summaryrefslogtreecommitdiff
path: root/spec/ruby/library/date/conversions_spec.rb
blob: a9a320b0fc2aea1d4678f33e9fb32fe12d170531 (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
require 'date'
require_relative '../../spec_helper'


describe "Date#new_start" do
  it "converts a date object into another with a new calendar reform" do
    Date.civil(1582, 10, 14, Date::ENGLAND).new_start.should == Date.civil(1582, 10, 24)
    Date.civil(1582, 10,  4, Date::ENGLAND).new_start.should == Date.civil(1582, 10,  4)
    Date.civil(1582, 10, 15).new_start(Date::ENGLAND).should == Date.civil(1582, 10,  5, Date::ENGLAND)
    Date.civil(1752,  9, 14).new_start(Date::ENGLAND).should == Date.civil(1752,  9, 14, Date::ENGLAND)
    Date.civil(1752,  9, 13).new_start(Date::ENGLAND).should == Date.civil(1752,  9,  2, Date::ENGLAND)
  end
end

describe "Date#italy" do
  it "converts a date object into another with the Italian calendar reform" do
    Date.civil(1582, 10, 14, Date::ENGLAND).italy.should == Date.civil(1582, 10, 24)
    Date.civil(1582, 10,  4, Date::ENGLAND).italy.should == Date.civil(1582, 10,  4)
  end
end

describe "Date#england" do
  it "converts a date object into another with the English calendar reform" do
    Date.civil(1582, 10, 15).england.should == Date.civil(1582, 10,  5, Date::ENGLAND)
    Date.civil(1752,  9, 14).england.should == Date.civil(1752,  9, 14, Date::ENGLAND)
    Date.civil(1752,  9, 13).england.should == Date.civil(1752,  9,  2, Date::ENGLAND)
  end
end

describe "Date#julian" do
  it "converts a date object into another with the Julian calendar" do
    Date.civil(1582, 10, 15).julian.should == Date.civil(1582, 10,  5, Date::JULIAN)
    Date.civil(1752,  9, 14).julian.should == Date.civil(1752,  9,  3, Date::JULIAN)
    Date.civil(1752,  9, 13).julian.should == Date.civil(1752,  9,  2, Date::JULIAN)
  end
end

describe "Date#gregorian" do
  it "converts a date object into another with the Gregorian calendar" do
    Date.civil(1582, 10,  4).gregorian.should == Date.civil(1582, 10, 14, Date::GREGORIAN)
    Date.civil(1752,  9, 14).gregorian.should == Date.civil(1752,  9, 14, Date::GREGORIAN)
  end
end
ph'>
-rw-r--r--NEWS679
-rw-r--r--README166
-rw-r--r--README.EXT241
-rw-r--r--README.EXT.ja149
-rw-r--r--README.ja192
-rw-r--r--README.ja.md163
-rw-r--r--README.md161
-rw-r--r--addr2line.c442
-rw-r--r--addr2line.h2
-rw-r--r--array.c1464
-rw-r--r--bcc32/Makefile.sub617
-rw-r--r--bcc32/README.bcc32130
-rwxr-xr-xbcc32/configure.bat163
-rwxr-xr-xbcc32/mkexports.rb26
-rw-r--r--bcc32/setup.mak179
-rw-r--r--benchmark/bm_app_aobench.rb291
-rw-r--r--benchmark/bm_app_lc_fizzbuzz.rb52
-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.rb4
-rw-r--r--benchmark/bm_hash_aref_sym_long.rb8
-rw-r--r--benchmark/bm_hash_flatten.rb9
-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.rb10
-rw-r--r--benchmark/bm_hash_values.rb9
-rw-r--r--benchmark/bm_securerandom.rb5
-rw-r--r--benchmark/bm_so_binary_trees.rb9
-rw-r--r--benchmark/bm_so_meteor_contest.rb12
-rw-r--r--benchmark/bm_vm1_gc_short_lived.rb10
-rw-r--r--benchmark/bm_vm1_gc_short_with_complex_long.rb27
-rw-r--r--benchmark/bm_vm1_gc_short_with_long.rb13
-rw-r--r--benchmark/bm_vm1_gc_short_with_symbol.rb15
-rw-r--r--benchmark/bm_vm1_gc_wb_ary.rb10
-rw-r--r--benchmark/bm_vm1_gc_wb_obj.rb13
-rw-r--r--benchmark/bm_vm2_newlambda.rb5
-rw-r--r--benchmark/bm_vm_thread_close.rb6
-rw-r--r--benchmark/bm_vm_thread_queue.rb18
-rw-r--r--benchmark/driver.rb26
-rw-r--r--benchmark/gc/aobench.rb1
-rw-r--r--benchmark/gc/binary_trees.rb1
-rw-r--r--benchmark/gc/gcbench.rb56
-rw-r--r--benchmark/gc/hash1.rb11
-rw-r--r--benchmark/gc/hash2.rb7
-rw-r--r--benchmark/gc/null.rb1
-rw-r--r--benchmark/gc/pentomino.rb1
-rw-r--r--benchmark/gc/rdoc.rb13
-rw-r--r--benchmark/gc/redblack.rb366
-rw-r--r--benchmark/gc/ring.rb29
-rw-r--r--benchmark/prepare_so_k_nucleotide.rb2
-rw-r--r--benchmark/prepare_so_reverse_complement.rb2
-rw-r--r--bignum.c7207
-rwxr-xr-xbin/erb4
-rwxr-xr-xbin/irb11
-rwxr-xr-xbin/rake4
-rwxr-xr-xbin/testrb3
-rwxr-xr-xbootstraptest/runner.rb48
-rw-r--r--bootstraptest/test_autoload.rb40
-rw-r--r--bootstraptest/test_class.rb10
-rw-r--r--bootstraptest/test_fork.rb28
-rw-r--r--bootstraptest/test_io.rb12
-rw-r--r--bootstraptest/test_literal.rb2
-rw-r--r--bootstraptest/test_literal_suffix.rb54
-rw-r--r--bootstraptest/test_method.rb48
-rw-r--r--bootstraptest/test_thread.rb72
-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.h635
-rw-r--r--ccan/str/str.h16
-rw-r--r--class.c582
-rw-r--r--common.mk322
-rw-r--r--compar.c19
-rw-r--r--compile.c538
-rw-r--r--complex.c229
-rw-r--r--configure.in1388
-rw-r--r--constant.h9
-rw-r--r--cont.c320
-rw-r--r--coverage/README17
-rw-r--r--debug.c7
-rw-r--r--defs/default_gems3
-rw-r--r--defs/gmake.mk63
-rw-r--r--defs/id.def25
-rw-r--r--defs/opt_operand.def2
-rw-r--r--dir.c570
-rw-r--r--dln.c58
-rw-r--r--dln.h19
-rw-r--r--dln_find.c51
-rw-r--r--dmyencoding.c2
-rw-r--r--dmyversion.c2
-rw-r--r--doc/ChangeLog-1.8.0152
-rw-r--r--doc/ChangeLog-1.9.38
-rw-r--r--doc/ChangeLog-2.0.024015
-rw-r--r--doc/ChangeLog-2.1.018060
-rw-r--r--doc/ChangeLog-YARV178
-rw-r--r--doc/NEWS-2.0.0531
-rw-r--r--doc/NEWS-2.1.0376
-rw-r--r--doc/contributing.rdoc466
-rw-r--r--doc/contributors.rdoc778
-rw-r--r--doc/dtrace_probes.rdoc178
-rw-r--r--doc/globals.rdoc6
-rw-r--r--doc/irb/irb.rd.ja52
-rw-r--r--doc/keywords.rdoc158
-rw-r--r--doc/maintainers.rdoc322
-rw-r--r--doc/marshal.rdoc313
-rw-r--r--doc/rake/CHANGES440
-rw-r--r--doc/rake/README196
-rw-r--r--doc/rake/command_line_usage.rdoc169
-rw-r--r--doc/rake/example/Rakefile138
-rw-r--r--doc/rake/example/Rakefile235
-rw-r--r--doc/rake/example/a.c6
-rw-r--r--doc/rake/example/b.c6
-rw-r--r--doc/rake/example/main.c11
-rw-r--r--doc/rake/glossary.rdoc51
-rw-r--r--doc/rake/jamis.rb591
-rw-r--r--doc/rake/proto_rake.rdoc127
-rw-r--r--doc/rake/rakefile.rdoc557
-rw-r--r--doc/rake/rational.rdoc151
-rw-r--r--doc/rake/release_notes/rake-0.8.7.rdoc55
-rw-r--r--doc/rake/release_notes/rake-0.9.0.rdoc112
-rw-r--r--doc/rake/release_notes/rake-0.9.1.rdoc52
-rw-r--r--doc/rake/release_notes/rake-0.9.2.2.rdoc55
-rw-r--r--doc/rake/release_notes/rake-0.9.2.rdoc49
-rw-r--r--doc/rake/release_notes/rake-0.9.3.rdoc102
-rw-r--r--doc/rake/release_notes/rake-0.9.4.rdoc110
-rw-r--r--doc/rake/release_notes/rake-0.9.5.rdoc114
-rw-r--r--doc/rake/release_notes/rake-0.9.6.rdoc127
-rw-r--r--doc/regexp.rdoc (renamed from doc/re.rdoc)149
-rw-r--r--doc/security.rdoc9
-rw-r--r--doc/standard_library.rdoc1
-rw-r--r--doc/syntax/assignment.rdoc12
-rw-r--r--doc/syntax/literals.rdoc17
-rw-r--r--doc/syntax/methods.rdoc59
-rw-r--r--doc/syntax/modules_and_classes.rdoc4
-rw-r--r--doc/syntax/refinements.rdoc34
-rw-r--r--enc/big5.c6
-rw-r--r--enc/depend8
-rw-r--r--enc/encdb.c4
-rw-r--r--enc/euc_jp.c53
-rw-r--r--enc/iso_8859_1.c2
-rw-r--r--enc/iso_8859_10.c4
-rw-r--r--enc/iso_8859_13.c4
-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.c2
-rw-r--r--enc/iso_8859_3.c4
-rw-r--r--enc/iso_8859_4.c4
-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
-rw-r--r--enc/shift_jis.c45
-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/trans/japanese_euc.trans4
-rw-r--r--enc/trans/utf8_mac-tbl.rb23655
-rw-r--r--enc/trans/utf8_mac.trans157
-rw-r--r--enc/unicode.c185
-rwxr-xr-xenc/unicode/case-folding.rb196
-rw-r--r--enc/unicode/casefold.h7831
-rw-r--r--enc/unicode/name2ctype.h9915
-rw-r--r--enc/us_ascii.c6
-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_8.c4
-rw-r--r--enc/windows_1251.c4
-rw-r--r--encoding.c279
-rw-r--r--enum.c705
-rw-r--r--enumerator.c264
-rw-r--r--error.c289
-rw-r--r--eval.c444
-rw-r--r--eval_error.c79
-rw-r--r--eval_intern.h84
-rw-r--r--eval_jump.c61
-rw-r--r--ext/-test-/bignum/big2str.c54
-rw-r--r--ext/-test-/bignum/bigzero.c27
-rw-r--r--ext/-test-/bignum/depend7
-rw-r--r--ext/-test-/bignum/div.c36
-rw-r--r--ext/-test-/bignum/extconf.rb7
-rw-r--r--ext/-test-/bignum/init.c11
-rw-r--r--ext/-test-/bignum/intpack.c88
-rw-r--r--ext/-test-/bignum/mul.c66
-rw-r--r--ext/-test-/bignum/str2big.c39
-rw-r--r--ext/-test-/bug-3571/bug.c2
-rw-r--r--ext/-test-/bug_reporter/bug_reporter.c24
-rw-r--r--ext/-test-/bug_reporter/extconf.rb1
-rw-r--r--ext/-test-/class/class2name.c14
-rw-r--r--ext/-test-/class/extconf.rb7
-rw-r--r--ext/-test-/class/init.c11
-rw-r--r--ext/-test-/debug/depend3
-rw-r--r--ext/-test-/debug/profile_frames.c43
-rw-r--r--ext/-test-/exception/dataerror.c31
-rw-r--r--ext/-test-/exception/depend3
-rw-r--r--ext/-test-/file/depend2
-rw-r--r--ext/-test-/file/extconf.rb7
-rw-r--r--ext/-test-/file/fs.c60
-rw-r--r--ext/-test-/file/init.c11
-rw-r--r--ext/-test-/file/stat.c27
-rw-r--r--ext/-test-/float/depend3
-rw-r--r--ext/-test-/float/extconf.rb7
-rw-r--r--ext/-test-/float/init.c11
-rw-r--r--ext/-test-/float/nextafter.c36
-rw-r--r--ext/-test-/iter/break.c4
-rw-r--r--ext/-test-/iter/extconf.rb8
-rw-r--r--ext/-test-/iter/init.c11
-rw-r--r--ext/-test-/iter/yield.c16
-rw-r--r--ext/-test-/num2int/depend1
-rw-r--r--ext/-test-/num2int/num2int.c130
-rw-r--r--ext/-test-/old_thread_select/depend2
-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-/postponed_job/depend1
-rw-r--r--ext/-test-/postponed_job/extconf.rb1
-rw-r--r--ext/-test-/postponed_job/postponed_job.c53
-rw-r--r--ext/-test-/printf/depend3
-rw-r--r--ext/-test-/printf/printf.c79
-rw-r--r--ext/-test-/rational/depend3
-rw-r--r--ext/-test-/rational/extconf.rb7
-rw-r--r--ext/-test-/rational/rat.c38
-rw-r--r--ext/-test-/recursion/extconf.rb2
-rw-r--r--ext/-test-/recursion/recursion.c28
-rw-r--r--ext/-test-/string/coderange.c21
-rw-r--r--ext/-test-/string/cstr.c8
-rw-r--r--ext/-test-/string/depend5
-rw-r--r--ext/-test-/string/extconf.rb1
-rw-r--r--ext/-test-/string/normalize.c18
-rw-r--r--ext/-test-/struct/extconf.rb7
-rw-r--r--ext/-test-/struct/init.c11
-rw-r--r--ext/-test-/struct/member.c18
-rw-r--r--ext/-test-/symbol/extconf.rb3
-rw-r--r--ext/-test-/symbol/init.c7
-rw-r--r--ext/-test-/symbol/intern.c14
-rw-r--r--ext/-test-/symbol/type.c78
-rw-r--r--ext/-test-/tracepoint/depend1
-rw-r--r--ext/-test-/tracepoint/extconf.rb1
-rw-r--r--ext/-test-/tracepoint/gc_hook.c80
-rw-r--r--ext/-test-/tracepoint/tracepoint.c96
-rw-r--r--ext/-test-/wait_for_single_fd/depend6
-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.rb8
-rw-r--r--ext/-test-/win32/console/init.c11
-rw-r--r--ext/-test-/win32/dln/empty/empty.c4
-rw-r--r--ext/-test-/win32/dln/empty/extconf.rb3
-rw-r--r--ext/-test-/win32/dln/extconf.rb1
-rw-r--r--ext/-test-/win32/dln/libdlntest.c2
-rw-r--r--ext/-test-/win32/fd_setsize/depend3
-rw-r--r--ext/.document8
-rw-r--r--ext/Setup1
-rw-r--r--ext/Setup.atheos1
-rw-r--r--ext/Setup.emx3
-rw-r--r--ext/Setup.nacl3
-rw-r--r--ext/Setup.nt2
-rw-r--r--ext/bigdecimal/bigdecimal.c3833
-rw-r--r--ext/bigdecimal/bigdecimal.gemspec7
-rw-r--r--ext/bigdecimal/bigdecimal.h38
-rw-r--r--ext/bigdecimal/depend2
-rw-r--r--ext/bigdecimal/lib/bigdecimal/jacobian.rb3
-rw-r--r--ext/bigdecimal/lib/bigdecimal/math.rb90
-rw-r--r--ext/bigdecimal/lib/bigdecimal/newton.rb3
-rw-r--r--ext/bigdecimal/lib/bigdecimal/util.rb36
-rw-r--r--ext/bigdecimal/sample/linear.rb21
-rw-r--r--ext/bigdecimal/sample/nlsolve.rb23
-rw-r--r--ext/coverage/coverage.c2
-rw-r--r--ext/coverage/depend11
-rw-r--r--ext/coverage/extconf.rb1
-rw-r--r--ext/curses/curses.c4329
-rw-r--r--ext/curses/depend1
-rw-r--r--ext/curses/extconf.rb116
-rw-r--r--ext/curses/hello.rb30
-rw-r--r--ext/curses/mouse.rb53
-rw-r--r--ext/curses/rain.rb76
-rw-r--r--ext/curses/view.rb91
-rw-r--r--ext/curses/view2.rb149
-rw-r--r--ext/date/date_core.c183
-rw-r--r--ext/date/date_parse.c10
-rw-r--r--ext/date/date_strptime.c14
-rw-r--r--ext/date/depend6
-rw-r--r--ext/date/lib/date.rb1
-rw-r--r--ext/date/lib/date/format.rb1
-rw-r--r--ext/dbm/dbm.c36
-rw-r--r--ext/dbm/depend1
-rw-r--r--ext/dbm/extconf.rb18
-rw-r--r--ext/digest/bubblebabble/bubblebabble.c32
-rw-r--r--ext/digest/bubblebabble/depend4
-rw-r--r--ext/digest/depend3
-rw-r--r--ext/digest/digest.c75
-rw-r--r--ext/digest/digest.h6
-rw-r--r--ext/digest/lib/digest.rb10
-rw-r--r--ext/digest/lib/digest/hmac.rb302
-rw-r--r--ext/digest/md5/depend7
-rw-r--r--ext/digest/md5/md5.c8
-rw-r--r--ext/digest/md5/md5.h4
-rw-r--r--ext/digest/rmd160/depend7
-rw-r--r--ext/digest/rmd160/rmd160.c6
-rw-r--r--ext/digest/rmd160/rmd160.h4
-rw-r--r--ext/digest/sha1/depend9
-rw-r--r--ext/digest/sha1/sha1.c6
-rw-r--r--ext/digest/sha1/sha1.h4
-rw-r--r--ext/digest/sha2/depend9
-rw-r--r--ext/digest/sha2/sha2.c33
-rw-r--r--ext/digest/sha2/sha2.h30
-rw-r--r--ext/dl/callback/depend2
-rw-r--r--ext/dl/callback/extconf.rb2
-rw-r--r--ext/dl/cfunc.c22
-rw-r--r--ext/dl/cptr.c10
-rw-r--r--ext/dl/depend15
-rw-r--r--ext/dl/dl.c10
-rw-r--r--ext/dl/dl.h2
-rw-r--r--ext/dl/extconf.rb7
-rw-r--r--ext/dl/handle.c1
-rw-r--r--ext/dl/win32/extconf.rb3
-rw-r--r--ext/etc/depend10
-rw-r--r--ext/etc/etc.c397
-rw-r--r--ext/etc/extconf.rb59
-rw-r--r--ext/etc/mkconstants.rb331
-rwxr-xr-xext/extmk.rb121
-rw-r--r--ext/fcntl/depend1
-rw-r--r--ext/fiddle/closure.c20
-rw-r--r--ext/fiddle/depend4
-rw-r--r--ext/fiddle/extconf.rb6
-rw-r--r--ext/fiddle/fiddle.c10
-rw-r--r--ext/fiddle/function.c49
-rw-r--r--ext/fiddle/handle.c15
-rw-r--r--ext/fiddle/lib/fiddle.rb9
-rw-r--r--ext/fiddle/lib/fiddle/import.rb4
-rw-r--r--ext/fiddle/pointer.c19
-rw-r--r--ext/fiddle/win32/extconf.rb3
-rw-r--r--ext/fiddle/win32/lib/win32/registry.rb845
-rw-r--r--ext/fiddle/win32/lib/win32/resolv.rb379
-rw-r--r--ext/gdbm/depend1
-rw-r--r--ext/gdbm/gdbm.c17
-rw-r--r--ext/io/console/console.c38
-rw-r--r--ext/io/console/depend4
-rw-r--r--ext/io/console/extconf.rb12
-rw-r--r--ext/io/console/io-console.gemspec3
-rw-r--r--ext/io/console/lib/console/size.rb2
-rw-r--r--ext/io/nonblock/depend4
-rw-r--r--ext/io/nonblock/nonblock.c31
-rw-r--r--ext/io/wait/depend4
-rw-r--r--ext/io/wait/wait.c2
-rw-r--r--ext/json/fbuffer/fbuffer.h9
-rw-r--r--ext/json/generator/depend1
-rw-r--r--ext/json/generator/generator.c27
-rw-r--r--ext/json/lib/json/common.rb12
-rw-r--r--ext/json/lib/json/generic_object.rb9
-rw-r--r--ext/json/lib/json/version.rb2
-rw-r--r--ext/json/parser/depend1
-rw-r--r--ext/json/parser/parser.c64
-rw-r--r--ext/json/parser/prereq.mk3
-rw-r--r--ext/nkf/depend4
-rw-r--r--ext/nkf/nkf-utf8/nkf.c24
-rw-r--r--ext/nkf/nkf-utf8/nkf.h4
-rw-r--r--ext/nkf/nkf-utf8/utf8tbl.c1
-rw-r--r--ext/nkf/nkf-utf8/utf8tbl.h1
-rw-r--r--ext/objspace/depend13
-rw-r--r--ext/objspace/object_tracing.c493
-rw-r--r--ext/objspace/objspace.c363
-rw-r--r--ext/objspace/objspace.h20
-rw-r--r--ext/objspace/objspace_dump.c431
-rw-r--r--ext/openssl/depend6
-rw-r--r--ext/openssl/extconf.rb5
-rw-r--r--ext/openssl/lib/openssl/bn.rb5
-rw-r--r--ext/openssl/lib/openssl/buffering.rb48
-rw-r--r--ext/openssl/lib/openssl/config.rb169
-rw-r--r--ext/openssl/lib/openssl/digest.rb27
-rw-r--r--ext/openssl/lib/openssl/ssl.rb70
-rw-r--r--ext/openssl/openssl_missing.c4
-rw-r--r--ext/openssl/ossl.c145
-rw-r--r--ext/openssl/ossl.h14
-rw-r--r--ext/openssl/ossl_asn1.c51
-rw-r--r--ext/openssl/ossl_bio.c2
-rw-r--r--ext/openssl/ossl_bn.c44
-rw-r--r--ext/openssl/ossl_cipher.c10
-rw-r--r--ext/openssl/ossl_config.c9
-rw-r--r--ext/openssl/ossl_digest.c2
-rw-r--r--ext/openssl/ossl_engine.c175
-rw-r--r--ext/openssl/ossl_hmac.c102
-rw-r--r--ext/openssl/ossl_ocsp.c500
-rw-r--r--ext/openssl/ossl_pkcs7.c20
-rw-r--r--ext/openssl/ossl_pkey.c7
-rw-r--r--ext/openssl/ossl_pkey_dh.c7
-rw-r--r--ext/openssl/ossl_pkey_dsa.c2
-rw-r--r--ext/openssl/ossl_pkey_ec.c6
-rw-r--r--ext/openssl/ossl_pkey_rsa.c5
-rw-r--r--ext/openssl/ossl_ssl.c124
-rw-r--r--ext/openssl/ossl_x509attr.c4
-rw-r--r--ext/openssl/ossl_x509cert.c38
-rw-r--r--ext/openssl/ossl_x509name.c9
-rw-r--r--ext/openssl/ossl_x509store.c8
-rw-r--r--ext/pathname/depend3
-rw-r--r--ext/pathname/extconf.rb1
-rw-r--r--ext/pathname/lib/pathname.rb22
-rw-r--r--ext/pathname/pathname.c90
-rw-r--r--ext/psych/depend3
-rw-r--r--ext/psych/lib/psych.rb261
-rw-r--r--ext/psych/lib/psych/class_loader.rb101
-rw-r--r--ext/psych/lib/psych/deprecated.rb3
-rw-r--r--ext/psych/lib/psych/exception.rb13
-rw-r--r--ext/psych/lib/psych/json/stream.rb1
-rw-r--r--ext/psych/lib/psych/nodes/node.rb4
-rw-r--r--ext/psych/lib/psych/nodes/sequence.rb2
-rw-r--r--ext/psych/lib/psych/scalar_scanner.rb29
-rw-r--r--ext/psych/lib/psych/stream.rb1
-rw-r--r--ext/psych/lib/psych/streaming.rb15
-rw-r--r--ext/psych/lib/psych/syntax_error.rb7
-rw-r--r--ext/psych/lib/psych/visitors/json_tree.rb7
-rw-r--r--ext/psych/lib/psych/visitors/to_ruby.rb130
-rw-r--r--ext/psych/lib/psych/visitors/yaml_tree.rb94
-rw-r--r--ext/psych/psych.gemspec17
-rw-r--r--ext/psych/psych_to_ruby.c4
-rw-r--r--ext/psych/yaml/api.c55
-rw-r--r--ext/psych/yaml/config.h9
-rw-r--r--ext/psych/yaml/emitter.c2
-rw-r--r--ext/psych/yaml/loader.c33
-rw-r--r--ext/psych/yaml/parser.c12
-rw-r--r--ext/psych/yaml/reader.c4
-rw-r--r--ext/psych/yaml/scanner.c73
-rw-r--r--ext/psych/yaml/yaml.h4
-rw-r--r--ext/psych/yaml/yaml_private.h27
-rw-r--r--ext/pty/depend7
-rw-r--r--ext/pty/pty.c27
-rw-r--r--ext/racc/cparse/README3
-rw-r--r--ext/racc/cparse/cparse.c54
-rw-r--r--ext/racc/cparse/depend1
-rw-r--r--ext/rbconfig/sizeof/depend3
-rw-r--r--ext/rbconfig/sizeof/extconf.rb3
-rw-r--r--ext/readline/README.ja51
-rw-r--r--ext/readline/depend7
-rw-r--r--ext/readline/extconf.rb13
-rw-r--r--ext/readline/readline.c836
-rw-r--r--ext/ripper/depend17
-rw-r--r--ext/ripper/eventids2.c6
-rw-r--r--ext/ripper/lib/ripper/lexer.rb4
-rw-r--r--ext/sdbm/_sdbm.c4
-rw-r--r--ext/sdbm/depend4
-rw-r--r--ext/sdbm/init.c53
-rw-r--r--ext/socket/.document1
-rw-r--r--ext/socket/ancdata.c126
-rw-r--r--ext/socket/basicsocket.c41
-rw-r--r--ext/socket/constants.c2
-rw-r--r--ext/socket/depend8
-rw-r--r--ext/socket/extconf.rb792
-rw-r--r--ext/socket/getaddrinfo.c10
-rw-r--r--ext/socket/getnameinfo.c8
-rw-r--r--ext/socket/ifaddr.c459
-rw-r--r--ext/socket/init.c129
-rw-r--r--ext/socket/ipsocket.c66
-rw-r--r--ext/socket/lib/socket.rb84
-rw-r--r--ext/socket/mkconstants.rb153
-rw-r--r--ext/socket/option.c557
-rw-r--r--ext/socket/raddrinfo.c561
-rw-r--r--ext/socket/rubysocket.h258
-rw-r--r--ext/socket/socket.c417
-rw-r--r--ext/socket/sockport.h86
-rw-r--r--ext/socket/tcpserver.c27
-rw-r--r--ext/socket/tcpsocket.c4
-rw-r--r--ext/socket/udpsocket.c39
-rw-r--r--ext/socket/unixserver.c6
-rw-r--r--ext/socket/unixsocket.c48
-rw-r--r--ext/stringio/depend7
-rw-r--r--ext/stringio/stringio.c122
-rw-r--r--ext/strscan/depend9
-rw-r--r--ext/strscan/strscan.c117
-rw-r--r--ext/syslog/depend4
-rw-r--r--ext/syslog/lib/syslog/logger.rb26
-rw-r--r--ext/syslog/syslog.c13
-rw-r--r--ext/thread/extconf.rb3
-rw-r--r--ext/thread/thread.c653
-rw-r--r--ext/tk/ChangeLog.tkextlib2
-rw-r--r--ext/tk/MANUAL_tcltklib.eng24
-rw-r--r--ext/tk/MANUAL_tcltklib.ja (renamed from ext/tk/MANUAL_tcltklib.eucj)0
-rw-r--r--ext/tk/README.1st2
-rw-r--r--ext/tk/README.ActiveTcl2
-rw-r--r--ext/tk/README.tcltklib18
-rw-r--r--ext/tk/extconf.rb103
-rw-r--r--ext/tk/lib/multi-tk.rb2
-rw-r--r--ext/tk/lib/tcltk.rb4
-rw-r--r--ext/tk/lib/tk/canvas.rb2
-rw-r--r--ext/tk/lib/tk/image.rb2
-rw-r--r--ext/tk/lib/tk/msgcat.rb41
-rw-r--r--ext/tk/lib/tk/namespace.rb7
-rw-r--r--ext/tk/lib/tk/text.rb2
-rw-r--r--ext/tk/lib/tkextlib/SUPPORT_STATUS15
-rw-r--r--ext/tk/lib/tkextlib/blt/component.rb2
-rw-r--r--ext/tk/lib/tkextlib/blt/tree.rb2
-rw-r--r--ext/tk/lib/tkextlib/blt/treeview.rb2
-rw-r--r--ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb2
-rwxr-xr-xext/tk/lib/tkextlib/pkg_checker.rb2
-rw-r--r--ext/tk/lib/tkextlib/tcllib/plotchart.rb2
-rw-r--r--ext/tk/lib/tkextlib/tile/style.rb4
-rw-r--r--ext/tk/lib/tkextlib/tkDND/tkdnd.rb2
-rw-r--r--ext/tk/lib/tkextlib/tktable/tktable.rb2
-rw-r--r--ext/tk/old-README.tcltklib.ja (renamed from ext/tk/old-README.tcltklib.eucj)0
-rw-r--r--ext/tk/sample/figmemo_sample.rb2
-rw-r--r--ext/tk/sample/msgs_tk/README2
-rw-r--r--ext/tk/sample/scrollframe.rb2
-rw-r--r--ext/tk/sample/tkextlib/blt/readme.txt2
-rw-r--r--ext/tk/sample/tkextlib/bwidget/Orig_LICENSE.txt12
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/catalog_demo/Orig_LICENSE.txt24
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/notebook.rb2
-rw-r--r--ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb2
-rw-r--r--ext/tk/sample/tkextlib/tcllib/Orig_LICENSE.txt8
-rw-r--r--ext/tk/sample/tkextlib/tkimg/demo.rb2
-rw-r--r--ext/tk/sample/tkextlib/tkimg/readme.txt2
-rw-r--r--ext/tk/sample/tkextlib/tktable/Orig_LICENSE.txt4
-rw-r--r--ext/tk/sample/tkextlib/treectrl/readme.txt2
-rw-r--r--ext/tk/sample/tkextlib/vu/Orig_LICENSE.txt4
-rw-r--r--ext/tk/sample/tktextframe.rb2
-rw-r--r--ext/tk/stubs.c14
-rw-r--r--ext/tk/tcltklib.c298
-rw-r--r--ext/tk/tkutil/extconf.rb7
-rw-r--r--ext/tk/tkutil/tkutil.c86
-rw-r--r--ext/win32/extconf.rb3
-rw-r--r--ext/win32/lib/Win32API.rb (renamed from ext/dl/win32/lib/Win32API.rb)0
-rw-r--r--ext/win32/lib/win32/importer.rb14
-rw-r--r--ext/win32/lib/win32/registry.rb (renamed from ext/dl/win32/lib/win32/registry.rb)129
-rw-r--r--ext/win32/lib/win32/resolv.rb (renamed from ext/dl/win32/lib/win32/resolv.rb)5
-rw-r--r--ext/win32/lib/win32/sspi.rb (renamed from ext/dl/win32/lib/win32/sspi.rb)2
-rw-r--r--ext/win32ole/depend13
-rw-r--r--ext/win32ole/sample/excel2.rb7
-rw-r--r--ext/win32ole/sample/olegen.rb8
-rw-r--r--ext/win32ole/win32ole.c6061
-rw-r--r--ext/win32ole/win32ole.h161
-rw-r--r--ext/win32ole/win32ole_error.c82
-rw-r--r--ext/win32ole/win32ole_error.h8
-rw-r--r--ext/win32ole/win32ole_event.c1258
-rw-r--r--ext/win32ole/win32ole_event.h6
-rw-r--r--ext/win32ole/win32ole_method.c928
-rw-r--r--ext/win32ole/win32ole_method.h15
-rw-r--r--ext/win32ole/win32ole_param.c418
-rw-r--r--ext/win32ole/win32ole_param.h8
-rw-r--r--ext/win32ole/win32ole_record.c577
-rw-r--r--ext/win32ole/win32ole_record.h10
-rw-r--r--ext/win32ole/win32ole_type.c901
-rw-r--r--ext/win32ole/win32ole_type.h8
-rw-r--r--ext/win32ole/win32ole_typelib.c832
-rw-r--r--ext/win32ole/win32ole_typelib.h11
-rw-r--r--ext/win32ole/win32ole_variable.c366
-rw-r--r--ext/win32ole/win32ole_variable.h8
-rw-r--r--ext/win32ole/win32ole_variant.c707
-rw-r--r--ext/win32ole/win32ole_variant.h13
-rw-r--r--ext/win32ole/win32ole_variant_m.c148
-rw-r--r--ext/win32ole/win32ole_variant_m.h7
-rw-r--r--ext/zlib/depend5
-rw-r--r--ext/zlib/zlib.c82
-rw-r--r--file.c512
-rw-r--r--gc.c7145
-rw-r--r--gc.h21
-rw-r--r--gems/bundled_gems3
-rw-r--r--golf_prelude.rb37
-rw-r--r--goruby.c8
-rw-r--r--hash.c1061
-rw-r--r--include/ruby/backward/classext.h2
-rw-r--r--include/ruby/backward/rubysig.h13
-rw-r--r--include/ruby/debug.h29
-rw-r--r--include/ruby/defines.h155
-rw-r--r--include/ruby/encoding.h74
-rw-r--r--include/ruby/intern.h262
-rw-r--r--include/ruby/io.h23
-rw-r--r--include/ruby/missing.h20
-rw-r--r--include/ruby/oniguruma.h62
-rw-r--r--include/ruby/re.h8
-rw-r--r--include/ruby/regex.h8
-rw-r--r--include/ruby/ruby.h644
-rw-r--r--include/ruby/st.h42
-rw-r--r--include/ruby/thread.h8
-rw-r--r--include/ruby/thread_native.h56
-rw-r--r--include/ruby/util.h15
-rw-r--r--include/ruby/version.h10
-rw-r--r--include/ruby/vm.h8
-rw-r--r--include/ruby/win32.h114
-rw-r--r--inits.c2
-rw-r--r--insns.def221
-rw-r--r--internal.h776
-rw-r--r--io.c1287
-rw-r--r--iseq.c379
-rw-r--r--iseq.h47
-rw-r--r--lib/English.rb4
-rw-r--r--[-rwxr-xr-x]lib/abbrev.rb95
-rw-r--r--lib/base64.rb2
-rw-r--r--lib/benchmark.rb117
-rw-r--r--lib/cgi.rb23
-rw-r--r--lib/cgi/cookie.rb59
-rw-r--r--lib/cgi/core.rb68
-rw-r--r--lib/cgi/html.rb297
-rw-r--r--lib/cgi/session.rb8
-rw-r--r--lib/cgi/session/pstore.rb13
-rw-r--r--lib/cgi/util.rb56
-rw-r--r--lib/cmath.rb114
-rw-r--r--lib/complex.rb28
-rw-r--r--lib/csv.rb72
-rw-r--r--lib/debug.rb22
-rw-r--r--lib/delegate.rb110
-rw-r--r--lib/drb/acl.rb20
-rw-r--r--lib/drb/drb.rb20
-rw-r--r--lib/drb/extserv.rb30
-rw-r--r--lib/drb/invokemethod.rb4
-rw-r--r--lib/drb/ssl.rb11
-rw-r--r--lib/e2mmap.rb26
-rw-r--r--lib/erb.rb21
-rw-r--r--lib/fileutils.rb296
-rw-r--r--lib/find.rb46
-rw-r--r--lib/forwardable.rb44
-rw-r--r--lib/getoptlong.rb2
-rw-r--r--lib/gserver.rb310
-rw-r--r--lib/ipaddr.rb277
-rw-r--r--lib/irb.rb43
-rw-r--r--lib/irb/cmd/chws.rb6
-rw-r--r--lib/irb/cmd/fork.rb29
-rw-r--r--lib/irb/cmd/load.rb48
-rw-r--r--lib/irb/cmd/nop.rb11
-rw-r--r--lib/irb/cmd/pushws.rb10
-rw-r--r--lib/irb/cmd/subirb.rb8
-rw-r--r--lib/irb/completion.rb304
-rw-r--r--lib/irb/context.rb175
-rw-r--r--lib/irb/ext/change-ws.rb34
-rw-r--r--lib/irb/ext/history.rb58
-rw-r--r--lib/irb/ext/loader.rb118
-rw-r--r--lib/irb/ext/math-mode.rb8
-rw-r--r--lib/irb/ext/multi-irb.rb175
-rw-r--r--lib/irb/ext/save-history.rb67
-rw-r--r--lib/irb/ext/tracer.rb26
-rw-r--r--lib/irb/ext/use-loader.rb28
-rw-r--r--lib/irb/ext/workspaces.rb26
-rw-r--r--lib/irb/extend-command.rb218
-rw-r--r--lib/irb/frame.rb4
-rw-r--r--lib/irb/help.rb18
-rw-r--r--lib/irb/init.rb212
-rw-r--r--lib/irb/input-method.rb36
-rw-r--r--lib/irb/inspector.rb16
-rw-r--r--lib/irb/lc/help-message26
-rw-r--r--lib/irb/lc/ja/help-message20
-rw-r--r--lib/irb/locale.rb71
-rw-r--r--lib/irb/notifier.rb82
-rw-r--r--lib/irb/output-method.rb6
-rw-r--r--lib/irb/ruby-lex.rb701
-rw-r--r--lib/irb/ruby-token.rb29
-rw-r--r--lib/irb/slex.rb261
-rw-r--r--lib/irb/workspace.rb114
-rw-r--r--lib/irb/xmp.rb38
-rw-r--r--lib/logger.rb259
-rw-r--r--lib/mathn.rb151
-rw-r--r--lib/matrix.rb63
-rw-r--r--lib/matrix/eigenvalue_decomposition.rb6
-rw-r--r--lib/minitest/.document2
-rw-r--r--lib/minitest/autorun.rb19
-rw-r--r--lib/minitest/hell.rb16
-rw-r--r--lib/minitest/parallel_each.rb36
-rw-r--r--lib/minitest/pride.rb119
-rw-r--r--lib/minitest/spec.rb541
-rw-r--r--lib/mkmf.rb282
-rw-r--r--lib/net/ftp.rb71
-rw-r--r--lib/net/http.rb25
-rw-r--r--lib/net/http/generic_request.rb61
-rw-r--r--lib/net/http/header.rb10
-rw-r--r--lib/net/http/requests.rb2
-rw-r--r--lib/net/http/response.rb13
-rw-r--r--lib/net/http/responses.rb9
-rw-r--r--lib/net/imap.rb486
-rw-r--r--lib/net/pop.rb8
-rw-r--r--lib/net/protocol.rb8
-rw-r--r--lib/net/smtp.rb40
-rw-r--r--lib/net/telnet.rb2
-rw-r--r--lib/observer.rb17
-rw-r--r--lib/open-uri.rb51
-rw-r--r--lib/open3.rb225
-rw-r--r--lib/optionparser.rb1
-rw-r--r--lib/optparse.rb110
-rw-r--r--lib/optparse/version.rb2
-rw-r--r--lib/ostruct.rb14
-rw-r--r--lib/pp.rb140
-rw-r--r--lib/prettyprint.rb223
-rw-r--r--lib/prime.rb132
-rw-r--r--lib/profiler.rb9
-rw-r--r--lib/pstore.rb22
-rw-r--r--lib/racc/parser.rb20
-rw-r--r--lib/racc/rdoc/grammar.en.rdoc83
-rw-r--r--lib/rake.rb9
-rw-r--r--lib/rake/alt_system.rb15
-rw-r--r--lib/rake/application.rb393
-rw-r--r--lib/rake/backtrace.rb21
-rw-r--r--lib/rake/classic_namespace.rb11
-rw-r--r--lib/rake/clean.rb52
-rw-r--r--lib/rake/cloneable.rb8
-rw-r--r--lib/rake/contrib/.document1
-rw-r--r--lib/rake/contrib/ftptools.rb32
-rw-r--r--lib/rake/contrib/publisher.rb16
-rw-r--r--lib/rake/contrib/rubyforgepublisher.rb4
-rw-r--r--lib/rake/contrib/sshpublisher.rb23
-rw-r--r--lib/rake/contrib/sys.rb194
-rw-r--r--lib/rake/cpu_counter.rb110
-rw-r--r--lib/rake/default_loader.rb4
-rw-r--r--lib/rake/dsl_definition.rb105
-rw-r--r--lib/rake/early_time.rb5
-rw-r--r--lib/rake/ext/core.rb10
-rw-r--r--lib/rake/ext/module.rb39
-rw-r--r--lib/rake/ext/pathname.rb25
-rw-r--r--lib/rake/ext/string.rb69
-rw-r--r--lib/rake/ext/time.rb2
-rw-r--r--lib/rake/file_list.rb78
-rw-r--r--lib/rake/file_task.rb9
-rw-r--r--lib/rake/file_utils.rb40
-rw-r--r--lib/rake/file_utils_ext.rb6
-rw-r--r--lib/rake/gempackagetask.rb17
-rw-r--r--lib/rake/invocation_chain.rb43
-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/name_space.rb59
-rw-r--r--lib/rake/packagetask.rb47
-rw-r--r--lib/rake/pathmap.rb2
-rw-r--r--lib/rake/promise.rb2
-rw-r--r--lib/rake/pseudo_status.rb9
-rw-r--r--lib/rake/rake_module.rb11
-rw-r--r--lib/rake/rdoctask.rb236
-rw-r--r--lib/rake/ruby182_test_unit_fix.rb8
-rw-r--r--lib/rake/runtest.rb11
-rw-r--r--lib/rake/scope.rb42
-rw-r--r--lib/rake/task.rb139
-rw-r--r--lib/rake/task_arguments.rb40
-rw-r--r--lib/rake/task_manager.rb89
-rw-r--r--lib/rake/tasklib.rb4
-rw-r--r--lib/rake/testtask.rb44
-rw-r--r--lib/rake/thread_history_display.rb2
-rw-r--r--lib/rake/thread_pool.rb37
-rw-r--r--lib/rake/trace_output.rb7
-rw-r--r--lib/rake/version.rb10
-rw-r--r--lib/rake/win32.rb7
-rw-r--r--lib/rational.rb23
-rw-r--r--lib/rbconfig/obsolete.rb38
-rw-r--r--lib/rdoc.rb9
-rw-r--r--lib/rdoc/any_method.rb62
-rw-r--r--lib/rdoc/class_module.rb32
-rw-r--r--lib/rdoc/code_object.rb121
-rw-r--r--lib/rdoc/comment.rb3
-rw-r--r--lib/rdoc/constant.rb10
-rw-r--r--lib/rdoc/context.rb33
-rw-r--r--lib/rdoc/cross_reference.rb2
-rw-r--r--lib/rdoc/encoding.rb4
-rw-r--r--lib/rdoc/extend.rb116
-rw-r--r--lib/rdoc/generator.rb1
-rw-r--r--lib/rdoc/generator/darkfish.rb53
-rw-r--r--lib/rdoc/generator/pot.rb97
-rw-r--r--lib/rdoc/generator/pot/message_extractor.rb67
-rw-r--r--lib/rdoc/generator/pot/po.rb83
-rw-r--r--lib/rdoc/generator/pot/po_entry.rb140
-rw-r--r--lib/rdoc/generator/template/darkfish/_footer.rhtml8
-rw-r--r--lib/rdoc/generator/template/darkfish/_head.rhtml21
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml7
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml6
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml7
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml7
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml7
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml9
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml8
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml14
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml10
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml7
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml18
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml9
-rw-r--r--lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml13
-rw-r--r--lib/rdoc/generator/template/darkfish/class.rhtml77
-rw-r--r--lib/rdoc/generator/template/darkfish/fonts.css167
-rw-r--r--lib/rdoc/generator/template/darkfish/fonts/Lato-Light.ttfbin0 -> 94668 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttfbin0 -> 94196 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttfbin0 -> 96184 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttfbin0 -> 95316 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttfbin0 -> 71200 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttfbin0 -> 71692 bytes-rw-r--r--[-rwxr-xr-x]lib/rdoc/generator/template/darkfish/images/add.pngbin733 -> 733 bytes-rw-r--r--[-rwxr-xr-x]lib/rdoc/generator/template/darkfish/images/arrow_up.pngbin372 -> 372 bytes-rw-r--r--[-rwxr-xr-x]lib/rdoc/generator/template/darkfish/images/delete.pngbin715 -> 715 bytes-rw-r--r--[-rwxr-xr-x]lib/rdoc/generator/template/darkfish/images/tag_blue.pngbin1880 -> 1880 bytes-rw-r--r--lib/rdoc/generator/template/darkfish/index.rhtml18
-rw-r--r--lib/rdoc/generator/template/darkfish/js/darkfish.js58
-rw-r--r--lib/rdoc/generator/template/darkfish/js/jquery.js22
-rw-r--r--lib/rdoc/generator/template/darkfish/js/search.js25
-rw-r--r--lib/rdoc/generator/template/darkfish/page.rhtml18
-rw-r--r--lib/rdoc/generator/template/darkfish/rdoc.css479
-rw-r--r--lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml10
-rw-r--r--lib/rdoc/generator/template/darkfish/servlet_root.rhtml38
-rw-r--r--lib/rdoc/generator/template/darkfish/table_of_contents.rhtml31
-rw-r--r--lib/rdoc/i18n.rb9
-rw-r--r--lib/rdoc/i18n/locale.rb101
-rw-r--r--lib/rdoc/i18n/text.rb125
-rw-r--r--lib/rdoc/include.rb118
-rw-r--r--lib/rdoc/known_classes.rb1
-rw-r--r--lib/rdoc/markdown.rb2169
-rw-r--r--lib/rdoc/markdown/literals_1_9.rb27
-rw-r--r--lib/rdoc/markup.rb29
-rw-r--r--lib/rdoc/markup/attribute_manager.rb7
-rw-r--r--lib/rdoc/markup/formatter.rb6
-rw-r--r--lib/rdoc/markup/heading.rb13
-rw-r--r--lib/rdoc/markup/parser.rb13
-rw-r--r--lib/rdoc/markup/pre_process.rb2
-rw-r--r--lib/rdoc/markup/to_html.rb105
-rw-r--r--lib/rdoc/markup/to_html_crossref.rb3
-rw-r--r--lib/rdoc/markup/to_joined_paragraph.rb2
-rw-r--r--lib/rdoc/markup/to_markdown.rb12
-rw-r--r--lib/rdoc/markup/verbatim.rb2
-rw-r--r--lib/rdoc/method_attr.rb28
-rw-r--r--lib/rdoc/mixin.rb120
-rw-r--r--lib/rdoc/normal_class.rb4
-rw-r--r--lib/rdoc/normal_module.rb4
-rw-r--r--lib/rdoc/options.rb140
-rw-r--r--lib/rdoc/parser.rb17
-rw-r--r--lib/rdoc/parser/c.rb66
-rw-r--r--lib/rdoc/parser/changelog.rb10
-rw-r--r--lib/rdoc/parser/ruby.rb1169
-rw-r--r--lib/rdoc/rd/block_parser.rb6
-rw-r--r--lib/rdoc/rd/inline_parser.rb2
-rw-r--r--lib/rdoc/rdoc.rb17
-rw-r--r--lib/rdoc/ri/driver.rb281
-rw-r--r--lib/rdoc/ri/paths.rb12
-rw-r--r--lib/rdoc/ruby_lex.rb235
-rw-r--r--lib/rdoc/ruby_token.rb95
-rw-r--r--lib/rdoc/rubygems_hook.rb19
-rw-r--r--lib/rdoc/servlet.rb41
-rw-r--r--lib/rdoc/stats.rb109
-rw-r--r--lib/rdoc/stats/normal.rb33
-rw-r--r--lib/rdoc/store.rb8
-rw-r--r--lib/rdoc/task.rb2
-rw-r--r--lib/rdoc/test_case.rb39
-rw-r--r--lib/rdoc/text.rb11
-rw-r--r--lib/rdoc/token_stream.rb2
-rw-r--r--lib/rdoc/tom_doc.rb32
-rw-r--r--lib/rdoc/top_level.rb4
-rw-r--r--lib/resolv.rb502
-rw-r--r--lib/rexml/attribute.rb9
-rw-r--r--lib/rexml/document.rb30
-rw-r--r--lib/rexml/dtd/dtd.rb5
-rw-r--r--lib/rexml/element.rb15
-rw-r--r--lib/rexml/entity.rb2
-rw-r--r--lib/rexml/formatters/pretty.rb2
-rw-r--r--lib/rexml/functions.rb2
-rw-r--r--lib/rexml/parsers/baseparser.rb28
-rw-r--r--lib/rexml/parsers/sax2parser.rb30
-rw-r--r--lib/rexml/parsers/streamparser.rb6
-rw-r--r--lib/rexml/parsers/treeparser.rb6
-rw-r--r--lib/rexml/parsers/ultralightparser.rb2
-rw-r--r--lib/rexml/parsers/xpathparser.rb2
-rw-r--r--lib/rexml/rexml.rb12
-rw-r--r--lib/rexml/sax2listener.rb16
-rw-r--r--lib/rexml/security.rb27
-rw-r--r--lib/rexml/source.rb2
-rw-r--r--lib/rexml/streamlistener.rb14
-rw-r--r--lib/rexml/text.rb22
-rw-r--r--lib/rexml/xmltokens.rb76
-rw-r--r--lib/rexml/xpath_parser.rb20
-rw-r--r--lib/rinda/rinda.rb50
-rw-r--r--lib/rinda/ring.rb303
-rw-r--r--lib/rinda/tuplespace.rb6
-rw-r--r--lib/rss/0.9.rb33
-rw-r--r--lib/rss/1.0.rb32
-rw-r--r--lib/rss/2.0.rb31
-rw-r--r--lib/rss/atom.rb2
-rw-r--r--lib/rss/content.rb2
-rw-r--r--lib/rss/dublincore.rb2
-rw-r--r--lib/rss/image.rb4
-rw-r--r--lib/rss/itunes.rb2
-rw-r--r--lib/rss/maker/base.rb2
-rw-r--r--lib/rss/parser.rb2
-rw-r--r--lib/rss/rexmlparser.rb5
-rw-r--r--lib/rss/rss.rb68
-rw-r--r--lib/rss/slash.rb2
-rw-r--r--lib/rss/syndication.rb3
-rw-r--r--lib/rss/taxonomy.rb4
-rw-r--r--lib/rss/trackback.rb4
-rw-r--r--lib/rss/utils.rb92
-rw-r--r--lib/rss/xmlparser.rb3
-rw-r--r--lib/rubygems.rb352
-rw-r--r--lib/rubygems/LICENSE.txt75
-rw-r--r--lib/rubygems/available_set.rb71
-rw-r--r--lib/rubygems/basic_specification.rb260
-rw-r--r--lib/rubygems/command.rb5
-rw-r--r--lib/rubygems/command_manager.rb80
-rw-r--r--lib/rubygems/commands/build_command.rb19
-rw-r--r--lib/rubygems/commands/cert_command.rb105
-rw-r--r--lib/rubygems/commands/check_command.rb7
-rw-r--r--lib/rubygems/commands/cleanup_command.rb18
-rw-r--r--lib/rubygems/commands/contents_command.rb186
-rw-r--r--lib/rubygems/commands/dependency_command.rb162
-rw-r--r--lib/rubygems/commands/environment_command.rb133
-rw-r--r--lib/rubygems/commands/fetch_command.rb13
-rw-r--r--lib/rubygems/commands/generate_index_command.rb2
-rw-r--r--lib/rubygems/commands/help_command.rb339
-rw-r--r--lib/rubygems/commands/install_command.rb241
-rw-r--r--lib/rubygems/commands/list_command.rb21
-rw-r--r--lib/rubygems/commands/mirror_command.rb6
-rw-r--r--lib/rubygems/commands/open_command.rb74
-rw-r--r--lib/rubygems/commands/outdated_command.rb21
-rw-r--r--lib/rubygems/commands/owner_command.rb21
-rw-r--r--lib/rubygems/commands/pristine_command.rb34
-rw-r--r--lib/rubygems/commands/push_command.rb23
-rw-r--r--lib/rubygems/commands/query_command.rb59
-rw-r--r--lib/rubygems/commands/rdoc_command.rb8
-rw-r--r--lib/rubygems/commands/search_command.rb23
-rw-r--r--lib/rubygems/commands/setup_command.rb18
-rw-r--r--lib/rubygems/commands/sources_command.rb201
-rw-r--r--lib/rubygems/commands/specification_command.rb18
-rw-r--r--lib/rubygems/commands/stale_command.rb10
-rw-r--r--lib/rubygems/commands/uninstall_command.rb59
-rw-r--r--lib/rubygems/commands/unpack_command.rb20
-rw-r--r--lib/rubygems/commands/update_command.rb213
-rw-r--r--lib/rubygems/commands/which_command.rb24
-rw-r--r--lib/rubygems/commands/yank_command.rb39
-rw-r--r--lib/rubygems/compatibility.rb7
-rw-r--r--lib/rubygems/config_file.rb37
-rw-r--r--lib/rubygems/core_ext/kernel_gem.rb15
-rwxr-xr-xlib/rubygems/core_ext/kernel_require.rb20
-rw-r--r--lib/rubygems/defaults.rb78
-rw-r--r--lib/rubygems/dependency.rb63
-rw-r--r--lib/rubygems/dependency_installer.rb424
-rw-r--r--lib/rubygems/dependency_resolver.rb575
-rw-r--r--lib/rubygems/deprecate.rb2
-rw-r--r--lib/rubygems/doctor.rb28
-rw-r--r--lib/rubygems/errors.rb54
-rw-r--r--lib/rubygems/exceptions.rb165
-rw-r--r--lib/rubygems/ext.rb3
-rw-r--r--lib/rubygems/ext/build_error.rb6
-rw-r--r--lib/rubygems/ext/builder.rb161
-rw-r--r--lib/rubygems/ext/cmake_builder.rb4
-rw-r--r--lib/rubygems/ext/configure_builder.rb4
-rw-r--r--lib/rubygems/ext/ext_conf_builder.rb42
-rw-r--r--lib/rubygems/ext/rake_builder.rb7
-rw-r--r--lib/rubygems/gem_runner.rb26
-rw-r--r--lib/rubygems/gemcutter_utilities.rb120
-rw-r--r--lib/rubygems/indexer.rb10
-rw-r--r--lib/rubygems/install_default_message.rb12
-rw-r--r--lib/rubygems/install_update_options.rb20
-rw-r--r--lib/rubygems/installer.rb246
-rw-r--r--lib/rubygems/installer_test_case.rb7
-rw-r--r--lib/rubygems/local_remote_options.rb4
-rw-r--r--lib/rubygems/name_tuple.rb29
-rw-r--r--lib/rubygems/package.rb130
-rw-r--r--lib/rubygems/package/file_source.rb33
-rw-r--r--lib/rubygems/package/io_source.rb45
-rw-r--r--lib/rubygems/package/old.rb10
-rw-r--r--lib/rubygems/package/source.rb3
-rw-r--r--lib/rubygems/package/tar_header.rb2
-rw-r--r--lib/rubygems/package/tar_reader/entry.rb2
-rw-r--r--lib/rubygems/package/tar_test_case.rb18
-rw-r--r--lib/rubygems/package/tar_writer.rb47
-rw-r--r--lib/rubygems/path_support.rb10
-rw-r--r--lib/rubygems/platform.rb25
-rw-r--r--lib/rubygems/psych_additions.rb4
-rw-r--r--lib/rubygems/rdoc.rb7
-rw-r--r--lib/rubygems/remote_fetcher.rb366
-rw-r--r--lib/rubygems/request.rb244
-rw-r--r--lib/rubygems/request/connection_pools.rb79
-rw-r--r--lib/rubygems/request/http_pool.rb38
-rw-r--r--lib/rubygems/request/https_pool.rb10
-rw-r--r--lib/rubygems/request_set.rb434
-rw-r--r--lib/rubygems/request_set/gem_dependency_api.rb792
-rw-r--r--lib/rubygems/request_set/lockfile.rb633
-rw-r--r--lib/rubygems/requirement.rb91
-rw-r--r--lib/rubygems/resolver.rb485
-rw-r--r--lib/rubygems/resolver/activation_request.rb172
-rw-r--r--lib/rubygems/resolver/api_set.rb125
-rw-r--r--lib/rubygems/resolver/api_specification.rb85
-rw-r--r--lib/rubygems/resolver/best_set.rb78
-rw-r--r--lib/rubygems/resolver/composed_set.rb66
-rw-r--r--lib/rubygems/resolver/conflict.rb160
-rw-r--r--lib/rubygems/resolver/current_set.rb13
-rw-r--r--lib/rubygems/resolver/dependency_request.rb116
-rw-r--r--lib/rubygems/resolver/git_set.rb122
-rw-r--r--lib/rubygems/resolver/git_specification.rb59
-rw-r--r--lib/rubygems/resolver/index_set.rb80
-rw-r--r--lib/rubygems/resolver/index_specification.rb69
-rw-r--r--lib/rubygems/resolver/installed_specification.rb58
-rw-r--r--lib/rubygems/resolver/installer_set.rb224
-rw-r--r--lib/rubygems/resolver/local_specification.rb41
-rw-r--r--lib/rubygems/resolver/lock_set.rb84
-rw-r--r--lib/rubygems/resolver/lock_specification.rb84
-rw-r--r--lib/rubygems/resolver/requirement_list.rb81
-rw-r--r--lib/rubygems/resolver/set.rb56
-rw-r--r--lib/rubygems/resolver/spec_specification.rb56
-rw-r--r--lib/rubygems/resolver/specification.rb110
-rw-r--r--lib/rubygems/resolver/stats.rb44
-rw-r--r--lib/rubygems/resolver/vendor_set.rb87
-rw-r--r--lib/rubygems/resolver/vendor_specification.rb24
-rw-r--r--lib/rubygems/security.rb61
-rw-r--r--lib/rubygems/security/policy.rb50
-rw-r--r--lib/rubygems/security/signer.rb24
-rw-r--r--lib/rubygems/security/trust_dir.rb18
-rw-r--r--lib/rubygems/server.rb43
-rw-r--r--lib/rubygems/source.rb131
-rw-r--r--lib/rubygems/source/git.rb232
-rw-r--r--lib/rubygems/source/installed.rb40
-rw-r--r--lib/rubygems/source/local.rb129
-rw-r--r--lib/rubygems/source/lock.rb48
-rw-r--r--lib/rubygems/source/specific_file.rb72
-rw-r--r--lib/rubygems/source/vendor.rb27
-rw-r--r--lib/rubygems/source_list.rb86
-rw-r--r--lib/rubygems/source_local.rb91
-rw-r--r--lib/rubygems/source_specific_file.rb28
-rw-r--r--lib/rubygems/spec_fetcher.rb70
-rw-r--r--lib/rubygems/specification.rb779
-rw-r--r--lib/rubygems/stub_specification.rb190
-rw-r--r--lib/rubygems/syck_hack.rb6
-rw-r--r--lib/rubygems/test_case.rb513
-rw-r--r--lib/rubygems/test_utilities.rb200
-rw-r--r--lib/rubygems/text.rb20
-rw-r--r--lib/rubygems/uninstaller.rb60
-rw-r--r--lib/rubygems/uri_formatter.rb49
-rw-r--r--lib/rubygems/user_interaction.rb282
-rw-r--r--lib/rubygems/util.rb134
-rw-r--r--lib/rubygems/util/list.rb48
-rw-r--r--lib/rubygems/util/stringio.rb34
-rw-r--r--lib/rubygems/validator.rb8
-rw-r--r--lib/rubygems/version.rb58
-rw-r--r--lib/rubygems/version_option.rb10
-rw-r--r--lib/scanf.rb11
-rw-r--r--lib/securerandom.rb126
-rw-r--r--lib/set.rb105
-rw-r--r--lib/shell.rb49
-rw-r--r--lib/shell/builtin-command.rb14
-rw-r--r--lib/shell/command-processor.rb12
-rw-r--r--lib/shell/filter.rb2
-rw-r--r--lib/shell/process-controller.rb9
-rw-r--r--lib/shell/system-command.rb1
-rw-r--r--lib/shellwords.rb20
-rw-r--r--lib/sync.rb2
-rw-r--r--lib/tempfile.rb66
-rw-r--r--lib/test/unit/test-unit.gemspec14
-rw-r--r--lib/thread.rb363
-rw-r--r--lib/thwait.rb6
-rw-r--r--lib/time.rb124
-rw-r--r--lib/timeout.rb56
-rw-r--r--lib/tmpdir.rb6
-rw-r--r--lib/tracer.rb14
-rw-r--r--lib/tsort.rb242
-rw-r--r--lib/un.rb34
-rw-r--r--lib/uri/common.rb857
-rw-r--r--lib/uri/ftp.rb25
-rw-r--r--lib/uri/generic.rb262
-rw-r--r--lib/uri/http.rb10
-rw-r--r--lib/uri/mailto.rb138
-rw-r--r--lib/uri/rfc2396_parser.rb543
-rw-r--r--lib/uri/rfc3986_parser.rb105
-rw-r--r--lib/weakref.rb23
-rw-r--r--lib/webrick.rb4
-rw-r--r--lib/webrick/accesslog.rb2
-rw-r--r--lib/webrick/compat.rb2
-rw-r--r--lib/webrick/htmlutils.rb5
-rw-r--r--lib/webrick/httpauth/digestauth.rb2
-rw-r--r--lib/webrick/httpauth/htdigest.rb9
-rw-r--r--lib/webrick/httpauth/htpasswd.rb9
-rw-r--r--lib/webrick/httpproxy.rb6
-rw-r--r--lib/webrick/httprequest.rb5
-rw-r--r--lib/webrick/httpresponse.rb14
-rw-r--r--lib/webrick/httpserver.rb4
-rw-r--r--lib/webrick/httpservlet/cgihandler.rb3
-rw-r--r--lib/webrick/httpservlet/erbhandler.rb2
-rw-r--r--lib/webrick/httpservlet/filehandler.rb73
-rw-r--r--lib/webrick/httpstatus.rb2
-rw-r--r--lib/webrick/httputils.rb14
-rw-r--r--lib/webrick/server.rb31
-rw-r--r--lib/webrick/ssl.rb2
-rw-r--r--lib/webrick/utils.rb36
-rw-r--r--lib/xmlrpc.rb4
-rw-r--r--lib/xmlrpc/client.rb40
-rw-r--r--lib/xmlrpc/config.rb2
-rw-r--r--lib/xmlrpc/datetime.rb2
-rw-r--r--lib/xmlrpc/httpserver.rb173
-rw-r--r--lib/xmlrpc/server.rb6
-rw-r--r--lib/yaml.rb44
-rw-r--r--lib/yaml/dbm.rb77
-rw-r--r--load.c120
-rw-r--r--loadpath.c92
-rw-r--r--localeinit.c70
-rw-r--r--man/rake.143
-rw-r--r--man/ruby.125
-rw-r--r--marshal.c439
-rw-r--r--math.c406
-rw-r--r--method.h15
-rw-r--r--miniinit.c30
-rw-r--r--misc/README2
-rw-r--r--misc/inf-ruby.el2
-rw-r--r--misc/rdoc-mode.el42
-rw-r--r--misc/ruby-additional.el212
-rw-r--r--misc/ruby-electric.el558
-rw-r--r--misc/ruby-mode.el158
-rw-r--r--misc/ruby-style.el1
-rw-r--r--missing/crypt.c2
-rw-r--r--missing/file.h2
-rw-r--r--missing/flock.c4
-rw-r--r--missing/isnan.c15
-rw-r--r--missing/nextafter.c77
-rw-r--r--nacl/README.nacl2
-rwxr-xr-x[-rw-r--r--]nacl/nacl-config.rb2
-rw-r--r--node.c214
-rw-r--r--node.h31
-rw-r--r--numeric.c1579
-rw-r--r--object.c687
-rw-r--r--pack.c658
-rw-r--r--parse.y2709
-rw-r--r--prelude.rb6
-rw-r--r--probes.d61
-rw-r--r--probes_helper.h2
-rw-r--r--proc.c723
-rw-r--r--process.c2036
-rw-r--r--random.c348
-rw-r--r--range.c164
-rw-r--r--rational.c488
-rw-r--r--re.c177
-rw-r--r--regcomp.c229
-rw-r--r--regenc.c66
-rw-r--r--regenc.h33
-rw-r--r--regerror.c24
-rw-r--r--regexec.c88
-rw-r--r--regint.h89
-rw-r--r--regparse.c488
-rw-r--r--regparse.h12
-rw-r--r--ruby.c355
-rw-r--r--ruby_atomic.h65
-rw-r--r--safe.c42
-rw-r--r--sample/benchmark.rb19
-rw-r--r--sample/cal.rb10
-rw-r--r--sample/cgi-session-pstore.rb11
-rw-r--r--sample/coverage.rb2
-rw-r--r--sample/delegate.rb31
-rw-r--r--sample/drb/README.ja.rdoc (renamed from sample/drb/README.rd.ja)2
-rw-r--r--sample/drb/README.rdoc (renamed from sample/drb/README.rd)6
-rw-r--r--sample/drb/acl.rb15
-rw-r--r--sample/drb/dbiff.rb22
-rw-r--r--sample/drb/dchats.rb20
-rw-r--r--sample/drb/dlogd.rb4
-rw-r--r--sample/drb/http0.rb60
-rw-r--r--sample/drb/http0serv.rb106
-rw-r--r--sample/drb/old_tuplespace.rb74
-rw-r--r--sample/drb/ring_place.rb6
-rw-r--r--sample/drb/simpletuple.rb8
-rw-r--r--sample/dualstack-fetch.rb2
-rw-r--r--sample/dualstack-httpd.rb32
-rw-r--r--sample/exyacc.rb24
-rw-r--r--sample/fib.awk8
-rw-r--r--sample/fib.pl4
-rw-r--r--sample/fib.scm4
-rw-r--r--sample/freq.rb2
-rw-r--r--sample/from.rb38
-rw-r--r--sample/logger/app.rb2
-rw-r--r--sample/mkproto.rb22
-rw-r--r--sample/net-imap.rb167
-rw-r--r--sample/observ.rb8
-rw-r--r--sample/occur.pl8
-rw-r--r--sample/occur.rb2
-rw-r--r--sample/occur2.rb2
-rw-r--r--sample/open3.rb12
-rw-r--r--sample/openssl/c_rehash.rb38
-rw-r--r--sample/openssl/certstore.rb52
-rw-r--r--sample/openssl/crlstore.rb32
-rwxr-xr-xsample/optparse/opttest.rb70
-rw-r--r--sample/pstore.rb19
-rw-r--r--sample/pty/expect_sample.rb2
-rw-r--r--sample/rcs.awk54
-rw-r--r--sample/rinda-ring.rb22
-rw-r--r--sample/tempfile.rb8
-rwxr-xr-xsample/test.rb42
-rw-r--r--sample/trick2013/README.md13
-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.mp4bin0 -> 580724 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/trojan.rb2
-rw-r--r--sample/weakref.rb9
-rw-r--r--signal.c278
-rw-r--r--siphash.c7
-rw-r--r--sparc.c11
-rw-r--r--spec/default.mspec4
-rw-r--r--sprintf.c442
-rw-r--r--st.c278
-rw-r--r--strftime.c3
-rw-r--r--string.c2097
-rw-r--r--struct.c628
-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.c1156
-rw-r--r--symbol.h54
-rw-r--r--template/Doxyfile.tmpl2
-rw-r--r--template/GNUmakefile.in6
-rw-r--r--template/encdb.h.tmpl14
-rw-r--r--template/fake.rb.in39
-rw-r--r--template/id.h.tmpl38
-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.pc.in23
-rw-r--r--template/sizes.c.tmpl30
-rw-r--r--template/verconf.h.tmpl61
-rw-r--r--template/vm.inc.tmpl2
-rw-r--r--template/yarvarch.ja14
-rw-r--r--test/-ext-/bignum/test_big2str.rb29
-rw-r--r--test/-ext-/bignum/test_bigzero.rb13
-rw-r--r--test/-ext-/bignum/test_div.rb28
-rw-r--r--test/-ext-/bignum/test_mul.rb137
-rw-r--r--test/-ext-/bignum/test_pack.rb398
-rw-r--r--test/-ext-/bignum/test_str2big.rb37
-rw-r--r--test/-ext-/bug_reporter/test_bug_reporter.rb17
-rw-r--r--test/-ext-/class/test_class2name.rb18
-rw-r--r--test/-ext-/debug/test_debug.rb30
-rw-r--r--test/-ext-/debug/test_profile_frames.rb104
-rw-r--r--test/-ext-/exception/test_data_error.rb14
-rw-r--r--test/-ext-/file/test_stat.rb14
-rw-r--r--test/-ext-/float/test_nextafter.rb57
-rw-r--r--test/-ext-/iter/test_iter_break.rb11
-rw-r--r--test/-ext-/iter/test_yield_block.rb21
-rw-r--r--test/-ext-/marshal/test_usrmarshal.rb3
-rw-r--r--test/-ext-/num2int/test_num2int.rb374
-rw-r--r--test/-ext-/old_thread_select/test_old_thread_select.rb100
-rw-r--r--test/-ext-/postponed_job/test_postponed_job.rb28
-rw-r--r--test/-ext-/rational/test_rat.rb31
-rw-r--r--test/-ext-/string/test_coderange.rb59
-rw-r--r--test/-ext-/string/test_cstr.rb25
-rw-r--r--test/-ext-/string/test_ellipsize.rb2
-rw-r--r--test/-ext-/string/test_normalize.rb106
-rw-r--r--test/-ext-/struct/test_member.rb16
-rw-r--r--test/-ext-/symbol/test_inadvertent_creation.rb135
-rw-r--r--test/-ext-/symbol/test_type.rb124
-rw-r--r--test/-ext-/test_printf.rb155
-rw-r--r--test/-ext-/test_recursion.rb36
-rw-r--r--test/-ext-/tracepoint/test_tracepoint.rb80
-rw-r--r--test/-ext-/typeddata/test_typeddata.rb15
-rw-r--r--test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb2
-rw-r--r--test/-ext-/win32/test_console_attr.rb43
-rw-r--r--test/-ext-/win32/test_dln.rb22
-rw-r--r--test/benchmark/test_benchmark.rb136
-rw-r--r--test/bigdecimal/test_bigdecimal.rb113
-rw-r--r--test/bigdecimal/test_bigdecimal_util.rb13
-rw-r--r--test/bigdecimal/test_bigmath.rb18
-rw-r--r--test/cgi/test_cgi_core.rb65
-rw-r--r--test/cgi/test_cgi_header.rb8
-rw-r--r--test/cgi/test_cgi_multipart.rb59
-rw-r--r--test/cgi/test_cgi_tag_helper.rb13
-rw-r--r--test/cgi/test_cgi_util.rb46
-rw-r--r--test/csv/base.rb2
-rwxr-xr-xtest/csv/test_data_converters.rb4
-rwxr-xr-xtest/csv/test_encodings.rb38
-rwxr-xr-xtest/csv/test_features.rb101
-rwxr-xr-xtest/csv/test_headers.rb34
-rwxr-xr-xtest/csv/test_interface.rb37
-rwxr-xr-xtest/csv/test_row.rb51
-rwxr-xr-xtest/csv/test_table.rb24
-rw-r--r--test/date/test_date.rb12
-rw-r--r--test/date/test_date_arith.rb30
-rw-r--r--test/date/test_date_attr.rb9
-rw-r--r--test/date/test_date_parse.rb13
-rw-r--r--test/date/test_date_strptime.rb22
-rw-r--r--test/date/test_switch_hitter.rb2
-rw-r--r--test/dbm/test_dbm.rb25
-rwxr-xr-xtest/digest/test_digest.rb47
-rw-r--r--test/digest/test_digest_extend.rb2
-rw-r--r--test/digest/test_digest_hmac.rb2
-rw-r--r--test/dl/test_base.rb12
-rw-r--r--test/dl/test_cptr.rb4
-rw-r--r--test/dl/test_dl2.rb27
-rw-r--r--test/dl/test_func.rb6
-rw-r--r--test/dl/test_handle.rb6
-rw-r--r--test/drb/drbtest.rb56
-rw-r--r--test/drb/ignore_test_drb.rb19
-rw-r--r--test/drb/test_acl.rb4
-rw-r--r--test/drb/test_drb.rb69
-rw-r--r--test/drb/test_drbssl.rb24
-rw-r--r--test/drb/test_drbunix.rb23
-rw-r--r--test/drb/ut_array.rb3
-rw-r--r--test/drb/ut_array_drbssl.rb13
-rw-r--r--test/drb/ut_array_drbunix.rb1
-rw-r--r--test/drb/ut_drb.rb6
-rw-r--r--test/drb/ut_drb_drbssl.rb13
-rw-r--r--test/drb/ut_drb_drbunix.rb3
-rw-r--r--test/drb/ut_eq.rb8
-rw-r--r--test/drb/ut_eval.rb7
-rw-r--r--test/drb/ut_large.rb7
-rw-r--r--test/drb/ut_port.rb1
-rw-r--r--test/drb/ut_safe1.rb1
-rw-r--r--test/drb/ut_timerholder.rb6
-rw-r--r--test/dtrace/helper.rb27
-rw-r--r--test/dtrace/test_array_create.rb2
-rw-r--r--test/dtrace/test_cmethod.rb2
-rw-r--r--test/dtrace/test_function_entry.rb2
-rw-r--r--test/dtrace/test_gc.rb2
-rw-r--r--test/dtrace/test_hash_create.rb2
-rw-r--r--test/dtrace/test_load.rb2
-rw-r--r--test/dtrace/test_method_cache.rb28
-rw-r--r--test/dtrace/test_object_create_start.rb2
-rw-r--r--test/dtrace/test_raise.rb2
-rw-r--r--test/dtrace/test_require.rb2
-rw-r--r--test/dtrace/test_singleton_function.rb2
-rw-r--r--test/dtrace/test_string.rb2
-rw-r--r--test/erb/test_erb.rb5
-rw-r--r--test/erb/test_erb_m17n.rb2
-rw-r--r--test/etc/test_etc.rb47
-rw-r--r--test/fiddle/helper.rb12
-rw-r--r--test/fiddle/test_c_struct_entry.rb10
-rw-r--r--test/fiddle/test_c_union_entity.rb9
-rw-r--r--test/fiddle/test_cparser.rb10
-rw-r--r--test/fiddle/test_func.rb7
-rw-r--r--test/fiddle/test_function.rb11
-rw-r--r--test/fiddle/test_handle.rb24
-rw-r--r--test/fiddle/test_import.rb19
-rw-r--r--test/fiddle/test_pointer.rb13
-rw-r--r--test/fileutils/fileasserts.rb41
-rw-r--r--test/fileutils/test_fileutils.rb597
-rw-r--r--test/gdbm/test_gdbm.rb108
-rw-r--r--test/io/console/test_io_console.rb54
-rw-r--r--test/io/nonblock/test_flush.rb14
-rw-r--r--test/io/wait/test_io_wait.rb8
-rw-r--r--test/irb/test_raise_no_backtrace_exception.rb14
-rwxr-xr-xtest/json/test_json.rb2
-rwxr-xr-xtest/json/test_json_generate.rb22
-rw-r--r--test/json/test_json_generic_object.rb15
-rw-r--r--test/lib/leakchecker.rb163
-rw-r--r--test/lib/minitest/README.txt (renamed from lib/minitest/README.txt)155
-rw-r--r--test/lib/minitest/autorun.rb13
-rw-r--r--test/lib/minitest/benchmark.rb (renamed from lib/minitest/benchmark.rb)49
-rw-r--r--test/lib/minitest/mock.rb (renamed from lib/minitest/mock.rb)11
-rw-r--r--test/lib/minitest/unit.rb (renamed from lib/minitest/unit.rb)282
-rw-r--r--test/lib/profile_test_all.rb90
-rw-r--r--test/lib/test/unit.rb (renamed from lib/test/unit.rb)63
-rw-r--r--test/lib/test/unit/assertions.rb (renamed from lib/test/unit/assertions.rb)167
-rw-r--r--test/lib/test/unit/parallel.rb (renamed from lib/test/unit/parallel.rb)32
-rw-r--r--test/lib/test/unit/testcase.rb (renamed from lib/test/unit/testcase.rb)2
-rw-r--r--test/lib/tracepointchecker.rb118
-rw-r--r--test/lib/with_different_ofs.rb (renamed from test/with_different_ofs.rb)0
-rw-r--r--test/logger/test_logdevice.rb420
-rw-r--r--test/logger/test_logger.rb295
-rw-r--r--test/logger/test_severity.rb15
-rw-r--r--test/matrix/test_matrix.rb62
-rw-r--r--test/matrix/test_vector.rb5
-rw-r--r--test/minitest/metametameta.rb5
-rw-r--r--test/minitest/test_minitest_benchmark.rb21
-rw-r--r--test/minitest/test_minitest_mock.rb76
-rw-r--r--test/minitest/test_minitest_spec.rb738
-rw-r--r--test/minitest/test_minitest_unit.rb446
-rw-r--r--test/misc/test_ruby_mode.rb5
-rw-r--r--test/mkmf/base.rb11
-rw-r--r--test/mkmf/test_config.rb17
-rw-r--r--test/mkmf/test_framework.rb6
-rw-r--r--test/mkmf/test_have_library.rb10
-rw-r--r--test/mkmf/test_have_macro.rb4
-rw-r--r--test/monitor/test_monitor.rb13
-rw-r--r--test/net/ftp/test_buffered_socket.rb40
-rw-r--r--test/net/ftp/test_ftp.rb16
-rw-r--r--test/net/http/test_http.rb107
-rw-r--r--test/net/http/test_https.rb4
-rw-r--r--test/net/http/utils.rb11
-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.rb63
-rw-r--r--test/net/imap/test_imap_response_parser.rb73
-rw-r--r--test/net/pop/test_pop.rb2
-rw-r--r--test/net/protocol/test_protocol.rb9
-rw-r--r--test/net/smtp/test_smtp.rb38
-rw-r--r--test/objspace/test_objspace.rb168
-rw-r--r--test/open-uri/test_open-uri.rb56
-rw-r--r--test/open-uri/test_ssl.rb14
-rw-r--r--test/openssl/test_bn.rb35
-rw-r--r--test/openssl/test_cipher.rb9
-rw-r--r--test/openssl/test_config.rb28
-rw-r--r--test/openssl/test_digest.rb2
-rw-r--r--test/openssl/test_hmac.rb9
-rw-r--r--test/openssl/test_pair.rb191
-rw-r--r--test/openssl/test_partial_record_read.rb36
-rw-r--r--test/openssl/test_pkcs7.rb141
-rw-r--r--test/openssl/test_pkey_rsa.rb30
-rw-r--r--test/openssl/test_ssl.rb142
-rw-r--r--test/openssl/test_ssl_session.rb52
-rw-r--r--test/openssl/test_x509cert.rb35
-rw-r--r--test/openssl/test_x509req.rb30
-rw-r--r--test/openssl/test_x509store.rb5
-rw-r--r--test/openssl/utils.rb13
-rw-r--r--test/optparse/test_acceptable.rb195
-rw-r--r--test/optparse/test_optparse.rb3
-rw-r--r--test/ostruct/test_ostruct.rb27
-rw-r--r--test/pathname/test_pathname.rb91
-rw-r--r--test/profile_test_all.rb52
-rw-r--r--test/psych/helper.rb60
-rw-r--r--test/psych/test_alias_and_anchor.rb2
-rw-r--r--test/psych/test_array.rb2
-rw-r--r--test/psych/test_boolean.rb2
-rw-r--r--test/psych/test_class.rb2
-rw-r--r--test/psych/test_coder.rb6
-rw-r--r--test/psych/test_date_time.rb23
-rw-r--r--test/psych/test_deprecated.rb8
-rw-r--r--test/psych/test_document.rb2
-rw-r--r--test/psych/test_emitter.rb2
-rw-r--r--test/psych/test_encoding.rb121
-rw-r--r--test/psych/test_engine_manager.rb47
-rw-r--r--test/psych/test_exception.rb47
-rw-r--r--test/psych/test_hash.rb7
-rw-r--r--test/psych/test_json_tree.rb2
-rw-r--r--test/psych/test_merge_keys.rb50
-rw-r--r--test/psych/test_nil.rb2
-rw-r--r--test/psych/test_null.rb2
-rw-r--r--test/psych/test_numeric.rb2
-rw-r--r--test/psych/test_object.rb2
-rw-r--r--test/psych/test_object_references.rb6
-rw-r--r--test/psych/test_omap.rb2
-rw-r--r--test/psych/test_parser.rb2
-rw-r--r--test/psych/test_psych.rb29
-rw-r--r--test/psych/test_safe_load.rb97
-rw-r--r--test/psych/test_scalar.rb2
-rw-r--r--test/psych/test_scalar_scanner.rb4
-rw-r--r--test/psych/test_serialize_subclasses.rb2
-rw-r--r--test/psych/test_set.rb2
-rw-r--r--test/psych/test_stream.rb2
-rw-r--r--test/psych/test_string.rb52
-rw-r--r--test/psych/test_struct.rb2
-rw-r--r--test/psych/test_symbol.rb10
-rw-r--r--test/psych/test_tainted.rb16
-rw-r--r--test/psych/test_to_yaml_properties.rb2
-rw-r--r--test/psych/test_tree_builder.rb2
-rw-r--r--test/psych/test_yaml.rb5
-rw-r--r--test/psych/test_yamldbm.rb6
-rw-r--r--test/psych/test_yamlstore.rb4
-rw-r--r--test/psych/visitors/test_to_ruby.rb8
-rw-r--r--test/psych/visitors/test_yaml_tree.rb4
-rw-r--r--test/rake/helper.rb512
-rw-r--r--test/rake/support/rakefile_definitions.rb478
-rw-r--r--test/rake/support/ruby_runner.rb34
-rw-r--r--test/rake/test_rake_application.rb226
-rw-r--r--test/rake/test_rake_application_options.rb86
-rw-r--r--test/rake/test_rake_backtrace.rb60
-rw-r--r--test/rake/test_rake_clean.rb55
-rw-r--r--test/rake/test_rake_cpu_counter.rb50
-rw-r--r--test/rake/test_rake_definitions.rb5
-rw-r--r--test/rake/test_rake_directory_task.rb19
-rw-r--r--test/rake/test_rake_dsl.rb37
-rw-r--r--test/rake/test_rake_file_creation_task.rb4
-rw-r--r--test/rake/test_rake_file_list.rb75
-rw-r--r--test/rake/test_rake_file_task.rb91
-rw-r--r--test/rake/test_rake_file_utils.rb8
-rw-r--r--test/rake/test_rake_ftp_file.rb41
-rw-r--r--test/rake/test_rake_functional.rb60
-rw-r--r--test/rake/test_rake_invocation_chain.rb18
-rw-r--r--test/rake/test_rake_linked_list.rb84
-rw-r--r--test/rake/test_rake_makefile_loader.rb4
-rw-r--r--test/rake/test_rake_multi_task.rb11
-rw-r--r--test/rake/test_rake_name_space.rb16
-rw-r--r--test/rake/test_rake_path_map.rb35
-rw-r--r--test/rake/test_rake_pathname_extensions.rb15
-rw-r--r--test/rake/test_rake_rake_test_loader.rb5
-rw-r--r--test/rake/test_rake_rdoc_task.rb83
-rw-r--r--test/rake/test_rake_reduce_compat.rb47
-rw-r--r--test/rake/test_rake_rules.rb85
-rw-r--r--test/rake/test_rake_scope.rb44
-rw-r--r--test/rake/test_rake_task.rb105
-rw-r--r--test/rake/test_rake_task_argument_parsing.rb16
-rw-r--r--test/rake/test_rake_task_arguments.rb43
-rw-r--r--test/rake/test_rake_task_manager.rb51
-rw-r--r--test/rake/test_rake_task_manager_argument_resolution.rb17
-rw-r--r--test/rake/test_rake_task_with_arguments.rb25
-rw-r--r--test/rake/test_rake_test_task.rb27
-rw-r--r--test/rake/test_rake_thread_pool.rb71
-rw-r--r--test/rake/test_rake_top_level_functions.rb40
-rw-r--r--test/rake/test_sys.rb20
-rw-r--r--test/rake/test_thread_history_display.rb22
-rw-r--r--test/rake/test_trace_output.rb9
-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_any_method.rb134
-rw-r--r--test/rdoc/test_rdoc_class_module.rb77
-rw-r--r--test/rdoc/test_rdoc_code_object.rb149
-rw-r--r--test/rdoc/test_rdoc_constant.rb30
-rw-r--r--test/rdoc/test_rdoc_context.rb19
-rw-r--r--test/rdoc/test_rdoc_context_section.rb7
-rw-r--r--test/rdoc/test_rdoc_cross_reference.rb7
-rw-r--r--test/rdoc/test_rdoc_encoding.rb23
-rw-r--r--test/rdoc/test_rdoc_generator_darkfish.rb80
-rw-r--r--test/rdoc/test_rdoc_generator_json_index.rb11
-rw-r--r--test/rdoc/test_rdoc_generator_pot.rb91
-rw-r--r--test/rdoc/test_rdoc_generator_pot_po.rb51
-rw-r--r--test/rdoc/test_rdoc_generator_pot_po_entry.rb139
-rw-r--r--test/rdoc/test_rdoc_generator_ri.rb8
-rw-r--r--test/rdoc/test_rdoc_i18n_locale.rb73
-rw-r--r--test/rdoc/test_rdoc_i18n_text.rb123
-rw-r--r--test/rdoc/test_rdoc_markdown.rb27
-rw-r--r--test/rdoc/test_rdoc_markdown_test.rb7
-rw-r--r--test/rdoc/test_rdoc_markup_attribute_manager.rb124
-rw-r--r--test/rdoc/test_rdoc_markup_document.rb7
-rw-r--r--test/rdoc/test_rdoc_markup_formatter.rb32
-rw-r--r--test/rdoc/test_rdoc_markup_heading.rb9
-rw-r--r--test/rdoc/test_rdoc_markup_parser.rb7
-rw-r--r--test/rdoc/test_rdoc_markup_pre_process.rb20
-rw-r--r--test/rdoc/test_rdoc_markup_raw.rb7
-rw-r--r--test/rdoc/test_rdoc_markup_to_html.rb86
-rw-r--r--test/rdoc/test_rdoc_markup_to_html_crossref.rb7
-rw-r--r--test/rdoc/test_rdoc_markup_to_html_snippet.rb8
-rw-r--r--test/rdoc/test_rdoc_markup_to_markdown.rb6
-rw-r--r--test/rdoc/test_rdoc_method_attr.rb40
-rw-r--r--test/rdoc/test_rdoc_normal_class.rb13
-rw-r--r--test/rdoc/test_rdoc_normal_module.rb5
-rw-r--r--test/rdoc/test_rdoc_options.rb167
-rw-r--r--test/rdoc/test_rdoc_parser.rb42
-rw-r--r--test/rdoc/test_rdoc_parser_c.rb197
-rw-r--r--test/rdoc/test_rdoc_parser_changelog.rb9
-rw-r--r--test/rdoc/test_rdoc_parser_markdown.rb2
-rw-r--r--test/rdoc/test_rdoc_parser_rd.rb9
-rw-r--r--test/rdoc/test_rdoc_parser_ruby.rb371
-rw-r--r--test/rdoc/test_rdoc_parser_simple.rb2
-rw-r--r--test/rdoc/test_rdoc_rd_block_parser.rb12
-rw-r--r--test/rdoc/test_rdoc_rd_inline_parser.rb1
-rw-r--r--test/rdoc/test_rdoc_rdoc.rb72
-rw-r--r--test/rdoc/test_rdoc_ri_driver.rb31
-rw-r--r--test/rdoc/test_rdoc_ruby_lex.rb148
-rw-r--r--test/rdoc/test_rdoc_rubygems_hook.rb5
-rw-r--r--test/rdoc/test_rdoc_servlet.rb82
-rw-r--r--test/rdoc/test_rdoc_stats.rb302
-rw-r--r--test/rdoc/test_rdoc_store.rb30
-rw-r--r--test/rdoc/test_rdoc_task.rb50
-rw-r--r--test/rdoc/test_rdoc_text.rb74
-rw-r--r--test/rdoc/test_rdoc_tom_doc.rb60
-rw-r--r--test/rdoc/xref_test_case.rb2
-rw-r--r--test/readline/test_readline.rb220
-rw-r--r--test/readline/test_readline_history.rb35
-rw-r--r--test/resolv/test_addr.rb13
-rw-r--r--test/resolv/test_dns.rb15
-rw-r--r--test/rexml/data/tutorial.xml2
-rw-r--r--test/rexml/listener.rb94
-rw-r--r--test/rexml/parse/test_document_type_declaration.rb49
-rw-r--r--test/rexml/parse/test_notation_declaration.rb99
-rw-r--r--test/rexml/parser/test_sax2.rb202
-rw-r--r--test/rexml/parser/test_tree.rb42
-rw-r--r--test/rexml/parser/test_ultra_light.rb69
-rw-r--r--test/rexml/rexml_test_utils.rb1
-rw-r--r--test/rexml/test_attributes.rb340
-rw-r--r--test/rexml/test_attributes_mixin.rb51
-rw-r--r--test/rexml/test_changing_encoding.rb68
-rw-r--r--test/rexml/test_comment.rb2
-rw-r--r--test/rexml/test_contrib.rb881
-rw-r--r--test/rexml/test_core.rb2463
-rw-r--r--test/rexml/test_doctype.rb193
-rw-r--r--test/rexml/test_document.rb374
-rw-r--r--test/rexml/test_elements.rb196
-rw-r--r--test/rexml/test_encoding.rb154
-rw-r--r--test/rexml/test_encoding_2.rb59
-rw-r--r--test/rexml/test_entity.rb306
-rw-r--r--test/rexml/test_functions.rb401
-rw-r--r--test/rexml/test_functions_number.rb52
-rw-r--r--test/rexml/test_jaxen.rb211
-rw-r--r--test/rexml/test_light.rb172
-rw-r--r--test/rexml/test_lightparser.rb19
-rw-r--r--test/rexml/test_listener.rb207
-rw-r--r--test/rexml/test_martin_fowler.rb40
-rw-r--r--test/rexml/test_namespace.rb56
-rw-r--r--test/rexml/test_notationdecl_mixin.rb58
-rw-r--r--test/rexml/test_notationdecl_parsetest.rb23
-rw-r--r--test/rexml/test_order.rb176
-rw-r--r--test/rexml/test_preceding_sibling.rb56
-rw-r--r--test/rexml/test_pullparser.rb160
-rw-r--r--test/rexml/test_rexml_issuezilla.rb22
-rw-r--r--test/rexml/test_sax.rb485
-rw-r--r--test/rexml/test_stream.rb189
-rw-r--r--test/rexml/test_text.rb21
-rw-r--r--test/rexml/test_ticket_80.rb46
-rw-r--r--test/rexml/test_validation_rng.rb616
-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.rb29
-rw-r--r--test/rexml/xpath/test_axis_preceding_sibling.rb39
-rw-r--r--test/rexml/xpath/test_base.rb1089
-rw-r--r--test/rexml/xpath/test_node.rb42
-rw-r--r--test/rexml/xpath/test_predicate.rb82
-rw-r--r--test/rexml/xpath/test_text.rb74
-rw-r--r--test/rinda/test_rinda.rb347
-rw-r--r--test/ripper/test_files.rb62
-rw-r--r--test/ripper/test_parser_events.rb25
-rw-r--r--test/ripper/test_ripper.rb4
-rw-r--r--test/ripper/test_scanner_events.rb33
-rw-r--r--test/rss/rss-assertions.rb4
-rw-r--r--test/rss/rss-testcase.rb2
-rw-r--r--test/rss/test_1.0.rb2
-rw-r--r--test/rss/test_2.0.rb2
-rw-r--r--test/rss/test_accessor.rb2
-rw-r--r--test/rss/test_atom.rb2
-rw-r--r--test/rss/test_content.rb2
-rw-r--r--test/rss/test_dublincore.rb2
-rw-r--r--test/rss/test_image.rb2
-rw-r--r--test/rss/test_inherit.rb2
-rw-r--r--test/rss/test_itunes.rb2
-rw-r--r--test/rss/test_maker_0.9.rb2
-rw-r--r--test/rss/test_maker_1.0.rb2
-rw-r--r--test/rss/test_maker_2.0.rb2
-rw-r--r--test/rss/test_maker_atom_entry.rb2
-rw-r--r--test/rss/test_maker_atom_feed.rb2
-rw-r--r--test/rss/test_maker_content.rb2
-rw-r--r--test/rss/test_maker_dc.rb2
-rw-r--r--test/rss/test_maker_image.rb2
-rw-r--r--test/rss/test_maker_itunes.rb6
-rw-r--r--test/rss/test_maker_slash.rb2
-rw-r--r--test/rss/test_maker_sy.rb2
-rw-r--r--test/rss/test_maker_taxo.rb2
-rw-r--r--test/rss/test_maker_trackback.rb2
-rw-r--r--test/rss/test_maker_xml-stylesheet.rb2
-rw-r--r--test/rss/test_parser.rb4
-rw-r--r--test/rss/test_parser_1.0.rb2
-rw-r--r--test/rss/test_parser_2.0.rb2
-rw-r--r--test/rss/test_parser_atom_entry.rb2
-rw-r--r--test/rss/test_parser_atom_feed.rb2
-rw-r--r--test/rss/test_setup_maker_0.9.rb2
-rw-r--r--test/rss/test_setup_maker_1.0.rb2
-rw-r--r--test/rss/test_setup_maker_2.0.rb2
-rw-r--r--test/rss/test_setup_maker_atom_entry.rb2
-rw-r--r--test/rss/test_setup_maker_atom_feed.rb2
-rw-r--r--test/rss/test_setup_maker_itunes.rb3
-rw-r--r--test/rss/test_setup_maker_slash.rb2
-rw-r--r--test/rss/test_slash.rb2
-rw-r--r--test/rss/test_syndication.rb2
-rw-r--r--test/rss/test_taxonomy.rb2
-rw-r--r--test/rss/test_to_s.rb2
-rw-r--r--test/rss/test_trackback.rb2
-rw-r--r--test/rss/test_version.rb2
-rw-r--r--test/rss/test_xml-stylesheet.rb2
-rw-r--r--test/ruby/allpairs.rb1
-rw-r--r--test/ruby/enc/test_emoji.rb6
-rw-r--r--test/ruby/enc/test_euc_kr.rb8
-rw-r--r--test/ruby/enc/test_utf16.rb8
-rw-r--r--test/ruby/envutil.rb218
-rw-r--r--test/ruby/find_executable.rb21
-rw-r--r--test/ruby/lbtest.rb2
-rw-r--r--test/ruby/marshaltestlib.rb97
-rw-r--r--test/ruby/memory_status.rb26
-rw-r--r--test/ruby/test_alias.rb85
-rw-r--r--test/ruby/test_argf.rb61
-rw-r--r--test/ruby/test_arity.rb4
-rw-r--r--test/ruby/test_array.rb267
-rw-r--r--test/ruby/test_assignment.rb65
-rw-r--r--test/ruby/test_autoload.rb172
-rw-r--r--test/ruby/test_backtrace.rb101
-rw-r--r--test/ruby/test_beginendblock.rb137
-rw-r--r--test/ruby/test_bignum.rb40
-rw-r--r--test/ruby/test_call.rb15
-rw-r--r--test/ruby/test_case.rb19
-rw-r--r--test/ruby/test_class.rb40
-rw-r--r--test/ruby/test_comparable.rb13
-rw-r--r--test/ruby/test_complex.rb411
-rw-r--r--test/ruby/test_complexrational.rb12
-rw-r--r--test/ruby/test_const.rb8
-rw-r--r--test/ruby/test_defined.rb9
-rw-r--r--test/ruby/test_dir.rb109
-rw-r--r--test/ruby/test_dir_m17n.rb199
-rw-r--r--test/ruby/test_econv.rb22
-rw-r--r--test/ruby/test_encoding.rb20
-rw-r--r--test/ruby/test_enum.rb239
-rw-r--r--test/ruby/test_enumerator.rb77
-rw-r--r--test/ruby/test_env.rb175
-rw-r--r--test/ruby/test_eval.rb42
-rw-r--r--test/ruby/test_exception.rb256
-rw-r--r--test/ruby/test_fiber.rb29
-rw-r--r--test/ruby/test_file.rb258
-rw-r--r--test/ruby/test_file_exhaustive.rb192
-rw-r--r--test/ruby/test_fixnum.rb74
-rw-r--r--test/ruby/test_float.rb130
-rw-r--r--test/ruby/test_fnmatch.rb170
-rw-r--r--test/ruby/test_gc.rb208
-rw-r--r--test/ruby/test_hash.rb541
-rw-r--r--test/ruby/test_integer.rb54
-rw-r--r--test/ruby/test_integer_comb.rb13
-rw-r--r--test/ruby/test_io.rb816
-rw-r--r--test/ruby/test_io_m17n.rb114
-rw-r--r--test/ruby/test_iseq.rb46
-rw-r--r--test/ruby/test_keyword.rb136
-rw-r--r--test/ruby/test_lambda.rb33
-rw-r--r--test/ruby/test_lazy_enumerator.rb21
-rw-r--r--test/ruby/test_m17n.rb164
-rw-r--r--test/ruby/test_m17n_comb.rb265
-rw-r--r--test/ruby/test_marshal.rb170
-rw-r--r--test/ruby/test_math.rb29
-rw-r--r--test/ruby/test_method.rb331
-rw-r--r--test/ruby/test_module.rb483
-rw-r--r--test/ruby/test_notimp.rb26
-rw-r--r--test/ruby/test_numeric.rb208
-rw-r--r--test/ruby/test_object.rb244
-rw-r--r--test/ruby/test_objectspace.rb27
-rw-r--r--test/ruby/test_optimization.rb66
-rw-r--r--test/ruby/test_pack.rb34
-rw-r--r--test/ruby/test_parse.rb38
-rw-r--r--test/ruby/test_pipe.rb13
-rw-r--r--test/ruby/test_primitive.rb4
-rw-r--r--test/ruby/test_proc.rb110
-rw-r--r--test/ruby/test_process.rb488
-rw-r--r--test/ruby/test_rand.rb36
-rw-r--r--test/ruby/test_range.rb116
-rw-r--r--test/ruby/test_rational.rb374
-rw-r--r--test/ruby/test_refinement.rb253
-rw-r--r--test/ruby/test_regexp.rb176
-rw-r--r--test/ruby/test_require.rb435
-rw-r--r--test/ruby/test_rubyoptions.rb286
-rw-r--r--test/ruby/test_rubyvm.rb17
-rw-r--r--test/ruby/test_settracefunc.rb407
-rw-r--r--test/ruby/test_signal.rb136
-rw-r--r--test/ruby/test_sleep.rb9
-rw-r--r--test/ruby/test_sprintf.rb91
-rw-r--r--test/ruby/test_string.rb222
-rw-r--r--test/ruby/test_stringchar.rb8
-rw-r--r--test/ruby/test_struct.rb209
-rw-r--r--test/ruby/test_super.rb117
-rw-r--r--test/ruby/test_symbol.rb33
-rw-r--r--test/ruby/test_syntax.rb109
-rw-r--r--test/ruby/test_system.rb2
-rw-r--r--test/ruby/test_thread.rb264
-rw-r--r--test/ruby/test_threadgroup.rb9
-rw-r--r--test/ruby/test_time.rb103
-rw-r--r--test/ruby/test_time_tz.rb52
-rw-r--r--test/ruby/test_transcode.rb179
-rw-r--r--test/ruby/test_unicode_escape.rb2
-rw-r--r--test/ruby/test_variable.rb12
-rw-r--r--test/ruby/test_weakmap.rb134
-rw-r--r--test/ruby/test_whileuntil.rb8
-rw-r--r--test/ruby/test_yield.rb4
-rw-r--r--test/ruby/ut_eof.rb4
-rw-r--r--test/rubygems/ca_cert.pem23
-rw-r--r--test/rubygems/client.pem49
-rw-r--r--test/rubygems/encrypted_private_key.pem30
-rw-r--r--test/rubygems/insure_session.rb43
-rw-r--r--test/rubygems/invalid_client.pem49
-rw-r--r--test/rubygems/specifications/bar-0.0.2.gemspec9
-rw-r--r--test/rubygems/specifications/foo-0.0.1.gemspecbin0 -> 269 bytes-rw-r--r--test/rubygems/test_bundled_ca.rb3
-rw-r--r--test/rubygems/test_gem.rb982
-rw-r--r--test/rubygems/test_gem_available_set.rb22
-rw-r--r--test/rubygems/test_gem_command.rb55
-rw-r--r--test/rubygems/test_gem_command_manager.rb44
-rw-r--r--test/rubygems/test_gem_commands_build_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_cert_command.rb169
-rw-r--r--test/rubygems/test_gem_commands_cleanup_command.rb41
-rw-r--r--test/rubygems/test_gem_commands_contents_command.rb85
-rw-r--r--test/rubygems/test_gem_commands_dependency_command.rb58
-rw-r--r--test/rubygems/test_gem_commands_environment_command.rb13
-rw-r--r--test/rubygems/test_gem_commands_fetch_command.rb91
-rw-r--r--test/rubygems/test_gem_commands_help_command.rb16
-rw-r--r--test/rubygems/test_gem_commands_install_command.rb699
-rw-r--r--test/rubygems/test_gem_commands_list_command.rb6
-rw-r--r--test/rubygems/test_gem_commands_open_command.rb46
-rw-r--r--test/rubygems/test_gem_commands_outdated_command.rb19
-rw-r--r--test/rubygems/test_gem_commands_owner_command.rb49
-rw-r--r--test/rubygems/test_gem_commands_pristine_command.rb128
-rw-r--r--test/rubygems/test_gem_commands_push_command.rb84
-rw-r--r--test/rubygems/test_gem_commands_query_command.rb288
-rw-r--r--test/rubygems/test_gem_commands_setup_command.rb9
-rw-r--r--test/rubygems/test_gem_commands_sources_command.rb72
-rw-r--r--test/rubygems/test_gem_commands_specification_command.rb71
-rw-r--r--test/rubygems/test_gem_commands_stale_command.rb4
-rw-r--r--test/rubygems/test_gem_commands_uninstall_command.rb104
-rw-r--r--test/rubygems/test_gem_commands_unpack_command.rb46
-rw-r--r--test/rubygems/test_gem_commands_update_command.rb363
-rw-r--r--test/rubygems/test_gem_commands_which_command.rb6
-rw-r--r--test/rubygems/test_gem_commands_yank_command.rb4
-rw-r--r--test/rubygems/test_gem_config_file.rb38
-rw-r--r--test/rubygems/test_gem_dependency.rb138
-rw-r--r--test/rubygems/test_gem_dependency_installer.rb379
-rw-r--r--test/rubygems/test_gem_dependency_list.rb34
-rw-r--r--test/rubygems/test_gem_dependency_resolution_error.rb28
-rw-r--r--test/rubygems/test_gem_dependency_resolver.rb327
-rw-r--r--test/rubygems/test_gem_dependency_resolver_api_set.rb80
-rw-r--r--test/rubygems/test_gem_doctor.rb2
-rw-r--r--test/rubygems/test_gem_ext_builder.rb276
-rw-r--r--test/rubygems/test_gem_ext_cmake_builder.rb8
-rw-r--r--test/rubygems/test_gem_ext_configure_builder.rb18
-rw-r--r--test/rubygems/test_gem_ext_ext_conf_builder.rb106
-rw-r--r--test/rubygems/test_gem_ext_rake_builder.rb4
-rw-r--r--test/rubygems/test_gem_gem_runner.rb30
-rw-r--r--test/rubygems/test_gem_gemcutter_utilities.rb9
-rw-r--r--test/rubygems/test_gem_impossible_dependencies_error.rb61
-rw-r--r--test/rubygems/test_gem_indexer.rb15
-rw-r--r--test/rubygems/test_gem_install_update_options.rb39
-rw-r--r--test/rubygems/test_gem_installer.rb379
-rw-r--r--test/rubygems/test_gem_local_remote_options.rb15
-rw-r--r--test/rubygems/test_gem_name_tuple.rb29
-rw-r--r--test/rubygems/test_gem_package.rb202
-rw-r--r--test/rubygems/test_gem_package_old.rb8
-rw-r--r--test/rubygems/test_gem_package_tar_header.rb16
-rw-r--r--test/rubygems/test_gem_package_tar_reader.rb29
-rw-r--r--test/rubygems/test_gem_package_tar_reader_entry.rb21
-rw-r--r--test/rubygems/test_gem_package_tar_writer.rb135
-rw-r--r--test/rubygems/test_gem_path_support.rb17
-rw-r--r--test/rubygems/test_gem_platform.rb24
-rw-r--r--test/rubygems/test_gem_rdoc.rb2
-rw-r--r--test/rubygems/test_gem_remote_fetcher.rb448
-rw-r--r--test/rubygems/test_gem_request.rb362
-rw-r--r--test/rubygems/test_gem_request_connection_pools.rb120
-rw-r--r--test/rubygems/test_gem_request_set.rb545
-rw-r--r--test/rubygems/test_gem_request_set_gem_dependency_api.rb814
-rw-r--r--test/rubygems/test_gem_request_set_lockfile.rb1238
-rw-r--r--test/rubygems/test_gem_requirement.rb34
-rw-r--r--test/rubygems/test_gem_resolver.rb733
-rw-r--r--test/rubygems/test_gem_resolver_activation_request.rb73
-rw-r--r--test/rubygems/test_gem_resolver_api_set.rb208
-rw-r--r--test/rubygems/test_gem_resolver_api_specification.rb144
-rw-r--r--test/rubygems/test_gem_resolver_best_set.rb137
-rw-r--r--test/rubygems/test_gem_resolver_composed_set.rb45
-rw-r--r--test/rubygems/test_gem_resolver_conflict.rb87
-rw-r--r--test/rubygems/test_gem_resolver_dependency_request.rb84
-rw-r--r--test/rubygems/test_gem_resolver_git_set.rb189
-rw-r--r--test/rubygems/test_gem_resolver_git_specification.rb112
-rw-r--r--test/rubygems/test_gem_resolver_index_set.rb89
-rw-r--r--test/rubygems/test_gem_resolver_index_specification.rb89
-rw-r--r--test/rubygems/test_gem_resolver_installed_specification.rb49
-rw-r--r--test/rubygems/test_gem_resolver_installer_set.rb247
-rw-r--r--test/rubygems/test_gem_resolver_local_specification.rb45
-rw-r--r--test/rubygems/test_gem_resolver_lock_set.rb63
-rw-r--r--test/rubygems/test_gem_resolver_lock_specification.rb98
-rw-r--r--test/rubygems/test_gem_resolver_requirement_list.rb20
-rw-r--r--test/rubygems/test_gem_resolver_specification.rb64
-rw-r--r--test/rubygems/test_gem_resolver_vendor_set.rb83
-rw-r--r--test/rubygems/test_gem_resolver_vendor_specification.rb83
-rw-r--r--test/rubygems/test_gem_security.rb60
-rw-r--r--test/rubygems/test_gem_security_policy.rb56
-rw-r--r--test/rubygems/test_gem_security_signer.rb20
-rw-r--r--test/rubygems/test_gem_security_trust_dir.rb6
-rw-r--r--test/rubygems/test_gem_server.rb81
-rw-r--r--test/rubygems/test_gem_silent_ui.rb5
-rw-r--r--test/rubygems/test_gem_source.rb163
-rw-r--r--test/rubygems/test_gem_source_fetch_problem.rb19
-rw-r--r--test/rubygems/test_gem_source_git.rb297
-rw-r--r--test/rubygems/test_gem_source_installed.rb36
-rw-r--r--test/rubygems/test_gem_source_list.rb24
-rw-r--r--test/rubygems/test_gem_source_local.rb37
-rw-r--r--test/rubygems/test_gem_source_lock.rb114
-rw-r--r--test/rubygems/test_gem_source_specific_file.rb44
-rw-r--r--test/rubygems/test_gem_source_vendor.rb31
-rw-r--r--test/rubygems/test_gem_spec_fetcher.rb180
-rw-r--r--test/rubygems/test_gem_specification.rb1209
-rw-r--r--test/rubygems/test_gem_stub_specification.rb191
-rw-r--r--test/rubygems/test_gem_uninstaller.rb84
-rw-r--r--test/rubygems/test_gem_unsatisfiable_dependency_error.rb32
-rw-r--r--test/rubygems/test_gem_uri_formatter.rb28
-rw-r--r--test/rubygems/test_gem_util.rb31
-rw-r--r--test/rubygems/test_gem_validator.rb9
-rw-r--r--test/rubygems/test_gem_version.rb26
-rw-r--r--test/rubygems/test_gem_version_option.rb64
-rw-r--r--test/rubygems/test_kernel.rb6
-rw-r--r--test/rubygems/test_require.rb60
-rw-r--r--test/runner.rb37
-rw-r--r--test/scanf/test_scanf.rb38
-rw-r--r--test/sdbm/test_sdbm.rb67
-rw-r--r--test/shell/test_command_processor.rb69
-rw-r--r--test/socket/test_addrinfo.rb4
-rw-r--r--test/socket/test_nonblock.rb29
-rw-r--r--test/socket/test_socket.rb131
-rw-r--r--test/socket/test_sockopt.rb32
-rw-r--r--test/socket/test_tcp.rb89
-rw-r--r--test/socket/test_udp.rb33
-rw-r--r--test/socket/test_unix.rb219
-rw-r--r--test/stringio/test_stringio.rb58
-rw-r--r--test/strscan/test_stringscanner.rb15
-rw-r--r--test/syslog/test_syslog_logger.rb102
-rw-r--r--test/test_curses.rb63
-rw-r--r--test/test_delegate.rb104
-rw-r--r--test/test_find.rb81
-rw-r--r--test/test_ipaddr.rb274
-rw-r--r--test/test_mathn.rb20
-rw-r--r--test/test_open3.rb20
-rw-r--r--test/test_prime.rb6
-rw-r--r--test/test_pstore.rb20
-rw-r--r--test/test_pty.rb43
-rw-r--r--test/test_securerandom.rb2
-rw-r--r--test/test_set.rb157
-rw-r--r--test/test_syslog.rb98
-rw-r--r--test/test_tempfile.rb24
-rw-r--r--test/test_time.rb113
-rw-r--r--test/test_timeout.rb71
-rw-r--r--test/test_tracer.rb2
-rw-r--r--test/test_tsort.rb56
-rw-r--r--test/test_weakref.rb28
-rw-r--r--test/testunit/test4test_hideskip.rb2
-rw-r--r--test/testunit/test4test_redefinition.rb2
-rw-r--r--test/testunit/test4test_sorting.rb2
-rw-r--r--test/testunit/test_hideskip.rb29
-rw-r--r--test/testunit/test_parallel.rb18
-rw-r--r--test/testunit/test_rake_integration.rb1
-rw-r--r--test/testunit/test_redefinition.rb14
-rw-r--r--test/testunit/test_sorting.rb14
-rw-r--r--test/testunit/tests_for_parallel/ptest_forth.rb8
-rw-r--r--test/testunit/tests_for_parallel/runner.rb3
-rw-r--r--test/thread/test_cv.rb35
-rw-r--r--test/thread/test_queue.rb170
-rw-r--r--test/thread/test_sync.rb6
-rw-r--r--test/uri/test_common.rb116
-rw-r--r--test/uri/test_generic.rb59
-rw-r--r--test/uri/test_mailto.rb4
-rw-r--r--test/webrick/test_filehandler.rb19
-rw-r--r--test/webrick/test_htmlutils.rb20
-rw-r--r--test/webrick/test_httpauth.rb168
-rw-r--r--test/webrick/test_httpproxy.rb2
-rw-r--r--test/webrick/test_httprequest.rb2
-rw-r--r--test/webrick/test_httpresponse.rb94
-rw-r--r--test/webrick/test_httpserver.rb23
-rw-r--r--test/webrick/test_httputils.rb4
-rw-r--r--test/webrick/test_server.rb2
-rw-r--r--test/webrick/utils.rb8
-rw-r--r--test/win32ole/test_err_in_callback.rb4
-rw-r--r--test/win32ole/test_win32ole.rb51
-rw-r--r--test/win32ole/test_win32ole_event.rb19
-rw-r--r--test/win32ole/test_win32ole_method.rb8
-rw-r--r--test/win32ole/test_win32ole_record.rb313
-rw-r--r--test/win32ole/test_win32ole_typelib.rb2
-rw-r--r--test/win32ole/test_win32ole_variant.rb72
-rw-r--r--test/win32ole/test_win32ole_variant_outarg.rb2
-rw-r--r--test/win32ole/test_word.rb1
-rw-r--r--test/xmlrpc/test_client.rb24
-rw-r--r--test/xmlrpc/test_cookie.rb14
-rw-r--r--test/xmlrpc/test_datetime.rb2
-rw-r--r--test/xmlrpc/test_features.rb6
-rw-r--r--test/xmlrpc/test_marshal.rb2
-rw-r--r--test/xmlrpc/test_parser.rb2
-rw-r--r--test/xmlrpc/test_webrick_server.rb15
-rw-r--r--test/xmlrpc/webrick_testing.rb26
-rw-r--r--test/zlib/test_zlib.rb761
-rw-r--r--thread.c1195
-rw-r--r--thread_pthread.c403
-rw-r--r--thread_pthread.h20
-rw-r--r--thread_win32.c124
-rw-r--r--thread_win32.h11
-rw-r--r--time.c366
-rw-r--r--timev.h41
-rwxr-xr-xtool/bisect.sh42
-rwxr-xr-xtool/change_maker.rb4
-rw-r--r--tool/compile_prelude.rb1
-rwxr-xr-xtool/config.guess1522
-rwxr-xr-xtool/config.sub1771
-rw-r--r--tool/downloader.rb11
-rwxr-xr-xtool/enc-unicode.rb6
-rwxr-xr-xtool/expand-config.rb7
-rw-r--r--tool/fake.rb30
-rwxr-xr-xtool/file2lastrev.rb7
-rwxr-xr-xtool/gen_dummy_probes.rb14
-rwxr-xr-xtool/gen_ruby_tapset.rb105
-rw-r--r--tool/generic_erb.rb4
-rwxr-xr-xtool/get-config_files13
-rwxr-xr-xtool/ifchange17
-rwxr-xr-xtool/instruction.rb12
-rwxr-xr-xtool/make-snapshot125
-rwxr-xr-xtool/merger.rb49
-rwxr-xr-xtool/mkconfig.rb31
-rwxr-xr-xtool/mkrunnable.rb100
-rw-r--r--tool/probes_to_wiki.rb16
-rwxr-xr-xtool/rbinstall.rb106
-rwxr-xr-xtool/rbuninstall.rb67
-rwxr-xr-xtool/redmine-backporter.rb411
-rwxr-xr-xtool/release.sh38
-rwxr-xr-xtool/rubytest.rb3
-rwxr-xr-xtool/strip-rdoc.rb1
-rw-r--r--tool/transcode-tblgen.rb98
-rwxr-xr-xtool/update-deps258
-rw-r--r--tool/vcs.rb48
-rw-r--r--transcode.c84
-rw-r--r--transcode_data.h8
-rw-r--r--util.c74
-rw-r--r--variable.c281
-rw-r--r--version.c76
-rw-r--r--version.h15
-rw-r--r--vm.c925
-rw-r--r--vm_backtrace.c243
-rw-r--r--vm_core.h319
-rw-r--r--vm_debug.h8
-rw-r--r--vm_dump.c417
-rw-r--r--vm_eval.c456
-rw-r--r--vm_exec.c25
-rw-r--r--vm_exec.h15
-rw-r--r--vm_insnhelper.c423
-rw-r--r--vm_insnhelper.h61
-rw-r--r--vm_method.c443
-rw-r--r--vm_trace.c396
-rw-r--r--vsnprintf.c11
-rw-r--r--win32/Makefile.sub122
-rwxr-xr-xwin32/configure.bat60
-rw-r--r--win32/file.c293
-rwxr-xr-xwin32/ifchange.bat24
-rwxr-xr-xwin32/rmall.bat6
-rw-r--r--win32/setup.mak28
-rw-r--r--win32/win32.c949
2012 files changed, 216187 insertions, 108396 deletions
diff --git a/.gdbinit b/.gdbinit
index c8705a6ccf..e2a34f3715 100644
--- a/.gdbinit
+++ b/.gdbinit
@@ -1,80 +1,34 @@
-define rp
+define hook-run
+ set $color_type = 0
+ set $color_highlite = 0
+ set $color_end = 0
+end
+
+define ruby_gdb_init
+ if !$color_type
+ set $color_type = "\033[31m"
+ end
+ if !$color_highlite
+ set $color_highlite = "\033[36m"
+ end
+ 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 (VALUE)($arg0) & RUBY_FIXNUM_FLAG
printf "FIXNUM: %ld\n", (long)($arg0) >> 1
else
if ((VALUE)($arg0) & ~(~(VALUE)0<<RUBY_SPECIAL_SHIFT)) == RUBY_SYMBOL_FLAG
set $id = (($arg0) >> RUBY_SPECIAL_SHIFT)
- if $id == '!' || $id == '+' || $id == '-' || $id == '*' || $id == '/' || $id == '%' || $id == '<' || $id == '>' || $id == '`'
- printf "SYMBOL(:%c)\n", $id
- else
- if $id == idDot2
- echo SYMBOL(:..)\n
- else
- if $id == idDot3
- echo SYMBOL(:...)\n
- else
- if $id == idUPlus
- echo SYMBOL(:+@)\n
- else
- if $id == idUMinus
- echo SYMBOL(:-@)\n
- else
- if $id == idPow
- echo SYMBOL(:**)\n
- else
- if $id == idCmp
- echo SYMBOL(:<=>)\n
- else
- if $id == idLTLT
- echo SYMBOL(:<<)\n
- else
- if $id == idLE
- echo SYMBOL(:<=)\n
- else
- if $id == idGE
- echo SYMBOL(:>=)\n
- else
- if $id == idEq
- echo SYMBOL(:==)\n
- else
- if $id == idEqq
- echo SYMBOL(:===)\n
- else
- if $id == idNeq
- echo SYMBOL(:!=)\n
- else
- if $id == idEqTilde
- echo SYMBOL(:=~)\n
- else
- if $id == idNeqTilde
- echo SYMBOL(:!~)\n
- else
- if $id == idAREF
- echo SYMBOL(:[])\n
- else
- if $id == idASET
- echo SYMBOL(:[]=)\n
- else
- printf "SYMBOL(%ld)\n", $id
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
- end
+ printf "%sSYMBOL%s: ", $color_type, $color_end
+ rp_id $id
else
if ($arg0) == RUBY_Qfalse
echo false\n
@@ -90,80 +44,51 @@ define rp
else
if (VALUE)($arg0) & RUBY_IMMEDIATE_MASK
if ((VALUE)($arg0) & RUBY_FLONUM_MASK) == RUBY_FLONUM_FLAG
- printf "FLONUM: %g\n", (double)rb_float_value($arg0)
+ printf "%sFLONUM%s: %g\n", $color_type, $color_end, (double)rb_float_value($arg0)
else
echo immediate\n
end
else
set $flags = ((struct RBasic*)($arg0))->flags
+ if ($flags & RUBY_FL_PROMOTED) == RUBY_FL_PROMOTED
+ printf "[PROMOTED] "
+ end
if ($flags & RUBY_T_MASK) == RUBY_T_NONE
- printf "T_NONE: "
+ printf "%sT_NONE%s: ", $color_type, $color_end
print (struct RBasic *)($arg0)
else
if ($flags & RUBY_T_MASK) == RUBY_T_NIL
- printf "T_NIL: "
+ printf "%sT_NIL%s: ", $color_type, $color_end
print (struct RBasic *)($arg0)
else
if ($flags & RUBY_T_MASK) == RUBY_T_OBJECT
- printf "T_OBJECT: "
+ printf "%sT_OBJECT%s: ", $color_type, $color_end
print (struct RObject *)($arg0)
else
if ($flags & RUBY_T_MASK) == RUBY_T_CLASS
- printf "T_CLASS%s: ", ($flags & RUBY_FL_SINGLETON) ? "*" : ""
+ printf "%sT_CLASS%s%s: ", $color_type, ($flags & RUBY_FL_SINGLETON) ? "*" : "", $color_end
rp_class $arg0
else
if ($flags & RUBY_T_MASK) == RUBY_T_ICLASS
- printf "T_ICLASS: "
+ printf "%sT_ICLASS%s: ", $color_type, $color_end
rp_class $arg0
else
if ($flags & RUBY_T_MASK) == RUBY_T_MODULE
- printf "T_MODULE: "
+ printf "%sT_MODULE%s: ", $color_type, $color_end
rp_class $arg0
else
if ($flags & RUBY_T_MASK) == RUBY_T_FLOAT
- printf "T_FLOAT: %.16g ", (((struct RFloat*)($arg0))->float_value)
+ printf "%sT_FLOAT%s: %.16g ", $color_type, $color_end, (((struct RFloat*)($arg0))->float_value)
print (struct RFloat *)($arg0)
else
if ($flags & RUBY_T_MASK) == RUBY_T_STRING
- printf "T_STRING: "
- set print address off
- output (char *)(($flags & RUBY_FL_USER1) ? \
- ((struct RString*)($arg0))->as.heap.ptr : \
- ((struct RString*)($arg0))->as.ary)
- set print address on
- printf " bytesize:%ld ", ($flags & RUBY_FL_USER1) ? \
- ((struct RString*)($arg0))->as.heap.len : \
- (($flags & (RUBY_FL_USER2|RUBY_FL_USER3|RUBY_FL_USER4|RUBY_FL_USER5|RUBY_FL_USER6)) >> RUBY_FL_USHIFT+2)
- if !($flags & RUBY_FL_USER1)
- printf "(embed) "
- else
- if ($flags & RUBY_FL_USER2)
- printf "(shared) "
- end
- if ($flags & RUBY_FL_USER3)
- printf "(assoc) "
- end
- end
- printf "encoding:%d ", ($flags & RUBY_ENCODING_MASK) >> RUBY_ENCODING_SHIFT
- if ($flags & RUBY_ENC_CODERANGE_MASK) == 0
- printf "coderange:unknown "
- else
- if ($flags & RUBY_ENC_CODERANGE_MASK) == RUBY_ENC_CODERANGE_7BIT
- printf "coderange:7bit "
- else
- if ($flags & RUBY_ENC_CODERANGE_MASK) == RUBY_ENC_CODERANGE_VALID
- printf "coderange:valid "
- else
- printf "coderange:broken "
- end
- end
- end
- print (struct RString *)($arg0)
+ printf "%sT_STRING%s: ", $color_type, $color_end
+ rp_string $arg0 $flags
else
if ($flags & RUBY_T_MASK) == RUBY_T_REGEXP
set $regsrc = ((struct RRegexp*)($arg0))->src
set $rsflags = ((struct RBasic*)$regsrc)->flags
- printf "T_REGEXP: "
+ printf "%sT_REGEXP%s: ", $color_type, $color_end
set print address off
output (char *)(($rsflags & RUBY_FL_USER1) ? \
((struct RString*)$regsrc)->as.heap.ptr : \
@@ -187,7 +112,7 @@ define rp
if ($flags & RUBY_T_MASK) == RUBY_T_ARRAY
if ($flags & RUBY_FL_USER1)
set $len = (($flags & (RUBY_FL_USER3|RUBY_FL_USER4)) >> (RUBY_FL_USHIFT+3))
- printf "T_ARRAY: len=%ld ", $len
+ printf "%sT_ARRAY%s: len=%ld ", $color_type, $color_end, $len
printf "(embed) "
if ($len == 0)
printf "{(empty)} "
@@ -197,7 +122,7 @@ define rp
end
else
set $len = ((struct RArray*)($arg0))->as.heap.len
- printf "T_ARRAY: len=%ld ", $len
+ printf "%sT_ARRAY%s: len=%ld ", $color_type, $color_end, $len
if ($flags & RUBY_FL_USER2)
printf "(shared) shared="
output/x ((struct RArray*)($arg0))->as.heap.aux.shared
@@ -215,18 +140,18 @@ define rp
print (struct RArray *)($arg0)
else
if ($flags & RUBY_T_MASK) == RUBY_T_FIXNUM
- printf "T_FIXNUM: "
+ printf "%sT_FIXNUM%s: ", $color_type, $color_end
print (struct RBasic *)($arg0)
else
if ($flags & RUBY_T_MASK) == RUBY_T_HASH
- printf "T_HASH: ",
+ printf "%sT_HASH%s: ", $color_type, $color_end,
if ((struct RHash *)($arg0))->ntbl
printf "len=%ld ", ((struct RHash *)($arg0))->ntbl->num_entries
end
print (struct RHash *)($arg0)
else
if ($flags & RUBY_T_MASK) == RUBY_T_STRUCT
- printf "T_STRUCT: len=%ld ", \
+ printf "%sT_STRUCT%s: len=%ld ", $color_type, $color_end, \
(($flags & (RUBY_FL_USER1|RUBY_FL_USER2)) ? \
($flags & (RUBY_FL_USER1|RUBY_FL_USER2)) >> (RUBY_FL_USHIFT+1) : \
((struct RStruct *)($arg0))->as.heap.len)
@@ -236,7 +161,7 @@ define rp
((struct RStruct *)($arg0))->as.heap.ptr)
else
if ($flags & RUBY_T_MASK) == RUBY_T_BIGNUM
- printf "T_BIGNUM: sign=%d len=%ld ", \
+ printf "%sT_BIGNUM%s: sign=%d len=%ld ", $color_type, $color_end, \
(($flags & RUBY_FL_USER1) != 0), \
(($flags & RUBY_FL_USER2) ? \
($flags & (RUBY_FL_USER5|RUBY_FL_USER4|RUBY_FL_USER3)) >> (RUBY_FL_USHIFT+3) : \
@@ -250,59 +175,87 @@ define rp
((struct RBignum*)($arg0))->as.heap.digits)
else
if ($flags & RUBY_T_MASK) == RUBY_T_RATIONAL
- printf "T_RATIONAL: "
+ printf "%sT_RATIONAL%s: ", $color_type, $color_end
print (struct RRational *)($arg0)
else
if ($flags & RUBY_T_MASK) == RUBY_T_COMPLEX
- printf "T_COMPLEX: "
+ printf "%sT_COMPLEX%s: ", $color_type, $color_end
print (struct RComplex *)($arg0)
else
if ($flags & RUBY_T_MASK) == RUBY_T_FILE
- printf "T_FILE: "
+ printf "%sT_FILE%s: ", $color_type, $color_end
print (struct RFile *)($arg0)
output *((struct RFile *)($arg0))->fptr
printf "\n"
else
if ($flags & RUBY_T_MASK) == RUBY_T_TRUE
- printf "T_TRUE: "
+ printf "%sT_TRUE%s: ", $color_type, $color_end
print (struct RBasic *)($arg0)
else
if ($flags & RUBY_T_MASK) == RUBY_T_FALSE
- printf "T_FALSE: "
+ printf "%sT_FALSE%s: ", $color_type, $color_end
print (struct RBasic *)($arg0)
else
if ($flags & RUBY_T_MASK) == RUBY_T_DATA
if ((struct RTypedData *)($arg0))->typed_flag == 1
- printf "T_DATA(%s): ", ((struct RTypedData *)($arg0))->type->wrap_struct_name
+ printf "%sT_DATA%s(%s): ", $color_type, $color_end, ((struct RTypedData *)($arg0))->type->wrap_struct_name
print (struct RTypedData *)($arg0)
else
- printf "T_DATA: "
+ printf "%sT_DATA%s: ", $color_type, $color_end
print (struct RData *)($arg0)
end
else
if ($flags & RUBY_T_MASK) == RUBY_T_MATCH
- printf "T_MATCH: "
+ printf "%sT_MATCH%s: ", $color_type, $color_end
print (struct RMatch *)($arg0)
else
if ($flags & RUBY_T_MASK) == RUBY_T_SYMBOL
- printf "T_SYMBOL: "
- print (struct RBasic *)($arg0)
+ printf "%sT_SYMBOL%s: ", $color_type, $color_end
+ print (struct RSymbol *)($arg0)
+ set $id_type = ((struct RSymbol *)($arg0))->type
+ 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
else
if ($flags & RUBY_T_MASK) == RUBY_T_UNDEF
- printf "T_UNDEF: "
+ printf "%sT_UNDEF%s: ", $color_type, $color_end
print (struct RBasic *)($arg0)
else
if ($flags & RUBY_T_MASK) == RUBY_T_NODE
- printf "T_NODE("
+ printf "%sT_NODE%s(", $color_type, $color_end
output (enum node_type)(($flags&RUBY_NODE_TYPEMASK)>>RUBY_NODE_TYPESHIFT)
printf "): "
print *(NODE *)($arg0)
else
if ($flags & RUBY_T_MASK) == RUBY_T_ZOMBIE
- printf "T_ZOMBIE: "
+ printf "%sT_ZOMBIE%s: ", $color_type, $color_end
print (struct RData *)($arg0)
else
- printf "unknown: "
+ printf "%sunknown%s: ", $color_type, $color_end
print (struct RBasic *)($arg0)
end
end
@@ -341,12 +294,165 @@ document rp
Print a Ruby's VALUE.
end
+define rp_id
+ set $id = (ID)$arg0
+ if $id == '!' || $id == '+' || $id == '-' || $id == '*' || $id == '/' || $id == '%' || $id == '<' || $id == '>' || $id == '`'
+ printf "(:%c)\n", $id
+ else
+ if $id == idDot2
+ printf "(:..)\n"
+ else
+ if $id == idDot3
+ printf "(:...)\n"
+ else
+ if $id == idUPlus
+ printf "(:+@)\n"
+ else
+ if $id == idUMinus
+ printf "(:-@)\n"
+ else
+ if $id == idPow
+ printf "(:**)\n"
+ else
+ if $id == idCmp
+ printf "(:<=>)\n"
+ else
+ if $id == idLTLT
+ printf "(:<<)\n"
+ else
+ if $id == idLE
+ printf "(:<=)\n"
+ else
+ if $id == idGE
+ printf "(:>=)\n"
+ else
+ if $id == idEq
+ printf "(:==)\n"
+ else
+ if $id == idEqq
+ printf "(:===)\n"
+ else
+ if $id == idNeq
+ printf "(:!=)\n"
+ else
+ if $id == idEqTilde
+ printf "(:=~)\n"
+ else
+ if $id == idNeqTilde
+ printf "(:!~)\n"
+ else
+ if $id == idAREF
+ printf "(:[])\n"
+ else
+ if $id == idASET
+ printf "(:[]=)\n"
+ else
+ if $id <= tLAST_OP_ID
+ printf "O"
+ else
+ set $id_type = $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
+ end
+ printf "(%ld): ", $id
+ rb_numtable_entry global_symbols.id_str $id
+ if $rb_numtable_rec
+ rp_string $rb_numtable_rec
+ else
+ echo undef\n
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+end
+document rp_id
+ Print an ID.
+end
+
+define rp_string
+ set $flags = ((struct RBasic*)($arg0))->flags
+ set print address off
+ output (char *)(($flags & RUBY_FL_USER1) ? \
+ ((struct RString*)($arg0))->as.heap.ptr : \
+ ((struct RString*)($arg0))->as.ary)
+ set print address on
+ printf " bytesize:%ld ", ($flags & RUBY_FL_USER1) ? \
+ ((struct RString*)($arg0))->as.heap.len : \
+ (($flags & (RUBY_FL_USER2|RUBY_FL_USER3|RUBY_FL_USER4|RUBY_FL_USER5|RUBY_FL_USER6)) >> RUBY_FL_USHIFT+2)
+ if !($flags & RUBY_FL_USER1)
+ printf "(embed) "
+ else
+ if ($flags & RUBY_FL_USER2)
+ printf "(shared) "
+ end
+ if ($flags & RUBY_FL_USER3)
+ printf "(assoc) "
+ end
+ end
+ printf "encoding:%d ", ($flags & RUBY_ENCODING_MASK) >> RUBY_ENCODING_SHIFT
+ if ($flags & RUBY_ENC_CODERANGE_MASK) == 0
+ printf "coderange:unknown "
+ else
+ if ($flags & RUBY_ENC_CODERANGE_MASK) == RUBY_ENC_CODERANGE_7BIT
+ printf "coderange:7bit "
+ else
+ if ($flags & RUBY_ENC_CODERANGE_MASK) == RUBY_ENC_CODERANGE_VALID
+ printf "coderange:valid "
+ else
+ printf "coderange:broken "
+ end
+ end
+ end
+ print (struct RString *)($arg0)
+end
+document rp_string
+ Print the content of a String.
+end
+
define rp_class
printf "(struct RClass *) %p", (void*)$arg0
if ((struct RClass *)($arg0))->ptr.origin != $arg0
printf " -> %p", ((struct RClass *)($arg0))->ptr.origin
end
printf "\n"
+ rb_classname $arg0
print *(struct RClass *)($arg0)
print *((struct RClass *)($arg0))->ptr
end
@@ -378,257 +484,257 @@ end
# Print members of ruby node.
define nd_head
- printf "u1.node: "
+ printf "%su1.node%s: ", $color_highlite, $color_end
rp ($arg0).u1.node
end
define nd_alen
- printf "u2.argc: "
+ printf "%su2.argc%s: ", $color_highlite, $color_end
p ($arg0).u2.argc
end
define nd_next
- printf "u3.node: "
+ printf "%su3.node%s: ", $color_highlite, $color_end
rp ($arg0).u3.node
end
define nd_cond
- printf "u1.node: "
+ printf "%su1.node%s: ", $color_highlite, $color_end
rp ($arg0).u1.node
end
define nd_body
- printf "u2.node: "
+ printf "%su2.node%s: ", $color_highlite, $color_end
rp ($arg0).u2.node
end
define nd_else
- printf "u3.node: "
+ printf "%su3.node%s: ", $color_highlite, $color_end
rp ($arg0).u3.node
end
define nd_orig
- printf "u3.value: "
+ printf "%su3.value%s: ", $color_highlite, $color_end
rp ($arg0).u3.value
end
define nd_resq
- printf "u2.node: "
+ printf "%su2.node%s: ", $color_highlite, $color_end
rp ($arg0).u2.node
end
define nd_ensr
- printf "u3.node: "
+ printf "%su3.node%s: ", $color_highlite, $color_end
rp ($arg0).u3.node
end
define nd_1st
- printf "u1.node: "
+ printf "%su1.node%s: ", $color_highlite, $color_end
rp ($arg0).u1.node
end
define nd_2nd
- printf "u2.node: "
+ printf "%su2.node%s: ", $color_highlite, $color_end
rp ($arg0).u2.node
end
define nd_stts
- printf "u1.node: "
+ printf "%su1.node%s: ", $color_highlite, $color_end
rp ($arg0).u1.node
end
define nd_entry
- printf "u3.entry: "
+ printf "%su3.entry%s: ", $color_highlite, $color_end
p ($arg0).u3.entry
end
define nd_vid
- printf "u1.id: "
+ printf "%su1.id%s: ", $color_highlite, $color_end
p ($arg0).u1.id
end
define nd_cflag
- printf "u2.id: "
+ printf "%su2.id%s: ", $color_highlite, $color_end
p ($arg0).u2.id
end
define nd_cval
- printf "u3.value: "
+ printf "%su3.value%s: ", $color_highlite, $color_end
rp ($arg0).u3.value
end
define nd_cnt
- printf "u3.cnt: "
+ printf "%su3.cnt%s: ", $color_highlite, $color_end
p ($arg0).u3.cnt
end
define nd_tbl
- printf "u1.tbl: "
+ printf "%su1.tbl%s: ", $color_highlite, $color_end
p ($arg0).u1.tbl
end
define nd_var
- printf "u1.node: "
+ printf "%su1.node%s: ", $color_highlite, $color_end
rp ($arg0).u1.node
end
define nd_ibdy
- printf "u2.node: "
+ printf "%su2.node%s: ", $color_highlite, $color_end
rp ($arg0).u2.node
end
define nd_iter
- printf "u3.node: "
+ printf "%su3.node%s: ", $color_highlite, $color_end
rp ($arg0).u3.node
end
define nd_value
- printf "u2.node: "
+ printf "%su2.node%s: ", $color_highlite, $color_end
rp ($arg0).u2.node
end
define nd_aid
- printf "u3.id: "
+ printf "%su3.id%s: ", $color_highlite, $color_end
p ($arg0).u3.id
end
define nd_lit
- printf "u1.value: "
+ printf "%su1.value%s: ", $color_highlite, $color_end
rp ($arg0).u1.value
end
define nd_frml
- printf "u1.node: "
+ printf "%su1.node%s: ", $color_highlite, $color_end
rp ($arg0).u1.node
end
define nd_rest
- printf "u2.argc: "
+ printf "%su2.argc%s: ", $color_highlite, $color_end
p ($arg0).u2.argc
end
define nd_opt
- printf "u1.node: "
+ printf "%su1.node%s: ", $color_highlite, $color_end
rp ($arg0).u1.node
end
define nd_recv
- printf "u1.node: "
+ printf "%su1.node%s: ", $color_highlite, $color_end
rp ($arg0).u1.node
end
define nd_mid
- printf "u2.id: "
+ printf "%su2.id%s: ", $color_highlite, $color_end
p ($arg0).u2.id
end
define nd_args
- printf "u3.node: "
+ printf "%su3.node%s: ", $color_highlite, $color_end
rp ($arg0).u3.node
end
define nd_noex
- printf "u1.id: "
+ printf "%su1.id%s: ", $color_highlite, $color_end
p ($arg0).u1.id
end
define nd_defn
- printf "u3.node: "
+ printf "%su3.node%s: ", $color_highlite, $color_end
rp ($arg0).u3.node
end
define nd_old
- printf "u1.id: "
+ printf "%su1.id%s: ", $color_highlite, $color_end
p ($arg0).u1.id
end
define nd_new
- printf "u2.id: "
+ printf "%su2.id%s: ", $color_highlite, $color_end
p ($arg0).u2.id
end
define nd_cfnc
- printf "u1.cfunc: "
+ printf "%su1.cfunc%s: ", $color_highlite, $color_end
p ($arg0).u1.cfunc
end
define nd_argc
- printf "u2.argc: "
+ printf "%su2.argc%s: ", $color_highlite, $color_end
p ($arg0).u2.argc
end
define nd_cname
- printf "u1.id: "
+ printf "%su1.id%s: ", $color_highlite, $color_end
p ($arg0).u1.id
end
define nd_super
- printf "u3.node: "
+ printf "%su3.node%s: ", $color_highlite, $color_end
rp ($arg0).u3.node
end
define nd_modl
- printf "u1.id: "
+ printf "%su1.id%s: ", $color_highlite, $color_end
p ($arg0).u1.id
end
define nd_clss
- printf "u1.value: "
+ printf "%su1.value%s: ", $color_highlite, $color_end
rp ($arg0).u1.value
end
define nd_beg
- printf "u1.node: "
+ printf "%su1.node%s: ", $color_highlite, $color_end
rp ($arg0).u1.node
end
define nd_end
- printf "u2.node: "
+ printf "%su2.node%s: ", $color_highlite, $color_end
rp ($arg0).u2.node
end
define nd_state
- printf "u3.state: "
+ printf "%su3.state%s: ", $color_highlite, $color_end
p ($arg0).u3.state
end
define nd_rval
- printf "u2.value: "
+ printf "%su2.value%s: ", $color_highlite, $color_end
rp ($arg0).u2.value
end
define nd_nth
- printf "u2.argc: "
+ printf "%su2.argc%s: ", $color_highlite, $color_end
p ($arg0).u2.argc
end
define nd_tag
- printf "u1.id: "
+ printf "%su1.id%s: ", $color_highlite, $color_end
p ($arg0).u1.id
end
define nd_tval
- printf "u2.value: "
+ printf "%su2.value%s: ", $color_highlite, $color_end
rp ($arg0).u2.value
end
@@ -653,7 +759,7 @@ define rb_numtable_entry
end
end
else
- set $rb_numtable_p = $rb_numtable_tbl->as.big.bins[$rb_numtable_id % $rb_numtable_tbl->num_bins]
+ set $rb_numtable_p = $rb_numtable_tbl->as.big.bins[st_numhash($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
@@ -667,12 +773,9 @@ define rb_numtable_entry
end
define rb_id2name
- rb_numtable_entry global_symbols.id_str (ID)$arg0
- if $rb_numtable_rec
- rp $rb_numtable_rec
- else
- echo undef\n
- end
+ ruby_gdb_init
+ printf "%sID%s: ", $color_type, $color_end
+ rp_id $arg0
end
document rb_id2name
Print the name of id
@@ -683,10 +786,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 $rb_method_entry_id
+ rb_numtable_entry $rb_method_entry_klass->m_tbl_wrapper->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 *)$rb_method_entry_klass->ptr->super
+ set $rb_method_entry_klass = (struct RClass *)RCLASS_SUPER($rb_method_entry_klass)
end
end
if $rb_method_entry_me
@@ -701,16 +804,21 @@ document rb_method_entry
end
define rb_classname
- call classname($arg0)
- rb_p $
- print *(struct RClass*)($arg0)
+ # up to 128bit int
+ set $rb_classname_permanent = "0123456789ABCDEF"
+ set $rb_classname = classname($arg0, $rb_classname_permanent)
+ if $rb_classname != RUBY_Qnil
+ rp $rb_classname
+ else
+ echo anonymous class/module\n
+ end
end
define rb_ancestors
set $rb_ancestors_module = $arg0
while $rb_ancestors_module
- rp $rb_ancestors_module
- set $rb_ancestors_module = ((struct RClass *)($rb_ancestors_module))->ptr.super
+ rp_class $rb_ancestors_module
+ set $rb_ancestors_module = RCLASS_SUPER($rb_ancestors_module)
end
end
document rb_ancestors
diff --git a/.gitignore b/.gitignore
index 5808bf1082..9515852837 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,19 +23,22 @@
.ppack
.svn
Makefile
+Makefile.old
extconf.h
y.output
y.tab.c
# /
+/*-fake.rb
/*.pc
/*_prelude.c
/COPYING.LIB
-/ChangeLog-1.8.0
+/ChangeLog-*
/ChangeLog.pre-alpha
/ChangeLog.pre1_1
/Doxyfile
/GNUmakefile
+/GNUmakefile.old
/README.atheos
/README.fat-patch
/README.v6
@@ -44,6 +47,7 @@ y.tab.c
/autom4te*.cache
/automake
/beos
+/bmlog-*
/breakpoints.gdb
/config.cache
/config.h
@@ -51,6 +55,11 @@ y.tab.c
/config.status
/config.status.lineno
/configure
+/coverage/simplecov
+/coverage/.last_run.json
+/coverage/.resultset.json*
+/coverage/assets
+/coverage/index.html
/doc/capi
/enc.mk
/encdb.h
@@ -82,6 +91,7 @@ y.tab.c
/rubicon
/ruby
/ruby-man.rd.gz
+/sizes.c
/test.rb
/tmp
/transdb.h
@@ -92,6 +102,8 @@ y.tab.c
# /benchmark/
/benchmark/bmx_*.rb
+/benchmark/fasta.output.*
+/benchmark/wc.input
# /enc/trans/
/enc/trans/*.c
@@ -103,6 +115,12 @@ y.tab.c
/ext/dl/callback/callback-*.c
/ext/dl/callback/callback.c
+# /ext/etc/
+/ext/etc/constdefs.h
+
+# /ext/rbconfig/
+/ext/rbconfig/sizeof/sizes.c
+
# /ext/ripper/
/ext/ripper/eventids1.c
/ext/ripper/eventids2table.c
@@ -118,10 +136,17 @@ y.tab.c
# /ext/tk/
/ext/tk/config_list
+# /gems
+/gems/*.gem
+
# /spec/
/spec/mspec
/spec/rubyspec
+# /tool/
+/tool/config.guess
+/tool/config.sub
+
# /win32/
/win32/*.ico
/win32/.time
diff --git a/.travis.yml b/.travis.yml
index db25c9eb08..d39c72b0f9 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -38,17 +38,31 @@ install: "sudo apt-get -qq build-dep ruby1.9.1 2>/dev/null"
# 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"
+ - "make -f common.mk BASERUBY=ruby srcdir=. update-config_files"
- "autoconf"
- - "./configure --with-gcc=$CC"
+ - "mkdir config_1st config_2nd"
+ - "./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 -sj encs"
- "make -sj exts"
-script: "make test OPTS=-v"
+script:
+ - "make test OPTS=-v"
+ - "make test-all TESTS='-qv -j2'"
# Branch matrix. Not all branches are Travis-ready so we limit branches here.
branches:
only:
- trunk
- ruby_1_9_3
+ - ruby_2_0_0
+ - ruby_2_1
+ - ruby_2_2
# We want to be notified when something happens.
notifications:
@@ -61,6 +75,13 @@ notifications:
template:
- "%{message} by @%{author}: See %{build_url}"
+ # Update ruby-head installed on Travis CI so other projects can test against it.
+ webhooks:
+ urls:
+ - "https://rubies.travis-ci.org/rebuild/ruby-head"
+ on_success: always
+ on_failure: never
+
# Local Variables:
# mode: YAML
# coding: utf-8-unix
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000000..ffdf2dd4b8
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,4 @@
+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 7a4ab22bfa..dc0c1aed39 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,26553 +1,8197 @@
-Fri Nov 22 12:46:08 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Sep 17 23:12:36 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * util.c (ruby_strtod): ignore too long fraction part, which does not
- affect the result.
+ * 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 Nov 20 15:20:00 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+Wed Sep 17 16:22:58 2014 Eric Wong <e@80x24.org>
- * test/ruby/test_thread.rb (test_mutex_unlock_on_trap): extend waiting
- time to invocation of signal handler from 0.01 sec to 0.2 sec.
- RubyCI report error on mswin. reported by @unak
+ * ext/zlib/zlib.c (zlib_mem_alloc): check overflow
-Wed Nov 13 11:57:01 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+Wed Sep 17 11:33:35 2014 Laurent Arnoud <laurent@spkdev.net>
- * lib/rubygems: Update to RubyGems 2.0.14. [ruby-core:58300]
- [Backport #9104]
- the patch is provided by drbrain (Eric Hodel).
-
-Tue Nov 12 23:41:43 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]
-
-Tue Nov 12 23:41:43 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * load.c (ruby_init_ext): share feature names between frame name and
- provided features.
-
-Tue Nov 12 23:33:08 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].
-
-Tue Nov 12 23:24:35 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]
-
-Tue Nov 12 23:24:35 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- (partially merged from r42862)
- * common.mk: use RUNRUBY instead of MINIRUBY because MINIRUBY can't
- require extension libraries. The patch is from nobu
- (Nobuyoshi Nakada).
-
-Mon Nov 11 23:54:51 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.
-
-Mon Nov 11 22:14:37 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]
-
-Mon Nov 11 22:14:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/Makefile.sub (config.h): VC 2013 supports C99 mathematics
- functions. [ruby-core:57981] [Bug #9044]
-
-Thu Oct 31 22:28:04 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]
-
-Thu Oct 31 22:28:04 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!
-
-Sun Oct 27 01:04:28 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
- * lib/rubygems: Update to RubyGems 2.0.13. [ruby-core:58031]
- [Backport #9052]
- the patch is provided by drbrain (Eric Hodel).
-
-Sat Oct 26 16:04:36 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
- * gc.c (gc_prof_set_heap_info): fix compile error when
- GC_PROFILE_MORE_DETAIL != 0.
- the patch is provided by ko1 (Koichi Sasada).
-
-Thu Oct 24 23:27:12 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
- * lib/rubygems: Update to RubyGems 2.0.12. [ruby-core:57818]
- [Backport #9014]
- the patch is provided by drbrain (Eric Hodel).
-
-Thu Oct 24 22:49:28 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * parse.y: Remove +(binary) and -(binary) special cases
- [Feature #9048]
-
-Thu Oct 24 22:36:56 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]
-
-Fri Oct 18 02:10: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.
-
-Fri Oct 18 02:05:45 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 10 01:14:37 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
- combinnation of paired and outer variants.
-
-Thu Oct 10 01:07:37 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]
-
-Thu Oct 10 00:58:39 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 Oct 10 00:58:39 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 Oct 10 00:58:39 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * array.c (rb_ary_count): iterate items appropriately.
- [Bug #8654]
-
-Thu Oct 10 00:44:28 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]
-
-Thu Oct 10 00:24:01 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]
-
-Mon Oct 7 21:03:54 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in, win32/Makefile.sub (FIBER_USE_NATIVE): move conditions
- from cont.c
-
-Thu Oct 10 00:17:56 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.
-
-Thu Oct 10 00:00:30 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.
-
-Thu Oct 10 00:00:30 2013 Tanaka Akira <akr@fsij.org>
-
- * lib/time.rb (Time.strptime): Use :offset.
- Patch by Felipe Contreras. [ruby-core:57694]
-
-Wed Oct 9 23:32:37 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].
-
-Sat Oct 5 02:14:56 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (rb_io_close_read): duplex IO should wait its child process
- even after close_read.
-
-Sat Oct 5 02:14:56 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * 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.
-
-Sat Oct 5 01:59:50 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.
-
-Sat Oct 5 00:16:33 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)
-
-Sat Oct 5 00:16:33 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * process.c (fork_daemon): kill the other threads all and abandon the
- kept mutexes.
-
-Sat Oct 5 00:16:33 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * process.c (fork_daemon): kill the other threads all and abandon the
- kept mutexes.
-
-Tue Oct 1 00:28:40 2013 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-
- * tool/make-snapshot: Fix order of priority for option parameter.
-
-Sat Sep 28 21:40:40 2013 Kenichi Kamiya <kachick1@gmail.com>
-
- * random.c (rb_random_ulong_limited): coerce before check negative.
- [Fixes GH-379]
-
-Fri Sep 27 01:24:20 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
- * lib/rubygems: Update to Rubygems 2.0.10. [ruby-core:57360]
- [Backport #8950]
- the patch is provided by drbrain (Eric Hodel).
- this update contains a security fix for CVE-2013-4363.
-
-Fri Sep 27 01:11:21 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (lambda): adjust position to the beginning of the block.
-
-Fri Sep 27 01:02:59 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 27 00:58:57 2013 Zachary Scott <e@zzak.io>
-
- * lib/gserver.rb: [DOC] correct gserver.rb license [Bug #8913]
-
-Sun Sep 15 23:15:32 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
- * lib/rubygems: Update to Rubygems 2.0.9. [ruby-core:57183]
- [Backport #8908]
- the patch is provided by drbrain (Eric Hodel).
-
-Sun Sep 15 22:59:04 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 15 22:55:44 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
-
-Sun Sep 15 22:03:01 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.
-
-Sat Sep 14 00:01:20 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
- * lib/rubygems: Update to RubyGems 2.0.8. [ruby-core:57155]
- [Backport #8900]
- the patch is provided by drbrain (Eric Hodel).
- this update contains a security fix for CVE-2013-4287.
-
-Fri Sep 13 23:20:29 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.
-
-Fri Sep 13 23:16:12 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
-
-Fri Sep 13 22:40:28 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.
-
-Fri Sep 13 01:44:54 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]
-
-Fri Sep 13 01:09:59 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.
-
-Fri Sep 13 00:57:54 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]
-
-Fri Sep 13 00:33:09 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
-
-Fri Sep 13 00:18:55 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 Sep 12 01:44:01 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]
-
-Thu Sep 12 01:34:07 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
-
-Thu Sep 12 01:18:44 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]
-
-Thu Sep 12 01:02:56 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.
-
-Thu Sep 12 01:02:56 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * time.c (time_mload): ignore auxiliary data, offset and zone, if
- invalid. [ruby-core:56648] [Bug #8795]
-
-Thu Sep 12 00:22:22 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.
-
-Thu Aug 29 21:51:33 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 21:28:56 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]
-
-Fri Aug 23 01:16:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/date/date_parse.c (rfc2822_cb): check if wday is given, since it
- can be omitted.
-
-Fri Aug 23 00:55:02 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]
-
-Sat Aug 17 00:42:12 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * parse.y: fix build error with bison-3.0.
-
-Sat Aug 17 00:39:20 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]
-
-Sat Aug 17 00:36:24 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]
-
-Sat Aug 17 00:32:17 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
- * lib/rubygems: update to RubyGems 2.0.7. the patch by drbrain.
- [ruby-core:56633] [Backport #8787]
-
-Sat Aug 10 23:59:47 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.
-
-Sun Aug 4 22:42:16 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)
-
-Sat Aug 3 23:02:09 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/extmk.rb (extmake): Invoke Logging::log_close in a ensure
- clause.
-
-Sat Aug 3 23:02:09 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]
-
-Sat Aug 3 22:46:19 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.
-
-Sat Aug 3 22:40:57 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (have_framework): allow header file to check.
- [ruby-core:55745] [Bug #8593]
-
-Sat Aug 3 22:24:44 2013 Shota Fukumori <her@sorah.jp>
-
- * lib/uri/common.rb (URI.decode_www_form_component):
- Don't raise error when str includes multibyte characters.
-
-Sun Jul 28 22:00:10 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]
-
-Sun Jul 28 21:50:34 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 21:50:34 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 21:44:57 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.
-
-Fri Jul 26 00:38:58 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
- * lib/rubygems: Update to RubyGems 2.0.6. [ruby-core:56160]
- [Backport #8682]
-
-Wed Jul 24 22:35:32 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 01:13:02 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
- * include/ruby/intern.h (rb_f_lambde): restore the declaration of
- rb_f_lambda() for backword compatibility. and mark it as deprecated.
-
-Tue Jul 23 01:36:43 2013 Zachary Scott <e@zzak.io>
-
- * lib/rubygems/psych_additions.rb: Ignore Psych docs here
-
-Tue Jul 23 01:34:00 2013 Koichi Sasada <ko1@atdot.net>
-
- * test/test_tracer.rb: catch up recent rubygems changes.
-
-Tue Jul 23 01:28:54 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
- * lib/rubygems: Update to RubyGems 2.0.5.
- The patch provided by drbrain (Eric Hodel). [ruby-core:55896]
- [Backport #8617]
-
- * test/rubygems: Tests for the above.
-
-Tue Jul 23 00:00:27 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].
-
-Sat Jul 20 23:49:33 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]
-
-Sat Jul 20 23:31:11 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]
-
-Sun Jul 14 00:18:08 2013 Zachary Scott <e@zzak.io>
-
- * sprintf.c: Fix typo patch by @hynkle [Fixes GH-357]
- https://github.com/ruby/ruby/pull/357
-
-Sun Jul 14 00:17:07 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * man/ri.1: Incorrect use of .Dd macro [Bug #8620] by Tristan Hill
-
-Sun Jul 14 00:15:26 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/logger.rb: Use :call-seq: for method signature rdoc
-
-Sun Jul 14 00:13:01 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.
-
-Sat Jul 13 23:50:00 2013 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_core.c: fixed coding error [ruby-core:55337].
- reported by Riley Lynch.
-
-Sat Jul 13 23:50:00 2013 Tadayoshi Funaba <tadf@dotrb.org>
+ * test/fiddle/test_import.rb (Fiddle::TestImport#test_sizeof):
+ added test for long long [fix GH-716]
- * ext/date/date_core.c: fixed a bug [ruby-core:55295]. reported
- by Riley Lynch.
+Wed Sep 17 11:09:21 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Sat Jul 13 23:41:25 2013 Tadayoshi Funaba <tadf@dotrb.org>
+ * tool/rbinstall.rb: fixed invalid options with latest rubygems.
+ https://github.com/rubygems/rubygems/issues/1013
- * ext/date/date_parse.c (date_zone_to_diff): [ruby-core:55831].
+Tue Sep 16 19:19:00 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Jul 13 23:34:13 2013 Akinori MUSHA <knu@iDaemons.org>
+ * benchmark/bm_app_aobench.rb: update outdated links to the
+ original program. [ruby-dev:48550] [Feature #10247]
- * object.c: Fix rdoc for Kernel#<=>. [Fix GH-352]
+Tue Sep 16 01:06:40 2014 NARUSE, Yui <naruse@ruby-lang.org>
-Sat Jul 13 23:29:51 2013 Akinori MUSHA <knu@iDaemons.org>
+ * reg*.c: Merge Onigmo 5.15.0 38a870960aa7370051a3544
- * lib/fileutils.rb (FileUtils#mode_to_s): Define mode_to_s() also
- as singleton method, or FileUtils.chmod fails in verbose mode.
+Mon Sep 15 16:21:10 2014 Eric Wong <e@80x24.org>
-Sat Jul 13 23:27:12 2013 Akinori MUSHA <knu@iDaemons.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
- * lib/fileutils.rb (FileUtils#chown, FileUtils#chown_R): If user
- and group are both nil, print ":".
+Mon Sep 15 10:29:25 2014 Natalie Weizenbaum <nweiz@google.com>
-Sat Jul 13 23:16:49 2013 Tanaka Akira <akr@fsij.org>
+ * 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]
- * bignum.c (bigrsh_bang): Fix bignum digits overrun.
+Mon Sep 15 09:43:18 2014 Sho Hashimoto <sho.hsmt@gmail.com>
-Sat Jul 13 23:16:49 2013 Tanaka Akira <akr@fsij.org>
+ * ext/fiddle/lib/fiddle/import.rb (Fiddle::Importer#sizeof): fix typo,
+ SIZEOF_LONG_LON. [Fix GH-714]
- * bignum.c (biglsh_bang): Fix bignum digits under-run.
+Mon Sep 15 08:13:40 2014 Matthew Draper <matthew@trebex.net>
-Sat Jul 13 22:45:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * sprintf.c (rb_str_format): rational 'f' format works for more
+ values. [fix GH-717]
- * 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]. [Fix GH-351], [Bug #8606].
+Sun Sep 14 16:57:27 2014 Eric Wong <e@80x24.org>
-Sat Jul 13 22:41:20 2013 Martin Bosslet <Martin.Bosslet@gmail.com>
+ * template/vm.inc.tmpl: "insns.c" => "insns.def"
+ * tool/instruction.rb: typo fix
- * test/openssl/test_x509crl.rb: Remove unused variable.
- [ruby-core:53501] [Bug #8114]
+Sun Sep 14 12:29:52 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- Thanks, Vipul Amler, for pointing this out!
+ * test/test_tracer.rb: fixed testcase for rubygems update.
-Sun Jul 7 02:00:41 2013 Martin Bosslet <Martin.Bosslet@gmail.com>
+Sun Sep 14 12:29:02 2014 SHIBATA Hiroshi <shibata.hiroshi@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:
+ * lib/rubygems: Update to RubyGems 2.4.1 master(713ab65)
+ Complete history at:
+ https://github.com/rubygems/rubygems/blob/master/History.txt#L3-L216
- [id, criticality, octet_string] if critical,
- [id, octet_string] if not.
+ * test/rubygems: ditto.
- Making sure to pick the last element of X509 extension and use it as
- SAN value.
- [ruby-core:55685] [Bug #8575]
+Sun Sep 14 11:03:24 2014 Aaron Patterson <aaron@tenderlovemaking.com>
- Thank you @nahi for providing the patch!
+ * ext/psych/lib/psych.rb: update version
+ * ext/psych/psych.gemspec: ditto
-Sun Jul 7 01:58:25 2013 Akinori MUSHA <knu@iDaemons.org>
+Sun Sep 14 08:43:37 2014 Eric Wong <e@80x24.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.
+ * ccan/container_of/container_of.h (container_of_or_null): added
+ [ccan 7ec5b8e06b2fd5fa98b1fcde1158c286d2d429d8] (David Gibson)
-Sun Jul 7 01:54:44 2013 Akinori MUSHA <knu@iDaemons.org>
+Sun Sep 14 08:41:44 2014 Eric Wong <e@80x24.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".
+ * ccan/list/list.h (list_del_init, list_node_init): new functions
+ for multiple list_del() calls
+ [ccan ec8654d94d3c5c47aa5f82698f7e8048c79765b1] (Rusty Russell)
-Fri Jul 5 00:55:05 2013 NARUSE, Yui <naruse@ruby-lang.org>
+Sat Sep 13 22:19:26 2014 Bernard Potocki <bernard.potocki@imanel.org>
- * regcomp.c (): Merge Onigmo 5.13.5 23b523076d6f1161.
+ * 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]
- * [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.
+Sat Sep 13 15:16:31 2014 Eric Wong <e@80x24.org>
-Wed Jul 3 23:31:26 2013 Shota Fukumori <sorah@cookpad.com>
+ * class.c: use ALLOC(rb_subclass_entry_t)
- * lib/mkmf.rb (try_config): Fix to not replace $LDFLAGS with $libs
- (1.9.3 behavior) [ruby-core:55752] [Bug #8595]
+Sat Sep 13 14:14:00 2014 Eric Wong <e@80x24.org>
-Tue Jul 2 03:06:38 2013 Kenta Murata <mrkn@mrkn.jp>
+ * process.c (free_exec_arg): remove
+ (memsize_exec_arg): ptr is never NULL
+ (exec_arg_data_type): use RUBY_TYPED_DEFAULT_FREE
- * 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]
- [Fix GH-332] https://github.com/ruby/ruby/pull/332
+ * variable.c (autoload_i_free): remove
+ (autoload_data_i_type): use RUBY_TYPED_DEFAULT_FREE
+ (autoload_memsize): ptr is never NULL
-Fri Jun 28 02:20:13 2013 Aman Gupta <ruby@tmm1.net>
+ * 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
- * compile.c (iseq_add_mark_object): Use new rb_iseq_add_mark_object().
+Sat Sep 13 13:43:07 2014 Eric Wong <e@80x24.org>
- * insns.def (setinlinecache): Ditto.
+ * doc/NEWS-2.0.0: fix typo for default RUBY_FIBER_MACHINE_STACK_SIZE
+ [ci skip]
- * iseq.c (rb_iseq_add_mark_object): New function to allocate
- iseq->mark_ary on demand. [Bug #8142]
+Sat Sep 13 11:16:58 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * iseq.h (rb_iseq_add_mark_object): Ditto.
+ * 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.
- * iseq.c (prepare_iseq_build): Avoid allocating mark_ary until needed.
+Sat Sep 13 09:47:44 2014 Eric Wong <e@80x24.org>
- * iseq.c (rb_iseq_build_for_ruby2cext): Ditto.
+ * man/ruby.1: use https for *.ruby-lang.org links
-Thu Jun 27 20:10:56 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+Sat Sep 13 06:31:23 2014 Eric Wong <e@80x24.org>
- * ext/openssl/lib/openssl/ssl.rb (verify_certificate_identity): fix
- hostname verification. Patched by nahi.
+ * vm.c (thread_alloc): remove needless volatile
- * test/openssl/test_ssl.rb (test_verify_certificate_identity): test for
- above.
+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
-Thu Jun 27 13:16:40 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+ * vm.c (env_free): remove, use RUBY_TYPED_DEFAULT_FREE
+ (env_mark, env_memsize): remove needless branching
- * 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]
+Sat Sep 13 05:52:15 2014 Eric Wong <e@80x24.org>
-Wed Jun 26 23:05:34 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+ * 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]
- * test/ruby/test_io.rb (TestIO#test_write_32bit_boundary): skip if
- writing a file is slow.
- [ruby-core:55541] [Bug #8519]
+ * vm.c (rb_proc_alloc): new inline function
+ (rb_vm_make_proc): call rb_proc_alloc
-Wed Jun 26 22:42:36 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm_core.h: remove rb_proc_alloc, add rb_proc_wrap
- * 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.
+ * benchmark/bm_vm2_newlambda.rb: short test to show difference
-Wed Jun 26 02:25:52 2013 Akinori MUSHA <knu@iDaemons.org>
+Sat Sep 13 04:40:04 2014 Eric Wong <e@80x24.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]
+ * 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]
-Tue Jun 25 00:12:19 2013 Zachary Scott <zachary@zacharyscott.net>
+ * test/ruby/test_process.rb (test_process_detach): new test
- * array.c: Return value in Array overview example found by @PragTob
- [Fix GH-336] https://github.com/ruby/ruby/pull/336
+ * inits.c (rb_call_inits): call Init_Thread before Init_process to
+ ensure Process::Waiter may be a subclass of Thread
-Tue Jun 25 00:11:46 2013 Zachary Scott <zachary@zacharyscott.net>
+Fri Sep 12 18:14:28 2014 Eric Wong <e@80x24.org>
- * array.c (rb_ary_zip): typo by @PragTob [Fix GH-337]
- https://github.com/ruby/ruby/pull/337
+ * vm.c (env_alloc): inline to avoid extra zeroing
+ tiny speedup [ruby-core:64980]
-Tue Jun 25 00:10:54 2013 Zachary Scott <zachary@zacharyscott.net>
+Fri Sep 12 17:13:29 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * win32/README.win32: grammar typo by @blankenshipz [Fix GH-334]
- https://github.com/ruby/ruby/pull/334
+ * vm_method.c (rb_method_entry_make, remove_method): ditto.
-Sun Jun 23 00:03:18 2013 Charlie Somerville <charliesome@ruby-lang.org>
+Fri Sep 12 14:39:55 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * ext/etc/etc.c (etc_getpwnam): use PRIsVALUE in format string instead
- of %s and RSTRING_PTR
+ * gems/bundled_gems: Upgraded to test-unit-3.0.1 and minitest-5.4.1
- * ext/etc/etc.c (etc_getgrnam): ditto
+Fri Sep 12 06:55:40 2014 Eric Wong <e@80x24.org>
-Sat Jun 22 00:54:41 2013 Eric Hodel <drbrain@segment7.net>
+ * string.c (Init_frozen_strings): use st_init_table_with_size
- * lib/rubygems: Update to RubyGems 2.0.3
+Fri Sep 12 06:15:37 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * test/rubygems: Tests for the above.
+ * 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
- * NEWS: Added RubyGems 2.0.3 note.
+ * ext/-test-/symbol/init.c (sym_find): moved from string.c for tests.
-Wed Jun 19 04:20:31 2013 Charlie Somerville <charliesome@ruby-lang.org>
+Fri Sep 12 04:24:03 2014 Eric Wong <e@80x24.org>
- * vm_insnhelper.c (vm_call_method): ensure methods of type
- VM_METHOD_TYPE_ATTR_SET are called with 1 argument
+ * insns.def (once): define and use fake RUNNING_THREAD_ONCE_DONE
+ pointer to indicate is->once.running_thread is done.
- * test/ruby/test_module.rb (class TestModule): add test
+ * 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]
- [ruby-core:55543] [Bug #8540]
+Thu Sep 11 20:10:00 2014 Koichi Sasada <ko1@atdot.net>
-Wed Jun 19 03:54:04 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm.c (rb_thread_mark): use rb_gc_mark_values() to mark VM stack.
- * defs/id.def (predefined): add "idProc".
+Thu Sep 11 19:50:57 2014 Koichi Sasada <ko1@atdot.net>
- * proc.c (mnew, mproc, mlambda): use predefined IDs.
+ * vm.c (rb_vm_register_special_exception): make new function to
+ make and register special exceptions.
- * vm.c (Init_VM): ditto.
+ * vm.c (rb_vm_mark): do not need to mark special exceptions
+ because they are registered by rb_gc_register_mark_object().
-Wed Jun 19 03:54:04 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * eval.c (Init_eval): use rb_vm_register_special_exception().
- * include/ruby/intern.h (rb_block_lambda): add declaration instead of
- deprecated rb_f_lambda.
+ * gc.c (Init_GC): ditto.
-Wed Jun 19 03:24:07 2013 Kazuki Tsujimoto <kazuki@callcc.net>
+ * proc.c (Init_Proc): ditto.
- * include/ruby/ruby.h, vm_eval.c (rb_funcall_with_block):
- new function to invoke a method with a block passed
- as an argument.
+ * thread.c (Init_Thread): ditto.
- * string.c (sym_call): use the above function to avoid
- a block sharing. [ruby-dev:47438] [Bug #8531]
+Thu Sep 11 19:32:30 2014 Koichi Sasada <ko1@atdot.net>
- * vm_insnhelper.c (vm_yield_with_cfunc): don't set block
- in the frame.
+ * gc.c (rb_gc_mark_values): added.
+ This function is similar to rb_gc_mark_locations(), but not
+ conservative.
- * test/ruby/test_symbol.rb (TestSymbol#test_block_given_to_proc):
- run related tests.
+ * internal.h: ditto.
-Wed Jun 19 03:06:57 2013 Kazuki Tsujimoto <kazuki@callcc.net>
+ * 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().
- * test/ruby/test_proc.rb (TestProc#test_block_given_method_to_proc):
- run test for r41359.
+Thu Sep 11 18:40:16 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Wed Jun 19 03:06:57 2013 Kazuki Tsujimoto <kazuki@callcc.net>
+ * .gitignore: ignored temporary files and coverage results.
- * 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.
+Thu Sep 11 18:15:30 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * proc.c (bmcall): use the above function to avoid a block sharing.
- [ruby-core:54626] [Bug #8341]
+ * .gitignore: ignored only simplecov.
+ * coverage/README: Added coverage docs.
- * test/ruby/test_proc.rb (TestProc#test_block_persist_between_calls):
- run related tests.
+Thu Sep 11 17:25:31 2014 Koichi Sasada <ko1@atdot.net>
-Tue Jun 18 02:49:20 2013 NARUSE, Yui <naruse@ruby-lang.org>
+ * include/ruby/ruby.h, gc.c: add new internal events
+ RUBY_INTERNAL_EVENT_GC_ENTER and
+ RUBY_INTERNAL_EVENT_GC_EXIT.
- * test/ruby/envutil.rb (assert_separately): stop_auto_run of
- Test::Unit::Runner to prevent auto runner use ARGV.
+ When invoking GC process, GC_ENTER event is called.
+ When exiting from GC process, GC_EXIT event is called.
- * test/ruby/envutil.rb (assert_separately): add $: to separate process.
+ Incremental GC (incremental marking and lazy sweep) can call
+ these events many times.
- * test/ruby/envutil.rb (assert_separately): fail if stderr is not
- empty and ignore_stderr is false.
+ 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
-Tue Jun 18 02:21:54 2013 NARUSE, Yui <naruse@ruby-lang.org>
+ 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
- * test/ruby/envutil.rb (EnvUtil.with_default_external): add for
- changing Encoding.default_external without warnings.
+ These internal events enable to measure GC pause time completely.
- * test/ruby/envutil.rb (EnvUtil.with_default_internal): ditto.
+Thu Sep 11 17:04:54 2014 Eric Wong <e@80x24.org>
- * test/ruby/test_io_m17n.rb: use above with_default_external.
+ * lib/benchmark.rb: remove CLOCK_MONOTONIC_RAW support
+ Thanks to Vit Ondruch for reporting the issue on ARM.
+ [Bug #10202]
-Tue Jun 18 00:43:27 2013 Zachary Scott <zachary@zacharyscott.net>
+Thu Sep 11 14:31:57 2014 Koichi Sasada <ko1@atdot.net>
- * vm_backtrace.c: Update rdoc for Backtrace#label with @_ko1
+ * include/ruby/ruby.h: freeze nil/true/false.
+ [Feature #8923]
-Tue Jun 18 00:34:57 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+ * gc.c (should_be_finalizable): check frozen after checkin FL_ABLE.
-merge revision(s) 41347: [Backport #5048] [Backport #5465] [Backport #8319]
+ * object.c (rb_obj_taint): check
+ OBJ_TAINTABLE(obj).
- * ext/tk/extconf.rb: support s390x (Thanks to bkabrda) [Bug #5465]
+ * object.c (rb_obj_freeze): remove immediate_frozen_tbl
+ because all of immediate values are frozen. YAY!
- * ext/tk/extconf.rb: apply [Bug #5048]
+ * object.c (rb_obj_frozen_p): ditto.
- * ext/tk/lib/tk/canvas.rb,ext/tk/sample/demos-{en,jp}/{tree.rb,widget}:
- fix bug (Thanks to zzak) [ruby-trunk - Bug #8319]
+ * test/ruby/test_eval.rb: skip instance_variable_set for
+ frozen objects.
-Sun Jun 16 01:56:54 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/ruby/test_weakmap.rb: check ArgumentError instead of
+ RuntimeError.
- * array.c (FL_SET_EMBED): shared object is frozen even when get
- unshared.
+Thu Sep 11 10:03:16 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * array.c (rb_ary_modify): ARY_SET_CAPA needs unshared array.
+ * lib/rdoc.rb, lib/rdoc, test/rdoc: Update to RDoc 4.2.0.alpha(21b241a)
-Sun Jun 16 01:32:26 2013 TAKANO Mitsuhiro <tak@no32.tk>
+Wed Sep 10 17:52:25 2014 Koichi Sasada <ko1@atdot.net>
- * insns.def: fix condition.
+ * compile.c (rb_vm_addr2insn): rename to rb_vm_insn_addr2insn
+ to clear what address.
-Sun Jun 16 01:22:35 2013 Eric Hodel <drbrain@segment7.net>
+Wed Sep 10 16:22:26 2014 Koichi Sasada <ko1@atdot.net>
- * ext/socket/extconf.rb: Enable RFC 3542 IPV6 socket options for OS X
- 10.7+. [ruby-trunk - Bug #8517]
+ * test/ruby/test_gc.rb: fix condition.
-Sun Jun 16 01:11:10 2013 Koichi Sasada <ko1@atdot.net>
+Wed Sep 10 15:29:46 2014 Eric Wong <e@80x24.org>
- * 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?)
+ * 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]
- * test/ruby/test_settracefunc.rb: add a test.
+ * compile.c (new_callinfo, setup_args, iseq_compile_each,
+ iseq_build_from_ary_body): adjust for type changes
-Sun Jun 16 00:30:56 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm_insnhelper.c (vm_getivar): ditto
- * 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 Sep 10 15:07:35 2014 Eric Wong <e@80x24.org>
-Wed Jun 12 23:41:21 2013 NARUSE, Yui <naruse@ruby-lang.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_insnhelper.c (vm_yield_setup_block_args): partially revert r41019.
- The code is not useless.
+ * vm_core (rb_iseq_t): move original ->iseq to bottom
-Wed Jun 12 23:41:21 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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_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]
+ * vm_dump.c (rb_vmdebug_debug_print_pre): use original iseq
-Wed Jun 12 23:05:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Sep 10 15:00:11 2014 Eric Wong <e@80x24.org>
- * io.c (io_getc): fix 7bit coderange condition, check if ascii read
- data instead of read length. [ruby-core:55444] [Bug #8516]
+ * time.c (time_mark): remove NULL check
+ (time_memsize): ditto
+ (time_free): remove, use RUBY_TYPED_DEFAULT_FREE instead
+ [Feature #10219]
-Sun Jun 9 02:27:07 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Sep 10 14:14:57 2014 NAKAMURA Usaku <usa@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]
+ * 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]
-Sun Jun 9 02:17:16 2013 Charlie Somerville <charliesome@ruby-lang.org>
+Wed Sep 10 11:59:10 2014 Koichi Sasada <ko1@atdot.net>
- * class.c (include_modules_at): invalidate method cache if included
- module contains constants
+ * gc.c (gc_stat): update rdoc.
- * test/ruby/test_module.rb: add test
+Wed Sep 10 11:52:08 2014 Koichi Sasada <ko1@atdot.net>
-Sun Jun 9 01:59:39 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+ * 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]
-merge revision 40783 (partially): [Backport #8413]
+Wed Sep 10 11:45:40 2014 Koichi Sasada <ko1@atdot.net>
- * win32/Makefile.sub: fix a typo in config.h.
+ * gc.c (gc_stat_internal): rename `heap_used' to `heap_allocated_pages'.
+ ref: [Feature #9924]
-Sun Jun 9 01:38:55 2013 Charlie Somerville <charliesome@ruby-lang.org>
+ * test/ruby/test_gc.rb: add constraints test for gc stat information.
- * intern.h: remove dangling rb_class_init_copy declaration
- [ruby-core:55120] [Bug #8434]
+Wed Sep 10 11:31:16 2014 Koichi Sasada <ko1@atdot.net>
-Sun Jun 9 01:30:57 2013 Shugo Maeda <shugo@ruby-lang.org>
+ * 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]
- * lib/net/imap.rb (capability_response): should ignore trailing
- spaces. Thanks, Peter Kovacs. [ruby-core:55024] [Bug #8415]
+Wed Sep 10 11:12:25 2014 Koichi Sasada <ko1@atdot.net>
- * test/net/imap/test_imap_response_parser.rb: related test.
+ * gc.c (gc_stat_internal): support:
+ * total_allocated_pages
+ * total_freed_pages
+ ref: [Feature #9924]
-Wed Jun 5 00:38:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Sep 10 10:48:04 2014 Koichi Sasada <ko1@atdot.net>
- * ext/zlib/zlib.c (gzfile_read, gzfile_read_all, gzfile_getc),
- (gzreader_gets): check EOF. [ruby-core:55220] [Bug #8467]
+ * test/ruby/test_gc.rb: catch up last fix.
-Wed Jun 5 00:32:18 2013 Tanaka Akira <akr@fsij.org>
+Wed Sep 10 10:36:08 2014 Koichi Sasada <ko1@atdot.net>
- * test/ruby/test_require.rb: Remove temporally files in the tests.
+ * gc.c (objspace_total_slot): rename objspace_available_slots.
- * test/ruby/test_rubyoptions.rb: Ditto.
+ * gc.c (objspace_live_slot, objspace_free_slot): rename
+ ..._slot() to ..._slots().
- * test/logger/test_logger.rb: Ditto.
+ * gc.c (objspace_free_slot): should subtract heap_pages_final_slots.
- * test/psych/test_psych.rb: Ditto.
+ * 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]
- * test/readline/test_readline.rb: Ditto.
+Wed Sep 10 07:22:53 2014 Koichi Sasada <ko1@atdot.net>
- * test/syslog/test_syslog_logger.rb: Ditto.
+ * gc.c: refactoring for RGENGC_PROFILE > 0.
- * test/webrick/test_httpauth.rb: Ditto.
+ * rename rb_objspace_t::profile::..._count
+ to rb_objspace_t::profile::total_..._count
+ * rename promote_infant_types to promote_types
- * test/zlib/test_zlib.rb: Ditto.
+ * gc.c (gc_remember_unprotected): count remembered shady objects here.
-Wed Jun 5 00:08:55 2013 Yusuke Endoh <mame@tsg.ne.jp>
+Wed Sep 10 03:12:12 2014 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
- * 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.
+ * gc.c (init_mark_stack): MEMZERO() receive type as 2nd argument instead
+ of size.
Coverity Scan found this bug.
-Wed Jun 5 00:04:12 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_str_quote_unprintable): check if argument is a string.
-
-Tue Jun 4 23:42:18 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 '/'.
-
-Tue Jun 4 23:32:12 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
-
-Tue Jun 4 23:27:24 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.
-
-Tue Jun 4 00:46:05 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (setup_overlapped, finish_overlapped): extract from
- rb_w32_read() and rb_w32_write().
-
-Tue Jun 4 00:02:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_core.h (rb_vm_tag): move jmpbuf between tag and prev so ensure to
- be accessible.
-
-Tue Jun 4 00:02:45 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.
-
-Mon Jun 3 23:22:58 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].
-
-Sun Jun 2 22:39:24 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * range.c: Fix rdoc on Range#bsearch [Bug #8242] [ruby-core:54143]
-
-Mon May 20 04:00:48 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/yaml.rb: YAML documentation from #8344 [Bug #8355]
-
-Wed May 15 23:22:09 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
- * include/ruby/intern.h: should include sys/time.h for struct timeval
- if it exists. [ruby-list:49363]
-
-Tue May 14 20:21:41 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.
-
-Tue May 14 20:11:00 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.
-
-
-Sun May 12 22:42:25 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * signal.c (rb_f_kill): fixes typo. s/HAS_KILLPG/HAVE_KILLPG/.
-
-Sun May 12 04:23:06 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]
-
-Sun May 12 04:23:06 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].
-
-Sun May 12 02:50:30 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.
-
-Sun May 12 02:50:30 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]
-
-Thu May 9 23:39:47 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * class.c (rb_mod_included_modules): should not include non-modules.
- [ruby-core:53158] [Bug #8025]
-
-Thu May 9 23:39:47 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 23:07:19 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.
-
-Wed May 8 23:07:19 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]
-
-Wed May 8 01:18:41 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 May 7 20:13:12 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
- * test/ruby/test_thread.rb (invoke_rec): extend timeout 10 -> 50 sec,
- to investigate test failure on rubyci.
- http://a.mrkn.jp/~mrkn/chkbuild/mountain_lion/ruby-2.0.0-m64-o0/log/20130507T052909Z.log.html.gz
-
-Sat May 4 23:48:56 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * doc/security.rdoc: Add note about reporting security vulns
-
-Sat May 4 23:44:54 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 23:39:45 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).
-
-Thu May 2 00:30:00 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.
-
-Thu May 2 00:19:46 2013 Tanaka Akira <akr@fsij.org>
-
- * dir.c (dir_set_pos): Fix a compilation error when seekdir() is not
- exist.
-
-Thu May 2 00:16:36 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * README.EXT: correct method name to be used. [Bug #7982]
-
- * README.EXT.ja: add notes too.
-
-Thu May 2 00:16:36 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * README.EXT: Copy note from r40505 for rb_sprintf() [Bug #7982]
-
-Thu May 2 00:16:36 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * README.EXT: Update note from r40504, by Jeremy Evans [Bug #7982]
-
-Thu May 2 00:16:36 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * README.EXT: Add note to warn use of %i in Exceptions [Bug #7982]
-
-Wed May 1 23:35:18 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]
-
-Sat Apr 27 02:12:14 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * io.c (rb_fd_fix_cloexec): use rb_update_max_fd().
-
-Sat Apr 27 02:12:14 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.
+Tue Sep 9 21:55:39 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-Sat Apr 27 01:57:43 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+ * ext/win32ole/sample/excel2.rb: remove some commented-out code.
+ rotate graph more slowly to see graph clearly.
- * configure.in: use quadrigraphs. workaround for autoconf 2.64.
- a patch provided by Hessob Park. [ruby-core:53157] [Backport #8020]
+Tue Sep 9 19:52:33 2014 Koichi Sasada <ko1@atdot.net>
-Sat Apr 27 00:39:28 2013 NARUSE, Yui <naruse@ruby-lang.org>
+ * gc.c: rename rb_objspace_t::marked_objects to marked_slots.
- * 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]
+ * gc.c (gc_marks_start): should be clear first.
-Sat Apr 27 00:39:28 2013 Akinori MUSHA <knu@iDaemons.org>
+ * gc.c (gc_marks_start): remembered shady objects are also marked.
- * test/ruby/test_module.rb
- (TestModule#test_const_get_invalid_name)
- (test_const_defined_invalid_name): Fix expected values.
+ * gc.c (gc_stat_internal): add heap_marked_slots.
-Sat Apr 27 00:39:28 2013 Akinori MUSHA <knu@iDaemons.org>
+Tue Sep 9 18:58:48 2014 Koichi Sasada <ko1@atdot.net>
- * string.c (rb_str_inspect): NUL should not be represented as "\0"
- when octal digits may follow. [ruby-core:54458] [Bug #8290]
+ * 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
-Fri Apr 26 23:48:58 2013 Tanaka Akira <akr@fsij.org>
+ * gc.c (gc_stat_internal):
+ * rename total_allocated_object -> total_allocated_objects
+ * rename total_freed_object -> total_freed_objects
- * thread_pthread.c (ruby_init_stack): Add STACK_GROW_DIR_DETECTION.
- This fixes a compilation failure while cross-compiling for ARM.
+Tue Sep 9 18:51:36 2014 Koichi Sasada <ko1@atdot.net>
-Fri Apr 26 23:32:09 2013 Kouhei Sutou <kou@cozmixng.org>
+ * gc.c (gc_stat_internal): fix symbol names
+ * heap_final_slot -> heap_final_slots
+ * heap_swept_slot -> heap_swept_slots
- * lib/rss/atom.rb (RSS::Atom::Entry): Fix indent of document comment.
+Tue Sep 9 18:18:07 2014 Koichi Sasada <ko1@atdot.net>
-Fri Apr 26 23:32:09 2013 Kouhei Sutou <kou@cozmixng.org>
+ * gc.c (rb_objspace_t::heap_pages): rename field names:
+ * used -> allocated_pages
+ * increment -> allocatable_pages
+ * length -> sorted_length
+ And remove unused `limit' field.
- * lib/rss/maker.rb (RSS::Maker): Fix indent of document comment.
+ * gc.c: rename macros:
+ * heap_pages_used -> heap_allocated_pages
+ * heap_pages_length -> heap_pages_sorted_length
+ * heap_pages_increment -> heap_allocatable_pages
-Fri Apr 26 23:32:09 2013 Zachary Scott <zachary@zacharyscott.net>
+ * 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
- * 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
+ ref: [Feature #9924]
+ https://docs.google.com/spreadsheets/d/11Ua4uBr6o0k-nORrZLEIIUkHJ9JRzRR0NyZfrhEEnc8/edit?usp=sharing
+ Yellow color fields in this table are changed.
-Thu Apr 25 00:40:41 2013 Zachary Scott <zachary@zacharyscott.net>
+ * test/ruby/test_gc.rb: catch up this change.
- * numeric.c: Fix wiki link on Float imprecision in overview, patched
- by Makoto Kishimoto [Bug #8304] [ruby-dev:47280]
+Tue Sep 9 14:56:03 2014 Koichi Sasada <ko1@atdot.net>
-Thu Apr 25 00:39:16 2013 Zachary Scott <zachary@zacharyscott.net>
+ * gc.c: continue layout changing.
- * string.c: Document String#setbyte return value by @gjmurakami-10gen
- [Fixes GH-294]
+ newobj_of() also touch:
+ (4) increment total_allocated_object_num
+ (5) check hook_events
-Thu Apr 25 00:38:06 2013 Zachary Scott <zachary@zacharyscott.net>
+ And gather fields related to marking phase.
- * ext/socket/lib/socket.rb: Doc typos by @vipulnsward [Fixes GH-292]
+Tue Sep 9 14:21:50 2014 Koichi Sasada <ko1@atdot.net>
-Tue Apr 23 23:06:43 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c: fix layout of rb_objspace_t to improve cache locality.
- * 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]
+ 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 Apr 23 22:33:16 2013 Shugo Maeda <shugo@ruby-lang.org>
+Tue Sep 9 14:09:36 2014 Koichi Sasada <ko1@atdot.net>
- * lib/net/imap.rb (getacl_response): parse the mailbox of an ACL
- response correctly. [ruby-core:54365] [Bug #8281]
+ * gc.c: move rb_objspace_t::flags::gc_stressful after during_gc
+ to make accessing both parameters easy.
-Sun Apr 21 00:14:36 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+ * gc.c (heap_get_freeobj): add LIKELY() hint.
- * test/ruby/test_require.rb (TestRequire#test_require_nonascii_path):
- RUBY_PLATFORM should escape as Regexp,
- because RUBY_PLATFORM may contain '.'.
+ * gc.c (heap_get_freeobj_from_next_freepage): ditto.
-Sun Apr 21 00:14:36 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+ * gc.c (newobj_of): check both parameters at once for exceptional
+ case.
- * test/ruby/test_require.rb (TestRequire#test_require_nonascii_path):
- fix load path for encoding to run the test as stand-alone.
+Tue Sep 9 13:51:32 2014 Koichi Sasada <ko1@atdot.net>
-Sun Apr 21 00:14:36 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+ * gc.c: add rb_objspace_t::flags::gc_stressful and
+ ruby_gc_stressful macro.
+ Rename objspace->gc_stress to objspace->gc_stress_mode.
- * 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]
+ If objspace->gc_stress_mode is true (!nil and !false) then
+ ruby_gc_stressful becomes TRUE.
- * test/ruby/test_require.rb (TestRequire#test_require_nonascii_path):
- a test for the above.
+ ruby_gc_stressful will speedup newobj_of() slightly.
-Sun Apr 21 00:13:24 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c: initialize ruby_gc_stress(full|_mode) by gc_params.gc_stress
+ even if ENABLE_VM_OBJSPACE is false.
- * 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]
+Tue Sep 9 13:05:50 2014 Koichi Sasada <ko1@atdot.net>
-Sun Apr 21 00:13:24 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c: remove ruby_disable_gc_stress and add ruby_disable_gc
+ to speed-up newobj_of().
- * 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].
+ * gc.c (ready_to_gc): check ruby_disable_gc.
-Sat Apr 20 23:32:06 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * signal.c: use ruby_disable_gc.
- * 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]
+Tue Sep 9 12:11:41 2014 Koichi Sasada <ko1@atdot.net>
-Sat Apr 20 02:37:33 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c: rename gc_stat entries and check stat transition.
- * ext/curses/curses.c (Init_curses): fix implementation function,
- crmode should be same as cbreak. [ruby-core:54013] [Bug #8222]
+Tue Sep 9 12:06:03 2014 Koichi Sasada <ko1@atdot.net>
-Sat Apr 20 02:09:46 2013 Martin Bosslet <Martin.Bosslet@gmail.com>
+ * gc.c (gc_sweep_rest): remove wrong modification of during_gc flag.
- * ext/openssl/ossl_ssl.c: Correct shutdown behavior w.r.t GC.
+Tue Sep 9 11:39:41 2014 Koichi Sasada <ko1@atdot.net>
- * test/openssl/test_ssl.rb: Add tests to verify correct behavior.
+ * gc.c: pack boolean values into rb_objspace_t::flags with bit fields
+ to improve cache locality.
- [Bug #8240] Patch provided by Shugo Maeda. Thanks!
+Tue Sep 9 11:11:05 2014 Koichi Sasada <ko1@atdot.net>
-Sat Apr 20 01:56:32 2013 Yuki Yugui Sonoda <yugui@google.com>
+ * test/ruby/test_object.rb: extend timeout.
- * thread_pthread.c (ruby_init_stack): Avoid using uninitialized value.
- stackaddr and size are not set if get_stack() fails.
+Tue Sep 9 09:02:07 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Apr 20 01:47:31 2013 Yuki Yugui Sonoda <yugui@google.com>
+ * lib/mkmf.rb (MakeMakefile#pkg_config): append --cflags to also
+ $CXXFLAGS, as they are often used by C++ compiler.
+ [ruby-core:54532] [Bug #8315]
- * thread_pthread.c: Fixes wrong scopes of #if USE_SLEEPY_TIMER_THREAD
- .. #endif sections. This fixes a build error on NativeClient.
+Tue Sep 9 07:03:22 2014 Eric Wong <e@80x24.org>
-Sat Apr 20 01:31:38 2013 NARUSE, Yui <naruse@ruby-lang.org>
+ * compile.c: remove needless SYM2ID <-> ID2SYM conversions
+ [misc #10207]
- * Merge Onigmo 5.13.4 f22cf2e566712cace60d17f84d63119d7c5764ee.
- [bug] fix problem with optimization of \z (Issue #16) [Bug #8210]
+Tue Sep 9 05:48:42 2014 Eric Wong <e@80x24.org>
-Sat Apr 20 01:18:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.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.
- * vm_insnhelper.c (vm_callee_setup_keyword_arg): non-symbol key is not
- a keyword argument, keep it as a positional argument.
+Tue Sep 9 04:36:24 2014 Eric Wong <e@80x24.org>
-Sat Apr 20 01:14:08 2013 Nobuyoshi Nakada <nobu@ruby-lang.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
- * thread.c (rb_mutex_synchronize_m): yield no block params. patch by
- splattael (Peter Suschlik) in [ruby-core:53773] [Bug #8097].
- fix GH-266.
+Mon Sep 8 16:08:22 2014 Koichi Sasada <ko1@atdot.net>
-Sat Apr 20 00:41:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * benchmark/bm_app_lc_fizzbuzz.rb: should skip output on benchmark.
- * compile.c (iseq_compile_each): append keyword hash to argument array
- to splat if needed. [ruby-core:54094] [Bug #8236]
+Mon Sep 8 16:04:02 2014 Koichi Sasada <ko1@atdot.net>
-Sat Apr 20 00:31:57 2013 Kouhei Sutou <kou@cozmixng.org>
+ * benchmark/bm_app_lc_fizzbuzz.rb: `answer.to_a' does not return
+ a string, but an array.
- * 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]
+Mon Sep 8 13:18:37 2014 Koichi Sasada <ko1@atdot.net>
-Tue Apr 16 01:30:47 2013 Kenta Murata <mrkn@mrkn.jp>
+ * benchmark/bm_app_lc_fizzbuzz.rb: added.
- * configure.in: set ac_cv_prog_cxx if CXX is supplied.
+ This program is described closely in "Understanding Computation"
+ chapter 6 by Tom Stuart. <http://computationbook.com/>
-Tue Apr 16 01:30:47 2013 Kenta Murata <mrkn@mrkn.jp>
+ Japanese translation will be published soon.
+ <http://www.oreilly.co.jp/books/9784873116976/>
- * configure.in: Fix c++ compiler auto-selection not only for
- Darwin 11.x, but also the other versions of Darwin.
+Mon Sep 8 12:01:39 2014 Koichi Sasada <ko1@atdot.net>
-Tue Apr 16 00:27:56 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c: add incremental GC algorithm. [Feature #10137]
- * compile.c (iseq_compile_each): fix of defined? with empty
- expression. [ruby-core:53999] [Bug #8220]
+ Please refer this ticket for details.
-Mon Apr 15 00:25:00 2013 Tanaka Akira <akr@fsij.org>
+ This change also introduces the following changes.
- * time.c (num_exact): use to_r method only if to_int method is
- available.
- [ruby-core:53764] [Bug #8173] reported by Hiro Asari.
+ * 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.
-Mon Apr 15 00:22:09 2013 Shota Fukumori <her@sorah.jp>
+ * include/ruby/ruby.h: add flag USE_RINCGC.
+ Now USE_RINCGC can be set only with USE_RGENGC.
- * ext/objspace/objspace.c: Fix typo in doc. Patch by Sho Hashimoto.
- [Bug #8116] [ruby-dev:47177]
+ * include/ruby/ruby.h: introduce FL_PROMOTED0 and add FL_PROMOTED1
+ to count object age.
-Mon Apr 15 00:15:04 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * include/ruby/ruby.h: rewrite write barriers for incremental marking.
- * 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]
+ * debug.c: catch up flag name changes.
-Mon Apr 15 00:13:13 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+ * internal.h: add rb_gc_writebarrier_remember() instead of
+ rb_gc_writebarrier_remember_promoted().
- * 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).
+ * array.c (ary_memcpy0): use rb_gc_writebarrier_remember().
-Mon Apr 15 00:07:31 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * array.c (rb_ary_modify): ditto.
- * 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]
+ * hash.c (rb_hash_keys): ditto.
-Mon Apr 15 00:07:31 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * hash.c (rb_hash_values): ditto.
- * include/ruby/io.h: rename SVR3,4 member names as POSIX compliant,
- to get rid of conflict on AIX. [ruby-core:53765] [Bug #8174]
+ * object.c (init_copy): use rb_copy_wb_protected_attribute() because
+ FL_WB_PROTECTED is moved from RBasic::flags.
-Sun Apr 14 23:49:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/objspace/test_objspace.rb: catch up ObjectSpace.dump() changes.
- * lib/mkmf.rb (configuration): not include all CFLAGS in CXXFLAGS, to
- use different set than C for C++. [ruby-core:45273] [Bug #6504]
+Sun Sep 7 12:47:06 2014 Tanaka Akira <akr@fsij.org>
-Sun Apr 14 23:43:06 2013 NARUSE, Yui <naruse@ruby-lang.org>
+ * process.c: PTHREAD_CANCEL_DISABLE is not defined on Android.
- * 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
+Sat Sep 6 20:59:06 2014 Tanaka Akira <akr@fsij.org>
-Sun Apr 14 23:19:55 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * process.c (has_privilege): The gid zero is not a privilege.
- * lib/mkmf.rb (MAIN_DOES_NOTHING): ensure symbols for tests to be
- preserved. [ruby-core:53745] [Bug #8169]
+Sat Sep 6 20:19:16 2014 Tanaka Akira <akr@fsij.org>
-Sun Apr 14 23:19:55 2013 Nobuyoshi Nakada <nobu@ruby-lang.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.
- * lib/mkmf.rb (MAIN_DOES_NOTHING): force to refer symbols for tests
- to be preserved. [ruby-core:53745] [Bug #8169]
+Sat Sep 6 19:27:10 2014 Tanaka Akira <akr@fsij.org>
-Sun Apr 14 03:00:51 2013 Naohisa Goto <ngotogenome@gmail.com>
+ * process.c (struct child_handler_disabler_state): Defined.
- * configure.in (AC_CHECK_HEADERS): atomic.h for Solaris atomic_ops.
+Sat Sep 6 18:31:32 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * ruby_atomic.h: Skip using Solaris10 atomic_ops on Solaris 9 or
- earlier if atomic.h is not available. [ruby-dev:47229] [Bug #8228]
+ * lib/rake.rb, lib/rake/*, test/rake/*: Update latest rake master(e47d023)
-Sun Apr 14 02:32:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Sep 6 16:38:08 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * time.c (GetTimeval): check if already initialized instance.
+ * 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.
- * time.c (GetNewTimeval): check if newly created instance.
+Sat Sep 6 11:08:52 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * time.c (time_init_0, time_init_1, time_init_copy, time_mload): must
- be newly created instance. [ruby-core:53436] [Bug #8099]
+ * 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]
-Sun Apr 14 02:13:25 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+Sat Sep 6 08:44:40 2014 Zachary Scott <e@zzak.io>
- * 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]
+ * lib/rdoc/generator/template/darkfish/js/jquery.js: Backport
+ rdoc/rdoc@74f60fcb04fee1778fe2694d1a0ea6513f8e67b7
-Fri Apr 12 04:16:30 2013 Naohisa Goto <ngotogenome@gmail.com>
+Sat Sep 6 08:10:44 2014 Eric Wong <e@80x24.org>
- * 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]
+ * test/ruby/test_io.rb (test_readpartial_locktmp): use IO#nonblock=
+ Old fcntl invocation may drop necessary flags on some platforms.
-Fri Apr 12 04:12:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Sep 6 07:46:51 2014 Eric Wong <e@80x24.org>
- * string.c (rb_str_conv_enc_opts): convert with one converter, instead
- of re-creating converters for each buffer expansion.
+ * test/ruby/test_io.rb (test_readpartial_locktmp): avoid EBADF
+ [ruby-core:64773] [ruby-core:64775]
-Fri Apr 12 03:48:25 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Sep 6 01:34:31 2014 Tanaka Akira <akr@fsij.org>
- * lib/mkmf.rb (find_library): fix to format message.
- [ruby-core:53568] [Bug #8130]
-
-Fri Apr 12 03:44:45 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]
-
-Fri Apr 12 02:27:42 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.
-
-Fri Apr 12 02:27:42 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]
-
-Fri Apr 12 02:27:42 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * addr2line.c (putce): suppress unused return value warning.
-
-Fri Apr 12 02:27:42 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]
-
-Fri Apr 12 02:27:42 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * addr2line.c (rb_dump_backtrace_with_lines): output line at once.
-
-Fri Apr 12 02:10:09 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]
-
-Fri Apr 12 01:57:52 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 Apr 12 01:28:46 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]
-
-Fri Apr 12 01:28:46 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.
-
-Mon Apr 8 00:10:59 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]
-
-Sun Apr 7 22:27:12 2013 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c: Avoid unnecessary heap growth. patched by tmm1(Aman Gupta).
- [Bug #8093] [ruby-core:53393]
-
-Sun Apr 7 03:01:49 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]
-
-Sun Apr 7 02:54:40 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]
-
-Fri Apr 5 00:54:08 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/openssl/ossl_bn.c (ossl_bn_initialize): fix can't create from bn.
-
-Thu Apr 4 02:27:12 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.
-
-Thu Apr 4 02:24:59 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]
-
-Thu Apr 4 02:11:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * marshal.c (w_extended): check for prepended object.
- [ruby-core:53206] [Bug #8043]
-
-Wed Mar 27 03:02:30 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.
-
-Wed Mar 27 02:58:44 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * Merge Onigmo 0fe387da2fee089254f6b04990541c731a26757f
- v5.13.3 [Bug#7972] [Bug#7974]
-
-Wed Mar 27 02:53:53 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]
-
-Wed Mar 27 02:50:45 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]
-
-Mon Mar 25 02:02:15 2013 Tadayoshi Funaba <tadf@dotrb.org>
-
- * complex.c: edited rdoc.
- * rational.c: ditto.
-
-Mon Mar 25 02:02:15 2013 Tadayoshi Funaba <tadf@dotrb.org>
-
- * complex.c: described syntax of string form.
- * rational.c: ditto.
-
-Mon Mar 25 01:26:26 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/webrick/httpproxy.rb: Fix typos in HTTPProxyServer [Bug #8013]
- Patch by Nobuhiro IMAI [ruby-core:53127]
-
-Mon Mar 25 01:09:48 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]
-
-Mon Mar 25 01:05:15 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]
-
-Mon Mar 25 01:00:03 2013 Nobuyoshi Nakada <nobu@ruby-lang.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.
- * class.c (rb_prepend_module): check redefinition of built-in optimized
- methods. [ruby-dev:47124] [Bug #7983]
+Sat Sep 6 00:49:41 2014 Tanaka Akira <akr@fsij.org>
- * vm.c (rb_vm_check_redefinition_by_prepend): ditto.
+ * signal.c (ruby_signal): Don't set SA_SIGINFO for SIG_IGN and
+ SIG_DFL.
-Mon Mar 25 00:51:57 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Sep 5 21:45:33 2014 Tanaka Akira <akr@fsij.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]
+ * 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.
-Mon Mar 25 00:47:04 2013 Koichi Sasada <ko1@atdot.net>
+Fri Sep 5 21:02:54 2014 Tanaka Akira <akr@fsij.org>
- * 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.
+ * process.c (handle_fork_error): Make try_gc_p argument volatile to
+ suppress "clobbered" warning.
- * test/ruby/test_iseq.rb: add a test of lines after ISeq#to_a.
+Fri Sep 5 20:48:06 2014 Tanaka Akira <akr@fsij.org>
-Mon Mar 25 00:41:23 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * process.c (handle_fork_error): Don't need state_p argument.
- * 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.
+Fri Sep 5 20:35:52 2014 Tanaka Akira <akr@fsij.org>
-Wed Mar 20 23:21:14 2013 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+ * process.c (has_privilege): Fix a return value.
- * 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]
+Fri Sep 5 19:00:40 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Wed Mar 20 23:17:33 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+ * lib/shellwords.rb: proofreading documentation.
+ [Bug #10155][ruby-core:64471]
- * 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.
+Fri Sep 5 18:34:33 2014 Laurent Arnoud <laurent@spkdev.net>
-Wed Mar 20 23:17:33 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+ * test/csv/test_row.rb: Added some missing tests in CSV.
+ [fix GH-710]
+ * test/csv/test_table.rb: ditto.
- * test/win32ole/test_err_in_callback.rb (TestErrInCallBack#setup): use
- relative path to get rid of "too long commandline" error.
+Fri Sep 5 12:57:52 2014 Tanaka Akira <akr@fsij.org>
-Wed Mar 20 23:17:33 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+ * process.c (has_privilege): Refine uid/gid check.
- * test/win32ole/test_err_in_callback.rb
- (TestErrInCallBack#test_err_in_callback): shouldn't create a file in
- the top of build directory.
+Fri Sep 5 12:40:55 2014 Tanaka Akira <akr@fsij.org>
-Wed Mar 20 23:08:40 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * configure.in: Check sys/id.h, getuidx and getgidx for AIX.
- * include/ruby/missing.h: removed __linux__. it's unnecessary.
+ * process.c (getresuid): Defined for AIX.
+ (getresgid): Ditto
+ AIX don't have getresuid/getresgid but getuidx/getgidx.
-Wed Mar 20 23:03:27 2013 Tanaka Akira <akr@fsij.org>
+Fri Sep 5 12:28:21 2014 Tanaka Akira <akr@fsij.org>
- * configure.in: move OS specific header/function knowledge before
- automatic header tests.
+ * process.c (has_privilege): Fix assignments.
-Wed Mar 20 23:01:42 2013 Tanaka Akira <akr@fsij.org>
+Fri Sep 5 11:10:13 2014 SHIBATA Hiroshi <shibata.hiroshi@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 gurded by #ifdef and the above move
- is required for this change.
+ * 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.
-Wed Mar 20 22:57:27 2013 Tanaka Akira <akr@fsij.org>
+Fri Sep 5 10:41:07 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * configure.in: move the test for -march=i486 just after
- RUBY_UNIVERSAL_ARCH/RUBY_DEFAULT_ARCH.
+ * test/rdoc/test_rdoc_rdoc.rb (TestRDocRDoc#test_parse_file_encoding):
+ typofix.
-Wed Mar 20 22:56:07 2013 Tanaka Akira <akr@fsij.org>
+Fri Sep 5 10:39:14 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * configure.in: change CFLAGS temporally to test
- ARCH_FLAG="-march=i486".
+ * lib/rdoc.rb, lib/rdoc, test/rdoc: Update to RDoc 4.2.0.alpha(313287)
-Wed Mar 20 22:54:33 2013 Tanaka Akira <akr@fsij.org>
+Fri Sep 5 06:04:22 2014 Eric Wong <e@80x24.org>
- * configure.in: don't define ARCH_FLAG="-march=i486" if it causes
- compilation problem.
+ * vm.c: remove unused USE_THREAD_RECYCLE [misc #10198]
-Wed Mar 20 22:36:41 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Fri Sep 5 00:29:08 2014 Tanaka Akira <akr@fsij.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.
+ * configure.in (dirfd): Check function.
-Wed Mar 20 22:34:52 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * dir.c (dir_fileno): New method.
+ [ruby-dev:48265] [Feature #9880]
- * include/ruby/missing.h (__syscall): moved to...
- * io.c: here. because __syscall() is only used from io.c.
+Thu Sep 4 23:39:52 2014 Tanaka Akira <akr@fsij.org>
- * 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].
+ * process.c (has_privilege): New function.
+ (retry_fork_async_signal_safe): Don't use vfork() for privileged
+ process.
-Wed Mar 20 22:33:26 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * configure.in (getresuid): Check function.
+ (getresgid): Ditto.
- * include/ruby/missing.h (struct timespec): include <sys/time.h>
+Thu Sep 4 20:22:14 2014 Laurent Arnoud <laurent@spkdev.net>
-Wed Mar 20 22:33:26 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * test/pathname/test_pathname.rb: added testcase for Pathname#mountpoint?.
+ [fix GH-709]
- * 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.
+Thu Sep 4 20:09:21 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * file.c: include sys/time.h explicitly.
- * random.c: ditto.
+ * symbian/*: removed Symbian support.
+ [Feature #10199][ruby-core:64725]
+ * dln.c: ditto.
+ * include/ruby/defines.h: ditto.
* thread_pthread.c: ditto.
- * time.c: ditto.
- * ext/date/date_strftime.c: ditto.
-
-Mon Mar 18 00:12:28 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.
-
-Mon Mar 18 00:11:33 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]
-
-Mon Mar 18 00:11:33 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]
-
-Mon Mar 18 00:05:50 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.
-
-Mon Mar 18 00:03:27 2013 Eric Hodel <drbrain@segment7.net>
-
- * test/rubygems/test_require.rb: Fix tests when 'a.rb' exists.
- [ruby-trunk - Bug #7749]
-
-Mon Mar 18 00:02:27 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.
-
-Mon Mar 18 00:00:32 2013 Eric Hodel <drbrain@segment7.net>
-
- * test/rubygems/test_gem_spec_fetcher.rb: Removed unused variable.
-
-Mon Mar 18 00:00:32 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
-
-Sun Mar 17 23:53:19 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
-
-Sun Mar 17 23:36:05 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
-
-Sun Mar 17 23:28:44 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 overrdden.
- [Bug #7698]
-
-Sun Mar 17 23:26:31 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/rubygems/ext/ext_conf_builder.rb (Gem::Ext::ExtConfBuilder.build):
- fix for unusal cases again. install to a temporary directory once
- and move instaled files to the destination directory, if it is same
- as the current directory. [Bug #7698]
-
-Sun Mar 17 23:22:22 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 17 23:19:34 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * 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 17 23:11:35 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.
-
-Tue Mar 12 00:56:19 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.
-
-Tue Mar 12 00:53:34 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * process.c (setup_communication_pipe): remove unused function.
- it was unintentionally added r39683.
-
-Tue Mar 12 00:53:34 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.
-
-Tue Mar 12 00:53:34 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.
-
-Tue Mar 12 00:53:34 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.
-
-Tue Mar 12 00:53:34 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread_pthread.c (consume_communication_pipe): retry when
- read returned CCP_READ_BUFF_SIZE.
-
-Tue Mar 12 00:53:34 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.
-
-Tue Mar 12 00:51:23 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.
-
-Tue Mar 12 00:51:23 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread_pthread.c (USE_SLEEPY_TIMER_THREAD): use more accurate
- ifdef condtions.
-
-Mon Mar 11 01:16:12 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]
-
-Mon Mar 11 01:12:50 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]
-
-Mon Mar 11 01:09:23 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * error.c: clarify reason for sleep in SignalException example
-
-Mon Mar 11 01:09:23 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 Mar 11 01:04:54 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 Mar 11 00:58:30 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 Mar 11 00:54:30 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 Mar 11 00:50:21 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * thread.c: Document Thread::new, clean up ::fork and mention calling
- super if subclassing Thread
-
-Mon Mar 11 00:47:47 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * configure.in (unexpand_shvar): Use the numeric comparison
- operator instead of '==' which is a ksh extention. [Bug #7941]
-
-Sun Mar 10 00:01:07 2013 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_core.c: [ruby-core:52303]
-
-Sat Mar 9 23:55:42 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]
-
-Sat Mar 9 23:51:58 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * random.c (rb_random_ulong_limited): fix error message for negative
- value. [ruby-dev:47061] [Bug #7903]
-
-Sat Mar 9 23:41:11 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * thread.c: Document ThreadGroup::Default
-
-Sat Mar 9 23:31:46 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]
-
-Sat Mar 9 23:15:06 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.
-
-Sat Mar 9 23:08:43 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 Mar 9 22:50:28 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 Mar 9 22:45:01 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * array.c (rb_ary_diff, rb_ary_and, rb_ary_or): Document return order
- [RubySpec #7803]
-
-Sat Mar 9 22:38:26 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * object.c (rb_obj_comp): Documenting Object#<=> return values
- Patch by Stefan Rusterholz
-
-Sat Mar 9 22:35:22 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 Mar 9 22:18:43 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * test/test_rbconfig.rb (TestRbConfig): fix r39372.
- It must see RbConfig::CONFIG instead of CONFIG.
-
-Sat Mar 9 22:18:43 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/test_rbconfig.rb (TestRbConfig): skip user defined values by
- configuration options. [Bug #7902]
-
-Sat Mar 9 22:07:53 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
- * lib/rexml/document.rb (REXML::Document.entity_expansion_text_limit):
- fix a typo in comment in r39384.
-
-Sat Mar 9 21:52:19 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]
-
-Sat Mar 9 21:46:41 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/globals.rdoc: Document what setting $DEBUG does.
-
- * doc/globals.rdoc: Added pointer to $-d for full documentation.
-
-Sat Mar 9 21:45:38 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.
-
-Sat Mar 9 21:29:45 2013 Naohisa Goto <ngotogenome@gmail.com>
-
- * signal.c (ruby_abort): fix typo in r39354 [Bug #5014]
-
-Sat Mar 9 21:29:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * signal.c (check_stack_overflow): extract duplicated code and get rid
- of declaration-after-statement. [Bug #5014]
-
-Sat Mar 9 21:29:45 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]
-
-Sat Mar 9 21:25:45 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * file.c (rb_group_member): added an error check. SUS says,
- getgroups(small_value) may return EINVAL.
-
-Sat Mar 9 21:23:36 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.
-
-Sat Mar 9 21:15:39 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.
-
-Wed Mar 6 22:13:38 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
-merge revision(s) 39297: [Backport #8032]
-
- * tool/mkconfig.rb: clear exec_prefix which may differ from prefix,
- before expanding rubyarchdir to remove prefix.
-
-Tue Mar 5 01:20:39 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * tool/merger.rb: add interaction when only ChangeLog is modified.
-
-Tue Mar 5 01:03:16 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * file.c (rb_group_member): get rid of NGROUPS dependency.
- [Bug #7886] [ruby-core:52537]
-
-Tue Mar 5 00:16:56 2013 Eric Hodel <drbrain@segment7.net>
-
- * ext/openssl/ossl.c (class OpenSSL): Use only inner parenthesis in
- create_extension examples.
-
-Tue Mar 5 00:16:56 2013 Eric Hodel <drbrain@segment7.net>
-
- * ext/openssl/ossl.c (class OpenSSL): Fixed ExtensionFactory example.
- Patch by Richard Bradley. [ruby-trunk - Bug #7551]
-
-Mon Mar 4 23:53:18 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
- (merge r39291)
- * configure.in (opt-dir): remove debug print.
-
-Mon Mar 4 23:42:34 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/psych/lib/psych/y.rb: Document Kernel#y by Adam Stankiewicz
- [Github tenderlove/psych#127]
-
-Mon Mar 4 23:37: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.
-
-Sun Mar 3 02:45:13 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * vm.c (ENV_IN_HEAP_P): fix off-by-one error.
-
-Sun Mar 3 02:39:01 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
-
-Sun Mar 3 02:22:56 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * class.c (include_modules_at): detect cyclic prepend with original
- method table. [ruby-core:52205] [Bug #7841]
-
-Sun Mar 3 02:16:24 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]
-
-Sun Mar 3 01:57:50 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (warnflags): disable -Werror by default unless
- development. [ruby-core:52131] [Bug #7830]
-
-Wed Feb 27 00:20:43 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]
-
-Sun Feb 24 15:16:00 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:23:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * thread.c: Grammar for #backtrace_locations and ::handle_interrupt
-
-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
- [Backport #7926]
-
-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 [Backport #7927]
-
-Wed Feb 20 13:37:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/pty/pty.c: Documentation for the PTY module [Backport #7928]
-
-Wed Feb 20 12:18:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * object.c: Document Data class by Matthew Mongeau [Backport #7929]
-
-Wed Feb 20 11:50:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/mutex_m.rb: Add rdoc for Mutex_m module [Backport #7930]
-
-Tue Feb 19 12:30:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * object.c: rdoc formatting for Kernel#Array() [Backport #7931]
- * array.c: Add rdoc for Array() method to Creating Arrays section
-
-Sat Feb 23 16:51:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * thread.c: Documentation for Thread#backtrace_locations
- [Backport #7932]
-
-Sat Feb 23 16:05:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * vm.c: Typo in ObjectSpace::WeakMap overview [Backport #7933]
-
-Sat Feb 23 16:00:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * thread.c: Improved rdoc for ::handle_interrupt, ::pending_interrupt?
- and #pending_interrupt? [Backport #7934]
-
-Sat Feb 23 14:19:51 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]
-
-Sat Feb 23 13:03:22 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/ipaddr.rb (IPAddr#in6_addr): Fix a typo with the closing
- parenthesis.
-
-Sat Feb 23 13:03:22 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]
-
-Sat Feb 23 13:00:49 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 23 13:00:07 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]
-
-Sat Feb 23 12:58:32 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]
-
-Tue Feb 23 12:07:00 2013 Kenta MURATA <mrkn@mrkn.jp>
-
- * backport r39321 from trunk. [ruby-core:51777] [Bug #7761]
-
- * ext/bigdecimal/bigdecimal.gemspec: bump to 1.2.0.
- [ruby-core:51777] [Bug #7761]
-
-Sat Feb 23 08:57:46 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * backport r39410 from trunk
-
- * doc/NEWS-*: Update NEWS from their respective branches
-
-Sat Feb 23 08:14:43 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * backport r39400-r39407 from trunk.
-
- * NEWS: many additions
-
- * object.c: Add doc for Module.prepended
-
-Sat Feb 23 06:07:04 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.
-
-Sat Feb 23 04:34:44 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * NEWS: pending_interrupt? is both instance and singleton method
-
-Sat Feb 23 02:49:10 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * NEWS: Add Thread#pending_interrupt? and Thread.handle_interrupt
-
-Fri Feb 22 19:22:05 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.
-
-Thu Feb 21 05:03:38 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.
-
-Thu Feb 21 04:54:14 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]
-
-Thu Feb 21 03:16:37 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * NEWS: Floats are frozen too
-
-Thu Feb 21 03:10:53 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * NEWS: Add that Fixnums and Bignums are frozen
-
-Wed Feb 20 17:02:12 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_eval.c (vm_call0_body): check interrupts after method dispatch
- from C methods. [Bug #7878]
-
-Wed Feb 20 08:05:25 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.
-
-Tue Feb 19 15:49:58 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (unexpand_shvar): regularize a shell variable by
- unexpanding shell variables in it.
-
- * configure.in (shvar_to_cpp): do not substitute exec_prefix itself
- with RUBY_EXEC_PREFIX, which cause recursive definition.
- [ruby-core:52296] [Bug #7860]
-
- * 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]
-
-Tue Feb 19 14:08:46 2013 Eric Hodel <drbrain@segment7.net>
-
- * backport r39307 from trunk. [Bug #7880]
-
- * 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 13:57:26 2013 Eric Hodel <drbrain@segment7.net>
-
- * backport r39247 from trunk. [Bug #7853]
-
- * lib/rdoc.rb: Update to release version of 4.0.0
-
- * lib/rubygems.rb: Update to release version of 2.0.0
-
-Tue Feb 19 12:25:27 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/Makefile.sub (config.status): site and vendor directories
- should use sitearch, not arch. [ruby-dev:46964] [Bug #7823]
-
-Tue Feb 19 07:51:01 2013 Koichi Sasada <ko1@atdot.net>
-
- * backport r39275 from trunk. [ruby-dev:46994] [Bug #7774]
-
- * 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 20:43:43 2013 Koichi Sasada <ko1@atdot.net>
-
- * backport r39276 from trunk. [ruby-dev:46997] [Bug #7825]
-
- * 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.
-
-Fri Feb 15 00:49:32 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.
-
-Fri Feb 15 00:49:32 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 13:17:10 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * Backport r39168 Warning about TracePoint events to 2.0.0
- [ruby-core:52073] [Bug #7815]
-
- * vm_trace.c: note about TracePoint events set
-
-Thu Feb 14 07:04:13 2013 Eric Hodel <drbrain@segment7.net>
-
- * Backport r39213 from trunk [ruby-trunk - Bug #7383]
-
- * 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.
-
-Thu Feb 14 07:01:12 2013 Eric Hodel <drbrain@segment7.net>
-
- * Backport part of r39166 from trunk [ruby-trunk - Bug #7809]
-
- * lib/rubygems/package.rb: Include checksums.yaml.gz signatures for
- verification.
- * test/rubygems/test_gem_package.rb: Test for the above.
-
-Wed Feb 13 15:34:21 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
-
-Sat Feb 9 21:13:35 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * backport r39167 from trunk. [ruby-core:52059] [Bug #7812]
-
- * BSDL: update copyright notice for 2013.
-
-Fri Feb 8 19:56:54 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * array.c (rb_ary_dup): reverted r39004. see [Bug #7768], and
- release manager finally decided to revert it.
-
-Fri Feb 8 16:09:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (rb_ensure): preserve errinfo across ensure proc before
- JUMP_TAG(). [ruby-core:52022] [Bug #7802]
-
-Fri Feb 8 16:08:28 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/ruby/envutil.rb (assert_separately): check also terminating
- signal not only if core dumped.
-
-Fri Feb 8 13:12:04 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc/generator/darkfish.rb: Set encoding on output template to
- user-specified encoding.
- * test/rdoc/test_rdoc_generator_darkfish.rb: Test for above.
-
- * lib/rdoc.rb: Bump version
-
-Fri Feb 8 11:53:33 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/security/policy.rb: Raise proper exceptions when
- verifying unsigned gems (instead of crashing).
- * test/rubygems/test_gem_security_policy.rb: Tests for the above.
-
-Fri Feb 8 10:44:44 2013 Eric Hodel <drbrain@segment7.net>
-
- * test/rubygems/test_gem_dependency_installer.rb: Improve coverage of
- --install-dir feature of gem install.
-
-Fri Feb 8 10:11:09 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/config_file.rb: Add missing require for
- user_interaction.rb
-
- * lib/rubygems/dependency_installer.rb: Minor refactor for clarity.
-
-Fri Feb 8 09:35:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (MakeMakefile#configuration): set all ruby names.
- hdrdir now needs RUBY_VERSION_NAME.
-
-Fri Feb 8 08:58:26 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/package/old.rb: Fix loading old format gems on ruby
- 1.8. This commit is only so trunk and rubygems master have the same
- code.
-
-Fri Feb 8 08:53:27 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/yaml_tree.rb: fixing string quotation
- when dumping Ruby strings. Thanks Ingy
-
- * test/psych/test_psych.rb: appropriate tests.
-
- * test/psych/test_yaml.rb: ditto
-
-Fri Feb 8 08:50:42 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/yaml_tree.rb: change output reference
- ids to be sequential numbers.
-
-Fri Feb 8 07:47:56 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/package/old.rb: Disallow installation of old-format
- gems when a security policy is active.
- * test/rubygems/test_gem_package_old.rb: Test for above.
-
-Fri Feb 8 07:34:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/net/http.rb (HTTP.post_form): Fix module scope in documentation
- Patch by David Albert [Bug #7794] [ruby-core:51955]
-
-Fri Feb 8 07:33:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * compar.c (cmp_equal): Document ignored exception and return false
- By Makoto Kishimoto [Bug #7790] [ruby-dev:46925] [ruby-dev:46910]
-
-Fri Feb 8 07:17:00 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/dependency_installer.rb: Only install local gems if
- they end in '.gem'. Fixes github rubygems issue #407.
- * test/rubygems/test_gem_dependency_installer.rb: Test for the above.
-
-Fri Feb 8 00:02:48 2013 Tanaka Akira <akr@fsij.org>
-
- * process.c (obj2gid): use getgrnam_r() only if getgrnam_r() and
- _SC_GETGR_R_SIZE_MAX is available.
- MirOS BSD (MirBSD 10 GENERIC#1382 i386) have getgrnam_r() but
- no _SC_GETGR_R_SIZE_MAX.
- (obj2uid): use getpwnam_r() only if getpwnam_r() and
- _SC_GETPW_R_SIZE_MAX is available.
- This is consistency for obj2gid.
- MirOS BSD have neither getpwnam_r() nor _SC_GETPW_R_SIZE_MAX.
-
-Thu Feb 7 22:01:18 2013 Tanaka Akira <akr@fsij.org>
-
- * configure.in: define linker for shared library on MirOS BSD.
-
-Thu Feb 7 21:09:23 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/rubygems/test_gem_config_file.rb
- (TestGemConfigFile#test_check_credentials_permissions): skip on
- Windows. see [Bug #7784] [ruby-core:51864] and r39070.
-
-Thu Feb 7 20:52:40 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/Makefile.sub (config.status): added variables which were
- missing at r39130.
-
-Thu Feb 7 15:33:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (MakeMakefile#merge_libs): insert following reversal
- ordered elements just after the duplicated element, not overwriting
- successive elements. [ruby-core:50314] [Bug #7467]
-
-Thu Feb 7 14:56:15 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/package.rb: Ensure digests are generated for signing.
- * test/rubygems/test_gem_package.rb: Test for the above.
-
- * lib/rubygems/security/policy.rb: Ensure digests are present when
- verifying a gem and match the number of signatures bidirectionally.
- * test/rubygems/test_gem_security_policy.rb: Test for the above.
-
- * lib/rubygems.rb: Documentation improvements (by zzak)
-
-Thu Feb 7 05:52:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * doc/pty/README: Remove static documentation file
- * ext/pty/pty.c: Add License to PTY module overview
-
-Thu Feb 7 02:31:10 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * vm_insnhelper.c: attr_writer should return its argument [Bug #7773]
-
- * test/ruby/test_basicinstructions.rb: Test for above
-
-Thu Feb 7 01:35:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * doc/security.rdoc: Link to japanese version of CVE page patch by
- nagachika
-
-Wed Feb 6 23:30:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * doc/pty/README.expect: Removed static documentation file
- * ext/pty/lib/expect.rb: Documentation for IO#expect
-
-Wed Feb 6 22:25:00 2013 Charlie Somerville <charlie@charliesomerville.com>
-
- * hash.c (env_reject_bang): hide keys array from ObjectSpace
- * hash.c (env_select_bang): ditto
-
-Wed Feb 6 17:33:01 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (multiarch): add option to move architecture dependent
- directories. [Feature #6111]
-
- * template/ruby.pc.in: add arch dependent paths.
-
- * configure.in (rubyarchhdrdir, sitearchhdrdir, vendorarchhdrdir): add
- options to customize architecture dependent header directories.
-
- * configure.in (rubyarchprefix, sitearchdir, vendorarchdir): add
- options to customize architecture dependent library directories.
-
- * template/ruby.pc.in, tool/mkconfig.rb, tool/rbinstall.rb: use
- configured values.
-
- * tool/mkconfig.rb: expand rubyarchdir to extract prefix.
-
- * configure.in (RUBY_VERSION_NAME), template/ruby.pc.in: add
- substitution and define.
-
- * configure.in, version.c: parametric architecture name for paths.
-
- * configure.in (shvar_to_cpp): convert sh variable references
- by replacing with string literal forms in cpp.
-
-Wed Feb 6 17:05:26 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc: Import RDoc 4.0.0.rc.2
-
-Mon Feb 4 02:22:49 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/ruby/test_process.rb (test_setsid): ensure to call
- Process.wait(). Reported by George Koehler. Thanks.
-
-Mon Feb 4 02:18:00 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/ruby/test_process.rb (test_setsid): skip when platform is
- OpenBSD. Contributed from George Koehler.
- [Bug #7789] [ruby-core:51889]
-
-Wed Feb 6 13:35:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * proc.c (rb_method_entry_location, rb_{mod,obj}_method_location): new
- functions to obtain source location of method definition.
-
- * vm_method.c (rb_obj_respond_to): show the location of old style
- respond_to? method.
-
-Wed Feb 6 13:03:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * doc/security.rdoc: Add link to CVEs on ruby-lang.org/en/security
-
-Wed Feb 6 12:49:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * NEWS: Add note about removal of CSV::load and CSV::dump from r39077
-
-Wed Feb 6 05:57:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/racc/parser.rb: Hide copyright notice from Racc doc
-
-Wed Feb 6 05:50:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * doc/rubygems/*: Removed outdated documentation files
- * lib/rubygems/LICENSE.txt: Include license file
- * lib/rubygems.rb: Move Gem module documentation so rdoc can parse it
- and link to LICENSE.txt
- * lib/rubygems/*: Hide useless documentation from Gem module rdoc
-
-Wed Feb 6 03:45:19 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * doc/security.rdoc: Remove documentation for unsafe CSV.load which
- was deleted in r39077
-
-Wed Feb 6 03:27:19 2013 James Edward Gray II <james@graysoftinc.com>
-
- * lib/csv.rb: Remove the dangerous serialization feature.
-
-Wed Feb 6 00:56:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/irb.rb: Remove example from restrictions, it works [Github #246]
- Based on patch by Ryunosuke SATO
-
-Wed Feb 6 00:46:53 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * vm.c (rb_vm_stack_to_heap): call rb_vm_get_binding_creatable_next_cfp
- instead of rb_vm_get_ruby_level_next_cfp to prevent a segfault by
- calling Kernel#callcc. See r39067 for more details.
- [ruby-dev:46908] [ruby-trunk - Bug #7774]
-
- * test/ruby/test_settracefunc.rb: add a test.
-
-Tue Feb 5 18:48:00 2013 Charlie Somerville <charlie@charliesomerville.com>
-
- * doc/security.rdoc: add regex, eval and drb sections
-
-Tue Feb 5 17:24:02 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc/servlet.rb: Fixed root search paths, filesystem paths
- instead of HTTP paths were returned.
- * test/rdoc/test_rdoc_servlet.rb: Test for above.
-
-Tue Feb 5 16:37:00 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/config_file.rb: Ignore permissions check on windows.
- Windows writes 0600 file as 0644 permissions making the check
- useless.
-
-Tue Feb 5 16:25:25 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_method.c (rb_obj_respond_to): drop optional include_all flag if
- respond_to? method is defined in old style. [Bug #7722]
-
-Tue Feb 05 15:04:34 2013 Koichi Sasada <ko1@atdot.net>
-
- * proc.c (rb_binding_new_with_cfp): permit to create binding object
- of IFUNC frame.
- When `rb_binding_new_with_cfp()' is called, VM finds out the first
- normal (has iseq) frame and create a binding object of this frame
- and create Env objects. `ep's of related frames are updated
- (`ep's point Env object managed spaces).
- However, `ep' of skipped IFUNC frame was not updated and
- old invalid `ep' was remained. It causes serious problems.
- To solve this issue, permit IFUNC to create binding.
- (Maybe there is no problem on it)
- [ruby-dev:46908] [ruby-trunk - Bug #7774]
-
- * test/ruby/test_settracefunc.rb: add a test.
-
- * vm.c (rb_vm_get_binding_creatable_next_cfp), vm_core.h: added.
-
- * vm_trace.c: fix to use `rb_vm_get_binding_creatable_next_cfp()'.
-
-Tue Feb 5 14:43:15 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/matrix.rb: Fix error message, patch by pypypy [Bug #7777]
-
-Tue Feb 5 14:36:04 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * numeric.c (fix_pow): Handle special cases when base is 0, -1 or +1
- [Bug #5713] [Bug #5715]
-
- * rational.c (nurat_expt): ditto
-
-Tue Feb 5 13:27:53 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/io/console/console.c (rawmode_opt): use default values by `stty
- raw`.
-
-Tue Feb 5 12:50:47 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * range.c: Use div instead of / for bsearch
-
- * test/ruby/test_range.rb: Test showing bug when requiring mathn
-
-Tue Feb 5 12:48:38 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * enumerator.c: Use to_enum for Enumerable methods returning
- Enumerators.
- This makes Lazy#cycle no longer needed, so it was removed.
- Make Enumerator#chunk and slice_before return lazy Enumerators.
- [Bug #7715]
-
- * internal.h: Remove ref to rb_enum_cycle_size; no longer needed
-
- * enum.c: Make enum_cycle_size static.
-
- * test/ruby/test_lazy_enumerator.rb: Test for above
-
-Tue Feb 5 12:48:10 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * enumerator.c: Finalize and document Lazy.new. [Bug #7248]
- Add Lazy#to_enum and simplify Lazy#size.
-
- * test/ruby/test_lazy_enumerator.rb: tests for above
-
-Tue Feb 5 11:35:35 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/push_command.rb: Fixed credential download for
- `gem push --host`
- * lib/rubygems/gemcutter_utilities.rb: ditto.
- * test/rubygems/test_gem_commands_push_command.rb: Test for the above.
- * test/rubygems/test_gem_gemcutter_utilities.rb: ditto.
-
- * lib/rubygems/config_file.rb: Abort if the `gem push` credentials
- file has insecure permissions.
- * test/rubygems/test_gem_config_file.rb: Test for the above.
-
- * lib/rubygems/ext/builder.rb: Do not look for Gemfile, Isolate, etc.
- while building gem extensions.
-
- * lib/rubygems/package.rb: Unset spec and files list if a gem's
- signatures cannot be verified.
- * test/rubygems/test_gem_package.rb: Test for the above.
-
- * lib/rubygems/specification.rb: Reduce use of eval.
- * lib/rubygems/test_case.rb: ditto.
-
- * test/rubygems/test_gem_specification.rb: Test setting
- specification_version for legacy gems. Dup Gem.ruby before
- untainting in case it's frozen.
-
- * lib/rubygems.rb: Reduce use of eval. Only read files when looking
- for Gemfile, Isolate, etc.
- * test/rubygems/test_gem.rb: Test for the above.
-
-Tue Feb 5 10:15:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * doc/security.rdoc: Wrap security guide at 80 columns
-
-Tue Feb 5 10:15:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * doc/security.rdoc: Grammatical error on security guide
- Patch by Josh Bassett [Github fixes #245]
-
-Tue Feb 5 10:00:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/racc/parser.rb: Update #do_parse and #yyparse from upstream
- See [Github tenderlove/racc@7d954b5]
-
-Tue Feb 5 09:55:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/racc: Merge Racc documentation downstream, add grammar ref file
-
-Tue Feb 5 08:03:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/irb.rb, lib/irb/ext/save-history.rb: Add documentation on how to
- enabled irb history [ruby-core:51347] [Bug #7679]
-
-Tue Feb 5 07:35:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/irb.rb, lib/irb/context.rb: Add documentation on how to enable
- auto-indentation and autocompletion using irbrc and irb_context
- [ruby-core:51209] [Bug #7642] and [ruby-core:51348] [Bug #7680]
-
-Tue Feb 5 05:20:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * doc/standard_library.rdoc: Document list of libraries and extensions
- and their purpose or short description
- * lib/README: Remove lib/README in favor of doc/standard_library.rdoc
-
-Tue Feb 5 04:40:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/json/lib/json.rb: Move module overview definition for rdoc
-
-Tue Feb 5 03:00:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/tracer.rb: Move class overview definition and reformat
-
-Mon Feb 4 15:10:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/io/console/console.c (rawmode_opt): initialize options for the
- case all options are not given.
-
-Mon Feb 4 12:44:13 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_dump.c (control_frame_dump): capitalize prefix of `ep'
- if `ep' points an env object.
-
-Mon Feb 4 04:20:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/English.rb: Add English module for RDoc to parse, then
- remove_const to avoid confusion. Include full list of aliases and
- their associated global variable.
-
-Mon Feb 4 02:40:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/yaml.rb (YAML::EngineManager): Documentation for #yamler and
- #yamler= for using the removed Syck gem as the YAML::ENGINE
-
-Sun Feb 3 16:54:27 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/io/console/io-console.gemspec: bump. [Bug #7762]
-
- * test/io/console/test_io_console.rb (test_stringio_getch): use more
- descriptive assertions.
-
- * ext/io/console/console.c (rawmode_opt): min is minimum characters,
- not tenths.
-
-Sun Feb 3 16:13:00 2013 Charlie Somerville <charlie@charliesomerville.com>
-
- * doc/security.rdoc: add first cut at a Ruby security document
-
-Sun Feb 3 10:25:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * random.c: Document range argument for Kernel#rand.
- [ruby-core:51794] [Bug #7770]
-
-Sun Feb 3 10:00:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * numeric.c: Document Float constants [ruby-core:51484] [Bug #7709]
-
-Sun Feb 3 09:38:44 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/profiler.rb (PROFILE_CALL_PROC, PROFILE_RETURN_PROC): add b_call
- and b_return to profile block calls.
-
- * lib/profiler.rb (PROFILE_CALL_PROC, PROFILE_RETURN_PROC): split
- PROFILE_PROC for call and return events.
-
-Sat Feb 2 14:32:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/minitest/mock.rb, lib/minitest/hell.rb: nodoc top-level module
-
-Sat Feb 2 14:05:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/debug.rb: Documentation for DEBUGGER__ class methods based on
- patch by Vincent Batts [ruby-core:51253]
-
-Sat Feb 2 13:37:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/net/smtp.rb: Fix rdoc title for Net::SMTP
-
-Sat Feb 2 13:32:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/net/pop.rb: Fix rdoc title for Net::POP3
-
-Sat Feb 2 13:00:11 2013 Yusuke Endoh <mame@tsg.ne.jp>
-
- * lib/gserver.rb (GServer#start): fix a timing issue. patch from
- Charles Nutter. [Bug #7081]
-
-Sat Feb 2 12:36:54 2013 Yusuke Endoh <mame@tsg.ne.jp>
-
- * lib/fileutils.rb (copy_entry, wrap_traverse): preserve attributes of
- directories on FileUtils.cp_r. The fix was proposed by Jan
- Wedekind. [Bug #7246]
-
- * test/fileutils/test_fileutils.rb: add a test for above.
-
-Sat Feb 2 12:30:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/uri/ftp.rb (URI::FTP.new2): nodoc method from r39013 [Bug #7301]
-
-Sat Feb 2 12:15:36 2013 Yusuke Endoh <mame@tsg.ne.jp>
-
- * lib/uri/ftp.rb (URI::FTP.new2): remove the rdoc because it is not
- well tested yet. [Bug #7301]
-
-Sat Feb 2 12:07:41 2013 Yusuke Endoh <mame@tsg.ne.jp>
-
- * ChangeLog: Forgot to add a reference to the ChangeLog of the
- previous commit.
-
-Sat Feb 2 12:05:18 2013 Yusuke Endoh <mame@tsg.ne.jp>
-
- * lib/fileutils.rb: chmod/chmod_R with a string mode (e.g., "+x")
- caused error in verbose mode. [Bug #7373]
-
- * test/fileutils/test_fileutils.rb: add a test for above.
-
-Sat Feb 2 11:44:42 2013 Yusuke Endoh <mame@tsg.ne.jp>
-
- * lib/English.rb: Remove some confusing words from rdoc. [Bug #7406]
-
-Sat Feb 2 10:17:12 2013 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * NEWS: add keyword arguments.
-
-Sat Feb 2 07:45:44 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * proc.c (proc_curry): Fix arity check [Bug #5747]
-
- * test/ruby/test_proc.rb: Test for above
-
-Sat Feb 2 07:44:15 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * proc.c: Add {*}_min_max_arity and refactor.
- [Bug #7765]
-
- * test/ruby/test_proc.rb: Fix wrong test
-
-Fri Feb 2 00:46:00 2013 Charlie Somerville <charlie@charliesomerville.com>
-
- * marshal.c: add security considerations to marshal overview, refer to
- overview from Marshal.load documentation [#7759]
-
-Fri Feb 1 23:04:00 2013 Charlie Somerville <charlie@charliesomerville.com>
-
- * array.c (rb_ary_dup): make returned array the same class as the original
- array [Bug #7768] [ruby-core:51792]
- * test/ruby/test_array.rb (class TestArray): add test
-
-Fri Feb 1 16:35:34 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * marshal.c (r_object0): prohibit setting instance variables of
- existing class/module.
-
-Fri Feb 1 14:34:29 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * ext/readline/extconf.rb, ext/readline/readline.c: check
- RL_PROMPT_START_IGNORE and RL_PROMPT_END_IGNORE directly in
- readline.c. Patch by Zachary Scott. [Bug #7397] [ruby-core:49561]
-
-Thu Jan 31 21:55:00 2013 Charlie Somerville <charlie@charliesomerville.com>
-
- * marshal.c (marshal_load): Add documentation warning against using
- Marshal.load on untrusted data [Bug #7759] [ruby-core:51765]
-
-Thu Jan 31 16:33:27 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (local_push_gen): no assigned but unused variable warnings
- in eval as well as -e. [Feature #7730] [ruby-core:51580]
-
-Wed Jan 30 12:30:08 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/ruby/test_signal.rb (test_trap_puts): Fix typo. "sync"
- should be "STDOUT.sync".
-
-Thu Jan 31 15:39:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * string.c (rb_str_aset_m): Documentation for String#[]= fix
- Raises an IndexError if Regexp match is out of range.
- Github fixes #243 Patch by Dmtiriy Budnik
-
-Thu Jan 31 13:54:44 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * ext/socket/raddrinfo.c (rsock_unix_sockaddr_len): return
- sizeof(sa_family_t) if path is empty. see "Autobind Feature" in
- unix(7) for details.
-
- * ext/socket/lib/socket.rb (unix_socket_abstract_name?): treat an
- empty path as an abstract name.
-
- * test/socket/test_unix.rb: related test.
-
-Wed Jan 30 20:58:50 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/basicsocket.c (bsock_getsockname): ignore truncated
- part of socket address.
- (bsock_getpeername): ditto.
- (bsock_local_address): ditto.
- (bsock_remote_address): ditto.
-
- * ext/socket/unixsocket.c (unix_path): ditto.
- (unix_addr): ditto.
- (unix_peeraddr): ditto.
-
- * ext/socket/init.c (cloexec_accept): ditto.
-
-Wed Jan 30 17:08:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/win32.h (fstat): revert r37337, which uses _fstati64()
- instead of fstati64() on mingw32. [Bug #7276]
-
-Wed Jan 30 15:26:37 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * ext/socket/unixsocket.c (rsock_init_unixsock): use rb_inspect()
- because rb_sys_fail_str() fails if its argument contains NUL.
-
- * test/socket/test_unix.rb: related test.
-
-Wed Jan 30 15:21:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_dump.c (rb_vm_bugreport): show the most important message, Crash
- Report log information, first.
-
-Wed Jan 30 15:00:05 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * array.c (rb_ary_bsearch): Raise TypeError on bad return from block
-
- * range.c (range_bsearch): ditto
-
- * test/ruby/test_array.rb (class): Test for above
-
- * test/ruby/test_range.rb (class): ditto
-
-Wed Jan 30 14:46:28 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * range.c: Restrict bsearch to integers [#7728]
-
- * test/ruby/test_range.rb: Test for above
-
-Wed Jan 30 14:10:52 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * array.c (rb_ary_bsearch): Return enumerator if no block [#7725]
-
- * range.c (range_bsearch): ditto
-
- * test/ruby/test_array.rb: Test for above
-
- * test/ruby/test_range.rb: ditto
-
-Wed Jan 30 13:53:43 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/matrix.rb: Take conjugate for inner product
- [rubyspec:5a01ad5719f2] [ruby-dev:46101]
-
-Wed Jan 30 13:22:05 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (local_push_gen): warn assigned but unused variables also in
- toplevel, except for -e option. [Feature #7730] [ruby-core:51580]
-
-Wed Jan 30 13:17:53 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * cont.c (cont_restore_thread): svar should be separate per fibers.
- [ruby-core:51331] [Bug #7678]
-
-Wed Jan 30 07:15:04 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * re.c (reg_operand): Simplify and reuse error handling [Bug #7539]
-
- * test/ruby/test_regexp.rb: Test for above
-
-Wed Jan 30 07:00:16 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * object.c: Improve error for failed implicit conversions [Bug #7539]
-
- * error.c: Adapt rdoc
-
- * test/ruby/test_object.rb: Test for above
-
-Tue Jan 29 21:40:12 2013 Tanaka Akira <akr@fsij.org>
-
- * lib/net/http/generic_request.rb (encode_multipart_form_data): remove
- tempfile explicitly.
-
-Tue Jan 29 19:27:18 2013 Benoit Daloze <eregontp@gmail.com>
-
- * array.c: Improve documentation about
- comparison by hash for concerned methods. [ruby-core:51266]
-
-Tue Jan 29 17:03:28 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_backtrace.c: fix issue of rb_debug_inspector_open().
- The order of making binding should be stack (frame) top to bottom.
- [Bug #7635]
- And also fix issue of collecting klass. Collecting klass is same
- as TracePoint#defined_class.
- (previous version, it returns T_ICLASS (internal objects).
-
- * test/-ext-/debug/test_debug.rb: add a test.
-
- * ext/-test-/debug/extconf.rb, init.c, inspector.c: ditto.
-
- * vm_backtrace.c: remove magic number and add enum CALLER_BINDING_*.
-
- * vm_backtrace.c, include/ruby/debug.h: add new C api (experimental)
- rb_debug_inspector_frame_self_get().
-
- * vm.c, vm_core.h, vm_trace.c: move decl. of
- rb_vm_control_frame_id_and_class() and constify first parameter.
-
-Tue Jan 29 16:50:58 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_trace.c (rb_tracepoint_enable, rb_tracepoint_disable): check safe
- level as well as set_trace_func.
-
- * vm_trace.c (set_trace_func, thread_{add,set}_trace_func_m): check
- safe level as well as 1.8.
-
-Tue Jan 29 16:49:19 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * proc.c (rb_mod_method_arity): return original arity of the method if
- aliased because of visibility change, like as Method#arity.
-
-Tue Jan 29 12:05:18 2013 Tanaka Akira <akr@fsij.org>
-
- * test/ruby/test_marshal.rb: remove temporally files early.
-
- * test/ruby/test_process.rb: ditto.
-
- * test/psych/test_exception.rb: ditto.
-
-Tue Jan 29 09:26:20 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * ext/socket/socket.c (sock_s_pack_sockaddr_un): calculate the
- correct address length of an abstract socket.
-
- * test/socket/test_unix.rb: related test.
-
-Mon Jan 28 18:02:16 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_backtrace.c (rb_debug_inspector_frame_{class,binding,iseq}_get):
- use long as index as well as RARRAY_LEN().
-
-Mon Jan 28 17:51:38 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/ruby/envutil.rb (assert_separately): imply no core dump.
-
-Mon Jan 28 12:32:31 2013 Tanaka Akira <akr@fsij.org>
-
- * ext/fcntl/fcntl.c: update document. use "file descriptor" instead
- of "file handle" because it is not used other Ruby documents and
- it is confusing with Windows file handle.
- correct F_DUPFD behavior.
-
-Sat Jan 26 22:39:12 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * marshal.c (w_object): dump instance variables of the result of
- marshal_dump not the original object. [ruby-core:51163] [Bug #7627]
-
- * complex.c (nucomp_marshal_dump): need to copy instance variables.
-
- * rational.c (nurat_marshal_dump): ditto.
-
-Sat Jan 26 13:35:56 2013 Eric Hodel <drbrain@segment7.net>
-
- * ext/fcntl/fcntl.c: Document Fcntl constants
-
-Sat Jan 26 12:54:40 2013 Eric Hodel <drbrain@segment7.net>
-
- * hash.c (rb_env_size): Restored documentation for ENV.size
-
- * lib/drb/drb.rb: Documented DRb::DRb#run.
-
- * lib/erb.rb (class ERB): Improved documentation of ERb.
-
- * transcode.c: Documented Encoding::Converter constants.
-
-Sat Jan 26 10:09:57 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/webrick/accesslog.rb: Improved WEBrick documentation.
- * lib/webrick/cgi.rb: ditto.
- * lib/webrick/config.rb: ditto.
- * lib/webrick/cookie.rb: ditto.
- * lib/webrick/httpauth/authenticator.rb: ditto.
- * lib/webrick/httpauth/basicauth.rb: ditto.
- * lib/webrick/httpauth/digestauth.rb: ditto.
- * lib/webrick/httpproxy.rb: ditto.
- * lib/webrick/httprequest.rb: ditto.
- * lib/webrick/httpresponse.rb: ditto.
- * lib/webrick/https.rb: ditto.
- * lib/webrick/httpserver.rb: ditto.
- * lib/webrick/httpservlet/cgihandler.rb: ditto.
- * lib/webrick/httpservlet/filehandler.rb: ditto.
- * lib/webrick/httpservlet/prochandler.rb: ditto.
- * lib/webrick/httputils.rb: ditto.
- * lib/webrick/httpversion.rb: ditto.
- * lib/webrick/log.rb: ditto.
- * lib/webrick/server.rb: ditto.
- * lib/webrick/ssl.rb: ditto.
- * lib/webrick/utils.rb: ditto.
- * lib/webrick/version.rb: ditto.
-
-Sat Jan 26 08:29:33 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * ext/socket/raddrinfo (rsock_unix_sockaddr_len): renamed from
- rsock_unixpath_len, because it returns not the length of the path,
- but the length of a socket address for the path.
-
-Sat Jan 26 01:12:23 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/ruby/test_io.rb (test_ioctl_linux): skip if a platform is
- not x86 because linux ioctl request number depend on cpu arch.
- At least, alpha, mips, sparc and ppc have a different number.
- [Bug #7718] [ruby-core:51544]
-
-Fri Jan 25 19:14:24 2013 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c: use TlsAlloc instead of __declspec(thread)
- to avoid SEGV if win32ole.so loaded with LoadLibrary in Windows
- XP or earlier.
-
-Fri Jan 25 16:47:31 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * ext/socket/raddrinfo.c (rsock_unixpath_len, init_unix_addrinfo),
- ext/socket/unixsocket.c (unixsock_connect_internal,
- rsock_init_unixsock): calculate the correct address length of
- an abstract socket. Without this fix, sizeof(struct sockaddr_un)
- is specified as the length of an abstract socket for bind(2) or
- connect(2), so the address of the socket is filled with extra NUL
- characters. See unix(7) for details.
-
- * ext/socket/lib/socket.rb (unix_server_socket): don't access the
- file system if the platform is Linux and path starts with NUL,
- which means that the socket is an abstract socket.
-
- * test/socket/test_unix.rb: related test.
-
-Fri Jan 25 13:02:27 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/drb/drb.rb: Updated documentation based on patch from Vincent
- Batts. [ruby-trunk - Bug #7714]
- * lib/drb/ssl.rb: ditto.
-
-Fri Jan 25 12:23:29 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/drb/drb.rb: Improved documentation by adding or hiding methods.
- * lib/drb/eq.rb: ditto.
- * lib/drb/extserv.rb: ditto.
- * lib/drb/gw.rb: ditto.
- * lib/drb/invokemethod.rb: ditto.
- * lib/drb/observer.rb: ditto.
- * lib/drb/ssl.rb: ditto.
- * lib/drb/timeridconv.rb: ditto.
- * lib/drb/unix.rb: ditto.
-
- * sample/drb/gw_cu.rb: Fixed bug in DRb gateway sample.
-
-Fri Jan 25 12:01:56 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_core.h: modify a comment about rb_iseq_t::local_size.
- A patch by davidbalbert (David Albert) [Bug #6750]
-
-Fri Jan 25 10:36:31 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/mkmf.rb: Documented MakeMakefile constants. Hide implementation
- details from RDoc
-
-Fri Jan 25 10:04:07 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/compatibility.rb: Hide compatibility shims from RDoc
-
- * lib/rubygems/config_file.rb: Hide RbConfig use from RDoc
-
- * lib/rubygems/test_case.rb: Added note to use realpath when 1.8
- support is dropped.
-
-Fri Jan 25 09:14:43 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc/generator/darkfish.rb: Fixed debug message. RDoc bug #174
- by Thomas Leitner.
-
- * lib/rdoc/store.rb: Fixed deletion of ri attribute data when a class
- was loaded then saved. RDoc bug #171 by Thomas Leitner.
- * test/rdoc/test_rdoc_store.rb: Test for above.
-
-Thu Jan 24 19:55:25 2013 Shota Fukumori <her@sorah.jp>
-
- * NEWS (yaml): Write about bundled libyaml.
-
-Thu Jan 24 16:54:34 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/calling_methods.rdoc: Added a Method Lookup section.
- * doc/syntax/refinements.rdoc (Method Lookup): Clarified that
- refinement methods are looked up in classes, not instances.
-
-Thu Jan 24 16:49:17 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * enum.c (enum_zip): Fix error message
-
- * array.c (take_items): Same, for Array#zip
-
-Thu Jan 24 16:47:26 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * enumerator.c (lazy_zip): raise error for bad arguments
- [Bug #7706]
-
-Thu Jan 24 16:05:08 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * enumerator.c: Optimize Lazy#zip when passed only arrays
- [Bug #7706]
-
-Thu Jan 24 15:21:17 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * enumerator.c: Fix state handling for Lazy#zip,{drop_take}{_while}
- [bug #7696] [bug #7691]
-
-Thu Jan 24 11:43:47 2013 Narihiro Nakamura <authornari@gmail.com>
-
- * eval.c (f_current_dirname): Add documentation about "__dir__
- returns always an absolute path". [Bug #7729]
-
-Thu Jan 24 10:28:30 2013 Eric Hodel <drbrain@segment7.net>
-
- * NEWS (RDoc): Added mention of page support and markdown support.
-
-Thu Jan 24 09:40:13 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/refinements.rdoc: Added refinements document based on
- the specification from the wiki.
- * doc/syntax.rdoc: Added link to refinements document.
-
-Wed Jan 23 16:29:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (rb_w32_spawn, rb_w32_aspawn_flags): fix missing
- initialization. pointed out by phasis68 (Heesob Park) at
- [ruby-core:51579]. [Bug #7721]
-
-Wed Jan 23 16:18:04 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (MakeMakefile#try_constant): fix for large unsigned.
-
- * lib/mkmf.rb (MakeMakefile#try_constant): fix for larger constants.
-
- * test/mkmf/test_constant.rb: tests for try_constant.
- TODO: define check_constant and use it.
-
-Wed Jan 23 13:35:37 2013 Koichi Sasada <ko1@atdot.net>
-
- * thread_pthread.c (ruby_init_stack): ignore `STACK_END_ADDRESS'
- if Ruby interpreter is running on co-routine.
- [Feature #2294]
- https://bugs.ruby-lang.org/issues/2294#note-18
-
-Wed Jan 23 12:28:22 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (rb_w32_spawn, rb_w32_aspawn_flags): check the results
- of acp_to_wstr() which can return NULL. [ruby-core:51557] [Bug #7721]
-
-Wed Jan 23 10:40:49 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/assignment.rdoc (Implicit Array Assignment): Clarify
- that "left-hand side" means "of the assignment". Suggested by Jorge
- Dias.
- * doc/syntax/assignment.rdoc (Multiple Assignment): ditto.
-
-Wed Jan 23 10:34:47 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/assignment.rdoc (Local Variables and Methods): Fixed
- example showing caching of a method's results into a local variable.
- Added not about using an explicit receiver to call a method that
- matches a local variable. Suggested by markov_twain on twitter.
-
-Wed Jan 23 10:20:08 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/README: Fixed typo. Patch by Pradeep Sahoo.
- Fixes #240 on github
-
-Wed Jan 23 09:53:39 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc/servlet.rb: Fixed display of site and home documentation.
- Fixes rdoc issue #170 by Thomas Leitner.
- * test/rdoc/test_rdoc_servlet.rb: Test for above.
-
- * lib/rdoc/code_object.rb: Split #initialize_visibility from
- #initialize for reuse when loading a stored object.
- Fixes rdoc issue #171 by Thomas Leitner.
-
- * lib/rdoc/any_method.rb: Initialize visibility for #display? For
- rdoc issue #171
- * lib/rdoc/attr.rb: ditto.
- * lib/rdoc/class_module.rb: ditto.
- * lib/rdoc/top_level.rb: ditto.
- * test/rdoc/test_rdoc_any_method.rb: Test for above.
- * test/rdoc/test_rdoc_attr.rb: ditto.
- * test/rdoc/test_rdoc_class_module.rb: ditto.
- * test/rdoc/test_rdoc_constant.rb: ditto.
- * test/rdoc/test_rdoc_top_level.rb: ditto.
-
-Wed Jan 23 06:43:26 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/test_case.rb: Use Dir.tmpdir for rubygems tests instead
- of ./tmp/test. Fixes [ruby-trunk - Bug #7717]
-
-Tue Jan 22 22:58:03 2013 Akinori MUSHA <knu@iDaemons.org>
-
- * misc/ruby-electric.el (ruby-electric-curlies): Fix the bug where
- an open curly inserted in a string is always replaced with a
- hash sign.
-
-Mon Jan 21 15:41:33 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * tool/mkconfig.rb: BASERUBY is transient at core build.
-
-Mon Jan 21 13:51:21 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb ($extmk): traverse parent directories for the case
- srcdir is a symlink.
-
-Sun Jan 20 23:55:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * marshal.c (w_object, r_object0): separate respond_to checks and
- calling, and get back to the old behavior for 2.0. [Bug #7564]
-
-Sun Jan 20 22:24:28 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * tool/vpath.rb (VPath#def_options): hack for msys make, which
- converts a command line argument to non-msys command seems like a
- path list automagically. [Bug #7710] [ruby-core:51489]
-
-Sat Jan 19 11:35:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * struct.c (Struct.new): Document Struct.new with block
- Patch by Hiroyuki Iwatsuki [Bug #7674]
-
-Sat Jan 19 09:52:46 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/miscellaneous.rdoc: Added section on defined?
-
-Sat Jan 19 09:27:31 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/assignment.rdoc (Local Variables and Methods): Made it
- more clear that local variables are created by the parser, not
- execution. Thanks to John Hawthorn.
-
-Sat Jan 19 09:15:58 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/assignment.rdoc: Improved links
- * doc/syntax/methods.rdoc: ditto.
-
- * doc/syntax.rdoc: Added link to assignment document
-
-Sat Jan 19 08:47:33 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/assignment.rdoc: Added a syntax document on assignment.
-
-Fri Jan 18 14:11:01 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/methods.rdoc: Added Array Decomposition.
-
-Fri Jan 18 12:54:21 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * tool/rbinstall.rb (gem): Gem.ensure_gem_subdirectories makes
- subdirectories group-writable, so make them with $dir_mode.
-
-Fri Jan 18 11:24:33 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/win32ole/win32ole.c (ole_initialize): uninitialize OLE at thread
- ends. [Bug #2618] [ruby-core:27634]
-
- * ext/win32ole/win32ole.c (ole_initialize): initialize OLE for each
- threads. [Bug #2618] [ruby-core:27634]
-
-Thu Jan 17 22:10:35 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rubygems/ext/builder.rb (Gem::Ext::Builder.make): Remove
- .time dependency from *.rb install target. It causes needless
- *.rb install. [Bug #7698] [ruby-core:51437]
- Reported by Tadashi Saito. Thanks!!!
- * test/rubygems/test_gem_installer.rb
- (TestGemInstaller#test_install_extension_and_script): Add a test
- for the above change.
-
-Thu Jan 17 21:08:20 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * eval.c: Fix a typo in ruby_finalize() documentation.
-
-Thu Jan 17 20:28:18 2013 Benoit Daloze <eregontp@gmail.com>
-
- * object.c: Typo in Kernel#hash documentation.
- Patch by zed_0xff [Github Fixes #237]
-
-Thu Jan 17 10:48:56 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/scalar_scanner.rb: use constants rather than
- calculating Inf and NaN.
-
-Thu Jan 17 10:21:05 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/miscellaneous.rdoc: Added Ending an Expression and
- indentation.
-
-Thu Jan 17 09:30:21 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/installer.rb: Untaint string when checking output
- for $SAFE=1
-
- * lib/rubygems/specification.rb: Keep previously loaded specs as
- active. This prevents double loading when refreshing the gem list.
- * test/rubygems/test_gem.rb: Test for above
-
- * lib/rubygems.rb: Bump version to 2.0.0.rc.2
-
-Thu Jan 17 09:08:37 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/control_expressions.rdoc: Added ? : ternary if
-
-Thu Jan 17 08:36:04 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/miscellaneous.rdoc: Added documentation for alias, undef,
- BEGIN, END.
- * doc/syntax/modules_and_classes.rdoc (Constants): Fixed unwrapped
- paragraph with trailing whitespace.
- * doc/syntax/modules_and_classes.rdoc (Scope): Added section pointing
- to alias and undef documentation.
- * doc/syntax.rdoc: Added link to miscellaneous section.
-
-Thu Jan 17 07:50:26 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/control_expressions.rdoc (Flip-Flop): Added a section on
- the flip-flop.
-
-Thu Jan 17 06:59:51 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/control_expressions.rdoc (if Expressions): Fixed markup
- error. Fixes #235 on github by FlyingFoX.
-
-Thu Jan 17 06:53:58 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/literals.rdoc (Strings): Fixed typo. Fixes #236 on
- github by Doug Yun.
-
-Wed Jan 16 18:45:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/win32ole/lib/win32ole.rb: use TracePoint to hook all thread
- creation not only by Thread.new and to get rid of interference with
- svar scope. [Bug #7681] [ruby-core:51365]
-
-Wed Jan 16 09:35:53 2013 Eric Hodel <drbrain@segment7.net>
-
- * .document: Removed extra space
- * lib/irb/lc/.document: Hide help-message
- * lib/minitest/.document: Hide README.txt
- * lib/rake/lib/.document: Hide project.rake
- * lib/rdoc/generator/template/json_index/.document: Hide JavaScript
- files
- * lib/rubygems/ssl_certs/.document: Hide PEM files.
-
-Wed Jan 16 03:54:28 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/control_expressions.rdoc: Omit optional "then" for if and
- unless expressions. Improved description of "a if a = 0.zero?"
- NameError. Note that "do" for for loop is optional.
-
-Wed Jan 16 03:28:47 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/calling_methods.rdoc: Link to defining methods.
- * doc/syntax/methods.rdoc: Link to calling methods, fixed typo.
-
-Wed Jan 16 03:15:00 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/methods.rdoc: Fixed link
- * doc/syntax/modules_and_classes.rdoc: Fixed link
- * doc/syntax.rdoc: Updated with links to the recently added pages
-
-Wed Jan 16 03:05:50 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/control_expressions.rdoc (redo Statement): Added note
- about retry.
- * doc/syntax/exceptions.rdoc: Added retry statement
-
-Tue Jan 15 23:12:34 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * tool/vpath.rb (VPath#list): default separator to PATH_SEPARATOR from
- configure.in for make, not same name constant of File for use in ruby.
-
-Tue Jan 15 22:30:04 2013 Keiju Ishitsuka <keiju@ishitsuka.com>
-
- * lib/irb/ext/save-history.rb: identify rightly a status of a
- history file that already exists [Bug #7694]. Thanks Nobuhiro IMAI
- for this patch.
-
-Tue Jan 15 15:55:28 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/control_expressions.rdoc: Added description of control
- expressions in ruby.
-
-Tue Jan 15 13:33:00 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/methods.rdoc (Method Names): Added method names including
- operator methods.
- * doc/syntax/methods.rdoc (Return Values): Added note that assignment
- methods ignore return values.
- * doc/syntax/precedence.rdoc: Added document describing precedence.
-
-Tue Jan 15 11:49:31 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/methods.rdoc (Block Argument): Added section on block
- argument. Thanks to Andy Lindeman.
-
-Tue Jan 15 10:54:59 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/calling_methods.rdoc (Arguments): Added improved
- introduction to arguments including passing style and lazy
- evaluation. Thanks to Matt Aimonetti.
- * doc/syntax/calling_methods.rdoc (Positional Arguments): Added
- description for sending a message to a method with *arguments
- * doc/syntax/calling_methods.rdoc (Default Positional Arguments):
- Added description. Thanks to Andy Lindeman.
- * doc/syntax/calling_methods.rdoc (Block Local Arguments):
- Added description of block locals. Thanks to Justin Collins.
- * doc/syntax/calling_methods.rdoc (Hash to Keyword Arguments): Added
- section describing ** operator. Thanks to Justin Collins.
-
-Tue Jan 15 10:40:18 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * test_lazy_enumerator: Test that map & flat_map also require a block
-
-Tue Jan 15 09:22:47 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread_pthread.c (gvl_init): Reset gvl.wait_yield explicitly when
- fork()ing. Patch by Apollon Oikonomopoulos. Thanks!
- [Bug #7693][ruby-core:51424]
-
-Tue Jan 15 09:27:56 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/calling_methods.rdoc (Receiver): Added :: as pointed out
- by Tony Arcieri
- * doc/syntax/calling_methods.rdoc (Block Argument): Fixed { } block
- examples as pointed out by David Copeland.
-
-Tue Jan 15 09:10:29 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/methods.rdoc (Array/Hash Argument): Moved above Keyword
- Arguments
- * doc/syntax/methods.rdoc (Keyword Arguments): Described ** for
- gathering arbitrary keyword arguments.
-
-Tue Jan 15 08:56:37 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/calling_methods.rdoc: Added document describing method
- calls.
-
-Tue Jan 15 07:39:21 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc/top_level.rb: Fixed extension trimming for page names in
- RDoc HTML output. [ruby-trunk - Bug #7673]
- * test/rdoc/test_rdoc_top_level.rb: Test for above.
-
-Mon Jan 14 23:06:41 2013 Keiju Ishitsuka <keiju@ishitsuka.com>
-
- * lib/irb/ext/save-history.rb: outputs its history to
- owner-only-readable file and change the permission of a file that
- already exists [Bug #7694]. Thanks Nobuhiro IMAI for bug reports.
-
-Mon Jan 14 17:12:48 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * enumerator.c (lazy_flat_map_func): flat_map should call each only
- when the value of a block returns a forcable object.
- [ruby-core:51401] [Bug #7690]
-
- * enumerator.c (lazy_flat_map): add documentation.
-
- * test/ruby/test_lazy_enumerator.rb: related test.
-
-Mon Jan 14 16:42:28 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * enumerator.c: Require block for Lazy#{take|drop}_while [Bug #7692]
-
-Mon Jan 14 14:41:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.c (BigDecimal_to_s): use CRuby style.
-
-Mon Jan 14 14:39:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.c: use `RB_TYPE_P(x, t)` instead of
- `TYPE(x) == t`.
-
-Mon Jan 14 10:18:56 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * enumerator.c: Fix size for Enumerator::Lazy#flat_map
-
-Mon Jan 14 07:12:52 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/matrix/lup_decomposition: Fix bugs with LUP Decomposition of
- rectangular matrices. [rubyspec:ba849801a85]
-
-Mon Jan 14 06:46:53 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * regparse.c (add_ctype_to_cc): don't check dup warn on adding
- negative ctype to cclass. [Bug #7471] [ruby-core:50344]
-
-Mon Jan 14 06:06:03 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/matrix/eigenvalue_decomposition: Backport bugfix of Jama 1.0.3
- [rubyspec:df87040be371]
-
-Sun Jan 13 16:45:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/psych/yaml/scanner.c: Fix typos, patch by James Dabbs
- [Github tenderlove/psych#118]
-
-Sun Jan 13 15:00:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.c (BigDecimal_sub):
- need to specify precision for converting Rational and Float.
- [ruby-dev:46544] [Bug #7404]
-
- * ext/bigdecimal/bigdecimal.c (BigDecimal_mult): ditto.
-
- * ext/bigdecimal/bigdecimal.c (BigDecimal_divide): ditto.
-
- * ext/bigdecimal/bigdecimal.c (BigDecimal_DoDivmod): ditto.
-
- * ext/bigdecimal/bigdecimal.c (BigDecimal_divremain): ditto.
-
- * test/bigdecimal/test_bigdecimal.rb: add tests for the above fixes.
-
-Sun Jan 13 14:48:55 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/matrix/eigenvalue_decomposition: Fix eigensystem with complex
- eigenvectors. Patch by pypypy567.
- [Bug #7208] [ruby-dev:46251] [rubyspec:242f8e55bd]
-
- * lib/matrix/lup_decomposition.rb: Fix error for rectangular matrices
- [bug#7620] [ruby-core:51118] [rubyspec:41f833ee2]
-
-Sun Jan 13 14:06:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/irb.rb, lib/prime.rb: Typos in overview
- Patch by Ershad K [Github Fixes #234]
-
-Sun Jan 13 13:40:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/open3.rb : Typo in Open3 overview. Patch by zed_0xff
- [Github Fixes #233]
-
-Sat Jan 12 17:42:00 2013 Kenta Murata <mrkn@cookpad.com>
-
- * numeric.c (do_coerce): fix for the exceptions which the coerce
- method raises. The optimization done by r38756 is preserved.
- [Bug #7645] [ruby-core:51213]
-
-Sat Jan 12 16:12:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/setup.mak (-runtime-): see msvcrt from link header on mswin
- instead of running testing executable file, for cross compiling.
-
-Sat Jan 12 08:58:47 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/to_ruby.rb: merge key values that
- contain something besides a hash should be left in tact.
-
- * test/psych/test_merge_keys.rb: test for change
-
-Sat Jan 12 07:52:47 2013 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * ext/win32ole/win32ole.c (ole_set_byref): support VT_UI8|VT_BYREF,
- VT_I8|VT_BYREF in cygwin and mingw.
-
- * ext/win32ole/win32ole.c (ole_variant2val): ditto.
-
- * test/win32ole/test_win32ole_variant.rb (test_s_new_with_i8_byref):
- ditto.
-
- * test/win32ole/test_win32ole_variant.rb (test_s_new_with_ui8_byref):
- ditto.
-
-Sat Jan 12 02:45:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * man/ruby.1 (options): include --*-encoding from r38784
-
-Fri Jan 11 23:34:48 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * ruby.c (usage): sort --*-encoding in help. (same order of -E)
-
-Fri Jan 11 16:56:29 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * tool/mkconfig.rb: use configured libdir value to fix
- --enable-load-relative on systems where libdir is not default value,
- overridden in config.site files. [ruby-core:47267] [Bug #6903]
-
-Fri Jan 11 11:59:32 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * string.c (dispose_string): use rb_str_free for freeing string in
- parse.y. by Sokolov Yura <funny.falcon@gmail.com>
- https://github.com/ruby/ruby/pull/87 fix GH-87
-
-Fri Jan 11 09:56:22 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * insns.def (defineclass): private constants should not be accessed
- by scoped module definitions. The bug was introduced in r38495.
-
- * test/ruby/test_module.rb: related test.
-
-Fri Jan 11 02:11:59 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * lib/rbconfig/obsolete.rb (respond_to_missing?): use send because
- RbConfig.respond_to_missing? is now private.
-
-Thu Jan 10 22:00:58 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_core.h (VM_DEBUG_BP_CHECK): set 0 as default.
- This flag specifies checking BP consistency on each frame popping.
- Now, we don't have any trouble on it, so I remove it.
- If you feel any bugs about VM execution, then set it to 1.
-
-Thu Jan 10 21:03:05 2013 TAKANO `takano32' Mitsuhiro <tak@no32.tk>
-
- * cont.c: define FIBER_USE_NATIVE as 0 in ia64.
-
-Thu Jan 10 19:39:05 2013 TAKANO `takano32' Mitsuhiro <tak@no32.tk>
-
- * thread.c: fix RB_GC_SAVE_MACHINE_REGISTER_STACK define for ia64.
-
-Thu Jan 10 17:45:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * Makefile.in, win32/Makefile.sub ($(MKFILES)): continue if Makefile
- unchanged.
-
-Thu Jan 10 16:31:20 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * vm_insnhelper.c (vm_search_super_method): raise a TypeError
- instead of a NotImplementedError if self is not an instance of the
- current class. [ruby-dev:39772] [Bug #2402]
-
-Thu Jan 10 16:47:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/tk/extconf.rb (find_tcltk_header): use have_header instead of
- try_cpp, which is incredibly slow with VC.
-
-Thu Jan 10 15:55:28 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * numeric.c (do_coerce): remove an unused variable.
-
-Thu Jan 10 15:35:55 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * tool/gen_dummy_probes.rb: remove comments in probes.d to fix the
- compilation error introduced by r38755.
-
-Thu Jan 10 11:15:04 2013 Kenta Murata <mrkn@cookpad.com>
-
- * numeric.c (do_coerce): speed optimization by using rb_check_funcall
- instead of rb_rescue + rb_funcall.
- This fix is based on the patch by Benoit Daloze.
- [Bug #7645] [ruby-core:51213]
-
-Thu Jan 10 11:15:04 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * probes.d: updating probes to be more symmetrical, adding
- documentation.
-
- * load.c: ditto
-
-Thu Jan 10 04:23:07 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/scalar_scanner.rb: strip trailing dots from
- floats so that Float() will not raise an exception.
-
- * test/psych/test_numeric.rb: test to ensure "1." can be loaded
-
- * test/psych/test_string.rb: make sure "1." can round trip
-
-Thu Jan 10 03:38:40 2013 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/yaml_tree.rb: ascii only binary strings
- will be dumped as unicode. Thanks Paul Kunysch!
-
- * test/psych/test_string.rb: appropriate test
-
-Thu Jan 10 03:29:55 2013 Koichi Sasada <ko1@atdot.net>
-
- * compile.c (compile_array_): modify wrong optimization.
- A script "[print(1)]; print(2)" should output "12".
- However, the compiler had eliminated "[print(1)]" expression
- because it is void expression (unused array).
- Of course, side-effect should be remained.
- This issue is reported by Masaya Tarui.
-
- * bootstraptest/test_literal.rb: add a test.
-
-Wed Jan 9 22:07:42 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * load.c (load_lock): if thread shield is destroyed and there is no
- waiting thread, insert new thread shield into load_table.
- [Bug #7530] [ruby-core:50645]
-
-Wed Jan 9 21:43:32 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * load.c (load_lock): revert r38744. it should acquire new thread
- shield.
-
-Wed Jan 9 15:40:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm.c (th_init, ruby_thread_init): initialize root_svar with Qnil,
- since lep_svar_place() expects uninitialized svar to be nil, not 0.
-
-Wed Jan 9 13:20:23 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * test/ruby/test_require.rb: improve test for r38744.
- fix to use Tempfile instead of temporary file in current directory.
- the patch is from nobu (Nobuyoshi Nakada).
-
-Wed Jan 9 09:53:23 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * load.c (load_lock): fix not to delete thread shield twice.
- it may break the shield locked by another thread.
- [Bug #7530] [ruby-core:50645]
-
- * test/ruby/test_require.rb: a test for above.
-
-Wed Jan 9 02:13:22 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/ruby.h (RBasic): to be aligned on a VALUE size
- boundary. [Bug #7647]
-
-Tue Jan 8 14:41:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_core.h (rb_iseq_t): move flip_cnt from struct iseq_compile_data,
- because it has same life span as enclosing iseq. [Bug #7671]
- [ruby-core:51296]
-
-Mon Jan 7 23:43:00 2013 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.c (rmpd_power_by_big_decimal):
- add RB_GC_GUARD to prevent the intermediate object is GCed too early.
- This patch was made by Yusuke Endoh. [Bug #7044] [ruby-core:47632]
-
- * test/bigdecimal/test_bigdecimal.rb: add a reproduction test for
- the issue [Bug #7044]
-
-Mon Jan 7 21:40:36 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * vm_method.c (Init_eval_method): main.public and main.private
- should be private.
-
- * proc.c (Init_Proc): main.define_method should be private.
-
- * test/ruby/test_module.rb: related test.
-
-Mon Jan 7 20:48:47 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * eval.c (Init_eval): main.include should be private.
- [ruby-core:51293] [Bug #7670]
-
- * test/ruby/test_module.rb (test_top_include_is_private): a new test
- for the above change.
-
-Mon Jan 7 20:29:50 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * NEWS: remove description about `require "refinement"'.
-
-Mon Jan 7 20:15:49 2013 Shugo Maeda <shugo@ruby-lang.org>
-
- * eval.c (Init_eval): enable Refinements by default.
- [ruby-core:51286] [Bug #7667]
-
- * eval.c (rb_mod_refine, top_using): show a warning when
- Module#refine or main.using is called at the first time.
-
- * ext/refinement/*: removed the extension library "refinement".
-
- * test/ruby/test_refinement.rb: fix for the above changes.
-
-Mon Jan 7 17:34:22 2013 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h (RUBY_EVENT_SPECIFIED_LINE): make it special.
- This flag is not contained by RUBY_EVENT_TRACEPOINT_ALL.
- This event is experimental one. It is possible to remove/rename
- flag name after 2.0.1.
-
- * vm_trace.c (get_event_id): return :line if SPECIFIED_LINE was
- occurred. `:specified_line' never been returned.
-
-Mon Jan 7 15:42:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (f_kwrest): allow bare kwrest_mark as valid syntax. its
- semantics is still undefined. [Bug #7662] [ruby-core:51269]
-
-Mon Jan 7 15:31:58 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (f_kwrest): reject duplicated kwrest argument name.
-
-Mon Jan 7 15:24:10 2013 Koichi Sasada <ko1@atdot.net>
-
- * vm_trace.c (rb_threadptr_exec_event_hooks_orig): pop tag before
- JUMP_TAG() if frame is `finish' frame.
- Without this patch, there is an inconsistency between control
- frame stack and tags stack.
- [Bug #7668]
-
- * test/ruby/test_settracefunc.rb: add a test for above.
-
-Mon Jan 7 15:21:48 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * Makefile.in, common.mk (fake, yes-fake, no-make): these dependencies
- are not platform dependent.
-
- * win32/Makefile.sub ($(arch)-fake.rb): workaround.
-
-Mon Jan 7 12:09:24 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_insnhelper.c (vm_callee_setup_arg_complex, vm_yield_setup_block_args):
- set keyrest hash after making rest array, so that the last element
- will not be overwritten. [ruby-core:51278] [Bug #7665]
-
-Mon Jan 7 09:37:24 2013 Koichi Sasada <ko1@atdot.net>
-
- * NEWS: add a NEWS entry about RubyVM.
-
-Sun Jan 6 19:06:57 2013 Yuki Yugui Sonoda <yugui@yugui.jp>
-
- * win32/Makefile.sub: Fix build with VC.
- Patch by Charlie Savage. Fixes [ruby-core:51261]
-
-Sun Jan 6 18:43:48 2013 Yuki Yugui Sonoda <yugui@yugui.jp>
-
- * bootstraptest/test_io.rb: add a test for [ruby-dev:46834].
-
- * io.c (rb_cloexec_fcntl_dupfd) Use an emulation with dup(2) when
- fcntl(2) and/or F_DUPFD is unavailable.
- Suggested by akr.
-
- * configure.in (HAVE_FCNTL): NativeClient does not provide fcntl(2).
-
-Sun Jan 6 11:11:26 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/modules_and_classes.rdoc: Fixed typo.
-
-Sun Jan 6 05:35:18 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/modules_and_classes.rdoc: Added singleton classes
- documentation.
-
-Sun Jan 6 02:22:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/webrick/httpservlet/abstract.rb (WEBrick::HTTPServlet): Typo in
- example. Patch by shlensky [Fixes #232 on github]
-
-Sat Jan 5 21:15:10 2013 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/net/http/generic_request.rb:
- Amazon ECA API and GTE/1.3 disallow requests whose host has port
- number if its port number equals to default port number of the
- scheme. [Bug #7650]
-
-Sat Jan 5 13:58:59 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/modules_and_classes.rdoc: Improved description of methods
- on a module or class as suggested by Tobias Buhlmann
-
-Sat Jan 5 13:38:07 2013 Masaki Matsushita <glass.saga@gmail.com>
-
- * string.c (rb_str_enumerate_lines): fix invalid byte sequence error
- when a separator is passed. The patch is from yoshidam (Yoshida
- Masato).
- [Bug #7646] [ruby-dev:46827]
-
- * test/ruby/test_string.rb: a test for above.
-
-Sat Jan 5 12:25:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/ruby/envutil.rb (Test::Unit::Assertions#assert_in_out_err):
- check stdout and stderr both.
-
-Sat Jan 5 10:21:54 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/modules_and_classes.rdoc: Added documentation of syntax
- for Modules and Classes.
- * doc/syntax/methods.rdoc: Moved some text to the Modules and
- Classes syntax document.
-
-Sat Jan 5 08:38:27 2013 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/methods.rdoc: Added return values and scope sections,
- slightly modified from the original patch. Fixes #227 from github by
- Dave Brown.
-
-Sat Jan 5 08:21:41 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * io.c (rb_cloexec_fcntl_dupfd): improve #ifdef condition.
- * io.c (rb_maygvl_fd_fix_cloexec): ditto.
-
-Sat Jan 5 07:54:59 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/cleanup_command.rb: Clean all possible gems
- using multiple passes. Fixes RubyGems bug #422. Refactored for
- maintainability.
- * test/rubygems/test_gem_commands_cleanup_command.rb: Test for above.
-
-Sat Jan 5 05:04:39 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * gc.c (vm_xrealloc): add a few comment why we avoid realloc(ptr,0).
-
-Fri Jan 4 20:17:06 2013 Yuki Yugui Sonoda <yugui@yugui.jp>
-
- * Makefile.in (RBCONFIG): Moved from common.mk in order to use the
- variable in Makefile.in.
-
- * win32/Makefile.sub (RBCONFIG): Ditto.
-
-Fri Jan 4 19:45:50 2013 Yuki Yugui Sonoda <yugui@yugui.jp>
-
- * common.mk (run, parse): Use BTESTRUBY instead of MINIRUBY to handle
- cross-compiling cases, e.g. NativeClient.
-
-Fri Jan 4 17:58:16 2013 Yuki Yugui Sonoda <yugui@yugui.jp>
-
- * common.mk (yes-btest): btest depends on also $(arch)-fake.rb and
- rbconfig.rb on building for NativeClient.
-
- * Makefile.in (fake): Avoid generating $(arch)-fake.rb unless cross
- compiling.
-
- * configure.in (CROSS_COMPILING): New substitution.
-
-Fri Jan 4 16:26:45 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/doctor.rb: Process directories in order in case the
- filesystem doesn't. [ruby-trunk - Bug #7618]
-
- Process specifications before other directories in case of bugs.
- * test/rubygems/test_gem_doctor.rb: Test for above.
-
- * lib/rubygems.rb: Updated version.
-
- * test/rubygems/test_require.rb: Fixed double require of
- benchmark.rb. RubyGems bug #420.
-
- * test/rubygems/test_gem_commands_check_command.rb: Fixed unused
- variable warnings.
- * test/rubygems/test_gem_commands_query_command.rb: ditto
- * test/rubygems/test_gem_installer.rb: ditto
-
-Fri Jan 4 15:05:25 2013 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc/cross_reference.rb: Fixed matching of C#=== or #===. RDoc
- bug #164
- * test/rdoc/test_rdoc_cross_reference.rb: Test for above.
-
- * lib/rdoc/parser/changelog.rb: Fixed parsing of dates. RDoc bug #165
- * test/rdoc/test_rdoc_parser_changelog.rb: Test for above.
-
- * lib/rdoc/parser.rb: Fixed parsing multibyte files with incomplete
- characters at byte 1024. [ruby-trunk - Bug #6393]
- Fixed handling of -E. [ruby-trunk - Bug #6392]
- * test/rdoc/test_rdoc_options.rb: Test for above.
- * test/rdoc/test_rdoc_parser.rb: ditto.
- * test/rdoc/test_rdoc_parser_c.rb: ditto.
- * test/rdoc/test_rdoc_parser_changelog.rb: ditto.
- * test/rdoc/test_rdoc_parser_markdown.rb: ditto.
- * test/rdoc/test_rdoc_parser_rd.rb: ditto.
- * test/rdoc/test_rdoc_rdoc.rb: ditto.
-
- * lib/rdoc/tom_doc.rb: Fixed parsing of [] in TomDoc arguments list.
- RDoc bug #167
- * test/rdoc/test_rdoc_tom_doc.rb: Test for above.
-
- * lib/rdoc.rb: Update version.
-
-Fri Jan 4 11:51:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/forwardable.rb: Fix rdoc parameters for ::def_single_delegator.
- Patch by Vladimir Andrijevik [Github Fixes #230]
-
-Fri Jan 4 00:35:11 2013 Yuki Yugui Sonoda <yugui@yugui.jp>
-
- Fix failures on btest for NativeClient.
- * bootstraptest/runner.rb (nacl?): New method to distinguish NaCl
- cross build.
-
- * bootstraptest/test_io.rb: Skip unsupported operations.
-
- * bootstraptest/test_literal.rb: ditto.
-
-Fri Jan 4 00:29:40 2013 Yuki Yugui Sonoda <yugui@yugui.jp>
-
- * io.c (rb_cloexec_fcntl_dupfd): Fix failures in
- bootstrap_test/test_io.rb. NativeClient does not support F_DUPFD
- but supports dup2(2).
-
-Thu Jan 3 17:46:50 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/element.rb (REXML::Elements#add): Remove too much
- "elements" in document. Sorry...
-
-Thu Jan 3 17:42:32 2013 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/element.rb (REXML::Elements#each): Add missing
- "elements" in document. [ruby-talk:402713]
- Reported by Wesley Rishel. Thanks!!!
-
-Thu Jan 3 15:13:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/psych/lib/psych.rb (Psych.load): Return value of
- Psych::SyntaxError.message should be same as example.
- Patch by Ippei Obayashi [ruby-core:51193] [Bug #7636]
-
-Thu Jan 3 14:58:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/forwardable.rb (SingleForwardable): Fix example in overview
- Patch by Vladimir Andrijevik [Github Fixes #231]
-
-Thu Jan 3 14:32:47 2013 Yuki Yugui Sonoda <yugui@yugui.jp>
-
- * configure.in (OBJCOPY): Fixes build error for NativeClient.
- Avoid disabling OBJCOPY for NativeClient.
-
- * thread_pthread.c (rb_reserved_fd_p): USE_SLEEPY_TIMER_THREAD is
- always defined. Fixes compilation error for NativeClient.
-
-Wed Jan 02 03:09:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/zlib/zlib.c (Zlib::GzipReader): Fix typo by zed_0xff
- [Fixes Github #229]
-
-Wed Jan 02 02:29:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * hash.c (rb_hash_update): Revert documentation from r38672
- See: https://github.com/ruby/ruby/pull/228#issuecomment-11791013
-
-Wed Jan 02 02:16:00 2013 Zachary Scott <zachary@zacharyscott.net>
-
- * hash.c (rb_hash_update): Documentation for Hash#merge and shallow
- copies Patch by Yorick Peterse [Fixes Github #228]
-
-Mon Dec 31 15:10:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * vm_backtrace.c: Add documentation for Kernel#caller_locations,
- Kernel#caller, and Thread::Backtrace::Location
-
-Mon Dec 31 13:05:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * test/ruby/test_backtrace.rb: Add test for r37957 [Feature #7434]
-
-Sun Dec 30 23:33:36 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (simple_re_meta): escaped closing parenthesis has different
- meaning. [Bug #7610] [ruby-core:51088]
-
-Sun Dec 30 12:09:47 2012 Charlie Somerville <charlie@charliesomerville.com>
-
- * configure.in: use 4 argument form of AC_CHECK_HEADERS to force
- autoconf to use compiler's result
-
-Sun Dec 30 10:58:04 2012 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * test/ruby/test_keyword.rb: add a test for passing hash
- as a last argument. [ruby-dev:46712] [Bug #7529]
-
-Sun Dec 30 10:51:29 2012 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * vm_insnhelper.c: set keyword hash on Proc/block calls.
- [ruby-core:51172] [Bug #7630]
-
- * test/ruby/test_keyword.rb: add tests for above.
-
-Sat Dec 29 21:57:11 2012 Keiju Ishitsuka <keiju@ishitsuka.com>
-
- * lib/irb/completion.rb: treat rightly completion for symbol on irb
- [Bug #7632].
-
-Sat Dec 29 21:51:30 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * ext/curses/curses.c (window_cury, window_curx, window_maxy,
- window_maxx, window_begy, window_begx): use RB_UNUSED_VAR()
- to suppress unused-but-set-variable warnings.
-
-Sat Dec 29 16:45:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * iseq.c (RubyVM::InstructionSequence): rdoc formatting
-
-Sat Dec 29 15:28:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * iseq.c (RubyVM::InstructionSequence): Add rdoc for new iseq features
- added from r38085, this includes ::of, #path, #absolute_path,
- #label, #base_label, #first_lineno, and #inspect
-
-Sat Dec 29 14:06:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * iseq.c (rb_iseq_line_trace_all, rb_iseq_line_trace_specify): Add
- rdoc for experimental C level api of iseq, from r38076
-
-Sat Dec 29 11:37:36 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * object.c (rb_obj_clone): attach clone to its singleton class during
- cloning singleton class so that singleton_method_added will be called
- on it. based on the patch by shiba (satoshi shiba)[Bug #5283] in
- [ruby-dev:44477]. [Bug #5283]
-
-Sat Dec 29 10:10:39 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (crt_externs.h): use standard macro AC_CHECK_HEADERS.
-
-Fri Dec 28 23:12:44 2012 Charlie Somerville <charlie@charliesomerville.com>
-
- * configure.in: check for the whether crt_externs.h is present when compiling
- for darwin (this header is missing in the iOS SDK)
- * eval_intern.h: check HAVE_CRT_EXTERNS_H before including crt_externs.h, if
- not defined, include missing/crt_externs.h instead
- * hash.c: ditto
- * missing/setproctitle.c: ditto
- * missing/crt_externs.h: declare _NSGetEnviron() function and define environ
- for iOS
-
-Fri Dec 28 21:40:36 2012 Keiju Ishitsuka <keiju@ishitsuka.com>
-
- * lib/irb/context.rb: IRB::Context#new: Check from JobManager
- inside IRB namespace [Bug #7628]. Thanks rafaelfranca for bug
- report and its patch.
-
-Fri Dec 28 17:06:17 2012 Akinori MUSHA <knu@iDaemons.org>
-
- * misc/ruby-electric.el (ruby-electric-curlies): Automatically
- indent closing curly brackets when
- ruby-electric-newline-before-closing-bracket is true.
-
-Fri Dec 28 11:50:42 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_insnhelper.c (vm_yield_setup_block_args): pass single argument to
- single optional parameter unchanged without splatting. [Bug #7621]
- [ruby-dev:46801]
-
-Fri Dec 28 11:17:47 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * proc.c (method_eq): fix the documentation to refer to owner.
- [ruby-core:51105] [Bug #7613]
-
- * test/ruby/test_method.rb (test_alias_onwer): new test to confirm
- that `a == b' returns false if owners of a and b are different.
-
-Fri Dec 28 07:07:43 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * def/id.def: use split(/^/) instead of String#lines to support
- Ruby 1.8.5 as BASERUBY.
-
-Thu Dec 27 21:56:56 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * variable.c (rb_mod_remove_const): fix segv caused by r38558.
-
-Tue Dec 28 01:13:48 2012 James Edward Gray II <james@graysoftinc.com>
-
- * lib/csv.rb: Added more Hash methods to CSV::Row.
-
-Thu Dec 27 23:27:15 2012 Keiju Ishitsuka <keiju@ishitsuka.com>
-
- * lib/irb/ruby-lex.rb: make lex_state to EXPR_END when next token
- is an operator after SYMBEG [Bug #6378].
-
-Thu Dec 27 21:30:21 2012 Keiju Ishitsuka <keiju@ishitsuka.com>
-
- * lib/irb/ruby-lex.rb: allow to handle recursive heredocs on
- irb[Bug #5648].
-
-Thu Dec 27 20:45:29 2012 Masaki Matsushita <glass.saga@gmail.com>
-
- * ext/stringio/stringio.c (strio_getline): fix not to raise TypeError
- when limit is nil.
- [Bug #7232] [ruby-core:48531]
-
- * test/stringio/test_stringio.rb: a test for above.
-
-Thu Dec 27 21:08:23 2012 Charlie Somerville <charlie@charliesomerville.com>
-
- * vm_core.h (VM_DEFINECLASS_TYPE): explicit cast to enum type to avoid 64->32
- shorten warning
-
-Thu Dec 27 20:11:29 2012 Masaki Matsushita <glass.saga@gmail.com>
-
- * ext/stringio/stringio.c (strio_ungetc): raise IOError instead of RuntimeError
- if the string is frozen.
- [Bug #7231] [ruby-core:48530]
-
- * ext/stringio/stringio.c (strio_ungetbyte): ditto.
-
- * test/stringio/test_stringio.rb: a test for above.
-
-Wed Dec 26 23:55:18 2012 Keiju Ishitsuka <keiju@ishitsuka.com>
-
- * lib/irb/context.rb: fix IRB::Inspector#keys_with_inspector [Bug #7598]
-
-Wed Dec 26 23:26:15 2012 Keiju Ishitsuka <keiju@ishitsuka.com>
-
- * lib/irb/context.rb: IRB::Context#use_readline= has been obsolete
- [Bug #6339].
-
-Wed Dec 26 21:32:46 2012 Keiju Ishitsuka <keiju@ishitsuka.com>
-
- * lib/irb/context.rb: make a correct prompt from
- IRB.conf[:IRB_NAME] on irb [Bug #6338]. Patched by sho-h.
-
-Wed Dec 26 21:09:19 2012 Keiju Ishitsuka <keiju@ishitsuka.com>
-
- * lib/irb/ext/math-mode.rb: make not able to change math-mode
- after irb starting [Bug #6302]. Patched by sho-h.
-
-Wed Dec 26 12:52:36 2012 Keiju Ishitsuka <keiju@ishitsuka.com>
-
- * lib/irb/init.rb: change default debug level for
- irb[ruby-dev:46805], [Bug #6301].
-
-Wed Dec 26 11:54:11 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: enable -fPIE when checking -pie for fixing
- OpenBSD build error. Patch by George Koehler. Thank you!
- [Bug #7606] [ruby-core:51082]
-
-Wed Dec 26 07:31:24 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_enc_cr_str_copy_for_substr): empty string is always
- valid or 7bit.
-
- * string.c (rb_str_enumerate_lines, rb_str_chop): reduce duplicated
- code.
-
- * string.c (rb_str_enumerate_chars): prevent shared copy from GC.
-
-Wed Dec 26 01:31:16 2012 Keiju Ishitsuka <keiju@ishitsuka.com>
-
- * lib/irb/init.rb, lib/irb/context.rb: fix conf.debug_level=
- [Bug #6301] and fix irb command option: -- irb_debug_level for irb.
-
-Wed Dec 26 00:59:18 2012 Keiju Ishitsuka <keiju@ishitsuka.com>
-
- * lib/irb/ruby-lex.rb: improve RubyLex performance for large files
- [Bug #5202]. Patch by ryanmelt.
-
-Tue Dec 25 22:21:06 2012 Keiju Ishitsuka <keiju@ishitsuka.com>
-
- * lib/irb/output-method.rb: raise right exception when
- IRB::OutputMethod#print don't defined [Bug #6657].
-
-Tue Dec 25 22:06:33 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_trace.c (rb_threadptr_exec_event_hooks_and_pop_frame):
- pop a frame before JUMP_TAG() if exception occurred.
- This change fix bug of Ruby 1.9.
- [ruby-core:51128] [ruby-trunk - Bug #7624]
-
- * vm_core.h (EXEC_EVENT_HOOK_AND_POP_FRAME): add to use
- `rb_threadptr_exec_event_hooks_and_pop_frame()'.
-
- * vm.c (vm_exec): use EXEC_EVENT_HOOK_AND_POP_FRAME() while
- exception handling. While exception handling, if an exception
- is raised in hooks, need to pop current frame and raise this
- raised exception by hook.
-
- * test/ruby/test_settracefunc.rb: add a test.
-
-Tue Dec 25 21:08:53 2012 Keiju Ishitsuka <keiju@ishitsuka.com>
-
- * lib/irb/init.rb, lib/irb/lc/ja/error.rb, lib/irb/lc/error.rb:
- raise exception when illegal RC_NAME_GENERATOR defined [Bug #6455].
-
-Tue Dec 25 19:22:17 2012 Keiju Ishitsuka <keiju@ishitsuka.com>
-
- * lib/irb/workspace.rb: define method to private on top-level irb
- [Bug #5776]. Patch by davidbalbert.
-
-Tue Dec 25 19:09:51 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * bignum.c, include/ruby/intern.h (rb_big_eql): exported.
-
- * thread.c (recursive_check): object_id maybe a Bignum, not Fixnum on
- LLP64. see also r38493 and r38548.
- reported by Heesob Park at [ruby-core:51083] [Bug #7607], and patched
- by shirosaki at [ruby-core:51095]
-
-Tue Dec 25 18:53:35 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_core.h, eval_intern.h (CHECK_STACK_OVERFLOW): move
- CHECK_STACK_OVERFLOW() to vm_core.h and rename to
- CHECK_VM_STACK_OVERFLOW().
- This change is only move and rename.
-
- * tool/instruction.rb: catch up above changes.
-
- * vm.c, vm_insnhelper.c: ditto.
-
- * vm_insnhelper.c (vm_stackoverflow): add a function to unify
- raising vm stackoverflow exception.
-
-Tue Dec 25 16:16:54 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_core.h (RUBY_VM_THREAD_VM_STACK_SIZE): change default
- VM stack size (128 KB or 256 KB -> 512 KB or 1024 KB).
- This re-sizing corrects smaller value introduced at r38478.
- Newer value is same VM stack size of Ruby 1.9.
- [ruby-dev:46797] [ruby-trunk - Bug #7603]
-
-Tue Dec 25 13:38:12 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * error.c (compile_err_append, compile_warn_print, warn_print): use
- rb_write_error_str() instead of writing to rb_stderr directly.
-
- * io.c (rb_write_error_str): a stopgap measure not to unblock GVL.
- warning from require seems to still have race condition errors.
-
-Tue Dec 25 00:59:29 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * node.h (NODE_OP_CDECL), compile.c (iseq_compile_each),
- parse.y (stmt, arg): allow scoped constant op-assignment.
- [ruby-core:40154] [Bug #5449]
-
-Mon Dec 24 04:56:48 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/net/http/generic_request.rb (Net::HTTPGenericRequest):
- set content-length to zero on empty post requests
- by Gregory Ostermayr <gregory.ostermayr@gmail.com>
- https://github.com/ruby/ruby/pull/201 fix GH-201
-
-Sun Dec 23 19:09:16 2012 Koichi Sasada <ko1@atdot.net>
-
- * thread.c: rename methods:
- from Thread.async_interrupt_timing to Thread.handle_interrupt,
- from Thread.async_interrupted? to Thread.pending_interrupt?.
- Also rename option from `defer' to `never'.
- [ruby-core:51074] [ruby-trunk - Feature #6762]
-
- * vm_core.c, thread.c: rename functions and data structure
- `async_errinfo' to `pending_interrupt'.
-
- * thread.c: add global variables sym_immediate, sym_on_blocking and
- sym_never.
-
- * cont.c, process.c, vm.c, signal.c: ditto.
-
- * lib/sync.rb, lib/thread.rb: catch up this renaming.
-
- * test/ruby/test_thread.rb: ditto.
-
-Sun Dec 23 17:57:30 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/profiler.rb (Profiler__::PROFILE_PROC, print_profile): store
- profile data per threads for concurrent-execution.
- [ruby-core:22046] [Bug #1152]
-
- * lib/profiler.rb (Profiler__::Wrapper): support calling singleton
- methods of an instance of BasicObject.
-
- * lib/profiler.rb (Profiler__::PROFILE_PROC): use TracePoint.
-
-Sun Dec 23 16:13:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/erb.rb: typos for ERB::new link
-
-Sun Dec 23 16:06:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/erb.rb: Document ERB::new trim_mode '-' for lines ending in -%>
- [ruby-core:51084] [Bug #7608]
-
-Sun Dec 23 15:25:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/irb/ruby-lex.rb: Add handling for %i and %I quoting to irb
- Patch by flori [ruby-core:49550] [Bug #7392] [Github Issue #157]
-
-Sun Dec 23 15:05:48 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_eval.c (rb_check_funcall_with_hook): rb_check_funcall with hook
- which is called before calling method_missing or target method.
-
- * marshal.c (w_object, r_object0): use rb_check_funcall_with_hook
- instead of respond_to? and call.
-
-Sun Dec 23 14:52:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * re.c (rb_reg_eqq): doc: #=== is not a synonym for #=~, added example
- [ruby-dev:46746] [Bug #7571]
-
-Sun Dec 23 14:35:13 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * thread.c (BLOCKING_REGION): if fail_if_interrupted is false ignore
- the result of blocking_region_begin(), since it always is true in
- that case. suppress "uninitialized" warnings.
-
-Sun Dec 23 09:34:07 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/check_command.rb: Added --doctor and --dry-run
- options to clean up after failed uninstallation.
- * test/rubygems/test_gem_commands_check_command.rb: Test for above.
-
- * lib/rubygems/commands/push_command.rb: Allow pushes from RubyGems
- 2.0.0.preview3
-
- * lib/rubygems/commands/update_command.rb: Use Gem.ruby_version
-
- * lib/rubygems/dependency.rb: Update style.
-
- * lib/rubygems/installer.rb: Ensure installed gem specifications will
- be useable. Refactor.
- * test/rubygems/test_gem_installer.rb: ditto.
-
- * lib/rubygems/validator.rb: Fixed bug with unreadable files.
-
- * lib/rubygems.rb: Fixed broken methods.
- * test/rubygems/test_gem.rb: Test for above.
-
- * test/rubygems/test_gem_commands_push_command.rb: Fixed overridden
- Gem.latest_rubygems_version
-
-Sun Dec 23 01:52:01 2012 Akinori MUSHA <knu@iDaemons.org>
-
- * io.c (rb_io_lines, rb_io_bytes, rb_io_chars, rb_io_codepoints):
- Deprecate IO#{lines,bytes,chars,codepoints} and those of ARGF.
- [Feature #6670]
-
- * ext/stringio/stringio.c (strio_lines, strio_bytes, strio_chars)
- (strio_codepoints): Deprecate
- StringIO#{lines,bytes,chars,codepoints}. [Feature #6670]
-
- * ext/zlib/zlib.c (rb_gzreader_lines, rb_gzreader_bytes):
- Deprecate Zlib::GzipReader#{lines,bytes}. [Feature #6670]
-
-Sat Dec 23 01:35:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/optparse.rb: Documentation for OptionParser to remove 'shadowed
- outer local variable' from example and make obvious ARGV with
- non-option arguments.
- Patch by Marcus Stollsteimer [ruby-core:47460] [Bug #6997]
-
-Sat Dec 23 00:08:00 2012 Kenta Murata <mrkn@mrkn.jp>
-
- * include/ruby/intern.h: add the prototype declaration of
- rb_num_coerce_bit.
-
- * numeric.c (rb_num_coerce_bit): the new coerce function for bitwise
- binary operation.
-
- * bignum.c (rb_big_and): use coerce to convert the argument, which isn't
- a Fixnum nor a Bignum, to the corresponding Integer object so that
- bitwise operations can support Integer-mimic objects.
- [Bug #1792] [ruby-core:39491]
-
- * bignum.c (rb_big_or): ditto.
-
- * bignum.c (rb_big_xor): ditto.
-
- * numeric.c (bit_coerce): ditto.
-
- * numeric.c (fix_and): ditto.
-
- * numeric.c (fix_or): ditto.
-
- * numeric.c (fix_xor): ditto.
-
- * test/ruby/test_integer.rb: add tests for the above changes.
-
- * test/ruby/test_bignum.rb: ditto.
-
-Sun Dec 23 00:04:54 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * internal.h (QUOTE, QUOTE_ID): quote unprintable chars in strings and
- IDs. [Bug #7574] [ruby-dev:46749]
-
- * string.c (rb_str_quote_unprintable): ditto.
-
-Sat Dec 22 23:59:18 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * error.c (rb_compile_error, rb_compile_warn, rb_compile_warning),
- (rb_warn, rb_warning): support PRIsVALUE.
-
-Sat Dec 22 22:04:58 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
- * cont.c (rb_fiber_start): unify conditions.
-
-Sat Dec 22 21:47:55 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * io.c (rb_io_wait_writable): use rb_thread_check_ints() instead
- of rb_thread_fd_writable().
- * io.c (rb_io_wait_readable): ditto.
-
-Sat Dec 22 20:31:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * object.c (rb_mod_const_get): symbol cannot be nested constant name.
-
-Sat Dec 22 19:26:35 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * object.c (rb_mod_const_get): check more strictly. [ruby-dev:46748]
- [Bug #7573]
-
-Wed Dec 19 02:34:48 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
- * cont.c (rb_fiber_start): in case of jump with TAG_FATAL,
- enqueue error into async_errinfo_queue, because you cannot call
- TH_TAG_JUMP() in this function. [ruby-dev:45218] [Bug #5993]
-
- * thread.c (rb_threadptr_execute_interrupts): now INT2FIX(TAG_FATAL)
- can be popped from async_errinfo_queue.
-
- * vm.c (rb_vm_make_jump_tag_but_local_jump): revert r38441.
- rb_vm_make_jump_tag_but_local_jump() shouldn't return exception
- in case of state == TAG_FATAL.
-
- * test/ruby/test_fiber.rb (test_exit_in_fiber): fix a test to illuminate
- Thread.exit should terminate current Thread.
-
-Sat Dec 22 13:15:08 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * gc.c (obj_id_to_ref): add a macro to treat Bignum object id.
- This follows the change r38493.
-
- * gc.c (id2ref): fix for working fine with Bignum object id on x64
- Windows.
- * gc.c (wmap_finalize): ditto.
-
-Sat Dec 22 11:30:21 2012 Masaki Matsushita <glass.saga@gmail.com>
-
- * struct.c (make_struct): remove junk ID check to allow members who
- have junk name like "foo\000".
- * test/ruby/test_struct.rb: Test for above.
- [Bug #7575] [ruby-dev:46750]
-
-Sat Dec 22 05:34:54 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/net/http.rb: Requests may be created with a URI which sets the
- Host header. Responses contain the requested URI for easier redirect
- following. [ruby-trunk - Feature #6482]
- * lib/net/http/generic_request.rb: ditto.
- * lib/net/http/response.rb: ditto.
- * NEWS (net/http): Updated for above.
- * test/net/http/test_http.rb: Tests for above.
- * test/net/http/test_http.rb: ditto.
- * test/net/http/test_httpresponse.rb: ditto.
-
-Sat Dec 22 02:35:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/irb/slex.rb(#match): Typo, should be D_DETAIL
- [ruby-core:51071] [Bug#7600]
-
-Sat Dec 22 02:29:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/irb/input-method.rb, lib/irb.rb: Typo in
- InputMethod#readable_atfer_eof? to #readable_after_eof?
- [ruby-core:51069] [Bug #7599]
-
-Sat Dec 22 02:19:38 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * vm_dump.c (rb_vm_bugreport): revert r38533.
- * addr2line.c (fill_lines): add ELF sanity check.
- [Bug #7597] [ruby-dev:46786]
-
-Sat Dec 22 02:05:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/irb/inspector.rb, lib/irb/context.rb: Move IRB::INSPECTORS and
- class methods to IRB::Inspector [ruby-core:51067][Bug #7598]
-
-Sat Dec 22 00:28:46 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * object.c (rb_obj_hash): shouldn't assume object_id can be long.
- based on a patch by Heesob Park at [ruby-core:51060].
- cf. [Backport #7454]
-
-Fri Dec 21 23:15:25 2012 Kouhei Sutou <kou@cozmixng.org>
-
- * ext/fiddle/lib/fiddle/struct.rb (Fiddle::CStructEntity#set_ctypes):
- CPtr -> Pointer.
- * test/fiddle/test_c_struct_entry.rb
- (Fiddle::TestCStructEntity#test_aref_pointer):
- Added the test for the above.
-
-Fri Dec 21 23:12:05 2012 Kouhei Sutou <kou@cozmixng.org>
-
- * ext/fiddle/lib/fiddle/struct.rb (Fiddle::CStructEntity#set_ctypes):
- CPtr -> Pointer.
- * test/fiddle/test_c_struct_entry.rb
- (Fiddle::TestCStructEntity#test_aref_pointer_array):
- Added the test for the above.
-
-Fri Dec 21 22:43:36 2012 Kouhei Sutou <kou@cozmixng.org>
-
- * ext/fiddle/lib/fiddle/import.rb (Fiddle::Importer#sizeof):
- CPtr -> Pointer.
- * test/fiddle/test_import.rb (Fiddle::TestImport#test_sizeof):
- Added the test for the above.
-
-Fri Dec 21 22:34:17 2012 Koichi Sasada <ko1@atdot.net>
-
- * test/ruby/test_iseq.rb: disable a test which checks features
- removed at r38532.
-
-Fri Dec 21 22:02:00 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/{dir.h,win32.c} (rb_w32_readdir): removed old rb_w32_readdir()
- and renamed from rb_w32_readdir_with_enc().
- [ruby-core:24864] [Feature #1927]
-
- * dir.c (READDIR): follow above change.
-
-Fri Dec 21 21:12:54 2012 Masaya Tarui <tarui@ruby-lang.org>
-
- * vm_dump.c (rb_vm_bugreport): commentout addr2line call temporarily
- in order to avoid segv. anyone can fix addr2line?
- [Bug #7597] [ruby-dev:46786]
-
-Fri Dec 21 20:38:28 2012 Koichi Sasada <ko1@atdot.net>
-
- * iseq.c (Init_ISeq): remove definition of the following methods:
- ISeq#line_trace_all and ISeq#line_trace_specify because they are
- half baked.
- C APIs are remained as experimental. These functions will be
- renamed, removed their parameters may be changed.
- You can use these methods by C exts. Please give us your comments.
-
-Fri Dec 21 20:21:04 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_trace.c (tracepoint_new): add code to support specified thread.
- But not tested and this feature is not supported officially.
-
-Fri Dec 21 19:37:15 2012 Koichi Sasada <ko1@atdot.net>
-
- * ruby.c (process_options): need to acquire env from TOPLEVEL_BINDING
- each time.
- `bind->env' may update after `eval()'.
- [Bug #7536]
-
-Fri Dec 21 18:46:50 2012 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/debug.h, vm_core.h: define rb_trace_arg_t at
- include/ruby/debug.h (move from vm_core.h).
-
-Fri Dec 21 17:48:15 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_core.h, vm_trace.c: fix multi-threading bug for tracing.
- Move `trace_arg' from rb_tp_t::trace_arg to rb_thread_t::trace_arg.
- `trace_arg' may changed by multiple threads.
- rb_thread_t::trace_arg can represent rb_thread_t::trace_running
- (null or non-null) and rb_thread_t::trace_running is removed.
- After that, `rb_tp_t' is not needed to check tracing or not
- (A running thread knows tracing or not). This is why I remove
- tp_attr_check_active() and make new function get_trace_arg().
-
- And this modification disable to work the following code:
- TracePoint.trace{|tp|
- Thread.new{p tp.event} # access `tp' from other threads.
- }
- I believe nobody mix threads at trace procedure.
- This is current limitation.
- [Bug #7590]
-
- * cont.c (fiber_switch, rb_cont_call): use rb_thread_t::trace_arg
- instead of rb_thread_t::trace_running.
-
- * test/ruby/test_settracefunc.rb: add a multi-threading test.
-
-Fri Dec 21 16:38:08 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * template/id.h.tmpl (ID2ATTRSET): compile time constant macro for
- ID_ATTRSET.
-
- * defs/id.def (KeywordError): check duplication.
-
- * defs/id.def: support for other scope IDs,
- ID_{INSTANCE,GLOBAL,CONST,CLASS}.
-
-Fri Dec 21 14:45:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/irb.rb, lib/irb/*: Documentation for IRB
-
-Fri Dec 21 11:31:02 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/rake/*: Updated to rake 0.9.6
- * doc/rake/*: ditto
- * test/rake/*: ditto
-
-Fri Dec 21 08:56:34 2012 Masaya Tarui <tarui@ruby-lang.org>
-
- * vm_trace.c (rb_suppress_tracing): remove unused variable 'vm_tracing'
-
-Fri Dec 21 01:01:45 2012 Masaya Tarui <tarui@ruby-lang.org>
-
- * lib/irb/completion.rb (CompletionProc): support completion of
- instance variables. [ruby-dev:46710] [Bug #7520]
-
-Thu Dec 20 20:58:25 2012 Masaya Tarui <tarui@ruby-lang.org>
-
- * vm_trace.c (rb_suppress_tracing): bugfix for vm->trace_running
- counter. And if tracing is already true, vm_trace_running ops is
- skipped to control overflow.
-
-Thu Dec 20 18:29:54 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/ruby.h (RTEST, NIL_P): make bare expressions without
- outermost parentheses.
-
-Thu Dec 20 17:29:00 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * NEWS: fix the description for Refinements.
-
-Thu Dec 20 16:53:59 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * vm_core.h (rb_vm_defineclass_type_t),
- compile.c (iseq_compile_each), insns.def (defineclass): change the
- meaning of the third operand of defineclass as follows:
- lower 3bits: the type of the defineclass
- 0 = class, 1 = singleton class, 2 = module
- 4th bit: a flag represents whether the defineclass is scoped
- 0 = not scoped (e.g., class Foo)
- 1 = scoped (e.g., class Bar::Baz)
- 5th bit: a flag represents whether the superclass is specified
- 0 = not specified (e.g., class Foo)
- 1 = specified (e.g., class Bar < Foo)
- If the superclass is specified and is not a class, a TypeError
- should be raised. [ruby-dev:46747] [Bug #7572]
-
- * test/ruby/test_class.rb: related test.
-
-Thu Dec 20 16:52:37 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * NEWS: announce AEAD encryption support in the OpenSSL extension.
-
-Thu Dec 20 16:40:13 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * gc.c (nonspecial_obj_id): VALUE is not compatible with Fixnum on
- LLP64 platform, such as 64bit Windows.
- reported by Heesob Park at [ruby-core:50255] [Bug #7454], and the
- fix is suggested by akr.
-
-Thu Dec 20 16:39:04 2012 Martin Bosslet <Martin.Bosslet@gmail.com>
-
- * ext/openssl/ossl_cipher.c: fix errors for installations that do not
- feature Authenticated Encryption.
- * ext/openssl/extconf.rb: detect presence of EVP_CTRL_GCM_GET_TAG to
- determine whether Authenticated Encryption can be used.
- [Feature #6980] [ruby-core:47426]
-
-Thu Dec 20 15:55:46 2012 Martin Bosslet <Martin.Bosslet@gmail.com>
-
- * ext/openssl/ossl.c: do not use FIPS_mode_set if not available.
- * test/openssl/utils.rb: revise comment about setting FIPS mode to
- false.
- * test/openssl/test_fips.rb: remove tests that cause errors on
- ruby-ci.
- [Feature #6946] [ruby-core:47345]
-
-Thu Dec 20 15:22:59 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc/parser/ruby.rb: Ignore methods defined on constants to
- prevent modules with the names of constants from appearing in the
- documentation.
- * test/rdoc/test_rdoc_parser_ruby.rb: Test for the above.
-
-Thu Dec 20 15:00:33 2012 Martin Bosslet <Martin.Bosslet@gmail.com>
-
- * ext/openssl/ossl_cipher.c: add support for Authenticated Encryption
- with Associated Data (AEAD) for OpenSSL versions that support the
- GCM encryption mode. It's the only mode supported for now by OpenSSL
- itself. Add Cipher#authenticated? to detect whether a chosen mode
- does support Authenticated Encryption.
- * test/openssl/test_cipher.rb: add tests for Authenticated Encryption.
- [Feature #6980] [ruby-core:47426] Thank you, Stephen Touset for
- providing a patch!
-
-Thu Dec 20 12:56:53 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc/markup/to_html.rb (class RDoc): Added current heading and
- top links to headings.
- * lib/rdoc/generator/template/darkfish/rdoc.css: ditto
- * test/rdoc/test_rdoc_generator_markup.rb: Test for above
- * test/rdoc/test_rdoc_markup_to_html.rb: ditto
-
- * test/rdoc/test_rdoc_comment.rb: Removed trailing whitespace.
-
-Thu Dec 20 11:05:26 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/ruby/envutil.rb (assert_valid_syntax): move from
- test_syntax.rb.
-
- * test/ruby/envutil.rb (assert_normal_exit): validate syntax before
- running because this assertion passes even if the code fails by
- SyntaxError.
-
-Thu Dec 20 10:29:58 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * test/openssl/test_pkey_dh.rb: revert special treatment of
- FIPS-capable installations since FIPS mode is now disabled for the
- tests.
-
-Thu Dec 20 10:23:12 2012 Martin Bosslet <Martin.Bosslet@gmail.com>
-
- * ext/openssl/ossl.c: add OpenSSL.fips_mode= to allow enabling FIPS
- mode manually.
- * test/openssl/utils.rb: turn off FIPS mode for tests. This prevents
- OpenSSL installations with FIPS mode enabled by default from raising
- FIPS-related errors during the tests.
- * test/openssl/test_fips.rb: add tests for FIPS-capable OpenSSL
- installations.
- [Feature #6946] [ruby-core:47345]
-
-Thu Dec 20 06:59:52 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm.c: support variable VM/Machine stack sizes.
- Specified by the following environment variables:
- - RUBY_THREAD_VM_STACK_SIZE: vm stack size used at thread creation.
- default: 128KB (32bit CPU) or 256KB (64bit CPU).
- - RUBY_THREAD_MACHINE_STACK_SIZE: machine stack size used at thread
- creation. default: 512KB or 1024KB.
- - 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 256KB.
- This values are specified at launched timing. You can not change
- these values at running time.
- Environ variables are only *hints* because:
- - They are aligned to 4KB.
- - They have minimum values (depend on OSs).
- - Machine stack settings are ignored by some OSs.
- Default values especially fiber stack sizes are increased.
- This change affect Fiber's behavior:
- (1) You can run more complex program on a Fiber.
- (2) You can not make many (thousands) Fibers because of
- lack of address space (on 32bit CPU).
- If (2) bothers you,
- (a) Use 64bit CPU with big memory, or
- (b) Specify RUBY_FIBER_(VM|MACHINE)_STACK_SIZE correctly.
- You need to choose correct stack size carefully. These values
- are completely rely on systems (OS/compiler and so on).
- [Feature #4614], [Bug #7212]
-
- * vm_core.h (rb_vm_t::default_params): add to record above settings.
-
- * vm.c (RubyVM::DEFAULT_PARAMS): add new constant to see
- above setting.
-
- * thread_pthread.c: support RUBY_THREAD_MACHINE_STACK_SIZE.
-
- * cont.c: support RUBY_FIBER_(VM|MACHINE)_STACK_SIZE.
-
- * test/ruby/test_fiber.rb: add tests for above.
-
- * test/ruby/test_thread.rb: ditto.
-
-Thu Dec 20 06:25:44 2012 Koichi Sasada <ko1@atdot.net>
-
- * test/ruby/test_fiber.rb: remove a strange single quote character.
- With this character, this script exits by SyntaxError.
-
-Thu Dec 20 01:03:00 2012 Zachary Scott <zachary@zacharyscott>
-
- * ext/.document: Add missing ext modules to .document
- Patch by Ryunosuke SATO [Fixes Github #224]
-
-Wed Dec 19 23:52:16 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ruby.c (load_file_internal): use original C string as the filename
- for parser.
- reported by whiteleaf at [ruby-list:49085] [ruby-dev:46738]
- [Bug #7562]
-
-Wed Dec 19 23:36:12 2012 Naohisa Goto <ngotogenome@gmail.com>
-
- * marshal.c (marshal_dump, marshal_load): fix SEGV during make rdoc
- and test failure in TestMarshal#test_gc and test_context_switch
- on SPARC Solaris 10 compiled with Oracle Solaris Studio 12.3.
- [Bug #7591] [ruby-dev:46772]
-
-Wed Dec 19 19:34:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * object.c (rb_mod_const_get): nul byte is invalid as constant name.
-
-Wed Dec 19 17:54:18 2012 Masaya Tarui <tarui@ruby-lang.org>
-
- * vm_trace.c (rb_threadptr_exec_event_hooks): get rid of race
- condition. [Bug #7589] [ruby-dev:46763]
-
-Wed Dec 19 16:30:28 2012 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/literals.rdoc: Added 0d decimal format. Thanks Nobu!
-
-Wed Dec 19 16:19:36 2012 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/methods.rdoc: Fixed typo. Thanks to Josh Susser.
-
-Wed Dec 19 16:18:22 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/query_command.rb: Refactored to improve
- maintainability.
- * test/rubygems/test_gem_commands_query_command.rb: Note default gems
- in gem list details.
-
- * lib/rubygems/uninstaller.rb: Detect all gems for uninstallation.
- This allows duplicate installs of default gems to be removed.
- * lib/rubygems/specification.rb: Allow use of ::each_spec.
- * lib/rubygems/test_case.rb: Added install_default_gems.
- * test/rubygems/test_gem_commands_uninstall_command.rb: Moved test
- down to the uninstaller tests.
- * test/rubygems/test_gem_uninstaller.rb: Test for uninstallation of
- default gems and duplicate default gems.
-
-Wed Dec 19 15:23:50 2012 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/methods.rdoc: Add () around keyword arguments example for
- consistency. Thanks to Josh Susser.
-
-Wed Dec 19 01:51:24 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
- * vm.c (rb_vm_jump_tag_but_local_jump): remove unnecessary 2nd
- argument.
-
- * load.c (rb_load_internal): ditto.
-
- * eval_intern.h (rb_vm_jump_tag_but_local_jump): ditto.
-
-Tue Dec 18 18:57:58 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * io.c (rb_io_wait_writable): don't use rb_thread_wait_fd()
- because it is for waiting until io readable.
-
- * io.c (rb_io_wait_writable): always use rb_thread_fd_writable()
- instead of bare rb_wait_for_single_fd(). we shouldn't ignore
- return value.
- * io.c (rb_io_wait_readable): ditto. always use rb_thread_wait_fd().
-
-Tue Dec 18 18:55:33 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (rb_thread_wait_fd_rw): fix infinite loop bug.
- rb_wait_for_single_fd() never return positive number.
-
-Tue Dec 18 17:24:40 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc/encoding.rb: Do not remove #! line from document when
- setting encoding. This allows ruby executables to be parsed as ruby
- files.
- * test/rdoc/test_rdoc_encoding.rb: Test for above.
-
- * lib/rdoc/parser.rb: Set the parser file name of ruby executables
- correctly.
- * test/rdoc/test_rdoc_parser.rb: Test for above.
-
-Tue Dec 18 16:46:15 2012 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/literals.rdoc: Used simplified heredoc example that
- doesn't include method definition. Added heredoc with backticks.
-
-Tue Dec 18 16:38:51 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc/store.rb: Work around RDoc stores from older versions of
- RDoc.
- * test/rdoc/test_rdoc_store.rb: Test for above.
-
-Tue Dec 18 16:31:20 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc/ruby_lex.rb: Return a TkHEREDOC instead of a TkSTRING when
- the heredoc identifier is followed by a line-end. This allows proper
- display of some HEREDOCs in source view.
- * lib/rdoc/ruby_token.rb: Added TkHEREDOC
- * test/rdoc/test_rdoc_ruby_lex.rb: Test for above.
-
-Tue Dec 18 09:45:14 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
- * vm.c (rb_vm_make_jump_tag_but_local_jump): take care of the case
- TAG_JUMP() with TAG_FATAL (ex. rb_fatal()). [ruby-core:50917]
- [Bug #7570]
-
- * test/ruby/test_fiber.rb (test_fatal_in_fiber): add a test for above.
-
- * ext/-test-/fatal/extconf.rb, ext/-test-/fatal/rb_fatal.c: ditto.
-
-Tue Dec 18 13:17:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * vm_trace.c (tracepoint_attr_defined_class): Clean up rdoc for
- TracePoint#defined_class
-
-Tue Dec 18 12:15:59 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/specification.rb: Fixed ruby output of requirements
- with multiple version specifiers.
- * test/rubygems/test_gem_ext_cmake_builder.rb: Only look for specific
- lines in cmake output. Should fix [ruby-trunk - Bug #7579]
-
-Tue Dec 18 11:45:26 2012 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/literals.rdoc: Added 0o octal integers.
-
-Tue Dec 18 12:28:52 2012 Martin Bosslet <Martin.Bosslet@gmail.com>
-
- * test/openssl/test_ssl.rb: Use :TLSv1_2_client explicitly in
- test_tls_v1_2 to prevent upstream bug.
- [Bug #7197] [ruby-dev:46240]
-
-Tue Dec 18 11:52:34 2012 Martin Bosslet <Martin.Bosslet@gmail.com>
-
- * ext/openssl/lib/ssl.rb: Enable insertion of empty fragments as a
- countermeasure for the BEAST attack by default. The default options
- of OpenSSL::SSL:SSLContext are now:
- OpenSSL::SSL::OP_ALL & ~OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS
- [Bug #5353] [ruby-core:39673]
-
- * test/openssl/test_ssl.rb: Adapt tests to new SSLContext default.
-
- * NEWS: Announce the new default.
-
-Tue Dec 18 06:36:12 2012 Koichi Sasada <ko1@atdot.net>
-
- * method.h: remove `VM_METHOD_TYPE_CFUNC_FRAMELESS' method type.
- This method type is for optimized CFUNC such as Fixnum#+ and so on.
- This feature is half-baked and no way to use them.
- [Background]
- Now, VM has opt_plus instructions to optimize `+' methods for
- some Classes (such as Fixnum, Float (flonum)). We call this
- type of instructions as `specialized instructions'.
- This simple technique improve simple program dramatically.
- However, we can make specialized instructions for only several
- types (classes) and selectors (method names) because a large
- instruction will be slow. In other words, this technique has no
- extensibility.
- To overcome this problem, VM_METHOD_TYPE_CFUNC_FRAMELESS was
- introduced (r37198). This type is a variant of CFUNC, but called
- their functions directly without building a method frame.
- Any CFUNC method can be defined as frameless methods if a method
- is not needed to make method frame. Frameless methods are faster
- as specialized instructions (a bit slower, but no need to care).
- No problem described at
- http://charlie.bz/blog/why-do-singleton-methods-make-ruby-slow
- because this technique doesn't see class, but see method body
- itself. Alias is also no problem.
- [Problem]
- However, we can't set frameless method type for polymorphic methods
- such as Array#[]. Necessity for method frame depends on which
- parameter type. For example, Fixnum#+ needs method frame if
- coerce is needed. Current VM_METHOD_TYPE_CFUNC_FRAMELESS is not
- flexible and need more tuning to introduce it.
- Expected behavior of frameless method type may be:
- result = optimized_cfunc(params); /* call optimized cfunc */
- if (result == Qundef) { result = normal_cfunc(); }
- This is why I say this feature is half-baked.
- We need to learn primitive method in Smalltalk more.
- (I heard this name at RubyConf Taiwan this month. Thanks!)
- [Conclusion]
- I remove this feature and consider again.
- This feature goes to next minor (2.1?).
- Nobody may use this feature and there is no compatibility issue.
-
- * proc.c (rb_method_entry_arity): ditto.
-
- * vm_eval.c, vm_insnhelper.c, vm_method.c: ditto.
-
-Tue Dec 18 04:58:22 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_trace.c (fill_id_and_klass): TracePoint#defined_class returns
- singleton class. `set_trace_func' passed attached class (which is
- attached/modified by singleton class) by 6th block parameter if it
- is singleton class. Previous behavior follows this spec.
- However, this method named `defined_class' should return singleton
- class directly because singleton methods are defined in singleton
- class. There are no compatible issue because TracePoint is introduced
- after 2.0.
- But compatibility with `set_trace_func' is broken. This means that
- you can not replace all `set_trace_func' code with TracePoint
- without consideration of this behavior.
- [Bug #7554]
-
- * test/ruby/test_settracefunc.rb: change a test to catch up
- an above change.
-
-Tue Dec 18 03:03:10 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/to_ruby.rb: speed up node mapping so
- common cases are evaluated first. Thanks Kevin Menard!
-
-Tue Dec 18 02:35:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/optparse.rb: Remove 'developer documentation' section from rdoc
- Patch by Marcus Stollsteimer [ruby-core:50526][Bug #7504]
-
-Tue Dec 18 02:35:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/matrix.rb (#lup): typo in example [ruby-core:50946][Bug #7582]
-
-Mon Dec 17 18:03:34 2012 Charlie Somerville <charlie@charliesomerville.com>
-
- * class.c (rewrite_cref_stack, clone_method): rewrite a method's cref
- stack when cloning into a new class to allow lexical const lookup to
- work as expected [ruby-core:47834] [Bug #7107]
- * test/ruby/test_class.rb (class TestClass): related test
-
-Mon Dec 17 13:56:55 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * io.c (io_flush_buffer_sync2): avoid to return 0. because
- rb_thread_call_without_gvl2 uses 0 internally.
- * io.c (io_flush_buffer_async2): adapt the above.
-
-Mon Dec 17 12:05:32 2012 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax/methods.rdoc: Added a description of singleton methods.
-
-Mon Dec 17 11:35:57 2012 Eric Hodel <drbrain@segment7.net>
-
- * doc/.document: Added doc/syntax
-
-Mon Dec 17 11:25:32 2012 Eric Hodel <drbrain@segment7.net>
-
- * doc/syntax.rdoc: Added syntax guide table of contents
- * doc/syntax/exceptions.rdoc: Syntax guide for exceptions
- * doc/syntax/literals.rdoc: Syntax guide for literals
- * doc/syntax/methods.rdoc: Syntax guide for methods
-
-Mon Dec 17 07:59:40 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems.rb: Updated VERSION
-
- * test/rubygems/test_gem_installer.rb: Fixed ambiguous first argument
- warning.
-
- * test/rubygems/test_gem_rdoc.rb: RDoc generation depends on installed
- version of RDoc.
-
-Sun Dec 16 02:04:41 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * signal.c (rb_sigaltstack_size): cast sysconf() return value
- explicitly. Fix compile error on Mac OS X.
-
-Sun Dec 16 00:39:43 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
- * cont.c (rb_fiber_start): don't enqueue Qnil to async_errinfo_queue.
- rb_vm_make_jump_tag_but_local_jump() could return Qnil (ex. when
- finished by Thread.exit). [ruby-dev:45218] [Bug #5993]
-
- * test/ruby/test_fiber.rb (test_exit_in_fiber): add test for it.
-
-Sat Dec 15 23:56:51 2012 Naohisa Goto <ngotogenome@gmail.com>
-
- * ext/fiddle/pointer.c (rb_fiddle_ptr2cptr): fix error message
- forgotten to be changed from DL to Fiddle.
-
-Sat Dec 15 23:14:32 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * signal.c (default_handler): remove rb_register_sigaltstack()
- call. sigaltstack was already registered when creating threads.
-
-Sat Dec 15 23:08:56 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * signal.c (rb_sigaltstack_size): new. calculate stack size for
- sigsegv handler. enlarge value when x86 or x86_64 on Linux.
- Linux has very small MINSIGSTKSZ size (2048 bytes) and
- our sigsegv routine need 5KiB at least. [Bug #7141]
- * internal.h: add declaration of rb_sigaltstack_size().
- * vm_core.h: remove ALT_STACK_SIZE definition.
-
- * signal.c (rb_register_sigaltstack): replace ALT_STACK_SIZE with
- rb_sigaltstack_size();
- * gc.c (Init_heap): ditto.
- * vm.c (th_init): ditto.
-
-Sat Dec 15 18:24:21 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * rational.c (f_round_common): should check overflow.
-
-Sat Dec 15 18:00:00 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * rational.c (float_rationalize): reduced.
-
-Sat Dec 15 14:18:44 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * io.c (finish_writeconv): uses rb_write_internal2 if
- fptr->write_lock have.
-
-Sat Dec 15 13:57:08 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (rb_mutex_owned_p): remove static.
- * io.c (io_flush_buffer): don't hold mutex if already have.
- Now recursive lock may occur when following scenario.
- fptr_finalize -> finish_writeconv_sync -> finish_writeconv
- -> io_fflush.
-
-Sat Dec 15 13:38:30 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * io.c (io_flush_buffer): uses io_flush_buffer_async2 instead of
- io_flush_buffer_async.
- * io.c (io_flush_buffer_async2): new helper function for
- io_flush_buffer. It uses rb_thread_call_without_gvl2() instead
- of rb_thread_io_blocking_region.
- * io.c (io_flush_buffer_sync2): new helper function for
- io_flush_buffer_async2.
-
-Sat Dec 15 13:04:26 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * io.c (internal_write_func2): new helper function for rb_write_internal2().
- * io.c (rb_write_internal2): new function. it uses
- rb_thread_call_without_gvl2() instead of rb_thread_io_blocking_region().
- * io.c (rb_binwrite_string): uses rb_write_internal2 instead of
- rb_write_internal. [Bug #7134]
-
-Sat Dec 15 12:55:29 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * io.c (rb_io_wait_writable): add to call rb_thread_wait_fd()
- likes rb_io_wait_readable.
-
-Sat Dec 15 11:54:50 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * io.c (rb_io_wait_writable): don't call rb_thread_fd_writable()
- when EINTR. EINTR mean signal interrupt was happen. We don't
- need any wait.
-
-Sat Dec 15 11:53:36 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (rb_thread_wait_fd_rw): remove silly rb_thread_alone()
- check.
-
-Sat Dec 15 10:22:38 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * thread.c (rb_thread_polling): revert but deprecate.
-
- * include/ruby/intern.h (rb_thread_polling): deprecate.
-
-Sat Dec 15 08:37:01 2012 Masaya Tarui <tarui@ruby-lang.org>
-
- * test/rubygems/test_gem_ext_cmake_builder.rb (test_self_build):
- get rid of false positive.
-
-Sat Dec 15 08:05:56 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/ruby/test_thread.rb (test_uninitialized, test_backtrace,
- test_thread_timer_and_interrupt, test_thread_join_in_trap,
- test_thread_join_current, test_thread_join_main_thread,
- test_main_thread_status_at_exit, test_thread_status_in_trap,
- test_thread_status_raise_after_kill, test_mutex_owned,
- test_mutex_owned2): move these tests from TestThreadGroup class
- to TestThread because they are not thread group tests.
-
- * test/ruby/test_thread.rb (test_thread_status_raise_after_kill):
- add t.join.
-
- * test/ruby/test_threadgroup.rb: new file. moved ThreadGroup test
- from test_thread.rb.
-
-Sat Dec 15 08:02:11 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/ruby/test_thread.rb (TestThread::Thread::new.): remove
- th.abort_on_exception change. Test template shouldn't change
- global flag. It prevent to test a normal case.
-
-Sat Dec 15 06:15:14 2012 Eric Hodel <drbrain@segment7.net>
-
- * configure.in (HAVE_GCC_ATOMIC_BUILTINS): Set -march=i486 to enable
- __sync_val_compare_and_swap. Patch by KOSAKI Motohiro.
- [ruby-trunk - Bug #7485]
-
-Sat Dec 15 03:42:34 2012 Naohisa Goto <ngotogenome@gmail.com>
-
- * ext/.document: add fiddle/pointer.c, fiddle/handle.c, and
- fiddle/win32/lib as documentation.
-
-Sat Dec 15 03:06:40 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * file.c (rb_file_flock): use rb_thread_wait_for() instead of
- rb_thread_polling(). When getting EAGAIN, we need to wait a
- while even if no multi threading.
- * thread.c (sleep_for_polling, rb_thread_polling) removed.
-
-Sat Dec 15 00:03:31 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * signal.c (rb_f_kill): remove rb_thread_polling() because this
- has no good effect and makes meaningless 100ms delay. 1)
- when sending signal to another process, waiting has just silly.
- 2) when sending signal to current process, 100ms is often not
- enough time to wait. It depend on kernel behavior. And,
- rb_thread_polling() doesn't make sense anyway. When rb_thread_alone()
- is true, it doesn't wait at all and Process.kill() users don't
- expect threading changes Process.kill() behavior. [Bug #7560]
-
-Fri Dec 14 17:10:57 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parser_params): parser_tokline to track the line number at
- which token started. [ruby-dev:46737] [Bug #7559]
-
- * parse.y (fcall): operation with starting line number.
-
- * parse.y (command, primary, method_call): point method name line.
-
- * parse.y (gettable_gen): return token line for __LINE__.
-
-Fri Dec 14 16:56:59 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * vm_insnhelper.c (vm_call_super_method): remove volatile introduced
- in r38365.
-
- * vm_insnhelper.c (vm_call_method): use __forceinline to prevent
- VC++ to make vm_call_general and vm_call_super_method as the same
- method. Thanks, Heesob Park. [Bug #7556] [ruby-core:50867]
-
-Fri Dec 14 14:59:14 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/ruby/envutil.rb (Test::Unit::Assertions#assert_separately):
- take file and line by using caller_locations if not given.
-
- * test/ruby/envutil.rb (Test::Unit::Assertions#assert_separately):
- count assertions in separated tests.
-
-Fri Dec 14 14:16:42 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc/rubygems_hook.rb: Fixed generation of documentation.
- Disabled rdoc generation by default to match RubyGems defaults.
- Reduced diff with RubyGems::RDoc.
- * test/rdoc/test_rdoc_rubygems_hook.rb: Tests for the above.
- * test/rubygems/test_gem_rdoc.rb: ditto.
-
- * lib/rdoc/store.rb: Removed useless variable assignment
-
-Fri Dec 14 13:58:40 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/commands/rdoc_command.rb: When overwriting
- documentation, remove existing documentation first.
-
- * lib/rubygems/server.rb: Fixed documentation links.
- * test/rubygems/test_gem_server.rb: Test for the above.
-
- * lib/rubygems/rdoc.rb: Reduced diff with RDoc::RubyGemsHook
- * test/rubygems/test_gem_rdoc.rb: ditto
-
-Fri Dec 14 04:08:05 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * test/ruby/envutil.rb (Test::Unit::Assertions#assert_separately):
- added to execute given test source on separate process,
- catch its resulted exception and raise it on main process.
-
-Fri Dec 14 07:43:44 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/yaml_tree.rb: quote strings that begin
- with non-word characters. Thanks Alex Tambellini!
- * test/psych/test_yaml.rb: appropriate test case
-
-Thu Dec 13 23:14:17 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * vm_insnhelper.c (vm_call_super_method): a workaround for the
- failure of TestRefinement#test_refine_recursion in Windows.
- See [ruby-core:50871] for details.
-
-Thu Dec 13 23:10:52 Charlie Somerville <charlie@charliesomerville.com>
-
- * object.c (Init_Object): use rb_mod_init_copy for Class#initialize_copy
- * class.c (rb_class_init_copy): rename to class_init_copy_check, performs type
- checks on arguments to prevent reinitialization of initialized class
- [ruby-core:50869] [Bug #7557]
- * class.c (rb_mod_init_copy): use class_init_copy_check if receiver is T_CLASS
- * test/ruby/test_class.rb (class TestClass): related test
-
-Thu Dec 13 16:53:10 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc/class_module.rb: Fixed duplicate comments for classes and
- modules from C.
- * test/rdoc/test_rdoc_class_module.rb: Test for the above.
-
- * lib/rdoc/parser/c.rb: Reload C variable names to allow proper
- updates of an ri store for C files.
- * lib/rdoc/rdoc.rb: ditto.
- * lib/rdoc/store.rb: ditto.
- * test/rdoc/test_rdoc_parser_c.rb: Test for the above.
- * test/rdoc/test_rdoc_store.rb: ditto.
-
-Thu Dec 13 14:20:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/irb*: merge doc from doc/irb/ird.rd and improve overall
- documentation of IRB
- * doc/irb/irb.rd: remove stale documentation
-
-Thu Dec 13 14:10:00 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * marshal.c (r_entry0): don't taint classes and modules because
- Marshal.load just returns the dumped classes and modules.
- [Bug #7325] [ruby-core:49198]
-
- * test/ruby/test_marshal.rb: related test.
-
-Thu Dec 13 14:10:13 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_require.rb (TestRequire#test_loaded_features_encoding):
- need to check compatibility, not equality of encodings.
-
-Thu Dec 13 14:02:15 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * file.c (rb_file_join): check encoding compatibility before joining
- strings.
-
-Thu Dec 13 13:06:27 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * proc.c (umethod_bind): allow another form of method transplanting
- from a module via UnboundMethod. [ruby-core:34267][Feature #4254]
-
-Thu Dec 13 12:07:25 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * include/ruby/ruby.h (RB_UNUSED_VAR): new macro to suppress
- warnings for unused variables.
-
- * ext/bigdecimal/bigdecimal.c (ENTER): use RB_UNUSED_VAR() to
- suppress annoying warnings by -Wunused-but-set-variable in gcc 4.6.
-
-Thu Dec 13 11:22:33 2012 Koichi Sasada <ko1@atdot.net>
-
- * method.h: remove "VM_METHOD_TYPE__MAX" from rb_method_type_t.
- rb_method_type_t is not a number and "_MAX" causes misunderstanding.
-
- * proc.c (rb_method_entry_arity): ditto.
-
- * vm_eval.c (vm_call0_body): ditto.
-
- * vm_insnhelper.c (vm_call_method): ditto.
-
-Wed Dec 12 21:40:45 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/tmpdir.rb (Dir::Tmpname#create): deal with a prefix name which
- starts with tilde as a plain name, not expanding as home directory.
- [ruby-core:50793] [Bug #7547]
-
-Wed Dec 12 19:48:59 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/json: merge JSON 1.7.5.
- fix tests and other fixes.
-
-Wed Dec 12 18:30:29 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * class.c (rb_prepend_module): move refined methods from the origin
- of a class to the class, because refinements should have priority
- over prepended modules.
-
- * test/ruby/test_refinement.rb: related test.
-
-Wed Dec 12 18:27:09 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * time.c (zone_str): lookup or insert by using st_update() at once.
-
-Wed Dec 12 15:30:11 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * configure.in: add -fno-omit-frame-pointer if libexecinfo is used.
- At least on FreeBSD ruby will crash on getting C backtrace
- when it is compiled with other than -O0.
-
- * vm_dump.c: enable backtrace on FreeBSD even if with optimizations.
-
-Wed Dec 12 16:08:04 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/rdoc/test_rdoc_rdoc.rb (TestRDocRDoc#test_normalized_file_list_non_file_directory):
- use File::NULL for portability if possible.
-
-Wed Dec 12 16:07:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm.c: ditto.
- * method.h (rb_method_flag_t): name a magic number for NOEX_SAFE and
- NOEX_WITH as NOEX_SAFE_SHIFT_OFFSET.
+Thu Sep 4 17:44:40 2014 Koichi Sasada <ko1@atdot.net>
- * method.h (rb_method_type_t, method_optimized_type): C89 forbids a
- comma after the last element in enum.
+ * dir.c (glob_helper): use #ifdef instead of #if.
+ gcc's -Wundef option shows warning for undefined macro.
- * proc.c (rb_method_entry_arity), vm_eval.c (vm_call0_body),
- vm_insnhelper.c (vm_call_method): add VM_METHOD_TYPE__MAX case.
+ * numeric.c (flo_is_finite_p): ditto.
-Wed Dec 12 14:16:35 2012 Eric Hodel <drbrain@segment7.net>
+ * vm_dump.c (rb_vmdebug_thread_dump_state): ditto.
- * lib/rdoc/class_module.rb: Added RDoc::ClassModule#documented? which
- checks comment_location. Hide RDoc::ClassModule#comment=.
- * test/rdoc/test_rdoc_class_module.rb: Test for above.
+ * vm_core.h: define VM_DEBUG_VERIFY_METHOD_CACHE to 0.
- * lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml:
- Fix display of the table of contents in the sidebar.
+Thu Sep 4 03:57:46 2014 Eric Wong <e@80x24.org>
- * lib/rdoc/generator/template/darkfish/table_of_contents.rhtml:
- Use #comment_location when displaying classes or modules.
+ * man/ruby.1: spelling fix ("bellow" => "below") [ci-skip]
- * test/rdoc/test_rdoc_store.rb: Use comment_location.
+Thu Sep 4 03:52:16 2014 Eric Wong <e@80x24.org>
-Wed Dec 12 13:40:52 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * man/ruby.1: add trailing slash to URLs [ci-skip]
- * vm_insnhelper.c (vm_getivar): no uninitialized instance variables
- warnings for non-object if attr method.
+Wed Sep 3 19:10:28 2014 Tanaka Akira <akr@fsij.org>
-Wed Dec 12 06:43:37 2012 Benoit Daloze <eregontp@gmail.com>
+ * process.c (before_fork_ruby): Renamed from before_fork.
+ (after_fork_ruby): Renamed from after_fork.
- * iseq.c (rb_iseq_parameters): fix limit for optional arguments.
+Wed Sep 3 18:56:05 2014 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_keyword.rb: tests for above.
+ * process.c (forked_child): Removed.
- * vm_core.h (struct rb_iseq_struct): update documentation
- with keyword arguments. [Bug #7540] [ruby-core:50735]
+Wed Sep 3 16:56:07 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Dec 12 03:45:41 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * object.c (rb_obj_copy_ivar): allocate no memory for empty
+ instance variables. [ruby-core:64700] [Bug #10191]
- * vm.c (vm_exec): pass exceptions while handling an exception.
+Wed Sep 3 12:05:17 2014 Tanaka Akira <akr@fsij.org>
- * vm_trace.c (rb_threadptr_exec_event_hooks): propagate exceptions.
- revert r38293 partially.
+ * 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.
-Wed Dec 12 03:09:05 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ 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.
- * sample/test.rb (Progress#initialize): add --verbose option and show
- messages in one line unless --verbose is given.
+Wed Sep 3 11:33:08 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Wed Dec 12 01:47:02 2012 Shugo Maeda <shugo@ruby-lang.org>
+ * 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]
- * eval.c (rb_using_refinement): make the method table of an iclass
- for a refinement that of the refinement, not that of the origin of
- the refinement, which is set by rb_include_class_new(). This
- change is needed to make module prepend into a refinement work
- properly.
+Wed Sep 3 07:50:15 2014 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_refinement.rb: related test.
+ * configure.in: Use AC_FUNC_FORK.
-Wed Dec 12 01:05:04 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * io.c: Use HAVE_WORKING_FORK instead of HAVE_FORK.
- * tool/make-snapshot: add --disable-rubygem to both MINIRUBY and RUBY.
- On making miniprelude.c, it seems use MINIRUBY. this fixes #7541
- but rubygems also needs to be fixed for older rubies.
+ * process.c: Ditto.
-Wed Dec 12 00:32:11 2012 Naohisa Goto <ngotogenome@gmail.com>
+Wed Sep 3 00:12:44 2014 Tanaka Akira <akr@fsij.org>
- * test/dl/test_func.rb (test_name_with_block, test_bind, test_qsort1):
- call unbind to release the callback closure because maximum number
- of callbacks is limited to DL::MAX_CALLBACK (== 5) with pure DL
- without Fiddle.
+ * process.c (retry_fork_async_signal_safe): Don't return on in child
+ process.
-Wed Dec 12 00:13:34 2012 Naohisa Goto <ngotogenome@gmail.com>
+Tue Sep 2 23:47:35 2014 Tanaka Akira <akr@fsij.org>
- * ext/dl/lib/dl/func.rb (DL::Function#unbind, #bound?): suppress
- NoMethodError when Fiddle is available. [ruby-core:50756] [Bug #7543]
- * test/dl/test_func.rb (test_bound*, test_unbind*): tests for the above.
+ * 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 Dec 11 19:38:37 2012 Naohisa Goto <ngotogenome@gmail.com>
+Tue Sep 2 23:26:26 2014 Tanaka Akira <akr@fsij.org>
- * ext/fiddle/function.c (Fiddle::Function.new): new keyword argument
- :name to set the name attribute.
- * ext/fiddle/lib/fiddle/import.rb (import_function, bind_function):
- set function name by using the :name keyword argument.
- Re-fixes r38243. [ruby-core:50566]
- * test/fiddle/test_function.rb (test_name): test for the :name keyword
- argument and Fiddle::Function#name.
+ * process.c (send_child_error): Simplified.
+ (recv_child_error): Ditto.
-Tue Dec 11 16:57:33 2012 Eric Hodel <drbrain@segment7.net>
+Tue Sep 2 22:56:25 2014 Tanaka Akira <akr@fsij.org>
- * common.mk: Added --pages-dir to rdoc creation. Now doc/ items show
- up at top-level.
- * .document: Moved doc/* entries to doc/.document
- * doc/.document: ditto
+ * process.c (rb_fork_async_signal_safe): Inline rb_fork_internal.
+ (rb_fork_ruby): Ditto.
+ (rb_fork_internal): Removed.
+ (chfunc_protect): Removed.
-Tue Dec 11 16:44:37 2012 Eric Hodel <drbrain@segment7.net>
+Tue Sep 2 22:43:52 2014 Tanaka Akira <akr@fsij.org>
- * lib/rdoc/options.rb: Added --page-dir option for moving pages in
- doc/ to the top-level.
- * lib/rdoc/rdoc.rb: ditto.
- * test/rdoc/test_rdoc_options.rb: Test for the above.
- * test/rdoc/test_rdoc_rdoc.rb: ditto.
+ * test/ruby/test_io.rb (test_new_with_block): Set autoclose to avoid
+ EBADF.
-Tue Dec 11 15:24:05 2012 Eric Hodel <drbrain@segment7.net>
+Tue Sep 2 22:01:51 2014 Kouhei Sutou <kou@cozmixng.org>
- * ext/pathname/lib/pathname.rb: Hide private methods from RDoc.
+ * Makefile.in (update-coverage): Remove a never executed line.
-Tue Dec 11 15:11:29 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Tue Sep 2 19:48:26 2014 Tanaka Akira <akr@fsij.org>
- * tool/make-snapshot (BASERUBY): add --disable-gem to avoid load gems.
- [Bug #7541] [ruby-core:50736]
+ * process.c (handle_fork_error): Extracted from retry_fork.
-Tue Dec 11 12:00:19 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Tue Sep 2 17:02:53 2014 Vit Ondruch <v.ondruch@tiscali.cz>
- * ext/dl/win32/extconf.rb: Fix typo
- by Santiago Pastorino <santiago@wyeworks.com>
- https://github.com/ruby/ruby/pull/221 fix GH-221
+ * tool/rbinstall.rb: fixed error of local installation.
+ [Bug #10192][ruby-core:64702]
-Tue Dec 11 01:53:37 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+Tue Sep 2 16:58:03 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * lib/matrix: alias {row|column}_size to {row|column}_count and use
- the latter.
- [Bug #7369] [ruby-core:49409]
+ * 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.
-Tue Dec 11 00:26:58 2012 Shugo Maeda <shugo@ruby-lang.org>
+Mon Sep 1 20:11:02 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * fix the behavior when a module is included into a refinement.
- This change is a little tricky, so it might be better to prohibit
- module inclusion to refinements.
+ * 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.
- * include/ruby/ruby.h (RMODULE_INCLUDED_INTO_REFINEMENT): new flag
- to represent that a module (iclass) is included into a refinement.
+Sun Aug 31 16:58:49 2014 Tanaka Akira <akr@fsij.org>
- * class.c (include_modules_at): set RMODULE_INCLUDED_INTO_REFINEMENT
- if klass is a refinement.
+ * lib/benchmark.rb: Fix a syntax error.
- * eval.c (rb_mod_refine): set the superclass of a refinement to the
- refined class for super.
+Sun Aug 31 08:46:44 2014 Eric Wong <e@80x24.org>
- * eval.c (rb_using_refinement): skip the above superclass (the
- refined class) when creating iclasses for refinements. Otherwise,
- `using Refinement1; using Refinement2' creates iclasses:
- <Refinement2> -> <RefinedClass> -> <Refinement1> -> RefinedClass,
- where <Module> is an iclass for Module, so RefinedClass is
- searched before Refinement1. The correct iclasses should be
- <Refinement2> -> <Refinement1> -> RefinedClass.
+ * ext/zlib/zlib.c (gzfile_reset): preserve ZSTREAM_FLAG_GZFILE
+ [Bug #10101]
- * vm_insnhelper.c (vm_search_normal_superclass): if klass is an
- iclass for a refinement, use the refinement's superclass instead
- of the iclass's superclass. Otherwise, multiple refinements are
- searched by super. For example, if a refinement Refinement2
- includes a module M (i.e., Refinement2 -> <M> -> RefinedClass,
- and if refinements iclasses are <Refinement2> -> <M>' ->
- <Refinement1> -> RefinedClass, then super in <Refinement2> should
- use Refinement2's superclass <M> instead of <Refinement2>'s
- superclass <M>'.
+ * test/zlib/test_zlib.rb (test_rewind): test each_byte
- * vm_insnhelper.c (vm_search_super_method): do not raise a
- NotImplementError if current_defined_class is a module included
- into a refinement. Because of the change of
- vm_search_normal_superclass(), the receiver might not be an
- instance of the module('s iclass).
+Sat Aug 30 19:22:47 2014 Eric Wong <e@80x24.org>
- * test/ruby/test_refinement.rb: related test.
+ * symbol.c (rb_sym2id): do not return garbage object
-Mon Dec 10 18:35:25 2012 Shugo Maeda <shugo@ruby-lang.org>
+Sat Aug 30 06:39:48 2014 Aaron Patterson <aaron@tenderlovemaking.com>
- * vm_method.c (rb_method_entry_without_refinements): use
- rb_resolve_refined_method() to search superclasses if
- me->def->orig_me is 0. This change fixes make test-all
- TESTS="json ruby/test_refinement.rb".
+ * 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
- * test/ruby/test_refinement.rb: related test.
+Sat Aug 30 06:23:40 2014 Aaron Patterson <aaron@tenderlovemaking.com>
-Mon Dec 10 17:59:07 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * 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
- * ext/fiddle/win32/*: library ports from DL to Fiddle.
+Sat Aug 30 06:10:39 2014 Aaron Patterson <aaron@tenderlovemaking.com>
- * ext/dl/win32/extconf.rb: check fiddle. often case dl compiled prior
- to fiddle, so this change is no meaning. in most cases, simply
- fiddle/win32 overwrite dl/win32.
+ * 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
-Mon Dec 10 15:23:35 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Aug 30 06:00:26 2014 Aaron Patterson <aaron@tenderlovemaking.com>
- * vm_trace.c (rb_threadptr_exec_event_hooks): exceptions in event
- hooks should not propagate outside.
+ * 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
-Mon Dec 10 15:11:06 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Aug 29 17:56:44 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * compile.c (iseq_compile_each): count flip-flop state in local iseq
- not in each iseqs, so that the keys can be other than hidden
- strings. [ruby-core:47253] [Bug #6899]
+ * test/net/imap/test_imap_response_parser.rb: removed needless code.
- * vm_insnhelper.c (lep_svar_get, lep_svar_set, vm_getspecial): store
- flip-flop states in an array instead of a hash.
+Fri Aug 29 17:36:58 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * iseq.c (set_relation): main iseq also can has local scope.
+ * test/rinda/test_rinda.rb: removed useless assignment variables.
+ * test/rss/rss-assertions.rb: ditto.
+ * test/rss/test_maker_itunes.rb: ditto.
-Mon Dec 10 10:36:12 2012 Narihiro Nakamura <authornari@gmail.com>
+Fri Aug 29 16:18:26 2014 Eric Wong <e@80x24.org>
- * lib/irb/magic-file.rb: set a encoding, which is detected from
- the file to read, to the internal encoding.
- [Bug #4281][ruby-dev:43036]
+ * string.c: revert part of r47311, add rb_vm_fstring_table(),
+ remove vm_core.h dependency. [ruby-core:64627]
-Mon Dec 10 09:40:19 2012 Eric Hodel <drbrain@segment7.net>
+Fri Aug 29 15:17:13 2014 Eric Wong <e@80x24.org>
- * lib/rubygems/ext/cmake_builder.rb: Added a builder for cmake.
- * lib/rubygems/ext.rb: ditto.
- * lib/rubygems/installer.rb: ditto.
- * test/rubygems/test_gem_ext_cmake_builder.rb: Test for above.
+ * 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]
-Mon Dec 10 09:13:08 2012 Eric Hodel <drbrain@segment7.net>
+Wed Aug 27 23:10:24 2014 Masaki Matsushita <glass.saga@gmail.com>
- * lib/rubygems/package.rb: Omit directories when packaging gems like
- RubyGems 1.8.x
- * test/rubygems/test_gem_package.rb: Test for above.
+ * lib/tempfile.rb: remove "require 'thread'". its features are no
+ longer used.
-Sun Dec 9 17:36:59 2012 Shugo Maeda <shugo@ruby-lang.org>
+Wed Aug 27 21:19:40 2014 gogo tanaka <mail@tanakakazuki.com>
- * vm_insnhelper.c (vm_call_opt_send): Kernel#send should not use
- refinements.
+ * 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.
- * proc.c (mnew): Kernel#method, Kernel#public_method,
- Module#instance_method, and Module#public_instance_method should
- not use refinements.
+Wed Aug 27 21:08:20 2014 gogo tanaka <mail@tanakakazuki.com>
- * vm_method.c (rb_method_boundp): Kernel#respond_to? should not use
- refinements.
+ * 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.
- * test/ruby/test_refinement.rb: related test.
+Wed Aug 27 19:52:33 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-Sun Dec 9 06:19:04 2012 Eric Hodel <drbrain@segment7.net>
+ * 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.
- * lib/rdoc/markdown/entities.rb: Added documentation.
+Wed Aug 27 09:57:29 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * lib/rdoc/parser/ruby.rb: Updated style
+ * test/ruby/test_complex.rb: removed unreachable code.
+ * test/ruby/test_rational.rb: ditto.
- * lib/rdoc/ruby_lex.rb: Parse characters up to \u{FFFFF}
- * test/rdoc/test_rdoc_ruby_lex.rb: Test for above.
+Wed Aug 27 07:59:17 2014 Eric Wong <e@80x24.org>
-Sat Dec 8 22:38:35 2012 Shugo Maeda <shugo@ruby-lang.org>
+ * compile.c (iseq_set_sequence): check for multiplication overflow
- * eval.c (rb_mod_refine): don't override Module#include. It's
- unnecessary now because refinements are activated only in refine
- blocks.
+Tue Aug 26 22:07:42 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Sat Dec 8 22:33:26 2012 Shugo Maeda <shugo@ruby-lang.org>
+ * test/ruby/test_complex.rb: cherry-picked working assertions from r47251.
+ * test/ruby/test_rational.rb: cherry-picked working assertions from r47263.
- * eval.c: remove Module#refinements.
+Tue Aug 26 21:07:56 2014 gogo tanaka <mail@tanakakazuki.com>
- * test/ruby/test_refinement.rb: remove tests for Module#refinements.
+ * lib/mathn.rb (Fixnum#**, Bignum#**, Float#**, Rational#**):
+ remove as these are now built-in. [ruby-core:63973] [Bug #10086]
-Sat Dec 8 13:17:55 2012 Shugo Maeda <shugo@ruby-lang.org>
+Tue Aug 26 20:46:55 2014 Tanaka Akira <akr@fsij.org>
- * eval.c (top_using): raise a RuntimeError if using is called in a
- module definition or a method definition.
+ * time.c (rb_time_unmagnify_to_float): Avoid double rounding.
+ Reported by Tsuyoshi Sawada.
+ https://bugs.ruby-lang.org/issues/10135#note-1
- * test/ruby/test_refinement.rb: related test.
+Tue Aug 26 17:12:47 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Dec 8 15:01:35 2012 Eric Hodel <drbrain@segment7.net>
+ * 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]
- * lib/rubygems/commands/cleanup_command.rb: Skip default gems when
- cleaning up.
- * test/rubygems/test_gem_commands_cleanup_command.rb: Test for above.
+Tue Aug 26 13:46:33 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * lib/rubygems/commands/query_command.rb: Fixed listing remote gems.
+ * template/fake.rb.in: fix failed to make install when @srcdir@ is
+ absolute path.
- * lib/rubygems/dependency_installer.rb: Ignore non-files when looking
- for local gems.
- * test/rubygems/test_gem_dependency_installer.rb: Test for above.
+Tue Aug 26 13:43:50 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * lib/rubygems/uninstaller.rb: The user must confirm uninstalling gems
- that have dependencies.
- * test/rubygems/test_gem_uninstaller.rb: Test for above.
+ * test/ruby/test_range.rb: added workaround for VERBOSE message.
- * lib/rubygems.rb (module Gem): Updated version.
+Tue Aug 26 12:38:02 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * test/rubygems/*.pem: Updated to run in FIPS mode.
- * test/rubygems/test_gem_security.rb: ditto.
- * test/rubygems/test_gem_security_signer.rb: ditto.
+ * test/test_mathn.rb: added workaround for VERBOSE messages.
-Sat Dec 8 12:34:01 2012 Shugo Maeda <shugo@ruby-lang.org>
+Tue Aug 26 11:44:04 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * vm_insnhelper.c (vm_search_normal_superclass): super in a
- refinement always uses the refined class as its superclass.
+ * lib/shell/process-controller.rb: removed commented-out code.
- * test/ruby/test_refinement.rb: related test.
+Tue Aug 26 11:39:01 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Sat Dec 8 11:59:59 2012 Shugo Maeda <shugo@ruby-lang.org>
+ * lib/thwait.rb (ThreadsWait): removed needless constant.
- * eval.c (rb_mod_refine): raise an ArgumentError if a given
- block is of a Proc object.
+Tue Aug 26 09:27:10 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * vm_insnhelper.c (vm_call_method): store refined methods in inline
- cache to improve performance. It's safe now because blocks cannot
- be yielded with different refinements in the new specification.
+ * lib/mathn.rb: mathn library is deprecated on ruby 2.2.
+ [Feature #10169][ruby-core:64553]
- * test/ruby/test_refinement.rb: related test.
+Tue Aug 26 09:25:03 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Sat Dec 8 11:17:53 2012 Shugo Maeda <shugo@ruby-lang.org>
+ * lib/mathn.rb: removed commented-out code.
- * eval.c (rb_mod_refine), vm_eval.c (rb_yield_refine_block):
- Module#refine activates all refinements defined in that module
- only in a given block.
+Mon Aug 25 20:15:50 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * string.c (sym_to_proc, sym_call): don't use refinements.
+ * 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.
- * test/ruby/test_refinement.rb: related test.
+Mon Aug 25 12:56:54 2014 Ivan Korunkov <ivankorunkov@ya.ru>
-Sat Dec 8 09:24:42 2012 Eric Hodel <drbrain@segment7.net>
+ * lib/logger.rb (format_datetime): use "%6N" to show microsecond.
+ [Fix GH-704]
- * ext/openssl/ossl_x509name.c: Completed documentation for
- OpenSSL::X509::Name.
+Mon Aug 25 11:02:07 2014 Eric Wong <e@80x24.org>
-Sat Dec 8 07:57:12 2012 Koichi Sasada <ko1@atdot.net>
+ * vm_core.h (rb_iseq_location_t): change first_lineno type to VALUE
+ * iseq.c (rb_iseq_build_for_ruby2cext): update based on argument
- * ext/objspace/objspace.c (iow_size): return size of internal object
- for ObjectSpace.memsize_of().
+Sun Aug 24 16:14:46 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * test/objspace/test_objspace.rb: add a test.
+ * lib/e2mmap.rb: remove needless instance variables.
+ * lib/irb.rb: ditto.
+ * lib/irb/**/*.rb: ditto.
+ * lib/shell.rb: ditto.
-Tue Dec 08 02:39:23 2012 James Edward Gray II <james@graysoftinc.com>
+Sun Aug 24 12:44:26 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * lib/csv.rb: A fix for row comparison by Stephen Wattam. [Bug #7528]
+ * test/ruby/test_complex.rb: removed needless conditions.
+ * test/ruby/test_rational.rb: ditto.
-Sat Dec 8 01:27:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Aug 24 11:47:39 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * lib/test/unit.rb (Test::Unit::Runner#_run_parallel): no need to
- check all reports.
+ * test/ruby/test_rational.rb: fixed indent.
-Sat Dec 8 00:10:34 2012 Shugo Maeda <shugo@ruby-lang.org>
+Sun Aug 24 11:44:11 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * vm_eval.c (yield_under, eval_under): do not activate refinements
- of the receiver in module_eval and instance_eval.
+ * test/ruby/test_rational.rb: remove commented-out code.
- * eval.c (ruby_Init_refinement): undef Class#refine.
+Sun Aug 24 11:09:29 2014 Eric Wong <e@80x24.org>
- * eval.c (ruby_Init_refinement): remove Module#using.
+ * lib/benchmark.rb (measure): reduce allocations as in r47260
- * eval.c (ruby_Init_refinement): main.using should be private.
+Sun Aug 24 10:35:54 2014 Pete Higgins <pete@peterhiggins.org>
- * eval.c (rb_mod_refine): the argument of Module#refine should not
- be a module.
+ * lib/benchmark.rb (module Benchmark): define BENCHMARK_CLOCK
+ (realtime): use Process.clock_gettime(BENCHMARK_CLOCK)
+ Reduces allocations to improve performance [Feature #10165]
- * insns.def (defineclass): do not activate refinements in a class or
- module.
+ * test/benchmark/test_benchmark.rb (test_realtime_output): new test
-Fri Dec 7 23:42:11 2012 Shugo Maeda <shugo@ruby-lang.org>
+Fri Aug 22 20:23:54 2014 Koichi Sasada <ko1@atdot.net>
- * ext/refinement/refinement.c: include ruby/ruby.h instead of the
- declaration of rb_warn().
+ * string.c (rb_fstring): fix condition (easy to cause infinite loop!).
-Fri Dec 7 16:07:00 2012 Zachary Scott <zachary@zacharyscott.net>
+Fri Aug 22 20:07:43 2014 Koichi Sasada <ko1@atdot.net>
- * doc/etc.rd: Removed stale documentation file
- * ext/etc/etc.c: Merged documentation from doc/etc.rd and updated
- rdoc, added documentation for Etc::Passwd and Etc::Group
+ * string.c (rb_fstring, fstr_update_callback): simply delete garbage
+ key first.
-Fri Dec 7 16:00:57 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ 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.
- * lib/test/unit.rb (Test::Unit::Runner#_run_parallel): no need to
- retry skipped test. this fix makes 40% faster the whole test-all
- with -j5 on Windows.
+ This bug can be cause memory corruption, reported by
+ http://u64.rubyci.org/~chkbuild/ruby-trunk/log/20140821T220302Z.fail.html.gz
-Fri Dec 7 14:22:29 2012 Eric Hodel <drbrain@segment7.net>
+Fri Aug 22 19:30:39 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * lib/rdoc/markup/to_joined_paragraph.rb: Completed documentation
- * lib/rdoc/parser/c.rb: ditto
- * lib/rdoc/parser/changelog.rb: ditto
- * lib/rdoc/servlet.rb: ditto
- * lib/rdoc/store.rb: ditto
+ * test/ruby/test_complex.rb: removed commented-out code.
- * lib/rdoc/store.rb: Improved HTML error page. Completed
- documentation
+Fri Aug 22 19:25:28 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * lib/rdoc/parser/ruby.rb: Fixed bug attaching a comment to A::B = 42
- * test/rdoc/test_rdoc_parser_ruby.rb: Test for above
+ * test/ruby/test_complex.rb: fixed broken tests. Math is not
+ compatible CMath now.
- * test/rdoc/test_rdoc_comment.rb: Removed garbage
+Fri Aug 22 15:36:09 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Dec 7 14:03:59 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * common.mk (Doxyfile): revert r43888, not to require preinstalled
+ ruby. [ruby-core:64488] [Bug #10161]
- * lib/timeout.rb (Timeout#timeout): since async_interrupt_timing
- re-raises a deferred exception, replace the timeout exception with
- Timeout::Error after it. [Bug #7503]
+Fri Aug 22 12:32:15 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Fri Dec 7 13:07:00 2012 Zachary Scott <zachary@zacharyscott.net>
+ * lib/shell.rb: removed commented-out code.
+ * lib/shell/builtin-command.rb: ditto.
+ * lib/shell/command-processor.rb: ditto.
- * doc/forwardable.rd: Remove stale documentation file
- * lib/forwardable.rb: Merge documentation from doc/forwardable.rd
+Fri Aug 22 12:21:46 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Fri Dec 7 09:47:35 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * lib/complex.rb: removed deprecated library.
+ * lib/rational.rb: ditto.
- * time.c (time_mdump): dump timezone string to private instance variable
- on marshaling.
+Fri Aug 22 11:38:49 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * time.c (time_mload): load timezone string from private instance
- variable named 'zone'.
+ * lib/prettyprint.rb: removed PrettyPrint#first?
+ because it is obsoleted method since Ruby 1.8.2
-Fri Dec 7 01:15:07 2012 Naohisa Goto <ngotogenome@gmail.com>
+Thu Aug 21 17:10:31 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/fiddle/lib/fiddle/function.rb (Fiddle::Function#name): new
- attribute needed to switch Win32::Registry from DL to Fiddle.
+ * 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]
- * ext/fiddle/lib/fiddle/import.rb (import_function, bind_function):
- set function name to the returned Fiddle::Function object.
+Thu Aug 21 14:45:41 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Fri Dec 7 00:11:44 2012 Shugo Maeda <shugo@ruby-lang.org>
+ * lib/e2mmap.rb: removed commented-out code.
- * test/ruby/test_refinement.rb: fix some tests to use neither
- Module#using nor Module#module_eval.
+Thu Aug 21 13:23:34 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Thu Dec 6 23:27:50 2012 Shugo Maeda <shugo@ruby-lang.org>
+ * lib/rinda/ring.rb: split executable code into sample directory.
+ * sample/rinda-ring.rb: ditto.
- * eval.c (ruby_Init_refinement): a new function to enable
- Refinements with a warning "Refinements are experimental...".
+Thu Aug 21 13:21:45 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * ext/refinement/refinement.c, ext/refinement/extconf.rb: a new
- extension library to enable Refinements.
+ * lib/drb/acl.rb: split executable code into sample directory.
+ * sample/drb/acl.rb: ditto.
-Thu Dec 6 18:23:05 2012 Shugo Maeda <shugo@ruby-lang.org>
+Thu Aug 21 12:55:35 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * revised r37993 to avoid SEGV/ILL in tests. In r37993, a method
- entry with VM_METHOD_TYPE_REFINED holds only the original method
- definition, so ci->me is set to a method entry allocated in the
- stack, and it causes SEGV/ILL. In this commit, a method entry
- with VM_METHOD_TYPE_REFINED holds the whole original method entry.
- Furthermore, rb_thread_mark() is changed to mark cfp->klass to
- avoid GC for iclasses created by copy_refinement_iclass().
+ * .gitignore: ignored temporary file for Changelog.
+ http://mkosaki.blog46.fc2.com/blog-entry-1284.html
- * vm_method.c (rb_method_entry_make): add a method entry with
- VM_METHOD_TYPE_REFINED to the class refined by the refinement if
- the target module is a refinement. When a method entry with
- VM_METHOD_TYPE_UNDEF is invoked by vm_call_method(), a method with
- the same name is searched in refinements. If such a method is
- found, the method is invoked. Otherwise, the original method in
- the refined class (rb_method_definition_t::body.orig_me) is
- invoked. This change is made to simplify the normal method lookup
- and to improve the performance of normal method calls.
+Thu Aug 21 12:40:22 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * vm_method.c (EXPR1, search_method, rb_method_entry),
- vm_eval.c (rb_call0, rb_search_method_entry): do not use
- refinements for method lookup.
+ * lib/net/imap.rb: split executable code into sample directory.
+ * sample/net-imap.rb: ditto.
- * vm_insnhelper.c (vm_call_method): search methods in refinements if
- ci->me is VM_METHOD_TYPE_REFINED. If the method is called by
- super (i.e., ci->call == vm_call_super_method), skip the same
- method entry as the current method to avoid infinite call of the
- same method.
+Thu Aug 21 12:23:56 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * class.c (include_modules_at): add a refined method entry for each
- method defined in a module included in a refinement.
+ * lib/net/imap.rb: removed commented-out code.
- * class.c (rb_prepend_module): set an empty table to
- RCLASS_M_TBL(klass) to add refined method entries, because
- refinements should have priority over prepended modules.
+Wed Aug 20 17:27:02 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * proc.c (mnew): use rb_method_entry_with_refinements() to get
- a refined method.
+ * 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]
- * vm.c (rb_thread_mark): mark cfp->klass for iclasses created by
- copy_refinement_iclass().
+Tue Aug 19 22:28:32 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm.c (Init_VM), cont.c (fiber_init): initialize th->cfp->klass.
+ * sprintf.c (rb_str_format): fix condition to round.
+ [ruby-core:64454] [Bug #10151]
- * test/ruby/test_refinement.rb (test_inline_method_cache): do not skip
- the test because it should pass successfully.
+Tue Aug 19 22:22:45 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/ruby/test_refinement.rb (test_redefine_refined_method): new
- test for the case a refined method is redefined.
+ * enc/trans/euckr-tbl.rb (EUCKR_TO_UCS_TBL): add missing euro and
+ registered signs. [ruby-core:64452] [Bug #10149]
-Thu Dec 6 17:29:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Aug 19 13:59:43 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * parse.y (parser_here_document): flush string content between new
- line and :string_embexpr. [ruby-core:48703] [Bug #7255]
+ * compar.c (rb_cmperr): preserve encodings of arguments in the
+ message.
-Thu Dec 6 16:35:21 2012 Eric Hodel <drbrain@segment7.net>
+Tue Aug 19 10:13:23 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/rake/helper.rb: Load envutil correctly. Removed useless rescue
- for signal propagation tests
- * lib/rake/file_utils.rb: Prefer the built ruby.
- * test/rake/test_rake_functional.rb: ditto
+ * ext/thread/thread.c (get_array): check instance variables are
+ initialized properly. [ruby-core:63826][Bug #10062]
-Thu Dec 6 15:20:34 2012 Eric Hodel <drbrain@segment7.net>
+Mon Aug 18 17:06:27 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/rdoc/context.rb: Don't warn for duplicate methods while loading.
- * test/rdoc/test_rdoc_context.rb: Test for above.
+ * sprintf.c (rb_str_format): support rational 'f' format.
+ [ruby-core:64382] [Bug #10136]
-Thu Dec 6 14:26:22 2012 Eric Hodel <drbrain@segment7.net>
+Mon Aug 18 08:03:46 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * lib/rubygems/command_manager.rb: Removed string concatenation
- syntax. [Bug #6265]
- * lib/rubygems/commands/install_command.rb: ditto
- * lib/rubygems/commands/uninstall_command.rb: ditto
- * lib/rubygems/indexer.rb: ditto
- * lib/rubygems/security/policy.rb: ditto
- * lib/rubygems/security.rb: ditto
- * lib/rubygems/uninstaller.rb: ditto
- * test/rubygems/test_gem_commands_cert_command.rb: ditto
- * test/rubygems/test_gem_package.rb: ditto
- * test/rubygems/test_gem_security.rb: ditto
- * test/rubygems/test_gem_security_policy.rb: ditto
+ * spec/default.mspec: use 2.2 definition.
-Thu Dec 6 14:10:08 2012 Eric Hodel <drbrain@segment7.net>
+Sun Aug 17 19:41:40 2014 Kazuki Tsujimoto <kazuki@callcc.net>
- * lib/rubygems/package.rb: Set rubygems_version before validation.
- Fixes issue with bundler.
- * test/rubygems/test_gem_package.rb: Test for above.
+ * 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.
- * lib/rubygems/remote_fetcher.rb: Only update the cache when we have
- permission. [ruby-trunk - Bug #7509]
- * lib/rubygems/source.rb (class Gem): ditto
- * test/rubygems/test_gem_remote_fetcher.rb: Test for above.
- * lib/rubygems/test_utilities.rb: ditto
+Sun Aug 17 17:08:12 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * lib/rubygems/specification.rb: Derive base_dir properly for default
- gems. [ruby-trunk - Bug #7496]
- * test/rubygems/test_gem_specification.rb: Test for above.
+ * ext/win32ole/win32ole.c (ole_invoke): use RHASH_SIZE instead of
+ calling Hash#length method.
- * lib/rubygems.rb: Untaint Dir.pwd when searching for gemdeps files
- for operation under $SAFE=1
+Sat Aug 16 19:32:06 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-Thu Dec 06 12:07:11 2012 Koichi Sasada <ko1@atdot.net>
+ * ext/win32ole/win32ole_event.c (evs_length): use RARRAY_LEN instead
+ of calling Array#length method.
- * vm_trace.c: TracePoint#enable should not cause an error
- when it is already enabled. TracePoint#disable is too.
- [ruby-core:50561] [ruby-trunk - Bug #7513]
+Sat Aug 16 10:20:17 2014 Eric Wong <e@80x24.org>
- * test/ruby/test_settracefunc.rb: add tests.
+ * time.c (time_timespec): fix tv_nsec overflow
+ [Bug #10144]
-Thu Dec 6 07:19:58 2012 Eric Hodel <drbrain@segment7.net>
+Fri Aug 15 20:34:17 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * lib/rdoc*: Improved display of ChangeLog files as HTML.
- * test/rdoc*: Test for above.
+ * 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.
-Thu Dec 6 04:34:19 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Fri Aug 15 19:38:00 2014 Koichi Sasada <ko1@atdot.net>
- * thread.c (rb_uninterruptible): helper function for providing
- temporary async_interrupt_timing(Object => :defer)
+ * iseq.c (rb_iseq_clone): Should not insert write barrier from
+ non-RVALUE data (to non-RVALUE data, of course).
- * io.c (rb_f_p): use rb_uninterruptible.
- * io.c (rb_f_p_internal): helper function for rb_f_p().
- * io.c (struct rb_f_p_arg): new struct for rb_f_p_internal.
+ Ruby 2.1 also has a same problem.
- * test/ruby/test_thread.rb (test_async_interrupt_and_p): test for
- the above.
+Fri Aug 15 19:34:33 2014 Koichi Sasada <ko1@atdot.net>
-Thu Dec 6 04:27:10 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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.
- * io.c (io_binwrite): check interrupt before io issue.
- * test/ruby/test_thread.rb (test_async_interrupt_and_io):
- test for the above.
+ It can cause unexpected behaviour.
-Thu Dec 6 01:10:36 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ Ruby 2.1 also have a same problem (setup_fake_str() in parse.y).
- * vm_eval.c (rb_method_call_status): use Qundef as no self instead of
- the current self.
+ * symbol.c (setup_fake_str): ditto.
- * vm_eval.c (send_internal): public_send does not consider how it is
- called, as mentioned in r14173. patched by charliesome (Charlie
- Somerville). [ruby-core:50489] [Bug #7499]
+Fri Aug 15 19:27:25 2014 Koichi Sasada <ko1@atdot.net>
-Wed Dec 5 23:50:23 2012 Narihiro Nakamura <authornari@gmail.com>
+ * 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.
- * gc.c (getrusage_time): uses clock_gettime() with
- CLOCK_PROCESS_CPUTIME_ID when available, which provides a 1ns
- precision on linux. [ruby-core:50495] [Bug #7500]
- patched by Aman Gupta.
+ Otherwise, it can be includes strange VALUEs.
-Wed Dec 5 22:46:02 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * internal.h: added.
- * vm.c (rb_vm_make_proc): save the proc made from the given block so
- that it will not get collected. [ruby-core:50545] [Bug #7507]
+ * node.h: use rb_ary_tmp_new_fill() for MEMO.
-Wed Dec 5 22:13:57 2012 Naohisa Goto <ngotogenome@gmail.com>
+Fri Aug 15 10:13:37 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * ext/dl/lib/dl/func.rb (DL::Function#bind): When Fiddle is used,
- @ptr should be updated. This fixes SEGV raised in DL::Function#call
- after calling DL::Function#bind. [Bug #7516] [ruby-dev:46708]
-
- * test/dl/test_func.rb (test_bind): test for the above
+ * lib/gserver.rb: removed unmaintained code.
+ [ruby-core:40313][Feature #5480]
+ * lib/xmlrpc/httpserver.rb: ditto.
-Wed Dec 5 18:53:00 2012 Masaya Tarui <tarui@ruby-lang.org>
+Fri Aug 15 09:22:12 2014 Eric Wong <e@80x24.org>
- * thread.c (rb_thread_s_async_interrupt_timing): have to check ints
- before jumping out.
- * test/ruby/test_thread.rb (test_async_interrupt_with_return): add test
- rescue has to catch a queued async exception at the time of return.
- * test/ruby/test_thread.rb (test_async_interrupt_with_break): add test
- rescue has to catch a queued async exception at the time of break.
+ * 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)
-Wed Dec 5 16:54:28 2012 Koichi Sasada <ko1@atdot.net>
+Fri Aug 15 09:06:31 2014 Eric Wong <e@80x24.org>
- * test/ruby/memory_status.rb: suppress warning.
- A patch from NAKAMURA Usaku.
+ * thread_pthread.h: define RB_NATIVETHREAD_LOCK_INIT and
+ RB_NATIVETHREAD_COND_INIT macros
-Wed Dec 5 16:06:54 2012 Eric Hodel <drbrain@segment7.net>
+ * 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]
- * lib/rdoc/parser/changelog.rb: Parse more ChangeLog file variations.
- * test/rdoc/test_rdoc_parser_changelog.rb: Test for above.
+ * thread_pthread.c (native_mutex_debug): make argument type-agnostic
+ to avoid later cast.
-Wed Dec 5 12:17:11 2012 Naohisa Goto <ngotogenome@gmail.com>
+ * thread_pthread.c (register_cached_thread_and_wait):
+ replace PTHREAD_COND_INITIALIZER with RB_NATIVETHREAD_COND_INIT,
+ use native_mutex_{lock,unlock}
- * ext/dl/lib/dl/func.rb (DL::Function#initialize, DL::Function#bind):
- ABI should be set by using CFunc#calltype even when Fiddle is used.
- When Fiddle is used and a block is given, name should not be ignored.
- [ruby-core:50562] [Bug #7514]
+ * thread_pthread.c (use_cached_thread):
+ use native_mutex_{lock,unlock}
- * ext/dl/lib/dl/import.rb (DL::Importer#bind_function): should respect
- abi and name when Fiddle is used.
+ * thread_pthread.c (native_sleep):
+ use rb_nativethread_lock_t to match th->interrupt_lock,
+ use native_mutex_{lock,unlock}
- * test/dl/test_func.rb (test_name_with_block): test for "name" method
- with giving a block.
+ * thread_pthread.c (timer_thread_lock): use rb_nativethread_lock_t type
-Wed Dec 5 11:55:00 2012 Zachary Scott <zachary@zacharyscott.net>
+Fri Aug 15 08:10:29 2014 Eric Wong <e@80x24.org>
- * doc/shell.rd, doc/shell.rd.ja: Removed stale doc files
- * lib/shell.rb, lib/shell/*: Merge and updates docs from doc/shell.rd*
+ * cont.c (cont_mark): fix typo in unused path [ci skip]
-Wed Dec 5 11:42:38 2012 Koichi Sasada <ko1@atdot.net>
+Fri Aug 15 06:00:56 2014 Eric Wong <e@80x24.org>
- * test/ruby/test_settracefunc.rb: disable trace.
+ * vm.c (rb_thread_mark): update comment about marking `me'
+ [ruby-core:64340] [ruby-core:64341]
-Wed Dec 5 11:37:37 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Aug 15 05:53:59 2014 Eric Wong <e@80x24.org>
- * lib/mkmf.rb (MakeMakefile#macro_defined?): use clearly different
- strings from conflict markers.
+ * README.EXT: preliminary documentation for RB_GC_GUARD
+ [Bug #10100] [ruby-core:60741]
-Wed Dec 5 04:25:00 2012 Zachary Scott <zachary@zacharyscott.net>
+Thu Aug 14 00:26:19 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * lib/README: Add rdoc modeline directive and formatting libs
+ * 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 Dec 5 04:04:02 2012 Masaya Tarui <tarui@ruby-lang.org>
+Wed Aug 13 21:41:04 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * test/ruby/test_thread.rb (test_async_interrupt_blocking): bugfix
- about deferred check
+ * 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 Dec 5 03:35:37 2012 Masaya Tarui <tarui@ruby-lang.org>
+Wed Aug 13 20:09:37 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * vm_core.h (RUBY_VM_CHECK_INTS_BLOCKING): check async queue everytime.
- * thread.c (sleep_forever): check RUBY_VM_CHECK_INTS_BLOCKING first.
- * thread.c (sleep_timeval): ditto.
- * test/ruby/test_thread.rb (test_async_interrupt_blocking): add a test
- exceptions are correctly deferred and raised on :on_blocking context.
+ * ext/win32ole/win32ole.c: remove unused variable.
-Wed Dec 5 02:36:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Aug 13 19:31:27 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * common.mk, defs/id.def, template/id.c.tmpl: generate id.c as well as id.h.
+ * ext/win32ole/win32ole.c (ole_search_handler_method, rescue_callback,
+ folerecord_inspect): use PRIsVALUE in rb_sprintf.
-Wed Dec 5 00:56:21 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * ext/win32ole/win32ole_param.c (foleparam_inspect): ditto.
- * thread.c (rb_mutex_owned_p): new method that return current
- thread have the target mutex or not. [Feature #7505] [ruby-dev:46697]
- * test/ruby/test_thread.rb (test_mutex_owned, test_mutex_owned2):
- test for the above.
- * NEWS: new for the above.
+ * ext/win32ole/win32ole_variable.c (folevariable_inspect): use
+ PRIsVALUE in rb_sprintf, use rb_inspect.
-Wed Dec 5 00:05:47 2012 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+Wed Aug 13 11:54:41 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * lib/erb.rb (make_compiler, add_put_cmd, add_insert_cmd): extract
- methods.
+ * lib/irb/completion.rb: reverted r47163.
+ because another case can't be show completion target.
-Tue Dec 4 18:21:04 2012 Naohisa Goto <ngotogenome@gmail.com>
+Wed Aug 13 11:17:00 2014 Shimpei Makimoto <github@makimoto.org>
- * test/ruby/memory_status.rb (Memory): use fiddle/types if available.
+ * 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.
- * test/ruby/memory_status.rb (Memory::Win32): :stdcall is needed on
- x86 WIN32. This commit partly reverts r38054.
+Wed Aug 13 11:08:55 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Tue Dec 4 18:05:58 2012 Naohisa Goto <ngotogenome@gmail.com>
+ * lib/irb/completion.rb: fixed broken completion list with
+ String including spaces. Contributed from @dunric. [fix GH-465]
- * ext/fiddle/lib/fiddle/types.rb: copied from ext/dl/lib/dl/types.rb
- and modified for Fiddle, needed for migration from DL to Fiddle.
+Wed Aug 13 00:07:01 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-Tue Dec 4 17:57:09 2012 Naohisa Goto <ngotogenome@gmail.com>
+ * 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.
- * ext/fiddle/lib/fiddle/import.rb (import_function, bind_function):
- should respect call_type for migration from DL to Fiddle.
- [Bug #7484] [ruby-core:50405]
+Tue Aug 12 23:17:47 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-Tue Dec 4 16:54:00 2012 Eric Hodel <drbrain@segment7.net>
+ * 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.
- * .document: Added ChangeLog and doc/ChangeLog-* as documentation
+Tue Aug 12 22:59:48 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-Tue Dec 4 16:47:46 2012 Eric Hodel <drbrain@segment7.net>
+ * 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.
- * lib/rdoc/parser/changelog.rb: Added a ChangeLog parser to RDoc.
- * lib/rdoc/parser.rb: ditto
- * test/rdoc/test_rdoc_parser_changelog.rb: Test for above.
+Tue Aug 12 21:49:40 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-Tue Dec 4 16:23:32 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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]
- * marshal.c (path2class, path2module): use PRIsVALUE.
+Tue Aug 12 14:22:58 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * marshal.c (w_object, marshal_dump, marshal_load): use
- rb_check_funcall if possible.
+ * configure.in: ignored working directory same as prefix value.
+ [ruby-core:54999] [Bug #8409]
- * marshal.c (w_object, marshal_dump, r_object0, marshal_load): use
- RB_GC_GUARD() (directly or indirectly) instead of volatile.
+Tue Aug 12 13:34:25 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * variable.c (rb_path_to_class): prevent the argument from GC.
+ * 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 Dec 04 13:55:07 2012 Koichi Sasada <ko1@atdot.net>
+Tue Aug 12 12:57:28 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * vm_opts.h: enable optimization - operand unification.
- Operand unification technique enable to combine
- an instruction and specific operands and make new
- instruction.
+ * vm_exec.c: improve performance in ppc64 arch.
+ [ruby-core:63437] [Feature #9997]
- * defs/opt_operand.def: add several configuration
- of operand unification.
+Tue Aug 12 12:14:52 2014 Akira Matsuda <ronnie@dio.jp>
- * insns.def: use `int' instead to suppress warning.
+ * lib/fileutils.rb: fix typo.
+ [ruby-dev:47831] [Bug #9180]
-Mon Dec 3 17:58:53 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Tue Aug 12 10:10:42 2014 Eric Wong <e@80x24.org>
- * parse.y: replace parser->enc with current_enc.
+ * vm_method.c (release_method_definition): use rb_free_method_entry
-Tue Dec 4 08:33:46 2012 Eric Hodel <drbrain@segment7.net>
+Tue Aug 12 06:16:09 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * README.EXT: Converted to RDoc format
- * README.EXT.ja: ditto
+ * 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.
-Tue Dec 4 08:32:10 2012 Eric Hodel <drbrain@segment7.net>
+Mon Aug 11 22:19:15 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * lib/rdoc/ri/driver.rb: Fixed ri page display for files with
- extensions.
- * test/rdoc/test_rdoc_ri_driver.rb: Test for above
+ * ext/win32ole/win32ole_variable.c (folevariable_inspect): refactoring.
-Tue Dec 4 04:11:50 2012 Eric Hodel <drbrain@segment7.net>
+Mon Aug 11 20:47:27 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * .document: Add NEWS for `ri ruby:NEWS`
- * NEWS: Set format as rdoc
- * doc/NEWS-1.8.7: ditto
- * doc/NEWS-1.9.1: ditto
- * doc/NEWS-1.9.2: ditto
- * doc/NEWS-1.9.3: ditto
+ * 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 Dec 3 20:37:22 2012 Koichi Sasada <ko1@atdot.net>
+Mon Aug 11 16:17:21 2014 Tony Miller <mcfiredrill@gmail.com>
- * vm_exec.c: check VM_COLLECT_USAGE_DETAILS.
+ * dir.c (rb_dir_exists_p): [DOC] Document that Dir.exists? is
+ deprecated. [ruby-core:64135] [Bug #10102]
-Mon Dec 3 20:28:02 2012 Koichi Sasada <ko1@atdot.net>
+Mon Aug 11 11:26:33 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * compile.c (iseq_specialized_instruction):
- change condition of using `opt_send_simple'.
- More method invocations can be simple.
+ * lib/tempfile.rb: start rdoc parsing inside singleton class
+ definition to include the document there.
+ [ruby-core:64157] [Bug #10105]
-Mon Dec 3 20:03:38 2012 Koichi Sasada <ko1@atdot.net>
+Sun Aug 10 12:22:43 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * test/ruby/test_objectspace.rb: skip RuntimeError
- which says a message "can't modify frozen File".
- Is that correct behavior?
+ * ext/win32ole/win32ole_type.c: refactoring.
-Mon Dec 03 20:00:19 2012 Koichi Sasada <ko1@atdot.net>
+Sun Aug 10 10:34:00 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * vm_exec.c: vm_analysis_insn should be static.
+ * lib/cgi/session/pstore.rb: separated sample code.
+ * lib/open3.rb: ditto.
-Mon Dec 3 19:10:12 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Aug 10 10:03:24 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * random.c (Init_Random), rational.c (Init_Rational): make marshal
- methods private. [Feature #6539]
+ * lib/irb/ext/multi-irb.rb: removed commented-out code.
-Mon Dec 3 18:29:27 2012 Koichi Sasada <ko1@atdot.net>
+Sat Aug 9 11:02:07 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * iseq.h: iseq_catch_table_entry::catch_type should be
- Fixnum because they are pushed into Array in a compiler.
- [Bug #7502]
+ * lib/irb.rb: removed commented-out code.
+ * lib/irb/**/*.rb: ditto.
- * test/ruby/test_objectspace.rb: add a test of this issue.
+Sat Aug 9 10:35:30 2014 Laurent Arnoud <laurent@spkdev.net>
-Mon Dec 3 18:25:16 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/cmath.rb: fixed indent. [fix GH-696]
+ * lib/drb/ssl.rb: ditto.
+ * lib/irb/**/*.rb: ditto.
- * template/id.h.tmpl (preserved_ids): "empty?" is not an attribute name.
+Sat Aug 9 10:28:03 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Mon Dec 3 16:23:09 2012 Koichi Sasada <ko1@atdot.net>
+ * test/minitest/test_minitest_unit.rb: removed obsoleted condition
+ for Ruby 1.8.
+ * test/ruby/test_time_tz.rb: ditto.
- * vm_backtrace.c (vm_backtrace_to_ary): check negative size (2nd arg).
+Sat Aug 9 10:18:00 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Mon Dec 3 15:50:33 2012 Akinori MUSHA <knu@iDaemons.org>
+ * 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.
- * misc/ruby-additional.el (ruby-mode-set-encoding): Unbreak by
- fixing a typo, s/set/setq/.
+Sat Aug 9 00:34:37 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-Mon Dec 3 14:14:19 2012 Koichi Sasada <ko1@atdot.net>
+ * 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.
- * compile.c (iseq_compile_each): joke shouldn't use id.h defined ids.
+Fri Aug 8 01:53:37 2014 Masaki Matsushita <glass.saga@gmail.com>
- * id.c (Init_id): ditto.
+ * lib/securerandom.rb: use OpenSSL::BN for performance improvement.
- * common.mk: fix dependency.
+ * benchmark/bm_securerandom.rb: benchmark script.
-Mon Dec 3 12:43:35 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Aug 8 17:19:57 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * misc/ruby-mode.el (ruby-block-end-re, ruby-delimiter)
- (ruby-mode-syntax-table, ruby-parse-partial, ruby-beginning-of-indent):
- merge from Emacs.
+ * lib/open-uri.rb: remove needless condition for old ruby version.
+ * test/open-uri/test_open-uri.rb: ditto.
- * misc/ruby-mode.el (ruby-calculate-indent): fix indentation of
- argument lines in parentheses. [Bug #5140]
+Fri Aug 8 16:40:59 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Mon Dec 3 07:52:41 2012 Eric Hodel <drbrain@segment7.net>
+ * lib/irb/init.rb: removed unreachable code.
- * lib/rdoc/parser.rb: Improved modeline support. Patch by nobu.
- * test/rdoc/test_rdoc_parser.rb: Test for above.
+Fri Aug 8 16:34:22 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Sun Dec 3 00:06:00 2012 Kenta Murata <mrkn@mrkn.jp>
+ * lib/drb/drb.rb: removed unreachable code.
- * ext/bigdecimal/bigdecimal.c (BigDecimal_new): stop checking string
- taintness. [Bug #5508] [ruby-core:40510]
+Fri Aug 8 14:33:49 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Sun Dec 2 19:26:47 2012 Masaya Tarui <tarui@ruby-lang.org>
+ * lib/webrick/httpproxy.rb: remove needless condition
+ for old ruby version.
- * thread.c (RB_GC_SAVE_MACHINE_CONTEXT, rb_gc_save_machine_context):
- extract rb_gc_save_machine_context to RB_GC_SAVE_MACHINE_CONTEXT.
- NOTE: machine_regs and machine_stack_end must be set in current scope.
+Fri Aug 8 01:07:10 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Dec 2 18:46:24 2012 Koichi Sasada <ko1@atdot.net>
+ * 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]
- * array.c, enum.c, insns.def, io.c, numeric.c, parse.y, process.c,
- range.c: use prepared IDs.
- A patch from charliesome (Charlie Somerville).
- [Bug #7495]
+Thu Aug 7 23:25:29 2014 Masaki Matsushita <glass.saga@gmail.com>
- * common.mk: add dependency to id.h.
+ * lib/open3.rb: avoid unnecessary write if stdin_data is empty.
- * common.mk: replace ID_H_INCLUDES with id.h.
+Thu Aug 7 21:42:49 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-Sun Dec 2 16:48:00 2012 Zachary Scott <zachary@zacharyscott.net>
+ * ext/win32ole/win32ole_typelib.c (foletypelib_version): return
+ version string.
- * lib/weakref.rb (rdoc): Clean up usage, add example,
- note ArgumentError on WeakRef.new
+ * test/win32ole/test_win32ole_typelib.rb (test_version): ditto.
-Sun Dec 2 16:45:00 2012 Zachary Scott <zachary@zacharyscott.net>
+Thu Aug 7 15:13:13 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * gc.c (WeakMap): Add doc for internal reference, use lib/weakref.rb
+ * lib/cgi.rb: remove needless condition for old ruby version.
-Sun Dec 2 07:24:23 2012 Eric Hodel <drbrain@segment7.net>
+Thu Aug 7 06:04:49 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/rdoc/parser.rb: Parse files with a -*- rdoc -*- modeline
- * test/rdoc/test_rdoc_parser.rb: Test for above
+ * parse.y (parser_yyerror): preserve source code encoding in
+ syntax error messages. [ruby-core:64228] [Bug #10114]
-Sun Dec 2 06:02:00 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Wed Aug 6 20:56:02 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * gc.h (SET_MACHINE_STACK_END): add volatile for preventing
- harmful optimization. [ruby-dev:46665] [Bug #7468]
+ * ext/win32ole/win32ole.c: separate src of WIN32OLE_TYPELIB from
+ win32ole.c
-Sun Dec 2 05:01:58 2012 Koichi Sasada <ko1@atdot.net>
+ * ext/win32ole/win32ole.h: ditto.
+ * ext/win32ole/win32ole_typelib.c: ditto.
+ * ext/win32ole/win32ole_typelib.h: ditto.
+ * ext/win32ole/depend: ditto.
- * iseq.c (rb_iseq_line_trace_each): iterate `line' event only.
+Wed Aug 6 20:44:07 2014 Akinori MUSHA <knu@iDaemons.org>
- * test/ruby/test_iseq.rb: add a test for this change.
+ * 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
-Sun Dec 2 02:46:04 2012 Koichi Sasada <ko1@atdot.net>
+Wed Aug 6 20:25:47 2014 Akinori MUSHA <knu@iDaemons.org>
- * vm_trace.c: add TracePoint#inspect.
+ * 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
- * test/ruby/test_settracefunc.rb: add a test for this change.
+Wed Aug 6 20:07:26 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-Sat Dec 1 21:18:19 2012 Koichi Sasada <ko1@atdot.net>
+ * ext/win32ole/win32ole.c (olerecord_ivar_set): remove rb_str_subseq.
- * test/ruby/test_backtrace.rb: add a test for
- Thread::Backtrace::Location#inspect.
- BTW, tests for `caller_locations' are not enough.
- Any volunteers are welcome.
+Wed Aug 6 19:09:27 2014 Akinori MUSHA <knu@iDaemons.org>
-Sat Dec 1 21:06:58 2012 Koichi Sasada <ko1@atdot.net>
+ * 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
- * vm_backtrace.c (location_inspect_m): add
- Thread::Backtrace::Location#inspect.
- It same as loc_obj.to_s.inspect.
+Wed Aug 6 18:42:58 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-Sat Dec 1 19:24:09 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/win32ole/win32ole.c: separate src of WIN32OLERuntimeError
+ from win32ole.c.
- * io.c (rb_io_puts): recurse for the argument itself, not converted
- array elements. [ruby-core:42444] [Bug #5986]
+ * ext/win32ole/win32ole.h: ditto
+ * ext/win32ole/depend: ditto.
+ * ext/win32ole/win32ole_error.c: ditto.
+ * ext/win32ole/win32ole_error.h: ditto.
-Sat Dec 1 19:01:36 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Aug 6 04:33:58 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * marshal.c (w_object, r_object0): call private marshal methods.
- [Feature #6539]
+ * lib/net/http.rb (Net::HTTP.proxy_uri): use initializer instead
+ of parser to handle IPv6 address. [Bug #9129]
-Sat Dec 1 18:52:22 2012 Eric Hodel <drbrain@segment7.net>
+Wed Aug 6 04:16:05 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * lib/rubygems/commands/cleanup_command.rb: Fix cleanup command for
- multiple gems. [ruby-trunk - #7481] by Kouhei Sutou
- * test/rubygems/test_gem_commands_cleanup_command.rb: Test for above.
- * lib/rubygems.rb: Autoload Gem::Source to prevent test failures
+ * 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
-Sat Dec 1 18:17:00 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Aug 6 03:18:04 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * complex.c (Init_Complex), time.c (Init_Time): make marshal methods
- private. [Feature #6539]
+ * lib/net/http/generic_request.rb (Net::HTTP::GenericRequest#exec):
+ handle req['host'] in update_uri.
- * object.c (Init_Object): make remove_instance_variable public.
- [Feature #6539]
+ * 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]
- * id.c (Init_id), template/id.h.tmpl: add initialize_{copy,clone,dup}
- and respond_to_missing?.
+Wed Aug 6 03:17:34 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * vm_method.c (rb_method_entry_make): make above methods private.
- [Feature #6539]
+ * lib/net/http/generic_request.rb
+ (Net::HTTP::GenericRequest#update_uri):
+ handle scheme, host, and port to reflect connection to @uri.
-Sat Dec 1 16:40:22 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * lib/net/http.rb (Net::HTTP#begin_transport): move trivial handling
+ to Net::HTTP::GenericRequest#update_uri.
- * test/ruby/test_thread.rb: move ConditionVariable related test
- into test/thread/test_cv.rb.
- * test/thread/test_cv.rb: new file.
- * test/thread/test_cv.rb (test_condvar_empty_signal): new tests.
- * test/thread/test_cv.rb (test_condvar_empty_broadcast): ditto.
-Sat Dec 1 15:14:25 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Wed Aug 6 02:16:43 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * test/ruby/test_thread.rb (test_cv_wait_deadlock): enable
- cv deadlock test.
+ * lib/net/http/generic_request.rb
+ (Net::HTTP::GenericRequest#initialize):
+ optimize object allocation.
-Sat Dec 1 14:23:33 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Wed Aug 6 01:16:47 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * lib/thread.rb (ConditionVariable): use hash instead of array for
- @waiters.
- * test/thread/test_queue.rb (test_sized_queue_and_wakeup): remove
- a test because @waiters no longer have a chance to duplicated. Now it's
- a hash.
+ * lib/uri/generic.rb (URI::Generic#path_query): remove a private method.
-Sat Dec 1 17:16:54 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Aug 6 01:15:47 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * misc/ruby-electric.el (ruby-electric-curlies): use kill-region
- instead of interactive command delete-backward-char.
+ * lib/uri/generic.rb (URI::Generic#normalize!): use String#empty?
-Sat Dec 1 17:12:55 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/uri/generic.rb (URI::Generic#path_query): optimized.
- * misc/inf-ruby.el (inferior-ruby-mode): fix the
- compilation-shell-minor-mode configuration. a patch by
- j2petkov (Jean-Christophe Petkovich) in [ruby-core:46518].
- [Bug #6742]
+ * lib/uri/generic.rb (URI::Generic#to_s): optimized.
-Sat Dec 1 15:05:30 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Aug 6 00:15:10 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * dir.c (glob_helper): use NAMLEN() to tell the length of d_name
- instead of strlen(), which can access beyond the boundary.
+ * lib/uri/http.rb (URI::HTTP#request_uri): optimized.
+ decrease object allocation, and ensure always create at least one new
+ object for return value.
-Sat Dec 1 13:48:13 2012 Eric Hodel <drbrain@segment7.net>
+Wed Aug 6 03:41:21 2014 Aaron Patterson <aaron@tenderlovemaking.com>
- * lib/rubygems/specification.rb: Don't add default gems to $LOAD_PATH
- as they are already there.
+ * 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.
-Sat Dec 1 12:22:17 2012 Kouhei Sutou <kou@cozmixng.org>
+Tue Aug 5 19:27:59 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * re-added r38053 that is reverted by r38061. Problems by r38053
- are resolved by r38096. r38096 removed GEM_SKIP configuration.
+ * ext/win32ole/win32ole.c (ole_invoke): skip VariantClear when
+ argument is VT_RECORD variant.
- The below is ChangeLog of r38053:
+Tue Aug 5 15:52:51 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * defs/default_gems: Add base directory column.
+ * gems/bundled_gems: Upgrade to test-unit-3.0.0 and minitest-5.4.0.
- * tool/rbinstall.rb:
- - Install .gemspecs of default gem to
- #{GEM_HOME}/specifications/default/.
- - Update files parameter of .gemspecs by relative path from
- library directory.
+Mon Aug 4 21:50:09 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-Sat Dec 1 11:09:12 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+ * test/win32ole/test_win32ole_record.rb: add for WIN32OLE_RECORD
+ test(need .NET Framework 3.5 to run test).
- * variable.c (rb_class_path_no_cache): add a function to get the class
- path without caching the computed path. Some classes are frozen, and
- will raise an exception without this.
+Mon Aug 4 19:49:34 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * probes.d (cmethod-entry, cmethod-return): separate cmethods from
- regular methods to match set trace func.
+ * ext/win32ole/win32ole.c (ole_invoke): call rb_hash_foreach instead
+ of rb_block_call.
- * probes_helper.h: refactor macros. Fix probes to avoid calling
- #inspect when profiling.
+ * ext/win32ole/win32ole.c: add comment for rdoc of WIN32OLE_VARIANT
+ class.
- * insns.def: update for use with new macros.
+Mon Aug 4 09:12:47 2014 Eric Wong <e@80x24.org>
- * vm_eval.c: ditto
+ * variable.c: cleanup to use rb_const_lookup
+ [Feature #10107]
* vm_insnhelper.c: ditto
- * test/dtrace/test_singleton_function.rb: fix test for new output.
-
- * test/dtrace/test_cmethod.rb: test the cmethod probes.
-
-Sat Dec 1 09:44:16 2012 Eric Hodel <drbrain@segment7.net>
-
- * test/rdoc/test_rdoc_options.rb: Windows drive letters are
- case-insensitive.
-
-Sat Dec 1 09:42:13 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems.rb: Search for gem deps file up the directory tree.
- * test/rubygems/test_gem.rb: Test for above.
-
-Sat Dec 1 09:33:32 2012 Eric Hodel <drbrain@segment7.net>
-
- * test/runner.rb: Set GEM_HOME, GEM_PATH and GEM_SKIP to empty set.
- With default_gem support in RubyGems GEM_SKIP prevents loading of
- built-in gems.
-
-Sat Dec 1 07:16:17 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * compile.c (ADD_CATCH_ENTRY): add a cast to fix SEGV with x64 mingw
- on Windows 8. Without cast, 0 might be non zero value at higher bits
- in rb_ary_new3().
- [ruby-core:50258] [Bug #7456]
-
-Sat Dec 1 04:07:57 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * parse.y (parser.utf8): remove unused property.
-
- * parse.y (UTF8_ENC): remove unused macro.
-
- * parse.y (parser_tokadd_utf8): use rb_utf8_encoding() directly.
-
-Sat Dec 1 03:49:45 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * lib/sync.rb (Sync_m#sync_synchronize): add Thread.async_interrupt_timing
- for protecting from async interrupt.
- * lib/sync.rb (Sync_m#sync_lock): ditto.
-
-Sat Dec 1 03:38:04 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * lib/thread.rb (ConditionVariable#broadcast): s/RuntimeError/StandardError/
- * lib/thread.rb (ConditionVariable#signal): ditto.
-
-Sat Dec 1 03:29:52 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * lib/thread.rb (SizedQueue#pop): rewrite by using ConditionVariable.
- * lib/thread.rb (SizedQueue#push): ditto.
- * lib/thread.rb (SizedQueue#max): ditto.
- * lib/thread.rb (Queue#pop): ditto.
- * lib/thread.rb (Queue#push): ditto.
-
- * lib/thread.rb (SizedQueue#num_waiting): adopt the above changes.
- * lib/thread.rb (SizedQueue#initialize): ditto.
- * lib/thread.rb (Queue#num_waiting): ditto.
- * lib/thread.rb (Queue#initialize): ditto.
- * test/thread/test_queue.rb (test_sized_queue_and_wakeup): ditto.
-
-Sat Dec 1 03:45:47 2012 Koichi Sasada <ko1@atdot.net>
-
- * thread.c (Thread.async_interrupt_timing): fix RDoc.
- :never is not used any more.
-
-Sat Dec 1 02:56:19 2012 Koichi Sasada <ko1@atdot.net>
-
- * iseq.c: add RubyVM::InstructionSequence (ISeq) inspection methods.
- * ISeq#path returns path of this ISeq written.
- * ISeq#absolute_path returns absolute path.
- * ISeq#label returns label (method name and so on).
- * ISeq#base_label returns base label (see Thread::Backtrace::Location).
- * ISeq#first_lineno returns first line number of this ISeq.
- * ISeq.of(obj) returns ISeq object which obj (Proc or Method)
- is contains.
-
- * test/ruby/test_iseq.rb: add tests.
-
-Sat Dec 1 02:58:51 2012 Eric Hodel <drbrain@segment7.net>
-
- * include/ruby/ruby.h (rb_event_flag_t): Maintain integer precision
- for clang error (VALUE aka unsigned long vs unsigned int)
-
-Sat Dec 1 02:53:18 2012 Eric Hodel <drbrain@segment7.net>
-
- * test/rubygems/test_gem_dependency_installer.rb: Use Gem.read_binary
- instead of File.binread for ruby 1.8 compatibility in the rubygems
- source repository. Updates r38075
-
-Sat Dec 1 02:33:20 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (rb_threadptr_interrupt_mask, async_interrupt_timing_func):
- merge into them into rb_thread_s_async_interrupt_timing.
- * thread.c (rb_thread_s_async_interrupt_timing): ditto.
-
-Sat Dec 1 02:11:47 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (rb_threadptr_interrupt_mask): add argument check.
- * thread.c (async_interrupt_timing_arg_check_i): helper function
- for the above.
- * test/ruby/test_thread.rb (test_async_interrupt_timing_invalid_argument):
- test for the above.
-
-Sat Dec 1 01:19:34 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * lib/thread.rb (ConditionVariable#broadcast): protect from
- async interrupt by using Thread.async_interrupt_timing.
- * lib/thread.rb (ConditionVariable#signal): ditto.
- * lib/thread.rb (ConditionVariable#wait): ditto.
-
-Sat Dec 1 02:04:23 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * test/ruby/envutil.rb (Test::Unit::Assertions#assert_in_out_err):
- raise if assert_in_out_err misused.
-
-Sat Dec 1 02:08:16 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/rdoc/test_rdoc_rubygems_hook.rb
- (TestRDocRubygemsHook#test_setup_unwritable): 1. check the existence
- of the file(directory) before touch it. 2. remove test
- file(directory) after the test. see [ruby-core:50388].
-
-Sat Dec 1 01:51:06 2012 Koichi Sasada <ko1@atdot.net>
-
- [EXPERIMENTAL]
- * iseq.c: add following two methods.
- * ISeq#line_trace_all returns all line traces (line numbers)
- * ISeq#line_trace_specify(pos, set) set `pos'th line event to
- specified_line event (if set is true).
- These features are introduced for debuggers (mainly to make
- breakpoint).
-
- * iseq.h: add decl. of C APIs.
-
- * test/ruby/test_iseq.rb: add tests.
-
- * vm_trace.c: add `specified_line' event.
-
- * include/ruby/ruby.h: ditto.
-
-Sat Dec 1 01:49:52 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/rubygems/test_gem_dependency_installer.rb: gems are of course
- binary files, so use a binary reading method when reading it.
- see [ruby-core:50388].
+Sun Aug 3 10:55:07 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Dec 1 01:21:07 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * include/ruby/encoding.h (rb_check_symbol_cstr): ditto.
- * lib/rubygems/command.rb (Gem::Command#get_all_gem_names_and_versions):
- who assumes that the pathname of a gem never contains ':' ?
- yes, on Unixen pathnames can contain ':', and on Windows they almost
- certainly contain ':'. see [ruby-core:50388].
+Sun Aug 3 10:43:08 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/rubygems/requirement.rb (Gem::Requirement::PATTERN_RAW): extract
- the regexp to match the version specifier from PATTERN to use in
- above method.
+ * 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 Dec 1 00:48:19 2012 Naohisa Goto <ngotogenome@gmail.com>
+Sat Aug 2 23:47:45 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * ext/fiddle/extconf.rb, ext/fiddle/function.c
- (Fiddle::Function::STDCALL): FFI_STDCALL is not a macro, but an
- enumeration. [ruby-core:50398] [Bug #7483]
+ * 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 Dec 1 00:08:55 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Sat Aug 2 14:34:58 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * test/rubygems/test_gem_installer.rb
- (TestGemInstaller#test_check_executable_overwrite_other_non_gem):
- on Windows, rubygems always generate a wrapper .bat file when
- installing a file into bin, so testing no-overwrite a wrapper file
- and a non-wrapper file is nonsense. see [ruby-core:50388].
+ * ext/win32ole/win32ole.c: add comments for rdoc.
-Fri Nov 30 23:39:58 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Sat Aug 2 10:26:57 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/rubygems/test_gem_installer.rb
- (TestGemInstaller#test_check_executable_overwrite_default_bin_dir):
- if the executable to be overwritten was generated by rubygems, the
- error message differs from the only copied one's.
- see [ruby-core:50388].
+ * 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 Nov 30 23:27:26 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri Aug 1 22:30:40 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * test/rubygems/test_gem_ext_ext_conf_builder.rb
- (TestGemExtExtConfBuilder::test_class_make): reading with binary mode
- of course introduce \r on Windows. see [ruby-core:50388].
+ * ext/win32ole/win32ole.c (folerecord_initialize): accept
+ only 2 arguments. The 2nd argument should be WIN32OLE object or
+ WIN32OLE_RECORD object.
-Fri Nov 30 23:11:37 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri Aug 1 20:17:33 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * lib/rubygems/specification.rb
- (Gem::Specification.validate_permissions): don't check executability
- of the source on Windows. they will be wrapped to .bat files when
- installing. see [ruby-core:50388].
+ * ext/win32ole/win32ole.c (ole_variant2val): call
+ folerecord_s_allocate instead of WIN32OLE_RECORD.new.
-Fri Nov 30 22:44:14 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Fri Aug 1 18:39:57 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * vm_core.h (rb_vm_struct): add thread_destruct_lock field.
- * thread.c (Init_Thread): ditto.
- * thread.c (rb_vm_gvl_destroy): ditto.
-
- * thread.c (thread_start_func_2): make sure vm->running_thread
- don't point to dead thread.
- * thread.c (timer_thread_function): close a race against thread
- destruction. [Bug #4911][ruby-dev:43859]
-
- * vm_core.h (rb_thread_set_current): reset running time of
- current thread instead of previous thread. We no longer
- assume previous running thread still live.
-
-Fri Nov 30 21:57:43 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * revert r38053 because it causes too many test failures.
- if you've already installed r38053 or later, remove the installed
- lib/ruby/gems/2.0.0 directory and reinstall this revision or later.
-
-Fri Nov 30 21:07:56 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * lib/test/unit/parallel.rb (Test::Unit::Worker.run): wrap LoadError
- because it's Gem::LoadError sometimes. see [Bug #6882]
-
-Fri Nov 30 20:47:44 2012 Koichi Sasada <ko1@atdot.net>
-
- * thread.c: TracePoint#self returns invoking/exiting thread object
- at thread_begin/end event.
-
- * test/ruby/test_settracefunc.rb: fix test.
-
-Fri Nov 30 19:55:17 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/memory_status.rb (Memory::Win32): use fiddle instead of dl,
- but I doubt fiddle is not compatible with dl. (if you are interested,
- see the diff.) [ruby-core:50194] [Bug #7443]
-
-Fri Nov 30 19:37:44 2012 Kouhei Sutou <kou@cozmixng.org>
-
- * defs/default_gems: Add base directory column.
-
- * tool/rbinstall.rb:
- - Install .gemspecs of default gem to
- #{GEM_HOME}/specifications/default/.
- - Update files parameter of .gemspecs by relative path from
- library directory.
-
-Fri Nov 30 19:30:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * vm_trace.c:
- tracepoint_attr_return_value (TracePoint#return_value):
- include `:b_return` for method doc
- tracepoint_enable_m, tracepoint_disable_m (#enable/#disable):
- don't have block argument, document block scope
-
-Fri Nov 30 18:52:56 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_trace.c (tracepoint_disable_m, tracepoint_enable_m):
- fix block parameter.
- No argument should be given to a block which is passed
- to TracePoint#enable (and disable).
-
-Fri Nov 30 18:23:26 2012 Koichi Sasada <ko1@atdot.net>
-
- * thread.c: rename Thread.control_interrupt
- to Thread.async_interrupt_timing.
- The option name `:never' is also changed to `:defer'.
- [ruby-core:50375] [ruby-trunk - Feature #6762]
-
- * thread.c: remove Thread.check_interrupt.
- This method is difficult to understand by name.
-
- * thread.c: add Thread.async_interrupted?.
- This method check any deferred async interrupts.
-
- * test/ruby/test_thread.rb: change tests for above.
-
-Fri Nov 30 18:24:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * vm_trace.c: Documentation for TracePoint API
- [ruby-core:47243] [Feature #6895]
+ * 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 Nov 30 17:43:50 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Aug 1 16:35:32 2014 Evan Miller <evan@squareup.com>
- * string.c (rb_str_cmp_m): try to compare with to_str result if
- possible before calling <=> method. [ruby-core:49279] [Bug #7342]
+ * numeric.c (flodivmod): all results are NaN if divisor is NaN.
+ [fix GH-692]
- * string.c (rb_str_cmp_m): use rb_check_funcall instead of respond_to
- and call.
+Thu Aug 01 07:28:12 2014 Kenta Murata <mrkn@mrkn.jp>
- * string.c (rb_str_cmp_m): return fixed value, one of -1,0,+1 always.
+ * 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
-Fri Nov 30 16:19:14 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Jul 31 22:20:12 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * vm_dump.c (rb_vm_bugreport): get rid of calling methods in sigsegv
- handler. based on a patch by charliesome (Charlie Somerville)
- [ruby-core:49573] [Bug #7402]
+ * ext/win32ole/win32ole.c: add WIN32OLE_RECORD#inspect.
-Fri Nov 30 16:05:44 2012 Eric Hodel <drbrain@segment7.net>
+Thu Jul 31 20:35:32 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * NEWS: Added RubyGems 2.0.0
+ * ext/win32ole/win32ole.c: add
+ WIN32OLE_RECORD#ole_instance_variable_set and
+ WIN32OLE_RECORD#ole_instance_variable_get
-Fri Nov 30 15:24:37 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Jul 30 23:28:10 2014 Kazuki Tsujimoto <kazuki@callcc.net>
- * parse.y (parser_yylex): fix false usage of local variable, it cannot
- appear in fname state [ruby-core:49659] [Bug #7408]
+ * sprintf.c (rb_str_format): like r47006, get rid of
+ function calls in RSTRING_PTR().
-Fri Nov 30 15:20:12 2012 Eric Hodel <drbrain@segment7.net>
+Wed Jul 30 22:10:29 2014 Kazuki Tsujimoto <kazuki@callcc.net>
- * lib/rubygems/package.rb: Load YAML for building gems.
- * test/rubygems/test_gem_commands_contents_command.rb: Sort expected
- output of default gem contents. Re-fixes r38004 and r38005.
+ * process.c (rlimit_resource_type, rlimit_resource_value):
+ get rid of inadvertent dynamic symbol pin-down.
-Fri Nov 30 15:15:00 2012 Zachary Scott <zachary@zacharyscott.net>
+ * re.c (match_backref_number): ditto.
- * vm_trace.c (set_trace_func): Formatting of params and events
+ * signal.c (esignal_init, rb_f_kill, trap_signm): ditto.
-Fri Nov 30 14:45:00 2012 Zachary Scott <zachary@zacharyscott.net>
+ * transcode.c (econv_opts): ditto.
- * lib/net/http.rb: Net::HTTP::Patch to list of HTTP Request Classes
- Patch by Ryunosuke SATO [Fixes #217 on github]
+ * vm_trace.c (symbol2event_flag): ditto.
-Fri Nov 30 14:05:00 2012 Zachary Scott <zachary@zacharyscott.net>
+Wed Jul 30 21:29:39 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * lib/cgi.rb: CGI example for HTML generation
- Patch by Marcus Stollsteimer [ruby-core:50303] [Bug #7465]
+ * ext/win32ole/win32ole.c (ole_invoke): pass WIN32OLE_RECORD variant
+ by reference when invoke OLE methods at first.
-Fri Nov 30 13:52:00 2012 Zachary Scott <zachary@zacharyscott.net>
+ * ext/win32ole/win32ole.c (olerecord_set_ivar): release
+ IRecordInfo interface before setting another IRecordInfo interface.
- * time.c: Documentation improvements, grammar and formatting
- Patch by Bernd Homuth [ruby-core:49203] [Bug #7326]
+Wed Jul 30 13:17:35 2014 Koichi Sasada <ko1@atdot.net>
-Fri Nov 30 13:48:33 2012 Eric Hodel <drbrain@segment7.net>
+ * gc.c: remove unused macros.
- * lib/rdoc.rb: Set version to 4.0.0.preview2
- * lib/rubygems.rb: Set version to 2.0.0.preview2
+Tue Jul 29 22:21:37 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-Fri Nov 30 13:11:53 2012 Eric Hodel <drbrain@segment7.net>
+ * ext/win32ole/win32ole.c (hash2olerec): ignore WIN32OLE_RECORD
+ instance variable if the variable is nil.
- * lib/rubygems/commands/setup_command.rb: Remove old files on install
- of RubyGems. (not by rbinstall.rb).
- * test/rubygems/test_gem_commands_setup_command.rb: Test for above.
+Tue Jul 29 19:43:27 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-Fri Nov 30 12:47:59 2012 Akinori MUSHA <knu@iDaemons.org>
+ * ext/win32ole/win32ole.c (folerecord_method_missing): refactoring.
+ divide functionality of folerecord_method_missing into
+ olerecord_ivar_set and olerecord_ivar_get.
- * lib/abbrev.rb (Abbrev#abbrev): A fixed string prefix pattern
- should only match the beginning of each word, not the beginning
- of every line in it.
+Mon Jul 28 20:20:08 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * lib/abbrev.rb (Abbrev#abbrev): Stop using a regexp that causes a
- false warning. [Bug #7471]
+ * ext/win32ole/win23ole.c (folerecord_method_missing): support
+ setter of member of WIN32OLE_RECORD object.
-Fri Nov 30 12:30:55 2012 Akinori MUSHA <knu@iDaemons.org>
+Mon Jul 28 06:37:19 2014 Zachary Scott <e@zzak.io>
- * test/test_abbrev.rb: Add tests for lib/abbrev.rb.
+ * vm_eval.c: [DOC] Fix rdoc formatting of patch from [Bug #9551]
-Fri Nov 30 12:27:51 2012 Eric Hodel <drbrain@segment7.net>
+Mon Jul 28 06:34:43 2014 Zachary Scott <e@zzak.io>
- * lib/rubygems/spec_fetcher.rb: Allow prerelease spec fetching to fail
- for bundler.
- * test/rubygems/test_gem_spec_fetcher.rb: Test for above.
+ * vm_eval.c: [DOC] [Bug #9551] Improve clarity of Kernel::catch
+ documentation, patch by Jesse Sielaff.
-Fri Nov 30 12:20:53 2012 Eric Hodel <drbrain@segment7.net>
+Mon Jul 28 06:24:54 2014 Zachary Scott <e@zzak.io>
- * lib/rake/backtrace.rb: Removed duplication in
- Rake::Backtrace::SUPPRESSED_PATHS
- * test/rake/test_rake_backtrace.rb: Skip tests when tmpdir is in the
- suppressed pattern.
+ * lib/uri/common.rb: [DOC] [Bug #9563] Recommend using URI.escape
+ before parsing a uri to avoid invalid characters. Reported by
+ Evgeniy Serykh.
-Fri Nov 30 11:07:45 2012 Shugo Maeda <shugo@ruby-lang.org>
+Mon Jul 28 05:55:56 2014 Zachary Scott <e@zzak.io>
- * revert r37993 to avoid SEGV in tests.
+ * 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]
-Fri Nov 30 10:38:54 2012 Eric Hodel <drbrain@segment7.net>
+ * lib/time.rb: ditto
- * lib/rdoc/ri/driver.rb: Relaxed matching for pages to be more
- user-friendly.
- * test/rdoc/test_rdoc_ri_driver.rb: Test for above.
+Mon Jul 28 05:32:06 2014 Zachary Scott <e@zzak.io>
-Fri Nov 30 09:50:16 2012 Eric Hodel <drbrain@segment7.net>
+ * lib/uri/common.rb: [DOC] [Bug #10075] Clarify how URI.join arguments
+ are handled by RFC3986, originally reported by John Feminella.
- * lib/rdoc/markdown.rb: Fixed warnings with -w
+Mon Jul 28 05:21:41 2014 Zachary Scott <e@zzak.io>
-Fri Nov 30 09:38:22 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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]
- * include/ruby/ruby.h (RB_GC_GUARD_PTR): add note.
+Mon Jul 28 05:12:22 2014 Zachary Scott <e@zzak.io>
- * vm_backtrace.c (backtrace_to_str_ary): use RB_GC_GUARD() instead of
- RB_GC_GUARD_PTR() which has no effect.
- (backtrace_to_location_ary): ditto.
- (vm_backtrace_to_ary): ditto.
+ * 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]
-Fri Nov 30 09:22:52 2012 Eric Hodel <drbrain@segment7.net>
+Mon Jul 28 04:39:58 2014 Zachary Scott <e@zzak.io>
- * lib/rubygems/commands/contents_command.rb: Sort output from command.
- Replaces r38004, r38005
- * test/rubygems/test_gem_commands_contents_command.rb: ditto.
-
- * lib/rubygems/defaults.rb: Use Gem.path_separator for jruby support.
- * lib/rubygems/path_support.rb: ditto
-
-Fri Nov 30 08:34:03 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc/generator/darkfish.rb: Silenced warning
- * test/rdoc/test_rdoc_rdoc.rb: ditto
-
- * lib/rdoc/markup/parser.rb: Use byteslice when available for
- performance
- * test/rdoc/test_rdoc_markup_parser.rb: Test for above
- * lib/rdoc/test_case.rb: ditto
-
- * lib/rdoc/parser/ruby.rb: Fixed bug parsing yield({})
- * test/rdoc/test_rdoc_parser_ruby.rb (end):
-
- * lib/rdoc/rubygems_hook.rb: Skip default gems. Display generator
- name properly.
- * test/rdoc/test_rdoc_rubygems_hook.rb: Test for above
-
- * lib/rdoc/servlet.rb: Fixed typo.
-
-Fri Nov 30 08:09:56 2012 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c : remove a unused function.
-
-Fri Nov 30 07:46:42 2012 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c (rb_objspace_call_finalizer): finalize_deferred may free up
- a object which is reachable from a part after this function,
- e.g. ruby_vm_destruct(). [ruby-dev:46647] [Bug #7452]
-
- * test/ruby/test_gc.rb (test_finalizing_main_thread): add a test
- for above.
-
-Fri Nov 30 07:43:44 2012 Koichi Sasada <ko1@atdot.net>
-
- * thread.c (rb_thread_interrupted): avoid warning of
- implicit conversion.
-
- * thread.c (rb_threadptr_execute_interrupts): ditto.
-
-Fri Nov 30 07:34:28 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_backtrace.c: add GC guards.
-
-Fri Nov 30 07:21:33 2012 Koichi Sasada <ko1@atdot.net>
-
- [EXPERIMENTAL: NEED DISCUSS]
- * vm_trace.c: add events
- * :thread_begin - hook at thread beginning.
- * :thread_end - hook at thread ending.
- * :b_call - hook at block enter.
- * :b_return - hook at block leave.
- This change slow down block invocation.
- Please try and give us feedback until 2.0 code freeze.
-
- * include/ruby/ruby.h: ditto.
-
- * compile.c (rb_iseq_compile_node): ditto.
-
- * insns.def: ditto.
-
- * thread.c: ditto.
-
- * vm.c: ditto.
+ * 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
- * include/ruby/debug.h: add a comment.
+Mon Jul 28 04:35:35 2014 Zachary Scott <e@zzak.io>
- * test/ruby/test_settracefunc.rb: add a tests.
+ * ext/openssl/ossl_hmac.c: Fix NO_HMAC warning [Fixes GH-665]
+ Patched by @vipulnsward https://github.com/ruby/ruby/pull/665
-Fri Nov 30 06:56:30 2012 Ryan Davis <ryand-ruby@zenspider.com>
+Sun Jul 27 19:49:36 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * test/minitest/*: Imported minitest 4.3.2 (r8027)
+ * 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.
-Fri Nov 30 04:16:29 2012 Eric Hodel <drbrain@segment7.net>
+Sun Jul 27 05:11:21 2014 Zachary Scott <e@zzak.io>
- * lib/rake/*: Updated to rake 0.9.5
- * test/rake/*: ditto.
- * NEWS: ditto.
+ * 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
-Fri Nov 30 02:53:47 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+Sun Jul 27 02:41:50 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * vm.c: add a return hook when a method raises an exception.
+ * lib/shell/command-processor.rb: remove unused variable.
+ * lib/shell/system-command.rb: ditto.
+ * lib/tmpdir.rb: ditto.
+ * lib/uri/generic.rb: ditto.
- * probes_helper.h: look up klass and method if none are provided.
+Sun Jul 27 02:08:31 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * eval.c: update macro usage.
+ * lib/weakref.rb: split executable code into sample directory.
+ * sample/weakref.rb: ditto.
- * vm_eval.c: ditto.
+Sun Jul 27 02:06:55 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * vm_insnhelper.c: ditto.
+ * lib/delegate.rb: split executable code into sample directory.
+ * sample/delegate.rb: ditto.
- * test/dtrace/test_function_entry.rb: test for change.
+Sun Jul 27 01:46:34 2014 Zachary Scott <e@zzak.io>
-Fri Nov 30 02:27:12 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * proc.c (method_super_method): [DOC] Method#super_method
- * compile.c (compile_array_): refix r37991 remove assertion:
- it is true only if type == COMPILE_ARRAY_TYPE_HASH.
- [ruby-dev:46658] [Bug #7466]
+Sun Jul 27 01:22:39 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm.c (m_core_hash_from_ary): add assertion instead of above.
+ * 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]
- * vm.c (m_core_hash_merge_ary): ditto.
+Sat Jul 26 17:22:14 2014 URABE Shyouhei <shyouhei@ruby-lang.org>
-Thu Nov 29 19:15:14 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/objspace/objspace_dump.c (dump_append): avoid fflush.
- * compile.c (compile_array_): hash elements must be paired even for
- literal elements. [ruby-dev:46658] [Bug #7466]
+ 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.
-Thu Nov 29 22:39:35 2012 Naohisa Goto <ngotogenome@gmail.com>
+Sat Jul 26 16:55:18 2014 Eric Wong <e@80x24.org>
- * ext/openssl/ossl_ssl.c (ssl_npn_encode_protocol_i): fix byte order
- issue on big-endian architecture [ruby-core:50292] [Bug #7463]
+ * iseq.h (struct iseq_compile_data_storage): reduce overhead
+ to 16 bytes (from 32) on 64-bit
-Thu Nov 29 22:23:31 2012 Hiroshi Nakamura <nahi@ruby-lang.org>
+Sat Jul 26 16:28:06 2014 Eric Wong <e@80x24.org>
- * test/openssl/test_cipher.rb (test_ctr_if_exists): add CTR mode test
- if underlying OpenSSL supports it. See #4408
+ * vm_core.h (struct rb_iseq_struct): reduce to 280 bytes
+ (from 288 bytes) on 64-bit
-Thu Nov 29 21:42:16 2012 Shugo Maeda <shugo@ruby-lang.org>
+Sat Jul 26 06:44:43 2014 Eric Wong <e@80x24.org>
- * vm_method.c (rb_method_entry_make): add a method entry with
- VM_METHOD_TYPE_REFINED to the class refined by the refinement if
- the target module is a refinement. When a method entry with
- VM_METHOD_TYPE_UNDEF is invoked by vm_call_method(), a method with
- the same name is searched in refinements. If such a method is
- found, the method is invoked. Otherwise, the original method in
- the refined class (rb_method_definition_t::body.orig_def) is
- invoked. This change is made to simplify the normal method lookup
- and to improve the performance of normal method calls.
+ * parse.y (struct parse_params): shrink to 320 to 304 bytes on 64-bit
- * vm_method.c (EXPR1, search_method, rb_method_entry),
- vm_eval.c (rb_call0, rb_search_method_entry): do not use
- refinements for method lookup.
+Sat Jul 26 05:58:35 2014 Eric Wong <e@80x24.org>
- * vm_insnhelper.c (vm_call_method): search methods in refinements if
- ci->me is VM_METHOD_TYPE_REFINED. If the method is called by
- super (i.e., ci->call == vm_call_super_method), skip the same
- method entry as the current method to avoid infinite call of the
- same method.
+ * 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
- * class.c (include_modules_at): add a refined method entry for each
- method defined in a module included in a refinement.
+Sat Jul 26 05:54:54 2014 Eric Wong <e@80x24.org>
- * class.c (rb_prepend_module): set an empty table to
- RCLASS_M_TBL(klass) to add refined method entries, because
- refinements should have priority over prepended modules.
+ * symbol.c (dsymbol_check): remove unneeded semi-colon
- * proc.c (mnew): use rb_method_entry_with_refinements() to get
- a refined method.
+Fri Jul 25 14:07:27 2014 Koichi Sasada <ko1@atdot.net>
- * test/ruby/test_refinement.rb (test_inline_method_cache): do not skip
- the test because it should pass successfully.
+ * 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.
- * test/ruby/test_refinement.rb (test_redefine_refined_method): new
- test for the case a refined method is redefined.
+ * gc.c (gc_marks_body): should clear parent_object just before
+ gc_mark_roots() because there are no parents objects
+ for root objects.
-Thu Nov 29 17:45:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Jul 25 13:45:39 2014 Koichi Sasada <ko1@atdot.net>
- * variable.c (rb_const_set): show namespace in warning messages.
- [Feature #7190]
+ * gc.c (rb_gc_writebarrier_remember_promoted): should remember only
+ OLD objects on RGENGC_AGE2_PROMOTION.
-Thu Nov 29 17:31:53 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Fri Jul 25 13:42:02 2014 Koichi Sasada <ko1@atdot.net>
- * lib/rubygems.rb (Gem.load_yaml): return if Kernel#gem is not defined
- yet. This causes crash if test-all requires libraries in a certain
- order. A simple reproducible code is
- ruby --disable-gem -e'require"yaml";require"minitest/autorun"'
+ * gc.c (gc_mark_stacked_objects): fix error message.
-Thu Nov 29 17:19:26 2012 Eric Hodel <drbrain@segment7.net>
+Fri Jul 25 13:18:00 2014 Will Farrington <wfarrington@digitalocean.com>
- * lib/tracer.rb: Updated to match removal of custom_require from
- RubyGems.
- * test/test_tracer.rb: ditto. Improved failure message if the test
- fails
+ * ext/socket/socket.c (sock_gethostname): Use NI_MAXHOST to support
+ hostnames longer than 64 characters if the system supports it.
+ [fixes GH-683]
-Thu Nov 29 17:15:00 2012 Zachary Scott <zachary@zacharyscott.net>
+Fri Jul 25 12:21:11 2014 Santiago Pastorino <santiago@wyeworks.com>
- * gc.c: Documentation for GC, GC::Profiler, ObjectSpace, and
- ObjectSpace::WeakMap [ruby-core:50245] [Bug #7449]
+ * compile.c (defined_expr): make the condition if the receiver
+ is explicit or implicit cleaner. [fix GH-681]
-Thu Nov 29 17:12:26 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Jul 25 03:53:52 2014 Eric Hodel <drbrain@segment7.net>
- * tool/generic_erb.rb, tool/id2token.rb: add --path-separator option
- for mingw where make and built ruby live in different world.
+ * doc/keywords.rdoc: [DOC] Describe each keyword.
- * tool/vpath.rb: extract from tool/instruction.rb.
+Thu Jul 24 22:40:24 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-Thu Nov 29 17:11:06 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/io/wait/test_io_wait.rb (TestIOWait#fill_pipe):
- Errno::EWOULDBLOCK may not be the same as Errno::EAGAIN. patch by
- phasis68 (Heesob Park) at [ruby-core:49894]. [Bug #7420]
-
-Thu Nov 29 17:03:38 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/test_case.rb: Determine path to certificates to avoid
- build-dir problems.
- * test/rubygems/test_gem_security_signer.rb: Use predetermined paths
- to avoid build-dir problems.
-
-Thu Nov 29 16:18:14 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/test_case.rb: Disable loading of keys and certificates
- outside rubygems or ruby tests as the files are not available (or
- necessary).
-
-Thu Nov 29 16:14:41 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_backtrace.c (rb_debug_inspector_open): use RARRAY_LENINT() for
- int variable.
-
-Thu Nov 29 15:59:55 2012 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/debug.h: add rb_debug_inspector_* APIs.
-
- * vm_backtrace.c: ditto.
-
- * common.mk: add dependency from vm_backtrace.o to
- include/ruby/debug.h.
-
- * proc.c (rb_binding_new_with_cfp): constify.
-
- * vm.c (rb_vm_get_ruby_level_next_cfp): constify.
-
- * vm_core.h, vm_trace.c: move decls.
-
-Thu Nov 29 15:56:14 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/rdoc/test_case.rb (RDoc::TestCase#verbose_capture_io):
- defined for asserts of warnings.
-
- * test/rdoc: use verbose_capture_io on asserts of warnings.
- they failed when tests was run with RUBYOPT=-W0.
-
-Thu Nov 29 15:53:38 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/psych/extconf.rb: added --enable-bundled-libyaml option. this
- enforces using bundled libyaml.
-
-Thu Nov 29 15:51:54 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems*: Updated to RubyGems 2.0
- * test/rubygems*: ditto.
-
- * common.mk (prelude): Updated for RubyGems 2.0 source rearrangement.
-
- * tool/change_maker.rb: Allow invalid UTF-8 characters in source
- files.
-
-Thu Nov 29 15:38:14 2012 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/debug.h: provide rb_tracearg_*() APIs,
- instead of rb_tracepoint_attr_*().
- These APIs are for debuggers/profilers.
- They will be explained in another docs sometime.
-
- * vm_trace.c: ditto.
-
-Thu Nov 29 15:10:45 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * test/minitest/test_minitest_unit.rb: restore orig_verbose only
- if it is set. This broke rdoc's tests.
- http://u64.rubyci.org/~chkbuild/ruby-trunk/log/20121129T050102Z.diff.html.gz
-
-Thu Nov 29 14:56:30 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_trace.c (rb_tracepoint_attr_method_id):
- rename TracePoint#id to TracePoint#method_id.
-
- * include/ruby/debug.h: ditto.
-
- * test/ruby/test_settracefunc.rb: ditto,
-
-Thu Nov 29 14:49:10 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_trace.c (rb_tracepoint_attr_defined_class):
- rename TracePoint#klass to TracePoint#defined_class.
- [ruby-core:50187] Re: [ruby-trunk - Feature #6895]
-
- * include/ruby/debug.h: ditto.
-
- * test/ruby/test_settracefunc.rb: ditto.
-
-Thu Nov 29 14:27:57 2012 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (gc_stat): prepare Symbol objects at first time
- to make it fast.
-
-Thu Nov 29 14:02:15 2012 Koichi Sasada <ko1@atdot.net>
+ * ext/win32ole/win32ole.c (Init_win32ole): add WIN32OLE_RECORD#initialize
+ method.
- * gc.c (gc_stat): GC.stat supports new information
- * total_allocated_object: total allocated object number.
- * total_freed_object: total freed object number.
- Above two numbers are only accumulated and they will
- overflow (return to 0). Please use them as a hint.
+ * ext/win32ole/win32ole.c (ole_val2variant): convert WIN32OLE_RECORD
+ object to VT_RECORD variant.
-Thu Nov 29 12:13:54 2012 Ryan Davis <ryand-ruby@zenspider.com>
+Thu Jul 24 20:10:59 2014 Koichi Sasada <ko1@atdot.net>
- * lib/minitest/*: Imported minitest 4.3.2 (r8026)
- * test/minitest/*: ditto
+ * 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.
-Thu Nov 29 11:06:06 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * test/ruby/test_gc.rb: catch up.
- * thread.c (thread_start_func_2): remove unused code. When
- th->safe_level == 4, th->errinfo never be thrown. So, to
- create new exception makes no sense.
+Thu Jul 24 15:55:02 2014 Naohisa Goto <ngotogenome@gmail.com>
-Thu Nov 29 10:29:53 2012 Koichi Sasada <ko1@atdot.net>
+ * 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]
- * vm_backtrace.c: same as a last patch.
+Thu Jul 24 04:42:13 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Thu Nov 29 10:24:25 2012 Koichi Sasada <ko1@atdot.net>
+ * lib/benchmark.rb: split executable code into sample directory.
+ * sample/benchmark.rb: ditto.
- * vm_backtrace.c: use `long' for return values of `NUM2LONG()'.
+Thu Jul 24 04:36:49 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Thu Nov 29 09:52:08 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * lib/tempfile.rb: split executable code into sample directory.
+ * sample/tempfile.rb: ditto.
- * thread.c (do_select): suppress warning (uninitialized value warning)
- with UNINITIALIZED_VAR().
+Thu Jul 24 04:29:36 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Thu Nov 29 09:36:09 2012 Koichi Sasada <ko1@atdot.net>
+ * lib/pstore.rb: split executable code into sample directory.
+ * sample/pstore.rb: ditto.
- * eval.c (ruby_cleanup): delay THREAD_KILLED timing.
- It should be located just before rb_thread_terminate_all().
+Wed Jul 23 23:50:11 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Nov 29 09:10:17 2012 Koichi Sasada <ko1@atdot.net>
+ * 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]
- * vm_backtrace.c (vm_backtrace_to_ary): support range argument
- like Array#[].
- [ruby-core:50092] [ruby-trunk - Feature #7434]
- Test and document is not available. Please help us.
+ * regint.h (PLATFORM_UNALIGNED_WORD_ACCESS): ditto.
-Thu Nov 29 06:46:33 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Wed Jul 23 04:04:38 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * thread.c (thread_start_func_2): small cleanups.
+ * lib/drb/extserv.rb: remove duplicate code with sample directory.
+ contributed from @vipulnsward. [fix GH-679]
-Thu Nov 29 06:37:08 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Tue Jul 22 12:56:24 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * thread.c (thread_start_func_2): remove unused code.
- this function never be used for main thread.
+ * 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]
-Thu Nov 29 06:27:55 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Tue Jul 22 01:48:38 2014 Eric Wong <e@80x24.org>
- * thread.c (thread_start_func_2): remove unused code.
- errinfo = th->errinfo; and errinfo = rb_errinfo(); are
- the same.
+ * 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]
-Thu Nov 29 05:26:32 2012 Koichi Sasada <ko1@atdot.net>
+Mon Jul 21 15:55:42 2014 fuji70 <fujifuji70@gmail.com>
- * vm_backtrace.c (backtrace_to_str_ary2): rename to backtrace_to_str_ary.
+ * lib/optparse.rb (getopts): print default values and descriptions
+ in the help message. [fix GH-676]
- * vm_backtrace.c (rb_backtrace_to_str_ary): use `backtrace_to_str_ary()'.
+Sun Jul 20 14:26:27 2014 Eric Wong <e@80x24.org>
- * vm_backtrace.c (backtrace_to_frame_ary): rename to
- backtrace_to_location_ary.
+ * vm_core.h (rb_proc_t): reduce to 64 bytes from 72 on 64-bit
-Thu Nov 29 05:19:25 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+Sun Jul 20 13:50:34 2014 Eric Wong <e@80x24.org>
- * probes.d: Change function-entry probe to method-entry.
- * insns.def: ditto
- * probes_helper.h: ditto
- * test/dtrace/test_function_entry.rb: ditto
- * test/dtrace/test_singleton_function.rb: ditto
- * vm.c: ditto
- * vm_eval.c: ditto
- * vm_insnhelper.c: ditto
+ * transcode.c (rb_econv_t): reduce to 184 bytes from 200 on 64-bit
-Thu Nov 29 04:45:17 2012 Koichi Sasada <ko1@atdot.net>
+Sun Jul 20 12:44:23 2014 Eric Wong <e@80x24.org>
- * vm_backtrace.c: rename Class name from
- ::RubyVM::Backtrace and ::RubyVM::Backtrace::Location
- to ::Thread::Backtrace and ::Thread::Backtrace::Location.
+ * 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]
-Wed Nov 28 23:52:02 2012 Masaya Tarui <tarui@ruby-lang.org>
+Sun Jul 20 12:41:53 2014 Eric Wong <e@80x24.org>
- * NEWS (Thread) remove incompatible changes about trap.
+ * 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]
-Wed Nov 28 23:39:01 2012 Koichi Sasada <ko1@atdot.net>
+Sun Jul 20 12:36:46 2014 Eric Wong <e@80x24.org>
- * thread.c (rb_mutex_sleep): fix to allow spurious wakeup.
- [ruby-dev:46654] [ruby-trunk - Bug #7455]
+ * include/ruby/oniguruma.h (struct re_pattern_buffer): shrink to 448
+ bytes from 464 bytes on 64-bit. This breaks the ABI.
+ [Feature #10034]
- * NEWS: write about spurious wakeup.
+Sun Jul 20 01:06:06 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Wed Nov 28 22:57:23 2012 Koichi Sasada <ko1@atdot.net>
+ * ext/openssl/ossl.c: use encryptor instead of encrypter in doc.
+ contributed from @vipulnsward. [fix GH-663]
- * thread_win32.c: catch up latest change of BLOCKING_REGION.
+Sun Jul 20 00:32:44 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Nov 28 22:54:21 2012 Koichi Sasada <ko1@atdot.net>
+ * io.c (rb_io_initialize): [DOC] fix rdoc of append mode. it does
+ not move the pointer at open. [ruby-core:63747] [Bug #10039]
- * vm_insnhelper.c (vm_call_method): fix undefined behavior.
- Should not access scope local variable from outer scope.
+Sat Jul 19 12:40:50 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Nov 28 22:20:55 2012 Masaya Tarui <tarui@ruby-lang.org>
+ * compile.c (iseq_compile_each): allow to access private attribute
+ reader in op_assign. [ruby-core:63817] [Bug #10060]
- * test/ruby/test_thread.rb (test_thread_status_in_trap): change test for
- thread status in trap. now can accept Thread#join and Thread#value in trap.
+Sat Jul 19 11:56:36 2014 Grey Baker <greysteil@gmail.com>
-Wed Nov 28 21:58:47 2012 Koichi Sasada <ko1@atdot.net>
+ * 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).
- * include/ruby/thread.h (rb_thread_call_without_gvl2): change
- meaning of function.
- This function is called with same parameters of
- `rb_thread_call_without_gvl()'.
- However, if interrupts are detected, then return immediately.
+ Previously a `nil` return value from `Time.month_days` would
+ have the `<` operator called on it, and raise `NoMethodError`.
+ [fix GH-667]
- * thread.c: implement `rb_thread_call_without_gvl2()'.
+ * lib/rdoc/parser/changelog.rb (RDoc#parse_entries): fix dirty hack.
-Wed Nov 28 21:31:21 2012 Masaya Tarui <tarui@ruby-lang.org>
+Sat Jul 19 06:19:01 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * thread.c (thread_join_sleep): check spurious wakeup by itself for
- corresponding status change in trap context.
- * vm_core.h (struct rb_thread_struct): add rb_thread_list_t and use as join_list for
- reentry by trap context.
- * thread.c (thread_start_func_2): ditto.
- * thread.c (remove_from_join_list): ditto.
- * thread.c (rb_thread_atfork): ditto.
- * thread.c (thread_join): ditto. & remove trap handler check.
- * thread.c (sleep_forever): add argument : spurious_check.
- * thread.c (sleep_timeval): ditto.
- * thread.c (rb_thread_sleep_forever): set spurious_check.
- * thread.c (rb_thread_sleep_deadly): ditto.
- * thread.c (sleep_for_polling): ditto.
- * thread.c (rb_thread_wait_for): ditto.
- * thread.c (sleep_wait_for_interrupt): bypass spurious_check.
+ * ext/win32ole/win32ole.c: refactoring.
-Wed Nov 28 21:23:18 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Jul 18 22:34:41 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * ext/psych/yaml/emitter.c (yaml_emitter_write_indicator): constify.
+ * ext/win32ole/win32ole.c (folevariant_initialize): WIN32OLE_VARIANT
+ does not support VT_RECORD. VT_RECORD should be supported in
+ WIN32OLE_RECORD.
- * ext/psych/yaml/emitter.c (yaml_emitter_write_block_scalar_hints):
+ * test/win32ole/test_win32ole_variant.rb (test_s_new_vt_record_exc):
ditto.
- * ext/psych/extconf.rb: mingw32 also needs macros for win32, not
- only mswin32.
-
- * ext/psych/extconf.rb: compile sources in the source directory
- without copying by using VPATH.
-
-Wed Nov 28 21:18:57 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (MakeMakefile#each_compile_rules): splat $(*VPATH*) for
- each VPATH elements.
-
-Wed Nov 28 16:40:14 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * vm_core.h (enum rb_thread_status): remove THREAD_TO_KILL
- * vm_core.h (struct rb_thread_struct): add to_kill field
- * thread.c (terminate_i): convert THREAD_TO_KILL to to_kill.
- * thread.c (rb_threadptr_to_kill): ditto.
- * thread.c (rb_thread_kill): ditto.
- * thread.c (rb_thread_wakeup_alive): ditto.
- * thread.c (thread_list_i): ditto.
- * thread.c (static const char): ditto.
- * thread.c (thread_status_name): ditto.
- * thread.c (rb_thread_status): ditto.
- * thread.c (rb_thread_inspect): ditto.
- * vm_backtrace.c (thread_backtrace_to_ary): ditto.
-
- * thread.c (rb_threadptr_execute_interrupts): fix thread status
- overwritten issue. [Bug #7450] [ruby-core:50249]
-
- * test/ruby/test_thread.rb (test_hread_status_raise_after_kill):
- test for the above.
- * test/ruby/test_thread.rb (test_thread_status_in_trap): test for
- thread status in trap.
- * test/ruby/test_thread.rb (test_status_and_stop_p): remove
- Thread.control_interrupt unsafe test. Thread#kill no longer
- changes thread status. Instead of, Thread#kill receiver changes
- their own status when receiving kill signal.
-
-Wed Nov 28 16:21:46 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (struct rb_mutex_struct): add allow_trap field.
- * internal.h (rb_mutex_allow_trap): added.
- * thread.c (rb_mutex_lock, rb_mutex_unlock): check mutex->allow_trap.
- * thread.c (mutex_sleep): remove trap check because it uses
- rb_mutex_lock and rb_mutex_unlock internally.
- * thread.c (rb_mutex_allow_trap): new helper function for the above.
-
- * io.c (io_binwrite): mark fptr->write_lock as writable in trap.
-
- * test/ruby/test_signal.rb (test_trap_puts): test for the above.
-
-Wed Nov 28 16:59:12 2012 Koichi Sasada <ko1@atdot.net>
-
- * proc.c: remove Proc#== and Proc#eql?.
- Proc objects compared with their object ids.
- [Bug #4559]
-
- * test/ruby/test_proc.rb: remove related test.
-
-Wed Nov 28 16:41:04 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc/servlet.rb: Add support for serving documentation from a
- subdirectory.
- * lib/rdoc/generator/darkfish.rb: ditto
- * test/rdoc/test_rdoc_servlet.rb: Test for above
- * test/rdoc/test_rdoc_servlet.rb: ditto
-
-Wed Nov 28 15:37:17 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * configure.in: fix r37924: run only on i[3-6]86-linux.
-
-Wed Nov 28 15:31:11 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * io.c (FMODE_SYNCWRITE): removed unused macro.
-
-Wed Nov 28 15:19:25 2012 Naohisa Goto <ngotogenome@gmail.com>
-
- * configure.in: revert r37911, r37906 and r37904 which break build
- with non-gcc and/or non-IA32 compilers, e.g. Solaris Studio,
- Fujitsu C Compiler. [ruby-dev:46646] [Bug #7451]
-
-Wed Nov 28 14:50:55 2012 Koichi Sasada <ko1@atdot.net>
-
- * ext/psych/extconf.rb: copy sources into build directory,
- not into srcdir.
-
-Wed Nov 28 14:34:06 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (rb_mutex_lock): moved trap context check from
- rb_mutex_trylock because try_lock have no change to make
- a deadlock.
- * thread.c (rb_mutex_trylock): ditto.
- * NEWS: news for the above.
-
-Wed Nov 28 13:39:54 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (thread_s_new): uses main_thread->status instead of
- th->inhibit_thread_creation for preventing thread creation.
- * vm_core.h (rb_vm_struct): remove inhibit_thread_creation field.
- * thread.c (rb_thread_terminate_all): ditto.
-
-Wed Nov 28 13:27:29 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/extconf.rb: use embedded libyaml if no system libyaml is
- found. [ruby-core:49463]
- * ext/psych/lib/psych.rb: updating to psych 2.0.0
- * ext/psych/lib/psych/deprecated.rb: updated docs
- * ext/psych/psych.gemspec: updated to psych 2.0.0
- * ext/psych/psych.h: fixing header file include for rename
- * ext/psych/psych_emitter.c: renamed to avoid libyaml conflict.
- * ext/psych/psych_emitter.h: ditto
- * ext/psych/psych_parser.c: ditto
- * ext/psych/psych_parser.h: ditto
- * ext/psych/psych_to_ruby.c: ditto
- * ext/psych/psych_to_ruby.h: ditto
- * ext/psych/psych_yaml_tree.c: ditto
- * ext/psych/psych_yaml_tree.h: ditto
- * ext/psych/yaml/LICENSE: embedding libyaml 0.1.4
- * ext/psych/yaml/api.c: ditto
- * ext/psych/yaml/config.h: ditto
- * ext/psych/yaml/dumper.c: ditto
- * ext/psych/yaml/emitter.c: ditto
- * 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.h: ditto
- * ext/psych/yaml/yaml_private.h: ditto
-
-Wed Nov 28 12:54:59 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (thread_join): A trap handler check was moved from
- thread_join_m because Thread#value should be raised an exception
- too.
- * thread.c (thread_join_m): remove trap handler check.
- * test/ruby/test_thread.rb (test_thread_join_in_trap): add test
- for thread#value.
- * NEWS: documentation fix for the above.
-
-Wed Nov 28 11:07:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/fiddle/closure.c: Documentation for Fiddle
- * ext/fiddle/lib/fiddle/import.rb: ditto
- * ext/fiddle/lib/fiddle/value.rb: ditto
- * ext/fiddle/lib/fiddle/pack.rb: ditto
- * ext/fiddle/lib/fiddle/cparser.rb: ditto
- * ext/fiddle/lib/fiddle/struct.rb: ditto
- * ext/fiddle/lib/fiddle/function.rb: ditto
-
-Wed Nov 28 09:15:51 2012 Ryan Davis <ryand-ruby@zenspider.com>
-
- * ext/strscan/strscan.c: Added #charpos for multibyte string position.
- * test/strscan/test_stringscanner.rb: ditto
-
-Wed Nov 28 09:00:34 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/fiddle/fiddle.c: adding alignment constants for compatibility
- with DL.
- * ext/fiddle/fiddle.h: ditto
- * ext/fiddle/lib/fiddle/cparser.rb: importing the C parser for DL
- backwards compatibility.
- * ext/fiddle/lib/fiddle/import.rb: importing the import DSL for DL
- backwards compatibility.
- * ext/fiddle/lib/fiddle/pack.rb: importing structure pack for DL
- backwards compatibility.
- * ext/fiddle/lib/fiddle/value.rb: ditto
- * ext/fiddle/lib/fiddle/struct.rb: importing struct DSL for DL backwards
- compatibility.
- * test/dl/test_c_struct_entry.rb: importing tests
- * test/dl/test_c_union_entity.rb: ditto
- * test/dl/test_cparser.rb: ditto
- * test/dl/test_import.rb: ditto
- * test/fiddle/test_c_struct_entry.rb: ditto
- * test/fiddle/test_c_union_entity.rb: ditto
- * test/fiddle/test_cparser.rb: ditto
- * test/fiddle/test_import.rb: ditto
-
-Wed Nov 28 08:56:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * doc/globals.rdoc: Add documentation file for magic globals
- [ruby-core:29048] [Bug #3022]
-
-Wed Nov 28 08:55:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * .document: Add README's to be included with docs
-
-Wed Nov 28 08:26:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/dl/lib/dl.rb: Deprecation notice for DL
-
-Wed Nov 28 08:25:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/fiddle/closure.c: Documentation for Fiddle
- * ext/fiddle/pointer.c: ditto
- * ext/fiddle/function.c: ditto
- * ext/fiddle/lib/fiddle.rb: ditto
- * ext/fiddle/fiddle.c: ditto
- * ext/fiddle/handle.c: ditto
-
-Wed Nov 28 04:53:40 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/fiddle/handle.c: Make Fiddle independent of DL, copy DL::Handle
- to Fiddle::Handle.
- * ext/fiddle/pointer.c: Make Fiddle independent of DL, copy
- DL::Pointer to Fiddle::Pointer.
- * test/fiddle/test_func.rb: relevant tests
- * test/fiddle/test_handle.rb: ditto
- * test/fiddle/test_pointer.rb: ditto
- * ext/dl/lib/dl/struct.rb: use Fiddle::Pointer if available
- * ext/fiddle/extconf.rb: check for dlfcn.h
- * ext/fiddle/fiddle.c: add constants for sizeof() things
- * ext/fiddle/fiddle.h: include dlfcn.h
- * ext/fiddle/function.c: expose a C function for creating new
- Fiddle::Function objects.
- * ext/fiddle/lib/fiddle.rb: include constants for dl backwards compat
- * ext/fiddle/lib/fiddle/function.rb: read the pointer from the
- function for dl backwards compat.
- * test/dl/test_callback.rb: check the addresses of the pointers rather
- than their types.
- * test/fiddle/helper.rb: remove dependency on dl
- * test/fiddle/test_closure.rb: ditto
- * test/fiddle/test_fiddle.rb: ditto
-
-Wed Nov 28 03:03:28 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * configure.in (opt-dir): don't use non portable flag -E of sed.
-
-Wed Nov 28 02:55:35 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * configure.in (ARCH_FLAG): __sync_val_compare_and_swap_4 needs
- -march=$target_cpu on at least linux gcc 4.1.
- patched by KOSAKI Motohiro
-
-Tue Nov 27 22:03:09 2012 Akinori MUSHA <knu@iDaemons.org>
-
- * string.c (rb_str_enumerate_chars, rb_str_enumerate_codepoints)
- (rb_str_enumerate_lines): Dummy initialization of ary has been
- replaced with UNINITIALIZED_VAR().
-
-Tue Nov 27 21:29:00 2012 Kenta Murata <mrkn@mrkn.jp>
-
- * bignum.c (bigdivrem): optimize the way to retry calculation of
- bigdivrem so that the calculation is started from the point where
- the last interruption was occurred.
-
- * bignum.c (bigdivrem1): ditto.
-
- * test/ruby/test_bignum.rb: add a test case for rb_bigdivrem in the
- case that an interruption is occurred during bigdivrem1 is running.
-
-Tue Nov 27 19:56:43 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm.c (rb_vm_make_env_object): make Proc object if Env is possible
- to point block.
- [ruby-core:41038] [ruby-trunk - Bug #5634]
-
- * vm.c (rb_vm_make_proc): No need to make Proc object here.
-
- * bootstraptest/test_proc.rb: add tests.
-
-Tue Nov 27 18:51:06 2012 Naohisa Goto <ngotogenome@gmail.com>
-
- * ruby_atomic.h (ATOMIC_CAS): added for Solaris and other platforms.
- * ruby_atomic.h, signal.c (NEED_RUBY_ATOMIC_OPS): renamed from
- NEED_RUBY_ATOMIC_EXCHANGE.
- * signal.c (ruby_atomic_compare_and_swap): naive, non-atomic
- compare-and-swap implementation only used for platforms without
- valid support for atomic operations.
-
-Tue Nov 27 17:43:46 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc/*: Added --root option for building documentation outside
- the source directory.
- * test/rdoc/*: ditto
- * common.mk (rdoc): Added --root to rdoc rule
-
-Tue Nov 27 16:24:45 2012 Eric Hodel <drbrain@segment7.net>
-
- * test/rdoc/test_rdoc_ri_paths.rb: Fixed duplicate path bug which
- caused windows failures.
-
-Tue Nov 27 16:06:00 2012 Eric Hodel <drbrain@segment7.net>
-
- * test/rdoc/test_rdoc_generator_darkfish.rb: Updated tests for windows
- * test/rdoc/test_rdoc_options.rb: ditto
- * test/rdoc/test_rdoc_parser.rb: ditto
- * test/rdoc/test_rdoc_rdoc.rb: ditto
- * test/rdoc/test_rdoc_ri_driver.rb: ditto
- * test/rdoc/test_rdoc_servlet.rb: ditto
-
-Tue Nov 27 15:13:51 2012 Eric Hodel <drbrain@segment7.net>
-
- * common.mk (rdoc): Set --debug for rdoc generation in case of bugs
-
-Tue Nov 27 14:56:45 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc/rubygems_hook.rb: Updated for (upcoming) RubyGems 2
- import.
- * test/rdoc/test_rdoc_rubygems_hook.rb: ditto
-
-Tue Nov 27 13:59:29 2012 Narihiro Nakamura <authornari@gmail.com>
-
- * NEWS: add improvements of the garbage collector.
-
-Tue Nov 27 13:27:46 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc*: Updated to RDoc 4.0 (pre-release)
- * bin/rdoc: ditto
- * test/rdoc*: ditto
- * NEWS: Updated with RDoc 4.0 information
-
-Tue Nov 27 12:17:11 2012 Koichi Sasada <ko1@atdot.net>
-
- * thread.c (rb_thread_terminate_all): retry broadcast only when
- an exception is raised.
-
-Tue Nov 27 12:02:25 2012 Koichi Sasada <ko1@atdot.net>
-
- * thread.c (rb_thread_terminate_all): broadcast terminate event
- not only an interrupt exception but any exceptions.
-
-Tue Nov 27 10:55:09 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * eval.c (ruby_cleanup): set thread status to THREAD_KILLED
- for preventing thr.raise.
- * test/ruby/test_thread.rb (test_main_thread_status_at_exit):
- test for the above.
-
-Tue Nov 27 10:31:29 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (rb_thread_terminate_all): suppress a warning.
-
-Tue Nov 27 09:29:11 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (thread_join): raises ThreadError if target thread
- is a main thread.
- * test/ruby/test_thread.rb (test_thread_join_main_thread):
- test for the above.
- * NEWS: news for the above.
-
-Tue Nov 27 09:24:47 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (thread_join): raises ThreadError if target thread
- is a current thread.
- * test/ruby/test_thread.rb (test_thread_join_current):
- test for the above.
- * NEWS: news for the above.
-
-Tue Nov 27 09:59:16 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/extmk.rb (extmake): close mkmf.log for each libraries so that
- failure messages are not mixed.
-
-Tue Nov 27 09:58:48 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/digest/*/extconf.rb, ext/openssl/extconf.rb: get git rid of
- post-1.8 feature require_relative for cross compilation.
- [ruby-core:50160] [Bug #7439]
-
-Tue Nov 27 09:17:59 2012 Koichi Sasada <ko1@atdot.net>
-
- * NEWS: add TracePoint.
-
-Tue Nov 27 08:16:03 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_trace.c: rename TracePoint#file and TracePoint#line
- to TracePoint#path and TracePoint#lineno respectively.
- They are consistent to RubyVM::Backtrace::Location.
-
- * include/ruby/debug.h: ditto.
-
- * vm_core.h: ditto.
-
- * test/ruby/test_settracefunc.rb: ditto.
-
-Tue Nov 27 08:04:26 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (rb_thread_terminate_all): broadcast eTerminateSignal
- again when Ctrl-C was pressed. [Feature #1952] [ruby-dev:39107]
-
-Tue Nov 27 07:58:03 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_core.h: add members to rb_trace_arg_t:
- * `klass_solved' represents klass and id is checked.
- * `line' represents line calculated from cfp.
- * `file' represents line calculated from cfp.
-
- * vm_trace.c: fix to use above data structures.
- No need to calculate klass and id, line and file
- pairs for each trace points.
-
-Tue Nov 27 07:47:09 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (rb_thread_terminate_all): add RUBY_VM_CHECK_INTS_BLOCKING().
- Otherwise the loop in this function behave as busy loop because
- native_sleep() return immediately when RUBY_VM_INTERRUPTED() is true.
-
-Tue Nov 27 04:12:49 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Jul 18 19:54:03 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * ext/extmk.rb (extmake): git rid of post-1.8 features for cross
- compilation. [ruby-core:50160] [Bug #7439]
-
-Tue Nov 27 00:13:41 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (rb_mutex_trylock, rb_mutex_unlock, mutex_sleep):
- raises ThreadError if called from trap handler as Thread#join.
- * NEWS: news for the above.
-
-Mon Nov 26 23:55:33 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * NEWS: update for Thread#join incompatible change.
-
-Mon Nov 26 22:44:24 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (rb_thread_terminate_all): use native_sleep() instead
- of rb_thread_schedule(). Otherwise, it consume 100% cpu meaninglessly.
- [Bug #5368] [ruby-dev:44546]
- * thread.c (thread_start_func_2): last sub-thread wakes up main thread.
-
-Mon Nov 26 21:16:04 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * vm_core.h (RUBY_VM_SET_TIMER_INTERRUPT, RUBY_VM_SET_INTERRUPT)
- (RUBY_VM_SET_FINALIZER_INTERRUPT, RUBY_VM_SET_TRAP_INTERRUPT)
- (RUBY_VM_INTERRUPTED): use enum symbol instead of immediate value.
- * thread.c (thread_join_m, rb_threadptr_execute_interrupts): ditto.
- * signal.c (signal_exec): ditto.
-
-Mon Nov 26 20:23:20 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (thread_join_m): use th->interrupt_mask instead of
- th->in_trap.
-
- * vm_core.h (struct rb_thread_struct): remove in_trap member.
- * signal.c (signal_exec): ditto.
- * thread.c (thread_create_core): ditto.
- * thread.c (Init_Thread): ditto.
-
-Mon Nov 26 20:23:49 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_argf.rb (TestArgf#test_chars): since marshal data is
- binary, shouldn't pass via text mode. use base64 encoded data.
-
-Mon Nov 26 19:45:18 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * ruby_atomic.h (ATOMIC_CAS): new macro for compare-and-exchange.
-
- * vm_core.h (struct rb_thread_struct): add interrupt_mask member.
- * thread.c (thread_create_core, Init_Thread): initialize
- th->thread_mask.
-
- * vm_core.h (RUBY_VM_INTERRUPTED_ANY): new macro for avoiding
- bare th->interrupt_flag.
- * vm_core.h (RUBY_VM_INTERRUPTED, RUBY_VM_INTERRUPTED): check
- th->interrupt_mask.
- * thread.c (set_unblock_function, rb_thread_schedule): replace
- th->interrupt_flag with RUBY_VM_INTERRUPTED_ANY()
-
- * signal.c (signal_exec): set up thread->interrupt_mask for
- preventing recursive trap handler.
- * vm_core.h (RUBY_VM_CHECK_INTS, RUBY_VM_CHECK_INTS_BLOCKING): ditto.
-
- * thread.c (rb_threadptr_execute_interrupts):
- don't process interrupt if it is masked.
- [Bug #6009] [ruby-core:42524]
-
-Mon Nov 26 19:43:42 2012 Koichi Sasada <ko1@atdot.net>
-
- * iseq.c (make_compile_option_value): add trace_instruction option.
- a patch by davidbalbert (David Albert).
- [Bug #6786]
-
-Mon Nov 26 19:10:53 2012 Koichi Sasada <ko1@atdot.net>
-
- * bootstraptest/test_thread.rb: try to `join' each 100
- threads.
- This benchmark seems consuming long time on travis-ci
- several times (and make `failure').
-
-Mon Nov 26 18:22:56 2012 Koichi Sasada <ko1@atdot.net>
-
- * common.mk: specify label `built-ruby'.
-
- * benchmark/driver.rb: quote path.
-
-Mon Nov 26 18:26:28 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * signal.c (signal_exec): add volatile to make sure setjmp safe.
-
-Mon Nov 26 18:19:47 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * signal.c (signal_exec): suppress "warning: variable 'signum'
- might be clobbered by 'longjmp' or 'vfork'" warning.
-
-Mon Nov 26 18:15:47 2012 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/driver.rb: accept multiple `-e'.
- You don't need to use `;' separation character.
- [ruby-core:50139] [ruby-trunk - Bug #7380]
-
-Mon Nov 26 17:10:04 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * string.c (rb_str_enumerate_chars, rb_str_enumerate_codepoints)
- (rb_str_enumerate_lines): suppress "may be used uninitialized in
- this function" warning.
-
-Mon Nov 26 17:00:12 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * vm_core.h (rb_thread_struct): added 'in_trap' member for marking
- running trap handler.
- * signal.c (signal_exec): turn on in_trap when running trap.
- * thread.c (Init_Thread, thread_create_core): initialize in_trap
- when creating new threads.
- * thread.c (thread_join_m): raise ThreadError when running trap
- handler.Bug [#6416][ruby-core:44956]
- * test/ruby/test_thread.rb (test_thread_join_in_trap): new test
- for the above.
-
-Mon Nov 26 16:36:13 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * io.c (argf_each_codepoint): add missing ARGF#codepoints [Bug #7438]
-
-Mon Nov 26 15:50:29 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * bignum.c (bigdivrem): restart calculation when bigdivrem1 was
- interrupted by signal. Otherwise, ruby script may see a garbage
- value.
-
-Mon Nov 26 15:33:02 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * bignum.c (big_div_struct): added volatile to 'stop' member.
- Otherwise, "if (bds->stop)" check in bigdivrem1 don't read
- memory and ignore interrupt.
- * bignum.c (bigdivrem, rb_big_stop): ditto.
-
-Mon Nov 26 12:11:09 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/Makefile.sub (DLNOBJ): missing in r37821.
-
-Mon Nov 26 10:50:19 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/ruby/test_process.rb (test_setsid): added a few wait for
- preventing that Process.getsid(io.pid) makes Errno::ESRCH.
-
-Sun Nov 25 22:34:00 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * array.c (ary_resize_smaller): new function to resize array.
-
- * array.c (rb_ary_delete): refactoring to extract a function.
-
- * array.c (rb_ary_delete_same): refactoring.
- It renames function, reduces duplicated code and removes unused
+ * ext/win32ole/win32ole.c (folevariant_initialize): remove unnecessary
code.
- * gc.c (wmap_final_func): follow the above change.
-
- * internal.h (rb_ary_delete_same): ditto.
-
-Sun Nov 25 22:27:33 2012 Benoit Daloze <eregontp@gmail.com>
-
- * array.c: fixes for the updated documentation in r35858:
- Typos and #take/#drop accept to take/drop 0 elements.
-
-Sun Nov 25 19:43:29 2012 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * NEWS: add a news about iconv.
-
-Sun Nov 25 03:49:23 2012 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/set.rb, test/test_set.rb: Move tests embedded in lib/set.rb
- to test/test_set.rb.
-
-Sun Nov 25 03:44:50 2012 Akinori MUSHA <knu@iDaemons.org>
-
- * string.c (rb_str_each_line, rb_str_lines): String#lines now
- returns an array instead of an enumerator. Passing a block is
- deprecated but still supported for backwards compatibility.
- Based on the patch by yhara. [Feature #6670]
-
- * string.c (rb_str_each_char, rb_str_chars): Ditto for
- String#chars.
-
- * string.c (rb_str_each_codepoint, rb_str_codepoints): Ditto for
- String#codepoints.
-
- * string.c (rb_str_each_byte, rb_str_bytes): Ditto for
- String#bytes.
-
- * NEWS: Add notes for the above changes.
-
-Sun Nov 25 02:07:37 2012 Akinori MUSHA <knu@iDaemons.org>
-
- * test/ruby/envutil.rb (Test::Unit::Assertions#assert_warning)
- (Test::Unit::Assertions#assert_warn), test/ruby/envutil.rb,
- test/ruby/test_enumerator.rb, test/ruby/test_io_m17n.rb,
- test/ruby/test_regexp.rb, test/ruby/test_syntax.rb:
- assert_warn() and assert_warning() are reversed.
-
-Sat Nov 24 21:08:50 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * gc.c (wmap_final_func): rename variables to clarify the meaning.
- In wmap2obj the key is WeakRef and the value is referenced object.
- In obj2wmap the key is referenced object and the value is an array
- of WeakRef.
-
- * gc.c (wmap_finalize): ditto.
- [ruby-core:49044] [Bug #7304]
-
-Sat Nov 24 21:01:55 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * array.c (rb_ary_delete_same_obj): new function for WeakRef.
- This deletes same objects as item argument in the array.
-
- * internal.h (rb_ary_delete_same_obj): add a declaration.
-
- * gc.c (wmap_final_func): remove WeakRef object reference from the
- array. rb_ary_delete() is not usable because it uses rb_equal() to
- compare object references.
-
- * gc.c (wmap_finalize): remove recycled object references from weak
- map hash properly. How to get object reference from object id was
- wrong. st_delete() doesn't work properly if key and value arguments
- are same. The key of obj2wmap is referenced object and the value of
- obj2wmap is WeakRef array.
-
- * gc.c (wmap_aset): obj2wmap should contain WeakRef array in the
- definition.
-
- * test/test_weakref.rb
- (TestWeakRef#test_not_reference_different_object,
- TestWeakRef#test_weakref_finalize): add tests for above.
- [ruby-core:49044] [Bug #7304]
-
-Sat Nov 24 19:44:41 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/nkf/nkf-utf8/nkf.c (unicode_iconv_combine): returning flags are
- nkf_char.
-
-Sat Nov 24 19:29:18 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * test/ruby/test_rubyoptions.rb (test_usage, test_usage_long):
- reduced, renamed.
-
-Sat Nov 24 13:10:14 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_trace.c (rb_tracepoint_attr_raised_exception): should not check
- value before event checking.
-
- * vm_trace.c (rb_tracepoint_attr_return_value): ditto.
-
- * test/ruby/test_settracefunc.rb: add tests for TracePoint#return_value
- and TracePoint#raised_exception.
-
-Sat Nov 24 12:47:27 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * test/ruby/test_process.rb (TestProcess#test_setsid): "./ruby-trunk"
- doesn't work on all environments. EnvUtil.rubybin would be suitable.
-
-Sat Nov 24 12:28:04 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * array.c (rb_ary_aref): fix Segmentation fault at TestArray#test_aref
- on x64 mingw. Variable argument of rb_scan_args() should be a pointer
- (VALUE *), but 0 of variable argument seems not equal to null pointer
- on x64 mingw.
-
-Sat Nov 24 11:47:14 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * process.c (proc_getsid): adds new method for getting session id.
- Contributed from fumiyas (Fumiyasu SATOH). Thank you!
- [Feature #6757] [ruby-dev:45977]
- * configure.in: adds getsid check.
- * test/ruby/test_process.rb (TestProcess#test_setsid): new test
- for the above.
- * NEWS: news for the above.
-
-Sat Nov 24 10:59:14 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (thread_create_core): don't use th->thread_id before
- initialized.
-
-Sat Nov 24 00:00:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ruby.c (proc_options, process_options, ruby_process_options): take
- care of the case argc is 0, and check if argv has NULL.
- [ruby-core:49889] [Bug #7423]
-
-Sat Nov 24 00:00:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (--disable-dln): option to disable dynamic linking
- feature. [ruby-core:37676] [Feature #4946]
-
-Fri Nov 23 23:44:41 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (MakeMakefile#pkg_config): strip all white spaces for
- mingw64+MSYS pkg-config which erroneously emits extra newlines.
- [ruby-core:47998] [Bug #7163]
-
-Fri Nov 23 17:31:54 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ruby.c (usage): wrap description lines if options are too long.
-
-Fri Nov 23 11:13:46 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/ruby/test_rubyoptions.rb (TestRubyOptions#test_usage2): refine
- assertion.
+Fri Jul 18 19:11:03 2014 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
- * test/ruby/test_rubyoptions.rb (TestRubyOptions#test_usage2): now
- --help option is for modern terminals.
+ * lib/matrix/eigenvalue_decomposition: Style fix
+ Patch by Gogo Tanaka [#10058]
-Fri Nov 23 10:45:00 2012 Zachary Scott <zachary@zacharyscott.net>
+Fri Jul 18 19:03:53 2014 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
- * ext/socket/ipsocket.c (IPSocket#peeraddr): Fix example
- [ruby-core:46429] [Bug #6732]
+ * lib/matrix.rb: Avoid using `and`.
+ Patch by gogo tanaka [#10058]
-Fri Nov 23 02:40:00 2012 Zachary Scott <zachary@zacharyscott.net>
+Fri Jul 18 17:41:54 2014 GoGo tanaka <qlli.illb@gmail.com>
- * lib/cgi/core.rb: Documentation for CGI#header alias
- Based on a patch by Marcus Stollsteimer
- [ruby-core:49585] [Bug #7405]
+ * test/matrix/test_matrix.rb: Add tests for Matrix class.
+ [Feature #10057][ruby-core:63809]
-Thu Nov 22 23:48:10 2012 Narihiro Nakamura <authornari@gmail.com>
+Fri Jul 18 10:14:42 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * gc.c (is_swept_object): extract from is_dead_object().
+ * lib/fileutils.rb: added missing options of FileUtils.touch by @Domon.
+ [fix GH-669]
- * gc.c (rb_gcdebug_print_obj_condition): add the function for debug.
- This function shows some conditions of given object (e.g.,
- marked, in heap, swept).
+Thu Jul 17 19:57:27 2014 Herwin <herwin@quarantainenet.nl>
- * gc.c (rb_gcdebug_sentinel): add the function for debug.
- This function allow check to inadvertently free up an object.
+ * ext/thread/thread.c (rb_szqueue_push): add optional parameter,
+ non_block defaulted to false. [ruby-core:63794] [Feature #10052]
-Thu Nov 22 23:45:18 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+Wed Jul 16 23:01:43 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * array.c (rb_ary_shared_with_p): fix cache validity check.
- If #pop or #shift has been called against $: or $", the array will
- be still shared with the snapshot. We check array length for cache
- validity.
- [ruby-core:49518] [Bug #7383]
+ * ext/win32ole/win32ole.c (ole_variant2val): support array of
+ VT_RECORD variant.
- * test/ruby/test_require.rb
- (TestRequire#test_require_with_array_pop,
- TestRequire#test_require_with_array_shift): add tests for above.
+Wed Jul 16 20:21:49 2014 Naohisa Goto <ngotogenome@gmail.com>
-Thu Nov 22 21:48:48 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * 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.
- * common.mk, win32/Makefile.sub (probes.dmyh): now be made in current
- (=build) directory if build from the repository.
+Wed Jul 16 19:55:32 2014 Naohisa Goto <ngotogenome@gmail.com>
-Thu Nov 22 21:34:51 2012 Tadayoshi Funaba <tadf@dotrb.org>
+ * vm_core.h (struct rb_iseq_struct): temporal workaround of [Bug 10037].
+ Add padding on big-endian 64-bit architecture (e.g. sparc64).
- * test/ruby/test_rubyoptions.rb: added a test.
+Wed Jul 16 19:32:23 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-Thu Nov 22 20:32:07 2012 Tadayoshi Funaba <tadf@dotrb.org>
+ * ext/win32ole/win32ole.c (fole_record_method_missing): call
+ rb_hash_fetch instead of rb_hash_aref.
- * complex.c (string_to_c_strict, string_to_c): check NUL.
- * rational.c (string_to_r_strict, string_to_r): ditto.
+Wed Jul 16 18:08:47 2014 Koichi Sasada <ko1@atdot.net>
-Thu Nov 22 20:21:45 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * iseq.c (rb_iseq_defined_string): use rb_gc_mark_object() instead of
+ marking from vm_mark().
- * Makefile.in (.dmyh.h): removed $(VPATH). GNU make don't
- recognize suffix rule with VPATH.
+ * vm.c (rb_vm_mark): ditto.
-Thu Nov 22 18:11:27 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Wed Jul 16 18:03:50 2014 Koichi Sasada <ko1@atdot.net>
- * common.mk, Makefile.in, win32/Makefile.sub (.dmyh.h): nmake merges
- explicit rules for same target, but not merges explicit rules and
- implicit rules -- always explicit rules win. So, need to add an
- explicit rule for probes.h. [Bug #7421] [ruby-core:49839]
+ * gc.c (gc_mark_roots): call rb_vm_mark directly.
-Thu Nov 22 18:01:28 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * vm.c: remove mark function for RubyVM object because
+ RubyVM object marked manually.
- * Makefile.in (probes.o): add -C to ignore #include in probes.d.
+Wed Jul 16 12:25:39 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * probes.d: include vm_opts.h instead of vm_core.h.
+ * regcomp.c: Merge Onigmo 5.14.1 25a8a69fc05ae3b56a09.
+ this includes Support for Unicode 7.0 [Bug #9092].
- * vm_opts.h (VM_COLLECT_USAGE_DETAILS): move definition from vm_core.h.
+Tue Jul 15 23:59:27 2014 Jared Jennings <jared.jennings.ctr@us.af.mil>
-Thu Nov 22 17:45:17 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/digest: make built-in digest function implementations
+ indicate success or failure of init and final functions.
+ [ruby-core:61614] [Bug #9659]
- * ext/nkf/nkf-utf8: Merge b0a6577a521d1bba5e19853f95d5c4b9be1072b5.
- Support JIS X 0213 and some bugfixes.
+ * ext/digest/digest.c: expect digest init and finish functions to
+ indicate success or failure; raise exception on failure.
+ [ruby-core:61614] [Bug #9659]
-Thu Nov 22 17:39:37 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Tue Jul 15 20:31:40 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * tool/gen_dummy_probes.rb: don't change #include, #if and #endif
- lines. [Bug #7370]
+ * ext/win32ole/win32ole.c: modify document for WIN32OLE_RECORD.
-Thu Nov 22 16:58:26 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Tue Jul 15 12:42:23 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * Makefile.in: run preprocessor when making probe.h
- * probes.d: define probe insn and insn__operand only when
- VM_COLLECT_USAGE_DETAILS is 1. [Bug #7370]
+ * defs/default_gems: change version definition file of rake.
-Thu Nov 22 16:20:49 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Tue Jul 15 12:00:03 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * vm.c: Don't define vm_collect_usage_operand() and
- static void vm_collect_usage_insn() when disabling
- VM_COLLECT_USAGE_DETAILS. (refix r37796)
+ * lib/rake.rb, lib/rake/*.rb: Upgrade to rake-10.3.2
+ [fix GH-668]
+ * test/rake/*.rb: ditto.
-Thu Nov 22 15:26:02 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Mon Jul 14 19:14:51 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * vm_insnhelper.h: partly revert r37631 (DTrace support).
- "vm usage information is always collected, so uncomment the
- functions." causes performance impact. [Bug #7370]
- Off course this revert disables related probes.
+ * ext/win32ole/win32ole.c: modify WIN32OLE class document and
+ add comment for constants of WIN32OLE.
-Thu Nov 22 14:14:36 2012 Akinori MUSHA <knu@iDaemons.org>
+Mon Jul 14 16:38:45 2014 Eric Wong <e@80x24.org>
- * re.c (rb_memsearch_ss): Apply performance improvement to short
- byte array search for platforms without memmem(3).
- [Feature #6311] [ruby-dev:45530]
+ * vm_core.h (struct rb_iseq_struct): reduce to 288 bytes
+ on x86-64 (from 296 bytes)
-Thu Nov 22 12:52:19 2012 Akinori MUSHA <knu@iDaemons.org>
+Mon Jul 14 16:07:25 2014 Eric Wong <e@80x24.org>
- * test/ruby/test_string.rb (TestString#test_index): Add some
- corner cases to tests for String#index, which might fail if ruby
- directly used a buggy memmem(3) implementation.
+ * iseq.h (struct iseq_catch_table_entry): shrink to 32 bytes
+ on x86-64 (from 48 bytes)
-Thu Nov 22 08:06:42 2012 Narihiro Nakamura <authornari@gmail.com>
+Mon Jul 14 16:04:41 2014 Eric Wong <e@80x24.org>
- * test/ruby/test_gc.rb (test_profiler_clear): fix wrong method
- calls [Bug #7419] [ruby-core:49828].
+ * 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
-Thu Nov 22 02:22:33 2012 Tadayoshi Funaba <tadf@dotrb.org>
+Sun Jul 13 17:49:52 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * NEWS: edited (order etc).
+ * ext/openssl/ossl_cipher.c: Fix call to ciphers class method and
+ spell out `encryption` by @vipulnsward [fix GH-664]
-Wed Nov 21 22:52:59 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Jul 13 17:31:51 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * ext/io/wait/wait.c (io_wait_readable): add alias wait_readable.
+ * ext/gdbm/gdbm.c: fix wrong arguments in GetDBM2 macro.
+ * ext/sdbm/init.c: ditto.
- * ext/io/wait/wait.c (io_wait_writable): this is easier to use than
- IO.select for a single IO object and is immune to the
- limitations/inefficiency of select() on platforms where poll/ppoll
- is available. patched by Eric Wong. [Feature #4646]
+Sun Jul 13 17:25:50 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Wed Nov 21 22:27:52 2012 Narihiro Nakamura <authornari@gmail.com>
+ * ext/dbm/dbm.c: fix wrong arguments in GetDBM2 macro by @v2e4lisp.
+ [fix GH-655]
- * gc.c (garbage_collect): remove a duplicative probe.
+Sun Jul 13 16:44:56 2014 Eric Wong <e@80x24.org>
-Wed Nov 21 22:08:48 2012 Narihiro Nakamura <authornari@gmail.com>
+ * vm_core.h (struct rb_call_info_struct): improve packing
+ This reduces the struct from 112 to 104 bytes on x86-64.
- * gc.c (gc_profile_clear): realloc profile records if its size is
- higher than the threshold, GC_PROFILE_RECORD_DEFAULT_SIZE * 2.
+Sun Jul 13 15:53:25 2014 Eric Wong <e@80x24.org>
-Wed Nov 21 21:53:29 2012 Tadayoshi Funaba <tadf@dotrb.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.
- * complex.c (nucomp_to_c): added.
+Sun Jul 13 10:56:26 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Nov 21 21:35:38 2012 Tadayoshi Funaba <tadf@dotrb.org>
+ * configure.in (rb_cv_broken_backtrace): exit with failure
+ normally, no needs to abort. [ruby-core:63678] [Bug #10008]
- * include/ruby/util.h: removed extra semicolon in definition of
- macro.
- * compile.c: ditto.
- * cont.c: ditto.
- * math.c: ditto.
- * node.c: ditto.
- * parse.y: ditto.
+Sat Jul 12 15:10:22 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-Wed Nov 21 18:46:37 2012 Tadayoshi Funaba <tadf@dotrb.org>
+ * ext/win32ole/win32ole.c (fole_record_method_missing): correct
+ fields Hash key.
- * rational.c (read_digits): due to a bit tighter rb_cstr_to_inum().
+Sat Jul 12 04:17:40 2014 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-Wed Nov 21 16:13:37 2012 Koichi Sasada <ko1@atdot.net>
+ * 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.
- * benchmark/bm_so_nsieve_bits.rb: add an encoding pragma because
- this benchmark using strings (literals) as binary sequence.
- Now, they are UTF-8 strings. [ruby-dev:46578]
+Sat Jul 12 01:13:45 2014 Naohisa Goto <ngotogenome@gmail.com>
-Wed Nov 21 00:57:43 2012 KOSAKI Motohiro <kosaki.motohiro@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]
- * file.c (Init_File): null device definition uses rb_define_const
- instead of rb_file_const.
+Fri Jul 11 20:49:10 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-Wed Nov 21 00:28:18 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/win32ole/win32ole.c: add WIN32OLE_RECORD class to support
+ VT_RECORD OLE variables.
- * test/ruby/test_m17n_comb.rb (test_str_crypt): Use RbConfig to get
- libc's directory. Patched by Vit Ondruch [ruby-core:49763] [Bug #7312]
+Fri Jul 11 17:15:08 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Tue Nov 20 23:28:26 2012 Masaki Matsushita <glass.saga@gmail.com>
+ * lib/abbrev.rb: remove executable.
- * marshal.c: add marshal readahead. marshalized Array, Hash and Struct
- have size at least number of its elements, marshal readahead will
- read the certain readable length and buffer when it needs more bytes.
- marshal readahead prevents many calls to IO#getbyte and IO#read,
- then it enables performance improvement.
- [ruby-dev:45637] [Feature #6440]
+Fri Jul 11 16:45:39 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Tue Nov 20 22:35:02 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * lib/fileutils.rb: handle ENOENT error with symlink targeted to
+ non-exists file. [ruby-dev:45933] [Bug #6716]
- * Makefile.in (.d.h): replace char * to const char * because somehow
- current dtrace removes const of function declaration in probes.d.
+Fri Jul 11 15:59:42 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Tue Nov 20 21:41:04 2012 Koichi Sasada <ko1@atdot.net>
+ * array.c: Clarify documentation for Array#insert.
+ [ruby-core:62934] [Bug #9901]
- * include/ruby/debug.h: introduced.
- Debugging/profiling features will be located.
+Fri Jul 11 15:39:36 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * vm_trace.c: expose C-level TracePoint APIs.
- Note that they are experimental.
+ * io.c: Improve Documentation by @dapplebeforedawn.
+ [fix GH-658] [ruby-core:63579] [Bug #10012]
- * vm_trace.c, include/ruby/debug.h: rename `rb_hook_flag_t'
- to `rb_event_hook_flag_t'.
- Macro names `RUBY_HOOK_FLAG_*' are also renamed to
- `RUBY_EVENT_HOOK_FLAG_*'.
+Fri Jul 11 14:19:14 2014 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
- * debug.h, vm_debug.h: rename debug.h to vm_debug.h.
+ * lib/matrix.rb: Fix sign for cross_product [#9499]
- * common.mk: ditto.
-
- * debug.c, main.c, vm_core.h: ditto.
-
-Tue Nov 20 21:12:37 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * configure.in (RUBY_DTRACE_AVAILABLE): only check dtrace availability.
-
- * configure.in (RUBY_DTRACE_POSTPROCESS): restore.
-
-Tue Nov 20 21:22:44 2012 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * test/win32ole/test_win32ole_type.rb (test_implemented_ole_types):
- IShellDispatch6 bundled in Windows 8. Thanks to phasis68 (Heesob
- Park). [ruby-core:49580][Bug #7403]
-
-Tue Nov 20 21:06:41 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * complex.c: some improvements.
- * rational.c: ditto.
-
-Tue Nov 20 21:01:16 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * common.mk (incs): BSD make cannot deal with non-prefixed dependency
- and prefixed target.
-
-Tue Nov 20 20:10:23 2012 Yusuke Endoh <mame@tsg.ne.jp>
-
- * array.c (rb_ary_bsearch): fix rdoc bug (O(n log n) -> O(log n)).
- Patch by Charlie Somerville. [ruby-core:49661] [Bug #7409]
-
- * range.c (range_bsearch): ditto.
-
-Tue Nov 20 19:02:44 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_trace.c: rename and add TracePoint APIs.
- (1) TracePoint.new(...){...} creates a new trace point
- but does not make it enable.
- (2) TracePoint.trace(...){...} creates a new trace point
- and enable it (same as old behavior).
- (3) TracePoint#enable make it enable (renamed from TracePoint#retrace).
- If block given, when enable only in block.
- (4) TracePoint#disable make it disable (renamed from TracePoint#untrace).
- If block given, when disable only in block.
- (5) TracePoint#enabled? returns this trace is enable or not.
- [Feature #6895]
-
- * test/ruby/test_settracefunc.rb: add tests.
-
-Tue Nov 20 18:35:05 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_trace.c: add two methods:
- (1) TracePoint#return_value which returns return
- value on the :return and :c_return event.
- (2) TracePoint#raised_exception which returns raised exception
- value on the :raise event.
- Each methods raise RuntimeError if it is called at unsupported
- event.
- Please review and give us feedback until next preview
- release (Dec/2012) of Ruby 2.0.0.
- [Feature #6895]
-
- * insns.def, vm.c, vm_eval.c, vm_insnhelper.c, eval.c, thread.c:
- ditto.
-
- * vm_trace.c, vm_core.h: move definition of rb_trace_arg_t from
- vm_trace.c to vm_core.h.
- Caller fills rb_trace_arg_t and pass the pointer of this variable.
-
- * test/ruby/test_settracefunc.rb: fix tests to test this change.
-
-Tue Nov 20 17:31:12 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * configure.in: fix dtrace didn't work on darwin.
-
- * configure.in (RUBY_DTRACE_AVAILABLE): unify RUBY_DTRACE_POSTPROCESS
- and RUBY_DTRACE_BSD_BROKEN.
-
-Tue Nov 20 15:20:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * file.c (File.extname): Documentation for extname on dotfiles and
- files ending with a dot. Also, added example for this.
- [ruby-core:47852] [Bug #7112]
-
-Tue Nov 20 14:19:20 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/ruby/test_signal.rb (TestSignal#test_signame): fix windows
- test failure. Process.kill on windows can't send a signal to
- another process.
-
-Tue Nov 20 13:58:11 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * io.c (Init_IO): moved all rb_file_const() into file.c.
- * file.c (Init_File): replace with rb_file_const() with
- rb_define_const() because RDoc don't care rb_file_const.
- [Bug #5530]
-
-Tue Nov 20 12:35:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * ruby.c (usage_msg): Fix typo [ruby-core:49205] [Bug #7327]
-
-Tue Nov 20 12:35:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * file.c (File::NULL): Document File::NULL constant
- [ruby-core:49384] [Bug #7365]
-
-Tue Nov 20 12:05:15 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (rb_w32_read): Windows 8 fixed one of a bug of console
- API.
- based on the patch by Heesob Park at [ruby-core:49479] [Bug #7379]
-
-Tue Nov 20 11:14:33 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * configure.in (--enable-dtrace): always call RUBY_DTRACE_BSD_BROKEN
- for portability.
- As the note, FreeBSD 8 has DTrace as the optional
- feature (it is enabled by the build option), but doesn't have USDT.
- FreeBSD 9 has USDT but they are still optional. FreeBSD 10 will
- enable them by default.
- The variable $rb_cv_prog_dtrace_g is "yes" only on FreeBSD 9 with
- optional DTrace or FreeBSD 10. If it is "no", you cannot know
- whether it doesn't need -G or DTrace is disabled. (by checking
- error code, you can know)
-
-Mon Nov 19 22:55:48 2012 Naohisa Goto <ngotogenome@gmail.com>
-
- * configure.in (--enable-dtrace): change help message
-
-Tue Nov 20 11:05:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/tracer.rb (Tracer.trace_func): printf to stdout
- Patch by Michal Fojtik [ruby-core:45219] [Bug #6490]
-
-Mon Nov 19 21:24:18 2012 Naohisa Goto <ngotogenome@gmail.com>
-
- * vm_dump.c: not to include probes.h because the code does not depend
- on it.
- * common.mk (vm_dump.$(OBJEXT)): remove dependency on probes.h
-
-Tue Nov 20 10:14:22 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (rb_thread_s_check_interrupt): removed redundant
- GET_THREAD().
-
-Tue Nov 20 10:12:46 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (rb_threadptr_async_errinfo_active_p): added a small
- comment.
-
-Tue Nov 20 10:05:56 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Fri Jul 11 11:11:50 2014 Koichi Sasada <ko1@atdot.net>
- * thread.c (rb_thread_blocking_region_end): replaced GET_THREAD()
- with ruby_thread_from_native(). We don't have GVL here.
+ * benchmark/prepare_so_k_nucleotide.rb: use require_relative.
-Tue Nov 20 09:56:15 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * benchmark/prepare_so_reverse_complement.rb: ditto.
- * thread.c (rb_threadptr_execute_interrupts) removed.
- * thread.c (rb_threadptr_execute_interrupts_common) renamed to
- rb_threadptr_execute_interrupts. I.e. unified
- rb_threadptr_execute_interrupts and rb_threadptr_execute_interrupts_common.
- * thread.c (rb_thread_schedule, rb_thread_execute_interrupts) s/_common//.
+Fri Jul 11 10:09:03 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Nov 20 09:48:34 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * pack.c (encodes): fix buffer overrun by tail_lf. Thanks to
+ Mamoru Tasaka and Tomas Hoger. [ruby-core:63604] [Bug #10019]
- * signal.c (rb_get_next_signal): removed pointless signal
- disabling. pthread_sigmask() only changes current thread
- mask.
+Thu Jul 10 23:51:36 2014 Naohisa Goto <ngotogenome@gmail.com>
-Tue Nov 20 09:36:55 2012 KOSAKI Motohiro <kosaki.motohiro@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.
- * signal.c (install_sighandler): added comments why we need
- rb_disable_interrupt().
+Thu Jul 10 15:02:55 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Nov 20 09:31:33 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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]
- * signal.c (rb_disable_interrupt, rb_enable_interrupt): removed
- USE_TRAP_MASK.
- * signal.c (trap_arg, trap_ensure): removed.
- * signal.c (trap, sig_trap): removed pointless signal disabling.
- We don't need it because we no longer run trap handler on signal
- handler context.
+Thu Jul 10 01:09:57 2014 Koichi Sasada <ko1@atdot.net>
-Tue Nov 20 09:20:49 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * symbol.c: remove rb_gc_mark_symbols().
- * prelude.rb: Moved Mutex#synchronize to
- * thread.c (rb_mutex_synchronize_m): here. [Bug #4266]
+ fstrings referred by static symbols and pinned dynamic symbols
+ are registered by rb_gc_register_mark_object().
-Tue Nov 20 08:36:15 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ fstrings referred by dynamic symbols (not pinned symbols)
+ are referred from global_symbols.dsymbol_fstr_hash (Hash object).
- * signal.c (sig_signame): implements Signal.signame method
- [Feature #5613]
- * test/ruby/test_signal.rb (test_signame): adds test for above
- * NEWS: add an item about above
+ 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.
-Mon Nov 19 16:30:59 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ This technique reduces root objects for GC marking.
- * struct.c (rb_struct_each_pair): yield associated pairs so that
- an unsplat argument can get both, for consistency with Hash,
- OpenStruct, and etc. [ruby-dev:46533] [Bug #7382]
-
-Mon Nov 19 16:17:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (LIBS): libelf is need on only FreeBSD.
-
-Mon Nov 19 16:08:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * common.mk (RUBYLIB): purelib option in runruby.rb is deprecated
- since r28841, so set to an empty list to get rid of a bogus path in
- child processes, which caused an insecure operation exception in
- test/ruby/test_encoding.rb:test_unsafe.
-
-Mon Nov 19 15:40:50 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
-
- * .travis.yml (script): add OPTS=-v, requested by @_ko1.
-
-Mon Nov 19 15:09:07 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * configure.in: fix didn't enable_dtrace=yes on auto.
-
- * configure.in: see enable_dtrace for adding libelf on FreeBSD.
-
- * common.mk: VPATH is not needed.
-
-Mon Nov 19 14:55:51 2012 Koichi Sasada <ko1@atdot.net>
-
- * thread.c: add `Thread#backtrace_locations' method.
- This method is similar to `caller_locations' method for
- specific method.
- And fix to accept `level' and `n' parameters for `Thread#backtrace'
- and `Thread#backtrace_locations'.
- `caller' (and `caller_locations') do not return `caller' method
- frame.
- However, `Thread#backtrace' (and `Thread#backtrace_locations')
- return `Thread#backtrace' method frame itself
- if `Thread.current.backtrace' was called.
-
- * vm_backtrace.c: ditto.
+ * gc.c (gc_mark_roots): ditto.
* internal.h: ditto.
- * test/ruby/test_backtrace.rb: add tests.
-
-Mon Nov 19 14:54:32 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * Makefile.in, common.mk (probes.h): moved to common.mk and changed to
- see $(srcdir).
-
- * common.mk (probes.dmyh): now created it on $(srcdir) always.
-
- * win32/Makefile.sub (.SUFFIXES): removed common suffix.
-
-Mon Nov 19 10:00:10 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * Makefile.in (.SUFFIX): bsdmake needs .SUFFIX is defined before use.
-
- * common.mk: fix path of probes.dmyh.
-
- * common.mk (vm_dump.o): depend probes.h.
-
- * configure.in: FreeBSD's USDT requires libelf.
-
-Mon Nov 19 01:11:59 2012 Naohisa Goto <ngotogenome@gmail.com>
-
- * vm_core.h, probes_helper.h (RUBY_DTRACE_FUNC_ENTRY_HOOK,
- RUBY_DTRACE_FUNC_RETURN_HOOK): move from vm_core.h to new file
- probes_helper.h for narrowing dependency to probes.h.
- * common.mk (VM_CORE_H_INCLUDES): remove dependency to probes.h.
- * common.mk (vm.$(OBJEXT)): add dependency to probes_helper.h.
- * vm.c, vm_insnhelper.c: include probes_helper.h.
-
-Sun Nov 18 16:33:00 2012 Naohisa Goto <ngotogenome@gmail.com>
-
- * configure.in, Makefile.in, common.mk: support DTrace on Solaris 10,
- based on r26235 by Yugui. On Solaris 10, low optimization level
- may also be needed, e.g. optflags="-xO1" or "-xO0" with Oracle
- SolarisStudio 12.3 cc.
-
- * configure.in (--enable-dtrace): new option to enable/disable
- DTrace support. By default, trying to enable if dtrace command
- is found on the system. It is disabled when cross compiling.
-
- * configure.in (RUBY_DTRACE_POSTPROCESS): new macro. checks whether
- the dtrace on the system needs postprocessing with "dtrace -G".
- The postprocessing is needed on Solaris 10 and other platforms.
-
- * configure.in (RUBY_DTRACE_BSD_BROKEN): new macro. checks whether
- the dtrace supports USDT.
-
- * configure.in (DTRACE): move after RUBY_DTRACE_POSTPROCESS.
-
- * configure.in (LD): On Solaris, /usr/ccs/bin/ld is preferred.
-
- * configure.in, Makefile.in, common.mk (DTRACE_OBJ): new macro for
- DTrace probe object generated by postprocessing with "dtrace -G".
-
- * Makefile.in, common.mk (probes.$(OBJEXT)): DTrace probe object
- generated by the postprocessing. New file probes.stamp is for
- rebuilding related objects that may be modified by "dtrace -G".
-
- * configure.in, Makefile.in, common.mk (DTRACE_GLOMMED_OBJ): new
- macro for DTrace static library hacks.
-
- * configure.in, Makefile.in (LIBRUBY_A_OBJS): ditto.
-
- * Makefile.in, common.mk (ruby-glommed.$(OBJEXT)): new target with
- rule for DTrace static library hacks.
-
- * common.mk (DTRACE_DEPENDENT_OBJS): objects depended on probes.h.
-
-Sun Nov 18 09:31:47 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * complex.c (read_comp): mathn compliant.
- * rational.c (read_num): ditto.
-
-Sun Nov 18 02:50:12 2012 Luis Lavena <luislavena@gmail.com>
-
- * win32/file.c (replace_to_long_name): correct logic around wildcard
- characters detection and ensure wide-chars are used as pattern.
- [ruby-core:49451] [Bug #7374]
-
-Sun Nov 18 02:02:46 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * complex.c (read_comp): modified handling of polar form.
-
-Sun Nov 18 00:50:44 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * complex.c (read_comp): fixed handling of polar form.
-
-Sun Nov 18 00:14:46 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * complex.c (string_to_c_strict, string_to_c): rewrote without regexp.
- * rational.c (string_to_r_strict, string_to_r): ditto.
-
-Sat Nov 17 23:53:05 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * complex.c (make_patterns): should not accept extra sign.
-
-Sat Nov 17 21:45:12 Luis Lavena <luislavena@gmail.com>
-
- * win32/file.c (replace_to_long_name): skip expansion for all wildcard
- characters.
- [ruby-core:49451] [Bug #7374]
-
- * test/ruby/test_file_exhaustive.rb: add more assertions to test.
-
-Sat Nov 17 12:14:50 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/yaml_tree.rb: use literal YAML style
- when emitting multi-line strings. Thanks @atambo
-
- * test/psych/test_yaml.rb: test for change.
-
-Sat Nov 17 12:03:41 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/scalar_scanner.rb: avoid raising exceptions when
- parsing Floats and Integers. Thanks riffraff [ruby-core:44426]
- * test/psych/test_numeric.rb: associated test
-
-Sat Nov 17 11:34:31 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * st.c (st_update): pass the key in st_table so that we can free
- memory of the key in st_table when deleting.
- [ruby-core:49220] [Bug #7330]
-
- * test/-ext-/st/test_update.rb
- (Bug::StTable#test_pass_objects_in_st_table): add a test.
-
-Sat Nov 17 11:26:36 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/core_ext.rb: move Kernel#y so that it can
- manually be required as 'psych/y'.
-
- * ext/psych/lib/psych/y.rb: ditto
-
-Sat Nov 17 08:13:48 2012 Benoit Daloze <eregontp@gmail.com>
-
- * lib/abbrev.rb: fix r37113. Correct examples, fix style
- and show explicit dependency (require 'abbrev').
-
-Sat Nov 17 07:35:15 2012 Luis Lavena <luislavena@gmail.com>
-
- * win32/file.c (replace_to_long_name): skip automatic path expansion
- when wildcard character is used. [ruby-core:49451] [Bug #7374]
-
- * test/ruby/test_file_exhaustive.rb: add a test for above.
-
-Sat Nov 17 00:50:23 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
- * marshal.c (w_object): add flonum to arg->data to keep reference index
- consistency. [ruby-core:49323] [Bug #7348]
-
- * test/ruby/test_marshal.rb: add a test for above.
-
-Sat Nov 17 00:40:25 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * common.mk (incs): dist files need probes.dmyh.
-
- * common.mk (probes.dmyh): depends on generator script.
-
- * Makefile.in, common.mk, configure.in, win32/Makefile.sub (probes.h):
- select generating with dtrace or copying dummy file by suffix rules.
-
-Fri Nov 16 19:24:10 2012 Koichi Sasada <ko1@atdot.net>
-
- * thread.c (rb_thread_call_without_gvl2): change the parameter of
- `func' from `int *skip_interrupt' to `VALUE *flags'.
- If (flags & RUBY_CALL_WO_GVL_FLAG_SKIP_CHECK_INTS) is not zero,
- then skip checking interrupt.
- [ruby-core:46547]
-
- * include/ruby/thread.h: ditto.
-
-Fri Nov 16 18:59:05 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * Makefile.in (no-dtrace-probes.h): dmyprobes.h is in srcdir.
-
- * common.mk (dmyprobes.h): ditto.
-
-Fri Nov 16 17:57:15 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * Makefile.in (probes.h): split build commands for dtrace-available
- and unavailable platforms.
-
- * Makefile.in (incs): probes.h is a platform dependent file, so it
- cannot be a part of prereq target. move it to all-incs.
-
- * configure.in (DTRACE): move after AC_PROG_CC since cross_compiling
- is set in it.
-
- * configure.in (DTRACE): ignore non-prefixed version if
- cross-compiling.
-
- * Makefile.in, win32/Makefile.sub (probes.h): fix copying dmyprobes.h
- path when outplace-build.
-
-Fri Nov 16 15:27:36 2012 Masaki Matsushita <glass.saga@gmail.com>
-
- * lib/net/pop.rb (POP3.certs): fix typo in comment.
- patch from no6v (Nobuhiro IMAI) <nov@yo.rim.or.jp>.
- [ruby-dev:46519] [Bug #7355]
-
-Fri Nov 16 12:36:47 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * test/rake/helper.rb (Rake::TestCase#setup): revert r37669.
- @orig_PWD should be the original pwd.
-
- * test/rake/test_*.rb: don't use @orig_PWD to load libraries.
- It should be specified with relative path from the file.
-
-Fri Nov 16 10:22:52 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * test/rake/helper.rb (Rake::TestCase#setup): @orig_PWD shouldn't be
- Dir.pwd when the build directory is different from source directory.
-
-Fri Nov 16 09:41:08 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/rake/version.rb: workaround fix to build. see #7366
- [ruby-dev:46522]
-
-Fri Nov 16 07:23:18 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/rake*: Updated to rake 0.9.4
- http://rake.rubyforge.org/doc/release_notes/rake-0_9_4_rdoc.html for
- a list of changes in 0.9.4.
-
- * test/rake*: ditto
-
- * NEWS: ditto
-
-Fri Nov 16 06:58:52 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/rake*: Updated to rake 0.9.3. See
- http://rake.rubyforge.org/doc/release_notes/rake-0_9_3_rdoc.html for
- a list of changes in 0.9.3.
-
- * test/rake*: ditto
-
- * bin/rake: ditto
-
- * NEWS: ditto
-
-Thu Nov 15 22:39:32 2012 Yusuke Endoh <mame@tsg.ne.jp>
-
- * range.c (range_bsearch): fix some bugs: a documentation bug, a wrong
- condition, missed break in switch/case, and workaround for GCC
- optimization. See [ruby-core:49364] in detail. A great patch from
- Heesob Park. [Bug #7352] [Feature #4766]
-
- * array.c (rb_ary_bsearch): fix similar bug (missed break).
-
- * test/ruby/test_range.rb: add two test cases for above.
-
-Thu Nov 15 22:41:57 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_exec.h (GENTRY): GENTRY should be pointer size.
- A patch by yoshidam (Yoshida Masato) [Bug #7332].
-
-Thu Nov 15 13:20:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * man/erb.1: Fix grammar and copyright dates
- * man/goruby.1: ditto
- * man/irb.1: ditto
- * man/rake.1: ditto
- * man/ri.1: ditto
- * man/ruby.1: ditto
- Patch by Arthur Gunn
- [Fixes Github #210]
-
-Thu Nov 15 11:35:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * man/ruby.1: Grammar edits for man page
- Based on a patch by Michael Endsley [Fixes Github #183]
-
-Thu Nov 15 00:47:20 2012 Yusuke Endoh <mame@tsg.ne.jp>
-
- * array.c (rb_ary_bsearch): add Array#bsearch for binary search.
- [ruby-core:36390] [Feature #4766]
-
- * test/ruby/test_array.rb: add a test for above.
-
- * range.c (range_bsearch): add Range#bsearch for binary search.
- [ruby-core:36390] [Feature #4766]
-
- * test/ruby/test_range.rb: add a test for above
-
- * NEWS: added the two new methods.
-
-Wed Nov 14 13:25:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/fileutils.rb (chmod): Add "X" to modes, convert format to table
- [ruby-core:48965] [Bug #7288]
-
-Wed Nov 14 11:51:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/csv.rb (init_comments): Document private method #init_comments.
- Based on a patch from Vincent Batts [ruby-core:49172] [Bug #7319]
-
-Wed Nov 14 00:54:00 2012 Kenta Murata <mrkn@mrkn.jp>
-
- * Makefile.in (probes.h): create from probes.d
-
-Tue Nov 13 18:44:01 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_insnhelper.c (vm_call_cfunc_with_frame): don't use ci after
- EXEC_EVENT_HOOK because ci can be overridden.
-
- * vm_eval.c: ditto.
-
- * method.h: change invoker's parameters types.
-
- * vm_method.c (call_cfunc_invoker_func): ditto.
-
-Tue Nov 13 18:01:54 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * eval.c (rb_mod_using): raise an ArgumentError if cyclic using is
- detected. based on the patch by Charlie Somerville.
- [ruby-core:49092] Bug #7308
-
- * test/ruby/test_refinement.rb: related test.
-
-Tue Nov 13 17:40:04 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * common.mk (vm_insnhelper.c): this target is useless and causes
- ruby always need rebuild.
-
-Tue Nov 13 17:35:49 2012 Koichi Sasada <ko1@atdot.net>
-
- * compile.c (insn_data_to_s_detail): remove debug lines.
-
-Tue Nov 13 17:28:47 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_insnhelper.c (vm_caller_setup_args): save and restore
- ci->argc and ci->blockptr before and after method invocations
- because these method dispatches can override call_info.
-
- * bootstraptest/test_method.rb: add tests for this fix.
-
-Tue Nov 13 16:38:02 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * common.mk (dmyprobes.h): always create for make dist.
-
- * Makefile.in (probes.h): create or copy dmyprobes.h
-
- * win32/Makefile.sub: only do copy dmyprobes.h.
-
-Tue Nov 13 15:37:21 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * Makefile.in (.SUFFIX): .SUFFIX is needed here for .d.h on bsd make.
-
-Tue Nov 13 15:34:35 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * common.mk Makefile.in win32/Makefile.sub (.d.h): it's not common.
-
-Tue Nov 13 12:27:11 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * configure.in: disable dtrace because it doesn't work on FreeBSD.
-
- * common.mk (clean-local): rm probes.h.
-
- * common.mk (parse.o): depend $(PROBES_H_INCLUDES).
-
- * common.mk (.d.h): moved from Makefile.in and use BASERUBY.
-
- * tool/gen_dummy_probes.rb: reimplemented with ruby because sed is not
- available on Windows Microsoft VC++ environment.
-
-Tue Nov 13 12:30:26 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/README.win32: added mention about build directory. currently
- we can not build ruby in win32 directory. this problem is reported
- by Masahiro Kitajima <katonbo@katontech.com>.
-
-Tue Nov 13 11:03:47 2012 Masaki Matsushita <glass.saga@gmail.com>
-
- * re.c (rb_memsearch_ss): performance improvement by using memmem(3) if
- possible. [ruby-dev:45530] [Feature #6311]
-
- * configure.in: check existence of memmem(3) and that it is not broken.
-
-Tue Nov 13 06:50:02 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * probes.d: add DTrace probe declarations. [ruby-core:27448]
-
- * array.c (empty_ary_alloc, ary_new): added array create DTrace probe.
-
- * compile.c (rb_insns_name): allowing DTrace probes to access
- instruction sequence name.
-
- * Makefile.in: translate probes.d file to appropriate header file.
-
- * common.mk: declare dependencies on the DTrace header.
-
- * configure.in: add a test for existence of DTrace.
-
- * eval.c (setup_exception): add a probe for when an exception is
- raised.
-
- * gc.c: Add DTrace probes for mark begin and end, and sweep begin and
- end.
-
- * hash.c (empty_hash_alloc): Add a probe for hash allocation.
-
- * insns.def: Add probes for function entry and return.
-
- * internal.h: function declaration for compile.c change.
-
- * load.c (rb_f_load): add probes for `load` entry and exit, require
- entry and exit, and wrapping search_required for load path search.
-
- * object.c (rb_obj_alloc): added a probe for general object creation.
-
- * parse.y (yycompile0): added a probe around parse and compile phase.
-
- * string.c (empty_str_alloc, str_new): DTrace probes for string
- allocation.
-
- * test/dtrace/*: tests for DTrace probes.
-
- * vm.c (vm_invoke_proc): add probes for function return on exception
- raise, hash create, and instruction sequence execution.
-
- * vm_core.h: add probe declarations for function entry and exit.
-
- * vm_dump.c: add probes header file.
-
- * vm_eval.c (vm_call0_cfunc, vm_call0_cfunc_with_frame): add probe on
- function entry and return.
-
- * vm_exec.c: expose instruction number to instruction name function.
-
- * vm_insnhelper.c: add function entry and exit probes for cfunc
- methods.
-
- * vm_insnhelper.h: vm usage information is always collected, so
- uncomment the functions.
-
-Mon Nov 12 19:14:50 2012 Akinori MUSHA <knu@iDaemons.org>
-
- * configure.in (isinf, isnan): isinf() and isnan() are macros on
- DragonFly which cannot be found by AC_REPLACE_FUNCS(). This
- workaround enforces the fact that they exist on DragonFly.
-
-Mon Nov 12 15:59:38 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * vm_core.h (rb_call_info_t::refinements), compile.c (new_callinfo),
- vm_insnhelper.c (vm_search_method): revert r37616 because it's too
- slow. [ruby-dev:46477]
-
- * test/ruby/test_refinement.rb (test_inline_method_cache): skip
- the test until the bug is fixed efficiently.
-
-Mon Nov 12 14:28:01 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/mkexports.rb (each_export): skip garbage generated by VS2012's
- nmake.
- reported and patched by Yoshida Masato at [Bug #7333] [ruby-dev:46484]
-
-Sun Nov 11 18:58:55 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * test/date/test_date_{parse,strptime}.rb: changed the format of
- some extra messages.
-
-Sun Nov 11 18:41:34 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_parse.c (date__parse): revised the tight parser
- (about handling of apostrophes).
-
-Sun Nov 11 15:39:04 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * hash.c (rb_hash_s_create): just warn for wrong elements now.
- [ruby-dev:46440] [Bug #7300]
-
- * hash.c (rb_hash_s_create): refine error messages.
-
- * error.c (rb_builtin_class_name): share for above.
-
-Sun Nov 11 15:12:18 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * eval.c (top_using): remove Kernel#using, and add main.using instead.
-
- * test/ruby/test_refinement.rb: related test.
-
-Sun Nov 11 13:41:01 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * eval.c (rb_using_refinement, rb_mod_using, f_using): clear method
- cache only when using is called explicitly.
-
- * test/ruby/test_refinement.rb: related test.
-
-Sun Nov 11 12:56:34 2012 Masaki Matsushita <glass.saga@gmail.com>
-
- * lib/pstore.rb (PStore): fix not to replace ThreadError raised in
- #transaction block with PStore::Error.
- [ruby-core:39238] [Bug #5269]
-
-Sun Nov 11 11:36:19 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * vm_core.h (rb_call_info_t::refinements), compile.c (new_callinfo):
- add a new field for inline method cache.
-
- * vm_insnhelper.c (vm_search_method): check rb_call_info_t::refinements
- not to confuse inline method cache when module_eval is used with
- refinements.
-
- * test/ruby/test_refinement.rb: related test.
-
-Sun Nov 11 08:45:45 2012 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * ruby.c: removed a comma before "before"
-
-Sat Nov 10 23:02:31 2012 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c: move immutable fields from struct heaps_slot and struct
- sorted_heaps_slot into struct heaps_header.
- Based on a patch from Sokolov Yura [Feature #6199][ruby-core:43592]
-
-Sat Nov 10 19:28:16 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * complex.c: modified doc.
- * rational.c: ditto.
-
-Sat Nov 10 18:20:10 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_parse.c: edited about era.
-
-Sat Nov 10 12:13:41 2012 Kouhei Sutou <kou@cozmixng.org>
-
- * tool/rbinstall.rb: Don't install *.gemspec under lib/.
- [ruby-core:48966] [Bug #7289]
- Reported by Vit Ondruch. Thanks!!!
-
-Sat Nov 10 00:49:26 2012 Naohisa Goto <ngotogenome@gmail.com>
-
- * ruby_atomic.h: renamed from atomic.h to avoid header file name
- conflict on Solaris 10. [ruby-dev:46414] [Bug #7287]
-
- * gc.c, signal.c, vm_core.h, common.mk: reflect the rename from
- atomic.h to ruby_atomic.h.
-
-Sat Nov 10 00:46:57 2012 Naohisa Goto <ngotogenome@gmail.com>
-
- * atomic.h: Revert r37491 which is a temporary workaround.
-
-Sat Nov 10 00:33:31 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * siphash.h: check configure macros before include newer headers.
-
-Fri Nov 9 23:33:05 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/erb.rb (ERB#run, ERB#result): eval under isolated bindings for
- safe concurrent use. [ruby-core:47638] [Bug #7046]
-
-Fri Nov 9 23:05:06 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * random.c (BYTE_ORDER): define using configured WORDS_BIGENDIAN.
-
- * siphash.c (sip_init_state): use union to suppress warnings by gcc
- 4.7.
-
-Fri Nov 9 19:40:03 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * array.c (rb_ary_splice): fix r37583 doesn't consider the case when
- beg > array length.
-
-Fri Nov 9 16:11:58 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * random.c (rb_memhash): use siphash.
-
-Fri Nov 9 16:08:46 2012 Sokolov Yura funny-falcon <funny.falcon@gmail.com>
-
- * array.c: speedup Array#unshift by using space in shared array.
- [Feature #6638]
- - when array owns its shared array (ARY_SHARED_NUM == 1), and there
- is enough space then try unshift values directly into shared
- array.
- - when resulting array is big (~>64 items) then make it shared with
- enough room for future #unshifts, and then insert into shared
- array.
-
- * array.c (rb_ary_splice): use shared array in rb_ary_slice.
- [Feature #6638]
- - use ary_ensure_room_for_push when rb_ary_slice used to add at the
- end of array, cause rb_ary_concat use rb_ary_slice.
-
- * array.c (ary_ensure_room_for_push): make array really suitable for
- queue. [Feature #6638]
- when array is shared (which happens after Array#shift), and
- ARY_SHARED_NUM == 1 (which is very often when array used as queue),
- then make rb_ary_push push directly into shared array.
-
- * array.c (rb_ary_modify): steal shared array's container when
- ARY_SHARED_NUM == 1. [Feature #6638]
- - Do not allocate new memory in rb_ary_modify when ARY_SHARED_NUM == 1
- and length almost same.
- - Store ARY_CAPA instead of RARRAY_LEN in ary_make_shared, to make
- it useful.
- - Fix rb_ary_sort_bang accordantly.
-
-Fri Nov 9 16:00:00 2012 Zachary Scott <zzak@zacharyscott.net>
-
- * ext/bigdecimal/bigdecimal.c: Documentation for BigDecimal
- Based on a patch from Vincent Batts [ruby-core:49047] [Bug #7305]
-
-Fri Nov 9 15:25:42 2012 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/shellwords.rb (Shellwords#shellescape): Add back my original
- real world example with some enhancement.
-
- * lib/shellwords.rb (Shellwords#shelljoin): Undo part of the
- previous rdoc change. This new example using a string-only
- array was not in line with the description.
-
-Fri Nov 9 12:58:13 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * string.c (rb_str_crypt): crypt(3) may return NULL.
- Latest glibc (2.16?) crypt(3) actually returns NULL. [Bug #7312]
-
-Fri Nov 9 12:07:06 2012 Akinori MUSHA <knu@iDaemons.org>
-
- * include/ruby/ruby.h (alloca), eval_intern.h (alloca), gc.c
- (alloca): Make alloca() globally available by moving the
- ultimate ifdef's to ruby/ruby.h. Gcc hides its builtin alloca()
- when compiling with -ansi, and linking thus fails on platforms
- that lack their own alloca() implementation in libc, which
- include OpenBSD and some ports of NetBSD. We use alloca()
- everywhere including from within third party C extensions, so
- alloca() must be made globally available. [Bug #7307]
-
- * addr2line.c (alloca): Replace the alloca() part with the
- ultimate ifdef's. [Bug #7307]
-
-Fri Nov 9 09:30:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * io.c (IO#new):
- Fix indentation from r37444
- [ruby-core:48052] [Bug #7179]
+Thu Jul 10 00:24:18 2014 Naohisa Goto <ngotogenome@gmail.com>
-Fri Nov 9 07:36:00 2012 Kenta Murata <mrkn@mrkn.jp>
+ * 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.
- * bignum.c (bigmul0): enable big_mul_toom3.
- [ruby-core:48552] [Bug #7242]
+Wed Jul 9 17:07:28 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * bignum.c (bigmul1_toom3): fix incorrect calculation.
- the patch is made by Heesob Park.
- [ruby-core:48552] [Bug #7242]
+ * symbol.c, symbol.h: Symbol class implementation and internals,
+ split from parse.y.
-Fri Nov 9 05:33:00 2012 Kenta Murata <mrkn@mrkn.jp>
+Wed Jul 9 14:45:39 2014 Koichi Sasada <ko1@atdot.net>
- * bignum.c (bigmul0): disable big_mul_toom3 temporarily.
- [ruby-core:48552] [Bug #7242]
+ * parse.y: change Symbol <-> ID relationship to avoid
+ exposing IDs from collectable symbols.
+ [Bug #10014]
- * test/ruby/test_bignum.rb (test_mul_large_numbers):
- add a test for bigmul1_toom3 suggested in [Bug #7242].
+ Now, rb_check_id() returns 0 if corresponding symbol is
+ pinned dynamic symbol.
-Thu Nov 8 21:57:59 2012 Masaki Matsushita <glass.saga@gmail.com>
+ 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.
- * re.c (rb_memsearch): performance improvement by using memchr().
- [ruby-dev:45397] [Feature #6173]
+ * parse.y:
+ add:
+ * STATIC_SYM2ID()
+ * STATIC_ID2SYM()
+ rename:
+ * rb_pin_dynamic_symbol() -> dsymbol_pindown()
-Thu Nov 8 19:02:50 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * internal.h:
+ remove:
+ * rb_check_id_without_pindown()
+ * rb_sym2id_without_pindown()
+ add:
+ * rb_check_symbol()
+ * rb_check_symbol_cstr()
- * lib/net/protocol.rb (Net::InternetMessageIO#each_crlf_line):
- treat \r as newline as mame pointed. [ruby-dev:46425] [Bug #7278]
+ * load.c: use rb_check_id() or rb_check_id_cstr().
-Thu Nov 8 11:32:11 2012 Akinori MUSHA <knu@iDaemons.org>
-
- * configure.in (--with-opt-dir): Avoid nesting of double quotes
- inside backquotes, since some traditional shells like PD KSH
- (which OpenBSD's /bin/sh bases on) fail to parse them.
-
-Thu Nov 8 09:34:00 2012 Kenta Murata <mrkn@cookpad.com>
-
- * numeric.c: Add a caution that the results of the comparing
- operations of two NaNs are undefined.
- [#1720] [ruby-dev:38725] [ruby-core:36966]
-
-Thu Nov 8 04:45:21 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * include/ruby/intern.h: Restore rb_enumeratorize as it was before
- r37497 and introduce rb_enumeratorize_with_size instead. [#7302]
-
- * enumerator.c: ditto.
-
-Wed Nov 7 15:22:37 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * numeric.c (ruby_float_step): fix r37514: it yielded with NaN
- if the unit is infinity.
-
-Wed Nov 7 15:46:12 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * lib/webrick.rb: fix typo. reported by Rohit Arondekar.
- https://github.com/ruby/ruby/pull/211
-
-Wed Nov 7 15:34:12 2012 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
-
- * lib/cgi/core.rb: alias CGI#http_header to CGI#header.
-
-Wed Nov 7 12:49:39 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * eval.c (rb_mod_refine): set RMODULE_IS_REFINEMENT to a created
- refinement module, and don't override method_added.
-
- * vm_method.c (rb_method_entry_make): check redefinition of
- optimized methods when a method is added to a refinement module.
- [ruby-core:48970] [Bug #7290]
-
- * test/ruby/test_refinement.rb: related test.
-
-Wed Nov 7 11:48:14 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * misc/ruby-additional.el (ruby-mode-set-encoding): now encoding needs
- to be set always explicitly actually. [Feature #6679]
-
-Wed Nov 7 09:15:58 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * object.c (rb_mod_const_get): avoid inadvertent symbol creation.
-
-Wed Nov 7 07:52:50 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enum.c (rb_enum_cycle_size): prefix with rb.
-
-Wed Nov 7 04:32:15 2012 Luis Lavena <luislavena@gmail.com>
-
- * test/ruby/test_file_exhaustive.rb: Remove FIXME skip on Windows
- specific test because the test in question was already fixed.
-
-Wed Nov 7 03:45:12 2012 Luis Lavena <luislavena@gmail.com>
-
- * ext/zlib/extconf.rb: Recognize zlibwapi as linking library.
- Patch by Daniel Berger.
-
- [ruby-core:44979] [Feature #6421]
-
-Wed Nov 7 02:06:40 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * enumerator.c: New method #size; constructor accepts size.
- Have #to_enum accept a block
- Warn when using deprecated form of constructor
- Support #size for enumerators created from enumerators
- Support for lazy.{map|flat_map|...}.size.
-
- * include/ruby/intern.h: RETURN_SIZED_ENUMERATOR for support of
- sized enumerators.
-
- * array.c: Support for various enumerator.size.
-
- * enum.c: ditto.
-
- * hash.c: ditto.
-
- * numeric.c: ditto.
-
- * range.c: ditto.
-
- * string.c: ditto.
+ * object.c: ditto.
* struct.c: ditto.
- * vm_eval.c: ditto.
-
-Tue Nov 6 20:40:28 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * object.c (rb_mod_const_get): Fix constant missing exception class
- and message to maintain backwards compatibility. Constant search
- should start at Object when constant starts with '::'
-
- * test/ruby/test_module.rb: test for fixes
-
-Tue Nov 6 16:50:00 2012 Masaki Matsushita <glass.saga@gmail.com>
+ * thread.c: ditto.
- * lib/tempfile.rb (Tempfile#inspect): fix confusing #inspect.
- previous Tempfile#inspect says it is a File, but actually
- it is not a File.
+ * vm_method.c: ditto.
- t = Tempfile.new("foo") #=> #<File:/tmp/foo20121106-31970-1ffbum0>
- t.is_a? File #=> false
+ * string.c (sym_find): use only rb_check_symbol().
- now Tempfile#inspect returns like:
+ * sprintf.c (rb_str_format): use rb_check_symbol_cstr().
- t = Tempfile.new("foo")
- #=> #<Tempfile:/tmp/foo20121106-31970-1ffbum0>
+Wed Jul 9 12:21:55 2014 Koichi Sasada <ko1@atdot.net>
- [ruby-core:47544] [Bug #7027]
+ * parse.y (symbols_i): delete garbage symbols for Symbol.all_symbols.
-Tue Nov 6 16:22:30 2012 Naohisa Goto <ngotogenome@gmail.com>
+Wed Jul 9 05:49:08 2014 Eric Wong <e@80x24.org>
- * atomic.h: add #include <sys/atomic.h> for the workaround of
- header file name conflict of atomic.h with /usr/include/atomic.h
- on Solaris 10. [ruby-dev:46414] [Bug #7287]
+ * thread_pthread.h (struct rb_global_vm_lock_struct):
+ do not expose pthread type for lock
-Tue Nov 6 14:38:00 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Wed Jul 9 05:41:40 2014 Eric Wong <e@80x24.org>
- * test/win32ole/test_win32ole.rb: now source encoding is UTF-8, so
- binary strings in old scripts are dangerous.
+ * thread_pthread.h: remove unneeded semaphore.h include
-Tue Nov 6 14:25:09 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Wed Jul 9 00:12:28 2014 Keiju Ishitsuka <keiju@ishitsuka.com>
- * lib/net/protocol.rb (Net::InternetMessageIO#each_crlf_line):
- don't use /n in universal regexp. [ruby-dev:46394] [Bug #7278]
+ * lib/irb/ruby-lex.rb: fix counting indent in identify_string_dvar.
-Tue Nov 6 09:42:26 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Tue Jul 8 16:58:02 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * string.c (rb_str_b): Add String#b, returning a copied string
- whose encoding is ASCII-8BIT. [ruby-dev:45992] [Feature #6767]
+ * test/ruby/memory_status.rb (Memory::PSCMD): use ps command which
+ outputs expected result. [ruby-dev:48370] [Bug #10010]
-Tue Nov 6 09:37:57 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Tue Jul 8 14:45:17 2014 Koichi Sasada <ko1@atdot.net>
- * ruby.c (load_file_internal): set default source encoding as
- UTF-8 instead of US-ASCII. [ruby-core:46021] [Feature #6679]
+ * parse.y (dsymbol_alloc): set global_symbols.minor_marked to 0.
- * parse.y (parser_initialize): set default parser encoding as
- UTF-8 instead of US-ASCII.
+ * parse.y (dsymbol_check): set RSYMBOL(sym)->fstr to 0
+ because we should not touch fstr after that.
-Tue Nov 6 05:48:06 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+ * parse.y (rb_gc_free_dsymbol): skip deleting str and sym
+ from tables if fstr == 0.
- * test/ruby/test_require.rb
- (TestRequire#test_require_to_path_redefined_in_load_path,
- TestRequire#test_require_to_str_redefined_in_load_path):
- Suppress method redefined warning when test-all with RUBYOPT=-w.
+Mon Jul 7 14:31:52 2014 Koichi Sasada <ko1@atdot.net>
-Thu Nov 8 00:24:14 2012 Akinori MUSHA <knu@iDaemons.org>
+ * parse.y: remove global_symbols::pinned_dsym
+ (and ::pinned_dsym_minor_marked).
- * ext/curses/view.rb: Do not fail if the file to view is shorter
- than the screen height.
+ Mark pinned dsymbols by rb_gc_register_mark_object() because
+ they are immortal.
-Mon Nov 5 11:40:00 2012 Mark Somerville <mark@scottishclmibs.com>
+ * parse.y (rb_gc_free_dsymbol): rename parameter name `ptr' to `sym'.
- * thread_pthread.c (rb_reserved_fd_p): fix typo in macro check
- that prevented the ifdef ever being true.
- [Bug #7281] [ruby-core:48940]
+Mon Jul 7 12:45:51 2014 Koichi Sasada <ko1@atdot.net>
-Mon Nov 5 23:28:57 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+ * gc.c: revert miss-commit.
- * file.c (rb_get_path_check_to_string): extract from
- rb_get_path_check(). We change the spec not to call to_path of
- String object.
+Mon Jul 7 12:40:59 2014 Koichi Sasada <ko1@atdot.net>
- * file.c (rb_get_path_check_convert): extract from rb_get_path_check().
+ * parse.y: need to use updated (re-created) symbols.
- * file.c (rb_get_path_check): follow the above change.
+Mon Jul 7 11:02:55 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * file.c (rb_file_expand_path_fast): remove check_expand_path_args().
- Instead we call it in load.c.
+ * tool/mkconfig.rb: remove not to require rbconfig/obsolete.rb.
- * file.c (rb_find_file_ext_safe): use rb_get_expanded_load_path() to
- reduce expand cost.
+ * lib/rbconfig/obsolete.rb: removed.
- * file.c (rb_find_file_safe): ditto.
+Mon Jul 7 10:52:03 2014 Koichi Sasada <ko1@atdot.net>
- * internal.h (rb_get_expanded_load_path): add a declaration.
+ * parse.y: do not use rb_gc_resurrect(), but create a new dynamic
+ symbol for garbage dynamic symbol.
- * internal.h (rb_get_path_check_to_string, rb_get_path_check_convert):
- add declarations.
+ * common.mk: use gc.h by parse.y.
- * load.c (rb_construct_expanded_load_path): fix for compatibility.
- Same checks in rb_get_path_check() are added. We don't replace
- $LOAD_PATH and ensure that String object of $LOAD_PATH are frozen.
- We don't freeze non String object and expand it every time. We add
- arguments for expanding load path partially and checking if load path
- have relative paths or non String objects.
+Mon Jul 7 02:18:42 2014 Koichi Sasada <ko1@atdot.net>
- * load.c (load_path_getcwd): get current working directory for checking
- if it's changed when getting load path.
+ * string.c (fstr_update_callback): do not use rb_gc_resurrect()
+ any more.
- * load.c (rb_get_expanded_load_path): fix for rebuilding cache properly.
- We check if current working directory is changed and rebuild expanded
- load path cache. We expand paths which start with ~ (User HOME) and
- non String objects every time for compatibility. We make this
- accessible from other source files.
+ Make new frozen string and replace with garbage frozen string.
- * load.c (rb_feature_provided): call rb_get_path() since we changed
- rb_file_expand_path_fast() not to call it.
+ * common.mk: use gc.h from string.c.
- * load.c (Init_load): initialize vm->load_path_check_cache.
+Mon Jul 7 00:36:13 2014 Koichi Sasada <ko1@atdot.net>
- * vm.c (rb_vm_mark): mark vm->load_path_check_cache for GC.
+ * gc.c: rename is_dying_object() to is_garbage_object().
- * vm_core.h (rb_vm_struct): add vm->load_path_check_cache to store data
- to check load path cache validity.
+ * gc.h: rb_objspace_garbage_object_p() as an exported function.
- * test/ruby/test_require.rb (TestRequire): add tests for require
- compatibility related to cached expanded load path.
- [ruby-core:47970] [Bug #7158]
+Sun Jul 6 21:30:35 2014 Koichi Sasada <ko1@atdot.net>
-Mon Nov 5 23:26:05 2012 Greg Price <price@mit.edu>
+ * gc.c (is_dying_object): fix missed condition.
- * load.c (rb_get_expanded_load_path): cache the expanded load
- path. This saves 4KB of allocation and some stats for every
- element of the load path (so nearly a MB in my Rails app)
- on every require.
+ * gc.c (is_live_object): move frequent path first.
- * load.c (rb_construct_expanded_load_path): ensure that $LOAD_PATH
- entries are frozen strings. The user must mutate $LOAD_PATH
- itself rather than its individual entries.
+Sun Jul 6 21:00:11 2014 Koichi Sasada <ko1@atdot.net>
- * vm_core.h (rb_vm_struct): add fields.
+ * 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.
- * vm.c (rb_vm_mark): mark new fields.
+ * gc.c (is_dying_object): change condition.
- * ruby.c (process_options): modify $LOAD_PATH directly rather than
- its elements.
- Patch by Greg Price.
- [ruby-core:47970] [Bug #7158]
+ * gc.c (is_live_object): use T_NONE instead of 0.
-Mon Nov 5 23:24:42 2012 Greg Price <price@mit.edu>
+ * gc.c (rb_objspace_dying_object_p): added.
- * load.c (rb_feature_p, rb_provide_feature): index $LOADED_FEATURES
- so that require isn't so slow.
+Sun Jul 6 13:37:27 2014 Koichi Sasada <ko1@atdot.net>
- * load.c (rb_provide_feature, get_loaded_features_index): ensure
- that $LOADED_FEATURES entries are frozen strings. The user
- must mutate $LOADED_FEATURES itself rather than its individual
+ * gc.c (rb_gc_register_mark_object): change data structure.
+ From single array, to array of arrays. Each array only has 1024
entries.
- * load.c (reset_loaded_features_snapshot): add a new function to reset
- vm->loaded_features_snapshot.
-
- * load.c (get_loaded_features_index_raw): add a new function to get
- the loaded-features index.
-
- * load.c (features_index_add_single): add a new function to add to the
- loaded-features index a single feature.
-
- * load.c (features_index_add): add a new function to add to the
- loaded-features index all the required entries for `feature`.
-
- * vm_core.h (rb_vm_struct): add fields.
-
- * vm.c (rb_vm_mark): mark new fields.
-
- * include/ruby/intern.h (rb_hash_clear): declare function.
-
- * hash.c (rb_hash_clear): make function non-static.
- Patch by Greg Price.
- [ruby-core:47970] [Bug #7158]
-
-Mon Nov 5 23:23:51 2012 Greg Price <price@mit.edu>
-
- * array.c (rb_ary_shared_with_p): new function.
- Expose whether two arrays are shared (read-only, C only).
-
- * include/ruby/intern.h (rb_ary_shared_with_p): declare.
- Patch by Greg Price.
- [ruby-core:47970] [Bug #7158]
-
-Mon Nov 5 23:21:14 2012 Greg Price <price@mit.edu>
-
- * load.c (loaded_feature_path): clarify and briefly comment
- function. These clarifications have no effect on the behavior
- of the function.
-
- * load.c (rb_feature_p): explain the search loop. Especially
- useful because the logic is complicated as described in the
- second paragraph.
- Patch by Greg Price.
- [ruby-core:47970] [Bug #7158]
-
-Mon Nov 5 22:45:03 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * ext/dl/win32/lib/Win32API.rb (Win32API#call): use 64bit pointer for x64
- Windows. This would fix
- TestSecureRandom#test_s_random_bytes_without_openssl error.
- [ruby-core:47451] [Bug #6990]
-
-Mon Nov 5 22:09:26 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * cygwin/GNUmakefile.in (uncommon.mk): link *.res.o.
- EXTOBJES is defined in uncommon.mk. *.res.o setting should be below
- uncommon.mk.
- [ruby-core:48858] [Bug #7277]
-
-Mon Nov 5 11:35:11 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread_pthread.c (native_thread_init, native_thread_destroy):
- removed HAVE_PTHREAD_CONDATTR_INIT check because this silly
- #ifdef makes use-uninitialized-var issue and (2) native_cond_initialize()
- already have a right platform and caller don't need any additional care.
- [Bug #6825]
-
-Mon Nov 5 10:57:59 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/cgi/core.rb: check if Tempfile is defined before use it.
-
- * lib/cgi/core.rb: remove tempfiles only if tempfiles exist
-
-Mon Nov 5 12:17:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/uri/http.rb (URI::HTTP.build): Fix example
- Patch by Carina C. Zona
- [Fixes #209 Github]
-
-Mon Nov 5 09:55:05 2012 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
-
- * lib/cgi/core.rb: remove tempfile more early.
-
-Sun Nov 4 20:29:46 2012 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
-
- * lib/cgi.rb, lib/cgi/*/rb: rename CGI#header to CGI#http_header,
- add and update HTML5 tag generator. [Bug #7110]
- Patch provided by Marcus Stollsteimer, thank you !
-
-Sun Nov 4 11:47:39 2012 Masaki Matsushita <glass.saga@gmail.com>
-
- * lib/fileutils.rb (module FileUtils): repatch [ruby-core:39622]
- [Feature #5337]. improve performance of FileUtils.compare_stream.
- [ruby-core:47545] [Feature #7028]
-
-Sun Nov 4 11:27:54 2012 Masaki Matsushita <glass.saga@gmail.com>
-
- * array.c (recursive_equal): fix to return true when self and other
- are resized to same size and the current index become out of
- range.
-
- * test/ruby/test_array.rb: add a test for the above.
-
-Sun Nov 4 10:19:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dir.c (file_s_fnmatch): match with expanding braces if FNM_EXTGLOB
- is set. [ruby-core:40037] [Feature #5422]
-
-Sat Nov 3 23:38:15 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * complex.c: modified doc.
- * rational.c: ditto.
-
-Sat Nov 3 22:38:55 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_core.c: modified doc.
-
-Sat Nov 3 18:35:55 2012 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * vm.c (rb_vm_rewrite_ep_in_errinfo, vm_rewrite_ep_in_errinfo):
- merge code and remove `rb_vm_rewrite_ep_in_errinfo'.
-
-Sat Nov 3 18:15:24 2012 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * vm.c, proc.c: avoid unnecessary `rb_vm_rewrite_ep_in_errinfo'
- calls.
-
-Sat Nov 3 17:53:43 2012 Kouhei Sutou <kou@cozmixng.org>
-
- * bin/testrb: Use only Test::Unit::AutoRunner in test-unit gem
- compatible API to be available by both test/unit bundled in Ruby
- and test-unit gem.
- * lib/test/unit.rb (Test::Unit::AutoRunner): Move codes from testrb.
-
-Sat Nov 3 14:56:21 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_parse.c (parse_eu): should capture apostrophe too.
-
-Sat Nov 3 14:46:15 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_parse.c (date__parse): revised the tight parser.
-
-Sat Nov 3 14:43:42 2012 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/xmldecl.rb (REXML::XMLDecl#content): Add missing \A
- and \z.
-
-Sat Nov 3 14:42:55 2012 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/output.rb (REXML::Output#initialize): Use normalized
- encoding name.
-
-Sat Nov 3 14:41:17 2012 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/output.rb (REXML::Output): Don't output BOM in middle
- of the output string.
- * test/rexml/test_document.rb: Add a test for the above change.
-
-Sat Nov 3 14:09:55 2012 Kouhei Sutou <kou@cozmixng.org>
-
- * NEWS: Add an item about REXML::Document#write.
-
-Sat Nov 3 13:46:49 2012 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_document.rb: Fix tests that expect encoding name
- isn't normalized.
-
-Sat Nov 3 13:26:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * dir.c (Dir#glob):
- Documentation for pattern section, backslash subsection
- Patch by Eric Bouchut
- [ruby-core:48528] [Bug #7230]
-
-Sat Nov 3 13:26:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * io.c (IO#new):
- Documentation for IO#open modes and formatting
- [ruby-core:48052] [Bug #7179]
-
-Sat Nov 3 13:01:02 2012 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_encoding.rb (EncodingTester#test_in_different_out):
- Fix a test that expects encoding in XML declaration is changed by
- Output's encoding. It is dropped feature.
-
-Sat Nov 3 12:49:45 2012 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/document.rb (REXML::Document#write): Document encoding
- option. Now different encoding between XML file's encoding and
- XML declaration's encoding is support.
- [Feature #4872] (work in progress)
- * lib/rexml/xmldecl.rb (REXML::XMLDecl#write): Always use XMLDecl's
- encoding.
- * test/rexml/test_document.rb: Update tests for the above change.
-
-Sat Nov 3 12:18:35 2012 Masaki Matsushita <glass.saga@gmail.com>
-
- * array.c (recursive_equal): fix not to make invalid pointers when
- self and other are resized to same size in #== of their elements.
- [ruby-dev:46373] [Feature #6177]
-
-Sat Nov 3 12:06:15 2012 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_xml_declaration.rb (TestXmlDeclaration#test_*):
- Remove needless prefix from test names.
-
-Sat Nov 3 12:04:52 2012 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_xml_declaration_parent_child.rb: Rename to ...
- * test/rexml/test_xml_declaration.rb: ... this.
-
-Sat Nov 3 11:43:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * hash.c (rb_hash_delete): Correct grammar
- Patch by Glenn Oppegard
- [Fixes #208 Github]
-
-Sat Nov 3 11:28:28 2012 Narihiro Nakamura <authornari@gmail.com>
-
- * NEWS: add a news about GC::Profiler.raw_data.
-
-Sat Nov 3 11:01:32 2012 Narihiro Nakamura <authornari@gmail.com>
-
- * NEWS: add a news about rb_newobj_of() and NEWOBJ_OF().
-
-Sat Nov 3 10:17:41 2012 Narihiro Nakamura <authornari@gmail.com>
-
- * eval.c (f_current_dirname): add the new method for Kernel.
- This method almost same as File.dirname(__FILE__). One
- different behavior is it returns nil when __FILE__ returns nil.
- [Feature #3346]
-
- * NEWS: ditto
-
- * test/ruby/test_method.rb: related test.
-
-Sat Nov 3 09:03:34 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * test/ruby/test_refinement.rb (test_new_method_by_send,
- test_new_method_by_method_object): add tests for Kernel#send and
- Kernel#method with refinements.
-
- * test/ruby/test_refinement.rb (test_symbol_to_proc): add a test
- calling a proc created by Symbol#to_proc outside the scope where
- a refinement is closed over.
-
-Sat Nov 3 04:14:19 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm.c (rb_vm_rewrite_ep_in_errinfo): rewrite all catch points in
- errinfo, not only the topmost frame. based on the patch by
- ktsj (Kazuki Tsujimoto) in [ruby-dev:45656]. [Bug #6460]
-
-Fri Nov 2 20:11:17 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (MakeMakefile#timestamp_file): remove @ which looks like
- configure variables.
-
- * lib/mkmf.rb (MakeMakefile#timestamp_file): use .-. instead of !, a
- special character of NMAKE and BSD make. [Bug #7265]
-
-Fri Nov 2 17:55:39 2012 Shota Fukumori <sorah@tubusu.net>
-
- * lib/test/unit.rb (_run_parallel): Delete status line before showing
- results. Patch by Hiroshi Shirosaki. [Bug #6897] [ruby-core:47250]
-
- * lib/test/unit.rb (_run_parallel): Fix strange result when disabled retrying.
- Patch by Hiroshi Shirosaki. [Bug #6897] [ruby-core:47250]
-
-Fri Nov 2 17:52:12 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * object.c (rb_mod_to_s): Module#{to_s,inspect}, when invoked on
- a refinement, returns a string in the format #<refinement:C@M>,
- where C is a refined class and M is a module at which the refinement
- is defined.
-
- * eval.c (rb_mod_refine): store information on a refinement for the
- above change.
-
- * test/ruby/test_refinement.rb: related test.
-
-Fri Nov 2 16:57:52 2012 Shota Fukumori <sorah@tubusu.net>
-
- * vm_dump.c (rb_vm_bugreport): Because of many log directories,
- making directory lists readable.
-
-Fri Nov 2 16:44:00 2012 Kenta Murata <mrkn@mrkn.jp>
-
- * vm_dump.c (rb_vm_bugreport): add ~/Library/Logs/DiagnosticReports
- in the locations list of crash reports.
-
-Fri Nov 2 14:52:52 2012 Masaki Matsushita <glass.saga@gmail.com>
-
- * array.c (recursive_equal): performance improvement by avoiding
- overhead to call rb_ary_elt().
- [ruby-dev:45412] [Feature #6177]
-
-Fri Nov 2 14:47:53 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * string.c (sym_to_proc, sym_call): A Proc created by Symbol#to_proc
- should close over the current refinements.
- [ruby-dev:46345] [Bug #7261]
-
- * vm_eval.c (rb_call0, rb_search_method_entry,
- rb_funcall_passing_block_with_refinements): add a new argument
- `refinements' for the above changes.
-
- * test/ruby/test_refinement.rb: related test.
-
-Fri Nov 2 08:24:28 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * proc.c (top_define_method): new method, main.define_method.
- [ruby-core:45715] [Feature #6609]
-
- * eval.c (top_include): fix a warning message, main is not a class or
- module.
-
-Fri Nov 2 04:41:33 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (MakeMakefile#timestamp_file): use ! instead of %, a GNU
- make special character.
-
-Fri Nov 2 04:40:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/ruby/test_process.rb (test_execopts_preserve_env_on_exec_failure):
- use never existing file in the current temporary directory.
-
-Fri Nov 2 04:23:20 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * tool/merger.rb: add feature to tag preview/rc.
-
-Fri Nov 2 03:23:37 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/mkmf.rb: fix for if config["libdir"] is nil.
-
-Thu Nov 1 23:06:01 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * tool/make-snapshot: fix wrong regexp for releasing preview.
- patched by mame.
-
-Thu Nov 1 22:27:11 2012 Koichi Sasada <ko1@atdot.net>
-
- * NEWS: add a news about objspace,
- ObjectSpace.reachable_objects_from.
-
-Thu Nov 1 21:57:00 2012 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.c (BigDecimal_new),
- test/bigdecimal/test_bigdecimal.rb:
- Fix exception message of BigDecimal constructor with a Float.
-
-Thu Nov 1 21:52:20 2012 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.c (BigDecimal_add),
- test/bigdecimal/test_bigdecimal.rb:
- need to specify precision for converting Rational and Float.
- [ruby-core:48045] [Bug #7176]
-
-Thu Nov 1 21:42:20 2012 Yusuke Endoh <mame@tsg.ne.jp>
-
- * test/ruby/test_process.rb: Revert r37404. My ubuntu box has
- actually the directory named "/nonexistent"... Sorry.
-
-Thu Nov 1 21:28:28 2012 Yusuke Endoh <mame@tsg.ne.jp>
-
- * test/ruby/test_process.rb: Process.exec raised EACCES on Linux
- 3.5.0-17-generic. This is a temporal fix to rescue that exception.
- Needs kosaki's review.
-
-Thu Nov 1 21:19:56 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * iseq.c (set_relation): parent_iseq need to be set regardless iseq
- type. fix r37397.
-
-Thu Nov 1 19:47:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * thread_pthread.c (RUBY_STACK_MIN): may not a compile time constant.
- fix r37079. [ruby-dev:46322] [Bug #7247]
-
-Thu Nov 1 16:44:36 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * NEWS: add note for Module#refine, Module#refinements,
- Module#using, and Kernel#using.
-
-Thu Nov 1 14:41:47 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * eval.c (rb_using_module): using should be used indirectly.
- [ruby-dev:46326] [Feature #7251]
-
-Wed Oct 31 18:17:38 2012 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c (gc_profile_record): don't define unused variables when
- GC_PROFILE_MORE_DETAIL is 0.
-
-Wed Oct 31 18:10:53 2012 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c (gc_prof_mark_timer_stop): count is not initialized.
-
-Wed Oct 31 09:28:24 2012 Eric Hodel <drbrain@segment7.net>
-
- * thread.c (rb_thread_call_without_gvl2): Note that ubf() may or may
- not be called with the GVL. Hinted that rb_thread_call_with_gvl()
- can be used to access ruby functionality.
-
-Wed Oct 31 09:06:54 2012 Eric Hodel <drbrain@segment7.net>
-
- * thread.c (rb_thread_call_without_gvl2): Update documentation to
- natural English.
- * thread.c (rb_thread_call_with_gvl): ditto.
-
-Wed Oct 31 02:53:07 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/dl/lib/dl/struct.rb: fix strange require order. [ruby-dev:45702]
-
- * ext/dl/lib/dl/value.rb: ditto
-
- * test/dl/test_c_struct_entry.rb: remove strange require order from
- tests.
-
- * test/dl/test_c_union_entity.rb: ditto
-
-Tue Oct 30 23:59:32 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * eval.c (rb_mod_refine): fix the error message when no block is
- given. [ruby-dev:46319] [Bug #7244]
-
- * test/ruby/test_refinement.rb: related test.
-
-Tue Oct 30 19:27:48 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * process.c (redirect_dup2): set standard handles when new fd is stdio,
- because if there is no allocated console at the moment Windows does
- not automatically associate it for child process's standard handle.
- this is adhoc workaround.
- reported by Martin Thiede at [ruby-core:48542] [Bug #7239].
-
- * io.c (rb_cloexec_dup2): ditto.
-
-Tue Oct 30 03:08:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/rbconfig/obsolete.rb (Config): re-introduce warnings for a
- lame-duck. [ruby-core:46836] [Bug #6809]
-
-Tue Oct 30 02:20:10 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * thread.c: added Thread#thread_variable_(get|set),
- Thread#thread_variable?, and Thread#thread_variables for operating
- on variables that are local to threads. [ruby-core:47790]
-
- * vm.c: ditto
-
- * test/ruby/test_thread.rb: tests for thread variables.
-
-Mon Oct 29 18:22:58 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/stringio/stringio.c (strio_close): close separately per each
- instances, as well as IO.
-
-Mon Oct 29 10:22:00 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/handlers/recorder.rb: added a class for
- recording YAML parse and emit events.
-
- * ext/psych/lib/psych/handler.rb: adding a list of events so that
- handler classes can more easily be meta-programmed.
-
- * test/psych/handlers/test_recorder.rb: tests for the change.
-
-Mon Oct 29 05:48:52 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/ostruct.rb: Add [] and []=, base on a patch by Thomas Sawyer.
- Also accept {Open}Struct as argument to new.
- Add #eql?, #hash & #each_pair
- Protect new_ostruct_member
-
-Mon Oct 29 03:20:58 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/matrix.rb: Fix determinant_e [ruby-dev:46305] [Bug #7228]
-
-Sun Oct 28 23:52:25 2012 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_document.rb: Add tests for parsing XML encoded
- by UTF-8 with BOM.
-
-Sun Oct 28 23:47:09 2012 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/source.rb: Move encoding detection code to base class.
- * lib/rexml/encoding.rb: Remove needless encoding detection code.
-
-Sun Oct 28 21:40:13 2012 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/parsers/baseparser.rb: Fix a bug that UTF-8 is used
- for UTF-16XX encoded XML that doesn't have encoding="UTF-16" in
- XML declaration.
- * test/rexml/test_document.rb: Add tests for the above change.
-
-Sun Oct 28 21:37:34 2012 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_document.rb: Group tests that they parse
- UTF-16XX encoded XML that has encoding="UTF-16" in XML declaration.
-
-Sun Oct 28 21:25:11 2012 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/source.rb (REXML::IOSource#initialize): Reduce
- @line_break initialize code. It should be done only in #encoding=.
- * lib/rexml/parsers/baseparser.rb: Don't set UTF-16 encoding to
- source by encoding="UTF-16" in XML declaration because UTF-16XX
- source encoding should be set in Source#initialize or
- IOSource#initialize. They should handle BOM. Parser should not
- consider about it.
-
-Sun Oct 28 21:18:37 2012 Kouhei Sutou <kou@cozmixng.org>
-
- * test/rexml/test_document.rb: Add tests for parsing XML encoded
- by UTF-16 with BOM.
-
-Sun Oct 28 19:12:11 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_parse.c (iso8601_{ext,bas}_time): should not match
- empty string.
-
-Sun Oct 28 18:51:33 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_parse.c (date__parse): revised the tight parser.
-
-Sun Oct 28 15:41:50 2012 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/document.rb (REXML::Document#write): Add :encoding option
- to support custom XML encoding.
- [Feature #4872] (work in progress)
- * test/rexml/test_document.rb: Add tests for the above change.
-
-Sun Oct 28 15:00:19 2012 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/document.rb (REXML::Document#write): Remove needless
- indent in document.
-
-Sun Oct 28 14:59:14 2012 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/document.rb (REXML::Document#write): Accept options
- Hash as argument.
- * test/rexml/test_document.rb: Add tests for the above change.
-
-Sun Oct 28 14:09:44 2012 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/document.rb (REXML::Document#write): Fix wrong usage
- in document.
-
-Sun Oct 28 14:03:48 2012 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/document.rb (REXML::Document#write): Fix wrong method
- names in document.
-
-Sun Oct 28 10:12:15 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/yaml_tree.rb: `tree` should return the
- same thing on every call.
-
- * test/psych/visitors/test_yaml_tree.rb: related test.
-
-Sun Oct 28 10:05:03 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/yaml_tree.rb: YAML Tree object should
- be able to take an emitter object as it's output.
-
- * test/psych/visitors/test_yaml_tree.rb: related test.
-
-Sun Oct 28 08:23:16 2012 Koichi Sasada <ko1@atdot.net>
-
- * bignum.c (bignew_1): Bignum instances are frozen.
- Feature #3222
-
- * include/ruby/ruby.h: Fixnum instances are also frozen.
-
- * class.c (singleton_class_of): check Bignum before
- singleton checking.
-
- * test/ruby/test_bignum.rb: add a test.
-
- * test/ruby/test_fixnum.rb: ditto.
-
- * test/ruby/marshaltestlib.rb, test/ruby/test_eval.rb,
- test/ruby/test_object.rb: catch up above changes.
-
-Sun Oct 28 04:38:06 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm.c (vm_define_method): remove type and frozen checking.
- Checking is done in `rb_singleton_class()'.
-
-Sun Oct 28 00:49:06 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (assign_in_cond): warn for static content object assignments
- in conditional statements. [ruby-dev:43083] [Feature #4299]
-
-Sat Oct 27 23:33:41 2012 Benoit Daloze <eregontp@gmail.com>
-
- * gc.c (gc_profile_result, gc_profile_report): use internal structures
- to avoid allocations and progressively print the output for #report.
- [ruby-core:47163] [Bug #6865]
-
-Sat Oct 27 11:01:10 2012 Koichi Sasada <ko1@atdot.net>
-
- * numeric.c (rb_float_new_in_heap), include/ruby/ruby.h:
- make all Float objects frozen.
- [ruby-dev:46081] [ruby-trunk - Feature #6936]
- Most part of patch by NARUSE, Yui <naruse@ruby-lang.org>.
-
- * class.c (singleton_class_of): raise TypeError when
- trying to define a singleton method on Float objects.
-
- * vm.c (vm_define_method): ditto.
-
- * test/ruby/marshaltestlib.rb: catch up above changes.
-
- * test/ruby/test_class.rb: ditto.
-
- * test/test_pp.rb: ditto.
-
-Sat Oct 27 10:50:53 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * object.c (rb_mod_const_get): make sure the constant name is
- converted to a string before searching. [ruby-core:48405]
-
-Sat Oct 27 10:12:13 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
-
- * iseq.c (rb_iseq_compile_with_option): Instead of testing
- respond_to, just check if the argument is actually a file,
- because by calling user-defined gets something weired can
- happen. Patch by Glass_saga. [ruby-dev:40202] [Bug #2861]
-
- * parse.y (ripper_initialize): ditto.
-
-Sat Oct 27 10:07:57 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (enum lex_state_e): [EXPERIMENTAL] lex_state as bit field /
- IS_lex_state() macro. based on the patch by Dave B in
- [ruby-core:23503]. [Feature #1493]
-
-Sat Oct 27 10:05:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/win32.h (fstat): use _fstati64() instead of fstati64()
- on mingw32.
-
-Sat Oct 27 06:28:33 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * object.c (rb_mod_const_get): const_get accepts qualified constant
- strings. e.g. Object.const_get("Foo::Bar::Baz") [ruby-core:41404]
-
- * test/ruby/test_module.rb: tests for new behavior
-
-Fri Oct 26 13:24:20 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (literal_concat_gen): merge fixed strings across
- concatenated literals, after an interpolation.
-
-Thu Oct 25 17:48:54 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (has_redirection): should use shell (cmd.exe) when
- the commandline contains '&'.
- reported by Roger Pack at [ruby-core:47912] [Bug #7143], and
- patched by Heesob Park at [ruby-core:47931].
-
-Thu Oct 25 15:00:08 2012 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h, class.c: remove (revert)
- `rb_add_method_cfunc_frameless()' API.
- This API is not mature to become an official API.
- For example, we can not use this API with
- `rb_define_private_method()'.
-
- * method.h, vm_method.c (rb_add_method_cfunc_frameless): removed.
-
-Thu Oct 25 13:35:07 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * tool/mkconfig.rb: remove string literal concatenation.
-
-Wed Oct 24 18:49:16 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/objspace/objspace.c (type2sym, count_objects_size): use enum
- instead of size_t which may be larger than actual values.
-
-Wed Oct 24 17:41:24 2012 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/driver.rb: add `-x' or `--exclude' option
- to specify exclude benchmark name pattern.
- You can specify "-x foo" if you want to exclude the benchmarks
- if the name of benchmark contains `foo'.
-
-Wed Oct 24 11:57:24 2012 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c (gc_prepare_free_objects): rename to match the behavior of
- this function.
-
-Wed Oct 24 11:55:19 2012 Koichi Sasada <ko1@atdot.net>
-
- * ext/objspace/objspace.c (reachable_object_from_i): change data
- structure of the result of reachable objects. Keys of table
- contains object_id of each reachable objects. Value of table
- is an object itself or an instance of InternalObjectWrapper.
- To avoid duplication, we use st_table and object_id keys.
-
- * ext/objspace/objspace.c (type2sym): bug fix.
- Should use `i' instead of `type'.
-
-Wed Oct 24 10:33:09 2012 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (garbage_collect, gc_marks): move the location of
- clear and restore rb_objspace_t::mark_func_data
- from garbage_collect() to gc_marks().
-
-Wed Oct 24 10:17:45 2012 Koichi Sasada <ko1@atdot.net>
-
- * ext/objspace/objspace.c (Init_objspace): add a new method
- `ObjectSpace::InternalObjectWrapper#internal_object_id' which returns
- an object id of a wrapped internal object.
-
-Wed Oct 24 08:55:04 2012 Koichi Sasada <ko1@atdot.net>
-
- * ext/objspace/objspace.c (ObjectSpace.reachable_objects_from):
- internal object support.
- If given object `obj' has references to internal objects
- (such as T_NODE objects), then this method returns instances of
- `ObjectSpace::InternalObjectWrapper' instead of that internal objects.
- This instance contains a reference to an internal object and you can
- check the type of internal object using
- `ObjectSpace::InternalObjectWrapper#type' method.
- Rdoc of `InternalObjectWrapper' is not prepared yet.
-
- * gc.c (rb_objspace_reachable_objects_from), gc.h: change
- an interface of 'rb_objspace_reachable_objects_from()'
-
- * gc.c, gc.h: add two APIs
- - rb_objspace_markable_object_p(obj): check markable or not.
- - rb_objspace_internal_object_p(obj): check internal or not.
-
-Wed Oct 24 05:52:36 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_insnhelper.c (vm_call_method): remove `default' and
- add a case for `VM_METHOD_TYPE_UNDEF'.
-
-Wed Oct 24 05:41:18 2012 Koichi Sasada <ko1@atdot.net>
-
- * eval_error.c (error_print), vm_eval.c (eval_string_with_cref),
- vm_trace.c (rb_suppress_tracing): use TH_PUSH_TAG() instead of
- PUSH_TAG().
-
-Wed Oct 24 05:17:52 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_eval.c (vm_call0_body): remove RUBY_VM_CHECK_INTS()
- after method invocation using rb_call0().
-
- * vm_eval.c (vm_call0_body): remove default section on top of
- switch statement and add cases for `VM_METHOD_TYPE_CFUNC_FRAMELESS'
- and `VM_METHOD_TYPE_UNDEF'.
-
- * vm_eval.c (vm_call0_body): remove useless brackets.
-
-Tue Oct 23 22:34:49 2012 Koichi Sasada <ko1@atdot.net>
-
- * thread.c (thread_raise_m): check interrupts after Thread#raise
- if a target thread is the current thread because the behavior
- of Thread.current.raise is expected to perform same as
- Kernel.raise (by rubyspec).
-
-Tue Oct 23 17:08:39 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ruby.c (usage, process_options): show more info in --help.
- [EXPERIMENTAL] [ruby-core:48072] [Bug #7184]
-
-Tue Oct 23 14:20:43 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * misc/ruby-electric.el using variable `last-command-event' instead of
- obsolete `last-command-char', so that work with Emacs trunk.
- a patch by Victor Deryagin <vderyagin AT gmail.com>.
-
-Tue Oct 23 14:06:47 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (visibility_option): visibility attribute is not
- available before GCC 4, so do not use -fvisibility option in that
- case. [ruby-core:48147] [Bug #7205]
-
-Tue Oct 23 12:57:29 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_core.h, vm_insnhelper.c, vm_eval.c (OPT_CALL_CFUNC_WITHOUT_FRAME):
- add a new optimization and its macro `OPT_CALL_CFUNC_WITHOUT_FRAME'.
- This optimization makes all cfunc method calls `frameless', which
- is faster than ordinal cfunc method call.
- If `frame' is needed (for example, it calls another method with
- `rb_funcall()'), then build a frame. In other words, this
- optimization delays frame building.
- However, to delay the frame building, we need additional overheads:
- (1) Store the last call information.
- (2) Check the delayed frame building before the frame is needed.
- (3) Overhead to build a delayed frame.
- rb_thread_t::passed_ci is storage of delayed cfunc call information.
- (1) is lightweight because it is only 1 assignment to `passed_ci'.
- To achieve (2), we modify GET_THREAD() to check `passed_ci' every
- time. It causes 10% overhead on my environment.
- This optimization only works for cfunc methods which do not need
- their `frame'.
- After evaluation on my environment, this optimization does not
- effective every time. Because of this evaluation results, this
- optimization is disabled at default.
-
- * vm_insnhelper.c, vm.c: add VM_PROFILE* macros to measure behaviour
- of VM internals. I will extend this feature.
-
- * vm_method.c, method.h: change parameters of the `invoker' function.
- Receive `func' pointer as the first parameter.
-
-Tue Oct 23 06:21:05 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/parser.c: just get the constant defined in Ruby.
-
- * ext/psych/lib/psych/syntax_error.rb: Psych::SyntaxError now inherits
- from StandardError rather than SyntaxError. Thanks Eric Hodel!
-
- * test/psych/test_exception.rb: tests for change.
-
-Tue Oct 23 06:17:36 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/scalar_scanner.rb: Cache symbols while
- tokenizing. Thanks Kevin Menard!
-
-Tue Oct 23 06:15:40 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/scalar_scanner.rb: Updated the RegExp to catch
- Strings earlier in the tokenization process. Thanks Kevin Menard!
-
-Tue Oct 23 06:12:39 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/to_ruby.rb: Handle nil tags specially
- to avoid slow method_missing calls. Thanks Kevin Menard!
-
-Tue Oct 23 06:07:57 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/scalar_scanner.rb: Ignore bad timestamps. If
- something looks like a timestamp but has an invalid component, treat
- it as a string instead of throwing an ArgumentError.
- Thanks Rhett Sutphin!
-
- * test/psych/test_scalar_scanner.rb: appropriate tests.
-
-Tue Oct 23 06:04:07 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/scalar_scanner.rb: Fix scalar_scanner to
- understand strings starting with an underscore and containing only
- digits. Thanks Kelley Reynolds.
-
- * test/psych/test_scalar_scanner.rb: test for fix
-
-Tue Oct 23 06:00:41 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych.rb: Changed comment in psych.rb to update new
- home page for libyaml. Thanks to Carolyn Ann.
-
-Sun Oct 21 19:12:59 2012 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * vm_core.h (rb_vm_t::trace_running): add a new field
- `trace_running' to store vm global tracing status.
-
- * vm_trace.c: fix SEGV bug. event_hook was free'd
- even when the hook is still used in another thread.
- [ruby-dev:46141] [Bug #7032]
-
-Sun Oct 21 19:12:42 2012 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * vm_core.h (rb_vm_t::trace_flag): remove `trace_flag'
- which is no longer used.
-
-Sun Oct 21 18:34:27 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_parse.c (date__parse): uses more tight parser if
- defined TIGHT_PARSER. now inactivated; because it introduces
- incompatibilities and it is a bit slow.
-
-Sat Oct 20 15:35:06 2012 Narihiro Nakamura <authornari@gmail.com>
-
- * include/ruby/ruby.h: add C APIs.
- VALUE rb_newobj_of(VALUE klass, VALUE flags)
- #define NEWOBJ_OF(obj,type,klass,flags)
- These allow to change a allocation strategy depending on klass
- or flags.
-
- * gc.c: ditto
-
- * array.c: use new C API.
- * bignum.c: ditto
- * class.c: ditto
- * complex.c: ditto
- * ext/socket/ancdata.c: ditto
- * ext/socket/option.c: ditto
- * hash.c: ditto
- * io.c: ditto
- * marshal.c: ditto
- * numeric.c: ditto
- * object.c: ditto
- * random.c: ditto
- * range.c: ditto
- * rational.c: ditto
- * re.c: ditto
- * string.c: ditto
- * struct.c: ditto
- [Feature #7177][Feature #7047]
-
-Sat Oct 20 12:50:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * ext/socket/socket.c: Documentation for Socket
- Based on a patch by David Albert
- [Bug #7105] [ruby-core:47828]
-
-Sat Oct 20 11:00:00 2012 Zachary Scott <zachary@zacharyscott.net>
-
- * lib/open-uri.rb: Documentation for OpenURI
-
-Sat Oct 20 06:18:34 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * hash.c (initialize_copy): unset the default proc if there isn't one
- for the target hash, call to_hash, check frozen status.
-
-Fri Oct 19 22:22:01 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm.c (rb_vm_jump_tag_but_local_jump): pass through thrown objects.
- [ruby-dev:46234] [Bug #7185]
-
- * vm_eval.c (rb_eval_cmd): if state is non-zero, val should be nil and
- rb_vm_jump_tag_but_local_jump() just jump tag.
-
-Fri Oct 19 22:11:55 2012 Benoit Daloze <eregontp@gmail.com>
-
- * pack.c (pack_unpack): set encoding of the
- 'H','h','B' and 'B' modifiers to US-ASCII.
-
- * test/ruby/test_pack.rb: tests for the above.
- [ruby-core:47653][Bug #7050]
-
- * test/test_securerandom.rb: tests for SecureRandom.hex
- from tenderlove. [ruby-core:46792][Bug #6799]
-
-Fri Oct 19 19:29:11 2012 Koichi Sasada <ko1@atdot.net>
-
- * method.h (rb_method_cfunc_t::invoker): add new field (func ptr)
- `invoker'. `invoker' function invoke cfunc body
- (rb_method_cfunc_t::func).
- `invoker' is set at method definition timing.
- With this change, the big `switch' (branch) in `call_cfunc()'
- is no longer needed.
- However, the performance benefit is only a bit.
-
- * vm_core.h (rb_call_info_t::aux::func): add a new field to store
- cfunc body function pointer.
-
- * vm_method.c (call_cfunc_invoker_func): add a new function which
- returns a suitable invoke function.
-
- * vm_method.c (setup_method_cfunc_struct): added.
-
- * vm_method.c (rb_add_method): fix to set `invoker'.
-
- * vm_eval.c (vm_call0_body): catch up above changes.
-
- * vm_insnhelper.c (call_cfunc): removed.
-
- * vm_insnhelper.c (vm_call_cfunc): fix to call cfunc body
- with `invoker' function.
-
-Fri Oct 19 16:55:58 2012 Koichi Sasada <ko1@atdot.net>
-
- * eval.c, vm_eval.c: use TH_PUSH_TAG() instead of PUSH_TAG().
-
-Fri Oct 19 11:13:55 2012 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/driver.rb: remove unexpected `output'.
- (commit miss)
-
-Fri Oct 19 10:24:03 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_insnhelper.c (vm_search_method): remove needless local variable.
-
-Fri Oct 19 10:22:26 2012 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/bmx_temp.rb: removed.
- This file should not be in repository.
-
-Fri Oct 19 10:20:10 2012 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/driver.rb: add new option `--ruby-arg [ARG]'
- which is passed as a launch parameter for each ruby's execution.
- ($ ruby [ARG] [File])
-
-Thu Oct 18 18:42:35 2012 Koichi Sasada <ko1@atdot.net>
-
- * insns.def (opt_send_simple): move the location of
- `opt_send_simple' to the place near `send' definition.
- (to take care about icache locality).
-
-Thu Oct 18 18:29:25 2012 Koichi Sasada <ko1@atdot.net>
-
- * insns.def (send): remove unused condition.
- This condition will be true after r37258.
-
- * vm_insnhelper.c (vm_caller_setup_args): remove `UNLIKELY' on
- checking blockiseq (it seems `LIKELY').
-
-Thu Oct 18 17:31:58 2012 Koichi Sasada <ko1@atdot.net>
-
- * insns.def (opt_send_simple): introduce new instruction used
- when no need to care about block and splat.
-
- * compile.c: use the `opt_send_simple' instruction.
-
-Thu Oct 18 16:44:07 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_method.c (rb_add_method_cfunc, rb_add_method_cfunc_frameless):
- check arity earlier at definition time.
-
-Thu Oct 18 15:11:31 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_insnhelper.c: add `inline' keyword to several functions.
- Compilers (gcc) are conservative than I expected.
-
-Thu Oct 18 15:01:15 2012 Koichi Sasada <ko1@atdot.net>
-
- * include/ruby/ruby.h: add a decl. of
- `rb_define_frameless_method()'.
-
-Thu Oct 18 14:31:17 2012 Koichi Sasada <ko1@atdot.net>
-
- * compile.c (new_callinfo): set a temporary index of callinfo
- (used in `iseq_set_sequence()') to rb_call_info_t::aux::index.
- rb_call_info_t::argc is initialized by same value of
- rb_call_info_t::orig_argc.
-
-Thu Oct 18 14:11:08 2012 Koichi Sasada <ko1@atdot.net>
-
- * class.c (rb_define_frameless_method): rename from
- rb_define_method_fast(). Defined method with this C API
- does not make a method frame. It is bit lightweight than
- ordinal C functions. Now only 0 or 1 argc are permitted.
-
- * method.h (VM_METHOD_TYPE_CFUNC_FRAMELESS): rename macro name
- from VM_METHOD_TYPE_CFUNC_FAST.
-
- * vm_insnhelper.c, vm_method.c: rename related functions.
-
- * proc.c (rb_method_entry_arity): catch up above changes.
-
-Thu Oct 18 10:30:34 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (assignable_gen): fail if yyerror occurred. fix a bug in
- r36973.
-
-Thu Oct 18 09:23:03 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+ * vm.c (Init_vm_objects): change default capa from 1 to 128.
- * hash.c (initialize_copy): duping should rehash the hash.
+Sat Jul 5 05:05:53 2014 Vipul A M <vipulnsward@gmail.com>
- * test/ruby/test_hash.rb: added a test to ensure rehash.
+ * lib/irb/locale.rb (IRB::Locale#modifier): fix wrong attr_reader
+ `modifieer` => `modifier` from irb locale. [fix GH-656]
-Wed Oct 17 21:16:47 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+Fri Jul 4 20:45:26 2014 Koichi Sasada <ko1@atdot.net>
- * common.mk (WPROGRAM): need same dependencies as PROGRAM.
+ * parse.y: rename symbols::sym_id to symbols::str_id.
+ This table is not {Symbol => ID} table, but
+ {String => ID} table.
- * cygwin/GNUmakefile.in (uncommon.mk): move include position
- below WPROGRAM definition to be defined in uncommon.mk.
+ * parse.y (lookup_sym_id): also rename lookup_sym_id() to
+ lookup_str_id() because key is not Symbol, but String.
- * ext/extmk.rb (all, static): fix make rubyw.exe failure with make -jN.
- If make of ruby.exe and rubyw.exe run in parallel, link dll and link
- exe run in parallel, which causes link failure on mingw. To fix this,
- we make ruby.exe and rubyw.exe in one make process.
- [ruby-core:48007] [Bug #7165]
+Fri Jul 4 18:42:04 2014 Koichi Sasada <ko1@atdot.net>
-Wed Oct 17 16:25:34 2012 Koichi Sasada <ko1@atdot.net>
+ * parse.y (must_be_dynamic_symbol): fix missed-condition.
- * benchmark/bm_vm2_method_missing.rb: add a benchmark to measure
- performance of invoking `method_missing'.
+Fri Jul 4 18:38:11 2014 Koichi Sasada <ko1@atdot.net>
-Wed Oct 17 16:23:17 2012 Koichi Sasada <ko1@atdot.net>
+ * parse.y (rb_pin_dynamic_symbol): should be `static' function.
- * vm_insnhelper.c (vm_getivar): fix to use `aux.index' instead of
- `aux.opt_pc'.
+Fri Jul 4 18:03:35 2014 Koichi Sasada <ko1@atdot.net>
-Wed Oct 17 16:03:54 2012 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.
- * vm_insnhelper.c (vm_call_method_missing): make a refactoring
- about method_missing process. Use `vm_call_method()' to invoke
- `method_missing' method instead of `rb_funcall2()'.
- In `vm_call_method()', set fastpath to `vm_call_method_missing()'
- if it can be cached.
+Fri Jul 4 11:53:56 2014 Koichi Sasada <ko1@atdot.net>
- * vm_core.h (rb_call_info_t): add new field
- `rb_call_info_t::aux::missing_reason' to pass the reason to
- `vm_call_method_missing()'.
+ * parse.y: remove unused code
+ surrounded by `#if ENABLE_SELECTOR_NAMESPACE'
-Wed Oct 17 15:33:12 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Jul 4 10:08:24 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * configure.in (opt-dir): allow multiple directories separated by
- $PATH_SEPARATOR as well as dir_config in mkmf.rb. [ruby-core:47868]
- [Bug #7120]
+ * 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.
-Wed Oct 17 15:08:13 2012 Shugo Maeda <shugo@ruby-lang.org>
+Fri Jul 4 04:42:05 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * lib/net/imap.rb: fix Net::IMAP::ResponseParser to accept
- message/delivery-status ([ruby-core:47920] [Bug #7146]),
- message/rfc822 attachments ([ruby-core:47921] [Bug #7147]), and
- (BODY ("MIXED")) ([ruby-core:47951] [Bug #7153]).
- patched by Tony Arkles.
+ * lib/net/http/response.rb (Net::Inflater#inflate_adapter):
+ prevent automatic encoding conversion.
- * test/net/imap/test_imap_response_parser.rb: related test.
+Fri Jul 4 04:39:52 2014 NARUSE, Yui <naruse@ruby-lang.org>
-Wed Oct 17 11:04:48 2012 NAKAMURA Usaku <usa@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.
- * test/ruby/test_hash.rb (TestHash#test_dup_equality): added a new test
- to show the problem of r37232.
+Fri Jul 4 02:56:04 2014 NARUSE, Yui <naruse@ruby-lang.org>
-Wed Oct 17 10:48:40 2012 Shugo Maeda <shugo@ruby-lang.org>
+ * lib/uri/generic.rb (URI::Generic#query=): remove validation, just
+ escape. [Feature #2542]
- * vm_insnhelper.c (vm_search_method): fix a build error that occurs
- when OPT_INLINE_METHOD_CACHE is 0.
+ * lib/uri/generic.rb (URI::Generic#fragment=): ditto.
-Wed Oct 17 08:46:47 2012 Koichi Sasada <ko1@atdot.net>
+ * lib/uri/generic.rb (URI::Generic#check_query): removed.
- * benchmark/bm_vm2_dstr.rb: add a benchmark to measure
- performance of dynamic generated string ("foo#{bar}baz").
+ * lib/uri/generic.rb (URI::Generic#set_query): ditto.
-Wed Oct 17 08:32:46 2012 Koichi Sasada <ko1@atdot.net>
+ * lib/uri/generic.rb (URI::Generic#check_fragment): ditto.
- * compile.c (compile_dstr_fragments): use `putobject' instead of
- `putstring' for all of strings used by NODE_DSTR because
- ruby users can not grab this string.
- For example, the string object of "baz" in "foo#{bar}baz"
- is located by `putobject' (users can not touch "baz" object
- directly). This change reduces GC pressure.
- This improvement is suggested by Aaron Patterson.
+ * lib/uri/generic.rb (URI::Generic#set_fragment): ditto.
-Wed Oct 17 08:02:57 2012 Koichi Sasada <ko1@atdot.net>
+Thu Jul 3 12:40:22 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * thread.c (rb_threadptr_interrupt_mask): fix to check interrupt
- after interrupt_mask changed.
+ * configure.in (--with-static-linked-ext): fix for extensions to
+ be linked statically.
-Wed Oct 17 06:42:47 2012 Koichi Sasada <ko1@atdot.net>
+ * Makefile.in, common.mk: use ENCSTATIC for enc directory.
- * vm_insnhelper.c (vm_call_method): fix to return value immediately.
- Remove CHECK_INTS() after that method dispatch.
-
-Wed Oct 17 06:25:56 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * hash.c (initialize_copy): copy the underlying st_table on dup,
- rather than copying the hash key by key. [ruby-core:48009]
-
- * test/ruby/test_hash.rb: relevant tests for initialize_copy
-
-Wed Oct 17 06:17:44 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_insnhelper.c (vm_call_iseq_setup_2): separate tailcall and normal
- method frame setup functions.
- Add checking interrupts at the tailcall setup function.
-
-Wed Oct 17 05:35:37 2012 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/bm_vm1_yield.rb: add a benchmark to measure `yield'
- (invoke empty block) performance.
-
- * benchmark/bm_vm2_method_with_block.rb: add a benchmark to measure
- method invocation with empty block.
-
-Wed Oct 17 05:05:07 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_insnhelper.c (vm_invoke_block): vm_caller_setup_args() can skip
- when splat flag is not set.
-
-Wed Oct 17 01:53:47 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_insnhelper.c (vm_getivar, vm_setivar): support index inline cache
- with rb_call_info_t to speedup `attr' getter and setter.
- Cached index is stored in rb_call_info_t::aux::index.
- `index' == 0 means not cached. `index' > 0 means cached and cached
- index is `index - 1'.
-
- * insns.def ((get|set)instancevariable): use new wrapper functions
- vm_(get|set)instancevariable() defined in vm_insnhelper.c.
-
- * vm_core.h (rb_call_info_t::aux): introduce new union data because
- opt_pc can share with index.
-
-Tue Oct 16 22:24:44 2012 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/driver.rb (show_results): Show speedup ratio
- with first executables score at last of results
- if two or more executables are given.
-
-Tue Oct 16 21:59:01 2012 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/driver.rb: some refactoring.
- (1) Remove `average differential'.
- In this benchmark driver, We should not care about `average'.
- We use fastest score because this score should not include
- any disturbances (affections of background process, etc).
- If you care about timing affect, I recommend `median'
- score with more than 5 examinations rather than simple
- `average' score (`average' score was affected by error scores).
- (2) Show log file name.
- (3) Change default directory from './' to driver's directory.
-
-Tue Oct 16 14:56:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (rb_file_join): need to check again after any conversion run.
- [ruby-core:48012] [Bug #7168]
-
-Tue Oct 16 12:52:14 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * test/ruby/envutil.rb (Test::Unit::Assertions#assert_file):
- rename from file_assertion.
-
-Tue Oct 16 11:30:18 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (rb_file_join): hide the result under construction until
- return.
-
- * file.c (rb_file_join): check nul-byte only for strings, since
- FilePathStringValue() does it. [ruby-core:48012] [Bug #7168]
-
- * file.c (rb_file_join): path names must be ASCII-compatible.
- [ruby-core:48012] [Bug #7168]
-
- * file.c (check_path_encoding): new function to ensure path name
- encoding to be ASCII-compatible.
-
-Tue Oct 16 09:40:04 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_regexp.rb
- (TextRegexp#test_raw_hyphen_and_tk_char_type_after_range): use
- Regexp.new instead of literal to ignore a parser warning.
-
-Tue Oct 16 09:30:30 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_regexp.rb
- (TextRegexp#test_raw_hyphen_and_tk_char_type_after_range): ignoring
- warnings are already set in setup method.
-
-Tue Oct 16 06:44:06 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_insnhelper.c (VM_CALLEE_SETUP_ARG): fix wrong condition.
-
-Tue Oct 16 06:29:18 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_insnhelper.c (vm_call_method): disable CI_SET_FASTPATH() if
- this method call needs splat argument because cached functions
- (vm_call_attrset, vm_call_ivar, vm_call_cfunc_fast_(unary|binary))
- do not check an arity.
-
- * bootstraptest/test_method.rb: add a test to check an above issue.
-
-Tue Oct 16 06:15:44 2012 Koichi Sasada <ko1@atdot.net>
-
- * method.h: introduce new method type VM_METHOD_TYPE_CFUNC_FAST.
- This method is similar to VM_METHOD_TYPE_CFUNC methods, but
- called cfunc without building new frame (does not push new control
- frame). If error is occurred in cfunc, the backtrace only shows
- caller frame and upper.
- This kind of methods can be added by rb_define_method_fast().
- This feature is similar to specialized instructions (opt_plus, etc),
- but more flexible (but a bit slower).
-
- * class.c (rb_define_method_fast): added.
- Maybe it will be renamed soon.
-
- * vm_insnhelper.c (vm_call_method): support method type
- VM_METHOD_TYPE_CFUNC_FAST.
-
- * proc.c (rb_method_entry_arity): catch up new method type.
-
- * vm_method.c (rb_add_method_cfunc_fast): added.
-
-Tue Oct 16 02:32:29 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_insnhelper.h (CI_SET_FASTPATH): add new parameter `enabled'.
- If `enable' is 0 then CI_SET_FASTPATH() doesn't work.
- And add new configuration option OPT_CALL_FASTPATH. If this macro
- was defined by 0, then CI_SET_FASTPATH() doesn't work any more.
-
- * vm_insnhelper.c (vm_call_method): Pass `0' for `enabled' parameter
- of CI_SET_FASTPATH if this method is protected.
-
-Tue Oct 16 02:17:35 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_core.h (VM_CALL_*): rename VM_CALL_*_BIT
- to VM_CALL_* (remove `_BIT' suffix).
- Add comments on each macros.
- Remove unused macro VM_CALL_TAILRECURSION_BIT.
-
- * compile.c, iseq.c, insns.def, vm_insnhelper.c: ditto.
-
-Mon Oct 15 22:14:44 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/ruby/envutil.rb (Test::Unit::Assertions#file_assertion):
- rewrite file assertions.
-
-Mon Oct 15 09:41:17 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_insnhelper.c (VM_CALLEE_SETUP_ARG): skip CI_SET_FASTPATH() if
- it was called from vm_yield_setup_args().
-
-Mon Oct 15 05:20:13 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_insnhelper.h CI_SET_FASTPATH: introduce new macro
- `CI_SET_FASTPATH(ci, func)'. This macro set `ci->call' as `func'.
- `func' (ci->call) is called at the last of `send'
- (and `invokesuper') instruction.
- `CI_SET_FASTPATH' does not set `ci->call' when the method
- (stored in `ci->me') is `protected'.
-
- * vm_insnhelper.c (vm_call_method): use `CI_SET_FASTPATH'.
- After several checking (visibility, argc checking), the result of
- checking can be reused until re-definition of this method
- with inline method cache.
-
- Note that this optimization is now experimental.
- If you find any problem about it, please tell us.
-
-Mon Oct 15 04:51:55 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_insnhelper.c: refactoring.
- - move all `call' related functions to the last of file.
- - make functions for respective method types in vm_call_method().
- (all functions have same function parameters)
-
- * vm_core.h: add `opt_pc' field in `rb_call_info_t'
- as temporal variable.
-
- * vm_eval.c (vm_call0_body): catch up above changes.
-
-Mon Oct 15 03:51:46 2012 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/bm_vm1_attr_ivar(_set).rb: added (for method dispatch speed).
-
- * benchmark/bm_vm1_float_simple.rb: added (for flonum/float).
-
-Mon Oct 15 02:51:16 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_eval.c (vm_call0_body): add new function.
- `vm_call0()' makes call_info struct and calls `vm_call0_body()'
- with this struct. In near future, `vm_call0()' will be removed
- because all of `vm_call0()' users setup call_info struct by itself.
-
-Mon Oct 15 01:38:06 2012 Koichi Sasada <ko1@atdot.net>
-
- * insns.def (send, invokesuper, invokeblock, opt_*), vm_core.h:
- use only a `ci' (rb_call_info_t) parameter instead of using
- parameters such as `op_id', 'op_argc', `blockiseq' and flag.
- These information are stored in rb_call_info_t at the compile
- time.
- This technique simplifies parameter passing at related
- function calls (~10% speedups for simple method invocation at
- my machine).
- `rb_call_info_t' also has new function pointer variable `call'.
- This `call' variable enables to customize method (block)
- invocation process for each place. However, it always call
- `vm_call_general()' at this changes.
- `rb_call_info_t' also has temporary variables for method
- (block) invocation.
-
- * vm_core.h, compile.c, insns.def: introduce VM_CALL_ARGS_SKIP_SETUP
- VM_CALL macro. This flag indicates that this call can skip
- caller_setup (block arg and splat arg).
-
- * compile.c: catch up above changes.
-
- * iseq.c: catch up above changes (especially for TS_CALLINFO).
-
- * tool/instruction.rb: catch up above changes.
-
- * vm_insnhelper.c, vm_insnhelper.h: ditto. Macros and functions
- parameters are changed.
-
- * vm_eval.c (vm_call0): ditto (it will be rewritten soon).
-
-Sun Oct 14 12:30:44 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ruby.c (rb_f_sub, rb_f_gsub): pass the given block.
- [ruby-core:47967] [Bug #7157]
-
-Sat Oct 13 23:15:39 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * regparse.c (parse_char_class): should match with a hyphen after a
- range in a character class.
-
- * test/ruby/test_regexp.rb (TestRegexp#test_char_class): fixed wrong
- test.
-
- * test/ruby/test_regexp.rb (TestRegexp#check): now can accept the
- error message.
-
- * test/ruby/test_regexp.rb
- (TextRegexp#test_raw_hyphen_and_tk_char_type_after_range): renamed
- because the previous name was wrong.
-
- * test/ruby/test_regexp.rb
- (TextRegexp#test_raw_hyphen_and_tk_char_type_after_range): added
- more test pattern.
-
-Sat Oct 13 03:01:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (realpath_rec): prevent link from GC while link_names refers
- the content.
-
-Sat Oct 13 01:37:48 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_regexp.rb
- (TestRegexp#test_raw_hyphen_and_type_char_after_range): added new
- test. ref [ruby-core:47115] [Backport #6853]
-
-Fri Oct 12 21:55:08 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * include/ruby/win32.h (rb_w32_pow): set floating point precision
- for mingw-w64 x86 pow(). This improves the precision of pow() on
- Windows XP for TestFloat#test_round_with_precision failure.
- [ruby-core:47911] [Bug #7142]
-
-Fri Oct 12 21:37:25 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * test/webrick/test_cgi.rb (TestWEBrickCGI#test_cgi): skip a test
- depending on locale on Windows. ENV[] doesn't work properly if
- console code page is not equal to file system encoding.
- [ruby-core:47910] [Bug #7140]
-
-Fri Oct 12 20:40:29 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (posix_sh_cmds): the command name of colon is ":".
-
-Fri Oct 12 18:18:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (rb_get_path_check): path name must not contain NUL bytes.
-
-Fri Oct 12 16:06:20 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * tool/merger.rb: now can merge revision(s) without --ticket again.
-
-Fri Oct 12 14:10:41 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (dir_config, init_mkmf): use configured libdir value as
- default library path. [ruby-core:43726] [Bug #6207]
-
-Fri Oct 12 05:25:00 2012 Zachary Scott <zzak@ruby-lang.org>
-
- * lib/timeout.rb (timeout):
- Remove paragraph on wrong implementation detail.
- [ruby-core:47739] [Bug #7088]
-
-Thu Oct 11 23:09:46 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_str_sub{seq,pos,str}, rb_str_each_{line,codepoint}):
- prevent String copies from GC. [ruby-core:47881] [Bug #7135]
-
-Thu Oct 11 07:40:50 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * iseq.c (insn_operand_intern): cast op to rb_call_info_t* before
- compare with iseq->callinfo_entries whose type is rb_call_info_t*.
-
-Thu Oct 11 03:37:08 2012 Koichi Sasada <ko1@atdot.net>
-
- * bootstraptest/test_block.rb: add tests for block with super.
-
-Thu Oct 11 02:54:07 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_dump.c: fix debug prints to catch up recent changes
- such as VM data structures.
-
-Thu Oct 11 02:50:34 2012 Koichi Sasada <ko1@atdot.net>
-
- * iseq.c (insn_operand_intern): add support disasm TS_CALLINFO
- operands.
-
-Wed Oct 10 15:12:48 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_process.rb (TestProcess#test_execopts_gid): skip on
- windows because the platform does not have Process.group method.
- patched by Jon Forums in [ruby-core:47878] [Bug #7133].
-
-Tue Oct 9 23:18:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/ruby/envutil.rb (assert_file, assert_file_not): more
- descriptive assertions for File predicates.
-
-Tue Oct 9 18:01:37 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * array.c (rb_ary_sample): use rb_random_ulong_limited, since
- precision of long may be larger than double.
-
- * random.c (rb_random_ulong_limited): new function to return a random
- value from 0 upto limit as unsigned long, similarly to
- rb_genrand_ulong_limited but with arbitrary RNG object.
-
-Tue Oct 9 17:13:27 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * process.c (rb_execarg_addopt, rb_execarg_run_options): add :uid and
- :gid options. [ruby-core:47414] [Feature #6975]
-
-Tue Oct 9 14:36:11 2012 Koichi Sasada <ko1@atdot.net>
-
- * iseq.c (iseq_free): fix memory leak.
- rb_iseq_t::callinfo_entries should be freed.
-
-Tue Oct 9 14:28:18 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_core.h (rb_call_info_t): add new type `rb_call_info_t'.
- This data structure contains information including inline method
- cache. After that, `struct iseq_inline_cache_entry' does not
- need to contain inline cache for method invocation.
- Other information will be added to this data structure.
-
- * vm_core.h (rb_iseq_t): add `callinfo_entries' and `callinfo_size'
- members to `rb_iseq_t'.
-
- * insns.def, compile.c: Use CALL_INFO instead of IC.
-
- * tool/instruction.rb: support CALL_INFO as operand type.
-
- * vm_insnhelper.c, vm_insnhelper.h: ditto.
-
-Sun Oct 7 23:54:33 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-
- * ext/zlib/zlib.c (zstream_run_func): don't call inflate() when
- z->stream.avail_in == 0. it return Z_BUF_ERROR.
- but deflate() could be called with z->stream->avail_in == 0 because
- it has hidden buffer in z->stream->state (opaque structure).
- fix for gem install error. [ruby-dev:46149] [Bug #7040]
-
-Mon Oct 8 23:55:41 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * eval.c (rb_mod_refinements): new method Module#refinements.
-
- * test/ruby/test_refinement.rb: add new tests for the above changes.
-
-Mon Oct 8 23:02:19 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * eval.c, gc.c, iseq.c, node.h, vm_insnhelper.c, vm_insnhelper.h,
- vm_method.c: rename omod and overlaid modules to refinements.
-
- * eval.c (hidden_identity_hash_new): renamed from identity_hash_new.
-
-Sun Oct 7 04:50:00 2012 Zachary Scott <zzak@ruby-lang.org>
-
- * lib/abbrev.rb: Documentation examples for Abbrev.
- [ruby-core:47442] [Bug #6985]
-
-Sun Oct 7 04:50:00 2012 Zachary Scott <zzak@ruby-lang.org>
-
- * thread.c (rb_thread_aref):
- Grammar in Thread documentation.
- Patch by Steve Klabnik [ruby-core:47799] [Bug #7099]
-
-Sun Oct 7 04:37:00 2012 Zachary Scott <zzak@ruby-lang.org>
-
- * string.c (rb_str_match):
- Clarify behavior for captured strings and local variable assignment
- Patch by Marcus Stollsteimer [ruby-core:47668] [Bug #7062]
-
-Sat Oct 6 18:31:36 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * vm_opts.h (OPT_GLOBAL_METHOD_CACHE): new build option to
- enable/disable global method caching. [ruby-dev:46203] [Bug #7111]
-
- * vm_method.c (rb_method_entry_get_with_omod): don't use global
- method cache if OPT_GLOBAL_METHOD_CACHE is 0.
-
-Sat Oct 6 16:32:04 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * vm_method.c (search_method): check omod only once for performance.
-
-Sat Oct 6 09:42:04 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enc/encdb.c, enc/utf_16_32.h (ENC_DUMMY_UNICODE): endian-less wide
- UTF encodings are dummy but Unicode.
-
- * encoding.c (rb_encdb_set_unicode): set Unicode flag.
-
- * template/encdb.h.tmpl: allow ENC_DUMMY variants.
-
- * encoding.c (rb_enc_unicode_p): oniguruma provides Unicode flag.
-
-Fri Oct 5 17:18:42 JST 2012 TAKANO Mitsuhiro <tak@no32.tk>
-
- * template/Doxyfile.tmpl: remove SHOW_DIRECTORIES and
- HTML_ALIGN_MEMBERS lines. They have been obsolete in
- Doxygen version 1.8.2.
-
-Fri Oct 5 15:26:18 2012 Koichi Sasada <ko1@atdot.net>
-
- * ext/objspace/objspace.c: add ObjectSpace#reachable_objects_from.
- This method returns an array of objects referenced by given object.
- If given object is special objects such as true/false/nil/Fixnum etc
- then it returns nil. See rdoc for details.
- [ruby-core:39772]
-
- * test/objspace/test_objspace.rb: add a test for this method.
-
- * gc.c: add rb_objspace_reachable_objects_from().
- To make this function, add several member `mark_func_data'
- to rb_objspace_t. If mark_func_data is not null, then
- gc_mark() calls mark_func_data::mark_func.
-
- * gc.h: export rb_objspace_reachable_objects_from().
-
-Thu Oct 4 23:40:04 2012 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c (init_heap): call init_mark_stack before to allocate
- altstack. This change avoid the stack overflow at the signal
- handler on 32bit, but I don't understand reason... [Feature #7095]
-
-Thu Oct 4 22:39:27 2012 Koichi Sasada <ko1@atdot.net>
-
- * insns.def (getlocal, setlocal): remove old getlocal/setlocal
- instructions and rename getdaynmic/setdynamic instructions
- to getlocal/setlocal.
-
- * compile.c: ditto.
-
- * iseq.c: remove TS_DINDEX.
-
- * vm_exec.h (dindex_t): remove type definition of `dindex_t'.
-
- * tool/instruction.rb: ditto.
-
-Thu Oct 4 21:44:17 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm.c (vm_analysis_insn|operand|register): use st_insert
- instead of using rb_hash_aset() because rb_hash_aset()
- check $SAFE.
-
-Thu Oct 4 21:15:26 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm.c (VM_COLLECT_USAGE_DETAILS): make new VM usage analysis
- hooks (old macro name is COLLECT_USAGE_ANALYSIS).
- This feature is only for VM developers. (I'm not sure I can use
- `VM developers' (the plural form) in this sentence).
- If VM_COLLECT_USAGE_DETAILS is not 0, VM enables the following
- usage collection features:
- (1) instruction: collect instruction usages.
- (2) operand: collect operand usages.
- (3) register: collect register usages.
- The results are stored in
- RubyVM::USAGE_ANALYSIS_INSN for (1, 2),
- RubyVM::USAGE_ANALYSIS_INSN_BIGRAM for (1) and
- RubyVM::USAGE_ANALYSIS_REGS for (3).
- You can stop collecting usages with
- RubyVM::USAGE_ANALYSIS_INSN_STOP(),
- RubyVM::USAGE_ANALYSIS_OPERAND_STOP(),
- RubyVM::USAGE_ANALYSIS_REGISTER_STOP()
- for (1), (2), (3) respectively.
- You can also change the hook functions by setting
- C level global variables
- `ruby_vm_collect_usage_func_(insn|operand|register)'
- for (1), (2), (3) respectively.
- See codes for more details.
-
- * tool/instruction.rb: fix macro names.
-
- * iseq.c (insn_operand_intern): make it export (used in vm.c).
- fix to skip several processes if not needed (pointer is 0).
-
- * vm_dump.c: move codes for collection features to vm.c.
-
- * vm_exec.h: rename macro and function names.
-
- * vm_insnhelper.h: ditto.
-
-Thu Oct 4 18:59:14 2012 Koichi Sasada <ko1@atdot.net>
-
- * test/ruby/test_settracefunc.rb (test_tracepoint):
- remove unused test case.
- (this test case is redefined by newer tests)
-
-Thu Oct 4 17:24:51 2012 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c (rb_objspace_call_finalizer): call gc_mark_stacked_objects
- at suitable point.
-
-Thu Oct 4 16:31:29 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (rb_objspace_call_finalizer): mark self-referencing finalizers
- before run finalizers, to fix SEGV from btest on 32bit.
-
- * gc.c (gc_mark_stacked_objects): extract from gc_marks().
-
-Thu Oct 4 11:43:28 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * thread_pthread.c (ruby_init_stack): round stack limit to page size
- boundary to calculate stack size more precisely. [ruby-dev:46174]
- [Bug #7084]
-
-Wed Oct 3 19:51:57 2012 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c: Use the non-recursive marking instead of recursion. The
- recursion marking of CRuby needs checking stack overflow and the
- fail-safe system, but these systems not good at partial points,
- for example, marking deep tree structures. [ruby-dev:46184]
- [Feature #7095]
-
- * configure.in (GC_MARK_STACKFRAME_WORD): removed. It's used by
- checking stack overflow of marking.
-
- * win32/Makefile.sub (GC_MARK_STACKFRAME_WORD): ditto.
-
-Wed Oct 3 15:33:02 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * thread_pthread.c (ruby_init_stack): use getrlimit() for the main
- thread on Mac OS X, since pthread_get_stack{addr,size}_np()
- return the default value always, but not the ulimit value.
- [ruby-dev:46174] [Bug #7084]
-
-Wed Oct 3 11:43:15 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (rb_io_reopen): improvement to accept optional arguments.
- a patch by Glass_saga (Masaki Matsushita) in [ruby-core:47806].
- [Feature #7103]
-
-Wed Oct 3 04:36:11 2012 Eric Hodel <drbrain@segment7.net>
-
- * ext/openssl/ossl_x509store.c (ossl_x509store_add_file): Added
- documentation
- * ext/openssl/ossl_x509store.c (ossl_x509store_set_default_paths):
- ditto
- * ext/openssl/ossl_x509store.c (ossl_x509store_add_cert): ditto
-
-Wed Oct 3 02:23:37 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * error.c (exc_to_s, name_err_to_s, name_err_mesg_to_str): do not
- taint messages.
-
-Tue Oct 2 16:47:06 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval.c (identity_hash_new): hide internal hashes for refinements.
-
- * eval.c (rb_mod_refine): no default value.
-
-Mon Oct 1 22:54:02 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * eval.c (identity_hash_new): new function to create a new identity
- hash.
-
- * eval.c (rb_overlay_module, rb_mod_using, rb_mod_refine): use
- identity_hash_new().
-
-Mon Oct 1 02:34:53 2012 Akinori MUSHA <knu@iDaemons.org>
-
- * configure.in (--with-opt-dir): Make this also work on DLDFLAGS
- so LIBRUBY_SO links fine with libexecinfo installed in a
- non-system directory.
-
-Sun Sep 30 23:32:00 2012 Kenta Murata <mrkn@mrkn.jp>
-
- * vm_dump.c (rb_vm_bugreport): add /Library/Logs/DiagnosticReports
- in the list of locations of crash reports.
-
-Sun Sep 30 21:18:03 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * string.c (rb_str_concat): use memcpy to copy a string which contains
- NUL characters. [ruby-core:47751] [Bug #7090]
-
-Sat Sep 29 19:41:53 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * test/ruby/envutil.rb (EnvUtil#invoke_ruby): kill child process
- before Timeout::Error is raised. rmdir of mktmpdir fails with
- EACCES if child process is alive on Windows.
-
- * test/thread/test_queue.rb (TestQueue): increase timeout.
- This test takes long time on Windows XP.
-
-Sat Sep 29 19:41:33 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * test/net/http/test_http.rb (TestNetHTTP#test_proxy_address):
- clear environment variables. If http_proxy environment variable was
- set, the test failed.
-
- * test/net/http/test_http.rb (TestNetHTTP#test_proxy_port): ditto.
-
-Sat Sep 29 19:41:11 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * test/drb/drbtest.rb (DRbCore#teardown):
- Use Process.kill :KILL on Windows because Process.kill :INT silently
- fails on Windows 7 and raises EINVAL on Windows XP for spawned
- process with new_pgroup: false.
-
- * test/drb/drbtest.rb (DRbAry#teardown): ditto.
-
-Sat Sep 29 19:40:32 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * test/ruby/test_unicode_escape.rb (TestUnicodeEscape#test_basic):
- set script encoding to work with LANG=C. It would work on both
- Windows and Unix. Refix of r37051.
-
-Sat Sep 29 11:21:06 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * vm_insnhelper.c (rb_vm_using_modules): use using_modules before
- klass to fix method lookup order, and use klass even if klass is
- not a module to make refinements in class_eval invoked on classes
- work.
-
- * eval.c (rb_using_module): accept a class as the second argument.
-
- * eval.c (rb_mod_using, f_using): raise a TypeError if the argument
- is not a module.
-
- * test/ruby/test_refinement.rb: add new tests for the above changes.
-
-Sat Sep 29 02:18:57 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * test/ruby/test_unicode_escape.rb (TestUnicodeEscape#test_basic):
- Use ruby only on Windows since the test fails on Unix with LANG=C.
- [ruby-core:47709] [Bug #7076]
-
-Fri Sep 28 22:19:31 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * test/ruby/test_unicode_escape.rb (TestUnicodeEscape#test_basic):
- echo command doesn't work properly against non-ascii character on
- Windows with chcp 437. Instead we use ruby.
- [ruby-core:47709] [Bug #7076]
-
-Fri Sep 28 17:54:31 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_insnhelper.c (vm_setup_method): refactoring.
- Remove src_argc and use iseq->arg_size directly.
-
-Fri Sep 28 17:26:27 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/rubygems/installer.rb (check_that_user_bin_dir_is_in_path):
- test_generate_bin_bindir_with_user_install_warning(TestGemInstaller)
- fails on Windows with msys bash. It makes comparing paths
- case-insensitive.
- pick from upstream to fix a failure of test-all [ruby-core:47711]
- https://github.com/rubygems/rubygems/commit/c474edb2f3704206f04da1c8c6cf9fb079d84abe
-
-Fri Sep 28 15:44:45 2012 Shugo Maeda <shugo@ruby-lang.org>
+ * ext/extmk.rb: supply dependencies of statically linked extension
+ libraries.
- * vm_method.c (search_method): copy refinement iclasses to search
- superclasses correctly.
+Wed Jul 2 15:45:49 2014 Koichi Sasada <ko1@atdot.net>
- * test/ruby/test_refinement.rb: related test.
+ * gc.c (gc_heap_lazy_sweep): simplify logic.
-Fri Sep 28 15:15:41 2012 Koichi Sasada <ko1@atdot.net>
+ * gc.c (gc_page_sweep): return TRUE if empty slots are available.
- * insns.def (opt_checkenv): remove unused instruction `opt_checkenv'.
+Wed Jul 2 09:48:42 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * compile.c (iseq_compile_each): ditto.
+ * logger.rb: removed unmaintained code.
+ [Feature #9860][ruby-core:62724]
+ * test/logger/test_application.rb: ditto.
- * node.h: remove unused node `NODE_OPTBLOCK'.
+Wed Jul 2 03:20:00 2014 Charlie Somerville <charliesome@ruby-lang.org>
- * ext/objspace/objspace.c, gc.c (gc_mark_children): ditto.
+ * node.c (dump_node): handle nd_value == (NODE *)-1 to mean this
+ keyword argument is required
-Fri Sep 28 13:14:34 2012 Koichi Sasada <ko1@atdot.net>
+Wed Jul 2 02:57:27 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_core.h: now VM_DEBUG_BP_CHECK should be 1.
+ * vm.c (rb_vm_env_local_variables): returns array of local
+ variable name symbols in the environment by envval.
-Fri Sep 28 12:51:54 2012 Koichi Sasada <ko1@atdot.net>
+ * proc.c (bind_local_variables): use rb_vm_env_local_variables.
- * vm_core.h: remove rb_control_frame_t::bp (bp: base pointer).
- `bp' can be calculate by `sp' (stack pointer) of previous frame.
- Now, `bp_check' field is remained for debug. You can eliminate
- this field by setting VM_DEBUG_BP_CHECK as 0.
+Wed Jul 2 02:23:52 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_insnhelper.c (vm_base_ptr): add `vm_base_ptr(cfp).
- This function calculates base pointer from cfp.
+ * proc.c (bind_receiver): new method to return the bound receiver
+ of the binding object. [ruby-dev:47613] [Feature #8779]
- * vm_insnhelper.c (vm_setup_method): push `recv' value on top of
- value stack (before method parameters).
- This change is for keeping consistency with normal method dispatch.
+Wed Jul 2 02:14:37 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * insns.def: fix to use vm_base_ptr().
+ * proc.c (bind_local_variables): update env from envval for each
+ iterations. [ruby-dev:48351] [Bug #10001]
- * vm.c (vm_exec): ditto.
+Tue Jul 1 23:46:34 2014 NAKAMURA Usaku <usa@ruby-lang.org>
- * vm_dump.c: remove `bp' related dumps.
+ * NEWS: [DOC] mention about Binding#local_variables, introduced at
+ r44392 (see [Feature #8773]).
- * cont.c (fiber_init): fix to check VM_DEBUG_BP_CHECK.
+Tue Jul 1 23:30:51 2014 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
-Fri Sep 28 10:40:51 2012 Nobuyoshi Nakada <nobu@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]
- * io.c (rb_io_reopen): accept File::Constants as well as mode string.
- based on the patch by Glass_saga (Masaki Matsushita) in
- [ruby-core:47694]. [Feature #7067]
+Tue Jul 1 16:18:22 2014 Akinori MUSHA <knu@iDaemons.org>
-Thu Sep 27 18:36:51 2012 Shugo Maeda <shugo@ruby-lang.org>
+ * ext/digest/lib/digest/hmac.rb, test/digest/test_digest_hmac.rb:
+ Digest::HMAC is finally removed as previously noticed.
+ [fix GH-648]
- * eval.c (rb_overlay_module, rb_mod_refine): accept a module as the
- argument of Module#refine.
+Tue Jul 1 11:13:43 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * vm_method.c (search_method): if klass is an iclass, lookup the
- original module of the iclass in omod in order to allow
- refinements of modules.
+ * ext/date/lib/date/format.rb: removed empty file by @vipulnsward.
+ * ext/date/lib/date.rb: removed needless require.
+ [fix GH-647]
- * test/ruby/test_refinement.rb: add tests for the above changes.
+Mon Jun 30 16:42:52 2014 Koichi Sasada <ko1@atdot.net>
-Thu Sep 27 18:12:20 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+ * gc.c (gc_stat_internal): return size_t value instead of VALUE
+ and remove `out' parameter.
- * ext/syslog/lib/syslog/logger.rb: add a formatter to the
- Syslog::Logger object. [Bug #7065]
- * test/syslog/test_syslog_logger.rb: ditto.
+ * gc.c: add braces for `if' statements.
-Wed Sep 26 16:39:57 2012 Koichi Sasada <ko1@atdot.net>
+ * gc.c (gc_stat_internal): fix comment.
- * insns.def: add new instruction `opt_empty_p' for optimize `empty?'
- method. Apply a patch proposed at [ruby-dev:46120]
- [ruby-trunk - Feature #6972] by Glass_saga (Masaki Matsushita).
+Mon Jun 30 15:07:34 2014 Koichi Sasada <ko1@atdot.net>
- * compile.c (iseq_specialized_instruction), vm.c, vm_insnhelper.h:
- ditto.
+ * gc.c: support `USE_RGENGC == 0'.
- * id.c, template/id.h.tmpl: ditto.
+ * test/ruby/test_gc.rb: ditto.
- * test/ruby/test_optimization.rb: test for this changes.
+Mon Jun 30 11:36:04 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Tue Sep 25 09:59:26 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * file.c: [DOC] document File.join returns a string.
+ Contributed by @dapplebeforedawn. [fix GH-646]
- * insns.def (invokesuper): klass in cfp is not valid in at_exit and
- END blocks. [ruby-core:47680] [Bug #7064]
+Sat Jun 28 22:57:01 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-Tue Sep 25 08:11:11 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/pathname/pathname.c (path_birthtime): Windows support.
+ see [Feature #9857] [ruby-dev:48339]
- * iseq.c (rb_iseq_defined_string): the index of defined_strings must
- be the value of type - 1.
+Sat Jun 28 22:44:16 2014 Tanaka Akira <akr@fsij.org>
-Mon Sep 24 17:36:51 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/pathname/pathname.c (path_birthtime): New method,
+ Pathname#birthtime.
+ Proposed by Kazuhiro NISHIYAMA. [ruby-dev:48232] [Feature #9857]
- * compile.c (defined_expr), insns.def (defined): share single frozen
- strings. [EXPERIMENTAL] [ruby-core:47558][Feature #7035]
+Sat Jun 28 20:29:03 2014 Simon Baird <simon.baird@gmail.com>
- * iseq.c (rb_iseq_defined_string): make expression strings.
+ * 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]
-Mon Sep 24 11:22:36 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Sat Jun 28 15:32:57 2014 Tanaka Akira <akr@fsij.org>
- * tool/merger.rb: add --ticket option to add ticket number.
+ * lib/webrick/utils.rb (create_listeners): Close socket objects.
-Sun Sep 23 21:51:59 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Jun 28 13:58:48 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/mkmf.rb (String#unspace): unescape with backslashes. normal
- makes need to escape spaces with backslashes. nmake is not the
- case. [Bug #7036]
+ * eval.c (setup_exception): should not overwrite SystemStackError
+ backtrace if set already. [ruby-core:63377] [Feature #6216]
- * lib/mkmf.rb (create_makefile): use timestamp file dependencies for
- directories.
+ * eval.c (setup_exception): get rid of method calls before raising
+ stack overflow, not to cause stack overflow again.
- * lib/mkmf.rb: unexpand macros.
+ * defs/id.def: add IDs for backtraces.
- * lib/mkmf.rb (LIBPATHFLAG): no needs to escape library path here.
+Sat Jun 28 04:08:22 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * lib/mkmf.rb (MakeMakefile#configuration): make prefix paths
- internal to deal with in Makefile.
+ * lib/uri/mailto.rb: update to latest specs, RFC 6068 and HTML5.
- * lib/mkmf.rb (MakeMakefile#mkintpath): not a global function now.
+ * lib/uri/mailto.rb (HEADER_PATTERN): removed.
-Sun Sep 23 02:33:37 2012 Benoit Daloze <eregontp@gmail.com>
+ * lib/uri/mailto.rb (HEADER_REGEXP): use RFC 6068 hfields.
- * complex.c: Fix examples of r36993.
- Keep the simple definition, mathematics define the result.
- Based on patch by Robin Dupret. Fixes #188 on github.
+ * lib/uri/mailto.rb (EMAIL_REGEXP): use HTML5 email regexp.
-Sat Sep 22 07:15:00 2012 Zachary Scott <zzak@ruby-lang.org>
+ * lib/uri/mailto.rb (URI::MailTo.build): support multiple to addresses.
- * ext/ripper/lib/ripper.rb:
- Match sample output to Ripper.sexp from current trunk version.
- [Bug #6929]
+ * lib/uri/mailto.rb (URI::MailTo#initialize): Support multiple to
+ addresses. Don't check with regexp, only split.
-Thu Sep 20 23:05:11 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * lib/uri/mailto.rb (URI::MailTo#check_to): verify by matching
+ URI path-rootless and HTML5 email regexp with unescaped one.
- * thread_pthread.c (native_cond_initialize): destroy condattr
- after using it. Patch by Stanislav Sedov. Thank you.
- [Bug #7041] [ruby-core:47619]
+ * lib/uri/mailto.rb (URI::MailTo#check_headers): verify only by
+ HEADER_REGEXP.
-Thu Sep 20 22:53:02 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * lib/uri/mailto.rb (URI::MailTo#set_headers): don't check by
+ HEADER_REGEXP, only split it.
- * thread_pthread.c (native_cond_initialize): clean up #ifdef condition.
+Sat Jun 28 00:35:10 2014 Lauri Tirkkonen <lotheac@iki.fi>
-Thu Sep 20 16:42:44 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * 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]
- * lib/drb/ssl.rb (DRb::DRbSSLSocket::SSLConfig::DEFAULT): add
- SSLTmpDhCallback for configuration option.
+Fri Jun 27 15:20:12 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * lib/drb/ssl.rb (setup_ssl_context): copy the value of tmp_dh_callback.
+ * lib/rubygems/test_case.rb: rescue Gem::LoadError in Gem::TestCase.
+ because it's effected by removing minitest from stdlib.
- * test/drb/ut_array_drbssl.rb: set tmp_dh_callback to suppress warning.
+Fri Jun 27 12:29:37 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * test/drb/ut_drb_drbssl.rb: ditto.
+ * lib/rubygems/specification.rb: fixed broken condition caused
+ by removing YAML::ENGINE.
+ * lib/rubygems/package/old.rb: ditto.
-Thu Sep 20 10:56:08 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri Jun 27 05:33:26 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/drb/ut_drb.rb: revert a part of r36987, and get rid of a warning
- with another method. if the substitution is removed, the ExtSrv
- object will be GC'ed and some tests will be blocked.
+ * hash.c (env_shift): fix memory leak on Windows, free environment
+ strings block always. [ruby-dev:48332] [Bug #9983]
-Thu Sep 20 07:20:00 2012 Zachary Scott <zzak@ruby-lang.org>
+Fri Jun 27 03:41:53 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * complex.c: Examples for Complex Documentation.
- Patch by Robin Dupret.
- Fixes #184 on github.
+ * sprintf.c (GETASTER): should not use the numbered argument to be
+ formatted, raise ArgumentError instead.
+ [ruby-dev:48330] [Bug #9982]
-Thu Sep 20 07:15:00 2012 Zachary Scott <zzak@ruby-lang.org>
+Thu Jun 26 18:18:28 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * ext/ripper/lib/ripper.rb: Documentation for Ripper.
- +:void_stmt+ is meaningless
- [Bug #6929] [ruby-core:47507]
+ * 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 Sep 20 07:05:00 2012 Zachary Scott <zzak@ruby-lang.org>
+Thu Jun 26 18:06:50 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * lib/csv.rb (Object#CSV, Array#to_csv, String#parse_csv):
- Examples and documentation for CSV.
- [Bug #6880] [ruby-core:47218]
+ * test/profile_test_all.rb: move into test library directory.
+ * test/runner.rb: fix require path for profile_test_all.rb.
-Thu Sep 20 00:42:20 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Jun 26 17:57:57 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * array.c (take_items), enum.c (enum_zip): raise TypeError at
- non-enumerable objects, not NoMethodError. [ruby-dev:46145]
- [Bug #7038]
+ * 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.
- * vm_eval.c (rb_check_block_call): check_funcall variant with block
- function.
+Thu Jun 26 08:28:01 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Sep 18 17:51:29 2012 NARUSE, Yui <naruse@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]
- * ext/openssl/ossl_ssl.c (ossl_sslctx_attrs): add npn_select_db to
- suppress warning: instance variable @npn_select_cb not initialized
+Thu Jun 26 02:45:04 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Sep 16 17:47:00 2012 Eric Hodel <drbrain@segment7.net>
+ * eval_error.c (error_print): put a newline after an anonymous
+ exception class name.
- * tool/change_maker.rb: Update svn detection for subversion 1.7's
- single .svn directory.
+Wed Jun 25 22:31:32 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Sep 16 11:39:12 2012 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]
- * io.c (io_set_read_length): if the read length equals to the buffer
- string size then nothing to do. or ensure the string modifiable
- before setting the length only when the former is shorter. based on
- the patch in [ruby-core:47541] by Hiroshi Shirosaki.
- [ruby-core:46586] [Bug #6764]
+Wed Jun 25 15:44:12 2014 Eric Wong <e@80x24.org>
-Sun Sep 16 08:57:52 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ccan/container_of/container_of.h (container_off_var):
+ avoid warning with -Wcast-qual
+ [ccan ba5ad771af4aa9e085498de6c3c665c52694460f (Rusty Russell)]
- * configure.in (strict_warnflags): separate strict flags from
- warnflags only for core. [ruby-dev:46105]
+Wed Jun 25 10:19:59 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Sep 16 08:16:05 2012 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]
- * .editorconfig: add. [ruby-core:47548] [Feature #7030]
+Tue Jun 24 14:46:17 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Sat Sep 15 01:56:40 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * 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.
- * ext/nkf/nkf-utf8/nkf.c: Merge upstream: 50a383c84.
- [ruby-dev:46128] [Bug #7005]
+Tue Jun 24 10:50:06 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Sep 15 00:20:04 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * hash.c (env_path_str_new): make PATH environment variable
+ string, to be frozen.
- * ext/nkf/nkf.c (rb_nkf_convert): suppress warning.
+Tue Jun 24 10:40:52 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Fri Sep 14 04:05:00 2012 Zachary Scott <zzak@ruby-lang.org>
+ * tool/make-snapshot: download bundle gems when package making.
+ [Feature #9852][ruby-core:62676]
+ * gems/bundled_gems: listed bundled gems for Ruby 2.2.
- * array.c (rb_ary_diff, rb_ary_uniq):
- Enhance documentation for array uniqueness
- Based on a patch by Robin Dupret
- [Bug #6872] [ruby-core:47209]
+Tue Jun 24 10:20:35 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Fri Sep 14 03:30:00 2012 Zachary Scott <zzak@ruby-lang.org>
+ * 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.
- * array.c (rb_ary_select):
- Update documentation for Array#select
- * enum.c (enum_find_all, enum_reject):
- Update documentation for Enumerable#find_all and Enumerable#reject
- Based on a patch by Jeff Saracco
- [Bug #6908] [ruby-core:47285] [Fixes #166 on github]
+Tue Jun 24 06:17:52 2014 NARUSE, Yui <naruse@ruby-lang.org>
-Fri Sep 14 00:20:00 2012 Zachary Scott <zzak@ruby-lang.org>
+ * eval.c (setup_exception): "mesg == sysstack_error" and
+ sysstack_error_p(mesg) are duplicated.
+ r46502 seems to want to use latter.
- * signal.c (rb_f_kill):
- Update documentation for Process.kill to reflect kill(2)
- Patch by Richo Healey
+Tue Jun 24 06:15:36 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Sep 13 21:40:49 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+ * ext/tk/tcltklib.c: fix format specifiers for VALUE and
+ Tcl_Interp*. [ruby-core:63283] [Bug #9972]
- * lib/securerandom.rb (SecureRandom.random_bytes):
- Use 64bit value as pointer for Windows x64 to fix SystemCallError.
+Tue Jun 24 05:40:41 2014 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * lib/securerandom.rb (SecureRandom.lastWin32ErrorMessage):
- Set proper encoding to avoid invalid byte sequence error.
- [ruby-core:47451] [Bug #6990]
+ * 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
-Thu Sep 13 11:20:00 2012 Zachary Scott <zzak@ruby-lang.org>
+Mon Jun 23 18:44:45 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * lib/optparse.rb: Remove unreachable email address from documentation
- [Bug #6996] [ruby-core:47459]
+ * tool/config_files.rb: rename class ConfigFiles to Downloader.
+ * tool/get-config_files: ditto.
+ * tool/make-snapshot: ditto.
-Thu Sep 13 11:20:00 2012 Zachary Scott <zzak@ruby-lang.org>
+Mon Jun 23 18:03:13 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * lib/xmlrpc.rb: Documentation for XMLRPC
- * lib/xmlrpc/datetime.rb: ditto.
- * lib/xmlrpc/parser.rb: ditto.
- * lib/xmlrpc/client.rb: ditto.
- * lib/xmlrpc/utils.rb: ditto.
- * lib/xmlrpc/README.rdoc: ditto.
- * lib/xmlrpc/create.rb: ditto.
- * lib/xmlrpc/base64.rb: ditto.
- * lib/xmlrpc/config.rb: ditto.
- * lib/xmlrpc/httpserver.rb: ditto.
- * lib/xmlrpc/server.rb: ditto.
- * lib/xmlrpc/marshal.rb: ditto.
- * lib/xmlrpc/README.txt: ditto.
- [Bug #6909] [ruby-core:47286]
+ * tool/rbinstall.rb: support to install bundle gems.
-Thu Sep 13 10:22:11 2012 Takashi Toyoshima <toyoshim@gmail.com>
+Mon Jun 23 17:33:11 2014 Akinori MUSHA <knu@iDaemons.org>
- * configure.in: Don't use PIE on Haiku because loader support is not
- enough.
+ * lib/net/imap.rb (Net::IMAP#fetch): [DOC] Describe how a range in
+ +set+ is interpreted, and mention -1 which can be used for '*'.
-Thu Sep 13 08:20:00 2012 Zachary Scott <zzak@ruby-lang.org>
+Mon Jun 23 16:22:50 2014 URABE Shyouhei <shyouhei@ruby-lang.org>
- * lib/shellwords.rb: Documentation for Shellwords.
+ * include/ruby/ruby.h (struct RHash): no longer. [Feature #9889]
-Thu Sep 13 08:00:00 2012 Zachary Scott <zzak@ruby-lang.org>
+ * include/ruby/ruby.h (RHASH): ditto.
- * ext/ripper/lib/ripper.rb: Documentation for Ripper.
- * ext/ripper/lib/ripper/lexer.rb: ditto.
- * ext/ripper/lib/ripper/sexp.rb: ditto.
- * ext/ripper/lib/ripper/filter.rb: ditto.
- * ext/ripper/lib/ripper/core.rb: ditto.
- [Bug #6929] [ruby-core:47309]
+ * include/ruby/ruby.h (RHASH_ITER_LEV): deprecated. Will be deleted later.
-Wed Sep 12 22:59:07 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * include/ruby/ruby.h (RHASH_IFNONE): ditto.
- * vm_insnhelper.c (vm_method_missing, vm_call_method): reuse arguments
- on the VM stack and get rid of ALLOCA.
+ * internal.h (struct RHash): moved here.
-Wed Sep 12 22:45::00 2012 Zachary Scott <zzak@ruby-lang.org>
+ * internal.h (RHASH): ditto.
- * ext/pathname/lib/pathname.rb: Documentation for Pathname.
- * ext/pathname/pathname.c: ditto.
- [Bug #6947] [ruby-core:47354]
+ * hash.c (rb_hash_iter_lev): do not use this.
-Mon Sep 10 10:19:34 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * hash.c (rb_hash_ifnone): ditto.
- * enc/depend: fixed wrong change in a part of r34802.
+Mon Jun 23 13:30:11 2014 URABE Shyouhei <shyouhei@ruby-lang.org>
-Sun Sep 9 22:02:50 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * include/ruby/ruby.h (struct RComplex): no longer. [Feature #9888]
- * ext/socket/basicsocket.c (rsock_bsock_send):
- avoid unnecessary select() calls before doing I/O
- Patch by Eric Wong. [Feature #4538] [ruby-core:35586]
- * ext/socket/init.c (rsock_s_recvfrom): ditto.
- * ext/socket/init.c (rsock_s_accept): ditto.
- * ext/socket/udpsocket.c (udp_send): ditto.
- * io.c (io_fflush): ditto.
- * io.c (io_binwrite): ditto.
- * io.c (rb_io_syswrite): ditto.
+ * include/ruby/ruby.h (RCOMPLEX): ditto.
-Mon Sep 10 01:38:51 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * include/ruby/ruby.h (RCOMPLEX_SET_REAL): deprecated. Will be deleted later.
- * io.c (nogvl_close, maygvl_close, nogvl_fclose, maygvl_fclose):
- suppress integer <-> pointer cast warnings.
- [Feature #4570] [ruby-core:35711]
+ * include/ruby/ruby.h (RCOMPLEX_SET_IMAG): ditto.
-Mon Sep 10 01:36:00 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * internal.h (struct RFloat): moved here.
- * io.c (rb_io_close): notify fd close before releasing gvl.
- * io.c (fptr_finalize): modify fptr->mode before releasing gvl.
- remove unnecessary rb_thread_fd_close().
- [Feature #4570] [ruby-core:35711]
+ * internal.h (RCOMPLEX): ditto.
-Mon Sep 10 00:16:34 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * complex.c (rb_complex_set_real): do not use this.
- * process.c: exec() requires to be single threaded also on Haiku.
- by Takashi Toyoshima <toyoshim@gmail.com>
- https://github.com/ruby/ruby/pull/178
+ * complex.c (rb_complex_set_imag): ditto.
-Sun Sep 9 21:21:15 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Mon Jun 23 13:10:15 2014 URABE Shyouhei <shyouhei@ruby-lang.org>
- * lib/thread.rb (Queue#pop): Fixed double registration issue when
- mutex.sleep is interrupted. [Bug #5258] [ruby-dev:44448]
- * lib/thread.rb (SizedQueue#push): ditto.
+ * include/ruby/ruby.h (struct RFloat): no longer. [Feature #9863]
- * test/thread/test_queue.rb (test_sized_queue_and_wakeup,
- test_queue_pop_interrupt, test_sized_queue_pop_interrupt,
- test_sized_queue_push_interrupt): new tests.
+ * include/ruby/ruby.h (RFLOAT): ditto.
-Sun Sep 9 20:20:31 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * internal.h (struct RFloat): moved here.
- * lib/sync.rb (Sync_m#sync_lock): Fixed wakeup/raise unsafe code.
- Patched by Masaki Matsushita. [Bug #5355] [ruby-dev:44521]
+ * internal.h (RFLOAT): ditto.
- * test/thread/test_sync.rb (test_sync_lock_and_wakeup,
- test_sync_upgrade_and_wakeup, test_sync_lock_and_raise):
- new test.
+Mon Jun 23 12:01:42 2014 NARUSE, Yui <naruse@ruby-lang.org>
-Sun Sep 9 18:39:46 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * lib/uri/generic.rb (check_port): allow strings for port= as
+ described in rdoc.
- * include/ruby/intern.h (rb_thread_blocking_region): Added
- a comment of recommended alternative way.
+ * lib/uri/rfc3986_parser.rb (regexp): implementation detail of above.
-Sun Sep 9 18:37:05 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Mon Jun 23 11:35:01 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/sync.rb (Sync_m): Removed RCS_ID.
+ * eval.c (setup_exception): set backtrace in system stack error
+ other than the pre-allocated sysstack_error. [Feature #6216]
-Sun Sep 9 18:21:03 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * proc.c (Init_Proc): freeze the pre-allocated sysstack_error.
- * test/ruby/test_io.rb (test_advise_pipe): new test to check
- io.advise() against anonymous io object don't make crash.
- made by Eric Wong. [Bug #6081] [ruby-core:42880]
+ * vm_insnhelper.c (vm_stackoverflow): raise new instance for each
+ times without calling any methods to keep the backtrace with no
+ further stack overflow.
-Sun Sep 9 16:47:12 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * object.c (rb_obj_copy_ivar): extract function to copy instance
+ variables only for T_OBJECT from init_copy.
- * io.c (nogvl_close, maygvl_close, nogvl_fclose, maygvl_fclose):
- new functions.
- * io.c (fptr_finalize): release GVL if possible.
- Patched by Eric Wong. [Feature #4570] [ruby-core:35711]
+Mon Jun 23 11:11:16 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Sep 9 16:08:48 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * signal.c (check_stack_overflow): drop the last tag too close to
+ the fault page, to get rid of stack overflow deadlock.
+ [Bug #9971]
- * io.c (io_bufread): removed unnecessary rb_thread_wait_fd().
- Patch by Eric Wong. [Bug #6629] [ruby-core:45789]
- * io.c (rb_io_sysread): ditto.
- * io.c (copy_stream_fallback_body): ditto.
+Sun Jun 22 09:11:15 2014 NARUSE, Yui <naruse@ruby-lang.org>
-Sun Sep 9 15:21:52 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * lib/uri/generic.rb: remove registry.
+ 'registry' is not used and RFC3986 doesn't use it.
- * thread.c (rb_mutex_lock): stop multiple threads use
- pthread_cond_timedwait() concurrently. [Bug #6278] [ruby-core:44275]
+Sun Jun 22 09:10:09 2014 NARUSE, Yui <naruse@ruby-lang.org>
-Sat Sep 8 18:52:22 2012 Nobuyoshi Nakada <nobu@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.
- * internal.h (struct rb_classext_struct): move allocator function into
- rb_classext_t from ordinary method table. [ruby-dev:46121]
- [Feature #6993]
+Sun Jun 22 09:05:42 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * object.c (rb_obj_alloc): call allocator function directly.
+ * lib/uri/common.rb (URI::REGEXP): move to lib/uri/rfc2396_parser.rb.
- * vm_method.c (rb_define_alloc_func, rb_undef_alloc_func)
- (rb_get_alloc_func): use allocator function in rb_classext_t.
+ * lib/uri/common.rb (URI::Parser): ditto.
-Fri Sep 7 01:21:51 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/uri/common.rb (URI.split): use RFC3986_Parser. [Feature #2542]
- * ext/extmk.rb (extmake), lib/mkmf.rb (have_framework): fix splitting
- options with an argument, not using NUL as special character.
- [ruby-core:47447] [Bug #6987]
+ * lib/uri/common.rb (URI.parse): ditto.
-Thu Sep 6 14:49:49 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/uri/common.rb (URI.join): ditto.
- * .gdbinit (rp): FLONUM support.
+ * lib/uri/common.rb (URI.extract): deprecated.
- * include/ruby/ruby.h (ruby_special_consts): define FLONUM constants
- always, so that they are available from gdb.
+ * lib/uri/common.rb (URI.regexp): ditto.
- * include/ruby/ruby.h (RB_FLOAT_TYPE_P): merge FLONUM and non-FLONUM
- versions. inline TYPE() comparison and FLONUM_P() should be
- optimized away on non-FLONUM.
+ * lib/uri/rfc2396_parser.rb: added.
-Thu Sep 6 08:20:55 2012 Ryan Davis <ryand-ruby@zenspider.com>
+ * lib/uri/rfc3986_parser.rb: added.
- * lib/minitest/*: Imported minitest 3.4.0 (r7762)
- * test/minitest/*: ditto
+Sun Jun 22 09:04:50 2014 NARUSE, Yui <naruse@ruby-lang.org>
-Wed Sep 5 19:20:53 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * lib/uri/mailto.rb (initialize): as previous commit, fix arg_check
- * parse.y (rb_warn4S): renamed from rb_warn4(), because the case in
- r36911 takes a string.
+Sun Jun 22 09:01:47 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * parse.y (rb_warn4S): use ripper_warnS() for ripper.
+ * lib/uri/ftp.rb (initialize): argument checking flag is arg_check,
+ but arg[-1] is fragment.
- * parse.y (ripper_warnS): now it is used.
+ * lib/uri/ftp.rb (initialize): explicitly specify arguments.
-Wed Sep 5 15:51:52 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
+Sat Jun 21 12:50:32 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * .travis.yml (notifications): [experimental] update notification
- template.
+ * 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]
-Wed Sep 5 15:21:12 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Sat Jun 21 07:06:13 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * parse.y (rb_warn4): added as a rb_warn variant to warn with explicit
- source file name and line in parse.y.
+ * encoding.c (enc_find): [DOC] never accepted a symbol.
+ [ruby-dev:48308] [Bug #9966]
- * parse.y (warn_unused_var): use rb_warn4 to suppress warning on ripper.
+Fri Jun 20 17:15:43 2014 Koichi Sasada <ko1@atdot.net>
-Wed Sep 5 13:30:04 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/lib/tracepointchecker.rb: add to check TracePoint healthiness.
- * dir.c (glob_make_pattern): names under recursive need to be single
- basenames to match for each name. [ruby-core:47418] [Bug #6977]
+ * test/runner.rb: use it.
-Tue Sep 4 20:55:17 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+Fri Jun 20 07:26:44 2014 Koichi Sasada <ko1@atdot.net>
- * test/ruby/envutil.rb (EnvUtil#invoke_ruby): show Timeout::Error
- instead of IOError if the timeout has expired.
+ * test/ruby/test_settracefunc.rb: rewrite tests with
+ assert_consistent_call_return().
- * test/test_pstore.rb
- (PStoreTest#test_pstore_files_are_accessed_as_binary_files):
- increase timeout because this test is slow on Windows.
- [ruby-core:47402] [Bug #6965]
+ assert_consistent_call_return() is also modified to check
+ consistency.
-Tue Sep 4 11:28:57 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
+Fri Jun 20 07:07:28 2014 Koichi Sasada <ko1@atdot.net>
- * vm_eval.c (ruby_eval_string_from_file_protect): initializer
- element is not computable at load time.
+ * compile.c (rb_iseq_compile_node): put start label of block after
+ trace (b_call).
+ [Bug #9964]
-Tue Sep 4 07:48:35 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * test/openssl/test_asn1_rb:
- test/openssl/test_ssl_session.rb:
- test/openssl/test_x509name.rb:
- test/openssl/test_buffering.rb:
- test/openssl/test_x509cert.rb:
- test/openssl/test_ssl.rb: Refactor code that leads to warnings on
- Ruby CI.
-
-Tue Sep 4 07:02:56 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * test/ruby/test_settracefunc.rb: add a test.
- * test/openssl/utils.rb: Use DSS1 as DSA signature digest for all
- OpenSSL versions < 1.0.0.
- [Feature #6946] [ruby-core:47405]
+ added assert_consistent_call_return() method check call/return
+ consistency.
-Mon Sep 3 21:22:37 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Jun 20 05:26:27 2014 Koichi Sasada <ko1@atdot.net>
- * include/ruby/ruby.h (rb_float_value): suppress warnings.
- [ruby-core:47406][Bug #6971]
+ * vm_eval.c (rb_catch_protect): fix same problem of [Bug #9961].
-Mon Sep 3 14:49:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm_eval.c (rb_iterate): ditto.
- * lib/matrix.rb (Vector#magnitude): accumulate squares of absolute
- values to fix for complex vector. [ruby-dev:46100] [Bug #6966]
+Thu Jun 19 21:41:30 2014 Koichi Sasada <ko1@atdot.net>
-Mon Sep 3 10:09:36 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * vm.c (rb_vm_rewind_cfp): add new function to rewind specified cfp
+ with invoking RUBY_EVENT_C_RETURN.
+ [Bug #9961]
- * ext/openssl/extconf.rb: Detect OpenSSL_FIPS macro
- ext/openssl/ossl.c: Expose OpenSSL::OPENSSL_FIPS constant to
- indicate whether OpenSSL runs in FIPS mode.
- test/openssl/test_pkey_dh.rb: Generate 256 bit keys for
- non-FIPS installations to improve test performance (e.g. for
- rubyci).
- test/openssl/utils.rb: Replace DSS1 as certificate signature
- digest with SHA1 for FIPS installations when using DSA by
- introducing TestUtils::DSA_SIGNATURE_DIGEST.
- test/openssl/test_x509cert.rb:
- test/openssl/test_x509crl.rb:
- test/openssl/test_x509req.rb: Use DSA_SIGNATURE_DIGEST
- NEWS: Introduce OpenSSL::OPENSSL_FIPS
+ * vm_core.h: ditto.
- These changes allow running the OpenSSL tests in FIPS mode
- while keeping a high performance for non-FIPS installations.
- Introduction of OpenSSL::OPENSSL_FIPS allows for applications
- to react to special requirements when using OpenSSL in FIPS mode.
- [Feature #6946] [ruby-core:47345]
+ * eval.c (rb_protect): use it.
-Sun Sep 2 21:46:28 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * eval.c (rb_rescue2): ditto.
- * test/openssl/utils.rb: Use a cached DH key instead of generating a
- new one each time.
+ * vm_eval.c (rb_iterate): ditto.
-Sun Sep 2 05:41:28 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * test/ruby/test_settracefunc.rb: add a test.
- * lib/webrick/ssl.rb (WEBrick::Config::SSL): add new key
- SSLTmpDhCallback to set SSLContext#tmp_dh_callback.
+ * vm_core.h (rb_vm_rewind_cfp): add the prototype declaration.
- * lib/webrick/ssl.rb (WEBrick::GenericServer#setup_ssl_context):
- follow above.
+Thu Jun 19 19:47:21 2014 Koichi Sasada <ko1@atdot.net>
-Sat Sep 1 18:50:50 2012 Akinori MUSHA <knu@iDaemons.org>
+ * 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]
- * lib/set.rb (#initialize_copy, #eql): Use instance_variable_get
- instead of instance_eval.
+ * vm_insnhelper.c (vm_call_bmethod_body): ditto.
-Fri Aug 31 21:47:56 2012 Kouhei Sutou <kou@cozmixng.org>
+ * test/ruby/test_settracefunc.rb: add a test.
- * lib/test/unit/test-unit.gemspec: Make test/unit default gem.
- [Feature #6875] [ruby-dev:46051]
+Thu Jun 19 18:14:47 2014 Koichi Sasada <ko1@atdot.net>
-Fri Aug 31 18:35:02 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * vm_core.h: add VM_FRAME_MAGIC_RESCUE to recognize normal block or
+ rescue clause.
- * ext/openssl/extconf.rb: Check existence of OPENSSL_NPN_NEGOTIATED.
- ext/ossl_ssl.c: Support Next Protocol Negotiation. Protocols to be
- advertised by the server can be set in the SSLContext by using
- SSLContext#npn_protocols=, protocol selection on the client is
- supported by providing a selection callback with
- SSLContext#npn_select_cb. The protocol that was finally negotiated
- is available through SSL#npn_protocol.
- test/openssl/test_ssl.rb: Add tests for Next Protocol Negotiation.
- NEWS: add news about NPN support.
- [Feature #6503] [ruby-core:45272]
+ * vm.c (vm_exec): use VM_FRAME_MAGIC_RESCUE on at rescue/ensure.
-Fri Aug 31 17:38:43 2012 Akinori MUSHA <knu@iDaemons.org>
+ * test/ruby/test_settracefunc.rb: should not invoke b_return at rescue
+ clause.
+ [Bug #9957]
- * lib/set.rb (Set#{each,reject!,select!}, SortedSet#each): Pass
- the original block through instead of creating one that only
- yields the passed argument.
+ * vm_dump.c (control_frame_dump): check VM_FRAME_MAGIC_RESCUE.
-Fri Aug 31 16:23:20 2012 Akinori MUSHA <knu@iDaemons.org>
+ * vm_dump.c (vm_stack_dump_each): ditto.
- * lib/ipaddr.rb: Introduce several new error classes where only
- ArgumentError and StandardError were used. IPAddr::Error is
- their common ancestor class that inherits from ArgumentError for
- backward compatibility. Submitted by Jon Daniel. Fixes #173 on
- GitHub.
+Thu Jun 19 13:39:11 2014 Arne Brasseur <arne@arnebrasseur.net>
-Fri Aug 31 14:51:27 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * proc.c (rb_method_curry): Implement Method#curry, which delegates
+ to to_proc.curry. [ruby-core:62212] [Feature #9783]
- * test/bigdecimal/test_bigdecimal.rb (TestBigDecimal#test_to_f): added
- for previous commit.
+Tue Jun 17 16:41:49 2014 Shugo Maeda <shugo@ruby-lang.org>
-Fri Aug 31 14:32:05 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * lib/net/ftp.rb (gets, readline): read lines without LF properly.
+ [ruby-core:63205] [Bug #9949]
- * ext/bigdecimal/bigdecimal.c (BigDecimal_to_f): use self's sign to
- determine 0.0 and Inf's sign instead of internal double value's.
- Reported by phasis68 (Heesob Park) at [ruby-core:47381] [Bug #6955]
+ * test/net/ftp/test_buffered_socket.rb: related test.
-Fri Aug 31 14:31:17 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Jun 17 12:35:24 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * template/id.h.tmpl, tool/id2token.rb: make id.h independent from
- parse.h, and make parse.c dependent on it instead.
+ * 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]
-Fri Aug 31 14:27:39 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Jun 17 12:24:57 2014 Koichi Sasada <ko1@atdot.net>
- * lib/mkmf.rb (create_makefile): fix race conditions at install-ext.
- target files need to depend on destination directory timestamp
- files, not phony targets.
+ * gc.c (obj_memsize_of): memsize_of(T_ZOMBIE) returns 0, not a rb_bug.
+ ObjectSpace.count_objects_size() uses memsize_of(T_ZOMBIE).
-Fri Aug 31 14:03:45 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ This bug introduced at r46348.
- * vm_trace.c (clean_hooks): do not access freed memory.
+Mon Jun 16 19:00:11 2014 Koichi Sasada <ko1@atdot.net>
- * vm_trace.c (rb_threadptr_exec_event_hooks): fix uninitialized state
- when no events is executed.
+ * test/runner.rb: failure message should be passed as an argument.
-Thu Aug 30 18:21:51 2012 Tanaka Akira <akr@fsij.org>
+Mon Jun 16 18:42:57 2014 Koichi Sasada <ko1@atdot.net>
- * io.c (rb_io_close): call rb_last_status_clear.
+ * test/runner.rb: capture TracePoint stat before setup and compare
+ it after teardown.
-Thu Aug 30 16:17:52 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Jun 16 14:33:56 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/bigdecimal/bigdecimal.c (BigDecimal_to_f): check underflow since
- strtod() sets errno to ERANGE at underflow too. [ruby-core:47342]
- [Bug #6944]
+ * process.c (open): use UTF-8 version function to support
+ non-ascii path properly. [ruby-core:63185] [Bug #9946]
-Thu Aug 30 12:44:43 2012 Akinori MUSHA <knu@iDaemons.org>
+Sat Jun 14 10:54:08 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/set.rb (Set#{<,>,<=,>=}): Define comparison operators as
- shorthand for the {proper_}{subset?,superset?} methods (finally).
- Given a push by Alexander E. Fischer.
+ * array.c (rcombinate0): remove recursion, by looping with indexes
+ stored in `p`.
-Thu Aug 30 09:21:01 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * array.c (rpermute0): remove recursion, by looping with indexes
+ stored in `p`.
- * lib/uri/ftp.rb (URI::FTP#initialize): raise InvalidURIError if "//"
- is not present [ruby-core:47344] [Bug #6945]
+ * array.c (permute0): remove recursion, by looping with indexes
+ stored in `p`. [ruby-core:63103] [Bug #9932]
-Thu Aug 30 07:45:12 2012 Luis Lavena <luislavena@gmail.com>
+Sat Jun 14 10:52:15 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/ruby/test_file_exhaustive.rb: fix test introduced in r36811 for
- posix environments where HOME is not defined. [ruby-core:47322]
+ * 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
-Wed Aug 29 23:42:59 2012 Tanaka Akira <akr@fsij.org>
+Sat Jun 14 08:28:59 2014 Zachary Scott <e@zzak.io>
- * internal.h (rb_last_status_clear): declared.
+ * man/rake.1: [DOC] Update links for Rake, patch by @hsbt [Bug #9904]
+ [Fixes GH-628] https://github.com/ruby/ruby/pull/628
- * process.c (rb_last_status_clear): exported.
- (rb_f_system): call rb_last_status_clear.
+Fri Jun 13 17:58:58 2014 Koichi Sasada <ko1@atdot.net>
- * io.c (rb_f_backquote): call rb_last_status_clear.
+ * vm_trace.c: add new method TracePoint.stat to debug
+ TracePoint mechanism.
-Wed Aug 29 22:01:15 2012 Tanaka Akira <akr@fsij.org>
+ Ruby users should not use this method. So I don't note this method
+ in the NEWS file.
- * process.c (rb_f_system): check failures of waitpid.
- [ruby-talk:398687]
+ * test/runner.rb: detect zombie active TracePoints with
+ TracePoint.stat.
-Wed Aug 29 15:03:04 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Jun 13 17:46:31 2014 Koichi Sasada <ko1@atdot.net>
- * configure.in (LIBDIR_BASENAME): use configured libdir value to fix
- --enable-load-relative on systems where libdir is not default value,
- overridden in config.site files. [ruby-core:47267] [Bug #6903]
+ * vm_trace.c: clear and restore recursive checking thread local data
+ to avoid unexpected throw from TracePoint.
+ [Bug #9940]
- * ruby.c (ruby_init_loadpath_safe): ditto.
+ * test/ruby/test_settracefunc.rb: add a test.
-Wed Aug 29 14:34:41 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * thread.c: added
+ * rb_threadptr_reset_recursive_data(rb_thread_t *th);
+ * rb_threadptr_restore_recursive_data(rb_thread_t *th, VALUE old);
- * addr2line.c: SIZE_MAX is defined in stdint.h, so r36755 breaks
- 32bit FreeBSD. [ruby-core:47360] [Bug #6948]
+ * vm_core.h: ditto.
-Wed Aug 29 04:50:04 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+Fri Jun 13 17:33:14 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/openssl/utils.rb
- test/openssl/test_pair.rb
- test/openssl/test_pkey_dh.rb: Use 1024 bit DH parameters to satisfy
- OpenSSL FIPS requirements. Patch by Vit Ondruch.
- [Bug #6938] [ruby-core:47326]
+ * 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]
-Tue Aug 28 22:31:49 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+ * array.c (yield_indexed_values): extract from permute0(),
+ rpermute0(), and rcombinate0().
- * insns.def (checkmatch): suppress warnings. [ruby-core:47339]
- [Bug #6930]
+Fri Jun 13 13:42:58 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Aug 28 20:03:54 2012 NARUSE, Yui <naruse@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.
- * configure.in: Fixing Haiku R1/alpha3 build with gcc-4.4.4.
- - omit ANSI standard flags to compile socket extension where
- anonymous union is required.
- - remove redundant -be flags.
- by Takashi Toyoshima <toyoshim@gmail.com>
- https://github.com/ruby/ruby/pull/168
+Thu Jun 12 20:32:28 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Aug 28 11:32:37 2012 Yuki Yugui Sonoda <yugui@google.com>
+ * string.c (rb_str_resize): should consider the capacity instead
+ of the old length, as pointed out by nagachika.
- * nacl/GNUmakefile.in (.rbconfig.time): r36828 was incomplete.
- It did not run correctly on clean build.
+Thu Jun 12 18:31:01 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Tue Aug 28 09:25:20 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * lib/net/http/responses.rb: added Net::HTTPPermanentRedirect(308)
+ Contributed by @yorkie [fix GH-638]
- * win32/Makefile.sub (Makefile): make to depend on common.mk, to
- stop and force to re-run make process when common.mk is changed.
+Thu Jun 12 13:27:38 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Aug 27 20:19:49 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+ * string.c (rb_str_freeze): shrink the buffer before freezing, as
+ pointed out by Eric Wong at [ruby-core:63119].
- * test/etc/test_etc.rb (TestEtc#test_getgrgid): fix for non unique GID.
- No unixen systems guarantee that GID is unique. Etc.getgrgid would
- not return the first entry in the order of Etc.group for shared GID.
- [ruby-core:47312] [Bug #6935]
+Thu Jun 12 13:09:03 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Aug 27 18:19:36 2012 Koichi Sasada <ko1@atdot.net>
+ * file.c (expand_path): shrink expanded path which no longer needs
+ rooms to append. [ruby-core:63114] [Bug #9934]
- * include/ruby/ruby.h (rb_float_value): optimize it.
- This technique was pointed by shinichiro.hamaji
- <http://shinh.skr.jp/m/?date=20120825#p02>.
+Wed Jun 11 17:37:48 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Aug 27 15:08:25 2012 Yuki Yugui Sonoda <yugui@google.com>
+ * configure.in (rb_cv_scalar_pthread_t): pthread_t is not required
+ to be a scalar type.
- * common.mk (vm_trace.o): Added a missing dependency.
+ * 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]
-Sun Aug 26 09:29:32 2012 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+ * thread_pthread.c (Init_native_thread, thread_start_func_1),
+ (native_thread_create): set thread_id_str if needed.
- * nacl/GNUmakefile.in (package): make package should install
- example.html for nacl build
+ * vm_core.h (rb_thread_t): add thread_id_string if needed.
- Patch by Takashi Toyoshima <toyoshim AT gmail.com>.
+Wed Jun 11 01:53:22 2014 Koichi Sasada <ko1@atdot.net>
-Sun Aug 26 09:22:33 2012 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+ * gc.c: invoke GC before memory allocation (xmalloc/xrealloc)
+ when GC.stress = true.
+ [Bug #9859]
- * nacl/GNUmakefile.in (CC, LD, NM, AR, AS, RANLIB, OBJDUMP, OBJCOPY)
- Rewrites these variables instead of PATH.
- NaCl port uses a toolchain which is specified by NACL_SDK_ROOT
- environment variable. Originally, NaCl build added the toolchain
- under the NACL_SDK_ROOT to the PATH. But updating PATH doesn't work
- on Mac.
- (RBCONFIG): Replaces configs with the variable updates above.
+ * test/ruby/test_gc.rb: add a test.
- * configure.in: Thus it is no longer necessary to check $PATH.
+Tue Jun 10 13:20:14 2014 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
- Based on a patch by Takashi Toyoshima <toyoshim AT gmail.com>.
+ * 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>
-Sun Aug 26 16:53:00 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Jun 10 10:57:07 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * insns.def (checkmatch): suppress warnings. [ruby-core:47310]
- [Bug #6930]
+ * 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]
- * vm_core.h (VM_FRAME_TYPE_FINISH_P): ditto.
+Mon Jun 9 20:40:48 2014 Koichi Sasada <ko1@atdot.net>
-Fri Aug 24 15:42:28 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c: change full GC timing to keep lower memory usage.
- * lib/mkmf.rb (create_makefile): use timestamp for destination
- directories to make them before making or copying files there.
- [ruby-dev:46067] [Bug #6904]
+ Extend heap only at
+ (1) after major GC
+ or
+ (2) after several (two times, at current) minor GC
-Fri Aug 24 12:40:15 2012 Luis Lavena <luislavena@gmail.com>
+ Details in https://bugs.ruby-lang.org/issues/9607#note-9
+ [Bug #9607]
- * configure.in (mingw): add shlwapi to the list of dependency
- libs for Windows.
- * win32/Makefile.sub (EXTSOLIBS): ditto.
+Mon Jun 9 16:01:41 2014 Masahiro Ide <imasahiro9@gmail.com>
- * internal.h: declare internal functions rb_w32_init_file,
- rb_file_expand_path_internal and rb_file_expand_path_fast.
+ * gc.c (gcdebug_sentinel): fix typo, "sentinel" not "sential".
+ [fix GH-634]
- * file.c (Init_File): invoke Windows initialization rb_w32_init_file
+Mon Jun 9 00:04:25 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * win32/file.c (rb_file_load_path_internal): new function.
- Windows-specific implementation that replaces file_expand_path.
- [Bug #6836][ruby-core:46996]
+ * configure.in (posix_fadvise): disable use of posix_fadvise
+ itself on 32-bit AIX. [ruby-core:62968] [Bug #9914]
- * win32/file.c (rb_w32_init_file): new function. Initialize codepage
- cache for faster conversion encodings lookup.
+Sun Jun 8 23:28:00 2014 <kanemoto@ruby-lang.org>
- * file.c (file_expand_path): rename to rb_file_expand_path_internal.
- Conditionally exclude from Windows.
+ * 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]
- * file.c (rb_file_expand_path_fast): new function. delegates to
- rb_file_expand_path_internal without performing a hit to the
- filesystem.
+Sun Jun 8 04:52:40 2014 Jun Hiroe <Jun.Hiroe@gmail.com>
- * file.c (file_expand_path_1): use rb_file_expand_path_internal without
- path expansion (used by require).
- * file.c (rb_find_file_ext_safe): ditto.
- * file.c (rb_find_file_safe): ditto.
+ * string.c (rb_str_slice_bang): [DOC] update return value against
+ a fixnum, which has changed because of M17N. [fix GH-631]
- * load.c (rb_get_expanded_load_path): use rb_file_expand_path_fast.
- * load.c (rb_feature_provided): ditto.
+Sat Jun 7 22:13:42 2014 Benoit Daloze <eregontp@gmail.com>
- * file.c (rb_file_expand_path): use rb_file_expand_path_internal with
- path expansion.
- * file.c (rb_file_absolute_path): ditto.
+ * 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_file_exhaustive.rb: new tests to exercise
- rb_file_expand_path_internal implementation and compliance with
- existing behaviors.
+ * test/ruby/test_numeric.rb: Add corresponding test.
-Fri Aug 24 07:35:24 2012 Eric Hodel <drbrain@segment7.net>
+Sat Jun 7 18:15:33 2014 Benoit Daloze <eregontp@gmail.com>
- * lib/net/http/backward.rb (class Net): Restored Net::HTTPSession to
- fix backwards-compatibility with ancient Net::HTTP. [Bug #6889]
+ * numeric.c (bit_coerce): remove constant parameter `err'
+ (always TRUE) of bit_coerce().
-Thu Aug 23 20:58:55 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+Sat Jun 7 16:01:57 2014 Yutaka Kanemoto <kanemoto@ruby-lang.org>
- * common.mk: support `make id.h` without `rm .id.h.time` after
- `rm id.h`.
+ * 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]
-Thu Aug 23 20:48:45 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Sat Jun 7 12:51:51 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/ruby/test_fixnum.rb (TestFixnum#test_singleton_method): new test.
+ * io.c (read_all): truncate the buffer before appending read data,
+ instead of truncating before reading.
+ [ruby-core:55951] [Bug #8625]
- * test/ruby/test_bignum.rb (TestBignum#test_singleton_method): ditto.
+Sat Jun 7 12:28:53 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/ruby/test_float.rb (TestFloat#test_singleton_method): ditto.
+ * ext/digest/digest.c (rb_digest_instance_equal): no need to call
+ `to_s` twice. [Bug #9913]
- * test/ruby/test_symbol.rb (TestSymbol#test_singleton_method): ditto.
+Sat Jun 7 11:35:01 2014 Tanaka Akira <akr@fsij.org>
-Thu Aug 23 20:34:32 2012 NAKAMURA Usaku <usa@ruby-lang.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]
- * class.c (singleton_class_of): flonum can't have singleton class.
+Sat Jun 7 06:03:11 2014 Benoit Daloze <eregontp@gmail.com>
- * vm.c (vm_define_method): flonum can't have singleton method.
+ * ext/digest/digest.c (rb_digest_instance_equal):
+ fix #== for non-string arguments. [ruby-core:62967] [Bug #9913]
-Thu Aug 23 19:18:33 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * test/digest/test_digest.rb: add test for above.
- * common.mk (win32/*): macro RUBY_H_INCLUDES is not defined there,
- so need to move dependency rules under the definition of it.
+Fri Jun 6 22:19:26 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Aug 23 19:16:20 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * compile.c (private_recv_p): check by node type, instead of a
+ magic number.
- * win32/Makefile.sub: refactoring. remove unused rules, and update
- some rules which are not used usually to fit current macros.
+ * node.h (NODE_PRIVATE_RECV), parse.y (attrset_gen): remove
-Thu Aug 23 16:46:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Jun 6 17:07:08 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * file.c (rb_find_file_ext_safe, rb_find_file_safe): default to
- US-ASCII for encdb and transdb.
+ * compile.c (iseq_compile_each), parse.y (new_attr_op_assign_gen):
+ allow op assign to a private attribute.
+ [ruby-core:62949] [Bug #9907]
- * load.c (search_required): keep encoding of feature name. set
- loading path to filesystem encoding. [Bug #6377][ruby-core:44750]
+Fri Jun 6 13:39:32 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ruby.c (add_modules, require_libraries): assume default external
- encoding as well as ARGV.
+ * io.c (io_setstrbuf, io_read): should not shorten the given buffer until
+ read succeeds. [ruby-core:55951] [Bug #8625]
-Thu Aug 23 16:20:04 2012 Koichi Sasada <ko1@atdot.net>
+Fri Jun 6 07:41:41 2014 Aaron Patterson <aaron@tenderlovemaking.com>
- * include/ruby/ruby.h: introduce flonum technique for
- 64bit CPU environment (sizeof(double) == sizeof(VALUE)).
- flonum technique enables to avoid double object creation
- if the double value d is in range about between
- 1.72723e-77 < |d| <= 1.15792e+77 or 0.0.
- flonum Float value is immediate and their lowest two bits
- are b10.
- If flonum is activated, then USE_FLONUM macro is 1.
- I'll write detailed in this technique on
- https://bugs.ruby-lang.org/projects/ruby-trunk/wiki/Flonum_tech
+ * 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
- * benchmark/bmx_temp.rb: add an benchmark for simple
- Float calculation.
+Thu Jun 5 16:08:39 2014 Koichi Sasada <ko1@atdot.net>
- * gc.c (id2ref, rb_obj_id): add flonum Float support.
+ * gc.c (gc_page_sweep): refactoring.
- * include/ruby/intern.h: move decl of rb_float_new(double)
- to include/ruby/ruby.h.
+ * gc.c (gc_page_sweep): should not set, but add final_slots into
+ sweep_page->final_slots.
- * insns.def, vm.c, vm_insnhelper.c: add flonum optimization
- and simplify source code.
+Thu Jun 5 14:36:24 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_insnhelper.h (FLONUM_2_P): added.
+ * configure.in (jemalloc): check for the header regardless drop-in
+ libjemalloc is found, for `malloc_conf` declaration.
- * marshal.c: support flonum output.
+ * version.c (ruby_show_version): show `malloc_conf` if set.
+ [Feature #9113]
- * numeric.c (rb_float_new_in_heap): added.
+ * 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]
- * parse.y: support flonum.
+ * include/ruby/missing.h: include alternative malloc header to
+ replace memory management functions.
- * random.c: ditto.
+ * dln.c, io.c, parse.y, st.c: undef malloc family before
+ re-definition to suppress warnings.
-Thu Aug 23 16:12:40 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Thu Jun 5 12:52:18 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * lib/mkmf.rb (create_makefile): add dependency to header files when
- depend files don't exist. now we can remove simple (and often
- wrong) depend files in most cases.
+ * man/ruby.1: remove rubyforge entry.
-Thu Aug 23 16:02:20 2012 Koichi Sasada <ko1@atdot.net>
+Thu Jun 5 12:45:32 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * ext/date/depend: add dependency to $(ruby_headers).
+ * misc/README: use github link instead of rubyforge.
-Thu Aug 23 12:51:39 2012 Shugo Maeda <shugo@ruby-lang.org>
+Thu Jun 5 10:03:29 2014 Koichi Sasada <ko1@atdot.net>
- * insns.def (invokesuper): reverted r36640 partially to make super
- in a thread work correctly. [ruby-core:47284] [Bug #6907]
+ * gc.c (obj_free): check also FL_PROMOTED bit by RVALUE_OLD_P().
- * test/ruby/test_super.rb: related test.
+Thu Jun 5 03:45:28 2014 Eric Wong <e@80x24.org>
-Thu Aug 23 12:30:20 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * configure.in: add --with-jemalloc option
+ [ruby-core:62912]
- * win32/configure.bat: support --with(out)?-ext(ensions) options.
+Wed Jun 4 22:28:14 2014 Koichi Sasada <ko1@atdot.net>
-Thu Aug 23 11:52:04 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * gc.c: introduce RZombie to manage zombie objects.
+ Rewrite finalizing logics with this type.
- * configure.in: Fixing Haiku build.
- - -lbe is not required for linking
- - stack protector doesn't work for now because of the default gcc's
- bug
- by Takashi Toyoshima <toyoshim@gmail.com>
- https://github.com/ruby/ruby/pull/167
+ * gc.c (gc_verify_internal_consistency): verify zombie (finalizing)
+ objects count.
- * signal.c (ruby_signal): haiku doesn't have SIGBUS.
+Wed Jun 4 22:09:53 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Aug 23 11:32:44 2012 NAKAMURA Usaku <usa@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]
- * test/open-uri/test_open-uri.rb (TestOpenURI#test_read_timeout): this
- test expects that the server thread will be killed in sleep, but 0.01
- sec is too short to reach there.
+Wed Jun 4 21:23:52 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Aug 23 10:49:28 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * re.c (match_aref): should not ignore name after NUL byte.
+ [ruby-dev:48275] [Bug #9902]
- * configure.in: use the value of --with-opt-dir on building ruby
- itself. [ruby-dev:46064] [Bug #6900]
+Wed Jun 4 04:08:37 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Aug 23 10:36:35 2012 NAKAMURA Usaku <usa@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]
- * common.mk (ID_H_TARGET): revert a part of r36724 and r36751. they
- break mswin build from clean source.
+Tue Jun 3 23:32:34 2014 Tanaka Akira <akr@fsij.org>
-Thu Aug 23 02:37:35 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+ * 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.
- * ext/syck: removed. Fixes [ruby-core:43360]
+Tue Jun 3 19:11:45 2014 Koichi Sasada <ko1@atdot.net>
- * test/syck: removed.
+ * gc.c (rb_objspace_free): should not rest_sweep() here.
+ Some data structures are already freed.
- * lib/yaml.rb: only require psych, show a warning if people try to set
- the engine to syck.
+Tue Jun 3 18:43:51 2014 Koichi Sasada <ko1@atdot.net>
-Thu Aug 23 01:46:53 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+ * test/ruby/test_gc.rb: allocate more objects to invoke GC by newobj.
+ GC allows extending pages depends on heap_increment.
- * insns.def: search up the cf stack for an object that is an instance
- of the recipient class. Fixes [ruby-core:47186]
+Tue Jun 3 18:01:27 2014 Koichi Sasada <ko1@atdot.net>
- * test/ruby/test_super.rb: related test.
+ * gc.c (rb_gc_call_finalizer_at_exit): add
+ gc_verify_internal_consistency() when RGENGC_CHECK_MODE >= 2.
-Wed Aug 22 19:46:24 2012 Tadayoshi Funaba <tadf@dotrb.org>
+Tue Jun 3 17:54:21 2014 Koichi Sasada <ko1@atdot.net>
- * ext/date/date_core.c: [ruby-core:47266].
+ * gc.c: change the counting method for young objects.
+ clear counter at the beginning of every GC and
+ count promoted (infant->young) objects.
-Wed Aug 22 19:41:19 2012 Tadayoshi Funaba <tadf@dotrb.org>
+ Some promotions (infant->young) are transition of promoting to old
+ objects. We should not count such promotions.
- * ext/date/date_core.c: [ruby-core:47226].
+ With this technique, we don't need to check young objects
+ at obj_free().
-Wed Aug 22 16:57:04 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Jun 3 16:38:19 2014 Koichi Sasada <ko1@atdot.net>
- * lib/mkmf.rb (configuration): extract least ruby headers list as
- ruby_headers, so depend files can use default dependency
- explicitly.
+ * 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.
-Wed Aug 22 15:27:50 2012 Koichi Sasada <ko1@atdot.net>
+ * gc.c (gc_after_sweep): do gc_verify_internal_consistency()
+ when RGENGC_CHECK_MODE >= 2.
- * vm_insnhelper.c (vm_setup_method): fix last commit of
- vm_insnhelper.c (r36771). [ruby-dev:46065] [Bug #6901]
- Should not disable tail call opt on FINISH_FRAME.
- This flag should be propagated correctly.
+Tue Jun 3 13:14:04 2014 Shugo Maeda <shugo@ruby-lang.org>
-Wed Aug 22 14:05:23 2012 Koichi Sasada <ko1@atdot.net>
+ * 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
- * vm_trace.c: support TracePoint. [ruby-trunk - Feature #6895]
+Tue Jun 3 13:18:24 2014 Koichi Sasada <ko1@atdot.net>
- * test/ruby/test_settracefunc.rb: add tests for above.
+ * gc.c (objspace_live_slot): live slot count should not include final
+ slot (contains T_ZOMBIE) count.
- * proc.c (rb_binding_new_with_cfp): add an internal function.
+Tue Jun 3 13:03:21 2014 Koichi Sasada <ko1@atdot.net>
- * vm.c (rb_vm_control_frame_id_and_class): add an internal function.
+ * gc.c (obj_free): fix spacing.
- * vm_trace.c: add rb_add_event_hook2() and rb_thread_add_event_hook2().
- Give us the good name for them!
+Tue Jun 3 12:59:32 2014 Koichi Sasada <ko1@atdot.net>
-Wed Aug 22 11:38:16 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
+ * gc.c (check_gen_consistency): fix error message.
- * .travis.yml (before_script): Turned out that make -j is broken.
+Tue Jun 3 12:40:23 2014 Koichi Sasada <ko1@atdot.net>
-Wed Aug 22 11:23:35 2012 Shugo Maeda <shugo@ruby-lang.org>
+ * gc.c: count old/young objects more correctly.
- * vm_insnhelper.c (vm_setup_method): should not enable tail call
- optimization for frames with VM_FRAME_FLAG_FINISH.
- [ruby-dev:46065] [Bug #6901]
+ * gc.c (RVALUE_DEMOTE_FROM_OLD): decrement old object count.
-Wed Aug 22 11:20:47 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * gc.c (RVALUE_DEMOTE_FROM_YOUNG): decrement young object count.
- * lib/rubygems/test_case.rb: run test with psych if exist.
+ * gc.c (rb_gc_resurrect): increment old object count.
-Thu Aug 16 12:09:51 2012 Yuki Yugui Sonoda <yugui@google.com>
+ * gc.c (gc_marks_body): should not add old object count.
+ This code is completely my misunderstanding.
- * nacl/pepper_main.c (init_loadpath): Pushes the correct load path on
- other architectures than x86_64. Fixes #6873.
+ * gc.c (rb_gc_force_recycle): decrement young or old object count
+ correctly.
-Wed Aug 15 19:37:33 2012 Yuki Yugui Sonoda <yugui@google.com>
+Tue Jun 3 12:26:47 2014 Koichi Sasada <ko1@atdot.net>
- * configure.in (ac_cv_func_shutdown): shutdown(2) has a dummy
- implementation but has no declaration and does not work in
- NativeClient SDK pepper_20.
+ * test/ruby/memory_status.rb: add $LOAD_PATH to load test/unit
+ correctly for fiddle/import unavailable environments.
-Wed Aug 15 19:29:29 2012 Yuki Yugui Sonoda <yugui@google.com>
+Tue Jun 3 09:45:13 2014 NAKAMURA Usaku <usa@ruby-lang.org>
- * common.mk (vm_backtrace.o): Added missing dependencies.
+ * 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]
- * ext/nkf/depend (nkf.o): ditto.
+Tue Jun 3 01:34:59 2014 Zachary Scott <e@zzak.io>
- * ext/ripper/depend (ripper.o) ditto.
+ * README.EXT: [DOC] Add rb_call_super when subclassing from @robin850
+ [Fixes GH-623] https://github.com/ruby/ruby/pull/623
-Wed Aug 22 07:27:00 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Mon Jun 2 17:14:49 2014 Koichi Sasada <ko1@atdot.net>
- * lib/cgi/util.rb (CGI.escapeHTML): use &#39;
- [ruby-core:47221] [Bug #6861]
+ * vm.c (ruby_vm_destruct): remove useless call of
+ rb_gc_force_recycle().
-Tue Aug 21 21:59:22 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+ At this line, a VM object is already freed
+ (is changed to T_NONE) by rb_gc_call_finalizer_at_exit().
- * lib/observer.rb: fix typo. https://github.com/ruby/ruby/pull/162 by
- unsymbol (Philip Cunningham).
+Mon Jun 2 15:50:24 2014 Koichi Sasada <ko1@atdot.net>
-Tue Aug 21 20:30:06 2012 Benoit Daloze <eregontp@gmail.com>
+ * eval.c (rb_using_refinement): add write-barriers for
+ cref->nd_refinements.
- * test/fileutils/test_fileutils.rb (TestFileUtils#teardown):
- do not assume cwd is TMPROOT and never remove current directory.
- [ruby-core:47224][Bug #6884]
+Mon Jun 2 12:26:08 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Tue Aug 21 17:29:56 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * CONTRIBUTING.md: added contributing guide for github. [fix GH-625]
- * addr2line.c (fill_lines): need check and cast of the file size of
- target binary because there are some platforms which off_t > size_t.
+Mon Jun 2 07:30:33 2014 Tanaka Akira <akr@fsij.org>
-Tue Aug 21 17:07:58 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
+ * test/ruby/envutil.rb (default_warning): New method.
- * .travis.yml (compiler): [experimental] clang support.
+ * test/ruby/test_autoload.rb: Use EnvUtil.default_warning.
-Tue Aug 21 15:44:27 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Mon Jun 2 07:05:59 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/dl/lib/dl/func.rb (DL::Function#bind): fixes an error in
- test/dl/test_import.rb (DL::TestImport#test_carried_function)
- introduced by r36718.
- the instance of the anonymous class which wraps the block should have
- same methods and instance variables of self.
+ * include/ruby/encoding.h: constify `rb_encoding` arguments.
-Tue Aug 21 14:29:22 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * include/ruby/oniguruma.h: constify `OnigEncoding` arguments.
- * win32/Makefile.sub (scriptbin.mk): no need to include twice.
+Sun Jun 1 12:05:10 2014 Tanaka Akira <akr@fsij.org>
-Tue Aug 21 10:52:08 2012 NAKAMURA Usaku <usa@ruby-lang.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.
- * test/unit/test.rb (Test::Unit::ProxyError): new exception class to
- wrap exceptions raised in workers in parallel test mode.
+Sun Jun 1 11:36:25 2014 Tanaka Akira <akr@fsij.org>
- * test/unit/parallel.rb (Test::Unit::Worker#puke): use above wrapper
+ * lib/rinda/ring.rb (RingFinger#make_socket): Close the socket on
exception.
- [Bug #6882] [ruby-dev:46054]
-
-Tue Aug 21 10:40:06 2012 Koichi Sasada <ko1@atdot.net>
-
- * test_continuation.rb (tracing_with_thread_set_trace_func):
- fix to use Thread#set_trace_func(nil), not set_trace_func(nil).
-
-Tue Aug 21 09:32:41 2012 Ryan Davis <ryand-ruby@zenspider.com>
-
- * lib/minitest/*: Imported minitest 3.3.0 (r7676)
- * test/minitest/*: ditto
-
-Tue Aug 21 09:05:32 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/testunit/tests_for_parallel/ptest_forth.rb: added a test case
- which causes an error.
-
- * test/testunit/test_parallel.rb: follow above change.
- see [Bug #6882]
-
-Tue Aug 21 05:43:00 2012 James Edward Gray II <james@graysoftinc.com>
-
- * lib/csv.rb: Fixes #161 on github
- * lib/csv.rb: You can now specify a pattern for :skip_lines.
- Matching lines will not be passed to the CSV parser.
- * lib/csv.rb: Patch by Christian Schwartz.
-
-Tue Aug 21 05:25:41 2012 Eric Hodel <drbrain@segment7.net>
-
- * re.c (rb_reg_initialize_m): Forgot to update output for or'd-options
- example.
-
-Tue Aug 21 05:18:03 2012 Eric Hodel <drbrain@segment7.net>
- * re.c (rb_reg_initialize_m): Update example to show that regexp
- options use | an not || to avoid confusion.
+Sun Jun 1 06:55:26 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Aug 20 23:02:27 2012 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]
- * parse.y: more descriptive token names in syntax error messages.
+Sun Jun 1 04:52:47 2014 Zachary Scott <e@zzak.io>
-Mon Aug 20 20:36:30 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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
- * vm_insnhelper.c (vm_call_method): follow iclasses as klass in cfp
- but not included modules. [ruby-core:47241] [Bug #6891]
+Sat May 31 22:30:14 2014 Tanaka Akira <akr@fsij.org>
- * vm_insnhelper.c (vm_call_bmethod): pass defined_class to follow
- proper ancestors. [ruby-core:47241] [Bug #6891]
+ * test/lib/leakchecker.rb: Leak checker extracted from
+ test/lib/minitest/unit.rb.
-Mon Aug 20 11:40:27 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * common.mk: fix failed to make with -j2.
- https://gist.github.com/3397935
-
-Mon Aug 20 10:51:01 2012 Shota Fukumori <sorah@tubusu.net>
-
- * lib/test/unit.rb, lib/test/unit/parallel.rb:
- generate error message (String) in parallel.rb instead of
- marshalling Exception. Fixes [Bug #6882] [ruby-dev:46054]
-
-Sun Aug 19 01:24:32 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * enum.c: fix docs. https://github.com/ruby/ruby/pull/129 by
- richardkmichael (Richard Michael).
-
-Sun Aug 19 00:47:26 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * lib/fileutils.rb: fix typo.
- https://github.com/ruby/ruby/pull/155 by simonc (Simon COURTOIS).
-
-Sat Aug 18 09:57:46 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enc/depend: fix inplace-build condition. enc.mk is generated with
- setting $srcdir to enc, but pwd is still top build directory.
- [ruby-core:47236] [Bug #6888]
-
-Fri Aug 17 23:28:54 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * object.c (rb_any_to_s, rb_obj_inspect): preserve encodings of class
- name and instance variable names.
-
-Fri Aug 17 12:39:33 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/dl/lib/dl/func.rb (DL::Function#bind): allow to return/break from
- the callback method. (Fiddle already allows it.)
- [Bug #6389] [ruby-dev:45604]
-
-Thu Aug 16 19:54:24 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_trace.c, vm_core.h: simplify tracing mechanism.
-
- (1) add rb_hook_list_t data structure which includes
- hooks, events (flag) and `need_clean' flag.
- If the last flag is true, then clean the hooks list.
- In other words, deleted hooks are contained by `hooks'.
- Cleanup process should run before traversing the list.
- (2) Change check mechanism
- See EXEC_EVENT_HOOK() in vm_core.h.
- (3) Add `raw' hooks APIs
- Normal hooks are guarded from exception by rb_protect().
- However, this protection is overhead for too simple
- functions which never cause exceptions. `raw' hooks
- are executed without protection and faster.
- Now, we only provide registration APIs. All `raw'
- hooks are kicked under protection (same as normal hooks).
-
- * include/ruby/ruby.h: remove internal data definition and
- macros.
-
- * internal.h (ruby_suppress_tracing), vm_trace.c: rename
- ruby_suppress_tracing() to rb_suppress_tracing()
- and remove unused function parameter.
-
- * parse.y: fix to use renamed rb_suppress_tracing().
-
- * thread.c (thread_create_core): no need to set RUBY_VM_VM.
-
- * vm.c (mark_event_hooks): move definition to vm_trace.c.
-
- * vm.c (ruby_vm_event_flags): add a global variable.
- This global variable represents all of Threads and VM's
- event masks (T1#events | T2#events | ... | VM#events).
- You can check the possibility kick trace func or not
- with ruby_vm_event_flags.
- ruby_vm_event_flags is maintained by vm_trace.c.
-
- * cont.c (fiber_switch, rb_cont_call): restore tracing status.
- [Feature #4347]
-
- * test/ruby/test_continuation.rb: ditto.
-
-Thu Aug 16 19:15:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * object.c (rb_class_initialize): forbid inheriting uninitialized
- class. another class tree not based on BasicObject cannot exist.
- [ruby-core:47148][Bug #6863]
-
-Thu Aug 16 11:52:06 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/-ext-/test_printf.rb (Test_SPrintf#test_{taint,untrust}): use
- plain object so that the results of to_s and inspect are infected.
- [ruby-dev:46053] [Bug #6881]
-
-Thu Aug 16 09:46:07 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * strftime.c: remove unnecessary macros to check traditional C.
- https://github.com/ruby/ruby/pull/46 by lateau (Daehyub Kim).
-
- * vsnprintf.c: remove K&R.
-
-Wed Aug 15 20:47:49 2012 Benoit Daloze <eregontp@gmail.com>
-
- * object.c (rb_obj_inspect): Kernel#inspect: do not call #to_s. A class
- can now benefit from the nice default #inspect even if it defines #to_s.
- Also, there is no more unexpected change in #inspect result.
-
- * NEWS: Add note about the change.
-
- * bignum.c, io.c, numeric.c, object.c, proc.c, vm.c (Init_*):
- Adapt internal structures (by aliasing #inspect to #to_s) so they
- don't rely on the removed behavior (#inspect calling overridden #to_s).
-
- * test/ruby/test_object.rb (test_inspect): add tests for Kernel#inspect.
-
- * lib/pp.rb (class PP): do not call #to_s anymore, as #inspect
- no more does (mame).
-
- * test/test_pp.rb (class PPInspectTest): remove related assertion (mame).
- [ruby-core:43238][Feature #6130]
-
- * test/drb/drbtest.rb (DRbCore#teardown, DRbAry#teardown):
- adapt DRb tests with the new change (shirosaki).
- [ruby-core:47182][Bug #6866]
-
-Wed Aug 15 18:05:37 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * lib/test/unit.rb (Test::Unit::Runner#failed): need to delete the
- status line if the status is skipped and -q is specified.
-
-Wed Aug 15 16:26:52 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * sprintf.c (ruby__sfvextra): the result should be infected by the
- given strings.
-
- * sprintf.c (ruby__sfvwrite): set buffer length and exclude
- uninitialized garbage to get correct coderange.
-
-Wed Aug 15 16:20:09 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * common.mk (ID_H_TARGET): make timestamp file of id.h so that the
- header will not be remade repetitively.
-
-Wed Aug 15 11:39:53 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_trace.c: separate trace_func related functions from
- thread.c.
-
- * thread.c: ditto.
+Sat May 31 21:15:43 2014 URABE Shyouhei <shyouhei@ruby-lang.org>
- * common.mk: add vm_trace.o.
+ * 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.
- * inits.c: call Init_vm_trace().
+ * 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.
-Tue Aug 14 16:25:46 2012 Shugo Maeda <shugo@ruby-lang.org>
+Sat May 31 16:32:50 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * test/erb/test_erb.rb (test_html_escape): add assertions for the
- cases where the argument is not a String.
+ * lib/ipaddr.rb: extracted inline tests into test dir.
+ * test/test_ipaddr.rb: ditto.
-Tue Aug 14 16:03:31 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Sat May 31 16:29:21 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * win32/win32.c (check_valid_dir): reject "..." as directory name.
- [Bug #6851]
+ * ext/digest/lib/digest/hmac.rb: extracted inline tests into test dir.
+ * test/digest/test_digest_hmac.rb: ditto.
-Tue Aug 14 16:02:51 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Sat May 31 16:02:03 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * test/ruby/test_file_exhaustive.rb
- (TestFileExhaustive#test_stat_dotted_prefix): added.
+ * test/test_syslog.rb: remove executable.
-Tue Aug 14 15:39:09 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Sat May 31 08:58:32 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/ruby/test_file_exhaustive.rb
- (TestFileExhaustive#test_stat_drive_root): added.
+ * enc/unicode.c (init_case_fold_table): no longer need to
+ initialize tables at runtime.
-Tue Aug 14 10:38:17 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * enc/unicode/case-folding.rb (lookup_hash): make perfect hash to
+ lookup case unfolding table 3.
- * lib/erb.rb (ERB::Util.html_escape): fix r36687: call to_s before
- passing it to CGI.escapeHTML.
+ * enc/unicode/case-folding.rb (lookup_hash): make perfect hash to
+ lookup case unfolding table 2.
-Mon Aug 13 13:13:19 2012 Shugo Maeda <shugo@ruby-lang.org>
+ * enc/unicode/case-folding.rb (lookup_hash): make perfect hash to
+ lookup case unfolding table 1.
- * lib/erb.rb (ERB::Util.html_escape): use CGI.escapeHTML to escape
- single quotes. [ruby-core:47138] [Bug #6861]
+ * enc/unicode/case-folding.rb (lookup_hash): make perfect hash to
+ lookup case folding table.
-Sun Aug 12 11:57:20 2012 Kazuki Tsujimoto <kazuki@callcc.net>
+ * enc/unicode/case-folding.rb (print_table): merge non-locale and
+ locale tables, and reduce initializing loops.
- * vm.c (invoke_block_from_c): fix unintentional block passing.
- [ruby-dev:45071] [Bug #5832]
+ * enc/unicode/case-folding.rb (CaseFolding): modularize, and add
+ --output-file option.
-Fri Aug 10 08:41:28 2012 Eric Hodel <drbrain@segment7.net>
+ * enc/unicode/case-folding.rb: script to convert CaseFolding.txt,
+ translated from CaseFolding.py.
- * gc.c (gc_malloc_allocated_size): RDoc does not process macros, so
- mention this method is only available when ruby is built with
- CALC_EXACT_MALLOC_SIZE
- * gc.c (gc_malloc_allocations): ditto
+Sat May 31 08:31:41 2014 Tanaka Akira <akr@fsij.org>
-Thu Aug 9 23:46:51 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/lib/minitest/unit.rb: Check Tempfile leaks for each test method
+ again.
- * tool/mkrunnable.rb: see build_os instead of target arch for
- cross-compiling.
+Sat May 31 03:50:50 2014 Zachary Scott <e@zzak.io>
- * configure.in (MINIRUBY): use real path for include path.
+ * lib/delegate.rb: [DOC] Document raise in Delegator class
+ Patch by @lucasmazza. [Fixes GH-621]
+ https://github.com/ruby/ruby/pull/621
- * template/fake.rb.in (builddir): remove duplications
+Fri May 30 21:23:26 2014 Tanaka Akira <akr@fsij.org>
-Thu Aug 9 20:03:11 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+ * 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/ruby/test_file_exhaustive.rb
- (TestFileExhaustive#test_stat_special_file): add a test.
- GetFileAttributesExW fails to get attributes of special files
- such as pagefile.sys.
+ * test/webrick/utils.rb: :ShutdownSocketWithoutClose is not required
+ now to immediate server shutdown detection.
+ This fixes fd leaks.
- * win32/win32.c (check_valid_dir): for performance, check the path
- by FindFirstFileW only if the path contains "..."
+ * test/net/http/utils.rb: Ditto.
- * win32/win32.c (winnt_stat): use GetFileAttributesExW instead of
- FindFirstFileW since GetFileAttributesExW is faster.
- Based on the patch by Dusan D. Majkic.
- [ruby-core:47083] [Feature #6845]
+Fri May 30 20:58:37 2014 Tanaka Akira <akr@fsij.org>
-Thu Aug 9 18:33:46 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/lib/minitest/unit.rb (check_fd_leak): Sort the inspected
+ objects list for a FD.
- * ruby.c (proc_options): show version only once even if -v and
- --version are given together.
- http://twitter.com/d6rkaiz/status/233491797085671424
+Fri May 30 18:06:55 2014 Tanaka Akira <akr@fsij.org>
-Thu Aug 9 12:37:22 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * test/lib/minitest/unit.rb (check_fd_leak): Try GC to delete leaked
+ FDs.
- * test/openssl/test_config.rb (OpenSSL#test_constants): skip this
- test if platform is Mac OS X or Windows. [Bug #6830]
+Fri May 30 12:05:59 2014 NARUSE, Yui <naruse@ruby-lang.org>
-Wed Aug 8 22:51:30 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/lib/test/unit/parallel.rb (_run_suite): orig_stdout may be nil
+ though I don't know the reason.
- * vm_eval.c (eval_under): singletons other than special constants
- don't need cref-scope hack.
+Fri May 30 11:33:35 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Aug 8 22:45:38 2012 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]
- * common.mk (.y.h): split from .y.c rule to manage dependency on
- parse.h. [ruby-core:46741] [Bug #6789]
+Fri May 30 10:22:21 2014 Mark Lorenz <mlorenz@covermymeds.com>
- * common.mk (id.h): keep old file unless changed.
+ * lib/erb.rb (result): [DOC] no longer accepts a Proc, as
+ Kernel.eval does not. [fix GH-619]
-Wed Aug 8 17:11:20 2012 Koichi Sasada <ko1@atdot.net>
+Fri May 30 07:25:46 2014 Tanaka Akira <akr@fsij.org>
- * compile.c (ADD_INSNL): make ADD_INSNL as alias of ADD_INSN1.
+ * ext/-test-/dir: Dir#fileno implemented.
-Wed Aug 8 17:08:14 2012 Koichi Sasada <ko1@atdot.net>
+ * test/lib/minitest/unit.rb (find_fds): Don't return the fd used to
+ scan /proc/$$/fd.
- * bootstrap/test_exception.rb: fix a last committed test.
+Fri May 30 04:48:00 2014 Eric Wong <e@80x24.org>
-Wed Aug 8 16:27:58 2012 Koichi Sasada <ko1@atdot.net>
+ * 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
- * compile.c, insns.def (checkmatch):
- remove checkincludearray instruction and
- add new instruction checkmatch.
- This change is to solve
- [Bug #4438] "rescue args type check omitted".
+Thu May 29 23:27:50 2014 Rei Odaira <Rei.Odaira@gmail.com>
- * iseq.c: increment ISEQ_MAJOR_VERSION because removal of
- checkincludearray instruction.
+ * 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]
- * vm_core.h: add several definitions for
- the checkmatch instruction.
+Thu May 29 23:11:20 2014 Tanaka Akira <akr@fsij.org>
- * vm_insnhelper.c (check_match): added.
+ * io.c (pipe_open): Close pipes when rb_execarg_fixup() raises
+ an exception.
+ (rb_execarg_fixup_v): New function.
- * bootstraptest/test_exception.rb: add a test.
+Thu May 29 22:18:57 2014 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_exception.rb: ditto.
+ * test/lib/minitest/unit.rb (capture_subprocess_io): Close fds.
-Wed Aug 8 05:51:20 2012 Eric Hodel <drbrain@segment7.net>
+Thu May 29 19:47:08 2014 Tanaka Akira <akr@fsij.org>
- * proc.c (method_clone): Added documentation. Patch by Robin Dupret.
- Fixes #152 on github.
-
-Tue Aug 7 20:19:29 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/readline/readline.c (Init_readline): rl_catch_signals=0 returns
- back. Without this, on FreeBSD9 and readline 6.2 irb can't catch ^C.
- [Bug #5423]
-
-Tue Aug 7 20:12:39 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_exec.c, insns.def (leave): solve problems on
- OPT_CALL_THREADED_CODE.
- Catch up finish frame structure on OPT_CALL_THREADED_CODE.
-
- * vm_core.h: add rb_thread_t#retval for temporary space on
- OPT_CALL_THREADED_CODE.
-
- * vm.c (th_init): clear rb_thread_t#retval as Qundef.
-
- * vm_dump.c (rb_vmdebug_debug_print_pre): fix debug print format.
-
-Tue Aug 7 11:58:27 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_require.rb (TestRequire#test_require_twice): added.
-
-Tue Aug 7 11:35:37 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * vm_method.c (rb_redefine_opt_method): use RCLASS_ORIGIN to avoid
- SEGV when a module-prepended class is refined.
-
-Tue Aug 7 10:46:37 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_file_exhaustive.rb
- (TestFileExhaustive#test_expand_path*): refactoring. split the method
- into some chunks of the same kind of tests.
-
-Tue Aug 7 00:31:09 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * class.c (rb_special_singleton_class_of): utility function.
-
- * vm_eval.c (eval_under): special deal for class variable scope with
- instance_eval.
-
- * vm_eval.c (rb_obj_instance_eval, rb_obj_instance_exec): allow method
- definition in instance_eval of special constants. [ruby-core:28324]
- [Bug #2788]
-
-Tue Aug 7 00:23:58 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * variable.c (CVAR_LOOKUP): split into helper functions.
-
-Mon Aug 6 19:15:11 2012 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * test/win32ole/test_win32ole_variant.rb: setting WIN32OLE.locale
- to pass some assertion. Thanks to Hiroshi Shirosaki.
- [ruby-core:46873][Bug #6814]
-
-Mon Aug 6 15:54:50 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * internal.h, class.c, eval.c, insns.def: find the appropriate
- receiver for super called in instance_eval. If such a receiver is
- not found, raise NoMethodError. [ruby-dev:39772] [Bug #2402]
-
-Mon Aug 6 14:54:38 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * include/ruby/ruby.h, eval.c, vm_insnhelper.c: fix typo.
-
-Mon Aug 6 13:13:58 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_eval.c (vm_call_super): since cfp->klass is always class or
- iclass, no search from method entry.
-
- * insns.def (defined): now should use klass in the current control
- frame to search superclass, not me->klass. reported by naruse.
-
-Mon Aug 6 11:19:19 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/etc/test_etc.rb (TestEtc#test_getpwuid): `s' is never set to nil.
-
-Mon Aug 6 11:08:48 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/syslog/test_syslog_logger.rb: skip unless Syslog module is
- available.
-
-Mon Aug 6 00:40:54 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/bigdecimal/bigdecimal.c (BigMath_s_log): fix format specifier.
-
-Mon Aug 6 00:39:24 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/ruby.h (NUM2ULONG): optimize by inline as well as
- NUM2LONG, and cast to unsigned long explicitly for the platforms
- where SIZEOF_VALUE is larger than SIZEOF_LONG.
-
- * include/ruby/ruby.h (NUM2SSIZET): fix type to cast.
-
-Sun Aug 5 21:10:36 2012 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c : if ENABLE_VM_OBJSPACE is 1, rest_sweep is not defined.
- remove unused declarations. [ruby-core:47004] [Bug #6837]
-
-Sun Aug 5 19:31:57 2012 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c: just move functions and so on. I don't touch any internal
- implementation.
-
-Sun Aug 5 13:22:29 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * configure.in: use gcc-4.2 prior to clang, gcc, and cc if exist for
- the use of Snow Leopard's old clang. see also r36594, r36610, r36611.
-
-Sun Aug 5 06:55:10 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_{core,strftime}.c: [ruby-core:46990].
-
-Sat Aug 4 22:56:20 2012 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c: use inline functions instead of macros, and close up
- related codes for the profiler.
-
-Sat Aug 4 20:37:56 2012 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c (gc_mark_children): use gc_mark_ptr instead of marking
- a object directly.
-
-Sat Aug 4 10:02:03 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * test/ruby/test_alias.rb (test_super_in_aliased_module_method):
- add a test case for [ruby-dev:46028], which fails in 1.8.
-
-Sat Aug 4 01:56:06 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_insnhelper.c (vm_search_normal_superclass): no longer needs
- receiver, klass is always unique in the ancestors now.
-
-Sat Aug 4 01:27:40 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * insns.def (invokesuper): reverted r36612 so that super in an
- aliased method will not call the same method.
-
-Fri Aug 3 19:26:10 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * insns.def (invokesuper): don't skip the same class. instead, use
- rb_method_entry_get_with_omod() to avoid infinite loop when
- super is used with refinements. [ruby-core:30450] [Bug #3351]
-
-Fri Aug 3 19:21:19 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in: use clang prior to gcc only when self-compiling on
- darwin. search default compilers on other platforms. [Bug #6816]
-
-Fri Aug 3 17:25:49 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * configure.in: move RUBY_MINGW32 after AC_PROG_CC.
- RUBY_MINGW32 uses AC_TRY_CPP and it sets CC and CPP. [Bug #6816]
-
- * configure.in: don't use AC_PROG_CC in AS_CASE.
-
-Fri Aug 3 17:21:52 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/runner.rb: get rid of loading previously installed gems.
- [ruby-dev:46025]
-
-Fri Aug 3 16:40:01 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
+ * io.c (rb_io_s_pipe): Close pipes if io_encoding_set() raises an
+ exception.
+ (io_encoding_set_v): New function.
- * .travis.yml (notifications): [experimental] IRC notifications.
+Thu May 29 19:42:49 2014 Tanaka Akira <akr@fsij.org>
-Thu Aug 2 20:32:29 2012 Shugo Maeda <shugo@ruby-lang.org>
+ * lib/csv.rb (CSV.open): Close the opened file when an exception
+ occur.
- * eval.c (rb_mod_using): new method Module#using. [experimental]
+Thu May 29 19:31:10 2014 Tanaka Akira <akr@fsij.org>
- * eval.c (rb_mod_refine): new method Module#refine. [experimental]
+ * ext/openssl/lib/openssl/ssl.rb (SSLServer#accept): Close a socket
+ if any exception occur.
- * eval.c (f_using): new method Kernel#using. [experimental]
+Thu May 29 05:05:29 2014 Eric Wong <e@80x24.org>
-Thu Aug 2 20:08:02 2012 Shugo Maeda <shugo@ruby-lang.org>
+ * include/ruby/ruby.h: Hide Symbol internals.
+ (struct RSymbol): moved to internal.h
+ (RSYMBOL): ditto
- * class.c, insns.def, method.h, proc.c, vm.c, vm_core.h, vm_eval.c,
- vm_insnhelper.c, vm_insnhelper.h, vm_method.c: add klass to
- rb_control_frame_t to implement super correctly.
+Thu May 29 00:28:56 2014 Tanaka Akira <akr@fsij.org>
-Thu Aug 2 13:23:08 2012 NARUSE, Yui <naruse@ruby-lang.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.
- * configure.in (AC_PROG_CC): AC_PROG_CC tries clang at first on
- darwin. [Bug #6816]
+Wed May 28 23:04:35 2014 Tanaka Akira <akr@fsij.org>
-Thu Aug 2 11:39:25 2012 Narihiro Nakamura <authornari@gmail.com>
+ * test/ruby/test_io.rb (test_flush_in_finalizer1): Use
+ ObjectSpace.each_object to close files.
+ GC.start is not reliable.
- * gc.c: return true or false. Patch by Dirkjan Bussink. [Bug #6821]
+Wed May 28 19:00:31 2014 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_gc.rb: add test-case for this bug.
+ * 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.
-Thu Aug 2 10:51:12 2012 Martin Bosslet <Martin.Bosslet@gmail.com>
+Wed May 28 18:06:13 2014 Tanaka Akira <akr@fsij.org>
- * ext/openssl/lib/openssl/digest.rb
- test/openssl/test_digest.rb: Add Digest module function to OpenSSL
- module and test it. Patch provided by Eric Hodel.
- [ruby-core:46908][Feature #6819]
+ * 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 Aug 1 22:29:12 2012 Benoit Daloze <eregontp@gmail.com>
+Wed May 28 10:29:28 2014 Eric Wong <e@80x24.org>
- * ext/digest/digest.c (hexencode_str_new): return an ASCII string
+ * 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
- * test/digest: tests for all kind of digests encodings
- [ruby-core:46792][Bug #6799]
+Wed May 28 09:30:51 2014 Eric Wong <e@80x24.org>
-Wed Aug 1 05:50:53 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+ * 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]
- * test/ruby/test_rubyoptions.rb (TestRubyOptions#test_encoding):
- Fix test_encoding failure on Windows.
- With chcp 65001, 1252 and 437, test_encoding failed. Test result
- depends on locale because LANG environment variable doesn't affect
- locale on Windows.
- [ruby-core:46872] [Bug #6813]
+Wed May 28 01:02:54 2014 Tanaka Akira <akr@fsij.org>
-Wed Aug 1 00:33:19 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/tempfile.rb (Tempfile#inspect): Show "(closed)" if the tempfile
+ is closed.
- * class.c (include_class_new): fix duplication of prepended module.
- since m_tbl of prepended module is always zero, copy from its
- copy iclass of original.
+Wed May 28 00:38:09 2014 Tanaka Akira <akr@fsij.org>
-Tue Jul 31 18:22:34 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/lib/minitest/unit.rb: Use Tempfile#close! instead of
+ Tempfile#unlink to close file descriptors.
- * variable.c (classname): tell if found name is permanent. search
- tmp_classpath only if class id is set. [ruby-core:42865][Bug #6078]
+ * test/openssl/test_config.rb: Ditto.
- * variable.c (rb_class_path): duplicate found temporary path.
+ * test/ruby/test_io.rb: Ditto.
- * variable.c (rb_set_class_path_string, rb_set_class_path): set class
- id to find classpath.
+Wed May 28 00:06:18 2014 Tanaka Akira <akr@fsij.org>
-Tue Jul 31 10:36:12 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+ * lib/net/ftp.rb (transfercmd): Close TCP server socket even if an
+ exception occur.
- * ext/psych/lib/psych.rb: updated to released version.
+Tue May 27 23:50:07 2014 Tanaka Akira <akr@fsij.org>
- * ext/psych/psych.gemspec: ditto
+ * lib/cgi/core.rb: Use Tempfile#close! instead of Tempfile#unlink
+ to close file descriptors.
-Tue Jul 31 06:18:06 2012 Eric Hodel <drbrain@segment7.net>
+Tue May 27 23:06:46 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * time.c (time_sec): Remove extra wording about leap seconds and refer
- directly to Wikipedia's leap second page for further information.
- [Bug #6749]
+ * parse.y (parser_number_literal_suffix): refine error message for
+ extra dot and digits.
-Mon Jul 30 23:01:47 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Tue May 27 22:44:20 2014 Tanaka Akira <akr@fsij.org>
- * lib/rubygems/platform.rb (Gem::Platform#initialize): Support pattern
- like x86_64-netbsd6.99.7.
+ * test/rexml: Avoid fd leaks.
-Mon Jul 30 21:00:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue May 27 22:24:25 2014 Kouhei Sutou <kou@cozmixng.org>
- * variable.c (find_class_path): no retry when preferred is given.
+ * test/rexml/test_document.rb: Indent.
- * variable.c (classname): if classid is set try it to find full
- qualified class path, and then try arbitrary class path. try
- tmp_classpath at last even if enclosing namespace is anonymous.
- fix r36574. [ruby-core:42865][Bug #6078]
+Tue May 27 22:15:29 2014 Kouhei Sutou <kou@cozmixng.org>
- * variable.c (rb_set_class_path_string, rb_set_class_path): set
- tmp_classpath instead of classpath if the name is not permanent.
+ * test/rexml/test_document.rb: Wrap by REXMLTests module.
-Mon Jul 30 14:24:20 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue May 27 22:11:10 2014 Kouhei Sutou <kou@cozmixng.org>
- * variable.c: store anonymous class path in tmp_classpath but not in
- classpath. [ruby-core:42865][Bug #6078]
+ * test/rexml/test_encoding_2.rb: Remove a needless file.
-Mon Jul 30 13:11:54 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue May 27 22:10:30 2014 Kouhei Sutou <kou@cozmixng.org>
- * configure.in (DLDFLAGS): on Darwin, deprecate -flat_namespace to get
- rid of huge imported symbols table.
+ * test/rexml/test_contrib.rb: Indent.
- * configure.in (LIBRUBY_RELATIVE): libruby_so is not made when
- disable-shared, so no absolute path is used for it and executable
- file is runnable anywhere.
+Tue May 27 21:28:16 2014 NARUSE, Yui <naruse@ruby-lang.org>
-Mon Jul 30 01:30:10 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+ * ext/socket/ifaddr.c (ifaddr_inspect_flags): support IFF_SIMPLEX.
- * common.mk: add a dependency. [ruby-core:46741] [Bug #6789]
+Tue May 27 21:03:03 2014 Kouhei Sutou <kou@cozmixng.org>
-Sun Jul 29 15:44:47 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.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.
- * thread.c (thread_create_core): hide th->async_errinfo_mask_stack from
- ObjectSpace.each_object. refix of r36539.
+Tue May 27 20:59:37 2014 Kouhei Sutou <kou@cozmixng.org>
-Sun Jul 29 23:57:27 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/rexml/test_comment.rb: Remove needless REXML module wrapping.
- * ext/socket/option.c (inet_ntop): use rb_w32_inet_ntop, instead of
- inet_ntop directly, which is unavailable on older version Windows.
+Tue May 27 20:56:49 2014 Kouhei Sutou <kou@cozmixng.org>
- * win32/win32.c (rb_w32_inet_ntop): type should be const.
+ * test/openssl/test_pkcs7.rb: Fix inverted expected and actual values.
-Sun Jul 29 14:20:34 2012 Kazuki Tsujimoto <kazuki@callcc.net>
+Tue May 27 20:26:06 2014 NAKAMURA Usaku <usa@ruby-lang.org>
- * thread.c (Init_Thread): does not need to set klass
- explicitly.
+ * test/ruby/test_io.rb (test_flush_in_finalizer1): some opened fds are
+ remain before GC, so unlink the tempfile is failed.
-Sun Jul 29 06:21:04 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+Tue May 27 19:07:26 2014 Tanaka Akira <akr@fsij.org>
- * win32/win32.c: suppress warning redeclared on mingw64.
- *_s functions are declared if MINGW_HAS_SECURE_API is defined.
- Follow up r36556.
+ * io.c (rb_io_autoclose_p): Don't raise on frozen IO.
-Sun Jul 29 00:28:46 2012 Narihiro Nakamura <authornari@gmail.com>
+ * test/lib/minitest/unit.rb: IO#autoclose? may raise IOError.
- * gc.c: remove unused initialization.
+Tue May 27 19:01:49 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Sat Jul 28 16:26:09 2012 Hiroshi Shirosaki <h.shirosaki@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.
- * win32/win32.c (gmtime_r): use _gmtime64_s() with x86_64-w64-mingw32.
+Tue May 27 18:46:23 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * win32/win32.c (localtime_r): use _localtime64_s() with
- x86_64-w64-mingw32. Since FileTimeToSystemTime() seems not work with
- large value under x64. Mingw-w64 doesn't have these declaration.
- [ruby-core:46780] [Bug #6794]
+ * test/openssl/test_pkcs7.rb: Add tests for PKCS7#type= and add_data.
+ [Feature #7399][ruby-core:49565]
-Fri Jul 27 18:25:51 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue May 27 17:45:09 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * io.c (rb_io_check_io): make public.
+ * test/openssl/test_hmac.rb (test_binary_update): Added Test for
+ HMAC signing with UTF-8 String. [Bug #7512][ruby-core:50559]
- * process.c (check_exec_redirect): try conversion to IO on redirect
- parameters. [ruby-core:44181] [Bug #6269]
+Tue May 27 17:10:14 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Fri Jul 27 17:58:12 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/runner.rb: fixed randomly test failure.
+ [Bug #6573][ruby-core:45563]
- * configure.in (RUBY_CPPOUTFILE): get rid of variable conflict so
- CPPFLAGS is not duplicated. [ruby-core:43097] [Bug #6119]
+Tue May 27 16:58:12 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Fri Jul 27 12:12:36 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * test/test_timeout.rb (test_timeout): inverted test condition.
+ [Bug #8523]
- * win32/mkexports.rb: should not export DllMain().
- reported by luis at [ruby-core:46743] [Bug #6790], solved by
- Heesob Park, and confirmed by nobu.
+Tue May 27 12:24:22 2014 Tanaka Akira <akr@fsij.org>
-Thu Jul 26 14:51:29 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
+ * test/lib/minitest/unit.rb: Show leaked file descriptors.
- * test/net/http/test_https.rb (TestNetHTTPS#test_session_reuse):
- localhost is not (always) 127.0.0.1. Don't expect that.
+Tue May 27 11:12:56 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Jul 26 07:18:38 2012 <kanemoto@ruby-lang.org>
+ * io.c (rb_io_fileno, rb_io_inspect): non-modification does not
+ error on frozen IO. [ruby-dev:48241] [Bug #9865]
- * ext/json/fbuffer/fbuffer.h: avoid compilation error on AIX by
- -ansi -std=iso9899:199409 (r36038). [ruby-core:46744] [Bug #6791].
+Tue May 27 00:00:21 2014 yui-knk <spiketeika@gmail.com>
-Thu Jul 26 00:42:23 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+ * insns.def (defineclass): fix typo in the instruction comment.
+ [fix GH-618]
- * thread.c (thread_create_core, Init_Thread): hide
- th->async_errinfo_queue and th->async_errinfo_mask_stack from
- ObjectSpace.each_object.
+Mon May 26 16:33:15 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-Wed Jul 25 17:41:05 2012 Nobuyoshi Nakada <nobu@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
- * complex.c, rational.c: compatible marshal loader for compatibilities
- with 1.8. [ruby-core:45775] [Bug #6625]
+Mon May 26 12:25:36 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Jul 25 17:17:05 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/optionparser.rb, lib/optparse.rb (OptParse): aliases.
+ [ruby-core:62751] [Feature #9864]
- * atomic.h: prefer GCC atomic builtins than Windows APIs, if possible,
- since they are generic.
+Mon May 26 07:59:34 2014 Tanaka Akira <akr@fsij.org>
-Wed Jul 25 11:16:57 2012 Eric Hodel <drbrain@segment7.net>
+ * test/lib/minitest/unit.rb: Show Finished threads line-by-line.
- * lib/net/.document: Removed. All files in net/ should be included in
- RDoc.
+Mon May 26 01:39:02 2014 Zachary Scott <e@zzak.io>
-Wed Jul 25 10:00:23 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * lib/csv.rb: Reject nil as data source for CSV.new, patch by @Peeja.
+ [Fixes GH-580] https://github.com/ruby/ruby/pull/580
- * test/testunit/test_redefinition.rb: broken class/method names.
+Mon May 26 01:07:51 2014 Tanaka Akira <akr@fsij.org>
-Wed Jul 25 09:26:32 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * test/lib/minitest/unit.rb: Show leaked threads and tempfiles
+ line-by-line.
- * lib/cgi/html.rb: Use << instead of +=.
- `a += b` is syntax sugar of `a = a + b`; it creates a new string
- object. `a << b` is concatenation and doesn't create new object.
+Sun May 25 23:02:06 2014 Tanaka Akira <akr@fsij.org>
-Wed Jul 25 09:16:26 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * test/lib/minitest/unit.rb (MiniTest::Assertions#diff): Remove
+ tempfiles.
- * lib/cgi/html.rb (element_init): suppress redefine warning.
- Don't define methods if they are already defined.
+Sun May 25 22:42:27 2014 Tanaka Akira <akr@fsij.org>
-Wed Jul 25 09:05:38 2012 Eric Hodel <drbrain@segment7.net>
+ * test/lib/minitest/unit.rb: Check tempfile leak for each test class.
- * lib/net/http.rb: Added SSL session reuse across connections for a
- single instance to speed up connection. [Feature #5341]
- * NEWS: ditto
- * test/net/http/test_https.rb: Tests for #5341
+Sun May 25 20:31:49 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Jul 25 06:54:24 2012 Eric Hodel <drbrain@segment7.net>
+ * 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.
- * doc/re.rdoc: Fix spelling
+Sun May 25 20:00:23 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Jul 25 06:49:12 2012 Eric Hodel <drbrain@segment7.net>
+ * 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]
- * re.c (rb_reg_s_last_match): Update $~ to reference Regexp
- documentation about "special global variables". [Bug #6723]
+Sun May 25 17:09:13 2014 Tanaka Akira <akr@fsij.org>
-Wed Jul 25 06:28:56 2012 Eric Hodel <drbrain@segment7.net>
+ * test/lib/minitest/unit.rb: Less ObjectSpace.each_object(Tempfile)
+ invocation.
- * iseq.c: Added documentation. Patch by David Albert. [Bug #6785]
+Sun May 25 16:54:06 2014 Tanaka Akira <akr@fsij.org>
-Wed Jul 25 03:05:06 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+ * test/lib/minitest/unit.rb: Use Thread.list instead of
+ ObjectSpace.each_object(Thread).
- * parse.y: added symbols and qsymbols productions for %i and %I
- support. %i{ .. } returns a list of symbols without interpolation,
- %I{ .. } returns a list of symbols with interpolation. Thanks to
- Josh Susser for inspiration of this feature. [Feature #4985]
+Sun May 25 15:53:54 2014 Tanaka Akira <akr@fsij.org>
- * ext/ripper/eventids2.c: added ripper events for %i and %I.
+ * lib/rinda/ring.rb (Rinda::RingServer#shutdown): Join the killed
+ threads.
- * test/ripper/test_parser_events.rb: ripper tests
+Sun May 25 15:26:17 2014 Tanaka Akira <akr@fsij.org>
- * test/ripper/test_scanner_events.rb: ditto
+ * lib/webrick/utils.rb: Override the inspect method of the thread
+ used in WEBrick::Utils::TimeoutHandler.
- * test/ruby/test_array.rb: test for %i and %I behavior
+Sun May 25 14:22:30 2014 Tanaka Akira <akr@fsij.org>
-Tue Jul 24 23:34:43 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+ * test/openssl: Join threads.
- * include/ruby/win32.h (rb_w32_pow): add new function.
- We use powl() instead of broken pow() for x64-mingw32. This workaround
- fixes test failures related to floating point numeric.
- [ruby-core:46686] [Bug #6784]
+Sun May 25 12:46:47 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Jul 24 15:01:24 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * error.c (rb_bug_context): new function to report bug with
+ context.
- * win32/win32.c (rb_w32_socket, rb_w32_socketpair): remember the family
- in the high word of socklist value.
+ * vm_dump.c (rb_vm_bugreport): accepts `ucontext_t` argument to
+ dump machine registers. based on [GH-584].
- * win32/win32.c (overlapped_socket_io, recvmsg, sendmsg, setfl): follow
- above changes.
+ * signal.c (sigbus, sigsegv): dump machine registers if available.
- * win32/win32.c (rb_w32_getsockname): set remembered family to the
- argument when OS's function fails.
+Sun May 25 12:32:42 2014 Tanaka Akira <akr@fsij.org>
-Tue Jul 24 12:35:13 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * test/lib/minitest/unit.rb: Sort leaked threads and tempfiles.
- * test/ruby/test_dir_m17n.rb: remove a garbage.
+Sun May 25 12:15:30 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/ruby/test_dir_m17n.rb: convert from ascii-8bit to other encoding
- with 8bit bytes always fails.
+ * signal.c (check_stack_overflow): fix condition to use ucontext
+ register, mcontext_t dereference, and its member names, on Mac
+ OS X.
-Tue Jul 24 12:32:18 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Sun May 25 11:58:26 2014 Zachary Scott <e@zzak.io>
- * test/ruby/test_dir_m17n.rb: sorry, typo.
+ * enumerator.c: [DOC] Fix example to show Enumerator#peek behavior
+ Patch by Erik Hollembeak [Bug #9814]
-Tue Jul 24 12:13:26 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Sun May 25 11:56:33 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/ruby/test_dir_m17n.rb: refactoring. RE should be in the left side
- of the =~ operator, and compare the result with nil is meaningless.
+ * 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]
-Tue Jul 24 11:35:20 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Sun May 25 11:32:42 2014 Zachary Scott <e@zzak.io>
- * test/ruby/test_pack.rb (test_pack_unpack_M): was redefined
- accidentally.
+ * lib/yaml.rb: Remove Psych::EngineManager [Bug #8344]
+ * test/psych/*: ditto.
-Tue Jul 24 09:31:18 2012 Eric Hodel <drbrain@segment7.net>
+Sun May 25 10:34:15 2014 Zachary Scott <e@zzak.io>
- * lib/rubygems: Updated to RubyGems 1.8.24, a bugfix release.
+ * doc/regexp.rdoc: [DOC] Clarify whitespace matching by @allolex
+ [Fixes GH-606] https://github.com/ruby/ruby/pull/606
-Tue Jul 24 08:30:15 2012 Luis Lavena <luislavena@gmail.com>
+Sun May 25 10:19:34 2014 Zachary Scott <e@zzak.io>
- * test/ruby/test_dir_m17n.rb (create_and_check_raw_file_name): add new
- helper method to ease encoding testing. Patch by Oleg Sukhodolsky.
- [ruby-core:46589][Bug #6765]
+ * enum.c: [DOC] Use #find in example to clarify alias by @rachellogie
+ Patch submitted via documenting-ruby/ruby#34
- * test/ruby/test_dir_m17n.rb (test_filename_extutf8): use filesystem
- encoding when reading entries and comparing.
+Sun May 25 10:16:43 2014 Zachary Scott <e@zzak.io>
- * test/ruby/test_dir_m17n.rb (test_filename_utf8_raw_name): removed.
+ * cont.c: [DOC] Fix rdoc in example for Fiber#transfer by @majjoha
+ Patch submitted via documenting-ruby/ruby#33
- * test/ruby/test_dir_m17n.rb (test_filename_utf8_raw_jp_name): split test.
+Sun May 25 10:01:11 2014 Zachary Scott <e@zzak.io>
-Tue Jul 24 08:09:30 2012 Luis Lavena <luislavena@gmail.com>
+ * lib/irb.rb: [DOC] Fixed syntax error in example by @jasdeepsingh.
+ Patch submitted via documenting-ruby/ruby#32
- * test/win32ole/test_win32ole_method.rb (is_ruby64?): Correct platform
- used to identify mingw-w64 (x64-mingw32). Patch by Hiroshi Shirosaki.
- [ruby-core:46651][Bug #6782]
+Sun May 25 09:58:02 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Tue Jul 24 07:22:58 2012 Eric Hodel <drbrain@segment7.net>
+ * test/fileutils/test_fileutils.rb (test_chown_R): Add tests for
+ chown_R. [Feature #9383][ruby-core:59641]
- * time.c (time_sec): Updated description of leap seconds for accuracy.
- Based on patch by Marcus Stollsteimer. [Bug #6749]
+Sun May 25 09:57:09 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Tue Jul 24 07:03:11 2012 Eric Hodel <drbrain@segment7.net>
+ * test/fileutils/test_fileutils.rb: Added recursively chown tests.
+ [Feature #9303][ruby-core:59325]
- * string.c (rb_str_sub): Fixed wording of documentation to match the
- replacement operation. Minor cleanup of markup. [Bug #6719]
- * string.c (rb_str_sub_bang): Minor wording change for clarity, minor
- cleanup of markup.
+Sun May 25 09:41:56 2014 Zachary Scott <e@zzak.io>
-Mon Jul 23 23:58:40 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * class.c: [DOC] Fixed grammar and examples of instance_methods.
+ By @alex-frost via documenting-ruby/ruby#31
- * enc/Makefile.in (TARGET_NAME, TARGET_ENTRY): needed for EXTDLDFLAGS
- on some platforms. [ruby-core:46600] [Bug #6768]
+Sun May 25 09:40:44 2014 Tanaka Akira <akr@fsij.org>
- * enc/depend: no longer needs tweaking DLDFLAGS for TARGET names.
+ * test/lib/minitest/unit.rb: Show leaked threads and tempfiles.
-Mon Jul 23 22:48:19 2012 Tanaka Akira <akr@fsij.org>
+Sun May 25 08:54:38 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * lib/open-uri.rb: use respond_to? to test Tempfile.
- [ruby-dev:45995] [Bug #6781] reported by hsbt (Hiroshi SHIBATA).
+ * test/openssl/test_partial_record_read.rb: Testing read_nonblock on
+ a partial TLS record results in IO::WaitReadable by @mohamedhafez.
+ [fix GH-547]
-Mon Jul 23 14:43:34 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun May 25 08:43:16 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * configure.in (LIBPATHENV): LIBPATH is used on AIX, but not
- SHLIB_PATH which was carelessly copied from HP/UX. suggested by
- Perry Smith at [ruby-core:46397]. [Bug #6728]
+ * lib/logger.rb: refactored to include Logger::Period.
-Mon Jul 23 01:55:08 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+Sun May 25 06:50:19 2014 Zachary Scott <e@zzak.io>
- * test/uri/test_generic.rb (URI#test_find_proxy): add tests with
- empty *_proxy env variables.
+ * vm_eval.c: [DOC] Improve instance_eval description when given a
+ block or String arguments. By @nathanl via documenting-ruby/ruby#28
-Mon Jul 23 01:47:26 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+Sun May 25 06:29:39 2014 Zachary Scott <e@zzak.io>
- * test/uri/test_generic.rb (URI#with_env): unset proxy related env
- variables. [Bug #6774]
+ * array.c: [DOC] Clarify default argument for Array.new.
+ By @Elffers [Fixes GH-610]
- * test/uri/test_generic.rb (URI#test_find_proxy): fix failures
- when proxy related env variables already set. [Bug #6774]
+Sat May 24 22:37:20 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Sun Jul 22 23:58:48 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * array.c: [DOC] Add more documents to shuffle! and shuffle.
+ Contributed by @JuanitoFatas [ci skip][fix GH-612]
- * thread.c (rb_threadptr_execute_interrupts_common): increase
- running_time_us on THREAD_TO_KILL like on THREAD_RUNNABLE.
- This cause not to switch from a thread which is to be killed
- on FreeBSD and Mac OS X. see also the test.
- This issue maybe exist for long time but happens after r36430.
+Sat May 24 22:28:55 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Sat Jul 21 06:21:45 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * test/lib/minitest/.document: removed unused configuration.
- * lib/net/http.rb: fixes for r36476. [Feature #6546]
- http://u64.rubyci.org/~chkbuild/ruby-trunk/log/20120720T030101Z.diff.html.gz
+Sat May 24 19:08:47 2014 Tanaka Akira <akr@fsij.org>
- * lib/net/http.rb (Net::HTTP.newobj): return back for compatibility.
+ * test/lib/minitest/spec.rb: Unused file removed.
- * lib/net/http.rb (Net::HTTP.new): set default_port if proxy port is
- not given.
+ * test/lib/minitest/autorun.rb: Don't require minitest/spec.
- * lib/net/http.rb (Net::HTTP#initialize): ditto.
+ * test/lib/minitest/benchmark.rb: Ditto.
- * lib/net/http.rb (Net::HTTP#proxy?): return true or false.
+Sat May 24 18:45:30 2014 Tanaka Akira <akr@fsij.org>
- * lib/net/http.rb (Net::HTTP#proxy_address): check proxy_uri is not nil.
+ * test/benchmark/test_benchmark.rb: Use test/unit.
- * lib/net/http.rb (Net::HTTP#proxy_port): ditto.
+Sat May 24 16:20:59 2014 Eric Wong <e@80x24.org>
-Sat Jul 21 23:12:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * process.c (proc_getgroups, proc_setgroups): use ALLOCV_N
+ [Bug #9856]
- * thread_pthread.c (ruby_init_stack): STACK_GROW_DIR_DETECTION is
- necessary on platforms with unknown stack direction. [Bug #6761]
+Sat May 24 15:49:39 2014 Tanaka Akira <akr@fsij.org>
-Sat Jul 21 15:13:42 2012 Shota Fukumori <sorah@tubusu.net>
+ * 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]
- * lib/test/unit/testcase.rb (method_added): refactoring.
+ * test/lib/minitest/parallel_each.rb: Removed.
-Sat Jul 21 14:06:41 2012 Shota Fukumori <sorah@tubusu.net>
+ * test/minitest/test_minitest_mock.rb: Don't call parallelize_me!.
- * lib/test/unit/testcase.rb: warn when test_* method is redefined.
- Patch by mame (Yusuke Endoh). [Feature #2643] [ruby-core:27790]
+ * test/minitest/test_minitest_spec.rb: Ditto.
- * test/testunit/test_redefinition.rb: Test for above.
+ * test/minitest/test_minitest_unit.rb: Ditto.
+ Tests for parallel feature removed.
- * test/testunit/test4test_redefinition.rb: Ditto.
+Sat May 24 15:29:10 2014 Tanaka Akira <akr@fsij.org>
-Sat Jul 21 08:41:14 2012 Eric Hodel <drbrain@segment7.net>
+ * test/lib/minitest/hell.rb: Unused file removed.
- * lib/logger.rb: Updated example in Logger comment to match other
- examples and fixed a bug. Patch by Marcus Stollsteimer.
- [Bug #6759]
+ * test/lib/minitest/pride.rb: Ditto.
-Fri Jul 20 17:20:54 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat May 24 15:05:32 2014 yui-knk <spiketeika@gmail.com>
- * random.c (rb_random_real): refine error message.
+ * enumerator.c (yielder_yield_push): Insert a break after the
+ method return value. [fix GH-617]
-Fri Jul 20 11:03:17 2012 Eric Hodel <drbrain@segment7.net>
+Sat May 24 14:59:12 2014 Tanaka Akira <akr@fsij.org>
- * NEWS: Updated net/http for automatic proxy detection (#6546) and
- automatic gzip and deflate compression (#6492, #6494).
+ * test/lib/minitest: Remove comments not appropriate now.
-Fri Jul 20 10:55:38 2012 Eric Hodel <drbrain@segment7.net>
+ * test/minitest: Ditto.
- * lib/net/http.rb: Net::HTTP now automatically detects and uses
- proxies from the environment. A proxy may also be specified as
- before.
+Sat May 24 14:02:04 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- Net::HTTP::Proxy still creates anonymous classes, but these classes
- are only used to store configuration information. When an HTTP
- instance is created the configuration is now copied.
+ * NEWS: added minitest changes.
- Additionally, Net::HTTP::ProxyDelta is no longer used by Net::HTTP
+Sat May 24 13:42:46 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- [Feature #6546]
- * lib/open-uri.rb: Moved URI::Generic#find_proxy to uri/generic.
- * lib/uri/generic.rb: Imported find_proxy from open-uri.
- * test/open-uri/test_open-uri.rb: Moved proxy-discovery tests to URI.
- * test/uri/test_generic.rb: Imported proxy-discovery tests from
- open-uri.
- * test/net/http/test_http.rb: Added tests for proxy behavior.
+ * test/lib/test/unit/test-unit.gemspec: removed needless gemspec file.
-Fri Jul 20 09:34:11 2012 Eric Hodel <drbrain@segment7.net>
+Sat May 24 09:39:06 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * test/socket/test_socket.rb: Ignore IPv6 unique local addresses on OS
- X (iCloud Back to my Mac addresses) for test_udp_socket since they do
- not act as loopback addresses. [Bug #6692]
+ * defs/default_gems: removed minitest entry.
-Fri Jul 20 09:32:14 2012 Eric Hodel <drbrain@segment7.net>
+Sat May 24 06:17:33 2014 Ryan Davis <ryand-ruby@zenspider.com>
- * ext/socket/raddrinfo.c (addrinfo_ipv6_unique_local_p): Added
- Addrinfo#ipv6_unique_local? to detect RFC 4193 unique local
- addresses. Part of #6692
- * ext/socket/rubysocket.h: Add IN6_IS_ADDR_UNIQUE_LOCAL macro if
- missing.
- * test/socket/test_addrinfo.rb: Test for ipv6_unique_local?
+ * lib/minitest: minitest 4.7.5 removed. Need to support proper
+ gem packaging / installation before minitest 5 can be added.
-Fri Jul 20 07:40:32 2012 Eric Hodel <drbrain@segment7.net>
+Sat May 24 05:54:06 2014 Tanaka Akira <akr@fsij.org>
- * lib/net/http/response.rb: Automatically inflate gzip and
- deflate-encoded response bodies. [Feature #6942]
- * lib/net/http/generic_request.rb: Automatically accept gzip and
- deflate content-encoding for requests. [Feature #6494]
- * lib/net/http/request.rb: Updated documentation for #6494.
- * lib/net/http.rb: Updated documentation for #6492 and #6494, removed
- Content-Encoding handling now present in Net::HTTPResponse.
- * test/net/http/test_httpresponse.rb: Tests for #6492
- * test/net/http/test_http_request.rb: Tests for #6494
- * test/open-uri/test_open-uri.rb (test_content_encoding): Updated test
- for automatic content-encoding handling.
+ * ext/socket/mkconstants.rb: More constants
-Fri Jul 20 03:42:54 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Sat May 24 00:25:34 2014 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
- * thread_pthread.c: use #ifdef, not #if.
+ * NEWS: add information of incompatibility about Prime.prime?
+ * lib/prime.rb: fix docs.
-Thu Jul 19 15:08:40 2012 Koichi Sasada <ko1@atdot.net>
+Fri May 23 21:36:28 2014 Josh Goebel <dreamer3@gmail.com>
- * thread.c (rb_thread_s_control_interrupt,
- rb_thread_s_check_interrupt): added for
- Thread.control_interrupt and Thread.check_interrupt.
- See details on rdoc.
- I'll make an ticket for this feature.
+ * 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]
- * test/ruby/test_thread.rb: add a test for Thread.control_interrupt.
+Fri May 23 03:48:08 2014 Eric Wong <e@80x24.org>
- * thread.c (rb_threadptr_raise): make a new exception object
- even if argc is 0.
+ * gc.c (rb_free_m_tbl): mark function as static
- * thread.c (rb_thread_kill): kill thread immediately if target thread
- is current thread.
+ * method.h (rb_free_m_tbl): remove prototype
- * vm_core.h (RUBY_VM_CHECK_INTS_BLOCKING): added.
- CHECK_INTS while/after blocking operation.
+Thu May 22 22:58:27 2014 Tanaka Akira <akr@fsij.org>
- * vm_core.h (RUBY_VM_CHECK_INTS): require rb_thread_t ptr.
+ * ext/socket/mkconstants.rb: More TCP option constants.
+ Describe Linux and glibc versions.
- * cont.c (fiber_switch): use replaced RUBY_VM_CHECK_INTS().
+Thu May 22 20:38:10 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * eval.c (ruby_cleanup): ditto.
+ * file.c (stat_birthtime): add birthtime support [Feature #9647]
- * insns.def: ditto.
+ * file.c (rb_stat_birthtime): add File::Stat.birthtime
- * process.c (rb_waitpid): ditto.
+ * file.c (rb_file_s_birthtime): add File.birthtime
- * vm_eval.c (vm_call0): ditto.
+ * file.c (rb_file_birthtime): add File#birthtime
- * vm_insnhelper.c (vm_call_method): ditto.
+ * configure.in: check struct stat.st_birthtimespec.
-Thu Jul 19 22:46:48 2012 Tanaka Akira <akr@fsij.org>
+Thu May 22 19:38:14 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * test/ruby/test_io.rb: remove temporally files early.
+ * file.c: remove IO::Statfs because of reject. [Feature #9772]
-Thu Jul 19 15:38:35 2012 Shugo Maeda <shugo@ruby-lang.org>
+Thu May 22 14:02:13 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * variable.c (rb_mod_class_variables): return inherited variables
- except when the optional argument is set to false.
- [ruby-dev:44034] [Bug #4971]
+ * enc/jis/props.kwd: constify character property tables of JIS
+ based encodings by perfect hash.
- * variable.c (rb_mod_constants): fix typo in documentation.
+ * enc/euc_jp.c, enc/shift_jis.c: use character property functions.
-Thu Jul 19 14:30:43 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed May 21 12:21:10 2014 Tanaka Akira <akr@fsij.org>
- * internal.h: move mark function declarations that should be private.
+ * ext/socket/option.c: Fix compilation error on Android.
+ Bionic doesn't define TCP state constants.
-Thu Jul 19 14:18:22 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Wed May 21 11:42:31 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/socket/init.c (rsock_init_sock): need to update max fd on all
- platforms.
+ * configure.in: workaround for Info.plist to get rid of `dsymutil`
+ crash by wrong files in parent directories.
+ [ruby-core:62594] [Bug #9840]
-Thu Jul 19 14:15:48 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue May 20 20:57:34 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * thread.c (rb_gc_mark_threads): remove deprecated function.
+ * test/ruby/test_dir.rb (test_glob): added testcase of double
+ slash path.
-Thu Jul 19 13:28:03 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Tue May 20 04:58:54 2014 Tanaka Akira <akr@fsij.org>
- * test/net/http/test_http.rb (TestNetHTTPLocalBind#test_bind_to_local*):
- re-enable the tests because now it's OK on windows.
+ * ext/socket/extconf.rb: Don't check fields of struct tcp_info if the
+ structure is not available.
-Thu Jul 19 13:26:25 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Mon May 19 23:13:33 2014 Tanaka Akira <akr@fsij.org>
- * ext/socket/extconf.rb: now enable IPv6 by default on mswin.
+ * 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.)
-Thu Jul 19 09:33:46 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+Mon May 19 20:49:07 2014 Tanaka Akira <akr@fsij.org>
- * ext/psych/emitter.c (initialize): allow a configuration object to be
- passed to the constructor so that mutation isn't required after
- instantiation.
+ * ext/socket/option.c (inspect_tcp_info): New function to inspect
+ struct tcp_info.
+ (sockopt_inspect): Use inspect_tcp_info.
- * ext/psych/lib/psych/handler.rb: add configuration object
+ * ext/socket/extconf.rb: Check tcp_info related things.
- * ext/psych/lib/psych/visitors/emitter.rb: use configuration object if
- extra configuration is present.
+ * ext/socket/rubysocket.h: Include netinet/tcp_fsm.h if available.
-Thu Jul 19 08:20:25 2012 Tanaka Akira <akr@fsij.org>
+Mon May 19 19:36:39 2014 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_file.rb: remove temporally files early.
+ * test/dbm/test_dbm.rb: Use Etc.uname.
-Thu Jul 19 07:37:41 2012 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+ * test/gdbm/test_gdbm.rb: Ditto.
- * test/drb/drbtest.rb: fixed: can't delete unix domain sockets problem.
+Mon May 19 16:54:22 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Jul 19 03:41:20 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * ext/etc/etc.c (etc_uname): add support for Windows using
+ GetVersionExW(), GetSystemInfo(), and GetComputerNameExW() with
+ `ComputerNameDnsHostname`. [Feature #9842]
- * bignum.c: Added #include <strings.h> for ffs(). Patch by Perry
- Smith. Thank you. [Bug #6748]
+Mon May 19 16:29:48 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Jul 19 01:56:02 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * string.c (rb_pat_search): advance by byte offset but not by char
+ offset. [ruby-core:62669] [Bug #9849]
- * include/ruby/intern.h (rb_num_zerodiv): Added NORETURN.
- Patched by Xi Wang. [Bug #6736]
+Mon May 19 14:06:18 2014 Shota Fukumori <her@sorah.jp>
-Wed Jul 18 23:57:38 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * bin/testrb: Removed. Forgot to remove in r45971.
+ [Feature #9711] [ruby-core:62620]
- * pack.c (pack_pack): round down too long uuencode width. folding
- width in uuencode format cannot be longer than 63 bytes.
+Sun May 18 16:42:08 2014 Tanaka Akira <akr@fsij.org>
-Wed Jul 18 23:04:18 2012 NARUSE, Yui <naruse@ruby-lang.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).
- * ext/dbm/dbm.c (fdbm_empty_p): fix wrong condition introduced in r36438.
+Sun May 18 12:15:54 2014 Jonathan Mukai-Heidt <johnnymukai@gmail.com>
- * ext/sdbm/init.c (fsdbm_empty_p): ditto.
+ * 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]
-Wed Jul 18 23:08:57 2012 Tanaka Akira <akr@fsij.org>
+Sun May 18 11:59:25 2014 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_beginendblock.rb: remove temporally files early.
+ * missing/nextafter.c: Include ruby/missing.h.
-Wed Jul 18 22:43:02 2012 Tanaka Akira <akr@fsij.org>
+Sun May 18 11:09:28 2014 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_autoload.rb: remove temporally files early.
+ * win32/Makefile.sub: Add nextafter.obj to MISSING.
-Wed Jul 18 21:59:46 2012 Tanaka Akira <akr@fsij.org>
+Sun May 18 10:46:04 2014 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_argf.rb: use temporally directory.
+ * ext/etc/etc.c: Etc.sysconf, Etc.confstr and IO#pathconf implemented.
-Wed Jul 18 19:41:19 2012 Tanaka Akira <akr@fsij.org>
+ * ext/etc/extconf.rb: Check sysconf(), confstr() and fpathconf().
- * test/openssl/test_config.rb: remove temporally files early.
+ * ext/etc/mkconstants.rb: New file.
-Wed Jul 18 17:45:26 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ [ruby-core:62600] [Feature #9842]
- * error.c (rb_builtin_type_name): map by index.
+Sun May 18 09:58:17 2014 Tanaka Akira <akr@fsij.org>
-Wed Jul 18 16:17:40 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/etc/etc.c: Etc.uname method implemented.
- * lib/mkmf.rb (have_framework): get rid of separating -framework
- option and its argument and dealing with the argument as a library
- or an object name. if $LDFLAGS were an array...
+ * ext/etc/extconf.rb: Check uname() function.
-Wed Jul 18 16:09:10 2012 Shugo Maeda <shugo@ruby-lang.org>
+ [ruby-core:62139] [Feature #9770]
- * ext/curses/extconf.rb: support PDCurses. patched by Luis Lavena.
- [ruby-core:46485] [Feature #6735]
+Sun May 18 09:16:33 2014 Tanaka Akira <akr@fsij.org>
-Wed Jul 18 15:50:25 2012 Shugo Maeda <shugo@ruby-lang.org>
+ * configure.in: Check nextafter() availability.
- * parse.y (primary): allow an empty grouped expression as the
- operand of the not operator (e.g., not ()).
- [ruby-core:45976] [Bug #6674]
+ * include/ruby/missing.h (nextafter): New optional declaration.
- * parse.y (parser_yylex): show no warning for a grouped expression
- as the operand of the not operator (e.g., not (a)) or as an
- argument of a method call without parentheses (e.g., foo (a)).
- [ruby-core:39050] [Bug #5214]
+ * missing/nextafter.c: New file.
-Wed Jul 18 15:33:21 2012 Koichi Sasada <ko1@atdot.net>
+ * numeric.c: Float#next_float and Float#prev_float implemented.
- * thread.c (rb_thread_call_without_gvl2): added.
- it can skip last CHECK_INTS. See document for more details.
- Document about it was updated a bit.
+ [ruby-core:62562] [Feature #9834]
- * include/ruby/thread.h (decl. of rb_thread_call_without_gvl2): added.
+Sun May 18 09:02:17 2014 Tanaka Akira <akr@fsij.org>
- * thread.c (rb_thread_call_with_gvl): remove "EXPERIMENTAL!"
- warning from a document.
+ * enum.c: Enumerable#slice_after implemented.
-Wed Jul 18 14:53:21 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * enumerator.c: Enumerator::Lazy#slice_after implemented.
- * configure.in (EXTDLDFLAGS): split options for each extension
- libraries, and unused in ruby.pc. [Bug #6734]
+ Requested by Tsuyoshi Sawada. [ruby-core:58123] [Feature #9071]
- * lib/mkmf.rb (MakeMakefile#configuration): add EXTDLDFLAGS.
+Sun May 18 08:22:25 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Jul 18 14:47:23 2012 Koichi Sasada <ko1@atdot.net>
+ * io.c (io_setstrbuf): always check if the buffer is modifiable.
+ [ruby-core:62643] [Bug #9847]
- * thread.c: fix last commit miss.
+Sun May 18 01:21:23 2014 Tanaka Akira <akr@fsij.org>
-Wed Jul 18 14:16:51 2012 Koichi Sasada <ko1@atdot.net>
+ * 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.
- * thread.c (rb_threadptr_async_errinfo_*): manage async errors queue.
- Async events such as an exception throwed by Thread#raise,
- Thread#kill and thread termination (after main thread termination)
- will be queued to th->async_errinfo_queue.
- - clear: clear the queue.
- - enque: enque err object into queue.
- - deque: deque err object from queue.
- - active_p: return 1 if the queue should be checked.
- rb_thread_t#thrown_errinfo was removed.
+ * rational.c (rb_rational_num): New function.
+ (rb_rational_den): Ditto.
- * vm_core.h: add declarations of rb_threadptr_async_errinfo_*.
- remove rb_thread_t#thrown_errinfo field and
- add rb_thread_t#async_errinfo_queue (queue body: Array),
- rb_thread_t#async_errinfo_queue_checked (flag),
- rb_thread_t#async_errinfo_mask_stack(Array, not used yet).
+ * include/ruby/intern.h (rb_rational_num): Declared.
+ (rb_rational_den): Ditto.
- * vm.c (rb_thread_mark): fix a mark function.
+ * ext/bigdecimal/bigdecimal.c: Follow the above change.
- * cont.c (rb_fiber_start): enque an error.
+ * ext/date/date_core.c: Ditto.
- * process.c (after_fork): clear async errinfo queue.
+ [ruby-core:60665] [Feature #9513]
-Wed Jul 18 14:25:55 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
+Sat May 17 17:04:32 2014 Shota Fukumori <her@sorah.jp>
- * pack.c: (ditto) bitwise operations are not char. Apply explicit
- casts on them.
+ * NEWS: Add news about removal of lib/test/**/*.rb.
-Wed Jul 18 12:59:50 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
+Sat May 17 16:57:33 2014 Shota Fukumori <her@sorah.jp>
- * encoding.c (load_encoding): explicit cast to suppress warning.
- Though the cast truncates some bits, from heuristic analysis I
- believe it is OK to do so here.
+ * lib/test: Removed because ruby's test cases now independent to
+ lib/test by r45970. [Feature #9711] [ruby-core:62620]
- * bignum.c (rb_cstr_to_inum): ditto.
+ I'm still considering about the future of lib/minitest, lib/test.
+ (bundling gems?)
-Wed Jul 18 12:55:54 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Sat May 17 15:06:40 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * lib/benchmark.rb: Fix Benchmark.benchmark output with an empty
- caption. patched by Benoit Daloze. [ruby-core:45719] [Bug #6610]
+ * 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.
-Wed Jul 18 10:00:54 2012 Eric Hodel <drbrain@segment7.net>
+Sat May 17 11:02:49 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/debug.rb: Added toplevel documentation. Based on patch by Oscar
- Del Ben. [Bug #6743], fixes #146 on github.
+ * dir.c (glob_helper): try match PLAIN as well as ALPHA, which are
+ separated by previous commits. [ruby-core:61552] [Bug #9648]
-Wed Jul 18 09:33:59 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * dir.c (glob_make_pattern): set PLAIN for non-magical path to
+ skip parts which not need to glob.
+ [ruby-core:61552] [Bug #9648]
- * test/win32ole/test_win32ole_event.rb (TestWIN32OLE_EVENT): use
- standard skip method to skip tests.
+ * dir.c (has_magic): return ALPHA at alphabetical name regardless
+ FNM_CASEFOLD flag.
-Wed Jul 18 09:26:45 2012 Eric Hodel <drbrain@segment7.net>
+ * dir.c (glob_helper): fix conditions for ALPHA.
+ [ruby-core:61552] [Bug #9648]
- * lib/logger.rb: Updated typos and output to match modern Logger
- output. Patch by Marcus Stollsteimer. [Bug #6738]
+Sat May 17 01:49:27 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Jul 18 07:59:29 2012 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
+ * dir.c (glob_helper): reduce matching at non-magical path on
+ Windows.
- * lib/cgi/util.rb (CGI.escapeHTML,unescapeHTML): Add &apos; for HTML5
- escaping.
- [Feature #6620]
+Sat May 17 01:49:23 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Jul 17 22:17:13 2012 Tanaka Akira <akr@fsij.org>
+ * dir.c (glob_pattern_type): separate names with alphabet but no
+ magical from plain.
- * lib/open-uri.rb: call io.close! for Tempfile.
+ * dir.c (glob_helper): match plain names as-is to treat super-root
+ same as the root. [ruby-core:61552] [Bug #9648]
-Tue Jul 17 16:41:32 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Fri May 16 17:38:22 2014 Koichi Sasada <ko1@atdot.net>
- * proc.c (rb_proc_arity): return normal value (not -n-1) if it is not
- a labmda, or it is a labmda and no arg_opts. [Bug #5694]
+ * 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.
-Tue Jul 17 03:56:34 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+Fri May 16 17:26:24 2014 Koichi Sasada <ko1@atdot.net>
- * ext/psych/lib/psych/visitors/to_ruby.rb: strings with YAML anchors
- are properly referenced. Patched by Joe Rafaniello via Github:
- https://github.com/tenderlove/psych/pull/69
- * ext/psych/lib/psych/visitors/yaml_tree.rb: ditto
- * test/psych/test_alias_and_anchor.rb: test for change
+ * gc.c (gc_before_sweep): heap_pages_swept_slots should contains
+ heap_pages_increment.
-Mon Jul 16 23:20:24 2012 Tanaka Akira <akr@fsij.org>
+ For example, GC by exceeding malloc_limit can remain
+ heap_pages_increment.
- * bignum.c (rb_integer_float_cmp): use FIXNUM_MIN and FIXNUM_MAX,
- instead of LONG_MIN and LONG_MAX.
+Thu May 15 21:18:43 2014 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-Mon Jul 16 22:50:41 2012 Tanaka Akira <akr@fsij.org>
+ * configure.in: enable SSE2 on mingw. target='i386-pc-mingw32'.
+ [ruby-core:62095] [Bug #8358]
- * numeric.c (flo_to_s): use the exponential form if the integer part
- is longer than or equal DBL_DIG.
- [ruby-dev:45960] [ruby-trunk - Bug #6741]
+Thu May 15 21:04:06 2014 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-Mon Jul 16 22:01:00 2012 Ayumu AIZAWA <ayumu.aizawa@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]
- * ext/readline/readline.c: fixed docs. [Bug #6740][ruby-core:46501]
- patched by Nobuhiro IMAI.
+ * test/testunit/test_parallel.rb (TestParallel): add a test.
-Mon Jul 16 19:24:01 2012 Tanaka Akira <akr@fsij.org>
+ * test/testunit/tests_for_parallel/ptest_forth.rb: ditto.
- * bignum.c (rb_integer_float_eq): new function.
- (rb_big_eq): use rb_integer_float_eq.
+Thu May 15 18:57:23 2014 Koichi Sasada <ko1@atdot.net>
- * internal.h (rb_integer_float_eq): declared.
+ * gc.c (garbage_collect_body): move gc_heap_prepare_minimum_pages()
+ from gc_sweep().
- * numeric.c (flo_eq): use rb_integer_float_eq.
- (fix_equal): ditto.
+Thu May 15 18:51:25 2014 Koichi Sasada <ko1@atdot.net>
-Mon Jul 16 19:02:31 2012 Tanaka Akira <akr@fsij.org>
+ * gc.c (heap_extend_pages): calculate next growing heap size.
- * bignum.c (rb_integer_float_cmp): rename a local variable.
+ * gc.c (heap_set_increment): accept addition pages instead of
+ minimum pages.
-Mon Jul 16 18:40:26 2012 Tanaka Akira <akr@fsij.org>
+ * gc.c (gc_after_sweep): use heap_etend_pages().
- * bignum.c (rb_integer_float_cmp): renamed from rb_big_float_cmp.
+ * gc.c (gc_heap_prepare_minimum_pages): add only 1 page.
- * internal.h: follow the above change.
+ * gc.c (heap_ready_to_gc): add only 1 page.
- * numeric.c: ditto.
+Thu May 15 18:42:49 2014 Koichi Sasada <ko1@atdot.net>
-Mon Jul 16 17:57:54 2012 Tanaka Akira <akr@fsij.org>
+ * gc.c: introduce macros to remove magic number.
- * bignum.c (rb_big_float_cmp): compare an integer and float precisely.
- [ruby-core:31376] [Bug #3589] reported by Tomasz Wegrzanowski.
+ 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.
-Mon Jul 16 17:29:45 2012 Tanaka Akira <akr@fsij.org>
+Thu May 15 17:32:51 2014 Hiroshi Shirosaki <h.shirosaki@gmail.com>
- * bignum.c (rb_big_float_cmp): support fixnum for argument x.
+ * 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.
- * numeric.c (fix_equal): use rb_big_float_cmp.
- (fix_cmp): ditto.
- (fix_gt): ditto.
- (fix_ge): ditto.
- (fix_lt): ditto.
- (fix_le): ditto.
- (flo_eq): ditto.
- (flo_cmp): use rb_big_float_cmp for fixnum argument.
- (flo_gt): ditto.
- (flo_ge): ditto.
- (flo_lt): ditto.
- (flo_le): ditto.
+Wed May 14 19:31:03 2014 Koichi Sasada <ko1@atdot.net>
-Mon Jul 16 17:05:53 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+ * ext/openssl/depend: remove dependency from internal headers.
+ [Feature #9612]
- * test/fileutils/test_fileutils.rb: add test for FileUtils#uptodate?
+ * ext/openssl/ossl.c (ossl_fips_mode_set): ditto.
-Mon Jul 16 16:56:12 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+ * ext/coverage/depend: ditto.
- * lib/fileutils.rb (FileUtils.uptodate?): remove useless parameter.
- patched by Oscar Del Ben.[Bug #6708][ruby-core:46256]
+ * include/ruby/thread_native.h: added.
-Mon Jul 16 15:37:56 2012 Tanaka Akira <akr@fsij.org>
+ This header file only provides wrapper functions to control
+ native threads. These wrapper functions are used by MRI
+ implementation.
- * bignum.c (rb_big_eq): use rb_big_float_cmp.
+ * vm_core.h: use include/ruby/thread_native.h.
-Mon Jul 16 15:00:45 2012 Tanaka Akira <akr@fsij.org>
+ * thread.c: ditto.
- * internal.h (rb_big_float_cmp): declared.
+ * thread_pthread.h: ditto.
- * bignum.c (rb_big_float_cmp): extracted from rb_big_cmp and big_op.
- (rb_big_cmp): use rb_big_float_cmp.
- (big_op): ditto.
+ * thread_win32.h: ditto.
- * numeric.c (flo_cmp): use rb_big_float_cmp.
- (flo_gt): ditto.
- (flo_ge): ditto.
- (flo_lt): ditto.
- (flo_le): ditto.
+ * thread_native.h: removed.
-Mon Jul 16 14:14:21 2012 Tanaka Akira <akr@fsij.org>
+Wed May 14 18:03:28 2014 Koichi Sasada <ko1@atdot.net>
- * bignum.c (enum big_op_t): new type.
- (big_op): use enum big_op_t.
- (big_gt): ditto.
- (big_ge): ditto.
- (big_lt): ditto.
- (big_le): ditto.
+ * gc.c: enable RGENGC_AGE2_PROMOTION.
-Sat Jul 14 18:18:48 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed May 14 18:02:30 2014 Koichi Sasada <ko1@atdot.net>
- * array.c (rb_get_values_at): fill with nil out of range.
- [ruby-core:43678] [Bug #6203]
+ * gc.c (rgengc_rememberset_mark): promote remembered object earlier.
-Sat Jul 14 17:17:55 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+Mon May 12 23:57:15 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * cont.c (cont_restore_0): improve docs. [Bug #6706][ruby-core:46243]
- patched by Oscar Del Ben via https://github.com/ruby/ruby/pull/140
+ * configure.in (rb_cv_atan2_inf_c99): check whether runtime atan2
+ handles Inf as C99. [ruby-core:62536] [Bug #9831]
-Sat Jul 14 17:08:13 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon May 12 20:33:01 2014 Tanaka Akira <akr@fsij.org>
- * hash.c (rb_hash_s_create): raise an exception, when input elements
- are not one or two elements arrays. [ruby-core:39945] [Bug #5406]
+ * configure.in: Invoke AC_REPLACE_FUNCS for each function.
-Sat Jul 14 16:16:48 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon May 12 19:52:11 2014 Koichi Sasada <ko1@atdot.net>
- * lib/test/unit.rb (Test::Unit::Runner#_run_parallel): use
- Array#uniq!.
+ * gc.c: count young object correctly and show it in GC.stat
+ on RGENGC_AGE2_PROMOTION.
- * lib/test/unit.rb (Test::Unit::Runner#deal): deal tasks to workers.
+ * gc.c (RVALUE_PROMOTE_YOUNG): decrement young object count on
+ YOUNG->OLD.
- * lib/test/unit.rb (Test::Unit::Runner#quit_workers): close and kill
- all workers.
+ * gc.c (obj_free): decrement young object count when young object
+ freed.
- * lib/test/unit.rb (Test::Unit::Runner#delete_worker): delete dead
- worker from working set.
+ * gc.c (gc_marks): should not clear young object count.
- * lib/test/unit.rb (Test::Unit::Runner#launch_worker): add new worker
- to working set.
+ * gc.c (gc_stat_internal): GC.stat :young_object information.
- * lib/test/unit.rb (Test::Unit::Runner#launch_worker): extract.
+Mon May 12 01:30:59 2014 Tanaka Akira <akr@fsij.org>
- * lib/test/unit.rb (Test::Unit::Runner#start_watchdog): extract.
+ * ext/socket/ifaddr.c (IS_IFADDRS): Unused macro removed.
- * lib/test/unit.rb (Test::Unit::Runner#_run_parallel): move
- initializations with nothing to release outside begin/ensure.
+ * ext/strscan/strscan.c (BUFSIZE): Ditto.
-Sat Jul 14 16:04:24 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/zlib/zlib.c (OBJ_IS_FREED): Ditto.
- * array.c (rb_ary_join): should not infected by separator if it is not
- used. [ruby-core:42161][Bug #5902]
+Sun May 11 22:27:18 2014 Tanaka Akira <akr@fsij.org>
-Sat Jul 14 02:31:55 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * compile.c (BUFSIZE): Unused macro removed.
- * include/ruby/intern.h (rb_thread_blocking_region): fix declarations
- prototypes without arguments in C++ have different meanings than C.
+ * vm.c (BUFSIZE): Ditto.
-Thu Jul 12 12:32:26 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * pack.c (INT64toNUM): Ditto.
+ (UINT64toNUM): Ditto.
+ (BYTEWIDTH): Ditto.
- * test/runner.rb: skip default gems to get rid of loading old versions
- before installation.
+ * time.c (lshift): Ditto.
+ (UINT64toNUM): Ditto.
+ (id_lshift): Unused variable removed.
-Thu Jul 12 11:44:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun May 11 21:23:27 2014 Tanaka Akira <akr@fsij.org>
- * string.c (rb_str_new_frozen): since the result object should have
- same tainted/untrusted bits with the original object, return new
- object if the shared object unmatch. [ruby-core:39745][Bug #5374]
+ * pack.c (swaps): Unused macro removed.
+ (swapi): Ditto.
+ (swapl): Ditto.
+ (swapll): Ditto.
-Thu Jul 12 10:46:39 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Sun May 11 08:02:49 2014 Eric Wong <e@80x24.org>
- * test/net/http/test_http.rb (TestNetHTTPLocalBind#test_bind_to_local*):
- cannot cross between network interfaces on Windows, so skip this test
- until we find better test.
+ * 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)]
-Thu Jul 12 08:48:33 2012 Ryan Davis <ryand-ruby@zenspider.com>
+Sun May 11 01:10:31 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/minitest/*: Imported minitest 3.2.0 (r7598)
- * test/minitest/*: ditto
+ * signal.c (rb_f_kill): directly enqueue an ignored signal to self,
+ except for SIGSEGV and SIGBUS. [ruby-dev:48203] [Bug #9820]
-Thu Jul 12 05:11:41 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat May 10 22:37:56 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * insns.def (defined): use method entry and id in cfp for proper
- superclass, since klass in iseq is shared by dynamically defined
- methods from the same block. [ruby-core:45831][Bug #6644]
+ * dir.c (push_glob): match in UTF-8 on Mac OS X.
+ [ruby-dev:48213] [Bug #9825]
-Thu Jul 12 01:49:07 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Sat May 10 13:32:18 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/net/http.rb (Net::HTTP#connect): use local_host and local_port
- if specified. patched by Ricardo Amorim [Feature #6617]
+ * 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]
-Wed Jul 11 17:36:39 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat May 10 09:32:19 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * ext/extmk.rb: append ENCOBJS to DLDOBJS but not EXTSOLIBS which is
- not a target, to compile enc/encinit.c.
+ * man/ruby.1: remove deadlink. [ruby-core:62145][Bug #9773]
-Wed Jul 11 12:38:20 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Sat May 10 08:47:36 2014 Tanaka Akira <akr@fsij.org>
- * ext/openssl/ossl_pkey_ec.c (ossl_ec_point_mul): nonstatic initializer
- of an aggregate type is a C99ism.
+ * signal.c (trap): Return "SYSTEM_DEFAULT" if SIG_DFL is set.
- * ext/openssl/ossl_pkey_ec.c (ossl_ec_point_mul): get rid of VC++
- warnings.
+Fri May 9 14:27:05 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Jul 9 16:11:30 2012 Yuki Yugui Sonoda <yugui@google.com>
+ * 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]
- * vm_eval.c (rb_eval_string_from_file,
- rb_eval_string_from_file_protect): new functions to replace
- rb_compile_main_from_string() and ruby_eval_main().
+Fri May 9 03:59:06 2014 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
- * nacl/pepper_ruby.c: Follows the change in vm_eval.c
+ * lib/delegate.rb: Fix example of using delegator.
+ patched from Andrey Koleshko. [Fixes GH-505]
-Mon Jul 9 14:05:42 2012 Yuki Yugui Sonoda <yugui@google.com>
+Fri May 9 03:42:43 2014 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
- Reverts a half of r36079. As we discussed on ruby-dev@ and IRC,
- we do not need to disclose intermediate representation of program.
- The program embedding CRuby should use rb_eval_string family.
- * include/ruby/ruby.h (ruby_opaque_t): removed.
- (ruby_compile_main_from_file, ruby_compile_main_from_string,
- ruby_eval_main): removed.
+ * lib/shell.rb: add documentation in lib/shell.rb
+ patched from reprah. [Fixes GH-516]
- * eval.c (ruby_eval_main_internal): became ruby_exec_internal() again.
- (ruby_eval_main): removed.
+Fri May 9 03:28:04 2014 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
- * ruby.c (PREPARE_PARSE_MAIN) reverted.
- (parse_and_compile_main, ruby_compile_main_from_file,
- ruby_compile_main_from_string): removed
+ * lib/fileutils.rb: show fileutils require at top.
+ patched from Richard Schneeman. [Fixes GH-604]
-Wed Jul 11 10:16:38 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri May 9 03:07:09 2014 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
- * include/ruby.h (HAVE_RUBY_THREAD_H): to show ruby/thread.h to be
- available. fixup of r36355.
+ * 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.
-Wed Jul 11 03:26:47 2012 Eric Hodel <drbrain@segment7.net>
+Thu May 8 14:34:29 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/zlib/zlib.c: Added streaming support to inflate processing.
- This allows zlib streams to be processed without huge memory growth.
- [Feature #6612]
- * NEWS: ditto
- * ext/zlib/zlib.c (zstream_expand_buffer): Uses rb_yield when a block
- is given for streaming support. Refactored to use
- zstream_expand_buffer_into to remove duplicate code.
- * ext/zlib/zlib.c (zstream_expand_buffer_protect): Added wrapper
- function to pass jump state back through GVL-free section to allow
- zstream clean-up before terminating the ruby call.
- * ext/zlib/zlib.c (zstream_expand_buffer_without_gvl): Acquire GVL to
- yield processed chunk of output stream.
- * ext/zlib/zlib.c (zstream_detach_buffer): When a block is given,
- returns Qnil mid-stream and yields the output buffer at the end of
- the stream.
- * test/zlib/test_zlib.rb: Updated tests
+ * class.c (rb_mod_init_copy): always clear instance variable,
+ constant and method tables first, regardless the source tables.
+ [ruby-dev:48182] [Bug #9813]
-Tue Jul 10 22:57:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu May 8 10:53:14 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * include/ruby/thread.h: new header file for thread stuff.
+ * configure.in: OpenBSD needs to include sys/param.h before include
+ sys/mount.h. [ruby-dev:48167]
- * thread.c (rb_thread_call_without_gvl): export. [Feature#4328]
- returns void* instead of VALUE. [Feature #5543]
+Thu May 8 10:17:04 2014 Karsten Sperling <karsten@sperling.co.nz>
- * thread.c (rb_thread_blocking_region): deprecate. [ruby-core:46295]
+ * 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]
-Tue Jul 10 10:48:59 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * lib/webrick/server.rb (WEBrick::GenericServer#start): IO.select()
+ raises ENOTSOCK on shutdown on Windows.
- * include/ruby/win32.h (NT, NtInitialize): removed unused old macros.
+Wed May 7 21:45:00 2014 Tanaka Akira <akr@fsij.org>
-Tue Jul 10 10:43:37 2012 NAKAMURA Usaku <usa@ruby-lang.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]
- * configure.in: removed --enable/disable-win95 options. (see r36342)
+Wed May 7 17:24:07 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Jul 10 00:44:41 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * numeric.c (num_step_scan_args): check keyword arguments and fail
+ if they conflict with positional arguments.
+ [ruby-dev:48177] [Bug #9811]
- * include/ruby/ruby.h: Removed RUBY_GLOBAL_SETUP completely. It is
- no meaning definition since r24894.
- * main.c: ditto.
- * nacl/pepper_main.c: ditto.
+Wed May 7 12:06:14 2014 Koichi Sasada <ko1@atdot.net>
-Mon Jul 9 23:59:36 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * benchmark/driver.rb: remove debug output and output results into
+ specified file.
- * dln.c: Simplify and make consistent an ifdef for Mac OS X.
- * ext/socket/rubysocket.h: ditto.
- * ext/tk/stubs.c: ditto.
- * io.c: ditto.
- * process.c: ditto.
- * signal.c: ditto.
- * vm_dump.c: ditto.
+Wed May 7 11:55:40 2014 Koichi Sasada <ko1@atdot.net>
-Mon Jul 9 17:37:35 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * benchmark/driver.rb: add '--rawdata-output=[FILE] option to output
+ raw results into FILE.
- * win32/win32.c (win95_stat): removed unnecessary macro.
+Wed May 7 11:25:41 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Jul 9 17:22:16 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * vm_eval.c (rb_f_local_variables): exclude variables hidden by
+ shadowing. [ruby-core:60501] [Bug #9486]
- * win32/configure.bat, win32/setup.mak, win32/Makefile.sub: omitted
- Win9x support. removed --enable/disable-win95 options.
+ * vm.c (collect_local_variables_in_iseq): ditto.
- * include/ruby/win32.h, file.c, win32/win32.c: ditto.
+Tue May 6 23:29:05 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * win32/README.win32: ditto.
+ * parse.y (new_bv_gen): no duplicated names, if already added in
+ shadowing_lvar().
-Mon Jul 9 13:28:34 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * parse.y (local_tbl_gen): remove local variables duplicated with
+ arguments.
+ [ruby-core:60501] [Bug #9486]
- * configure.in (DLDFLAGS): use TARGET_ENTRY to specify an entry point
- instead of TARGET which may contain non-identifier characters.
+Tue May 6 18:48:50 2014 Tanaka Akira <akr@fsij.org>
- * lib/mkmf.rb (create_makefile): add TARGET_NAME which is the first
- part consists of only word characters. [ruby-core:46248][Bug #6709]
+ * lib/time.rb (Time.make_time): Adjust the time zone of "now".
-Sun Jul 8 07:36:19 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue May 6 18:33:12 2014 Tadayoshi Funaba <tadf@dotrb.org>
- * parse.y (shadowing_lvar_gen, warn_unused_var): no warnings for
- variables starting with _. [ruby-core:46160][Feature #6693]
+ * io.c (io_{read,write}_nonblock): use rb_get_kwargs instead of
+ rb_hash_aref.
-Sat Jul 7 23:07:30 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+Tue May 6 18:03:05 2014 Tanaka Akira <akr@fsij.org>
- * test/csv/test_features.rb: add require for Tempfile.
- * test/csv/test_serialization.rb: ditto.
+ * lib/time.rb (Time.make_time): Argument validation code moved from
+ Time.parse and Time.strptime.
-Fri Jul 6 06:49:50 2012 Eric Hodel <drbrain@segment7.net>
+Tue May 6 17:27:06 2014 Tanaka Akira <akr@fsij.org>
- * array.c (rb_ary_aref): Added a description of the behavior of
- index positioning. [Bug #6680]
- * array.c (rb_ary_aset): ditto. Reordered sentences for clarity.
- * string.c (rb_str_aref_m): Added a description of the behavior of
- index positioning
+ * 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]
-Fri Jul 6 05:38:44 2012 Eric Hodel <drbrain@segment7.net>
+Tue May 6 04:31:48 2014 Tadayoshi Funaba <tadf@dotrb.org>
- * string.c (rb_str_bytesize): Improve documentation. Patch by Oscar
- Del Ben from github issue #138.
- * string.c (rb_str_empty): ditto.
- * string.c (rb_str_times): ditto.
- * string.c (rb_str_dump): ditto.
- * string.c (rb_str_center): ditto.
+ * file.c (rb_f_test): removed meaningless "case 'a'".
-Fri Jul 6 04:05:59 2012 Eric Hodel <drbrain@segment7.net>
+Tue May 6 01:28:14 2014 Tanaka Akira <akr@fsij.org>
- * ext/zlib/zlib.c (zstream_expand_buffer_without_gvl): Use
- ruby_xrealloc() to avoid crash with CALC_EXACT_MALLOC_SIZE.
+ * 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]
-Thu Jul 5 17:32:19 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue May 6 01:08:01 2014 Koichi Sasada <ko1@atdot.net>
- * internal.h: move ThreadShield declarations from intern.h.
+ * benchmark/driver.rb: define File::NULL if not defined and /dev/null
+ is available to run benchmark driver on ruby 1.9.2.
-Thu Jul 5 16:00:24 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon May 5 23:53:24 2014 Tanaka Akira <akr@fsij.org>
- * thread.c (ThreadShield): rename from Barrier.
+ * ext/socket/mkconstants.rb: Add IP_TRANSPARENT.
+ IP_TRANSPARENT is provieded since glibc-2.12.
+ Reported by Eliezer Croitoru. [ruby-core:50372] [Bug #7476]
-Thu Jul 5 15:14:50 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon May 5 22:29:47 2014 Tanaka Akira <akr@fsij.org>
- * bootstraptest/runner.rb (show_progress): refine error output. do not
- count non-empty error message, but just warn.
+ * 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]
- * bootstraptest/runner.rb (error): show errors immediately if tty.
+Mon May 5 21:52:35 2014 Tanaka Akira <akr@fsij.org>
-Thu Jul 5 12:28:11 2012 Akinori MUSHA <knu@iDaemons.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]
- * test/net/http/test_httpresponses.rb: Add a test file for
- Net::HTTPResponses and put a test case for the previous bug.
+ * ext/pathname/lib/pathname.rb (cleanpath_conservative): ditto.
-Thu Jul 5 06:33:52 2012 Mark Dodwell <mark@mkdynamic.co.uk>
+Mon May 5 21:48:04 2014 Tanaka Akira <akr@fsij.org>
- * lib/net/http/responses.rb: Fix 4xx classes to inherit correctly
- from Net::HTTPClientError. [Bug #6700]
+ * ext/pathname/lib/pathname.rb (Pathname#/): Aliased to Pathname#+.
+ Suggested by Alexey Muranov. [ruby-core:61432] [Feature #9625]
-Wed Jul 4 21:55:35 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Mon May 5 17:26:09 2014 Tadayoshi Funaba <tadf@dotrb.org>
- * ruby.c (proc_options): warn only if -K and -w option is specified.
- see also r36274 [Feature #5206]
+ * math.c (rb_math_sqrt): omitted exporting an unused function,
+ anyway.
+ * internal.h: follows the above change.
-Wed Jul 4 21:41:44 2012 Naohisa Goto <ngotogenome@gmail.com>
+Mon May 5 11:44:03 2014 Tanaka Akira <akr@fsij.org>
- * gc.c, atomic.h (ATOMIC_SIZE_*): moved from gc.c to atomic.h
- [ruby-dev:45909]
+ * lib/time.rb (Time.strptime): Raise ArgumentError if Date._strptime
+ doesn't extract date information.
+ Reported by tadayoshi funaba. [ruby-core:62349]
-Wed Jul 4 19:13:15 2012 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+Mon May 5 01:12:27 2014 Tadayoshi Funaba <tadf@dotrb.org>
- * test/win32ole/test_win32ole.rb (test_s_codepage_changed):
- FileSystemObject only supports ANSI or UTF-16LE encoding.
- Patch by h.shirosaki (Hiroshi Shirosaki) [ruby-trunk - Bug #6650]
+ * 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.
-Wed Jul 4 11:52:12 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Sun May 4 20:51:32 2014 Tanaka Akira <akr@fsij.org>
- * gc.c (ATOMIC_SIZE_*): 64bit Windows support.
+ * lib/time.rb (Time.force_zone!): Use usual local time if it has
+ expected offset from UTC.
-Wed Jul 4 11:11:28 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun May 4 17:58:12 2014 Tanaka Akira <akr@fsij.org>
- * eval.c (rb_frame_callee, rb_f_callee_name): fix to return the
- called id. this longstanding bug has been caused and blocked by
- the structure of old rb_control_frame_t and rb_iseq_t.
+ * 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.
- * vm_insnhelper.c (vm_push_frame): set proper method entry.
+ * lib/rss/rss.rb (Time.w3cdtf): Use Time.force_zone!.
-Wed Jul 4 08:29:31 2012 Eric Hodel <drbrain@segment7.net>
+Sun May 4 10:22:59 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * array.c (rb_ary_aref): Updated documentation to indicate the
- starting index is an index into the array or string. Updated
- examples to show behavior of indexes at the end of an array or
- string. Based on patch by Marcus Stollsteimer. [Bug #6680]
- * array.c (rb_ary_aset): ditto.
- * string.c (rb_str_aref): ditto. Also added descriptive argument
- names to call-seq section.
+ * 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]
-Wed Jul 4 07:05:59 2012 Eric Hodel <drbrain@segment7.net>
+Sun May 4 03:46:42 2014 Tanaka Akira <akr@fsij.org>
- * test/zlib/test_zlib.rb (test_inflate_partial_input): Added test for
- inflating incomplete zlib streams.
+ * lib/time.rb (Time.httpdate): Always return a UTC Time object.
-Tue Jul 3 23:14:16 2012 Naohisa Goto <ngotogenome@gmail.com>
+Sun May 4 03:26:39 2014 Tanaka Akira <akr@fsij.org>
- * gc.c (ATOMIC_SIZE_EXCHANGE): fix function name on Solaris [Bug #6689]
- [ruby-dev:45904]
+ * lib/time.rb (Time.make_time): Refactored.
-Tue Jul 3 16:07:49 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun May 4 02:53:17 2014 Tanaka Akira <akr@fsij.org>
- * gc.c (vm_malloc_fixup, vm_xrealloc, vm_xfree, after_gc_sweep): use
- atomic operations to update malloc_params.
+ * lib/time.rb (Time.rfc2822): Fix year completion.
+ Produce fixed-offset time object if appropriate.
+ (Time.xmlschema): Produce fixed-offset time object if appropriate.
-Tue Jul 3 14:50:16 2012 Eric Hodel <drbrain@segment7.net>
+Sat May 3 23:52:20 2014 Tanaka Akira <akr@fsij.org>
- * ext/zlib/zlib.c (zstream_run_func): Don't exit run loop for buffer
- error. [Feature #6615]
- * ext/zlib/zlib.c: Fix style to match existing functions.
+ * lib/time.rb (make_time): Produce fixed-offset time object if
+ appropriate.
+ (Time.strptime): Use d[:zone] instead of d[:offset].
-Tue Jul 3 12:05:51 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * lib/rss/rss.rb (Time.w3cdtf): Produce fixed-offset time object if
+ appropriate.
- * ext/dl/cfunc.c (rb_dlcfunc_call): also needed the workaround for VC8
- for x64. [ruby-dev:45875] [Bug #6676]
- reported by aves_ramphastos (Seigo Ishigane)
+Sat May 3 20:21:38 2014 Tanaka Akira <akr@fsij.org>
-Tue Jul 3 11:56:46 2012 Eric Hodel <drbrain@segment7.net>
+ * lib/time.rb (Time.strptime): Use d[:offset] if d[:seconds] is not
+ given.
+ Reported by tadayoshi funaba. [ruby-core:62322]
- * ext/zlib/zlib.c (zstream_detach_buffer): Refactored tainting of
- output string, moving it from the callee to zstream_detach_buffer.
- * ext/zlib/zlib.c (rb_zstream_finish): ditto
- * ext/zlib/zlib.c (rb_zstream_flush_next_out): ditto
- * ext/zlib/zlib.c (rb_deflate_deflate): ditto
- * ext/zlib/zlib.c (rb_deflate_flush): ditto
- * ext/zlib/zlib.c (rb_inflate_inflate): ditto
+Sat May 3 04:04:16 2014 Eric Wong <e@80x24.org>
-Tue Jul 3 11:16:06 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * complex.c (parse_comp): replace ALLOCA_N with ALLOCV_N/ALLOCV_END
+ [Bug #9608]
+ * rational.c (read_digits): ditto
- * common.mk (runnable): make symbolic links to run in build directory.
+Sat May 3 00:06:30 2014 Naohisa Goto <ngotogenome@gmail.com>
-Tue Jul 3 10:46:06 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * 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.
- * ruby.c (proc_options): warn if -K option is specified. [Feature #5206]
+ * configure.in (HAVE_STRUCT_STATVFS_F_BASETYPE): check struct
+ statvfs.f_basetype which is available on AIX, HP-UX, and Solaris.
-Tue Jul 3 06:12:13 2012 Eric Hodel <drbrain@segment7.net>
+Fri May 2 21:04:02 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * object.c (Init_Object): Added RDoc location pointers for
- Kernel#methods, Kernel#protected_methods, Kernel#private_methods and
- Kernel#public_methods. [Bug #6666]
+ * 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]
-Tue Jul 3 06:02:54 2012 Eric Hodel <drbrain@segment7.net>
+Fri May 2 11:32:51 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/zlib/zlib.c (zstream_run): Process zlib streams without GVL.
- [Feature #6615]
- * NEWS: ditto.
+ * 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]
-Mon Jul 2 22:13:04 2012 Tanaka Akira <akr@fsij.org>
+Fri May 2 10:37:55 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * thread.c (rb_thread_aref): add explanation for why Thread#[] and
- Thread#[]= are fiber-local and not thread-local.
- reported by Julien A. [ruby-core:41606] [ruby-trunk - Bug #5750]
+ * 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]
-Mon Jul 2 21:25:55 2012 Tanaka Akira <akr@fsij.org>
+Thu May 1 22:19:34 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * time.c (timew_out_of_timet_range): specialization for
- SIZEOF_TIME_T == SIZEOF_INT64_T.
+ * file.c: Change AND condition to nested condition.
-Mon Jul 2 17:06:32 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu May 1 00:36:26 2014 Naohisa Goto <ngotogenome@gmail.com>
- * class.c (rb_include_module): include modules after the origin.
+ * 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]
- * class.c (include_modules_at): skip prepended modules.
+Wed Apr 30 19:46:23 2014 Narihiro Nakamura <authornari@gmail.com>
- * class.c (rb_prepend_module): now basic.klass in ICLASS refers the
- old original class/module. [ruby-dev:45868][Bug #6662]
+ * gc.c (gc_after_sweep): suppress unnecessary expanding heap.
+ Tomb heap pages are freed pages here, so expanding heap is
+ not required.
- * class.c (rb_mod_ancestors): ditto.
+Wed Apr 30 17:58:40 2014 Koichi Sasada <ko1@atdot.net>
- * vm_method.c (search_method): search method entry from the origin
- iclass.
+ * vm.c (invoke_block_from_c): add VM_FRAME_FLAG_BMETHOD to record
+ it is bmethod frame.
-Mon Jul 2 05:54:58 2012 Tadayoshi Funaba <tadf@dotrb.org>
+ * vm.c (vm_exec): invoke RUBY_EVENT_RETURN event if rollbacked frame
+ is VM_FRAME_FLAG_BMETHOD.
+ [Bug #9759]
- * ext/date/date_core.c: [ruby-core:46058].
+ * test/ruby/test_settracefunc.rb: add a test for TracePoint/set_trace_func.
-Mon Jul 2 05:35:43 2012 Tadayoshi Funaba <tadf@dotrb.org>
+ * vm_core.h: rename rb_thread_t::passed_me to
+ rb_thread_t::passed_bmethod_me to clarify the usage.
- * ext/date/date_core.c (d_lite_marshal_load): accepts old dump.
+ * vm_insnhelper.c (vm_call_bmethod_body): use renamed member.
-Mon Jul 2 03:21:53 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+Wed Apr 30 17:06:49 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * README.EXT.ja: fixed args of have_struct_member() ,
- create_makefile() same as r35977. however, mkmf.rb include
- no Japanese-docs, so Appendix C was not removed. [Bug #6597]
+ * 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]
-Fri Jun 29 05:08:41 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Tue Apr 29 14:17:57 2014 Tanaka Akira <akr@fsij.org>
- * lib/test/unit/parallel.rb: workaround fix for rubygems.
- RubyGems can't find rake if the source directory is not equal to
- the directory which is running the test. [Bug #6604]
+ * lib/tmpdir.rb: Rescue LoadError on etc.so for miniruby.
+ Revert r45707, r45711, r45717.
-Thu Jun 28 20:33:15 2012 Luis Lavena <luislavena@gmail.com>
+Tue Apr 29 12:50:02 2014 Tanaka Akira <akr@fsij.org>
- * test/win32ole/test_win32ole.rb (test_s_codepage_changed):
- FileSystemObject only supports ANSI or UTF-16LE encoding.
- Patch by bosko (Bosko Ivanisevic) [ruby-trunk - Bug #6650]
+ * lib/fileutils.rb: Don't need to define fu_get_gid and fu_get_gid in
+ rescue LoadError on 'etc'.
-Thu Jun 28 09:27:09 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+Tue Apr 29 10:21:38 2014 Kazuki Tsujimoto <kazuki@callcc.net>
- * class.c (class_instance_method_list): consider prepended Class/Module
- when recur != 0. [ruby-dev:45863] [Bug #6660]
+ * parse.y (symbols_i): like r45492, call rb_gc_resurrect().
- * test/ruby/test_module.rb (test_prepend_instance_methods_false): add
- a test for it.
+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.
-Thu Jun 28 06:12:42 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * file.c (rb_io_statfs): check FSTATFS macro only instead of
+ HAVE_FSTATFS and HAVE_FSTATVFS.
- * class.c (rb_mod_ancestors): fix ancestors order.
- [ruby-core:45919][Bug #6658] [ruby-dev:45861][Bug #6659]
+ * file.c (statfs_type): use new macro.
+ * file.c (statfs_fstypename): ditto.
+ * file.c (statfs_inspect): ditto.
-Wed Jun 27 21:28:59 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+Tue Apr 29 00:20:26 2014 Rajarshi Das <rajarshid@cybage.com>
- * lib/racc/parser.rb: NotImplementError is not exist.
+ * bootstraptest/test_literal.rb: fix typo of "dynamic". [ci skip]
- * lib/irb/output-method.rb (IRB::OutputMethod#print): ditto.
+ * regexp.rdoc: fix typo of "organized". [ci skip]
-Wed Jun 27 21:31:13 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/session.rb: fix typo of "recognized". [ci skip]
- * class.c (rb_prepend_module): ancestors of prepending module also
- should be included. [ruby-core:45914][Bug #6654]
+Mon Apr 28 21:40:27 2014 NARUSE, Yui <naruse@ruby-lang.org>
-Wed Jun 27 21:01:32 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * configure.in (HAVE_STRUCT_STATFS_F_TYPE): check struct statfs.f_type
+ to support OpenBSD.
- * class.c (class_instance_method_list): m_tbl in prepended
- class/module is NULL. [ruby-core:45915][Bug #6655]
+ * file.c (statfs_type): use above macro to switch.
-Wed Jun 27 16:48:48 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * file.c (statfs_inspect): ditto.
- * class.c (rb_prepend_module): prepend module into another module.
+Mon Apr 28 18:06:08 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * eval.c (rb_mod_prepend): new method Module#prepend. [Feature #1102]
+ * configure.in: check struct statvfs and struct statvfs.f_fstypename.
-Wed Jun 27 09:15:46 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * configure.in: on NetBSD fstatfs is obsoleted.
- * io.c (is_popen_fork): check if fork and raise NotImplementedError if
- unavailable.
+ * file.c: support NetBSD for File::Statfs.
- * io.c (rb_io_s_popen): allow environment variables hash and exec
- options as flat parameters, not in an array arguments.
- [Feature#6651] [EXPERIMENTAL]
+Mon Apr 28 17:42:42 2014 Narihiro Nakamura <authornari@gmail.com>
- * process.c (rb_execarg_extract_options): extract exec options, but no
- exceptions on non-exec options and returns them as a Hash.
+ * gc.c: This argument must be a pointer.
- * process.c (rb_execarg_setenv): set environment variables.
+Mon Apr 28 17:40:15 2014 Narihiro Nakamura <authornari@gmail.com>
-Tue Jun 26 16:57:14 2012 Koichi Sasada <ko1@atdot.net>
+ * gc.c: Fix typos. These are undefined variables.
- * thread_pthread.c (register_cached_thread_and_wait):
- return immediately if malloc() failed.
- [ruby-core:43960] [ruby-trunk - Bug #6235]
+Sun Apr 27 19:39:42 2014 Tadayoshi Funaba <tadf@dotrb.org>
- * thread_pthread.c (USE_THREAD_CACHE): check already defined or not.
+ * ext/date/date_strptime.c (date__strptime_internal): do not
+ overwrite century.
-Tue Jun 26 10:01:56 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Apr 26 11:50:08 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * io.c (rb_io_s_popen): revert r36213 "popen: shell commands with
- envvar" because it disabled to let single command bypass shell.
+ * test/ruby/test_enum.rb (test_flat_map): Added test for flat_map.
+ Contribute from @igaiga. [fix GH-598]
-Mon Jun 25 17:49:28 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Apr 26 10:55:33 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * class.c (rb_mix_module): revert Module#mix.
+ * 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]
-Mon Jun 25 16:57:38 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Apr 26 08:05:36 2014 Tanaka Akira <akr@fsij.org>
- * proc.c (rb_mod_define_method): allow method transplanting from a
- module to either class or module. [ruby-core:34267][Feature #4254]
+ * 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.
-Mon Jun 25 11:34:45 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri Apr 25 22:54:34 2014 Naohisa Goto <ngotogenome@gmail.com>
- * internal.h: use rb_pid_t instead of pid_t because of there is no
- definition of pid_t here on Windows.
+ * 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]
-Mon Jun 25 00:25:01 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Fri Apr 25 19:16:30 2014 Tanaka Akira <akr@fsij.org>
- * configure.in (for stack end address): remove human68k specific
- check. It is no longer supported.
+ * lib/webrick/utils.rb: Don't rescue LoadError for 'etc' extension.
-Sun Jun 24 23:02:17 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Apr 25 14:55:59 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * io.c (pipe_open): merge win32 code using spawnv().
+ * 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]
-Sun Jun 24 22:53:42 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Apr 25 13:11:49 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * process.c (check_exec_fds): separate check_exec_fds_1() since
- nonstatic initializer of an aggregate type is not allowed by C89.
+ * configure.in: NetBSD's ksh, used by configure, needs escapes.
-Sun Jun 24 07:47:17 2012 Tanaka Akira <akr@fsij.org>
+Fri Apr 25 12:51:08 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * internal.h (rb_execarg): options field removed.
+ * configure.in: correct pthread_setname_np's prototype on NetBSD.
+ [Bug #9586]
- * process.c: follow the rb_execarg change.
+Thu Apr 24 23:17:25 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-Sat Jun 23 23:48:21 2012 Tanaka Akira <akr@fsij.org>
+ * lib/fileutils.rb (fu_get_uid, fu_get_gid): Etc.getpwnam/getgrnam may
+ returns nil.
- * process.c (proc_spawn_cmd): unused variable removed to suppress a
- warning.
- (save_env): ditto.
+ * lib/webrick/utils.rb (su): ditto.
- [ruby-core:45797] reported by Luis Lavena.
+Thu Apr 24 22:55:22 2014 Tanaka Akira <akr@fsij.org>
-Sat Jun 23 23:19:31 2012 Tanaka Akira <akr@fsij.org>
+ * bootstraptest/test_io.rb: Add etc.so to $" before require 'tmpdir'.
- * internal.h (rb_execarg): add new_pgroup_given and new_pgroup_flag
- fields.
+Thu Apr 24 21:09:55 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * process.c (EXEC_OPTION_NEW_PGROUP): removed.
- (proc_spawn_cmd): take a struct rb_execarg argument.
- use the new fields.
- (rb_execarg_addopt): use the new fields.
- (rb_spawn_process): follow the proc_spawn_cmd change.
+ * man/ruby.1: fix broken link.
- [ruby-core:45794] [ruby-trunk - Bug #6633] reported by Luis Lavena.
+Thu Apr 24 20:53:02 2014 Tanaka Akira <akr@fsij.org>
-Sat Jun 23 20:26:36 2012 Tanaka Akira <akr@fsij.org>
+ * lib/tmpdir.rb: Don't need to rescue LoadError for etc.so.
- * internal.h (rb_execarg): add fd_dup2, fd_close, fd_open,
- fd_dup2_child fields.
+Thu Apr 24 17:39:53 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * process.c (EXEC_OPTION_DUP2): removed.
- (EXEC_OPTION_CLOSE): removed.
- (EXEC_OPTION_OPEN): removed.
- (EXEC_OPTION_DUP2_CHILD): removed.
- (mark_exec_arg): mark the new fields.
- (check_exec_redirect1): change condition for default option.
- (check_exec_redirect): take a struct rb_execarg argument.
- use the new fields.
- (rb_execarg_addopt): follow the check_exec_redirect change.
- (check_exec_fds): use the new fields.
- (save_redirect_fd): ditto.
+ * file.c (statfs_inspect): suppress warnings.
+ assume those values won't be larger than LONG_LONG_MAX.
-Sat Jun 23 19:01:18 2012 Tanaka Akira <akr@fsij.org>
+Thu Apr 24 11:53:28 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * process.c (rb_execarg_fixup): fix envopts condition.
+ * 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]
-Sat Jun 23 18:44:13 2012 Tanaka Akira <akr@fsij.org>
+Thu Apr 24 11:21:37 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * process.c (check_exec_redirect1): extracted from
- check_exec_redirect.
+ * parse.y (rb_sym2id, rb_sym2id_without_pindown): return 0 for
+ non-symbol values, for the time being.
-Sat Jun 23 17:22:02 2012 Tanaka Akira <akr@fsij.org>
+Thu Apr 24 05:50:13 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * process.c (save_env): don't use EXEC_OPTION_UNSETENV_OTHERS.
- (rb_execarg_run_options): ditto.
+ * parse.y (dsym_node_gen): like r45492, call rb_gc_resurrect().
-Sat Jun 23 17:04:08 2012 Tanaka Akira <akr@fsij.org>
+Wed Apr 23 20:36:22 2014 Tanaka Akira <akr@fsij.org>
- * internal.h (rb_execarg): add env_modification field.
+ * ext/etc/extconf.rb: Build ext/etc unconditionally.
- * process.c (EXEC_OPTION_ENV): removed.
- (mark_exec_arg): mark env_modification field.
- (rb_exec_fillarg): update the new field, instead of options array.
- (rb_execarg_fixup): use the new field.
- (save_env): ditto.
- (rb_execarg_run_options): ditto.
+Wed Apr 23 14:10:50 2014 NARUSE, Yui <naruse@ruby-lang.org>
-Sat Jun 23 16:27:01 2012 Tanaka Akira <akr@fsij.org>
+ * file.c (statfs_fsid): remove statfs.f_fsid because it doesn't return
+ meaningful value portably. http://togetter.com/li/658517
- * internal.h (rb_execarg): add rlimit_limits field.
+Wed Apr 23 11:03:41 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * process.c (EXEC_OPTION_RLIMIT): removed.
- (mark_exec_arg): mark rlimit_limits field.
- (rb_execarg_addopt): update the new fields, instead of options array.
- (run_exec_rlimit): use the new field.
- (rb_execarg_run_options): clear sarg using MEMZERO. use the new
- field.
+ * 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]
-Sat Jun 23 14:29:25 2012 Tanaka Akira <akr@fsij.org>
+Wed Apr 23 00:43:00 2014 NAKAMURA Usaku <usa@ruby-lang.org>
- * internal.h (rb_execarg): add chdir_given and chdir_dir fields.
+ * win32/win32.c, include/ruby/win32.h (ustatfs): implementation of
+ statfs(2) clone. [EXPERIMENTAL]
- * process.c (EXEC_OPTION_CHDIR): removed.
- (mark_exec_arg): mark chdir_dir field.
- (rb_execarg_addopt): update the new fields, instead of options array.
- (rb_execarg_run_options): use the new fields.
+ * file.c (rb_io_statfs): use above function.
-Sat Jun 23 13:20:47 2012 Tanaka Akira <akr@fsij.org>
+ * configure.in, win32/Makefile.sub (struct statfs): available.
- * internal.h (rb_execarg): add close_others_given, close_others_do and
- close_others_maxhint fields.
+Tue Apr 22 23:56:24 2014 NAKAMURA Usaku <usa@ruby-lang.org>
- * process.c (EXEC_OPTION_CLOSE_OTHERS): removed.
- (rb_execarg_addopt): update the new fields, instead of options array.
- (check_exec_fds): take eargp as an argument. update the
- close_others_maxhint field.
- (rb_execarg_fixup): follow the argument change of check_exec_fds.
- (rb_execarg_run_options): use the new fields.
+ * file.c (rb_io_stafs): use statfs(2) if fstatfs(2) is unavailable.
-Sat Jun 23 10:41:59 2012 Tanaka Akira <akr@fsij.org>
+ * configure.in (fstatfs): check it.
- * internal.h (rb_execarg): add unsetenv_others_given and
- unsetenv_others_do fields.
+Tue Apr 22 22:15:51 2014 NAKAMURA Usaku <usa@ruby-lang.org>
- * process.c (EXEC_OPTION_UNSETENV_OTHERS): removed.
- (rb_execarg_addopt): update the new fields, instead of options array.
- (rb_execarg_fixup): use the new fields.
+ * file.c (rb_io_statfs): need to define even if the system doesn't have
+ fstatfs(2).
-Sat Jun 23 09:35:47 2012 Tanaka Akira <akr@fsij.org>
+ * test/ruby/test_file.rb (TestFile#test_statfs): skip if IO#stafs is not
+ implemented.
- * process.c: use the variable name "soptions" for sargp->options.
+Tue Apr 22 19:32:48 2014 NARUSE, Yui <naruse@ruby-lang.org>
-Sat Jun 23 09:17:49 2012 Tanaka Akira <akr@fsij.org>
+ * file.c: newly added a class File::Statfs. (experimental)
- * process.c: use the name "sargp" for struct rb_execarg variables
- consistently for saving process attributes.
+Tue Apr 22 08:22:33 2014 Koichi Sasada <ko1@atdot.net>
- * io.c: ditto.
+ * gc.c (objspace_malloc_increase): don't cause GC by malloc_increase
+ when memop type is MEMOP_TYPE_REALLOC.
-Sat Jun 23 07:59:57 2012 Tanaka Akira <akr@fsij.org>
+ GC at realloc is not well maintained.
+ We need a time to make it safe.
+ [ruby-dev:48117]
- * process.c: use the name "eargp" for struct rb_execarg variables
- consistently except for saving process attributes.
+Tue Apr 22 06:54:15 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * io.c: ditto.
+ * gc.c (objspace_malloc_increase): run full mark if 0x04 bit is
+ set in ruby_gc_stress. [ruby-core:62103] [Feature #9761]
- * ext/pty/pty.c: ditto.
+ * gc.c (objspace_malloc_increase): run GC after realloc not only
+ malloc and calloc by GC.stress. [ruby-core:62103] [Feature #9761]
-Wed Jun 20 18:27:03 2012 Yuki Yugui Sonoda <yugui@google.com>
+Mon Apr 21 19:12:20 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * common.mk: Add missing dependencies.
+ * 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.
-Fri Jun 22 20:27:39 2012 Tanaka Akira <akr@fsij.org>
+Mon Apr 21 19:02:44 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * internal.h (rb_execarg): add pgroup_given and pgroup_pgid fields.
+ * string.c (coderange_scan): remove useless condition `p < e` after
+ search_nonascii.
- * process.c (EXEC_OPTION_PGROUP): removed.
- (rb_execarg_addopt): update the new fields, instead of options array.
- (run_exec_pgroup): take a struct rb_execarg argument. refer the new
- fields.
- (rb_execarg_run_options): follow run_exec_pgroup change.
+ * string.c (rb_str_coderange_scan_restartable): ditto.
-Fri Jun 22 18:48:51 2012 Kouhei Sutou <kou@cozmixng.org>
+Mon Apr 21 18:55:21 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * README.EXT, README.EXT.ja: use "sval" for the third argument
- name of Data_Wrap_Struct().
- Suggested by @satoh_fumiyasu. Thanks!!!
+ * ext/-test-/string/coderange.c: add Bug::String.new#coderange_scan
+ to explicitly scan coderange.
-Fri Jun 22 18:04:26 2012 Koichi Sasada <ko1@atdot.net>
+Mon Apr 21 18:19:35 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * iseq.c, vm_eval.c: set th->base_block properly.
- th->base_block is information for (a) parsing, (b) compiling
- and (c) setting up the frame to execute the program passed by
- `eval' method. For example, (1) parser need to know up-level
- variables to detect it is variable or method without paren.
- Befor (a), (b) and (c), VM set th->base_block by passed bindng
- (or previous frame information). After execute (a), (b) and (c),
- VM should clear th->base_block. However, if (a), (b) or (c)
- raises an exception, then th->base_block is not cleared.
- Problem is that the uncleared value th->balo_block is used for
- irrelevant iseq compilation. It causes SEGV or critical error.
- I tried to solve this problem: to clear them before exception,
- but finally I found out that it is difficult to do it (Ruby
- program can be run in many places).
- Because of this background, I set th->base_block before
- compiling iseq and restore it after compiling.
- Basically, th->base_block is dirty hack (similar to global
- variable) and this patch is also dirty.
+ * string.c (coderange_scan): remove unused logic.
- * bootstraptest/test_eval.rb: add a test for above.
+ * string.c (rb_str_coderange_scan_restartable): ditto.
- * internal.h: remove unused decl.
+Mon Apr 21 14:11:48 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * iseq.c (rb_iseq_compile_with_option): add base_block parameter.
- set th->base_block before compilation and restore it after
- compilation.
+ * ext/stringio/stringio.c (strio_putc): fix for non-ascii
+ encoding, like as IO#putc. [ruby-dev:48114] [Bug #9765]
- * ruby.c (require_libraries): pass 0 as base_block instead of
- setting th->base_block
+Sun Apr 20 12:57:15 2014 Masaya Tarui <tarui@ruby-lang.org>
- * tool/compile_prelude.rb (prelude_eval): apply above changes.
+ * st.c (st_foreach_check): change start point of search at check
+ from top to current. [ruby-dev:48047] [Bug #9646]
- * vm.c, vm_eval.c: ditto.
+Sun Apr 20 08:41:33 2014 Andrew DeMaria <ademariad@gmail.com>
- * vm_core.h: add comments.
+ * lib/mkmf.rb (link_command, libpathflag, create_makefile): prefer
+ user specified `$LIBPATH` than `$DEFLIBPATH`. [ruby-core:62100]
+ [ruby-trunk - Bug #9760]
-Fri Jun 22 18:19:38 2012 Tanaka Akira <akr@fsij.org>
+Sun Apr 20 06:01:18 2014 Eric Wong <e@80x24.org>
- * process.c: pass struct rb_execarg value instead of its options
- field for saving process attribute changing functions.
- (save_redirect_fd): take a struct rb_execarg argument.
- (run_exec_dup2): ditto.
- (run_exec_close): ditto.
- (run_exec_open): ditto.
- (run_exec_dup2_child): ditto.
- (run_exec_pgroup): ditto.
- (run_exec_rlimit): ditto.
- (save_env): ditto.
- (rb_execarg_run_options): follow the above functions change.
+ * gc.c (rb_gc_writebarrier): drop special case for big hash/array
+ [Bug #9518]
-Fri Jun 22 17:55:48 2012 Koichi Sasada <ko1@atdot.net>
+Sat Apr 19 15:38:29 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/ruby/test_backtrace.rb: decrease recursion depth
- to reduce consuming stack size.
+ * 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]
-Fri Jun 22 13:36:50 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Apr 19 10:07:24 2014 Tanaka Akira <akr@fsij.org>
- * random.c (random_init, random_load): cannot initialize frozen object
- again, nor with tainted/untrusted object. [Bug #6540]
+ * internal.h (struct RBignum): Use size_t for len.
-Fri Jun 22 13:32:33 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * include/ruby/intern.h (rb_big_new): Use size_t instead of long to
+ specify the size of bignum.
+ (rb_big_resize): Ditto.
- * error.c (rb_check_copyable): new function, to ensure the target is
- not frozen and the source is not tainted nor untrusted.
+ * bignum.c: Follow above changes.
-Fri Jun 22 05:55:20 2012 Eric Hodel <drbrain@segment7.net>
+ * rational.c: Follow above changes.
- * eval.c (ruby_cleanup): Fixed typo. Patch by Trever Dawe.
- Fixes #131 (github). [ruby-trunk - Bug #6619]
+ * marshal.c: Follow above changes.
-Thu Jun 21 21:16:58 2012 Tanaka Akira <akr@fsij.org>
+Sat Apr 19 00:32:07 2014 Tanaka Akira <akr@fsij.org>
- * process.c (rb_execarg_addopt): take a VALUE argument instead of
- struct rb_execarg.
- (rb_exec_arg_addopt): follow the rb_execarg_addopt change.
- (check_exec_options_i): ditto.
+ * numeric.c (rb_num2long): Returns a long.
+ (rb_num2ulong): Returns a unsigned long.
- * io.c (pipe_open): follow the rb_execarg_addopt change.
+ * bignum.c (rb_big2long): Returns a long.
+ (rb_big2ulong): Returns a unsigned long.
- * internal.h (rb_execarg_addopt): follow the definition change.
+ * include/ruby/intern.h: Follow above changes.
-Thu Jun 21 20:34:19 2012 Tanaka Akira <akr@fsij.org>
+ * include/ruby/ruby.h: Follow above changes.
+ (rb_num2long_inline): No need to cast.
+ (rb_num2ulong_inline): Ditto.
- * process.c (rb_exec_fillarg): take a VALUE argument instead of
- struct rb_execarg.
- (rb_check_exec_options): ditto.
- (check_exec_options_i): ditto.
+Sat Apr 19 00:17:20 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Jun 21 19:48:05 2012 Tanaka Akira <akr@fsij.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.
- * process.c (rb_exec_async_signal_safe): use rb_execarg_run_options
- instead of rb_run_exec_options_err.
- (rb_spawn_process): ditto.
+Fri Apr 18 21:48:24 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Jun 21 19:02:43 2012 Tanaka Akira <akr@fsij.org>
+ * string.c (rb_str_new_frozen): consider the shared string at
+ middle.
- * process.c (rb_exec_fillarg): take a VALUE argument instead of
- struct rb_execarg.
- (rb_execarg_init): follow the rb_exec_fillarg change.
+ * string.c (rb_str_subseq, rb_str_substr, str_byte_substr): share
+ middle of a string.
-Thu Jun 21 18:36:43 2012 Tanaka Akira <akr@fsij.org>
+Fri Apr 18 15:40:05 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * process.c (rb_execarg_init): take a VALUE argument instead of
- struct rb_execarg.
- (rb_execarg_new): follow the rb_execarg_init change.
- (rb_exec_arg_init): ditto.
+ * string.c: use uintptr_t instead of VALUE because they are not ruby
+ object.
- * internal.h (rb_execarg_init): follow the definition change.
+Fri Apr 18 14:51:42 2014 NARUSE, Yui <naruse@ruby-lang.org>
-Thu Jun 21 17:20:44 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * string.c: check str_strlen's argument, and add comment or
+ use NULL if simply it uses str's enc.
- * parse.y (new_args_tail_gen): fix GC problem of keyword rest
- argument. the wrapped struct should be bound to the wrapping node
- before assignment of child nodes, to get rid of the case the
- children are referred by only the struct pointer which is not a
- subject of GC. [ruby-core:45744]
+Fri Apr 18 14:32:40 2014 NARUSE, Yui <naruse@ruby-lang.org>
-Thu Jun 21 07:06:52 2012 Koichi Sasada <ko1@atdot.net>
+ * string.c (str_strlen): use enc_strlen if the coderange is known.
- * error.c (err_append): rename err_append() to compile_err_append()
- and move definition body. err_append() is used only by compiling.
+Fri Apr 18 14:21:21 2014 NARUSE, Yui <naruse@ruby-lang.org>
-Thu Jun 21 06:21:54 2012 Tanaka Akira <akr@fsij.org>
+ * string.c (enc_strlen): move UTF-8 optimization from str_strlen to
+ enc_strlen.
- * process.c (rb_execarg_fixup): take a VALUE argument instead of
- struct rb_execarg.
+Fri Apr 18 08:50:18 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * internal.h (rb_execarg_fixup): follow the definition change.
+ * configure.in (rb_cv_getcwd_malloc): check if getcwd allocates
+ buffer if NULL is given [ruby-core:62072] [Bug #9752]
- * io.c (pipe_open): follow rb_execarg_fixup change.
+Thu Apr 17 16:28:10 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * ext/pty/pty.c (establishShell): ditto.
+ * prelude.rb: [DOC] Update Thread::exclusive docs by @stevenharman.
-Wed Jun 20 21:25:37 2012 Tanaka Akira <akr@fsij.org>
+Thu Apr 17 10:03:53 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * internal.h (struct rb_execarg): add umask_given and umask_mask
- fields.
+ * lib/fileutils.rb (FileUtils#copy_entry): update rdoc about
+ preserve option and permissions, following r31123.
+ [ruby-core:62065] [Bug #9748]
- * process.c (STATIC_ASSERT): removed.
- (rb_execarg_addopt): follow the rb_execarg change.
- (rb_execarg_run_options): ditto.
+Wed Apr 16 23:47:36 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Jun 20 20:38:23 2012 Tanaka Akira <akr@fsij.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]
- * internal.h (struct rb_execarg) moved and renamed from
- struct rb_exec_arg in intern.h.
+Wed Apr 16 09:51:16 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * include/ruby/intern.h (struct rb_exec_arg): refer Data object which
- contains struct rb_execarg.
+ * 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]
- * process.c: use struct rb_execarg instead of struct rb_exec_arg
- except functions declared in intern.h.
- (rb_exec_arg_addopt): extract a pointer to struct rb_execarg from
- struct rb_exec_arg.
- (rb_exec_arg_init): ditto.
- (rb_exec_arg_fixup): ditto.
- (rb_run_exec_options_err): ditto.
- (rb_run_exec_options): ditto.
- (rb_exec_err): ditto.
- (rb_exec): ditto.
+Tue Apr 15 19:36:42 2014 NAKAMURA Usaku <usa@ruby-lang.org>
- * io.c: use struct rb_execarg instead of struct rb_exec_arg.
+ * include/ruby/win32.h (rb_w32_cmdvector): removed.
- * ext/pty/pty.c: ditto.
+ * win32/win32.c (rb_w32_sysinit): use WCHAR version of GetCommandLine()
+ internally.
-Wed Jun 20 19:13:25 2012 Tanaka Akira <akr@fsij.org>
+ * win32/win32.c (w32_cmdvector): renamed from rb_w32_cmdvector. use
+ WCHAR* instead of char* internally.
- * internal.h (rb_execarg_new): declared.
- (rb_execarg_get): ditto.
+ these changes are expected to not changing the behavior yet.
- * process.c (mark_exec_arg): new function.
- (free_exec_arg): ditto.
- (memsize_exec_arg): ditto.
- (exec_arg_data_type): defined.
- (rb_execarg_new): new function.
- (rb_execarg_get): ditto.
- (rb_f_exec): use rb_execarg_new.
- (rb_spawn_internal): ditto.
- (rb_f_spawn): ditto.
+Tue Apr 15 19:26:05 2014 Tanaka Akira <akr@fsij.org>
- * io.c (pipe_open_v): use rb_execarg_new.
- (pipe_open_s): ditto.
+ * 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 & ...
- * ext/pty/pty.c (establishShell): use rb_execarg_new.
+Tue Apr 15 12:49:53 2014 Sam Rawlins <sam.rawlins@gmail.com>
-Wed Jun 20 16:36:14 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * enum.c (enum_each_slice, enum_each_cons): make more efficient by
+ allocating less and recycling block argument arrays if possible.
+ [Fixes GH-596]
- * missing/setproctitle.c (environ): use (*_NSGetEnviron()) instead of
- environ on Darwin for namespace cleanness, same as [ruby-core:00537].
- [ruby-core:45615] [Bug #6576]
+Mon Apr 14 18:44:45 2014 NARUSE, Yui <naruse@ruby-lang.org>
-Wed Jun 20 11:33:04 2012 Nobuyoshi Nakada <nobu@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.
- * process.c (rb_execarg_addopt): always make Fixnum, and ignore higher
- bits in too large umask value.
+Mon Apr 14 18:05:48 2014 NARUSE, Yui <naruse@ruby-lang.org>
-Wed Jun 20 11:24:35 2012 Nobuyoshi Nakada <nobu@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.
- * lib/test/unit.rb (Test::Unit::Runner#_run_parallel): deal with
- sudden-death of workers.
+Mon Apr 14 17:20:10 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Jun 18 20:34:20 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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]
- * time.c (init_leap_second_info): fix non-ANSI function declaration.
+Sun Apr 13 12:46:58 2014 Tanaka Akira <akr@fsij.org>
-Mon Jun 18 20:29:04 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * bignum.c (SIZEOF_BDIGIT): Renamed from SIZEOF_BDIGITS.
- * ruby.c (rb_f_sub): use ansi style declaration.
- * ruby.c (rb_f_gsub): ditto.
- * ruby.c (rb_f_chomp): ditto.
+ * internal.h: Ditto.
-Mon Jun 18 20:26:23 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * marshal.c: Ditto.
- * random.c (rb_random_int32): get rid of "warning: constant 0x100000000
- is so big it is long" warning.
+ * rational.c: Ditto.
-Mon Jun 18 20:07:23 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sun Apr 13 10:18:09 2014 Tanaka Akira <akr@fsij.org>
- * dir.c (dir_initialize): get rid of "unused return: argc = rb_scan_args()"
- warning.
+ * common.mk: Unused target, $(MKMAIN_CMD), removed.
-Mon Jun 18 19:31:20 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * Makefile.in (MKMAIN_CMD): Unused macro removed.
- * include/ruby/missing.h: include math.h before checking INFINITY
- and NAN. Otherwise, strange macro redefinition will occur.
+ * win32/Makefile.sub (MKMAIN_CMD): Ditto.
-Mon Jun 18 19:12:37 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sat Apr 12 22:11:10 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * array.c (ary_reverse): use ansi style declaration.
+ * 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]
-Tue Jun 19 18:43:50 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Apr 12 09:26:48 2014 Eric Hodel <drbrain@segment7.net>
- * include/ruby/backward/rubysig.h: fix visibility. [Bug #6607]
+ * ext/openssl/ossl_ocsp.c: [DOC] Document OpenSSL::OCSP.
-Tue Jun 19 17:51:54 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Apr 11 18:52:38 2014 Koichi Sasada <ko1@atdot.net>
- * process.c (rb_execarg_run_options): do not call any methods in the
- async-signal-safe function. mask has been checked with NUM2MODET()
- already and converted with LONG2NUM().
+ * array.c (ARY_SET): added.
-Tue Jun 19 11:59:56 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ ARY_SET() is same functionality of RARRAY_ASET(), but
+ it has an assertion (`ary' doesn't have shared array).
- * ext/readline/readline.c (Init_readline): don't set 0 to
- rl_catch_signals and rl_catch_sigwinch. [Bug #5423]
+Fri Apr 11 16:54:26 2014 Koichi Sasada <ko1@atdot.net>
-Tue Jun 19 11:52:59 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * array.c: make shared arrays WB-protected objects.
- * ext/readline/readline.c (readline_s_get_special_prefixes): suppress
- warning: uninitialized instance variable.
+ Shared arrays were WB-unprotected object because
+ sharing array can modify shared array's buffer
+ if it occupied shared array.
-Tue Jun 19 11:43:16 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ [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.
- * ext/readline/readline.c (readline_getc): fix editline compatibility
- broken by r36123. [Bug #6601]
+ It cause WB miss so that shared arrays were WB-unprotected.
+ (WB-unprotected objects are marked everytime if it is living)
-Mon Jun 18 17:10:08 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ This patch insert WB() for `shared' if it is needed.
- * string.c (rb_str_subpos): split from rb_str_substr. returns
- adjusted position for substring.
+Fri Apr 11 15:05:26 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Jun 18 10:42:57 2012 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]
- * ext/readline/readline.c (readline_getc): deal with ESC just followed
- by ASCII as meta prefix in incremental search mode. based on the
- patch from rctay (Tay Ray Chuan) at [ruby-core:45682]. [Bug #6601]
+ * vm_insnhelper.c (vm_search_super_method): allow bound
+ UnboundMethod case.
-Sun Jun 17 22:23:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Apr 11 12:02:30 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * dir.c (rb_file_directory_p): move documentation for Dir.exist? from
- file.c so that the proper description will be shown instead of the
- documentation of File.directory?. [ruby-core:45685]
+ * addr2line.c (rb_dump_backtrace_with_lines): set base address
+ which is retrieved from dladdr to dladdr_fbases, to skip already
+ parsed objects.
-Sun Jun 17 16:21:01 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Apr 11 12:44:50 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * thread_win32.h (rb_thread_lock_t): make a union for USE_WIN32_MUTEX.
- this internal is used only in thread_win32.c, but has to be complete
- to define rb_thread_t.
+ * array.c (ary_reject): may be turned into a shared array during
+ the given block. [ruby-dev:48101] [Bug #9727]
- * thread_win32.c (native_mutex_lock, native_mutex_destroy): fix for
- USE_WIN32_MUTEX.
+Thu Apr 10 23:41:21 2014 Akinori MUSHA <knu@iDaemons.org>
- * thread_win32.c (native_cond_timedwait_ms): rename reserved pattern
- name. user defined symbols should not start with __.
+ * lib/net/ftp.rb (Net::FTP#login): [DOC] The default password for
+ anonymous login was changed to "anonymous@" in r25313.
-Sat Jun 16 19:24:01 2012 Tadayoshi Funaba <tadf@dotrb.org>
+Thu Apr 10 19:22:58 2014 Koichi Sasada <ko1@atdot.net>
- * ext/date/date_core.c: define date_sg_t.
+ * test/ruby/test_array.rb: remove useless `assert'.
-Sat Jun 16 18:46:57 2012 Tadayoshi Funaba <tadf@dotrb.org>
+Thu Apr 10 19:11:11 2014 Koichi Sasada <ko1@atdot.net>
- * ext/date/date_tmx.h: offset in struct tmx_funcs is now int.
- * ext/date/date_strftime.c: ditto.
- * ext/date/date_core.c: ditto.
+ * array.c (rb_ary_modify): remember shared array owner if a shared
+ array owner is promoted and a shared array is not promoted.
-Sat Jun 16 18:31:46 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ Now, shared array is WB-unprotected so that shared arrays are not
+ promoted. All objects referred from shared array should be marked
+ correctly.
- * eval.c (ruby_setup): set running state in the normal case before
- popping a tag.
+ [ruby-core:61919] [ruby-trunk - Bug #9718]
-Sat Jun 16 07:46:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/ruby/test_array.rb: add a test for above.
- * lib/test/unit.rb (Test::Unit::Runner#_run_parallel): format workers
- results in the parent.
+Thu Apr 10 18:57:12 2014 Koichi Sasada <ko1@atdot.net>
-Sat Jun 16 07:12:56 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c (gc_verify_internal_consistency): move lines and enable
+ allrefs_dump() on RGENGC_CHECK_MODE >= 4.
- * tool/runruby.rb (File.realpath): return real path of expanded path.
- [Bug #6598]
+Thu Apr 10 15:01:06 2014 NARUSE, Yui <naruse@ruby-lang.org>
-Sat Jun 16 07:12:28 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * addr2line.c (append_obj): clear allocated memory.
- * bootstraptest/runner.rb (main): ignore -j option for compatibility
- with test/unit.
+ * addr2line.c (rb_dump_backtrace_with_lines): free `base_addrs'.
-Sat Jun 16 07:11:52 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Apr 10 14:40:18 2014 Koichi Sasada <ko1@atdot.net>
- * lib/test/unit.rb (Test::Unit::Runner#puke): modify only result and
- drop useless reports, not override entirely.
+ * gc.c (rb_gc_writebarrier_unprotect_promoted): disable to dump debug
+ message when RGENGC_CHECK_MODE == 0.
- * lib/test/unit/parallel.rb (Test::Unit::Worker#_run_suite): report
- unformatted results. formatting messages is not a workers task.
+Thu Apr 10 08:13:47 2014 Tanaka Akira <akr@fsij.org>
- * lib/test/unit/parallel.rb (Test::Unit::Worker#puke): store raw
- results.
+ * signal.c (check_stack_overflow): Don't use ucontext_t if ucontext.h
+ is not available.
+ Fixes build on Android (x86).
-Sat Jun 16 01:27:14 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+Wed Apr 9 23:22:44 2014 Tanaka Akira <akr@fsij.org>
- * ext/psych/lib/psych.rb: bumping psych to 1.3.3
- * ext/psych/psych.gemspec: ditto
+ * 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].
-Fri Jun 15 20:54:28 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+Wed Apr 9 21:02:04 2014 Tanaka Akira <akr@fsij.org>
- * vm_backtrace.c (backtrace_collect): rename from backtreace_collect.
+ * 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.
-Fri Jun 15 19:22:13 2012 Koichi Sasada <ko1@atdot.net>
+Wed Apr 9 15:16:59 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_core.h: remove VM_FRAME_MAGIC_FINISH (finish frame type).
- Before this commit:
- `finish frame' was place holder which indicates that VM loop
- needs to return function.
- If a C method calls a Ruby methods (a method written by Ruby),
- then VM loop will be (re-)invoked. When the Ruby method returns,
- then also VM loop should be escaped. `finish frame' has only
- one instruction `finish', which returns VM loop function.
- VM loop function executes `finish' instruction, then VM loop
- function returns itself.
- With such mechanism, `leave' instruction (which returns one
- frame from current scope) doesn't need to check that this `leave'
- should also return from VM loop function.
- Strictly, one branch can be removed from `leave' instruction.
- Consideration:
- However, pushing the `finish frame' needs costs because
- it needs several memory accesses. The number of pushing
- `finish frame' is greater than I had assumed. Of course,
- pushing `finish frame' consumes additional control frame.
- Moreover, recent processors has good branch prediction,
- with which we can ignore such trivial checking.
- After this commit:
- Finally, I decide to remove `finish frame' and `finish'
- instruction. Some parts of VM depend on `finish frame',
- so the new frame flag VM_FRAME_FLAG_FINISH is introduced.
- If this frame should escape from VM function loop, then
- the result of VM_FRAME_TYPE_FINISH_P(cfp) is true.
- `leave' instruction checks this flag every time.
- I measured performance on it. However on my environments,
- it improves some benchmarks and slows some benchmarks down.
- Maybe it is because of C compiler optimization parameters.
- I'll re-visit here if this cause problems.
+ * encoding.c (rb_enc_default_internal): fix rdoc. `__FILE__` is
+ in filesystem encoding but not `default_internal`.
+ [ruby-core:61894] [Bug #9713]
- * insns.def (leave, finish): remove finish instruction.
+Wed Apr 9 14:43:00 2014 Koichi Sasada <ko1@atdot.net>
- * vm.c, vm_eval.c, vm_exec.c, vm_backtrace.c, vm_dump.c:
- apply above changes.
+ * test/ruby/test_gc.rb: more long timeout.
+ This test failed under RGENGC_CHECK_MODE >= 2.
-Fri Jun 15 19:11:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Apr 9 13:07:13 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/test/unit.rb (Test::Unit::Runner#puke): always add skipped
- results to the report for parallel test. [Bug #6595]
+ * configure.in: get rid of __builtin_setjmp/__builtin_longjmp on
+ x64-mingw, which causes SEGV with callcc.
+ [ruby-core:61887] [Bug #9710]
-Fri Jun 15 09:01:35 2012 Yuki Yugui Sonoda <yugui@google.com>
+Wed Apr 9 12:44:54 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * nacl/pepper_main.c: Removed an unnecessary and erroneous inclusion.
+ * string.c (str_buf_cat): should round up the capacity by 4KiB,
+ but not number of rooms. [ruby-core:61886] [Bug #9709]
-Thu Jun 14 22:59:56 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Apr 8 22:55:32 2014 Akinori MUSHA <knu@iDaemons.org>
- * configure.in (RUBY_CPPOUTFILE): check if output is really sent to
- specified file to tell if -o option works. [ruby-dev:45742]
- [Bug#6591]
+ * lib/mkmf.rb (MakeMakefile#dir_config): [DOC] Improve
+ documentation.
- * configure.in (RUBY_CPPOUTFILE): check if output file is actually
- created. [ruby-dev:45742] [Bug#6591]
+Tue Apr 8 22:31:44 2014 Koichi Sasada <ko1@atdot.net>
-Thu Jun 14 22:10:50 2012 Tanaka Akira <akr@fsij.org>
+ * gc.c: rename `RGENGC_THREEGEN' to `RGENGC_AGE2_PROMOTION'.
- * process.c (proc_exec_sh): don't strip leading spaces of the script.
+ * gc.c (rgengc_rememberset_mark): don't promote, but remain in
+ remember set for infant objects.
-Thu Jun 14 15:54:02 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * gc.c (RVALUE_PROMOTE_INFANT, RVALUE_PROMOTE_YOUNG): count numbers
+ in these functions.
- * file.c (rb_file_s_basename, rb_file_s_dirname): documentation fix.
- File.basename and File.dirname support File::ALT_SEPARATOR.
+Mon Apr 7 21:11:49 2014 Tanaka Akira <akr@fsij.org>
-Thu Jun 14 11:10:10 2012 Yuki Yugui Sonoda <yugui@google.com>
+ * 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]
- * nacl/pepper_main.c: Applies the new embedding API to pepper_ruby.
+Mon Apr 7 07:20:23 2014 NARUSE, Yui <naruse@ruby-lang.org>
-Thu Jun 14 10:44:41 2012 Yuki Yugui Sonoda <yugui@google.com>
+ * 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]
- * include/ruby/ruby.h: Grouped APIs for embedding CRuby interpreter.
- (ruby_setup, ruby_compile_main_from_file,
- ruby_compile_main_from_string, ruby_eval_main,
- ruby_set_script_name): new APIs to embed CRuby.
- (ruby_opaque_t) Opaque pointer to an internal data, to NODE or iseq
- in particular.
+Mon Apr 7 02:39:48 2014 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
- * eval.c (ruby_setup): Similar to ruby_init but returns an error code
- instead of exit(3) on error.
- (ruby_eval_main): Similar to ruby_exec_node but returns the
- evaluation result.
- (ruby_eval_main_internal): renamed from ruby_exec_internal.
+ * 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
- * ruby.c (toplevel_context): new helper function.
- (PREPARE_EVAL_MAIN): moved.
- (process_options): refactored with new functions.
- (parse_and_compile_main) new helper function.
- (ruby_compile_main_from_file, ruby_compile_main_from_string) new API
- (ruby_set_script_name): new API.
+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]
-Thu Jun 14 10:39:48 2012 Yuki Yugui Sonoda <yugui@google.com>
+Sat Apr 5 19:36:33 2014 Tadayoshi Funaba <tadf@dotrb.org>
- * eval.c: Add doxygen comments.
+ * ext/date/date_core.c (d_lite_cmp): should compare with #<.
- * ruby.c: ditto.
+Sat Apr 5 00:31:21 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * thread_pthread.c: ditto
+ * ext/readline/extconf.rb (rl_hook_func_t): check pointer type.
+ [ruby-dev:48089] [Bug #9702]
- * version.c: ditto.
+Fri Apr 4 07:13:44 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_core.h: ditto.
+ * configure.in (ac_cv_func___builtin_setjmp): should not skip
+ flags restoration in RUBY_WERROR_FLAG by `break`.
+ [ruby-dev:48086] [Bug #9698]
-Thu Jun 14 10:16:07 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Wed Apr 2 21:50:06 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * configure.in: revert r36071 and add NetBSD to blacklist of -ansi.
+ * configure.in (ac_cv_func___builtin_setjmp): __builtin_longjmp()
+ in Apple LLVM 5.1 (LLVM 3.4svn) uses `void**`, not `jmp_buf`.
+ [Bug #9692]
-Thu Jun 14 07:59:12 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Wed Apr 2 20:57:15 2014 Koichi Sasada <ko1@atdot.net>
- * thread_pthread.c (get_stack): Linux is the only OS which includes
- the size of guard page into the stack size.
+ * gc.c, gc.h (rb_objspace_each_objects_without_setup):
+ Add a new (hidden) C-API to iterate objspace snapshot.
-Thu Jun 14 06:21:00 2012 Eric Hodel <drbrain@segment7.net>
+ This API is not safe to call any C-APIs in a given callback
+ function. Be careful to use this C-API.
- * lib/drb/drb.rb: Replace broken links to the English DRb book.
- Patch by Zachary Scott. [ruby-trunk - Bug #6544]
+Wed Apr 2 17:43:17 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Jun 14 06:17:47 2012 Eric Hodel <drbrain@segment7.net>
+ * 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]
- * lib/observer.rb: Update broken link to the Programming Ruby book.
- Patch by Zachary Scott. [ruby-trunk - Bug #6536]
- * lib/drb/drb.rb: ditto.
+Wed Apr 2 15:12:18 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Thu Jun 14 05:23:05 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * common.mk: Use redmine-2.x url for DeveloperHowto wiki.
+ [ruby-core:60657] [Bug #9511]
- * regparse.c (PFETCH_READY): suppress Wunused-but-set-variable.
+Wed Apr 2 11:46:29 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * regparse.c (is_onechar_cclass): restructured to clarify that c is
- used iff found == 1.
+ * ext/pathname/lib/pathname.rb (Pathname#join): Fix error with
+ empty args. Reported by ko1 via IRC.
-Thu Jun 14 02:54:17 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * test/pathname/test_pathname.rb (TestPathname#test_join): Add the
+ test for above case.
- * configure.in: use -fbuiltin with -ansi -std=iso9899:199409.
- This prevents errors introduced by disabling builtin functions,
- which is the sub-effect of -ansi/-std.
- Now NetBSD can use -ansi -std=iso9899:199409.
- Maybe mingw, cygwin and darwin can also.
+Tue Apr 1 11:39:57 2014 James Edward Gray II <james@graysoftinc.com>
-Thu Jun 14 02:53:30 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * lib/csv.rb: Symbol HeaderConverter: strip leading/trailing space.
+ Reported by Skye Shaw
+ [Fixes GH-575]
- * Makefile.in: don't remove macros. now name2ctype uses macros.
+Tue Apr 1 11:34:04 2014 James Edward Gray II <james@graysoftinc.com>
- * tool/enc-unicode.rb: add comment why it uses Hash#index.
+ * lib/csv.rb: Don't attempt to convert nil headers.
+ Reported by Skye Shaw
- * enc/unicode/{name2ctype.kwd,name2ctype.src,name2ctype.h.blt}:
- update to follow the current name2ctype.h.
- FYI current Unicode version is 6.1.
+Tue Apr 1 17:29:35 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Jun 14 00:16:59 2012 Akinori MUSHA <knu@iDaemons.org>
+ * tool/config_files.rb (ConfigFiles.download): show failed URI.
+ [ruby-core:61792] [Bug #9690]
- * lib/net/http/responses.rb, lib/webrick/httpstatus.rb: Add HTTP
- response codes added in RFCs 2817 and 4918. [ruby-core:45547]
- [Feature #6569]
+Tue Apr 1 12:06:49 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * lib/net/http/responses.rb: Rename Net::HTTPMultipleChoice to
- Net::HTTPMultipleChoices, leaving the former as alias to the
- latter for backward compatibility. [ruby-core:45547]
- [Feature #6569]
+ * addr2line.c (rb_dump_backtrace_with_lines): don't depend hard coded
+ symbol '_start'.
- * lib/net/http/responses.rb: Add comments about unused,
- still-in-draft and private extension response codes.
- [ruby-core:45547] [Feature #6569]
+ * addr2line.c (fill_lines): instead of above, get a dynamic symbol
+ in the main executable and use it to know the base address.
-Wed Jun 13 22:44:32 2012 Naohisa Goto <ngotogenome@gmail.com>
+ * addr2line.c (follow_debuglink0): use obj_info_t instead of
+ line_info_t to handle object related data.
- * test/dl/test_func.rb (test_qsort1, test_qsort2): use TYPE_SIZE_T
- for size_t variables. [ruby-dev:45733] [Bug #6584]
+ * addr2line.c (main_exe_path): defined for Linux.
-Wed Jun 13 22:18:01 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Apr 1 08:58:39 2014 Kazuki Tsujimoto <kazuki@callcc.net>
- * configure.in: remove -ansi and -std options for lgamma_r() and
- finite().
+ * parse.y (rb_str_dynamic_intern): set mark bit if dynamic symbol
+ is before sweeping.
-Wed Jun 13 21:46:34 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Apr 1 07:37:00 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * configure.in: cygwin does not provide some declarations in strict
- ANSI mode.
+ * addr2line.c (fill_lines): use dynsym, which is used for dynamic
+ linking and always exists, if there's no symtab.
-Wed Jun 13 20:19:59 2012 Tanaka Akira <akr@fsij.org>
+Tue Apr 1 07:27:15 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * process.c (rb_fork_internal): move a variable declaration.
+ * vm_dump.c (rb_print_backtrace): current implementation
+ uses dladdr to get the path of objects.
-Wed Jun 13 17:54:38 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
+Mon Mar 31 23:57:45 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * regparse.c (PFETCH_READY): this line was to suppress warning,
- but did emit warnings if -Wuninitialized was set. Assigning
- NULL instead if pfetch_prev should suffice the situation.
+ * ext/readline/extconf.rb: fix typo, `$defs` not `$DEFS`.
+ [ruby-core:61756] [Bug #9578]
-Wed Jun 13 17:51:05 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Mar 31 17:23:50 2014 NAKAMURA Usaku <usa@ruby-lang.org>
- * configure.in: cygwin needs C99 for some stuff, e.g.,
- pthread_attr_setstacksize, sched_yield.
+ * test/ruby/memory_status.rb: require envutil before accessing EnvUtil
+ module. reported by ko1 via twitter.
-Wed Jun 13 17:50:43 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Mar 31 10:28:01 2014 Eric Wong <e@80x24.org>
- * Makefile.in (.c.i): add warnflags to make the result consistent with
- compilation.
+ * st.c (st_init_table_with_size): update comment
+ [Feature #9425]
-Wed Jun 13 15:12:07 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
+Sun Mar 30 23:39:26 2014 NAKAMURA Usaku <usa@ruby-lang.org>
- * configure.in: On Windows platforms, system provided headers are
- VC++ optimized. That is, C++ habits are often contaminated into
- various headers. Most frequent situation is the use of //
- comments. We bypass ANSI C mode for them. Otherwise extension
- libs cannot include those headers.
+ * 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]
-Wed Jun 13 13:39:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Mar 29 13:04:22 2014 Koichi Sasada <ko1@atdot.net>
- * include/ruby/win32.h: get rid of C99 style one line comments.
+ * 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]
-Wed Jun 13 13:39:04 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ This issue is pointed by Tim Robertson.
+ http://www.omniref.com/blog/blog/2014/03/27/ruby-garbage-collection-still-not-ready-for-production/
- * encoding.c (enc_alias_internal): use strdup defined as macro.
+Fri Mar 28 19:32:13 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Jun 13 10:20:27 2012 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]
- * process.c (rb_exec_fillarg): get rid of SIZE_T_MAX which may need
- more headers.
+Fri Mar 28 09:21:54 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * process.c (rb_exec_fillarg): fix array element size. "continue" and
- "readonly" exceeded the size.
+ * ext/psych/psych.gemspec: update gemspec for psych-2.0.5
- * process.c (rb_exec_fillarg): use shell if the first word is reserved
- or special built-in name.
- http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html
+Fri Mar 28 09:11:06 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * process.c (rb_exec_fillarg): treat '=' only in the first word. if
- the first word does not contain '=', it is the command name and
- environment assignments cannot be anymore.
+ * 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.
-Tue Jun 12 23:45:36 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Thu Mar 27 18:58:10 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/mkmf.rb: add dummy clean-static target to prevent errors for the
- case real clean-static target doesn't exist.
+ * re.c (match_regexp): set regexp for MatchData from string.
-Tue Jun 12 22:49:42 2012 Naohisa Goto <ngotogenome@gmail.com>
+ * re.c (rb_backref_set_string): create MatchData from string and
+ set backref.
- * process.c (rb_exec_arg_fixup): fix compile error
+ * 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]
-Tue Jun 12 21:40:13 2012 Tanaka Akira <akr@fsij.org>
+Thu Mar 27 11:58:55 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * process.c (rb_exec_fillarg): treat '=' character as a meta
- character to detect assignments preceding command name.
+ * 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.
-Tue Jun 12 20:29:19 2012 Tanaka Akira <akr@fsij.org>
+Wed Mar 26 14:57:35 2014 NAKAMURA Usaku <usa@ruby-lang.org>
- * include/ruby/intern.h (rb_exec_arg_init): deprecated.
- (rb_exec_arg_addopt): ditto.
- (rb_exec_arg_fixup): ditto.
- (rb_run_exec_options): ditto.
- (rb_run_exec_options_err): ditto.
+ * parse.y: inline must be static (for mswin).
+ fixed build error introduced at r45426.
- * internal.h (rb_execarg_init): declared.
- (rb_execarg_addopt): ditto.
- (rb_execarg_fixup): ditto.
- (rb_execarg_run_options): ditto.
+Wed Mar 26 14:33:00 2014 Narihiro Nakamura <authornari@gmail.com>
- * process.c: call rb_execarg_addopt, rb_execarg_fixup,
- rb_execarg_run_options, rb_execarg_init.
- (rb_execarg_addopt): renamed from rb_exec_arg_addopt.
- (rb_exec_arg_addopt): stub to call rb_execarg_addopt.
- (rb_execarg_init): renamed from rb_exec_arg_init.
- (rb_exec_arg_init): stub to call rb_execarg_init.
- (rb_execarg_fixup): renamed from rb_exec_arg_fixup.
- (rb_exec_arg_fixup): stub to call rb_execarg_fixup.
- (rb_execarg_run_options): renamed from rb_run_exec_options_err.
- (rb_run_exec_options_err): stub to call rb_execarg_run_options.
- (rb_run_exec_options): call rb_execarg_run_options.
+ * internal.h (USE_SYMBOL_GC): enable Symbol GC by default (USE_SYMBOL_GC == 1).
- * io.c: call rb_execarg_addopt, rb_execarg_fixup,
- rb_execarg_run_options, rb_execarg_init.
+Tue Mar 25 22:57:11 2014 Narihiro Nakamura <authornari@gmail.com>
- * ext/pty/pty.c (establishShell): call rb_execarg_init and
- rb_execarg_fixup.
+ * parse.y: support Symbol GC. [ruby-trunk Feature #9634]
+ See this ticket about Symbol GC.
-Tue Jun 12 18:39:59 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
+ * 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
- * configure.in: enable strict ANSI mode by default in case of GCC,
- requested by _ko1.
+ * gc.c: declare RSymbol. support T_SYMBOL.
-Tue Jun 12 06:40:23 2012 Tanaka Akira <akr@fsij.org>
+ * 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.
- * process.c (rb_exec_fillarg): detect '#' as a meta character.
+ * string.c (Init_String): String#intern and String#to_sym use
+ rb_str_dynamic_intern.
-Mon Jun 11 22:15:44 2012 Tanaka Akira <akr@fsij.org>
+ * template/id.h.tmpl: use LSB of ID as a flag for determining a
+ static symbol, so we shift left other ruby_id_types.
- * include/ruby/intern.h (rb_proc_exec_n): deprecated.
- (rb_exec): ditto.
- (rb_exec_err): ditto.
- (rb_fork): ditto.
- (rb_fork_err): ditto.
+ * string.c: use rb_sym2str instead `rb_id2str(SYM2ID(sym))` to
+ avoid pinning.
-Mon Jun 11 18:49:52 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * load.c: use xx_without_pindown function at creating temporary ID
+ to avoid pinning.
- * configure.in: on checking libexecinfo, don't specify /use/local.
- On FreeBSD people must specify --with-opt-dir or --with-execinfo-dir.
+ * object.c: ditto.
-Mon Jun 11 12:14:37 2012 Koichi Sasada <ko1@atdot.net>
+ * sprintf.c: ditto.
- * vm_core.h: remove lfp (local frame pointer) and rename
- dfp (dynamic frame pointer) to ep (environment pointer).
- This change make VM `normal' (similar to other interpreters).
- Before this commit:
- Each frame has two env pointers lfp and dfp. lfp points
- local environment which is method/class/toplevel frame.
- lfp[0] is block pointer.
- dfp is block local frame. dfp[0] points previous (parent)
- environment pointer.
- lfp == dfp when frame is method/class/toplevel.
- You can get lfp from dfp by traversing previous environment
- pointers.
- After this commit:
- Each frame has only `ep' to point respective environment.
- If there is parent environment, then ep[0] points parent
- environment (as dfp). If there are no more environment,
- then ep[0] points block pointer (as lfp). We call such ep
- as `LEP' (local EP). We add some macros to get LEP and to
- detect LEP or not.
- In short, we replace dfp and lfp with ep and LEP.
- rb_block_t and rb_binding_t member `lfp' and `dfp' are removed
- and member `ep' is added.
- rename rb_thread_t's member `local_lfp' and `local_svar' to
- `root_lep' and `root_svar'.
- (VM_EP_PREV_EP(ep)): get previous environment pointer. This macro
- assume that ep is not LEP.
- (VM_EP_BLOCK_PTR(ep)): get block pointer. This macro assume
- that ep is LEP.
- (VM_EP_LEP_P(ep)): detect ep is LEP or not.
- (VM_ENVVAL_BLOCK_PTR(ptr)): make block pointer.
- (VM_ENVVAL_BLOCK_PTR_P(v)): detect v is block pointer.
- (VM_ENVVAL_PREV_EP_PTR(ptr)): make prev environment pointer.
- (VM_ENVVAL_PREV_EP_PTR_P(v)): detect v is prev env pointer.
-
- * vm.c: apply above changes.
- (VM_EP_LEP(ep)): get LEP.
- (VM_CF_LEP(cfp)): get LEP of cfp->ep.
- (VM_CF_PREV_EP(cfp)): utility function VM_EP_PREV_EP(cfp->ep).
- (VM_CF_BLOCK_PTR(cfp)): utility function VM_EP_BLOCK_PTR(cfp->ep).
-
- * vm.c, vm_eval.c, vm_insnhelper.c, vm_insnhelper.h, insns.def:
- apply above changes.
-
- * cont.c: ditto.
-
- * eval.c, eval_intern.h: ditto.
-
- * proc.c: ditto.
+ * struct.c: ditto.
* thread.c: ditto.
- * vm_dump.c: ditto.
-
- * vm_exec.h: fix function name (on vm debug mode).
-
-Mon Jun 11 11:52:18 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
-
- * compile.c (iseq_set_sequence): nonstatic initializer of an
- aggregate type is a C99ism.
-
- * compile.c (enum compile_array_type_t): comma at the end of enum
- list is a C99ism.
-
- * vm_backtrace.c (enum LOCATION_TYPE): ditto.
-
-Mon Jun 11 06:31:33 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_proc_exec_n): revert the function removed at r35889.
-
-Mon Jun 11 06:20:50 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * thread_pthread.c (rb_thread_create_timer_thread): assign return
- value to the variable err.
-
-Mon Jun 11 06:17:06 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * thread_pthread.c (native_cond_initialize): fix typo in r36022.
- this cause a failure on FreeBSD 8.2 amd64.
- http://fbsd.rubyci.org/~chkbuild/ruby-trunk/log/20120610T130201Z.diff.html.gz
-
-Mon Jun 11 05:21:57 2012 Koichi Sasada <ko1@atdot.net>
-
- * .gdbinit (SDR): add SDR function. It's only for VM debugging.
-
-Sun Jun 10 21:50:45 2012 Yuki Sonoda (Yugui) <yugui@yugui.jp>
-
- * nacl/nacl_config.rb: Fixed for 32bit hosts.
-
-Sun Jun 10 20:23:14 2012 Yuki Sonoda (Yugui) <yugui@yugui.jp>
-
- Fixes threading on NativeClient.
-
- * thread_pthread.c (timer_thread_sleep): Extracted out a function from
- thread_timer(). Added an alternative implementation for platforms
- that lacks select(2) or pipe(2).
- (rb_thread_create_timer_thread, native_cond_initialize,
- native_cond_destroy): Replaced wrong HAVE_XXX checks.
-
- * configure.in (pthread_attr_init): New check.
-
-Sun Jun 10 21:30:11 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_exec_without_timer_thread): renamed from rb_exec_err.
- (rb_exec_err): new stub function to call
- rb_exec_without_timer_thread.
- (rb_f_exec): call rb_exec_without_timer_thread.
- (rb_exec): call rb_exec_without_timer_thread.
-
-Sun Jun 10 21:13:10 2012 Tanaka Akira <akr@fsij.org>
+ * variable.c: ditto.
- * process.c (rb_fork): call rb_fork_internal instead of rb_fork_err.
-
-Sun Jun 10 20:55:59 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_fork_ruby): call rb_fork_internal directly.
-
-Sun Jun 10 20:19:40 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_fork_ruby): new function.
- (rb_f_fork): use rb_fork_ruby instead of rb_fork.
- (rb_daemon): ditto.
-
- * io.c (pipe_open): use rb_fork_ruby instead of rb_fork.
-
- * internal.h (rb_fork_ruby): declared.
-
-Sun Jun 10 18:58:16 2012 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/net/http/response.rb: Remove a duplicated rdoc and leave a
- pointer.
-
- * lib/net/http/responses.rb: Add RFC numbers to base on.
-
-Sun Jun 10 18:31:42 2012 Yuki Sonoda (Yugui) <yugui@yugui.jp>
-
- * configure.in (RUBY_NACL): Warns if $PATH does not contain the path
- to NativeClient SDK. PATH variable redefinition in GNUmakefile does
- not work for GNU make 3.81.
-
-Sun Jun 10 17:54:36 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.h (IS_STACK_DIR_UPPER): utility macro.
-
- * thread_pthread.c (get_stack): seems stack size does not include
- guard size on Mac OS X.
-
- * thread_pthread.c (ruby_init_stack): adjust stack size for offset of
- addr from the bottom.
-
-Sun Jun 10 15:49:47 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (retry_fork): call after_fork except in a child process.
- (rb_fork_internal): restrict after_fork call condition.
-
-Sun Jun 10 14:19:33 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * configure.in: NetBSD 6 adds libexecinfo but it only works on amd64.
- http://www.mail-archive.com/source-changes-full@netbsd.org/msg38729.html
-
-Sun Jun 10 12:43:23 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_f_exec): call rb_exec_async_signal_safe except on
- Mac OS X. cf. the comment in before_exec_non_async_signal_safe.
-
-Sun Jun 10 12:15:18 2012 Tanaka Akira <akr@fsij.org>
-
- * io.c (popen_exec): don't call rb_thread_atfork_before_exec. use
- rb_exec_async_signal_safe instead of rb_exec_err.
- (pipe_open): use rb_fork_async_signal_safe instead of rb_fork_err.
-
-Sun Jun 10 11:44:57 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_fork_internal): call after_fork only unless
- chfunc_is_async_signal_safe.
-
-Sun Jun 10 11:33:01 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * ext/openssl/ossl_pkey_ec.c
- test/openssl/test_pkey_ec.rb: Add support for EC_POINT_mul.
- Patch provided by Sambasiva Suda. Thanks!
- [ruby-core:44408][ruby-trunk - Feature #6310]
-
-Sun Jun 10 10:48:15 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * lib/openssl/ssl.rb: Use a simple random number to generate the
- session id. MD5, as was used before, causes problems when
- using a FIPS version of OpenSSL. Issue was found by Jared
- Jennings, thank you!
- [ruby-trunk - Bug #6137]
-
-Sun Jun 10 10:27:34 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * NEWS: Add note about the new private key export behavior.
-
-Sun Jun 10 10:24:51 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_exec_async_signal_safe): exported.
-
- * ext/pty/extconf.rb: modify $INCFLAGS to include internal.h
-
- * ext/pty/pty.c: include internal.h.
- (chfunc): don't call rb_thread_atfork_before_exec. use
- rb_exec_async_signal_safe instead of rb_f_exec.
- (establishShell): set up earg. use rb_fork_async_signal_safe
- instead of rb_fork_err.
-
- * internal.h (rb_exec_async_signal_safe): declared.
- (rb_fork_async_signal_safe): declared.
-
-Sun Jun 10 10:21:37 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * ext/openssl/ossl.c
- ext/openssl/ossl_pkey_rsa.c
- ext/openssl/ossl_pkey_dsa.c
- ext/openssl/ossl_pkey_ec.c: Forbid export passwords that are less
- than four characters long, as OpenSSL itself does not allow this.
- Issue found by Eric Hodel.
- * ext/openssl/ossl_pkey_ec.c: Add export as an alias of to_pem,
- following the PKey interface contract.
- * test/openssl/test_pkey_dsa.rb
- test/openssl/test_pkey_rsa.rb
- test/openssl/test_pkey_ec.rb: Add tests that assert correct
- behaviour when dealing with passwords that are less than four
- characters long.
- [ruby-core: 42281][ruby-trunk - Bug #5951]
-
-Sun Jun 10 10:14:26 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_f_exec): use rb_exec_arg_prepare.
-
-Sun Jun 10 06:43:51 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c: split after_exec into async-signal-safe part and rest.
- (after_exec_async_signal_safe): extracted from after_exec.
- (after_exec_non_async_signal_safe): ditto.
- (after_exec): call them.
- (rb_exec_async_signal_safe): call after_exec_async_signal_safe.
- (rb_exec_err): call after_exec_non_async_signal_safe instead of
- after_exec.
-
-Sun Jun 10 06:21:10 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * NEWS: document new features of Ruby OpenSSL.
-
-Sun Jun 10 03:09:41 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * ext/openssl/ossl.c: Fix error in example. Patch by David Albert.
-
- Add/extend existing documentation. Examples now also cover RSA
- signatures and PBKDF2.
- [ruby-core: 45154][ruby-trunk - Bug #6475]
-
-
-Sun Jun 10 01:41:45 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * ext/openssl/ossl_ssl.c: Introduce SSLContext#renegotiation_cb and
- remove SSLContext#disable_client_renegotiation and related
- functionality introduced in r35797. The new callback approach
- gives clients maximum flexibility to decide on their own what to
- do on renegotiation attempts.
- Add documentation for SSL module and SSLError.
- * test/openssl/test_ssl.rb: Add a test for
- SSLContext#renegotiation_cb.
-
-Sun Jun 10 01:37:18 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_fork_internal): initialize exc.
-
-Sun Jun 10 00:19:25 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c: don't use non async-signal-safe functions in a child
- process before exec, for invoking a command.
- (rb_exec_atfork): call rb_exec_async_signal_safe only.
- (retry_fork): take chfunc_is_async_signal_safe argument. call
- before_fork and after_fork only unless chfunc_is_async_signal_safe.
- (send_child_error): take chfunc_is_async_signal_safe argument.
- send an exception only unless chfunc_is_async_signal_safe.
- (recv_child_error): take chfunc_is_async_signal_safe argument.
- receive an exception only unless chfunc_is_async_signal_safe.
- (rb_fork_internal): renamed from rb_fork_err and take
- chfunc_is_async_signal_safe argument.
- use rb_protect only unless chfunc_is_async_signal_safe.
- (rb_fork_err): call rb_fork_internal with false as
- chfunc_is_async_signal_safe.
- (rb_fork_async_signal_safe): call rb_fork_internal with true as
- chfunc_is_async_signal_safe.
- (rb_spawn_process): call rb_fork_async_signal_safe instead of
- rb_fork_err.
-
-Sat Jun 9 23:57:03 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_fork_err): rewrite a complex "if" statement.
-
-Sat Jun 9 23:44:29 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (before_exec_async_signal_safe): extracted from
- before_exec.
- (before_exec_non_async_signal_safe): ditto.
- (before_exec): call before_exec_async_signal_safe and
- before_exec_non_async_signal_safe.
- (rb_exec_async_signal_safe): call before_exec_async_signal_safe.
- (rb_exec_err): call before_exec_non_async_signal_safe instead of
- before_exec.
-
-Sat Jun 9 23:36:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * iseq.c (iseq_load, insn_operand_intern, rb_iseq_disasm)
- (rb_iseq_parameters): use rb_id2str() instead of rb_id2name() to
- keep encoding.
-
- * string.c (rb_str_symname_p): new function that checks if the string
- is valid as a symbol name. split from sym_inspect().
-
-Sat Jun 9 22:27:05 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (retry_fork): rewrite a complex "for" statement by
- simple statements.
-
-Sat Jun 9 21:50:04 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (retry_fork): extracted from rb_fork_err.
- (send_child_error): ditto.
- (recv_child_error): ditto.
-
-Sat Jun 9 17:21:48 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * iseq.c (iseq_load): type is a symbol, and invalid as ID in common.
-
-Sat Jun 9 10:57:14 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_exec_async_signal_safe): extracted from rb_exec_err.
-
-Sat Jun 9 09:31:07 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c: simplified because close_others option is always
- enabled by default.
- (rb_f_exec): don't need to set the option.
- (rb_exec_arg_prepare): don't need to set the option. don't need
- default_close_others argument.
- (rb_spawn_internal): don't need to give default_close_others
- argument for rb_exec_arg_prepare. don't need default_close_others
- argument.
- (rb_spawn_err): don't need to give default_close_others
- argument for rb_spawn_internal.
- (rb_spawn): don't need to give default_close_others
- argument for rb_spawn_internal.
- (rb_f_system): don't need to give default_close_others argument for
- rb_spawn_internal.
- (rb_f_spawn): don't need to give default_close_others argument for
- rb_exec_arg_prepare.
-
-Sat Jun 9 09:00:58 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_proc_exec): call before_exec() here addition to
- rb_exec_err.
-
-Sat Jun 9 08:30:52 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * thread_pthread.c (ruby_init_stack): use stack info if possible.
-
-Sat Jun 9 08:21:32 2012 Eric Hodel <drbrain@segment7.net>
-
- * README.EXT (prepare extconf.rb): Added note to see MakeMakefile for
- documentation of extconf.rb functions. Patch by Zachary Scott.
- [ruby-trunk - Feature #6522]
- * README.EXT (Appendix C): Removed in favor of MakeMakefile.
- Patch by Zachary Scott.
- * lib/mkmf.rb: Merged documentation from README.EXT Appendix C. Patch
- by Zachary Scott.
-
-Sat Jun 9 08:16:47 2012 Eric Hodel <drbrain@segment7.net>
-
- * doc/re.rdoc: Completed wording in the description of the =~ operator.
- [ruby-trunk - Bug #6529]
-
-Sat Jun 9 08:09:38 2012 Eric Hodel <drbrain@segment7.net>
-
- * string.c (rb_str_start_with): Removed "p" from start_with? examples
- to match other String method examples. [ruby-trunk - Bug #6553]
- * string.c (rb_str_end_with): Updated end_with? to use code markup
- instead of italic.
-
-Sat Jun 9 07:56:03 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/benchmark.rb: Updated formatting of Benchmark documentation for
- consistency. [ruby-trunk - Bug #6533]
-
-Sat Jun 9 07:46:26 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/delegate.rb: Added documentation for Delegator#!. Patch by
- Zachary Scott. [ruby-trunk - Feature #6534]
-
-Sat Jun 9 07:39:50 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/net/http/responses.rb: Add RFC 6585 response codes. Patch by
- Sangil Jung. [ruby-trunk - Feature #6480]
- * lib/net/http/response.rb: ditto
- * lib/net/http.rb: ditto
- * lib/webrick/httpstatus.rb: ditto
-
-Sat Jun 9 01:24:28 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_exec_err): before_exec() call moved from proc_exec_cmd
- and proc_exec_sh.
- (rb_proc_exec): ditto.
-
-Sat Jun 9 01:11:07 2012 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/intern.h (rb_exec_arg_init): declaration changed to
- return a value.
-
- * process.c (rb_exec_arg_init): return a value.
-
-Fri Jun 8 23:44:14 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c: don't check the availability of FD_CLOEXEC. It should
- be available if fork() is available.
-
- * io.c: ditto.
-
-Fri Jun 8 22:39:32 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_fork_err): revert r35955. The condition needs !chfunc
- to close ep[0] and ep[1]. The catched exception is re-raised
- immediately after that if status is not NULL.
-
-Fri Jun 8 19:43:33 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_exec_err): after_exec() call moved from proc_exec_cmd
- and proc_exec_sh.
- (rb_proc_exec): ditto.
-
-Fri Jun 8 19:00:59 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (ARGV_COUNT): unused macro removed.
- (ARGV_SIZE): ditto.
- (ALLOC_ARGV): ditto.
- (ALLOC_ARGV_WITH_STR): ditto.
-
-Fri Jun 8 16:19:33 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/runner.rb (src_testdir): expand real path so that
- TestGem#test_self_find_files does not fail by aliased load path when
- srcdir contains a symbolic link.
-
- * tool/runruby.rb (srcdir): ditto.
-
-Fri Jun 8 12:04:39 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * process.c (rb_fork_err): error state in the child process is prior
- to exceptions in proc_syswait().
-
- * process.c (rb_fork_err): determine status on errors.
-
- * ext/pty/pty.c (establishShell): reraise exception if something
- raised during sleep.
-
- * ext/pty/pty.c (establishShell): now needs status to protect from
- exceptions in rb_fork_err().
-
-Thu Jun 7 22:13:05 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_fork_err): Fix the condition to use rb_protect.
-
-Thu Jun 7 20:29:12 2012 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/intern.h: rb_exec_arg and related stuff moved back from
- internal.h
-
-Thu Jun 7 15:53:03 2012 Koichi Sasada <ko1@atdot.net>
-
- * .gdbinit: add function `trace_machine_instructions' to trace
- in native machine assemble.
- See https://bugs.ruby-lang.org/projects/ruby-trunk/wiki/MachineInstructionsTraceWithGDB
- for more details.
-
-Wed Jun 6 21:31:21 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (proc_exec_cmd) renamed from proc_exec_v.
- (proc_exec_sh): renamed from rb_proc_exec_e.
- (proc_spawn_cmd_internal): renamed from proc_spawn_v.
- (proc_spawn_cmd): renamed from proc_spawn_n.
- (proc_spawn_sh): renamed from proc_spawn.
-
-Wed Jun 6 21:18:47 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * process.c (try_with_sh): please take care of the macro defined by
- you.
-
-Wed Jun 6 20:45:08 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (proc_exec_v): don't call dln_find_exe_r here because it
- is not async-signal-safe and proc_exec_v is called in a child
- process.
- command_abspath field of rb_exec_arg.
- (rb_exec_fillarg): call dln_find_exe_r and set command_abspath.
- (rb_exec_err): Give the absolute path of the invoking command for
- proc_exec_v, instead of the command name.
-
- * internal.h: add command_abspath field for rb_exec_arg.
-
-Wed Jun 6 20:08:01 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (try_with_sh): take envp argument.
- (exec_with_sh): ditto. use it for execve.
- (proc_exec_v): provide envp for try_with_sh.
-
-Wed Jun 6 13:25:04 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c, include/ruby/win32.h (rb_w32_wrap_io_handle): new API.
- this API wraps an I/O handle (HANDLE or SOCKET) and returns fd.
- the second parameter should be combination of O_*, for example,
- O_RDWR | O_BINARY | O_NOINHERIT.
-
- * win32/win32.c, include/ruby/win32.h (rb_w32_unwrap_io_handle): new
- API. this API unwraps an I/O handle and close the fd (not closes
- the handle itself).
-
- [Feature #4906] [ruby-core:37227]
-
-Wed Jun 6 13:18:26 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (rb_w32_close): of course, console handle is not socket.
-
-Wed Jun 6 12:37:43 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * process.c (rb_run_exec_options_err): allocate a temporary buffer for
- run_exec_dup2() for restoring fds on non-fork environments.
-
-Wed Jun 6 09:45:21 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/dl/test_c_{struct_entry,union_entity}.rb: sorry, typos.
-
-Wed Jun 6 05:27:54 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_exec_fillarg): check use_shell field before accessing
- a union field.
-
-Wed Jun 6 04:58:44 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_spawn_process): prog variable is not used for Unix.
-
-Wed Jun 6 00:20:37 2012 Tanaka Akira <akr@fsij.org>
-
- * internal.h (rb_exec_arg_init): change return type to void.
-
- * process.c (rb_exec_arg_init): don't return a value.
- (rb_exec_arg_prepare): ditto.
- (rb_spawn_process): don't take the prog argument. extract the
- information from earg.
- (rb_spawn_internal): follow rb_spawn_process change.
- (rb_f_spawn): ditto.
-
- * io.c (pipe_open): don't take the prog argument. extract the
- information from eargp.
- (pipe_open_v): follow pipe_open change.
- (pipe_open_s): ditto.
-
-Tue Jun 5 23:51:33 2012 Tanaka Akira <akr@fsij.org>
-
- * internal.h (rb_exec_arg): use union to represent command invocation
- with/without shell.
-
- * process.c: follow the rb_exec_arg change.
-
- * io.c (pipe_open): ditto.
-
-Tue Jun 5 22:28:46 2012 Tanaka Akira <akr@fsij.org>
-
- * internal.h: rb_exec_arg and related stuff moved from intern.h
-
- * include/ruby/intern.h (rb_proc_exec_n): removed.
-
-Tue Jun 5 21:57:22 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_exec_arg_fixup): allocate a temporary buffer for
- run_exec_dup2 here because it should be async-signal-safe.
- (run_exec_dup2): use the temporary buffer.
- (run_exec_dup2_tmpbuf_size): new function.
-
- * include/ruby/intern.h (rb_exec_arg): add dup2_tmpbuf field.
-
-Tue Jun 5 20:13:15 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * object.c (rb_obj_init_copy): should check if trusted too.
-
-Tue Jun 5 19:59:13 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (strtok): declaration removed because it is not used.
-
-Tue Jun 5 19:33:51 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (proc_spawn): don't detect simple command line here
- because rb_exec_fillarg already did.
-
-Tue Jun 5 19:21:10 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_exec_fillarg): bail out a loop eagerly.
-
-Tue Jun 5 19:15:14 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c: add comments about async-signal-safe.
-
- * io.c: ditto.
-
-Tue Jun 5 09:25:10 2012 Eric Hodel <drbrain@segment7.net>
-
- * io.c: Edited documentation for IO and File open and new and
- Kernel#open for consistency and clarity.
-
-Mon Jun 4 21:53:56 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (rb_w32_sysinit): let the system not display the
- critical-error-handler message box and the Windows Error Reporting
- dialog. [ruby-core:45389] [Bug #6535]
-
-Mon Jun 4 19:36:25 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_exec_fillarg): allocate one more element before
- beginning in argv_str for try_with_sh.
-
- * internal.h (ARGVSTR2ARGC): adjust for the above change.
- (ARGVSTR2ARGV): ditto.
-
-Mon Jun 4 19:17:06 2012 Tanaka Akira <akr@fsij.org>
-
- * internal.h (ARGVSTR2ARGC): defined.
- (ARGVSTR2ARGV): defined.
-
- * process.c (proc_exec_v): use ARGVSTR2ARGV.
- (rb_spawn_process): use ARGVSTR2ARGC and ARGVSTR2ARGV.
-
- * io.c (pipe_open): use ARGVSTR2ARGV.
-
-Mon Jun 4 16:13:00 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_insnhelper.h: remove magical code "lfp[0] & 0x02".
- Current VM doesn't use this bit.
-
- * vm_core.h (RUBY_VM_GET_BLOCK_PTR): added.
-
- * eval.c (rb_block_given_p): use RUBY_VM_GET_BLOCK_PTR().
-
- * vm_eval.c (rb_f_block_given_p): ditto.
-
-Mon Jun 4 15:39:33 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (constat_apply): apply VT100 functions.
- [ruby-core:44958] [Feature #6418]
-
- * win32/win32.c (constat_parse): parse some VT100 escape sequence.
-
-Mon Jun 4 14:06:12 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * process.c (rb_exec_err): should preserve errno.
-
-Mon Jun 4 13:10:11 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/dl/test_c_{struct_entry,union_entity}.rb: broken require.
-
-Mon Jun 4 12:01:21 2012 Koichi Sasada <ko1@atdot.net>
-
- * test/ruby/test_backtrace.rb: fix test.
- Windows path includes `:' character.
-
-Mon Jun 4 11:42:39 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_core.h (rb_location_t): fix type and field name.
- (1) rename rb_location_t to rb_iseq_location_t.
- (2) rename field names of rb_iseq_location_t to adjust
- RubyVM::Backtrace::Location methods.
- (2-1) filename -> path
- (2-2) filepath -> absolute_path
- (2-3) basename -> base_label
- (2-4) name -> label
- (3) rename filed name rb_iseq_location_t#line_no to
- rb_iseq_location_t#first_lineno to clear purpose of this field.
- (4) The field names rb_binding_t#(filename|line_no) are also renamed
- to rb_binding_t#(path|first_lineno).
-
- * compile.c: apply above changes.
-
- * iseq.c: ditto.
-
- * proc.c: ditto.
-
- * vm*.c: ditto.
-
-Mon Jun 4 11:40:28 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * marshal.c (r_object0): also load TYPE_USRMARSHAL, TYPE_DATA using
- compatible loader.
-
-Mon Jun 4 11:33:42 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * process.c (rb_run_exec_options_err): restore save_env() call for
- non-fork environments.
-
- * process.c (rb_exec_err): restore environments after the failure of
- exec to fix [ruby-core:44093] [Bug #6249] on non-fork environments
-
-Mon Jun 4 10:42:04 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * io.c (pipe_open): follow up changes in r35889.
-
- * process.c (proc_spawn_n): now uses char ** instead of VALUE *.
-
- * process.c (rb_spawn_process): prog is now VALUE of String, not char *.
-
-Mon Jun 4 06:12:43 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * marshal.c (r_object0): remove old warning for _alloc.
-
-Mon Jun 4 04:24:06 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * marshal.c: experimental test aborted.
- * complex.c: ditto.
- * rational.c: ditto.
- * include/ruby/intern.h: ditto.
-
-Mon Jun 4 00:45:18 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_spawn_process): fix for Windows. not tested.
-
-Mon Jun 4 00:11:51 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_proc_exec_e): don't use ISSPACE(). \f, \r and \v
- are not word separator in Bourne shell.
-
-Sun Jun 3 23:47:30 2012 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/intern.h (rb_exec_arg): remove argc and argv fields.
- add use_shell, argv_str and argv_buf fields.
-
- * process.c (rb_proc_exec_e): don't split shell command line arguments
- here to avoid memory allocation in a child process.
- (rb_exec_fillarg): split shell command line arguments here.
- (proc_exec_v): takes argv_str argument instead of argv.
- (rb_proc_exec_ne): removed.
- (rb_proc_exec_n): removed.
- (rb_run_exec_options_err): don't initialize the removed fields.
- (rb_exec_err): don't initialize the removed fields.
- call proc_exec_v directly instead of rb_proc_exec_ne.
- (rb_spawn_process): use use_shell field.
-
-Sun Jun 3 21:53:00 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * GPL: update text of GPLv2. [ruby-core:44488] [Bug #6328]
- http://www.gnu.org/licenses/gpl-2.0.txt
-
-Sun Jun 3 21:22:52 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_exec_getargs): remove rb_exec_arg argument.
-
-Sun Jun 3 21:14:26 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * marshal.c: calls directly rb_{Complex,Rational}_marshal_load().
- But now disabled. [experimental]
- * complex.c: followed the above.
- * rational.c: ditto.
- * include/ruby/intern.h: ditto.
-
-Sun Jun 3 21:18:17 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_check_argv): use rb_str_new_frozen instead of
- rb_str_new4.
-
-Sun Jun 3 20:10:52 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_proc_exec_e): extended version of rb_proc_exec() to
- call execle().
- (rb_proc_exec): use rb_proc_exec_e().
- (rb_exec_err): use rb_proc_exec_e().
-
-Sun Jun 3 19:47:18 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * thread.c (vm_living_thread_num): suppress a warning.
-
-Sun Jun 3 17:23:52 2012 Tanaka Akira <akr@fsij.org>
-
- * use execve() to preserve environment variables when exec method is
- failed. [ruby-core:44093] [ruby-trunk - Bug #6249]
-
- * include/ruby/intern.h (rb_exec_arg): add envp_str and envp_buf field
- to store envp of execve().
-
- * process.c (proc_exec_v): takes envp_str as an argument and use it
- for execve().
- (rb_proc_exec_ne): extended version of rb_proc_exec_n().
- (rb_proc_exec_n): use rb_proc_exec_ne().
- (rb_proc_exec): follow proc_exec_v() change.
- (fill_envp_buf_i): new function.
- (rb_exec_arg_fixup): set up envp_str and envp_buf.
- (save_env_i): removed.
- (save_env): removed.
- (rb_run_exec_options_err): don't modify environment variables.
- (rb_exec_err): use rb_proc_exec_ne().
-
-Sun Jun 3 16:33:58 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * marshal.c: revert r35879 "now marshal_{load|dump} are external."
-
- * complex.c (nucomp_marshal__{dump,load}): should use rb_marshal_{dump,load}.
-
- * rational.c (nurat_marshal__{dump,load}): ditto.
-
-Sun Jun 3 14:13:58 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_core.c: checks whether the object is frozen or not.
-
-Sun Jun 3 14:00:51 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * complex.c: wrote Complex#_dump and Complex::load. But now
- disabled (due to compatibility) [experimental].
-
- * rational.c: wrote Rational#_dump and Rational::load. ditto.
-
-Sun Jun 3 10:23:32 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * complex.c (nucomp_marshal_load): [ruby-core:45394]
- * rational.c (nurat_marshal_load): ditto.
-
-Sun Jun 3 03:15:46 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * regparse.c (onig_number_of_names): suppress a warning.
-
-Sun Jun 3 01:36:52 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_backtrace.c: change names.
- (1) Class name: RubyVM::FrameInfo -> RubyVM::Backtrace::Location.
- (2) Method name: RubyVM::FrameInfo.caller ->
- Kernel.caller_locations.
- (3) Instance methods of
- RubyVM::FrameInfo (RubyVM::Backtrace::Location)
- (3-1) name -> label
- (3-2) basename -> base_label (basename is confusing with
- File.basename)
- (3-3) line_no -> lineno (We have already similar name
- File#lineno, commented by kou [ruby-dev:45686]).
- (3-4) filename -> path.
- (3-5) filepath -> absolute_path.
- (3-5) iseq -> removed (we will make other APIs to access iseq
- and other information of frame for debugging).
-
- * test/ruby/test_backtrace.rb: apply above changes.
- And apply comment from kou [ruby-dev:45686].
-
-Sun Jun 3 00:49:11 2012 Koichi Sasada <ko1@atdot.net>
-
- * common.mk: fix to build vm_backtrace.c only itself (vm_backtrace.c
- is no longer included from vm.c). I hope this separation reduce
- compile time of vm.c.
-
- * internal.h: ditto.
-
- * vm.c, vm_core.h, vm_dump.c, vm_eval.c: ditto.
-
- * vm_eval.c: some functions (callee, etc) moved to vm_backtrace.c.
-
-Sun Jun 3 00:20:53 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm_backtrace.c: added. Separate backtrace related functions to
- this file.
-
- * vm.c, common.mk: ditto.
-
-Sat Jun 2 18:09:02 2012 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/ipaddr.rb: Inhibit zero-filled octets in an IPv4 address in
- all platforms. [ruby-dev:45671]
-
- * lib/ipaddr.rb: Allow the x:x:x:x:x:x:d.d.d.d form not limited to
- IPv4 mapped/compatible addresses. This change also makes it
- possible for the parser to understand IPv4 mapped and compatible
- IPv6 addresses in non-compressed form.
-
- * lib/ipaddr.rb: Stop exposing IPSocket.valid*? methods which were
- only usable on non-IPv6-ready platforms.
-
-Sat Jun 2 16:59:00 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * string.c (rb_enc_cr_str_buf_cat): don't reset coderange as unknown.
- the condition 'ptr_a8 && str_cr != ENC_CODERANGE_7BIT' means not
- unknown, str is also ASCII-8BIT because str_encindex == ptr_encindex,
- and nont (str_cr == ENC_CODERANGE_UNKNOWN) and
- str_cr != ENC_CODERANGE_7BIT means str_cr is valid because ASCII-8BIT
- can't be broken. [ruby-dev:45688] [Bug #6509]
-
-Sat Jun 2 07:04:48 2012 Eric Hodel <drbrain@segment7.net>
-
- * doc/re.rdoc (Performance): Replaced incorrect example of reducing
- backtracking through anchoring with reduced backtracking through a
- range. [ruby-trunk - Bug #6525]
-
-Sat Jun 2 06:34:15 2012 Eric Hodel <drbrain@segment7.net>
-
- * doc/re.rdoc (Performance): Removed useless sample output from final
- performance example and switched from #match to #=~ for consistency.
- [ruby-trunk - Bug #6524]
-
-Fri Jun 1 09:30:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * object.c (class_or_module_required): extract check for class or
- module.
-
-Fri Jun 1 08:50:47 2012 Eric Hodel <drbrain@segment7.net>
-
- * array.c: Updated Array documentation formatting. Patch by Zachary
- Scott. [ruby-trunk - Feature #6517]
-
-Fri Jun 1 06:57:10 2012 Eric Hodel <drbrain@segment7.net>
-
- * ext/dl/lib/dl/struct.rb (DL::CStructEntity#set_ctypes): Refactored
- #set_ctypes using newer ruby features to simplify its implementation.
- * test/dl/test_c_struct_entry.rb (class DL): Test to verify
- refactoring.
-
-Fri Jun 1 06:40:25 2012 Eric Hodel <drbrain@segment7.net>
-
- * object.c (Init_Object): Restored Kernel documentation based on
- Pickaxe book documentation. Patch by Zachary Scott.
- [ruby-trunk - Feature #6521]
-
-Fri Jun 1 06:29:42 2012 Eric Hodel <drbrain@segment7.net>
-
- * object.c (rb_equal): Let Object be a link in #=== documentation.
- Patch by Zachary Scott. [ruby-trunk - Feature #6518]
-
-Thu May 31 09:27:06 2012 Eric Hodel <drbrain@segment7.net>
-
- * ext/dl/lib/dl/struct.rb (DL::CStructEntity::size): Refactored ::size
- to remove unused variables and simplify using newer ruby features.
- * test/dl/test_c_struct_entry.rb: Test to validate refactoring
-
-Thu May 31 08:40:34 2012 Eric Hodel <drbrain@segment7.net>
-
- * ext/dl/lib/dl/struct.rb (DL::CUnionEntity#set_ctypes): Refactored
- #set_types to reuse DL::CUnionEntity::size
- * test/dl/test_c_union_entity.rb: Added test
-
-Thu May 31 08:20:14 2012 Eric Hodel <drbrain@segment7.net>
-
- * ext/dl/lib/dl/struct.rb (DL::CUnionEntity::size): Fixed ::size to
- return the size of the union.
- * test/dl/test_c_union_entity.rb: Test for DL::CUnionEntity::size
-
-Thu May 31 07:45:43 2012 Eric Hodel <drbrain@segment7.net>
-
- * ext/dl: Added documentation. Patch by Vincent Batts.
- [ruby-trunk - Bug #6496]
-
-Wed May 30 16:30:00 2012 Kenta Murata <mrkn@cookpad.com>
-
- * ext/bigdecimal/lib/bigdecimal/jacobian.rb,
- ext/bigdecimal/lib/bigdecimal/newton.rb:
- fix documentation comments.
- Patch by alperakgun from github.com/shyouhei/ruby/pull/8
-
-Wed May 30 16:20:00 2012 Kenta Murata <mrkn@cookpad.com>
-
- * ext/bigdecimal/lib/bigdecimal/jacobian.rb (Jacobian#dfdxi):
- fix jacobian to get stuck in an infinite loop when a solution is not
- found due to forget to increment nRetry counter.
- Patch by alperakgun from github.com/shyouhei/ruby/pull/8
-
-Wed May 30 10:58:31 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * time.c (utc_offset_arg): utc offset can be precision in seconds.
- e.g. old Europe/Lisbon (c.f. [ruby-dev:40066])
-
-Wed May 30 06:20:29 2012 Eric Hodel <drbrain@segment7.net>
-
- * error.c (exc_set_backtrace): Updated documentation to indicate
- set_backtrace allows a string as well as an array of strings.
- [ruby-trunk - Bug #6501]
-
-Tue May 29 17:28:20 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * strftime.c (rb_strftime_with_timespec): support GNU extension triple
- colons modifier. [EXPERIMENTAL]
-
- * strftime.c (rb_strftime_with_timespec): check conversion with locale
- modifier.
-
- * strftime.c (rb_strftime_with_timespec): colons are valid only for
- 'z' and must come just before it.
-
-Mon May 28 16:56:55 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/test/unit.rb (Test::Unit::Runner#_prepare_run): StatusLineOutput
- needs job_status to be :replace.
-
-Mon May 28 13:35:33 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * common.mk (do-install-*): fix dependencies. based on the patch by
- nagachika at [ruby-dev:45683]. [Bug #6506]
-
-Mon May 28 12:03:04 2012 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c (obj_free): doesn't free a method table if it doesn't
- exist. [ruby-dev:44436]
- * test/ruby/test_gc.rb (class TestGc): added the test case for
- this issue.
-
-Sun May 27 23:37:48 2012 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/bm_vm1_lvar_init.rb: added.
- This benchmark measures a initialize time of non-used variable.
-
- * benchmark/bm_vm1_lvar_set.rb: added.
- This benchmark measures a local variables initialization time.
-
- * benchmark/bm_vm2_bigarray.rb: added.
- This benchmark mesures a big array literal creation time.
-
- * benchmark/bm_vm2_bighash.rb: added.
- This benchmark mesures a big hash literal creation time.
-
- * benchmark/bm*: change notation "i=0" to "i = 0".
-
-Sun May 27 13:33:26 2012 Koichi Sasada <ko1@atdot.net>
-
- * benchmark/driver.rb: fix to continue benchmarks when
- an error is occurred.
-
-Sun May 27 11:27:50 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/test/unit.rb (Test::Unit::Runner#_prepare_run): fix operator
- precedence, so that platform and TERM should be counted.
-
-Sun May 27 10:02:33 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_strftime.c: allows %Ok and %Ol.
-
-Sun May 27 09:29:20 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_core.c: modified doc.
-
-Sat May 26 19:04:34 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_core.c: added description.
-
-Sat May 26 18:14:57 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_strftime.c: reduced the code.
-
-Sat May 26 18:08:59 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * time.c: modified doc.
- * ext/date/date_core.c: ditto.
-
-Sat May 26 17:05:45 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm.c (backtrace_*): change type of lev and n from size_t to int.
- Also set type of rb_backtrace_t#backtrace_size to int.
- A patch from nobu.
-
- * vm_eval.c: ditto.
-
-Sat May 26 16:26:30 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (realpath_rec): UNC prefix does not end with path separator,
- so new separator is needed after it.
-
-Sat May 26 15:29:22 2012 Koichi Sasada <ko1@atdot.net>
-
- * test/ruby/test_backtrace.rb (test_caller_lev):
- decrease recursion size.
-
-Sat May 26 13:50:48 2012 Koichi Sasada <ko1@atdot.net>
-
- * NEWS: add Kernel#caller's second argument.
-
-Sat May 26 13:40:29 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm.c (RubyVM::FrameInfo): add a class to access each frame
- information. You don't need to parse strings from caller().
- FrameInfo has the following methods:
- FrameInfo#name: method name, class name, etc with decorations.
- FrameInfo#basename: name without decorations.
- FrameInfo#line_no: line number.
- FrameInfo#filename: file name.
- FrameInfo#filepath: full filepath.
- FrameInfo#iseq: iseq if it is iseq frame (defined by ruby script)
- FrameInfo#to_s: return caller() method style string.
- RubyVM::FrameInfo.caller(n, lev) returns array of FrameInfo objects.
- The name "RubyVM::FrameInfo.caller" is long and ambiguous (it is
- confusing with Kernel::caller() method), we need to change the name
- before Ruby 2.0 release. Good names or comments are welcome.
-
- * test/ruby/test_backtrace.rb: add a test for above change.
-
-Sat May 26 12:18:09 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm.c (frame_info_to_str): add `break'.
-
- * vm.c (backtrace_object): remove lev and n parameter.
- backtrace_object always returns all of backtrace information.
-
- * vm.c (rb_backtrace_to_str_ary): fix to use backtrace_object().
- This change improve performance of caller(lev, n).
-
- * benchmark/bm_vm3_backtrace.rb: added to check above improvement.
- FYI: measurement on my laptop, 1.9.3p229 needs 5.125 sec,
- and current trunk only needs 0.299sec.
-
-Sat May 26 11:05:09 2012 Koichi Sasada <ko1@atdot.net>
-
- * vm.c (rb_frame_info_t): keep previous ISEQ frame info for CFUNC
- frame info. And fix to cache a calculated line_no of ISEQ frame
- info.
-
-Sat May 26 09:54:53 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * ext/openssl/ossl_ssl.c: Allow disabling client-side renegotiation.
- * test/openssl/test_ssl.rb: Simple tests for this.
-
- Client-side renegotiation is still considered problematic, even
- when used in the context of secure renegotiation (RI, RFC 5746).
- The changes allow users to either completely disable client
- renegotiation on the server, or to specify a maximum number of
- handshakes allowed in total. The number of total handshakes is
- counted in a callback set as SSL_set_info_callback. If the
- maximum number of handshakes is exceeded an error will be raised
- We do not support renegotiation in the OpenSSL extension, therefore
- this feature can only be tested externally.
- The feature is opt-in, the default setting will be to allow
- unlimited client renegotiation, as was the case before.
-
-Fri May 25 23:38:58 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * test/openssl/test_ssl.rb: Clarify the intention of errors to be
- expected. Two errors are possible when connection is refused due
- to a protocol version that was explicitly disallowed,
- OpenSSL::SSL::SSLError or Errno::ECONNRESET, depending on the
- OpenSSL version in use.
-
-Fri May 25 22:19:40 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * vm_method.c: ditto.
- * ext/openssl/ossl_ssl.c: Revert r35583
- * test/openssl/test_ssl.rb: Handle ECONNRESET in code instead to avoid
- the test failing in Ruby CI [1]
+Wed Mar 26 13:25:54 2014 NARUSE, Yui <naruse@ruby-lang.org>
- [1] http://u64.rubyci.org/~chkbuild/ruby-trunk/log/20120507T190102Z.log.html.gz#test-all
+ * addr2line.c (fill_lines): loop reverse order not to overwrite
+ the basis of base addresses comparison.
-Fri May 25 19:51:36 2012 Koichi Sasada <ko1@atdot.net>
+ * addr2line.c: use uintptr_t instead of intptr_t for pointers.
- * vm_eval.c (rb_f_caller): caller() method accepts second optional
- argument `n' which specify how many frames should return.
- For example, `caller(0, 1)' returns only one frame information
- which calls caller() method. If there are less than n frame
- information, then all frame information are returned. If n is 0,
- then always return [].
- This fix is part of [ruby-dev:42345] [Ruby 1.9-Feature#3917].
- However, performance and features are not enough.
- RDoc is also not available.
+ * addr2line.c (rb_dump_backtrace_with_lines): don't use syms.
- * test/ruby/test_backtrace.rb: add a test for above.
+ * vm_dump.c (rb_print_backtrace): ditto.
-Fri May 25 17:05:07 2012 Koichi Sasada <ko1@atdot.net>
+ * addr2line.h: ditto.
- * vm.c (oldbt_init, vm_backtrace_str_ary): arg->data should
- be initialized before calling `backtrace_each()'.
+Wed Mar 26 11:20:50 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri May 25 16:11:27 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * marshal.c (w_object): internal objects are not dumpable.
+ [ruby-core:61677] [Bug #9674]
- * trunk/ext/-test-/printf/printf.c: change function names because of
- conflict with msvcrt. fixed build error of mswin.
+ * ext/thread/thread.c (undumpable): ConditionVariable and Queue
+ are not dumpable. [ruby-core:61677] [Bug #9674]
-Fri May 25 10:52:52 2012 Koichi Sasada <ko1@atdot.net>
+Wed Mar 26 10:36:39 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * vm.c: refactoring backtrace related functions.
- (1) unify similar functions (rb_backtrace_each() and
- backtrace_object()). backtrace_each() is a unified function.
- variation:
- a) backtrace_object(): create backtrace object.
- b) vm_backtrace_str_ary(): create bt as an array of string.
- c) vm_backtrace_print(): print backtrace to specified file.
- d) rb_backtrace_print_as_bugreport(): print backtrace on
- bugreport style.
- (2) remove rb_backtrace_each(). Use backtrace_each() instead.
- (3) change the type of lev parameter to size_t.
- a) lev == 0 means current frame (exception, etc use it).
- b) lev == 1 means upper frame (caller(0) use it).
+ * addr2line.c (follow_debuglink): show message if it closes opened
+ (and maybe used) elf binary.
- * vm_core.h, vm_dump.c, vm_eval.c: ditto.
+Wed Mar 26 10:34:25 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * vm.c (backtrace_object(), vm_backtrace_str_ary()): fix to return a
- correct size of caller(lev) array.
- Let n be a "caller(0).size" then ln as caller(lev).size should be
- (n - lev). However, the previous implementation returns a wrong
- size array (ln > n - lev). [ruby-dev:45673]
+ * addr2line.c (fill_line): pass and use offset instead of
+ curobj_baseaddr.
- * test/ruby/test_backtrace.rb: add tests for backtrace.
+Wed Mar 26 09:07:48 2014 Yutaka Kanemoto <kanemoto@ruby-lang.org>
-Fri May 25 08:51:39 2012 Eric Hodel <drbrain@segment7.net>
+ * configure.in: add --disable-pie. [Feature #9673]
- * enum.c (enum_count): Enumerable#count no longer uses #size when
- counting elements. Patch by Nobuhiro IMAI. [ruby-trunk - Bug #6473]
+Wed Mar 26 08:47:04 2014 NARUSE, Yui <naruse@ruby-lang.org>
-Fri May 25 01:15:39 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * addr2line.c (fill_lines): don't run fill_lines multiple times.
- * sprintf.c (ruby__sfvextra): [EXPERIMENTAL] use inspect instead of
- to_s if plus flag is given.
+Wed Mar 26 08:45:00 2014 Sam Rawlins <sam.rawlins@gmail.com>
- * vsnprintf.c (BSD_vfprintf): pass sign flag.
+ * internal.h: add prototype for rb_reg_search0
-Fri May 25 00:37:22 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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.
- * test/rubygems/test_gem_indexer.rb (setup, teardown): save @tempdir
- to remove it properly. [Bug #5348]
+ * string.c: don't allocate backref str if replacement string is provided
-Thu May 24 23:36:51 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ [GH-578] [Bug #9676] [ruby-core:61682]
- * vsnprintf.c (BSD_vfprintf): [EXPERIMENTAL] object representation in
- rb_enc_vsprintf(). [Feature #5896]
+Wed Mar 26 08:29:43 2014 mo khan <mo@mokhan.ca>
-Thu May 24 15:33:01 2012 Koichi Sasada <ko1@atdot.net>
+ * lib/rubygems.rb: fix spelling of Jim Weirich. [Fixes GH-577]
- * vm_method.c (rb_method_defined_by): removed.
- nobu pointed out that rb_method_basic_definition_p() is enough
- for last commit.
+Wed Mar 26 01:55:45 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * error.c, eval_error.c: change for above.
+ * 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.
-Thu May 24 14:30:13 2012 Koichi Sasada <ko1@atdot.net>
+Wed Mar 26 01:34:50 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * vm.c: add RubyVM::Backtrace object (btobj).
- Backtrace information contains an array consists of location
- information for each frames by string.
- RubyVM::Backtrace object is lightweight backtrace information,
- which contains complete information to generate traditional style
- backtrace (an array of strings) with faster generation.
- If someone accesses to backtrace information via
- Exception#backtrace, then convert a RubyVM::Backtrace object to
- traditional style backtrace.
- This change causes incompatibility on marshal dumped binary
- of Exception. If you have any trouble on it, please tell us
- before Ruby 2.0 release.
- Note that RubyVM::Backtrace object should not expose Ruby level.
+ * addr2line.c (fill_lines): skip if path is NULL.
- * error.c, eval.c, vm_eval.c: ditto.
+Tue Mar 25 23:57:17 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * internal.h: ditto.
+ * parse.y (parser_yylex): only a newline after label should be
+ significant. [ruby-core:61658] [Bug #9669]
- * eval_error.c: fix to skip "set_backtrace" method invocation in
- creating an exception object if it call a normal set_backtrace
- method (defined by core).
+Tue Mar 25 23:32:25 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * test/ruby/test_settracefunc.rb: fix for above change.
+ * ext/pathname/lib/pathname.rb (Pathname#join): remove unnecessary
+ unshift.
- * vm_method.c (rb_method_defined_by): added. This function
- checks that the given object responds with the given method
- by the given cfunc.
+ * test/pathname/test_pathname.rb (TestPathname#test_join): add tests.
- * benchmark/bm_vm2_raise1.rb, benchmark/bm_vm2_raise2.rb:
- add to measure exception creation speed. raise1 create
- exception objects from shallow stack frame. raise2 create
- exception objects from deep stack frame.
+Tue Mar 25 16:47:36 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu May 24 12:07:46 2012 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]
- * io.c (io_strip_bom): check EOF. [Bug #6487][ruby-core:45203]
+Mon Mar 24 22:19:56 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed May 23 22:06:14 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * parse.y (ripper_initialize): filename can not be modified.
- * lib/net/http/header.rb (Net::HTTPHeader#range): fix broken parser of
- HTTP Range request. Old one can't parse invalid specs and multiple
- specs correctly.
+Mon Mar 24 15:19:47 2014 NARUSE, Yui <naruse@ruby-lang.org>
-Wed May 23 10:18:54 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * addr2line.c (rb_dump_backtrace_with_lines): fetch path of the
+ executable from /proc/self/exe on Linux.
- * win32/win32.c (finish_overlapped_socket, overlapped_socket_io):
- replace ECONNABORTED to EPIPE in send, sendto and sendmsg to improve
- BSD socket compatibility. this change removes a failure on the test
- of net/ftp.
+Mon Mar 24 14:14:37 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Wed May 23 05:35:58 2012 Eric Hodel <drbrain@segment7.net>
+ * gc.c: Fix up default GC params by @csfrancis [fix GH-556]
- * lib/net/http.rb: Broke up Net::HTTP into individual files.
- [ruby-trunk - Feature #6435]
- * lib/net/http/backward.rb: ditto.
- * lib/net/http/response.rb: ditto.
- * lib/net/http/exceptions.rb: ditto.
- * lib/net/http/responses.rb: ditto.
- * lib/net/http/generic_request.rb: ditto.
- * lib/net/http/header.rb: ditto.
- * lib/net/http/request.rb: ditto.
- * lib/net/http/proxy_delta.rb: ditto.
- * lib/net/http/requests.rb: ditto.
+Mon Mar 24 13:13:36 2014 NARUSE, Yui <naruse@ruby-lang.org>
-Wed May 23 05:15:11 2012 Eric Hodel <drbrain@segment7.net>
+ * 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]
- * class.c (rb_mod_init_copy): Clear the cached inspect string of a
- dup'd anonymous module or class. [ruby-trunk - Bug #6454]
- * test/ruby/test_module.rb (class TestModule): ditto
+Sun Mar 23 11:03:50 2014 Kohei Suzuki <eagletmt@gmail.com>
-Tue May 22 16:49:15 2012 Koichi Sasada <ko1@atdot.net>
+ * 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]
- * vm_core.h: add a data type rb_location_t to store iseq location
- information.
- rb_location_t#filename, filepath, name and line_no was moved from
- rb_iseq_t. rb_location_t#basename is a new field which is
- similar to `name' field without any decoration.
- `name' field contains some decoration such as `block in foo'.
- `basename' only contains `foo'.
- rb_iseq_t contains memory object of rb_location_t.
+Sun Mar 23 08:12:27 2014 Eric Wong <e@80x24.org>
- * iseq.c: setup rb_location_t for each rb_iseq_t memory objects.
+ * 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
- * compile.c, proc.c, vm.c, vm_dump.c, vm_eval.c, vm_insnhelper.c,
- vm_method.c: support about it.
+Sat Mar 22 22:56:45 2014 NARUSE, Yui <naruse@ruby-lang.org>
-Tue May 22 00:45:05 2012 Yusuke Endoh <mame@tsg.ne.jp>
+ * addr2line.c (fill_lines): compare the file names of object in which
+ symbols exist. [Bug #9654] [ruby-dev:48058]
- * struct.c (rb_struct_members): Refactoring. As Struct#members had
- returned an array of String, the old code was needed to convert
- Symbols to Strings. But it is almost unnecessary because the
- method now returns an array of Symbols. A patch by Masaki
- Matsushita <glass.saga at gmail dot com> [Feature #6218]
- [ruby-dev:45451]
+Sat Mar 22 06:46:16 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon May 21 19:20:25 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * lib/cgi/util.rb (escape_html, unescape_html): make synonyms
+ aliases instead of wrapper methods.
- * lib/net/ftp.rb (Net::FTP#retrbinary): close only if conn is not nil
- because transfercmd may fail and return nil.
+ * lib/cgi/util.rb (escape_element, unescape_element): ditto.
+ [Fixes GH-573]
- * lib/net/ftp.rb (Net::FTP#retrlines): ditto.
+Fri Mar 21 21:57:34 2014 Akinori MUSHA <knu@iDaemons.org>
-Mon May 21 15:10:28 2012 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
- * ext/syslog/syslog.c: Classify constants and macros into several
- sub-modules. (Syslog::Priority, Syslog::Level, Syslog::Option
- and Syslog::Macros)
+Fri Mar 21 16:31:56 2014 Zachary Scott <e@zzak.io>
- * ext/syslog/syslog.c (mSyslog_inspect): Use rb_sprintf().
+ * gc.c: [DOC] Fix call-seq for GC.start by @jasonrclark [Fixes GH-572]
+ https://github.com/ruby/ruby/pull/572
- * ext/syslog/syslog.c (mSyslog_inspect): Make sure self is a
- module before calling rb_class2name().
+Thu Mar 20 11:37:28 2014 James Edward Gray II <james@graysoftinc.com>
-Mon May 21 12:44:11 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
+ * 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]
- * .travis.yml (install): It seems tcl/tk is skipped in Travis
- CI. Trying to fix the situation.
+Thu Mar 20 16:53:07 2014 Koichi Sasada <ko1@atdot.net>
-Mon May 21 12:11:25 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c (objspace_malloc_increase): should not invoke
+ garbage_collect_with_gvl() here on non-ruby threads.
- * enc/depend (ENCOBJS): add dependencies.
+ Should just ignore the malloc_increase.
- * enc/make_encmake.rb (target_encodings): extract dependencies.
+ This issue is pointed by Eric Wong [ruby-core:61519].
-Mon May 21 11:26:17 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Thu Mar 20 13:05:16 2014 Koichi Sasada <ko1@atdot.net>
- * lib/net/ftp.rb (Net::FTP#transfercmd): rescue shutdown.
+ * struct.c (rb_struct_alloc): use RARRAY_CONST_PTR() instead of
+ RARRAY_PTR().
-Sun May 20 23:00:11 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Mar 20 12:59:39 2014 Koichi Sasada <ko1@atdot.net>
- * ext/extmk.rb (extmake): reopen $stdout to NULL, since setting
- $stdout cannot affect child processes.
+ * 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.
-Sun May 20 21:36:39 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * eval.c, object.c: ditto.
- * enc/shift_jis.c (code_to_mbclen): return
- ONIGERR_INVALID_CODE_POINT_VALUE if the code is invalid.
+Thu Mar 20 12:31:26 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * string.c (tr_next): increment character until the code
- is a valid character. [ruby-dev:45652] [Bug #6450]
+ * 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]
-Sun May 20 12:25:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Mar 19 17:13:06 2014 Eric Wong <e@80x24.org>
- * Makefile.in (LIBRUBY_SO): link EXTSOLIBS too.
+ * 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]
- * ext/extmk.rb (mf.macro): use EXTSOLIBS instead of SOLIBS to get rid
- of discard libraries needed by default. [Bug #6462]
+Tue Mar 18 23:20:12 2014 Shota Fukumori <her@sorah.jp>
-Sat May 19 19:04:38 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm_eval.c (eval_string_with_cref): Unify to use NIL_P.
- * ext/extmk.rb (command_output): ENCOBJS is needed for all linked
- ruby, if --disable-shared and --with-static-linked-ext.
+Tue Mar 18 22:03:41 2014 Shota Fukumori <her@sorah.jp>
- * ext/extmk.rb (command_output): dmyext is needed as DLDOBJS if no
- static linked extensions.
+ * vm_eval.c (eval_string_with_cref): Use file path even if scope is
+ given. Related to [ruby-core:56099] [Bug #8662] and r42103.
- * Makefile.in, common.mk (PROGRAM): no extension libraries.
+Mon Mar 17 13:17:47 2014 Koichi Sasada <ko1@atdot.net>
- * common.mk (build-ext): pass macros for libruby.so.
+ * enumerator.c (enumerator_block_call): use RARRAY_CONST_PTR()
+ instead of RARRAY_PTR().
- * ext/extmk.rb (command_output): link extension libraries and encoding
- libraries into libruby.so, not ruby executable.
+ * io.c (rb_io_s_popen): ditto.
- * ext/extmk.rb (command_output): fold long macro lines.
+ * numeric.c (num_step_size): ditto.
- * Makefile.in (LIBEXT): add macro.
+ * vm_eval.c (rb_apply): ditto.
- * configure.in (ENCOBJS, EXTOBJS): use LIBEXT, not hardcoded suffix.
+ * vm_eval.c (rb_eval_cmd): ditto.
- * Makefile.in (LIBRUBY_A): fix typo. re-applying r35242.
+Mon Mar 17 10:11:59 2014 Eric Wong <e@80x24.org>
-Sat May 19 04:46:53 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * variable.c (rb_const_set): delete existing entry on redefinition
+ [Bug #9645]
+ * test/ruby/test_const.rb (test_redefinition): test for leak
- * ext/openssl/extconf.rb: Use Logging::message instead of message.
- * ext/zlib/extconf.rb: ditto.
+Sun Mar 16 21:33:01 2014 Zachary Scott <e@zzak.io>
-Fri May 18 18:13:44 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/time.rb: [DOC] Fix timezone in example of Time.parse [Bug #9521]
+ Based on patch by @stomar
- * lib/mkmf.rb (MakeMakefile#configuration): keep space at end of
- OUTFLAG and COUTFLAG. [ruby-dev:45650]
+Sun Mar 16 13:21:40 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri May 18 17:39:42 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * configure.in (DLDFLAGS): insert a space between option and its
+ argument for non-GCC compilers. [ruby-core:61429] [Bug #9624]
- * thread_pthread.c (rb_thread_create_timer_thread): Added error
- check when failing fcntl(). [Bug #6147] [ruby-dev:45364]
+Sun Mar 16 08:05:06 2014 Eric Wong <e@80x24.org>
-Fri May 18 17:41:00 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c (objspace_xcalloc): fix GC accounting
- * ext/extmk.rb (extmake): link archives only, skip script only
- extension libraries.
+Sun Mar 16 06:33:35 2014 NARUSE, Yui <naruse@ruby-lang.org>
-Fri May 18 17:25:33 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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.
- * cont.c: bump up fiber machine stack size when running on 64bit
- arch. [Bug #6344] [ruby-dev:45554]
+Sun Mar 16 05:51:55 2014 Zachary Scott <e@zzak.io>
-Fri May 18 15:20:56 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * lib/gserver.rb: [DOC] Fixed typo in example by @stomar [Bug #9543]
- * lib/uri/generic.rb (URI::Generic.build): duplicate args before adding
- new items. (don't change arguments)
+Sat Mar 15 18:54:03 2014 Kazuki Tsujimoto <kazuki@callcc.net>
- * lib/uri/generic.rb (URI::Generic.build): use URI::Generic::COMPONENT
- if this method is called from URI::Generic.
+ * ext/.document: remove refinement from documentable directories.
- * lib/uri/generic.rb (URI::Generic.build2): escape only if the item is
- a String.
+Sat Mar 15 11:02:58 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/uri/generic.rb (URI::Generic.build2): use DEFAULT_PARSER because
- it doesn't have parser method. [Bug #6420]
+ * configure.in (DLDFLAGS): check for each options to control
+ symbol resolution. [ruby-core:61429] [Bug #9624]
-Fri May 18 15:54:07 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sat Mar 15 07:02:35 2014 Eric Wong <e@80x24.org>
- * ext/zlib/extconf.rb: Use an exception instead of bare puts.
+ * st.c (st_update): remove unnecessary assignment
-Fri May 18 15:53:05 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Fri Mar 14 14:58:38 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * ext/psych/extconf.rb: Use an exception instead of bare abort.
+ * 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.
-Fri May 18 15:51:32 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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)
- * ext/fiddle/extconf.rb: Use an exception instead of bare abort.
+ * 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 May 18 15:49:35 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
- * ext/readline/extconf.rb: Use an exception instead of bare exit.
+Fri Mar 14 12:07:46 2014 Zachary Scott <e@zzak.io>
-Fri May 18 15:38:11 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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
- * ext/ripper/extconf.rb: Use an exception instead of bare
- Logging.message.
+Fri Mar 14 01:18:24 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri May 18 15:23:06 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * vm.c (invoke_block_from_c): add splattable argument.
- * ext/openssl/extconf.rb: Clarify a message when hit Apple
- OpenSSL issue.
+ * vm.c (vm_invoke_proc): disallow to splat when directly invoked.
-Fri May 18 15:14:32 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * vm_insnhelper.c (vm_callee_setup_arg_complex, vm_callee_setup_arg):
+ relax arity check of yielded lambda. [ruby-core:61340] [Bug #9605]
- * ext/extmk.rb: Show a message when extconf.rb raised an exception.
- * ext/openssl/extconf.rb: Use exception raising instead of message
- and/or abort. We want to display error message to console _and_
- logging into mkmf.log.
+ * test/ruby/test_yield.rb (TestRubyYieldGen#emu_bind_params): no
+ longer raise ArgumentError when splatting to lambda.
-Fri May 18 06:14:07 2012 Eric Hodel <drbrain@segment7.net>
+Thu Mar 13 23:51:02 2014 NAKAMURA Usaku <usa@ruby-lang.org>
- * ext/syslog/lib/syslog/logger.rb: Added Syslog::Logger which was
- ported from the SyslogLogger gem. [ruby-trunk - Feature #5096]
- * NEWS: ditto.
- * test/syslog/test_syslog_logger.rb: ditto.
+ * 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.
-Fri May 18 01:28:21 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+Wed Mar 12 11:19:03 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/psych/parser.c (transcode_string): fix encoding index names.
- Thanks markizko for reporting.
+ * vm_insnhelper.c (vm_callee_setup_arg): disable fastpath if splat
+ argument, since argc may differ for each calls.
+ [ruby-core:61422] [Bug #9622]
-Thu May 17 23:03:58 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm_insnhelper.c (vm_callee_setup_arg): turn a macro into an
+ inline function.
- * configure.in: fix function name to be checked, to initialize
- rb_thread_cond_t properly.
+Wed Mar 12 07:26:05 2014 Eric Wong <e@80x24.org>
- * thread_pthread.c (native_cond_initialize, native_cond_destroy):
- fix macro name.
+ * 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]
-Thu May 17 12:53:07 2012 Yuki Yugui Sonoda <yugui@google.com>
+Tue Mar 11 22:31:25 2014 Kazuki Tsujimoto <kazuki@callcc.net>
- * thread.c, thread_pthread.c: Moved pthread-specific preprocessor
- hacks to thread_pthread.c
+ * ext/.document: add objspace/objspace_dump.c to document file.
-Thu May 17 12:18:47 2012 Yuki Yugui Sonoda <yugui@google.com>
+Tue Mar 11 22:22:38 2014 Kazuki Tsujimoto <kazuki@callcc.net>
- * io.c: Fix a mistake on merging the patch in the previous commit.
+ * test/objspace/test_objspace.rb (TestObjSpace#test_dump_uninitialized_file):
+ remove dependency on json library.
-Thu May 17 11:33:07 2012 Yuki Yugui Sonoda <yugui@google.com>
+Tue Mar 11 10:55:10 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- Imports Ruby's port to NativeClient (a.k.a NaCl).
- Patch by Google Inc. [ruby-core:45073].
+ * 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].
- * configure.in (RUBY_NACL): New M4 func to configure variables for
- NaCl.
- (RUBY_NACL_CHECK_PEPPER_TYPES): New M4 func to check the old names
- of Pepper interface types.
- (BTESTRUBY): New variable to specify which ruby should be run on
- "make btest". NaCl can run the built binary by sel_ldr, but it need
- rbconfig.rb. So this variable is distinguished from $MINIRUBY.
+Tue Mar 11 06:54:00 2014 Scott Francis <scott.francis@shopify.com>
- * thread_pthread.c: Disabled some features on NaCl.
+ * ext/objspace/objspace_dump.c: Check fptr before trying to dump RFILE
+ object fd. [GH-562]
- * io.c: ditto.
+ * test/objspace/test_objspace.rb: add test
- * process.c: ditto.
+Tue Mar 11 02:04:36 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * signal.c: ditto.
+ * vm_dump.c (rb_vm_bugreport): show vm maps on FreeBSD.
- * file.c: ditto.
+ * vm_dump.c (procstat_vm): copied from FreeBSD.
+ http://svnweb.freebsd.org/base/head/usr.bin/procstat/procstat_vm.c?revision=261780
- * missing/flock.c: ditto.
+Mon Mar 10 12:14:26 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * nacl/pepper_main.c: An example implementation of Pepper application
- that embeds Ruby.
+ * configure.in: always check dladdr(1).
- * nacl/example.html: An example of web page that uses the Pepper
- application.
+ * 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.
- * nacl/nacl-config.rb: Detects variants of NaCl SDK.
+Mon Mar 10 10:51:17 2014 ksss <co000ri@gmail.com>
- * nacl/GNUmakefile.in: Makefile template for NaCl specific build
- process.
+ * test/ruby/test_enumerator.rb (test_iterators): fix test for hash
+ iterators. [Fixes GH-558]
- * nacl/package.rb: script for packaging a NaCl-Ruby embedding
- application.
+Sun Mar 9 14:14:49 2014 Eric Wong <e@80x24.org>
- * nacl/reate_nmf.rb: Wrapper script of create_nmf.py
+ * 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]
- * dln.c (dln_load): Added a hack to call on NaCl.
+Sun Mar 9 13:51:16 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * util.c (ruby_getcwd): Path to the current directory is not available
- on NaCl.
+ * ext/fiddle/function.c (function_call): fix memory leak when an
+ exception occurs at argument conversion or the function call.
-Thu May 17 10:54:58 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Mar 9 06:42:40 2014 Eric Wong <e@80x24.org>
- * ext/tk/extconf.rb: add -l options to $libs not $LDFLAGS,
- to be passed to EXTLIBS in exts.mk.
+ * variable.c (struct global_variable): shrink by 8 bytes on 64-bit
- * enc/encinit.c.erb: use %-lines to adjust indent in the generated file.
+Sat Mar 8 17:42:51 2014 Eric Wong <e@80x24.org>
- * lib/mkmf.rb (MakeMakefile#have_framework): combine -framework option
- and its argument with an equal sign not to be separated in merge_libs.
+ * vm.c (add_opt_method): cleanup to use rb_method_entry_at
- * ext/tk/extconf.rb: ditto.
+Sat Mar 8 13:46:40 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/extmk.rb: EXTLDFLAGS also needs to be passed.
+ * 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].
-Wed May 16 15:44:22 2012 Yuki Yugui Sonoda <yugui@google.com>
+Sat Mar 8 13:30:39 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * configure.in: Fix an unbalanced quote.
+ * 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]
-Wed May 16 15:43:10 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Fri Mar 7 19:29:13 2014 Eric Wong <e@80x24.org>
- * ext/extmk.rb (exts.mk): use double quotes instead of single quotes
- for commandline because it's not recognized as quotes on Windows.
+ * vm_eval.c (vm_call0_body): use RARRAY_CONST_PTR
+ (check_funcall_exec): ditto
+ [ruby-core:61360]
-Wed May 16 15:15:55 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Mar 7 19:14:11 2014 Eric Wong <e@80x24.org>
- * configure.in (LD): enclose with single quotes but not double quotes
- not to expand command substitution.
+ * vm_eval.c (vm_call0_body): fix RB_GC_GUARD location
+ (check_funcall_exec): ditto
+ [Bug #9609]
-Wed May 16 14:19:51 2012 Yuki Yugui Sonoda <yugui@google.com>
+Fri Mar 7 14:48:17 2014 Narihiro Nakamura <authornari@gmail.com>
- Supports static linking of extensions and encodings again.
- Fixes --with-static-linked-ext.
+ * parse.y (ENC_SINGLE): Unused macro removed.
- Patch by Google Inc. [ruby-core:45073].
+Fri Mar 7 12:06:19 2014 Martin Bosslet <Martin.Bosslet@gmail.com>
- * Makefile.in (ENCOBJS, EXTOBJS): New variables to specify static
- linked libraries. Also reintroduces extinit.o, introduces encinit.o
- introduces encinit.o
+ * test/openssl/test_ssl.rb: Reuse TLS default options from
+ OpenSSL::SSL::SSLContext::DEFAULT_PARAMS.
- * common.mk: Builds static libraries rather than shared objects if
- specified.
+Thu Mar 6 15:15:24 2014 Zachary Scott <e@zzak.io>
- * configure.in (LD): new substitution.
+ * doc/syntax/assignment.rdoc: [DOC] Fix assignment directions
+ By @idupree [Fixes GH-555] https://github.com/ruby/ruby/pull/555
- * enc/depend: Supports static linked libraries
- (libencs, libenc, libtrans): New target.
+Thu Mar 6 15:07:18 2014 Zachary Scott <e@zzak.io>
- * enc/encinit.c.erb: new template to generate the initialization of
- statically linked encodings.
+ * doc/syntax/methods.rdoc: [DOC] Fix example for block arguments
+ By @idupree [Fixes GH-554] https://github.com/ruby/ruby/pull/554
- * enc/make_encmake.rb (--module): new flag to specify whether static
- or dynamic.
+Thu Mar 6 10:33:31 2014 Martin Bosslet <Martin.Bosslet@gmail.com>
- * transcode_data.h (TRANS_INIT): New macro to get rid of the name
- collision of encoding initializers and transcoder initializers.
+ * 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]
- * ext/extmk.rb: Fixes the behavior on $extstatic is true.
+Wed Mar 5 15:56:18 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/mkmf.rb (clean-static): new target to clean up static linked
- libraries.
+ * parse.y (f_arg_asgn): define optional arguments as argument
+ variables in the rhs default expressions.
+ [ruby-core:61299] [Bug #9593]
- * ruby.c (process_options): New initializes statically linked
- encodings here.
+Wed Mar 5 11:58:30 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed May 16 14:30:43 2012 NAKAMURA Usaku <usa@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.
- * io.c: fixed a merge mistake of r33878, reported by nobu via IRC.
+Wed Mar 5 00:42:00 2014 Kazuki Tsujimoto <kazuki@callcc.net>
-Wed May 16 06:59:41 2012 Tadayoshi Funaba <tadf@dotrb.org>
+ * ext/pathname/lib/pathname.rb (Pathname#find): add "ignore_error"
+ keyword argument defaulted to true as well as Find#find.
- * ext/date/date_strftime.c: should also be aware of flags on
- complex specifier.
+Tue Mar 4 23:00:18 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-Wed May 16 05:11:29 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+ * test/ruby/test_eval.rb (TestEval#make_test_binding): renamed.
+ it's not test method.
- * ext/psych/lib/psych/visitors/to_ruby.rb: fix a bug with string
- subclass dumping and loading.
+Tue Mar 4 20:50:59 2014 Masaya Tarui <tarui@ruby-lang.org>
- * test/psych/test_array.rb: pertinent tests
+ * st.c (st_foreach): fix type of hash. not st_data_t but st_index_t.
- * test/psych/test_string.rb: ditto
+Tue Mar 4 19:41:40 2014 Tanaka Akira <akr@fsij.org>
-Wed May 16 01:31:21 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+ * Makefile.in: ".DEFAULT" target removed because it is not for
+ specifying default target.
- * ext/psych/lib/psych/visitors/to_ruby.rb: convert omap tagged maps to
- Psych::Omap objects rather than hashes. [Bug #6425]
+Tue Mar 4 00:25:35 2014 Kazuki Tsujimoto <kazuki@callcc.net>
- * test/psych/test_omap.rb: pertinent test.
+ * lib/find.rb (Find#find): should pass ignore_error option to enumerators.
-Wed May 16 01:15:45 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+Mon Mar 3 13:27:35 2014 NAKAMURA Usaku <usa@ruby-lang.org>
- * ext/psych/lib/psych/visitors/yaml_tree.rb: keep a reference to
- custom coders so that GC does not impact dumped yaml reference ids.
+ * test/test_find.rb (TestFind#test_unsearchable_dir): ruby cannot make
+ directory unreachable by owner on Windows.
-Tue May 15 23:59:48 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Mar 3 08:10:04 2014 Eric Wong <e@80x24.org>
- * lib/test/unit.rb (Test::Unit::Options#setup_options): add --color option.
+ * vm_method.c (rb_method_entry_get_without_cache): disable GMC
+ writing if GMC is disabled.
+ [ruby-core:61218]
- * lib/test/unit.rb (Test::Unit::Runner#_prepare_run): defer color code
- initialization to regard --color option.
+Mon Mar 3 07:47:17 2014 Eric Wong <e@80x24.org>
-Mon May 14 16:28:36 2012 Nobuyoshi Nakada <nobu@ruby-lang.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]
- * parse.y (f_arglist): should reset lexical states after empty
- argument list with no parenthesis as well as parenthesized list,
- so that reserved name method definition work. [ruby-dev:45626]
- [Bug #6403]
+Mon Mar 3 07:17:31 2014 Zachary Scott <e@zzak.io>
-Mon May 14 00:14:24 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+ * NEWS: [DOC] Update doc regarding filesystem load when flushing IO
- * enumerator.c (lazy_take_func, lazy_take): multiple calls of
- force/to_a method to Enumerator::Lazy#take should return same
- results. [ruby-dev:45634] [Bug #6428]
+Mon Mar 3 04:37:50 2014 NAKAMURA Usaku <usa@ruby-lang.org>
- * test/ruby/test_lazy_enumerator.rb (test_take_recycle): add test for
- above.
-
-Sun May 13 23:38:31 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+ * io.c (rb_io_fsync): need to fsync even if on Windows. fixed mistake
+ of r45254 and r45256.
- * test/ruby/test_io.rb (test_flush_in_finalizer1): don't use IO.for_fd
- to close IO objects. it create IO object with already closed fd, and
- cause occasional Errno::EBADF in following tests. [ruby-core:45020]
- [Bug #6228]
+Mon Mar 3 04:21:34 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-Sun May 13 23:32:16 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+ * test/win32ole: get rid of warnings (unused variable).
- * test/ruby/test_io.rb (TestIO): revert r35631. it broke the intent of
- test_flush_in_finalizer1. [ruby-core:43951] [Bug #6228]
+Mon Mar 3 02:53:53 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-Sun May 13 22:46:36 2012 Tanaka Akira <akr@fsij.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]
- * ext/etc/etc.c (passwd_ensure): move endpwent() call from
- passwd_iterate to close /etc/passwd on exception.
- (group_ensure): move endgrent() call from group_iterate to close
- /etc/group on exception.
+Mon Mar 3 00:17:43 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-Sun May 13 18:10:43 2012 Tadayoshi Funaba <tadf@dotrb.org>
+ * test/ruby/test_backtrace.rb: get rid of warnings. unused variable,
+ shadowing.
- * ext/date/date_strftime.c: removed unused code and changed the style.
+Sun Mar 2 11:15:10 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun May 13 17:37:56 2012 Tadayoshi Funaba <tadf@dotrb.org>
+ * lib/find.rb (Find#find): add "ignore_error" keyword argument
+ defaulted to true. [ruby-core:51025] [Feature #7596]
- * ext/date/date_strftime.c: refactored.
+Sun Mar 2 11:13:30 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun May 13 06:40:12 2012 Luis Lavena <luislavena@gmail.com>
+ * ext/readline/extconf.rb (rl_hook_func_t): define as Function for
+ very old readline versions. [ruby-core:61209] [Bug #9578]
- * test/ruby/test_io.rb (class TestIO): Disable GC during IO tests to
- avoid file descriptors being GC'ed. Suggestion by Tomoyuki Chikanaga
- [ruby-core:43951][Bug #6228]
+Sun Mar 2 10:47:58 2014 Eric Wong <e@80x24.org>
-Sat May 12 07:00:16 2012 Eric Hodel <drbrain@segment7.net>
+ * load.c (ruby_init_ext): make idempotent to suppress warnings
- * ext/sdbm/init.c: Added documentation. Patch by Justin Collins,
- cleanup by Zachary Scott. [ruby-trunk - #6410]
+Sat Mar 1 19:51:42 2014 Tanaka Akira <akr@fsij.org>
-Sat May 12 06:02:03 2012 Eric Hodel <drbrain@segment7.net>
+ * lib/open3.rb (Open3.capture3): Ignore Errno::EPIPE for writing
+ stdin_data.
+ (Open3.capture2): Ditto.
+ (Open3.capture2e): Ditto.
- * lib/fileutils.rb (cp_r): Fixed cp_r example. Patch by TJ Koblentz
- from pull request #114. [ruby-trunk - Bug #6411]
+Sat Mar 1 19:06:47 2014 Eric Wong <e@80x24.org>
-Sat May 12 05:23:06 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * gc.c (ruby_gc_set_params): simplify condition
- * thread.c (rb_threadptr_execute_interrupts_common):
- test_signal_requiring of test/ruby/test_signal.rb fail if the sub
- process is killed on waiting IO in lex_io_gets in rb_load_file in
- rb_load_internal in require.
- This is because
- (1) the process receive the killing signal in
- rb_thread_io_blocking_region in rb_read_internal in lex_io_gets.
- (2) set th->errinfo as INT2FIX(TAG_FATAL) at
- rb_threadptr_execute_interrupts_common.
- (3) escape rb_load_file in rb_load_internal and jump to EXEC_TAG()
- without set loaded as TRUE.
- (4) call first rb_exc_raise(GET_THREAD()->errinfo); because loaded
- is FALSE as above. this errinfo should be an exception object
- but this is INT2FIX(TAG_FATAL).
- Don't call first rb_exc_raise if GET_THREAD()->errinfo is Fixnum.
+Sat Mar 1 16:18:40 2014 Tanaka Akira <akr@fsij.org>
-Fri May 11 14:23:11 2012 Nobuyoshi Nakada <nobu@ruby-lang.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]
- * parse.y (primary): begin/end block should be isolated from outside.
- [ruby-dev:45631][Bug #6419]
+Sat Mar 1 16:05:58 2014 Eric Wong <e@80x24.org>
-Fri May 11 14:09:47 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c (ruby_gc_set_params): fix building without RGenGC
- * ext/bigdecimal/bigdecimal.c (PUSH): to prevent VALUE from GC,
- must not cast it to unsigned long, which may be shorter than
- VALUE, and the result can be mere garbage.
+Sat Mar 1 11:08:00 2014 Aaron Patterson <aaron@tenderlovemaking.com>
-Fri May 11 09:51:07 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: support dumping Encoding
+ objects.
- * lib/test/unit.rb (Test::Unit::Runner#failed): no unnecessary
- newlines if no reports to be displayed.
+ * ext/psych/lib/psych/visitors/to_ruby.rb: support loading Encoding
+ objects.
-Thu May 10 10:55:35 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/psych/test_encoding.rb: add test
- * test/minitest/test_minitest_mock.rb: Correct requiring path to
- metametameta.rb.
+ * ext/psych/lib/psych.rb: add version
- * test/minitest/test_minitest_unit.rb: Correct requiring path to
- metametameta.rb.
+Sat Mar 1 10:52:34 2014 Zachary Scott <e@zzak.io>
-Thu May 10 10:18:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * README.EXT.ja: [DOC] Fix typo "macro macro" @utenmiki [Fixes GH-551]
+ https://github.com/ruby/ruby/pull/551
- * parse.y (lex_state_name): returns name for lex_state_e, for debug
- use.
+Fri Feb 28 11:16:55 2014 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-Wed May 9 16:36:01 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * numeric.c: Fix Numeric#step with 0 unit [Bug #9575]
- * lib/mkmf.rb (MakeMakefile#pkg_config): check if libs resulted from
- pkg-config works actually.
+Thu Feb 27 17:59:01 2014 Zachary Scott <e@zzak.io>
-Wed May 9 16:01:38 2012 Shugo Maeda <shugo@ruby-lang.org>
+ * 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
- * lib/net/imap.rb (decode_utf7, encode_utf7): refactored by
- Nobuyoshi Nakada, to use String#encode.
+Thu Feb 27 12:10:09 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed May 9 13:26:25 2012 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]
- * test/rubygems/test_gem_remote_fetcher.rb: skip OpenSSL dependent
- tests if not available.
+Thu Feb 27 03:55:45 2014 Zachary Scott <e@zzak.io>
-Wed May 9 08:09:38 2012 Ryan Davis <ryand-ruby@zenspider.com>
+ * thread.c: [DOC] Typo in comment for _FORTIFY_SOURCE [Fixes GH-548]
+ Patch by @qnet-herwin https://github.com/ruby/ruby/pull/548
- * lib/minitest/*: Imported minitest 3.0.0 (r7435)
- * test/minitest/*: ditto
- * test/rubygems/*: Imported fixes for buggy use of assert_match
- and deprecated assert_block
- UNBUNCH YOUR PANTIES. THE TESTS DO NOT RUN CLEAN ON OSX.
+Wed Feb 26 18:43:43 2014 Koichi Sasada <ko1@atdot.net>
-Wed May 9 06:28:59 2012 Eric Hodel <drbrain@segment7.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.
- * re.c (rb_reg_equal): Removed incorrect example for Regexp#== with
- "n" option. [ruby-talk - Bug #6415]
+Wed Feb 26 14:10:44 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed May 9 06:23:33 2012 Tadayoshi Funaba <tadf@dotrb.org>
+ * eval.c (setup_exception): preserve exception class name encoding
+ in debug mode messages.
- * ext/date/date_core.c: reverted.
+ * eval.c (setup_exception): preserve errinfo across calling #to_s
+ method on the exception. [ruby-core:61091] [Bug #9568]
-Wed May 9 04:31:26 2012 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+Wed Feb 26 01:29:27 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * lib/rinda/ring.rb (lookup_ring_any): fix Rinda::RingFinger.primary
- hungs forever. [ruby-talk:395364]
+ * string.c (sym_find): Add Symbol.find(str), which returns whether given
+ string is defined as symbol or not. [Feature #7854]
-Tue May 8 21:09:00 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+Tue Feb 25 22:52:02 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * include/ruby/win32.h (FD_SET): change function to macro.
- To avoid buffer overflow when smaller FD_SETSIZE is used in ext
- libraries.
+ * ext/dl/dl.c (rb_dl_realloc): use NUM2SIZET instead of NUM2INT.
- * win32/win32.c (rb_w32_fdset): this function is not used anymore.
- But we leave this for compatibility.
+ * ext/fiddle/fiddle.c (rb_fiddle_realloc): ditto.
- * win32/win32.c (rb_w32_select_with_thread): fix SEGV when smaller
- FD_SETSIZE is used in ext libraries. Dereference of fd_set pointer
- causes SEGV.
+Tue Feb 25 22:49:30 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * test/-ext-/win32/test_fd_setsize.rb(TestFdSetSize): add tests for
- above.
- * ext/-test-/win32/fd_setsize/depend: ditto.
- * ext/-test-/win32/fd_setsize/extconf.rb: ditto.
- * ext/-test-/win32/fd_setsize/fd_setsize.c: ditto.
-
- [ruby-core:44588] [Bug #6352]
-
-Tue May 8 20:44:46 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * io.c (io_unread): fix IO#pos with mode 'r' bug on Windows.
- If the end of reading buffer is CR, io_unread() needs to unread one
- more byte.
- [ruby-core:44874] [Bug #6401]
+ * ext/dl/dl.c (rb_dl_malloc): use NUM2SIZET instead of NUM2INT.
+ Coverity Scan found this bug.
- * test/ruby/test_io_m17n.rb (TestIO_M17N#test_pos_with_buffer_end_cr):
- add a test for above.
+ * ext/fiddle/fiddle.c (rb_fiddle_malloc): ditto.
-Tue May 8 13:38:17 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+Tue Feb 25 12:06:13 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * ext/date/date_core.c: improving introduction in Date/DateTime
- documentation. patched by Daniel Kaufman via Github.
- https://github.com/ruby/ruby/pull/110
+ * win32/Makefile.sub: define PACKED_STRUCT.
-Tue May 8 13:36:02 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Feb 24 21:41:56 2014 NAKAMURA Usaku <usa@ruby-lang.org>
- * configure.in (POSTLINK): default to : command to get rid of flag
- only command, since BSD make does not work with it.
+ * README.md, README.ja.md: removed (wrong) mode setting for emacs.
-Tue May 8 13:35:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Feb 24 20:05:41 2014 Eric Wong <e@80x24.org>
- * lib/test/unit.rb (MiniTest#run_test): remove exact trace and get rid
- of IndexError, which could caused by modified $@ sometimes.
+ * 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
-Tue May 8 11:21:27 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Mon Feb 24 18:10:02 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * test/minitest/metametameta.rb (MetaMetaMetaTestCase#assert_report):
- support drive letter on Windows. yes, the original code is metameta.
+ * test/fiddle/test_function.rb: remove unused variables.
+ * test/fileutils/test_fileutils.rb: ditto.
+ * test/io/console/test_io_console.rb: ditto.
-Tue May 8 08:54:48 2012 Eric Hodel <drbrain@segment7.net>
+Mon Feb 24 12:37:51 2014 Eric Wong <e@80x24.org>
- * lib/abbrev.rb: Fixed typo in abbrev pattern documentation. Based on
- patch by Mark Rushakoff. [ruby-trunk - #6346]
+ * 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]
-Tue May 8 07:44:18 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Sun Feb 23 17:55:50 2014 Kouhei Sutou <kou@cozmixng.org>
- * ext/openssl/ossl_ssl.c (ossl_start_ssl): remove useless rb_sys_fail
- before ossl_raise. this cause a test failure on Linux.
- http://u64.rubyci.org/~chkbuild/ruby-trunk/log/20120507T190102Z.log.html.gz
+ * 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!!!
-Tue May 8 05:35:18 2012 Eric Hodel <drbrain@segment7.net>
+ * test/rexml/xpath/test_node.rb: Add tests for the above case.
- * object.c (Init_Object): Added reference to variable.c where
- public_constant and private_constant documentation lives. [#6381]
+Sun Feb 23 12:18:54 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue May 8 04:47:44 2012 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.
- * lib/test/unit.rb (Test::Unit::Runner#output): prefer local output to
- get rid of unexpected side effect in test/minitest/metametameta.rb.
+ * 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.
- * lib/test/unit.rb (MiniTest#run_test): show the running test in $0.
+Sun Feb 23 11:33:25 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * lib/test/unit.rb (Test::Unit::StatusLineOutput): new class to output
- in status line.
+ * 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.
- * test/testunit/test_hideskip.rb (TestHideSkip#test_hideskip):
- MiniTest#puke now reports Skipped messages only if verbose mode.
+Sun Feb 23 02:19:51 2014 Tanaka Akira <akr@fsij.org>
- * test/testunit/test_sorting.rb (TestTestUnitSorting#test_sorting):
- ditto.
+ * 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]
- * lib/test/unit.rb (Test::Unit::Runner#puke): modify only result and
- drop useless reports, not override entirely.
+Sat Feb 22 23:17:01 2014 Kouhei Sutou <kou@cozmixng.org>
- * bootstraptest/runner.rb (exec_test, show_progress): show rotators
- and pass/fail counts.
+ * lib/rexml/xpath_parser.rb: Fix indent.
- * sample/test.rb (PROGRESS): refine output.
+Sat Feb 22 23:15:35 2014 Kouhei Sutou <kou@cozmixng.org>
-Tue May 8 02:34:26 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * test/rexml/xpath/test_attribute.rb: Simplify.
- * lib/minitest/unit.rb (assert_match): refix of r35563.
- r35563 breaks the intention of the original change.
- https://github.com/seattlerb/minitest/commit/68858105b2eb11c85105ffac5f32b662c59397f3
- * lib/minitest/unit.rb (refute_match): ditto.
+Sat Feb 22 20:28:47 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-Mon May 7 21:19:17 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * tool/redmine-backporter.rb: more friendly.
- * ext/json: Merge JSON 1.7.1.
- https://github.com/flori/json/commit/e5b9a9465c1159fae533bca320d950b772bcb4ac
+Sat Feb 22 20:24:43 2014 Kouhei Sutou <kou@cozmixng.org>
-Mon May 7 22:54:22 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * test/rexml/test_xpath*.rb: Move to ...
+ * test/rexml/xpath/*.rb: ... here.
- * ext/openssl/ossl_ssl.c: add support for option flags
- OpenSSL::SSL::OP_NO_TLSv1_1
- OpenSSL::SSL::OP_NO_TLSv1_2
- to allow blocking specific TLS versions. Thanks to Justin Guyett for
- pointing this out to me.
- * test/openssl/test_ssl.rb: add tests to assert correct behavior when
- blocking certain versions of TLS/SSL both on server and client side.
- Also refactored tests to reduce boilerplate code a little.
- * test/openssl/utils.rb: rescue Errno::ECONNRESET for tests where
- client rejects the connection because a forbidden protocol version
- was used.
+Sat Feb 22 20:04:41 2014 Kouhei Sutou <kou@cozmixng.org>
-Mon May 7 20:14:15 2012 Tanaka Akira <akr@fsij.org>
+ * test/rexml/listener.rb: Untabify.
- * lib/securerandom.rb (random_bytes): call to_int method for the
- argument at first.
+Sat Feb 22 19:07:31 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-Mon May 7 17:54:12 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/io/console/console.c (console_dev): need read access for conout$
+ because some functions need it. [Bug#9554]
- * lib/minitest/unit.rb (assert_match): replace matcher only if both
- matcher and obj are String. fix r35541. [Bug #6405]
- DON'T COMMIT IF YOU CAN'T RUN TEST.
- FIX AS SOON AS POSSIBLE YOU BREAK TESTS.
- patched by ayumin.
- https://github.com/seattlerb/minitest/pull/124
+Sat Feb 22 18:40:58 2014 Eric Wong <e@80x24.org>
- * lib/minitest/unit.rb (refute_match): ditto.
+ * .gitignore: ignore benchmark files
-Mon May 7 13:41:00 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Feb 22 01:22:24 2014 Yusuke Endoh <mame@tsg.ne.jp>
- * Makefile.in (PROGRAM), configure.in (POSTLINK): sign built program
- using RUBY_CODESIGN identity.
+ * bignum.c (bary_mul_precheck): fix a copy-paste error.
+ Coverity Scan found this bug.
-Mon May 7 13:03:55 2012 Shugo Maeda <shugo@ruby-lang.org>
+Sat Feb 22 00:58:51 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * lib/net/imap.rb (body_type_attachment): parse body type
- "ATTACHMENT". [ruby-core:44849] [Bug #6397]
+ * ext/socket/raddrinfo.c (rb_getaddrinfo): second argument of
+ MEMZERO is type. Coverity Scan found this bug.
-Mon May 7 10:49:36 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Fri Feb 21 23:47:24 2014 Shugo Maeda <shugo@ruby-lang.org>
- * ext/bigdecimal/bigdecimal.c (Init_bigdecimal): define IDs before
- they are used. [ruby-core:44900] [Bug #6406]
+ * 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]
-Mon May 7 10:27:56 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Feb 21 23:03:39 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * ext/digest/rmd160/rmd160.c (RMD160_Update): fix for huge data.
+ * tool/redmine-backporter.rb: added to handle redmine tickets.
-Mon May 7 10:23:04 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Fri Feb 21 20:42:01 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/fileutils/fileasserts.rb: use assert_equal, assert_match, and so on.
+ * class.c (rb_mod_init_copy): do nothing if copying self.
+ [ruby-dev:47989] [Bug #9535]
- * test/ruby/enc/test_utf16.rb, test/ruby/enc/test_utf32.rb,
- test/ruby/test_io_m17n.rb (assert_str_equal): ditto.
+ * hash.c (rb_hash_initialize_copy): ditto.
- * test/rubygems/test_gem_remote_fetcher.rb
- (assert_data_from_{server,proxy}): ditto.
+Fri Feb 21 16:45:54 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/test_pstore.rb (test_thread_safe): ditto.
+ * lib/logger.rb (next_rotate_time, previous_period_end): consider
+ DST change.
-Mon May 7 10:16:30 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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]
- * test/rubygems/test_gem_installer.rb (TestGemInstaller#test_dir): fix
- argument order. expected value must come first.
+Fri Feb 21 10:39:33 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Mon May 7 09:14:11 2012 Martin Bosslet <Martin.Bosslet@googlemail.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.
- * ext/openssl/ossl_ssl.c: support TLSv1.1 & TLSv1.2. Add
- SSLContext#version to inspect the version that was negotiated for
- a given connection.
- * ext/openssl/extconf.rb: detect TLS 1.1 & 1.2 support.
- * test/openssl/test_ssl.rb: add tests for TLS 1.1 & 1.2 given they
- are supported by the native OpenSSL being used.
+Fri Feb 21 09:48:56 2014 Eric Wong <e@80x24.org>
-Sun May 6 21:34:29 2012 NARUSE, Yui <naruse@ruby-lang.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
- * io.c (io_encoding_set): suppress warnings. [ruby-dev:45627]
- this tmp1 is not required after r35538.
+Fri Feb 21 08:27:19 2014 Eric Wong <e@80x24.org>
- * addr2line.c: suppress warnings.
+ * 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]
-Sun May 6 18:39:39 2012 Koichi Sasada <ko1@atdot.net>
+Thu Feb 20 22:21:26 2014 Tanaka Akira <akr@fsij.org>
- * compile.c (iseq_compile_each): remove unused variable `size'.
+ * ext/socket/raddrinfo.c (numeric_getaddrinfo): Use xcalloc.
+ Suggested by Eric Wong.
+ https://bugs.ruby-lang.org/issues/9525#note-14
-Sun May 6 14:50:03 2012 Tanaka Akira <akr@fsij.org>
+Thu Feb 20 11:21:13 2014 Masaki Matsushita <glass.saga@gmail.com>
- * lib/securerandom.rb: show actual read length in an error message.
+ * hash.c (rb_hash_flatten): fix behavior of flatten(-1).
+ [ruby-dev:47988] [Bug #9533]
-Sat May 5 06:43:10 2012 Ryan Davis <ryand-ruby@zenspider.com>
+ * test/ruby/test_array.rb: test for above.
- * lib/minitest/*: Imported minitest 2.12.1 (r7323)
- * test/minitest/*: ditto
+Wed Feb 19 18:57:02 2014 Tanaka Akira <akr@fsij.org>
-Sat May 5 01:47:33 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/socket: Bypass getaddrinfo() if node and serv are numeric.
+ Reporeted by Naotoshi Seo. [ruby-core:60801] [Bug #9525]
- * test/zlib/test_zlib.rb (test_inflate): add a test for Zlib.inflate.
- patched by headius (Charles Nutter). [ruby-core:44859] [Bug #6398]
+ * ext/socket/extconf.rb: Detect struct sockaddr_in6.sin6_len.
- * test/zlib/test_zlib.rb (test_deflate): add a test for Zlib.deflate.
+ * ext/socket/sockport.h (SET_SIN6_LEN): New macro.
+ (INIT_SOCKADDR_IN6): Ditto.
-Sat May 5 00:53:55 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/socket/rubysocket.h (struct rb_addrinfo): Add
+ allocated_by_malloc field.
- * io.c (parse_mode_enc): remove warnings 'Ignoring internal encoding'.
- [ruby-core:44455] [Bug #6324]
+ * 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.
- * io.c (io_encoding_set): ditto.
+Wed Feb 19 18:31:48 2014 Tanaka Akira <akr@fsij.org>
-Fri May 4 07:19:02 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/socket: Wrap struct addrinfo by struct rb_addrinfo.
- * lib/rdoc/parser.rb (RDoc.binary?): fix wrong regexp.
- [ruby-core:44798] [Bug #6393]
+Wed Feb 19 17:47:01 2014 Tanaka Akira <akr@fsij.org>
-Fri May 4 01:33:20 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/socket/ipsocket.c (ip_s_getaddress): Don't access freed memory.
- * lib/rdoc/parser.rb (RDoc.alias_extension): a real file is irrelevant
- to aliasing. [ruby-core:44796][Bug #6392]
+Wed Feb 19 11:39:41 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * lib/rdoc/parser.rb (RDoc.zip?): non-existent file will not be a zip
- file.
+ * configure.in: it must see rb_cv_broken_memmem not rb_cv_func_memmem.
- * lib/rdoc/parser.rb (RDoc.can_parse_by_name): accept aliased
- extension file names.
+Tue Feb 18 23:18:41 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * lib/rdoc/parser.rb (RDoc.binary?): binary read data may have
- incomplete multibyte sequence. [ruby-core:44798][Bug #6393]
+ * test/socket/test_socket.rb: unix socket is required by test case.
-Wed May 2 23:55:51 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Feb 18 20:48:38 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * lib/test/unit.rb (Test::Unit::RequireFiles#non_options): expand
- real path to get rid of loading same files via symlinks.
+ * 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.
-Wed May 2 23:26:04 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+Tue Feb 18 14:27:18 2014 Shota Fukumori <her@sorah.jp>
- * cont.c (rb_fiber_m_transfer): improve sample code in Fiber#transfer
- documentation. emphasize the difference between transfer and resume.
+ * lib/test/unit.rb: Requires minitest < 5.0.0 if Gem is available.
-Wed May 2 23:21:20 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Feb 18 14:24:07 2014 Shota Fukumori <her@sorah.jp>
- * parse.y (parser_yylex): allow spaces between lambda arrow and
- parenthesis. [ruby-dev:45605][Feature #6390]
+ * lib/test/unit/test-unit.gemspec: Add minitest < 5.0.0 dependency
-Wed May 2 19:06:30 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+ * tool/rbinstall.rb: Add empty implementations for `add_dependency`,
+ `add_runtime_dependency`, `add_development_dependency` for
+ Gem::Specification.
- * cont.c (rb_fiber_m_transfer): Improved Fiber documentation.
- patched by Anuj Dutta. [ruby-core:44540][Bug #6343]
+Tue Feb 18 12:06:39 2014 Tanaka Akira <akr@fsij.org>
-Wed May 2 13:06:37 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * configure.in (FILE_COUNT): Removed. (win32.c defines it in itself.)
+ (FILE_READPTR): Ditto.
- * README, README.ja: reformatted using rdoc markup. based on the
- patches by zzak (Zachary Scott) in [Feature #6388].
+Tue Feb 18 09:35:44 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * README, README.ja: updated the author's mail address.
+ * test/test/psych/test_string.rb: remove unused variables.
+ * test/test/psych/test_yaml.rb: ditto.
-Wed May 2 09:46:09 2012 Kouji Takao <kouji@takao7.net>
+Mon Feb 17 21:31:31 2014 Koichi Sasada <ko1@atdot.net>
- * ext/readline/readline.c (Readline.special_prefixes=)
- (Readline.special_prefixes): new function. An original patch was
- created by nagachika. [Feature #5784]
+ * test/ruby/test_gc.rb: ignore warning messages for running with -w
+ option such as chkbuild.
-Tue May 1 22:18:45 2012 Kouji Takao <kouji@takao7.net>
+Mon Feb 17 20:00:27 2014 Tanaka Akira <akr@fsij.org>
- * ext/readline/readline.c (Readline.pre_input_hook)
- (Readline.insert_text, Readline.redisplay): new function. An
- original patch was created by nagachika. [Feature #5785]
+ * internal.h: Move BDIGIT and related definitions from
+ include/ruby/defines.h.
-Tue May 1 15:46:48 2012 Koichi Sasada <ko1@atdot.net>
+Mon Feb 17 17:41:55 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * common.mk: "$(Q)-..." doesn't work on nmake.
+ * marshal.c (marshal_dump, marshal_load): do not recycle wrapper
+ objects, to prevent from segfault with continuation.
+ [ruby-dev:47970] [Bug #9523]
-Tue May 1 15:32:10 2012 Koichi Sasada <ko1@atdot.net>
+Mon Feb 17 15:43:59 2014 Zachary Scott <e@zzak.io>
- * common.mk: replace '@' prefix to '$(Q)' to control build
- process outputs.
+ * doc/keywords.rdoc: [DOC] Add keywords doc by documenting-ruby/ruby#29
+ https://github.com/documenting-ruby/ruby/pull/29
-Tue May 1 14:17:59 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Mon Feb 17 12:31:31 2014 Koichi Sasada <ko1@atdot.net>
- * ext/openssl/deprecation.rb (OpenSSL.check_func): check if header is
- available for macro compatibility.
+ * gc.c (get_envparam_double): fix a warning message.
-Tue May 1 10:53:54 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Mon Feb 17 12:09:52 2014 Koichi Sasada <ko1@atdot.net>
- * test/ruby/test_settracefunc.rb: ignore traces from another threads
- because Kernel.set_trace_func affects other threads.
+ * gc.c: introduce new environment variable
+ "RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR" to control major/minor GC
+ frequency.
-Tue May 1 06:04:14 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ 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.
- * ext/digest/sha2/sha2.c (REVERSE32): explicitly cast since unsigned
- long may be larger than sha2_word32.
+ * test/ruby/test_gc.rb: add a test.
- * ext/digest/sha2/sha2.c (SHA{256,512,384}_{Final,End}): should clear
- whole content, not pointer size.
+Mon Feb 17 11:28:40 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * ext/digest/*/extconf.rb: use pkg_config to use same library with
- openssl. [ruby-core:44755][Bug #6379]
+ * test/test_pty.rb: ignore warnings to unused variables.
- * ext/openssl/deprecation.rb: extract check for broken Apple OpenSSL.
+Mon Feb 17 11:27:36 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Tue May 1 05:02:30 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * test/test_find.rb: remove unused variables.
- * configure.in (optflags): disable unsafe optimizations.
- [ruby-core:44679][Bug #6370]
+Sun Feb 17 02:12:00 2014 Kenta Murata <mrkn@mrkn.jp>
-Mon Apr 30 23:36:49 2012 Tanaka Akira <akr@fsij.org>
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_initialize): Insert GC guard.
- * lib/fileutils.rb (copy_metadata): use File.lchown and File.lchmod to
- update meta data of symlinks.
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_global_new): ditto.
-Mon Apr 30 23:05:53 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+Sun Feb 16 15:53:36 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * test/ruby/test_continuation.rb (tracing_with_set_trace_func): don't
- call Continuation from other threads. [ruby-dev:45596] [Bug #6382]
+ * test/test_securerandom.rb: File.exists? is deprecated. use File.exist?
-Mon Apr 30 20:10:04 2012 Tanaka Akira <akr@fsij.org>
+Sun Feb 16 15:05:00 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
- * ext/zlib/extconf.rb: detect z_crc_t type which will be defined
- since zlib-1.2.7.
+ * test/pathname/test_pathname.rb: File.exists? is deprecated. use File.exist?
- * ext/zlib/zlib.c (rb_zlib_crc_table): use z_crc_t if available.
+Sun Feb 16 15:00:28 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
-Mon Apr 30 09:02:15 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+ * test/net/ftp/test_ftp.rb: remove unused variables.
+ * test/logger/test_logger.rb: ditto.
- * ext/openssl/lib/openssl/ssl.rb: add hostname to "hostname does not
- match server cert." error. patched by Wes Morgan via Github.
- https://github.com/ruby/ruby/pull/122
+Sun Feb 16 14:52:46 2014 Eric Wong <e@80x24.org>
-Mon Apr 30 04:43:53 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+ * dir.c (dir_s_glob): RB_GC_GUARD instead of volatile
- * ext/psych/lib/psych/json/yaml_events.rb: implicit styles should not
- be changeable for JSON events.
+Sun Feb 16 14:33:52 2014 Tanaka Akira <akr@fsij.org>
-Sun Apr 29 06:12:02 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * include/ruby/ruby.h (RBIGNUM_SIGN): Defined for compatibility.
+ (RBIGNUM_POSITIVE_P): Ditto.
+ (RBIGNUM_NEGATIVE_P): Ditto.
- * parse.y (assoc, parser_yylex): add syntax to splat keyword hash.
- [ruby-core:44591][Feature #6353]
+Sun Feb 16 12:46:47 2014 Eric Wong <e@80x24.org>
- * compile.c (compile_array_): generate keyword splat insns.
+ * io.c (rb_f_backquote): trade volatile for manual recycle
+ rb_gc_force_recycle ensures object is visible until recycle
- * vm.c (m_core_hash_merge_kwd): merge keyword hash into intermediate
- hash. leftward argument is prior currently.
+Sun Feb 16 11:55:14 2014 Eric Wong <e@80x24.org>
-Fri Apr 27 12:34:23 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * marshal.c (marshal_dump): use rb_gc_force_recycle for GC-safety
+ (marshal_load): ditto
+ [ruby-core:60730] [Bug #7805]
- * ext/dl/cfunc.c (rb_dlcfunc_call): should convert a Bignum value to
- unsigned long long on Win64.
- [ruby-core:44636][Bug #6364] reported by raylinn@gmail.com (ray linn)
+Sun Feb 16 08:11:23 2014 Zachary Scott <e@zzak.io>
-Fri Apr 27 10:58:17 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * README.EXT.ja: [DOC] Fix typo by @utenmiki [Fixes GH-534]
+ https://github.com/ruby/ruby/pull/534
- * test/readline/test_readline.rb (setup): avoid affected by user's
- inputrc file. [ruby-dev:45584][Bug #6357]
+Sun Feb 16 07:48:20 2014 Tanaka Akira <akr@fsij.org>
-Fri Apr 27 01:45:05 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/bigdecimal/bigdecimal.c (BIGNUM_ZERO_P): Unused macro removed.
- * thread.c (rb_threadptr_execute_interrupts_common):
- handle timer_interrupt only on the first loop for the case to avoid
- the infinite loop like following case:
- * there is 2 Ruby threads (3 pthreads)
- (1) main thread is waiting at gvl_yield:112 (native_cond_wait)
- (2) sub thread works
- (3) sub thread waits at gvl_yield:133 (native_mutex_unlock)
- (4) main thread works
- (5) main thread goes to gvl_acquire_common
- (6) main thread call rb_wakeup_timer_thread
- (7) timer thread set timer interrupt to the main thread
- (8) main thread works
- (9) main thread waits at gvl_acquire_common:64 (native_cond_wait)
- (10) sub tread works
- (11) set sub thread as the current thread
- (12) run Ruby thread
- (13) ...100ms
- (14) sub thread goes to rb_threadptr_execute_interrupts_common
- (15) sub thread call rb_thread_schedule_limits
- (16) sub thread call gvl_release_common
- (17) sub threads waits at gvl_yield:121 (native_cond_wait)
- (18) main threads works
- (19) main thread back to gvl_yield
- (20) set main thread as the current thread
- (21) main thread call gvl_yield
- (22) main thread waits at gvl_yield:112 (native_cond_wait)
- As described above, the main thread can't escape from
- rb_threadptr_execute_interrupts_common.
- See extended memo: http://bugs.ruby-lang.org/projects/ruby-trunk/wiki/R35480_ExtendedMemo
+Sun Feb 16 06:12:23 2014 Tanaka Akira <akr@fsij.org>
-Fri Apr 27 07:15:07 2012 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.
- * ext/socket/socket.c (sock_s_pack_sockaddr_un): support the longest
- path in sockaddr_un, really.
- reported by nagachika.
- http://d.hatena.ne.jp/nagachika/20120426/ruby_trunk_changes_35474_35476
+ * bignum.c: Follow the above change.
-Thu Apr 26 12:28:06 2012 Tanaka Akira <akr@fsij.org>
+ * gc.c: Ditto.
- * ext/socket/raddrinfo.c (init_unix_addrinfo): support the longest
- path in sockaddr_un.
- (inspect_sockaddr): ditto.
- (addrinfo_mdump): ditto.
- (addrinfo_mload): ditto.
- (rsock_unixpath_str): new function.
- (rsock_unixpath): removed.
- (rsock_unixaddr): use rsock_unixpath_str.
+ * marshal.c: Ditto.
- * ext/socket/socket.c (sock_s_pack_sockaddr_un): support the longest
- path in sockaddr_un.
- (sock_s_unpack_sockaddr_un): ditto.
- (sock_s_gethostbyaddr): unused variable removed.
+ * math.c: Ditto.
- * ext/socket/unixsocket.c (rsock_init_unixsock): support the longest
- path in sockaddr_un.
+ * numeric.c: Ditto.
- * ext/socket/rubysocket.h (rsock_unixpath_str): declared.
- (rsock_unixpath): removed.
+ * random.c: Ditto.
- * test/socket/test_unix.rb: comment out test_nul because abstract unix
- sockets may contain NULs.
+ * rational.c: Ditto.
-Thu Apr 26 01:32:33 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * sprintf.c: Ditto.
- * test/optparse/test_summary.rb (test_summary_containing_space): add
- test for r35467. OptionParser#to_a shouldn't split banner by spaces.
+ * ext/-test-/bignum/bigzero.c: Ditto.
-Wed Apr 25 23:02:46 2012 Tanaka Akira <akr@fsij.org>
+ * ext/-test-/bignum/intpack.c: Ditto.
- * ext/socket/raddrinfo.c (init_unix_addrinfo): refine error message
- format.
- (addrinfo_mload): show more information on "too long AF_UNIX path"
- error.
- (addrinfo_unix_path): ditto for "too short AF_UNIX address" and
- "too long AF_UNIX address" error.
+ * ext/bigdecimal/bigdecimal.c: Ditto.
-Wed Apr 25 05:46:12 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Feb 15 20:48:49 2014 Tanaka Akira <akr@fsij.org>
- * lib/optparse.rb (OptionParser#to_a): split for each lines.
- [ruby-dev:45568][Bug #6348]
+ * configure.in (FILE_READEND): Don't detect it because it is not used.
-Tue Apr 24 21:57:53 2012 Tanaka Akira <akr@fsij.org>
+Sat Feb 15 13:22:28 2014 Eric Wong <e@80x24.org>
- * ext/socket/raddrinfo.c (init_unix_addrinfo): show actual path length
- when it is too long for Unix socket.
+ * probes_helper.h (RUBY_DTRACE_HOOK): correct type for _id
- * ext/socket/unixsocket.c (rsock_init_unixsock): ditto.
+Sat Feb 15 11:47:47 2014 Tanaka Akira <akr@fsij.org>
- * ext/socket/socket.c (sock_s_pack_sockaddr_un): ditto.
+ * bignum.c (rb_big_cmp): Avoid bignum allocation for comparison
+ between bignum and fixnum.
-Tue Apr 24 21:43:58 2012 Yusuke Endoh <mame@tsg.ne.jp>
+Sat Feb 15 10:55:12 2014 Hiroshi Shirosaki <h.shirosaki@gmail.com>
- * lib/net/smtp.rb (check_continue): raise an error with an explanatory
- message. [ruby-core:35854] [Feature #4598]
+ * ext/-test-/win32/fd_setsize/depend: fix wrong dependencies.
+ [ruby-dev:47253]
-Tue Apr 24 21:11:31 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Sat Feb 15 00:38:54 2014 Tanaka Akira <akr@fsij.org>
- * lib/optparse.rb (OptionParser#to_a): should split by end-of-line,
- and MUST TEST IT, MUST RUN THE TEST, MUST VERIFY BEFORE BACKPORT.
- [ruby-dev:45568][Bug #6348]
+ * 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.
-Tue Apr 24 19:59:31 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * 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.
- * enc/euc_jp.c: added EUC-JP-2004 and its alias EUC-JISX0213.
- [ruby-dev:45571] [Feature #6349]
- Requested by Kyouhei Yanagita <yanagi@shakenbu.org>.
+ [ruby-core:57111] [Feature #8887]
- * enc/trans/japanese_euc.trans: ditto.
+Sat Feb 15 00:27:46 2014 Tanaka Akira <akr@fsij.org>
- * enc/trans/JIS/JISX0213-[12]%UCS@{BMP,SIP}.src: JIS X 0213:2004 ->
- Unicode mapping table from NetBSD.
+ * include/ruby/ruby.h,
+ internal.h,
+ ext/-test-/bignum/bigzero.c: Hide a Bignum definition.
+ [ruby-core:42891] [Feature #6083]
- * enc/trans/JIS/UCS@{BMP,SIP}%JISX0213-[12].src: Unicode -> JIS X
- 0213:2004 mapping table from NetBSD.
+Sat Feb 15 00:13:14 2014 Tanaka Akira <akr@fsij.org>
- * tool/transcode-tblgen.rb: added SIP support.
+ * 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]
- * test/ruby/test_transcode.rb: tests of above changes.
+Fri Feb 14 18:38:46 2014 Eric Wong <e@80x24.org>
-Tue Apr 24 18:12:13 2012 Koichi Sasada <ko1@atdot.net>
+ * 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]
- * compile.c: fix to output warning when the same literals
- are available as a condition of same case clause.
- And remove information ('#n') because we can find duplicated
- condition with explicit line numbers.
- [ruby-core:38343] [Ruby 1.9 - Bug #5068]
+Thu Feb 13 23:30:30 2014 Shugo Maeda <shugo@ruby-lang.org>
- * test/ruby/test_syntax.rb: add a test for above.
+ * 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]
-Tue Apr 24 17:03:51 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * 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]
- * win32/win32.c (waitpid): need to check the return value of
- FindChildSlotByHandle() before passing poll_child_status().
- this fixed a SEGV in test-all. reported by ko1 via IRC.
+ * test/ruby/test_refinement.rb: related tests.
-Tue Apr 24 16:04:39 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Feb 13 18:38:15 2014 Eric Wong <e@80x24.org>
- * parse.y (parser_yylex): EXPR_BEG by keywords is a start point of
- commands. [ruby-dev:45563][Bug #6347]
+ * re.c (rb_reg_raise): remove volatile
+ Unnecessary since r41597
- * parse.y (superclass): ditto for superclass.
+Thu Feb 13 18:28:51 2014 Eric Wong <e@80x24.org>
- * parse.y (parser_parse_string, parser_here_document): ditto for
- string interpolation.
+ * re.c (rb_reg_regcomp): remove volatile
+ Unnecessary since r13261
- * parse.y (parser_yylex): ditto for singleton class.
+Thu Feb 13 16:54:32 2014 Zachary Scott <e@zzak.io>
-Tue Apr 24 15:51:41 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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
- * lib/optparse.rb (OptionParser#to_a): should split by end-of-line
- [ruby-dev:45568][Bug #6348]
+Thu Feb 13 15:43:16 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/optparse.rb (OptionParser#to_a): String#to_a is no longer
- defined. [ruby-dev:45568][Bug #6348]
+ * parse.y (IDSET_ATTRSET_FOR_INTERN): fix off-by-one bug.
-Tue Apr 24 12:46:50 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+ * parse.y (rb_enc_symname_type): junk ID succeeded by '=' is also
+ attrset ID. [ruby-core:60668] [Bug #8756]
- * hash.c, object.c, struct.c, lib/ostruct.rb: add to_h methods.
- [Feature #6276]
+Thu Feb 13 11:06:32 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Apr 24 10:54:34 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * configure.in: check if pthread_setname_np is available.
- * test/drb/drbtest.rb ({DRbCore,DRbAry}#teardown): cannot pass SIGTERM
- to another process on Windows, so use SIGINT instead.
+ * thread_pthread.c: pthread_setname_np is not available on old
+ Darwins. [ruby-core:60524] [Bug #9492]
-Tue Apr 24 00:25:39 2012 Yusuke Endoh <mame@tsg.ne.jp>
+Thu Feb 13 00:56:59 2014 Masaki Matsushita <glass.saga@gmail.com>
- * thread.c (rb_check_deadlock): refine an error message of deadlock
- detection. [ruby-core:44336] [Bug #6288]
+ * configure.in: revert r44922. I should have used AC_CHECK_FUNCS()
+ to just define a symbol if the function is available.
-Tue Apr 24 00:14:42 2012 Yusuke Endoh <mame@tsg.ne.jp>
+Thu Feb 13 00:20:58 2014 Masaki Matsushita <glass.saga@gmail.com>
- * parse.y (primary): remove wrong "fixpos" that caused incorrect
- source_location of blocks. [ruby-core:42232] [Bug #5930]
+ * configure.in: use AC_CHECK_FUNC instead of AC_CHECK_FUNCS
+ if available.
- * test/ruby/test_proc.rb: add a test for above.
+Thu Feb 13 00:15:10 2014 Masaki Matsushita <glass.saga@gmail.com>
-Mon Apr 23 22:56:08 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * configure.in: fix to undefine HAVE_MEMMEM correctly if it is broken.
- * ext/iconv: deprecated. [Feature #6322]
+Tue Feb 11 23:54:40 2014 Tanaka Akira <akr@fsij.org>
-Mon Apr 23 22:07:00 2012 Tanaka Akira <akr@fsij.org>
+ * bignum.c (rb_big_cmp): Specialize a comparison to zero.
- * test/socket/test_unix.rb (bound_unix_socket): make temporary
- filename shorter for less possibility of Unix socket path over
- 107 bytes when TMPDIR has long path.
+ * ext/bigdecimal/bigdecimal.c (is_negative): Use rb_big_cmp instead of
+ RBIGNUM_NEGATIVE_P.
+ (BigMath_s_log): Ditto.
-Mon Apr 23 20:35:49 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+Tue Feb 11 22:59:10 2014 Tanaka Akira <akr@fsij.org>
- * win32/win32.c (szInternalCmds, internal_match, internal_cmd_match):
- get rid of a segmentation fault with GCC 4.7.0.
- reported by raylinn@gmail.com (ray linn) at [ruby-core:44505]
- [Bug #6333], and patched by mame.
+ * ext/openssl/ossl_bn.c (ossl_bn_initialize): Use rb_integer_pack.
+ Fix SEGV by OpenSSL::BN.new(1 << (2**34)).
- * test/ruby/test_system.rb (TestSystem#test_system): test for it.
+Tue Feb 11 17:00:38 2014 Zachary Scott <e@zzak.io>
-Mon Apr 23 20:11:02 2012 Tanaka Akira <akr@fsij.org>
+ * ext/tk/README.tcltklib: [DOC] Fix typo by @xta [Fixes GH-532]
- * lib/drb/ssl.rb: generate 1024 bits RSA key instead of 512 bits.
- OpenSSL 1.0.1 rejects 512 bits RSA key for TLS1.2 with SHA512.
- http://rt.openssl.org/Ticket/Display.html?id=2769&user=guest&pass=guest
- reported by Bohuslav Kabrda.
- [ruby-core:43844] [ruby-trunk - Bug #6221]
+Sun Feb 9 13:59:29 2014 Tanaka Akira <akr@fsij.org>
-Mon Apr 23 19:54:33 2012 Tanaka Akira <akr@fsij.org>
+ * configure.in: Fix compilation error.
+ https://bugs.ruby-lang.org/issues/8358#note-16
- * test/drb/drbtest.rb: rescue Errno::ESRCH for Process.kill.
- reported by NARUSE, Yui. [ruby-dev:45551]
+Sun Feb 9 05:20:24 2014 NARUSE, Yui <naruse@ruby-lang.org>
-Mon Apr 23 14:16:45 2012 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.
- * .gdbinit (rb_ps_vm): follow st_table's packing change.
+Sun Feb 9 04:07:34 2014 Zachary Scott <e@zzak.io>
-Mon Apr 23 10:43:30 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/yaml.rb: [DOC] Add links to syck and psych on github [Bug #9501]
+ Based on a patch by Giorgos Tsiftsis
- * configure.in: disable rubygems not to load rbconfig.rb before
- fake.rb. [ruby-core:44492][Bug #6329]
+Sun Feb 9 02:13:53 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Apr 22 20:26:06 2012 Tanaka Akira <akr@fsij.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]
- * lib/drb/extservm.rb (DRb::ExtServManager): don't use /bin/sh to
- invoke service subprocess. mark detach threads for clean up.
+Sat Feb 8 23:40:35 2014 Vit Ondruch <vondruch@redhat.com>
- * test/drb/drbtest.rb: clean up the service subprocess in teardown.
+ * 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]
- * test/drb/test_drb.rb: set @service_name for teardown.
+Sat Feb 8 21:44:07 2014 Masaki Matsushita <glass.saga@gmail.com>
- * test/drb/test_drbunix.rb: ditto.
+ * configure.in: check qsort_r(3) and whether it is GNU version.
+ BSD version has different prototype.
- * test/drb/test_drbssl.rb: ditto.
+ * util.h: use qsort_r() as ruby_qsort() if it is GNU version.
- [ruby-dev:45547]
+ * util.c: define ruby_qsort() if needed.
-Sun Apr 22 07:51:29 2012 Tanaka Akira <akr@fsij.org>
+Sat Feb 8 16:34:36 2014 Tanaka Akira <akr@fsij.org>
- * lib/drb/ssl.rb: close accepted TCP socket if SSL accept is failed.
- [ruby-dev:45541]
+ * lib/resolv.rb (Resolv::DNS::Message::MessageDecoder#get_labels):
+ Make it iterative.
-Sat Apr 21 14:36:49 2012 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+Sat Feb 8 15:54:12 2014 Koichi Sasada <ko1@atdot.net>
- * test/rinda/test_rinda.rb: fix sticks on some tests problem
- [Bug #6272]
+ * 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.
-Fri Apr 20 12:24:04 2012 Eric Hodel <drbrain@segment7.net>
+Sat Feb 8 15:41:37 2014 Tanaka Akira <akr@fsij.org>
- * lib/rubygems/ssl_certs/AddTrustExternalCARoot.pem: Removed to avoid
- conflict with ca-bundle.pem
- * lib/rubygems/ssl_certs/VerisignClass3PublicPrimaryCertificationAuthority-G2.pem:
- ditto.
- * lib/rubygems/ssl_certs/Entrust_net-Secure-Server-Certification-Authority.pem:
- ditto.
+ * lib/resolv.rb: Don't set CLOEXEC flag explicitly. (Ruby set it by
+ default.)
-Fri Apr 20 08:07:06 2012 Eric Hodel <drbrain@segment7.net>
+Sat Feb 8 15:27:02 2014 Tanaka Akira <akr@fsij.org>
- * lib/rubygems: Update to RubyGems 1.8.23 which contains security
- fixes:
+ * lib/resolv.rb (Resolv::DNS::Message::MessageDecoder): Raise
+ DecodeError if no data before the limit.
+ Reported by Will Bryant. [ruby-core:60557] [Bug #9498]
- RubyGems now disallows redirection from HTTPS to HTTP.
+Sat Feb 8 15:11:21 2014 Tanaka Akira <akr@fsij.org>
- RubyGems now verifies SSL connections.
+ * io.c (SMALLBUF): Unused macro removed.
- See https://github.com/rubygems/rubygems/blob/1.8/History.txt for
- changes since 1.8.22.
- * test/rubygems: ditto.
+Fri Feb 7 23:37:49 2014 Tanaka Akira <akr@fsij.org>
-Thu Apr 19 16:33:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/resolv.rb: Ignore name servers which cause EAFNOSUPPORT on
+ socket creation.
+ Reported by Bjoern Rennhak. [ruby-core:60442] [Bug #9477]
- * strftime.c (rb_strftime_with_timespec): fix carry-up bug and
- overwrite '+' with '-' if negative offset less than a hour.
- [ruby-core:44447][Bug #6323]
+Fri Feb 7 21:58:48 2014 Zachary Scott <e@zzak.io>
-Thu Apr 19 09:39:57 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * lib/open-uri.rb: [DOC] use lower case version of core classes, same
+ as commit r44878, based on patch by Jonathan Jackson [Bug #9483]
- * ext/-test-/win32/dln/extconf.rb: need import library for ordinal
- entry even on mingw. [ruby-core:44441][Bug #6320]
+Fri Feb 7 21:54:53 2014 Zachary Scott <e@zzak.io>
-Thu Apr 19 09:35:15 2012 Eric Hodel <drbrain@segment7.net>
+ * 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]
- * random.c (random_init): Clarify that the default seed is
- Random.new_seed, not zero. Based on patch by Roger Pack.
- [ruby-trunk - Bug #6313]
- * random.c (rb_f_srand): ditto.
+Fri Feb 7 05:28:38 2014 Eric Wong <e@80x24.org>
-Thu Apr 19 08:59:02 2012 Eric Hodel <drbrain@segment7.net>
+ * constant.h: reduce rb_const_entry_t size on 64-bit
+ Patch by Adam Avilla [ruby-core:60542] [Feature #9496]
- * ext/curses/curses.c (window_nodelay): Fixed call-seq of nodelay to
- include the '='.
+Thu Feb 6 15:27:46 2014 Koichi Sasada <ko1@atdot.net>
- Improved description window.nodelay=.
+ * gc.c (get_envparam_int): correct warning messages.
-Thu Apr 19 08:47:54 2012 Eric Hodel <drbrain@segment7.net>
+ * gc.c (get_envparam_double): ditto.
- * io.c (io_readpartial): Document the output buffer parameter is
- overwritten with the read contents even when non-empty.
- Patch by yu nobuoka. [ruby-trunk - Bug #6285]
- * io.c (io_read_nonblock): ditto.
- * io.c (io_read): ditto.
- * io.c (rb_io_sysread): ditto.
- * io.c (argf_read): ditto.
- * io.c (argf_readpartial): ditto.
- * ext/stringio/stringio.c (strio_read): ditto.
- * test/ruby/test_argf.rb (class TestArgf): Add test for existing
- behavior of read outbuf.
- * test/ruby/test_io.rb (class TestIO): ditto.
- * test/stringio/test_stringio.rb (class TestStringIO): ditto.
+Thu Feb 6 15:17:30 2014 Koichi Sasada <ko1@atdot.net>
-Wed Apr 18 22:58:55 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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.
- * configure.in (DOT, DOXYGEN): use AC_CHECK_PROGS instead of
- AC_CHECK_PROG which needs the third argument. [ruby-core:44433]
- [Bug #6316]
+ * gc.c (get_envparam_double): ditto.
- * configure.in (PKG_CONFIG): fix condition to skip older version
- of pkg-config. continue in backticks does not affect outside.
+Thu Feb 6 09:00:35 2014 Koichi Sasada <ko1@atdot.net>
-Wed Apr 18 13:59:40 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * 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.
- * win32/file.c (INVALID_FILE_ATTRIBUTES): define for old SDK.
+ * gc.c (get_envparam_int): accept a value equals to lowerbound.
-Wed Apr 18 10:22:54 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * gc.c (get_envparam_double): ditto.
- * strftime.c (rb_strftime_with_timespec): add an interim digit for
- the timezone offset which is less than an hour.
+Thu Feb 6 08:23:28 2014 Eric Wong <e@80x24.org>
-Wed Apr 18 09:58:29 2012 Eric Hodel <drbrain@segment7.net>
+ * 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
- * lib/rubygems/version.rb: Fixed init_with warning by calling into
- yaml_initialize (for syck) from psych's init_with
+Thu Feb 6 07:18:01 2014 Eric Hodel <drbrain@segment7.net>
-Wed Apr 18 09:03:43 2012 Eric Hodel <drbrain@segment7.net>
+ * lib/rubygems: Update to RubyGems 2.2.2. Complete history at:
- * lib/rubygems: Update to RubyGems 1.8.22 plus r33517 and r35337 which
- were ported to the rubygems git repository.
-
- See https://github.com/rubygems/rubygems/blob/1.8/History.txt for
- changes since 1.8.11.
+ http://rubygems.rubyforge.org/rubygems-update/History_txt.html#label-2.2.2+%2F+2014-02-05
* test/rubygems: ditto.
-Tue Apr 17 22:18:48 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * strftime.c (rb_strftime_with_timespec): fix padding of time zone
- offset. [ruby-dev:43287][Bug #4458]
-
-Tue Apr 17 13:11:14 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dln.c (rb_w32_check_imported): skip ordinal entries. based on a
- patch by phasis68 (Heesob Park) at [ruby-core:44381].
- [ruby-core:44371][Bug #6303]
-
-Mon Apr 16 18:22:14 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * spec/default.mspec: expand relative path for ruby_exe which uses
- them with Dir.chdir; it breaks relative paths, for example
- core/kernel/exec_spec.rb.
-
-Mon Apr 16 16:22:40 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (gmtime_r, localtime_r): POSIX compliant reentrant
- versions.
-
- * configure.in (RUBY_MSVCRT_VERSION): define on mingw too.
-
- * win32/Makefile.sub (config.h): prefix RT_VER with RUBY and make
- more descriptive to get rid of potential conflict.
-
-Mon Apr 16 15:19:39 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (NO_RUBY_VENDOR_LIB): fix missing comma.
-
-Mon Apr 16 12:17:12 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/matrix.rb (hermitian?): Bug fix, patch by George Koehler
- [Bug #6290] [rubyspec:4b9573d7613]
-
-Mon Apr 16 09:42:50 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * lib/rubygems/remote_fetcher.rb (Gem::RemoteFetcher#download): should
- use File.identical? to check the identity of the files.
- this fixed an error of a test on Windows.
-
-Sat Apr 14 12:55:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (UNREACHABLE): gcc 4.4 eliminates unreachable code
- if -O3 is given.
-
- * win32/win32.c (child_result): dropped colon.
-
-Sat Apr 14 10:45:18 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/webrick/server.rb (WEBrick::GenericServer#start):
- partially revert r35315.
-
- * test/webrick/test_server.rb (test_start_exception):
- received signal is delivered to the main thread, so it is needed to
- emulate it. patched by Eric Hodel. [ruby-core:44348] [Feature #6236]
-
-Sat Apr 14 09:35:45 2012 Eric Hodel <drbrain@segment7.net>
-
- * variable.c (trace_ev): Removed "not reached" comment as this line is
- reached.
- * variable.c (rb_obj_remove_instance_variable): Replaced "not reached"
- comment with the UNREACHABLE macro.
- * variable.c (rb_mod_const_missing): ditto.
- * variable.c (rb_mod_remove_cvar): ditto.
- * enum.c (first_i): ditto.
- * string.c (rb_str_aref): ditto.
- * string.c (str_byte_aref): ditto.
- * string.c (rb_to_id): ditto.
- * io.c (rb_io_fmode_modestr): ditto.
- * io.c (rb_io_oflags_modestr): ditto.
- * pack.c (num2i32): ditto.
- * vm_eval.c (rb_method_missing): ditto.
- * vm_eval.c (rb_f_throw): ditto.
- * dir.c (dir_read): ditto.
- * win32/win32.c (child_result): ditto.
- * struct.c (rb_struct_getmember): ditto.
- * struct.c (rb_struct_set): ditto.
- * struct.c (rb_struct_aref_id): ditto.
- * eval.c (rb_f_raise): ditto.
- * process.c (rb_f_exit_bang): ditto.
- * process.c (rb_f_exit): ditto.
- * process.c (rb_f_abort): ditto.
- * ext/-test-/iter/break.c (iter_break_value): ditto.
- * ext/pty/pty.c (pty_check): ditto.
- * ext/openssl/ossl_pkey.c (ossl_pkey_new): ditto.
- * ext/readline/readline.c (rb_remove_history): ditto.
- * ext/stringio/stringio.c (strio_unimpl): ditto.
- * numeric.c (num_sadded): ditto.
- * numeric.c (num_init_copy): ditto.
- * numeric.c (rb_num2ll): ditto.
- * numeric.c (rb_num2ull): ditto.
- * vm_insnhelper.c (call_cfunc): ditto.
- * ruby.c (opt_W_getter): ditto.
- * bignum.c (rb_big_coerce): ditto.
- * file.c (rb_f_test): ditto.
-
-Sat Apr 14 08:38:20 2012 Eric Hodel <drbrain@segment7.net>
-
- * encoding.c (rb_enc_codepoint_len): Use UNREACHABLE to avoid "control
- reaches end of non-void function" warnings. [ruby-trunk - Bug #6066]
- * re.c (name_to_backref_number): ditto.
- * object.c (rb_Float): ditto.
- * io.c (io_readpartial): ditto.
- * io.c (io_read_nonblock): ditto.
- * pack.c (rb_uv_to_utf8): ditto.
- * proc.c (rb_method_entry_arity): ditto.
- * vm_method.c (rb_f_notimplement): ditto.
- * struct.c (rb_struct_aset_id): ditto.
- * class.c (rb_scan_args): ditto.
- * process.c (rlimit_resource_type): ditto.
- * process.c (rlimit_resource_value): ditto.
- * process.c (p_uid_switch): ditto.
- * process.c (p_gid_switch): ditto.
- * ext/digest/digest.c (rb_digest_instance_update): ditto.
- * ext/digest/digest.c (rb_digest_instance_finish): ditto.
- * ext/digest/digest.c (rb_digest_instance_reset): ditto.
- * ext/digest/digest.c (rb_digest_instance_block_length): ditto.
- * ext/bigdecimal/bigdecimal.c (BigDecimalCmp): ditto.
- * ext/dl/handle.c (rb_dlhandle_close): ditto.
- * ext/tk/tcltklib.c (pending_exception_check0): ditto.
- * ext/tk/tcltklib.c (pending_exception_check1): ditto.
- * ext/tk/tcltklib.c (ip_cancel_eval_core): ditto.
- * ext/tk/tcltklib.c (lib_get_reltype_name): ditto.
- * ext/tk/tcltklib.c (create_dummy_encoding_for_tk_core): ditto.
- * ext/tk/tkutil/tkutil.c (tk_hash_kv): ditto.
- * ext/openssl/ossl_ssl.c (ossl_ssl_session_reused): ditto.
- * ext/openssl/ossl_pkey_ec.c (ossl_ec_key_dsa_verify_asn1): ditto.
- * ext/openssl/ossl_pkey_ec.c (ossl_ec_point_is_at_infinit): ditto.
- * ext/openssl/ossl_pkey_ec.c (ossl_ec_point_is_on_curve): ditto.
- * ext/fiddle/conversions.c (generic_to_value): ditto.
- * ext/socket/raddrinfo.c (rsock_io_socket_addrinfo): ditto.
- * ext/socket/socket.c (sock_s_getnameinfo): ditto.
- * ext/ripper/eventids2.c (ripper_token2eventid): ditto.
- * cont.c (return_fiber): ditto.
- * dmydln.c (dln_load): ditto.
- * vm_insnhelper.c (vm_search_normal_superclass): ditto.
- * bignum.c (big_fdiv): ditto.
- * marshal.c (r_symlink): ditto.
- * marshal.c (r_symbol): ditto.
-
-Fri Apr 13 17:12:09 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * hash.c (inspect_i): keep string's coderange.
-
-Fri Apr 13 15:26:51 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * hash.c (rb_hash_aset, rb_hash_update, rb_hash_update_by): use
- st_update() to reduce evaluation of hash values.
-
-Fri Apr 13 15:17:36 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/webrick/server.rb (WEBrick::GenericServer#stop): fix r35303;
- this method is to deny new connections, not shutdown yet.
-
- * lib/webrick/server.rb (WEBrick::GenericServer#start):
- re-raise exception only when the exception is Interrupt (^C).
-
-Thu Apr 12 19:51:45 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_core.c: added some notes.
-
-Wed Apr 11 17:16:49 2012 Koichi Sasada <ko1@atdot.net>
-
- * compile.c (compile_array, compile_array_):
- Divide big array (or hash) literals into several blocks and
- concatenate them. There was a problem that a big array (hash)
- literal causes SystemStackError exception (stack overflow)
- because VM push all contents of the literal onto VM stack to
- make an array (or hash). To solve this issue, we make several
- arrays (hashes) and concatenate them to make a big array (hash)
- object. [ruby-dev:37701] [Bug #982]
-
- * compile.c (iseq_compile_each, setup_args): use modified
- compile_array.
-
- * vm.c (m_core_hash_from_ary, m_core_hash_merge_ary,
- m_core_hash_merge_ptr): added for above change.
-
- * id.c (Init_id), parse.y: add core method ids.
-
- * bootstraptest/test_literal.rb: add simple tests.
-
- * bootstraptest/test_eval.rb: remove rescue clause to catch
- SystemStackError exception.
-
- * test/ruby/test_literal.rb: add tests to check no stack overflow.
-
-Thu Apr 12 07:10:37 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/uri/generic.rb (module URI): URI now downcases the scheme to
- follow RFC 2396 section 3.1. [ruby-trunk - Feature #4551]
- * test/uri/test_generic.rb (class URI): Test for above
-
-Thu Apr 12 06:15:44 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/net/protocol.rb (module Net): Added ReadTimeout to match
- OpenTimeout. ReadTimeout is now raised by rbuf_fill instead of
- Timeout::Error to help users distinguish what type of timeout
- occurred. [ruby-trunk - Feature #6088]
- * lib/net/pop.rb (module Net): Updated documentation for ReadTimeout
- and OpenTimeout.
- * lib/net/http.rb (module Net): ditto
- * lib/net/smtp.rb (module Net): ditto
- * lib/net/telnet.rb (module Net): Net::ReadTimeout is now raised in
- waitfor to match Net::Protocol.
- * test/net/http/test_http.rb: Updated Timeout::Error expectation to
- Net::ReadTimeout.
- * test/net/ftp/test_ftp.rb: ditto
-
-Thu Apr 12 05:27:01 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/webrick/server.rb (module WEBrick::GenericServer): A server
- will now continue only when a StandardError subclass is raised. For
- other exception types the error will be logged at the fatal level and
- the server will safely stop. Based on a patch by Alex Young.
- [ruby-trunk - Feature #6236]
- * test/webrick/test_server.rb: Test for new exception handling
- behavior. Join the server thread instead of busy-waiting for it to
- shut down to remove race conditions.
-
-Thu Apr 12 03:50:44 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/test/unit.rb (Test::Unit:Runner::Worker#_run_suites):
- call GC.start before running the test suites.
-
-Wed Apr 11 22:31:19 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (rb_check_id_cstr): new function to check if ID is
- registered with NUL-terminated C string.
-
- * sprintf.c (rb_str_format): avoid inadvertent symbol creation.
-
-Wed Apr 11 20:28:36 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * io.c (rb_io_eof): use eof() instead of io_fillbuf(). It's because
- io_unread() doesn't work properly when reading CRLF with read(length)
- and mode 'r'.
- [ruby-core:44189][Bug #6271]
-
- * test/ruby/test_io_m17n.rb (TestIO_M17N#test_read_crlf_and_eof):
- test for above.
-
-Wed Apr 11 07:38:33 2012 Eric Hodel <drbrain@segment7.net>
-
- * ext/digest/sha2/lib/sha2.rb (Digest#block_length): Fixed method name
- in documentation examples. Patch by naleski via
- https://github.com/ruby/ruby/pull/115
-
-Wed Apr 11 07:33:13 2012 Eric Hodel <drbrain@segment7.net>
-
- * pack.c (pack_pack): Warn when an invalid character is found in the
- format string when $VERBOSE is true. [ruby-trunk - Feature #5219]
- * pack.c (pack_unpack): ditto
- * test/ruby/test_pack.rb (class TestPack): Test for warnings on
- invalid format characters.
-
-Wed Apr 11 06:11:10 2012 Eric Hodel <drbrain@segment7.net>
-
- * string.c (rb_str_tr): Documented use of \ to escape characters.
- [ruby-trunk - Bug #6161]
- * string.c (rb_str_count): ditto
-
-Wed Apr 11 05:14:51 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/abbrev.rb: Clarified that Abbrev.abbrev returns a Hash instead
- of an Array. Patch by Andrei Bocan. [ruby-trunk - Bug #6107]
-
-Wed Apr 11 03:02:24 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * ext/ripper/lib/ripper/sexp.rb: fix spelling. patched by
- Jonathan Hinkle via https://github.com/ruby/ruby/pull/116
-
-Tue Apr 10 19:07:04 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * error.c (rb_enc_raise): new function to raise an exception with
- the message in the given encoding. patched by now (Nikolai
- Weibull) at [ruby-core:41160]. [Feature #5650]
-
-Tue Apr 10 18:19:32 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/net/http.rb (Net::HTTP#send_request_with_body_stream):
- use IO.copy_stream for requests using body_stream.
- patched by Eric Wong. [ruby-core:40898] [Feature #5605]
-
-Tue Apr 10 16:53:21 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * thread_pthread.c: add prototype declarations for older Mac OS X.
- [ruby-core:43376][Bug #6170]
-
-Tue Apr 10 15:35:21 2012 Koichi Sasada <ko1@atdot.net>
-
- * compile.c (iseq_set_sequence): show a hint if there are duplicated
- "when" clauses. [ruby-core:41502] [ruby-trunk - Feature #5716]
-
-Tue Apr 10 09:57:00 2012 Eric Hodel <drbrain@segment7.net>
-
- * string.c (rb_str_split_m): Documented behavior of split on the empty
- string. [ruby-trunk - Feature #3575]
-
-Tue Apr 10 09:48:31 2012 Eric Hodel <drbrain@segment7.net>
-
- * ext/zlib/zlib.c (rb_deflate_s_deflate): Fixed ruby example replacing
- NO_FLUSH with FINISH. [ruby-trunk - Bug #6273]
-
-Mon Apr 9 23:10:26 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (isUNCRoot, winnt_stat): support long UNC.
- [ruby-core:30623][Feature #3399]
-
-Mon Apr 9 15:16:01 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (string_content, parser_yylex): count brace nesting to
- dispatch embexpr_end. [ruby-core:43775][Bug #6211]
-
-Mon Apr 9 13:06:58 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * hash.c (rb_hash_set_default_proc): Accept nil, patch by Run Paint
- [Feature #4234]
-
- * test/ruby/test_hash.rb: test for above.
-
-Mon Apr 9 08:01:15 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_strftime.c: gets the value with range() consistently.
- * ext/date/date_strftime.c (range): now just replaces the given item.
+Wed Feb 5 20:56:32 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Apr 9 06:58:01 2012 Tadayoshi Funaba <tadf@dotrb.org>
+ * marshal.c (to_be_skipped_id): ignore anonymous attributes.
- * complex.c (nucomp_expt): [ruby-core:44170].
+ * pack.c (Init_pack): use anonymous ID so that associated objects
+ do not appear in the packed result.
-Mon Apr 9 02:52:03 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * parse.y (rb_make_internal_id): return an anonymous ID for
+ internal use.
- * complex.c (nucomp_expt): the result of f_complex_new2 may be a fixnum
- with mathn. [ruby-core:44170] [Bug #6267]
+Wed Feb 5 14:41:56 2014 Koichi Sasada <ko1@atdot.net>
-Sun Apr 8 22:46:01 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * vsnprintf.c: remove duplicated def of `UNINITIALIZED_VAR()'.
- * ext/json/generator/generator.c (generate_json_bignum):
- add RB_GC_GUARD.
- http://fb.rubyci.org/~chkbuild/ruby-trunk/log/20120407T210301Z.diff.html.gz
+Wed Feb 5 14:40:16 2014 Koichi Sasada <ko1@atdot.net>
-Sun Apr 8 07:26:40 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/objspace/objspace_dump.c (dump_object): use STR_SHARED_P()
+ instead of removed STR_NOCAPA_P() macro.
- * lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler): get keys
- and fetch values from it to prevent @timeout_info's error
- "can't add a new key into hash during iteration".
+Wed Feb 5 13:51:33 2014 Koichi Sasada <ko1@atdot.net>
-Sun Apr 8 06:51:57 2012 NARUSE, Yui <naruse@ruby-lang.org>
+ * internal.h, vm_core.h: move LIKELY/UNLIKELY/UNINITIALIZED_VAR()
+ macros from vm_core.h to internal.h.
- * io.c (io_unread): cast as long the value for extra_max.
- [ruby-core:44137] [Bug #6257]
+ * string.c: remove dependency to "vm_core.h".
-Sun Apr 8 06:46:48 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/webrick/httpresponse.rb (WEBrick::HTTPResponse#send_body_io):
- use readpartial to get data even if the response is streaming data and
- each data is smaller than @buffer_size.
- patched by yu nobuoka. [ruby-dev:45471] [Bug #6230]
-
-Sat Apr 7 22:35:36 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * include/ruby/win32.h (rb_w32_aspawn_flags): add the declaration of
- new function.
-
- * process.c (enum): add EXEC_OPTION_PGROUP and move the position
- above for the usage in proc_spawn_n().
-
- * process.c (proc_spawn_n): add an argument to pass new option
- `new_pgroup`. The option specifies CREATE_NEW_PROCESS_GROUP flag to
- CreateProcessW(). This flag is necessary for the usage of
- Process.kill on the subprocess on Windows.
-
- * process.c (rb_exec_arg_addopt): ditto.
-
- * process.c (rb_spawn_process): ditto.
-
- * process.c (documentation for rb_f_spawn): add documentation for new
- option `new_pgroup` of spawn.
-
- * test/ruby/test_process.rb (TestProcess#test_execopts_new_pgroup):
- add tests for option `new_pgroup`.
-
- * test/ruby/test_thread.rb
- (TestThreadGroup#test_thread_timer_and_interrupt):
- add option `new_pgroup: true` to spawn on Windows. It's needed for
- Process.kill on a subprocess.
-
- * win32/win32.c (CreateChild): add an argument to pass
- dwCreationFlags of CreateProcessW().
-
- * win32/win32.c (rb_w32_spawn): ditto.
-
- * win32/win32.c (rb_w32_aspawn_flags): add new function to pass
- dwCreationFlags.
-
- * win32/win32.c (rb_w32_aspawn): refactor to move the content to
- rb_w32_aspawn_flags().
- [ruby-core:43245][Bug #6131]
-
-Sat Apr 7 22:32:00 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * test/ruby/test_thread.rb
- (TestThreadGroup#test_thread_timer_and_interrupt): skip on Windows.
- Process.kill cannot kill a subprocess if CREATE_NEW_PROCESS_GROUP
- flag is not specified in a call to CreateProcessW().
-
- * win32/win32.c (CreateChild): revert the usage of
- CREATE_NEW_PROCESS_GROUP flag for compatibility.
- [ruby-core:43245][Bug #6131]
-
-Sat Apr 7 10:28:40 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych.rb: bumping up psych version to match release.
- * ext/psych/psych.gemspec: ditto
-
-Sat Apr 7 02:07:00 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/parser.c: fall back to any encoding if the external
- encoding is wrong. [ruby-core:44163]
- * test/psych/test_encoding.rb: fix test
-
-Fri Apr 6 16:24:24 2012 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * struct.c (documentation for rb_struct_members_m):
- fix 'array of strings' to 'array of symbols'
- [ruby-core:44152][Bug #6264]
-
-Fri Apr 6 14:27:04 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * Makefile.in ($(LIBRUBY_A)): fix typo.
-
-Thu Apr 5 13:26:15 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * missing/alloca.c (xmalloc, xfree): use ruby version, not
- depending on RUBY_LIB_PREFIX. [ruby-dev:45492][Bug #6255]
-
-Wed Apr 4 13:06:39 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/ftp/ftp.rb (Net::FTP#close): restore original read_timeout.
-
-Wed Apr 4 10:33:31 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/ftp/ftp.rb (Net::FTP#close): ignore exceptions from shutdown and
- read on closing.
-
-Wed Apr 4 01:48:35 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/ftp/ftp.rb (Net::FTP#close): close socket more gracefully.
-
- * lib/ftp/ftp.rb (Net::BufferedSocket#shutdown): added.
-
- * test/net/ftp/test_ftp.rb (FTPTest#create_ftp_server): wait socket
- with shutdown and read.
-
-Tue Apr 3 19:00:52 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/net/ftp/test_ftp.rb (FTPTest#create_ftp_server): should wait
- a little before closing socket because if the client call
- Net::FTP#getmultiline the socket is suddenly closed by the server in
- the getline loop.
-
-Tue Apr 3 18:33:38 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * process.c (setreuid, setregid): suppress warnings.
- [ruby-core:43374][Bug #6169]
-
-Tue Apr 3 10:18:27 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enumerator.c (inspect_enumerator): suppress uninitialized
- instance variable warnings. [ruby-dev:45449][Bug #6214]
- patched by no6v (Nobuhiro IMAI).
-
-Mon Apr 2 13:25:08 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/optparse/ac.rb: autoconf-like options.
-
-Mon Apr 2 10:34:00 2012 eregon <eregontp@gmail.com>
-
- * string.c (rb_str_start_with, rb_str_end_with): raise an error if
- an argument is not convertible to a String.
- [ruby-core:40623][Bug #5536]
-
-Mon Apr 2 03:35:25 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/webrick/server.rb (WEBrick::GenericServer): close socket only if
- the socket is not closed yet.
-
-Sun Apr 1 23:03:18 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/net/ftp.rb (Net::BufferedSocket): should delegate send() to @io
- for Net::FTP#abort and Net::FTP#status.
-
-Sun Apr 1 00:41:56 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * lib/net/ftp.rb: fixed the domain name in examples.
-
-Sat Mar 31 21:39:45 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler): dup to prevent
- @timeout_info's "can't add a new key into hash during iteration".
-
-Sat Mar 31 14:22:59 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * hash.c (hash_default_value): extract from rb_hash_aref(), to be
- shared with rb_hash_shift(), so that overriding Hash#default
- will be respected.
-
-Sat Mar 31 14:16:02 2012 Sokolov Yura (funny-falcon) <funny.falcon@gmail.com>
-
- * hash.c: do not allocate st_table when it is not necessary.
-
-Sat Mar 31 13:42:39 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * lib/net/ftp.rb (read_timeout=, open_timeout=): supported timeout.
-
-Sat Mar 31 13:20:40 2012 Sokolov Yura (funny-falcon) <funny.falcon@gmail.com>
-
- * hash.c: remove unnecessary checks for Qundef in hash iterations.
- since hash use st_foreach_check for iterations, such checks are
- needless.
-
-Sat Mar 31 12:05:01 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * ext/openssl/ossl_x509cert.c: Fix doc typo.
-
-Sat Mar 31 10:13:24 2012 Sokolov Yura (funny-falcon) <funny.falcon@gmail.com>
-
- * st.c (st_foreach_check, st_foreach): remove ancient check. This
- check are from initial ordered hash commit when first entry were
- created with entry->fore = entry->back = entry.
-
- * st.c (st_delete): use real_entries in st_delete for packed tables
-
-Sat Mar 31 07:53:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * st.c (st_foreach_check): remove the entry by replacing with never
- when ST_DELETE.
-
- * hash.c (st_foreach_safe): since table is not for VALUE, Qundef is
- not special value, so use 0 instead. therefore this function can be
- applied to only st_table which 0 is invalid as keys, e.g., IDs.
-
- * hash.c: Qundef cannot be passed from st_foreach_check().
-
- * hash.c, marshal.c, object.c, variable.c: fix callback argument types
- of iterators.
-
-Thu Mar 29 23:50:15 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * st.c (st_update): pass pointer to key to the callback function.
+ * common.mk: ditto.
-Thu Mar 29 16:36:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Feb 5 13:29:01 2014 Koichi Sasada <ko1@atdot.net>
- * st.c (st_update): add existing parameter to the callback function.
+ * string.c (rb_str_free): use FL_TEST(str, STR_SHARED) directly
+ because str is not embed.
-Thu Mar 29 16:35:32 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * string.c (str_replace): remove `FL_SET(str, STR_SHARED)' line
+ because STR_SET_SHARED() set STR_SHARED.
- * lib/test/unit.rb (terminal_width, del_status_line, put_status):
- extract as methods.
+Wed Feb 5 13:18:08 2014 Koichi Sasada <ko1@atdot.net>
-Thu Mar 29 10:20:18 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * internal.h: remove macros STR_NOCAPA and STR_NOCAPA_P().
- * ext/openssl/ossl_pkcs7.c: fix crash when parsing garbage data.
- * test/openssl/test_pkcs7.rb: assert correct behavior for it.
- Thanks to Matt Venables for reporting the issue.
- [ruby-core:43250][Bug #6134]
+ * string.c (rb_str_resize): remove `STR_SET_NOEMBED(str)' because
+ str_make_independent_expand() set NOEMBED flag.
-Thu Mar 29 10:16:05 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * string.c (rb_str_resize): remove `STR_NOCAPA_P(str)' check because
+ `str' is independent (not shared).
- * thread_win32.c (TIME_QUANTUM_USEC): 10ms(= old setting) [experimental]
- cf. [Bug #6098]
+Wed Feb 5 12:54:25 2014 Koichi Sasada <ko1@atdot.net>
-Thu Mar 29 10:12:12 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+ * string.c: refactoring, especially about string flags.
- * thread.c (rb_threadptr_execute_interrupts_common): use defined
- TIME_QUANTUM_USEC instead of a magic number. there is no meanings
- to use different values for checking interval of interruption and
- thread switching limits.
- cf. [Bug #6098]
+ * string.c (STR_UNSET_NOCAPA): removed.
+ Use FL_UNSET() with STR_SHARED.
-Thu Mar 29 09:26:17 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * string.c (rb_str_capacity): check STR_SHARED directly
+ because it is not a embed string.
- * test/openssl/test_x509cert.rb: exclude test that fails when issuing
- a certificate with RSA signature and DSS1 digest for earlier
- OpenSSL versions when used in conjunction with OpenSSL 1.0.1.
- Thanks, Vit Ondruch, for reporting the issue.
- [ruby-core:42949][Bug #6089]
+ * string.c (rb_str_modify_expand): ditto.
-Thu Mar 29 08:25:35 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * string.c (rb_str_shared_replace): use STR_SET_SHARED().
- * NEWS: add note about unified behavior of encoding nil values in
- instances of OpenSSL::ASN1::ASN1Data.
+ * string.c (str_make_independent_expand): remove STR_UNSET_NOCAPA()
+ because `str' is not shared string.
-Thu Mar 29 07:45:36 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+Wed Feb 5 12:11:04 2014 Koichi Sasada <ko1@atdot.net>
- * ext/openssl/ossl_asn1.c: raise TypeError when trying to encode nil
- values for Primitive instances.
- * test/openssl/test_asn1.rb: Assert consistent behavior when
- encoding nil values: Primitives raise TypeError, Constructives
- raise NoMethodError.
- Fixes [ruby-core:43009][Bug #6102]
+ * string.c (RESIZE_CAPA): should not resize shared string.
-Wed Mar 28 16:39:59 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Feb 5 11:46:42 2014 Koichi Sasada <ko1@atdot.net>
- * process.c (obj2uid, obj2gid): allow strings as input user/group id.
- [ruby-core:40923][Feature #5610]
+ * gc.c (gc_mark_children): STR_ASSOC is no longer available.
+ Reported by @nagachika.
+ http://d.hatena.ne.jp/nagachika/20140204
-Wed Mar 28 15:06:18 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Feb 5 11:27:22 2014 Koichi Sasada <ko1@atdot.net>
- * marshal.c (r_symreal): default to ASCII-8BIT for non-ascii symbols,
- otherwise it should be converted to US-ASCII in rb_intern_str() if
- possible. [ruby-core:43762][Bug #6209]
+ * 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 Mar 28 08:44:24 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+Wed Feb 5 04:23:41 2014 Aaron Patterson <aaron@tenderlovemaking.com>
- * ext/psych/lib/psych.rb: updating version to match gem
+ * ext/psych/lib/psych.rb: New release of psych.
* ext/psych/psych.gemspec: ditto
- * ext/psych/lib/psych/visitors/to_ruby.rb: fixing deprecation warning
-
-Tue Mar 27 23:44:11 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * io.c (io_unread): fixed memory leak. report by nagachika via IRC.
-
-Tue Mar 27 22:44:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (verconf.h): separate load path specific stuff from
- config.h.
-
-Tue Mar 27 22:43:40 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/Makefile.sub: fix config.h path to include.
-
-Tue Mar 27 17:08:08 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * win32/win32.c (check_if_dir): fix memory leak.
-
-Tue Mar 27 13:13:51 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (str_new_empty): should copy also the encoding as an
- empty substring. [ruby-dev:45441][Bug #6206]
-
-Mon Mar 26 23:43:04 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * lib/net/ftp.rb (parse227, parse228, parse229): don't use $~.
-
-Mon Mar 26 23:34:40 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * lib/net/ftp.rb (parse227, parse228, parse229): don't use local
- variables defined by named capture for other Ruby implementations
- such as Rubinius.
-
-Mon Mar 26 23:19:03 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * lib/net/ftp.rb (parse_pasv_port): refactored.
-
-Mon Mar 26 19:49:49 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * test/net/ftp/test_ftp.rb: add the test, which was forgotten in the
- previous commit.
-
-Mon Mar 26 19:37:27 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * lib/net/ftp.rb (parse227, parse228, parse229): refactored.
-
-Mon Mar 26 11:46:23 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * enumerator.c (inspect_enumerator): show method arguments of
- lazy enumerators correctly.
-
-Mon Mar 26 13:51:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (check_if_dir, check_if_wdir): fix for Visual C++
- not to use S_ISDIR(). [Feature #2408][ruby-core:26925]
-
- * ruby.c (load_file_internal): ditto.
-
-Mon Mar 26 11:46:01 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ruby.c (load_file_internal): bail out if the script is a directory.
- [Feature #2408][ruby-core:26925]
-
- * win32/win32.c (rb_w32_open, rb_w32_wopen): check if the file is a
- directory when access denied, to set errno to EISDIR.
-
-Sun Mar 25 18:13:14 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * string.c (tr_setup_table): fix multiple non latin argument for
- non latin (over 256 characters) tr-like methods.
- [ruby-core:43371] [Bug #6167]
-
-Sun Mar 25 00:46:06 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * enumerator (lazy_initialize): set the instance variable "receiver"
- to include the receiver to the return value of inspect on a lazy
- enumerator directly created by Enumerator::Lazy.new.
-
- * enumerator (RETURN_LAZY): don't set the instance variable "receiver".
-
-Sat Mar 24 23:59:00 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * enumerator (enumerator_inspect): include the original receiver and
- method name of Enumerator::Lazy in the result of inspect.
- [ruby-core:43345] [Bug #6159]
-
- * enumerator (InitVM_Enumerator): don't use rb_define_alias for
- some methods such as collect in order to make rb_frame_this_func()
- return the correct method names.
-
-Sat Mar 24 22:22:18 2012 Sambasiva Rao Suda <sambasivarao@gmail.org>
-
- * time.c (time_init_1): Time.new will accept seconds as string or
- int. [ruby-core:43569][Bug #6193]
-
-Fri Mar 23 15:12:12 2012 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * transcode.c (documentation for str_encode): Explain
- that transcoding to the same encoding is a no-op
- (i.e. no exceptions, no replacements,...).
- [ruby-core:43557][Bug #6190]
-
-Fri Mar 23 13:19:20 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * bignum.c (rb_str_to_inum): must be ASCII compatible encoding as
- well as String#hex and String#oct. [ruby-core:43566][Bug #6192]
-
- * string.c (rb_must_asciicompat): check if ASCII compatible.
-
-Thu Mar 22 23:14:36 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * transcode.c (str_encode_bang, encoded_dup): if nothing was
- transcoded, just set encoding but leave coderange unchanged as
- force_encoding. [ruby-core:43557][Bug #6190]
-
-Thu Mar 22 22:30:44 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * io.c (static int io_fflush): add the definition.
- Use it in set_binary_mode_with_seek_cur().
-
- * io.c (set_binary_mode_with_seek_cur): refactoring to split the
- content into io_unread(). Fix the possibility of buffer overflow.
-
- * io.c (io_unread): add new implementation for Windows. Previous one
- caused invalid cursor position using IO#pos with OS text mode. New
- one fixes the bug.
-
- * test/ruby/test_io_m17n.rb
- (TestIO_M17N#test_pos_dont_move_cursor_position): add a test for
- above bug.
- [ruby-core:43497] [Bug #6179]
-
-Thu Mar 22 19:55:08 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (rb_w32_fstat, rb_w32_fstati64): convert FILETIME
- to time_t directly, not to be affected by TZ unnecessarily.
-
- * win32/win32.c (unixtime_to_filetime): convert time_t to FILETIME
- simply.
-
-Thu Mar 22 13:43:31 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/openssl/ossl_pkey_rsa.c (rsa_generate): fix argument type.
- [Bug #6094]
-
-Thu Mar 22 11:14:10 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_io.rb (TestIO#test_pos_with_getc): updated.
- see [ruby-core:43550]
-
-Wed Mar 21 17:57:57 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * regcomp.c: Merge Onigmo 3d855b30d574536d3ae600260208c6624ae4791c.
- [Bug#6143] [Bug#6144] [Bug#6145]
-
-Wed Mar 21 17:01:55 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_io.rb (TestIO#test_pos_with_getc): added.
- see [Bug #6179][ruby-core:43518]
-
-Mon Mar 19 17:18:51 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * enumerator.c (lazy_flat_map_func): convert the block value to
- Array if it doesn't respond to each. [ruby-core:43334]
- [Bug #6155]
-
-Mon Mar 19 16:34:14 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * enum.c (zip_i): variadic argument needs explicit cast on the
- platforms where VALUE is longer than int.
-
-Mon Mar 19 15:36:41 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * enumerator.c (enumerable_lazy): add an example of take and first
- to the documentation. [ruby-core:43344] [Bug #6158]
- add the description of the behavior when a block is given to zip
- or cycle.
-
-Mon Mar 19 15:20:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * compile.c (iseq_specialized_instruction): DRY and replace chain
- of if-else with switch for special instructions. based on a
- patch by Vasfed. https://github.com/ruby/ruby/pull/105
-
-Mon Mar 19 15:05:54 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
-
- * test/test_pty.rb: same as r29280, skip tests when PTY allocation
- failed (that's not our fault).
-
-Sun Mar 18 23:21:17 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (aligned_free): fix condition for free. memalign() and
- posix_memalign() are not defined together normally.
-
-Sun Mar 18 18:31:45 2012 Yuki Sonoda (Yugui) <yugui@yugui.jp>
-
- * gc.c (aligned_malloc, aligned_free): added fallback implementations
- for platforms like OSX Leopard.
-
-Sun Mar 18 17:17:48 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * bignum.c (rb_big_pow): estimate result bit size more precisely.
- [ruby-core:30735][Feature #3429]
-
-Sun Mar 18 17:17:36 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (free_method_entry_i): method entry may be in
- unlinked_method_entry_list. [ruby-core:43383][Bug #6171]
-
-Sun Mar 18 15:27:31 2012 Tanaka Akira <akr@fsij.org>
-
- * compile.c: typo fix by Run Paint Run Run.
- [ruby-core:28368] [Bug #2824]
-
-Sun Mar 18 10:01:02 2012 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * lib/profiler.rb: support calling singleton methods of
- an instance of BasicObject.
-
-Sat Mar 17 06:56:58 2012 Eric Hodel <drbrain@segment7.net>
-
- * object.c: Fix indentation of Class#inherited example.
-
-Sat Mar 17 01:46:05 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * string.c (trnext): fix bug with string ending with '\\'.
- [ruby-dev:45374][Bug #6160]
-
- * test/ruby/test_string.rb (TestString#test_delete): test for
- above.
-
-Fri Mar 16 20:06:24 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (trnext): should advance char-wise.
- [ruby-core:43335][Bug #6156]
-
-Fri Mar 16 17:42:05 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (block_append_gen): fix unreachable warning line number.
- should warn at the code, not jump.
-
-Fri Mar 16 17:33:08 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enum.c (enum_take): allocate buffer array before iteration, as well
- as enum_first did.
-
- * enum.c (enum_first): remove duplication.
-
-Fri Mar 16 14:43:18 2012 Yuki Sonoda (Yugui) <yugui@yugui.jp>
-
- * load.c (ruby_init_ext): don't free the given pointer itself.
- It is not guaranteed even that the pointer is on heap.
-
-Fri Mar 16 14:37:57 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * vm_eval.c (rb_mod_module_eval): fix the documentation of
- class_eval to mention class variable lookup. [ruby-core:40649]
- [Bug #5544]
-
-Fri Mar 16 14:27:11 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * vm_eval.c (rb_mod_module_eval): fix the documentation of
- class_eval to mention constant lookup. [ruby-core:41718]
- [Bug #5777]
-
-Fri Mar 16 14:10:45 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * lib/net/imap.rb (initialize): raise Net::IMAP::Error when the
- connection is closed without a greeting response.
- [ruby-core:40938] [Bug #5616]
-
-Fri Mar 16 13:50:12 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * lib/net/imap.rb (rfc822_text): ignore [] after RFC822.
- [ruby-core:40945] [Bug #5620]
-
-Fri Mar 16 12:00:42 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_insnhelper.c (argument_error): use line number at the beginning
- of lambda, not the first code of its body.
- [ruby-core:43314][Bug #6151]
-
- * iseq.c (rb_iseq_first_lineno): constified.
-
-Fri Mar 16 11:20:07 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * enumerator.c (lazy_take): don't enumerate an extra value.
- [ruby-dev:45370] [Bug #6152]
-
-Fri Mar 16 06:30:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enumerator.c (lazy_zip_func): variadic argument needs explicit cast
- on the platforms where VALUE is longer than int.
-
- * enumerator.c (lazy_init_iterator): no need to check overflow twice.
-
-Fri Mar 16 05:47:09 2012 Eric Hodel <drbrain@segment7.net>
-
- * enumerator.c (lazy_init_iterator): Fix type error (int vs long).
-
-Thu Mar 15 23:13:36 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * enum.c (rb_enum_values_pack): rename from enum_values_pack, and
- remove static.
-
- * enumerator.c (lazy_init_iterator, lazy_init_yielder,
- lazy_select_func, lazy_reject_func, lazy_grep_func): handle
- multiple values correctly.
-
- * enumerator.c (lazy_grep): change the behavior when a block is
- given, to be consistent with Enumerable#grep.
-
-Thu Mar 15 19:12:31 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * enumerator.c (lazy_zip): rescue StopIteration returned by
- Enumerator#next.
-
-Thu Mar 15 18:19:53 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * enumerator.c (lazy_zip, lazy_cycle): Enumerator::Lazy#{zip,cycle}
- should be eager when a block is given, to be consistent with
- Enumerable#{zip,cycle}.
-
-Thu Mar 15 17:45:27 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * enumerator.c (InitVM_Enumerator): renamed Enumerable::Lazy to
- Enumerator::Lazy.
-
-Thu Mar 15 16:37:38 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * enumerator.c (enumerable_lazy): added cycle to the documentation.
-
-Thu Mar 15 15:37:42 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parser_yylex): fix warning line number.
-
-Thu Mar 15 15:19:38 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enumerator.c (lazy_cycle): check argument number overflow before
- creating temporary array.
-
-Thu Mar 15 15:04:54 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * util.c (ruby_strtod): no need to check same digit for hexdigit
- twice. [ruby-dev:45363][Bug #6146]
-
- * parse.y (sym_check_asciionly): check ascii compatibility before
- scanning for code range.
-
- * parse.y (intern_str): set to us-ascii if ascii only.
- [ruby-dev:45363][Bug #6146]
-
- * file.c (ruby_enc_find_basename): allow NULL as alllen.
- [ruby-dev:45363][Bug #6146]
-
-Thu Mar 15 14:49:31 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_str_conv_enc_opts): default to original encoding.
-
-Thu Mar 15 13:47:17 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * hash.c (env_str_new, rb_f_getenv, env_fetch): use rb_str_conv_enc()
- instead of rb_str_encode() to simplify the code.
-
-Thu Mar 15 12:44:50 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c, include/ruby/win32.h (rb_w32_ugetenv): new API to
- accept and to return UTF-8 strings.
-
- * win32/win32.c (rb_w32_getenv): follow above change.
-
- * win32/win32.c (rb_w32_get_environ): returns UTF-8 environment area.
-
- * hash.c (env_str_new, rb_f_getenv, env_fetch): follow above changes.
- [Bug #5570] [ruby-core:40737]
-
-Thu Mar 15 10:57:27 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * enumerator.c (lazy_cycle): add Enumerable::Lazy#cycle.
-
-Thu Mar 15 10:31:40 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/ruby/test_arity.rb (TestArity#err_mess): use assert_raise.
-
-Thu Mar 15 07:03:52 2012 Eric Hodel <drbrain@segment7.net>
-
- * vm_eval.c (check_funcall): Raise ArgumentError if respond_to?
- requires more than three arguments. [Bug #6000]
-
- * test/ruby/test_object.rb (class TestObject): Test for respond_to?
- requiring more than three arguments.
-
-Thu Mar 15 06:08:06 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * include/ruby/intern.h: Add rb_check_arity, rb_error_arity [#6085]
-
- * array.c: Use rb_check_arity / rb_error_arity
-
- * class.c: ditto
-
- * enumerator.c: ditto
-
- * eval.c: ditto
-
- * file.c: ditto
-
- * hash.c: ditto
-
- * numeric.c: ditto
-
- * proc.c: ditto
-
- * process.c: ditto
-
- * random.c: ditto
-
- * re.c: ditto
-
- * signal.c: ditto
-
- * string.c: ditto
-
- * struct.c: ditto
-
- * transcode.c: ditto
-
- * vm_eval.c: ditto
-
- * vm_insnhelper.c: ditto & implementation of rb_error_arity
-
- * test/ruby/test_arity.rb: tests for above
-
-Thu Mar 15 06:08:05 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * vm_insnhelper.c: improve number of arguments error in case of
- optional parameters (issue #6085)
-
- * include/ruby/intern.h: define UNLIMITED_ARGUMENTS
-
- * test/ruby/test_arity.rb: test for above
-
-Thu Mar 15 00:58:04 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * enumerator.c (enumerable_lazy): fix the documentation of
- Enumerable#lazy.
-
-Wed Mar 14 22:01:06 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * enumerator.c (lazy_init_iterator): break when Qundef is returned
- to make obj.drop(3).take(2) work properly.
-
- * enumerator.c (lazy_take_while): add Enumerable::Lazy#take_while.
-
- * enumerator.c (lazy_drop): add Enumerable::Lazy#drop.
-
- * enumerator.c (lazy_drop_while): add Enumerable::Lazy#drop_while.
-
- * enumerator.c (InitVM_Enumerator): add Enumerable::Lazy#force as an
- alias of to_a.
-
-Wed Mar 14 19:28:40 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * enumerator.c (lazy_take): add Enumerable::Lazy#take.
-
-Wed Mar 14 18:40:36 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * enumerator.c: use long for array indices.
-
-Wed Mar 14 18:25:18 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * enumerator.c: moved the comment of StopIteration.
-
-Wed Mar 14 17:55:29 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * numeric.c (flodivmod): must go through the same pass if HAVE_FMOD or
- not. this is a bugfix of r35013.
-
-Wed Mar 14 16:41:55 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/test_tmpdir.rb (TestTmpdir#test_world_writable): skip on Windows.
-
-Wed Mar 14 15:09:23 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * numeric.c: fix flodivmod for cornercases [Bug #6044]
- add ruby_float_mod
-
- * insns.def (opt_mod): use ruby_float_mod
-
- * internal.h: declare ruby_float_mod
-
- * test/ruby/test_float.rb: tests for above
-
- * test/ruby/envutil.rb: create helper assert_is_minus_zero
-
-Wed Mar 14 10:44:35 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enumerator.c (lazy_grep_func): should use === instead of =~, as
- well as Enumerable#grep
-
-Wed Mar 14 08:15:54 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * enumerator.c (lazy_flat_map_func): use each for non-Array objects.
-
-Wed Mar 14 08:06:35 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * enumerator.c (lazy_zip): add Enumerable::Lazy#zip.
-
- * enumerator.c (lazy_lazy): just returns self.
-
-Wed Mar 14 07:48:36 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_core.c (datetime_s_now): [ruby-core:43256].
-
-Tue Mar 13 22:00:14 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * compile.c (iseq_set_arguments): keyword rest arg without keyword args.
-
- * node.c (dump_node): dump kw_rest_arg too.
-
- * parse.y (block_param, f_arg): more kwrest patterns.
- [ruby-core:42455][Bug #5989]
-
- * parse.y (new_args_gen): no extra kw_rest_arg if no keyword rest arg.
-
-Tue Mar 13 15:17:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (block_param, f_args): add rules for the case arguments
- begin with kwrest. [ruby-core:42455][Bug #5989]
-
-Tue Mar 13 12:37:53 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * io.c (io_encoding_set): always warn if external encoding and internal
- encoding are identical. [ruby-core:40727] [Bug #5568]
-
-Tue Mar 13 12:37:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c: add ObjectSpace::WeakMap. [ruby-dev:44565][Bug #5350]
-
- * lib/weakref.rb: use WeakMap instead of _id2ref.
-
-Tue Mar 13 10:59:48 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * tool/rbinstall.rb (prepare): skip if basedir is not defined.
- [ruby-core:39135][Bug #5238]
-
- * tool/rbinstall.rb (CONFIG.[]): check for mandatory
- configurations.
-
-Tue Mar 13 00:09:18 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * enumerator.c (enumerable_lazy): added documentation.
-
-Mon Mar 12 20:19:25 2012 Tanaka Akira <akr@fsij.org>
-
- * lib/tmpdir.rb (Dir::tmpdir): test the current directory suitable for
- temporary directory.
-
-Mon Mar 12 20:08:16 2012 Tanaka Akira <akr@fsij.org>
-
- * lib/fileutils.rb (fu_have_symlink?): specify TypeError for rescue
- clause.
-
-Mon Mar 12 19:23:13 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * encoding.c (rb_find_encoding): new function find encoding from
- arbitrary object as a pointer to rb_encoding, and return NULL if
- not found.
-
- * io.c (io_encoding_set): just warn unsupported encodings, but not
- exception. [ruby-core:40726] [Bug #5567]
-
-Mon Mar 12 19:03:32 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_method.c (Init_eval_method): respond_to? and
- respond_to_missing? are public.
-
-Mon Mar 12 14:56:52 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * node.h (NEW_YIELD), parse.y (new_yield_gen): array-values flags
- has been already obsolete. patch by Thomas Enebo.
- [ruby-core:41929][Bug #5847]
-
-Mon Mar 12 12:44:33 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_method.c (Init_eval_method): copy basic methods to Exception.
- [ruby-core:40287][Bug #5473]
-
-Mon Mar 12 10:13:36 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval_jump.c (rb_exec_end_proc): remember the latest exit status.
- [ruby-core:43173][Bug #5218]
-
-Mon Mar 12 07:33:12 2012 Tanaka Akira <akr@fsij.org>
-
- * lib/tmpdir.rb: update document for changing
- FileUtils.remove_entry_secure to FileUtils.remove_entry.
-
- * NEWS: add incompatibility note for lib/tmpdir.rb.
-
-Mon Mar 12 07:19:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/tmpdir.rb (Dir.tmpdir): should not use world-writable but
- non-sticky directory.
-
- * lib/tmpdir.rb (Dir.mktmpdir): check the parent directory.
-
-Mon Mar 12 07:04:11 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * random.c (Init_Random): removed rb_Random_DEFAULT and register as
- mark-object instead of global variable.
-
-Mon Mar 12 07:03:32 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * random.c (random_s_rand): ensure default PRNG is re-initialized
- after fork. patched by Eric Wong. [ruby-core:41209][Bug #5661]
-
-Sun Mar 11 23:57:29 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * pack.c (pack_unpack): when unpack('M') occurs an illegal byte
- sequence, output the "=" character and the following character in
- the decoded data without any transformation.
- [ruby-dev:44875] [Bug #5635]
-
-Sun Mar 11 22:32:43 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/json: Merge 164a75c8bd2007d32c4d7665d53140d8fc126dcd.
- [ruby-core:41917] [Bug #5846]
-
-Sun Mar 11 17:10:04 2012 Shota Fukumori <sorah@tubusu.net>
-
- * lib/test/unit.rb: Put error message into STDERR if failed to launch
- worker (job) process. [ruby-dev:44802] [Bug #5577]
-
- * lib/test/unit/parallel.rb: If failed to increment_io, exit with code
- 2. [ruby-dev:44802] [Bug #5577]
-
-Sun Mar 11 15:46:45 2012 Shota Fukumori <sorah@tubusu.net>
-
- * io.c: fix rdoc of `IO.binwrite` to show same as `IO.write` except
- it opens file with mode "wb:ASCII-8BIT". [Bug #5782] [ruby-core:42592]
-
-Sat Mar 10 23:52:28 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * st.c: pack tables also generic keys. patched by Sokolov Yura at
- https://github.com/ruby/ruby/pull/84
-
- * st.c: add st_foreach_check for fixing iteration over packed table
- and st_delete_safe. patched by Sokolov Yura at
- https://github.com/ruby/ruby/pull/84
-
- * st.c: fix packed num_entries on delete_safe. patched by Sokolov
- Yura at https://github.com/ruby/ruby/pull/84
-
-Fri Mar 9 14:29:32 2012 Shugo Maeda <shugo@ruby-lang.org>
-
- * enumerator.c (lazy_flat_map): add Enumerable::Lazy#flat_map.
-
-Fri Mar 9 06:29:22 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych.rb (load, parse): stop parsing or loading after
- the first document has been parsed.
-
- * test/psych/test_stream.rb: pertinent tests.
-
-Fri Mar 9 06:17:05 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych.rb (parse_stream, load_stream): if a block is
- given, documents will be yielded to the block as they are parsed.
- [ruby-core:42404] [Bug #5978]
-
- * ext/psych/lib/psych/handlers/document_stream.rb: add a handler that
- yields documents as they are parsed
-
- * test/psych/test_stream.rb: corresponding tests.
-
-Fri Mar 9 00:35:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enumerator.c (lazy_initialize, enumerable_lazy): no additional
- arguments.
-
-Fri Mar 9 00:30:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enumerator.c: add Enumerable#lazy. based on the patch by
- Innokenty Mikhailov at <https://github.com/ruby/ruby/pull/101>
- [ruby-core:37164] [Feature #4890]
-
-Fri Mar 9 00:25:59 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enumerator.c (enumerator_each, generator_each): pass arguments to
- the block with yielder.
-
-Fri Mar 9 00:25:02 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * array.c (rb_ary_cat): new function to concat objects into array.
-
-Thu Mar 8 16:44:02 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * .gdbinit (rb_numtable_entry): update for recent refactoring of
- st_table.
-
-Wed Mar 7 22:41:50 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * lib/xmlrpc/client.rb (module XMLRPC): fix typo.
-
- * test/xmlrpc/test_client.rb (test_async_call): add test for
- XMLRPC::Client#call_async to check above fix.
-
-Wed Mar 7 16:30:24 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * error.c (rb_load_fail): should honor encoding.
-
- * load.c (load_failed): ditto.
-
-Wed Mar 7 12:26:25 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * error.c (rb_load_fail): use path as a string, not char*.
-
- * internal.h: (rb_load_fail): moved from ruby/intern.h.
-
- * ruby.c (load_file_internal): fname cannot be NULL.
-
-Wed Mar 7 08:32:43 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * error.c (rb_loaderror_with_path): Adding the missing file as an
- instance variable to the LoadError exception.
- [ruby-core:39079]
-
- * load.c: call rb_loaderror_with_path so that the missing path is
- added to the exception.
-
- * ruby.c: call rb_loaderror rather than raising our own LoadError
- exception.
-
- * include/ruby/intern.h: add declaration for rb_loaderror_with_path.
-
- * test/ruby/test_require.rb: add supporting test for LoadError#path
- method.
-
-Wed Mar 7 08:28:00 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * lib/xmlrpc/parser.rb: support i8 types. Thanks Stas Kelvich!
- [ruby-core:29246] [Feature #3090]
-
- * test/xmlrpc/test_client.rb: supporting test
-
-Wed Mar 7 07:43:29 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * lib/xmlrpc/client.rb: assume servers that do not send a Content-Type
- header are sending 'text/xml'. Thanks Nathan Leavitt!
- [ruby-core:41204] [Bug #5660]
-
- * test/xmlrpc/test_client.rb: supporting test
-
-Wed Mar 7 07:39:28 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * test/xmlrpc/test_client.rb: adding a test for performing an XMLRPC
- call.
- * test/xmlrpc/data/blog.xml: supporting XML document for the response.
-
-Tue Mar 6 16:24:01 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parser_tokadd_string): escape simple regexp meta
- character terminators.
-
-Tue Mar 6 10:11:43 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/io/console/console.c (set_rawmode): clear ECHOE and ECHOK
- bits too.
-
- * ext/io/console/console.c (echo_p): ignore ECHOE and ECHOK bits.
- [ruby-dev:45309] [Bug #6116]
-
- * ext/io/console/console.c (console_raw): fix rdoc.
-
- * ext/io/console/console.c (console_set_echo): mentioned about
- platform dependency.
-
-Tue Mar 6 07:18:10 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * lib/xmlrpc/client.rb: switch net/http post2 calls to modern
- `request_post` methods.
-
-Tue Mar 6 02:31:20 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/core_ext.rb: only extend Kernel if IRB is loaded
- in order to stop method pollution.
-
-Tue Mar 6 01:34:19 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (block_call): rules for block_call after block_call.
- based on a patch by pasberth https://github.com/ruby/ruby/pull/102
- [ruby-dev:45308][Bug #6115]
-
-Tue Mar 6 01:24:13 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (block_command, block_call): simplified rules.
-
-Mon Mar 5 18:28:35 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * test/ruby/test_regexp.rb (TestRegexp#test_source): fix typo.
- * test/ruby/test_regexp.rb (TestRegexp#test_equal): ditto.
-
-Mon Mar 5 17:11:44 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/syck/lib/syck/rubytypes.rb (Exception.yaml_new): fix bug
- that causes YAML serialization problem for Exception.
- Exception#initialize doesn't use visible instance variable for
- the exception message, so call the method with the message.
- patched by Jingwen Owen Ou <jingweno AT gmail.com>.
- http://github.com/ruby/ruby/pull/41
-
-Mon Mar 5 16:50:22 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_sleep.rb (TestSleep#test_sleep_5sec): syntax error.
-
- * test/ruby/test_sleep.rb (TestSleep#test_sleep_5sec): call uname
- only on linux because it's a workaround for linux only.
-
-Mon Mar 5 12:44:12 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * st.c (unpack_entries): chain entries directly. based on a patch
- by Sokolov Yura <funny.falcon AT gmail.com>.
- * st.c (unpack_entries): use union instead of casted pointer.
- patched by Sokolov Yura <funny.falcon AT gmail.com>.
+Wed Feb 5 04:16:41 2014 Aaron Patterson <aaron@tenderlovemaking.com>
- * st.c: use PACKED_ENT and FIND_ENTRY. patched by Sokolov
- Yura <funny.falcon AT gmail.com>.
-
- * st.c (unpack_entries): reallocate bins if packed array size
- is not same as initial bins size. based on a patch by
- Sokolov Yura <funny.falcon AT gmail.com>.
-
-Mon Mar 5 11:51:48 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/bigdecimal/lib/bigdecimal/math.rb: remove description about
- BigMath#log. patched by Sho Hashimoto [ruby-dev:45307] [Bug #6112]
-
- * string.c (str_byteslice): fix typo.
-
-Sun Mar 4 23:21:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parser_tokadd_string): regexp engine doesn't need
- terminators to be escaped. [ruby-core:40364][Bug #5484]
-
-Sat Mar 3 22:51:46 2012 Tanaka Akira <akr@fsij.org>
-
- * process.c (rb_run_exec_options_err): chdir at last to interpret
- relative pathnames from the current directory of the parent process.
-
-Sat Mar 3 12:20:44 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_strftime.c: reassigned some variables.
-
-Sat Mar 3 12:12:16 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_{parse,strptime}.c: [ruby-dev:45303].
-
-Sat Mar 3 10:09:21 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * lib/xmlrpc/client.rb (initialize): net/http defaults to 1_2 in 1.8+,
- so we can safely remove the call to enable it.
-
-Sat Mar 3 08:42:25 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * lib/xmlrpc/client.rb (new2): use URI for uri parsing.
- * test/xmlrpc/test_client.rb: test that query params are passed to the
- client constructor.
-
-Sat Mar 3 08:20:10 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * lib/xmlrpc/client.rb (new2): raises an ArgumentError on bad
- arguments.
- * test/xmlrpc/test_client.rb: tests for bad uris
-
-Sat Mar 3 08:08:11 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * lib/xmlrpc/client.rb (new2): fix custom port specification when an
- SSL uri is used.
- * test/xmlrpc/test_client.rb: tests for XMLRPC::Client.new2
-
-Sat Mar 3 08:03:29 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/syck/rubyext.c (mktime_do): use ISDIGIT().
- [ruby-core:43060] [Bug #6108]
-
- * ext/syck/token.c (sycklex_yaml_utf8): cast as unsigned char.
- [ruby-core:43060] [Bug #6108]
-
-Sat Mar 3 06:57:14 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (ruby_pc): make configurable. [Bug #6051]
-
-Fri Mar 2 17:49:03 2012 Hiroshi Nakamura <nahi@ruby-lang.org>
-
- * .travis.yml (branches): Enable TravisCI for ruby_1_9_3.
-
-Fri Mar 2 17:13:33 2012 Hiroshi Nakamura <nahi@ruby-lang.org>
-
- * test/ruby/test_array.rb (test_combination2): Make the test case for
- [ruby-core:29240] more descriptive.
- cf. http://bugs.jruby.org/6518
-
-Fri Mar 2 16:37:11 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (file_expand_path): use wcscasecmp().
-
-Fri Mar 2 16:36:31 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * thread_pthread.c (native_cond_timeout): cast explicitly to suppress
- a warning.
-
-Fri Mar 2 16:35:56 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (pipe_open): cmd is no longer used if fork is available.
-
-Thu Mar 1 16:13:18 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * internal.h (rb_file_const, rb_file_load_ok): moved functions for
- internal use only.
-
-Thu Mar 1 15:40:05 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/makedirs.bat: new command to make intermediate
- directories, and not to report any errors if the directory
- already exists.
-
- * win32/Makefile.sub (MAKEDIRS): enable command extensions.
-
-Thu Mar 1 01:25:43 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * regparse.c (is_onechar_cclass): optimize character class
- Merge Onigmo 27278c12e6674043cc8affca6507e20e119a86ee.
-
- * regparse.c (is_onechar_cclass): [bug] unexpected match occurs when a
- char class contains no char
-
- * enc/unicode.c (init_case_fold_table): define the sizes of case
- folding tables in casefold.h
-
-Wed Feb 29 16:11:34 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/Makefile.sub (MAKEDIRS): use mkdir of cmd.exe instead of ruby.
- [Bug #6103] [ruby-core:43012]
-
- * win32/README.win32: added a notice about command extension of cmd.exe.
-
-Wed Feb 29 15:39:39 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_io.rb (TestIO#test_readpartial_locktmp): skip on
- windows because of the platform restriction.
-
-Wed Feb 29 15:38:50 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/memory_status.rb (Memory): syntax error.
-
-Wed Feb 29 13:06:42 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/ruby/memory_status.rb: use /proc/self/status if it is in
- the expected format.
-
-Wed Feb 29 06:14:51 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_core.c: reverted r34825.
-
-Tue Feb 28 23:20:01 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * Makefile.in (PLATFORM_DIR): add a variable for `win32` directory.
- * Makefile.in (clean-platform): add new target.
- It cleans `win32` directory.
-
- * common.mk (clean): add a dependency for `win32` directory.
- * common.mk (distclean): ditto.
- * common.mk (distclean-platform): add new target.
- It cleans `win32` directory.
- * common.mk ($(PLATFORM_D)): add new target to make `win32` directory.
- * common.mk (win32/win32.$(OBJEXT)): move win32.o into `win32`
- directory.
- * common.mk (win32/file.$(OBJEXT)): add new target for win32/file.c.
-
- * configure.in: move win32.o into `win32` directory and add
- win32/file.o to MISSING.
-
- * file.c (file_load_ok, rb_file_load_ok): replace static
- file_load_ok() with public rb_file_load_ok().
- It's to link Windows implementation in win32/file.c.
- * file.c (rb_find_file_ext_safe): ditto.
- * file.c (rb_find_file_safe): ditto.
-
- * win32/file.c (rb_file_load_ok): new file. Add Windows specific
- optimized implementation of rb_file_load_ok(). We created a
- separated file to avoid too many #ifdef macro which is unreadable.
-
- * win32/Makefile.sub (PLATFORM_DIR): add a variable for `win32`
- directory.
- * win32/Makefile.sub (MISSING): move win32.obj into `win32`
- directory and add win32/file.obj to MISSING.
- * win32/Makefile.sub (MAKEDIRS): replace MINIRUBY with BASERUBY.
- It's because miniruby doesn't exist when making `win32` directory.
- * win32/Makefile.sub (clean-platform): add new target to clean `win32`
- directory.
- * win32/Makefile.sub ({$(srcdir)}.c{}.obj): make it not match
- win32/file.c to build properly.
- * win32/Makefile.sub (win32/win32.$(OBJEXT)): move win32.obj into
- `win32` directory.
-
- Patch created with Luis Lavena.
- [ruby-core:42480] [Feature #5999]
-
-Tue Feb 28 20:27:25 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_core.c: [ruby-core:42998]
-
-Tue Feb 28 18:47:44 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (io_binwrite, rb_io_syswrite): use shared frozen source
- strings.
-
- * io.c (io_fread, io_getpartial, rb_io_sysread): set buffer size
- after check if readable, which can cause thread switch.
- [ruby-dev:45297][Bug #6099]
-
-Tue Feb 28 17:16:01 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/time.rb (Time#xmlschema): use strftime specifiers instead of
- fractional exponential calculation which yields undesirable
- result. [ruby-core:42997][Bug #6100]
-
-Tue Feb 28 14:15:29 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/net/protocol.rb: Add OpenTimeout subclass of Timeout::Error
- * lib/net/pop.rb: Modernize Timeout usage. Patch by Eric Wong.
- Use Net::OpenTimeout instead of Timeout::Error. [Bug #5765]
- * lib/net/http.rb: ditto
- * lib/net/smtp.rb: ditto
- * lib/net/telnet.rb: ditto
-
-Tue Feb 28 13:51:12 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/net/http.rb: Retry HTTP requests for additional network errors.
- Introduce OpenTimeout subclass of Timeout::Error. [Bug #6001]
- * test/net/http/test_http.rb: Reduce timeout to 0.01s for faster test
- * test/net/http/test_https.rb: ditto
-
-Tue Feb 28 11:44:49 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (debugflags): check if -ggdb is accepted.
- [ruby-core:42875][Bug #6080]
-
-Tue Feb 28 10:28:51 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych.rb: default open YAML files with utf8 external
- encoding. [ruby-core:42967]
- * test/psych/test_tainted.rb: ditto
-
-Mon Feb 27 23:46:09 2012 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * parse.y (opt_bv_decl): allow newline at the end. [ruby-dev:45292]
-
-Mon Feb 27 20:43:05 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * io.c (rb_io_set_pos): add rdoc about textmode.
-
- * test/ruby/test_io.rb (TestIO#test_setpos): use binmode.
-
-Mon Feb 27 17:00:15 2012 Akinori MUSHA <knu@iDaemons.org>
-
- * string.c (rb_str_crypt): Update rdoc and state that this
- function is system dependent. Reviewed by nobu, thanks to
- @takai.
-
-Mon Feb 27 17:03:20 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): since methods
- can be overridden, so should not make an assumption on the type
- of results. [ruby-core:42969][Bug #6093]
-
-Mon Feb 27 10:54:20 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (try_cppflags, try_cflags, try_ldflags): replace the
- target flags if the given flag is accepted.
-
-Mon Feb 27 10:53:44 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/rubygems/test_gem_specification.rb (test_self_from_yaml_syck_default_key_bug):
- ignore the test for too old versions.
-
-Mon Feb 27 10:53:12 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/test/unit.rb (Test::Unit::Runner#puke): skips with no
- messages should be trivial.
-
-Mon Feb 27 10:50:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c, process.c, time.c, ext: use rb_sys_fail_str instead of
- rb_sys_fail.
-
-Mon Feb 27 10:48:49 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/openssl/extconf.rb: suppress useless deprecation warnings
- from OpenSSL added by Apple.
-
-Sun Feb 26 23:29:49 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * regparse.c (add_code_range_to_buf0): wrong condition of duplicated
- warnings.
-
-Sun Feb 26 11:26:44 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * compile.c (iseq_compile_each): call on special object instead of
- self. since stabby lambda is a syntax, so it should not be
- affected by the context. [ruby-core:42349][Bug #5966]
-
- * insns.def (send): no special deal for FCALL. self should be put
- on TOS instead.
-
-Sun Feb 26 05:35:43 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * error.c (report_bug): use buf and snprintf to avoid consuming stack.
- [ruby-dev:45272] [Bug #6058]
-
-Sat Feb 25 17:41:19 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/extconf.rb (headers): try ambiguous headers at last.
-
-Sat Feb 25 17:07:15 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/fileutils.rb: use chomp(?/) instead of sub to optimize and avoid
- to regexping invalid string.
-
-Sat Feb 25 16:18:24 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * complex.c (nucomp_marshal_load): raise error on invalid data.
- reported by John Firebaugh [ruby-core:42860] [Bug #6076]
-
-Sat Feb 25 14:46:54 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/dl/dl.c (Init_dl): support intrinsic types, size_t, ptrdiff_t
- and intptr_t. [ruby-core:42460][Feature #5992]
-
- * ext/fiddle/fiddle.c (Init_fiddle): ditto.
-
- * ext/dl/lib/dl/cparser.rb (DL::CParser#parse_ctype): ditto.
-
-Sat Feb 25 11:08:28 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/curses/curses.c (Init_curses): use rb_define_const once for
- Curses::VERSION.
-
- * ext/dbm/dbm.c (Init_dbm): ditto for DBM::VERSION.
-
-Sat Feb 25 10:34:22 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/curses/curses.c (Init_curses): make Curses::VERSION
- understandable without context.
-
- * ext/dbm/dbm.c (Init_dbm): ditto for DBM::VERSION.
-
-Sat Feb 25 07:53:58 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parser_tokadd_string): insert a backslash only if
- quoted by single quotes. [ruby-dev:45281] [Bug #6069]
-
-Sat Feb 25 07:53:49 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dir.c (dir_inspect), io.c (rb_io_inspect): keep encoding of path.
- [Bug #6072]
-
-Sat Feb 25 07:53:40 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dir.c (dir_initialize): keep path in original encoding.
-
- * error.c (syserr_initialize): prefer the encoding of message over
- locale. [ruby-dev:45279][Bug #6071]
-
-Sat Feb 25 06:55:29 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (utime_internal): fix a variable missed to replace.
- [ruby-core:42864] [Bug #6077]
-
-Fri Feb 24 18:21:55 2012 Hiroshi Nakamura <nahi@ruby-lang.org>
-
- * test/zlib/test_zlib.rb (TestZlibGzipReader#test_encoding): Add
- encoding testcases for GzipReader#read. read() emits
- Encoding.default_external in contrast to read(size) emits BINARY.
- See also: http://bugs.jruby.org/6208
-
-Fri Feb 24 17:56:39 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
-
- * test/ruby/test_literal.rb (TestRubyLiteral#test_special_const):
- test for https://bugs.php.net/bug.php?id=61095
-
-Fri Feb 24 16:48:29 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dir.c, file.c, io.c (rb_sys_fail_path): use rb_sys_fail_str.
-
- * error.c: new functions to deal exceptions with string instances.
-
- * dir.c, file.c, io.c: use rb_sys_fail_path.
-
-Fri Feb 24 15:49:07 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (__builtin_unreachable): check for clang.
- [ruby-core:42849]
-
- * include/ruby/ruby.h (UNREACHABLE): fallback definition.
-
-Fri Feb 24 13:54:33 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/parser.c: prevent a memory leak by protecting calls to
- handler callbacks.
- * test/psych/test_parser.rb: test to demonstrate leak.
-
-Fri Feb 24 12:07:34 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * lib/net/http.rb: Fix documentation. Patched from Florian Mhun
- via http://github.com/ruby/ruby/pull/96
-
-Fri Feb 24 11:48:07 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * string.c (rb_str_prepend): Fix documentation for String#prepend.
- Patched from Franck Verrot via http://github.com/ruby/ruby/pull/98
- and Andrew Horsman via http://github.com/ruby/ruby/pull/55
-
-Fri Feb 24 10:08:33 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/net/http.rb (Net::HTTP#transport_request): Fix infinite loop
- upon EOFError or Errno::ECONNRESET where count is reset to 0.
- * test/net/http/test_http.rb (class TestNetHTTPKeepAlive): Test for
- above.
-
-Fri Feb 24 09:05:40 2012 Eric Hodel <drbrain@segment7.net>
-
- * complex.c (Init_Complex): Document Complex::I. Patch by Sylvain
- Daubert. [Feature #5623]
-
-Fri Feb 24 08:52:09 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parser_tokadd_string, parser_yylex): insert a backslash
- if the next character is non-ascii. [ruby-dev:45278] [Bug #6069]
-
-Fri Feb 24 08:13:20 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/profiler.rb: Add Profiler documentation by Gonzalo Rodriguez.
- [Bug #5816]
-
-Fri Feb 24 08:08:38 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/parser.c: set parser encoding based on the YAML input
- rather than user configuration.
- * test/psych/test_encoding.rb: corresponding tests.
- * test/psych/test_parser.rb: ditto
- * test/psych/test_tainted.rb: ditto
-
-Fri Feb 24 08:02:52 2012 Eric Hodel <drbrain@segment7.net>
-
- * hash.c (Init_Hash): Add section on how objects are used as Hash keys
- and how to use custom classes as Hash keys.
-
-Fri Feb 24 07:36:11 2012 Eric Hodel <drbrain@segment7.net>
-
- * object.c (rb_obj_eql): Improve equality documentation by adding an
- example of equal? vs == and recommending eql? be aliased to == when
- overridden.
-
-Fri Feb 24 07:21:15 2012 Eric Hodel <drbrain@segment7.net>
-
- * object.c (rb_obj_hash): Added note that the hash value is not
- deterministic on Marc-Andre's suggestion. Expanded description of
- the purpose of the hash method. [Bug #6068]
-
-Thu Feb 23 23:01:21 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/extconf.rb: unused macro removed.
-
-Thu Feb 23 22:26:53 2012 Tanaka Akira <akr@fsij.org>
-
- * test/test_curses.rb: new file.
-
-Thu Feb 23 19:57:56 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/curses/rain.rb: trap SIGHUP, SIGINT, SIGQUIT and SIGTERM only.
-
-Thu Feb 23 19:56:48 2012 Tanaka Akira <akr@fsij.org>
-
- * signal.c (sig_trap): show signal name on error.
-
-Thu Feb 23 12:21:48 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/extconf.rb: use DBM_SUFFIX only to detect header of
- Berkeley DB.
-
-Thu Feb 23 10:00:18 2012 Eric Hodel <drbrain@segment7.net>
-
- * io.c (rb_io_f_sync): Fix double-negative typo. [ruby-trunk - #5837]
-
-Thu Feb 23 09:57:21 2012 Eric Hodel <drbrain@segment7.net>
-
- * load.c (rb_f_require): Add note to require for scope of items in the
- loaded file. [ruby-trunk - #5910]
-
-Thu Feb 23 03:58:08 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/ostruct.rb (delete_field): Bug fix so previous value is
- returned. Patch by Nick Recobra [Bug #6063]
-
-Thu Feb 23 02:33:00 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (rb_io_extract_modeenc): fail only if conflicting
- text/binary modes given explicitly. [ruby-dev:45268][Bug #6055]
-
-Wed Feb 22 23:27:08 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/iconv/test_option.rb: enabled. [ruby-core:42802][Bug #6061]
-
-Wed Feb 22 21:45:56 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/curses/curses.c: use defined() to suppress a warning.
-
-Wed Feb 22 21:44:29 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/curses/extconf.rb: refactored.
-
-Wed Feb 22 20:42:28 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/curses/extconf.rb: try to distinguish curses_version is a
- function or variable.
-
- * ext/curses/curses.c (Init_curses): refine Curses::VERSION.
-
-Wed Feb 22 19:47:03 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/curses/extconf.rb: show the chosen header and library.
-
-Wed Feb 22 19:22:31 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * reverted 34739 for test/date.
-
-Wed Feb 22 19:08:55 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/curses/extconf.rb: refactored.
-
-Wed Feb 22 18:44:41 2012 Shota Fukumori <sorah@tubusu.net>
-
- * lib/test/unit.rb (setup_options): add option "--retry" as opposite
- for "--no-retry"
-
-Wed Feb 22 18:34:02 2012 Shota Fukumori <sorah@tubusu.net>
-
- * lib/test/unit.rb (setup_options): add option "--show-skip" to
- cancel "--hide-skip" (-q)
-
-Wed Feb 22 17:36:22 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (rb_io_s_foreach): argument check before making Enumerator.
- [ruby-dev:31525]
-
-Wed Feb 22 17:07:35 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (rb_io_s_foreach): return enumerator including keyword
- arguments. [ruby-dev:45267][Bug #6054]
-
-Wed Feb 22 12:15:16 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * configure.in: allow llvm-gcc because it work fine with r34278.
-
-Wed Feb 22 10:57:08 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * regparse.c (fetch_token): don't use // comment.
-
-Wed Feb 22 10:32:11 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/mkmf/test_framework.rb: try CoreFoundation framework, than
- Cocoa which is dependent on QuickTime SDK which has separated
- since Xcode 4.3.
-
-Wed Feb 22 10:18:05 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * common.mk (test-all, test-ruby): more dependencies.
-
-Wed Feb 22 06:48:55 2012 Eric Hodel <drbrain@segment7.net>
-
- * file.c (rb_f_test): Fix formatting of Kernel#test rdoc.
-
-Wed Feb 22 06:12:15 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/extconf.rb: check DBM_SUFFIX for Mac OS X.
- Its ndbm.h doesn't include db.h.
-
-Wed Feb 22 06:02:42 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/dbm.c (fdbm_initialize): disable Berkeley DB error messages.
-
- * ext/dbm/extconf.rb: check DBC type for above.
-
- [ruby-dev:45269]
-
-Tue Feb 21 20:23:47 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * hash.c (rb_any_hash): treat Qundef like as other special constants.
-
- * hash.c (hash_foreach_iter): fix signature.
-
-Tue Feb 21 19:39:34 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/curses/curses.c (Init_curses): use curses_version() for
- Curses::VERSION.
-
-Tue Feb 21 18:21:25 2012 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c : remove gc_clear_mark_on_sweep_slots() and use
- rest_sweep() instead of it, because some dead objects might be
- marked in next the mark phase by false pointers.
- [ruby-core:42672]
-
-Tue Feb 21 16:08:17 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * proc.c (rb_hash_proc): get wrapped pointer properly. [Bug #6048]
-
-Tue Feb 21 14:41:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * template/ruby.pc.in: added rubylibprefix, {rubylib,vendor,site}dir
- and {ruby,vendor,site}archdir. [ruby-core:42766][Feature #6052]
-
-Tue Feb 21 09:13:25 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * proc.c (method_hash, proc_hash): Fix {Unbound}Method#hash
- [Bug #6048]. Isolate hash computation for proc
-
- * internal.h: Declaration for above
-
- * vm_method.c (rb_method_definition_hash): Computation for
- hash part of a method definition
-
- * method.h: Declaration for above
-
- * test/ruby/test_method.rb: Test for above
-
-Tue Feb 21 02:56:15 2012 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * enumerator.c (enumerator_rewind): update the documentation.
- fixed: #6053
-
-Mon Feb 20 23:38:35 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * enc/depend: ignore mktable.c because it's not encoding library.
- [ruby-core:42760] [Bug #6049]
-
-Mon Feb 20 21:40:53 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/curses/extconf.rb: fold too long lines.
-
-Mon Feb 20 21:16:48 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * lib/fileutils.rb: revert a line modified accidentally at r34669.
- This fixes mingw test errors in TestDir_M17N.
- [ruby-core:42728] [Feature #4970]
-
-Mon Feb 20 21:09:27 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/curses/curses.c (Init_curses): define Curses::VERSION.
-
-Mon Feb 20 21:08:00 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/curses/extconf.rb: restore $libs and $defs for each
- header/library choice.
-
-Mon Feb 20 19:57:26 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/extconf.rb: weaken header/library consistency check if db is
- "ndbm". It seems several (possibly historical) distributions
- provide libndbm. However the content of libndbm vary: Berkeley DB,
- GDBM or even 4.3BSD NDBM. (Mandriva, Tru64 UNIX, OpenSuSE,
- SCO OpenServer, ...)
- "ndbm" is not searched automatically now (dblib doesn't contain it)
- but configure --with-dbm-type=ndbm choose libndbm and ndbm.h.
-
-Mon Feb 20 19:15:57 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/extconf.rb: refine variable names.
-
-Mon Feb 20 15:50:33 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in: check if -fstack-protector is really available.
-
-Sun Feb 19 23:43:38 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/extconf.rb: show header and library found.
-
-Sun Feb 19 23:01:01 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/dbm.c (Init_dbm): refine DBM::VERSION definition.
-
- * ext/dbm/extconf.rb: provide RUBYDBM_GDBM_HEADER macro.
-
-Sun Feb 19 17:07:27 2012 Tanaka Akira <akr@fsij.org>
-
- * test/dbm/test_dbm.rb (test_dbmfile_suffix): check pag and dir is
- empty for 4.3BSD ndbm.
-
-Sun Feb 19 03:00:30 2012 Tanaka Akira <akr@fsij.org>
-
- * test/dbm/test_dbm.rb (test_dbmfile_suffix): check magic numbers.
-
-Sun Feb 19 01:05:41 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/extconf.rb: detect GDBM's ndbm.h by testing dbm_clearerr is
- an empty macro.
-
-Sun Feb 19 00:25:55 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/extconf.rb: don't choose 'dbm' if _GDB_H_ is defined which
- is available since GDBM 1.9 because 'gdbm_compat' is appropriate
- choice since GDBM 1.8.1.
-
-Sat Feb 18 23:27:00 2012 Kenta Murata <mrkn@mrkn.jp>
-
- * random.c: remove a duplicated comment.
-
-Sat Feb 18 18:43:13 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/extconf.rb (dblib): prefer recent GDBM over older GDBM.
- (have_declared_libvar): new function to check a declared variable
- exists in a library.
- (have_undeclared_libvar): renamed from renamed from have_libvar.
- (headers.db_check2): check that GDBM version variable if GDBM header
- is chosen.
-
- * ext/dbm/dbm.c (Init_dbm): use HAVE_DECLARED_LIBVAR_GDBM_VERSION and
- HAVE_UNDECLARED_LIBVAR_GDBM_VERSION macro.
-
-Sat Feb 18 13:53:01 2012 Tanaka Akira <akr@fsij.org>
-
- * test/dbm/test_dbm.rb (test_dbmfile_suffix): DBM::VERSION should
- be Berkeley DB if foo.db is created by DBM.open.
-
-Sat Feb 18 13:40:37 2012 Tanaka Akira <akr@fsij.org>
-
- * test/dbm/test_dbm.rb (test_dbmfile_suffix): test dbm file suffix.
-
-Sat Feb 18 12:50:59 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/dbm.c (DBM::VERSION): define it by detecting _GDBM_H_ or
- _DBM_IOERR.
-
-Sat Feb 18 07:52:45 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * tool/enc-unicode.rb: don't use 1.9 feature on tools.
-
-Sat Feb 18 02:48:39 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * lib/fileutils.rb: refactored FileUtil methods to use the
- `define_command` API. Patch from 7rans <transfire@gmail.com>
- * test/fileutils/test_dryrun.rb: corresponding test refactoring
- * test/fileutils/test_nowrite.rb: ditto
- * test/fileutils/test_verbose.rb: ditto
-
-Fri Feb 17 21:39:36 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/extconf.rb: remove dbm.
-
-Fri Feb 17 21:18:39 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/extconf.rb: refine header/library mismatch detection.
- check only for ndbm.h except libc. check _GDBM_H_ for gdbm.
- check _DBM_IOERR for the original ndbm.
-
-Fri Feb 17 20:30:44 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/extconf.rb: don't check libdbm. It is not a ndbm
- implementation. (libdbm in Version 7 Unix is database library
- for single database per process.)
-
-Fri Feb 17 15:38:53 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * Merge Onigmo-5.13.1. [ruby-dev:45057] [Feature #5820]
- https://github.com/k-takata/Onigmo
- cp reg{comp,enc,error,exec,parse,syntax}.c reg{enc,int,parse}.h
- cp oniguruma.h
- cp tool/enc-unicode.rb
- cp -r enc/
-
-Fri Feb 17 15:20:30 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enum.c (enum_each_slice): arrays to be yielded can be newly
- created in the block.
-
- * enum.c: move work variables to objects not to let called blocks
- access stack area out of scope. [Bug #5801]
-
-Fri Feb 17 12:35:55 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * tool/merger.rb: remove borders from the commit message which is used
- when the commit doesn't change ChangeLog.
-
-Fri Feb 17 11:50:11 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * common.mk (btest, btest-ruby, test-sample test-knownbugs)
- (test-all, test-ruby): depend on prog.
-
-Fri Feb 17 09:56:22 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (create_header): log the content of header.
-
-Fri Feb 17 09:44:55 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * tool/transcode-tblgen.rb (import_ucm): don't use \h because the
- script should work with ruby 1.8.
-
- * tool/enc-unicode.rb: ditto.
-
-Fri Feb 17 07:33:29 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * enum.c (id_lshift): use constant ID.
-
-Fri Feb 17 07:30:53 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/extconf.rb: refactored to split too long conditions.
-
-Fri Feb 17 00:23:25 2012 Tanaka Akira <akr@fsij.org>
-
- * test/dbm/test_dbm.rb: fix skip condition for libgdbm 1.8.0 or prior.
- reported by Bohuslav Kabrda.
- [ruby-core:42685] [ruby-trunk - Bug #6036]
-
-Fri Feb 17 00:04:21 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/extconf.rb: check _DB_H_ macro unavailable except
- Berkeley DB library.
-
-Thu Feb 16 05:41:35 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * insns.def (splatarray): make new array if flag is set.
-
- * compile.c (iseq_compile_each): make new array with
- splat. [ruby-core:21901][Feature #1125]
-
-Thu Feb 16 00:14:04 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * lib/abbrev.rb (Array#abbrev): add missing '"' in documentation.
-
-Wed Feb 15 22:20:19 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * cont.c (rb_fiber_reset_root_local_storage): add a new function to
- restore rb_thread_t::local_storage.
-
- * cont.c (rb_obj_is_fiber): add a new function to tell finalizer to
- prevent fibers from destroy.
-
- * gc.c (rb_objspace_call_finalizer): don't sweep fibers at finalizing
- objspace.
-
- * internal.h (rb_fiber_reset_root_local_storage, rb_obj_is_fiber):
- add prototypes.
-
- * vm.c (ruby_vm_destruct): reset main thread's local_storage before
- free main thread. rb_thread_t::local_storage is replaced by fiber's
- local storage when forked from fiber, and it should be already freed
- when the fiber was destroyed. [ruby-core:41456] [Bug #5700]
-
- * test/ruby/test_fiber.rb (test_fork_from_fiber): add test for fork
- from fiber.
-
-Wed Feb 15 19:57:02 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/fiddle/closure.c (callback): deal with unsigned integers.
- [ruby-core:42458][Bug #5991][Bug #6022]
-
- * ext/fiddle/conversions.c (value_to_generic, generic_to_value):
- ditto.
-
- * ext/fiddle/closure.c (callback): same as r34506.
-
-Wed Feb 15 17:41:31 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * io.c (io_strsetbuf): call rb_str_modify to make str independent
- before calling rb_str_set_len for r34580.
-
-Wed Feb 15 12:30:10 2012 Eric Hodel <drbrain@segment7.net>
-
- * ext/zlib/zlib.c (Init_zlib): Added Zlib::TEXT and note that
- Zlib::ASCII is deprecated in zlib 1.2.3 and newer.
-
-Wed Feb 15 12:24:40 2012 Eric Hodel <drbrain@segment7.net>
-
- * ext/zlib/zlib.c: Move constant descriptions to constants. Remove
- extra comment block at the top of Init_zlib().
-
-Wed Feb 15 12:30:46 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/ostruct.rb: Create getters and setters after dup.
- [Bug #6028] [rubyspecs:0380bcc]
-
-Wed Feb 15 10:59:52 2012 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c (HEAP_BITMAP_LIMIT): HEAP_BITMAP_LIMIT is computed on the
- basis of HEAP_SIZE because it must covers a whole heap block.
- [ruby-trunk - Bug #6006]
-
-Wed Feb 15 09:27:45 2012 Eric Hodel <drbrain@segment7.net>
-
- * ext/zlib/zlib.c (Init_zlib): Added Zlib::FIXED and Zlib::RLE
- strategies.
- * NEWS: Add note about the new Zlib constants.
-
-Wed Feb 15 09:11:36 2012 Eric Hodel <drbrain@segment7.net>
-
- * ext/zlib/zlib.c: Improve documentation. [ruby-trunk - Bug #5948]
-
-Wed Feb 15 07:28:54 2012 Eric Hodel <drbrain@segment7.net>
-
- * encoding.c (Init_Encoding): Add IO example of internal and external
- encoding. Fixed a typo in the force_encoding example. [#5949]
-
-Wed Feb 15 06:58:21 2012 Eric Hodel <drbrain@segment7.net>
-
- * encoding.c (Init_Encoding): Add Encoding documentation.
- [ruby-trunk - Bug #5949]
- * encoding.c (rb_set_default_external): Fix typo in documentation.
-
-Tue Feb 14 20:22:11 2012 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c (CEILDIV): rename to a appropriate name.
-
-Tue Feb 14 18:07:20 2012 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c (assign_heap_slot): SEGV happens cause on 64-bit platform
- sometime there should be `objs-=2` instead of `objs--`.
- [Bug #6006]
- patched by Sokolov Yura. https://github.com/ruby/ruby/pull/92
-
-Tue Feb 14 16:00:30 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (io_setstrbuf): cut down the buffer if longer.
-
-Tue Feb 14 15:06:37 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/test/unit/assertions.rb (build_message): skip escaped
- question marks.
-
-Tue Feb 14 12:10:04 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * variable.c (autoload_const_set, autoload_require): fix
- signatures.
-
-Tue Feb 14 05:23:40 2012 Eric Hodel <drbrain@segment7.net>
-
- * process.c (proc_wait): Change typo "SystemError" to
- "SystemCallError". [ruby-trunk - Bug #5962]
- * process.c (proc_wait2): ditto
-
-Tue Feb 14 05:18:24 2012 Eric Hodel <drbrain@segment7.net>
-
- * enumerator.c: Document use of Enumerator.new for creating a lazy
- enumeration for filtering/chaining. [ruby-trunk - Feature #707]
-
-Mon Feb 13 23:01:50 2012 Akinori MUSHA <knu@iDaemons.org>
-
- * vm_method.c (rb_method_boundp):
- obj.respond_to?(:a_protected_method) should return false because
- calling a protected method may cause NoMethodError if called
- from outside the class inheritance tree. Kernel#respond_to? is
- mostly used to test if it is safe to call a method, so the false
- positive should be avoided. [ruby-dev:40461] [ruby-dev:41739]
- [ruby-dev:41837]
-
-Mon Feb 13 21:52:06 2012 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c (HEAP_OBJ_LIMIT, HEAP_BITMAP_LIMIT): HEAP_OBJ_LIMIT used
- `sizeof(struct heaps_slot)` while heap is currently allocated
- with `struct heaps_header`.
- HEAP_BITMAP_LIMIT were calculated from
- `HEAP_OBJ_LIMIT/sizeof(uintptr_t)` - one Byte for each object,
- not one Bit. [Bug #6006]
- patched by Sokolov Yura. https://github.com/ruby/ruby/pull/92
-
-Mon Feb 13 18:30:32 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (io_setstrbuf): defer resizing buffer string until data is
- read actually.
-
-Mon Feb 13 10:24:39 2012 Loren Segal <lsegal@soen.ca>
-
- * io.c (Init_IO): use directive hack to make ARGF documentable
- in other tools. [ruby-core:42515][Bug #6007]
-
-Sun Feb 12 20:43:54 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/ruby.h (rb_event_hook_func_t): add argument names.
-
-Sun Feb 12 16:30:23 2012 Akinori MUSHA <knu@iDaemons.org>
-
- * tool/merger.rb (#default_merge_branch): Add support for
- Subversion 1.7 which adopted a whole new working directory
- structure.
-
-Sun Feb 12 15:14:41 2012 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * benchmark/driver.rb: suppress unused/shadowing variable warnings.
-
-Sun Feb 12 03:14:40 2012 Eric Hodel <drbrain@segment7.net>
-
- * vm_eval.c (check_funcall): Call respond_to? with matching arity for
- legacy single-argument implementations. [ruby-trunk - Bug #6000]
-
-Sat Feb 11 12:04:05 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * compile.c (defined_expr): guard the whole expression.
- [ruby-dev:45021][Bug#5786]
-
-Sat Feb 11 08:34:42 2012 Eric Hodel <drbrain@segment7.net>
-
- * ext/zlib/zlib.c (rb_inflate_add_dictionary): Added
- Zlib::Inflate#add_dictionary to allow users to pre-specify
- for using during #inflate. [ruby-trunk - Feature #5937]
-
-Sat Feb 11 08:23:02 2012 Eric Hodel <drbrain@segment7.net>
-
- * ext/zlib/zlib.c (do_inflate): Inflate more data if buffered data
- exists. Allows Zlib::Inflate#set_dictionary to work.
- [ruby-trunk - Bug #5929]
-
-Sat Feb 11 06:00:48 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * dir.c (fnmatch): The * needs to be escaped to avoid formatting in
- fnmatch comment.
- patched by @dalton. https://github.com/ruby/ruby/pull/91
-
-Fri Feb 10 03:41:31 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/parser.c: removed external encoding setter, allow parser
- to be reused.
- * ext/psych/lib/psych/parser.rb: added external encoding setter.
- * test/psych/test_parser.rb: test parser reuse
-
-Fri Feb 10 01:30:41 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/dl/dl.h (ALIGN_OF): use offsetof().
-
- * ext/dl/dl.h (DLALIGN): round up at once and get rid of overflow.
-
-Fri Feb 10 00:47:07 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/ruby/envutil.rb (assert_no_memory_leak): new assertion to
- check memory leak by invoking child ruby process and watch its
- memory size.
-
-Thu Feb 9 23:41:44 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * test/pathname/test_pathname.rb (test_binread): add assertion to
- check encoding.
-
-Thu Feb 9 16:48:19 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/dl/dl.c (Init_dl): fix mangled document.
-
-Thu Feb 9 16:10:34 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/memory_status.rb (Memory::Win32): 64bit support.
-
-Thu Feb 9 16:08:55 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/dl/lib/value.rb (DL::ValueUtil.{unsigned_value,signed_value}):
- currently pack/unpack does not accept "q!" and "Q!".
-
-Thu Feb 9 16:01:29 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/fiddle/conversions.c (value_to_generic): src is not guaranteed as
- a Bignum if the type is LONG_LONG. it may be a Fixnum if the value
- is small.
-
-Thu Feb 9 11:32:36 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/dl/lib/types.rb: Win64 support.
-
-Thu Feb 9 04:12:29 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * test/pathname/test_pathname.rb: not read but binread.
- patched by Benoit Daloze, [ruby-core:42440] [Bug #5984]
-
-Wed Feb 8 22:29:59 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (rb_str_modify_expand): fix memory leak.
-
-Wed Feb 8 14:06:59 2012 Hiroshi Nakamura <nahi@ruby-lang.org>
-
- * ext/openssl/ossl_ssl.c: Add SSL constants and allow to unset SSL
- option to prevent BEAST attack. See [Bug #5353].
-
- In OpenSSL, OP_DONT_INSERT_EMPTY_FRAGMENTS is used to prevent
- TLS-CBC-IV vulnerability described at
- http://www.openssl.org/~bodo/tls-cbc.txt
- It's known issue of TLSv1/SSLv3 but it attracts lots of attention
- these days as BEAST attack. (CVE-2011-3389)
-
- Until now ossl sets OP_ALL at SSLContext allocation and call
- SSL_CTX_set_options at connection. SSL_CTX_set_options updates the
- value by using |= so bits set by OP_ALL cannot be unset afterwards.
-
- This commit changes to call SSL_CTX_set_options only 1 time for each
- SSLContext. It sets the specified value if SSLContext#options= are
- called and sets OP_ALL if not.
-
- To help users to unset bits in OP_ALL, this commit also adds several
- constant to SSL such as
- OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS. These constants were
- not exposed in Ruby because there's no way to unset bits in OP_ALL
- before.
-
- Following is an example to enable 0/n split for BEAST prevention.
-
- ctx.options = OP_ALL & ~OP_DONT_INSERT_EMPTY_FRAGMENTS
-
- * test/openssl/test_ssl.rb: Test above option exists.
-
-Wed Feb 8 13:12:02 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * ext/openssl/ossl_x509name.c: Use the numerical representation of
- unrecognized OIDs instead of the sn "UNDEF".
-
- * test/openssl/test_x509name.rb: Add tests for the fixed behavior.
-
- Patch provided by Paul Kehrer, thank you!
- [ruby-core:41769] [Feature #5787]
-
-Wed Feb 8 09:49:58 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * tool/merger.rb: don't abort, update first.
-
-Wed Feb 8 09:47:33 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * ext/openssl/ossl_asn1.c: Call INT2NUM only once for GeneralString.
- Thanks to Mantas Mikulenas for noticing and providing a patch!
- [ruby-core:42358] [Bug #5972]
-
-Wed Feb 8 09:19:00 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * ext/openssl/ossl_cipher.c: Add warning about key as IV.
-
-Tue Feb 7 20:08:12 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * error.c (exc_inspect): Fix typo. patch from Trent Ogren
- via https://github.com/ruby/ruby/pull/90
-
-Tue Feb 7 19:37:35 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * st.c: refactor packed entries using structs.
-
-Tue Feb 7 14:52:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * st.c (st_update): table can be unpacked in the callback.
-
- * st.c (st_foreach): should not yield same pair when checking
- after unpacking.
-
-Mon Feb 6 21:55:13 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * tool/merger.rb: abort if the working directory is dirty.
-
- * tool/merger.rb: update the working directory after commit.
-
-Mon Feb 6 00:16:27 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * encoding.c (rb_enc_compatible): return ASCII-8BIT even if 2nd string
- is ascii only string. [ruby-core:42354] [Bug #5968]
-
-Fri Feb 3 07:16:47 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/webrick.rb: Moved proxy rewriting to WEBrick::HTTPProxy.
- * lib/webrick/httpproxy.rb: Add examples of creating a proxy server
- and response rewriting using HTTPProxy.
-
-Fri Feb 3 06:53:22 2012 Eric Hodel <drbrain@segment7.net>
-
- * ext/openssl/ossl_x509store.c: Add class documentation for
- OpenSSL::X509::Store
-
-Thu Feb 2 22:28:13 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * test/net/http/test_https_proxy.rb
- (HTTPSProxyTest#test_https_proxy_authentication):
- add workaround to avoid to hang up without openssl.
- see [ruby-dev:45021][Bug #5786]
-
- * test/resolv/test_dns.rb (TestResolvDNS#test_query_ipv4_address):
- ditto.
-
-Thu Feb 2 21:48:18 2012 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/parsers/baseparser.rb: use meaningful names.
-
-Thu Feb 2 21:38:52 2012 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/parsers/baseparser.rb, test/rexml/test_namespace.rb:
- fix the default xml namespace URI validation.
- [ruby-dev:45169] [Bug #5956]
- Reported by Miho Hiramatsu. Thanks!!!
-
-Thu Feb 2 17:51:02 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * io.c (argf_next_argv): reset ARGF.next_p on ARGV.replace.
- r34409 breaks replacing ARGV.
- [ruby-dev:45160] [Bug #5952]
-
-Thu Feb 2 16:21:01 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/net/http/test_http.rb (TestNetHTTPKeepAlive#*): remove debug
- output.
-
-Thu Feb 2 01:24:34 2012 Yusuke Endoh <mame@tsg.ne.jp>
-
- * parse.y (debug_lines, coverage): set file path encoding for coverage
- result. [ruby-dev:44950]
-
-Wed Feb 1 14:38:31 2012 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/tempfile.rb (Tempfile#unlink, Tempfile::Remover#call): Just
- call File.unlink and ignore ENOENT because existence check
- before unlinking does not help in terms of race condition.
-
- * lib/tempfile.rb (Tempfile#unlink, Tempfile::Remover#call): My
- comment about thread safeness is obsolete.
-
-Wed Feb 1 09:50:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * doc/re.rdoc (Repetition): fix typo. reported by Ori Avtalion
- and patched by Zachary Scott. [Bug #5947]
-
-Wed Feb 1 06:38:54 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (argf_close): skip stdin, which should be readable again.
- [ruby-dev:45160] [Bug #5952]
-
- * io.c (argf_readlines): reinitialize after all read to be
- readable again.
-
-Tue Jan 31 21:27:43 2012 Narihiro Nakamura <authornari@gmail.com>
-
- * configure.in (HEAP_ALIGN_LOG): HEAP_ALIGN_LOG should be page
- size in OpenBSD. [ruby-core:42158][Bug #5901]
-
- * gc.c : avoid to redefine.
-
-Tue Jan 31 14:27:22 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/ruby/envutil.rb (EnvUtil.invoke_ruby): yield also child pid
- in block form.
-
-Mon Jan 30 19:08:19 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_eval.c (vm_call0): should pass block to enumerators. patched
- by Kazuki Tsujimoto. [ruby-dev:44961][Bug #5731]
-
- * vm_eval.c (method_missing), vm_insnhelper.c (vm_call_method):
- ditto. patched by satoshi shiba.
-
-Mon Jan 30 12:31:05 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * file.c (append_fspath): need to set the encoding to result always.
-
-Mon Jan 30 10:38:37 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/irb/test_completion.rb: skip if cannot load irb/completion
- (maybe readline does not exist).
-
-Sun Jan 29 22:47:19 2012 Yutaka Kanemoto <kanemoto@ruby-lang.org>
-
- * tool/config.{guess,sub}: updated to automake-1.11.2.
-
-Sun Jan 29 12:17:56 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/readline/readline.c (readline_attempted_completion_function):
- respect encodings. [Bug #5941]
-
-Sat Jan 28 09:33:33 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * win32/win32.c (rb_w32_read): fix an issue that $stdin.read doesn't
- terminate by CTRL-C on Windows.
- [ruby-dev:45149] [Bug #5812]
-
-Sat Jan 28 08:18:11 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * test/ruby/test_thread.rb
- (TestThreadGroup#test_thread_timer_and_interrupt): skip exit status
- assertion because we cannot get signal status on Windows.
-
- * win32/win32.c (CreateChild): create process group to receive the
- signal by GenerateConsoleCtrlEvent().
-
- * win32/win32.c (kill): use CTRL_BREAK_EVENT instead of CTRL_C_EVENT
- if a process group is specified. CTRL_C_EVENT signal cannot be
- generated for process groups for the specification.
- [ruby-dev:45149] [Bug #5812]
-
-Sat Jan 28 07:46:03 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * thread_win32.c (rb_w32_wait_events_blocking): use
- ruby_thread_from_native() instead of GET_THREAD() because
- GET_THREAD() doesn't always return the current thread and
- WaitForMultipleObjects() at rb_w32_read() doesn't return by
- Thread#kill. This fixes TestQueue#test_thr_kill failure on
- Windows.
-
- * thread_win32.c (rb_w32_wait_events): use ruby_thread_from_native()
- instead of GET_THREAD() for consistency with the above change.
-
- * thread_win32.c (rb_w32_sleep): ditto.
-
- * thread_win32.c (rb_w32_Sleep): ditto.
- [ruby-dev:45149] [Bug #5812]
-
-Sat Jan 28 07:28:48 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * test/zlib/test_zlib.rb (TestZlibGzipReader#test_reader_wrap): set
- binmode explicitly for fixing test error on Windows. This is consistent
- with r34243.
- [ruby-dev:45149] [Bug #5812]
-
-Sat Jan 28 05:53:34 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/irb/completion.rb (IRB::InputCompletor::CompletionProc):
- ignore non-string name modules. [ruby-core:42244][Bug #5938]
-
-Fri Jan 27 16:31:45 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (HEAP_ALIGN, HEAP_ALIGN_MASK): DRY, let compiler calculate
- from HEAP_ALIGN_LOG.
-
-Thu Jan 26 11:03:37 2012 Eric Hodel <drbrain@segment7.net>
-
- * lib/matrix.rb: Clean up extra whitespace in output documentation.
-
-Thu Jan 26 03:24:02 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/io/console/console.c (io_getch): default delegating method
- for StringIO. https://github.com/nobu/io-console/issues/4
-
- * ext/stringio/stringio.c: moved some methods to hidden modules.
-
-Wed Jan 25 13:27:42 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (rb_file_s_basename): ignore non-ascii extension in
- different encoding, which cannot match.
-
- * file.c (rmext): no extension to strip if empty string.
-
- * file.c (rb_enc_path_next, rb_enc_path_skip_prefix)
- (rb_enc_path_last_separator, rb_enc_path_end)
- (ruby_enc_find_basename, ruby_enc_find_extname): encoding-aware
- path handling functions.
-
- * file.c (rb_home_dir, file_expand_path, rb_realpath_internal)
- (rb_file_s_basename, rb_file_dirname, rb_file_s_extname)
- (rb_file_join): should respect the encodings of arguments than
- file system encoding. [ruby-dev:45145] [Bug #5919]
-
- * dir.c (check_dirname, ruby_glob0): ditto.
-
- * ext/pathname/pathname.c (path_sub_ext): ditto.
-
-Tue Jan 24 14:20:42 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm.c (rb_iter_break_value): new function to break a block with
- the value. [ruby-dev:45132] [Feature #5895]
-
-Tue Jan 24 12:58:41 2012 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * object.c (rb_Hash): add Kernel#Hash conversion method like
- Array() or Float(). a patch from Run Paint Run Run. Fix #3131
-
-Tue Jan 24 11:38:05 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/uri/common.rb (URI.encode_www_form_component): initialize on
- requiring to support JRuby, which runs parallel multithreads.
- [ruby-core:42222] [Bug #5925]
-
- * lib/uri/common.rb (URI.decode_www_form_component): initialize on
-
-Mon Jan 23 20:33:11 2012 Jason Kay <geniture@me.com>
-
- * lib/net/http.rb (Net::HTTP#connect): Writing entire packet at
- once to avoid incomplete transmission. Current code using
- writeline was causing sub-optimal conversing with a proxy due to
- the connect tunnel request headers being split over multiple
- packets. The modification I made allows the connect request to
- be written as one packet, avoiding problems and optimizing the
- conversation.
-
- https://github.com/ruby/ruby/pull/72
- [Feature #5460]
-
-Mon Jan 23 17:06:17 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/uri/mailto.rb (URI::MailTo.build): follow Array#to_s change of
- Ruby 1.9; use Array#join. [Bug #5840]
-
-Mon Jan 23 16:42:28 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * io.c (extract_binmode): raise an exception if binmode/textmode
- is specified with both vmode and opthash.
- [ruby-core:42199] [Bug #5918]
-
-Mon Jan 23 16:35:27 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * io.c (rb_io_extract_modeenc): set ASCII-8BIT if binmode is specified
- with opthash. [ruby-core:42197] [Bug #5917]
-
-Mon Jan 23 10:08:00 2012 Kenta Murata <mrkn@cookpad.com>
-
- * test/cgi/test_cgi_util.rb (test_cgi_escape_preserve_encoding):
- add a test for CGI::escape to preserve encoding.
-
- * test/cgi/test_cgi_util.rb (test_cgi_unescape_preserve_encoding):
- add a test for CGI::unescape to preserve encoding.
-
-Mon Jan 23 00:45:34 2012 Akinori MUSHA <knu@iDaemons.org>
-
- * misc/rdoc-mode.el (rdoc-imenu-create-index): Add imenu support
- to rdoc-mode.
-
- * misc/rdoc-mode.el (rdoc-mode): Fix regexp patterns containing
- "\s " where CR/LF is not supposed to match.
-
-Sun Jan 22 15:41:26 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (rb_intern3): split to registration check and new
- registration.
-
- * parse.y (rb_intern_str): make interned string shared with the
- given string.
-
- * parse.y (rb_intern3, rb_intern_str): check the coderange first.
-
-Sat Jan 21 22:21:07 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/ruby.h (FIXNUM_P): simple flag should be int.
-
-Sat Jan 21 21:51:19 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * encoding.c (rb_enc_compatible): fix segv on symbols.
- [ruby-core:42204] [Bug #5921]
-
-Sat Jan 21 11:43:45 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * dir.c (dir_chdir, check_dirname): get rid of optimization-out.
-
-Fri Jan 20 20:47:37 2012 Kenta Murata <mrkn@cookpad.com>
-
- * lib/cgi/util.rb (CGI.escape): support a string with invalid byte
- sequence. [Bug #5913]
-
- * test/cgi/test_cgi_util.rb
- (test_cgi_escape_with_invalid_byte_sequence): test for the above
- change.
-
-Fri Jan 20 17:37:37 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * vm.c (vm_exec): remove workaround for LLVM because r34278 fixes it.
-
- * vm_insnhelper.c (vm_call_cfunc): ditto.
-
-Fri Jan 20 14:31:43 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/net/http.rb (Net::HTTP#transport_request): retry a idempotent
- request automatically. [ruby-dev:45030] [Bug #5790]
- [ruby-core:41821] [Bug #5813]
-
- * lib/net/http.rb (Net::HTTP#keep_alive_timeout=): added to specify
- the second to reconnect the TCP connection on Keep-Alive.
- The default value is 2 second because current servers uses 2 sec.
- http://ftp-admin.blogspot.com/2009/09/keepalivetimeout2.html
-
- * lib/net/http.rb (Net::HTTP#begin_transport): reconnect TCP
- connection on keep-alive timeout.
-
-Thu Jan 19 07:53:09 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_strptime.c: moved detector of leftover.
-
-Thu Jan 19 07:10:47 2012 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_parse.c: [ruby-core:42173].
-
-Wed Jan 18 18:11:02 2012 Akinori MUSHA <knu@iDaemons.org>
-
- * misc/rdoc-mode.el (rdoc-mode): Add provide so that requiring
- this library succeeds.
-
-Wed Jan 18 18:06:45 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/curses/curses.c (cWindow, cMouseEvent): made typed data.
-
-Wed Jan 18 12:49:15 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/to_ruby.rb: Added support for loading
- subclasses of String with ivars
- * ext/psych/lib/psych/visitors/yaml_tree.rb: Added support for dumping
- subclasses of String with ivars
- * test/psych/test_string.rb: corresponding tests
-
-Wed Jan 18 10:39:47 2012 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/to_ruby.rb: Added ability to load array
- subclasses with ivars.
- * ext/psych/lib/psych/visitors/yaml_tree.rb: Added ability to dump
- array subclasses with ivars.
- * test/psych/test_array.rb: corresponding tests
-
-Tue Jan 17 17:18:41 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (SPT_TYPE): enable as SPT_REUSEARGV on Darwin.
-
- * missing/setproctitle.c (ruby_init_setproctitle): changed prefix.
-
-Tue Jan 17 12:32:46 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (aligned_malloc, aligned_free): covered missing defined
- operators and fixes for cygwin.
-
-Tue Jan 17 10:54:46 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * st.c (do_hash): it's the time to remove cast to unsigned int.
-
-Tue Jan 17 07:30:12 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * st.c (unpack_entries): Fix r34310: on unpacking, the position of
- a hash must be do_hash-ed value.
-
- * st.c (add_packed_direct): ditto.
-
-Mon Jan 16 16:41:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/optparse.rb (Regexp): fix incorrect options when casting to
- a Regexp, and suppress encoding option warnings.
- https://github.com/ruby/ruby/pull/82
-
-Mon Jan 16 11:22:38 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (rb_chsize): no need to get the current file size.
-
-Mon Jan 16 00:41:33 2012 Sokolov Yura <funny.falcon@gmail.com>
-
- * st.c: st use function instead of macro. In my current
- environment (Ubuntu 11.04 32bit gcc-4.5.2) it gives 4%
- performance improvement.
-
- https://github.com/ruby/ruby/pull/77
-
-Sun Jan 15 14:09:48 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * object.c (rb_inspect): raise the result is not compatible with
- the default external encoding. [ruby-core:42095] [Bug #5848]
- 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.
-
-Sun Jan 15 13:21:50 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/json/parser/parser.rl (json_string_unescape): workaround fix
- for over optimization of GCC 4.7. [ruby-core:42085] [Bug #5888]
- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51862
-
-Sat Jan 14 22:24:09 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/dl/callback/mkcallback.rb (gencallback): suppress unused
- variables.
-
-Sat Jan 14 21:56:43 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * iseq.c (iseq_data_to_ary): check line info table boundary. line
- number 0 means no line number info is needed. [ruby-dev:45130]
- [Bug #5894]
-
-Sat Jan 14 18:24:13 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * error.c (exc_equal): clear rb_thread_t::errinfo when ignore
- an exception under rb_protect(). [ruby-core:41979] [Bug #5865]
-
-Sat Jan 14 12:02:55 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * sprintf.c (rb_enc_vsprintf): relaxed the restriction. since the
- implementation deeply depends on plain char, so wchar_t based
- encodings are not supported.
-
-Sat Jan 14 12:00:20 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * error.c (exc_equal): ignore exceptions during implicit
- conversion. [ruby-core:41979] [Bug #5865]
-
-Sat Jan 14 05:58:54 2012 Eric Hodel <drbrain@segment7.net>
-
- * io.c (rb_io_s_read): Fix formatting of open_args comment. Reported
- by Adam Prescott.
-
-Fri Jan 13 18:41:19 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * sprintf.c (rb_enc_vsprintf): can be used for ASCII compatible
- encodings only.
-
-Fri Jan 13 18:29:06 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * thread.c (rb_mutex_unlock_th): simplified.
-
- * thread.c (rb_barrier_waiting): fix potential overflows.
-
-Fri Jan 13 17:23:38 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * load.c (load_unlock): update loading table at once.
-
-Fri Jan 13 16:44:45 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * error.c (exc_equal): try implicit conversion for delegator.
- [ruby-core:41979] [Bug #5865]
-
-Fri Jan 13 03:46:53 2012 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/shellwords.rb (Shellwords#shellescape): shellescape() now
- stringifies the given object using to_s.
-
- * lib/shellwords.rb (Shellwords#shelljoin): shelljoin() accepts
- non-string objects in the given array, each of which is
- stringified using to_s.
-
- * lib/shellwords.rb: Fix rdoc markups.
-
-Fri Jan 13 03:38:36 2012 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/shellwords.rb (Shellwords#shellsplit): Fix a bug where
- consecutive backslashes in double quotes are all removed except
- the one at the tail.
-
-Fri Jan 13 03:28:00 2012 Luis Lavena <luislavena@gmail.com>
-
- * ext/socket/extconf.rb (if ipv6): only define _WIN32_WINNT if was not
- previously defined. This solve warnings with multiple defines in
- command line with GCC 4.6.1
-
-Thu Jan 12 18:44:31 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb: fix r33904 and revert r33905. initialize global
- variables with init_mkmf before initializing constants.
- [ruby-dev:45124] [Bug #5879]
-
-Thu Jan 12 13:51:00 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * cont.c (cont_restore_0): prevent optimizing out `sp'. sp is used for
- reserving a memory space with ALLOCA_N for restoring machine stack
- stored in cont->machine_stack, but clang optimized out it (and
- maybe #5851 is also caused by this).
- This affected TestContinuation#test_check_localvars.
-
- * cont.c (cont_restore_1): revert workaround introduced in r32201.
-
-Thu Jan 12 02:14:43 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * object.c: Added examples for Object#is_a? and
- Object#instance_of? patched from Manoj Kumar.
- [Bug #5880] [ruby-core:42057]
-
-Thu Jan 12 00:57:48 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * lib/mkmf.rb: verbose-mode can use by RM, RMDIRS, etc.
- (e.g. make V=1 realclean)
-
-Wed Jan 11 23:40:21 2012 Naohisa Goto <ngoto@gen-info.osaka-u.ac.jp>
-
- * string.c (rb_str_concat): set array element after definition
- to fix compile error with Fujitsu C Compiler 5.6 on Solaris 10
- on Sparc. [Bug #5878] [ruby-dev:45123]
-
-Wed Jan 11 22:52:51 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * gc.c (ruby_mimmalloc): don't set allocated size to header.
- ruby_mimmalloc() doesn't increment allocated_size/allocations and
- decrement them in ruby_xfree() cause inconsistency.
-
- * gc.c (ruby_xfree): don't decrement allocated_size/allocations if
- allocated size record is 0.
-
-Wed Jan 11 22:36:43 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * test/readline/test_readline.rb (test_completion_proc_empty_result):
- ensure clearance of Readline's line_buffer after the test.
-
-Tue Jan 10 21:57:38 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * ext/dbm/dbm.c (Init_dbm): fix a build error on mswin32.
- use `extern __declspec(dllimport)` for dll link with VC.
- [ruby-core:41996] [Bug #5869]
+ * 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 Jan 10 15:31:55 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Tue Feb 4 19:10:29 2014 Koichi Sasada <ko1@atdot.net>
- * vm.c (vm_exec): refix r34162; suppress warning and add description.
+ * 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 Jan 10 15:13:58 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Tue Feb 4 17:20:03 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/readline/readline.c (readline_attempted_completion_function):
- use rb_memerror().
+ * dir.c (glob_helper): return the filename with actual cases on
+ the filesystem if it is case-insensitive. [ruby-core:42469]
+ [Feature #5994]
-Tue Jan 10 12:49:42 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Tue Feb 4 16:16:58 2014 Koichi Sasada <ko1@atdot.net>
- * gc.c: in fact, i686-linux doesn't need to define _XOPEN_SOURCE 600.
+ * string.c: use STR_SHARED instead of ELTS_SHARED.
+ (same value, but more clear meaning)
-Tue Jan 10 12:44:11 2012 NARUSE, Yui <naruse@ruby-lang.org>
+Tue Feb 4 16:09:14 2014 Koichi Sasada <ko1@atdot.net>
- * gc.c (ruby_mimmalloc): defined for objects need not rb_objspace,
- but should return pointer suitable for ruby_xfree;
- main vm and main thread.
- patched by Sokolov Yura. https://github.com/ruby/ruby/pull/79
+ * string.c: remove STR_ASSOC related code.
+ By r44804, string objects can not have STR_ASSOC flag.
* internal.h: ditto.
- * vm.c (Init_BareVM): use ruby_mimmalloc.
-
- * ext/dl/cfunc.c: #include <ruby/util.h>.
-
- * ext/syslog/syslog.c: use xfree because it is allocated by
- ruby_strdup.
-
-Tue Jan 10 12:13:56 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * ext/readline/readline.c (readline_attempted_completion_function):
- fix compile error.
-
-Tue Jan 10 10:41:11 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/readline/readline.c (readline_attempted_completion_function):
- empty completion result does not mean memory error.
-
-Tue Jan 10 02:19:22 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * test/ruby/test_io.rb (test_autoclose_true_closed_by_finalizer,
- test_autoclose_true_closed_by_finalizer): skip if IO objects are
- not recycled yet. [ruby-dev:45098] [Bug #5850]
-
-Tue Jan 10 00:41:28 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * lib/tempfile.rb (Tempfile#_close): clear @tempfile and @data[1] even
- when exception is raised at @tempfile.close. [ruby-dev:45113]
-
- * lib/tempfile.rb (Tempfile#unlink): fix a typo.
-
-Tue Jan 10 00:32:17 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * gc.c (run_finalizer): clear rb_thread_t::errinfo when ignore
- an exception under rb_protect(). [ruby-dev:45113]
-
-Mon Jan 9 23:37:43 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * ext/readline/readline.c (readline_attempted_completion_function):
- fix typos.
-
-Mon Jan 9 20:55:34 2012 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c : don't embed struct heaps_slot to a heap block because it
- can causes copy-on-write of memory page on heap block when its
- free_next is rewritten.
-
-Mon Jan 9 20:26:33 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/pathname/pathname.c (path_entries): add document suggested by
- the thread [ruby-core:41959] [Bug #5859].
-
-Mon Jan 9 20:14:13 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/lib/socket.rb (family_addrinfo): don't require protocol
- equality. For example, protocol 0 and IPPROTO_TCP is not problem
- for TCP.
-
-Mon Jan 9 20:08:52 2012 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/lib/socket.rb (family_addrinfo): return the given
- addrinfo object.
- Patch by Ippei Obayashi. [ruby-dev:45095] [Bug #5845]
-
-Mon Jan 9 19:40:20 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/zlib/test_zlib.rb (TestZlibGzipWriter#test_writer_wrap): set
- binmode explicitly.
-
-Mon Jan 9 14:42:41 2012 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c: free_slots is changed Singly linked list. clear
- free_slots before sweep.
-
-Mon Jan 9 07:46:17 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * gc.c: i686-linux needs to define _XOPEN_SOURCE 600 for posix_memalign.
-
-Mon Jan 9 04:24:59 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * gc.c (rb_objspace_free): global_List is allocated with xmalloc.
- patched by Sokolov Yura. https://github.com/ruby/ruby/pull/78
-
- * dln_find.c: remove useless replacement of free.
-
- * ext/readline/readline.c (readline_attempted_completion_function):
- strings for readline must allocated with malloc.
-
- * process.c (run_exec_dup2): use free; see also r20950.
-
- * re.c (onig_new_with_source): use malloc for oniguruma.
-
- * vm.c (ruby_vm_destruct): use free for VMs.
-
- * vm.c (thread_free): use free for threads.
-
-Mon Jan 9 04:24:59 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * dln_find.c: remove useless replacement of free.
-
- * ext/readline/readline.c (filename_completion_proc_call):
- matches should use xfree.
-
- * ext/readline/readline.c (username_completion_proc_call): ditto.
-
-Mon Jan 9 01:12:35 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * numeric.c (rb_enc_uint_char): raise RangeError when added codepoint
- is invalid. [Feature #5855] [Bug #5863] [Bug #5864]
-
- * string.c (rb_str_concat): ditto.
-
- * string.c (rb_str_concat): set encoding as ASCII-8BIT when the string
- is US-ASCII and the argument is an integer greater than 127.
-
- * regenc.c (onigenc_mb2_code_to_mbclen): rearrange error code.
-
- * enc/euc_jp.c (code_to_mbclen): ditto.
-
- * enc/shift_jis.c (code_to_mbclen): ditto.
-
-Sun Jan 8 20:31:45 2012 Narihiro Nakamura <narihiro@netlab.jp>
-
- * gc.c : consider header bytes which are used by malloc.
-
-Sun Jan 8 11:54:43 2012 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c (aligned_free): support MinGW. Patch by Hiroshi Shirosaki.
-
-Sun Jan 8 11:43:05 2012 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c (slot_sweep): add a assertion instead of a debug print.
-
-Sun Jan 8 01:18:19 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * test/-ext-/old_thread_select/test_old_thread_select.rb:
- avoid platform bug. [Bug #5858] [ruby-dev:45108]
-
-Sun Jan 8 00:46:34 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * gc.c: get rid of implicit narrowing conversion.
-
-Sun Jan 8 00:10:10 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * configure.in: check posix_memalign(3) and memalign(3).
-
- * gc.c (aligned_malloc): use configure's result instead of
- _POSIX_C_SOURCE and _XOPEN_SOURCE because they can't be used
- to check availability at least on FreeBSD.
-
-Sat Jan 7 22:25:50 2012 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c: use Bitmap Marking algorithm to avoid copy-on-write of
- memory pages. See [ruby-dev:45085] [Feature #5839]
- [ruby-core:41916].
-
- * include/ruby/ruby.h : FL_MARK rename to FL_RESERVED1.
-
- * node.h : ditto.
-
- * debug.c : ditto.
-
- * object.c (rb_obj_clone): FL_MARK move to a bitmap.
-
- * class.c (rb_singleton_class_clone): ditto.
-
-Sat Jan 7 00:47:07 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * configure.in: always define CANONICALIZATION_FOR_MATHN.
- [ruby-dev:45100] [Bug #5852]
-
-Fri Jan 6 23:11:20 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * include/ruby/version.h: RUBY_API_VERSION 2.0.0
-
-Fri Jan 6 12:24:11 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * object.c (rb_inspect): raises Encoding::CompatibilityError if the
- result is incompatible with the default external encoding.
- [ruby-core:41931] [Bug #5848]
-
-Thu Jan 5 15:26:15 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (check_valid_dir): strict checking of root.
- GetDriveType() succeeds with non root directory as the argument,
- even if MSDN says that the API needs the root directory.
- this patch fixes a failure of test/ruby/test_file_exhaustive.rb.
-
-Thu Jan 5 12:15:55 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * file.c (rb_file_join): separator is appended by array length - 1
- times. patched by Benoit Daloze [ruby-core:41901] [Bug #5841]
-
-Thu Jan 5 11:47:54 2012 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/uri/common.rb (URI::Parser#initialize_regexp):
- use \A \z instead of ^ $. [Bug #5843]
-
-Wed Jan 4 17:55:53 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * array.c (rb_ary_sample): add example for Array#sample
- based on patch from https://github.com/ruby/ruby/pull/74
-
-Wed Jan 4 14:24:33 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * string.c (str_nth_len): count ascii-only run at the end. this
- bug appears only when single-byte-optimization is disabled due
- to unknown coderange. [ruby-core:41896] [Bug #5836]
-
-Wed Jan 4 11:32:07 2012 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (check_valid_dir): special case for a root directory.
- Reported by Masateru OKAMOTO at [Bug #5819].
-
-Wed Jan 4 00:19:54 2012 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/parsers/baseparser.rb: use private instead of _xxx
- method name. This is Ruby code not Python code.
- refs #5696
-
-Tue Jan 3 23:57:37 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * lib/rexml/parsers/baseparser.rb: rexml BaseParser uses
- instance_eval unnecessarily on listener add.
- patch from Charles Nutter. [Bug #5696] [ruby-core:41437]
-
-Tue Jan 3 20:44:13 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * README: add comment for Git user. patch from Arun Agrawal.
- * README.ja: ditto.
-
-Tue Jan 3 15:58:22 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * thread.c: changed documentation for "thread-local" variables.
- patch from Julien Ammous.
-
-Tue Jan 3 15:50:12 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * process.c: Fix typo. patch from Aviv Ben-Yosef.
-
-Tue Jan 3 13:43:37 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * tool/merger.rb: allow r0123 style revision number.
-
-Tue Jan 3 11:17:55 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * tool/merger.rb (#version_up): version.h date should be Japanese
- locale date.
-
-Mon Jan 2 22:08:00 2012 Akinori MUSHA <knu@iDaemons.org>
-
- * tool/file2lastrev.rb (VCS::detect): Add support for Subversion
- 1.7 which adopted a whole new working directory structure.
-
- * tool/file2lastrev.rb (VCS::detect): Simply use .each instead of
- .sort.reverse_each which looks too arbitrary. If you want SVN
- to be tried first, then you just have to register it first as it
- is right now.
-
-Mon Jan 2 20:53:36 2012 Tanaka Akira <akr@fsij.org>
-
- * lib/securerandom.rb (random_bytes): use IO#read instead of
- IO#readpartial to make the intent more clear.
-
-Mon Jan 2 15:26:39 2012 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * test/ruby/test_object.rb (test_send_with_block): add a normal case.
-
-Mon Jan 2 15:18:54 2012 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * test/ruby/test_object.rb (test_send_with_block): moved from
- bootstraptest/test_flow.rb.
-
-Mon Jan 2 15:10:11 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * lib/test/unit/parallel.rb: use pack("m0") instead of
- pack("m").gsub("\n","").
- * lib/test/unit.rb (Test::Unit::Runner::Worker#run): ditto.
-
-Mon Jan 2 15:05:09 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * lib/test/unit.rb (Test::Unit::Runner::Worker#run): use
- File.basename with suffix instead of gsub.
-
-Mon Jan 2 14:55:28 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * lib/test/unit.rb (Test::Unit::Runner#_run_parallel): find may
- return nil and nil can not dup.
-
-Sun Jan 1 12:23:10 2012 Akinori MUSHA <knu@iDaemons.org>
-
- * lib/shellwords.rb (Shellwords#shellescape): Drop the //n flag
- that only causes warnings with no real effect. [Bug #5637]
-
-Sat Dec 31 06:28:37 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * thread.c (rb_barrier_waiting): save the number of waiting threads
- in RBASIC()->flags. [ruby-dev:45002] [Bug #5768]
-
- * thread.c (rb_barrier_wait): increment and decrement around
- rb_mutex_lock, and use rb_barrier_waiting().
-
- * thread.c (rb_barrier_release): use rb_barrier_waiting().
-
- * thread.c (rb_barrier_destroy): ditto.
-
-Mon Dec 26 17:20:10 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * vm.c (vm_exec): add guard to prevent optimization for LLVM clang.
-
-Fri Dec 30 17:01:12 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * vm_eval.c (rb_f_send): fix obj.send() documentation issue.
- [Bug #5125] [ruby-core:38633]
-
-Thu Dec 29 22:36:16 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * lib/test/unit.rb (Test::Unit::Runner::Worker#_run_parallels): fix
- premature exit when all workers' status are :ready or :prepare.
- [ruby-dev:45061] [Bug #5822]
-
-Thu Dec 29 01:51:13 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * include/ruby/ruby.h: fix #error pragma. LLP64 platform is supported.
-
- * include/ruby/st.h: ditto.
-
-Wed Dec 28 11:22:45 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/fileutils.rb (FileUtils::Entry_#entries): use utility method
- instead of typoed regexp. [ruby-core:41829] [Bug #5817]
-
-Wed Dec 28 02:08:04 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * vm_insnhelper.c (unknown_keyword_error): add GC guard to prevent
- intermediate object from GC.
-
-Tue Dec 27 22:34:54 2011 Shota Fukumori <sorah@tubusu.net>
-
- * lib/test/unit.rb (Worker#close): "closing IO if IO is closed"
- should be "closing IO if IO isn't closed"
-
-Tue Dec 27 22:04:27 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * st.c (st_update): new function to lookup the given key and
- update the value. [ruby-dev:44998]
-
-Tue Dec 27 21:17:33 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * node.h (rb_args_info): change pre_args_num and post_args_num as
- int, to match with rb_iseq_t.
-
- * parse.y (new_args_gen): check overflow.
-
-Mon Dec 26 22:38:35 2011 Yusuke Endoh <mame@tsg.ne.jp>
-
- * vm_insnhelper.c (unknown_keyword_error): make it kind a error
- message when unknown keyword is given. It require more work.
- See [ruby-core:40518] and [ruby-core:40541] in detail.
-
-Mon Dec 26 22:31:07 2011 Yusuke Endoh <mame@tsg.ne.jp>
-
- * vm_core.h (struct rb_iseq_struct), compile.c (iseq_set_arguments),
- iseq.c (rb_iseq_parameters), vm_insnhelper.c
- (vm_callee_setup_arg_complex): support Method#parameters for keyword
- arguments. The provisional spec is what Benoit Daloze proposed.
- [ruby-core:40541]
-
- * test/ruby/test_keyword.rb: add a test for above.
-
-Mon Dec 26 22:15:27 2011 Yusuke Endoh <mame@tsg.ne.jp>
-
- * vm_core.h (struct rb_iseq_struct), compile.c (iseq_set_arguments,
- iseq_compile_each), vm_insnhelper.c (vm_callee_setup_arg_complex):
- implement keyword arguments. See [ruby-core:40290]
- The feature is promised to be included in 2.0, but the detail spec
- is still under discussion; this commit is a springboard for further
- discussion. Please try it and give us feedback.
- This commit includes fixes for some problems reported by Benoit
- Daloze <eregontp AT gmail.com> [ruby-core:40518] and Marc-Andre
- Lafortune <ruby-core-mailing-list AT marc-andre.ca>
- [ruby-core:41772].
-
- * iseq.c (iseq_free, prepare_iseq_build): bookkeeping.
-
- * test/ruby/test_keyword.rb: add tests for keyword arguments.
-
- * test/ripper/dummyparser.rb (class DummyParser): temporal fix for
- ripper test.
-
-Mon Dec 26 22:00:17 2011 Yusuke Endoh <mame@tsg.ne.jp>
-
- * node.h, node.c, parse.y: implement a parser part for keyword
- arguments.
- This is a preparation for keyword argument (see [ruby-core:40290]).
-
- * gc.c (gc_mark_children): bookkeeping.
-
-Mon Dec 26 21:03:18 2011 Yusuke Endoh <mame@tsg.ne.jp>
-
- * node.h, parse.y (new_args_gen), compile.c (iseq_set_arguments): use
- struct rb_args_info instead of NODEs.
- This is a preparation for keyword argument (see [ruby-core:40290]).
-
- * node.c (dump_node), gc.c (gc_mark_children, obj_free): bookkeeping.
-
-Mon Dec 26 20:59:51 2011 Yusuke Endoh <mame@tsg.ne.jp>
-
- * node.h, parse.y (lambda, f_larglist): remove NEW_LAMBDA hack.
- This is a preparation for keyword argument (see [ruby-core:40290]).
-
-Mon Dec 26 22:01:19 2011 Hiroshi Shirosaki <h.shirosaki@gmail.com>
-
- * io.c (rb_sys_fail_path): move the definition.
- Move above for using it in set_binary_mode_with_seek_cur().
-
- * io.c (set_binary_mode_with_seek_cur): fix improper seek cursor.
- Seeking file cursor with setting binary mode has possibility to
- cause infinite loop. Fixed the bug and refined error handling.
- Introduced at r34043.
-
- And cleanups as below.
- Remove unnecessary parentheses of `fptr`.
- Use return value of setmode().
-
- * test/ruby/test_io_m17n.rb
- (TestIO_M17N#test_seek_with_setting_binmode): add a test for above.
- [ruby-core:41671] [Bug #5714]
-
-Mon Dec 26 17:01:14 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * common.mk (LIBRUBY_A): depends on main.o since r33774.
- [ruby-core:41786] [Bug #5796]
-
-Mon Dec 26 13:07:08 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_io.rb (TestIO#test_autoclose): Tempfile.new doesn't
- accept the block argument.
-
-Mon Dec 26 13:06:52 2011 Shota Fukumori <sorah@tubusu.net>
-
- * lib/test/unit.rb: Avoid zombie processes on "--separate" option
- added at r34121.
-
-Mon Dec 26 04:01:23 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * ext/openssl/ossl_cipher.c: Update and complete documentation.
-
-Sun Dec 25 23:16:11 2011 Shota Fukumori <sorah@tubusu.net>
-
- * test/testunit/test_parallel.rb (test_separate): Test for "--separate"
- option (r34121)
-
-Sun Dec 25 22:39:49 2011 Shota Fukumori <sorah@tubusu.net>
-
- * lib/test/unit.rb (_run_parallel):
- New option "--separate" for test/unit; when running tests with this
- option, a job process will be restarted after one test file has done.
- This means all test files will run with separated process.
-
- * lib/test/unit/parallel.rb: Fix for above. Now parallel.rb puts
- "ready!" for first ready, "ready" for afters.
-
-Sun Dec 25 00:02:15 2011 Luis Lavena <luislavena@gmail.com>
-
- * configure.in: change --with-ntver to --with-winnt-ver to be more
- descriptive in the context. [ruby-core:41794]
-
-Sat Dec 24 23:25:15 2011 Luis Lavena <luislavena@gmail.com>
-
- * configure.in: add --with-ntver option to match win32/configure.bat
- functionality. Set 0x0501 as default. [ruby-core:35010]
- [ruby-core:35035]
+ * ext/objspace/objspace_dump.c (dump_object): ditto.
-Sat Dec 24 12:38:53 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Feb 4 14:07:20 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * proc.c (proc_call): get rid of optimization-out by clang.
+ * pack.c (str_associate, str_associated): keep associated objects
+ in an instance variables, instead of in the internal structure.
- * proc.c (rb_proc_call, rb_proc_call_with_block): ditto.
+ * string.c (rb_str_associate, rb_str_associated): deprecate.
-Sat Dec 24 10:56:32 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Feb 4 12:55:31 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/readline/readline.c (readline_readline): check if outstream
- is closed to get rid of a bug of readline 6. [ruby-dev:45043]
- [Bug #5803]
+ * 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.
-Sat Dec 24 06:59:49 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Feb 4 12:45:15 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/readline/test_readline.rb (test_line_buffer__point): use
- lambda not to exit entire method by "return". or "next" for
- proc. [ruby-dev:45042] [Bug #5802]
+ * dir.c (glob_make_pattern): all alphabets are magic characters on
+ case-insensitive filesystems. [ruby-core:42469] [Feature #5994]
-Sat Dec 24 01:20:39 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+Tue Feb 4 09:47:57 2014 Eric Hodel <drbrain@segment7.net>
- * vm_eval.c (send_internal): PASS_PASSED_BLOCK_TH must be placed
- just before calling rb_call0.
-
- * bootstraptest/test_flow.rb: add a test for above.
-
-Sat Dec 24 00:55:16 2011 Tanaka Akira <akr@fsij.org>
-
- * lib/tempfile.rb (Tempfile#initialize): warn if a block is given.
-
-Fri Dec 23 16:14:30 2011 TAKAO Kouji <kouji@takao7.net>
-
- * ext/readline/readline.c (readline_attempted_completion_function):
- in Readline module with GNU Readline 6 case, Readline module
- resets completion_append_character to " ", after it executes
- completion. So, Readline module stores
- completion_append_character, and Readline module always sets it
- after Readline module executes completion. [ruby-dev:43456]
- [Feature #4635]
-
-Fri Dec 23 15:59:05 2011 TAKAO Kouji <kouji@takao7.net>
-
- * ext/readline/readline.c (Init_readline): libedit check
- rl_getc_function only when rl_initialize() is called, and
- using_history() call rl_initialize(). This assignment should be
- placed before using_history(). [ruby-core:40641] [Bug #5539]
-
-Fri Dec 23 10:14:47 2011 Tanaka Akira <akr@fsij.org>
-
- * test/thread/test_queue.rb (test_thr_kill): show the number of loop
- run when the test failed.
-
-Fri Dec 23 09:23:48 2011 Tanaka Akira <akr@fsij.org>
-
- * test/test_pty.rb (test_pty_check_default): call PTY.check until
- "cat" command is finished.
-
-Fri Dec 23 06:03:00 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * common.mk: add "check succeeded" message.
-
- * README, README.ja: follow above change.
-
-Fri Dec 23 06:00:39 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * ext/bigdecimal/bigdecimal.h: add satisfy cc-mode comment.
- * util.c: ditto.
-
-Fri Dec 23 00:08:25 2011 Tanaka Akira <akr@fsij.org>
-
- * test/test_pty.rb (test_pty_check_default): "cat" may not terminated
- in the 0.1 second.
-
-Thu Dec 22 23:37:25 2011 Tanaka Akira <akr@fsij.org>
-
- * test/ruby/test_thread.rb (test_condvar_timed_wait): don't test the
- maximum sleep time. Ruby is not a real-time system.
-
-Thu Dec 22 22:37:45 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * thread_pthread.c (ping_signal_thread_list): remove return value.
- * thread_pthread.c (check_signal_thread_list): add a new function to
- check if signal thread list is empty.
- * thread_pthread.c (thread_timer): check signal thread list after
- timer_thread_function(). main thread might be added into signal thread
- list during timer_thread_function().
-
-Thu Dec 22 00:40:24 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * ext/bigdecimal/bigdecimal.c (VpMult, VpCtoV, VpSqrt): remove assigned
- but unused variables.
-
-Wed Dec 21 18:28:22 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * common.mk (newline.c, miniprelude.c): revert r33949 because the change
- broke mswin build, and the changer said no reason about the change.
- [ruby-dev:45016] [Bug #5783]
-
-Wed Dec 21 12:35:24 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/bigdecimal/bigdecimal.c (BigDecimal_s_allocate): follow
- Allocation Framework. [Bug #5775]
-
-Wed Dec 21 02:25:36 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/emitter.c: fixing clang warnings. Thanks Joey!
-
-Wed Dec 21 01:06:00 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * ext/bigdecimal/README: Update redmine.ruby-lang.org to bugs.ruby-lang.org
- * ext/socket/ancdata.c: ditto
- * test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb: ditto
- * test/syck/test_yaml.rb: ditto
- * doc/ChangeLog-1.9.3: ditto
-
-Tue Dec 20 23:50:12 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
-
- * PStore content update perf optimization. Patch by Masaki Matsushita.
- See #5248.
-
- * lib/pstore.rb (save_data):
-
- * Delete inadequate Marshal check.
-
- * Deferred file truncation: when writing the new content, truncate
- the saved file to the data size after writing the data, instead of
- truncating whole bytes before writing data.
-
- * Deferred MD5 calculation: when comparing MD5 hash to check the
- content modification, calculate MD5 hash of new data iif the
- content length is differ from the old one.
-
- * Compare content size with String#bytesize instead of String#size.
-
-Tue Dec 20 21:00:30 2011 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_core.c: uses to_integer instead.
- * test/date/test_switch_hitter.rb: added a test.
-
-Tue Dec 20 15:04:18 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
-
- * Make sure to clear $! when ignoring an exception
-
- * ext/openssl/ossl.c (ossl_pem_passwd_cb0, ossl_verify_cb):
- pem_passwd_cb and verify_cb ignores the exception raised in a
- callback proc so it should clear $! for subsequent execution.
-
- That's said, both subsequent processes for pem_passwd_cb and
- verify_cb raises another exception before leaking $! to Ruby world.
- We cannot test this fix in Ruby land.
-
- * test/openssl/test_pkey_rsa.rb
- (test_read_private_key_pem_pw_exception): Test for pem_passwd_cb +
- exception.
-
-Tue Dec 20 11:49:13 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/date/test_date_base.rb (test_jd): tests for
- [ruby-dev:45008].
-
-Tue Dec 20 10:20:48 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/date/date_core.c (wholenum): fix the type of the return value.
-
-Tue Dec 20 05:03:24 2011 Eric Hodel <drbrain@segment7.net>
-
- * README.ja: Update redmine.ruby-lang.org to bugs.ruby-lang.org
- * README: ditto
- * common.mk: ditto
- * man/erb.1: ditto
- * man/irb.1: ditto
- * man/ri.1: ditto
- * man/ruby.1: ditto
- * sparc.c: ditto
- * tool/install-sh: ditto
-
-Tue Dec 20 02:15:18 2011 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_core.c: [ruby-dev:45008].
-
-Sun Dec 18 18:52:37 2011 Naohisa Goto <ngotogenome@gmail.com>
-
- * vm.c (vm_define_method): improve guard of iseq from GC. Fix
- failure or segmentation fault in test_singleton_method(TestGc)
- on sparc Solaris10 compiled with Oracle Solaris Studio 12.2.
- [Bug #5762] [ruby-dev:45000] [Bug #4178]
-
-Sun Dec 18 14:34:31 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/bigdecimal/bigdecimal.c (Init_bigdecimal): does not follow
- allocation framework right now. [ruby-core:41710] [Bug #5773]
-
-Sun Dec 18 12:42:48 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/to_ruby.rb: BigDecimals can be restored
- from YAML.
- * ext/psych/lib/psych/visitors/yaml_tree.rb: BigDecimals can be dumped
- to YAML.
- * test/psych/test_numeric.rb: tests for BigDecimal serialization
-
-Sun Dec 18 12:03:13 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/scalar_scanner.rb: Strings that look like dates
- should be treated as strings and not dates.
-
- * test/psych/test_scalar_scanner.rb: corresponding tests.
-
-Sun Dec 18 09:43:21 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * test/thread/test_queue.rb (test_thr_kill): extend timeout.
- this test takes a long time at slow machine.
-
-Sun Dec 18 09:36:51 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * test/ruby/envutil.rb (invoke_ruby): remove :timeout option before
- pass it to Kernel#spawn.
-
-Fri Dec 16 17:18:38 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * README, README.ja: 'make check' is preferable to 'make test'.
-
-Thu Dec 15 23:16:13 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * error.c (builtin_type_name): don't return pointer to the buffer of
- temporary String object.
-
-Thu Dec 15 17:56:58 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (argf_type): make typed data.
-
-Thu Dec 15 17:40:28 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * error.c (rb_check_type): fix typo.
-
-Thu Dec 15 14:48:35 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/strscan/strscan.c: use typed data with
- onig_region_memsize().
-
-Thu Dec 15 14:33:33 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * error.c (rb_check_typeddata): refine error message with
- including expected struct name.
-
-Thu Dec 15 13:15:51 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * regcomp.c (onig_region_memsize): implemented for memsize_of().
-
- * ext/objspace/objspace.c (memsize_of): use it.
-
-Thu Dec 15 10:44:54 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * array.c (rb_ary_reject_bang, rb_ary_delete_if): update rdoc.
- documentation from Thomas Leitner <t_leitner AT gmx.at> in
- [ruby-core:41616]. [Bug #5752]
-
-Thu Dec 15 10:10:43 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/ruby/test_require.rb (test_race_exception): get rid of
- not-guaranteed timing issue. [ruby-core:41655] [Bug #5754]
-
-Wed Dec 14 21:58:42 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_io_m17n.rb
- (TestIO_M17N#test_{read_with_binmode_and_get[cs]}): only for Windows.
-
-Wed Dec 14 19:57:23 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * common.mk,Makefile.in,win32/Makefile.sub (ECHO1): move platform
- specific hack from common.mk to Makefile.in (and win32/Makefile.sub).
- [Bug #5711]
-
- * lib/mkmf.rb: we can generate Makefile as we like.
-
-Wed Dec 14 19:22:33 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c, include/ruby/win32.h (rb_w32_fd_is_text): new function.
-
- * win32/win32.c (init_stdhandle): set default mode of stdin as binmode.
-
- * io.c (set_binary_mode_with_seek_cur): new function to replace
- SET_BINARY_MODE_WITH_SEEK_CUR macro. now returns previous mode of the
- fd and take care of LF in rbuf.
-
- * io.c (do_writeconv): set text mode when needed.
-
- * io.c (io_read): need to change the mode of the IO to binmode
- temporally when the length for IO#read, because IO#read with length
- must behave so.
-
- * test/ruby/test_io_m17n.rb (TestIO_M17N#test_{read_with_length,
- read_with_length_binmode,get[cs]_and_read_with_binmode,
- read_with_binmode_and_get[cs],read_write_with_binmode}): tests for
- above changes.
-
- all patches are written by Hiroshi Shirosaki. [ruby-core:41496]
- [Feature #5714]
-
-Wed Dec 14 15:28:31 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * transcode.c (str_encode): about the extension of :fallback
- option since 1.9.3.
-
-Wed Dec 14 12:19:59 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * load.c (load_unlock): release loading barrier and then remove it
- from loading_table if it is not in-use. [Bug #5754]
-
- * thread.c (rb_barrier_release, rb_barrier_destroy): return
- whether any other threads are waiting on it.
-
-Wed Dec 14 11:23:45 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * thread_pthread.c (ubf_select): call rb_thread_wakeup_timer_thread()
- only when it is not timer_thread. [Bug #5757] [ruby-dev:44985]
- patched by Tomoyuki Chikanaga.
-
-Wed Dec 14 10:20:08 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * load.c (load_lock): delete the loading barrier if it has been
- destroyed.
-
- * thread.c (rb_barrier_wait): return nil for recursive lock
- instead of false, to distinguish it from destroyed barrier.
-
-Wed Dec 14 01:24:55 2011 okkez <okkez000@gmail.com>
-
- * thread_pthread.c (rb_thread_create_timer_thread): fix memory
- leak. [ruby-dev:44904] [Bug #5688]
-
-Wed Dec 14 00:01:15 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (primary): point method name line. [ruby-core:40936]
- [Bug #5614]
-
-Tue Dec 13 23:43:48 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * error.c (name_err_mesg_to_str): clear rb_thread_t::errinfo when
- ignore exception under rb_protect(). [ruby-core:41612] [Bug #5755]
-
- * test/ruby/test_exception.rb (test_exception_in_name_error_to_str):
- add a corresponding test.
-
-Tue Dec 13 16:13:29 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * load.c (load_unlock): all threads requiring one file should
- share same loading barrier, so it must be kept alive while those
- are waiting on it. [ruby-core:41618] [Bug #5754]
-
-Tue Dec 13 07:30:14 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * lib/webrick/httpresponse.rb (setup_header): 1xx responses
- are allowed to have Keep-Alive connections.
-
- * test/webrick/test_httpresponse.rb: corresponding test.
-
-Tue Dec 13 07:13:28 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * lib/webrick/httpresponse.rb (setup_header): 204 and 304 responses
- are allowed to have a Keep-Alive connection. [ruby-core:41581]
-
- * test/webrick/test_httpresponse.rb: corresponding test.
-
-Tue Dec 13 06:29:39 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parser_magic_comment): should pass the proper value.
- [ruby-dev:44984][Bug #5753]
-
-Tue Dec 13 05:50:07 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_insnhelper.c (vm_yield_setup_block_args): splat single
- argument if optional arguments are defined not only mandatory or
- post arguments. [ruby-core:41557] [Bug #5730]
-
-Mon Dec 12 22:35:39 2011 Shugo Maeda <shugo@ruby-lang.org>
-
- * parse.y (stmt_or_begin): changed the error message for BEGIN not
- at toplevel. [ruby-dev:44963] [Bug #5738]
-
-Mon Dec 12 17:29:01 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * README: Fixed SupportedPlatforms URL in the README.
- patched by eMxyzptlk. https://github.com/ruby/ruby/pull/62
-
-Mon Dec 12 17:26:51 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * load.c (rb_feature_p): lazy assigned load_path searched in
- loading_table were not expanded, but all features, pushed to
- loading table, are expanded. a patch by Yura Sokolov
- <funny.falcon AT gmail.com> in [ruby-core:41545]. [Bug #5727]
-
-Mon Dec 12 15:41:03 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/stringio/stringio.c (strio_truncate): fix typo. patched by
- Nick Howard <ndh AT baroquebobcat.com>.
- https://github.com/ruby/ruby/pull/65
-
-Sun Dec 11 12:19:17 2011 Shugo Maeda <shugo@ruby-lang.org>
-
- * lib/net/imap.rb: includes the sequence number of UID in a error
- message. suggested by art lussos.
- [ruby-core:41413] [Feature #5692]
-
-Sun Dec 11 11:42:10 2011 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * ext/syslog/syslog.c: fix a typo. [ruby-core:41585] [Bug #5740]
-
-Sun Dec 11 10:48:16 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * error.c (exit_initialize): deal with true and false as well as
- Kernel#exit. [ruby-dev:44951] [Bug #5728]
-
-Sun Dec 11 10:37:47 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * object.c (rb_check_to_int): new function to convert a VALUE to
- an Integer if possible, but returns nil instead of raising an
- exception otherwise.
-
-Sun Dec 11 10:34:39 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * process.c (rb_exit_status_code): extract from rb_f_exit_bang and
- rb_f_exit. assume 0 to be success in Kernel#exit! too.
-
-Fri Dec 9 19:24:31 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * enc/trans/iso-8859-16-tbl.rb: add ISO-8859-16 converter.
-
- * enc/trans/single_byte.trans: ditto.
-
-Fri Dec 9 14:28:40 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * file.c (file_path_convert): don't convert it when the path string is
- ascii only. [ruby-core:41556] [Bug #5733]
- tests are contributed by nobu.
-
-Fri Dec 9 08:00:15 2011 Luis Lavena <luislavena@gmail.com>
-
- * include/ruby/win32.h: undef stat to silence mingw-w64 stat
- redefinition warnings (GCC 4.6.3).
-
-Thu Dec 8 23:38:24 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * variable.c (set_const_visibility): clear inline-cache when constant's
- visibility is modified. [ruby-dev:44929]
-
- * test/ruby/test_module.rb (test_private_constants_clear_inlinecache):
- add test for it.
-
-Thu Dec 8 23:26:11 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/extmk.rb (extract_makefile): should sort after map, not before
- it. in this case there is no difference, but we should write better
- code. this bad smell was caught by nagachika.
-
-Thu Dec 8 22:31:13 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/extmk.rb (extract_makefile): need to sort the array of current
- srcs before comparing to the sorted old srcs.
- fixed the problem that the configuring stage of exts were always
- run, introduced at r33801.
-
-Thu Dec 8 13:26:24 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/rexml/test_order.rb (OrderTester#test_more_ordering): use
- Zlib::GzipReader.open instead of Zlib::GzipReader.new with File.new.
- fixed a test error on Windows introduced at r33946.
-
-Thu Dec 8 13:11:26 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_process.rb (TestProcess#test_sete[gu]id): silently
- skip if not implemented such functions (such as, on Windows).
- fixed test errors on Windows introduced at r33953.
-
-Thu Dec 8 12:57:50 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/socket/extconf.rb: forgotten to define HAVE_SOCKETPAIR for
- windows.
- fixed test errors on Windows introduced at r33947.
-
-Thu Dec 8 12:11:06 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (RUBY_WERROR_FLAG): append all warning flags which
- are enabled to compile, so that printf format modifiers properly
- fail. [ruby-core:41351] [Bug #5679]
-
-Thu Dec 8 07:20:15 2011 Eric Hodel <drbrain@segment7.net>
-
- * doc/re.rdoc: Document difference between match and =~, options with
- Regexp.new and global variables. Patch by Sylvain Daubert.
- [Ruby 1.9 - Bug #5709]
-
-Thu Dec 8 06:53:10 2011 Eric Hodel <drbrain@segment7.net>
-
- * doc/re.rdoc: Fix example code to match documentation. Patch by
- Jarno Lamberg. [Ruby 1.9 - Bug #5624]
-
-Wed Dec 7 19:04:22 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (rpath): fix typo in the help string. a patch from
- Yuji Yamano <yyamano AT kt.rim.or.jp> in [ruby-list:48568].
-
-Wed Dec 7 18:55:56 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm.c (vm_set_top_stack, vm_set_eval_stack): check for stack
- overflow with stack_max before push new frame. [ruby-core:41520]
- [Bug #5720]
-
- * vm.c (vm_set_main_stack): no stack overflow chances after
- vm_set_eval_stack().
-
-Wed Dec 7 09:58:15 2011 Eric Hodel <drbrain@segment7.net>
-
- * ext/bigdecimal/bigdecimal.c: Document +@, -@, hash, INFINITY, Nan.
- Patch by Sylvain Daubert. [Ruby 1.9 - Feature #5622]
-
-Wed Dec 7 09:48:00 2011 Eric Hodel <drbrain@segment7.net>
-
- * io.c (Init_IO): Mention io/console methods. [Ruby 1.9 - Bug #5602]
- * ext/io/console/console.c: Mention that io/console must be required
- similar to lib/time.rb
-
-Wed Dec 7 08:04:31 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych.rb (module Psych): parse and load methods take
- an optional file name that is used when raising Psych::SyntaxError
- exceptions
- * ext/psych/lib/psych/syntax_error.rb (module Psych): allow nil file
- names and handle nil file names in the exception message
- * test/psych/test_exception.rb (module Psych): Tests for changes.
-
-Tue Dec 6 18:26:33 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/dbm.c: use db_version() instead of DB_VERSION_STRING to
- detect runtime Berkeley DB version.
- use dpversion instead of _QDBM_VERSION to detect runtime QDBM
- version.
- [ruby-dev:44948]
-
-Tue Dec 6 12:30:41 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/extconf.rb: detect gdbm_version in libgdbm.
-
- * ext/dbm/dbm.c: make DBM::VERSION more informative for gdbm, qdbm and
- Berkeley DB 1.x. [ruby-dev:44944]
-
-Tue Dec 6 07:26:37 2011 Eric Hodel <drbrain@segment7.net>
-
- * range.c: Improve documentation for Range. Patch by Chris Zetter.
- [Ruby 1.9 - Bug #5656]
-
-Mon Dec 5 19:08:04 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * regparse.c (PFETCH_READY): separate gcc specific trick.
-
-Mon Dec 5 19:01:59 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * process.c (proc_seteuid_m): fix argument.
-
- * test/ruby/test_process.rb (test_geteuid): fix typo.
-
- * test/ruby/test_process.rb (test_getegid, test_set[eg]uid): add.
-
-Mon Dec 5 18:56:55 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * bignum.c (big_rshift), compile.c (validate_label,
- iseq_build_from_ary_exception), cont.c (cont_capture), dir.c
- (dir_open_dir), gc.c (objspace_each_objects), io.c (pipe_open)
- (rb_io_advise), parse.y (parser_compile_string)
- (rb_parser_compile_file), proc.c (binding_free), process.c
- (rb_proc_exec_n, rb_seteuid_core, proc_setegid, rb_setegid_core)
- (p_uid_exchange, p_gid_exchange), regparse.c (strdup_with_null),
- signal.c (sig_dfl), vm.c (rb_iseq_eval, rb_iseq_eval_main),
- vm_insnhelper.c (vm_expandarray): suppress
- unused-but-set-variable warnings.
-
- * class.c (rb_obj_methods), compile.c (iseq_compile_each),
- iseq.c(iseq_load, rb_iseq_parameters), pack.c (pack_pack),
- regcomp.c (is_not_included, update_string_node_case_fold),
- transcode.c (rb_econv_open0, make_replacement),
- vm_eval.c (raise_method_missing): remove unused variable.
-
- * signal.c (reserved_signal_p): static.
-
-Mon Dec 5 14:27:23 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * include/ruby/{subst.h,win32.h}, ext/socket/rubysocket.h: revert
- r33876. [ruby-core:41475] [Bug #5706]
-
- * ext/socket/extconf.rb: the alternative hack for [Bug #5675].
-
-Mon Dec 5 10:18:45 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/zlib/zlib.c (rb_gzreader_initialize): revert a part of r33937.
- 1st, to change the mode of an IO is very sensitive problem, so
- the maintainer of this library should judge it.
- 2nd, usually Zlib::GzipReader.new is not called directly. #initialize
- is called via .open, and in the method the I/O is opened in binary
- mode, so there is no problem without changing the mode in #initialize.
-
-Sun Dec 4 22:53:12 2011 Tanaka Akira <akr@fsij.org>
-
- * lib/tempfile.rb: don't use lock directory. [ruby-dev:39197]
-
-Sun Dec 4 22:34:43 2011 Tanaka Akira <akr@fsij.org>
-
- * lib/tempfile.rb (Tempfile::MAX_TRY): remove unused constant.
-
-Sun Dec 4 12:11:28 2011 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * lib/pp.rb: fix rdoc.
-
-Sun Dec 4 12:03:16 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/delegate.rb (Delegator#methods): Kernel#methods receives
- zero or one argument. [ruby-core:37118] [Bug #4882]
-
-Sun Dec 4 10:15:00 2011 Luis Lavena <luislavena@gmail.com>
-
- * ext/zlib/zlib.c (rb_gzreader_initialize): use binary mode by default
- under Windows. Patch by Hiroshi Shirosaki. [ruby-core:40706]
- [Feature #5562]
-
- * include/ruby/encoding.h (void rb_econv_binmode): define NEWLINE
- decorator.
-
- * io.c (rb_cloexec_fcntl_dupfd): Introduce NEED_READCONV and
- NEED_WRITECONV to replace universal newline decorator by CRLF only
- when required to improve file reading and writing under Windows.
- Patch by Hiroshi Shirosaki. [ruby-core:40706] [Feature #5562]
- * io.c (do_writeconv): adjust binary mode if required.
- * io.c (read_all, appendline, swallow, rb_io_getline_1): ditto.
- * io.c (io_getc, rb_io_each_codepoint, rb_io_ungetc): ditto.
- * io.c (rb_io_binmode, rb_io_ascii8bit_binmode): ditto.
- * io.c (rb_io_extract_modeenc, rb_sysopen): ditto.
- * io.c (pipe_open, prep_stdio, io_encoding_set): ditto.
- * io.c (rb_io_s_pipe, copy_stream_body): ditto.
-
- * test/ruby/test_io_m17n.rb (EOT): add test for pipe and stdin in
- binary mode.
-
- * win32/win32.c (init_stdhandle): remove O_BINARY from stdhandle
- initialization.
- * win32/win32.c (rb_w32_write): use FTEXT mode accordingly.
-
-Sat Dec 3 20:49:16 2011 Yusuke Endoh <mame@tsg.ne.jp>
-
- * variable.c (set_const_visibility): print a warning when no argument
- is passwd to Module#private_constant. [ruby-list:48558]
-
- * vm_method.c (set_method_visibility): ditto for
- Module#private_class_method.
-
-Sat Dec 3 20:43:14 2011 Yusuke Endoh <mame@tsg.ne.jp>
-
- * variable.c (set_const_visibility): Module#private_constant has
- changed the visibility of only the first argument. Now it changes
- all of them. [ruby-list:48558]
-
- * test/ruby/test_module.rb: add a test for above.
-
-Sat Dec 3 07:17:29 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * Makefile.in (CFLAGS): append ARCH_FLAG.
-
- * configure.in (ARCH_FLAG): exclude from CFLAGS.
-
- * configure.in (UNIVERSAL_INTS): include short int. fix for
- test/mkmf.
-
-Fri Dec 2 15:48:08 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/bigdecimal/bigdecimal.c (VpAllocReal): reduce extra frac.
-
-Fri Dec 2 15:41:24 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in: check whether -pie or -Wl,-pie is valid as
- LDFLAGS. [ruby-core:41438] [Bug#5697]
-
- * configure.in: use $linker_flag for LDFLAGS option which is not
- limited to particular platforms.
-
-Thu Dec 1 23:21:58 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * thread_pthread.c (thread_timer): call prctl(PR_SET_NAME) only if
- PR_SET_NAME is available.
-
-Thu Dec 1 22:31:16 2011 Tanaka Akira <akr@fsij.org>
-
- * io.c (linux_get_maxfd): change local variable name.
-
-Thu Dec 1 16:59:24 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/socket/extconf.rb: add arguments for macro calls.
- [ruby-core:41370] [Bug#5681]
-
-Thu Dec 1 16:20:16 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (MakeMakefile#try_func): fix broken patch at r33834.
-
-Thu Dec 1 14:43:17 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/bigdecimal/bigdecimal.h (Real): suppress false warning from
- clang. [ruby-core:41418] [Bug#5693]
-
-Thu Dec 1 10:31:55 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (LDFLAGS): -fstack-protector is always needed to
- link static library created with it. [ruby-core:41387]
- [Bug#5686]
-
-Thu Dec 1 07:03:51 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: add sys/prctl.h test.
- * thread_pthread.c (thread_timer): call prctl(PR_SET_NAME) to change
- thread name. It may help to debug.
-
-Wed Nov 30 23:35:45 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * variable.c (rb_path2class): don't raise NameError when the middle
- constant of the path is not defined but defined on toplevel.
- [ruby-core:41410] [Bug #5691]
-
-Wed Nov 30 20:02:02 2011 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * transcode.c: Simplified rb_econv_binmode, avoided a warning on cygwin.
-
-Wed Nov 30 08:57:07 2011 Eric Hodel <drbrain@segment7.net>
-
- * lib/mkmf.rb: Use MakeMakefile's rm_f to avoid conflict with Rake or
- FileUtils.
- * test/ruby/test_module.rb: Hide MakeMakefile's inclusion in Object
-
-Wed Nov 30 09:12:43 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * lib/rdoc/encoding.rb (RDoc::Encoding.read_file): fixup newline chars
- on Windows.
- see https://github.com/rdoc/rdoc/issues/87
-
- * test/rdoc/test_rdoc_markup_pre_process.rb
- (TestRDocMarkupPreProcess#test_include_file,
- TestRDocMarkupPreProcess#test_include_file_encoding_incompatible):
- follow above change.
-
-Wed Nov 30 09:09:37 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/parser.c (parse): parse method can take an option file
- name for use in exception messages.
- * test/psych/test_parser.rb: corresponding tests.
-
-Tue Nov 29 09:07:59 2011 Eric Hodel <drbrain@segment7.net>
-
- * lib/mkmf.rb: Fix indentations of constants at end of module.
- Document some constants.
-
-Tue Nov 29 09:58:23 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (rb_write_error2): suppress unused variable warning.
-
-Tue Nov 29 07:45:26 2011 Eric Hodel <drbrain@segment7.net>
-
- * lib/mkmf.rb: Wrap comments to 78 columns and clean up formatting.
-
-Tue Nov 29 05:54:18 2011 Eric Hodel <drbrain@segment7.net>
-
- * lib/mkmf.rb: Wrap mkmf.rb in module MakeMakefile to clean up Object
- documentation. [Ruby 1.9 - Feature #5658]
- * ext/extmk.rb: Use MakeMakefile::CONFIG instead of Object::CONFIG
- * test/mkmf/base.rb: ditto
-
-Tue Nov 29 00:08:57 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
-
- * common.mk (INSTRUBY_ARGS): added --mantype to apply mdoc2man.rb
- to man pages. Fixes #5598.
- (do-install-nodoc, do-install-local, do-install-man,
- dont-install-nodoc, dont-install-local, dont-install-man):
- No longer needs --mantype.
-
- Reported by Rainer Orth <ro AT cebitec.uni-bielefeld.de>,
- patch by George Koehler <xkernigh AT netscape.net>.
-
-Mon Nov 28 22:26:31 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/rake/test_rake_directory_task.rb
- (TestRakeDirectoryTask#test_directory_win32): shouldn't create any
- file/directory on root directory. create on @tempdir (= Dir.pwd).
- see https://github.com/jimweirich/rake/issues/91
-
-Mon Nov 28 12:57:29 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (rb_write_error2): fwrite() returns ssize_t.
-
-Mon Nov 28 12:47:19 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * parse.y (nodetype, nodeline): static. these functions are for
- debugging, and not intend to be public.
-
-Mon Nov 28 12:37:54 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * gc.c (initial_params): static. it seems to be forgotten at r33501.
-
-Mon Nov 28 12:32:24 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * include/ruby/win32.h, win32/win32.c (GetCurrentThreadHandle): remove
- unused old API.
-
-Mon Nov 28 12:29:20 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/mkexports.rb (Exports#initialize): remove old symbol name.
-
-Mon Nov 28 12:15:28 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/mkexports.rb (Exports#read_substitution): need to read
- from subst.h too. [Bug #5675]
-
-Mon Nov 28 11:46:35 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * io.c (rb_io_flush): release GVL during fsync() on Windows.
-
-Mon Nov 28 11:00:25 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * include/ruby/subst.h: typo of r33876.
-
-Mon Nov 28 10:36:00 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/subst.h: moved Windows specific substitutions from
- win32.h.
-
- * ext/socket/rubysocket.h: include ruby/subst.h. [Bug #5675]
-
-Mon Nov 28 10:20:58 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/{Makeilfe.sub,win32.c} (FILE_COUNT, FILE_READPTR): move the
- definitions from config.h to win32.c. I dared to have left such
- macros, for other future compiler support.
- [ruby-core:41313] [Bug #5674]
-
-Mon Nov 28 09:28:30 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (rb_w32_uchmod): typo. [Bug#5671] [ruby-dev:44898]
-
- * test/ruby/test_file.rb (TestFile#test_chmod_m17n): test of above bug.
-
-Sun Nov 27 21:25:33 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: added -fno-strict-overflow. it suppress annoying
- -Wstrict-overflow warning.
-
-Sun Nov 27 20:58:02 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * io.c (rb_write_error2): get rid of warning on linux. fwrite
- of glibc is tagged __attribute__ ((__warn_unused_result__))
- if _FORTIFY_SOURCE != 0.
- * vm_dump.c (rb_vm_bugreport): ditto.
-
-Sun Nov 27 19:09:02 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (stack_protector): disable on mingw. [Bug#5676]
-
- * Makefile.in (DLDFLAGS): also needs -fstack-protector.
- [Bug#5676]
-
-Sun Nov 27 14:13:33 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: add -fstack-protector into XLDFLAGS as well as
- XCFLAGS if stack-protector is used.
-
-Sun Nov 27 13:09:25 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: workaround to avoid MacOS X build error.
- Maybe autoconf 2.61 is slightly buggy. [ruby-core:41316]
-
-Sun Nov 27 04:57:11 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * configure.in (--no-undefined): r33840 breaks FreeBSD and DragonFly
- with gcc 4.4 or later. Their environ is in /usr/libexec/ld-elf.so.1,
- so it will be false negative.
-
-Sun Nov 27 04:55:45 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/net/http.rb (Net::HTTP::SSL_IVNAMES): rerefix 33701.
- SSL_ATTRIBUTES stores names for set_params, they are symbol.
- SSL_IVNAMES stores instance variable names.
-
-Sun Nov 27 00:16:07 2011 Tanaka Akira <akr@fsij.org>
-
- * io.c (copy_stream_body): use 0666 for permission argument for open.
- [ruby-core:40865]
-
-Sat Nov 26 23:01:38 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * test/openssl/test_engine.rb: remove side effect of generic engine
- load by explicitly loading software-based "openssl" engine for
- all tests.
-
-Sat Nov 26 20:41:48 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/net/http.rb (Net::HTTP.get_response): enable use_ssl
- if given URI object is https.
- patched by Mark Ferlatte [ruby-core:40665] [Bug #5545]
-
- * lib/net/http.rb (Net::HTTP.post_form): ditto.
-
-Sat Nov 26 20:01:18 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/net/http.rb (Net::HTTP::SSL_ATTRIBUTES): refix 33701.
- store instance variable symbol names.
-
-Sat Nov 26 15:40:25 2011 URABE Shyouhei <shyouhei@ruby-lang.org>
-
- * .travis.yml (script): should be ./configure
-
-Sat Nov 26 15:39:18 2011 URABE Shyouhei <shyouhei@ruby-lang.org>
-
- * .travis.yml (before_script): wrong name, sorry.
-
-Sat Nov 26 15:31:34 2011 URABE Shyouhei <shyouhei@ruby-lang.org>
-
- * .travis.yml (before-script): autoconf required.
-
-Sat Nov 26 15:24:05 2011 URABE Shyouhei <shyouhei@ruby-lang.org>
-
- * .travis.yml: Travis enable.
-
-Sat Nov 26 10:47:50 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * ext/openssl/extconf.rb: remove checks for available functions.
- * ext/openssl/missing.h: ditto.
- Thanks, Tim Mooney for reporting this!
- [Bug #5432] [ruby-core:40088]
-
-Sat Nov 26 10:22:28 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * ext/openssl/ossl_ssl.c: add comment on where to find implementation
- of OpenSSL::SSL::SSLSocket#session.
-
-Sat Nov 26 05:00:25 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (--no-undefined): RUBY_TRY_CFLAGS does nothing for
- linker flags. use RUBY_TRY_LDFLAGS.
-
-Fri Nov 25 11:37:07 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * io.c (ioctl_narg_len, linux_iocparm_len): reinstantiate linux
- specific narg length calculation.
- * test/ruby/test_io.rb (test_ioctl_linux2): add new test for old and
- unstructured ioctl.
-
-Fri Nov 25 10:39:14 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * Makefile.in (EXTLDFLAGS): export it.
- * configure.in: add --no-undefined if --enable-shared is specified.
- Gentoo enabled this option long time. Also, export EXTLDFALGS.
-
-Fri Nov 25 08:48:35 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: turn on PIE if --enable-shared is not specified.
-
-Fri Nov 25 08:05:07 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: add -fstack-protector. It help to protect us from
- stack smashing attack.
-
-Fri Nov 25 08:03:28 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: add -D_FORTIFY_SOURCE=2. It provide some compile
- time and runtime check for security.
-
-Fri Nov 25 08:00:23 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * lib/mkmf.rb: get rid of warnings of mkmf.rb if -Wmissing-declarations
- and/or -Wold-style-definition warnings if specified.
- Patch by Nikolai Weibull. Thank you! [Bug #5459] [ruby-core:40200]
-
-Fri Nov 25 07:46:09 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: add -Wall always.
-
-Thu Nov 24 20:02:40 2011 Tanaka Akira <akr@fsij.org>
-
- * test/openssl/test_engine.rb: use IO#reopen to restore stderr.
-
-Thu Nov 24 19:59:56 2011 Tanaka Akira <akr@fsij.org>
-
- * io.c (rb_io_reopen): re-initialize buffering mode for stdout and
- stderr.
-
-Thu Nov 24 11:12:48 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * io.c (rb_io_fsync,rb_io_fdatasync): release GVL during fsync().
- fsync() and fdatasync() may take a long time on slow disks and/or
- if there is much dirty data.
- Patch by Eric Wong. [Feature #5665] [ruby-core:41247]
-
-Thu Nov 24 10:05:02 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * test/openssl/test_engine.rb: Suppress output from 'openssl'
- engine's RC4 cipher.
- [Bug #5633] [ruby-core:41026]
-
-Thu Nov 24 08:05:02 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * ext/openssl/ossl_pkey_dsa.c: remove redundant colon from error
- message.
- * ext/openssl/ossl_ssl.c: ditto.
- * ext/openssl/ossl_pkey_rsa: ditto.
- patched by Eric Hodel [Bug #5604] [ruby-core:40896]
-
-Wed Nov 23 20:03:43 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * io.c (ioctl_narg_len): don't use _IOC_SIZE macro on Linux.
- On Linux some constants for ioctl(2) doesn't include the size of
- its return value and 16bit value; for example FIONREAD 0x541B.
- Moreover the manual, ioctl_list(2), says "Note that the size
- bits are very unreliable: in lots of cases they are wrong,
- either because of buggy macros using sizeof(sizeof(struct)),
- or because of legacy values."
- So we shouldn't use it.
-
-Tue Nov 22 18:07:32 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (_pioinfo): need to declare _pioinfo() before using
- _osfhnd and other macros which uses _pioinfo() internally.
-
-Tue Nov 22 17:49:45 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (_pioinfo): make an inline function.
-
-Tue Nov 22 11:26:08 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
-Tue Nov 22 11:33:58 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/win32.c (dupfd): argument of _osfhnd and so on should not
- have side effect.
-
-Tue Nov 22 11:26:08 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * bignum.c (rb_big_divide): refix of r33536. Don't change behavior of Bignum#/.
- [ruby-core:40429] [Bug #5490]
-
-Tue Nov 22 10:46:57 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * numeric.c (ruby_float_step): improve floating point calculations.
- [ruby-core:35753] [Bug #4576]
-
- * numeric.c (ruby_float_step): correct the error of floating point
- numbers on the excluding case.
- patched by Masahiro Tanaka [ruby-core:39608]
-
- * numeric.c (ruby_float_step): use the end value when the current
- value is greater than or equal to the end value.
- patched by Akira Tanaka [ruby-core:39612]
-
-Tue Nov 22 06:59:21 2011 Tanaka Akira <akr@fsij.org>
-
- * test/ruby/test_io.rb (test_fcntl_dupfd): there is no known platform
- which don't have F_DUPFD. [ruby-dev:44874]
-
-Tue Nov 22 04:46:22 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych.rb: remove autoload from psych
- * ext/psych/lib/psych/json.rb: ditto
-
-Tue Nov 22 00:44:59 2011 Tanaka Akira <akr@fsij.org>
-
- * test/ruby/test_io.rb (test_fcntl_dupfd): the argument of F_DUPFD is
- minimum file descriptor.
-
-Tue Nov 22 00:25:17 2011 Tanaka Akira <akr@fsij.org>
-
- * io.c (linux_get_maxfd): get rid of a warning.
-
-Mon Nov 21 23:39:14 2011 Tanaka Akira <akr@fsij.org>
-
- * io.c (linux_get_maxfd): new function to find maximum fd on Linux.
- (rb_close_before_exec): use linux_get_maxfd.
-
-Mon Nov 21 06:16:24 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * cont.c (fiber_switch): ignore fiber context switch
- because destination fiber is same as current fiber.
- With out this, it may segv on FreeBSD 9.
- patched by Koichi Sasada.
-
-Sun Nov 20 23:22:42 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/extmk.rb (extract_makefile, extmake): regenerate makefiles
- if globbed source file list is changed.
-
- * lib/mkmf.rb (create_makefile): store ORIG_SRCS.
-
-Sun Nov 20 22:43:03 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * enc/unicode.c (PROPERTY_NAME_MAX_SIZE): +1.
- reported by Ken Takata. [ruby-dev:44894][Bug #5652]
-
-Sun Nov 20 11:01:28 2011 Tanaka Akira <akr@fsij.org>
-
- * lib/set.rb (SortedSet.setup): remove old_init after initialize
- method is redefined. The remove before redefinition makes the
- warning prevention fragile. [ruby-dev:44892]
-
-Sun Nov 20 04:01:45 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * Makefile.in (enc/unicode/name2ctype.h): remove duplicated
- ifdefs.
-
-Sat Nov 19 19:31:47 2011 Tanaka Akira <akr@fsij.org>
-
- * time.c (TIME_COPY_GMT): copy vtm.utc_offset and vtm.zone too.
- patch by Tomoyuki Chikanaga.
- [ruby-dev:44827] [Bug #5586]
-
-Sat Nov 19 16:36:57 2011 Tanaka Akira <akr@fsij.org>
-
- * test/net/http/test_http.rb: remove temporally files in ensure clause.
-
-Sat Nov 19 08:18:41 2011 Tanaka Akira <akr@fsij.org>
-
- * test/net/http/test_http.rb: remove temporally files.
-
-Fri Nov 18 17:18:16 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/io/console/console.c (console_raw, console_set_raw)
- (console_getch): optional parameters. [EXPERIMENTAL]
-
-Fri Nov 18 16:12:11 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/io/console/console.c (console_cooked, console_set_cooked):
- new methods to reset cooked mode. [EXPERIMENTAL]
-
-Fri Nov 18 13:20:26 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/unit/assertions.rb (MINI_DIR): quick dirty hack to get rid of
- warnings when using assert/assert_respond_to.
-
-Fri Nov 18 13:03:38 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * io.c (rb_cloexec_open): set O_NOINHERIT instead of O_CLOEXEC if it is
- available (for Windows).
-
- * win32/win32.c (fcntl): on F_DUPFD, determine the inheritance of the
- new handle by O_NOINHERIT flag of original fd.
-
-Fri Nov 18 08:00:41 2011 Ryan Davis <ryand-ruby@zenspider.com>
-
- * lib/minitest/*: Imported minitest 2.8.1 (r6750)
- * test/minitest/*: ditto
- * configure.in: Improved gcc-llvm error message to help people migrate.
-
-Thu Nov 17 20:43:34 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/extconf.rb: revert a part of the patch in [ruby-dev:41531].
- don't use db.h with other headers. [ruby-dev:44884].
-
-Thu Nov 17 20:23:03 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * benchmark/bm_io_select[23].rb: use Process::RLIMIT_NOFILE only when
- it is defined. if it is not defined, assume 64 as the max of fds.
-
-Thu Nov 17 10:36:46 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych.rb (load_file): make sure opened yaml files are
- also closed. [ruby-core:41088]
-
-Wed Nov 16 18:13:52 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * Makefile.in (LIBRUBY_A): check if generated linked library is
- valid for extconf.
-
-Wed Nov 16 13:51:40 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * bignum.c (rb_big2ulong): need to calc in unsigned long, because
- the range of VALUE is larger than it on LLP64 platform, such as Win64.
- this change fixes the failures of test/-ext-/num2int.
-
-Wed Nov 16 12:02:47 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/webrick/test_cgi.rb (TestWEBrickCGI#start_cgi_server): there are
- no guarantee of existence of RbConfig::CONFIG['LIBPATHENV'].
- it only exists in Unix-like environments.
-
- * test/webrick/test_filehandler.rb
- (WEBrick::TestFileHandler#test_script_disclosure): ditto.
-
-Wed Nov 16 11:34:20 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * io.c (argf_next_argv): wrong timing of setting ecflags.
- fixed the failure of TestArgf#test_textmode introduced at r33662.
-
-Wed Nov 16 10:45:00 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/-test-/num2int/num2int.c: remove an unnecessary and wrong decl
- of rb_stdout. it's declared in ruby.h correctly.
-
-Wed Nov 16 10:26:41 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * bignum.c (rb_big2ull): add a cast to get rid of a VC++ warning.
-
-Wed Nov 16 09:39:27 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/minitest/unit.rb (assert_raises): experimental fix to run
- correctly on chkbuild over 64bit linux. call exception_details only
- when the detail is really needed to avoid create needless inspect
- under ulimit-ed environment.
-
-Wed Nov 16 06:34:30 2011 Tanaka Akira <akr@fsij.org>
-
- * test/ruby/test_thread.rb (test_condvar_timed_wait): use
- assert_operator.
-
-Tue Nov 15 21:56:25 2011 Tanaka Akira <akr@fsij.org>
-
- * test/ruby/test_sleep.rb (test_sleep_5sec): 0.1sec tolerance is too
- small for busy environment.
-
-Tue Nov 15 20:08:55 2011 Tanaka Akira <akr@fsij.org>
-
- * io.c, thread.c, ext/pty/pty.c, ext/fiddle/closure.c: use
- __linux__ macro for consistency.
-
-Tue Nov 15 14:45:15 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * include/ruby/ruby.h(NUM2LONG, NUM2INT, NUM2SHORT, NUM2LL,
- INT2NUM, UINT2NUM, LONG2NUM, ULONG2NUM, NUM2CHR): wrap by
- macros.
-
-Tue Nov 15 13:38:14 2011 Naohisa Goto <ngotogenome@gmail.com>
-
- * include/ruby/defines.h (FLUSH_REGISTER_WINDOWS): move sparc asm code
- to a separate file sparc.c for preventing inlining optimization.
- Patched by Jurij Smakov. [Bug #5244] [ruby-core:40685]
- * sparc.c (rb_sparc_flush_register_windows): ditto.
- * configure.in: ditto.
-
-Tue Nov 15 13:11:35 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * include/ruby/ruby.h: get rid of gcc specific rb_long2int(),
- NUM2LONG(), NUM2INT(), NUM2SHORT(), NUM2LL(), INT2NUM(),
- UINT2NUM(), LONG2NUM(), ULONG2NUM() and NUM2CHR()
- implementation. Because 1) They don't make any better code
- at all. 2) Inline function have a better debugger supoort.
-
-Tue Nov 15 09:58:25 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/ruby/test_io.rb (TestIO#test_fcntl_dupfd): fix OpenBSD test
- failure. [ruby-dev:44872]
-
-Tue Nov 15 09:50:21 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * regcomp.c (print_indent_tree): fix double printing of ENCLOSE_OPTION
- children bug. patched by Suraj Kurapati. [ruby-core:40964]
-
-Tue Nov 15 01:53:48 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * test/ruby/test_io.rb (test_fcntl_dupfd): fix test error on
- SnowLeopard. Pointed out by CHIKANAGA Tomoyuki. [ruby-dev:44866]
-
-Mon Nov 14 22:06:02 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/openssl/ossl_pkey.c (ossl_pkey_new_from_file): set close-on-exec
- flag.
-
- * ext/openssl/ossl_x509cert.c (rb_fd_fix_cloexec): ditto.
-
-Mon Nov 14 14:54:17 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * bignum.c (rb_big2ull): fix 32bit platform breakage. we must
- not assume sizeof(VALUE) == sizeof(LONG_LONG).
- * test/-ext-/num2int/test_num2int.rb (class TestNum2int):
- fix false assumption on 32bit platform.
-
-Mon Nov 14 14:52:54 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * numeric.c (rb_fix2ushort): fix typo. use num rb_num2ushort()
- instead of num2uint().
-
-Sun Nov 13 10:31:03 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * include/ruby/ruby.h: add #ifdef comment.
-
-Sun Nov 13 10:28:18 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * include/ruby/ruby.h: add NUM2SHORT(), NUM2USHORT() macros.
- * numeric.c: ditto.
-
- * test/-ext-/num2int/test_num2int.rb: add testcases for NUM2SHORT().
- * ext/-test-/num2int/num2int.c: ditto.
-
-Sun Nov 13 10:23:48 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * bignum.c (rb_big2ull): fix off-by-twice bug of NUM2ULL.
- * test/-ext-/num2int/test_num2int.rb (class TestNum2int):
- fix a testcase too.
-
-Sun Nov 13 10:22:44 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/-ext-/num2int/test_num2int.rb (class TestNum2int):
- add FIXNUM tests.
-
-Sun Nov 13 09:57:29 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * numeric.c (check_uint): fix off-by-one bug of NUM2UINT.
- * bignum.c (rb_big2ulong): fix off-by-one bug of NUM2ULONG.
-
- * test/-ext-/num2int/test_num2int.rb: add a testcase for NUM2INT()
- NUM2UINT(), NUM2LONG(), NUM2ULONG(), NUM2LL and NUM2ULL().
- * ext/-test-/num2int/depend: ditto.
- * ext/-test-/num2int/extconf.rb: ditto.
- * ext/-test-/num2int/num2int.c: ditto.
-
-Sun Nov 13 23:47:29 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/dbm/extconf.rb: use convertible_int.
-
-Sun Nov 13 23:45:57 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (checking_for): should not modify the result.
-
- * lib/mkmf.rb (have_struct_member): accept compiler options.
-
- * lib/mkmf.rb (convertible_int): add restricted support of struct
- member, and TYPEOF_ macro.
-
-Sun Nov 13 23:21:24 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/gdbm/gdbm.c (fgdbm_reorganize): set close-on-exec flag after
- gdbm_reorganize(). gdbm_reorganize() opens a new database internally.
-
-Sun Nov 13 19:57:18 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/extconf.rb: rollback for each headers for each libraries.
-
-Sun Nov 13 16:24:48 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/extconf.rb: treat libc as a choice for a library which
- provide ndbm API.
-
-Sun Nov 13 15:40:43 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/extconf.rb: duplicate $libs and $defs when save them.
-
-Sun Nov 13 12:43:48 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/extconf.rb: rollback $libs and $defs when db detection is
- failed. It fixes -lgdbm -lqdbm when the system has qdbm and gdbm
- without gdbm_compat.
-
-Sat Nov 12 21:14:51 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/webrick/test_cgi.rb (class TestWEBrickCGI): respect
- RbConfig::CONFIG["LIBPATHENV"]. [Bug #5135] [ruby-core:38653]
- * test/webrick/test_filehandler.rb (class WEBrick): ditto.
-
-Sat Nov 12 20:57:29 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/ruby/test_io.rb (test_fcntl_dupfd): skip if Fcntl::DUPFD
- is not defined. Pointed out by CHIKANAGA Tomoyuki. Thanks.
-
-Sat Nov 12 17:26:10 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (do_ioctl, ioctl_narg_len, setup_narg, rb_ioctl): use
- ioctl_req_t.
-
-Sat Nov 12 17:01:49 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/dbm/extconf.rb (headers.db_check): reduce duplicated code.
-
-Sat Nov 12 15:59:42 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/extconf.rb: dbm_clearerr should be available in all ndbm
- implementation. If it is not available, it is caused by
- header/library mismatch such that Berkeley DB header & gdbm library.
-
- * ext/dbm/dbm.c (fdbm_store): use dbm_clearerr() unconditionally.
- gdbm 1.9 provides it as a real function instead of a empty macro.
-
-Sat Nov 12 13:35:33 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * bootstraptest/runner.rb: don't suppress SIGINT.
- [Feature #5612] [ruby-dev:44856]
-
-Sat Nov 12 11:20:36 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * io.c (fcntl_narg_len): introduce narg calculation for fcntl instead
- of hard coded 256.
- * io.c (setup_narg): ditto.
-
-Sat Nov 12 11:19:35 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/ruby/test_io.rb (test_fcntl_dupfd): add another fcntl test.
-
-Sat Nov 12 11:18:17 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/ruby/test_io.rb (test_fcntl_lock_freebsd): add a testcase
- of fcntl lock for freebsd.
-
-Sat Nov 12 11:16:32 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * io.c (ioctl_narg_len): Linux doesn't have IOCPARM_LEN macro, but
- has _IOC_SIZE. support it.
-
-Sat Nov 12 11:13:18 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * io.c (rb_ioctl): don't expose our sanity check value to ruby script.
- It may change string value meaning if the value is string.
- (e.g. MacOS X has F_GETPATH ioctl)
- * io.c (rb_fcntl): ditto.
-
-Sat Nov 12 11:06:02 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * io.c (ioctl_req_t): Type of req argument of ioctl() depend on platform.
- Moreover almost all linux ioctl can't be represented by 32bit integer
- (i.e. MSB is 1). We need wrap ioctl argument type.
- [Bug #5429] [ruby-dev:44589]
- * io.c (struct ioctl_arg): ditto.
- * io.c (rb_ioctl): ditto.
- * test/ruby/test_io.rb (test_ioctl_linux): add a testcase for ioctl
-
-Sat Nov 12 11:00:42 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * io.c (struct io_cntl_arg): remove io_p member.
- * io.c (nogvl_fcntl, do_fcntl, rb_fcntl): separated from ioctl functions.
- * io.c (nogvl_io_cntl): remove fcntl depended logic.
- * io.c (io_cntl): ditto.
- * io.c (rb_io_ctl): ditto.
- * io.c (rb_io_ioctl): ditto.
-
-Sat Nov 12 10:59:49 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * io.c (setup_narg): fix off by one bug.
-
-Sat Nov 12 10:56:43 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * io.c (+setup_narg): factor out length calculation logic.
- * io.c (rb_io_ctl): ditto.
-
-Sat Nov 12 10:52:17 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * io.c (+ioctl_narg_len) new helper function.
- * io.c (rb_io_ctl): don't use ioctl specific length check
- if caller is fcntl.
-
-Fri Nov 11 23:00:46 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/extconf.rb: db_prefix is not required now.
-
-Fri Nov 11 21:13:30 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/gdbm/gdbm.c (fgdbm_initialize): use GDBM_CLOEXEC if available.
-
-Fri Nov 11 21:00:05 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/extconf.rb: fix dbm_pagfno and dbm_dirfno detection with
- Berkeley DB. Macro definitions needs arguments to detect correctly.
- SIZEOF_DSIZE needs -DDB_DBM_HSEARCH because db.h defines datum type
- only if DB_DBM_HSEARCH is defined.
-
-Fri Nov 11 18:41:57 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * process.c (proc_seteuid): separate an internal wrapper function
- from the method implementation.
-
-Fri Nov 11 17:21:15 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (have_library, find_library, have_func): allow
- arguments of function to be checked.
-
-Fri Nov 11 17:09:45 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_dump.c (HAVE_BACKTRACE): fallback to 0.
-
- * vm_dump.c (rb_vm_bugreport): show "Other runtime information"
- header only when available.
-
- * vm_dump.c (rb_vm_bugreport): get rid of modifying the content of
- VM directly.
-
- * vm_dump.c (rb_vm_bugreport): check if vm is non-null.
- Pointed out by Ikegami Daisuke <ikegami.da@gmail.com>.
- Thank you.
-
-Fri Nov 11 12:36:37 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * io.c (pipe_open): Remove fflush(stdin). it's no effect.
- Pointed out by Ikegami Daisuke <ikegami.da@gmail.com>.
- Thank you.
-
-Fri Nov 11 07:33:30 2011 Eric Hodel <drbrain@segment7.net>
-
- * lib/net/http.rb (Net::HTTP::SSL_ATTRIBUTES): Use symbol keys instead
- of string keys to avoid duplicating parameters in
- OpenSSL::SSL:SSLContext#set_params.
-
-Thu Nov 10 15:02:37 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (have_library, have_func, have_var, have_header):
- add compiler option parameter.
-
-Thu Nov 10 07:45:16 2011 Eric Hodel <drbrain@segment7.net>
-
- * ext/openssl/lib/openssl/ssl.rb (class OpenSSL::SSL::SSLContext):
- Document #set_params.
-
-Wed Nov 9 11:36:53 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread_pthread.c (gvl_yield): don't prevent concurrent sched_yield().
- [Bug #5130] [ruby-core:38647]
-
-Wed Nov 9 23:20:22 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (rb_update_max_fd): fstat(2) can fail with other than
- EBADF. [ruby-dev:44837] [Bug #5593]. Cf.
- http://pubs.opengroup.org/onlinepubs/9699919799/functions/fstat.html
-
- * io.c (rb_sysopen): max fd is updated in rb_sysopen_internal()
- already.
-
-Wed Nov 9 22:13:38 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_file.rb (TestFile#test_utime_with_minus_time_segv):
- fixed previous commit.
-
-Wed Nov 9 19:53:45 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_file.rb (TestFile#test_utime_with_minus_time_segv):
- add test for r33685.
-
-Wed Nov 9 19:00:44 2011 Koichi Sasada <ko1@atdot.net>
-
- * test/ruby/test_fiber.rb: add tests for r33684 (Fiber#resume).
-
-Wed Nov 9 16:40:49 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (unixtime_to_filetime): should check the return value
- of localtime(). reported by snowjail at gmail.com.
- [ruby-dev:44838] [Bug #5596]
-
-Thu Nov 9 13:17:25 2011 Koichi Sasada <ko1@atdot.net>
-
- * cont.c (rb_fiber_m_transfer, rb_fiber_resume): prohibit using
- "resume" after "transfer" method are used. You should not mix
- "resume" fiber and "transfer" fiber.
- [Bug #5526]
-
- * NEWS: add information about this change.
-
-Wed Nov 9 11:40:37 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * template/Doxyfile.tmpl (INCLUDE_PATH): add srcdir and include.
- [ruby-core:40843] [Bug #5597]
-
-Wed Nov 9 11:02:54 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * thread.c (do_select): fix cast, tv_sec is time_t.
-
-Wed Nov 9 10:32:20 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in: should not use test -e for portability.
- [ruby-core:40841] [Bug #5594]
-
-Wed Nov 9 04:52:16 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/tree_builder.rb: dump complex numbers,
- rationals, etc with reference ids.
- * ext/psych/lib/psych/visitors/yaml_tree.rb: ditto
- * ext/psych/lib/psych/visitors/to_ruby.rb: loading complex numbers,
- rationals, etc with reference ids.
- * test/psych/test_object_references.rb: corresponding tests
-
-Tue Nov 8 23:34:37 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/dbm/dbm.c (fdbm_fetch, fdbm_key, fdbm_delete, fdbm_store)
- (fdbm_has_key, fdbm_has_value): get rid of overflow.
-
- * ext/gdbm/gdbm.c (rb_gdbm_fetch2, rb_gdbm_nextkey)
- (rb_gdbm_delete, fgdbm_store, fgdbm_has_key): ditto.
-
- * ext/dbm/dbm.c (fdbm_delete_if): hide intermediate objects.
-
- * ext/gdbm/gdbm.c (fgdbm_delete_if): ditto.
-
- * ext/dbm/extconf.rb: check size of datum.dsize to get rid of
- overflow.
-
-Tue Nov 8 23:30:21 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * addr2line.c (PATH_MAX): define if not defined. [ruby-core:40840]
-
-Tue Nov 8 23:26:49 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/tk/tcltklib.c (rb_thread_critical): fix type.
-
- * ext/tk/tcltklib.c (eventloop_sleep, lib_eventloop_core): int is
- enough for micro seconds. may need to check overflow in the
- setter though.
-
- * ext/tk/tcltklib.c (RSTRING_LENINT): check overflow if necessary.
-
- * ext/tk/tcltklib.c (RbTk_ALLOC_N): wrapper for ckalloc() which
- takes an int.
-
- * ext/tk/tcltklib.c (ip_ruby_cmd_receiver_get, tcltklib_compile_info):
- get rid overflow.
-
- * ext/tk/tcltklib.c (tcltklib_compile_info): constified.
-
-Tue Nov 8 20:50:45 2011 Tanaka Akira <akr@fsij.org>
-
- * test/dbm/test_dbm.rb: split tests for read only database.
-
- * test/gdbm/test_gdbm.rb: ditto.
-
-Tue Nov 8 18:59:07 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/pty/pty.c (MasterDevice): define only when used.
- (SlaveDevice): ditto.
- (deviceNo): ditto.
-
-Tue Nov 8 17:59:24 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/ruby.h (rb_long2int): define as a macro always, so
- that cpp conditionals can tell if it is provided.
-
-Tue Nov 8 17:30:50 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (cpp_command): remove multiple -arch flags since cpp
- cannot work.
-
-Tue Nov 8 14:50:55 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * io.c (io_fwrite): call rb_w32_write_console() only if FMODE_TTY is
- set. this is the one of the reason of IO writing slowness of Windows
- in 1.9.3 or later.
-
-Tue Nov 8 11:01:04 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/pty/pty.c (get_device_once): FreeBSD 8 supported O_CLOEXEC flag
- for posix_openpt, but FreeBSD 9's posix_openpt doesn't support
- O_CLOEXEC and fails if specified.
-
-Tue Nov 8 02:36:45 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * include/ruby/encoding.h (ECONV_NEWLINE_DECORATOR_READ_MASK,
- ECONV_NEWLINE_DECORATOR_WRITE_MASK): new macro.
-
- * io.c (rb_io_extract_modeenc, pipe_open, prep_stdio, argf_next_argv):
- set TEXTMODE_NEWLINE_DECORATOR_ON_WRITE for textmode on creating IO
- if the flag is available.
-
- * io.c (make_writeconv): drop decorators for reading.
-
- * io.c (make_readconv): drop decorators for writing.
-
- * io.c (do_writeconv): existing writeconv is not the condition to raise
- ArgumentError. should check textmode or not.
-
- * test/ruby/test_io_m17n.rb
- (TestIO_M17N#test_{cr,lf,crlf}_decorator_on_stdout): test above
- changes.
-
-Mon Nov 7 22:03:47 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/gdbm/gdbm.c (fgdbm_initialize): set close-on-exec flag.
-
-Mon Nov 7 20:31:52 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/scalar_scanner.rb: make sure strings that look
- like base 60 numbers are serialized as quoted strings.
- * test/psych/test_string.rb: test for change.
-
-Mon Nov 7 20:26:37 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * test/psych/test_yamlstore.rb: make test case inherit from MiniTest,
- load psych/helper so that psych is loaded.
-
-Mon Nov 7 20:18:29 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * test/psych/test_yamldbm.rb: Test case should inherit from MiniTest,
- load psych/helper so that psych and friends are loaded.
-
-Mon Nov 7 20:15:44 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/extconf.rb: check dbm_pagfno() and dbm_dirfno().
-
- * ext/dbm/dbm.c: use above to set close-on-exec flag.
-
-Mon Nov 7 20:05:16 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * io.c (io_fflush): remove fsync().
-
- * io.c (rb_io_flush, rb_io_rewind): fsync() here.
-
- these changes reduces fsync() calls to improve performance.
- first reported at [ruby-list:48515] by ak7 at mail.goo.ne.jp .
- [Bug #5585]
-
-Mon Nov 7 19:43:10 2011 Tanaka Akira <akr@fsij.org>
-
- * io.c (rb_close_before_exec): use F_MAXFD if available.
- F_MAXFD is available on NetBSD since NetBSD 2.0.
-
-Mon Nov 7 19:25:16 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_io_m17n.rb
- (TestIO_M17N#test_default_stdout_stderr_mode): new test for
- r33627-33629. see [backport #5565]
-
-Mon Nov 7 01:14:22 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * lib/debug.rb: add help for 'pp' and 'r[estart]'. patch
- from Sho Hashimoto. [Bug #5093] [ruby-dev:44222]
-
-Sun Nov 6 14:49:58 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/rubysocket.h (rsock_recvmsg): declared.
-
- * ext/socket/ancdata.c (rsock_recvmsg): extracted from
- nogvl_recvmsg_func.
- (nogvl_recvmsg_func): use rsock_recvmsg.
-
- * ext/socket/unixsocket.c (recvmsg_blocking): use rsock_recvmsg.
-
-Sun Nov 6 03:22:36 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * test/openssl/test_engine.rb: add test for engine cipher. RC4 is used
- because AES is not supported by the "openssl" engine currently.
-
-Sun Nov 6 00:11:52 2011 Tanaka Akira <akr@fsij.org>
-
- * lib/test/unit.rb (Test::Unit::Options#non_options): options[:ruby]
- should be an array. This fixes
- "./ruby test/runner.rb test/testunit/test_parallel.rb"
- [ruby-dev:44782]
-
-Sat Nov 5 20:30:30 2011 Martin Duerst <duerst@it.aoyama.ac.jp>
-
- * insns.def: Some fixes and tweaks to English explanations
-
-Sat Nov 5 19:11:50 2011 Tanaka Akira <akr@fsij.org>
-
- * io.c (rb_cloexec_fcntl_dupfd): don't clear try_dupfd_cloexec if
- fcntl(F_DUPFD) failed as fcntl(F_DUPFD_CLOEXEC).
-
-Sat Nov 5 18:05:12 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/socket.c (rsock_socketpair0): refactored.
-
-Sat Nov 5 17:55:52 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/init.c (rsock_socket0): don't clear try_sock_cloexec if
- SOCK_CLOEXEC is not a reason for EINVAL.
-
-Sat Nov 5 16:27:52 2011 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * ext/pathname/lib/pathname.rb, ext/tk/lib/multi-tk.rb,
- ext/tk/sample/demos-en/widget, lib/benchmark.rb, lib/irb/cmd/fork.rb,
- lib/mkmf.rb, lib/net/ftp.rb, lib/net/smtp.rb, lib/open3.rb,
- lib/pstore.rb, lib/rexml/element.rb, lib/rexml/light/node.rb,
- lib/rinda/tuplespace.rb, lib/rss/maker/base.rb,
- lib/rss/maker/entry.rb, lib/scanf.rb, lib/set.rb, lib/shell.rb,
- lib/shell/command-processor.rb, lib/shell/process-controller.rb,
- lib/shell/system-command.rb, lib/uri/common.rb: remove unused block
- arguments to avoid creating Proc objects.
-
-Sat Nov 5 15:45:04 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/init.c (rsock_socket0): extract single socket() call with
- CLOEXEC handling from rsock_socket.
-
-Sat Nov 5 13:49:40 2011 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * lib/pathname.rb (Pathname#find): return an enumerator if
- no block is given.
-
- * test/pathname/test_pathname.rb: add tests for above.
-
- [ruby-dev:44797] [Feature #5572]
-
-Sat Nov 5 11:18:12 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/socket.c (rsock_socketpair0): don't clear
- try_sock_cloexec if SOCK_CLOEXEC is not a reason for EINVAL.
-
-Fri Nov 4 14:08:19 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
-
- * ext/openssl/ossl_pkey_rsa.c (rsa_generate): [SECURITY] Set RSA
- exponent value correctly. Awful bug. This bug caused exponent of
- generated key to be always '1'. By default, and regardless of e
- given as a parameter.
-
- !!! Keys generated by this code (trunk after 2011-09-01) must be
- re-generated !!! (ruby_1_9_3 is safe)
-
- * test/openssl/test_pkey_rsa.rb: Add tests for default exponent and
- specifying exponent by a parameter.
-
-Fri Nov 4 01:31:25 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * test/openssl/test_engine.rb: add first tests for builtin "openssl"
- engine.
-
-Fri Nov 4 08:41:26 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * ext/openssl/extconf.rb:
- * ext/openssl/ossl_engine.c: add some missing OpenSSL engines.
- Thanks, Yui Naruse, for providing the patch!
- [Bug #5548] [ruby-core:40670]
-
-Fri Nov 4 04:54:10 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/configure.bat: disable delayed expansion of enironment variable.
- [Bug #5517] [ruby-core:40531]
-
-Fri Nov 4 03:45:22 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * io.c (make_writeconv): fixed typo of previous commit.
-
-Fri Nov 4 01:56:30 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * io.c (make_writeconv): unversal_newline converter is for reading.
- so, if the io is text mode and has ECONV_UNIVERSAL_NEWLINE_DECORATOR
- flag, use crlf_newline converter for writing.
- this change fixes the problem about the luck of CR up Kernel.p and
- Kernel.puts to stdout/stderr on Windows.
-
-Fri Nov 4 01:04:48 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/readline/readline.c (Init_readline): like r18313, libedit's
- replace_history_entry may use offset instead of which.
- so introduce history_replace_offset_func and initialize it.
-
- * ext/readline/readline.c (hist_set): use history_replace_offset_func.
-
-Fri Nov 4 00:53:35 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/readline/readline.c (Init_readline): fix wrong condition.
-
-Thu Nov 3 23:53:04 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * encoding.c (rb_locale_charmap): ignore calling nl_langinfo_codeset()
- on Windows except cygwin. [experimental]
-
-Thu Nov 3 22:45:09 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/socket.c (rsock_socketpair0): extracted from
- rsock_socketpair to set close-on-exec flag for each socketpair()
- call.
-
-Thu Nov 3 22:12:41 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * ext/socket/init.c (rsock_socket): set close-on-exec flag when
- SOCK_CLOEXEC is not available.
-
-Thu Nov 3 08:36:00 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * test/openssl/test_engine.rb: call Engine::cleanup on exit.
- Patch provided by Yui Naruse, thanks!
- [Bug #5547] [ruby-core:40669]
-
-Wed Nov 2 21:36:00 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * complex.c (nucomp_rationalize): fix function. [ruby-core:40667]
- [Bug #5546]
-
-Wed Nov 2 08:16:45 2011 Tanaka Akira <akr@fsij.org>
-
- * lib/webrick/utils.rb: fix fcntl call.
-
- * lib/drb/unix.rb: ditto.
-
-Wed Nov 2 00:43:59 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * test/psych/test_yamldbm.rb: avoid platform dependency.
- patch by Naohisa Goto. [ruby-dev:44763] [Bug #5535]
- * test/syck/test_yamldbm.rb: ditto.
-
-Wed Nov 2 00:14:15 2011 Shugo Maeda <shugo@ruby-lang.org>
-
- * test/ruby/test_marshal.rb: renamed methods duplicated with those
- of marshaltestlib.rb.
-
-Tue Nov 1 22:08:27 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in: reject llvm-gcc.
-
-Tue Nov 1 21:39:00 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * io.c (rb_cloexec_pipe): remove workaround of r33587.
- The bug of NetBSD is fixed on Mon Oct 31 21:31:29 UTC 2011.
- http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=45545
-
-Tue Nov 1 19:49:08 2011 Tanaka Akira <akr@fsij.org>
-
- * io.c (rb_io_reopen): call rb_fd_fix_cloexec instead of
- rb_maygvl_fd_fix_cloexec.
-
-Tue Nov 1 19:00:30 2011 Tanaka Akira <akr@fsij.org>
-
- * io.c (rb_io_reopen): call rb_maygvl_fd_fix_cloexec after freopen().
-
-Tue Nov 1 17:17:26 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * file.c (file_expand_path): reset coderange after expanding path.
-
-Tue Nov 1 14:55:29 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * io.c (nogvl_io_cntl): rb_cloexec_fcntl_dupfd's 2nd argument is int.
-
- * process.c (move_fds_to_avoid_crash): ditto.
-
-Tue Nov 1 13:14:33 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * vsnprintf.c (BSD_vfprintf): support 'll' prefix.
-
- * vsnprintf.c (__sfeof): rename to avoid the collision with NetBSD's
- one.
-
- * vsnprintf.c (__sferror): ditto.
-
- * vsnprintf.c (__sclearerr): ditto.
-
- * vsnprintf.c (__sfileno): ditto.
-
-Tue Nov 1 12:36:16 2011 Tanaka Akira <akr@fsij.org>
-
- * internal.h (rb_maygvl_fd_fix_cloexec): change the visibility for
- ext/socket.
-
-Tue Nov 1 12:00:53 2011 Tanaka Akira <akr@fsij.org>
-
- * io.c (rb_maygvl_fd_fix_cloexec): renamed from fd_set_cloexec.
-
- * internal.h (rb_maygvl_fd_fix_cloexec): declared.
-
- * ext/socket/init.c (cloexec_accept): use rb_maygvl_fd_fix_cloexec.
- (rsock_s_accept_nonblock): use rb_update_max_fd.
- (rsock_s_accept): use rb_update_max_fd.
-
-Tue Nov 1 08:24:40 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/init.c (cloexec_accept): new function to use accept4 if
- available.
- (rsock_s_accept_nonblock): use cloexec_accept.
- (accept_blocking): ditto.
-
- * ext/socket/extconf.rb: check accept4.
-
-Tue Nov 1 07:31:55 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/ancdata.c (nogvl_recvmsg_func): use MSG_CMSG_CLOEXEC if
- available.
-
- * ext/socket/unixsocket.c (recvmsg_blocking): ditto.
-
-Tue Nov 1 05:59:41 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/socket.c (rsock_socketpair): use SOCK_CLOEXEC if
- available.
-
-Tue Nov 1 02:56:17 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ruby.c (load_file_internal): convert the encoding of load path if
- needed by platform. calling open() was replaced by rb_cloexec_open()
- at r33549, but the function expected UTF-8 pathname on Windows.
- (open() expected "locale" pathname.)
- reported by taco via IRC.
-
- * ruby.c (load_file): change the type of the 2nd parameter to pass its
- encoding to load_file_internal().
-
- * ruby.c (process_options, rb_load_file): follow above change.
- NOTE: we should pass encoding information to rb_load_file().
-
-Mon Oct 31 23:49:38 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/socket.c (rsock_socketpair): extracted from
- rsock_sock_s_socketpair.
-
-Mon Oct 31 23:31:53 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/init.c (rsock_socket): use SOCK_CLOEXEC if available.
-
-Mon Oct 31 21:47:44 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * io.c (rb_cloexec_pipe): NetBSD 6.0 will support pipe2(2),
- but its return value is -1 or larger than 0.
-
-Mon Oct 31 22:04:54 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/dbm/dbm.c (fdbm_initialize): use O_CLOEXEC if available.
-
-Mon Oct 31 21:47:48 2011 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/intern.h (rb_fd_fix_cloexec): renamed from
- rb_fd_set_cloexec.
-
- * io.c: follow the above renaming.
-
- * ext/pty/pty.c: ditto.
-
- * ext/socket/init.c: ditto.
-
- * ext/socket/socket.c: ditto.
-
- * ext/socket/ancdata.c: ditto.
-
- * ext/socket/unixsocket.c: ditto.
-
-Mon Oct 31 21:02:43 2011 Tanaka Akira <akr@fsij.org>
-
- * lib/resolv.rb (Resolv::DNS): retry IO.select for premature wakeup.
-
-Mon Oct 31 20:14:22 2011 Tanaka Akira <akr@fsij.org>
-
- * io.c (fd_set_cloexec): clear CLOEXEC flag for standard file
- descriptors.
- (rb_cloexec_dup): use rb_cloexec_fcntl_dupfd.
- (rb_cloexec_fcntl_dupfd): use F_DUPFD_CLOEXEC if available.
-
-Mon Oct 31 19:14:11 2011 Tanaka Akira <akr@fsij.org>
-
- * test/resolv/test_dns.rb: don't check maximum slept time.
- ruby doesn't guarantee the maximum time because it is not a
- realtime application.
-
-Mon Oct 31 13:10:06 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (setfl): extract from fcntl().
-
- * win32/win32.c (dupfd): new function to support F_DUPFD. based on a
- patch written by akr.
-
- * win32/win32.c (fcntl): use above functions.
-
- * include/ruby/win32.h (F_DUPFD): define. [experimental]
-
- * include/ruby/win32.h (F_SETFL): change the value to correspond with
- other platforms.
-
-Mon Oct 31 12:37:50 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/pty/pty.c (get_device_once): use O_CLOEXEC for posix_openpt if
- available.
-
-Mon Oct 31 12:05:24 2011 Tanaka Akira <akr@fsij.org>
-
- * io.c (rb_cloexec_dup2): check oldfd == newfd at first.
- pointed by KOSAKI Motohiro. [ruby-dev:44713]
-
-Mon Oct 31 10:50:26 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * io.c (rb_cloexec_fcntl_dupfd): this function needs F_DUPFD.
-
- * io.c (nogvl_io_cntl): use rb_cloexec_fcntl_dupfd() only if the
- platform has F_DUPFD.
-
-Mon Oct 31 00:50:00 2011 Luis Lavena <luislavena@gmail.com>
-
- * configure.in: check -fno-omit-frame-pointer acceptance and usage
- under MinGW. [ruby-core:39957] [Bug #5407]
-
-Mon Oct 31 00:16:11 2011 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/intern.h (rb_cloexec_fcntl_dupfd): declared.
-
- * io.c (rb_cloexec_fcntl_dupfd): new function.
- (nogvl_io_cntl): use rb_cloexec_fcntl_dupfd.
-
- * process.c (move_fds_to_avoid_crash): use rb_cloexec_fcntl_dupfd.
-
-Sun Oct 30 22:46:46 2011 Tanaka Akira <akr@fsij.org>
-
- * configure.in: check pipe2.
-
- * io.c (rb_cloexec_pipe): use pipe2 if available.
-
-Sun Oct 30 22:32:44 2011 Tanaka Akira <akr@fsij.org>
-
- * ruby.c (fill_standard_fds): use fstat() instead of fcntl(F_GETFD)
- for MinGW. reported by Luis Lavena. [ruby-core:40526] [Bug #5516]
-
-Sun Oct 30 21:12:47 2011 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/intern.h (rb_cloexec_pipe): declared.
-
- * io.c (rb_cloexec_pipe): new function.
- (rb_pipe): use rb_cloexec_pipe.
-
- * thread_pthread.c (rb_thread_create_timer_thread): use
- rb_cloexec_pipe.
-
-Sun Oct 30 20:06:07 2011 Tanaka Akira <akr@fsij.org>
-
- * io.c (rb_cloexec_dup): refine control flow.
- (rb_cloexec_dup2): ditto.
-
-Sun Oct 30 18:45:50 2011 Tanaka Akira <akr@fsij.org>
-
- * ruby.c (fill_standard_fds): new function to open closed standard
- file descriptors.
- (ruby_sysinit): call fill_standard_fds.
-
-Sun Oct 30 10:50:36 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * tool/rbinstall.rb (install_recursive, bin-comm): split mere
- string not path name. [ruby-core:40462] [Bug #5492]
-
-Sun Oct 30 10:47:20 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (rb_cloexec_dup, rb_cloexec_dup2): CLOEXEC has been set if
- dup3 succeeded.
-
-Sun Oct 30 09:58:48 2011 Tanaka Akira <akr@fsij.org>
-
- * io.c (rb_cloexec_dup): don't allocate standard file descriptors.
-
-Sun Oct 30 08:29:51 2011 Tanaka Akira <akr@fsij.org>
-
- * io.c (rb_cloexec_dup2): don't set CLOEXEC for standard file
- descriptors.
-
-Sun Oct 30 07:47:10 2011 Tanaka Akira <akr@fsij.org>
-
- * configure.in: check dup3.
-
- * io.c (rb_cloexec_dup2): use dup3 if available.
-
-Sat Oct 29 22:06:37 2011 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/intern.h (rb_cloexec_dup2): declared.
-
- * io.c (rb_cloexec_dup2): new function.
- (io_reopen): use rb_cloexec_dup2.
-
-Sat Oct 20 21:08:18 2011 Tajima Akio <artonx@yahoo.co.jp>
-
- * win32/Makefile.sub (CONFIG_H): have stdint.h if VC2010.
- [Bug #5243]
-
-Sat Oct 29 20:59:08 2011 Tanaka Akira <akr@fsij.org>
-
- * io.c (rb_cloexec_dup): use F_DUPFD_CLOEXEC if available.
-
-Sat Oct 29 20:00:26 2011 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/intern.h (rb_cloexec_dup): declared.
-
- * io.c (rb_cloexec_dup): new function.
- (ruby_dup): use rb_cloexec_dup.
-
- * ext/pty/pty.c (pty_getpty): use rb_cloexec_dup.
-
- * ext/openssl/ossl_bio.c (ossl_obj2bio): ditto.
-
-Sat Oct 29 16:11:34 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/sdbm/_sdbm.c (sdbm_prep): use O_CLOEXEC if available.
-
-Sat Oct 29 14:26:56 2011 Tanaka Akira <akr@fsij.org>
-
- * io.c (rb_cloexec_open): use O_CLOEXEC if available.
-
-Sat Oct 29 12:57:15 2011 Tanaka Akira <akr@fsij.org>
-
- * process.c (ruby_setsid): use rb_cloexec_open.
- (rb_daemon): ditto.
-
- * ruby.c (load_file_internal): ditto.
-
- * file.c (rb_file_s_truncate): ditto.
- (file_load_ok): ditto.
-
- * random.c (fill_random_seed): ditto.
-
- * ext/pty/pty.c (chfunc): ditto.
- (get_device_once): ditto.
-
- * ext/io/console/console.c (console_dev): ditto.
-
-Sat Oct 29 10:40:19 2011 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/intern.h (rb_cloexec_open): declared.
-
- * io.c (fd_set_cloexec): extracted from rb_fd_set_cloexec.
- (rb_cloexec_open): new function.
- (sysopen_func): use rb_cloexec_open.
- (rb_sysopen_internal): use rb_update_max_fd instead of
- rb_fd_set_cloexec.
-
-Sat Oct 29 09:05:07 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * thread_pthread.h: no Structured Exception Handling like macros.
- [ruby-core:40432] [Bug #5491]
-
-Fri Oct 28 22:05:34 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/sdbm/_sdbm.c: RCS $Id$ removed.
-
-Thu Oct 27 18:58:00 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * parse.y (parser_nextc): set encoding for the buffer of ripper.
-
-Fri Oct 28 06:06:08 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/sdbm/_sdbm.c (sdbm_prep): set FD_CLOEXEC flags for file
- descriptors.
- (fd_set_cloexec): new function.
-
-Fri Oct 28 03:01:27 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * vm_insnhelper.c (vm_call_cfunc): adding back useless hack. For some
- reason, this fixes CFP errors on OS X 10.7.
-
-Fri Oct 28 00:09:31 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/sdbm/_sdbm.c (sdbm_prep): refactored for less nesting.
-
-Thu Oct 27 18:28:18 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (RUBY_DEFINE_IF): revert r33534 partially to get
- rid of AS_ECHO which is not available in autoconf 2.61.
- [ruby-dev:44702]
-
-Thu Oct 27 16:10:46 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * bignum.c (rb_big_divide): raise ZeroDivisionError if divisor is
- zero, as well as Fixnum. [ruby-core:40429] [Bug #5490]
-
-Thu Oct 27 14:56:22 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (RUBY_FUNC_ATTRIBUTE): unset temporary variable.
-
- * configure.in (RUBY_STACK_GROW_DIRECTION): substitute CPU name as
- shell variable name. based on the patch by The Written Word Inc. at
- [ruby-core:40421]. [Bug #5488]
-
-Thu Oct 27 09:57:56 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * include/ruby/ruby.h (SIZE_MAX): define SIZE_MAX if not defined.
- patched by The Written Word Inc. [ruby-core:40422] [Bug #5489]
-
-Thu Oct 27 08:47:38 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * ext/psych/parser.c: remove unused variable.
-
-Thu Oct 27 08:38:41 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * ext/openssl/extconf.rb: add -Wall flag by default when compiler is
- GCC.
-
-Wed Oct 26 15:24:25 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * file.c (rb_file_join): honor input encodings than ASCII-8BIT.
- [ruby-core:40338] [Bug #5483]
-
-Tue Oct 25 21:52:31 2011 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/defines.h: use "__sparc" instead of "sparc" and
- "__sparc__".
-
- * dln.c: ditto.
-
- [ruby-dev:44694]
-
-Tue Oct 25 06:34:39 2011 Eric Hodel <drbrain@segment7.net>
-
- * re.c (match_aref): Use <code> around indexing examples to prevent
- hyperlinks. [ruby-talk:389396]
-
-Mon Oct 24 23:55:31 2011 Tanaka Akira <akr@fsij.org>
-
- * complex.c: use "__sun" instead of "__sun__" to detect SunOS.
-
- * math.c: ditto.
-
- * hash.c: ditto.
-
- * atomic.h: ditto.
-
- * ext/io/wait/wait.c: ditto.
-
- [ruby-dev:44693]
-
-Mon Oct 24 22:45:37 2011 Tanaka Akira <akr@fsij.org>
-
- * io.c: use "__sun" instead of "sun" to detect SunOS.
-
- * dln.c: ditto.
-
- * cont.c: ditto.
-
- * ext/sdbm/_sdbm.c: ditto.
-
- [ruby-dev:44693]
-
-Mon Oct 24 22:38:08 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/pty/pty.c (get_device_once): delay rb_fd_set_cloexec() until
- grantpt() on Solaris. grantpt() doesn't work with CLOEXEC on
- Solaris 10.
- reported by Naohisa GOTO. [ruby-dev:44688] [Bug #5475]
-
-Mon Oct 24 08:18:14 2011 Tanaka Akira <akr@fsij.org>
-
- * io.c (copy_stream_fallback_body): check nil for EOF of read method.
- patch by Eric Wong. [ruby-core:39134] [Bug #5237]
-
-Sun Oct 23 18:21:23 2011 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * ext/tk/MANUAL_tcltklib.eng: fix typo.
-
-Sun Oct 23 18:03:31 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * numeric.c (rb_infinity, rb_nan): aggregated member initializers
- need braces.
-
-Sun Oct 23 16:43:43 2011 Naohisa Goto <ngotogenome@gmail.com>
-
- * ext/io/wait/wait.c: ioctl(2) is declared in unistd.h on Solaris.
-
-Sun Oct 23 16:33:35 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * ext/tk/MANUAL_tcltklib.eng: fix typo. reported by Mimura-san.
- [ruby-dev:44683] [Bug #5471]
-
-Sun Oct 23 08:01:29 2011 Tanaka Akira <akr@fsij.org>
-
- * io.c (rb_fd_set_cloexec): set close-on-exec flag only if F_GETFD is
- defined. reported by Luis Lavena. [ruby-core:40281] [Bug #5470]
-
-Sat Oct 22 19:48:50 2011 Tanaka Akira <akr@fsij.org>
-
- * test/openssl/test_ssl.rb (test_multibyte_read_write): start server
- for each length to avoid race condition.
-
-Sat Oct 22 18:49:24 2011 Tanaka Akira <akr@fsij.org>
-
- * include/ruby/intern.h (rb_fd_set_cloexec): declared.
-
- * io.c (rb_fd_set_cloexec): new function.
- (ruby_dup): call rb_fd_set_cloexec to set close-on-exec flag.
- (rb_sysopen_internal): ditto.
- (rb_pipe): ditto.
- (io_reopen): ditto.
- (io_cntl): ditto.
-
- * process.c (rb_f_exec): change the default :close_others option to
- true.
- (rb_f_system): ditto.
- (move_fds_to_avoid_crash): call rb_fd_set_cloexec to set
- close-on-exec flag.
- (ruby_setsid): ditto.
- (rb_daemon): ditto.
-
- * thread_pthread.c (rb_thread_create_timer_thread): call
- rb_fd_set_cloexec to set close-on-exec flag.
-
- * ruby.c (load_file_internal): ditto.
-
- * file.c (rb_file_s_truncate): ditto.
- (file_load_ok): ditto.
-
- * random.c (fill_random_seed): ditto.
-
- * ext/pty/pty.c (chfunc): ditto.
- (get_device_once): ditto.
-
- * ext/openssl/ossl_bio.c (ossl_obj2bio): ditto.
-
- * ext/socket/init.c (rsock_socket): ditto.
- (rsock_s_accept_nonblock): ditto.
- (rsock_s_accept): ditto.
-
- * ext/socket/socket.c (rsock_sock_s_socketpair): ditto.
-
- * ext/socket/ancdata.c (discard_cmsg): ditto.
- (make_io_for_unix_rights): ditto.
-
- * ext/socket/unixsocket.c (unix_recv_io): ditto.
-
- * ext/io/console/console.c (console_dev): ditto.
-
- [ruby-core:38140] [Feature #5041]
-
-Sat Oct 22 17:46:27 2011 Tanaka Akira <akr@fsij.org>
-
- * lib/resolv.rb: fix a exception name in previous patch.
-
-Sat Oct 22 17:43:33 2011 Tanaka Akira <akr@fsij.org>
-
- * lib/resolv.rb: make timeout configurable for DNS query.
- patch by Eric Wong. [ruby-core:38533] [Feature #5100]
-
-Sat Oct 22 02:07:48 2011 Naohisa Goto <ngotogenome@gmail.com>
-
- * numeric.c (rb_infinity, rb_nan): use union to prevent bus error
- caused by misalignment. [Bug #5469] [ruby-dev:44657]
-
- * include/ruby/missing.h (INFINITY, NAN): ditto
-
-Fri Oct 21 22:02:17 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (initial_params): pack in a struct.
-
- * gc.c (rb_gc_set_params): set parameters always.
- [ruby-dev:44648] [Bug #5467]
-
-Fri Oct 21 12:10:20 2011 Naohisa Goto <ngotogenome@gmail.com>
-
- * atomic.h: change Solaris checking macro because atomic_ops can work
- not only with Sun Studio but also with Fujitsu C Compiler.
-
-Fri Oct 21 02:11:00 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * ext/openssl/ossl_ns_spki.c: Complete documentation.
- * test/openssl/test_ns_spki.rb: Integrate SPKI#to_text.
-
-Thu Oct 20 22:47:28 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (socklist_insert, socklist_lookup, socklist_delete):
- new functions to wrap of st_insert(), st_lookup() and st_delete() to
- socklist.
- allocating socklist is deferred until it is really needed.
-
- * win32/win32.c (exit_handler): delete socklist only if it is
- initialized.
-
- * win32/win32.c (rb_w32_sysinit, StartSockets): refactoring: move
- initialization of select_mutex to StartSockets().
-
- * win32/win32.c (exit_handler): refactoring: delete select_mutex only
- if winsock is used.
-
-Thu Oct 20 22:38:53 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * ext/openssl/ossl_pkcs5.c: add note on timing attacks and general
- documentation.
-
-Thu Oct 20 21:19:15 2011 Naohisa Goto <ngotogenome@gmail.com>
-
- * vm_eval.c (check_funcall): set array elements one-by-one to fix
- compile error with Fujitsu C Compiler 5.6 on Solaris 10 on Sparc.
- [Bug #5464] [ruby-dev:44632]
-
-Thu Oct 20 13:09:35 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/defines.h (flush_register_windows): use software
- trap on Debian Sparc 32-bit userspace. [Bug #5244]
-
-Thu Oct 20 12:28:22 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * test/openssl/test_pkcs5.rb: add RFC 6070 tests for PBKDF2 with
- HMAC-SHA1
-
-Thu Oct 20 11:42:23 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * util.c (mmprepare): fix for fragmental size.
-
- * util.c (mmswap_, mmrot3_): portability improvement.
-
-Thu Oct 20 05:58:02 2011 Eric Hodel <drbrain@segment7.net>
-
- * ext/openssl/ossl_ns_spki.c (Init_ossl_ns_spki): Stub documentation
- for Netscape SPKI.
-
-Thu Oct 20 05:13:39 2011 Ryan Davis <ryand-ruby@zenspider.com>
-
- * lib/minitest/*: Imported minitest 2.6.2 (r6712)
- * test/minitest/*: ditto
-
-Thu Oct 20 06:55:32 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * lib/openssl/buffering.rb: Force multi-byte strings to be treated as
- binary data.
- * test/openssl/test_ssl.rb: Add test for it.
-
- Thanks to Niklas Baumstark for reporting the issue!
-
- [Ruby 1.9 - Bug #5233] [ruby-core:39120]
-
-Wed Oct 19 17:06:54 2011 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * version.h (RUBY_VERSION): finally declare start of 2.0 work!
-
-Wed Oct 19 11:48:44 2011 Eric Hodel <drbrain@segment7.net>
-
- * error.c (Init_Exception): Document $! and $@. Provide
- recommendations for creating exceptions for a library.
-
-Wed Oct 19 11:25:46 2011 Eric Hodel <drbrain@segment7.net>
-
- * error.c (Init_Exception): Add hierarchy of Exception subclasses.
- Based on patch by Sylvain Daubert. [Ruby 1.9 - Bug #5438]
-
-Wed Oct 19 11:04:47 2011 Eric Hodel <drbrain@segment7.net>
-
- * enum.c: Reformat block args to a single standard, { |args| ... }.
- Patch by b t. [Ruby 1.9 - Bug #5393]
-
-Wed Oct 19 12:11:26 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * ext/openssl/ossl_ssl.c: Remove set, but unused variables.
- ext/openssl/ossl_pkey.c: ditto
-
- * ext/openssl/ossl_pkey_dh.c: Make functions passed to
- rb_thread_blocking_region return VALUE instead of void.
- ext/openssl/ossl_pkey_dsa.c: ditto
- ext/openssl/ossl_pkey_rsa.c: ditto
-
-Tue Oct 18 23:28:53 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * hash.c (identhash): share with type_numhash.
-
- * st.c (st_hashtype_num): rename from type_numhash.
-
-Tue Oct 18 23:07:30 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_core.h (ruby_current_thread): probeprofiler has been removed
- long ago.
-
-Tue Oct 18 23:05:49 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/ripper/eventids2.c (ripper_init_eventids2): separate
- initializations of IDs and objects.
-
- * ext/ripper/tools/generate.rb (generate_eventids1): ditto.
-
- * parse.y (Init_ripper, InitVM_ripper): fix inversed roles.
-
-Sun Oct 16 19:46:16 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/bigdecimal/bigdecimal.gemspec (files): fixed typo, and
- removed nonexistent file.
-
- * ext/bigdecimal/bigdecimal.gemspec (homepage): added.
-
- * ext/io/console/io-console.gemspec (homepage): ditto.
-
-Fri Oct 14 12:13:57 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/pty/pty.c (pty_check): should return nil until the child
- terminates or stops. [ruby-dev:44600] [Bug #2642]
-
-Fri Oct 14 11:19:37 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * include/ruby/intern.h (rb_ary_rotate): export.
-
-Fri Oct 14 05:58:05 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * atomic.h (ATOMIC_INC, ATOMIC_DEC): return old values.
- [ruby-dev:44596] [Bug #5439]
-
- * signal.c (ruby_atomic_exchange): no needs to define on the
- platforms where atomic.h is available.
-
-Thu Oct 13 19:29:40 2011 Naohisa Goto <ngotogenome@gmail.com>
-
- * atomic.h (ATOMIC_*): use atomic_ops(3C) when SunStudio on Solaris.
- [ruby-dev:44596] [Bug #5439]
-
-Thu Oct 13 18:13:04 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * atomic.h(ATOMIC_SET): add cast to void to prevent misuse.
- [ruby-dev:44596] [Bug #5439]
-
-Thu Oct 13 18:04:27 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (rb_gc_finalize_deferred, rb_objspace_call_finalizer):
- should use ATOMIC_EXCHANGE() to check the previous value.
- [ruby-dev:44596] [Bug #5439]
-
-Wed Oct 12 23:39:58 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
-
- * test/openssl/test_ssl.rb: Move duplicated tests for SSL::Session to
- test_ssl_session.rb
-
-Tue Oct 11 08:49:40 2011 Eric Hodel <drbrain@segment7.net>
-
- * array.c (rb_ary_initialize): Improve explanation of Array.new
- parameters. Patch by Alvaro Pereyra Rabanal. [Ruby 1.9 - Bug #5425]
- * array.c (rb_ary_s_try_convert): Fix typo (try => tries)
- * array.c (rb_ary_rindex): Add spacing for block.
- * array.c (rb_ary_uniq_bang): Describe block
- * array.c (rb_ary_uniq): ditto
-
-Tue Oct 11 07:55:38 2011 Eric Hodel <drbrain@segment7.net>
-
- * array.c: Add a description to Array, minor cleanups. Patch by
- Andrea Singh. [Ruby 1.9 - Bug #5412]
-
-Tue Oct 11 06:09:52 2011 Eric Hodel <drbrain@segment7.net>
-
- * lib/pp.rb: Move PP documentation to top of class PP. Patch by
- Sylvain Daubert. [Ruby 1.9 - Bug #5430]
-
-Tue Oct 11 06:06:29 2011 Eric Hodel <drbrain@segment7.net>
-
- * ext/coverage/coverage.c (Init_coverage): Change list format and
- describe Coverage.result output. Patch by Sylvain Daubert.
- [Ruby 1.9 - Bug #5428]
-
-Tue Oct 11 05:53:23 2011 Eric Hodel <drbrain@segment7.net>
-
- * object.c (Init_Object): Add reference to BasicObject, brief
- explanation of constant lookup. Based on patch by Alvaro Pereyra
- Rabanal.
- [Ruby 1.9 - Bug #5426]
-
-Sun Oct 9 11:06:52 2011 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * test/psych/test_yamldbm.rb: don't run test if the system
- don't support yaml/dbm.
-
- * test/syck/test_yamldbm.rb: ditto.
-
-Sat Oct 8 08:54:56 2011 Eric Hodel <drbrain@segment7.net>
-
- * enum.c (group_by): Improve group_by description. Patch by b t.
- [#5411]
-
-Sat Oct 8 03:17:51 2011 Eric Hodel <drbrain@segment7.net>
-
- * lib/shell.rb: Document some methods of Shell. Patch by Carol
- Nichols. [Ruby 1.9 - Bug #5417]
-
-Fri Oct 7 17:54:28 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/test/unit/assertions.rb (assert_send, assert_not_send):
- parenthesize non-empty arguments.
-
-Fri Oct 7 06:35:50 2011 Eric Hodel <drbrain@segment7.net>
-
- * array.c: Use + for arguments described in documentation to allow
- rdoc -C2 to work better. Remove <code> from method references to
- allow cross-references in HTML documentation.
-
-Thu Oct 6 18:46:23 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * vm_eval.c (make_no_method_exception): fix typo.
-
- * vm_insnhelper.c, vm_insnhelper.h: ditto.
-
-Thu Oct 6 16:29:30 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_eval.c (make_no_method_execption): extract from
- raise_method_missing().
-
- * vm_eval.c (send_internal): remove inadvertent symbol creation
- from public_send. based on a patch by Jeremy Evans <code AT
- jeremyevans.net> in [ruby-core:38576]. [Feature #5112]
-
- * vm_insnhelper.c (vm_call_method): remove inadvertent symbol
- creation from send and __send__, too.
-
-Thu Oct 6 14:59:11 2011 Eric Hodel <drbrain@segment7.net>
-
- * lib/time.rb: Clean up Time documentation. Patch by Jake Goulding.
- [Ruby 1.9 - Bug #5416]
-
-Thu Oct 6 10:00:54 2011 Eric Hodel <drbrain@segment7.net>
-
- * enum.c (group_by): Improve documentation based on patch by b t.
-
-Thu Oct 6 09:56:30 2011 Eric Hodel <drbrain@segment7.net>
-
- * enum.c: Clean up wording in Enumerable documentation. Patch by b t.
- [Ruby 1.9 - Bug #5411]
-
-Thu Oct 6 09:17:18 2011 Eric Hodel <drbrain@segment7.net>
-
- * time.c (Init_Time): Remove editorial comments from Time
- documentation, fix link.
-
-Thu Oct 6 09:14:20 2011 Eric Hodel <drbrain@segment7.net>
-
- * time.c (Init_Time): Improve Time documentation. Patch by Shane
- Emmons. [Ruby 1.9 - Bug #5404]
- * lib/time.rb: Improve time.rb documentation including Time.strptime.
- Patch by Shane Emmons. [Ruby 1.9 - Bug #5402]
-
-Thu Oct 6 08:54:05 2011 Eric Hodel <drbrain@segment7.net>
-
- * random.c: Improve documentation of Random. Patch by Gregory
- Parkhurst. [Ruby 1.9 - Bug #5410]
-
-Thu Oct 6 01:44:51 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * cont.c (cont_mark): mark original Thread object from saved_thread.
- [ruby-dev:44571] [Bug #5386]
-
-Wed Oct 5 16:33:04 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * vm_insnhelper.c (vm_call_cfunc): remove useless hack.
-
-Wed Oct 5 05:56:39 2011 Eric Hodel <drbrain@segment7.net>
-
- * hash.c (Init_Hash): Improve Hash documentation. Patch by Alvaro
- Pereyra Rabanal. [Ruby 1.9 - Bug #5405]
-
-Wed Oct 5 05:47:59 2011 Eric Hodel <drbrain@segment7.net>
-
- * random.c (Init_Random): Add a top-level comment for Random. Patch
- by Brett Bim. [Ruby 1.9 - Bug #5403]
-
-Wed Oct 5 02:50:27 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/syntax_error.rb: Add file, line, offset, and
- message attributes during parse failure.
- * ext/psych/parser.c: Update parser to raise exception with correct
- values.
- * test/psych/test_exception.rb: corresponding tests.
-
-Wed Oct 5 01:52:16 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/parser.c (parse): Use context_mark for indicating error
- line and column.
-
-Wed Oct 5 01:22:08 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/scalar_scanner.rb: use normal begin / rescue
- since postfix rescue cannot receive the exception class. Thanks
- nagachika!
-
-Tue Oct 4 21:10:08 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * class.c (class_alloc): allocate extra memory after containing
- object setup to get rid of rare-but-potential memory leak.
-
- * gc.c (gc_mark_children): skip marking extended members if ptr is
- NULL.
-
-Tue Oct 4 16:17:50 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/time.rb (Time.strptime): use Time.at if d[:seconds] is set.
- Reported by Christopher Eberz. [ruby-core:39903] Bug #5399
-
-Tue Oct 4 11:44:10 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * gc.c (rb_gc_set_params): ruby_verbose can be Qnil, so use RTEST.
-
-Tue Oct 4 08:33:41 2011 Eric Hodel <drbrain@segment7.net>
-
- * ext/etc/etc.c: Document Etc, Etc.sysconfdir, Etc.systmpdir. Patch
- by mathew murphy. [Ruby 1.9 - Bug #5396]
-
-Tue Oct 4 08:21:51 2011 Eric Hodel <drbrain@segment7.net>
-
- * lib/shellwords.rb: Update toplevel comment with an example. Patch
- by Samnang Chhun. [Ruby 1.9 - Bug #5388]
-
-Tue Oct 4 08:15:50 2011 Eric Hodel <drbrain@segment7.net>
-
- * proc.c (proc_call): Update documentation to match argument handling
- of proc/Proc.new/lambda/->()
-
-Tue Oct 4 07:59:16 2011 Eric Hodel <drbrain@segment7.net>
-
- * proc.c (proc_call): Fix documentation of Proc#call vs Proc#===.
- [Ruby 1.9 - Bug #5349]
-
-Tue Oct 4 07:43:18 2011 Eric Hodel <drbrain@segment7.net>
-
- * array.c (rb_ary_initialize): Make Array.new description match
- call-seq. Patch by Henry Maddocks. [Ruby 1.9 - Bug #5344]
-
-Tue Oct 4 07:35:23 2011 Eric Hodel <drbrain@segment7.net>
-
- * array.c (rb_ary_initialize): Add output for examples. Patch by
- Jonathan Mukai. [Ruby 1.9 - Bug #5216]
-
-Tue Oct 4 07:30:50 2011 Eric Hodel <drbrain@segment7.net>
-
- * array.c (rb_ary_s_create): Add example results for Array::[]. Patch
- by Jonathan Mukai. [Ruby 1.9 - Bug #5215]
-
-Tue Oct 4 07:15:17 2011 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems 1.8.11. Move Deprecate into the
- Gem namespace.
-
-Tue Oct 4 06:43:47 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych.rb: update psych version.
- * ext/psych/psych.gemspec: generate new gemspec for new version.
-
-Tue Oct 4 06:29:55 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych.rb: calling `yaml` rather than `to_yaml`.
- * ext/psych/lib/psych/nodes/node.rb: Rename `to_yaml` to just `yaml`
- in order to avoid YAML::ENGINE switching from replacing this method.
- * test/psych/helper.rb: fix tests for method name change.
- * test/psych/test_document.rb: ditto
- * test/psych/visitors/test_emitter.rb: ditto
-
-Tue Oct 4 06:20:19 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/scalar_scanner.rb: Match values against the
- floating point spec defined in YAML to avoid erroneous parses.
- * test/psych/test_numeric.rb: corresponding test.
-
-Tue Oct 4 05:59:24 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/to_ruby.rb: ToRuby visitor can be
- constructed with a ScalarScanner.
- * ext/psych/lib/psych/visitors/yaml_tree.rb: ScalarScanner can be
- passed to the YAMLTree visitor.
-
-Tue Oct 4 05:47:23 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/to_ruby.rb: Define Regexp::NOENCODING
- for 1.9.2 backwards compatibility.
- * ext/psych/lib/psych/visitors/yaml_tree.rb: Fix Date string
- generation for 1.9.2 backwards compatibility.
-
-Mon Oct 3 23:56:39 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * gc.c (rb_gc_set_params): output GC parameter change messages only
- if -w/-v options are specified. these messages are output to stderr,
- not to stdout. [ruby-core:39795] [Bug #5380]
-
- * test/ruby/test_gc.rb (test_gc_parameter): add test for it.
-
-Sun Oct 2 20:05:32 2011 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * vm.c (rb_thread_mark), cont.c (cont_mark): revert r33369 and r33371
- that may cause SEGV in certain environments.
-
-Sun Oct 2 12:14:06 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * test/psych/test_yamldbm.rb: add test case.
- * test/syck/test_yamldbm.rb: ditto.
-
-Sun Oct 2 11:28:09 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * lib/yaml/store.rb: make initialize method signature match the
- superclass signature.
-
-Sun Oct 2 10:44:01 2011 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * io.c: fix documentation of ARGF.lineno=.
-
-Sat Oct 1 20:03:19 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (have_framework): try as Objective-C.
- https://twitter.com/nagachika/status/120294447660539904
-
-Sun Oct 2 08:43:25 2011 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * vm.c (rb_thread_mark), cont.c (cont_mark): self pointer should not
- be marked by itself. Patch by Koichi Sasada.
- [ruby-dev:44567] [Bug #5386]
-
-Sun Oct 2 00:42:14 2011 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * vm.c (rb_thread_mark): rb_thread_t needs self to be marked.
- [ruby-dev:44566] [Bug #5386]
-
-Sat Oct 1 09:48:53 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * gc.c (add_heap_slots, init_heap): reset heaps_inc zero when
- heap slots are expanded by environment variable RUBY_HEAP_MIN_SLOTS.
- [ruby-core:39777] [Bug #5380]
-
- * test/ruby/test_gc.rb (test_gc_parameter): add test for it.
-
- * test/ruby/envutil.rb (assert_normal_exit): add :child_env option to
- enable pass environment variables to child process.
-
-Thu Sep 29 13:17:51 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * array.c (ary_join_1): should not copy the encoding of non-string
- element after string element. [ruby-core:39776] [Bug #5379]
-
-Thu Sep 29 11:53:56 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (slot_sweep, rb_gc_finalize_deferred)
- (rb_objspace_call_finalizer, rb_gc): run finalizers
- sequentially. [ruby-dev:44562]
-
-Thu Sep 29 20:37:38 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/gdbm/gdbm.c (rb_gdbm_fatal): adjust argument type.
-
-Thu Sep 29 20:10:42 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (is_id_value, is_live_object): extract from id2ref().
-
- * gc.c (run_finalizer): use object instead of object id.
-
-Thu Sep 29 20:07:36 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * use RB_TYPE_P which is optimized for constant types, instead of
- comparison with TYPE.
-
-Wed Sep 28 09:20:37 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (pthread_np.h): needs pthread.h to be included
- previously on OpenBSD. a patch by George Koehler <xkernigh AT
- netscape.net> at [ruby-core:39752]. [Bug #5376]
-
-Wed Sep 28 04:41:35 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * test/psych/test_yamlstore.rb: use tmpdir for tmpfile.
- * test/syck/test_yamlstore.rb: ditto.
-
-Wed Sep 28 04:10:46 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * ext/bigdecimal/README: update report to.
-
-Tue Sep 28 04:05:00 2011 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal_en.html: removed because this file isn't
- maintained now.
-
- * ext/bigdecimal/bigdecimal_ja.html: ditto.
-
-Tue Sep 27 09:55:40 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread_pthread.c: make native_fd_select().
- * thread.c (do_select): remove #ifdef _WIN32. Instead, use
- native_fd_select() always.
-
-Tue Sep 27 09:44:59 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (do_select): remove cygwin specific hack. It's layer
- violation and too large hack.
- * thread.c (cmp_tv, subtract_tv): removed.
-
-Tue Sep 27 03:50:19 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * test/rexml/test_sax.rb: add require 'rexml/document'.
-
-Tue Sep 27 03:32:27 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * test/psych/test_yamldbm.rb: fix #setup and #teardown.
- [Bug #5370] [ruby-core:39730]
- * test/syck/test_yamldbm.rb: ditto.
-
-Mon Sep 26 11:27:38 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/webrick/httputils.rb: Add MIME Type definition of .js and .svg.
- patched by Hal Brodigan. [ruby-core:39704] [Bug #5365]
-
-Mon Sep 26 09:20:44 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: remove DJGPP support. It's not longer supported
- since ruby 1.9.0.
-
-Mon Sep 26 09:07:46 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * include/ruby/defines.h: remove NextStep, OpenStep, Rhapsody
- support. Last activity of their OSes are 7 years ago.
- * configure.in: ditto.
- * dir.c: ditto.
- * ext/tk/extconf.rb: ditto.
-
-Mon Sep 26 09:02:49 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: remove a code for human68k. it's no longer
- supported since r19677.
-
-Sun Sep 25 23:43:32 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * ext/openssl/ossl_asn1.c: fix int_ossl_asn1_decode0_cons when being
- fed arbitrary string values.
- Clearly distinguish between the cases "universal, infinite and
- not a SEQUENCE or SET" and "universal SEQUENCE or SET, possibly
- infinite". Raise error for universal tags that are not infinite.
- * test/openssl/test_asn1.rb: add a test for this.
-
- Thanks to Hiroshi Yoshida for reporting this bug.
- [Bug #5363] [ruby-dev:44542]
-
-Sun Sep 25 20:57:18 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * test/syck/test/yamldbm.rb: add test for Syck::DBM.
- * test/psych/test_yamldbm.rb: add test for Psych::DBM.
- * test/psych/test_yamlstore.rb: add test for Psych::PStore.
-
-Sun Sep 25 20:54:10 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * lib/yaml/dbm/dbm.rb: fix #update, add #key for using instead #index.
- [Bug #5305][ruby-dev:44485]
-
-Sun Sep 25 16:54:33 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * encoding.c (require_enc): reject only loading from untrusted
- load paths. [ruby-dev:44541] [Bug #5279]
-
- * transcode.c (load_transcoder_entry): ditto.
-
-Sun Sep 25 16:45:05 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in: ignore all warnings from an arbitrary
- header in /usr/local/include.
-
-Sun Sep 25 03:43:03 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * enum.c (slice_before_i): use rb_attr_get to suppress wrong warning
- for internal instance variable slicebefore_initial_state.
-
-Fri Sep 23 14:20:14 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * ext/openssl/ossl_asn1.c: remove unused variable.
-
-Fri Sep 23 13:46:59 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * test/openssl/test_ssl_session.rb: execute test_session_exts_read
- only for OpenSSL versions >= 0.9.8k. Thanks, Eric Wong, for
- reporting this.
- [Bug #4961] [ruby-core:37726]
-
-Fri Sep 23 11:59:08 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * test/openssl/test_ssl_session.rb: ensure server calls callbacks in
- test_ctx_server_session_cb. Thanks to Eric Wong for the patch.
- [Bug #5336] [ruby-core:39619]
-
-Thu Sep 22 02:53:19 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_insnhelper.c (vm_call_cfunc): suppress a warning. note that
- `volatile type *var' doesn't make var itself volatile.
-
-Thu Sep 22 01:52:48 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * thread_pthread.c (ubf_select): activate timer thread when interrupt
- blocking thread.
- A patch created by Koichi Sasada. [ruby-core:39634] [Bug #5343]
- to cover race condition, timer thread periodically send SIGVTARLM to
- threads in signal thread list. so you should activate timer thread
- when interrupt a thread.
-
-Wed Sep 21 16:55:26 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/io/wait/test_io_wait.rb (TestIOWait#setup): of course, the
- behavior of mingw is just same with mswin.
-
-Tue Sep 20 18:08:51 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_insnhelper.c (vm_get_cvar_base): reduce duplicated checks and
- move a warning outside the loop.
-
-Mon Sep 19 18:55:51 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * lib/fileutils.rb (module FileUtils): improve performance of
- FileUtils.compare_stream. a patch by Masaki Matsushita.
- [Feature #5337] [ruby-core:39622]
-
-Mon Sep 19 18:42:58 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * test/-ext-/old_thread_select/test_old_thread_select.rb:
- select() with timeout may return early in old Linux kernels
- with 250 Hz tickrate and no dynticks, so skip everything older
- than 2.6.32 (which has long term support).
- And, Make the timing assertions consistently use assert_operator with
- timing difference in error message
- Patch by Eric Wong. [Bug #5335] [ruby-core:39618]
-
-Mon Sep 19 09:28:06 2011 Eric Hodel <drbrain@segment7.net>
-
- * test/openssl/test_ssl.rb (class OpenSSL): Test
- OpenSSL::SSL::SSLSocket#session and #session=.
-
-Mon Sep 19 07:54:17 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * object.c (rb_obj_clone): singleton class should be attached
- singleton object to. a patch by Satoshi Shiba <shiba AT rvm.jp>
- at [ruby-dev:44460]. [Bug #5274]
-
-Sat Sep 17 23:34:10 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parser_data_type): inherit the core type in ripper so
- that checks in core would work. [ruby-core:39591] [Bug #5331]
-
-Sat Sep 17 12:44:04 2011 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * lib/find.rb (Find.find): add documentation that Find.find
- without block returns an enumerator.
-
-Thu Sep 15 11:39:43 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (mark_entry, mark_key, mark_keyvalue): adjust callback
- argument types.
-
-Thu Sep 15 01:44:10 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * ext/tk/*: Change encoding from EUC-JP to UTF-8
-
-Wed Sep 14 11:43:37 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (rb_fd_rcopy): added an argument guard.
- Patch by NAKAMURA Usaku. [Bug #5306] [ruby-core:39435]
-
-Tue Sep 13 20:21:49 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/pstore.rb, test/test_pstore.rb: suppress warnings with -v.
-
- * lib/pstore.rb (PStore): always open in binary mode even if
- default encodings are set. [Bug #5311] [ruby-core:39503]
-
-Tue Sep 13 05:37:15 2011 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * io.c (Init_IO): update BINARY comment. it should not change the
- encoding of the result to ASCII-8BIT. [ruby-talk:387719]
-
-Mon Sep 12 19:55:00 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (rb_thread_select): fix to ignore an argument
- modification of rb_thread_fd_select().
- based on a patch by Eric Wong. [Bug #5306] [ruby-core:39435]
- * thread.c (rb_fd_rcopy): New. for reverse fd copy.
-
- * test/-ext-/old_thread_select/test_old_thread_select.rb
- (test_old_select_false_positive): test for bug5306.
-
- * ext/-test-/old_thread_select/old_thread_select.c (fdset2array):
- New. convert fdsets to array.
- * ext/-test-/old_thread_select/old_thread_select.c (old_thread_select):
- return 'read', 'write', 'except' argument of rb_thread_select()
- to ruby script.
-
-Mon Sep 12 13:38:12 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * README.EXT, README.EXT.ja (2.2.2), parse.y (rb_check_id): add
- documents for rb_check_id().
-
-Mon Sep 12 12:53:39 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * lib/rake/file_list.rb (Rake::FileList#egrep): there is no need to
- open files in binary mode.
- see more details in https://github.com/jimweirich/rake/issues/74
-
-Mon Sep 12 12:42:36 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/ruby/test_exception.rb (TestException#test_exit_success_p):
- assert also the cases when exiting with true and false.
-
- * lib/test/unit/assertions.rb (assert_send): make arguments in
- the default message clearer.
-
-Sun Sep 11 05:23:14 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * lib/matrix.rb: Deal with subclasses of Matrix [redmine #5307]
-
-Sat Sep 10 13:38:20 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * dir.c (dir_s_aref):
- * dir.c (dir_entries): Two small documentation fixes.
- A patch from Aaron Lerch. [Bug #5302] [ruby-core:39404]
-
-Sat Sep 10 08:30:03 2011 Koichi Sasada <ko1@atdot.net>
-
- * gc.c (GC_PROFILE_MORE_DETAIL, CALC_EXACT_MALLOC_SIZE):
- define macros only if they are not defined.
- fixes: [Ruby 1.9 - Feature #5291]
-
-Sat Sep 10 08:25:47 2011 Yukihiro Matsumoto <matz@ruby-lang.org>
-
- * parse.y (bv_decls): parse.y relies on $$ = $1 before action
- routines. a patch from Michael Edgar. [Bug #5303]
- [ruby-core:39429]
-
-Sat Sep 10 01:37:55 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-
- * sample/drb/dhasenc.rb: coding cookie of Emacs is coding,
- not encoding.
-
- * sample/mine.rb: ditto.
-
-Fri Sep 9 21:56:40 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * ext/bigdecimal/bigdecimal.c (BigDecimal_sqrt): Fix comment.
- BigDecimal#sqrt requires argument. Reported by Makoto Kishimoto.
- Thanks for your contribution. [Bug #5267] [ruby-dev:44452]
-
-Fri Sep 9 11:00:55 2011 Shota Fukumori <sorah@tubusu.net>
-
- * test/rubygems/test_gem_commands_help_command.rb: Add one
- `require` because if run test-all with test/unit parallel
- running, sometimes this test fails by some constants not found.
- The error reason is some worker doesn't require the file needed by
- this test. This issue is related to [ruby-core:36168].
-
-Fri Sep 9 10:22:03 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * thread.c (rb_thread_select): fix a typo to initialize efds
- properly. [Bug #5299] [ruby-core:39380]
-
-Fri Sep 9 02:02:09 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * template/yarvarch.ja:
- Change encoding from Shift_JIS to UTF-8
-
-Thu Sep 9 01:14:00 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * sample/drb/README.rd.ja:
- * sample/drb/dhasenc.rb:
- * sample/mine.rb:
- Change encoding from EUC-JP to UTF-8
-
-Thu Sep 8 21:03:22 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/nkf/nkf-utf8/nkf.c: import nkf 2.1.2 (be9c280)
- Bump version number/release date only.
-
-Thu Sep 8 12:43:18 2011 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c (Init_GC): defined GC::Profiler.raw_data. based on the
- patch by Eric Hodel. [ruby-core:37857] [Bug #4991]
-
-Thu Sep 8 09:02:53 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (id2ref): objects which are unmarked but not in sweep_slots
- are not dead.
-
-Thu Sep 8 07:44:25 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * transcode.c (rb_declare_transcoder, load_transcoder_entry): no
- longer need to limit the length of transcoder library name.
-
-Thu Sep 8 07:36:36 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/syck/lib/syck/types.rb: use toplevel Syck.
- for the case someone define Syck::Syck (or YAML::Syck).
-
-Thu Sep 8 07:33:12 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * gc.c (id2ref): unmarked object is already dead while lazy
- sweeping, and to it cannot come back since other objects
- referred from it might have been freed already.
-
-Wed Sep 8 03:48:00 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * ext/readline/README.ja:
- Change encoding from EUC-JP to UTF-8
-
-Wed Sep 8 02:59:00 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * test/rexml/test_encoding.rb:
- Add require 'require 'rexml/document'
-
-Wed Sep 8 02:53:00 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * ext/nkf/nkf-utf8/nkf.c:
- Change encoding from ISO-2022 to UTF-8
-
-Wed Sep 7 23:41:24 2011 Kouhei Sutou <kou@cozmixng.org>
-
- * lib/rexml/parsers/baseparser.rb, test/rexml/test_comment.rb:
- allow a single hyphen in comment. [Bug #5278] [ruby-core:39289]
- Reported by Thomas Fritzsche. Thanks!!!
-
-Wed Sep 7 17:27:18 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/yaml.rb: explicitly specify ::Object to avoid the collision with
- Syck::Object.
-
-Tue Sep 6 21:06:49 2011 Shota Fukumori <sorah@tubusu.net>
-
- * lib/test/unit.rb (_run_suites): Now reports are written the
- following order: Skip, Failure, Error. [Feature #5282]
-
- * test_sorting.rb: test for above.
-
- * test4test_sorting.rb: Ditto.
-
- * lib/test/unit.rb (run): Put RUBY_DESCRIPTION before quitting.
- [Feature #5282]
-
-Tue Sep 6 21:13:47 2011 Masaya Tarui <tarui@ruby-lang.org>
-
- * win32/Makefile.sub (INSNS): change command line option -Ks to -Ku
- for generate *.inc. because insns.def encoding has been changed SJIS
- to UTF-8. if $BASERUBY is 1.9, -Ks cause an error. [Feature #5128]
- (same as r33194)
-
-Tue Sep 6 15:55:24 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * transcode.c (load_transcoder_entry): concatenate paths directly.
-
- * encoding.c (load_encoding): predefined encoding names are safe.
- [ruby-dev:44469] [Bug #5279]
-
- * transcode.c (load_transcoder_entry): ditto.
-
-Tue Sep 6 12:07:10 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * transcode.c: enabled econv newline option.
-
-Tue Sep 6 06:44:57 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * numeric.c (dbl2ival): Fix Float#divmod and #round for 32 bit
- platform. part 1 of [bug #5276]
-
-Tue Sep 6 06:44:25 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * numeric.c (flo_round): Fix criteria for 32 bits platform
- part 2 of [bug #5276]
-
-Tue Sep 6 05:37:11 2011 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
-
- * test/rinda/test_rinda.rb (test_core_03_notify): Fixed test failures
- [ruby-dev:44430] [Ruby 1.9 - Bug #372]
-
-Mon Sep 5 20:59:30 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * insns.def: change encoding pragma for emacs (shift_jis to utf-8).
-
-Mon Sep 5 19:32:15 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * Makefile.in (INSNS): change command line option -Ks to -Ku for
- generate *.inc. because insns.def encoding has been changed SJIS to
- UTF-8. if $BASERUBY is 1.9, -Ks cause an error. [Feature #5128]
-
-Mon Sep 5 18:10:56 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * transcode.c (rb_econv_binmode): newline decorators are
- exclusive.
-
-Mon Sep 5 15:03:37 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * test/rubygems/test_gem_security.rb
- (test_class_build_self_signed_cert): reset opt[:trust_dir] to apply
- temporary Gem.user_home.
-
-Mon Sep 5 10:04:35 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * README.ja, README.EXT.ja: resolve conflicts. [ruby-dev:44459]
-
-Mon Sep 5 05:13:22 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * numeric.c (flo_round): Make Float#round round big values [bug
- #5272]
-
-Mon Sep 5 04:28:25 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * numeric.c (int_round): Integer#round always returns an Integer [Bug
- #5271]
-
-Sun Sep 4 22:28:50 2011 Shugo Maeda <shugo@ruby-lang.org>
-
- * lib/net/imap.rb (default_port, default_imap_port,
- default_tls_port, default_ssl_port, default_imaps_port):
- added methods for consistency with Net::POP.
- based on the patch by art lussos. [ruby-core:38997] [Bug #5198]
-
-Sun Sep 4 21:19:19 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-
- * Change encoding from EUC-JP to UTF-8. [Feature #5128]
-
-Sun Sep 4 00:47:39 2011 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * test/ruby/test_fiber.rb (TestFiber#test_no_valid_cfp):
- add a test. Unlike TestThread#test_no_valid_cfp,
- this test succeeds even if win32ole is required (see r33153).
-
-Sun Sep 4 00:11:49 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * variable.c (rb_const_set): show the previous definition
- location. [EXPERIMENTAL]
-
-Sat Sep 3 23:56:24 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * configure.in (sizeof_struct_dirent_too_small): check if struct
- dirent.d_name is too small.
-
- * configure.in (RUBY_MINGW32): take tool prefix from CC.
-
-Sat Sep 3 23:52:08 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (argf_next_argv): open in default text mode.
- [ruby-core:39234] [Bug #5268]
-
-Sat Sep 3 18:40:57 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * lib/thread.rb (SizedQueue#max=): raise ArgumentError if max is not
- positive number. patch by Masaki Matsushita.
- [ruby-dev:44449] [Bug #5259]
-
- * test/thread/test_queue.rb (test_sized_queue_initialize,
- test_sized_queue_assign_max): add tests for it.
-
-Fri Sep 2 21:11:16 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (validate_enc_binmode, prep_stdio): default to text mode on
- dosish platforms. [ruby-core:38822] [Bug #5164]
-
- * transcode.c (rb_econv_prepare_options): keep default ecflags
- unchanged if no options.
-
-Fri Sep 2 14:36:47 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_insnhelper.c (vm_search_const_defined_class): search
- ancestors only when global scope. [ruby-core:39227] [Bug #5264]
-
-Fri Sep 2 09:58:08 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (parser_tokadd_string, parser_yylex): ignore a backslash
- which prefixes an non-ascii character, which has no escape
- syntax. [ruby-core:39222] [Ruby 1.9 - Bug #5262]
-
-Fri Sep 2 04:05:25 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/visitors/yaml_tree.rb: emit strings tagged as
- ascii-8bit as binary in YAML.
- * test/psych/test_string.rb: corresponding test.
-
-Fri Sep 2 01:07:14 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * numeric.c (flo_round): substitute machine dependent magic number.
-
-Thu Sep 1 17:31:22 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * insns.def (defineclass), vm_insnhelper.c (vm_get_cvar_base): see
- also inherited constants for classes without superclass and
- modules. [ruby-core:37698] [Bug #3423]
-
-Thu Sep 1 16:18:44 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
-
- * Release GVL while OpenSSL's public key generation.
-
- t = Thread.new { print "."; sleep 0.1 }
- key = OpenSSL::PKey::RSA.new(2048)
- #=> Thread t works in parallel with public key generation if
- OS/machine allows it.
-
- This works with OpenSSL >= 0.9.8. From this version, it has new
- public key generation function which allows us to interrupt the
- execution while pkey generation iterations.
-
- * ext/openssl/extconf.rb: Check existence of OpenSSL's new public key
- generation function. (DH_generate_parameters_ex,
- DSA_generate_parameters_ex and RSA_generate_key_ex.
-
- * ext/openssl/ossl_pkey.{h,c} (ossl_generate_cb_2,
- ossl_generate_cb_stop): Added new callback function for OpenSSL pkey
- generation which handles Thread interruption by Ruby.
- ossl_generate_cb_stop is the unblock function(ubf) for Ruby which
- sets a stop flag. New pkey generation callback ossl_generate_cb_2
- checks the stop flag at each iterations of OpenSSL and interrupts
- pkey generation when the flag is set.
-
- * ext/openssl/ossl_pkey_dsa.c (dsa_generate): Call
- rb_thread_blocking_region with the above unblock function to release
- GVL while pkey generation.
-
- * ext/openssl/ossl_pkey_rsa.c (rsa_generate): ditto.
-
- * ext/openssl/ossl_pkey_dh.c (dh_generate): ditto.
-
- * test/openssl/test_pkey_{dh,dsa,rsa}.rb: Test it.
-
-Thu Sep 1 14:06:54 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_thread.rb (TestThread#test_no_valid_cfp): skip when
- win32ole is required. in such case, win32ole redefines
- Thread#initialize, and the block argument becomes to be not the top
- of the thread, then this testcase always fails.
-
-Thu Sep 1 10:20:50 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_io_m17n.rb (TestIO_M17N#test_{default_mode_on_dosish,
- default_mode_on_unix,text_mode,binary_mode}): sorry for wrong test
- committed in r33144. I'd misunderstood the spec of ruby's universal
- newline.
-
-Thu Sep 1 09:27:57 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * variable.c (rb_autoloading_value): Fix the order of definitions.
- It is used by autoload_defined_p.
-
-Wed Aug 31 17:28:23 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
-
- * variable.c (rb_autoload): There was a chance to run GC (from
- rb_str_new2()) before finishing autoload_data_i construction. It
- caused SEGV at rb_gc_mark() at autoload_i_mark.
-
- * variable.c (rb_autoload_load): Move RB_GC_GUARD() to proper
- position based on suggestion by CHIKANAGA Tomoyuki at
- http://d.hatena.ne.jp/nagachika/20110826/ruby_trunk_changes_33070_33078
-
- * variable.c (autoload_defined_p): Fix incompatible autoload behavior
- that causes Rails crash. Class definition instruction defined in
- 'defineclass' in insns.def always invokes rb_autoload_load for a
- constant. It's invoked for every class definition regardless of
- existence of autoload definition. rb_autoload_load checks if a
- constant is defined as autoloaded, but new thread-safe autoload
- returned different value if the constant is under autoloading.
-
-Wed Aug 31 17:20:56 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
-
- * Re-apply r33078, thread-safe autoload which is reverted at r33093.
-
-Wed Aug 31 16:28:04 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_io_m17n.rb (TestIO_M17N#test_{default_mode_on_dosish,
- default_mode_on_unix,text_mode,binary_mode}): tests for [Bug #5164].
-
-Wed Aug 31 15:54:11 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/json: Merge json gem v1.5.4 (3dab4c5a6a97fac03dac).
-
-Wed Aug 31 13:09:41 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
-
- * numeric.c (flo_round): Avoid overflow by optimizing for trivial
- cases [Bug #5227]
-
-Wed Aug 31 00:50:01 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c (rb_w32_select_with_thread): and my typo. we all must
- be more careful.
-
-Wed Aug 31 00:48:38 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * thread.c (rb_thread_select): critical typo in r33117.
-
-Wed Aug 31 00:30:49 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/-ext-/old_thread_select/test_old_thread_select.rb
- (TestOldThreadSelect#test_old_select_read_timeout): if the machine
- is fast enough, the time used by code around IO.select may be smaller
- than Time implement threshold.
-
-Wed Aug 31 00:04:38 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * ext/-test-/old_thread_select/old_thread_select.c (old_thread_select):
- typo.
-
- * test/-ext-/old_thread_select/test_old_thread_select.rb
- (TestOldThreadSelect#test_old_select_signal_safe): use SIGINT instead
- of SIGUSR1 because the former is general and the latter is platform
- dependent.
-
-Tue Aug 30 23:59:36 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * win32/win32.c, include/ruby/intern.h (rb_w32_fd_copy): implement
- for rb_thread_select() in thread.c. the use of rb_fd_copy() is
- introduced in r33117.
- [Bug #5251] [ruby-core:39195]
-
- * thread.c (rb_thread_select): must call rb_fd_init() before using
- rb_fdset_t. see the implementations of rb_fd_init()s if you want to
- know the reason.
-
-Tue Aug 30 22:34:45 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * test/dl/test_callback.rb (test_callback_with_string): prevents
- temporary string from GC.
-
-Tue Aug 30 22:25:38 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * vm_insnhelper.c (vm_call_cfunc): revert r33112. RB_GC_GUARD macro
- protect a VALUE from GC. It's not for general anti-optimizing
- purpose.
-
-Tue Aug 30 11:06:19 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * ext/json: Merge json gem 1.5.4+ (2149f4185c598fb97db1).
- [Bug #5173] [ruby-core:38866]
+ * lib/rubygems: Update to RubyGems 2.2.2 prerelease to check fixes to
+ CI.
+ * test/rubygems: ditto.
-Tue Aug 30 09:57:50 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Mon Feb 3 12:04:47 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * lib/thread.rb (Queue#pop): fix a race against Thread.wakeup.
- Patch by Masaki Matsushita <glass.saga at gmail dot com>
- [Bug #5195] [ruby-dev:44400]
+ * error.c: [DOC] Exception#cause may return nil. [ci skip]
-Tue Aug 30 09:48:07 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sun Feb 2 05:48:42 2014 Eric Wong <e@80x24.org>
- * cont.c (fiber_entry): fix stack allocation failure on Debian
- GNU/kFreeBSD.
- Patch by Lucas Nussbaum <lucas at lucas-nussbaum dot net>.
- [Bug #5241] [ruby-core:39147]
+ * io.c (rb_io_syswrite): add RB_GC_GUARD
+ [Bug #9472][ruby-core:60407]
-Tue Aug 30 09:28:01 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sat Feb 1 15:09:16 2014 Masaki Suketa <masaki.suketa@nifty.ne.jp>
- * thread.c (rb_thread_select): rewrite by using
- rb_thread_fd_select(). old one is EINTR unsafe.
- Patch by Eric Wong. [Bug #5229] [ruby-core:39102]
+ * ext/win32ole/win32ole.c (ole_typedesc2val): add VT_RECORD case.
- * test/-ext-/old_thread_select/test_old_thread_select.rb:
- a testcase for rb_thread_select().
- * ext/-test-/old_thread_select/old_thread_select.c: ditto.
- * ext/-test-/old_thread_select/depend: ditto.
- * ext/-test-/old_thread_select/extconf.rb: ditto.
+Sat Feb 1 06:38:51 2014 Zachary Scott <e@zzak.io>
-Tue Aug 30 09:08:22 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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
- * configure.in: fix a build failure on GNU Hurd.
- Patch by Samuel Thibault <sthibault at debian dot org>. Thank you!
- [Bug #5250] [ruby-core:39185]
+Sat Feb 1 06:30:20 2014 Zachary Scott <e@zzak.io>
-Sun Aug 29 23:22:00 2011 Kenta Murata <mrkn@mrkn.jp>
+ * error.c: [DOC] Document Exception#cause by @jasonrclark [ci skip]
+ [Fixes GH-519] https://github.com/ruby/ruby/pull/519
- * test/ruby/test_numeric.rb (test_num2long): modify a test against the
- change by r33108.
+Sat Feb 1 06:10:49 2014 Zachary Scott <e@zzak.io>
-Sun Aug 29 09:58:00 2011 Kenta Murata <mrkn@mrkn.jp>
+ * 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
- * numeric.c (bit_coerce): A Fixnum and a Bignum are only permitted for
- bitwise arithmetic with a Fixnum. #1792
+Sat Feb 1 06:04:56 2014 Zachary Scott <e@zzak.io>
- * test/ruby/test_fixnum.rb: add tests for the above change.
+ * numeric.c: [DOC] Fix typo in example for #step [ci skip]
+ Patch by @ksss [Fixes GH-522] https://github.com/ruby/ruby/pull/522
- * bignum.c (bit_coerce): A Fixnum and a Bignum are only permitted for
- bitwise arithmetic with a Bignum. #1792
+Fri Jan 31 17:01:47 2014 Eric Wong <e@80x24.org>
- * test/ruby/test_bignum.rb: add tests for the above change.
+ * ext/socket/init.c (rsock_socket0): split out SOCK_CLOEXEC version
+ * ext/socket/socket.c (rsock_socketpair0): ditto
+ [ruby-core:60377]
-Sun Aug 28 15:38:17 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+Fri Jan 31 03:48:40 2014 Eric Wong <e@80x24.org>
- * ext/date/date_parse.c (date_zone_to_diff): keep a temporary string
- stored in variable while the contents buffer is being used.
+ * benchmark/driver: avoid large alloc in driver process
+ [ruby-core:59869] [Bug #9430]
- * ext/date/date_parse.c (date_zone_to_diff): get rid of out of bounds
- memory read. [ruby-dev:44409] [Bug #5213]
+Thu Jan 30 14:45:49 2014 Shugo Maeda <shugo@ruby-lang.org>
-Sun Aug 28 05:29:50 2011 Ryan Davis <ryand-ruby@zenspider.com>
+ * configure.in: use $@ instead of $(.TARGET) because .TARGET is not
+ supported by GNU make.
- * lib/minitest/*: Imported minitest 2.5.1 (r6596)
- * test/minitest/*: ditto
+Thu Jan 30 08:26:21 2014 Yusuke Endoh <mame@tsg.ne.jp>
-Sat Aug 27 20:46:05 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+ * ext/fiddle/closure.c: use sizeof(*pcl) for correct sizeof value.
+ [ruby-core:57599] [Bug #8978].
- * vm.c (rb_vm_rewrite_dfp_in_errinfo): change return type
- to suppress a warning.
+Wed Jan 29 20:08:15 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_core.h: ditto.
+ * 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]
-Sat Aug 27 19:04:06 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Wed Jan 29 18:09:48 2014 Eric Wong <e@80x24.org>
- * internal.h (rb_strftime_timespec): moved from time.c and define only
- if ruby/encoding.h is included.
+ * io.c (nogvl_copy_stream_sendfile): remove socket check
+ [ruby-core:59856][Feature #9427]
- * internal.h (rb_strftime): ditto.
+Wed Jan 29 04:29:54 2014 Aaron Patterson <aaron@tenderlovemaking.com>
-Sat Aug 27 18:53:51 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+ * ext/openssl/ossl_ssl.c: pass read_nonblock options to underlying IO
+ when SSL session has not been started.
- * proc.c (proc_new): force to rewrite errinfo when calling Proc.new in ensure.
- [Bug #5234] [ruby-core:39125]
- This code will be removed after changing throw mechanism (see r33064).
+ * test/openssl/test_ssl.rb: test for change.
- * vm.c (rb_vm_rewrite_dfp_in_errinfo): new function.
+Wed Jan 29 03:49:36 2014 Aaron Patterson <aaron@tenderlovemaking.com>
- * vm.c (vm_make_env_each): changed accordingly.
+ * ext/fiddle/closure.c: use sizeof(*pcl) for correct sizeof value.
+ [ruby-core:57599] [Bug #8978]. Thanks mame!
- * vm_core.h: ditto.
+Wed Jan 29 03:36:42 2014 Eric Wong <e@80x24.org>
- * bootstraptest/test_flow.rb: add tests for above.
+ * doc/contributing.rdoc: allow/encourage other git hosts
+ [ruby-core:59807][misc #9421]
-Sat Aug 27 18:44:06 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Tue Jan 28 23:36:01 2014 Tanaka Akira <akr@fsij.org>
- * internal.h (rb_strftime_timespec): move to time.c because it depends
- encoding.h.
+ * ext/socket: Avoid redundant fcntl/fstat syscalls for cloexec
+ sockets.
+ Patch by Eric Wong. [ruby-core:59429] [Feature #9330]
-Sat Aug 27 18:17:58 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Tue Jan 28 20:51:07 2014 Tanaka Akira <akr@fsij.org>
- * strftime.c (rb_strftime_with_timespec): get enc argument to specify
- the encoding of the format. On Windows (at least Japanese Windows),
- Time#strftime("%Z") includes non ASCII in locale encoding (CP932).
- So convert locale to default internal. [ruby-core:39092] [Bug #5226]
+ * 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].
- * strftime.c (rb_strftime): ditto.
+Tue Jan 28 16:31:13 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * strftime.c (rb_strftime_timespec): ditto.
+ * 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]
- * internal.h (rb_strftime_timespec): follow above.
+Tue Jan 28 15:27:36 2014 NARUSE, Yui <naruse@ruby-lang.org>
- * time.c (rb_strftime_alloc): ditto.
+ * thread_pthread.c: rlimit is only available on Linux.
+ At least r44712 breaks FreeBSD.
+ [ruby-core:60113] [Bug #9454]
- * time.c (strftimev): ditto.
+Tue Jan 28 15:17:59 2014 Zachary Scott <e@zzak.io>
- * time.c (time_strftime): ditto.
+ * lib/set.rb: [DOC] Add examples for Set#intersect? and Set#disjoint?
+ Patch by xavier nayrac [Bug #9331] [ci skip]
- * time.c (time_to_s): the resulted string of Time#to_s is always
- ascii only, so this should be US-ASCII.
+Tue Jan 28 15:12:22 2014 Zachary Scott <e@zzak.io>
- * time.c (time_asctime): ditto.
+ * ext/zlib/zlib.c (rb_zlib_adler32): [DOC] Add example for adler32
+ Patch by Vajrasky Kok [Bug #9307] [ci skip]
-Sat Aug 27 11:18:12 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+Tue Jan 28 08:56:00 2014 Charlie Somerville <charliesome@ruby-lang.org>
- * Revert r33078. It caused a Rails application NoMethodError.
+ * 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]
- /home/nahi/git/emptyApp/ruby/1.9.1/gems/rack-mount-0.6.14/lib/rack/mount/utils.rb:157: warning: toplevel constant ScanError referenced by Regin::Parser::ScanError
- /home/nahi/git/emptyApp/ruby/1.9.1/gems/rack-mount-0.6.14/lib/rack/mount/vendor/regin/regin/parser.rb:17:in `parse_regexp': undefined method `scan_str' for #<Regin::Parser:0x00000002344548> (NoMethodError)
+Mon Jan 27 21:52:55 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Aug 27 08:44:58 2011 Eric Hodel <drbrain@segment7.net>
+ * 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]
- * lib/rdoc: Import RDoc 3.9.4. Typo and grammar fixes by Luke Gruber.
- [Ruby 1.9 - Bug #5203]
+Sat Jan 25 22:17:02 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-Sat Aug 27 07:53:34 2011 Eric Hodel <drbrain@segment7.net>
+ * README.ja.md, README.md: update the controller address of
+ mailing lists.
- * lib/open-uri.rb: Fix indentation of OpenURI::OpenRead#open. Use ++
- instead of `' for method arguments in open-uri.rb
+Sat Jan 25 14:50:42 2014 Eric Wong <normalperson@yhbt.net>
-Sat Aug 27 07:22:07 2011 Eric Hodel <drbrain@segment7.net>
+ * process.c (send_child_error): retry write on EINTR to fix
+ occasional Errno::EINTR from Process.spawn.
- * ext/pathname/lib/pathname.rb: Fix typos and grammar mistakes. Patch
- by Luke Gruber. [#5203]
- * ext/pty/lib/expect.rb: ditto
- * lib/mathn.rb: ditto
- * lib/net/http.rb: ditto
- * lib/open-uri.rb: ditto
- * lib/ostruct.rb: ditto
- * lib/tempfile.rb: ditto
- * lib/thread.rb: ditto
- * lib/weakref.rb: ditto
- * sample/webrick/httpproxy.rb: ditto
+ * process.c (recv_child_error): retry read on EINTR to fix
+ occasional Errno::EINTR from Process.spawn.
-Sat Aug 27 04:03:18 2011 Koichi Sasada <ko1@atdot.net>
+Sat Jan 25 14:21:06 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * iseq.c (iseq_data_to_ary): fix type of variable
- (long -> unsigned long) to suppress a warning.
+ * 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 Aug 27 04:02:11 2011 Koichi Sasada <ko1@atdot.net>
+Sat Jan 25 11:16:19 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_core.h: add a decl. of rb_autoloading_value().
+ * 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 Aug 26 19:12:08 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+Fri Jan 24 15:13:20 2014 Zachary Scott <e@zzak.io>
- * variable.c: Make autoload thread-safe. See #921.
+ * lib/racc/rdoc/grammar.en.rdoc: [DOC] Correct grammar and typos
+ Patch by Giorgos Tsiftsis [Bug #9429] [ci skip]
- What's the problem?
- autoload is thread unsafe. When we define a constant to be
- autoloaded, we expect the constant construction is invariant. But
- current autoload implementation allows other threads to access the
- constant while the first thread is loading a file.
+Thu Jan 23 20:20:17 2014 Koichi Sasada <ko1@atdot.net>
- What's happening inside?
- The current implementation uses Qundef as a marker of autoload in
- Constant table. Once the first thread find Qundef as a value at
- constant lookup, it starts loading a defined feature. Generally a
- loaded file overrides the Qundef in Constant table by module/class
- declaration at very beginning lines of the file, so other threads
- can see the new Module/Class object before feature loading is
- finished. It breaks invariant construction.
+ * 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.
- How to solve?
- To ensure invariant constant construction, we need to override
- Qundef with defined Object after the feature loading. For keeping
- Qundef in Constant table, I expanded autoload_data struct in
- Module to have a slot for keeping the defined object while feature
- loading. And changed Module's constant lookup/update logic a
- little so that the slot is only visible from the thread which
- invokes feature loading. (== the first thread which accessed the
- autoload constant)
+Thu Jan 23 20:06:27 2014 Koichi Sasada <ko1@atdot.net>
- Evaluation?
- All test passes (bootstrap test, test-all and RubySpec) and added
- 8 tests for threading behavior. Extra logics are executed only
- when Qundef is found, so no perf drop should happen except
- autoloading.
+ * test/ruby/test_settracefunc.rb: check the target thread.
- * variable.c (rb_autoload): Prepare new autoload_data struct.
+Thu Jan 23 19:59:16 2014 Koichi Sasada <ko1@atdot.net>
- * variable.c (rb_autoload_load): Load feature and update Constant
- table after feature loading is finished.
+ * test/ruby/test_settracefunc.rb: check the target thread.
- * variable.c (rb_const_get_0): When the fetched constant is under
- autoloading, it returns the object only for the thread which starts
- autoloading.
+Thu Jan 23 14:26:44 2014 Zachary Scott <e@zzak.io>
- * variable.c (rb_const_defined_0): Ditto.
+ * lib/fileutils.rb: [DOC] Fix typo in options_of() example [Bug #9392]
+ Patch by Giorgos Tsiftsis
- * variable.c (rb_const_set): When the specified constant is under
- autoloading, it sets the object only for the thread which starts
- autoloading. Otherwise, simply overrides Qundef with constant
- override warning.
+Thu Jan 23 13:56:16 2014 Zachary Scott <e@zzak.io>
- * vm_insnhelper.c (vm_get_ev_const): Apply same change as
- rb_const_get_0 in variable.c.
+ * README -> README.md: [DOC] Format README with Markdown [Bug #9255]
+ * README.ja -> README.ja.md: ditto
- * test/ruby/test_autoload.rb: Added tests for threading behavior.
+Wed Jan 22 15:59:39 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Aug 26 10:10:37 2011 Eric Hodel <drbrain@segment7.net>
+ * ext/thread/thread.c (Init_thread): ConditionVariable and Queue
+ are not able to copy. [ruby-core:59961] [Bug #9440]
- * lib/rubygems: Update to RubyGems 1.8.10. Fixes security issue in
- creating ruby-format gemspecs. Fixes Gem.dir not being at the front
- of Gem.path to fix uninstall and cleanup commands. Fixes gem
- uninstall stopping on the first missing gem.
+Tue Jan 21 20:14:55 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Aug 26 08:21:10 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+ * 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]
- * time.c (strftimev): Make Time#to_s default to US-ASCII encoding but
- respect Encoding.default_internal. [ruby-core:39092]
- * test/ruby/test_time.rb (class TestTime): Corresponding test.
+Tue Jan 21 17:55:09 2014 Zachary Scott <e@zzak.io>
-Thu Aug 25 09:43:16 2011 Eric Hodel <drbrain@segment7.net>
+ * 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
- * ext/openssl/lib/openssl/bn.rb: Hide copyright info from RDoc.
- * ext/openssl/lib/openssl/digest.rb: ditto
- * ext/openssl/lib/openssl/x509.rb: ditto
- * ext/openssl/lib/openssl/cipher.rb: ditto
+Tue Jan 21 16:43:22 2014 Zachary Scott <e@zzak.io>
-Thu Aug 25 09:25:48 2011 Eric Hodel <drbrain@segment7.net>
+ * 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
- * ext/openssl/ossl_digest.c: Document OpenSSL::Digest::digest and add
- an example to OpenSSL::Digest. Patch by Sylvain Daubert.
- [Ruby 1.9 - Bug #5166]
- * ext/openssl/lib/openssl/digest.rb (module OpenSSL): ditto
+Tue Jan 21 16:26:44 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Aug 25 08:19:43 2011 Koichi Sasada <ko1@atdot.net>
+ * 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]
- * vm.c (vm_make_env_each): work around to solve Bug #2729.
- fixes: Bug #2729
- a patch from Kazuki Tsujimoto <kazuki@callcc.net>
- This problem is caused by changing dfp (dynamic env pointer)
- from saved dfp. Saved dfp is pointed env in VM stack. However,
- the dfp can be moved because VM copies env from VM stack to
- the heap. At this copying, dfp was also changed. To solve this
- problem, I'll try to change throw mechanism (not save target dfp,
- but save target cfp).
+Tue Jan 21 04:31:23 2014 Tanaka Akira <akr@fsij.org>
- * bootstraptest/test_flow.rb: add a test for above.
+ * ext/socket/option.c: Use "int" for IP_MULTICAST_LOOP and
+ IP_MULTICAST_TTL on Mac OS X and Windows.
-Thu Aug 25 07:57:33 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+Tue Jan 21 00:39:15 2014 Tanaka Akira <akr@fsij.org>
- * numeric.c (int_round): Fix Integer#round [ruby-core:39096]
+ * 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.
-Thu Aug 25 07:00:00 2011 Koichi Sasada <ko1@atdot.net>
+Mon Jan 20 20:20:27 2014 Tanaka Akira <akr@fsij.org>
- * vm_insnhelper.h, vm_insnhelper.c, vm.c, vm_method.c, insns.def:
- Manage a redefinition of special methods for each classes.
- A patch from Joel Gouly <joel.gouly@gmail.com>. Thanks!
+ * ext/socket/option.c: Use preprocessor macros to avoid repeated
+ conditionals.
-Thu Aug 25 06:51:08 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+Mon Jan 20 13:55:03 2014 Zachary Scott <e@zzak.io>
- * ext/psych/lib/psych.rb: Fixing psych version number.
- * ext/psych/psych.gemspec: updating the gemspec.
+ * lib/rubygems/version.rb: [DOC] Use gender-neutral pronouns [ci skip]
+ * lib/rubygems/security.rb: ditto
-Thu Aug 25 06:11:35 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+Sun Jan 19 06:38:48 2014 Benoit Daloze <eregontp@gmail.com>
- * ext/psych/lib/psych/nodes/node.rb: default `to_yaml` encoding to be
- UTF-8.
- * test/psych/test_encoding.rb: test yaml dump encoding.
+ * compar.c (cmp_equal): warn for this release and still rescue
+ standard exceptions for a nicer transition. See #7688.
+ Partly reverts r44502.
-Thu Aug 25 01:24:33 2011 Naohisa Goto <ngotogenome@gmail.com>
+ * test/ruby/test_comparable.rb: adapt assertion to match new behavior.
- * test/fileutils/test_fileutils.rb (test_chmod_symbol_mode): Solaris
- seems to behave the same as FreeBSD.
+Sun Jan 19 06:27:18 2014 Benoit Daloze <eregontp@gmail.com>
-Thu Aug 25 01:11:36 2011 Naohisa Goto <ngotogenome@gmail.com>
+ * test/ruby/test_comparable.rb: specify behavior for the different
+ kind of exceptions rescued (or not) by Comparable#==.
- * test/ruby/test_rubyoptions.rb (test_script_from_stdin): slave pty
- should be manipulated because master pty may not be a tty on some
- environment (e.g. Solaris). [Bug:#5222] [ruby-dev:44420]
+Sat Jan 18 23:12:19 2014 Tanaka Akira <akr@fsij.org>
-Wed Aug 24 15:13:56 2011 Koichi Sasada <ko1@atdot.net>
+ * ext/socket: Avoid unnecessary ppoll/select on Linux.
+ Patch by Eric Wong. [ruby-core:57950] [Bug #9039]
- * iseq.h, iseq.c, compile.c: Change the line number data structure
- to solve an issue reported at [ruby-dev:44413] [Ruby 1.9 - Bug #5217].
- Before this fix, each instruction has an information including
- line number (iseq::iseq_insn_info_table). Instead of this data
- structure, recording only line number changing places
- (iseq::iseq_line_info_table).
- The order of entries in iseq_line_info_table is ascending order of
- iseq_line_info_table_entry::position. You can get a line number
- by an iseq and a program counter with this data structure.
- This fix reduces memory consumption of iseq (bytecode).
- On my measurement, a rails application consumes 21.8MB for
- iseq with this fix on the 32bit CPU. Without this fix, it
- consumes 24.7MB for iseq [ruby-dev:44415].
+Sat Jan 18 22:57:44 2014 Tanaka Akira <akr@fsij.org>
- * proc.c: ditto.
+ * lib/resolv.rb (Resolv::DNS::Resource::TXT#data): Return concatenated
+ string.
+ Patch by Ryan Brunner. [ruby-core:58220] [Bug #9093]
- * vm_insnhelper.c: ditto.
+Sat Jan 18 22:35:15 2014 Tanaka Akira <akr@fsij.org>
- * vm_method.c: ditto.
+ * io.c (rb_update_max_fd): Return immediately if the given fd is small
+ enough.
- * vm.c (rb_vm_get_sourceline): change to use rb_iseq_line_no().
+Sat Jan 18 22:25:53 2014 Tanaka Akira <akr@fsij.org>
-Wed Aug 24 09:49:10 2011 Koichi Sasada <ko1@atdot.net>
+ * io.c: Test O_CLOEXEC only once.
+ Patch by Eric Wong. [ruby-core:59419] [Feature #9328]
- * insns.def (defined): fix to checking class variable.
- A patch by Magnus Holm <judofyr@gmail.com>. Thanks!
+Sat Jan 18 21:24:49 2014 Tanaka Akira <akr@fsij.org>
- * test/ruby/test_variable.rb: add a test for above.
+ * 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]
-Wed Aug 24 08:53:06 2011 Eric Hodel <drbrain@segment7.net>
+Sat Jan 18 21:19:04 2014 Tanaka Akira <akr@fsij.org>
- * lib/rdoc: Update to RDoc 3.9.3. Fixes RDoc with `ruby -Ku`. Allows
- HTTPS image paths to be turned into <img> tags. Prevents special
- markup inside <tt> from being processed.
+ * lib/open-uri.rb: Make proxy disabling working again.
+ Fixed by Christophe Philemotte. [ruby-core:59650] [Bug #9385]
-Wed Aug 24 07:57:43 2011 Eric Hodel <drbrain@segment7.net>
+Fri Jan 17 20:05:02 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/rubygems: Update to RubyGems 1.8.9. Fixes uninstalling multiple
- gems and gem cleanup.
+ * lib/delegate.rb (Delegator): keep source information methods
+ which start and end with '__'. [ruby-core:59718] [Bug #9403]
-Wed Aug 24 06:45:20 2011 Ryan Davis <ryand-ruby@zenspider.com>
+Fri Jan 17 17:58:04 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/minitest/*: Imported minitest 2.5.0 (r6557)
- * test/minitest/*: ditto
+ * eval.c (rb_mod_s_constants): return its own constants for other
+ than Module itself. [ruby-core:59763] [Bug #9413]
-Wed Aug 24 00:38:22 2011 Yusuke Endoh <mame@tsg.ne.jp>
+Tue Jan 16 00:17:00 2014 Kenta Murata <mrkn@mrkn.jp>
- * thread.c (update_coverage): skip coverage count up if the current
- line is out of the way. rb_sourceline() is unreliable when source
- code is big. [ruby-dev:44413]
+ * ext/bigdecimal/bigdecimal.gemspec: bigdecimal version 1.2.5.
- * test/coverage/test_coverage.rb: add a test for above.
+Wed Jan 15 20:30:31 2014 Masaki Matsushita <glass.saga@gmail.com>
-Tue Aug 23 15:23:56 2011 Eric Hodel <drbrain@segment7.net>
+ * io.c (io_binwrite): use writev(2) to avoid double write if available.
- * load.c (rb_f_require): Improve documentation of Kernel#require.
- [Ruby 1.9 - Bug #5210]
+ * configure.in: check writev(2)
-Tue Aug 23 11:27:26 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+Wed Jan 15 14:04:33 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/zlib/zlib.c (gzfile_read_header): Ensure that each section of
- gzip header is readable to avoid SEGV.
+ * string.c (get_encoding): respect BOM on pseudo encodings.
+ [ruby-dev:47895] [Bug #9415]
- * test/zlib/test_zlib.rb (test_corrupted_header): Test it.
+Wed Jan 15 14:03:47 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Aug 22 23:43:33 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+ * string.c (get_actual_encoding): get actual encoding according to
+ the BOM if exists.
- * sprintf.c (rb_str_format): add RB_GC_GUARD to prevent temporary
- strings from GC.
+ * string.c (rb_str_inspect): use according encoding, instead of
+ pseudo encodings, UTF-{16,32}. [ruby-core:59757] [Bug #8940]
-Sun Aug 21 17:49:53 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+Tue Jan 14 21:07:22 2014 Masaki Matsushita <glass.saga@gmail.com>
- * iseq.c (iseq_s_disasm): remove variable which is no longer used
- since r33013.
+ * ext/thread/thread.c (rb_szqueue_clear): notify SZQUEUE_WAITERS
+ on SizedQueue#clear. [ruby-core:59462] [Bug #9342]
-Sun Aug 21 14:20:58 2011 Naohisa Goto <ngotogenome@gmail.com>
+ * test/thread/test_queue.rb: add test. the patch is from
+ Justin Collins.
- * configure.in: use LD_LIBRARY_PATH_64 on 64-bit Solaris.
+Tue Jan 14 15:58:43 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sat Aug 20 13:19:52 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+ * ext/bigdecimal/bigdecimal.c (CLASS_NAME): macro to wrap
+ depending on PRIsVALUE for 1.9. [Backport #9406]
- * iseq.c (iseq_s_disasm): fix a bug that may cause SEGV.
+ * ext/bigdecimal/bigdecimal.c (DECIMAL_SIZE_OF_BITS): fallback
+ definition for 2.1 or older. [ruby-core:59750] [Backport #9406]
- * test/ruby/test_method.rb (test_body): add a test for the above change.
+Tue Jan 14 11:28:44 2014 Yuki Yugui Sonoda <yugui@google.com>
-Sat Aug 20 10:43:24 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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.
- * ext/stringio/stringio.c (strio_read): return new string if nil
- is explicitly given as a buffer ([Bug #5207]), otherwise set the
- encoding. also removed dead code.
+Tue Jan 14 02:20:00 2014 Kenta Murata <mrkn@mrkn.jp>
-Fri Aug 19 14:25:51 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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]
- * process.c (proc_spawn_v, proc_spawn): should not wait the
- spawned process.
+ * test/bigdecimal/test_bigdecimal.rb: tests for the above change.
- * process.c (proc_spawn_v): fix missing argument, and try with
- /bin/sh only if failed with ENOEXEC.
+ * ext/bigdecimal/bigdecimal.gemspec: bigdecimal version 1.2.4.
-Fri Aug 19 14:12:57 2011 Shugo Maeda <shugo@ruby-lang.org>
+Mon Jan 13 14:55:31 2014 Zachary Scott <e@zzak.io>
- * lib/net/imap.rb (idle): raises a Net::IMAP::Error when the
- connection is closed. based on the patch by Hugo Barauna.
- [Bug #5190] [ruby-core:38930]
+ * 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]
-Fri Aug 19 13:18:00 2011 Kenta Murata <mrkn@mrkn.jp>
+Mon Jan 13 14:47:07 2014 Zachary Scott <e@zzak.io>
- * configure.in: defines _DARWIN_UNLIMITED_SELECT if the target_os
- is darwin.
+ * 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
-Fri Aug 19 13:14:00 2011 Kenta Murata <mrkn@mrkn.jp>
+Mon Jan 13 14:25:55 2014 Zachary Scott <e@zzak.io>
- * thread.c: add a description for the behavior of select(2) on
- Mac OS X 10.7 (Lion).
+ * ext/openssl/ossl_pkey_dh.c: Fixed typo by Sandor Szuecs [Bug #9243]
-Fri Aug 19 11:28:58 2011 Shugo Maeda <shugo@ruby-lang.org>
+Mon Jan 13 12:03:00 2014 Charlie Somerville <charliesome@ruby-lang.org>
- * lib/net/imap.rb (msg_att): accepts extra space before ')'.
- based on the patch by art lussos. [Bug #5163] [ruby-core:38820]
+ * 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]
-Wed Aug 17 23:01:00 2011 Kenta Murata <mrkn@mrkn.jp>
+ * test/thread/test_queue.rb: add test
- * ext/bigdecimal/bigdecimal.c (cannot_be_coerced_into_BigDecimal):
- remove duplication.
+Sun Jan 12 16:41:10 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Aug 17 15:27:00 2011 Kenta Murata <mrkn@mrkn.jp>
+ * 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]
- * ext/bigdecimal/bigdecimal.c (cannot_be_coerced_into_BigDecimal):
- add a new function for raising error when an object cannot coerce
- into BigDecimal. [Bug #5172]
+Sun Jan 12 09:21:35 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/bigdecimal/bigdecimal.c (BigDecimalValueWithPrec): use
- cannot_be_coerced_into_BigDecimal function.
+ * include/ruby/util.h (DECIMAL_SIZE_OF_BITS): a preprocessor
+ constant macro to approximate decimal representation size of n-bits
+ integer.
- * ext/bigdecimal/bigdecimal.c (BigMath_s_exp): ditto.
+ * iseq.c (register_label): use DECIMAL_SIZE_OF_BITS for better
+ approximation.
* ext/bigdecimal/bigdecimal.c (BigMath_s_log): ditto.
- * test/bigdecimal/test_bigdecimal.rb: test for the above changes.
-
- * test/bigdecimal/testbase.rb (under_gc_stress): add a new utility
- method to run tests under the condition of GC.stress = true.
-
-Wed Aug 17 10:16:00 2011 Kenta Murata <mrkn@mrkn.jp>
-
- * rational.c (nurat_coerce): Rational#coerce should converts itself
- into Complex if the argument is a Complex with non-zero imaginary
- part. [Bug #5020] [ruby-dev:44088]
-
- * test/ruby/test_rational.rb (test_coerce): test for the above change.
-
-Wed Aug 17 06:33:19 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * ext/openssl/ossl_x509cert.c: Add class documentation for
- OpenSSL::X509::Certificate.
-
-Wed Aug 17 04:54:25 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * ext/openssl/ossl_pkey.c: corrected docs, OpenSSL::PKey::DH does
- *not* support #sign/verify.
-
-Tue Aug 16 18:56:54 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm.c (ruby_threadptr_data_type): rename to hide.
- [ruby-core:38972]
-
-Tue Aug 16 18:52:08 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * win32/mkexports.rb (Exports::Mswin#each_export): exclude Init_
- and _threadptr_ functions, as well as mingw.
-
-Tue Aug 16 09:31:44 2011 Eric Hodel <drbrain@segment7.net>
-
- * ext/dl: Add documentation. Patch by Vincent Batts.
- [Ruby 1.9 - Bug #5192]
-
-Tue Aug 16 08:48:26 2011 Eric Hodel <drbrain@segment7.net>
-
- * ext/.document (fiddle): Remove duplicate entry
- * ext/fiddle: Complete documentation of Fiddle. Patch by Vincent
- Batts. [#5192]
-
-Tue Aug 16 08:00:15 2011 Eric Hodel <drbrain@segment7.net>
-
- * ext/socket: Make Socket documentation appear. Add documentation for
- Socket, TCPServer, SOCKSSocket. Patch by Sylvain Daubert.
- [Ruby 1.9 - Feature #5182]
-
-Mon Aug 15 09:58:55 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * ext/openssl/ossl_ssl.c: Support disabling OpenSSL compression.
-
- * test/openssl/test_ssl.rb: Add a test for it.
- Thanks to Eric Wong for the patch.
- [Ruby 1.9 - Feature #5183] [ruby-core:38911]
-
-Sun Aug 14 05:57:01 2011 Tanaka Akira <akr@fsij.org>
-
- * test/socket/test_socket.rb (test_connect_timeout): added a test
- based on a patch by Eric Wong. [ruby-core:38910]
-
-Sat Aug 13 22:17:27 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * tool/mkconfig.rb: do not make the entries related to sitedir and
- verdordir if disabled by --without options. [ruby-core:38922]
- [Bug #5187]
-
-Sat Aug 13 17:03:22 2011 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_core.c: [ruby-core:38861]
-
-Sat Aug 13 09:39:07 2011 Tadayoshi Funaba <tadf@dotrb.org>
-
- * test/date/test_*.rb: added tests.
-
-Sat Aug 13 09:36:19 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * ext/date/date_parse.c (parse_ddd_cb): fix r32896. RB_GC_GUARD
- insertion position was mistaken. [ruby-dev:44337] [Bug #5152]
-
-Sat Aug 13 09:26:24 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/core_ext.rb: Make Kernel#y private.
- [ruby-core:38913]
-
- * test/psych/test_yaml.rb: corresponding test.
-
-Sat Aug 13 09:05:16 2011 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_core.c (date_strftime_alloc): followed the change
- of r32885.
-
- * doc/NEWS-1.9.3: followed the above change.
-
-Sat Aug 13 08:55:38 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/lib/psych/scalar_scanner.rb: Only consider strings
- with fewer than 2 dots to be numbers. [ruby-core:38915]
-
-Sat Aug 13 08:47:20 2011 Tadayoshi Funaba <tadf@dotrb.org>
-
- * ext/date/date_core.c: [ruby-core:38855].
-
-Sat Aug 13 03:41:37 2011 Eric Hodel <drbrain@segment7.net>
-
- * lib/uri/common.rb: Fix documentation of URI::Parser.new. Patch by
- Steve Klabnik. [Ruby 1.9 - Bug #5177]
-
-Sat Aug 13 02:19:57 2011 Eric Hodel <drbrain@segment7.net>
-
- * ext/digest/digest.c: Add documentation for the Digest module. Patch
- by Sylvain Daubert. [Ruby 1.9 - Bug #5167]
-
-Sat Aug 13 01:56:11 2011 Eric Hodel <drbrain@segment7.net>
-
- * lib/rake: Update to Rake 0.9.2.2. Prevent pollution of toplevel
- namespace by Commands. Remove unused variable and debugging
- statement in tests.
-
-Fri Aug 12 11:39:35 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * configure.in: Describe "no" configure option for site_ruby
- and vendor_ruby. Patch by Vit Ondruch. [Bug #5187][ruby-core:38921]
-
-Fri Aug 12 09:00:24 2011 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Import RubyGems 1.8.8. Fixes encoding of YAML gemspec
- from gems. Github Issue #149
-
-Fri Aug 12 08:17:46 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/ipsocket.c (init_inetsock_internal): use SOMAXCONN for
- listen backlog.
-
- * ext/socket/unixsocket.c (rsock_init_unixsock): ditto.
-
- * ext/socket/lib/socket.rb (Addrinfo#listen): ditto.
- (Socket.tcp_server_sockets_port0): ditto.
-
- * ext/socket/mkconstants.rb: define SOMAXCONN as 5 if not available.
-
- [ruby-core:38493]
-
-Fri Aug 12 03:24:35 2011 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc: Import RDoc 3.9.2. Fixes TIDYLINK for HTML output.
-
-Thu Aug 11 15:37:42 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
-
- * variable.c (autoload_delete): An autoload entry is still in a
- RCLASS_IV_TBL, not in a RCLASS_CONST_TBL, so take back the table
- changed in r29600. And an autoload entry keeps not a
- rb_const_entry_t but a NODE so remove rb_const_entry_t thing added
- in r29602.
-
-Thu Aug 11 15:07:36 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (link_command): use LIBRUBYARG in rbconfig for
- unbundled extensions. [ruby-core:38802] [Bug #5147]
-
- * lib/mkmf.rb (init_mkmf): revert r32902. [ruby-core:38903]
-
-Wed Aug 10 23:03:55 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/lib/socket.rb: fix argument check in the previous commit.
-
-Wed Aug 10 22:12:28 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/lib/socket.rb (Socket.tcp): add :connect_timeout option.
- (Addrinfo#connect_from): add :timeout option.
- (Addrinfo#connect): ditto.
- (Addrinfo#connect_to): ditto.
- [ruby-core:38538]
-
-Wed Aug 10 21:27:19 2011 Tanaka Akira <akr@fsij.org>
-
- * lib/net/pop.rb: fix typo in document.
-
- * lib/net/http.rb: ditto.
-
- * lib/net/imap.rb: ditto.
-
-Wed Aug 10 19:30:00 2011 Kenta Murata <mrkn@mrkn.jp>
-
- * complex.c (nucomp_rationalize): calls rationalize of real part if
- imaginary part is exactly zero. The patch is made by Marc-Andre
- Lafortune. fixes [Bug #5178] [ruby-core:38885]
-
- * test/ruby/test_complex.rb (test_rationalize): add a test for the
- above change.
-
- * complex.c (nucomp_to_r): fix RDoc comment. The patch is made by
- Marc-Andre Lafortune.
-
-Wed Aug 10 14:11:07 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (init_mkmf): set $LIBRUBYARG regardless of shared
- option. [ruby-core:38802] [Bug #5147]
-
-Wed Aug 10 02:53:27 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * lib/net/http.rb: come back autoload. OpenSSL constant is used
- some places, so it leads mistakes like HTTP.start.
-
-Tue Aug 9 22:57:45 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * ext/date/date_parse.c (date_zone_to_diff): add RB_GC_GUARD.
- [ruby-dev:44337] [Bug #5152]
-
- * ext/date/data_parse.c (parse_ddd_cb): ditto.
-
-Tue Aug 9 14:25:47 2011 Naohisa Goto <ngotogenome@gmail.com>
-
- * ext/fiddle/conversions.c (generic_to_value): ffi_arg and ffi_sarg
- should be used to handle shorter return value. fix [Bug #3861]
- [ruby-core:32504]
-
- * ext/fiddle/closure.c (callback): ditto
-
- * ext/fiddle/conversions.h (fiddle_generic): ditto
-
- * ext/fiddle/conversions.c (value_to_generic): char, short and int
- are strictly distinguished on big-endian CPU, e.g. sparc64.
-
-Tue Aug 9 11:21:08 2011 Narihiro Nakamura <authornari@gmail.com>
-
- * gc.c (gc_lazy_sweep): if sweep target slots are not found, we
- try heap_increment() because it might be able to expand the
- heap. [Bug #5127] [ruby-dev:44285]
-
- * gc.c (gc_clear_mark_on_sweep_slots): if a sweeping was
- interrupted, we expand the heap if at all possible.
-
-Tue Aug 9 12:20:33 2011 Naohisa Goto <ngotogenome@gmail.com>
-
- * test/fiddle/helper.rb (libc_so, libm_so): Solaris support added.
- [ruby-core:38853] [Bug #5168]
-
- * test/dl/test_base.rb (libc_so, libm_so): on Solaris, remove libc
- and libm version numbers for detecting default libc and libm.
-
-Tue Aug 9 09:18:04 2011 Eric Hodel <drbrain@segment7.net>
-
- * ext/zlib/zlib.c (gzfile_wrap): Document encoding options.
-
- * ext/zlib/zlib.c (rb_gzwriter_s_open): ditto
-
- * ext/zlib/zlib.c (rb_gzreader_s_open): ditto
-
-Sun Aug 7 23:31:32 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * time.c (rb_strftime_alloc): raise ERANGE if width is too large.
- Patch by Nobuyoshi Nakada. [Bug #4457] [ruby-dev:43285]
-
- * test/ruby/test_time.rb (class TestTime): add a test for the
- above change.
-
-Sun Aug 7 22:51:45 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * ext/openssl/ossl_asn1.c (decode_eoc): remove unused variables.
- Patch by Eric Wong. [Feature #5157] [ruby-core:38798]
-
- * ext/openssl/ossl_asn1.c (ossl_asn1_decode): ditto.
-
- * ext/openssl/ossl_pkey.c (ossl_pkey_new_from_data): ditto.
-
-Sun Aug 7 22:37:08 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * common.mk (iseq.o), ext/bigdecimal/depend (bigdecimal.o): add
+ dependency to ruby/util.h for DECIMAL_SIZE_OF_BITS.
- * configure.in: add -Wunused-variable to default CFLAGS.
- Patch by Eric Wong. [Feature #5157] [ruby-core:38798]
+Fri Jan 10 16:27:20 2014 Yuki Yugui Sonoda <yugui@google.com>
-Sun Aug 7 15:37:35 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * 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.
- * ext/digest/sha2/sha2ossl.c: use original SHA384_Final on DragonFly.
+Fri Jan 10 18:01:41 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Aug 7 14:08:16 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+ * vm_insnhelper.c (vm_search_super_method): allow bound method from a
+ module, yet another method transplanting.
- * ext/objspace/objspace.c: fix typos in a document.
+Fri Jan 10 13:34:04 2014 Aman Gupta <ruby@tmm1.net>
-Sun Aug 7 07:14:57 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * 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
- * cont.c (HAVE_GETCONTEXT): see getcontext(3) because DragonFly BSD
- x64 port doesn't have it.
+Fri Jan 10 06:23:21 2014 Benoit Daloze <eregontp@gmail.com>
-Sun Aug 7 00:42:55 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * range.c (Range#size): [DOC] improve description and add examples.
+ Patch by @skade. [Fixes GH-501]
- * ext/tk/lib/tk/wm.rb (Tk::Wm.command): Add the missing receiver
- before calling epath. patched by flori
- https://github.com/flori/ruby/commit/aa9474d32e5f2c57f8b0e2e0c528a03f06a4d433
+Fri Jan 10 00:47:52 2014 Josef Stribny <strzibny@gmail.com>
-Sat Aug 6 07:06:34 2011 Eric Hodel <drbrain@segment7.net>
+ * ext/tk/extconf.rb: fix to pass arrays instead of strings to
+ libpathflag. patch at [ruby-core:59665]. [Bug #9386]
- * marshal.c (w_object): Fix exception message when _dump_data is not
- defined on a T_DATA object.
+Thu Jan 9 20:49:22 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Aug 5 22:16:20 2011 Naohisa Goto <ngotogenome@gmail.com>
+ * configure.in: -mstackrealign is necessary for -msse2 working.
+ [ruby-core:54716] [Bug #8349]
- * numeric.c (rb_infinity, rb_nan): use WORDS_BIGENDIAN to get endian.
- fix [Bug #5160] [ruby-dev:44356]
+ * configure.in: use SSE2 instructions to drop unexpected precisions on
+ other than mingw. [ruby-core:59472] [Bug #8358]
-Fri Aug 5 17:14:11 2011 Akinori MUSHA <knu@iDaemons.org>
+Thu Jan 9 20:31:10 2014 NAKAMURA Usaku <usa@ruby-lang.org>
- * test/test_syslog.rb (TestSyslog#test_log): Do not be too
- specific about the log line format. Fixes #5081.
+ * hash.c (rb_objid_hash): should return `long'. brushup r44534.
-Fri Aug 5 15:57:10 2011 Naohisa Goto <ngotogenome@gmail.com>
+ * object.c (rb_obj_hash): follow above change.
- * complex.c (f_signbit): fix compile error in gcc4 on Solaris with
- CFLAGS="-std=gnu99". [ruby-dev:44355] fix [Bug #5159]
+Thu Jan 9 19:12:37 2014 Koichi Sasada <ko1@atdot.net>
- * math.c: ditto.
+ * vm.c (rb_vm_pop_cfunc_frame): added. It cares c_return event.
+ The patch base by drkaes (Stefan Kaes).
+ [Bug #9321]
-Fri Aug 5 15:55:33 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * variable.c (rb_mod_const_missing): use rb_vm_pop_cfunc_frame()
+ instead of rb_frame_pop().
- * test/ruby/test_object.rb: tests that respond_to? returns false.
+ * vm_eval.c (raise_method_missing): ditto.
-Fri Aug 5 13:32:43 2011 Shugo Maeda <shugo@ruby-lang.org>
+ * vm_eval.c (rb_iterate): ditto.
- * lib/xmlrpc/client.rb, lib/xmlrpc/server.rb: should use
- String#bytesize instead of String#size.
+ * internal.h (rb_vm_pop_cfunc_frame): add decl.
-Fri Aug 5 12:18:20 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_eval.c (check_funcall): try respond_to? first if redefined.
- [Bug #5158]
-
-Fri Aug 5 09:48:22 2011 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Import RubyGems 1.8.7:
- Added missing require for `gem uninstall --format-executable`.
-
- The correct name of the executable being uninstalled is now displayed
- with --format-executable.
-
- Fixed `gem unpack uninstalled_gem` default version picker.
-
- RubyGems no longer claims a nonexistent gem can be uninstalled.
-
- `gem which` no longer claims directories are requirable files.
-
- `gem cleanup` continues cleaning up gems if one can't be uninstalled
- due to permissions. Issue #82.
-
- Gem repository directories are no longer created world-writable.
- Patch by Sakuro OZAWA. [Ruby 1.9 - Bug #4930]
-
-Fri Aug 5 07:00:31 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * test/io/console/test_io_console.rb (test_noctty): daemon() on
- Fedora Rawhide seems not to detach the controlling terminal,
- when the argument noclose is non-zero. ref: [Bug #5135]
-
-Thu Aug 4 23:48:00 2011 Kenta Murata <mrkn@mrkn.jp>
-
- * thread_pthread.c (native_cond_signal): retry to call pthread_cond_signal
- and pthread_cond_broadcast if they return EAGAIN in
- native_cond_signal and native_cond_broadcast, respectively.
- It is for the pthread implementation of Mac OS X 10.7 (Lion).
- fixes #5155. [ruby-dev:44342].
-
- * thread_pthread.c (native_cond_broadcast): ditto.
-
- * thread_pthread.c (struct cached_thread_entry): stop using
- pthread_cond_t and its functions directly.
-
- * thread_pthread.c (register_cached_thread_and_wait): ditto.
-
- * thread_pthread.c (use_cached_thread): ditto.
-
-Thu Aug 4 20:29:41 2011 Naohisa Goto <ngotogenome@gmail.com>
-
- * configure.in: when Solaris cc, use $(CC) to link shared libs.
-
-Thu Aug 4 20:19:11 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * error.c (report_bug): use a small message buffer instead of BUFSIZ.
- It is needed for avoiding nested SIGSEGV on Linux.
- Note: BUFSIZ is not proper buffer size. It's unrelated with maximum
- filename length. :-/
- [Bug #5139] [ruby-dev:44315]
-
-Thu Aug 4 16:08:45 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * tool/rbinstall.rb (gem): install all gemspecs under lib and ext.
-
- * tool/rbinstall.rb (Gem::Specification): may not be defined when
- cross-compiling and BASERUBY is 1.8.
-
-Thu Aug 4 11:30:36 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * include/ruby/missing.h: define __syscall on OpenBSD as r32702.
-
-Thu Aug 4 03:02:54 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * tool/rbinstall.rb: use rubygems to load gemspecs, copy actual
- gemspecs on install rather than generate fake ones for all gems.
-
-Thu Aug 4 02:45:10 2011 Kenta Murata <mrkn@mrkn.jp>
-
- * configure.in: set CXX variable to the C++ compiler that matches the
- C compiler specified by CC variable (e.g. use g++-4.2 for gcc-4.2).
-
-Thu Aug 4 02:21:10 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * lib/mkmf.rb (link_command): use static library only for bundled
- extensions. [Bug #5147]
-
-Thu Aug 4 02:02:10 2011 Aaron Patterson <aaron@tenderlovemaking.com>
-
- * ext/psych/psych.gemspec: installing psych as a gem.
-
-Wed Aug 3 16:01:35 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * util.c, include/ruby/util.h (ruby_add_suffix): remove the function.
- [Bug #5153] [ruby-core:38736]
-
- * io.c (argf_next_argv): remove the call of above function.
-
- * ext/-test-/add_suffix, test/-ext-/test_add_suffix.rb: remove the test
- extension module because this is only for testing ruby_add_suffix().
-
- * LEGAL: remove the mention about a part of util.c, because now we
- removed the part.
-
- * io.c (argf_next_argv): now the new filename is not guaranteed to
- use, so should check the return value of rename(2).
-
- * test/ruby/test_argf.rb (TestArgf#test_inplace_rename_impossible):
- now we expect same result with other platforms on no_safe_rename
- platforms (=Windows).
-
-Wed Aug 3 09:18:08 2011 URABE Shyouhei <shyouhei@ruby-lang.org>
-
- * test/xmlrpc/webrick_testing.rb (WEBrick_Testing#start_server):
- Like r32795, bind address should be specified.
-
-Wed Aug 3 07:46:30 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * encoding.c (enc_find): mistakenly remained !. [Bug #5150]
-
-Wed Aug 3 00:11:08 2011 Tanaka Akira <akr@fsij.org>
-
- * lib/prettyprint.rb: update document. [ruby-core:36776]
-
-Tue Aug 2 22:04:46 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * gc.c (init_heap): allocate sigaltstack after heaps are allocated.
- [ruby-dev:44315] [Bug #5139]
-
- * vm.c (thread_free): use free because objspace is not ready.
-
- * vm.c (th_init): use malloc because objspace is not ready.
-
-Tue Aug 2 20:10:16 2011 Shota Fukumori <sorah@tubusu.net>
-
- * test/testunit/test_parallel.rb: pass "--ruby" option to
- test/testunit/tests_for_parallel/runner.rb. [Bug #5132] [ruby-dev:44303]
-
-Tue Aug 2 15:53:37 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * encoding.c (str_to_encoding): rename from to_encoding and
- use str_to_encindex.
-
- * encoding.c (str_to_encindex): split from to_encoding.
-
- * encoding.c (rb_to_encoding): use str_to_encoding.
-
- * encoding.c (rb_obj_encoding): don't bypass rb_encoding*.
- If it uses rb_encoding*, it bypass encindex. If it uses encindex,
- it doesn't bypass.
-
- * encoding.c (enc_find): add shortcut for encoding object, use
- str_to_encindex, and avoid bypass rb_encoding*.
-
-Tue Aug 2 12:03:16 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * hash.c (recursive_hash): hash value of emptied hash should be
- equal to an empty hash. [ruby-core:38650]
-
-Tue Aug 2 11:42:15 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * parse.y (rb_enc_symname2_p): :! is valid symbol. [Bug #5136]
-
-Tue Aug 2 07:33:29 2011 URABE Shyouhei <shyouhei@ruby-lang.org>
-
- * test/net/http/test_http.rb (TestNetHTTP_version_1_1_methods#test_timeout_during_HTTP_session):
- If you connect to localhost, you should listen localhost.
-
- * test/net/http/test_https.rb (TestNetHTTPS#test_timeout_during_SSL_handshake):
- ditto.
-
-Tue Aug 2 06:18:15 2011 Luis Lavena <luislavena@gmail.com>
-
- * lib/rubygems/installer.rb (class Gem): Correct path check on Windows
- Possible fix for [Ruby 1.9 - Bug #5111]
- * test/rubygems/test_gem_installer.rb (load Gem): ditto
-
-Mon Aug 1 20:12:03 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * test/ruby/test_process.rb (TestProcess#windows?): new method.
-
- * test/ruby/test_process.rb (TestProcess#*): use above method.
-
- * test/ruby/test_process.rb (TestProcess#test_execopts_redirect):
- windows doesn't support FD_CLOEXEC.
-
-Mon Aug 1 15:45:23 2011 Eric Hodel <drbrain@segment7.net>
-
- * test/rake/test_rake_functional.rb: Don't assume the binary name of
- ruby is "ruby". [Ruby 1.9 - Bug #5114]
- * test/rake/helper.rb: ditto
-
-Mon Aug 1 15:31:14 2011 URABE Shyouhei <shyouhei@ruby-lang.org>
-
- * test/io/console/test_io_console.rb (TestIO_Console#test_sync):
- Skip when PTY allocation failed (that's not our fault).
-
-Mon Aug 1 15:04:12 2011 URABE Shyouhei <shyouhei@ruby-lang.org>
-
- * test/xmlrpc/test_webrick_server.rb (Test_Webrick#setup_http_server):
- XMLRPC::Client.new3(), when called without host: argument, tries
- to connect to a host where "localhost" resolves to. On the
- other hand a WEBrick::HTTPServer.new(), when called without
- BindAddress: argument, tries to listen all the address where
- getaddrinfo(AF_UNSPEC) resolves to. This is a mismatch because
- "localhost" might not resolve to one of those listening sockets.
- We would better explicitly specify "localhost" here and if
- failed, just skip the whole test.
-
-Mon Aug 1 14:24:56 2011 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc.rb: Import RDoc 3.9.1. Fixes bugs in the RDoc::Markup
- parser.
-
-Mon Aug 1 12:00:35 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * insns.def (concatstrings): don't use initial ASCII-8BIT string.
- [ruby-core:38635] [Bug #5126]
-
-Sun Jul 31 22:57:16 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
-
- * enc/Makefile.in (ECHO1): Same as the recent fix in common.mk.
- ":" in a make variable replacement cause a syntax error with
- /usr/ccs/bin/make on Solaris. Uses $(NULLCMD) instead.
-
-Sun Jul 31 21:16:02 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
-
- * complex.c (f_signbit): gcc4 on Solaris DOES have signbit but does
- not have it on header.
-
- * math.c: ditto.
-
-Sun Jul 31 21:09:04 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
-
- * common.mk (node_name.inc): Use $(Q) for consistency.
-
- * Makefile.in (INSNS): ditto.
-
-Sun Jul 31 21:19:51 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
-
- * lib/mkmf.rb (configuration:ECHO1): Same as the recent fix in
- common.mk.
- ":" in a make variable replacement cause a syntax error with
- /usr/ccs/bin/make on Solaris. Uses $(NULLCMD) instead.
-
-Sun Jul 31 20:39:12 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
-
- * common.mk (ECHO1): nmake does not allow parenthesis in make variable
- replacement.
-
-Sun Jul 31 23:06:57 2011 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * vm.c (check_env): print debug messages to stderr.
- [Feature #4871] [ruby-dev:43743]
-
-Sun Jul 31 22:50:23 2011 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * vm.c (vm_make_env_each): don't save prev env value.
- It is no longer used. [Feature #4871] [ruby-dev:43743]
-
- * vm.c (check_env): changed accordingly.
-
-Sun Jul 31 20:21:36 2011 "Yuki Sonoda (Yugui)" <yugui@yugui.jp>
-
- * common.mk (ECHO1): ":" in a make variable replacement cause a syntax
- error with /usr/ccs/bin/make on Solaris. Uses $(NULLCMD) instead.
-
- * configure.in (NULLCMD): new check.
-
- * Makefile.in (NULLCMD): Reflects checking in configure.
-
- * win32/Makefile.sub (NULLCMD): new assignment.
-
-Sun Jul 31 18:58:59 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (rb_pipe): pipe on cygwin can succeed half but fail
- half.
-
-Sun Jul 31 11:31:07 2011 Kazuki Tsujimoto <kazuki@callcc.net>
-
- * vm.c: check if cfp is valid. [Bug #5083] [ruby-dev:44208]
-
-Sun Jul 31 09:18:28 2011 Eric Hodel <drbrain@segment7.net>
-
- * lib/rdoc: Update to RDoc 3.9. Fixed `ri []`, stopdoc creating an
- object reference, nodoc for class aliases, verbatim === lines.
-
-Sun Jul 31 01:29:08 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * io.c (rb_io_each_byte): remove unused variable e.
-
-Sat Jul 31 01:23:45 2011 Kenta Murata <mrkn@mrkn.jp>
-
- * test/bigdecimal/test_bigdecimal.rb (test_version): removed.
-
-Sat Jul 30 23:19:09 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * defs/default_gems: separate from tool/rbinstall.rb.
-
-Sat Jul 30 23:14:44 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * io.c (rb_io_each_byte): rbuf can be refreshed during yield.
- [Bug #5119]
-
-Sat Jul 30 22:35:50 2011 Naohisa Goto <ngotogenome@gmail.com>
-
- * strftime.c (NEEDS): avoid SEGV due to integer overflow in
- sparc-solaris2.10 and i686-linux. fix [Bug #4456] [ruby-dev:43284]
-
-Sat Jul 30 17:26:26 2011 Masaki Suketa <masaki.suketa@nifty.ne.jp>
-
- * test/win32ole/test_win32ole_variant.rb: use skip method to skip the test.
-
- * test/win32ole/test_win32ole_variant_outarg.rb: ditto.
-
-Sat Jul 30 14:27:00 2011 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/bigdecimal.c (BigDecimal_version): version 1.1.0.
-
- * ext/bigdecimal/bigdecimal.gemspec: turn into a default gem.
-
- * tool/rbinstall.rb: ditto.
-
-Sat Jul 30 11:21:55 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * vm_core.h (ALT_STACK_SIZE): use MINSIGSTKSZ*2 instead of SIGSTKSZ*2.
- [ruby-core:38607]
-
-Sat Jul 30 10:39:14 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * vm.c (th_init): preallocate alternative stack.
- NoMemoryError is better than rb_bug, of course.
- Patch by Eric Wong. [ruby-core:38572][ruby-core:38594].
-
- * signal.c (rb_register_sigaltstack): ditto.
-
- * vm_core.h: moved ALT_STACK_SIZE definition from signal.c.
- * vm.c (thread_free): use xfree() instead of free().
-
-Sat Jul 30 07:20:49 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/lib/socket.rb (udp_server_sockets): unused variable
- removed.
- patch by Jeremy Evans. [ruby-core:38600]
-
-Fri Jul 29 23:56:32 2011 Tanaka Akira <akr@fsij.org>
-
- * lib/securerandom.rb: call OpenSSL::Random.seed at the
- SecureRandom.random_bytes call.
- based on the patch by Masahiro Tomita. [ruby-dev:44270]
-
-Fri Jul 29 23:53:48 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * array.c (rb_ary_set_len): new function to set array length.
-
- * vm_eval.c (method_missing): set the length of argv array, to mark
- arguments.
-
- * vm_eval.c (rb_apply): get rid of too large alloca.
-
-Fri Jul 29 20:48:39 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/mkconstants.rb: fix typos.
-
-Fri Jul 29 20:28:56 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/mkconstants.rb: use whitespaces as a separator.
-
-Fri Jul 29 18:59:07 2011 Tanaka Akira <akr@fsij.org>
-
- * ext/socket/mkconstants.rb: add documents for constants.
- patch by Eric Hodel. [ruby-core:37853] [Bug #4989]
-
-Fri Jul 29 16:00:43 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * configure.in (enable_pthread): use -pthread on OpenBSD without
- explicit option. patched by Jeremy Evans. [ruby-core:38572]
-
-Thu Jul 28 23:36:28 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * ext/fiddle/closure.c (callback): use rb_ary_tmp_new() instead of
- xmalloc() to allocate an array for arguments of callback procedure,
- to prevent arguments from being swept by GC. [ruby-core:38546]
- [Bug #4929]
-
-Thu Jul 28 22:36:06 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
-
- * ext/openssl/ossl_cipher.c (ossl_cipher_initialize): Avoid possible
- SEGV from AES encryption/decryption. Processing data by
- Cipher#update without initializing key (meaningless usage of Cipher
- object since we don't offer a way to export a key) could cause SEGV.
-
- In OpenSSL, 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. See
- #2768.
-
- * test/openssl/test_cipher.rb: test it.
-
-Thu Jul 28 14:25:08 2011 NAKAMURA Usaku <usa@ruby-lang.org>
-
- * lib/rubygems/user_interaction.rb (Gem::StreamUI#tty?): typo.
-
-Thu Jul 28 12:32:53 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/dl/callback/mkcallback.rb (gencallback): use PTR2NUM.
-
- * ext/dl/cptr.c (rb_dlptr_aref, rb_dlptr_aset): check NULL pointer
- dereference.
-
- * ext/dl/cptr.c (rb_dlptr_s_to_ptr): use rb_check_funcall.
-
- * ext/dl/cptr.c (rb_dlptr_s_to_ptr): fix wrapping condition.
-
-Thu Jul 28 04:53:31 2011 Eric Hodel <drbrain@segment7.net>
-
- * lib/delegate.rb: Move file-level documentation to the appropriate
- classes.
-
-Thu Jul 28 02:15:04 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * ext/dl/cfunc.c (dlcfunc_mark), ext/dl/cptr.c (dlptr_mark):
- workaround to mark wrapped object. this is not a true fix,
- because [Bug #4929] is caused by the interface design of DL.
-
-Thu Jul 28 00:28:15 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * test/fileutils/test_fileutils.rb: add OpenBSD case.
- patched by Jeremy Evans [ruby-core:38530] see #5097
-
- * test/ruby/test_process.rb: ditto.
-
-Wed Jul 27 22:46:59 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
-
- * test/rinda/test_rinda.rb (test_remote_array_and_hash):
- add local variables to protect objects from GC. [ruby-dev:44253]
- [Bug #5104]
-
-Wed Jul 27 17:55:54 2011 NARUSE, Yui <naruse@ruby-lang.org>
-
- * include/ruby/missing.h: define __syscall if the platform has
- __syscall in the library but doesn't define it in headers
- for example Mac OS X.
-
-Wed Jul 27 15:39:14 2011 Eric Hodel <drbrain@segment7.net>
-
- * object.c: Add usage documentation for BasicObject. Based on patch
- by Thomas Sawyer. [Ruby 1.9 - Bug #5067]
-
-Wed Jul 27 12:24:17 2011 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems/uninstaller.rb: Add missing require and update
- messaging to avoid confusion with uninstall --format-executable.
- [Ruby 1.9 - Bug #4062]
-
-Wed Jul 27 09:34:24 2011 Eric Hodel <drbrain@segment7.net>
-
- * lib/rubygems: Update to RubyGems 1.8.6.1.
-
-Wed Jul 27 09:27:59 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
-
- * test/openssl/test_pkcs12.rb: Add test and intermediate certificates.
- [ Ruby 1.9 - Feature #3793 ] [ruby-core:32088]
-
-Wed Jul 27 01:05:32 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * eval_error.c (rb_print_undef_str): new function to raise
- NameError for undefined method.
-
- * load.c (rb_mod_autoload_p), object.c (rb_mod_const_get),
- variable.c (rb_f_untrace_var, set_const_visibility), vm_method.c
- (rb_mod_{remove,undef,alias}_method, set_method_visibility):
- remove inadvertent symbol creation. based on the first patch by
- Jeremy Evans at [ruby-core:38447]. [Feature #5089]
-
- * vm_method.c (obj_respond_to): fix the respond_to_missing? override
- case. based on the patch by Jeremy Evans at [ruby-core:38417].
- [Feature #5072]
-
- * parse.y (rb_check_id): make the given name a symbol or a string.
- based on the second patch by Jeremy Evans at [ruby-core:38447]
-
-Wed Jul 27 00:50:00 2011 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/lib/bigdecimal/util.rb (Rational#to_d):
- zero or negative precision is error. fixes #5098.
- [ruby-dev:44210]
-
- * test/bigdecimal/test_bigdecimal_util.rb: add test for the above
- change.
-
-Wed Jul 27 00:48:00 2011 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/lib/bigdecimal/util.rb (Float#to_d): modified for
- specifying precision. fixes #5098. [ruby-dev:44210]
-
- * test/bigdecimal/test_bigdecimal_util.rb: add test for the above
- change.
-
-Wed Jul 27 00:45:00 2011 Kenta Murata <mrkn@mrkn.jp>
-
- * ext/bigdecimal/lib/bigdecimal/util.rb (Integer#to_d): added
- for symmetry to BigDecimal() function with an Integer.
- fixes #5098. [ruby-dev:44210]
-
- * test/bigdecimal/test_bigdecimal_util.rb: add test for the above
- change.
-
-Wed Jul 27 00:30:00 2011 Kenta Murata <mrkn@mrkn.jp>
+ * test/ruby/test_settracefunc.rb: add tests.
+ provided by drkaes (Stefan Kaes).
- * ext/bigdecimal/lib/bigdecimal/util.rb (BigDecimal#to_d): added
- for adapting other Numeric subclasses. [ruby-dev:44245]
+ * 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.
- * test/bigdecimal/test_bigdecimal_util.rb: test for the above change.
+Thu Jan 9 17:40:28 2014 NAKAMURA Usaku <usa@ruby-lang.org>
-Wed Jul 27 00:27:00 2011 Kenta Murata <mrkn@mrkn.jp>
+ * 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.
- * bigdecimal/bigdecimal.c (VpDup) a new function for duplicating
- a BigDecimal.
+Thu Jan 9 09:55:20 2014 Aaron Patterson <aaron@tenderlovemaking.com>
- * bigdecimal/bigdecimal.c (BigDecimal_new): support generating a new
- BigDecimal from another BigDecimal using BigDecimal global function
- or constructor. [ruby-dev:44245]
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: dumping strings with
+ quotes should not have changed. [ruby-core:59316] [Bug #9300]
-Tue Jul 26 23:33:24 2011 Igor Zubkov <igor.zubkov@gmail.com>
+ * ext/psych/lib/psych.rb: fixed missing require.
- * array.c: Fix typo. https://github.com/ruby/ruby/pull/36
+ * test/psych/test_string.rb: test
-Mon Jul 25 23:51:01 2011 Yusuke Endoh <mame@tsg.ne.jp>
+Thu Jan 9 09:51:00 2014 Aaron Patterson <aaron@tenderlovemaking.com>
- * proc.c: pre-allocate the unlinked_method_entry_list_entry struct to
- avoid memory allocation during GC. based on a patch from Eric Wong.
- [ruby-core:38498]
+ * ext/psych/lib/psych/visitors/to_ruby.rb: anonymous structs
+ should be able to roundtrip. Thanks @splattael!
-Mon Jul 25 23:39:33 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * test/psych/test_object_references.rb: test for change
- * test/rake/test_rake_directory_task.rb (TestRakeDirectoryTask#
- test_directory_win32): fixed wrong test.
+Wed Jan 8 22:53:16 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Jul 25 22:36:11 2011 Yusuke Endoh <mame@tsg.ne.jp>
+ * 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]
- * proc.c (struct METHOD), gc.c (gc_marks), vm_method.c
- (rb_gc_mark_unlinked_live_method_entries): fix SEGV bug.
- rb_method_entry_t was free'd even when the method is still on the
- stack if it is BMETHOD (i.e., Method#call). This is because
- rb_method_entry_t is embedded in struct METHOD. This commit
- separates them and marks the live method entries.
- See [ruby-core:38449] in detail. fix [Bug #5047] [ruby-core:38171]
+Wed Jan 8 15:55:21 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Jul 25 22:14:37 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+ * hash.c (rb_objid_hash): return hash value from object ID with a
+ salt, extract from rb_any_hash().
- * lib/xmlrpc/client.rb: Fix possible HTTP header formatting failure by
- 'Basic' header. Long username caused the base64 String truncation in
- HTTP header which is not allowed. See #5046.
+ * object.c (rb_obj_hash): return same value as rb_any_hash().
+ fix r44125. [ruby-core:59638] [Bug #9381]
- * test/xmlrpc/test_webrick_server.rb: test it.
+Wed Jan 8 13:12:41 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Jul 25 15:04:33 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+ * lib/timeout.rb (Timeout::ExitException.catch): pass arguments
+ for new instance.
- * ext/openssl/lib/openssl.rb: End of transition period introduced by
- [ruby-dev:38018]. From the next version of 1.9.3, you should use
- require "openssl"
- instead of
- require "openssl/ssl"
- and
- require "openssl/x509"
+ * lib/timeout.rb (Timeout::ExitException#exception): fallback to
+ Timeout::Error if couldn't throw. [ruby-dev:47872] [Bug #9380]
-Mon Jul 25 13:46:38 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+ * lib/timeout.rb (Timeout#timeout): initialize ExitException with
+ message for the fallback case.
- * ext/openssl/lib/openssl/x509.rb: Cosmetic change: move definition
- introduced in r30152 to x509-internal.rb.
+Tue Jan 7 12:43:06 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Mon Jul 25 13:09:42 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+ * lib/timeout.rb (Timeout#timeout): should not rescue ordinarily
+ raised ExitException, which should not be thrown.
- * ext/openssl/ossl_ssl.c (ossl_ssl_shutdown): Avoid randomly generated
- SSLError from SSLSocket just after invoking SSLSocket#close.
- OpenSSL's SSL_shutdown could try to send alert packet and it might
- set SSLerr(global error stack) as the result. It causes the next
- SSL read/write operation to fail by unrelated reason.
+ * lib/timeout.rb (Timeout::ExitException.catch): set @thread only if
+ it ought to be caught.
- By design, we're ignoring any error at SSL_shutdown() so we clear
- global error stack after SSL_shutdown is called. See #5039.
+ * 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]
-Sun Jul 24 20:29:53 2011 Tanaka Akira <akr@fsij.org>
+Tue Jan 7 10:16:02 2014 Eric Hodel <drbrain@segment7.net>
- * ext/socket/extconf.rb: refine the recvmsg test.
+ * lib/rubygems: Update to RubyGems master 21e409d / RubyGems 2.2.1.
-Sun Jul 24 20:02:31 2011 Tanaka Akira <akr@fsij.org>
+ See http://rubygems.rubyforge.org/rubygems-update/History_txt.html
+ for a list of bug fixes.
- * ext/socket/extconf.rb: fix the recvmsg test.
+ * test/rubygems: ditto.
-Sun Jul 24 08:42:51 2011 Tanaka Akira <akr@fsij.org>
+Tue Jan 7 10:10:46 2014 Eric Wong <e@80x24.org>
- * ext/socket/extconf.rb: test recvmsg allocates file descriptors for
- fd passing even with MSG_PEEK.
+ * ext/json/generator/depend: add build dependencies for json extension
+ [Bug #9374] [ruby-core:59609]
+ * ext/json/parser/depend: ditto
- * ext/socket/ancdata.c: use the above test result.
+Tue Jan 7 04:35:46 2014 Aman Gupta <ruby@tmm1.net>
-Sun Jul 24 01:04:50 2011 Eric Hodel <drbrain@segment7.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.
- * lib/rubygems/specification.rb: Restore behavior of
- Gem::Specification#loaded. [Ruby 1.9 - Bug #5032]
+Mon Jan 6 21:28:48 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
-Sun Jul 24 00:05:00 2011 Jeremy Evans <merch-redmine@jeremyevans.net>
+ * .gitignore: ignore *-fake.rb generated even when CROSS_COMPILING = no
+ since r42862.
- * error.c (rb_name_error_str): new function to raise NameError
- with the name string but not ID.
+Sun Jan 5 20:14:14 2014 Benoit Daloze <eregontp@gmail.com>
- * object.c, proc.c, variable.c: more removal of inadvertent symbol
- creation. [Feature #5079]
+ * 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]
-Sat Jul 23 21:14:00 2011 Tadayoshi Funaba <tadf@dotrb.org>
+ * test/ruby/test_comparable.rb: adapt assertion to match new behavior.
- * lib/cmath.rb (cbrt): should return a real number if possible.
+ * lib/rdoc/method_attr.rb: fix bugs discovered by this change.
-Sat Jul 23 20:12:52 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * test/rdoc/test_rdoc_normal_class.rb: fix bugs in tests.
- * test/rake/test_rake_functional.rb (setup): Use __FILE__ for the base
- directory. Current directory is not the top source directory when
- the building process runs on other than there.
+Sat Jan 4 22:44:00 2014 Charlie Somerville <charliesome@ruby-lang.org>
- * test/rake/test_rake_rake_test_loader.rb: ditto.
+ * struct.c (rb_struct_set): return assigned value from setter method
+ rather than struct object. [Bug #9353] [ruby-core:59509]
- * test/rake/test_rake_task_argument_parsing.rb
- (test_terminal_width_using_hardcoded_80): hardcoded 80 is used
- when app.unix? is false.
+ * test/ruby/test_struct.rb (test_setter_method_returns_value): add test
-Sat Jul 23 20:11:50 2011 Tadayoshi Funaba <tadf@dotrb.org>
+Sat Jan 4 21:44:31 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
- * ext/date/date_core.c: an issue that is same as [ruby-dev:44071].
- * ext/date/date_strftime.c: identical to [ruby-dev:44112].
+ * test/ruby/test_gc.rb (TestGc#test_latest_gc_info): use
+ GC.stat(:key) instead of GC.stat.
-Sat Jul 23 19:12:53 2011 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+Sat Jan 4 19:15:29 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/win32ole/test_err_in_callback.rb (test_err_in_callback):
- skip test if ADODB.connection is not available.
+ * ext/socket/socket.c (rsock_syserr_fail_host_port): use format flags,
+ '+' to inspect, ' ' to quote unprintables.
-Sat Jul 23 15:37:04 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * ext/socket/socket.c (rsock_syserr_fail_path): ditto.
- * parse.y (rb_enc_symname_type): :$a!, @a! and so on are not
- valid symbols, so they should be inspected with quotes.
+ * ext/socket/socket.c (rsock_syserr_fail_raddrinfo): ditto.
-Sat Jul 23 17:06:25 2011 Tanaka Akira <akr@fsij.org>
+ * 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.
- * io.c (rb_update_max_fd): validate fd.
+ * ext/socket/socket.c (rsock_syserr_fail_path): ditto, and
+ rb_syserr_fail().
- * ext/socket/rubysocket.h (rsock_discard_cmsg_resource): add
- msg_peek_p argument for the declaration.
+ * ext/socket/socket.c (rsock_sys_fail_sockaddr): ditto, use
+ rsock_syserr_fail_raddrinfo().
- * ext/socket/ancdata.c (discard_cmsg): add msg_peek_p argument.
- assume FreeBSD, NetBSD and MacOS X doesn't generate passed fd
- when MSG_PEEK.
- (rsock_discard_cmsg_resource): add msg_peek_p argument.
- (bsock_recvmsg_internal): call rsock_discard_cmsg_resource with
- msg_peek_p argument.
+ * ext/socket/socket.c (rsock_sys_fail_raddrinfo): ditto.
- * ext/socket/unixsocket.c (unix_recv_io): call
- rsock_discard_cmsg_resource with msg_peek_p argument.
+ * ext/socket/socket.c (setup_domain_and_type): ditto.
-Sat Jul 23 14:38:28 2011 Eric Hodel <drbrain@segment7.net>
+Sat Jan 4 17:18:58 2014 Kazuki Tsujimoto <kazuki@callcc.net>
- * test/rake*: Remove dependencies on flexmock and session gems.
- [Ruby 1.9 - Bug #4987]
+ * vm.c (RubyVM::OPTS): get rid of a garbage character.
-Sat Jul 23 12:19:04 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Jan 4 10:17:54 2014 Eric Hodel <drbrain@segment7.net>
- * parse.y (rb_check_id): take care of attrset ID created
- implicitly by local ID. [Bug #5084]
+ * lib/rinda/ring.rb (Rinda::RingFinger#make_socket): Use
+ ipv4_multicast_ttl option for portability.
- * parse.y (rb_check_id): conversion condition was inverse.
- [Bug #5084]
+Sat Jan 4 10:15:47 2014 Eric Hodel <drbrain@segment7.net>
-Fri Jul 22 21:46:54 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * lib/rinda/ring.rb (Rinda::RingFinger#make_socket): Use
+ ipv4_multicast_loop option for portability. Patch by Jeremy Evans.
+ [ruby-trunk - Bug #9351]
- * vm_insnhelper.c (vm_call_cfunc): added volatile for a workaround
- of cfp consistency error problem on OS X 10.7 (Lion). It's
- suspected llvm optimization bug.
- [Bug #5074] [ruby-dev:44185]
+Fri Jan 3 19:09:00 2014 Eric Wong <normalperson@yhbt.net>
-Fri Jul 22 21:18:20 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * 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]
- * lib/uri/generic.rb (WFKV_): unroll the loop of regexp.
+ * 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
- * lib/uri/generic.rb (URI.decode_www_form_component): ditto.
+Fri Jan 3 10:43:57 2014 Aman Gupta <ruby@tmm1.net>
-Fri Jul 22 21:06:39 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * 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.
- * object.c (rb_mod_{const,cvar}_defined, rb_obj_ivar_defined):
- avoid inadvertent symbol creation in reflection methods. based
- on a patch by Jeremy Evans at [ruby-core:38367]. [Feature #5072]
+Fri Jan 3 00:09:54 2014 Benoit Daloze <eregontp@gmail.com>
- * vm_method.c (rb_mod_method_defined)
- (rb_mod_{public,private,protected}_method_defined)
- (obj_respond_to): ditto.
+ * ext/bigdecimal: update class method call style from :: to .
+ in documentation and usage.
- * parse.y (rb_check_id): new function returns already interned ID
- or 0.
+ * 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.
-Fri Jul 22 20:44:49 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * ext/bigdecimal/sample/nlsolve.rb: fix indent.
- * parse.y (rb_is_global_id, rb_is_attrset_id): add missing
- predicates.
+Thu Jan 2 16:07:21 2014 Masaki Matsushita <glass.saga@gmail.com>
-Fri Jul 22 20:24:38 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+ * io.c (io_fwrite): freeze converted str.
- * test/ruby/test_object.rb (TestObject#test_respond_to_missing):
- 2nd argument of respond_to_missing? is not optional.
+Thu Jan 2 04:15:13 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Jul 22 19:05:47 2011 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]
- * parse.y (rb_enc_symname2_p): get rid of potential out-of-bound
- access.
+Thu Jan 2 01:23:30 2014 Masaki Matsushita <glass.saga@gmail.com>
-Fri Jul 22 13:55:59 2011 Eric Hodel <drbrain@segment7.net>
+ * vm_eval.c (method_missing): use ALLOCV_N() instead of
+ ALLOCA_N() and rb_ary_tmp_new().
- * lib/net/http.rb: Net::HTTP#finish is used to manually close
- connections. [Ruby 1.9 - Bug #5045]
+Thu Jan 2 00:53:16 2014 Masaki Matsushita <glass.saga@gmail.com>
-Fri Jul 22 13:51:29 2011 Eric Hodel <drbrain@segment7.net>
+ * array.c (rb_ary_zip): use ALLOCV_N() instead of ALLOCA_N().
- * ext/readline/readline.c: Add examples for Readline.completion_proc=.
- [Ruby 1.9 - Bug #5057]
+Thu Jan 2 00:04:29 2014 Masaki Matsushita <glass.saga@gmail.com>
-Fri Jul 22 13:03:12 2011 Martin Bosslet <Martin.Bosslet@googlemail.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]
- * ext/openssl/ossl_hmac.c: Revert checking return type of
- HMAC_Init_ex as it is not compatible with OpenSSL < 1.0.0.
+ * internal.h: remove definition of rb_hash_keys().
-Fri Jul 22 12:10:21 2011 Eric Hodel <drbrain@segment7.net>
+Wed Jan 1 18:19:35 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * tool/rbinstall.rb (default gems): Install executables into the fake
- gem dir for Gem.bin_path. [#4485]
+ * configure.in: reset LDFLAGS and DLDFLAGS for opt-dir again after
+ LIBPATHFLAG and RPATHFLAG are set. [ruby-dev:47868] [Bug #9317]
-Fri Jul 22 11:20:20 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+Wed Jan 1 11:12:29 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/openssl/ossl_digest.c: Check return value of EVP_DigestInit_ex.
- * ext/openssl/ossl_hmac.c: Check return value of HMAC_Init_ex.
- Thanks, Jared Jennings, for the patch.
- [ Ruby 1.9 - Bug #4944 ] [ruby-core:37670]
+ * configure.in: use SSE2 instructions for drop unexpected
+ precisions. [ruby-core:54738] [Bug #8358]
-Fri Jul 22 09:09:43 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+Tue Dec 31 23:49:07 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/openssl/ossl_engine.c: Avoid double free of ENGINE reference.
- * test/openssl/test_engine.rb: Add a test for it.
- Thanks to Ippei Obayashi for providing the patch.
- [ Ruby 1.9 - Bug #5062 ] [ruby-dev:44173]
+ * eval.c (rb_f_raise): add cause: optional keyword argument.
+ [ruby-core:58610] [Feature #8257] [EXPERIMENTAL]
-Fri Jul 22 06:37:13 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+Tue Dec 31 21:44:17 2013 Akio Tajima <artonx@yahoo.co.jp>
- * lib/csv.rb: Do not modify CSV.generate's argument [ruby-core:38356]
+ * win32/Makefile.sub: remove HAVE_FSEEKO because fseeko removed from win32/win32.c
+ Fixed [Bug #9333].
-Thu Jul 21 20:59:59 2011 Tanaka Akira <akr@fsij.org>
+Tue Dec 31 21:02:27 2013 Masaki Matsushita <glass.saga@gmail.com>
- * ext/socket/ancdata.c (discard_cmsg): workaround for MacOS X Lion.
+ * io.c (io_fwrite): allocate frozen str only when str is not converted.
-Thu Jul 21 20:02:11 2011 Yusuke Endoh <mame@tsg.ne.jp>
+Tue Dec 31 15:44:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * thread.c (set_trace_func, thread_set_trace_func_m): reset tracing
- state when set_trace_func hook is removed. This is workaround patch
- to force to reset tracing state that is broken by continuation call.
- a patch from James M. Lawrence. [Feature #4347] [ruby-core:34998]
+ * lib/mkmf.rb (RbConfig): expand RUBY_SO_NAME for extensions
+ backward compatibility. [ruby-core:59426] [Bug #9329]
- * test/ruby/test_continuation.rb (class TestContinuation): add a test
- for above. a patch from James M. Lawrence.
+Mon Dec 30 23:33:07 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
-Thu Jul 21 19:27:19 2011 Yusuke Endoh <mame@tsg.ne.jp>
+ * variable.c: [DOC] adding extra example in docs.
+ patched by Steve Klabnik. [Bug #9210]
- * node.c (dump_node): add today's knowledge. "init arguments (m)" and
- "init arguments (p)" of compile.c indicates a Ruby code that
- evaluates multiple assignments that is in method or block
- parameters: def foo((m1,m2), (m3,m4), *r, (p1,p2), (p3,p4)); end
- The former (init arguments (m)) evaluates the multiple assignments
- before rest argument, that are (m1,m2) and (m3,m4). The letter
- (init arguments (p)) does ones after rest argument, that are
- (p1,p2) and (p3, p4).
+Mon Dec 30 18:34:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Thu Jul 21 18:11:07 2011 NARUSE, Yui <naruse@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]
- * enum.c (enum_inject): remove empty line to notify rdoc
- Enumerable#reduce is alias. patched by milki@github.
- https://github.com/ruby/ruby/pull/26
+Mon Dec 30 16:11:52 2013 WATANABE Hirofumi <eban@ruby-lang.org>
-Thu Jul 21 17:30:21 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * tool/make-snapshot: needs CXXFLAGS. [ruby-core:59393][Bug #9320]
- * array.c (rb_ary_delete_at_m): use simple array literal in rdoc.
- patched by samuel tonini. [ruby-core:38310] [Bug #5066]
+Sun Dec 29 18:36:54 2013 Shota Fukumori <her@sorah.jp>
-Thu Jul 21 17:14:21 2011 NARUSE, Yui <naruse@ruby-lang.org>
+ * lib/mkmf.rb (configuration): Make CXXFLAGS customizable.
+ Patch by Kohei Suzuki (eagletmt). [Fixes GH-492]
- * lib/webrick/httprequest.rb (WEBrick::HTTPRequest#each):
- Allow HTTP/0.9 request which doesn't has any header or body.
- patched by Felix Jodoin. [ruby-core:38040] [Bug #5022]
+Sun Dec 29 12:11:11 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Wed Jul 20 23:02:18 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+ * proc.c (mnew_from_me): keep iclass as-is, to make inheritance
+ chain consistent. [ruby-core:59358] [Bug #9315]
- * io.c (rb_update_max_fd): remove parentheses. they are not in
- macro.
+ * proc.c (method_owner): return the original defined_class from
+ prepended iclass, instead.
-Wed Jul 20 22:22:23 2011 Tanaka Akira <akr@fsij.org>
+Sun Dec 29 08:47:24 2013 Lucas Allan Amorim <lucas.allan@gmail.com>
- * include/ruby/intern.h (rb_update_max_fd): declaration moved from
- internal.h.
+ * test/ruby/test_sprintf.rb (test_hash): Added tests for sprintf
+ with a hash as parameter. [Fixes GH-491]
- * file.c: ditto.
+Sun Dec 29 07:27:51 2013 Benoit Daloze <eregontp@gmail.com>
- * io.c: call rb_update_max_fd for each new fds.
+ * 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.
- * process.c: ditto.
+Sat Dec 28 22:21:59 2013 Benoit Daloze <eregontp@gmail.com>
- * random.c: ditto.
+ * object.c (Kernel#<=>) surround Comparable operators with <code> tags.
+ The #== method was hidden in ri/rdoc's output and was highlighting
+ the line instead.
- * ruby.c: ditto.
+Sat Dec 28 17:24:00 2013 DV Suresh <e@dvsuresh.me>
- * ext/io/console/console.c: ditto.
+ * 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
- * ext/openssl/ossl_bio.c: ditto.
+Sat Dec 28 00:42:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/pty/pty.c: ditto.
+ * parse.y (local_push_gen, local_pop_gen): save cmdarg_stack to
+ isolate command argument state from outer scope.
+ [ruby-core:59342] [Bug #9308]
- * ext/socket/init.c: ditto.
+Fri Dec 27 13:25:03 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * ext/socket/socket.c: ditto.
+ * win32/{setup.mak,Makefile.sub}: update fake.rb like
+ template/fake.rb.in.
- * ext/socket/ancdata.c: ditto.
+Thu Dec 26 16:10:41 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * ext/socket/unixsocket.c: ditto.
+ * 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.
-Wed Jul 20 15:16:22 2011 NARUSE, Yui <naruse@ruby-lang.org>
+Thu Dec 26 14:25:03 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * ext/dl/handle.c (dlhandle_sym): clear previous error with dlerror()
- before calling dlsym(). [ruby-dev:44091] [Bug #5021]
+ * hash.c (HASH_REJECT_COPY_EXTRA_STATES): turn off the old
+ behavior, copying extra states by accident.
-Wed Jul 20 07:16:26 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+Thu Dec 26 10:49:14 2013 Yukihiro Matsumoto <matz@ruby-lang.org>
- * NEWS: mention Kernel#warn. [ruby-core:38119] [Feature #5029]
+ * version.h (RUBY_VERSION): 2.2.0 development has started.
-Tue Jul 19 16:40:45 2011 TAKANO Mitsuhiro (takano32) <tak@no32.tk>
+Thu Dec 26 10:27:53 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * cont.c (cont_save_thread): fix missing semicolon.
+ * tool/merger.rb (tag): support 2.1.1 semi-automatic tagging and 2.2.0
+ explicit tagging.
-Tue Jul 19 16:25:15 2011 Tanaka Akira <akr@fsij.org>
+Thu Dec 26 06:35:25 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
- * io.c (UPDATE_MAXFD): removed.
+ * proc.c: Having any mandatory keyword argument increases min arity
+ [#9299]
-Tue Jul 19 16:07:45 2011 Tanaka Akira <akr@fsij.org>
+Thu Dec 26 06:27:08 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
- * io.c (rb_update_max_fd): new function.
+ * proc.c: Having optional keyword arguments makes maximum arity +1,
+ not unlimited [#8072]
- * internal.h (rb_update_max_fd): declare rb_update_max_fd.
+Thu Dec 26 01:09:57 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * thread_pthread.c (rb_thread_create_timer_thread): update max fd when
- timer thread pipe is created.
+ * tool/release.sh: make symbolic links.
-Mon Jul 18 13:36:47 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+Thu Dec 26 00:45:33 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * ext/psych/lib/psych.rb: define a new BadAlias error class.
+ * tool/make-snapshot: support new version scheme.
- * ext/psych/lib/psych/visitors/to_ruby.rb: raise an exception when
- deserializing an alias that does not exist.
+Wed Dec 25 22:44:14 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * test/psych/test_merge_keys.rb: corresponding test.
+ * 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.
-Mon Jul 18 00:00:46 2011 Shugo Maeda <shugo@ruby-lang.org>
+ * iseq.c (rb_iseq_parameters): if no keyword check, keyword rest is
+ present.
- * ext/curses/curses.c: added the new class Curses::Pad, which
- supports scrolling. patch by Eric Hodel. [Feature #4896]
- [ruby-core:37206]
+ * parse.y (new_args_tail_gen): set keywords check to nd_cflag, which
+ equals to that keyword rest is not present.
-Sun Jul 17 16:26:40 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Wed Dec 25 22:32:19 2013 Zachary Scott <e@zzak.io>
- * error.c (rb_check_trusted): new function to check an object is
- trusted.
+ * lib/abbrev.rb: [DOC] rdoc format patch by Giorgos Tsiftsis [Bug #9146]
- * struct.c (rb_struct_modify), time.c (time_modify): check by the
- above function to show proper class names. [Bug #5036]
+Wed Dec 25 20:30:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Jul 17 15:30:04 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * iseq.c (rb_iseq_parameters): push argument type symbol only for
+ unnamed rest keywords argument.
- * error.c (rb_warn_m): accept multiple args in like puts. rdoc
- patch by Erik Price at [ruby-core:38119]. [Feature #5029]
+Wed Dec 25 20:28:48 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Sun Jul 17 07:56:31 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+ * proc.c (rb_iseq_min_max_arity): maximum argument is unlimited if
+ having rest keywords argument. [ruby-core:53298] [Bug #8072]
- * test/openssl/test_ssl_session.rb: add PEM SSL session without TLS
- extensions. Use this as the default for the tests to ensure
- compatibility with OpenSSL 0.9.7.
- [ Ruby 1.9 - Bug #4961 ] [ruby-core:37726]
+Wed Dec 25 18:29:22 2013 Koichi Sasada <ko1@atdot.net>
-Sat Jul 16 17:29:20 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+ * vm_insnhelper.c (argument_error): insert dummy frame to make
+ a backtrace object intead of modify backtrace string array.
+ [Bug #9295]
- * configure.in (RUBY_UNIVERSAL_ARCH): restore arch flag.
- Bug #4977
+ * 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.
-Sat Jul 16 06:27:51 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+Wed Dec 25 13:00:54 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * lib/uri/common.rb (module): Remove optional parser argument to
- Kernel#URI
- [ruby-core:38061]
+ * configure.in: let mingw do something black-magic, and check if
+ _gmtime64_s() is available actually.
- * lib/uri/generic.rb (module): ditto
+ * 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]
-Sat Jul 16 03:19:45 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Wed Dec 25 12:33:41 2013 Yusuke Endoh <mame@tsg.ne.jp>
- * win32/win32.c (is_socket, is_console): add prototypes to fix compile
- problem with gcc introduced at r32549.
- reported by Jon Forums. [Bug #5030] [ruby-core:38079]
+ * 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.)
-Sat Jul 16 00:55:38 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Wed Dec 25 10:42:02 2013 Yamashita Yuu <yamashita@geishatokyo.com>
- * time.c (time_dup): used rb_obj_class() instead of CLASS_OF().
- The patch is made by Kazuki Tsujimoto. [Bug #5012] [ruby-dev:44071]
+ * 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]
- * test/ruby/test_time.rb (TestTime#test_getlocal_dont_share_eigenclass):
- added a new test for eigenclass of time object.
+Wed Dec 25 01:03:00 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Fri Jul 15 19:11:00 2011 Kenta Murata <mrkn@mrkn.jp>
+ * 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]
- * bignum.c (bigsub_int): add RB_GC_GUARD. This patch is made by
- Makoto Kishimoto. fixes #4223 [ruby-dev:42907]
+Tue Dec 24 23:20:38 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * bignum.c (bigadd_int): ditto.
+ * test/fileutils/fileasserts.rb (assert_ownership_user): new
+ assertion for user ownership.
-Fri Jul 15 14:27:53 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+ * 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]
- * win32/win32.c, include/ruby/win32.h (rb_w32_io_cancelable_p): renamed
- from rb_w32_has_cancel_io(). now it takes a parameter as fd to check
- the fd is console or not, because we cannot cancel console input even
- if we have cancel_io function.
+Tue Dec 24 16:28:05 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * io.c (WAIT_FD_IN_WIN32): call above function instead of the old one,
- so now we can kill the thread which calls STDIN.gets.
- the problem was reported by ko1 via IRC.
+ * 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]
-Fri Jul 15 09:10:41 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+ * vm.c (rb_vm_cref_in_context): return ruby level cref if self is
+ same.
- * ext/digest/sha2/sha2.c (SHA256_Update, SHA512_Update): avoid Bus
- Error caused by unalignment access on Sparc-Solaris (and possibly on
- other similar environment.) This patch just do memcpy always instead
- of checking architecture. I see no perf drop on my 64bit env. For
- more details, see #4320.
+Tue Dec 24 14:13:14 2013 Koichi Sasada <ko1@atdot.net>
- * test/digest/test_digest.rb: add test for unalignment access.
+ * README.EXT: add a refer to URL.
-Fri Jul 15 01:51:25 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Tue Dec 24 13:48:45 2013 Koichi Sasada <ko1@atdot.net>
- * regint.h (PLATFORM_UNALIGNED_WORD_ACCESS): Power PC does not
- allow unaligned word access.
+ * README.EXT: add a document about RGenGC.
+ Reviewed by havenwood.
+ [misc #8962]
- * st.c (UNALIGNED_WORD_ACCESS): x86_64 allows unaligned word
- access as well as i386.
+ * README.EXT.ja: ditto.
-Thu Jul 14 12:19:34 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+Tue Dec 24 12:11:43 2013 Koichi Sasada <ko1@atdot.net>
- * ext/openssl/ossl.c (ossl_verify_cb): trap the exception from
- verify callback of SSLContext and X509Store and make the
- verification fail normally. Raising exception directly from callback
- causes orphan resources in OpenSSL stack. Patched by Ippei Obayashi.
- See #4445.
+ * include/ruby/ruby.h (RARRAY_ASET): try to avoid compiler warning.
+ [Bug #9287]
- * test/openssl/test_ssl.rb
- (test_exception_in_verify_callback_is_ignored): test it.
+Tue Dec 24 05:04:56 2013 NAKAMURA Usaku <usa@ruby-lang.org>
-Tue Jul 12 23:41:49 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * test/fileutils/test_fileutils.rb (setup): should not call
+ Process.groups for Windows. get rid of many errors introduced by
+ r44364.
- * NEWS: add a description of Signal.trap change.
+Mon Dec 23 18:37:16 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-Tue Jul 12 20:02:35 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * test/fileutils/fileasserts.rb (assert_ownership_group): new
+ assertion for group ownership.
- * signal.c (reserved_signal_p): reverted a part of r32523.
- chikanaga noticed trap(:CHLD) has some realworld usecase.
- * test/ruby/test_signal.rb (TestSignal#test_reserved_signal):
- ditto.
+ * test/fileutils/test_fileutils.rb (test_chown{,_verbose,_noop}):
+ based on the patch by vajrasky (Vajrasky Kok) at
+ [ruby-core:59281]. [Feature #9286]
-Tue Jul 12 17:12:45 2011 Yukihiro Matsumoto <matz@ruby-lang.org>
+Mon Dec 23 15:53:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * vm_method.c (rb_add_method): should not call method_added hook
- for undef operation. [Bug #5015]
+ * hash.c (HAS_EXTRA_STATES): warn extra states only when something
+ differ. [ruby-core:59254] [Bug #9275]
-Tue Jul 12 16:58:44 2011 Shota Fukumori <sorah@tubusu.net>
+Mon Dec 23 12:42:13 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
- * lib/test/unit.rb(Test::Unit::Options#process_args): Fix bug.
- Fix process_args didn't return `@option` after r30939.
+ * array.c: Have to_h raise on elements that are not key-value pairs
+ [#9239]
-Tue Jul 12 14:07:46 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * enum.c: ditto
- * signal.c (install_sighandler): fixed a race.
+Mon Dec 23 05:01:55 2013 Zachary Scott <e@zzak.io>
-Tue Jul 12 13:49:32 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+ * 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
- * signal.c (sig_trap): don't permit to change a signal handler which
- the interpreter reserved.
- * signal.c (reserved_signal_p): ditto.
- [Bug #2616] [ruby-core:27625]
+Mon Dec 23 03:18:09 2013 Zachary Scott <e@zzak.io>
- * test/ruby/test_signal.rb (TestSignal#test_reserved_signal):
- added a test for reserved signal.
+ * 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
-Tue Jul 12 11:58:28 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Sun Dec 22 23:56:56 2013 Zachary Scott <e@zzak.io>
- * win32/setup.mak: support x86-amd64 cross compile environment.
+ * lib/{rake,rdoc,rss}/*, test/rexml/test_listener.rb: [DOC] Fix typos
+ by @dvsuresh [Fixes GH-486] https://github.com/ruby/ruby/pull/486
-Mon Jul 11 23:22:28 2011 Yutaka Kanemoto <kanemoto@ruby-lang.org>
+Sun Dec 22 11:08:47 2013 Eric Hodel <drbrain@segment7.net>
- * time.c: can't compile time.c on AIX due to missing declaration for
- ffs(). It is declared in strings.h on AIX.
+ * test/rubygems/test_gem_ext_builder.rb: Fix warning due to ambiguous
+ expression.
-Mon Jul 11 15:54:24 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sun Dec 22 11:05:53 2013 Eric Hodel <drbrain@segment7.net>
- * process.c: removed signal() macro. It's no longer used.
+ * 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.
-Mon Jul 11 15:02:24 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+Sun Dec 22 10:23:40 2013 Eric Hodel <drbrain@segment7.net>
- * numeric.c (rb_num2ull): use FIX2LONG instead of FIX2ULONG. see
- rb_num2ulong(). fixed the problem of ObjectSpace._id2ref of IL32LLP64
- platforms, introduced at r32433.
+ * lib/rdoc.rb: Set RDoc to release version.
-Mon Jul 11 05:38:05 2011 Yutaka Kanemoto <kanemoto@ruby-lang.org>
+Sun Dec 22 10:19:07 2013 Eric Hodel <drbrain@segment7.net>
- * thread_pthread.c (get_stack): need to adjust stack addr for
- [Bug #1813] on AIX.
+ * lib/rubygems.rb: Set RubyGems to release version.
-Mon Jul 11 01:16:27 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+Sun Dec 22 10:16:08 2013 Eric Hodel <drbrain@segment7.net>
- * thread_pthread.c (rb_thread_create_timer_thread): removed
- rb_disable_interrupt()/rb_enable_interrupt().
- * vm_core.h: ditto.
- * process.c (static void before_exec): ditto.
- * process.c (static void after_exec): ditto.
- [Bug #4765] [ruby-dev:43571]
+ * lib/rubygems.rb (module Gem): Fix comment for
+ Gem::load_path_insert_index.
- * eval_intern.h: removed rb_trap_restore_mask().
- * vm_eval.c (rb_throw_obj): ditto.
- * eval.c (setup_exception): ditto.
+Sun Dec 22 04:07:55 2013 Koichi Sasada <ko1@atdot.net>
- * signal.c: removed trap_last_mask.
- * signal.c (trap_restore_mask): removed.
- * signal.c (init_sigchld): comment clarification why signal block
- is needed. and removed trap_last_mask operation.
- * signal.c (trap_ensure): removed trap_last_mask operation.
+ * 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]
- * signal.c (rb_disable_interrupt, rb_enable_interrupt): made
- static and removed sigdelset(SIGVTALRM) and sigdelset(SIGSEGV).
+Sat Dec 21 13:00:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * process.c (rb_syswait): removed implicit signal handler change.
+ * file.c: remove unnecessary the source path from EEXIST error
+ messages and show the destination path only. [ruby-core:59202]
+ [Feature #9263]
-Sun Jul 10 23:49:12 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+Sat Dec 21 12:37:19 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * docs/NEWS-1.9.3: moved from NEWS.
+ * lib/resolv.rb (Resolv::Hosts#lazy_initialize): should not
+ consider encodings in hosts file. [ruby-core:59239] [Bug #9273]
- * docs/ChangeLog-1.9.3: merged ChangeLog for 1.9.3.
+ * lib/resolv.rb (Resolv::Config.parse_resolv_conf): ditto.
- * NEWS: NEWS for 1.9.4 that describes changes since 1.9.3
+Sat Dec 21 05:43:27 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * ChangeLog: new ChangeLog for 1.9.4.
+ * tool/make-snapshot: replace RUBY_PATCHLEVEL_STR in version.h to
+ show users that this ruby is a preview/rc version.
-Sun Jul 10 23:30:52 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+Sat Dec 21 05:03:49 2013 NAKAMURA Usaku <usa@ruby-lang.org>
- * version.h (RUBY_VERSION): ruby_1_9_3 branch was forked.
+ * 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
diff --git a/LEGAL b/LEGAL
index 65706459cd..24e36e6231 100644
--- a/LEGAL
+++ b/LEGAL
@@ -5,6 +5,37 @@ 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]:
@@ -56,7 +87,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:
@@ -98,7 +129,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.
@@ -193,11 +224,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
@@ -210,8 +241,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
@@ -231,6 +262,34 @@ random.c
http://www.math.keio.ac.jp/matumoto/emt.html
email: matumoto@math.keio.ac.jp
+vm_dump.c:procstat_vm
+
+ * 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
@@ -476,7 +535,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.
@@ -527,7 +586,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 2d349e5201..39fe0bb37f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -40,6 +40,7 @@ datadir = @datadir@
arch = @arch@
sitearch = @sitearch@
sitedir = @sitedir@
+archlibdir = @archlibdir@
ruby_version = @ruby_version@
TESTUI = console
@@ -52,14 +53,17 @@ arch_hdrdir = $(EXTOUT)/include/$(arch)
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 = @CFLAGS@ $(ARCH_FLAG)
+CFLAGS_NO_ARCH = @CFLAGS@
+CFLAGS = $(CFLAGS_NO_ARCH) $(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)
@@ -86,7 +90,6 @@ 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)
@@ -110,8 +113,6 @@ XRUBY_LIBDIR = @XRUBY_LIBDIR@
XRUBY_RUBYLIBDIR = @XRUBY_RUBYLIBDIR@
XRUBY_RUBYHDRDIR = @XRUBY_RUBYHDRDIR@
-DEFAULT_PRELUDES = $(@USE_RUBYGEMS@_GEM_PRELUDE)
-
#### End of system configuration section. ####
MAJOR= @MAJOR@
@@ -134,6 +135,7 @@ PREP = @PREP@
ARCHFILE = @ARCHFILE@
SETUP =
EXTSTATIC = @EXTSTATIC@
+ENCSTATIC = @ENCSTATIC@
SET_LC_MESSAGES = env LC_MESSAGES=C
MAKEDIRS = @MKDIR_P@
@@ -168,8 +170,6 @@ SYMBOL_PREFIX = @SYMBOL_PREFIX@
INSTALLED_LIST= .installed.list
-MKMAIN_CMD = mkmain.sh
-
NEWLINE_C = newline.c
MINIPRELUDE_C = miniprelude.c
RBCONFIG = .rbconfig.time
@@ -181,6 +181,10 @@ OS_DEST_FILE = $@
MESSAGE_BEGIN = @for line in
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
@@ -189,8 +193,6 @@ configure_args = @configure_args@
all:
-.DEFAULT: all
-
# Prevent GNU make v3 from overflowing arg limit on SysV.
.NOEXPORT:
@@ -214,7 +216,7 @@ $(LIBRUBY_A):
$(Q) $(AR) $(ARFLAGS) $@ $(LIBRUBY_A_OBJS) $(DMYEXT)
@-$(RANLIB) $@ 2> /dev/null || true
$(ECHO) verifying static-library $@
- @$(PURIFY) $(CC) $(XLDFLAGS) $(MAINOBJ) $(LIBRUBY_A) $(MAINLIBS) $(EXTLIBS) $(LIBS) $(OUTFLAG)conftest$(EXEEXT) $(LDFLAGS)
+ @$(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINOBJ) $(LIBRUBY_A) $(MAINLIBS) $(EXTLIBS) $(LIBS) $(OUTFLAG)conftest$(EXEEXT)
@$(RM) conftest$(EXEEXT) conftest.c
$(LIBRUBY_SO):
@@ -223,7 +225,7 @@ $(LIBRUBY_SO):
$(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 if File.exist? link; \
+ @-$(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
@@ -253,17 +255,17 @@ install-cross: $(arch)-fake.rb $(RBCONFIG) rbconfig.rb $(arch_hdrdir)/ruby/confi
Makefile: $(srcdir)/Makefile.in $(srcdir)/enc/Makefile.in
-$(MKFILES): config.status
- @[ -f Makefile ] && mv Makefile Makefile.old
- MAKE=$(MAKE) $(SHELL) ./config.status
- @cmp Makefile Makefile.old > /dev/null 2>&1 && echo Makefile unchanged && exit 0; \
+$(MKFILES): config.status $(srcdir)/version.h
+ @[ -f $@ ] && mv $@ $@.old
+ MAKE=$(MAKE) $(SHELL) ./config.status $@
+ @cmp $@ $@.old > /dev/null 2>&1 && echo $@ unchanged && exit 0; \
{ \
echo "all:; -@rm -f conftest.mk"; \
echo "conftest.mk: .force; @echo AUTO_REMAKE"; \
echo ".force:"; \
} > conftest.mk || exit 1; \
$(MAKE) -f conftest.mk | grep '^AUTO_REMAKE$$' >/dev/null 2>&1 || \
- { echo "Makefile updated, restart."; exit 1; }
+ { echo "$@ updated, restart."; exit 1; }
uncommon.mk: $(srcdir)/common.mk
sed 's/{\$$([^(){}]*)[^{}]*}//g' $< > $@
@@ -324,6 +326,22 @@ 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 $<
@@ -403,24 +421,12 @@ 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
@@ -430,6 +436,11 @@ enc/encinit.$(OBJEXT): enc/encinit.c $(SETUP)
up::
@$(CHDIR) "$(srcdir)" && LC_TIME=C exec $(VCSUP)
+up::
+ -$(Q)$(MAKE) $(MFLAGS) after-update
+
+after-update:: update-config_files
+
update-mspec:
@$(CHDIR) $(srcdir); \
if [ -d spec/mspec ]; then \
@@ -455,6 +466,17 @@ update-rubyspec: update-mspec
test-rubyspec-precheck:
@if [ ! -d $(srcdir)/spec/rubyspec ]; then echo No rubyspec here. make update-rubyspec first.; exit 1; fi
+update-coverage:
+ @$(CHDIR) $(srcdir); \
+ if [ -d coverage/simplecov ]; then \
+ cd coverage/simplecov; \
+ echo updating simplecov ...; \
+ exec git pull; \
+ else \
+ echo retrieving simplecov ...; \
+ exec git clone $(SIMPLECOV_GIT_URL) coverage/simplecov; \
+ fi
+
INSNS = opt_sc.inc optinsn.inc optunifs.inc insns.inc insns_info.inc \
vmtc.inc vm.inc
@@ -463,3 +485,8 @@ $(INSNS): $(srcdir)/insns.def vm_opts.h \
$(srcdir)/tool/instruction.rb $(srcdir)/tool/insns2vm.rb
$(ECHO) generating $@
$(Q) $(BASERUBY) -Ku $(srcdir)/tool/insns2vm.rb $(INSNS2VMOPT) $@
+
+loadpath: verconf.h
+ @$(CPP) $(XCFLAGS) $(CPPFLAGS) $(srcdir)/loadpath.c | \
+ sed -e '1,/^const char ruby_initial_load_paths/d;/;/,$$d' \
+ -e '/^ /!d;s/ *"\\0"$$//;s/" *"//g'
diff --git a/NEWS b/NEWS
index 99c9e1dd26..6abfa3fc50 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,6 @@
# -*- rdoc -*-
-= NEWS for Ruby 2.0.0
+= NEWS for Ruby 2.2.0
This document is a list of user visible feature changes made between
releases except for bug fixes.
@@ -9,536 +9,247 @@ 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 1.9.3 release
+== Changes since the 2.1.0 release
=== Language changes
-* Added keyword arguments.
-
-* Added %i and %I for symbol list creation (similar to %w and %W).
-
-* Default source encoding is changed to UTF-8. (was US-ASCII)
-
-* No warning for unused variables starting with '_'
+* nil/true/false
+ * nil/true/false objects are frozen. [Feature #8923]
=== Core classes updates (outstanding ones only)
-* ARGF
- * added method:
- * added ARGF#codepoints and ARGF#each_codepoint, like the corresponding
- methods for IO.
+* Binding
+ * New methods:
+ * Binding#local_variables
+ * Binding#receiver
-* Array
- * added method:
- * added Array#bsearch for binary search.
- * incompatible changes:
- * random parameter of Array#shuffle! and Array#sample now
- will be called with one argument, maximum value.
- * when given Range arguments, Array#values_at now returns nil for each
- value that is out-of-range.
+* Dir
+ * New methods:
+ * Dir#fileno
* Enumerable
- * added method:
- * added Enumerable#lazy method for lazy enumeration.
-
-* Enumerator
- * added method:
- * added Enumerator#size for lazy size evaluation.
- * extended method:
- * Enumerator.new accept an argument for lazy size evaluation.
- * new class Enumerator::Lazy for lazy enumeration
-
-* ENV
- * aliased method:
- * ENV.to_h is a new alias for ENV.to_hash
+ * New methods:
+ * Enumerable#slice_after
+ * Extended methods:
+ * min, min_by, max and max_by supports optional argument to return
+ multiple elements.
-* Fiber
- * incompatible changes:
- * Fiber#resume cannot resume a fiber which invokes "Fiber#transfer".
+* Float
+ * New methods:
+ * Float#next_float
+ * Float#prev_float
* File
- * extended method:
- * File.fnmatch? now expands braces in the pattern if
- File::FNM_EXTGLOB option is given.
-
-* GC
- * improvements:
- * introduced the bitmap marking which suppresses to copy a memory page
- with Copy-on-Write.
- * introduced the non-recursive marking which avoids unexpected stack overflow.
-
-* GC::Profiler
- * added method:
- * added GC::Profiler.raw_data which returns raw profile data for GC.
+ * New methods:
+ * File.birthtime
+ * File#birthtime
-* Hash
- * added method:
- * added Hash#to_h as explicit conversion method, like Array#to_a.
- * extended method:
- * Hash#default_proc= can be passed nil to clear the default proc.
+* File::Stat
+ * New methods:
+ * File::Stat#birthtime
-* IO
- * deprecated methods:
- * IO#lines, #bytes, #chars and #codepoints are deprecated.
+* GC
+ * Improvements
+ * Introduce incremental marking for major GC. [Feature #10137]
* Kernel
- * added method:
- * added Kernel#Hash conversion method like Array() or Float().
- * added Kernel#__dir__ which returns the absolute path of the
- directory of the file from which this method is called.
- * added Kernel#caller_locations which returns an array of
- frame information objects.
- * extended method:
- * Kernel#warn accepts multiple args in like puts.
- * Kernel#caller accepts second optional argument `n' which specify
- required caller size.
- * Kernel#to_enum and enum_for accept a block for lazy size evaluation.
- * incompatible changes:
- * system() and exec() closes non-standard file descriptors
- (The default of :close_others option is changed to true by default.)
- * respond_to? against a protected method now returns false unless
- the second argument is true.
- * __callee__ has returned to the original behavior, and now
- returns the called name but not the original name in an
- aliased method.
- * Kernel#inspect does not call #to_s anymore
- (it used to call redefined #to_s).
-
-* LoadError
- * added method:
- * added LoadError#path method to return the file name that could not be
- loaded.
-
-* Module
- * added method:
- * added Module#prepend which is similar to Module#include,
- however a method in the prepended module overrides the
- corresponding method in the prepending module.
- * added Module.prepended and Module.prepend_features, similar
- to included and append_features.
- * added Module#refine, which extends a class or module locally.
- [experimental]
- * extended method:
- * Module#define_method accepts a UnboundMethod from a Module.
- * Module#const_get accepts a qualified constant string, e.g.
- Object.const_get("Foo::Bar::Baz")
-
-* Mutex
- * added method:
- * added Mutex#owned? which returns the mutex is held by current
- thread or not. [experimental]
- * incompatible changes:
- * Mutex#lock, Mutex#unlock, Mutex#try_lock, Mutex#synchronize
- and Mutex#sleep are no longer allowed to be used from trap handler
- and raise a ThreadError in such case.
- * Mutex#sleep may spurious wakeup. Check after wakeup.
-
-* NilClass
- * added method:
- * added nil.to_h which returns {}
-
-* ObjectSpace::WeakMap
- * new low level class to hold weak references to objects.
-
-* Proc
- * incompatible change:
- * removed Proc#== and #eql? so two procs are == only when they are
- the same object.
+ * New methods:
+ * Kernel#itself
* Process
- * added method:
- * added getsid for getting session id (unix only).
-
-* Range
- * added method:
- * added Range#size for lazy size evaluation.
- * added Range#bsearch for binary search.
-
-* RubyVM (MRI specific)
- * added RubyVM::InstructionSequence.of to get the instruction sequence
- from a method or a block.
- * added RubyVM::InstructionSequence#path, #absolute_path, #label,
- #base_label and #first_lineno to retrieve information from where
- the instruction sequence was defined.
- * added Environment variables to specify stack usage:
- * RUBY_THREAD_VM_STACK_SIZE: vm stack size used at thread creation.
- default: 128KB (32bit CPU) or 256KB (64bit CPU).
- * RUBY_THREAD_MACHINE_STACK_SIZE: machine stack size used at thread
- creation. default: 512KB or 1024KB.
- * 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 256KB.
- These variables are checked only at launched time.
- * added constant DEFAULT_PARAMS to get above default parameters.
-
-* Signal
- * added method:
- * added Signal.signame which returns signal name
-
- * incompatible changes:
- * Signal.trap raises ArgumentError when :SEGV, :BUS, :ILL, :FPE, :VTALRM
- are specified.
-
-* String
- * added method:
- * added String#b returning a copied string whose encoding is ASCII-8BIT.
- * change return value:
- * String#lines now returns an array instead of an enumerator.
- * String#chars now returns an array instead of an enumerator.
- * String#codepoints now returns an array instead of an enumerator.
- * String#bytes now returns an array instead of an enumerator.
-
-* Struct
- * added method:
- * added Struct#to_h returning values with keys corresponding to the
- instance variable names.
-
-* Thread
- * added method:
- * added Thread#thread_variable_get for getting thread local variables
- (these are different than Fiber local variables).
- * added Thread#thread_variable_set for setting thread local variables.
- * added Thread#thread_variables for getting a list of the thread local
- variable keys.
- * added Thread#thread_variable? for testing to see if a particular thread
- variable has been set.
- * added Thread.handle_interrupt as well as instance and singleton methods
- pending_interrupt? for asynchronous handling of exceptions
- * added Thread#backtrace_locations which returns similar information of
- Kernel#caller_locations.
- * new class Thread::Backtrace::Location to hold backtrace location
- information. These are returned by Thread#backtrace_locations and
- Kernel#caller_locations.
- * incompatible changes:
- * Thread#join and Thread#value now raises a ThreadError if target thread
- is the current or main thread.
-
-* Time
- * change return value:
- * Time#to_s now returns US-ASCII encoding instead of BINARY.
-
-* TracePoint
- * new class. This class is replacement of set_trace_func.
- Easy to use and efficient implementation.
-
-* toplevel
- * added method:
- * added main.define_method which defines a global function.
- * added main.using, which imports refinements into the current file or
- eval string. [experimental]
+ * Extended method:
+ * Process execution methods such as Process.spawn opens the file in write
+ mode for redirect from [:out, :err].
+ * Process creation methods, such as spawn(), uses vfork() system call.
+ vfork() is faster than fork() when the parent process uses huge memory.
+
+* Symbol
+ * Improvements
+ * Most symbols which are returned by String#to_sym and
+ String#intern are GC-able.
+
+* 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).
+
+* 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)
-* Array#values_at
-
- See above.
-
-* String#lines
-* String#chars
-* String#codepoints
-* String#bytes
+* GC
+ * incompatible changes:
+ * Rename GC.stat entries. [Feature #9924]
+ See https://docs.google.com/spreadsheets/d/11Ua4uBr6o0k-nORrZLEIIUkHJ9JRzRR0NyZfrhEEnc8/edit?usp=sharing
- These methods no longer return an Enumerator, although passing a
- block is still supported for backwards compatibility.
+* IO
+ * incompatible changes:
+ * When flushing file IO, 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.
- Code like str.lines.with_index(1) { |line, lineno| ... } no longer
- works because str.lines returns an array. Replace lines with
- each_line in such cases.
+* 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.
-* IO#lines
-* IO#chars
-* IO#codepoints
-* IO#bytes
-* ARGF#lines
-* ARGF#chars
-* ARGF#bytes
-* StringIO#lines
-* StringIO#chars
-* StringIO#codepoints
-* StringIO#bytes
-* Zlib::GzipReader#lines
-* Zlib::GzipReader#bytes
+* 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.
- These methods are deprecated in favor of each_line, each_byte,
- each_char and each_codepoint.
+* 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.
-* Proc#==
-* Proc#eql?
+=== Stdlib updates (outstanding ones only)
- These methods were removed. Two procs are == only when they are
- the same object.
+* Digest
+ * Digest::HMAC has been removed just as previously noticed.
-* Fixnum
-* Bignum
-* Float
+* Etc
+ * New methods:
+ * Etc.uname
+ * Etc.sysconf
+ * Etc.confstr
+ * IO#pathconf
- Fixnums, Bignums and Floats are frozen.
+* Find, Pathname
+ * Extended methods:
+ * find method accepts "ignore_error" keyword argument.
-* Signal.trap
+* Pathname
+ * Pathname#/ is aliased to Pathname#+.
+ * New methods:
+ * Pathname#birthtime
- See above.
+=== Stdlib compatibility issues (excluding feature bug fixes)
-* Merge Onigmo.
- https://github.com/k-takata/Onigmo
+* lib/mathn.rb
+ * Show deprecated warning [Feature #10169]
-* The :close_others option is true by default for system() and exec().
- Also, the close-on-exec flag is set by default for all new file descriptors.
- This means file descriptors doesn't inherit to spawned process unless
- explicitly requested such as system(..., fd=>fd).
+* ext/date/lib/date/format.rb
+ * Removed because it's empty file.
-* Kernel#respond_to? against a protected method now returns false
- unless the second argument is true.
+* Digest
+ * Digest::HMAC has finally ceased to exist. Use OpenSSL::HMAC or an external gem instead.
-* Kernel#respond_to_missing?
-* Kernel#initialize_clone
-* Kernel#initialize_dup
+* 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.
- These methods are now private.
+* lib/rational.rb
+ * Removed because it is deprecated from 2009.
-* Thread#join, Thread#value
+* lib/complex.rb
+ * Removed because it is deprecated from 2009.
- See above.
+* lib/prettyprint.rb
+ * Removed PrettyPrint#first?
-* Mutex#lock, Mutex#unlock, Mutex#try_lock, Mutex#synchronize and Mutex#sleep
+* lib/minitest/*.rb
+ * Removed because it conflicts to minitest 5. [Feature #9711]
- See above.
+* lib/test/**/*.rb
+ * Removed because it conflicts to minitest 5, and it was just an wrapper
+ of minitest 4. [Feature #9711]
-=== Stdlib updates (outstanding ones only)
+* lib/uri
+ * support RFC 3986. [Feature #2542]
-* cgi
- * Add HTML5 tag maker.
- * CGI#header has been renamed to CGI#http_header and
- aliased to CGI#header.
- * When HTML5 tagmaker called, overwrite CGI#header,
- CGI#header function is to create a <header> element.
-
-* CSV
- * Removed CSV::dump and CSV::load to protect users from dangerous
- serialization vulnerability
-
-* iconv
- * Iconv has been removed. Use String#encode instead.
-
-* io/console
- * new methods:
- * added IO#cooked which sets the terminal to cooked mode within the given block.
- * added IO#cooked! which sets the terminal to cooked.
- * extended method:
- * IO#raw, IO#raw!, and IO#getch accept keyword arguments, :min and :time.
-
-* io/wait
- * new features:
- * added IO#wait_writable method.
- * added IO#wait_readable method as alias of IO#wait.
-
-* json
- * updated to 1.7.7.
-
-* net/http
- * new features:
- * Proxies are now automatically detected from the http_proxy environment
- variable. See Net::HTTP::new for details.
- * gzip and deflate compression are now requested for all requests by
- default. See Net::HTTP for details.
- * SSL sessions are now reused across connections for a single instance.
- This speeds up connection by using a previously negotiated session.
- * Requests may be created from a URI which sets the request_uri and host
- header of the request (but does not change the host connected to).
- * Responses contain the URI requested which allows easier implementation of
- redirect following.
- * new methods:
- * Net::HTTP#local_host
- * Net::HTTP#local_host=
- * Net::HTTP#local_port
- * Net::HTTP#local_port=
- * extended method:
- * Net::HTTP#connect uses local_host and local_port if specified.
-
-* net/imap
- * new methods:
- * Net::IMAP.default_port
- * Net::IMAP.default_imap_port
- * Net::IMAP.default_tls_port
- * Net::IMAP.default_ssl_port
- * Net::IMAP.default_imaps_port
-
-* objspace
- * new method:
- * ObjectSpace.reachable_objects_from(obj)
-
-* openssl
- * Consistently raise an error when trying to encode nil values. All instances
- of OpenSSL::ASN1::Primitive now raise TypeError when calling to_der on an
- instance whose value is nil. All instances of OpenSSL::ASN1::Constructive
- raise NoMethodError in the same case. Constructing such values is still
- permitted.
- * TLS 1.1 & 1.2 support by setting OpenSSL::SSL::SSLContext#ssl_version to
- :TLSv1_2, :TLSv1_2_server, :TLSv1_2_client or :TLSv1_1, :TLSv1_1_server
- :TLSv1_1_client. The version being effectively used can be queried
- with OpenSSL::SSL#ssl_version. Furthermore, it is also possible to
- blacklist the new TLS versions with OpenSSL::SSL:OP_NO_TLSv1_1 and
- OpenSSL::SSL::OP_NO_TLSv1_2.
- * Added OpenSSL::SSL::SSLContext#renegotiation_cb. A user-defined callback
- may be set which gets called whenever a new handshake is negotiated. This
- also allows to programmatically decline (client) renegotiation attempts.
- * Support for "0/n" splitting of records as BEAST mitigation via
- OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS.
- * The default options for OpenSSL::SSL::SSLContext have changed to
- OpenSSL::SSL::OP_ALL & ~OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS
- instead of OpenSSL::SSL::OP_ALL only. This enables the countermeasure for
- the BEAST attack by default.
- * OpenSSL requires passwords for decrypting PEM-encoded files to be at least
- four characters long. This led to awkward situations where an export with
- a password with fewer than four characters was possible, but accessing the
- file afterwards failed. OpenSSL::PKey::RSA, OpenSSL::PKey::DSA and
- OpenSSL::PKey::EC therefore now enforce the same check when exporting a
- private key to PEM with a password - it has to be at least four characters
- long.
- * SSL/TLS support for the Next Protocol Negotiation extension. Supported
- with OpenSSL 1.0.1 and higher.
- * OpenSSL::OPENSSL_FIPS allows client applications to detect whether OpenSSL
- is FIPS-enabled. OpenSSL.fips_mode= allows turning on and off FIPS mode
- manually in order to adapt to situations where FIPS mode would be an
- explicit requirement.
- * Authenticated Encryption with Associated Data (AEAD) is supported via
- Cipher#auth_data= and Cipher#auth_tag/Cipher#auth_tag=.
- Currently (OpenSSL 1.0.1c), only GCM mode is supported.
-
-* ostruct
- * new methods:
- * OpenStruct#[], []=
- * OpenStruct#each_pair
- * OpenStruct#eql?
- * OpenStruct#hash
- * OpenStruct#to_h converts the struct to a hash.
- * extended method:
- * OpenStruct.new also accepts an OpenStruct / Struct.
-
-* pathname
- * extended method:
- * Pathname#find returns an enumerator if no block is given.
-
-* rake
- * rake has been updated to version 0.9.5.
-
- This version is backwards-compatible with previous rake versions and
- contains many bug fixes.
-
- See
- http://rake.rubyforge.org/doc/release_notes/rake-0_9_5_rdoc.html for a list
- of changes in rake 0.9.3, 0.9.4 and 0.9.5.
-
-* RDoc
- * RDoc has been updated to version 4.0
-
- This version is largely backwards-compatible with previous rdoc versions.
- The most notable change is an update to the ri data format (ri data must
- be regenerated for gems shared across rdoc versions). Further API changes
- are internal and won't affect most users.
-
- Notable changes include:
-
- * Page support for ri. Try `ri ruby:` for a list of pages in ruby or
- `ri ruby:syntax/literals` for the syntax documentation for literals.
-
- This also works for gems such as `ri rspec:README` for the rspec gem's
- README file.
- * Markdown support. See ri RDoc::Markdown for details.
-
- See https://github.com/rdoc/rdoc/blob/master/History.rdoc for a full list
- of changes in rdoc 4.0.
-
-* resolv
- * new methods:
- * Resolv::DNS#timeouts=
- * Resolv::DNS::Config#timeouts=
-
-* rexml
- * REXML::Document#write supports Hash arguments.
- * REXML::Document#write supports new :encoding option. It changes
- XML document encoding. Without :encoding option, encoding in
- XML declaration is used for XML document encoding.
-
-* RubyGems
- * Updated to 2.0.14.
-
- See http://rubygems.rubyforge.org/rubygems-update/History_txt.html#label-2.0.14+%2F+2013-11-12
- for release notes.
-
- * Updated to 2.0.10. This fixes CVE_2013-4363:
-
- http://rubygems.rubyforge.org/rubygems-update/CVE-2013-4363_txt.html
-
- * Updated to 2.0.8. This fixes CVE-2013-4287:
-
- http://rubygems.rubyforge.org/rubygems-update/CVE-2013-4287_txt.html
-
- * Updated to 2.0.0
-
- RubyGems 2.0.0 features the following improvements:
-
- * Improved support for default gems shipping with ruby 2.0.0+
- * A gem can have arbitrary metadata through Gem::Specification#metadata
- * `gem search` now defaults to --remote and is anchored like gem list.
- * Added --document to replace --rdoc and --ri. Use --no-document to
- disable documentation, --document=rdoc to only generate rdoc.
- * Only ri-format documentation is generated by default.
- * `gem server` uses RDoc::Servlet from RDoc 4.0 to generate HTML
- documentation.
-
- For an expanded list of updates and bug fixes see:
- https://github.com/rubygems/rubygems/blob/master/History.txt
-
-* shellwords
- * Shellwords#shellescape now stringifies the given object using to_s.
- * Shellwords#shelljoin accepts non-string objects in the given
- array, each of which is stringified using to_s.
-
-* stringio
- * deprecated methods:
- * StringIO#lines, #bytes, #chars and #codepoints are deprecated.
+* GServer
+ * GServer is extracted to gserver gem. It's unmaintain code.
-* syslog
- * Added Syslog::Logger which provides a Logger API atop Syslog.
- * Syslog::Priority, Syslog::Level, Syslog::Option and Syslog::Macros
- are introduced for easy detection of available constants on a
- running system.
+* Logger
+ * Logger::Application is extracted to logger-application gem. It's unmaintain code.
-* tmpdir
+* Prime
* incompatible changes:
- * Dir.mktmpdir uses FileUtils.remove_entry instead of
- FileUtils.remove_entry_secure. This means that applications should not
- change the permission of the created temporary directory to make
- accessible from other users.
-
-* yaml
- * Syck has been removed. YAML now completely depends on libyaml being
- installed.
- * libyaml is now bundled with ruby, for cases where the library is not
- installed locally.
-
-* zlib
- * Added streaming support for Zlib::Inflate and Zlib::Deflate. This allows
- processing of a stream without the use of large amounts of memory.
- * Added support for the new deflate strategies Zlib::RLE and Zlib::FIXED.
- * Zlib streams are now processed without the GVL. This allows gzip, zlib and
- deflate streams to be processed in parallel.
- * deprecated methods:
- * Zlib::GzipReader#lines and #bytes are deprecated.
+ * Prime.prime? now returns false for negative numbers. This method
+ should not be used to know the number is composite or not. [Bug #7395]
-=== Stdlib compatibility issues (excluding feature bug fixes)
-
-* OpenStruct new methods can conflict with custom attributes named
- "each_pair", "eql?", "hash" or "to_h".
-
-* Dir.mktmpdir in lib/tmpdir.rb
+* Psych
+ * Removed Psych::EngineManager [Bug #8344]
- See above.
+=== Built-in global variables compatibility issues
=== C API updates
-* NUM2SHORT() and NUM2USHORT() added. They are similar to NUM2INT, but short.
-
-* rb_newobj_of() and NEWOBJ_OF() added. They create a new object of a given class.
-
+* 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.
+
+* 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()` now share middle of a string,
+ but not only the end of a string. 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
diff --git a/README b/README
deleted file mode 100644
index cda6a93cd6..0000000000
--- a/README
+++ /dev/null
@@ -1,166 +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(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 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 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 6a622d2b11..f7ee0022df 100644
--- a/README.EXT
+++ b/README.EXT
@@ -125,12 +125,15 @@ 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".
+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)'. For arrays,
-use `RARRAY_LEN(ary)' and `RARRAY_PTR(ary)' respectively.
+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
@@ -205,6 +208,7 @@ 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)).
@@ -218,6 +222,7 @@ rb_str_vcatf(VALUE str, const char* format, va_list ap) ::
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.
@@ -250,15 +255,18 @@ 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.
@@ -272,12 +280,16 @@ types are given.
rb_ary_aref(argc, VALUE *argv, VALUE ary) ::
- Equivaelent to Array#[].
+ 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]
@@ -400,6 +412,11 @@ 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)
+
=== Constant Definition
We have 2 functions to define constants:
@@ -465,6 +482,16 @@ 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)
@@ -639,7 +666,7 @@ Here's the example of an initializing function.
{
/* define DBM class */
cDBM = rb_define_class("DBM", rb_cObject);
- /* DBM includes Enumerate module */
+ /* DBM includes Enumerable module */
rb_include_module(cDBM, rb_mEnumerable);
/* DBM has class method open(): arguments are received as C array */
@@ -672,10 +699,10 @@ 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) {\
+ #define GetDBM(obj, dbmp) do {\
Data_Get_Struct(obj, struct dbmdata, dbmp);\
if (dbmp->di_dbm == 0) closed_dbm();\
- }
+ } while (0)
This sort of complicated macro does the retrieving and close checking for
the DBM.
@@ -760,7 +787,7 @@ various conditions.
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 excutable file path
+ find_executable(bin[, path]): find executable file path
create_header(header): generate configured header
create_makefile(target[, target_prefix]): generate Makefile
@@ -853,7 +880,7 @@ lex.c :: automatically generated from keywords
eval_safe.c
insns.def : definition of VM instructions
iseq.c : implementation of VM::ISeq
- thread.c : thread management and context swiching
+ thread.c : thread management and context switching
thread_win32.c : thread implementation
thread_pthread.c : ditto
vm.c
@@ -882,7 +909,7 @@ lex.c :: automatically generated from keywords
== Utility Functions
-debug.c :: debug symbols for C debuggger
+debug.c :: debug symbols for C debugger
dln.c :: dynamic loading
st.c :: general purpose hash table
strftime.c :: formatting times
@@ -1057,6 +1084,10 @@ 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
@@ -1065,6 +1096,15 @@ 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
@@ -1075,7 +1115,8 @@ StringValuePtr(value) ::
StringValueCStr(value) ::
- Object with #to_str -> pointer to String data without NULL bytes
+ 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) ::
@@ -1239,10 +1280,18 @@ rb_scan_args(int argc, VALUE *argv, const char *fmt, ...) ::
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 by an array of values.
+ Invokes a method, passing arguments as an array of values.
+ Able to call only public methods.
VALUE rb_eval_string(const char *str) ::
@@ -1312,12 +1361,12 @@ 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 occured.
+ 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
- occured during func, it returns the result of func and *state is zero.
+ 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
@@ -1382,13 +1431,18 @@ void ruby_init() ::
Initializes the interpreter.
-void ruby_options(int argc, char **argv) ::
+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.
-void ruby_run() ::
+int ruby_run_node(void *n) ::
- Starts execution of the interpreter.
+ 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) ::
@@ -1465,6 +1519,159 @@ 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 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.
+
/*
* Local variables:
* fill-column: 70
diff --git a/README.EXT.ja b/README.EXT.ja
index 932a1c72d0..0ab61abcbe 100644
--- a/README.EXT.ja
+++ b/README.EXT.ja
@@ -111,8 +111,8 @@ FIXNUMとNILに関してはより高速な判別マクロが用意されてい
換結果がintのサイズに収まらない場合には例外を発生します.
それから,FIXNUMに限らずRubyのデータを整数に変換する
「NUM2INT()」および「NUM2LONG()」というマクロがあります.こ
-れらのマクロはマクロはデータタイプのチェック無しで使えます
-(整数に変換できない場合には例外が発生する).同様にチェック無
+れらのマクロはデータタイプのチェック無しで使えます
+(整数に変換できない場合には例外が発生する).同様にチェック無し
で使える変換マクロはdoubleを取り出す「NUM2DBL()」があります.
char* を取り出す場合, StringValue() と StringValuePtr()
@@ -140,13 +140,15 @@ var は lvalue である必要があります.
あるのは文字列と配列くらいだと思います.
ruby.hでは構造体へキャストするマクロも「RXXXXX()」(全部大文
-字にしたもの)という名前で提供されています(例: RSTRING()).
+字にしたもの)という名前で提供されています(例: RSTRING()).た
+だし、構造体への直接のアクセスはできるだけ避け,対応する
+rb_xxxx() といった関数を使うようにして下さい.例えば,配列の
+要素へアクセスする場合は,rb_ary_entry(ary, offset),
+rb_ary_store(ary, offset, obj) を利用するようにして下さい.
構造体からデータを取り出すマクロが提供されています.文字列
strの長さを得るためには「RSTRING_LEN(str)」とし,文字列strを
-char*として得るためには「RSTRING_PTR(str)」とします.配列の
-場合には,それぞれ「RARRAY_LEN(ary)」,「RARRAY_PTR(ary)」と
-なります.
+char*として得るためには「RSTRING_PTR(str)」とします.
Rubyの構造体を直接アクセスする時に気をつけなければならないこ
とは,配列や文字列の構造体の中身は参照するだけで,直接変更し
@@ -193,7 +195,7 @@ INT2NUM()は整数がFIXNUMの範囲に収まらない場合,Bignumに変換
Rubyが用意している関数を用いてください.
ここではもっとも使われるであろう文字列と配列の生成/操作を行
-い関数をあげます(全部ではないです).
+う関数をあげます(全部ではないです).
=== 文字列に対する関数
@@ -232,6 +234,7 @@ 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))と同等である.
@@ -245,6 +248,7 @@ rb_str_vcatf(VALUE str, const char* format, va_list ap)
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の文字列を生成する.
@@ -277,15 +281,18 @@ 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要素の配列を生成する.
@@ -306,6 +313,10 @@ 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]
@@ -506,13 +517,23 @@ IDとは変数名,メソッド名を表す整数です.Rubyの中では
rb_check_id(volatile VALUE *name)
rb_check_id_cstr(const char *name, long len, rb_encoding *enc)
-もし引数がシンボルでも文字列でもなければ、to_strメソッドで文
+もし引数がシンボルでも文字列でもなければ,to_strメソッドで文
字列に変換しようとします.第二の関数はその変換結果を*nameに保
存し,その名前が既知のシンボルでない場合は0を返します.この関
-数が0以外を返した場合は*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のメソッドを呼び出すためには以下
@@ -524,6 +545,7 @@ Cから文字列を経由せずにRubyのメソッドを呼び出すためには
します.その他に引数の指定の仕方が違う以下の関数もあります.
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の配列を与えます.
@@ -715,19 +737,19 @@ Rubyは拡張ライブラリをロードする時に「Init_ライブラリ名
{
/* DBMクラスを定義する */
cDBM = rb_define_class("DBM", rb_cObject);
- /* DBMはEnumerateモジュールをインクルードする */
+ /* 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");
}
@@ -741,8 +763,8 @@ dbm.cではData_Make_Structを以下のように使っています.
int di_size;
DBM *di_dbm;
};
-
-
+
+
obj = Data_Make_Struct(klass, struct dbmdata, 0, free_dbm, dbmp);
ここではdbmstruct構造体へのポインタをDataにカプセル化してい
@@ -752,10 +774,10 @@ dbm.cではData_Make_Structを以下のように使っています.
Dataオブジェクトからdbmstruct構造体のポインタを取り出すため
に以下のマクロを使っています.
- #define GetDBM(obj, dbmp) {\
+ #define GetDBM(obj, dbmp) do {\
Data_Get_Struct(obj, struct dbmdata, dbmp);\
if (dbmp->di_dbm == 0) closed_dbm();\
- }
+ } while (0)
ちょっと複雑なマクロですが,要するにdbmdata構造体のポインタ
の取り出しと,closeされているかどうかのチェックをまとめてい
@@ -1104,8 +1126,11 @@ Data_Get_Struct(data, type, sval) ::
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)
@@ -1255,10 +1280,18 @@ 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)
@@ -1310,7 +1343,7 @@ VALUE rb_block_call(VALUE obj, ID mid, int argc, VALUE * argv, VALUE (*func) (AN
func2をブロックとして設定し, func1をイテレータとして呼ぶ.
func1には arg1が引数として渡され, func2には第1引数にイテレー
タから与えられた値, 第2引数にarg2が渡される.
-
+
1.9でrb_iterateを使う場合は, func1の中でRubyレベルのメソッド
を呼び出さなければならない.
1.9でobsoleteとなった. 代わりにrb_block_callが用意された.
@@ -1396,13 +1429,16 @@ void ruby_init() ::
Rubyインタプリタの初期化を行なう.
-void ruby_options(int argc, char **argv) ::
+void *ruby_options(int argc, char **argv) ::
- Rubyインタプリタのコマンドライン引数の処理を行なう.
+ Rubyインタプリタのコマンドライン引数の処理を行ない,
+ Rubyのソースコードをコンパイルする.
+ コンパイルされたソースへのポインタ,もしくは特殊値を返す.
-void ruby_run() ::
+int ruby_run_node(void *n) ::
- Rubyインタプリタを実行する.
+ コンパイルされたコードを実行する.
+ 実行に成功した場合はEXIT_SUCCESSを,エラーが起こったときはそれ以外を返す.
void ruby_script(char *name) ::
@@ -1495,53 +1531,62 @@ have_macro(macro, headers) ::
have_library(lib, func) ::
関数funcを定義しているライブラリlibの存在をチェックする.
- ライブラリが存在する時,trueを返す.
+ チェックに成功すると,-llibを$libsに追加し,trueを返す.
find_library(lib, func, path...) ::
関数funcを定義しているライブラリlibの存在を -Lpath を追加
- しながらチェックする.ライブラリが見付かった時,trueを返す.
+ しながらチェックする.チェックに成功すると,-llibを$libsに
+ 追加し,trueを返す.
have_func(func, header) ::
ヘッダファイルheaderをインクルードして関数funcの存在をチェ
ックする.funcが標準ではリンクされないライブラリ内のもので
ある時には先にhave_libraryでそのライブラリをチェックしてお
- く事.関数が存在する時trueを返す.
+ く事.チェックに成功すると,プリプロセッサマクロ
+ `HAVE_{FUNC}` を定義し,trueを返す.
have_var(var, header) ::
ヘッダファイルheaderをインクルードして変数varの存在をチェッ
クする.varが標準ではリンクされないライブラリ内のものであ
る時には先にhave_libraryでそのライブラリをチェックしておく
- 事.変数が存在する時trueを返す.
+ 事.チェックに成功すると,プリプロセッサマクロ
+ `HAVE_{VAR}` を定義し,trueを返す.
have_header(header) ::
- ヘッダファイルの存在をチェックする.ヘッダファイルが存在す
- る時trueを返す.
+ ヘッダファイルの存在をチェックする.チェックに成功すると,
+ プリプロセッサマクロ `HAVE_{HEADER_H}` を定義し,trueを返す.
+ (スラッシュやドットはアンダースコアに置換される)
find_header(header, path...) ::
ヘッダファイルheaderの存在を -Ipath を追加しながらチェック
- する.ヘッダファイルが見付かった時,trueを返す.
+ する.チェックに成功すると,プリプロセッサマクロ
+ `HAVE_{HEADER_H}` を定義し,trueを返す.
+ (スラッシュやドットはアンダースコアに置換される)
have_struct_member(type, member[, header[, opt]]) ::
- ヘッダファイルheaderをインクルードして型typeにメンバmember
- が存在するかをチェックする.typeが定義されていて,memberを
- 持つする時trueを返す.
+ ヘッダファイルheaderをインクルードして型typeが定義され,
+ なおかつメンバmemberが存在するかをチェックする.チェックに
+ 成功すると,プリプロセッサマクロ `HAVE_{TYPE}_{MEMBER}` を
+ 定義し,trueを返す.
have_type(type, header, opt) ::
ヘッダファイルheaderをインクルードして型typeが存在するかを
- チェックする.typeが定義されている時trueを返す.
+ チェックする.チェックに成功すると,プリプロセッサマクロ
+ `HAVE_TYPE_{TYPE}` を定義し,trueを返す.
check_sizeof(type, header) ::
ヘッダファイルheaderをインクルードして型typeのchar単位サイ
- ズを調べる.typeが定義されている時そのサイズを返す.定義さ
- れていないときはnilを返す.
+ ズを調べる.チェックに成功すると,プリプロセッサマクロ
+ `SIZEOF_{TYPE}` を定義し,そのサイズを返す.定義されていな
+ いときはnilを返す.
create_makefile(target[, target_prefix]) ::
@@ -1582,11 +1627,37 @@ dir_config(target[, default_include, default_lib]) ::
と等価である.追加された include ディレクトリと lib ディレ
クトリの配列を返す. ([include_dir, lib_dir])
-pkg_config(pkg) ::
+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 関数を利用するようにして下さい.
- pkg-configコマンドからパッケージpkgの情報を得る.
- pkg-configの実際のコマンド名は,--with-pkg-configコマンド
- ラインオプションで指定可能.
+そのほか,対応についての詳細は README.EXT の「Appendix D. Generational
+GC」を参照して下さい.
/*
* Local variables:
diff --git a/README.ja b/README.ja
deleted file mode 100644
index 03c007af7c..0000000000
--- a/README.ja
+++ /dev/null
@@ -1,192 +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-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.jp まで.
--------------------------------------------------------
-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
new file mode 100644
index 0000000000..1e9bae7e0c
--- /dev/null
+++ b/README.ja.md
@@ -0,0 +1,163 @@
+# 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}/${PLATFOR
+ M}`
+ * `${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}/${P
+ LATFORM}`
+ * `${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` ファイルを参照してください。
+
+## 著者
+
+コメント,バグレポートその他は mailto:matz@ruby-lang.org まで.
+---
+created at: Thu Aug 3 11:57:36 JST 1995
diff --git a/README.md b/README.md
new file mode 100644
index 0000000000..c6498a8cca
--- /dev/null
+++ b/README.md
@@ -0,0 +1,161 @@
+# 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
+
+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}/${PLATFOR
+ M}`
+ * `${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}/${P
+ LATFORM}`
+ * `${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
+
+## The Author
+
+Ruby was originally designed and developed by Yukihiro Matsumoto (Matz) in
+1995.
+
+<mailto:matz@ruby-lang.org>
diff --git a/addr2line.c b/addr2line.c
index 72e2c15617..c8faf48d62 100644
--- a/addr2line.c
+++ b/addr2line.c
@@ -9,6 +9,7 @@
**********************************************************************/
#include "ruby/config.h"
+#include "ruby/missing.h"
#include "addr2line.h"
#include <stdio.h>
@@ -16,11 +17,6 @@
#ifdef USE_ELF
-#ifdef __OpenBSD__
-#include <elf_abi.h>
-#else
-#include <elf.h>
-#endif
#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
@@ -32,6 +28,12 @@
#include <sys/stat.h>
#include <unistd.h>
+#ifdef __OpenBSD__
+#include <elf_abi.h>
+#else
+#include <elf.h>
+#endif
+
/* Make alloca work the best possible way. */
#ifdef __GNUC__
# ifndef atarist
@@ -53,11 +55,8 @@ void *alloca();
# endif /* HAVE_ALLOCA_H */
#endif /* __GNUC__ */
-#ifdef HAVE_DL_ITERATE_PHDR
-# ifndef _GNU_SOURCE
-# define _GNU_SOURCE
-# endif
-# include <link.h>
+#ifdef HAVE_DLADDR
+# include <dlfcn.h>
#endif
#define DW_LNS_copy 0x01
@@ -86,6 +85,13 @@ 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
@@ -95,13 +101,22 @@ 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;
- unsigned long base_addr;
-} line_info_t;
+ uintptr_t base_addr;
+ obj_info_t *next;
+};
/* Avoid consuming stack as this module may be used from signal handler */
static char binary_filename[PATH_MAX];
@@ -194,34 +209,15 @@ 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,
- unsigned long addr, int file, int line,
- char *include_directories, char *filenames, line_info_t *lines)
+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)
{
int i;
- for (i = 0; i < num_traces; i++) {
- unsigned long a = (unsigned long)traces[i] - lines[i].base_addr;
+ addr += obj->base_addr;
+ for (i = offset; i < num_traces; i++) {
+ uintptr_t a = (uintptr_t)traces[i];
/* 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) {
@@ -232,8 +228,8 @@ fill_line(int num_traces, void **traces,
}
static void
-parse_debug_line_cu(int num_traces, void **traces,
- char **debug_line, line_info_t *lines)
+parse_debug_line_cu(int num_traces, void **traces, char **debug_line,
+ obj_info_t *obj, line_info_t *lines, int offset)
{
char *p, *cu_end, *cu_start, *include_directories, *filenames;
unsigned long unit_length;
@@ -279,7 +275,7 @@ parse_debug_line_cu(int num_traces, void **traces,
is_stmt = default_is_stmt = *(unsigned char *)p;
p++;
- line_base = *(char *)p;
+ line_base = *(signed char *)p;
p++;
line_range = *(unsigned char *)p;
@@ -307,7 +303,8 @@ parse_debug_line_cu(int num_traces, void **traces,
#define FILL_LINE() \
do { \
fill_line(num_traces, traces, addr, file, line, \
- include_directories, filenames, lines); \
+ include_directories, filenames, \
+ obj, lines, offset); \
/*basic_block = prologue_end = epilogue_begin = 0;*/ \
} while (0)
@@ -406,11 +403,12 @@ parse_debug_line_cu(int num_traces, void **traces,
static void
parse_debug_line(int num_traces, void **traces,
- char *debug_line, unsigned long size, line_info_t *lines)
+ char *debug_line, unsigned long size,
+ obj_info_t *obj, line_info_t *lines, int offset)
{
char *debug_line_end = debug_line + size;
while (debug_line < debug_line_end) {
- parse_debug_line_cu(num_traces, traces, &debug_line, lines);
+ parse_debug_line_cu(num_traces, traces, &debug_line, obj, lines, offset);
}
if (debug_line != debug_line_end) {
kprintf("Unexpected size of .debug_line in %s\n",
@@ -419,19 +417,27 @@ 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
-fill_lines(int num_traces, void **traces, char **syms, int check_debuglink,
- line_info_t *current_line, line_info_t *lines);
+append_obj(obj_info_t **objp) {
+ obj_info_t *newobj = calloc(1, sizeof(obj_info_t));
+ if (*objp) (*objp)->next = newobj;
+ *objp = newobj;
+}
static void
-follow_debuglink(char *debuglink, int num_traces, void **traces, char **syms,
- line_info_t *current_line, line_info_t *lines)
+follow_debuglink(char *debuglink, int num_traces, void **traces,
+ obj_info_t **objp, line_info_t *lines, int offset)
{
/* 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) {
@@ -442,22 +448,22 @@ follow_debuglink(char *debuglink, int num_traces, void **traces, char **syms,
subdir = (char *)alloca(strlen(binary_filename) + 1);
strcpy(subdir, binary_filename);
strcpy(binary_filename, global_debug_dir);
- 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);
+ 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);
}
/* read file and fill lines */
-static void
-fill_lines(int num_traces, void **traces, char **syms, int check_debuglink,
- line_info_t *current_line, line_info_t *lines)
+static uintptr_t
+fill_lines(int num_traces, void **traces, int check_debuglink,
+ obj_info_t **objp, line_info_t *lines, int offset)
{
- int i;
+ int i, j;
char *shstr;
char *section_name;
ElfW(Ehdr) *ehdr;
@@ -466,23 +472,27 @@ fill_lines(int num_traces, void **traces, char **syms, 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) {
- return;
+ goto fail;
}
filesize = lseek(fd, 0, SEEK_END);
if (filesize < 0) {
int e = errno;
close(fd);
kprintf("lseek: %s\n", strerror(e));
- return;
+ goto fail;
}
#if SIZEOF_OFF_T > SIZEOF_SIZE_T
if (filesize > (off_t)SIZE_MAX) {
close(fd);
kprintf("Too large file %s\n", binary_filename);
- return;
+ goto fail;
}
#endif
lseek(fd, 0, SEEK_SET);
@@ -492,7 +502,7 @@ fill_lines(int num_traces, void **traces, char **syms, int check_debuglink,
int e = errno;
close(fd);
kprintf("mmap: %s\n", strerror(e));
- return;
+ goto fail;
}
ehdr = (ElfW(Ehdr) *)file;
@@ -502,21 +512,12 @@ fill_lines(int num_traces, void **traces, char **syms, int check_debuglink,
* it match non-elf file.
*/
close(fd);
- return;
+ goto fail;
}
- 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;
- }
- }
+ obj->fd = fd;
+ obj->mapped = file;
+ obj->mapped_size = (size_t)filesize;
shdr = (ElfW(Shdr) *)(file + ehdr->e_shoff);
@@ -525,11 +526,88 @@ fill_lines(int num_traces, void **traces, char **syms, int check_debuglink,
for (i = 0; i < ehdr->e_shnum; i++) {
section_name = shstr + shdr[i].sh_name;
- if (!strcmp(section_name, ".debug_line")) {
- debug_line_shdr = shdr + i;
+ 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;
break;
- } else if (!strcmp(section_name, ".gnu_debuglink")) {
- gnu_debuglink_shdr = shdr + i;
+ 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;
+ }
}
}
@@ -538,111 +616,161 @@ fill_lines(int num_traces, void **traces, char **syms, 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, syms,
- current_line, lines);
+ num_traces, traces,
+ objp, lines, offset);
}
- return;
+ goto finish;
}
parse_debug_line(num_traces, traces,
file + debug_line_shdr->sh_offset,
debug_line_shdr->sh_size,
- lines);
+ obj, lines, offset);
+finish:
+ return dladdr_fbase;
+fail:
+ return (uintptr_t)-1;
}
-#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)
+#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)
{
- 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;
- }
+# 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)
+{
+ 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;
}
- return 0;
+ len--; /* sysctl sets strlen+1 */
+ return len;
}
-
-#endif /* HAVE_DL_ITERATE_PHDR */
+#else
+#undef HAVE_MAIN_EXE_PATH
+#endif
void
-rb_dump_backtrace_with_lines(int num_traces, void **trace, char **syms)
+rb_dump_backtrace_with_lines(int num_traces, void **traces)
{
int i;
/* async-signal unsafe */
- 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;
+ 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;
+ }
}
-
- 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++) {
- 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);
+ 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;
}
- } else {
- kprintf("%s ???:%d\n", syms[i], line->line);
}
- } else {
- kprintf("%s\n", syms[i]);
+ *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);
}
+next_line:
+ continue;
}
+ /* output */
for (i = 0; i < num_traces; i++) {
line_info_t *line = &lines[i];
- if (line->fd) {
- munmap(line->mapped, line->mapped_size);
- close(line->fd);
+ 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);
}
+ free(o);
}
free(lines);
+ free(dladdr_fbases);
}
/* From FreeBSD's lib/libstand/printf.c */
@@ -731,7 +859,7 @@ ksprintn(char *nbuf, uintmax_t num, int base, int *lenp, int upper)
*++p = upper ? toupper(c) : c;
} while (num /= base);
if (lenp)
- *lenp = p - nbuf;
+ *lenp = (int)(p - nbuf);
return (p);
}
@@ -946,7 +1074,7 @@ reswitch: switch (ch = (unsigned char)*fmt++) {
if (p == NULL)
p = "(null)";
if (!dot)
- n = strlen (p);
+ n = (int)strlen (p);
else
for (n = 0; n < dwidth && p[n]; n++)
continue;
diff --git a/addr2line.h b/addr2line.h
index 3782d89e07..d99f010934 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, char **syms);
+rb_dump_backtrace_with_lines(int num_traces, void **traces);
#endif /* USE_ELF */
diff --git a/array.c b/array.c
index 9f900ba305..6b551dbe24 100644
--- a/array.c
+++ b/array.c
@@ -24,8 +24,6 @@
#endif
#include <assert.h>
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
-
VALUE rb_cArray;
static ID id_cmp, id_div, id_power;
@@ -33,22 +31,6 @@ 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 inline void
-memfill(register VALUE *mem, register long size, register VALUE val)
-{
- while (size--) {
- *mem++ = val;
- }
-}
-
# define ARY_SHARED_P(ary) \
(assert(!FL_TEST((ary), ELTS_SHARED) || !FL_TEST((ary), RARRAY_EMBED_FLAG)), \
FL_TEST((ary),ELTS_SHARED)!=0)
@@ -63,6 +45,7 @@ memfill(register VALUE *mem, register long size, register VALUE val)
(assert(ARY_EMBED_P(a)), \
(long)((RBASIC(a)->flags >> RARRAY_EMBED_LEN_SHIFT) & \
(RARRAY_EMBED_LEN_MASK >> RARRAY_EMBED_LEN_SHIFT)))
+#define ARY_HEAP_SIZE(a) (assert(!ARY_EMBED_P(a)), assert(ARY_OWNS_HEAP_P(a)), RARRAY(a)->as.heap.aux.capa * sizeof(VALUE))
#define ARY_OWNS_HEAP_P(a) (!FL_TEST((a), ELTS_SHARED|RARRAY_EMBED_FLAG))
#define FL_SET_EMBED(a) do { \
@@ -127,15 +110,18 @@ memfill(register VALUE *mem, register long size, register VALUE val)
#define ARY_SHARED(ary) (assert(ARY_SHARED_P(ary)), RARRAY(ary)->as.heap.aux.shared)
#define ARY_SET_SHARED(ary, value) do { \
- assert(!ARY_EMBED_P(ary)); \
- assert(ARY_SHARED_P(ary)); \
- assert(ARY_SHARED_ROOT_P(value)); \
- RARRAY(ary)->as.heap.aux.shared = (value); \
+ const VALUE _ary_ = (ary); \
+ const VALUE _value_ = (value); \
+ 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_); \
} while (0)
#define RARRAY_SHARED_ROOT_FLAG FL_USER5
#define ARY_SHARED_ROOT_P(ary) (FL_TEST((ary), RARRAY_SHARED_ROOT_FLAG))
#define ARY_SHARED_NUM(ary) \
(assert(ARY_SHARED_ROOT_P(ary)), RARRAY(ary)->as.heap.aux.capa)
+#define ARY_SHARED_OCCUPIED(ary) (ARY_SHARED_NUM(ary) == 1)
#define ARY_SET_SHARED_NUM(ary, value) do { \
assert(ARY_SHARED_ROOT_P(ary)); \
RARRAY(ary)->as.heap.aux.capa = (value); \
@@ -145,6 +131,74 @@ memfill(register VALUE *mem, register long size, register VALUE val)
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)
{
@@ -161,23 +215,35 @@ ary_resize_capa(VALUE ary, long capacity)
ARY_SET_HEAP_LEN(ary, len);
}
else {
- REALLOC_N(RARRAY(ary)->as.heap.ptr, VALUE, (capacity));
+ SIZED_REALLOC_N(RARRAY(ary)->as.heap.ptr, VALUE, capacity, RARRAY(ary)->as.heap.aux.capa);
}
ARY_SET_CAPA(ary, (capacity));
}
else {
if (!ARY_EMBED_P(ary)) {
long len = RARRAY_LEN(ary);
- VALUE *ptr = RARRAY_PTR(ary);
- if (len > capacity) len = capacity;
- MEMCPY(RARRAY(ary)->as.ary, ptr, VALUE, len);
+ const VALUE *ptr = RARRAY_CONST_PTR(ary);
+
+ if (len > capacity) len = capacity;
+ MEMCPY((VALUE *)RARRAY(ary)->as.ary, ptr, VALUE, len);
FL_SET_EMBED(ary);
ARY_SET_LEN(ary, len);
- xfree(ptr);
+ ruby_xfree((VALUE *)ptr);
}
}
}
+static inline void
+ary_shrink_capa(VALUE ary)
+{
+ long capacity = ARY_HEAP_LEN(ary);
+ long old_capa = RARRAY(ary)->as.heap.aux.capa;
+ assert(!ARY_SHARED_P(ary));
+ assert(old_capa >= capacity);
+ if (old_capa > capacity)
+ REALLOC_N(RARRAY(ary)->as.heap.ptr, VALUE, capacity);
+}
+
static void
ary_double_capa(VALUE ary, long min)
{
@@ -246,8 +312,6 @@ static inline void
rb_ary_modify_check(VALUE ary)
{
rb_check_frozen(ary);
- if (!OBJ_UNTRUSTED(ary) && rb_safe_level() >= 4)
- rb_raise(rb_eSecurityError, "Insecure: can't modify array");
}
void
@@ -255,36 +319,40 @@ rb_ary_modify(VALUE ary)
{
rb_ary_modify_check(ary);
if (ARY_SHARED_P(ary)) {
- long len = RARRAY_LEN(ary);
+ long shared_len, len = RARRAY_LEN(ary);
VALUE shared = ARY_SHARED(ary);
if (len <= RARRAY_EMBED_LEN_MAX) {
- VALUE *ptr = ARY_HEAP_PTR(ary);
+ const VALUE *ptr = ARY_HEAP_PTR(ary);
FL_UNSET_SHARED(ary);
FL_SET_EMBED(ary);
- MEMCPY(ARY_EMBED_PTR(ary), ptr, VALUE, len);
+ MEMCPY((VALUE *)ARY_EMBED_PTR(ary), ptr, VALUE, len);
rb_ary_decrement_share(shared);
ARY_SET_EMBED_LEN(ary, len);
}
- else if (ARY_SHARED_NUM(shared) == 1 && len > (RARRAY_LEN(shared)>>1)) {
- long shift = RARRAY_PTR(ary) - RARRAY_PTR(shared);
+ else if (ARY_SHARED_OCCUPIED(shared) && len > ((shared_len = RARRAY_LEN(shared))>>1)) {
+ long shift = RARRAY_CONST_PTR(ary) - RARRAY_CONST_PTR(shared);
FL_UNSET_SHARED(ary);
- ARY_SET_PTR(ary, RARRAY_PTR(shared));
- ARY_SET_CAPA(ary, RARRAY_LEN(shared));
- MEMMOVE(RARRAY_PTR(ary), RARRAY_PTR(ary)+shift, VALUE, len);
+ ARY_SET_PTR(ary, RARRAY_CONST_PTR(shared));
+ ARY_SET_CAPA(ary, shared_len);
+ RARRAY_PTR_USE(ary, ptr, {
+ MEMMOVE(ptr, ptr+shift, VALUE, len);
+ });
FL_SET_EMBED(shared);
rb_ary_decrement_share(shared);
}
else {
VALUE *ptr = ALLOC_N(VALUE, len);
- MEMCPY(ptr, RARRAY_PTR(ary), VALUE, len);
+ MEMCPY(ptr, RARRAY_CONST_PTR(ary), VALUE, len);
rb_ary_unshare(ary);
ARY_SET_CAPA(ary, len);
ARY_SET_PTR(ary, ptr);
}
+
+ rb_gc_writebarrier_remember(ary);
}
}
-static void
+static VALUE
ary_ensure_room_for_push(VALUE ary, long add_len)
{
long new_len = RARRAY_LEN(ary) + add_len;
@@ -293,19 +361,20 @@ ary_ensure_room_for_push(VALUE ary, long add_len)
if (ARY_SHARED_P(ary)) {
if (new_len > RARRAY_EMBED_LEN_MAX) {
VALUE shared = ARY_SHARED(ary);
- if (ARY_SHARED_NUM(shared) == 1) {
- if (RARRAY_PTR(ary) - RARRAY_PTR(shared) + new_len <= RARRAY_LEN(shared)) {
+ 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, than it is likely it participate in push/shift pattern */
+ /* if array is shared, then it is likely it participate in push/shift pattern */
rb_ary_modify(ary);
capa = ARY_CAPA(ary);
if (new_len > capa - (capa >> 6)) {
ary_double_capa(ary, new_len);
}
+ return ary;
}
- return;
}
}
}
@@ -314,6 +383,8 @@ ary_ensure_room_for_push(VALUE ary, long add_len)
if (new_len > capa) {
ary_double_capa(ary, new_len);
}
+
+ return ary;
}
/*
@@ -369,10 +440,11 @@ rb_ary_shared_with_p(VALUE ary1, VALUE ary2)
static VALUE
ary_alloc(VALUE klass)
{
- NEWOBJ_OF(ary, struct RArray, klass, T_ARRAY);
- FL_SET_EMBED((VALUE)ary);
- ARY_SET_EMBED_LEN((VALUE)ary, 0);
-
+ NEWOBJ_OF(ary, struct RArray, klass, T_ARRAY | RARRAY_EMBED_FLAG | (RGENGC_WB_PROTECTED_ARRAY ? FL_WB_PROTECTED : 0));
+ /* Created array is:
+ * FL_SET_EMBED((VALUE)ary);
+ * ARY_SET_EMBED_LEN((VALUE)ary, 0);
+ */
return (VALUE)ary;
}
@@ -389,7 +461,7 @@ empty_ary_alloc(VALUE klass)
static VALUE
ary_new(VALUE klass, long capa)
{
- VALUE ary;
+ VALUE ary,*ptr;
if (capa < 0) {
rb_raise(rb_eArgError, "negative array size (or size too big)");
@@ -402,34 +474,35 @@ ary_new(VALUE klass, long capa)
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, ALLOC_N(VALUE, capa));
+ ARY_SET_PTR(ary, ptr);
ARY_SET_CAPA(ary, capa);
ARY_SET_HEAP_LEN(ary, 0);
}
+ else {
+ ary = ary_alloc(klass);
+ }
return ary;
}
VALUE
-rb_ary_new2(long capa)
+rb_ary_new_capa(long capa)
{
return ary_new(rb_cArray, capa);
}
-
VALUE
rb_ary_new(void)
{
return rb_ary_new2(RARRAY_EMBED_LEN_MAX);
}
-#include <stdarg.h>
-
VALUE
-rb_ary_new3(long n, ...)
+rb_ary_new_from_args(long n, ...)
{
va_list ar;
VALUE ary;
@@ -439,7 +512,7 @@ rb_ary_new3(long n, ...)
va_start(ar, n);
for (i=0; i<n; i++) {
- RARRAY_PTR(ary)[i] = va_arg(ar, VALUE);
+ ARY_SET(ary, i, va_arg(ar, VALUE));
}
va_end(ar);
@@ -448,13 +521,13 @@ rb_ary_new3(long n, ...)
}
VALUE
-rb_ary_new4(long n, const VALUE *elts)
+rb_ary_new_from_values(long n, const VALUE *elts)
{
VALUE ary;
ary = rb_ary_new2(n);
if (n > 0 && elts) {
- MEMCPY(RARRAY_PTR(ary), elts, VALUE, n);
+ ary_memcpy(ary, 0, n, elts);
ARY_SET_LEN(ary, n);
}
@@ -467,11 +540,20 @@ 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)
{
if (ARY_OWNS_HEAP_P(ary)) {
- xfree(ARY_HEAP_PTR(ary));
+ ruby_sized_xfree((void *)ARY_HEAP_PTR(ary), ARY_HEAP_SIZE(ary));
}
}
@@ -505,18 +587,19 @@ ary_make_shared(VALUE ary)
return ary;
}
else if (OBJ_FROZEN(ary)) {
- ary_resize_capa(ary, ARY_HEAP_LEN(ary));
+ ary_shrink_capa(ary);
FL_SET_SHARED_ROOT(ary);
ARY_SET_SHARED_NUM(ary, 1);
return ary;
}
else {
- NEWOBJ_OF(shared, struct RArray, 0, T_ARRAY);
+ 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));
FL_UNSET_EMBED(shared);
- ARY_SET_LEN((VALUE)shared, ARY_CAPA(ary));
- ARY_SET_PTR((VALUE)shared, RARRAY_PTR(ary));
- rb_mem_clear(RARRAY_PTR(shared) + RARRAY_LEN(ary), ARY_CAPA(ary) - RARRAY_LEN(ary));
+ ARY_SET_LEN((VALUE)shared, capa);
+ ARY_SET_PTR((VALUE)shared, RARRAY_CONST_PTR(ary));
+ ary_mem_clear((VALUE)shared, len, capa - len);
FL_SET_SHARED_ROOT(shared);
ARY_SET_SHARED_NUM((VALUE)shared, 1);
FL_SET_SHARED(ary);
@@ -526,14 +609,15 @@ ary_make_shared(VALUE ary)
}
}
-
static VALUE
ary_make_substitution(VALUE ary)
{
- if (RARRAY_LEN(ary) <= RARRAY_EMBED_LEN_MAX) {
- VALUE subst = rb_ary_new2(RARRAY_LEN(ary));
- MEMCPY(ARY_EMBED_PTR(subst), RARRAY_PTR(ary), VALUE, RARRAY_LEN(ary));
- ARY_SET_EMBED_LEN(subst, RARRAY_LEN(ary));
+ long len = RARRAY_LEN(ary);
+
+ if (len <= RARRAY_EMBED_LEN_MAX) {
+ VALUE subst = rb_ary_new2(len);
+ ary_memcpy(subst, 0, len, RARRAY_CONST_PTR(ary));
+ ARY_SET_EMBED_LEN(subst, len);
return subst;
}
else {
@@ -586,16 +670,16 @@ rb_ary_s_try_convert(VALUE dummy, VALUE ary)
/*
* call-seq:
- * Array.new(size=0, obj=nil)
+ * Array.new(size=0, default=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 +obj+ are sent, an array is created with
- * +size+ copies of +obj+. Take notice that all elements will reference the
- * same object +obj+.
+ * 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+.
*
* The second form creates a copy of the array passed as a parameter (the
* array is generated by calling to_ary on the parameter).
@@ -648,8 +732,8 @@ rb_ary_initialize(int argc, VALUE *argv, VALUE ary)
rb_ary_modify(ary);
if (argc == 0) {
- if (ARY_OWNS_HEAP_P(ary) && RARRAY_PTR(ary)) {
- xfree(RARRAY_PTR(ary));
+ if (ARY_OWNS_HEAP_P(ary) && RARRAY_CONST_PTR(ary) != 0) {
+ ruby_sized_xfree((void *)RARRAY_CONST_PTR(ary), ARY_HEAP_SIZE(ary));
}
rb_ary_unshare_safe(ary);
FL_SET_EMBED(ary);
@@ -669,12 +753,14 @@ 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()) {
@@ -689,7 +775,7 @@ rb_ary_initialize(int argc, VALUE *argv, VALUE ary)
}
}
else {
- memfill(RARRAY_PTR(ary), len, val);
+ ary_memfill(ary, 0, len, val);
ARY_SET_LEN(ary, len);
}
return ary;
@@ -708,7 +794,7 @@ rb_ary_s_create(int argc, VALUE *argv, VALUE klass)
{
VALUE ary = ary_new(klass, argc);
if (argc > 0 && argv) {
- MEMCPY(RARRAY_PTR(ary), argv, VALUE, argc);
+ ary_memcpy(ary, 0, argc, argv);
ARY_SET_LEN(ary, argc);
}
@@ -718,11 +804,13 @@ rb_ary_s_create(int argc, VALUE *argv, VALUE klass)
void
rb_ary_store(VALUE ary, long idx, VALUE val)
{
+ long len = RARRAY_LEN(ary);
+
if (idx < 0) {
- idx += RARRAY_LEN(ary);
+ idx += len;
if (idx < 0) {
rb_raise(rb_eIndexError, "index %ld too small for array; minimum: %ld",
- idx - RARRAY_LEN(ary), -RARRAY_LEN(ary));
+ idx - len, -len);
}
}
else if (idx >= ARY_MAX_SIZE) {
@@ -733,15 +821,14 @@ rb_ary_store(VALUE ary, long idx, VALUE val)
if (idx >= ARY_CAPA(ary)) {
ary_double_capa(ary, idx);
}
- if (idx > RARRAY_LEN(ary)) {
- rb_mem_clear(RARRAY_PTR(ary) + RARRAY_LEN(ary),
- idx-RARRAY_LEN(ary) + 1);
+ if (idx > len) {
+ ary_mem_clear(ary, len, idx - len + 1);
}
- if (idx >= RARRAY_LEN(ary)) {
+ if (idx >= len) {
ARY_SET_LEN(ary, idx + 1);
}
- RARRAY_PTR(ary)[idx] = val;
+ ARY_SET(ary, idx, val);
}
static VALUE
@@ -753,7 +840,7 @@ ary_make_partial(VALUE ary, VALUE klass, long offset, long len)
if (len <= RARRAY_EMBED_LEN_MAX) {
VALUE result = ary_alloc(klass);
- MEMCPY(ARY_EMBED_PTR(result), RARRAY_PTR(ary) + offset, VALUE, len);
+ ary_memcpy(result, 0, len, RARRAY_CONST_PTR(ary) + offset);
ARY_SET_EMBED_LEN(result, len);
return result;
}
@@ -762,7 +849,7 @@ ary_make_partial(VALUE ary, VALUE klass, long offset, long len)
FL_UNSET_EMBED(result);
shared = ary_make_shared(ary);
- ARY_SET_PTR(result, RARRAY_PTR(ary));
+ ARY_SET_PTR(result, RARRAY_CONST_PTR(ary));
ARY_SET_LEN(result, RARRAY_LEN(ary));
rb_ary_set_shared(result, shared);
@@ -785,22 +872,24 @@ enum ary_take_pos_flags
};
static VALUE
-ary_take_first_or_last(int argc, VALUE *argv, VALUE ary, enum ary_take_pos_flags last)
+ary_take_first_or_last(int argc, const VALUE *argv, VALUE ary, enum ary_take_pos_flags last)
{
VALUE nv;
long n;
+ long len;
long offset = 0;
rb_scan_args(argc, argv, "1", &nv);
n = NUM2LONG(nv);
- if (n > RARRAY_LEN(ary)) {
- n = RARRAY_LEN(ary);
+ len = RARRAY_LEN(ary);
+ if (n > len) {
+ n = len;
}
else if (n < 0) {
rb_raise(rb_eArgError, "negative array size");
}
if (last) {
- offset = RARRAY_LEN(ary) - n;
+ offset = len - n;
}
return ary_make_partial(ary, rb_cArray, offset, n);
}
@@ -822,33 +911,20 @@ VALUE
rb_ary_push(VALUE ary, VALUE item)
{
long idx = RARRAY_LEN(ary);
-
- ary_ensure_room_for_push(ary, 1);
- RARRAY_PTR(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_PTR(ary)[idx] = item;
+ VALUE target_ary = ary_ensure_room_for_push(ary, 1);
+ RARRAY_PTR_USE(ary, ptr, {
+ RB_OBJ_WRITE(target_ary, &ptr[idx], item);
+ });
ARY_SET_LEN(ary, idx + 1);
return ary;
}
VALUE
-rb_ary_cat(VALUE ary, const VALUE *ptr, long len)
+rb_ary_cat(VALUE ary, const VALUE *argv, long len)
{
long oldlen = RARRAY_LEN(ary);
-
- ary_ensure_room_for_push(ary, len);
- MEMCPY(RARRAY_PTR(ary) + oldlen, ptr, VALUE, len);
+ VALUE target_ary = ary_ensure_room_for_push(ary, len);
+ ary_memcpy0(ary, oldlen, len, argv, target_ary);
ARY_SET_LEN(ary, oldlen + len);
return ary;
}
@@ -880,16 +956,17 @@ rb_ary_pop(VALUE ary)
{
long n;
rb_ary_modify_check(ary);
- if (RARRAY_LEN(ary) == 0) return Qnil;
+ n = RARRAY_LEN(ary);
+ if (n == 0) return Qnil;
if (ARY_OWNS_HEAP_P(ary) &&
- RARRAY_LEN(ary) * 3 < ARY_CAPA(ary) &&
+ n * 3 < ARY_CAPA(ary) &&
ARY_CAPA(ary) > ARY_DEFAULT_SIZE)
{
- ary_resize_capa(ary, RARRAY_LEN(ary) * 2);
+ ary_resize_capa(ary, n * 2);
}
- n = RARRAY_LEN(ary)-1;
+ --n;
ARY_SET_LEN(ary, n);
- return RARRAY_PTR(ary)[n];
+ return RARRAY_AREF(ary, n);
}
/*
@@ -929,23 +1006,26 @@ VALUE
rb_ary_shift(VALUE ary)
{
VALUE top;
+ long len = RARRAY_LEN(ary);
rb_ary_modify_check(ary);
- if (RARRAY_LEN(ary) == 0) return Qnil;
- top = RARRAY_PTR(ary)[0];
+ if (len == 0) return Qnil;
+ top = RARRAY_AREF(ary, 0);
if (!ARY_SHARED_P(ary)) {
- if (RARRAY_LEN(ary) < ARY_DEFAULT_SIZE) {
- MEMMOVE(RARRAY_PTR(ary), RARRAY_PTR(ary)+1, VALUE, RARRAY_LEN(ary)-1);
+ if (len < ARY_DEFAULT_SIZE) {
+ RARRAY_PTR_USE(ary, ptr, {
+ MEMMOVE(ptr, ptr+1, VALUE, len-1);
+ }); /* WB: no new reference */
ARY_INCREASE_LEN(ary, -1);
return top;
}
assert(!ARY_EMBED_P(ary)); /* ARY_EMBED_LEN_MAX < ARY_DEFAULT_SIZE */
- RARRAY_PTR(ary)[0] = Qnil;
+ ARY_SET(ary, 0, Qnil);
ary_make_shared(ary);
}
- else if (ARY_SHARED_NUM(ARY_SHARED(ary)) == 1) {
- RARRAY_PTR(ary)[0] = Qnil;
+ else if (ARY_SHARED_OCCUPIED(ARY_SHARED(ary))) {
+ RARRAY_PTR_USE(ary, ptr, ptr[0] = Qnil);
}
ARY_INCREASE_PTR(ary, 1); /* shift ptr */
ARY_INCREASE_LEN(ary, -1);
@@ -990,33 +1070,35 @@ rb_ary_shift_m(int argc, VALUE *argv, VALUE ary)
result = ary_take_first_or_last(argc, argv, ary, ARY_TAKE_FIRST);
n = RARRAY_LEN(result);
if (ARY_SHARED_P(ary)) {
- if (ARY_SHARED_NUM(ARY_SHARED(ary)) == 1) {
- rb_mem_clear(RARRAY_PTR(ary), n);
+ if (ARY_SHARED_OCCUPIED(ARY_SHARED(ary))) {
+ ary_mem_clear(ary, 0, n);
}
ARY_INCREASE_PTR(ary, n);
}
else {
- MEMMOVE(RARRAY_PTR(ary), RARRAY_PTR(ary)+n, VALUE, RARRAY_LEN(ary)-n);
+ 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 void
+static VALUE
ary_ensure_room_for_unshift(VALUE ary, int argc)
{
long len = RARRAY_LEN(ary);
long new_len = len + argc;
long capa;
- VALUE *head, *sharedp;
+ const VALUE *head, *sharedp;
if (ARY_SHARED_P(ary)) {
VALUE shared = ARY_SHARED(ary);
capa = RARRAY_LEN(shared);
- if (ARY_SHARED_NUM(shared) == 1 && capa > new_len) {
- head = RARRAY_PTR(ary);
- sharedp = RARRAY_PTR(shared);
+ if (ARY_SHARED_OCCUPIED(shared) && capa > new_len) {
+ head = RARRAY_CONST_PTR(ary);
+ sharedp = RARRAY_CONST_PTR(shared);
goto makeroom_if_need;
}
}
@@ -1033,7 +1115,7 @@ ary_ensure_room_for_unshift(VALUE ary, int argc)
capa = ARY_CAPA(ary);
ary_make_shared(ary);
- head = sharedp = RARRAY_PTR(ary);
+ head = sharedp = RARRAY_CONST_PTR(ary);
goto makeroom;
makeroom_if_need:
if (head - sharedp < argc) {
@@ -1041,14 +1123,20 @@ ary_ensure_room_for_unshift(VALUE ary, int argc)
makeroom:
room = capa - new_len;
room -= room >> 4;
- MEMMOVE(sharedp + argc + room, head, VALUE, len);
+ MEMMOVE((VALUE *)sharedp + argc + room, head, VALUE, len);
head = sharedp + argc + room;
}
ARY_SET_PTR(ary, head - argc);
+ assert(ARY_SHARED_OCCUPIED(ARY_SHARED(ary)));
+ return ARY_SHARED(ary);
}
else {
/* sliding items */
- MEMMOVE(RARRAY_PTR(ary) + argc, RARRAY_PTR(ary), VALUE, len);
+ RARRAY_PTR_USE(ary, ptr, {
+ MEMMOVE(ptr + argc, ptr, VALUE, len);
+ });
+
+ return ary;
}
}
@@ -1068,14 +1156,15 @@ 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;
}
- ary_ensure_room_for_unshift(ary, argc);
- MEMCPY(RARRAY_PTR(ary), argv, VALUE, argc);
+ target_ary = ary_ensure_room_for_unshift(ary, argc);
+ ary_memcpy0(ary, 0, argc, argv, target_ary);
ARY_SET_LEN(ary, len + argc);
return ary;
}
@@ -1090,11 +1179,12 @@ rb_ary_unshift(VALUE ary, VALUE item)
static inline VALUE
rb_ary_elt(VALUE ary, long offset)
{
- if (RARRAY_LEN(ary) == 0) return Qnil;
- if (offset < 0 || RARRAY_LEN(ary) <= offset) {
+ long len = RARRAY_LEN(ary);
+ if (len == 0) return Qnil;
+ if (offset < 0 || len <= offset) {
return Qnil;
}
- return RARRAY_PTR(ary)[offset];
+ return RARRAY_AREF(ary, offset);
}
VALUE
@@ -1110,12 +1200,13 @@ VALUE
rb_ary_subseq(VALUE ary, long beg, long len)
{
VALUE klass;
+ long alen = RARRAY_LEN(ary);
- if (beg > RARRAY_LEN(ary)) return Qnil;
+ if (beg > alen) return Qnil;
if (beg < 0 || len < 0) return Qnil;
- if (RARRAY_LEN(ary) < len || RARRAY_LEN(ary) < beg + len) {
- len = RARRAY_LEN(ary) - beg;
+ if (alen < len || alen < beg + len) {
+ len = alen - beg;
}
klass = rb_obj_class(ary);
if (len == 0) return ary_new(klass, 0);
@@ -1160,7 +1251,7 @@ rb_ary_subseq(VALUE ary, long beg, long len)
*/
VALUE
-rb_ary_aref(int argc, VALUE *argv, VALUE ary)
+rb_ary_aref(int argc, const VALUE *argv, VALUE ary)
{
VALUE arg;
long beg, len;
@@ -1232,7 +1323,7 @@ rb_ary_first(int argc, VALUE *argv, VALUE ary)
{
if (argc == 0) {
if (RARRAY_LEN(ary) == 0) return Qnil;
- return RARRAY_PTR(ary)[0];
+ return RARRAY_AREF(ary, 0);
}
else {
return ary_take_first_or_last(argc, argv, ary, ARY_TAKE_FIRST);
@@ -1255,11 +1346,12 @@ rb_ary_first(int argc, VALUE *argv, VALUE ary)
*/
VALUE
-rb_ary_last(int argc, VALUE *argv, VALUE ary)
+rb_ary_last(int argc, const VALUE *argv, VALUE ary)
{
if (argc == 0) {
- if (RARRAY_LEN(ary) == 0) return Qnil;
- return RARRAY_PTR(ary)[RARRAY_LEN(ary)-1];
+ long len = RARRAY_LEN(ary);
+ if (len == 0) return Qnil;
+ return RARRAY_AREF(ary, len-1);
}
else {
return ary_take_first_or_last(argc, argv, ary, ARY_TAKE_LAST);
@@ -1314,11 +1406,14 @@ rb_ary_fetch(int argc, VALUE *argv, VALUE ary)
}
return ifnone;
}
- return RARRAY_PTR(ary)[idx];
+ return RARRAY_AREF(ary, idx);
}
/*
* call-seq:
+ * ary.find_index(obj) -> int or nil
+ * ary.find_index { |item| block } -> int or nil
+ * ary.find_index -> Enumerator
* ary.index(obj) -> int or nil
* ary.index { |item| block } -> int or nil
* ary.index -> Enumerator
@@ -1338,31 +1433,42 @@ rb_ary_fetch(int argc, VALUE *argv, VALUE ary)
* a.index("b") #=> 1
* a.index("z") #=> nil
* a.index { |x| x == "b" } #=> 1
- *
- * This is an alias of Array#find_index.
*/
static VALUE
rb_ary_index(int argc, VALUE *argv, VALUE ary)
{
+ const VALUE *ptr;
VALUE val;
- long i;
+ long i, len;
if (argc == 0) {
RETURN_ENUMERATOR(ary, 0, 0);
for (i=0; i<RARRAY_LEN(ary); i++) {
- if (RTEST(rb_yield(RARRAY_PTR(ary)[i]))) {
+ if (RTEST(rb_yield(RARRAY_AREF(ary, i)))) {
return LONG2NUM(i);
}
}
return Qnil;
}
- rb_scan_args(argc, argv, "1", &val);
+ rb_check_arity(argc, 0, 1);
+ val = argv[0];
if (rb_block_given_p())
rb_warn("given block not used");
- for (i=0; i<RARRAY_LEN(ary); i++) {
- if (rb_equal(RARRAY_PTR(ary)[i], val))
+ len = RARRAY_LEN(ary);
+ ptr = RARRAY_CONST_PTR(ary);
+ for (i=0; i<len; i++) {
+ VALUE e = ptr[i];
+ switch (rb_equal_opt(e, val)) {
+ case Qundef:
+ if (!rb_equal(e, val)) break;
+ case Qtrue:
return LONG2NUM(i);
+ case Qfalse:
+ continue;
+ }
+ len = RARRAY_LEN(ary);
+ ptr = RARRAY_CONST_PTR(ary);
}
return Qnil;
}
@@ -1394,29 +1500,40 @@ rb_ary_index(int argc, VALUE *argv, VALUE ary)
static VALUE
rb_ary_rindex(int argc, VALUE *argv, VALUE ary)
{
+ const VALUE *ptr;
VALUE val;
- long i = RARRAY_LEN(ary);
+ long i = RARRAY_LEN(ary), len;
if (argc == 0) {
RETURN_ENUMERATOR(ary, 0, 0);
while (i--) {
- if (RTEST(rb_yield(RARRAY_PTR(ary)[i])))
+ if (RTEST(rb_yield(RARRAY_AREF(ary, i))))
return LONG2NUM(i);
- if (i > RARRAY_LEN(ary)) {
- i = RARRAY_LEN(ary);
+ if (i > (len = RARRAY_LEN(ary))) {
+ i = len;
}
}
return Qnil;
}
- rb_scan_args(argc, argv, "1", &val);
+ rb_check_arity(argc, 0, 1);
+ val = argv[0];
if (rb_block_given_p())
rb_warn("given block not used");
+ ptr = RARRAY_CONST_PTR(ary);
while (i--) {
- if (rb_equal(RARRAY_PTR(ary)[i], val))
+ VALUE e = ptr[i];
+ switch (rb_equal_opt(e, val)) {
+ case Qundef:
+ if (!rb_equal(e, val)) break;
+ case Qtrue:
return LONG2NUM(i);
- if (i > RARRAY_LEN(ary)) {
- i = RARRAY_LEN(ary);
+ case Qfalse:
+ continue;
+ }
+ if (i > (len = RARRAY_LEN(ary))) {
+ i = len;
}
+ ptr = RARRAY_CONST_PTR(ary);
}
return Qnil;
}
@@ -1434,17 +1551,19 @@ static void
rb_ary_splice(VALUE ary, long beg, long len, VALUE rpl)
{
long rlen;
+ long olen;
if (len < 0) rb_raise(rb_eIndexError, "negative length (%ld)", len);
+ olen = RARRAY_LEN(ary);
if (beg < 0) {
- beg += RARRAY_LEN(ary);
+ beg += olen;
if (beg < 0) {
rb_raise(rb_eIndexError, "index %ld too small for array; minimum: %ld",
- beg - RARRAY_LEN(ary), -RARRAY_LEN(ary));
+ beg - olen, -olen);
}
}
- if (RARRAY_LEN(ary) < len || RARRAY_LEN(ary) < beg + len) {
- len = RARRAY_LEN(ary) - beg;
+ if (olen < len || olen < beg + len) {
+ len = olen - beg;
}
if (rpl == Qundef) {
@@ -1453,16 +1572,18 @@ rb_ary_splice(VALUE ary, long beg, long len, VALUE rpl)
else {
rpl = rb_ary_to_ary(rpl);
rlen = RARRAY_LEN(rpl);
+ olen = RARRAY_LEN(ary); /* ary may be resized in rpl.to_ary too */
}
- if (beg >= RARRAY_LEN(ary)) {
+ if (beg >= olen) {
+ VALUE target_ary;
if (beg > ARY_MAX_SIZE - rlen) {
rb_raise(rb_eIndexError, "index %ld too big", beg);
}
- ary_ensure_room_for_push(ary, rlen-len); /* len is 0 or negative */
+ target_ary = ary_ensure_room_for_push(ary, rlen-len); /* len is 0 or negative */
len = beg + rlen;
- rb_mem_clear(RARRAY_PTR(ary) + RARRAY_LEN(ary), beg - RARRAY_LEN(ary));
+ ary_mem_clear(ary, olen, beg - olen);
if (rlen > 0) {
- MEMCPY(RARRAY_PTR(ary) + beg, RARRAY_PTR(rpl), VALUE, rlen);
+ ary_memcpy0(ary, beg, rlen, RARRAY_CONST_PTR(rpl), target_ary);
}
ARY_SET_LEN(ary, len);
}
@@ -1470,18 +1591,19 @@ rb_ary_splice(VALUE ary, long beg, long len, VALUE rpl)
long alen;
rb_ary_modify(ary);
- alen = RARRAY_LEN(ary) + rlen - len;
+ alen = olen + rlen - len;
if (alen >= ARY_CAPA(ary)) {
ary_double_capa(ary, alen);
}
if (len != rlen) {
- MEMMOVE(RARRAY_PTR(ary) + beg + rlen, RARRAY_PTR(ary) + beg + len,
- VALUE, RARRAY_LEN(ary) - (beg + len));
+ RARRAY_PTR_USE(ary, ptr,
+ MEMMOVE(ptr + beg + rlen, ptr + beg + len,
+ VALUE, olen - (beg + len)));
ARY_SET_LEN(ary, alen);
}
if (rlen > 0) {
- MEMMOVE(RARRAY_PTR(ary) + beg, RARRAY_PTR(rpl), VALUE, rlen);
+ MEMMOVE(RARRAY_PTR(ary) + beg, RARRAY_CONST_PTR(rpl), VALUE, rlen);
}
}
}
@@ -1524,8 +1646,8 @@ rb_ary_resize(VALUE ary, long len)
if (len >= ARY_CAPA(ary)) {
ary_double_capa(ary, len);
}
- rb_mem_clear(RARRAY_PTR(ary) + olen, len - olen);
- ARY_SET_LEN(ary, len);
+ ary_mem_clear(ary, olen, len - olen);
+ ARY_SET_LEN(ary, len);
}
else if (ARY_EMBED_P(ary)) {
ARY_SET_EMBED_LEN(ary, len);
@@ -1534,12 +1656,12 @@ rb_ary_resize(VALUE ary, long len)
VALUE tmp[RARRAY_EMBED_LEN_MAX];
MEMCPY(tmp, ARY_HEAP_PTR(ary), VALUE, len);
ary_discard(ary);
- MEMCPY(ARY_EMBED_PTR(ary), tmp, VALUE, len);
+ MEMCPY((VALUE *)ARY_EMBED_PTR(ary), tmp, VALUE, len); /* WB: no new reference */
ARY_SET_EMBED_LEN(ary, len);
}
else {
if (olen > len + ARY_DEFAULT_SIZE) {
- REALLOC_N(RARRAY(ary)->as.heap.ptr, VALUE, len);
+ SIZED_REALLOC_N(RARRAY(ary)->as.heap.ptr, VALUE, len, RARRAY(ary)->as.heap.aux.capa);
ARY_SET_CAPA(ary, len);
}
ARY_SET_HEAP_LEN(ary, len);
@@ -1619,7 +1741,9 @@ 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.
+ * 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.
*
* a = %w{ a b c d }
* a.insert(2, 99) #=> ["a", "b", 99, "c", "d"]
@@ -1648,6 +1772,12 @@ rb_ary_insert(int argc, VALUE *argv, VALUE ary)
static VALUE
rb_ary_length(VALUE ary);
+static VALUE
+ary_enum_length(VALUE ary, VALUE args, VALUE eobj)
+{
+ return rb_ary_length(ary);
+}
+
/*
* call-seq:
* ary.each { |item| block } -> ary
@@ -1672,9 +1802,9 @@ rb_ary_each(VALUE array)
long i;
volatile VALUE ary = array;
- RETURN_SIZED_ENUMERATOR(ary, 0, 0, rb_ary_length);
+ RETURN_SIZED_ENUMERATOR(ary, 0, 0, ary_enum_length);
for (i=0; i<RARRAY_LEN(ary); i++) {
- rb_yield(RARRAY_PTR(ary)[i]);
+ rb_yield(RARRAY_AREF(ary, i));
}
return ary;
}
@@ -1701,7 +1831,7 @@ static VALUE
rb_ary_each_index(VALUE ary)
{
long i;
- RETURN_SIZED_ENUMERATOR(ary, 0, 0, rb_ary_length);
+ RETURN_SIZED_ENUMERATOR(ary, 0, 0, ary_enum_length);
for (i=0; i<RARRAY_LEN(ary); i++) {
rb_yield(LONG2NUM(i));
@@ -1729,12 +1859,14 @@ rb_ary_reverse_each(VALUE ary)
{
long len;
- RETURN_SIZED_ENUMERATOR(ary, 0, 0, rb_ary_length);
+ RETURN_SIZED_ENUMERATOR(ary, 0, 0, ary_enum_length);
len = RARRAY_LEN(ary);
while (len--) {
- rb_yield(RARRAY_PTR(ary)[len]);
- if (RARRAY_LEN(ary) < len) {
- len = RARRAY_LEN(ary);
+ long nlen;
+ rb_yield(RARRAY_AREF(ary, len));
+ nlen = RARRAY_LEN(ary);
+ if (nlen < len) {
+ len = nlen;
}
}
return ary;
@@ -1777,16 +1909,17 @@ rb_ary_empty_p(VALUE ary)
VALUE
rb_ary_dup(VALUE ary)
{
- VALUE dup = rb_ary_new2(RARRAY_LEN(ary));
- MEMCPY(RARRAY_PTR(dup), RARRAY_PTR(ary), VALUE, RARRAY_LEN(ary));
- ARY_SET_LEN(dup, RARRAY_LEN(ary));
+ long len = RARRAY_LEN(ary);
+ VALUE dup = rb_ary_new2(len);
+ ary_memcpy(dup, 0, len, RARRAY_CONST_PTR(ary));
+ ARY_SET_LEN(dup, len);
return dup;
}
VALUE
rb_ary_resurrect(VALUE ary)
{
- return rb_ary_new4(RARRAY_LEN(ary), RARRAY_PTR(ary));
+ return rb_ary_new4(RARRAY_LEN(ary), RARRAY_CONST_PTR(ary));
}
extern VALUE rb_output_fs;
@@ -1817,14 +1950,13 @@ ary_join_0(VALUE ary, VALUE sep, long max, VALUE result)
long i;
VALUE val;
- if (max > 0) rb_enc_copy(result, RARRAY_PTR(ary)[0]);
+ if (max > 0) rb_enc_copy(result, RARRAY_AREF(ary, 0));
for (i=0; i<max; i++) {
- val = RARRAY_PTR(ary)[i];
+ val = RARRAY_AREF(ary, i);
if (i > 0 && !NIL_P(sep))
rb_str_buf_append(result, sep);
rb_str_buf_append(result, val);
if (OBJ_TAINTED(val)) OBJ_TAINT(result);
- if (OBJ_UNTRUSTED(val)) OBJ_TAINT(result);
}
}
@@ -1837,14 +1969,13 @@ ary_join_1(VALUE obj, VALUE ary, VALUE sep, long i, VALUE result, int *first)
if (i > 0 && !NIL_P(sep))
rb_str_buf_append(result, sep);
- val = RARRAY_PTR(ary)[i];
- switch (TYPE(val)) {
- case T_STRING:
+ val = RARRAY_AREF(ary, i);
+ if (RB_TYPE_P(val, T_STRING)) {
str_join:
rb_str_buf_append(result, val);
*first = FALSE;
- break;
- case T_ARRAY:
+ }
+ else if (RB_TYPE_P(val, T_ARRAY)) {
obj = val;
ary_join:
if (val == ary) {
@@ -1859,8 +1990,8 @@ ary_join_1(VALUE obj, VALUE ary, VALUE sep, long i, VALUE result, int *first)
args[3] = (VALUE)first;
rb_exec_recursive(recursive_join, obj, (VALUE)args);
}
- break;
- default:
+ }
+ else {
tmp = rb_check_string_type(val);
if (!NIL_P(tmp)) {
val = tmp;
@@ -1887,19 +2018,17 @@ rb_ary_join(VALUE ary, VALUE sep)
{
long len = 1, i;
int taint = FALSE;
- int untrust = FALSE;
VALUE val, tmp, result;
if (RARRAY_LEN(ary) == 0) return rb_usascii_str_new(0, 0);
if (OBJ_TAINTED(ary)) taint = TRUE;
- if (OBJ_UNTRUSTED(ary)) untrust = TRUE;
if (!NIL_P(sep)) {
StringValue(sep);
len += RSTRING_LEN(sep) * (RARRAY_LEN(ary) - 1);
}
for (i=0; i<RARRAY_LEN(ary); i++) {
- val = RARRAY_PTR(ary)[i];
+ val = RARRAY_AREF(ary, i);
tmp = rb_check_string_type(val);
if (NIL_P(tmp) || tmp != val) {
@@ -1907,7 +2036,6 @@ rb_ary_join(VALUE ary, VALUE sep)
result = rb_str_buf_new(len + (RARRAY_LEN(ary)-i)*10);
rb_enc_associate(result, rb_usascii_encoding());
if (taint) OBJ_TAINT(result);
- if (untrust) OBJ_UNTRUST(result);
ary_join_0(ary, sep, i, result);
first = i == 0;
ary_join_1(ary, ary, sep, i, result, &first);
@@ -1919,7 +2047,6 @@ rb_ary_join(VALUE ary, VALUE sep)
result = rb_str_buf_new(len);
if (taint) OBJ_TAINT(result);
- if (untrust) OBJ_UNTRUST(result);
ary_join_0(ary, sep, RARRAY_LEN(ary), result);
return result;
@@ -1953,23 +2080,20 @@ static VALUE
inspect_ary(VALUE ary, VALUE dummy, int recur)
{
int tainted = OBJ_TAINTED(ary);
- int untrust = OBJ_UNTRUSTED(ary);
long i;
VALUE s, str;
if (recur) return rb_usascii_str_new_cstr("[...]");
str = rb_str_buf_new2("[");
for (i=0; i<RARRAY_LEN(ary); i++) {
- s = rb_inspect(RARRAY_PTR(ary)[i]);
+ s = rb_inspect(RARRAY_AREF(ary, i));
if (OBJ_TAINTED(s)) tainted = TRUE;
- if (OBJ_UNTRUSTED(s)) untrust = TRUE;
if (i > 0) rb_str_buf_cat2(str, ", ");
else rb_enc_copy(str, s);
rb_str_buf_append(str, s);
}
rb_str_buf_cat2(str, "]");
if (tainted) OBJ_TAINT(str);
- if (untrust) OBJ_UNTRUST(str);
return str;
}
@@ -2018,6 +2142,37 @@ rb_ary_to_a(VALUE ary)
/*
* call-seq:
+ * ary.to_h -> hash
+ *
+ * Returns the result of interpreting <i>ary</i> as an array of
+ * <tt>[key, value]</tt> pairs.
+ *
+ * [[:foo, :bar], [1, 2]].to_h
+ * # => {:foo => :bar, 1 => 2}
+ */
+
+static VALUE
+rb_ary_to_h(VALUE ary)
+{
+ long i;
+ VALUE hash = rb_hash_new();
+ for (i=0; i<RARRAY_LEN(ary); i++) {
+ VALUE key_value_pair = rb_check_array_type(rb_ary_elt(ary, i));
+ if (NIL_P(key_value_pair)) {
+ rb_raise(rb_eTypeError, "wrong element type %s at %ld (expected array)",
+ rb_builtin_class_name(rb_ary_elt(ary, i)), 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));
+ }
+ rb_hash_aset(hash, RARRAY_AREF(key_value_pair, 0), RARRAY_AREF(key_value_pair, 1));
+ }
+ return hash;
+}
+
+/*
+ * call-seq:
* ary.to_ary -> ary
*
* Returns +self+.
@@ -2042,13 +2197,15 @@ ary_reverse(VALUE *p1, VALUE *p2)
VALUE
rb_ary_reverse(VALUE ary)
{
- VALUE *p1, *p2;
+ VALUE *p2;
+ long len = RARRAY_LEN(ary);
rb_ary_modify(ary);
- if (RARRAY_LEN(ary) > 1) {
- p1 = RARRAY_PTR(ary);
- p2 = p1 + RARRAY_LEN(ary) - 1; /* points last item */
- ary_reverse(p1, p2);
+ if (len > 1) {
+ RARRAY_PTR_USE(ary, p1, {
+ p2 = p1 + len - 1; /* points last item */
+ ary_reverse(p1, p2);
+ }); /* WB: no new reference */
}
return ary;
}
@@ -2087,8 +2244,8 @@ rb_ary_reverse_m(VALUE ary)
VALUE dup = rb_ary_new2(len);
if (len > 0) {
- VALUE *p1 = RARRAY_PTR(ary);
- VALUE *p2 = RARRAY_PTR(dup) + len - 1;
+ const VALUE *p1 = RARRAY_CONST_PTR(ary);
+ VALUE *p2 = (VALUE *)RARRAY_CONST_PTR(dup) + len - 1;
do *p2-- = *p1++; while (--len > 0);
}
ARY_SET_LEN(dup, RARRAY_LEN(ary));
@@ -2173,7 +2330,8 @@ rb_ary_rotate_bang(int argc, VALUE *argv, VALUE ary)
static VALUE
rb_ary_rotate_m(int argc, VALUE *argv, VALUE ary)
{
- VALUE rotated, *ptr, *ptr2;
+ VALUE rotated;
+ const VALUE *ptr;
long len, cnt = 1;
switch (argc) {
@@ -2186,11 +2344,10 @@ rb_ary_rotate_m(int argc, VALUE *argv, VALUE ary)
rotated = rb_ary_new2(len);
if (len > 0) {
cnt = rotate_count(cnt, len);
- ptr = RARRAY_PTR(ary);
- ptr2 = RARRAY_PTR(rotated);
+ ptr = RARRAY_CONST_PTR(ary);
len -= cnt;
- MEMCPY(ptr2, ptr + cnt, VALUE, len);
- MEMCPY(ptr2 + len, ptr, VALUE, cnt);
+ ary_memcpy(rotated, 0, len, ptr + cnt);
+ ary_memcpy(rotated, len, cnt, ptr);
}
ARY_SET_LEN(rotated, RARRAY_LEN(ary));
return rotated;
@@ -2258,7 +2415,7 @@ sort_2(const void *ap, const void *bp, void *dummy)
return rb_str_cmp(a, b);
}
- retval = rb_funcall(a, id_cmp, 1, b);
+ retval = rb_funcallv(a, id_cmp, 1, &b);
n = rb_cmpint(retval, a, b);
sort_reentered(data->ary);
@@ -2296,26 +2453,25 @@ rb_ary_sort_bang(VALUE ary)
struct ary_sort_data data;
long len = RARRAY_LEN(ary);
- RBASIC(tmp)->klass = 0;
+ RBASIC_CLEAR_CLASS(tmp);
data.ary = tmp;
data.opt_methods = 0;
data.opt_inited = 0;
- ruby_qsort(RARRAY_PTR(tmp), len, sizeof(VALUE),
- rb_block_given_p()?sort_1:sort_2, &data);
-
+ RARRAY_PTR_USE(tmp, ptr, {
+ ruby_qsort(ptr, len, sizeof(VALUE),
+ rb_block_given_p()?sort_1:sort_2, &data);
+ }); /* WB: no new reference */
+ rb_ary_modify(ary);
if (ARY_EMBED_P(tmp)) {
- assert(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);
- MEMCPY(RARRAY_PTR(ary), ARY_EMBED_PTR(tmp), VALUE, ARY_EMBED_LEN(tmp));
+ ary_memcpy(ary, 0, ARY_EMBED_LEN(tmp), ARY_EMBED_PTR(tmp));
ARY_SET_LEN(ary, ARY_EMBED_LEN(tmp));
}
else {
- assert(!ARY_EMBED_P(tmp));
- if (ARY_HEAP_PTR(ary) == ARY_HEAP_PTR(tmp)) {
- assert(!ARY_EMBED_P(ary));
+ if (!ARY_EMBED_P(ary) && ARY_HEAP_PTR(ary) == ARY_HEAP_PTR(tmp)) {
FL_UNSET_SHARED(ary);
ARY_SET_CAPA(ary, RARRAY_LEN(tmp));
}
@@ -2329,9 +2485,9 @@ rb_ary_sort_bang(VALUE ary)
rb_ary_unshare(ary);
}
else {
- xfree(ARY_HEAP_PTR(ary));
+ ruby_sized_xfree((void *)ARY_HEAP_PTR(ary), ARY_HEAP_SIZE(ary));
}
- ARY_SET_PTR(ary, RARRAY_PTR(tmp));
+ ARY_SET_PTR(ary, RARRAY_CONST_PTR(tmp));
ARY_SET_HEAP_LEN(ary, len);
ARY_SET_CAPA(ary, RARRAY_LEN(tmp));
}
@@ -2342,7 +2498,7 @@ rb_ary_sort_bang(VALUE ary)
FL_SET(tmp, FL_FREEZE);
}
/* tmp will be GC'ed. */
- RBASIC(tmp)->klass = rb_cArray;
+ RBASIC_SET_CLASS_RAW(tmp, rb_cArray); /* rb_cArray must be marked */
}
return ary;
}
@@ -2454,7 +2610,8 @@ rb_ary_bsearch(VALUE ary)
smaller = 0;
}
else if (rb_obj_is_kind_of(v, rb_cNumeric)) {
- switch (rb_cmpint(rb_funcall(v, id_cmp, 1, INT2FIX(0)), v, INT2FIX(0))) {
+ const VALUE zero = INT2FIX(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;
@@ -2479,7 +2636,7 @@ rb_ary_bsearch(VALUE ary)
static VALUE
-sort_by_i(VALUE i)
+sort_by_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, dummy))
{
return rb_yield(i);
}
@@ -2501,7 +2658,7 @@ rb_ary_sort_by_bang(VALUE ary)
{
VALUE sorted;
- RETURN_SIZED_ENUMERATOR(ary, 0, 0, rb_ary_length);
+ RETURN_SIZED_ENUMERATOR(ary, 0, 0, ary_enum_length);
rb_ary_modify(ary);
sorted = rb_block_call(ary, rb_intern("sort_by"), 0, 0, sort_by_i, 0);
rb_ary_replace(ary, sorted);
@@ -2525,8 +2682,9 @@ rb_ary_sort_by_bang(VALUE ary)
* If no block is given, an Enumerator is returned instead.
*
* a = [ "a", "b", "c", "d" ]
- * a.map { |x| x + "!" } #=> ["a!", "b!", "c!", "d!"]
- * 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"]
*/
static VALUE
@@ -2535,10 +2693,10 @@ rb_ary_collect(VALUE ary)
long i;
VALUE collect;
- RETURN_SIZED_ENUMERATOR(ary, 0, 0, rb_ary_length);
+ RETURN_SIZED_ENUMERATOR(ary, 0, 0, ary_enum_length);
collect = rb_ary_new2(RARRAY_LEN(ary));
for (i = 0; i < RARRAY_LEN(ary); i++) {
- rb_ary_push(collect, rb_yield(RARRAY_PTR(ary)[i]));
+ rb_ary_push(collect, rb_yield(RARRAY_AREF(ary, i)));
}
return collect;
}
@@ -2561,6 +2719,8 @@ 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
@@ -2568,16 +2728,16 @@ rb_ary_collect_bang(VALUE ary)
{
long i;
- RETURN_SIZED_ENUMERATOR(ary, 0, 0, rb_ary_length);
+ RETURN_SIZED_ENUMERATOR(ary, 0, 0, ary_enum_length);
rb_ary_modify(ary);
for (i = 0; i < RARRAY_LEN(ary); i++) {
- rb_ary_store(ary, i, rb_yield(RARRAY_PTR(ary)[i]));
+ rb_ary_store(ary, i, rb_yield(RARRAY_AREF(ary, i)));
}
return ary;
}
VALUE
-rb_get_values_at(VALUE obj, long olen, int argc, VALUE *argv, VALUE (*func) (VALUE, long))
+rb_get_values_at(VALUE obj, long olen, int argc, const VALUE *argv, VALUE (*func) (VALUE, long))
{
VALUE result = rb_ary_new2(argc);
long beg, len, i, j;
@@ -2651,10 +2811,10 @@ rb_ary_select(VALUE ary)
VALUE result;
long i;
- RETURN_SIZED_ENUMERATOR(ary, 0, 0, rb_ary_length);
+ RETURN_SIZED_ENUMERATOR(ary, 0, 0, ary_enum_length);
result = rb_ary_new2(RARRAY_LEN(ary));
for (i = 0; i < RARRAY_LEN(ary); i++) {
- if (RTEST(rb_yield(RARRAY_PTR(ary)[i]))) {
+ if (RTEST(rb_yield(RARRAY_AREF(ary, i)))) {
rb_ary_push(result, rb_ary_elt(ary, i));
}
}
@@ -2682,10 +2842,10 @@ rb_ary_select_bang(VALUE ary)
{
long i1, i2;
- RETURN_SIZED_ENUMERATOR(ary, 0, 0, rb_ary_length);
+ 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_PTR(ary)[i1];
+ VALUE v = RARRAY_AREF(ary, i1);
if (!RTEST(rb_yield(v))) continue;
if (i1 != i2) {
rb_ary_store(ary, i2, v);
@@ -2693,8 +2853,8 @@ rb_ary_select_bang(VALUE ary)
i2++;
}
- if (RARRAY_LEN(ary) == i2) return Qnil;
- if (i2 < RARRAY_LEN(ary))
+ if (i1 == i2) return Qnil;
+ if (i2 < i1)
ARY_SET_LEN(ary, i2);
return ary;
}
@@ -2718,7 +2878,7 @@ rb_ary_select_bang(VALUE ary)
static VALUE
rb_ary_keep_if(VALUE ary)
{
- RETURN_SIZED_ENUMERATOR(ary, 0, 0, rb_ary_length);
+ RETURN_SIZED_ENUMERATOR(ary, 0, 0, ary_enum_length);
rb_ary_select_bang(ary);
return ary;
}
@@ -2763,7 +2923,7 @@ rb_ary_delete(VALUE ary, VALUE item)
long i1, i2;
for (i1 = i2 = 0; i1 < RARRAY_LEN(ary); i1++) {
- VALUE e = RARRAY_PTR(ary)[i1];
+ VALUE e = RARRAY_AREF(ary, i1);
if (rb_equal(e, item)) {
v = e;
@@ -2792,7 +2952,7 @@ rb_ary_delete_same(VALUE ary, VALUE item)
long i1, i2;
for (i1 = i2 = 0; i1 < RARRAY_LEN(ary); i1++) {
- VALUE e = RARRAY_PTR(ary)[i1];
+ VALUE e = RARRAY_AREF(ary, i1);
if (e == item) {
continue;
@@ -2822,9 +2982,10 @@ rb_ary_delete_at(VALUE ary, long pos)
}
rb_ary_modify(ary);
- del = RARRAY_PTR(ary)[pos];
- MEMMOVE(RARRAY_PTR(ary)+pos, RARRAY_PTR(ary)+pos+1, VALUE,
- RARRAY_LEN(ary)-pos-1);
+ del = RARRAY_AREF(ary, pos);
+ RARRAY_PTR_USE(ary, ptr, {
+ MEMMOVE(ptr+pos, ptr+pos+1, VALUE, len-pos-1);
+ });
ARY_INCREASE_LEN(ary, -1);
return del;
@@ -2894,8 +3055,8 @@ rb_ary_slice_bang(int argc, VALUE *argv, VALUE ary)
len = orig_len - pos;
}
if (len == 0) return rb_ary_new2(0);
- arg2 = rb_ary_new4(len, RARRAY_PTR(ary)+pos);
- RBASIC(arg2)->klass = rb_obj_class(ary);
+ arg2 = rb_ary_new4(len, RARRAY_CONST_PTR(ary)+pos);
+ RBASIC_SET_CLASS(arg2, rb_obj_class(ary));
rb_ary_splice(ary, pos, len, Qundef);
return arg2;
}
@@ -2929,9 +3090,9 @@ ary_reject(VALUE orig, VALUE result)
long i;
for (i = 0; i < RARRAY_LEN(orig); i++) {
- VALUE v = RARRAY_PTR(orig)[i];
+ VALUE v = RARRAY_AREF(orig, i);
if (!RTEST(rb_yield(v))) {
- rb_ary_push_1(result, v);
+ rb_ary_push(result, v);
}
}
return result;
@@ -2945,7 +3106,7 @@ ary_reject_bang(VALUE ary)
rb_ary_modify_check(ary);
for (i = 0; i < RARRAY_LEN(ary); ) {
- VALUE v = RARRAY_PTR(ary)[i];
+ VALUE v = RARRAY_AREF(ary, i);
if (RTEST(rb_yield(v))) {
rb_ary_delete_at(ary, i);
result = ary;
@@ -2976,7 +3137,7 @@ ary_reject_bang(VALUE ary)
static VALUE
rb_ary_reject_bang(VALUE ary)
{
- RETURN_SIZED_ENUMERATOR(ary, 0, 0, rb_ary_length);
+ RETURN_SIZED_ENUMERATOR(ary, 0, 0, ary_enum_length);
return ary_reject_bang(ary);
}
@@ -2998,7 +3159,7 @@ rb_ary_reject(VALUE ary)
{
VALUE rejected_ary;
- RETURN_SIZED_ENUMERATOR(ary, 0, 0, rb_ary_length);
+ RETURN_SIZED_ENUMERATOR(ary, 0, 0, ary_enum_length);
rejected_ary = rb_ary_new();
ary_reject(ary, rejected_ary);
return rejected_ary;
@@ -3018,21 +3179,22 @@ rb_ary_reject(VALUE ary)
*
* If no block is given, an Enumerator is returned instead.
*
- * a = [ "a", "b", "c" ]
- * a.delete_if {|x| x >= "b" } #=> ["a"]
+ * scores = [ 97, 42, 75 ]
+ * scores.delete_if {|score| score < 80 } #=> [97]
*/
static VALUE
rb_ary_delete_if(VALUE ary)
{
- RETURN_SIZED_ENUMERATOR(ary, 0, 0, rb_ary_length);
+ RETURN_SIZED_ENUMERATOR(ary, 0, 0, ary_enum_length);
ary_reject_bang(ary);
return ary;
}
static VALUE
-take_i(VALUE val, VALUE *args, int argc, VALUE *argv)
+take_i(RB_BLOCK_CALL_FUNC_ARGLIST(val, cbarg))
{
+ 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);
@@ -3049,8 +3211,8 @@ take_items(VALUE obj, long n)
result = rb_ary_new2(n);
args[0] = result; args[1] = (VALUE)n;
if (rb_check_block_call(obj, idEach, 0, 0, take_i, (VALUE)args) == Qundef)
- rb_raise(rb_eTypeError, "wrong argument type %s (must respond to :each)",
- rb_obj_classname(obj));
+ rb_raise(rb_eTypeError, "wrong argument type %"PRIsVALUE" (must respond to :each)",
+ rb_obj_class(obj));
return result;
}
@@ -3083,31 +3245,57 @@ static VALUE
rb_ary_zip(int argc, VALUE *argv, VALUE ary)
{
int i, j;
- long len;
+ long len = RARRAY_LEN(ary);
VALUE result = Qnil;
- len = RARRAY_LEN(ary);
for (i=0; i<argc; i++) {
argv[i] = take_items(argv[i], len);
}
- if (!rb_block_given_p()) {
- result = rb_ary_new2(len);
- }
- for (i=0; i<RARRAY_LEN(ary); i++) {
- VALUE tmp = rb_ary_new2(argc+1);
+ if (rb_block_given_p()) {
+ int arity = rb_block_arity();
- rb_ary_push(tmp, rb_ary_elt(ary, i));
- for (j=0; j<argc; j++) {
- rb_ary_push(tmp, rb_ary_elt(argv[j], i));
- }
- if (NIL_P(result)) {
- rb_yield(tmp);
+ if (arity > 1) {
+ VALUE work, *tmp;
+
+ tmp = ALLOCV_N(VALUE, work, argc+1);
+
+ for (i=0; i<RARRAY_LEN(ary); i++) {
+ tmp[0] = RARRAY_AREF(ary, i);
+ for (j=0; j<argc; j++) {
+ tmp[j+1] = rb_ary_elt(argv[j], i);
+ }
+ rb_yield_values2(argc+1, tmp);
+ }
+
+ if (work) ALLOCV_END(work);
}
else {
+ for (i=0; i<RARRAY_LEN(ary); i++) {
+ VALUE tmp = rb_ary_new2(argc+1);
+
+ rb_ary_push(tmp, RARRAY_AREF(ary, i));
+ for (j=0; j<argc; j++) {
+ rb_ary_push(tmp, rb_ary_elt(argv[j], i));
+ }
+ rb_yield(tmp);
+ }
+ }
+ }
+ else {
+ result = rb_ary_new_capa(len);
+
+ for (i=0; i<len; i++) {
+ VALUE tmp = rb_ary_new_capa(argc+1);
+
+ rb_ary_push(tmp, RARRAY_AREF(ary, i));
+ for (j=0; j<argc; j++) {
+ rb_ary_push(tmp, rb_ary_elt(argv[j], i));
+ }
rb_ary_push(result, tmp);
}
}
+
return result;
}
@@ -3155,6 +3343,7 @@ rb_ary_transpose(VALUE ary)
/*
* call-seq:
* ary.replace(other_ary) -> ary
+ * ary.initialize_copy(other_ary) -> ary
*
* Replaces the contents of +self+ with the contents of +other_ary+,
* truncating or expanding if necessary.
@@ -3172,19 +3361,17 @@ rb_ary_replace(VALUE copy, VALUE orig)
if (copy == orig) return copy;
if (RARRAY_LEN(orig) <= RARRAY_EMBED_LEN_MAX) {
- VALUE *ptr;
VALUE shared = 0;
if (ARY_OWNS_HEAP_P(copy)) {
- xfree(RARRAY_PTR(copy));
- }
+ RARRAY_PTR_USE(copy, ptr, ruby_sized_xfree(ptr, ARY_HEAP_SIZE(copy)));
+ }
else if (ARY_SHARED_P(copy)) {
shared = ARY_SHARED(copy);
FL_UNSET_SHARED(copy);
}
FL_SET_EMBED(copy);
- ptr = RARRAY_PTR(orig);
- MEMCPY(RARRAY_PTR(copy), ptr, VALUE, RARRAY_LEN(orig));
+ ary_memcpy(copy, 0, RARRAY_LEN(orig), RARRAY_CONST_PTR(orig));
if (shared) {
rb_ary_decrement_share(shared);
}
@@ -3193,13 +3380,13 @@ rb_ary_replace(VALUE copy, VALUE orig)
else {
VALUE shared = ary_make_shared(orig);
if (ARY_OWNS_HEAP_P(copy)) {
- xfree(RARRAY_PTR(copy));
+ RARRAY_PTR_USE(copy, ptr, ruby_sized_xfree(ptr, ARY_HEAP_SIZE(copy)));
}
else {
rb_ary_unshare_safe(copy);
}
FL_UNSET_EMBED(copy);
- ARY_SET_PTR(copy, RARRAY_PTR(orig));
+ ARY_SET_PTR(copy, RARRAY_CONST_PTR(orig));
ARY_SET_LEN(copy, RARRAY_LEN(orig));
rb_ary_set_shared(copy, shared);
}
@@ -3268,7 +3455,6 @@ rb_ary_fill(int argc, VALUE *argv, VALUE ary)
{
VALUE item, arg1, arg2;
long beg = 0, end = 0, len = 0;
- VALUE *p, *pend;
int block_p = FALSE;
if (rb_block_given_p()) {
@@ -3310,7 +3496,7 @@ rb_ary_fill(int argc, VALUE *argv, VALUE ary)
if (end >= ARY_CAPA(ary)) {
ary_resize_capa(ary, end);
}
- rb_mem_clear(RARRAY_PTR(ary) + RARRAY_LEN(ary), end - RARRAY_LEN(ary));
+ ary_mem_clear(ary, RARRAY_LEN(ary), end - RARRAY_LEN(ary));
ARY_SET_LEN(ary, end);
}
@@ -3321,15 +3507,11 @@ 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;
- RARRAY_PTR(ary)[i] = v;
+ ARY_SET(ary, i, v);
}
}
else {
- p = RARRAY_PTR(ary) + beg;
- pend = p + len;
- while (p < pend) {
- *p++ = item;
- }
+ ary_memfill(ary, beg, len, item);
}
return ary;
}
@@ -3343,8 +3525,9 @@ rb_ary_fill(int argc, VALUE *argv, VALUE ary)
*
* [ 1, 2, 3 ] + [ 4, 5 ] #=> [ 1, 2, 3, 4, 5 ]
* a = [ "a", "b", "c" ]
- * a + [ "d", "e", "f" ]
- * a #=> [ "a", "b", "c", "d", "e", "f" ]
+ * c = a + [ "d", "e", "f" ]
+ * c #=> [ "a", "b", "c", "d", "e", "f" ]
+ * a #=> [ "a", "b", "c" ]
*
* See also Array#concat.
*/
@@ -3353,13 +3536,16 @@ VALUE
rb_ary_plus(VALUE x, VALUE y)
{
VALUE z;
- long len;
+ long len, xlen, ylen;
y = to_ary(y);
- len = RARRAY_LEN(x) + RARRAY_LEN(y);
+ xlen = RARRAY_LEN(x);
+ ylen = RARRAY_LEN(y);
+ len = xlen + ylen;
z = rb_ary_new2(len);
- MEMCPY(RARRAY_PTR(z), RARRAY_PTR(x), VALUE, RARRAY_LEN(x));
- MEMCPY(RARRAY_PTR(z) + RARRAY_LEN(x), RARRAY_PTR(y), VALUE, RARRAY_LEN(y));
+
+ ary_memcpy(z, 0, xlen, RARRAY_CONST_PTR(x));
+ ary_memcpy(z, xlen, ylen, RARRAY_CONST_PTR(y));
ARY_SET_LEN(z, len);
return z;
}
@@ -3410,7 +3596,8 @@ rb_ary_concat(VALUE x, VALUE y)
static VALUE
rb_ary_times(VALUE ary, VALUE times)
{
- VALUE ary2, tmp, *ptr, *ptr2;
+ VALUE ary2, tmp;
+ const VALUE *ptr;
long t, len;
tmp = rb_check_string_type(times);
@@ -3434,17 +3621,16 @@ rb_ary_times(VALUE ary, VALUE times)
ary2 = ary_new(rb_obj_class(ary), len);
ARY_SET_LEN(ary2, len);
- ptr = RARRAY_PTR(ary);
- ptr2 = RARRAY_PTR(ary2);
+ ptr = RARRAY_CONST_PTR(ary);
t = RARRAY_LEN(ary);
if (0 < t) {
- MEMCPY(ptr2, ptr, VALUE, t);
- while (t <= len/2) {
- MEMCPY(ptr2+t, ptr2, VALUE, t);
+ ary_memcpy(ary2, 0, t, ptr);
+ while (t <= len/2) {
+ ary_memcpy(ary2, t, t, RARRAY_CONST_PTR(ary2));
t *= 2;
}
if (t < len) {
- MEMCPY(ptr2+t, ptr2, VALUE, len-t);
+ ary_memcpy(ary2, t, len-t, RARRAY_CONST_PTR(ary2));
}
}
out:
@@ -3480,9 +3666,9 @@ rb_ary_assoc(VALUE ary, VALUE key)
VALUE v;
for (i = 0; i < RARRAY_LEN(ary); ++i) {
- v = rb_check_array_type(RARRAY_PTR(ary)[i]);
+ v = rb_check_array_type(RARRAY_AREF(ary, i));
if (!NIL_P(v) && RARRAY_LEN(v) > 0 &&
- rb_equal(RARRAY_PTR(v)[0], key))
+ rb_equal(RARRAY_AREF(v, 0), key))
return v;
}
return Qnil;
@@ -3513,10 +3699,10 @@ rb_ary_rassoc(VALUE ary, VALUE value)
VALUE v;
for (i = 0; i < RARRAY_LEN(ary); ++i) {
- v = RARRAY_PTR(ary)[i];
+ v = RARRAY_AREF(ary, i);
if (RB_TYPE_P(v, T_ARRAY) &&
RARRAY_LEN(v) > 1 &&
- rb_equal(RARRAY_PTR(v)[1], value))
+ rb_equal(RARRAY_AREF(v, 1), value))
return v;
}
return Qnil;
@@ -3526,12 +3712,12 @@ static VALUE
recursive_equal(VALUE ary1, VALUE ary2, int recur)
{
long i, len1;
- VALUE *p1, *p2;
+ const VALUE *p1, *p2;
if (recur) return Qtrue; /* Subtle! */
- p1 = RARRAY_PTR(ary1);
- p2 = RARRAY_PTR(ary2);
+ p1 = RARRAY_CONST_PTR(ary1);
+ p2 = RARRAY_CONST_PTR(ary2);
len1 = RARRAY_LEN(ary1);
for (i = 0; i < len1; i++) {
@@ -3542,8 +3728,8 @@ recursive_equal(VALUE ary1, VALUE ary2, int recur)
return Qfalse;
if (len1 < i)
return Qtrue;
- p1 = RARRAY_PTR(ary1) + i;
- p2 = RARRAY_PTR(ary2) + i;
+ p1 = RARRAY_CONST_PTR(ary1) + i;
+ p2 = RARRAY_CONST_PTR(ary2) + i;
}
else {
return Qfalse;
@@ -3574,12 +3760,13 @@ rb_ary_equal(VALUE ary1, VALUE ary2)
{
if (ary1 == ary2) return Qtrue;
if (!RB_TYPE_P(ary2, T_ARRAY)) {
- if (!rb_respond_to(ary2, rb_intern("to_ary"))) {
+ if (!rb_respond_to(ary2, idTo_ary)) {
return Qfalse;
}
return rb_equal(ary2, ary1);
}
if (RARRAY_LEN(ary1) != RARRAY_LEN(ary2)) return Qfalse;
+ if (RARRAY_CONST_PTR(ary1) == RARRAY_CONST_PTR(ary2)) return Qtrue;
return rb_exec_recursive_paired(recursive_equal, ary1, ary2, ary2);
}
@@ -3610,30 +3797,10 @@ rb_ary_eql(VALUE ary1, VALUE ary2)
if (ary1 == ary2) return Qtrue;
if (!RB_TYPE_P(ary2, T_ARRAY)) return Qfalse;
if (RARRAY_LEN(ary1) != RARRAY_LEN(ary2)) return Qfalse;
+ if (RARRAY_CONST_PTR(ary1) == RARRAY_CONST_PTR(ary2)) return Qtrue;
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_PTR(ary)[i]);
- h = rb_hash_uint(h, NUM2LONG(n));
- }
- }
- h = rb_hash_end(h);
- return LONG2FIX(h);
-}
-
/*
* call-seq:
* ary.hash -> fixnum
@@ -3642,12 +3809,25 @@ recursive_hash(VALUE ary, VALUE dummy, int recur)
*
* 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)
{
- return rb_exec_recursive_outer(recursive_hash, ary, 0);
+ 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);
}
/*
@@ -3668,7 +3848,7 @@ rb_ary_includes(VALUE ary, VALUE item)
long i;
for (i=0; i<RARRAY_LEN(ary); i++) {
- if (rb_equal(RARRAY_PTR(ary)[i], item)) {
+ if (rb_equal(RARRAY_AREF(ary, i), item)) {
return Qtrue;
}
}
@@ -3687,7 +3867,8 @@ recursive_cmp(VALUE ary1, VALUE ary2, int recur)
len = RARRAY_LEN(ary2);
}
for (i=0; i<len; i++) {
- VALUE v = rb_funcall(rb_ary_elt(ary1, i), id_cmp, 1, rb_ary_elt(ary2, i));
+ VALUE e1 = rb_ary_elt(ary1, i), e2 = rb_ary_elt(ary2, i);
+ VALUE v = rb_funcallv(e1, id_cmp, 1, &e2);
if (v != INT2FIX(0)) {
return v;
}
@@ -3702,21 +3883,26 @@ 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 two elements
- * that are not equal will determine the return value for the whole
- * comparison.
+ * 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.
*
- * If all the values are equal, then the return is based on a comparison of
+ * If all the elements are equal, then the result 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
*
*/
@@ -3743,7 +3929,10 @@ ary_add_hash(VALUE hash, VALUE ary)
long i;
for (i=0; i<RARRAY_LEN(ary); i++) {
- rb_hash_aset(hash, RARRAY_PTR(ary)[i], Qtrue);
+ VALUE elt = RARRAY_AREF(ary, i);
+ if (rb_hash_lookup2(hash, elt, Qundef) == Qundef) {
+ rb_hash_aset(hash, elt, elt);
+ }
}
return hash;
}
@@ -3753,7 +3942,7 @@ ary_tmp_hash_new(void)
{
VALUE hash = rb_hash_new();
- RBASIC(hash)->klass = 0;
+ RBASIC_CLEAR_CLASS(hash);
return hash;
}
@@ -3823,7 +4012,7 @@ rb_ary_diff(VALUE ary1, VALUE ary2)
ary3 = rb_ary_new();
for (i=0; i<RARRAY_LEN(ary1); i++) {
- if (st_lookup(RHASH_TBL(hash), RARRAY_PTR(ary1)[i], 0)) continue;
+ if (st_lookup(rb_hash_tbl_raw(hash), RARRAY_AREF(ary1, i), 0)) continue;
rb_ary_push(ary3, rb_ary_elt(ary1, i));
}
ary_recycle_hash(hash);
@@ -3851,20 +4040,20 @@ static VALUE
rb_ary_and(VALUE ary1, VALUE ary2)
{
VALUE hash, ary3, v;
+ st_table *table;
st_data_t vv;
long i;
ary2 = to_ary(ary2);
- ary3 = rb_ary_new2(RARRAY_LEN(ary1) < RARRAY_LEN(ary2) ?
- RARRAY_LEN(ary1) : RARRAY_LEN(ary2));
+ ary3 = rb_ary_new();
+ if (RARRAY_LEN(ary2) == 0) return ary3;
hash = ary_make_hash(ary2);
-
- if (RHASH_EMPTY_P(hash))
- return ary3;
+ table = rb_hash_tbl_raw(hash);
for (i=0; i<RARRAY_LEN(ary1); i++) {
- vv = (st_data_t)(v = rb_ary_elt(ary1, i));
- if (st_delete(RHASH_TBL(hash), &vv, 0)) {
+ v = RARRAY_AREF(ary1, i);
+ vv = (st_data_t)v;
+ if (st_delete(table, &vv, 0)) {
rb_ary_push(ary3, v);
}
}
@@ -3873,6 +4062,14 @@ 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
@@ -3890,26 +4087,19 @@ rb_ary_and(VALUE ary1, VALUE ary2)
static VALUE
rb_ary_or(VALUE ary1, VALUE ary2)
{
- VALUE hash, ary3, v;
- st_data_t vv;
+ VALUE hash, ary3;
long i;
ary2 = to_ary(ary2);
- ary3 = rb_ary_new2(RARRAY_LEN(ary1)+RARRAY_LEN(ary2));
- hash = ary_add_hash(ary_make_hash(ary1), ary2);
+ hash = ary_make_hash(ary1);
- for (i=0; i<RARRAY_LEN(ary1); i++) {
- vv = (st_data_t)(v = rb_ary_elt(ary1, i));
- if (st_delete(RHASH_TBL(hash), &vv, 0)) {
- rb_ary_push(ary3, v);
- }
- }
for (i=0; i<RARRAY_LEN(ary2); i++) {
- vv = (st_data_t)(v = rb_ary_elt(ary2, i));
- if (st_delete(RHASH_TBL(hash), &vv, 0)) {
- rb_ary_push(ary3, v);
+ 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);
ary_recycle_hash(hash);
return ary3;
}
@@ -3949,38 +4139,29 @@ push_value(st_data_t key, st_data_t val, st_data_t ary)
static VALUE
rb_ary_uniq_bang(VALUE ary)
{
- VALUE hash, v;
- long i, j;
+ VALUE hash;
+ long hash_size;
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);
- if (RARRAY_LEN(ary) == (i = RHASH_SIZE(hash))) {
- return Qnil;
- }
- 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, i);
- st_foreach(RHASH_TBL(hash), push_value, ary);
- }
- else {
+ else
hash = ary_make_hash(ary);
- if (RARRAY_LEN(ary) == (long)RHASH_SIZE(hash)) {
- return Qnil;
- }
- for (i=j=0; i<RARRAY_LEN(ary); i++) {
- st_data_t vv = (st_data_t)(v = rb_ary_elt(ary, i));
- if (st_delete(RHASH_TBL(hash), &vv, 0)) {
- rb_ary_store(ary, j++, v);
- }
- }
- ARY_SET_LEN(ary, j);
+
+ 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);
ary_recycle_hash(hash);
return ary;
@@ -4008,26 +4189,19 @@ rb_ary_uniq_bang(VALUE ary)
static VALUE
rb_ary_uniq(VALUE ary)
{
- VALUE hash, uniq, v;
- long i;
+ VALUE hash, uniq;
if (RARRAY_LEN(ary) <= 1)
return rb_ary_dup(ary);
if (rb_block_given_p()) {
hash = ary_make_hash_by(ary);
- uniq = ary_new(rb_obj_class(ary), RHASH_SIZE(hash));
- st_foreach(RHASH_TBL(hash), push_value, uniq);
+ uniq = rb_hash_values(hash);
}
else {
hash = ary_make_hash(ary);
- uniq = ary_new(rb_obj_class(ary), RHASH_SIZE(hash));
- for (i=0; i<RARRAY_LEN(ary); i++) {
- st_data_t vv = (st_data_t)(v = rb_ary_elt(ary, i));
- if (st_delete(RHASH_TBL(hash), &vv, 0)) {
- rb_ary_push(uniq, v);
- }
- }
+ uniq = rb_hash_values(hash);
}
+ RBASIC_SET_CLASS(uniq, rb_obj_class(ary));
ary_recycle_hash(hash);
return uniq;
@@ -4052,21 +4226,18 @@ rb_ary_compact_bang(VALUE ary)
long n;
rb_ary_modify(ary);
- p = t = RARRAY_PTR(ary);
+ p = t = (VALUE *)RARRAY_CONST_PTR(ary); /* WB: no new reference */
end = p + RARRAY_LEN(ary);
while (t < end) {
if (NIL_P(*t)) t++;
else *p++ = *t++;
}
- n = p - RARRAY_PTR(ary);
+ n = p - RARRAY_CONST_PTR(ary);
if (RARRAY_LEN(ary) == n) {
return Qnil;
}
- ARY_SET_LEN(ary, n);
- if (n * 2 < ARY_CAPA(ary) && ARY_DEFAULT_SIZE * 2 < ARY_CAPA(ary)) {
- ary_resize_capa(ary, n * 2);
- }
+ ary_resize_smaller(ary, n);
return ary;
}
@@ -4098,7 +4269,7 @@ rb_ary_compact(VALUE ary)
* Returns the number of elements.
*
* If an argument is given, counts the number of elements which equal +obj+
- * using <code>===</code>.
+ * using <code>==</code>.
*
* If a block is given, counts the number of elements for which the block
* returns a true value.
@@ -4122,7 +4293,7 @@ rb_ary_count(int argc, VALUE *argv, VALUE ary)
return LONG2NUM(RARRAY_LEN(ary));
for (i = 0; i < RARRAY_LEN(ary); i++) {
- v = RARRAY_PTR(ary)[i];
+ v = RARRAY_AREF(ary, i);
if (RTEST(rb_yield(v))) n++;
}
}
@@ -4134,7 +4305,7 @@ rb_ary_count(int argc, VALUE *argv, VALUE ary)
rb_warn("given block not used");
}
for (i = 0; i < RARRAY_LEN(ary); i++) {
- if (rb_equal(RARRAY_PTR(ary)[i], obj)) n++;
+ if (rb_equal(RARRAY_AREF(ary, i), obj)) n++;
}
}
@@ -4157,7 +4328,7 @@ flatten(VALUE ary, int level, int *modified)
while (1) {
while (i < RARRAY_LEN(ary)) {
- elt = RARRAY_PTR(ary)[i++];
+ elt = RARRAY_AREF(ary, i++);
tmp = rb_check_array_type(elt);
if (RBASIC(result)->klass) {
rb_raise(rb_eRuntimeError, "flatten reentered");
@@ -4191,7 +4362,7 @@ flatten(VALUE ary, int level, int *modified)
st_free_table(memo);
- RBASIC(result)->klass = rb_class_of(ary);
+ RBASIC_SET_CLASS(result, rb_class_of(ary));
return result;
}
@@ -4278,7 +4449,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 VALUE sym_random;
+static ID id_random;
#define RAND_UPTO(max) (long)rb_random_ulong_limited((randgen), (max)-1)
@@ -4289,34 +4460,46 @@ static VALUE sym_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
rb_ary_shuffle_bang(int argc, VALUE *argv, VALUE ary)
{
- VALUE *ptr, opts, *snap_ptr, randgen = rb_cRandom;
- long i, snap_len;
+ VALUE opts, randgen = rb_cRandom;
+ long i, len;
if (OPTHASH_GIVEN_P(opts)) {
- randgen = rb_hash_lookup2(opts, sym_random, randgen);
+ 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;
+ }
}
rb_check_arity(argc, 0, 0);
rb_ary_modify(ary);
- i = RARRAY_LEN(ary);
- ptr = RARRAY_PTR(ary);
- snap_len = i;
- snap_ptr = ptr;
- while (i) {
- long j = RAND_UPTO(i);
- VALUE tmp;
- if (snap_len != RARRAY_LEN(ary) || snap_ptr != RARRAY_PTR(ary)) {
- rb_raise(rb_eRuntimeError, "modified during shuffle");
+ i = len = RARRAY_LEN(ary);
+ RARRAY_PTR_USE(ary, ptr, {
+ while (i) {
+ long j = RAND_UPTO(i);
+ VALUE tmp;
+ if (len != RARRAY_LEN(ary) || ptr != RARRAY_CONST_PTR(ary)) {
+ rb_raise(rb_eRuntimeError, "modified during shuffle");
+ }
+ tmp = ptr[--i];
+ ptr[i] = ptr[j];
+ ptr[j] = tmp;
}
- tmp = ptr[--i];
- ptr[i] = ptr[j];
- ptr[j] = tmp;
- }
+ }); /* WB: no new reference */
return ary;
}
@@ -4330,6 +4513,7 @@ 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.
*
@@ -4372,27 +4556,29 @@ rb_ary_shuffle(int argc, VALUE *argv, VALUE ary)
static VALUE
rb_ary_sample(int argc, VALUE *argv, VALUE ary)
{
- VALUE nv, result, *ptr;
+ VALUE nv, result;
VALUE opts, randgen = rb_cRandom;
long n, len, i, j, k, idx[10];
long rnds[numberof(idx)];
if (OPTHASH_GIVEN_P(opts)) {
- randgen = rb_hash_lookup2(opts, sym_random, randgen);
+ 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;
+ }
}
- ptr = RARRAY_PTR(ary);
len = RARRAY_LEN(ary);
if (argc == 0) {
- if (len == 0) return Qnil;
- if (len == 1) {
+ if (len < 2)
i = 0;
- }
- else {
+ else
i = RAND_UPTO(len);
- if ((len = RARRAY_LEN(ary)) <= i) return Qnil;
- ptr = RARRAY_PTR(ary);
- }
- return ptr[i];
+
+ return rb_ary_elt(ary, i);
}
rb_scan_args(argc, argv, "1", &nv);
n = NUM2LONG(nv);
@@ -4405,28 +4591,23 @@ rb_ary_sample(int argc, VALUE *argv, VALUE ary)
}
k = len;
len = RARRAY_LEN(ary);
- ptr = RARRAY_PTR(ary);
- if (len < k) {
- if (n <= numberof(idx)) {
- for (i = 0; i < n; ++i) {
- if (rnds[i] >= len) {
- return rb_ary_new2(0);
- }
- }
+ if (len < k && n <= numberof(idx)) {
+ for (i = 0; i < n; ++i) {
+ if (rnds[i] >= len) return rb_ary_new_capa(0);
}
}
if (n > len) n = len;
switch (n) {
case 0:
- return rb_ary_new2(0);
+ return rb_ary_new_capa(0);
case 1:
i = rnds[0];
- return rb_ary_new4(1, &ptr[i]);
+ return rb_ary_new_from_values(1, &RARRAY_AREF(ary, i));
case 2:
i = rnds[0];
j = rnds[1];
if (j >= i) j++;
- return rb_ary_new3(2, ptr[i], ptr[j]);
+ return rb_ary_new_from_args(2, RARRAY_AREF(ary, i), RARRAY_AREF(ary, j));
case 3:
i = rnds[0];
j = rnds[1];
@@ -4436,10 +4617,9 @@ rb_ary_sample(int argc, VALUE *argv, VALUE ary)
if (j >= i) l = i, g = ++j;
if (k >= l && (++k >= g)) ++k;
}
- return rb_ary_new3(3, ptr[i], ptr[j], ptr[k]);
+ return rb_ary_new_from_args(3, RARRAY_AREF(ary, i), RARRAY_AREF(ary, j), RARRAY_AREF(ary, k));
}
if (n <= numberof(idx)) {
- VALUE *ptr_result;
long sorted[numberof(idx)];
sorted[0] = idx[0] = rnds[0];
for (i=1; i<n; i++) {
@@ -4451,25 +4631,26 @@ rb_ary_sample(int argc, VALUE *argv, VALUE ary)
memmove(&sorted[j+1], &sorted[j], sizeof(sorted[0])*(i-j));
sorted[j] = idx[i] = k;
}
- result = rb_ary_new2(n);
- ptr_result = RARRAY_PTR(result);
- for (i=0; i<n; i++) {
- ptr_result[i] = ptr[idx[i]];
- }
+ result = rb_ary_new_capa(n);
+ RARRAY_PTR_USE(result, ptr_result, {
+ for (i=0; i<n; i++) {
+ ptr_result[i] = RARRAY_AREF(ary, idx[i]);
+ }
+ });
}
else {
- VALUE *ptr_result;
- result = rb_ary_new4(len, ptr);
- RBASIC(result)->klass = 0;
- ptr_result = RARRAY_PTR(result);
+ result = rb_ary_dup(ary);
+ RBASIC_CLEAR_CLASS(result);
RB_GC_GUARD(ary);
- for (i=0; i<n; i++) {
- j = RAND_UPTO(len-i) + i;
- nv = ptr_result[j];
- ptr_result[j] = ptr_result[i];
- ptr_result[i] = nv;
- }
- RBASIC(result)->klass = rb_cArray;
+ RARRAY_PTR_USE(result, ptr_result, {
+ for (i=0; i<n; i++) {
+ j = RAND_UPTO(len-i) + i;
+ nv = ptr_result[j];
+ ptr_result[j] = ptr_result[i];
+ ptr_result[i] = nv;
+ }
+ });
+ RBASIC_SET_CLASS_RAW(result, rb_cArray);
}
ARY_SET_LEN(result, n);
@@ -4477,18 +4658,19 @@ rb_ary_sample(int argc, VALUE *argv, VALUE ary)
}
static VALUE
-rb_ary_cycle_size(VALUE self, VALUE args)
+rb_ary_cycle_size(VALUE self, VALUE args, VALUE eobj)
{
long mul;
VALUE n = Qnil;
if (args && (RARRAY_LEN(args) > 0)) {
- n = RARRAY_PTR(args)[0];
+ n = RARRAY_AREF(args, 0);
}
if (RARRAY_LEN(self) == 0) return INT2FIX(0);
if (n == Qnil) return DBL2NUM(INFINITY);
mul = NUM2LONG(n);
if (mul <= 0) return INT2FIX(0);
- return rb_funcall(rb_ary_length(self), '*', 1, LONG2FIX(mul));
+ n = LONG2FIX(mul);
+ return rb_funcallv(rb_ary_length(self), '*', 1, &n);
}
/*
@@ -4530,20 +4712,38 @@ rb_ary_cycle(int argc, VALUE *argv, VALUE ary)
while (RARRAY_LEN(ary) > 0 && (n < 0 || 0 < n--)) {
for (i=0; i<RARRAY_LEN(ary); i++) {
- rb_yield(RARRAY_PTR(ary)[i]);
+ rb_yield(RARRAY_AREF(ary, i));
}
}
return Qnil;
}
#define tmpbuf(n, size) rb_str_tmp_new((n)*(size))
-#define tmpbuf_discard(s) (rb_str_resize((s), 0L), RBASIC(s)->klass = rb_cString)
+#define tmpbuf_discard(s) (rb_str_resize((s), 0L), RBASIC_SET_CLASS_RAW(s, rb_cString))
#define tmpary(n) rb_ary_tmp_new(n)
-#define tmpary_discard(a) (ary_discard(a), RBASIC(a)->klass = rb_cArray)
+#define tmpary_discard(a) (ary_discard(a), RBASIC_SET_CLASS_RAW(a, rb_cArray))
/*
- * Recursively compute permutations of +r+ elements of the set
- * <code>[0..n-1]</code>.
+ * 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>.
*
* When we have a complete permutation of array indexes, copy the values
* at those indexes into a new array and yield that array.
@@ -4551,38 +4751,40 @@ rb_ary_cycle(int argc, VALUE *argv, VALUE ary)
* 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(long n, long r, long *p, long index, char *used, VALUE values)
+permute0(const long n, const long r, long *const p, char *const used, const VALUE values)
{
- long i,j;
- for (i = 0; i < n; i++) {
- if (used[i] == 0) {
+ 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;
p[index] = i;
+ used[i] = 1; /* mark index used */
+ ++index;
if (index < r-1) { /* if not done yet */
- used[i] = 1; /* mark index used */
- permute0(n, r, p, index+1, /* recurse */
- used, values);
- used[i] = 0; /* index unused */
+ p[index] = i = 0;
+ continue;
}
- 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) {
+ for (i = 0; i < n; ++i) {
+ if (used[i]) continue;
+ p[index] = i;
+ if (!yield_indexed_values(values, r, p)) {
rb_raise(rb_eRuntimeError, "permute reentered");
}
}
+ i = p[--index]; /* pop index */
+ used[i] = 0; /* index unused */
+ p[index] = ++i;
}
}
}
@@ -4596,7 +4798,8 @@ descending_factorial(long from, long how_many)
{
VALUE cnt = LONG2FIX(how_many >= 0);
while (how_many-- > 0) {
- cnt = rb_funcall(cnt, '*', 1, LONG2FIX(from--));
+ VALUE v = LONG2FIX(from--);
+ cnt = rb_funcallv(cnt, '*', 1, &v);
}
return cnt;
}
@@ -4604,20 +4807,23 @@ descending_factorial(long from, long how_many)
static VALUE
binomial_coefficient(long comb, long size)
{
+ VALUE r, v;
if (comb > size-comb) {
comb = size-comb;
}
if (comb < 0) {
return LONG2FIX(0);
}
- return rb_funcall(descending_factorial(size, comb), id_div, 1, descending_factorial(comb, comb));
+ r = descending_factorial(size, comb);
+ v = descending_factorial(comb, comb);
+ return rb_funcallv(r, id_div, 1, &v);
}
static VALUE
-rb_ary_permutation_size(VALUE ary, VALUE args)
+rb_ary_permutation_size(VALUE ary, VALUE args, VALUE eobj)
{
long n = RARRAY_LEN(ary);
- long k = (args && (RARRAY_LEN(args) > 0)) ? NUM2LONG(RARRAY_PTR(args)[0]) : n;
+ long k = (args && (RARRAY_LEN(args) > 0)) ? NUM2LONG(RARRAY_AREF(args, 0)) : n;
return descending_factorial(n, k);
}
@@ -4669,32 +4875,51 @@ rb_ary_permutation(int argc, VALUE *argv, VALUE ary)
}
else if (r == 1) { /* this is a special, easy case */
for (i = 0; i < RARRAY_LEN(ary); i++) {
- rb_yield(rb_ary_new3(1, RARRAY_PTR(ary)[i]));
+ rb_yield(rb_ary_new3(1, RARRAY_AREF(ary, i)));
}
}
else { /* this is the general case */
- 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);
+ volatile VALUE t0;
+ long *p = (long*)ALLOCV(t0, r*sizeof(long)+n*sizeof(char));
+ char *used = (char*)(p + r);
VALUE ary0 = ary_make_shared_copy(ary); /* private defensive copy of ary */
- RBASIC(ary0)->klass = 0;
+ RBASIC_CLEAR_CLASS(ary0);
MEMZERO(used, char, n); /* initialize array */
- permute0(n, r, p, 0, used, ary0); /* compute and yield permutations */
- tmpbuf_discard(t0);
- tmpbuf_discard(t1);
- RBASIC(ary0)->klass = rb_cArray;
+ permute0(n, r, p, used, ary0); /* compute and yield permutations */
+ ALLOCV_END(t0);
+ 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)
+rb_ary_combination_size(VALUE ary, VALUE args, VALUE eobj)
{
long n = RARRAY_LEN(ary);
- long k = NUM2LONG(RARRAY_PTR(args)[0]);
+ long k = NUM2LONG(RARRAY_AREF(args, 0));
return binomial_coefficient(k, n);
}
@@ -4727,7 +4952,7 @@ rb_ary_combination_size(VALUE ary, VALUE args)
static VALUE
rb_ary_combination(VALUE ary, VALUE num)
{
- long n, i, len;
+ long i, n, len;
n = NUM2LONG(num);
RETURN_SIZED_ENUMERATOR(ary, 1, &num, rb_ary_combination_size);
@@ -4740,41 +4965,24 @@ rb_ary_combination(VALUE ary, VALUE num)
}
else if (n == 1) {
for (i = 0; i < len; i++) {
- rb_yield(rb_ary_new3(1, RARRAY_PTR(ary)[i]));
+ rb_yield(rb_ary_new3(1, RARRAY_AREF(ary, i)));
}
}
else {
- 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_PTR(ary)[stack[lev+1]];
- for (lev++; lev < n; lev++) {
- chosen[lev] = RARRAY_PTR(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);
+ 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);
}
return ary;
}
/*
- * Recursively compute repeated permutations of +r+ elements of the set
+ * 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
@@ -4783,47 +4991,44 @@ 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(long n, long r, long *p, long index, VALUE values)
+rpermute0(const long n, const long r, long *const p, const VALUE values)
{
- 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 */
+ long i = 0, index = 0;
+
+ p[index] = i;
+ for (;;) {
+ if (++index < r-1) {
+ p[index] = i = 0;
+ continue;
}
- 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) {
+ for (i = 0; i < n; ++i) {
+ p[index] = i;
+ if (!yield_indexed_values(values, r, p)) {
rb_raise(rb_eRuntimeError, "repeated permute reentered");
}
}
+ do {
+ if (index <= 0) return;
+ } while ((i = ++p[--index]) >= n);
}
}
static VALUE
-rb_ary_repeated_permutation_size(VALUE ary, VALUE args)
+rb_ary_repeated_permutation_size(VALUE ary, VALUE args, VALUE eobj)
{
long n = RARRAY_LEN(ary);
- long k = NUM2LONG(RARRAY_PTR(args)[0]);
+ long k = NUM2LONG(RARRAY_AREF(args, 0));
+ VALUE v;
if (k < 0) {
return LONG2FIX(0);
}
- return rb_funcall(LONG2NUM(n), id_power, 1, LONG2NUM(k));
+ v = LONG2NUM(k);
+ return rb_funcallv(LONG2NUM(n), id_power, 1, &v);
}
/*
@@ -4866,51 +5071,50 @@ rb_ary_repeated_permutation(VALUE ary, VALUE num)
}
else if (r == 1) { /* this is a special, easy case */
for (i = 0; i < RARRAY_LEN(ary); i++) {
- rb_yield(rb_ary_new3(1, RARRAY_PTR(ary)[i]));
+ rb_yield(rb_ary_new3(1, RARRAY_AREF(ary, i)));
}
}
else { /* this is the general case */
- volatile VALUE t0 = tmpbuf(r, sizeof(long));
- long *p = (long*)RSTRING_PTR(t0);
+ volatile VALUE t0;
+ long *p = ALLOCV_N(long, t0, r * sizeof(long));
VALUE ary0 = ary_make_shared_copy(ary); /* private defensive copy of ary */
- RBASIC(ary0)->klass = 0;
+ RBASIC_CLEAR_CLASS(ary0);
- rpermute0(n, r, p, 0, ary0); /* compute and yield repeated permutations */
- tmpbuf_discard(t0);
- RBASIC(ary0)->klass = rb_cArray;
+ rpermute0(n, r, p, ary0); /* compute and yield repeated permutations */
+ ALLOCV_END(t0);
+ RBASIC_SET_CLASS_RAW(ary0, rb_cArray);
}
return ary;
}
static void
-rcombinate0(long n, long r, long *p, long index, long rest, VALUE values)
+rcombinate0(const long n, const long r, long *const p, const long rest, const VALUE values)
{
- long j;
- if (rest > 0) {
- for (; index < n; ++index) {
- p[r-rest] = index;
- rcombinate0(n, r, p, index, rest-1, values);
+ long i = 0, index = 0;
+
+ p[index] = i;
+ for (;;) {
+ if (++index < r-1) {
+ p[index] = i;
+ continue;
}
- }
- 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");
+ for (; i < n; ++i) {
+ p[index] = i;
+ if (!yield_indexed_values(values, r, p)) {
+ rb_raise(rb_eRuntimeError, "repeated combination reentered");
+ }
}
+ do {
+ if (index <= 0) return;
+ } while ((i = ++p[--index]) >= n);
}
}
static VALUE
-rb_ary_repeated_combination_size(VALUE ary, VALUE args)
+rb_ary_repeated_combination_size(VALUE ary, VALUE args, VALUE eobj)
{
long n = RARRAY_LEN(ary);
- long k = NUM2LONG(RARRAY_PTR(args)[0]);
+ long k = NUM2LONG(RARRAY_AREF(args, 0));
if (k == 0) {
return LONG2FIX(1);
}
@@ -4960,21 +5164,21 @@ rb_ary_repeated_combination(VALUE ary, VALUE num)
}
else if (n == 1) {
for (i = 0; i < len; i++) {
- rb_yield(rb_ary_new3(1, RARRAY_PTR(ary)[i]));
+ rb_yield(rb_ary_new3(1, RARRAY_AREF(ary, i)));
}
}
else if (len == 0) {
/* yield nothing */
}
else {
- volatile VALUE t0 = tmpbuf(n, sizeof(long));
- long *p = (long*)RSTRING_PTR(t0);
+ volatile VALUE t0;
+ long *p = ALLOCV_N(long, t0, n);
VALUE ary0 = ary_make_shared_copy(ary); /* private defensive copy of ary */
- RBASIC(ary0)->klass = 0;
+ RBASIC_CLEAR_CLASS(ary0);
- rcombinate0(len, n, p, 0, n, ary0); /* compute and yield repeated combinations */
- tmpbuf_discard(t0);
- RBASIC(ary0)->klass = rb_cArray;
+ rcombinate0(len, n, p, n, ary0); /* compute and yield repeated combinations */
+ ALLOCV_END(t0);
+ RBASIC_SET_CLASS_RAW(ary0, rb_cArray);
}
return ary;
}
@@ -5012,8 +5216,8 @@ rb_ary_product(int argc, VALUE *argv, VALUE ary)
long i,j;
long resultlen = 1;
- RBASIC(t0)->klass = 0;
- RBASIC(t1)->klass = 0;
+ RBASIC_CLEAR_CLASS(t0);
+ RBASIC_CLEAR_CLASS(t1);
/* initialize the arrays of arrays */
ARY_SET_LEN(t0, n);
@@ -5138,7 +5342,7 @@ rb_ary_take_while(VALUE ary)
RETURN_ENUMERATOR(ary, 0, 0);
for (i = 0; i < RARRAY_LEN(ary); i++) {
- if (!RTEST(rb_yield(RARRAY_PTR(ary)[i]))) break;
+ if (!RTEST(rb_yield(RARRAY_AREF(ary, i)))) break;
}
return rb_ary_take(ary, LONG2FIX(i));
}
@@ -5198,12 +5402,37 @@ rb_ary_drop_while(VALUE ary)
RETURN_ENUMERATOR(ary, 0, 0);
for (i = 0; i < RARRAY_LEN(ary); i++) {
- if (!RTEST(rb_yield(RARRAY_PTR(ary)[i]))) break;
+ if (!RTEST(rb_yield(RARRAY_AREF(ary, i)))) break;
}
return rb_ary_drop(ary, LONG2FIX(i));
}
/*
+ * 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;
+}
+
+/*
* Arrays are ordered, integer-indexed collections of any object.
*
* Array indexing starts at 0, as in C or Java. A negative index is assumed
@@ -5260,7 +5489,8 @@ rb_ary_drop_while(VALUE ary)
*
* Elements in an array can be retrieved using the Array#[] method. It can
* take a single integer argument (a numeric index), a pair of arguments
- * (start and length) or a range.
+ * (start and length) or a range. Negative indices start counting from the end,
+ * with -1 being the last element.
*
* arr = [1, 2, 3, 4, 5, 6]
* arr[2] #=> 3
@@ -5268,6 +5498,7 @@ rb_ary_drop_while(VALUE ary)
* arr[-3] #=> 4
* arr[2, 3] #=> [3, 4, 5]
* arr[1..4] #=> [2, 3, 4, 5]
+ * arr[1..-3] #=> [2, 3, 4]
*
* Another way to access a particular array element is by using the #at method
*
@@ -5356,7 +5587,8 @@ rb_ary_drop_while(VALUE ary)
* To delete a particular element anywhere in an array, use #delete:
*
* arr = [1, 2, 2, 3]
- * arr.delete(2) #=> [1, 3]
+ * arr.delete(2) #=> 2
+ * arr #=> [1,3]
*
* A useful method if you need to remove +nil+ values from an array is
* #compact:
@@ -5391,10 +5623,10 @@ rb_ary_drop_while(VALUE ary)
* Another sometimes useful iterator is #reverse_each which will iterate over
* the elements in the array in reverse order.
*
- * words = %w[rats live on no evil star]
+ * words = %w[first second third fourth fifth sixth]
* str = ""
- * words.reverse_each { |word| str += "#{word.reverse} " }
- * str #=> "rats live on no evil star "
+ * words.reverse_each { |word| str += "#{word} " }
+ * p str #=> "sixth fifth fourth third second first "
*
* The #map method can be used to create a new array based on the original
* array, but with the values modified by the supplied block:
@@ -5455,6 +5687,7 @@ Init_Array(void)
rb_define_method(rb_cArray, "inspect", rb_ary_inspect, 0);
rb_define_alias(rb_cArray, "to_s", "inspect");
rb_define_method(rb_cArray, "to_a", rb_ary_to_a, 0);
+ rb_define_method(rb_cArray, "to_h", rb_ary_to_h, 0);
rb_define_method(rb_cArray, "to_ary", rb_ary_to_ary_m, 0);
rb_define_method(rb_cArray, "frozen?", rb_ary_frozen_p, 0);
@@ -5548,9 +5781,10 @@ 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, "any?", rb_ary_any_p, 0);
id_cmp = rb_intern("<=>");
- sym_random = ID2SYM(rb_intern("random"));
+ id_random = rb_intern("random");
id_div = rb_intern("div");
id_power = rb_intern("**");
}
diff --git a/bcc32/Makefile.sub b/bcc32/Makefile.sub
deleted file mode 100644
index 1cd26a8643..0000000000
--- a/bcc32/Makefile.sub
+++ /dev/null
@@ -1,617 +0,0 @@
-# -*- makefile -*-
-
-SHELL = $(COMSPEC)
-MKFILES = Makefile
-
-!ifndef MFLAGS
-MFLAGS=-
-!endif
-
-#### Start of system configuration section. ####
-!ifndef OS
-OS = bccwin32
-!endif
-!if !defined(RT)
-!error RT not defined. Retry from configure pass.
-!endif
-
-arch = $(ARCH)-$(OS)
-
-## variables may be overridden by $(compile_dir)/Makefile
-!ifndef srcdir
-srcdir = ..
-!endif
-!ifndef RUBY_INSTALL_NAME
-RUBY_INSTALL_NAME = ruby
-!endif
-!ifndef RUBYW_INSTALL_NAME
-RUBYW_INSTALL_NAME = $(RUBY_INSTALL_NAME:ruby=rubyw)
-!elif "$(RUBYW_INSTALL_NAME)" == "$(RUBY_INSTALL_NAME)"
-RUBYW_INSTALL_NAME = $(RUBY_INSTALL_NAME:ruby=rubyw)
-!endif
-!if "$(RUBYW_INSTALL_NAME)" == "$(RUBY_INSTALL_NAME)"
-RUBYW_INSTALL_NAME = $(RUBY_INSTALL_NAME)w
-!endif
-!ifndef RUBY_SO_NAME
-RUBY_SO_NAME = $(RT)-$(RUBY_INSTALL_NAME)$(MAJOR)$(MINOR)$(TEENY)
-!endif
-!ifndef icondirs
-!ifdef ICONDIRS
-icondirs=$(ICONDIRS)
-!endif
-!endif
-!ifdef icondirs
-icondirs=$(icondirs:\=/)
-iconinc=-I$(icondirs: = -I)
-!endif
-###############
-
-.SUFFIXES: .y
-
-!ifndef CC
-CC = bcc32
-!endif
-!ifndef CPP
-CPP = cpp32
-!endif
-!ifndef RC
-RC = brcc32
-!endif
-!ifndef YACC
-YACC = bison
-!endif
-!ifndef AR
-AR = tlib
-!endif
-!ifndef BASERUBY
-BASERUBY = ruby
-!endif
-
-PURIFY =
-AUTOCONF = autoconf
-IFCHANGE = $(srcdir:/=\)\win32\ifchange.bat
-RM = $(srcdir:/=\)\win32\rm.bat
-CP = copy > nul
-MV = move > nul
-
-!if !defined(PROCESSOR_ARCHITECTURE)
-PROCESSOR_ARCHITECTURE = x86
-!endif
-MACHINE = $(PROCESSOR_ARCHITECTURE)
-!if "$(PROCESSOR_ARCHITECTURE)" == "x86"
-!ifndef PROCESSOR_LEVEL
-PROCESSOR_LEVEL = 5
-!endif
-!if 6 < $(PROCESSOR_LEVEL)
-PROCESSOR_LEVEL = 6
-!endif
-PROCESSOR_FLAG = -$(PROCESSOR_LEVEL)
-CPU = i$(PROCESSOR_LEVEL)86
-ARCH = i386
-!else
-CPU = $(PROCESSOR_ARCHITECTURE)
-ARCH = $(PROCESSOR_ARCHITECTURE)
-!endif
-!ifndef DEBUGFLAGS
-DEBUGFLAGS =
-!endif
-!ifndef OPTFLAGS
-OPTFLAGS = -O
-!endif
-
-!ifndef prefix
-prefix = /usr
-!endif
-!ifndef exec_prefix
-exec_prefix = $(prefix)
-!endif
-!ifndef libdir
-libdir = $(exec_prefix)/lib
-!endif
-!if !defined(datadir)
-datadir = $(prefix)/share
-!endif
-!ifndef EXTOUT
-EXTOUT = .ext
-!endif
-!ifndef TESTUI
-TESTUI = console
-!endif
-!ifndef TESTS
-TESTS =
-!endif
-!ifndef RDOCTARGET
-RDOCTARGET = install-doc
-!endif
-
-OUTFLAG = -o
-COUTFLAG = -o
-!ifndef CFLAGS
-CFLAGS = -q -tWR -tWC $(DEBUGFLAGS) $(OPTFLAGS) $(PROCESSOR_FLAG) -w- -wsus -wcpt -wdup -wext -wrng -wrpt -wzdi
-!endif
-!ifndef DEFS
-DEFS =
-!endif
-!ifndef CPPFLAGS
-CPPFLAGS =
-!endif
-CPPFLAGS = $(DEFS) $(CPPFLAGS)
-!ifndef CXXFLAGS
-CXXFLAGS = $(CFLAGS)
-!endif
-!ifndef LDFLAGS
-LDFLAGS = -S:$(STACK)
-!endif
-!ifndef RFLAGS
-RFLAGS = $(iconinc)
-!endif
-!ifndef EXTLIBS
-EXTLIBS =
-!endif
-!ifndef MEMLIB
-MEMLIB =
-!endif
-LIBS = $(MEMLIB) cw32i.lib import32.lib ws2_32.lib $(EXTLIBS)
-MISSING = acosh.obj cbrt.obj crypt.obj erf.obj lgamma_r.obj strlcat.obj strlcpy.obj tgamma.obj win32.obj
-
-!ifndef STACK
-STACK = 0x2000000
-!endif
-
-XCFLAGS = -DRUBY_EXPORT -I. -I$(arch_hdrdir) -I$(hdrdir) -I$(srcdir) -I$(srcdir)/missing
-
-ARFLAGS = /a /p32
-LD = ilink32 -q -Gn
-LDSHARED = $(LD)
-XLDFLAGS = -Tpe c0x32.obj
-WLDFLAGS = -aa -Tpe c0w32.obj
-DLDFLAGS = -Tpd c0d32.obj
-LIBRUBY_LDSHARED = $(LDSHARED)
-LIBRUBY_DLDFLAGS = -Gi $(DLDFLAGS) $(EXTLDFLAGS)
-LDOBJECTS = $(MAINOBJ)
-
-SOLIBS =
-
-EXEEXT = .exe
-PROGRAM=$(RUBY_INSTALL_NAME)$(EXEEXT)
-WPROGRAM=$(RUBYW_INSTALL_NAME)$(EXEEXT)
-RUBYDEF = $(RUBY_SO_NAME).def
-MINIRUBY = .\miniruby$(EXEEXT) -I$(srcdir)/lib $(MINIRUBYOPT)
-RUNRUBY = .\$(PROGRAM) -i"$(EXTOUT)/$(arch)" "$(srcdir)/runruby.rb" --extout="$(EXTOUT)" --
-
-ORGLIBPATH = $(LIB)
-
-#### End of system configuration section. ####
-
-LIBRUBY_A = $(RUBY_SO_NAME)-static.lib
-LIBRUBY_SO = $(RUBY_SO_NAME).dll
-LIBRUBY = $(RUBY_SO_NAME).lib
-LIBRUBYARG = $(LIBRUBY)
-THREAD_MODEL = win32
-
-PREP = miniruby$(EXEEXT)
-
-OBJEXT = obj
-ASMEXT = asm
-
-INSTALLED_LIST= .installed.list
-
-MKMAIN_CMD = mkmain.bat
-
-SRC_FILE = $(<:\=/)
-
-WINMAINOBJ = winmain.$(OBJEXT)
-ARCHMINIOBJS = dmydln.$(OBJEXT)
-
-arch_hdrdir = $(EXTOUT)/include/$(arch)
-hdrdir = $(srcdir)/include
-VPATH = $(arch_hdrdir)/ruby;$(hdrdir)/ruby;$(srcdir);$(srcdir)/enc;$(srcdir)/missing;$(srcdir)/win32
-
-.path.c = .;$(srcdir);$(srcdir)/enc;$(srcdir)/win32;$(srcdir)/missing
-.path.ci = $(srcdir)
-.path.inc = .;$(srcdir)
-.path.def = .;$(srcdir)
-.path.h = .;$(arch_hdrdir)/ruby;$(hdrdir)/ruby;$(srcdir);$(srcdir)/win32;$(srcdir)/missing
-.path.y = $(srcdir)
-.path. = $(srcdir)
-
-.c.obj:
- $(CC) $(CFLAGS) $(XCFLAGS) -I. $(CPPFLAGS) $(COUTFLAG)$@ -c $(<:/=\)
-
-.c.asm:
- $(CC) $(CFLAGS) $(XCFLAGS) -I. $(CPPFLAGS) $(COUTFLAG)$@ -S $(<:\=/)
-
-.rc.res:
- $(RC) $(RFLAGS) -I. -I$(<D). $(iconinc) -I$(srcdir)/win32 $(RFLAGS) -fo$@ $(<:/=\)
-
-all: $(srcdir)/bcc32/Makefile.sub $(srcdir)/common.mk
-
-ruby: $(PROGRAM)
-rubyw: $(WPROGRAM)
-
-!include $(srcdir)/common.mk
-
-$(MKFILES): $(srcdir)/bcc32/Makefile.sub $(srcdir)/bcc32/configure.bat $(srcdir)/bcc32/setup.mak
- $(COMSPEC) /C $(srcdir:/=\)\bcc32\configure.bat $(configure_args)
- @echo $(MKFILES) should be updated, re-run $(MAKE).
- @$(MAKE) > nul -q -f &&|
-PHONY: nul
- @exit
-|
-
-PHONY: nul
-
-RUBY_CONFIG_H = $(arch_hdrdir)/ruby/config.h
-CONFIG_H = ./.config.h.time
-
-config: config.status
-
-config.status: $(CONFIG_H)
-
-guard = INCLUDE_RUBY_CONFIG_H
-
-$(CONFIG_H): $(MKFILES) $(srcdir)/bcc32/Makefile.sub
- @if not exist $(arch_hdrdir:/=\) md $(arch_hdrdir:/=\)
- @if not exist $(arch_hdrdir:/=\)\ruby md $(arch_hdrdir:/=\)\ruby
- @$(IFCHANGE) $(RUBY_CONFIG_H:/=\) &&|
-\#ifndef $(guard)
-\#define $(guard) 1
-\#define NO_BIG_INLINE 1
-\#define HAVE_SYS_TYPES_H 1
-\#define HAVE_SYS_STAT_H 1
-\#define HAVE_STDLIB_H 1
-\#define HAVE_STRING_H 1
-\#define HAVE_MEMORY_H 1
-\#define HAVE_LONG_LONG 1
-\#define HAVE_OFF_T 1
-\#define SIZEOF_INT 4
-\#define SIZEOF_SHORT 2
-\#define SIZEOF_LONG 4
-\#define SIZEOF_LONG_LONG 0
-\#define SIZEOF___INT64 8
-\#define SIZEOF_OFF_T 8
-\#define SIZEOF_VOIDP 4
-\#define SIZEOF_FLOAT 4
-\#define SIZEOF_DOUBLE 8
-\#define SIZEOF_TIME_T 4
-\#define SIZEOF_RLIM_T 0
-\#define SIZEOF_SIZE_T 4
-\#define SIZEOF_PTRDIFF_T 4
-\#define HAVE_PROTOTYPES 1
-\#define TOKEN_PASTE(x,y) x\#\#y
-\#define HAVE_STDARG_PROTOTYPES 1
-\#define NORETURN(x) x
-\#define RUBY_EXTERN extern __declspec(dllimport)
-\#define HAVE_DECL_SYS_NERR 1
-\#define HAVE_LIMITS_H 1
-\#define HAVE_FCNTL_H 1
-\#define HAVE_UTIME_H 1
-\#define HAVE_FLOAT_H 1
-\#define rb_uid_t uid_t
-\#define rb_gid_t gid_t
-\#define rb_pid_t int
-\#define HAVE_STRUCT_STAT_ST_RDEV 1
-\#define HAVE_ST_RDEV 1
-!if $(BORLANDC) < 0x0580
-\#define int8_t signed char
-\#define uint8_t unsigned char
-\#define int16_t short
-\#define uint16_t unsigned short
-\#define int32_t int
-\#define uint32_t unsigned int
-\#define int64_t __int64
-\#define uint64_t unsigned __int64
-\#define ssize_t int
-!endif
-\#define HAVE_INT8_T 1
-\#define HAVE_UINT8_T 1
-\#define SIZEOF_INT8_T 1
-\#define HAVE_INT16_T 1
-\#define HAVE_UINT16_T 1
-\#define SIZEOF_INT32_T 2
-\#define HAVE_INT32_T 1
-\#define HAVE_UINT32_T 1
-\#define SIZEOF_INT32_T 4
-\#define HAVE_INT64_T 1
-\#define HAVE_UINT64_T 1
-\#define SIZEOF_INT64_T 8
-\#define HAVE_INTPTR_T 1
-\#define HAVE_UINTPTR_T 1
-\#define HAVE_SSIZE_T 1
-\#define GETGROUPS_T int
-\#define RETSIGTYPE void
-\#define HAVE_ALLOCA 1
-\#define HAVE_DUP2 1
-\#define HAVE_MEMMOVE 1
-\#define HAVE_MKDIR 1
-\#define HAVE_STRCASECMP 1
-\#define HAVE_STRNCASECMP 1
-\#define HAVE_STRERROR 1
-\#define HAVE_STRFTIME 1
-\#define HAVE_STRCHR 1
-\#define HAVE_STRSTR 1
-\#define HAVE_STRTOD 1
-\#define HAVE_STRTOL 1
-\#define HAVE_STRTOUL 1
-\#define HAVE_SNPRINTF 1
-\#define HAVE_VSNPRINTF 1
-\#define HAVE_ISNAN 1
-\#define HAVE_FINITE 1
-\#define HAVE_HYPOT 1
-\#define HAVE_FMOD 1
-\#define HAVE_WAITPID 1
-\#define HAVE_FSYNC 1
-\#define HAVE_GETCWD 1
-\#define HAVE_TRUNCATE 1
-\#define HAVE_FTRUNCATE 1
-\#define HAVE_FSEEKO 1
-\#define HAVE_FTELLO 1
-\#define HAVE_TIMES 1
-\#define HAVE_FCNTL 1
-\#define HAVE_LINK 1
-\#define HAVE_TELLDIR 1
-\#define HAVE_SEEKDIR 1
-\#define HAVE_COSH 1
-\#define HAVE_SINH 1
-\#define HAVE_TANH 1
-\#define RSHIFT(x,y) ((x)>>(int)y)
-\#define FILE_COUNT level
-\#define FILE_READPTR curp
-\#define RUBY_SETJMP(env) setjmp(env)
-\#define RUBY_LONGJMP(env,val) longjmp(env,val)
-\#define RUBY_JMP_BUF jmp_buf
-\#define inline __inline
-\#define NEED_IO_SEEK_BETWEEN_RW 1
-\#define STACK_GROW_DIRECTION -1
-\#define DEFAULT_KCODE KCODE_NONE
-\#define LOAD_RELATIVE 1
-\#define DLEXT ".so"
-\#define RUBY_LIB_PREFIX "/lib/ruby"
-\#define RUBY_PLATFORM "$(ARCH)-$(OS)"
-\#endif /* $(guard) */
-|
- @exit > $(@:/=\)
-
-config.status: $(MKFILES) $(srcdir)/bcc32/Makefile.sub $(srcdir)/common.mk
- @echo Creating $@
- @type > $@ &&|
-# Generated automatically by Makefile.sub.
-s,@SHELL@,$$(COMSPEC),;t t
-s,@BUILD_FILE_SEPARATOR@,\,;t t
-s,@PATH_SEPARATOR@,;,;t t
-s,@CFLAGS@,$(CFLAGS),;t t
-s,@DEFS@,$(DEFS),;t t
-s,@CPPFLAGS@,$(CPPFLAGS),;t t
-s,@CXXFLAGS@,$(CXXFLAGS),;t t
-s,@FFLAGS@,$(FFLAGS),;t t
-s,@LDFLAGS@,,;t t
-s,@LIBS@,$(LIBS),;t t
-s,@exec_prefix@,$${prefix},;t t
-s,@prefix@,$(prefix),;t t
-s,@program_transform_name@,s,,,,;t t
-s,@bindir@,$${exec_prefix}/bin,;t t
-s,@sbindir@,$${exec_prefix}/sbin,;t t
-s,@libexecdir@,$${exec_prefix}/libexec,;t t
-s,@datadir@,$${prefix}/share,;t t
-s,@sysconfdir@,$${prefix}/etc,;t t
-s,@sharedstatedir@,/etc,;t t
-s,@localstatedir@,/var,;t t
-s,@libdir@,$${exec_prefix}/lib,;t t
-s,@includedir@,$${prefix}/include,;t t
-s,@oldincludedir@,/usr/include,;t t
-s,@infodir@,$${prefix}/info,;t t
-s,@mandir@,$${prefix}/man,;t t
-s,@ridir@,$${prefix}/share/ri,;t t
-s,@build@,$(CPU)-pc-$(OS),;t t
-s,@build_alias@,$(CPU)-$(OS),;t t
-s,@build_cpu@,$(CPU),;t t
-s,@build_vendor@,pc,;t t
-s,@build_os@,$(OS),;t t
-s,@host@,$(CPU)-pc-$(OS),;t t
-s,@host_alias@,$(CPU)-$(OS),;t t
-s,@host_cpu@,$(CPU),;t t
-s,@host_vendor@,pc,;t t
-s,@host_os@,$(OS),;t t
-s,@target@,$(ARCH)-pc-$(OS),;t t
-s,@target_alias@,$(ARCH)-$(OS),;t t
-s,@target_cpu@,$(ARCH),;t t
-s,@target_vendor@,pc,;t t
-s,@target_os@,$(OS),;t t
-s,@CC@,$(CC),;t t
-s,@CPP@,cpp32,;t t
-s,@CXX@,$$(CC),;t t
-s,@LD@,$(LD),;t t
-s,@YACC@,$(YACC),;t t
-s,@RANLIB@,,;t t
-s,@AR@,$(AR),;t t
-s,@ARFLAGS@,$(ARFLAGS) ,;t t
-s,@LN_S@,$(LN_S),;t t
-s,@SET_MAKE@,MFLAGS = -$$(MAKEFLAGS),;t t
-s,@RM@,$$(top_srcdir:/=\)\win32\rm.bat,;t t
-s,@CP@,copy > nul,;t t
-s,@LIBOBJS@, $(MISSING),;t t
-s,@ALLOCA@,$(ALLOCA),;t t
-s,@DEFAULT_KCODE@,$(DEFAULT_KCODE),;t t
-s,@EXEEXT@,.exe,;t t
-s,@OBJEXT@,obj,;t t
-s,@XCFLAGS@,$(XCFLAGS),;t t
-s,@XLDFLAGS@,$(XLDFLAGS),;t t
-s,@DLDFLAGS@,$(DLDFLAGS),;t t
-s,@ARCH_FLAG@,$(ARCH_FLAG),;t t
-s,@STATIC@,$(STATIC),;t t
-s,@CCDLFLAGS@,,;t t
-s,@LDSHARED@,$(LDSHARED),;t t
-s,@DLEXT@,so,;t t
-s,@LIBEXT@,lib,;t t
-s,@STRIP@,$(STRIP),;t t
-s,@EXTSTATIC@,$(EXTSTATIC),;t t
-s,@setup@,Setup,;t t
-s,@MINIRUBY@,$(MINIRUBY),;t t
-s,@PREP@,miniruby$(EXEEXT),;t t
-s,@RUNRUBY@,$(RUNRUBY),;t t
-s,@EXTOUT@,$(EXTOUT),;t t
-s,@ARCHFILE@,,;t t
-s,@RDOCTARGET@,,;t t
-s,@LIBRUBY_LDSHARED@,$$(LDSHARED),;t t
-s,@LIBRUBY_DLDFLAGS@,-Gi $$(DLDFLAGS),;t t
-s,@RUBY_INSTALL_NAME@,$(RUBY_INSTALL_NAME),;t t
-s,@rubyw_install_name@,$(RUBYW_INSTALL_NAME),;t t
-s,@RUBYW_INSTALL_NAME@,$(RUBYW_INSTALL_NAME),;t t
-s,@RUBY_SO_NAME@,$(RUBY_SO_NAME),;t t
-s,@LIBRUBY_A@,$$(RUBY_SO_NAME)-static.lib,;t t
-s,@LIBRUBY_SO@,$$(RUBY_SO_NAME).dll,;t t
-s,@LIBRUBY_ALIASES@,$(LIBRUBY_ALIASES),;t t
-s,@LIBRUBY@,$$(RUBY_SO_NAME).lib,;t t
-s,@LIBRUBYARG@,$$(LIBRUBYARG_SHARED),;t t
-s,@LIBRUBYARG_STATIC@,$$(LIBRUBY_A),;t t
-s,@LIBRUBYARG_SHARED@,$$(LIBRUBY),;t t
-s,@SOLIBS@,$(SOLIBS),;t t
-s,@DLDLIBS@,$(DLDLIBS),;t t
-s,@ENABLE_SHARED@,yes,;t t
-s,@OUTFLAG@,$(OUTFLAG),;t t
-s,@COUTFLAG@,$(COUTFLAG),;t t
-s,@CPPOUTFILE@,,;t t
-s,@LIBPATHFLAG@, -L"%s",;t t
-s,@RPATHFLAG@,,;t t
-s,@LIBARG@,%s.lib,;t t
-s,@LINK_SO@,$$(LDSHARED) $$(DLDFLAGS) $$(LIBPATH) $$(OBJS:/=\), $$(@:/=\), nul, $$(LIBS) $$(LOCAL_LIBS), $$(DEFFILE:/=\), $$(RESFILE:/=\),;t t
-s,@COMPILE_C@,$$(CC) $$(INCFLAGS) $$(CFLAGS) $$(CPPFLAGS) $(COUTFLAG)$$(@) -c $$(<:/=\),;t t
-s,@COMPILE_CXX@,$$(CXX) $$(INCFLAGS) $$(CXXFLAGS) $$(CPPFLAGS) -P $(COUTFLAG)$$(@) -c $$(<:/=\),;t t
-s,@COMPILE_RULES@,{$$(srcdir)}.%s{}.%s: {$$(topdir)}.%s{}.%s: {$$(hdrdir)}.%s{}.%s: .%s.%s:,;t t
-s,@RULE_SUBST@,{.;$$(VPATH)}%s,;t t
-s,@COMMON_LIBS@,m advapi32 avicap32 avifil32 cap comctl32 comdlg32 dlcapi gdi32 glu32 imagehlp imm32 inetmib1 kernel32 loadperf lsapi32 lz32 mapi32 mgmtapi mpr msacm32 msvfw32 nddeapi netapi32 ole32 oleaut32 oledlg olepro32 opengl32 pdh pkpd32 rasapi32 rasdlg rassapi rpcrt4 setupapi shell32 shfolder snmpapi sporder tapi32 url user32 vdmdbg version win32spl winmm wintrust wsock32,;t t
-s,@COMMON_MACROS@,WIN32_LEAN_AND_MEAN WIN32,;t t
-s,@COMMON_HEADERS@,winsock2.h windows.h,;t t
-s,@cleanlibs@,$$*.tds,;t t
-s,@cleanobjs@,$$*-$$(arch).def $$*.il? $$*.lib,;t t
-s,@TRY_LINK@,$$(CC) -oconftest $$(INCFLAGS) -I$$(hdrdir) $$(CPPFLAGS) $$(CFLAGS) $$(LIBPATH) $$(LDFLAGS) $$(src) $$(LOCAL_LIBS) $$(LIBS),;t t
-s,@EXPORT_PREFIX@,_,;t t
-s,@arch@,$(ARCH)-$(OS),;t t
-s,@sitearch@,$(ARCH)-$(OS),;t t
-s,@sitedir@,$${prefix}/lib/ruby/site_ruby,;t t
-s,@vendordir@,$${prefix}/lib/ruby/vendor_ruby,;t t
-s,@rubyhdrdir@,$$(includedir)/ruby-$$(MAJOR).$$(MINOR).$$(TEENY),;t t
-s,@sitehdrdir@,$$(rubyhdrdir)/site_ruby,;t t
-s,@vendorhdrdir@,$$(rubyhdrdir)/vendor_ruby,;t t
-s,@configure_args@,--enable-shared $(configure_args),;t t
-s,@configure_input@,$$configure_input,;t t
-s,@srcdir@,$(srcdir),;t t
-s,@top_srcdir@,$(srcdir),;t t
-|
-
-miniruby$(EXEEXT):
- @echo $(LIBS)
- $(LD) $(LDFLAGS) $(XLDFLAGS) $(MAINOBJ) $(MINIOBJS) $(COMMONOBJS:/=\) $(DMYEXT),$@,nul,$(LIBS)
-
-$(PROGRAM): $(MAINOBJ) $(LIBRUBY_SO) $(RUBY_INSTALL_NAME).res
- $(LD) $(LDFLAGS) $(XLDFLAGS) $(MAINOBJ),$@,nul,$(LIBRUBYARG) $(LIBS),,$(RUBY_INSTALL_NAME).res
-
-$(WPROGRAM): $(MAINOBJ) $(WINMAINOBJ) $(LIBRUBY_SO) $(RUBYW_INSTALL_NAME).res
- $(LD) $(LDFLAGS) $(WLDFLAGS) $(MAINOBJ) $(WINMAINOBJ),$@,nul,$(LIBRUBYARG) $(LIBS),,$(RUBYW_INSTALL_NAME).res
-
-$(LIBRUBY_A): $(OBJS) $(DMYEXT)
- @-if exist $@ del $@
- $(AR) $(ARFLAGS) "$@" $(OBJS) $(DMYEXT)
-
-# $(LIBRUBY): $(LIBRUBY_SO)
-# implib $@ $(LIBRUBY_SO)
-
-$(LIBRUBY_SO): $(LIBRUBY_A) $(DLDOBJS) $(RUBYDEF) $(RUBY_SO_NAME).res
- @echo $(DLDOBJS)
- @$(PRE_LIBRUBY_UPDATE)
- $(LIBRUBY_LDSHARED) $(LIBRUBY_DLDFLAGS) $(DLDOBJS:/=\),$(LIBRUBY_SO),nul,$(LIBRUBY_A) $(LIBS),$(RUBYDEF),$(RUBY_SO_NAME).res
-
-$(LIBRUBY): $(LIBRUBY_SO)
-
-$(RUBYDEF): $(LIBRUBY_A) $(PREP)
- $(MINIRUBY) $(srcdir)/bcc32/mkexports.rb -output=$@ -base=$(RUBY_SO_NAME) $(LIBRUBY_A)
-
-$(RUBY_INSTALL_NAME).rc $(RUBYW_INSTALL_NAME).rc $(RUBY_SO_NAME).rc: rbconfig.rb $(srcdir)/revision.h $(srcdir)/win32/resource.rb
- @$(MINIRUBY) $(srcdir)/win32/resource.rb \
- -ruby_name=$(RUBY_INSTALL_NAME) \
- -rubyw_name=$(RUBYW_INSTALL_NAME) \
- -so_name=$(RUBY_SO_NAME) \
- . $(icondirs) $(srcdir)/win32
-
-lex.c: {$(srcdir)}lex.c.blt
- copy "$(?:/=\)" $@
-
-post-install-bin::
- @$(NULLCMD)
-post-install-lib::
- @$(NULLCMD)
-post-install-ext-comm::
- @$(NULLCMD)
-post-install-ext-arch::
- @$(NULLCMD)
-post-install-man::
- @$(NULLCMD)
-post-install-doc::
- @$(NULLCMD)
-
-clean-local::
- @$(RM) $(WINMAINOBJ) ext\extinit.c ext\extinit.$(OBJEXT) *.tds *.il? $(RUBY_SO_NAME).lib
- @$(RM) $(RUBY_INSTALL_NAME).res $(RUBYW_INSTALL_NAME).res $(RUBY_SO_NAME).res
- @$(RM) *.map *.pdb *.ilk *.exp $(RUBYDEF) ext\ripper\y.output
-
-distclean-local::
- @$(RM) ext\config.cache $(RBCONFIG:/=\)
- @$(RM) $(RUBY_INSTALL_NAME).rc $(RUBYW_INSTALL_NAME).rc $(RUBY_SO_NAME).rc
-
-clean-ext distclean-ext realclean-ext::
- @for /R ext %I in (.) do @if exist %I\Makefile ( \
- echo $(@:-ext=)ing %~nI & \
- cd %I & \
- $(MAKE) $(MFLAGS) $(@:-ext=) & \
- cd %CD% \
- )
-
-ext/extinit.obj: ext/extinit.c $(SETUP)
- $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@ -c ext/extinit.c
-
-main.$(OBJEXT): win32.h
-ascii.$(OBJEXT): win32.h
-array.$(OBJEXT): win32.h
-bignum.$(OBJEXT): win32.h
-class.$(OBJEXT): win32.h
-compar.$(OBJEXT): win32.h
-dir.$(OBJEXT): dir.h win32.h
-dln.$(OBJEXT): win32.h
-enum.$(OBJEXT): win32.h
-error.$(OBJEXT): win32.h
-euc_jp.$(OBJEXT): win32.h
-eval.$(OBJEXT): win32.h
-file.$(OBJEXT): win32.h
-gc.$(OBJEXT): win32.h
-hash.$(OBJEXT): win32.h
-inits.$(OBJEXT): win32.h
-io.$(OBJEXT): win32.h
-marshal.$(OBJEXT): win32.h
-math.$(OBJEXT): win32.h
-numeric.$(OBJEXT): win32.h
-object.$(OBJEXT): win32.h
-pack.$(OBJEXT): win32.h
-parse.$(OBJEXT): win32.h
-process.$(OBJEXT): win32.h
-prec.$(OBJEXT): win32.h
-random.$(OBJEXT): win32.h
-range.$(OBJEXT): win32.h
-re.$(OBJEXT): win32.h
-regcomp.$(OBJEXT): win32.h
-regenc.$(OBJEXT): win32.h
-regerror.$(OBJEXT): win32.h
-regexec.$(OBJEXT): win32.h
-reggnu.$(OBJEXT): win32.h
-regparse.$(OBJEXT): win32.h
-ruby.$(OBJEXT): win32.h
-signal.$(OBJEXT): win32.h
-sjis.$(OBJEXT): win32.h
-sprintf.$(OBJEXT): win32.h
-st.$(OBJEXT): win32.h
-string.$(OBJEXT): win32.h
-struct.$(OBJEXT): win32.h
-time.$(OBJEXT): win32.h
-utf_8.$(OBJEXT): win32.h
-util.$(OBJEXT): win32.h
-variable.$(OBJEXT): win32.h
-version.$(OBJEXT): win32.h
diff --git a/bcc32/README.bcc32 b/bcc32/README.bcc32
deleted file mode 100644
index cd33eec0a1..0000000000
--- a/bcc32/README.bcc32
+++ /dev/null
@@ -1,130 +0,0 @@
-=begin
-
-= How to build ruby using Borland C++
-
-== Requirement
-
-(1) Borland C++ 5.0 or later.
-
-(2) Please set environment variable (({PATH}))
- to run required commands properly from the command line.
-
- Note: building ruby requires following commands.
- * make
- * bcc32
- * tlib
- * ilink32
-
-(3) If you want to build from CVS source, following commands are required.
- * bison ((<URL:http://gnuwin32.sourceforge.net/packages/bison.htm>))
- * sed ((<URL:http://gnuwin32.sourceforge.net/packages/sed.htm>))
-
-(4) We strongly recommend to build ruby on C++Builder, to link following files.
- * usebormm.lib
- * memmgr.lib
-
- RTL's internal memory manager cannot handle large memory block properly,
- so we should use borlndmm.dll instead.
- 10000.times { "" << "." * 529671; GC.start } # crash
-
-== How to compile and install
-
-(1) Execute bcc32\configure.bat on your build directory.
- ex. c:\src\ruby> bcc32\configure.bat
- You can specify the target platform as an argument.
- For example, run `((%configure i686-bccwin32%))'
- You can also specify the install directory.
- For example, run `((%configure --prefix=<install_directory>%))'
- Default of the install directory is /usr .
- The default ((|<PLATFORM>|)) is `(({i386-bccwin32}))'.
-
-(2) Change ((|RUBY_INSTALL_NAME|)) and ((|RUBY_SO_NAME|)) in (({Makefile}))
- if you want to change the name of the executable files.
- And add ((|RUBYW_INSTALL_NAME|)) to change the name of the
- executable without console window if also you want.
-
-(3) Run `((%make%))'
-
-(4) Run `((%make test%))'
-
-(5) Run `((%make install%))'
-
-(6) Requires dynamic RTL (cc3250.dll on C++Builder5) and borlndmm.dll (If built with
- usebormm.lib) to use installed binary. These files are ordinary in bcc32's bin
- directory.
-
-== Icons
-
-Any icon files(*.ico) in the build directory, directories specified with
-((|icondirs|)) make variable and (({win32})) directory under the ruby
-source directory will be included in DLL or executable files, according
-to their base names.
- $(RUBY_INSTALL_NAME).ico or ruby.ico --> $(RUBY_INSTALL_NAME).exe
- $(RUBYW_INSTALL_NAME).ico or rubyw.ico --> $(RUBYW_INSTALL_NAME).exe
- the others --> $(RUBY_SO_NAME).dll
-
-Although no icons are distributed with the ruby source or in the official
-site, you can use anything you like. For example, followings are written
-in Japanese, but you can download at least.
-
-* ((<URL:http://member.nifty.ne.jp/ueivu/rubyico.html>)) or
- ((<zipped icons|URL:http://member.nifty.ne.jp/ueivu/Ruby_ico.zip>))
-* ((<URL:http://homepage1.nifty.com/a_nakata/ruby/>)) or
- ((<icon itself|URL:http://homepage1.nifty.com/a_nakata/ruby/RubyIcon.ico>))
-
-== Build examples
-
-* Build on the ruby source directory.
-
- ex.)
- ruby source directory: C:\ruby
- build directory: C:\ruby
- install directory: C:\usr\local
-
- C:
- cd \ruby
- bcc32\configure --prefix=/usr/local
- make
- make test
- make install
-
-* Build on the relative directory from the ruby source directory and CPU type
- i386.
-
- ex.)
- ruby source directory: C:\ruby
- build directory: C:\ruby\bccwin32
- install directory: C:\usr\local
- CPU i386
-
- C:
- cd \ruby
- mkdir bccwin32
- cd bccwin32
- ..\bcc32\configure --prefix=/usr/local
- make
- make test
- make install
-
-* Build on the different drive.
-
- ex.)
- ruby source directory: C:\src\ruby
- build directory: D:\build\ruby
- install directory: C:\usr\local
-
- D:
- cd D:\build\ruby
- C:\src\ruby\bcc32\configure --prefix=C:/usr/local
- make
- make test
- make install
-
-== Bugs
-
-You can ((*NOT*)) use a path name contains any white space characters as
-the ruby source directory, this restriction comes from the behavior of
-(({!INCLUDE})) directives of (({MAKE})).
-((- you may call it a bug. -))
-
-=end
diff --git a/bcc32/configure.bat b/bcc32/configure.bat
deleted file mode 100755
index 8cdfc64b03..0000000000
--- a/bcc32/configure.bat
+++ /dev/null
@@ -1,163 +0,0 @@
-@echo off
-::: Don't set environment variable in batch file other than autoexec.bat
-::: to avoid "Out of environment space" problem on Windows 95/98.
-::: set TMPMAKE=~tmp~.mak
-
-echo> ~tmp~.mak ####
-echo>> ~tmp~.mak conf = %0
-echo>> ~tmp~.mak $(conf:\=/): nul
-echo>> ~tmp~.mak @del ~setup~.mak
-echo>> ~tmp~.mak @-$(MAKE) -l$(MAKEFLAGS) -f $(@D)setup.mak \
-if exist pathlist.tmp del pathlist.tmp
-if exist confargs.mk del confargs.mk
-:loop
-if "%1" == "" goto :end
-if "%1" == "--prefix" goto :prefix
-if "%1" == "prefix" goto :prefix
-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" == "--program-suffix" goto :suffix
-if "%1" == "RUBY_SUFFIX" goto :suffix
-if "%1" == "--program-name" goto :installname
-if "%1" == "--install-name" goto :installname
-if "%1" == "RUBY_INSTALL_NAME" goto :installname
-if "%1" == "--so-name" goto :soname
-if "%1" == "RUBY_SO_NAME" goto :soname
-if "%1" == "--enable-install-doc" goto :enable-rdoc
-if "%1" == "--disable-install-doc" goto :disable-rdoc
-if "%1" == "--extout" goto :extout
-if "%1" == "EXTOUT" goto :extout
-if "%1" == "--with-baseruby" goto :baseruby
-if "%1" == "BASERUBY" goto :baseruby
-if "%1" == "--path" goto :path
-if "%1" == "-h" goto :help
-if "%1" == "--help" goto :help
- echo>>confargs.tmp %1 \
- shift
-goto :loop
-:srcdir
- echo>> ~tmp~.mak -Dsrcdir=%2 \
- echo>>confargs.tmp --srcdir=%2 \
- shift
- shift
-goto :loop
-:prefix
- echo>> ~tmp~.mak -Dprefix=%2 \
- echo>>confargs.tmp %1=%2 \
- shift
- shift
-goto :loop
-:suffix
- echo>>confargs.mk !ifndef RUBY_SUFFIX
- echo>>confargs.mk RUBY_SUFFIX = %2
- echo>>confargs.mk !endif
- echo>>confargs.tmp %1=%2 \
- shift
- shift
-goto :loop
-:installname
- echo>>confargs.mk !ifndef RUBY_INSTALL_NAME
- echo>>confargs.mk RUBY_INSTALL_NAME = %2
- echo>>confargs.mk !endif
- echo>>confargs.tmp %1=%2 \
- shift
- shift
-goto :loop
-:soname
- echo>>confargs.mk !ifndef RUBY_SO_NAME
- echo>>confargs.mk RUBY_SO_NAME = %2
- echo>>confargs.mk !endif
- echo>>confargs.tmp %1=%2 \
- shift
- shift
-goto :loop
-:target
- echo>> ~tmp~.mak %2 \
- echo>>confargs.tmp --target=%2 \
- shift
- shift
-goto :loop
-:extstatic
- echo>>confargs.mk !ifndef EXTSTATIC
- echo>>confargs.mk EXTSTATIC = static
- echo>>confargs.mk !endif
- echo>>confargs.tmp %1 \
- shift
-goto :loop
-:enable-rdoc
- echo>>confargs.mk !ifndef RDOCTARGET
- echo>>confargs.mk RDOCTARGET = install-doc
- echo>>confargs.mk !endif
- echo>>confargs.tmp %1 \
- shift
-goto :loop
-:disable-rdoc
- echo>>confargs.mk !ifndef RDOCTARGET
- echo>>confargs.mk RDOCTARGET = install-nodoc
- echo>>confargs.mk !endif
- echo>>confargs.tmp %1 \
- shift
-goto :loop
-:extout
- echo>>confargs.mk !ifndef EXTOUT
- echo>>confargs.mk EXTOUT = %2
- echo>>confargs.mk !endif
- echo>>confargs.tmp %1=%2 \
- shift
- shift
-goto :loop
-:baseruby
- echo>>confargs.mk !ifndef BASERUBY
- echo>>confargs.mk BASERUBY = %2
- echo>>confargs.mk !endif
- echo>>confargs.tmp %1=%2 \
- shift
- shift
-goto :loop
-:path
- echo>>pathlist.tmp %2;\
- echo>>confargs.tmp %1=%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 Installation directories:
- echo --prefix=PREFIX install files in PREFIX (ignored currently)
- echo System types:
- echo --target=TARGET configure for TARGET [i386-bccwin32]
- echo Optional Package:
- echo --with-baseruby=RUBY use RUBY as baseruby [ruby]
- echo --with-static-linked-ext link external modules statically
- echo --enable-install-doc install rdoc indexes during install
- del *.tmp
- del ~tmp~.mak
-goto :exit
-:end
-echo>> ~tmp~.mak -Dbcc32dir=$(@D)
-if not exist confargs.tmp goto :noconfargs
- echo>>confargs.mk configure_args = \
- type>>confargs.mk confargs.tmp
- echo.>>confargs.mk
- echo>>confargs.mk ####
-:noconfargs
-if not exist pathlist.tmp goto :nopathlist
- echo>>confargs.mk pathlist = \
- type>>confargs.mk pathlist.tmp
- echo.>>confargs.mk
- echo>>confargs.mk ####
- echo>>confargs.mk PATH = $(pathlist:;=/bin;)$(PATH)
- echo>>confargs.mk INCLUDE = $(pathlist:;=/include;)
- echo>>confargs.mk LIB = $(pathlist:;=/lib;)
-:nopathlist
-if exist confargs.mk copy confargs.mk ~setup~.mak > nul
-type>>~setup~.mak ~tmp~.mak
-del *.tmp > nul
-del ~tmp~.mak > nul
-make -s -f ~setup~.mak
-:exit
diff --git a/bcc32/mkexports.rb b/bcc32/mkexports.rb
deleted file mode 100755
index 888ab2e2a6..0000000000
--- a/bcc32/mkexports.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-#!./miniruby -s
-
-$:.unshift(File.expand_path("../..", __FILE__))
-require 'win32/mkexports'
-
-class Exports::Bcc < Exports
- def forwarding(internal, export)
- internal[/\A_?/]+export
- end
-
- def each_line(objs, &block)
- objs.each do |obj|
- opt = /\.(?:so|dll)\z/i =~ obj ? "-ee" : "-oiPUBDEF -oiPUBD32"
- IO.foreach("|tdump -q #{opt} #{obj.tr('/', '\\')} < nul", &block)
- end
- end
-
- def each_export(objs)
- objdump(objs) do |l|
- next unless /(?:PUBDEF|PUBD32|EXPORT)/ =~ l
- yield $1 if /'(.*?)'/ =~ l
- end
- yield "_strcasecmp", "_stricmp"
- yield "_strncasecmp", "_strnicmp"
- end
-end
diff --git a/bcc32/setup.mak b/bcc32/setup.mak
deleted file mode 100644
index df2fd3c128..0000000000
--- a/bcc32/setup.mak
+++ /dev/null
@@ -1,179 +0,0 @@
-# -*- makefile -*-
-
-!if "$(srcdir)" != ""
-bcc32dir = $(srcdir)/bcc32
-!elseif "$(bcc32dir)" == "bcc32/"
-srcdir = .
-!elseif "$(bcc32dir:/bcc32/=)/bcc32/" == "$(bcc32dir)"
-srcdir = $(bcc32dir:/bcc32/=)
-!else
-srcdir = $(bcc32dir)/..
-!endif
-!ifndef prefix
-prefix = /usr
-!endif
-OS = bccwin32
-RT = $(OS)
-BANG = !
-APPEND = echo.>>$(MAKEFILE)
-!ifdef MAKEFILE
-MAKE = $(MAKE) -f $(MAKEFILE)
-!else
-MAKEFILE = Makefile
-!endif
-
-all: Makefile
-Makefile: -prologue- -generic- -epilogue-
-i386-$(OS): -prologue- -i386- -epilogue-
-i486-$(OS): -prologue- -i486- -epilogue-
-i586-$(OS): -prologue- -i586- -epilogue-
-i686-$(OS): -prologue- -i686- -epilogue-
-alpha-$(OS): -prologue- -alpha- -epilogue-
-
--prologue-: -basic-vars- -version- -system-vars-
-
--basic-vars-: nul
- @echo Creating $(MAKEFILE)
- @type > $(MAKEFILE) &&|
-\#\#\# Makefile for ruby $(OS) \#\#\#
-$(BANG)ifndef srcdir
-srcdir = $(srcdir:\=/)
-$(BANG)endif
-$(BANG)ifndef prefix
-prefix = $(prefix:\=/)
-$(BANG)endif
-$(BANG)if !defined(BASERUBY)
-!if defined(BASERUBY)
-BASERUBY = $(BASERUBY)
-!endif
-|
-!if !defined(BASERUBY)
- @for %I in (ruby.exe) do @echo BASERUBY = "%~$$PATH:I" >> $(MAKEFILE)
-!endif
- @type >> $(MAKEFILE) &&|
-$(BANG)endif
-|
-!if exist(confargs.mk)
- @type confargs.mk >> $(MAKEFILE)
- @del confargs.mk
-!endif
-
--system-vars-: -runtime- -bormm-
-
--bormm-: nul
- @-ilink32 -q -Gn -x usebormm.lib > nul
- @-if exist usebormm.tds $(APPEND) MEMLIB = usebormm.lib
- @if exist usebormm.* del usebormm.*
-
--osname-: nul
- @echo OS = >>$(MAKEFILE)
-
--runtime-: nul
- type > conftest.c &&|
-\#include <stdio.h>
-int main(){printf("");return 0;}
-|
- bcc32 conftest.c cw32i.lib > nul
- tdump conftest.exe < nul > conftest.i
- grep "^Imports from CC" conftest.i > conftest.c
- cpp32 -P- -DFile=\# -DImports=RTNAME -Dfrom== conftest.c > nul
- $(MAKE) > nul -DBANG=$(BANG) -f &&|
--runtime-: nul
-$(BANG)include conftest.i
-RT = $$(RTNAME:.DLL=)
-OS = $$(RT:CC32=)
--runtime-:
- del conftest.*
-$(BANG)if "$$(OS)" == "50"
- echo OS = bccwin32 >> $(MAKEFILE)
-$(BANG)else
- echo OS = bccwin32_$$(OS) >> $(MAKEFILE)
-$(BANG)endif
-|
- @echo RT = $$(OS) >> $(MAKEFILE)
-
--version-: nul
- @cpp32 -I$(srcdir) -P- -o$(MAKEFILE) > nul &&|
-\#define RUBY_REVISION 0
-\#include "version.h"
-MAJOR = RUBY_API_VERSION_MAJOR
-MINOR = RUBY_API_VERSION_MINOR
-TEENY = RUBY_API_VERSION_TEENY
-
-BORLANDC = __BORLANDC__
-|
- @$(MAKE) > nul -DBANG=$(BANG) -f &&,
--version-: nul
-$(BANG)include $(MAKEFILE)
-$(BANG)include $(MAKEFILE).i
--version-:
- @del $(MAKEFILE).i
- @type >> $(MAKEFILE) &&|
-MAJOR = $$(MAJOR)
-MINOR = $$(MINOR)
-TEENY = $$(TEENY)
-BORLANDC = $$(BORLANDC)
-|
-,
-
--generic-: nul
-!if defined(PROCESSOR_ARCHITECTURE) || defined(PROCESSOR_LEVEL)
- @type >> $(MAKEFILE) &&|
-!if defined(PROCESSOR_ARCHITECTURE)
-$(BANG)ifndef PROCESSOR_ARCHITECTURE
-PROCESSOR_ARCHITECTURE = $(PROCESSOR_ARCHITECTURE)
-$(BANG)endif
-!endif
-!if defined(PROCESSOR_LEVEL)
-$(BANG)ifndef PROCESSOR_LEVEL
-PROCESSOR_LEVEL = $(PROCESSOR_LEVEL)
-$(BANG)endif
-!endif
-|
-!endif
-
--alpha-: nul
- @$(APPEND) !ifndef PROCESSOR_ARCHITECTURE
- @$(APPEND) PROCESSOR_ARCHITECTURE = alpha
- @$(APPEND) !endif
--ix86-: nul
- @$(APPEND) !ifndef PROCESSOR_ARCHITECTURE
- @$(APPEND) PROCESSOR_ARCHITECTURE = x86
- @$(APPEND) !endif
-
--i386-: -ix86-
- @$(APPEND) !ifndef PROCESSOR_LEVEL
- @$(APPEND) PROCESSOR_LEVEL = 3
- @$(APPEND) !endif
--i486-: -ix86-
- @$(APPEND) !ifndef PROCESSOR_LEVEL
- @$(APPEND) PROCESSOR_LEVEL = 4
- @$(APPEND) !endif
--i586-: -ix86-
- @$(APPEND) !ifndef PROCESSOR_LEVEL
- @$(APPEND) PROCESSOR_LEVEL = 5
- @$(APPEND) !endif
--i686-: -ix86-
- @$(APPEND) !ifndef PROCESSOR_LEVEL
- @$(APPEND) PROCESSOR_LEVEL = 6
- @$(APPEND) !endif
-
--epilogue-: -encs-
-
--encs-: nul
- @$(MAKE) -f $(srcdir)/win32/enc-setup.mak srcdir="$(srcdir)" MAKEFILE=$(MAKEFILE)
-
--epilogue-: nul
- @type >> $(MAKEFILE) &&|
-
-\# RUBY_INSTALL_NAME = ruby
-\# RUBY_SO_NAME = $$(RT)-$$(RUBY_INSTALL_NAME)$$(MAJOR)$$(MINOR)
-\# CFLAGS = -q $$(DEBUGFLAGS) $$(OPTFLAGS) $$(PROCESSOR_FLAG) -w- -wsus -wcpt -wdup -wext -wrng -wrpt -wzdi
-\# CPPFLAGS = -I. -I$$(srcdir) -I$$(srcdir)/missing -DLIBRUBY_SO=\"$$(LIBRUBY_SO)\"
-\# STACK = 0x2000000
-\# LDFLAGS = -S:$$(STACK)
-\# RFLAGS = $$(iconinc)
-\# EXTLIBS = cw32.lib import32.lib user32.lib kernel32.lib
-$(BANG)include $$(srcdir)/bcc32/Makefile.sub
-|
- @echo type "`$(MAKE)'" to make ruby for $(OS).
diff --git a/benchmark/bm_app_aobench.rb b/benchmark/bm_app_aobench.rb
new file mode 100644
index 0000000000..ffab116fcd
--- /dev/null
+++ b/benchmark/bm_app_aobench.rb
@@ -0,0 +1,291 @@
+# AO render benchmark
+# Original program (C) Syoyo Fujita in Javascript (and other languages)
+# https://code.google.com/p/aobench/
+# Ruby(yarv2llvm) version by Hideki Miura
+#
+
+IMAGE_WIDTH = 256
+IMAGE_HEIGHT = 256
+NSUBSAMPLES = 2
+NAO_SAMPLES = 8
+
+class Vec
+ def initialize(x, y, z)
+ @x = x
+ @y = y
+ @z = z
+ end
+
+ attr_accessor :x, :y, :z
+
+ def vadd(b)
+ Vec.new(@x + b.x, @y + b.y, @z + b.z)
+ end
+
+ def vsub(b)
+ Vec.new(@x - b.x, @y - b.y, @z - b.z)
+ end
+
+ def vcross(b)
+ Vec.new(@y * b.z - @z * b.y,
+ @z * b.x - @x * b.z,
+ @x * b.y - @y * b.x)
+ end
+
+ def vdot(b)
+ @x * b.x + @y * b.y + @z * b.z
+ end
+
+ def vlength
+ Math.sqrt(@x * @x + @y * @y + @z * @z)
+ end
+
+ def vnormalize
+ len = vlength
+ v = Vec.new(@x, @y, @z)
+ if len > 1.0e-17 then
+ v.x = v.x / len
+ v.y = v.y / len
+ v.z = v.z / len
+ end
+ v
+ end
+end
+
+
+class Sphere
+ def initialize(center, radius)
+ @center = center
+ @radius = radius
+ end
+
+ attr_reader :center, :radius
+
+ def intersect(ray, isect)
+ rs = ray.org.vsub(@center)
+ b = rs.vdot(ray.dir)
+ c = rs.vdot(rs) - (@radius * @radius)
+ d = b * b - c
+ if d > 0.0 then
+ t = - b - Math.sqrt(d)
+
+ if t > 0.0 and t < isect.t then
+ isect.t = t
+ isect.hit = true
+ isect.pl = Vec.new(ray.org.x + ray.dir.x * t,
+ ray.org.y + ray.dir.y * t,
+ ray.org.z + ray.dir.z * t)
+ n = isect.pl.vsub(@center)
+ isect.n = n.vnormalize
+ else
+ 0.0
+ end
+ end
+ nil
+ end
+end
+
+class Plane
+ def initialize(p, n)
+ @p = p
+ @n = n
+ end
+
+ def intersect(ray, isect)
+ d = -@p.vdot(@n)
+ v = ray.dir.vdot(@n)
+ v0 = v
+ if v < 0.0 then
+ v0 = -v
+ end
+ if v0 < 1.0e-17 then
+ return
+ end
+
+ t = -(ray.org.vdot(@n) + d) / v
+
+ if t > 0.0 and t < isect.t then
+ isect.hit = true
+ isect.t = t
+ isect.n = @n
+ isect.pl = Vec.new(ray.org.x + t * ray.dir.x,
+ ray.org.y + t * ray.dir.y,
+ ray.org.z + t * ray.dir.z)
+ end
+ nil
+ end
+end
+
+class Ray
+ def initialize(org, dir)
+ @org = org
+ @dir = dir
+ end
+
+ attr_accessor :org, :dir
+end
+
+class Isect
+ def initialize
+ @t = 10000000.0
+ @hit = false
+ @pl = Vec.new(0.0, 0.0, 0.0)
+ @n = Vec.new(0.0, 0.0, 0.0)
+ end
+
+ attr_accessor :t, :hit, :pl, :n
+end
+
+def clamp(f)
+ i = f * 255.5
+ if i > 255.0 then
+ i = 255.0
+ end
+ if i < 0.0 then
+ i = 0.0
+ end
+ i.to_i
+end
+
+def otherBasis(basis, n)
+ basis[2] = Vec.new(n.x, n.y, n.z)
+ basis[1] = Vec.new(0.0, 0.0, 0.0)
+
+ if n.x < 0.6 and n.x > -0.6 then
+ basis[1].x = 1.0
+ elsif n.y < 0.6 and n.y > -0.6 then
+ basis[1].y = 1.0
+ elsif n.z < 0.6 and n.z > -0.6 then
+ basis[1].z = 1.0
+ else
+ basis[1].x = 1.0
+ end
+
+ basis[0] = basis[1].vcross(basis[2])
+ basis[0] = basis[0].vnormalize
+
+ basis[1] = basis[2].vcross(basis[0])
+ basis[1] = basis[1].vnormalize
+end
+
+class Scene
+ def initialize
+ @spheres = Array.new
+ @spheres[0] = Sphere.new(Vec.new(-2.0, 0.0, -3.5), 0.5)
+ @spheres[1] = Sphere.new(Vec.new(-0.5, 0.0, -3.0), 0.5)
+ @spheres[2] = Sphere.new(Vec.new(1.0, 0.0, -2.2), 0.5)
+ @plane = Plane.new(Vec.new(0.0, -0.5, 0.0), Vec.new(0.0, 1.0, 0.0))
+ end
+
+ def ambient_occlusion(isect)
+ basis = Array.new
+ otherBasis(basis, isect.n)
+
+ ntheta = NAO_SAMPLES
+ nphi = NAO_SAMPLES
+ eps = 0.0001
+ occlusion = 0.0
+
+ p0 = Vec.new(isect.pl.x + eps * isect.n.x,
+ isect.pl.y + eps * isect.n.y,
+ isect.pl.z + eps * isect.n.z)
+ nphi.times do |j|
+ ntheta.times do |i|
+ r = rand
+ phi = 2.0 * 3.14159265 * rand
+ x = Math.cos(phi) * Math.sqrt(1.0 - r)
+ y = Math.sin(phi) * Math.sqrt(1.0 - r)
+ z = Math.sqrt(r)
+
+ rx = x * basis[0].x + y * basis[1].x + z * basis[2].x
+ ry = x * basis[0].y + y * basis[1].y + z * basis[2].y
+ rz = x * basis[0].z + y * basis[1].z + z * basis[2].z
+
+ raydir = Vec.new(rx, ry, rz)
+ ray = Ray.new(p0, raydir)
+
+ occisect = Isect.new
+ @spheres[0].intersect(ray, occisect)
+ @spheres[1].intersect(ray, occisect)
+ @spheres[2].intersect(ray, occisect)
+ @plane.intersect(ray, occisect)
+ if occisect.hit then
+ occlusion = occlusion + 1.0
+ else
+ 0.0
+ end
+ end
+ end
+
+ occlusion = (ntheta.to_f * nphi.to_f - occlusion) / (ntheta.to_f * nphi.to_f)
+
+ Vec.new(occlusion, occlusion, occlusion)
+ end
+
+ def render(w, h, nsubsamples)
+ cnt = 0
+ nsf = nsubsamples.to_f
+ h.times do |y|
+ w.times do |x|
+ rad = Vec.new(0.0, 0.0, 0.0)
+
+ # Subsmpling
+ nsubsamples.times do |v|
+ nsubsamples.times do |u|
+
+ cnt = cnt + 1
+ wf = w.to_f
+ hf = h.to_f
+ xf = x.to_f
+ yf = y.to_f
+ uf = u.to_f
+ vf = v.to_f
+
+ px = (xf + (uf / nsf) - (wf / 2.0)) / (wf / 2.0)
+ py = -(yf + (vf / nsf) - (hf / 2.0)) / (hf / 2.0)
+
+ eye = Vec.new(px, py, -1.0).vnormalize
+
+ ray = Ray.new(Vec.new(0.0, 0.0, 0.0), eye)
+
+ isect = Isect.new
+ @spheres[0].intersect(ray, isect)
+ @spheres[1].intersect(ray, isect)
+ @spheres[2].intersect(ray, isect)
+ @plane.intersect(ray, isect)
+ if isect.hit then
+ col = ambient_occlusion(isect)
+ rad.x = rad.x + col.x
+ rad.y = rad.y + col.y
+ rad.z = rad.z + col.z
+ end
+ end
+ end
+
+ r = rad.x / (nsf * nsf)
+ g = rad.y / (nsf * nsf)
+ b = rad.z / (nsf * nsf)
+ printf("%c", clamp(r))
+ printf("%c", clamp(g))
+ printf("%c", clamp(b))
+ end
+ nil
+ end
+
+ nil
+ end
+end
+
+alias printf_orig printf
+def printf *args
+end
+
+# File.open("ao.ppm", "w") do |fp|
+ printf("P6\n")
+ printf("%d %d\n", IMAGE_WIDTH, IMAGE_HEIGHT)
+ printf("255\n", IMAGE_WIDTH, IMAGE_HEIGHT)
+ Scene.new.render(IMAGE_WIDTH, IMAGE_HEIGHT, NSUBSAMPLES)
+# end
+
+undef printf
+alias printf printf_orig
diff --git a/benchmark/bm_app_lc_fizzbuzz.rb b/benchmark/bm_app_lc_fizzbuzz.rb
new file mode 100644
index 0000000000..f09574bbeb
--- /dev/null
+++ b/benchmark/bm_app_lc_fizzbuzz.rb
@@ -0,0 +1,52 @@
+#
+# 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_hash_aref_miss.rb b/benchmark/bm_hash_aref_miss.rb
new file mode 100644
index 0000000000..b0913dd4bb
--- /dev/null
+++ b/benchmark/bm_hash_aref_miss.rb
@@ -0,0 +1,5 @@
+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
new file mode 100644
index 0000000000..19439b061b
--- /dev/null
+++ b/benchmark/bm_hash_aref_str.rb
@@ -0,0 +1,4 @@
+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
new file mode 100644
index 0000000000..54298ffc9e
--- /dev/null
+++ b/benchmark/bm_hash_aref_sym.rb
@@ -0,0 +1,4 @@
+h = {}
+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_aref_sym_long.rb b/benchmark/bm_hash_aref_sym_long.rb
new file mode 100644
index 0000000000..a9be4059e6
--- /dev/null
+++ b/benchmark/bm_hash_aref_sym_long.rb
@@ -0,0 +1,8 @@
+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?
+].map!(&:to_sym)
+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
new file mode 100644
index 0000000000..e944aae9f2
--- /dev/null
+++ b/benchmark/bm_hash_flatten.rb
@@ -0,0 +1,9 @@
+h = {}
+
+10000.times do |i|
+ h[i] = nil
+end
+
+1000.times do
+ h.flatten
+end
diff --git a/benchmark/bm_hash_ident_num.rb b/benchmark/bm_hash_ident_num.rb
new file mode 100644
index 0000000000..b226736c6f
--- /dev/null
+++ b/benchmark/bm_hash_ident_num.rb
@@ -0,0 +1,4 @@
+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
new file mode 100644
index 0000000000..4b3b58edec
--- /dev/null
+++ b/benchmark/bm_hash_ident_obj.rb
@@ -0,0 +1,4 @@
+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
new file mode 100644
index 0000000000..8582b38e31
--- /dev/null
+++ b/benchmark/bm_hash_ident_str.rb
@@ -0,0 +1,4 @@
+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
new file mode 100644
index 0000000000..4c81e3d28e
--- /dev/null
+++ b/benchmark/bm_hash_ident_sym.rb
@@ -0,0 +1,4 @@
+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
new file mode 100644
index 0000000000..6863cd01f9
--- /dev/null
+++ b/benchmark/bm_hash_keys.rb
@@ -0,0 +1,9 @@
+h = {}
+
+10000.times do |i|
+ h[i] = nil
+end
+
+5000.times do
+ h.keys
+end
diff --git a/benchmark/bm_hash_shift.rb b/benchmark/bm_hash_shift.rb
new file mode 100644
index 0000000000..a645671a5b
--- /dev/null
+++ b/benchmark/bm_hash_shift.rb
@@ -0,0 +1,10 @@
+h = {}
+
+10000.times do |i|
+ h[i] = nil
+end
+
+50000.times do
+ k, v = h.shift
+ h[k] = v
+end
diff --git a/benchmark/bm_hash_values.rb b/benchmark/bm_hash_values.rb
new file mode 100644
index 0000000000..069441302f
--- /dev/null
+++ b/benchmark/bm_hash_values.rb
@@ -0,0 +1,9 @@
+h = {}
+
+10000.times do |i|
+ h[i] = nil
+end
+
+5000.times do
+ h.values
+end
diff --git a/benchmark/bm_securerandom.rb b/benchmark/bm_securerandom.rb
new file mode 100644
index 0000000000..a082ea6d5b
--- /dev/null
+++ b/benchmark/bm_securerandom.rb
@@ -0,0 +1,5 @@
+require "securerandom"
+
+20_0000.times do
+ SecureRandom.random_number(100)
+end
diff --git a/benchmark/bm_so_binary_trees.rb b/benchmark/bm_so_binary_trees.rb
index 6a26465578..b1693e4109 100644
--- a/benchmark/bm_so_binary_trees.rb
+++ b/benchmark/bm_so_binary_trees.rb
@@ -4,7 +4,9 @@
# contributed by Jesse Millikan
# disable output
-def STDOUT.write_ *args
+alias puts_orig puts
+def puts str
+ # disable puts
end
def item_check(tree)
@@ -25,7 +27,7 @@ def bottom_up_tree(item, depth)
end
end
-max_depth = 12 # 16 # ARGV[0].to_i
+max_depth = 16 # ARGV[0].to_i
min_depth = 4
max_depth = min_depth + 2 if min_depth + 2 > max_depth
@@ -55,3 +57,6 @@ min_depth.step(max_depth + 1, 2) do |depth|
end
puts "long lived tree of depth #{max_depth}\t check: #{item_check(long_lived_tree)}"
+
+undef puts
+alias puts puts_orig
diff --git a/benchmark/bm_so_meteor_contest.rb b/benchmark/bm_so_meteor_contest.rb
index 99cf6a91cc..b8e93bd150 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 boundries and 2) it produces a prunable board. if either of these
+ # 1) it overlaps the boundaries 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 accross the rows
+ # loop across the rows
(location / 6).to_i.upto(9) do | row_on |
- # obtain a set of regions representing the bits of the curent row.
+ # obtain a set of regions representing the bits of the current 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 muliple of five true is returned since
+ # be zero. The size of any such reaason is tested if it is not a multiple 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
- # follwing reasons:
+ # following 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
@@ -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 noticable time (performance).
+ # take noticeable time (performance).
if (@boards_found == @stop_count) then
print_results
exit(0)
diff --git a/benchmark/bm_vm1_gc_short_lived.rb b/benchmark/bm_vm1_gc_short_lived.rb
new file mode 100644
index 0000000000..e78bca5668
--- /dev/null
+++ b/benchmark/bm_vm1_gc_short_lived.rb
@@ -0,0 +1,10 @@
+i = 0
+while i<30_000_000 # while loop 1
+ a = '' # short-lived String
+ b = ''
+ c = ''
+ d = ''
+ e = ''
+ f = ''
+ i+=1
+end
diff --git a/benchmark/bm_vm1_gc_short_with_complex_long.rb b/benchmark/bm_vm1_gc_short_with_complex_long.rb
new file mode 100644
index 0000000000..b66052dee0
--- /dev/null
+++ b/benchmark/bm_vm1_gc_short_with_complex_long.rb
@@ -0,0 +1,27 @@
+def nested_hash h, n
+ if n == 0
+ ''
+ else
+ 10.times{
+ h[Object.new] = nested_hash(h, n-1)
+ }
+ end
+end
+
+long_lived = Hash.new
+nested_hash long_lived, 6
+
+GC.start
+GC.start
+
+i = 0
+while i<30_000_000 # while loop 1
+ a = '' # short-lived String
+ b = ''
+ c = ''
+ d = ''
+ e = ''
+ f = ''
+ i+=1
+end
+
diff --git a/benchmark/bm_vm1_gc_short_with_long.rb b/benchmark/bm_vm1_gc_short_with_long.rb
new file mode 100644
index 0000000000..298dbc845b
--- /dev/null
+++ b/benchmark/bm_vm1_gc_short_with_long.rb
@@ -0,0 +1,13 @@
+long_lived = Array.new(1_000_000){|i| "#{i}"}
+GC.start
+GC.start
+i = 0
+while i<30_000_000 # while loop 1
+ a = '' # short-lived String
+ b = ''
+ c = ''
+ d = ''
+ e = ''
+ f = ''
+ i+=1
+end
diff --git a/benchmark/bm_vm1_gc_short_with_symbol.rb b/benchmark/bm_vm1_gc_short_with_symbol.rb
new file mode 100644
index 0000000000..6b15c1b7bf
--- /dev/null
+++ b/benchmark/bm_vm1_gc_short_with_symbol.rb
@@ -0,0 +1,15 @@
+# make many symbols
+50_000.times{|i| sym = "sym#{i}".to_sym}
+GC.start
+GC.start
+
+i = 0
+while i<30_000_000 # while loop 1
+ a = '' # short-lived String
+ b = ''
+ c = ''
+ d = ''
+ e = ''
+ f = ''
+ i+=1
+end
diff --git a/benchmark/bm_vm1_gc_wb_ary.rb b/benchmark/bm_vm1_gc_wb_ary.rb
new file mode 100644
index 0000000000..ecfab51dbf
--- /dev/null
+++ b/benchmark/bm_vm1_gc_wb_ary.rb
@@ -0,0 +1,10 @@
+long_lived = []
+GC.start
+GC.start
+
+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
new file mode 100644
index 0000000000..017eff4f94
--- /dev/null
+++ b/benchmark/bm_vm1_gc_wb_obj.rb
@@ -0,0 +1,13 @@
+class C
+ attr_accessor :foo
+end
+long_lived = C.new
+GC.start
+GC.start
+
+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_newlambda.rb b/benchmark/bm_vm2_newlambda.rb
new file mode 100644
index 0000000000..6422c9b0d0
--- /dev/null
+++ b/benchmark/bm_vm2_newlambda.rb
@@ -0,0 +1,5 @@
+i = 0
+while i<6_000_000 # benchmark loop 2
+ i += 1
+ lambda {}
+end
diff --git a/benchmark/bm_vm_thread_close.rb b/benchmark/bm_vm_thread_close.rb
new file mode 100644
index 0000000000..3e9a265ce8
--- /dev/null
+++ b/benchmark/bm_vm_thread_close.rb
@@ -0,0 +1,6 @@
+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_queue.rb b/benchmark/bm_vm_thread_queue.rb
new file mode 100644
index 0000000000..37381ae62b
--- /dev/null
+++ b/benchmark/bm_vm_thread_queue.rb
@@ -0,0 +1,18 @@
+require 'thread'
+
+n = 1_000_000
+q = Queue.new
+consumer = Thread.new{
+ while q.pop
+ # consuming
+ end
+}
+
+producer = Thread.new{
+ n.times{
+ q.push true
+ }
+ q.push nil
+}
+
+consumer.join
diff --git a/benchmark/driver.rb b/benchmark/driver.rb
index 695dc41aff..3904e25503 100644
--- a/benchmark/driver.rb
+++ b/benchmark/driver.rb
@@ -77,6 +77,7 @@ class BenchmarkDriver
@exclude = opt[:exclude] || nil
@verbose = opt[:quiet] ? false : (opt[:verbose] || false)
@output = opt[:output] ? open(opt[:output], 'w') : nil
+ @rawdata_output = opt[:rawdata_output] ? open(opt[:rawdata_output], 'w') : nil
@loop_wl1 = @loop_wl2 = nil
@ruby_arg = opt[:ruby_arg] || nil
@opt = opt
@@ -128,6 +129,14 @@ class BenchmarkDriver
message "Elapsed time: #{Time.now - @start_time} (sec)"
end
+ if @rawdata_output
+ h = {}
+ h[:cpuinfo] = File.read('/proc/cpuinfo') if File.exist?('/proc/cpuinfo')
+ h[:executables] = @execs
+ h[:results] = @results
+ @rawdata_output.puts h.inspect
+ end
+
output '-----------------------------------------------------------'
output 'benchmark results:'
@@ -238,11 +247,17 @@ 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{
- `#{cmd}`
+ system(cmd, out: File::NULL)
}
if $? != 0
@@ -260,6 +275,7 @@ if __FILE__ == $0
:dir => File.dirname(__FILE__),
:repeat => 1,
:output => "bmlog-#{Time.now.strftime('%Y%m%d-%H%M%S')}.#{$$}",
+ :raw_output => nil
}
parser = OptionParser.new{|o|
@@ -287,12 +303,16 @@ if __FILE__ == $0
o.on('--ruby-arg [ARG]', "Optional argument for ruby"){|a|
opt[:ruby_arg] = a
}
- o.on('-q', '--quiet', "Run without notify information except result table."){|q|
- opt[:quiet] = q
+ o.on('--rawdata-output [FILE]', 'output rawdata'){|r|
+ opt[:rawdata_output] = r
}
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)
diff --git a/benchmark/gc/aobench.rb b/benchmark/gc/aobench.rb
new file mode 100644
index 0000000000..2eed7abc83
--- /dev/null
+++ b/benchmark/gc/aobench.rb
@@ -0,0 +1 @@
+require_relative '../bm_app_aobench.rb'
diff --git a/benchmark/gc/binary_trees.rb b/benchmark/gc/binary_trees.rb
new file mode 100644
index 0000000000..af8ea722aa
--- /dev/null
+++ b/benchmark/gc/binary_trees.rb
@@ -0,0 +1 @@
+require_relative '../bm_so_binary_trees.rb'
diff --git a/benchmark/gc/gcbench.rb b/benchmark/gc/gcbench.rb
new file mode 100644
index 0000000000..09a404466a
--- /dev/null
+++ b/benchmark/gc/gcbench.rb
@@ -0,0 +1,56 @@
+require 'benchmark'
+require 'pp'
+require 'optparse'
+
+$list = true
+$gcprof = true
+
+opt = OptionParser.new
+opt.on('-q'){$list = false}
+opt.on('-d'){$gcprof = false}
+opt.parse!(ARGV)
+
+script = File.join(File.dirname(__FILE__), ARGV.shift)
+script += '.rb' unless FileTest.exist?(script)
+raise "#{script} not found" unless FileTest.exist?(script)
+
+puts "Script: #{script}"
+
+if $gcprof
+ GC::Profiler.enable
+end
+
+tms = Benchmark.measure{|x|
+ load script
+}
+
+gc_time = 0
+
+if $gcprof
+ gc_time = GC::Profiler.total_time
+ GC::Profiler.report if $list and RUBY_VERSION >= '2.0.0' # before 1.9.3, report() may run infinite loop
+ GC::Profiler.disable
+end
+
+pp GC.stat
+
+puts "#{RUBY_DESCRIPTION} #{GC::OPTS.inspect}" if defined?(GC::OPTS)
+
+desc = "#{RUBY_VERSION}#{RUBY_PATCHLEVEL >= 0 ? "p#{RUBY_PATCHLEVEL}" : "dev"}"
+name = File.basename(script, '.rb')
+
+puts
+puts script
+puts Benchmark::CAPTION
+puts tms
+puts "GC total time (sec): #{gc_time}"
+
+# show High-Water Mark on Linux
+if File.exist?('/proc/self/status') && /VmHWM:\s*(\d+.+)/ =~ File.read('/proc/self/status')
+ puts
+ puts "VmHWM: #{$1.chomp}"
+end
+
+puts
+puts "Summary of #{name} on #{desc}\t#{tms.real}\t#{gc_time}\t#{GC.count}"
+puts " (real time in sec, GC time in sec, GC count)"
diff --git a/benchmark/gc/hash1.rb b/benchmark/gc/hash1.rb
new file mode 100644
index 0000000000..cb030d458d
--- /dev/null
+++ b/benchmark/gc/hash1.rb
@@ -0,0 +1,11 @@
+value = 0.01
+h = {}
+n = 50_000
+
+1.upto(n){|i|
+ h["%020d" % i] = "v-#{i}"
+}
+
+(n * 1_000).times{
+ ''
+}
diff --git a/benchmark/gc/hash2.rb b/benchmark/gc/hash2.rb
new file mode 100644
index 0000000000..e8c943fb21
--- /dev/null
+++ b/benchmark/gc/hash2.rb
@@ -0,0 +1,7 @@
+value = 0.01
+h = {}
+n = 4*(10**6)
+
+1.upto(n){|i|
+ h["%020d" % i] = value * i
+}
diff --git a/benchmark/gc/null.rb b/benchmark/gc/null.rb
new file mode 100644
index 0000000000..c05a79f561
--- /dev/null
+++ b/benchmark/gc/null.rb
@@ -0,0 +1 @@
+# null
diff --git a/benchmark/gc/pentomino.rb b/benchmark/gc/pentomino.rb
new file mode 100644
index 0000000000..94ba74be89
--- /dev/null
+++ b/benchmark/gc/pentomino.rb
@@ -0,0 +1 @@
+require_relative '../bm_app_pentomino.rb'
diff --git a/benchmark/gc/rdoc.rb b/benchmark/gc/rdoc.rb
new file mode 100644
index 0000000000..14c89f5611
--- /dev/null
+++ b/benchmark/gc/rdoc.rb
@@ -0,0 +1,13 @@
+require 'rdoc/rdoc'
+require 'tmpdir'
+
+srcdir = File.expand_path('../..', __dir__)
+
+Dir.mktmpdir('rdocbench-'){|d|
+ dir = File.join(d, 'rdocbench')
+ args = %W(--root #{srcdir} --page-dir #{srcdir}/doc --encoding=UTF-8 --no-force-update --all --ri --debug --quiet #{srcdir})
+ args << '--op' << dir
+
+ r = RDoc::RDoc.new
+ r.document args
+}
diff --git a/benchmark/gc/redblack.rb b/benchmark/gc/redblack.rb
new file mode 100644
index 0000000000..c66290140a
--- /dev/null
+++ b/benchmark/gc/redblack.rb
@@ -0,0 +1,366 @@
+# This benchmark is imported from https://github.com/jruby/rubybench/blob/master/time/bench_red_black.rb
+# License is License is Apache-2
+
+require 'benchmark'
+
+# Algorithm based on "Introduction to Algorithms" by Cormen and others
+class RedBlackTree
+ class Node
+ attr_accessor :color
+ attr_accessor :key
+ attr_accessor :left
+ attr_accessor :right
+ attr_accessor :parent
+
+ RED = :red
+ BLACK = :black
+ COLORS = [RED, BLACK].freeze
+
+ def initialize(key, color = RED)
+ raise ArgumentError, "Bad value for color parameter" unless COLORS.include?(color)
+ @color = color
+ @key = key
+ @left = @right = @parent = NilNode.instance
+ end
+
+ def black?
+ return color == BLACK
+ end
+
+ def red?
+ return color == RED
+ end
+ end
+
+ class NilNode < Node
+ class << self
+ private :new
+
+ # it's not thread safe
+ def instance
+ @instance ||= begin
+ def instance
+ return @instance
+ end
+
+ new
+ end
+ end
+ end
+
+ def initialize
+ self.color = BLACK
+ self.key = 0
+ self.left = nil
+ self.right = nil
+ self.parent = nil
+ end
+
+ def nil?
+ return true
+ end
+ end
+
+ include Enumerable
+
+ attr_accessor :root
+ attr_accessor :size
+
+ def initialize
+ self.root = NilNode.instance
+ self.size = 0
+ end
+
+ def add(key)
+ insert(Node.new(key))
+ end
+
+ def insert(x)
+ insert_helper(x)
+
+ x.color = Node::RED
+ while x != root && x.parent.color == Node::RED
+ if x.parent == x.parent.parent.left
+ y = x.parent.parent.right
+ if !y.nil? && y.color == Node::RED
+ x.parent.color = Node::BLACK
+ y.color = Node::BLACK
+ x.parent.parent.color = Node::RED
+ x = x.parent.parent
+ else
+ if x == x.parent.right
+ x = x.parent
+ left_rotate(x)
+ end
+ x.parent.color = Node::BLACK
+ x.parent.parent.color = Node::RED
+ right_rotate(x.parent.parent)
+ end
+ else
+ y = x.parent.parent.left
+ if !y.nil? && y.color == Node::RED
+ x.parent.color = Node::BLACK
+ y.color = Node::BLACK
+ x.parent.parent.color = Node::RED
+ x = x.parent.parent
+ else
+ if x == x.parent.left
+ x = x.parent
+ right_rotate(x)
+ end
+ x.parent.color = Node::BLACK
+ x.parent.parent.color = Node::RED
+ left_rotate(x.parent.parent)
+ end
+ end
+ end
+ root.color = Node::BLACK
+ end
+
+ alias << insert
+
+ def delete(z)
+ y = (z.left.nil? || z.right.nil?) ? z : successor(z)
+ x = y.left.nil? ? y.right : y.left
+ x.parent = y.parent
+
+ if y.parent.nil?
+ self.root = x
+ else
+ if y == y.parent.left
+ y.parent.left = x
+ else
+ y.parent.right = x
+ end
+ end
+
+ z.key = y.key if y != z
+
+ if y.color == Node::BLACK
+ delete_fixup(x)
+ end
+
+ self.size -= 1
+ return y
+ end
+
+ def minimum(x = root)
+ while !x.left.nil?
+ x = x.left
+ end
+ return x
+ end
+
+ def maximum(x = root)
+ while !x.right.nil?
+ x = x.right
+ end
+ return x
+ end
+
+ def successor(x)
+ if !x.right.nil?
+ return minimum(x.right)
+ end
+ y = x.parent
+ while !y.nil? && x == y.right
+ x = y
+ y = y.parent
+ end
+ return y
+ end
+
+ def predecessor(x)
+ if !x.left.nil?
+ return maximum(x.left)
+ end
+ y = x.parent
+ while !y.nil? && x == y.left
+ x = y
+ y = y.parent
+ end
+ return y
+ end
+
+ def inorder_walk(x = root)
+ x = self.minimum
+ while !x.nil?
+ yield x.key
+ x = successor(x)
+ end
+ end
+
+ alias each inorder_walk
+
+ def reverse_inorder_walk(x = root)
+ x = self.maximum
+ while !x.nil?
+ yield x.key
+ x = predecessor(x)
+ end
+ end
+
+ alias reverse_each reverse_inorder_walk
+
+ def search(key, x = root)
+ while !x.nil? && x.key != key
+ key < x.key ? x = x.left : x = x.right
+ end
+ return x
+ end
+
+ def empty?
+ return self.root.nil?
+ end
+
+ def black_height(x = root)
+ height = 0
+ while !x.nil?
+ x = x.left
+ height +=1 if x.nil? || x.black?
+ end
+ return height
+ end
+
+private
+
+ def left_rotate(x)
+ raise "x.right is nil!" if x.right.nil?
+ y = x.right
+ x.right = y.left
+ y.left.parent = x if !y.left.nil?
+ y.parent = x.parent
+ if x.parent.nil?
+ self.root = y
+ else
+ if x == x.parent.left
+ x.parent.left = y
+ else
+ x.parent.right = y
+ end
+ end
+ y.left = x
+ x.parent = y
+ end
+
+ def right_rotate(x)
+ raise "x.left is nil!" if x.left.nil?
+ y = x.left
+ x.left = y.right
+ y.right.parent = x if !y.right.nil?
+ y.parent = x.parent
+ if x.parent.nil?
+ self.root = y
+ else
+ if x == x.parent.left
+ x.parent.left = y
+ else
+ x.parent.right = y
+ end
+ end
+ y.right = x
+ x.parent = y
+ end
+
+ def insert_helper(z)
+ y = NilNode.instance
+ x = root
+ while !x.nil?
+ y = x
+ z.key < x.key ? x = x.left : x = x.right
+ end
+ z.parent = y
+ if y.nil?
+ self.root = z
+ else
+ z.key < y.key ? y.left = z : y.right = z
+ end
+ self.size += 1
+ end
+
+ def delete_fixup(x)
+ while x != root && x.color == Node::BLACK
+ if x == x.parent.left
+ w = x.parent.right
+ if w.color == Node::RED
+ w.color = Node::BLACK
+ x.parent.color = Node::RED
+ left_rotate(x.parent)
+ w = x.parent.right
+ end
+ if w.left.color == Node::BLACK && w.right.color == Node::BLACK
+ w.color = Node::RED
+ x = x.parent
+ else
+ if w.right.color == Node::BLACK
+ w.left.color = Node::BLACK
+ w.color = Node::RED
+ right_rotate(w)
+ w = x.parent.right
+ end
+ w.color = x.parent.color
+ x.parent.color = Node::BLACK
+ w.right.color = Node::BLACK
+ left_rotate(x.parent)
+ x = root
+ end
+ else
+ w = x.parent.left
+ if w.color == Node::RED
+ w.color = Node::BLACK
+ x.parent.color = Node::RED
+ right_rotate(x.parent)
+ w = x.parent.left
+ end
+ if w.right.color == Node::BLACK && w.left.color == Node::BLACK
+ w.color = Node::RED
+ x = x.parent
+ else
+ if w.left.color == Node::BLACK
+ w.right.color = Node::BLACK
+ w.color = Node::RED
+ left_rotate(w)
+ w = x.parent.left
+ end
+ w.color = x.parent.color
+ x.parent.color = Node::BLACK
+ w.left.color = Node::BLACK
+ right_rotate(x.parent)
+ x = root
+ end
+ end
+ end
+ x.color = Node::BLACK
+ end
+end
+
+def rbt_bm
+ n = 100_000
+ a1 = []; n.times { a1 << rand(999_999) }
+ a2 = []; n.times { a2 << rand(999_999) }
+
+ start = Time.now
+
+ tree = RedBlackTree.new
+
+ n.times {|i| tree.add(i) }
+ n.times { tree.delete(tree.root) }
+
+ tree = RedBlackTree.new
+ a1.each {|e| tree.add(e) }
+ a2.each {|e| tree.search(e) }
+ tree.inorder_walk {|key| key + 1 }
+ tree.reverse_inorder_walk {|key| key + 1 }
+ n.times { tree.minimum }
+ n.times { tree.maximum }
+
+ return Time.now - start
+end
+
+N = (ARGV[0] || 10).to_i
+
+N.times do
+ # puts rbt_bm.to_f
+ rbt_bm.to_f
+ # puts "GC.count = #{GC.count}" if GC.respond_to?(:count)
+end
diff --git a/benchmark/gc/ring.rb b/benchmark/gc/ring.rb
new file mode 100644
index 0000000000..be2c7b7250
--- /dev/null
+++ b/benchmark/gc/ring.rb
@@ -0,0 +1,29 @@
+# create many old objects
+
+max = 30_000_000
+
+class Ring
+ attr_reader :next_ring
+ def initialize n = nil
+ @next_ring = n
+ end
+
+
+ def size
+ s = 1
+ ring = self
+ while ring.next_ring
+ s += 1
+ ring = ring.next_ring
+ end
+ s
+ end
+end
+
+ring = Ring.new
+
+max.times{
+ ring = Ring.new(ring)
+}
+
+# p ring.size
diff --git a/benchmark/prepare_so_k_nucleotide.rb b/benchmark/prepare_so_k_nucleotide.rb
index f28f4460a1..d83aeb7a7e 100644
--- a/benchmark/prepare_so_k_nucleotide.rb
+++ b/benchmark/prepare_so_k_nucleotide.rb
@@ -1,2 +1,2 @@
-require File.join(File.dirname(__FILE__), 'make_fasta_output')
+require_relative '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 7f089109de..da3ec2df14 100644
--- a/benchmark/prepare_so_reverse_complement.rb
+++ b/benchmark/prepare_so_reverse_complement.rb
@@ -1,2 +1,2 @@
-require File.join(File.dirname(__FILE__), 'make_fasta_output')
+require_relative 'make_fasta_output'
prepare_fasta_output(2_500_000)
diff --git a/bignum.c b/bignum.c
index a9448ceab0..08b4337262 100644
--- a/bignum.c
+++ b/bignum.c
@@ -25,30 +25,2848 @@
#endif
#include <assert.h>
+#if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H)
+#define USE_GMP
+#include <gmp.h>
+#endif
+
+#define RB_BIGNUM_TYPE_P(x) RB_TYPE_P((x), T_BIGNUM)
+
VALUE rb_cBignum;
+const char ruby_digitmap[] = "0123456789abcdefghijklmnopqrstuvwxyz";
+
+#ifndef SIZEOF_BDIGIT_DBL
+# if SIZEOF_INT*2 <= SIZEOF_LONG_LONG
+# define SIZEOF_BDIGIT_DBL SIZEOF_LONG_LONG
+# else
+# define SIZEOF_BDIGIT_DBL SIZEOF_LONG
+# endif
+#endif
-static VALUE big_three = Qnil;
+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(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));
+
+#if SIZEOF_BDIGIT < SIZEOF_LONG
+STATIC_ASSERT(sizeof_long_and_sizeof_bdigit, SIZEOF_LONG % SIZEOF_BDIGIT == 0);
+#else
+STATIC_ASSERT(sizeof_long_and_sizeof_bdigit, SIZEOF_BDIGIT % SIZEOF_LONG == 0);
+#endif
-#if defined __MINGW32__
-#define USHORT _USHORT
+#ifdef WORDS_BIGENDIAN
+# define HOST_BIGENDIAN_P 1
+#else
+# define HOST_BIGENDIAN_P 0
#endif
+#define ALIGNOF(type) ((int)offsetof(struct { char f1; type f2; }, f2))
+/* (!LSHIFTABLE(d, n) ? 0 : (n)) is same as n but suppress a warning, C4293, by Visual Studio. */
+#define LSHIFTABLE(d, n) ((n) < sizeof(d) * CHAR_BIT)
+#define LSHIFTX(d, n) (!LSHIFTABLE(d, n) ? 0 : ((d) << (!LSHIFTABLE(d, n) ? 0 : (n))))
+#define CLEAR_LOWBITS(d, numbits) ((d) & LSHIFTX(~((d)*0), (numbits)))
+#define FILL_LOWBITS(d, numbits) ((d) | (LSHIFTX(((d)*0+1), (numbits))-1))
+#define POW2_P(x) (((x)&((x)-1))==0)
-#define BDIGITS(x) (RBIGNUM_DIGITS(x))
-#define BITSPERDIG (SIZEOF_BDIGITS*CHAR_BIT)
+#define BDIGITS(x) (BIGNUM_DIGITS(x))
+#define BITSPERDIG (SIZEOF_BDIGIT*CHAR_BIT)
#define BIGRAD ((BDIGIT_DBL)1 << BITSPERDIG)
#define BIGRAD_HALF ((BDIGIT)(BIGRAD >> 1))
-#define DIGSPERLONG (SIZEOF_LONG/SIZEOF_BDIGITS)
-#if HAVE_LONG_LONG
-# define DIGSPERLL (SIZEOF_LONG_LONG/SIZEOF_BDIGITS)
-#endif
-#define BIGUP(x) ((BDIGIT_DBL)(x) << BITSPERDIG)
+#define BDIGIT_MSB(d) (((d) & BIGRAD_HALF) != 0)
+#define BIGUP(x) LSHIFTX(((x) + (BDIGIT_DBL)0), BITSPERDIG)
#define BIGDN(x) RSHIFT((x),BITSPERDIG)
-#define BIGLO(x) ((BDIGIT)((x) & (BIGRAD-1)))
-#define BDIGMAX ((BDIGIT)-1)
+#define BIGLO(x) ((BDIGIT)((x) & BDIGMAX))
+#define BDIGMAX ((BDIGIT)(BIGRAD-1))
+#define BDIGIT_DBL_MAX (~(BDIGIT_DBL)0)
+
+#if SIZEOF_BDIGIT == 2
+# define swap_bdigit(x) swap16(x)
+#elif SIZEOF_BDIGIT == 4
+# define swap_bdigit(x) swap32(x)
+#elif SIZEOF_BDIGIT == 8
+# define swap_bdigit(x) swap64(x)
+#endif
-#define BIGZEROP(x) (RBIGNUM_LEN(x) == 0 || \
+#define BIGZEROP(x) (BIGNUM_LEN(x) == 0 || \
(BDIGITS(x)[0] == 0 && \
- (RBIGNUM_LEN(x) == 1 || bigzero_p(x))))
+ (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) : \
+ rb_absint_size(x, NULL))
+
+#define BIGDIVREM_EXTRA_WORDS 1
+#define roomof(n, m) ((long)(((n)+(m)-1) / (m)))
+#define bdigit_roomof(n) roomof(n, SIZEOF_BDIGIT)
+#define BARY_ARGS(ary) ary, numberof(ary)
+
+#define BARY_ADD(z, x, y) bary_add(BARY_ARGS(z), BARY_ARGS(x), BARY_ARGS(y))
+#define BARY_SUB(z, x, y) bary_sub(BARY_ARGS(z), BARY_ARGS(x), BARY_ARGS(y))
+#define BARY_SHORT_MUL(z, x, y) bary_short_mul(BARY_ARGS(z), BARY_ARGS(x), BARY_ARGS(y))
+#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 bignew(len,sign) bignew_1(rb_cBignum,(len),(sign))
+
+#define BDIGITS_ZERO(ptr, n) do { \
+ BDIGIT *bdigitz_zero_ptr = (ptr); \
+ size_t bdigitz_zero_n = (n); \
+ while (bdigitz_zero_n) { \
+ *bdigitz_zero_ptr++ = 0; \
+ bdigitz_zero_n--; \
+ } \
+} while (0)
+
+#define BARY_TRUNC(ds, n) do { \
+ while (0 < (n) && (ds)[(n)-1] == 0) \
+ (n)--; \
+ } while (0)
+
+#define KARATSUBA_BALANCED(xn, yn) ((yn)/2 < (xn))
+#define TOOM3_BALANCED(xn, yn) (((yn)+2)/3 * 2 < (xn))
+
+#define GMP_MUL_DIGITS 20
+#define KARATSUBA_MUL_DIGITS 70
+#define TOOM3_MUL_DIGITS 150
+
+#define GMP_DIV_DIGITS 20
+#define GMP_BIG2STR_DIGITS 20
+#define GMP_STR2BIG_DIGITS 20
+
+typedef void (mulfunc_t)(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn, BDIGIT *wds, size_t wn);
+
+static mulfunc_t bary_mul_toom3_start;
+static mulfunc_t bary_mul_karatsuba_start;
+static BDIGIT bigdivrem_single(BDIGIT *qds, const BDIGIT *xds, size_t xn, BDIGIT y);
+static void bary_divmod(BDIGIT *qds, size_t qn, BDIGIT *rds, size_t rn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn);
+
+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 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; }
+#endif
+
+#define U16(a) ((uint16_t)(a))
+#define U32(a) ((uint32_t)(a))
+#ifdef HAVE_UINT64_T
+#define U64(a,b) (((uint64_t)(a) << 32) | (b))
+#endif
+#ifdef HAVE_UINT128_T
+#define U128(a,b,c,d) (((uint128_t)U64(a,b) << 64) | U64(c,d))
+#endif
+
+/* The following scirpt, maxpow.rb, generates the tables follows.
+
+def big(n, bits)
+ ns = []
+ ((bits+31)/32).times {
+ ns << sprintf("0x%08x", n & 0xffff_ffff)
+ n >>= 32
+ }
+ "U#{bits}(" + ns.reverse.join(",") + ")"
+end
+def values(ary, width, indent)
+ lines = [""]
+ ary.each {|e|
+ lines << "" if !ary.last.empty? && width < (lines.last + e + ", ").length
+ lines.last << e + ", "
+ }
+ lines.map {|line| " " * indent + line.chomp(" ") + "\n" }.join
+end
+[16,32,64,128].each {|bits|
+ max = 2**bits-1
+ exps = []
+ nums = []
+ 2.upto(36) {|base|
+ exp = 0
+ n = 1
+ while n * base <= max
+ exp += 1
+ n *= base
+ end
+ exps << exp.to_s
+ nums << big(n, bits)
+ }
+ puts "#ifdef HAVE_UINT#{bits}_T"
+ puts "static const int maxpow#{bits}_exp[35] = {"
+ print values(exps, 70, 4)
+ puts "};"
+ puts "static const uint#{bits}_t maxpow#{bits}_num[35] = {"
+ print values(nums, 70, 4)
+ puts "};"
+ puts "#endif"
+}
+
+ */
+
+#if SIZEOF_BDIGIT_DBL == 2
+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,
+};
+static const uint16_t maxpow16_num[35] = {
+ U16(0x00008000), U16(0x0000e6a9), U16(0x00004000), U16(0x00003d09),
+ U16(0x0000b640), U16(0x000041a7), U16(0x00008000), U16(0x0000e6a9),
+ U16(0x00002710), U16(0x00003931), U16(0x00005100), U16(0x00006f91),
+ U16(0x00009610), U16(0x0000c5c1), U16(0x00001000), U16(0x00001331),
+ U16(0x000016c8), U16(0x00001acb), U16(0x00001f40), U16(0x0000242d),
+ U16(0x00002998), U16(0x00002f87), U16(0x00003600), U16(0x00003d09),
+ U16(0x000044a8), U16(0x00004ce3), U16(0x000055c0), U16(0x00005f45),
+ U16(0x00006978), U16(0x0000745f), U16(0x00008000), U16(0x00008c61),
+ U16(0x00009988), U16(0x0000a77b), U16(0x0000b640),
+};
+#elif SIZEOF_BDIGIT_DBL == 4
+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,
+};
+static const uint32_t maxpow32_num[35] = {
+ U32(0x80000000), U32(0xcfd41b91), U32(0x40000000), U32(0x48c27395),
+ U32(0x81bf1000), U32(0x75db9c97), U32(0x40000000), U32(0xcfd41b91),
+ U32(0x3b9aca00), U32(0x8c8b6d2b), U32(0x19a10000), U32(0x309f1021),
+ U32(0x57f6c100), U32(0x98c29b81), U32(0x10000000), U32(0x18754571),
+ U32(0x247dbc80), U32(0x3547667b), U32(0x4c4b4000), U32(0x6b5a6e1d),
+ U32(0x94ace180), U32(0xcaf18367), U32(0x0b640000), U32(0x0e8d4a51),
+ U32(0x1269ae40), U32(0x17179149), U32(0x1cb91000), U32(0x23744899),
+ U32(0x2b73a840), U32(0x34e63b41), U32(0x40000000), U32(0x4cfa3cc1),
+ U32(0x5c13d840), U32(0x6d91b519), U32(0x81bf1000),
+};
+#elif SIZEOF_BDIGIT_DBL == 8 && defined 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,
+ 12,
+};
+static const uint64_t maxpow64_num[35] = {
+ U64(0x80000000,0x00000000), U64(0xa8b8b452,0x291fe821),
+ U64(0x40000000,0x00000000), U64(0x6765c793,0xfa10079d),
+ U64(0x41c21cb8,0xe1000000), U64(0x36427987,0x50226111),
+ U64(0x80000000,0x00000000), U64(0xa8b8b452,0x291fe821),
+ U64(0x8ac72304,0x89e80000), U64(0x4d28cb56,0xc33fa539),
+ U64(0x1eca170c,0x00000000), U64(0x780c7372,0x621bd74d),
+ U64(0x1e39a505,0x7d810000), U64(0x5b27ac99,0x3df97701),
+ U64(0x10000000,0x00000000), U64(0x27b95e99,0x7e21d9f1),
+ U64(0x5da0e1e5,0x3c5c8000), U64(0xd2ae3299,0xc1c4aedb),
+ U64(0x16bcc41e,0x90000000), U64(0x2d04b7fd,0xd9c0ef49),
+ U64(0x5658597b,0xcaa24000), U64(0xa0e20737,0x37609371),
+ U64(0x0c29e980,0x00000000), U64(0x14adf4b7,0x320334b9),
+ U64(0x226ed364,0x78bfa000), U64(0x383d9170,0xb85ff80b),
+ U64(0x5a3c23e3,0x9c000000), U64(0x8e651373,0x88122bcd),
+ U64(0xdd41bb36,0xd259e000), U64(0x0aee5720,0xee830681),
+ U64(0x10000000,0x00000000), U64(0x172588ad,0x4f5f0981),
+ U64(0x211e44f7,0xd02c1000), U64(0x2ee56725,0xf06e5c71),
+ U64(0x41c21cb8,0xe1000000),
+};
+#elif SIZEOF_BDIGIT_DBL == 16 && defined 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,
+ 24,
+};
+static const uint128_t maxpow128_num[35] = {
+ U128(0x80000000,0x00000000,0x00000000,0x00000000),
+ U128(0x6f32f1ef,0x8b18a2bc,0x3cea5978,0x9c79d441),
+ U128(0x40000000,0x00000000,0x00000000,0x00000000),
+ U128(0xd0cf4b50,0xcfe20765,0xfff4b4e3,0xf741cf6d),
+ U128(0x6558e2a0,0x921fe069,0x42860000,0x00000000),
+ U128(0x5080c7b7,0xd0e31ba7,0x5911a67d,0xdd3d35e7),
+ U128(0x40000000,0x00000000,0x00000000,0x00000000),
+ U128(0x6f32f1ef,0x8b18a2bc,0x3cea5978,0x9c79d441),
+ U128(0x4b3b4ca8,0x5a86c47a,0x098a2240,0x00000000),
+ U128(0xffd1390a,0x0adc2fb8,0xdabbb817,0x4d95c99b),
+ U128(0x2c6fdb36,0x4c25e6c0,0x00000000,0x00000000),
+ U128(0x384bacd6,0x42c343b4,0xe90c4272,0x13506d29),
+ U128(0x31f5db32,0xa34aced6,0x0bf13a0e,0x00000000),
+ U128(0x20753ada,0xfd1e839f,0x53686d01,0x3143ee01),
+ U128(0x10000000,0x00000000,0x00000000,0x00000000),
+ U128(0x68ca11d6,0xb4f6d1d1,0xfaa82667,0x8073c2f1),
+ U128(0x223e493b,0xb3bb69ff,0xa4b87d6c,0x40000000),
+ U128(0xad62418d,0x14ea8247,0x01c4b488,0x6cc66f59),
+ U128(0x2863c1f5,0xcdae42f9,0x54000000,0x00000000),
+ U128(0xa63fd833,0xb9386b07,0x36039e82,0xbe651b25),
+ U128(0x1d1f7a9c,0xd087a14d,0x28cdf3d5,0x10000000),
+ U128(0x651b5095,0xc2ea8fc1,0xb30e2c57,0x77aaf7e1),
+ U128(0x0ddef20e,0xff760000,0x00000000,0x00000000),
+ U128(0x29c30f10,0x29939b14,0x6664242d,0x97d9f649),
+ U128(0x786a435a,0xe9558b0e,0x6aaf6d63,0xa8000000),
+ U128(0x0c5afe6f,0xf302bcbf,0x94fd9829,0xd87f5079),
+ U128(0x1fce575c,0xe1692706,0x07100000,0x00000000),
+ U128(0x4f34497c,0x8597e144,0x36e91802,0x00528229),
+ U128(0xbf3a8e1d,0x41ef2170,0x7802130d,0x84000000),
+ U128(0x0e7819e1,0x7f1eb0fb,0x6ee4fb89,0x01d9531f),
+ U128(0x20000000,0x00000000,0x00000000,0x00000000),
+ U128(0x4510460d,0xd9e879c0,0x14a82375,0x2f22b321),
+ U128(0x91abce3c,0x4b4117ad,0xe76d35db,0x22000000),
+ U128(0x08973ea3,0x55d75bc2,0x2e42c391,0x727d69e1),
+ U128(0x10e425c5,0x6daffabc,0x35c10000,0x00000000),
+};
+#endif
+
+static BDIGIT_DBL
+maxpow_in_bdigit_dbl(int base, int *exp_ret)
+{
+ BDIGIT_DBL maxpow;
+ int exponent;
+
+ assert(2 <= base && base <= 36);
+
+ {
+#if SIZEOF_BDIGIT_DBL == 2
+ maxpow = maxpow16_num[base-2];
+ exponent = maxpow16_exp[base-2];
+#elif SIZEOF_BDIGIT_DBL == 4
+ maxpow = maxpow32_num[base-2];
+ exponent = maxpow32_exp[base-2];
+#elif SIZEOF_BDIGIT_DBL == 8 && defined HAVE_UINT64_T
+ maxpow = maxpow64_num[base-2];
+ exponent = maxpow64_exp[base-2];
+#elif SIZEOF_BDIGIT_DBL == 16 && defined HAVE_UINT128_T
+ maxpow = maxpow128_num[base-2];
+ exponent = maxpow128_exp[base-2];
+#else
+ maxpow = base;
+ exponent = 1;
+ while (maxpow <= BDIGIT_DBL_MAX / base) {
+ maxpow *= base;
+ exponent++;
+ }
+#endif
+ }
+
+ *exp_ret = exponent;
+ return maxpow;
+}
+
+static inline BDIGIT_DBL
+bary2bdigitdbl(const BDIGIT *ds, size_t n)
+{
+ assert(n <= 2);
+
+ if (n == 2)
+ return ds[0] | BIGUP(ds[1]);
+ if (n == 1)
+ return ds[0];
+ return 0;
+}
+
+static inline void
+bdigitdbl2bary(BDIGIT *ds, size_t n, BDIGIT_DBL num)
+{
+ assert(n == 2);
+
+ ds[0] = BIGLO(num);
+ ds[1] = (BDIGIT)BIGDN(num);
+}
+
+static int
+bary_cmp(const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn)
+{
+ BARY_TRUNC(xds, xn);
+ BARY_TRUNC(yds, yn);
+
+ if (xn < yn)
+ return -1;
+ if (xn > yn)
+ return 1;
+
+ while (xn-- && xds[xn] == yds[xn])
+ ;
+ if (xn == (size_t)-1)
+ return 0;
+ return xds[xn] < yds[xn] ? -1 : 1;
+}
+
+static BDIGIT
+bary_small_lshift(BDIGIT *zds, const BDIGIT *xds, size_t n, int shift)
+{
+ size_t i;
+ BDIGIT_DBL num = 0;
+ assert(0 <= shift && shift < BITSPERDIG);
+
+ for (i=0; i<n; i++) {
+ num = num | (BDIGIT_DBL)*xds++ << shift;
+ *zds++ = BIGLO(num);
+ num = BIGDN(num);
+ }
+ return BIGLO(num);
+}
+
+static void
+bary_small_rshift(BDIGIT *zds, const BDIGIT *xds, size_t n, int shift, BDIGIT higher_bdigit)
+{
+ BDIGIT_DBL num = 0;
+ BDIGIT x;
+
+ assert(0 <= shift && shift < BITSPERDIG);
+
+ num = BIGUP(higher_bdigit);
+ while (n--) {
+ num = (num | xds[n]) >> shift;
+ x = xds[n];
+ zds[n] = BIGLO(num);
+ num = BIGUP(x);
+ }
+}
+
+static int
+bary_zero_p(BDIGIT *xds, size_t xn)
+{
+ if (xn == 0)
+ return 1;
+ do {
+ if (xds[--xn]) return 0;
+ } while (xn);
+ return 1;
+}
+
+static void
+bary_neg(BDIGIT *ds, size_t n)
+{
+ while (n--)
+ ds[n] = BIGLO(~ds[n]);
+}
+
+static int
+bary_2comp(BDIGIT *ds, size_t n)
+{
+ size_t i;
+ i = 0;
+ for (i = 0; i < n; i++) {
+ if (ds[i] != 0) {
+ goto non_zero;
+ }
+ }
+ return 1;
+
+ non_zero:
+ ds[i] = BIGLO(~ds[i] + 1);
+ i++;
+ for (; i < n; i++) {
+ ds[i] = BIGLO(~ds[i]);
+ }
+ return 0;
+}
+
+static void
+bary_swap(BDIGIT *ds, size_t num_bdigits)
+{
+ BDIGIT *p1 = ds;
+ BDIGIT *p2 = ds + num_bdigits - 1;
+ for (; p1 < p2; p1++, p2--) {
+ BDIGIT tmp = *p1;
+ *p1 = *p2;
+ *p2 = tmp;
+ }
+}
+
+#define INTEGER_PACK_WORDORDER_MASK \
+ (INTEGER_PACK_MSWORD_FIRST | \
+ INTEGER_PACK_LSWORD_FIRST)
+#define INTEGER_PACK_BYTEORDER_MASK \
+ (INTEGER_PACK_MSBYTE_FIRST | \
+ INTEGER_PACK_LSBYTE_FIRST | \
+ INTEGER_PACK_NATIVE_BYTE_ORDER)
+
+static void
+validate_integer_pack_format(size_t numwords, size_t wordsize, size_t nails, int flags, int supported_flags)
+{
+ int wordorder_bits = flags & INTEGER_PACK_WORDORDER_MASK;
+ int byteorder_bits = flags & INTEGER_PACK_BYTEORDER_MASK;
+
+ if (flags & ~supported_flags) {
+ rb_raise(rb_eArgError, "unsupported flags specified");
+ }
+ if (wordorder_bits == 0) {
+ if (1 < numwords)
+ rb_raise(rb_eArgError, "word order not specified");
+ }
+ else if (wordorder_bits != INTEGER_PACK_MSWORD_FIRST &&
+ wordorder_bits != INTEGER_PACK_LSWORD_FIRST)
+ rb_raise(rb_eArgError, "unexpected word order");
+ if (byteorder_bits == 0) {
+ rb_raise(rb_eArgError, "byte order not specified");
+ }
+ else if (byteorder_bits != INTEGER_PACK_MSBYTE_FIRST &&
+ byteorder_bits != INTEGER_PACK_LSBYTE_FIRST &&
+ byteorder_bits != INTEGER_PACK_NATIVE_BYTE_ORDER)
+ rb_raise(rb_eArgError, "unexpected byte order");
+ if (wordsize == 0)
+ rb_raise(rb_eArgError, "invalid wordsize: %"PRI_SIZE_PREFIX"u", wordsize);
+ if (SSIZE_MAX < wordsize)
+ rb_raise(rb_eArgError, "too big wordsize: %"PRI_SIZE_PREFIX"u", wordsize);
+ if (wordsize <= nails / CHAR_BIT)
+ rb_raise(rb_eArgError, "too big nails: %"PRI_SIZE_PREFIX"u", nails);
+ if (SIZE_MAX / wordsize < numwords)
+ rb_raise(rb_eArgError, "too big numwords * wordsize: %"PRI_SIZE_PREFIX"u * %"PRI_SIZE_PREFIX"u", numwords, wordsize);
+}
+
+static void
+integer_pack_loop_setup(
+ size_t numwords, size_t wordsize, size_t nails, int flags,
+ size_t *word_num_fullbytes_ret,
+ int *word_num_partialbits_ret,
+ size_t *word_start_ret,
+ ssize_t *word_step_ret,
+ size_t *word_last_ret,
+ size_t *byte_start_ret,
+ int *byte_step_ret)
+{
+ int wordorder_bits = flags & INTEGER_PACK_WORDORDER_MASK;
+ int byteorder_bits = flags & INTEGER_PACK_BYTEORDER_MASK;
+ size_t word_num_fullbytes;
+ int word_num_partialbits;
+ size_t word_start;
+ ssize_t word_step;
+ size_t word_last;
+ size_t byte_start;
+ int byte_step;
+
+ word_num_partialbits = CHAR_BIT - (int)(nails % CHAR_BIT);
+ if (word_num_partialbits == CHAR_BIT)
+ word_num_partialbits = 0;
+ word_num_fullbytes = wordsize - (nails / CHAR_BIT);
+ if (word_num_partialbits != 0) {
+ word_num_fullbytes--;
+ }
+
+ if (wordorder_bits == INTEGER_PACK_MSWORD_FIRST) {
+ word_start = wordsize*(numwords-1);
+ word_step = -(ssize_t)wordsize;
+ word_last = 0;
+ }
+ else {
+ word_start = 0;
+ word_step = wordsize;
+ word_last = wordsize*(numwords-1);
+ }
+
+ if (byteorder_bits == INTEGER_PACK_NATIVE_BYTE_ORDER) {
+#ifdef WORDS_BIGENDIAN
+ byteorder_bits = INTEGER_PACK_MSBYTE_FIRST;
+#else
+ byteorder_bits = INTEGER_PACK_LSBYTE_FIRST;
+#endif
+ }
+ if (byteorder_bits == INTEGER_PACK_MSBYTE_FIRST) {
+ byte_start = wordsize-1;
+ byte_step = -1;
+ }
+ else {
+ byte_start = 0;
+ byte_step = 1;
+ }
+
+ *word_num_partialbits_ret = word_num_partialbits;
+ *word_num_fullbytes_ret = word_num_fullbytes;
+ *word_start_ret = word_start;
+ *word_step_ret = word_step;
+ *word_last_ret = word_last;
+ *byte_start_ret = byte_start;
+ *byte_step_ret = byte_step;
+}
+
+static inline void
+integer_pack_fill_dd(BDIGIT **dpp, BDIGIT **dep, BDIGIT_DBL *ddp, int *numbits_in_dd_p)
+{
+ if (*dpp < *dep && BITSPERDIG <= (int)sizeof(*ddp) * CHAR_BIT - *numbits_in_dd_p) {
+ *ddp |= (BDIGIT_DBL)(*(*dpp)++) << *numbits_in_dd_p;
+ *numbits_in_dd_p += BITSPERDIG;
+ }
+ else if (*dpp == *dep) {
+ /* higher bits are infinity zeros */
+ *numbits_in_dd_p = (int)sizeof(*ddp) * CHAR_BIT;
+ }
+}
+
+static inline BDIGIT_DBL
+integer_pack_take_lowbits(int n, BDIGIT_DBL *ddp, int *numbits_in_dd_p)
+{
+ BDIGIT_DBL ret;
+ ret = (*ddp) & (((BDIGIT_DBL)1 << n) - 1);
+ *ddp >>= n;
+ *numbits_in_dd_p -= n;
+ return ret;
+}
+
+#if !defined(WORDS_BIGENDIAN)
+static int
+bytes_2comp(unsigned char *buf, size_t len)
+{
+ size_t i;
+ for (i = 0; i < len; i++)
+ buf[i] = ~buf[i];
+ for (i = 0; i < len; i++) {
+ buf[i]++;
+ if (buf[i] != 0)
+ return 0;
+ }
+ return 1;
+}
+#endif
+
+static int
+bary_pack(int sign, BDIGIT *ds, size_t num_bdigits, void *words, size_t numwords, size_t wordsize, size_t nails, int flags)
+{
+ BDIGIT *dp, *de;
+ unsigned char *buf, *bufend;
+
+ dp = ds;
+ de = ds + num_bdigits;
+
+ validate_integer_pack_format(numwords, wordsize, nails, flags,
+ INTEGER_PACK_MSWORD_FIRST|
+ INTEGER_PACK_LSWORD_FIRST|
+ INTEGER_PACK_MSBYTE_FIRST|
+ INTEGER_PACK_LSBYTE_FIRST|
+ INTEGER_PACK_NATIVE_BYTE_ORDER|
+ INTEGER_PACK_2COMP|
+ INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION);
+
+ while (dp < de && de[-1] == 0)
+ de--;
+ if (dp == de) {
+ sign = 0;
+ }
+
+ if (!(flags & INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION)) {
+ if (sign == 0) {
+ MEMZERO(words, unsigned char, numwords * wordsize);
+ return 0;
+ }
+ if (nails == 0 && numwords == 1) {
+ int need_swap = wordsize != 1 &&
+ (flags & INTEGER_PACK_BYTEORDER_MASK) != INTEGER_PACK_NATIVE_BYTE_ORDER &&
+ ((flags & INTEGER_PACK_MSBYTE_FIRST) ? !HOST_BIGENDIAN_P : HOST_BIGENDIAN_P);
+ if (0 < sign || !(flags & INTEGER_PACK_2COMP)) {
+ BDIGIT d;
+ if (wordsize == 1) {
+ *((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 (wordsize == 2 && (uintptr_t)words % ALIGNOF(uint16_t) == 0) {
+ uint16_t u = (uint16_t)(d = dp[0]);
+ if (need_swap) u = swap16(u);
+ *((uint16_t *)words) = u;
+ return ((1 < de - dp || CLEAR_LOWBITS(d, 16) != 0) ? 2 : 1) * sign;
+ }
+#endif
+#if defined(HAVE_UINT32_T) && 4 <= SIZEOF_BDIGIT
+ if (wordsize == 4 && (uintptr_t)words % ALIGNOF(uint32_t) == 0) {
+ uint32_t u = (uint32_t)(d = dp[0]);
+ if (need_swap) u = swap32(u);
+ *((uint32_t *)words) = u;
+ return ((1 < de - dp || CLEAR_LOWBITS(d, 32) != 0) ? 2 : 1) * sign;
+ }
+#endif
+#if defined(HAVE_UINT64_T) && 8 <= SIZEOF_BDIGIT
+ if (wordsize == 8 && (uintptr_t)words % ALIGNOF(uint64_t) == 0) {
+ uint64_t u = (uint64_t)(d = dp[0]);
+ if (need_swap) u = swap64(u);
+ *((uint64_t *)words) = u;
+ return ((1 < de - dp || CLEAR_LOWBITS(d, 64) != 0) ? 2 : 1) * sign;
+ }
+#endif
+ }
+ else { /* sign < 0 && (flags & INTEGER_PACK_2COMP) */
+ BDIGIT_DBL_SIGNED d;
+ if (wordsize == 1) {
+ *((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 (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 :
+ (1 < de - dp || FILL_LOWBITS(d, 16) != -1) ? -2 : -1;
+ }
+#endif
+#if defined(HAVE_UINT32_T) && 4 <= SIZEOF_BDIGIT
+ 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 :
+ (1 < de - dp || FILL_LOWBITS(d, 32) != -1) ? -2 : -1;
+ }
+#endif
+#if defined(HAVE_UINT64_T) && 8 <= SIZEOF_BDIGIT
+ 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 :
+ (1 < de - dp || FILL_LOWBITS(d, 64) != -1) ? -2 : -1;
+ }
+#endif
+ }
+ }
+#if !defined(WORDS_BIGENDIAN)
+ if (nails == 0 && SIZEOF_BDIGIT == 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 dst_size = numwords * wordsize;
+ int overflow = 0;
+ while (0 < src_size && ((unsigned char *)ds)[src_size-1] == 0)
+ src_size--;
+ if (src_size <= dst_size) {
+ MEMCPY(words, dp, char, src_size);
+ MEMZERO((char*)words + src_size, char, dst_size - src_size);
+ }
+ else {
+ MEMCPY(words, dp, char, dst_size);
+ overflow = 1;
+ }
+ if (sign < 0 && (flags & INTEGER_PACK_2COMP)) {
+ int zero_p = bytes_2comp(words, dst_size);
+ if (zero_p && overflow) {
+ unsigned char *p = (unsigned char *)dp;
+ if (dst_size == src_size-1 &&
+ p[dst_size] == 1) {
+ overflow = 0;
+ }
+ }
+ }
+ if (overflow)
+ sign *= 2;
+ 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;
+ size_t src_num_bdigits = de - dp;
+ size_t dst_num_bdigits = numwords * bdigits_per_word;
+ int overflow = 0;
+ 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;
+ if (src_num_bdigits <= dst_num_bdigits) {
+ MEMCPY(words, dp, BDIGIT, src_num_bdigits);
+ BDIGITS_ZERO((BDIGIT*)words + src_num_bdigits, dst_num_bdigits - src_num_bdigits);
+ }
+ else {
+ MEMCPY(words, dp, BDIGIT, dst_num_bdigits);
+ overflow = 1;
+ }
+ if (sign < 0 && (flags & INTEGER_PACK_2COMP)) {
+ int zero_p = bary_2comp(words, dst_num_bdigits);
+ if (zero_p && overflow &&
+ dst_num_bdigits == src_num_bdigits-1 &&
+ dp[dst_num_bdigits] == 1)
+ overflow = 0;
+ }
+ if (msbytefirst_p != HOST_BIGENDIAN_P) {
+ size_t i;
+ for (i = 0; i < dst_num_bdigits; i++) {
+ BDIGIT d = ((BDIGIT*)words)[i];
+ ((BDIGIT*)words)[i] = swap_bdigit(d);
+ }
+ }
+ if (mswordfirst_p ? !msbytefirst_p : msbytefirst_p) {
+ size_t i;
+ BDIGIT *p = words;
+ for (i = 0; i < numwords; i++) {
+ bary_swap(p, bdigits_per_word);
+ p += bdigits_per_word;
+ }
+ }
+ if (mswordfirst_p) {
+ bary_swap(words, dst_num_bdigits);
+ }
+ if (overflow)
+ sign *= 2;
+ return sign;
+ }
+ }
+
+ buf = words;
+ bufend = buf + numwords * wordsize;
+
+ if (buf == bufend) {
+ /* overflow if non-zero*/
+ if (!(flags & INTEGER_PACK_2COMP) || 0 <= sign)
+ sign *= 2;
+ else {
+ if (de - dp == 1 && dp[0] == 1)
+ sign = -1; /* val == -1 == -2**(numwords*(wordsize*CHAR_BIT-nails)) */
+ else
+ sign = -2; /* val < -1 == -2**(numwords*(wordsize*CHAR_BIT-nails)) */
+ }
+ }
+ else if (dp == de) {
+ memset(buf, '\0', bufend - buf);
+ }
+ else if (dp < de && buf < bufend) {
+ int word_num_partialbits;
+ size_t word_num_fullbytes;
+
+ ssize_t word_step;
+ size_t byte_start;
+ int byte_step;
+
+ size_t word_start, word_last;
+ unsigned char *wordp, *last_wordp;
+ BDIGIT_DBL dd;
+ int numbits_in_dd;
+
+ integer_pack_loop_setup(numwords, wordsize, nails, flags,
+ &word_num_fullbytes, &word_num_partialbits,
+ &word_start, &word_step, &word_last, &byte_start, &byte_step);
+
+ wordp = buf + word_start;
+ last_wordp = buf + word_last;
+
+ dd = 0;
+ numbits_in_dd = 0;
+
+#define FILL_DD \
+ integer_pack_fill_dd(&dp, &de, &dd, &numbits_in_dd)
+#define TAKE_LOWBITS(n) \
+ integer_pack_take_lowbits(n, &dd, &numbits_in_dd)
+
+ while (1) {
+ size_t index_in_word = 0;
+ unsigned char *bytep = wordp + byte_start;
+ while (index_in_word < word_num_fullbytes) {
+ FILL_DD;
+ *bytep = TAKE_LOWBITS(CHAR_BIT);
+ bytep += byte_step;
+ index_in_word++;
+ }
+ if (word_num_partialbits) {
+ FILL_DD;
+ *bytep = TAKE_LOWBITS(word_num_partialbits);
+ bytep += byte_step;
+ index_in_word++;
+ }
+ while (index_in_word < wordsize) {
+ *bytep = 0;
+ bytep += byte_step;
+ index_in_word++;
+ }
+
+ if (wordp == last_wordp)
+ break;
+
+ wordp += word_step;
+ }
+ FILL_DD;
+ /* overflow tests */
+ if (dp != de || 1 < dd) {
+ /* 2**(numwords*(wordsize*CHAR_BIT-nails)+1) <= abs(val) */
+ sign *= 2;
+ }
+ else if (dd == 1) {
+ /* 2**(numwords*(wordsize*CHAR_BIT-nails)) <= abs(val) < 2**(numwords*(wordsize*CHAR_BIT-nails)+1) */
+ if (!(flags & INTEGER_PACK_2COMP) || 0 <= sign)
+ sign *= 2;
+ else { /* overflow_2comp && sign == -1 */
+ /* test lower bits are all zero. */
+ dp = ds;
+ while (dp < de && *dp == 0)
+ dp++;
+ if (de - dp == 1 && /* only one non-zero word. */
+ POW2_P(*dp)) /* *dp contains only one bit set. */
+ sign = -1; /* val == -2**(numwords*(wordsize*CHAR_BIT-nails)) */
+ else
+ sign = -2; /* val < -2**(numwords*(wordsize*CHAR_BIT-nails)) */
+ }
+ }
+ }
+
+ if ((flags & INTEGER_PACK_2COMP) && (sign < 0 && numwords != 0)) {
+ unsigned char *buf;
+
+ int word_num_partialbits;
+ size_t word_num_fullbytes;
+
+ ssize_t word_step;
+ size_t byte_start;
+ int byte_step;
+
+ size_t word_start, word_last;
+ unsigned char *wordp, *last_wordp;
+
+ unsigned int partialbits_mask;
+ int carry;
+
+ integer_pack_loop_setup(numwords, wordsize, nails, flags,
+ &word_num_fullbytes, &word_num_partialbits,
+ &word_start, &word_step, &word_last, &byte_start, &byte_step);
+
+ partialbits_mask = (1 << word_num_partialbits) - 1;
+
+ buf = words;
+ wordp = buf + word_start;
+ last_wordp = buf + word_last;
+
+ carry = 1;
+ while (1) {
+ size_t index_in_word = 0;
+ unsigned char *bytep = wordp + byte_start;
+ while (index_in_word < word_num_fullbytes) {
+ carry += (unsigned char)~*bytep;
+ *bytep = (unsigned char)carry;
+ carry >>= CHAR_BIT;
+ bytep += byte_step;
+ index_in_word++;
+ }
+ if (word_num_partialbits) {
+ carry += (*bytep & partialbits_mask) ^ partialbits_mask;
+ *bytep = carry & partialbits_mask;
+ carry >>= word_num_partialbits;
+ bytep += byte_step;
+ index_in_word++;
+ }
+
+ if (wordp == last_wordp)
+ break;
+
+ wordp += word_step;
+ }
+ }
+
+ return sign;
+#undef FILL_DD
+#undef TAKE_LOWBITS
+}
+
+static size_t
+integer_unpack_num_bdigits_small(size_t numwords, size_t wordsize, size_t nails, int *nlp_bits_ret)
+{
+ /* nlp_bits stands for number of leading padding bits */
+ size_t num_bits = (wordsize * CHAR_BIT - nails) * numwords;
+ size_t num_bdigits = (num_bits + BITSPERDIG - 1) / BITSPERDIG;
+ *nlp_bits_ret = (int)(num_bdigits * BITSPERDIG - num_bits);
+ return num_bdigits;
+}
+
+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 */
+ /* num_bits = (wordsize * CHAR_BIT - nails) * numwords */
+ /* num_bdigits = (num_bits + BITSPERDIG - 1) / BITSPERDIG */
+
+ /* num_bits = CHAR_BIT * (wordsize * numwords) - nails * numwords = CHAR_BIT * num_bytes1 - nails * numwords */
+ size_t num_bytes1 = wordsize * numwords;
+
+ /* q1 * CHAR_BIT + r1 = numwords */
+ size_t q1 = numwords / CHAR_BIT;
+ size_t r1 = numwords % CHAR_BIT;
+
+ /* num_bits = CHAR_BIT * num_bytes1 - nails * (q1 * CHAR_BIT + r1) = CHAR_BIT * num_bytes2 - nails * r1 */
+ size_t num_bytes2 = num_bytes1 - nails * q1;
+
+ /* q2 * CHAR_BIT + r2 = nails */
+ size_t q2 = nails / CHAR_BIT;
+ size_t r2 = nails % CHAR_BIT;
+
+ /* num_bits = CHAR_BIT * num_bytes2 - (q2 * CHAR_BIT + r2) * r1 = CHAR_BIT * num_bytes3 - r1 * r2 */
+ size_t num_bytes3 = num_bytes2 - q2 * r1;
+
+ /* q3 * BITSPERDIG + r3 = num_bytes3 */
+ size_t q3 = num_bytes3 / BITSPERDIG;
+ size_t r3 = num_bytes3 % BITSPERDIG;
+
+ /* num_bits = CHAR_BIT * (q3 * BITSPERDIG + r3) - r1 * r2 = BITSPERDIG * num_digits1 + CHAR_BIT * r3 - r1 * r2 */
+ size_t num_digits1 = CHAR_BIT * q3;
+
+ /*
+ * if CHAR_BIT * r3 >= r1 * r2
+ * CHAR_BIT * r3 - r1 * r2 = CHAR_BIT * BITSPERDIG - (CHAR_BIT * BITSPERDIG - (CHAR_BIT * r3 - r1 * r2))
+ * q4 * BITSPERDIG + r4 = CHAR_BIT * BITSPERDIG - (CHAR_BIT * r3 - r1 * r2)
+ * num_bits = BITSPERDIG * num_digits1 + CHAR_BIT * BITSPERDIG - (q4 * BITSPERDIG + r4) = BITSPERDIG * num_digits2 - r4
+ * else
+ * q4 * BITSPERDIG + r4 = -(CHAR_BIT * r3 - r1 * r2)
+ * num_bits = BITSPERDIG * num_digits1 - (q4 * BITSPERDIG + r4) = BITSPERDIG * num_digits2 - r4
+ * end
+ */
+
+ if (CHAR_BIT * r3 >= r1 * r2) {
+ size_t tmp1 = CHAR_BIT * BITSPERDIG - (CHAR_BIT * r3 - r1 * r2);
+ size_t q4 = tmp1 / BITSPERDIG;
+ int r4 = (int)(tmp1 % BITSPERDIG);
+ size_t num_digits2 = num_digits1 + CHAR_BIT - q4;
+ *nlp_bits_ret = r4;
+ return num_digits2;
+ }
+ else {
+ size_t tmp1 = r1 * r2 - CHAR_BIT * r3;
+ size_t q4 = tmp1 / BITSPERDIG;
+ int r4 = (int)(tmp1 % BITSPERDIG);
+ size_t num_digits2 = num_digits1 - q4;
+ *nlp_bits_ret = r4;
+ return num_digits2;
+ }
+}
+
+static size_t
+integer_unpack_num_bdigits(size_t numwords, size_t wordsize, size_t nails, int *nlp_bits_ret)
+{
+ size_t num_bdigits;
+
+ if (numwords <= (SIZE_MAX - (BITSPERDIG-1)) / CHAR_BIT / wordsize) {
+ num_bdigits = integer_unpack_num_bdigits_small(numwords, wordsize, nails, nlp_bits_ret);
+#ifdef DEBUG_INTEGER_PACK
+ {
+ int nlp_bits1;
+ size_t num_bdigits1 = integer_unpack_num_bdigits_generic(numwords, wordsize, nails, &nlp_bits1);
+ assert(num_bdigits == num_bdigits1);
+ assert(*nlp_bits_ret == nlp_bits1);
+ }
+#endif
+ }
+ else {
+ num_bdigits = integer_unpack_num_bdigits_generic(numwords, wordsize, nails, nlp_bits_ret);
+ }
+ return num_bdigits;
+}
+
+static inline void
+integer_unpack_push_bits(int data, int numbits, BDIGIT_DBL *ddp, int *numbits_in_dd_p, BDIGIT **dpp)
+{
+ (*ddp) |= ((BDIGIT_DBL)data) << (*numbits_in_dd_p);
+ *numbits_in_dd_p += numbits;
+ while (BITSPERDIG <= *numbits_in_dd_p) {
+ *(*dpp)++ = BIGLO(*ddp);
+ *ddp = BIGDN(*ddp);
+ *numbits_in_dd_p -= BITSPERDIG;
+ }
+}
+
+static int
+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) :
+ ((u >> (size * CHAR_BIT - 1)) ? -1 : 1);
+ if (sign < 0) {
+ u |= LSHIFTX(BDIGMAX, size * CHAR_BIT);
+ u = BIGLO(1 + ~u);
+ }
+ }
+ else
+ sign = (flags & INTEGER_PACK_NEGATIVE) ? -1 : 1;
+ *dp = u;
+ return sign;
+}
+
+static int
+bary_unpack_internal(BDIGIT *bdigits, size_t num_bdigits, const void *words, size_t numwords, size_t wordsize, size_t nails, int flags, int nlp_bits)
+{
+ int sign;
+ const unsigned char *buf = words;
+ BDIGIT *dp;
+ BDIGIT *de;
+
+ dp = bdigits;
+ de = dp + num_bdigits;
+
+ if (!(flags & INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION)) {
+ if (nails == 0 && numwords == 1) {
+ int need_swap = wordsize != 1 &&
+ (flags & INTEGER_PACK_BYTEORDER_MASK) != INTEGER_PACK_NATIVE_BYTE_ORDER &&
+ ((flags & INTEGER_PACK_MSBYTE_FIRST) ? !HOST_BIGENDIAN_P : HOST_BIGENDIAN_P);
+ 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 (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 (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 (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);
+ }
+#endif
+ }
+#if !defined(WORDS_BIGENDIAN)
+ if (nails == 0 && SIZEOF_BDIGIT == 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;
+ MEMCPY(dp, words, char, src_size);
+ if (flags & INTEGER_PACK_2COMP) {
+ if (flags & INTEGER_PACK_NEGATIVE) {
+ int zero_p;
+ memset((char*)dp + src_size, 0xff, dst_size - src_size);
+ zero_p = bary_2comp(dp, num_bdigits);
+ sign = zero_p ? -2 : -1;
+ }
+ else if (buf[src_size-1] >> (CHAR_BIT-1)) {
+ memset((char*)dp + src_size, 0xff, dst_size - src_size);
+ bary_2comp(dp, num_bdigits);
+ sign = -1;
+ }
+ else {
+ MEMZERO((char*)dp + src_size, char, dst_size - src_size);
+ sign = 1;
+ }
+ }
+ else {
+ MEMZERO((char*)dp + src_size, char, dst_size - src_size);
+ sign = (flags & INTEGER_PACK_NEGATIVE) ? -1 : 1;
+ }
+ return sign;
+ }
+#endif
+ if (nails == 0 && SIZEOF_BDIGIT == sizeof(BDIGIT) &&
+ wordsize % SIZEOF_BDIGIT == 0) {
+ size_t bdigits_per_word = wordsize / SIZEOF_BDIGIT;
+ 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;
+ MEMCPY(dp, words, BDIGIT, numwords*bdigits_per_word);
+ if (mswordfirst_p) {
+ bary_swap(dp, num_bdigits);
+ }
+ if (mswordfirst_p ? !msbytefirst_p : msbytefirst_p) {
+ size_t i;
+ BDIGIT *p = dp;
+ for (i = 0; i < numwords; i++) {
+ bary_swap(p, bdigits_per_word);
+ p += bdigits_per_word;
+ }
+ }
+ if (msbytefirst_p != HOST_BIGENDIAN_P) {
+ BDIGIT *p;
+ for (p = dp; p < de; p++) {
+ BDIGIT d = *p;
+ *p = swap_bdigit(d);
+ }
+ }
+ if (flags & INTEGER_PACK_2COMP) {
+ if (flags & INTEGER_PACK_NEGATIVE) {
+ int zero_p = bary_2comp(dp, num_bdigits);
+ sign = zero_p ? -2 : -1;
+ }
+ else if (BDIGIT_MSB(de[-1])) {
+ bary_2comp(dp, num_bdigits);
+ sign = -1;
+ }
+ else {
+ sign = 1;
+ }
+ }
+ else {
+ sign = (flags & INTEGER_PACK_NEGATIVE) ? -1 : 1;
+ }
+ return sign;
+ }
+ }
+
+ if (num_bdigits != 0) {
+ int word_num_partialbits;
+ size_t word_num_fullbytes;
+
+ ssize_t word_step;
+ size_t byte_start;
+ int byte_step;
+
+ size_t word_start, word_last;
+ const unsigned char *wordp, *last_wordp;
+ BDIGIT_DBL dd;
+ int numbits_in_dd;
+
+ integer_pack_loop_setup(numwords, wordsize, nails, flags,
+ &word_num_fullbytes, &word_num_partialbits,
+ &word_start, &word_step, &word_last, &byte_start, &byte_step);
+
+ wordp = buf + word_start;
+ last_wordp = buf + word_last;
+
+ dd = 0;
+ numbits_in_dd = 0;
+
+#define PUSH_BITS(data, numbits) \
+ integer_unpack_push_bits(data, numbits, &dd, &numbits_in_dd, &dp)
+
+ while (1) {
+ size_t index_in_word = 0;
+ const unsigned char *bytep = wordp + byte_start;
+ while (index_in_word < word_num_fullbytes) {
+ PUSH_BITS(*bytep, CHAR_BIT);
+ bytep += byte_step;
+ index_in_word++;
+ }
+ if (word_num_partialbits) {
+ PUSH_BITS(*bytep & ((1 << word_num_partialbits) - 1), word_num_partialbits);
+ bytep += byte_step;
+ index_in_word++;
+ }
+
+ if (wordp == last_wordp)
+ break;
+
+ wordp += word_step;
+ }
+ if (dd)
+ *dp++ = (BDIGIT)dd;
+ assert(dp <= de);
+ while (dp < de)
+ *dp++ = 0;
+#undef PUSH_BITS
+ }
+
+ if (!(flags & INTEGER_PACK_2COMP)) {
+ sign = (flags & INTEGER_PACK_NEGATIVE) ? -1 : 1;
+ }
+ else {
+ if (nlp_bits) {
+ if ((flags & INTEGER_PACK_NEGATIVE) ||
+ (bdigits[num_bdigits-1] >> (BITSPERDIG - nlp_bits - 1))) {
+ bdigits[num_bdigits-1] |= BIGLO(BDIGMAX << (BITSPERDIG - nlp_bits));
+ sign = -1;
+ }
+ else {
+ sign = 1;
+ }
+ }
+ else {
+ if (flags & INTEGER_PACK_NEGATIVE) {
+ sign = bary_zero_p(bdigits, num_bdigits) ? -2 : -1;
+ }
+ else {
+ if (num_bdigits != 0 && BDIGIT_MSB(bdigits[num_bdigits-1]))
+ sign = -1;
+ else
+ sign = 1;
+ }
+ }
+ if (sign == -1 && num_bdigits != 0) {
+ bary_2comp(bdigits, num_bdigits);
+ }
+ }
+
+ return sign;
+}
+
+static void
+bary_unpack(BDIGIT *bdigits, size_t num_bdigits, const void *words, size_t numwords, size_t wordsize, size_t nails, int flags)
+{
+ size_t num_bdigits0;
+ int nlp_bits;
+ int sign;
+
+ validate_integer_pack_format(numwords, wordsize, nails, flags,
+ INTEGER_PACK_MSWORD_FIRST|
+ INTEGER_PACK_LSWORD_FIRST|
+ INTEGER_PACK_MSBYTE_FIRST|
+ INTEGER_PACK_LSBYTE_FIRST|
+ INTEGER_PACK_NATIVE_BYTE_ORDER|
+ INTEGER_PACK_2COMP|
+ INTEGER_PACK_FORCE_BIGNUM|
+ INTEGER_PACK_NEGATIVE|
+ INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION);
+
+ num_bdigits0 = integer_unpack_num_bdigits(numwords, wordsize, nails, &nlp_bits);
+
+ assert(num_bdigits0 <= num_bdigits);
+
+ sign = bary_unpack_internal(bdigits, num_bdigits0, words, numwords, wordsize, nails, flags, nlp_bits);
+
+ if (num_bdigits0 < num_bdigits) {
+ BDIGITS_ZERO(bdigits + num_bdigits0, num_bdigits - num_bdigits0);
+ if (sign == -2) {
+ bdigits[num_bdigits0] = 1;
+ }
+ }
+}
+
+static int
+bary_subb(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn, int borrow)
+{
+ BDIGIT_DBL_SIGNED num;
+ size_t i;
+ size_t sn;
+
+ assert(xn <= zn);
+ assert(yn <= zn);
+
+ sn = xn < yn ? xn : yn;
+
+ num = borrow ? -1 : 0;
+ for (i = 0; i < sn; i++) {
+ num += (BDIGIT_DBL_SIGNED)xds[i] - yds[i];
+ zds[i] = BIGLO(num);
+ num = BIGDN(num);
+ }
+ if (yn <= xn) {
+ for (; i < xn; i++) {
+ if (num == 0) goto num_is_zero;
+ num += xds[i];
+ zds[i] = BIGLO(num);
+ num = BIGDN(num);
+ }
+ }
+ else {
+ for (; i < yn; i++) {
+ num -= yds[i];
+ zds[i] = BIGLO(num);
+ num = BIGDN(num);
+ }
+ }
+ if (num == 0) goto num_is_zero;
+ for (; i < zn; i++) {
+ zds[i] = BDIGMAX;
+ }
+ return 1;
+
+ num_is_zero:
+ if (xds == zds && xn == zn)
+ return 0;
+ for (; i < xn; i++) {
+ zds[i] = xds[i];
+ }
+ for (; i < zn; i++) {
+ zds[i] = 0;
+ }
+ return 0;
+}
+
+static int
+bary_sub(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn)
+{
+ return bary_subb(zds, zn, xds, xn, yds, yn, 0);
+}
+
+static int
+bary_sub_one(BDIGIT *zds, size_t zn)
+{
+ return bary_subb(zds, zn, zds, zn, NULL, 0, 1);
+}
+
+static int
+bary_addc(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn, int carry)
+{
+ BDIGIT_DBL num;
+ size_t i;
+
+ assert(xn <= zn);
+ assert(yn <= zn);
+
+ if (xn > yn) {
+ const BDIGIT *tds;
+ tds = xds; xds = yds; yds = tds;
+ i = xn; xn = yn; yn = i;
+ }
+
+ num = carry ? 1 : 0;
+ for (i = 0; i < xn; i++) {
+ num += (BDIGIT_DBL)xds[i] + yds[i];
+ zds[i] = BIGLO(num);
+ num = BIGDN(num);
+ }
+ for (; i < yn; i++) {
+ if (num == 0) goto num_is_zero;
+ num += yds[i];
+ zds[i] = BIGLO(num);
+ num = BIGDN(num);
+ }
+ for (; i < zn; i++) {
+ if (num == 0) goto num_is_zero;
+ zds[i] = BIGLO(num);
+ num = BIGDN(num);
+ }
+ return num != 0;
+
+ num_is_zero:
+ if (yds == zds && yn == zn)
+ return 0;
+ for (; i < yn; i++) {
+ zds[i] = yds[i];
+ }
+ for (; i < zn; i++) {
+ zds[i] = 0;
+ }
+ return 0;
+}
+
+static int
+bary_add(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn)
+{
+ return bary_addc(zds, zn, xds, xn, yds, yn, 0);
+}
+
+static int
+bary_add_one(BDIGIT *ds, size_t n)
+{
+ size_t i;
+ for (i = 0; i < n; i++) {
+ ds[i] = BIGLO(ds[i]+1);
+ if (ds[i] != 0)
+ return 0;
+ }
+ return 1;
+}
+
+static void
+bary_mul_single(BDIGIT *zds, size_t zn, BDIGIT x, BDIGIT y)
+{
+ BDIGIT_DBL n;
+
+ assert(2 <= zn);
+
+ n = (BDIGIT_DBL)x * y;
+ bdigitdbl2bary(zds, 2, n);
+ BDIGITS_ZERO(zds + 2, zn - 2);
+}
+
+static int
+bary_muladd_1xN(BDIGIT *zds, size_t zn, BDIGIT x, const BDIGIT *yds, size_t yn)
+{
+ BDIGIT_DBL n;
+ BDIGIT_DBL dd;
+ size_t j;
+
+ assert(zn > yn);
+
+ if (x == 0)
+ return 0;
+ dd = x;
+ n = 0;
+ for (j = 0; j < yn; j++) {
+ BDIGIT_DBL ee = n + dd * yds[j];
+ if (ee) {
+ n = zds[j] + ee;
+ zds[j] = BIGLO(n);
+ n = BIGDN(n);
+ }
+ else {
+ n = 0;
+ }
+
+ }
+ for (; j < zn; j++) {
+ if (n == 0)
+ break;
+ n += zds[j];
+ zds[j] = BIGLO(n);
+ n = BIGDN(n);
+ }
+ return n != 0;
+}
+
+static BDIGIT_DBL_SIGNED
+bigdivrem_mulsub(BDIGIT *zds, size_t zn, BDIGIT x, const BDIGIT *yds, size_t yn)
+{
+ size_t i;
+ BDIGIT_DBL t2;
+ BDIGIT_DBL_SIGNED num;
+
+ assert(zn == yn + 1);
+
+ num = 0;
+ t2 = 0;
+ i = 0;
+
+ do {
+ BDIGIT_DBL ee;
+ t2 += (BDIGIT_DBL)yds[i] * x;
+ ee = num - BIGLO(t2);
+ num = (BDIGIT_DBL)zds[i] + ee;
+ if (ee) zds[i] = BIGLO(num);
+ num = BIGDN(num);
+ t2 = BIGDN(t2);
+ } while (++i < yn);
+ num += zds[i] - t2; /* borrow from high digit; don't update */
+ return num;
+}
+
+static int
+bary_mulsub_1xN(BDIGIT *zds, size_t zn, BDIGIT x, const BDIGIT *yds, size_t yn)
+{
+ BDIGIT_DBL_SIGNED num;
+
+ assert(zn == yn + 1);
+
+ num = bigdivrem_mulsub(zds, zn, x, yds, yn);
+ zds[yn] = BIGLO(num);
+ if (BIGDN(num))
+ return 1;
+ return 0;
+}
+
+static void
+bary_mul_normal(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn)
+{
+ size_t i;
+
+ assert(xn + yn <= zn);
+
+ BDIGITS_ZERO(zds, zn);
+ for (i = 0; i < xn; i++) {
+ bary_muladd_1xN(zds+i, zn-i, xds[i], yds, yn);
+ }
+}
+
+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));
+ bary_mul_normal(BDIGITS(z), zn, BDIGITS(x), xn, BDIGITS(y), yn);
+ RB_GC_GUARD(x);
+ RB_GC_GUARD(y);
+ return z;
+}
+
+/* efficient squaring (2 times faster than normal multiplication)
+ * ref: Handbook of Applied Cryptography, Algorithm 14.16
+ * http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf
+ */
+static void
+bary_sq_fast(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn)
+{
+ size_t i, j;
+ BDIGIT_DBL c, v, w;
+ BDIGIT vl;
+ int vh;
+
+ assert(xn * 2 <= zn);
+
+ BDIGITS_ZERO(zds, zn);
+
+ if (xn == 0)
+ return;
+
+ for (i = 0; i < xn-1; i++) {
+ v = (BDIGIT_DBL)xds[i];
+ if (!v)
+ continue;
+ c = (BDIGIT_DBL)zds[i + i] + v * v;
+ zds[i + i] = BIGLO(c);
+ c = BIGDN(c);
+ v *= 2;
+ vl = BIGLO(v);
+ vh = (int)BIGDN(v);
+ for (j = i + 1; j < xn; j++) {
+ w = (BDIGIT_DBL)xds[j];
+ c += (BDIGIT_DBL)zds[i + j] + vl * w;
+ zds[i + j] = BIGLO(c);
+ c = BIGDN(c);
+ if (vh)
+ c += w;
+ }
+ if (c) {
+ c += (BDIGIT_DBL)zds[i + xn];
+ zds[i + xn] = BIGLO(c);
+ c = BIGDN(c);
+ if (c)
+ zds[i + xn + 1] += (BDIGIT)c;
+ }
+ }
+
+ /* i == xn-1 */
+ v = (BDIGIT_DBL)xds[i];
+ if (!v)
+ return;
+ c = (BDIGIT_DBL)zds[i + i] + v * v;
+ zds[i + i] = BIGLO(c);
+ c = BIGDN(c);
+ if (c) {
+ zds[i + xn] += BIGLO(c);
+ }
+}
+
+VALUE
+rb_big_sq_fast(VALUE x)
+{
+ size_t xn = BIGNUM_LEN(x), zn = 2 * xn;
+ VALUE z = bignew(zn, 1);
+ bary_sq_fast(BDIGITS(z), zn, BDIGITS(x), xn);
+ RB_GC_GUARD(x);
+ return z;
+}
+
+/* balancing multiplication by slicing larger argument */
+static void
+bary_mul_balance_with_mulfunc(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn, BDIGIT *wds, size_t wn, mulfunc_t *mulfunc)
+{
+ VALUE work = 0;
+ size_t yn0 = yn;
+ size_t r, n;
+
+ assert(xn + yn <= zn);
+ assert(xn <= yn);
+ assert(!KARATSUBA_BALANCED(xn, yn) || !TOOM3_BALANCED(xn, yn));
+
+ BDIGITS_ZERO(zds, xn);
+
+ n = 0;
+ while (yn > 0) {
+ BDIGIT *tds;
+ size_t tn;
+ r = xn > yn ? yn : xn;
+ tn = xn + r;
+ if (2 * (xn + r) <= zn - n) {
+ tds = zds + n + xn + r;
+ mulfunc(tds, tn, xds, xn, yds + n, r, wds, wn);
+ BDIGITS_ZERO(zds + n + xn, r);
+ bary_add(zds + n, tn,
+ zds + n, tn,
+ tds, tn);
+ }
+ else {
+ if (wn < xn) {
+ wn = xn;
+ wds = ALLOCV_N(BDIGIT, work, wn);
+ }
+ tds = zds + n;
+ MEMCPY(wds, zds + n, BDIGIT, xn);
+ mulfunc(tds, tn, xds, xn, yds + n, r, wds-xn, wn-xn);
+ bary_add(zds + n, tn,
+ zds + n, tn,
+ wds, xn);
+ }
+ yn -= r;
+ n += r;
+ }
+ BDIGITS_ZERO(zds+xn+yn0, zn - (xn+yn0));
+
+ if (work)
+ ALLOCV_END(work);
+}
+
+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));
+ 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);
+ return z;
+}
+
+/* multiplication by karatsuba method */
+static void
+bary_mul_karatsuba(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn, BDIGIT *wds, size_t wn)
+{
+ VALUE work = 0;
+
+ size_t n;
+ int sub_p, borrow, carry1, carry2, carry3;
+
+ int odd_y = 0;
+ int odd_xy = 0;
+ int sq;
+
+ const BDIGIT *xds0, *xds1, *yds0, *yds1;
+ BDIGIT *zds0, *zds1, *zds2, *zds3;
+
+ assert(xn + yn <= zn);
+ assert(xn <= yn);
+ assert(yn < 2 * xn);
+
+ sq = xds == yds && xn == yn;
+
+ if (yn & 1) {
+ odd_y = 1;
+ yn--;
+ if (yn < xn) {
+ odd_xy = 1;
+ xn--;
+ }
+ }
+
+ n = yn / 2;
+
+ assert(n < xn);
+
+ if (wn < n) {
+ /* This function itself needs only n BDIGITs for work area.
+ * However this function calls bary_mul_karatsuba and
+ * bary_mul_balance recursively.
+ * 2n BDIGITs are enough to avoid allocations in
+ * the recursively called functions.
+ */
+ wn = 2*n;
+ wds = ALLOCV_N(BDIGIT, work, wn);
+ }
+
+ /* Karatsuba algorithm:
+ *
+ * x = x0 + r*x1
+ * y = y0 + r*y1
+ * z = x*y
+ * = (x0 + r*x1) * (y0 + r*y1)
+ * = x0*y0 + r*(x1*y0 + x0*y1) + r*r*x1*y1
+ * = x0*y0 + r*(x0*y0 + x1*y1 - (x1-x0)*(y1-y0)) + r*r*x1*y1
+ * = x0*y0 + r*(x0*y0 + x1*y1 - (x0-x1)*(y0-y1)) + r*r*x1*y1
+ */
+
+ xds0 = xds;
+ xds1 = xds + n;
+ yds0 = yds;
+ yds1 = yds + n;
+ zds0 = zds;
+ zds1 = zds + n;
+ zds2 = zds + 2*n;
+ zds3 = zds + 3*n;
+
+ sub_p = 1;
+
+ /* zds0:? zds1:? zds2:? zds3:? wds:? */
+
+ if (bary_sub(zds0, n, xds, n, xds+n, xn-n)) {
+ bary_2comp(zds0, n);
+ sub_p = !sub_p;
+ }
+
+ /* zds0:|x1-x0| zds1:? zds2:? zds3:? wds:? */
+
+ if (sq) {
+ sub_p = 1;
+ bary_mul_karatsuba_start(zds1, 2*n, zds0, n, zds0, n, wds, wn);
+ }
+ else {
+ if (bary_sub(wds, n, yds, n, yds+n, n)) {
+ bary_2comp(wds, n);
+ sub_p = !sub_p;
+ }
+
+ /* zds0:|x1-x0| zds1:? zds2:? zds3:? wds:|y1-y0| */
+
+ bary_mul_karatsuba_start(zds1, 2*n, zds0, n, wds, n, wds+n, wn-n);
+ }
+
+ /* zds0:|x1-x0| zds1,zds2:|x1-x0|*|y1-y0| zds3:? wds:|y1-y0| */
+
+ borrow = 0;
+ if (sub_p) {
+ borrow = !bary_2comp(zds1, 2*n);
+ }
+ /* zds0:|x1-x0| zds1,zds2:-?|x1-x0|*|y1-y0| zds3:? wds:|y1-y0| */
+
+ MEMCPY(wds, zds1, BDIGIT, n);
+
+ /* zds0:|x1-x0| zds1,zds2:-?|x1-x0|*|y1-y0| zds3:? wds:lo(-?|x1-x0|*|y1-y0|) */
+
+ bary_mul_karatsuba_start(zds0, 2*n, xds0, n, yds0, n, wds+n, wn-n);
+
+ /* zds0,zds1:x0*y0 zds2:hi(-?|x1-x0|*|y1-y0|) zds3:? wds:lo(-?|x1-x0|*|y1-y0|) */
+
+ carry1 = bary_add(wds, n, wds, n, zds0, n);
+ carry1 = bary_addc(zds2, n, zds2, n, zds1, n, carry1);
+
+ /* zds0,zds1:x0*y0 zds2:hi(x0*y0-?|x1-x0|*|y1-y0|) zds3:? wds:lo(x0*y0-?|x1-x0|*|y1-y0|) */
+
+ carry2 = bary_add(zds1, n, zds1, n, wds, n);
+
+ /* zds0:lo(x0*y0) zds1:hi(x0*y0)+lo(x0*y0-?|x1-x0|*|y1-y0|) zds2:hi(x0*y0-?|x1-x0|*|y1-y0|) zds3:? wds:lo(x0*y0-?|x1-x0|*|y1-y0|) */
+
+ MEMCPY(wds, zds2, BDIGIT, n);
+
+ /* zds0:lo(x0*y0) zds1:hi(x0*y0)+lo(x0*y0-?|x1-x0|*|y1-y0|) zds2:_ zds3:? wds:hi(x0*y0-?|x1-x0|*|y1-y0|) */
+
+ bary_mul_karatsuba_start(zds2, zn-2*n, xds1, xn-n, yds1, n, wds+n, wn-n);
+
+ /* zds0:lo(x0*y0) zds1:hi(x0*y0)+lo(x0*y0-?|x1-x0|*|y1-y0|) zds2,zds3:x1*y1 wds:hi(x0*y0-?|x1-x0|*|y1-y0|) */
+
+ carry3 = bary_add(zds1, n, zds1, n, zds2, n);
+
+ /* zds0:lo(x0*y0) zds1:hi(x0*y0)+lo(x0*y0-?|x1-x0|*|y1-y0|)+lo(x1*y1) zds2,zds3:x1*y1 wds:hi(x0*y0-?|x1-x0|*|y1-y0|) */
+
+ carry3 = bary_addc(zds2, n, zds2, n, zds3, (4*n < zn ? n : zn-3*n), carry3);
+
+ /* zds0:lo(x0*y0) zds1:hi(x0*y0)+lo(x0*y0-?|x1-x0|*|y1-y0|)+lo(x1*y1) zds2,zds3:x1*y1+hi(x1*y1) wds:hi(x0*y0-?|x1-x0|*|y1-y0|) */
+
+ bary_add(zds2, zn-2*n, zds2, zn-2*n, wds, n);
+
+ /* zds0:lo(x0*y0) zds1:hi(x0*y0)+lo(x0*y0-?|x1-x0|*|y1-y0|)+lo(x1*y1) zds2,zds3:x1*y1+hi(x1*y1)+hi(x0*y0-?|x1-x0|*|y1-y0|) wds:_ */
+
+ if (carry2)
+ bary_add_one(zds2, zn-2*n);
+
+ if (carry1 + carry3 - borrow < 0)
+ bary_sub_one(zds3, zn-3*n);
+ else if (carry1 + carry3 - borrow > 0) {
+ BDIGIT c = carry1 + carry3 - borrow;
+ bary_add(zds3, zn-3*n, zds3, zn-3*n, &c, 1);
+ }
+
+ /*
+ if (SIZEOF_BDIGIT * 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]; }
+ assert(z == x * y);
+ }
+ */
+
+ if (odd_xy) {
+ bary_muladd_1xN(zds+yn, zn-yn, yds[yn], xds, xn);
+ bary_muladd_1xN(zds+xn, zn-xn, xds[xn], yds, yn+1);
+ }
+ else if (odd_y) {
+ bary_muladd_1xN(zds+yn, zn-yn, yds[yn], xds, xn);
+ }
+
+ if (work)
+ ALLOCV_END(work);
+}
+
+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));
+ 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);
+ RB_GC_GUARD(x);
+ RB_GC_GUARD(y);
+ return z;
+}
+
+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)
+{
+ size_t n;
+ size_t wnc;
+ VALUE work = 0;
+
+ /* "p" stands for "positive". Actually it means "non-negative", though. */
+ size_t x0n; const BDIGIT *x0ds;
+ size_t x1n; const BDIGIT *x1ds;
+ size_t x2n; const BDIGIT *x2ds;
+ size_t y0n; const BDIGIT *y0ds;
+ size_t y1n; const BDIGIT *y1ds;
+ size_t y2n; const BDIGIT *y2ds;
+
+ size_t u1n; BDIGIT *u1ds; int u1p;
+ size_t u2n; BDIGIT *u2ds; int u2p;
+ size_t u3n; BDIGIT *u3ds; int u3p;
+
+ size_t v1n; BDIGIT *v1ds; int v1p;
+ size_t v2n; BDIGIT *v2ds; int v2p;
+ size_t v3n; BDIGIT *v3ds; int v3p;
+
+ size_t t0n; BDIGIT *t0ds; int t0p;
+ size_t t1n; BDIGIT *t1ds; int t1p;
+ size_t t2n; BDIGIT *t2ds; int t2p;
+ size_t t3n; BDIGIT *t3ds; int t3p;
+ size_t t4n; BDIGIT *t4ds; int t4p;
+
+ size_t z0n; BDIGIT *z0ds;
+ size_t z1n; BDIGIT *z1ds; int z1p;
+ size_t z2n; BDIGIT *z2ds; int z2p;
+ size_t z3n; BDIGIT *z3ds; int z3p;
+ size_t z4n; BDIGIT *z4ds;
+
+ size_t zzn; BDIGIT *zzds;
+
+ int sq = xds == yds && xn == yn;
+
+ assert(xn <= yn); /* assume y >= x */
+ assert(xn + yn <= zn);
+
+ n = (yn + 2) / 3;
+ assert(2*n < xn);
+
+ wnc = 0;
+
+ wnc += (u1n = n+1); /* BITSPERDIG*n+2 bits */
+ wnc += (u2n = n+1); /* BITSPERDIG*n+1 bits */
+ wnc += (u3n = n+1); /* BITSPERDIG*n+3 bits */
+ wnc += (v1n = n+1); /* BITSPERDIG*n+2 bits */
+ wnc += (v2n = n+1); /* BITSPERDIG*n+1 bits */
+ wnc += (v3n = n+1); /* BITSPERDIG*n+3 bits */
+
+ wnc += (t0n = 2*n); /* BITSPERDIG*2*n bits */
+ wnc += (t1n = 2*n+2); /* BITSPERDIG*2*n+4 bits but bary_mul needs u1n+v1n */
+ wnc += (t2n = 2*n+2); /* BITSPERDIG*2*n+2 bits but bary_mul needs u2n+v2n */
+ wnc += (t3n = 2*n+2); /* BITSPERDIG*2*n+6 bits but bary_mul needs u3n+v3n */
+ wnc += (t4n = 2*n); /* BITSPERDIG*2*n bits */
+
+ wnc += (z1n = 2*n+1); /* BITSPERDIG*2*n+5 bits */
+ wnc += (z2n = 2*n+1); /* BITSPERDIG*2*n+6 bits */
+ wnc += (z3n = 2*n+1); /* BITSPERDIG*2*n+8 bits */
+
+ if (wn < wnc) {
+ wn = wnc * 3 / 2; /* Allocate working memory for whole recursion at once. */
+ wds = ALLOCV_N(BDIGIT, work, wn);
+ }
+
+ u1ds = wds; wds += u1n;
+ u2ds = wds; wds += u2n;
+ u3ds = wds; wds += u3n;
+
+ v1ds = wds; wds += v1n;
+ v2ds = wds; wds += v2n;
+ v3ds = wds; wds += v3n;
+
+ t0ds = wds; wds += t0n;
+ t1ds = wds; wds += t1n;
+ t2ds = wds; wds += t2n;
+ t3ds = wds; wds += t3n;
+ t4ds = wds; wds += t4n;
+
+ z1ds = wds; wds += z1n;
+ z2ds = wds; wds += z2n;
+ z3ds = wds; wds += z3n;
+
+ wn -= wnc;
+
+ zzds = u1ds;
+ zzn = 6*n+1;
+
+ x0n = n;
+ x1n = n;
+ x2n = xn - 2*n;
+ x0ds = xds;
+ x1ds = xds + n;
+ x2ds = xds + 2*n;
+
+ if (sq) {
+ y0n = x0n;
+ y1n = x1n;
+ y2n = x2n;
+ y0ds = x0ds;
+ y1ds = x1ds;
+ y2ds = x2ds;
+ }
+ else {
+ y0n = n;
+ y1n = n;
+ y2n = yn - 2*n;
+ y0ds = yds;
+ y1ds = yds + n;
+ y2ds = yds + 2*n;
+ }
+
+ /*
+ * ref. http://en.wikipedia.org/wiki/Toom%E2%80%93Cook_multiplication
+ *
+ * x(b) = x0 * b^0 + x1 * b^1 + x2 * b^2
+ * y(b) = y0 * b^0 + y1 * b^1 + y2 * b^2
+ *
+ * z(b) = x(b) * y(b)
+ * z(b) = z0 * b^0 + z1 * b^1 + z2 * b^2 + z3 * b^3 + z4 * b^4
+ * where:
+ * z0 = x0 * y0
+ * z1 = x0 * y1 + x1 * y0
+ * z2 = x0 * y2 + x1 * y1 + x2 * y0
+ * z3 = x1 * y2 + x2 * y1
+ * z4 = x2 * y2
+ *
+ * Toom3 method (a.k.a. Toom-Cook method):
+ * (Step1) calculating 5 points z(b0), z(b1), z(b2), z(b3), z(b4),
+ * where:
+ * b0 = 0, b1 = 1, b2 = -1, b3 = -2, b4 = inf,
+ * z(0) = x(0) * y(0) = x0 * y0
+ * z(1) = x(1) * y(1) = (x0 + x1 + x2) * (y0 + y1 + y2)
+ * z(-1) = x(-1) * y(-1) = (x0 - x1 + x2) * (y0 - y1 + y2)
+ * z(-2) = x(-2) * y(-2) = (x0 - 2 * (x1 - 2 * x2)) * (y0 - 2 * (y1 - 2 * y2))
+ * z(inf) = x(inf) * y(inf) = x2 * y2
+ *
+ * (Step2) interpolating z0, z1, z2, z3 and z4.
+ *
+ * (Step3) Substituting base value into b of the polynomial z(b),
+ */
+
+ /*
+ * [Step1] calculating 5 points z(b0), z(b1), z(b2), z(b3), z(b4)
+ */
+
+ /* u1 <- x0 + x2 */
+ bary_add(u1ds, u1n, x0ds, x0n, x2ds, x2n);
+ u1p = 1;
+
+ /* x(-1) : u2 <- u1 - x1 = x0 - x1 + x2 */
+ if (bary_sub(u2ds, u2n, u1ds, u1n, x1ds, x1n)) {
+ bary_2comp(u2ds, u2n);
+ u2p = 0;
+ }
+ else {
+ u2p = 1;
+ }
+
+ /* x(1) : u1 <- u1 + x1 = x0 + x1 + x2 */
+ bary_add(u1ds, u1n, u1ds, u1n, x1ds, x1n);
+
+ /* x(-2) : u3 <- 2 * (u2 + x2) - x0 = x0 - 2 * (x1 - 2 * x2) */
+ u3p = 1;
+ if (u2p) {
+ bary_add(u3ds, u3n, u2ds, u2n, x2ds, x2n);
+ }
+ else if (bary_sub(u3ds, u3n, x2ds, x2n, u2ds, u2n)) {
+ bary_2comp(u3ds, u3n);
+ u3p = 0;
+ }
+ bary_small_lshift(u3ds, u3ds, u3n, 1);
+ if (!u3p) {
+ bary_add(u3ds, u3n, u3ds, u3n, x0ds, x0n);
+ }
+ else if (bary_sub(u3ds, u3n, u3ds, u3n, x0ds, x0n)) {
+ bary_2comp(u3ds, u3n);
+ u3p = 0;
+ }
+
+ if (sq) {
+ v1n = u1n; v1ds = u1ds; v1p = u1p;
+ v2n = u2n; v2ds = u2ds; v2p = u2p;
+ v3n = u3n; v3ds = u3ds; v3p = u3p;
+ }
+ else {
+ /* v1 <- y0 + y2 */
+ bary_add(v1ds, v1n, y0ds, y0n, y2ds, y2n);
+ v1p = 1;
+
+ /* y(-1) : v2 <- v1 - y1 = y0 - y1 + y2 */
+ v2p = 1;
+ if (bary_sub(v2ds, v2n, v1ds, v1n, y1ds, y1n)) {
+ bary_2comp(v2ds, v2n);
+ v2p = 0;
+ }
+
+ /* y(1) : v1 <- v1 + y1 = y0 + y1 + y2 */
+ bary_add(v1ds, v1n, v1ds, v1n, y1ds, y1n);
+
+ /* y(-2) : v3 <- 2 * (v2 + y2) - y0 = y0 - 2 * (y1 - 2 * y2) */
+ v3p = 1;
+ if (v2p) {
+ bary_add(v3ds, v3n, v2ds, v2n, y2ds, y2n);
+ }
+ else if (bary_sub(v3ds, v3n, y2ds, y2n, v2ds, v2n)) {
+ bary_2comp(v3ds, v3n);
+ v3p = 0;
+ }
+ bary_small_lshift(v3ds, v3ds, v3n, 1);
+ if (!v3p) {
+ bary_add(v3ds, v3n, v3ds, v3n, y0ds, y0n);
+ }
+ else if (bary_sub(v3ds, v3n, v3ds, v3n, y0ds, y0n)) {
+ bary_2comp(v3ds, v3n);
+ v3p = 0;
+ }
+ }
+
+ /* z(0) : t0 <- x0 * y0 */
+ bary_mul_toom3_start(t0ds, t0n, x0ds, x0n, y0ds, y0n, wds, wn);
+ t0p = 1;
+
+ /* z(1) : t1 <- u1 * v1 */
+ bary_mul_toom3_start(t1ds, t1n, u1ds, u1n, v1ds, v1n, wds, wn);
+ t1p = u1p == v1p;
+ assert(t1ds[t1n-1] == 0);
+ t1n--;
+
+ /* z(-1) : t2 <- u2 * v2 */
+ bary_mul_toom3_start(t2ds, t2n, u2ds, u2n, v2ds, v2n, wds, wn);
+ t2p = u2p == v2p;
+ assert(t2ds[t2n-1] == 0);
+ t2n--;
+
+ /* z(-2) : t3 <- u3 * v3 */
+ bary_mul_toom3_start(t3ds, t3n, u3ds, u3n, v3ds, v3n, wds, wn);
+ t3p = u3p == v3p;
+ assert(t3ds[t3n-1] == 0);
+ t3n--;
+
+ /* z(inf) : t4 <- x2 * y2 */
+ bary_mul_toom3_start(t4ds, t4n, x2ds, x2n, y2ds, y2n, wds, wn);
+ t4p = 1;
+
+ /*
+ * [Step2] interpolating z0, z1, z2, z3 and z4.
+ */
+
+ /* z0 <- z(0) == t0 */
+ z0n = t0n; z0ds = t0ds;
+
+ /* z4 <- z(inf) == t4 */
+ z4n = t4n; z4ds = t4ds;
+
+ /* z3 <- (z(-2) - z(1)) / 3 == (t3 - t1) / 3 */
+ if (t3p == t1p) {
+ z3p = t3p;
+ if (bary_sub(z3ds, z3n, t3ds, t3n, t1ds, t1n)) {
+ bary_2comp(z3ds, z3n);
+ z3p = !z3p;
+ }
+ }
+ else {
+ z3p = t3p;
+ bary_add(z3ds, z3n, t3ds, t3n, t1ds, t1n);
+ }
+ bigdivrem_single(z3ds, z3ds, z3n, 3);
+
+ /* z1 <- (z(1) - z(-1)) / 2 == (t1 - t2) / 2 */
+ if (t1p == t2p) {
+ z1p = t1p;
+ if (bary_sub(z1ds, z1n, t1ds, t1n, t2ds, t2n)) {
+ bary_2comp(z1ds, z1n);
+ z1p = !z1p;
+ }
+ }
+ else {
+ z1p = t1p;
+ bary_add(z1ds, z1n, t1ds, t1n, t2ds, t2n);
+ }
+ bary_small_rshift(z1ds, z1ds, z1n, 1, 0);
+
+ /* z2 <- z(-1) - z(0) == t2 - t0 */
+ if (t2p == t0p) {
+ z2p = t2p;
+ if (bary_sub(z2ds, z2n, t2ds, t2n, t0ds, t0n)) {
+ bary_2comp(z2ds, z2n);
+ z2p = !z2p;
+ }
+ }
+ else {
+ z2p = t2p;
+ bary_add(z2ds, z2n, t2ds, t2n, t0ds, t0n);
+ }
+
+ /* z3 <- (z2 - z3) / 2 + 2 * z(inf) == (z2 - z3) / 2 + 2 * t4 */
+ if (z2p == z3p) {
+ z3p = z2p;
+ if (bary_sub(z3ds, z3n, z2ds, z2n, z3ds, z3n)) {
+ bary_2comp(z3ds, z3n);
+ z3p = !z3p;
+ }
+ }
+ else {
+ z3p = z2p;
+ bary_add(z3ds, z3n, z2ds, z2n, z3ds, z3n);
+ }
+ bary_small_rshift(z3ds, z3ds, z3n, 1, 0);
+ if (z3p == t4p) {
+ bary_muladd_1xN(z3ds, z3n, 2, t4ds, t4n);
+ }
+ else {
+ if (bary_mulsub_1xN(z3ds, z3n, 2, t4ds, t4n)) {
+ bary_2comp(z3ds, z3n);
+ z3p = !z3p;
+ }
+ }
+
+ /* z2 <- z2 + z1 - z(inf) == z2 + z1 - t4 */
+ if (z2p == z1p) {
+ bary_add(z2ds, z2n, z2ds, z2n, z1ds, z1n);
+ }
+ else {
+ if (bary_sub(z2ds, z2n, z2ds, z2n, z1ds, z1n)) {
+ bary_2comp(z2ds, z2n);
+ z2p = !z2p;
+ }
+ }
+
+ if (z2p == t4p) {
+ if (bary_sub(z2ds, z2n, z2ds, z2n, t4ds, t4n)) {
+ bary_2comp(z2ds, z2n);
+ z2p = !z2p;
+ }
+ }
+ else {
+ bary_add(z2ds, z2n, z2ds, z2n, t4ds, t4n);
+ }
+
+ /* z1 <- z1 - z3 */
+ if (z1p == z3p) {
+ if (bary_sub(z1ds, z1n, z1ds, z1n, z3ds, z3n)) {
+ bary_2comp(z1ds, z1n);
+ z1p = !z1p;
+ }
+ }
+ else {
+ bary_add(z1ds, z1n, z1ds, z1n, z3ds, z3n);
+ }
+
+ /*
+ * [Step3] Substituting base value into b of the polynomial z(b),
+ */
+
+ MEMCPY(zzds, z0ds, BDIGIT, z0n);
+ BDIGITS_ZERO(zzds + z0n, 4*n - z0n);
+ MEMCPY(zzds + 4*n, z4ds, BDIGIT, z4n);
+ BDIGITS_ZERO(zzds + 4*n + z4n, zzn - (4*n + z4n));
+ if (z1p)
+ bary_add(zzds + n, zzn - n, zzds + n, zzn - n, z1ds, z1n);
+ else
+ bary_sub(zzds + n, zzn - n, zzds + n, zzn - n, z1ds, z1n);
+ if (z2p)
+ bary_add(zzds + 2*n, zzn - 2*n, zzds + 2*n, zzn - 2*n, z2ds, z2n);
+ else
+ bary_sub(zzds + 2*n, zzn - 2*n, zzds + 2*n, zzn - 2*n, z2ds, z2n);
+ if (z3p)
+ bary_add(zzds + 3*n, zzn - 3*n, zzds + 3*n, zzn - 3*n, z3ds, z3n);
+ else
+ bary_sub(zzds + 3*n, zzn - 3*n, zzds + 3*n, zzn - 3*n, z3ds, z3n);
+
+ BARY_TRUNC(zzds, zzn);
+ MEMCPY(zds, zzds, BDIGIT, zzn);
+ BDIGITS_ZERO(zds + zzn, zn - zzn);
+
+ if (work)
+ ALLOCV_END(work);
+}
+
+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));
+ 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);
+ RB_GC_GUARD(x);
+ RB_GC_GUARD(y);
+ return z;
+}
+
+#ifdef USE_GMP
+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;
+ mpz_t x, y, z;
+ size_t count;
+
+ assert(xn + yn <= zn);
+
+ mpz_init(x);
+ mpz_init(y);
+ mpz_init(z);
+ mpz_import(x, xn, -1, sizeof(BDIGIT), 0, nails, xds);
+ if (xds == yds && xn == yn) {
+ mpz_mul(z, x, x);
+ }
+ else {
+ mpz_import(y, yn, -1, sizeof(BDIGIT), 0, nails, yds);
+ mpz_mul(z, x, y);
+ }
+ mpz_export(zds, &count, -1, sizeof(BDIGIT), 0, nails, z);
+ BDIGITS_ZERO(zds+count, zn-count);
+ mpz_clear(x);
+ mpz_clear(y);
+ mpz_clear(z);
+}
+
+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));
+ bary_mul_gmp(BDIGITS(z), zn, BDIGITS(x), xn, BDIGITS(y), yn);
+ RB_GC_GUARD(x);
+ RB_GC_GUARD(y);
+ return z;
+}
+#endif
+
+static void
+bary_short_mul(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn)
+{
+ assert(xn + yn <= zn);
+
+ if (xn == 1 && yn == 1) {
+ bary_mul_single(zds, zn, xds[0], yds[0]);
+ }
+ else {
+ bary_mul_normal(zds, zn, xds, xn, yds, yn);
+ rb_thread_check_ints();
+ }
+}
+
+/* determine whether a bignum is sparse or not by random sampling */
+static inline int
+bary_sparse_p(const BDIGIT *ds, size_t n)
+{
+ long c = 0;
+
+ if ( ds[rb_genrand_ulong_limited(n / 2) + n / 4]) c++;
+ if (c <= 1 && ds[rb_genrand_ulong_limited(n / 2) + n / 4]) c++;
+ if (c <= 1 && ds[rb_genrand_ulong_limited(n / 2) + n / 4]) c++;
+
+ return (c <= 1) ? 1 : 0;
+}
+
+static int
+bary_mul_precheck(BDIGIT **zdsp, size_t *znp, const BDIGIT **xdsp, size_t *xnp, const BDIGIT **ydsp, size_t *ynp)
+{
+ size_t nlsz; /* number of least significant zero BDIGITs */
+
+ BDIGIT *zds = *zdsp;
+ size_t zn = *znp;
+ const BDIGIT *xds = *xdsp;
+ size_t xn = *xnp;
+ const BDIGIT *yds = *ydsp;
+ size_t yn = *ynp;
+
+ assert(xn + yn <= zn);
+
+ nlsz = 0;
+
+ while (0 < xn) {
+ if (xds[xn-1] == 0) {
+ xn--;
+ }
+ else {
+ do {
+ if (xds[0] != 0)
+ break;
+ xds++;
+ xn--;
+ nlsz++;
+ } while (0 < xn);
+ break;
+ }
+ }
+
+ while (0 < yn) {
+ if (yds[yn-1] == 0) {
+ yn--;
+ }
+ else {
+ do {
+ if (yds[0] != 0)
+ break;
+ yds++;
+ yn--;
+ nlsz++;
+ } while (0 < yn);
+ break;
+ }
+ }
+
+ if (nlsz) {
+ BDIGITS_ZERO(zds, nlsz);
+ zds += nlsz;
+ zn -= nlsz;
+ }
+
+ /* make sure that y is longer than x */
+ if (xn > yn) {
+ const BDIGIT *tds;
+ size_t tn;
+ tds = xds; xds = yds; yds = tds;
+ tn = xn; xn = yn; yn = tn;
+ }
+ assert(xn <= yn);
+
+ if (xn <= 1) {
+ if (xn == 0) {
+ BDIGITS_ZERO(zds, zn);
+ return 1;
+ }
+
+ if (xds[0] == 1) {
+ MEMCPY(zds, yds, BDIGIT, yn);
+ BDIGITS_ZERO(zds+yn, zn-yn);
+ return 1;
+ }
+ if (POW2_P(xds[0])) {
+ zds[yn] = bary_small_lshift(zds, yds, yn, bit_length(xds[0])-1);
+ BDIGITS_ZERO(zds+yn+1, zn-yn-1);
+ return 1;
+ }
+ if (yn == 1 && yds[0] == 1) {
+ zds[0] = xds[0];
+ BDIGITS_ZERO(zds+1, zn-1);
+ return 1;
+ }
+ bary_mul_normal(zds, zn, xds, xn, yds, yn);
+ return 1;
+ }
+
+ *zdsp = zds;
+ *znp = zn;
+ *xdsp = xds;
+ *xnp = xn;
+ *ydsp = yds;
+ *ynp = yn;
+
+ return 0;
+}
+
+static void
+bary_mul_karatsuba_branch(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn, BDIGIT *wds, size_t wn)
+{
+ /* normal multiplication when x is small */
+ if (xn < KARATSUBA_MUL_DIGITS) {
+ normal:
+ if (xds == yds && xn == yn)
+ bary_sq_fast(zds, zn, xds, xn);
+ else
+ bary_short_mul(zds, zn, xds, xn, yds, yn);
+ return;
+ }
+
+ /* normal multiplication when x or y is a sparse bignum */
+ if (bary_sparse_p(xds, xn)) goto normal;
+ if (bary_sparse_p(yds, yn)) {
+ bary_short_mul(zds, zn, yds, yn, xds, xn);
+ return;
+ }
+
+ /* balance multiplication by slicing y when x is much smaller than y */
+ if (!KARATSUBA_BALANCED(xn, yn)) {
+ bary_mul_balance_with_mulfunc(zds, zn, xds, xn, yds, yn, wds, wn, bary_mul_karatsuba_start);
+ return;
+ }
+
+ /* multiplication by karatsuba method */
+ bary_mul_karatsuba(zds, zn, xds, xn, yds, yn, wds, wn);
+}
+
+static void
+bary_mul_karatsuba_start(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn, BDIGIT *wds, size_t wn)
+{
+ if (bary_mul_precheck(&zds, &zn, &xds, &xn, &yds, &yn))
+ return;
+
+ bary_mul_karatsuba_branch(zds, zn, xds, xn, yds, yn, wds, wn);
+}
+
+static void
+bary_mul_toom3_branch(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn, BDIGIT *wds, size_t wn)
+{
+ if (xn < TOOM3_MUL_DIGITS) {
+ bary_mul_karatsuba_branch(zds, zn, xds, xn, yds, yn, wds, wn);
+ return;
+ }
+
+ if (!TOOM3_BALANCED(xn, yn)) {
+ bary_mul_balance_with_mulfunc(zds, zn, xds, xn, yds, yn, wds, wn, bary_mul_toom3_start);
+ return;
+ }
+
+ bary_mul_toom3(zds, zn, xds, xn, yds, yn, wds, wn);
+}
+
+static void
+bary_mul_toom3_start(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn, BDIGIT *wds, size_t wn)
+{
+ if (bary_mul_precheck(&zds, &zn, &xds, &xn, &yds, &yn))
+ return;
+
+ bary_mul_toom3_branch(zds, zn, xds, xn, yds, yn, wds, wn);
+}
+
+static void
+bary_mul(BDIGIT *zds, size_t zn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn)
+{
+#ifdef USE_GMP
+ const size_t naive_threshold = GMP_MUL_DIGITS;
+#else
+ const size_t naive_threshold = KARATSUBA_MUL_DIGITS;
+#endif
+ if (xn <= yn) {
+ if (xn < naive_threshold) {
+ if (xds == yds && xn == yn)
+ bary_sq_fast(zds, zn, xds, xn);
+ else
+ bary_short_mul(zds, zn, xds, xn, yds, yn);
+ return;
+ }
+ }
+ else {
+ if (yn < naive_threshold) {
+ bary_short_mul(zds, zn, yds, yn, xds, xn);
+ return;
+ }
+ }
+
+#ifdef USE_GMP
+ bary_mul_gmp(zds, zn, xds, xn, yds, yn);
+#else
+ bary_mul_toom3_start(zds, zn, xds, xn, yds, yn, NULL, 0);
+#endif
+}
+
+struct big_div_struct {
+ size_t yn, zn;
+ BDIGIT *yds, *zds;
+ volatile VALUE stop;
+};
+
+static void *
+bigdivrem1(void *ptr)
+{
+ struct big_div_struct *bds = (struct big_div_struct*)ptr;
+ size_t yn = bds->yn;
+ size_t zn = bds->zn;
+ BDIGIT *yds = bds->yds, *zds = bds->zds;
+ BDIGIT_DBL_SIGNED num;
+ BDIGIT q;
+
+ do {
+ if (bds->stop) {
+ bds->zn = zn;
+ return 0;
+ }
+ if (zds[zn-1] == yds[yn-1]) q = BDIGMAX;
+ else q = (BDIGIT)((BIGUP(zds[zn-1]) + zds[zn-2])/yds[yn-1]);
+ if (q) {
+ num = bigdivrem_mulsub(zds+zn-(yn+1), yn+1,
+ q,
+ yds, yn);
+ while (num) { /* "add back" required */
+ q--;
+ num = bary_add(zds+zn-(yn+1), yn,
+ zds+zn-(yn+1), yn,
+ yds, yn);
+ num--;
+ }
+ }
+ zn--;
+ zds[zn] = q;
+ } while (zn > yn);
+ return 0;
+}
+
+static void
+rb_big_stop(void *ptr)
+{
+ struct big_div_struct *bds = ptr;
+ bds->stop = Qtrue;
+}
+
+static BDIGIT
+bigdivrem_single1(BDIGIT *qds, const BDIGIT *xds, size_t xn, BDIGIT x_higher_bdigit, BDIGIT y)
+{
+ assert(0 < xn);
+ assert(x_higher_bdigit < y);
+ if (POW2_P(y)) {
+ BDIGIT r;
+ r = xds[0] & (y-1);
+ bary_small_rshift(qds, xds, xn, bit_length(y)-1, x_higher_bdigit);
+ return r;
+ }
+ else {
+ size_t i;
+ BDIGIT_DBL t2;
+ t2 = x_higher_bdigit;
+ i = xn;
+ while (i--) {
+ t2 = BIGUP(t2) + xds[i];
+ qds[i] = (BDIGIT)(t2 / y);
+ t2 %= y;
+ }
+ return (BDIGIT)t2;
+ }
+}
+
+static BDIGIT
+bigdivrem_single(BDIGIT *qds, const BDIGIT *xds, size_t xn, BDIGIT y)
+{
+ return bigdivrem_single1(qds, xds, xn, 0, y);
+}
+
+static void
+bigdivrem_restoring(BDIGIT *zds, size_t zn, BDIGIT *yds, size_t yn)
+{
+ struct big_div_struct bds;
+ size_t ynzero;
+
+ assert(yn < zn);
+ assert(BDIGIT_MSB(yds[yn-1]));
+ assert(zds[zn-1] < yds[yn-1]);
+
+ for (ynzero = 0; !yds[ynzero]; ynzero++);
+
+ if (ynzero+1 == yn) {
+ BDIGIT r;
+ r = bigdivrem_single1(zds+yn, zds+ynzero, zn-yn, zds[zn-1], yds[ynzero]);
+ zds[ynzero] = r;
+ return;
+ }
+
+ bds.yn = yn - ynzero;
+ bds.zds = zds + ynzero;
+ bds.yds = yds + ynzero;
+ bds.stop = Qfalse;
+ bds.zn = zn - ynzero;
+ if (bds.zn > 10000 || bds.yn > 10000) {
+ retry:
+ bds.stop = Qfalse;
+ rb_thread_call_without_gvl(bigdivrem1, &bds, rb_big_stop, &bds);
+
+ if (bds.stop == Qtrue) {
+ /* execute trap handler, but exception was not raised. */
+ goto retry;
+ }
+ }
+ else {
+ bigdivrem1(&bds);
+ }
+}
+
+static void
+bary_divmod_normal(BDIGIT *qds, size_t qn, BDIGIT *rds, size_t rn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn)
+{
+ int shift;
+ BDIGIT *zds, *yyds;
+ size_t zn;
+ VALUE tmpyz = 0;
+
+ assert(yn < xn || (xn == yn && yds[yn - 1] <= xds[xn - 1]));
+ assert(qds ? (xn - yn + 1) <= qn : 1);
+ assert(rds ? yn <= rn : 1);
+
+ zn = xn + BIGDIVREM_EXTRA_WORDS;
+
+ shift = nlz(yds[yn-1]);
+ if (shift) {
+ int alloc_y = !rds;
+ int alloc_z = !qds || qn < zn;
+ if (alloc_y && alloc_z) {
+ yyds = ALLOCV_N(BDIGIT, tmpyz, yn+zn);
+ zds = yyds + yn;
+ }
+ else {
+ yyds = alloc_y ? ALLOCV_N(BDIGIT, tmpyz, yn) : rds;
+ zds = alloc_z ? ALLOCV_N(BDIGIT, tmpyz, zn) : qds;
+ }
+ zds[xn] = bary_small_lshift(zds, xds, xn, shift);
+ bary_small_lshift(yyds, yds, yn, shift);
+ }
+ else {
+ if (qds && zn <= qn)
+ zds = qds;
+ else
+ zds = ALLOCV_N(BDIGIT, tmpyz, zn);
+ MEMCPY(zds, xds, BDIGIT, xn);
+ zds[xn] = 0;
+ /* bigdivrem_restoring will not modify y.
+ * So use yds directly. */
+ yyds = (BDIGIT *)yds;
+ }
+
+ bigdivrem_restoring(zds, zn, yyds, yn);
+
+ if (rds) {
+ if (shift)
+ bary_small_rshift(rds, zds, yn, shift, 0);
+ else
+ MEMCPY(rds, zds, BDIGIT, yn);
+ BDIGITS_ZERO(rds+yn, rn-yn);
+ }
+
+ if (qds) {
+ size_t j = zn - yn;
+ MEMMOVE(qds, zds+yn, BDIGIT, j);
+ BDIGITS_ZERO(qds+j, qn-j);
+ }
+
+ if (tmpyz)
+ ALLOCV_END(tmpyz);
+}
+
+VALUE
+rb_big_divrem_normal(VALUE x, VALUE y)
+{
+ size_t xn = BIGNUM_LEN(x), yn = BIGNUM_LEN(y), qn, rn;
+ BDIGIT *xds = BDIGITS(x), *yds = BDIGITS(y), *qds, *rds;
+ VALUE q, r;
+
+ BARY_TRUNC(yds, yn);
+ if (yn == 0)
+ rb_num_zerodiv();
+ BARY_TRUNC(xds, xn);
+
+ if (xn < yn || (xn == yn && xds[xn - 1] < yds[yn - 1]))
+ return rb_assoc_new(LONG2FIX(0), x);
+
+ qn = xn + BIGDIVREM_EXTRA_WORDS;
+ q = bignew(qn, BIGNUM_SIGN(x)==BIGNUM_SIGN(y));
+ qds = BDIGITS(q);
+
+ rn = yn;
+ r = bignew(rn, BIGNUM_SIGN(x));
+ rds = BDIGITS(r);
+
+ bary_divmod_normal(qds, qn, rds, rn, xds, xn, yds, yn);
+
+ bigtrunc(q);
+ bigtrunc(r);
+
+ RB_GC_GUARD(x);
+ RB_GC_GUARD(y);
+
+ return rb_assoc_new(q, r);
+}
+
+#ifdef USE_GMP
+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;
+ mpz_t x, y, q, r;
+ size_t count;
+
+ assert(yn < xn || (xn == yn && yds[yn - 1] <= xds[xn - 1]));
+ assert(qds ? (xn - yn + 1) <= qn : 1);
+ assert(rds ? yn <= rn : 1);
+ assert(qds || rds);
+
+ mpz_init(x);
+ mpz_init(y);
+ if (qds) mpz_init(q);
+ if (rds) mpz_init(r);
+
+ mpz_import(x, xn, -1, sizeof(BDIGIT), 0, nails, xds);
+ mpz_import(y, yn, -1, sizeof(BDIGIT), 0, nails, yds);
+
+ if (!rds) {
+ mpz_fdiv_q(q, x, y);
+ }
+ else if (!qds) {
+ mpz_fdiv_r(r, x, y);
+ }
+ else {
+ mpz_fdiv_qr(q, r, x, y);
+ }
+
+ mpz_clear(x);
+ mpz_clear(y);
+
+ if (qds) {
+ mpz_export(qds, &count, -1, sizeof(BDIGIT), 0, nails, q);
+ BDIGITS_ZERO(qds+count, qn-count);
+ mpz_clear(q);
+ }
+
+ if (rds) {
+ mpz_export(rds, &count, -1, sizeof(BDIGIT), 0, nails, r);
+ BDIGITS_ZERO(rds+count, rn-count);
+ mpz_clear(r);
+ }
+}
+
+VALUE
+rb_big_divrem_gmp(VALUE x, VALUE y)
+{
+ size_t xn = BIGNUM_LEN(x), yn = BIGNUM_LEN(y), qn, rn;
+ BDIGIT *xds = BDIGITS(x), *yds = BDIGITS(y), *qds, *rds;
+ VALUE q, r;
+
+ BARY_TRUNC(yds, yn);
+ if (yn == 0)
+ rb_num_zerodiv();
+ BARY_TRUNC(xds, xn);
+
+ if (xn < yn || (xn == yn && xds[xn - 1] < yds[yn - 1]))
+ return rb_assoc_new(LONG2FIX(0), x);
+
+ qn = xn - yn + 1;
+ q = bignew(qn, BIGNUM_SIGN(x)==BIGNUM_SIGN(y));
+ qds = BDIGITS(q);
+
+ rn = yn;
+ r = bignew(rn, BIGNUM_SIGN(x));
+ rds = BDIGITS(r);
+
+ bary_divmod_gmp(qds, qn, rds, rn, xds, xn, yds, yn);
+
+ bigtrunc(q);
+ bigtrunc(r);
+
+ RB_GC_GUARD(x);
+ RB_GC_GUARD(y);
+
+ return rb_assoc_new(q, r);
+}
+#endif
+
+static void
+bary_divmod_branch(BDIGIT *qds, size_t qn, BDIGIT *rds, size_t rn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn)
+{
+#ifdef USE_GMP
+ if (GMP_DIV_DIGITS < xn) {
+ bary_divmod_gmp(qds, qn, rds, rn, xds, xn, yds, yn);
+ return;
+ }
+#endif
+ bary_divmod_normal(qds, qn, rds, rn, xds, xn, yds, yn);
+}
+
+static void
+bary_divmod(BDIGIT *qds, size_t qn, BDIGIT *rds, size_t rn, const BDIGIT *xds, size_t xn, const BDIGIT *yds, size_t yn)
+{
+ assert(xn <= qn);
+ assert(yn <= rn);
+
+ BARY_TRUNC(yds, yn);
+ if (yn == 0)
+ rb_num_zerodiv();
+
+ BARY_TRUNC(xds, xn);
+ if (xn == 0) {
+ BDIGITS_ZERO(qds, qn);
+ BDIGITS_ZERO(rds, rn);
+ return;
+ }
+
+ if (xn < yn || (xn == yn && xds[xn - 1] < yds[yn - 1])) {
+ MEMCPY(rds, xds, BDIGIT, xn);
+ BDIGITS_ZERO(rds+xn, rn-xn);
+ BDIGITS_ZERO(qds, qn);
+ }
+ else if (yn == 1) {
+ MEMCPY(qds, xds, BDIGIT, xn);
+ BDIGITS_ZERO(qds+xn, qn-xn);
+ rds[0] = bigdivrem_single(qds, xds, xn, yds[0]);
+ BDIGITS_ZERO(rds+1, rn-1);
+ }
+ else if (xn == 2 && yn == 2) {
+ BDIGIT_DBL x = bary2bdigitdbl(xds, 2);
+ BDIGIT_DBL y = bary2bdigitdbl(yds, 2);
+ BDIGIT_DBL q = x / y;
+ BDIGIT_DBL r = x % y;
+ qds[0] = BIGLO(q);
+ qds[1] = BIGLO(BIGDN(q));
+ BDIGITS_ZERO(qds+2, qn-2);
+ rds[0] = BIGLO(r);
+ rds[1] = BIGLO(BIGDN(r));
+ BDIGITS_ZERO(rds+2, rn-2);
+ }
+ else {
+ bary_divmod_branch(qds, qn, rds, rn, xds, xn, yds, yn);
+ }
+}
+
#define BIGNUM_DEBUG 0
#if BIGNUM_DEBUG
@@ -57,11 +2875,11 @@ static void
dump_bignum(VALUE x)
{
long i;
- printf("%c0x0", RBIGNUM_SIGN(x) ? '+' : '-');
- for (i = RBIGNUM_LEN(x); i--; ) {
- printf("_%08"PRIxBDIGIT, BDIGITS(x)[i]);
+ printf("%c0x0", BIGNUM_SIGN(x) ? '+' : '-');
+ for (i = BIGNUM_LEN(x); i--; ) {
+ printf("_%0*"PRIxBDIGIT, SIZEOF_BDIGIT*2, BDIGITS(x)[i]);
}
- printf(", len=%lu", RBIGNUM_LEN(x));
+ printf(", len=%"PRIuSIZE, BIGNUM_LEN(x));
puts("");
}
@@ -78,13 +2896,7 @@ rb_big_dump(VALUE x)
static int
bigzero_p(VALUE x)
{
- long i;
- BDIGIT *ds = BDIGITS(x);
-
- for (i = RBIGNUM_LEN(x) - 1; 0 <= i; i--) {
- if (ds[i]) return 0;
- }
- return 1;
+ return bary_zero_p(BDIGITS(x), BIGNUM_LEN(x));
}
int
@@ -105,9 +2917,9 @@ rb_cmpint(VALUE val, VALUE a, VALUE b)
if (l < 0) return -1;
return 0;
}
- if (RB_TYPE_P(val, T_BIGNUM)) {
+ if (RB_BIGNUM_TYPE_P(val)) {
if (BIGZEROP(val)) return 0;
- if (RBIGNUM_SIGN(val)) return 1;
+ if (BIGNUM_SIGN(val)) return 1;
return -1;
}
if (RTEST(rb_funcall(val, '>', 1, INT2FIX(0)))) return 1;
@@ -115,38 +2927,39 @@ rb_cmpint(VALUE val, VALUE a, VALUE b)
return 0;
}
-#define RBIGNUM_SET_LEN(b,l) \
- ((RBASIC(b)->flags & RBIGNUM_EMBED_FLAG) ? \
+#define BIGNUM_SET_LEN(b,l) \
+ ((RBASIC(b)->flags & BIGNUM_EMBED_FLAG) ? \
(void)(RBASIC(b)->flags = \
- (RBASIC(b)->flags & ~RBIGNUM_EMBED_LEN_MASK) | \
- ((l) << RBIGNUM_EMBED_LEN_SHIFT)) : \
+ (RBASIC(b)->flags & ~BIGNUM_EMBED_LEN_MASK) | \
+ ((l) << BIGNUM_EMBED_LEN_SHIFT)) : \
(void)(RBIGNUM(b)->as.heap.len = (l)))
static void
-rb_big_realloc(VALUE big, long len)
+rb_big_realloc(VALUE big, size_t len)
{
BDIGIT *ds;
- if (RBASIC(big)->flags & RBIGNUM_EMBED_FLAG) {
- if (RBIGNUM_EMBED_LEN_MAX < len) {
+ if (RBASIC(big)->flags & BIGNUM_EMBED_FLAG) {
+ if (BIGNUM_EMBED_LEN_MAX < len) {
ds = ALLOC_N(BDIGIT, len);
- MEMCPY(ds, RBIGNUM(big)->as.ary, BDIGIT, RBIGNUM_EMBED_LEN_MAX);
- RBIGNUM(big)->as.heap.len = RBIGNUM_LEN(big);
+ MEMCPY(ds, RBIGNUM(big)->as.ary, BDIGIT, BIGNUM_EMBED_LEN_MAX);
+ RBIGNUM(big)->as.heap.len = BIGNUM_LEN(big);
RBIGNUM(big)->as.heap.digits = ds;
- RBASIC(big)->flags &= ~RBIGNUM_EMBED_FLAG;
+ RBASIC(big)->flags &= ~BIGNUM_EMBED_FLAG;
}
}
else {
- if (len <= RBIGNUM_EMBED_LEN_MAX) {
+ if (len <= BIGNUM_EMBED_LEN_MAX) {
ds = RBIGNUM(big)->as.heap.digits;
- RBASIC(big)->flags |= RBIGNUM_EMBED_FLAG;
- RBIGNUM_SET_LEN(big, len);
+ RBASIC(big)->flags |= BIGNUM_EMBED_FLAG;
+ BIGNUM_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);
xfree(ds);
}
}
else {
- if (RBIGNUM_LEN(big) == 0) {
+ if (BIGNUM_LEN(big) == 0) {
RBIGNUM(big)->as.heap.digits = ALLOC_N(BDIGIT, len);
}
else {
@@ -157,20 +2970,21 @@ rb_big_realloc(VALUE big, long len)
}
void
-rb_big_resize(VALUE big, long len)
+rb_big_resize(VALUE big, size_t len)
{
rb_big_realloc(big, len);
- RBIGNUM_SET_LEN(big, len);
+ BIGNUM_SET_LEN(big, len);
}
static VALUE
-bignew_1(VALUE klass, long len, int sign)
+bignew_1(VALUE klass, size_t len, int sign)
{
- NEWOBJ_OF(big, struct RBignum, klass, T_BIGNUM);
- RBIGNUM_SET_SIGN(big, sign?1:0);
- if (len <= RBIGNUM_EMBED_LEN_MAX) {
- RBASIC(big)->flags |= RBIGNUM_EMBED_FLAG;
- RBIGNUM_SET_LEN(big, len);
+ 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);
+ (void)VALGRIND_MAKE_MEM_UNDEFINED((void*)RBIGNUM(big)->as.ary, sizeof(RBIGNUM(big)->as.ary));
}
else {
RBIGNUM(big)->as.heap.digits = ALLOC_N(BDIGIT, len);
@@ -180,10 +2994,8 @@ bignew_1(VALUE klass, long len, int sign)
return (VALUE)big;
}
-#define bignew(len,sign) bignew_1(rb_cBignum,(len),(sign))
-
VALUE
-rb_big_new(long len, int sign)
+rb_big_new(size_t len, int sign)
{
return bignew(len, sign != 0);
}
@@ -191,33 +3003,29 @@ rb_big_new(long len, int sign)
VALUE
rb_big_clone(VALUE x)
{
- long len = RBIGNUM_LEN(x);
- VALUE z = bignew_1(CLASS_OF(x), len, RBIGNUM_SIGN(x));
+ size_t len = BIGNUM_LEN(x);
+ VALUE z = bignew_1(CLASS_OF(x), len, BIGNUM_SIGN(x));
MEMCPY(BDIGITS(z), BDIGITS(x), BDIGIT, len);
return z;
}
+static void
+big_extend_carry(VALUE x)
+{
+ rb_big_resize(x, BIGNUM_LEN(x)+1);
+ BDIGITS(x)[BIGNUM_LEN(x)-1] = 1;
+}
+
/* modify a bignum by 2's complement */
static void
get2comp(VALUE x)
{
- long i = RBIGNUM_LEN(x);
+ long i = BIGNUM_LEN(x);
BDIGIT *ds = BDIGITS(x);
- BDIGIT_DBL num;
- if (!i) return;
- while (i--) ds[i] = ~ds[i];
- i = 0; num = 1;
- do {
- num += ds[i];
- ds[i++] = BIGLO(num);
- num = BIGDN(num);
- } while (i < RBIGNUM_LEN(x));
- if (num != 0) {
- rb_big_resize(x, RBIGNUM_LEN(x)+1);
- ds = BDIGITS(x);
- ds[RBIGNUM_LEN(x)-1] = 1;
+ if (bary_2comp(ds, i)) {
+ big_extend_carry(x);
}
}
@@ -227,15 +3035,45 @@ rb_big_2comp(VALUE x) /* get 2's complement */
get2comp(x);
}
+static BDIGIT
+abs2twocomp(VALUE *xp, long *n_ret)
+{
+ VALUE x = *xp;
+ long n = BIGNUM_LEN(x);
+ BDIGIT *ds = BDIGITS(x);
+ BDIGIT hibits = 0;
+
+ BARY_TRUNC(ds, n);
+
+ if (n != 0 && BIGNUM_NEGATIVE_P(x)) {
+ VALUE z = bignew_1(CLASS_OF(x), n, 0);
+ MEMCPY(BDIGITS(z), ds, BDIGIT, n);
+ bary_2comp(BDIGITS(z), n);
+ hibits = BDIGMAX;
+ *xp = z;
+ }
+ *n_ret = n;
+ return hibits;
+}
+
+static void
+twocomp2abs_bang(VALUE x, int hibits)
+{
+ BIGNUM_SET_SIGN(x, !hibits);
+ if (hibits) {
+ get2comp(x);
+ }
+}
+
static inline VALUE
bigtrunc(VALUE x)
{
- long len = RBIGNUM_LEN(x);
+ size_t len = BIGNUM_LEN(x);
BDIGIT *ds = BDIGITS(x);
if (len == 0) return x;
while (--len && !ds[len]);
- if (RBIGNUM_LEN(x) > len+1) {
+ if (BIGNUM_LEN(x) > len+1) {
rb_big_resize(x, len+1);
}
return x;
@@ -244,36 +3082,52 @@ bigtrunc(VALUE x)
static inline VALUE
bigfixize(VALUE x)
{
- long len = RBIGNUM_LEN(x);
+ size_t n = BIGNUM_LEN(x);
BDIGIT *ds = BDIGITS(x);
-
- if (len == 0) return INT2FIX(0);
- if ((size_t)(len*SIZEOF_BDIGITS) <= sizeof(long)) {
- long num = 0;
-#if 2*SIZEOF_BDIGITS > SIZEOF_LONG
- num = (long)ds[0];
+#if SIZEOF_BDIGIT < SIZEOF_LONG
+ unsigned long u;
#else
- while (len--) {
- num = (long)(BIGUP(num) + ds[len]);
- }
+ BDIGIT u;
#endif
- if (num >= 0) {
- if (RBIGNUM_SIGN(x)) {
- if (POSFIXABLE(num)) return LONG2FIX(num);
- }
- else {
- if (NEGFIXABLE(-num)) return LONG2FIX(-num);
- }
- }
+
+ BARY_TRUNC(ds, n);
+
+ if (n == 0) return INT2FIX(0);
+
+#if SIZEOF_BDIGIT < SIZEOF_LONG
+ if (sizeof(long)/SIZEOF_BDIGIT < n)
+ goto return_big;
+ else {
+ int i = (int)n;
+ u = 0;
+ while (i--) {
+ u = (unsigned long)(BIGUP(u) + ds[i]);
+ }
+ }
+#else /* SIZEOF_BDIGIT >= SIZEOF_LONG */
+ if (1 < n)
+ goto return_big;
+ else
+ u = ds[0];
+#endif
+
+ if (BIGNUM_POSITIVE_P(x)) {
+ if (POSFIXABLE(u)) return LONG2FIX((long)u);
+ }
+ else {
+ if (u <= -FIXNUM_MIN) return LONG2FIX(-(long)u);
}
+
+ return_big:
+ rb_big_resize(x, n);
return x;
}
static VALUE
bignorm(VALUE x)
{
- if (RB_TYPE_P(x, T_BIGNUM)) {
- x = bigfixize(bigtrunc(x));
+ if (RB_BIGNUM_TYPE_P(x)) {
+ x = bigfixize(x);
}
return x;
}
@@ -287,21 +3141,22 @@ rb_big_norm(VALUE x)
VALUE
rb_uint2big(VALUE n)
{
- BDIGIT_DBL num = n;
- long i = 0;
- BDIGIT *digits;
- VALUE big;
+ long i;
+ VALUE big = bignew(bdigit_roomof(SIZEOF_VALUE), 1);
+ BDIGIT *digits = BDIGITS(big);
- big = bignew(DIGSPERLONG, 1);
- digits = BDIGITS(big);
- while (i < DIGSPERLONG) {
- digits[i++] = BIGLO(num);
- num = BIGDN(num);
+#if SIZEOF_BDIGIT >= SIZEOF_VALUE
+ digits[0] = n;
+#else
+ for (i = 0; i < bdigit_roomof(SIZEOF_VALUE); i++) {
+ digits[i] = BIGLO(n);
+ n = BIGDN(n);
}
+#endif
- i = DIGSPERLONG;
+ i = bdigit_roomof(SIZEOF_VALUE);
while (--i && !digits[i]) ;
- RBIGNUM_SET_LEN(big, i+1);
+ BIGNUM_SET_LEN(big, i+1);
return big;
}
@@ -321,7 +3176,7 @@ rb_int2big(SIGNED_VALUE n)
}
big = rb_uint2big(u);
if (neg) {
- RBIGNUM_SET_SIGN(big, 0);
+ BIGNUM_SET_SIGN(big, 0);
}
return big;
}
@@ -340,265 +3195,770 @@ rb_int2inum(SIGNED_VALUE n)
return rb_int2big(n);
}
-#if SIZEOF_LONG % SIZEOF_BDIGITS != 0
-# error unexpected SIZEOF_LONG : SIZEOF_BDIGITS ratio
-#endif
+void
+rb_big_pack(VALUE val, unsigned long *buf, long num_longs)
+{
+ rb_integer_pack(val, buf, num_longs, sizeof(long), 0,
+ INTEGER_PACK_LSWORD_FIRST|INTEGER_PACK_NATIVE_BYTE_ORDER|
+ INTEGER_PACK_2COMP);
+}
+
+VALUE
+rb_big_unpack(unsigned long *buf, long num_longs)
+{
+ return rb_integer_unpack(buf, num_longs, sizeof(long), 0,
+ INTEGER_PACK_LSWORD_FIRST|INTEGER_PACK_NATIVE_BYTE_ORDER|
+ INTEGER_PACK_2COMP);
+}
/*
- * buf is an array of long integers.
- * buf is ordered from least significant word to most significant word.
- * buf[0] is the least significant word and
- * buf[num_longs-1] is the most significant word.
- * This means words in buf is little endian.
- * However each word in buf is native endian.
- * (buf[i]&1) is the least significant bit and
- * (buf[i]&(1<<(SIZEOF_LONG*CHAR_BIT-1))) is the most significant bit
- * for each 0 <= i < num_longs.
- * So buf is little endian at whole on a little endian machine.
- * But buf is mixed endian on a big endian machine.
- *
- * The buf represents negative integers as two's complement.
- * So, the most significant bit of the most significant word,
- * (buf[num_longs-1]>>(SIZEOF_LONG*CHAR_BIT-1)),
- * is the sign bit: 1 means negative and 0 means zero or positive.
- *
- * If given size of buf (num_longs) is not enough to represent val,
- * higier words (including a sign bit) are ignored.
+ * Calculate the number of bytes to be required to represent
+ * the absolute value of the integer given as _val_.
+ *
+ * [val] an integer.
+ * [nlz_bits_ret] number of leading zero bits in the most significant byte is returned if not NULL.
+ *
+ * This function returns ((val_numbits * CHAR_BIT + CHAR_BIT - 1) / CHAR_BIT)
+ * where val_numbits is the number of bits of abs(val).
+ * This function should not overflow.
+ *
+ * If nlz_bits_ret is not NULL,
+ * (return_value * CHAR_BIT - val_numbits) is stored in *nlz_bits_ret.
+ * In this case, 0 <= *nlz_bits_ret < CHAR_BIT.
+ *
*/
-void
-rb_big_pack(VALUE val, unsigned long *buf, long num_longs)
+size_t
+rb_absint_size(VALUE val, int *nlz_bits_ret)
{
+ BDIGIT *dp;
+ BDIGIT *de;
+ BDIGIT fixbuf[bdigit_roomof(sizeof(long))];
+
+ int num_leading_zeros;
+
val = rb_to_int(val);
- if (num_longs == 0)
- return;
+
if (FIXNUM_P(val)) {
- long i;
- long tmp = FIX2LONG(val);
- buf[0] = (unsigned long)tmp;
- tmp = tmp < 0 ? ~0L : 0;
- for (i = 1; i < num_longs; i++)
- buf[i] = (unsigned long)tmp;
- return;
- }
- else {
- long len = RBIGNUM_LEN(val);
- BDIGIT *ds = BDIGITS(val), *dend = ds + len;
- long i, j;
- for (i = 0; i < num_longs && ds < dend; i++) {
- unsigned long l = 0;
- for (j = 0; j < DIGSPERLONG && ds < dend; j++, ds++) {
- l |= ((unsigned long)*ds << (j * BITSPERDIG));
- }
- buf[i] = l;
+ long v = FIX2LONG(val);
+ if (v < 0) {
+ v = -v;
}
- for (; i < num_longs; i++)
- buf[i] = 0;
- if (RBIGNUM_NEGATIVE_P(val)) {
- for (i = 0; i < num_longs; i++) {
- buf[i] = ~buf[i];
- }
- for (i = 0; i < num_longs; i++) {
- buf[i]++;
- if (buf[i] != 0)
- return;
+#if SIZEOF_BDIGIT >= SIZEOF_LONG
+ fixbuf[0] = v;
+#else
+ {
+ int i;
+ for (i = 0; i < numberof(fixbuf); i++) {
+ fixbuf[i] = BIGLO(v);
+ v = BIGDN(v);
}
}
+#endif
+ dp = fixbuf;
+ de = fixbuf + numberof(fixbuf);
+ }
+ else {
+ dp = BDIGITS(val);
+ de = dp + BIGNUM_LEN(val);
+ }
+ while (dp < de && de[-1] == 0)
+ de--;
+ if (dp == de) {
+ if (nlz_bits_ret)
+ *nlz_bits_ret = 0;
+ return 0;
+ }
+ 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;
+}
+
+static size_t
+absint_numwords_small(size_t numbytes, int nlz_bits_in_msbyte, size_t word_numbits, size_t *nlz_bits_ret)
+{
+ size_t val_numbits = numbytes * CHAR_BIT - nlz_bits_in_msbyte;
+ size_t div = val_numbits / word_numbits;
+ size_t mod = val_numbits % word_numbits;
+ size_t numwords;
+ size_t nlz_bits;
+ numwords = mod == 0 ? div : div + 1;
+ nlz_bits = mod == 0 ? 0 : word_numbits - mod;
+ *nlz_bits_ret = nlz_bits;
+ return numwords;
+}
+
+static size_t
+absint_numwords_generic(size_t numbytes, int nlz_bits_in_msbyte, size_t word_numbits, size_t *nlz_bits_ret)
+{
+ 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] = { 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)];
+ BDIGIT one[1] = { 1 };
+ size_t nlz_bits;
+ size_t mod;
+ int sign;
+ size_t numwords;
+
+ /*
+ * val_numbits = numbytes * CHAR_BIT - nlz_bits_in_msbyte
+ * div, mod = val_numbits.divmod(word_numbits)
+ * numwords = mod == 0 ? div : div + 1
+ * nlz_bits = mod == 0 ? 0 : word_numbits - mod
+ */
+
+ bary_unpack(BARY_ARGS(numbytes_bary), &numbytes, 1, sizeof(numbytes), 0,
+ INTEGER_PACK_NATIVE_BYTE_ORDER);
+ BARY_SHORT_MUL(val_numbits_bary, numbytes_bary, char_bit);
+ if (nlz_bits_in_msbyte)
+ BARY_SUB(val_numbits_bary, val_numbits_bary, nlz_bits_in_msbyte_bary);
+ bary_unpack(BARY_ARGS(word_numbits_bary), &word_numbits, 1, sizeof(word_numbits), 0,
+ INTEGER_PACK_NATIVE_BYTE_ORDER);
+ BARY_DIVMOD(div_bary, mod_bary, val_numbits_bary, word_numbits_bary);
+ if (BARY_ZERO_P(mod_bary)) {
+ nlz_bits = 0;
+ }
+ else {
+ BARY_ADD(div_bary, div_bary, one);
+ bary_pack(+1, BARY_ARGS(mod_bary), &mod, 1, sizeof(mod), 0,
+ INTEGER_PACK_NATIVE_BYTE_ORDER);
+ nlz_bits = word_numbits - mod;
+ }
+ sign = bary_pack(+1, BARY_ARGS(div_bary), &numwords, 1, sizeof(numwords), 0,
+ INTEGER_PACK_NATIVE_BYTE_ORDER);
+
+ if (sign == 2) {
+#if defined __GNUC__ && (__GNUC__ == 4 && __GNUC_MINOR__ == 4)
+ *nlz_bits_ret = 0;
+#endif
+ return (size_t)-1;
+ }
+ *nlz_bits_ret = nlz_bits;
+ return numwords;
+}
+
+/*
+ * Calculate the number of words to be required to represent
+ * the absolute value of the integer given as _val_.
+ *
+ * [val] an integer.
+ * [word_numbits] number of bits in a word.
+ * [nlz_bits_ret] number of leading zero bits in the most significant word is returned if not NULL.
+ *
+ * This function returns ((val_numbits * CHAR_BIT + word_numbits - 1) / word_numbits)
+ * where val_numbits is the number of bits of abs(val).
+ *
+ * This function can overflow.
+ * When overflow occur, (size_t)-1 is returned.
+ *
+ * If nlz_bits_ret is not NULL and overflow is not occur,
+ * (return_value * word_numbits - val_numbits) is stored in *nlz_bits_ret.
+ * In this case, 0 <= *nlz_bits_ret < word_numbits.
+ *
+ */
+size_t
+rb_absint_numwords(VALUE val, size_t word_numbits, size_t *nlz_bits_ret)
+{
+ size_t numbytes;
+ int nlz_bits_in_msbyte;
+ size_t numwords;
+ size_t nlz_bits;
+
+ if (word_numbits == 0)
+ return (size_t)-1;
+
+ numbytes = rb_absint_size(val, &nlz_bits_in_msbyte);
+
+ if (numbytes <= SIZE_MAX / CHAR_BIT) {
+ numwords = absint_numwords_small(numbytes, nlz_bits_in_msbyte, word_numbits, &nlz_bits);
+#ifdef DEBUG_INTEGER_PACK
+ {
+ size_t numwords0, nlz_bits0;
+ numwords0 = absint_numwords_generic(numbytes, nlz_bits_in_msbyte, word_numbits, &nlz_bits0);
+ assert(numwords0 == numwords);
+ assert(nlz_bits0 == nlz_bits);
+ }
+#endif
+ }
+ else {
+ numwords = absint_numwords_generic(numbytes, nlz_bits_in_msbyte, word_numbits, &nlz_bits);
}
+ if (numwords == (size_t)-1)
+ return numwords;
+
+ if (nlz_bits_ret)
+ *nlz_bits_ret = nlz_bits;
+
+ return numwords;
}
-/* See rb_big_pack comment for endianness and sign of buf. */
-VALUE
-rb_big_unpack(unsigned long *buf, long num_longs)
+/* Test abs(val) consists only a bit or not.
+ *
+ * Returns 1 if abs(val) == 1 << n for some n >= 0.
+ * Returns 0 otherwise.
+ *
+ * rb_absint_singlebit_p can be used to determine required buffer size
+ * for rb_integer_pack used with INTEGER_PACK_2COMP (two's complement).
+ *
+ * Following example calculates number of bits required to
+ * 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);
+ * size = rb_absint_numwords(val, 1, NULL)
+ * if (size == (size_t)-1) ...overflow...
+ * if (neg && rb_absint_singlebit_p(val))
+ * size--;
+ *
+ * Following example calculates number of bytes required to
+ * 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 nlz_bits;
+ * size = rb_absint_size(val, &nlz_bits);
+ * if (nlz_bits == 0 && !(neg && rb_absint_singlebit_p(val)))
+ * size++;
+ */
+int
+rb_absint_singlebit_p(VALUE val)
{
- while (2 <= num_longs) {
- if (buf[num_longs-1] == 0 && (long)buf[num_longs-2] >= 0)
- num_longs--;
- else if (buf[num_longs-1] == ~0UL && (long)buf[num_longs-2] < 0)
- num_longs--;
- else
- break;
- }
- if (num_longs == 0)
- return INT2FIX(0);
- else if (num_longs == 1)
- return LONG2NUM((long)buf[0]);
- else {
- VALUE big;
- BDIGIT *ds;
- long len = num_longs * DIGSPERLONG;
- long i;
- big = bignew(len, 1);
- ds = BDIGITS(big);
- for (i = 0; i < num_longs; i++) {
- unsigned long d = buf[i];
-#if SIZEOF_LONG == SIZEOF_BDIGITS
- *ds++ = d;
+ BDIGIT *dp;
+ BDIGIT *de;
+ BDIGIT fixbuf[bdigit_roomof(sizeof(long))];
+ BDIGIT d;
+
+ val = rb_to_int(val);
+
+ if (FIXNUM_P(val)) {
+ long v = FIX2LONG(val);
+ if (v < 0) {
+ v = -v;
+ }
+#if SIZEOF_BDIGIT >= SIZEOF_LONG
+ fixbuf[0] = v;
#else
- int j;
- for (j = 0; j < DIGSPERLONG; j++) {
- *ds++ = BIGLO(d);
- d = BIGDN(d);
+ {
+ int i;
+ for (i = 0; i < numberof(fixbuf); i++) {
+ fixbuf[i] = BIGLO(v);
+ v = BIGDN(v);
}
-#endif
- }
- if ((long)buf[num_longs-1] < 0) {
- get2comp(big);
- RBIGNUM_SET_SIGN(big, 0);
}
- return bignorm(big);
+#endif
+ dp = fixbuf;
+ de = fixbuf + numberof(fixbuf);
}
+ else {
+ dp = BDIGITS(val);
+ de = dp + BIGNUM_LEN(val);
+ }
+ while (dp < de && de[-1] == 0)
+ de--;
+ while (dp < de && dp[0] == 0)
+ dp++;
+ if (dp == de) /* no bit set. */
+ return 0;
+ if (dp != de-1) /* two non-zero words. two bits set, at least. */
+ return 0;
+ d = *dp;
+ return POW2_P(d);
}
-#define QUAD_SIZE 8
-#if SIZEOF_LONG_LONG == QUAD_SIZE && SIZEOF_BDIGITS*2 == SIZEOF_LONG_LONG
+/*
+ * Export an integer into a buffer.
+ *
+ * This function fills the buffer specified by _words_ and _numwords_ as
+ * val in the format specified by _wordsize_, _nails_ and _flags_.
+ *
+ * [val] Fixnum, Bignum or another integer like object which has to_int method.
+ * [words] buffer to export abs(val).
+ * [numwords] the size of given buffer as number of words.
+ * [wordsize] the size of word as number of bytes.
+ * [nails] number of padding bits in a word.
+ * Most significant nails bits of each word are filled by zero.
+ * [flags] bitwise or of constants which name starts "INTEGER_PACK_".
+ *
+ * flags:
+ * [INTEGER_PACK_MSWORD_FIRST] Store the most significant word as the first word.
+ * [INTEGER_PACK_LSWORD_FIRST] Store the least significant word as the first word.
+ * [INTEGER_PACK_MSBYTE_FIRST] Store the most significant byte in a word as the first byte in the word.
+ * [INTEGER_PACK_LSBYTE_FIRST] Store the least significant byte in a word as the first byte in the word.
+ * [INTEGER_PACK_NATIVE_BYTE_ORDER] INTEGER_PACK_MSBYTE_FIRST or INTEGER_PACK_LSBYTE_FIRST corresponding to the host's endian.
+ * [INTEGER_PACK_2COMP] Use 2's complement representation.
+ * [INTEGER_PACK_LITTLE_ENDIAN] Same as INTEGER_PACK_LSWORD_FIRST|INTEGER_PACK_LSBYTE_FIRST
+ * [INTEGER_PACK_BIG_ENDIAN] Same as INTEGER_PACK_MSWORD_FIRST|INTEGER_PACK_MSBYTE_FIRST
+ * [INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION] Use generic implementation (for test and debug).
+ *
+ * This function fills the buffer specified by _words_
+ * as abs(val) if INTEGER_PACK_2COMP is not specified in _flags_.
+ * If INTEGER_PACK_2COMP is specified, 2's complement representation of val is
+ * filled in the buffer.
+ *
+ * This function returns the signedness and overflow condition.
+ * The overflow condition depends on INTEGER_PACK_2COMP.
+ *
+ * INTEGER_PACK_2COMP is not specified:
+ * -2 : negative overflow. val <= -2**(numwords*(wordsize*CHAR_BIT-nails))
+ * -1 : negative without overflow. -2**(numwords*(wordsize*CHAR_BIT-nails)) < val < 0
+ * 0 : zero. val == 0
+ * 1 : positive without overflow. 0 < val < 2**(numwords*(wordsize*CHAR_BIT-nails))
+ * 2 : positive overflow. 2**(numwords*(wordsize*CHAR_BIT-nails)) <= val
+ *
+ * INTEGER_PACK_2COMP is specified:
+ * -2 : negative overflow. val < -2**(numwords*(wordsize*CHAR_BIT-nails))
+ * -1 : negative without overflow. -2**(numwords*(wordsize*CHAR_BIT-nails)) <= val < 0
+ * 0 : zero. val == 0
+ * 1 : positive without overflow. 0 < val < 2**(numwords*(wordsize*CHAR_BIT-nails))
+ * 2 : positive overflow. 2**(numwords*(wordsize*CHAR_BIT-nails)) <= val
+ *
+ * The value, -2**(numwords*(wordsize*CHAR_BIT-nails)), is representable
+ * in 2's complement representation but not representable in absolute value.
+ * So -1 is returned for the value if INTEGER_PACK_2COMP is specified
+ * but returns -2 if INTEGER_PACK_2COMP is not specified.
+ *
+ * The least significant words are filled in the buffer when overflow occur.
+ */
-void
-rb_quad_pack(char *buf, VALUE val)
+int
+rb_integer_pack(VALUE val, void *words, size_t numwords, size_t wordsize, size_t nails, int flags)
{
- LONG_LONG q;
+ int sign;
+ BDIGIT *ds;
+ size_t num_bdigits;
+ BDIGIT fixbuf[bdigit_roomof(sizeof(long))];
+
+ RB_GC_GUARD(val) = rb_to_int(val);
- val = rb_to_int(val);
if (FIXNUM_P(val)) {
- q = FIX2LONG(val);
+ long v = FIX2LONG(val);
+ if (v < 0) {
+ sign = -1;
+ v = -v;
+ }
+ else {
+ sign = 1;
+ }
+#if SIZEOF_BDIGIT >= SIZEOF_LONG
+ fixbuf[0] = v;
+#else
+ {
+ int i;
+ for (i = 0; i < numberof(fixbuf); i++) {
+ fixbuf[i] = BIGLO(v);
+ v = BIGDN(v);
+ }
+ }
+#endif
+ ds = fixbuf;
+ num_bdigits = numberof(fixbuf);
}
else {
- long len = RBIGNUM_LEN(val);
- BDIGIT *ds;
-
- if (len > SIZEOF_LONG_LONG/SIZEOF_BDIGITS) {
- len = SIZEOF_LONG_LONG/SIZEOF_BDIGITS;
- }
- ds = BDIGITS(val);
- q = 0;
- while (len--) {
- q = BIGUP(q);
- q += ds[len];
- }
- if (!RBIGNUM_SIGN(val)) q = -q;
+ sign = BIGNUM_POSITIVE_P(val) ? 1 : -1;
+ ds = BDIGITS(val);
+ num_bdigits = BIGNUM_LEN(val);
}
- memcpy(buf, (char*)&q, SIZEOF_LONG_LONG);
+
+ return bary_pack(sign, ds, num_bdigits, words, numwords, wordsize, nails, flags);
}
+/*
+ * Import an integer into a buffer.
+ *
+ * [words] buffer to import.
+ * [numwords] the size of given buffer as number of words.
+ * [wordsize] the size of word as number of bytes.
+ * [nails] number of padding bits in a word.
+ * Most significant nails bits of each word are ignored.
+ * [flags] bitwise or of constants which name starts "INTEGER_PACK_".
+ *
+ * flags:
+ * [INTEGER_PACK_MSWORD_FIRST] Interpret the first word as the most significant word.
+ * [INTEGER_PACK_LSWORD_FIRST] Interpret the first word as the least significant word.
+ * [INTEGER_PACK_MSBYTE_FIRST] Interpret the first byte in a word as the most significant byte in the word.
+ * [INTEGER_PACK_LSBYTE_FIRST] Interpret the first byte in a word as the least significant byte in the word.
+ * [INTEGER_PACK_NATIVE_BYTE_ORDER] INTEGER_PACK_MSBYTE_FIRST or INTEGER_PACK_LSBYTE_FIRST corresponding to the host's endian.
+ * [INTEGER_PACK_2COMP] Use 2's complement representation.
+ * [INTEGER_PACK_LITTLE_ENDIAN] Same as INTEGER_PACK_LSWORD_FIRST|INTEGER_PACK_LSBYTE_FIRST
+ * [INTEGER_PACK_BIG_ENDIAN] Same as INTEGER_PACK_MSWORD_FIRST|INTEGER_PACK_MSBYTE_FIRST
+ * [INTEGER_PACK_FORCE_BIGNUM] the result will be a Bignum
+ * even if it is representable as a Fixnum.
+ * [INTEGER_PACK_NEGATIVE] Returns non-positive value.
+ * (Returns non-negative value if not specified.)
+ * [INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION] Use generic implementation (for test and debug).
+ *
+ * This function returns the imported integer as Fixnum or Bignum.
+ *
+ * The range of the result value depends on INTEGER_PACK_2COMP and INTEGER_PACK_NEGATIVE.
+ *
+ * INTEGER_PACK_2COMP is not set:
+ * 0 <= val < 2**(numwords*(wordsize*CHAR_BIT-nails)) if !INTEGER_PACK_NEGATIVE
+ * -2**(numwords*(wordsize*CHAR_BIT-nails)) < val <= 0 if INTEGER_PACK_NEGATIVE
+ *
+ * INTEGER_PACK_2COMP is set:
+ * -2**(numwords*(wordsize*CHAR_BIT-nails)-1) <= val <= 2**(numwords*(wordsize*CHAR_BIT-nails)-1)-1 if !INTEGER_PACK_NEGATIVE
+ * -2**(numwords*(wordsize*CHAR_BIT-nails)) <= val <= -1 if INTEGER_PACK_NEGATIVE
+ *
+ * INTEGER_PACK_2COMP without INTEGER_PACK_NEGATIVE means sign extension.
+ * INTEGER_PACK_2COMP with INTEGER_PACK_NEGATIVE mean assuming the higher bits are 1.
+ *
+ * Note that this function returns 0 when numwords is zero and
+ * INTEGER_PACK_2COMP is set but INTEGER_PACK_NEGATIVE is not set.
+ */
+
VALUE
-rb_quad_unpack(const char *buf, int sign)
+rb_integer_unpack(const void *words, size_t numwords, size_t wordsize, size_t nails, int flags)
{
- unsigned LONG_LONG q;
- long neg = 0;
- long i;
- BDIGIT *digits;
- VALUE big;
-
- memcpy(&q, buf, SIZEOF_LONG_LONG);
- if (sign) {
- if (FIXABLE((LONG_LONG)q)) return LONG2FIX((LONG_LONG)q);
- if ((LONG_LONG)q < 0) {
- q = -(LONG_LONG)q;
- neg = 1;
- }
+ VALUE val;
+ size_t num_bdigits;
+ int sign;
+ int nlp_bits;
+ BDIGIT *ds;
+ BDIGIT fixbuf[2] = { 0, 0 };
+
+ validate_integer_pack_format(numwords, wordsize, nails, flags,
+ INTEGER_PACK_MSWORD_FIRST|
+ INTEGER_PACK_LSWORD_FIRST|
+ INTEGER_PACK_MSBYTE_FIRST|
+ INTEGER_PACK_LSBYTE_FIRST|
+ INTEGER_PACK_NATIVE_BYTE_ORDER|
+ INTEGER_PACK_2COMP|
+ INTEGER_PACK_FORCE_BIGNUM|
+ INTEGER_PACK_NEGATIVE|
+ INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION);
+
+ num_bdigits = integer_unpack_num_bdigits(numwords, wordsize, nails, &nlp_bits);
+
+ if (LONG_MAX-1 < num_bdigits)
+ rb_raise(rb_eArgError, "too big to unpack as an integer");
+ if (num_bdigits <= numberof(fixbuf) && !(flags & INTEGER_PACK_FORCE_BIGNUM)) {
+ val = Qfalse;
+ ds = fixbuf;
}
else {
- if (POSFIXABLE(q)) return LONG2FIX(q);
+ val = bignew((long)num_bdigits, 0);
+ ds = BDIGITS(val);
}
+ sign = bary_unpack_internal(ds, num_bdigits, words, numwords, wordsize, nails, flags, nlp_bits);
- i = 0;
- big = bignew(DIGSPERLL, 1);
- digits = BDIGITS(big);
- while (i < DIGSPERLL) {
- digits[i++] = BIGLO(q);
- q = BIGDN(q);
+ if (sign == -2) {
+ if (val) {
+ big_extend_carry(val);
+ }
+ else if (num_bdigits == numberof(fixbuf)) {
+ val = bignew((long)num_bdigits+1, 0);
+ MEMCPY(BDIGITS(val), fixbuf, BDIGIT, num_bdigits);
+ BDIGITS(val)[num_bdigits++] = 1;
+ }
+ else {
+ ds[num_bdigits++] = 1;
+ }
}
- i = DIGSPERLL;
- while (i-- && !digits[i]) ;
- RBIGNUM_SET_LEN(big, i+1);
-
- if (neg) {
- RBIGNUM_SET_SIGN(big, 0);
+ if (!val) {
+ BDIGIT_DBL u = fixbuf[0] + BIGUP(fixbuf[1]);
+ if (u == 0)
+ return LONG2FIX(0);
+ if (0 < sign && POSFIXABLE(u))
+ return LONG2FIX(u);
+ if (sign < 0 && BDIGIT_MSB(fixbuf[1]) == 0 &&
+ NEGFIXABLE(-(BDIGIT_DBL_SIGNED)u))
+ return LONG2FIX(-(BDIGIT_DBL_SIGNED)u);
+ val = bignew((long)num_bdigits, 0 <= sign);
+ MEMCPY(BDIGITS(val), fixbuf, BDIGIT, num_bdigits);
}
- return bignorm(big);
+
+ if ((flags & INTEGER_PACK_FORCE_BIGNUM) && sign != 0 &&
+ bary_zero_p(BDIGITS(val), BIGNUM_LEN(val)))
+ sign = 0;
+ BIGNUM_SET_SIGN(val, 0 <= sign);
+
+ if (flags & INTEGER_PACK_FORCE_BIGNUM)
+ return bigtrunc(val);
+ return bignorm(val);
}
-#else
+#define conv_digit(c) (ruby_digit36_to_number_table[(unsigned char)(c)])
-static int
-quad_buf_complement(char *buf, size_t len)
+static void
+str2big_scan_digits(const char *s, const char *str, int base, int badcheck, size_t *num_digits_p, size_t *len_p)
{
- size_t i;
- for (i = 0; i < len; i++)
- buf[i] = ~buf[i];
- for (i = 0; i < len; i++) {
- buf[i]++;
- if (buf[i] != 0)
- return 0;
+ char nondigit = 0;
+ size_t num_digits = 0;
+ const char *digits_start = str;
+ const char *digits_end = str;
+
+ int c;
+
+ if (badcheck && *str == '_') goto bad;
+
+ while ((c = *str++) != 0) {
+ if (c == '_') {
+ if (nondigit) {
+ if (badcheck) goto bad;
+ break;
+ }
+ nondigit = (char) c;
+ continue;
+ }
+ else if ((c = conv_digit(c)) < 0) {
+ break;
+ }
+ if (c >= base) break;
+ nondigit = 0;
+ num_digits++;
+ digits_end = str;
}
- return 1;
+ if (badcheck) {
+ str--;
+ if (s+1 < str && str[-1] == '_') goto bad;
+ while (*str && ISSPACE(*str)) str++;
+ if (*str) {
+ bad:
+ rb_invalid_str(s, "Integer()");
+ }
+ }
+ *num_digits_p = num_digits;
+ *len_p = digits_end - digits_start;
}
-void
-rb_quad_pack(char *buf, VALUE val)
-{
- long len;
+static VALUE
+str2big_poweroftwo(
+ int sign,
+ const char *digits_start,
+ const char *digits_end,
+ size_t num_digits,
+ int bits_per_digit)
+{
+ BDIGIT *dp;
+ BDIGIT_DBL dd;
+ int numbits;
+
+ size_t num_bdigits;
+ const char *p;
+ int c;
+ VALUE z;
- memset(buf, 0, QUAD_SIZE);
- val = rb_to_int(val);
- if (FIXNUM_P(val)) {
- val = rb_int2big(FIX2LONG(val));
+ num_bdigits = (num_digits / BITSPERDIG) * bits_per_digit + roomof((num_digits % BITSPERDIG) * bits_per_digit, BITSPERDIG);
+ z = bignew(num_bdigits, sign);
+ dp = BDIGITS(z);
+ dd = 0;
+ numbits = 0;
+ for (p = digits_end; digits_start < p; p--) {
+ if ((c = conv_digit(p[-1])) < 0)
+ continue;
+ dd |= (BDIGIT_DBL)c << numbits;
+ numbits += bits_per_digit;
+ if (BITSPERDIG <= numbits) {
+ *dp++ = BIGLO(dd);
+ dd = BIGDN(dd);
+ numbits -= BITSPERDIG;
+ }
}
- len = RBIGNUM_LEN(val) * SIZEOF_BDIGITS;
- if (len > QUAD_SIZE) {
- len = QUAD_SIZE;
+ if (numbits) {
+ *dp++ = BIGLO(dd);
}
- memcpy(buf, (char*)BDIGITS(val), len);
- if (RBIGNUM_NEGATIVE_P(val)) {
- quad_buf_complement(buf, QUAD_SIZE);
+ assert((size_t)(dp - BDIGITS(z)) == num_bdigits);
+
+ return z;
+}
+
+static VALUE
+str2big_normal(
+ int sign,
+ const char *digits_start,
+ const char *digits_end,
+ size_t num_bdigits,
+ int base)
+{
+ size_t blen = 1;
+ BDIGIT *zds;
+ BDIGIT_DBL num;
+
+ size_t i;
+ const char *p;
+ int c;
+ VALUE z;
+
+ z = bignew(num_bdigits, sign);
+ zds = BDIGITS(z);
+ BDIGITS_ZERO(zds, num_bdigits);
+
+ for (p = digits_start; p < digits_end; p++) {
+ if ((c = conv_digit(*p)) < 0)
+ continue;
+ num = c;
+ i = 0;
+ for (;;) {
+ while (i<blen) {
+ num += (BDIGIT_DBL)zds[i]*base;
+ zds[i++] = BIGLO(num);
+ num = BIGDN(num);
+ }
+ if (num) {
+ blen++;
+ continue;
+ }
+ break;
+ }
+ assert(blen <= num_bdigits);
}
+
+ return z;
}
-#define BNEG(b) (RSHIFT(((BDIGIT*)(b))[QUAD_SIZE/SIZEOF_BDIGITS-1],BITSPERDIG-1) != 0)
+static VALUE
+str2big_karatsuba(
+ int sign,
+ const char *digits_start,
+ const char *digits_end,
+ size_t num_digits,
+ size_t num_bdigits,
+ int digits_per_bdigits_dbl,
+ int base)
+{
+ VALUE powerv;
+ size_t unit;
+ VALUE tmpuv = 0;
+ BDIGIT *uds, *vds, *tds;
+ BDIGIT_DBL dd;
+ BDIGIT_DBL current_base;
+ int m;
+ int power_level = 0;
-VALUE
-rb_quad_unpack(const char *buf, int sign)
-{
- VALUE big = bignew(QUAD_SIZE/SIZEOF_BDIGITS, 1);
+ size_t i;
+ const char *p;
+ int c;
+ VALUE z;
+
+ uds = ALLOCV_N(BDIGIT, tmpuv, 2*num_bdigits);
+ vds = uds + num_bdigits;
- memcpy((char*)BDIGITS(big), buf, QUAD_SIZE);
- if (sign && BNEG(buf)) {
- char *tmp = (char*)BDIGITS(big);
+ powerv = power_cache_get_power(base, power_level, NULL);
- RBIGNUM_SET_SIGN(big, 0);
- quad_buf_complement(tmp, QUAD_SIZE);
+ i = 0;
+ dd = 0;
+ current_base = 1;
+ m = digits_per_bdigits_dbl;
+ if (num_digits < (size_t)m)
+ m = (int)num_digits;
+ for (p = digits_end; digits_start < p; p--) {
+ if ((c = conv_digit(p[-1])) < 0)
+ continue;
+ dd = dd + c * current_base;
+ current_base *= base;
+ num_digits--;
+ m--;
+ if (m == 0) {
+ uds[i++] = BIGLO(dd);
+ uds[i++] = (BDIGIT)BIGDN(dd);
+ dd = 0;
+ m = digits_per_bdigits_dbl;
+ if (num_digits < (size_t)m)
+ m = (int)num_digits;
+ current_base = 1;
+ }
+ }
+ assert(i == num_bdigits);
+ 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_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_add(vds+i, num_bdigits-i, vds+i, num_bdigits-i, uds+i, unit);
+ }
+ else {
+ MEMCPY(vds+i, uds+i, BDIGIT, num_bdigits-i);
+ }
+ }
+ power_level++;
+ powerv = power_cache_get_power(base, power_level, NULL);
+ tds = vds;
+ vds = uds;
+ uds = tds;
}
+ BARY_TRUNC(uds, num_bdigits);
+ z = bignew(num_bdigits, sign);
+ MEMCPY(BDIGITS(z), uds, BDIGIT, num_bdigits);
+
+ if (tmpuv)
+ ALLOCV_END(tmpuv);
- return bignorm(big);
+ return z;
}
+#ifdef USE_GMP
+static VALUE
+str2big_gmp(
+ int sign,
+ const char *digits_start,
+ const char *digits_end,
+ size_t num_digits,
+ size_t num_bdigits,
+ int base)
+{
+ const size_t nails = (sizeof(BDIGIT)-SIZEOF_BDIGIT)*CHAR_BIT;
+ char *buf, *p;
+ const char *q;
+ VALUE tmps;
+ mpz_t mz;
+ VALUE z;
+ BDIGIT *zds;
+ size_t zn, count;
+
+ buf = ALLOCV_N(char, tmps, num_digits+1);
+ p = buf;
+ for (q = digits_start; q < digits_end; q++) {
+ if (conv_digit(*q) < 0)
+ continue;
+ *p++ = *q;
+ }
+ *p = '\0';
+
+ mpz_init(mz);
+ mpz_set_str(mz, buf, base);
+ zn = num_bdigits;
+ z = bignew(zn, sign);
+ zds = BDIGITS(z);
+ mpz_export(BDIGITS(z), &count, -1, sizeof(BDIGIT), 0, nails, mz);
+ BDIGITS_ZERO(zds+count, zn-count);
+ mpz_clear(mz);
+
+ if (tmps)
+ ALLOCV_END(tmps);
+
+ return z;
+}
#endif
VALUE
rb_cstr_to_inum(const char *str, int base, int badcheck)
{
const char *s = str;
- char *end;
- char sign = 1, nondigit = 0;
+ char sign = 1;
int c;
- BDIGIT_DBL num;
- long len, blen = 1;
- long i;
VALUE z;
- BDIGIT *zds;
-#undef ISDIGIT
-#define ISDIGIT(c) ('0' <= (c) && (c) <= '9')
-#define conv_digit(c) \
- (!ISASCII(c) ? -1 : \
- ISDIGIT(c) ? ((c) - '0') : \
- ISLOWER(c) ? ((c) - 'a' + 10) : \
- ISUPPER(c) ? ((c) - 'A' + 10) : \
- -1)
+ int bits_per_digit;
+
+ const char *digits_start, *digits_end;
+ size_t num_digits;
+ size_t num_bdigits;
+ size_t len;
if (!str) {
- if (badcheck) goto bad;
+ if (badcheck) {
+ bad:
+ rb_invalid_str(s, "Integer()");
+ }
return INT2FIX(0);
}
while (ISSPACE(*str)) str++;
@@ -619,15 +3979,19 @@ rb_cstr_to_inum(const char *str, int base, int badcheck)
switch (str[1]) {
case 'x': case 'X':
base = 16;
+ str += 2;
break;
case 'b': case 'B':
base = 2;
+ str += 2;
break;
case 'o': case 'O':
base = 8;
+ str += 2;
break;
case 'd': case 'D':
base = 10;
+ str += 2;
break;
default:
base = 8;
@@ -640,47 +4004,28 @@ rb_cstr_to_inum(const char *str, int base, int badcheck)
base = 10;
}
}
- switch (base) {
- case 2:
- len = 1;
+ else if (base == 2) {
if (str[0] == '0' && (str[1] == 'b'||str[1] == 'B')) {
str += 2;
}
- break;
- case 3:
- len = 2;
- break;
- case 8:
+ }
+ else if (base == 8) {
if (str[0] == '0' && (str[1] == 'o'||str[1] == 'O')) {
str += 2;
}
- case 4: case 5: case 6: case 7:
- len = 3;
- break;
- case 10:
+ }
+ else if (base == 10) {
if (str[0] == '0' && (str[1] == 'd'||str[1] == 'D')) {
str += 2;
}
- case 9: case 11: case 12: case 13: case 14: case 15:
- len = 4;
- break;
- case 16:
- len = 4;
+ }
+ else if (base == 16) {
if (str[0] == '0' && (str[1] == 'x'||str[1] == 'X')) {
str += 2;
}
- break;
- default:
- if (base < 2 || 36 < base) {
- rb_raise(rb_eArgError, "invalid radix %d", base);
- }
- if (base <= 32) {
- len = 5;
- }
- else {
- len = 6;
- }
- break;
+ }
+ if (base < 2 || 36 < base) {
+ rb_raise(rb_eArgError, "invalid radix %d", base);
}
if (*str == '0') { /* squeeze preceding 0s */
int us = 0;
@@ -688,8 +4033,10 @@ 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;
}
@@ -699,9 +4046,10 @@ rb_cstr_to_inum(const char *str, int base, int badcheck)
if (badcheck) goto bad;
return INT2FIX(0);
}
- len *= strlen(str)*sizeof(char);
- if ((size_t)len <= (sizeof(long)*CHAR_BIT)) {
+ bits_per_digit = bit_length(base-1);
+ if (bits_per_digit * strlen(str) <= sizeof(long) * CHAR_BIT) {
+ char *end;
unsigned long val = STRTOUL(str, &end, base);
if (str < end && *end == '_') goto bigparse;
@@ -720,54 +4068,40 @@ rb_cstr_to_inum(const char *str, int base, int badcheck)
}
else {
VALUE big = rb_uint2big(val);
- RBIGNUM_SET_SIGN(big, sign);
+ BIGNUM_SET_SIGN(big, sign);
return bignorm(big);
}
}
+
bigparse:
- len = (len/BITSPERDIG)+1;
- if (badcheck && *str == '_') goto bad;
+ digits_start = str;
+ str2big_scan_digits(s, str, base, badcheck, &num_digits, &len);
+ digits_end = digits_start + len;
- z = bignew(len, sign);
- zds = BDIGITS(z);
- for (i=len;i--;) zds[i]=0;
- while ((c = *str++) != 0) {
- if (c == '_') {
- if (nondigit) {
- if (badcheck) goto bad;
- break;
- }
- nondigit = (char) c;
- continue;
- }
- else if ((c = conv_digit(c)) < 0) {
- break;
- }
- if (c >= base) break;
- nondigit = 0;
- i = 0;
- num = c;
- for (;;) {
- while (i<blen) {
- num += (BDIGIT_DBL)zds[i]*base;
- zds[i++] = BIGLO(num);
- num = BIGDN(num);
- }
- if (num) {
- blen++;
- continue;
- }
- break;
- }
+ if (POW2_P(base)) {
+ z = str2big_poweroftwo(sign, digits_start, digits_end, num_digits,
+ bits_per_digit);
}
- if (badcheck) {
- str--;
- if (s+1 < str && str[-1] == '_') goto bad;
- while (*str && ISSPACE(*str)) str++;
- if (*str) {
- bad:
- rb_invalid_str(s, "Integer()");
- }
+ else {
+ int digits_per_bdigits_dbl;
+ maxpow_in_bdigit_dbl(base, &digits_per_bdigits_dbl);
+ num_bdigits = roomof(num_digits, digits_per_bdigits_dbl)*2;
+
+#ifdef USE_GMP
+ if (GMP_STR2BIG_DIGITS < num_bdigits) {
+ z = str2big_gmp(sign, digits_start, digits_end, num_digits,
+ num_bdigits, base);
+ }
+ else
+#endif
+ if (num_bdigits < KARATSUBA_MUL_DIGITS) {
+ z = str2big_normal(sign, digits_start, digits_end,
+ num_bdigits, base);
+ }
+ else {
+ z = str2big_karatsuba(sign, digits_start, digits_end, num_digits,
+ num_bdigits, digits_per_bdigits_dbl, base);
+ }
}
return bignorm(z);
@@ -805,26 +4139,178 @@ rb_str_to_inum(VALUE str, int base, int badcheck)
return ret;
}
+VALUE
+rb_str2big_poweroftwo(VALUE arg, int base, int badcheck)
+{
+ int positive_p = 1;
+ const char *s, *str;
+ const char *digits_start, *digits_end;
+ size_t num_digits;
+ size_t len;
+ VALUE z;
+
+ if (base < 2 || 36 < base || !POW2_P(base)) {
+ rb_raise(rb_eArgError, "invalid radix %d", base);
+ }
+
+ rb_must_asciicompat(arg);
+ s = str = StringValueCStr(arg);
+ if (*str == '-') {
+ str++;
+ positive_p = 0;
+ }
+
+ digits_start = str;
+ str2big_scan_digits(s, str, base, badcheck, &num_digits, &len);
+ digits_end = digits_start + len;
+
+ z = str2big_poweroftwo(positive_p, digits_start, digits_end, num_digits,
+ bit_length(base-1));
+
+ RB_GC_GUARD(arg);
+
+ return bignorm(z);
+}
+
+VALUE
+rb_str2big_normal(VALUE arg, int base, int badcheck)
+{
+ int positive_p = 1;
+ const char *s, *str;
+ const char *digits_start, *digits_end;
+ size_t num_digits;
+ size_t len;
+ VALUE z;
+
+ int digits_per_bdigits_dbl;
+ size_t num_bdigits;
+
+ if (base < 2 || 36 < base) {
+ rb_raise(rb_eArgError, "invalid radix %d", base);
+ }
+
+ rb_must_asciicompat(arg);
+ s = str = StringValueCStr(arg);
+ if (*str == '-') {
+ str++;
+ positive_p = 0;
+ }
+
+ digits_start = str;
+ str2big_scan_digits(s, str, base, badcheck, &num_digits, &len);
+ digits_end = digits_start + len;
+
+ maxpow_in_bdigit_dbl(base, &digits_per_bdigits_dbl);
+ num_bdigits = roomof(num_digits, digits_per_bdigits_dbl)*2;
+
+ z = str2big_normal(positive_p, digits_start, digits_end,
+ num_bdigits, base);
+
+ RB_GC_GUARD(arg);
+
+ return bignorm(z);
+}
+
+VALUE
+rb_str2big_karatsuba(VALUE arg, int base, int badcheck)
+{
+ int positive_p = 1;
+ const char *s, *str;
+ const char *digits_start, *digits_end;
+ size_t num_digits;
+ size_t len;
+ VALUE z;
+
+ int digits_per_bdigits_dbl;
+ size_t num_bdigits;
+
+ if (base < 2 || 36 < base) {
+ rb_raise(rb_eArgError, "invalid radix %d", base);
+ }
+
+ rb_must_asciicompat(arg);
+ s = str = StringValueCStr(arg);
+ if (*str == '-') {
+ str++;
+ positive_p = 0;
+ }
+
+ digits_start = str;
+ str2big_scan_digits(s, str, base, badcheck, &num_digits, &len);
+ digits_end = digits_start + len;
+
+ maxpow_in_bdigit_dbl(base, &digits_per_bdigits_dbl);
+ num_bdigits = roomof(num_digits, digits_per_bdigits_dbl)*2;
+
+ z = str2big_karatsuba(positive_p, digits_start, digits_end, num_digits,
+ num_bdigits, digits_per_bdigits_dbl, base);
+
+ RB_GC_GUARD(arg);
+
+ return bignorm(z);
+}
+
+#ifdef USE_GMP
+VALUE
+rb_str2big_gmp(VALUE arg, int base, int badcheck)
+{
+ int positive_p = 1;
+ const char *s, *str;
+ const char *digits_start, *digits_end;
+ size_t num_digits;
+ size_t len;
+ VALUE z;
+
+ int digits_per_bdigits_dbl;
+ size_t num_bdigits;
+
+ if (base < 2 || 36 < base) {
+ rb_raise(rb_eArgError, "invalid radix %d", base);
+ }
+
+ rb_must_asciicompat(arg);
+ s = str = StringValueCStr(arg);
+ if (*str == '-') {
+ str++;
+ positive_p = 0;
+ }
+
+ digits_start = str;
+ str2big_scan_digits(s, str, base, badcheck, &num_digits, &len);
+ digits_end = digits_start + len;
+
+ maxpow_in_bdigit_dbl(base, &digits_per_bdigits_dbl);
+ num_bdigits = roomof(num_digits, digits_per_bdigits_dbl)*2;
+
+ z = str2big_gmp(positive_p, digits_start, digits_end, num_digits, num_bdigits, base);
+
+ RB_GC_GUARD(arg);
+
+ return bignorm(z);
+}
+#endif
+
#if HAVE_LONG_LONG
static VALUE
rb_ull2big(unsigned LONG_LONG n)
{
- BDIGIT_DBL num = n;
- long i = 0;
- BDIGIT *digits;
- VALUE big;
+ long i;
+ VALUE big = bignew(bdigit_roomof(SIZEOF_LONG_LONG), 1);
+ BDIGIT *digits = BDIGITS(big);
- big = bignew(DIGSPERLL, 1);
- digits = BDIGITS(big);
- while (i < DIGSPERLL) {
- digits[i++] = BIGLO(num);
- num = BIGDN(num);
+#if SIZEOF_BDIGIT >= SIZEOF_LONG_LONG
+ digits[0] = n;
+#else
+ for (i = 0; i < bdigit_roomof(SIZEOF_LONG_LONG); i++) {
+ digits[i] = BIGLO(n);
+ n = BIGDN(n);
}
+#endif
- i = DIGSPERLL;
+ i = bdigit_roomof(SIZEOF_LONG_LONG);
while (i-- && !digits[i]) ;
- RBIGNUM_SET_LEN(big, i+1);
+ BIGNUM_SET_LEN(big, i+1);
return big;
}
@@ -832,15 +4318,19 @@ static VALUE
rb_ll2big(LONG_LONG n)
{
long neg = 0;
+ unsigned LONG_LONG u;
VALUE big;
if (n < 0) {
- n = -n;
+ u = 1 + (unsigned LONG_LONG)(-(n + 1)); /* u = -n avoiding overflow */
neg = 1;
}
- big = rb_ull2big(n);
+ else {
+ u = n;
+ }
+ big = rb_ull2big(u);
if (neg) {
- RBIGNUM_SET_SIGN(big, 0);
+ BIGNUM_SET_SIGN(big, 0);
}
return big;
}
@@ -873,292 +4363,549 @@ rb_str2inum(VALUE str, int base)
return rb_str_to_inum(str, base, base==0);
}
-const char ruby_digitmap[] = "0123456789abcdefghijklmnopqrstuvwxyz";
-
-static VALUE bigsqr(VALUE x);
-static void bigdivmod(VALUE x, VALUE y, volatile VALUE *divp, volatile VALUE *modp);
-
-#define POW2_P(x) (((x)&((x)-1))==0)
-
-static inline int
-ones(register unsigned long x)
+static VALUE
+big_shift3(VALUE x, int lshift_p, size_t shift_numdigits, int shift_numbits)
{
-#if SIZEOF_LONG == 8
-# define MASK_55 0x5555555555555555UL
-# define MASK_33 0x3333333333333333UL
-# define MASK_0f 0x0f0f0f0f0f0f0f0fUL
-#else
-# define MASK_55 0x55555555UL
-# define MASK_33 0x33333333UL
-# define MASK_0f 0x0f0f0f0fUL
-#endif
- x -= (x >> 1) & MASK_55;
- x = ((x >> 2) & MASK_33) + (x & MASK_33);
- x = ((x >> 4) + x) & MASK_0f;
- x += (x >> 8);
- x += (x >> 16);
-#if SIZEOF_LONG == 8
- x += (x >> 32);
-#endif
- return (int)(x & 0x7f);
-#undef MASK_0f
-#undef MASK_33
-#undef MASK_55
+ BDIGIT *xds, *zds;
+ long s1;
+ int s2;
+ VALUE z;
+ long xn;
+
+ if (lshift_p) {
+ if (LONG_MAX < shift_numdigits) {
+ rb_raise(rb_eArgError, "too big number");
+ }
+ s1 = shift_numdigits;
+ s2 = shift_numbits;
+ xn = BIGNUM_LEN(x);
+ z = bignew(xn+s1+1, BIGNUM_SIGN(x));
+ zds = BDIGITS(z);
+ BDIGITS_ZERO(zds, s1);
+ xds = BDIGITS(x);
+ zds[xn+s1] = bary_small_lshift(zds+s1, xds, xn, s2);
+ }
+ 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)))
+ return INT2FIX(0);
+ else
+ return INT2FIX(-1);
+ }
+ s1 = shift_numdigits;
+ s2 = shift_numbits;
+ hibitsx = abs2twocomp(&x, &xn);
+ xds = BDIGITS(x);
+ if (xn <= s1) {
+ return hibitsx ? INT2FIX(-1) : INT2FIX(0);
+ }
+ zn = xn - s1;
+ z = bignew(zn, 0);
+ zds = BDIGITS(z);
+ bary_small_rshift(zds, xds+s1, zn, s2, hibitsx != 0 ? BDIGMAX : 0);
+ twocomp2abs_bang(z, hibitsx != 0);
+ }
+ RB_GC_GUARD(x);
+ return z;
}
-static inline unsigned long
-next_pow2(register unsigned long x)
+static VALUE
+big_shift2(VALUE x, int lshift_p, VALUE y)
{
- x |= x >> 1;
- x |= x >> 2;
- x |= x >> 4;
- x |= x >> 8;
- x |= x >> 16;
-#if SIZEOF_LONG == 8
- x |= x >> 32;
-#endif
- return x + 1;
+ int sign;
+ size_t lens[2];
+ size_t shift_numdigits;
+ int shift_numbits;
+
+ assert(POW2_P(CHAR_BIT));
+ assert(POW2_P(BITSPERDIG));
+
+ if (BIGZEROP(x))
+ return INT2FIX(0);
+ sign = rb_integer_pack(y, lens, numberof(lens), sizeof(size_t), 0,
+ INTEGER_PACK_LSWORD_FIRST|INTEGER_PACK_NATIVE_BYTE_ORDER);
+ if (sign < 0) {
+ lshift_p = !lshift_p;
+ sign = -sign;
+ }
+ if (lshift_p) {
+ if (1 < sign || CHAR_BIT <= lens[1])
+ rb_raise(rb_eRangeError, "shift width too big");
+ }
+ else {
+ if (1 < sign || CHAR_BIT <= lens[1])
+ return BIGNUM_POSITIVE_P(x) ? INT2FIX(0) : INT2FIX(-1);
+ }
+ shift_numbits = (int)(lens[0] & (BITSPERDIG-1));
+ shift_numdigits = (lens[0] >> bit_length(BITSPERDIG-1)) |
+ (lens[1] << (CHAR_BIT*SIZEOF_SIZE_T - bit_length(BITSPERDIG-1)));
+ return big_shift3(x, lshift_p, shift_numdigits, shift_numbits);
}
-static inline int
-floor_log2(register unsigned long x)
+static VALUE
+big_lshift(VALUE x, unsigned long shift)
{
- x |= x >> 1;
- x |= x >> 2;
- x |= x >> 4;
- x |= x >> 8;
- x |= x >> 16;
-#if SIZEOF_LONG == 8
- x |= x >> 32;
-#endif
- return (int)ones(x) - 1;
+ long s1 = shift/BITSPERDIG;
+ int s2 = (int)(shift%BITSPERDIG);
+ return big_shift3(x, 1, s1, s2);
}
-static inline int
-ceil_log2(register unsigned long x)
+static VALUE
+big_rshift(VALUE x, unsigned long shift)
{
- return floor_log2(x) + !POW2_P(x);
+ long s1 = shift/BITSPERDIG;
+ int s2 = (int)(shift%BITSPERDIG);
+ return big_shift3(x, 0, s1, s2);
}
-#define LOG2_KARATSUBA_DIGITS 7
-#define KARATSUBA_DIGITS (1L<<LOG2_KARATSUBA_DIGITS)
-#define MAX_BIG2STR_TABLE_ENTRIES 64
+#define MAX_BASE36_POWER_TABLE_ENTRIES (SIZEOF_SIZE_T * CHAR_BIT + 1)
-static VALUE big2str_power_cache[35][MAX_BIG2STR_TABLE_ENTRIES];
+static VALUE base36_power_cache[35][MAX_BASE36_POWER_TABLE_ENTRIES];
+static size_t base36_numdigits_cache[35][MAX_BASE36_POWER_TABLE_ENTRIES];
static void
power_cache_init(void)
{
int i, j;
for (i = 0; i < 35; ++i) {
- for (j = 0; j < MAX_BIG2STR_TABLE_ENTRIES; ++j) {
- big2str_power_cache[i][j] = Qnil;
+ for (j = 0; j < MAX_BASE36_POWER_TABLE_ENTRIES; ++j) {
+ base36_power_cache[i][j] = Qnil;
}
}
}
static inline VALUE
-power_cache_get_power0(int base, int i)
+power_cache_get_power(int base, int power_level, size_t *numdigits_ret)
{
- if (NIL_P(big2str_power_cache[base - 2][i])) {
- big2str_power_cache[base - 2][i] =
- i == 0 ? rb_big_pow(rb_int2big(base), INT2FIX(KARATSUBA_DIGITS))
- : bigsqr(power_cache_get_power0(base, i - 1));
- rb_gc_register_mark_object(big2str_power_cache[base - 2][i]);
+ /*
+ * MAX_BASE36_POWER_TABLE_ENTRIES is big enough to that
+ * base36_power_cache[base][MAX_BASE36_POWER_TABLE_ENTRIES-1] fills whole memory.
+ * So MAX_BASE36_POWER_TABLE_ENTRIES <= power_level is not possible to calculate.
+ *
+ * number-of-bytes =
+ * log256(base36_power_cache[base][MAX_BASE36_POWER_TABLE_ENTRIES-1]) =
+ * log256(maxpow_in_bdigit_dbl(base)**(2**(MAX_BASE36_POWER_TABLE_ENTRIES-1))) =
+ * log256(maxpow_in_bdigit_dbl(base)**(2**(SIZEOF_SIZE_T*CHAR_BIT))) =
+ * (2**(SIZEOF_SIZE_T*CHAR_BIT))*log256(maxpow_in_bdigit_dbl(base)) =
+ * (256**SIZEOF_SIZE_T)*log256(maxpow_in_bdigit_dbl(base)) >
+ * (256**SIZEOF_SIZE_T)*(sizeof(BDIGIT_DBL)-1) >
+ * 256**SIZEOF_SIZE_T
+ */
+ if (MAX_BASE36_POWER_TABLE_ENTRIES <= power_level)
+ rb_bug("too big power number requested: maxpow_in_bdigit_dbl(%d)**(2**%d)", base, power_level);
+
+ if (NIL_P(base36_power_cache[base - 2][power_level])) {
+ VALUE power;
+ size_t numdigits;
+ if (power_level == 0) {
+ int numdigits0;
+ BDIGIT_DBL dd = maxpow_in_bdigit_dbl(base, &numdigits0);
+ power = bignew(2, 1);
+ bdigitdbl2bary(BDIGITS(power), 2, dd);
+ numdigits = numdigits0;
+ }
+ else {
+ power = bigtrunc(bigsq(power_cache_get_power(base, power_level - 1, &numdigits)));
+ numdigits *= 2;
+ }
+ rb_obj_hide(power);
+ base36_power_cache[base - 2][power_level] = power;
+ base36_numdigits_cache[base - 2][power_level] = numdigits;
+ rb_gc_register_mark_object(power);
}
- return big2str_power_cache[base - 2][i];
+ if (numdigits_ret)
+ *numdigits_ret = base36_numdigits_cache[base - 2][power_level];
+ return base36_power_cache[base - 2][power_level];
}
-static VALUE
-power_cache_get_power(int base, long n1, long* m1)
+struct big2str_struct {
+ int negative;
+ int base;
+ BDIGIT_DBL hbase2;
+ int hbase2_numdigits;
+ VALUE result;
+ char *ptr;
+};
+
+static void
+big2str_alloc(struct big2str_struct *b2s, size_t len)
+{
+ if (LONG_MAX-1 < len)
+ rb_raise(rb_eArgError, "too big number");
+ b2s->result = rb_usascii_str_new(0, (long)(len + 1)); /* plus one for sign */
+ b2s->ptr = RSTRING_PTR(b2s->result);
+ if (b2s->negative)
+ *b2s->ptr++ = '-';
+}
+
+static void
+big2str_2bdigits(struct big2str_struct *b2s, BDIGIT *xds, size_t xn, size_t taillen)
{
- int i, m;
- long j;
- VALUE t;
+ size_t j;
+ BDIGIT_DBL num;
+ char buf[SIZEOF_BDIGIT_DBL*CHAR_BIT], *p;
+ int beginning = !b2s->ptr;
+ size_t len = 0;
+
+ assert(xn <= 2);
+ num = bary2bdigitdbl(xds, xn);
+
+ if (beginning) {
+ if (num == 0)
+ return;
+ p = buf;
+ j = sizeof(buf);
+ do {
+ p[--j] = ruby_digitmap[num % b2s->base];
+ num /= b2s->base;
+ } while (num);
+ len = sizeof(buf) - j;
+ big2str_alloc(b2s, len + taillen);
+ MEMCPY(b2s->ptr, buf + j, char, len);
+ }
+ else {
+ p = b2s->ptr;
+ j = b2s->hbase2_numdigits;
+ do {
+ p[--j] = ruby_digitmap[num % b2s->base];
+ num /= b2s->base;
+ } while (j);
+ len = b2s->hbase2_numdigits;
+ }
+ b2s->ptr += len;
+}
- if (n1 <= KARATSUBA_DIGITS)
- rb_bug("n1 > KARATSUBA_DIGITS");
+static void
+big2str_karatsuba(struct big2str_struct *b2s, BDIGIT *xds, size_t xn, size_t wn,
+ int power_level, size_t taillen)
+{
+ VALUE b;
+ size_t half_numdigits, lower_numdigits;
+ int lower_power_level;
+ size_t bn;
+ const BDIGIT *bds;
+ size_t len;
- m = ceil_log2(n1);
- if (m1) *m1 = 1 << m;
- i = m - LOG2_KARATSUBA_DIGITS;
- if (i >= MAX_BIG2STR_TABLE_ENTRIES)
- i = MAX_BIG2STR_TABLE_ENTRIES - 1;
- t = power_cache_get_power0(base, i);
+ /*
+ * Precondition:
+ * abs(x) < maxpow**(2**power_level)
+ * where
+ * maxpow = maxpow_in_bdigit_dbl(base, &numdigits)
+ *
+ * This function generates sequence of zeros, and then stringized abs(x) into b2s->ptr.
+ *
+ * b2s->ptr can be NULL.
+ * It is allocated when the first character is generated via big2str_alloc.
+ *
+ * The prefix zeros should be generated if and only if b2s->ptr is not NULL.
+ * When the zeros are generated, the zeros and abs(x) consists
+ * numdigits*(2**power_level) characters at total.
+ *
+ * Note:
+ * power_cache_get_power(base, power_level, &len) may not be cached yet. It should not be called.
+ * power_cache_get_power(base, power_level-1, &len) should be cached already if 0 <= power_level-1.
+ */
- j = KARATSUBA_DIGITS*(1 << i);
- while (n1 > j) {
- t = bigsqr(t);
- j *= 2;
+ if (xn == 0 || bary_zero_p(xds, xn)) {
+ if (b2s->ptr) {
+ /* When x is zero, power_cache_get_power(base, power_level) should be cached already. */
+ power_cache_get_power(b2s->base, power_level, &len);
+ memset(b2s->ptr, '0', len);
+ b2s->ptr += len;
+ }
+ return;
}
- return t;
-}
-/* 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 (power_level == 0) {
+ big2str_2bdigits(b2s, xds, xn, taillen);
+ return;
+ }
- if (base < 2 || 36 < base)
- rb_bug("invalid radix %d", base);
+ lower_power_level = power_level-1;
+ b = power_cache_get_power(b2s->base, lower_power_level, &lower_numdigits);
+ bn = BIGNUM_LEN(b);
+ bds = BDIGITS(b);
- if (FIXNUM_P(x)) {
- bits = (SIZEOF_LONG*CHAR_BIT - 1)/2 + 1;
+ half_numdigits = lower_numdigits;
+
+ while (0 < lower_power_level &&
+ (xn < bn ||
+ (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);
+ bds = BDIGITS(b);
+ }
+
+ if (lower_power_level == 0 &&
+ (xn < bn ||
+ (xn == bn && bary_cmp(xds, xn, bds, bn) < 0))) {
+ if (b2s->ptr) {
+ len = half_numdigits * 2 - lower_numdigits;
+ memset(b2s->ptr, '0', len);
+ b2s->ptr += len;
+ }
+ big2str_2bdigits(b2s, xds, xn, taillen);
}
- else if (BIGZEROP(x)) {
- return 0;
+ else {
+ BDIGIT *qds, *rds;
+ size_t qn, rn;
+ BDIGIT *tds;
+ int shift;
+
+ if (lower_power_level != power_level-1 && b2s->ptr) {
+ len = (half_numdigits - lower_numdigits) * 2;
+ memset(b2s->ptr, '0', len);
+ b2s->ptr += len;
+ }
+
+ shift = nlz(bds[bn-1]);
+
+ qn = xn + BIGDIVREM_EXTRA_WORDS;
+
+ if (shift == 0) {
+ /* bigdivrem_restoring will not modify y.
+ * So use bds directly. */
+ tds = (BDIGIT *)bds;
+ xds[xn] = 0;
+ }
+ else {
+ /* bigdivrem_restoring will modify y.
+ * So use temporary buffer. */
+ tds = xds + qn;
+ assert(qn + bn <= xn + wn);
+ bary_small_lshift(tds, bds, bn, shift);
+ xds[xn] = bary_small_lshift(xds, xds, xn, shift);
+ }
+
+ bigdivrem_restoring(xds, qn, tds, bn);
+
+ rds = xds;
+ rn = bn;
+
+ qds = xds + bn;
+ qn = qn - bn;
+
+ if (shift) {
+ bary_small_rshift(rds, rds, rn, shift, 0);
+ }
+
+ BARY_TRUNC(qds, qn);
+ assert(qn <= bn);
+ big2str_karatsuba(b2s, qds, qn, xn+wn - (rn+qn), lower_power_level, lower_numdigits+taillen);
+ BARY_TRUNC(rds, rn);
+ big2str_karatsuba(b2s, rds, rn, xn+wn - rn, lower_power_level, taillen);
}
- else if (RBIGNUM_LEN(x) >= LONG_MAX/BITSPERDIG) {
- rb_raise(rb_eRangeError, "bignum too big to convert into `string'");
+}
+
+static VALUE
+big2str_base_poweroftwo(VALUE x, int base)
+{
+ int word_numbits = ffs(base) - 1;
+ size_t numwords;
+ VALUE result;
+ char *ptr;
+ numwords = rb_absint_numwords(x, word_numbits, NULL);
+ if (BIGNUM_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) ? '+' : '-';
}
else {
- bits = BITSPERDIG*RBIGNUM_LEN(x);
+ if (LONG_MAX < numwords)
+ rb_raise(rb_eArgError, "too big number");
+ result = rb_usascii_str_new(0, numwords);
+ ptr = RSTRING_PTR(result);
}
+ rb_integer_pack(x, ptr, numwords, 1, CHAR_BIT-word_numbits,
+ INTEGER_PACK_BIG_ENDIAN);
+ while (0 < numwords) {
+ *ptr = ruby_digitmap[*(unsigned char *)ptr];
+ ptr++;
+ numwords--;
+ }
+ return result;
+}
- /* @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]);
+VALUE
+rb_big2str_poweroftwo(VALUE x, int base)
+{
+ return big2str_base_poweroftwo(x, base);
}
-static long
-big2str_orig(VALUE x, int base, char* ptr, long len, long hbase, int trim)
+static VALUE
+big2str_generic(VALUE x, int base)
{
- long i = RBIGNUM_LEN(x), j = len;
- BDIGIT* ds = BDIGITS(x);
+ BDIGIT *xds;
+ size_t xn;
+ struct big2str_struct b2s_data;
+ int power_level;
+ VALUE power;
- while (i && j > 0) {
- long k = i;
- BDIGIT_DBL num = 0;
+ xds = BDIGITS(x);
+ xn = BIGNUM_LEN(x);
+ BARY_TRUNC(xds, xn);
- while (k--) { /* x / hbase */
- num = BIGUP(num) + ds[k];
- ds[k] = (BDIGIT)(num / hbase);
- num %= hbase;
- }
- if (trim && ds[i-1] == 0) i--;
- k = SIZEOF_BDIGITS;
- while (k--) {
- ptr[--j] = ruby_digitmap[num % base];
- num /= base;
- if (j <= 0) break;
- if (trim && i == 0 && num == 0) break;
- }
+ if (xn == 0) {
+ return rb_usascii_str_new2("0");
+ }
+
+ if (base < 2 || 36 < base)
+ rb_raise(rb_eArgError, "invalid radix %d", base);
+
+ if (xn >= LONG_MAX/BITSPERDIG) {
+ rb_raise(rb_eRangeError, "bignum too big to convert into `string'");
+ }
+
+ 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) {
+ 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) {
+ /*
+ * This increment guarantees x < power_cache_get_power(base, power_level)
+ * without invoking it actually.
+ * (power_cache_get_power(base, power_level) can be slow and not used
+ * in big2str_karatsuba.)
+ *
+ * Although it is possible that x < power_cache_get_power(base, power_level-1),
+ * it is no problem because big2str_karatsuba checks it and
+ * doesn't affect the result when b2s_data.ptr is NULL.
+ */
+ power_level++;
+ }
+
+ b2s_data.negative = BIGNUM_NEGATIVE_P(x);
+ b2s_data.base = base;
+ b2s_data.hbase2 = maxpow_in_bdigit_dbl(base, &b2s_data.hbase2_numdigits);
+
+ b2s_data.result = Qnil;
+ b2s_data.ptr = NULL;
+
+ if (power_level == 0) {
+ big2str_2bdigits(&b2s_data, xds, xn, 0);
}
- if (trim) {
- while (j < len && ptr[j] == '0') j++;
- MEMMOVE(ptr, ptr + j, char, len - j);
- len -= j;
+ else {
+ VALUE tmpw = 0;
+ BDIGIT *wds;
+ size_t wn;
+ wn = power_level * BIGDIVREM_EXTRA_WORDS + BIGNUM_LEN(power);
+ wds = ALLOCV_N(BDIGIT, tmpw, xn + wn);
+ MEMCPY(wds, xds, BDIGIT, xn);
+ big2str_karatsuba(&b2s_data, wds, xn, wn, power_level, 0);
+ if (tmpw)
+ ALLOCV_END(tmpw);
}
- return len;
+ RB_GC_GUARD(x);
+
+ *b2s_data.ptr = '\0';
+ rb_str_resize(b2s_data.result, (long)(b2s_data.ptr - RSTRING_PTR(b2s_data.result)));
+
+ RB_GC_GUARD(x);
+ return b2s_data.result;
+}
+
+VALUE
+rb_big2str_generic(VALUE x, int base)
+{
+ return big2str_generic(x, base);
}
-static long
-big2str_karatsuba(VALUE x, int base, char* ptr,
- long n1, long len, long hbase, int trim)
+#ifdef USE_GMP
+VALUE
+big2str_gmp(VALUE x, int base)
{
- long lh, ll, m1;
- VALUE b, q, r;
+ const size_t nails = (sizeof(BDIGIT)-SIZEOF_BDIGIT)*CHAR_BIT;
+ mpz_t mx;
+ size_t size;
+ VALUE str;
+ BDIGIT *xds = BDIGITS(x);
+ size_t xn = BIGNUM_LEN(x);
- if (BIGZEROP(x)) {
- if (trim) return 0;
- else {
- memset(ptr, '0', len);
- return len;
- }
- }
+ mpz_init(mx);
+ mpz_import(mx, xn, -1, sizeof(BDIGIT), 0, nails, xds);
+
+ size = mpz_sizeinbase(mx, base);
- if (n1 <= KARATSUBA_DIGITS) {
- return big2str_orig(x, base, ptr, len, hbase, trim);
+ if (BIGNUM_NEGATIVE_P(x)) {
+ mpz_neg(mx, mx);
+ str = rb_usascii_str_new(0, size+1);
}
+ else {
+ str = rb_usascii_str_new(0, size);
+ }
+ mpz_get_str(RSTRING_PTR(str), base, mx);
+ mpz_clear(mx);
- b = power_cache_get_power(base, n1, &m1);
- bigdivmod(x, b, &q, &r);
- lh = big2str_karatsuba(q, base, ptr, (len - m1)/2,
- len - m1, hbase, trim);
- rb_big_resize(q, 0);
- ll = big2str_karatsuba(r, base, ptr + lh, m1/2,
- m1, hbase, !lh && trim);
- rb_big_resize(r, 0);
+ if (RSTRING_PTR(str)[RSTRING_LEN(str)-1] == '\0') {
+ rb_str_set_len(str, RSTRING_LEN(str)-1);
+ }
- return lh + ll;
+ RB_GC_GUARD(x);
+ return str;
}
VALUE
-rb_big2str0(VALUE x, int base, int trim)
+rb_big2str_gmp(VALUE x, int base)
+{
+ return big2str_gmp(x, base);
+}
+#endif
+
+static VALUE
+rb_big2str1(VALUE x, int base)
{
- int off;
- VALUE ss, xx;
- long n1, n2, len, hbase;
- char* ptr;
+ BDIGIT *xds;
+ size_t xn;
if (FIXNUM_P(x)) {
return rb_fix2str(x, base);
}
- if (BIGZEROP(x)) {
+
+ bigtrunc(x);
+ xds = BDIGITS(x);
+ xn = BIGNUM_LEN(x);
+ BARY_TRUNC(xds, xn);
+
+ if (xn == 0) {
return rb_usascii_str_new2("0");
}
if (base < 2 || 36 < base)
rb_raise(rb_eArgError, "invalid radix %d", base);
- n2 = big2str_find_n1(x, base);
- n1 = (n2 + 1) / 2;
- ss = rb_usascii_str_new(0, n2 + 1); /* plus one for sign */
- ptr = RSTRING_PTR(ss);
- ptr[0] = RBIGNUM_SIGN(x) ? '+' : '-';
-
- hbase = base*base;
-#if SIZEOF_BDIGITS > 2
- hbase *= hbase;
-#endif
- off = !(trim && RBIGNUM_SIGN(x)); /* erase plus sign if trim */
- xx = rb_big_clone(x);
- RBIGNUM_SET_SIGN(xx, 1);
- if (n1 <= KARATSUBA_DIGITS) {
- len = off + big2str_orig(xx, base, ptr + off, n2, hbase, trim);
+ if (xn >= LONG_MAX/BITSPERDIG) {
+ rb_raise(rb_eRangeError, "bignum too big to convert into `string'");
}
- else {
- len = off + big2str_karatsuba(xx, base, ptr + off, n1,
- n2, hbase, trim);
+
+ if (POW2_P(base)) {
+ /* base == 2 || base == 4 || base == 8 || base == 16 || base == 32 */
+ return big2str_base_poweroftwo(x, base);
}
- rb_big_resize(xx, 0);
- ptr[len] = '\0';
- rb_str_resize(ss, len);
+#ifdef USE_GMP
+ if (GMP_BIG2STR_DIGITS < xn) {
+ return big2str_gmp(x, base);
+ }
+#endif
- return ss;
+ return big2str_generic(x, base);
}
VALUE
rb_big2str(VALUE x, int base)
{
- return rb_big2str0(x, base, 1);
+ return rb_big2str1(x, base);
}
/*
@@ -1190,43 +4937,37 @@ rb_big_to_s(int argc, VALUE *argv, VALUE x)
return rb_big2str(x, base);
}
-static VALUE
-big2ulong(VALUE x, const char *type, int check)
+static unsigned long
+big2ulong(VALUE x, const char *type)
{
- long len = RBIGNUM_LEN(x);
- BDIGIT_DBL num;
+ size_t len = BIGNUM_LEN(x);
+ unsigned long num;
BDIGIT *ds;
- if (len > DIGSPERLONG) {
- if (check)
- rb_raise(rb_eRangeError, "bignum too big to convert into `%s'", type);
- len = DIGSPERLONG;
+ if (len == 0)
+ return 0;
+ if (BIGSIZE(x) > sizeof(long)) {
+ rb_raise(rb_eRangeError, "bignum too big to convert into `%s'", type);
}
ds = BDIGITS(x);
+#if SIZEOF_LONG <= SIZEOF_BDIGIT
+ num = (unsigned long)ds[0];
+#else
num = 0;
while (len--) {
- num = BIGUP(num);
- num += ds[len];
- }
- return (VALUE)num;
-}
-
-VALUE
-rb_big2ulong_pack(VALUE x)
-{
- VALUE num = big2ulong(x, "unsigned long", FALSE);
- if (!RBIGNUM_SIGN(x)) {
- return (VALUE)(-(SIGNED_VALUE)num);
+ num <<= BITSPERDIG;
+ num += (unsigned long)ds[len]; /* overflow is already checked */
}
+#endif
return num;
}
-VALUE
+unsigned long
rb_big2ulong(VALUE x)
{
- VALUE num = big2ulong(x, "unsigned long", TRUE);
+ unsigned long num = big2ulong(x, "unsigned long");
- if (RBIGNUM_POSITIVE_P(x)) {
+ if (BIGNUM_POSITIVE_P(x)) {
return num;
}
else {
@@ -1234,28 +4975,26 @@ rb_big2ulong(VALUE x)
return -(long)num;
if (num == 1+(unsigned long)(-(LONG_MIN+1)))
return LONG_MIN;
- rb_raise(rb_eRangeError, "bignum out of range of unsigned long");
}
- return num;
+ rb_raise(rb_eRangeError, "bignum out of range of unsigned long");
}
-SIGNED_VALUE
+long
rb_big2long(VALUE x)
{
- VALUE num = big2ulong(x, "long", TRUE);
+ unsigned long num = big2ulong(x, "long");
- if (RBIGNUM_POSITIVE_P(x)) {
- if (LONG_MAX < num)
- rb_raise(rb_eRangeError, "bignum too big to convert into `long'");
- return num;
+ if (BIGNUM_POSITIVE_P(x)) {
+ if (num <= LONG_MAX)
+ return num;
}
else {
if (num <= LONG_MAX)
return -(long)num;
if (num == 1+(unsigned long)(-(LONG_MIN+1)))
return LONG_MIN;
- rb_raise(rb_eRangeError, "bignum too big to convert into `long'");
}
+ rb_raise(rb_eRangeError, "bignum too big to convert into `long'");
}
#if HAVE_LONG_LONG
@@ -1263,18 +5002,23 @@ rb_big2long(VALUE x)
static unsigned LONG_LONG
big2ull(VALUE x, const char *type)
{
- long len = RBIGNUM_LEN(x);
- BDIGIT_DBL num;
- BDIGIT *ds;
+ size_t len = BIGNUM_LEN(x);
+ unsigned LONG_LONG num;
+ BDIGIT *ds = BDIGITS(x);
- if (len > SIZEOF_LONG_LONG/SIZEOF_BDIGITS)
+ if (len == 0)
+ return 0;
+ if (BIGSIZE(x) > SIZEOF_LONG_LONG)
rb_raise(rb_eRangeError, "bignum too big to convert into `%s'", type);
- ds = BDIGITS(x);
+#if SIZEOF_LONG_LONG <= SIZEOF_BDIGIT
+ num = (unsigned LONG_LONG)ds[0];
+#else
num = 0;
while (len--) {
num = BIGUP(num);
num += ds[len];
}
+#endif
return num;
}
@@ -1283,7 +5027,7 @@ rb_big2ull(VALUE x)
{
unsigned LONG_LONG num = big2ull(x, "unsigned long long");
- if (RBIGNUM_POSITIVE_P(x)) {
+ if (BIGNUM_POSITIVE_P(x)) {
return num;
}
else {
@@ -1291,9 +5035,8 @@ rb_big2ull(VALUE x)
return -(LONG_LONG)num;
if (num == 1+(unsigned LONG_LONG)(-(LLONG_MIN+1)))
return LLONG_MIN;
- rb_raise(rb_eRangeError, "bignum out of range of unsigned long long");
}
- return num;
+ rb_raise(rb_eRangeError, "bignum out of range of unsigned long long");
}
LONG_LONG
@@ -1301,18 +5044,17 @@ rb_big2ll(VALUE x)
{
unsigned LONG_LONG num = big2ull(x, "long long");
- if (RBIGNUM_POSITIVE_P(x)) {
- if (LLONG_MAX < num)
- rb_raise(rb_eRangeError, "bignum too big to convert into `long long'");
- return num;
+ if (BIGNUM_POSITIVE_P(x)) {
+ if (num <= LLONG_MAX)
+ return num;
}
else {
if (num <= LLONG_MAX)
return -(LONG_LONG)num;
if (num == 1+(unsigned LONG_LONG)(-(LLONG_MIN+1)))
return LLONG_MIN;
- rb_raise(rb_eRangeError, "bignum too big to convert into `long long'");
}
+ rb_raise(rb_eRangeError, "bignum too big to convert into `long long'");
}
#endif /* HAVE_LONG_LONG */
@@ -1333,7 +5075,7 @@ dbl2big(double d)
rb_raise(rb_eFloatDomainError, "NaN");
}
- while (!POSFIXABLE(u) || 0 != (long)u) {
+ while (1.0 <= u) {
u /= (double)(BIGRAD);
i++;
}
@@ -1355,32 +5097,11 @@ rb_dbl2big(double d)
return bignorm(dbl2big(d));
}
-static int
-nlz(BDIGIT x)
-{
- BDIGIT y;
- int n = BITSPERDIG;
-#if BITSPERDIG > 64
- y = x >> 64; if (y) {n -= 64; x = y;}
-#endif
-#if BITSPERDIG > 32
- y = x >> 32; if (y) {n -= 32; x = y;}
-#endif
-#if BITSPERDIG > 16
- y = x >> 16; if (y) {n -= 16; x = y;}
-#endif
- y = x >> 8; if (y) {n -= 8; x = y;}
- y = x >> 4; if (y) {n -= 4; x = y;}
- y = x >> 2; if (y) {n -= 2; x = y;}
- y = x >> 1; if (y) {return n - 2;}
- return n - x;
-}
-
static double
big2dbl(VALUE x)
{
double d = 0.0;
- long i = (bigtrunc(x), RBIGNUM_LEN(x)), lo = 0, bits;
+ long i = (bigtrunc(x), BIGNUM_LEN(x)), lo = 0, bits;
BDIGIT *ds = BDIGITS(x), dl;
if (i) {
@@ -1397,16 +5118,17 @@ big2dbl(VALUE x)
d = ds[i] + BIGRAD*d;
}
dl = ds[i];
- if (bits && (dl & (1UL << (bits %= BITSPERDIG)))) {
- int carry = dl & ~(~(BDIGIT)0 << bits);
+ if (bits && (dl & ((BDIGIT)1 << (bits %= BITSPERDIG)))) {
+ int carry = (dl & ~(BDIGMAX << bits)) != 0;
if (!carry) {
while (i-- > 0) {
- if ((carry = ds[i]) != 0) break;
+ carry = ds[i] != 0;
+ if (carry) break;
}
}
if (carry) {
- dl &= (BDIGIT)~0 << bits;
- dl += (BDIGIT)1 << bits;
+ dl &= BDIGMAX << bits;
+ dl = BIGLO(dl + ((BDIGIT)1 << bits));
if (!dl) d += 1;
}
}
@@ -1421,7 +5143,7 @@ big2dbl(VALUE x)
}
}
}
- if (!RBIGNUM_SIGN(x)) d = -d;
+ if (!BIGNUM_SIGN(x)) d = -d;
return d;
}
@@ -1478,16 +5200,16 @@ rb_integer_float_cmp(VALUE x, VALUE y)
return INT2FIX(1);
return INT2FIX(0);
#else
- long xl, yl;
+ long xn, yn;
if (yi < FIXNUM_MIN)
return INT2FIX(1);
if (FIXNUM_MAX+1 <= yi)
return INT2FIX(-1);
- xl = FIX2LONG(x);
- yl = (long)yi;
- if (xl < yl)
+ xn = FIX2LONG(x);
+ yn = (long)yi;
+ if (xn < yn)
return INT2FIX(-1);
- if (xl > yl)
+ if (xn > yn)
return INT2FIX(1);
if (yf < 0.0)
return INT2FIX(1);
@@ -1523,12 +5245,12 @@ rb_integer_float_eq(VALUE x, VALUE y)
return Qfalse;
return Qtrue;
#else
- long xl, yl;
+ long xn, yn;
if (yi < LONG_MIN || LONG_MAX < yi)
return Qfalse;
- xl = FIX2LONG(x);
- yl = (long)yi;
- if (xl != yl)
+ xn = FIX2LONG(x);
+ yn = (long)yi;
+ if (xn != yn)
return Qfalse;
return Qtrue;
#endif
@@ -1552,39 +5274,37 @@ rb_integer_float_eq(VALUE x, VALUE y)
VALUE
rb_big_cmp(VALUE x, VALUE y)
{
- long xlen = RBIGNUM_LEN(x);
- BDIGIT *xds, *yds;
-
- switch (TYPE(y)) {
- case T_FIXNUM:
- y = rb_int2big(FIX2LONG(y));
- break;
-
- case T_BIGNUM:
- break;
+ int cmp;
- case T_FLOAT:
+ 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);
+ }
+ }
+ else if (RB_BIGNUM_TYPE_P(y)) {
+ }
+ else if (RB_FLOAT_TYPE_P(y)) {
return rb_integer_float_cmp(x, y);
-
- default:
+ }
+ else {
return rb_num_coerce_cmp(x, y, rb_intern("<=>"));
}
- if (RBIGNUM_SIGN(x) > RBIGNUM_SIGN(y)) return INT2FIX(1);
- if (RBIGNUM_SIGN(x) < RBIGNUM_SIGN(y)) return INT2FIX(-1);
- if (xlen < RBIGNUM_LEN(y))
- return (RBIGNUM_SIGN(x)) ? INT2FIX(-1) : INT2FIX(1);
- if (xlen > RBIGNUM_LEN(y))
- return (RBIGNUM_SIGN(x)) ? INT2FIX(1) : INT2FIX(-1);
-
- xds = BDIGITS(x);
- yds = BDIGITS(y);
+ if (BIGNUM_SIGN(x) > BIGNUM_SIGN(y)) return INT2FIX(1);
+ if (BIGNUM_SIGN(x) < BIGNUM_SIGN(y)) return INT2FIX(-1);
- while (xlen-- && (xds[xlen]==yds[xlen]));
- if (-1 == xlen) return INT2FIX(0);
- return (xds[xlen] > yds[xlen]) ?
- (RBIGNUM_SIGN(x) ? INT2FIX(1) : INT2FIX(-1)) :
- (RBIGNUM_SIGN(x) ? INT2FIX(-1) : INT2FIX(1));
+ cmp = bary_cmp(BDIGITS(x), BIGNUM_LEN(x), BDIGITS(y), BIGNUM_LEN(y));
+ if (BIGNUM_SIGN(x))
+ return INT2FIX(cmp);
+ else
+ return INT2FIX(-cmp);
}
enum big_op_t {
@@ -1600,27 +5320,21 @@ big_op(VALUE x, VALUE y, enum big_op_t op)
VALUE rel;
int n;
- switch (TYPE(y)) {
- case T_FIXNUM:
- case T_BIGNUM:
+ if (FIXNUM_P(y) || RB_BIGNUM_TYPE_P(y)) {
rel = rb_big_cmp(x, y);
- break;
-
- case T_FLOAT:
+ }
+ else if (RB_FLOAT_TYPE_P(y)) {
rel = rb_integer_float_cmp(x, y);
- break;
-
- default:
- {
- ID id = 0;
- switch (op) {
- case big_op_gt: id = '>'; break;
- case big_op_ge: id = rb_intern(">="); break;
- case big_op_lt: id = '<'; break;
- case big_op_le: id = rb_intern("<="); break;
- }
- return rb_num_coerce_relop(x, y, id);
+ }
+ else {
+ ID id = 0;
+ switch (op) {
+ case big_op_gt: id = '>'; break;
+ case big_op_ge: id = rb_intern(">="); break;
+ case big_op_lt: id = '<'; break;
+ case big_op_le: id = rb_intern("<="); break;
}
+ return rb_num_coerce_relop(x, y, id);
}
if (NIL_P(rel)) return Qfalse;
@@ -1705,20 +5419,21 @@ big_le(VALUE x, VALUE y)
VALUE
rb_big_eq(VALUE x, VALUE y)
{
- switch (TYPE(y)) {
- case T_FIXNUM:
+ if (FIXNUM_P(y)) {
+ if (bignorm(x) == y) return Qtrue;
y = rb_int2big(FIX2LONG(y));
- break;
- case T_BIGNUM:
- break;
- case T_FLOAT:
+ }
+ else if (RB_BIGNUM_TYPE_P(y)) {
+ }
+ else if (RB_FLOAT_TYPE_P(y)) {
return rb_integer_float_eq(x, y);
- default:
+ }
+ else {
return rb_equal(y, x);
}
- 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;
+ 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;
return Qtrue;
}
@@ -1736,10 +5451,10 @@ rb_big_eq(VALUE x, VALUE y)
VALUE
rb_big_eql(VALUE x, VALUE y)
{
- if (!RB_TYPE_P(y, T_BIGNUM)) 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;
+ 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;
return Qtrue;
}
@@ -1755,7 +5470,7 @@ rb_big_uminus(VALUE x)
{
VALUE z = rb_big_clone(x);
- RBIGNUM_SET_SIGN(z, !RBIGNUM_SIGN(x));
+ BIGNUM_SET_SIGN(z, !BIGNUM_SIGN(x));
return bignorm(z);
}
@@ -1776,78 +5491,49 @@ static VALUE
rb_big_neg(VALUE x)
{
VALUE z = rb_big_clone(x);
- BDIGIT *ds;
- long i;
-
- if (!RBIGNUM_SIGN(x)) get2comp(z);
- ds = BDIGITS(z);
- i = RBIGNUM_LEN(x);
- if (!i) return INT2FIX(~(SIGNED_VALUE)0);
- while (i--) {
- ds[i] = ~ds[i];
- }
- RBIGNUM_SET_SIGN(z, !RBIGNUM_SIGN(z));
- if (RBIGNUM_SIGN(x)) get2comp(z);
-
- return bignorm(z);
-}
+ BDIGIT *ds = BDIGITS(z);
+ long n = BIGNUM_LEN(z);
-static void
-bigsub_core(BDIGIT *xds, long xn, BDIGIT *yds, long yn, BDIGIT *zds, long zn)
-{
- BDIGIT_DBL_SIGNED num;
- long i;
+ if (!n) return INT2FIX(-1);
- for (i = 0, num = 0; i < yn; i++) {
- num += (BDIGIT_DBL_SIGNED)xds[i] - yds[i];
- zds[i] = BIGLO(num);
- num = BIGDN(num);
- }
- while (num && i < xn) {
- num += xds[i];
- zds[i++] = BIGLO(num);
- num = BIGDN(num);
- }
- while (i < xn) {
- zds[i] = xds[i];
- i++;
+ if (BIGNUM_POSITIVE_P(z)) {
+ if (bary_add_one(ds, n)) {
+ big_extend_carry(z);
+ }
+ BIGNUM_SET_NEGATIVE_SIGN(z);
}
- assert(i <= zn);
- while (i < zn) {
- zds[i++] = 0;
+ else {
+ bary_neg(ds, n);
+ if (bary_add_one(ds, n))
+ return INT2FIX(-1);
+ bary_neg(ds, n);
+ BIGNUM_SET_POSITIVE_SIGN(z);
}
+
+ return bignorm(z);
}
static VALUE
bigsub(VALUE x, VALUE y)
{
- VALUE z = 0;
- long i = RBIGNUM_LEN(x);
- BDIGIT *xds, *yds;
+ VALUE z;
+ BDIGIT *xds, *yds, *zds;
+ long xn, yn, zn;
- /* if x is smaller than y, swap */
- if (RBIGNUM_LEN(x) < RBIGNUM_LEN(y)) {
- z = x; x = y; y = z; /* swap x y */
- }
- else if (RBIGNUM_LEN(x) == RBIGNUM_LEN(y)) {
- xds = BDIGITS(x);
- yds = BDIGITS(y);
- while (i > 0) {
- i--;
- if (xds[i] > yds[i]) {
- break;
- }
- if (xds[i] < yds[i]) {
- z = x; x = y; y = z; /* swap x y */
- break;
- }
- }
- }
+ xn = BIGNUM_LEN(x);
+ yn = BIGNUM_LEN(y);
+ zn = xn < yn ? yn : xn;
+
+ z = bignew(zn, 1);
+
+ xds = BDIGITS(x);
+ yds = BDIGITS(y);
+ zds = BDIGITS(z);
- z = bignew(RBIGNUM_LEN(x), z==0);
- bigsub_core(BDIGITS(x), RBIGNUM_LEN(x),
- BDIGITS(y), RBIGNUM_LEN(y),
- BDIGITS(z), RBIGNUM_LEN(z));
+ if (bary_sub(zds, zn, xds, xn, yds, yn)) {
+ bary_2comp(zds, zn);
+ BIGNUM_SET_NEGATIVE_SIGN(z);
+ }
return z;
}
@@ -1859,21 +5545,30 @@ bigsub_int(VALUE x, long y0)
{
VALUE z;
BDIGIT *xds, *zds;
- long xn;
+ long xn, zn;
BDIGIT_DBL_SIGNED num;
long i, y;
y = y0;
xds = BDIGITS(x);
- xn = RBIGNUM_LEN(x);
+ xn = BIGNUM_LEN(x);
+
+ if (xn == 0)
+ return LONG2NUM(-y0);
- z = bignew(xn, RBIGNUM_SIGN(x));
+ zn = xn;
+#if SIZEOF_BDIGIT < SIZEOF_LONG
+ if (zn < bdigit_roomof(SIZEOF_LONG))
+ zn = bdigit_roomof(SIZEOF_LONG);
+#endif
+ z = bignew(zn, BIGNUM_SIGN(x));
zds = BDIGITS(z);
-#if SIZEOF_BDIGITS == SIZEOF_LONG
+#if SIZEOF_BDIGIT >= SIZEOF_LONG
+ assert(xn == zn);
num = (BDIGIT_DBL_SIGNED)xds[0] - y;
if (xn == 1 && num < 0) {
- RBIGNUM_SET_SIGN(z, !RBIGNUM_SIGN(x));
+ BIGNUM_SET_SIGN(z, !BIGNUM_SIGN(x));
zds[0] = (BDIGIT)-num;
RB_GC_GUARD(x);
return bignorm(z);
@@ -1881,26 +5576,62 @@ bigsub_int(VALUE x, long y0)
zds[0] = BIGLO(num);
num = BIGDN(num);
i = 1;
+ if (i < xn)
+ goto y_is_zero_x;
+ goto finish;
#else
num = 0;
- for (i=0; i<(int)(sizeof(y)/sizeof(BDIGIT)); i++) {
+ for (i=0; i < xn; i++) {
+ if (y == 0) goto y_is_zero_x;
num += (BDIGIT_DBL_SIGNED)xds[i] - BIGLO(y);
zds[i] = BIGLO(num);
num = BIGDN(num);
y = BIGDN(y);
}
+ for (; i < zn; i++) {
+ if (y == 0) goto y_is_zero_z;
+ num -= BIGLO(y);
+ zds[i] = BIGLO(num);
+ num = BIGDN(num);
+ y = BIGDN(y);
+ }
+ goto finish;
#endif
- while (num && i < xn) {
+
+ for (; i < xn; i++) {
+ y_is_zero_x:
+ if (num == 0) goto num_is_zero_x;
num += xds[i];
- zds[i++] = BIGLO(num);
+ zds[i] = BIGLO(num);
num = BIGDN(num);
}
- while (i < xn) {
+#if SIZEOF_BDIGIT < SIZEOF_LONG
+ for (; i < zn; i++) {
+ y_is_zero_z:
+ if (num == 0) goto num_is_zero_z;
+ zds[i] = BIGLO(num);
+ num = BIGDN(num);
+ }
+#endif
+ goto finish;
+
+ for (; i < xn; i++) {
+ num_is_zero_x:
zds[i] = xds[i];
- i++;
}
+#if SIZEOF_BDIGIT < SIZEOF_LONG
+ for (; i < zn; i++) {
+ num_is_zero_z:
+ zds[i] = 0;
+ }
+#endif
+ goto finish;
+
+ finish:
+ assert(num == 0 || num == -1);
if (num < 0) {
- z = bigsub(x, rb_int2big(y0));
+ get2comp(z);
+ BIGNUM_SET_SIGN(z, !BIGNUM_SIGN(x));
}
RB_GC_GUARD(x);
return bignorm(z);
@@ -1916,106 +5647,102 @@ bigadd_int(VALUE x, long y)
long i;
xds = BDIGITS(x);
- xn = RBIGNUM_LEN(x);
+ xn = BIGNUM_LEN(x);
- if (xn < 2) {
- zn = 3;
- }
- else {
- zn = xn + 1;
- }
- z = bignew(zn, RBIGNUM_SIGN(x));
+ if (xn == 0)
+ return LONG2NUM(y);
+
+ zn = xn;
+#if SIZEOF_BDIGIT < SIZEOF_LONG
+ if (zn < bdigit_roomof(SIZEOF_LONG))
+ zn = bdigit_roomof(SIZEOF_LONG);
+#endif
+ zn++;
+
+ z = bignew(zn, BIGNUM_SIGN(x));
zds = BDIGITS(z);
-#if SIZEOF_BDIGITS == SIZEOF_LONG
+#if SIZEOF_BDIGIT >= SIZEOF_LONG
num = (BDIGIT_DBL)xds[0] + y;
zds[0] = BIGLO(num);
num = BIGDN(num);
i = 1;
+ if (i < xn)
+ goto y_is_zero_x;
+ goto y_is_zero_z;
#else
num = 0;
- for (i=0; i<(int)(sizeof(y)/sizeof(BDIGIT)); i++) {
+ for (i=0; i < xn; i++) {
+ if (y == 0) goto y_is_zero_x;
num += (BDIGIT_DBL)xds[i] + BIGLO(y);
zds[i] = BIGLO(num);
num = BIGDN(num);
y = BIGDN(y);
}
-#endif
- while (num && i < xn) {
- num += xds[i];
- zds[i++] = BIGLO(num);
+ for (; i < zn; i++) {
+ if (y == 0) goto y_is_zero_z;
+ num += BIGLO(y);
+ zds[i] = BIGLO(num);
num = BIGDN(num);
+ y = BIGDN(y);
}
- if (num) zds[i++] = (BDIGIT)num;
- else while (i < xn) {
- zds[i] = xds[i];
- i++;
- }
- assert(i <= zn);
- while (i < zn) {
- zds[i++] = 0;
- }
- RB_GC_GUARD(x);
- return bignorm(z);
-}
-
-static void
-bigadd_core(BDIGIT *xds, long xn, BDIGIT *yds, long yn, BDIGIT *zds, long zn)
-{
- BDIGIT_DBL num = 0;
- long i;
+ goto finish;
- if (xn > yn) {
- BDIGIT *tds;
- tds = xds; xds = yds; yds = tds;
- i = xn; xn = yn; yn = i;
- }
+#endif
- i = 0;
- while (i < xn) {
- num += (BDIGIT_DBL)xds[i] + yds[i];
- zds[i++] = BIGLO(num);
+ for (;i < xn; i++) {
+ y_is_zero_x:
+ if (num == 0) goto num_is_zero_x;
+ num += (BDIGIT_DBL)xds[i];
+ zds[i] = BIGLO(num);
num = BIGDN(num);
}
- while (num && i < yn) {
- num += yds[i];
- zds[i++] = BIGLO(num);
+ for (; i < zn; i++) {
+ y_is_zero_z:
+ if (num == 0) goto num_is_zero_z;
+ zds[i] = BIGLO(num);
num = BIGDN(num);
}
- while (i < yn) {
- zds[i] = yds[i];
- i++;
+ goto finish;
+
+ for (;i < xn; i++) {
+ num_is_zero_x:
+ zds[i] = xds[i];
}
- if (num) zds[i++] = (BDIGIT)num;
- assert(i <= zn);
- while (i < zn) {
- zds[i++] = 0;
+ for (; i < zn; i++) {
+ num_is_zero_z:
+ zds[i] = 0;
}
+ goto finish;
+
+ finish:
+ RB_GC_GUARD(x);
+ return bignorm(z);
}
static VALUE
bigadd(VALUE x, VALUE y, int sign)
{
VALUE z;
- long len;
+ size_t len;
- sign = (sign == RBIGNUM_SIGN(y));
- if (RBIGNUM_SIGN(x) != sign) {
+ sign = (sign == BIGNUM_SIGN(y));
+ if (BIGNUM_SIGN(x) != sign) {
if (sign) return bigsub(y, x);
return bigsub(x, y);
}
- if (RBIGNUM_LEN(x) > RBIGNUM_LEN(y)) {
- len = RBIGNUM_LEN(x) + 1;
+ if (BIGNUM_LEN(x) > BIGNUM_LEN(y)) {
+ len = BIGNUM_LEN(x) + 1;
}
else {
- len = RBIGNUM_LEN(y) + 1;
+ len = BIGNUM_LEN(y) + 1;
}
z = bignew(len, sign);
- bigadd_core(BDIGITS(x), RBIGNUM_LEN(x),
- BDIGITS(y), RBIGNUM_LEN(y),
- BDIGITS(z), RBIGNUM_LEN(z));
+ bary_add(BDIGITS(z), BIGNUM_LEN(z),
+ BDIGITS(x), BIGNUM_LEN(x),
+ BDIGITS(y), BIGNUM_LEN(y));
return z;
}
@@ -2032,10 +5759,9 @@ rb_big_plus(VALUE x, VALUE y)
{
long n;
- switch (TYPE(y)) {
- case T_FIXNUM:
+ if (FIXNUM_P(y)) {
n = FIX2LONG(y);
- if ((n > 0) != RBIGNUM_SIGN(x)) {
+ if ((n > 0) != BIGNUM_SIGN(x)) {
if (n < 0) {
n = -n;
}
@@ -2045,14 +5771,14 @@ rb_big_plus(VALUE x, VALUE y)
n = -n;
}
return bigadd_int(x, n);
-
- case T_BIGNUM:
+ }
+ else if (RB_BIGNUM_TYPE_P(y)) {
return bignorm(bigadd(x, y, 1));
-
- case T_FLOAT:
+ }
+ else if (RB_FLOAT_TYPE_P(y)) {
return DBL2NUM(rb_big2dbl(x) + RFLOAT_VALUE(y));
-
- default:
+ }
+ else {
return rb_num_coerce_bin(x, y, '+');
}
}
@@ -2069,10 +5795,9 @@ rb_big_minus(VALUE x, VALUE y)
{
long n;
- switch (TYPE(y)) {
- case T_FIXNUM:
+ if (FIXNUM_P(y)) {
n = FIX2LONG(y);
- if ((n > 0) != RBIGNUM_SIGN(x)) {
+ if ((n > 0) != BIGNUM_SIGN(x)) {
if (n < 0) {
n = -n;
}
@@ -2082,573 +5807,76 @@ rb_big_minus(VALUE x, VALUE y)
n = -n;
}
return bigsub_int(x, n);
-
- case T_BIGNUM:
- return bignorm(bigadd(x, y, 0));
-
- case T_FLOAT:
- return DBL2NUM(rb_big2dbl(x) - RFLOAT_VALUE(y));
-
- default:
- return rb_num_coerce_bin(x, y, '-');
- }
-}
-
-static long
-big_real_len(VALUE x)
-{
- long i = RBIGNUM_LEN(x);
- BDIGIT *xds = BDIGITS(x);
- while (--i && !xds[i]);
- return i + 1;
-}
-
-static VALUE
-bigmul1_single(VALUE x, VALUE y)
-{
- BDIGIT_DBL n;
- VALUE z = bignew(2, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
- BDIGIT *xds, *yds, *zds;
-
- xds = BDIGITS(x);
- yds = BDIGITS(y);
- zds = BDIGITS(z);
-
- n = (BDIGIT_DBL)xds[0] * yds[0];
- zds[0] = BIGLO(n);
- zds[1] = (BDIGIT)BIGDN(n);
-
- return z;
-}
-
-static VALUE
-bigmul1_normal(VALUE x, VALUE y)
-{
- long xl = RBIGNUM_LEN(x), yl = RBIGNUM_LEN(y), i, j = xl + yl + 1;
- BDIGIT_DBL n = 0;
- VALUE z = bignew(j, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
- BDIGIT *xds, *yds, *zds;
-
- xds = BDIGITS(x);
- yds = BDIGITS(y);
- zds = BDIGITS(z);
- while (j--) zds[j] = 0;
- for (i = 0; i < xl; i++) {
- BDIGIT_DBL dd;
- dd = xds[i];
- if (dd == 0) continue;
- n = 0;
- for (j = 0; j < yl; j++) {
- BDIGIT_DBL ee = n + (BDIGIT_DBL)dd * yds[j];
- n = zds[i + j] + ee;
- if (ee) zds[i + j] = BIGLO(n);
- n = BIGDN(n);
- }
- if (n) {
- zds[i + j] = (BDIGIT)n;
- }
- }
- rb_thread_check_ints();
- return z;
-}
-
-static VALUE bigmul0(VALUE x, VALUE y);
-
-/* balancing multiplication by slicing larger argument */
-static VALUE
-bigmul1_balance(VALUE x, VALUE y)
-{
- VALUE z, t1, t2;
- long i, xn, yn, r, n;
- BDIGIT *yds, *zds, *t1ds;
-
- xn = RBIGNUM_LEN(x);
- yn = RBIGNUM_LEN(y);
- assert(2 * xn <= yn || 3 * xn <= 2*(yn+2));
-
- z = bignew(xn + yn, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
- t1 = bignew(xn, 1);
-
- yds = BDIGITS(y);
- zds = BDIGITS(z);
- t1ds = BDIGITS(t1);
-
- for (i = 0; i < xn + yn; i++) zds[i] = 0;
-
- n = 0;
- while (yn > 0) {
- r = xn > yn ? yn : xn;
- MEMCPY(t1ds, yds + n, BDIGIT, r);
- RBIGNUM_SET_LEN(t1, r);
- t2 = bigmul0(x, t1);
- bigadd_core(zds + n, RBIGNUM_LEN(z) - n,
- BDIGITS(t2), big_real_len(t2),
- zds + n, RBIGNUM_LEN(z) - n);
- yn -= r;
- n += r;
}
-
- return z;
-}
-
-/* split a bignum into high and low bignums */
-static void
-big_split(VALUE v, long n, volatile VALUE *ph, volatile VALUE *pl)
-{
- long hn = 0, ln = RBIGNUM_LEN(v);
- VALUE h, l;
- BDIGIT *vds = BDIGITS(v);
-
- if (ln > n) {
- hn = ln - n;
- ln = n;
+ else if (RB_BIGNUM_TYPE_P(y)) {
+ return bignorm(bigadd(x, y, 0));
}
-
- if (!hn) {
- h = rb_uint2big(0);
+ else if (RB_FLOAT_TYPE_P(y)) {
+ return DBL2NUM(rb_big2dbl(x) - RFLOAT_VALUE(y));
}
else {
- while (--hn && !vds[hn + ln]);
- h = bignew(hn += 2, 1);
- MEMCPY(BDIGITS(h), vds + ln, BDIGIT, hn - 1);
- BDIGITS(h)[hn - 1] = 0; /* margin for carry */
+ return rb_num_coerce_bin(x, y, '-');
}
-
- while (--ln && !vds[ln]);
- l = bignew(ln += 2, 1);
- MEMCPY(BDIGITS(l), vds, BDIGIT, ln - 1);
- BDIGITS(l)[ln - 1] = 0; /* margin for carry */
-
- *pl = l;
- *ph = h;
}
-/* multiplication by karatsuba method */
static VALUE
-bigmul1_karatsuba(VALUE x, VALUE y)
+bigsq(VALUE x)
{
- long i, n, xn, yn, t1n, t2n;
- VALUE xh, xl, yh, yl, z, t1, t2, t3;
- BDIGIT *zds;
+ long xn, zn;
+ VALUE z;
+ BDIGIT *xds, *zds;
- xn = RBIGNUM_LEN(x);
- yn = RBIGNUM_LEN(y);
- n = yn / 2;
- big_split(x, n, &xh, &xl);
- if (x == y) {
- yh = xh; yl = xl;
- }
- else big_split(y, n, &yh, &yl);
+ xn = BIGNUM_LEN(x);
+ zn = 2 * xn;
- /* x = xh * b + xl
- * y = yh * b + yl
- *
- * Karatsuba method:
- * x * y = z2 * b^2 + z1 * b + z0
- * where
- * z2 = xh * yh
- * z0 = xl * yl
- * z1 = (xh + xl) * (yh + yl) - z2 - z0
- *
- * ref: http://en.wikipedia.org/wiki/Karatsuba_algorithm
- */
+ z = bignew(zn, 1);
- /* allocate a result bignum */
- z = bignew(xn + yn, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
+ xds = BDIGITS(x);
zds = BDIGITS(z);
- /* t1 <- xh * yh */
- t1 = bigmul0(xh, yh);
- t1n = big_real_len(t1);
-
- /* copy t1 into high bytes of the result (z2) */
- MEMCPY(zds + 2 * n, BDIGITS(t1), BDIGIT, t1n);
- for (i = 2 * n + t1n; i < xn + yn; i++) zds[i] = 0;
-
- if (!BIGZEROP(xl) && !BIGZEROP(yl)) {
- /* t2 <- xl * yl */
- t2 = bigmul0(xl, yl);
- t2n = big_real_len(t2);
-
- /* copy t2 into low bytes of the result (z0) */
- MEMCPY(zds, BDIGITS(t2), BDIGIT, t2n);
- for (i = t2n; i < 2 * n; i++) zds[i] = 0;
- }
- else {
- t2 = Qundef;
- t2n = 0;
-
- /* copy 0 into low bytes of the result (z0) */
- for (i = 0; i < 2 * n; i++) zds[i] = 0;
- }
-
- /* xh <- xh + xl */
- if (RBIGNUM_LEN(xl) > RBIGNUM_LEN(xh)) {
- t3 = xl; xl = xh; xh = t3;
- }
- /* xh has a margin for carry */
- bigadd_core(BDIGITS(xh), RBIGNUM_LEN(xh),
- BDIGITS(xl), RBIGNUM_LEN(xl),
- BDIGITS(xh), RBIGNUM_LEN(xh));
-
- /* yh <- yh + yl */
- if (x != y) {
- if (RBIGNUM_LEN(yl) > RBIGNUM_LEN(yh)) {
- t3 = yl; yl = yh; yh = t3;
- }
- /* yh has a margin for carry */
- bigadd_core(BDIGITS(yh), RBIGNUM_LEN(yh),
- BDIGITS(yl), RBIGNUM_LEN(yl),
- BDIGITS(yh), RBIGNUM_LEN(yh));
- }
- else yh = xh;
-
- /* t3 <- xh * yh */
- t3 = bigmul0(xh, yh);
-
- i = xn + yn - n;
- /* subtract t1 from t3 */
- bigsub_core(BDIGITS(t3), big_real_len(t3), BDIGITS(t1), t1n, BDIGITS(t3), big_real_len(t3));
-
- /* subtract t2 from t3; t3 is now the middle term of the product */
- if (t2 != Qundef) bigsub_core(BDIGITS(t3), big_real_len(t3), BDIGITS(t2), t2n, BDIGITS(t3), big_real_len(t3));
-
- /* add t3 to middle bytes of the result (z1) */
- bigadd_core(zds + n, i, BDIGITS(t3), big_real_len(t3), zds + n, i);
+#ifdef USE_GMP
+ if (xn < GMP_MUL_DIGITS)
+ bary_sq_fast(zds, zn, xds, xn);
+ else
+ bary_mul(zds, zn, xds, xn, xds, xn);
+#else
+ if (xn < KARATSUBA_MUL_DIGITS)
+ bary_sq_fast(zds, zn, xds, xn);
+ else
+ bary_mul(zds, zn, xds, xn, xds, xn);
+#endif
+ RB_GC_GUARD(x);
return z;
}
-static void
-biglsh_bang(BDIGIT *xds, long xn, unsigned long shift)
-{
- long const s1 = shift/BITSPERDIG;
- int const s2 = (int)(shift%BITSPERDIG);
- int const s3 = BITSPERDIG-s2;
- BDIGIT* zds;
- BDIGIT num;
- long i;
- if (s1 >= xn) {
- MEMZERO(xds, BDIGIT, xn);
- return;
- }
- zds = xds + xn - 1;
- xn -= s1 + 1;
- num = xds[xn]<<s2;
- while (0 < xn) {
- *zds-- = num | xds[--xn]>>s3;
- num = xds[xn]<<s2;
- }
- assert(xds <= zds);
- *zds = num;
- for (i = s1; i > 0; --i)
- *zds-- = 0;
-}
-
-static void
-bigrsh_bang(BDIGIT* xds, long xn, unsigned long shift)
-{
- long s1 = shift/BITSPERDIG;
- int s2 = (int)(shift%BITSPERDIG);
- int s3 = BITSPERDIG - s2;
- int i;
- BDIGIT num;
- BDIGIT* zds;
- if (s1 >= xn) {
- MEMZERO(xds, BDIGIT, xn);
- return;
- }
-
- i = 0;
- zds = xds + s1;
- num = *zds++>>s2;
- while (i < xn - s1 - 1) {
- xds[i++] = (BDIGIT)(*zds<<s3) | num;
- num = *zds++>>s2;
- }
- assert(i < xn);
- xds[i] = num;
- MEMZERO(xds + xn - s1, BDIGIT, s1);
-}
-
-static void
-big_split3(VALUE v, long n, volatile VALUE* p0, volatile VALUE* p1, volatile VALUE* p2)
-{
- VALUE v0, v12, v1, v2;
-
- big_split(v, n, &v12, &v0);
- big_split(v12, n, &v2, &v1);
-
- *p0 = bigtrunc(v0);
- *p1 = bigtrunc(v1);
- *p2 = bigtrunc(v2);
-}
-
-static VALUE big_lshift(VALUE, unsigned long);
-static VALUE big_rshift(VALUE, unsigned long);
-static VALUE bigdivrem(VALUE, VALUE, volatile VALUE*, volatile VALUE*);
-
static VALUE
-bigmul1_toom3(VALUE x, VALUE y)
+bigmul0(VALUE x, VALUE y)
{
- long n, xn, yn, zn;
- VALUE x0, x1, x2, y0, y1, y2;
- VALUE u0, u1, u2, u3, u4, v1, v2, v3;
- VALUE z0, z1, z2, z3, z4, z, t;
- BDIGIT* zds;
-
- xn = RBIGNUM_LEN(x);
- yn = RBIGNUM_LEN(y);
- assert(xn <= yn); /* assume y >= x */
-
- n = (yn + 2) / 3;
- big_split3(x, n, &x0, &x1, &x2);
- if (x == y) {
- y0 = x0; y1 = x1; y2 = x2;
- }
- else big_split3(y, n, &y0, &y1, &y2);
-
- /*
- * ref. http://en.wikipedia.org/wiki/Toom%E2%80%93Cook_multiplication
- *
- * x(b) = x0 * b^0 + x1 * b^1 + x2 * b^2
- * y(b) = y0 * b^0 + y1 * b^1 + y2 * b^2
- *
- * z(b) = x(b) * y(b)
- * z(b) = z0 * b^0 + z1 * b^1 + z2 * b^2 + z3 * b^3 + z4 * b^4
- * where:
- * z0 = x0 * y0
- * z1 = x0 * y1 + x1 * y0
- * z2 = x0 * y2 + x1 * y1 + x2 * y0
- * z3 = x1 * y2 + x2 * y1
- * z4 = x2 * y2
- *
- * Toom3 method (a.k.a. Toom-Cook method):
- * (Step1) calculating 5 points z(b0), z(b1), z(b2), z(b3), z(b4),
- * where:
- * b0 = 0, b1 = 1, b2 = -1, b3 = -2, b4 = inf,
- * z(0) = x(0) * y(0) = x0 * y0
- * z(1) = x(1) * y(1) = (x0 + x1 + x2) * (y0 + y1 + y2)
- * z(-1) = x(-1) * y(-1) = (x0 - x1 + x2) * (y0 - y1 + y2)
- * z(-2) = x(-2) * y(-2) = (x0 - 2 * (x1 - 2 * x2)) * (y0 - 2 * (y1 - 2 * y2))
- * z(inf) = x(inf) * y(inf) = x2 * y2
- *
- * (Step2) interpolating z0, z1, z2, z3, z4, and z5.
- *
- * (Step3) Substituting base value into b of the polynomial z(b),
- */
-
- /*
- * [Step1] calculating 5 points z(b0), z(b1), z(b2), z(b3), z(b4)
- */
-
- /* u1 <- x0 + x2 */
- u1 = bigtrunc(bigadd(x0, x2, 1));
-
- /* x(-1) : u2 <- u1 - x1 = x0 - x1 + x2 */
- u2 = bigtrunc(bigsub(u1, x1));
-
- /* x(1) : u1 <- u1 + x1 = x0 + x1 + x2 */
- u1 = bigtrunc(bigadd(u1, x1, 1));
-
- /* x(-2) : u3 <- 2 * (u2 + x2) - x0 = x0 - 2 * (x1 - 2 * x2) */
- u3 = bigadd(u2, x2, 1);
- if (BDIGITS(u3)[RBIGNUM_LEN(u3)-1] & BIGRAD_HALF) {
- rb_big_resize(u3, RBIGNUM_LEN(u3) + 1);
- BDIGITS(u3)[RBIGNUM_LEN(u3)-1] = 0;
- }
- biglsh_bang(BDIGITS(u3), RBIGNUM_LEN(u3), 1);
- u3 = bigtrunc(bigadd(bigtrunc(u3), x0, 0));
-
- if (x == y) {
- v1 = u1; v2 = u2; v3 = u3;
- }
- else {
- /* v1 <- y0 + y2 */
- v1 = bigtrunc(bigadd(y0, y2, 1));
-
- /* y(-1) : v2 <- v1 - y1 = y0 - y1 + y2 */
- v2 = bigtrunc(bigsub(v1, y1));
-
- /* y(1) : v1 <- v1 + y1 = y0 + y1 + y2 */
- v1 = bigtrunc(bigadd(v1, y1, 1));
-
- /* y(-2) : v3 <- 2 * (v2 + y2) - y0 = y0 - 2 * (y1 - 2 * y2) */
- v3 = bigadd(v2, y2, 1);
- if (BDIGITS(v3)[RBIGNUM_LEN(v3)-1] & BIGRAD_HALF) {
- rb_big_resize(v3, RBIGNUM_LEN(v3) + 1);
- BDIGITS(v3)[RBIGNUM_LEN(v3)-1] = 0;
- }
- biglsh_bang(BDIGITS(v3), RBIGNUM_LEN(v3), 1);
- v3 = bigtrunc(bigadd(bigtrunc(v3), y0, 0));
- }
-
- /* z(0) : u0 <- x0 * y0 */
- u0 = bigtrunc(bigmul0(x0, y0));
-
- /* z(1) : u1 <- u1 * v1 */
- u1 = bigtrunc(bigmul0(u1, v1));
-
- /* z(-1) : u2 <- u2 * v2 */
- u2 = bigtrunc(bigmul0(u2, v2));
-
- /* z(-2) : u3 <- u3 * v3 */
- u3 = bigtrunc(bigmul0(u3, v3));
-
- /* z(inf) : u4 <- x2 * y2 */
- u4 = bigtrunc(bigmul0(x2, y2));
-
- /* for GC */
- v1 = v2 = v3 = Qnil;
-
- /*
- * [Step2] interpolating z0, z1, z2, z3, z4, and z5.
- */
-
- /* z0 <- z(0) == u0 */
- z0 = u0;
-
- /* z4 <- z(inf) == u4 */
- z4 = u4;
-
- /* z3 <- (z(-2) - z(1)) / 3 == (u3 - u1) / 3 */
- z3 = bigadd(u3, u1, 0);
- bigdivrem(z3, big_three, &z3, NULL); /* TODO: optimize */
- bigtrunc(z3);
-
- /* z1 <- (z(1) - z(-1)) / 2 == (u1 - u2) / 2 */
- z1 = bigtrunc(bigadd(u1, u2, 0));
- bigrsh_bang(BDIGITS(z1), RBIGNUM_LEN(z1), 1);
-
- /* z2 <- z(-1) - z(0) == u2 - u0 */
- z2 = bigtrunc(bigadd(u2, u0, 0));
-
- /* z3 <- (z2 - z3) / 2 + 2 * z(inf) == (z2 - z3) / 2 + 2 * u4 */
- z3 = bigtrunc(bigadd(z2, z3, 0));
- bigrsh_bang(BDIGITS(z3), RBIGNUM_LEN(z3), 1);
- t = big_lshift(u4, 1); /* TODO: combining with next addition */
- z3 = bigtrunc(bigadd(z3, t, 1));
+ long xn, yn, zn;
+ VALUE z;
+ BDIGIT *xds, *yds, *zds;
- /* z2 <- z2 + z1 - z(inf) == z2 + z1 - u4 */
- z2 = bigtrunc(bigadd(z2, z1, 1));
- z2 = bigtrunc(bigadd(z2, u4, 0));
+ if (x == y)
+ return bigsq(x);
- /* z1 <- z1 - z3 */
- z1 = bigtrunc(bigadd(z1, z3, 0));
+ xn = BIGNUM_LEN(x);
+ yn = BIGNUM_LEN(y);
+ zn = xn + yn;
- /*
- * [Step3] Substituting base value into b of the polynomial z(b),
- */
+ z = bignew(zn, BIGNUM_SIGN(x)==BIGNUM_SIGN(y));
- zn = 6*n + 1;
- z = bignew(zn, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
+ xds = BDIGITS(x);
+ yds = BDIGITS(y);
zds = BDIGITS(z);
- MEMCPY(zds, BDIGITS(z0), BDIGIT, RBIGNUM_LEN(z0));
- MEMZERO(zds + RBIGNUM_LEN(z0), BDIGIT, zn - RBIGNUM_LEN(z0));
- bigadd_core(zds + n, zn - n, BDIGITS(z1), big_real_len(z1), zds + n, zn - n);
- bigadd_core(zds + 2*n, zn - 2*n, BDIGITS(z2), big_real_len(z2), zds + 2*n, zn - 2*n);
- bigadd_core(zds + 3*n, zn - 3*n, BDIGITS(z3), big_real_len(z3), zds + 3*n, zn - 3*n);
- bigadd_core(zds + 4*n, zn - 4*n, BDIGITS(z4), big_real_len(z4), zds + 4*n, zn - 4*n);
- z = bignorm(z);
- return bignorm(z);
-}
-
-/* efficient squaring (2 times faster than normal multiplication)
- * ref: Handbook of Applied Cryptography, Algorithm 14.16
- * http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf
- */
-static VALUE
-bigsqr_fast(VALUE x)
-{
- long len = RBIGNUM_LEN(x), i, j;
- VALUE z = bignew(2 * len + 1, 1);
- BDIGIT *xds = BDIGITS(x), *zds = BDIGITS(z);
- BDIGIT_DBL c, v, w;
+ bary_mul(zds, zn, xds, xn, yds, yn);
- for (i = 2 * len + 1; i--; ) zds[i] = 0;
- for (i = 0; i < len; i++) {
- v = (BDIGIT_DBL)xds[i];
- if (!v) continue;
- c = (BDIGIT_DBL)zds[i + i] + v * v;
- zds[i + i] = BIGLO(c);
- c = BIGDN(c);
- v *= 2;
- for (j = i + 1; j < len; j++) {
- w = (BDIGIT_DBL)xds[j];
- c += (BDIGIT_DBL)zds[i + j] + BIGLO(v) * w;
- zds[i + j] = BIGLO(c);
- c = BIGDN(c);
- if (BIGDN(v)) c += w;
- }
- if (c) {
- c += (BDIGIT_DBL)zds[i + len];
- zds[i + len] = BIGLO(c);
- c = BIGDN(c);
- }
- if (c) zds[i + len + 1] += (BDIGIT)c;
- }
+ RB_GC_GUARD(x);
+ RB_GC_GUARD(y);
return z;
}
-#define KARATSUBA_MUL_DIGITS 70
-#define TOOM3_MUL_DIGITS 150
-
-
-/* determine whether a bignum is sparse or not by random sampling */
-static inline VALUE
-big_sparse_p(VALUE x)
-{
- long c = 0, n = RBIGNUM_LEN(x);
-
- if ( BDIGITS(x)[rb_genrand_ulong_limited(n / 2) + n / 4]) c++;
- if (c <= 1 && BDIGITS(x)[rb_genrand_ulong_limited(n / 2) + n / 4]) c++;
- if (c <= 1 && BDIGITS(x)[rb_genrand_ulong_limited(n / 2) + n / 4]) c++;
-
- return (c <= 1) ? Qtrue : Qfalse;
-}
-
-static VALUE
-bigmul0(VALUE x, VALUE y)
-{
- long xn, yn;
-
- xn = RBIGNUM_LEN(x);
- yn = RBIGNUM_LEN(y);
-
- /* make sure that y is longer than x */
- if (xn > yn) {
- VALUE t;
- long tn;
- t = x; x = y; y = t;
- tn = xn; xn = yn; yn = tn;
- }
- assert(xn <= yn);
-
- /* normal multiplication when x is small */
- if (xn < KARATSUBA_MUL_DIGITS) {
- normal:
- if (x == y) return bigsqr_fast(x);
- if (xn == 1 && yn == 1) return bigmul1_single(x, y);
- return bigmul1_normal(x, y);
- }
-
- /* normal multiplication when x or y is a sparse bignum */
- if (big_sparse_p(x)) goto normal;
- if (big_sparse_p(y)) return bigmul1_normal(y, x);
-
- /* balance multiplication by slicing y when x is much smaller than y */
- if (2 * xn <= yn) return bigmul1_balance(x, y);
-
- if (xn < TOOM3_MUL_DIGITS) {
- /* multiplication by karatsuba method */
- return bigmul1_karatsuba(x, y);
- }
- else if (3*xn <= 2*(yn + 2))
- return bigmul1_balance(x, y);
- return bigmul1_toom3(x, y);
-}
-
/*
* call-seq:
* big * other -> Numeric
@@ -2659,207 +5887,112 @@ bigmul0(VALUE x, VALUE y)
VALUE
rb_big_mul(VALUE x, VALUE y)
{
- switch (TYPE(y)) {
- case T_FIXNUM:
+ if (FIXNUM_P(y)) {
y = rb_int2big(FIX2LONG(y));
- break;
-
- case T_BIGNUM:
- break;
-
- case T_FLOAT:
+ }
+ else if (RB_BIGNUM_TYPE_P(y)) {
+ }
+ else if (RB_FLOAT_TYPE_P(y)) {
return DBL2NUM(rb_big2dbl(x) * RFLOAT_VALUE(y));
-
- default:
+ }
+ else {
return rb_num_coerce_bin(x, y, '*');
}
return bignorm(bigmul0(x, y));
}
-struct big_div_struct {
- long nx, ny, j, nyzero;
- BDIGIT *yds, *zds;
- volatile VALUE stop;
-};
-
-static void *
-bigdivrem1(void *ptr)
-{
- struct big_div_struct *bds = (struct big_div_struct*)ptr;
- long ny = bds->ny;
- long i, j;
- BDIGIT *yds = bds->yds, *zds = bds->zds;
- BDIGIT_DBL t2;
- BDIGIT_DBL_SIGNED num;
- BDIGIT q;
-
- j = bds->j;
- do {
- if (bds->stop) {
- bds->j = j;
- return 0;
- }
- if (zds[j] == yds[ny-1]) q = (BDIGIT)BIGRAD-1;
- else q = (BDIGIT)((BIGUP(zds[j]) + zds[j-1])/yds[ny-1]);
- if (q) {
- i = bds->nyzero; num = 0; t2 = 0;
- do { /* multiply and subtract */
- BDIGIT_DBL ee;
- t2 += (BDIGIT_DBL)yds[i] * q;
- ee = num - BIGLO(t2);
- num = (BDIGIT_DBL)zds[j - ny + i] + ee;
- if (ee) zds[j - ny + i] = BIGLO(num);
- num = BIGDN(num);
- t2 = BIGDN(t2);
- } while (++i < ny);
- num += zds[j - ny + i] - t2;/* borrow from high digit; don't update */
- while (num) { /* "add back" required */
- i = 0; num = 0; q--;
- do {
- BDIGIT_DBL ee = num + yds[i];
- num = (BDIGIT_DBL)zds[j - ny + i] + ee;
- if (ee) zds[j - ny + i] = BIGLO(num);
- num = BIGDN(num);
- } while (++i < ny);
- num--;
- }
- }
- zds[j] = q;
- } while (--j >= ny);
- return 0;
-}
-
-static void
-rb_big_stop(void *ptr)
-{
- struct big_div_struct *bds = ptr;
- bds->stop = Qtrue;
-}
-
static VALUE
bigdivrem(VALUE x, VALUE y, volatile VALUE *divp, volatile VALUE *modp)
{
- struct big_div_struct bds;
- long nx = RBIGNUM_LEN(x), ny = RBIGNUM_LEN(y);
- long i, j;
- VALUE z, yy, zz;
- BDIGIT *xds, *yds, *zds, *tds;
- BDIGIT_DBL t2;
- BDIGIT dd, q;
+ long xn = BIGNUM_LEN(x), yn = BIGNUM_LEN(y);
+ VALUE z;
+ BDIGIT *xds, *yds, *zds;
+ BDIGIT dd;
+
+ VALUE q = Qnil, r = Qnil;
+ BDIGIT *qds, *rds;
+ long qn, rn;
- if (BIGZEROP(y)) rb_num_zerodiv();
- xds = BDIGITS(x);
yds = BDIGITS(y);
- if (nx < ny || (nx == ny && xds[nx - 1] < yds[ny - 1])) {
+ BARY_TRUNC(yds, yn);
+ if (yn == 0)
+ rb_num_zerodiv();
+
+ xds = BDIGITS(x);
+ BARY_TRUNC(xds, xn);
+
+ if (xn < yn || (xn == yn && xds[xn - 1] < yds[yn - 1])) {
if (divp) *divp = rb_int2big(0);
if (modp) *modp = x;
return Qnil;
}
- if (ny == 1) {
+ if (yn == 1) {
dd = yds[0];
- z = rb_big_clone(x);
+ z = bignew(xn, BIGNUM_SIGN(x)==BIGNUM_SIGN(y));
zds = BDIGITS(z);
- t2 = 0; i = nx;
- while (i--) {
- t2 = BIGUP(t2) + zds[i];
- zds[i] = (BDIGIT)(t2 / dd);
- t2 %= dd;
- }
- RBIGNUM_SET_SIGN(z, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
+ dd = bigdivrem_single(zds, xds, xn, dd);
if (modp) {
- *modp = rb_uint2big((VALUE)t2);
- RBIGNUM_SET_SIGN(*modp, RBIGNUM_SIGN(x));
+ *modp = rb_uint2big((VALUE)dd);
+ BIGNUM_SET_SIGN(*modp, BIGNUM_SIGN(x));
}
if (divp) *divp = z;
return Qnil;
}
+ if (xn == 2 && yn == 2) {
+ BDIGIT_DBL x0 = bary2bdigitdbl(xds, 2);
+ BDIGIT_DBL y0 = bary2bdigitdbl(yds, 2);
+ 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));
+ 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));
+ zds = BDIGITS(z);
+ zds[0] = BIGLO(r0);
+ zds[1] = BIGLO(BIGDN(r0));
+ *modp = z;
+ }
+ return Qnil;
+ }
- z = bignew(nx==ny?nx+2:nx+1, RBIGNUM_SIGN(x)==RBIGNUM_SIGN(y));
- zds = BDIGITS(z);
- if (nx==ny) zds[nx+1] = 0;
- while (!yds[ny-1]) ny--;
-
- dd = 0;
- q = yds[ny-1];
- while ((q & (BDIGIT)(1UL<<(BITSPERDIG-1))) == 0) {
- q <<= 1UL;
- dd++;
- }
- if (dd) {
- yy = rb_big_clone(y);
- tds = BDIGITS(yy);
- j = 0;
- t2 = 0;
- while (j<ny) {
- t2 += (BDIGIT_DBL)yds[j]<<dd;
- tds[j++] = BIGLO(t2);
- t2 = BIGDN(t2);
- }
- yds = tds;
- RB_GC_GUARD(y) = yy;
- j = 0;
- t2 = 0;
- while (j<nx) {
- t2 += (BDIGIT_DBL)xds[j]<<dd;
- zds[j++] = BIGLO(t2);
- t2 = BIGDN(t2);
- }
- zds[j] = (BDIGIT)t2;
+ if (divp) {
+ qn = xn + BIGDIVREM_EXTRA_WORDS;
+ q = bignew(qn, BIGNUM_SIGN(x)==BIGNUM_SIGN(y));
+ qds = BDIGITS(q);
}
else {
- zds[nx] = 0;
- j = nx;
- while (j--) zds[j] = xds[j];
+ qn = 0;
+ qds = NULL;
}
- bds.nx = nx;
- bds.ny = ny;
- bds.zds = zds;
- bds.yds = yds;
- bds.stop = Qfalse;
- bds.j = nx==ny?nx+1:nx;
- for (bds.nyzero = 0; !yds[bds.nyzero]; bds.nyzero++);
- if (nx > 10000 || ny > 10000) {
- retry:
- bds.stop = Qfalse;
- rb_thread_call_without_gvl(bigdivrem1, &bds, rb_big_stop, &bds);
-
- if (bds.stop == Qtrue) {
- /* execute trap handler, but exception was not raised. */
- goto retry;
- }
+ if (modp) {
+ rn = yn;
+ r = bignew(rn, BIGNUM_SIGN(x));
+ rds = BDIGITS(r);
}
else {
- bigdivrem1(&bds);
+ rn = 0;
+ rds = NULL;
}
- if (divp) { /* move quotient down in z */
- *divp = zz = rb_big_clone(z);
- zds = BDIGITS(zz);
- j = (nx==ny ? nx+2 : nx+1) - ny;
- for (i = 0;i < j;i++) zds[i] = zds[i+ny];
- if (!zds[i-1]) i--;
- RBIGNUM_SET_LEN(zz, i);
- }
- if (modp) { /* normalize remainder */
- *modp = zz = rb_big_clone(z);
- zds = BDIGITS(zz);
- while (ny > 1 && !zds[ny-1]) --ny;
- if (dd) {
- t2 = 0; i = ny;
- while (i--) {
- t2 = (t2 | zds[i]) >> dd;
- q = zds[i];
- zds[i] = BIGLO(t2);
- t2 = BIGUP(q);
- }
- }
- if (!zds[ny-1]) ny--;
- RBIGNUM_SET_LEN(zz, ny);
- RBIGNUM_SET_SIGN(zz, RBIGNUM_SIGN(x));
+ bary_divmod_branch(qds, qn, rds, rn, xds, xn, yds, yn);
+
+ if (divp) {
+ bigtrunc(q);
+ *divp = q;
}
- return z;
+ if (modp) {
+ bigtrunc(r);
+ *modp = r;
+ }
+
+ return Qnil;
}
static void
@@ -2868,7 +6001,7 @@ bigdivmod(VALUE x, VALUE y, volatile VALUE *divp, volatile VALUE *modp)
VALUE mod;
bigdivrem(x, y, divp, &mod);
- if (RBIGNUM_SIGN(x) != RBIGNUM_SIGN(y) && !BIGZEROP(mod)) {
+ if (BIGNUM_SIGN(x) != BIGNUM_SIGN(y) && !BIGZEROP(mod)) {
if (divp) *divp = bigadd(*divp, rb_int2big(1), 0);
if (modp) *modp = bigadd(mod, y, 1);
}
@@ -2883,27 +6016,22 @@ rb_big_divide(VALUE x, VALUE y, ID op)
{
VALUE z;
- switch (TYPE(y)) {
- case T_FIXNUM:
+ if (FIXNUM_P(y)) {
y = rb_int2big(FIX2LONG(y));
- break;
-
- case T_BIGNUM:
- break;
-
- case T_FLOAT:
- {
- if (op == '/') {
- return DBL2NUM(rb_big2dbl(x) / RFLOAT_VALUE(y));
- }
- else {
- double dy = RFLOAT_VALUE(y);
- if (dy == 0.0) rb_num_zerodiv();
- return rb_dbl2big(rb_big2dbl(x) / dy);
- }
+ }
+ else if (RB_BIGNUM_TYPE_P(y)) {
+ }
+ else if (RB_FLOAT_TYPE_P(y)) {
+ if (op == '/') {
+ return DBL2NUM(rb_big2dbl(x) / RFLOAT_VALUE(y));
}
-
- default:
+ else {
+ double dy = RFLOAT_VALUE(y);
+ if (dy == 0.0) rb_num_zerodiv();
+ return rb_dbl2big(rb_big2dbl(x) / dy);
+ }
+ }
+ else {
return rb_num_coerce_bin(x, y, op);
}
bigdivmod(x, y, &z, 0);
@@ -2953,15 +6081,10 @@ rb_big_modulo(VALUE x, VALUE y)
{
VALUE z;
- switch (TYPE(y)) {
- case T_FIXNUM:
+ if (FIXNUM_P(y)) {
y = rb_int2big(FIX2LONG(y));
- break;
-
- case T_BIGNUM:
- break;
-
- default:
+ }
+ else if (!RB_BIGNUM_TYPE_P(y)) {
return rb_num_coerce_bin(x, y, '%');
}
bigdivmod(x, y, 0, &z);
@@ -2983,15 +6106,10 @@ rb_big_remainder(VALUE x, VALUE y)
{
VALUE z;
- switch (TYPE(y)) {
- case T_FIXNUM:
+ if (FIXNUM_P(y)) {
y = rb_int2big(FIX2LONG(y));
- break;
-
- case T_BIGNUM:
- break;
-
- default:
+ }
+ else if (!RB_BIGNUM_TYPE_P(y)) {
return rb_num_coerce_bin(x, y, rb_intern("remainder"));
}
bigdivrem(x, y, 0, &z);
@@ -3011,15 +6129,10 @@ rb_big_divmod(VALUE x, VALUE y)
{
VALUE div, mod;
- switch (TYPE(y)) {
- case T_FIXNUM:
+ if (FIXNUM_P(y)) {
y = rb_int2big(FIX2LONG(y));
- break;
-
- case T_BIGNUM:
- break;
-
- default:
+ }
+ else if (!RB_BIGNUM_TYPE_P(y)) {
return rb_num_coerce_bin(x, y, rb_intern("divmod"));
}
bigdivmod(x, y, &div, &mod);
@@ -3027,73 +6140,29 @@ rb_big_divmod(VALUE x, VALUE y)
return rb_assoc_new(bignorm(div), bignorm(mod));
}
-static int
-bdigbitsize(BDIGIT x)
-{
- int size = 1;
- int nb = BITSPERDIG / 2;
- BDIGIT bits = (~0 << nb);
-
- if (!x) return 0;
- while (x > 1) {
- if (x & bits) {
- size += nb;
- x >>= nb;
- }
- x &= ~bits;
- nb /= 2;
- bits >>= nb;
- }
-
- return size;
-}
-
-static VALUE big_lshift(VALUE, unsigned long);
-static VALUE big_rshift(VALUE, unsigned long);
-
static VALUE
big_shift(VALUE x, long n)
{
if (n < 0)
- return big_lshift(x, (unsigned long)-n);
+ return big_lshift(x, 1+(unsigned long)(-(n+1)));
else if (n > 0)
return big_rshift(x, (unsigned long)n);
return x;
}
static VALUE
-big_fdiv(VALUE x, VALUE y)
+big_fdiv(VALUE x, VALUE y, long ey)
{
#define DBL_BIGDIG ((DBL_MANT_DIG + BITSPERDIG) / BITSPERDIG)
VALUE z;
- long l, ex, ey;
- int i;
+ long l, ex;
bigtrunc(x);
- l = RBIGNUM_LEN(x) - 1;
- ex = l * BITSPERDIG;
- ex += bdigbitsize(BDIGITS(x)[l]);
+ l = BIGNUM_LEN(x);
+ ex = l * BITSPERDIG - nlz(BDIGITS(x)[l-1]);
ex -= 2 * DBL_BIGDIG * BITSPERDIG;
if (ex) x = big_shift(x, ex);
- switch (TYPE(y)) {
- case T_FIXNUM:
- y = rb_int2big(FIX2LONG(y));
- case T_BIGNUM:
- bigtrunc(y);
- l = RBIGNUM_LEN(y) - 1;
- ey = l * BITSPERDIG;
- ey += bdigbitsize(BDIGITS(y)[l]);
- ey -= DBL_BIGDIG * BITSPERDIG;
- if (ey) y = big_shift(y, ey);
- break;
- case T_FLOAT:
- y = dbl2big(ldexp(frexp(RFLOAT_VALUE(y), &i), DBL_MANT_DIG));
- ey = i - DBL_MANT_DIG;
- break;
- default:
- rb_bug("big_fdiv");
- }
bigdivrem(x, y, &z, 0);
l = ex - ey;
#if SIZEOF_LONG > SIZEOF_INT
@@ -3106,6 +6175,26 @@ big_fdiv(VALUE x, VALUE y)
return DBL2NUM(ldexp(big2dbl(z), (int)l));
}
+static VALUE
+big_fdiv_int(VALUE x, VALUE y)
+{
+ long l, ey;
+ bigtrunc(y);
+ l = BIGNUM_LEN(y);
+ ey = l * BITSPERDIG - nlz(BDIGITS(y)[l-1]);
+ ey -= DBL_BIGDIG * BITSPERDIG;
+ if (ey) y = big_shift(y, ey);
+ return big_fdiv(x, y, ey);
+}
+
+static VALUE
+big_fdiv_float(VALUE x, VALUE y)
+{
+ int i;
+ y = dbl2big(ldexp(frexp(RFLOAT_VALUE(y), &i), DBL_MANT_DIG));
+ return big_fdiv(x, y, i - DBL_MANT_DIG);
+}
+
/*
* call-seq:
* big.fdiv(numeric) -> float
@@ -3125,39 +6214,29 @@ rb_big_fdiv(VALUE x, VALUE y)
double dx, dy;
dx = big2dbl(x);
- switch (TYPE(y)) {
- case T_FIXNUM:
+ if (FIXNUM_P(y)) {
dy = (double)FIX2LONG(y);
if (isinf(dx))
- return big_fdiv(x, y);
- break;
-
- case T_BIGNUM:
+ return big_fdiv_int(x, rb_int2big(FIX2LONG(y)));
+ }
+ else if (RB_BIGNUM_TYPE_P(y)) {
dy = rb_big2dbl(y);
if (isinf(dx) || isinf(dy))
- return big_fdiv(x, y);
- break;
-
- case T_FLOAT:
+ return big_fdiv_int(x, y);
+ }
+ else if (RB_FLOAT_TYPE_P(y)) {
dy = RFLOAT_VALUE(y);
if (isnan(dy))
return y;
if (isinf(dx))
- return big_fdiv(x, y);
- break;
-
- default:
+ return big_fdiv_float(x, y);
+ }
+ else {
return rb_num_coerce_bin(x, y, rb_intern("fdiv"));
}
return DBL2NUM(dx / dy);
}
-static VALUE
-bigsqr(VALUE x)
-{
- return bigtrunc(bigmul0(x, x));
-}
-
/*
* call-seq:
* big ** exponent -> numeric
@@ -3177,20 +6256,21 @@ rb_big_pow(VALUE x, VALUE y)
double d;
SIGNED_VALUE yy;
+ again:
if (y == INT2FIX(0)) return INT2FIX(1);
- switch (TYPE(y)) {
- case T_FLOAT:
+ if (RB_FLOAT_TYPE_P(y)) {
d = RFLOAT_VALUE(y);
- if ((!RBIGNUM_SIGN(x) && !BIGZEROP(x)) && d != round(d))
+ if ((!BIGNUM_SIGN(x) && !BIGZEROP(x)) && d != round(d))
return rb_funcall(rb_complex_raw1(x), rb_intern("**"), 1, y);
- break;
-
- case T_BIGNUM:
+ }
+ else if (RB_BIGNUM_TYPE_P(y)) {
+ y = bignorm(y);
+ if (FIXNUM_P(y))
+ goto again;
rb_warn("in a**b, b may be too big");
d = rb_big2dbl(y);
- break;
-
- case T_FIXNUM:
+ }
+ else if (FIXNUM_P(y)) {
yy = FIX2LONG(y);
if (yy < 0)
@@ -3198,73 +6278,84 @@ rb_big_pow(VALUE x, VALUE y)
else {
VALUE z = 0;
SIGNED_VALUE mask;
- const long xlen = RBIGNUM_LEN(x) - 1;
- const long xbits = ffs(RBIGNUM_DIGITS(x)[xlen]) + SIZEOF_BDIGITS*BITSPERDIG*xlen;
- const long BIGLEN_LIMIT = BITSPERDIG*1024*1024;
+ const size_t xbits = rb_absint_numwords(x, 1, NULL);
+ const size_t BIGLEN_LIMIT = 32*1024*1024;
- if ((xbits > BIGLEN_LIMIT) || (xbits * yy > BIGLEN_LIMIT)) {
+ if (xbits == (size_t)-1 ||
+ (xbits > BIGLEN_LIMIT) ||
+ (xbits * yy > BIGLEN_LIMIT)) {
rb_warn("in a**b, b may be too big");
d = (double)yy;
- break;
}
- for (mask = FIXNUM_MAX + 1; mask; mask >>= 1) {
- if (z) z = bigsqr(z);
- if (yy & mask) {
- z = z ? bigtrunc(bigmul0(z, x)) : x;
+ else {
+ for (mask = FIXNUM_MAX + 1; mask; mask >>= 1) {
+ if (z) z = bigsq(z);
+ if (yy & mask) {
+ z = z ? bigtrunc(bigmul0(z, x)) : x;
+ }
}
+ return bignorm(z);
}
- return bignorm(z);
}
- /* NOTREACHED */
- break;
-
- default:
+ }
+ else {
return rb_num_coerce_bin(x, y, rb_intern("**"));
}
return DBL2NUM(pow(rb_big2dbl(x), d));
}
static VALUE
-bigand_int(VALUE x, long y)
+bigand_int(VALUE x, long xn, BDIGIT hibitsx, long y)
{
VALUE z;
BDIGIT *xds, *zds;
- long xn, zn;
+ long zn;
long i;
- char sign;
+ BDIGIT hibitsy;
if (y == 0) return INT2FIX(0);
- sign = (y > 0);
+ if (xn == 0) return hibitsx ? LONG2NUM(y) : 0;
+ hibitsy = 0 <= y ? 0 : BDIGMAX;
xds = BDIGITS(x);
- zn = xn = RBIGNUM_LEN(x);
-#if SIZEOF_BDIGITS == SIZEOF_LONG
- if (sign) {
+#if SIZEOF_BDIGIT >= SIZEOF_LONG
+ if (!hibitsy) {
y &= xds[0];
return LONG2NUM(y);
}
#endif
- z = bignew(zn, RBIGNUM_SIGN(x) || sign);
+ zn = xn;
+#if SIZEOF_BDIGIT < SIZEOF_LONG
+ if (hibitsx && zn < bdigit_roomof(SIZEOF_LONG))
+ zn = bdigit_roomof(SIZEOF_LONG);
+#endif
+
+ z = bignew(zn, 0);
zds = BDIGITS(z);
-#if SIZEOF_BDIGITS == SIZEOF_LONG
+#if SIZEOF_BDIGIT >= SIZEOF_LONG
i = 1;
- zds[0] = xds[0] & y;
+ zds[0] = xds[0] & BIGLO(y);
#else
- {
- BDIGIT_DBL num = y;
-
- for (i=0; i<(int)(sizeof(y)/sizeof(BDIGIT)); i++) {
- zds[i] = xds[i] & BIGLO(num);
- num = BIGDN(num);
- }
+ for (i=0; i < xn; i++) {
+ if (y == 0 || y == -1) break;
+ zds[i] = xds[i] & BIGLO(y);
+ y = BIGDN(y);
+ }
+ for (; i < zn; i++) {
+ if (y == 0 || y == -1) break;
+ zds[i] = hibitsx & BIGLO(y);
+ y = BIGDN(y);
}
#endif
- while (i < xn) {
- zds[i] = sign?0:xds[i];
- i++;
+ for (;i < xn; i++) {
+ zds[i] = xds[i] & hibitsy;
+ }
+ for (;i < zn; i++) {
+ zds[i] = hibitsx & hibitsy;
}
- if (!RBIGNUM_SIGN(z)) get2comp(z);
+ twocomp2abs_bang(z, hibitsx && hibitsy);
+ RB_GC_GUARD(x);
return bignorm(z);
}
@@ -3276,91 +6367,121 @@ bigand_int(VALUE x, long y)
*/
VALUE
-rb_big_and(VALUE xx, VALUE yy)
+rb_big_and(VALUE x, VALUE y)
{
- volatile VALUE x, y, z;
+ VALUE z;
BDIGIT *ds1, *ds2, *zds;
- long i, l1, l2;
- char sign;
+ long i, xn, yn, n1, n2;
+ BDIGIT hibitsx, hibitsy;
+ BDIGIT hibits1, hibits2;
+ VALUE tmpv;
+ BDIGIT tmph;
+ long tmpn;
- if (!FIXNUM_P(yy) && !RB_TYPE_P(yy, T_BIGNUM)) {
- return rb_num_coerce_bit(xx, yy, '&');
+ if (!FIXNUM_P(y) && !RB_BIGNUM_TYPE_P(y)) {
+ return rb_num_coerce_bit(x, y, '&');
}
- x = xx;
- y = yy;
-
- if (!RBIGNUM_SIGN(x)) {
- x = rb_big_clone(x);
- get2comp(x);
- }
+ hibitsx = abs2twocomp(&x, &xn);
if (FIXNUM_P(y)) {
- return bigand_int(x, FIX2LONG(y));
+ return bigand_int(x, xn, hibitsx, FIX2LONG(y));
}
- if (!RBIGNUM_SIGN(y)) {
- y = rb_big_clone(y);
- get2comp(y);
- }
- if (RBIGNUM_LEN(x) > RBIGNUM_LEN(y)) {
- l1 = RBIGNUM_LEN(y);
- l2 = RBIGNUM_LEN(x);
- ds1 = BDIGITS(y);
- ds2 = BDIGITS(x);
- sign = RBIGNUM_SIGN(y);
- }
- else {
- l1 = RBIGNUM_LEN(x);
- l2 = RBIGNUM_LEN(y);
- ds1 = BDIGITS(x);
- ds2 = BDIGITS(y);
- sign = RBIGNUM_SIGN(x);
+ hibitsy = abs2twocomp(&y, &yn);
+ if (xn > yn) {
+ tmpv = x; x = y; y = tmpv;
+ tmpn = xn; xn = yn; yn = tmpn;
+ tmph = hibitsx; hibitsx = hibitsy; hibitsy = tmph;
}
- z = bignew(l2, RBIGNUM_SIGN(x) || RBIGNUM_SIGN(y));
+ n1 = xn;
+ n2 = yn;
+ ds1 = BDIGITS(x);
+ ds2 = BDIGITS(y);
+ hibits1 = hibitsx;
+ hibits2 = hibitsy;
+
+ if (!hibits1)
+ n2 = n1;
+
+ z = bignew(n2, 0);
zds = BDIGITS(z);
- for (i=0; i<l1; i++) {
+ for (i=0; i<n1; i++) {
zds[i] = ds1[i] & ds2[i];
}
- for (; i<l2; i++) {
- zds[i] = sign?0:ds2[i];
+ for (; i<n2; i++) {
+ zds[i] = hibits1 & ds2[i];
}
- if (!RBIGNUM_SIGN(z)) get2comp(z);
+ twocomp2abs_bang(z, hibits1 && hibits2);
+ RB_GC_GUARD(x);
+ RB_GC_GUARD(y);
return bignorm(z);
}
static VALUE
-bigor_int(VALUE x, long y)
+bigor_int(VALUE x, long xn, BDIGIT hibitsx, long y)
{
VALUE z;
BDIGIT *xds, *zds;
- long xn, zn;
+ long zn;
long i;
- char sign;
+ BDIGIT hibitsy;
- sign = (y >= 0);
+ if (y == -1) return INT2FIX(-1);
+ if (xn == 0) return hibitsx ? INT2FIX(-1) : LONG2FIX(y);
+ hibitsy = 0 <= y ? 0 : BDIGMAX;
xds = BDIGITS(x);
- zn = xn = RBIGNUM_LEN(x);
- z = bignew(zn, RBIGNUM_SIGN(x) && sign);
+
+ zn = BIGNUM_LEN(x);
+#if SIZEOF_BDIGIT < SIZEOF_LONG
+ if (zn < bdigit_roomof(SIZEOF_LONG))
+ zn = bdigit_roomof(SIZEOF_LONG);
+#endif
+ z = bignew(zn, 0);
zds = BDIGITS(z);
-#if SIZEOF_BDIGITS == SIZEOF_LONG
+#if SIZEOF_BDIGIT >= SIZEOF_LONG
i = 1;
- zds[0] = xds[0] | y;
+ zds[0] = xds[0] | BIGLO(y);
+ if (i < zn)
+ goto y_is_fixed_point;
+ goto finish;
#else
- {
- BDIGIT_DBL num = y;
+ for (i=0; i < xn; i++) {
+ if (y == 0 || y == -1) goto y_is_fixed_point;
+ zds[i] = xds[i] | BIGLO(y);
+ y = BIGDN(y);
+ }
+ if (hibitsx)
+ goto fill_hibits;
+ for (; i < zn; i++) {
+ if (y == 0 || y == -1) goto y_is_fixed_point;
+ zds[i] = BIGLO(y);
+ y = BIGDN(y);
+ }
+ goto finish;
+#endif
- for (i=0; i<(int)(sizeof(y)/sizeof(BDIGIT)); i++) {
- zds[i] = xds[i] | BIGLO(num);
- num = BIGDN(num);
- }
+ y_is_fixed_point:
+ if (hibitsy)
+ goto fill_hibits;
+ for (; i < xn; i++) {
+ zds[i] = xds[i];
}
-#endif
- while (i < xn) {
- zds[i] = sign?xds[i]:(BDIGIT)(BIGRAD-1);
- i++;
+ if (hibitsx)
+ goto fill_hibits;
+ for (; i < zn; i++) {
+ zds[i] = 0;
}
- if (!RBIGNUM_SIGN(z)) get2comp(z);
+ goto finish;
+
+ fill_hibits:
+ for (; i < zn; i++) {
+ zds[i] = BDIGMAX;
+ }
+
+ finish:
+ twocomp2abs_bang(z, hibitsx || hibitsy);
+ RB_GC_GUARD(x);
return bignorm(z);
}
@@ -3372,91 +6493,96 @@ bigor_int(VALUE x, long y)
*/
VALUE
-rb_big_or(VALUE xx, VALUE yy)
+rb_big_or(VALUE x, VALUE y)
{
- volatile VALUE x, y, z;
+ VALUE z;
BDIGIT *ds1, *ds2, *zds;
- long i, l1, l2;
- char sign;
+ long i, xn, yn, n1, n2;
+ BDIGIT hibitsx, hibitsy;
+ BDIGIT hibits1, hibits2;
+ VALUE tmpv;
+ BDIGIT tmph;
+ long tmpn;
- if (!FIXNUM_P(yy) && !RB_TYPE_P(yy, T_BIGNUM)) {
- return rb_num_coerce_bit(xx, yy, '|');
+ if (!FIXNUM_P(y) && !RB_BIGNUM_TYPE_P(y)) {
+ return rb_num_coerce_bit(x, y, '|');
}
- x = xx;
- y = yy;
-
- if (!RBIGNUM_SIGN(x)) {
- x = rb_big_clone(x);
- get2comp(x);
- }
+ hibitsx = abs2twocomp(&x, &xn);
if (FIXNUM_P(y)) {
- return bigor_int(x, FIX2LONG(y));
- }
- if (!RBIGNUM_SIGN(y)) {
- y = rb_big_clone(y);
- get2comp(y);
- }
- if (RBIGNUM_LEN(x) > RBIGNUM_LEN(y)) {
- l1 = RBIGNUM_LEN(y);
- l2 = RBIGNUM_LEN(x);
- ds1 = BDIGITS(y);
- ds2 = BDIGITS(x);
- sign = RBIGNUM_SIGN(y);
+ return bigor_int(x, xn, hibitsx, FIX2LONG(y));
}
- else {
- l1 = RBIGNUM_LEN(x);
- l2 = RBIGNUM_LEN(y);
- ds1 = BDIGITS(x);
- ds2 = BDIGITS(y);
- sign = RBIGNUM_SIGN(x);
+ hibitsy = abs2twocomp(&y, &yn);
+ if (xn > yn) {
+ tmpv = x; x = y; y = tmpv;
+ tmpn = xn; xn = yn; yn = tmpn;
+ tmph = hibitsx; hibitsx = hibitsy; hibitsy = tmph;
}
- z = bignew(l2, RBIGNUM_SIGN(x) && RBIGNUM_SIGN(y));
+ n1 = xn;
+ n2 = yn;
+ ds1 = BDIGITS(x);
+ ds2 = BDIGITS(y);
+ hibits1 = hibitsx;
+ hibits2 = hibitsy;
+
+ if (hibits1)
+ n2 = n1;
+
+ z = bignew(n2, 0);
zds = BDIGITS(z);
- for (i=0; i<l1; i++) {
+ for (i=0; i<n1; i++) {
zds[i] = ds1[i] | ds2[i];
}
- for (; i<l2; i++) {
- zds[i] = sign?ds2[i]:(BDIGIT)(BIGRAD-1);
+ for (; i<n2; i++) {
+ zds[i] = hibits1 | ds2[i];
}
- if (!RBIGNUM_SIGN(z)) get2comp(z);
+ twocomp2abs_bang(z, hibits1 || hibits2);
+ RB_GC_GUARD(x);
+ RB_GC_GUARD(y);
return bignorm(z);
}
static VALUE
-bigxor_int(VALUE x, long y)
+bigxor_int(VALUE x, long xn, BDIGIT hibitsx, long y)
{
VALUE z;
BDIGIT *xds, *zds;
- long xn, zn;
+ long zn;
long i;
- char sign;
+ BDIGIT hibitsy;
- sign = (y >= 0) ? 1 : 0;
+ hibitsy = 0 <= y ? 0 : BDIGMAX;
xds = BDIGITS(x);
- zn = xn = RBIGNUM_LEN(x);
- z = bignew(zn, !(RBIGNUM_SIGN(x) ^ sign));
+ zn = BIGNUM_LEN(x);
+#if SIZEOF_BDIGIT < SIZEOF_LONG
+ if (zn < bdigit_roomof(SIZEOF_LONG))
+ zn = bdigit_roomof(SIZEOF_LONG);
+#endif
+ z = bignew(zn, 0);
zds = BDIGITS(z);
-#if SIZEOF_BDIGITS == SIZEOF_LONG
+#if SIZEOF_BDIGIT >= SIZEOF_LONG
i = 1;
- zds[0] = xds[0] ^ y;
+ zds[0] = xds[0] ^ BIGLO(y);
#else
- {
- BDIGIT_DBL num = y;
-
- for (i=0; i<(int)(sizeof(y)/sizeof(BDIGIT)); i++) {
- zds[i] = xds[i] ^ BIGLO(num);
- num = BIGDN(num);
- }
+ for (i = 0; i < xn; i++) {
+ zds[i] = xds[i] ^ BIGLO(y);
+ y = BIGDN(y);
+ }
+ for (; i < zn; i++) {
+ zds[i] = hibitsx ^ BIGLO(y);
+ y = BIGDN(y);
}
#endif
- while (i < xn) {
- zds[i] = sign?xds[i]:~xds[i];
- i++;
+ for (; i < xn; i++) {
+ zds[i] = xds[i] ^ hibitsy;
+ }
+ for (; i < zn; i++) {
+ zds[i] = hibitsx ^ hibitsy;
}
- if (!RBIGNUM_SIGN(z)) get2comp(z);
+ twocomp2abs_bang(z, (hibitsx ^ hibitsy) != 0);
+ RB_GC_GUARD(x);
return bignorm(z);
}
/*
@@ -3467,72 +6593,53 @@ bigxor_int(VALUE x, long y)
*/
VALUE
-rb_big_xor(VALUE xx, VALUE yy)
+rb_big_xor(VALUE x, VALUE y)
{
- volatile VALUE x, y;
VALUE z;
BDIGIT *ds1, *ds2, *zds;
- long i, l1, l2;
- char sign;
+ long i, xn, yn, n1, n2;
+ BDIGIT hibitsx, hibitsy;
+ BDIGIT hibits1, hibits2;
+ VALUE tmpv;
+ BDIGIT tmph;
+ long tmpn;
- if (!FIXNUM_P(yy) && !RB_TYPE_P(yy, T_BIGNUM)) {
- return rb_num_coerce_bit(xx, yy, '^');
+ if (!FIXNUM_P(y) && !RB_BIGNUM_TYPE_P(y)) {
+ return rb_num_coerce_bit(x, y, '^');
}
- x = xx;
- y = yy;
-
- if (!RBIGNUM_SIGN(x)) {
- x = rb_big_clone(x);
- get2comp(x);
- }
+ hibitsx = abs2twocomp(&x, &xn);
if (FIXNUM_P(y)) {
- return bigxor_int(x, FIX2LONG(y));
- }
- if (!RBIGNUM_SIGN(y)) {
- y = rb_big_clone(y);
- get2comp(y);
+ return bigxor_int(x, xn, hibitsx, FIX2LONG(y));
}
- if (RBIGNUM_LEN(x) > RBIGNUM_LEN(y)) {
- l1 = RBIGNUM_LEN(y);
- l2 = RBIGNUM_LEN(x);
- ds1 = BDIGITS(y);
- ds2 = BDIGITS(x);
- sign = RBIGNUM_SIGN(y);
- }
- else {
- l1 = RBIGNUM_LEN(x);
- l2 = RBIGNUM_LEN(y);
- ds1 = BDIGITS(x);
- ds2 = BDIGITS(y);
- sign = RBIGNUM_SIGN(x);
- }
- RBIGNUM_SET_SIGN(x, RBIGNUM_SIGN(x)?1:0);
- RBIGNUM_SET_SIGN(y, RBIGNUM_SIGN(y)?1:0);
- z = bignew(l2, !(RBIGNUM_SIGN(x) ^ RBIGNUM_SIGN(y)));
+ hibitsy = abs2twocomp(&y, &yn);
+ if (xn > yn) {
+ tmpv = x; x = y; y = tmpv;
+ tmpn = xn; xn = yn; yn = tmpn;
+ tmph = hibitsx; hibitsx = hibitsy; hibitsy = tmph;
+ }
+ n1 = xn;
+ n2 = yn;
+ ds1 = BDIGITS(x);
+ ds2 = BDIGITS(y);
+ hibits1 = hibitsx;
+ hibits2 = hibitsy;
+
+ z = bignew(n2, 0);
zds = BDIGITS(z);
- for (i=0; i<l1; i++) {
+ for (i=0; i<n1; i++) {
zds[i] = ds1[i] ^ ds2[i];
}
- for (; i<l2; i++) {
- zds[i] = sign?ds2[i]:~ds2[i];
+ for (; i<n2; i++) {
+ zds[i] = hibitsx ^ ds2[i];
}
- if (!RBIGNUM_SIGN(z)) get2comp(z);
-
+ twocomp2abs_bang(z, (hibits1 ^ hibits2) != 0);
+ RB_GC_GUARD(x);
+ RB_GC_GUARD(y);
return bignorm(z);
}
-static VALUE
-check_shiftdown(VALUE y, VALUE x)
-{
- if (!RBIGNUM_LEN(x)) return INT2FIX(0);
- if (RBIGNUM_LEN(y) > SIZEOF_LONG / SIZEOF_BDIGITS) {
- return RBIGNUM_SIGN(x) ? INT2FIX(0) : INT2FIX(-1);
- }
- return Qnil;
-}
-
/*
* call-seq:
* big << numeric -> integer
@@ -3543,59 +6650,33 @@ check_shiftdown(VALUE y, VALUE x)
VALUE
rb_big_lshift(VALUE x, VALUE y)
{
- long shift;
- int neg = 0;
+ int lshift_p;
+ size_t shift_numdigits;
+ int shift_numbits;
for (;;) {
if (FIXNUM_P(y)) {
- shift = FIX2LONG(y);
- if (shift < 0) {
- neg = 1;
- shift = -shift;
+ long l = FIX2LONG(y);
+ unsigned long shift;
+ if (0 <= l) {
+ lshift_p = 1;
+ shift = l;
+ }
+ else {
+ lshift_p = 0;
+ shift = 1+(unsigned long)(-(l+1));
}
- break;
+ shift_numbits = (int)(shift & (BITSPERDIG-1));
+ shift_numdigits = shift >> bit_length(BITSPERDIG-1);
+ return bignorm(big_shift3(x, lshift_p, shift_numdigits, shift_numbits));
}
- else if (RB_TYPE_P(y, T_BIGNUM)) {
- if (!RBIGNUM_SIGN(y)) {
- VALUE t = check_shiftdown(y, x);
- if (!NIL_P(t)) return t;
- neg = 1;
- }
- shift = big2ulong(y, "long", TRUE);
- break;
+ else if (RB_BIGNUM_TYPE_P(y)) {
+ return bignorm(big_shift2(x, 1, y));
}
y = rb_to_int(y);
}
-
- x = neg ? big_rshift(x, shift) : big_lshift(x, shift);
- return bignorm(x);
}
-static VALUE
-big_lshift(VALUE x, unsigned long shift)
-{
- BDIGIT *xds, *zds;
- long s1 = shift/BITSPERDIG;
- int s2 = (int)(shift%BITSPERDIG);
- VALUE z;
- BDIGIT_DBL num = 0;
- long len, i;
-
- len = RBIGNUM_LEN(x);
- z = bignew(len+s1+1, RBIGNUM_SIGN(x));
- zds = BDIGITS(z);
- for (i=0; i<s1; i++) {
- *zds++ = 0;
- }
- xds = BDIGITS(x);
- for (i=0; i<len; i++) {
- num = num | (BDIGIT_DBL)*xds++<<s2;
- *zds++ = BIGLO(num);
- num = BIGDN(num);
- }
- *zds = BIGLO(num);
- return z;
-}
/*
* call-seq:
@@ -3607,79 +6688,31 @@ big_lshift(VALUE x, unsigned long shift)
VALUE
rb_big_rshift(VALUE x, VALUE y)
{
- long shift;
- int neg = 0;
+ int lshift_p;
+ size_t shift_numdigits;
+ int shift_numbits;
for (;;) {
if (FIXNUM_P(y)) {
- shift = FIX2LONG(y);
- if (shift < 0) {
- neg = 1;
- shift = -shift;
+ long l = FIX2LONG(y);
+ unsigned long shift;
+ if (0 <= l) {
+ lshift_p = 0;
+ shift = l;
+ }
+ else {
+ lshift_p = 1;
+ shift = 1+(unsigned long)(-(l+1));
}
- break;
+ shift_numbits = (int)(shift & (BITSPERDIG-1));
+ shift_numdigits = shift >> bit_length(BITSPERDIG-1);
+ return bignorm(big_shift3(x, lshift_p, shift_numdigits, shift_numbits));
}
- else if (RB_TYPE_P(y, T_BIGNUM)) {
- if (RBIGNUM_SIGN(y)) {
- VALUE t = check_shiftdown(y, x);
- if (!NIL_P(t)) return t;
- }
- else {
- neg = 1;
- }
- shift = big2ulong(y, "long", TRUE);
- break;
+ else if (RB_BIGNUM_TYPE_P(y)) {
+ return bignorm(big_shift2(x, 0, y));
}
y = rb_to_int(y);
}
-
- x = neg ? big_lshift(x, shift) : big_rshift(x, shift);
- return bignorm(x);
-}
-
-static VALUE
-big_rshift(VALUE x, unsigned long shift)
-{
- BDIGIT *xds, *zds;
- long s1 = shift/BITSPERDIG;
- int s2 = (int)(shift%BITSPERDIG);
- VALUE z;
- BDIGIT_DBL num = 0;
- long i, j;
- volatile VALUE save_x;
-
- if (s1 > RBIGNUM_LEN(x)) {
- if (RBIGNUM_SIGN(x))
- return INT2FIX(0);
- else
- return INT2FIX(-1);
- }
- if (!RBIGNUM_SIGN(x)) {
- x = rb_big_clone(x);
- get2comp(x);
- }
- save_x = x;
- xds = BDIGITS(x);
- i = RBIGNUM_LEN(x); j = i - s1;
- if (j == 0) {
- if (RBIGNUM_SIGN(x)) return INT2FIX(0);
- else return INT2FIX(-1);
- }
- z = bignew(j, RBIGNUM_SIGN(x));
- if (!RBIGNUM_SIGN(x)) {
- num = ((BDIGIT_DBL)~0) << BITSPERDIG;
- }
- zds = BDIGITS(z);
- while (i--, j--) {
- num = (num | xds[i]) >> s2;
- zds[j] = BIGLO(num);
- num = BIGUP(xds[i]);
- }
- if (!RBIGNUM_SIGN(x)) {
- get2comp(z);
- }
- RB_GC_GUARD(save_x);
- return z;
}
/*
@@ -3705,42 +6738,45 @@ static VALUE
rb_big_aref(VALUE x, VALUE y)
{
BDIGIT *xds;
- BDIGIT_DBL num;
- VALUE shift;
- long i, s1, s2;
+ size_t shift;
+ size_t i, s1, s2;
+ long l;
+ BDIGIT bit;
- if (RB_TYPE_P(y, T_BIGNUM)) {
- if (!RBIGNUM_SIGN(y))
+ if (RB_BIGNUM_TYPE_P(y)) {
+ if (!BIGNUM_SIGN(y))
return INT2FIX(0);
bigtrunc(y);
- if (RBIGNUM_LEN(y) > DIGSPERLONG) {
+ if (BIGSIZE(y) > sizeof(size_t)) {
out_of_range:
- return RBIGNUM_SIGN(x) ? INT2FIX(0) : INT2FIX(1);
+ return BIGNUM_SIGN(x) ? INT2FIX(0) : INT2FIX(1);
}
- shift = big2ulong(y, "long", FALSE);
+#if SIZEOF_SIZE_T <= SIZEOF_LONG
+ shift = big2ulong(y, "long");
+#else
+ shift = big2ull(y, "long long");
+#endif
}
else {
- i = NUM2LONG(y);
- if (i < 0) return INT2FIX(0);
- shift = (VALUE)i;
+ l = NUM2LONG(y);
+ if (l < 0) return INT2FIX(0);
+ shift = (size_t)l;
}
s1 = shift/BITSPERDIG;
s2 = shift%BITSPERDIG;
+ bit = (BDIGIT)1 << s2;
- if (s1 >= RBIGNUM_LEN(x)) goto out_of_range;
- if (!RBIGNUM_SIGN(x)) {
- xds = BDIGITS(x);
- i = 0; num = 1;
- while (num += ~xds[i], ++i <= s1) {
- num = BIGDN(num);
- }
- }
- else {
- num = BDIGITS(x)[s1];
- }
- if (num & ((BDIGIT_DBL)1<<s2))
- return INT2FIX(1);
- return INT2FIX(0);
+ if (s1 >= BIGNUM_LEN(x)) goto out_of_range;
+
+ xds = BDIGITS(x);
+ if (BIGNUM_POSITIVE_P(x))
+ return (xds[s1] & bit) ? INT2FIX(1) : INT2FIX(0);
+ if (xds[s1] & (bit-1))
+ return (xds[s1] & bit) ? INT2FIX(0) : INT2FIX(1);
+ for (i = 0; i < s1; i++)
+ if (xds[i])
+ return (xds[s1] & bit) ? INT2FIX(0) : INT2FIX(1);
+ return (xds[s1] & bit) ? INT2FIX(1) : INT2FIX(0);
}
/*
@@ -3748,6 +6784,8 @@ rb_big_aref(VALUE x, VALUE y)
* big.hash -> fixnum
*
* Compute a hash based on the value of _big_.
+ *
+ * See also Object#hash.
*/
static VALUE
@@ -3755,12 +6793,22 @@ rb_big_hash(VALUE x)
{
st_index_t hash;
- hash = rb_memhash(BDIGITS(x), sizeof(BDIGIT)*RBIGNUM_LEN(x)) ^ RBIGNUM_SIGN(x);
+ hash = rb_memhash(BDIGITS(x), sizeof(BDIGIT)*BIGNUM_LEN(x)) ^ BIGNUM_SIGN(x);
return INT2FIX(hash);
}
/*
- * MISSING: documentation
+ * call-seq:
+ * big.coerce(numeric) -> array
+ *
+ * Returns an array with both a +numeric+ and a +big+ represented as Bignum
+ * objects.
+ *
+ * This is achieved by converting +numeric+ to a Bignum.
+ *
+ * A TypeError is raised if the +numeric+ is not a Fixnum or Bignum type.
+ *
+ * (0x3FFFFFFFFFFFFFFF+1).coerce(42) #=> [42, 4611686018427387904]
*/
static VALUE
@@ -3769,7 +6817,7 @@ rb_big_coerce(VALUE x, VALUE y)
if (FIXNUM_P(y)) {
y = rb_int2big(FIX2LONG(y));
}
- else if (!RB_TYPE_P(y, T_BIGNUM)) {
+ else if (!RB_BIGNUM_TYPE_P(y)) {
rb_raise(rb_eTypeError, "can't coerce %s to Bignum",
rb_obj_classname(y));
}
@@ -3779,6 +6827,7 @@ rb_big_coerce(VALUE x, VALUE y)
/*
* call-seq:
* big.abs -> aBignum
+ * big.magnitude -> aBignum
*
* Returns the absolute value of <i>big</i>.
*
@@ -3788,9 +6837,9 @@ rb_big_coerce(VALUE x, VALUE y)
static VALUE
rb_big_abs(VALUE x)
{
- if (!RBIGNUM_SIGN(x)) {
+ if (!BIGNUM_SIGN(x)) {
x = rb_big_clone(x);
- RBIGNUM_SET_SIGN(x, 1);
+ BIGNUM_SET_SIGN(x, 1);
}
return x;
}
@@ -3810,7 +6859,86 @@ rb_big_abs(VALUE x)
static VALUE
rb_big_size(VALUE big)
{
- return LONG2FIX(RBIGNUM_LEN(big)*SIZEOF_BDIGITS);
+ return SIZET2NUM(BIGSIZE(big));
+}
+
+/*
+ * call-seq:
+ * int.bit_length -> integer
+ *
+ * Returns the number of bits of the value of <i>int</i>.
+ *
+ * "the number of bits" means that
+ * the bit position of the highest bit which is different to the sign bit.
+ * (The bit position of the bit 2**n is n+1.)
+ * If there is no such bit (zero or minus one), zero is returned.
+ *
+ * I.e. This method returns ceil(log2(int < 0 ? -int : int+1)).
+ *
+ * (-2**10000-1).bit_length #=> 10001
+ * (-2**10000).bit_length #=> 10000
+ * (-2**10000+1).bit_length #=> 10000
+ *
+ * (-2**1000-1).bit_length #=> 1001
+ * (-2**1000).bit_length #=> 1000
+ * (-2**1000+1).bit_length #=> 1000
+ *
+ * (2**1000-1).bit_length #=> 1000
+ * (2**1000).bit_length #=> 1001
+ * (2**1000+1).bit_length #=> 1001
+ *
+ * (2**10000-1).bit_length #=> 10000
+ * (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
+rb_big_bit_length(VALUE big)
+{
+ int nlz_bits;
+ size_t numbytes;
+
+ static const BDIGIT char_bit[1] = { CHAR_BIT };
+ BDIGIT numbytes_bary[bdigit_roomof(sizeof(size_t))];
+ BDIGIT nlz_bary[1];
+ BDIGIT result_bary[bdigit_roomof(sizeof(size_t)+1)];
+
+ numbytes = rb_absint_size(big, &nlz_bits);
+
+ if (numbytes == 0)
+ return LONG2FIX(0);
+
+ if (BIGNUM_NEGATIVE_P(big) && rb_absint_singlebit_p(big)) {
+ if (nlz_bits != CHAR_BIT-1) {
+ nlz_bits++;
+ }
+ else {
+ nlz_bits = 0;
+ numbytes--;
+ }
+ }
+
+ if (numbytes <= SIZE_MAX / CHAR_BIT) {
+ return SIZET2NUM(numbytes * CHAR_BIT - nlz_bits);
+ }
+
+ nlz_bary[0] = nlz_bits;
+
+ bary_unpack(BARY_ARGS(numbytes_bary), &numbytes, 1, sizeof(numbytes), 0,
+ INTEGER_PACK_NATIVE_BYTE_ORDER);
+ BARY_SHORT_MUL(result_bary, numbytes_bary, char_bit);
+ BARY_SUB(result_bary, result_bary, nlz_bary);
+
+ return rb_integer_unpack(result_bary, numberof(result_bary), sizeof(BDIGIT), 0,
+ INTEGER_PACK_LSWORD_FIRST|INTEGER_PACK_NATIVE_BYTE_ORDER);
}
/*
@@ -3823,7 +6951,7 @@ rb_big_size(VALUE big)
static VALUE
rb_big_odd_p(VALUE num)
{
- if (BDIGITS(num)[0] & 1) {
+ if (BIGNUM_LEN(num) != 0 && BDIGITS(num)[0] & 1) {
return Qtrue;
}
return Qfalse;
@@ -3839,7 +6967,7 @@ rb_big_odd_p(VALUE num)
static VALUE
rb_big_even_p(VALUE num)
{
- if (BDIGITS(num)[0] & 1) {
+ if (BIGNUM_LEN(num) != 0 && BDIGITS(num)[0] & 1) {
return Qfalse;
}
return Qtrue;
@@ -3904,11 +7032,14 @@ Init_Bignum(void)
rb_define_method(rb_cBignum, "abs", rb_big_abs, 0);
rb_define_method(rb_cBignum, "magnitude", rb_big_abs, 0);
rb_define_method(rb_cBignum, "size", rb_big_size, 0);
+ rb_define_method(rb_cBignum, "bit_length", rb_big_bit_length, 0);
rb_define_method(rb_cBignum, "odd?", rb_big_odd_p, 0);
rb_define_method(rb_cBignum, "even?", rb_big_even_p, 0);
- power_cache_init();
+#ifdef USE_GMP
+ /* The version of loaded GMP. */
+ rb_define_const(rb_cBignum, "GMP_VERSION", rb_sprintf("GMP %s", gmp_version));
+#endif
- big_three = rb_uint2big(3);
- rb_gc_register_mark_object(big_three);
+ power_cache_init();
}
diff --git a/bin/erb b/bin/erb
index 6b92ac2284..6a7ea7d593 100755
--- a/bin/erb
+++ b/bin/erb
@@ -72,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 =~ /^[0-4]$/
+ raise "invalid safe_level #{arg.dump}" unless arg =~ /^[0-3]$/
safe_level = arg.to_i
when '-T' # trim mode
arg = ARGV.req_arg
@@ -105,7 +105,7 @@ class ERB
-v enable verbose mode
-d set $DEBUG to true
-r library load a library
- -S safe_level set $SAFE (0..4)
+ -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, -)
diff --git a/bin/irb b/bin/irb
index 6c8465c802..c64ee85fbd 100755
--- a/bin/irb
+++ b/bin/irb
@@ -8,13 +8,4 @@
require "irb"
-if __FILE__ == $0
- IRB.start(__FILE__)
-else
- # check -e option
- if /^-e$/ =~ $0
- IRB.start(__FILE__)
- else
- IRB.setup(__FILE__)
- end
-end
+IRB.start(__FILE__)
diff --git a/bin/rake b/bin/rake
index 6aad2f0df3..4e0bbb7b7a 100755
--- a/bin/rake
+++ b/bin/rake
@@ -28,10 +28,6 @@ begin
rescue LoadError
end
-module Rake
- REDUCE_COMPAT = true if ARGV.include?("--reduce-compat")
-end
-
require 'rake'
Rake.application.run
diff --git a/bin/testrb b/bin/testrb
deleted file mode 100755
index 23a00b439f..0000000000
--- a/bin/testrb
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-require 'test/unit'
-exit Test::Unit::AutoRunner.run(true)
diff --git a/bootstraptest/runner.rb b/bootstraptest/runner.rb
index 75e255428a..d58b824386 100755
--- a/bootstraptest/runner.rb
+++ b/bootstraptest/runner.rb
@@ -140,9 +140,8 @@ End
@passed = "\e[#{colors["pass"] || "32"}m"
@failed = "\e[#{colors["fail"] || "31"}m"
@reset = "\e[m"
- @erase = "\r\e[2K\r"
else
- @passed = @failed = @reset = @erase = ""
+ @passed = @failed = @reset = ""
end
unless quiet
puts Time.now
@@ -163,28 +162,44 @@ 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.print @basename, " "
+ $stderr.printf("%s%-*s ", erase(@quiet), @width, @basename)
+ $stderr.flush
+ @columns = @width + 1
$stderr.puts if @verbose
count = @count
error = @error
load File.expand_path(path)
if @tty
if @error == error
- $stderr.print "#{@progress_bs}#{@passed}PASS #{@count-count}#{@reset}"
- $stderr.print @erase if @quiet
+ msg = "PASS #{@count-count}"
+ @columns += msg.size - 1
+ $stderr.print "#{@progress_bs}#{@passed}#{msg}#{@reset}"
else
- $stderr.print "#{@progress_bs}#{@failed}FAIL #{@error-error}/#{@count-count}#{@reset}"
+ msg = "FAIL #{@error-error}/#{@count-count}"
+ $stderr.print "#{@progress_bs}#{@failed}#{msg}#{@reset}"
+ @columns = 0
end
end
- $stderr.puts unless @quiet and @tty
+ $stderr.puts unless @quiet and @tty and @error == error
end
+ $stderr.print(erase) if @quiet
if @error == 0
if @count == 0
$stderr.puts "No tests, no problem"
@@ -207,23 +222,28 @@ 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#{@reset}"
+ $stderr.print "#{@failed}F"
+ $stderr.printf(" %.3f", t) if @verbose
+ $stderr.print "#{@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.print @basename, " ", @progress[@count % @progress.size]
+ $stderr.printf("%-*s%s", @width, @basename, @progress[@count % @progress.size])
end
end
rescue Interrupt
@@ -321,7 +341,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)
@@ -385,7 +405,7 @@ end
INDENT = 27
def adjust_indent(src)
- untabify(src).gsub(/^ {#{INDENT}}/o, '').gsub(/^/, ' ')
+ untabify(src).gsub(/^ {#{INDENT}}/o, '').gsub(/^/, ' ').sub(/\s*\z/, "\n")
end
def untabify(str)
@@ -407,7 +427,7 @@ def get_result_string(src, opt = '')
begin
`#{@ruby} -W0 #{opt} #{filename}`
ensure
- raise Interrupt if $?.signaled? && $?.termsig == Signal.list["INT"]
+ raise Interrupt if $? and $?.signaled? && $?.termsig == Signal.list["INT"]
raise CoreDumpError, "core dumped" if $? and $?.coredump?
end
else
@@ -445,7 +465,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_autoload.rb b/bootstraptest/test_autoload.rb
index e8df6684b6..a9f8e6dacd 100644
--- a/bootstraptest/test_autoload.rb
+++ b/bootstraptest/test_autoload.rb
@@ -43,46 +43,6 @@ assert_equal 'ok', %q{
ZZZ.ok
}
-assert_equal 'ok', %q{
- open("zzz.rb", "w") {|f| f.puts "class ZZZ; def self.ok;:ok;end;end"}
- autoload :ZZZ, "./zzz.rb"
- proc{$SAFE=4; ZZZ.ok}.call
-}
-
-assert_equal 'ok', %q{
- open("zzz.rb", "w") {|f| f.puts "class ZZZ; def self.ok;:ok;end;end"}
- autoload :ZZZ, "./zzz.rb"
- require "./zzz.rb"
- proc{$SAFE=4; ZZZ.ok}.call
-}
-
-assert_equal 'ok', %q{
- open("zzz.rb", "w") {|f| f.puts "class ZZZ; def hoge;:ok;end;end"}
- autoload :ZZZ, File.join(Dir.pwd, 'zzz.rb')
- module M; end
- Thread.new{M.instance_eval('$SAFE=4; ZZZ.new.hoge')}.value
-}
-
-assert_equal 'ok', %q{
- open("zzz.rb", "w") {|f| f.puts "class ZZZ; def hoge;:ok;end;end"}
- autoload :ZZZ, File.join(Dir.pwd, 'zzz.rb')
- module M; end
- Thread.new{$SAFE=4; M.instance_eval('ZZZ.new.hoge')}.value
-}
-
-assert_equal 'ok', %q{
- open("zzz.rb", "w") {|f| f.puts "class ZZZ; def hoge;:ok;end;end"}
- autoload :ZZZ, File.join(Dir.pwd, 'zzz.rb')
- Thread.new{$SAFE=4; eval('ZZZ.new.hoge')}.value
-}
-
-assert_equal 'ok', %q{
- open("zzz.rb", "w") {|f| f.puts "class ZZZ; def hoge;:ok;end;end"}
- autoload :ZZZ, File.join(Dir.pwd, 'zzz.rb')
- module M; end
- Thread.new{eval('$SAFE=4; ZZZ.new.hoge')}.value
-}
-
assert_equal 'okok', %q{
open("zzz.rb", "w") {|f| f.puts "class ZZZ; def self.ok;:ok;end;end"}
autoload :ZZZ, "./zzz.rb"
diff --git a/bootstraptest/test_class.rb b/bootstraptest/test_class.rb
index 664dd2f166..b7fe0a1acd 100644
--- a/bootstraptest/test_class.rb
+++ b/bootstraptest/test_class.rb
@@ -11,6 +11,16 @@ assert_equal 'C', %q( class C; end
C.new.class.name )
assert_equal 'Class', %q( class C; end
C.new.class.class )
+assert_equal 'true', %q( Object.__send__(:remove_const, :TrueClass)
+ GC.start
+ true.inspect)
+assert_equal 'false', %q( Object.__send__(:remove_const, :FalseClass)
+ GC.start
+ false.inspect)
+assert_equal 'nil', %q( Object.__send__(:remove_const, :NilClass)
+ GC.start
+ nil.inspect)
+
# inherited class
assert_equal 'true', %q( class A; end
diff --git a/bootstraptest/test_fork.rb b/bootstraptest/test_fork.rb
index 384294727f..5de6ee1b12 100644
--- a/bootstraptest/test_fork.rb
+++ b/bootstraptest/test_fork.rb
@@ -22,26 +22,32 @@ assert_finish 10, %q{
}, '[ruby-core:22158]'
assert_normal_exit(<<'End', '[ruby-dev:37934]')
- Thread.new { sleep 1; Thread.kill Thread.main }
+ main = Thread.current
+ Thread.new { sleep 0.01 until main.stop?; Thread.kill main }
Process.setrlimit(:NPROC, 1)
fork {}
End
assert_equal 'ok', %q{
begin
+ r, w = IO.pipe
if pid1 = fork
- sleep 1
+ w.close
+ r.read(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 }
+ trap("USR1") { Time.now.to_s; Process.kill("USR2", pid2) }
+ w.close
Process.wait2(pid2)
else
- sleep 2
+ w.close
+ sleep 0.2
end
- exit 0
+ exit true
end
rescue NotImplementedError
:ok
@@ -50,17 +56,17 @@ assert_equal 'ok', %q{
assert_equal '[1, 2]', %q{
a = []
- trap(:INT) { a.push(1) }
- trap(:TERM) { a.push(2) }
+ main = Thread.current
+ trap(:INT) { a.push(1).size == 2 and main.wakeup }
+ trap(:TERM) { a.push(2).size == 2 and main.wakeup }
pid = $$
begin
- fork do
- sleep 0.5
+ pid = fork do
Process.kill(:INT, pid)
Process.kill(:TERM, pid)
end
-
- sleep 1
+ Process.wait(pid)
+ 100.times {break if a.size > 1; sleep 0.001}
a.sort
rescue NotImplementedError
[1, 2]
diff --git a/bootstraptest/test_io.rb b/bootstraptest/test_io.rb
index f7360f34b3..cee8cb399e 100644
--- a/bootstraptest/test_io.rb
+++ b/bootstraptest/test_io.rb
@@ -2,9 +2,8 @@ assert_finish 5, %q{
r, w = IO.pipe
t1 = Thread.new { r.sysread(1) }
t2 = Thread.new { r.sysread(1) }
- sleep 0.1
+ sleep 0.01 until t1.stop? and t2.stop?
w.write "a"
- sleep 0.1
w.write "a"
}, '[ruby-dev:31866]'
@@ -34,9 +33,9 @@ assert_finish 10, %q{
assert_finish 1, %q{
r, w = IO.pipe
Thread.new {
- w << "ab"
- sleep 0.1
- w << "ab"
+ w << "ab"
+ sleep 0.01
+ w << "ab"
}
r.gets("abab")
}
@@ -91,7 +90,8 @@ assert_normal_exit %q{
megacontent = "abc" * 12345678
#File.open("megasrc", "w") {|f| f << megacontent }
- Thread.new { sleep rand*0.2; Process.kill(:INT, $$) }
+ t0 = Thread.main
+ Thread.new { sleep 0.001 until t0.stop?; Process.kill(:INT, $$) }
r1, w1 = IO.pipe
r2, w2 = IO.pipe
diff --git a/bootstraptest/test_literal.rb b/bootstraptest/test_literal.rb
index b95a2f2d0a..aa65bddae1 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'
-# dynacmi regexp
+# dynamic regexp
assert_equal 'regexp', %q(/re#{'ge'}xp/.source)
assert_equal 'Regexp', %q(/re#{'ge'}xp/.class)
diff --git a/bootstraptest/test_literal_suffix.rb b/bootstraptest/test_literal_suffix.rb
new file mode 100644
index 0000000000..4316c9e040
--- /dev/null
+++ b/bootstraptest/test_literal_suffix.rb
@@ -0,0 +1,54 @@
+# numbers with suffix
+assert_equal '0/1', '0r'
+assert_equal 'Rational', '0r.class'
+assert_equal '1/1', '1r'
+assert_equal 'Rational', '1r.class'
+assert_equal '-1/1', '-1r'
+assert_equal 'Rational', '(-1r).class'
+assert_equal '1/1', '0x1r'
+assert_equal 'Rational', '0x1r.class'
+assert_equal '1/1', '0b1r'
+assert_equal 'Rational', '0b1r.class'
+assert_equal '1/1', '0d1r'
+assert_equal 'Rational', '0d1r.class'
+assert_equal '1/1', '0o1r'
+assert_equal 'Rational', '0o1r.class'
+assert_equal '1/1', '01r'
+assert_equal 'Rational', '01r.class'
+assert_equal '6/5', '1.2r'
+assert_equal 'Rational', '1.2r.class'
+assert_equal '-6/5', '-1.2r'
+assert_equal 'Rational', '(-1.2r).class'
+assert_equal '0+0i', '0i'
+assert_equal 'Complex', '0i.class'
+assert_equal '0+1i', '1i'
+assert_equal 'Complex', '1i.class'
+assert_equal '0+1i', '0x1i'
+assert_equal 'Complex', '0x1i.class'
+assert_equal '0+1i', '0b1i'
+assert_equal 'Complex', '0b1i.class'
+assert_equal '0+1i', '0d1i'
+assert_equal 'Complex', '0d1i.class'
+assert_equal '0+1i', '0o1i'
+assert_equal 'Complex', '0o1i.class'
+assert_equal '0+1i', '01i'
+assert_equal 'Complex', '01i.class'
+assert_equal '0+1.2i', '1.2i'
+assert_equal 'Complex', '1.2i.class'
+assert_equal '0+1/1i', '1ri'
+assert_equal 'Complex', '1ri.class'
+assert_equal '0+6/5i', '1.2ri'
+assert_equal 'Complex', '1.2ri.class'
+assert_equal '0+10.0i', '1e1i'
+assert_equal 'Complex', '1e1i.class'
+assert_equal '1', '1if true'
+assert_equal '1', '1rescue nil'
+assert_equal '10000000000000000001/10000000000000000000',
+ '1.0000000000000000001r'
+
+assert_equal 'syntax error, unexpected tIDENTIFIER, expecting end-of-input',
+ %q{begin eval('1ir', nil, '', 0); rescue SyntaxError => e; e.message[/\A:(?:\d+:)? (.*)/, 1] end}
+assert_equal 'syntax error, unexpected tIDENTIFIER, expecting end-of-input',
+ %q{begin eval('1.2ir', nil, '', 0); rescue SyntaxError => e; e.message[/\A:(?:\d+:)? (.*)/, 1] end}
+assert_equal 'syntax error, unexpected tIDENTIFIER, expecting end-of-input',
+ %q{begin eval('1e1r', nil, '', 0); rescue SyntaxError => e; e.message[/\A:(?:\d+:)? (.*)/, 1] end}
diff --git a/bootstraptest/test_method.rb b/bootstraptest/test_method.rb
index ed22608aea..0a7cb0a577 100644
--- a/bootstraptest/test_method.rb
+++ b/bootstraptest/test_method.rb
@@ -886,50 +886,6 @@ class C0; def m *args; [:C0_m, args]; end; end
class C1 < C0; def m a, o=:o; super; end; end
; C1.new.m 1, 2}
-assert_equal %q{[:ok, :ok, :ok, :ok, :ok, :ok, :ng, :ng]}, %q{
- $ans = []
- class Foo
- def m
- end
- end
-
- c1 = c2 = nil
-
- lambda{
- $SAFE = 4
- c1 = Class.new{
- def m
- end
- }
- c2 = Class.new(Foo){
- alias mm m
- }
- }.call
-
- def test
- begin
- yield
- rescue SecurityError
- $ans << :ok
- else
- $ans << :ng
- end
- end
-
- o1 = c1.new
- o2 = c2.new
-
- test{o1.m}
- test{o2.mm}
- test{o1.send :m}
- test{o2.send :mm}
- test{o1.public_send :m}
- test{o2.public_send :mm}
- test{o1.method(:m).call}
- test{o2.method(:mm).call}
- $ans
-}
-
assert_equal 'ok', %q{
class C
def x=(n)
@@ -1001,8 +957,8 @@ assert_equal 'ok', %q{
assert_normal_exit %q{
begin
- Process.setrlimit(Process::RLIMIT_STACK, 4_202_496)
- # FreeBSD fails this less than 4M + 8K bytes.
+ Process.setrlimit(Process::RLIMIT_STACK, 4_206_592)
+ # FreeBSD SEGVs this less than 4M + 12K bytes.
rescue Exception
exit
end
diff --git a/bootstraptest/test_thread.rb b/bootstraptest/test_thread.rb
index 121def8b42..048aeb19c2 100644
--- a/bootstraptest/test_thread.rb
+++ b/bootstraptest/test_thread.rb
@@ -10,7 +10,8 @@ assert_equal %q{ok}, %q{
:ok
}.value
}
-assert_equal %q{20100}, %q{
+assert_equal %q{ok}, %q{
+begin
v = 0
(1..200).map{|i|
Thread.new{
@@ -19,7 +20,10 @@ assert_equal %q{20100}, %q{
}.each{|t|
v += t.value
}
- v
+ v == 20100 ? :ok : v
+rescue ThreadError => e
+ :ok if /can't create Thread/ =~ e.message
+end
}
assert_equal %q{5000}, %q{
5000.times{|e|
@@ -41,13 +45,17 @@ assert_equal %q{5000}, %q{
}
}
}
-assert_equal %q{5000}, %q{
- 5000.times{
+assert_equal %q{ok}, %q{
+begin
+ :ok if 5000 == 5000.times{
t = Thread.new{}
while t.alive?
Thread.pass
end
}
+rescue NoMemoryError
+ :ok
+end
}
assert_equal %q{100}, %q{
100.times{
@@ -233,16 +241,16 @@ assert_equal 'ok', %{
}
assert_finish 3, %{
- th = Thread.new {sleep 2}
- th.join(1)
+ th = Thread.new {sleep 0.2}
+ th.join(0.1)
th.join
}
assert_finish 3, %{
require 'timeout'
- th = Thread.new {sleep 2}
+ th = Thread.new {sleep 0.2}
begin
- Timeout.timeout(1) {th.join}
+ Timeout.timeout(0.1) {th.join}
rescue Timeout::Error
end
th.join
@@ -268,7 +276,7 @@ assert_normal_exit %q{
assert_equal 'ok', %q{
def m
t = Thread.new { while true; // =~ "" end }
- sleep 0.1
+ sleep 0.01
10.times {
if /((ab)*(ab)*)*(b)/ =~ "ab"*7
return :ng if !$4
@@ -332,8 +340,9 @@ assert_equal 'ok', %q{
assert_equal 'ok', %q{
begin
m1, m2 = Mutex.new, Mutex.new
- Thread.new { m1.lock; sleep 1; m2.lock }
- m2.lock; sleep 1; m1.lock
+ 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
:ng
rescue Exception
:ok
@@ -342,7 +351,7 @@ assert_equal 'ok', %q{
assert_equal 'ok', %q{
m = Mutex.new
- Thread.new { m.lock }; sleep 1; m.lock
+ Thread.new { m.lock }; sleep 0.1; m.lock
:ok
}
@@ -360,15 +369,15 @@ assert_equal 'ok', %q{
assert_equal 'ok', %q{
m = Mutex.new
- Thread.new { m.lock; sleep 2 }
- sleep 1; m.lock
+ Thread.new { m.lock; sleep 0.2 }
+ sleep 0.1; m.lock
:ok
}
assert_equal 'ok', %q{
m = Mutex.new
- Thread.new { m.lock; sleep 2; m.unlock }
- sleep 1; m.lock
+ Thread.new { m.lock; sleep 0.2; m.unlock }
+ sleep 0.1; m.lock
:ok
}
@@ -390,19 +399,20 @@ assert_equal 'ok', %q{
assert_equal 'ok', %{
open("zzz.rb", "w") do |f|
- f.puts <<-END
+ f.puts <<-'end;' # do
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.3
+ sleep 0.01 until parent.stop?
begin
fork { GC.start }
rescue Exception
parent.raise $!
end
+ th1.run
end
m.lock
pid, status = Process.wait2
@@ -410,7 +420,7 @@ assert_equal 'ok', %{
rescue NotImplementedError
$result = :ok
end
- END
+ end;
end
require "./zzz.rb"
$result
@@ -440,17 +450,27 @@ assert_finish 3, %q{
assert_equal 'ok', %q{
begin
- Process.waitpid2(fork {sleep 1})[1].success? ? 'ok' : 'ng'
+ Process.waitpid2(fork {})[1].success? ? 'ok' : 'ng'
rescue NotImplementedError
'ok'
end
}
assert_equal 'foo', %q{
- 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 }
+ 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 }
GC.start
f.call.source
}
diff --git a/ccan/build_assert/build_assert.h b/ccan/build_assert/build_assert.h
new file mode 100644
index 0000000000..a04d1d4709
--- /dev/null
+++ b/ccan/build_assert/build_assert.h
@@ -0,0 +1,40 @@
+/* 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
new file mode 100644
index 0000000000..1f77a535e4
--- /dev/null
+++ b/ccan/check_type/check_type.h
@@ -0,0 +1,63 @@
+/* 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
new file mode 100644
index 0000000000..ae3e1fc81f
--- /dev/null
+++ b/ccan/container_of/container_of.h
@@ -0,0 +1,142 @@
+/* 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
new file mode 100644
index 0000000000..89de354795
--- /dev/null
+++ b/ccan/licenses/BSD-MIT
@@ -0,0 +1,17 @@
+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
new file mode 100644
index 0000000000..feb9b118e6
--- /dev/null
+++ b/ccan/licenses/CC0
@@ -0,0 +1,28 @@
+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
new file mode 100644
index 0000000000..749db7849a
--- /dev/null
+++ b/ccan/list/list.h
@@ -0,0 +1,635 @@
+/* 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) (h)
+#define list_debug_node(n, 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 - 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)
+{
+ n->next = h->n.next;
+ n->prev = &h->n;
+ h->n.next->prev = n;
+ h->n.next = 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)
+{
+ n->next = &h->n;
+ n->prev = h->n.prev;
+ h->n.prev->next = n;
+ h->n.prev = n;
+ (void)list_debug(h, 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_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) \
+ for (i = container_of_var(list_debug(h, LIST_LOC)->n.prev, i, member); \
+ &i->member != &(h)->n; \
+ i = container_of_var(i->member.prev, 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:
+ * struct child *next;
+ * 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);
+}
+
+/**
+ * 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) \
+ for (i = list_node_to_off_(list_debug(h, LIST_LOC)->n.next, \
+ (off)); \
+ list_node_from_off_((void *)i, (off)) != &(h)->n; \
+ i = list_node_to_off_(list_node_from_off_((void *)i, (off))->next, \
+ (off)))
+
+/**
+ * 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) \
+ for (i = list_node_to_off_(list_debug(h, LIST_LOC)->n.next, \
+ (off)), \
+ nxt = list_node_to_off_(list_node_from_off_(i, (off))->next, \
+ (off)); \
+ list_node_from_off_(i, (off)) != &(h)->n; \
+ i = nxt, \
+ nxt = list_node_to_off_(list_node_from_off_(i, (off))->next, \
+ (off)))
+
+
+/* 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
new file mode 100644
index 0000000000..9a9da9cd3f
--- /dev/null
+++ b/ccan/str/str.h
@@ -0,0 +1,16 @@
+/* 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 764c251d5e..d841328077 100644
--- a/class.c
+++ b/class.c
@@ -31,8 +31,113 @@
#include "internal.h"
#include <ctype.h>
-extern st_table *rb_class_tbl;
-static ID id_attached;
+int rb_vm_add_root_module(ID id, VALUE module);
+
+
+#define id_attached id__attached__
+
+void
+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->klass = klass;
+ entry->next = NULL;
+
+ head = RCLASS_EXT(super)->subclasses;
+ if (head) {
+ entry->next = head;
+ RCLASS_EXT(head->klass)->parent_subclasses = &entry->next;
+ }
+
+ RCLASS_EXT(super)->subclasses = entry;
+ RCLASS_EXT(klass)->parent_subclasses = &RCLASS_EXT(super)->subclasses;
+ }
+}
+
+static void
+rb_module_add_to_subclasses_list(VALUE module, VALUE iclass)
+{
+ rb_subclass_entry_t *entry, *head;
+
+ entry = ALLOC(rb_subclass_entry_t);
+ entry->klass = iclass;
+ entry->next = NULL;
+
+ head = RCLASS_EXT(module)->subclasses;
+ if (head) {
+ entry->next = head;
+ RCLASS_EXT(head->klass)->module_subclasses = &entry->next;
+ }
+
+ RCLASS_EXT(module)->subclasses = entry;
+ RCLASS_EXT(iclass)->module_subclasses = &RCLASS_EXT(module)->subclasses;
+}
+
+void
+rb_class_remove_from_super_subclasses(VALUE klass)
+{
+ rb_subclass_entry_t *entry;
+
+ if (RCLASS_EXT(klass)->parent_subclasses) {
+ entry = *RCLASS_EXT(klass)->parent_subclasses;
+
+ *RCLASS_EXT(klass)->parent_subclasses = entry->next;
+ if (entry->next) {
+ RCLASS_EXT(entry->next->klass)->parent_subclasses = RCLASS_EXT(klass)->parent_subclasses;
+ }
+ xfree(entry);
+ }
+
+ RCLASS_EXT(klass)->parent_subclasses = NULL;
+}
+
+void
+rb_class_remove_from_module_subclasses(VALUE klass)
+{
+ rb_subclass_entry_t *entry;
+
+ if (RCLASS_EXT(klass)->module_subclasses) {
+ entry = *RCLASS_EXT(klass)->module_subclasses;
+ *RCLASS_EXT(klass)->module_subclasses = entry->next;
+
+ if (entry->next) {
+ RCLASS_EXT(entry->next->klass)->module_subclasses = RCLASS_EXT(klass)->module_subclasses;
+ }
+
+ xfree(entry);
+ }
+
+ RCLASS_EXT(klass)->module_subclasses = NULL;
+}
+
+void
+rb_class_foreach_subclass(VALUE klass, void(*f)(VALUE))
+{
+ rb_subclass_entry_t *cur = RCLASS_EXT(klass)->subclasses;
+
+ /* do not be tempted to simplify this loop into a for loop, the order of
+ operations is important here if `f` modifies the linked list */
+ while (cur) {
+ VALUE curklass = cur->klass;
+ cur = cur->next;
+ f(curklass);
+ }
+}
+
+void
+rb_class_detach_subclasses(VALUE 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, rb_class_remove_from_module_subclasses);
+}
/**
* Allocates a struct RClass for a new class.
@@ -49,14 +154,20 @@ static ID id_attached;
static VALUE
class_alloc(VALUE flags, VALUE klass)
{
- NEWOBJ_OF(obj, struct RClass, klass, flags);
+ 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_SUPER(obj) = 0;
+ RCLASS_M_TBL_WRAPPER(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_SERIAL(obj) = rb_next_class_serial();
+
RCLASS_REFINED_CLASS(obj) = Qnil;
RCLASS_EXT(obj)->allocator = 0;
return (VALUE)obj;
@@ -77,8 +188,8 @@ rb_class_boot(VALUE super)
{
VALUE klass = class_alloc(T_CLASS, rb_cClass);
- RCLASS_SUPER(klass) = super;
- RCLASS_M_TBL(klass) = st_init_numtable();
+ RCLASS_SET_SUPER(klass, super);
+ RCLASS_M_TBL_INIT(klass);
OBJ_INFECT(klass, super);
return (VALUE)klass;
@@ -121,21 +232,23 @@ rb_class_new(VALUE super)
return rb_class_boot(super);
}
-static NODE*
-rewrite_cref_stack(NODE *node, VALUE old_klass, VALUE new_klass)
+static void
+rewrite_cref_stack(NODE *node, VALUE old_klass, VALUE new_klass, NODE **new_cref_ptr)
{
NODE *new_node;
- if (!node) {
- return NULL;
- }
- if (node->nd_clss == old_klass) {
- new_node = NEW_CREF(new_klass);
- new_node->nd_next = node->nd_next;
- } else {
+ while (node) {
+ if (node->nd_clss == old_klass) {
+ new_node = NEW_CREF(new_klass);
+ RB_OBJ_WRITE(new_node, &new_node->nd_next, node->nd_next);
+ *new_cref_ptr = new_node;
+ return;
+ }
new_node = NEW_CREF(node->nd_clss);
- new_node->nd_next = rewrite_cref_stack(node->nd_next, old_klass, new_klass);
+ node = node->nd_next;
+ *new_cref_ptr = new_node;
+ new_cref_ptr = &new_node->nd_next;
}
- return new_node;
+ *new_cref_ptr = NULL;
}
static void
@@ -144,9 +257,11 @@ 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);
- iseq->cref_stack = rewrite_cref_stack(me->def->body.iseq->cref_stack, me->klass, klass);
+ rewrite_cref_stack(me->def->body.iseq->cref_stack, me->klass, klass, &new_cref);
+ RB_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);
}
@@ -162,19 +277,27 @@ clone_method_i(st_data_t key, st_data_t value, st_data_t data)
return ST_CONTINUE;
}
+struct clone_const_arg {
+ VALUE klass;
+ st_table *tbl;
+};
+
static int
-clone_const(ID key, const rb_const_entry_t *ce, st_table *tbl)
+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);
- *nce = *ce;
- st_insert(tbl, key, (st_data_t)nce);
+ MEMCPY(nce, ce, rb_const_entry_t, 1);
+ RB_OBJ_WRITTEN(arg->klass, Qundef, ce->value);
+ RB_OBJ_WRITTEN(arg->klass, Qundef, ce->file);
+
+ st_insert(arg->tbl, key, (st_data_t)nce);
return ST_CONTINUE;
}
static int
clone_const_i(st_data_t key, st_data_t value, st_data_t data)
{
- return clone_const((ID)key, (const rb_const_entry_t *)value, (st_table *)data);
+ return clone_const((ID)key, (const rb_const_entry_t *)value, (struct clone_const_arg *)data);
}
static void
@@ -198,20 +321,29 @@ rb_mod_init_copy(VALUE clone, VALUE orig)
if (RB_TYPE_P(clone, T_CLASS)) {
class_init_copy_check(clone, orig);
}
- rb_obj_init_copy(clone, orig);
+ if (!OBJ_INIT_COPY(clone, orig)) return clone;
if (!FL_TEST(CLASS_OF(clone), FL_SINGLETON)) {
- RBASIC(clone)->klass = rb_singleton_class_clone(orig);
+ RBASIC_SET_CLASS(clone, rb_singleton_class_clone(orig));
rb_singleton_class_attached(RBASIC(clone)->klass, (VALUE)clone);
}
- RCLASS_SUPER(clone) = RCLASS_SUPER(orig);
+ 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;
+ }
+ if (RCLASS_M_TBL_WRAPPER(clone)) {
+ rb_free_m_tbl_wrapper(RCLASS_M_TBL_WRAPPER(clone));
+ RCLASS_M_TBL_WRAPPER(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) = st_copy(RCLASS_IV_TBL(orig));
+ 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);
CONST_ID(id, "__classpath__");
@@ -220,17 +352,15 @@ rb_mod_init_copy(VALUE clone, VALUE orig)
st_delete(RCLASS_IV_TBL(clone), &id, 0);
}
if (RCLASS_CONST_TBL(orig)) {
- if (RCLASS_CONST_TBL(clone)) {
- rb_free_const_table(RCLASS_CONST_TBL(clone));
- }
+ struct clone_const_arg arg;
+
RCLASS_CONST_TBL(clone) = st_init_numtable();
- st_foreach(RCLASS_CONST_TBL(orig), clone_const_i, (st_data_t)RCLASS_CONST_TBL(clone));
+ 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)) {
- if (RCLASS_M_TBL(clone)) {
- rb_free_m_table(RCLASS_M_TBL(clone));
- }
- RCLASS_M_TBL(clone) = st_init_numtable();
+ RCLASS_M_TBL_INIT(clone);
st_foreach(RCLASS_M_TBL(orig), clone_method_i, (st_data_t)clone);
}
@@ -255,28 +385,32 @@ rb_singleton_class_clone_and_attach(VALUE obj, VALUE attach)
VALUE clone = class_alloc(RBASIC(klass)->flags, 0);
if (BUILTIN_TYPE(obj) == T_CLASS) {
- RBASIC(clone)->klass = clone;
+ RBASIC_SET_CLASS(clone, clone);
}
else {
- RBASIC(clone)->klass = rb_singleton_class_clone(klass);
+ RBASIC_SET_CLASS(clone, rb_singleton_class_clone(klass));
}
- RCLASS_SUPER(clone) = RCLASS_SUPER(klass);
+ RCLASS_SET_SUPER(clone, RCLASS_SUPER(klass));
RCLASS_EXT(clone)->allocator = RCLASS_EXT(klass)->allocator;
if (RCLASS_IV_TBL(klass)) {
- RCLASS_IV_TBL(clone) = st_copy(RCLASS_IV_TBL(klass));
+ RCLASS_IV_TBL(clone) = rb_st_copy(clone, RCLASS_IV_TBL(klass));
}
if (RCLASS_CONST_TBL(klass)) {
+ struct clone_const_arg arg;
RCLASS_CONST_TBL(clone) = st_init_numtable();
- st_foreach(RCLASS_CONST_TBL(klass), clone_const_i, (st_data_t)RCLASS_CONST_TBL(clone));
+ arg.klass = clone;
+ arg.tbl = RCLASS_CONST_TBL(clone);
+ st_foreach(RCLASS_CONST_TBL(klass), clone_const_i, (st_data_t)&arg);
}
if (attach != Qundef) {
rb_singleton_class_attached(clone, attach);
}
- RCLASS_M_TBL(clone) = st_init_numtable();
+ RCLASS_M_TBL_INIT(clone);
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);
+
return clone;
}
}
@@ -292,13 +426,14 @@ rb_singleton_class_attached(VALUE klass, VALUE obj)
if (!RCLASS_IV_TBL(klass)) {
RCLASS_IV_TBL(klass) = st_init_numtable();
}
- st_insert(RCLASS_IV_TBL(klass), id_attached, obj);
+ rb_st_insert_id_and_value(klass, RCLASS_IV_TBL(klass), id_attached, obj);
}
}
#define METACLASS_OF(k) RBASIC(k)->klass
+#define SET_METACLASS_OF(k, cls) RBASIC_SET_CLASS(k, cls)
/*!
* whether k is a meta^(n)-class of Class class
@@ -346,17 +481,18 @@ make_metaclass(VALUE klass)
rb_singleton_class_attached(metaclass, klass);
if (META_CLASS_OF_CLASS_CLASS_P(klass)) {
- METACLASS_OF(klass) = METACLASS_OF(metaclass) = metaclass;
+ SET_METACLASS_OF(klass, metaclass);
+ SET_METACLASS_OF(metaclass, metaclass);
}
else {
VALUE tmp = METACLASS_OF(klass); /* for a meta^(n)-class klass, tmp is meta^(n)-class of Class class */
- METACLASS_OF(klass) = metaclass;
- METACLASS_OF(metaclass) = ENSURE_EIGENCLASS(tmp);
+ SET_METACLASS_OF(klass, metaclass);
+ SET_METACLASS_OF(metaclass, ENSURE_EIGENCLASS(tmp));
}
super = RCLASS_SUPER(klass);
while (RB_TYPE_P(super, T_ICLASS)) super = RCLASS_SUPER(super);
- RCLASS_SUPER(metaclass) = super ? ENSURE_EIGENCLASS(super) : rb_cClass;
+ RCLASS_SET_SUPER(metaclass, super ? ENSURE_EIGENCLASS(super) : rb_cClass);
OBJ_INFECT(metaclass, RCLASS_SUPER(metaclass));
@@ -376,10 +512,10 @@ make_singleton_class(VALUE obj)
VALUE klass = rb_class_boot(orig_class);
FL_SET(klass, FL_SINGLETON);
- RBASIC(obj)->klass = klass;
+ RBASIC_SET_CLASS(obj, klass);
rb_singleton_class_attached(klass, obj);
- METACLASS_OF(klass) = METACLASS_OF(rb_class_real(orig_class));
+ SET_METACLASS_OF(klass, METACLASS_OF(rb_class_real(orig_class)));
return klass;
}
@@ -387,12 +523,10 @@ make_singleton_class(VALUE obj)
static VALUE
boot_defclass(const char *name, VALUE super)
{
- extern st_table *rb_class_tbl;
VALUE obj = rb_class_boot(super);
ID id = rb_intern(name);
rb_name_class(obj, id);
- st_add_direct(rb_class_tbl, id, obj);
rb_const_set((rb_cObject ? rb_cObject : obj), id, obj);
return obj;
}
@@ -400,19 +534,16 @@ boot_defclass(const char *name, VALUE super)
void
Init_class_hierarchy(void)
{
- id_attached = rb_intern("__attached__");
-
rb_cBasicObject = boot_defclass("BasicObject", 0);
rb_cObject = boot_defclass("Object", rb_cBasicObject);
rb_cModule = boot_defclass("Module", rb_cObject);
rb_cClass = boot_defclass("Class", rb_cModule);
- rb_const_set(rb_cObject, rb_intern("BasicObject"), rb_cBasicObject);
- RBASIC(rb_cClass)->klass
- = RBASIC(rb_cModule)->klass
- = RBASIC(rb_cObject)->klass
- = RBASIC(rb_cBasicObject)->klass
- = rb_cClass;
+ rb_const_set(rb_cObject, rb_intern_const("BasicObject"), rb_cBasicObject);
+ RBASIC_SET_CLASS(rb_cClass, rb_cClass);
+ RBASIC_SET_CLASS(rb_cModule, rb_cClass);
+ RBASIC_SET_CLASS(rb_cObject, rb_cClass);
+ RBASIC_SET_CLASS(rb_cBasicObject, rb_cClass);
}
@@ -516,7 +647,7 @@ rb_define_class(const char *name, VALUE super)
rb_warn("no super class for `%s', Object assumed", name);
}
klass = rb_define_class_id(id, super);
- st_add_direct(rb_class_tbl, id, klass);
+ rb_vm_add_root_module(id, klass);
rb_name_class(klass, id);
rb_const_set(rb_cObject, id, klass);
rb_class_inherited(super, klass);
@@ -596,9 +727,7 @@ VALUE
rb_module_new(void)
{
VALUE mdl = class_alloc(T_MODULE, rb_cModule);
-
- RCLASS_M_TBL(mdl) = st_init_numtable();
-
+ RCLASS_M_TBL_INIT(mdl);
return (VALUE)mdl;
}
@@ -627,7 +756,7 @@ rb_define_module(const char *name)
rb_raise(rb_eTypeError, "%s is not a module", rb_obj_classname(module));
}
module = rb_define_module_id(id);
- st_add_direct(rb_class_tbl, id, module);
+ rb_vm_add_root_module(id, module);
rb_const_set(rb_cObject, id, module);
return module;
@@ -675,13 +804,16 @@ 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(klass) = RCLASS_M_TBL(RCLASS_ORIGIN(module));
- RCLASS_SUPER(klass) = super;
+
+ RCLASS_M_TBL_WRAPPER(OBJ_WB_UNPROTECT(klass)) =
+ RCLASS_M_TBL_WRAPPER(OBJ_WB_UNPROTECT(RCLASS_ORIGIN(module)));
+
+ RCLASS_SET_SUPER(klass, super);
if (RB_TYPE_P(module, T_ICLASS)) {
- RBASIC(klass)->klass = RBASIC(module)->klass;
+ RBASIC_SET_CLASS(klass, RBASIC(module)->klass);
}
else {
- RBASIC(klass)->klass = module;
+ RBASIC_SET_CLASS(klass, module);
}
OBJ_INFECT(klass, module);
OBJ_INFECT(klass, super);
@@ -697,9 +829,6 @@ rb_include_module(VALUE klass, VALUE module)
int changed = 0;
rb_frozen_class_p(klass);
- if (!OBJ_UNTRUSTED(klass)) {
- rb_secure(4);
- }
if (!RB_TYPE_P(module, T_MODULE)) {
Check_Type(module, T_MODULE);
@@ -710,7 +839,6 @@ rb_include_module(VALUE klass, VALUE module)
changed = include_modules_at(klass, RCLASS_ORIGIN(klass), module);
if (changed < 0)
rb_raise(rb_eArgError, "cyclic include detected");
- if (changed) rb_clear_cache();
}
static int
@@ -723,8 +851,8 @@ add_refined_method_entry_i(st_data_t key, st_data_t value, st_data_t data)
static int
include_modules_at(const VALUE klass, VALUE c, VALUE module)
{
- VALUE p;
- int changed = 0;
+ VALUE p, iclass;
+ int method_changed = 0, constant_changed = 0;
const st_table *const klass_m_tbl = RCLASS_M_TBL(RCLASS_ORIGIN(klass));
while (module) {
@@ -738,7 +866,7 @@ include_modules_at(const VALUE klass, VALUE c, VALUE module)
for (p = RCLASS_SUPER(klass); p; p = RCLASS_SUPER(p)) {
switch (BUILTIN_TYPE(p)) {
case T_ICLASS:
- if (RCLASS_M_TBL(p) == RCLASS_M_TBL(module)) {
+ if (RCLASS_M_TBL_WRAPPER(p) == RCLASS_M_TBL_WRAPPER(module)) {
if (!superclass_seen) {
c = p; /* move insertion point */
}
@@ -750,7 +878,16 @@ include_modules_at(const VALUE klass, VALUE c, VALUE module)
break;
}
}
- c = RCLASS_SUPER(c) = rb_include_class_new(module, RCLASS_SUPER(c));
+ iclass = rb_include_class_new(module, RCLASS_SUPER(c));
+ c = RCLASS_SET_SUPER(c, 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);
@@ -760,14 +897,17 @@ include_modules_at(const VALUE klass, VALUE c, VALUE module)
FL_SET(c, RMODULE_INCLUDED_INTO_REFINEMENT);
}
if (RMODULE_M_TBL(module) && RMODULE_M_TBL(module)->num_entries)
- changed = 1;
+ method_changed = 1;
if (RMODULE_CONST_TBL(module) && RMODULE_CONST_TBL(module)->num_entries)
- changed = 1;
+ constant_changed = 1;
skip:
module = RCLASS_SUPER(module);
}
- return changed;
+ if (method_changed) rb_clear_method_cache_by_class(klass);
+ if (constant_changed) rb_clear_constant_cache();
+
+ return method_changed;
}
static int
@@ -805,9 +945,6 @@ rb_prepend_module(VALUE klass, VALUE module)
int changed = 0;
rb_frozen_class_p(klass);
- if (!OBJ_UNTRUSTED(klass)) {
- rb_secure(4);
- }
Check_Type(module, T_MODULE);
@@ -816,11 +953,12 @@ rb_prepend_module(VALUE klass, VALUE module)
origin = RCLASS_ORIGIN(klass);
if (origin == klass) {
origin = class_alloc(T_ICLASS, klass);
- RCLASS_SUPER(origin) = RCLASS_SUPER(klass);
- RCLASS_SUPER(klass) = origin;
+ OBJ_WB_UNPROTECT(origin); /* TODO: conservative shading. Need more survey. */
+ RCLASS_SET_SUPER(origin, RCLASS_SUPER(klass));
+ RCLASS_SET_SUPER(klass, origin);
RCLASS_ORIGIN(klass) = origin;
- RCLASS_M_TBL(origin) = RCLASS_M_TBL(klass);
- RCLASS_M_TBL(klass) = st_init_numtable();
+ RCLASS_M_TBL_WRAPPER(origin) = RCLASS_M_TBL_WRAPPER(klass);
+ RCLASS_M_TBL_INIT(klass);
st_foreach(RCLASS_M_TBL(origin), move_refined_method,
(st_data_t) RCLASS_M_TBL(klass));
}
@@ -828,7 +966,6 @@ rb_prepend_module(VALUE klass, VALUE module)
if (changed < 0)
rb_raise(rb_eArgError, "cyclic prepend detected");
if (changed) {
- rb_clear_cache();
rb_vm_check_redefinition_by_prepend(klass);
}
}
@@ -904,16 +1041,18 @@ rb_mod_include_p(VALUE mod, VALUE mod2)
* call-seq:
* mod.ancestors -> array
*
- * Returns a list of modules included in <i>mod</i> (including
- * <i>mod</i> itself).
+ * Returns a list of modules included/prepended in <i>mod</i>
+ * (including <i>mod</i> itself).
*
* module Mod
* include Math
* include Comparable
+ * prepend Enumerable
* end
*
- * Mod.ancestors #=> [Mod, Comparable, Math]
- * Math.ancestors #=> [Math]
+ * Mod.ancestors #=> [Enumerable, Mod, Comparable, Math]
+ * Math.ancestors #=> [Math]
+ * Enumerable.ancestors #=> [Enumerable]
*/
VALUE
@@ -922,8 +1061,6 @@ rb_mod_ancestors(VALUE mod)
VALUE p, ary = rb_ary_new();
for (p = mod; p; p = RCLASS_SUPER(p)) {
- if (FL_TEST(p, FL_SINGLETON))
- continue;
if (BUILTIN_TYPE(p) == T_ICLASS) {
rb_ary_push(ary, RBASIC(p)->klass);
}
@@ -1006,7 +1143,7 @@ method_entry_i(st_data_t key, st_data_t value, st_data_t data)
}
static VALUE
-class_instance_method_list(int argc, VALUE *argv, VALUE mod, int obj, int (*func) (st_data_t, st_data_t, st_data_t))
+class_instance_method_list(int argc, const VALUE *argv, VALUE mod, int obj, int (*func) (st_data_t, st_data_t, st_data_t))
{
VALUE ary;
int recur, prepended = 0;
@@ -1046,29 +1183,29 @@ class_instance_method_list(int argc, VALUE *argv, VALUE mod, int obj, int (*func
*
* 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. 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.
+ * 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.
*
* module A
* def method1() end
* end
* class B
+ * include A
* def method2() end
* end
* class C < B
* def method3() end
* end
*
- * A.instance_methods #=> [:method1]
- * B.instance_methods(false) #=> [:method2]
- * C.instance_methods(false) #=> [:method3]
- * C.instance_methods(true).length #=> 43
+ * 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
*/
VALUE
-rb_class_instance_methods(int argc, VALUE *argv, VALUE mod)
+rb_class_instance_methods(int argc, const VALUE *argv, VALUE mod)
{
return class_instance_method_list(argc, argv, mod, 0, ins_methods_i);
}
@@ -1078,12 +1215,12 @@ rb_class_instance_methods(int argc, 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 not <code>false</code>, the
- * methods of any ancestors are included.
+ * <i>mod</i>. If the optional parameter is <code>false</code>, the
+ * methods of any ancestors are not included.
*/
VALUE
-rb_class_protected_instance_methods(int argc, VALUE *argv, VALUE mod)
+rb_class_protected_instance_methods(int argc, const VALUE *argv, VALUE mod)
{
return class_instance_method_list(argc, argv, mod, 0, ins_methods_prot_i);
}
@@ -1093,8 +1230,8 @@ rb_class_protected_instance_methods(int argc, 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 not <code>false</code>, the
- * methods of any ancestors are included.
+ * <i>mod</i>. If the optional parameter is <code>false</code>, the
+ * methods of any ancestors are not included.
*
* module Mod
* def method1() end
@@ -1106,7 +1243,7 @@ rb_class_protected_instance_methods(int argc, VALUE *argv, VALUE mod)
*/
VALUE
-rb_class_private_instance_methods(int argc, VALUE *argv, VALUE mod)
+rb_class_private_instance_methods(int argc, const VALUE *argv, VALUE mod)
{
return class_instance_method_list(argc, argv, mod, 0, ins_methods_priv_i);
}
@@ -1116,25 +1253,26 @@ rb_class_private_instance_methods(int argc, 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 not <code>false</code>, the methods of
- * any ancestors are included.
+ * If the optional parameter is <code>false</code>, the methods of
+ * any ancestors are not included.
*/
VALUE
-rb_class_public_instance_methods(int argc, VALUE *argv, VALUE mod)
+rb_class_public_instance_methods(int argc, const VALUE *argv, VALUE mod)
{
return class_instance_method_list(argc, argv, mod, 0, ins_methods_pub_i);
}
/*
* call-seq:
- * obj.methods(all=true) -> array
+ * obj.methods(regular=true) -> array
*
* 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 <i>all</i> parameter is set to <code>false</code>, only those methods
- * in the receiver will be listed.
+ * If the optional parameter is <code>false</code>, it
+ * returns an array of <i>obj<i>'s public and protected singleton methods,
+ * the array will not include methods in modules included in <i>obj</i>.
*
* class Klass
* def klass_method()
@@ -1144,26 +1282,25 @@ rb_class_public_instance_methods(int argc, VALUE *argv, VALUE mod)
* k.methods[0..9] #=> [:klass_method, :nil?, :===,
* # :==~, :!, :eql?
* # :hash, :<=>, :class, :singleton_class]
- * k.methods.length #=> 57
+ * k.methods.length #=> 56
+ *
+ * k.methods(false) #=> []
+ * def k.singleton_method; end
+ * k.methods(false) #=> [:singleton_method]
+ *
+ * module M123; def m123; end end
+ * k.extend M123
+ * k.methods(false) #=> [:singleton_method]
*/
VALUE
-rb_obj_methods(int argc, VALUE *argv, VALUE obj)
+rb_obj_methods(int argc, const VALUE *argv, VALUE obj)
{
- 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;
- }
+ rb_check_arity(argc, 0, 1);
+ if (argc > 0 && !RTEST(argv[0])) {
return rb_obj_singleton_methods(argc, argv, obj);
}
+ return class_instance_method_list(argc, argv, CLASS_OF(obj), 1, ins_methods_i);
}
/*
@@ -1176,7 +1313,7 @@ rb_obj_methods(int argc, VALUE *argv, VALUE obj)
*/
VALUE
-rb_obj_protected_methods(int argc, VALUE *argv, VALUE obj)
+rb_obj_protected_methods(int argc, const VALUE *argv, VALUE obj)
{
return class_instance_method_list(argc, argv, CLASS_OF(obj), 1, ins_methods_prot_i);
}
@@ -1191,7 +1328,7 @@ rb_obj_protected_methods(int argc, VALUE *argv, VALUE obj)
*/
VALUE
-rb_obj_private_methods(int argc, VALUE *argv, VALUE obj)
+rb_obj_private_methods(int argc, const VALUE *argv, VALUE obj)
{
return class_instance_method_list(argc, argv, CLASS_OF(obj), 1, ins_methods_priv_i);
}
@@ -1206,7 +1343,7 @@ rb_obj_private_methods(int argc, VALUE *argv, VALUE obj)
*/
VALUE
-rb_obj_public_methods(int argc, VALUE *argv, VALUE obj)
+rb_obj_public_methods(int argc, const VALUE *argv, VALUE obj)
{
return class_instance_method_list(argc, argv, CLASS_OF(obj), 1, ins_methods_pub_i);
}
@@ -1245,10 +1382,10 @@ rb_obj_public_methods(int argc, VALUE *argv, VALUE obj)
*/
VALUE
-rb_obj_singleton_methods(int argc, VALUE *argv, VALUE obj)
+rb_obj_singleton_methods(int argc, const VALUE *argv, VALUE obj)
{
- VALUE recur, ary, klass;
- st_table *list;
+ VALUE recur, ary, klass, origin;
+ st_table *list, *mtbl;
if (argc == 0) {
recur = Qtrue;
@@ -1257,16 +1394,17 @@ rb_obj_singleton_methods(int argc, VALUE *argv, VALUE obj)
rb_scan_args(argc, argv, "01", &recur);
}
klass = CLASS_OF(obj);
+ origin = RCLASS_ORIGIN(klass);
list = st_init_numtable();
if (klass && FL_TEST(klass, FL_SINGLETON)) {
- if (RCLASS_M_TBL(klass))
- st_foreach(RCLASS_M_TBL(klass), method_entry_i, (st_data_t)list);
+ 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 (RCLASS_M_TBL(klass))
- st_foreach(RCLASS_M_TBL(klass), method_entry_i, (st_data_t)list);
+ if (klass != origin && (mtbl = RCLASS_M_TBL(klass)) != 0)
+ st_foreach(mtbl, method_entry_i, (st_data_t)list);
klass = RCLASS_SUPER(klass);
}
}
@@ -1419,16 +1557,14 @@ singleton_class_of(VALUE obj)
else {
enum ruby_value_type type = BUILTIN_TYPE(obj);
if (type == T_FLOAT || type == T_BIGNUM) {
- rb_raise(rb_eTypeError, "can't define singleton");
+ rb_raise(rb_eTypeError, "can't define singleton");
}
}
- 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);
+ klass = RBASIC(obj)->klass;
+ if (!(FL_TEST(klass, FL_SINGLETON) &&
+ rb_ivar_get(klass, id_attached) == obj)) {
+ klass = rb_make_metaclass(obj, klass);
}
if (OBJ_TAINTED(obj)) {
@@ -1437,17 +1573,31 @@ singleton_class_of(VALUE obj)
else {
FL_UNSET(klass, FL_TAINT);
}
- if (OBJ_UNTRUSTED(obj)) {
- OBJ_UNTRUST(klass);
- }
- else {
- FL_UNSET(klass, FL_UNTRUSTED);
- }
- if (OBJ_FROZEN(obj)) OBJ_FREEZE(klass);
+ if (OBJ_FROZEN(obj)) OBJ_FREEZE_RAW(klass);
return klass;
}
+/*!
+ * Returns the singleton class of \a obj, or nil if obj is not a
+ * singleton object.
+ *
+ * \param obj an arbitrary object.
+ * \return the singleton class or nil.
+ */
+VALUE
+rb_singleton_class_get(VALUE obj)
+{
+ VALUE klass;
+
+ if (SPECIAL_CONST_P(obj)) {
+ return rb_special_singleton_class(obj);
+ }
+ klass = RBASIC(obj)->klass;
+ if (!FL_TEST(klass, FL_SINGLETON)) return Qnil;
+ if (rb_ivar_get(klass, id_attached) != obj) return Qnil;
+ return klass;
+}
/*!
* Returns the singleton class of \a obj. Creates it if necessary.
@@ -1631,8 +1781,11 @@ rb_scan_args(int argc, const VALUE *argv, const char *fmt, ...)
}
else {
hash = rb_check_hash_type(last);
- if (!NIL_P(hash))
- argc--;
+ if (!NIL_P(hash)) {
+ VALUE opts = rb_extract_keywords(&hash);
+ if (!hash) argc--;
+ hash = opts ? opts : Qnil;
+ }
}
}
/* capture leading mandatory arguments */
@@ -1696,6 +1849,121 @@ rb_scan_args(int argc, const VALUE *argv, const char *fmt, ...)
return argc;
}
+NORETURN(static void keyword_error(const char *error, VALUE keys));
+static void
+keyword_error(const char *error, VALUE keys)
+{
+ const char *msg = "";
+ if (RARRAY_LEN(keys) == 1) {
+ keys = RARRAY_AREF(keys, 0);
+ }
+ else {
+ keys = rb_ary_join(keys, rb_usascii_str_new2(", "));
+ msg = "s";
+ }
+ rb_raise(rb_eArgError, "%s keyword%s: %"PRIsVALUE, error, msg, 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)
+{
+ VALUE keys;
+ int i;
+ for (i = 0; i < keywords; i++) {
+ rb_hash_delete(hash, ID2SYM(table[i]));
+ }
+ keys = rb_funcall(hash, rb_intern("keys"), 0, 0);
+ if (!RB_TYPE_P(keys, T_ARRAY)) rb_raise(rb_eArgError, "unknown keyword");
+ 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];
+ 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)) {
+ 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)j) {
+ unknown_keyword_error(keyword_hash, table, required+optional);
+ }
+ }
+ return j;
+#undef extract_kwarg
+}
+
/*!
* \}
*/
diff --git a/common.mk b/common.mk
index e3df7d05d2..2c8f914ccf 100644
--- a/common.mk
+++ b/common.mk
@@ -14,10 +14,12 @@ RUBYLIB = $(PATH_SEPARATOR)
RUBYOPT = -
RUN_OPTS = --disable-gems
-SPEC_GIT_BASE = git://github.com/rubyspec
+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/hsbt/simplecov.git
+
STATIC_RUBY = static-ruby
EXTCONF = extconf.rb
@@ -33,7 +35,7 @@ MAINOBJ = $(NORMALMAINOBJ)
EXTOBJS =
DLDOBJS = $(DMYEXT)
EXTSOLIBS =
-MINIOBJS = $(ARCHMINIOBJS) dmyencoding.$(OBJEXT) dmyversion.$(OBJEXT) miniprelude.$(OBJEXT)
+MINIOBJS = $(ARCHMINIOBJS) miniinit.$(OBJEXT) miniprelude.$(OBJEXT)
ENC_MK = enc.mk
COMMONOBJS = array.$(OBJEXT) \
@@ -43,6 +45,7 @@ COMMONOBJS = array.$(OBJEXT) \
complex.$(OBJEXT) \
dir.$(OBJEXT) \
dln_find.$(OBJEXT) \
+ encoding.$(OBJEXT) \
enum.$(OBJEXT) \
enumerator.$(OBJEXT) \
error.$(OBJEXT) \
@@ -80,10 +83,12 @@ COMMONOBJS = array.$(OBJEXT) \
strftime.$(OBJEXT) \
string.$(OBJEXT) \
struct.$(OBJEXT) \
+ symbol.$(OBJEXT) \
time.$(OBJEXT) \
transcode.$(OBJEXT) \
util.$(OBJEXT) \
variable.$(OBJEXT) \
+ version.$(OBJEXT) \
compile.$(OBJEXT) \
debug.$(OBJEXT) \
iseq.$(OBJEXT) \
@@ -98,8 +103,8 @@ COMMONOBJS = array.$(OBJEXT) \
$(MISSING)
EXPORTOBJS = $(DLNOBJ) \
- encoding.$(OBJEXT) \
- version.$(OBJEXT) \
+ localeinit.$(OBJEXT) \
+ loadpath.$(OBJEXT) \
$(COMMONOBJS)
OBJS = $(EXPORTOBJS) prelude.$(OBJEXT)
@@ -107,10 +112,9 @@ 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
-YES_GEM_PRELUDE = $(GEM_PRELUDE)
-NO_GEM_PRELUDE =
PRELUDES = prelude.c miniprelude.c
GOLFPRELUDES = golf_prelude.c
@@ -119,7 +123,8 @@ SCRIPT_ARGS = --dest-dir="$(DESTDIR)" \
--mflags="$(MFLAGS)" \
--make-flags="$(MAKEFLAGS)"
EXTMK_ARGS = $(SCRIPT_ARGS) --extension $(EXTS) --extstatic $(EXTSTATIC) \
- --make-flags="V=$(V) MINIRUBY='$(MINIRUBY)'" --
+ --make-flags="V=$(V) MINIRUBY='$(MINIRUBY)'" --gnumake=$(gnumake) \
+ --
INSTRUBY = $(SUDO) $(RUNRUBY) -r./$(arch)-fake $(srcdir)/tool/rbinstall.rb
INSTRUBY_ARGS = $(SCRIPT_ARGS) \
--data-mode=$(INSTALL_DATA_MODE) \
@@ -143,7 +148,7 @@ COMPILE_PRELUDE = $(MINIRUBY) -I$(srcdir) $(srcdir)/tool/compile_prelude.rb
all: showflags main docs
-main: showflags $(EXTSTATIC:static=lib)encs exts
+main: showflags $(ENCSTATIC:static=lib)encs exts
@$(NULLCMD)
.PHONY: showflags
@@ -159,12 +164,13 @@ showflags:
" DLDFLAGS = $(DLDFLAGS)" \
" SOLIBS = $(SOLIBS)" \
$(MESSAGE_END)
+ -@$(CC_VERSION)
.PHONY: showconfig
showconfig:
- @$(MESSAGE_BEGIN) \
- "$(configure_args)" \
- $(MESSAGE_END)
+ @$(ECHO_BEGIN) \
+ $(configure_args) \
+ $(ECHO_END)
exts: build-ext
@@ -176,16 +182,10 @@ $(EXTS_MK): $(MKFILES) all-incs $(PREP) $(RBCONFIG) $(LIBRUBY)
configure-ext: $(EXTS_MK)
build-ext: $(EXTS_MK)
- $(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)
+ $(Q)$(MAKE) -f $(EXTS_MK) $(MFLAGS) libdir="$(libdir)" LIBRUBY_EXTS=$(LIBRUBY_EXTS) ENCOBJS="$(ENCOBJS)"
prog: program wprogram
-loadpath: $(PREP) PHONY
- $(MINIRUBY) -e 'p $$:'
-
$(PREP): $(MKFILES)
miniruby$(EXEEXT): config.status $(ALLOBJS) $(ARCHFILE) $(DTRACE_OBJ)
@@ -200,7 +200,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)
@@ -210,6 +210,7 @@ Doxyfile: $(srcdir)/template/Doxyfile.tmpl $(PREP) $(srcdir)/tool/generic_erb.rb
program: showflags $(PROGRAM)
wprogram: showflags $(WPROGRAM)
+mini: PHONY miniruby$(EXEEXT)
$(PROGRAM) $(WPROGRAM): $(LIBRUBY) $(MAINOBJ) $(OBJS) $(EXTOBJS) $(SETUP) $(PREP)
@@ -224,8 +225,8 @@ $(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: $(EXPORTOBJS)
- $(Q)$(NM) -Pgp $(EXPORTOBJS) | \
+ruby.imp: $(COMMONOBJS)
+ $(Q)$(NM) -Pgp $(COMMONOBJS) | \
awk 'BEGIN{print "#!"}; $$2~/^[BDT]$$/&&$$1!~/^(Init_|.*_threadptr_|\.)/{print $$1}' | \
sort -u -o $@
@@ -235,80 +236,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:: pre-install-local pre-install-ext pre-install-doc
-do-install-all: all
+pre-install-all:: all pre-install-local pre-install-ext pre-install-doc
+do-install-all: pre-install-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
+do-install-nodoc: main pre-install-nodoc
$(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)
+do-install-local: $(PROGRAM) pre-install-local
$(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
+do-install-ext: exts pre-install-ext
$(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
- $(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=bin --install=ext-arch
+do-install-arch: main do-install-arch
+ $(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)
+do-install-comm: $(PREP) pre-install-comm
$(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)
+do-install-bin: $(PROGRAM) pre-install-bin
$(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)
+do-install-lib: $(PREP) pre-install-lib
$(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
+do-install-ext-comm: exts pre-install-ext-comm
$(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
+do-install-ext-arch: exts pre-install-ext-arch
$(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)
+do-install-man: $(PREP) pre-install-man
$(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)
+do-install-capi: $(PREP) pre-install-capi
$(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=capi
post-install-capi::
@$(NULLCMD)
@@ -323,6 +324,11 @@ 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
+ $(Q)$(SUDO) $(MINIRUBY) $(srcdir)/tool/rbuninstall.rb --destdir=$(DESTDIR) $(INSTALLED_LIST)
+
+reinstall: all uninstall install
+
what-where-nodoc: no-install-nodoc
no-install-nodoc: pre-no-install-nodoc dont-install-nodoc post-no-install-nodoc
pre-no-install-nodoc:: pre-no-install-local pre-no-install-ext
@@ -400,14 +406,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)
+do-install-doc: $(PROGRAM) pre-install-doc
$(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)
+do-install-gem: $(PROGRAM) pre-install-gem
$(INSTRUBY) --make="$(MAKE)" $(INSTRUBY_ARGS) --install=gem
post-install-gem::
@$(NULLCMD)
@@ -420,6 +426,16 @@ rdoc-coverage: PHONY main
@echo Generating RDoc coverage report
$(Q) $(XRUBY) "$(srcdir)/bin/rdoc" --root "$(srcdir)" --encoding=UTF-8 --all --quiet -C $(RDOCFLAGS) "$(srcdir)"
+RDOCBENCHOUT=/tmp/rdocbench
+
+GCBENCH_ITEM=null
+
+gcbench: PHONY
+ $(Q) $(XRUBY) "$(srcdir)/benchmark/gc/gcbench.rb" $(GCBENCH_ITEM)
+
+gcbench-rdoc: PHONY
+ $(Q) $(XRUBY) "$(srcdir)/benchmark/gc/gcbench.rb" rdoc
+
nodoc: PHONY
what-where-doc: no-install-doc
@@ -432,16 +448,21 @@ post-no-install-doc::
CLEAR_INSTALLED_LIST = clear-installed-list
-install-prereq: $(CLEAR_INSTALLED_LIST) yes-fake PHONY
+install-prereq: $(CLEAR_INSTALLED_LIST) yes-fake sudo-precheck PHONY
clear-installed-list: PHONY
@> $(INSTALLED_LIST) set MAKE="$(MAKE)"
clean: clean-ext clean-local clean-enc clean-golf clean-rdoc clean-capi clean-extout clean-platform
-clean-local:: PHONY
+clean-local:: clean-runnable
$(Q)$(RM) $(OBJS) $(MINIOBJS) $(MAINOBJ) $(LIBRUBY_A) $(LIBRUBY_SO) $(LIBRUBY) $(LIBRUBY_ALIASES)
$(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)
+ $(Q)$(RM) GNUmakefile.old Makefile.old $(arch)-fake.rb
+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
clean-ext:: PHONY
clean-golf: PHONY
$(Q)$(RM) $(GORUBY)$(EXEEXT) $(GOLFOBJS)
@@ -449,6 +470,7 @@ clean-rdoc: PHONY
clean-capi: PHONY
clean-platform: PHONY
clean-extout: PHONY
+ -$(Q)$(RMDIR) $(EXTOUT)/$(arch) $(EXTOUT) 2> $(NULL) || exit 0
clean-docs: clean-rdoc clean-capi
distclean: distclean-ext distclean-local distclean-enc distclean-golf distclean-extout distclean-platform
@@ -467,16 +489,30 @@ 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 newline.c miniprelude.c revision.h
-realclean-ext::
+realclean-ext:: PHONY
realclean-golf: distclean-golf
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-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:
+ $(Q) $(RM) $(PLATFORM_D)
+ -$(Q) $(RMDIR) $(PLATFORM_DIR) 2> $(NULL) || exit 0
+
check: main test test-all
$(ECHO) check succeeded
check-ruby: test test-ruby
@@ -488,23 +524,23 @@ no-fake: PHONY
btest: $(TEST_RUNNABLE)-btest
no-btest: PHONY
yes-btest: fake miniruby$(EXEEXT) PHONY
- $(BOOTSTRAPRUBY) "$(srcdir)/bootstraptest/runner.rb" --ruby="$(BTESTRUBY)" $(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)$(RUNRUBY) "$(srcdir)/bootstraptest/runner.rb" --ruby="$(PROGRAM) -I$(srcdir)/lib" -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)$(RUNRUBY) $(srcdir)/tool/rubytest.rb $(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
- -$(RUNRUBY) "$(srcdir)/bootstraptest/runner.rb" --ruby="$(PROGRAM)" $(OPTS) $(TESTOPTS) $(srcdir)/KNOWNBUGS.rb
+ -$(RUNRUBY) "$(srcdir)/bootstraptest/runner.rb" --ruby="$(PROGRAM) $(RUN_OPTS)" $(OPTS) $(TESTOPTS) $(srcdir)/KNOWNBUGS.rb
test: test-sample btest-ruby test-knownbug
@@ -541,7 +577,7 @@ yes-runnable: PHONY
encs: enc trans
libencs: libenc libtrans
-encs enc trans libencs libenc libtrans: showflags $(ENC_MK) $(LIBRUBY) $(PREP)
+encs enc trans libencs libenc libtrans: showflags $(ENC_MK) $(LIBRUBY) $(PREP) PHONY
$(ECHO) making $@
$(Q) $(MAKE) -f $(ENC_MK) V="$(V)" \
RUBY="$(MINIRUBY)" MINIRUBY="$(MINIRUBY)" \
@@ -554,7 +590,7 @@ 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)
$(ECHO) generating $@
- $(Q) $(MINIRUBY) $(srcdir)/enc/make_encmake.rb --builtin-encs="$(BUILTIN_ENCOBJS)" --builtin-transes="$(BUILTIN_TRANSOBJS)" --module$(EXTSTATIC) $@ $(ENCS)
+ $(Q) $(MINIRUBY) $(srcdir)/enc/make_encmake.rb --builtin-encs="$(BUILTIN_ENCOBJS)" --builtin-transes="$(BUILTIN_TRANSOBJS)" --module$(ENCSTATIC) $@ $(ENCS)
.PRECIOUS: $(MKFILES)
@@ -583,6 +619,30 @@ PHONY:
$(Q)sed -e "/^#line.*y\.tab\.h/d;/^#line.*parse.*\.y/d" y.tab.h > $(@:.c=.h)
$(Q)$(RM) y.tab.c y.tab.h
+$(PLATFORM_D):
+ $(Q) $(MAKEDIRS) $(PLATFORM_DIR)
+ @exit > $@
+
+###
+CCAN_DIR = {$(VPATH)}ccan
+CCAN_LIST_INCLUDES = $(CCAN_DIR)/build_assert/build_assert.h \
+ $(CCAN_DIR)/check_type/check_type.h \
+ $(CCAN_DIR)/container_of/container_of.h \
+ $(CCAN_DIR)/list/list.h \
+ $(CCAN_DIR)/str/str.h
+
+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 \
+ $(CCAN_LIST_INCLUDES)
+
+###
+
acosh.$(OBJEXT): {$(VPATH)}acosh.c
alloca.$(OBJEXT): {$(VPATH)}alloca.c {$(VPATH)}config.h
crypt.$(OBJEXT): {$(VPATH)}crypt.c
@@ -593,7 +653,7 @@ 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 {$(VPATH)}util.h $(RUBY_H_INCLUDES)
+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
@@ -608,31 +668,18 @@ dl_os2.$(OBJEXT): {$(VPATH)}dl_os2.c
ia64.$(OBJEXT): {$(VPATH)}ia64.s
$(CC) $(CFLAGS) -c $<
-$(PLATFORM_D):
- $(Q) $(MAKEDIRS) $(PLATFORM_DIR)
- @exit > $@
-
###
-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
-
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
+ $(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
+ $(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
+ {$(VPATH)}internal.h $(hdrdir)/ruby.h
dir.$(OBJEXT): {$(VPATH)}dir.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h \
$(ENCODING_H_INCLUDES) \
{$(VPATH)}internal.h
@@ -640,26 +687,23 @@ 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
-dmyencoding.$(OBJEXT): {$(VPATH)}dmyencoding.c $(RUBY_H_INCLUDES) \
- {$(VPATH)}regenc.h {$(VPATH)}util.h $(ENCODING_H_INCLUDES) \
- {$(VPATH)}encoding.c {$(VPATH)}internal.h
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)}util.h {$(VPATH)}id.h {$(VPATH)}internal.h
enumerator.$(OBJEXT): {$(VPATH)}enumerator.c $(RUBY_H_INCLUDES) \
- {$(VPATH)}internal.h
+ {$(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)}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)
+ $(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)}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
@@ -667,44 +711,45 @@ 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)
-hash.$(OBJEXT): {$(VPATH)}hash.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h \
- $(ENCODING_H_INCLUDES) {$(VPATH)}internal.h $(PROBES_H_INCLUDES)
+ {$(VPATH)}thread.h $(PROBES_H_INCLUDES) {$(VPATH)}vm_opts.h {$(VPATH)}debug.h
+hash.$(OBJEXT): {$(VPATH)}hash.c $(RUBY_H_INCLUDES) {$(VPATH)}util.h {$(VPATH)}id.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
-main.$(OBJEXT): {$(VPATH)}main.c $(RUBY_H_INCLUDES) {$(VPATH)}node.h {$(VPATH)}vm_debug.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)
+ $(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)}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)}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 \
+ $(ENCODING_H_INCLUDES) {$(VPATH)}id.h {$(VPATH)}symbol.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)}parse.h {$(VPATH)}internal.h $(PROBES_H_INCLUDES) {$(VPATH)}vm_opts.h {$(VPATH)}gc.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)}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)}thread.h {$(VPATH)}vm_opts.h
random.$(OBJEXT): {$(VPATH)}random.c $(RUBY_H_INCLUDES) \
- {$(VPATH)}siphash.c {$(VPATH)}siphash.h
+ {$(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
+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
@@ -724,47 +769,58 @@ 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
-safe.$(OBJEXT): {$(VPATH)}safe.c $(RUBY_H_INCLUDES) $(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)
-sprintf.$(OBJEXT): {$(VPATH)}sprintf.c $(RUBY_H_INCLUDES) {$(VPATH)}re.h \
- {$(VPATH)}regex.h {$(VPATH)}vsnprintf.c $(ENCODING_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)}id.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)
+string.$(OBJEXT): {$(VPATH)}string.c $(RUBY_H_INCLUDES) {$(VPATH)}re.h {$(VPATH)}gc.h \
+ {$(VPATH)}regex.h $(ENCODING_H_INCLUDES) {$(VPATH)}internal.h \
+ $(PROBES_H_INCLUDES)
struct.$(OBJEXT): {$(VPATH)}struct.c $(RUBY_H_INCLUDES) {$(VPATH)}internal.h
+symbol.$(OBJEXT): {$(VPATH)}symbol.c $(RUBY_H_INCLUDES) $(ENCODING_H_INCLUDES) \
+ {$(VPATH)}internal.h {$(VPATH)}node.h {$(VPATH)}id.h {$(VPATH)}symbol.h \
+ $(PROBES_H_INCLUDES)
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)}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)}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)}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) \
- {$(VPATH)}version.h $(srcdir)/version.h $(srcdir)/revision.h {$(VPATH)}config.h \
+ $(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
-dmyversion.$(OBJEXT): {$(VPATH)}dmyversion.c version.$(OBJEXT)
+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)}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)}insns_info.inc {$(VPATH)}node_name.inc {$(VPATH)}internal.h \
+ {$(VPATH)}vm_opts.h {$(VPATH)}ruby_atomic.h {$(VPATH)}eval_intern.h \
+ {$(VPATH)}util.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 \
@@ -772,28 +828,28 @@ vm.$(OBJEXT): {$(VPATH)}vm.c {$(VPATH)}gc.h {$(VPATH)}iseq.h \
{$(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
+ $(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)}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)}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)}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)}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
+ $(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
+ $(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
+ $(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
+ {$(VPATH)}vm_debug.h {$(VPATH)}node.h $(hdrdir)/ruby.h
ascii.$(OBJEXT): {$(VPATH)}ascii.c {$(VPATH)}regenc.h {$(VPATH)}config.h \
{$(VPATH)}oniguruma.h {$(VPATH)}missing.h $(RUBY_H_INCLUDES)
@@ -809,7 +865,8 @@ unicode.$(OBJEXT): {$(VPATH)}unicode.c {$(VPATH)}regint.h \
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 $(RUBY_H_INCLUDES) $(PLATFORM_D)
+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
@@ -818,6 +875,10 @@ 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 $(RBCONFIG)
+ $(ECHO) creating $@
+ $(Q) $(MINIRUBY) "$(srcdir)/tool/generic_erb.rb" $(srcdir)/template/verconf.h.tmpl > $@
+
DTRACE_DEPENDENT_OBJS = array.$(OBJEXT) \
eval.$(OBJEXT) \
gc.$(OBJEXT) \
@@ -826,6 +887,7 @@ DTRACE_DEPENDENT_OBJS = array.$(OBJEXT) \
object.$(OBJEXT) \
parse.$(OBJEXT) \
string.$(OBJEXT) \
+ symbol.$(OBJEXT) \
vm.$(OBJEXT)
probes.$(OBJEXT): $(DTRACE_DEPENDENT_OBJS)
@@ -854,7 +916,7 @@ INSNS2VMOPT = --srcdir="$(srcdir)"
srcs: {$(VPATH)}parse.c {$(VPATH)}lex.c {$(VPATH)}newline.c {$(VPATH)}id.c srcs-ext srcs-enc
EXT_SRCS = $(srcdir)/ext/ripper/ripper.c $(srcdir)/ext/json/parser/parser.c \
- $(srcdir)/ext/dl/callback/callback.c
+ $(srcdir)/ext/dl/callback/callback.c $(srcdir)/ext/rbconfig/sizeof/sizes.c
srcs-ext: $(EXT_SRCS)
@@ -864,19 +926,20 @@ srcs-enc: $(ENC_MK)
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
+ $(srcdir)/revision.h $(REVISION_H) enc/unicode/name2ctype.h enc/jis/props.h \
+ {$(VPATH)}id.h {$(VPATH)}probes.dmyh
insns: $(INSNS)
id.h: $(srcdir)/tool/generic_erb.rb $(srcdir)/template/id.h.tmpl $(srcdir)/defs/id.def
$(ECHO) generating $@
$(Q) $(BASERUBY) $(srcdir)/tool/generic_erb.rb --output=$@ \
- $(srcdir)/template/$@.tmpl
+ $(srcdir)/template/id.h.tmpl
id.c: $(srcdir)/tool/generic_erb.rb $(srcdir)/template/id.c.tmpl $(srcdir)/defs/id.def
$(ECHO) generating $@
$(Q) $(BASERUBY) $(srcdir)/tool/generic_erb.rb --output=$@ \
- $(srcdir)/template/$@.tmpl
+ $(srcdir)/template/id.c.tmpl
node_name.inc: {$(VPATH)}node.h
$(ECHO) generating $@
@@ -928,10 +991,10 @@ $(REVISION_H): $(srcdir)/version.h $(srcdir)/ChangeLog $(srcdir)/tool/file2lastr
-$(Q) $(BASERUBY) $(srcdir)/tool/file2lastrev.rb --revision.h "$(srcdir)" > revision.tmp
$(Q)$(IFCHANGE) "--timestamp=$@" "$(srcdir)/revision.h" revision.tmp
-$(srcdir)/ext/ripper/ripper.c: parse.y
+$(srcdir)/ext/ripper/ripper.c: parse.y id.h
$(ECHO) generating $@
$(Q) $(CHDIR) $(@D) && $(exec) $(MAKE) -f depend $(MFLAGS) \
- Q=$(Q) ECHO=$(ECHO) top_srcdir=../.. srcdir=. VPATH=../.. RUBY="$(BASERUBY)"
+ 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 $@
@@ -943,6 +1006,12 @@ $(srcdir)/ext/dl/callback/callback.c: $(srcdir)/ext/dl/callback/mkcallback.rb $(
$(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) && $(exec) $(MAKE) -f depend $(MFLAGS) \
+ Q=$(Q) ECHO=$(ECHO) top_srcdir=../../.. srcdir=. VPATH=../../.. RUBY="$(BASERUBY)"
+
##
run: fake miniruby$(EXEEXT) PHONY
@@ -954,6 +1023,12 @@ runruby: $(PROGRAM) PHONY
parse: fake miniruby$(EXEEXT) PHONY
$(BTESTRUBY) $(srcdir)/tool/parse.rb $(TESTRUN_SCRIPT)
+bisect: PHONY
+ $(srcdir)/tool/bisect.sh miniruby $(srcdir)
+
+bisect-ruby: PHONY
+ $(srcdir)/tool/bisect.sh ruby $(srcdir)
+
COMPARE_RUBY = $(BASERUBY)
ITEM =
OPTS =
@@ -974,7 +1049,8 @@ tbench: $(PROGRAM) PHONY
--pattern='bmx_' --directory=$(srcdir)/benchmark $(OPTS)
run.gdb:
- echo b ruby_debug_breakpoint > run.gdb
+ echo set breakpoint pending on > 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
@@ -999,6 +1075,12 @@ dist:
up::
-$(Q)$(MAKE) $(MFLAGS) REVISION_FORCE=PHONY "$(REVISION_H)"
+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:
@echo PROGRAM=$(PROGRAM)
@@ -1015,6 +1097,8 @@ change: PHONY
love: sudo-precheck up all test install test-all
@echo love is all you need
+yes-test-all: sudo-precheck
+
sudo-precheck:
@$(SUDO) echo > $(NULL)
@@ -1035,10 +1119,12 @@ help: PHONY
" gdb-ruby: runs test.rb by ruby under gdb" \
" check: equals make test test-all" \
" test: ruby core tests" \
- " test-all: all ruby tests" \
+ " 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" \
+ " gcbench: gc benchmark [GCBENCH_ITEM=<item_name>]" \
+ " gcbench-rdoc: gc benchmark with GCBENCH_ITEM=rdoc" \
" install: install all ruby distributions" \
" install-nodoc: install without rdoc" \
" install-cross: install cross compiling staff" \
@@ -1048,5 +1134,5 @@ help: PHONY
" golf: for golfers" \
"" \
"see DeveloperHowto for more detail: " \
- " http://bugs.ruby-lang.org/wiki/ruby/DeveloperHowto" \
+ " https://bugs.ruby-lang.org/projects/ruby/wiki/DeveloperHowto" \
$(MESSAGE_END)
diff --git a/compar.c b/compar.c
index fc04946e3f..81dff38f49 100644
--- a/compar.c
+++ b/compar.c
@@ -18,17 +18,16 @@ static ID cmp;
void
rb_cmperr(VALUE x, VALUE y)
{
- const char *classname;
+ VALUE classname;
if (SPECIAL_CONST_P(y)) {
- y = rb_inspect(y);
- classname = StringValuePtr(y);
+ classname = rb_inspect(y);
}
else {
- classname = rb_obj_classname(y);
+ classname = rb_obj_class(y);
}
- rb_raise(rb_eArgError, "comparison of %s with %s failed",
- rb_obj_classname(x), classname);
+ rb_raise(rb_eArgError, "comparison of %"PRIsVALUE" with %"PRIsVALUE" failed",
+ rb_obj_class(x), classname);
}
static VALUE
@@ -54,8 +53,8 @@ rb_invcmp(VALUE x, VALUE y)
static VALUE
cmp_eq_recursive(VALUE arg1, VALUE arg2, int recursive)
{
- if (recursive) return Qfalse;
- return rb_funcall(arg1, cmp, 1, arg2);
+ if (recursive) return Qnil;
+ return rb_funcallv(arg1, cmp, 1, &arg2);
}
static VALUE
@@ -71,6 +70,8 @@ cmp_eq(VALUE *a)
static VALUE
cmp_failed(void)
{
+ rb_warn("Comparable#== will no more rescue exceptions of #<=> in the next release.");
+ rb_warn("Return nil in #<=> if the comparison is inappropriate or avoid such comparison.");
return Qfalse;
}
@@ -83,7 +84,7 @@ cmp_failed(void)
* _obj_ and _other_ are the same object.
*
* Even if _obj_ <=> _other_ raised an exception, the exception
- * is ignoread and returns false.
+ * is ignored and returns false.
*/
static VALUE
diff --git a/compile.c b/compile.c
index b86a1e38f3..ac4e5bac22 100644
--- a/compile.c
+++ b/compile.c
@@ -19,7 +19,6 @@
#include "insns.inc"
#include "insns_info.inc"
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
#define FIXNUM_INC(n, i) ((n)+(INT2FIX(i)&~FIXNUM_FLAG))
#define FIXNUM_OR(n, i) ((n)|INT2FIX(i))
@@ -172,10 +171,10 @@ r_value(VALUE value)
(((rb_iseq_t*)DATA_PTR(iseq))->location.absolute_path)
#define NEW_ISEQVAL(node, name, type, line_no) \
- new_child_iseq(iseq, (node), (name), 0, (type), (line_no))
+ new_child_iseq(iseq, (node), rb_fstring(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))
+ new_child_iseq(iseq, (node), rb_fstring(name), iseq->self, (type), (line_no))
/* add instructions */
#define ADD_SEQ(seq1, seq2) \
@@ -217,13 +216,13 @@ r_value(VALUE value)
#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)))
+ (id), (VALUE)(argc), (VALUE)(block), (VALUE)(flag)))
#define ADD_TRACE(seq, line, event) \
do { \
if ((event) == RUBY_EVENT_LINE && iseq->coverage && \
(line) != iseq->compile_data->last_coverable_line) { \
- RARRAY_PTR(iseq->coverage)[(line) - 1] = INT2FIX(0); \
+ RARRAY_ASET(iseq->coverage, (line) - 1, INT2FIX(0)); \
iseq->compile_data->last_coverable_line = (line); \
ADD_INSN1((seq), (line), trace, INT2FIX(RUBY_EVENT_COVERAGE)); \
} \
@@ -266,6 +265,11 @@ 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)])
@@ -279,7 +283,7 @@ r_value(VALUE value)
if (compile_debug) rb_compile_bug strs; \
GET_THREAD()->errinfo = iseq->compile_data->err_info; \
rb_compile_error strs; \
- iseq->compile_data->err_info = GET_THREAD()->errinfo; \
+ RB_OBJ_WRITE(iseq->self, &iseq->compile_data->err_info, GET_THREAD()->errinfo); \
GET_THREAD()->errinfo = tmp; \
ret = 0; \
break; \
@@ -299,7 +303,7 @@ r_value(VALUE value)
#define INIT_ANCHOR(name) \
(name##_body__.last = &name##_body__.anchor, name = &name##_body__)
-#define hide_obj(obj) do {OBJ_FREEZE(obj); RBASIC(obj)->klass = 0;} while (0)
+#define hide_obj(obj) do {OBJ_FREEZE(obj); RBASIC_CLEAR_CLASS(obj);} while (0)
#include "optinsn.inc"
#if OPT_INSTRUCTIONS_UNIFICATION
@@ -325,10 +329,9 @@ static void debug_list(ISEQ_ARG_DECLARE LINK_ANCHOR *anchor);
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, int insn_id, int argc, ...);
+static INSN *new_insn_body(rb_iseq_t *iseq, int line_no, enum ruby_vminsn_type 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);
@@ -480,8 +483,8 @@ rb_iseq_compile_node(VALUE self, NODE *node)
LABEL *start = iseq->compile_data->start_label = NEW_LABEL(0);
LABEL *end = iseq->compile_data->end_label = NEW_LABEL(0);
- ADD_LABEL(ret, start);
ADD_TRACE(ret, FIX2INT(iseq->location.first_lineno), RUBY_EVENT_B_CALL);
+ ADD_LABEL(ret, start);
COMPILE(ret, "block body", node->nd_body);
ADD_LABEL(ret, end);
ADD_TRACE(ret, nd_line(node), RUBY_EVENT_B_RETURN);
@@ -511,6 +514,10 @@ rb_iseq_compile_node(VALUE self, NODE *node)
}
}
}
+ else if (nd_type(node) == NODE_IFUNC) {
+ /* user callback */
+ (*node->nd_cfnc)(iseq, ret, node->nd_tval);
+ }
else {
switch (iseq->type) {
case ISEQ_TYPE_METHOD:
@@ -560,10 +567,7 @@ 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 long i;
-
- iseq->iseq_encoded = ALLOC_N(VALUE, iseq->iseq_size);
- MEMCPY(iseq->iseq_encoded, iseq->iseq, VALUE, iseq->iseq_size);
+ unsigned int i;
for (i = 0; i < iseq->iseq_size; /* */ ) {
int insn = (int)iseq->iseq_encoded[i];
@@ -571,12 +575,51 @@ rb_iseq_translate_threaded_code(rb_iseq_t *iseq)
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(rb_iseq_t *iseq) /* cold path */
+{
+ if (iseq->iseq) return iseq->iseq;
+
+ iseq->iseq = ALLOC_N(VALUE, iseq->iseq_size);
+
+ MEMCPY(iseq->iseq, iseq->iseq_encoded, VALUE, iseq->iseq_size);
+
+#if OPT_DIRECT_THREADED_CODE || OPT_CALL_THREADED_CODE
+ {
+ unsigned int i;
+
+ for (i = 0; i < iseq->iseq_size; /* */ ) {
+ const void *addr = (const void *)iseq->iseq[i];
+ const int insn = rb_vm_insn_addr2insn(addr);
+
+ iseq->iseq[i] = insn;
+ i += insn_len(insn);
+ }
+ }
+#endif
+ return iseq->iseq;
+}
+
/*********************************************/
/* definition of data structure for compiler */
/*********************************************/
@@ -588,26 +631,24 @@ compile_data_alloc(rb_iseq_t *iseq, size_t size)
struct iseq_compile_data_storage *storage =
iseq->compile_data->storage_current;
+ if (size >= INT_MAX) rb_memerror();
if (storage->pos + size > storage->size) {
- unsigned long alloc_size = storage->size * 2;
+ unsigned int alloc_size = storage->size;
- retry:
- if (alloc_size < size) {
+ while (alloc_size < size) {
+ if (alloc_size >= INT_MAX / 2) rb_memerror();
alloc_size *= 2;
- goto retry;
}
storage->next = (void *)ALLOC_N(char, alloc_size +
- sizeof(struct
- iseq_compile_data_storage));
+ SIZEOF_ISEQ_COMPILE_DATA_STORAGE);
storage = iseq->compile_data->storage_current = storage->next;
storage->next = 0;
storage->pos = 0;
storage->size = alloc_size;
- storage->buff = (char *)(&storage->buff + 1);
}
ptr = (void *)&storage->buff[storage->pos];
- storage->pos += size;
+ storage->pos += (int)size;
return ptr;
}
@@ -923,7 +964,7 @@ new_insn_core(rb_iseq_t *iseq, int line_no,
}
static INSN *
-new_insn_body(rb_iseq_t *iseq, int line_no, int insn_id, int argc, ...)
+new_insn_body(rb_iseq_t *iseq, int line_no, enum ruby_vminsn_type insn_id, int argc, ...)
{
VALUE *operands = 0;
va_list argv;
@@ -941,7 +982,7 @@ new_insn_body(rb_iseq_t *iseq, int line_no, int insn_id, int argc, ...)
}
static rb_call_info_t *
-new_callinfo(rb_iseq_t *iseq, ID mid, int argc, VALUE block, unsigned long flag)
+new_callinfo(rb_iseq_t *iseq, ID mid, int argc, VALUE block, unsigned int flag)
{
rb_call_info_t *ci = (rb_call_info_t *)compile_data_alloc(iseq, sizeof(rb_call_info_t));
ci->mid = mid;
@@ -958,7 +999,8 @@ new_callinfo(rb_iseq_t *iseq, ID mid, int argc, VALUE block, unsigned long flag)
ci->flag |= VM_CALL_ARGS_SKIP_SETUP;
}
}
- ci->vmstat = 0;
+ ci->method_state = 0;
+ ci->class_serial = 0;
ci->blockptr = 0;
ci->recv = Qundef;
ci->call = 0; /* TODO: should set default function? */
@@ -969,10 +1011,10 @@ new_callinfo(rb_iseq_t *iseq, ID mid, int argc, VALUE block, unsigned long flag)
}
static INSN *
-new_insn_send(rb_iseq_t *iseq, int line_no, VALUE id, VALUE argc, VALUE block, VALUE flag)
+new_insn_send(rb_iseq_t *iseq, int line_no, ID id, VALUE argc, VALUE block, VALUE flag)
{
VALUE *operands = (VALUE *)compile_data_alloc(iseq, sizeof(VALUE) * 1);
- operands[0] = (VALUE)new_callinfo(iseq, SYM2ID(id), FIX2INT(argc), block, FIX2INT(flag));
+ operands[0] = (VALUE)new_callinfo(iseq, id, FIX2INT(argc), block, FIX2INT(flag));
return new_insn_core(iseq, line_no, BIN(send), 1, operands);
}
@@ -1170,7 +1212,7 @@ iseq_set_arguments(rb_iseq_t *iseq, LINK_ANCHOR *optargs, NODE *node_args)
iseq->arg_opts = i;
iseq->arg_opt_table = ALLOC_N(VALUE, i);
- MEMCPY(iseq->arg_opt_table, RARRAY_PTR(labels), 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;
}
@@ -1183,21 +1225,33 @@ iseq_set_arguments(rb_iseq_t *iseq, LINK_ANCHOR *optargs, NODE *node_args)
if (args->kw_args) {
NODE *node = args->kw_args;
VALUE keywords = rb_ary_tmp_new(1);
- int i = 0, j;
+ 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) {
- rb_ary_push(keywords, INT2FIX(node->nd_body->nd_vid));
+ 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_keyword_check = args->kw_rest_arg->nd_cflag != 0;
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_PTR(keywords)[j]);
+ iseq->arg_keyword_table[j] = FIX2INT(RARRAY_AREF(keywords, j));
}
ADD_INSN(optargs, nd_line(args->kw_args), pop);
}
@@ -1421,8 +1475,7 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
/* make instruction sequence */
generated_iseq = ALLOC_N(VALUE, pos);
line_info_table = ALLOC_N(struct iseq_line_info_entry, k);
- iseq->ic_entries = ALLOC_N(struct iseq_inline_cache_entry, iseq->ic_size);
- MEMZERO(iseq->ic_entries, struct iseq_inline_cache_entry, iseq->ic_size);
+ iseq->is_entries = ZALLOC_N(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); */
@@ -1520,9 +1573,9 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
case TS_IC: /* inline cache */
{
int ic_index = FIX2INT(operands[j]);
- IC ic = &iseq->ic_entries[ic_index];
- if (UNLIKELY(ic_index >= iseq->ic_size)) {
- rb_bug("iseq_set_sequence: ic_index overflow: index: %d, size: %d", ic_index, iseq->ic_size);
+ 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[pos + 1 + j] = (VALUE)ic;
break;
@@ -1628,11 +1681,11 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
}
#endif
- iseq->iseq = (void *)generated_iseq;
+ iseq->iseq_encoded = (void *)generated_iseq;
iseq->iseq_size = pos;
iseq->stack_max = stack_max;
- line_info_table = ruby_xrealloc(line_info_table, k * sizeof(struct iseq_line_info_entry));
+ REALLOC_N(line_info_table, struct iseq_line_info_entry, k);
iseq->line_info_table = line_info_table;
iseq->line_info_size = k;
@@ -1654,19 +1707,22 @@ label_get_sp(LABEL *lobj)
static int
iseq_set_exception_table(rb_iseq_t *iseq)
{
- VALUE *tptr, *ptr;
+ const VALUE *tptr, *ptr;
int tlen, i;
struct iseq_catch_table_entry *entry;
tlen = (int)RARRAY_LEN(iseq->compile_data->catch_table_ary);
- tptr = RARRAY_PTR(iseq->compile_data->catch_table_ary);
+ tptr = RARRAY_CONST_PTR(iseq->compile_data->catch_table_ary);
- iseq->catch_table = tlen ? ALLOC_N(struct iseq_catch_table_entry, tlen) : 0;
- iseq->catch_table_size = tlen;
+ iseq->catch_table = 0;
+ if (tlen > 0) {
+ iseq->catch_table = xmalloc(iseq_catch_table_bytes(tlen));
+ iseq->catch_table->size = tlen;
+ }
- for (i = 0; i < tlen; i++) {
- ptr = RARRAY_PTR(tptr[i]);
- entry = &iseq->catch_table[i];
+ if (iseq->catch_table) for (i = 0; i < iseq->catch_table->size; i++) {
+ ptr = RARRAY_CONST_PTR(tptr[i]);
+ entry = &iseq->catch_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));
@@ -1695,7 +1751,7 @@ iseq_set_exception_table(rb_iseq_t *iseq)
}
}
- iseq->compile_data->catch_table_ary = 0; /* free */
+ RB_OBJ_WRITE(iseq->self, &iseq->compile_data->catch_table_ary, 0); /* free */
return COMPILE_OK;
}
@@ -1873,8 +1929,9 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
* leave # unreachable
*/
INSN *piobj = (INSN *)get_prev_insn((INSN *)list);
+ enum ruby_vminsn_type previ = piobj->insn_id;
- if (piobj->insn_id == BIN(send) || piobj->insn_id == BIN(opt_send_simple)) {
+ 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;
@@ -1939,6 +1996,11 @@ 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_SKIP_SETUP) {
@@ -2237,15 +2299,16 @@ compile_dstr_fragments(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE *node, int *cntp)
debugp_param("nd_lit", lit);
if (!NIL_P(lit)) {
- hide_obj(lit);
cnt++;
+ if (RB_TYPE_P(lit, T_STRING))
+ lit = node->nd_lit = rb_fstring(node->nd_lit);
ADD_INSN1(ret, nd_line(node), putobject, lit);
}
while (list) {
node = list->nd_head;
if (nd_type(node) == NODE_STR) {
- hide_obj(node->nd_lit);
+ node->nd_lit = rb_fstring(node->nd_lit);
ADD_INSN1(ret, nd_line(node), putobject, node->nd_lit);
}
else {
@@ -2407,7 +2470,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, ID2SYM(id_core_hash_from_ary), INT2FIX(1));
+ ADD_SEND(ret, line, id_core_hash_from_ary, INT2FIX(1));
}
}
else {
@@ -2418,7 +2481,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, ID2SYM(id_core_hash_merge_ary), INT2FIX(1));
+ ADD_SEND(ret, line, id_core_hash_merge_ary, INT2FIX(1));
}
}
}
@@ -2439,23 +2502,27 @@ compile_array_(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE* node_root,
APPEND_LIST(ret, anchor);
break;
case COMPILE_ARRAY_TYPE_HASH:
- if (first) {
- first = 0;
- ADD_INSN1(anchor, line, newhash, INT2FIX(i));
- APPEND_LIST(ret, anchor);
- }
- else if (i > 0) {
- ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
- ADD_INSN(ret, line, swap);
- APPEND_LIST(ret, anchor);
- ADD_SEND(ret, line, ID2SYM(id_core_hash_merge_ptr), INT2FIX(i + 1));
+ if (i > 0) {
+ if (first) {
+ ADD_INSN1(anchor, line, newhash, INT2FIX(i));
+ APPEND_LIST(ret, anchor);
+ }
+ else {
+ 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));
+ }
}
if (kw) {
+ VALUE nhash = (i > 0 || !first) ? INT2FIX(2) : INT2FIX(1);
ADD_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
- ADD_INSN(ret, line, swap);
+ if (i > 0 || !first) ADD_INSN(ret, line, swap);
COMPILE(ret, "keyword splat", kw);
- ADD_SEND(ret, line, ID2SYM(id_core_hash_merge_kwd), INT2FIX(2));
+ ADD_SEND(ret, line, id_core_hash_merge_kwd, nhash);
+ if (nhash == INT2FIX(1)) ADD_SEND(ret, line, rb_intern("dup"), INT2FIX(0));
}
+ first = 0;
break;
case COMPILE_ARRAY_TYPE_ARGS:
APPEND_LIST(ret, anchor);
@@ -2495,7 +2562,7 @@ case_when_optimizable_literal(NODE * node)
break;
}
case NODE_STR:
- return node->nd_lit;
+ return node->nd_lit = rb_fstring(node->nd_lit);
}
return Qundef;
}
@@ -2522,8 +2589,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 {
@@ -2760,6 +2827,8 @@ 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,
@@ -2863,17 +2932,10 @@ defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *ret,
case NODE_VCALL:
case NODE_FCALL:
case NODE_ATTRASGN:{
- int self = TRUE;
+ const int explicit_receiver =
+ (type == NODE_CALL ||
+ (type == NODE_ATTRASGN && !private_recv_p(node)));
- 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));
}
@@ -2881,7 +2943,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 (!self) {
+ if (explicit_receiver) {
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);
@@ -2970,8 +3032,6 @@ defined_expr(rb_iseq_t *iseq, LINK_ANCHOR *ret,
return done;
}
-#define BUFSIZE 0x100
-
static VALUE
make_name_for_block(rb_iseq_t *iseq)
{
@@ -2988,10 +3048,10 @@ make_name_for_block(rb_iseq_t *iseq)
}
if (level == 1) {
- return rb_sprintf("block in %s", RSTRING_PTR(ip->location.label));
+ return rb_sprintf("block in %"PRIsVALUE, ip->location.label);
}
else {
- return rb_sprintf("block (%d levels) in %s", level, RSTRING_PTR(ip->location.label));
+ return rb_sprintf("block (%d levels) in %"PRIsVALUE, level, ip->location.label);
}
}
@@ -3060,7 +3120,7 @@ add_ensure_iseq(LINK_ANCHOR *ret, rb_iseq_t *iseq, int is_return)
}
static VALUE
-setup_args(rb_iseq_t *iseq, LINK_ANCHOR *args, NODE *argn, VALUE *flag)
+setup_args(rb_iseq_t *iseq, LINK_ANCHOR *args, NODE *argn, unsigned int *flag)
{
VALUE argc = INT2FIX(0);
int nsplat = 0;
@@ -3143,6 +3203,17 @@ setup_args(rb_iseq_t *iseq, LINK_ANCHOR *args, NODE *argn, VALUE *flag)
return argc;
}
+static VALUE
+build_postexe_iseq(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE *body)
+{
+ int line = nd_line(body);
+ VALUE argc = INT2FIX(0);
+ 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);
+ iseq_set_local_table(iseq, 0);
+ return Qnil;
+}
/**
compile each node
@@ -3155,6 +3226,7 @@ static int
iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
{
enum node_type type;
+ LINK_ELEMENT *saved_last_element = 0;
int line;
if (node == 0) {
@@ -3172,6 +3244,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
if (node->flags & NODE_FL_NEWLINE) {
ADD_TRACE(ret, line, RUBY_EVENT_LINE);
+ saved_last_element = ret->last;
}
switch (type) {
@@ -3231,7 +3304,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
INIT_ANCHOR(body_seq);
INIT_ANCHOR(cond_seq);
- RHASH_TBL(literals)->type = &cdhash_type;
+ rb_hash_tbl_raw(literals)->type = &cdhash_type;
if (node->nd_head == 0) {
COMPILE_(ret, "when", node->nd_body, poped);
@@ -3416,13 +3489,13 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
redo_label, end_label);
}
else if (type == NODE_UNTIL) {
- /* untile */
+ /* until */
compile_branch_condition(iseq, ret, node->nd_cond,
end_label, redo_label);
}
else {
ADD_CALL_RECEIVER(ret, line);
- ADD_CALL(ret, line, ID2SYM(idGets), INT2FIX(0));
+ ADD_CALL(ret, line, idGets, INT2FIX(0));
ADD_INSNL(ret, line, branchif, redo_label);
/* opt_n */
}
@@ -3471,7 +3544,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
NEW_CHILD_ISEQVAL(node->nd_body, make_name_for_block(iseq),
ISEQ_TYPE_BLOCK, line);
- ADD_SEND_R(ret, line, ID2SYM(idEach), INT2FIX(0),
+ ADD_SEND_R(ret, line, idEach, INT2FIX(0),
iseq->compile_data->current_block, INT2FIX(0));
}
else {
@@ -3910,7 +3983,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->ic_size++));
+ ID2SYM(node->nd_vid), INT2FIX(iseq->is_size++));
break;
}
case NODE_CDECL:{
@@ -3943,7 +4016,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
case NODE_OP_ASGN1: {
DECL_ANCHOR(args);
VALUE argc;
- VALUE flag = 0;
+ unsigned int flag = 0;
+ unsigned int asgnflag = 0;
ID id = node->nd_mid;
int boff = 0;
@@ -3973,7 +4047,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
if (!poped) {
ADD_INSN(ret, line, putnil);
}
- COMPILE(ret, "NODE_OP_ASGN1 recv", node->nd_recv);
+ asgnflag = COMPILE_RECV(ret, "NODE_OP_ASGN1 recv", node);
switch (nd_type(node->nd_args->nd_head)) {
case NODE_ZARRAY:
argc = INT2FIX(0);
@@ -3986,7 +4060,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ADD_SEQ(ret, args);
}
ADD_INSN1(ret, line, dupn, FIXNUM_INC(argc, 1 + boff));
- ADD_SEND_R(ret, line, ID2SYM(idAREF), argc, Qfalse, LONG2FIX(flag));
+ flag |= asgnflag;
+ ADD_SEND_R(ret, line, idAREF, argc, Qfalse, INT2FIX(flag));
if (id == 0 || id == 1) {
/* 0: or, 1: and
@@ -4029,14 +4104,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_R(ret, line, ID2SYM(idASET),
- argc, Qfalse, LONG2FIX(flag));
+ ADD_SEND_R(ret, line, idASET,
+ argc, Qfalse, INT2FIX(flag));
}
else {
if (boff > 0)
ADD_INSN(ret, line, swap);
- ADD_SEND_R(ret, line, ID2SYM(idASET),
- FIXNUM_INC(argc, 1), Qfalse, LONG2FIX(flag));
+ ADD_SEND_R(ret, line, idASET,
+ FIXNUM_INC(argc, 1), Qfalse, INT2FIX(flag));
}
ADD_INSN(ret, line, pop);
ADD_INSNL(ret, line, jump, lfin);
@@ -4049,7 +4124,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, ID2SYM(id), INT2FIX(1));
+ ADD_SEND(ret, line, id, INT2FIX(1));
if (!poped) {
ADD_INSN1(ret, line, setn, FIXNUM_INC(argc, 2+boff));
}
@@ -4066,14 +4141,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_R(ret, line, ID2SYM(idASET),
- argc, Qfalse, LONG2FIX(flag));
+ ADD_SEND_R(ret, line, idASET,
+ argc, Qfalse, INT2FIX(flag));
}
else {
if (boff > 0)
ADD_INSN(ret, line, swap);
- ADD_SEND_R(ret, line, ID2SYM(idASET),
- FIXNUM_INC(argc, 1), Qfalse, LONG2FIX(flag));
+ ADD_SEND_R(ret, line, idASET,
+ FIXNUM_INC(argc, 1), Qfalse, INT2FIX(flag));
}
ADD_INSN(ret, line, pop);
}
@@ -4082,6 +4157,7 @@ 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;
+ VALUE asgnflag;
LABEL *lfin = NEW_LABEL(line);
LABEL *lcfin = NEW_LABEL(line);
/*
@@ -4126,10 +4202,10 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
*/
- COMPILE(ret, "NODE_OP_ASGN2#recv", node->nd_recv);
+ asgnflag = COMPILE_RECV(ret, "NODE_OP_ASGN2#recv", node);
ADD_INSN(ret, line, dup);
- ADD_SEND(ret, line, ID2SYM(node->nd_next->nd_vid),
- INT2FIX(0));
+ ADD_SEND_R(ret, line, node->nd_next->nd_vid,
+ INT2FIX(0), Qfalse, INT2FIX(asgnflag));
if (atype == 0 || atype == 1) { /* 0: OR or 1: AND */
ADD_INSN(ret, line, dup);
@@ -4143,8 +4219,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(ret, line, ID2SYM(node->nd_next->nd_aid),
- INT2FIX(1));
+ ADD_SEND_R(ret, line, node->nd_next->nd_aid,
+ INT2FIX(1), Qfalse, INT2FIX(asgnflag));
ADD_INSNL(ret, line, jump, lfin);
ADD_LABEL(ret, lcfin);
@@ -4159,14 +4235,14 @@ 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, ID2SYM(node->nd_next->nd_mid),
+ ADD_SEND(ret, line, node->nd_next->nd_mid,
INT2FIX(1));
if (!poped) {
ADD_INSN(ret, line, swap);
ADD_INSN1(ret, line, topn, INT2FIX(1));
}
- ADD_SEND(ret, line, ID2SYM(node->nd_next->nd_aid),
- INT2FIX(1));
+ ADD_SEND_R(ret, line, node->nd_next->nd_aid,
+ INT2FIX(1), Qfalse, INT2FIX(asgnflag));
ADD_INSN(ret, line, pop);
}
break;
@@ -4228,7 +4304,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, ID2SYM(node->nd_aid), INT2FIX(1));
+ ADD_CALL(ret, line, node->nd_aid, INT2FIX(1));
/* cref value */
ADD_INSN(ret, line, swap); /* value cref */
if (!poped) {
@@ -4281,6 +4357,37 @@ 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)
+ {
+ VALUE str = rb_fstring(node->nd_recv->nd_lit);
+ iseq_add_mark_object(iseq, str);
+ ADD_INSN1(ret, line, opt_str_freeze, str);
+ if (poped) {
+ ADD_INSN(ret, line, pop);
+ }
+ 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)
+ {
+ 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_INSN2(ret, line, opt_aref_with,
+ new_callinfo(iseq, idAREF, 1, 0, 0), str);
+ if (poped) {
+ ADD_INSN(ret, line, pop);
+ }
+ break;
+ }
case NODE_FCALL:
case NODE_VCALL:{ /* VCALL: variable or call */
/*
@@ -4292,7 +4399,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
DECL_ANCHOR(args);
ID mid = node->nd_mid;
VALUE argc;
- VALUE flag = 0;
+ unsigned int flag = 0;
VALUE parent_block = iseq->compile_data->current_block;
iseq->compile_data->current_block = Qfalse;
@@ -4392,8 +4499,8 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
flag |= VM_CALL_FCALL;
}
- ADD_SEND_R(ret, line, ID2SYM(mid),
- argc, parent_block, LONG2FIX(flag));
+ ADD_SEND_R(ret, line, mid,
+ argc, parent_block, INT2FIX(flag));
if (poped) {
ADD_INSN(ret, line, pop);
@@ -4404,7 +4511,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
case NODE_ZSUPER:{
DECL_ANCHOR(args);
int argc;
- VALUE flag = 0;
+ unsigned int flag = 0;
VALUE parent_block = iseq->compile_data->current_block;
INIT_ANCHOR(args);
@@ -4460,7 +4567,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
ADD_INSN1(args, line, newarray, INT2FIX(j));
ADD_INSN (args, line, concatarray);
- /* argc is setteled at above */
+ /* argc is settled at above */
}
else {
int j;
@@ -4478,14 +4585,14 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
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));
+ ADD_SEND (args, line, 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));
+ ADD_SEND(args, line, 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);
@@ -4593,7 +4700,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
case NODE_YIELD:{
DECL_ANCHOR(args);
VALUE argc;
- VALUE flag = 0;
+ unsigned int flag = 0;
INIT_ANCHOR(args);
if (iseq->type == ISEQ_TYPE_TOP) {
@@ -4649,7 +4756,7 @@ 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->ic_size++));
+ ID2SYM(node->nd_vid), INT2FIX(iseq->is_size++));
}
break;
}
@@ -4658,7 +4765,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
if (iseq->compile_data->option->inline_const_cache) {
LABEL *lend = NEW_LABEL(line);
- int ic_index = iseq->ic_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));
@@ -4732,13 +4839,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_INSN(ret, line, opt_regexpmatch2);
+ 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, ID2SYM(idEqTilde), INT2FIX(1));
+ ADD_SEND(ret, line, idEqTilde, INT2FIX(1));
}
if (poped) {
@@ -4754,9 +4861,9 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
break;
}
case NODE_STR:{
+ node->nd_lit = rb_fstring(node->nd_lit);
debugp_param("nd_lit", node->nd_lit);
if (!poped) {
- OBJ_FREEZE(node->nd_lit);
ADD_INSN1(ret, line, putstring, node->nd_lit);
}
break;
@@ -4770,10 +4877,10 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
break;
}
case NODE_XSTR:{
- OBJ_FREEZE(node->nd_lit);
+ node->nd_lit = rb_fstring(node->nd_lit);
ADD_CALL_RECEIVER(ret, line);
ADD_INSN1(ret, line, putobject, node->nd_lit);
- ADD_CALL(ret, line, ID2SYM(idBackquote), INT2FIX(1));
+ ADD_CALL(ret, line, idBackquote, INT2FIX(1));
if (poped) {
ADD_INSN(ret, line, pop);
@@ -4783,7 +4890,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, ID2SYM(idBackquote), INT2FIX(1));
+ ADD_CALL(ret, line, idBackquote, INT2FIX(1));
if (poped) {
ADD_INSN(ret, line, pop);
@@ -4810,17 +4917,12 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
break;
}
case NODE_DREGX_ONCE:{
- /* TODO: once? */
- LABEL *lend = NEW_LABEL(line);
- int ic_index = iseq->ic_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);
+ VALUE block_iseq = NEW_CHILD_ISEQVAL(block_node, make_name_for_block(iseq), ISEQ_TYPE_BLOCK, line);
- ADD_INSN2(ret, line, onceinlinecache, lend, INT2FIX(ic_index));
- ADD_INSN(ret, line, pop);
-
- compile_dregx(iseq, ret, node);
-
- ADD_INSN1(ret, line, setinlinecache, INT2FIX(ic_index));
- ADD_LABEL(ret, lend);
+ ADD_INSN2(ret, line, once, block_iseq, INT2FIX(ic_index));
if (poped) {
ADD_INSN(ret, line, pop);
@@ -4869,7 +4971,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
case NODE_DEFN:{
VALUE iseqval = NEW_ISEQVAL(node->nd_defn,
- rb_str_dup(rb_id2str(node->nd_mid)),
+ rb_id2str(node->nd_mid),
ISEQ_TYPE_METHOD, line);
debugp_param("defn/iseq", iseqval);
@@ -4878,7 +4980,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));
ADD_INSN1(ret, line, putobject, ID2SYM(node->nd_mid));
ADD_INSN1(ret, line, putiseq, iseqval);
- ADD_SEND (ret, line, ID2SYM(id_core_define_method), INT2FIX(3));
+ ADD_SEND (ret, line, id_core_define_method, INT2FIX(3));
if (poped) {
ADD_INSN(ret, line, pop);
@@ -4889,7 +4991,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
case NODE_DEFS:{
VALUE iseqval = NEW_ISEQVAL(node->nd_defn,
- rb_str_dup(rb_id2str(node->nd_mid)),
+ rb_id2str(node->nd_mid),
ISEQ_TYPE_METHOD, line);
debugp_param("defs/iseq", iseqval);
@@ -4898,7 +5000,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
COMPILE(ret, "defs: recv", node->nd_recv);
ADD_INSN1(ret, line, putobject, ID2SYM(node->nd_mid));
ADD_INSN1(ret, line, putiseq, iseqval);
- ADD_SEND (ret, line, ID2SYM(id_core_define_singleton_method), INT2FIX(3));
+ ADD_SEND (ret, line, id_core_define_singleton_method, INT2FIX(3));
if (poped) {
ADD_INSN(ret, line, pop);
@@ -4910,7 +5012,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, ID2SYM(id_core_set_method_alias), INT2FIX(3));
+ ADD_SEND(ret, line, id_core_set_method_alias, INT2FIX(3));
if (poped) {
ADD_INSN(ret, line, pop);
@@ -4921,7 +5023,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, ID2SYM(id_core_set_variable_alias), INT2FIX(2));
+ ADD_SEND(ret, line, id_core_set_variable_alias, INT2FIX(2));
if (poped) {
ADD_INSN(ret, line, pop);
@@ -4932,7 +5034,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, ID2SYM(id_core_undef_method), INT2FIX(2));
+ ADD_SEND(ret, line, id_core_undef_method, INT2FIX(2));
if (poped) {
ADD_INSN(ret, line, pop);
@@ -4997,7 +5099,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->ic_size++;
+ int ic_index = iseq->is_size++;
DECL_ANCHOR(pref);
DECL_ANCHOR(body);
@@ -5029,7 +5131,7 @@ 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, ID2SYM(node->nd_mid),
+ ADD_CALL(ret, line, node->nd_mid,
INT2FIX(1));
}
if (poped) {
@@ -5039,7 +5141,7 @@ 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->ic_size++;
+ int ic_index = iseq->is_size++;
debugi("colon3#nd_mid", node->nd_mid);
@@ -5188,19 +5290,15 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
break;
}
case NODE_POSTEXE:{
- LABEL *lend = NEW_LABEL(line);
- VALUE block = NEW_CHILD_ISEQVAL(node->nd_body, make_name_for_block(iseq), ISEQ_TYPE_BLOCK, line);
- int ic_index = iseq->ic_size++;
-
- ADD_INSN2(ret, line, onceinlinecache, lend, INT2FIX(ic_index));
- ADD_INSN(ret, line, pop);
+ /* compiled to:
+ * ONCE{ rb_mRubyVMFrozenCore::core#set_postexe{ ... } }
+ */
+ 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_INSN1(ret, line, putspecialobject, INT2FIX(VM_SPECIAL_OBJECT_VMCORE));
- ADD_INSN1(ret, line, putiseq, block);
- ADD_SEND (ret, line, ID2SYM(id_core_set_postexe), INT2FIX(1));
-
- ADD_INSN1(ret, line, setinlinecache, INT2FIX(ic_index));
- ADD_LABEL(ret, lend);
+ ADD_INSN2(ret, line, once, once_iseq, INT2FIX(is_index));
if (poped) {
ADD_INSN(ret, line, pop);
@@ -5209,17 +5307,17 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
}
case NODE_KW_ARG:{
LABEL *default_label = NEW_LABEL(line);
- LABEL *end_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_SEND(ret, line, 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));
+ ADD_SEND(ret, line, 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);
@@ -5233,16 +5331,21 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
default:
rb_bug("iseq_compile_each (NODE_KW_ARG): unknown node: %s", ruby_node_name(nd_type(node->nd_body)));
}
- ADD_INSNL(ret, line, jump, end_label);
+ 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);
- COMPILE_POPED(ret, "keyword default argument", node->nd_body);
- ADD_LABEL(ret, end_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, ID2SYM(idIntern), INT2FIX(0));
+ ADD_SEND(ret, line, idIntern, INT2FIX(0));
}
else {
ADD_INSN(ret, line, pop);
@@ -5252,20 +5355,37 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
case NODE_ATTRASGN:{
DECL_ANCHOR(recv);
DECL_ANCHOR(args);
- VALUE flag = 0;
+ unsigned int flag = 0;
VALUE argc;
+ int asgnflag;
+
+ /* optimization shortcut
+ * obj["literal"] = value -> opt_aset_with(obj, "literal", value)
+ */
+ if (node->nd_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)
+ {
+ 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_INSN2(ret, line, opt_aset_with,
+ new_callinfo(iseq, idASET, 2, 0, 0), str);
+ ADD_INSN(ret, line, pop);
+ break;
+ }
INIT_ANCHOR(recv);
INIT_ANCHOR(args);
argc = setup_args(iseq, args, node->nd_args, &flag);
- if (node->nd_recv == (NODE *) 1) {
- flag |= VM_CALL_FCALL;
- ADD_INSN(recv, line, putself);
- }
- else {
- COMPILE(recv, "recv", node->nd_recv);
- }
+ flag |= (asgnflag = COMPILE_RECV(recv, "recv", node));
debugp_param("argc", argc);
debugp_param("nd_mid", ID2SYM(node->nd_mid));
@@ -5279,7 +5399,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, ID2SYM(idAREF), INT2FIX(1));
+ ADD_SEND_R(ret, line, idAREF, INT2FIX(1), Qfalse, INT2FIX(asgnflag));
}
ADD_INSN1(ret, line, setn, FIXNUM_INC(argc, 3));
ADD_INSN (ret, line, pop);
@@ -5287,7 +5407,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, ID2SYM(idAREF), INT2FIX(1));
+ ADD_SEND_R(ret, line, idAREF, INT2FIX(1), Qfalse, INT2FIX(asgnflag));
ADD_INSN1(ret, line, setn, FIXNUM_INC(argc, 2));
ADD_INSN (ret, line, pop);
}
@@ -5299,7 +5419,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ADD_SEQ(ret, recv);
ADD_SEQ(ret, args);
}
- ADD_SEND_R(ret, line, ID2SYM(node->nd_mid), argc, 0, LONG2FIX(flag));
+ ADD_SEND_R(ret, line, node->nd_mid, argc, 0, INT2FIX(flag));
ADD_INSN(ret, line, pop);
break;
@@ -5314,7 +5434,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
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, ID2SYM(idLambda), argc, block);
+ ADD_CALL_WITH_BLOCK(ret, line, idLambda, argc, block);
if (poped) {
ADD_INSN(ret, line, pop);
@@ -5326,6 +5446,13 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
return COMPILE_NG;
}
+ /* check & remove redundant trace(line) */
+ if (saved_last_element && ret /* ret can be 0 when error */ &&
+ ret->last == saved_last_element &&
+ ((INSN *)saved_last_element)->insn_id == BIN(trace)) {
+ POP_ELEMENT(ret);
+ }
+
debug_node_end();
return COMPILE_OK;
}
@@ -5346,16 +5473,29 @@ calc_sp_depth(int depth, INSN *insn)
return insn_stack_increase(depth, insn->insn_id, insn->operands);
}
-static int
-insn_data_line_no(INSN *iobj)
+static VALUE
+opobj_inspect(VALUE obj)
{
- return insn_len(iobj->line_no);
+ 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);
}
+
+
static VALUE
insn_data_to_s_detail(INSN *iobj)
{
- VALUE str = rb_sprintf("%-16s", insn_name(iobj->insn_id));
+ VALUE str = rb_sprintf("%-20s ", insn_name(iobj->insn_id));
if (iobj->operands) {
const char *types = insn_op_types(iobj->insn_id);
@@ -5363,7 +5503,6 @@ 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) */
@@ -5380,7 +5519,7 @@ insn_data_to_s_detail(INSN *iobj)
if (0 && iseq) { /* TODO: invalidate now */
val = iseq->self;
}
- rb_str_concat(str, rb_inspect(val));
+ rb_str_concat(str, opobj_inspect(val));
}
break;
case TS_LINDEX:
@@ -5388,11 +5527,11 @@ insn_data_to_s_detail(INSN *iobj)
case TS_VALUE: /* VALUE */
{
VALUE v = OPERAND_AT(iobj, j);
- rb_str_concat(str, rb_inspect(v));
+ rb_str_concat(str, opobj_inspect(v));
break;
}
case TS_ID: /* ID */
- rb_str_concat(str, rb_inspect(OPERAND_AT(iobj, j)));
+ rb_str_concat(str, opobj_inspect(OPERAND_AT(iobj, j)));
break;
case TS_GENTRY:
{
@@ -5441,7 +5580,7 @@ dump_disasm_list(struct iseq_link_element *link)
{
iobj = (INSN *)link;
str = insn_data_to_s_detail(iobj);
- printf("%04d %-65s(%4d)\n", pos, StringValueCStr(str), insn_data_line_no(iobj));
+ printf("%04d %-65s(%4d)\n", pos, StringValueCStr(str), iobj->line_no);
pos += insn_data_length(iobj);
break;
}
@@ -5459,7 +5598,7 @@ dump_disasm_list(struct iseq_link_element *link)
case ISEQ_ELEMENT_ADJUST:
{
ADJUST *adjust = (ADJUST *)link;
- printf("adjust: [label: %d]\n", adjust->label->label_no);
+ printf("adjust: [label: %d]\n", adjust->label ? adjust->label->label_no : -1);
break;
}
default:
@@ -5483,7 +5622,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_obj_freeze(rb_str_new2(insn_name_info[i])));
+ rb_ary_push(ary, rb_fstring(rb_str_new2(insn_name_info[i])));
}
return rb_obj_freeze(ary);
}
@@ -5542,16 +5681,17 @@ iseq_build_from_ary_exception(rb_iseq_t *iseq, struct st_table *labels_table,
int i;
for (i=0; i<RARRAY_LEN(exception); i++) {
- VALUE v, type, *ptr, eiseqval;
+ VALUE v, type, eiseqval;
+ const VALUE *ptr;
LABEL *lstart, *lend, *lcont;
int sp;
- RB_GC_GUARD(v) = rb_convert_type(RARRAY_PTR(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");
}
- ptr = RARRAY_PTR(v);
+ ptr = RARRAY_CONST_PTR(v);
type = get_exception_sym2type(ptr[0]);
if (ptr[1] == Qnil) {
eiseqval = 0;
@@ -5608,7 +5748,7 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *anchor,
VALUE body, struct st_table *labels_table)
{
/* TODO: body should be frozen */
- VALUE *ptr = RARRAY_PTR(body);
+ const VALUE *ptr = RARRAY_CONST_PTR(body);
long i, len = RARRAY_LEN(body);
int j;
int line_no = 0;
@@ -5638,7 +5778,7 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *anchor,
st_data_t insn_id;
VALUE insn;
- insn = (argc < 0) ? Qnil : RARRAY_PTR(obj)[0];
+ insn = (argc < 0) ? Qnil : RARRAY_AREF(obj, 0);
if (st_lookup(insn_table, (st_data_t)insn, &insn_id) == 0) {
/* TODO: exception */
RB_GC_GUARD(insn) = rb_inspect(insn);
@@ -5686,8 +5826,8 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *anchor,
break;
case TS_IC:
argv[j] = op;
- if (NUM2INT(op) >= iseq->ic_size) {
- iseq->ic_size = NUM2INT(op) + 1;
+ if (NUM2INT(op) >= iseq->is_size) {
+ iseq->is_size = NUM2INT(op) + 1;
}
break;
case TS_CALLINFO:
@@ -5695,16 +5835,16 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *anchor,
ID mid = 0;
int orig_argc = 0;
VALUE block = 0;
- unsigned long flag = 0;
+ unsigned int 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")));
+ VALUE vblock = rb_hash_aref(op, ID2SYM(rb_intern("blockptr")));
if (!NIL_P(vmid)) mid = SYM2ID(vmid);
- if (!NIL_P(vflag)) flag = NUM2ULONG(vflag);
+ if (!NIL_P(vflag)) flag = NUM2UINT(vflag);
if (!NIL_P(vorig_argc)) orig_argc = FIX2INT(vorig_argc);
if (!NIL_P(vblock)) block = iseq_build_load_iseq(iseq, vblock);
}
@@ -5769,7 +5909,7 @@ rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args,
iseq->local_size = iseq->local_table_size + 1;
for (i=0; i<RARRAY_LEN(locals); i++) {
- VALUE lv = RARRAY_PTR(locals)[i];
+ VALUE lv = RARRAY_AREF(locals, i);
tbl[i] = FIXNUM_P(lv) ? (ID)FIX2LONG(lv) : SYM2ID(CHECK_SYMBOL(lv));
}
diff --git a/complex.c b/complex.c
index f6f63f6ebd..b65bc8a61c 100644
--- a/complex.c
+++ b/complex.c
@@ -18,10 +18,10 @@
VALUE rb_cComplex;
-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,
+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,
id_i_real, id_i_imag;
#define f_boolcast(x) ((x) ? Qtrue : Qfalse)
@@ -76,20 +76,6 @@ 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)
@@ -106,16 +92,6 @@ 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
@@ -152,16 +128,10 @@ 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
@@ -180,9 +150,6 @@ f_to_f(VALUE x)
}
fun1(to_r)
-fun1(to_s)
-
-fun2(divmod)
inline static VALUE
f_eqeq_p(VALUE x, VALUE y)
@@ -194,7 +161,6 @@ f_eqeq_p(VALUE x, VALUE y)
fun2(expt)
fun2(fdiv)
-fun2(idiv)
fun2(quo)
inline static VALUE
@@ -210,17 +176,16 @@ f_negative_p(VALUE x)
inline static VALUE
f_zero_p(VALUE x)
{
- switch (TYPE(x)) {
- case T_FIXNUM:
+ if (RB_TYPE_P(x, T_FIXNUM)) {
return f_boolcast(FIX2LONG(x) == 0);
- case T_BIGNUM:
+ }
+ else if (RB_TYPE_P(x, T_BIGNUM)) {
return Qfalse;
- case T_RATIONAL:
- {
- VALUE num = RRATIONAL(x)->num;
+ }
+ else if (RB_TYPE_P(x, T_RATIONAL)) {
+ VALUE num = RRATIONAL(x)->num;
- return f_boolcast(FIXNUM_P(num) && FIX2LONG(num) == 0);
- }
+ return f_boolcast(FIXNUM_P(num) && FIX2LONG(num) == 0);
}
return rb_funcall(x, id_eqeq_p, 1, ZERO);
}
@@ -230,19 +195,18 @@ f_zero_p(VALUE x)
inline static VALUE
f_one_p(VALUE x)
{
- switch (TYPE(x)) {
- case T_FIXNUM:
+ if (RB_TYPE_P(x, T_FIXNUM)) {
return f_boolcast(FIX2LONG(x) == 1);
- case T_BIGNUM:
+ }
+ else if (RB_TYPE_P(x, T_BIGNUM)) {
return Qfalse;
- case T_RATIONAL:
- {
- VALUE num = RRATIONAL(x)->num;
- VALUE den = RRATIONAL(x)->den;
+ }
+ else if (RB_TYPE_P(x, T_RATIONAL)) {
+ VALUE num = RRATIONAL(x)->num;
+ VALUE den = RRATIONAL(x)->den;
- return f_boolcast(FIXNUM_P(num) && FIX2LONG(num) == 1 &&
- FIXNUM_P(den) && FIX2LONG(den) == 1);
- }
+ return f_boolcast(FIXNUM_P(num) && FIX2LONG(num) == 1 &&
+ FIXNUM_P(den) && FIX2LONG(den) == 1);
}
return rb_funcall(x, id_eqeq_p, 1, ONE);
}
@@ -260,12 +224,6 @@ 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);
@@ -313,10 +271,10 @@ k_complex_p(VALUE x)
inline static VALUE
nucomp_s_new_internal(VALUE klass, VALUE real, VALUE imag)
{
- NEWOBJ_OF(obj, struct RComplex, klass, T_COMPLEX);
+ NEWOBJ_OF(obj, struct RComplex, klass, T_COMPLEX | (RGENGC_WB_PROTECTED_COMPLEX ? FL_WB_PROTECTED : 0));
- obj->real = real;
- obj->imag = imag;
+ RCOMPLEX_SET_REAL(obj, real);
+ RCOMPLEX_SET_IMAG(obj, imag);
return (VALUE)obj;
}
@@ -383,13 +341,10 @@ nucomp_canonicalization(int f)
inline static void
nucomp_real_check(VALUE num)
{
- switch (TYPE(num)) {
- case T_FIXNUM:
- case T_BIGNUM:
- case T_FLOAT:
- case T_RATIONAL:
- break;
- default:
+ if (!RB_TYPE_P(num, T_FIXNUM) &&
+ !RB_TYPE_P(num, T_BIGNUM) &&
+ !RB_TYPE_P(num, T_FLOAT) &&
+ !RB_TYPE_P(num, T_RATIONAL)) {
if (!k_numeric_p(num) || !f_real_p(num))
rb_raise(rb_eTypeError, "not a real");
}
@@ -462,13 +417,6 @@ 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));
@@ -483,6 +431,8 @@ 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:
*
@@ -542,7 +492,6 @@ m_log_bang(VALUE x)
imp1(sin)
imp1(sinh)
-imp1(sqrt)
static VALUE
m_cos(VALUE x)
@@ -575,6 +524,8 @@ m_sin(VALUE x)
}
#if 0
+imp1(sqrt)
+
static VALUE
m_sqrt(VALUE x)
{
@@ -1242,11 +1193,9 @@ f_signbit(VALUE x)
!defined(signbit)
extern int signbit(double);
#endif
- switch (TYPE(x)) {
- case T_FLOAT: {
+ if (RB_TYPE_P(x, T_FLOAT)) {
double f = RFLOAT_VALUE(x);
return f_boolcast(!isnan(f) && signbit(f));
- }
}
return f_negative_p(x);
}
@@ -1292,7 +1241,7 @@ f_format(VALUE self, VALUE (*func)(VALUE))
static VALUE
nucomp_to_s(VALUE self)
{
- return f_format(self, f_to_s);
+ return f_format(self, rb_String);
}
/*
@@ -1313,7 +1262,7 @@ nucomp_inspect(VALUE self)
VALUE s;
s = rb_usascii_str_new2("(");
- rb_str_concat(s, f_format(self, f_inspect));
+ rb_str_concat(s, f_format(self, rb_inspect));
rb_str_cat2(s, ")");
return s;
@@ -1332,8 +1281,8 @@ nucomp_loader(VALUE self, VALUE a)
{
get_dat1(self);
- dat->real = rb_ivar_get(a, id_i_real);
- dat->imag = rb_ivar_get(a, id_i_imag);
+ RCOMPLEX_SET_REAL(dat, rb_ivar_get(a, id_i_real));
+ RCOMPLEX_SET_IMAG(dat, rb_ivar_get(a, id_i_imag));
return self;
}
@@ -1357,8 +1306,8 @@ nucomp_marshal_load(VALUE self, VALUE a)
Check_Type(a, T_ARRAY);
if (RARRAY_LEN(a) != 2)
rb_raise(rb_eArgError, "marshaled complex must have an array whose length is 2 but %ld", RARRAY_LEN(a));
- rb_ivar_set(self, id_i_real, RARRAY_PTR(a)[0]);
- rb_ivar_set(self, id_i_imag, RARRAY_PTR(a)[1]);
+ rb_ivar_set(self, id_i_real, RARRAY_AREF(a, 0));
+ rb_ivar_set(self, id_i_imag, RARRAY_AREF(a, 1));
return self;
}
@@ -1393,6 +1342,20 @@ 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_REAL(cmp, i);
+ return cmp;
+}
+
/*
* call-seq:
* cmp.to_i -> integer
@@ -1410,9 +1373,8 @@ nucomp_to_i(VALUE self)
get_dat1(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));
+ rb_raise(rb_eRangeError, "can't convert %"PRIsVALUE" into Integer",
+ self);
}
return f_to_i(dat->real);
}
@@ -1434,9 +1396,8 @@ nucomp_to_f(VALUE self)
get_dat1(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));
+ rb_raise(rb_eRangeError, "can't convert %"PRIsVALUE" into Float",
+ self);
}
return f_to_f(dat->real);
}
@@ -1460,9 +1421,8 @@ nucomp_to_r(VALUE self)
get_dat1(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));
+ rb_raise(rb_eRangeError, "can't convert %"PRIsVALUE" into Rational",
+ self);
}
return f_to_r(dat->real);
}
@@ -1488,9 +1448,8 @@ nucomp_rationalize(int argc, VALUE *argv, VALUE self)
rb_scan_args(argc, argv, "01", NULL);
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));
+ rb_raise(rb_eRangeError, "can't convert %"PRIsVALUE" into Rational",
+ self);
}
return rb_funcall2(dat->real, rb_intern("rationalize"), argc, argv);
}
@@ -1781,19 +1740,26 @@ parse_comp(const char *s, int strict,
VALUE *num)
{
char *buf, *b;
+ VALUE tmp;
+ int ret = 1;
- buf = ALLOCA_N(char, strlen(s) + 1);
+ buf = ALLOCV_N(char, tmp, strlen(s) + 1);
b = buf;
skip_ws(&s);
- if (!read_comp(&s, strict, num, &b))
- return 0;
- skip_ws(&s);
+ if (!read_comp(&s, strict, num, &b)) {
+ ret = 0;
+ }
+ else {
+ skip_ws(&s);
- if (strict)
- if (*s != '\0')
- return 0;
- return 1;
+ if (strict)
+ if (*s != '\0')
+ ret = 0;
+ }
+ ALLOCV_END(tmp);
+
+ return ret;
}
static VALUE
@@ -1819,9 +1785,8 @@ string_to_c_strict(VALUE self)
s = (char *)"";
if (!parse_comp(s, 1, &num)) {
- VALUE ins = f_inspect(self);
- rb_raise(rb_eArgError, "invalid value for convert(): %s",
- StringValuePtr(ins));
+ rb_raise(rb_eArgError, "invalid value for convert(): %+"PRIsVALUE,
+ self);
}
return num;
@@ -1887,30 +1852,17 @@ nucomp_s_convert(int argc, VALUE *argv, VALUE klass)
backref = rb_backref_get();
rb_match_busy(backref);
- switch (TYPE(a1)) {
- case T_FIXNUM:
- case T_BIGNUM:
- case T_FLOAT:
- break;
- case T_STRING:
+ if (RB_TYPE_P(a1, T_STRING)) {
a1 = string_to_c_strict(a1);
- break;
}
- switch (TYPE(a2)) {
- case T_FIXNUM:
- case T_BIGNUM:
- case T_FLOAT:
- break;
- case T_STRING:
+ if (RB_TYPE_P(a2, T_STRING)) {
a2 = string_to_c_strict(a2);
- break;
}
rb_backref_set(backref);
- switch (TYPE(a1)) {
- case T_COMPLEX:
+ if (RB_TYPE_P(a1, T_COMPLEX)) {
{
get_dat1(a1);
@@ -1919,8 +1871,7 @@ nucomp_s_convert(int argc, VALUE *argv, VALUE klass)
}
}
- switch (TYPE(a2)) {
- case T_COMPLEX:
+ if (RB_TYPE_P(a2, T_COMPLEX)) {
{
get_dat1(a2);
@@ -1929,8 +1880,7 @@ nucomp_s_convert(int argc, VALUE *argv, VALUE klass)
}
}
- switch (TYPE(a1)) {
- case T_COMPLEX:
+ if (RB_TYPE_P(a1, T_COMPLEX)) {
if (argc == 1 || (k_exact_zero_p(a2)))
return a1;
}
@@ -2018,6 +1968,7 @@ numeric_arg(VALUE self)
/*
* call-seq:
* num.rect -> array
+ * num.rectangular -> array
*
* Returns an array; [num, 0].
*/
@@ -2112,29 +2063,19 @@ 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 */
@@ -2226,7 +2167,7 @@ Init_Complex(void)
rb_define_method(rb_cComplex, "inspect", nucomp_inspect, 0);
rb_define_private_method(rb_cComplex, "marshal_dump", nucomp_marshal_dump, 0);
- compat = rb_define_class_under(rb_cComplex, "compatible", rb_cObject);
+ compat = rb_define_class_under(rb_cComplex, "compatible", rb_cObject); /* :nodoc: */
rb_define_private_method(compat, "marshal_load", nucomp_marshal_load, 1);
rb_marshal_define_compat(rb_cComplex, compat, nucomp_dumper, nucomp_loader);
@@ -2268,6 +2209,8 @@ 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 d242e01657..d2373ed2b6 100644
--- a/configure.in
+++ b/configure.in
@@ -3,16 +3,20 @@ AC_INIT()
{
AC_CONFIG_AUX_DIR(tool)
-AC_PREREQ(2.60)
+AC_PREREQ(2.67)
AC_DEFUN([RUBY_PREREQ_AC],
[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]), [$1]), [-1],
AC_MSG_ERROR([Autoconf version ]$1[ or higher is required]$2))])
+AC_DISABLE_OPTION_CHECKING
+
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
# AC_EGREP_CPP with CFLAGS=-g on Darwin.
+#
+# TODO: remove this hack when AC_PREREQ() becomes 2.70 or later.
AS_CASE([$build_os], [darwin*], [
rm() {
rm_recursive=''
@@ -46,6 +50,11 @@ else
fi
AC_SUBST(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"],
[cygwin*], [
@@ -188,8 +197,6 @@ 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
@@ -222,37 +229,71 @@ 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)
AC_SUBST(RUBYW_BASE_NAME)
AC_SUBST(RUBY_VERSION_NAME, '${RUBY_BASE_NAME}-${ruby_version}')
-AC_DEFINE_UNQUOTED(RUBY_BASE_NAME, "${RUBY_BASE_NAME}" !<verconf>!)
-AC_DEFINE_UNQUOTED(RUBY_VERSION_NAME, RUBY_BASE_NAME"-"RUBY_LIB_VERSION !<verconf>!)
AC_CANONICAL_TARGET
+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.
+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_transform=
+AS_CASE("${os_version_style}",
+ [full|teeny], [],
+ [minor+0], [os_version_style_transform=['s/\([0-9]\.[0-9][0-9]*\)\.[0-9][.0-9]*$/\1.0/']],
+ [minor], [os_version_style_transform=['s/\([0-9]\.[0-9][0-9]*\)\.[0-9][.0-9]*$/\1/']],
+ [major+0], [os_version_style_transform=['s/\([0-9]\)\.[0-9][.0-9]*$/\1.0/']],
+ [major], [os_version_style_transform=['s/\([0-9]\)\.[0-9][.0-9]*$/\1/']],
+ [none], [os_version_style_transform=['s/[0-9]\.[0-9][.0-9]*$//']],
+ [AC_MSG_ERROR(unknown --with-os-version-style: $withval)])
+AS_IF([test -z "$target_alias" -a -n "$os_version_style_transform"],
+ [
+ target=`echo ${target} | sed "$os_version_style_transform"`
+ target_os=`echo ${target_os} | sed "$os_version_style_transform"`
+ ])
+
AC_DEFUN([RUBY_APPEND_OPTION],
- [# RUBY_APPEND_OPTION($1, $2)
+ [# RUBY_APPEND_OPTION($1)
AS_CASE([" [$]{$1-} "],
[*' $2 '*], [], [' '], [ $1="$2"], [ $1="[$]$1 $2"])])
AC_DEFUN([RUBY_APPEND_OPTIONS],
- [{ for rb_opt in $2; do # RUBY_APPEND_OPTIONS($1, $2)
+ [# RUBY_APPEND_OPTIONS($1)
+ for rb_opt in $2; do
AS_CASE([" [$]{$1-} "],
[*" [$]{rb_opt} "*], [], [' '], [ $1="[$]{rb_opt}"], [ $1="[$]$1 [$]{rb_opt}"])
- done; }])
+ done])
AC_DEFUN([RUBY_PREPEND_OPTION],
- [# RUBY_PREPEND_OPTION($1, $2)
+ [# RUBY_PREPEND_OPTION($1)
AS_CASE([" [$]{$1-} "],
[*' $2 '*], [], [' '], [ $1="$2"], [ $1="$2 [$]$1"])])
AC_DEFUN([RUBY_PREPEND_OPTIONS],
- [{ unset rb_opts; for rb_opt in $2; do # RUBY_PREPEND_OPTIONS($1, $2)
+ [# RUBY_PREPEND_OPTIONS($1)
+ unset rb_opts; for rb_opt in $2; do
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],
@@ -306,7 +347,6 @@ if test ${target_archs+set}; then
target=`echo $target | sed "s/^$target_cpu-/-/"`
target_alias=`echo $target_alias | sed "s/^$target_cpu-/-/"`
if test "${universal_binary-no}" = yes; then
- RUBY_PREREQ_AC(2.63, [ to compile universal binary])
AC_SUBST(try_header,try_compile)
target_cpu=universal
real_cross_compiling=$cross_compiling
@@ -392,6 +432,17 @@ RUBY_NACL
AS_CASE(["$host_os:$build_os"],
[darwin*:darwin*], [
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)
+ # Apple clang version 2.1 (tags/Apple/clang-163.7.1) (based on LLVM 3.0svn)
+ if ! $CC -E -xc - <<SRC >/dev/null; then
+ @%:@if defined __APPLE_CC__ && defined __clang_major__ && __clang_major__ < 3
+ @%:@error premature clang
+ @%:@endif
+SRC
+ AC_MSG_ERROR([clang version 3.0 or later is required])
+ fi
])
if test x"${build}" != x"${host}"; then
AC_CHECK_TOOL(CC, gcc)
@@ -409,7 +460,9 @@ AC_SUBST(LD)
if test "$GCC" = yes; then
linker_flag=-Wl,
: ${optflags=-O3}
- RUBY_APPEND_OPTIONS(XCFLAGS, ["-include ruby/config.h" "-include ruby/missing.h"])
+ gcc_major=`echo =__GNUC__ | $CC -E -xc - | sed '/^=/!d;s///'`
+ test -n "$gcc_major" || gcc_major=0
+ # RUBY_APPEND_OPTIONS(XCFLAGS, ["-include ruby/config.h" "-include ruby/missing.h"])
else
linker_flag=
fi
@@ -422,6 +475,16 @@ RUBY_CPPOUTFILE
AC_SUBST(OUTFLAG)
AC_SUBST(COUTFLAG)
+cc_version=
+for option in --version -v -V -qversion; do
+ cc_version_message=`$CC $option 2>&1`
+ cc_version_status=$?
+ AS_CASE($cc_version_status, [0], [:], [continue])
+ AS_CASE($cc_version_message, [*Warning*], [continue])
+ cc_version='$(CC) '$option
+done
+AC_SUBST(CC_VERSION, $cc_version)
+
RUBY_UNIVERSAL_ARCH
if test "$target_cpu" != "$host_cpu" -a "$GCC" = yes -a "$cross_compiling" = no -a "$universal_binary" = no; then
RUBY_DEFAULT_ARCH("$target_cpu")
@@ -531,13 +594,17 @@ AC_DEFUN([RUBY_DTRACE_POSTPROCESS],
[AC_CACHE_CHECK(whether $DTRACE needs post processing, rb_cv_prog_dtrace_g,
[
if {
- 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_provider.d <<_PROBES &&
+ provider conftest {
+ probe fire();
+ };
+_PROBES
+ $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 &&
+ $CC $CFLAGS $CPPFLAGS -c -o conftest.o conftest.c &&
$DTRACE -G -s conftest_provider.d conftest.o 2>/dev/null
}; then
rb_cv_prog_dtrace_g=yes
@@ -615,7 +682,35 @@ else
unset ac_c_werror_flag
fi])
-AC_DEFUN(RUBY_TRY_CFLAGS, [
+RUBY_WERROR_FLAG([
+ AC_MSG_CHECKING([whether CFLAGS is valid])
+ AC_TRY_COMPILE([], [],
+ [AC_MSG_RESULT(yes)],
+ [
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR([something wrong with CFLAGS="$CFLAGS"])
+ ]
+ )
+ 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([faild 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_MSG_CHECKING([whether ]$1[ is accepted as CFLAGS])
RUBY_WERROR_FLAG([
CFLAGS="[$]CFLAGS $1"
@@ -627,7 +722,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])
@@ -648,11 +743,16 @@ AC_ARG_ENABLE(werror,
AS_HELP_STRING([--disable-werror],
[don't make warnings into errors
even if a compiler support -Werror feature
- @<:@disabled by default unless development version@:>@]),
+ [[disabled by default unless development version]]]),
[particular_werror_flags=$enableval])
rb_cv_warnflags="$warnflags"
if test "$GCC:${warnflags+set}:no" = yes::no; then
+ if test $gcc_major -ge 4; then
+ extra_warning=-Werror=extra-tokens
+ else
+ extra_warning=
+ fi
for wflag in -Wno-unused-parameter -Wno-parentheses -Wno-long-long \
-Wno-missing-field-initializers \
-Wunused-variable \
@@ -661,6 +761,10 @@ if test "$GCC:${warnflags+set}:no" = yes::no; then
-Werror=declaration-after-statement \
-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
wflag=`echo x$wflag | sed 's/^x-Werror=/-W/;s/^x//'`
@@ -685,25 +789,27 @@ if test "$GCC:${warnflags+set}:no" = yes::no; then
rb_cv_warnflags="$warnflags"
warnflags=
fi
-if test "$GCC" = yes; then
- test "${debugflags+set}" || {RUBY_TRY_CFLAGS(-ggdb3, [debugflags=-ggdb3])}
- test "${debugflags+set}" || {RUBY_TRY_CFLAGS(-ggdb, [debugflags=-ggdb])}
- test "${debugflags+set}" || {RUBY_TRY_CFLAGS(-g3, [debugflags=-g3])}
+RUBY_TRY_CFLAGS(-Qunused-arguments, [RUBY_APPEND_OPTIONS(rb_cv_wsuppress_flags, -Qunused-arguments)])
+if test "$GCC" = yes; then
# -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|haiku], [
stack_protector=no
- ],
- [
+ ])
+ if test -z "${stack_protector+set}"; then
RUBY_TRY_CFLAGS(-fstack-protector, [stack_protector=yes], [stack_protector=no])
if test "x$stack_protector" = xyes; then
RUBY_TRY_LDFLAGS(-fstack-protector, [], [stack_protector=broken])
fi
- ])
+ fi
if test "x$stack_protector" = xyes; then
RUBY_APPEND_OPTION(XCFLAGS, -fstack-protector)
RUBY_APPEND_OPTION(XLDFLAGS, -fstack-protector)
@@ -727,14 +833,21 @@ if test "$GCC" = yes; then
],
[
# ANSI (no XCFLAGS because this is C only)
- RUBY_TRY_CFLAGS(-ansi -std=iso9899:199409, [
- RUBY_APPEND_OPTION(warnflags, -ansi -std=iso9899:199409)
- RUBY_APPEND_OPTION(strict_warnflags, -ansi -std=iso9899:199409)
- ])
+ 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
])
# suppress annoying -Wstrict-overflow warnings
RUBY_TRY_CFLAGS(-fno-strict-overflow, [RUBY_APPEND_OPTION(XCFLAGS, -fno-strict-overflow)])
+
+ test "${debugflags+set}" || {RUBY_TRY_CFLAGS(-ggdb3, [debugflags=-ggdb3])}
+ test "${debugflags+set}" || {RUBY_TRY_CFLAGS(-ggdb, [debugflags=-ggdb])}
+ test "${debugflags+set}" || {RUBY_TRY_CFLAGS(-g3, [debugflags=-g3])}
fi
test $ac_cv_prog_cc_g = yes && : ${debugflags=-g}
@@ -742,18 +855,14 @@ if test "$GCC" = ""; then
AS_CASE(["$target_os"],[aix*],[warnflags="$warnflags -qinfo=por" rb_cv_warnflags="$rb_cv_warnflags -qinfo=por"])
fi
if test "$GCC" = yes; then
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
- @%:@if !(defined __GNUC__ && __GNUC__ >= 4)
- @%:@error not GCC 4 or later
- >>>not GCC 4 or later<<<
- @%:@endif])],
- [visibility_option=yes], [visibility_option=no])
- if test "$visibility_option" = yes; then
+ if test "$gcc_major" -ge 4; then
RUBY_TRY_CFLAGS(-fvisibility=hidden, [visibility_option=yes], [visibility_option=no])
fi
AC_SUBST(WERRORFLAG, "-Werror")
if test "$visibility_option" = yes; then
RUBY_APPEND_OPTION(XCFLAGS, -fvisibility=hidden)
+ AC_DEFINE(RUBY_SYMBOL_EXPORT_BEGIN, [_Pragma("GCC visibility push(default)")])
+ AC_DEFINE(RUBY_SYMBOL_EXPORT_END, [_Pragma("GCC visibility pop")])
else
RUBY_TRY_LDFLAGS([-Wl,-unexported_symbol,_Init_*], [visibility_option=ld], [visibility_option=no])
fi
@@ -773,6 +882,18 @@ if test "$GCC" = yes; then
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|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\""
@@ -785,6 +906,7 @@ 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"],
@@ -832,7 +954,8 @@ AS_CASE(["$target_os"],
[macosx_10_5=yes], [macosx_10_5=no])
AC_MSG_RESULT($macosx_10_5)
if test $macosx_10_5 = yes; then
- ac_cv_header_ucontext_h=no
+ ac_cv_func_getcontext=no
+ ac_cv_func_setcontext=no
else
AC_DEFINE(BROKEN_SETREUID, 1)
AC_DEFINE(BROKEN_SETREGID, 1)
@@ -840,6 +963,7 @@ AS_CASE(["$target_os"],
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
AC_CACHE_CHECK(for broken crypt with 8bit chars, rb_cv_broken_crypt,
[AC_TRY_RUN([
#include <stdio.h>
@@ -876,7 +1000,7 @@ main()
if test -n "$codesign"; then
POSTLINK="test -z '\$(RUBY_CODESIGN)' || $codesign -s '\$(RUBY_CODESIGN)' -f \$@"
LINK_SO="$LINK_SO
-$POSTLINK"
+\$(POSTLINK)"
fi
AC_CHECK_HEADERS(crt_externs.h, [], [], [
#include <crt_externs.h>
@@ -897,7 +1021,7 @@ $POSTLINK"
AC_CHECK_FUNCS(cygwin_conv_path)
AC_LIBOBJ([langinfo])
],
-[mingw*], [ LIBS="-lshell32 -lws2_32 -limagehlp -lshlwapi $LIBS"
+[mingw*], [ LIBS="-lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi $LIBS"
ac_cv_header_a_out_h=no
ac_cv_header_pwd_h=no
ac_cv_header_utime_h=no
@@ -917,7 +1041,6 @@ $POSTLINK"
ac_cv_func_isnan=yes
ac_cv_func_finite=yes
ac_cv_func_link=yes
- ac_cv_func_fseeko=yes
ac_cv_lib_crypt_crypt=no
ac_cv_func_getpgrp_void=no
ac_cv_func_memcmp_working=yes
@@ -929,6 +1052,17 @@ $POSTLINK"
ac_cv_func_gmtime_r=yes
rb_cv_large_fd_select=yes
ac_cv_type_struct_timeval=yes
+ 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 <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_LIBOBJ([langinfo])
],
[os2-emx*], [ LIBS="-lm $LIBS"
@@ -943,15 +1077,13 @@ $POSTLINK"
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
],
-[bow], [ ac_cv_func_setitimer=no
- ],
-[superux*], [ ac_cv_func_setitimer=no
- ],
[nacl], [
LIBS="-lm $LIBS"
if test "${nacl_cv_build_variant}" = "newlib"; then
@@ -965,17 +1097,101 @@ $POSTLINK"
],
[ LIBS="-lm $LIBS"])
+AC_CHECK_LIB(crypt, crypt) # glibc (GNU/Linux, GNU/Hurd, GNU/kFreeBSD)
+AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
+AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
+AC_CHECK_LIB(socket, shutdown) # SunOS/Solaris
+
dnl Checks for header files.
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(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 xti.h netinet/in_systm.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)
+AC_CHECK_HEADERS( \
+ limits.h \
+ sys/file.h \
+ sys/ioctl.h \
+ sys/syscall.h \
+ fcntl.h \
+ sys/fcntl.h \
+ sys/param.h \
+ sys/select.h \
+ sys/time.h \
+ sys/times.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 \
+ sys/uio.h \
+ atomic.h \
+ malloc.h \
+ malloc_np.h \
+ malloc/malloc.h \
+ setjmpex.h \
+ sys/id.h
+)
+
+AC_ARG_WITH([gmp],
+ [AS_HELP_STRING([--without-gmp],
+ [disable GNU GMP to accelerate Bignum operations])],
+ [],
+ [with_gmp=yes])
+AS_IF([test "x$with_gmp" != xno],
+ [AC_CHECK_HEADERS(gmp.h)
+ AS_IF([test "x$ac_cv_header_gmp_h" != xno],
+ AC_CHECK_LIB([gmp], [__gmpz_init]))
+ with_gmp="$ac_cv_lib_gmp___gmpz_init"
+ AS_IF([test -z "$with_gmp"], [with_gmp=no])])
+
+AC_ARG_WITH([jemalloc],
+ [AS_HELP_STRING([--with-jemalloc],[use jemalloc allocator])],
+ [with_jemalloc=yes], [with_jemalloc=no])
+AS_IF([test "x$with_jemalloc" = xyes],[
+ AC_CHECK_LIB([jemalloc], [malloc_conf], [], [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
+ LIBS="-ljemalloc $LIBS"
+ ])
+ AS_IF([test "x$with_jemalloc" = xyes],
+ [
+ ac_cv_func_malloc_usable_size=yes
+ ],
+ [AC_MSG_ERROR([jemalloc requested but not found])
+ ])
+])
dnl check for large file stuff
mv confdefs.h confdefs1.h
@@ -985,13 +1201,25 @@ 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])
+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_posix_fadvise=no
+ ])
+ ])
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)])
@@ -1090,16 +1318,37 @@ 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)
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(for pri in $2; do
+ RUBY_WERROR_FLAG(RUBY_APPEND_OPTIONS(CFLAGS, $rb_cv_wsuppress_flags)
+ for pri in $2; do
AC_TRY_COMPILE(
[@%:@include <stdio.h>
@%:@include <stddef.h>
@@ -1126,6 +1375,11 @@ elif test "x$ac_cv_type___int64" = xyes; then
RUBY_CHECK_PRINTF_PREFIX(__int64, ll I64, LL)
fi
+dnl RUBY_CHECK_SIZEOF [typename] [if-signed] [if-unsigned] [included]
+AC_DEFUN([RUBY_CHECK_SIGNEDNESS], [dnl
+ AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT([$4])], [($1)-1 > 0])],
+ [$3], [$2])])
+
dnl RUBY_REPLACE_TYPE [typename] [default type] [macro type] [included]
AC_DEFUN([RUBY_REPLACE_TYPE], [dnl
AC_CHECK_TYPE([$1],
@@ -1138,10 +1392,7 @@ AC_DEFUN([RUBY_REPLACE_TYPE], [dnl
[*" signed "*], [ ],
[*" unsigned "*], [
u=U],
- [
- AC_COMPILE_IFELSE(
- [AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT([$4])], [($n)-1 > 0])],
- [u=U])])
+ [RUBY_CHECK_SIGNEDNESS($n, [], [u=U], [$4])])
if test x"$t" = x; then
for t in "long long" long int short; do
test -n "$u" && t="unsigned $t"
@@ -1166,7 +1417,9 @@ AC_DEFUN([RUBY_REPLACE_TYPE], [dnl
t=INT])
rb_cv_[$1]_convertible=${u}${t}])
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)
AC_DEFINE_UNQUOTED([$3]2NUM[(v)], [${rb_cv_[$1]_convertible}2NUM(v)])
AC_DEFINE_UNQUOTED(NUM2[$3][(v)], [NUM2${rb_cv_[$1]_convertible}(v)])
AC_DEFINE_UNQUOTED(PRI_[$3]_PREFIX,
@@ -1187,6 +1440,8 @@ RUBY_REPLACE_TYPE(rlim_t, [int long "long long"], RLIM, [
@%:@endif
@%:@include <sys/resource.h>
])
+RUBY_REPLACE_TYPE(off_t, [], OFFT)
+RUBY_REPLACE_TYPE(clockid_t, [], CLOCKID)
AC_CACHE_CHECK(for prototypes, rb_cv_have_prototypes,
[AC_TRY_COMPILE([int foo(int x) { return 0; }], [return foo(10);],
@@ -1293,11 +1548,16 @@ m4_ifval([$3], dnl
[AS_VAR_PUSHDEF([rbcv],[$3])], dnl
[AS_VAR_PUSHDEF([rbcv],[rb_cv_func_][$1])]dnl
)dnl
+m4_pushdef([attrib_code],[m4_bpatsubst([$1],["],[\\"])])
m4_ifval([$4], [rbcv_cond=["$4"]; test "$rbcv_cond" || unset rbcv_cond])
-AC_CACHE_CHECK(for [$1] function attribute, rbcv,
+AC_CACHE_CHECK(for m4_ifval([$2],[$2],[$1]) function attribute, rbcv,
[rbcv=x
RUBY_WERROR_FLAG([
-for mac in "__attribute__ (($1)) x" "x __attribute__ (($1))" "__declspec($1) x" x; do
+for mac in \
+ "__attribute__ ((attrib_code)) x" \
+ "x __attribute__ ((attrib_code))" \
+ "__declspec(attrib_code) 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})
@@ -1312,7 +1572,7 @@ done
if test "$rbcv" != x; then
RUBY_DEFINE_IF(m4_ifval([$4],[${rbcv_cond}]), attrib[(x)], $rbcv)
fi
-m4_ifval([$4], [unset rbcv_cond])dnl
+m4_ifval([$4], [unset rbcv_cond]) dnl
AS_VAR_POPDEF([attrib])dnl
AS_VAR_POPDEF([rbcv])dnl
])
@@ -1325,6 +1585,7 @@ 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("-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],
@@ -1335,18 +1596,20 @@ if test "$GCC" = yes; then
[rb_cv_gcc_function_alias=$a; break])
done])
if test "$rb_cv_gcc_function_alias" != no; then
+ AC_DEFINE(HAVE_ATTRIBUTE_FUNCTION_ALIAS)
AC_DEFINE_UNQUOTED([RUBY_ALIAS_FUNCTION_TYPE(type, prot, name, args)],
[type prot __attribute__(($rb_cv_gcc_function_alias(@%:@name)));])
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_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);
+ __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);
],
[rb_cv_gcc_atomic_builtins=yes],
[rb_cv_gcc_atomic_builtins=no])])
@@ -1354,10 +1617,24 @@ if test "$GCC" = yes; then
AC_DEFINE(HAVE_GCC_ATOMIC_BUILTINS)
fi
+ AC_CACHE_CHECK([for __sync builtins], [rb_cv_gcc_sync_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);
+ ],
+ [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)
+ fi
+
AC_CACHE_CHECK(for __builtin_unreachable, rb_cv_func___builtin_unreachable,
[RUBY_WERROR_FLAG(
- [AC_TRY_LINK([@%:@include <stdlib.h>],
- [exit(0); __builtin_unreachable();],
+ [AC_TRY_LINK([volatile int zero;],
+ [if (zero) __builtin_unreachable();],
[rb_cv_func___builtin_unreachable=yes],
[rb_cv_func___builtin_unreachable=no])
])
@@ -1382,15 +1659,27 @@ fi
RUBY_APPEND_OPTION(XCFLAGS, -DRUBY_EXPORT)
+AC_CACHE_CHECK(for function name string predefined identifier,
+ rb_cv_function_name_string,
+ [rb_cv_function_name_string=no
+ RUBY_WERROR_FLAG([
+ for func in __func__ __FUNCTION__; do
+ AC_TRY_LINK([@%:@include <stdio.h>],
+ [puts($func);],
+ [rb_cv_function_name_string=$func
+ break])
+ done
+ ])]
+)
+if test "$rb_cv_function_name_string" != no; then
+ AC_DEFINE_UNQUOTED(RUBY_FUNCTION_NAME_STRING, [$rb_cv_function_name_string])
+fi
+
dnl Check whether we need to define sys_nerr locally
AC_CHECK_DECLS([sys_nerr], [], [], [$ac_includes_default
@%:@include <errno.h>])
-AC_CHECK_LIB(crypt, crypt)
-AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
-AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
-AC_CHECK_LIB(socket, socketpair) # SunOS/Solaris
-AC_CHECK_LIB(rt, clock_gettime) # GNU/Linux
+AC_CHECK_DECLS([getenv])
AS_CASE(["$target_cpu"],
[alpha*|sh4|sh4el|sh4eb], [AS_CASE(["$target_os"::"$GCC"],
@@ -1410,6 +1699,8 @@ fi
AC_TYPE_SIZE_T
+RUBY_CHECK_SIGNEDNESS(size_t, [AC_MSG_ERROR(size_t is signed)], [],
+ [@%:@include <sys/types.h>])
RUBY_CHECK_SIZEOF(size_t, [int long void*], [], [@%:@include <sys/types.h>])
RUBY_CHECK_SIZEOF(ptrdiff_t, size_t, [], [@%:@include <stddef.h>])
RUBY_CHECK_PRINTF_PREFIX(size_t, z)
@@ -1430,6 +1721,7 @@ 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>
@@ -1438,6 +1730,24 @@ AC_CHECK_TYPES([struct timeval], [], [], [@%:@ifdef HAVE_TIME_H
@%:@include <sys/time.h>
@%:@endif])
+if test "${ac_cv_type_struct_timeval}" = yes; then
+ RUBY_CHECK_SIZEOF([struct timeval.tv_sec], [time_t long "long long"], [],
+ [@%:@ifdef HAVE_TIME_H
+@%:@include <time.h>
+@%:@endif
+@%:@ifdef HAVE_SYS_TIME_H
+@%:@include <sys/time.h>
+@%:@endif])
+ AS_CASE(${ac_cv_sizeof_struct_timeval_tv_sec},
+ [SIZEOF_INT], [t=int],
+ [SIZEOF_LONG], [t=long],
+ [SIZEOF_LONG_LONG], [t=LONG_LONG],
+ [t=])
+ if test "${t}" != ""; then
+ AC_DEFINE_UNQUOTED(TYPEOF_TIMEVAL_TV_SEC, [$t])
+ fi
+fi
+
AC_CHECK_TYPES([struct timespec], [], [], [@%:@ifdef HAVE_TIME_H
@%:@include <time.h>
@%:@endif
@@ -1478,6 +1788,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)
@@ -1518,8 +1829,12 @@ if test $rb_cv_stack_end_address != no; then
AC_DEFINE_UNQUOTED(STACK_END_ADDRESS, $rb_cv_stack_end_address)
fi
+# posix_memalign(memptr, alignment, size) implemented for OpenBSD 4.8 doesn't work if alignment > MALLOC_PAGESIZE.
+# [ruby-core:42158] https://bugs.ruby-lang.org/issues/5901
+# OpenBSD 5.2 fixed the problem. (src/lib/libc/stdlib/malloc.c:1.142)
+# MirOS #10semel has the problem but fixed in the repository. (src/lib/libc/stdlib/malloc.c:1.9)
AS_CASE(["$target_os"],
-[openbsd*], [
+[openbsd*|mirbsd*], [
AC_CACHE_CHECK(for heap align log on openbsd, rb_cv_page_size_log,
[rb_cv_page_size_log=no
for page_log in 12 13; do
@@ -1606,10 +1921,28 @@ AS_CASE(["$target_os"],[freebsd*],[
AC_DEFINE(BROKEN_CLOSE)
AC_REPLACE_FUNCS(close)
])
-AC_REPLACE_FUNCS(dup2 memmove strerror\
- strchr strstr crypt flock\
- isnan finite isinf hypot acosh erf tgamma lgamma_r cbrt \
- strlcpy strlcat ffs setproctitle)
+
+AC_REPLACE_FUNCS(acosh)
+AC_REPLACE_FUNCS(cbrt)
+AC_REPLACE_FUNCS(crypt)
+AC_REPLACE_FUNCS(dup2)
+AC_REPLACE_FUNCS(erf)
+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)
# for missing/setproctitle.c
AS_CASE(["$target_os"],
@@ -1630,20 +1963,233 @@ if test "$rb_cv_have_signbit" = yes; then
else
AC_LIBOBJ([signbit])
fi
-AC_CHECK_FUNCS(fmod killpg wait4 waitpid fork spawnv syscall __syscall chroot getcwd eaccess\
- truncate ftruncate ftello chsize times utimes utimensat fcntl lockf lstat\
- truncate64 ftruncate64 ftello64 fseeko fseeko64 \
- link symlink readlink readdir_r fsync fdatasync fchown posix_fadvise\
- setitimer setruid seteuid setreuid setresuid socketpair\
- setrgid setegid setregid setresgid issetugid pause lchown lchmod\
- getpgrp setpgrp getpgid setpgid initgroups getgroups setgroups\
- getpriority getrlimit setrlimit sysconf close getpwnam_r getgrnam_r\
- dlopen sigprocmask sigaction sigsetjmp _setjmp _longjmp\
- getsid setsid telldir seekdir fchmod cosh sinh tanh log2 round llabs\
- setuid setgid daemon select_large_fdset setenv unsetenv\
- mktime timegm gmtime_r clock_gettime gettimeofday poll ppoll\
- pread sendfile shutdown sigaltstack dl_iterate_phdr\
- dup dup3 pipe2 posix_memalign memalign ioctl)
+
+AC_FUNC_FORK
+
+AC_CHECK_FUNCS(__syscall)
+AC_CHECK_FUNCS(_longjmp) # used for AC_ARG_WITH(setjmp-type)
+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)
+AC_CHECK_FUNCS(endgrent)
+AC_CHECK_FUNCS(fchmod)
+AC_CHECK_FUNCS(fchown)
+AC_CHECK_FUNCS(fcntl)
+AC_CHECK_FUNCS(fdatasync)
+AC_CHECK_FUNCS(fmod)
+AC_CHECK_FUNCS(fsync)
+AC_CHECK_FUNCS(ftruncate)
+AC_CHECK_FUNCS(ftruncate64) # used for Win32 platform
+AC_CHECK_FUNCS(getcwd)
+AC_CHECK_FUNCS(getgidx)
+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)
+AC_CHECK_FUNCS(lchown)
+AC_CHECK_FUNCS(link)
+AC_CHECK_FUNCS(llabs)
+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(writev)
+AC_CHECK_FUNCS(memrchr)
+AC_CHECK_FUNCS(memmem)
+AC_CHECK_FUNCS(mktime)
+AC_CHECK_FUNCS(pipe2)
+AC_CHECK_FUNCS(poll)
+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(seekdir)
+AC_CHECK_FUNCS(select_large_fdset)
+AC_CHECK_FUNCS(sendfile)
+AC_CHECK_FUNCS(setegid)
+AC_CHECK_FUNCS(setenv)
+AC_CHECK_FUNCS(seteuid)
+AC_CHECK_FUNCS(setgid)
+AC_CHECK_FUNCS(setgroups)
+AC_CHECK_FUNCS(setpgid)
+AC_CHECK_FUNCS(setpgrp)
+AC_CHECK_FUNCS(setregid)
+AC_CHECK_FUNCS(setresgid)
+AC_CHECK_FUNCS(setresuid)
+AC_CHECK_FUNCS(setreuid)
+AC_CHECK_FUNCS(setrgid)
+AC_CHECK_FUNCS(setrlimit)
+AC_CHECK_FUNCS(setruid)
+AC_CHECK_FUNCS(setsid)
+AC_CHECK_FUNCS(setuid)
+AC_CHECK_FUNCS(shutdown)
+AC_CHECK_FUNCS(sigaction)
+AC_CHECK_FUNCS(sigaltstack)
+AC_CHECK_FUNCS(sigprocmask)
+AC_CHECK_FUNCS(sinh)
+AC_CHECK_FUNCS(spawnv)
+AC_CHECK_FUNCS(symlink)
+AC_CHECK_FUNCS(syscall)
+AC_CHECK_FUNCS(sysconf)
+AC_CHECK_FUNCS(tanh)
+AC_CHECK_FUNCS(telldir)
+AC_CHECK_FUNCS(timegm)
+AC_CHECK_FUNCS(times)
+AC_CHECK_FUNCS(truncate)
+AC_CHECK_FUNCS(truncate64) # used for Win32
+AC_CHECK_FUNCS(unsetenv)
+AC_CHECK_FUNCS(utimensat)
+AC_CHECK_FUNCS(utimes)
+AC_CHECK_FUNCS(wait4)
+AC_CHECK_FUNCS(waitpid)
+
+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([], [$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, [__builtin_choose_expr(0, 0, 0)])
+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)
+ ])
+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)])
+
+# Some platform need -lrt for clock_gettime, but the other don't.
+if test x"$ac_cv_func_clock_gettime" != xyes; then
+ # glibc 2.17 moves clock_* functions from librt to the main C library.
+ # http://sourceware.org/ml/libc-announce/2012/msg00001.html
+ AC_CHECK_LIB(rt, clock_gettime)
+ if test x"$ac_cv_lib_rt_clock_gettime" = xyes; then
+ AC_DEFINE(HAVE_CLOCK_GETTIME, 1)
+ fi
+fi
+AC_CHECK_FUNCS(clock_getres) # clock_getres should be tested after clock_gettime test including librt test.
AC_CACHE_CHECK(for unsetenv returns a value, rb_cv_unsetenv_return_value,
[AC_TRY_COMPILE([
@@ -1655,49 +2201,89 @@ if test "$rb_cv_unsetenv_return_value" = no; then
AC_DEFINE(VOID_UNSETENV)
fi
+# used for AC_ARG_WITH(setjmp-type)
+AC_CACHE_CHECK(for sigsetjmp as a macro or function, ac_cv_func_sigsetjmp,
+ [AC_TRY_COMPILE([
+#include <setjmp.h>
+], [sigjmp_buf env; sigsetjmp(env,1);],
+ 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_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_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])
])
+# we don't use _setjmp if _longjmp doesn't exist.
test x$ac_cv_func__longjmp = xno && ac_cv_func__setjmp=no
+AC_DEFUN([RUBY_SETJMP_TYPE], [
+RUBY_CHECK_BUILTIN_SETJMP
AC_MSG_CHECKING(for setjmp type)
+setjmp_suffix=
AC_ARG_WITH(setjmp-type,
AS_HELP_STRING([--with-setjmp-type], [select setjmp type]),
[
AS_CASE([$withval],
- [__builtin_setjmp], [ setjmp_prefix=__builtin_],
+ [__builtin_setjmp], [setjmp=__builtin_setjmp],
[_setjmp], [ setjmp_prefix=_],
[sigsetjmp], [ setjmp_prefix=sig],
[setjmp], [ setjmp_prefix=],
+ [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 = no; then
- AC_MSG_ERROR(${setjmp_prefix}setjmp is not available)
+ 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 test "$ac_cv_func___builtin_setjmp" = yes; then
+elif { AS_CASE("$ac_cv_func___builtin_setjmp", [yes*], [true], [false]); }; then
+ setjmp_cast=`expr "$ac_cv_func___builtin_setjmp" : "yes with cast (\(.*\))"`
setjmp_prefix=__builtin_
+ setjmp_suffix=
+elif test "$ac_cv_header_setjmpex_h:$ac_cv_func__setjmpex" = yes:yes; then
+ setjmp_prefix=
+ setjmp_suffix=ex
elif test "$ac_cv_func__setjmp" = yes; then
setjmp_prefix=_
+ setjmp_suffix=
elif test "$ac_cv_func_sigsetjmp" = yes; then
AS_CASE([$target_os],[solaris*|cygwin*],[setjmp_prefix=],[setjmp_prefix=sig])
+ setjmp_suffix=
else
setjmp_prefix=
+ setjmp_suffix=
fi
if test x$setjmp_prefix = xsig; then
setjmp_sigmask=yes
else
unset setjmp_sigmask
fi
-AC_MSG_RESULT(${setjmp_prefix}setjmp)
-AC_DEFINE_UNQUOTED([RUBY_SETJMP(env)], [${setjmp_prefix}setjmp(env${setjmp_sigmask+,0})])
-AC_DEFINE_UNQUOTED([RUBY_LONGJMP(env,val)], [${setjmp_prefix}longjmp(env,val)])
+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_DEFINE_UNQUOTED(RUBY_JMP_BUF, ${setjmp_sigmask+${setjmp_prefix}}jmp_buf)
+])
+# End of setjmp check.
AC_ARG_ENABLE(setreuid,
AS_HELP_STRING([--enable-setreuid], [use setreuid()/setregid() according to need even if obsolete]),
@@ -1843,7 +2429,7 @@ main()
],
rb_cv_localtime_overflow=yes,
rb_cv_localtime_overflow=no,
- rb_cv_localtime_overflow=yes)])
+ rb_cv_localtime_overflow=no)])
if test "$rb_cv_localtime_overflow" = no; then
AC_DEFINE(LOCALTIME_OVERFLOW_PROBLEM)
fi
@@ -1881,9 +2467,16 @@ main()
fi
if test "$ac_cv_func_getpgid" = no; then
+ # AC_FUNC_GETPGRP fails when cross-compiling with old autoconf.
+ # autoconf is changed between 2.52d and 2.52f?
+ # http://lists.gnu.org/archive/html/bug-gnu-utils/2001-09/msg00181.html
+ # "autoconf cleanup for AC_FUNC_GETPGRP and GETPGRP_VOID"
AC_FUNC_GETPGRP
fi
if test "$ac_cv_func_setpgid:$ac_cv_func_setpgrp" = no:yes; then
+ # AC_FUNC_SETPGRP fails when cross-compiling. (until autoconf 2.69?)
+ # https://lists.gnu.org/archive/html/bug-autoconf/2013-02/msg00002.html
+ # "AC_FUNC_SETPGRP fails to work properly when cross-compiling"
AC_FUNC_SETPGRP
fi
@@ -1912,98 +2505,12 @@ 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
+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>])
-AC_CACHE_CHECK([whether struct dirent.d_name is too small], rb_cv_sizeof_struct_dirent_too_small,
- [AC_COMPILE_IFELSE(
- [AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT([
-@%:@if defined _WIN32
-@%:@ error <<<struct direct in win32/dir.h has variable length d_name>>>
-@%:@elif defined HAVE_DIRENT_H
-@%:@ include <dirent.h>
-@%:@elif defined HAVE_DIRECT_H
-@%:@ include <direct.h>
-@%:@else
-@%:@ define dirent direct
-@%:@ if HAVE_SYS_NDIR_H
-@%:@ include <sys/ndir.h>
-@%:@ endif
-@%:@ if HAVE_SYS_DIR_H
-@%:@ include <sys/dir.h>
-@%:@ endif
-@%:@ if HAVE_NDIR_H
-@%:@ include <ndir.h>
-@%:@ endif
-@%:@endif
-@%:@include <stddef.h>
-@%:@define numberof(array) [(int)(sizeof(array) / sizeof((array)[0]))]
-struct dirent d;
-])],
- [offsetof(struct dirent, [d_name[numberof(d.d_name)]]) - offsetof(struct dirent, d_name) < 256])],
- [rb_cv_sizeof_struct_dirent_too_small=yes],
- [rb_cv_sizeof_struct_dirent_too_small=no])])
-if test "$rb_cv_sizeof_struct_dirent_too_small" = yes; then
- AC_DEFINE(SIZEOF_STRUCT_DIRENT_TOO_SMALL, 1)
-fi
-
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),
@@ -2020,7 +2527,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"],
@@ -2096,22 +2603,66 @@ if test x"$enable_pthread" = xyes; then
[root], [],
[c_r], [MAINLIBS="-pthread $MAINLIBS"],
[AS_CASE(["$target_os"],
- [openbsd*], [LIBS="-pthread $LIBS"],
+ [openbsd*|mirbsd*], [LIBS="-pthread $LIBS"],
[LIBS="-l$pthread_lib $LIBS"])])
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_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_sigmask pthread_setname_np)
if test "${host_os}" = "nacl"; then
ac_cv_func_pthread_attr_init=no
else
AC_CHECK_FUNCS(pthread_attr_init)
fi
+ 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
+ AC_DEFINE_UNQUOTED(SET_THREAD_NAME(name), pthread_setname_np${rb_cv_func_pthread_setname_np_arguments})
+ else
+ AC_DEFINE_UNQUOTED(SET_THREAD_NAME(name), (void)0)
+ fi
+ fi
fi
if test x"$ac_cv_header_ucontext_h" = xyes; then
if test x"$rb_with_pthread" = xyes; then
@@ -2119,7 +2670,7 @@ if test x"$ac_cv_header_ucontext_h" = xyes; then
fi
fi
-if test "$ac_cv_func_fork" = "yes" -a "$rb_with_pthread" = "yes"; then
+if test "$ac_cv_func_fork_works" = "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>
@@ -2272,9 +2823,6 @@ 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"
@@ -2285,7 +2833,7 @@ if test "$with_dln_a_out" != yes; 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"
@@ -2326,7 +2874,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,$(.TARGET)'
+ DLDFLAGS="$DLDFLAGS "'-Wl,-soname,$@'
else
test "$GCC" = yes && test "$rb_cv_prog_gnu_ld" = yes || LDSHARED='$(LD) -Bshareable'
fi
@@ -2337,7 +2885,6 @@ 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}
# /usr/local/include is always searched for
@@ -2381,8 +2928,7 @@ if test "$with_dln_a_out" != yes; then
DLDFLAGS="$DLDFLAGS -lroot glue-noinit.a init_term_dyn.o start_dyn.o"
],
[i586*], [
- : ${LDSHARED='$(LD) -shared'}
- DLDFLAGS="$DLDFLAGS -L/boot/develop/lib/x86 -lroot"
+ : ${LDSHARED='$(CC) -shared'}
])
: ${LIBPATHENV=LIBRARY_PATH}
rb_cv_dlopen=yes ],
@@ -2402,8 +2948,40 @@ if test "$with_dln_a_out" != yes; then
[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}${flag// /,}"
+ RUBY_TRY_LDFLAGS([$flag], [], [flag=])
+ if test "x$flag" != x; then
+ RUBY_APPEND_OPTIONS(DLDFLAGS, [$flag])
+ fi
+ done
+ ])
+ fi
+
+ if test "$enable_rpath" = yes; then
+ if test x"${RPATHFLAG}" = x; then
+ 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=])
+ if test "x${rpathflag}" != x; then
+ RPATHFLAG=" ${rpathflag}%1\$-s"
+ break
+ fi
+ done
+ fi
+ fi
fi
if test "${LDSHAREDXX}" = ""; then
AS_CASE(["${LDSHARED}"],
@@ -2427,43 +3005,97 @@ AC_SUBST(RPATHFLAG)
AC_SUBST(LIBPATHENV, "${LIBPATHENV-LD_LIBRARY_PATH}")
AC_SUBST(TRY_LINK)
-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"
- LDFLAGS="$LDFLAGS${LDFLAGS:+ }$val"
- DLDFLAGS="$DLDFLAGS${DLDFLAGS:+ }$val"
- ])
+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' ' '`
+ test x"${LDFLAGS}" = x || LDFLAGS="$LDFLAGS "
+ LDFLAGS="$LDFLAGS$val"
+ test x"${DLDFLAGS}" = x || DLDFLAGS="$DLDFLAGS "
+ DLDFLAGS="$DLDFLAGS$val"
+ LDFLAGS_OPTDIR="$val"
+fi
+AS_CASE(["$target_os"],
+[freebsd*], [
+ AC_CHECK_LIB([procstat], [procstat_open_sysctl])
+ ])
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])
+ fi],
[*-freebsd*|x86_64-netbsd*], [
AC_CHECK_HEADERS([execinfo.h])
if test "x$ac_cv_header_execinfo_h" = xyes; then
AC_CHECK_LIB([execinfo], [backtrace])
- execinfo_frame_pointer=no
- RUBY_TRY_CFLAGS(-fno-omit-frame-pointer, [execinfo_frame_pointer=yes])
- if test "x$execinfo_frame_pointer" = xyes; then
- # optflags must be manipulated very carefully. For the
- # later cflagspat/cxxflagspat substitution to work, CFLAGS
- # and CXXFLAGS must start exactly with the value of
- # optflags.
- CFLAGS="${CFLAGS# }"; CFLAGS="${CFLAGS#"$optflags "}"
- CXXFLAGS="${CXXFLAGS# }"; CXXFLAGS="${CXXFLAGS#"$optflags "}"
- RUBY_APPEND_OPTION(optflags, -fno-omit-frame-pointer)
- CFLAGS=" $optflags $CFLAGS"
- CXXFLAGS=" $optflags $CXXFLAGS"
- fi
+ AC_CHECK_LIB([unwind], [unw_backtrace])
fi])
AC_CHECK_FUNCS(backtrace)
+if test "x$ac_cv_func_backtrace" = xyes; then
+ AC_CACHE_CHECK(for broken backtrace, rb_cv_broken_backtrace,
+ [AC_TRY_RUN([
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <signal.h>
+#include <execinfo.h>
+
+#define TRACE_SIZE 256
+
+void sigsegv(int signum, siginfo_t *info, void *ctx){
+ void *trace[TRACE_SIZE];
+ int n = backtrace(trace, TRACE_SIZE);
+ if (n > 0) {
+ /*fprintf(stdout, "backtrace:%d\n",n);*/
+ } else {
+ _exit(EXIT_FAILURE);
+ }
+ _exit(EXIT_SUCCESS);
+}
+int
+main(void)
+{
+ 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;
+ }
+ ss.ss_size = SIGSTKSZ;
+ ss.ss_flags = 0;
+ if (sigaltstack(&ss, NULL) == -1) {
+ fprintf(stderr, "sigaltstack failed\n");
+ return EXIT_FAILURE;
+ }
+ struct sigaction sa;
+ memset(&sa, 0, sizeof(struct sigaction));
+ sigemptyset(&sa.sa_mask);
+ sa.sa_sigaction = sigsegv;
+ sa.sa_flags |= SA_SIGINFO;
+ sa.sa_flags |= SA_ONSTACK;
+ sigaction(SIGSEGV, &sa, NULL);
+ a[0] = 1;
+ return EXIT_SUCCESS;
+}
+],
+ rb_cv_broken_backtrace=no,
+ rb_cv_broken_backtrace=yes,
+ rb_cv_broken_backtrace=no)])
+ if test "$rb_cv_broken_backtrace" = yes; then
+ AC_DEFINE(BROKEN_BACKTRACE, 1)
+ fi
+fi
+
AC_ARG_WITH(valgrind,
AS_HELP_STRING([--without-valgrind],[disable valgrind memcheck support]),
[], with_valgrind=yes)
@@ -2514,7 +3146,6 @@ 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
@@ -2555,38 +3186,54 @@ 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])])
-if test x"$EXTSTATIC" = xstatic; then
+ [AS_CASE([$withval],[yes],[STATIC=;EXTSTATIC=static],[no],[],[EXTSTATIC="$withval"])])
+AS_CASE([",$EXTSTATIC,"], [,static,|*,enc,*], [
ENCOBJS='enc/encinit.$(OBJEXT) enc/libenc.$(LIBEXT) enc/libtrans.$(LIBEXT)'
EXTOBJS='ext/extinit.$(OBJEXT)'
AC_DEFINE_UNQUOTED(EXTSTATIC, 1)
-fi
+ AC_SUBST(ENCSTATIC, static)
+])
AC_SUBST(ENCOBJS)
AC_SUBST(EXTOBJS)
-AS_CASE(["$target_os"],
- dnl OS/2 environment w/ Autoconf 2.1x for EMX
- [os2-emx], [
- setup=Setup.emx
- ],
- [*djgpp*], [
- setup=Setup.dj
- ],
- [nacl], [
- setup=Setup.nacl
- ],
- [
- setup=Setup
- ])
-
+if test -f "$srcdir/ext/Setup.$target_os"; then
+ setup="Setup.$target_os"
+else
+ setup=
+ for file in "$srcdir"/ext/Setup.*; do
+ AS_CASE(["$file"], [*~|*.bak|*.orig|*.rej|*.tmp], [continue])
+ setup=`basename "$file"`
+ AS_CASE(["$target_os"], [`expr "$setup" : 'Setup.\(.*\)'`*], [break])
+ platform=`sed '/^option *platform */!d;s///;s/|/*|/g;q' "$file"`
+ if test "x$platform" != x; then
+ eval "AS_CASE([\"\$target_os\"], [$platform*], [break])"
+ fi
+ setup=
+ done
+ : ${setup:=Setup}
+fi
AC_SUBST(setup)
-test x"$prefix" = xNONE && prefix=$ac_default_prefix
-test x"${exec_prefix}" = xNONE && exec_prefix="$prefix"
-pat=`echo "${exec_prefix}" | tr -c '\012' .`'\(.*\)'
-for var in bindir libdir; do
+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
+ RUBY_EXEC_PREFIX="$prefix"
+else
+ RUBY_EXEC_PREFIX=$ac_default_prefix
+fi
+pat=`echo "${RUBY_EXEC_PREFIX}" | tr -c '\012' .`'\(.*\)'
+for var in bindir libdir rubylibprefix; do
eval val='"$'$var'"'
- AS_CASE(["$val"], ["${exec_prefix}"*], [val='${exec_prefix}'"`expr \"$val\" : \"$pat\"`"])
+ AS_CASE(["$val"], ["${RUBY_EXEC_PREFIX}"*], [val='${exec_prefix}'"`expr \"$val\" : \"$pat\"`"])
eval $var='"$val"'
done
@@ -2654,6 +3301,18 @@ AS_CASE(["$target_os"],
DLDLIBS="$DLDLIBS -lc"
])
+AC_ARG_ENABLE(multiarch,
+ AS_HELP_STRING([--enable-multiarch], [enable multiarch compatible directories]),
+ [multiarch=], [unset multiarch])
+if test ${multiarch+set}; then
+ AC_DEFINE(ENABLE_MULTIARCH)
+fi
+
+archlibdir='${libdir}/${arch}'
+sitearchlibdir='${libdir}/${sitearch}'
+archincludedir='${includedir}/${arch}'
+sitearchincludedir='${includedir}/${sitearch}'
+
AC_ARG_WITH(soname,
AS_HELP_STRING([--with-soname=SONAME], [base name of shared library]),
[RUBY_SO_NAME=$withval], [RUBY_SO_NAME='$(RUBY_BASE_NAME)'])
@@ -2667,7 +3326,7 @@ ENABLE_SHARED=no
AC_ARG_ENABLE(shared,
AS_HELP_STRING([--enable-shared], [build a shared library for Ruby]),
[enable_shared=$enableval])
-libprefix='$(libdir)'
+libprefix=${multiarch+'$(archlibdir)'}${multiarch-'$(libdir)'}
LIBRUBY_RELATIVE=${load_relative-no}
AS_CASE("$enable_shared", [yes], [
LIBRUBY='$(LIBRUBY_SO)'
@@ -2686,6 +3345,7 @@ AS_CASE("$enable_shared", [yes], [
AS_CASE(["$libdir"], ['${exec_prefix}/'*], [libdir_basename=`basename "$libdir"`])
fi
AC_DEFINE_UNQUOTED(LIBDIR_BASENAME, ["${libdir_basename}"])
+ libdir_basename="${libdir_basename}"${multiarch+'/${arch}'}
AS_CASE(["$target_os"],
[freebsd*|dragonfly*], [],
@@ -2706,7 +3366,8 @@ AS_CASE("$enable_shared", [yes], [
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
- LIBRUBY_RPATHFLAGS="'-Wl,-rpath,\$\${ORIGIN}/../${libdir_basename}'"
+ libprefix="'\$\${ORIGIN}/../${libdir_basename}'"
+ LIBRUBY_RPATHFLAGS="-Wl,-rpath,${libprefix}"
LIBRUBY_RELATIVE=yes
fi
],
@@ -2728,7 +3389,7 @@ AS_CASE("$enable_shared", [yes], [
LIBRUBY_ALIASES=""
fi
],
- [openbsd*], [
+ [openbsd*|mirbsd*], [
SOLIBS='$(LIBS)'
LIBRUBY_SO='lib$(RUBY_SO_NAME).so.$(MAJOR).'`expr ${MINOR} \* 10 + ${TEENY}`
],
@@ -2776,6 +3437,7 @@ AS_CASE("$enable_shared", [yes], [
LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "' $(XLDFLAGS)'
LIBRUBY_SO='lib$(RUBY_SO_NAME).dylib'
LIBRUBY_ALIASES='lib$(RUBY_BASE_NAME).$(MAJOR).$(MINOR).dylib lib$(RUBY_INSTALL_NAME).dylib'
+ SOLIBS='$(LIBS)'
],
[interix*], [
LIBRUBYARG_SHARED='-L. -L${libdir} -l$(RUBY_SO_NAME)'
@@ -2787,7 +3449,9 @@ AS_CASE("$enable_shared", [yes], [
LIBRUBYARG_SHARED=
# enable PIE if possible
- pie=
+ AC_ARG_ENABLE(pie,
+ AS_HELP_STRING([--disable-pie], [disable PIE feature]),
+ [pie=$enableval], [pie=])
AS_CASE(["$target_os"],
[haiku], [
# gcc supports PIE, but doesn't work correctly in Haiku
@@ -2820,7 +3484,13 @@ AS_CASE("$enable_shared", [yes], [
])
if test "$enable_rpath" = yes; then
test -z "$LIBRUBY_RPATHFLAGS" || LIBRUBY_RPATHFLAGS="$LIBRUBY_RPATHFLAGS "
- LIBRUBY_RPATHFLAGS="$LIBRUBY_RPATHFLAGS${linker_flag}-R ${linker_flag}${libprefix} -L\$(libdir)"
+ 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}"
LIBRUBYARG_SHARED="$LIBRUBY_RPATHFLAGS $LIBRUBYARG_SHARED"
LIBRUBYARG_STATIC="$LIBRUBY_RPATHFLAGS $LIBRUBYARG_STATIC"
fi
@@ -2882,6 +3552,7 @@ AC_SUBST(DTRACE_OBJ)
AC_SUBST(DTRACE_GLOMMED_OBJ)
AC_SUBST(LIBRUBY_A_OBJS)
+RUBY_SETJMP_TYPE
}
{ # build section
@@ -2896,7 +3567,7 @@ AC_ARG_ENABLE(install-rdoc,
[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=yes])
+ [install_capi=$enableval], [install_capi=no])
if test "$install_doc" != no; then
if test "$install_rdoc" != no; then
@@ -2948,6 +3619,8 @@ AS_CASE(["$target_os"],
],
[darwin*], [
RUBY_APPEND_OPTION(CFLAGS, -pipe)
+ RUBY_APPEND_OPTION(XLDFLAGS, [-framework CoreFoundation])
+ RUBY_APPEND_OPTION(LIBRUBYARG_STATIC, [-framework CoreFoundation])
],
[os2-emx], [
AC_LIBOBJ([os2])
@@ -3023,6 +3696,10 @@ AS_CASE(["$target_os"],
[nacl], [
FIRSTMAKEFILE=GNUmakefile:nacl/GNUmakefile.in
])
+
+AS_CASE(["$with_gmp: $SOLIBS "], [no:* | *' -lgmp '*|*' $(LIBS) '*], [],
+ [SOLIBS="-lgmp $SOLIBS"])
+
MINIOBJS="$MINIDLNOBJ"
AS_CASE(["$THREAD_MODEL"],
@@ -3044,10 +3721,7 @@ AS_CASE(["$FIRSTMAKEFILE"], [*GNUmakefile:*], [gnumake=yes], [
rm -fr conftest.dir
AS_CASE(["$gnumake"],
[*yes*], [
- echo '@%:@ -*- makefile -*-' > GNUmakefile
- echo 'override MFLAGS := $(filter-out -j%,$(MFLAGS))' >> GNUmakefile
- echo "include Makefile" >> GNUmakefile
- echo "-include uncommon.mk" >> GNUmakefile
+ FIRSTMAKEFILE=GNUmakefile:template/GNUmakefile.in
gnumake=yes],
[
gnumake=no])
@@ -3104,9 +3778,13 @@ 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, [
+if test "$ac_cv_func_memmem" = yes; then
AC_CACHE_CHECK(for broken memmem, rb_cv_broken_memmem, [
AC_TRY_RUN([
#include <string.h>
@@ -3136,10 +3814,8 @@ main()
rb_cv_broken_memmem=yes,
rb_cv_broken_memmem=yes)
])
- if test "$rb_cv_broken_memmem" = no; then
- AC_DEFINE(HAVE_MEMMEM, 1)
- fi
-])
+ test x"$rb_cv_broken_memmem" = xyes && ac_cv_func_memmem=no
+fi
CPPFLAGS="$CPPFLAGS "'$(DEFS)'
@@ -3159,7 +3835,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
@@ -3196,7 +3872,9 @@ AC_SUBST(MINIOBJS)
AC_SUBST(THREAD_MODEL)
AC_SUBST(PLATFORM_DIR)
-MAKEFILES="Makefile `echo $FIRSTMAKEFILE | sed 's/:.*//'`"
+firstmf=`echo $FIRSTMAKEFILE | sed 's/:.*//'`
+firsttmpl=`echo $FIRSTMAKEFILE | sed 's/.*://'`
+MAKEFILES="Makefile $firstmf"
MAKEFILES="`echo $MAKEFILES`"
AC_SUBST(MAKEFILES)
@@ -3215,76 +3893,6 @@ AS_CASE(["$target_os"],
rubyw_install_name='$(RUBYW_INSTALL_NAME)'
])
-AC_ARG_ENABLE(multiarch,
- AS_HELP_STRING([--enable-multiarch], [enable multiarch compatible directories]),
- [multiarch=], [unset multiarch])
-
-archlibdir='${libdir}/${arch}'
-sitearchlibdir='${libdir}/${sitearch}'
-archincludedir='${includedir}/${arch}'
-sitearchincludedir='${includedir}/${sitearch}'
-
-shvar_to_cpp() {
- var="$1" val="$2"
- exec_prefix_pat="`echo \"${exec_prefix}\" | sed 's/\\./\\\\./g'`"
- arch_pat="`echo \"${arch}\" | sed 's/\\./\\\\./g'`"
- sitearch_pat="`echo \"${sitearch}\" | sed 's/\\./\\\\./g'`"
- val="`echo '\"'\"${val}\"'\"' |
- sed \
- -e 's/\${\([[A-Z][A-Z_]]*\)}/\"\1\"/g' \
- -e 's|\${sitearchlibdir}|'\"${sitearchlibdir}|g\" \
- -e 's|\${sitearchincludedir}|'\"${sitearchincludedir}|g\" \
- -e 's|\${archlibdir}|'\"${archlibdir}|g\" \
- -e 's|\${archincludedir}|'\"${archincludedir}|g\" \
- -e 's|\${libdir}|'\"${libdir}|g\" \
- -e 's/\${ruby_version}/\"RUBY_LIB_VERSION\"/g' \
- -e 's/\${arch}/\"arch\"/g' \
- -e 's/\${sitearch}/\"arch\"/g' \
- -e 's/\${vendorarchdir}/\"RUBY_VENDOR_ARCH_LIB\"/g' \
- -e 's/\${sitearchdir}/\"RUBY_SITE_ARCH_LIB\"/g' \
- -e 's/\${vendorlibdir}/\"RUBY_VENDOR_LIB2\"/g' \
- -e 's/\${sitelibdir}/\"RUBY_SITE_LIB2\"/g' \
- -e 's/\${vendordir}/\"RUBY_VENDOR_LIB\"/g' \
- -e 's/\${sitedir}/\"RUBY_SITE_LIB\"/g' \
- -e 's/\${rubylibdir}/\"RUBY_LIB\"/g' \
- -e 's/\${rubylibprefix}/\"RUBY_LIB_PREFIX\"/g' \
- -e 's/\${rubyarchprefix}/\"RUBY_ARCH_PREFIX_FOR(arch)\"/g' \
- -e 's/\${rubysitearchprefix}/\"RUBY_SITEARCH_PREFIX_FOR(arch)\"/g' \
- -e 's/\${exec_prefix}/\"RUBY_EXEC_PREFIX\"/g' \
- -e \"s|${exec_prefix_pat}/|\"'\"RUBY_EXEC_PREFIX\"/|g' \
- -e \"s|${arch_pat}|\"'\"arch\"|g' \
- -e \"s|${sitearch_pat}|\"'\"sitearch\"|g' \
- -e 's|^\\\"NONE/|RUBY_EXEC_PREFIX\\\"/|' \
- -e 's|^\\\"NONE\\\"|\\\"'\"${prefix}\"'\\\"|' \
- -e 's/^\\\"\\\"\(.\)/\1/;s/\(.\)\\\"\\\"$/\1/'
- `"
- eval $var='"$val"'
-}
-
-unexpand_shvar() {
- var=$1 n="" v="" expr=""
- shift
- test "$#" -eq 0 && return
- for n do
- eval v='"$'$n'"'
- v="`echo \"$v\" | sed -e ['s/${[^${}\"]*}/\"&\"/g'] -e ['s/[][$|.\\?*]/\\\\&/g']`"
- if test -n "$v"; then
- expr=["${expr};s|"'\("[^$"]*\)'"$v|\\1\${$n}\"|g"]
- AS_CASE(["$v"], [*'${'*'}'*], [expr=["$expr;s|$v|\"\${$n}\"|g"]])
- fi
- done
- expr=['s/${[^${}"]*}/"&"/g;'"${expr};"'s/"\(\${[^${}"]*}\)"/\1/g']
- eval $var='"`echo \"\\\"${'$var'}\\\"\" | sed \"$expr;s/\\\"//g\"`"'
-}
-
-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}'}
@@ -3331,9 +3939,13 @@ if test ${RUBY_LIB_VERSION_STYLE+set}; then
test -f verconf.h || > verconf.h
ruby_version="`$CPP -I. -I"${srcdir}" -I"${srcdir}/include" conftest.c | sed '/^ruby_version=/!d;s/ //g'`"
eval $ruby_version
+elif test -z "${ruby_version}"; then
+ AC_MSG_ERROR([No ruby version, No place for bundled libraries])
else
RUBY_LIB_VERSION="\"${ruby_version}\""
fi
+AC_SUBST(RUBY_LIB_VERSION_STYLE)
+AC_SUBST(RUBY_LIB_VERSION)
AC_ARG_WITH(sitedir,
AS_HELP_STRING([--with-sitedir=DIR], [site libraries in DIR [[RUBY_LIB_PREFIX/site_ruby]], "no" to disable site directory]),
@@ -3342,7 +3954,7 @@ AC_ARG_WITH(sitedir,
sitelibdir='${sitedir}/${ruby_version}'
AC_ARG_WITH(sitearchdir,
- AS_HELP_STRING([--with-arch-sitedir=DIR],
+ AS_HELP_STRING([--with-sitearchdir=DIR],
[architecture dependent site libraries in DIR [[SITEDIR/SITEARCH]], "no" to disable site directory]),
[sitearchdir=$withval],
[sitearchdir=${multiarch+'${rubysitearchprefix}/site_ruby/${ruby_version}'}${multiarch-'${sitelibdir}/${sitearch}'}])
@@ -3354,59 +3966,19 @@ AC_ARG_WITH(vendordir,
vendorlibdir='${vendordir}/${ruby_version}'
AC_ARG_WITH(vendorarchdir,
- AS_HELP_STRING([--with-arch-vendordir=DIR],
+ AS_HELP_STRING([--with-vendorarchdir=DIR],
[architecture dependent vendor libraries in DIR [[VENDORDIR/SITEARCH]], "no" to disable vendor directory]),
[vendorarchdir=$withval],
[vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby/${ruby_version}'}${multiarch-'${vendorlibdir}/${sitearch}'}])
-unexpand_shvar rubylibprefix exec_prefix libdir RUBY_BASE_NAME
-unexpand_shvar rubyarchprefix exec_prefix libdir arch RUBY_BASE_NAME archlibdir rubylibprefix
-unexpand_shvar rubysitearchprefix exec_prefix libdir sitearch arch RUBY_BASE_NAME archlibdir sitearchlibdir rubylibprefix
if test "${LOAD_RELATIVE+set}"; then
AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE)
- RUBY_EXEC_PREFIX='""'
-else
- shvar_to_cpp RUBY_EXEC_PREFIX "${exec_prefix}"
-fi
-shvar_to_cpp RUBY_LIB_PREFIX "${rubylibprefix}"
-shvar_to_cpp RUBY_ARCH_PREFIX_FOR "${rubyarchprefix}"
-shvar_to_cpp RUBY_SITEARCH_PREFIX_FOR "${rubysitearchprefix}"
-shvar_to_cpp RIDIR "${ridir}"
-unexpand_shvar exec_prefix prefix
-
-if test ${RUBY_LIB_VERSION_STYLE+set}; then
- AC_DEFINE_UNQUOTED(RUBY_LIB_VERSION_STYLE, $RUBY_LIB_VERSION_STYLE !<verconf>!)
-else
- AC_DEFINE_UNQUOTED(RUBY_LIB_VERSION, [$RUBY_LIB_VERSION] !<verconf>!)
+ RUBY_EXEC_PREFIX=''
fi
-AC_DEFINE_UNQUOTED(RUBY_EXEC_PREFIX, ${RUBY_EXEC_PREFIX})
-AC_DEFINE_UNQUOTED(RUBY_LIB_PREFIX, ${RUBY_LIB_PREFIX} !<verconf>!)
-AC_DEFINE_UNQUOTED(RUBY_ARCH_PREFIX_FOR(arch), ${RUBY_ARCH_PREFIX_FOR} !<verconf>!)
-AC_DEFINE_UNQUOTED(RUBY_SITEARCH_PREFIX_FOR(arch), ${RUBY_SITEARCH_PREFIX_FOR} !<verconf>!)
-shvar_to_cpp RUBY_LIB "${rubylibdir}"
-if test "x${RUBY_LIB}" != 'xRUBY_LIB_PREFIX"/"RUBY_LIB_VERSION'; then
- AC_DEFINE_UNQUOTED(RUBY_LIB, ${RUBY_LIB} !<verconf>!)
-fi
-shvar_to_cpp RUBY_ARCH_LIB_FOR "${rubyarchdir}"
-AC_DEFINE_UNQUOTED(RUBY_ARCH_LIB_FOR(arch), ${RUBY_ARCH_LIB_FOR} !<verconf>!)
-if test "x$sitedir" = xno; then
- AC_DEFINE(NO_RUBY_SITE_LIB, [] !<verconf>!)
-else
- shvar_to_cpp RUBY_SITE_LIB "${sitedir}"
- AC_DEFINE_UNQUOTED(RUBY_SITE_LIB, ${RUBY_SITE_LIB} !<verconf>!)
- shvar_to_cpp RUBY_SITE_ARCH_LIB_FOR "${sitearchdir}"
- AC_DEFINE_UNQUOTED(RUBY_SITE_ARCH_LIB_FOR(arch), ${RUBY_SITE_ARCH_LIB_FOR} !<verconf>!)
-fi
-if test "x$vendordir" = xno; then
- AC_DEFINE(NO_RUBY_VENDOR_LIB, [] !<verconf>!)
-else
- shvar_to_cpp RUBY_VENDOR_LIB "${vendordir}"
- AC_DEFINE_UNQUOTED(RUBY_VENDOR_LIB, ${RUBY_VENDOR_LIB} !<verconf>!)
- shvar_to_cpp RUBY_VENDOR_ARCH_LIB_FOR "${vendorarchdir}"
- AC_DEFINE_UNQUOTED(RUBY_VENDOR_ARCH_LIB_FOR(arch), ${RUBY_VENDOR_ARCH_LIB_FOR} !<verconf>!)
-fi
+AC_SUBST(RUBY_EXEC_PREFIX)
+AC_SUBST(libdirname, ${multiarch+arch}libdir)
AC_SUBST(archlibdir)dnl
AC_SUBST(sitearchlibdir)dnl
AC_SUBST(archincludedir)dnl
@@ -3423,16 +3995,12 @@ AC_SUBST(vendordir)dnl
AC_SUBST(vendorlibdir)dnl
AC_SUBST(vendorarchdir)dnl
-configure_args=$ac_configure_args
-AC_SUBST(configure_args)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__ !<verconf>!)
+ AC_DEFINE_UNQUOTED(RUBY_PLATFORM_CPU, __ARCHITECTURE__)
else
for archs in ${universal_archnames}; do
cpu=`echo $archs | sed 's/.*=//'`
@@ -3444,24 +4012,23 @@ if test "${universal_binary-no}" = yes ; then
test "$ac_cv_type_long_long" = yes && ints="'long long' $ints"
AC_SUBST(UNIVERSAL_ARCHNAMES, "${universal_archnames}")
AC_SUBST(UNIVERSAL_INTS, "${ints}")
- AC_DEFINE_UNQUOTED(RUBY_PLATFORM_OS, "${target_os}" !<verconf>!)
- AC_DEFINE_UNQUOTED(RUBY_ARCH, "universal-"RUBY_PLATFORM_OS !<verconf>!)
- AC_DEFINE_UNQUOTED(RUBY_PLATFORM, "universal."RUBY_PLATFORM_CPU"-"RUBY_PLATFORM_OS !<verconf>!)
+ AC_DEFINE_UNQUOTED(RUBY_PLATFORM_OS, "${target_os}")
+ AC_DEFINE_UNQUOTED(RUBY_ARCH, "universal-"RUBY_PLATFORM_OS)
+ AC_DEFINE_UNQUOTED(RUBY_PLATFORM, "universal."RUBY_PLATFORM_CPU"-"RUBY_PLATFORM_OS)
else
arch="${target_cpu}-${target_os}"
- AC_DEFINE_UNQUOTED(RUBY_PLATFORM, "${arch}" !<verconf>!)
+ AC_DEFINE_UNQUOTED(RUBY_PLATFORM, "${arch}")
fi
unset sitearch
AS_CASE(["$target_os"],[mingw*],[sitearch="$target_cpu-$rb_cv_msvcrt"])
-test ${sitearch+set} && AC_DEFINE_UNQUOTED(RUBY_SITEARCH, "${sitearch}" !<verconf>!)
: ${sitearch='${arch}'}
AC_ARG_WITH(search-path,
AS_HELP_STRING([--with-search-path=DIR], [specify the additional search path]),
[search_path=$withval])
if test "$search_path" != ""; then
- AC_DEFINE_UNQUOTED(RUBY_SEARCH_PATH,"$search_path" !<verconf>!)
+ AC_SUBST(RUBY_SEARCH_PATH, $search_path)
fi
AC_ARG_WITH(rubyhdrdir,
@@ -3470,7 +4037,7 @@ AC_ARG_WITH(rubyhdrdir,
[rubyhdrdir='${includedir}/${RUBY_VERSION_NAME}'])
AC_ARG_WITH(rubyarchhdrdir,
- AS_HELP_STRING([--with-arch-rubyhdrdir=DIR],
+ AS_HELP_STRING([--with-rubyarchhdrdir=DIR],
[architecture dependent core headers in DIR [[$(rubyhdrdir)/$(arch)]]]),
[rubyarchhdrdir=$withval],
[rubyarchhdrdir=${multiarch+'${archincludedir}/${RUBY_VERSION_NAME}'}${multiarch-'${rubyhdrdir}/${arch}'}])
@@ -3481,7 +4048,7 @@ AC_ARG_WITH(sitehdrdir,
[sitehdrdir='${rubyhdrdir}/site_ruby'])
AC_ARG_WITH(sitearchhdrdir,
- AS_HELP_STRING([--with-arch-sitehdrdir=DIR],
+ AS_HELP_STRING([--with-sitearchhdrdir=DIR],
[architecture dependent core site headers in DIR [[RUBYHDRDIR/site_ruby]]]),
[sitearchhdrdir=$withval],
[sitearchhdrdir=${multiarch+'${sitearchincludedir}/${RUBY_VERSION_NAME}/site_ruby'}${multiarch-'${sitehdrdir}/${sitearch}'}])
@@ -3492,7 +4059,7 @@ AC_ARG_WITH(vendorhdrdir,
[vendorhdrdir='${rubyhdrdir}/vendor_ruby'])
AC_ARG_WITH(vendorarchhdrdir,
- AS_HELP_STRING([--with-arch-vendorhdrdir=DIR],
+ AS_HELP_STRING([--with-vendorarchhdrdir=DIR],
[architecture dependent core vendor headers in DIR [[RUBYHDRDIR/vendor_ruby]]]),
[vendorarchhdrdir=$withval],
[vendorarchhdrdir=${multiarch+'${sitearchincludedir}/${RUBY_VERSION_NAME}/vendor_ruby'}${multiarch-'${vendorhdrdir}/${sitearch}'}])
@@ -3539,11 +4106,10 @@ guard=INCLUDE_RUBY_CONFIG_H
{
echo "#ifndef $guard"
echo "#define $guard 1"
- grep -v "^#define PACKAGE_" confdefs.h | grep -v ' !<verconf>!$'
+ grep -v "^#define PACKAGE_" confdefs.h
echo "#endif /* $guard */"
} | tr -d '\015' |
${srcdir}/tool/ifchange "${config_h}" -
-sed -n 's/ !<verconf>!$//p' confdefs.h | ${srcdir}/tool/ifchange verconf.h -
tr -d '\015' < largefile.h > confdefs.h
rm largefile.h
@@ -3572,7 +4138,9 @@ AC_MSG_RESULT($PACKAGE library version = $ruby_version)
AS_CASE([" $CPP "], [*" $CC "*], [CPP=`echo " $CPP " | sed "s| $CC |"' $(CC) |;s/^ *//;s/ *$//'`])
-AC_CONFIG_FILES($FIRSTMAKEFILE)
+if test x"$firstmf" != x; then
+ AC_CONFIG_FILES($firstmf:$firsttmpl, [], [firstmf="$firstmf" firsttmpl="$firsttmpl"])
+fi
AC_CONFIG_FILES(Makefile, [
tmpmk=confmk$$.tmp
{
@@ -3592,6 +4160,7 @@ 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
@@ -3623,6 +4192,11 @@ AC_ARG_WITH([ruby-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 9354241961..8c854bfffa 100644
--- a/constant.h
+++ b/constant.h
@@ -18,13 +18,13 @@ typedef enum {
typedef struct rb_const_entry_struct {
rb_const_flag_t flag;
- VALUE value; /* should be mark */
- VALUE file;
int line;
+ const VALUE value; /* should be mark */
+ const VALUE file; /* should be mark */
} rb_const_entry_t;
-VALUE rb_mod_private_constant(int argc, VALUE *argv, VALUE obj);
-VALUE rb_mod_public_constant(int argc, VALUE *argv, VALUE obj);
+VALUE rb_mod_private_constant(int argc, const VALUE *argv, VALUE obj);
+VALUE rb_mod_public_constant(int argc, const 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);
@@ -32,5 +32,6 @@ 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 e1c5c8953e..2ff2cbb98c 100644
--- a/cont.c
+++ b/cont.c
@@ -89,24 +89,28 @@ enum context_type {
typedef struct rb_context_struct {
enum context_type type;
- VALUE self;
int argc;
+ VALUE self;
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
- VALUE *machine_stack;
- VALUE *machine_stack_src;
+ struct {
+ VALUE *stack;
+ VALUE *stack_src;
+ size_t stack_size;
#ifdef __ia64
- VALUE *machine_register_stack;
- VALUE *machine_register_stack_src;
- int machine_register_stack_size;
+ VALUE *register_stack;
+ VALUE *register_stack_src;
+ int register_stack_size;
#endif
+ } machine;
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;
enum fiber_status {
@@ -116,13 +120,13 @@ enum fiber_status {
};
#if FIBER_USE_NATIVE && !defined(_WIN32)
-#define MAX_MAHINE_STACK_CACHE 10
+#define MAX_MACHINE_STACK_CACHE 10
static int machine_stack_cache_index = 0;
typedef struct machine_stack_cache_struct {
void *ptr;
size_t size;
} machine_stack_cache_t;
-static machine_stack_cache_t machine_stack_cache[MAX_MAHINE_STACK_CACHE];
+static machine_stack_cache_t machine_stack_cache[MAX_MACHINE_STACK_CACHE];
static machine_stack_cache_t terminated_machine_stack;
#endif
@@ -130,19 +134,25 @@ typedef struct rb_fiber_struct {
rb_context_t cont;
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 transfered;
+ struct rb_fiber_struct *prev_fiber;
+ struct rb_fiber_struct *next_fiber;
#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;
@@ -181,16 +191,16 @@ 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_localtion(cont->vm_stack,
+ rb_gc_mark_locations(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 */
@@ -198,15 +208,15 @@ cont_mark(void *ptr)
rb_fiber_t *fib = (rb_fiber_t*)cont;
GetThreadPtr(cont->saved_thread.self, th);
if ((th->fiber != cont->self) && fib->status == RUNNING) {
- 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);
}
}
}
#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
}
@@ -223,7 +233,8 @@ cont_free(void *ptr)
#if FIBER_USE_NATIVE
if (cont->type == CONTINUATION_CONTEXT) {
/* cont */
- RUBY_FREE_UNLESS_NULL(cont->machine_stack);
+ ruby_xfree(cont->ensure_array);
+ RUBY_FREE_UNLESS_NULL(cont->machine.stack);
}
else {
/* fiber */
@@ -238,11 +249,11 @@ cont_free(void *ptr)
#else /* not WIN32 */
if (GET_THREAD()->fiber != cont->self) {
rb_fiber_t *fib = (rb_fiber_t*)cont;
- if (fib->context.uc_stack.ss_sp) {
+ if (fib->ss_sp) {
if (cont->type == ROOT_FIBER_CONTEXT) {
rb_bug("Illegal root fiber parameter");
}
- munmap((void*)fib->context.uc_stack.ss_sp, fib->context.uc_stack.ss_size);
+ munmap((void*)fib->ss_sp, fib->ss_size);
}
}
else {
@@ -253,10 +264,11 @@ cont_free(void *ptr)
#endif
}
#else /* not FIBER_USE_NATIVE */
- RUBY_FREE_UNLESS_NULL(cont->machine_stack);
+ ruby_xfree(cont->ensure_array);
+ 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);
@@ -282,12 +294,12 @@ cont_memsize(const void *ptr)
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
}
@@ -351,7 +363,8 @@ fiber_memsize(const void *ptr)
size_t size = 0;
if (ptr) {
size = sizeof(*fib);
- if (fib->cont.type != ROOT_FIBER_CONTEXT) {
+ 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);
@@ -375,48 +388,49 @@ 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,},
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
static void
@@ -424,13 +438,13 @@ cont_save_thread(rb_context_t *cont, rb_thread_t *th)
{
/* save thread context */
cont->saved_thread = *th;
- /* saved_thread->machine_stack_(start|end) should be NULL */
+ /* saved_thread->machine.stack_(start|end) should be NULL */
/* because it may happen GC afterward */
- cont->saved_thread.machine_stack_start = 0;
- cont->saved_thread.machine_stack_end = 0;
+ cont->saved_thread.machine.stack_start = 0;
+ cont->saved_thread.machine.stack_end = 0;
#ifdef __ia64
- cont->saved_thread.machine_register_stack_start = 0;
- cont->saved_thread.machine_register_stack_end = 0;
+ cont->saved_thread.machine.register_stack_start = 0;
+ cont->saved_thread.machine.register_stack_end = 0;
#endif
}
@@ -483,9 +497,26 @@ cont_capture(volatile int *stat)
cont_save_machine_stack(th, cont);
+ /* backup ensure_list to array for search in another context */
+ {
+ rb_ensure_list_t *p;
+ int size = 0;
+ rb_ensure_entry_t *entry;
+ for (p=th->ensure_list; p; p=p->next)
+ size++;
+ entry = cont->ensure_array = ALLOC_N(rb_ensure_entry_t,size+1);
+ for (p=th->ensure_list; p; p=p->next) {
+ if (!p->entry.marker)
+ p->entry.marker = rb_ary_tmp_new(0); /* dummy object */
+ *entry++ = p->entry;
+ }
+ entry->marker = 0;
+ }
+
if (ruby_setjmp(cont->jmpbuf)) {
volatile VALUE value;
+ VAR_INITIALIZED(cont);
value = cont->value;
if (cont->argc == -1) rb_exc_raise(value);
cont->value = Qnil;
@@ -544,6 +575,8 @@ cont_restore_thread(rb_context_t *cont)
th->first_proc = sth->first_proc;
th->root_lep = sth->root_lep;
th->root_svar = sth->root_svar;
+ th->ensure_list = sth->ensure_list;
+
}
#if FIBER_USE_NATIVE
@@ -555,7 +588,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
@@ -598,9 +631,10 @@ fiber_machine_stack_alloc(size_t size)
void *page;
STACK_GROW_DIR_DETECTION;
+ errno = 0;
ptr = mmap(NULL, size, PROT_READ | PROT_WRITE, FIBER_STACK_FLAGS, -1, 0);
if (ptr == MAP_FAILED) {
- rb_raise(rb_eFiberError, "can't alloc machine stack to fiber");
+ rb_raise(rb_eFiberError, "can't alloc machine stack to fiber: %s", strerror(errno));
}
/* guard page setup */
@@ -629,7 +663,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;
@@ -640,12 +674,14 @@ 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
}
@@ -662,29 +698,29 @@ 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->cont.self) {
rb_bug("non_root_fiber->context.uc_stac.ss_sp should not be NULL");
@@ -717,16 +753,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
@@ -761,7 +797,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);
@@ -773,7 +809,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
@@ -786,7 +822,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);
@@ -802,7 +838,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]);
@@ -902,7 +938,7 @@ rb_callcc(VALUE self)
}
static VALUE
-make_passing_arg(int argc, VALUE *argv)
+make_passing_arg(int argc, const VALUE *argv)
{
switch (argc) {
case 0:
@@ -914,6 +950,80 @@ make_passing_arg(int argc, VALUE *argv)
}
}
+/* CAUTION!! : Currently, error in rollback_func is not supported */
+/* same as rb_protect if set rollback_func to NULL */
+void
+ruby_register_rollback_func_for_ensure(VALUE (*ensure_func)(ANYARGS), VALUE (*rollback_func)(ANYARGS))
+{
+ st_table **table_p = &GET_VM()->ensure_rollback_table;
+ if (UNLIKELY(*table_p == NULL)) {
+ *table_p = st_init_numtable();
+ }
+ st_insert(*table_p, (st_data_t)ensure_func, (st_data_t)rollback_func);
+}
+
+static inline VALUE
+lookup_rollback_func(VALUE (*ensure_func)(ANYARGS))
+{
+ st_table *table = GET_VM()->ensure_rollback_table;
+ st_data_t val;
+ if (table && st_lookup(table, (st_data_t)ensure_func, &val))
+ return (VALUE) val;
+ return Qundef;
+}
+
+
+static inline void
+rollback_ensure_stack(VALUE self,rb_ensure_list_t *current,rb_ensure_entry_t *target)
+{
+ rb_ensure_list_t *p;
+ rb_ensure_entry_t *entry;
+ size_t i;
+ size_t cur_size;
+ size_t target_size;
+ size_t base_point;
+ VALUE (*func)(ANYARGS);
+
+ cur_size = 0;
+ for (p=current; p; p=p->next)
+ cur_size++;
+ target_size = 0;
+ for (entry=target; entry->marker; entry++)
+ target_size++;
+
+ /* search common stack point */
+ p = current;
+ base_point = cur_size;
+ while (base_point) {
+ if (target_size >= base_point &&
+ p->entry.marker == target[target_size - base_point].marker)
+ break;
+ base_point --;
+ p = p->next;
+ }
+
+ /* rollback function check */
+ for (i=0; i < target_size - base_point; i++) {
+ if (!lookup_rollback_func(target[i].e_proc)) {
+ rb_raise(rb_eRuntimeError, "continuation called from out of critical rb_ensure scope");
+ }
+ }
+ /* pop ensure stack */
+ while (cur_size > base_point) {
+ /* escape from ensure block */
+ (*current->entry.e_proc)(current->entry.data2);
+ current = current->next;
+ cur_size--;
+ }
+ /* push ensure stack */
+ while (i--) {
+ func = (VALUE (*)(ANYARGS)) lookup_rollback_func(target[i].e_proc);
+ if ((VALUE)func != Qundef) {
+ (*func)(target[i].data2);
+ }
+ }
+}
+
/*
* call-seq:
* cont.call(args, ...)
@@ -951,6 +1061,7 @@ rb_cont_call(int argc, VALUE *argv, VALUE contval)
rb_raise(rb_eRuntimeError, "continuation called across fiber");
}
}
+ rollback_ensure_stack(contval, th->ensure_list, cont->ensure_array);
cont->argc = argc;
cont->value = make_passing_arg(argc, argv);
@@ -1031,6 +1142,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,},
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
static VALUE
@@ -1050,8 +1162,7 @@ fiber_t_alloc(VALUE fibval)
}
THREAD_MUST_BE_RUNNING(th);
- fib = ALLOC(rb_fiber_t);
- memset(fib, 0, sizeof(rb_fiber_t));
+ fib = ZALLOC(rb_fiber_t);
fib->cont.self = fibval;
fib->cont.type = FIBER_CONTEXT;
cont_init(&fib->cont, th);
@@ -1145,7 +1256,7 @@ return_fiber(void)
}
}
-VALUE rb_fiber_transfer(VALUE fib, int argc, VALUE *argv);
+VALUE rb_fiber_transfer(VALUE fib, int argc, const VALUE *argv);
static void
rb_fiber_terminate(rb_fiber_t *fib)
@@ -1154,11 +1265,12 @@ rb_fiber_terminate(rb_fiber_t *fib)
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);
+ 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;
+ fib->cont.machine.stack = NULL;
+ fib->cont.machine.stack_size = 0;
#endif
rb_fiber_transfer(return_fiber(), 1, &value);
}
@@ -1168,20 +1280,18 @@ rb_fiber_start(void)
{
rb_thread_t *th = GET_THREAD();
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;
- VALUE *argv, args;
+ const VALUE *argv, args = cont->value;
GetProcPtr(cont->saved_thread.first_proc, proc);
- args = cont->value;
- argv = (argc = cont->argc) > 1 ? RARRAY_PTR(args) : &args;
+ argv = (argc = cont->argc) > 1 ? RARRAY_CONST_PTR(args) : &args;
cont->value = Qnil;
th->errinfo = Qnil;
th->root_lep = rb_vm_ep_local_ep(proc->block.ep);
@@ -1263,13 +1373,13 @@ fiber_store(rb_fiber_t *next_fib)
fiber_setcontext(next_fib, fib);
#ifndef _WIN32
if (terminated_machine_stack.ptr) {
- if (machine_stack_cache_index < MAX_MAHINE_STACK_CACHE) {
+ 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) {
+ if (terminated_machine_stack.ptr != fib->cont.machine.stack) {
munmap((void*)terminated_machine_stack.ptr, terminated_machine_stack.size * sizeof(VALUE));
}
else {
@@ -1294,7 +1404,7 @@ fiber_store(rb_fiber_t *next_fib)
}
static inline VALUE
-fiber_switch(VALUE fibval, int argc, VALUE *argv, int is_resume)
+fiber_switch(VALUE fibval, int argc, const VALUE *argv, int is_resume)
{
VALUE value;
rb_fiber_t *fib;
@@ -1369,13 +1479,13 @@ fiber_switch(VALUE fibval, int argc, VALUE *argv, int is_resume)
}
VALUE
-rb_fiber_transfer(VALUE fib, int argc, VALUE *argv)
+rb_fiber_transfer(VALUE fib, int argc, const VALUE *argv)
{
return fiber_switch(fib, argc, argv, 0);
}
VALUE
-rb_fiber_resume(VALUE fibval, int argc, VALUE *argv)
+rb_fiber_resume(VALUE fibval, int argc, const VALUE *argv)
{
rb_fiber_t *fib;
GetFiberPtr(fibval, fib);
@@ -1391,7 +1501,7 @@ rb_fiber_resume(VALUE fibval, int argc, VALUE *argv)
}
VALUE
-rb_fiber_yield(int argc, VALUE *argv)
+rb_fiber_yield(int argc, const VALUE *argv)
{
return rb_fiber_transfer(return_fiber(), argc, argv);
}
@@ -1485,7 +1595,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
@@ -1559,7 +1669,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);
@@ -1570,9 +1680,7 @@ Init_Cont(void)
rb_define_method(rb_cFiber, "resume", rb_fiber_m_resume, -1);
}
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
+RUBY_SYMBOL_EXPORT_BEGIN
void
ruby_Init_Continuation_body(void)
@@ -1593,6 +1701,4 @@ ruby_Init_Fiber_as_Coroutine(void)
rb_define_singleton_method(rb_cFiber, "current", rb_fiber_s_current, 0);
}
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
-#endif
+RUBY_SYMBOL_EXPORT_END
diff --git a/coverage/README b/coverage/README
new file mode 100644
index 0000000000..7e4ff59e2a
--- /dev/null
+++ b/coverage/README
@@ -0,0 +1,17 @@
+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/debug.c b/debug.c
index 4909a45d17..15c1ea8b9e 100644
--- a/debug.c
+++ b/debug.c
@@ -24,6 +24,7 @@ const union {
enum ruby_tag_type tag_type;
enum node_type node_type;
enum ruby_method_ids method_ids;
+ enum ruby_id_types id_types;
enum {
RUBY_ENCODING_INLINE_MAX = ENCODING_INLINE_MAX,
RUBY_ENCODING_SHIFT = ENCODING_SHIFT,
@@ -32,11 +33,11 @@ const union {
RUBY_ENC_CODERANGE_7BIT = ENC_CODERANGE_7BIT,
RUBY_ENC_CODERANGE_VALID = ENC_CODERANGE_VALID,
RUBY_ENC_CODERANGE_BROKEN = ENC_CODERANGE_BROKEN,
- RUBY_FL_RESERVED1 = FL_RESERVED1,
- RUBY_FL_RESERVED2 = FL_RESERVED2,
+ RUBY_FL_PROMOTED0 = FL_PROMOTED0,
+ RUBY_FL_PROMOTED1 = FL_PROMOTED1,
+ RUBY_FL_PROMOTED = FL_PROMOTED0|FL_PROMOTED1,
RUBY_FL_FINALIZE = FL_FINALIZE,
RUBY_FL_TAINT = FL_TAINT,
- RUBY_FL_UNTRUSTED = FL_UNTRUSTED,
RUBY_FL_EXIVAR = FL_EXIVAR,
RUBY_FL_FREEZE = FL_FREEZE,
RUBY_FL_SINGLETON = FL_SINGLETON,
diff --git a/defs/default_gems b/defs/default_gems
index e73e383b26..ce9010910a 100644
--- a/defs/default_gems
+++ b/defs/default_gems
@@ -1,5 +1,4 @@
# gem base directory versioning file [executable files under bin]
-rake lib/rake lib/rake/version.rb [rake]
+rake lib/rake lib/rake.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
new file mode 100644
index 0000000000..f5033b2245
--- /dev/null
+++ b/defs/gmake.mk
@@ -0,0 +1,63 @@
+# -*- makefile-gmake -*-
+gnumake = yes
+
+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 += $(TEST_DEPENDS) $(if $(filter check%,$(MAKECMDGOALS)),main)
+TEST_DEPENDS += $(if $(filter all,$(INSTALLDOC)),docs)
+
+ifneq ($(filter -O0 -Od,$(optflags)),)
+override XCFLAGS := $(filter-out -D_FORTIFY_SOURCE=%,$(XCFLAGS))
+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 $$< > $$@
+
+%.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 love 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 love 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 love 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)
+
+ifneq ($(if $(filter install,$(MAKECMDGOALS)),$(filter uninstall,$(MAKECMDGOALS))),)
+install-targets := $(filter install uninstall,$(MAKECMDGOALS))
+$(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 love,$(MAKECMDGOALS)),)
+showflags: up
+sudo-precheck: test
+install-prereq: sudo-precheck
+yes-test-all no-test-all: install
+endif
diff --git a/defs/id.def b/defs/id.def
index 91c4110d24..f7fffbde3c 100644
--- a/defs/id.def
+++ b/defs/id.def
@@ -1,7 +1,17 @@
# -*- mode: ruby; coding: us-ascii -*-
firstline, predefined = __LINE__+1, %[\
+ freeze
+ inspect
intern
+ object_id
+ const_missing
method_missing MethodMissing
+ method_added
+ singleton_method_added
+ method_removed
+ singleton_method_removed
+ method_undefined
+ singleton_method_undefined
length
size
gets
@@ -11,13 +21,28 @@ firstline, predefined = __LINE__+1, %[\
lambda
send
__send__
+ __attached__
initialize
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
+
_ UScore
"/*NULL*/" NULL
empty?
+ eql?
respond_to? Respond_to
respond_to_missing? Respond_to_missing
<IFUNC>
diff --git a/defs/opt_operand.def b/defs/opt_operand.def
index ab7103a421..887e3da49a 100644
--- a/defs/opt_operand.def
+++ b/defs/opt_operand.def
@@ -1,5 +1,5 @@
#
-# configration file for operand union optimization
+# configuration file for operand union optimization
#
# format:
# [insn name] op1, op2 ...
diff --git a/dir.c b/dir.c
index 17192141e7..09b78c6b4b 100644
--- a/dir.c
+++ b/dir.c
@@ -63,10 +63,6 @@ char *strchr(char*,char);
#include "ruby/util.h"
-#if !defined HAVE_LSTAT && !defined lstat
-#define lstat stat
-#endif
-
/* define system APIs */
#ifdef _WIN32
#undef chdir
@@ -79,7 +75,40 @@ char *strchr(char*,char);
#define opendir(p) rb_w32_uopendir(p)
#endif
-#define rb_sys_fail_path(path) rb_sys_fail_str(path)
+#ifdef __APPLE__
+# define HAVE_HFS 1
+#else
+# define HAVE_HFS 0
+#endif
+#if HAVE_HFS
+#include <sys/param.h>
+#include <sys/mount.h>
+
+static inline int
+is_hfs(DIR *dirp)
+{
+ struct statfs buf;
+ if (fstatfs(dirfd(dirp), &buf) == 0) {
+ return buf.f_type == 17; /* HFS on darwin */
+ }
+ return FALSE;
+}
+
+static inline int
+has_nonascii(const char *ptr, size_t len)
+{
+ while (len > 0) {
+ if (!ISASCII(*ptr)) return 1;
+ ptr++;
+ --len;
+ }
+ return 0;
+}
+
+# define IF_HAVE_HFS(something) something
+#else
+# define IF_HAVE_HFS(something) /* nothing */
+#endif
#define FNM_NOESCAPE 0x01
#define FNM_PATHNAME 0x02
@@ -352,6 +381,7 @@ dir_memsize(const void *ptr)
static const rb_data_type_t dir_data_type = {
"dir",
{dir_mark, dir_free, dir_memsize,},
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
static VALUE dir_close(VALUE);
@@ -381,8 +411,12 @@ dir_s_alloc(VALUE klass)
/*
* call-seq:
* Dir.new( string ) -> aDir
+ * Dir.new( string, encoding: enc ) -> aDir
*
* Returns a new directory object for the named directory.
+ *
+ * The optional <i>enc</i> argument specifies the encoding of the directory.
+ * If not specified, the filesystem encoding is used.
*/
static VALUE
dir_initialize(int argc, VALUE *argv, VALUE dir)
@@ -390,18 +424,20 @@ dir_initialize(int argc, VALUE *argv, VALUE dir)
struct dir_data *dp;
rb_encoding *fsenc;
VALUE dirname, opt, orig;
- static VALUE sym_enc;
+ static ID keyword_ids[1];
- if (!sym_enc) {
- sym_enc = ID2SYM(rb_intern("encoding"));
+ if (!keyword_ids[0]) {
+ keyword_ids[0] = rb_intern("encoding");
}
+
fsenc = rb_filesystem_encoding();
rb_scan_args(argc, argv, "1:", &dirname, &opt);
if (!NIL_P(opt)) {
- VALUE enc = rb_hash_aref(opt, sym_enc);
- if (!NIL_P(enc)) {
+ VALUE enc;
+ rb_get_kwargs(opt, keyword_ids, 0, 1, &enc);
+ if (enc != Qundef && !NIL_P(enc)) {
fsenc = rb_to_encoding(enc);
}
}
@@ -434,7 +470,12 @@ dir_initialize(int argc, VALUE *argv, VALUE dir)
/*
* call-seq:
* Dir.open( string ) -> aDir
+ * Dir.open( string, encoding: enc ) -> aDir
* Dir.open( string ) {| aDir | block } -> anObject
+ * Dir.open( string, encoding: enc ) {| aDir | block } -> anObject
+ *
+ * The optional <i>enc</i> argument specifies the encoding of the directory.
+ * If not specified, the filesystem encoding is used.
*
* With no block, <code>open</code> is a synonym for
* <code>Dir::new</code>. If a block is present, it is passed
@@ -466,8 +507,6 @@ static struct dir_data *
dir_check(VALUE dir)
{
struct dir_data *dirp;
- if (!OBJ_UNTRUSTED(dir) && rb_safe_level() >= 4)
- rb_raise(rb_eSecurityError, "Insecure: operation on trusted Dir");
rb_check_frozen(dir);
dirp = rb_check_typeddata(dir, &dir_data_type);
if (!dirp->dir) dir_closed();
@@ -500,9 +539,41 @@ dir_inspect(VALUE dir)
return rb_funcall(dir, rb_intern("to_s"), 0, 0);
}
+#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);
+}
+#else
+#define dir_fileno rb_f_notimplement
+#endif
+
/*
* call-seq:
* dir.path -> string or nil
+ * dir.to_path -> string or nil
*
* Returns the path parameter passed to <em>dir</em>'s constructor.
*
@@ -519,50 +590,10 @@ dir_path(VALUE dir)
return rb_str_dup(dirp->path);
}
-#if defined HAVE_READDIR_R
-# define READDIR(dir, enc, entry, dp) (readdir_r((dir), (entry), &(dp)) == 0 && (dp) != 0)
-#elif defined _WIN32
-# define READDIR(dir, enc, entry, dp) (((dp) = rb_w32_readdir((dir), (enc))) != 0)
-#else
-# define READDIR(dir, enc, entry, dp) (((dp) = readdir(dir)) != 0)
-#endif
-#if defined HAVE_READDIR_R
-# define IF_HAVE_READDIR_R(something) something
+#if defined _WIN32
+# define READDIR(dir, enc) rb_w32_readdir((dir), (enc))
#else
-# define IF_HAVE_READDIR_R(something) /* nothing */
-#endif
-
-#if defined SIZEOF_STRUCT_DIRENT_TOO_SMALL
-# include <limits.h>
-# define NAME_MAX_FOR_STRUCT_DIRENT 255
-# if defined NAME_MAX
-# if NAME_MAX_FOR_STRUCT_DIRENT < NAME_MAX
-# undef NAME_MAX_FOR_STRUCT_DIRENT
-# define NAME_MAX_FOR_STRUCT_DIRENT NAME_MAX
-# endif
-# endif
-# if defined _POSIX_NAME_MAX
-# if NAME_MAX_FOR_STRUCT_DIRENT < _POSIX_NAME_MAX
-# undef NAME_MAX_FOR_STRUCT_DIRENT
-# define NAME_MAX_FOR_STRUCT_DIRENT _POSIX_NAME_MAX
-# endif
-# endif
-# if defined _XOPEN_NAME_MAX
-# if NAME_MAX_FOR_STRUCT_DIRENT < _XOPEN_NAME_MAX
-# undef NAME_MAX_FOR_STRUCT_DIRENT
-# define NAME_MAX_FOR_STRUCT_DIRENT _XOPEN_NAME_MAX
-# endif
-# endif
-# define DEFINE_STRUCT_DIRENT \
- union { \
- struct dirent dirent; \
- char dummy[offsetof(struct dirent, d_name) + \
- NAME_MAX_FOR_STRUCT_DIRENT + 1]; \
- }
-# define STRUCT_DIRENT(entry) ((entry).dirent)
-#else
-# define DEFINE_STRUCT_DIRENT struct dirent
-# define STRUCT_DIRENT(entry) (entry)
+# define READDIR(dir, enc) readdir((dir))
#endif
/*
@@ -582,11 +613,10 @@ dir_read(VALUE dir)
{
struct dir_data *dirp;
struct dirent *dp;
- IF_HAVE_READDIR_R(DEFINE_STRUCT_DIRENT entry);
GetDIR(dir, dirp);
errno = 0;
- if (READDIR(dirp->dir, dirp->enc, &STRUCT_DIRENT(entry), dp)) {
+ if ((dp = READDIR(dirp->dir, dirp->enc)) != NULL) {
return rb_external_str_new_with_enc(dp->d_name, NAMLEN(dp), dirp->enc);
}
else {
@@ -620,13 +650,25 @@ dir_each(VALUE dir)
{
struct dir_data *dirp;
struct dirent *dp;
- IF_HAVE_READDIR_R(DEFINE_STRUCT_DIRENT entry);
+ IF_HAVE_HFS(int hfs_p);
RETURN_ENUMERATOR(dir, 0, 0);
GetDIR(dir, dirp);
rewinddir(dirp->dir);
- while (READDIR(dirp->dir, dirp->enc, &STRUCT_DIRENT(entry), dp)) {
- rb_yield(rb_external_str_new_with_enc(dp->d_name, NAMLEN(dp), dirp->enc));
+ 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 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);
+ }
+ else
+#endif
+ path = rb_external_str_new_with_enc(name, namlen, dirp->enc);
+ rb_yield(path);
if (dirp->dir == NULL) dir_closed();
}
return dir;
@@ -692,7 +734,7 @@ dir_seek(VALUE dir, VALUE pos)
#ifdef HAVE_SEEKDIR
/*
* call-seq:
- * dir.pos( integer ) -> integer
+ * dir.pos = integer -> integer
*
* Synonym for <code>Dir#seek</code>, but returns the position
* parameter.
@@ -730,9 +772,6 @@ dir_rewind(VALUE dir)
{
struct dir_data *dirp;
- if (rb_safe_level() >= 4 && !OBJ_UNTRUSTED(dir)) {
- rb_raise(rb_eSecurityError, "Insecure: can't close");
- }
GetDIR(dir, dirp);
rewinddir(dirp->dir);
return dir;
@@ -880,7 +919,6 @@ rb_dir_getwd(void)
char *path;
VALUE cwd;
- rb_secure(4);
path = my_getcwd();
cwd = rb_tainted_str_new2(path);
rb_enc_associate(cwd, rb_filesystem_encoding());
@@ -899,6 +937,7 @@ rb_dir_getwd(void)
*
* Dir.chdir("/tmp") #=> 0
* Dir.getwd #=> "/tmp"
+ * Dir.pwd #=> "/tmp"
*/
static VALUE
dir_s_getwd(VALUE dir)
@@ -1025,18 +1064,25 @@ sys_warning_1(VALUE mesg)
*/
#define to_be_ignored(e) ((e) == ENOENT || (e) == ENOTDIR)
+#ifdef _WIN32
+#define STAT(p, s) rb_w32_ustati64((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)
{
- int ret = stat(path, pst);
+ int ret = STAT(path, pst);
if (ret < 0 && !to_be_ignored(errno))
sys_warning(path);
return ret;
}
+#if defined HAVE_LSTAT || defined lstat
static int
do_lstat(const char *path, struct stat *pst, int flags)
{
@@ -1046,6 +1092,9 @@ do_lstat(const char *path, struct stat *pst, int flags)
return ret;
}
+#else
+#define do_lstat do_stat
+#endif
static DIR *
do_opendir(const char *path, int flags, rb_encoding *enc)
@@ -1068,12 +1117,15 @@ do_opendir(const char *path, int flags, rb_encoding *enc)
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 int
+static enum glob_pattern_type
has_magic(const char *p, const char *pend, int flags, rb_encoding *enc)
{
const int escape = !(flags & FNM_NOESCAPE);
- const int nocase = flags & FNM_CASEFOLD;
+ int hasalpha = 0;
register char c;
@@ -1082,22 +1134,23 @@ has_magic(const char *p, const char *pend, int flags, rb_encoding *enc)
case '*':
case '?':
case '[':
- return 1;
+ return MAGICAL;
case '\\':
if (escape && !(c = *p++))
- return 0;
+ return PLAIN;
continue;
default:
- if (!FNM_SYSCASE && ISALPHA(c) && nocase)
- return 1;
+ if (ISALPHA(c)) {
+ hasalpha = 1;
+ }
}
p = Next(p-1, pend, enc);
}
- return 0;
+ return hasalpha ? ALPHA : PLAIN;
}
/* Find separator in globbing pattern. */
@@ -1161,9 +1214,6 @@ 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;
@@ -1182,7 +1232,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[0] == '*' && p[1] == '*' && p[2] == '/') {
+ if (p + 2 < e && 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;
@@ -1192,12 +1242,13 @@ glob_make_pattern(const char *p, const char *e, int flags, rb_encoding *enc)
}
else {
const char *m = find_dirsep(p, e, flags, enc);
- int magic = has_magic(p, m, flags, enc);
+ const enum glob_pattern_type magic = has_magic(p, m, flags, enc);
+ const enum glob_pattern_type non_magic = (HAVE_HFS || FNM_SYSCASE) ? PLAIN : ALPHA;
char *buf;
- if (!magic && !recursive && *m) {
+ if (!(FNM_SYSCASE || magic > non_magic) && !recursive && *m) {
const char *m2;
- while (!has_magic(m+1, m2 = find_dirsep(m+1, e, flags, enc), flags, enc) &&
+ while (has_magic(m+1, m2 = find_dirsep(m+1, e, flags, enc), flags, enc) <= non_magic &&
*m2) {
m = m2;
}
@@ -1209,7 +1260,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 : PLAIN;
+ tmp->type = magic > MAGICAL ? MAGICAL : magic > non_magic ? magic : PLAIN;
tmp->str = buf;
if (*m) {
dirsep = 1;
@@ -1252,9 +1303,8 @@ glob_free_pattern(struct glob_pattern *list)
}
static char *
-join_path(const char *path, int dirsep, const char *name, size_t namlen)
+join_path(const char *path, long len, int dirsep, const char *name, size_t namlen)
{
- long len = strlen(path);
char *buf = GLOB_ALLOC_N(char, len+namlen+(dirsep?1:0)+1);
if (!buf) return 0;
@@ -1288,17 +1338,17 @@ 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;
- (*args->func)(args->path, args->value, args->enc);
+ glob_call_func(args->func, args->path, args->value, args->enc);
return Qnil;
}
-#define glob_call_func(func, path, arg, enc) (*(func))((path), (arg), (enc))
-
static int
glob_helper(
const char *path,
@@ -1317,6 +1367,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;
@@ -1328,9 +1379,12 @@ glob_helper(
case PLAIN:
plain = 1;
break;
- case MAGICAL:
+ case ALPHA:
magical = 1;
break;
+ case MAGICAL:
+ magical = 2;
+ break;
case MATCH_ALL:
match_all = 1;
break;
@@ -1342,6 +1396,7 @@ glob_helper(
}
}
+ pathlen = strlen(path);
if (*path) {
if (match_all && exist == UNKNOWN) {
if (do_lstat(path, &st, flags) == 0) {
@@ -1368,7 +1423,7 @@ glob_helper(
if (status) return status;
}
if (match_dir && isdir == YES) {
- char *tmp = join_path(path, dirsep, "", 0);
+ char *tmp = join_path(path, pathlen, dirsep, "", 0);
if (!tmp) return -1;
status = glob_call_func(func, tmp, arg, enc);
GLOB_FREE(tmp);
@@ -1381,26 +1436,76 @@ glob_helper(
if (magical || recursive) {
struct dirent *dp;
DIR *dirp;
- IF_HAVE_READDIR_R(DEFINE_STRUCT_DIRENT entry);
+# ifdef DOSISH
+ char *plainname = 0;
+# endif
+ IF_HAVE_HFS(int hfs_p);
+# ifdef DOSISH
+ 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
dirp = do_opendir(*path ? path : ".", flags, enc);
- if (dirp == NULL) return 0;
+ if (dirp == NULL) {
+# if FNM_SYSCASE || HAVE_HFS
+ if ((magical < 2) && !recursive && (errno == EACCES)) {
+ /* no read permission, fallback */
+ goto literally;
+ }
+# endif
+ return 0;
+ }
+ IF_HAVE_HFS(hfs_p = is_hfs(dirp));
- while (READDIR(dirp, enc, &STRUCT_DIRENT(entry), dp)) {
+# if HAVE_HFS
+ if (!(hfs_p || magical || recursive)) {
+ closedir(dirp);
+ goto literally;
+ }
+ flags |= FNM_CASEFOLD;
+# endif
+ while ((dp = READDIR(dirp, enc)) != NULL) {
char *buf;
enum answer new_isdir = UNKNOWN;
+ const char *name;
+ size_t namlen;
+ int dotfile = 0;
+ IF_HAVE_HFS(VALUE utf8str = Qnil);
if (recursive && dp->d_name[0] == '.') {
- /* always skip current and parent directories not to recurse infinitely */
- if (!dp->d_name[1]) continue;
- if (dp->d_name[1] == '.' && !dp->d_name[2]) continue;
+ ++dotfile;
+ if (!dp->d_name[1]) {
+ /* unless DOTMATCH, skip current directories not to recurse infinitely */
+ if (!(flags & FNM_DOTMATCH)) continue;
+ ++dotfile;
+ }
+ else if (dp->d_name[1] == '.' && !dp->d_name[2]) {
+ /* always skip parent directories not to recurse infinitely */
+ continue;
+ }
}
- buf = join_path(path, dirsep, dp->d_name, NAMLEN(dp));
+ name = dp->d_name;
+ namlen = NAMLEN(dp);
+# 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_HAVE_HFS(if (!NIL_P(utf8str)) rb_str_resize(utf8str, 0));
if (!buf) {
status = -1;
break;
}
- if (recursive && ((flags & FNM_DOTMATCH) || dp->d_name[0] != '.')) {
+ name = buf + pathlen + (dirsep != 0);
+ if (recursive && dotfile < ((flags & FNM_DOTMATCH) ? 2 : 1)) {
/* RECURSIVE never match dot files unless FNM_DOTMATCH is set */
#ifndef _WIN32
if (do_lstat(buf, &st, flags) == 0)
@@ -1426,9 +1531,20 @@ glob_helper(
*new_end++ = p; /* append recursive pattern */
p = p->next; /* 0 times recursion */
}
- if (p->type == PLAIN || p->type == MAGICAL) {
- if (fnmatch(p->str, enc, dp->d_name, flags) == 0)
+ switch (p->type) {
+ case ALPHA:
+# ifdef DOSISH
+ if (plainname) {
*new_end++ = p->next;
+ break;
+ }
+# endif
+ case PLAIN:
+ case MAGICAL:
+ if (fnmatch(p->str, enc, name, flags) == 0)
+ *new_end++ = p->next;
+ default:
+ break;
}
}
@@ -1444,10 +1560,13 @@ glob_helper(
else if (plain) {
struct glob_pattern **copy_beg, **copy_end, **cur2;
+# if FNM_SYSCASE || HAVE_HFS
+ 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 == PLAIN ? *cur : 0;
+ *copy_end++ = (*cur)->type <= ALPHA ? *cur : 0;
for (cur = copy_beg; cur < copy_end; ++cur) {
if (*cur) {
@@ -1477,7 +1596,7 @@ glob_helper(
}
}
- buf = join_path(path, dirsep, name, len);
+ buf = join_path(path, pathlen, dirsep, name, len);
GLOB_FREE(name);
if (!buf) {
GLOB_FREE(new_beg);
@@ -1636,7 +1755,7 @@ ruby_brace_expand(const char *str, int flags, ruby_glob_func *func, VALUE arg,
GLOB_FREE(buf);
}
else if (!lbrace && !rbrace) {
- status = (*func)(s, arg, enc);
+ status = glob_call_func(func, s, arg, enc);
}
return status;
@@ -1685,9 +1804,16 @@ static int
push_glob(VALUE ary, VALUE str, int flags)
{
struct glob_args args;
+#ifdef __APPLE__
+ rb_encoding *enc = rb_utf8_encoding();
+
+ str = rb_str_encode_ospath(str);
+#else
rb_encoding *enc = rb_enc_get(str);
if (enc == rb_usascii_encoding()) enc = rb_filesystem_encoding();
+ if (enc == rb_usascii_encoding()) enc = rb_ascii8bit_encoding();
+#endif
args.func = push_pattern;
args.value = ary;
args.enc = enc;
@@ -1725,7 +1851,7 @@ rb_push_glob(VALUE str, int flags) /* '\0' is delimiter */
}
static VALUE
-dir_globs(long argc, VALUE *argv, int flags)
+dir_globs(long argc, const VALUE *argv, int flags)
{
VALUE ary = rb_ary_new();
long i;
@@ -1762,49 +1888,56 @@ dir_s_aref(int argc, VALUE *argv, VALUE obj)
/*
* call-seq:
- * Dir.glob( pattern, [flags] ) -> array
- * Dir.glob( pattern, [flags] ) {| filename | block } -> nil
- *
- * Returns the filenames found by expanding <i>pattern</i> which is
- * an +Array+ of the patterns or the pattern +String+, either as an
- * <i>array</i> or as parameters to the block. Note that this pattern
- * is not a regexp (it's closer to a shell glob). See
- * <code>File::fnmatch</code> for the meaning of the <i>flags</i>
- * parameter. Note that case sensitivity depends on your system (so
- * <code>File::FNM_CASEFOLD</code> is ignored), as does the order
- * in which the results are returned.
- *
- * <code>*</code>:: Matches any file. Can be restricted by
- * other values in the glob. <code>*</code>
- * will match all files; <code>c*</code> will
- * match all files beginning with
- * <code>c</code>; <code>*c</code> will match
- * all files ending with <code>c</code>; and
- * <code>\*c\*</code> will match all files that
- * have <code>c</code> in them (including at
- * the beginning or end). Equivalent to
- * <code>/ .* /x</code> in regexp. Note, this
- * will not match Unix-like hidden files (dotfiles).
- * In order to include those in the match results,
- * you must use something like <code>"{*,.*}"</code>.
- * <code>**</code>:: Matches directories recursively.
- * <code>?</code>:: Matches any one character. Equivalent to
- * <code>/.{1}/</code> in regexp.
- * <code>[set]</code>:: Matches any one character in +set+.
- * Behaves exactly like character sets in
- * Regexp, including set negation
- * (<code>[^a-z]</code>).
- * <code>{p,q}</code>:: Matches either literal <code>p</code> or
- * literal <code>q</code>. Matching literals
- * may be more than one character in length.
- * More than two literals may be specified.
- * Equivalent to pattern alternation in
- * regexp.
- * <code> \\ </code>:: Escapes the next metacharacter.
- * Note that this means you cannot use backslash
- * in windows as part of a glob,
- * i.e. <code>Dir["c:\\foo*"]</code> will not work,
- * use <code>Dir["c:/foo*"]</code> instead.
+ * Dir.glob( pattern, [flags] ) -> matches
+ * Dir.glob( pattern, [flags] ) { |filename| block } -> nil
+ *
+ * Expands +pattern+, which is an Array of patterns or a pattern String, and
+ * returns the results as +matches+ or as arguments given to the block.
+ *
+ * Note that this pattern is not a regexp, it's closer to a shell glob. See
+ * File::fnmatch for the meaning of the +flags+ parameter. Note that case
+ * sensitivity depends on your system (so File::FNM_CASEFOLD is ignored), as
+ * does the order in which the results are returned.
+ *
+ * <code>*</code>::
+ * Matches any file. Can be restricted by other values in the glob.
+ * Equivalent to <code>/ .* /x</code> in regexp.
+ *
+ * <code>*</code>:: Matches all files
+ * <code>c*</code>:: Matches all files beginning with <code>c</code>
+ * <code>*c</code>:: Matches all files ending with <code>c</code>
+ * <code>\*c\*</code>:: Match all files that have <code>c</code> in them
+ * (including at the beginning or end).
+ *
+ * Note, this will not match Unix-like hidden files (dotfiles). In order
+ * to include those in the match results, you must use the
+ * File::FNM_DOTMATCH flag or something like <code>"{*,.*}"</code>.
+ *
+ * <code>**</code>::
+ * Matches directories recursively.
+ *
+ * <code>?</code>::
+ * Matches any one character. Equivalent to <code>/.{1}/</code> in regexp.
+ *
+ * <code>[set]</code>::
+ * Matches any one character in +set+. Behaves exactly like character sets
+ * in Regexp, including set negation (<code>[^a-z]</code>).
+ *
+ * <code>{p,q}</code>::
+ * Matches either literal <code>p</code> or literal <code>q</code>.
+ * Equivalent to pattern alternation in regexp.
+ *
+ * Matching literals may be more than one character in length. More than
+ * two literals may be specified.
+ *
+ * <code> \\ </code>::
+ * Escapes the next metacharacter.
+ *
+ * Note that this means you cannot use backslash on windows as part of a
+ * glob, i.e. <code>Dir["c:\\foo*"]</code> will not work, use
+ * <code>Dir["c:/foo*"]</code> instead.
+ *
+ * Examples:
*
* Dir["config.?"] #=> ["config.h"]
* Dir.glob("config.?") #=> ["config.h"]
@@ -1844,8 +1977,9 @@ dir_s_glob(int argc, VALUE *argv, VALUE obj)
ary = rb_push_glob(str, flags);
}
else {
- volatile VALUE v = ary;
- ary = dir_globs(RARRAY_LEN(v), RARRAY_PTR(v), flags);
+ VALUE v = ary;
+ ary = dir_globs(RARRAY_LEN(v), RARRAY_CONST_PTR(v), flags);
+ RB_GC_GUARD(v);
}
if (rb_block_given_p()) {
@@ -1867,8 +2001,10 @@ dir_open_dir(int argc, VALUE *argv)
/*
* call-seq:
- * Dir.foreach( dirname ) {| filename | block } -> nil
- * Dir.foreach( dirname ) -> an_enumerator
+ * Dir.foreach( dirname ) {| filename | block } -> nil
+ * Dir.foreach( dirname, encoding: enc ) {| filename | block } -> nil
+ * Dir.foreach( dirname ) -> an_enumerator
+ * Dir.foreach( dirname, encoding: enc ) -> an_enumerator
*
* Calls the block once for each entry in the named directory, passing
* the filename of each entry as a parameter to the block.
@@ -1898,12 +2034,16 @@ dir_foreach(int argc, VALUE *argv, VALUE io)
/*
* call-seq:
- * Dir.entries( dirname ) -> array
+ * Dir.entries( dirname ) -> array
+ * Dir.entries( dirname, encoding: enc ) -> array
*
* Returns an array containing all of the filenames in the given
* directory. Will raise a <code>SystemCallError</code> if the named
* directory doesn't exist.
*
+ * The optional <i>enc</i> argument specifies the encoding of the directory.
+ * If not specified, the filesystem encoding is used.
+ *
* Dir.entries("testdir") #=> [".", "..", "config.h", "main.rb"]
*
*/
@@ -1947,38 +2087,50 @@ fnmatch_brace(const char *pattern, VALUE val, void *enc)
* File.fnmatch( pattern, path, [flags] ) -> (true or false)
* File.fnmatch?( pattern, path, [flags] ) -> (true or false)
*
- * Returns true if <i>path</i> matches against <i>pattern</i> The
- * pattern is not a regular expression; instead it follows rules
- * similar to shell filename globbing. It may contain the following
- * metacharacters:
- *
- * <code>*</code>:: Matches any file. Can be restricted by
- * other values in the glob. <code>*</code>
- * will match all files; <code>c*</code> will
- * match all files beginning with
- * <code>c</code>; <code>*c</code> will match
- * all files ending with <code>c</code>; and
- * <code>\*c*</code> will match all files that
- * have <code>c</code> in them (including at
- * the beginning or end). Equivalent to
- * <code>/ .* /x</code> in regexp.
- * <code>**</code>:: Matches directories recursively or files
- * expansively.
- * <code>?</code>:: Matches any one character. Equivalent to
- * <code>/.{1}/</code> in regexp.
- * <code>[set]</code>:: Matches any one character in +set+.
- * Behaves exactly like character sets in
- * Regexp, including set negation
- * (<code>[^a-z]</code>).
- * <code> \ </code>:: Escapes the next metacharacter.
- *
- * <i>flags</i> is a bitwise OR of the <code>FNM_xxx</code>
- * parameters. The same glob pattern and flags are used by
- * <code>Dir::glob</code>.
+ * Returns true if +path+ matches against +pattern+. The pattern is not a
+ * regular expression; instead it follows rules similar to shell filename
+ * globbing. It may contain the following metacharacters:
+ *
+ * <code>*</code>::
+ * Matches any file. Can be restricted by other values in the glob.
+ * Equivalent to <code>/ .* /x</code> in regexp.
+ *
+ * <code>*</code>:: Matches all files regular files
+ * <code>c*</code>:: Matches all files beginning with <code>c</code>
+ * <code>*c</code>:: Matches all files ending with <code>c</code>
+ * <code>\*c*</code>:: Matches all files that have <code>c</code> in them
+ * (including at the beginning or end).
+ *
+ * To match hidden files (that start with a <code>.</code> set the
+ * File::FNM_DOTMATCH flag.
+ *
+ * <code>**</code>::
+ * Matches directories recursively or files expansively.
+ *
+ * <code>?</code>::
+ * Matches any one character. Equivalent to <code>/.{1}/</code> in regexp.
+ *
+ * <code>[set]</code>::
+ * Matches any one character in +set+. Behaves exactly like character sets
+ * in Regexp, including set negation (<code>[^a-z]</code>).
+ *
+ * <code> \ </code>::
+ * Escapes the next metacharacter.
+ *
+ * <code>{a,b}</code>::
+ * Matches pattern a and pattern b if File::FNM_EXTGLOB flag is enabled.
+ * Behaves like a Regexp union (<code>(?:a|b)</code>).
+ *
+ * +flags+ is a bitwise OR of the <code>FNM_XXX</code> constants. The same
+ * glob pattern and flags are used by Dir::glob.
+ *
+ * Examples:
*
* File.fnmatch('cat', 'cat') #=> true # match entire string
* File.fnmatch('cat', 'category') #=> false # only match partial string
- * File.fnmatch('c{at,ub}s', 'cats') #=> false # { } isn't supported
+ *
+ * File.fnmatch('c{at,ub}s', 'cats') #=> false # { } isn't supported by default
+ * File.fnmatch('c{at,ub}s', 'cats', File::FNM_EXTGLOB) #=> true # { } is supported on FNM_EXTGLOB
*
* File.fnmatch('c?t', 'cat') #=> true # '?' match only 1 character
* File.fnmatch('c??t', 'cat') #=> false # ditto
@@ -2072,19 +2224,24 @@ dir_s_home(int argc, VALUE *argv, VALUE obj)
VALUE user;
const char *u = 0;
- rb_scan_args(argc, argv, "01", &user);
+ rb_check_arity(argc, 0, 1);
+ user = (argc > 0) ? argv[0] : Qnil;
if (!NIL_P(user)) {
SafeStringValue(user);
+ rb_must_asciicompat(user);
u = StringValueCStr(user);
+ if (*u) {
+ return rb_home_dir_of(user, rb_str_new(0, 0));
+ }
}
- return rb_home_dir(u, rb_str_new(0, 0));
+ return rb_default_home_dir(rb_str_new(0, 0));
+
}
#if 0
/*
* 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.
@@ -2097,6 +2254,19 @@ 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)
+{
+ rb_warning("Dir.exists? is a deprecated name, use Dir.exist? instead");
+ return rb_file_directory_p(obj, fname);
+}
+
+/*
* Objects of class <code>Dir</code> are directory streams representing
* directories in the underlying file system. They provide a variety of
* ways to list directories and their contents. See also
@@ -2120,6 +2290,7 @@ 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);
@@ -2145,15 +2316,48 @@ Init_Dir(void)
rb_define_singleton_method(rb_cDir,"glob", dir_s_glob, -1);
rb_define_singleton_method(rb_cDir,"[]", dir_s_aref, -1);
rb_define_singleton_method(rb_cDir,"exist?", rb_file_directory_p, 1);
- rb_define_singleton_method(rb_cDir,"exists?", rb_file_directory_p, 1);
+ rb_define_singleton_method(rb_cDir,"exists?", rb_dir_exists_p, 1);
rb_define_singleton_method(rb_cFile,"fnmatch", file_s_fnmatch, -1);
rb_define_singleton_method(rb_cFile,"fnmatch?", file_s_fnmatch, -1);
+ /* Document-const: File::Constants::FNM_NOESCAPE
+ *
+ * Disables escapes in File.fnmatch and Dir.glob patterns
+ */
rb_file_const("FNM_NOESCAPE", INT2FIX(FNM_NOESCAPE));
+
+ /* Document-const: File::Constants::FNM_PATHNAME
+ *
+ * Wildcards in File.fnmatch and Dir.glob patterns do not match directory
+ * separators
+ */
rb_file_const("FNM_PATHNAME", INT2FIX(FNM_PATHNAME));
+
+ /* Document-const: File::Constants::FNM_DOTMATCH
+ *
+ * The '*' wildcard matches filenames starting with "." in File.fnmatch
+ * and Dir.glob patterns
+ */
rb_file_const("FNM_DOTMATCH", INT2FIX(FNM_DOTMATCH));
+
+ /* Document-const: File::Constants::FNM_CASEFOLD
+ *
+ * Makes File.fnmatch patterns case insensitive (but not Dir.glob
+ * patterns).
+ */
rb_file_const("FNM_CASEFOLD", INT2FIX(FNM_CASEFOLD));
+
+ /* Document-const: File::Constants::FNM_EXTGLOB
+ *
+ * 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));
}
diff --git a/dln.c b/dln.c
index e6b20d54e3..2b6a82f063 100644
--- a/dln.c
+++ b/dln.c
@@ -47,6 +47,7 @@ void *xcalloc();
void *xrealloc();
#endif
+#undef free
#define free(x) xfree(x)
#include <stdio.h>
@@ -1178,25 +1179,26 @@ dln_strerror(void)
static void
aix_loaderror(const char *pathname)
{
- 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("\" ");
+ 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");
+ }
+ else {
+ ERRBUF_APPEND(strerror(errno));
+ ERRBUF_APPEND("[loadquery failed]");
}
- ERRBUF_APPEND("\n");
- } else {
- ERRBUF_APPEND(strerror(errno));
- ERRBUF_APPEND("[loadquery failed]");
- }
- dln_loaderror("%s", errbuf);
+ dln_loaderror("%s", errbuf);
}
#endif
@@ -1255,20 +1257,25 @@ dln_load(const char *file)
#if defined _WIN32 && !defined __CYGWIN__
HINSTANCE handle;
- char winfile[MAXPATHLEN];
+ WCHAR *winfile;
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);
- strlcpy(winfile, file, sizeof(winfile));
+ /* Convert the file path to wide char */
+ winfile = rb_w32_mbstr_to_wstr(CP_UTF8, file, -1, NULL);
+ if (!winfile) {
+ dln_memerror();
+ }
/* Load file */
- if ((handle = LoadLibrary(winfile)) == NULL) {
+ handle = LoadLibraryW(winfile);
+ free(winfile);
+
+ if (!handle) {
error = dln_strerror();
goto failed;
}
@@ -1340,11 +1347,6 @@ dln_load(const char *file)
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);
diff --git a/dln.h b/dln.h
index abbd6d85a3..d98b2607e2 100644
--- a/dln.h
+++ b/dln.h
@@ -28,14 +28,17 @@
# define _(args) ()
#endif
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
+RUBY_SYMBOL_EXPORT_BEGIN
+
+#ifndef DLN_FIND_EXTRA_ARG
+#define DLN_FIND_EXTRA_ARG
+#endif
+#ifndef DLN_FIND_EXTRA_ARG_DECL
+#define DLN_FIND_EXTRA_ARG_DECL
#endif
-DEPRECATED(char *dln_find_exe(const char*,const char*));
-DEPRECATED(char *dln_find_file(const char*,const char*));
-char *dln_find_exe_r(const char*,const char*,char*,size_t);
-char *dln_find_file_r(const char*,const char*,char*,size_t);
+char *dln_find_exe_r(const char*,const char*,char*,size_t DLN_FIND_EXTRA_ARG_DECL);
+char *dln_find_file_r(const char*,const char*,char*,size_t DLN_FIND_EXTRA_ARG_DECL);
#ifdef USE_DLN_A_OUT
extern char *dln_argv0;
@@ -43,8 +46,6 @@ extern char *dln_argv0;
void *dln_load(const char*);
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
-#endif
+RUBY_SYMBOL_EXPORT_END
#endif
diff --git a/dln_find.c b/dln_find.c
index d9166fac39..56a19818cf 100644
--- a/dln_find.c
+++ b/dln_find.c
@@ -11,19 +11,11 @@
#ifdef RUBY_EXPORT
#include "ruby/ruby.h"
-#define dln_notimplement rb_notimplement
-#define dln_memerror rb_memerror
-#define dln_exit rb_exit
-#define dln_loaderror rb_loaderror
#define dln_warning rb_warning
#define dln_warning_arg
#else
-#define dln_notimplement --->>> dln not implemented <<<---
-#define dln_memerror abort
-#define dln_exit exit
#define dln_warning fprintf
#define dln_warning_arg stderr,
-static void dln_loaderror(const char *format, ...);
#endif
#include "dln.h"
@@ -67,14 +59,16 @@ char *dln_argv0;
# include <unistd.h>
#endif
-#ifndef _WIN32
+#if !defined(_WIN32) && !HAVE_DECL_GETENV
char *getenv();
#endif
-static char *dln_find_1(const char *fname, const char *path, char *buf, size_t size, int exe_flag);
+static char *dln_find_1(const char *fname, const char *path, char *buf, size_t size, int exe_flag
+ DLN_FIND_EXTRA_ARG_DECL);
char *
-dln_find_exe_r(const char *fname, const char *path, char *buf, size_t size)
+dln_find_exe_r(const char *fname, const char *path, char *buf, size_t size
+ DLN_FIND_EXTRA_ARG_DECL)
{
char *envpath = 0;
@@ -84,41 +78,30 @@ dln_find_exe_r(const char *fname, const char *path, char *buf, size_t size)
}
if (!path) {
-#if defined(_WIN32)
- path = "/usr/local/bin;/usr/ucb;/usr/bin;/bin;.";
-#else
- path = "/usr/local/bin:/usr/ucb:/usr/bin:/bin:.";
-#endif
+ path =
+ "/usr/local/bin" PATH_SEP
+ "/usr/ucb" PATH_SEP
+ "/usr/bin" PATH_SEP
+ "/bin" PATH_SEP
+ ".";
}
- buf = dln_find_1(fname, path, buf, size, 1);
+ buf = dln_find_1(fname, path, buf, size, 1 DLN_FIND_EXTRA_ARG);
if (envpath) free(envpath);
return buf;
}
char *
-dln_find_file_r(const char *fname, const char *path, char *buf, size_t size)
+dln_find_file_r(const char *fname, const char *path, char *buf, size_t size
+ DLN_FIND_EXTRA_ARG_DECL)
{
if (!path) path = ".";
- return dln_find_1(fname, path, buf, size, 0);
-}
-
-static char fbuf[MAXPATHLEN];
-
-char *
-dln_find_exe(const char *fname, const char *path)
-{
- return dln_find_exe_r(fname, path, fbuf, sizeof(fbuf));
-}
-
-char *
-dln_find_file(const char *fname, const char *path)
-{
- return dln_find_file_r(fname, path, fbuf, sizeof(fbuf));
+ return dln_find_1(fname, path, buf, size, 0 DLN_FIND_EXTRA_ARG);
}
static char *
dln_find_1(const char *fname, const char *path, char *fbuf, size_t size,
- int exe_flag /* non 0 if looking for executable. */)
+ int exe_flag /* non 0 if looking for executable. */
+ DLN_FIND_EXTRA_ARG_DECL)
{
register const char *dp;
register const char *ep;
diff --git a/dmyencoding.c b/dmyencoding.c
deleted file mode 100644
index 1bd1106e69..0000000000
--- a/dmyencoding.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define NO_LOCALE_CHARMAP 1
-#include "encoding.c"
diff --git a/dmyversion.c b/dmyversion.c
deleted file mode 100644
index 279c6ea95a..0000000000
--- a/dmyversion.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define NO_INITIAL_LOAD_PATH 1
-#include "version.c"
diff --git a/doc/ChangeLog-1.8.0 b/doc/ChangeLog-1.8.0
index e16c7f4f20..07d7c6b165 100644
--- a/doc/ChangeLog-1.8.0
+++ b/doc/ChangeLog-1.8.0
@@ -42,7 +42,7 @@ Sun Aug 3 23:56:50 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
Sun Aug 3 22:07:47 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * ext/tk/lib/tkentry.rb: support 'validatecommand' option of
+ * ext/tk/lib/tkentry.rb: support 'validatecommand' option of
TkEntry/TkSpinbox widget
* ext/tk/sample/{demos-en,demos-jp}/spin.rb: add
@@ -60,7 +60,7 @@ Sun Aug 3 18:03:44 2003 WATANABE Hirofumi <eban@ruby-lang.org>
Sun Aug 3 08:53:06 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * ext/tk/sample/{demos-en,demos-jp}/image3.rb: add
+ * ext/tk/sample/{demos-en,demos-jp}/image3.rb: add
* ext/tk/lib/tkcanvas.rb: bug fix on Tk object ID management
@@ -84,7 +84,7 @@ Sat Aug 2 23:51:52 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
Sat Aug 2 09:58:13 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * ext/tk/lib/tk.rb: bug fix --- TkGrid failed to treat
+ * ext/tk/lib/tk.rb: bug fix --- TkGrid failed to treat
RELATIVE PLACEMENT
* ext/tk/sample/demos-en/, demos-jp/: add or modify some
@@ -122,7 +122,7 @@ Sat Aug 2 14:02:39 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
Sat Aug 2 09:58:13 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * ext/tk/lib/tk.rb: bug fix --- forgot to entry a widget class
+ * ext/tk/lib/tk.rb: bug fix --- forgot to entry a widget class
name of 'labelframe' widget
* ext/tk/sample/{demos-en,demos-jp}/{labelframe.rb,paned1.rb,
@@ -238,7 +238,7 @@ Fri Aug 1 09:54:38 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
Fri Aug 1 04:58:55 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * ext/tk/lib/tk.rb: bug fix --- forget to eval given block to
+ * ext/tk/lib/tk.rb: bug fix --- forget to eval given block to
TkRoot.new method
* ext/tk/sample/tkoptdb-safeTk.rb: new sample script
@@ -255,13 +255,13 @@ Thu Jul 31 23:44:00 2003 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
Thu Jul 31 23:04:45 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * ext/tk/sample/resource.en, ext/tk/sample/resource.jp:
+ * ext/tk/sample/resource.en, ext/tk/sample/resource.jp:
wrong resource file format
- * ext/tk/lib/tk.rb: add Tk::Encoding.{encoding_convertfrom,
+ * ext/tk/lib/tk.rb: add Tk::Encoding.{encoding_convertfrom,
encoding_convertto}
- * ext/tk/lib/tk.rb: add TkOptionDB.read_with_encoding to read
+ * ext/tk/lib/tk.rb: add TkOptionDB.read_with_encoding to read
non-utf8 resource file
Thu Jul 31 23:02:47 2003 NAKAMURA Usaku <usa@ruby-lang.org>
@@ -274,15 +274,15 @@ Thu Jul 31 20:52:40 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk.rb: (IMPORTANT BUG FIX) scan of event keywords
doesn't work on recent versions of Tck/Tk
- * ext/tk/lib/tk.rb: initialize error of instance variable on
+ * ext/tk/lib/tk.rb: initialize error of instance variable on
TkComposite
- * ext/tk/lib/multi-tk.rb: initialize error on encoding-system on
+ * ext/tk/lib/multi-tk.rb: initialize error on encoding-system on
MultiTkIp
* ext/tk/lib/tk.rb: trouble on destroying widgets
- * ext/tk/sample/demos-en/, demos-jp/: add JP and EN version of
+ * ext/tk/sample/demos-en/, demos-jp/: add JP and EN version of
Ruby/Tk widget demos
Thu Jul 31 15:25:12 2003 NAKAMURA Usaku <usa@ruby-lang.org>
@@ -311,13 +311,13 @@ Thu Jul 31 08:18:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
Thu Jul 31 07:59:18 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * ext/tk/lib/tk.rb: wrap the command-proc of TkScale --- pass
+ * ext/tk/lib/tk.rb: wrap the command-proc of TkScale --- pass
the numeric object to the proc
- * ext/tk/lib/tk.rb: better support for widgets created on
+ * ext/tk/lib/tk.rb: better support for widgets created on
Tk interpreter (without Ruby)
- * ext/tk/lib/multi-tk.rb: a little more stable on Multiple Tk
+ * ext/tk/lib/multi-tk.rb: a little more stable on Multiple Tk
interpreters running
Thu Jul 31 00:17:19 2003 Shugo Maeda <shugo@ruby-lang.org>
@@ -411,17 +411,17 @@ Wed Jul 30 07:23:14 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tkentry.rb: fix lack of methods for TkEntry
- * ext/tk/lib/multi-tk.rb, ext/tk/lib/tk.rb,
- ext/tk/lib/tkdialog.rb, ext/tk/lib/tkentry.rb,
+ * ext/tk/lib/multi-tk.rb, ext/tk/lib/tk.rb,
+ ext/tk/lib/tkdialog.rb, ext/tk/lib/tkentry.rb,
ext/tk/sample/safe-tk.rb, ext/tk/sample/tktimer2.rb: bug fix
- * ext/tk/lib/multi-tk.rb: MultiTkIp.new_* accept a block to
+ * ext/tk/lib/multi-tk.rb: MultiTkIp.new_* accept a block to
eval under the new interpreter
Wed Jul 30 04:36:30 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * ext/tcltklib/tcltklib.c,
- ext/tk/lib/tk.rb, ext/tk/lib/tkafter.rb: additional check of
+ * ext/tcltklib/tcltklib.c,
+ ext/tk/lib/tk.rb, ext/tk/lib/tkafter.rb: additional check of
Tk interpreters' status for a little more safety
Wed Jul 30 02:37:12 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
@@ -514,14 +514,14 @@ Mon Jul 28 22:57:52 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
Tue Jul 29 16:20:36 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * ext/tcltklib/tcltklib.c: bug fix and
+ * ext/tcltklib/tcltklib.c: bug fix and
change mainloop_abort_on_no_widget_cmd => mainloop_abort_on_exception
( to avoid thread timing trouble on accessing destroyed widgets )
- * ext/tk/lib/multi-tk.rb: change default mode of
+ * ext/tk/lib/multi-tk.rb: change default mode of
mainloop_abort_on_exception on multi-tk.rb
- * ext/tk/lib/multi-tk.rb: fix a bug of the procedure for
+ * ext/tk/lib/multi-tk.rb: fix a bug of the procedure for
'Delete' button on the safe-Tk frmae
Tue Jul 29 12:22:28 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
@@ -541,8 +541,8 @@ Tue Jul 29 12:15:37 2003 NAKAMURA Usaku <usa@ruby-lang.org>
Tue Jul 29 08:05:30 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * ext/tk/lib/tk.rb, ext/tk/lib/tkdialog.rb, ext/tk/lib/tktext.rb,
- ext/tk/sample/tkbiff.rb, ext/tk/sample/tkdialog.rb,
+ * ext/tk/lib/tk.rb, ext/tk/lib/tkdialog.rb, ext/tk/lib/tktext.rb,
+ ext/tk/sample/tkbiff.rb, ext/tk/sample/tkdialog.rb,
ext/tk/sample/tkform.rb: bug fix ( tested with Ruby/Tk widget demo )
Tue Jul 29 04:22:08 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
@@ -571,7 +571,7 @@ Tue Jul 29 01:24:32 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/multi-tk.rb: bug fix and pack options are pssed
to the safeTk container
- * ext/tk/sample/safe-tk.rb: add example for pack options of
+ * ext/tk/sample/safe-tk.rb: add example for pack options of
safeTk container
Mon Jul 28 23:23:08 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
@@ -643,7 +643,7 @@ Sun Jul 27 19:35:06 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tcltklib/tcltklib.c: add some methods to support
multiple interpreters (low level)
- * ext/tk/lib/multi-tk.rb: new library to support multiple Tk
+ * ext/tk/lib/multi-tk.rb: new library to support multiple Tk
interpreters (high level)
* ext/tcltklib/demo/safeTk.rb: new sample of safeTk interpreter
@@ -732,12 +732,12 @@ Fri Jul 26 00:04:25 2003 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
Fri Jul 25 16:43:03 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * ext/tcltklib/tcltklib.c: add TclTkIp#create_slave,
+ * ext/tcltklib/tcltklib.c: add TclTkIp#create_slave,
TclTkIp#_make_safe and TclTkIp#safe?
* ext/tcltklib/MANUAL.euc: modify descriptions
- * ext/tk/lib/tk.rb: bug fix [ruby-talk:76980] and modify to
+ * ext/tk/lib/tk.rb: bug fix [ruby-talk:76980] and modify to
support multi Tk IPs
* ext/tk/lib/tkafter.rb: modify to support multi Tk IPs
@@ -747,10 +747,10 @@ Fri Jul 25 15:47:39 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
* ext/openssl/extconf.rb: add check for BN_rand_range() and
BN_pseudo_rand_range().
- * ext/openssl/ossl_bn.c (ossl_bn_s_rand_range): should raise
+ * ext/openssl/ossl_bn.c (ossl_bn_s_rand_range): should raise
NotImplementedError if BN_rand_range() wan not defined.
- * ext/openssl/ossl_bn.c (ossl_bn_s_pseudo_rand_range): should raise
+ * ext/openssl/ossl_bn.c (ossl_bn_s_pseudo_rand_range): should raise
NotImplementedError if BN_pseudo_rand_range() wan not defined.
* ext/openssl/ossl_pkcs7.c (ossl_pkcs7_s_encrypt): avoid compiler
@@ -1110,7 +1110,7 @@ Thu Jul 17 13:42:53 2003 WATANABE Hirofumi <eban@ruby-lang.org>
Thu Jul 17 06:40:28 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * ext/tk/lib/tk.rb: recover and fix typo : Tk.chooseDirectory
+ * ext/tk/lib/tk.rb: recover and fix typo : Tk.chooseDirectory
(Tk8.4 feature)
Wed Jul 16 16:23:58 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
@@ -1139,7 +1139,7 @@ Tue Jul 15 14:38:21 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
Tue Jul 15 03:30:41 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
- * ext/syck/rubyext.c (syck_mark_emitter): forgot to rb_gc_mark the
+ * ext/syck/rubyext.c (syck_mark_emitter): forgot to rb_gc_mark the
outgoing IO object.
Sun Jul 13 14:55:36 2003 Koji Arai <jca02266@nifty.ne.jp>
@@ -1196,7 +1196,7 @@ Fri Jul 11 16:09:09 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
Fri Jul 11 07:17:47 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * ext/tk/lib/tk.rb: not create a Tcl/Tk interpreter if already
+ * ext/tk/lib/tk.rb: not create a Tcl/Tk interpreter if already
defined TkCore::INTERP
* ext/tk/lib/tk.rb: bugfix on TkWindow#configure
@@ -1306,7 +1306,7 @@ Thu Jul 3 14:22:46 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
Thu Jul 3 12:13:05 2003 WATANABE Hirofumi <eban@ruby-lang.org>
- * lib/mkmf.rb (VPATH): convert from Windows form to Unix form on
+ * lib/mkmf.rb (VPATH): convert from Windows form to Unix form on
MinGW. This fixes the build with GNU make 3.80-1 for Cygwin.
Wed Jul 2 23:27:34 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
@@ -1459,11 +1459,11 @@ Thu Jun 26 21:34:49 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
Wed Jun 25 14:40:33 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * ext/tk/lib/tk.rb: add and modify methods ---
- TkWidget.database_class, TkWidget.database_classname,
- TkWidget#database_class, TkWidget#database_classname
+ * ext/tk/lib/tk.rb: add and modify methods ---
+ TkWidget.database_class, TkWidget.database_classname,
+ TkWidget#database_class, TkWidget#database_classname
- * ext/tk/lib/tk.rb: instances of a subclass of TkToplevel or
+ * ext/tk/lib/tk.rb: instances of a subclass of TkToplevel or
TkFrame are created with ":class=>subclass" option as default.
* ext/tk/sample/tkoptdb.rb: add a new part
@@ -1478,7 +1478,7 @@ Wed Jun 25 05:49:10 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk.rb: add widget destroy hook binding to TkBindTag::ALL
- * ext/tk/lib/tkcanvas.rb: Although requiring manual control of GC,
+ * ext/tk/lib/tkcanvas.rb: Although requiring manual control of GC,
memory eating problem of TkCanvas Items is fixed.
* ext/tk/lib/tktext.rb: add some methods and bug fix
@@ -1493,10 +1493,10 @@ Tue Jun 24 16:46:07 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk.rb: bug fix on TkToplevel, TkFrame,
TkPanedwindow, TkOptionDB
- * ext/tk/lib/tk.rb: TkOptionDB --- make it more secure to use procs
+ * ext/tk/lib/tk.rb: TkOptionDB --- make it more secure to use procs
defined on resourceDB
- * ext/tk/sample/tkoptdb.rb, resource.ja, resource.en:
+ * ext/tk/sample/tkoptdb.rb, resource.ja, resource.en:
sample script how to use TkOptionDB.
Tue Jun 24 14:22:41 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
@@ -1610,14 +1610,14 @@ Sun Jun 22 23:42:20 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
Sun Jun 22 16:17:02 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * ext/tk/lib/tk.rb: TkRoot.new and TkToplevel.new accept Wm
+ * ext/tk/lib/tk.rb: TkRoot.new and TkToplevel.new accept Wm
commands as elements
* ext/tk/lib/tk.rb: TkMenu --- add some methods
* ext/tk/lib/tk.rb: TkOptionMenubutton --- bug fix
- * ext/tk/sample/tkmenubutton.rb: sample of TkMenubutton and
+ * ext/tk/sample/tkmenubutton.rb: sample of TkMenubutton and
TkOptionMenubutton
Sat Jun 21 23:15:08 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
@@ -1625,7 +1625,7 @@ Sat Jun 21 23:15:08 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (proc_invoke): should not propagate distination tag if
tag is already handled in this level. (ruby-bugs-ja PR#501)
- * object.c (str_to_id): check for empty string before intern.
+ * object.c (str_to_id): check for empty string before intern.
[ruby-talk:74006]
Sat Jun 21 13:56:09 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
@@ -1636,10 +1636,10 @@ Sat Jun 21 13:56:09 2003 Takaaki Uematsu <uema2x@jcom.home.ne.jp>
Sat Jun 21 12:55:17 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
- * ext/tk/lib/tk.rb: TkRoot.new and TkToplevel.new accept Wm commands
- as elements of a hash argument.
+ * ext/tk/lib/tk.rb: TkRoot.new and TkToplevel.new accept Wm commands
+ as elements of a hash argument.
- * ext/tk/sample/tktimer2.rb: add comments about the usage of a
+ * ext/tk/sample/tktimer2.rb: add comments about the usage of a
TkTimer object.
Sat Jun 21 08:47:22 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
@@ -1647,10 +1647,10 @@ Sat Jun 21 08:47:22 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk*.rb: remove direct-accesses to TkComm::INTERP and
TkComm::INITIALIZE_TARGETS
- * ext/tk/lib/tk*.rb: use TkINTERP_SETUP_SCRIPTS constant for setting
+ * ext/tk/lib/tk*.rb: use TkINTERP_SETUP_SCRIPTS constant for setting
up the interpreter
- * ext/tcltklib/tcltklib.c: support to create a safe interpreter
+ * ext/tcltklib/tcltklib.c: support to create a safe interpreter
with safe-Tk
Fri Jun 20 23:28:27 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
@@ -1660,7 +1660,7 @@ Fri Jun 20 23:28:27 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
Fri Jun 20 15:04:28 2003 NAKAMURA Usaku <usa@ruby-lang.org>
- * defines.h (PATH_ENV): name of PATH environment. [new].
+ * defines.h (PATH_ENV): name of PATH environment. [new].
* defines.h (ENV_IGNORECASE): define for case insensitive platforms
to access environment variables.
@@ -1678,7 +1678,7 @@ Fri Jun 20 14:52:46 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
Fri Jun 20 03:09:21 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
- * parse.y (new_yield): distinguish "yield 1,2" and "yield [1,2]".
+ * parse.y (new_yield): distinguish "yield 1,2" and "yield [1,2]".
[ruby-dev:20360]
* eval.c (rb_eval): support new_yield() change.
@@ -1688,7 +1688,7 @@ Fri Jun 20 03:09:21 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
[ruby-list:36935]
* parse.y (no_blockarg): separate no block argument check and
- ret_args argument processing.
+ ret_args argument processing.
Fri Jun 20 00:45:19 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
@@ -1696,9 +1696,9 @@ Fri Jun 20 00:45:19 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
Thu Jun 19 22:51:41 2003 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
- * lib/drb.rb, lib/drb/drb.rb, lib/drb/eq.rb,
- lib/drb/extserv.rb, lib/drb/extservm.rb, lib/drb/gw.rb,
- lib/drb/invokemethod.rb, lib/drb/observer.rb,
+ * lib/drb.rb, lib/drb/drb.rb, lib/drb/eq.rb,
+ lib/drb/extserv.rb, lib/drb/extservm.rb, lib/drb/gw.rb,
+ lib/drb/invokemethod.rb, lib/drb/observer.rb,
lib/drb/timeridconv.rb, lib/drb/unix.rb: import drb-2.0.4b3
Thu Jun 19 16:14:43 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
@@ -1710,17 +1710,17 @@ Thu Jun 19 16:14:43 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tcltklib/tcltklib.c: add TclTkLib::EventFlag::NONE ( == 0 )
- * ext/tcltklib/tcltklib.c: add set_no_event_wait() and
+ * ext/tcltklib/tcltklib.c: add set_no_event_wait() and
get_no_event_wait()
* ext/tcltklib/MANUAL.euc: modify
* ext/tcltklib/README.euc: ditto
- * ext/tk/lib/tk.rb: change default value of TkCore.do_one_event
+ * ext/tk/lib/tk.rb: change default value of TkCore.do_one_event
argument
- * ext/tk/lib/tk.rb: add TkCore.set_no_event_wait(wait) and
+ * ext/tk/lib/tk.rb: add TkCore.set_no_event_wait(wait) and
TkCore.get_no_event_wait
* ext/tk/lib/tk.rb: add Tk.exit ( == destroy root widget )
@@ -1730,7 +1730,7 @@ Thu Jun 19 16:14:43 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tkafter.rb: set_callback returns self
- * ext/tk/lib/tkafter.rb: continue() raises an exception, if already
+ * ext/tk/lib/tkafter.rb: continue() raises an exception, if already
running or no procedure.
* ext/tk/lib/tkafter.rb: skip() raises an exception, if not running.
@@ -1768,15 +1768,15 @@ Wed Jun 18 19:46:21 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk.rb: rename 'no_create' option to 'without_creating'
- * ext/tk/lib/tk.rb: add TkWindow#pack_in, TkWindow#grid_in,
+ * ext/tk/lib/tk.rb: add TkWindow#pack_in, TkWindow#grid_in,
TkWindow#place_in
* ext/tk/lib/tk.rb: add TkWindow#bind_class and TkWindow#database_class
- * ext/tk/lib/tk.rb: add TkBindTag.new_by_name and TkDatabaseClass
+ * ext/tk/lib/tk.rb: add TkBindTag.new_by_name and TkDatabaseClass
for binding to database class
- * ext/tk/lib/tk.rb: check varname whether already exsist or not.
+ * ext/tk/lib/tk.rb: check varname whether already exsist or not.
(TkVarAccess.new)
* ext/tk/lib/tk.rb: TkTextWin#bbox returns an array of four numbers
@@ -1788,21 +1788,21 @@ Wed Jun 18 19:46:21 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk.rb: TkBindTag.new accepts a block
- * ext/tk/lib/tk.rb: If given taglist, TkWindow#bindtags(taglist)
+ * ext/tk/lib/tk.rb: If given taglist, TkWindow#bindtags(taglist)
returns taglist
* ext/tk/lib/tk.rb: add TkWindow#bindtags=(taglist)
- * ext/tk/lib/tk.rb: Tk.focue and Tk.focus_lastfor return nil
+ * ext/tk/lib/tk.rb: Tk.focue and Tk.focus_lastfor return nil
if there is no target widget.
- * ext/tk/lib/tk.rb: Tk::Wm.client returns the argument string
+ * ext/tk/lib/tk.rb: Tk::Wm.client returns the argument string
when setting name
- * ext/tk/lib/tk.rb: TkGrid.columnconfiginfo and rowconfiginfo
+ * ext/tk/lib/tk.rb: TkGrid.columnconfiginfo and rowconfiginfo
given a slot return a number.
- * ext/tk/lib/tk.rb: TkWindow.grid_columnconfiginfo and
+ * ext/tk/lib/tk.rb: TkWindow.grid_columnconfiginfo and
grid_rowconfiginfo --- ditto
* ext/tk/lib/tk.rb: rename and define alias :: TkOption ==> TkOptionDB
@@ -1813,10 +1813,10 @@ Wed Jun 18 19:46:21 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk.rb: some TkComm methods change to module functions
- * ext/tk/lib/tk.rb: add support for -displayof option to some
+ * ext/tk/lib/tk.rb: add support for -displayof option to some
TkWinfo methods
- * ext/tk/lib/tk.rb: bind, bind_append and bind_remove ---
+ * ext/tk/lib/tk.rb: bind, bind_append and bind_remove ---
returns the target of event-binding
* ext/tk/lib/tk.rb: add Tk8.4 features
@@ -1837,7 +1837,7 @@ Wed Jun 18 19:46:21 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tkentry.rb: TkEntry#bbox returns an array of four numbers
- * ext/tk/lib/tkentry.rb: scan validatecommand arguments and
+ * ext/tk/lib/tkentry.rb: scan validatecommand arguments and
convert to proper type
* ext/tk/lib/tkbgerror.rb: support to define a error handler by user
@@ -1932,7 +1932,7 @@ Fri Jun 13 09:24:39 2003 Shugo Maeda <shugo@ruby-lang.org>
Thu Jun 12 22:13:13 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk.rb : add 'no_create' option to widget
- initialize method.
+ initialize method.
* ext/tk/MANIFEST : forgot to commit when added tkmacpkg.rb
and tkwinpkg.rb
@@ -1947,7 +1947,7 @@ Thu Jun 12 21:14:11 2003 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tkmacpkg.rb : Mac resource (not new but not
included until now)
- * ext/tk/lib/tkwinpkg.rb : Win DDE and registry (not new but not
+ * ext/tk/lib/tkwinpkg.rb : Win DDE and registry (not new but not
included until now)
Tue Jun 10 14:26:30 2003 why the lucky stiff <ruby-cvs@whytheluckystiff.net>
@@ -8346,7 +8346,7 @@ Tue Jun 4 07:03:33 2002 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tkfont.rb: Fix bugs on TkFont.init_widget_font for Tk8.x.
- * ext/tk/lib/tkafter.rb: Add self to 1st argument of interval-
+ * ext/tk/lib/tkafter.rb: Add self to 1st argument of interval-
and loop-proc
TkAfter#current_interval returns an interval (sleep) time value
TkAfter#current_args returns an array of arguments
@@ -8354,7 +8354,7 @@ Tue Jun 4 07:03:33 2002 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/lib/tk*.rb: Allow to use Symbols for parameters.
- * ext/tk/lib/tkcanvas.rb: (TkcItem) Add 'coords' parameter to the
+ * ext/tk/lib/tkcanvas.rb: (TkcItem) Add 'coords' parameter to the
canvas item constructor (for new notation of constructor).
* ext/tcltklib/tcltklib.c: New 'mainloop' and 'mainloop_watchdog'.
@@ -8363,7 +8363,7 @@ Tue Jun 4 07:03:33 2002 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
'use' parameter.
* ext/tk/lib/tk.rb: Add new parameter 'widgetname' to the widget
- constructor to support effective use of Resource Database.
+ constructor to support effective use of Resource Database.
* ext/tk/lib/tk.rb: TkOption::get always returns a tainted string.
@@ -13763,7 +13763,7 @@ Tue Apr 17 17:33:55 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (handle_rescue): use === to compare exception match.
- * error.c (syserr_eqq): comparison between SytemCallErrors should
+ * error.c (syserr_eqq): comparison between SystemCallErrors should
based on their error numbers.
Tue Apr 17 16:54:39 2001 K.Kosako <kosako@sofnec.co.jp>
diff --git a/doc/ChangeLog-1.9.3 b/doc/ChangeLog-1.9.3
index 692b996335..e9ede641f5 100644
--- a/doc/ChangeLog-1.9.3
+++ b/doc/ChangeLog-1.9.3
@@ -14297,7 +14297,7 @@ Thu Jun 10 09:10:08 2010 Yukihiro Matsumoto <matz@ruby-lang.org>
Wed Jun 9 22:51:50 2010 Tanaka Akira <akr@fsij.org>
- * time.c (find_time_t): always outerpolate from past.
+ * time.c (find_time_t): always extrapolate from past.
[ruby-core:30672] reported by Benoit Daloze.
Wed Jun 9 22:13:08 2010 Tanaka Akira <akr@fsij.org>
@@ -76917,7 +76917,7 @@ Tue May 31 15:52:45 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
break the loop if the socket reached to EOF. [ruby-talk:142285]
* lib/webrick/httpserver.rb (WEBrick::HTTPServer#run): send response
- without reading the whole request body if keep-alive is diabled.
+ without reading the whole request body if keep-alive is disabled.
[experimental]
Mon May 30 23:48:29 2005 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
@@ -76939,7 +76939,7 @@ Sat May 28 16:39:21 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
Sat May 28 05:15:44 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
* ext/openssl/ossl_x509store.c (ossl_x509stctx_set_time): should
- not set internal flag directry.
+ not set internal flag directory.
Sat May 28 02:00:11 2005 GOTOU Yuuzou <gotoyuzo@notwork.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 errror on non-http proxy URI.
+ raise an error 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>
diff --git a/doc/ChangeLog-2.0.0 b/doc/ChangeLog-2.0.0
new file mode 100644
index 0000000000..a1a79b8dca
--- /dev/null
+++ b/doc/ChangeLog-2.0.0
@@ -0,0 +1,24015 @@
+Fri Feb 8 19:56:54 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * array.c (rb_ary_dup): reverted r39004. see [Bug #7768], and
+ release manager finally decided to revert it.
+
+Fri Feb 8 16:09:45 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_ensure): preserve errinfo across ensure proc before
+ JUMP_TAG(). [ruby-core:52022] [Bug #7802]
+
+Fri Feb 8 16:08:28 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/ruby/envutil.rb (assert_separately): check also terminating
+ signal not only if core dumped.
+
+Fri Feb 8 13:12:04 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/generator/darkfish.rb: Set encoding on output template to
+ user-specified encoding.
+ * test/rdoc/test_rdoc_generator_darkfish.rb: Test for above.
+
+ * lib/rdoc.rb: Bump version
+
+Fri Feb 8 11:53:33 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/security/policy.rb: Raise proper exceptions when
+ verifying unsigned gems (instead of crashing).
+ * test/rubygems/test_gem_security_policy.rb: Tests for the above.
+
+Fri Feb 8 10:44:44 2013 Eric Hodel <drbrain@segment7.net>
+
+ * test/rubygems/test_gem_dependency_installer.rb: Improve coverage of
+ --install-dir feature of gem install.
+
+Fri Feb 8 10:11:09 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/config_file.rb: Add missing require for
+ user_interaction.rb
+
+ * lib/rubygems/dependency_installer.rb: Minor refactor for clarity.
+
+Fri Feb 8 09:35:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (MakeMakefile#configuration): set all ruby names.
+ hdrdir now needs RUBY_VERSION_NAME.
+
+Fri Feb 8 08:58:26 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/package/old.rb: Fix loading old format gems on ruby
+ 1.8. This commit is only so trunk and rubygems master have the same
+ code.
+
+Fri Feb 8 08:53:27 2013 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: fixing string quotation
+ when dumping Ruby strings. Thanks Ingy
+
+ * test/psych/test_psych.rb: appropriate tests.
+
+ * test/psych/test_yaml.rb: ditto
+
+Fri Feb 8 08:50:42 2013 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: change output reference
+ ids to be sequential numbers.
+
+Fri Feb 8 07:47:56 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/package/old.rb: Disallow installation of old-format
+ gems when a security policy is active.
+ * test/rubygems/test_gem_package_old.rb: Test for above.
+
+Fri Feb 8 07:34:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/net/http.rb (HTTP.post_form): Fix module scope in documentation
+ Patch by David Albert [Bug #7794] [ruby-core:51955]
+
+Fri Feb 8 07:33:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * compar.c (cmp_equal): Document ignored exception and return false
+ By Makoto Kishimoto [Bug #7790] [ruby-dev:46925] [ruby-dev:46910]
+
+Fri Feb 8 07:17:00 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/dependency_installer.rb: Only install local gems if
+ they end in '.gem'. Fixes github rubygems issue #407.
+ * test/rubygems/test_gem_dependency_installer.rb: Test for the above.
+
+Fri Feb 8 00:02:48 2013 Tanaka Akira <akr@fsij.org>
+
+ * process.c (obj2gid): use getgrnam_r() only if getgrnam_r() and
+ _SC_GETGR_R_SIZE_MAX is available.
+ MirOS BSD (MirBSD 10 GENERIC#1382 i386) have getgrnam_r() but
+ no _SC_GETGR_R_SIZE_MAX.
+ (obj2uid): use getpwnam_r() only if getpwnam_r() and
+ _SC_GETPW_R_SIZE_MAX is available.
+ This is consistency for obj2gid.
+ MirOS BSD have neither getpwnam_r() nor _SC_GETPW_R_SIZE_MAX.
+
+Thu Feb 7 22:01:18 2013 Tanaka Akira <akr@fsij.org>
+
+ * configure.in: define linker for shared library on MirOS BSD.
+
+Thu Feb 7 21:09:23 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/rubygems/test_gem_config_file.rb
+ (TestGemConfigFile#test_check_credentials_permissions): skip on
+ Windows. see [Bug #7784] [ruby-core:51864] and r39070.
+
+Thu Feb 7 20:52:40 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/Makefile.sub (config.status): added variables which were
+ missing at r39130.
+
+Thu Feb 7 15:33:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (MakeMakefile#merge_libs): insert following reversal
+ ordered elements just after the duplicated element, not overwriting
+ successive elements. [ruby-core:50314] [Bug #7467]
+
+Thu Feb 7 14:56:15 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/package.rb: Ensure digests are generated for signing.
+ * test/rubygems/test_gem_package.rb: Test for the above.
+
+ * lib/rubygems/security/policy.rb: Ensure digests are present when
+ verifying a gem and match the number of signatures bidirectionally.
+ * test/rubygems/test_gem_security_policy.rb: Test for the above.
+
+ * lib/rubygems.rb: Documentation improvements (by zzak)
+
+Thu Feb 7 05:52:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * doc/pty/README: Remove static documentation file
+ * ext/pty/pty.c: Add License to PTY module overview
+
+Thu Feb 7 02:31:10 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * vm_insnhelper.c: attr_writer should return its argument [Bug #7773]
+
+ * test/ruby/test_basicinstructions.rb: Test for above
+
+Thu Feb 7 01:35:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * doc/security.rdoc: Link to japanese version of CVE page patch by
+ nagachika
+
+Wed Feb 6 23:30:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * doc/pty/README.expect: Removed static documentation file
+ * ext/pty/lib/expect.rb: Documentation for IO#expect
+
+Wed Feb 6 22:25:00 2013 Charlie Somerville <charlie@charliesomerville.com>
+
+ * hash.c (env_reject_bang): hide keys array from ObjectSpace
+ * hash.c (env_select_bang): ditto
+
+Wed Feb 6 17:33:01 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (multiarch): add option to move architecture dependent
+ directories. [Feature #6111]
+
+ * template/ruby.pc.in: add arch dependent paths.
+
+ * configure.in (rubyarchhdrdir, sitearchhdrdir, vendorarchhdrdir): add
+ options to customize architecture dependent header directories.
+
+ * configure.in (rubyarchprefix, sitearchdir, vendorarchdir): add
+ options to customize architecture dependent library directories.
+
+ * template/ruby.pc.in, tool/mkconfig.rb, tool/rbinstall.rb: use
+ configured values.
+
+ * tool/mkconfig.rb: expand rubyarchdir to extract prefix.
+
+ * configure.in (RUBY_VERSION_NAME), template/ruby.pc.in: add
+ substitution and define.
+
+ * configure.in, version.c: parametric architecture name for paths.
+
+ * configure.in (shvar_to_cpp): convert sh variable references
+ by replacing with string literal forms in cpp.
+
+Wed Feb 6 17:05:26 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc: Import RDoc 4.0.0.rc.2
+
+Mon Feb 4 02:22:49 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_process.rb (test_setsid): ensure to call
+ Process.wait(). Reported by George Koehler. Thanks.
+
+Mon Feb 4 02:18:00 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_process.rb (test_setsid): skip when platform is
+ OpenBSD. Contributed from George Koehler.
+ [Bug #7789] [ruby-core:51889]
+
+Wed Feb 6 13:35:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * proc.c (rb_method_entry_location, rb_{mod,obj}_method_location): new
+ functions to obtain source location of method definition.
+
+ * vm_method.c (rb_obj_respond_to): show the location of old style
+ respond_to? method.
+
+Wed Feb 6 13:03:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * doc/security.rdoc: Add link to CVEs on ruby-lang.org/en/security
+
+Wed Feb 6 12:49:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * NEWS: Add note about removal of CSV::load and CSV::dump from r39077
+
+Wed Feb 6 05:57:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/racc/parser.rb: Hide copyright notice from Racc doc
+
+Wed Feb 6 05:50:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * doc/rubygems/*: Removed outdated documentation files
+ * lib/rubygems/LICENSE.txt: Include license file
+ * lib/rubygems.rb: Move Gem module documentation so rdoc can parse it
+ and link to LICENSE.txt
+ * lib/rubygems/*: Hide useless documentation from Gem module rdoc
+
+Wed Feb 6 03:45:19 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * doc/security.rdoc: Remove documentation for unsafe CSV.load which
+ was deleted in r39077
+
+Wed Feb 6 03:27:19 2013 James Edward Gray II <james@graysoftinc.com>
+
+ * lib/csv.rb: Remove the dangerous serialization feature.
+
+Wed Feb 6 00:56:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/irb.rb: Remove example from restrictions, it works [Github #246]
+ Based on patch by Ryunosuke SATO
+
+Wed Feb 6 00:46:53 2013 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * vm.c (rb_vm_stack_to_heap): call rb_vm_get_binding_creatable_next_cfp
+ instead of rb_vm_get_ruby_level_next_cfp to prevent a segfault by
+ calling Kernel#callcc. See r39067 for more details.
+ [ruby-dev:46908] [ruby-trunk - Bug #7774]
+
+ * test/ruby/test_settracefunc.rb: add a test.
+
+Tue Feb 5 18:48:00 2013 Charlie Somerville <charlie@charliesomerville.com>
+
+ * doc/security.rdoc: add regex, eval and drb sections
+
+Tue Feb 5 17:24:02 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/servlet.rb: Fixed root search paths, filesystem paths
+ instead of HTTP paths were returned.
+ * test/rdoc/test_rdoc_servlet.rb: Test for above.
+
+Tue Feb 5 16:37:00 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/config_file.rb: Ignore permissions check on windows.
+ Windows writes 0600 file as 0644 permissions making the check
+ useless.
+
+Tue Feb 5 16:25:25 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_method.c (rb_obj_respond_to): drop optional include_all flag if
+ respond_to? method is defined in old style. [Bug #7722]
+
+Tue Feb 05 15:04:34 2013 Koichi Sasada <ko1@atdot.net>
+
+ * proc.c (rb_binding_new_with_cfp): permit to create binding object
+ of IFUNC frame.
+ When `rb_binding_new_with_cfp()' is called, VM finds out the first
+ normal (has iseq) frame and create a binding object of this frame
+ and create Env objects. `ep's of related frames are updated
+ (`ep's point Env object managed spaces).
+ However, `ep' of skipped IFUNC frame was not updated and
+ old invalid `ep' was remained. It causes serious problems.
+ To solve this issue, permit IFUNC to create binding.
+ (Maybe there is no problem on it)
+ [ruby-dev:46908] [ruby-trunk - Bug #7774]
+
+ * test/ruby/test_settracefunc.rb: add a test.
+
+ * vm.c (rb_vm_get_binding_creatable_next_cfp), vm_core.h: added.
+
+ * vm_trace.c: fix to use `rb_vm_get_binding_creatable_next_cfp()'.
+
+Tue Feb 5 14:43:15 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * lib/matrix.rb: Fix error message, patch by pypypy [Bug #7777]
+
+Tue Feb 5 14:36:04 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * numeric.c (fix_pow): Handle special cases when base is 0, -1 or +1
+ [Bug #5713] [Bug #5715]
+
+ * rational.c (nurat_expt): ditto
+
+Tue Feb 5 13:27:53 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/io/console/console.c (rawmode_opt): use default values by `stty
+ raw`.
+
+Tue Feb 5 12:50:47 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * range.c: Use div instead of / for bsearch
+
+ * test/ruby/test_range.rb: Test showing bug when requiring mathn
+
+Tue Feb 5 12:48:38 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * enumerator.c: Use to_enum for Enumerable methods returning
+ Enumerators.
+ This makes Lazy#cycle no longer needed, so it was removed.
+ Make Enumerator#chunk and slice_before return lazy Enumerators.
+ [Bug #7715]
+
+ * internal.h: Remove ref to rb_enum_cycle_size; no longer needed
+
+ * enum.c: Make enum_cycle_size static.
+
+ * test/ruby/test_lazy_enumerator.rb: Test for above
+
+Tue Feb 5 12:48:10 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * enumerator.c: Finalize and document Lazy.new. [Bug #7248]
+ Add Lazy#to_enum and simplify Lazy#size.
+
+ * test/ruby/test_lazy_enumerator.rb: tests for above
+
+Tue Feb 5 11:35:35 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/commands/push_command.rb: Fixed credential download for
+ `gem push --host`
+ * lib/rubygems/gemcutter_utilities.rb: ditto.
+ * test/rubygems/test_gem_commands_push_command.rb: Test for the above.
+ * test/rubygems/test_gem_gemcutter_utilities.rb: ditto.
+
+ * lib/rubygems/config_file.rb: Abort if the `gem push` credentials
+ file has insecure permissions.
+ * test/rubygems/test_gem_config_file.rb: Test for the above.
+
+ * lib/rubygems/ext/builder.rb: Do not look for Gemfile, Isolate, etc.
+ while building gem extensions.
+
+ * lib/rubygems/package.rb: Unset spec and files list if a gem's
+ signatures cannot be verified.
+ * test/rubygems/test_gem_package.rb: Test for the above.
+
+ * lib/rubygems/specification.rb: Reduce use of eval.
+ * lib/rubygems/test_case.rb: ditto.
+
+ * test/rubygems/test_gem_specification.rb: Test setting
+ specification_version for legacy gems. Dup Gem.ruby before
+ untainting in case it's frozen.
+
+ * lib/rubygems.rb: Reduce use of eval. Only read files when looking
+ for Gemfile, Isolate, etc.
+ * test/rubygems/test_gem.rb: Test for the above.
+
+Tue Feb 5 10:15:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * doc/security.rdoc: Wrap security guide at 80 columns
+
+Tue Feb 5 10:15:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * doc/security.rdoc: Grammatical error on security guide
+ Patch by Josh Bassett [Github fixes #245]
+
+Tue Feb 5 10:00:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/racc/parser.rb: Update #do_parse and #yyparse from upstream
+ See [Github tenderlove/racc@7d954b5]
+
+Tue Feb 5 09:55:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/racc: Merge Racc documentation downstream, add grammar ref file
+
+Tue Feb 5 08:03:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/irb.rb, lib/irb/ext/save-history.rb: Add documentation on how to
+ enabled irb history [ruby-core:51347] [Bug #7679]
+
+Tue Feb 5 07:35:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/irb.rb, lib/irb/context.rb: Add documentation on how to enable
+ auto-indentation and autocompletion using irbrc and irb_context
+ [ruby-core:51209] [Bug #7642] and [ruby-core:51348] [Bug #7680]
+
+Tue Feb 5 05:20:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * doc/standard_library.rdoc: Document list of libraries and extensions
+ and their purpose or short description
+ * lib/README: Remove lib/README in favor of doc/standard_library.rdoc
+
+Tue Feb 5 04:40:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * ext/json/lib/json.rb: Move module overview definition for rdoc
+
+Tue Feb 5 03:00:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/tracer.rb: Move class overview definition and reformat
+
+Mon Feb 4 15:10:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/io/console/console.c (rawmode_opt): initialize options for the
+ case all options are not given.
+
+Mon Feb 4 12:44:13 2013 Koichi Sasada <ko1@atdot.net>
+
+ * vm_dump.c (control_frame_dump): capitalize prefix of `ep'
+ if `ep' points an env object.
+
+Mon Feb 4 04:20:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/English.rb: Add English module for RDoc to parse, then
+ remove_const to avoid confusion. Include full list of aliases and
+ their associated global variable.
+
+Mon Feb 4 02:40:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/yaml.rb (YAML::EngineManager): Documentation for #yamler and
+ #yamler= for using the removed Syck gem as the YAML::ENGINE
+
+Sun Feb 3 16:54:27 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/io/console/io-console.gemspec: bump. [Bug #7762]
+
+ * test/io/console/test_io_console.rb (test_stringio_getch): use more
+ descriptive assertions.
+
+ * ext/io/console/console.c (rawmode_opt): min is minimum characters,
+ not tenths.
+
+Sun Feb 3 16:13:00 2013 Charlie Somerville <charlie@charliesomerville.com>
+
+ * doc/security.rdoc: add first cut at a Ruby security document
+
+Sun Feb 3 10:25:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * random.c: Document range argument for Kernel#rand.
+ [ruby-core:51794] [Bug #7770]
+
+Sun Feb 3 10:00:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * numeric.c: Document Float constants [ruby-core:51484] [Bug #7709]
+
+Sun Feb 3 09:38:44 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/profiler.rb (PROFILE_CALL_PROC, PROFILE_RETURN_PROC): add b_call
+ and b_return to profile block calls.
+
+ * lib/profiler.rb (PROFILE_CALL_PROC, PROFILE_RETURN_PROC): split
+ PROFILE_PROC for call and return events.
+
+Sat Feb 2 14:32:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/minitest/mock.rb, lib/minitest/hell.rb: nodoc top-level module
+
+Sat Feb 2 14:05:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/debug.rb: Documentation for DEBUGGER__ class methods based on
+ patch by Vincent Batts [ruby-core:51253]
+
+Sat Feb 2 13:37:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/net/smtp.rb: Fix rdoc title for Net::SMTP
+
+Sat Feb 2 13:32:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/net/pop.rb: Fix rdoc title for Net::POP3
+
+Sat Feb 2 13:00:11 2013 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * lib/gserver.rb (GServer#start): fix a timing issue. patch from
+ Charles Nutter. [Bug #7081]
+
+Sat Feb 2 12:36:54 2013 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * lib/fileutils.rb (copy_entry, wrap_traverse): preserve attributes of
+ directories on FileUtils.cp_r. The fix was proposed by Jan
+ Wedekind. [Bug #7246]
+
+ * test/fileutils/test_fileutils.rb: add a test for above.
+
+Sat Feb 2 12:30:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/uri/ftp.rb (URI::FTP.new2): nodoc method from r39013 [Bug #7301]
+
+Sat Feb 2 12:15:36 2013 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * lib/uri/ftp.rb (URI::FTP.new2): remove the rdoc because it is not
+ well tested yet. [Bug #7301]
+
+Sat Feb 2 12:07:41 2013 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * ChangeLog: Forgot to add a reference to the ChangeLog of the
+ previous commit.
+
+Sat Feb 2 12:05:18 2013 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * lib/fileutils.rb: chmod/chmod_R with a string mode (e.g., "+x")
+ caused error in verbose mode. [Bug #7373]
+
+ * test/fileutils/test_fileutils.rb: add a test for above.
+
+Sat Feb 2 11:44:42 2013 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * lib/English.rb: Remove some confusing words from rdoc. [Bug #7406]
+
+Sat Feb 2 10:17:12 2013 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * NEWS: add keyword arguments.
+
+Sat Feb 2 07:45:44 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * proc.c (proc_curry): Fix arity check [Bug #5747]
+
+ * test/ruby/test_proc.rb: Test for above
+
+Sat Feb 2 07:44:15 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * proc.c: Add {*}_min_max_arity and refactor.
+ [Bug #7765]
+
+ * test/ruby/test_proc.rb: Fix wrong test
+
+Fri Feb 2 00:46:00 2013 Charlie Somerville <charlie@charliesomerville.com>
+
+ * marshal.c: add security considerations to marshal overview, refer to
+ overview from Marshal.load documentation [#7759]
+
+Fri Feb 1 23:04:00 2013 Charlie Somerville <charlie@charliesomerville.com>
+
+ * array.c (rb_ary_dup): make returned array the same class as the original
+ array [Bug #7768] [ruby-core:51792]
+ * test/ruby/test_array.rb (class TestArray): add test
+
+Fri Feb 1 16:35:34 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * marshal.c (r_object0): prohibit setting instance variables of
+ existing class/module.
+
+Fri Feb 1 14:34:29 2013 Shugo Maeda <shugo@ruby-lang.org>
+
+ * ext/readline/extconf.rb, ext/readline/readline.c: check
+ RL_PROMPT_START_IGNORE and RL_PROMPT_END_IGNORE directly in
+ readline.c. Patch by Zachary Scott. [Bug #7397] [ruby-core:49561]
+
+Thu Jan 31 21:55:00 2013 Charlie Somerville <charlie@charliesomerville.com>
+
+ * marshal.c (marshal_load): Add documentation warning against using
+ Marshal.load on untrusted data [Bug #7759] [ruby-core:51765]
+
+Thu Jan 31 16:33:27 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (local_push_gen): no assigned but unused variable warnings
+ in eval as well as -e. [Feature #7730] [ruby-core:51580]
+
+Wed Jan 30 12:30:08 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_signal.rb (test_trap_puts): Fix typo. "sync"
+ should be "STDOUT.sync".
+
+Thu Jan 31 15:39:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * string.c (rb_str_aset_m): Documentation for String#[]= fix
+ Raises an IndexError if Regexp match is out of range.
+ Github fixes #243 Patch by Dmtiriy Budnik
+
+Thu Jan 31 13:54:44 2013 Shugo Maeda <shugo@ruby-lang.org>
+
+ * ext/socket/raddrinfo.c (rsock_unix_sockaddr_len): return
+ sizeof(sa_family_t) if path is empty. see "Autobind Feature" in
+ unix(7) for details.
+
+ * ext/socket/lib/socket.rb (unix_socket_abstract_name?): treat an
+ empty path as an abstract name.
+
+ * test/socket/test_unix.rb: related test.
+
+Wed Jan 30 20:58:50 2013 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/basicsocket.c (bsock_getsockname): ignore truncated
+ part of socket address.
+ (bsock_getpeername): ditto.
+ (bsock_local_address): ditto.
+ (bsock_remote_address): ditto.
+
+ * ext/socket/unixsocket.c (unix_path): ditto.
+ (unix_addr): ditto.
+ (unix_peeraddr): ditto.
+
+ * ext/socket/init.c (cloexec_accept): ditto.
+
+Wed Jan 30 17:08:20 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/win32.h (fstat): revert r37337, which uses _fstati64()
+ instead of fstati64() on mingw32. [Bug #7276]
+
+Wed Jan 30 15:26:37 2013 Shugo Maeda <shugo@ruby-lang.org>
+
+ * ext/socket/unixsocket.c (rsock_init_unixsock): use rb_inspect()
+ because rb_sys_fail_str() fails if its argument contains NUL.
+
+ * test/socket/test_unix.rb: related test.
+
+Wed Jan 30 15:21:30 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_dump.c (rb_vm_bugreport): show the most important message, Crash
+ Report log information, first.
+
+Wed Jan 30 15:00:05 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * array.c (rb_ary_bsearch): Raise TypeError on bad return from block
+
+ * range.c (range_bsearch): ditto
+
+ * test/ruby/test_array.rb (class): Test for above
+
+ * test/ruby/test_range.rb (class): ditto
+
+Wed Jan 30 14:46:28 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * range.c: Restrict bsearch to integers [#7728]
+
+ * test/ruby/test_range.rb: Test for above
+
+Wed Jan 30 14:10:52 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * array.c (rb_ary_bsearch): Return enumerator if no block [#7725]
+
+ * range.c (range_bsearch): ditto
+
+ * test/ruby/test_array.rb: Test for above
+
+ * test/ruby/test_range.rb: ditto
+
+Wed Jan 30 13:53:43 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * lib/matrix.rb: Take conjugate for inner product
+ [rubyspec:5a01ad5719f2] [ruby-dev:46101]
+
+Wed Jan 30 13:22:05 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (local_push_gen): warn assigned but unused variables also in
+ toplevel, except for -e option. [Feature #7730] [ruby-core:51580]
+
+Wed Jan 30 13:17:53 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * cont.c (cont_restore_thread): svar should be separate per fibers.
+ [ruby-core:51331] [Bug #7678]
+
+Wed Jan 30 07:15:04 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * re.c (reg_operand): Simplify and reuse error handling [Bug #7539]
+
+ * test/ruby/test_regexp.rb: Test for above
+
+Wed Jan 30 07:00:16 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * object.c: Improve error for failed implicit conversions [Bug #7539]
+
+ * error.c: Adapt rdoc
+
+ * test/ruby/test_object.rb: Test for above
+
+Tue Jan 29 21:40:12 2013 Tanaka Akira <akr@fsij.org>
+
+ * lib/net/http/generic_request.rb (encode_multipart_form_data): remove
+ tempfile explicitly.
+
+Tue Jan 29 19:27:18 2013 Benoit Daloze <eregontp@gmail.com>
+
+ * array.c: Improve documentation about
+ comparison by hash for concerned methods. [ruby-core:51266]
+
+Tue Jan 29 17:03:28 2013 Koichi Sasada <ko1@atdot.net>
+
+ * vm_backtrace.c: fix issue of rb_debug_inspector_open().
+ The order of making binding should be stack (frame) top to bottom.
+ [Bug #7635]
+ And also fix issue of collecting klass. Collecting klass is same
+ as TracePoint#defined_class.
+ (previous version, it returns T_ICLASS (internal objects).
+
+ * test/-ext-/debug/test_debug.rb: add a test.
+
+ * ext/-test-/debug/extconf.rb, init.c, inspector.c: ditto.
+
+ * vm_backtrace.c: remove magic number and add enum CALLER_BINDING_*.
+
+ * vm_backtrace.c, include/ruby/debug.h: add new C api (experimental)
+ rb_debug_inspector_frame_self_get().
+
+ * vm.c, vm_core.h, vm_trace.c: move decl. of
+ rb_vm_control_frame_id_and_class() and constify first parameter.
+
+Tue Jan 29 16:50:58 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_trace.c (rb_tracepoint_enable, rb_tracepoint_disable): check safe
+ level as well as set_trace_func.
+
+ * vm_trace.c (set_trace_func, thread_{add,set}_trace_func_m): check
+ safe level as well as 1.8.
+
+Tue Jan 29 16:49:19 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * proc.c (rb_mod_method_arity): return original arity of the method if
+ aliased because of visibility change, like as Method#arity.
+
+Tue Jan 29 12:05:18 2013 Tanaka Akira <akr@fsij.org>
+
+ * test/ruby/test_marshal.rb: remove temporally files early.
+
+ * test/ruby/test_process.rb: ditto.
+
+ * test/psych/test_exception.rb: ditto.
+
+Tue Jan 29 09:26:20 2013 Shugo Maeda <shugo@ruby-lang.org>
+
+ * ext/socket/socket.c (sock_s_pack_sockaddr_un): calculate the
+ correct address length of an abstract socket.
+
+ * test/socket/test_unix.rb: related test.
+
+Mon Jan 28 18:02:16 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_backtrace.c (rb_debug_inspector_frame_{class,binding,iseq}_get):
+ use long as index as well as RARRAY_LEN().
+
+Mon Jan 28 17:51:38 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/ruby/envutil.rb (assert_separately): imply no core dump.
+
+Mon Jan 28 12:32:31 2013 Tanaka Akira <akr@fsij.org>
+
+ * ext/fcntl/fcntl.c: update document. use "file descriptor" instead
+ of "file handle" because it is not used other Ruby documents and
+ it is confusing with Windows file handle.
+ correct F_DUPFD behavior.
+
+Sat Jan 26 22:39:12 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * marshal.c (w_object): dump instance variables of the result of
+ marshal_dump not the original object. [ruby-core:51163] [Bug #7627]
+
+ * complex.c (nucomp_marshal_dump): need to copy instance variables.
+
+ * rational.c (nurat_marshal_dump): ditto.
+
+Sat Jan 26 13:35:56 2013 Eric Hodel <drbrain@segment7.net>
+
+ * ext/fcntl/fcntl.c: Document Fcntl constants
+
+Sat Jan 26 12:54:40 2013 Eric Hodel <drbrain@segment7.net>
+
+ * hash.c (rb_env_size): Restored documentation for ENV.size
+
+ * lib/drb/drb.rb: Documented DRb::DRb#run.
+
+ * lib/erb.rb (class ERB): Improved documentation of ERb.
+
+ * transcode.c: Documented Encoding::Converter constants.
+
+Sat Jan 26 10:09:57 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/webrick/accesslog.rb: Improved WEBrick documentation.
+ * lib/webrick/cgi.rb: ditto.
+ * lib/webrick/config.rb: ditto.
+ * lib/webrick/cookie.rb: ditto.
+ * lib/webrick/httpauth/authenticator.rb: ditto.
+ * lib/webrick/httpauth/basicauth.rb: ditto.
+ * lib/webrick/httpauth/digestauth.rb: ditto.
+ * lib/webrick/httpproxy.rb: ditto.
+ * lib/webrick/httprequest.rb: ditto.
+ * lib/webrick/httpresponse.rb: ditto.
+ * lib/webrick/https.rb: ditto.
+ * lib/webrick/httpserver.rb: ditto.
+ * lib/webrick/httpservlet/cgihandler.rb: ditto.
+ * lib/webrick/httpservlet/filehandler.rb: ditto.
+ * lib/webrick/httpservlet/prochandler.rb: ditto.
+ * lib/webrick/httputils.rb: ditto.
+ * lib/webrick/httpversion.rb: ditto.
+ * lib/webrick/log.rb: ditto.
+ * lib/webrick/server.rb: ditto.
+ * lib/webrick/ssl.rb: ditto.
+ * lib/webrick/utils.rb: ditto.
+ * lib/webrick/version.rb: ditto.
+
+Sat Jan 26 08:29:33 2013 Shugo Maeda <shugo@ruby-lang.org>
+
+ * ext/socket/raddrinfo (rsock_unix_sockaddr_len): renamed from
+ rsock_unixpath_len, because it returns not the length of the path,
+ but the length of a socket address for the path.
+
+Sat Jan 26 01:12:23 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_io.rb (test_ioctl_linux): skip if a platform is
+ not x86 because linux ioctl request number depend on cpu arch.
+ At least, alpha, mips, sparc and ppc have a different number.
+ [Bug #7718] [ruby-core:51544]
+
+Fri Jan 25 19:14:24 2013 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * ext/win32ole/win32ole.c: use TlsAlloc instead of __declspec(thread)
+ to avoid SEGV if win32ole.so loaded with LoadLibrary in Windows
+ XP or earlier.
+
+Fri Jan 25 16:47:31 2013 Shugo Maeda <shugo@ruby-lang.org>
+
+ * ext/socket/raddrinfo.c (rsock_unixpath_len, init_unix_addrinfo),
+ ext/socket/unixsocket.c (unixsock_connect_internal,
+ rsock_init_unixsock): calculate the correct address length of
+ an abstract socket. Without this fix, sizeof(struct sockaddr_un)
+ is specified as the length of an abstract socket for bind(2) or
+ connect(2), so the address of the socket is filled with extra NUL
+ characters. See unix(7) for details.
+
+ * ext/socket/lib/socket.rb (unix_server_socket): don't access the
+ file system if the platform is Linux and path starts with NUL,
+ which means that the socket is an abstract socket.
+
+ * test/socket/test_unix.rb: related test.
+
+Fri Jan 25 13:02:27 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/drb/drb.rb: Updated documentation based on patch from Vincent
+ Batts. [ruby-trunk - Bug #7714]
+ * lib/drb/ssl.rb: ditto.
+
+Fri Jan 25 12:23:29 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/drb/drb.rb: Improved documentation by adding or hiding methods.
+ * lib/drb/eq.rb: ditto.
+ * lib/drb/extserv.rb: ditto.
+ * lib/drb/gw.rb: ditto.
+ * lib/drb/invokemethod.rb: ditto.
+ * lib/drb/observer.rb: ditto.
+ * lib/drb/ssl.rb: ditto.
+ * lib/drb/timeridconv.rb: ditto.
+ * lib/drb/unix.rb: ditto.
+
+ * sample/drb/gw_cu.rb: Fixed bug in DRb gateway sample.
+
+Fri Jan 25 12:01:56 2013 Koichi Sasada <ko1@atdot.net>
+
+ * vm_core.h: modify a comment about rb_iseq_t::local_size.
+ A patch by davidbalbert (David Albert) [Bug #6750]
+
+Fri Jan 25 10:36:31 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/mkmf.rb: Documented MakeMakefile constants. Hide implementation
+ details from RDoc
+
+Fri Jan 25 10:04:07 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/compatibility.rb: Hide compatibility shims from RDoc
+
+ * lib/rubygems/config_file.rb: Hide RbConfig use from RDoc
+
+ * lib/rubygems/test_case.rb: Added note to use realpath when 1.8
+ support is dropped.
+
+Fri Jan 25 09:14:43 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/generator/darkfish.rb: Fixed debug message. RDoc bug #174
+ by Thomas Leitner.
+
+ * lib/rdoc/store.rb: Fixed deletion of ri attribute data when a class
+ was loaded then saved. RDoc bug #171 by Thomas Leitner.
+ * test/rdoc/test_rdoc_store.rb: Test for above.
+
+Thu Jan 24 19:55:25 2013 Shota Fukumori <her@sorah.jp>
+
+ * NEWS (yaml): Write about bundled libyaml.
+
+Thu Jan 24 16:54:34 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/calling_methods.rdoc: Added a Method Lookup section.
+ * doc/syntax/refinements.rdoc (Method Lookup): Clarified that
+ refinement methods are looked up in classes, not instances.
+
+Thu Jan 24 16:49:17 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * enum.c (enum_zip): Fix error message
+
+ * array.c (take_items): Same, for Array#zip
+
+Thu Jan 24 16:47:26 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * enumerator.c (lazy_zip): raise error for bad arguments
+ [Bug #7706]
+
+Thu Jan 24 16:05:08 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * enumerator.c: Optimize Lazy#zip when passed only arrays
+ [Bug #7706]
+
+Thu Jan 24 15:21:17 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * enumerator.c: Fix state handling for Lazy#zip,{drop_take}{_while}
+ [bug #7696] [bug #7691]
+
+Thu Jan 24 11:43:47 2013 Narihiro Nakamura <authornari@gmail.com>
+
+ * eval.c (f_current_dirname): Add documentation about "__dir__
+ returns always an absolute path". [Bug #7729]
+
+Thu Jan 24 10:28:30 2013 Eric Hodel <drbrain@segment7.net>
+
+ * NEWS (RDoc): Added mention of page support and markdown support.
+
+Thu Jan 24 09:40:13 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/refinements.rdoc: Added refinements document based on
+ the specification from the wiki.
+ * doc/syntax.rdoc: Added link to refinements document.
+
+Wed Jan 23 16:29:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_spawn, rb_w32_aspawn_flags): fix missing
+ initialization. pointed out by phasis68 (Heesob Park) at
+ [ruby-core:51579]. [Bug #7721]
+
+Wed Jan 23 16:18:04 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (MakeMakefile#try_constant): fix for large unsigned.
+
+ * lib/mkmf.rb (MakeMakefile#try_constant): fix for larger constants.
+
+ * test/mkmf/test_constant.rb: tests for try_constant.
+ TODO: define check_constant and use it.
+
+Wed Jan 23 13:35:37 2013 Koichi Sasada <ko1@atdot.net>
+
+ * thread_pthread.c (ruby_init_stack): ignore `STACK_END_ADDRESS'
+ if Ruby interpreter is running on co-routine.
+ [Feature #2294]
+ https://bugs.ruby-lang.org/issues/2294#note-18
+
+Wed Jan 23 12:28:22 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_spawn, rb_w32_aspawn_flags): check the results
+ of acp_to_wstr() which can return NULL. [ruby-core:51557] [Bug #7721]
+
+Wed Jan 23 10:40:49 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/assignment.rdoc (Implicit Array Assignment): Clarify
+ that "left-hand side" means "of the assignment". Suggested by Jorge
+ Dias.
+ * doc/syntax/assignment.rdoc (Multiple Assignment): ditto.
+
+Wed Jan 23 10:34:47 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/assignment.rdoc (Local Variables and Methods): Fixed
+ example showing caching of a method's results into a local variable.
+ Added not about using an explicit receiver to call a method that
+ matches a local variable. Suggested by markov_twain on twitter.
+
+Wed Jan 23 10:20:08 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/README: Fixed typo. Patch by Pradeep Sahoo.
+ Fixes #240 on github
+
+Wed Jan 23 09:53:39 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/servlet.rb: Fixed display of site and home documentation.
+ Fixes rdoc issue #170 by Thomas Leitner.
+ * test/rdoc/test_rdoc_servlet.rb: Test for above.
+
+ * lib/rdoc/code_object.rb: Split #initialize_visibility from
+ #initialize for reuse when loading a stored object.
+ Fixes rdoc issue #171 by Thomas Leitner.
+
+ * lib/rdoc/any_method.rb: Initialize visibility for #display? For
+ rdoc issue #171
+ * lib/rdoc/attr.rb: ditto.
+ * lib/rdoc/class_module.rb: ditto.
+ * lib/rdoc/top_level.rb: ditto.
+ * test/rdoc/test_rdoc_any_method.rb: Test for above.
+ * test/rdoc/test_rdoc_attr.rb: ditto.
+ * test/rdoc/test_rdoc_class_module.rb: ditto.
+ * test/rdoc/test_rdoc_constant.rb: ditto.
+ * test/rdoc/test_rdoc_top_level.rb: ditto.
+
+Wed Jan 23 06:43:26 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/test_case.rb: Use Dir.tmpdir for rubygems tests instead
+ of ./tmp/test. Fixes [ruby-trunk - Bug #7717]
+
+Tue Jan 22 22:58:03 2013 Akinori MUSHA <knu@iDaemons.org>
+
+ * misc/ruby-electric.el (ruby-electric-curlies): Fix the bug where
+ an open curly inserted in a string is always replaced with a
+ hash sign.
+
+Mon Jan 21 15:41:33 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * tool/mkconfig.rb: BASERUBY is transient at core build.
+
+Mon Jan 21 13:51:21 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb ($extmk): traverse parent directories for the case
+ srcdir is a symlink.
+
+Sun Jan 20 23:55:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * marshal.c (w_object, r_object0): separate respond_to checks and
+ calling, and get back to the old behavior for 2.0. [Bug #7564]
+
+Sun Jan 20 22:24:28 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * tool/vpath.rb (VPath#def_options): hack for msys make, which
+ converts a command line argument to non-msys command seems like a
+ path list automagically. [Bug #7710] [ruby-core:51489]
+
+Sat Jan 19 11:35:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * struct.c (Struct.new): Document Struct.new with block
+ Patch by Hiroyuki Iwatsuki [Bug #7674]
+
+Sat Jan 19 09:52:46 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/miscellaneous.rdoc: Added section on defined?
+
+Sat Jan 19 09:27:31 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/assignment.rdoc (Local Variables and Methods): Made it
+ more clear that local variables are created by the parser, not
+ execution. Thanks to John Hawthorn.
+
+Sat Jan 19 09:15:58 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/assignment.rdoc: Improved links
+ * doc/syntax/methods.rdoc: ditto.
+
+ * doc/syntax.rdoc: Added link to assignment document
+
+Sat Jan 19 08:47:33 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/assignment.rdoc: Added a syntax document on assignment.
+
+Fri Jan 18 14:11:01 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/methods.rdoc: Added Array Decomposition.
+
+Fri Jan 18 12:54:21 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * tool/rbinstall.rb (gem): Gem.ensure_gem_subdirectories makes
+ subdirectories group-writable, so make them with $dir_mode.
+
+Fri Jan 18 11:24:33 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/win32ole/win32ole.c (ole_initialize): uninitialize OLE at thread
+ ends. [Bug #2618] [ruby-core:27634]
+
+ * ext/win32ole/win32ole.c (ole_initialize): initialize OLE for each
+ threads. [Bug #2618] [ruby-core:27634]
+
+Thu Jan 17 22:10:35 2013 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rubygems/ext/builder.rb (Gem::Ext::Builder.make): Remove
+ .time dependency from *.rb install target. It causes needless
+ *.rb install. [Bug #7698] [ruby-core:51437]
+ Reported by Tadashi Saito. Thanks!!!
+ * test/rubygems/test_gem_installer.rb
+ (TestGemInstaller#test_install_extension_and_script): Add a test
+ for the above change.
+
+Thu Jan 17 21:08:20 2013 Kouhei Sutou <kou@cozmixng.org>
+
+ * eval.c: Fix a typo in ruby_finalize() documentation.
+
+Thu Jan 17 20:28:18 2013 Benoit Daloze <eregontp@gmail.com>
+
+ * object.c: Typo in Kernel#hash documentation.
+ Patch by zed_0xff [Github Fixes #237]
+
+Thu Jan 17 10:48:56 2013 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/scalar_scanner.rb: use constants rather than
+ calculating Inf and NaN.
+
+Thu Jan 17 10:21:05 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/miscellaneous.rdoc: Added Ending an Expression and
+ indentation.
+
+Thu Jan 17 09:30:21 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/installer.rb: Untaint string when checking output
+ for $SAFE=1
+
+ * lib/rubygems/specification.rb: Keep previously loaded specs as
+ active. This prevents double loading when refreshing the gem list.
+ * test/rubygems/test_gem.rb: Test for above
+
+ * lib/rubygems.rb: Bump version to 2.0.0.rc.2
+
+Thu Jan 17 09:08:37 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/control_expressions.rdoc: Added ? : ternary if
+
+Thu Jan 17 08:36:04 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/miscellaneous.rdoc: Added documentation for alias, undef,
+ BEGIN, END.
+ * doc/syntax/modules_and_classes.rdoc (Constants): Fixed unwrapped
+ paragraph with trailing whitespace.
+ * doc/syntax/modules_and_classes.rdoc (Scope): Added section pointing
+ to alias and undef documentation.
+ * doc/syntax.rdoc: Added link to miscellaneous section.
+
+Thu Jan 17 07:50:26 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/control_expressions.rdoc (Flip-Flop): Added a section on
+ the flip-flop.
+
+Thu Jan 17 06:59:51 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/control_expressions.rdoc (if Expressions): Fixed markup
+ error. Fixes #235 on github by FlyingFoX.
+
+Thu Jan 17 06:53:58 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/literals.rdoc (Strings): Fixed typo. Fixes #236 on
+ github by Doug Yun.
+
+Wed Jan 16 18:45:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/win32ole/lib/win32ole.rb: use TracePoint to hook all thread
+ creation not only by Thread.new and to get rid of interference with
+ svar scope. [Bug #7681] [ruby-core:51365]
+
+Wed Jan 16 09:35:53 2013 Eric Hodel <drbrain@segment7.net>
+
+ * .document: Removed extra space
+ * lib/irb/lc/.document: Hide help-message
+ * lib/minitest/.document: Hide README.txt
+ * lib/rake/lib/.document: Hide project.rake
+ * lib/rdoc/generator/template/json_index/.document: Hide JavaScript
+ files
+ * lib/rubygems/ssl_certs/.document: Hide PEM files.
+
+Wed Jan 16 03:54:28 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/control_expressions.rdoc: Omit optional "then" for if and
+ unless expressions. Improved description of "a if a = 0.zero?"
+ NameError. Note that "do" for for loop is optional.
+
+Wed Jan 16 03:28:47 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/calling_methods.rdoc: Link to defining methods.
+ * doc/syntax/methods.rdoc: Link to calling methods, fixed typo.
+
+Wed Jan 16 03:15:00 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/methods.rdoc: Fixed link
+ * doc/syntax/modules_and_classes.rdoc: Fixed link
+ * doc/syntax.rdoc: Updated with links to the recently added pages
+
+Wed Jan 16 03:05:50 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/control_expressions.rdoc (redo Statement): Added note
+ about retry.
+ * doc/syntax/exceptions.rdoc: Added retry statement
+
+Tue Jan 15 23:12:34 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * tool/vpath.rb (VPath#list): default separator to PATH_SEPARATOR from
+ configure.in for make, not same name constant of File for use in ruby.
+
+Tue Jan 15 22:30:04 2013 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/irb/ext/save-history.rb: identify rightly a status of a
+ history file that already exists [Bug #7694]. Thanks Nobuhiro IMAI
+ for this patch.
+
+Tue Jan 15 15:55:28 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/control_expressions.rdoc: Added description of control
+ expressions in ruby.
+
+Tue Jan 15 13:33:00 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/methods.rdoc (Method Names): Added method names including
+ operator methods.
+ * doc/syntax/methods.rdoc (Return Values): Added note that assignment
+ methods ignore return values.
+ * doc/syntax/precedence.rdoc: Added document describing precedence.
+
+Tue Jan 15 11:49:31 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/methods.rdoc (Block Argument): Added section on block
+ argument. Thanks to Andy Lindeman.
+
+Tue Jan 15 10:54:59 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/calling_methods.rdoc (Arguments): Added improved
+ introduction to arguments including passing style and lazy
+ evaluation. Thanks to Matt Aimonetti.
+ * doc/syntax/calling_methods.rdoc (Positional Arguments): Added
+ description for sending a message to a method with *arguments
+ * doc/syntax/calling_methods.rdoc (Default Positional Arguments):
+ Added description. Thanks to Andy Lindeman.
+ * doc/syntax/calling_methods.rdoc (Block Local Arguments):
+ Added description of block locals. Thanks to Justin Collins.
+ * doc/syntax/calling_methods.rdoc (Hash to Keyword Arguments): Added
+ section describing ** operator. Thanks to Justin Collins.
+
+Tue Jan 15 10:40:18 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * test_lazy_enumerator: Test that map & flat_map also require a block
+
+Tue Jan 15 09:22:47 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c (gvl_init): Reset gvl.wait_yield explicitly when
+ fork()ing. Patch by Apollon Oikonomopoulos. Thanks!
+ [Bug #7693][ruby-core:51424]
+
+Tue Jan 15 09:27:56 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/calling_methods.rdoc (Receiver): Added :: as pointed out
+ by Tony Arcieri
+ * doc/syntax/calling_methods.rdoc (Block Argument): Fixed { } block
+ examples as pointed out by David Copeland.
+
+Tue Jan 15 09:10:29 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/methods.rdoc (Array/Hash Argument): Moved above Keyword
+ Arguments
+ * doc/syntax/methods.rdoc (Keyword Arguments): Described ** for
+ gathering arbitrary keyword arguments.
+
+Tue Jan 15 08:56:37 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/calling_methods.rdoc: Added document describing method
+ calls.
+
+Tue Jan 15 07:39:21 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/top_level.rb: Fixed extension trimming for page names in
+ RDoc HTML output. [ruby-trunk - Bug #7673]
+ * test/rdoc/test_rdoc_top_level.rb: Test for above.
+
+Mon Jan 14 23:06:41 2013 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/irb/ext/save-history.rb: outputs its history to
+ owner-only-readable file and change the permission of a file that
+ already exists [Bug #7694]. Thanks Nobuhiro IMAI for bug reports.
+
+Mon Jan 14 17:12:48 2013 Shugo Maeda <shugo@ruby-lang.org>
+
+ * enumerator.c (lazy_flat_map_func): flat_map should call each only
+ when the value of a block returns a forcable object.
+ [ruby-core:51401] [Bug #7690]
+
+ * enumerator.c (lazy_flat_map): add documentation.
+
+ * test/ruby/test_lazy_enumerator.rb: related test.
+
+Mon Jan 14 16:42:28 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * enumerator.c: Require block for Lazy#{take|drop}_while [Bug #7692]
+
+Mon Jan 14 14:41:00 2013 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_to_s): use CRuby style.
+
+Mon Jan 14 14:39:00 2013 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c: use `RB_TYPE_P(x, t)` instead of
+ `TYPE(x) == t`.
+
+Mon Jan 14 10:18:56 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * enumerator.c: Fix size for Enumerator::Lazy#flat_map
+
+Mon Jan 14 07:12:52 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * lib/matrix/lup_decomposition: Fix bugs with LUP Decomposition of
+ rectangular matrices. [rubyspec:ba849801a85]
+
+Mon Jan 14 06:46:53 2013 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * regparse.c (add_ctype_to_cc): don't check dup warn on adding
+ negative ctype to cclass. [Bug #7471] [ruby-core:50344]
+
+Mon Jan 14 06:06:03 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * lib/matrix/eigenvalue_decomposition: Backport bugfix of Jama 1.0.3
+ [rubyspec:df87040be371]
+
+Sun Jan 13 16:45:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * ext/psych/yaml/scanner.c: Fix typos, patch by James Dabbs
+ [Github tenderlove/psych#118]
+
+Sun Jan 13 15:00:00 2013 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_sub):
+ need to specify precision for converting Rational and Float.
+ [ruby-dev:46544] [Bug #7404]
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_mult): ditto.
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_divide): ditto.
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_DoDivmod): ditto.
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_divremain): ditto.
+
+ * test/bigdecimal/test_bigdecimal.rb: add tests for the above fixes.
+
+Sun Jan 13 14:48:55 2013 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * lib/matrix/eigenvalue_decomposition: Fix eigensystem with complex
+ eigenvectors. Patch by pypypy567.
+ [Bug #7208] [ruby-dev:46251] [rubyspec:242f8e55bd]
+
+ * lib/matrix/lup_decomposition.rb: Fix error for rectangular matrices
+ [bug#7620] [ruby-core:51118] [rubyspec:41f833ee2]
+
+Sun Jan 13 14:06:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/irb.rb, lib/prime.rb: Typos in overview
+ Patch by Ershad K [Github Fixes #234]
+
+Sun Jan 13 13:40:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/open3.rb : Typo in Open3 overview. Patch by zed_0xff
+ [Github Fixes #233]
+
+Sat Jan 12 17:42:00 2013 Kenta Murata <mrkn@cookpad.com>
+
+ * numeric.c (do_coerce): fix for the exceptions which the coerce
+ method raises. The optimization done by r38756 is preserved.
+ [Bug #7645] [ruby-core:51213]
+
+Sat Jan 12 16:12:46 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/setup.mak (-runtime-): see msvcrt from link header on mswin
+ instead of running testing executable file, for cross compiling.
+
+Sat Jan 12 08:58:47 2013 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/to_ruby.rb: merge key values that
+ contain something besides a hash should be left in tact.
+
+ * test/psych/test_merge_keys.rb: test for change
+
+Sat Jan 12 07:52:47 2013 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * ext/win32ole/win32ole.c (ole_set_byref): support VT_UI8|VT_BYREF,
+ VT_I8|VT_BYREF in cygwin and mingw.
+
+ * ext/win32ole/win32ole.c (ole_variant2val): ditto.
+
+ * test/win32ole/test_win32ole_variant.rb (test_s_new_with_i8_byref):
+ ditto.
+
+ * test/win32ole/test_win32ole_variant.rb (test_s_new_with_ui8_byref):
+ ditto.
+
+Sat Jan 12 02:45:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * man/ruby.1 (options): include --*-encoding from r38784
+
+Fri Jan 11 23:34:48 2013 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * ruby.c (usage): sort --*-encoding in help. (same order of -E)
+
+Fri Jan 11 16:56:29 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * tool/mkconfig.rb: use configured libdir value to fix
+ --enable-load-relative on systems where libdir is not default value,
+ overridden in config.site files. [ruby-core:47267] [Bug #6903]
+
+Fri Jan 11 11:59:32 2013 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * string.c (dispose_string): use rb_str_free for freeing string in
+ parse.y. by Sokolov Yura <funny.falcon@gmail.com>
+ https://github.com/ruby/ruby/pull/87 fix GH-87
+
+Fri Jan 11 09:56:22 2013 Shugo Maeda <shugo@ruby-lang.org>
+
+ * insns.def (defineclass): private constants should not be accessed
+ by scoped module definitions. The bug was introduced in r38495.
+
+ * test/ruby/test_module.rb: related test.
+
+Fri Jan 11 02:11:59 2013 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/rbconfig/obsolete.rb (respond_to_missing?): use send because
+ RbConfig.respond_to_missing? is now private.
+
+Thu Jan 10 22:00:58 2013 Koichi Sasada <ko1@atdot.net>
+
+ * vm_core.h (VM_DEBUG_BP_CHECK): set 0 as default.
+ This flag specifies checking BP consistency on each frame popping.
+ Now, we don't have any trouble on it, so I remove it.
+ If you feel any bugs about VM execution, then set it to 1.
+
+Thu Jan 10 21:03:05 2013 TAKANO `takano32' Mitsuhiro <tak@no32.tk>
+
+ * cont.c: define FIBER_USE_NATIVE as 0 in ia64.
+
+Thu Jan 10 19:39:05 2013 TAKANO `takano32' Mitsuhiro <tak@no32.tk>
+
+ * thread.c: fix RB_GC_SAVE_MACHINE_REGISTER_STACK define for ia64.
+
+Thu Jan 10 17:45:39 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * Makefile.in, win32/Makefile.sub ($(MKFILES)): continue if Makefile
+ unchanged.
+
+Thu Jan 10 16:31:20 2013 Shugo Maeda <shugo@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_search_super_method): raise a TypeError
+ instead of a NotImplementedError if self is not an instance of the
+ current class. [ruby-dev:39772] [Bug #2402]
+
+Thu Jan 10 16:47:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/tk/extconf.rb (find_tcltk_header): use have_header instead of
+ try_cpp, which is incredibly slow with VC.
+
+Thu Jan 10 15:55:28 2013 Shugo Maeda <shugo@ruby-lang.org>
+
+ * numeric.c (do_coerce): remove an unused variable.
+
+Thu Jan 10 15:35:55 2013 Shugo Maeda <shugo@ruby-lang.org>
+
+ * tool/gen_dummy_probes.rb: remove comments in probes.d to fix the
+ compilation error introduced by r38755.
+
+Thu Jan 10 11:15:04 2013 Kenta Murata <mrkn@cookpad.com>
+
+ * numeric.c (do_coerce): speed optimization by using rb_check_funcall
+ instead of rb_rescue + rb_funcall.
+ This fix is based on the patch by Benoit Daloze.
+ [Bug #7645] [ruby-core:51213]
+
+Thu Jan 10 11:15:04 2013 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * probes.d: updating probes to be more symmetrical, adding
+ documentation.
+
+ * load.c: ditto
+
+Thu Jan 10 04:23:07 2013 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/scalar_scanner.rb: strip trailing dots from
+ floats so that Float() will not raise an exception.
+
+ * test/psych/test_numeric.rb: test to ensure "1." can be loaded
+
+ * test/psych/test_string.rb: make sure "1." can round trip
+
+Thu Jan 10 03:38:40 2013 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: ascii only binary strings
+ will be dumped as unicode. Thanks Paul Kunysch!
+
+ * test/psych/test_string.rb: appropriate test
+
+Thu Jan 10 03:29:55 2013 Koichi Sasada <ko1@atdot.net>
+
+ * compile.c (compile_array_): modify wrong optimization.
+ A script "[print(1)]; print(2)" should output "12".
+ However, the compiler had eliminated "[print(1)]" expression
+ because it is void expression (unused array).
+ Of course, side-effect should be remained.
+ This issue is reported by Masaya Tarui.
+
+ * bootstraptest/test_literal.rb: add a test.
+
+Wed Jan 9 22:07:42 2013 Masaki Matsushita <glass.saga@gmail.com>
+
+ * load.c (load_lock): if thread shield is destroyed and there is no
+ waiting thread, insert new thread shield into load_table.
+ [Bug #7530] [ruby-core:50645]
+
+Wed Jan 9 21:43:32 2013 Masaki Matsushita <glass.saga@gmail.com>
+
+ * load.c (load_lock): revert r38744. it should acquire new thread
+ shield.
+
+Wed Jan 9 15:40:18 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm.c (th_init, ruby_thread_init): initialize root_svar with Qnil,
+ since lep_svar_place() expects uninitialized svar to be nil, not 0.
+
+Wed Jan 9 13:20:23 2013 Masaki Matsushita <glass.saga@gmail.com>
+
+ * test/ruby/test_require.rb: improve test for r38744.
+ fix to use Tempfile instead of temporary file in current directory.
+ the patch is from nobu (Nobuyoshi Nakada).
+
+Wed Jan 9 09:53:23 2013 Masaki Matsushita <glass.saga@gmail.com>
+
+ * load.c (load_lock): fix not to delete thread shield twice.
+ it may break the shield locked by another thread.
+ [Bug #7530] [ruby-core:50645]
+
+ * test/ruby/test_require.rb: a test for above.
+
+Wed Jan 9 02:13:22 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/ruby.h (RBasic): to be aligned on a VALUE size
+ boundary. [Bug #7647]
+
+Tue Jan 8 14:41:41 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_core.h (rb_iseq_t): move flip_cnt from struct iseq_compile_data,
+ because it has same life span as enclosing iseq. [Bug #7671]
+ [ruby-core:51296]
+
+Mon Jan 7 23:43:00 2013 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (rmpd_power_by_big_decimal):
+ add RB_GC_GUARD to prevent the intermediate object is GCed too early.
+ This patch was made by Yusuke Endoh. [Bug #7044] [ruby-core:47632]
+
+ * test/bigdecimal/test_bigdecimal.rb: add a reproduction test for
+ the issue [Bug #7044]
+
+Mon Jan 7 21:40:36 2013 Shugo Maeda <shugo@ruby-lang.org>
+
+ * vm_method.c (Init_eval_method): main.public and main.private
+ should be private.
+
+ * proc.c (Init_Proc): main.define_method should be private.
+
+ * test/ruby/test_module.rb: related test.
+
+Mon Jan 7 20:48:47 2013 Shugo Maeda <shugo@ruby-lang.org>
+
+ * eval.c (Init_eval): main.include should be private.
+ [ruby-core:51293] [Bug #7670]
+
+ * test/ruby/test_module.rb (test_top_include_is_private): a new test
+ for the above change.
+
+Mon Jan 7 20:29:50 2013 Shugo Maeda <shugo@ruby-lang.org>
+
+ * NEWS: remove description about `require "refinement"'.
+
+Mon Jan 7 20:15:49 2013 Shugo Maeda <shugo@ruby-lang.org>
+
+ * eval.c (Init_eval): enable Refinements by default.
+ [ruby-core:51286] [Bug #7667]
+
+ * eval.c (rb_mod_refine, top_using): show a warning when
+ Module#refine or main.using is called at the first time.
+
+ * ext/refinement/*: removed the extension library "refinement".
+
+ * test/ruby/test_refinement.rb: fix for the above changes.
+
+Mon Jan 7 17:34:22 2013 Koichi Sasada <ko1@atdot.net>
+
+ * include/ruby/ruby.h (RUBY_EVENT_SPECIFIED_LINE): make it special.
+ This flag is not contained by RUBY_EVENT_TRACEPOINT_ALL.
+ This event is experimental one. It is possible to remove/rename
+ flag name after 2.0.1.
+
+ * vm_trace.c (get_event_id): return :line if SPECIFIED_LINE was
+ occurred. `:specified_line' never been returned.
+
+Mon Jan 7 15:42:10 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (f_kwrest): allow bare kwrest_mark as valid syntax. its
+ semantics is still undefined. [Bug #7662] [ruby-core:51269]
+
+Mon Jan 7 15:31:58 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (f_kwrest): reject duplicated kwrest argument name.
+
+Mon Jan 7 15:24:10 2013 Koichi Sasada <ko1@atdot.net>
+
+ * vm_trace.c (rb_threadptr_exec_event_hooks_orig): pop tag before
+ JUMP_TAG() if frame is `finish' frame.
+ Without this patch, there is an inconsistency between control
+ frame stack and tags stack.
+ [Bug #7668]
+
+ * test/ruby/test_settracefunc.rb: add a test for above.
+
+Mon Jan 7 15:21:48 2013 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * Makefile.in, common.mk (fake, yes-fake, no-make): these dependencies
+ are not platform dependent.
+
+ * win32/Makefile.sub ($(arch)-fake.rb): workaround.
+
+Mon Jan 7 12:09:24 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_callee_setup_arg_complex, vm_yield_setup_block_args):
+ set keyrest hash after making rest array, so that the last element
+ will not be overwritten. [ruby-core:51278] [Bug #7665]
+
+Mon Jan 7 09:37:24 2013 Koichi Sasada <ko1@atdot.net>
+
+ * NEWS: add a NEWS entry about RubyVM.
+
+Sun Jan 6 19:06:57 2013 Yuki Yugui Sonoda <yugui@yugui.jp>
+
+ * win32/Makefile.sub: Fix build with VC.
+ Patch by Charlie Savage. Fixes [ruby-core:51261]
+
+Sun Jan 6 18:43:48 2013 Yuki Yugui Sonoda <yugui@yugui.jp>
+
+ * bootstraptest/test_io.rb: add a test for [ruby-dev:46834].
+
+ * io.c (rb_cloexec_fcntl_dupfd) Use an emulation with dup(2) when
+ fcntl(2) and/or F_DUPFD is unavailable.
+ Suggested by akr.
+
+ * configure.in (HAVE_FCNTL): NativeClient does not provide fcntl(2).
+
+Sun Jan 6 11:11:26 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/modules_and_classes.rdoc: Fixed typo.
+
+Sun Jan 6 05:35:18 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/modules_and_classes.rdoc: Added singleton classes
+ documentation.
+
+Sun Jan 6 02:22:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/webrick/httpservlet/abstract.rb (WEBrick::HTTPServlet): Typo in
+ example. Patch by shlensky [Fixes #232 on github]
+
+Sat Jan 5 21:15:10 2013 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/http/generic_request.rb:
+ Amazon ECA API and GTE/1.3 disallow requests whose host has port
+ number if its port number equals to default port number of the
+ scheme. [Bug #7650]
+
+Sat Jan 5 13:58:59 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/modules_and_classes.rdoc: Improved description of methods
+ on a module or class as suggested by Tobias Buhlmann
+
+Sat Jan 5 13:38:07 2013 Masaki Matsushita <glass.saga@gmail.com>
+
+ * string.c (rb_str_enumerate_lines): fix invalid byte sequence error
+ when a separator is passed. The patch is from yoshidam (Yoshida
+ Masato).
+ [Bug #7646] [ruby-dev:46827]
+
+ * test/ruby/test_string.rb: a test for above.
+
+Sat Jan 5 12:25:42 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/ruby/envutil.rb (Test::Unit::Assertions#assert_in_out_err):
+ check stdout and stderr both.
+
+Sat Jan 5 10:21:54 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/modules_and_classes.rdoc: Added documentation of syntax
+ for Modules and Classes.
+ * doc/syntax/methods.rdoc: Moved some text to the Modules and
+ Classes syntax document.
+
+Sat Jan 5 08:38:27 2013 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/methods.rdoc: Added return values and scope sections,
+ slightly modified from the original patch. Fixes #227 from github by
+ Dave Brown.
+
+Sat Jan 5 08:21:41 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (rb_cloexec_fcntl_dupfd): improve #ifdef condition.
+ * io.c (rb_maygvl_fd_fix_cloexec): ditto.
+
+Sat Jan 5 07:54:59 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/commands/cleanup_command.rb: Clean all possible gems
+ using multiple passes. Fixes RubyGems bug #422. Refactored for
+ maintainability.
+ * test/rubygems/test_gem_commands_cleanup_command.rb: Test for above.
+
+Sat Jan 5 05:04:39 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * gc.c (vm_xrealloc): add a few comment why we avoid realloc(ptr,0).
+
+Fri Jan 4 20:17:06 2013 Yuki Yugui Sonoda <yugui@yugui.jp>
+
+ * Makefile.in (RBCONFIG): Moved from common.mk in order to use the
+ variable in Makefile.in.
+
+ * win32/Makefile.sub (RBCONFIG): Ditto.
+
+Fri Jan 4 19:45:50 2013 Yuki Yugui Sonoda <yugui@yugui.jp>
+
+ * common.mk (run, parse): Use BTESTRUBY instead of MINIRUBY to handle
+ cross-compiling cases, e.g. NativeClient.
+
+Fri Jan 4 17:58:16 2013 Yuki Yugui Sonoda <yugui@yugui.jp>
+
+ * common.mk (yes-btest): btest depends on also $(arch)-fake.rb and
+ rbconfig.rb on building for NativeClient.
+
+ * Makefile.in (fake): Avoid generating $(arch)-fake.rb unless cross
+ compiling.
+
+ * configure.in (CROSS_COMPILING): New substitution.
+
+Fri Jan 4 16:26:45 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/doctor.rb: Process directories in order in case the
+ filesystem doesn't. [ruby-trunk - Bug #7618]
+
+ Process specifications before other directories in case of bugs.
+ * test/rubygems/test_gem_doctor.rb: Test for above.
+
+ * lib/rubygems.rb: Updated version.
+
+ * test/rubygems/test_require.rb: Fixed double require of
+ benchmark.rb. RubyGems bug #420.
+
+ * test/rubygems/test_gem_commands_check_command.rb: Fixed unused
+ variable warnings.
+ * test/rubygems/test_gem_commands_query_command.rb: ditto
+ * test/rubygems/test_gem_installer.rb: ditto
+
+Fri Jan 4 15:05:25 2013 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/cross_reference.rb: Fixed matching of C#=== or #===. RDoc
+ bug #164
+ * test/rdoc/test_rdoc_cross_reference.rb: Test for above.
+
+ * lib/rdoc/parser/changelog.rb: Fixed parsing of dates. RDoc bug #165
+ * test/rdoc/test_rdoc_parser_changelog.rb: Test for above.
+
+ * lib/rdoc/parser.rb: Fixed parsing multibyte files with incomplete
+ characters at byte 1024. [ruby-trunk - Bug #6393]
+ Fixed handling of -E. [ruby-trunk - Bug #6392]
+ * test/rdoc/test_rdoc_options.rb: Test for above.
+ * test/rdoc/test_rdoc_parser.rb: ditto.
+ * test/rdoc/test_rdoc_parser_c.rb: ditto.
+ * test/rdoc/test_rdoc_parser_changelog.rb: ditto.
+ * test/rdoc/test_rdoc_parser_markdown.rb: ditto.
+ * test/rdoc/test_rdoc_parser_rd.rb: ditto.
+ * test/rdoc/test_rdoc_rdoc.rb: ditto.
+
+ * lib/rdoc/tom_doc.rb: Fixed parsing of [] in TomDoc arguments list.
+ RDoc bug #167
+ * test/rdoc/test_rdoc_tom_doc.rb: Test for above.
+
+ * lib/rdoc.rb: Update version.
+
+Fri Jan 4 11:51:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/forwardable.rb: Fix rdoc parameters for ::def_single_delegator.
+ Patch by Vladimir Andrijevik [Github Fixes #230]
+
+Fri Jan 4 00:35:11 2013 Yuki Yugui Sonoda <yugui@yugui.jp>
+
+ Fix failures on btest for NativeClient.
+ * bootstraptest/runner.rb (nacl?): New method to distinguish NaCl
+ cross build.
+
+ * bootstraptest/test_io.rb: Skip unsupported operations.
+
+ * bootstraptest/test_literal.rb: ditto.
+
+Fri Jan 4 00:29:40 2013 Yuki Yugui Sonoda <yugui@yugui.jp>
+
+ * io.c (rb_cloexec_fcntl_dupfd): Fix failures in
+ bootstrap_test/test_io.rb. NativeClient does not support F_DUPFD
+ but supports dup2(2).
+
+Thu Jan 3 17:46:50 2013 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rexml/element.rb (REXML::Elements#add): Remove too much
+ "elements" in document. Sorry...
+
+Thu Jan 3 17:42:32 2013 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rexml/element.rb (REXML::Elements#each): Add missing
+ "elements" in document. [ruby-talk:402713]
+ Reported by Wesley Rishel. Thanks!!!
+
+Thu Jan 3 15:13:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * ext/psych/lib/psych.rb (Psych.load): Return value of
+ Psych::SyntaxError.message should be same as example.
+ Patch by Ippei Obayashi [ruby-core:51193] [Bug #7636]
+
+Thu Jan 3 14:58:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/forwardable.rb (SingleForwardable): Fix example in overview
+ Patch by Vladimir Andrijevik [Github Fixes #231]
+
+Thu Jan 3 14:32:47 2013 Yuki Yugui Sonoda <yugui@yugui.jp>
+
+ * configure.in (OBJCOPY): Fixes build error for NativeClient.
+ Avoid disabling OBJCOPY for NativeClient.
+
+ * thread_pthread.c (rb_reserved_fd_p): USE_SLEEPY_TIMER_THREAD is
+ always defined. Fixes compilation error for NativeClient.
+
+Wed Jan 02 03:09:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * ext/zlib/zlib.c (Zlib::GzipReader): Fix typo by zed_0xff
+ [Fixes Github #229]
+
+Wed Jan 02 02:29:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * hash.c (rb_hash_update): Revert documentation from r38672
+ See: https://github.com/ruby/ruby/pull/228#issuecomment-11791013
+
+Wed Jan 02 02:16:00 2013 Zachary Scott <zachary@zacharyscott.net>
+
+ * hash.c (rb_hash_update): Documentation for Hash#merge and shallow
+ copies Patch by Yorick Peterse [Fixes Github #228]
+
+Mon Dec 31 15:10:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * vm_backtrace.c: Add documentation for Kernel#caller_locations,
+ Kernel#caller, and Thread::Backtrace::Location
+
+Mon Dec 31 13:05:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * test/ruby/test_backtrace.rb: Add test for r37957 [Feature #7434]
+
+Sun Dec 30 23:33:36 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (simple_re_meta): escaped closing parenthesis has different
+ meaning. [Bug #7610] [ruby-core:51088]
+
+Sun Dec 30 12:09:47 2012 Charlie Somerville <charlie@charliesomerville.com>
+
+ * configure.in: use 4 argument form of AC_CHECK_HEADERS to force
+ autoconf to use compiler's result
+
+Sun Dec 30 10:58:04 2012 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * test/ruby/test_keyword.rb: add a test for passing hash
+ as a last argument. [ruby-dev:46712] [Bug #7529]
+
+Sun Dec 30 10:51:29 2012 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * vm_insnhelper.c: set keyword hash on Proc/block calls.
+ [ruby-core:51172] [Bug #7630]
+
+ * test/ruby/test_keyword.rb: add tests for above.
+
+Sat Dec 29 21:57:11 2012 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/irb/completion.rb: treat rightly completion for symbol on irb
+ [Bug #7632].
+
+Sat Dec 29 21:51:30 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * ext/curses/curses.c (window_cury, window_curx, window_maxy,
+ window_maxx, window_begy, window_begx): use RB_UNUSED_VAR()
+ to suppress unused-but-set-variable warnings.
+
+Sat Dec 29 16:45:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * iseq.c (RubyVM::InstructionSequence): rdoc formatting
+
+Sat Dec 29 15:28:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * iseq.c (RubyVM::InstructionSequence): Add rdoc for new iseq features
+ added from r38085, this includes ::of, #path, #absolute_path,
+ #label, #base_label, #first_lineno, and #inspect
+
+Sat Dec 29 14:06:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * iseq.c (rb_iseq_line_trace_all, rb_iseq_line_trace_specify): Add
+ rdoc for experimental C level api of iseq, from r38076
+
+Sat Dec 29 11:37:36 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * object.c (rb_obj_clone): attach clone to its singleton class during
+ cloning singleton class so that singleton_method_added will be called
+ on it. based on the patch by shiba (satoshi shiba)[Bug #5283] in
+ [ruby-dev:44477]. [Bug #5283]
+
+Sat Dec 29 10:10:39 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (crt_externs.h): use standard macro AC_CHECK_HEADERS.
+
+Fri Dec 28 23:12:44 2012 Charlie Somerville <charlie@charliesomerville.com>
+
+ * configure.in: check for the whether crt_externs.h is present when compiling
+ for darwin (this header is missing in the iOS SDK)
+ * eval_intern.h: check HAVE_CRT_EXTERNS_H before including crt_externs.h, if
+ not defined, include missing/crt_externs.h instead
+ * hash.c: ditto
+ * missing/setproctitle.c: ditto
+ * missing/crt_externs.h: declare _NSGetEnviron() function and define environ
+ for iOS
+
+Fri Dec 28 21:40:36 2012 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/irb/context.rb: IRB::Context#new: Check from JobManager
+ inside IRB namespace [Bug #7628]. Thanks rafaelfranca for bug
+ report and its patch.
+
+Fri Dec 28 17:06:17 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * misc/ruby-electric.el (ruby-electric-curlies): Automatically
+ indent closing curly brackets when
+ ruby-electric-newline-before-closing-bracket is true.
+
+Fri Dec 28 11:50:42 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_yield_setup_block_args): pass single argument to
+ single optional parameter unchanged without splatting. [Bug #7621]
+ [ruby-dev:46801]
+
+Fri Dec 28 11:17:47 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * proc.c (method_eq): fix the documentation to refer to owner.
+ [ruby-core:51105] [Bug #7613]
+
+ * test/ruby/test_method.rb (test_alias_onwer): new test to confirm
+ that `a == b' returns false if owners of a and b are different.
+
+Fri Dec 28 07:07:43 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * def/id.def: use split(/^/) instead of String#lines to support
+ Ruby 1.8.5 as BASERUBY.
+
+Thu Dec 27 21:56:56 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * variable.c (rb_mod_remove_const): fix segv caused by r38558.
+
+Tue Dec 28 01:13:48 2012 James Edward Gray II <james@graysoftinc.com>
+
+ * lib/csv.rb: Added more Hash methods to CSV::Row.
+
+Thu Dec 27 23:27:15 2012 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/irb/ruby-lex.rb: make lex_state to EXPR_END when next token
+ is an operator after SYMBEG [Bug #6378].
+
+Thu Dec 27 21:30:21 2012 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/irb/ruby-lex.rb: allow to handle recursive heredocs on
+ irb[Bug #5648].
+
+Thu Dec 27 20:45:29 2012 Masaki Matsushita <glass.saga@gmail.com>
+
+ * ext/stringio/stringio.c (strio_getline): fix not to raise TypeError
+ when limit is nil.
+ [Bug #7232] [ruby-core:48531]
+
+ * test/stringio/test_stringio.rb: a test for above.
+
+Thu Dec 27 21:08:23 2012 Charlie Somerville <charlie@charliesomerville.com>
+
+ * vm_core.h (VM_DEFINECLASS_TYPE): explicit cast to enum type to avoid 64->32
+ shorten warning
+
+Thu Dec 27 20:11:29 2012 Masaki Matsushita <glass.saga@gmail.com>
+
+ * ext/stringio/stringio.c (strio_ungetc): raise IOError instead of RuntimeError
+ if the string is frozen.
+ [Bug #7231] [ruby-core:48530]
+
+ * ext/stringio/stringio.c (strio_ungetbyte): ditto.
+
+ * test/stringio/test_stringio.rb: a test for above.
+
+Wed Dec 26 23:55:18 2012 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/irb/context.rb: fix IRB::Inspector#keys_with_inspector [Bug #7598]
+
+Wed Dec 26 23:26:15 2012 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/irb/context.rb: IRB::Context#use_readline= has been obsolete
+ [Bug #6339].
+
+Wed Dec 26 21:32:46 2012 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/irb/context.rb: make a correct prompt from
+ IRB.conf[:IRB_NAME] on irb [Bug #6338]. Patched by sho-h.
+
+Wed Dec 26 21:09:19 2012 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/irb/ext/math-mode.rb: make not able to change math-mode
+ after irb starting [Bug #6302]. Patched by sho-h.
+
+Wed Dec 26 12:52:36 2012 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/irb/init.rb: change default debug level for
+ irb[ruby-dev:46805], [Bug #6301].
+
+Wed Dec 26 11:54:11 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in: enable -fPIE when checking -pie for fixing
+ OpenBSD build error. Patch by George Koehler. Thank you!
+ [Bug #7606] [ruby-core:51082]
+
+Wed Dec 26 07:31:24 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (rb_enc_cr_str_copy_for_substr): empty string is always
+ valid or 7bit.
+
+ * string.c (rb_str_enumerate_lines, rb_str_chop): reduce duplicated
+ code.
+
+ * string.c (rb_str_enumerate_chars): prevent shared copy from GC.
+
+Wed Dec 26 01:31:16 2012 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/irb/init.rb, lib/irb/context.rb: fix conf.debug_level=
+ [Bug #6301] and fix irb command option: -- irb_debug_level for irb.
+
+Wed Dec 26 00:59:18 2012 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/irb/ruby-lex.rb: improve RubyLex performance for large files
+ [Bug #5202]. Patch by ryanmelt.
+
+Tue Dec 25 22:21:06 2012 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/irb/output-method.rb: raise right exception when
+ IRB::OutputMethod#print don't defined [Bug #6657].
+
+Tue Dec 25 22:06:33 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_trace.c (rb_threadptr_exec_event_hooks_and_pop_frame):
+ pop a frame before JUMP_TAG() if exception occurred.
+ This change fix bug of Ruby 1.9.
+ [ruby-core:51128] [ruby-trunk - Bug #7624]
+
+ * vm_core.h (EXEC_EVENT_HOOK_AND_POP_FRAME): add to use
+ `rb_threadptr_exec_event_hooks_and_pop_frame()'.
+
+ * vm.c (vm_exec): use EXEC_EVENT_HOOK_AND_POP_FRAME() while
+ exception handling. While exception handling, if an exception
+ is raised in hooks, need to pop current frame and raise this
+ raised exception by hook.
+
+ * test/ruby/test_settracefunc.rb: add a test.
+
+Tue Dec 25 21:08:53 2012 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/irb/init.rb, lib/irb/lc/ja/error.rb, lib/irb/lc/error.rb:
+ raise exception when illegal RC_NAME_GENERATOR defined [Bug #6455].
+
+Tue Dec 25 19:22:17 2012 Keiju Ishitsuka <keiju@ishitsuka.com>
+
+ * lib/irb/workspace.rb: define method to private on top-level irb
+ [Bug #5776]. Patch by davidbalbert.
+
+Tue Dec 25 19:09:51 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * bignum.c, include/ruby/intern.h (rb_big_eql): exported.
+
+ * thread.c (recursive_check): object_id maybe a Bignum, not Fixnum on
+ LLP64. see also r38493 and r38548.
+ reported by Heesob Park at [ruby-core:51083] [Bug #7607], and patched
+ by shirosaki at [ruby-core:51095]
+
+Tue Dec 25 18:53:35 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_core.h, eval_intern.h (CHECK_STACK_OVERFLOW): move
+ CHECK_STACK_OVERFLOW() to vm_core.h and rename to
+ CHECK_VM_STACK_OVERFLOW().
+ This change is only move and rename.
+
+ * tool/instruction.rb: catch up above changes.
+
+ * vm.c, vm_insnhelper.c: ditto.
+
+ * vm_insnhelper.c (vm_stackoverflow): add a function to unify
+ raising vm stackoverflow exception.
+
+Tue Dec 25 16:16:54 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_core.h (RUBY_VM_THREAD_VM_STACK_SIZE): change default
+ VM stack size (128 KB or 256 KB -> 512 KB or 1024 KB).
+ This re-sizing corrects smaller value introduced at r38478.
+ Newer value is same VM stack size of Ruby 1.9.
+ [ruby-dev:46797] [ruby-trunk - Bug #7603]
+
+Tue Dec 25 13:38:12 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * error.c (compile_err_append, compile_warn_print, warn_print): use
+ rb_write_error_str() instead of writing to rb_stderr directly.
+
+ * io.c (rb_write_error_str): a stopgap measure not to unblock GVL.
+ warning from require seems to still have race condition errors.
+
+Tue Dec 25 00:59:29 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * node.h (NODE_OP_CDECL), compile.c (iseq_compile_each),
+ parse.y (stmt, arg): allow scoped constant op-assignment.
+ [ruby-core:40154] [Bug #5449]
+
+Mon Dec 24 04:56:48 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/http/generic_request.rb (Net::HTTPGenericRequest):
+ set content-length to zero on empty post requests
+ by Gregory Ostermayr <gregory.ostermayr@gmail.com>
+ https://github.com/ruby/ruby/pull/201 fix GH-201
+
+Sun Dec 23 19:09:16 2012 Koichi Sasada <ko1@atdot.net>
+
+ * thread.c: rename methods:
+ from Thread.async_interrupt_timing to Thread.handle_interrupt,
+ from Thread.async_interrupted? to Thread.pending_interrupt?.
+ Also rename option from `defer' to `never'.
+ [ruby-core:51074] [ruby-trunk - Feature #6762]
+
+ * vm_core.c, thread.c: rename functions and data structure
+ `async_errinfo' to `pending_interrupt'.
+
+ * thread.c: add global variables sym_immediate, sym_on_blocking and
+ sym_never.
+
+ * cont.c, process.c, vm.c, signal.c: ditto.
+
+ * lib/sync.rb, lib/thread.rb: catch up this renaming.
+
+ * test/ruby/test_thread.rb: ditto.
+
+Sun Dec 23 17:57:30 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/profiler.rb (Profiler__::PROFILE_PROC, print_profile): store
+ profile data per threads for concurrent-execution.
+ [ruby-core:22046] [Bug #1152]
+
+ * lib/profiler.rb (Profiler__::Wrapper): support calling singleton
+ methods of an instance of BasicObject.
+
+ * lib/profiler.rb (Profiler__::PROFILE_PROC): use TracePoint.
+
+Sun Dec 23 16:13:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/erb.rb: typos for ERB::new link
+
+Sun Dec 23 16:06:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/erb.rb: Document ERB::new trim_mode '-' for lines ending in -%>
+ [ruby-core:51084] [Bug #7608]
+
+Sun Dec 23 15:25:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/irb/ruby-lex.rb: Add handling for %i and %I quoting to irb
+ Patch by flori [ruby-core:49550] [Bug #7392] [Github Issue #157]
+
+Sun Dec 23 15:05:48 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_eval.c (rb_check_funcall_with_hook): rb_check_funcall with hook
+ which is called before calling method_missing or target method.
+
+ * marshal.c (w_object, r_object0): use rb_check_funcall_with_hook
+ instead of respond_to? and call.
+
+Sun Dec 23 14:52:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * re.c (rb_reg_eqq): doc: #=== is not a synonym for #=~, added example
+ [ruby-dev:46746] [Bug #7571]
+
+Sun Dec 23 14:35:13 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread.c (BLOCKING_REGION): if fail_if_interrupted is false ignore
+ the result of blocking_region_begin(), since it always is true in
+ that case. suppress "uninitialized" warnings.
+
+Sun Dec 23 09:34:07 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/commands/check_command.rb: Added --doctor and --dry-run
+ options to clean up after failed uninstallation.
+ * test/rubygems/test_gem_commands_check_command.rb: Test for above.
+
+ * lib/rubygems/commands/push_command.rb: Allow pushes from RubyGems
+ 2.0.0.preview3
+
+ * lib/rubygems/commands/update_command.rb: Use Gem.ruby_version
+
+ * lib/rubygems/dependency.rb: Update style.
+
+ * lib/rubygems/installer.rb: Ensure installed gem specifications will
+ be useable. Refactor.
+ * test/rubygems/test_gem_installer.rb: ditto.
+
+ * lib/rubygems/validator.rb: Fixed bug with unreadable files.
+
+ * lib/rubygems.rb: Fixed broken methods.
+ * test/rubygems/test_gem.rb: Test for above.
+
+ * test/rubygems/test_gem_commands_push_command.rb: Fixed overridden
+ Gem.latest_rubygems_version
+
+Sun Dec 23 01:52:01 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * io.c (rb_io_lines, rb_io_bytes, rb_io_chars, rb_io_codepoints):
+ Deprecate IO#{lines,bytes,chars,codepoints} and those of ARGF.
+ [Feature #6670]
+
+ * ext/stringio/stringio.c (strio_lines, strio_bytes, strio_chars)
+ (strio_codepoints): Deprecate
+ StringIO#{lines,bytes,chars,codepoints}. [Feature #6670]
+
+ * ext/zlib/zlib.c (rb_gzreader_lines, rb_gzreader_bytes):
+ Deprecate Zlib::GzipReader#{lines,bytes}. [Feature #6670]
+
+Sat Dec 23 01:35:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/optparse.rb: Documentation for OptionParser to remove 'shadowed
+ outer local variable' from example and make obvious ARGV with
+ non-option arguments.
+ Patch by Marcus Stollsteimer [ruby-core:47460] [Bug #6997]
+
+Sat Dec 23 00:08:00 2012 Kenta Murata <mrkn@mrkn.jp>
+
+ * include/ruby/intern.h: add the prototype declaration of
+ rb_num_coerce_bit.
+
+ * numeric.c (rb_num_coerce_bit): the new coerce function for bitwise
+ binary operation.
+
+ * bignum.c (rb_big_and): use coerce to convert the argument, which isn't
+ a Fixnum nor a Bignum, to the corresponding Integer object so that
+ bitwise operations can support Integer-mimic objects.
+ [Bug #1792] [ruby-core:39491]
+
+ * bignum.c (rb_big_or): ditto.
+
+ * bignum.c (rb_big_xor): ditto.
+
+ * numeric.c (bit_coerce): ditto.
+
+ * numeric.c (fix_and): ditto.
+
+ * numeric.c (fix_or): ditto.
+
+ * numeric.c (fix_xor): ditto.
+
+ * test/ruby/test_integer.rb: add tests for the above changes.
+
+ * test/ruby/test_bignum.rb: ditto.
+
+Sun Dec 23 00:04:54 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * internal.h (QUOTE, QUOTE_ID): quote unprintable chars in strings and
+ IDs. [Bug #7574] [ruby-dev:46749]
+
+ * string.c (rb_str_quote_unprintable): ditto.
+
+Sat Dec 22 23:59:18 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * error.c (rb_compile_error, rb_compile_warn, rb_compile_warning),
+ (rb_warn, rb_warning): support PRIsVALUE.
+
+Sat Dec 22 22:04:58 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+
+ * cont.c (rb_fiber_start): unify conditions.
+
+Sat Dec 22 21:47:55 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (rb_io_wait_writable): use rb_thread_check_ints() instead
+ of rb_thread_fd_writable().
+ * io.c (rb_io_wait_readable): ditto.
+
+Sat Dec 22 20:31:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * object.c (rb_mod_const_get): symbol cannot be nested constant name.
+
+Sat Dec 22 19:26:35 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * object.c (rb_mod_const_get): check more strictly. [ruby-dev:46748]
+ [Bug #7573]
+
+Wed Dec 19 02:34:48 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+
+ * cont.c (rb_fiber_start): in case of jump with TAG_FATAL,
+ enqueue error into async_errinfo_queue, because you cannot call
+ TH_TAG_JUMP() in this function. [ruby-dev:45218] [Bug #5993]
+
+ * thread.c (rb_threadptr_execute_interrupts): now INT2FIX(TAG_FATAL)
+ can be popped from async_errinfo_queue.
+
+ * vm.c (rb_vm_make_jump_tag_but_local_jump): revert r38441.
+ rb_vm_make_jump_tag_but_local_jump() shouldn't return exception
+ in case of state == TAG_FATAL.
+
+ * test/ruby/test_fiber.rb (test_exit_in_fiber): fix a test to illuminate
+ Thread.exit should terminate current Thread.
+
+Sat Dec 22 13:15:08 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * gc.c (obj_id_to_ref): add a macro to treat Bignum object id.
+ This follows the change r38493.
+
+ * gc.c (id2ref): fix for working fine with Bignum object id on x64
+ Windows.
+ * gc.c (wmap_finalize): ditto.
+
+Sat Dec 22 11:30:21 2012 Masaki Matsushita <glass.saga@gmail.com>
+
+ * struct.c (make_struct): remove junk ID check to allow members who
+ have junk name like "foo\000".
+ * test/ruby/test_struct.rb: Test for above.
+ [Bug #7575] [ruby-dev:46750]
+
+Sat Dec 22 05:34:54 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/net/http.rb: Requests may be created with a URI which sets the
+ Host header. Responses contain the requested URI for easier redirect
+ following. [ruby-trunk - Feature #6482]
+ * lib/net/http/generic_request.rb: ditto.
+ * lib/net/http/response.rb: ditto.
+ * NEWS (net/http): Updated for above.
+ * test/net/http/test_http.rb: Tests for above.
+ * test/net/http/test_http.rb: ditto.
+ * test/net/http/test_httpresponse.rb: ditto.
+
+Sat Dec 22 02:35:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/irb/slex.rb(#match): Typo, should be D_DETAIL
+ [ruby-core:51071] [Bug#7600]
+
+Sat Dec 22 02:29:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/irb/input-method.rb, lib/irb.rb: Typo in
+ InputMethod#readable_atfer_eof? to #readable_after_eof?
+ [ruby-core:51069] [Bug #7599]
+
+Sat Dec 22 02:19:38 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * vm_dump.c (rb_vm_bugreport): revert r38533.
+ * addr2line.c (fill_lines): add ELF sanity check.
+ [Bug #7597] [ruby-dev:46786]
+
+Sat Dec 22 02:05:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/irb/inspector.rb, lib/irb/context.rb: Move IRB::INSPECTORS and
+ class methods to IRB::Inspector [ruby-core:51067][Bug #7598]
+
+Sat Dec 22 00:28:46 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * object.c (rb_obj_hash): shouldn't assume object_id can be long.
+ based on a patch by Heesob Park at [ruby-core:51060].
+ cf. [Backport #7454]
+
+Fri Dec 21 23:15:25 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * ext/fiddle/lib/fiddle/struct.rb (Fiddle::CStructEntity#set_ctypes):
+ CPtr -> Pointer.
+ * test/fiddle/test_c_struct_entry.rb
+ (Fiddle::TestCStructEntity#test_aref_pointer):
+ Added the test for the above.
+
+Fri Dec 21 23:12:05 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * ext/fiddle/lib/fiddle/struct.rb (Fiddle::CStructEntity#set_ctypes):
+ CPtr -> Pointer.
+ * test/fiddle/test_c_struct_entry.rb
+ (Fiddle::TestCStructEntity#test_aref_pointer_array):
+ Added the test for the above.
+
+Fri Dec 21 22:43:36 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * ext/fiddle/lib/fiddle/import.rb (Fiddle::Importer#sizeof):
+ CPtr -> Pointer.
+ * test/fiddle/test_import.rb (Fiddle::TestImport#test_sizeof):
+ Added the test for the above.
+
+Fri Dec 21 22:34:17 2012 Koichi Sasada <ko1@atdot.net>
+
+ * test/ruby/test_iseq.rb: disable a test which checks features
+ removed at r38532.
+
+Fri Dec 21 22:02:00 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/{dir.h,win32.c} (rb_w32_readdir): removed old rb_w32_readdir()
+ and renamed from rb_w32_readdir_with_enc().
+ [ruby-core:24864] [Feature #1927]
+
+ * dir.c (READDIR): follow above change.
+
+Fri Dec 21 21:12:54 2012 Masaya Tarui <tarui@ruby-lang.org>
+
+ * vm_dump.c (rb_vm_bugreport): commentout addr2line call temporarily
+ in order to avoid segv. anyone can fix addr2line?
+ [Bug #7597] [ruby-dev:46786]
+
+Fri Dec 21 20:38:28 2012 Koichi Sasada <ko1@atdot.net>
+
+ * iseq.c (Init_ISeq): remove definition of the following methods:
+ ISeq#line_trace_all and ISeq#line_trace_specify because they are
+ half baked.
+ C APIs are remained as experimental. These functions will be
+ renamed, removed their parameters may be changed.
+ You can use these methods by C exts. Please give us your comments.
+
+Fri Dec 21 20:21:04 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_trace.c (tracepoint_new): add code to support specified thread.
+ But not tested and this feature is not supported officially.
+
+Fri Dec 21 19:37:15 2012 Koichi Sasada <ko1@atdot.net>
+
+ * ruby.c (process_options): need to acquire env from TOPLEVEL_BINDING
+ each time.
+ `bind->env' may update after `eval()'.
+ [Bug #7536]
+
+Fri Dec 21 18:46:50 2012 Koichi Sasada <ko1@atdot.net>
+
+ * include/ruby/debug.h, vm_core.h: define rb_trace_arg_t at
+ include/ruby/debug.h (move from vm_core.h).
+
+Fri Dec 21 17:48:15 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_core.h, vm_trace.c: fix multi-threading bug for tracing.
+ Move `trace_arg' from rb_tp_t::trace_arg to rb_thread_t::trace_arg.
+ `trace_arg' may changed by multiple threads.
+ rb_thread_t::trace_arg can represent rb_thread_t::trace_running
+ (null or non-null) and rb_thread_t::trace_running is removed.
+ After that, `rb_tp_t' is not needed to check tracing or not
+ (A running thread knows tracing or not). This is why I remove
+ tp_attr_check_active() and make new function get_trace_arg().
+
+ And this modification disable to work the following code:
+ TracePoint.trace{|tp|
+ Thread.new{p tp.event} # access `tp' from other threads.
+ }
+ I believe nobody mix threads at trace procedure.
+ This is current limitation.
+ [Bug #7590]
+
+ * cont.c (fiber_switch, rb_cont_call): use rb_thread_t::trace_arg
+ instead of rb_thread_t::trace_running.
+
+ * test/ruby/test_settracefunc.rb: add a multi-threading test.
+
+Fri Dec 21 16:38:08 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * template/id.h.tmpl (ID2ATTRSET): compile time constant macro for
+ ID_ATTRSET.
+
+ * defs/id.def (KeywordError): check duplication.
+
+ * defs/id.def: support for other scope IDs,
+ ID_{INSTANCE,GLOBAL,CONST,CLASS}.
+
+Fri Dec 21 14:45:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/irb.rb, lib/irb/*: Documentation for IRB
+
+Fri Dec 21 11:31:02 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rake/*: Updated to rake 0.9.6
+ * doc/rake/*: ditto
+ * test/rake/*: ditto
+
+Fri Dec 21 08:56:34 2012 Masaya Tarui <tarui@ruby-lang.org>
+
+ * vm_trace.c (rb_suppress_tracing): remove unused variable 'vm_tracing'
+
+Fri Dec 21 01:01:45 2012 Masaya Tarui <tarui@ruby-lang.org>
+
+ * lib/irb/completion.rb (CompletionProc): support completion of
+ instance variables. [ruby-dev:46710] [Bug #7520]
+
+Thu Dec 20 20:58:25 2012 Masaya Tarui <tarui@ruby-lang.org>
+
+ * vm_trace.c (rb_suppress_tracing): bugfix for vm->trace_running
+ counter. And if tracing is already true, vm_trace_running ops is
+ skipped to control overflow.
+
+Thu Dec 20 18:29:54 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/ruby.h (RTEST, NIL_P): make bare expressions without
+ outermost parentheses.
+
+Thu Dec 20 17:29:00 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * NEWS: fix the description for Refinements.
+
+Thu Dec 20 16:53:59 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * vm_core.h (rb_vm_defineclass_type_t),
+ compile.c (iseq_compile_each), insns.def (defineclass): change the
+ meaning of the third operand of defineclass as follows:
+ lower 3bits: the type of the defineclass
+ 0 = class, 1 = singleton class, 2 = module
+ 4th bit: a flag represents whether the defineclass is scoped
+ 0 = not scoped (e.g., class Foo)
+ 1 = scoped (e.g., class Bar::Baz)
+ 5th bit: a flag represents whether the superclass is specified
+ 0 = not specified (e.g., class Foo)
+ 1 = specified (e.g., class Bar < Foo)
+ If the superclass is specified and is not a class, a TypeError
+ should be raised. [ruby-dev:46747] [Bug #7572]
+
+ * test/ruby/test_class.rb: related test.
+
+Thu Dec 20 16:52:37 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * NEWS: announce AEAD encryption support in the OpenSSL extension.
+
+Thu Dec 20 16:40:13 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * gc.c (nonspecial_obj_id): VALUE is not compatible with Fixnum on
+ LLP64 platform, such as 64bit Windows.
+ reported by Heesob Park at [ruby-core:50255] [Bug #7454], and the
+ fix is suggested by akr.
+
+Thu Dec 20 16:39:04 2012 Martin Bosslet <Martin.Bosslet@gmail.com>
+
+ * ext/openssl/ossl_cipher.c: fix errors for installations that do not
+ feature Authenticated Encryption.
+ * ext/openssl/extconf.rb: detect presence of EVP_CTRL_GCM_GET_TAG to
+ determine whether Authenticated Encryption can be used.
+ [Feature #6980] [ruby-core:47426]
+
+Thu Dec 20 15:55:46 2012 Martin Bosslet <Martin.Bosslet@gmail.com>
+
+ * ext/openssl/ossl.c: do not use FIPS_mode_set if not available.
+ * test/openssl/utils.rb: revise comment about setting FIPS mode to
+ false.
+ * test/openssl/test_fips.rb: remove tests that cause errors on
+ ruby-ci.
+ [Feature #6946] [ruby-core:47345]
+
+Thu Dec 20 15:22:59 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/parser/ruby.rb: Ignore methods defined on constants to
+ prevent modules with the names of constants from appearing in the
+ documentation.
+ * test/rdoc/test_rdoc_parser_ruby.rb: Test for the above.
+
+Thu Dec 20 15:00:33 2012 Martin Bosslet <Martin.Bosslet@gmail.com>
+
+ * ext/openssl/ossl_cipher.c: add support for Authenticated Encryption
+ with Associated Data (AEAD) for OpenSSL versions that support the
+ GCM encryption mode. It's the only mode supported for now by OpenSSL
+ itself. Add Cipher#authenticated? to detect whether a chosen mode
+ does support Authenticated Encryption.
+ * test/openssl/test_cipher.rb: add tests for Authenticated Encryption.
+ [Feature #6980] [ruby-core:47426] Thank you, Stephen Touset for
+ providing a patch!
+
+Thu Dec 20 12:56:53 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/markup/to_html.rb (class RDoc): Added current heading and
+ top links to headings.
+ * lib/rdoc/generator/template/darkfish/rdoc.css: ditto
+ * test/rdoc/test_rdoc_generator_markup.rb: Test for above
+ * test/rdoc/test_rdoc_markup_to_html.rb: ditto
+
+ * test/rdoc/test_rdoc_comment.rb: Removed trailing whitespace.
+
+Thu Dec 20 11:05:26 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/ruby/envutil.rb (assert_valid_syntax): move from
+ test_syntax.rb.
+
+ * test/ruby/envutil.rb (assert_normal_exit): validate syntax before
+ running because this assertion passes even if the code fails by
+ SyntaxError.
+
+Thu Dec 20 10:29:58 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * test/openssl/test_pkey_dh.rb: revert special treatment of
+ FIPS-capable installations since FIPS mode is now disabled for the
+ tests.
+
+Thu Dec 20 10:23:12 2012 Martin Bosslet <Martin.Bosslet@gmail.com>
+
+ * ext/openssl/ossl.c: add OpenSSL.fips_mode= to allow enabling FIPS
+ mode manually.
+ * test/openssl/utils.rb: turn off FIPS mode for tests. This prevents
+ OpenSSL installations with FIPS mode enabled by default from raising
+ FIPS-related errors during the tests.
+ * test/openssl/test_fips.rb: add tests for FIPS-capable OpenSSL
+ installations.
+ [Feature #6946] [ruby-core:47345]
+
+Thu Dec 20 06:59:52 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm.c: support variable VM/Machine stack sizes.
+ Specified by the following environment variables:
+ - RUBY_THREAD_VM_STACK_SIZE: vm stack size used at thread creation.
+ default: 128KB (32bit CPU) or 256KB (64bit CPU).
+ - RUBY_THREAD_MACHINE_STACK_SIZE: machine stack size used at thread
+ creation. default: 512KB or 1024KB.
+ - 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 256KB.
+ This values are specified at launched timing. You can not change
+ these values at running time.
+ Environ variables are only *hints* because:
+ - They are aligned to 4KB.
+ - They have minimum values (depend on OSs).
+ - Machine stack settings are ignored by some OSs.
+ Default values especially fiber stack sizes are increased.
+ This change affect Fiber's behavior:
+ (1) You can run more complex program on a Fiber.
+ (2) You can not make many (thousands) Fibers because of
+ lack of address space (on 32bit CPU).
+ If (2) bothers you,
+ (a) Use 64bit CPU with big memory, or
+ (b) Specify RUBY_FIBER_(VM|MACHINE)_STACK_SIZE correctly.
+ You need to choose correct stack size carefully. These values
+ are completely rely on systems (OS/compiler and so on).
+ [Feature #4614], [Bug #7212]
+
+ * vm_core.h (rb_vm_t::default_params): add to record above settings.
+
+ * vm.c (RubyVM::DEFAULT_PARAMS): add new constant to see
+ above setting.
+
+ * thread_pthread.c: support RUBY_THREAD_MACHINE_STACK_SIZE.
+
+ * cont.c: support RUBY_FIBER_(VM|MACHINE)_STACK_SIZE.
+
+ * test/ruby/test_fiber.rb: add tests for above.
+
+ * test/ruby/test_thread.rb: ditto.
+
+Thu Dec 20 06:25:44 2012 Koichi Sasada <ko1@atdot.net>
+
+ * test/ruby/test_fiber.rb: remove a strange single quote character.
+ With this character, this script exits by SyntaxError.
+
+Thu Dec 20 01:03:00 2012 Zachary Scott <zachary@zacharyscott>
+
+ * ext/.document: Add missing ext modules to .document
+ Patch by Ryunosuke SATO [Fixes Github #224]
+
+Wed Dec 19 23:52:16 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ruby.c (load_file_internal): use original C string as the filename
+ for parser.
+ reported by whiteleaf at [ruby-list:49085] [ruby-dev:46738]
+ [Bug #7562]
+
+Wed Dec 19 23:36:12 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * marshal.c (marshal_dump, marshal_load): fix SEGV during make rdoc
+ and test failure in TestMarshal#test_gc and test_context_switch
+ on SPARC Solaris 10 compiled with Oracle Solaris Studio 12.3.
+ [Bug #7591] [ruby-dev:46772]
+
+Wed Dec 19 19:34:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * object.c (rb_mod_const_get): nul byte is invalid as constant name.
+
+Wed Dec 19 17:54:18 2012 Masaya Tarui <tarui@ruby-lang.org>
+
+ * vm_trace.c (rb_threadptr_exec_event_hooks): get rid of race
+ condition. [Bug #7589] [ruby-dev:46763]
+
+Wed Dec 19 16:30:28 2012 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/literals.rdoc: Added 0d decimal format. Thanks Nobu!
+
+Wed Dec 19 16:19:36 2012 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/methods.rdoc: Fixed typo. Thanks to Josh Susser.
+
+Wed Dec 19 16:18:22 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/commands/query_command.rb: Refactored to improve
+ maintainability.
+ * test/rubygems/test_gem_commands_query_command.rb: Note default gems
+ in gem list details.
+
+ * lib/rubygems/uninstaller.rb: Detect all gems for uninstallation.
+ This allows duplicate installs of default gems to be removed.
+ * lib/rubygems/specification.rb: Allow use of ::each_spec.
+ * lib/rubygems/test_case.rb: Added install_default_gems.
+ * test/rubygems/test_gem_commands_uninstall_command.rb: Moved test
+ down to the uninstaller tests.
+ * test/rubygems/test_gem_uninstaller.rb: Test for uninstallation of
+ default gems and duplicate default gems.
+
+Wed Dec 19 15:23:50 2012 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/methods.rdoc: Add () around keyword arguments example for
+ consistency. Thanks to Josh Susser.
+
+Wed Dec 19 01:51:24 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+
+ * vm.c (rb_vm_jump_tag_but_local_jump): remove unnecessary 2nd
+ argument.
+
+ * load.c (rb_load_internal): ditto.
+
+ * eval_intern.h (rb_vm_jump_tag_but_local_jump): ditto.
+
+Tue Dec 18 18:57:58 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (rb_io_wait_writable): don't use rb_thread_wait_fd()
+ because it is for waiting until io readable.
+
+ * io.c (rb_io_wait_writable): always use rb_thread_fd_writable()
+ instead of bare rb_wait_for_single_fd(). we shouldn't ignore
+ return value.
+ * io.c (rb_io_wait_readable): ditto. always use rb_thread_wait_fd().
+
+Tue Dec 18 18:55:33 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_thread_wait_fd_rw): fix infinite loop bug.
+ rb_wait_for_single_fd() never return positive number.
+
+Tue Dec 18 17:24:40 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/encoding.rb: Do not remove #! line from document when
+ setting encoding. This allows ruby executables to be parsed as ruby
+ files.
+ * test/rdoc/test_rdoc_encoding.rb: Test for above.
+
+ * lib/rdoc/parser.rb: Set the parser file name of ruby executables
+ correctly.
+ * test/rdoc/test_rdoc_parser.rb: Test for above.
+
+Tue Dec 18 16:46:15 2012 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/literals.rdoc: Used simplified heredoc example that
+ doesn't include method definition. Added heredoc with backticks.
+
+Tue Dec 18 16:38:51 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/store.rb: Work around RDoc stores from older versions of
+ RDoc.
+ * test/rdoc/test_rdoc_store.rb: Test for above.
+
+Tue Dec 18 16:31:20 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/ruby_lex.rb: Return a TkHEREDOC instead of a TkSTRING when
+ the heredoc identifier is followed by a line-end. This allows proper
+ display of some HEREDOCs in source view.
+ * lib/rdoc/ruby_token.rb: Added TkHEREDOC
+ * test/rdoc/test_rdoc_ruby_lex.rb: Test for above.
+
+Tue Dec 18 09:45:14 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+
+ * vm.c (rb_vm_make_jump_tag_but_local_jump): take care of the case
+ TAG_JUMP() with TAG_FATAL (ex. rb_fatal()). [ruby-core:50917]
+ [Bug #7570]
+
+ * test/ruby/test_fiber.rb (test_fatal_in_fiber): add a test for above.
+
+ * ext/-test-/fatal/extconf.rb, ext/-test-/fatal/rb_fatal.c: ditto.
+
+Tue Dec 18 13:17:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * vm_trace.c (tracepoint_attr_defined_class): Clean up rdoc for
+ TracePoint#defined_class
+
+Tue Dec 18 12:15:59 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/specification.rb: Fixed ruby output of requirements
+ with multiple version specifiers.
+ * test/rubygems/test_gem_ext_cmake_builder.rb: Only look for specific
+ lines in cmake output. Should fix [ruby-trunk - Bug #7579]
+
+Tue Dec 18 11:45:26 2012 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/literals.rdoc: Added 0o octal integers.
+
+Tue Dec 18 12:28:52 2012 Martin Bosslet <Martin.Bosslet@gmail.com>
+
+ * test/openssl/test_ssl.rb: Use :TLSv1_2_client explicitly in
+ test_tls_v1_2 to prevent upstream bug.
+ [Bug #7197] [ruby-dev:46240]
+
+Tue Dec 18 11:52:34 2012 Martin Bosslet <Martin.Bosslet@gmail.com>
+
+ * ext/openssl/lib/ssl.rb: Enable insertion of empty fragments as a
+ countermeasure for the BEAST attack by default. The default options
+ of OpenSSL::SSL:SSLContext are now:
+ OpenSSL::SSL::OP_ALL & ~OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS
+ [Bug #5353] [ruby-core:39673]
+
+ * test/openssl/test_ssl.rb: Adapt tests to new SSLContext default.
+
+ * NEWS: Announce the new default.
+
+Tue Dec 18 06:36:12 2012 Koichi Sasada <ko1@atdot.net>
+
+ * method.h: remove `VM_METHOD_TYPE_CFUNC_FRAMELESS' method type.
+ This method type is for optimized CFUNC such as Fixnum#+ and so on.
+ This feature is half-baked and no way to use them.
+ [Background]
+ Now, VM has opt_plus instructions to optimize `+' methods for
+ some Classes (such as Fixnum, Float (flonum)). We call this
+ type of instructions as `specialized instructions'.
+ This simple technique improve simple program dramatically.
+ However, we can make specialized instructions for only several
+ types (classes) and selectors (method names) because a large
+ instruction will be slow. In other words, this technique has no
+ extensibility.
+ To overcome this problem, VM_METHOD_TYPE_CFUNC_FRAMELESS was
+ introduced (r37198). This type is a variant of CFUNC, but called
+ their functions directly without building a method frame.
+ Any CFUNC method can be defined as frameless methods if a method
+ is not needed to make method frame. Frameless methods are faster
+ as specialized instructions (a bit slower, but no need to care).
+ No problem described at
+ http://charlie.bz/blog/why-do-singleton-methods-make-ruby-slow
+ because this technique doesn't see class, but see method body
+ itself. Alias is also no problem.
+ [Problem]
+ However, we can't set frameless method type for polymorphic methods
+ such as Array#[]. Necessity for method frame depends on which
+ parameter type. For example, Fixnum#+ needs method frame if
+ coerce is needed. Current VM_METHOD_TYPE_CFUNC_FRAMELESS is not
+ flexible and need more tuning to introduce it.
+ Expected behavior of frameless method type may be:
+ result = optimized_cfunc(params); /* call optimized cfunc */
+ if (result == Qundef) { result = normal_cfunc(); }
+ This is why I say this feature is half-baked.
+ We need to learn primitive method in Smalltalk more.
+ (I heard this name at RubyConf Taiwan this month. Thanks!)
+ [Conclusion]
+ I remove this feature and consider again.
+ This feature goes to next minor (2.1?).
+ Nobody may use this feature and there is no compatibility issue.
+
+ * proc.c (rb_method_entry_arity): ditto.
+
+ * vm_eval.c, vm_insnhelper.c, vm_method.c: ditto.
+
+Tue Dec 18 04:58:22 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_trace.c (fill_id_and_klass): TracePoint#defined_class returns
+ singleton class. `set_trace_func' passed attached class (which is
+ attached/modified by singleton class) by 6th block parameter if it
+ is singleton class. Previous behavior follows this spec.
+ However, this method named `defined_class' should return singleton
+ class directly because singleton methods are defined in singleton
+ class. There are no compatible issue because TracePoint is introduced
+ after 2.0.
+ But compatibility with `set_trace_func' is broken. This means that
+ you can not replace all `set_trace_func' code with TracePoint
+ without consideration of this behavior.
+ [Bug #7554]
+
+ * test/ruby/test_settracefunc.rb: change a test to catch up
+ an above change.
+
+Tue Dec 18 03:03:10 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/to_ruby.rb: speed up node mapping so
+ common cases are evaluated first. Thanks Kevin Menard!
+
+Tue Dec 18 02:35:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/optparse.rb: Remove 'developer documentation' section from rdoc
+ Patch by Marcus Stollsteimer [ruby-core:50526][Bug #7504]
+
+Tue Dec 18 02:35:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/matrix.rb (#lup): typo in example [ruby-core:50946][Bug #7582]
+
+Mon Dec 17 18:03:34 2012 Charlie Somerville <charlie@charliesomerville.com>
+
+ * class.c (rewrite_cref_stack, clone_method): rewrite a method's cref
+ stack when cloning into a new class to allow lexical const lookup to
+ work as expected [ruby-core:47834] [Bug #7107]
+ * test/ruby/test_class.rb (class TestClass): related test
+
+Mon Dec 17 13:56:55 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (io_flush_buffer_sync2): avoid to return 0. because
+ rb_thread_call_without_gvl2 uses 0 internally.
+ * io.c (io_flush_buffer_async2): adapt the above.
+
+Mon Dec 17 12:05:32 2012 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax/methods.rdoc: Added a description of singleton methods.
+
+Mon Dec 17 11:35:57 2012 Eric Hodel <drbrain@segment7.net>
+
+ * doc/.document: Added doc/syntax
+
+Mon Dec 17 11:25:32 2012 Eric Hodel <drbrain@segment7.net>
+
+ * doc/syntax.rdoc: Added syntax guide table of contents
+ * doc/syntax/exceptions.rdoc: Syntax guide for exceptions
+ * doc/syntax/literals.rdoc: Syntax guide for literals
+ * doc/syntax/methods.rdoc: Syntax guide for methods
+
+Mon Dec 17 07:59:40 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems.rb: Updated VERSION
+
+ * test/rubygems/test_gem_installer.rb: Fixed ambiguous first argument
+ warning.
+
+ * test/rubygems/test_gem_rdoc.rb: RDoc generation depends on installed
+ version of RDoc.
+
+Sun Dec 16 02:04:41 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * signal.c (rb_sigaltstack_size): cast sysconf() return value
+ explicitly. Fix compile error on Mac OS X.
+
+Sun Dec 16 00:39:43 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+
+ * cont.c (rb_fiber_start): don't enqueue Qnil to async_errinfo_queue.
+ rb_vm_make_jump_tag_but_local_jump() could return Qnil (ex. when
+ finished by Thread.exit). [ruby-dev:45218] [Bug #5993]
+
+ * test/ruby/test_fiber.rb (test_exit_in_fiber): add test for it.
+
+Sat Dec 15 23:56:51 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * ext/fiddle/pointer.c (rb_fiddle_ptr2cptr): fix error message
+ forgotten to be changed from DL to Fiddle.
+
+Sat Dec 15 23:14:32 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * signal.c (default_handler): remove rb_register_sigaltstack()
+ call. sigaltstack was already registered when creating threads.
+
+Sat Dec 15 23:08:56 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * signal.c (rb_sigaltstack_size): new. calculate stack size for
+ sigsegv handler. enlarge value when x86 or x86_64 on Linux.
+ Linux has very small MINSIGSTKSZ size (2048 bytes) and
+ our sigsegv routine need 5KiB at least. [Bug #7141]
+ * internal.h: add declaration of rb_sigaltstack_size().
+ * vm_core.h: remove ALT_STACK_SIZE definition.
+
+ * signal.c (rb_register_sigaltstack): replace ALT_STACK_SIZE with
+ rb_sigaltstack_size();
+ * gc.c (Init_heap): ditto.
+ * vm.c (th_init): ditto.
+
+Sat Dec 15 18:24:21 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * rational.c (f_round_common): should check overflow.
+
+Sat Dec 15 18:00:00 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * rational.c (float_rationalize): reduced.
+
+Sat Dec 15 14:18:44 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (finish_writeconv): uses rb_write_internal2 if
+ fptr->write_lock have.
+
+Sat Dec 15 13:57:08 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_mutex_owned_p): remove static.
+ * io.c (io_flush_buffer): don't hold mutex if already have.
+ Now recursive lock may occur when following scenario.
+ fptr_finalize -> finish_writeconv_sync -> finish_writeconv
+ -> io_fflush.
+
+Sat Dec 15 13:38:30 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (io_flush_buffer): uses io_flush_buffer_async2 instead of
+ io_flush_buffer_async.
+ * io.c (io_flush_buffer_async2): new helper function for
+ io_flush_buffer. It uses rb_thread_call_without_gvl2() instead
+ of rb_thread_io_blocking_region.
+ * io.c (io_flush_buffer_sync2): new helper function for
+ io_flush_buffer_async2.
+
+Sat Dec 15 13:04:26 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (internal_write_func2): new helper function for rb_write_internal2().
+ * io.c (rb_write_internal2): new function. it uses
+ rb_thread_call_without_gvl2() instead of rb_thread_io_blocking_region().
+ * io.c (rb_binwrite_string): uses rb_write_internal2 instead of
+ rb_write_internal. [Bug #7134]
+
+Sat Dec 15 12:55:29 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (rb_io_wait_writable): add to call rb_thread_wait_fd()
+ likes rb_io_wait_readable.
+
+Sat Dec 15 11:54:50 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (rb_io_wait_writable): don't call rb_thread_fd_writable()
+ when EINTR. EINTR mean signal interrupt was happen. We don't
+ need any wait.
+
+Sat Dec 15 11:53:36 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_thread_wait_fd_rw): remove silly rb_thread_alone()
+ check.
+
+Sat Dec 15 10:22:38 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread.c (rb_thread_polling): revert but deprecate.
+
+ * include/ruby/intern.h (rb_thread_polling): deprecate.
+
+Sat Dec 15 08:37:01 2012 Masaya Tarui <tarui@ruby-lang.org>
+
+ * test/rubygems/test_gem_ext_cmake_builder.rb (test_self_build):
+ get rid of false positive.
+
+Sat Dec 15 08:05:56 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_thread.rb (test_uninitialized, test_backtrace,
+ test_thread_timer_and_interrupt, test_thread_join_in_trap,
+ test_thread_join_current, test_thread_join_main_thread,
+ test_main_thread_status_at_exit, test_thread_status_in_trap,
+ test_thread_status_raise_after_kill, test_mutex_owned,
+ test_mutex_owned2): move these tests from TestThreadGroup class
+ to TestThread because they are not thread group tests.
+
+ * test/ruby/test_thread.rb (test_thread_status_raise_after_kill):
+ add t.join.
+
+ * test/ruby/test_threadgroup.rb: new file. moved ThreadGroup test
+ from test_thread.rb.
+
+Sat Dec 15 08:02:11 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_thread.rb (TestThread::Thread::new.): remove
+ th.abort_on_exception change. Test template shouldn't change
+ global flag. It prevent to test a normal case.
+
+Sat Dec 15 06:15:14 2012 Eric Hodel <drbrain@segment7.net>
+
+ * configure.in (HAVE_GCC_ATOMIC_BUILTINS): Set -march=i486 to enable
+ __sync_val_compare_and_swap. Patch by KOSAKI Motohiro.
+ [ruby-trunk - Bug #7485]
+
+Sat Dec 15 03:42:34 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * ext/.document: add fiddle/pointer.c, fiddle/handle.c, and
+ fiddle/win32/lib as documentation.
+
+Sat Dec 15 03:06:40 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * file.c (rb_file_flock): use rb_thread_wait_for() instead of
+ rb_thread_polling(). When getting EAGAIN, we need to wait a
+ while even if no multi threading.
+ * thread.c (sleep_for_polling, rb_thread_polling) removed.
+
+Sat Dec 15 00:03:31 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * signal.c (rb_f_kill): remove rb_thread_polling() because this
+ has no good effect and makes meaningless 100ms delay. 1)
+ when sending signal to another process, waiting has just silly.
+ 2) when sending signal to current process, 100ms is often not
+ enough time to wait. It depend on kernel behavior. And,
+ rb_thread_polling() doesn't make sense anyway. When rb_thread_alone()
+ is true, it doesn't wait at all and Process.kill() users don't
+ expect threading changes Process.kill() behavior. [Bug #7560]
+
+Fri Dec 14 17:10:57 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (parser_params): parser_tokline to track the line number at
+ which token started. [ruby-dev:46737] [Bug #7559]
+
+ * parse.y (fcall): operation with starting line number.
+
+ * parse.y (command, primary, method_call): point method name line.
+
+ * parse.y (gettable_gen): return token line for __LINE__.
+
+Fri Dec 14 16:56:59 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_call_super_method): remove volatile introduced
+ in r38365.
+
+ * vm_insnhelper.c (vm_call_method): use __forceinline to prevent
+ VC++ to make vm_call_general and vm_call_super_method as the same
+ method. Thanks, Heesob Park. [Bug #7556] [ruby-core:50867]
+
+Fri Dec 14 14:59:14 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/ruby/envutil.rb (Test::Unit::Assertions#assert_separately):
+ take file and line by using caller_locations if not given.
+
+ * test/ruby/envutil.rb (Test::Unit::Assertions#assert_separately):
+ count assertions in separated tests.
+
+Fri Dec 14 14:16:42 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/rubygems_hook.rb: Fixed generation of documentation.
+ Disabled rdoc generation by default to match RubyGems defaults.
+ Reduced diff with RubyGems::RDoc.
+ * test/rdoc/test_rdoc_rubygems_hook.rb: Tests for the above.
+ * test/rubygems/test_gem_rdoc.rb: ditto.
+
+ * lib/rdoc/store.rb: Removed useless variable assignment
+
+Fri Dec 14 13:58:40 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/commands/rdoc_command.rb: When overwriting
+ documentation, remove existing documentation first.
+
+ * lib/rubygems/server.rb: Fixed documentation links.
+ * test/rubygems/test_gem_server.rb: Test for the above.
+
+ * lib/rubygems/rdoc.rb: Reduced diff with RDoc::RubyGemsHook
+ * test/rubygems/test_gem_rdoc.rb: ditto
+
+Fri Dec 14 04:08:05 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * test/ruby/envutil.rb (Test::Unit::Assertions#assert_separately):
+ added to execute given test source on separate process,
+ catch its resulted exception and raise it on main process.
+
+Fri Dec 14 07:43:44 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: quote strings that begin
+ with non-word characters. Thanks Alex Tambellini!
+ * test/psych/test_yaml.rb: appropriate test case
+
+Thu Dec 13 23:14:17 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_call_super_method): a workaround for the
+ failure of TestRefinement#test_refine_recursion in Windows.
+ See [ruby-core:50871] for details.
+
+Thu Dec 13 23:10:52 Charlie Somerville <charlie@charliesomerville.com>
+
+ * object.c (Init_Object): use rb_mod_init_copy for Class#initialize_copy
+ * class.c (rb_class_init_copy): rename to class_init_copy_check, performs type
+ checks on arguments to prevent reinitialization of initialized class
+ [ruby-core:50869] [Bug #7557]
+ * class.c (rb_mod_init_copy): use class_init_copy_check if receiver is T_CLASS
+ * test/ruby/test_class.rb (class TestClass): related test
+
+Thu Dec 13 16:53:10 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/class_module.rb: Fixed duplicate comments for classes and
+ modules from C.
+ * test/rdoc/test_rdoc_class_module.rb: Test for the above.
+
+ * lib/rdoc/parser/c.rb: Reload C variable names to allow proper
+ updates of an ri store for C files.
+ * lib/rdoc/rdoc.rb: ditto.
+ * lib/rdoc/store.rb: ditto.
+ * test/rdoc/test_rdoc_parser_c.rb: Test for the above.
+ * test/rdoc/test_rdoc_store.rb: ditto.
+
+Thu Dec 13 14:20:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/irb*: merge doc from doc/irb/ird.rd and improve overall
+ documentation of IRB
+ * doc/irb/irb.rd: remove stale documentation
+
+Thu Dec 13 14:10:00 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * marshal.c (r_entry0): don't taint classes and modules because
+ Marshal.load just returns the dumped classes and modules.
+ [Bug #7325] [ruby-core:49198]
+
+ * test/ruby/test_marshal.rb: related test.
+
+Thu Dec 13 14:10:13 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_require.rb (TestRequire#test_loaded_features_encoding):
+ need to check compatibility, not equality of encodings.
+
+Thu Dec 13 14:02:15 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * file.c (rb_file_join): check encoding compatibility before joining
+ strings.
+
+Thu Dec 13 13:06:27 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * proc.c (umethod_bind): allow another form of method transplanting
+ from a module via UnboundMethod. [ruby-core:34267][Feature #4254]
+
+Thu Dec 13 12:07:25 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * include/ruby/ruby.h (RB_UNUSED_VAR): new macro to suppress
+ warnings for unused variables.
+
+ * ext/bigdecimal/bigdecimal.c (ENTER): use RB_UNUSED_VAR() to
+ suppress annoying warnings by -Wunused-but-set-variable in gcc 4.6.
+
+Thu Dec 13 11:22:33 2012 Koichi Sasada <ko1@atdot.net>
+
+ * method.h: remove "VM_METHOD_TYPE__MAX" from rb_method_type_t.
+ rb_method_type_t is not a number and "_MAX" causes misunderstanding.
+
+ * proc.c (rb_method_entry_arity): ditto.
+
+ * vm_eval.c (vm_call0_body): ditto.
+
+ * vm_insnhelper.c (vm_call_method): ditto.
+
+Wed Dec 12 21:40:45 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/tmpdir.rb (Dir::Tmpname#create): deal with a prefix name which
+ starts with tilde as a plain name, not expanding as home directory.
+ [ruby-core:50793] [Bug #7547]
+
+Wed Dec 12 19:48:59 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/json: merge JSON 1.7.5.
+ fix tests and other fixes.
+
+Wed Dec 12 18:30:29 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * class.c (rb_prepend_module): move refined methods from the origin
+ of a class to the class, because refinements should have priority
+ over prepended modules.
+
+ * test/ruby/test_refinement.rb: related test.
+
+Wed Dec 12 18:27:09 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * time.c (zone_str): lookup or insert by using st_update() at once.
+
+Wed Dec 12 15:30:11 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * configure.in: add -fno-omit-frame-pointer if libexecinfo is used.
+ At least on FreeBSD ruby will crash on getting C backtrace
+ when it is compiled with other than -O0.
+
+ * vm_dump.c: enable backtrace on FreeBSD even if with optimizations.
+
+Wed Dec 12 16:08:04 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/rdoc/test_rdoc_rdoc.rb (TestRDocRDoc#test_normalized_file_list_non_file_directory):
+ use File::NULL for portability if possible.
+
+Wed Dec 12 16:07:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * method.h (rb_method_flag_t): name a magic number for NOEX_SAFE and
+ NOEX_WITH as NOEX_SAFE_SHIFT_OFFSET.
+
+ * method.h (rb_method_type_t, method_optimized_type): C89 forbids a
+ comma after the last element in enum.
+
+ * proc.c (rb_method_entry_arity), vm_eval.c (vm_call0_body),
+ vm_insnhelper.c (vm_call_method): add VM_METHOD_TYPE__MAX case.
+
+Wed Dec 12 14:16:35 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/class_module.rb: Added RDoc::ClassModule#documented? which
+ checks comment_location. Hide RDoc::ClassModule#comment=.
+ * test/rdoc/test_rdoc_class_module.rb: Test for above.
+
+ * lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml:
+ Fix display of the table of contents in the sidebar.
+
+ * lib/rdoc/generator/template/darkfish/table_of_contents.rhtml:
+ Use #comment_location when displaying classes or modules.
+
+ * test/rdoc/test_rdoc_store.rb: Use comment_location.
+
+Wed Dec 12 13:40:52 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_getivar): no uninitialized instance variables
+ warnings for non-object if attr method.
+
+Wed Dec 12 06:43:37 2012 Benoit Daloze <eregontp@gmail.com>
+
+ * iseq.c (rb_iseq_parameters): fix limit for optional arguments.
+
+ * test/ruby/test_keyword.rb: tests for above.
+
+ * vm_core.h (struct rb_iseq_struct): update documentation
+ with keyword arguments. [Bug #7540] [ruby-core:50735]
+
+Wed Dec 12 03:45:41 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm.c (vm_exec): pass exceptions while handling an exception.
+
+ * vm_trace.c (rb_threadptr_exec_event_hooks): propagate exceptions.
+ revert r38293 partially.
+
+Wed Dec 12 03:09:05 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * sample/test.rb (Progress#initialize): add --verbose option and show
+ messages in one line unless --verbose is given.
+
+Wed Dec 12 01:47:02 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * eval.c (rb_using_refinement): make the method table of an iclass
+ for a refinement that of the refinement, not that of the origin of
+ the refinement, which is set by rb_include_class_new(). This
+ change is needed to make module prepend into a refinement work
+ properly.
+
+ * test/ruby/test_refinement.rb: related test.
+
+Wed Dec 12 01:05:04 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * tool/make-snapshot: add --disable-rubygem to both MINIRUBY and RUBY.
+ On making miniprelude.c, it seems use MINIRUBY. this fixes #7541
+ but rubygems also needs to be fixed for older rubies.
+
+Wed Dec 12 00:32:11 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * test/dl/test_func.rb (test_name_with_block, test_bind, test_qsort1):
+ call unbind to release the callback closure because maximum number
+ of callbacks is limited to DL::MAX_CALLBACK (== 5) with pure DL
+ without Fiddle.
+
+Wed Dec 12 00:13:34 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * ext/dl/lib/dl/func.rb (DL::Function#unbind, #bound?): suppress
+ NoMethodError when Fiddle is available. [ruby-core:50756] [Bug #7543]
+ * test/dl/test_func.rb (test_bound*, test_unbind*): tests for the above.
+
+Tue Dec 11 19:38:37 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * ext/fiddle/function.c (Fiddle::Function.new): new keyword argument
+ :name to set the name attribute.
+ * ext/fiddle/lib/fiddle/import.rb (import_function, bind_function):
+ set function name by using the :name keyword argument.
+ Re-fixes r38243. [ruby-core:50566]
+ * test/fiddle/test_function.rb (test_name): test for the :name keyword
+ argument and Fiddle::Function#name.
+
+Tue Dec 11 16:57:33 2012 Eric Hodel <drbrain@segment7.net>
+
+ * common.mk: Added --pages-dir to rdoc creation. Now doc/ items show
+ up at top-level.
+ * .document: Moved doc/* entries to doc/.document
+ * doc/.document: ditto
+
+Tue Dec 11 16:44:37 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/options.rb: Added --page-dir option for moving pages in
+ doc/ to the top-level.
+ * lib/rdoc/rdoc.rb: ditto.
+ * test/rdoc/test_rdoc_options.rb: Test for the above.
+ * test/rdoc/test_rdoc_rdoc.rb: ditto.
+
+Tue Dec 11 15:24:05 2012 Eric Hodel <drbrain@segment7.net>
+
+ * ext/pathname/lib/pathname.rb: Hide private methods from RDoc.
+
+Tue Dec 11 15:11:29 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * tool/make-snapshot (BASERUBY): add --disable-gem to avoid load gems.
+ [Bug #7541] [ruby-core:50736]
+
+Tue Dec 11 12:00:19 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/dl/win32/extconf.rb: Fix typo
+ by Santiago Pastorino <santiago@wyeworks.com>
+ https://github.com/ruby/ruby/pull/221 fix GH-221
+
+Tue Dec 11 01:53:37 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * lib/matrix: alias {row|column}_size to {row|column}_count and use
+ the latter.
+ [Bug #7369] [ruby-core:49409]
+
+Tue Dec 11 00:26:58 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * fix the behavior when a module is included into a refinement.
+ This change is a little tricky, so it might be better to prohibit
+ module inclusion to refinements.
+
+ * include/ruby/ruby.h (RMODULE_INCLUDED_INTO_REFINEMENT): new flag
+ to represent that a module (iclass) is included into a refinement.
+
+ * class.c (include_modules_at): set RMODULE_INCLUDED_INTO_REFINEMENT
+ if klass is a refinement.
+
+ * eval.c (rb_mod_refine): set the superclass of a refinement to the
+ refined class for super.
+
+ * eval.c (rb_using_refinement): skip the above superclass (the
+ refined class) when creating iclasses for refinements. Otherwise,
+ `using Refinement1; using Refinement2' creates iclasses:
+ <Refinement2> -> <RefinedClass> -> <Refinement1> -> RefinedClass,
+ where <Module> is an iclass for Module, so RefinedClass is
+ searched before Refinement1. The correct iclasses should be
+ <Refinement2> -> <Refinement1> -> RefinedClass.
+
+ * vm_insnhelper.c (vm_search_normal_superclass): if klass is an
+ iclass for a refinement, use the refinement's superclass instead
+ of the iclass's superclass. Otherwise, multiple refinements are
+ searched by super. For example, if a refinement Refinement2
+ includes a module M (i.e., Refinement2 -> <M> -> RefinedClass,
+ and if refinements iclasses are <Refinement2> -> <M>' ->
+ <Refinement1> -> RefinedClass, then super in <Refinement2> should
+ use Refinement2's superclass <M> instead of <Refinement2>'s
+ superclass <M>'.
+
+ * vm_insnhelper.c (vm_search_super_method): do not raise a
+ NotImplementError if current_defined_class is a module included
+ into a refinement. Because of the change of
+ vm_search_normal_superclass(), the receiver might not be an
+ instance of the module('s iclass).
+
+ * test/ruby/test_refinement.rb: related test.
+
+Mon Dec 10 18:35:25 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * vm_method.c (rb_method_entry_without_refinements): use
+ rb_resolve_refined_method() to search superclasses if
+ me->def->orig_me is 0. This change fixes make test-all
+ TESTS="json ruby/test_refinement.rb".
+
+ * test/ruby/test_refinement.rb: related test.
+
+Mon Dec 10 17:59:07 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/fiddle/win32/*: library ports from DL to Fiddle.
+
+ * ext/dl/win32/extconf.rb: check fiddle. often case dl compiled prior
+ to fiddle, so this change is no meaning. in most cases, simply
+ fiddle/win32 overwrite dl/win32.
+
+Mon Dec 10 15:23:35 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_trace.c (rb_threadptr_exec_event_hooks): exceptions in event
+ hooks should not propagate outside.
+
+Mon Dec 10 15:11:06 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * compile.c (iseq_compile_each): count flip-flop state in local iseq
+ not in each iseqs, so that the keys can be other than hidden
+ strings. [ruby-core:47253] [Bug #6899]
+
+ * vm_insnhelper.c (lep_svar_get, lep_svar_set, vm_getspecial): store
+ flip-flop states in an array instead of a hash.
+
+ * iseq.c (set_relation): main iseq also can has local scope.
+
+Mon Dec 10 10:36:12 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * lib/irb/magic-file.rb: set a encoding, which is detected from
+ the file to read, to the internal encoding.
+ [Bug #4281][ruby-dev:43036]
+
+Mon Dec 10 09:40:19 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/ext/cmake_builder.rb: Added a builder for cmake.
+ * lib/rubygems/ext.rb: ditto.
+ * lib/rubygems/installer.rb: ditto.
+ * test/rubygems/test_gem_ext_cmake_builder.rb: Test for above.
+
+Mon Dec 10 09:13:08 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/package.rb: Omit directories when packaging gems like
+ RubyGems 1.8.x
+ * test/rubygems/test_gem_package.rb: Test for above.
+
+Sun Dec 9 17:36:59 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_call_opt_send): Kernel#send should not use
+ refinements.
+
+ * proc.c (mnew): Kernel#method, Kernel#public_method,
+ Module#instance_method, and Module#public_instance_method should
+ not use refinements.
+
+ * vm_method.c (rb_method_boundp): Kernel#respond_to? should not use
+ refinements.
+
+ * test/ruby/test_refinement.rb: related test.
+
+Sun Dec 9 06:19:04 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/markdown/entities.rb: Added documentation.
+
+ * lib/rdoc/parser/ruby.rb: Updated style
+
+ * lib/rdoc/ruby_lex.rb: Parse characters up to \u{FFFFF}
+ * test/rdoc/test_rdoc_ruby_lex.rb: Test for above.
+
+Sat Dec 8 22:38:35 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * eval.c (rb_mod_refine): don't override Module#include. It's
+ unnecessary now because refinements are activated only in refine
+ blocks.
+
+Sat Dec 8 22:33:26 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * eval.c: remove Module#refinements.
+
+ * test/ruby/test_refinement.rb: remove tests for Module#refinements.
+
+Sat Dec 8 13:17:55 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * eval.c (top_using): raise a RuntimeError if using is called in a
+ module definition or a method definition.
+
+ * test/ruby/test_refinement.rb: related test.
+
+Sat Dec 8 15:01:35 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/commands/cleanup_command.rb: Skip default gems when
+ cleaning up.
+ * test/rubygems/test_gem_commands_cleanup_command.rb: Test for above.
+
+ * lib/rubygems/commands/query_command.rb: Fixed listing remote gems.
+
+ * lib/rubygems/dependency_installer.rb: Ignore non-files when looking
+ for local gems.
+ * test/rubygems/test_gem_dependency_installer.rb: Test for above.
+
+ * lib/rubygems/uninstaller.rb: The user must confirm uninstalling gems
+ that have dependencies.
+ * test/rubygems/test_gem_uninstaller.rb: Test for above.
+
+ * lib/rubygems.rb (module Gem): Updated version.
+
+ * test/rubygems/*.pem: Updated to run in FIPS mode.
+ * test/rubygems/test_gem_security.rb: ditto.
+ * test/rubygems/test_gem_security_signer.rb: ditto.
+
+Sat Dec 8 12:34:01 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_search_normal_superclass): super in a
+ refinement always uses the refined class as its superclass.
+
+ * test/ruby/test_refinement.rb: related test.
+
+Sat Dec 8 11:59:59 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * eval.c (rb_mod_refine): raise an ArgumentError if a given
+ block is of a Proc object.
+
+ * vm_insnhelper.c (vm_call_method): store refined methods in inline
+ cache to improve performance. It's safe now because blocks cannot
+ be yielded with different refinements in the new specification.
+
+ * test/ruby/test_refinement.rb: related test.
+
+Sat Dec 8 11:17:53 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * eval.c (rb_mod_refine), vm_eval.c (rb_yield_refine_block):
+ Module#refine activates all refinements defined in that module
+ only in a given block.
+
+ * string.c (sym_to_proc, sym_call): don't use refinements.
+
+ * test/ruby/test_refinement.rb: related test.
+
+Sat Dec 8 09:24:42 2012 Eric Hodel <drbrain@segment7.net>
+
+ * ext/openssl/ossl_x509name.c: Completed documentation for
+ OpenSSL::X509::Name.
+
+Sat Dec 8 07:57:12 2012 Koichi Sasada <ko1@atdot.net>
+
+ * ext/objspace/objspace.c (iow_size): return size of internal object
+ for ObjectSpace.memsize_of().
+
+ * test/objspace/test_objspace.rb: add a test.
+
+Tue Dec 08 02:39:23 2012 James Edward Gray II <james@graysoftinc.com>
+
+ * lib/csv.rb: A fix for row comparison by Stephen Wattam. [Bug #7528]
+
+Sat Dec 8 01:27:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit.rb (Test::Unit::Runner#_run_parallel): no need to
+ check all reports.
+
+Sat Dec 8 00:10:34 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * vm_eval.c (yield_under, eval_under): do not activate refinements
+ of the receiver in module_eval and instance_eval.
+
+ * eval.c (ruby_Init_refinement): undef Class#refine.
+
+ * eval.c (ruby_Init_refinement): remove Module#using.
+
+ * eval.c (ruby_Init_refinement): main.using should be private.
+
+ * eval.c (rb_mod_refine): the argument of Module#refine should not
+ be a module.
+
+ * insns.def (defineclass): do not activate refinements in a class or
+ module.
+
+Fri Dec 7 23:42:11 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * ext/refinement/refinement.c: include ruby/ruby.h instead of the
+ declaration of rb_warn().
+
+Fri Dec 7 16:07:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * doc/etc.rd: Removed stale documentation file
+ * ext/etc/etc.c: Merged documentation from doc/etc.rd and updated
+ rdoc, added documentation for Etc::Passwd and Etc::Group
+
+Fri Dec 7 16:00:57 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * lib/test/unit.rb (Test::Unit::Runner#_run_parallel): no need to
+ retry skipped test. this fix makes 40% faster the whole test-all
+ with -j5 on Windows.
+
+Fri Dec 7 14:22:29 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/markup/to_joined_paragraph.rb: Completed documentation
+ * lib/rdoc/parser/c.rb: ditto
+ * lib/rdoc/parser/changelog.rb: ditto
+ * lib/rdoc/servlet.rb: ditto
+ * lib/rdoc/store.rb: ditto
+
+ * lib/rdoc/store.rb: Improved HTML error page. Completed
+ documentation
+
+ * lib/rdoc/parser/ruby.rb: Fixed bug attaching a comment to A::B = 42
+ * test/rdoc/test_rdoc_parser_ruby.rb: Test for above
+
+ * test/rdoc/test_rdoc_comment.rb: Removed garbage
+
+Fri Dec 7 14:03:59 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/timeout.rb (Timeout#timeout): since async_interrupt_timing
+ re-raises a deferred exception, replace the timeout exception with
+ Timeout::Error after it. [Bug #7503]
+
+Fri Dec 7 13:07:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * doc/forwardable.rd: Remove stale documentation file
+ * lib/forwardable.rb: Merge documentation from doc/forwardable.rd
+
+Fri Dec 7 09:47:35 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * time.c (time_mdump): dump timezone string to private instance variable
+ on marshaling.
+
+ * time.c (time_mload): load timezone string from private instance
+ variable named 'zone'.
+
+Fri Dec 7 01:15:07 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * ext/fiddle/lib/fiddle/function.rb (Fiddle::Function#name): new
+ attribute needed to switch Win32::Registry from DL to Fiddle.
+
+ * ext/fiddle/lib/fiddle/import.rb (import_function, bind_function):
+ set function name to the returned Fiddle::Function object.
+
+Fri Dec 7 00:11:44 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * test/ruby/test_refinement.rb: fix some tests to use neither
+ Module#using nor Module#module_eval.
+
+Thu Dec 6 23:27:50 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * eval.c (ruby_Init_refinement): a new function to enable
+ Refinements with a warning "Refinements are experimental...".
+
+ * ext/refinement/refinement.c, ext/refinement/extconf.rb: a new
+ extension library to enable Refinements.
+
+Thu Dec 6 18:23:05 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * revised r37993 to avoid SEGV/ILL in tests. In r37993, a method
+ entry with VM_METHOD_TYPE_REFINED holds only the original method
+ definition, so ci->me is set to a method entry allocated in the
+ stack, and it causes SEGV/ILL. In this commit, a method entry
+ with VM_METHOD_TYPE_REFINED holds the whole original method entry.
+ Furthermore, rb_thread_mark() is changed to mark cfp->klass to
+ avoid GC for iclasses created by copy_refinement_iclass().
+
+ * vm_method.c (rb_method_entry_make): add a method entry with
+ VM_METHOD_TYPE_REFINED to the class refined by the refinement if
+ the target module is a refinement. When a method entry with
+ VM_METHOD_TYPE_UNDEF is invoked by vm_call_method(), a method with
+ the same name is searched in refinements. If such a method is
+ found, the method is invoked. Otherwise, the original method in
+ the refined class (rb_method_definition_t::body.orig_me) is
+ invoked. This change is made to simplify the normal method lookup
+ and to improve the performance of normal method calls.
+
+ * vm_method.c (EXPR1, search_method, rb_method_entry),
+ vm_eval.c (rb_call0, rb_search_method_entry): do not use
+ refinements for method lookup.
+
+ * vm_insnhelper.c (vm_call_method): search methods in refinements if
+ ci->me is VM_METHOD_TYPE_REFINED. If the method is called by
+ super (i.e., ci->call == vm_call_super_method), skip the same
+ method entry as the current method to avoid infinite call of the
+ same method.
+
+ * class.c (include_modules_at): add a refined method entry for each
+ method defined in a module included in a refinement.
+
+ * class.c (rb_prepend_module): set an empty table to
+ RCLASS_M_TBL(klass) to add refined method entries, because
+ refinements should have priority over prepended modules.
+
+ * proc.c (mnew): use rb_method_entry_with_refinements() to get
+ a refined method.
+
+ * vm.c (rb_thread_mark): mark cfp->klass for iclasses created by
+ copy_refinement_iclass().
+
+ * vm.c (Init_VM), cont.c (fiber_init): initialize th->cfp->klass.
+
+ * test/ruby/test_refinement.rb (test_inline_method_cache): do not skip
+ the test because it should pass successfully.
+
+ * test/ruby/test_refinement.rb (test_redefine_refined_method): new
+ test for the case a refined method is redefined.
+
+Thu Dec 6 17:29:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (parser_here_document): flush string content between new
+ line and :string_embexpr. [ruby-core:48703] [Bug #7255]
+
+Thu Dec 6 16:35:21 2012 Eric Hodel <drbrain@segment7.net>
+
+ * test/rake/helper.rb: Load envutil correctly. Removed useless rescue
+ for signal propagation tests
+ * lib/rake/file_utils.rb: Prefer the built ruby.
+ * test/rake/test_rake_functional.rb: ditto
+
+Thu Dec 6 15:20:34 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/context.rb: Don't warn for duplicate methods while loading.
+ * test/rdoc/test_rdoc_context.rb: Test for above.
+
+Thu Dec 6 14:26:22 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/command_manager.rb: Removed string concatenation
+ syntax. [Bug #6265]
+ * lib/rubygems/commands/install_command.rb: ditto
+ * lib/rubygems/commands/uninstall_command.rb: ditto
+ * lib/rubygems/indexer.rb: ditto
+ * lib/rubygems/security/policy.rb: ditto
+ * lib/rubygems/security.rb: ditto
+ * lib/rubygems/uninstaller.rb: ditto
+ * test/rubygems/test_gem_commands_cert_command.rb: ditto
+ * test/rubygems/test_gem_package.rb: ditto
+ * test/rubygems/test_gem_security.rb: ditto
+ * test/rubygems/test_gem_security_policy.rb: ditto
+
+Thu Dec 6 14:10:08 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/package.rb: Set rubygems_version before validation.
+ Fixes issue with bundler.
+ * test/rubygems/test_gem_package.rb: Test for above.
+
+ * lib/rubygems/remote_fetcher.rb: Only update the cache when we have
+ permission. [ruby-trunk - Bug #7509]
+ * lib/rubygems/source.rb (class Gem): ditto
+ * test/rubygems/test_gem_remote_fetcher.rb: Test for above.
+ * lib/rubygems/test_utilities.rb: ditto
+
+ * lib/rubygems/specification.rb: Derive base_dir properly for default
+ gems. [ruby-trunk - Bug #7496]
+ * test/rubygems/test_gem_specification.rb: Test for above.
+
+ * lib/rubygems.rb: Untaint Dir.pwd when searching for gemdeps files
+ for operation under $SAFE=1
+
+Thu Dec 06 12:07:11 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_trace.c: TracePoint#enable should not cause an error
+ when it is already enabled. TracePoint#disable is too.
+ [ruby-core:50561] [ruby-trunk - Bug #7513]
+
+ * test/ruby/test_settracefunc.rb: add tests.
+
+Thu Dec 6 07:19:58 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc*: Improved display of ChangeLog files as HTML.
+ * test/rdoc*: Test for above.
+
+Thu Dec 6 04:34:19 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_uninterruptible): helper function for providing
+ temporary async_interrupt_timing(Object => :defer)
+
+ * io.c (rb_f_p): use rb_uninterruptible.
+ * io.c (rb_f_p_internal): helper function for rb_f_p().
+ * io.c (struct rb_f_p_arg): new struct for rb_f_p_internal.
+
+ * test/ruby/test_thread.rb (test_async_interrupt_and_p): test for
+ the above.
+
+Thu Dec 6 04:27:10 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (io_binwrite): check interrupt before io issue.
+ * test/ruby/test_thread.rb (test_async_interrupt_and_io):
+ test for the above.
+
+Thu Dec 6 01:10:36 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_eval.c (rb_method_call_status): use Qundef as no self instead of
+ the current self.
+
+ * vm_eval.c (send_internal): public_send does not consider how it is
+ called, as mentioned in r14173. patched by charliesome (Charlie
+ Somerville). [ruby-core:50489] [Bug #7499]
+
+Wed Dec 5 23:50:23 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c (getrusage_time): uses clock_gettime() with
+ CLOCK_PROCESS_CPUTIME_ID when available, which provides a 1ns
+ precision on linux. [ruby-core:50495] [Bug #7500]
+ patched by Aman Gupta.
+
+Wed Dec 5 22:46:02 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm.c (rb_vm_make_proc): save the proc made from the given block so
+ that it will not get collected. [ruby-core:50545] [Bug #7507]
+
+Wed Dec 5 22:13:57 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * ext/dl/lib/dl/func.rb (DL::Function#bind): When Fiddle is used,
+ @ptr should be updated. This fixes SEGV raised in DL::Function#call
+ after calling DL::Function#bind. [Bug #7516] [ruby-dev:46708]
+
+ * test/dl/test_func.rb (test_bind): test for the above
+
+Wed Dec 5 18:53:00 2012 Masaya Tarui <tarui@ruby-lang.org>
+
+ * thread.c (rb_thread_s_async_interrupt_timing): have to check ints
+ before jumping out.
+ * test/ruby/test_thread.rb (test_async_interrupt_with_return): add test
+ rescue has to catch a queued async exception at the time of return.
+ * test/ruby/test_thread.rb (test_async_interrupt_with_break): add test
+ rescue has to catch a queued async exception at the time of break.
+
+Wed Dec 5 16:54:28 2012 Koichi Sasada <ko1@atdot.net>
+
+ * test/ruby/memory_status.rb: suppress warning.
+ A patch from NAKAMURA Usaku.
+
+Wed Dec 5 16:06:54 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/parser/changelog.rb: Parse more ChangeLog file variations.
+ * test/rdoc/test_rdoc_parser_changelog.rb: Test for above.
+
+Wed Dec 5 12:17:11 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * ext/dl/lib/dl/func.rb (DL::Function#initialize, DL::Function#bind):
+ ABI should be set by using CFunc#calltype even when Fiddle is used.
+ When Fiddle is used and a block is given, name should not be ignored.
+ [ruby-core:50562] [Bug #7514]
+
+ * ext/dl/lib/dl/import.rb (DL::Importer#bind_function): should respect
+ abi and name when Fiddle is used.
+
+ * test/dl/test_func.rb (test_name_with_block): test for "name" method
+ with giving a block.
+
+Wed Dec 5 11:55:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * doc/shell.rd, doc/shell.rd.ja: Removed stale doc files
+ * lib/shell.rb, lib/shell/*: Merge and updates docs from doc/shell.rd*
+
+Wed Dec 5 11:42:38 2012 Koichi Sasada <ko1@atdot.net>
+
+ * test/ruby/test_settracefunc.rb: disable trace.
+
+Wed Dec 5 11:37:37 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (MakeMakefile#macro_defined?): use clearly different
+ strings from conflict markers.
+
+Wed Dec 5 04:25:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/README: Add rdoc modeline directive and formatting libs
+
+Wed Dec 5 04:04:02 2012 Masaya Tarui <tarui@ruby-lang.org>
+
+ * test/ruby/test_thread.rb (test_async_interrupt_blocking): bugfix
+ about deferred check
+
+Wed Dec 5 03:35:37 2012 Masaya Tarui <tarui@ruby-lang.org>
+
+ * vm_core.h (RUBY_VM_CHECK_INTS_BLOCKING): check async queue everytime.
+ * thread.c (sleep_forever): check RUBY_VM_CHECK_INTS_BLOCKING first.
+ * thread.c (sleep_timeval): ditto.
+ * test/ruby/test_thread.rb (test_async_interrupt_blocking): add a test
+ exceptions are correctly deferred and raised on :on_blocking context.
+
+Wed Dec 5 02:36:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk, defs/id.def, template/id.c.tmpl: generate id.c as well as id.h.
+
+Wed Dec 5 00:56:21 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_mutex_owned_p): new method that return current
+ thread have the target mutex or not. [Feature #7505] [ruby-dev:46697]
+ * test/ruby/test_thread.rb (test_mutex_owned, test_mutex_owned2):
+ test for the above.
+ * NEWS: new for the above.
+
+Wed Dec 5 00:05:47 2012 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/erb.rb (make_compiler, add_put_cmd, add_insert_cmd): extract
+ methods.
+
+Tue Dec 4 18:21:04 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * test/ruby/memory_status.rb (Memory): use fiddle/types if available.
+
+ * test/ruby/memory_status.rb (Memory::Win32): :stdcall is needed on
+ x86 WIN32. This commit partly reverts r38054.
+
+Tue Dec 4 18:05:58 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * ext/fiddle/lib/fiddle/types.rb: copied from ext/dl/lib/dl/types.rb
+ and modified for Fiddle, needed for migration from DL to Fiddle.
+
+Tue Dec 4 17:57:09 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * ext/fiddle/lib/fiddle/import.rb (import_function, bind_function):
+ should respect call_type for migration from DL to Fiddle.
+ [Bug #7484] [ruby-core:50405]
+
+Tue Dec 4 16:54:00 2012 Eric Hodel <drbrain@segment7.net>
+
+ * .document: Added ChangeLog and doc/ChangeLog-* as documentation
+
+Tue Dec 4 16:47:46 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/parser/changelog.rb: Added a ChangeLog parser to RDoc.
+ * lib/rdoc/parser.rb: ditto
+ * test/rdoc/test_rdoc_parser_changelog.rb: Test for above.
+
+Tue Dec 4 16:23:32 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * marshal.c (path2class, path2module): use PRIsVALUE.
+
+ * marshal.c (w_object, marshal_dump, marshal_load): use
+ rb_check_funcall if possible.
+
+ * marshal.c (w_object, marshal_dump, r_object0, marshal_load): use
+ RB_GC_GUARD() (directly or indirectly) instead of volatile.
+
+ * variable.c (rb_path_to_class): prevent the argument from GC.
+
+Tue Dec 04 13:55:07 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_opts.h: enable optimization - operand unification.
+ Operand unification technique enable to combine
+ an instruction and specific operands and make new
+ instruction.
+
+ * defs/opt_operand.def: add several configuration
+ of operand unification.
+
+ * insns.def: use `int' instead to suppress warning.
+
+Mon Dec 3 17:58:53 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * parse.y: replace parser->enc with current_enc.
+
+Tue Dec 4 08:33:46 2012 Eric Hodel <drbrain@segment7.net>
+
+ * README.EXT: Converted to RDoc format
+ * README.EXT.ja: ditto
+
+Tue Dec 4 08:32:10 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/ri/driver.rb: Fixed ri page display for files with
+ extensions.
+ * test/rdoc/test_rdoc_ri_driver.rb: Test for above
+
+Tue Dec 4 04:11:50 2012 Eric Hodel <drbrain@segment7.net>
+
+ * .document: Add NEWS for `ri ruby:NEWS`
+ * NEWS: Set format as rdoc
+ * doc/NEWS-1.8.7: ditto
+ * doc/NEWS-1.9.1: ditto
+ * doc/NEWS-1.9.2: ditto
+ * doc/NEWS-1.9.3: ditto
+
+Mon Dec 3 20:37:22 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_exec.c: check VM_COLLECT_USAGE_DETAILS.
+
+Mon Dec 3 20:28:02 2012 Koichi Sasada <ko1@atdot.net>
+
+ * compile.c (iseq_specialized_instruction):
+ change condition of using `opt_send_simple'.
+ More method invocations can be simple.
+
+Mon Dec 3 20:03:38 2012 Koichi Sasada <ko1@atdot.net>
+
+ * test/ruby/test_objectspace.rb: skip RuntimeError
+ which says a message "can't modify frozen File".
+ Is that correct behavior?
+
+Mon Dec 03 20:00:19 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_exec.c: vm_analysis_insn should be static.
+
+Mon Dec 3 19:10:12 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * random.c (Init_Random), rational.c (Init_Rational): make marshal
+ methods private. [Feature #6539]
+
+Mon Dec 3 18:29:27 2012 Koichi Sasada <ko1@atdot.net>
+
+ * iseq.h: iseq_catch_table_entry::catch_type should be
+ Fixnum because they are pushed into Array in a compiler.
+ [Bug #7502]
+
+ * test/ruby/test_objectspace.rb: add a test of this issue.
+
+Mon Dec 3 18:25:16 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * template/id.h.tmpl (preserved_ids): "empty?" is not an attribute name.
+
+Mon Dec 3 16:23:09 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_backtrace.c (vm_backtrace_to_ary): check negative size (2nd arg).
+
+Mon Dec 3 15:50:33 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * misc/ruby-additional.el (ruby-mode-set-encoding): Unbreak by
+ fixing a typo, s/set/setq/.
+
+Mon Dec 3 14:14:19 2012 Koichi Sasada <ko1@atdot.net>
+
+ * compile.c (iseq_compile_each): joke shouldn't use id.h defined ids.
+
+ * id.c (Init_id): ditto.
+
+ * common.mk: fix dependency.
+
+Mon Dec 3 12:43:35 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * misc/ruby-mode.el (ruby-block-end-re, ruby-delimiter)
+ (ruby-mode-syntax-table, ruby-parse-partial, ruby-beginning-of-indent):
+ merge from Emacs.
+
+ * misc/ruby-mode.el (ruby-calculate-indent): fix indentation of
+ argument lines in parentheses. [Bug #5140]
+
+Mon Dec 3 07:52:41 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/parser.rb: Improved modeline support. Patch by nobu.
+ * test/rdoc/test_rdoc_parser.rb: Test for above.
+
+Sun Dec 3 00:06:00 2012 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_new): stop checking string
+ taintness. [Bug #5508] [ruby-core:40510]
+
+Sun Dec 2 19:26:47 2012 Masaya Tarui <tarui@ruby-lang.org>
+
+ * thread.c (RB_GC_SAVE_MACHINE_CONTEXT, rb_gc_save_machine_context):
+ extract rb_gc_save_machine_context to RB_GC_SAVE_MACHINE_CONTEXT.
+ NOTE: machine_regs and machine_stack_end must be set in current scope.
+
+Sun Dec 2 18:46:24 2012 Koichi Sasada <ko1@atdot.net>
+
+ * array.c, enum.c, insns.def, io.c, numeric.c, parse.y, process.c,
+ range.c: use prepared IDs.
+ A patch from charliesome (Charlie Somerville).
+ [Bug #7495]
+
+ * common.mk: add dependency to id.h.
+
+ * common.mk: replace ID_H_INCLUDES with id.h.
+
+Sun Dec 2 16:48:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/weakref.rb (rdoc): Clean up usage, add example,
+ note ArgumentError on WeakRef.new
+
+Sun Dec 2 16:45:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * gc.c (WeakMap): Add doc for internal reference, use lib/weakref.rb
+
+Sun Dec 2 07:24:23 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/parser.rb: Parse files with a -*- rdoc -*- modeline
+ * test/rdoc/test_rdoc_parser.rb: Test for above
+
+Sun Dec 2 06:02:00 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * gc.h (SET_MACHINE_STACK_END): add volatile for preventing
+ harmful optimization. [ruby-dev:46665] [Bug #7468]
+
+Sun Dec 2 05:01:58 2012 Koichi Sasada <ko1@atdot.net>
+
+ * iseq.c (rb_iseq_line_trace_each): iterate `line' event only.
+
+ * test/ruby/test_iseq.rb: add a test for this change.
+
+Sun Dec 2 02:46:04 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_trace.c: add TracePoint#inspect.
+
+ * test/ruby/test_settracefunc.rb: add a test for this change.
+
+Sat Dec 1 21:18:19 2012 Koichi Sasada <ko1@atdot.net>
+
+ * test/ruby/test_backtrace.rb: add a test for
+ Thread::Backtrace::Location#inspect.
+ BTW, tests for `caller_locations' are not enough.
+ Any volunteers are welcome.
+
+Sat Dec 1 21:06:58 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_backtrace.c (location_inspect_m): add
+ Thread::Backtrace::Location#inspect.
+ It same as loc_obj.to_s.inspect.
+
+Sat Dec 1 19:24:09 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (rb_io_puts): recurse for the argument itself, not converted
+ array elements. [ruby-core:42444] [Bug #5986]
+
+Sat Dec 1 19:01:36 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * marshal.c (w_object, r_object0): call private marshal methods.
+ [Feature #6539]
+
+Sat Dec 1 18:52:22 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/commands/cleanup_command.rb: Fix cleanup command for
+ multiple gems. [ruby-trunk - #7481] by Kouhei Sutou
+ * test/rubygems/test_gem_commands_cleanup_command.rb: Test for above.
+ * lib/rubygems.rb: Autoload Gem::Source to prevent test failures
+
+Sat Dec 1 18:17:00 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * complex.c (Init_Complex), time.c (Init_Time): make marshal methods
+ private. [Feature #6539]
+
+ * object.c (Init_Object): make remove_instance_variable public.
+ [Feature #6539]
+
+ * id.c (Init_id), template/id.h.tmpl: add initialize_{copy,clone,dup}
+ and respond_to_missing?.
+
+ * vm_method.c (rb_method_entry_make): make above methods private.
+ [Feature #6539]
+
+Sat Dec 1 16:40:22 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_thread.rb: move ConditionVariable related test
+ into test/thread/test_cv.rb.
+ * test/thread/test_cv.rb: new file.
+ * test/thread/test_cv.rb (test_condvar_empty_signal): new tests.
+ * test/thread/test_cv.rb (test_condvar_empty_broadcast): ditto.
+
+Sat Dec 1 15:14:25 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_thread.rb (test_cv_wait_deadlock): enable
+ cv deadlock test.
+
+Sat Dec 1 14:23:33 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * lib/thread.rb (ConditionVariable): use hash instead of array for
+ @waiters.
+ * test/thread/test_queue.rb (test_sized_queue_and_wakeup): remove
+ a test because @waiters no longer have a chance to duplicated. Now it's
+ a hash.
+
+Sat Dec 1 17:16:54 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * misc/ruby-electric.el (ruby-electric-curlies): use kill-region
+ instead of interactive command delete-backward-char.
+
+Sat Dec 1 17:12:55 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * misc/inf-ruby.el (inferior-ruby-mode): fix the
+ compilation-shell-minor-mode configuration. a patch by
+ j2petkov (Jean-Christophe Petkovich) in [ruby-core:46518].
+ [Bug #6742]
+
+Sat Dec 1 15:05:30 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dir.c (glob_helper): use NAMLEN() to tell the length of d_name
+ instead of strlen(), which can access beyond the boundary.
+
+Sat Dec 1 13:48:13 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/specification.rb: Don't add default gems to $LOAD_PATH
+ as they are already there.
+
+Sat Dec 1 12:22:17 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * re-added r38053 that is reverted by r38061. Problems by r38053
+ are resolved by r38096. r38096 removed GEM_SKIP configuration.
+
+ The below is ChangeLog of r38053:
+
+ * defs/default_gems: Add base directory column.
+
+ * tool/rbinstall.rb:
+ - Install .gemspecs of default gem to
+ #{GEM_HOME}/specifications/default/.
+ - Update files parameter of .gemspecs by relative path from
+ library directory.
+
+Sat Dec 1 11:09:12 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * variable.c (rb_class_path_no_cache): add a function to get the class
+ path without caching the computed path. Some classes are frozen, and
+ will raise an exception without this.
+
+ * probes.d (cmethod-entry, cmethod-return): separate cmethods from
+ regular methods to match set trace func.
+
+ * probes_helper.h: refactor macros. Fix probes to avoid calling
+ #inspect when profiling.
+
+ * insns.def: update for use with new macros.
+
+ * vm_eval.c: ditto
+
+ * vm_insnhelper.c: ditto
+
+ * test/dtrace/test_singleton_function.rb: fix test for new output.
+
+ * test/dtrace/test_cmethod.rb: test the cmethod probes.
+
+Sat Dec 1 09:44:16 2012 Eric Hodel <drbrain@segment7.net>
+
+ * test/rdoc/test_rdoc_options.rb: Windows drive letters are
+ case-insensitive.
+
+Sat Dec 1 09:42:13 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems.rb: Search for gem deps file up the directory tree.
+ * test/rubygems/test_gem.rb: Test for above.
+
+Sat Dec 1 09:33:32 2012 Eric Hodel <drbrain@segment7.net>
+
+ * test/runner.rb: Set GEM_HOME, GEM_PATH and GEM_SKIP to empty set.
+ With default_gem support in RubyGems GEM_SKIP prevents loading of
+ built-in gems.
+
+Sat Dec 1 07:16:17 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * compile.c (ADD_CATCH_ENTRY): add a cast to fix SEGV with x64 mingw
+ on Windows 8. Without cast, 0 might be non zero value at higher bits
+ in rb_ary_new3().
+ [ruby-core:50258] [Bug #7456]
+
+Sat Dec 1 04:07:57 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * parse.y (parser.utf8): remove unused property.
+
+ * parse.y (UTF8_ENC): remove unused macro.
+
+ * parse.y (parser_tokadd_utf8): use rb_utf8_encoding() directly.
+
+Sat Dec 1 03:49:45 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * lib/sync.rb (Sync_m#sync_synchronize): add Thread.async_interrupt_timing
+ for protecting from async interrupt.
+ * lib/sync.rb (Sync_m#sync_lock): ditto.
+
+Sat Dec 1 03:38:04 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * lib/thread.rb (ConditionVariable#broadcast): s/RuntimeError/StandardError/
+ * lib/thread.rb (ConditionVariable#signal): ditto.
+
+Sat Dec 1 03:29:52 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * lib/thread.rb (SizedQueue#pop): rewrite by using ConditionVariable.
+ * lib/thread.rb (SizedQueue#push): ditto.
+ * lib/thread.rb (SizedQueue#max): ditto.
+ * lib/thread.rb (Queue#pop): ditto.
+ * lib/thread.rb (Queue#push): ditto.
+
+ * lib/thread.rb (SizedQueue#num_waiting): adopt the above changes.
+ * lib/thread.rb (SizedQueue#initialize): ditto.
+ * lib/thread.rb (Queue#num_waiting): ditto.
+ * lib/thread.rb (Queue#initialize): ditto.
+ * test/thread/test_queue.rb (test_sized_queue_and_wakeup): ditto.
+
+Sat Dec 1 03:45:47 2012 Koichi Sasada <ko1@atdot.net>
+
+ * thread.c (Thread.async_interrupt_timing): fix RDoc.
+ :never is not used any more.
+
+Sat Dec 1 02:56:19 2012 Koichi Sasada <ko1@atdot.net>
+
+ * iseq.c: add RubyVM::InstructionSequence (ISeq) inspection methods.
+ * ISeq#path returns path of this ISeq written.
+ * ISeq#absolute_path returns absolute path.
+ * ISeq#label returns label (method name and so on).
+ * ISeq#base_label returns base label (see Thread::Backtrace::Location).
+ * ISeq#first_lineno returns first line number of this ISeq.
+ * ISeq.of(obj) returns ISeq object which obj (Proc or Method)
+ is contains.
+
+ * test/ruby/test_iseq.rb: add tests.
+
+Sat Dec 1 02:58:51 2012 Eric Hodel <drbrain@segment7.net>
+
+ * include/ruby/ruby.h (rb_event_flag_t): Maintain integer precision
+ for clang error (VALUE aka unsigned long vs unsigned int)
+
+Sat Dec 1 02:53:18 2012 Eric Hodel <drbrain@segment7.net>
+
+ * test/rubygems/test_gem_dependency_installer.rb: Use Gem.read_binary
+ instead of File.binread for ruby 1.8 compatibility in the rubygems
+ source repository. Updates r38075
+
+Sat Dec 1 02:33:20 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_threadptr_interrupt_mask, async_interrupt_timing_func):
+ merge into them into rb_thread_s_async_interrupt_timing.
+ * thread.c (rb_thread_s_async_interrupt_timing): ditto.
+
+Sat Dec 1 02:11:47 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_threadptr_interrupt_mask): add argument check.
+ * thread.c (async_interrupt_timing_arg_check_i): helper function
+ for the above.
+ * test/ruby/test_thread.rb (test_async_interrupt_timing_invalid_argument):
+ test for the above.
+
+Sat Dec 1 01:19:34 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * lib/thread.rb (ConditionVariable#broadcast): protect from
+ async interrupt by using Thread.async_interrupt_timing.
+ * lib/thread.rb (ConditionVariable#signal): ditto.
+ * lib/thread.rb (ConditionVariable#wait): ditto.
+
+Sat Dec 1 02:04:23 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * test/ruby/envutil.rb (Test::Unit::Assertions#assert_in_out_err):
+ raise if assert_in_out_err misused.
+
+Sat Dec 1 02:08:16 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/rdoc/test_rdoc_rubygems_hook.rb
+ (TestRDocRubygemsHook#test_setup_unwritable): 1. check the existence
+ of the file(directory) before touch it. 2. remove test
+ file(directory) after the test. see [ruby-core:50388].
+
+Sat Dec 1 01:51:06 2012 Koichi Sasada <ko1@atdot.net>
+
+ [EXPERIMENTAL]
+ * iseq.c: add following two methods.
+ * ISeq#line_trace_all returns all line traces (line numbers)
+ * ISeq#line_trace_specify(pos, set) set `pos'th line event to
+ specified_line event (if set is true).
+ These features are introduced for debuggers (mainly to make
+ breakpoint).
+
+ * iseq.h: add decl. of C APIs.
+
+ * test/ruby/test_iseq.rb: add tests.
+
+ * vm_trace.c: add `specified_line' event.
+
+ * include/ruby/ruby.h: ditto.
+
+Sat Dec 1 01:49:52 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/rubygems/test_gem_dependency_installer.rb: gems are of course
+ binary files, so use a binary reading method when reading it.
+ see [ruby-core:50388].
+
+Sat Dec 1 01:21:07 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * lib/rubygems/command.rb (Gem::Command#get_all_gem_names_and_versions):
+ who assumes that the pathname of a gem never contains ':' ?
+ yes, on Unixen pathnames can contain ':', and on Windows they almost
+ certainly contain ':'. see [ruby-core:50388].
+
+ * lib/rubygems/requirement.rb (Gem::Requirement::PATTERN_RAW): extract
+ the regexp to match the version specifier from PATTERN to use in
+ above method.
+
+Sat Dec 1 00:48:19 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * ext/fiddle/extconf.rb, ext/fiddle/function.c
+ (Fiddle::Function::STDCALL): FFI_STDCALL is not a macro, but an
+ enumeration. [ruby-core:50398] [Bug #7483]
+
+Sat Dec 1 00:08:55 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/rubygems/test_gem_installer.rb
+ (TestGemInstaller#test_check_executable_overwrite_other_non_gem):
+ on Windows, rubygems always generate a wrapper .bat file when
+ installing a file into bin, so testing no-overwrite a wrapper file
+ and a non-wrapper file is nonsense. see [ruby-core:50388].
+
+Fri Nov 30 23:39:58 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/rubygems/test_gem_installer.rb
+ (TestGemInstaller#test_check_executable_overwrite_default_bin_dir):
+ if the executable to be overwritten was generated by rubygems, the
+ error message differs from the only copied one's.
+ see [ruby-core:50388].
+
+Fri Nov 30 23:27:26 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/rubygems/test_gem_ext_ext_conf_builder.rb
+ (TestGemExtExtConfBuilder::test_class_make): reading with binary mode
+ of course introduce \r on Windows. see [ruby-core:50388].
+
+Fri Nov 30 23:11:37 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * lib/rubygems/specification.rb
+ (Gem::Specification.validate_permissions): don't check executability
+ of the source on Windows. they will be wrapped to .bat files when
+ installing. see [ruby-core:50388].
+
+Fri Nov 30 22:44:14 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * vm_core.h (rb_vm_struct): add thread_destruct_lock field.
+ * thread.c (Init_Thread): ditto.
+ * thread.c (rb_vm_gvl_destroy): ditto.
+
+ * thread.c (thread_start_func_2): make sure vm->running_thread
+ don't point to dead thread.
+ * thread.c (timer_thread_function): close a race against thread
+ destruction. [Bug #4911][ruby-dev:43859]
+
+ * vm_core.h (rb_thread_set_current): reset running time of
+ current thread instead of previous thread. We no longer
+ assume previous running thread still live.
+
+Fri Nov 30 21:57:43 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * revert r38053 because it causes too many test failures.
+ if you've already installed r38053 or later, remove the installed
+ lib/ruby/gems/2.0.0 directory and reinstall this revision or later.
+
+Fri Nov 30 21:07:56 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * lib/test/unit/parallel.rb (Test::Unit::Worker.run): wrap LoadError
+ because it's Gem::LoadError sometimes. see [Bug #6882]
+
+Fri Nov 30 20:47:44 2012 Koichi Sasada <ko1@atdot.net>
+
+ * thread.c: TracePoint#self returns invoking/exiting thread object
+ at thread_begin/end event.
+
+ * test/ruby/test_settracefunc.rb: fix test.
+
+Fri Nov 30 19:55:17 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/memory_status.rb (Memory::Win32): use fiddle instead of dl,
+ but I doubt fiddle is not compatible with dl. (if you are interested,
+ see the diff.) [ruby-core:50194] [Bug #7443]
+
+Fri Nov 30 19:37:44 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * defs/default_gems: Add base directory column.
+
+ * tool/rbinstall.rb:
+ - Install .gemspecs of default gem to
+ #{GEM_HOME}/specifications/default/.
+ - Update files parameter of .gemspecs by relative path from
+ library directory.
+
+Fri Nov 30 19:30:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * vm_trace.c:
+ tracepoint_attr_return_value (TracePoint#return_value):
+ include `:b_return` for method doc
+ tracepoint_enable_m, tracepoint_disable_m (#enable/#disable):
+ don't have block argument, document block scope
+
+Fri Nov 30 18:52:56 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_trace.c (tracepoint_disable_m, tracepoint_enable_m):
+ fix block parameter.
+ No argument should be given to a block which is passed
+ to TracePoint#enable (and disable).
+
+Fri Nov 30 18:23:26 2012 Koichi Sasada <ko1@atdot.net>
+
+ * thread.c: rename Thread.control_interrupt
+ to Thread.async_interrupt_timing.
+ The option name `:never' is also changed to `:defer'.
+ [ruby-core:50375] [ruby-trunk - Feature #6762]
+
+ * thread.c: remove Thread.check_interrupt.
+ This method is difficult to understand by name.
+
+ * thread.c: add Thread.async_interrupted?.
+ This method check any deferred async interrupts.
+
+ * test/ruby/test_thread.rb: change tests for above.
+
+Fri Nov 30 18:24:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * vm_trace.c: Documentation for TracePoint API
+ [ruby-core:47243] [Feature #6895]
+
+Fri Nov 30 17:43:50 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (rb_str_cmp_m): try to compare with to_str result if
+ possible before calling <=> method. [ruby-core:49279] [Bug #7342]
+
+ * string.c (rb_str_cmp_m): use rb_check_funcall instead of respond_to
+ and call.
+
+ * string.c (rb_str_cmp_m): return fixed value, one of -1,0,+1 always.
+
+Fri Nov 30 16:19:14 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_dump.c (rb_vm_bugreport): get rid of calling methods in sigsegv
+ handler. based on a patch by charliesome (Charlie Somerville)
+ [ruby-core:49573] [Bug #7402]
+
+Fri Nov 30 16:05:44 2012 Eric Hodel <drbrain@segment7.net>
+
+ * NEWS: Added RubyGems 2.0.0
+
+Fri Nov 30 15:24:37 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (parser_yylex): fix false usage of local variable, it cannot
+ appear in fname state [ruby-core:49659] [Bug #7408]
+
+Fri Nov 30 15:20:12 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/package.rb: Load YAML for building gems.
+ * test/rubygems/test_gem_commands_contents_command.rb: Sort expected
+ output of default gem contents. Re-fixes r38004 and r38005.
+
+Fri Nov 30 15:15:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * vm_trace.c (set_trace_func): Formatting of params and events
+
+Fri Nov 30 14:45:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/net/http.rb: Net::HTTP::Patch to list of HTTP Request Classes
+ Patch by Ryunosuke SATO [Fixes #217 on github]
+
+Fri Nov 30 14:05:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/cgi.rb: CGI example for HTML generation
+ Patch by Marcus Stollsteimer [ruby-core:50303] [Bug #7465]
+
+Fri Nov 30 13:52:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * time.c: Documentation improvements, grammar and formatting
+ Patch by Bernd Homuth [ruby-core:49203] [Bug #7326]
+
+Fri Nov 30 13:48:33 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc.rb: Set version to 4.0.0.preview2
+ * lib/rubygems.rb: Set version to 2.0.0.preview2
+
+Fri Nov 30 13:11:53 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/commands/setup_command.rb: Remove old files on install
+ of RubyGems. (not by rbinstall.rb).
+ * test/rubygems/test_gem_commands_setup_command.rb: Test for above.
+
+Fri Nov 30 12:47:59 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/abbrev.rb (Abbrev#abbrev): A fixed string prefix pattern
+ should only match the beginning of each word, not the beginning
+ of every line in it.
+
+ * lib/abbrev.rb (Abbrev#abbrev): Stop using a regexp that causes a
+ false warning. [Bug #7471]
+
+Fri Nov 30 12:30:55 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * test/test_abbrev.rb: Add tests for lib/abbrev.rb.
+
+Fri Nov 30 12:27:51 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/spec_fetcher.rb: Allow prerelease spec fetching to fail
+ for bundler.
+ * test/rubygems/test_gem_spec_fetcher.rb: Test for above.
+
+Fri Nov 30 12:20:53 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rake/backtrace.rb: Removed duplication in
+ Rake::Backtrace::SUPPRESSED_PATHS
+ * test/rake/test_rake_backtrace.rb: Skip tests when tmpdir is in the
+ suppressed pattern.
+
+Fri Nov 30 11:07:45 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * revert r37993 to avoid SEGV in tests.
+
+Fri Nov 30 10:38:54 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/ri/driver.rb: Relaxed matching for pages to be more
+ user-friendly.
+ * test/rdoc/test_rdoc_ri_driver.rb: Test for above.
+
+Fri Nov 30 09:50:16 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/markdown.rb: Fixed warnings with -w
+
+Fri Nov 30 09:38:22 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/ruby.h (RB_GC_GUARD_PTR): add note.
+
+ * vm_backtrace.c (backtrace_to_str_ary): use RB_GC_GUARD() instead of
+ RB_GC_GUARD_PTR() which has no effect.
+ (backtrace_to_location_ary): ditto.
+ (vm_backtrace_to_ary): ditto.
+
+Fri Nov 30 09:22:52 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/commands/contents_command.rb: Sort output from command.
+ Replaces r38004, r38005
+ * test/rubygems/test_gem_commands_contents_command.rb: ditto.
+
+ * lib/rubygems/defaults.rb: Use Gem.path_separator for jruby support.
+ * lib/rubygems/path_support.rb: ditto
+
+Fri Nov 30 08:34:03 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/generator/darkfish.rb: Silenced warning
+ * test/rdoc/test_rdoc_rdoc.rb: ditto
+
+ * lib/rdoc/markup/parser.rb: Use byteslice when available for
+ performance
+ * test/rdoc/test_rdoc_markup_parser.rb: Test for above
+ * lib/rdoc/test_case.rb: ditto
+
+ * lib/rdoc/parser/ruby.rb: Fixed bug parsing yield({})
+ * test/rdoc/test_rdoc_parser_ruby.rb (end):
+
+ * lib/rdoc/rubygems_hook.rb: Skip default gems. Display generator
+ name properly.
+ * test/rdoc/test_rdoc_rubygems_hook.rb: Test for above
+
+ * lib/rdoc/servlet.rb: Fixed typo.
+
+Fri Nov 30 08:09:56 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c : remove a unused function.
+
+Fri Nov 30 07:46:42 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c (rb_objspace_call_finalizer): finalize_deferred may free up
+ a object which is reachable from a part after this function,
+ e.g. ruby_vm_destruct(). [ruby-dev:46647] [Bug #7452]
+
+ * test/ruby/test_gc.rb (test_finalizing_main_thread): add a test
+ for above.
+
+Fri Nov 30 07:43:44 2012 Koichi Sasada <ko1@atdot.net>
+
+ * thread.c (rb_thread_interrupted): avoid warning of
+ implicit conversion.
+
+ * thread.c (rb_threadptr_execute_interrupts): ditto.
+
+Fri Nov 30 07:34:28 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_backtrace.c: add GC guards.
+
+Fri Nov 30 07:21:33 2012 Koichi Sasada <ko1@atdot.net>
+
+ [EXPERIMENTAL: NEED DISCUSS]
+ * vm_trace.c: add events
+ * :thread_begin - hook at thread beginning.
+ * :thread_end - hook at thread ending.
+ * :b_call - hook at block enter.
+ * :b_return - hook at block leave.
+ This change slow down block invocation.
+ Please try and give us feedback until 2.0 code freeze.
+
+ * include/ruby/ruby.h: ditto.
+
+ * compile.c (rb_iseq_compile_node): ditto.
+
+ * insns.def: ditto.
+
+ * thread.c: ditto.
+
+ * vm.c: ditto.
+
+ * include/ruby/debug.h: add a comment.
+
+ * test/ruby/test_settracefunc.rb: add a tests.
+
+Fri Nov 30 06:56:30 2012 Ryan Davis <ryand-ruby@zenspider.com>
+
+ * test/minitest/*: Imported minitest 4.3.2 (r8027)
+
+Fri Nov 30 04:16:29 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rake/*: Updated to rake 0.9.5
+ * test/rake/*: ditto.
+ * NEWS: ditto.
+
+Fri Nov 30 02:53:47 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * vm.c: add a return hook when a method raises an exception.
+
+ * probes_helper.h: look up klass and method if none are provided.
+
+ * eval.c: update macro usage.
+
+ * vm_eval.c: ditto.
+
+ * vm_insnhelper.c: ditto.
+
+ * test/dtrace/test_function_entry.rb: test for change.
+
+Fri Nov 30 02:27:12 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * compile.c (compile_array_): refix r37991 remove assertion:
+ it is true only if type == COMPILE_ARRAY_TYPE_HASH.
+ [ruby-dev:46658] [Bug #7466]
+
+ * vm.c (m_core_hash_from_ary): add assertion instead of above.
+
+ * vm.c (m_core_hash_merge_ary): ditto.
+
+Thu Nov 29 19:15:14 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * compile.c (compile_array_): hash elements must be paired even for
+ literal elements. [ruby-dev:46658] [Bug #7466]
+
+Thu Nov 29 22:39:35 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * ext/openssl/ossl_ssl.c (ssl_npn_encode_protocol_i): fix byte order
+ issue on big-endian architecture [ruby-core:50292] [Bug #7463]
+
+Thu Nov 29 22:23:31 2012 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * test/openssl/test_cipher.rb (test_ctr_if_exists): add CTR mode test
+ if underlying OpenSSL supports it. See #4408
+
+Thu Nov 29 21:42:16 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * vm_method.c (rb_method_entry_make): add a method entry with
+ VM_METHOD_TYPE_REFINED to the class refined by the refinement if
+ the target module is a refinement. When a method entry with
+ VM_METHOD_TYPE_UNDEF is invoked by vm_call_method(), a method with
+ the same name is searched in refinements. If such a method is
+ found, the method is invoked. Otherwise, the original method in
+ the refined class (rb_method_definition_t::body.orig_def) is
+ invoked. This change is made to simplify the normal method lookup
+ and to improve the performance of normal method calls.
+
+ * vm_method.c (EXPR1, search_method, rb_method_entry),
+ vm_eval.c (rb_call0, rb_search_method_entry): do not use
+ refinements for method lookup.
+
+ * vm_insnhelper.c (vm_call_method): search methods in refinements if
+ ci->me is VM_METHOD_TYPE_REFINED. If the method is called by
+ super (i.e., ci->call == vm_call_super_method), skip the same
+ method entry as the current method to avoid infinite call of the
+ same method.
+
+ * class.c (include_modules_at): add a refined method entry for each
+ method defined in a module included in a refinement.
+
+ * class.c (rb_prepend_module): set an empty table to
+ RCLASS_M_TBL(klass) to add refined method entries, because
+ refinements should have priority over prepended modules.
+
+ * proc.c (mnew): use rb_method_entry_with_refinements() to get
+ a refined method.
+
+ * test/ruby/test_refinement.rb (test_inline_method_cache): do not skip
+ the test because it should pass successfully.
+
+ * test/ruby/test_refinement.rb (test_redefine_refined_method): new
+ test for the case a refined method is redefined.
+
+Thu Nov 29 17:45:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * variable.c (rb_const_set): show namespace in warning messages.
+ [Feature #7190]
+
+Thu Nov 29 17:31:53 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/rubygems.rb (Gem.load_yaml): return if Kernel#gem is not defined
+ yet. This causes crash if test-all requires libraries in a certain
+ order. A simple reproducible code is
+ ruby --disable-gem -e'require"yaml";require"minitest/autorun"'
+
+Thu Nov 29 17:19:26 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/tracer.rb: Updated to match removal of custom_require from
+ RubyGems.
+ * test/test_tracer.rb: ditto. Improved failure message if the test
+ fails
+
+Thu Nov 29 17:15:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * gc.c: Documentation for GC, GC::Profiler, ObjectSpace, and
+ ObjectSpace::WeakMap [ruby-core:50245] [Bug #7449]
+
+Thu Nov 29 17:12:26 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * tool/generic_erb.rb, tool/id2token.rb: add --path-separator option
+ for mingw where make and built ruby live in different world.
+
+ * tool/vpath.rb: extract from tool/instruction.rb.
+
+Thu Nov 29 17:11:06 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/io/wait/test_io_wait.rb (TestIOWait#fill_pipe):
+ Errno::EWOULDBLOCK may not be the same as Errno::EAGAIN. patch by
+ phasis68 (Heesob Park) at [ruby-core:49894]. [Bug #7420]
+
+Thu Nov 29 17:03:38 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/test_case.rb: Determine path to certificates to avoid
+ build-dir problems.
+ * test/rubygems/test_gem_security_signer.rb: Use predetermined paths
+ to avoid build-dir problems.
+
+Thu Nov 29 16:18:14 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/test_case.rb: Disable loading of keys and certificates
+ outside rubygems or ruby tests as the files are not available (or
+ necessary).
+
+Thu Nov 29 16:14:41 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_backtrace.c (rb_debug_inspector_open): use RARRAY_LENINT() for
+ int variable.
+
+Thu Nov 29 15:59:55 2012 Koichi Sasada <ko1@atdot.net>
+
+ * include/ruby/debug.h: add rb_debug_inspector_* APIs.
+
+ * vm_backtrace.c: ditto.
+
+ * common.mk: add dependency from vm_backtrace.o to
+ include/ruby/debug.h.
+
+ * proc.c (rb_binding_new_with_cfp): constify.
+
+ * vm.c (rb_vm_get_ruby_level_next_cfp): constify.
+
+ * vm_core.h, vm_trace.c: move decls.
+
+Thu Nov 29 15:56:14 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/rdoc/test_case.rb (RDoc::TestCase#verbose_capture_io):
+ defined for asserts of warnings.
+
+ * test/rdoc: use verbose_capture_io on asserts of warnings.
+ they failed when tests was run with RUBYOPT=-W0.
+
+Thu Nov 29 15:53:38 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/psych/extconf.rb: added --enable-bundled-libyaml option. this
+ enforces using bundled libyaml.
+
+Thu Nov 29 15:51:54 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems*: Updated to RubyGems 2.0
+ * test/rubygems*: ditto.
+
+ * common.mk (prelude): Updated for RubyGems 2.0 source rearrangement.
+
+ * tool/change_maker.rb: Allow invalid UTF-8 characters in source
+ files.
+
+Thu Nov 29 15:38:14 2012 Koichi Sasada <ko1@atdot.net>
+
+ * include/ruby/debug.h: provide rb_tracearg_*() APIs,
+ instead of rb_tracepoint_attr_*().
+ These APIs are for debuggers/profilers.
+ They will be explained in another docs sometime.
+
+ * vm_trace.c: ditto.
+
+Thu Nov 29 15:10:45 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * test/minitest/test_minitest_unit.rb: restore orig_verbose only
+ if it is set. This broke rdoc's tests.
+ http://u64.rubyci.org/~chkbuild/ruby-trunk/log/20121129T050102Z.diff.html.gz
+
+Thu Nov 29 14:56:30 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_trace.c (rb_tracepoint_attr_method_id):
+ rename TracePoint#id to TracePoint#method_id.
+
+ * include/ruby/debug.h: ditto.
+
+ * test/ruby/test_settracefunc.rb: ditto,
+
+Thu Nov 29 14:49:10 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_trace.c (rb_tracepoint_attr_defined_class):
+ rename TracePoint#klass to TracePoint#defined_class.
+ [ruby-core:50187] Re: [ruby-trunk - Feature #6895]
+
+ * include/ruby/debug.h: ditto.
+
+ * test/ruby/test_settracefunc.rb: ditto.
+
+Thu Nov 29 14:27:57 2012 Koichi Sasada <ko1@atdot.net>
+
+ * gc.c (gc_stat): prepare Symbol objects at first time
+ to make it fast.
+
+Thu Nov 29 14:02:15 2012 Koichi Sasada <ko1@atdot.net>
+
+ * gc.c (gc_stat): GC.stat supports new information
+ * total_allocated_object: total allocated object number.
+ * total_freed_object: total freed object number.
+ Above two numbers are only accumulated and they will
+ overflow (return to 0). Please use them as a hint.
+
+Thu Nov 29 12:13:54 2012 Ryan Davis <ryand-ruby@zenspider.com>
+
+ * lib/minitest/*: Imported minitest 4.3.2 (r8026)
+ * test/minitest/*: ditto
+
+Thu Nov 29 11:06:06 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (thread_start_func_2): remove unused code. When
+ th->safe_level == 4, th->errinfo never be thrown. So, to
+ create new exception makes no sense.
+
+Thu Nov 29 10:29:53 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_backtrace.c: same as a last patch.
+
+Thu Nov 29 10:24:25 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_backtrace.c: use `long' for return values of `NUM2LONG()'.
+
+Thu Nov 29 09:52:08 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * thread.c (do_select): suppress warning (uninitialized value warning)
+ with UNINITIALIZED_VAR().
+
+Thu Nov 29 09:36:09 2012 Koichi Sasada <ko1@atdot.net>
+
+ * eval.c (ruby_cleanup): delay THREAD_KILLED timing.
+ It should be located just before rb_thread_terminate_all().
+
+Thu Nov 29 09:10:17 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_backtrace.c (vm_backtrace_to_ary): support range argument
+ like Array#[].
+ [ruby-core:50092] [ruby-trunk - Feature #7434]
+ Test and document is not available. Please help us.
+
+Thu Nov 29 06:46:33 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (thread_start_func_2): small cleanups.
+
+Thu Nov 29 06:37:08 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (thread_start_func_2): remove unused code.
+ this function never be used for main thread.
+
+Thu Nov 29 06:27:55 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (thread_start_func_2): remove unused code.
+ errinfo = th->errinfo; and errinfo = rb_errinfo(); are
+ the same.
+
+Thu Nov 29 05:26:32 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_backtrace.c (backtrace_to_str_ary2): rename to backtrace_to_str_ary.
+
+ * vm_backtrace.c (rb_backtrace_to_str_ary): use `backtrace_to_str_ary()'.
+
+ * vm_backtrace.c (backtrace_to_frame_ary): rename to
+ backtrace_to_location_ary.
+
+Thu Nov 29 05:19:25 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * probes.d: Change function-entry probe to method-entry.
+ * insns.def: ditto
+ * probes_helper.h: ditto
+ * test/dtrace/test_function_entry.rb: ditto
+ * test/dtrace/test_singleton_function.rb: ditto
+ * vm.c: ditto
+ * vm_eval.c: ditto
+ * vm_insnhelper.c: ditto
+
+Thu Nov 29 04:45:17 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_backtrace.c: rename Class name from
+ ::RubyVM::Backtrace and ::RubyVM::Backtrace::Location
+ to ::Thread::Backtrace and ::Thread::Backtrace::Location.
+
+Wed Nov 28 23:52:02 2012 Masaya Tarui <tarui@ruby-lang.org>
+
+ * NEWS (Thread) remove incompatible changes about trap.
+
+Wed Nov 28 23:39:01 2012 Koichi Sasada <ko1@atdot.net>
+
+ * thread.c (rb_mutex_sleep): fix to allow spurious wakeup.
+ [ruby-dev:46654] [ruby-trunk - Bug #7455]
+
+ * NEWS: write about spurious wakeup.
+
+Wed Nov 28 22:57:23 2012 Koichi Sasada <ko1@atdot.net>
+
+ * thread_win32.c: catch up latest change of BLOCKING_REGION.
+
+Wed Nov 28 22:54:21 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_insnhelper.c (vm_call_method): fix undefined behavior.
+ Should not access scope local variable from outer scope.
+
+Wed Nov 28 22:20:55 2012 Masaya Tarui <tarui@ruby-lang.org>
+
+ * test/ruby/test_thread.rb (test_thread_status_in_trap): change test for
+ thread status in trap. now can accept Thread#join and Thread#value in trap.
+
+Wed Nov 28 21:58:47 2012 Koichi Sasada <ko1@atdot.net>
+
+ * include/ruby/thread.h (rb_thread_call_without_gvl2): change
+ meaning of function.
+ This function is called with same parameters of
+ `rb_thread_call_without_gvl()'.
+ However, if interrupts are detected, then return immediately.
+
+ * thread.c: implement `rb_thread_call_without_gvl2()'.
+
+Wed Nov 28 21:31:21 2012 Masaya Tarui <tarui@ruby-lang.org>
+
+ * thread.c (thread_join_sleep): check spurious wakeup by itself for
+ corresponding status change in trap context.
+ * vm_core.h (struct rb_thread_struct): add rb_thread_list_t and use as join_list for
+ reentry by trap context.
+ * thread.c (thread_start_func_2): ditto.
+ * thread.c (remove_from_join_list): ditto.
+ * thread.c (rb_thread_atfork): ditto.
+ * thread.c (thread_join): ditto. & remove trap handler check.
+ * thread.c (sleep_forever): add argument : spurious_check.
+ * thread.c (sleep_timeval): ditto.
+ * thread.c (rb_thread_sleep_forever): set spurious_check.
+ * thread.c (rb_thread_sleep_deadly): ditto.
+ * thread.c (sleep_for_polling): ditto.
+ * thread.c (rb_thread_wait_for): ditto.
+ * thread.c (sleep_wait_for_interrupt): bypass spurious_check.
+
+Wed Nov 28 21:23:18 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/psych/yaml/emitter.c (yaml_emitter_write_indicator): constify.
+
+ * ext/psych/yaml/emitter.c (yaml_emitter_write_block_scalar_hints):
+ ditto.
+
+ * ext/psych/extconf.rb: mingw32 also needs macros for win32, not
+ only mswin32.
+
+ * ext/psych/extconf.rb: compile sources in the source directory
+ without copying by using VPATH.
+
+Wed Nov 28 21:18:57 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (MakeMakefile#each_compile_rules): splat $(*VPATH*) for
+ each VPATH elements.
+
+Wed Nov 28 16:40:14 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * vm_core.h (enum rb_thread_status): remove THREAD_TO_KILL
+ * vm_core.h (struct rb_thread_struct): add to_kill field
+ * thread.c (terminate_i): convert THREAD_TO_KILL to to_kill.
+ * thread.c (rb_threadptr_to_kill): ditto.
+ * thread.c (rb_thread_kill): ditto.
+ * thread.c (rb_thread_wakeup_alive): ditto.
+ * thread.c (thread_list_i): ditto.
+ * thread.c (static const char): ditto.
+ * thread.c (thread_status_name): ditto.
+ * thread.c (rb_thread_status): ditto.
+ * thread.c (rb_thread_inspect): ditto.
+ * vm_backtrace.c (thread_backtrace_to_ary): ditto.
+
+ * thread.c (rb_threadptr_execute_interrupts): fix thread status
+ overwritten issue. [Bug #7450] [ruby-core:50249]
+
+ * test/ruby/test_thread.rb (test_hread_status_raise_after_kill):
+ test for the above.
+ * test/ruby/test_thread.rb (test_thread_status_in_trap): test for
+ thread status in trap.
+ * test/ruby/test_thread.rb (test_status_and_stop_p): remove
+ Thread.control_interrupt unsafe test. Thread#kill no longer
+ changes thread status. Instead of, Thread#kill receiver changes
+ their own status when receiving kill signal.
+
+Wed Nov 28 16:21:46 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (struct rb_mutex_struct): add allow_trap field.
+ * internal.h (rb_mutex_allow_trap): added.
+ * thread.c (rb_mutex_lock, rb_mutex_unlock): check mutex->allow_trap.
+ * thread.c (mutex_sleep): remove trap check because it uses
+ rb_mutex_lock and rb_mutex_unlock internally.
+ * thread.c (rb_mutex_allow_trap): new helper function for the above.
+
+ * io.c (io_binwrite): mark fptr->write_lock as writable in trap.
+
+ * test/ruby/test_signal.rb (test_trap_puts): test for the above.
+
+Wed Nov 28 16:59:12 2012 Koichi Sasada <ko1@atdot.net>
+
+ * proc.c: remove Proc#== and Proc#eql?.
+ Proc objects compared with their object ids.
+ [Bug #4559]
+
+ * test/ruby/test_proc.rb: remove related test.
+
+Wed Nov 28 16:41:04 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/servlet.rb: Add support for serving documentation from a
+ subdirectory.
+ * lib/rdoc/generator/darkfish.rb: ditto
+ * test/rdoc/test_rdoc_servlet.rb: Test for above
+ * test/rdoc/test_rdoc_servlet.rb: ditto
+
+Wed Nov 28 15:37:17 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * configure.in: fix r37924: run only on i[3-6]86-linux.
+
+Wed Nov 28 15:31:11 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (FMODE_SYNCWRITE): removed unused macro.
+
+Wed Nov 28 15:19:25 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * configure.in: revert r37911, r37906 and r37904 which break build
+ with non-gcc and/or non-IA32 compilers, e.g. Solaris Studio,
+ Fujitsu C Compiler. [ruby-dev:46646] [Bug #7451]
+
+Wed Nov 28 14:50:55 2012 Koichi Sasada <ko1@atdot.net>
+
+ * ext/psych/extconf.rb: copy sources into build directory,
+ not into srcdir.
+
+Wed Nov 28 14:34:06 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_mutex_lock): moved trap context check from
+ rb_mutex_trylock because try_lock have no change to make
+ a deadlock.
+ * thread.c (rb_mutex_trylock): ditto.
+ * NEWS: news for the above.
+
+Wed Nov 28 13:39:54 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (thread_s_new): uses main_thread->status instead of
+ th->inhibit_thread_creation for preventing thread creation.
+ * vm_core.h (rb_vm_struct): remove inhibit_thread_creation field.
+ * thread.c (rb_thread_terminate_all): ditto.
+
+Wed Nov 28 13:27:29 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/extconf.rb: use embedded libyaml if no system libyaml is
+ found. [ruby-core:49463]
+ * ext/psych/lib/psych.rb: updating to psych 2.0.0
+ * ext/psych/lib/psych/deprecated.rb: updated docs
+ * ext/psych/psych.gemspec: updated to psych 2.0.0
+ * ext/psych/psych.h: fixing header file include for rename
+ * ext/psych/psych_emitter.c: renamed to avoid libyaml conflict.
+ * ext/psych/psych_emitter.h: ditto
+ * ext/psych/psych_parser.c: ditto
+ * ext/psych/psych_parser.h: ditto
+ * ext/psych/psych_to_ruby.c: ditto
+ * ext/psych/psych_to_ruby.h: ditto
+ * ext/psych/psych_yaml_tree.c: ditto
+ * ext/psych/psych_yaml_tree.h: ditto
+ * ext/psych/yaml/LICENSE: embedding libyaml 0.1.4
+ * ext/psych/yaml/api.c: ditto
+ * ext/psych/yaml/config.h: ditto
+ * ext/psych/yaml/dumper.c: ditto
+ * ext/psych/yaml/emitter.c: ditto
+ * 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.h: ditto
+ * ext/psych/yaml/yaml_private.h: ditto
+
+Wed Nov 28 12:54:59 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (thread_join): A trap handler check was moved from
+ thread_join_m because Thread#value should be raised an exception
+ too.
+ * thread.c (thread_join_m): remove trap handler check.
+ * test/ruby/test_thread.rb (test_thread_join_in_trap): add test
+ for thread#value.
+ * NEWS: documentation fix for the above.
+
+Wed Nov 28 11:07:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * ext/fiddle/closure.c: Documentation for Fiddle
+ * ext/fiddle/lib/fiddle/import.rb: ditto
+ * ext/fiddle/lib/fiddle/value.rb: ditto
+ * ext/fiddle/lib/fiddle/pack.rb: ditto
+ * ext/fiddle/lib/fiddle/cparser.rb: ditto
+ * ext/fiddle/lib/fiddle/struct.rb: ditto
+ * ext/fiddle/lib/fiddle/function.rb: ditto
+
+Wed Nov 28 09:15:51 2012 Ryan Davis <ryand-ruby@zenspider.com>
+
+ * ext/strscan/strscan.c: Added #charpos for multibyte string position.
+ * test/strscan/test_stringscanner.rb: ditto
+
+Wed Nov 28 09:00:34 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/fiddle/fiddle.c: adding alignment constants for compatibility
+ with DL.
+ * ext/fiddle/fiddle.h: ditto
+ * ext/fiddle/lib/fiddle/cparser.rb: importing the C parser for DL
+ backwards compatibility.
+ * ext/fiddle/lib/fiddle/import.rb: importing the import DSL for DL
+ backwards compatibility.
+ * ext/fiddle/lib/fiddle/pack.rb: importing structure pack for DL
+ backwards compatibility.
+ * ext/fiddle/lib/fiddle/value.rb: ditto
+ * ext/fiddle/lib/fiddle/struct.rb: importing struct DSL for DL backwards
+ compatibility.
+ * test/dl/test_c_struct_entry.rb: importing tests
+ * test/dl/test_c_union_entity.rb: ditto
+ * test/dl/test_cparser.rb: ditto
+ * test/dl/test_import.rb: ditto
+ * test/fiddle/test_c_struct_entry.rb: ditto
+ * test/fiddle/test_c_union_entity.rb: ditto
+ * test/fiddle/test_cparser.rb: ditto
+ * test/fiddle/test_import.rb: ditto
+
+Wed Nov 28 08:56:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * doc/globals.rdoc: Add documentation file for magic globals
+ [ruby-core:29048] [Bug #3022]
+
+Wed Nov 28 08:55:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * .document: Add README's to be included with docs
+
+Wed Nov 28 08:26:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * ext/dl/lib/dl.rb: Deprecation notice for DL
+
+Wed Nov 28 08:25:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * ext/fiddle/closure.c: Documentation for Fiddle
+ * ext/fiddle/pointer.c: ditto
+ * ext/fiddle/function.c: ditto
+ * ext/fiddle/lib/fiddle.rb: ditto
+ * ext/fiddle/fiddle.c: ditto
+ * ext/fiddle/handle.c: ditto
+
+Wed Nov 28 04:53:40 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/fiddle/handle.c: Make Fiddle independent of DL, copy DL::Handle
+ to Fiddle::Handle.
+ * ext/fiddle/pointer.c: Make Fiddle independent of DL, copy
+ DL::Pointer to Fiddle::Pointer.
+ * test/fiddle/test_func.rb: relevant tests
+ * test/fiddle/test_handle.rb: ditto
+ * test/fiddle/test_pointer.rb: ditto
+ * ext/dl/lib/dl/struct.rb: use Fiddle::Pointer if available
+ * ext/fiddle/extconf.rb: check for dlfcn.h
+ * ext/fiddle/fiddle.c: add constants for sizeof() things
+ * ext/fiddle/fiddle.h: include dlfcn.h
+ * ext/fiddle/function.c: expose a C function for creating new
+ Fiddle::Function objects.
+ * ext/fiddle/lib/fiddle.rb: include constants for dl backwards compat
+ * ext/fiddle/lib/fiddle/function.rb: read the pointer from the
+ function for dl backwards compat.
+ * test/dl/test_callback.rb: check the addresses of the pointers rather
+ than their types.
+ * test/fiddle/helper.rb: remove dependency on dl
+ * test/fiddle/test_closure.rb: ditto
+ * test/fiddle/test_fiddle.rb: ditto
+
+Wed Nov 28 03:03:28 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * configure.in (opt-dir): don't use non portable flag -E of sed.
+
+Wed Nov 28 02:55:35 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * configure.in (ARCH_FLAG): __sync_val_compare_and_swap_4 needs
+ -march=$target_cpu on at least linux gcc 4.1.
+ patched by KOSAKI Motohiro
+
+Tue Nov 27 22:03:09 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * string.c (rb_str_enumerate_chars, rb_str_enumerate_codepoints)
+ (rb_str_enumerate_lines): Dummy initialization of ary has been
+ replaced with UNINITIALIZED_VAR().
+
+Tue Nov 27 21:29:00 2012 Kenta Murata <mrkn@mrkn.jp>
+
+ * bignum.c (bigdivrem): optimize the way to retry calculation of
+ bigdivrem so that the calculation is started from the point where
+ the last interruption was occurred.
+
+ * bignum.c (bigdivrem1): ditto.
+
+ * test/ruby/test_bignum.rb: add a test case for rb_bigdivrem in the
+ case that an interruption is occurred during bigdivrem1 is running.
+
+Tue Nov 27 19:56:43 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm.c (rb_vm_make_env_object): make Proc object if Env is possible
+ to point block.
+ [ruby-core:41038] [ruby-trunk - Bug #5634]
+
+ * vm.c (rb_vm_make_proc): No need to make Proc object here.
+
+ * bootstraptest/test_proc.rb: add tests.
+
+Tue Nov 27 18:51:06 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * ruby_atomic.h (ATOMIC_CAS): added for Solaris and other platforms.
+ * ruby_atomic.h, signal.c (NEED_RUBY_ATOMIC_OPS): renamed from
+ NEED_RUBY_ATOMIC_EXCHANGE.
+ * signal.c (ruby_atomic_compare_and_swap): naive, non-atomic
+ compare-and-swap implementation only used for platforms without
+ valid support for atomic operations.
+
+Tue Nov 27 17:43:46 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/*: Added --root option for building documentation outside
+ the source directory.
+ * test/rdoc/*: ditto
+ * common.mk (rdoc): Added --root to rdoc rule
+
+Tue Nov 27 16:24:45 2012 Eric Hodel <drbrain@segment7.net>
+
+ * test/rdoc/test_rdoc_ri_paths.rb: Fixed duplicate path bug which
+ caused windows failures.
+
+Tue Nov 27 16:06:00 2012 Eric Hodel <drbrain@segment7.net>
+
+ * test/rdoc/test_rdoc_generator_darkfish.rb: Updated tests for windows
+ * test/rdoc/test_rdoc_options.rb: ditto
+ * test/rdoc/test_rdoc_parser.rb: ditto
+ * test/rdoc/test_rdoc_rdoc.rb: ditto
+ * test/rdoc/test_rdoc_ri_driver.rb: ditto
+ * test/rdoc/test_rdoc_servlet.rb: ditto
+
+Tue Nov 27 15:13:51 2012 Eric Hodel <drbrain@segment7.net>
+
+ * common.mk (rdoc): Set --debug for rdoc generation in case of bugs
+
+Tue Nov 27 14:56:45 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc/rubygems_hook.rb: Updated for (upcoming) RubyGems 2
+ import.
+ * test/rdoc/test_rdoc_rubygems_hook.rb: ditto
+
+Tue Nov 27 13:59:29 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * NEWS: add improvements of the garbage collector.
+
+Tue Nov 27 13:27:46 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc*: Updated to RDoc 4.0 (pre-release)
+ * bin/rdoc: ditto
+ * test/rdoc*: ditto
+ * NEWS: Updated with RDoc 4.0 information
+
+Tue Nov 27 12:17:11 2012 Koichi Sasada <ko1@atdot.net>
+
+ * thread.c (rb_thread_terminate_all): retry broadcast only when
+ an exception is raised.
+
+Tue Nov 27 12:02:25 2012 Koichi Sasada <ko1@atdot.net>
+
+ * thread.c (rb_thread_terminate_all): broadcast terminate event
+ not only an interrupt exception but any exceptions.
+
+Tue Nov 27 10:55:09 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * eval.c (ruby_cleanup): set thread status to THREAD_KILLED
+ for preventing thr.raise.
+ * test/ruby/test_thread.rb (test_main_thread_status_at_exit):
+ test for the above.
+
+Tue Nov 27 10:31:29 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_thread_terminate_all): suppress a warning.
+
+Tue Nov 27 09:29:11 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (thread_join): raises ThreadError if target thread
+ is a main thread.
+ * test/ruby/test_thread.rb (test_thread_join_main_thread):
+ test for the above.
+ * NEWS: news for the above.
+
+Tue Nov 27 09:24:47 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (thread_join): raises ThreadError if target thread
+ is a current thread.
+ * test/ruby/test_thread.rb (test_thread_join_current):
+ test for the above.
+ * NEWS: news for the above.
+
+Tue Nov 27 09:59:16 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/extmk.rb (extmake): close mkmf.log for each libraries so that
+ failure messages are not mixed.
+
+Tue Nov 27 09:58:48 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/digest/*/extconf.rb, ext/openssl/extconf.rb: get git rid of
+ post-1.8 feature require_relative for cross compilation.
+ [ruby-core:50160] [Bug #7439]
+
+Tue Nov 27 09:17:59 2012 Koichi Sasada <ko1@atdot.net>
+
+ * NEWS: add TracePoint.
+
+Tue Nov 27 08:16:03 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_trace.c: rename TracePoint#file and TracePoint#line
+ to TracePoint#path and TracePoint#lineno respectively.
+ They are consistent to RubyVM::Backtrace::Location.
+
+ * include/ruby/debug.h: ditto.
+
+ * vm_core.h: ditto.
+
+ * test/ruby/test_settracefunc.rb: ditto.
+
+Tue Nov 27 08:04:26 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_thread_terminate_all): broadcast eTerminateSignal
+ again when Ctrl-C was pressed. [Feature #1952] [ruby-dev:39107]
+
+Tue Nov 27 07:58:03 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_core.h: add members to rb_trace_arg_t:
+ * `klass_solved' represents klass and id is checked.
+ * `line' represents line calculated from cfp.
+ * `file' represents line calculated from cfp.
+
+ * vm_trace.c: fix to use above data structures.
+ No need to calculate klass and id, line and file
+ pairs for each trace points.
+
+Tue Nov 27 07:47:09 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_thread_terminate_all): add RUBY_VM_CHECK_INTS_BLOCKING().
+ Otherwise the loop in this function behave as busy loop because
+ native_sleep() return immediately when RUBY_VM_INTERRUPTED() is true.
+
+Tue Nov 27 04:12:49 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/extmk.rb (extmake): git rid of post-1.8 features for cross
+ compilation. [ruby-core:50160] [Bug #7439]
+
+Tue Nov 27 00:13:41 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_mutex_trylock, rb_mutex_unlock, mutex_sleep):
+ raises ThreadError if called from trap handler as Thread#join.
+ * NEWS: news for the above.
+
+Mon Nov 26 23:55:33 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * NEWS: update for Thread#join incompatible change.
+
+Mon Nov 26 22:44:24 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_thread_terminate_all): use native_sleep() instead
+ of rb_thread_schedule(). Otherwise, it consume 100% cpu meaninglessly.
+ [Bug #5368] [ruby-dev:44546]
+ * thread.c (thread_start_func_2): last sub-thread wakes up main thread.
+
+Mon Nov 26 21:16:04 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * vm_core.h (RUBY_VM_SET_TIMER_INTERRUPT, RUBY_VM_SET_INTERRUPT)
+ (RUBY_VM_SET_FINALIZER_INTERRUPT, RUBY_VM_SET_TRAP_INTERRUPT)
+ (RUBY_VM_INTERRUPTED): use enum symbol instead of immediate value.
+ * thread.c (thread_join_m, rb_threadptr_execute_interrupts): ditto.
+ * signal.c (signal_exec): ditto.
+
+Mon Nov 26 20:23:20 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (thread_join_m): use th->interrupt_mask instead of
+ th->in_trap.
+
+ * vm_core.h (struct rb_thread_struct): remove in_trap member.
+ * signal.c (signal_exec): ditto.
+ * thread.c (thread_create_core): ditto.
+ * thread.c (Init_Thread): ditto.
+
+Mon Nov 26 20:23:49 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_argf.rb (TestArgf#test_chars): since marshal data is
+ binary, shouldn't pass via text mode. use base64 encoded data.
+
+Mon Nov 26 19:45:18 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * ruby_atomic.h (ATOMIC_CAS): new macro for compare-and-exchange.
+
+ * vm_core.h (struct rb_thread_struct): add interrupt_mask member.
+ * thread.c (thread_create_core, Init_Thread): initialize
+ th->thread_mask.
+
+ * vm_core.h (RUBY_VM_INTERRUPTED_ANY): new macro for avoiding
+ bare th->interrupt_flag.
+ * vm_core.h (RUBY_VM_INTERRUPTED, RUBY_VM_INTERRUPTED): check
+ th->interrupt_mask.
+ * thread.c (set_unblock_function, rb_thread_schedule): replace
+ th->interrupt_flag with RUBY_VM_INTERRUPTED_ANY()
+
+ * signal.c (signal_exec): set up thread->interrupt_mask for
+ preventing recursive trap handler.
+ * vm_core.h (RUBY_VM_CHECK_INTS, RUBY_VM_CHECK_INTS_BLOCKING): ditto.
+
+ * thread.c (rb_threadptr_execute_interrupts):
+ don't process interrupt if it is masked.
+ [Bug #6009] [ruby-core:42524]
+
+Mon Nov 26 19:43:42 2012 Koichi Sasada <ko1@atdot.net>
+
+ * iseq.c (make_compile_option_value): add trace_instruction option.
+ a patch by davidbalbert (David Albert).
+ [Bug #6786]
+
+Mon Nov 26 19:10:53 2012 Koichi Sasada <ko1@atdot.net>
+
+ * bootstraptest/test_thread.rb: try to `join' each 100
+ threads.
+ This benchmark seems consuming long time on travis-ci
+ several times (and make `failure').
+
+Mon Nov 26 18:22:56 2012 Koichi Sasada <ko1@atdot.net>
+
+ * common.mk: specify label `built-ruby'.
+
+ * benchmark/driver.rb: quote path.
+
+Mon Nov 26 18:26:28 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * signal.c (signal_exec): add volatile to make sure setjmp safe.
+
+Mon Nov 26 18:19:47 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * signal.c (signal_exec): suppress "warning: variable 'signum'
+ might be clobbered by 'longjmp' or 'vfork'" warning.
+
+Mon Nov 26 18:15:47 2012 Koichi Sasada <ko1@atdot.net>
+
+ * benchmark/driver.rb: accept multiple `-e'.
+ You don't need to use `;' separation character.
+ [ruby-core:50139] [ruby-trunk - Bug #7380]
+
+Mon Nov 26 17:10:04 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * string.c (rb_str_enumerate_chars, rb_str_enumerate_codepoints)
+ (rb_str_enumerate_lines): suppress "may be used uninitialized in
+ this function" warning.
+
+Mon Nov 26 17:00:12 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * vm_core.h (rb_thread_struct): added 'in_trap' member for marking
+ running trap handler.
+ * signal.c (signal_exec): turn on in_trap when running trap.
+ * thread.c (Init_Thread, thread_create_core): initialize in_trap
+ when creating new threads.
+ * thread.c (thread_join_m): raise ThreadError when running trap
+ handler.Bug [#6416][ruby-core:44956]
+ * test/ruby/test_thread.rb (test_thread_join_in_trap): new test
+ for the above.
+
+Mon Nov 26 16:36:13 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * io.c (argf_each_codepoint): add missing ARGF#codepoints [Bug #7438]
+
+Mon Nov 26 15:50:29 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * bignum.c (bigdivrem): restart calculation when bigdivrem1 was
+ interrupted by signal. Otherwise, ruby script may see a garbage
+ value.
+
+Mon Nov 26 15:33:02 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * bignum.c (big_div_struct): added volatile to 'stop' member.
+ Otherwise, "if (bds->stop)" check in bigdivrem1 don't read
+ memory and ignore interrupt.
+ * bignum.c (bigdivrem, rb_big_stop): ditto.
+
+Mon Nov 26 12:11:09 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/Makefile.sub (DLNOBJ): missing in r37821.
+
+Mon Nov 26 10:50:19 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_process.rb (test_setsid): added a few wait for
+ preventing that Process.getsid(io.pid) makes Errno::ESRCH.
+
+Sun Nov 25 22:34:00 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * array.c (ary_resize_smaller): new function to resize array.
+
+ * array.c (rb_ary_delete): refactoring to extract a function.
+
+ * array.c (rb_ary_delete_same): refactoring.
+ It renames function, reduces duplicated code and removes unused
+ code.
+
+ * gc.c (wmap_final_func): follow the above change.
+
+ * internal.h (rb_ary_delete_same): ditto.
+
+Sun Nov 25 22:27:33 2012 Benoit Daloze <eregontp@gmail.com>
+
+ * array.c: fixes for the updated documentation in r35858:
+ Typos and #take/#drop accept to take/drop 0 elements.
+
+Sun Nov 25 19:43:29 2012 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * NEWS: add a news about iconv.
+
+Sun Nov 25 03:49:23 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/set.rb, test/test_set.rb: Move tests embedded in lib/set.rb
+ to test/test_set.rb.
+
+Sun Nov 25 03:44:50 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * string.c (rb_str_each_line, rb_str_lines): String#lines now
+ returns an array instead of an enumerator. Passing a block is
+ deprecated but still supported for backwards compatibility.
+ Based on the patch by yhara. [Feature #6670]
+
+ * string.c (rb_str_each_char, rb_str_chars): Ditto for
+ String#chars.
+
+ * string.c (rb_str_each_codepoint, rb_str_codepoints): Ditto for
+ String#codepoints.
+
+ * string.c (rb_str_each_byte, rb_str_bytes): Ditto for
+ String#bytes.
+
+ * NEWS: Add notes for the above changes.
+
+Sun Nov 25 02:07:37 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * test/ruby/envutil.rb (Test::Unit::Assertions#assert_warning)
+ (Test::Unit::Assertions#assert_warn), test/ruby/envutil.rb,
+ test/ruby/test_enumerator.rb, test/ruby/test_io_m17n.rb,
+ test/ruby/test_regexp.rb, test/ruby/test_syntax.rb:
+ assert_warn() and assert_warning() are reversed.
+
+Sat Nov 24 21:08:50 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * gc.c (wmap_final_func): rename variables to clarify the meaning.
+ In wmap2obj the key is WeakRef and the value is referenced object.
+ In obj2wmap the key is referenced object and the value is an array
+ of WeakRef.
+
+ * gc.c (wmap_finalize): ditto.
+ [ruby-core:49044] [Bug #7304]
+
+Sat Nov 24 21:01:55 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * array.c (rb_ary_delete_same_obj): new function for WeakRef.
+ This deletes same objects as item argument in the array.
+
+ * internal.h (rb_ary_delete_same_obj): add a declaration.
+
+ * gc.c (wmap_final_func): remove WeakRef object reference from the
+ array. rb_ary_delete() is not usable because it uses rb_equal() to
+ compare object references.
+
+ * gc.c (wmap_finalize): remove recycled object references from weak
+ map hash properly. How to get object reference from object id was
+ wrong. st_delete() doesn't work properly if key and value arguments
+ are same. The key of obj2wmap is referenced object and the value of
+ obj2wmap is WeakRef array.
+
+ * gc.c (wmap_aset): obj2wmap should contain WeakRef array in the
+ definition.
+
+ * test/test_weakref.rb
+ (TestWeakRef#test_not_reference_different_object,
+ TestWeakRef#test_weakref_finalize): add tests for above.
+ [ruby-core:49044] [Bug #7304]
+
+Sat Nov 24 19:44:41 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/nkf/nkf-utf8/nkf.c (unicode_iconv_combine): returning flags are
+ nkf_char.
+
+Sat Nov 24 19:29:18 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * test/ruby/test_rubyoptions.rb (test_usage, test_usage_long):
+ reduced, renamed.
+
+Sat Nov 24 13:10:14 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_trace.c (rb_tracepoint_attr_raised_exception): should not check
+ value before event checking.
+
+ * vm_trace.c (rb_tracepoint_attr_return_value): ditto.
+
+ * test/ruby/test_settracefunc.rb: add tests for TracePoint#return_value
+ and TracePoint#raised_exception.
+
+Sat Nov 24 12:47:27 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * test/ruby/test_process.rb (TestProcess#test_setsid): "./ruby-trunk"
+ doesn't work on all environments. EnvUtil.rubybin would be suitable.
+
+Sat Nov 24 12:28:04 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * array.c (rb_ary_aref): fix Segmentation fault at TestArray#test_aref
+ on x64 mingw. Variable argument of rb_scan_args() should be a pointer
+ (VALUE *), but 0 of variable argument seems not equal to null pointer
+ on x64 mingw.
+
+Sat Nov 24 11:47:14 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * process.c (proc_getsid): adds new method for getting session id.
+ Contributed from fumiyas (Fumiyasu SATOH). Thank you!
+ [Feature #6757] [ruby-dev:45977]
+ * configure.in: adds getsid check.
+ * test/ruby/test_process.rb (TestProcess#test_setsid): new test
+ for the above.
+ * NEWS: news for the above.
+
+Sat Nov 24 10:59:14 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (thread_create_core): don't use th->thread_id before
+ initialized.
+
+Sat Nov 24 00:00:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ruby.c (proc_options, process_options, ruby_process_options): take
+ care of the case argc is 0, and check if argv has NULL.
+ [ruby-core:49889] [Bug #7423]
+
+Sat Nov 24 00:00:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (--disable-dln): option to disable dynamic linking
+ feature. [ruby-core:37676] [Feature #4946]
+
+Fri Nov 23 23:44:41 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (MakeMakefile#pkg_config): strip all white spaces for
+ mingw64+MSYS pkg-config which erroneously emits extra newlines.
+ [ruby-core:47998] [Bug #7163]
+
+Fri Nov 23 17:31:54 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ruby.c (usage): wrap description lines if options are too long.
+
+Fri Nov 23 11:13:46 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/ruby/test_rubyoptions.rb (TestRubyOptions#test_usage2): refine
+ assertion.
+
+ * test/ruby/test_rubyoptions.rb (TestRubyOptions#test_usage2): now
+ --help option is for modern terminals.
+
+Fri Nov 23 10:45:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * ext/socket/ipsocket.c (IPSocket#peeraddr): Fix example
+ [ruby-core:46429] [Bug #6732]
+
+Fri Nov 23 02:40:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/cgi/core.rb: Documentation for CGI#header alias
+ Based on a patch by Marcus Stollsteimer
+ [ruby-core:49585] [Bug #7405]
+
+Thu Nov 22 23:48:10 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c (is_swept_object): extract from is_dead_object().
+
+ * gc.c (rb_gcdebug_print_obj_condition): add the function for debug.
+ This function shows some conditions of given object (e.g.,
+ marked, in heap, swept).
+
+ * gc.c (rb_gcdebug_sentinel): add the function for debug.
+ This function allow check to inadvertently free up an object.
+
+Thu Nov 22 23:45:18 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * array.c (rb_ary_shared_with_p): fix cache validity check.
+ If #pop or #shift has been called against $: or $", the array will
+ be still shared with the snapshot. We check array length for cache
+ validity.
+ [ruby-core:49518] [Bug #7383]
+
+ * test/ruby/test_require.rb
+ (TestRequire#test_require_with_array_pop,
+ TestRequire#test_require_with_array_shift): add tests for above.
+
+Thu Nov 22 21:48:48 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * common.mk, win32/Makefile.sub (probes.dmyh): now be made in current
+ (=build) directory if build from the repository.
+
+Thu Nov 22 21:34:51 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * test/ruby/test_rubyoptions.rb: added a test.
+
+Thu Nov 22 20:32:07 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * complex.c (string_to_c_strict, string_to_c): check NUL.
+ * rational.c (string_to_r_strict, string_to_r): ditto.
+
+Thu Nov 22 20:21:45 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * Makefile.in (.dmyh.h): removed $(VPATH). GNU make don't
+ recognize suffix rule with VPATH.
+
+Thu Nov 22 18:11:27 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * common.mk, Makefile.in, win32/Makefile.sub (.dmyh.h): nmake merges
+ explicit rules for same target, but not merges explicit rules and
+ implicit rules -- always explicit rules win. So, need to add an
+ explicit rule for probes.h. [Bug #7421] [ruby-core:49839]
+
+Thu Nov 22 18:01:28 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * Makefile.in (probes.o): add -C to ignore #include in probes.d.
+
+ * probes.d: include vm_opts.h instead of vm_core.h.
+
+ * vm_opts.h (VM_COLLECT_USAGE_DETAILS): move definition from vm_core.h.
+
+Thu Nov 22 17:45:17 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/nkf/nkf-utf8: Merge b0a6577a521d1bba5e19853f95d5c4b9be1072b5.
+ Support JIS X 0213 and some bugfixes.
+
+Thu Nov 22 17:39:37 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * tool/gen_dummy_probes.rb: don't change #include, #if and #endif
+ lines. [Bug #7370]
+
+Thu Nov 22 16:58:26 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * Makefile.in: run preprocessor when making probe.h
+ * probes.d: define probe insn and insn__operand only when
+ VM_COLLECT_USAGE_DETAILS is 1. [Bug #7370]
+
+Thu Nov 22 16:20:49 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * vm.c: Don't define vm_collect_usage_operand() and
+ static void vm_collect_usage_insn() when disabling
+ VM_COLLECT_USAGE_DETAILS. (refix r37796)
+
+Thu Nov 22 15:26:02 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * vm_insnhelper.h: partly revert r37631 (DTrace support).
+ "vm usage information is always collected, so uncomment the
+ functions." causes performance impact. [Bug #7370]
+ Off course this revert disables related probes.
+
+Thu Nov 22 14:14:36 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * re.c (rb_memsearch_ss): Apply performance improvement to short
+ byte array search for platforms without memmem(3).
+ [Feature #6311] [ruby-dev:45530]
+
+Thu Nov 22 12:52:19 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * test/ruby/test_string.rb (TestString#test_index): Add some
+ corner cases to tests for String#index, which might fail if ruby
+ directly used a buggy memmem(3) implementation.
+
+Thu Nov 22 08:06:42 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * test/ruby/test_gc.rb (test_profiler_clear): fix wrong method
+ calls [Bug #7419] [ruby-core:49828].
+
+Thu Nov 22 02:22:33 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * NEWS: edited (order etc).
+
+Wed Nov 21 22:52:59 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/io/wait/wait.c (io_wait_readable): add alias wait_readable.
+
+ * ext/io/wait/wait.c (io_wait_writable): this is easier to use than
+ IO.select for a single IO object and is immune to the
+ limitations/inefficiency of select() on platforms where poll/ppoll
+ is available. patched by Eric Wong. [Feature #4646]
+
+Wed Nov 21 22:27:52 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c (garbage_collect): remove a duplicative probe.
+
+Wed Nov 21 22:08:48 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c (gc_profile_clear): realloc profile records if its size is
+ higher than the threshold, GC_PROFILE_RECORD_DEFAULT_SIZE * 2.
+
+Wed Nov 21 21:53:29 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * complex.c (nucomp_to_c): added.
+
+Wed Nov 21 21:35:38 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * include/ruby/util.h: removed extra semicolon in definition of
+ macro.
+ * compile.c: ditto.
+ * cont.c: ditto.
+ * math.c: ditto.
+ * node.c: ditto.
+ * parse.y: ditto.
+
+Wed Nov 21 18:46:37 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * rational.c (read_digits): due to a bit tighter rb_cstr_to_inum().
+
+Wed Nov 21 16:13:37 2012 Koichi Sasada <ko1@atdot.net>
+
+ * benchmark/bm_so_nsieve_bits.rb: add an encoding pragma because
+ this benchmark using strings (literals) as binary sequence.
+ Now, they are UTF-8 strings. [ruby-dev:46578]
+
+Wed Nov 21 00:57:43 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * file.c (Init_File): null device definition uses rb_define_const
+ instead of rb_file_const.
+
+Wed Nov 21 00:28:18 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * test/ruby/test_m17n_comb.rb (test_str_crypt): Use RbConfig to get
+ libc's directory. Patched by Vit Ondruch [ruby-core:49763] [Bug #7312]
+
+Tue Nov 20 23:28:26 2012 Masaki Matsushita <glass.saga@gmail.com>
+
+ * marshal.c: add marshal readahead. marshalized Array, Hash and Struct
+ have size at least number of its elements, marshal readahead will
+ read the certain readable length and buffer when it needs more bytes.
+ marshal readahead prevents many calls to IO#getbyte and IO#read,
+ then it enables performance improvement.
+ [ruby-dev:45637] [Feature #6440]
+
+Tue Nov 20 22:35:02 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * Makefile.in (.d.h): replace char * to const char * because somehow
+ current dtrace removes const of function declaration in probes.d.
+
+Tue Nov 20 21:41:04 2012 Koichi Sasada <ko1@atdot.net>
+
+ * include/ruby/debug.h: introduced.
+ Debugging/profiling features will be located.
+
+ * vm_trace.c: expose C-level TracePoint APIs.
+ Note that they are experimental.
+
+ * vm_trace.c, include/ruby/debug.h: rename `rb_hook_flag_t'
+ to `rb_event_hook_flag_t'.
+ Macro names `RUBY_HOOK_FLAG_*' are also renamed to
+ `RUBY_EVENT_HOOK_FLAG_*'.
+
+ * debug.h, vm_debug.h: rename debug.h to vm_debug.h.
+
+ * common.mk: ditto.
+
+ * debug.c, main.c, vm_core.h: ditto.
+
+Tue Nov 20 21:12:37 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * configure.in (RUBY_DTRACE_AVAILABLE): only check dtrace availability.
+
+ * configure.in (RUBY_DTRACE_POSTPROCESS): restore.
+
+Tue Nov 20 21:22:44 2012 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * test/win32ole/test_win32ole_type.rb (test_implemented_ole_types):
+ IShellDispatch6 bundled in Windows 8. Thanks to phasis68 (Heesob
+ Park). [ruby-core:49580][Bug #7403]
+
+Tue Nov 20 21:06:41 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * complex.c: some improvements.
+ * rational.c: ditto.
+
+Tue Nov 20 21:01:16 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (incs): BSD make cannot deal with non-prefixed dependency
+ and prefixed target.
+
+Tue Nov 20 20:10:23 2012 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * array.c (rb_ary_bsearch): fix rdoc bug (O(n log n) -> O(log n)).
+ Patch by Charlie Somerville. [ruby-core:49661] [Bug #7409]
+
+ * range.c (range_bsearch): ditto.
+
+Tue Nov 20 19:02:44 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_trace.c: rename and add TracePoint APIs.
+ (1) TracePoint.new(...){...} creates a new trace point
+ but does not make it enable.
+ (2) TracePoint.trace(...){...} creates a new trace point
+ and enable it (same as old behavior).
+ (3) TracePoint#enable make it enable (renamed from TracePoint#retrace).
+ If block given, when enable only in block.
+ (4) TracePoint#disable make it disable (renamed from TracePoint#untrace).
+ If block given, when disable only in block.
+ (5) TracePoint#enabled? returns this trace is enable or not.
+ [Feature #6895]
+
+ * test/ruby/test_settracefunc.rb: add tests.
+
+Tue Nov 20 18:35:05 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_trace.c: add two methods:
+ (1) TracePoint#return_value which returns return
+ value on the :return and :c_return event.
+ (2) TracePoint#raised_exception which returns raised exception
+ value on the :raise event.
+ Each methods raise RuntimeError if it is called at unsupported
+ event.
+ Please review and give us feedback until next preview
+ release (Dec/2012) of Ruby 2.0.0.
+ [Feature #6895]
+
+ * insns.def, vm.c, vm_eval.c, vm_insnhelper.c, eval.c, thread.c:
+ ditto.
+
+ * vm_trace.c, vm_core.h: move definition of rb_trace_arg_t from
+ vm_trace.c to vm_core.h.
+ Caller fills rb_trace_arg_t and pass the pointer of this variable.
+
+ * test/ruby/test_settracefunc.rb: fix tests to test this change.
+
+Tue Nov 20 17:31:12 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * configure.in: fix dtrace didn't work on darwin.
+
+ * configure.in (RUBY_DTRACE_AVAILABLE): unify RUBY_DTRACE_POSTPROCESS
+ and RUBY_DTRACE_BSD_BROKEN.
+
+Tue Nov 20 15:20:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * file.c (File.extname): Documentation for extname on dotfiles and
+ files ending with a dot. Also, added example for this.
+ [ruby-core:47852] [Bug #7112]
+
+Tue Nov 20 14:19:20 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_signal.rb (TestSignal#test_signame): fix windows
+ test failure. Process.kill on windows can't send a signal to
+ another process.
+
+Tue Nov 20 13:58:11 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (Init_IO): moved all rb_file_const() into file.c.
+ * file.c (Init_File): replace with rb_file_const() with
+ rb_define_const() because RDoc don't care rb_file_const.
+ [Bug #5530]
+
+Tue Nov 20 12:35:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * ruby.c (usage_msg): Fix typo [ruby-core:49205] [Bug #7327]
+
+Tue Nov 20 12:35:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * file.c (File::NULL): Document File::NULL constant
+ [ruby-core:49384] [Bug #7365]
+
+Tue Nov 20 12:05:15 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_read): Windows 8 fixed one of a bug of console
+ API.
+ based on the patch by Heesob Park at [ruby-core:49479] [Bug #7379]
+
+Tue Nov 20 11:14:33 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * configure.in (--enable-dtrace): always call RUBY_DTRACE_BSD_BROKEN
+ for portability.
+ As the note, FreeBSD 8 has DTrace as the optional
+ feature (it is enabled by the build option), but doesn't have USDT.
+ FreeBSD 9 has USDT but they are still optional. FreeBSD 10 will
+ enable them by default.
+ The variable $rb_cv_prog_dtrace_g is "yes" only on FreeBSD 9 with
+ optional DTrace or FreeBSD 10. If it is "no", you cannot know
+ whether it doesn't need -G or DTrace is disabled. (by checking
+ error code, you can know)
+
+Mon Nov 19 22:55:48 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * configure.in (--enable-dtrace): change help message
+
+Tue Nov 20 11:05:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/tracer.rb (Tracer.trace_func): printf to stdout
+ Patch by Michal Fojtik [ruby-core:45219] [Bug #6490]
+
+Mon Nov 19 21:24:18 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * vm_dump.c: not to include probes.h because the code does not depend
+ on it.
+ * common.mk (vm_dump.$(OBJEXT)): remove dependency on probes.h
+
+Tue Nov 20 10:14:22 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_thread_s_check_interrupt): removed redundant
+ GET_THREAD().
+
+Tue Nov 20 10:12:46 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_threadptr_async_errinfo_active_p): added a small
+ comment.
+
+Tue Nov 20 10:05:56 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_thread_blocking_region_end): replaced GET_THREAD()
+ with ruby_thread_from_native(). We don't have GVL here.
+
+Tue Nov 20 09:56:15 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_threadptr_execute_interrupts) removed.
+ * thread.c (rb_threadptr_execute_interrupts_common) renamed to
+ rb_threadptr_execute_interrupts. I.e. unified
+ rb_threadptr_execute_interrupts and rb_threadptr_execute_interrupts_common.
+ * thread.c (rb_thread_schedule, rb_thread_execute_interrupts) s/_common//.
+
+Tue Nov 20 09:48:34 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * signal.c (rb_get_next_signal): removed pointless signal
+ disabling. pthread_sigmask() only changes current thread
+ mask.
+
+Tue Nov 20 09:36:55 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * signal.c (install_sighandler): added comments why we need
+ rb_disable_interrupt().
+
+Tue Nov 20 09:31:33 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * signal.c (rb_disable_interrupt, rb_enable_interrupt): removed
+ USE_TRAP_MASK.
+ * signal.c (trap_arg, trap_ensure): removed.
+ * signal.c (trap, sig_trap): removed pointless signal disabling.
+ We don't need it because we no longer run trap handler on signal
+ handler context.
+
+Tue Nov 20 09:20:49 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * prelude.rb: Moved Mutex#synchronize to
+ * thread.c (rb_mutex_synchronize_m): here. [Bug #4266]
+
+Tue Nov 20 08:36:15 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * signal.c (sig_signame): implements Signal.signame method
+ [Feature #5613]
+ * test/ruby/test_signal.rb (test_signame): adds test for above
+ * NEWS: add an item about above
+
+Mon Nov 19 16:30:59 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * struct.c (rb_struct_each_pair): yield associated pairs so that
+ an unsplat argument can get both, for consistency with Hash,
+ OpenStruct, and etc. [ruby-dev:46533] [Bug #7382]
+
+Mon Nov 19 16:17:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (LIBS): libelf is need on only FreeBSD.
+
+Mon Nov 19 16:08:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (RUBYLIB): purelib option in runruby.rb is deprecated
+ since r28841, so set to an empty list to get rid of a bogus path in
+ child processes, which caused an insecure operation exception in
+ test/ruby/test_encoding.rb:test_unsafe.
+
+Mon Nov 19 15:40:50 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * .travis.yml (script): add OPTS=-v, requested by @_ko1.
+
+Mon Nov 19 15:09:07 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * configure.in: fix didn't enable_dtrace=yes on auto.
+
+ * configure.in: see enable_dtrace for adding libelf on FreeBSD.
+
+ * common.mk: VPATH is not needed.
+
+Mon Nov 19 14:55:51 2012 Koichi Sasada <ko1@atdot.net>
+
+ * thread.c: add `Thread#backtrace_locations' method.
+ This method is similar to `caller_locations' method for
+ specific method.
+ And fix to accept `level' and `n' parameters for `Thread#backtrace'
+ and `Thread#backtrace_locations'.
+ `caller' (and `caller_locations') do not return `caller' method
+ frame.
+ However, `Thread#backtrace' (and `Thread#backtrace_locations')
+ return `Thread#backtrace' method frame itself
+ if `Thread.current.backtrace' was called.
+
+ * vm_backtrace.c: ditto.
+
+ * internal.h: ditto.
+
+ * test/ruby/test_backtrace.rb: add tests.
+
+Mon Nov 19 14:54:32 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * Makefile.in, common.mk (probes.h): moved to common.mk and changed to
+ see $(srcdir).
+
+ * common.mk (probes.dmyh): now created it on $(srcdir) always.
+
+ * win32/Makefile.sub (.SUFFIXES): removed common suffix.
+
+Mon Nov 19 10:00:10 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * Makefile.in (.SUFFIX): bsdmake needs .SUFFIX is defined before use.
+
+ * common.mk: fix path of probes.dmyh.
+
+ * common.mk (vm_dump.o): depend probes.h.
+
+ * configure.in: FreeBSD's USDT requires libelf.
+
+Mon Nov 19 01:11:59 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * vm_core.h, probes_helper.h (RUBY_DTRACE_FUNC_ENTRY_HOOK,
+ RUBY_DTRACE_FUNC_RETURN_HOOK): move from vm_core.h to new file
+ probes_helper.h for narrowing dependency to probes.h.
+ * common.mk (VM_CORE_H_INCLUDES): remove dependency to probes.h.
+ * common.mk (vm.$(OBJEXT)): add dependency to probes_helper.h.
+ * vm.c, vm_insnhelper.c: include probes_helper.h.
+
+Sun Nov 18 16:33:00 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * configure.in, Makefile.in, common.mk: support DTrace on Solaris 10,
+ based on r26235 by Yugui. On Solaris 10, low optimization level
+ may also be needed, e.g. optflags="-xO1" or "-xO0" with Oracle
+ SolarisStudio 12.3 cc.
+
+ * configure.in (--enable-dtrace): new option to enable/disable
+ DTrace support. By default, trying to enable if dtrace command
+ is found on the system. It is disabled when cross compiling.
+
+ * configure.in (RUBY_DTRACE_POSTPROCESS): new macro. checks whether
+ the dtrace on the system needs postprocessing with "dtrace -G".
+ The postprocessing is needed on Solaris 10 and other platforms.
+
+ * configure.in (RUBY_DTRACE_BSD_BROKEN): new macro. checks whether
+ the dtrace supports USDT.
+
+ * configure.in (DTRACE): move after RUBY_DTRACE_POSTPROCESS.
+
+ * configure.in (LD): On Solaris, /usr/ccs/bin/ld is preferred.
+
+ * configure.in, Makefile.in, common.mk (DTRACE_OBJ): new macro for
+ DTrace probe object generated by postprocessing with "dtrace -G".
+
+ * Makefile.in, common.mk (probes.$(OBJEXT)): DTrace probe object
+ generated by the postprocessing. New file probes.stamp is for
+ rebuilding related objects that may be modified by "dtrace -G".
+
+ * configure.in, Makefile.in, common.mk (DTRACE_GLOMMED_OBJ): new
+ macro for DTrace static library hacks.
+
+ * configure.in, Makefile.in (LIBRUBY_A_OBJS): ditto.
+
+ * Makefile.in, common.mk (ruby-glommed.$(OBJEXT)): new target with
+ rule for DTrace static library hacks.
+
+ * common.mk (DTRACE_DEPENDENT_OBJS): objects depended on probes.h.
+
+Sun Nov 18 09:31:47 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * complex.c (read_comp): mathn compliant.
+ * rational.c (read_num): ditto.
+
+Sun Nov 18 02:50:12 2012 Luis Lavena <luislavena@gmail.com>
+
+ * win32/file.c (replace_to_long_name): correct logic around wildcard
+ characters detection and ensure wide-chars are used as pattern.
+ [ruby-core:49451] [Bug #7374]
+
+Sun Nov 18 02:02:46 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * complex.c (read_comp): modified handling of polar form.
+
+Sun Nov 18 00:50:44 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * complex.c (read_comp): fixed handling of polar form.
+
+Sun Nov 18 00:14:46 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * complex.c (string_to_c_strict, string_to_c): rewrote without regexp.
+ * rational.c (string_to_r_strict, string_to_r): ditto.
+
+Sat Nov 17 23:53:05 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * complex.c (make_patterns): should not accept extra sign.
+
+Sat Nov 17 21:45:12 Luis Lavena <luislavena@gmail.com>
+
+ * win32/file.c (replace_to_long_name): skip expansion for all wildcard
+ characters.
+ [ruby-core:49451] [Bug #7374]
+
+ * test/ruby/test_file_exhaustive.rb: add more assertions to test.
+
+Sat Nov 17 12:14:50 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: use literal YAML style
+ when emitting multi-line strings. Thanks @atambo
+
+ * test/psych/test_yaml.rb: test for change.
+
+Sat Nov 17 12:03:41 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/scalar_scanner.rb: avoid raising exceptions when
+ parsing Floats and Integers. Thanks riffraff [ruby-core:44426]
+ * test/psych/test_numeric.rb: associated test
+
+Sat Nov 17 11:34:31 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * st.c (st_update): pass the key in st_table so that we can free
+ memory of the key in st_table when deleting.
+ [ruby-core:49220] [Bug #7330]
+
+ * test/-ext-/st/test_update.rb
+ (Bug::StTable#test_pass_objects_in_st_table): add a test.
+
+Sat Nov 17 11:26:36 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/core_ext.rb: move Kernel#y so that it can
+ manually be required as 'psych/y'.
+
+ * ext/psych/lib/psych/y.rb: ditto
+
+Sat Nov 17 08:13:48 2012 Benoit Daloze <eregontp@gmail.com>
+
+ * lib/abbrev.rb: fix r37113. Correct examples, fix style
+ and show explicit dependency (require 'abbrev').
+
+Sat Nov 17 07:35:15 2012 Luis Lavena <luislavena@gmail.com>
+
+ * win32/file.c (replace_to_long_name): skip automatic path expansion
+ when wildcard character is used. [ruby-core:49451] [Bug #7374]
+
+ * test/ruby/test_file_exhaustive.rb: add a test for above.
+
+Sat Nov 17 00:50:23 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+
+ * marshal.c (w_object): add flonum to arg->data to keep reference index
+ consistency. [ruby-core:49323] [Bug #7348]
+
+ * test/ruby/test_marshal.rb: add a test for above.
+
+Sat Nov 17 00:40:25 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (incs): dist files need probes.dmyh.
+
+ * common.mk (probes.dmyh): depends on generator script.
+
+ * Makefile.in, common.mk, configure.in, win32/Makefile.sub (probes.h):
+ select generating with dtrace or copying dummy file by suffix rules.
+
+Fri Nov 16 19:24:10 2012 Koichi Sasada <ko1@atdot.net>
+
+ * thread.c (rb_thread_call_without_gvl2): change the parameter of
+ `func' from `int *skip_interrupt' to `VALUE *flags'.
+ If (flags & RUBY_CALL_WO_GVL_FLAG_SKIP_CHECK_INTS) is not zero,
+ then skip checking interrupt.
+ [ruby-core:46547]
+
+ * include/ruby/thread.h: ditto.
+
+Fri Nov 16 18:59:05 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * Makefile.in (no-dtrace-probes.h): dmyprobes.h is in srcdir.
+
+ * common.mk (dmyprobes.h): ditto.
+
+Fri Nov 16 17:57:15 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * Makefile.in (probes.h): split build commands for dtrace-available
+ and unavailable platforms.
+
+ * Makefile.in (incs): probes.h is a platform dependent file, so it
+ cannot be a part of prereq target. move it to all-incs.
+
+ * configure.in (DTRACE): move after AC_PROG_CC since cross_compiling
+ is set in it.
+
+ * configure.in (DTRACE): ignore non-prefixed version if
+ cross-compiling.
+
+ * Makefile.in, win32/Makefile.sub (probes.h): fix copying dmyprobes.h
+ path when outplace-build.
+
+Fri Nov 16 15:27:36 2012 Masaki Matsushita <glass.saga@gmail.com>
+
+ * lib/net/pop.rb (POP3.certs): fix typo in comment.
+ patch from no6v (Nobuhiro IMAI) <nov@yo.rim.or.jp>.
+ [ruby-dev:46519] [Bug #7355]
+
+Fri Nov 16 12:36:47 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * test/rake/helper.rb (Rake::TestCase#setup): revert r37669.
+ @orig_PWD should be the original pwd.
+
+ * test/rake/test_*.rb: don't use @orig_PWD to load libraries.
+ It should be specified with relative path from the file.
+
+Fri Nov 16 10:22:52 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * test/rake/helper.rb (Rake::TestCase#setup): @orig_PWD shouldn't be
+ Dir.pwd when the build directory is different from source directory.
+
+Fri Nov 16 09:41:08 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/rake/version.rb: workaround fix to build. see #7366
+ [ruby-dev:46522]
+
+Fri Nov 16 07:23:18 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rake*: Updated to rake 0.9.4
+ http://rake.rubyforge.org/doc/release_notes/rake-0_9_4_rdoc.html for
+ a list of changes in 0.9.4.
+
+ * test/rake*: ditto
+
+ * NEWS: ditto
+
+Fri Nov 16 06:58:52 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rake*: Updated to rake 0.9.3. See
+ http://rake.rubyforge.org/doc/release_notes/rake-0_9_3_rdoc.html for
+ a list of changes in 0.9.3.
+
+ * test/rake*: ditto
+
+ * bin/rake: ditto
+
+ * NEWS: ditto
+
+Thu Nov 15 22:39:32 2012 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * range.c (range_bsearch): fix some bugs: a documentation bug, a wrong
+ condition, missed break in switch/case, and workaround for GCC
+ optimization. See [ruby-core:49364] in detail. A great patch from
+ Heesob Park. [Bug #7352] [Feature #4766]
+
+ * array.c (rb_ary_bsearch): fix similar bug (missed break).
+
+ * test/ruby/test_range.rb: add two test cases for above.
+
+Thu Nov 15 22:41:57 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_exec.h (GENTRY): GENTRY should be pointer size.
+ A patch by yoshidam (Yoshida Masato) [Bug #7332].
+
+Thu Nov 15 13:20:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * man/erb.1: Fix grammar and copyright dates
+ * man/goruby.1: ditto
+ * man/irb.1: ditto
+ * man/rake.1: ditto
+ * man/ri.1: ditto
+ * man/ruby.1: ditto
+ Patch by Arthur Gunn
+ [Fixes Github #210]
+
+Thu Nov 15 11:35:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * man/ruby.1: Grammar edits for man page
+ Based on a patch by Michael Endsley [Fixes Github #183]
+
+Thu Nov 15 00:47:20 2012 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * array.c (rb_ary_bsearch): add Array#bsearch for binary search.
+ [ruby-core:36390] [Feature #4766]
+
+ * test/ruby/test_array.rb: add a test for above.
+
+ * range.c (range_bsearch): add Range#bsearch for binary search.
+ [ruby-core:36390] [Feature #4766]
+
+ * test/ruby/test_range.rb: add a test for above
+
+ * NEWS: added the two new methods.
+
+Wed Nov 14 13:25:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/fileutils.rb (chmod): Add "X" to modes, convert format to table
+ [ruby-core:48965] [Bug #7288]
+
+Wed Nov 14 11:51:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/csv.rb (init_comments): Document private method #init_comments.
+ Based on a patch from Vincent Batts [ruby-core:49172] [Bug #7319]
+
+Wed Nov 14 00:54:00 2012 Kenta Murata <mrkn@mrkn.jp>
+
+ * Makefile.in (probes.h): create from probes.d
+
+Tue Nov 13 18:44:01 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_insnhelper.c (vm_call_cfunc_with_frame): don't use ci after
+ EXEC_EVENT_HOOK because ci can be overridden.
+
+ * vm_eval.c: ditto.
+
+ * method.h: change invoker's parameters types.
+
+ * vm_method.c (call_cfunc_invoker_func): ditto.
+
+Tue Nov 13 18:01:54 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * eval.c (rb_mod_using): raise an ArgumentError if cyclic using is
+ detected. based on the patch by Charlie Somerville.
+ [ruby-core:49092] Bug #7308
+
+ * test/ruby/test_refinement.rb: related test.
+
+Tue Nov 13 17:40:04 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * common.mk (vm_insnhelper.c): this target is useless and causes
+ ruby always need rebuild.
+
+Tue Nov 13 17:35:49 2012 Koichi Sasada <ko1@atdot.net>
+
+ * compile.c (insn_data_to_s_detail): remove debug lines.
+
+Tue Nov 13 17:28:47 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_insnhelper.c (vm_caller_setup_args): save and restore
+ ci->argc and ci->blockptr before and after method invocations
+ because these method dispatches can override call_info.
+
+ * bootstraptest/test_method.rb: add tests for this fix.
+
+Tue Nov 13 16:38:02 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * common.mk (dmyprobes.h): always create for make dist.
+
+ * Makefile.in (probes.h): create or copy dmyprobes.h
+
+ * win32/Makefile.sub: only do copy dmyprobes.h.
+
+Tue Nov 13 15:37:21 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * Makefile.in (.SUFFIX): .SUFFIX is needed here for .d.h on bsd make.
+
+Tue Nov 13 15:34:35 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * common.mk Makefile.in win32/Makefile.sub (.d.h): it's not common.
+
+Tue Nov 13 12:27:11 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * configure.in: disable dtrace because it doesn't work on FreeBSD.
+
+ * common.mk (clean-local): rm probes.h.
+
+ * common.mk (parse.o): depend $(PROBES_H_INCLUDES).
+
+ * common.mk (.d.h): moved from Makefile.in and use BASERUBY.
+
+ * tool/gen_dummy_probes.rb: reimplemented with ruby because sed is not
+ available on Windows Microsoft VC++ environment.
+
+Tue Nov 13 12:30:26 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/README.win32: added mention about build directory. currently
+ we can not build ruby in win32 directory. this problem is reported
+ by Masahiro Kitajima <katonbo@katontech.com>.
+
+Tue Nov 13 11:03:47 2012 Masaki Matsushita <glass.saga@gmail.com>
+
+ * re.c (rb_memsearch_ss): performance improvement by using memmem(3) if
+ possible. [ruby-dev:45530] [Feature #6311]
+
+ * configure.in: check existence of memmem(3) and that it is not broken.
+
+Tue Nov 13 06:50:02 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * probes.d: add DTrace probe declarations. [ruby-core:27448]
+
+ * array.c (empty_ary_alloc, ary_new): added array create DTrace probe.
+
+ * compile.c (rb_insns_name): allowing DTrace probes to access
+ instruction sequence name.
+
+ * Makefile.in: translate probes.d file to appropriate header file.
+
+ * common.mk: declare dependencies on the DTrace header.
+
+ * configure.in: add a test for existence of DTrace.
+
+ * eval.c (setup_exception): add a probe for when an exception is
+ raised.
+
+ * gc.c: Add DTrace probes for mark begin and end, and sweep begin and
+ end.
+
+ * hash.c (empty_hash_alloc): Add a probe for hash allocation.
+
+ * insns.def: Add probes for function entry and return.
+
+ * internal.h: function declaration for compile.c change.
+
+ * load.c (rb_f_load): add probes for `load` entry and exit, require
+ entry and exit, and wrapping search_required for load path search.
+
+ * object.c (rb_obj_alloc): added a probe for general object creation.
+
+ * parse.y (yycompile0): added a probe around parse and compile phase.
+
+ * string.c (empty_str_alloc, str_new): DTrace probes for string
+ allocation.
+
+ * test/dtrace/*: tests for DTrace probes.
+
+ * vm.c (vm_invoke_proc): add probes for function return on exception
+ raise, hash create, and instruction sequence execution.
+
+ * vm_core.h: add probe declarations for function entry and exit.
+
+ * vm_dump.c: add probes header file.
+
+ * vm_eval.c (vm_call0_cfunc, vm_call0_cfunc_with_frame): add probe on
+ function entry and return.
+
+ * vm_exec.c: expose instruction number to instruction name function.
+
+ * vm_insnhelper.c: add function entry and exit probes for cfunc
+ methods.
+
+ * vm_insnhelper.h: vm usage information is always collected, so
+ uncomment the functions.
+
+Mon Nov 12 19:14:50 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * configure.in (isinf, isnan): isinf() and isnan() are macros on
+ DragonFly which cannot be found by AC_REPLACE_FUNCS(). This
+ workaround enforces the fact that they exist on DragonFly.
+
+Mon Nov 12 15:59:38 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * vm_core.h (rb_call_info_t::refinements), compile.c (new_callinfo),
+ vm_insnhelper.c (vm_search_method): revert r37616 because it's too
+ slow. [ruby-dev:46477]
+
+ * test/ruby/test_refinement.rb (test_inline_method_cache): skip
+ the test until the bug is fixed efficiently.
+
+Mon Nov 12 14:28:01 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/mkexports.rb (each_export): skip garbage generated by VS2012's
+ nmake.
+ reported and patched by Yoshida Masato at [Bug #7333] [ruby-dev:46484]
+
+Sun Nov 11 18:58:55 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * test/date/test_date_{parse,strptime}.rb: changed the format of
+ some extra messages.
+
+Sun Nov 11 18:41:34 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_parse.c (date__parse): revised the tight parser
+ (about handling of apostrophes).
+
+Sun Nov 11 15:39:04 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * hash.c (rb_hash_s_create): just warn for wrong elements now.
+ [ruby-dev:46440] [Bug #7300]
+
+ * hash.c (rb_hash_s_create): refine error messages.
+
+ * error.c (rb_builtin_class_name): share for above.
+
+Sun Nov 11 15:12:18 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * eval.c (top_using): remove Kernel#using, and add main.using instead.
+
+ * test/ruby/test_refinement.rb: related test.
+
+Sun Nov 11 13:41:01 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * eval.c (rb_using_refinement, rb_mod_using, f_using): clear method
+ cache only when using is called explicitly.
+
+ * test/ruby/test_refinement.rb: related test.
+
+Sun Nov 11 12:56:34 2012 Masaki Matsushita <glass.saga@gmail.com>
+
+ * lib/pstore.rb (PStore): fix not to replace ThreadError raised in
+ #transaction block with PStore::Error.
+ [ruby-core:39238] [Bug #5269]
+
+Sun Nov 11 11:36:19 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * vm_core.h (rb_call_info_t::refinements), compile.c (new_callinfo):
+ add a new field for inline method cache.
+
+ * vm_insnhelper.c (vm_search_method): check rb_call_info_t::refinements
+ not to confuse inline method cache when module_eval is used with
+ refinements.
+
+ * test/ruby/test_refinement.rb: related test.
+
+Sun Nov 11 08:45:45 2012 Martin Duerst <duerst@it.aoyama.ac.jp>
+
+ * ruby.c: removed a comma before "before"
+
+Sat Nov 10 23:02:31 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c: move immutable fields from struct heaps_slot and struct
+ sorted_heaps_slot into struct heaps_header.
+ Based on a patch from Sokolov Yura [Feature #6199][ruby-core:43592]
+
+Sat Nov 10 19:28:16 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * complex.c: modified doc.
+ * rational.c: ditto.
+
+Sat Nov 10 18:20:10 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_parse.c: edited about era.
+
+Sat Nov 10 12:13:41 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * tool/rbinstall.rb: Don't install *.gemspec under lib/.
+ [ruby-core:48966] [Bug #7289]
+ Reported by Vit Ondruch. Thanks!!!
+
+Sat Nov 10 00:49:26 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * ruby_atomic.h: renamed from atomic.h to avoid header file name
+ conflict on Solaris 10. [ruby-dev:46414] [Bug #7287]
+
+ * gc.c, signal.c, vm_core.h, common.mk: reflect the rename from
+ atomic.h to ruby_atomic.h.
+
+Sat Nov 10 00:46:57 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * atomic.h: Revert r37491 which is a temporary workaround.
+
+Sat Nov 10 00:33:31 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * siphash.h: check configure macros before include newer headers.
+
+Fri Nov 9 23:33:05 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/erb.rb (ERB#run, ERB#result): eval under isolated bindings for
+ safe concurrent use. [ruby-core:47638] [Bug #7046]
+
+Fri Nov 9 23:05:06 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * random.c (BYTE_ORDER): define using configured WORDS_BIGENDIAN.
+
+ * siphash.c (sip_init_state): use union to suppress warnings by gcc
+ 4.7.
+
+Fri Nov 9 19:40:03 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * array.c (rb_ary_splice): fix r37583 doesn't consider the case when
+ beg > array length.
+
+Fri Nov 9 16:11:58 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * random.c (rb_memhash): use siphash.
+
+Fri Nov 9 16:08:46 2012 Sokolov Yura funny-falcon <funny.falcon@gmail.com>
+
+ * array.c: speedup Array#unshift by using space in shared array.
+ [Feature #6638]
+ - when array owns its shared array (ARY_SHARED_NUM == 1), and there
+ is enough space then try unshift values directly into shared
+ array.
+ - when resulting array is big (~>64 items) then make it shared with
+ enough room for future #unshifts, and then insert into shared
+ array.
+
+ * array.c (rb_ary_splice): use shared array in rb_ary_slice.
+ [Feature #6638]
+ - use ary_ensure_room_for_push when rb_ary_slice used to add at the
+ end of array, cause rb_ary_concat use rb_ary_slice.
+
+ * array.c (ary_ensure_room_for_push): make array really suitable for
+ queue. [Feature #6638]
+ when array is shared (which happens after Array#shift), and
+ ARY_SHARED_NUM == 1 (which is very often when array used as queue),
+ then make rb_ary_push push directly into shared array.
+
+ * array.c (rb_ary_modify): steal shared array's container when
+ ARY_SHARED_NUM == 1. [Feature #6638]
+ - Do not allocate new memory in rb_ary_modify when ARY_SHARED_NUM == 1
+ and length almost same.
+ - Store ARY_CAPA instead of RARRAY_LEN in ary_make_shared, to make
+ it useful.
+ - Fix rb_ary_sort_bang accordantly.
+
+Fri Nov 9 16:00:00 2012 Zachary Scott <zzak@zacharyscott.net>
+
+ * ext/bigdecimal/bigdecimal.c: Documentation for BigDecimal
+ Based on a patch from Vincent Batts [ruby-core:49047] [Bug #7305]
+
+Fri Nov 9 15:25:42 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/shellwords.rb (Shellwords#shellescape): Add back my original
+ real world example with some enhancement.
+
+ * lib/shellwords.rb (Shellwords#shelljoin): Undo part of the
+ previous rdoc change. This new example using a string-only
+ array was not in line with the description.
+
+Fri Nov 9 12:58:13 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * string.c (rb_str_crypt): crypt(3) may return NULL.
+ Latest glibc (2.16?) crypt(3) actually returns NULL. [Bug #7312]
+
+Fri Nov 9 12:07:06 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * include/ruby/ruby.h (alloca), eval_intern.h (alloca), gc.c
+ (alloca): Make alloca() globally available by moving the
+ ultimate ifdef's to ruby/ruby.h. Gcc hides its builtin alloca()
+ when compiling with -ansi, and linking thus fails on platforms
+ that lack their own alloca() implementation in libc, which
+ include OpenBSD and some ports of NetBSD. We use alloca()
+ everywhere including from within third party C extensions, so
+ alloca() must be made globally available. [Bug #7307]
+
+ * addr2line.c (alloca): Replace the alloca() part with the
+ ultimate ifdef's. [Bug #7307]
+
+Fri Nov 9 09:30:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * io.c (IO#new):
+ Fix indentation from r37444
+ [ruby-core:48052] [Bug #7179]
+
+Fri Nov 9 07:36:00 2012 Kenta Murata <mrkn@mrkn.jp>
+
+ * bignum.c (bigmul0): enable big_mul_toom3.
+ [ruby-core:48552] [Bug #7242]
+
+ * bignum.c (bigmul1_toom3): fix incorrect calculation.
+ the patch is made by Heesob Park.
+ [ruby-core:48552] [Bug #7242]
+
+Fri Nov 9 05:33:00 2012 Kenta Murata <mrkn@mrkn.jp>
+
+ * bignum.c (bigmul0): disable big_mul_toom3 temporarily.
+ [ruby-core:48552] [Bug #7242]
+
+ * test/ruby/test_bignum.rb (test_mul_large_numbers):
+ add a test for bigmul1_toom3 suggested in [Bug #7242].
+
+Thu Nov 8 21:57:59 2012 Masaki Matsushita <glass.saga@gmail.com>
+
+ * re.c (rb_memsearch): performance improvement by using memchr().
+ [ruby-dev:45397] [Feature #6173]
+
+Thu Nov 8 19:02:50 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/protocol.rb (Net::InternetMessageIO#each_crlf_line):
+ treat \r as newline as mame pointed. [ruby-dev:46425] [Bug #7278]
+
+Thu Nov 8 11:32:11 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * configure.in (--with-opt-dir): Avoid nesting of double quotes
+ inside backquotes, since some traditional shells like PD KSH
+ (which OpenBSD's /bin/sh bases on) fail to parse them.
+
+Thu Nov 8 09:34:00 2012 Kenta Murata <mrkn@cookpad.com>
+
+ * numeric.c: Add a caution that the results of the comparing
+ operations of two NaNs are undefined.
+ [#1720] [ruby-dev:38725] [ruby-core:36966]
+
+Thu Nov 8 04:45:21 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * include/ruby/intern.h: Restore rb_enumeratorize as it was before
+ r37497 and introduce rb_enumeratorize_with_size instead. [#7302]
+
+ * enumerator.c: ditto.
+
+Wed Nov 7 15:22:37 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * numeric.c (ruby_float_step): fix r37514: it yielded with NaN
+ if the unit is infinity.
+
+Wed Nov 7 15:46:12 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * lib/webrick.rb: fix typo. reported by Rohit Arondekar.
+ https://github.com/ruby/ruby/pull/211
+
+Wed Nov 7 15:34:12 2012 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
+
+ * lib/cgi/core.rb: alias CGI#http_header to CGI#header.
+
+Wed Nov 7 12:49:39 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * eval.c (rb_mod_refine): set RMODULE_IS_REFINEMENT to a created
+ refinement module, and don't override method_added.
+
+ * vm_method.c (rb_method_entry_make): check redefinition of
+ optimized methods when a method is added to a refinement module.
+ [ruby-core:48970] [Bug #7290]
+
+ * test/ruby/test_refinement.rb: related test.
+
+Wed Nov 7 11:48:14 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * misc/ruby-additional.el (ruby-mode-set-encoding): now encoding needs
+ to be set always explicitly actually. [Feature #6679]
+
+Wed Nov 7 09:15:58 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * object.c (rb_mod_const_get): avoid inadvertent symbol creation.
+
+Wed Nov 7 07:52:50 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * enum.c (rb_enum_cycle_size): prefix with rb.
+
+Wed Nov 7 04:32:15 2012 Luis Lavena <luislavena@gmail.com>
+
+ * test/ruby/test_file_exhaustive.rb: Remove FIXME skip on Windows
+ specific test because the test in question was already fixed.
+
+Wed Nov 7 03:45:12 2012 Luis Lavena <luislavena@gmail.com>
+
+ * ext/zlib/extconf.rb: Recognize zlibwapi as linking library.
+ Patch by Daniel Berger.
+
+ [ruby-core:44979] [Feature #6421]
+
+Wed Nov 7 02:06:40 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * enumerator.c: New method #size; constructor accepts size.
+ Have #to_enum accept a block
+ Warn when using deprecated form of constructor
+ Support #size for enumerators created from enumerators
+ Support for lazy.{map|flat_map|...}.size.
+
+ * include/ruby/intern.h: RETURN_SIZED_ENUMERATOR for support of
+ sized enumerators.
+
+ * array.c: Support for various enumerator.size.
+
+ * enum.c: ditto.
+
+ * hash.c: ditto.
+
+ * numeric.c: ditto.
+
+ * range.c: ditto.
+
+ * string.c: ditto.
+
+ * struct.c: ditto.
+
+ * vm_eval.c: ditto.
+
+Tue Nov 6 20:40:28 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * object.c (rb_mod_const_get): Fix constant missing exception class
+ and message to maintain backwards compatibility. Constant search
+ should start at Object when constant starts with '::'
+
+ * test/ruby/test_module.rb: test for fixes
+
+Tue Nov 6 16:50:00 2012 Masaki Matsushita <glass.saga@gmail.com>
+
+ * lib/tempfile.rb (Tempfile#inspect): fix confusing #inspect.
+ previous Tempfile#inspect says it is a File, but actually
+ it is not a File.
+
+ t = Tempfile.new("foo") #=> #<File:/tmp/foo20121106-31970-1ffbum0>
+ t.is_a? File #=> false
+
+ now Tempfile#inspect returns like:
+
+ t = Tempfile.new("foo")
+ #=> #<Tempfile:/tmp/foo20121106-31970-1ffbum0>
+
+ [ruby-core:47544] [Bug #7027]
+
+Tue Nov 6 16:22:30 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * atomic.h: add #include <sys/atomic.h> for the workaround of
+ header file name conflict of atomic.h with /usr/include/atomic.h
+ on Solaris 10. [ruby-dev:46414] [Bug #7287]
+
+Tue Nov 6 14:38:00 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/win32ole/test_win32ole.rb: now source encoding is UTF-8, so
+ binary strings in old scripts are dangerous.
+
+Tue Nov 6 14:25:09 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/protocol.rb (Net::InternetMessageIO#each_crlf_line):
+ don't use /n in universal regexp. [ruby-dev:46394] [Bug #7278]
+
+Tue Nov 6 09:42:26 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * string.c (rb_str_b): Add String#b, returning a copied string
+ whose encoding is ASCII-8BIT. [ruby-dev:45992] [Feature #6767]
+
+Tue Nov 6 09:37:57 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ruby.c (load_file_internal): set default source encoding as
+ UTF-8 instead of US-ASCII. [ruby-core:46021] [Feature #6679]
+
+ * parse.y (parser_initialize): set default parser encoding as
+ UTF-8 instead of US-ASCII.
+
+Tue Nov 6 05:48:06 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * test/ruby/test_require.rb
+ (TestRequire#test_require_to_path_redefined_in_load_path,
+ TestRequire#test_require_to_str_redefined_in_load_path):
+ Suppress method redefined warning when test-all with RUBYOPT=-w.
+
+Thu Nov 8 00:24:14 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/curses/view.rb: Do not fail if the file to view is shorter
+ than the screen height.
+
+Mon Nov 5 11:40:00 2012 Mark Somerville <mark@scottishclmibs.com>
+
+ * thread_pthread.c (rb_reserved_fd_p): fix typo in macro check
+ that prevented the ifdef ever being true.
+ [Bug #7281] [ruby-core:48940]
+
+Mon Nov 5 23:28:57 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * file.c (rb_get_path_check_to_string): extract from
+ rb_get_path_check(). We change the spec not to call to_path of
+ String object.
+
+ * file.c (rb_get_path_check_convert): extract from rb_get_path_check().
+
+ * file.c (rb_get_path_check): follow the above change.
+
+ * file.c (rb_file_expand_path_fast): remove check_expand_path_args().
+ Instead we call it in load.c.
+
+ * file.c (rb_find_file_ext_safe): use rb_get_expanded_load_path() to
+ reduce expand cost.
+
+ * file.c (rb_find_file_safe): ditto.
+
+ * internal.h (rb_get_expanded_load_path): add a declaration.
+
+ * internal.h (rb_get_path_check_to_string, rb_get_path_check_convert):
+ add declarations.
+
+ * load.c (rb_construct_expanded_load_path): fix for compatibility.
+ Same checks in rb_get_path_check() are added. We don't replace
+ $LOAD_PATH and ensure that String object of $LOAD_PATH are frozen.
+ We don't freeze non String object and expand it every time. We add
+ arguments for expanding load path partially and checking if load path
+ have relative paths or non String objects.
+
+ * load.c (load_path_getcwd): get current working directory for checking
+ if it's changed when getting load path.
+
+ * load.c (rb_get_expanded_load_path): fix for rebuilding cache properly.
+ We check if current working directory is changed and rebuild expanded
+ load path cache. We expand paths which start with ~ (User HOME) and
+ non String objects every time for compatibility. We make this
+ accessible from other source files.
+
+ * load.c (rb_feature_provided): call rb_get_path() since we changed
+ rb_file_expand_path_fast() not to call it.
+
+ * load.c (Init_load): initialize vm->load_path_check_cache.
+
+ * vm.c (rb_vm_mark): mark vm->load_path_check_cache for GC.
+
+ * vm_core.h (rb_vm_struct): add vm->load_path_check_cache to store data
+ to check load path cache validity.
+
+ * test/ruby/test_require.rb (TestRequire): add tests for require
+ compatibility related to cached expanded load path.
+ [ruby-core:47970] [Bug #7158]
+
+Mon Nov 5 23:26:05 2012 Greg Price <price@mit.edu>
+
+ * load.c (rb_get_expanded_load_path): cache the expanded load
+ path. This saves 4KB of allocation and some stats for every
+ element of the load path (so nearly a MB in my Rails app)
+ on every require.
+
+ * load.c (rb_construct_expanded_load_path): ensure that $LOAD_PATH
+ entries are frozen strings. The user must mutate $LOAD_PATH
+ itself rather than its individual entries.
+
+ * vm_core.h (rb_vm_struct): add fields.
+
+ * vm.c (rb_vm_mark): mark new fields.
+
+ * ruby.c (process_options): modify $LOAD_PATH directly rather than
+ its elements.
+ Patch by Greg Price.
+ [ruby-core:47970] [Bug #7158]
+
+Mon Nov 5 23:24:42 2012 Greg Price <price@mit.edu>
+
+ * load.c (rb_feature_p, rb_provide_feature): index $LOADED_FEATURES
+ so that require isn't so slow.
+
+ * load.c (rb_provide_feature, get_loaded_features_index): ensure
+ that $LOADED_FEATURES entries are frozen strings. The user
+ must mutate $LOADED_FEATURES itself rather than its individual
+ entries.
+
+ * load.c (reset_loaded_features_snapshot): add a new function to reset
+ vm->loaded_features_snapshot.
+
+ * load.c (get_loaded_features_index_raw): add a new function to get
+ the loaded-features index.
+
+ * load.c (features_index_add_single): add a new function to add to the
+ loaded-features index a single feature.
+
+ * load.c (features_index_add): add a new function to add to the
+ loaded-features index all the required entries for `feature`.
+
+ * vm_core.h (rb_vm_struct): add fields.
+
+ * vm.c (rb_vm_mark): mark new fields.
+
+ * include/ruby/intern.h (rb_hash_clear): declare function.
+
+ * hash.c (rb_hash_clear): make function non-static.
+ Patch by Greg Price.
+ [ruby-core:47970] [Bug #7158]
+
+Mon Nov 5 23:23:51 2012 Greg Price <price@mit.edu>
+
+ * array.c (rb_ary_shared_with_p): new function.
+ Expose whether two arrays are shared (read-only, C only).
+
+ * include/ruby/intern.h (rb_ary_shared_with_p): declare.
+ Patch by Greg Price.
+ [ruby-core:47970] [Bug #7158]
+
+Mon Nov 5 23:21:14 2012 Greg Price <price@mit.edu>
+
+ * load.c (loaded_feature_path): clarify and briefly comment
+ function. These clarifications have no effect on the behavior
+ of the function.
+
+ * load.c (rb_feature_p): explain the search loop. Especially
+ useful because the logic is complicated as described in the
+ second paragraph.
+ Patch by Greg Price.
+ [ruby-core:47970] [Bug #7158]
+
+Mon Nov 5 22:45:03 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * ext/dl/win32/lib/Win32API.rb (Win32API#call): use 64bit pointer for x64
+ Windows. This would fix
+ TestSecureRandom#test_s_random_bytes_without_openssl error.
+ [ruby-core:47451] [Bug #6990]
+
+Mon Nov 5 22:09:26 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * cygwin/GNUmakefile.in (uncommon.mk): link *.res.o.
+ EXTOBJES is defined in uncommon.mk. *.res.o setting should be below
+ uncommon.mk.
+ [ruby-core:48858] [Bug #7277]
+
+Mon Nov 5 11:35:11 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c (native_thread_init, native_thread_destroy):
+ removed HAVE_PTHREAD_CONDATTR_INIT check because this silly
+ #ifdef makes use-uninitialized-var issue and (2) native_cond_initialize()
+ already have a right platform and caller don't need any additional care.
+ [Bug #6825]
+
+Mon Nov 5 10:57:59 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/cgi/core.rb: check if Tempfile is defined before use it.
+
+ * lib/cgi/core.rb: remove tempfiles only if tempfiles exist
+
+Mon Nov 5 12:17:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/uri/http.rb (URI::HTTP.build): Fix example
+ Patch by Carina C. Zona
+ [Fixes #209 Github]
+
+Mon Nov 5 09:55:05 2012 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
+
+ * lib/cgi/core.rb: remove tempfile more early.
+
+Sun Nov 4 20:29:46 2012 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
+
+ * lib/cgi.rb, lib/cgi/*/rb: rename CGI#header to CGI#http_header,
+ add and update HTML5 tag generator. [Bug #7110]
+ Patch provided by Marcus Stollsteimer, thank you !
+
+Sun Nov 4 11:47:39 2012 Masaki Matsushita <glass.saga@gmail.com>
+
+ * lib/fileutils.rb (module FileUtils): repatch [ruby-core:39622]
+ [Feature #5337]. improve performance of FileUtils.compare_stream.
+ [ruby-core:47545] [Feature #7028]
+
+Sun Nov 4 11:27:54 2012 Masaki Matsushita <glass.saga@gmail.com>
+
+ * array.c (recursive_equal): fix to return true when self and other
+ are resized to same size and the current index become out of
+ range.
+
+ * test/ruby/test_array.rb: add a test for the above.
+
+Sun Nov 4 10:19:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dir.c (file_s_fnmatch): match with expanding braces if FNM_EXTGLOB
+ is set. [ruby-core:40037] [Feature #5422]
+
+Sat Nov 3 23:38:15 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * complex.c: modified doc.
+ * rational.c: ditto.
+
+Sat Nov 3 22:38:55 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: modified doc.
+
+Sat Nov 3 18:35:55 2012 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * vm.c (rb_vm_rewrite_ep_in_errinfo, vm_rewrite_ep_in_errinfo):
+ merge code and remove `rb_vm_rewrite_ep_in_errinfo'.
+
+Sat Nov 3 18:15:24 2012 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * vm.c, proc.c: avoid unnecessary `rb_vm_rewrite_ep_in_errinfo'
+ calls.
+
+Sat Nov 3 17:53:43 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * bin/testrb: Use only Test::Unit::AutoRunner in test-unit gem
+ compatible API to be available by both test/unit bundled in Ruby
+ and test-unit gem.
+ * lib/test/unit.rb (Test::Unit::AutoRunner): Move codes from testrb.
+
+Sat Nov 3 14:56:21 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_parse.c (parse_eu): should capture apostrophe too.
+
+Sat Nov 3 14:46:15 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_parse.c (date__parse): revised the tight parser.
+
+Sat Nov 3 14:43:42 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rexml/xmldecl.rb (REXML::XMLDecl#content): Add missing \A
+ and \z.
+
+Sat Nov 3 14:42:55 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rexml/output.rb (REXML::Output#initialize): Use normalized
+ encoding name.
+
+Sat Nov 3 14:41:17 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rexml/output.rb (REXML::Output): Don't output BOM in middle
+ of the output string.
+ * test/rexml/test_document.rb: Add a test for the above change.
+
+Sat Nov 3 14:09:55 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * NEWS: Add an item about REXML::Document#write.
+
+Sat Nov 3 13:46:49 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * test/rexml/test_document.rb: Fix tests that expect encoding name
+ isn't normalized.
+
+Sat Nov 3 13:26:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * dir.c (Dir#glob):
+ Documentation for pattern section, backslash subsection
+ Patch by Eric Bouchut
+ [ruby-core:48528] [Bug #7230]
+
+Sat Nov 3 13:26:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * io.c (IO#new):
+ Documentation for IO#open modes and formatting
+ [ruby-core:48052] [Bug #7179]
+
+Sat Nov 3 13:01:02 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * test/rexml/test_encoding.rb (EncodingTester#test_in_different_out):
+ Fix a test that expects encoding in XML declaration is changed by
+ Output's encoding. It is dropped feature.
+
+Sat Nov 3 12:49:45 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rexml/document.rb (REXML::Document#write): Document encoding
+ option. Now different encoding between XML file's encoding and
+ XML declaration's encoding is support.
+ [Feature #4872] (work in progress)
+ * lib/rexml/xmldecl.rb (REXML::XMLDecl#write): Always use XMLDecl's
+ encoding.
+ * test/rexml/test_document.rb: Update tests for the above change.
+
+Sat Nov 3 12:18:35 2012 Masaki Matsushita <glass.saga@gmail.com>
+
+ * array.c (recursive_equal): fix not to make invalid pointers when
+ self and other are resized to same size in #== of their elements.
+ [ruby-dev:46373] [Feature #6177]
+
+Sat Nov 3 12:06:15 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * test/rexml/test_xml_declaration.rb (TestXmlDeclaration#test_*):
+ Remove needless prefix from test names.
+
+Sat Nov 3 12:04:52 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * test/rexml/test_xml_declaration_parent_child.rb: Rename to ...
+ * test/rexml/test_xml_declaration.rb: ... this.
+
+Sat Nov 3 11:43:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * hash.c (rb_hash_delete): Correct grammar
+ Patch by Glenn Oppegard
+ [Fixes #208 Github]
+
+Sat Nov 3 11:28:28 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * NEWS: add a news about GC::Profiler.raw_data.
+
+Sat Nov 3 11:01:32 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * NEWS: add a news about rb_newobj_of() and NEWOBJ_OF().
+
+Sat Nov 3 10:17:41 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * eval.c (f_current_dirname): add the new method for Kernel.
+ This method almost same as File.dirname(__FILE__). One
+ different behavior is it returns nil when __FILE__ returns nil.
+ [Feature #3346]
+
+ * NEWS: ditto
+
+ * test/ruby/test_method.rb: related test.
+
+Sat Nov 3 09:03:34 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * test/ruby/test_refinement.rb (test_new_method_by_send,
+ test_new_method_by_method_object): add tests for Kernel#send and
+ Kernel#method with refinements.
+
+ * test/ruby/test_refinement.rb (test_symbol_to_proc): add a test
+ calling a proc created by Symbol#to_proc outside the scope where
+ a refinement is closed over.
+
+Sat Nov 3 04:14:19 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm.c (rb_vm_rewrite_ep_in_errinfo): rewrite all catch points in
+ errinfo, not only the topmost frame. based on the patch by
+ ktsj (Kazuki Tsujimoto) in [ruby-dev:45656]. [Bug #6460]
+
+Fri Nov 2 20:11:17 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (MakeMakefile#timestamp_file): remove @ which looks like
+ configure variables.
+
+ * lib/mkmf.rb (MakeMakefile#timestamp_file): use .-. instead of !, a
+ special character of NMAKE and BSD make. [Bug #7265]
+
+Fri Nov 2 17:55:39 2012 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/test/unit.rb (_run_parallel): Delete status line before showing
+ results. Patch by Hiroshi Shirosaki. [Bug #6897] [ruby-core:47250]
+
+ * lib/test/unit.rb (_run_parallel): Fix strange result when disabled retrying.
+ Patch by Hiroshi Shirosaki. [Bug #6897] [ruby-core:47250]
+
+Fri Nov 2 17:52:12 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * object.c (rb_mod_to_s): Module#{to_s,inspect}, when invoked on
+ a refinement, returns a string in the format #<refinement:C@M>,
+ where C is a refined class and M is a module at which the refinement
+ is defined.
+
+ * eval.c (rb_mod_refine): store information on a refinement for the
+ above change.
+
+ * test/ruby/test_refinement.rb: related test.
+
+Fri Nov 2 16:57:52 2012 Shota Fukumori <sorah@tubusu.net>
+
+ * vm_dump.c (rb_vm_bugreport): Because of many log directories,
+ making directory lists readable.
+
+Fri Nov 2 16:44:00 2012 Kenta Murata <mrkn@mrkn.jp>
+
+ * vm_dump.c (rb_vm_bugreport): add ~/Library/Logs/DiagnosticReports
+ in the locations list of crash reports.
+
+Fri Nov 2 14:52:52 2012 Masaki Matsushita <glass.saga@gmail.com>
+
+ * array.c (recursive_equal): performance improvement by avoiding
+ overhead to call rb_ary_elt().
+ [ruby-dev:45412] [Feature #6177]
+
+Fri Nov 2 14:47:53 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * string.c (sym_to_proc, sym_call): A Proc created by Symbol#to_proc
+ should close over the current refinements.
+ [ruby-dev:46345] [Bug #7261]
+
+ * vm_eval.c (rb_call0, rb_search_method_entry,
+ rb_funcall_passing_block_with_refinements): add a new argument
+ `refinements' for the above changes.
+
+ * test/ruby/test_refinement.rb: related test.
+
+Fri Nov 2 08:24:28 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * proc.c (top_define_method): new method, main.define_method.
+ [ruby-core:45715] [Feature #6609]
+
+ * eval.c (top_include): fix a warning message, main is not a class or
+ module.
+
+Fri Nov 2 04:41:33 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (MakeMakefile#timestamp_file): use ! instead of %, a GNU
+ make special character.
+
+Fri Nov 2 04:40:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/ruby/test_process.rb (test_execopts_preserve_env_on_exec_failure):
+ use never existing file in the current temporary directory.
+
+Fri Nov 2 04:23:20 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * tool/merger.rb: add feature to tag preview/rc.
+
+Fri Nov 2 03:23:37 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/mkmf.rb: fix for if config["libdir"] is nil.
+
+Thu Nov 1 23:06:01 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * tool/make-snapshot: fix wrong regexp for releasing preview.
+ patched by mame.
+
+Thu Nov 1 22:27:11 2012 Koichi Sasada <ko1@atdot.net>
+
+ * NEWS: add a news about objspace,
+ ObjectSpace.reachable_objects_from.
+
+Thu Nov 1 21:57:00 2012 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_new),
+ test/bigdecimal/test_bigdecimal.rb:
+ Fix exception message of BigDecimal constructor with a Float.
+
+Thu Nov 1 21:52:20 2012 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_add),
+ test/bigdecimal/test_bigdecimal.rb:
+ need to specify precision for converting Rational and Float.
+ [ruby-core:48045] [Bug #7176]
+
+Thu Nov 1 21:42:20 2012 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * test/ruby/test_process.rb: Revert r37404. My ubuntu box has
+ actually the directory named "/nonexistent"... Sorry.
+
+Thu Nov 1 21:28:28 2012 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * test/ruby/test_process.rb: Process.exec raised EACCES on Linux
+ 3.5.0-17-generic. This is a temporal fix to rescue that exception.
+ Needs kosaki's review.
+
+Thu Nov 1 21:19:56 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * iseq.c (set_relation): parent_iseq need to be set regardless iseq
+ type. fix r37397.
+
+Thu Nov 1 19:47:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread_pthread.c (RUBY_STACK_MIN): may not a compile time constant.
+ fix r37079. [ruby-dev:46322] [Bug #7247]
+
+Thu Nov 1 16:44:36 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * NEWS: add note for Module#refine, Module#refinements,
+ Module#using, and Kernel#using.
+
+Thu Nov 1 14:41:47 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * eval.c (rb_using_module): using should be used indirectly.
+ [ruby-dev:46326] [Feature #7251]
+
+Wed Oct 31 18:17:38 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c (gc_profile_record): don't define unused variables when
+ GC_PROFILE_MORE_DETAIL is 0.
+
+Wed Oct 31 18:10:53 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c (gc_prof_mark_timer_stop): count is not initialized.
+
+Wed Oct 31 09:28:24 2012 Eric Hodel <drbrain@segment7.net>
+
+ * thread.c (rb_thread_call_without_gvl2): Note that ubf() may or may
+ not be called with the GVL. Hinted that rb_thread_call_with_gvl()
+ can be used to access ruby functionality.
+
+Wed Oct 31 09:06:54 2012 Eric Hodel <drbrain@segment7.net>
+
+ * thread.c (rb_thread_call_without_gvl2): Update documentation to
+ natural English.
+ * thread.c (rb_thread_call_with_gvl): ditto.
+
+Wed Oct 31 02:53:07 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/dl/lib/dl/struct.rb: fix strange require order. [ruby-dev:45702]
+
+ * ext/dl/lib/dl/value.rb: ditto
+
+ * test/dl/test_c_struct_entry.rb: remove strange require order from
+ tests.
+
+ * test/dl/test_c_union_entity.rb: ditto
+
+Tue Oct 30 23:59:32 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * eval.c (rb_mod_refine): fix the error message when no block is
+ given. [ruby-dev:46319] [Bug #7244]
+
+ * test/ruby/test_refinement.rb: related test.
+
+Tue Oct 30 19:27:48 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * process.c (redirect_dup2): set standard handles when new fd is stdio,
+ because if there is no allocated console at the moment Windows does
+ not automatically associate it for child process's standard handle.
+ this is adhoc workaround.
+ reported by Martin Thiede at [ruby-core:48542] [Bug #7239].
+
+ * io.c (rb_cloexec_dup2): ditto.
+
+Tue Oct 30 03:08:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/rbconfig/obsolete.rb (Config): re-introduce warnings for a
+ lame-duck. [ruby-core:46836] [Bug #6809]
+
+Tue Oct 30 02:20:10 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * thread.c: added Thread#thread_variable_(get|set),
+ Thread#thread_variable?, and Thread#thread_variables for operating
+ on variables that are local to threads. [ruby-core:47790]
+
+ * vm.c: ditto
+
+ * test/ruby/test_thread.rb: tests for thread variables.
+
+Mon Oct 29 18:22:58 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/stringio/stringio.c (strio_close): close separately per each
+ instances, as well as IO.
+
+Mon Oct 29 10:22:00 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/handlers/recorder.rb: added a class for
+ recording YAML parse and emit events.
+
+ * ext/psych/lib/psych/handler.rb: adding a list of events so that
+ handler classes can more easily be meta-programmed.
+
+ * test/psych/handlers/test_recorder.rb: tests for the change.
+
+Mon Oct 29 05:48:52 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * lib/ostruct.rb: Add [] and []=, base on a patch by Thomas Sawyer.
+ Also accept {Open}Struct as argument to new.
+ Add #eql?, #hash & #each_pair
+ Protect new_ostruct_member
+
+Mon Oct 29 03:20:58 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * lib/matrix.rb: Fix determinant_e [ruby-dev:46305] [Bug #7228]
+
+Sun Oct 28 23:52:25 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * test/rexml/test_document.rb: Add tests for parsing XML encoded
+ by UTF-8 with BOM.
+
+Sun Oct 28 23:47:09 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rexml/source.rb: Move encoding detection code to base class.
+ * lib/rexml/encoding.rb: Remove needless encoding detection code.
+
+Sun Oct 28 21:40:13 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rexml/parsers/baseparser.rb: Fix a bug that UTF-8 is used
+ for UTF-16XX encoded XML that doesn't have encoding="UTF-16" in
+ XML declaration.
+ * test/rexml/test_document.rb: Add tests for the above change.
+
+Sun Oct 28 21:37:34 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * test/rexml/test_document.rb: Group tests that they parse
+ UTF-16XX encoded XML that has encoding="UTF-16" in XML declaration.
+
+Sun Oct 28 21:25:11 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rexml/source.rb (REXML::IOSource#initialize): Reduce
+ @line_break initialize code. It should be done only in #encoding=.
+ * lib/rexml/parsers/baseparser.rb: Don't set UTF-16 encoding to
+ source by encoding="UTF-16" in XML declaration because UTF-16XX
+ source encoding should be set in Source#initialize or
+ IOSource#initialize. They should handle BOM. Parser should not
+ consider about it.
+
+Sun Oct 28 21:18:37 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * test/rexml/test_document.rb: Add tests for parsing XML encoded
+ by UTF-16 with BOM.
+
+Sun Oct 28 19:12:11 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_parse.c (iso8601_{ext,bas}_time): should not match
+ empty string.
+
+Sun Oct 28 18:51:33 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_parse.c (date__parse): revised the tight parser.
+
+Sun Oct 28 15:41:50 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rexml/document.rb (REXML::Document#write): Add :encoding option
+ to support custom XML encoding.
+ [Feature #4872] (work in progress)
+ * test/rexml/test_document.rb: Add tests for the above change.
+
+Sun Oct 28 15:00:19 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rexml/document.rb (REXML::Document#write): Remove needless
+ indent in document.
+
+Sun Oct 28 14:59:14 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rexml/document.rb (REXML::Document#write): Accept options
+ Hash as argument.
+ * test/rexml/test_document.rb: Add tests for the above change.
+
+Sun Oct 28 14:09:44 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rexml/document.rb (REXML::Document#write): Fix wrong usage
+ in document.
+
+Sun Oct 28 14:03:48 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rexml/document.rb (REXML::Document#write): Fix wrong method
+ names in document.
+
+Sun Oct 28 10:12:15 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: `tree` should return the
+ same thing on every call.
+
+ * test/psych/visitors/test_yaml_tree.rb: related test.
+
+Sun Oct 28 10:05:03 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: YAML Tree object should
+ be able to take an emitter object as it's output.
+
+ * test/psych/visitors/test_yaml_tree.rb: related test.
+
+Sun Oct 28 08:23:16 2012 Koichi Sasada <ko1@atdot.net>
+
+ * bignum.c (bignew_1): Bignum instances are frozen.
+ Feature #3222
+
+ * include/ruby/ruby.h: Fixnum instances are also frozen.
+
+ * class.c (singleton_class_of): check Bignum before
+ singleton checking.
+
+ * test/ruby/test_bignum.rb: add a test.
+
+ * test/ruby/test_fixnum.rb: ditto.
+
+ * test/ruby/marshaltestlib.rb, test/ruby/test_eval.rb,
+ test/ruby/test_object.rb: catch up above changes.
+
+Sun Oct 28 04:38:06 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm.c (vm_define_method): remove type and frozen checking.
+ Checking is done in `rb_singleton_class()'.
+
+Sun Oct 28 00:49:06 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (assign_in_cond): warn for static content object assignments
+ in conditional statements. [ruby-dev:43083] [Feature #4299]
+
+Sat Oct 27 23:33:41 2012 Benoit Daloze <eregontp@gmail.com>
+
+ * gc.c (gc_profile_result, gc_profile_report): use internal structures
+ to avoid allocations and progressively print the output for #report.
+ [ruby-core:47163] [Bug #6865]
+
+Sat Oct 27 11:01:10 2012 Koichi Sasada <ko1@atdot.net>
+
+ * numeric.c (rb_float_new_in_heap), include/ruby/ruby.h:
+ make all Float objects frozen.
+ [ruby-dev:46081] [ruby-trunk - Feature #6936]
+ Most part of patch by NARUSE, Yui <naruse@ruby-lang.org>.
+
+ * class.c (singleton_class_of): raise TypeError when
+ trying to define a singleton method on Float objects.
+
+ * vm.c (vm_define_method): ditto.
+
+ * test/ruby/marshaltestlib.rb: catch up above changes.
+
+ * test/ruby/test_class.rb: ditto.
+
+ * test/test_pp.rb: ditto.
+
+Sat Oct 27 10:50:53 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * object.c (rb_mod_const_get): make sure the constant name is
+ converted to a string before searching. [ruby-core:48405]
+
+Sat Oct 27 10:12:13 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * iseq.c (rb_iseq_compile_with_option): Instead of testing
+ respond_to, just check if the argument is actually a file,
+ because by calling user-defined gets something weired can
+ happen. Patch by Glass_saga. [ruby-dev:40202] [Bug #2861]
+
+ * parse.y (ripper_initialize): ditto.
+
+Sat Oct 27 10:07:57 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (enum lex_state_e): [EXPERIMENTAL] lex_state as bit field /
+ IS_lex_state() macro. based on the patch by Dave B in
+ [ruby-core:23503]. [Feature #1493]
+
+Sat Oct 27 10:05:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/win32.h (fstat): use _fstati64() instead of fstati64()
+ on mingw32.
+
+Sat Oct 27 06:28:33 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * object.c (rb_mod_const_get): const_get accepts qualified constant
+ strings. e.g. Object.const_get("Foo::Bar::Baz") [ruby-core:41404]
+
+ * test/ruby/test_module.rb: tests for new behavior
+
+Fri Oct 26 13:24:20 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (literal_concat_gen): merge fixed strings across
+ concatenated literals, after an interpolation.
+
+Thu Oct 25 17:48:54 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (has_redirection): should use shell (cmd.exe) when
+ the commandline contains '&'.
+ reported by Roger Pack at [ruby-core:47912] [Bug #7143], and
+ patched by Heesob Park at [ruby-core:47931].
+
+Thu Oct 25 15:00:08 2012 Koichi Sasada <ko1@atdot.net>
+
+ * include/ruby/ruby.h, class.c: remove (revert)
+ `rb_add_method_cfunc_frameless()' API.
+ This API is not mature to become an official API.
+ For example, we can not use this API with
+ `rb_define_private_method()'.
+
+ * method.h, vm_method.c (rb_add_method_cfunc_frameless): removed.
+
+Thu Oct 25 13:35:07 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * tool/mkconfig.rb: remove string literal concatenation.
+
+Wed Oct 24 18:49:16 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/objspace/objspace.c (type2sym, count_objects_size): use enum
+ instead of size_t which may be larger than actual values.
+
+Wed Oct 24 17:41:24 2012 Koichi Sasada <ko1@atdot.net>
+
+ * benchmark/driver.rb: add `-x' or `--exclude' option
+ to specify exclude benchmark name pattern.
+ You can specify "-x foo" if you want to exclude the benchmarks
+ if the name of benchmark contains `foo'.
+
+Wed Oct 24 11:57:24 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c (gc_prepare_free_objects): rename to match the behavior of
+ this function.
+
+Wed Oct 24 11:55:19 2012 Koichi Sasada <ko1@atdot.net>
+
+ * ext/objspace/objspace.c (reachable_object_from_i): change data
+ structure of the result of reachable objects. Keys of table
+ contains object_id of each reachable objects. Value of table
+ is an object itself or an instance of InternalObjectWrapper.
+ To avoid duplication, we use st_table and object_id keys.
+
+ * ext/objspace/objspace.c (type2sym): bug fix.
+ Should use `i' instead of `type'.
+
+Wed Oct 24 10:33:09 2012 Koichi Sasada <ko1@atdot.net>
+
+ * gc.c (garbage_collect, gc_marks): move the location of
+ clear and restore rb_objspace_t::mark_func_data
+ from garbage_collect() to gc_marks().
+
+Wed Oct 24 10:17:45 2012 Koichi Sasada <ko1@atdot.net>
+
+ * ext/objspace/objspace.c (Init_objspace): add a new method
+ `ObjectSpace::InternalObjectWrapper#internal_object_id' which returns
+ an object id of a wrapped internal object.
+
+Wed Oct 24 08:55:04 2012 Koichi Sasada <ko1@atdot.net>
+
+ * ext/objspace/objspace.c (ObjectSpace.reachable_objects_from):
+ internal object support.
+ If given object `obj' has references to internal objects
+ (such as T_NODE objects), then this method returns instances of
+ `ObjectSpace::InternalObjectWrapper' instead of that internal objects.
+ This instance contains a reference to an internal object and you can
+ check the type of internal object using
+ `ObjectSpace::InternalObjectWrapper#type' method.
+ Rdoc of `InternalObjectWrapper' is not prepared yet.
+
+ * gc.c (rb_objspace_reachable_objects_from), gc.h: change
+ an interface of 'rb_objspace_reachable_objects_from()'
+
+ * gc.c, gc.h: add two APIs
+ - rb_objspace_markable_object_p(obj): check markable or not.
+ - rb_objspace_internal_object_p(obj): check internal or not.
+
+Wed Oct 24 05:52:36 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_insnhelper.c (vm_call_method): remove `default' and
+ add a case for `VM_METHOD_TYPE_UNDEF'.
+
+Wed Oct 24 05:41:18 2012 Koichi Sasada <ko1@atdot.net>
+
+ * eval_error.c (error_print), vm_eval.c (eval_string_with_cref),
+ vm_trace.c (rb_suppress_tracing): use TH_PUSH_TAG() instead of
+ PUSH_TAG().
+
+Wed Oct 24 05:17:52 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_eval.c (vm_call0_body): remove RUBY_VM_CHECK_INTS()
+ after method invocation using rb_call0().
+
+ * vm_eval.c (vm_call0_body): remove default section on top of
+ switch statement and add cases for `VM_METHOD_TYPE_CFUNC_FRAMELESS'
+ and `VM_METHOD_TYPE_UNDEF'.
+
+ * vm_eval.c (vm_call0_body): remove useless brackets.
+
+Tue Oct 23 22:34:49 2012 Koichi Sasada <ko1@atdot.net>
+
+ * thread.c (thread_raise_m): check interrupts after Thread#raise
+ if a target thread is the current thread because the behavior
+ of Thread.current.raise is expected to perform same as
+ Kernel.raise (by rubyspec).
+
+Tue Oct 23 17:08:39 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ruby.c (usage, process_options): show more info in --help.
+ [EXPERIMENTAL] [ruby-core:48072] [Bug #7184]
+
+Tue Oct 23 14:20:43 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * misc/ruby-electric.el using variable `last-command-event' instead of
+ obsolete `last-command-char', so that work with Emacs trunk.
+ a patch by Victor Deryagin <vderyagin AT gmail.com>.
+
+Tue Oct 23 14:06:47 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (visibility_option): visibility attribute is not
+ available before GCC 4, so do not use -fvisibility option in that
+ case. [ruby-core:48147] [Bug #7205]
+
+Tue Oct 23 12:57:29 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_core.h, vm_insnhelper.c, vm_eval.c (OPT_CALL_CFUNC_WITHOUT_FRAME):
+ add a new optimization and its macro `OPT_CALL_CFUNC_WITHOUT_FRAME'.
+ This optimization makes all cfunc method calls `frameless', which
+ is faster than ordinal cfunc method call.
+ If `frame' is needed (for example, it calls another method with
+ `rb_funcall()'), then build a frame. In other words, this
+ optimization delays frame building.
+ However, to delay the frame building, we need additional overheads:
+ (1) Store the last call information.
+ (2) Check the delayed frame building before the frame is needed.
+ (3) Overhead to build a delayed frame.
+ rb_thread_t::passed_ci is storage of delayed cfunc call information.
+ (1) is lightweight because it is only 1 assignment to `passed_ci'.
+ To achieve (2), we modify GET_THREAD() to check `passed_ci' every
+ time. It causes 10% overhead on my environment.
+ This optimization only works for cfunc methods which do not need
+ their `frame'.
+ After evaluation on my environment, this optimization does not
+ effective every time. Because of this evaluation results, this
+ optimization is disabled at default.
+
+ * vm_insnhelper.c, vm.c: add VM_PROFILE* macros to measure behaviour
+ of VM internals. I will extend this feature.
+
+ * vm_method.c, method.h: change parameters of the `invoker' function.
+ Receive `func' pointer as the first parameter.
+
+Tue Oct 23 06:21:05 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/parser.c: just get the constant defined in Ruby.
+
+ * ext/psych/lib/psych/syntax_error.rb: Psych::SyntaxError now inherits
+ from StandardError rather than SyntaxError. Thanks Eric Hodel!
+
+ * test/psych/test_exception.rb: tests for change.
+
+Tue Oct 23 06:17:36 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/scalar_scanner.rb: Cache symbols while
+ tokenizing. Thanks Kevin Menard!
+
+Tue Oct 23 06:15:40 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/scalar_scanner.rb: Updated the RegExp to catch
+ Strings earlier in the tokenization process. Thanks Kevin Menard!
+
+Tue Oct 23 06:12:39 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/to_ruby.rb: Handle nil tags specially
+ to avoid slow method_missing calls. Thanks Kevin Menard!
+
+Tue Oct 23 06:07:57 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/scalar_scanner.rb: Ignore bad timestamps. If
+ something looks like a timestamp but has an invalid component, treat
+ it as a string instead of throwing an ArgumentError.
+ Thanks Rhett Sutphin!
+
+ * test/psych/test_scalar_scanner.rb: appropriate tests.
+
+Tue Oct 23 06:04:07 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/scalar_scanner.rb: Fix scalar_scanner to
+ understand strings starting with an underscore and containing only
+ digits. Thanks Kelley Reynolds.
+
+ * test/psych/test_scalar_scanner.rb: test for fix
+
+Tue Oct 23 06:00:41 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych.rb: Changed comment in psych.rb to update new
+ home page for libyaml. Thanks to Carolyn Ann.
+
+Sun Oct 21 19:12:59 2012 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * vm_core.h (rb_vm_t::trace_running): add a new field
+ `trace_running' to store vm global tracing status.
+
+ * vm_trace.c: fix SEGV bug. event_hook was free'd
+ even when the hook is still used in another thread.
+ [ruby-dev:46141] [Bug #7032]
+
+Sun Oct 21 19:12:42 2012 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * vm_core.h (rb_vm_t::trace_flag): remove `trace_flag'
+ which is no longer used.
+
+Sun Oct 21 18:34:27 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_parse.c (date__parse): uses more tight parser if
+ defined TIGHT_PARSER. now inactivated; because it introduces
+ incompatibilities and it is a bit slow.
+
+Sat Oct 20 15:35:06 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * include/ruby/ruby.h: add C APIs.
+ VALUE rb_newobj_of(VALUE klass, VALUE flags)
+ #define NEWOBJ_OF(obj,type,klass,flags)
+ These allow to change a allocation strategy depending on klass
+ or flags.
+
+ * gc.c: ditto
+
+ * array.c: use new C API.
+ * bignum.c: ditto
+ * class.c: ditto
+ * complex.c: ditto
+ * ext/socket/ancdata.c: ditto
+ * ext/socket/option.c: ditto
+ * hash.c: ditto
+ * io.c: ditto
+ * marshal.c: ditto
+ * numeric.c: ditto
+ * object.c: ditto
+ * random.c: ditto
+ * range.c: ditto
+ * rational.c: ditto
+ * re.c: ditto
+ * string.c: ditto
+ * struct.c: ditto
+ [Feature #7177][Feature #7047]
+
+Sat Oct 20 12:50:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * ext/socket/socket.c: Documentation for Socket
+ Based on a patch by David Albert
+ [Bug #7105] [ruby-core:47828]
+
+Sat Oct 20 11:00:00 2012 Zachary Scott <zachary@zacharyscott.net>
+
+ * lib/open-uri.rb: Documentation for OpenURI
+
+Sat Oct 20 06:18:34 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * hash.c (initialize_copy): unset the default proc if there isn't one
+ for the target hash, call to_hash, check frozen status.
+
+Fri Oct 19 22:22:01 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm.c (rb_vm_jump_tag_but_local_jump): pass through thrown objects.
+ [ruby-dev:46234] [Bug #7185]
+
+ * vm_eval.c (rb_eval_cmd): if state is non-zero, val should be nil and
+ rb_vm_jump_tag_but_local_jump() just jump tag.
+
+Fri Oct 19 22:11:55 2012 Benoit Daloze <eregontp@gmail.com>
+
+ * pack.c (pack_unpack): set encoding of the
+ 'H','h','B' and 'B' modifiers to US-ASCII.
+
+ * test/ruby/test_pack.rb: tests for the above.
+ [ruby-core:47653][Bug #7050]
+
+ * test/test_securerandom.rb: tests for SecureRandom.hex
+ from tenderlove. [ruby-core:46792][Bug #6799]
+
+Fri Oct 19 19:29:11 2012 Koichi Sasada <ko1@atdot.net>
+
+ * method.h (rb_method_cfunc_t::invoker): add new field (func ptr)
+ `invoker'. `invoker' function invoke cfunc body
+ (rb_method_cfunc_t::func).
+ `invoker' is set at method definition timing.
+ With this change, the big `switch' (branch) in `call_cfunc()'
+ is no longer needed.
+ However, the performance benefit is only a bit.
+
+ * vm_core.h (rb_call_info_t::aux::func): add a new field to store
+ cfunc body function pointer.
+
+ * vm_method.c (call_cfunc_invoker_func): add a new function which
+ returns a suitable invoke function.
+
+ * vm_method.c (setup_method_cfunc_struct): added.
+
+ * vm_method.c (rb_add_method): fix to set `invoker'.
+
+ * vm_eval.c (vm_call0_body): catch up above changes.
+
+ * vm_insnhelper.c (call_cfunc): removed.
+
+ * vm_insnhelper.c (vm_call_cfunc): fix to call cfunc body
+ with `invoker' function.
+
+Fri Oct 19 16:55:58 2012 Koichi Sasada <ko1@atdot.net>
+
+ * eval.c, vm_eval.c: use TH_PUSH_TAG() instead of PUSH_TAG().
+
+Fri Oct 19 11:13:55 2012 Koichi Sasada <ko1@atdot.net>
+
+ * benchmark/driver.rb: remove unexpected `output'.
+ (commit miss)
+
+Fri Oct 19 10:24:03 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_insnhelper.c (vm_search_method): remove needless local variable.
+
+Fri Oct 19 10:22:26 2012 Koichi Sasada <ko1@atdot.net>
+
+ * benchmark/bmx_temp.rb: removed.
+ This file should not be in repository.
+
+Fri Oct 19 10:20:10 2012 Koichi Sasada <ko1@atdot.net>
+
+ * benchmark/driver.rb: add new option `--ruby-arg [ARG]'
+ which is passed as a launch parameter for each ruby's execution.
+ ($ ruby [ARG] [File])
+
+Thu Oct 18 18:42:35 2012 Koichi Sasada <ko1@atdot.net>
+
+ * insns.def (opt_send_simple): move the location of
+ `opt_send_simple' to the place near `send' definition.
+ (to take care about icache locality).
+
+Thu Oct 18 18:29:25 2012 Koichi Sasada <ko1@atdot.net>
+
+ * insns.def (send): remove unused condition.
+ This condition will be true after r37258.
+
+ * vm_insnhelper.c (vm_caller_setup_args): remove `UNLIKELY' on
+ checking blockiseq (it seems `LIKELY').
+
+Thu Oct 18 17:31:58 2012 Koichi Sasada <ko1@atdot.net>
+
+ * insns.def (opt_send_simple): introduce new instruction used
+ when no need to care about block and splat.
+
+ * compile.c: use the `opt_send_simple' instruction.
+
+Thu Oct 18 16:44:07 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_method.c (rb_add_method_cfunc, rb_add_method_cfunc_frameless):
+ check arity earlier at definition time.
+
+Thu Oct 18 15:11:31 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_insnhelper.c: add `inline' keyword to several functions.
+ Compilers (gcc) are conservative than I expected.
+
+Thu Oct 18 15:01:15 2012 Koichi Sasada <ko1@atdot.net>
+
+ * include/ruby/ruby.h: add a decl. of
+ `rb_define_frameless_method()'.
+
+Thu Oct 18 14:31:17 2012 Koichi Sasada <ko1@atdot.net>
+
+ * compile.c (new_callinfo): set a temporary index of callinfo
+ (used in `iseq_set_sequence()') to rb_call_info_t::aux::index.
+ rb_call_info_t::argc is initialized by same value of
+ rb_call_info_t::orig_argc.
+
+Thu Oct 18 14:11:08 2012 Koichi Sasada <ko1@atdot.net>
+
+ * class.c (rb_define_frameless_method): rename from
+ rb_define_method_fast(). Defined method with this C API
+ does not make a method frame. It is bit lightweight than
+ ordinal C functions. Now only 0 or 1 argc are permitted.
+
+ * method.h (VM_METHOD_TYPE_CFUNC_FRAMELESS): rename macro name
+ from VM_METHOD_TYPE_CFUNC_FAST.
+
+ * vm_insnhelper.c, vm_method.c: rename related functions.
+
+ * proc.c (rb_method_entry_arity): catch up above changes.
+
+Thu Oct 18 10:30:34 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (assignable_gen): fail if yyerror occurred. fix a bug in
+ r36973.
+
+Thu Oct 18 09:23:03 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * hash.c (initialize_copy): duping should rehash the hash.
+
+ * test/ruby/test_hash.rb: added a test to ensure rehash.
+
+Wed Oct 17 21:16:47 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * common.mk (WPROGRAM): need same dependencies as PROGRAM.
+
+ * cygwin/GNUmakefile.in (uncommon.mk): move include position
+ below WPROGRAM definition to be defined in uncommon.mk.
+
+ * ext/extmk.rb (all, static): fix make rubyw.exe failure with make -jN.
+ If make of ruby.exe and rubyw.exe run in parallel, link dll and link
+ exe run in parallel, which causes link failure on mingw. To fix this,
+ we make ruby.exe and rubyw.exe in one make process.
+ [ruby-core:48007] [Bug #7165]
+
+Wed Oct 17 16:25:34 2012 Koichi Sasada <ko1@atdot.net>
+
+ * benchmark/bm_vm2_method_missing.rb: add a benchmark to measure
+ performance of invoking `method_missing'.
+
+Wed Oct 17 16:23:17 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_insnhelper.c (vm_getivar): fix to use `aux.index' instead of
+ `aux.opt_pc'.
+
+Wed Oct 17 16:03:54 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_insnhelper.c (vm_call_method_missing): make a refactoring
+ about method_missing process. Use `vm_call_method()' to invoke
+ `method_missing' method instead of `rb_funcall2()'.
+ In `vm_call_method()', set fastpath to `vm_call_method_missing()'
+ if it can be cached.
+
+ * vm_core.h (rb_call_info_t): add new field
+ `rb_call_info_t::aux::missing_reason' to pass the reason to
+ `vm_call_method_missing()'.
+
+Wed Oct 17 15:33:12 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (opt-dir): allow multiple directories separated by
+ $PATH_SEPARATOR as well as dir_config in mkmf.rb. [ruby-core:47868]
+ [Bug #7120]
+
+Wed Oct 17 15:08:13 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb: fix Net::IMAP::ResponseParser to accept
+ message/delivery-status ([ruby-core:47920] [Bug #7146]),
+ message/rfc822 attachments ([ruby-core:47921] [Bug #7147]), and
+ (BODY ("MIXED")) ([ruby-core:47951] [Bug #7153]).
+ patched by Tony Arkles.
+
+ * test/net/imap/test_imap_response_parser.rb: related test.
+
+Wed Oct 17 11:04:48 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_hash.rb (TestHash#test_dup_equality): added a new test
+ to show the problem of r37232.
+
+Wed Oct 17 10:48:40 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_search_method): fix a build error that occurs
+ when OPT_INLINE_METHOD_CACHE is 0.
+
+Wed Oct 17 08:46:47 2012 Koichi Sasada <ko1@atdot.net>
+
+ * benchmark/bm_vm2_dstr.rb: add a benchmark to measure
+ performance of dynamic generated string ("foo#{bar}baz").
+
+Wed Oct 17 08:32:46 2012 Koichi Sasada <ko1@atdot.net>
+
+ * compile.c (compile_dstr_fragments): use `putobject' instead of
+ `putstring' for all of strings used by NODE_DSTR because
+ ruby users can not grab this string.
+ For example, the string object of "baz" in "foo#{bar}baz"
+ is located by `putobject' (users can not touch "baz" object
+ directly). This change reduces GC pressure.
+ This improvement is suggested by Aaron Patterson.
+
+Wed Oct 17 08:02:57 2012 Koichi Sasada <ko1@atdot.net>
+
+ * thread.c (rb_threadptr_interrupt_mask): fix to check interrupt
+ after interrupt_mask changed.
+
+Wed Oct 17 06:42:47 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_insnhelper.c (vm_call_method): fix to return value immediately.
+ Remove CHECK_INTS() after that method dispatch.
+
+Wed Oct 17 06:25:56 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * hash.c (initialize_copy): copy the underlying st_table on dup,
+ rather than copying the hash key by key. [ruby-core:48009]
+
+ * test/ruby/test_hash.rb: relevant tests for initialize_copy
+
+Wed Oct 17 06:17:44 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_insnhelper.c (vm_call_iseq_setup_2): separate tailcall and normal
+ method frame setup functions.
+ Add checking interrupts at the tailcall setup function.
+
+Wed Oct 17 05:35:37 2012 Koichi Sasada <ko1@atdot.net>
+
+ * benchmark/bm_vm1_yield.rb: add a benchmark to measure `yield'
+ (invoke empty block) performance.
+
+ * benchmark/bm_vm2_method_with_block.rb: add a benchmark to measure
+ method invocation with empty block.
+
+Wed Oct 17 05:05:07 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_insnhelper.c (vm_invoke_block): vm_caller_setup_args() can skip
+ when splat flag is not set.
+
+Wed Oct 17 01:53:47 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_insnhelper.c (vm_getivar, vm_setivar): support index inline cache
+ with rb_call_info_t to speedup `attr' getter and setter.
+ Cached index is stored in rb_call_info_t::aux::index.
+ `index' == 0 means not cached. `index' > 0 means cached and cached
+ index is `index - 1'.
+
+ * insns.def ((get|set)instancevariable): use new wrapper functions
+ vm_(get|set)instancevariable() defined in vm_insnhelper.c.
+
+ * vm_core.h (rb_call_info_t::aux): introduce new union data because
+ opt_pc can share with index.
+
+Tue Oct 16 22:24:44 2012 Koichi Sasada <ko1@atdot.net>
+
+ * benchmark/driver.rb (show_results): Show speedup ratio
+ with first executables score at last of results
+ if two or more executables are given.
+
+Tue Oct 16 21:59:01 2012 Koichi Sasada <ko1@atdot.net>
+
+ * benchmark/driver.rb: some refactoring.
+ (1) Remove `average differential'.
+ In this benchmark driver, We should not care about `average'.
+ We use fastest score because this score should not include
+ any disturbances (affections of background process, etc).
+ If you care about timing affect, I recommend `median'
+ score with more than 5 examinations rather than simple
+ `average' score (`average' score was affected by error scores).
+ (2) Show log file name.
+ (3) Change default directory from './' to driver's directory.
+
+Tue Oct 16 14:56:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (rb_file_join): need to check again after any conversion run.
+ [ruby-core:48012] [Bug #7168]
+
+Tue Oct 16 12:52:14 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * test/ruby/envutil.rb (Test::Unit::Assertions#assert_file):
+ rename from file_assertion.
+
+Tue Oct 16 11:30:18 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (rb_file_join): hide the result under construction until
+ return.
+
+ * file.c (rb_file_join): check nul-byte only for strings, since
+ FilePathStringValue() does it. [ruby-core:48012] [Bug #7168]
+
+ * file.c (rb_file_join): path names must be ASCII-compatible.
+ [ruby-core:48012] [Bug #7168]
+
+ * file.c (check_path_encoding): new function to ensure path name
+ encoding to be ASCII-compatible.
+
+Tue Oct 16 09:40:04 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_regexp.rb
+ (TextRegexp#test_raw_hyphen_and_tk_char_type_after_range): use
+ Regexp.new instead of literal to ignore a parser warning.
+
+Tue Oct 16 09:30:30 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_regexp.rb
+ (TextRegexp#test_raw_hyphen_and_tk_char_type_after_range): ignoring
+ warnings are already set in setup method.
+
+Tue Oct 16 06:44:06 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_insnhelper.c (VM_CALLEE_SETUP_ARG): fix wrong condition.
+
+Tue Oct 16 06:29:18 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_insnhelper.c (vm_call_method): disable CI_SET_FASTPATH() if
+ this method call needs splat argument because cached functions
+ (vm_call_attrset, vm_call_ivar, vm_call_cfunc_fast_(unary|binary))
+ do not check an arity.
+
+ * bootstraptest/test_method.rb: add a test to check an above issue.
+
+Tue Oct 16 06:15:44 2012 Koichi Sasada <ko1@atdot.net>
+
+ * method.h: introduce new method type VM_METHOD_TYPE_CFUNC_FAST.
+ This method is similar to VM_METHOD_TYPE_CFUNC methods, but
+ called cfunc without building new frame (does not push new control
+ frame). If error is occurred in cfunc, the backtrace only shows
+ caller frame and upper.
+ This kind of methods can be added by rb_define_method_fast().
+ This feature is similar to specialized instructions (opt_plus, etc),
+ but more flexible (but a bit slower).
+
+ * class.c (rb_define_method_fast): added.
+ Maybe it will be renamed soon.
+
+ * vm_insnhelper.c (vm_call_method): support method type
+ VM_METHOD_TYPE_CFUNC_FAST.
+
+ * proc.c (rb_method_entry_arity): catch up new method type.
+
+ * vm_method.c (rb_add_method_cfunc_fast): added.
+
+Tue Oct 16 02:32:29 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_insnhelper.h (CI_SET_FASTPATH): add new parameter `enabled'.
+ If `enable' is 0 then CI_SET_FASTPATH() doesn't work.
+ And add new configuration option OPT_CALL_FASTPATH. If this macro
+ was defined by 0, then CI_SET_FASTPATH() doesn't work any more.
+
+ * vm_insnhelper.c (vm_call_method): Pass `0' for `enabled' parameter
+ of CI_SET_FASTPATH if this method is protected.
+
+Tue Oct 16 02:17:35 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_core.h (VM_CALL_*): rename VM_CALL_*_BIT
+ to VM_CALL_* (remove `_BIT' suffix).
+ Add comments on each macros.
+ Remove unused macro VM_CALL_TAILRECURSION_BIT.
+
+ * compile.c, iseq.c, insns.def, vm_insnhelper.c: ditto.
+
+Mon Oct 15 22:14:44 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/ruby/envutil.rb (Test::Unit::Assertions#file_assertion):
+ rewrite file assertions.
+
+Mon Oct 15 09:41:17 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_insnhelper.c (VM_CALLEE_SETUP_ARG): skip CI_SET_FASTPATH() if
+ it was called from vm_yield_setup_args().
+
+Mon Oct 15 05:20:13 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_insnhelper.h CI_SET_FASTPATH: introduce new macro
+ `CI_SET_FASTPATH(ci, func)'. This macro set `ci->call' as `func'.
+ `func' (ci->call) is called at the last of `send'
+ (and `invokesuper') instruction.
+ `CI_SET_FASTPATH' does not set `ci->call' when the method
+ (stored in `ci->me') is `protected'.
+
+ * vm_insnhelper.c (vm_call_method): use `CI_SET_FASTPATH'.
+ After several checking (visibility, argc checking), the result of
+ checking can be reused until re-definition of this method
+ with inline method cache.
+
+ Note that this optimization is now experimental.
+ If you find any problem about it, please tell us.
+
+Mon Oct 15 04:51:55 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_insnhelper.c: refactoring.
+ - move all `call' related functions to the last of file.
+ - make functions for respective method types in vm_call_method().
+ (all functions have same function parameters)
+
+ * vm_core.h: add `opt_pc' field in `rb_call_info_t'
+ as temporal variable.
+
+ * vm_eval.c (vm_call0_body): catch up above changes.
+
+Mon Oct 15 03:51:46 2012 Koichi Sasada <ko1@atdot.net>
+
+ * benchmark/bm_vm1_attr_ivar(_set).rb: added (for method dispatch speed).
+
+ * benchmark/bm_vm1_float_simple.rb: added (for flonum/float).
+
+Mon Oct 15 02:51:16 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_eval.c (vm_call0_body): add new function.
+ `vm_call0()' makes call_info struct and calls `vm_call0_body()'
+ with this struct. In near future, `vm_call0()' will be removed
+ because all of `vm_call0()' users setup call_info struct by itself.
+
+Mon Oct 15 01:38:06 2012 Koichi Sasada <ko1@atdot.net>
+
+ * insns.def (send, invokesuper, invokeblock, opt_*), vm_core.h:
+ use only a `ci' (rb_call_info_t) parameter instead of using
+ parameters such as `op_id', 'op_argc', `blockiseq' and flag.
+ These information are stored in rb_call_info_t at the compile
+ time.
+ This technique simplifies parameter passing at related
+ function calls (~10% speedups for simple method invocation at
+ my machine).
+ `rb_call_info_t' also has new function pointer variable `call'.
+ This `call' variable enables to customize method (block)
+ invocation process for each place. However, it always call
+ `vm_call_general()' at this changes.
+ `rb_call_info_t' also has temporary variables for method
+ (block) invocation.
+
+ * vm_core.h, compile.c, insns.def: introduce VM_CALL_ARGS_SKIP_SETUP
+ VM_CALL macro. This flag indicates that this call can skip
+ caller_setup (block arg and splat arg).
+
+ * compile.c: catch up above changes.
+
+ * iseq.c: catch up above changes (especially for TS_CALLINFO).
+
+ * tool/instruction.rb: catch up above changes.
+
+ * vm_insnhelper.c, vm_insnhelper.h: ditto. Macros and functions
+ parameters are changed.
+
+ * vm_eval.c (vm_call0): ditto (it will be rewritten soon).
+
+Sun Oct 14 12:30:44 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ruby.c (rb_f_sub, rb_f_gsub): pass the given block.
+ [ruby-core:47967] [Bug #7157]
+
+Sat Oct 13 23:15:39 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * regparse.c (parse_char_class): should match with a hyphen after a
+ range in a character class.
+
+ * test/ruby/test_regexp.rb (TestRegexp#test_char_class): fixed wrong
+ test.
+
+ * test/ruby/test_regexp.rb (TestRegexp#check): now can accept the
+ error message.
+
+ * test/ruby/test_regexp.rb
+ (TextRegexp#test_raw_hyphen_and_tk_char_type_after_range): renamed
+ because the previous name was wrong.
+
+ * test/ruby/test_regexp.rb
+ (TextRegexp#test_raw_hyphen_and_tk_char_type_after_range): added
+ more test pattern.
+
+Sat Oct 13 03:01:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (realpath_rec): prevent link from GC while link_names refers
+ the content.
+
+Sat Oct 13 01:37:48 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_regexp.rb
+ (TestRegexp#test_raw_hyphen_and_type_char_after_range): added new
+ test. ref [ruby-core:47115] [Backport #6853]
+
+Fri Oct 12 21:55:08 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * include/ruby/win32.h (rb_w32_pow): set floating point precision
+ for mingw-w64 x86 pow(). This improves the precision of pow() on
+ Windows XP for TestFloat#test_round_with_precision failure.
+ [ruby-core:47911] [Bug #7142]
+
+Fri Oct 12 21:37:25 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * test/webrick/test_cgi.rb (TestWEBrickCGI#test_cgi): skip a test
+ depending on locale on Windows. ENV[] doesn't work properly if
+ console code page is not equal to file system encoding.
+ [ruby-core:47910] [Bug #7140]
+
+Fri Oct 12 20:40:29 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (posix_sh_cmds): the command name of colon is ":".
+
+Fri Oct 12 18:18:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (rb_get_path_check): path name must not contain NUL bytes.
+
+Fri Oct 12 16:06:20 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * tool/merger.rb: now can merge revision(s) without --ticket again.
+
+Fri Oct 12 14:10:41 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (dir_config, init_mkmf): use configured libdir value as
+ default library path. [ruby-core:43726] [Bug #6207]
+
+Fri Oct 12 05:25:00 2012 Zachary Scott <zzak@ruby-lang.org>
+
+ * lib/timeout.rb (timeout):
+ Remove paragraph on wrong implementation detail.
+ [ruby-core:47739] [Bug #7088]
+
+Thu Oct 11 23:09:46 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (rb_str_sub{seq,pos,str}, rb_str_each_{line,codepoint}):
+ prevent String copies from GC. [ruby-core:47881] [Bug #7135]
+
+Thu Oct 11 07:40:50 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * iseq.c (insn_operand_intern): cast op to rb_call_info_t* before
+ compare with iseq->callinfo_entries whose type is rb_call_info_t*.
+
+Thu Oct 11 03:37:08 2012 Koichi Sasada <ko1@atdot.net>
+
+ * bootstraptest/test_block.rb: add tests for block with super.
+
+Thu Oct 11 02:54:07 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_dump.c: fix debug prints to catch up recent changes
+ such as VM data structures.
+
+Thu Oct 11 02:50:34 2012 Koichi Sasada <ko1@atdot.net>
+
+ * iseq.c (insn_operand_intern): add support disasm TS_CALLINFO
+ operands.
+
+Wed Oct 10 15:12:48 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_process.rb (TestProcess#test_execopts_gid): skip on
+ windows because the platform does not have Process.group method.
+ patched by Jon Forums in [ruby-core:47878] [Bug #7133].
+
+Tue Oct 9 23:18:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/ruby/envutil.rb (assert_file, assert_file_not): more
+ descriptive assertions for File predicates.
+
+Tue Oct 9 18:01:37 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (rb_ary_sample): use rb_random_ulong_limited, since
+ precision of long may be larger than double.
+
+ * random.c (rb_random_ulong_limited): new function to return a random
+ value from 0 upto limit as unsigned long, similarly to
+ rb_genrand_ulong_limited but with arbitrary RNG object.
+
+Tue Oct 9 17:13:27 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * process.c (rb_execarg_addopt, rb_execarg_run_options): add :uid and
+ :gid options. [ruby-core:47414] [Feature #6975]
+
+Tue Oct 9 14:36:11 2012 Koichi Sasada <ko1@atdot.net>
+
+ * iseq.c (iseq_free): fix memory leak.
+ rb_iseq_t::callinfo_entries should be freed.
+
+Tue Oct 9 14:28:18 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_core.h (rb_call_info_t): add new type `rb_call_info_t'.
+ This data structure contains information including inline method
+ cache. After that, `struct iseq_inline_cache_entry' does not
+ need to contain inline cache for method invocation.
+ Other information will be added to this data structure.
+
+ * vm_core.h (rb_iseq_t): add `callinfo_entries' and `callinfo_size'
+ members to `rb_iseq_t'.
+
+ * insns.def, compile.c: Use CALL_INFO instead of IC.
+
+ * tool/instruction.rb: support CALL_INFO as operand type.
+
+ * vm_insnhelper.c, vm_insnhelper.h: ditto.
+
+Sun Oct 7 23:54:33 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+
+ * ext/zlib/zlib.c (zstream_run_func): don't call inflate() when
+ z->stream.avail_in == 0. it return Z_BUF_ERROR.
+ but deflate() could be called with z->stream->avail_in == 0 because
+ it has hidden buffer in z->stream->state (opaque structure).
+ fix for gem install error. [ruby-dev:46149] [Bug #7040]
+
+Mon Oct 8 23:55:41 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * eval.c (rb_mod_refinements): new method Module#refinements.
+
+ * test/ruby/test_refinement.rb: add new tests for the above changes.
+
+Mon Oct 8 23:02:19 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * eval.c, gc.c, iseq.c, node.h, vm_insnhelper.c, vm_insnhelper.h,
+ vm_method.c: rename omod and overlaid modules to refinements.
+
+ * eval.c (hidden_identity_hash_new): renamed from identity_hash_new.
+
+Sun Oct 7 04:50:00 2012 Zachary Scott <zzak@ruby-lang.org>
+
+ * lib/abbrev.rb: Documentation examples for Abbrev.
+ [ruby-core:47442] [Bug #6985]
+
+Sun Oct 7 04:50:00 2012 Zachary Scott <zzak@ruby-lang.org>
+
+ * thread.c (rb_thread_aref):
+ Grammar in Thread documentation.
+ Patch by Steve Klabnik [ruby-core:47799] [Bug #7099]
+
+Sun Oct 7 04:37:00 2012 Zachary Scott <zzak@ruby-lang.org>
+
+ * string.c (rb_str_match):
+ Clarify behavior for captured strings and local variable assignment
+ Patch by Marcus Stollsteimer [ruby-core:47668] [Bug #7062]
+
+Sat Oct 6 18:31:36 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * vm_opts.h (OPT_GLOBAL_METHOD_CACHE): new build option to
+ enable/disable global method caching. [ruby-dev:46203] [Bug #7111]
+
+ * vm_method.c (rb_method_entry_get_with_omod): don't use global
+ method cache if OPT_GLOBAL_METHOD_CACHE is 0.
+
+Sat Oct 6 16:32:04 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * vm_method.c (search_method): check omod only once for performance.
+
+Sat Oct 6 09:42:04 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * enc/encdb.c, enc/utf_16_32.h (ENC_DUMMY_UNICODE): endian-less wide
+ UTF encodings are dummy but Unicode.
+
+ * encoding.c (rb_encdb_set_unicode): set Unicode flag.
+
+ * template/encdb.h.tmpl: allow ENC_DUMMY variants.
+
+ * encoding.c (rb_enc_unicode_p): oniguruma provides Unicode flag.
+
+Fri Oct 5 17:18:42 JST 2012 TAKANO Mitsuhiro <tak@no32.tk>
+
+ * template/Doxyfile.tmpl: remove SHOW_DIRECTORIES and
+ HTML_ALIGN_MEMBERS lines. They have been obsolete in
+ Doxygen version 1.8.2.
+
+Fri Oct 5 15:26:18 2012 Koichi Sasada <ko1@atdot.net>
+
+ * ext/objspace/objspace.c: add ObjectSpace#reachable_objects_from.
+ This method returns an array of objects referenced by given object.
+ If given object is special objects such as true/false/nil/Fixnum etc
+ then it returns nil. See rdoc for details.
+ [ruby-core:39772]
+
+ * test/objspace/test_objspace.rb: add a test for this method.
+
+ * gc.c: add rb_objspace_reachable_objects_from().
+ To make this function, add several member `mark_func_data'
+ to rb_objspace_t. If mark_func_data is not null, then
+ gc_mark() calls mark_func_data::mark_func.
+
+ * gc.h: export rb_objspace_reachable_objects_from().
+
+Thu Oct 4 23:40:04 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c (init_heap): call init_mark_stack before to allocate
+ altstack. This change avoid the stack overflow at the signal
+ handler on 32bit, but I don't understand reason... [Feature #7095]
+
+Thu Oct 4 22:39:27 2012 Koichi Sasada <ko1@atdot.net>
+
+ * insns.def (getlocal, setlocal): remove old getlocal/setlocal
+ instructions and rename getdaynmic/setdynamic instructions
+ to getlocal/setlocal.
+
+ * compile.c: ditto.
+
+ * iseq.c: remove TS_DINDEX.
+
+ * vm_exec.h (dindex_t): remove type definition of `dindex_t'.
+
+ * tool/instruction.rb: ditto.
+
+Thu Oct 4 21:44:17 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm.c (vm_analysis_insn|operand|register): use st_insert
+ instead of using rb_hash_aset() because rb_hash_aset()
+ check $SAFE.
+
+Thu Oct 4 21:15:26 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm.c (VM_COLLECT_USAGE_DETAILS): make new VM usage analysis
+ hooks (old macro name is COLLECT_USAGE_ANALYSIS).
+ This feature is only for VM developers. (I'm not sure I can use
+ `VM developers' (the plural form) in this sentence).
+ If VM_COLLECT_USAGE_DETAILS is not 0, VM enables the following
+ usage collection features:
+ (1) instruction: collect instruction usages.
+ (2) operand: collect operand usages.
+ (3) register: collect register usages.
+ The results are stored in
+ RubyVM::USAGE_ANALYSIS_INSN for (1, 2),
+ RubyVM::USAGE_ANALYSIS_INSN_BIGRAM for (1) and
+ RubyVM::USAGE_ANALYSIS_REGS for (3).
+ You can stop collecting usages with
+ RubyVM::USAGE_ANALYSIS_INSN_STOP(),
+ RubyVM::USAGE_ANALYSIS_OPERAND_STOP(),
+ RubyVM::USAGE_ANALYSIS_REGISTER_STOP()
+ for (1), (2), (3) respectively.
+ You can also change the hook functions by setting
+ C level global variables
+ `ruby_vm_collect_usage_func_(insn|operand|register)'
+ for (1), (2), (3) respectively.
+ See codes for more details.
+
+ * tool/instruction.rb: fix macro names.
+
+ * iseq.c (insn_operand_intern): make it export (used in vm.c).
+ fix to skip several processes if not needed (pointer is 0).
+
+ * vm_dump.c: move codes for collection features to vm.c.
+
+ * vm_exec.h: rename macro and function names.
+
+ * vm_insnhelper.h: ditto.
+
+Thu Oct 4 18:59:14 2012 Koichi Sasada <ko1@atdot.net>
+
+ * test/ruby/test_settracefunc.rb (test_tracepoint):
+ remove unused test case.
+ (this test case is redefined by newer tests)
+
+Thu Oct 4 17:24:51 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c (rb_objspace_call_finalizer): call gc_mark_stacked_objects
+ at suitable point.
+
+Thu Oct 4 16:31:29 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * gc.c (rb_objspace_call_finalizer): mark self-referencing finalizers
+ before run finalizers, to fix SEGV from btest on 32bit.
+
+ * gc.c (gc_mark_stacked_objects): extract from gc_marks().
+
+Thu Oct 4 11:43:28 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread_pthread.c (ruby_init_stack): round stack limit to page size
+ boundary to calculate stack size more precisely. [ruby-dev:46174]
+ [Bug #7084]
+
+Wed Oct 3 19:51:57 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c: Use the non-recursive marking instead of recursion. The
+ recursion marking of CRuby needs checking stack overflow and the
+ fail-safe system, but these systems not good at partial points,
+ for example, marking deep tree structures. [ruby-dev:46184]
+ [Feature #7095]
+
+ * configure.in (GC_MARK_STACKFRAME_WORD): removed. It's used by
+ checking stack overflow of marking.
+
+ * win32/Makefile.sub (GC_MARK_STACKFRAME_WORD): ditto.
+
+Wed Oct 3 15:33:02 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread_pthread.c (ruby_init_stack): use getrlimit() for the main
+ thread on Mac OS X, since pthread_get_stack{addr,size}_np()
+ return the default value always, but not the ulimit value.
+ [ruby-dev:46174] [Bug #7084]
+
+Wed Oct 3 11:43:15 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (rb_io_reopen): improvement to accept optional arguments.
+ a patch by Glass_saga (Masaki Matsushita) in [ruby-core:47806].
+ [Feature #7103]
+
+Wed Oct 3 04:36:11 2012 Eric Hodel <drbrain@segment7.net>
+
+ * ext/openssl/ossl_x509store.c (ossl_x509store_add_file): Added
+ documentation
+ * ext/openssl/ossl_x509store.c (ossl_x509store_set_default_paths):
+ ditto
+ * ext/openssl/ossl_x509store.c (ossl_x509store_add_cert): ditto
+
+Wed Oct 3 02:23:37 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * error.c (exc_to_s, name_err_to_s, name_err_mesg_to_str): do not
+ taint messages.
+
+Tue Oct 2 16:47:06 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (identity_hash_new): hide internal hashes for refinements.
+
+ * eval.c (rb_mod_refine): no default value.
+
+Mon Oct 1 22:54:02 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * eval.c (identity_hash_new): new function to create a new identity
+ hash.
+
+ * eval.c (rb_overlay_module, rb_mod_using, rb_mod_refine): use
+ identity_hash_new().
+
+Mon Oct 1 02:34:53 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * configure.in (--with-opt-dir): Make this also work on DLDFLAGS
+ so LIBRUBY_SO links fine with libexecinfo installed in a
+ non-system directory.
+
+Sun Sep 30 23:32:00 2012 Kenta Murata <mrkn@mrkn.jp>
+
+ * vm_dump.c (rb_vm_bugreport): add /Library/Logs/DiagnosticReports
+ in the list of locations of crash reports.
+
+Sun Sep 30 21:18:03 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * string.c (rb_str_concat): use memcpy to copy a string which contains
+ NUL characters. [ruby-core:47751] [Bug #7090]
+
+Sat Sep 29 19:41:53 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * test/ruby/envutil.rb (EnvUtil#invoke_ruby): kill child process
+ before Timeout::Error is raised. rmdir of mktmpdir fails with
+ EACCES if child process is alive on Windows.
+
+ * test/thread/test_queue.rb (TestQueue): increase timeout.
+ This test takes long time on Windows XP.
+
+Sat Sep 29 19:41:33 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * test/net/http/test_http.rb (TestNetHTTP#test_proxy_address):
+ clear environment variables. If http_proxy environment variable was
+ set, the test failed.
+
+ * test/net/http/test_http.rb (TestNetHTTP#test_proxy_port): ditto.
+
+Sat Sep 29 19:41:11 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * test/drb/drbtest.rb (DRbCore#teardown):
+ Use Process.kill :KILL on Windows because Process.kill :INT silently
+ fails on Windows 7 and raises EINVAL on Windows XP for spawned
+ process with new_pgroup: false.
+
+ * test/drb/drbtest.rb (DRbAry#teardown): ditto.
+
+Sat Sep 29 19:40:32 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * test/ruby/test_unicode_escape.rb (TestUnicodeEscape#test_basic):
+ set script encoding to work with LANG=C. It would work on both
+ Windows and Unix. Refix of r37051.
+
+Sat Sep 29 11:21:06 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * vm_insnhelper.c (rb_vm_using_modules): use using_modules before
+ klass to fix method lookup order, and use klass even if klass is
+ not a module to make refinements in class_eval invoked on classes
+ work.
+
+ * eval.c (rb_using_module): accept a class as the second argument.
+
+ * eval.c (rb_mod_using, f_using): raise a TypeError if the argument
+ is not a module.
+
+ * test/ruby/test_refinement.rb: add new tests for the above changes.
+
+Sat Sep 29 02:18:57 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * test/ruby/test_unicode_escape.rb (TestUnicodeEscape#test_basic):
+ Use ruby only on Windows since the test fails on Unix with LANG=C.
+ [ruby-core:47709] [Bug #7076]
+
+Fri Sep 28 22:19:31 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * test/ruby/test_unicode_escape.rb (TestUnicodeEscape#test_basic):
+ echo command doesn't work properly against non-ascii character on
+ Windows with chcp 437. Instead we use ruby.
+ [ruby-core:47709] [Bug #7076]
+
+Fri Sep 28 17:54:31 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_insnhelper.c (vm_setup_method): refactoring.
+ Remove src_argc and use iseq->arg_size directly.
+
+Fri Sep 28 17:26:27 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/rubygems/installer.rb (check_that_user_bin_dir_is_in_path):
+ test_generate_bin_bindir_with_user_install_warning(TestGemInstaller)
+ fails on Windows with msys bash. It makes comparing paths
+ case-insensitive.
+ pick from upstream to fix a failure of test-all [ruby-core:47711]
+ https://github.com/rubygems/rubygems/commit/c474edb2f3704206f04da1c8c6cf9fb079d84abe
+
+Fri Sep 28 15:44:45 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * vm_method.c (search_method): copy refinement iclasses to search
+ superclasses correctly.
+
+ * test/ruby/test_refinement.rb: related test.
+
+Fri Sep 28 15:15:41 2012 Koichi Sasada <ko1@atdot.net>
+
+ * insns.def (opt_checkenv): remove unused instruction `opt_checkenv'.
+
+ * compile.c (iseq_compile_each): ditto.
+
+ * node.h: remove unused node `NODE_OPTBLOCK'.
+
+ * ext/objspace/objspace.c, gc.c (gc_mark_children): ditto.
+
+Fri Sep 28 13:14:34 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_core.h: now VM_DEBUG_BP_CHECK should be 1.
+
+Fri Sep 28 12:51:54 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_core.h: remove rb_control_frame_t::bp (bp: base pointer).
+ `bp' can be calculate by `sp' (stack pointer) of previous frame.
+ Now, `bp_check' field is remained for debug. You can eliminate
+ this field by setting VM_DEBUG_BP_CHECK as 0.
+
+ * vm_insnhelper.c (vm_base_ptr): add `vm_base_ptr(cfp).
+ This function calculates base pointer from cfp.
+
+ * vm_insnhelper.c (vm_setup_method): push `recv' value on top of
+ value stack (before method parameters).
+ This change is for keeping consistency with normal method dispatch.
+
+ * insns.def: fix to use vm_base_ptr().
+
+ * vm.c (vm_exec): ditto.
+
+ * vm_dump.c: remove `bp' related dumps.
+
+ * cont.c (fiber_init): fix to check VM_DEBUG_BP_CHECK.
+
+Fri Sep 28 10:40:51 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (rb_io_reopen): accept File::Constants as well as mode string.
+ based on the patch by Glass_saga (Masaki Matsushita) in
+ [ruby-core:47694]. [Feature #7067]
+
+Thu Sep 27 18:36:51 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * eval.c (rb_overlay_module, rb_mod_refine): accept a module as the
+ argument of Module#refine.
+
+ * vm_method.c (search_method): if klass is an iclass, lookup the
+ original module of the iclass in omod in order to allow
+ refinements of modules.
+
+ * test/ruby/test_refinement.rb: add tests for the above changes.
+
+Thu Sep 27 18:12:20 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/syslog/lib/syslog/logger.rb: add a formatter to the
+ Syslog::Logger object. [Bug #7065]
+ * test/syslog/test_syslog_logger.rb: ditto.
+
+Wed Sep 26 16:39:57 2012 Koichi Sasada <ko1@atdot.net>
+
+ * insns.def: add new instruction `opt_empty_p' for optimize `empty?'
+ method. Apply a patch proposed at [ruby-dev:46120]
+ [ruby-trunk - Feature #6972] by Glass_saga (Masaki Matsushita).
+
+ * compile.c (iseq_specialized_instruction), vm.c, vm_insnhelper.h:
+ ditto.
+
+ * id.c, template/id.h.tmpl: ditto.
+
+ * test/ruby/test_optimization.rb: test for this changes.
+
+Tue Sep 25 09:59:26 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * insns.def (invokesuper): klass in cfp is not valid in at_exit and
+ END blocks. [ruby-core:47680] [Bug #7064]
+
+Tue Sep 25 08:11:11 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * iseq.c (rb_iseq_defined_string): the index of defined_strings must
+ be the value of type - 1.
+
+Mon Sep 24 17:36:51 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * compile.c (defined_expr), insns.def (defined): share single frozen
+ strings. [EXPERIMENTAL] [ruby-core:47558][Feature #7035]
+
+ * iseq.c (rb_iseq_defined_string): make expression strings.
+
+Mon Sep 24 11:22:36 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * tool/merger.rb: add --ticket option to add ticket number.
+
+Sun Sep 23 21:51:59 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (String#unspace): unescape with backslashes. normal
+ makes need to escape spaces with backslashes. nmake is not the
+ case. [Bug #7036]
+
+ * lib/mkmf.rb (create_makefile): use timestamp file dependencies for
+ directories.
+
+ * lib/mkmf.rb: unexpand macros.
+
+ * lib/mkmf.rb (LIBPATHFLAG): no needs to escape library path here.
+
+ * lib/mkmf.rb (MakeMakefile#configuration): make prefix paths
+ internal to deal with in Makefile.
+
+ * lib/mkmf.rb (MakeMakefile#mkintpath): not a global function now.
+
+Sun Sep 23 02:33:37 2012 Benoit Daloze <eregontp@gmail.com>
+
+ * complex.c: Fix examples of r36993.
+ Keep the simple definition, mathematics define the result.
+ Based on patch by Robin Dupret. Fixes #188 on github.
+
+Sat Sep 22 07:15:00 2012 Zachary Scott <zzak@ruby-lang.org>
+
+ * ext/ripper/lib/ripper.rb:
+ Match sample output to Ripper.sexp from current trunk version.
+ [Bug #6929]
+
+Thu Sep 20 23:05:11 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c (native_cond_initialize): destroy condattr
+ after using it. Patch by Stanislav Sedov. Thank you.
+ [Bug #7041] [ruby-core:47619]
+
+Thu Sep 20 22:53:02 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c (native_cond_initialize): clean up #ifdef condition.
+
+Thu Sep 20 16:42:44 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/drb/ssl.rb (DRb::DRbSSLSocket::SSLConfig::DEFAULT): add
+ SSLTmpDhCallback for configuration option.
+
+ * lib/drb/ssl.rb (setup_ssl_context): copy the value of tmp_dh_callback.
+
+ * test/drb/ut_array_drbssl.rb: set tmp_dh_callback to suppress warning.
+
+ * test/drb/ut_drb_drbssl.rb: ditto.
+
+Thu Sep 20 10:56:08 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/drb/ut_drb.rb: revert a part of r36987, and get rid of a warning
+ with another method. if the substitution is removed, the ExtSrv
+ object will be GC'ed and some tests will be blocked.
+
+Thu Sep 20 07:20:00 2012 Zachary Scott <zzak@ruby-lang.org>
+
+ * complex.c: Examples for Complex Documentation.
+ Patch by Robin Dupret.
+ Fixes #184 on github.
+
+Thu Sep 20 07:15:00 2012 Zachary Scott <zzak@ruby-lang.org>
+
+ * ext/ripper/lib/ripper.rb: Documentation for Ripper.
+ +:void_stmt+ is meaningless
+ [Bug #6929] [ruby-core:47507]
+
+Thu Sep 20 07:05:00 2012 Zachary Scott <zzak@ruby-lang.org>
+
+ * lib/csv.rb (Object#CSV, Array#to_csv, String#parse_csv):
+ Examples and documentation for CSV.
+ [Bug #6880] [ruby-core:47218]
+
+Thu Sep 20 00:42:20 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (take_items), enum.c (enum_zip): raise TypeError at
+ non-enumerable objects, not NoMethodError. [ruby-dev:46145]
+ [Bug #7038]
+
+ * vm_eval.c (rb_check_block_call): check_funcall variant with block
+ function.
+
+Tue Sep 18 17:51:29 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/openssl/ossl_ssl.c (ossl_sslctx_attrs): add npn_select_db to
+ suppress warning: instance variable @npn_select_cb not initialized
+
+Sun Sep 16 17:47:00 2012 Eric Hodel <drbrain@segment7.net>
+
+ * tool/change_maker.rb: Update svn detection for subversion 1.7's
+ single .svn directory.
+
+Sun Sep 16 11:39:12 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (io_set_read_length): if the read length equals to the buffer
+ string size then nothing to do. or ensure the string modifiable
+ before setting the length only when the former is shorter. based on
+ the patch in [ruby-core:47541] by Hiroshi Shirosaki.
+ [ruby-core:46586] [Bug #6764]
+
+Sun Sep 16 08:57:52 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (strict_warnflags): separate strict flags from
+ warnflags only for core. [ruby-dev:46105]
+
+Sun Sep 16 08:16:05 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * .editorconfig: add. [ruby-core:47548] [Feature #7030]
+
+Sat Sep 15 01:56:40 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/nkf/nkf-utf8/nkf.c: Merge upstream: 50a383c84.
+ [ruby-dev:46128] [Bug #7005]
+
+Sat Sep 15 00:20:04 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/nkf/nkf.c (rb_nkf_convert): suppress warning.
+
+Fri Sep 14 04:05:00 2012 Zachary Scott <zzak@ruby-lang.org>
+
+ * array.c (rb_ary_diff, rb_ary_uniq):
+ Enhance documentation for array uniqueness
+ Based on a patch by Robin Dupret
+ [Bug #6872] [ruby-core:47209]
+
+Fri Sep 14 03:30:00 2012 Zachary Scott <zzak@ruby-lang.org>
+
+ * array.c (rb_ary_select):
+ Update documentation for Array#select
+ * enum.c (enum_find_all, enum_reject):
+ Update documentation for Enumerable#find_all and Enumerable#reject
+ Based on a patch by Jeff Saracco
+ [Bug #6908] [ruby-core:47285] [Fixes #166 on github]
+
+Fri Sep 14 00:20:00 2012 Zachary Scott <zzak@ruby-lang.org>
+
+ * signal.c (rb_f_kill):
+ Update documentation for Process.kill to reflect kill(2)
+ Patch by Richo Healey
+
+Thu Sep 13 21:40:49 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * lib/securerandom.rb (SecureRandom.random_bytes):
+ Use 64bit value as pointer for Windows x64 to fix SystemCallError.
+
+ * lib/securerandom.rb (SecureRandom.lastWin32ErrorMessage):
+ Set proper encoding to avoid invalid byte sequence error.
+ [ruby-core:47451] [Bug #6990]
+
+Thu Sep 13 11:20:00 2012 Zachary Scott <zzak@ruby-lang.org>
+
+ * lib/optparse.rb: Remove unreachable email address from documentation
+ [Bug #6996] [ruby-core:47459]
+
+Thu Sep 13 11:20:00 2012 Zachary Scott <zzak@ruby-lang.org>
+
+ * lib/xmlrpc.rb: Documentation for XMLRPC
+ * lib/xmlrpc/datetime.rb: ditto.
+ * lib/xmlrpc/parser.rb: ditto.
+ * lib/xmlrpc/client.rb: ditto.
+ * lib/xmlrpc/utils.rb: ditto.
+ * lib/xmlrpc/README.rdoc: ditto.
+ * lib/xmlrpc/create.rb: ditto.
+ * lib/xmlrpc/base64.rb: ditto.
+ * lib/xmlrpc/config.rb: ditto.
+ * lib/xmlrpc/httpserver.rb: ditto.
+ * lib/xmlrpc/server.rb: ditto.
+ * lib/xmlrpc/marshal.rb: ditto.
+ * lib/xmlrpc/README.txt: ditto.
+ [Bug #6909] [ruby-core:47286]
+
+Thu Sep 13 10:22:11 2012 Takashi Toyoshima <toyoshim@gmail.com>
+
+ * configure.in: Don't use PIE on Haiku because loader support is not
+ enough.
+
+Thu Sep 13 08:20:00 2012 Zachary Scott <zzak@ruby-lang.org>
+
+ * lib/shellwords.rb: Documentation for Shellwords.
+
+Thu Sep 13 08:00:00 2012 Zachary Scott <zzak@ruby-lang.org>
+
+ * ext/ripper/lib/ripper.rb: Documentation for Ripper.
+ * ext/ripper/lib/ripper/lexer.rb: ditto.
+ * ext/ripper/lib/ripper/sexp.rb: ditto.
+ * ext/ripper/lib/ripper/filter.rb: ditto.
+ * ext/ripper/lib/ripper/core.rb: ditto.
+ [Bug #6929] [ruby-core:47309]
+
+Wed Sep 12 22:59:07 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_method_missing, vm_call_method): reuse arguments
+ on the VM stack and get rid of ALLOCA.
+
+Wed Sep 12 22:45::00 2012 Zachary Scott <zzak@ruby-lang.org>
+
+ * ext/pathname/lib/pathname.rb: Documentation for Pathname.
+ * ext/pathname/pathname.c: ditto.
+ [Bug #6947] [ruby-core:47354]
+
+Mon Sep 10 10:19:34 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * enc/depend: fixed wrong change in a part of r34802.
+
+Sun Sep 9 22:02:50 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * ext/socket/basicsocket.c (rsock_bsock_send):
+ avoid unnecessary select() calls before doing I/O
+ Patch by Eric Wong. [Feature #4538] [ruby-core:35586]
+ * ext/socket/init.c (rsock_s_recvfrom): ditto.
+ * ext/socket/init.c (rsock_s_accept): ditto.
+ * ext/socket/udpsocket.c (udp_send): ditto.
+ * io.c (io_fflush): ditto.
+ * io.c (io_binwrite): ditto.
+ * io.c (rb_io_syswrite): ditto.
+
+Mon Sep 10 01:38:51 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (nogvl_close, maygvl_close, nogvl_fclose, maygvl_fclose):
+ suppress integer <-> pointer cast warnings.
+ [Feature #4570] [ruby-core:35711]
+
+Mon Sep 10 01:36:00 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (rb_io_close): notify fd close before releasing gvl.
+ * io.c (fptr_finalize): modify fptr->mode before releasing gvl.
+ remove unnecessary rb_thread_fd_close().
+ [Feature #4570] [ruby-core:35711]
+
+Mon Sep 10 00:16:34 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * process.c: exec() requires to be single threaded also on Haiku.
+ by Takashi Toyoshima <toyoshim@gmail.com>
+ https://github.com/ruby/ruby/pull/178
+
+Sun Sep 9 21:21:15 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * lib/thread.rb (Queue#pop): Fixed double registration issue when
+ mutex.sleep is interrupted. [Bug #5258] [ruby-dev:44448]
+ * lib/thread.rb (SizedQueue#push): ditto.
+
+ * test/thread/test_queue.rb (test_sized_queue_and_wakeup,
+ test_queue_pop_interrupt, test_sized_queue_pop_interrupt,
+ test_sized_queue_push_interrupt): new tests.
+
+Sun Sep 9 20:20:31 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * lib/sync.rb (Sync_m#sync_lock): Fixed wakeup/raise unsafe code.
+ Patched by Masaki Matsushita. [Bug #5355] [ruby-dev:44521]
+
+ * test/thread/test_sync.rb (test_sync_lock_and_wakeup,
+ test_sync_upgrade_and_wakeup, test_sync_lock_and_raise):
+ new test.
+
+Sun Sep 9 18:39:46 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * include/ruby/intern.h (rb_thread_blocking_region): Added
+ a comment of recommended alternative way.
+
+Sun Sep 9 18:37:05 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * lib/sync.rb (Sync_m): Removed RCS_ID.
+
+Sun Sep 9 18:21:03 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_io.rb (test_advise_pipe): new test to check
+ io.advise() against anonymous io object don't make crash.
+ made by Eric Wong. [Bug #6081] [ruby-core:42880]
+
+Sun Sep 9 16:47:12 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (nogvl_close, maygvl_close, nogvl_fclose, maygvl_fclose):
+ new functions.
+ * io.c (fptr_finalize): release GVL if possible.
+ Patched by Eric Wong. [Feature #4570] [ruby-core:35711]
+
+Sun Sep 9 16:08:48 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (io_bufread): removed unnecessary rb_thread_wait_fd().
+ Patch by Eric Wong. [Bug #6629] [ruby-core:45789]
+ * io.c (rb_io_sysread): ditto.
+ * io.c (copy_stream_fallback_body): ditto.
+
+Sun Sep 9 15:21:52 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_mutex_lock): stop multiple threads use
+ pthread_cond_timedwait() concurrently. [Bug #6278] [ruby-core:44275]
+
+Sat Sep 8 18:52:22 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * internal.h (struct rb_classext_struct): move allocator function into
+ rb_classext_t from ordinary method table. [ruby-dev:46121]
+ [Feature #6993]
+
+ * object.c (rb_obj_alloc): call allocator function directly.
+
+ * vm_method.c (rb_define_alloc_func, rb_undef_alloc_func)
+ (rb_get_alloc_func): use allocator function in rb_classext_t.
+
+Fri Sep 7 01:21:51 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/extmk.rb (extmake), lib/mkmf.rb (have_framework): fix splitting
+ options with an argument, not using NUL as special character.
+ [ruby-core:47447] [Bug #6987]
+
+Thu Sep 6 14:49:49 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * .gdbinit (rp): FLONUM support.
+
+ * include/ruby/ruby.h (ruby_special_consts): define FLONUM constants
+ always, so that they are available from gdb.
+
+ * include/ruby/ruby.h (RB_FLOAT_TYPE_P): merge FLONUM and non-FLONUM
+ versions. inline TYPE() comparison and FLONUM_P() should be
+ optimized away on non-FLONUM.
+
+Thu Sep 6 08:20:55 2012 Ryan Davis <ryand-ruby@zenspider.com>
+
+ * lib/minitest/*: Imported minitest 3.4.0 (r7762)
+ * test/minitest/*: ditto
+
+Wed Sep 5 19:20:53 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * parse.y (rb_warn4S): renamed from rb_warn4(), because the case in
+ r36911 takes a string.
+
+ * parse.y (rb_warn4S): use ripper_warnS() for ripper.
+
+ * parse.y (ripper_warnS): now it is used.
+
+Wed Sep 5 15:51:52 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * .travis.yml (notifications): [experimental] update notification
+ template.
+
+Wed Sep 5 15:21:12 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * parse.y (rb_warn4): added as a rb_warn variant to warn with explicit
+ source file name and line in parse.y.
+
+ * parse.y (warn_unused_var): use rb_warn4 to suppress warning on ripper.
+
+Wed Sep 5 13:30:04 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dir.c (glob_make_pattern): names under recursive need to be single
+ basenames to match for each name. [ruby-core:47418] [Bug #6977]
+
+Tue Sep 4 20:55:17 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * test/ruby/envutil.rb (EnvUtil#invoke_ruby): show Timeout::Error
+ instead of IOError if the timeout has expired.
+
+ * test/test_pstore.rb
+ (PStoreTest#test_pstore_files_are_accessed_as_binary_files):
+ increase timeout because this test is slow on Windows.
+ [ruby-core:47402] [Bug #6965]
+
+Tue Sep 4 11:28:57 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * vm_eval.c (ruby_eval_string_from_file_protect): initializer
+ element is not computable at load time.
+
+Tue Sep 4 07:48:35 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * test/openssl/test_asn1_rb:
+ test/openssl/test_ssl_session.rb:
+ test/openssl/test_x509name.rb:
+ test/openssl/test_buffering.rb:
+ test/openssl/test_x509cert.rb:
+ test/openssl/test_ssl.rb: Refactor code that leads to warnings on
+ Ruby CI.
+
+Tue Sep 4 07:02:56 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * test/openssl/utils.rb: Use DSS1 as DSA signature digest for all
+ OpenSSL versions < 1.0.0.
+ [Feature #6946] [ruby-core:47405]
+
+Mon Sep 3 21:22:37 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/ruby.h (rb_float_value): suppress warnings.
+ [ruby-core:47406][Bug #6971]
+
+Mon Sep 3 14:49:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/matrix.rb (Vector#magnitude): accumulate squares of absolute
+ values to fix for complex vector. [ruby-dev:46100] [Bug #6966]
+
+Mon Sep 3 10:09:36 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/extconf.rb: Detect OpenSSL_FIPS macro
+ ext/openssl/ossl.c: Expose OpenSSL::OPENSSL_FIPS constant to
+ indicate whether OpenSSL runs in FIPS mode.
+ test/openssl/test_pkey_dh.rb: Generate 256 bit keys for
+ non-FIPS installations to improve test performance (e.g. for
+ rubyci).
+ test/openssl/utils.rb: Replace DSS1 as certificate signature
+ digest with SHA1 for FIPS installations when using DSA by
+ introducing TestUtils::DSA_SIGNATURE_DIGEST.
+ test/openssl/test_x509cert.rb:
+ test/openssl/test_x509crl.rb:
+ test/openssl/test_x509req.rb: Use DSA_SIGNATURE_DIGEST
+ NEWS: Introduce OpenSSL::OPENSSL_FIPS
+
+ These changes allow running the OpenSSL tests in FIPS mode
+ while keeping a high performance for non-FIPS installations.
+ Introduction of OpenSSL::OPENSSL_FIPS allows for applications
+ to react to special requirements when using OpenSSL in FIPS mode.
+ [Feature #6946] [ruby-core:47345]
+
+Sun Sep 2 21:46:28 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * test/openssl/utils.rb: Use a cached DH key instead of generating a
+ new one each time.
+
+Sun Sep 2 05:41:28 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/webrick/ssl.rb (WEBrick::Config::SSL): add new key
+ SSLTmpDhCallback to set SSLContext#tmp_dh_callback.
+
+ * lib/webrick/ssl.rb (WEBrick::GenericServer#setup_ssl_context):
+ follow above.
+
+Sat Sep 1 18:50:50 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/set.rb (#initialize_copy, #eql): Use instance_variable_get
+ instead of instance_eval.
+
+Fri Aug 31 21:47:56 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/test/unit/test-unit.gemspec: Make test/unit default gem.
+ [Feature #6875] [ruby-dev:46051]
+
+Fri Aug 31 18:35:02 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/extconf.rb: Check existence of OPENSSL_NPN_NEGOTIATED.
+ ext/ossl_ssl.c: Support Next Protocol Negotiation. Protocols to be
+ advertised by the server can be set in the SSLContext by using
+ SSLContext#npn_protocols=, protocol selection on the client is
+ supported by providing a selection callback with
+ SSLContext#npn_select_cb. The protocol that was finally negotiated
+ is available through SSL#npn_protocol.
+ test/openssl/test_ssl.rb: Add tests for Next Protocol Negotiation.
+ NEWS: add news about NPN support.
+ [Feature #6503] [ruby-core:45272]
+
+Fri Aug 31 17:38:43 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/set.rb (Set#{each,reject!,select!}, SortedSet#each): Pass
+ the original block through instead of creating one that only
+ yields the passed argument.
+
+Fri Aug 31 16:23:20 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/ipaddr.rb: Introduce several new error classes where only
+ ArgumentError and StandardError were used. IPAddr::Error is
+ their common ancestor class that inherits from ArgumentError for
+ backward compatibility. Submitted by Jon Daniel. Fixes #173 on
+ GitHub.
+
+Fri Aug 31 14:51:27 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/bigdecimal/test_bigdecimal.rb (TestBigDecimal#test_to_f): added
+ for previous commit.
+
+Fri Aug 31 14:32:05 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_to_f): use self's sign to
+ determine 0.0 and Inf's sign instead of internal double value's.
+ Reported by phasis68 (Heesob Park) at [ruby-core:47381] [Bug #6955]
+
+Fri Aug 31 14:31:17 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * template/id.h.tmpl, tool/id2token.rb: make id.h independent from
+ parse.h, and make parse.c dependent on it instead.
+
+Fri Aug 31 14:27:39 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (create_makefile): fix race conditions at install-ext.
+ target files need to depend on destination directory timestamp
+ files, not phony targets.
+
+Fri Aug 31 14:03:45 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_trace.c (clean_hooks): do not access freed memory.
+
+ * vm_trace.c (rb_threadptr_exec_event_hooks): fix uninitialized state
+ when no events is executed.
+
+Thu Aug 30 18:21:51 2012 Tanaka Akira <akr@fsij.org>
+
+ * io.c (rb_io_close): call rb_last_status_clear.
+
+Thu Aug 30 16:17:52 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_to_f): check underflow since
+ strtod() sets errno to ERANGE at underflow too. [ruby-core:47342]
+ [Bug #6944]
+
+Thu Aug 30 12:44:43 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/set.rb (Set#{<,>,<=,>=}): Define comparison operators as
+ shorthand for the {proper_}{subset?,superset?} methods (finally).
+ Given a push by Alexander E. Fischer.
+
+Thu Aug 30 09:21:01 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/uri/ftp.rb (URI::FTP#initialize): raise InvalidURIError if "//"
+ is not present [ruby-core:47344] [Bug #6945]
+
+Thu Aug 30 07:45:12 2012 Luis Lavena <luislavena@gmail.com>
+
+ * test/ruby/test_file_exhaustive.rb: fix test introduced in r36811 for
+ posix environments where HOME is not defined. [ruby-core:47322]
+
+Wed Aug 29 23:42:59 2012 Tanaka Akira <akr@fsij.org>
+
+ * internal.h (rb_last_status_clear): declared.
+
+ * process.c (rb_last_status_clear): exported.
+ (rb_f_system): call rb_last_status_clear.
+
+ * io.c (rb_f_backquote): call rb_last_status_clear.
+
+Wed Aug 29 22:01:15 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_f_system): check failures of waitpid.
+ [ruby-talk:398687]
+
+Wed Aug 29 15:03:04 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (LIBDIR_BASENAME): use configured libdir value to fix
+ --enable-load-relative on systems where libdir is not default value,
+ overridden in config.site files. [ruby-core:47267] [Bug #6903]
+
+ * ruby.c (ruby_init_loadpath_safe): ditto.
+
+Wed Aug 29 14:34:41 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * addr2line.c: SIZE_MAX is defined in stdint.h, so r36755 breaks
+ 32bit FreeBSD. [ruby-core:47360] [Bug #6948]
+
+Wed Aug 29 04:50:04 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * test/openssl/utils.rb
+ test/openssl/test_pair.rb
+ test/openssl/test_pkey_dh.rb: Use 1024 bit DH parameters to satisfy
+ OpenSSL FIPS requirements. Patch by Vit Ondruch.
+ [Bug #6938] [ruby-core:47326]
+
+Tue Aug 28 22:31:49 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+
+ * insns.def (checkmatch): suppress warnings. [ruby-core:47339]
+ [Bug #6930]
+
+Tue Aug 28 20:03:54 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * configure.in: Fixing Haiku R1/alpha3 build with gcc-4.4.4.
+ - omit ANSI standard flags to compile socket extension where
+ anonymous union is required.
+ - remove redundant -be flags.
+ by Takashi Toyoshima <toyoshim@gmail.com>
+ https://github.com/ruby/ruby/pull/168
+
+Tue Aug 28 11:32:37 2012 Yuki Yugui Sonoda <yugui@google.com>
+
+ * nacl/GNUmakefile.in (.rbconfig.time): r36828 was incomplete.
+ It did not run correctly on clean build.
+
+Tue Aug 28 09:25:20 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/Makefile.sub (Makefile): make to depend on common.mk, to
+ stop and force to re-run make process when common.mk is changed.
+
+Mon Aug 27 20:19:49 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * test/etc/test_etc.rb (TestEtc#test_getgrgid): fix for non unique GID.
+ No unixen systems guarantee that GID is unique. Etc.getgrgid would
+ not return the first entry in the order of Etc.group for shared GID.
+ [ruby-core:47312] [Bug #6935]
+
+Mon Aug 27 18:19:36 2012 Koichi Sasada <ko1@atdot.net>
+
+ * include/ruby/ruby.h (rb_float_value): optimize it.
+ This technique was pointed by shinichiro.hamaji
+ <http://shinh.skr.jp/m/?date=20120825#p02>.
+
+Mon Aug 27 15:08:25 2012 Yuki Yugui Sonoda <yugui@google.com>
+
+ * common.mk (vm_trace.o): Added a missing dependency.
+
+Sun Aug 26 09:29:32 2012 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * nacl/GNUmakefile.in (package): make package should install
+ example.html for nacl build
+
+ Patch by Takashi Toyoshima <toyoshim AT gmail.com>.
+
+Sun Aug 26 09:22:33 2012 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * nacl/GNUmakefile.in (CC, LD, NM, AR, AS, RANLIB, OBJDUMP, OBJCOPY)
+ Rewrites these variables instead of PATH.
+ NaCl port uses a toolchain which is specified by NACL_SDK_ROOT
+ environment variable. Originally, NaCl build added the toolchain
+ under the NACL_SDK_ROOT to the PATH. But updating PATH doesn't work
+ on Mac.
+ (RBCONFIG): Replaces configs with the variable updates above.
+
+ * configure.in: Thus it is no longer necessary to check $PATH.
+
+ Based on a patch by Takashi Toyoshima <toyoshim AT gmail.com>.
+
+Sun Aug 26 16:53:00 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * insns.def (checkmatch): suppress warnings. [ruby-core:47310]
+ [Bug #6930]
+
+ * vm_core.h (VM_FRAME_TYPE_FINISH_P): ditto.
+
+Fri Aug 24 15:42:28 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (create_makefile): use timestamp for destination
+ directories to make them before making or copying files there.
+ [ruby-dev:46067] [Bug #6904]
+
+Fri Aug 24 12:40:15 2012 Luis Lavena <luislavena@gmail.com>
+
+ * configure.in (mingw): add shlwapi to the list of dependency
+ libs for Windows.
+ * win32/Makefile.sub (EXTSOLIBS): ditto.
+
+ * internal.h: declare internal functions rb_w32_init_file,
+ rb_file_expand_path_internal and rb_file_expand_path_fast.
+
+ * file.c (Init_File): invoke Windows initialization rb_w32_init_file
+
+ * win32/file.c (rb_file_load_path_internal): new function.
+ Windows-specific implementation that replaces file_expand_path.
+ [Bug #6836][ruby-core:46996]
+
+ * win32/file.c (rb_w32_init_file): new function. Initialize codepage
+ cache for faster conversion encodings lookup.
+
+ * file.c (file_expand_path): rename to rb_file_expand_path_internal.
+ Conditionally exclude from Windows.
+
+ * file.c (rb_file_expand_path_fast): new function. delegates to
+ rb_file_expand_path_internal without performing a hit to the
+ filesystem.
+
+ * file.c (file_expand_path_1): use rb_file_expand_path_internal without
+ path expansion (used by require).
+ * file.c (rb_find_file_ext_safe): ditto.
+ * file.c (rb_find_file_safe): ditto.
+
+ * load.c (rb_get_expanded_load_path): use rb_file_expand_path_fast.
+ * load.c (rb_feature_provided): ditto.
+
+ * file.c (rb_file_expand_path): use rb_file_expand_path_internal with
+ path expansion.
+ * file.c (rb_file_absolute_path): ditto.
+
+ * test/ruby/test_file_exhaustive.rb: new tests to exercise
+ rb_file_expand_path_internal implementation and compliance with
+ existing behaviors.
+
+Fri Aug 24 07:35:24 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/net/http/backward.rb (class Net): Restored Net::HTTPSession to
+ fix backwards-compatibility with ancient Net::HTTP. [Bug #6889]
+
+Thu Aug 23 20:58:55 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * common.mk: support `make id.h` without `rm .id.h.time` after
+ `rm id.h`.
+
+Thu Aug 23 20:48:45 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_fixnum.rb (TestFixnum#test_singleton_method): new test.
+
+ * test/ruby/test_bignum.rb (TestBignum#test_singleton_method): ditto.
+
+ * test/ruby/test_float.rb (TestFloat#test_singleton_method): ditto.
+
+ * test/ruby/test_symbol.rb (TestSymbol#test_singleton_method): ditto.
+
+Thu Aug 23 20:34:32 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * class.c (singleton_class_of): flonum can't have singleton class.
+
+ * vm.c (vm_define_method): flonum can't have singleton method.
+
+Thu Aug 23 19:18:33 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * common.mk (win32/*): macro RUBY_H_INCLUDES is not defined there,
+ so need to move dependency rules under the definition of it.
+
+Thu Aug 23 19:16:20 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/Makefile.sub: refactoring. remove unused rules, and update
+ some rules which are not used usually to fit current macros.
+
+Thu Aug 23 16:46:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (rb_find_file_ext_safe, rb_find_file_safe): default to
+ US-ASCII for encdb and transdb.
+
+ * load.c (search_required): keep encoding of feature name. set
+ loading path to filesystem encoding. [Bug #6377][ruby-core:44750]
+
+ * ruby.c (add_modules, require_libraries): assume default external
+ encoding as well as ARGV.
+
+Thu Aug 23 16:20:04 2012 Koichi Sasada <ko1@atdot.net>
+
+ * include/ruby/ruby.h: introduce flonum technique for
+ 64bit CPU environment (sizeof(double) == sizeof(VALUE)).
+ flonum technique enables to avoid double object creation
+ if the double value d is in range about between
+ 1.72723e-77 < |d| <= 1.15792e+77 or 0.0.
+ flonum Float value is immediate and their lowest two bits
+ are b10.
+ If flonum is activated, then USE_FLONUM macro is 1.
+ I'll write detailed in this technique on
+ https://bugs.ruby-lang.org/projects/ruby-trunk/wiki/Flonum_tech
+
+ * benchmark/bmx_temp.rb: add an benchmark for simple
+ Float calculation.
+
+ * gc.c (id2ref, rb_obj_id): add flonum Float support.
+
+ * include/ruby/intern.h: move decl of rb_float_new(double)
+ to include/ruby/ruby.h.
+
+ * insns.def, vm.c, vm_insnhelper.c: add flonum optimization
+ and simplify source code.
+
+ * vm_insnhelper.h (FLONUM_2_P): added.
+
+ * marshal.c: support flonum output.
+
+ * numeric.c (rb_float_new_in_heap): added.
+
+ * parse.y: support flonum.
+
+ * random.c: ditto.
+
+Thu Aug 23 16:12:40 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * lib/mkmf.rb (create_makefile): add dependency to header files when
+ depend files don't exist. now we can remove simple (and often
+ wrong) depend files in most cases.
+
+Thu Aug 23 16:02:20 2012 Koichi Sasada <ko1@atdot.net>
+
+ * ext/date/depend: add dependency to $(ruby_headers).
+
+Thu Aug 23 12:51:39 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * insns.def (invokesuper): reverted r36640 partially to make super
+ in a thread work correctly. [ruby-core:47284] [Bug #6907]
+
+ * test/ruby/test_super.rb: related test.
+
+Thu Aug 23 12:30:20 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/configure.bat: support --with(out)?-ext(ensions) options.
+
+Thu Aug 23 11:52:04 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * configure.in: Fixing Haiku build.
+ - -lbe is not required for linking
+ - stack protector doesn't work for now because of the default gcc's
+ bug
+ by Takashi Toyoshima <toyoshim@gmail.com>
+ https://github.com/ruby/ruby/pull/167
+
+ * signal.c (ruby_signal): haiku doesn't have SIGBUS.
+
+Thu Aug 23 11:32:44 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/open-uri/test_open-uri.rb (TestOpenURI#test_read_timeout): this
+ test expects that the server thread will be killed in sleep, but 0.01
+ sec is too short to reach there.
+
+Thu Aug 23 10:49:28 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * configure.in: use the value of --with-opt-dir on building ruby
+ itself. [ruby-dev:46064] [Bug #6900]
+
+Thu Aug 23 10:36:35 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * common.mk (ID_H_TARGET): revert a part of r36724 and r36751. they
+ break mswin build from clean source.
+
+Thu Aug 23 02:37:35 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/syck: removed. Fixes [ruby-core:43360]
+
+ * test/syck: removed.
+
+ * lib/yaml.rb: only require psych, show a warning if people try to set
+ the engine to syck.
+
+Thu Aug 23 01:46:53 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * insns.def: search up the cf stack for an object that is an instance
+ of the recipient class. Fixes [ruby-core:47186]
+
+ * test/ruby/test_super.rb: related test.
+
+Wed Aug 22 19:46:24 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: [ruby-core:47266].
+
+Wed Aug 22 19:41:19 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: [ruby-core:47226].
+
+Wed Aug 22 16:57:04 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (configuration): extract least ruby headers list as
+ ruby_headers, so depend files can use default dependency
+ explicitly.
+
+Wed Aug 22 15:27:50 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_insnhelper.c (vm_setup_method): fix last commit of
+ vm_insnhelper.c (r36771). [ruby-dev:46065] [Bug #6901]
+ Should not disable tail call opt on FINISH_FRAME.
+ This flag should be propagated correctly.
+
+Wed Aug 22 14:05:23 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_trace.c: support TracePoint. [ruby-trunk - Feature #6895]
+
+ * test/ruby/test_settracefunc.rb: add tests for above.
+
+ * proc.c (rb_binding_new_with_cfp): add an internal function.
+
+ * vm.c (rb_vm_control_frame_id_and_class): add an internal function.
+
+ * vm_trace.c: add rb_add_event_hook2() and rb_thread_add_event_hook2().
+ Give us the good name for them!
+
+Wed Aug 22 11:38:16 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * .travis.yml (before_script): Turned out that make -j is broken.
+
+Wed Aug 22 11:23:35 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_setup_method): should not enable tail call
+ optimization for frames with VM_FRAME_FLAG_FINISH.
+ [ruby-dev:46065] [Bug #6901]
+
+Wed Aug 22 11:20:47 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/rubygems/test_case.rb: run test with psych if exist.
+
+Thu Aug 16 12:09:51 2012 Yuki Yugui Sonoda <yugui@google.com>
+
+ * nacl/pepper_main.c (init_loadpath): Pushes the correct load path on
+ other architectures than x86_64. Fixes #6873.
+
+Wed Aug 15 19:37:33 2012 Yuki Yugui Sonoda <yugui@google.com>
+
+ * configure.in (ac_cv_func_shutdown): shutdown(2) has a dummy
+ implementation but has no declaration and does not work in
+ NativeClient SDK pepper_20.
+
+Wed Aug 15 19:29:29 2012 Yuki Yugui Sonoda <yugui@google.com>
+
+ * common.mk (vm_backtrace.o): Added missing dependencies.
+
+ * ext/nkf/depend (nkf.o): ditto.
+
+ * ext/ripper/depend (ripper.o) ditto.
+
+Wed Aug 22 07:27:00 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/cgi/util.rb (CGI.escapeHTML): use &#39;
+ [ruby-core:47221] [Bug #6861]
+
+Tue Aug 21 21:59:22 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * lib/observer.rb: fix typo. https://github.com/ruby/ruby/pull/162 by
+ unsymbol (Philip Cunningham).
+
+Tue Aug 21 20:30:06 2012 Benoit Daloze <eregontp@gmail.com>
+
+ * test/fileutils/test_fileutils.rb (TestFileUtils#teardown):
+ do not assume cwd is TMPROOT and never remove current directory.
+ [ruby-core:47224][Bug #6884]
+
+Tue Aug 21 17:29:56 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * addr2line.c (fill_lines): need check and cast of the file size of
+ target binary because there are some platforms which off_t > size_t.
+
+Tue Aug 21 17:07:58 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * .travis.yml (compiler): [experimental] clang support.
+
+Tue Aug 21 15:44:27 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/dl/lib/dl/func.rb (DL::Function#bind): fixes an error in
+ test/dl/test_import.rb (DL::TestImport#test_carried_function)
+ introduced by r36718.
+ the instance of the anonymous class which wraps the block should have
+ same methods and instance variables of self.
+
+Tue Aug 21 14:29:22 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/Makefile.sub (scriptbin.mk): no need to include twice.
+
+Tue Aug 21 10:52:08 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/unit/test.rb (Test::Unit::ProxyError): new exception class to
+ wrap exceptions raised in workers in parallel test mode.
+
+ * test/unit/parallel.rb (Test::Unit::Worker#puke): use above wrapper
+ exception.
+ [Bug #6882] [ruby-dev:46054]
+
+Tue Aug 21 10:40:06 2012 Koichi Sasada <ko1@atdot.net>
+
+ * test_continuation.rb (tracing_with_thread_set_trace_func):
+ fix to use Thread#set_trace_func(nil), not set_trace_func(nil).
+
+Tue Aug 21 09:32:41 2012 Ryan Davis <ryand-ruby@zenspider.com>
+
+ * lib/minitest/*: Imported minitest 3.3.0 (r7676)
+ * test/minitest/*: ditto
+
+Tue Aug 21 09:05:32 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/testunit/tests_for_parallel/ptest_forth.rb: added a test case
+ which causes an error.
+
+ * test/testunit/test_parallel.rb: follow above change.
+ see [Bug #6882]
+
+Tue Aug 21 05:43:00 2012 James Edward Gray II <james@graysoftinc.com>
+
+ * lib/csv.rb: Fixes #161 on github
+ * lib/csv.rb: You can now specify a pattern for :skip_lines.
+ Matching lines will not be passed to the CSV parser.
+ * lib/csv.rb: Patch by Christian Schwartz.
+
+Tue Aug 21 05:25:41 2012 Eric Hodel <drbrain@segment7.net>
+
+ * re.c (rb_reg_initialize_m): Forgot to update output for or'd-options
+ example.
+
+Tue Aug 21 05:18:03 2012 Eric Hodel <drbrain@segment7.net>
+
+ * re.c (rb_reg_initialize_m): Update example to show that regexp
+ options use | an not || to avoid confusion.
+
+Mon Aug 20 23:02:27 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y: more descriptive token names in syntax error messages.
+
+Mon Aug 20 20:36:30 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_call_method): follow iclasses as klass in cfp
+ but not included modules. [ruby-core:47241] [Bug #6891]
+
+ * vm_insnhelper.c (vm_call_bmethod): pass defined_class to follow
+ proper ancestors. [ruby-core:47241] [Bug #6891]
+
+Mon Aug 20 11:40:27 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * common.mk: fix failed to make with -j2.
+ https://gist.github.com/3397935
+
+Mon Aug 20 10:51:01 2012 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/test/unit.rb, lib/test/unit/parallel.rb:
+ generate error message (String) in parallel.rb instead of
+ marshalling Exception. Fixes [Bug #6882] [ruby-dev:46054]
+
+Sun Aug 19 01:24:32 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * enum.c: fix docs. https://github.com/ruby/ruby/pull/129 by
+ richardkmichael (Richard Michael).
+
+Sun Aug 19 00:47:26 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * lib/fileutils.rb: fix typo.
+ https://github.com/ruby/ruby/pull/155 by simonc (Simon COURTOIS).
+
+Sat Aug 18 09:57:46 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * enc/depend: fix inplace-build condition. enc.mk is generated with
+ setting $srcdir to enc, but pwd is still top build directory.
+ [ruby-core:47236] [Bug #6888]
+
+Fri Aug 17 23:28:54 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * object.c (rb_any_to_s, rb_obj_inspect): preserve encodings of class
+ name and instance variable names.
+
+Fri Aug 17 12:39:33 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/dl/lib/dl/func.rb (DL::Function#bind): allow to return/break from
+ the callback method. (Fiddle already allows it.)
+ [Bug #6389] [ruby-dev:45604]
+
+Thu Aug 16 19:54:24 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_trace.c, vm_core.h: simplify tracing mechanism.
+
+ (1) add rb_hook_list_t data structure which includes
+ hooks, events (flag) and `need_clean' flag.
+ If the last flag is true, then clean the hooks list.
+ In other words, deleted hooks are contained by `hooks'.
+ Cleanup process should run before traversing the list.
+ (2) Change check mechanism
+ See EXEC_EVENT_HOOK() in vm_core.h.
+ (3) Add `raw' hooks APIs
+ Normal hooks are guarded from exception by rb_protect().
+ However, this protection is overhead for too simple
+ functions which never cause exceptions. `raw' hooks
+ are executed without protection and faster.
+ Now, we only provide registration APIs. All `raw'
+ hooks are kicked under protection (same as normal hooks).
+
+ * include/ruby/ruby.h: remove internal data definition and
+ macros.
+
+ * internal.h (ruby_suppress_tracing), vm_trace.c: rename
+ ruby_suppress_tracing() to rb_suppress_tracing()
+ and remove unused function parameter.
+
+ * parse.y: fix to use renamed rb_suppress_tracing().
+
+ * thread.c (thread_create_core): no need to set RUBY_VM_VM.
+
+ * vm.c (mark_event_hooks): move definition to vm_trace.c.
+
+ * vm.c (ruby_vm_event_flags): add a global variable.
+ This global variable represents all of Threads and VM's
+ event masks (T1#events | T2#events | ... | VM#events).
+ You can check the possibility kick trace func or not
+ with ruby_vm_event_flags.
+ ruby_vm_event_flags is maintained by vm_trace.c.
+
+ * cont.c (fiber_switch, rb_cont_call): restore tracing status.
+ [Feature #4347]
+
+ * test/ruby/test_continuation.rb: ditto.
+
+Thu Aug 16 19:15:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * object.c (rb_class_initialize): forbid inheriting uninitialized
+ class. another class tree not based on BasicObject cannot exist.
+ [ruby-core:47148][Bug #6863]
+
+Thu Aug 16 11:52:06 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/-ext-/test_printf.rb (Test_SPrintf#test_{taint,untrust}): use
+ plain object so that the results of to_s and inspect are infected.
+ [ruby-dev:46053] [Bug #6881]
+
+Thu Aug 16 09:46:07 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * strftime.c: remove unnecessary macros to check traditional C.
+ https://github.com/ruby/ruby/pull/46 by lateau (Daehyub Kim).
+
+ * vsnprintf.c: remove K&R.
+
+Wed Aug 15 20:47:49 2012 Benoit Daloze <eregontp@gmail.com>
+
+ * object.c (rb_obj_inspect): Kernel#inspect: do not call #to_s. A class
+ can now benefit from the nice default #inspect even if it defines #to_s.
+ Also, there is no more unexpected change in #inspect result.
+
+ * NEWS: Add note about the change.
+
+ * bignum.c, io.c, numeric.c, object.c, proc.c, vm.c (Init_*):
+ Adapt internal structures (by aliasing #inspect to #to_s) so they
+ don't rely on the removed behavior (#inspect calling overridden #to_s).
+
+ * test/ruby/test_object.rb (test_inspect): add tests for Kernel#inspect.
+
+ * lib/pp.rb (class PP): do not call #to_s anymore, as #inspect
+ no more does (mame).
+
+ * test/test_pp.rb (class PPInspectTest): remove related assertion (mame).
+ [ruby-core:43238][Feature #6130]
+
+ * test/drb/drbtest.rb (DRbCore#teardown, DRbAry#teardown):
+ adapt DRb tests with the new change (shirosaki).
+ [ruby-core:47182][Bug #6866]
+
+Wed Aug 15 18:05:37 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * lib/test/unit.rb (Test::Unit::Runner#failed): need to delete the
+ status line if the status is skipped and -q is specified.
+
+Wed Aug 15 16:26:52 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * sprintf.c (ruby__sfvextra): the result should be infected by the
+ given strings.
+
+ * sprintf.c (ruby__sfvwrite): set buffer length and exclude
+ uninitialized garbage to get correct coderange.
+
+Wed Aug 15 16:20:09 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (ID_H_TARGET): make timestamp file of id.h so that the
+ header will not be remade repetitively.
+
+Wed Aug 15 11:39:53 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_trace.c: separate trace_func related functions from
+ thread.c.
+
+ * thread.c: ditto.
+
+ * common.mk: add vm_trace.o.
+
+ * inits.c: call Init_vm_trace().
+
+Tue Aug 14 16:25:46 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * test/erb/test_erb.rb (test_html_escape): add assertions for the
+ cases where the argument is not a String.
+
+Tue Aug 14 16:03:31 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (check_valid_dir): reject "..." as directory name.
+ [Bug #6851]
+
+Tue Aug 14 16:02:51 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_file_exhaustive.rb
+ (TestFileExhaustive#test_stat_dotted_prefix): added.
+
+Tue Aug 14 15:39:09 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_file_exhaustive.rb
+ (TestFileExhaustive#test_stat_drive_root): added.
+
+Tue Aug 14 10:38:17 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/erb.rb (ERB::Util.html_escape): fix r36687: call to_s before
+ passing it to CGI.escapeHTML.
+
+Mon Aug 13 13:13:19 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/erb.rb (ERB::Util.html_escape): use CGI.escapeHTML to escape
+ single quotes. [ruby-core:47138] [Bug #6861]
+
+Sun Aug 12 11:57:20 2012 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * vm.c (invoke_block_from_c): fix unintentional block passing.
+ [ruby-dev:45071] [Bug #5832]
+
+Fri Aug 10 08:41:28 2012 Eric Hodel <drbrain@segment7.net>
+
+ * gc.c (gc_malloc_allocated_size): RDoc does not process macros, so
+ mention this method is only available when ruby is built with
+ CALC_EXACT_MALLOC_SIZE
+ * gc.c (gc_malloc_allocations): ditto
+
+Thu Aug 9 23:46:51 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * tool/mkrunnable.rb: see build_os instead of target arch for
+ cross-compiling.
+
+ * configure.in (MINIRUBY): use real path for include path.
+
+ * template/fake.rb.in (builddir): remove duplications
+
+Thu Aug 9 20:03:11 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * test/ruby/test_file_exhaustive.rb
+ (TestFileExhaustive#test_stat_special_file): add a test.
+ GetFileAttributesExW fails to get attributes of special files
+ such as pagefile.sys.
+
+ * win32/win32.c (check_valid_dir): for performance, check the path
+ by FindFirstFileW only if the path contains "..."
+
+ * win32/win32.c (winnt_stat): use GetFileAttributesExW instead of
+ FindFirstFileW since GetFileAttributesExW is faster.
+ Based on the patch by Dusan D. Majkic.
+ [ruby-core:47083] [Feature #6845]
+
+Thu Aug 9 18:33:46 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ruby.c (proc_options): show version only once even if -v and
+ --version are given together.
+ http://twitter.com/d6rkaiz/status/233491797085671424
+
+Thu Aug 9 12:37:22 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/openssl/test_config.rb (OpenSSL#test_constants): skip this
+ test if platform is Mac OS X or Windows. [Bug #6830]
+
+Wed Aug 8 22:51:30 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_eval.c (eval_under): singletons other than special constants
+ don't need cref-scope hack.
+
+Wed Aug 8 22:45:38 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (.y.h): split from .y.c rule to manage dependency on
+ parse.h. [ruby-core:46741] [Bug #6789]
+
+ * common.mk (id.h): keep old file unless changed.
+
+Wed Aug 8 17:11:20 2012 Koichi Sasada <ko1@atdot.net>
+
+ * compile.c (ADD_INSNL): make ADD_INSNL as alias of ADD_INSN1.
+
+Wed Aug 8 17:08:14 2012 Koichi Sasada <ko1@atdot.net>
+
+ * bootstrap/test_exception.rb: fix a last committed test.
+
+Wed Aug 8 16:27:58 2012 Koichi Sasada <ko1@atdot.net>
+
+ * compile.c, insns.def (checkmatch):
+ remove checkincludearray instruction and
+ add new instruction checkmatch.
+ This change is to solve
+ [Bug #4438] "rescue args type check omitted".
+
+ * iseq.c: increment ISEQ_MAJOR_VERSION because removal of
+ checkincludearray instruction.
+
+ * vm_core.h: add several definitions for
+ the checkmatch instruction.
+
+ * vm_insnhelper.c (check_match): added.
+
+ * bootstraptest/test_exception.rb: add a test.
+
+ * test/ruby/test_exception.rb: ditto.
+
+Wed Aug 8 05:51:20 2012 Eric Hodel <drbrain@segment7.net>
+
+ * proc.c (method_clone): Added documentation. Patch by Robin Dupret.
+ Fixes #152 on github.
+
+Tue Aug 7 20:19:29 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/readline/readline.c (Init_readline): rl_catch_signals=0 returns
+ back. Without this, on FreeBSD9 and readline 6.2 irb can't catch ^C.
+ [Bug #5423]
+
+Tue Aug 7 20:12:39 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_exec.c, insns.def (leave): solve problems on
+ OPT_CALL_THREADED_CODE.
+ Catch up finish frame structure on OPT_CALL_THREADED_CODE.
+
+ * vm_core.h: add rb_thread_t#retval for temporary space on
+ OPT_CALL_THREADED_CODE.
+
+ * vm.c (th_init): clear rb_thread_t#retval as Qundef.
+
+ * vm_dump.c (rb_vmdebug_debug_print_pre): fix debug print format.
+
+Tue Aug 7 11:58:27 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_require.rb (TestRequire#test_require_twice): added.
+
+Tue Aug 7 11:35:37 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * vm_method.c (rb_redefine_opt_method): use RCLASS_ORIGIN to avoid
+ SEGV when a module-prepended class is refined.
+
+Tue Aug 7 10:46:37 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_file_exhaustive.rb
+ (TestFileExhaustive#test_expand_path*): refactoring. split the method
+ into some chunks of the same kind of tests.
+
+Tue Aug 7 00:31:09 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * class.c (rb_special_singleton_class_of): utility function.
+
+ * vm_eval.c (eval_under): special deal for class variable scope with
+ instance_eval.
+
+ * vm_eval.c (rb_obj_instance_eval, rb_obj_instance_exec): allow method
+ definition in instance_eval of special constants. [ruby-core:28324]
+ [Bug #2788]
+
+Tue Aug 7 00:23:58 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * variable.c (CVAR_LOOKUP): split into helper functions.
+
+Mon Aug 6 19:15:11 2012 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * test/win32ole/test_win32ole_variant.rb: setting WIN32OLE.locale
+ to pass some assertion. Thanks to Hiroshi Shirosaki.
+ [ruby-core:46873][Bug #6814]
+
+Mon Aug 6 15:54:50 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * internal.h, class.c, eval.c, insns.def: find the appropriate
+ receiver for super called in instance_eval. If such a receiver is
+ not found, raise NoMethodError. [ruby-dev:39772] [Bug #2402]
+
+Mon Aug 6 14:54:38 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * include/ruby/ruby.h, eval.c, vm_insnhelper.c: fix typo.
+
+Mon Aug 6 13:13:58 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_eval.c (vm_call_super): since cfp->klass is always class or
+ iclass, no search from method entry.
+
+ * insns.def (defined): now should use klass in the current control
+ frame to search superclass, not me->klass. reported by naruse.
+
+Mon Aug 6 11:19:19 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/etc/test_etc.rb (TestEtc#test_getpwuid): `s' is never set to nil.
+
+Mon Aug 6 11:08:48 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/syslog/test_syslog_logger.rb: skip unless Syslog module is
+ available.
+
+Mon Aug 6 00:40:54 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/bigdecimal/bigdecimal.c (BigMath_s_log): fix format specifier.
+
+Mon Aug 6 00:39:24 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/ruby.h (NUM2ULONG): optimize by inline as well as
+ NUM2LONG, and cast to unsigned long explicitly for the platforms
+ where SIZEOF_VALUE is larger than SIZEOF_LONG.
+
+ * include/ruby/ruby.h (NUM2SSIZET): fix type to cast.
+
+Sun Aug 5 21:10:36 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c : if ENABLE_VM_OBJSPACE is 1, rest_sweep is not defined.
+ remove unused declarations. [ruby-core:47004] [Bug #6837]
+
+Sun Aug 5 19:31:57 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c: just move functions and so on. I don't touch any internal
+ implementation.
+
+Sun Aug 5 13:22:29 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * configure.in: use gcc-4.2 prior to clang, gcc, and cc if exist for
+ the use of Snow Leopard's old clang. see also r36594, r36610, r36611.
+
+Sun Aug 5 06:55:10 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_{core,strftime}.c: [ruby-core:46990].
+
+Sat Aug 4 22:56:20 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c: use inline functions instead of macros, and close up
+ related codes for the profiler.
+
+Sat Aug 4 20:37:56 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c (gc_mark_children): use gc_mark_ptr instead of marking
+ a object directly.
+
+Sat Aug 4 10:02:03 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * test/ruby/test_alias.rb (test_super_in_aliased_module_method):
+ add a test case for [ruby-dev:46028], which fails in 1.8.
+
+Sat Aug 4 01:56:06 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_search_normal_superclass): no longer needs
+ receiver, klass is always unique in the ancestors now.
+
+Sat Aug 4 01:27:40 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * insns.def (invokesuper): reverted r36612 so that super in an
+ aliased method will not call the same method.
+
+Fri Aug 3 19:26:10 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * insns.def (invokesuper): don't skip the same class. instead, use
+ rb_method_entry_get_with_omod() to avoid infinite loop when
+ super is used with refinements. [ruby-core:30450] [Bug #3351]
+
+Fri Aug 3 19:21:19 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: use clang prior to gcc only when self-compiling on
+ darwin. search default compilers on other platforms. [Bug #6816]
+
+Fri Aug 3 17:25:49 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * configure.in: move RUBY_MINGW32 after AC_PROG_CC.
+ RUBY_MINGW32 uses AC_TRY_CPP and it sets CC and CPP. [Bug #6816]
+
+ * configure.in: don't use AC_PROG_CC in AS_CASE.
+
+Fri Aug 3 17:21:52 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/runner.rb: get rid of loading previously installed gems.
+ [ruby-dev:46025]
+
+Fri Aug 3 16:40:01 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * .travis.yml (notifications): [experimental] IRC notifications.
+
+Thu Aug 2 20:32:29 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * eval.c (rb_mod_using): new method Module#using. [experimental]
+
+ * eval.c (rb_mod_refine): new method Module#refine. [experimental]
+
+ * eval.c (f_using): new method Kernel#using. [experimental]
+
+Thu Aug 2 20:08:02 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * class.c, insns.def, method.h, proc.c, vm.c, vm_core.h, vm_eval.c,
+ vm_insnhelper.c, vm_insnhelper.h, vm_method.c: add klass to
+ rb_control_frame_t to implement super correctly.
+
+Thu Aug 2 13:23:08 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * configure.in (AC_PROG_CC): AC_PROG_CC tries clang at first on
+ darwin. [Bug #6816]
+
+Thu Aug 2 11:39:25 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c: return true or false. Patch by Dirkjan Bussink. [Bug #6821]
+
+ * test/ruby/test_gc.rb: add test-case for this bug.
+
+Thu Aug 2 10:51:12 2012 Martin Bosslet <Martin.Bosslet@gmail.com>
+
+ * ext/openssl/lib/openssl/digest.rb
+ test/openssl/test_digest.rb: Add Digest module function to OpenSSL
+ module and test it. Patch provided by Eric Hodel.
+ [ruby-core:46908][Feature #6819]
+
+Wed Aug 1 22:29:12 2012 Benoit Daloze <eregontp@gmail.com>
+
+ * ext/digest/digest.c (hexencode_str_new): return an ASCII string
+
+ * test/digest: tests for all kind of digests encodings
+ [ruby-core:46792][Bug #6799]
+
+Wed Aug 1 05:50:53 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * test/ruby/test_rubyoptions.rb (TestRubyOptions#test_encoding):
+ Fix test_encoding failure on Windows.
+ With chcp 65001, 1252 and 437, test_encoding failed. Test result
+ depends on locale because LANG environment variable doesn't affect
+ locale on Windows.
+ [ruby-core:46872] [Bug #6813]
+
+Wed Aug 1 00:33:19 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * class.c (include_class_new): fix duplication of prepended module.
+ since m_tbl of prepended module is always zero, copy from its
+ copy iclass of original.
+
+Tue Jul 31 18:22:34 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * variable.c (classname): tell if found name is permanent. search
+ tmp_classpath only if class id is set. [ruby-core:42865][Bug #6078]
+
+ * variable.c (rb_class_path): duplicate found temporary path.
+
+ * variable.c (rb_set_class_path_string, rb_set_class_path): set class
+ id to find classpath.
+
+Tue Jul 31 10:36:12 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych.rb: updated to released version.
+
+ * ext/psych/psych.gemspec: ditto
+
+Tue Jul 31 06:18:06 2012 Eric Hodel <drbrain@segment7.net>
+
+ * time.c (time_sec): Remove extra wording about leap seconds and refer
+ directly to Wikipedia's leap second page for further information.
+ [Bug #6749]
+
+Mon Jul 30 23:01:47 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/rubygems/platform.rb (Gem::Platform#initialize): Support pattern
+ like x86_64-netbsd6.99.7.
+
+Mon Jul 30 21:00:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * variable.c (find_class_path): no retry when preferred is given.
+
+ * variable.c (classname): if classid is set try it to find full
+ qualified class path, and then try arbitrary class path. try
+ tmp_classpath at last even if enclosing namespace is anonymous.
+ fix r36574. [ruby-core:42865][Bug #6078]
+
+ * variable.c (rb_set_class_path_string, rb_set_class_path): set
+ tmp_classpath instead of classpath if the name is not permanent.
+
+Mon Jul 30 14:24:20 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * variable.c: store anonymous class path in tmp_classpath but not in
+ classpath. [ruby-core:42865][Bug #6078]
+
+Mon Jul 30 13:11:54 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (DLDFLAGS): on Darwin, deprecate -flat_namespace to get
+ rid of huge imported symbols table.
+
+ * configure.in (LIBRUBY_RELATIVE): libruby_so is not made when
+ disable-shared, so no absolute path is used for it and executable
+ file is runnable anywhere.
+
+Mon Jul 30 01:30:10 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+
+ * common.mk: add a dependency. [ruby-core:46741] [Bug #6789]
+
+Sun Jul 29 15:44:47 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+
+ * thread.c (thread_create_core): hide th->async_errinfo_mask_stack from
+ ObjectSpace.each_object. refix of r36539.
+
+Sun Jul 29 23:57:27 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/socket/option.c (inet_ntop): use rb_w32_inet_ntop, instead of
+ inet_ntop directly, which is unavailable on older version Windows.
+
+ * win32/win32.c (rb_w32_inet_ntop): type should be const.
+
+Sun Jul 29 14:20:34 2012 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * thread.c (Init_Thread): does not need to set klass
+ explicitly.
+
+Sun Jul 29 06:21:04 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * win32/win32.c: suppress warning redeclared on mingw64.
+ *_s functions are declared if MINGW_HAS_SECURE_API is defined.
+ Follow up r36556.
+
+Sun Jul 29 00:28:46 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c: remove unused initialization.
+
+Sat Jul 28 16:26:09 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * win32/win32.c (gmtime_r): use _gmtime64_s() with x86_64-w64-mingw32.
+
+ * win32/win32.c (localtime_r): use _localtime64_s() with
+ x86_64-w64-mingw32. Since FileTimeToSystemTime() seems not work with
+ large value under x64. Mingw-w64 doesn't have these declaration.
+ [ruby-core:46780] [Bug #6794]
+
+Fri Jul 27 18:25:51 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (rb_io_check_io): make public.
+
+ * process.c (check_exec_redirect): try conversion to IO on redirect
+ parameters. [ruby-core:44181] [Bug #6269]
+
+Fri Jul 27 17:58:12 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (RUBY_CPPOUTFILE): get rid of variable conflict so
+ CPPFLAGS is not duplicated. [ruby-core:43097] [Bug #6119]
+
+Fri Jul 27 12:12:36 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/mkexports.rb: should not export DllMain().
+ reported by luis at [ruby-core:46743] [Bug #6790], solved by
+ Heesob Park, and confirmed by nobu.
+
+Thu Jul 26 14:51:29 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * test/net/http/test_https.rb (TestNetHTTPS#test_session_reuse):
+ localhost is not (always) 127.0.0.1. Don't expect that.
+
+Thu Jul 26 07:18:38 2012 <kanemoto@ruby-lang.org>
+
+ * ext/json/fbuffer/fbuffer.h: avoid compilation error on AIX by
+ -ansi -std=iso9899:199409 (r36038). [ruby-core:46744] [Bug #6791].
+
+Thu Jul 26 00:42:23 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+
+ * thread.c (thread_create_core, Init_Thread): hide
+ th->async_errinfo_queue and th->async_errinfo_mask_stack from
+ ObjectSpace.each_object.
+
+Wed Jul 25 17:41:05 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * complex.c, rational.c: compatible marshal loader for compatibilities
+ with 1.8. [ruby-core:45775] [Bug #6625]
+
+Wed Jul 25 17:17:05 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * atomic.h: prefer GCC atomic builtins than Windows APIs, if possible,
+ since they are generic.
+
+Wed Jul 25 11:16:57 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/net/.document: Removed. All files in net/ should be included in
+ RDoc.
+
+Wed Jul 25 10:00:23 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/testunit/test_redefinition.rb: broken class/method names.
+
+Wed Jul 25 09:26:32 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/cgi/html.rb: Use << instead of +=.
+ `a += b` is syntax sugar of `a = a + b`; it creates a new string
+ object. `a << b` is concatenation and doesn't create new object.
+
+Wed Jul 25 09:16:26 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/cgi/html.rb (element_init): suppress redefine warning.
+ Don't define methods if they are already defined.
+
+Wed Jul 25 09:05:38 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/net/http.rb: Added SSL session reuse across connections for a
+ single instance to speed up connection. [Feature #5341]
+ * NEWS: ditto
+ * test/net/http/test_https.rb: Tests for #5341
+
+Wed Jul 25 06:54:24 2012 Eric Hodel <drbrain@segment7.net>
+
+ * doc/re.rdoc: Fix spelling
+
+Wed Jul 25 06:49:12 2012 Eric Hodel <drbrain@segment7.net>
+
+ * re.c (rb_reg_s_last_match): Update $~ to reference Regexp
+ documentation about "special global variables". [Bug #6723]
+
+Wed Jul 25 06:28:56 2012 Eric Hodel <drbrain@segment7.net>
+
+ * iseq.c: Added documentation. Patch by David Albert. [Bug #6785]
+
+Wed Jul 25 03:05:06 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * parse.y: added symbols and qsymbols productions for %i and %I
+ support. %i{ .. } returns a list of symbols without interpolation,
+ %I{ .. } returns a list of symbols with interpolation. Thanks to
+ Josh Susser for inspiration of this feature. [Feature #4985]
+
+ * ext/ripper/eventids2.c: added ripper events for %i and %I.
+
+ * test/ripper/test_parser_events.rb: ripper tests
+
+ * test/ripper/test_scanner_events.rb: ditto
+
+ * test/ruby/test_array.rb: test for %i and %I behavior
+
+Tue Jul 24 23:34:43 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * include/ruby/win32.h (rb_w32_pow): add new function.
+ We use powl() instead of broken pow() for x64-mingw32. This workaround
+ fixes test failures related to floating point numeric.
+ [ruby-core:46686] [Bug #6784]
+
+Tue Jul 24 15:01:24 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_socket, rb_w32_socketpair): remember the family
+ in the high word of socklist value.
+
+ * win32/win32.c (overlapped_socket_io, recvmsg, sendmsg, setfl): follow
+ above changes.
+
+ * win32/win32.c (rb_w32_getsockname): set remembered family to the
+ argument when OS's function fails.
+
+Tue Jul 24 12:35:13 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_dir_m17n.rb: remove a garbage.
+
+ * test/ruby/test_dir_m17n.rb: convert from ascii-8bit to other encoding
+ with 8bit bytes always fails.
+
+Tue Jul 24 12:32:18 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_dir_m17n.rb: sorry, typo.
+
+Tue Jul 24 12:13:26 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_dir_m17n.rb: refactoring. RE should be in the left side
+ of the =~ operator, and compare the result with nil is meaningless.
+
+Tue Jul 24 11:35:20 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_pack.rb (test_pack_unpack_M): was redefined
+ accidentally.
+
+Tue Jul 24 09:31:18 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems: Updated to RubyGems 1.8.24, a bugfix release.
+
+Tue Jul 24 08:30:15 2012 Luis Lavena <luislavena@gmail.com>
+
+ * test/ruby/test_dir_m17n.rb (create_and_check_raw_file_name): add new
+ helper method to ease encoding testing. Patch by Oleg Sukhodolsky.
+ [ruby-core:46589][Bug #6765]
+
+ * test/ruby/test_dir_m17n.rb (test_filename_extutf8): use filesystem
+ encoding when reading entries and comparing.
+
+ * test/ruby/test_dir_m17n.rb (test_filename_utf8_raw_name): removed.
+
+ * test/ruby/test_dir_m17n.rb (test_filename_utf8_raw_jp_name): split test.
+
+Tue Jul 24 08:09:30 2012 Luis Lavena <luislavena@gmail.com>
+
+ * test/win32ole/test_win32ole_method.rb (is_ruby64?): Correct platform
+ used to identify mingw-w64 (x64-mingw32). Patch by Hiroshi Shirosaki.
+ [ruby-core:46651][Bug #6782]
+
+Tue Jul 24 07:22:58 2012 Eric Hodel <drbrain@segment7.net>
+
+ * time.c (time_sec): Updated description of leap seconds for accuracy.
+ Based on patch by Marcus Stollsteimer. [Bug #6749]
+
+Tue Jul 24 07:03:11 2012 Eric Hodel <drbrain@segment7.net>
+
+ * string.c (rb_str_sub): Fixed wording of documentation to match the
+ replacement operation. Minor cleanup of markup. [Bug #6719]
+ * string.c (rb_str_sub_bang): Minor wording change for clarity, minor
+ cleanup of markup.
+
+Mon Jul 23 23:58:40 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * enc/Makefile.in (TARGET_NAME, TARGET_ENTRY): needed for EXTDLDFLAGS
+ on some platforms. [ruby-core:46600] [Bug #6768]
+
+ * enc/depend: no longer needs tweaking DLDFLAGS for TARGET names.
+
+Mon Jul 23 22:48:19 2012 Tanaka Akira <akr@fsij.org>
+
+ * lib/open-uri.rb: use respond_to? to test Tempfile.
+ [ruby-dev:45995] [Bug #6781] reported by hsbt (Hiroshi SHIBATA).
+
+Mon Jul 23 14:43:34 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (LIBPATHENV): LIBPATH is used on AIX, but not
+ SHLIB_PATH which was carelessly copied from HP/UX. suggested by
+ Perry Smith at [ruby-core:46397]. [Bug #6728]
+
+Mon Jul 23 01:55:08 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * test/uri/test_generic.rb (URI#test_find_proxy): add tests with
+ empty *_proxy env variables.
+
+Mon Jul 23 01:47:26 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * test/uri/test_generic.rb (URI#with_env): unset proxy related env
+ variables. [Bug #6774]
+
+ * test/uri/test_generic.rb (URI#test_find_proxy): fix failures
+ when proxy related env variables already set. [Bug #6774]
+
+Sun Jul 22 23:58:48 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * thread.c (rb_threadptr_execute_interrupts_common): increase
+ running_time_us on THREAD_TO_KILL like on THREAD_RUNNABLE.
+ This cause not to switch from a thread which is to be killed
+ on FreeBSD and Mac OS X. see also the test.
+ This issue maybe exist for long time but happens after r36430.
+
+Sat Jul 21 06:21:45 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/http.rb: fixes for r36476. [Feature #6546]
+ http://u64.rubyci.org/~chkbuild/ruby-trunk/log/20120720T030101Z.diff.html.gz
+
+ * lib/net/http.rb (Net::HTTP.newobj): return back for compatibility.
+
+ * lib/net/http.rb (Net::HTTP.new): set default_port if proxy port is
+ not given.
+
+ * lib/net/http.rb (Net::HTTP#initialize): ditto.
+
+ * lib/net/http.rb (Net::HTTP#proxy?): return true or false.
+
+ * lib/net/http.rb (Net::HTTP#proxy_address): check proxy_uri is not nil.
+
+ * lib/net/http.rb (Net::HTTP#proxy_port): ditto.
+
+Sat Jul 21 23:12:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread_pthread.c (ruby_init_stack): STACK_GROW_DIR_DETECTION is
+ necessary on platforms with unknown stack direction. [Bug #6761]
+
+Sat Jul 21 15:13:42 2012 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/test/unit/testcase.rb (method_added): refactoring.
+
+Sat Jul 21 14:06:41 2012 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/test/unit/testcase.rb: warn when test_* method is redefined.
+ Patch by mame (Yusuke Endoh). [Feature #2643] [ruby-core:27790]
+
+ * test/testunit/test_redefinition.rb: Test for above.
+
+ * test/testunit/test4test_redefinition.rb: Ditto.
+
+Sat Jul 21 08:41:14 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/logger.rb: Updated example in Logger comment to match other
+ examples and fixed a bug. Patch by Marcus Stollsteimer.
+ [Bug #6759]
+
+Fri Jul 20 17:20:54 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * random.c (rb_random_real): refine error message.
+
+Fri Jul 20 11:03:17 2012 Eric Hodel <drbrain@segment7.net>
+
+ * NEWS: Updated net/http for automatic proxy detection (#6546) and
+ automatic gzip and deflate compression (#6492, #6494).
+
+Fri Jul 20 10:55:38 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/net/http.rb: Net::HTTP now automatically detects and uses
+ proxies from the environment. A proxy may also be specified as
+ before.
+
+ Net::HTTP::Proxy still creates anonymous classes, but these classes
+ are only used to store configuration information. When an HTTP
+ instance is created the configuration is now copied.
+
+ Additionally, Net::HTTP::ProxyDelta is no longer used by Net::HTTP
+
+ [Feature #6546]
+ * lib/open-uri.rb: Moved URI::Generic#find_proxy to uri/generic.
+ * lib/uri/generic.rb: Imported find_proxy from open-uri.
+ * test/open-uri/test_open-uri.rb: Moved proxy-discovery tests to URI.
+ * test/uri/test_generic.rb: Imported proxy-discovery tests from
+ open-uri.
+ * test/net/http/test_http.rb: Added tests for proxy behavior.
+
+Fri Jul 20 09:34:11 2012 Eric Hodel <drbrain@segment7.net>
+
+ * test/socket/test_socket.rb: Ignore IPv6 unique local addresses on OS
+ X (iCloud Back to my Mac addresses) for test_udp_socket since they do
+ not act as loopback addresses. [Bug #6692]
+
+Fri Jul 20 09:32:14 2012 Eric Hodel <drbrain@segment7.net>
+
+ * ext/socket/raddrinfo.c (addrinfo_ipv6_unique_local_p): Added
+ Addrinfo#ipv6_unique_local? to detect RFC 4193 unique local
+ addresses. Part of #6692
+ * ext/socket/rubysocket.h: Add IN6_IS_ADDR_UNIQUE_LOCAL macro if
+ missing.
+ * test/socket/test_addrinfo.rb: Test for ipv6_unique_local?
+
+Fri Jul 20 07:40:32 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/net/http/response.rb: Automatically inflate gzip and
+ deflate-encoded response bodies. [Feature #6942]
+ * lib/net/http/generic_request.rb: Automatically accept gzip and
+ deflate content-encoding for requests. [Feature #6494]
+ * lib/net/http/request.rb: Updated documentation for #6494.
+ * lib/net/http.rb: Updated documentation for #6492 and #6494, removed
+ Content-Encoding handling now present in Net::HTTPResponse.
+ * test/net/http/test_httpresponse.rb: Tests for #6492
+ * test/net/http/test_http_request.rb: Tests for #6494
+ * test/open-uri/test_open-uri.rb (test_content_encoding): Updated test
+ for automatic content-encoding handling.
+
+Fri Jul 20 03:42:54 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * thread_pthread.c: use #ifdef, not #if.
+
+Thu Jul 19 15:08:40 2012 Koichi Sasada <ko1@atdot.net>
+
+ * thread.c (rb_thread_s_control_interrupt,
+ rb_thread_s_check_interrupt): added for
+ Thread.control_interrupt and Thread.check_interrupt.
+ See details on rdoc.
+ I'll make an ticket for this feature.
+
+ * test/ruby/test_thread.rb: add a test for Thread.control_interrupt.
+
+ * thread.c (rb_threadptr_raise): make a new exception object
+ even if argc is 0.
+
+ * thread.c (rb_thread_kill): kill thread immediately if target thread
+ is current thread.
+
+ * vm_core.h (RUBY_VM_CHECK_INTS_BLOCKING): added.
+ CHECK_INTS while/after blocking operation.
+
+ * vm_core.h (RUBY_VM_CHECK_INTS): require rb_thread_t ptr.
+
+ * cont.c (fiber_switch): use replaced RUBY_VM_CHECK_INTS().
+
+ * eval.c (ruby_cleanup): ditto.
+
+ * insns.def: ditto.
+
+ * process.c (rb_waitpid): ditto.
+
+ * vm_eval.c (vm_call0): ditto.
+
+ * vm_insnhelper.c (vm_call_method): ditto.
+
+Thu Jul 19 22:46:48 2012 Tanaka Akira <akr@fsij.org>
+
+ * test/ruby/test_io.rb: remove temporally files early.
+
+Thu Jul 19 15:38:35 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * variable.c (rb_mod_class_variables): return inherited variables
+ except when the optional argument is set to false.
+ [ruby-dev:44034] [Bug #4971]
+
+ * variable.c (rb_mod_constants): fix typo in documentation.
+
+Thu Jul 19 14:30:43 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * internal.h: move mark function declarations that should be private.
+
+Thu Jul 19 14:18:22 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/socket/init.c (rsock_init_sock): need to update max fd on all
+ platforms.
+
+Thu Jul 19 14:15:48 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread.c (rb_gc_mark_threads): remove deprecated function.
+
+Thu Jul 19 13:28:03 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/net/http/test_http.rb (TestNetHTTPLocalBind#test_bind_to_local*):
+ re-enable the tests because now it's OK on windows.
+
+Thu Jul 19 13:26:25 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/socket/extconf.rb: now enable IPv6 by default on mswin.
+
+Thu Jul 19 09:33:46 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/emitter.c (initialize): allow a configuration object to be
+ passed to the constructor so that mutation isn't required after
+ instantiation.
+
+ * ext/psych/lib/psych/handler.rb: add configuration object
+
+ * ext/psych/lib/psych/visitors/emitter.rb: use configuration object if
+ extra configuration is present.
+
+Thu Jul 19 08:20:25 2012 Tanaka Akira <akr@fsij.org>
+
+ * test/ruby/test_file.rb: remove temporally files early.
+
+Thu Jul 19 07:37:41 2012 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * test/drb/drbtest.rb: fixed: can't delete unix domain sockets problem.
+
+Thu Jul 19 03:41:20 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * bignum.c: Added #include <strings.h> for ffs(). Patch by Perry
+ Smith. Thank you. [Bug #6748]
+
+Thu Jul 19 01:56:02 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * include/ruby/intern.h (rb_num_zerodiv): Added NORETURN.
+ Patched by Xi Wang. [Bug #6736]
+
+Wed Jul 18 23:57:38 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * pack.c (pack_pack): round down too long uuencode width. folding
+ width in uuencode format cannot be longer than 63 bytes.
+
+Wed Jul 18 23:04:18 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/dbm/dbm.c (fdbm_empty_p): fix wrong condition introduced in r36438.
+
+ * ext/sdbm/init.c (fsdbm_empty_p): ditto.
+
+Wed Jul 18 23:08:57 2012 Tanaka Akira <akr@fsij.org>
+
+ * test/ruby/test_beginendblock.rb: remove temporally files early.
+
+Wed Jul 18 22:43:02 2012 Tanaka Akira <akr@fsij.org>
+
+ * test/ruby/test_autoload.rb: remove temporally files early.
+
+Wed Jul 18 21:59:46 2012 Tanaka Akira <akr@fsij.org>
+
+ * test/ruby/test_argf.rb: use temporally directory.
+
+Wed Jul 18 19:41:19 2012 Tanaka Akira <akr@fsij.org>
+
+ * test/openssl/test_config.rb: remove temporally files early.
+
+Wed Jul 18 17:45:26 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * error.c (rb_builtin_type_name): map by index.
+
+Wed Jul 18 16:17:40 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (have_framework): get rid of separating -framework
+ option and its argument and dealing with the argument as a library
+ or an object name. if $LDFLAGS were an array...
+
+Wed Jul 18 16:09:10 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * ext/curses/extconf.rb: support PDCurses. patched by Luis Lavena.
+ [ruby-core:46485] [Feature #6735]
+
+Wed Jul 18 15:50:25 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * parse.y (primary): allow an empty grouped expression as the
+ operand of the not operator (e.g., not ()).
+ [ruby-core:45976] [Bug #6674]
+
+ * parse.y (parser_yylex): show no warning for a grouped expression
+ as the operand of the not operator (e.g., not (a)) or as an
+ argument of a method call without parentheses (e.g., foo (a)).
+ [ruby-core:39050] [Bug #5214]
+
+Wed Jul 18 15:33:21 2012 Koichi Sasada <ko1@atdot.net>
+
+ * thread.c (rb_thread_call_without_gvl2): added.
+ it can skip last CHECK_INTS. See document for more details.
+ Document about it was updated a bit.
+
+ * include/ruby/thread.h (decl. of rb_thread_call_without_gvl2): added.
+
+ * thread.c (rb_thread_call_with_gvl): remove "EXPERIMENTAL!"
+ warning from a document.
+
+Wed Jul 18 14:53:21 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (EXTDLDFLAGS): split options for each extension
+ libraries, and unused in ruby.pc. [Bug #6734]
+
+ * lib/mkmf.rb (MakeMakefile#configuration): add EXTDLDFLAGS.
+
+Wed Jul 18 14:47:23 2012 Koichi Sasada <ko1@atdot.net>
+
+ * thread.c: fix last commit miss.
+
+Wed Jul 18 14:16:51 2012 Koichi Sasada <ko1@atdot.net>
+
+ * thread.c (rb_threadptr_async_errinfo_*): manage async errors queue.
+ Async events such as an exception throwed by Thread#raise,
+ Thread#kill and thread termination (after main thread termination)
+ will be queued to th->async_errinfo_queue.
+ - clear: clear the queue.
+ - enque: enque err object into queue.
+ - deque: deque err object from queue.
+ - active_p: return 1 if the queue should be checked.
+ rb_thread_t#thrown_errinfo was removed.
+
+ * vm_core.h: add declarations of rb_threadptr_async_errinfo_*.
+ remove rb_thread_t#thrown_errinfo field and
+ add rb_thread_t#async_errinfo_queue (queue body: Array),
+ rb_thread_t#async_errinfo_queue_checked (flag),
+ rb_thread_t#async_errinfo_mask_stack(Array, not used yet).
+
+ * vm.c (rb_thread_mark): fix a mark function.
+
+ * cont.c (rb_fiber_start): enque an error.
+
+ * process.c (after_fork): clear async errinfo queue.
+
+Wed Jul 18 14:25:55 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * pack.c: (ditto) bitwise operations are not char. Apply explicit
+ casts on them.
+
+Wed Jul 18 12:59:50 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * encoding.c (load_encoding): explicit cast to suppress warning.
+ Though the cast truncates some bits, from heuristic analysis I
+ believe it is OK to do so here.
+
+ * bignum.c (rb_cstr_to_inum): ditto.
+
+Wed Jul 18 12:55:54 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/benchmark.rb: Fix Benchmark.benchmark output with an empty
+ caption. patched by Benoit Daloze. [ruby-core:45719] [Bug #6610]
+
+Wed Jul 18 10:00:54 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/debug.rb: Added toplevel documentation. Based on patch by Oscar
+ Del Ben. [Bug #6743], fixes #146 on github.
+
+Wed Jul 18 09:33:59 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/win32ole/test_win32ole_event.rb (TestWIN32OLE_EVENT): use
+ standard skip method to skip tests.
+
+Wed Jul 18 09:26:45 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/logger.rb: Updated typos and output to match modern Logger
+ output. Patch by Marcus Stollsteimer. [Bug #6738]
+
+Wed Jul 18 07:59:29 2012 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
+
+ * lib/cgi/util.rb (CGI.escapeHTML,unescapeHTML): Add &apos; for HTML5
+ escaping.
+ [Feature #6620]
+
+Tue Jul 17 22:17:13 2012 Tanaka Akira <akr@fsij.org>
+
+ * lib/open-uri.rb: call io.close! for Tempfile.
+
+Tue Jul 17 16:41:32 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * proc.c (rb_proc_arity): return normal value (not -n-1) if it is not
+ a labmda, or it is a labmda and no arg_opts. [Bug #5694]
+
+Tue Jul 17 03:56:34 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/to_ruby.rb: strings with YAML anchors
+ are properly referenced. Patched by Joe Rafaniello via Github:
+ https://github.com/tenderlove/psych/pull/69
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: ditto
+ * test/psych/test_alias_and_anchor.rb: test for change
+
+Mon Jul 16 23:20:24 2012 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (rb_integer_float_cmp): use FIXNUM_MIN and FIXNUM_MAX,
+ instead of LONG_MIN and LONG_MAX.
+
+Mon Jul 16 22:50:41 2012 Tanaka Akira <akr@fsij.org>
+
+ * numeric.c (flo_to_s): use the exponential form if the integer part
+ is longer than or equal DBL_DIG.
+ [ruby-dev:45960] [ruby-trunk - Bug #6741]
+
+Mon Jul 16 22:01:00 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * ext/readline/readline.c: fixed docs. [Bug #6740][ruby-core:46501]
+ patched by Nobuhiro IMAI.
+
+Mon Jul 16 19:24:01 2012 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (rb_integer_float_eq): new function.
+ (rb_big_eq): use rb_integer_float_eq.
+
+ * internal.h (rb_integer_float_eq): declared.
+
+ * numeric.c (flo_eq): use rb_integer_float_eq.
+ (fix_equal): ditto.
+
+Mon Jul 16 19:02:31 2012 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (rb_integer_float_cmp): rename a local variable.
+
+Mon Jul 16 18:40:26 2012 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (rb_integer_float_cmp): renamed from rb_big_float_cmp.
+
+ * internal.h: follow the above change.
+
+ * numeric.c: ditto.
+
+Mon Jul 16 17:57:54 2012 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (rb_big_float_cmp): compare an integer and float precisely.
+ [ruby-core:31376] [Bug #3589] reported by Tomasz Wegrzanowski.
+
+Mon Jul 16 17:29:45 2012 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (rb_big_float_cmp): support fixnum for argument x.
+
+ * numeric.c (fix_equal): use rb_big_float_cmp.
+ (fix_cmp): ditto.
+ (fix_gt): ditto.
+ (fix_ge): ditto.
+ (fix_lt): ditto.
+ (fix_le): ditto.
+ (flo_eq): ditto.
+ (flo_cmp): use rb_big_float_cmp for fixnum argument.
+ (flo_gt): ditto.
+ (flo_ge): ditto.
+ (flo_lt): ditto.
+ (flo_le): ditto.
+
+Mon Jul 16 17:05:53 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * test/fileutils/test_fileutils.rb: add test for FileUtils#uptodate?
+
+Mon Jul 16 16:56:12 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * lib/fileutils.rb (FileUtils.uptodate?): remove useless parameter.
+ patched by Oscar Del Ben.[Bug #6708][ruby-core:46256]
+
+Mon Jul 16 15:37:56 2012 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (rb_big_eq): use rb_big_float_cmp.
+
+Mon Jul 16 15:00:45 2012 Tanaka Akira <akr@fsij.org>
+
+ * internal.h (rb_big_float_cmp): declared.
+
+ * bignum.c (rb_big_float_cmp): extracted from rb_big_cmp and big_op.
+ (rb_big_cmp): use rb_big_float_cmp.
+ (big_op): ditto.
+
+ * numeric.c (flo_cmp): use rb_big_float_cmp.
+ (flo_gt): ditto.
+ (flo_ge): ditto.
+ (flo_lt): ditto.
+ (flo_le): ditto.
+
+Mon Jul 16 14:14:21 2012 Tanaka Akira <akr@fsij.org>
+
+ * bignum.c (enum big_op_t): new type.
+ (big_op): use enum big_op_t.
+ (big_gt): ditto.
+ (big_ge): ditto.
+ (big_lt): ditto.
+ (big_le): ditto.
+
+Sat Jul 14 18:18:48 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (rb_get_values_at): fill with nil out of range.
+ [ruby-core:43678] [Bug #6203]
+
+Sat Jul 14 17:17:55 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * cont.c (cont_restore_0): improve docs. [Bug #6706][ruby-core:46243]
+ patched by Oscar Del Ben via https://github.com/ruby/ruby/pull/140
+
+Sat Jul 14 17:08:13 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * hash.c (rb_hash_s_create): raise an exception, when input elements
+ are not one or two elements arrays. [ruby-core:39945] [Bug #5406]
+
+Sat Jul 14 16:16:48 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit.rb (Test::Unit::Runner#_run_parallel): use
+ Array#uniq!.
+
+ * lib/test/unit.rb (Test::Unit::Runner#deal): deal tasks to workers.
+
+ * lib/test/unit.rb (Test::Unit::Runner#quit_workers): close and kill
+ all workers.
+
+ * lib/test/unit.rb (Test::Unit::Runner#delete_worker): delete dead
+ worker from working set.
+
+ * lib/test/unit.rb (Test::Unit::Runner#launch_worker): add new worker
+ to working set.
+
+ * lib/test/unit.rb (Test::Unit::Runner#launch_worker): extract.
+
+ * lib/test/unit.rb (Test::Unit::Runner#start_watchdog): extract.
+
+ * lib/test/unit.rb (Test::Unit::Runner#_run_parallel): move
+ initializations with nothing to release outside begin/ensure.
+
+Sat Jul 14 16:04:24 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (rb_ary_join): should not infected by separator if it is not
+ used. [ruby-core:42161][Bug #5902]
+
+Sat Jul 14 02:31:55 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/intern.h (rb_thread_blocking_region): fix declarations
+ prototypes without arguments in C++ have different meanings than C.
+
+Thu Jul 12 12:32:26 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/runner.rb: skip default gems to get rid of loading old versions
+ before installation.
+
+Thu Jul 12 11:44:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (rb_str_new_frozen): since the result object should have
+ same tainted/untrusted bits with the original object, return new
+ object if the shared object unmatch. [ruby-core:39745][Bug #5374]
+
+Thu Jul 12 10:46:39 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/net/http/test_http.rb (TestNetHTTPLocalBind#test_bind_to_local*):
+ cannot cross between network interfaces on Windows, so skip this test
+ until we find better test.
+
+Thu Jul 12 08:48:33 2012 Ryan Davis <ryand-ruby@zenspider.com>
+
+ * lib/minitest/*: Imported minitest 3.2.0 (r7598)
+ * test/minitest/*: ditto
+
+Thu Jul 12 05:11:41 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * insns.def (defined): use method entry and id in cfp for proper
+ superclass, since klass in iseq is shared by dynamically defined
+ methods from the same block. [ruby-core:45831][Bug #6644]
+
+Thu Jul 12 01:49:07 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/http.rb (Net::HTTP#connect): use local_host and local_port
+ if specified. patched by Ricardo Amorim [Feature #6617]
+
+Wed Jul 11 17:36:39 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/extmk.rb: append ENCOBJS to DLDOBJS but not EXTSOLIBS which is
+ not a target, to compile enc/encinit.c.
+
+Wed Jul 11 12:38:20 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/openssl/ossl_pkey_ec.c (ossl_ec_point_mul): nonstatic initializer
+ of an aggregate type is a C99ism.
+
+ * ext/openssl/ossl_pkey_ec.c (ossl_ec_point_mul): get rid of VC++
+ warnings.
+
+Mon Jul 9 16:11:30 2012 Yuki Yugui Sonoda <yugui@google.com>
+
+ * vm_eval.c (rb_eval_string_from_file,
+ rb_eval_string_from_file_protect): new functions to replace
+ rb_compile_main_from_string() and ruby_eval_main().
+
+ * nacl/pepper_ruby.c: Follows the change in vm_eval.c
+
+Mon Jul 9 14:05:42 2012 Yuki Yugui Sonoda <yugui@google.com>
+
+ Reverts a half of r36079. As we discussed on ruby-dev@ and IRC,
+ we do not need to disclose intermediate representation of program.
+ The program embedding CRuby should use rb_eval_string family.
+ * include/ruby/ruby.h (ruby_opaque_t): removed.
+ (ruby_compile_main_from_file, ruby_compile_main_from_string,
+ ruby_eval_main): removed.
+
+ * eval.c (ruby_eval_main_internal): became ruby_exec_internal() again.
+ (ruby_eval_main): removed.
+
+ * ruby.c (PREPARE_PARSE_MAIN) reverted.
+ (parse_and_compile_main, ruby_compile_main_from_file,
+ ruby_compile_main_from_string): removed
+
+Wed Jul 11 10:16:38 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby.h (HAVE_RUBY_THREAD_H): to show ruby/thread.h to be
+ available. fixup of r36355.
+
+Wed Jul 11 03:26:47 2012 Eric Hodel <drbrain@segment7.net>
+
+ * ext/zlib/zlib.c: Added streaming support to inflate processing.
+ This allows zlib streams to be processed without huge memory growth.
+ [Feature #6612]
+ * NEWS: ditto
+ * ext/zlib/zlib.c (zstream_expand_buffer): Uses rb_yield when a block
+ is given for streaming support. Refactored to use
+ zstream_expand_buffer_into to remove duplicate code.
+ * ext/zlib/zlib.c (zstream_expand_buffer_protect): Added wrapper
+ function to pass jump state back through GVL-free section to allow
+ zstream clean-up before terminating the ruby call.
+ * ext/zlib/zlib.c (zstream_expand_buffer_without_gvl): Acquire GVL to
+ yield processed chunk of output stream.
+ * ext/zlib/zlib.c (zstream_detach_buffer): When a block is given,
+ returns Qnil mid-stream and yields the output buffer at the end of
+ the stream.
+ * test/zlib/test_zlib.rb: Updated tests
+
+Tue Jul 10 22:57:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/thread.h: new header file for thread stuff.
+
+ * thread.c (rb_thread_call_without_gvl): export. [Feature#4328]
+ returns void* instead of VALUE. [Feature #5543]
+
+ * thread.c (rb_thread_blocking_region): deprecate. [ruby-core:46295]
+
+Tue Jul 10 10:48:59 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * include/ruby/win32.h (NT, NtInitialize): removed unused old macros.
+
+Tue Jul 10 10:43:37 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * configure.in: removed --enable/disable-win95 options. (see r36342)
+
+Tue Jul 10 00:44:41 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * include/ruby/ruby.h: Removed RUBY_GLOBAL_SETUP completely. It is
+ no meaning definition since r24894.
+ * main.c: ditto.
+ * nacl/pepper_main.c: ditto.
+
+Mon Jul 9 23:59:36 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * dln.c: Simplify and make consistent an ifdef for Mac OS X.
+ * ext/socket/rubysocket.h: ditto.
+ * ext/tk/stubs.c: ditto.
+ * io.c: ditto.
+ * process.c: ditto.
+ * signal.c: ditto.
+ * vm_dump.c: ditto.
+
+Mon Jul 9 17:37:35 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (win95_stat): removed unnecessary macro.
+
+Mon Jul 9 17:22:16 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/configure.bat, win32/setup.mak, win32/Makefile.sub: omitted
+ Win9x support. removed --enable/disable-win95 options.
+
+ * include/ruby/win32.h, file.c, win32/win32.c: ditto.
+
+ * win32/README.win32: ditto.
+
+Mon Jul 9 13:28:34 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (DLDFLAGS): use TARGET_ENTRY to specify an entry point
+ instead of TARGET which may contain non-identifier characters.
+
+ * lib/mkmf.rb (create_makefile): add TARGET_NAME which is the first
+ part consists of only word characters. [ruby-core:46248][Bug #6709]
+
+Sun Jul 8 07:36:19 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (shadowing_lvar_gen, warn_unused_var): no warnings for
+ variables starting with _. [ruby-core:46160][Feature #6693]
+
+Sat Jul 7 23:07:30 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+
+ * test/csv/test_features.rb: add require for Tempfile.
+ * test/csv/test_serialization.rb: ditto.
+
+Fri Jul 6 06:49:50 2012 Eric Hodel <drbrain@segment7.net>
+
+ * array.c (rb_ary_aref): Added a description of the behavior of
+ index positioning. [Bug #6680]
+ * array.c (rb_ary_aset): ditto. Reordered sentences for clarity.
+ * string.c (rb_str_aref_m): Added a description of the behavior of
+ index positioning
+
+Fri Jul 6 05:38:44 2012 Eric Hodel <drbrain@segment7.net>
+
+ * string.c (rb_str_bytesize): Improve documentation. Patch by Oscar
+ Del Ben from github issue #138.
+ * string.c (rb_str_empty): ditto.
+ * string.c (rb_str_times): ditto.
+ * string.c (rb_str_dump): ditto.
+ * string.c (rb_str_center): ditto.
+
+Fri Jul 6 04:05:59 2012 Eric Hodel <drbrain@segment7.net>
+
+ * ext/zlib/zlib.c (zstream_expand_buffer_without_gvl): Use
+ ruby_xrealloc() to avoid crash with CALC_EXACT_MALLOC_SIZE.
+
+Thu Jul 5 17:32:19 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * internal.h: move ThreadShield declarations from intern.h.
+
+Thu Jul 5 16:00:24 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread.c (ThreadShield): rename from Barrier.
+
+Thu Jul 5 15:14:50 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bootstraptest/runner.rb (show_progress): refine error output. do not
+ count non-empty error message, but just warn.
+
+ * bootstraptest/runner.rb (error): show errors immediately if tty.
+
+Thu Jul 5 12:28:11 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * test/net/http/test_httpresponses.rb: Add a test file for
+ Net::HTTPResponses and put a test case for the previous bug.
+
+Thu Jul 5 06:33:52 2012 Mark Dodwell <mark@mkdynamic.co.uk>
+
+ * lib/net/http/responses.rb: Fix 4xx classes to inherit correctly
+ from Net::HTTPClientError. [Bug #6700]
+
+Wed Jul 4 21:55:35 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ruby.c (proc_options): warn only if -K and -w option is specified.
+ see also r36274 [Feature #5206]
+
+Wed Jul 4 21:41:44 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * gc.c, atomic.h (ATOMIC_SIZE_*): moved from gc.c to atomic.h
+ [ruby-dev:45909]
+
+Wed Jul 4 19:13:15 2012 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * test/win32ole/test_win32ole.rb (test_s_codepage_changed):
+ FileSystemObject only supports ANSI or UTF-16LE encoding.
+ Patch by h.shirosaki (Hiroshi Shirosaki) [ruby-trunk - Bug #6650]
+
+Wed Jul 4 11:52:12 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * gc.c (ATOMIC_SIZE_*): 64bit Windows support.
+
+Wed Jul 4 11:11:28 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (rb_frame_callee, rb_f_callee_name): fix to return the
+ called id. this longstanding bug has been caused and blocked by
+ the structure of old rb_control_frame_t and rb_iseq_t.
+
+ * vm_insnhelper.c (vm_push_frame): set proper method entry.
+
+Wed Jul 4 08:29:31 2012 Eric Hodel <drbrain@segment7.net>
+
+ * array.c (rb_ary_aref): Updated documentation to indicate the
+ starting index is an index into the array or string. Updated
+ examples to show behavior of indexes at the end of an array or
+ string. Based on patch by Marcus Stollsteimer. [Bug #6680]
+ * array.c (rb_ary_aset): ditto.
+ * string.c (rb_str_aref): ditto. Also added descriptive argument
+ names to call-seq section.
+
+Wed Jul 4 07:05:59 2012 Eric Hodel <drbrain@segment7.net>
+
+ * test/zlib/test_zlib.rb (test_inflate_partial_input): Added test for
+ inflating incomplete zlib streams.
+
+Tue Jul 3 23:14:16 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * gc.c (ATOMIC_SIZE_EXCHANGE): fix function name on Solaris [Bug #6689]
+ [ruby-dev:45904]
+
+Tue Jul 3 16:07:49 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * gc.c (vm_malloc_fixup, vm_xrealloc, vm_xfree, after_gc_sweep): use
+ atomic operations to update malloc_params.
+
+Tue Jul 3 14:50:16 2012 Eric Hodel <drbrain@segment7.net>
+
+ * ext/zlib/zlib.c (zstream_run_func): Don't exit run loop for buffer
+ error. [Feature #6615]
+ * ext/zlib/zlib.c: Fix style to match existing functions.
+
+Tue Jul 3 12:05:51 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/dl/cfunc.c (rb_dlcfunc_call): also needed the workaround for VC8
+ for x64. [ruby-dev:45875] [Bug #6676]
+ reported by aves_ramphastos (Seigo Ishigane)
+
+Tue Jul 3 11:56:46 2012 Eric Hodel <drbrain@segment7.net>
+
+ * ext/zlib/zlib.c (zstream_detach_buffer): Refactored tainting of
+ output string, moving it from the callee to zstream_detach_buffer.
+ * ext/zlib/zlib.c (rb_zstream_finish): ditto
+ * ext/zlib/zlib.c (rb_zstream_flush_next_out): ditto
+ * ext/zlib/zlib.c (rb_deflate_deflate): ditto
+ * ext/zlib/zlib.c (rb_deflate_flush): ditto
+ * ext/zlib/zlib.c (rb_inflate_inflate): ditto
+
+Tue Jul 3 11:16:06 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (runnable): make symbolic links to run in build directory.
+
+Tue Jul 3 10:46:06 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ruby.c (proc_options): warn if -K option is specified. [Feature #5206]
+
+Tue Jul 3 06:12:13 2012 Eric Hodel <drbrain@segment7.net>
+
+ * object.c (Init_Object): Added RDoc location pointers for
+ Kernel#methods, Kernel#protected_methods, Kernel#private_methods and
+ Kernel#public_methods. [Bug #6666]
+
+Tue Jul 3 06:02:54 2012 Eric Hodel <drbrain@segment7.net>
+
+ * ext/zlib/zlib.c (zstream_run): Process zlib streams without GVL.
+ [Feature #6615]
+ * NEWS: ditto.
+
+Mon Jul 2 22:13:04 2012 Tanaka Akira <akr@fsij.org>
+
+ * thread.c (rb_thread_aref): add explanation for why Thread#[] and
+ Thread#[]= are fiber-local and not thread-local.
+ reported by Julien A. [ruby-core:41606] [ruby-trunk - Bug #5750]
+
+Mon Jul 2 21:25:55 2012 Tanaka Akira <akr@fsij.org>
+
+ * time.c (timew_out_of_timet_range): specialization for
+ SIZEOF_TIME_T == SIZEOF_INT64_T.
+
+Mon Jul 2 17:06:32 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * class.c (rb_include_module): include modules after the origin.
+
+ * class.c (include_modules_at): skip prepended modules.
+
+ * class.c (rb_prepend_module): now basic.klass in ICLASS refers the
+ old original class/module. [ruby-dev:45868][Bug #6662]
+
+ * class.c (rb_mod_ancestors): ditto.
+
+ * vm_method.c (search_method): search method entry from the origin
+ iclass.
+
+Mon Jul 2 05:54:58 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: [ruby-core:46058].
+
+Mon Jul 2 05:35:43 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c (d_lite_marshal_load): accepts old dump.
+
+Mon Jul 2 03:21:53 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * README.EXT.ja: fixed args of have_struct_member() ,
+ create_makefile() same as r35977. however, mkmf.rb include
+ no Japanese-docs, so Appendix C was not removed. [Bug #6597]
+
+Fri Jun 29 05:08:41 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/test/unit/parallel.rb: workaround fix for rubygems.
+ RubyGems can't find rake if the source directory is not equal to
+ the directory which is running the test. [Bug #6604]
+
+Thu Jun 28 20:33:15 2012 Luis Lavena <luislavena@gmail.com>
+
+ * test/win32ole/test_win32ole.rb (test_s_codepage_changed):
+ FileSystemObject only supports ANSI or UTF-16LE encoding.
+ Patch by bosko (Bosko Ivanisevic) [ruby-trunk - Bug #6650]
+
+Thu Jun 28 09:27:09 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+
+ * class.c (class_instance_method_list): consider prepended Class/Module
+ when recur != 0. [ruby-dev:45863] [Bug #6660]
+
+ * test/ruby/test_module.rb (test_prepend_instance_methods_false): add
+ a test for it.
+
+
+Thu Jun 28 06:12:42 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * class.c (rb_mod_ancestors): fix ancestors order.
+ [ruby-core:45919][Bug #6658] [ruby-dev:45861][Bug #6659]
+
+Wed Jun 27 21:28:59 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * lib/racc/parser.rb: NotImplementError is not exist.
+
+ * lib/irb/output-method.rb (IRB::OutputMethod#print): ditto.
+
+Wed Jun 27 21:31:13 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * class.c (rb_prepend_module): ancestors of prepending module also
+ should be included. [ruby-core:45914][Bug #6654]
+
+Wed Jun 27 21:01:32 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * class.c (class_instance_method_list): m_tbl in prepended
+ class/module is NULL. [ruby-core:45915][Bug #6655]
+
+Wed Jun 27 16:48:48 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * class.c (rb_prepend_module): prepend module into another module.
+
+ * eval.c (rb_mod_prepend): new method Module#prepend. [Feature #1102]
+
+Wed Jun 27 09:15:46 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (is_popen_fork): check if fork and raise NotImplementedError if
+ unavailable.
+
+ * io.c (rb_io_s_popen): allow environment variables hash and exec
+ options as flat parameters, not in an array arguments.
+ [Feature#6651] [EXPERIMENTAL]
+
+ * process.c (rb_execarg_extract_options): extract exec options, but no
+ exceptions on non-exec options and returns them as a Hash.
+
+ * process.c (rb_execarg_setenv): set environment variables.
+
+Tue Jun 26 16:57:14 2012 Koichi Sasada <ko1@atdot.net>
+
+ * thread_pthread.c (register_cached_thread_and_wait):
+ return immediately if malloc() failed.
+ [ruby-core:43960] [ruby-trunk - Bug #6235]
+
+ * thread_pthread.c (USE_THREAD_CACHE): check already defined or not.
+
+Tue Jun 26 10:01:56 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (rb_io_s_popen): revert r36213 "popen: shell commands with
+ envvar" because it disabled to let single command bypass shell.
+
+Mon Jun 25 17:49:28 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * class.c (rb_mix_module): revert Module#mix.
+
+Mon Jun 25 16:57:38 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * proc.c (rb_mod_define_method): allow method transplanting from a
+ module to either class or module. [ruby-core:34267][Feature #4254]
+
+Mon Jun 25 11:34:45 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * internal.h: use rb_pid_t instead of pid_t because of there is no
+ definition of pid_t here on Windows.
+
+Mon Jun 25 00:25:01 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in (for stack end address): remove human68k specific
+ check. It is no longer supported.
+
+Sun Jun 24 23:02:17 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (pipe_open): merge win32 code using spawnv().
+
+Sun Jun 24 22:53:42 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * process.c (check_exec_fds): separate check_exec_fds_1() since
+ nonstatic initializer of an aggregate type is not allowed by C89.
+
+Sun Jun 24 07:47:17 2012 Tanaka Akira <akr@fsij.org>
+
+ * internal.h (rb_execarg): options field removed.
+
+ * process.c: follow the rb_execarg change.
+
+Sat Jun 23 23:48:21 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (proc_spawn_cmd): unused variable removed to suppress a
+ warning.
+ (save_env): ditto.
+
+ [ruby-core:45797] reported by Luis Lavena.
+
+Sat Jun 23 23:19:31 2012 Tanaka Akira <akr@fsij.org>
+
+ * internal.h (rb_execarg): add new_pgroup_given and new_pgroup_flag
+ fields.
+
+ * process.c (EXEC_OPTION_NEW_PGROUP): removed.
+ (proc_spawn_cmd): take a struct rb_execarg argument.
+ use the new fields.
+ (rb_execarg_addopt): use the new fields.
+ (rb_spawn_process): follow the proc_spawn_cmd change.
+
+ [ruby-core:45794] [ruby-trunk - Bug #6633] reported by Luis Lavena.
+
+Sat Jun 23 20:26:36 2012 Tanaka Akira <akr@fsij.org>
+
+ * internal.h (rb_execarg): add fd_dup2, fd_close, fd_open,
+ fd_dup2_child fields.
+
+ * process.c (EXEC_OPTION_DUP2): removed.
+ (EXEC_OPTION_CLOSE): removed.
+ (EXEC_OPTION_OPEN): removed.
+ (EXEC_OPTION_DUP2_CHILD): removed.
+ (mark_exec_arg): mark the new fields.
+ (check_exec_redirect1): change condition for default option.
+ (check_exec_redirect): take a struct rb_execarg argument.
+ use the new fields.
+ (rb_execarg_addopt): follow the check_exec_redirect change.
+ (check_exec_fds): use the new fields.
+ (save_redirect_fd): ditto.
+
+Sat Jun 23 19:01:18 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_execarg_fixup): fix envopts condition.
+
+Sat Jun 23 18:44:13 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (check_exec_redirect1): extracted from
+ check_exec_redirect.
+
+Sat Jun 23 17:22:02 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (save_env): don't use EXEC_OPTION_UNSETENV_OTHERS.
+ (rb_execarg_run_options): ditto.
+
+Sat Jun 23 17:04:08 2012 Tanaka Akira <akr@fsij.org>
+
+ * internal.h (rb_execarg): add env_modification field.
+
+ * process.c (EXEC_OPTION_ENV): removed.
+ (mark_exec_arg): mark env_modification field.
+ (rb_exec_fillarg): update the new field, instead of options array.
+ (rb_execarg_fixup): use the new field.
+ (save_env): ditto.
+ (rb_execarg_run_options): ditto.
+
+Sat Jun 23 16:27:01 2012 Tanaka Akira <akr@fsij.org>
+
+ * internal.h (rb_execarg): add rlimit_limits field.
+
+ * process.c (EXEC_OPTION_RLIMIT): removed.
+ (mark_exec_arg): mark rlimit_limits field.
+ (rb_execarg_addopt): update the new fields, instead of options array.
+ (run_exec_rlimit): use the new field.
+ (rb_execarg_run_options): clear sarg using MEMZERO. use the new
+ field.
+
+Sat Jun 23 14:29:25 2012 Tanaka Akira <akr@fsij.org>
+
+ * internal.h (rb_execarg): add chdir_given and chdir_dir fields.
+
+ * process.c (EXEC_OPTION_CHDIR): removed.
+ (mark_exec_arg): mark chdir_dir field.
+ (rb_execarg_addopt): update the new fields, instead of options array.
+ (rb_execarg_run_options): use the new fields.
+
+Sat Jun 23 13:20:47 2012 Tanaka Akira <akr@fsij.org>
+
+ * internal.h (rb_execarg): add close_others_given, close_others_do and
+ close_others_maxhint fields.
+
+ * process.c (EXEC_OPTION_CLOSE_OTHERS): removed.
+ (rb_execarg_addopt): update the new fields, instead of options array.
+ (check_exec_fds): take eargp as an argument. update the
+ close_others_maxhint field.
+ (rb_execarg_fixup): follow the argument change of check_exec_fds.
+ (rb_execarg_run_options): use the new fields.
+
+Sat Jun 23 10:41:59 2012 Tanaka Akira <akr@fsij.org>
+
+ * internal.h (rb_execarg): add unsetenv_others_given and
+ unsetenv_others_do fields.
+
+ * process.c (EXEC_OPTION_UNSETENV_OTHERS): removed.
+ (rb_execarg_addopt): update the new fields, instead of options array.
+ (rb_execarg_fixup): use the new fields.
+
+Sat Jun 23 09:35:47 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c: use the variable name "soptions" for sargp->options.
+
+Sat Jun 23 09:17:49 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c: use the name "sargp" for struct rb_execarg variables
+ consistently for saving process attributes.
+
+ * io.c: ditto.
+
+Sat Jun 23 07:59:57 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c: use the name "eargp" for struct rb_execarg variables
+ consistently except for saving process attributes.
+
+ * io.c: ditto.
+
+ * ext/pty/pty.c: ditto.
+
+Wed Jun 20 18:27:03 2012 Yuki Yugui Sonoda <yugui@google.com>
+
+ * common.mk: Add missing dependencies.
+
+Fri Jun 22 20:27:39 2012 Tanaka Akira <akr@fsij.org>
+
+ * internal.h (rb_execarg): add pgroup_given and pgroup_pgid fields.
+
+ * process.c (EXEC_OPTION_PGROUP): removed.
+ (rb_execarg_addopt): update the new fields, instead of options array.
+ (run_exec_pgroup): take a struct rb_execarg argument. refer the new
+ fields.
+ (rb_execarg_run_options): follow run_exec_pgroup change.
+
+Fri Jun 22 18:48:51 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * README.EXT, README.EXT.ja: use "sval" for the third argument
+ name of Data_Wrap_Struct().
+ Suggested by @satoh_fumiyasu. Thanks!!!
+
+Fri Jun 22 18:04:26 2012 Koichi Sasada <ko1@atdot.net>
+
+ * iseq.c, vm_eval.c: set th->base_block properly.
+ th->base_block is information for (a) parsing, (b) compiling
+ and (c) setting up the frame to execute the program passed by
+ `eval' method. For example, (1) parser need to know up-level
+ variables to detect it is variable or method without paren.
+ Befor (a), (b) and (c), VM set th->base_block by passed bindng
+ (or previous frame information). After execute (a), (b) and (c),
+ VM should clear th->base_block. However, if (a), (b) or (c)
+ raises an exception, then th->base_block is not cleared.
+ Problem is that the uncleared value th->balo_block is used for
+ irrelevant iseq compilation. It causes SEGV or critical error.
+ I tried to solve this problem: to clear them before exception,
+ but finally I found out that it is difficult to do it (Ruby
+ program can be run in many places).
+ Because of this background, I set th->base_block before
+ compiling iseq and restore it after compiling.
+ Basically, th->base_block is dirty hack (similar to global
+ variable) and this patch is also dirty.
+
+ * bootstraptest/test_eval.rb: add a test for above.
+
+ * internal.h: remove unused decl.
+
+ * iseq.c (rb_iseq_compile_with_option): add base_block parameter.
+ set th->base_block before compilation and restore it after
+ compilation.
+
+ * ruby.c (require_libraries): pass 0 as base_block instead of
+ setting th->base_block
+
+ * tool/compile_prelude.rb (prelude_eval): apply above changes.
+
+ * vm.c, vm_eval.c: ditto.
+
+ * vm_core.h: add comments.
+
+Fri Jun 22 18:19:38 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c: pass struct rb_execarg value instead of its options
+ field for saving process attribute changing functions.
+ (save_redirect_fd): take a struct rb_execarg argument.
+ (run_exec_dup2): ditto.
+ (run_exec_close): ditto.
+ (run_exec_open): ditto.
+ (run_exec_dup2_child): ditto.
+ (run_exec_pgroup): ditto.
+ (run_exec_rlimit): ditto.
+ (save_env): ditto.
+ (rb_execarg_run_options): follow the above functions change.
+
+Fri Jun 22 17:55:48 2012 Koichi Sasada <ko1@atdot.net>
+
+ * test/ruby/test_backtrace.rb: decrease recursion depth
+ to reduce consuming stack size.
+
+Fri Jun 22 13:36:50 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * random.c (random_init, random_load): cannot initialize frozen object
+ again, nor with tainted/untrusted object. [Bug #6540]
+
+Fri Jun 22 13:32:33 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * error.c (rb_check_copyable): new function, to ensure the target is
+ not frozen and the source is not tainted nor untrusted.
+
+Fri Jun 22 05:55:20 2012 Eric Hodel <drbrain@segment7.net>
+
+ * eval.c (ruby_cleanup): Fixed typo. Patch by Trever Dawe.
+ Fixes #131 (github). [ruby-trunk - Bug #6619]
+
+Thu Jun 21 21:16:58 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_execarg_addopt): take a VALUE argument instead of
+ struct rb_execarg.
+ (rb_exec_arg_addopt): follow the rb_execarg_addopt change.
+ (check_exec_options_i): ditto.
+
+ * io.c (pipe_open): follow the rb_execarg_addopt change.
+
+ * internal.h (rb_execarg_addopt): follow the definition change.
+
+Thu Jun 21 20:34:19 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_exec_fillarg): take a VALUE argument instead of
+ struct rb_execarg.
+ (rb_check_exec_options): ditto.
+ (check_exec_options_i): ditto.
+
+Thu Jun 21 19:48:05 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_exec_async_signal_safe): use rb_execarg_run_options
+ instead of rb_run_exec_options_err.
+ (rb_spawn_process): ditto.
+
+Thu Jun 21 19:02:43 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_exec_fillarg): take a VALUE argument instead of
+ struct rb_execarg.
+ (rb_execarg_init): follow the rb_exec_fillarg change.
+
+Thu Jun 21 18:36:43 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_execarg_init): take a VALUE argument instead of
+ struct rb_execarg.
+ (rb_execarg_new): follow the rb_execarg_init change.
+ (rb_exec_arg_init): ditto.
+
+ * internal.h (rb_execarg_init): follow the definition change.
+
+Thu Jun 21 17:20:44 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (new_args_tail_gen): fix GC problem of keyword rest
+ argument. the wrapped struct should be bound to the wrapping node
+ before assignment of child nodes, to get rid of the case the
+ children are referred by only the struct pointer which is not a
+ subject of GC. [ruby-core:45744]
+
+Thu Jun 21 07:06:52 2012 Koichi Sasada <ko1@atdot.net>
+
+ * error.c (err_append): rename err_append() to compile_err_append()
+ and move definition body. err_append() is used only by compiling.
+
+Thu Jun 21 06:21:54 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_execarg_fixup): take a VALUE argument instead of
+ struct rb_execarg.
+
+ * internal.h (rb_execarg_fixup): follow the definition change.
+
+ * io.c (pipe_open): follow rb_execarg_fixup change.
+
+ * ext/pty/pty.c (establishShell): ditto.
+
+Wed Jun 20 21:25:37 2012 Tanaka Akira <akr@fsij.org>
+
+ * internal.h (struct rb_execarg): add umask_given and umask_mask
+ fields.
+
+ * process.c (STATIC_ASSERT): removed.
+ (rb_execarg_addopt): follow the rb_execarg change.
+ (rb_execarg_run_options): ditto.
+
+Wed Jun 20 20:38:23 2012 Tanaka Akira <akr@fsij.org>
+
+ * internal.h (struct rb_execarg) moved and renamed from
+ struct rb_exec_arg in intern.h.
+
+ * include/ruby/intern.h (struct rb_exec_arg): refer Data object which
+ contains struct rb_execarg.
+
+ * process.c: use struct rb_execarg instead of struct rb_exec_arg
+ except functions declared in intern.h.
+ (rb_exec_arg_addopt): extract a pointer to struct rb_execarg from
+ struct rb_exec_arg.
+ (rb_exec_arg_init): ditto.
+ (rb_exec_arg_fixup): ditto.
+ (rb_run_exec_options_err): ditto.
+ (rb_run_exec_options): ditto.
+ (rb_exec_err): ditto.
+ (rb_exec): ditto.
+
+ * io.c: use struct rb_execarg instead of struct rb_exec_arg.
+
+ * ext/pty/pty.c: ditto.
+
+Wed Jun 20 19:13:25 2012 Tanaka Akira <akr@fsij.org>
+
+ * internal.h (rb_execarg_new): declared.
+ (rb_execarg_get): ditto.
+
+ * process.c (mark_exec_arg): new function.
+ (free_exec_arg): ditto.
+ (memsize_exec_arg): ditto.
+ (exec_arg_data_type): defined.
+ (rb_execarg_new): new function.
+ (rb_execarg_get): ditto.
+ (rb_f_exec): use rb_execarg_new.
+ (rb_spawn_internal): ditto.
+ (rb_f_spawn): ditto.
+
+ * io.c (pipe_open_v): use rb_execarg_new.
+ (pipe_open_s): ditto.
+
+ * ext/pty/pty.c (establishShell): use rb_execarg_new.
+
+Wed Jun 20 16:36:14 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * missing/setproctitle.c (environ): use (*_NSGetEnviron()) instead of
+ environ on Darwin for namespace cleanness, same as [ruby-core:00537].
+ [ruby-core:45615] [Bug #6576]
+
+Wed Jun 20 11:33:04 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * process.c (rb_execarg_addopt): always make Fixnum, and ignore higher
+ bits in too large umask value.
+
+Wed Jun 20 11:24:35 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit.rb (Test::Unit::Runner#_run_parallel): deal with
+ sudden-death of workers.
+
+Mon Jun 18 20:34:20 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * time.c (init_leap_second_info): fix non-ANSI function declaration.
+
+Mon Jun 18 20:29:04 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * ruby.c (rb_f_sub): use ansi style declaration.
+ * ruby.c (rb_f_gsub): ditto.
+ * ruby.c (rb_f_chomp): ditto.
+
+Mon Jun 18 20:26:23 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * random.c (rb_random_int32): get rid of "warning: constant 0x100000000
+ is so big it is long" warning.
+
+Mon Jun 18 20:07:23 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * dir.c (dir_initialize): get rid of "unused return: argc = rb_scan_args()"
+ warning.
+
+Mon Jun 18 19:31:20 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * include/ruby/missing.h: include math.h before checking INFINITY
+ and NAN. Otherwise, strange macro redefinition will occur.
+
+Mon Jun 18 19:12:37 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * array.c (ary_reverse): use ansi style declaration.
+
+Tue Jun 19 18:43:50 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/backward/rubysig.h: fix visibility. [Bug #6607]
+
+Tue Jun 19 17:51:54 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * process.c (rb_execarg_run_options): do not call any methods in the
+ async-signal-safe function. mask has been checked with NUM2MODET()
+ already and converted with LONG2NUM().
+
+Tue Jun 19 11:59:56 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/readline/readline.c (Init_readline): don't set 0 to
+ rl_catch_signals and rl_catch_sigwinch. [Bug #5423]
+
+Tue Jun 19 11:52:59 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/readline/readline.c (readline_s_get_special_prefixes): suppress
+ warning: uninitialized instance variable.
+
+Tue Jun 19 11:43:16 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/readline/readline.c (readline_getc): fix editline compatibility
+ broken by r36123. [Bug #6601]
+
+Mon Jun 18 17:10:08 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (rb_str_subpos): split from rb_str_substr. returns
+ adjusted position for substring.
+
+Mon Jun 18 10:42:57 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/readline/readline.c (readline_getc): deal with ESC just followed
+ by ASCII as meta prefix in incremental search mode. based on the
+ patch from rctay (Tay Ray Chuan) at [ruby-core:45682]. [Bug #6601]
+
+Sun Jun 17 22:23:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dir.c (rb_file_directory_p): move documentation for Dir.exist? from
+ file.c so that the proper description will be shown instead of the
+ documentation of File.directory?. [ruby-core:45685]
+
+Sun Jun 17 16:21:01 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread_win32.h (rb_thread_lock_t): make a union for USE_WIN32_MUTEX.
+ this internal is used only in thread_win32.c, but has to be complete
+ to define rb_thread_t.
+
+ * thread_win32.c (native_mutex_lock, native_mutex_destroy): fix for
+ USE_WIN32_MUTEX.
+
+ * thread_win32.c (native_cond_timedwait_ms): rename reserved pattern
+ name. user defined symbols should not start with __.
+
+Sat Jun 16 19:24:01 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: define date_sg_t.
+
+Sat Jun 16 18:46:57 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_tmx.h: offset in struct tmx_funcs is now int.
+ * ext/date/date_strftime.c: ditto.
+ * ext/date/date_core.c: ditto.
+
+Sat Jun 16 18:31:46 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval.c (ruby_setup): set running state in the normal case before
+ popping a tag.
+
+Sat Jun 16 07:46:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit.rb (Test::Unit::Runner#_run_parallel): format workers
+ results in the parent.
+
+Sat Jun 16 07:12:56 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * tool/runruby.rb (File.realpath): return real path of expanded path.
+ [Bug #6598]
+
+Sat Jun 16 07:12:28 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bootstraptest/runner.rb (main): ignore -j option for compatibility
+ with test/unit.
+
+Sat Jun 16 07:11:52 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit.rb (Test::Unit::Runner#puke): modify only result and
+ drop useless reports, not override entirely.
+
+ * lib/test/unit/parallel.rb (Test::Unit::Worker#_run_suite): report
+ unformatted results. formatting messages is not a workers task.
+
+ * lib/test/unit/parallel.rb (Test::Unit::Worker#puke): store raw
+ results.
+
+Sat Jun 16 01:27:14 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych.rb: bumping psych to 1.3.3
+ * ext/psych/psych.gemspec: ditto
+
+Fri Jun 15 20:54:28 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * vm_backtrace.c (backtrace_collect): rename from backtreace_collect.
+
+Fri Jun 15 19:22:13 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_core.h: remove VM_FRAME_MAGIC_FINISH (finish frame type).
+ Before this commit:
+ `finish frame' was place holder which indicates that VM loop
+ needs to return function.
+ If a C method calls a Ruby methods (a method written by Ruby),
+ then VM loop will be (re-)invoked. When the Ruby method returns,
+ then also VM loop should be escaped. `finish frame' has only
+ one instruction `finish', which returns VM loop function.
+ VM loop function executes `finish' instruction, then VM loop
+ function returns itself.
+ With such mechanism, `leave' instruction (which returns one
+ frame from current scope) doesn't need to check that this `leave'
+ should also return from VM loop function.
+ Strictly, one branch can be removed from `leave' instruction.
+ Consideration:
+ However, pushing the `finish frame' needs costs because
+ it needs several memory accesses. The number of pushing
+ `finish frame' is greater than I had assumed. Of course,
+ pushing `finish frame' consumes additional control frame.
+ Moreover, recent processors has good branch prediction,
+ with which we can ignore such trivial checking.
+ After this commit:
+ Finally, I decide to remove `finish frame' and `finish'
+ instruction. Some parts of VM depend on `finish frame',
+ so the new frame flag VM_FRAME_FLAG_FINISH is introduced.
+ If this frame should escape from VM function loop, then
+ the result of VM_FRAME_TYPE_FINISH_P(cfp) is true.
+ `leave' instruction checks this flag every time.
+ I measured performance on it. However on my environments,
+ it improves some benchmarks and slows some benchmarks down.
+ Maybe it is because of C compiler optimization parameters.
+ I'll re-visit here if this cause problems.
+
+ * insns.def (leave, finish): remove finish instruction.
+
+ * vm.c, vm_eval.c, vm_exec.c, vm_backtrace.c, vm_dump.c:
+ apply above changes.
+
+Fri Jun 15 19:11:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit.rb (Test::Unit::Runner#puke): always add skipped
+ results to the report for parallel test. [Bug #6595]
+
+Fri Jun 15 09:01:35 2012 Yuki Yugui Sonoda <yugui@google.com>
+
+ * nacl/pepper_main.c: Removed an unnecessary and erroneous inclusion.
+
+Thu Jun 14 22:59:56 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (RUBY_CPPOUTFILE): check if output is really sent to
+ specified file to tell if -o option works. [ruby-dev:45742]
+ [Bug#6591]
+
+ * configure.in (RUBY_CPPOUTFILE): check if output file is actually
+ created. [ruby-dev:45742] [Bug#6591]
+
+Thu Jun 14 22:10:50 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (proc_exec_sh): don't strip leading spaces of the script.
+
+Thu Jun 14 15:54:02 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * file.c (rb_file_s_basename, rb_file_s_dirname): documentation fix.
+ File.basename and File.dirname support File::ALT_SEPARATOR.
+
+Thu Jun 14 11:10:10 2012 Yuki Yugui Sonoda <yugui@google.com>
+
+ * nacl/pepper_main.c: Applies the new embedding API to pepper_ruby.
+
+Thu Jun 14 10:44:41 2012 Yuki Yugui Sonoda <yugui@google.com>
+
+ * include/ruby/ruby.h: Grouped APIs for embedding CRuby interpreter.
+ (ruby_setup, ruby_compile_main_from_file,
+ ruby_compile_main_from_string, ruby_eval_main,
+ ruby_set_script_name): new APIs to embed CRuby.
+ (ruby_opaque_t) Opaque pointer to an internal data, to NODE or iseq
+ in particular.
+
+ * eval.c (ruby_setup): Similar to ruby_init but returns an error code
+ instead of exit(3) on error.
+ (ruby_eval_main): Similar to ruby_exec_node but returns the
+ evaluation result.
+ (ruby_eval_main_internal): renamed from ruby_exec_internal.
+
+ * ruby.c (toplevel_context): new helper function.
+ (PREPARE_EVAL_MAIN): moved.
+ (process_options): refactored with new functions.
+ (parse_and_compile_main) new helper function.
+ (ruby_compile_main_from_file, ruby_compile_main_from_string) new API
+ (ruby_set_script_name): new API.
+
+
+Thu Jun 14 10:39:48 2012 Yuki Yugui Sonoda <yugui@google.com>
+
+ * eval.c: Add doxygen comments.
+
+ * ruby.c: ditto.
+
+ * thread_pthread.c: ditto
+
+ * version.c: ditto.
+
+ * vm_core.h: ditto.
+
+Thu Jun 14 10:16:07 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * configure.in: revert r36071 and add NetBSD to blacklist of -ansi.
+
+Thu Jun 14 07:59:12 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * thread_pthread.c (get_stack): Linux is the only OS which includes
+ the size of guard page into the stack size.
+
+Thu Jun 14 06:21:00 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/drb/drb.rb: Replace broken links to the English DRb book.
+ Patch by Zachary Scott. [ruby-trunk - Bug #6544]
+
+Thu Jun 14 06:17:47 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/observer.rb: Update broken link to the Programming Ruby book.
+ Patch by Zachary Scott. [ruby-trunk - Bug #6536]
+ * lib/drb/drb.rb: ditto.
+
+Thu Jun 14 05:23:05 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * regparse.c (PFETCH_READY): suppress Wunused-but-set-variable.
+
+ * regparse.c (is_onechar_cclass): restructured to clarify that c is
+ used iff found == 1.
+
+Thu Jun 14 02:54:17 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * configure.in: use -fbuiltin with -ansi -std=iso9899:199409.
+ This prevents errors introduced by disabling builtin functions,
+ which is the sub-effect of -ansi/-std.
+ Now NetBSD can use -ansi -std=iso9899:199409.
+ Maybe mingw, cygwin and darwin can also.
+
+Thu Jun 14 02:53:30 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * Makefile.in: don't remove macros. now name2ctype uses macros.
+
+ * tool/enc-unicode.rb: add comment why it uses Hash#index.
+
+ * enc/unicode/{name2ctype.kwd,name2ctype.src,name2ctype.h.blt}:
+ update to follow the current name2ctype.h.
+ FYI current Unicode version is 6.1.
+
+Thu Jun 14 00:16:59 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/net/http/responses.rb, lib/webrick/httpstatus.rb: Add HTTP
+ response codes added in RFCs 2817 and 4918. [ruby-core:45547]
+ [Feature #6569]
+
+ * lib/net/http/responses.rb: Rename Net::HTTPMultipleChoice to
+ Net::HTTPMultipleChoices, leaving the former as alias to the
+ latter for backward compatibility. [ruby-core:45547]
+ [Feature #6569]
+
+ * lib/net/http/responses.rb: Add comments about unused,
+ still-in-draft and private extension response codes.
+ [ruby-core:45547] [Feature #6569]
+
+Wed Jun 13 22:44:32 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * test/dl/test_func.rb (test_qsort1, test_qsort2): use TYPE_SIZE_T
+ for size_t variables. [ruby-dev:45733] [Bug #6584]
+
+Wed Jun 13 22:18:01 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: remove -ansi and -std options for lgamma_r() and
+ finite().
+
+Wed Jun 13 21:46:34 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: cygwin does not provide some declarations in strict
+ ANSI mode.
+
+Wed Jun 13 20:19:59 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_fork_internal): move a variable declaration.
+
+Wed Jun 13 17:54:38 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * regparse.c (PFETCH_READY): this line was to suppress warning,
+ but did emit warnings if -Wuninitialized was set. Assigning
+ NULL instead if pfetch_prev should suffice the situation.
+
+Wed Jun 13 17:51:05 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: cygwin needs C99 for some stuff, e.g.,
+ pthread_attr_setstacksize, sched_yield.
+
+Wed Jun 13 17:50:43 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * Makefile.in (.c.i): add warnflags to make the result consistent with
+ compilation.
+
+Wed Jun 13 15:12:07 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * configure.in: On Windows platforms, system provided headers are
+ VC++ optimized. That is, C++ habits are often contaminated into
+ various headers. Most frequent situation is the use of //
+ comments. We bypass ANSI C mode for them. Otherwise extension
+ libs cannot include those headers.
+
+Wed Jun 13 13:39:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/win32.h: get rid of C99 style one line comments.
+
+Wed Jun 13 13:39:04 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * encoding.c (enc_alias_internal): use strdup defined as macro.
+
+Wed Jun 13 10:20:27 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * process.c (rb_exec_fillarg): get rid of SIZE_T_MAX which may need
+ more headers.
+
+ * process.c (rb_exec_fillarg): fix array element size. "continue" and
+ "readonly" exceeded the size.
+
+ * process.c (rb_exec_fillarg): use shell if the first word is reserved
+ or special built-in name.
+ http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html
+
+ * process.c (rb_exec_fillarg): treat '=' only in the first word. if
+ the first word does not contain '=', it is the command name and
+ environment assignments cannot be anymore.
+
+Tue Jun 12 23:45:36 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/mkmf.rb: add dummy clean-static target to prevent errors for the
+ case real clean-static target doesn't exist.
+
+Tue Jun 12 22:49:42 2012 Naohisa Goto <ngotogenome@gmail.com>
+
+ * process.c (rb_exec_arg_fixup): fix compile error
+
+Tue Jun 12 21:40:13 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_exec_fillarg): treat '=' character as a meta
+ character to detect assignments preceding command name.
+
+Tue Jun 12 20:29:19 2012 Tanaka Akira <akr@fsij.org>
+
+ * include/ruby/intern.h (rb_exec_arg_init): deprecated.
+ (rb_exec_arg_addopt): ditto.
+ (rb_exec_arg_fixup): ditto.
+ (rb_run_exec_options): ditto.
+ (rb_run_exec_options_err): ditto.
+
+ * internal.h (rb_execarg_init): declared.
+ (rb_execarg_addopt): ditto.
+ (rb_execarg_fixup): ditto.
+ (rb_execarg_run_options): ditto.
+
+ * process.c: call rb_execarg_addopt, rb_execarg_fixup,
+ rb_execarg_run_options, rb_execarg_init.
+ (rb_execarg_addopt): renamed from rb_exec_arg_addopt.
+ (rb_exec_arg_addopt): stub to call rb_execarg_addopt.
+ (rb_execarg_init): renamed from rb_exec_arg_init.
+ (rb_exec_arg_init): stub to call rb_execarg_init.
+ (rb_execarg_fixup): renamed from rb_exec_arg_fixup.
+ (rb_exec_arg_fixup): stub to call rb_execarg_fixup.
+ (rb_execarg_run_options): renamed from rb_run_exec_options_err.
+ (rb_run_exec_options_err): stub to call rb_execarg_run_options.
+ (rb_run_exec_options): call rb_execarg_run_options.
+
+ * io.c: call rb_execarg_addopt, rb_execarg_fixup,
+ rb_execarg_run_options, rb_execarg_init.
+
+ * ext/pty/pty.c (establishShell): call rb_execarg_init and
+ rb_execarg_fixup.
+
+Tue Jun 12 18:39:59 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * configure.in: enable strict ANSI mode by default in case of GCC,
+ requested by _ko1.
+
+Tue Jun 12 06:40:23 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_exec_fillarg): detect '#' as a meta character.
+
+Mon Jun 11 22:15:44 2012 Tanaka Akira <akr@fsij.org>
+
+ * include/ruby/intern.h (rb_proc_exec_n): deprecated.
+ (rb_exec): ditto.
+ (rb_exec_err): ditto.
+ (rb_fork): ditto.
+ (rb_fork_err): ditto.
+
+Mon Jun 11 18:49:52 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * configure.in: on checking libexecinfo, don't specify /use/local.
+ On FreeBSD people must specify --with-opt-dir or --with-execinfo-dir.
+
+Mon Jun 11 12:14:37 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_core.h: remove lfp (local frame pointer) and rename
+ dfp (dynamic frame pointer) to ep (environment pointer).
+ This change make VM `normal' (similar to other interpreters).
+ Before this commit:
+ Each frame has two env pointers lfp and dfp. lfp points
+ local environment which is method/class/toplevel frame.
+ lfp[0] is block pointer.
+ dfp is block local frame. dfp[0] points previous (parent)
+ environment pointer.
+ lfp == dfp when frame is method/class/toplevel.
+ You can get lfp from dfp by traversing previous environment
+ pointers.
+ After this commit:
+ Each frame has only `ep' to point respective environment.
+ If there is parent environment, then ep[0] points parent
+ environment (as dfp). If there are no more environment,
+ then ep[0] points block pointer (as lfp). We call such ep
+ as `LEP' (local EP). We add some macros to get LEP and to
+ detect LEP or not.
+ In short, we replace dfp and lfp with ep and LEP.
+ rb_block_t and rb_binding_t member `lfp' and `dfp' are removed
+ and member `ep' is added.
+ rename rb_thread_t's member `local_lfp' and `local_svar' to
+ `root_lep' and `root_svar'.
+ (VM_EP_PREV_EP(ep)): get previous environment pointer. This macro
+ assume that ep is not LEP.
+ (VM_EP_BLOCK_PTR(ep)): get block pointer. This macro assume
+ that ep is LEP.
+ (VM_EP_LEP_P(ep)): detect ep is LEP or not.
+ (VM_ENVVAL_BLOCK_PTR(ptr)): make block pointer.
+ (VM_ENVVAL_BLOCK_PTR_P(v)): detect v is block pointer.
+ (VM_ENVVAL_PREV_EP_PTR(ptr)): make prev environment pointer.
+ (VM_ENVVAL_PREV_EP_PTR_P(v)): detect v is prev env pointer.
+
+ * vm.c: apply above changes.
+ (VM_EP_LEP(ep)): get LEP.
+ (VM_CF_LEP(cfp)): get LEP of cfp->ep.
+ (VM_CF_PREV_EP(cfp)): utility function VM_EP_PREV_EP(cfp->ep).
+ (VM_CF_BLOCK_PTR(cfp)): utility function VM_EP_BLOCK_PTR(cfp->ep).
+
+ * vm.c, vm_eval.c, vm_insnhelper.c, vm_insnhelper.h, insns.def:
+ apply above changes.
+
+ * cont.c: ditto.
+
+ * eval.c, eval_intern.h: ditto.
+
+ * proc.c: ditto.
+
+ * thread.c: ditto.
+
+ * vm_dump.c: ditto.
+
+ * vm_exec.h: fix function name (on vm debug mode).
+
+Mon Jun 11 11:52:18 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * compile.c (iseq_set_sequence): nonstatic initializer of an
+ aggregate type is a C99ism.
+
+ * compile.c (enum compile_array_type_t): comma at the end of enum
+ list is a C99ism.
+
+ * vm_backtrace.c (enum LOCATION_TYPE): ditto.
+
+Mon Jun 11 06:31:33 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_proc_exec_n): revert the function removed at r35889.
+
+Mon Jun 11 06:20:50 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * thread_pthread.c (rb_thread_create_timer_thread): assign return
+ value to the variable err.
+
+Mon Jun 11 06:17:06 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * thread_pthread.c (native_cond_initialize): fix typo in r36022.
+ this cause a failure on FreeBSD 8.2 amd64.
+ http://fbsd.rubyci.org/~chkbuild/ruby-trunk/log/20120610T130201Z.diff.html.gz
+
+Mon Jun 11 05:21:57 2012 Koichi Sasada <ko1@atdot.net>
+
+ * .gdbinit (SDR): add SDR function. It's only for VM debugging.
+
+Sun Jun 10 21:50:45 2012 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * nacl/nacl_config.rb: Fixed for 32bit hosts.
+
+Sun Jun 10 20:23:14 2012 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ Fixes threading on NativeClient.
+
+ * thread_pthread.c (timer_thread_sleep): Extracted out a function from
+ thread_timer(). Added an alternative implementation for platforms
+ that lacks select(2) or pipe(2).
+ (rb_thread_create_timer_thread, native_cond_initialize,
+ native_cond_destroy): Replaced wrong HAVE_XXX checks.
+
+ * configure.in (pthread_attr_init): New check.
+
+Sun Jun 10 21:30:11 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_exec_without_timer_thread): renamed from rb_exec_err.
+ (rb_exec_err): new stub function to call
+ rb_exec_without_timer_thread.
+ (rb_f_exec): call rb_exec_without_timer_thread.
+ (rb_exec): call rb_exec_without_timer_thread.
+
+Sun Jun 10 21:13:10 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_fork): call rb_fork_internal instead of rb_fork_err.
+
+Sun Jun 10 20:55:59 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_fork_ruby): call rb_fork_internal directly.
+
+Sun Jun 10 20:19:40 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_fork_ruby): new function.
+ (rb_f_fork): use rb_fork_ruby instead of rb_fork.
+ (rb_daemon): ditto.
+
+ * io.c (pipe_open): use rb_fork_ruby instead of rb_fork.
+
+ * internal.h (rb_fork_ruby): declared.
+
+Sun Jun 10 18:58:16 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/net/http/response.rb: Remove a duplicated rdoc and leave a
+ pointer.
+
+ * lib/net/http/responses.rb: Add RFC numbers to base on.
+
+Sun Jun 10 18:31:42 2012 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * configure.in (RUBY_NACL): Warns if $PATH does not contain the path
+ to NativeClient SDK. PATH variable redefinition in GNUmakefile does
+ not work for GNU make 3.81.
+
+Sun Jun 10 17:54:36 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * gc.h (IS_STACK_DIR_UPPER): utility macro.
+
+ * thread_pthread.c (get_stack): seems stack size does not include
+ guard size on Mac OS X.
+
+ * thread_pthread.c (ruby_init_stack): adjust stack size for offset of
+ addr from the bottom.
+
+Sun Jun 10 15:49:47 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (retry_fork): call after_fork except in a child process.
+ (rb_fork_internal): restrict after_fork call condition.
+
+Sun Jun 10 14:19:33 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * configure.in: NetBSD 6 adds libexecinfo but it only works on amd64.
+ http://www.mail-archive.com/source-changes-full@netbsd.org/msg38729.html
+
+Sun Jun 10 12:43:23 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_f_exec): call rb_exec_async_signal_safe except on
+ Mac OS X. cf. the comment in before_exec_non_async_signal_safe.
+
+Sun Jun 10 12:15:18 2012 Tanaka Akira <akr@fsij.org>
+
+ * io.c (popen_exec): don't call rb_thread_atfork_before_exec. use
+ rb_exec_async_signal_safe instead of rb_exec_err.
+ (pipe_open): use rb_fork_async_signal_safe instead of rb_fork_err.
+
+Sun Jun 10 11:44:57 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_fork_internal): call after_fork only unless
+ chfunc_is_async_signal_safe.
+
+Sun Jun 10 11:33:01 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_pkey_ec.c
+ test/openssl/test_pkey_ec.rb: Add support for EC_POINT_mul.
+ Patch provided by Sambasiva Suda. Thanks!
+ [ruby-core:44408][ruby-trunk - Feature #6310]
+
+Sun Jun 10 10:48:15 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * lib/openssl/ssl.rb: Use a simple random number to generate the
+ session id. MD5, as was used before, causes problems when
+ using a FIPS version of OpenSSL. Issue was found by Jared
+ Jennings, thank you!
+ [ruby-trunk - Bug #6137]
+
+Sun Jun 10 10:27:34 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * NEWS: Add note about the new private key export behavior.
+
+Sun Jun 10 10:24:51 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_exec_async_signal_safe): exported.
+
+ * ext/pty/extconf.rb: modify $INCFLAGS to include internal.h
+
+ * ext/pty/pty.c: include internal.h.
+ (chfunc): don't call rb_thread_atfork_before_exec. use
+ rb_exec_async_signal_safe instead of rb_f_exec.
+ (establishShell): set up earg. use rb_fork_async_signal_safe
+ instead of rb_fork_err.
+
+ * internal.h (rb_exec_async_signal_safe): declared.
+ (rb_fork_async_signal_safe): declared.
+
+Sun Jun 10 10:21:37 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl.c
+ ext/openssl/ossl_pkey_rsa.c
+ ext/openssl/ossl_pkey_dsa.c
+ ext/openssl/ossl_pkey_ec.c: Forbid export passwords that are less
+ than four characters long, as OpenSSL itself does not allow this.
+ Issue found by Eric Hodel.
+ * ext/openssl/ossl_pkey_ec.c: Add export as an alias of to_pem,
+ following the PKey interface contract.
+ * test/openssl/test_pkey_dsa.rb
+ test/openssl/test_pkey_rsa.rb
+ test/openssl/test_pkey_ec.rb: Add tests that assert correct
+ behaviour when dealing with passwords that are less than four
+ characters long.
+ [ruby-core: 42281][ruby-trunk - Bug #5951]
+
+Sun Jun 10 10:14:26 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_f_exec): use rb_exec_arg_prepare.
+
+Sun Jun 10 06:43:51 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c: split after_exec into async-signal-safe part and rest.
+ (after_exec_async_signal_safe): extracted from after_exec.
+ (after_exec_non_async_signal_safe): ditto.
+ (after_exec): call them.
+ (rb_exec_async_signal_safe): call after_exec_async_signal_safe.
+ (rb_exec_err): call after_exec_non_async_signal_safe instead of
+ after_exec.
+
+Sun Jun 10 06:21:10 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * NEWS: document new features of Ruby OpenSSL.
+
+Sun Jun 10 03:09:41 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl.c: Fix error in example. Patch by David Albert.
+
+ Add/extend existing documentation. Examples now also cover RSA
+ signatures and PBKDF2.
+ [ruby-core: 45154][ruby-trunk - Bug #6475]
+
+
+Sun Jun 10 01:41:45 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_ssl.c: Introduce SSLContext#renegotiation_cb and
+ remove SSLContext#disable_client_renegotiation and related
+ functionality introduced in r35797. The new callback approach
+ gives clients maximum flexibility to decide on their own what to
+ do on renegotiation attempts.
+ Add documentation for SSL module and SSLError.
+ * test/openssl/test_ssl.rb: Add a test for
+ SSLContext#renegotiation_cb.
+
+Sun Jun 10 01:37:18 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_fork_internal): initialize exc.
+
+Sun Jun 10 00:19:25 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c: don't use non async-signal-safe functions in a child
+ process before exec, for invoking a command.
+ (rb_exec_atfork): call rb_exec_async_signal_safe only.
+ (retry_fork): take chfunc_is_async_signal_safe argument. call
+ before_fork and after_fork only unless chfunc_is_async_signal_safe.
+ (send_child_error): take chfunc_is_async_signal_safe argument.
+ send an exception only unless chfunc_is_async_signal_safe.
+ (recv_child_error): take chfunc_is_async_signal_safe argument.
+ receive an exception only unless chfunc_is_async_signal_safe.
+ (rb_fork_internal): renamed from rb_fork_err and take
+ chfunc_is_async_signal_safe argument.
+ use rb_protect only unless chfunc_is_async_signal_safe.
+ (rb_fork_err): call rb_fork_internal with false as
+ chfunc_is_async_signal_safe.
+ (rb_fork_async_signal_safe): call rb_fork_internal with true as
+ chfunc_is_async_signal_safe.
+ (rb_spawn_process): call rb_fork_async_signal_safe instead of
+ rb_fork_err.
+
+Sat Jun 9 23:57:03 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_fork_err): rewrite a complex "if" statement.
+
+Sat Jun 9 23:44:29 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (before_exec_async_signal_safe): extracted from
+ before_exec.
+ (before_exec_non_async_signal_safe): ditto.
+ (before_exec): call before_exec_async_signal_safe and
+ before_exec_non_async_signal_safe.
+ (rb_exec_async_signal_safe): call before_exec_async_signal_safe.
+ (rb_exec_err): call before_exec_non_async_signal_safe instead of
+ before_exec.
+
+Sat Jun 9 23:36:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * iseq.c (iseq_load, insn_operand_intern, rb_iseq_disasm)
+ (rb_iseq_parameters): use rb_id2str() instead of rb_id2name() to
+ keep encoding.
+
+ * string.c (rb_str_symname_p): new function that checks if the string
+ is valid as a symbol name. split from sym_inspect().
+
+Sat Jun 9 22:27:05 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (retry_fork): rewrite a complex "for" statement by
+ simple statements.
+
+Sat Jun 9 21:50:04 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (retry_fork): extracted from rb_fork_err.
+ (send_child_error): ditto.
+ (recv_child_error): ditto.
+
+Sat Jun 9 17:21:48 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * iseq.c (iseq_load): type is a symbol, and invalid as ID in common.
+
+Sat Jun 9 10:57:14 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_exec_async_signal_safe): extracted from rb_exec_err.
+
+Sat Jun 9 09:31:07 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c: simplified because close_others option is always
+ enabled by default.
+ (rb_f_exec): don't need to set the option.
+ (rb_exec_arg_prepare): don't need to set the option. don't need
+ default_close_others argument.
+ (rb_spawn_internal): don't need to give default_close_others
+ argument for rb_exec_arg_prepare. don't need default_close_others
+ argument.
+ (rb_spawn_err): don't need to give default_close_others
+ argument for rb_spawn_internal.
+ (rb_spawn): don't need to give default_close_others
+ argument for rb_spawn_internal.
+ (rb_f_system): don't need to give default_close_others argument for
+ rb_spawn_internal.
+ (rb_f_spawn): don't need to give default_close_others argument for
+ rb_exec_arg_prepare.
+
+Sat Jun 9 09:00:58 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_proc_exec): call before_exec() here addition to
+ rb_exec_err.
+
+Sat Jun 9 08:30:52 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread_pthread.c (ruby_init_stack): use stack info if possible.
+
+Sat Jun 9 08:21:32 2012 Eric Hodel <drbrain@segment7.net>
+
+ * README.EXT (prepare extconf.rb): Added note to see MakeMakefile for
+ documentation of extconf.rb functions. Patch by Zachary Scott.
+ [ruby-trunk - Feature #6522]
+ * README.EXT (Appendix C): Removed in favor of MakeMakefile.
+ Patch by Zachary Scott.
+ * lib/mkmf.rb: Merged documentation from README.EXT Appendix C. Patch
+ by Zachary Scott.
+
+Sat Jun 9 08:16:47 2012 Eric Hodel <drbrain@segment7.net>
+
+ * doc/re.rdoc: Completed wording in the description of the =~ operator.
+ [ruby-trunk - Bug #6529]
+
+Sat Jun 9 08:09:38 2012 Eric Hodel <drbrain@segment7.net>
+
+ * string.c (rb_str_start_with): Removed "p" from start_with? examples
+ to match other String method examples. [ruby-trunk - Bug #6553]
+ * string.c (rb_str_end_with): Updated end_with? to use code markup
+ instead of italic.
+
+Sat Jun 9 07:56:03 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/benchmark.rb: Updated formatting of Benchmark documentation for
+ consistency. [ruby-trunk - Bug #6533]
+
+Sat Jun 9 07:46:26 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/delegate.rb: Added documentation for Delegator#!. Patch by
+ Zachary Scott. [ruby-trunk - Feature #6534]
+
+Sat Jun 9 07:39:50 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/net/http/responses.rb: Add RFC 6585 response codes. Patch by
+ Sangil Jung. [ruby-trunk - Feature #6480]
+ * lib/net/http/response.rb: ditto
+ * lib/net/http.rb: ditto
+ * lib/webrick/httpstatus.rb: ditto
+
+Sat Jun 9 01:24:28 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_exec_err): before_exec() call moved from proc_exec_cmd
+ and proc_exec_sh.
+ (rb_proc_exec): ditto.
+
+Sat Jun 9 01:11:07 2012 Tanaka Akira <akr@fsij.org>
+
+ * include/ruby/intern.h (rb_exec_arg_init): declaration changed to
+ return a value.
+
+ * process.c (rb_exec_arg_init): return a value.
+
+Fri Jun 8 23:44:14 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c: don't check the availability of FD_CLOEXEC. It should
+ be available if fork() is available.
+
+ * io.c: ditto.
+
+Fri Jun 8 22:39:32 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_fork_err): revert r35955. The condition needs !chfunc
+ to close ep[0] and ep[1]. The catched exception is re-raised
+ immediately after that if status is not NULL.
+
+Fri Jun 8 19:43:33 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_exec_err): after_exec() call moved from proc_exec_cmd
+ and proc_exec_sh.
+ (rb_proc_exec): ditto.
+
+Fri Jun 8 19:00:59 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (ARGV_COUNT): unused macro removed.
+ (ARGV_SIZE): ditto.
+ (ALLOC_ARGV): ditto.
+ (ALLOC_ARGV_WITH_STR): ditto.
+
+Fri Jun 8 16:19:33 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/runner.rb (src_testdir): expand real path so that
+ TestGem#test_self_find_files does not fail by aliased load path when
+ srcdir contains a symbolic link.
+
+ * tool/runruby.rb (srcdir): ditto.
+
+Fri Jun 8 12:04:39 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * process.c (rb_fork_err): error state in the child process is prior
+ to exceptions in proc_syswait().
+
+ * process.c (rb_fork_err): determine status on errors.
+
+ * ext/pty/pty.c (establishShell): reraise exception if something
+ raised during sleep.
+
+ * ext/pty/pty.c (establishShell): now needs status to protect from
+ exceptions in rb_fork_err().
+
+Thu Jun 7 22:13:05 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_fork_err): Fix the condition to use rb_protect.
+
+Thu Jun 7 20:29:12 2012 Tanaka Akira <akr@fsij.org>
+
+ * include/ruby/intern.h: rb_exec_arg and related stuff moved back from
+ internal.h
+
+Thu Jun 7 15:53:03 2012 Koichi Sasada <ko1@atdot.net>
+
+ * .gdbinit: add function `trace_machine_instructions' to trace
+ in native machine assemble.
+ See https://bugs.ruby-lang.org/projects/ruby-trunk/wiki/MachineInstructionsTraceWithGDB
+ for more details.
+
+Wed Jun 6 21:31:21 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (proc_exec_cmd) renamed from proc_exec_v.
+ (proc_exec_sh): renamed from rb_proc_exec_e.
+ (proc_spawn_cmd_internal): renamed from proc_spawn_v.
+ (proc_spawn_cmd): renamed from proc_spawn_n.
+ (proc_spawn_sh): renamed from proc_spawn.
+
+Wed Jun 6 21:18:47 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * process.c (try_with_sh): please take care of the macro defined by
+ you.
+
+Wed Jun 6 20:45:08 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (proc_exec_v): don't call dln_find_exe_r here because it
+ is not async-signal-safe and proc_exec_v is called in a child
+ process.
+ command_abspath field of rb_exec_arg.
+ (rb_exec_fillarg): call dln_find_exe_r and set command_abspath.
+ (rb_exec_err): Give the absolute path of the invoking command for
+ proc_exec_v, instead of the command name.
+
+ * internal.h: add command_abspath field for rb_exec_arg.
+
+Wed Jun 6 20:08:01 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (try_with_sh): take envp argument.
+ (exec_with_sh): ditto. use it for execve.
+ (proc_exec_v): provide envp for try_with_sh.
+
+Wed Jun 6 13:25:04 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c, include/ruby/win32.h (rb_w32_wrap_io_handle): new API.
+ this API wraps an I/O handle (HANDLE or SOCKET) and returns fd.
+ the second parameter should be combination of O_*, for example,
+ O_RDWR | O_BINARY | O_NOINHERIT.
+
+ * win32/win32.c, include/ruby/win32.h (rb_w32_unwrap_io_handle): new
+ API. this API unwraps an I/O handle and close the fd (not closes
+ the handle itself).
+
+ [Feature #4906] [ruby-core:37227]
+
+Wed Jun 6 13:18:26 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_close): of course, console handle is not socket.
+
+Wed Jun 6 12:37:43 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * process.c (rb_run_exec_options_err): allocate a temporary buffer for
+ run_exec_dup2() for restoring fds on non-fork environments.
+
+Wed Jun 6 09:45:21 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/dl/test_c_{struct_entry,union_entity}.rb: sorry, typos.
+
+Wed Jun 6 05:27:54 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_exec_fillarg): check use_shell field before accessing
+ a union field.
+
+Wed Jun 6 04:58:44 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_spawn_process): prog variable is not used for Unix.
+
+Wed Jun 6 00:20:37 2012 Tanaka Akira <akr@fsij.org>
+
+ * internal.h (rb_exec_arg_init): change return type to void.
+
+ * process.c (rb_exec_arg_init): don't return a value.
+ (rb_exec_arg_prepare): ditto.
+ (rb_spawn_process): don't take the prog argument. extract the
+ information from earg.
+ (rb_spawn_internal): follow rb_spawn_process change.
+ (rb_f_spawn): ditto.
+
+ * io.c (pipe_open): don't take the prog argument. extract the
+ information from eargp.
+ (pipe_open_v): follow pipe_open change.
+ (pipe_open_s): ditto.
+
+Tue Jun 5 23:51:33 2012 Tanaka Akira <akr@fsij.org>
+
+ * internal.h (rb_exec_arg): use union to represent command invocation
+ with/without shell.
+
+ * process.c: follow the rb_exec_arg change.
+
+ * io.c (pipe_open): ditto.
+
+Tue Jun 5 22:28:46 2012 Tanaka Akira <akr@fsij.org>
+
+ * internal.h: rb_exec_arg and related stuff moved from intern.h
+
+ * include/ruby/intern.h (rb_proc_exec_n): removed.
+
+Tue Jun 5 21:57:22 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_exec_arg_fixup): allocate a temporary buffer for
+ run_exec_dup2 here because it should be async-signal-safe.
+ (run_exec_dup2): use the temporary buffer.
+ (run_exec_dup2_tmpbuf_size): new function.
+
+ * include/ruby/intern.h (rb_exec_arg): add dup2_tmpbuf field.
+
+Tue Jun 5 20:13:15 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * object.c (rb_obj_init_copy): should check if trusted too.
+
+Tue Jun 5 19:59:13 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (strtok): declaration removed because it is not used.
+
+Tue Jun 5 19:33:51 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (proc_spawn): don't detect simple command line here
+ because rb_exec_fillarg already did.
+
+Tue Jun 5 19:21:10 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_exec_fillarg): bail out a loop eagerly.
+
+Tue Jun 5 19:15:14 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c: add comments about async-signal-safe.
+
+ * io.c: ditto.
+
+Tue Jun 5 09:25:10 2012 Eric Hodel <drbrain@segment7.net>
+
+ * io.c: Edited documentation for IO and File open and new and
+ Kernel#open for consistency and clarity.
+
+Mon Jun 4 21:53:56 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_sysinit): let the system not display the
+ critical-error-handler message box and the Windows Error Reporting
+ dialog. [ruby-core:45389] [Bug #6535]
+
+Mon Jun 4 19:36:25 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_exec_fillarg): allocate one more element before
+ beginning in argv_str for try_with_sh.
+
+ * internal.h (ARGVSTR2ARGC): adjust for the above change.
+ (ARGVSTR2ARGV): ditto.
+
+Mon Jun 4 19:17:06 2012 Tanaka Akira <akr@fsij.org>
+
+ * internal.h (ARGVSTR2ARGC): defined.
+ (ARGVSTR2ARGV): defined.
+
+ * process.c (proc_exec_v): use ARGVSTR2ARGV.
+ (rb_spawn_process): use ARGVSTR2ARGC and ARGVSTR2ARGV.
+
+ * io.c (pipe_open): use ARGVSTR2ARGV.
+
+Mon Jun 4 16:13:00 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_insnhelper.h: remove magical code "lfp[0] & 0x02".
+ Current VM doesn't use this bit.
+
+ * vm_core.h (RUBY_VM_GET_BLOCK_PTR): added.
+
+ * eval.c (rb_block_given_p): use RUBY_VM_GET_BLOCK_PTR().
+
+ * vm_eval.c (rb_f_block_given_p): ditto.
+
+Mon Jun 4 15:39:33 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/win32.c (constat_apply): apply VT100 functions.
+ [ruby-core:44958] [Feature #6418]
+
+ * win32/win32.c (constat_parse): parse some VT100 escape sequence.
+
+Mon Jun 4 14:06:12 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * process.c (rb_exec_err): should preserve errno.
+
+Mon Jun 4 13:10:11 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/dl/test_c_{struct_entry,union_entity}.rb: broken require.
+
+Mon Jun 4 12:01:21 2012 Koichi Sasada <ko1@atdot.net>
+
+ * test/ruby/test_backtrace.rb: fix test.
+ Windows path includes `:' character.
+
+Mon Jun 4 11:42:39 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_core.h (rb_location_t): fix type and field name.
+ (1) rename rb_location_t to rb_iseq_location_t.
+ (2) rename field names of rb_iseq_location_t to adjust
+ RubyVM::Backtrace::Location methods.
+ (2-1) filename -> path
+ (2-2) filepath -> absolute_path
+ (2-3) basename -> base_label
+ (2-4) name -> label
+ (3) rename filed name rb_iseq_location_t#line_no to
+ rb_iseq_location_t#first_lineno to clear purpose of this field.
+ (4) The field names rb_binding_t#(filename|line_no) are also renamed
+ to rb_binding_t#(path|first_lineno).
+
+ * compile.c: apply above changes.
+
+ * iseq.c: ditto.
+
+ * proc.c: ditto.
+
+ * vm*.c: ditto.
+
+Mon Jun 4 11:40:28 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * marshal.c (r_object0): also load TYPE_USRMARSHAL, TYPE_DATA using
+ compatible loader.
+
+Mon Jun 4 11:33:42 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * process.c (rb_run_exec_options_err): restore save_env() call for
+ non-fork environments.
+
+ * process.c (rb_exec_err): restore environments after the failure of
+ exec to fix [ruby-core:44093] [Bug #6249] on non-fork environments
+
+Mon Jun 4 10:42:04 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * io.c (pipe_open): follow up changes in r35889.
+
+ * process.c (proc_spawn_n): now uses char ** instead of VALUE *.
+
+ * process.c (rb_spawn_process): prog is now VALUE of String, not char *.
+
+Mon Jun 4 06:12:43 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * marshal.c (r_object0): remove old warning for _alloc.
+
+Mon Jun 4 04:24:06 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * marshal.c: experimental test aborted.
+ * complex.c: ditto.
+ * rational.c: ditto.
+ * include/ruby/intern.h: ditto.
+
+Mon Jun 4 00:45:18 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_spawn_process): fix for Windows. not tested.
+
+Mon Jun 4 00:11:51 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_proc_exec_e): don't use ISSPACE(). \f, \r and \v
+ are not word separator in Bourne shell.
+
+Sun Jun 3 23:47:30 2012 Tanaka Akira <akr@fsij.org>
+
+ * include/ruby/intern.h (rb_exec_arg): remove argc and argv fields.
+ add use_shell, argv_str and argv_buf fields.
+
+ * process.c (rb_proc_exec_e): don't split shell command line arguments
+ here to avoid memory allocation in a child process.
+ (rb_exec_fillarg): split shell command line arguments here.
+ (proc_exec_v): takes argv_str argument instead of argv.
+ (rb_proc_exec_ne): removed.
+ (rb_proc_exec_n): removed.
+ (rb_run_exec_options_err): don't initialize the removed fields.
+ (rb_exec_err): don't initialize the removed fields.
+ call proc_exec_v directly instead of rb_proc_exec_ne.
+ (rb_spawn_process): use use_shell field.
+
+Sun Jun 3 21:53:00 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * GPL: update text of GPLv2. [ruby-core:44488] [Bug #6328]
+ http://www.gnu.org/licenses/gpl-2.0.txt
+
+Sun Jun 3 21:22:52 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_exec_getargs): remove rb_exec_arg argument.
+
+Sun Jun 3 21:14:26 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * marshal.c: calls directly rb_{Complex,Rational}_marshal_load().
+ But now disabled. [experimental]
+ * complex.c: followed the above.
+ * rational.c: ditto.
+ * include/ruby/intern.h: ditto.
+
+Sun Jun 3 21:18:17 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_check_argv): use rb_str_new_frozen instead of
+ rb_str_new4.
+
+Sun Jun 3 20:10:52 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_proc_exec_e): extended version of rb_proc_exec() to
+ call execle().
+ (rb_proc_exec): use rb_proc_exec_e().
+ (rb_exec_err): use rb_proc_exec_e().
+
+Sun Jun 3 19:47:18 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * thread.c (vm_living_thread_num): suppress a warning.
+
+Sun Jun 3 17:23:52 2012 Tanaka Akira <akr@fsij.org>
+
+ * use execve() to preserve environment variables when exec method is
+ failed. [ruby-core:44093] [ruby-trunk - Bug #6249]
+
+ * include/ruby/intern.h (rb_exec_arg): add envp_str and envp_buf field
+ to store envp of execve().
+
+ * process.c (proc_exec_v): takes envp_str as an argument and use it
+ for execve().
+ (rb_proc_exec_ne): extended version of rb_proc_exec_n().
+ (rb_proc_exec_n): use rb_proc_exec_ne().
+ (rb_proc_exec): follow proc_exec_v() change.
+ (fill_envp_buf_i): new function.
+ (rb_exec_arg_fixup): set up envp_str and envp_buf.
+ (save_env_i): removed.
+ (save_env): removed.
+ (rb_run_exec_options_err): don't modify environment variables.
+ (rb_exec_err): use rb_proc_exec_ne().
+
+Sun Jun 3 16:33:58 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * marshal.c: revert r35879 "now marshal_{load|dump} are external."
+
+ * complex.c (nucomp_marshal__{dump,load}): should use rb_marshal_{dump,load}.
+
+ * rational.c (nurat_marshal__{dump,load}): ditto.
+
+Sun Jun 3 14:13:58 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: checks whether the object is frozen or not.
+
+Sun Jun 3 14:00:51 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * complex.c: wrote Complex#_dump and Complex::load. But now
+ disabled (due to compatibility) [experimental].
+
+ * rational.c: wrote Rational#_dump and Rational::load. ditto.
+
+Sun Jun 3 10:23:32 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * complex.c (nucomp_marshal_load): [ruby-core:45394]
+ * rational.c (nurat_marshal_load): ditto.
+
+Sun Jun 3 03:15:46 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * regparse.c (onig_number_of_names): suppress a warning.
+
+Sun Jun 3 01:36:52 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_backtrace.c: change names.
+ (1) Class name: RubyVM::FrameInfo -> RubyVM::Backtrace::Location.
+ (2) Method name: RubyVM::FrameInfo.caller ->
+ Kernel.caller_locations.
+ (3) Instance methods of
+ RubyVM::FrameInfo (RubyVM::Backtrace::Location)
+ (3-1) name -> label
+ (3-2) basename -> base_label (basename is confusing with
+ File.basename)
+ (3-3) line_no -> lineno (We have already similar name
+ File#lineno, commented by kou [ruby-dev:45686]).
+ (3-4) filename -> path.
+ (3-5) filepath -> absolute_path.
+ (3-5) iseq -> removed (we will make other APIs to access iseq
+ and other information of frame for debugging).
+
+ * test/ruby/test_backtrace.rb: apply above changes.
+ And apply comment from kou [ruby-dev:45686].
+
+Sun Jun 3 00:49:11 2012 Koichi Sasada <ko1@atdot.net>
+
+ * common.mk: fix to build vm_backtrace.c only itself (vm_backtrace.c
+ is no longer included from vm.c). I hope this separation reduce
+ compile time of vm.c.
+
+ * internal.h: ditto.
+
+ * vm.c, vm_core.h, vm_dump.c, vm_eval.c: ditto.
+
+ * vm_eval.c: some functions (callee, etc) moved to vm_backtrace.c.
+
+Sun Jun 3 00:20:53 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_backtrace.c: added. Separate backtrace related functions to
+ this file.
+
+ * vm.c, common.mk: ditto.
+
+Sat Jun 2 18:09:02 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/ipaddr.rb: Inhibit zero-filled octets in an IPv4 address in
+ all platforms. [ruby-dev:45671]
+
+ * lib/ipaddr.rb: Allow the x:x:x:x:x:x:d.d.d.d form not limited to
+ IPv4 mapped/compatible addresses. This change also makes it
+ possible for the parser to understand IPv4 mapped and compatible
+ IPv6 addresses in non-compressed form.
+
+ * lib/ipaddr.rb: Stop exposing IPSocket.valid*? methods which were
+ only usable on non-IPv6-ready platforms.
+
+Sat Jun 2 16:59:00 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * string.c (rb_enc_cr_str_buf_cat): don't reset coderange as unknown.
+ the condition 'ptr_a8 && str_cr != ENC_CODERANGE_7BIT' means not
+ unknown, str is also ASCII-8BIT because str_encindex == ptr_encindex,
+ and nont (str_cr == ENC_CODERANGE_UNKNOWN) and
+ str_cr != ENC_CODERANGE_7BIT means str_cr is valid because ASCII-8BIT
+ can't be broken. [ruby-dev:45688] [Bug #6509]
+
+Sat Jun 2 07:04:48 2012 Eric Hodel <drbrain@segment7.net>
+
+ * doc/re.rdoc (Performance): Replaced incorrect example of reducing
+ backtracking through anchoring with reduced backtracking through a
+ range. [ruby-trunk - Bug #6525]
+
+Sat Jun 2 06:34:15 2012 Eric Hodel <drbrain@segment7.net>
+
+ * doc/re.rdoc (Performance): Removed useless sample output from final
+ performance example and switched from #match to #=~ for consistency.
+ [ruby-trunk - Bug #6524]
+
+Fri Jun 1 09:30:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * object.c (class_or_module_required): extract check for class or
+ module.
+
+Fri Jun 1 08:50:47 2012 Eric Hodel <drbrain@segment7.net>
+
+ * array.c: Updated Array documentation formatting. Patch by Zachary
+ Scott. [ruby-trunk - Feature #6517]
+
+Fri Jun 1 06:57:10 2012 Eric Hodel <drbrain@segment7.net>
+
+ * ext/dl/lib/dl/struct.rb (DL::CStructEntity#set_ctypes): Refactored
+ #set_ctypes using newer ruby features to simplify its implementation.
+ * test/dl/test_c_struct_entry.rb (class DL): Test to verify
+ refactoring.
+
+Fri Jun 1 06:40:25 2012 Eric Hodel <drbrain@segment7.net>
+
+ * object.c (Init_Object): Restored Kernel documentation based on
+ Pickaxe book documentation. Patch by Zachary Scott.
+ [ruby-trunk - Feature #6521]
+
+Fri Jun 1 06:29:42 2012 Eric Hodel <drbrain@segment7.net>
+
+ * object.c (rb_equal): Let Object be a link in #=== documentation.
+ Patch by Zachary Scott. [ruby-trunk - Feature #6518]
+
+Thu May 31 09:27:06 2012 Eric Hodel <drbrain@segment7.net>
+
+ * ext/dl/lib/dl/struct.rb (DL::CStructEntity::size): Refactored ::size
+ to remove unused variables and simplify using newer ruby features.
+ * test/dl/test_c_struct_entry.rb: Test to validate refactoring
+
+Thu May 31 08:40:34 2012 Eric Hodel <drbrain@segment7.net>
+
+ * ext/dl/lib/dl/struct.rb (DL::CUnionEntity#set_ctypes): Refactored
+ #set_types to reuse DL::CUnionEntity::size
+ * test/dl/test_c_union_entity.rb: Added test
+
+Thu May 31 08:20:14 2012 Eric Hodel <drbrain@segment7.net>
+
+ * ext/dl/lib/dl/struct.rb (DL::CUnionEntity::size): Fixed ::size to
+ return the size of the union.
+ * test/dl/test_c_union_entity.rb: Test for DL::CUnionEntity::size
+
+Thu May 31 07:45:43 2012 Eric Hodel <drbrain@segment7.net>
+
+ * ext/dl: Added documentation. Patch by Vincent Batts.
+ [ruby-trunk - Bug #6496]
+
+Wed May 30 16:30:00 2012 Kenta Murata <mrkn@cookpad.com>
+
+ * ext/bigdecimal/lib/bigdecimal/jacobian.rb,
+ ext/bigdecimal/lib/bigdecimal/newton.rb:
+ fix documentation comments.
+ Patch by alperakgun from github.com/shyouhei/ruby/pull/8
+
+Wed May 30 16:20:00 2012 Kenta Murata <mrkn@cookpad.com>
+
+ * ext/bigdecimal/lib/bigdecimal/jacobian.rb (Jacobian#dfdxi):
+ fix jacobian to get stuck in an infinite loop when a solution is not
+ found due to forget to increment nRetry counter.
+ Patch by alperakgun from github.com/shyouhei/ruby/pull/8
+
+Wed May 30 10:58:31 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * time.c (utc_offset_arg): utc offset can be precision in seconds.
+ e.g. old Europe/Lisbon (c.f. [ruby-dev:40066])
+
+Wed May 30 06:20:29 2012 Eric Hodel <drbrain@segment7.net>
+
+ * error.c (exc_set_backtrace): Updated documentation to indicate
+ set_backtrace allows a string as well as an array of strings.
+ [ruby-trunk - Bug #6501]
+
+Tue May 29 17:28:20 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * strftime.c (rb_strftime_with_timespec): support GNU extension triple
+ colons modifier. [EXPERIMENTAL]
+
+ * strftime.c (rb_strftime_with_timespec): check conversion with locale
+ modifier.
+
+ * strftime.c (rb_strftime_with_timespec): colons are valid only for
+ 'z' and must come just before it.
+
+Mon May 28 16:56:55 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit.rb (Test::Unit::Runner#_prepare_run): StatusLineOutput
+ needs job_status to be :replace.
+
+Mon May 28 13:35:33 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (do-install-*): fix dependencies. based on the patch by
+ nagachika at [ruby-dev:45683]. [Bug #6506]
+
+Mon May 28 12:03:04 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c (obj_free): doesn't free a method table if it doesn't
+ exist. [ruby-dev:44436]
+ * test/ruby/test_gc.rb (class TestGc): added the test case for
+ this issue.
+
+Sun May 27 23:37:48 2012 Koichi Sasada <ko1@atdot.net>
+
+ * benchmark/bm_vm1_lvar_init.rb: added.
+ This benchmark measures a initialize time of non-used variable.
+
+ * benchmark/bm_vm1_lvar_set.rb: added.
+ This benchmark measures a local variables initialization time.
+
+ * benchmark/bm_vm2_bigarray.rb: added.
+ This benchmark mesures a big array literal creation time.
+
+ * benchmark/bm_vm2_bighash.rb: added.
+ This benchmark mesures a big hash literal creation time.
+
+ * benchmark/bm*: change notation "i=0" to "i = 0".
+
+Sun May 27 13:33:26 2012 Koichi Sasada <ko1@atdot.net>
+
+ * benchmark/driver.rb: fix to continue benchmarks when
+ an error is occurred.
+
+Sun May 27 11:27:50 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit.rb (Test::Unit::Runner#_prepare_run): fix operator
+ precedence, so that platform and TERM should be counted.
+
+Sun May 27 10:02:33 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_strftime.c: allows %Ok and %Ol.
+
+Sun May 27 09:29:20 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: modified doc.
+
+Sat May 26 19:04:34 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: added description.
+
+Sat May 26 18:14:57 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_strftime.c: reduced the code.
+
+Sat May 26 18:08:59 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * time.c: modified doc.
+ * ext/date/date_core.c: ditto.
+
+Sat May 26 17:05:45 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm.c (backtrace_*): change type of lev and n from size_t to int.
+ Also set type of rb_backtrace_t#backtrace_size to int.
+ A patch from nobu.
+
+ * vm_eval.c: ditto.
+
+Sat May 26 16:26:30 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (realpath_rec): UNC prefix does not end with path separator,
+ so new separator is needed after it.
+
+Sat May 26 15:29:22 2012 Koichi Sasada <ko1@atdot.net>
+
+ * test/ruby/test_backtrace.rb (test_caller_lev):
+ decrease recursion size.
+
+Sat May 26 13:50:48 2012 Koichi Sasada <ko1@atdot.net>
+
+ * NEWS: add Kernel#caller's second argument.
+
+Sat May 26 13:40:29 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm.c (RubyVM::FrameInfo): add a class to access each frame
+ information. You don't need to parse strings from caller().
+ FrameInfo has the following methods:
+ FrameInfo#name: method name, class name, etc with decorations.
+ FrameInfo#basename: name without decorations.
+ FrameInfo#line_no: line number.
+ FrameInfo#filename: file name.
+ FrameInfo#filepath: full filepath.
+ FrameInfo#iseq: iseq if it is iseq frame (defined by ruby script)
+ FrameInfo#to_s: return caller() method style string.
+ RubyVM::FrameInfo.caller(n, lev) returns array of FrameInfo objects.
+ The name "RubyVM::FrameInfo.caller" is long and ambiguous (it is
+ confusing with Kernel::caller() method), we need to change the name
+ before Ruby 2.0 release. Good names or comments are welcome.
+
+ * test/ruby/test_backtrace.rb: add a test for above change.
+
+Sat May 26 12:18:09 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm.c (frame_info_to_str): add `break'.
+
+ * vm.c (backtrace_object): remove lev and n parameter.
+ backtrace_object always returns all of backtrace information.
+
+ * vm.c (rb_backtrace_to_str_ary): fix to use backtrace_object().
+ This change improve performance of caller(lev, n).
+
+ * benchmark/bm_vm3_backtrace.rb: added to check above improvement.
+ FYI: measurement on my laptop, 1.9.3p229 needs 5.125 sec,
+ and current trunk only needs 0.299sec.
+
+Sat May 26 11:05:09 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm.c (rb_frame_info_t): keep previous ISEQ frame info for CFUNC
+ frame info. And fix to cache a calculated line_no of ISEQ frame
+ info.
+
+Sat May 26 09:54:53 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_ssl.c: Allow disabling client-side renegotiation.
+ * test/openssl/test_ssl.rb: Simple tests for this.
+
+ Client-side renegotiation is still considered problematic, even
+ when used in the context of secure renegotiation (RI, RFC 5746).
+ The changes allow users to either completely disable client
+ renegotiation on the server, or to specify a maximum number of
+ handshakes allowed in total. The number of total handshakes is
+ counted in a callback set as SSL_set_info_callback. If the
+ maximum number of handshakes is exceeded an error will be raised
+ We do not support renegotiation in the OpenSSL extension, therefore
+ this feature can only be tested externally.
+ The feature is opt-in, the default setting will be to allow
+ unlimited client renegotiation, as was the case before.
+
+Fri May 25 23:38:58 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * test/openssl/test_ssl.rb: Clarify the intention of errors to be
+ expected. Two errors are possible when connection is refused due
+ to a protocol version that was explicitly disallowed,
+ OpenSSL::SSL::SSLError or Errno::ECONNRESET, depending on the
+ OpenSSL version in use.
+
+Fri May 25 22:19:40 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_ssl.c: Revert r35583
+ * test/openssl/test_ssl.rb: Handle ECONNRESET in code instead to avoid
+ the test failing in Ruby CI [1]
+
+ [1] http://u64.rubyci.org/~chkbuild/ruby-trunk/log/20120507T190102Z.log.html.gz#test-all
+
+Fri May 25 19:51:36 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_eval.c (rb_f_caller): caller() method accepts second optional
+ argument `n' which specify how many frames should return.
+ For example, `caller(0, 1)' returns only one frame information
+ which calls caller() method. If there are less than n frame
+ information, then all frame information are returned. If n is 0,
+ then always return [].
+ This fix is part of [ruby-dev:42345] [Ruby 1.9-Feature#3917].
+ However, performance and features are not enough.
+ RDoc is also not available.
+
+ * test/ruby/test_backtrace.rb: add a test for above.
+
+Fri May 25 17:05:07 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm.c (oldbt_init, vm_backtrace_str_ary): arg->data should
+ be initialized before calling `backtrace_each()'.
+
+Fri May 25 16:11:27 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * trunk/ext/-test-/printf/printf.c: change function names because of
+ conflict with msvcrt. fixed build error of mswin.
+
+Fri May 25 10:52:52 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm.c: refactoring backtrace related functions.
+ (1) unify similar functions (rb_backtrace_each() and
+ backtrace_object()). backtrace_each() is a unified function.
+ variation:
+ a) backtrace_object(): create backtrace object.
+ b) vm_backtrace_str_ary(): create bt as an array of string.
+ c) vm_backtrace_print(): print backtrace to specified file.
+ d) rb_backtrace_print_as_bugreport(): print backtrace on
+ bugreport style.
+ (2) remove rb_backtrace_each(). Use backtrace_each() instead.
+ (3) change the type of lev parameter to size_t.
+ a) lev == 0 means current frame (exception, etc use it).
+ b) lev == 1 means upper frame (caller(0) use it).
+
+ * vm_core.h, vm_dump.c, vm_eval.c: ditto.
+
+ * vm.c (backtrace_object(), vm_backtrace_str_ary()): fix to return a
+ correct size of caller(lev) array.
+ Let n be a "caller(0).size" then ln as caller(lev).size should be
+ (n - lev). However, the previous implementation returns a wrong
+ size array (ln > n - lev). [ruby-dev:45673]
+
+ * test/ruby/test_backtrace.rb: add tests for backtrace.
+
+Fri May 25 08:51:39 2012 Eric Hodel <drbrain@segment7.net>
+
+ * enum.c (enum_count): Enumerable#count no longer uses #size when
+ counting elements. Patch by Nobuhiro IMAI. [ruby-trunk - Bug #6473]
+
+Fri May 25 01:15:39 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * sprintf.c (ruby__sfvextra): [EXPERIMENTAL] use inspect instead of
+ to_s if plus flag is given.
+
+ * vsnprintf.c (BSD_vfprintf): pass sign flag.
+
+Fri May 25 00:37:22 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/rubygems/test_gem_indexer.rb (setup, teardown): save @tempdir
+ to remove it properly. [Bug #5348]
+
+Thu May 24 23:36:51 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vsnprintf.c (BSD_vfprintf): [EXPERIMENTAL] object representation in
+ rb_enc_vsprintf(). [Feature #5896]
+
+Thu May 24 15:33:01 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_method.c (rb_method_defined_by): removed.
+ nobu pointed out that rb_method_basic_definition_p() is enough
+ for last commit.
+
+ * error.c, eval_error.c: change for above.
+
+Thu May 24 14:30:13 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm.c: add RubyVM::Backtrace object (btobj).
+ Backtrace information contains an array consists of location
+ information for each frames by string.
+ RubyVM::Backtrace object is lightweight backtrace information,
+ which contains complete information to generate traditional style
+ backtrace (an array of strings) with faster generation.
+ If someone accesses to backtrace information via
+ Exception#backtrace, then convert a RubyVM::Backtrace object to
+ traditional style backtrace.
+ This change causes incompatibility on marshal dumped binary
+ of Exception. If you have any trouble on it, please tell us
+ before Ruby 2.0 release.
+ Note that RubyVM::Backtrace object should not expose Ruby level.
+
+ * error.c, eval.c, vm_eval.c: ditto.
+
+ * internal.h: ditto.
+
+ * eval_error.c: fix to skip "set_backtrace" method invocation in
+ creating an exception object if it call a normal set_backtrace
+ method (defined by core).
+
+ * test/ruby/test_settracefunc.rb: fix for above change.
+
+ * vm_method.c (rb_method_defined_by): added. This function
+ checks that the given object responds with the given method
+ by the given cfunc.
+
+ * benchmark/bm_vm2_raise1.rb, benchmark/bm_vm2_raise2.rb:
+ add to measure exception creation speed. raise1 create
+ exception objects from shallow stack frame. raise2 create
+ exception objects from deep stack frame.
+
+Thu May 24 12:07:46 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (io_strip_bom): check EOF. [Bug #6487][ruby-core:45203]
+
+Wed May 23 22:06:14 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/http/header.rb (Net::HTTPHeader#range): fix broken parser of
+ HTTP Range request. Old one can't parse invalid specs and multiple
+ specs correctly.
+
+Wed May 23 10:18:54 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (finish_overlapped_socket, overlapped_socket_io):
+ replace ECONNABORTED to EPIPE in send, sendto and sendmsg to improve
+ BSD socket compatibility. this change removes a failure on the test
+ of net/ftp.
+
+Wed May 23 05:35:58 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/net/http.rb: Broke up Net::HTTP into individual files.
+ [ruby-trunk - Feature #6435]
+ * lib/net/http/backward.rb: ditto.
+ * lib/net/http/response.rb: ditto.
+ * lib/net/http/exceptions.rb: ditto.
+ * lib/net/http/responses.rb: ditto.
+ * lib/net/http/generic_request.rb: ditto.
+ * lib/net/http/header.rb: ditto.
+ * lib/net/http/request.rb: ditto.
+ * lib/net/http/proxy_delta.rb: ditto.
+ * lib/net/http/requests.rb: ditto.
+
+Wed May 23 05:15:11 2012 Eric Hodel <drbrain@segment7.net>
+
+ * class.c (rb_mod_init_copy): Clear the cached inspect string of a
+ dup'd anonymous module or class. [ruby-trunk - Bug #6454]
+ * test/ruby/test_module.rb (class TestModule): ditto
+
+Tue May 22 16:49:15 2012 Koichi Sasada <ko1@atdot.net>
+
+ * vm_core.h: add a data type rb_location_t to store iseq location
+ information.
+ rb_location_t#filename, filepath, name and line_no was moved from
+ rb_iseq_t. rb_location_t#basename is a new field which is
+ similar to `name' field without any decoration.
+ `name' field contains some decoration such as `block in foo'.
+ `basename' only contains `foo'.
+ rb_iseq_t contains memory object of rb_location_t.
+
+ * iseq.c: setup rb_location_t for each rb_iseq_t memory objects.
+
+ * compile.c, proc.c, vm.c, vm_dump.c, vm_eval.c, vm_insnhelper.c,
+ vm_method.c: support about it.
+
+Tue May 22 00:45:05 2012 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * struct.c (rb_struct_members): Refactoring. As Struct#members had
+ returned an array of String, the old code was needed to convert
+ Symbols to Strings. But it is almost unnecessary because the
+ method now returns an array of Symbols. A patch by Masaki
+ Matsushita <glass.saga at gmail dot com> [Feature #6218]
+ [ruby-dev:45451]
+
+Mon May 21 19:20:25 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/ftp.rb (Net::FTP#retrbinary): close only if conn is not nil
+ because transfercmd may fail and return nil.
+
+ * lib/net/ftp.rb (Net::FTP#retrlines): ditto.
+
+Mon May 21 15:10:28 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * ext/syslog/syslog.c: Classify constants and macros into several
+ sub-modules. (Syslog::Priority, Syslog::Level, Syslog::Option
+ and Syslog::Macros)
+
+ * ext/syslog/syslog.c (mSyslog_inspect): Use rb_sprintf().
+
+ * ext/syslog/syslog.c (mSyslog_inspect): Make sure self is a
+ module before calling rb_class2name().
+
+Mon May 21 12:44:11 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * .travis.yml (install): It seems tcl/tk is skipped in Travis
+ CI. Trying to fix the situation.
+
+Mon May 21 12:11:25 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * enc/depend (ENCOBJS): add dependencies.
+
+ * enc/make_encmake.rb (target_encodings): extract dependencies.
+
+Mon May 21 11:26:17 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/ftp.rb (Net::FTP#transfercmd): rescue shutdown.
+
+Sun May 20 23:00:11 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/extmk.rb (extmake): reopen $stdout to NULL, since setting
+ $stdout cannot affect child processes.
+
+Sun May 20 21:36:39 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * enc/shift_jis.c (code_to_mbclen): return
+ ONIGERR_INVALID_CODE_POINT_VALUE if the code is invalid.
+
+ * string.c (tr_next): increment character until the code
+ is a valid character. [ruby-dev:45652] [Bug #6450]
+
+Sun May 20 12:25:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * Makefile.in (LIBRUBY_SO): link EXTSOLIBS too.
+
+ * ext/extmk.rb (mf.macro): use EXTSOLIBS instead of SOLIBS to get rid
+ of discard libraries needed by default. [Bug #6462]
+
+Sat May 19 19:04:38 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/extmk.rb (command_output): ENCOBJS is needed for all linked
+ ruby, if --disable-shared and --with-static-linked-ext.
+
+ * ext/extmk.rb (command_output): dmyext is needed as DLDOBJS if no
+ static linked extensions.
+
+ * Makefile.in, common.mk (PROGRAM): no extension libraries.
+
+ * common.mk (build-ext): pass macros for libruby.so.
+
+ * ext/extmk.rb (command_output): link extension libraries and encoding
+ libraries into libruby.so, not ruby executable.
+
+ * ext/extmk.rb (command_output): fold long macro lines.
+
+ * Makefile.in (LIBEXT): add macro.
+
+ * configure.in (ENCOBJS, EXTOBJS): use LIBEXT, not hardcoded suffix.
+
+ * Makefile.in (LIBRUBY_A): fix typo. re-applying r35242.
+
+Sat May 19 04:46:53 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * ext/openssl/extconf.rb: Use Logging::message instead of message.
+ * ext/zlib/extconf.rb: ditto.
+
+Fri May 18 18:13:44 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (MakeMakefile#configuration): keep space at end of
+ OUTFLAG and COUTFLAG. [ruby-dev:45650]
+
+Fri May 18 17:39:42 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c (rb_thread_create_timer_thread): Added error
+ check when failing fcntl(). [Bug #6147] [ruby-dev:45364]
+
+Fri May 18 17:41:00 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/extmk.rb (extmake): link archives only, skip script only
+ extension libraries.
+
+Fri May 18 17:25:33 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * cont.c: bump up fiber machine stack size when running on 64bit
+ arch. [Bug #6344] [ruby-dev:45554]
+
+Fri May 18 15:20:56 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/uri/generic.rb (URI::Generic.build): duplicate args before adding
+ new items. (don't change arguments)
+
+ * lib/uri/generic.rb (URI::Generic.build): use URI::Generic::COMPONENT
+ if this method is called from URI::Generic.
+
+ * lib/uri/generic.rb (URI::Generic.build2): escape only if the item is
+ a String.
+
+ * lib/uri/generic.rb (URI::Generic.build2): use DEFAULT_PARSER because
+ it doesn't have parser method. [Bug #6420]
+
+Fri May 18 15:54:07 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * ext/zlib/extconf.rb: Use an exception instead of bare puts.
+
+Fri May 18 15:53:05 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * ext/psych/extconf.rb: Use an exception instead of bare abort.
+
+Fri May 18 15:51:32 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * ext/fiddle/extconf.rb: Use an exception instead of bare abort.
+
+Fri May 18 15:49:35 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * ext/readline/extconf.rb: Use an exception instead of bare exit.
+
+Fri May 18 15:38:11 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * ext/ripper/extconf.rb: Use an exception instead of bare
+ Logging.message.
+
+Fri May 18 15:23:06 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * ext/openssl/extconf.rb: Clarify a message when hit Apple
+ OpenSSL issue.
+
+Fri May 18 15:14:32 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * ext/extmk.rb: Show a message when extconf.rb raised an exception.
+ * ext/openssl/extconf.rb: Use exception raising instead of message
+ and/or abort. We want to display error message to console _and_
+ logging into mkmf.log.
+
+Fri May 18 06:14:07 2012 Eric Hodel <drbrain@segment7.net>
+
+ * ext/syslog/lib/syslog/logger.rb: Added Syslog::Logger which was
+ ported from the SyslogLogger gem. [ruby-trunk - Feature #5096]
+ * NEWS: ditto.
+ * test/syslog/test_syslog_logger.rb: ditto.
+
+Fri May 18 01:28:21 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/parser.c (transcode_string): fix encoding index names.
+ Thanks markizko for reporting.
+
+Thu May 17 23:03:58 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: fix function name to be checked, to initialize
+ rb_thread_cond_t properly.
+
+ * thread_pthread.c (native_cond_initialize, native_cond_destroy):
+ fix macro name.
+
+Thu May 17 12:53:07 2012 Yuki Yugui Sonoda <yugui@google.com>
+
+ * thread.c, thread_pthread.c: Moved pthread-specific preprocessor
+ hacks to thread_pthread.c
+
+Thu May 17 12:18:47 2012 Yuki Yugui Sonoda <yugui@google.com>
+
+ * io.c: Fix a mistake on merging the patch in the previous commit.
+
+Thu May 17 11:33:07 2012 Yuki Yugui Sonoda <yugui@google.com>
+
+ Imports Ruby's port to NativeClient (a.k.a NaCl).
+ Patch by Google Inc. [ruby-core:45073].
+
+ * configure.in (RUBY_NACL): New M4 func to configure variables for
+ NaCl.
+ (RUBY_NACL_CHECK_PEPPER_TYPES): New M4 func to check the old names
+ of Pepper interface types.
+ (BTESTRUBY): New variable to specify which ruby should be run on
+ "make btest". NaCl can run the built binary by sel_ldr, but it need
+ rbconfig.rb. So this variable is distinguished from $MINIRUBY.
+
+ * thread_pthread.c: Disabled some features on NaCl.
+
+ * io.c: ditto.
+
+ * process.c: ditto.
+
+ * signal.c: ditto.
+
+ * file.c: ditto.
+
+ * missing/flock.c: ditto.
+
+ * nacl/pepper_main.c: An example implementation of Pepper application
+ that embeds Ruby.
+
+ * nacl/example.html: An example of web page that uses the Pepper
+ application.
+
+ * nacl/nacl-config.rb: Detects variants of NaCl SDK.
+
+ * nacl/GNUmakefile.in: Makefile template for NaCl specific build
+ process.
+
+ * nacl/package.rb: script for packaging a NaCl-Ruby embedding
+ application.
+
+ * nacl/reate_nmf.rb: Wrapper script of create_nmf.py
+
+ * dln.c (dln_load): Added a hack to call on NaCl.
+
+ * util.c (ruby_getcwd): Path to the current directory is not available
+ on NaCl.
+
+Thu May 17 10:54:58 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/tk/extconf.rb: add -l options to $libs not $LDFLAGS,
+ to be passed to EXTLIBS in exts.mk.
+
+ * enc/encinit.c.erb: use %-lines to adjust indent in the generated file.
+
+ * lib/mkmf.rb (MakeMakefile#have_framework): combine -framework option
+ and its argument with an equal sign not to be separated in merge_libs.
+
+ * ext/tk/extconf.rb: ditto.
+
+ * ext/extmk.rb: EXTLDFLAGS also needs to be passed.
+
+Wed May 16 15:44:22 2012 Yuki Yugui Sonoda <yugui@google.com>
+
+ * configure.in: Fix an unbalanced quote.
+
+Wed May 16 15:43:10 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/extmk.rb (exts.mk): use double quotes instead of single quotes
+ for commandline because it's not recognized as quotes on Windows.
+
+Wed May 16 15:15:55 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (LD): enclose with single quotes but not double quotes
+ not to expand command substitution.
+
+Wed May 16 14:19:51 2012 Yuki Yugui Sonoda <yugui@google.com>
+
+ Supports static linking of extensions and encodings again.
+ Fixes --with-static-linked-ext.
+
+ Patch by Google Inc. [ruby-core:45073].
+
+ * Makefile.in (ENCOBJS, EXTOBJS): New variables to specify static
+ linked libraries. Also reintroduces extinit.o, introduces encinit.o
+ introduces encinit.o
+
+ * common.mk: Builds static libraries rather than shared objects if
+ specified.
+
+ * configure.in (LD): new substitution.
+
+ * enc/depend: Supports static linked libraries
+ (libencs, libenc, libtrans): New target.
+
+ * enc/encinit.c.erb: new template to generate the initialization of
+ statically linked encodings.
+
+ * enc/make_encmake.rb (--module): new flag to specify whether static
+ or dynamic.
+
+ * transcode_data.h (TRANS_INIT): New macro to get rid of the name
+ collision of encoding initializers and transcoder initializers.
+
+ * ext/extmk.rb: Fixes the behavior on $extstatic is true.
+
+ * lib/mkmf.rb (clean-static): new target to clean up static linked
+ libraries.
+
+ * ruby.c (process_options): New initializes statically linked
+ encodings here.
+
+Wed May 16 14:30:43 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * io.c: fixed a merge mistake of r33878, reported by nobu via IRC.
+
+Wed May 16 06:59:41 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_strftime.c: should also be aware of flags on
+ complex specifier.
+
+Wed May 16 05:11:29 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/to_ruby.rb: fix a bug with string
+ subclass dumping and loading.
+
+ * test/psych/test_array.rb: pertinent tests
+
+ * test/psych/test_string.rb: ditto
+
+Wed May 16 01:31:21 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/to_ruby.rb: convert omap tagged maps to
+ Psych::Omap objects rather than hashes. [Bug #6425]
+
+ * test/psych/test_omap.rb: pertinent test.
+
+Wed May 16 01:15:45 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: keep a reference to
+ custom coders so that GC does not impact dumped yaml reference ids.
+
+Tue May 15 23:59:48 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit.rb (Test::Unit::Options#setup_options): add --color option.
+
+ * lib/test/unit.rb (Test::Unit::Runner#_prepare_run): defer color code
+ initialization to regard --color option.
+
+Mon May 14 16:28:36 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (f_arglist): should reset lexical states after empty
+ argument list with no parenthesis as well as parenthesized list,
+ so that reserved name method definition work. [ruby-dev:45626]
+ [Bug #6403]
+
+Mon May 14 00:14:24 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+
+ * enumerator.c (lazy_take_func, lazy_take): multiple calls of
+ force/to_a method to Enumerator::Lazy#take should return same
+ results. [ruby-dev:45634] [Bug #6428]
+
+ * test/ruby/test_lazy_enumerator.rb (test_take_recycle): add test for
+ above.
+
+Sun May 13 23:38:31 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+
+ * test/ruby/test_io.rb (test_flush_in_finalizer1): don't use IO.for_fd
+ to close IO objects. it create IO object with already closed fd, and
+ cause occasional Errno::EBADF in following tests. [ruby-core:45020]
+ [Bug #6228]
+
+Sun May 13 23:32:16 2012 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
+
+ * test/ruby/test_io.rb (TestIO): revert r35631. it broke the intent of
+ test_flush_in_finalizer1. [ruby-core:43951] [Bug #6228]
+
+Sun May 13 22:46:36 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/etc/etc.c (passwd_ensure): move endpwent() call from
+ passwd_iterate to close /etc/passwd on exception.
+ (group_ensure): move endgrent() call from group_iterate to close
+ /etc/group on exception.
+
+Sun May 13 18:10:43 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_strftime.c: removed unused code and changed the style.
+
+Sun May 13 17:37:56 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_strftime.c: refactored.
+
+Sun May 13 06:40:12 2012 Luis Lavena <luislavena@gmail.com>
+
+ * test/ruby/test_io.rb (class TestIO): Disable GC during IO tests to
+ avoid file descriptors being GC'ed. Suggestion by Tomoyuki Chikanaga
+ [ruby-core:43951][Bug #6228]
+
+Sat May 12 07:00:16 2012 Eric Hodel <drbrain@segment7.net>
+
+ * ext/sdbm/init.c: Added documentation. Patch by Justin Collins,
+ cleanup by Zachary Scott. [ruby-trunk - #6410]
+
+Sat May 12 06:02:03 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/fileutils.rb (cp_r): Fixed cp_r example. Patch by TJ Koblentz
+ from pull request #114. [ruby-trunk - Bug #6411]
+
+Sat May 12 05:23:06 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * thread.c (rb_threadptr_execute_interrupts_common):
+ test_signal_requiring of test/ruby/test_signal.rb fail if the sub
+ process is killed on waiting IO in lex_io_gets in rb_load_file in
+ rb_load_internal in require.
+ This is because
+ (1) the process receive the killing signal in
+ rb_thread_io_blocking_region in rb_read_internal in lex_io_gets.
+ (2) set th->errinfo as INT2FIX(TAG_FATAL) at
+ rb_threadptr_execute_interrupts_common.
+ (3) escape rb_load_file in rb_load_internal and jump to EXEC_TAG()
+ without set loaded as TRUE.
+ (4) call first rb_exc_raise(GET_THREAD()->errinfo); because loaded
+ is FALSE as above. this errinfo should be an exception object
+ but this is INT2FIX(TAG_FATAL).
+ Don't call first rb_exc_raise if GET_THREAD()->errinfo is Fixnum.
+
+Fri May 11 14:23:11 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (primary): begin/end block should be isolated from outside.
+ [ruby-dev:45631][Bug #6419]
+
+Fri May 11 14:09:47 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/bigdecimal/bigdecimal.c (PUSH): to prevent VALUE from GC,
+ must not cast it to unsigned long, which may be shorter than
+ VALUE, and the result can be mere garbage.
+
+Fri May 11 09:51:07 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit.rb (Test::Unit::Runner#failed): no unnecessary
+ newlines if no reports to be displayed.
+
+Thu May 10 10:55:35 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/minitest/test_minitest_mock.rb: Correct requiring path to
+ metametameta.rb.
+
+ * test/minitest/test_minitest_unit.rb: Correct requiring path to
+ metametameta.rb.
+
+Thu May 10 10:18:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (lex_state_name): returns name for lex_state_e, for debug
+ use.
+
+Wed May 9 16:36:01 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (MakeMakefile#pkg_config): check if libs resulted from
+ pkg-config works actually.
+
+Wed May 9 16:01:38 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb (decode_utf7, encode_utf7): refactored by
+ Nobuyoshi Nakada, to use String#encode.
+
+Wed May 9 13:26:25 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/rubygems/test_gem_remote_fetcher.rb: skip OpenSSL dependent
+ tests if not available.
+
+Wed May 9 08:09:38 2012 Ryan Davis <ryand-ruby@zenspider.com>
+
+ * lib/minitest/*: Imported minitest 3.0.0 (r7435)
+ * test/minitest/*: ditto
+ * test/rubygems/*: Imported fixes for buggy use of assert_match
+ and deprecated assert_block
+ UNBUNCH YOUR PANTIES. THE TESTS DO NOT RUN CLEAN ON OSX.
+
+Wed May 9 06:28:59 2012 Eric Hodel <drbrain@segment7.net>
+
+ * re.c (rb_reg_equal): Removed incorrect example for Regexp#== with
+ "n" option. [ruby-talk - Bug #6415]
+
+Wed May 9 06:23:33 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: reverted.
+
+Wed May 9 04:31:26 2012 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * lib/rinda/ring.rb (lookup_ring_any): fix Rinda::RingFinger.primary
+ hungs forever. [ruby-talk:395364]
+
+Tue May 8 21:09:00 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * include/ruby/win32.h (FD_SET): change function to macro.
+ To avoid buffer overflow when smaller FD_SETSIZE is used in ext
+ libraries.
+
+ * win32/win32.c (rb_w32_fdset): this function is not used anymore.
+ But we leave this for compatibility.
+
+ * win32/win32.c (rb_w32_select_with_thread): fix SEGV when smaller
+ FD_SETSIZE is used in ext libraries. Dereference of fd_set pointer
+ causes SEGV.
+
+ * test/-ext-/win32/test_fd_setsize.rb(TestFdSetSize): add tests for
+ above.
+ * ext/-test-/win32/fd_setsize/depend: ditto.
+ * ext/-test-/win32/fd_setsize/extconf.rb: ditto.
+ * ext/-test-/win32/fd_setsize/fd_setsize.c: ditto.
+
+ [ruby-core:44588] [Bug #6352]
+
+Tue May 8 20:44:46 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * io.c (io_unread): fix IO#pos with mode 'r' bug on Windows.
+ If the end of reading buffer is CR, io_unread() needs to unread one
+ more byte.
+ [ruby-core:44874] [Bug #6401]
+
+ * test/ruby/test_io_m17n.rb (TestIO_M17N#test_pos_with_buffer_end_cr):
+ add a test for above.
+
+Tue May 8 13:38:17 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * ext/date/date_core.c: improving introduction in Date/DateTime
+ documentation. patched by Daniel Kaufman via Github.
+ https://github.com/ruby/ruby/pull/110
+
+Tue May 8 13:36:02 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (POSTLINK): default to : command to get rid of flag
+ only command, since BSD make does not work with it.
+
+Tue May 8 13:35:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit.rb (MiniTest#run_test): remove exact trace and get rid
+ of IndexError, which could caused by modified $@ sometimes.
+
+Tue May 8 11:21:27 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/minitest/metametameta.rb (MetaMetaMetaTestCase#assert_report):
+ support drive letter on Windows. yes, the original code is metameta.
+
+Tue May 8 08:54:48 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/abbrev.rb: Fixed typo in abbrev pattern documentation. Based on
+ patch by Mark Rushakoff. [ruby-trunk - #6346]
+
+Tue May 8 07:44:18 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/openssl/ossl_ssl.c (ossl_start_ssl): remove useless rb_sys_fail
+ before ossl_raise. this cause a test failure on Linux.
+ http://u64.rubyci.org/~chkbuild/ruby-trunk/log/20120507T190102Z.log.html.gz
+
+Tue May 8 05:35:18 2012 Eric Hodel <drbrain@segment7.net>
+
+ * object.c (Init_Object): Added reference to variable.c where
+ public_constant and private_constant documentation lives. [#6381]
+
+Tue May 8 04:47:44 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit.rb (Test::Unit::Runner#output): prefer local output to
+ get rid of unexpected side effect in test/minitest/metametameta.rb.
+
+ * lib/test/unit.rb (MiniTest#run_test): show the running test in $0.
+
+ * lib/test/unit.rb (Test::Unit::StatusLineOutput): new class to output
+ in status line.
+
+ * test/testunit/test_hideskip.rb (TestHideSkip#test_hideskip):
+ MiniTest#puke now reports Skipped messages only if verbose mode.
+
+ * test/testunit/test_sorting.rb (TestTestUnitSorting#test_sorting):
+ ditto.
+
+ * lib/test/unit.rb (Test::Unit::Runner#puke): modify only result and
+ drop useless reports, not override entirely.
+
+ * bootstraptest/runner.rb (exec_test, show_progress): show rotators
+ and pass/fail counts.
+
+ * sample/test.rb (PROGRESS): refine output.
+
+Tue May 8 02:34:26 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/minitest/unit.rb (assert_match): refix of r35563.
+ r35563 breaks the intention of the original change.
+ https://github.com/seattlerb/minitest/commit/68858105b2eb11c85105ffac5f32b662c59397f3
+ * lib/minitest/unit.rb (refute_match): ditto.
+
+Mon May 7 21:19:17 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/json: Merge JSON 1.7.1.
+ https://github.com/flori/json/commit/e5b9a9465c1159fae533bca320d950b772bcb4ac
+
+Mon May 7 22:54:22 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_ssl.c: add support for option flags
+ OpenSSL::SSL::OP_NO_TLSv1_1
+ OpenSSL::SSL::OP_NO_TLSv1_2
+ to allow blocking specific TLS versions. Thanks to Justin Guyett for
+ pointing this out to me.
+ * test/openssl/test_ssl.rb: add tests to assert correct behavior when
+ blocking certain versions of TLS/SSL both on server and client side.
+ Also refactored tests to reduce boilerplate code a little.
+ * test/openssl/utils.rb: rescue Errno::ECONNRESET for tests where
+ client rejects the connection because a forbidden protocol version
+ was used.
+
+Mon May 7 20:14:15 2012 Tanaka Akira <akr@fsij.org>
+
+ * lib/securerandom.rb (random_bytes): call to_int method for the
+ argument at first.
+
+Mon May 7 17:54:12 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/minitest/unit.rb (assert_match): replace matcher only if both
+ matcher and obj are String. fix r35541. [Bug #6405]
+ DON'T COMMIT IF YOU CAN'T RUN TEST.
+ FIX AS SOON AS POSSIBLE YOU BREAK TESTS.
+ patched by ayumin.
+ https://github.com/seattlerb/minitest/pull/124
+
+ * lib/minitest/unit.rb (refute_match): ditto.
+
+Mon May 7 13:41:00 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * Makefile.in (PROGRAM), configure.in (POSTLINK): sign built program
+ using RUBY_CODESIGN identity.
+
+Mon May 7 13:03:55 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb (body_type_attachment): parse body type
+ "ATTACHMENT". [ruby-core:44849] [Bug #6397]
+
+Mon May 7 10:49:36 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/bigdecimal/bigdecimal.c (Init_bigdecimal): define IDs before
+ they are used. [ruby-core:44900] [Bug #6406]
+
+Mon May 7 10:27:56 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/digest/rmd160/rmd160.c (RMD160_Update): fix for huge data.
+
+Mon May 7 10:23:04 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/fileutils/fileasserts.rb: use assert_equal, assert_match, and so on.
+
+ * test/ruby/enc/test_utf16.rb, test/ruby/enc/test_utf32.rb,
+ test/ruby/test_io_m17n.rb (assert_str_equal): ditto.
+
+ * test/rubygems/test_gem_remote_fetcher.rb
+ (assert_data_from_{server,proxy}): ditto.
+
+ * test/test_pstore.rb (test_thread_safe): ditto.
+
+Mon May 7 10:16:30 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/rubygems/test_gem_installer.rb (TestGemInstaller#test_dir): fix
+ argument order. expected value must come first.
+
+Mon May 7 09:14:11 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_ssl.c: support TLSv1.1 & TLSv1.2. Add
+ SSLContext#version to inspect the version that was negotiated for
+ a given connection.
+ * ext/openssl/extconf.rb: detect TLS 1.1 & 1.2 support.
+ * test/openssl/test_ssl.rb: add tests for TLS 1.1 & 1.2 given they
+ are supported by the native OpenSSL being used.
+
+Sun May 6 21:34:29 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * io.c (io_encoding_set): suppress warnings. [ruby-dev:45627]
+ this tmp1 is not required after r35538.
+
+ * addr2line.c: suppress warnings.
+
+Sun May 6 18:39:39 2012 Koichi Sasada <ko1@atdot.net>
+
+ * compile.c (iseq_compile_each): remove unused variable `size'.
+
+Sun May 6 14:50:03 2012 Tanaka Akira <akr@fsij.org>
+
+ * lib/securerandom.rb: show actual read length in an error message.
+
+Sat May 5 06:43:10 2012 Ryan Davis <ryand-ruby@zenspider.com>
+
+ * lib/minitest/*: Imported minitest 2.12.1 (r7323)
+ * test/minitest/*: ditto
+
+Sat May 5 01:47:33 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * test/zlib/test_zlib.rb (test_inflate): add a test for Zlib.inflate.
+ patched by headius (Charles Nutter). [ruby-core:44859] [Bug #6398]
+
+ * test/zlib/test_zlib.rb (test_deflate): add a test for Zlib.deflate.
+
+Sat May 5 00:53:55 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * io.c (parse_mode_enc): remove warnings 'Ignoring internal encoding'.
+ [ruby-core:44455] [Bug #6324]
+
+ * io.c (io_encoding_set): ditto.
+
+Fri May 4 07:19:02 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/rdoc/parser.rb (RDoc.binary?): fix wrong regexp.
+ [ruby-core:44798] [Bug #6393]
+
+Fri May 4 01:33:20 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/rdoc/parser.rb (RDoc.alias_extension): a real file is irrelevant
+ to aliasing. [ruby-core:44796][Bug #6392]
+
+ * lib/rdoc/parser.rb (RDoc.zip?): non-existent file will not be a zip
+ file.
+
+ * lib/rdoc/parser.rb (RDoc.can_parse_by_name): accept aliased
+ extension file names.
+
+ * lib/rdoc/parser.rb (RDoc.binary?): binary read data may have
+ incomplete multibyte sequence. [ruby-core:44798][Bug #6393]
+
+Wed May 2 23:55:51 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit.rb (Test::Unit::RequireFiles#non_options): expand
+ real path to get rid of loading same files via symlinks.
+
+Wed May 2 23:26:04 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * cont.c (rb_fiber_m_transfer): improve sample code in Fiber#transfer
+ documentation. emphasize the difference between transfer and resume.
+
+Wed May 2 23:21:20 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (parser_yylex): allow spaces between lambda arrow and
+ parenthesis. [ruby-dev:45605][Feature #6390]
+
+Wed May 2 19:06:30 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * cont.c (rb_fiber_m_transfer): Improved Fiber documentation.
+ patched by Anuj Dutta. [ruby-core:44540][Bug #6343]
+
+Wed May 2 13:06:37 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * README, README.ja: reformatted using rdoc markup. based on the
+ patches by zzak (Zachary Scott) in [Feature #6388].
+
+ * README, README.ja: updated the author's mail address.
+
+Wed May 2 09:46:09 2012 Kouji Takao <kouji@takao7.net>
+
+ * ext/readline/readline.c (Readline.special_prefixes=)
+ (Readline.special_prefixes): new function. An original patch was
+ created by nagachika. [Feature #5784]
+
+Tue May 1 22:18:45 2012 Kouji Takao <kouji@takao7.net>
+
+ * ext/readline/readline.c (Readline.pre_input_hook)
+ (Readline.insert_text, Readline.redisplay): new function. An
+ original patch was created by nagachika. [Feature #5785]
+
+Tue May 1 15:46:48 2012 Koichi Sasada <ko1@atdot.net>
+
+ * common.mk: "$(Q)-..." doesn't work on nmake.
+
+Tue May 1 15:32:10 2012 Koichi Sasada <ko1@atdot.net>
+
+ * common.mk: replace '@' prefix to '$(Q)' to control build
+ process outputs.
+
+Tue May 1 14:17:59 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/openssl/deprecation.rb (OpenSSL.check_func): check if header is
+ available for macro compatibility.
+
+Tue May 1 10:53:54 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_settracefunc.rb: ignore traces from another threads
+ because Kernel.set_trace_func affects other threads.
+
+Tue May 1 06:04:14 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/digest/sha2/sha2.c (REVERSE32): explicitly cast since unsigned
+ long may be larger than sha2_word32.
+
+ * ext/digest/sha2/sha2.c (SHA{256,512,384}_{Final,End}): should clear
+ whole content, not pointer size.
+
+ * ext/digest/*/extconf.rb: use pkg_config to use same library with
+ openssl. [ruby-core:44755][Bug #6379]
+
+ * ext/openssl/deprecation.rb: extract check for broken Apple OpenSSL.
+
+Tue May 1 05:02:30 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (optflags): disable unsafe optimizations.
+ [ruby-core:44679][Bug #6370]
+
+Mon Apr 30 23:36:49 2012 Tanaka Akira <akr@fsij.org>
+
+ * lib/fileutils.rb (copy_metadata): use File.lchown and File.lchmod to
+ update meta data of symlinks.
+
+Mon Apr 30 23:05:53 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * test/ruby/test_continuation.rb (tracing_with_set_trace_func): don't
+ call Continuation from other threads. [ruby-dev:45596] [Bug #6382]
+
+Mon Apr 30 20:10:04 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/zlib/extconf.rb: detect z_crc_t type which will be defined
+ since zlib-1.2.7.
+
+ * ext/zlib/zlib.c (rb_zlib_crc_table): use z_crc_t if available.
+
+Mon Apr 30 09:02:15 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * ext/openssl/lib/openssl/ssl.rb: add hostname to "hostname does not
+ match server cert." error. patched by Wes Morgan via Github.
+ https://github.com/ruby/ruby/pull/122
+
+Mon Apr 30 04:43:53 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/json/yaml_events.rb: implicit styles should not
+ be changeable for JSON events.
+
+Sun Apr 29 06:12:02 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (assoc, parser_yylex): add syntax to splat keyword hash.
+ [ruby-core:44591][Feature #6353]
+
+ * compile.c (compile_array_): generate keyword splat insns.
+
+ * vm.c (m_core_hash_merge_kwd): merge keyword hash into intermediate
+ hash. leftward argument is prior currently.
+
+Fri Apr 27 12:34:23 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/dl/cfunc.c (rb_dlcfunc_call): should convert a Bignum value to
+ unsigned long long on Win64.
+ [ruby-core:44636][Bug #6364] reported by raylinn@gmail.com (ray linn)
+
+Fri Apr 27 10:58:17 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/readline/test_readline.rb (setup): avoid affected by user's
+ inputrc file. [ruby-dev:45584][Bug #6357]
+
+Fri Apr 27 01:45:05 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * thread.c (rb_threadptr_execute_interrupts_common):
+ handle timer_interrupt only on the first loop for the case to avoid
+ the infinite loop like following case:
+ * there is 2 Ruby threads (3 pthreads)
+ (1) main thread is waiting at gvl_yield:112 (native_cond_wait)
+ (2) sub thread works
+ (3) sub thread waits at gvl_yield:133 (native_mutex_unlock)
+ (4) main thread works
+ (5) main thread goes to gvl_acquire_common
+ (6) main thread call rb_wakeup_timer_thread
+ (7) timer thread set timer interrupt to the main thread
+ (8) main thread works
+ (9) main thread waits at gvl_acquire_common:64 (native_cond_wait)
+ (10) sub tread works
+ (11) set sub thread as the current thread
+ (12) run Ruby thread
+ (13) ...100ms
+ (14) sub thread goes to rb_threadptr_execute_interrupts_common
+ (15) sub thread call rb_thread_schedule_limits
+ (16) sub thread call gvl_release_common
+ (17) sub threads waits at gvl_yield:121 (native_cond_wait)
+ (18) main threads works
+ (19) main thread back to gvl_yield
+ (20) set main thread as the current thread
+ (21) main thread call gvl_yield
+ (22) main thread waits at gvl_yield:112 (native_cond_wait)
+ As described above, the main thread can't escape from
+ rb_threadptr_execute_interrupts_common.
+ See extended memo: http://bugs.ruby-lang.org/projects/ruby-trunk/wiki/R35480_ExtendedMemo
+
+Fri Apr 27 07:15:07 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/socket.c (sock_s_pack_sockaddr_un): support the longest
+ path in sockaddr_un, really.
+ reported by nagachika.
+ http://d.hatena.ne.jp/nagachika/20120426/ruby_trunk_changes_35474_35476
+
+Thu Apr 26 12:28:06 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/raddrinfo.c (init_unix_addrinfo): support the longest
+ path in sockaddr_un.
+ (inspect_sockaddr): ditto.
+ (addrinfo_mdump): ditto.
+ (addrinfo_mload): ditto.
+ (rsock_unixpath_str): new function.
+ (rsock_unixpath): removed.
+ (rsock_unixaddr): use rsock_unixpath_str.
+
+ * ext/socket/socket.c (sock_s_pack_sockaddr_un): support the longest
+ path in sockaddr_un.
+ (sock_s_unpack_sockaddr_un): ditto.
+ (sock_s_gethostbyaddr): unused variable removed.
+
+ * ext/socket/unixsocket.c (rsock_init_unixsock): support the longest
+ path in sockaddr_un.
+
+ * ext/socket/rubysocket.h (rsock_unixpath_str): declared.
+ (rsock_unixpath): removed.
+
+ * test/socket/test_unix.rb: comment out test_nul because abstract unix
+ sockets may contain NULs.
+
+Thu Apr 26 01:32:33 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * test/optparse/test_summary.rb (test_summary_containing_space): add
+ test for r35467. OptionParser#to_a shouldn't split banner by spaces.
+
+Wed Apr 25 23:02:46 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/raddrinfo.c (init_unix_addrinfo): refine error message
+ format.
+ (addrinfo_mload): show more information on "too long AF_UNIX path"
+ error.
+ (addrinfo_unix_path): ditto for "too short AF_UNIX address" and
+ "too long AF_UNIX address" error.
+
+Wed Apr 25 05:46:12 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/optparse.rb (OptionParser#to_a): split for each lines.
+ [ruby-dev:45568][Bug #6348]
+
+Tue Apr 24 21:57:53 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/raddrinfo.c (init_unix_addrinfo): show actual path length
+ when it is too long for Unix socket.
+
+ * ext/socket/unixsocket.c (rsock_init_unixsock): ditto.
+
+ * ext/socket/socket.c (sock_s_pack_sockaddr_un): ditto.
+
+Tue Apr 24 21:43:58 2012 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * lib/net/smtp.rb (check_continue): raise an error with an explanatory
+ message. [ruby-core:35854] [Feature #4598]
+
+Tue Apr 24 21:11:31 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/optparse.rb (OptionParser#to_a): should split by end-of-line,
+ and MUST TEST IT, MUST RUN THE TEST, MUST VERIFY BEFORE BACKPORT.
+ [ruby-dev:45568][Bug #6348]
+
+Tue Apr 24 19:59:31 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * enc/euc_jp.c: added EUC-JP-2004 and its alias EUC-JISX0213.
+ [ruby-dev:45571] [Feature #6349]
+ Requested by Kyouhei Yanagita <yanagi@shakenbu.org>.
+
+ * enc/trans/japanese_euc.trans: ditto.
+
+ * enc/trans/JIS/JISX0213-[12]%UCS@{BMP,SIP}.src: JIS X 0213:2004 ->
+ Unicode mapping table from NetBSD.
+
+ * enc/trans/JIS/UCS@{BMP,SIP}%JISX0213-[12].src: Unicode -> JIS X
+ 0213:2004 mapping table from NetBSD.
+
+ * tool/transcode-tblgen.rb: added SIP support.
+
+ * test/ruby/test_transcode.rb: tests of above changes.
+
+Tue Apr 24 18:12:13 2012 Koichi Sasada <ko1@atdot.net>
+
+ * compile.c: fix to output warning when the same literals
+ are available as a condition of same case clause.
+ And remove information ('#n') because we can find duplicated
+ condition with explicit line numbers.
+ [ruby-core:38343] [Ruby 1.9 - Bug #5068]
+
+ * test/ruby/test_syntax.rb: add a test for above.
+
+Tue Apr 24 17:03:51 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (waitpid): need to check the return value of
+ FindChildSlotByHandle() before passing poll_child_status().
+ this fixed a SEGV in test-all. reported by ko1 via IRC.
+
+Tue Apr 24 16:04:39 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (parser_yylex): EXPR_BEG by keywords is a start point of
+ commands. [ruby-dev:45563][Bug #6347]
+
+ * parse.y (superclass): ditto for superclass.
+
+ * parse.y (parser_parse_string, parser_here_document): ditto for
+ string interpolation.
+
+ * parse.y (parser_yylex): ditto for singleton class.
+
+Tue Apr 24 15:51:41 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/optparse.rb (OptionParser#to_a): should split by end-of-line
+ [ruby-dev:45568][Bug #6348]
+
+ * lib/optparse.rb (OptionParser#to_a): String#to_a is no longer
+ defined. [ruby-dev:45568][Bug #6348]
+
+Tue Apr 24 12:46:50 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * hash.c, object.c, struct.c, lib/ostruct.rb: add to_h methods.
+ [Feature #6276]
+
+Tue Apr 24 10:54:34 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/drb/drbtest.rb ({DRbCore,DRbAry}#teardown): cannot pass SIGTERM
+ to another process on Windows, so use SIGINT instead.
+
+Tue Apr 24 00:25:39 2012 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * thread.c (rb_check_deadlock): refine an error message of deadlock
+ detection. [ruby-core:44336] [Bug #6288]
+
+Tue Apr 24 00:14:42 2012 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * parse.y (primary): remove wrong "fixpos" that caused incorrect
+ source_location of blocks. [ruby-core:42232] [Bug #5930]
+
+ * test/ruby/test_proc.rb: add a test for above.
+
+Mon Apr 23 22:56:08 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/iconv: deprecated. [Feature #6322]
+
+Mon Apr 23 22:07:00 2012 Tanaka Akira <akr@fsij.org>
+
+ * test/socket/test_unix.rb (bound_unix_socket): make temporary
+ filename shorter for less possibility of Unix socket path over
+ 107 bytes when TMPDIR has long path.
+
+Mon Apr 23 20:35:49 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (szInternalCmds, internal_match, internal_cmd_match):
+ get rid of a segmentation fault with GCC 4.7.0.
+ reported by raylinn@gmail.com (ray linn) at [ruby-core:44505]
+ [Bug #6333], and patched by mame.
+
+ * test/ruby/test_system.rb (TestSystem#test_system): test for it.
+
+Mon Apr 23 20:11:02 2012 Tanaka Akira <akr@fsij.org>
+
+ * lib/drb/ssl.rb: generate 1024 bits RSA key instead of 512 bits.
+ OpenSSL 1.0.1 rejects 512 bits RSA key for TLS1.2 with SHA512.
+ http://rt.openssl.org/Ticket/Display.html?id=2769&user=guest&pass=guest
+ reported by Bohuslav Kabrda.
+ [ruby-core:43844] [ruby-trunk - Bug #6221]
+
+Mon Apr 23 19:54:33 2012 Tanaka Akira <akr@fsij.org>
+
+ * test/drb/drbtest.rb: rescue Errno::ESRCH for Process.kill.
+ reported by NARUSE, Yui. [ruby-dev:45551]
+
+Mon Apr 23 14:16:45 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * .gdbinit (rb_ps_vm): follow st_table's packing change.
+
+Mon Apr 23 10:43:30 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: disable rubygems not to load rbconfig.rb before
+ fake.rb. [ruby-core:44492][Bug #6329]
+
+Sun Apr 22 20:26:06 2012 Tanaka Akira <akr@fsij.org>
+
+ * lib/drb/extservm.rb (DRb::ExtServManager): don't use /bin/sh to
+ invoke service subprocess. mark detach threads for clean up.
+
+ * test/drb/drbtest.rb: clean up the service subprocess in teardown.
+
+ * test/drb/test_drb.rb: set @service_name for teardown.
+
+ * test/drb/test_drbunix.rb: ditto.
+
+ * test/drb/test_drbssl.rb: ditto.
+
+ [ruby-dev:45547]
+
+Sun Apr 22 07:51:29 2012 Tanaka Akira <akr@fsij.org>
+
+ * lib/drb/ssl.rb: close accepted TCP socket if SSL accept is failed.
+ [ruby-dev:45541]
+
+Sat Apr 21 14:36:49 2012 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * test/rinda/test_rinda.rb: fix sticks on some tests problem
+ [Bug #6272]
+
+Fri Apr 20 12:24:04 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/ssl_certs/AddTrustExternalCARoot.pem: Removed to avoid
+ conflict with ca-bundle.pem
+ * lib/rubygems/ssl_certs/VerisignClass3PublicPrimaryCertificationAuthority-G2.pem:
+ ditto.
+ * lib/rubygems/ssl_certs/Entrust_net-Secure-Server-Certification-Authority.pem:
+ ditto.
+
+Fri Apr 20 08:07:06 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems: Update to RubyGems 1.8.23 which contains security
+ fixes:
+
+ RubyGems now disallows redirection from HTTPS to HTTP.
+
+ RubyGems now verifies SSL connections.
+
+ See https://github.com/rubygems/rubygems/blob/1.8/History.txt for
+ changes since 1.8.22.
+ * test/rubygems: ditto.
+
+Thu Apr 19 16:33:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * strftime.c (rb_strftime_with_timespec): fix carry-up bug and
+ overwrite '+' with '-' if negative offset less than a hour.
+ [ruby-core:44447][Bug #6323]
+
+Thu Apr 19 09:39:57 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/-test-/win32/dln/extconf.rb: need import library for ordinal
+ entry even on mingw. [ruby-core:44441][Bug #6320]
+
+Thu Apr 19 09:35:15 2012 Eric Hodel <drbrain@segment7.net>
+
+ * random.c (random_init): Clarify that the default seed is
+ Random.new_seed, not zero. Based on patch by Roger Pack.
+ [ruby-trunk - Bug #6313]
+ * random.c (rb_f_srand): ditto.
+
+Thu Apr 19 08:59:02 2012 Eric Hodel <drbrain@segment7.net>
+
+ * ext/curses/curses.c (window_nodelay): Fixed call-seq of nodelay to
+ include the '='.
+
+ Improved description window.nodelay=.
+
+Thu Apr 19 08:47:54 2012 Eric Hodel <drbrain@segment7.net>
+
+ * io.c (io_readpartial): Document the output buffer parameter is
+ overwritten with the read contents even when non-empty.
+ Patch by yu nobuoka. [ruby-trunk - Bug #6285]
+ * io.c (io_read_nonblock): ditto.
+ * io.c (io_read): ditto.
+ * io.c (rb_io_sysread): ditto.
+ * io.c (argf_read): ditto.
+ * io.c (argf_readpartial): ditto.
+ * ext/stringio/stringio.c (strio_read): ditto.
+ * test/ruby/test_argf.rb (class TestArgf): Add test for existing
+ behavior of read outbuf.
+ * test/ruby/test_io.rb (class TestIO): ditto.
+ * test/stringio/test_stringio.rb (class TestStringIO): ditto.
+
+Wed Apr 18 22:58:55 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (DOT, DOXYGEN): use AC_CHECK_PROGS instead of
+ AC_CHECK_PROG which needs the third argument. [ruby-core:44433]
+ [Bug #6316]
+
+ * configure.in (PKG_CONFIG): fix condition to skip older version
+ of pkg-config. continue in backticks does not affect outside.
+
+Wed Apr 18 13:59:40 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/file.c (INVALID_FILE_ATTRIBUTES): define for old SDK.
+
+Wed Apr 18 10:22:54 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * strftime.c (rb_strftime_with_timespec): add an interim digit for
+ the timezone offset which is less than an hour.
+
+Wed Apr 18 09:58:29 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/version.rb: Fixed init_with warning by calling into
+ yaml_initialize (for syck) from psych's init_with
+
+Wed Apr 18 09:03:43 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems: Update to RubyGems 1.8.22 plus r33517 and r35337 which
+ were ported to the rubygems git repository.
+
+ See https://github.com/rubygems/rubygems/blob/1.8/History.txt for
+ changes since 1.8.11.
+
+ * test/rubygems: ditto.
+
+Tue Apr 17 22:18:48 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * strftime.c (rb_strftime_with_timespec): fix padding of time zone
+ offset. [ruby-dev:43287][Bug #4458]
+
+Tue Apr 17 13:11:14 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dln.c (rb_w32_check_imported): skip ordinal entries. based on a
+ patch by phasis68 (Heesob Park) at [ruby-core:44381].
+ [ruby-core:44371][Bug #6303]
+
+Mon Apr 16 18:22:14 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * spec/default.mspec: expand relative path for ruby_exe which uses
+ them with Dir.chdir; it breaks relative paths, for example
+ core/kernel/exec_spec.rb.
+
+Mon Apr 16 16:22:40 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/win32.c (gmtime_r, localtime_r): POSIX compliant reentrant
+ versions.
+
+ * configure.in (RUBY_MSVCRT_VERSION): define on mingw too.
+
+ * win32/Makefile.sub (config.h): prefix RT_VER with RUBY and make
+ more descriptive to get rid of potential conflict.
+
+Mon Apr 16 15:19:39 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (NO_RUBY_VENDOR_LIB): fix missing comma.
+
+Mon Apr 16 12:17:12 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * lib/matrix.rb (hermitian?): Bug fix, patch by George Koehler
+ [Bug #6290] [rubyspec:4b9573d7613]
+
+Mon Apr 16 09:42:50 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * lib/rubygems/remote_fetcher.rb (Gem::RemoteFetcher#download): should
+ use File.identical? to check the identity of the files.
+ this fixed an error of a test on Windows.
+
+Sat Apr 14 12:55:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (UNREACHABLE): gcc 4.4 eliminates unreachable code
+ if -O3 is given.
+
+ * win32/win32.c (child_result): dropped colon.
+
+Sat Apr 14 10:45:18 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/webrick/server.rb (WEBrick::GenericServer#start):
+ partially revert r35315.
+
+ * test/webrick/test_server.rb (test_start_exception):
+ received signal is delivered to the main thread, so it is needed to
+ emulate it. patched by Eric Hodel. [ruby-core:44348] [Feature #6236]
+
+Sat Apr 14 09:35:45 2012 Eric Hodel <drbrain@segment7.net>
+
+ * variable.c (trace_ev): Removed "not reached" comment as this line is
+ reached.
+ * variable.c (rb_obj_remove_instance_variable): Replaced "not reached"
+ comment with the UNREACHABLE macro.
+ * variable.c (rb_mod_const_missing): ditto.
+ * variable.c (rb_mod_remove_cvar): ditto.
+ * enum.c (first_i): ditto.
+ * string.c (rb_str_aref): ditto.
+ * string.c (str_byte_aref): ditto.
+ * string.c (rb_to_id): ditto.
+ * io.c (rb_io_fmode_modestr): ditto.
+ * io.c (rb_io_oflags_modestr): ditto.
+ * pack.c (num2i32): ditto.
+ * vm_eval.c (rb_method_missing): ditto.
+ * vm_eval.c (rb_f_throw): ditto.
+ * dir.c (dir_read): ditto.
+ * win32/win32.c (child_result): ditto.
+ * struct.c (rb_struct_getmember): ditto.
+ * struct.c (rb_struct_set): ditto.
+ * struct.c (rb_struct_aref_id): ditto.
+ * eval.c (rb_f_raise): ditto.
+ * process.c (rb_f_exit_bang): ditto.
+ * process.c (rb_f_exit): ditto.
+ * process.c (rb_f_abort): ditto.
+ * ext/-test-/iter/break.c (iter_break_value): ditto.
+ * ext/pty/pty.c (pty_check): ditto.
+ * ext/openssl/ossl_pkey.c (ossl_pkey_new): ditto.
+ * ext/readline/readline.c (rb_remove_history): ditto.
+ * ext/stringio/stringio.c (strio_unimpl): ditto.
+ * numeric.c (num_sadded): ditto.
+ * numeric.c (num_init_copy): ditto.
+ * numeric.c (rb_num2ll): ditto.
+ * numeric.c (rb_num2ull): ditto.
+ * vm_insnhelper.c (call_cfunc): ditto.
+ * ruby.c (opt_W_getter): ditto.
+ * bignum.c (rb_big_coerce): ditto.
+ * file.c (rb_f_test): ditto.
+
+Sat Apr 14 08:38:20 2012 Eric Hodel <drbrain@segment7.net>
+
+ * encoding.c (rb_enc_codepoint_len): Use UNREACHABLE to avoid "control
+ reaches end of non-void function" warnings. [ruby-trunk - Bug #6066]
+ * re.c (name_to_backref_number): ditto.
+ * object.c (rb_Float): ditto.
+ * io.c (io_readpartial): ditto.
+ * io.c (io_read_nonblock): ditto.
+ * pack.c (rb_uv_to_utf8): ditto.
+ * proc.c (rb_method_entry_arity): ditto.
+ * vm_method.c (rb_f_notimplement): ditto.
+ * struct.c (rb_struct_aset_id): ditto.
+ * class.c (rb_scan_args): ditto.
+ * process.c (rlimit_resource_type): ditto.
+ * process.c (rlimit_resource_value): ditto.
+ * process.c (p_uid_switch): ditto.
+ * process.c (p_gid_switch): ditto.
+ * ext/digest/digest.c (rb_digest_instance_update): ditto.
+ * ext/digest/digest.c (rb_digest_instance_finish): ditto.
+ * ext/digest/digest.c (rb_digest_instance_reset): ditto.
+ * ext/digest/digest.c (rb_digest_instance_block_length): ditto.
+ * ext/bigdecimal/bigdecimal.c (BigDecimalCmp): ditto.
+ * ext/dl/handle.c (rb_dlhandle_close): ditto.
+ * ext/tk/tcltklib.c (pending_exception_check0): ditto.
+ * ext/tk/tcltklib.c (pending_exception_check1): ditto.
+ * ext/tk/tcltklib.c (ip_cancel_eval_core): ditto.
+ * ext/tk/tcltklib.c (lib_get_reltype_name): ditto.
+ * ext/tk/tcltklib.c (create_dummy_encoding_for_tk_core): ditto.
+ * ext/tk/tkutil/tkutil.c (tk_hash_kv): ditto.
+ * ext/openssl/ossl_ssl.c (ossl_ssl_session_reused): ditto.
+ * ext/openssl/ossl_pkey_ec.c (ossl_ec_key_dsa_verify_asn1): ditto.
+ * ext/openssl/ossl_pkey_ec.c (ossl_ec_point_is_at_infinit): ditto.
+ * ext/openssl/ossl_pkey_ec.c (ossl_ec_point_is_on_curve): ditto.
+ * ext/fiddle/conversions.c (generic_to_value): ditto.
+ * ext/socket/raddrinfo.c (rsock_io_socket_addrinfo): ditto.
+ * ext/socket/socket.c (sock_s_getnameinfo): ditto.
+ * ext/ripper/eventids2.c (ripper_token2eventid): ditto.
+ * cont.c (return_fiber): ditto.
+ * dmydln.c (dln_load): ditto.
+ * vm_insnhelper.c (vm_search_normal_superclass): ditto.
+ * bignum.c (big_fdiv): ditto.
+ * marshal.c (r_symlink): ditto.
+ * marshal.c (r_symbol): ditto.
+
+Fri Apr 13 17:12:09 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * hash.c (inspect_i): keep string's coderange.
+
+Fri Apr 13 15:26:51 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * hash.c (rb_hash_aset, rb_hash_update, rb_hash_update_by): use
+ st_update() to reduce evaluation of hash values.
+
+Fri Apr 13 15:17:36 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/webrick/server.rb (WEBrick::GenericServer#stop): fix r35303;
+ this method is to deny new connections, not shutdown yet.
+
+ * lib/webrick/server.rb (WEBrick::GenericServer#start):
+ re-raise exception only when the exception is Interrupt (^C).
+
+Thu Apr 12 19:51:45 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: added some notes.
+
+Wed Apr 11 17:16:49 2012 Koichi Sasada <ko1@atdot.net>
+
+ * compile.c (compile_array, compile_array_):
+ Divide big array (or hash) literals into several blocks and
+ concatenate them. There was a problem that a big array (hash)
+ literal causes SystemStackError exception (stack overflow)
+ because VM push all contents of the literal onto VM stack to
+ make an array (or hash). To solve this issue, we make several
+ arrays (hashes) and concatenate them to make a big array (hash)
+ object. [ruby-dev:37701] [Bug #982]
+
+ * compile.c (iseq_compile_each, setup_args): use modified
+ compile_array.
+
+ * vm.c (m_core_hash_from_ary, m_core_hash_merge_ary,
+ m_core_hash_merge_ptr): added for above change.
+
+ * id.c (Init_id), parse.y: add core method ids.
+
+ * bootstraptest/test_literal.rb: add simple tests.
+
+ * bootstraptest/test_eval.rb: remove rescue clause to catch
+ SystemStackError exception.
+
+ * test/ruby/test_literal.rb: add tests to check no stack overflow.
+
+Thu Apr 12 07:10:37 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/uri/generic.rb (module URI): URI now downcases the scheme to
+ follow RFC 2396 section 3.1. [ruby-trunk - Feature #4551]
+ * test/uri/test_generic.rb (class URI): Test for above
+
+Thu Apr 12 06:15:44 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/net/protocol.rb (module Net): Added ReadTimeout to match
+ OpenTimeout. ReadTimeout is now raised by rbuf_fill instead of
+ Timeout::Error to help users distinguish what type of timeout
+ occurred. [ruby-trunk - Feature #6088]
+ * lib/net/pop.rb (module Net): Updated documentation for ReadTimeout
+ and OpenTimeout.
+ * lib/net/http.rb (module Net): ditto
+ * lib/net/smtp.rb (module Net): ditto
+ * lib/net/telnet.rb (module Net): Net::ReadTimeout is now raised in
+ waitfor to match Net::Protocol.
+ * test/net/http/test_http.rb: Updated Timeout::Error expectation to
+ Net::ReadTimeout.
+ * test/net/ftp/test_ftp.rb: ditto
+
+Thu Apr 12 05:27:01 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/webrick/server.rb (module WEBrick::GenericServer): A server
+ will now continue only when a StandardError subclass is raised. For
+ other exception types the error will be logged at the fatal level and
+ the server will safely stop. Based on a patch by Alex Young.
+ [ruby-trunk - Feature #6236]
+ * test/webrick/test_server.rb: Test for new exception handling
+ behavior. Join the server thread instead of busy-waiting for it to
+ shut down to remove race conditions.
+
+Thu Apr 12 03:50:44 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/test/unit.rb (Test::Unit:Runner::Worker#_run_suites):
+ call GC.start before running the test suites.
+
+Wed Apr 11 22:31:19 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (rb_check_id_cstr): new function to check if ID is
+ registered with NUL-terminated C string.
+
+ * sprintf.c (rb_str_format): avoid inadvertent symbol creation.
+
+Wed Apr 11 20:28:36 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * io.c (rb_io_eof): use eof() instead of io_fillbuf(). It's because
+ io_unread() doesn't work properly when reading CRLF with read(length)
+ and mode 'r'.
+ [ruby-core:44189][Bug #6271]
+
+ * test/ruby/test_io_m17n.rb (TestIO_M17N#test_read_crlf_and_eof):
+ test for above.
+
+Wed Apr 11 07:38:33 2012 Eric Hodel <drbrain@segment7.net>
+
+ * ext/digest/sha2/lib/sha2.rb (Digest#block_length): Fixed method name
+ in documentation examples. Patch by naleski via
+ https://github.com/ruby/ruby/pull/115
+
+Wed Apr 11 07:33:13 2012 Eric Hodel <drbrain@segment7.net>
+
+ * pack.c (pack_pack): Warn when an invalid character is found in the
+ format string when $VERBOSE is true. [ruby-trunk - Feature #5219]
+ * pack.c (pack_unpack): ditto
+ * test/ruby/test_pack.rb (class TestPack): Test for warnings on
+ invalid format characters.
+
+Wed Apr 11 06:11:10 2012 Eric Hodel <drbrain@segment7.net>
+
+ * string.c (rb_str_tr): Documented use of \ to escape characters.
+ [ruby-trunk - Bug #6161]
+ * string.c (rb_str_count): ditto
+
+Wed Apr 11 05:14:51 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/abbrev.rb: Clarified that Abbrev.abbrev returns a Hash instead
+ of an Array. Patch by Andrei Bocan. [ruby-trunk - Bug #6107]
+
+Wed Apr 11 03:02:24 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * ext/ripper/lib/ripper/sexp.rb: fix spelling. patched by
+ Jonathan Hinkle via https://github.com/ruby/ruby/pull/116
+
+Tue Apr 10 19:07:04 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * error.c (rb_enc_raise): new function to raise an exception with
+ the message in the given encoding. patched by now (Nikolai
+ Weibull) at [ruby-core:41160]. [Feature #5650]
+
+Tue Apr 10 18:19:32 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/http.rb (Net::HTTP#send_request_with_body_stream):
+ use IO.copy_stream for requests using body_stream.
+ patched by Eric Wong. [ruby-core:40898] [Feature #5605]
+
+Tue Apr 10 16:53:21 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread_pthread.c: add prototype declarations for older Mac OS X.
+ [ruby-core:43376][Bug #6170]
+
+Tue Apr 10 15:35:21 2012 Koichi Sasada <ko1@atdot.net>
+
+ * compile.c (iseq_set_sequence): show a hint if there are duplicated
+ "when" clauses. [ruby-core:41502] [ruby-trunk - Feature #5716]
+
+Tue Apr 10 09:57:00 2012 Eric Hodel <drbrain@segment7.net>
+
+ * string.c (rb_str_split_m): Documented behavior of split on the empty
+ string. [ruby-trunk - Feature #3575]
+
+Tue Apr 10 09:48:31 2012 Eric Hodel <drbrain@segment7.net>
+
+ * ext/zlib/zlib.c (rb_deflate_s_deflate): Fixed ruby example replacing
+ NO_FLUSH with FINISH. [ruby-trunk - Bug #6273]
+
+Mon Apr 9 23:10:26 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/win32.c (isUNCRoot, winnt_stat): support long UNC.
+ [ruby-core:30623][Feature #3399]
+
+Mon Apr 9 15:16:01 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (string_content, parser_yylex): count brace nesting to
+ dispatch embexpr_end. [ruby-core:43775][Bug #6211]
+
+Mon Apr 9 13:06:58 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * hash.c (rb_hash_set_default_proc): Accept nil, patch by Run Paint
+ [Feature #4234]
+
+ * test/ruby/test_hash.rb: test for above.
+
+Mon Apr 9 08:01:15 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_strftime.c: gets the value with range() consistently.
+ * ext/date/date_strftime.c (range): now just replaces the given item.
+
+Mon Apr 9 06:58:01 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * complex.c (nucomp_expt): [ruby-core:44170].
+
+Mon Apr 9 02:52:03 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * complex.c (nucomp_expt): the result of f_complex_new2 may be a fixnum
+ with mathn. [ruby-core:44170] [Bug #6267]
+
+Sun Apr 8 22:46:01 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/json/generator/generator.c (generate_json_bignum):
+ add RB_GC_GUARD.
+ http://fb.rubyci.org/~chkbuild/ruby-trunk/log/20120407T210301Z.diff.html.gz
+
+Sun Apr 8 07:26:40 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler): get keys
+ and fetch values from it to prevent @timeout_info's error
+ "can't add a new key into hash during iteration".
+
+Sun Apr 8 06:51:57 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * io.c (io_unread): cast as long the value for extra_max.
+ [ruby-core:44137] [Bug #6257]
+
+Sun Apr 8 06:46:48 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/webrick/httpresponse.rb (WEBrick::HTTPResponse#send_body_io):
+ use readpartial to get data even if the response is streaming data and
+ each data is smaller than @buffer_size.
+ patched by yu nobuoka. [ruby-dev:45471] [Bug #6230]
+
+Sat Apr 7 22:35:36 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * include/ruby/win32.h (rb_w32_aspawn_flags): add the declaration of
+ new function.
+
+ * process.c (enum): add EXEC_OPTION_PGROUP and move the position
+ above for the usage in proc_spawn_n().
+
+ * process.c (proc_spawn_n): add an argument to pass new option
+ `new_pgroup`. The option specifies CREATE_NEW_PROCESS_GROUP flag to
+ CreateProcessW(). This flag is necessary for the usage of
+ Process.kill on the subprocess on Windows.
+
+ * process.c (rb_exec_arg_addopt): ditto.
+
+ * process.c (rb_spawn_process): ditto.
+
+ * process.c (documentation for rb_f_spawn): add documentation for new
+ option `new_pgroup` of spawn.
+
+ * test/ruby/test_process.rb (TestProcess#test_execopts_new_pgroup):
+ add tests for option `new_pgroup`.
+
+ * test/ruby/test_thread.rb
+ (TestThreadGroup#test_thread_timer_and_interrupt):
+ add option `new_pgroup: true` to spawn on Windows. It's needed for
+ Process.kill on a subprocess.
+
+ * win32/win32.c (CreateChild): add an argument to pass
+ dwCreationFlags of CreateProcessW().
+
+ * win32/win32.c (rb_w32_spawn): ditto.
+
+ * win32/win32.c (rb_w32_aspawn_flags): add new function to pass
+ dwCreationFlags.
+
+ * win32/win32.c (rb_w32_aspawn): refactor to move the content to
+ rb_w32_aspawn_flags().
+ [ruby-core:43245][Bug #6131]
+
+Sat Apr 7 22:32:00 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * test/ruby/test_thread.rb
+ (TestThreadGroup#test_thread_timer_and_interrupt): skip on Windows.
+ Process.kill cannot kill a subprocess if CREATE_NEW_PROCESS_GROUP
+ flag is not specified in a call to CreateProcessW().
+
+ * win32/win32.c (CreateChild): revert the usage of
+ CREATE_NEW_PROCESS_GROUP flag for compatibility.
+ [ruby-core:43245][Bug #6131]
+
+Sat Apr 7 10:28:40 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych.rb: bumping up psych version to match release.
+ * ext/psych/psych.gemspec: ditto
+
+Sat Apr 7 02:07:00 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/parser.c: fall back to any encoding if the external
+ encoding is wrong. [ruby-core:44163]
+ * test/psych/test_encoding.rb: fix test
+
+Fri Apr 6 16:24:24 2012 Martin Duerst <duerst@it.aoyama.ac.jp>
+
+ * struct.c (documentation for rb_struct_members_m):
+ fix 'array of strings' to 'array of symbols'
+ [ruby-core:44152][Bug #6264]
+
+Fri Apr 6 14:27:04 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * Makefile.in ($(LIBRUBY_A)): fix typo.
+
+Thu Apr 5 13:26:15 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * missing/alloca.c (xmalloc, xfree): use ruby version, not
+ depending on RUBY_LIB_PREFIX. [ruby-dev:45492][Bug #6255]
+
+Wed Apr 4 13:06:39 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/ftp/ftp.rb (Net::FTP#close): restore original read_timeout.
+
+Wed Apr 4 10:33:31 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/ftp/ftp.rb (Net::FTP#close): ignore exceptions from shutdown and
+ read on closing.
+
+Wed Apr 4 01:48:35 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/ftp/ftp.rb (Net::FTP#close): close socket more gracefully.
+
+ * lib/ftp/ftp.rb (Net::BufferedSocket#shutdown): added.
+
+ * test/net/ftp/test_ftp.rb (FTPTest#create_ftp_server): wait socket
+ with shutdown and read.
+
+Tue Apr 3 19:00:52 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/net/ftp/test_ftp.rb (FTPTest#create_ftp_server): should wait
+ a little before closing socket because if the client call
+ Net::FTP#getmultiline the socket is suddenly closed by the server in
+ the getline loop.
+
+Tue Apr 3 18:33:38 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * process.c (setreuid, setregid): suppress warnings.
+ [ruby-core:43374][Bug #6169]
+
+Tue Apr 3 10:18:27 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * enumerator.c (inspect_enumerator): suppress uninitialized
+ instance variable warnings. [ruby-dev:45449][Bug #6214]
+ patched by no6v (Nobuhiro IMAI).
+
+Mon Apr 2 13:25:08 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/optparse/ac.rb: autoconf-like options.
+
+Mon Apr 2 10:34:00 2012 eregon <eregontp@gmail.com>
+
+ * string.c (rb_str_start_with, rb_str_end_with): raise an error if
+ an argument is not convertible to a String.
+ [ruby-core:40623][Bug #5536]
+
+Mon Apr 2 03:35:25 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/webrick/server.rb (WEBrick::GenericServer): close socket only if
+ the socket is not closed yet.
+
+Sun Apr 1 23:03:18 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/ftp.rb (Net::BufferedSocket): should delegate send() to @io
+ for Net::FTP#abort and Net::FTP#status.
+
+Sun Apr 1 00:41:56 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/ftp.rb: fixed the domain name in examples.
+
+Sat Mar 31 21:39:45 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/webrick/utils.rb (WEBrick::Utils::TimeoutHandler): dup to prevent
+ @timeout_info's "can't add a new key into hash during iteration".
+
+Sat Mar 31 14:22:59 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * hash.c (hash_default_value): extract from rb_hash_aref(), to be
+ shared with rb_hash_shift(), so that overriding Hash#default
+ will be respected.
+
+Sat Mar 31 14:16:02 2012 Sokolov Yura (funny-falcon) <funny.falcon@gmail.com>
+
+ * hash.c: do not allocate st_table when it is not necessary.
+
+Sat Mar 31 13:42:39 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/ftp.rb (read_timeout=, open_timeout=): supported timeout.
+
+Sat Mar 31 13:20:40 2012 Sokolov Yura (funny-falcon) <funny.falcon@gmail.com>
+
+ * hash.c: remove unnecessary checks for Qundef in hash iterations.
+ since hash use st_foreach_check for iterations, such checks are
+ needless.
+
+Sat Mar 31 12:05:01 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_x509cert.c: Fix doc typo.
+
+Sat Mar 31 10:13:24 2012 Sokolov Yura (funny-falcon) <funny.falcon@gmail.com>
+
+ * st.c (st_foreach_check, st_foreach): remove ancient check. This
+ check are from initial ordered hash commit when first entry were
+ created with entry->fore = entry->back = entry.
+
+ * st.c (st_delete): use real_entries in st_delete for packed tables
+
+Sat Mar 31 07:53:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * st.c (st_foreach_check): remove the entry by replacing with never
+ when ST_DELETE.
+
+ * hash.c (st_foreach_safe): since table is not for VALUE, Qundef is
+ not special value, so use 0 instead. therefore this function can be
+ applied to only st_table which 0 is invalid as keys, e.g., IDs.
+
+ * hash.c: Qundef cannot be passed from st_foreach_check().
+
+ * hash.c, marshal.c, object.c, variable.c: fix callback argument types
+ of iterators.
+
+Thu Mar 29 23:50:15 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * st.c (st_update): pass pointer to key to the callback function.
+
+Thu Mar 29 16:36:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * st.c (st_update): add existing parameter to the callback function.
+
+Thu Mar 29 16:35:32 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit.rb (terminal_width, del_status_line, put_status):
+ extract as methods.
+
+Thu Mar 29 10:20:18 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_pkcs7.c: fix crash when parsing garbage data.
+ * test/openssl/test_pkcs7.rb: assert correct behavior for it.
+ Thanks to Matt Venables for reporting the issue.
+ [ruby-core:43250][Bug #6134]
+
+Thu Mar 29 10:16:05 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * thread_win32.c (TIME_QUANTUM_USEC): 10ms(= old setting) [experimental]
+ cf. [Bug #6098]
+
+Thu Mar 29 10:12:12 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * thread.c (rb_threadptr_execute_interrupts_common): use defined
+ TIME_QUANTUM_USEC instead of a magic number. there is no meanings
+ to use different values for checking interval of interruption and
+ thread switching limits.
+ cf. [Bug #6098]
+
+Thu Mar 29 09:26:17 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * test/openssl/test_x509cert.rb: exclude test that fails when issuing
+ a certificate with RSA signature and DSS1 digest for earlier
+ OpenSSL versions when used in conjunction with OpenSSL 1.0.1.
+ Thanks, Vit Ondruch, for reporting the issue.
+ [ruby-core:42949][Bug #6089]
+
+Thu Mar 29 08:25:35 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * NEWS: add note about unified behavior of encoding nil values in
+ instances of OpenSSL::ASN1::ASN1Data.
+
+Thu Mar 29 07:45:36 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_asn1.c: raise TypeError when trying to encode nil
+ values for Primitive instances.
+ * test/openssl/test_asn1.rb: Assert consistent behavior when
+ encoding nil values: Primitives raise TypeError, Constructives
+ raise NoMethodError.
+ Fixes [ruby-core:43009][Bug #6102]
+
+Wed Mar 28 16:39:59 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * process.c (obj2uid, obj2gid): allow strings as input user/group id.
+ [ruby-core:40923][Feature #5610]
+
+Wed Mar 28 15:06:18 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * marshal.c (r_symreal): default to ASCII-8BIT for non-ascii symbols,
+ otherwise it should be converted to US-ASCII in rb_intern_str() if
+ possible. [ruby-core:43762][Bug #6209]
+
+Wed Mar 28 08:44:24 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych.rb: updating version to match gem
+ * ext/psych/psych.gemspec: ditto
+ * ext/psych/lib/psych/visitors/to_ruby.rb: fixing deprecation warning
+
+Tue Mar 27 23:44:11 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * io.c (io_unread): fixed memory leak. report by nagachika via IRC.
+
+Tue Mar 27 22:44:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (verconf.h): separate load path specific stuff from
+ config.h.
+
+Tue Mar 27 22:43:40 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/Makefile.sub: fix config.h path to include.
+
+Tue Mar 27 17:08:08 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * win32/win32.c (check_if_dir): fix memory leak.
+
+Tue Mar 27 13:13:51 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (str_new_empty): should copy also the encoding as an
+ empty substring. [ruby-dev:45441][Bug #6206]
+
+Mon Mar 26 23:43:04 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/ftp.rb (parse227, parse228, parse229): don't use $~.
+
+Mon Mar 26 23:34:40 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/ftp.rb (parse227, parse228, parse229): don't use local
+ variables defined by named capture for other Ruby implementations
+ such as Rubinius.
+
+Mon Mar 26 23:19:03 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/ftp.rb (parse_pasv_port): refactored.
+
+Mon Mar 26 19:49:49 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * test/net/ftp/test_ftp.rb: add the test, which was forgotten in the
+ previous commit.
+
+Mon Mar 26 19:37:27 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/ftp.rb (parse227, parse228, parse229): refactored.
+
+Mon Mar 26 11:46:23 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * enumerator.c (inspect_enumerator): show method arguments of
+ lazy enumerators correctly.
+
+Mon Mar 26 13:51:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/win32.c (check_if_dir, check_if_wdir): fix for Visual C++
+ not to use S_ISDIR(). [Feature #2408][ruby-core:26925]
+
+ * ruby.c (load_file_internal): ditto.
+
+Mon Mar 26 11:46:01 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ruby.c (load_file_internal): bail out if the script is a directory.
+ [Feature #2408][ruby-core:26925]
+
+ * win32/win32.c (rb_w32_open, rb_w32_wopen): check if the file is a
+ directory when access denied, to set errno to EISDIR.
+
+Sun Mar 25 18:13:14 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * string.c (tr_setup_table): fix multiple non latin argument for
+ non latin (over 256 characters) tr-like methods.
+ [ruby-core:43371] [Bug #6167]
+
+Sun Mar 25 00:46:06 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * enumerator (lazy_initialize): set the instance variable "receiver"
+ to include the receiver to the return value of inspect on a lazy
+ enumerator directly created by Enumerator::Lazy.new.
+
+ * enumerator (RETURN_LAZY): don't set the instance variable "receiver".
+
+Sat Mar 24 23:59:00 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * enumerator (enumerator_inspect): include the original receiver and
+ method name of Enumerator::Lazy in the result of inspect.
+ [ruby-core:43345] [Bug #6159]
+
+ * enumerator (InitVM_Enumerator): don't use rb_define_alias for
+ some methods such as collect in order to make rb_frame_this_func()
+ return the correct method names.
+
+Sat Mar 24 22:22:18 2012 Sambasiva Rao Suda <sambasivarao@gmail.org>
+
+ * time.c (time_init_1): Time.new will accept seconds as string or
+ int. [ruby-core:43569][Bug #6193]
+
+Fri Mar 23 15:12:12 2012 Martin Duerst <duerst@it.aoyama.ac.jp>
+
+ * transcode.c (documentation for str_encode): Explain
+ that transcoding to the same encoding is a no-op
+ (i.e. no exceptions, no replacements,...).
+ [ruby-core:43557][Bug #6190]
+
+Fri Mar 23 13:19:20 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (rb_str_to_inum): must be ASCII compatible encoding as
+ well as String#hex and String#oct. [ruby-core:43566][Bug #6192]
+
+ * string.c (rb_must_asciicompat): check if ASCII compatible.
+
+Thu Mar 22 23:14:36 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * transcode.c (str_encode_bang, encoded_dup): if nothing was
+ transcoded, just set encoding but leave coderange unchanged as
+ force_encoding. [ruby-core:43557][Bug #6190]
+
+Thu Mar 22 22:30:44 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * io.c (static int io_fflush): add the definition.
+ Use it in set_binary_mode_with_seek_cur().
+
+ * io.c (set_binary_mode_with_seek_cur): refactoring to split the
+ content into io_unread(). Fix the possibility of buffer overflow.
+
+ * io.c (io_unread): add new implementation for Windows. Previous one
+ caused invalid cursor position using IO#pos with OS text mode. New
+ one fixes the bug.
+
+ * test/ruby/test_io_m17n.rb
+ (TestIO_M17N#test_pos_dont_move_cursor_position): add a test for
+ above bug.
+ [ruby-core:43497] [Bug #6179]
+
+Thu Mar 22 19:55:08 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_fstat, rb_w32_fstati64): convert FILETIME
+ to time_t directly, not to be affected by TZ unnecessarily.
+
+ * win32/win32.c (unixtime_to_filetime): convert time_t to FILETIME
+ simply.
+
+Thu Mar 22 13:43:31 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/openssl/ossl_pkey_rsa.c (rsa_generate): fix argument type.
+ [Bug #6094]
+
+Thu Mar 22 11:14:10 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_io.rb (TestIO#test_pos_with_getc): updated.
+ see [ruby-core:43550]
+
+Wed Mar 21 17:57:57 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * regcomp.c: Merge Onigmo 3d855b30d574536d3ae600260208c6624ae4791c.
+ [Bug#6143] [Bug#6144] [Bug#6145]
+
+Wed Mar 21 17:01:55 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_io.rb (TestIO#test_pos_with_getc): added.
+ see [Bug #6179][ruby-core:43518]
+
+Mon Mar 19 17:18:51 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * enumerator.c (lazy_flat_map_func): convert the block value to
+ Array if it doesn't respond to each. [ruby-core:43334]
+ [Bug #6155]
+
+Mon Mar 19 16:34:14 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * enum.c (zip_i): variadic argument needs explicit cast on the
+ platforms where VALUE is longer than int.
+
+Mon Mar 19 15:36:41 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * enumerator.c (enumerable_lazy): add an example of take and first
+ to the documentation. [ruby-core:43344] [Bug #6158]
+ add the description of the behavior when a block is given to zip
+ or cycle.
+
+Mon Mar 19 15:20:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * compile.c (iseq_specialized_instruction): DRY and replace chain
+ of if-else with switch for special instructions. based on a
+ patch by Vasfed. https://github.com/ruby/ruby/pull/105
+
+Mon Mar 19 15:05:54 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * test/test_pty.rb: same as r29280, skip tests when PTY allocation
+ failed (that's not our fault).
+
+Sun Mar 18 23:21:17 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * gc.c (aligned_free): fix condition for free. memalign() and
+ posix_memalign() are not defined together normally.
+
+Sun Mar 18 18:31:45 2012 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * gc.c (aligned_malloc, aligned_free): added fallback implementations
+ for platforms like OSX Leopard.
+
+Sun Mar 18 17:17:48 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (rb_big_pow): estimate result bit size more precisely.
+ [ruby-core:30735][Feature #3429]
+
+Sun Mar 18 17:17:36 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * gc.c (free_method_entry_i): method entry may be in
+ unlinked_method_entry_list. [ruby-core:43383][Bug #6171]
+
+Sun Mar 18 15:27:31 2012 Tanaka Akira <akr@fsij.org>
+
+ * compile.c: typo fix by Run Paint Run Run.
+ [ruby-core:28368] [Bug #2824]
+
+Sun Mar 18 10:01:02 2012 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * lib/profiler.rb: support calling singleton methods of
+ an instance of BasicObject.
+
+Sat Mar 17 06:56:58 2012 Eric Hodel <drbrain@segment7.net>
+
+ * object.c: Fix indentation of Class#inherited example.
+
+Sat Mar 17 01:46:05 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * string.c (trnext): fix bug with string ending with '\\'.
+ [ruby-dev:45374][Bug #6160]
+
+ * test/ruby/test_string.rb (TestString#test_delete): test for
+ above.
+
+Fri Mar 16 20:06:24 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (trnext): should advance char-wise.
+ [ruby-core:43335][Bug #6156]
+
+Fri Mar 16 17:42:05 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (block_append_gen): fix unreachable warning line number.
+ should warn at the code, not jump.
+
+Fri Mar 16 17:33:08 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * enum.c (enum_take): allocate buffer array before iteration, as well
+ as enum_first did.
+
+ * enum.c (enum_first): remove duplication.
+
+Fri Mar 16 14:43:18 2012 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * load.c (ruby_init_ext): don't free the given pointer itself.
+ It is not guaranteed even that the pointer is on heap.
+
+Fri Mar 16 14:37:57 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * vm_eval.c (rb_mod_module_eval): fix the documentation of
+ class_eval to mention class variable lookup. [ruby-core:40649]
+ [Bug #5544]
+
+Fri Mar 16 14:27:11 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * vm_eval.c (rb_mod_module_eval): fix the documentation of
+ class_eval to mention constant lookup. [ruby-core:41718]
+ [Bug #5777]
+
+Fri Mar 16 14:10:45 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb (initialize): raise Net::IMAP::Error when the
+ connection is closed without a greeting response.
+ [ruby-core:40938] [Bug #5616]
+
+Fri Mar 16 13:50:12 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb (rfc822_text): ignore [] after RFC822.
+ [ruby-core:40945] [Bug #5620]
+
+Fri Mar 16 12:00:42 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_insnhelper.c (argument_error): use line number at the beginning
+ of lambda, not the first code of its body.
+ [ruby-core:43314][Bug #6151]
+
+ * iseq.c (rb_iseq_first_lineno): constified.
+
+Fri Mar 16 11:20:07 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * enumerator.c (lazy_take): don't enumerate an extra value.
+ [ruby-dev:45370] [Bug #6152]
+
+Fri Mar 16 06:30:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * enumerator.c (lazy_zip_func): variadic argument needs explicit cast
+ on the platforms where VALUE is longer than int.
+
+ * enumerator.c (lazy_init_iterator): no need to check overflow twice.
+
+Fri Mar 16 05:47:09 2012 Eric Hodel <drbrain@segment7.net>
+
+ * enumerator.c (lazy_init_iterator): Fix type error (int vs long).
+
+Thu Mar 15 23:13:36 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * enum.c (rb_enum_values_pack): rename from enum_values_pack, and
+ remove static.
+
+ * enumerator.c (lazy_init_iterator, lazy_init_yielder,
+ lazy_select_func, lazy_reject_func, lazy_grep_func): handle
+ multiple values correctly.
+
+ * enumerator.c (lazy_grep): change the behavior when a block is
+ given, to be consistent with Enumerable#grep.
+
+Thu Mar 15 19:12:31 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * enumerator.c (lazy_zip): rescue StopIteration returned by
+ Enumerator#next.
+
+Thu Mar 15 18:19:53 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * enumerator.c (lazy_zip, lazy_cycle): Enumerator::Lazy#{zip,cycle}
+ should be eager when a block is given, to be consistent with
+ Enumerable#{zip,cycle}.
+
+Thu Mar 15 17:45:27 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * enumerator.c (InitVM_Enumerator): renamed Enumerable::Lazy to
+ Enumerator::Lazy.
+
+Thu Mar 15 16:37:38 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * enumerator.c (enumerable_lazy): added cycle to the documentation.
+
+Thu Mar 15 15:37:42 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (parser_yylex): fix warning line number.
+
+Thu Mar 15 15:19:38 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * enumerator.c (lazy_cycle): check argument number overflow before
+ creating temporary array.
+
+Thu Mar 15 15:04:54 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * util.c (ruby_strtod): no need to check same digit for hexdigit
+ twice. [ruby-dev:45363][Bug #6146]
+
+ * parse.y (sym_check_asciionly): check ascii compatibility before
+ scanning for code range.
+
+ * parse.y (intern_str): set to us-ascii if ascii only.
+ [ruby-dev:45363][Bug #6146]
+
+ * file.c (ruby_enc_find_basename): allow NULL as alllen.
+ [ruby-dev:45363][Bug #6146]
+
+Thu Mar 15 14:49:31 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (rb_str_conv_enc_opts): default to original encoding.
+
+Thu Mar 15 13:47:17 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * hash.c (env_str_new, rb_f_getenv, env_fetch): use rb_str_conv_enc()
+ instead of rb_str_encode() to simplify the code.
+
+Thu Mar 15 12:44:50 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c, include/ruby/win32.h (rb_w32_ugetenv): new API to
+ accept and to return UTF-8 strings.
+
+ * win32/win32.c (rb_w32_getenv): follow above change.
+
+ * win32/win32.c (rb_w32_get_environ): returns UTF-8 environment area.
+
+ * hash.c (env_str_new, rb_f_getenv, env_fetch): follow above changes.
+ [Bug #5570] [ruby-core:40737]
+
+Thu Mar 15 10:57:27 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * enumerator.c (lazy_cycle): add Enumerable::Lazy#cycle.
+
+Thu Mar 15 10:31:40 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/ruby/test_arity.rb (TestArity#err_mess): use assert_raise.
+
+Thu Mar 15 07:03:52 2012 Eric Hodel <drbrain@segment7.net>
+
+ * vm_eval.c (check_funcall): Raise ArgumentError if respond_to?
+ requires more than three arguments. [Bug #6000]
+
+ * test/ruby/test_object.rb (class TestObject): Test for respond_to?
+ requiring more than three arguments.
+
+Thu Mar 15 06:08:06 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * include/ruby/intern.h: Add rb_check_arity, rb_error_arity [#6085]
+
+ * array.c: Use rb_check_arity / rb_error_arity
+
+ * class.c: ditto
+
+ * enumerator.c: ditto
+
+ * eval.c: ditto
+
+ * file.c: ditto
+
+ * hash.c: ditto
+
+ * numeric.c: ditto
+
+ * proc.c: ditto
+
+ * process.c: ditto
+
+ * random.c: ditto
+
+ * re.c: ditto
+
+ * signal.c: ditto
+
+ * string.c: ditto
+
+ * struct.c: ditto
+
+ * transcode.c: ditto
+
+ * vm_eval.c: ditto
+
+ * vm_insnhelper.c: ditto & implementation of rb_error_arity
+
+ * test/ruby/test_arity.rb: tests for above
+
+Thu Mar 15 06:08:05 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * vm_insnhelper.c: improve number of arguments error in case of
+ optional parameters (issue #6085)
+
+ * include/ruby/intern.h: define UNLIMITED_ARGUMENTS
+
+ * test/ruby/test_arity.rb: test for above
+
+Thu Mar 15 00:58:04 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * enumerator.c (enumerable_lazy): fix the documentation of
+ Enumerable#lazy.
+
+Wed Mar 14 22:01:06 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * enumerator.c (lazy_init_iterator): break when Qundef is returned
+ to make obj.drop(3).take(2) work properly.
+
+ * enumerator.c (lazy_take_while): add Enumerable::Lazy#take_while.
+
+ * enumerator.c (lazy_drop): add Enumerable::Lazy#drop.
+
+ * enumerator.c (lazy_drop_while): add Enumerable::Lazy#drop_while.
+
+ * enumerator.c (InitVM_Enumerator): add Enumerable::Lazy#force as an
+ alias of to_a.
+
+Wed Mar 14 19:28:40 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * enumerator.c (lazy_take): add Enumerable::Lazy#take.
+
+Wed Mar 14 18:40:36 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * enumerator.c: use long for array indices.
+
+Wed Mar 14 18:25:18 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * enumerator.c: moved the comment of StopIteration.
+
+Wed Mar 14 17:55:29 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * numeric.c (flodivmod): must go through the same pass if HAVE_FMOD or
+ not. this is a bugfix of r35013.
+
+Wed Mar 14 16:41:55 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/test_tmpdir.rb (TestTmpdir#test_world_writable): skip on Windows.
+
+Wed Mar 14 15:09:23 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * numeric.c: fix flodivmod for cornercases [Bug #6044]
+ add ruby_float_mod
+
+ * insns.def (opt_mod): use ruby_float_mod
+
+ * internal.h: declare ruby_float_mod
+
+ * test/ruby/test_float.rb: tests for above
+
+ * test/ruby/envutil.rb: create helper assert_is_minus_zero
+
+Wed Mar 14 10:44:35 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * enumerator.c (lazy_grep_func): should use === instead of =~, as
+ well as Enumerable#grep
+
+Wed Mar 14 08:15:54 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * enumerator.c (lazy_flat_map_func): use each for non-Array objects.
+
+Wed Mar 14 08:06:35 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * enumerator.c (lazy_zip): add Enumerable::Lazy#zip.
+
+ * enumerator.c (lazy_lazy): just returns self.
+
+Wed Mar 14 07:48:36 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c (datetime_s_now): [ruby-core:43256].
+
+Tue Mar 13 22:00:14 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * compile.c (iseq_set_arguments): keyword rest arg without keyword args.
+
+ * node.c (dump_node): dump kw_rest_arg too.
+
+ * parse.y (block_param, f_arg): more kwrest patterns.
+ [ruby-core:42455][Bug #5989]
+
+ * parse.y (new_args_gen): no extra kw_rest_arg if no keyword rest arg.
+
+Tue Mar 13 15:17:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (block_param, f_args): add rules for the case arguments
+ begin with kwrest. [ruby-core:42455][Bug #5989]
+
+Tue Mar 13 12:37:53 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * io.c (io_encoding_set): always warn if external encoding and internal
+ encoding are identical. [ruby-core:40727] [Bug #5568]
+
+Tue Mar 13 12:37:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * gc.c: add ObjectSpace::WeakMap. [ruby-dev:44565][Bug #5350]
+
+ * lib/weakref.rb: use WeakMap instead of _id2ref.
+
+Tue Mar 13 10:59:48 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * tool/rbinstall.rb (prepare): skip if basedir is not defined.
+ [ruby-core:39135][Bug #5238]
+
+ * tool/rbinstall.rb (CONFIG.[]): check for mandatory
+ configurations.
+
+Tue Mar 13 00:09:18 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * enumerator.c (enumerable_lazy): added documentation.
+
+Mon Mar 12 20:19:25 2012 Tanaka Akira <akr@fsij.org>
+
+ * lib/tmpdir.rb (Dir::tmpdir): test the current directory suitable for
+ temporary directory.
+
+Mon Mar 12 20:08:16 2012 Tanaka Akira <akr@fsij.org>
+
+ * lib/fileutils.rb (fu_have_symlink?): specify TypeError for rescue
+ clause.
+
+Mon Mar 12 19:23:13 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * encoding.c (rb_find_encoding): new function find encoding from
+ arbitrary object as a pointer to rb_encoding, and return NULL if
+ not found.
+
+ * io.c (io_encoding_set): just warn unsupported encodings, but not
+ exception. [ruby-core:40726] [Bug #5567]
+
+Mon Mar 12 19:03:32 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_method.c (Init_eval_method): respond_to? and
+ respond_to_missing? are public.
+
+Mon Mar 12 14:56:52 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * node.h (NEW_YIELD), parse.y (new_yield_gen): array-values flags
+ has been already obsolete. patch by Thomas Enebo.
+ [ruby-core:41929][Bug #5847]
+
+Mon Mar 12 12:44:33 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_method.c (Init_eval_method): copy basic methods to Exception.
+ [ruby-core:40287][Bug #5473]
+
+Mon Mar 12 10:13:36 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval_jump.c (rb_exec_end_proc): remember the latest exit status.
+ [ruby-core:43173][Bug #5218]
+
+Mon Mar 12 07:33:12 2012 Tanaka Akira <akr@fsij.org>
+
+ * lib/tmpdir.rb: update document for changing
+ FileUtils.remove_entry_secure to FileUtils.remove_entry.
+
+ * NEWS: add incompatibility note for lib/tmpdir.rb.
+
+Mon Mar 12 07:19:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/tmpdir.rb (Dir.tmpdir): should not use world-writable but
+ non-sticky directory.
+
+ * lib/tmpdir.rb (Dir.mktmpdir): check the parent directory.
+
+Mon Mar 12 07:04:11 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * random.c (Init_Random): removed rb_Random_DEFAULT and register as
+ mark-object instead of global variable.
+
+Mon Mar 12 07:03:32 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * random.c (random_s_rand): ensure default PRNG is re-initialized
+ after fork. patched by Eric Wong. [ruby-core:41209][Bug #5661]
+
+Sun Mar 11 23:57:29 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * pack.c (pack_unpack): when unpack('M') occurs an illegal byte
+ sequence, output the "=" character and the following character in
+ the decoded data without any transformation.
+ [ruby-dev:44875] [Bug #5635]
+
+Sun Mar 11 22:32:43 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/json: Merge 164a75c8bd2007d32c4d7665d53140d8fc126dcd.
+ [ruby-core:41917] [Bug #5846]
+
+Sun Mar 11 17:10:04 2012 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/test/unit.rb: Put error message into STDERR if failed to launch
+ worker (job) process. [ruby-dev:44802] [Bug #5577]
+
+ * lib/test/unit/parallel.rb: If failed to increment_io, exit with code
+ 2. [ruby-dev:44802] [Bug #5577]
+
+Sun Mar 11 15:46:45 2012 Shota Fukumori <sorah@tubusu.net>
+
+ * io.c: fix rdoc of `IO.binwrite` to show same as `IO.write` except
+ it opens file with mode "wb:ASCII-8BIT". [Bug #5782] [ruby-core:42592]
+
+Sat Mar 10 23:52:28 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * st.c: pack tables also generic keys. patched by Sokolov Yura at
+ https://github.com/ruby/ruby/pull/84
+
+ * st.c: add st_foreach_check for fixing iteration over packed table
+ and st_delete_safe. patched by Sokolov Yura at
+ https://github.com/ruby/ruby/pull/84
+
+ * st.c: fix packed num_entries on delete_safe. patched by Sokolov
+ Yura at https://github.com/ruby/ruby/pull/84
+
+Fri Mar 9 14:29:32 2012 Shugo Maeda <shugo@ruby-lang.org>
+
+ * enumerator.c (lazy_flat_map): add Enumerable::Lazy#flat_map.
+
+Fri Mar 9 06:29:22 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych.rb (load, parse): stop parsing or loading after
+ the first document has been parsed.
+
+ * test/psych/test_stream.rb: pertinent tests.
+
+Fri Mar 9 06:17:05 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych.rb (parse_stream, load_stream): if a block is
+ given, documents will be yielded to the block as they are parsed.
+ [ruby-core:42404] [Bug #5978]
+
+ * ext/psych/lib/psych/handlers/document_stream.rb: add a handler that
+ yields documents as they are parsed
+
+ * test/psych/test_stream.rb: corresponding tests.
+
+Fri Mar 9 00:35:03 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * enumerator.c (lazy_initialize, enumerable_lazy): no additional
+ arguments.
+
+Fri Mar 9 00:30:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * enumerator.c: add Enumerable#lazy. based on the patch by
+ Innokenty Mikhailov at <https://github.com/ruby/ruby/pull/101>
+ [ruby-core:37164] [Feature #4890]
+
+Fri Mar 9 00:25:59 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * enumerator.c (enumerator_each, generator_each): pass arguments to
+ the block with yielder.
+
+Fri Mar 9 00:25:02 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (rb_ary_cat): new function to concat objects into array.
+
+Thu Mar 8 16:44:02 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * .gdbinit (rb_numtable_entry): update for recent refactoring of
+ st_table.
+
+Wed Mar 7 22:41:50 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * lib/xmlrpc/client.rb (module XMLRPC): fix typo.
+
+ * test/xmlrpc/test_client.rb (test_async_call): add test for
+ XMLRPC::Client#call_async to check above fix.
+
+Wed Mar 7 16:30:24 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * error.c (rb_load_fail): should honor encoding.
+
+ * load.c (load_failed): ditto.
+
+Wed Mar 7 12:26:25 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * error.c (rb_load_fail): use path as a string, not char*.
+
+ * internal.h: (rb_load_fail): moved from ruby/intern.h.
+
+ * ruby.c (load_file_internal): fname cannot be NULL.
+
+Wed Mar 7 08:32:43 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * error.c (rb_loaderror_with_path): Adding the missing file as an
+ instance variable to the LoadError exception.
+ [ruby-core:39079]
+
+ * load.c: call rb_loaderror_with_path so that the missing path is
+ added to the exception.
+
+ * ruby.c: call rb_loaderror rather than raising our own LoadError
+ exception.
+
+ * include/ruby/intern.h: add declaration for rb_loaderror_with_path.
+
+ * test/ruby/test_require.rb: add supporting test for LoadError#path
+ method.
+
+Wed Mar 7 08:28:00 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * lib/xmlrpc/parser.rb: support i8 types. Thanks Stas Kelvich!
+ [ruby-core:29246] [Feature #3090]
+
+ * test/xmlrpc/test_client.rb: supporting test
+
+Wed Mar 7 07:43:29 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * lib/xmlrpc/client.rb: assume servers that do not send a Content-Type
+ header are sending 'text/xml'. Thanks Nathan Leavitt!
+ [ruby-core:41204] [Bug #5660]
+
+ * test/xmlrpc/test_client.rb: supporting test
+
+Wed Mar 7 07:39:28 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * test/xmlrpc/test_client.rb: adding a test for performing an XMLRPC
+ call.
+ * test/xmlrpc/data/blog.xml: supporting XML document for the response.
+
+Tue Mar 6 16:24:01 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (parser_tokadd_string): escape simple regexp meta
+ character terminators.
+
+Tue Mar 6 10:11:43 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/io/console/console.c (set_rawmode): clear ECHOE and ECHOK
+ bits too.
+
+ * ext/io/console/console.c (echo_p): ignore ECHOE and ECHOK bits.
+ [ruby-dev:45309] [Bug #6116]
+
+ * ext/io/console/console.c (console_raw): fix rdoc.
+
+ * ext/io/console/console.c (console_set_echo): mentioned about
+ platform dependency.
+
+Tue Mar 6 07:18:10 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * lib/xmlrpc/client.rb: switch net/http post2 calls to modern
+ `request_post` methods.
+
+Tue Mar 6 02:31:20 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/core_ext.rb: only extend Kernel if IRB is loaded
+ in order to stop method pollution.
+
+Tue Mar 6 01:34:19 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (block_call): rules for block_call after block_call.
+ based on a patch by pasberth https://github.com/ruby/ruby/pull/102
+ [ruby-dev:45308][Bug #6115]
+
+Tue Mar 6 01:24:13 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (block_command, block_call): simplified rules.
+
+Mon Mar 5 18:28:35 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * test/ruby/test_regexp.rb (TestRegexp#test_source): fix typo.
+ * test/ruby/test_regexp.rb (TestRegexp#test_equal): ditto.
+
+Mon Mar 5 17:11:44 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/syck/lib/syck/rubytypes.rb (Exception.yaml_new): fix bug
+ that causes YAML serialization problem for Exception.
+ Exception#initialize doesn't use visible instance variable for
+ the exception message, so call the method with the message.
+ patched by Jingwen Owen Ou <jingweno AT gmail.com>.
+ http://github.com/ruby/ruby/pull/41
+
+Mon Mar 5 16:50:22 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_sleep.rb (TestSleep#test_sleep_5sec): syntax error.
+
+ * test/ruby/test_sleep.rb (TestSleep#test_sleep_5sec): call uname
+ only on linux because it's a workaround for linux only.
+
+Mon Mar 5 12:44:12 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * st.c (unpack_entries): chain entries directly. based on a patch
+ by Sokolov Yura <funny.falcon AT gmail.com>.
+
+ * st.c (unpack_entries): use union instead of casted pointer.
+ patched by Sokolov Yura <funny.falcon AT gmail.com>.
+
+ * st.c: use PACKED_ENT and FIND_ENTRY. patched by Sokolov
+ Yura <funny.falcon AT gmail.com>.
+
+ * st.c (unpack_entries): reallocate bins if packed array size
+ is not same as initial bins size. based on a patch by
+ Sokolov Yura <funny.falcon AT gmail.com>.
+
+Mon Mar 5 11:51:48 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/bigdecimal/lib/bigdecimal/math.rb: remove description about
+ BigMath#log. patched by Sho Hashimoto [ruby-dev:45307] [Bug #6112]
+
+ * string.c (str_byteslice): fix typo.
+
+Sun Mar 4 23:21:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (parser_tokadd_string): regexp engine doesn't need
+ terminators to be escaped. [ruby-core:40364][Bug #5484]
+
+Sat Mar 3 22:51:46 2012 Tanaka Akira <akr@fsij.org>
+
+ * process.c (rb_run_exec_options_err): chdir at last to interpret
+ relative pathnames from the current directory of the parent process.
+
+Sat Mar 3 12:20:44 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_strftime.c: reassigned some variables.
+
+Sat Mar 3 12:12:16 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_{parse,strptime}.c: [ruby-dev:45303].
+
+Sat Mar 3 10:09:21 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * lib/xmlrpc/client.rb (initialize): net/http defaults to 1_2 in 1.8+,
+ so we can safely remove the call to enable it.
+
+Sat Mar 3 08:42:25 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * lib/xmlrpc/client.rb (new2): use URI for uri parsing.
+ * test/xmlrpc/test_client.rb: test that query params are passed to the
+ client constructor.
+
+Sat Mar 3 08:20:10 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * lib/xmlrpc/client.rb (new2): raises an ArgumentError on bad
+ arguments.
+ * test/xmlrpc/test_client.rb: tests for bad uris
+
+Sat Mar 3 08:08:11 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * lib/xmlrpc/client.rb (new2): fix custom port specification when an
+ SSL uri is used.
+ * test/xmlrpc/test_client.rb: tests for XMLRPC::Client.new2
+
+Sat Mar 3 08:03:29 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/syck/rubyext.c (mktime_do): use ISDIGIT().
+ [ruby-core:43060] [Bug #6108]
+
+ * ext/syck/token.c (sycklex_yaml_utf8): cast as unsigned char.
+ [ruby-core:43060] [Bug #6108]
+
+Sat Mar 3 06:57:14 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (ruby_pc): make configurable. [Bug #6051]
+
+Fri Mar 2 17:49:03 2012 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * .travis.yml (branches): Enable TravisCI for ruby_1_9_3.
+
+Fri Mar 2 17:13:33 2012 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * test/ruby/test_array.rb (test_combination2): Make the test case for
+ [ruby-core:29240] more descriptive.
+ cf. http://bugs.jruby.org/6518
+
+Fri Mar 2 16:37:11 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (file_expand_path): use wcscasecmp().
+
+Fri Mar 2 16:36:31 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread_pthread.c (native_cond_timeout): cast explicitly to suppress
+ a warning.
+
+Fri Mar 2 16:35:56 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (pipe_open): cmd is no longer used if fork is available.
+
+Thu Mar 1 16:13:18 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * internal.h (rb_file_const, rb_file_load_ok): moved functions for
+ internal use only.
+
+Thu Mar 1 15:40:05 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/makedirs.bat: new command to make intermediate
+ directories, and not to report any errors if the directory
+ already exists.
+
+ * win32/Makefile.sub (MAKEDIRS): enable command extensions.
+
+Thu Mar 1 01:25:43 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * regparse.c (is_onechar_cclass): optimize character class
+ Merge Onigmo 27278c12e6674043cc8affca6507e20e119a86ee.
+
+ * regparse.c (is_onechar_cclass): [bug] unexpected match occurs when a
+ char class contains no char
+
+ * enc/unicode.c (init_case_fold_table): define the sizes of case
+ folding tables in casefold.h
+
+Wed Feb 29 16:11:34 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/Makefile.sub (MAKEDIRS): use mkdir of cmd.exe instead of ruby.
+ [Bug #6103] [ruby-core:43012]
+
+ * win32/README.win32: added a notice about command extension of cmd.exe.
+
+Wed Feb 29 15:39:39 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_io.rb (TestIO#test_readpartial_locktmp): skip on
+ windows because of the platform restriction.
+
+Wed Feb 29 15:38:50 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/memory_status.rb (Memory): syntax error.
+
+Wed Feb 29 13:06:42 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/ruby/memory_status.rb: use /proc/self/status if it is in
+ the expected format.
+
+Wed Feb 29 06:14:51 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: reverted r34825.
+
+Tue Feb 28 23:20:01 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * Makefile.in (PLATFORM_DIR): add a variable for `win32` directory.
+ * Makefile.in (clean-platform): add new target.
+ It cleans `win32` directory.
+
+ * common.mk (clean): add a dependency for `win32` directory.
+ * common.mk (distclean): ditto.
+ * common.mk (distclean-platform): add new target.
+ It cleans `win32` directory.
+ * common.mk ($(PLATFORM_D)): add new target to make `win32` directory.
+ * common.mk (win32/win32.$(OBJEXT)): move win32.o into `win32`
+ directory.
+ * common.mk (win32/file.$(OBJEXT)): add new target for win32/file.c.
+
+ * configure.in: move win32.o into `win32` directory and add
+ win32/file.o to MISSING.
+
+ * file.c (file_load_ok, rb_file_load_ok): replace static
+ file_load_ok() with public rb_file_load_ok().
+ It's to link Windows implementation in win32/file.c.
+ * file.c (rb_find_file_ext_safe): ditto.
+ * file.c (rb_find_file_safe): ditto.
+
+ * win32/file.c (rb_file_load_ok): new file. Add Windows specific
+ optimized implementation of rb_file_load_ok(). We created a
+ separated file to avoid too many #ifdef macro which is unreadable.
+
+ * win32/Makefile.sub (PLATFORM_DIR): add a variable for `win32`
+ directory.
+ * win32/Makefile.sub (MISSING): move win32.obj into `win32`
+ directory and add win32/file.obj to MISSING.
+ * win32/Makefile.sub (MAKEDIRS): replace MINIRUBY with BASERUBY.
+ It's because miniruby doesn't exist when making `win32` directory.
+ * win32/Makefile.sub (clean-platform): add new target to clean `win32`
+ directory.
+ * win32/Makefile.sub ({$(srcdir)}.c{}.obj): make it not match
+ win32/file.c to build properly.
+ * win32/Makefile.sub (win32/win32.$(OBJEXT)): move win32.obj into
+ `win32` directory.
+
+ Patch created with Luis Lavena.
+ [ruby-core:42480] [Feature #5999]
+
+Tue Feb 28 20:27:25 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: [ruby-core:42998]
+
+Tue Feb 28 18:47:44 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (io_binwrite, rb_io_syswrite): use shared frozen source
+ strings.
+
+ * io.c (io_fread, io_getpartial, rb_io_sysread): set buffer size
+ after check if readable, which can cause thread switch.
+ [ruby-dev:45297][Bug #6099]
+
+Tue Feb 28 17:16:01 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/time.rb (Time#xmlschema): use strftime specifiers instead of
+ fractional exponential calculation which yields undesirable
+ result. [ruby-core:42997][Bug #6100]
+
+Tue Feb 28 14:15:29 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/net/protocol.rb: Add OpenTimeout subclass of Timeout::Error
+ * lib/net/pop.rb: Modernize Timeout usage. Patch by Eric Wong.
+ Use Net::OpenTimeout instead of Timeout::Error. [Bug #5765]
+ * lib/net/http.rb: ditto
+ * lib/net/smtp.rb: ditto
+ * lib/net/telnet.rb: ditto
+
+Tue Feb 28 13:51:12 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/net/http.rb: Retry HTTP requests for additional network errors.
+ Introduce OpenTimeout subclass of Timeout::Error. [Bug #6001]
+ * test/net/http/test_http.rb: Reduce timeout to 0.01s for faster test
+ * test/net/http/test_https.rb: ditto
+
+Tue Feb 28 11:44:49 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (debugflags): check if -ggdb is accepted.
+ [ruby-core:42875][Bug #6080]
+
+Tue Feb 28 10:28:51 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych.rb: default open YAML files with utf8 external
+ encoding. [ruby-core:42967]
+ * test/psych/test_tainted.rb: ditto
+
+Mon Feb 27 23:46:09 2012 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (opt_bv_decl): allow newline at the end. [ruby-dev:45292]
+
+Mon Feb 27 20:43:05 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * io.c (rb_io_set_pos): add rdoc about textmode.
+
+ * test/ruby/test_io.rb (TestIO#test_setpos): use binmode.
+
+Mon Feb 27 17:00:15 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * string.c (rb_str_crypt): Update rdoc and state that this
+ function is system dependent. Reviewed by nobu, thanks to
+ @takai.
+
+Mon Feb 27 17:03:20 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/bigdecimal/bigdecimal.c (GetVpValueWithPrec): since methods
+ can be overridden, so should not make an assumption on the type
+ of results. [ruby-core:42969][Bug #6093]
+
+Mon Feb 27 10:54:20 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (try_cppflags, try_cflags, try_ldflags): replace the
+ target flags if the given flag is accepted.
+
+Mon Feb 27 10:53:44 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/rubygems/test_gem_specification.rb (test_self_from_yaml_syck_default_key_bug):
+ ignore the test for too old versions.
+
+Mon Feb 27 10:53:12 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit.rb (Test::Unit::Runner#puke): skips with no
+ messages should be trivial.
+
+Mon Feb 27 10:50:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c, process.c, time.c, ext: use rb_sys_fail_str instead of
+ rb_sys_fail.
+
+Mon Feb 27 10:48:49 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/openssl/extconf.rb: suppress useless deprecation warnings
+ from OpenSSL added by Apple.
+
+Sun Feb 26 23:29:49 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * regparse.c (add_code_range_to_buf0): wrong condition of duplicated
+ warnings.
+
+Sun Feb 26 11:26:44 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * compile.c (iseq_compile_each): call on special object instead of
+ self. since stabby lambda is a syntax, so it should not be
+ affected by the context. [ruby-core:42349][Bug #5966]
+
+ * insns.def (send): no special deal for FCALL. self should be put
+ on TOS instead.
+
+Sun Feb 26 05:35:43 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * error.c (report_bug): use buf and snprintf to avoid consuming stack.
+ [ruby-dev:45272] [Bug #6058]
+
+Sat Feb 25 17:41:19 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/extconf.rb (headers): try ambiguous headers at last.
+
+Sat Feb 25 17:07:15 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/fileutils.rb: use chomp(?/) instead of sub to optimize and avoid
+ to regexping invalid string.
+
+Sat Feb 25 16:18:24 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * complex.c (nucomp_marshal_load): raise error on invalid data.
+ reported by John Firebaugh [ruby-core:42860] [Bug #6076]
+
+Sat Feb 25 14:46:54 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/dl/dl.c (Init_dl): support intrinsic types, size_t, ptrdiff_t
+ and intptr_t. [ruby-core:42460][Feature #5992]
+
+ * ext/fiddle/fiddle.c (Init_fiddle): ditto.
+
+ * ext/dl/lib/dl/cparser.rb (DL::CParser#parse_ctype): ditto.
+
+Sat Feb 25 11:08:28 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/curses/curses.c (Init_curses): use rb_define_const once for
+ Curses::VERSION.
+
+ * ext/dbm/dbm.c (Init_dbm): ditto for DBM::VERSION.
+
+Sat Feb 25 10:34:22 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/curses/curses.c (Init_curses): make Curses::VERSION
+ understandable without context.
+
+ * ext/dbm/dbm.c (Init_dbm): ditto for DBM::VERSION.
+
+Sat Feb 25 07:53:58 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (parser_tokadd_string): insert a backslash only if
+ quoted by single quotes. [ruby-dev:45281] [Bug #6069]
+
+Sat Feb 25 07:53:49 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dir.c (dir_inspect), io.c (rb_io_inspect): keep encoding of path.
+ [Bug #6072]
+
+Sat Feb 25 07:53:40 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dir.c (dir_initialize): keep path in original encoding.
+
+ * error.c (syserr_initialize): prefer the encoding of message over
+ locale. [ruby-dev:45279][Bug #6071]
+
+Sat Feb 25 06:55:29 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (utime_internal): fix a variable missed to replace.
+ [ruby-core:42864] [Bug #6077]
+
+Fri Feb 24 18:21:55 2012 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * test/zlib/test_zlib.rb (TestZlibGzipReader#test_encoding): Add
+ encoding testcases for GzipReader#read. read() emits
+ Encoding.default_external in contrast to read(size) emits BINARY.
+ See also: http://bugs.jruby.org/6208
+
+Fri Feb 24 17:56:39 2012 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * test/ruby/test_literal.rb (TestRubyLiteral#test_special_const):
+ test for https://bugs.php.net/bug.php?id=61095
+
+Fri Feb 24 16:48:29 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dir.c, file.c, io.c (rb_sys_fail_path): use rb_sys_fail_str.
+
+ * error.c: new functions to deal exceptions with string instances.
+
+ * dir.c, file.c, io.c: use rb_sys_fail_path.
+
+Fri Feb 24 15:49:07 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (__builtin_unreachable): check for clang.
+ [ruby-core:42849]
+
+ * include/ruby/ruby.h (UNREACHABLE): fallback definition.
+
+Fri Feb 24 13:54:33 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/parser.c: prevent a memory leak by protecting calls to
+ handler callbacks.
+ * test/psych/test_parser.rb: test to demonstrate leak.
+
+Fri Feb 24 12:07:34 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * lib/net/http.rb: Fix documentation. Patched from Florian Mhun
+ via http://github.com/ruby/ruby/pull/96
+
+Fri Feb 24 11:48:07 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * string.c (rb_str_prepend): Fix documentation for String#prepend.
+ Patched from Franck Verrot via http://github.com/ruby/ruby/pull/98
+ and Andrew Horsman via http://github.com/ruby/ruby/pull/55
+
+Fri Feb 24 10:08:33 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/net/http.rb (Net::HTTP#transport_request): Fix infinite loop
+ upon EOFError or Errno::ECONNRESET where count is reset to 0.
+ * test/net/http/test_http.rb (class TestNetHTTPKeepAlive): Test for
+ above.
+
+Fri Feb 24 09:05:40 2012 Eric Hodel <drbrain@segment7.net>
+
+ * complex.c (Init_Complex): Document Complex::I. Patch by Sylvain
+ Daubert. [Feature #5623]
+
+Fri Feb 24 08:52:09 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (parser_tokadd_string, parser_yylex): insert a backslash
+ if the next character is non-ascii. [ruby-dev:45278] [Bug #6069]
+
+Fri Feb 24 08:13:20 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/profiler.rb: Add Profiler documentation by Gonzalo Rodriguez.
+ [Bug #5816]
+
+Fri Feb 24 08:08:38 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/parser.c: set parser encoding based on the YAML input
+ rather than user configuration.
+ * test/psych/test_encoding.rb: corresponding tests.
+ * test/psych/test_parser.rb: ditto
+ * test/psych/test_tainted.rb: ditto
+
+Fri Feb 24 08:02:52 2012 Eric Hodel <drbrain@segment7.net>
+
+ * hash.c (Init_Hash): Add section on how objects are used as Hash keys
+ and how to use custom classes as Hash keys.
+
+Fri Feb 24 07:36:11 2012 Eric Hodel <drbrain@segment7.net>
+
+ * object.c (rb_obj_eql): Improve equality documentation by adding an
+ example of equal? vs == and recommending eql? be aliased to == when
+ overridden.
+
+Fri Feb 24 07:21:15 2012 Eric Hodel <drbrain@segment7.net>
+
+ * object.c (rb_obj_hash): Added note that the hash value is not
+ deterministic on Marc-Andre's suggestion. Expanded description of
+ the purpose of the hash method. [Bug #6068]
+
+Thu Feb 23 23:01:21 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/extconf.rb: unused macro removed.
+
+Thu Feb 23 22:26:53 2012 Tanaka Akira <akr@fsij.org>
+
+ * test/test_curses.rb: new file.
+
+Thu Feb 23 19:57:56 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/curses/rain.rb: trap SIGHUP, SIGINT, SIGQUIT and SIGTERM only.
+
+Thu Feb 23 19:56:48 2012 Tanaka Akira <akr@fsij.org>
+
+ * signal.c (sig_trap): show signal name on error.
+
+Thu Feb 23 12:21:48 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/extconf.rb: use DBM_SUFFIX only to detect header of
+ Berkeley DB.
+
+Thu Feb 23 10:00:18 2012 Eric Hodel <drbrain@segment7.net>
+
+ * io.c (rb_io_f_sync): Fix double-negative typo. [ruby-trunk - #5837]
+
+Thu Feb 23 09:57:21 2012 Eric Hodel <drbrain@segment7.net>
+
+ * load.c (rb_f_require): Add note to require for scope of items in the
+ loaded file. [ruby-trunk - #5910]
+
+Thu Feb 23 03:58:08 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * lib/ostruct.rb (delete_field): Bug fix so previous value is
+ returned. Patch by Nick Recobra [Bug #6063]
+
+Thu Feb 23 02:33:00 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (rb_io_extract_modeenc): fail only if conflicting
+ text/binary modes given explicitly. [ruby-dev:45268][Bug #6055]
+
+Wed Feb 22 23:27:08 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/iconv/test_option.rb: enabled. [ruby-core:42802][Bug #6061]
+
+Wed Feb 22 21:45:56 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/curses/curses.c: use defined() to suppress a warning.
+
+Wed Feb 22 21:44:29 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/curses/extconf.rb: refactored.
+
+Wed Feb 22 20:42:28 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/curses/extconf.rb: try to distinguish curses_version is a
+ function or variable.
+
+ * ext/curses/curses.c (Init_curses): refine Curses::VERSION.
+
+Wed Feb 22 19:47:03 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/curses/extconf.rb: show the chosen header and library.
+
+Wed Feb 22 19:22:31 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * reverted 34739 for test/date.
+
+Wed Feb 22 19:08:55 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/curses/extconf.rb: refactored.
+
+Wed Feb 22 18:44:41 2012 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/test/unit.rb (setup_options): add option "--retry" as opposite
+ for "--no-retry"
+
+Wed Feb 22 18:34:02 2012 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/test/unit.rb (setup_options): add option "--show-skip" to
+ cancel "--hide-skip" (-q)
+
+Wed Feb 22 17:36:22 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (rb_io_s_foreach): argument check before making Enumerator.
+ [ruby-dev:31525]
+
+Wed Feb 22 17:07:35 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (rb_io_s_foreach): return enumerator including keyword
+ arguments. [ruby-dev:45267][Bug #6054]
+
+Wed Feb 22 12:15:16 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * configure.in: allow llvm-gcc because it work fine with r34278.
+
+Wed Feb 22 10:57:08 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * regparse.c (fetch_token): don't use // comment.
+
+Wed Feb 22 10:32:11 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/mkmf/test_framework.rb: try CoreFoundation framework, than
+ Cocoa which is dependent on QuickTime SDK which has separated
+ since Xcode 4.3.
+
+Wed Feb 22 10:18:05 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (test-all, test-ruby): more dependencies.
+
+Wed Feb 22 06:48:55 2012 Eric Hodel <drbrain@segment7.net>
+
+ * file.c (rb_f_test): Fix formatting of Kernel#test rdoc.
+
+Wed Feb 22 06:12:15 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/extconf.rb: check DBM_SUFFIX for Mac OS X.
+ Its ndbm.h doesn't include db.h.
+
+Wed Feb 22 06:02:42 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/dbm.c (fdbm_initialize): disable Berkeley DB error messages.
+
+ * ext/dbm/extconf.rb: check DBC type for above.
+
+ [ruby-dev:45269]
+
+Tue Feb 21 20:23:47 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * hash.c (rb_any_hash): treat Qundef like as other special constants.
+
+ * hash.c (hash_foreach_iter): fix signature.
+
+Tue Feb 21 19:39:34 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/curses/curses.c (Init_curses): use curses_version() for
+ Curses::VERSION.
+
+Tue Feb 21 18:21:25 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c : remove gc_clear_mark_on_sweep_slots() and use
+ rest_sweep() instead of it, because some dead objects might be
+ marked in next the mark phase by false pointers.
+ [ruby-core:42672]
+
+Tue Feb 21 16:08:17 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * proc.c (rb_hash_proc): get wrapped pointer properly. [Bug #6048]
+
+Tue Feb 21 14:41:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * template/ruby.pc.in: added rubylibprefix, {rubylib,vendor,site}dir
+ and {ruby,vendor,site}archdir. [ruby-core:42766][Feature #6052]
+
+Tue Feb 21 09:13:25 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * proc.c (method_hash, proc_hash): Fix {Unbound}Method#hash
+ [Bug #6048]. Isolate hash computation for proc
+
+ * internal.h: Declaration for above
+
+ * vm_method.c (rb_method_definition_hash): Computation for
+ hash part of a method definition
+
+ * method.h: Declaration for above
+
+ * test/ruby/test_method.rb: Test for above
+
+Tue Feb 21 02:56:15 2012 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * enumerator.c (enumerator_rewind): update the documentation.
+ fixed: #6053
+
+Mon Feb 20 23:38:35 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * enc/depend: ignore mktable.c because it's not encoding library.
+ [ruby-core:42760] [Bug #6049]
+
+Mon Feb 20 21:40:53 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/curses/extconf.rb: fold too long lines.
+
+Mon Feb 20 21:16:48 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * lib/fileutils.rb: revert a line modified accidentally at r34669.
+ This fixes mingw test errors in TestDir_M17N.
+ [ruby-core:42728] [Feature #4970]
+
+Mon Feb 20 21:09:27 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/curses/curses.c (Init_curses): define Curses::VERSION.
+
+Mon Feb 20 21:08:00 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/curses/extconf.rb: restore $libs and $defs for each
+ header/library choice.
+
+Mon Feb 20 19:57:26 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/extconf.rb: weaken header/library consistency check if db is
+ "ndbm". It seems several (possibly historical) distributions
+ provide libndbm. However the content of libndbm vary: Berkeley DB,
+ GDBM or even 4.3BSD NDBM. (Mandriva, Tru64 UNIX, OpenSuSE,
+ SCO OpenServer, ...)
+ "ndbm" is not searched automatically now (dblib doesn't contain it)
+ but configure --with-dbm-type=ndbm choose libndbm and ndbm.h.
+
+Mon Feb 20 19:15:57 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/extconf.rb: refine variable names.
+
+Mon Feb 20 15:50:33 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: check if -fstack-protector is really available.
+
+Sun Feb 19 23:43:38 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/extconf.rb: show header and library found.
+
+Sun Feb 19 23:01:01 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/dbm.c (Init_dbm): refine DBM::VERSION definition.
+
+ * ext/dbm/extconf.rb: provide RUBYDBM_GDBM_HEADER macro.
+
+Sun Feb 19 17:07:27 2012 Tanaka Akira <akr@fsij.org>
+
+ * test/dbm/test_dbm.rb (test_dbmfile_suffix): check pag and dir is
+ empty for 4.3BSD ndbm.
+
+Sun Feb 19 03:00:30 2012 Tanaka Akira <akr@fsij.org>
+
+ * test/dbm/test_dbm.rb (test_dbmfile_suffix): check magic numbers.
+
+Sun Feb 19 01:05:41 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/extconf.rb: detect GDBM's ndbm.h by testing dbm_clearerr is
+ an empty macro.
+
+Sun Feb 19 00:25:55 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/extconf.rb: don't choose 'dbm' if _GDB_H_ is defined which
+ is available since GDBM 1.9 because 'gdbm_compat' is appropriate
+ choice since GDBM 1.8.1.
+
+Sat Feb 18 23:27:00 2012 Kenta Murata <mrkn@mrkn.jp>
+
+ * random.c: remove a duplicated comment.
+
+Sat Feb 18 18:43:13 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/extconf.rb (dblib): prefer recent GDBM over older GDBM.
+ (have_declared_libvar): new function to check a declared variable
+ exists in a library.
+ (have_undeclared_libvar): renamed from renamed from have_libvar.
+ (headers.db_check2): check that GDBM version variable if GDBM header
+ is chosen.
+
+ * ext/dbm/dbm.c (Init_dbm): use HAVE_DECLARED_LIBVAR_GDBM_VERSION and
+ HAVE_UNDECLARED_LIBVAR_GDBM_VERSION macro.
+
+Sat Feb 18 13:53:01 2012 Tanaka Akira <akr@fsij.org>
+
+ * test/dbm/test_dbm.rb (test_dbmfile_suffix): DBM::VERSION should
+ be Berkeley DB if foo.db is created by DBM.open.
+
+Sat Feb 18 13:40:37 2012 Tanaka Akira <akr@fsij.org>
+
+ * test/dbm/test_dbm.rb (test_dbmfile_suffix): test dbm file suffix.
+
+Sat Feb 18 12:50:59 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/dbm.c (DBM::VERSION): define it by detecting _GDBM_H_ or
+ _DBM_IOERR.
+
+Sat Feb 18 07:52:45 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * tool/enc-unicode.rb: don't use 1.9 feature on tools.
+
+Sat Feb 18 02:48:39 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * lib/fileutils.rb: refactored FileUtil methods to use the
+ `define_command` API. Patch from 7rans <transfire@gmail.com>
+ * test/fileutils/test_dryrun.rb: corresponding test refactoring
+ * test/fileutils/test_nowrite.rb: ditto
+ * test/fileutils/test_verbose.rb: ditto
+
+Fri Feb 17 21:39:36 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/extconf.rb: remove dbm.
+
+Fri Feb 17 21:18:39 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/extconf.rb: refine header/library mismatch detection.
+ check only for ndbm.h except libc. check _GDBM_H_ for gdbm.
+ check _DBM_IOERR for the original ndbm.
+
+Fri Feb 17 20:30:44 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/extconf.rb: don't check libdbm. It is not a ndbm
+ implementation. (libdbm in Version 7 Unix is database library
+ for single database per process.)
+
+Fri Feb 17 15:38:53 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * Merge Onigmo-5.13.1. [ruby-dev:45057] [Feature #5820]
+ https://github.com/k-takata/Onigmo
+ cp reg{comp,enc,error,exec,parse,syntax}.c reg{enc,int,parse}.h
+ cp oniguruma.h
+ cp tool/enc-unicode.rb
+ cp -r enc/
+
+Fri Feb 17 15:20:30 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * enum.c (enum_each_slice): arrays to be yielded can be newly
+ created in the block.
+
+ * enum.c: move work variables to objects not to let called blocks
+ access stack area out of scope. [Bug #5801]
+
+Fri Feb 17 12:35:55 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * tool/merger.rb: remove borders from the commit message which is used
+ when the commit doesn't change ChangeLog.
+
+Fri Feb 17 11:50:11 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (btest, btest-ruby, test-sample test-knownbugs)
+ (test-all, test-ruby): depend on prog.
+
+Fri Feb 17 09:56:22 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (create_header): log the content of header.
+
+Fri Feb 17 09:44:55 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * tool/transcode-tblgen.rb (import_ucm): don't use \h because the
+ script should work with ruby 1.8.
+
+ * tool/enc-unicode.rb: ditto.
+
+Fri Feb 17 07:33:29 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * enum.c (id_lshift): use constant ID.
+
+Fri Feb 17 07:30:53 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/extconf.rb: refactored to split too long conditions.
+
+Fri Feb 17 00:23:25 2012 Tanaka Akira <akr@fsij.org>
+
+ * test/dbm/test_dbm.rb: fix skip condition for libgdbm 1.8.0 or prior.
+ reported by Bohuslav Kabrda.
+ [ruby-core:42685] [ruby-trunk - Bug #6036]
+
+Fri Feb 17 00:04:21 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/extconf.rb: check _DB_H_ macro unavailable except
+ Berkeley DB library.
+
+Thu Feb 16 05:41:35 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * insns.def (splatarray): make new array if flag is set.
+
+ * compile.c (iseq_compile_each): make new array with
+ splat. [ruby-core:21901][Feature #1125]
+
+Thu Feb 16 00:14:04 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * lib/abbrev.rb (Array#abbrev): add missing '"' in documentation.
+
+Wed Feb 15 22:20:19 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * cont.c (rb_fiber_reset_root_local_storage): add a new function to
+ restore rb_thread_t::local_storage.
+
+ * cont.c (rb_obj_is_fiber): add a new function to tell finalizer to
+ prevent fibers from destroy.
+
+ * gc.c (rb_objspace_call_finalizer): don't sweep fibers at finalizing
+ objspace.
+
+ * internal.h (rb_fiber_reset_root_local_storage, rb_obj_is_fiber):
+ add prototypes.
+
+ * vm.c (ruby_vm_destruct): reset main thread's local_storage before
+ free main thread. rb_thread_t::local_storage is replaced by fiber's
+ local storage when forked from fiber, and it should be already freed
+ when the fiber was destroyed. [ruby-core:41456] [Bug #5700]
+
+ * test/ruby/test_fiber.rb (test_fork_from_fiber): add test for fork
+ from fiber.
+
+Wed Feb 15 19:57:02 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/fiddle/closure.c (callback): deal with unsigned integers.
+ [ruby-core:42458][Bug #5991][Bug #6022]
+
+ * ext/fiddle/conversions.c (value_to_generic, generic_to_value):
+ ditto.
+
+ * ext/fiddle/closure.c (callback): same as r34506.
+
+Wed Feb 15 17:41:31 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * io.c (io_strsetbuf): call rb_str_modify to make str independent
+ before calling rb_str_set_len for r34580.
+
+Wed Feb 15 12:30:10 2012 Eric Hodel <drbrain@segment7.net>
+
+ * ext/zlib/zlib.c (Init_zlib): Added Zlib::TEXT and note that
+ Zlib::ASCII is deprecated in zlib 1.2.3 and newer.
+
+Wed Feb 15 12:24:40 2012 Eric Hodel <drbrain@segment7.net>
+
+ * ext/zlib/zlib.c: Move constant descriptions to constants. Remove
+ extra comment block at the top of Init_zlib().
+
+Wed Feb 15 12:30:46 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * lib/ostruct.rb: Create getters and setters after dup.
+ [Bug #6028] [rubyspecs:0380bcc]
+
+Wed Feb 15 10:59:52 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c (HEAP_BITMAP_LIMIT): HEAP_BITMAP_LIMIT is computed on the
+ basis of HEAP_SIZE because it must covers a whole heap block.
+ [ruby-trunk - Bug #6006]
+
+Wed Feb 15 09:27:45 2012 Eric Hodel <drbrain@segment7.net>
+
+ * ext/zlib/zlib.c (Init_zlib): Added Zlib::FIXED and Zlib::RLE
+ strategies.
+ * NEWS: Add note about the new Zlib constants.
+
+Wed Feb 15 09:11:36 2012 Eric Hodel <drbrain@segment7.net>
+
+ * ext/zlib/zlib.c: Improve documentation. [ruby-trunk - Bug #5948]
+
+Wed Feb 15 07:28:54 2012 Eric Hodel <drbrain@segment7.net>
+
+ * encoding.c (Init_Encoding): Add IO example of internal and external
+ encoding. Fixed a typo in the force_encoding example. [#5949]
+
+Wed Feb 15 06:58:21 2012 Eric Hodel <drbrain@segment7.net>
+
+ * encoding.c (Init_Encoding): Add Encoding documentation.
+ [ruby-trunk - Bug #5949]
+ * encoding.c (rb_set_default_external): Fix typo in documentation.
+
+Tue Feb 14 20:22:11 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c (CEILDIV): rename to a appropriate name.
+
+Tue Feb 14 18:07:20 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c (assign_heap_slot): SEGV happens cause on 64-bit platform
+ sometime there should be `objs-=2` instead of `objs--`.
+ [Bug #6006]
+ patched by Sokolov Yura. https://github.com/ruby/ruby/pull/92
+
+Tue Feb 14 16:00:30 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (io_setstrbuf): cut down the buffer if longer.
+
+Tue Feb 14 15:06:37 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit/assertions.rb (build_message): skip escaped
+ question marks.
+
+Tue Feb 14 12:10:04 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * variable.c (autoload_const_set, autoload_require): fix
+ signatures.
+
+Tue Feb 14 05:23:40 2012 Eric Hodel <drbrain@segment7.net>
+
+ * process.c (proc_wait): Change typo "SystemError" to
+ "SystemCallError". [ruby-trunk - Bug #5962]
+ * process.c (proc_wait2): ditto
+
+Tue Feb 14 05:18:24 2012 Eric Hodel <drbrain@segment7.net>
+
+ * enumerator.c: Document use of Enumerator.new for creating a lazy
+ enumeration for filtering/chaining. [ruby-trunk - Feature #707]
+
+Mon Feb 13 23:01:50 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * vm_method.c (rb_method_boundp):
+ obj.respond_to?(:a_protected_method) should return false because
+ calling a protected method may cause NoMethodError if called
+ from outside the class inheritance tree. Kernel#respond_to? is
+ mostly used to test if it is safe to call a method, so the false
+ positive should be avoided. [ruby-dev:40461] [ruby-dev:41739]
+ [ruby-dev:41837]
+
+Mon Feb 13 21:52:06 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c (HEAP_OBJ_LIMIT, HEAP_BITMAP_LIMIT): HEAP_OBJ_LIMIT used
+ `sizeof(struct heaps_slot)` while heap is currently allocated
+ with `struct heaps_header`.
+ HEAP_BITMAP_LIMIT were calculated from
+ `HEAP_OBJ_LIMIT/sizeof(uintptr_t)` - one Byte for each object,
+ not one Bit. [Bug #6006]
+ patched by Sokolov Yura. https://github.com/ruby/ruby/pull/92
+
+Mon Feb 13 18:30:32 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (io_setstrbuf): defer resizing buffer string until data is
+ read actually.
+
+Mon Feb 13 10:24:39 2012 Loren Segal <lsegal@soen.ca>
+
+ * io.c (Init_IO): use directive hack to make ARGF documentable
+ in other tools. [ruby-core:42515][Bug #6007]
+
+Sun Feb 12 20:43:54 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/ruby.h (rb_event_hook_func_t): add argument names.
+
+Sun Feb 12 16:30:23 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * tool/merger.rb (#default_merge_branch): Add support for
+ Subversion 1.7 which adopted a whole new working directory
+ structure.
+
+Sun Feb 12 15:14:41 2012 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * benchmark/driver.rb: suppress unused/shadowing variable warnings.
+
+Sun Feb 12 03:14:40 2012 Eric Hodel <drbrain@segment7.net>
+
+ * vm_eval.c (check_funcall): Call respond_to? with matching arity for
+ legacy single-argument implementations. [ruby-trunk - Bug #6000]
+
+Sat Feb 11 12:04:05 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * compile.c (defined_expr): guard the whole expression.
+ [ruby-dev:45021][Bug#5786]
+
+Sat Feb 11 08:34:42 2012 Eric Hodel <drbrain@segment7.net>
+
+ * ext/zlib/zlib.c (rb_inflate_add_dictionary): Added
+ Zlib::Inflate#add_dictionary to allow users to pre-specify
+ for using during #inflate. [ruby-trunk - Feature #5937]
+
+Sat Feb 11 08:23:02 2012 Eric Hodel <drbrain@segment7.net>
+
+ * ext/zlib/zlib.c (do_inflate): Inflate more data if buffered data
+ exists. Allows Zlib::Inflate#set_dictionary to work.
+ [ruby-trunk - Bug #5929]
+
+Sat Feb 11 06:00:48 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * dir.c (fnmatch): The * needs to be escaped to avoid formatting in
+ fnmatch comment.
+ patched by @dalton. https://github.com/ruby/ruby/pull/91
+
+Fri Feb 10 03:41:31 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/parser.c: removed external encoding setter, allow parser
+ to be reused.
+ * ext/psych/lib/psych/parser.rb: added external encoding setter.
+ * test/psych/test_parser.rb: test parser reuse
+
+Fri Feb 10 01:30:41 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/dl/dl.h (ALIGN_OF): use offsetof().
+
+ * ext/dl/dl.h (DLALIGN): round up at once and get rid of overflow.
+
+Fri Feb 10 00:47:07 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/ruby/envutil.rb (assert_no_memory_leak): new assertion to
+ check memory leak by invoking child ruby process and watch its
+ memory size.
+
+Thu Feb 9 23:41:44 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * test/pathname/test_pathname.rb (test_binread): add assertion to
+ check encoding.
+
+Thu Feb 9 16:48:19 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/dl/dl.c (Init_dl): fix mangled document.
+
+Thu Feb 9 16:10:34 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/memory_status.rb (Memory::Win32): 64bit support.
+
+Thu Feb 9 16:08:55 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/dl/lib/value.rb (DL::ValueUtil.{unsigned_value,signed_value}):
+ currently pack/unpack does not accept "q!" and "Q!".
+
+Thu Feb 9 16:01:29 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/fiddle/conversions.c (value_to_generic): src is not guaranteed as
+ a Bignum if the type is LONG_LONG. it may be a Fixnum if the value
+ is small.
+
+Thu Feb 9 11:32:36 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/dl/lib/types.rb: Win64 support.
+
+Thu Feb 9 04:12:29 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * test/pathname/test_pathname.rb: not read but binread.
+ patched by Benoit Daloze, [ruby-core:42440] [Bug #5984]
+
+Wed Feb 8 22:29:59 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (rb_str_modify_expand): fix memory leak.
+
+Wed Feb 8 14:06:59 2012 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * ext/openssl/ossl_ssl.c: Add SSL constants and allow to unset SSL
+ option to prevent BEAST attack. See [Bug #5353].
+
+ In OpenSSL, OP_DONT_INSERT_EMPTY_FRAGMENTS is used to prevent
+ TLS-CBC-IV vulnerability described at
+ http://www.openssl.org/~bodo/tls-cbc.txt
+ It's known issue of TLSv1/SSLv3 but it attracts lots of attention
+ these days as BEAST attack. (CVE-2011-3389)
+
+ Until now ossl sets OP_ALL at SSLContext allocation and call
+ SSL_CTX_set_options at connection. SSL_CTX_set_options updates the
+ value by using |= so bits set by OP_ALL cannot be unset afterwards.
+
+ This commit changes to call SSL_CTX_set_options only 1 time for each
+ SSLContext. It sets the specified value if SSLContext#options= are
+ called and sets OP_ALL if not.
+
+ To help users to unset bits in OP_ALL, this commit also adds several
+ constant to SSL such as
+ OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS. These constants were
+ not exposed in Ruby because there's no way to unset bits in OP_ALL
+ before.
+
+ Following is an example to enable 0/n split for BEAST prevention.
+
+ ctx.options = OP_ALL & ~OP_DONT_INSERT_EMPTY_FRAGMENTS
+
+ * test/openssl/test_ssl.rb: Test above option exists.
+
+Wed Feb 8 13:12:02 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_x509name.c: Use the numerical representation of
+ unrecognized OIDs instead of the sn "UNDEF".
+
+ * test/openssl/test_x509name.rb: Add tests for the fixed behavior.
+
+ Patch provided by Paul Kehrer, thank you!
+ [ruby-core:41769] [Feature #5787]
+
+Wed Feb 8 09:49:58 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * tool/merger.rb: don't abort, update first.
+
+Wed Feb 8 09:47:33 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_asn1.c: Call INT2NUM only once for GeneralString.
+ Thanks to Mantas Mikulenas for noticing and providing a patch!
+ [ruby-core:42358] [Bug #5972]
+
+Wed Feb 8 09:19:00 2012 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_cipher.c: Add warning about key as IV.
+
+Tue Feb 7 20:08:12 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * error.c (exc_inspect): Fix typo. patch from Trent Ogren
+ via https://github.com/ruby/ruby/pull/90
+
+Tue Feb 7 19:37:35 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * st.c: refactor packed entries using structs.
+
+Tue Feb 7 14:52:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * st.c (st_update): table can be unpacked in the callback.
+
+ * st.c (st_foreach): should not yield same pair when checking
+ after unpacking.
+
+Mon Feb 6 21:55:13 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * tool/merger.rb: abort if the working directory is dirty.
+
+ * tool/merger.rb: update the working directory after commit.
+
+Mon Feb 6 00:16:27 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * encoding.c (rb_enc_compatible): return ASCII-8BIT even if 2nd string
+ is ascii only string. [ruby-core:42354] [Bug #5968]
+
+Fri Feb 3 07:16:47 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/webrick.rb: Moved proxy rewriting to WEBrick::HTTPProxy.
+ * lib/webrick/httpproxy.rb: Add examples of creating a proxy server
+ and response rewriting using HTTPProxy.
+
+Fri Feb 3 06:53:22 2012 Eric Hodel <drbrain@segment7.net>
+
+ * ext/openssl/ossl_x509store.c: Add class documentation for
+ OpenSSL::X509::Store
+
+Thu Feb 2 22:28:13 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * test/net/http/test_https_proxy.rb
+ (HTTPSProxyTest#test_https_proxy_authentication):
+ add workaround to avoid to hang up without openssl.
+ see [ruby-dev:45021][Bug #5786]
+
+ * test/resolv/test_dns.rb (TestResolvDNS#test_query_ipv4_address):
+ ditto.
+
+Thu Feb 2 21:48:18 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rexml/parsers/baseparser.rb: use meaningful names.
+
+Thu Feb 2 21:38:52 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rexml/parsers/baseparser.rb, test/rexml/test_namespace.rb:
+ fix the default xml namespace URI validation.
+ [ruby-dev:45169] [Bug #5956]
+ Reported by Miho Hiramatsu. Thanks!!!
+
+Thu Feb 2 17:51:02 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * io.c (argf_next_argv): reset ARGF.next_p on ARGV.replace.
+ r34409 breaks replacing ARGV.
+ [ruby-dev:45160] [Bug #5952]
+
+Thu Feb 2 16:21:01 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/net/http/test_http.rb (TestNetHTTPKeepAlive#*): remove debug
+ output.
+
+Thu Feb 2 01:24:34 2012 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * parse.y (debug_lines, coverage): set file path encoding for coverage
+ result. [ruby-dev:44950]
+
+Wed Feb 1 14:38:31 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/tempfile.rb (Tempfile#unlink, Tempfile::Remover#call): Just
+ call File.unlink and ignore ENOENT because existence check
+ before unlinking does not help in terms of race condition.
+
+ * lib/tempfile.rb (Tempfile#unlink, Tempfile::Remover#call): My
+ comment about thread safeness is obsolete.
+
+Wed Feb 1 09:50:10 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * doc/re.rdoc (Repetition): fix typo. reported by Ori Avtalion
+ and patched by Zachary Scott. [Bug #5947]
+
+Wed Feb 1 06:38:54 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (argf_close): skip stdin, which should be readable again.
+ [ruby-dev:45160] [Bug #5952]
+
+ * io.c (argf_readlines): reinitialize after all read to be
+ readable again.
+
+Tue Jan 31 21:27:43 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * configure.in (HEAP_ALIGN_LOG): HEAP_ALIGN_LOG should be page
+ size in OpenBSD. [ruby-core:42158][Bug #5901]
+
+ * gc.c : avoid to redefine.
+
+Tue Jan 31 14:27:22 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/ruby/envutil.rb (EnvUtil.invoke_ruby): yield also child pid
+ in block form.
+
+Mon Jan 30 19:08:19 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_eval.c (vm_call0): should pass block to enumerators. patched
+ by Kazuki Tsujimoto. [ruby-dev:44961][Bug #5731]
+
+ * vm_eval.c (method_missing), vm_insnhelper.c (vm_call_method):
+ ditto. patched by satoshi shiba.
+
+Mon Jan 30 12:31:05 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * file.c (append_fspath): need to set the encoding to result always.
+
+Mon Jan 30 10:38:37 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/irb/test_completion.rb: skip if cannot load irb/completion
+ (maybe readline does not exist).
+
+Sun Jan 29 22:47:19 2012 Yutaka Kanemoto <kanemoto@ruby-lang.org>
+
+ * tool/config.{guess,sub}: updated to automake-1.11.2.
+
+Sun Jan 29 12:17:56 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/readline/readline.c (readline_attempted_completion_function):
+ respect encodings. [Bug #5941]
+
+Sat Jan 28 09:33:33 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * win32/win32.c (rb_w32_read): fix an issue that $stdin.read doesn't
+ terminate by CTRL-C on Windows.
+ [ruby-dev:45149] [Bug #5812]
+
+Sat Jan 28 08:18:11 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * test/ruby/test_thread.rb
+ (TestThreadGroup#test_thread_timer_and_interrupt): skip exit status
+ assertion because we cannot get signal status on Windows.
+
+ * win32/win32.c (CreateChild): create process group to receive the
+ signal by GenerateConsoleCtrlEvent().
+
+ * win32/win32.c (kill): use CTRL_BREAK_EVENT instead of CTRL_C_EVENT
+ if a process group is specified. CTRL_C_EVENT signal cannot be
+ generated for process groups for the specification.
+ [ruby-dev:45149] [Bug #5812]
+
+Sat Jan 28 07:46:03 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * thread_win32.c (rb_w32_wait_events_blocking): use
+ ruby_thread_from_native() instead of GET_THREAD() because
+ GET_THREAD() doesn't always return the current thread and
+ WaitForMultipleObjects() at rb_w32_read() doesn't return by
+ Thread#kill. This fixes TestQueue#test_thr_kill failure on
+ Windows.
+
+ * thread_win32.c (rb_w32_wait_events): use ruby_thread_from_native()
+ instead of GET_THREAD() for consistency with the above change.
+
+ * thread_win32.c (rb_w32_sleep): ditto.
+
+ * thread_win32.c (rb_w32_Sleep): ditto.
+ [ruby-dev:45149] [Bug #5812]
+
+Sat Jan 28 07:28:48 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * test/zlib/test_zlib.rb (TestZlibGzipReader#test_reader_wrap): set
+ binmode explicitly for fixing test error on Windows. This is consistent
+ with r34243.
+ [ruby-dev:45149] [Bug #5812]
+
+Sat Jan 28 05:53:34 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/irb/completion.rb (IRB::InputCompletor::CompletionProc):
+ ignore non-string name modules. [ruby-core:42244][Bug #5938]
+
+Fri Jan 27 16:31:45 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * gc.c (HEAP_ALIGN, HEAP_ALIGN_MASK): DRY, let compiler calculate
+ from HEAP_ALIGN_LOG.
+
+Thu Jan 26 11:03:37 2012 Eric Hodel <drbrain@segment7.net>
+
+ * lib/matrix.rb: Clean up extra whitespace in output documentation.
+
+Thu Jan 26 03:24:02 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/io/console/console.c (io_getch): default delegating method
+ for StringIO. https://github.com/nobu/io-console/issues/4
+
+ * ext/stringio/stringio.c: moved some methods to hidden modules.
+
+Wed Jan 25 13:27:42 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (rb_file_s_basename): ignore non-ascii extension in
+ different encoding, which cannot match.
+
+ * file.c (rmext): no extension to strip if empty string.
+
+ * file.c (rb_enc_path_next, rb_enc_path_skip_prefix)
+ (rb_enc_path_last_separator, rb_enc_path_end)
+ (ruby_enc_find_basename, ruby_enc_find_extname): encoding-aware
+ path handling functions.
+
+ * file.c (rb_home_dir, file_expand_path, rb_realpath_internal)
+ (rb_file_s_basename, rb_file_dirname, rb_file_s_extname)
+ (rb_file_join): should respect the encodings of arguments than
+ file system encoding. [ruby-dev:45145] [Bug #5919]
+
+ * dir.c (check_dirname, ruby_glob0): ditto.
+
+ * ext/pathname/pathname.c (path_sub_ext): ditto.
+
+Tue Jan 24 14:20:42 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm.c (rb_iter_break_value): new function to break a block with
+ the value. [ruby-dev:45132] [Feature #5895]
+
+Tue Jan 24 12:58:41 2012 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * object.c (rb_Hash): add Kernel#Hash conversion method like
+ Array() or Float(). a patch from Run Paint Run Run. Fix #3131
+
+Tue Jan 24 11:38:05 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/uri/common.rb (URI.encode_www_form_component): initialize on
+ requiring to support JRuby, which runs parallel multithreads.
+ [ruby-core:42222] [Bug #5925]
+
+ * lib/uri/common.rb (URI.decode_www_form_component): initialize on
+
+Mon Jan 23 20:33:11 2012 Jason Kay <geniture@me.com>
+
+ * lib/net/http.rb (Net::HTTP#connect): Writing entire packet at
+ once to avoid incomplete transmission. Current code using
+ writeline was causing sub-optimal conversing with a proxy due to
+ the connect tunnel request headers being split over multiple
+ packets. The modification I made allows the connect request to
+ be written as one packet, avoiding problems and optimizing the
+ conversation.
+
+ https://github.com/ruby/ruby/pull/72
+ [Feature #5460]
+
+Mon Jan 23 17:06:17 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/uri/mailto.rb (URI::MailTo.build): follow Array#to_s change of
+ Ruby 1.9; use Array#join. [Bug #5840]
+
+Mon Jan 23 16:42:28 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * io.c (extract_binmode): raise an exception if binmode/textmode
+ is specified with both vmode and opthash.
+ [ruby-core:42199] [Bug #5918]
+
+Mon Jan 23 16:35:27 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * io.c (rb_io_extract_modeenc): set ASCII-8BIT if binmode is specified
+ with opthash. [ruby-core:42197] [Bug #5917]
+
+Mon Jan 23 10:08:00 2012 Kenta Murata <mrkn@cookpad.com>
+
+ * test/cgi/test_cgi_util.rb (test_cgi_escape_preserve_encoding):
+ add a test for CGI::escape to preserve encoding.
+
+ * test/cgi/test_cgi_util.rb (test_cgi_unescape_preserve_encoding):
+ add a test for CGI::unescape to preserve encoding.
+
+Mon Jan 23 00:45:34 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * misc/rdoc-mode.el (rdoc-imenu-create-index): Add imenu support
+ to rdoc-mode.
+
+ * misc/rdoc-mode.el (rdoc-mode): Fix regexp patterns containing
+ "\s " where CR/LF is not supposed to match.
+
+Sun Jan 22 15:41:26 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (rb_intern3): split to registration check and new
+ registration.
+
+ * parse.y (rb_intern_str): make interned string shared with the
+ given string.
+
+ * parse.y (rb_intern3, rb_intern_str): check the coderange first.
+
+Sat Jan 21 22:21:07 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/ruby.h (FIXNUM_P): simple flag should be int.
+
+Sat Jan 21 21:51:19 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * encoding.c (rb_enc_compatible): fix segv on symbols.
+ [ruby-core:42204] [Bug #5921]
+
+Sat Jan 21 11:43:45 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * dir.c (dir_chdir, check_dirname): get rid of optimization-out.
+
+Fri Jan 20 20:47:37 2012 Kenta Murata <mrkn@cookpad.com>
+
+ * lib/cgi/util.rb (CGI.escape): support a string with invalid byte
+ sequence. [Bug #5913]
+
+ * test/cgi/test_cgi_util.rb
+ (test_cgi_escape_with_invalid_byte_sequence): test for the above
+ change.
+
+Fri Jan 20 17:37:37 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * vm.c (vm_exec): remove workaround for LLVM because r34278 fixes it.
+
+ * vm_insnhelper.c (vm_call_cfunc): ditto.
+
+Fri Jan 20 14:31:43 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/http.rb (Net::HTTP#transport_request): retry a idempotent
+ request automatically. [ruby-dev:45030] [Bug #5790]
+ [ruby-core:41821] [Bug #5813]
+
+ * lib/net/http.rb (Net::HTTP#keep_alive_timeout=): added to specify
+ the second to reconnect the TCP connection on Keep-Alive.
+ The default value is 2 second because current servers uses 2 sec.
+ http://ftp-admin.blogspot.com/2009/09/keepalivetimeout2.html
+
+ * lib/net/http.rb (Net::HTTP#begin_transport): reconnect TCP
+ connection on keep-alive timeout.
+
+Thu Jan 19 07:53:09 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_strptime.c: moved detector of leftover.
+
+Thu Jan 19 07:10:47 2012 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_parse.c: [ruby-core:42173].
+
+Wed Jan 18 18:11:02 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * misc/rdoc-mode.el (rdoc-mode): Add provide so that requiring
+ this library succeeds.
+
+Wed Jan 18 18:06:45 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/curses/curses.c (cWindow, cMouseEvent): made typed data.
+
+Wed Jan 18 12:49:15 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/to_ruby.rb: Added support for loading
+ subclasses of String with ivars
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: Added support for dumping
+ subclasses of String with ivars
+ * test/psych/test_string.rb: corresponding tests
+
+Wed Jan 18 10:39:47 2012 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/to_ruby.rb: Added ability to load array
+ subclasses with ivars.
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: Added ability to dump
+ array subclasses with ivars.
+ * test/psych/test_array.rb: corresponding tests
+
+Tue Jan 17 17:18:41 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (SPT_TYPE): enable as SPT_REUSEARGV on Darwin.
+
+ * missing/setproctitle.c (ruby_init_setproctitle): changed prefix.
+
+Tue Jan 17 12:32:46 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * gc.c (aligned_malloc, aligned_free): covered missing defined
+ operators and fixes for cygwin.
+
+Tue Jan 17 10:54:46 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * st.c (do_hash): it's the time to remove cast to unsigned int.
+
+Tue Jan 17 07:30:12 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * st.c (unpack_entries): Fix r34310: on unpacking, the position of
+ a hash must be do_hash-ed value.
+
+ * st.c (add_packed_direct): ditto.
+
+Mon Jan 16 16:41:53 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/optparse.rb (Regexp): fix incorrect options when casting to
+ a Regexp, and suppress encoding option warnings.
+ https://github.com/ruby/ruby/pull/82
+
+Mon Jan 16 11:22:38 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/win32.c (rb_chsize): no need to get the current file size.
+
+Mon Jan 16 00:41:33 2012 Sokolov Yura <funny.falcon@gmail.com>
+
+ * st.c: st use function instead of macro. In my current
+ environment (Ubuntu 11.04 32bit gcc-4.5.2) it gives 4%
+ performance improvement.
+
+ https://github.com/ruby/ruby/pull/77
+
+Sun Jan 15 14:09:48 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * object.c (rb_inspect): raise the result is not compatible with
+ the default external encoding. [ruby-core:42095] [Bug #5848]
+ 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.
+
+Sun Jan 15 13:21:50 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/json/parser/parser.rl (json_string_unescape): workaround fix
+ for over optimization of GCC 4.7. [ruby-core:42085] [Bug #5888]
+ http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51862
+
+Sat Jan 14 22:24:09 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/dl/callback/mkcallback.rb (gencallback): suppress unused
+ variables.
+
+Sat Jan 14 21:56:43 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * iseq.c (iseq_data_to_ary): check line info table boundary. line
+ number 0 means no line number info is needed. [ruby-dev:45130]
+ [Bug #5894]
+
+Sat Jan 14 18:24:13 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * error.c (exc_equal): clear rb_thread_t::errinfo when ignore
+ an exception under rb_protect(). [ruby-core:41979] [Bug #5865]
+
+Sat Jan 14 12:02:55 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * sprintf.c (rb_enc_vsprintf): relaxed the restriction. since the
+ implementation deeply depends on plain char, so wchar_t based
+ encodings are not supported.
+
+Sat Jan 14 12:00:20 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * error.c (exc_equal): ignore exceptions during implicit
+ conversion. [ruby-core:41979] [Bug #5865]
+
+Sat Jan 14 05:58:54 2012 Eric Hodel <drbrain@segment7.net>
+
+ * io.c (rb_io_s_read): Fix formatting of open_args comment. Reported
+ by Adam Prescott.
+
+Fri Jan 13 18:41:19 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * sprintf.c (rb_enc_vsprintf): can be used for ASCII compatible
+ encodings only.
+
+Fri Jan 13 18:29:06 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread.c (rb_mutex_unlock_th): simplified.
+
+ * thread.c (rb_barrier_waiting): fix potential overflows.
+
+Fri Jan 13 17:23:38 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * load.c (load_unlock): update loading table at once.
+
+Fri Jan 13 16:44:45 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * error.c (exc_equal): try implicit conversion for delegator.
+ [ruby-core:41979] [Bug #5865]
+
+Fri Jan 13 03:46:53 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/shellwords.rb (Shellwords#shellescape): shellescape() now
+ stringifies the given object using to_s.
+
+ * lib/shellwords.rb (Shellwords#shelljoin): shelljoin() accepts
+ non-string objects in the given array, each of which is
+ stringified using to_s.
+
+ * lib/shellwords.rb: Fix rdoc markups.
+
+Fri Jan 13 03:38:36 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/shellwords.rb (Shellwords#shellsplit): Fix a bug where
+ consecutive backslashes in double quotes are all removed except
+ the one at the tail.
+
+Fri Jan 13 03:28:00 2012 Luis Lavena <luislavena@gmail.com>
+
+ * ext/socket/extconf.rb (if ipv6): only define _WIN32_WINNT if was not
+ previously defined. This solve warnings with multiple defines in
+ command line with GCC 4.6.1
+
+Thu Jan 12 18:44:31 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb: fix r33904 and revert r33905. initialize global
+ variables with init_mkmf before initializing constants.
+ [ruby-dev:45124] [Bug #5879]
+
+Thu Jan 12 13:51:00 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * cont.c (cont_restore_0): prevent optimizing out `sp'. sp is used for
+ reserving a memory space with ALLOCA_N for restoring machine stack
+ stored in cont->machine_stack, but clang optimized out it (and
+ maybe #5851 is also caused by this).
+ This affected TestContinuation#test_check_localvars.
+
+ * cont.c (cont_restore_1): revert workaround introduced in r32201.
+
+Thu Jan 12 02:14:43 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * object.c: Added examples for Object#is_a? and
+ Object#instance_of? patched from Manoj Kumar.
+ [Bug #5880] [ruby-core:42057]
+
+Thu Jan 12 00:57:48 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * lib/mkmf.rb: verbose-mode can use by RM, RMDIRS, etc.
+ (e.g. make V=1 realclean)
+
+Wed Jan 11 23:40:21 2012 Naohisa Goto <ngoto@gen-info.osaka-u.ac.jp>
+
+ * string.c (rb_str_concat): set array element after definition
+ to fix compile error with Fujitsu C Compiler 5.6 on Solaris 10
+ on Sparc. [Bug #5878] [ruby-dev:45123]
+
+Wed Jan 11 22:52:51 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * gc.c (ruby_mimmalloc): don't set allocated size to header.
+ ruby_mimmalloc() doesn't increment allocated_size/allocations and
+ decrement them in ruby_xfree() cause inconsistency.
+
+ * gc.c (ruby_xfree): don't decrement allocated_size/allocations if
+ allocated size record is 0.
+
+Wed Jan 11 22:36:43 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * test/readline/test_readline.rb (test_completion_proc_empty_result):
+ ensure clearance of Readline's line_buffer after the test.
+
+Tue Jan 10 21:57:38 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * ext/dbm/dbm.c (Init_dbm): fix a build error on mswin32.
+ use `extern __declspec(dllimport)` for dll link with VC.
+ [ruby-core:41996] [Bug #5869]
+
+Tue Jan 10 15:31:55 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * vm.c (vm_exec): refix r34162; suppress warning and add description.
+
+Tue Jan 10 15:13:58 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/readline/readline.c (readline_attempted_completion_function):
+ use rb_memerror().
+
+Tue Jan 10 12:49:42 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * gc.c: in fact, i686-linux doesn't need to define _XOPEN_SOURCE 600.
+
+Tue Jan 10 12:44:11 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * gc.c (ruby_mimmalloc): defined for objects need not rb_objspace,
+ but should return pointer suitable for ruby_xfree;
+ main vm and main thread.
+ patched by Sokolov Yura. https://github.com/ruby/ruby/pull/79
+
+ * internal.h: ditto.
+
+ * vm.c (Init_BareVM): use ruby_mimmalloc.
+
+ * ext/dl/cfunc.c: #include <ruby/util.h>.
+
+ * ext/syslog/syslog.c: use xfree because it is allocated by
+ ruby_strdup.
+
+Tue Jan 10 12:13:56 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * ext/readline/readline.c (readline_attempted_completion_function):
+ fix compile error.
+
+Tue Jan 10 10:41:11 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/readline/readline.c (readline_attempted_completion_function):
+ empty completion result does not mean memory error.
+
+Tue Jan 10 02:19:22 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * test/ruby/test_io.rb (test_autoclose_true_closed_by_finalizer,
+ test_autoclose_true_closed_by_finalizer): skip if IO objects are
+ not recycled yet. [ruby-dev:45098] [Bug #5850]
+
+Tue Jan 10 00:41:28 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * lib/tempfile.rb (Tempfile#_close): clear @tempfile and @data[1] even
+ when exception is raised at @tempfile.close. [ruby-dev:45113]
+
+ * lib/tempfile.rb (Tempfile#unlink): fix a typo.
+
+Tue Jan 10 00:32:17 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * gc.c (run_finalizer): clear rb_thread_t::errinfo when ignore
+ an exception under rb_protect(). [ruby-dev:45113]
+
+Mon Jan 9 23:37:43 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * ext/readline/readline.c (readline_attempted_completion_function):
+ fix typos.
+
+Mon Jan 9 20:55:34 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c : don't embed struct heaps_slot to a heap block because it
+ can causes copy-on-write of memory page on heap block when its
+ free_next is rewritten.
+
+Mon Jan 9 20:26:33 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/pathname/pathname.c (path_entries): add document suggested by
+ the thread [ruby-core:41959] [Bug #5859].
+
+Mon Jan 9 20:14:13 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/lib/socket.rb (family_addrinfo): don't require protocol
+ equality. For example, protocol 0 and IPPROTO_TCP is not problem
+ for TCP.
+
+Mon Jan 9 20:08:52 2012 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/lib/socket.rb (family_addrinfo): return the given
+ addrinfo object.
+ Patch by Ippei Obayashi. [ruby-dev:45095] [Bug #5845]
+
+Mon Jan 9 19:40:20 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/zlib/test_zlib.rb (TestZlibGzipWriter#test_writer_wrap): set
+ binmode explicitly.
+
+Mon Jan 9 14:42:41 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c: free_slots is changed Singly linked list. clear
+ free_slots before sweep.
+
+Mon Jan 9 07:46:17 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * gc.c: i686-linux needs to define _XOPEN_SOURCE 600 for posix_memalign.
+
+Mon Jan 9 04:24:59 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * gc.c (rb_objspace_free): global_List is allocated with xmalloc.
+ patched by Sokolov Yura. https://github.com/ruby/ruby/pull/78
+
+ * dln_find.c: remove useless replacement of free.
+
+ * ext/readline/readline.c (readline_attempted_completion_function):
+ strings for readline must allocated with malloc.
+
+ * process.c (run_exec_dup2): use free; see also r20950.
+
+ * re.c (onig_new_with_source): use malloc for oniguruma.
+
+ * vm.c (ruby_vm_destruct): use free for VMs.
+
+ * vm.c (thread_free): use free for threads.
+
+Mon Jan 9 04:24:59 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * dln_find.c: remove useless replacement of free.
+
+ * ext/readline/readline.c (filename_completion_proc_call):
+ matches should use xfree.
+
+ * ext/readline/readline.c (username_completion_proc_call): ditto.
+
+Mon Jan 9 01:12:35 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * numeric.c (rb_enc_uint_char): raise RangeError when added codepoint
+ is invalid. [Feature #5855] [Bug #5863] [Bug #5864]
+
+ * string.c (rb_str_concat): ditto.
+
+ * string.c (rb_str_concat): set encoding as ASCII-8BIT when the string
+ is US-ASCII and the argument is an integer greater than 127.
+
+ * regenc.c (onigenc_mb2_code_to_mbclen): rearrange error code.
+
+ * enc/euc_jp.c (code_to_mbclen): ditto.
+
+ * enc/shift_jis.c (code_to_mbclen): ditto.
+
+Sun Jan 8 20:31:45 2012 Narihiro Nakamura <narihiro@netlab.jp>
+
+ * gc.c : consider header bytes which are used by malloc.
+
+Sun Jan 8 11:54:43 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c (aligned_free): support MinGW. Patch by Hiroshi Shirosaki.
+
+Sun Jan 8 11:43:05 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c (slot_sweep): add a assertion instead of a debug print.
+
+Sun Jan 8 01:18:19 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * test/-ext-/old_thread_select/test_old_thread_select.rb:
+ avoid platform bug. [Bug #5858] [ruby-dev:45108]
+
+Sun Jan 8 00:46:34 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * gc.c: get rid of implicit narrowing conversion.
+
+Sun Jan 8 00:10:10 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * configure.in: check posix_memalign(3) and memalign(3).
+
+ * gc.c (aligned_malloc): use configure's result instead of
+ _POSIX_C_SOURCE and _XOPEN_SOURCE because they can't be used
+ to check availability at least on FreeBSD.
+
+Sat Jan 7 22:25:50 2012 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c: use Bitmap Marking algorithm to avoid copy-on-write of
+ memory pages. See [ruby-dev:45085] [Feature #5839]
+ [ruby-core:41916].
+
+ * include/ruby/ruby.h : FL_MARK rename to FL_RESERVED1.
+
+ * node.h : ditto.
+
+ * debug.c : ditto.
+
+ * object.c (rb_obj_clone): FL_MARK move to a bitmap.
+
+ * class.c (rb_singleton_class_clone): ditto.
+
+Sat Jan 7 00:47:07 2012 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * configure.in: always define CANONICALIZATION_FOR_MATHN.
+ [ruby-dev:45100] [Bug #5852]
+
+Fri Jan 6 23:11:20 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * include/ruby/version.h: RUBY_API_VERSION 2.0.0
+
+Fri Jan 6 12:24:11 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * object.c (rb_inspect): raises Encoding::CompatibilityError if the
+ result is incompatible with the default external encoding.
+ [ruby-core:41931] [Bug #5848]
+
+Thu Jan 5 15:26:15 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (check_valid_dir): strict checking of root.
+ GetDriveType() succeeds with non root directory as the argument,
+ even if MSDN says that the API needs the root directory.
+ this patch fixes a failure of test/ruby/test_file_exhaustive.rb.
+
+Thu Jan 5 12:15:55 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * file.c (rb_file_join): separator is appended by array length - 1
+ times. patched by Benoit Daloze [ruby-core:41901] [Bug #5841]
+
+Thu Jan 5 11:47:54 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/uri/common.rb (URI::Parser#initialize_regexp):
+ use \A \z instead of ^ $. [Bug #5843]
+
+Wed Jan 4 17:55:53 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * array.c (rb_ary_sample): add example for Array#sample
+ based on patch from https://github.com/ruby/ruby/pull/74
+
+Wed Jan 4 14:24:33 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * string.c (str_nth_len): count ascii-only run at the end. this
+ bug appears only when single-byte-optimization is disabled due
+ to unknown coderange. [ruby-core:41896] [Bug #5836]
+
+Wed Jan 4 11:32:07 2012 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (check_valid_dir): special case for a root directory.
+ Reported by Masateru OKAMOTO at [Bug #5819].
+
+Wed Jan 4 00:19:54 2012 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rexml/parsers/baseparser.rb: use private instead of _xxx
+ method name. This is Ruby code not Python code.
+ refs #5696
+
+Tue Jan 3 23:57:37 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * lib/rexml/parsers/baseparser.rb: rexml BaseParser uses
+ instance_eval unnecessarily on listener add.
+ patch from Charles Nutter. [Bug #5696] [ruby-core:41437]
+
+Tue Jan 3 20:44:13 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * README: add comment for Git user. patch from Arun Agrawal.
+ * README.ja: ditto.
+
+Tue Jan 3 15:58:22 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * thread.c: changed documentation for "thread-local" variables.
+ patch from Julien Ammous.
+
+Tue Jan 3 15:50:12 2012 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * process.c: Fix typo. patch from Aviv Ben-Yosef.
+
+Tue Jan 3 13:43:37 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * tool/merger.rb: allow r0123 style revision number.
+
+Tue Jan 3 11:17:55 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * tool/merger.rb (#version_up): version.h date should be Japanese
+ locale date.
+
+Mon Jan 2 22:08:00 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * tool/file2lastrev.rb (VCS::detect): Add support for Subversion
+ 1.7 which adopted a whole new working directory structure.
+
+ * tool/file2lastrev.rb (VCS::detect): Simply use .each instead of
+ .sort.reverse_each which looks too arbitrary. If you want SVN
+ to be tried first, then you just have to register it first as it
+ is right now.
+
+Mon Jan 2 20:53:36 2012 Tanaka Akira <akr@fsij.org>
+
+ * lib/securerandom.rb (random_bytes): use IO#read instead of
+ IO#readpartial to make the intent more clear.
+
+Mon Jan 2 15:26:39 2012 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * test/ruby/test_object.rb (test_send_with_block): add a normal case.
+
+Mon Jan 2 15:18:54 2012 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * test/ruby/test_object.rb (test_send_with_block): moved from
+ bootstraptest/test_flow.rb.
+
+Mon Jan 2 15:10:11 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * lib/test/unit/parallel.rb: use pack("m0") instead of
+ pack("m").gsub("\n","").
+ * lib/test/unit.rb (Test::Unit::Runner::Worker#run): ditto.
+
+Mon Jan 2 15:05:09 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * lib/test/unit.rb (Test::Unit::Runner::Worker#run): use
+ File.basename with suffix instead of gsub.
+
+Mon Jan 2 14:55:28 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * lib/test/unit.rb (Test::Unit::Runner#_run_parallel): find may
+ return nil and nil can not dup.
+
+Sun Jan 1 12:23:10 2012 Akinori MUSHA <knu@iDaemons.org>
+
+ * lib/shellwords.rb (Shellwords#shellescape): Drop the //n flag
+ that only causes warnings with no real effect. [Bug #5637]
+
+Sat Dec 31 06:28:37 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * thread.c (rb_barrier_waiting): save the number of waiting threads
+ in RBASIC()->flags. [ruby-dev:45002] [Bug #5768]
+
+ * thread.c (rb_barrier_wait): increment and decrement around
+ rb_mutex_lock, and use rb_barrier_waiting().
+
+ * thread.c (rb_barrier_release): use rb_barrier_waiting().
+
+ * thread.c (rb_barrier_destroy): ditto.
+
+Mon Dec 26 17:20:10 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * vm.c (vm_exec): add guard to prevent optimization for LLVM clang.
+
+Fri Dec 30 17:01:12 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * vm_eval.c (rb_f_send): fix obj.send() documentation issue.
+ [Bug #5125] [ruby-core:38633]
+
+Thu Dec 29 22:36:16 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * lib/test/unit.rb (Test::Unit::Runner::Worker#_run_parallels): fix
+ premature exit when all workers' status are :ready or :prepare.
+ [ruby-dev:45061] [Bug #5822]
+
+Thu Dec 29 01:51:13 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * include/ruby/ruby.h: fix #error pragma. LLP64 platform is supported.
+
+ * include/ruby/st.h: ditto.
+
+Wed Dec 28 11:22:45 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/fileutils.rb (FileUtils::Entry_#entries): use utility method
+ instead of typoed regexp. [ruby-core:41829] [Bug #5817]
+
+Wed Dec 28 02:08:04 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * vm_insnhelper.c (unknown_keyword_error): add GC guard to prevent
+ intermediate object from GC.
+
+Tue Dec 27 22:34:54 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/test/unit.rb (Worker#close): "closing IO if IO is closed"
+ should be "closing IO if IO isn't closed"
+
+Tue Dec 27 22:04:27 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * st.c (st_update): new function to lookup the given key and
+ update the value. [ruby-dev:44998]
+
+Tue Dec 27 21:17:33 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * node.h (rb_args_info): change pre_args_num and post_args_num as
+ int, to match with rb_iseq_t.
+
+ * parse.y (new_args_gen): check overflow.
+
+Mon Dec 26 22:38:35 2011 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * vm_insnhelper.c (unknown_keyword_error): make it kind a error
+ message when unknown keyword is given. It require more work.
+ See [ruby-core:40518] and [ruby-core:40541] in detail.
+
+Mon Dec 26 22:31:07 2011 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * vm_core.h (struct rb_iseq_struct), compile.c (iseq_set_arguments),
+ iseq.c (rb_iseq_parameters), vm_insnhelper.c
+ (vm_callee_setup_arg_complex): support Method#parameters for keyword
+ arguments. The provisional spec is what Benoit Daloze proposed.
+ [ruby-core:40541]
+
+ * test/ruby/test_keyword.rb: add a test for above.
+
+Mon Dec 26 22:15:27 2011 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * vm_core.h (struct rb_iseq_struct), compile.c (iseq_set_arguments,
+ iseq_compile_each), vm_insnhelper.c (vm_callee_setup_arg_complex):
+ implement keyword arguments. See [ruby-core:40290]
+ The feature is promised to be included in 2.0, but the detail spec
+ is still under discussion; this commit is a springboard for further
+ discussion. Please try it and give us feedback.
+ This commit includes fixes for some problems reported by Benoit
+ Daloze <eregontp AT gmail.com> [ruby-core:40518] and Marc-Andre
+ Lafortune <ruby-core-mailing-list AT marc-andre.ca>
+ [ruby-core:41772].
+
+ * iseq.c (iseq_free, prepare_iseq_build): bookkeeping.
+
+ * test/ruby/test_keyword.rb: add tests for keyword arguments.
+
+ * test/ripper/dummyparser.rb (class DummyParser): temporal fix for
+ ripper test.
+
+Mon Dec 26 22:00:17 2011 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * node.h, node.c, parse.y: implement a parser part for keyword
+ arguments.
+ This is a preparation for keyword argument (see [ruby-core:40290]).
+
+ * gc.c (gc_mark_children): bookkeeping.
+
+Mon Dec 26 21:03:18 2011 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * node.h, parse.y (new_args_gen), compile.c (iseq_set_arguments): use
+ struct rb_args_info instead of NODEs.
+ This is a preparation for keyword argument (see [ruby-core:40290]).
+
+ * node.c (dump_node), gc.c (gc_mark_children, obj_free): bookkeeping.
+
+Mon Dec 26 20:59:51 2011 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * node.h, parse.y (lambda, f_larglist): remove NEW_LAMBDA hack.
+ This is a preparation for keyword argument (see [ruby-core:40290]).
+
+Mon Dec 26 22:01:19 2011 Hiroshi Shirosaki <h.shirosaki@gmail.com>
+
+ * io.c (rb_sys_fail_path): move the definition.
+ Move above for using it in set_binary_mode_with_seek_cur().
+
+ * io.c (set_binary_mode_with_seek_cur): fix improper seek cursor.
+ Seeking file cursor with setting binary mode has possibility to
+ cause infinite loop. Fixed the bug and refined error handling.
+ Introduced at r34043.
+
+ And cleanups as below.
+ Remove unnecessary parentheses of `fptr`.
+ Use return value of setmode().
+
+ * test/ruby/test_io_m17n.rb
+ (TestIO_M17N#test_seek_with_setting_binmode): add a test for above.
+ [ruby-core:41671] [Bug #5714]
+
+Mon Dec 26 17:01:14 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * common.mk (LIBRUBY_A): depends on main.o since r33774.
+ [ruby-core:41786] [Bug #5796]
+
+Mon Dec 26 13:07:08 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_io.rb (TestIO#test_autoclose): Tempfile.new doesn't
+ accept the block argument.
+
+Mon Dec 26 13:06:52 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/test/unit.rb: Avoid zombie processes on "--separate" option
+ added at r34121.
+
+Mon Dec 26 04:01:23 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_cipher.c: Update and complete documentation.
+
+Sun Dec 25 23:16:11 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * test/testunit/test_parallel.rb (test_separate): Test for "--separate"
+ option (r34121)
+
+Sun Dec 25 22:39:49 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/test/unit.rb (_run_parallel):
+ New option "--separate" for test/unit; when running tests with this
+ option, a job process will be restarted after one test file has done.
+ This means all test files will run with separated process.
+
+ * lib/test/unit/parallel.rb: Fix for above. Now parallel.rb puts
+ "ready!" for first ready, "ready" for afters.
+
+Sun Dec 25 00:02:15 2011 Luis Lavena <luislavena@gmail.com>
+
+ * configure.in: change --with-ntver to --with-winnt-ver to be more
+ descriptive in the context. [ruby-core:41794]
+
+Sat Dec 24 23:25:15 2011 Luis Lavena <luislavena@gmail.com>
+
+ * configure.in: add --with-ntver option to match win32/configure.bat
+ functionality. Set 0x0501 as default. [ruby-core:35010]
+ [ruby-core:35035]
+
+Sat Dec 24 12:38:53 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * proc.c (proc_call): get rid of optimization-out by clang.
+
+ * proc.c (rb_proc_call, rb_proc_call_with_block): ditto.
+
+Sat Dec 24 10:56:32 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/readline/readline.c (readline_readline): check if outstream
+ is closed to get rid of a bug of readline 6. [ruby-dev:45043]
+ [Bug #5803]
+
+Sat Dec 24 06:59:49 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/readline/test_readline.rb (test_line_buffer__point): use
+ lambda not to exit entire method by "return". or "next" for
+ proc. [ruby-dev:45042] [Bug #5802]
+
+Sat Dec 24 01:20:39 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * vm_eval.c (send_internal): PASS_PASSED_BLOCK_TH must be placed
+ just before calling rb_call0.
+
+ * bootstraptest/test_flow.rb: add a test for above.
+
+Sat Dec 24 00:55:16 2011 Tanaka Akira <akr@fsij.org>
+
+ * lib/tempfile.rb (Tempfile#initialize): warn if a block is given.
+
+Fri Dec 23 16:14:30 2011 TAKAO Kouji <kouji@takao7.net>
+
+ * ext/readline/readline.c (readline_attempted_completion_function):
+ in Readline module with GNU Readline 6 case, Readline module
+ resets completion_append_character to " ", after it executes
+ completion. So, Readline module stores
+ completion_append_character, and Readline module always sets it
+ after Readline module executes completion. [ruby-dev:43456]
+ [Feature #4635]
+
+Fri Dec 23 15:59:05 2011 TAKAO Kouji <kouji@takao7.net>
+
+ * ext/readline/readline.c (Init_readline): libedit check
+ rl_getc_function only when rl_initialize() is called, and
+ using_history() call rl_initialize(). This assignment should be
+ placed before using_history(). [ruby-core:40641] [Bug #5539]
+
+Fri Dec 23 10:14:47 2011 Tanaka Akira <akr@fsij.org>
+
+ * test/thread/test_queue.rb (test_thr_kill): show the number of loop
+ run when the test failed.
+
+Fri Dec 23 09:23:48 2011 Tanaka Akira <akr@fsij.org>
+
+ * test/test_pty.rb (test_pty_check_default): call PTY.check until
+ "cat" command is finished.
+
+Fri Dec 23 06:03:00 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * common.mk: add "check succeeded" message.
+
+ * README, README.ja: follow above change.
+
+Fri Dec 23 06:00:39 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * ext/bigdecimal/bigdecimal.h: add satisfy cc-mode comment.
+ * util.c: ditto.
+
+Fri Dec 23 00:08:25 2011 Tanaka Akira <akr@fsij.org>
+
+ * test/test_pty.rb (test_pty_check_default): "cat" may not terminated
+ in the 0.1 second.
+
+Thu Dec 22 23:37:25 2011 Tanaka Akira <akr@fsij.org>
+
+ * test/ruby/test_thread.rb (test_condvar_timed_wait): don't test the
+ maximum sleep time. Ruby is not a real-time system.
+
+Thu Dec 22 22:37:45 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * thread_pthread.c (ping_signal_thread_list): remove return value.
+ * thread_pthread.c (check_signal_thread_list): add a new function to
+ check if signal thread list is empty.
+ * thread_pthread.c (thread_timer): check signal thread list after
+ timer_thread_function(). main thread might be added into signal thread
+ list during timer_thread_function().
+
+Thu Dec 22 00:40:24 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * ext/bigdecimal/bigdecimal.c (VpMult, VpCtoV, VpSqrt): remove assigned
+ but unused variables.
+
+Wed Dec 21 18:28:22 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * common.mk (newline.c, miniprelude.c): revert r33949 because the change
+ broke mswin build, and the changer said no reason about the change.
+ [ruby-dev:45016] [Bug #5783]
+
+Wed Dec 21 12:35:24 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_s_allocate): follow
+ Allocation Framework. [Bug #5775]
+
+Wed Dec 21 02:25:36 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/emitter.c: fixing clang warnings. Thanks Joey!
+
+Wed Dec 21 01:06:00 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * ext/bigdecimal/README: Update redmine.ruby-lang.org to bugs.ruby-lang.org
+ * ext/socket/ancdata.c: ditto
+ * test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb: ditto
+ * test/syck/test_yaml.rb: ditto
+ * doc/ChangeLog-1.9.3: ditto
+
+Tue Dec 20 23:50:12 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * PStore content update perf optimization. Patch by Masaki Matsushita.
+ See #5248.
+
+ * lib/pstore.rb (save_data):
+
+ * Delete inadequate Marshal check.
+
+ * Deferred file truncation: when writing the new content, truncate
+ the saved file to the data size after writing the data, instead of
+ truncating whole bytes before writing data.
+
+ * Deferred MD5 calculation: when comparing MD5 hash to check the
+ content modification, calculate MD5 hash of new data iif the
+ content length is differ from the old one.
+
+ * Compare content size with String#bytesize instead of String#size.
+
+Tue Dec 20 21:00:30 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: uses to_integer instead.
+ * test/date/test_switch_hitter.rb: added a test.
+
+Tue Dec 20 15:04:18 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * Make sure to clear $! when ignoring an exception
+
+ * ext/openssl/ossl.c (ossl_pem_passwd_cb0, ossl_verify_cb):
+ pem_passwd_cb and verify_cb ignores the exception raised in a
+ callback proc so it should clear $! for subsequent execution.
+
+ That's said, both subsequent processes for pem_passwd_cb and
+ verify_cb raises another exception before leaking $! to Ruby world.
+ We cannot test this fix in Ruby land.
+
+ * test/openssl/test_pkey_rsa.rb
+ (test_read_private_key_pem_pw_exception): Test for pem_passwd_cb +
+ exception.
+
+Tue Dec 20 11:49:13 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/date/test_date_base.rb (test_jd): tests for
+ [ruby-dev:45008].
+
+Tue Dec 20 10:20:48 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/date/date_core.c (wholenum): fix the type of the return value.
+
+Tue Dec 20 05:03:24 2011 Eric Hodel <drbrain@segment7.net>
+
+ * README.ja: Update redmine.ruby-lang.org to bugs.ruby-lang.org
+ * README: ditto
+ * common.mk: ditto
+ * man/erb.1: ditto
+ * man/irb.1: ditto
+ * man/ri.1: ditto
+ * man/ruby.1: ditto
+ * sparc.c: ditto
+ * tool/install-sh: ditto
+
+Tue Dec 20 02:15:18 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: [ruby-dev:45008].
+
+Sun Dec 18 18:52:37 2011 Naohisa Goto <ngotogenome@gmail.com>
+
+ * vm.c (vm_define_method): improve guard of iseq from GC. Fix
+ failure or segmentation fault in test_singleton_method(TestGc)
+ on sparc Solaris10 compiled with Oracle Solaris Studio 12.2.
+ [Bug #5762] [ruby-dev:45000] [Bug #4178]
+
+Sun Dec 18 14:34:31 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/bigdecimal/bigdecimal.c (Init_bigdecimal): does not follow
+ allocation framework right now. [ruby-core:41710] [Bug #5773]
+
+Sun Dec 18 12:42:48 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/to_ruby.rb: BigDecimals can be restored
+ from YAML.
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: BigDecimals can be dumped
+ to YAML.
+ * test/psych/test_numeric.rb: tests for BigDecimal serialization
+
+Sun Dec 18 12:03:13 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/scalar_scanner.rb: Strings that look like dates
+ should be treated as strings and not dates.
+
+ * test/psych/test_scalar_scanner.rb: corresponding tests.
+
+Sun Dec 18 09:43:21 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * test/thread/test_queue.rb (test_thr_kill): extend timeout.
+ this test takes a long time at slow machine.
+
+Sun Dec 18 09:36:51 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * test/ruby/envutil.rb (invoke_ruby): remove :timeout option before
+ pass it to Kernel#spawn.
+
+Fri Dec 16 17:18:38 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * README, README.ja: 'make check' is preferable to 'make test'.
+
+Thu Dec 15 23:16:13 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * error.c (builtin_type_name): don't return pointer to the buffer of
+ temporary String object.
+
+Thu Dec 15 17:56:58 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (argf_type): make typed data.
+
+Thu Dec 15 17:40:28 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * error.c (rb_check_type): fix typo.
+
+Thu Dec 15 14:48:35 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/strscan/strscan.c: use typed data with
+ onig_region_memsize().
+
+Thu Dec 15 14:33:33 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * error.c (rb_check_typeddata): refine error message with
+ including expected struct name.
+
+Thu Dec 15 13:15:51 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * regcomp.c (onig_region_memsize): implemented for memsize_of().
+
+ * ext/objspace/objspace.c (memsize_of): use it.
+
+Thu Dec 15 10:44:54 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (rb_ary_reject_bang, rb_ary_delete_if): update rdoc.
+ documentation from Thomas Leitner <t_leitner AT gmx.at> in
+ [ruby-core:41616]. [Bug #5752]
+
+Thu Dec 15 10:10:43 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/ruby/test_require.rb (test_race_exception): get rid of
+ not-guaranteed timing issue. [ruby-core:41655] [Bug #5754]
+
+Wed Dec 14 21:58:42 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_io_m17n.rb
+ (TestIO_M17N#test_{read_with_binmode_and_get[cs]}): only for Windows.
+
+Wed Dec 14 19:57:23 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * common.mk,Makefile.in,win32/Makefile.sub (ECHO1): move platform
+ specific hack from common.mk to Makefile.in (and win32/Makefile.sub).
+ [Bug #5711]
+
+ * lib/mkmf.rb: we can generate Makefile as we like.
+
+Wed Dec 14 19:22:33 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c, include/ruby/win32.h (rb_w32_fd_is_text): new function.
+
+ * win32/win32.c (init_stdhandle): set default mode of stdin as binmode.
+
+ * io.c (set_binary_mode_with_seek_cur): new function to replace
+ SET_BINARY_MODE_WITH_SEEK_CUR macro. now returns previous mode of the
+ fd and take care of LF in rbuf.
+
+ * io.c (do_writeconv): set text mode when needed.
+
+ * io.c (io_read): need to change the mode of the IO to binmode
+ temporally when the length for IO#read, because IO#read with length
+ must behave so.
+
+ * test/ruby/test_io_m17n.rb (TestIO_M17N#test_{read_with_length,
+ read_with_length_binmode,get[cs]_and_read_with_binmode,
+ read_with_binmode_and_get[cs],read_write_with_binmode}): tests for
+ above changes.
+
+ all patches are written by Hiroshi Shirosaki. [ruby-core:41496]
+ [Feature #5714]
+
+Wed Dec 14 15:28:31 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * transcode.c (str_encode): about the extension of :fallback
+ option since 1.9.3.
+
+Wed Dec 14 12:19:59 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * load.c (load_unlock): release loading barrier and then remove it
+ from loading_table if it is not in-use. [Bug #5754]
+
+ * thread.c (rb_barrier_release, rb_barrier_destroy): return
+ whether any other threads are waiting on it.
+
+Wed Dec 14 11:23:45 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * thread_pthread.c (ubf_select): call rb_thread_wakeup_timer_thread()
+ only when it is not timer_thread. [Bug #5757] [ruby-dev:44985]
+ patched by Tomoyuki Chikanaga.
+
+Wed Dec 14 10:20:08 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * load.c (load_lock): delete the loading barrier if it has been
+ destroyed.
+
+ * thread.c (rb_barrier_wait): return nil for recursive lock
+ instead of false, to distinguish it from destroyed barrier.
+
+Wed Dec 14 01:24:55 2011 okkez <okkez000@gmail.com>
+
+ * thread_pthread.c (rb_thread_create_timer_thread): fix memory
+ leak. [ruby-dev:44904] [Bug #5688]
+
+Wed Dec 14 00:01:15 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (primary): point method name line. [ruby-core:40936]
+ [Bug #5614]
+
+Tue Dec 13 23:43:48 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * error.c (name_err_mesg_to_str): clear rb_thread_t::errinfo when
+ ignore exception under rb_protect(). [ruby-core:41612] [Bug #5755]
+
+ * test/ruby/test_exception.rb (test_exception_in_name_error_to_str):
+ add a corresponding test.
+
+Tue Dec 13 16:13:29 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * load.c (load_unlock): all threads requiring one file should
+ share same loading barrier, so it must be kept alive while those
+ are waiting on it. [ruby-core:41618] [Bug #5754]
+
+Tue Dec 13 07:30:14 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * lib/webrick/httpresponse.rb (setup_header): 1xx responses
+ are allowed to have Keep-Alive connections.
+
+ * test/webrick/test_httpresponse.rb: corresponding test.
+
+Tue Dec 13 07:13:28 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * lib/webrick/httpresponse.rb (setup_header): 204 and 304 responses
+ are allowed to have a Keep-Alive connection. [ruby-core:41581]
+
+ * test/webrick/test_httpresponse.rb: corresponding test.
+
+Tue Dec 13 06:29:39 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (parser_magic_comment): should pass the proper value.
+ [ruby-dev:44984][Bug #5753]
+
+Tue Dec 13 05:50:07 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_yield_setup_block_args): splat single
+ argument if optional arguments are defined not only mandatory or
+ post arguments. [ruby-core:41557] [Bug #5730]
+
+Mon Dec 12 22:35:39 2011 Shugo Maeda <shugo@ruby-lang.org>
+
+ * parse.y (stmt_or_begin): changed the error message for BEGIN not
+ at toplevel. [ruby-dev:44963] [Bug #5738]
+
+Mon Dec 12 17:29:01 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * README: Fixed SupportedPlatforms URL in the README.
+ patched by eMxyzptlk. https://github.com/ruby/ruby/pull/62
+
+Mon Dec 12 17:26:51 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * load.c (rb_feature_p): lazy assigned load_path searched in
+ loading_table were not expanded, but all features, pushed to
+ loading table, are expanded. a patch by Yura Sokolov
+ <funny.falcon AT gmail.com> in [ruby-core:41545]. [Bug #5727]
+
+Mon Dec 12 15:41:03 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/stringio/stringio.c (strio_truncate): fix typo. patched by
+ Nick Howard <ndh AT baroquebobcat.com>.
+ https://github.com/ruby/ruby/pull/65
+
+Sun Dec 11 12:19:17 2011 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb: includes the sequence number of UID in a error
+ message. suggested by art lussos.
+ [ruby-core:41413] [Feature #5692]
+
+Sun Dec 11 11:42:10 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * ext/syslog/syslog.c: fix a typo. [ruby-core:41585] [Bug #5740]
+
+Sun Dec 11 10:48:16 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * error.c (exit_initialize): deal with true and false as well as
+ Kernel#exit. [ruby-dev:44951] [Bug #5728]
+
+Sun Dec 11 10:37:47 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * object.c (rb_check_to_int): new function to convert a VALUE to
+ an Integer if possible, but returns nil instead of raising an
+ exception otherwise.
+
+Sun Dec 11 10:34:39 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * process.c (rb_exit_status_code): extract from rb_f_exit_bang and
+ rb_f_exit. assume 0 to be success in Kernel#exit! too.
+
+Fri Dec 9 19:24:31 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * enc/trans/iso-8859-16-tbl.rb: add ISO-8859-16 converter.
+
+ * enc/trans/single_byte.trans: ditto.
+
+Fri Dec 9 14:28:40 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * file.c (file_path_convert): don't convert it when the path string is
+ ascii only. [ruby-core:41556] [Bug #5733]
+ tests are contributed by nobu.
+
+Fri Dec 9 08:00:15 2011 Luis Lavena <luislavena@gmail.com>
+
+ * include/ruby/win32.h: undef stat to silence mingw-w64 stat
+ redefinition warnings (GCC 4.6.3).
+
+Thu Dec 8 23:38:24 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * variable.c (set_const_visibility): clear inline-cache when constant's
+ visibility is modified. [ruby-dev:44929]
+
+ * test/ruby/test_module.rb (test_private_constants_clear_inlinecache):
+ add test for it.
+
+Thu Dec 8 23:26:11 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/extmk.rb (extract_makefile): should sort after map, not before
+ it. in this case there is no difference, but we should write better
+ code. this bad smell was caught by nagachika.
+
+Thu Dec 8 22:31:13 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/extmk.rb (extract_makefile): need to sort the array of current
+ srcs before comparing to the sorted old srcs.
+ fixed the problem that the configuring stage of exts were always
+ run, introduced at r33801.
+
+Thu Dec 8 13:26:24 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/rexml/test_order.rb (OrderTester#test_more_ordering): use
+ Zlib::GzipReader.open instead of Zlib::GzipReader.new with File.new.
+ fixed a test error on Windows introduced at r33946.
+
+Thu Dec 8 13:11:26 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_process.rb (TestProcess#test_sete[gu]id): silently
+ skip if not implemented such functions (such as, on Windows).
+ fixed test errors on Windows introduced at r33953.
+
+Thu Dec 8 12:57:50 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/socket/extconf.rb: forgotten to define HAVE_SOCKETPAIR for
+ windows.
+ fixed test errors on Windows introduced at r33947.
+
+Thu Dec 8 12:11:06 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (RUBY_WERROR_FLAG): append all warning flags which
+ are enabled to compile, so that printf format modifiers properly
+ fail. [ruby-core:41351] [Bug #5679]
+
+Thu Dec 8 07:20:15 2011 Eric Hodel <drbrain@segment7.net>
+
+ * doc/re.rdoc: Document difference between match and =~, options with
+ Regexp.new and global variables. Patch by Sylvain Daubert.
+ [Ruby 1.9 - Bug #5709]
+
+Thu Dec 8 06:53:10 2011 Eric Hodel <drbrain@segment7.net>
+
+ * doc/re.rdoc: Fix example code to match documentation. Patch by
+ Jarno Lamberg. [Ruby 1.9 - Bug #5624]
+
+Wed Dec 7 19:04:22 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (rpath): fix typo in the help string. a patch from
+ Yuji Yamano <yyamano AT kt.rim.or.jp> in [ruby-list:48568].
+
+Wed Dec 7 18:55:56 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm.c (vm_set_top_stack, vm_set_eval_stack): check for stack
+ overflow with stack_max before push new frame. [ruby-core:41520]
+ [Bug #5720]
+
+ * vm.c (vm_set_main_stack): no stack overflow chances after
+ vm_set_eval_stack().
+
+Wed Dec 7 09:58:15 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/bigdecimal/bigdecimal.c: Document +@, -@, hash, INFINITY, Nan.
+ Patch by Sylvain Daubert. [Ruby 1.9 - Feature #5622]
+
+Wed Dec 7 09:48:00 2011 Eric Hodel <drbrain@segment7.net>
+
+ * io.c (Init_IO): Mention io/console methods. [Ruby 1.9 - Bug #5602]
+ * ext/io/console/console.c: Mention that io/console must be required
+ similar to lib/time.rb
+
+Wed Dec 7 08:04:31 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych.rb (module Psych): parse and load methods take
+ an optional file name that is used when raising Psych::SyntaxError
+ exceptions
+ * ext/psych/lib/psych/syntax_error.rb (module Psych): allow nil file
+ names and handle nil file names in the exception message
+ * test/psych/test_exception.rb (module Psych): Tests for changes.
+
+Tue Dec 6 18:26:33 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/dbm.c: use db_version() instead of DB_VERSION_STRING to
+ detect runtime Berkeley DB version.
+ use dpversion instead of _QDBM_VERSION to detect runtime QDBM
+ version.
+ [ruby-dev:44948]
+
+Tue Dec 6 12:30:41 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/extconf.rb: detect gdbm_version in libgdbm.
+
+ * ext/dbm/dbm.c: make DBM::VERSION more informative for gdbm, qdbm and
+ Berkeley DB 1.x. [ruby-dev:44944]
+
+Tue Dec 6 07:26:37 2011 Eric Hodel <drbrain@segment7.net>
+
+ * range.c: Improve documentation for Range. Patch by Chris Zetter.
+ [Ruby 1.9 - Bug #5656]
+
+Mon Dec 5 19:08:04 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * regparse.c (PFETCH_READY): separate gcc specific trick.
+
+Mon Dec 5 19:01:59 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * process.c (proc_seteuid_m): fix argument.
+
+ * test/ruby/test_process.rb (test_geteuid): fix typo.
+
+ * test/ruby/test_process.rb (test_getegid, test_set[eg]uid): add.
+
+Mon Dec 5 18:56:55 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (big_rshift), compile.c (validate_label,
+ iseq_build_from_ary_exception), cont.c (cont_capture), dir.c
+ (dir_open_dir), gc.c (objspace_each_objects), io.c (pipe_open)
+ (rb_io_advise), parse.y (parser_compile_string)
+ (rb_parser_compile_file), proc.c (binding_free), process.c
+ (rb_proc_exec_n, rb_seteuid_core, proc_setegid, rb_setegid_core)
+ (p_uid_exchange, p_gid_exchange), regparse.c (strdup_with_null),
+ signal.c (sig_dfl), vm.c (rb_iseq_eval, rb_iseq_eval_main),
+ vm_insnhelper.c (vm_expandarray): suppress
+ unused-but-set-variable warnings.
+
+ * class.c (rb_obj_methods), compile.c (iseq_compile_each),
+ iseq.c(iseq_load, rb_iseq_parameters), pack.c (pack_pack),
+ regcomp.c (is_not_included, update_string_node_case_fold),
+ transcode.c (rb_econv_open0, make_replacement),
+ vm_eval.c (raise_method_missing): remove unused variable.
+
+ * signal.c (reserved_signal_p): static.
+
+Mon Dec 5 14:27:23 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * include/ruby/{subst.h,win32.h}, ext/socket/rubysocket.h: revert
+ r33876. [ruby-core:41475] [Bug #5706]
+
+ * ext/socket/extconf.rb: the alternative hack for [Bug #5675].
+
+Mon Dec 5 10:18:45 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/zlib/zlib.c (rb_gzreader_initialize): revert a part of r33937.
+ 1st, to change the mode of an IO is very sensitive problem, so
+ the maintainer of this library should judge it.
+ 2nd, usually Zlib::GzipReader.new is not called directly. #initialize
+ is called via .open, and in the method the I/O is opened in binary
+ mode, so there is no problem without changing the mode in #initialize.
+
+Sun Dec 4 22:53:12 2011 Tanaka Akira <akr@fsij.org>
+
+ * lib/tempfile.rb: don't use lock directory. [ruby-dev:39197]
+
+Sun Dec 4 22:34:43 2011 Tanaka Akira <akr@fsij.org>
+
+ * lib/tempfile.rb (Tempfile::MAX_TRY): remove unused constant.
+
+Sun Dec 4 12:11:28 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * lib/pp.rb: fix rdoc.
+
+Sun Dec 4 12:03:16 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/delegate.rb (Delegator#methods): Kernel#methods receives
+ zero or one argument. [ruby-core:37118] [Bug #4882]
+
+Sun Dec 4 10:15:00 2011 Luis Lavena <luislavena@gmail.com>
+
+ * ext/zlib/zlib.c (rb_gzreader_initialize): use binary mode by default
+ under Windows. Patch by Hiroshi Shirosaki. [ruby-core:40706]
+ [Feature #5562]
+
+ * include/ruby/encoding.h (void rb_econv_binmode): define NEWLINE
+ decorator.
+
+ * io.c (rb_cloexec_fcntl_dupfd): Introduce NEED_READCONV and
+ NEED_WRITECONV to replace universal newline decorator by CRLF only
+ when required to improve file reading and writing under Windows.
+ Patch by Hiroshi Shirosaki. [ruby-core:40706] [Feature #5562]
+ * io.c (do_writeconv): adjust binary mode if required.
+ * io.c (read_all, appendline, swallow, rb_io_getline_1): ditto.
+ * io.c (io_getc, rb_io_each_codepoint, rb_io_ungetc): ditto.
+ * io.c (rb_io_binmode, rb_io_ascii8bit_binmode): ditto.
+ * io.c (rb_io_extract_modeenc, rb_sysopen): ditto.
+ * io.c (pipe_open, prep_stdio, io_encoding_set): ditto.
+ * io.c (rb_io_s_pipe, copy_stream_body): ditto.
+
+ * test/ruby/test_io_m17n.rb (EOT): add test for pipe and stdin in
+ binary mode.
+
+ * win32/win32.c (init_stdhandle): remove O_BINARY from stdhandle
+ initialization.
+ * win32/win32.c (rb_w32_write): use FTEXT mode accordingly.
+
+Sat Dec 3 20:49:16 2011 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * variable.c (set_const_visibility): print a warning when no argument
+ is passwd to Module#private_constant. [ruby-list:48558]
+
+ * vm_method.c (set_method_visibility): ditto for
+ Module#private_class_method.
+
+Sat Dec 3 20:43:14 2011 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * variable.c (set_const_visibility): Module#private_constant has
+ changed the visibility of only the first argument. Now it changes
+ all of them. [ruby-list:48558]
+
+ * test/ruby/test_module.rb: add a test for above.
+
+Sat Dec 3 07:17:29 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * Makefile.in (CFLAGS): append ARCH_FLAG.
+
+ * configure.in (ARCH_FLAG): exclude from CFLAGS.
+
+ * configure.in (UNIVERSAL_INTS): include short int. fix for
+ test/mkmf.
+
+Fri Dec 2 15:48:08 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/bigdecimal/bigdecimal.c (VpAllocReal): reduce extra frac.
+
+Fri Dec 2 15:41:24 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: check whether -pie or -Wl,-pie is valid as
+ LDFLAGS. [ruby-core:41438] [Bug#5697]
+
+ * configure.in: use $linker_flag for LDFLAGS option which is not
+ limited to particular platforms.
+
+Thu Dec 1 23:21:58 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * thread_pthread.c (thread_timer): call prctl(PR_SET_NAME) only if
+ PR_SET_NAME is available.
+
+Thu Dec 1 22:31:16 2011 Tanaka Akira <akr@fsij.org>
+
+ * io.c (linux_get_maxfd): change local variable name.
+
+Thu Dec 1 16:59:24 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/socket/extconf.rb: add arguments for macro calls.
+ [ruby-core:41370] [Bug#5681]
+
+Thu Dec 1 16:20:16 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (MakeMakefile#try_func): fix broken patch at r33834.
+
+Thu Dec 1 14:43:17 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/bigdecimal/bigdecimal.h (Real): suppress false warning from
+ clang. [ruby-core:41418] [Bug#5693]
+
+Thu Dec 1 10:31:55 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (LDFLAGS): -fstack-protector is always needed to
+ link static library created with it. [ruby-core:41387]
+ [Bug#5686]
+
+Thu Dec 1 07:03:51 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in: add sys/prctl.h test.
+ * thread_pthread.c (thread_timer): call prctl(PR_SET_NAME) to change
+ thread name. It may help to debug.
+
+Wed Nov 30 23:35:45 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * variable.c (rb_path2class): don't raise NameError when the middle
+ constant of the path is not defined but defined on toplevel.
+ [ruby-core:41410] [Bug #5691]
+
+Wed Nov 30 20:02:02 2011 Martin Duerst <duerst@it.aoyama.ac.jp>
+
+ * transcode.c: Simplified rb_econv_binmode, avoided a warning on cygwin.
+
+Wed Nov 30 08:57:07 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/mkmf.rb: Use MakeMakefile's rm_f to avoid conflict with Rake or
+ FileUtils.
+ * test/ruby/test_module.rb: Hide MakeMakefile's inclusion in Object
+
+Wed Nov 30 09:12:43 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * lib/rdoc/encoding.rb (RDoc::Encoding.read_file): fixup newline chars
+ on Windows.
+ see https://github.com/rdoc/rdoc/issues/87
+
+ * test/rdoc/test_rdoc_markup_pre_process.rb
+ (TestRDocMarkupPreProcess#test_include_file,
+ TestRDocMarkupPreProcess#test_include_file_encoding_incompatible):
+ follow above change.
+
+Wed Nov 30 09:09:37 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/parser.c (parse): parse method can take an option file
+ name for use in exception messages.
+ * test/psych/test_parser.rb: corresponding tests.
+
+Tue Nov 29 09:07:59 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/mkmf.rb: Fix indentations of constants at end of module.
+ Document some constants.
+
+Tue Nov 29 09:58:23 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (rb_write_error2): suppress unused variable warning.
+
+Tue Nov 29 07:45:26 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/mkmf.rb: Wrap comments to 78 columns and clean up formatting.
+
+Tue Nov 29 05:54:18 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/mkmf.rb: Wrap mkmf.rb in module MakeMakefile to clean up Object
+ documentation. [Ruby 1.9 - Feature #5658]
+ * ext/extmk.rb: Use MakeMakefile::CONFIG instead of Object::CONFIG
+ * test/mkmf/base.rb: ditto
+
+Tue Nov 29 00:08:57 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * common.mk (INSTRUBY_ARGS): added --mantype to apply mdoc2man.rb
+ to man pages. Fixes #5598.
+ (do-install-nodoc, do-install-local, do-install-man,
+ dont-install-nodoc, dont-install-local, dont-install-man):
+ No longer needs --mantype.
+
+ Reported by Rainer Orth <ro AT cebitec.uni-bielefeld.de>,
+ patch by George Koehler <xkernigh AT netscape.net>.
+
+Mon Nov 28 22:26:31 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/rake/test_rake_directory_task.rb
+ (TestRakeDirectoryTask#test_directory_win32): shouldn't create any
+ file/directory on root directory. create on @tempdir (= Dir.pwd).
+ see https://github.com/jimweirich/rake/issues/91
+
+Mon Nov 28 12:57:29 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (rb_write_error2): fwrite() returns ssize_t.
+
+Mon Nov 28 12:47:19 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * parse.y (nodetype, nodeline): static. these functions are for
+ debugging, and not intend to be public.
+
+Mon Nov 28 12:37:54 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * gc.c (initial_params): static. it seems to be forgotten at r33501.
+
+Mon Nov 28 12:32:24 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * include/ruby/win32.h, win32/win32.c (GetCurrentThreadHandle): remove
+ unused old API.
+
+Mon Nov 28 12:29:20 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/mkexports.rb (Exports#initialize): remove old symbol name.
+
+Mon Nov 28 12:15:28 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/mkexports.rb (Exports#read_substitution): need to read
+ from subst.h too. [Bug #5675]
+
+Mon Nov 28 11:46:35 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * io.c (rb_io_flush): release GVL during fsync() on Windows.
+
+Mon Nov 28 11:00:25 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * include/ruby/subst.h: typo of r33876.
+
+Mon Nov 28 10:36:00 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/subst.h: moved Windows specific substitutions from
+ win32.h.
+
+ * ext/socket/rubysocket.h: include ruby/subst.h. [Bug #5675]
+
+Mon Nov 28 10:20:58 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/{Makeilfe.sub,win32.c} (FILE_COUNT, FILE_READPTR): move the
+ definitions from config.h to win32.c. I dared to have left such
+ macros, for other future compiler support.
+ [ruby-core:41313] [Bug #5674]
+
+Mon Nov 28 09:28:30 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_uchmod): typo. [Bug#5671] [ruby-dev:44898]
+
+ * test/ruby/test_file.rb (TestFile#test_chmod_m17n): test of above bug.
+
+Sun Nov 27 21:25:33 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in: added -fno-strict-overflow. it suppress annoying
+ -Wstrict-overflow warning.
+
+Sun Nov 27 20:58:02 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (rb_write_error2): get rid of warning on linux. fwrite
+ of glibc is tagged __attribute__ ((__warn_unused_result__))
+ if _FORTIFY_SOURCE != 0.
+ * vm_dump.c (rb_vm_bugreport): ditto.
+
+Sun Nov 27 19:09:02 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (stack_protector): disable on mingw. [Bug#5676]
+
+ * Makefile.in (DLDFLAGS): also needs -fstack-protector.
+ [Bug#5676]
+
+Sun Nov 27 14:13:33 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in: add -fstack-protector into XLDFLAGS as well as
+ XCFLAGS if stack-protector is used.
+
+Sun Nov 27 13:09:25 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in: workaround to avoid MacOS X build error.
+ Maybe autoconf 2.61 is slightly buggy. [ruby-core:41316]
+
+Sun Nov 27 04:57:11 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * configure.in (--no-undefined): r33840 breaks FreeBSD and DragonFly
+ with gcc 4.4 or later. Their environ is in /usr/libexec/ld-elf.so.1,
+ so it will be false negative.
+
+Sun Nov 27 04:55:45 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/http.rb (Net::HTTP::SSL_IVNAMES): rerefix 33701.
+ SSL_ATTRIBUTES stores names for set_params, they are symbol.
+ SSL_IVNAMES stores instance variable names.
+
+Sun Nov 27 00:16:07 2011 Tanaka Akira <akr@fsij.org>
+
+ * io.c (copy_stream_body): use 0666 for permission argument for open.
+ [ruby-core:40865]
+
+Sat Nov 26 23:01:38 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * test/openssl/test_engine.rb: remove side effect of generic engine
+ load by explicitly loading software-based "openssl" engine for
+ all tests.
+
+Sat Nov 26 20:41:48 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/http.rb (Net::HTTP.get_response): enable use_ssl
+ if given URI object is https.
+ patched by Mark Ferlatte [ruby-core:40665] [Bug #5545]
+
+ * lib/net/http.rb (Net::HTTP.post_form): ditto.
+
+Sat Nov 26 20:01:18 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/http.rb (Net::HTTP::SSL_ATTRIBUTES): refix 33701.
+ store instance variable symbol names.
+
+Sat Nov 26 15:40:25 2011 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * .travis.yml (script): should be ./configure
+
+Sat Nov 26 15:39:18 2011 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * .travis.yml (before_script): wrong name, sorry.
+
+Sat Nov 26 15:31:34 2011 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * .travis.yml (before-script): autoconf required.
+
+Sat Nov 26 15:24:05 2011 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * .travis.yml: Travis enable.
+
+Sat Nov 26 10:47:50 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/extconf.rb: remove checks for available functions.
+ * ext/openssl/missing.h: ditto.
+ Thanks, Tim Mooney for reporting this!
+ [Bug #5432] [ruby-core:40088]
+
+Sat Nov 26 10:22:28 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_ssl.c: add comment on where to find implementation
+ of OpenSSL::SSL::SSLSocket#session.
+
+Sat Nov 26 05:00:25 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (--no-undefined): RUBY_TRY_CFLAGS does nothing for
+ linker flags. use RUBY_TRY_LDFLAGS.
+
+Fri Nov 25 11:37:07 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (ioctl_narg_len, linux_iocparm_len): reinstantiate linux
+ specific narg length calculation.
+ * test/ruby/test_io.rb (test_ioctl_linux2): add new test for old and
+ unstructured ioctl.
+
+Fri Nov 25 10:39:14 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * Makefile.in (EXTLDFLAGS): export it.
+ * configure.in: add --no-undefined if --enable-shared is specified.
+ Gentoo enabled this option long time. Also, export EXTLDFALGS.
+
+Fri Nov 25 08:48:35 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in: turn on PIE if --enable-shared is not specified.
+
+Fri Nov 25 08:05:07 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in: add -fstack-protector. It help to protect us from
+ stack smashing attack.
+
+Fri Nov 25 08:03:28 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in: add -D_FORTIFY_SOURCE=2. It provide some compile
+ time and runtime check for security.
+
+Fri Nov 25 08:00:23 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * lib/mkmf.rb: get rid of warnings of mkmf.rb if -Wmissing-declarations
+ and/or -Wold-style-definition warnings if specified.
+ Patch by Nikolai Weibull. Thank you! [Bug #5459] [ruby-core:40200]
+
+Fri Nov 25 07:46:09 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in: add -Wall always.
+
+Thu Nov 24 20:02:40 2011 Tanaka Akira <akr@fsij.org>
+
+ * test/openssl/test_engine.rb: use IO#reopen to restore stderr.
+
+Thu Nov 24 19:59:56 2011 Tanaka Akira <akr@fsij.org>
+
+ * io.c (rb_io_reopen): re-initialize buffering mode for stdout and
+ stderr.
+
+Thu Nov 24 11:12:48 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (rb_io_fsync,rb_io_fdatasync): release GVL during fsync().
+ fsync() and fdatasync() may take a long time on slow disks and/or
+ if there is much dirty data.
+ Patch by Eric Wong. [Feature #5665] [ruby-core:41247]
+
+Thu Nov 24 10:05:02 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * test/openssl/test_engine.rb: Suppress output from 'openssl'
+ engine's RC4 cipher.
+ [Bug #5633] [ruby-core:41026]
+
+Thu Nov 24 08:05:02 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_pkey_dsa.c: remove redundant colon from error
+ message.
+ * ext/openssl/ossl_ssl.c: ditto.
+ * ext/openssl/ossl_pkey_rsa: ditto.
+ patched by Eric Hodel [Bug #5604] [ruby-core:40896]
+
+Wed Nov 23 20:03:43 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * io.c (ioctl_narg_len): don't use _IOC_SIZE macro on Linux.
+ On Linux some constants for ioctl(2) doesn't include the size of
+ its return value and 16bit value; for example FIONREAD 0x541B.
+ Moreover the manual, ioctl_list(2), says "Note that the size
+ bits are very unreliable: in lots of cases they are wrong,
+ either because of buggy macros using sizeof(sizeof(struct)),
+ or because of legacy values."
+ So we shouldn't use it.
+
+Tue Nov 22 18:07:32 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (_pioinfo): need to declare _pioinfo() before using
+ _osfhnd and other macros which uses _pioinfo() internally.
+
+Tue Nov 22 17:49:45 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/win32.c (_pioinfo): make an inline function.
+
+Tue Nov 22 11:26:08 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+Tue Nov 22 11:33:58 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/win32.c (dupfd): argument of _osfhnd and so on should not
+ have side effect.
+
+Tue Nov 22 11:26:08 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * bignum.c (rb_big_divide): refix of r33536. Don't change behavior of Bignum#/.
+ [ruby-core:40429] [Bug #5490]
+
+Tue Nov 22 10:46:57 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * numeric.c (ruby_float_step): improve floating point calculations.
+ [ruby-core:35753] [Bug #4576]
+
+ * numeric.c (ruby_float_step): correct the error of floating point
+ numbers on the excluding case.
+ patched by Masahiro Tanaka [ruby-core:39608]
+
+ * numeric.c (ruby_float_step): use the end value when the current
+ value is greater than or equal to the end value.
+ patched by Akira Tanaka [ruby-core:39612]
+
+Tue Nov 22 06:59:21 2011 Tanaka Akira <akr@fsij.org>
+
+ * test/ruby/test_io.rb (test_fcntl_dupfd): there is no known platform
+ which don't have F_DUPFD. [ruby-dev:44874]
+
+Tue Nov 22 04:46:22 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych.rb: remove autoload from psych
+ * ext/psych/lib/psych/json.rb: ditto
+
+Tue Nov 22 00:44:59 2011 Tanaka Akira <akr@fsij.org>
+
+ * test/ruby/test_io.rb (test_fcntl_dupfd): the argument of F_DUPFD is
+ minimum file descriptor.
+
+Tue Nov 22 00:25:17 2011 Tanaka Akira <akr@fsij.org>
+
+ * io.c (linux_get_maxfd): get rid of a warning.
+
+Mon Nov 21 23:39:14 2011 Tanaka Akira <akr@fsij.org>
+
+ * io.c (linux_get_maxfd): new function to find maximum fd on Linux.
+ (rb_close_before_exec): use linux_get_maxfd.
+
+Mon Nov 21 06:16:24 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * cont.c (fiber_switch): ignore fiber context switch
+ because destination fiber is same as current fiber.
+ With out this, it may segv on FreeBSD 9.
+ patched by Koichi Sasada.
+
+Sun Nov 20 23:22:42 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/extmk.rb (extract_makefile, extmake): regenerate makefiles
+ if globbed source file list is changed.
+
+ * lib/mkmf.rb (create_makefile): store ORIG_SRCS.
+
+Sun Nov 20 22:43:03 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * enc/unicode.c (PROPERTY_NAME_MAX_SIZE): +1.
+ reported by Ken Takata. [ruby-dev:44894][Bug #5652]
+
+Sun Nov 20 11:01:28 2011 Tanaka Akira <akr@fsij.org>
+
+ * lib/set.rb (SortedSet.setup): remove old_init after initialize
+ method is redefined. The remove before redefinition makes the
+ warning prevention fragile. [ruby-dev:44892]
+
+Sun Nov 20 04:01:45 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * Makefile.in (enc/unicode/name2ctype.h): remove duplicated
+ ifdefs.
+
+Sat Nov 19 19:31:47 2011 Tanaka Akira <akr@fsij.org>
+
+ * time.c (TIME_COPY_GMT): copy vtm.utc_offset and vtm.zone too.
+ patch by Tomoyuki Chikanaga.
+ [ruby-dev:44827] [Bug #5586]
+
+Sat Nov 19 16:36:57 2011 Tanaka Akira <akr@fsij.org>
+
+ * test/net/http/test_http.rb: remove temporally files in ensure clause.
+
+Sat Nov 19 08:18:41 2011 Tanaka Akira <akr@fsij.org>
+
+ * test/net/http/test_http.rb: remove temporally files.
+
+Fri Nov 18 17:18:16 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/io/console/console.c (console_raw, console_set_raw)
+ (console_getch): optional parameters. [EXPERIMENTAL]
+
+Fri Nov 18 16:12:11 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/io/console/console.c (console_cooked, console_set_cooked):
+ new methods to reset cooked mode. [EXPERIMENTAL]
+
+Fri Nov 18 13:20:26 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/unit/assertions.rb (MINI_DIR): quick dirty hack to get rid of
+ warnings when using assert/assert_respond_to.
+
+Fri Nov 18 13:03:38 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * io.c (rb_cloexec_open): set O_NOINHERIT instead of O_CLOEXEC if it is
+ available (for Windows).
+
+ * win32/win32.c (fcntl): on F_DUPFD, determine the inheritance of the
+ new handle by O_NOINHERIT flag of original fd.
+
+Fri Nov 18 08:00:41 2011 Ryan Davis <ryand-ruby@zenspider.com>
+
+ * lib/minitest/*: Imported minitest 2.8.1 (r6750)
+ * test/minitest/*: ditto
+ * configure.in: Improved gcc-llvm error message to help people migrate.
+
+Thu Nov 17 20:43:34 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/extconf.rb: revert a part of the patch in [ruby-dev:41531].
+ don't use db.h with other headers. [ruby-dev:44884].
+
+Thu Nov 17 20:23:03 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * benchmark/bm_io_select[23].rb: use Process::RLIMIT_NOFILE only when
+ it is defined. if it is not defined, assume 64 as the max of fds.
+
+Thu Nov 17 10:36:46 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych.rb (load_file): make sure opened yaml files are
+ also closed. [ruby-core:41088]
+
+Wed Nov 16 18:13:52 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * Makefile.in (LIBRUBY_A): check if generated linked library is
+ valid for extconf.
+
+Wed Nov 16 13:51:40 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * bignum.c (rb_big2ulong): need to calc in unsigned long, because
+ the range of VALUE is larger than it on LLP64 platform, such as Win64.
+ this change fixes the failures of test/-ext-/num2int.
+
+Wed Nov 16 12:02:47 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/webrick/test_cgi.rb (TestWEBrickCGI#start_cgi_server): there are
+ no guarantee of existence of RbConfig::CONFIG['LIBPATHENV'].
+ it only exists in Unix-like environments.
+
+ * test/webrick/test_filehandler.rb
+ (WEBrick::TestFileHandler#test_script_disclosure): ditto.
+
+Wed Nov 16 11:34:20 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * io.c (argf_next_argv): wrong timing of setting ecflags.
+ fixed the failure of TestArgf#test_textmode introduced at r33662.
+
+Wed Nov 16 10:45:00 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/-test-/num2int/num2int.c: remove an unnecessary and wrong decl
+ of rb_stdout. it's declared in ruby.h correctly.
+
+Wed Nov 16 10:26:41 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * bignum.c (rb_big2ull): add a cast to get rid of a VC++ warning.
+
+Wed Nov 16 09:39:27 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/minitest/unit.rb (assert_raises): experimental fix to run
+ correctly on chkbuild over 64bit linux. call exception_details only
+ when the detail is really needed to avoid create needless inspect
+ under ulimit-ed environment.
+
+Wed Nov 16 06:34:30 2011 Tanaka Akira <akr@fsij.org>
+
+ * test/ruby/test_thread.rb (test_condvar_timed_wait): use
+ assert_operator.
+
+Tue Nov 15 21:56:25 2011 Tanaka Akira <akr@fsij.org>
+
+ * test/ruby/test_sleep.rb (test_sleep_5sec): 0.1sec tolerance is too
+ small for busy environment.
+
+Tue Nov 15 20:08:55 2011 Tanaka Akira <akr@fsij.org>
+
+ * io.c, thread.c, ext/pty/pty.c, ext/fiddle/closure.c: use
+ __linux__ macro for consistency.
+
+Tue Nov 15 14:45:15 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * include/ruby/ruby.h(NUM2LONG, NUM2INT, NUM2SHORT, NUM2LL,
+ INT2NUM, UINT2NUM, LONG2NUM, ULONG2NUM, NUM2CHR): wrap by
+ macros.
+
+Tue Nov 15 13:38:14 2011 Naohisa Goto <ngotogenome@gmail.com>
+
+ * include/ruby/defines.h (FLUSH_REGISTER_WINDOWS): move sparc asm code
+ to a separate file sparc.c for preventing inlining optimization.
+ Patched by Jurij Smakov. [Bug #5244] [ruby-core:40685]
+ * sparc.c (rb_sparc_flush_register_windows): ditto.
+ * configure.in: ditto.
+
+Tue Nov 15 13:11:35 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * include/ruby/ruby.h: get rid of gcc specific rb_long2int(),
+ NUM2LONG(), NUM2INT(), NUM2SHORT(), NUM2LL(), INT2NUM(),
+ UINT2NUM(), LONG2NUM(), ULONG2NUM() and NUM2CHR()
+ implementation. Because 1) They don't make any better code
+ at all. 2) Inline function have a better debugger supoort.
+
+Tue Nov 15 09:58:25 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_io.rb (TestIO#test_fcntl_dupfd): fix OpenBSD test
+ failure. [ruby-dev:44872]
+
+Tue Nov 15 09:50:21 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * regcomp.c (print_indent_tree): fix double printing of ENCLOSE_OPTION
+ children bug. patched by Suraj Kurapati. [ruby-core:40964]
+
+Tue Nov 15 01:53:48 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * test/ruby/test_io.rb (test_fcntl_dupfd): fix test error on
+ SnowLeopard. Pointed out by CHIKANAGA Tomoyuki. [ruby-dev:44866]
+
+Mon Nov 14 22:06:02 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/openssl/ossl_pkey.c (ossl_pkey_new_from_file): set close-on-exec
+ flag.
+
+ * ext/openssl/ossl_x509cert.c (rb_fd_fix_cloexec): ditto.
+
+Mon Nov 14 14:54:17 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * bignum.c (rb_big2ull): fix 32bit platform breakage. we must
+ not assume sizeof(VALUE) == sizeof(LONG_LONG).
+ * test/-ext-/num2int/test_num2int.rb (class TestNum2int):
+ fix false assumption on 32bit platform.
+
+Mon Nov 14 14:52:54 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * numeric.c (rb_fix2ushort): fix typo. use num rb_num2ushort()
+ instead of num2uint().
+
+Sun Nov 13 10:31:03 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * include/ruby/ruby.h: add #ifdef comment.
+
+Sun Nov 13 10:28:18 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * include/ruby/ruby.h: add NUM2SHORT(), NUM2USHORT() macros.
+ * numeric.c: ditto.
+
+ * test/-ext-/num2int/test_num2int.rb: add testcases for NUM2SHORT().
+ * ext/-test-/num2int/num2int.c: ditto.
+
+Sun Nov 13 10:23:48 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * bignum.c (rb_big2ull): fix off-by-twice bug of NUM2ULL.
+ * test/-ext-/num2int/test_num2int.rb (class TestNum2int):
+ fix a testcase too.
+
+Sun Nov 13 10:22:44 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/-ext-/num2int/test_num2int.rb (class TestNum2int):
+ add FIXNUM tests.
+
+Sun Nov 13 09:57:29 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * numeric.c (check_uint): fix off-by-one bug of NUM2UINT.
+ * bignum.c (rb_big2ulong): fix off-by-one bug of NUM2ULONG.
+
+ * test/-ext-/num2int/test_num2int.rb: add a testcase for NUM2INT()
+ NUM2UINT(), NUM2LONG(), NUM2ULONG(), NUM2LL and NUM2ULL().
+ * ext/-test-/num2int/depend: ditto.
+ * ext/-test-/num2int/extconf.rb: ditto.
+ * ext/-test-/num2int/num2int.c: ditto.
+
+Sun Nov 13 23:47:29 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/dbm/extconf.rb: use convertible_int.
+
+Sun Nov 13 23:45:57 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (checking_for): should not modify the result.
+
+ * lib/mkmf.rb (have_struct_member): accept compiler options.
+
+ * lib/mkmf.rb (convertible_int): add restricted support of struct
+ member, and TYPEOF_ macro.
+
+Sun Nov 13 23:21:24 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/gdbm/gdbm.c (fgdbm_reorganize): set close-on-exec flag after
+ gdbm_reorganize(). gdbm_reorganize() opens a new database internally.
+
+Sun Nov 13 19:57:18 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/extconf.rb: rollback for each headers for each libraries.
+
+Sun Nov 13 16:24:48 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/extconf.rb: treat libc as a choice for a library which
+ provide ndbm API.
+
+Sun Nov 13 15:40:43 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/extconf.rb: duplicate $libs and $defs when save them.
+
+Sun Nov 13 12:43:48 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/extconf.rb: rollback $libs and $defs when db detection is
+ failed. It fixes -lgdbm -lqdbm when the system has qdbm and gdbm
+ without gdbm_compat.
+
+Sat Nov 12 21:14:51 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/webrick/test_cgi.rb (class TestWEBrickCGI): respect
+ RbConfig::CONFIG["LIBPATHENV"]. [Bug #5135] [ruby-core:38653]
+ * test/webrick/test_filehandler.rb (class WEBrick): ditto.
+
+Sat Nov 12 20:57:29 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_io.rb (test_fcntl_dupfd): skip if Fcntl::DUPFD
+ is not defined. Pointed out by CHIKANAGA Tomoyuki. Thanks.
+
+Sat Nov 12 17:26:10 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (do_ioctl, ioctl_narg_len, setup_narg, rb_ioctl): use
+ ioctl_req_t.
+
+Sat Nov 12 17:01:49 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/dbm/extconf.rb (headers.db_check): reduce duplicated code.
+
+Sat Nov 12 15:59:42 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/extconf.rb: dbm_clearerr should be available in all ndbm
+ implementation. If it is not available, it is caused by
+ header/library mismatch such that Berkeley DB header & gdbm library.
+
+ * ext/dbm/dbm.c (fdbm_store): use dbm_clearerr() unconditionally.
+ gdbm 1.9 provides it as a real function instead of a empty macro.
+
+Sat Nov 12 13:35:33 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * bootstraptest/runner.rb: don't suppress SIGINT.
+ [Feature #5612] [ruby-dev:44856]
+
+Sat Nov 12 11:20:36 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (fcntl_narg_len): introduce narg calculation for fcntl instead
+ of hard coded 256.
+ * io.c (setup_narg): ditto.
+
+Sat Nov 12 11:19:35 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_io.rb (test_fcntl_dupfd): add another fcntl test.
+
+Sat Nov 12 11:18:17 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/ruby/test_io.rb (test_fcntl_lock_freebsd): add a testcase
+ of fcntl lock for freebsd.
+
+Sat Nov 12 11:16:32 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (ioctl_narg_len): Linux doesn't have IOCPARM_LEN macro, but
+ has _IOC_SIZE. support it.
+
+Sat Nov 12 11:13:18 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (rb_ioctl): don't expose our sanity check value to ruby script.
+ It may change string value meaning if the value is string.
+ (e.g. MacOS X has F_GETPATH ioctl)
+ * io.c (rb_fcntl): ditto.
+
+Sat Nov 12 11:06:02 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (ioctl_req_t): Type of req argument of ioctl() depend on platform.
+ Moreover almost all linux ioctl can't be represented by 32bit integer
+ (i.e. MSB is 1). We need wrap ioctl argument type.
+ [Bug #5429] [ruby-dev:44589]
+ * io.c (struct ioctl_arg): ditto.
+ * io.c (rb_ioctl): ditto.
+ * test/ruby/test_io.rb (test_ioctl_linux): add a testcase for ioctl
+
+Sat Nov 12 11:00:42 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (struct io_cntl_arg): remove io_p member.
+ * io.c (nogvl_fcntl, do_fcntl, rb_fcntl): separated from ioctl functions.
+ * io.c (nogvl_io_cntl): remove fcntl depended logic.
+ * io.c (io_cntl): ditto.
+ * io.c (rb_io_ctl): ditto.
+ * io.c (rb_io_ioctl): ditto.
+
+Sat Nov 12 10:59:49 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (setup_narg): fix off by one bug.
+
+Sat Nov 12 10:56:43 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (+setup_narg): factor out length calculation logic.
+ * io.c (rb_io_ctl): ditto.
+
+Sat Nov 12 10:52:17 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (+ioctl_narg_len) new helper function.
+ * io.c (rb_io_ctl): don't use ioctl specific length check
+ if caller is fcntl.
+
+Fri Nov 11 23:00:46 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/extconf.rb: db_prefix is not required now.
+
+Fri Nov 11 21:13:30 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/gdbm/gdbm.c (fgdbm_initialize): use GDBM_CLOEXEC if available.
+
+Fri Nov 11 21:00:05 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/extconf.rb: fix dbm_pagfno and dbm_dirfno detection with
+ Berkeley DB. Macro definitions needs arguments to detect correctly.
+ SIZEOF_DSIZE needs -DDB_DBM_HSEARCH because db.h defines datum type
+ only if DB_DBM_HSEARCH is defined.
+
+Fri Nov 11 18:41:57 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * process.c (proc_seteuid): separate an internal wrapper function
+ from the method implementation.
+
+Fri Nov 11 17:21:15 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (have_library, find_library, have_func): allow
+ arguments of function to be checked.
+
+Fri Nov 11 17:09:45 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_dump.c (HAVE_BACKTRACE): fallback to 0.
+
+ * vm_dump.c (rb_vm_bugreport): show "Other runtime information"
+ header only when available.
+
+ * vm_dump.c (rb_vm_bugreport): get rid of modifying the content of
+ VM directly.
+
+ * vm_dump.c (rb_vm_bugreport): check if vm is non-null.
+ Pointed out by Ikegami Daisuke <ikegami.da@gmail.com>.
+ Thank you.
+
+Fri Nov 11 12:36:37 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * io.c (pipe_open): Remove fflush(stdin). it's no effect.
+ Pointed out by Ikegami Daisuke <ikegami.da@gmail.com>.
+ Thank you.
+
+Fri Nov 11 07:33:30 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/net/http.rb (Net::HTTP::SSL_ATTRIBUTES): Use symbol keys instead
+ of string keys to avoid duplicating parameters in
+ OpenSSL::SSL:SSLContext#set_params.
+
+Thu Nov 10 15:02:37 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (have_library, have_func, have_var, have_header):
+ add compiler option parameter.
+
+Thu Nov 10 07:45:16 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/openssl/lib/openssl/ssl.rb (class OpenSSL::SSL::SSLContext):
+ Document #set_params.
+
+Wed Nov 9 11:36:53 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c (gvl_yield): don't prevent concurrent sched_yield().
+ [Bug #5130] [ruby-core:38647]
+
+Wed Nov 9 23:20:22 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (rb_update_max_fd): fstat(2) can fail with other than
+ EBADF. [ruby-dev:44837] [Bug #5593]. Cf.
+ http://pubs.opengroup.org/onlinepubs/9699919799/functions/fstat.html
+
+ * io.c (rb_sysopen): max fd is updated in rb_sysopen_internal()
+ already.
+
+Wed Nov 9 22:13:38 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_file.rb (TestFile#test_utime_with_minus_time_segv):
+ fixed previous commit.
+
+Wed Nov 9 19:53:45 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_file.rb (TestFile#test_utime_with_minus_time_segv):
+ add test for r33685.
+
+Wed Nov 9 19:00:44 2011 Koichi Sasada <ko1@atdot.net>
+
+ * test/ruby/test_fiber.rb: add tests for r33684 (Fiber#resume).
+
+Wed Nov 9 16:40:49 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (unixtime_to_filetime): should check the return value
+ of localtime(). reported by snowjail at gmail.com.
+ [ruby-dev:44838] [Bug #5596]
+
+Thu Nov 9 13:17:25 2011 Koichi Sasada <ko1@atdot.net>
+
+ * cont.c (rb_fiber_m_transfer, rb_fiber_resume): prohibit using
+ "resume" after "transfer" method are used. You should not mix
+ "resume" fiber and "transfer" fiber.
+ [Bug #5526]
+
+ * NEWS: add information about this change.
+
+Wed Nov 9 11:40:37 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * template/Doxyfile.tmpl (INCLUDE_PATH): add srcdir and include.
+ [ruby-core:40843] [Bug #5597]
+
+Wed Nov 9 11:02:54 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * thread.c (do_select): fix cast, tv_sec is time_t.
+
+Wed Nov 9 10:32:20 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: should not use test -e for portability.
+ [ruby-core:40841] [Bug #5594]
+
+Wed Nov 9 04:52:16 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/tree_builder.rb: dump complex numbers,
+ rationals, etc with reference ids.
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: ditto
+ * ext/psych/lib/psych/visitors/to_ruby.rb: loading complex numbers,
+ rationals, etc with reference ids.
+ * test/psych/test_object_references.rb: corresponding tests
+
+Tue Nov 8 23:34:37 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/dbm/dbm.c (fdbm_fetch, fdbm_key, fdbm_delete, fdbm_store)
+ (fdbm_has_key, fdbm_has_value): get rid of overflow.
+
+ * ext/gdbm/gdbm.c (rb_gdbm_fetch2, rb_gdbm_nextkey)
+ (rb_gdbm_delete, fgdbm_store, fgdbm_has_key): ditto.
+
+ * ext/dbm/dbm.c (fdbm_delete_if): hide intermediate objects.
+
+ * ext/gdbm/gdbm.c (fgdbm_delete_if): ditto.
+
+ * ext/dbm/extconf.rb: check size of datum.dsize to get rid of
+ overflow.
+
+Tue Nov 8 23:30:21 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * addr2line.c (PATH_MAX): define if not defined. [ruby-core:40840]
+
+Tue Nov 8 23:26:49 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/tk/tcltklib.c (rb_thread_critical): fix type.
+
+ * ext/tk/tcltklib.c (eventloop_sleep, lib_eventloop_core): int is
+ enough for micro seconds. may need to check overflow in the
+ setter though.
+
+ * ext/tk/tcltklib.c (RSTRING_LENINT): check overflow if necessary.
+
+ * ext/tk/tcltklib.c (RbTk_ALLOC_N): wrapper for ckalloc() which
+ takes an int.
+
+ * ext/tk/tcltklib.c (ip_ruby_cmd_receiver_get, tcltklib_compile_info):
+ get rid overflow.
+
+ * ext/tk/tcltklib.c (tcltklib_compile_info): constified.
+
+Tue Nov 8 20:50:45 2011 Tanaka Akira <akr@fsij.org>
+
+ * test/dbm/test_dbm.rb: split tests for read only database.
+
+ * test/gdbm/test_gdbm.rb: ditto.
+
+Tue Nov 8 18:59:07 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/pty/pty.c (MasterDevice): define only when used.
+ (SlaveDevice): ditto.
+ (deviceNo): ditto.
+
+Tue Nov 8 17:59:24 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/ruby.h (rb_long2int): define as a macro always, so
+ that cpp conditionals can tell if it is provided.
+
+Tue Nov 8 17:30:50 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (cpp_command): remove multiple -arch flags since cpp
+ cannot work.
+
+Tue Nov 8 14:50:55 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * io.c (io_fwrite): call rb_w32_write_console() only if FMODE_TTY is
+ set. this is the one of the reason of IO writing slowness of Windows
+ in 1.9.3 or later.
+
+Tue Nov 8 11:01:04 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/pty/pty.c (get_device_once): FreeBSD 8 supported O_CLOEXEC flag
+ for posix_openpt, but FreeBSD 9's posix_openpt doesn't support
+ O_CLOEXEC and fails if specified.
+
+Tue Nov 8 02:36:45 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * include/ruby/encoding.h (ECONV_NEWLINE_DECORATOR_READ_MASK,
+ ECONV_NEWLINE_DECORATOR_WRITE_MASK): new macro.
+
+ * io.c (rb_io_extract_modeenc, pipe_open, prep_stdio, argf_next_argv):
+ set TEXTMODE_NEWLINE_DECORATOR_ON_WRITE for textmode on creating IO
+ if the flag is available.
+
+ * io.c (make_writeconv): drop decorators for reading.
+
+ * io.c (make_readconv): drop decorators for writing.
+
+ * io.c (do_writeconv): existing writeconv is not the condition to raise
+ ArgumentError. should check textmode or not.
+
+ * test/ruby/test_io_m17n.rb
+ (TestIO_M17N#test_{cr,lf,crlf}_decorator_on_stdout): test above
+ changes.
+
+Mon Nov 7 22:03:47 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/gdbm/gdbm.c (fgdbm_initialize): set close-on-exec flag.
+
+Mon Nov 7 20:31:52 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/scalar_scanner.rb: make sure strings that look
+ like base 60 numbers are serialized as quoted strings.
+ * test/psych/test_string.rb: test for change.
+
+Mon Nov 7 20:26:37 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * test/psych/test_yamlstore.rb: make test case inherit from MiniTest,
+ load psych/helper so that psych is loaded.
+
+Mon Nov 7 20:18:29 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * test/psych/test_yamldbm.rb: Test case should inherit from MiniTest,
+ load psych/helper so that psych and friends are loaded.
+
+Mon Nov 7 20:15:44 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/extconf.rb: check dbm_pagfno() and dbm_dirfno().
+
+ * ext/dbm/dbm.c: use above to set close-on-exec flag.
+
+Mon Nov 7 20:05:16 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * io.c (io_fflush): remove fsync().
+
+ * io.c (rb_io_flush, rb_io_rewind): fsync() here.
+
+ these changes reduces fsync() calls to improve performance.
+ first reported at [ruby-list:48515] by ak7 at mail.goo.ne.jp .
+ [Bug #5585]
+
+Mon Nov 7 19:43:10 2011 Tanaka Akira <akr@fsij.org>
+
+ * io.c (rb_close_before_exec): use F_MAXFD if available.
+ F_MAXFD is available on NetBSD since NetBSD 2.0.
+
+Mon Nov 7 19:25:16 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_io_m17n.rb
+ (TestIO_M17N#test_default_stdout_stderr_mode): new test for
+ r33627-33629. see [backport #5565]
+
+Mon Nov 7 01:14:22 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * lib/debug.rb: add help for 'pp' and 'r[estart]'. patch
+ from Sho Hashimoto. [Bug #5093] [ruby-dev:44222]
+
+Sun Nov 6 14:49:58 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/rubysocket.h (rsock_recvmsg): declared.
+
+ * ext/socket/ancdata.c (rsock_recvmsg): extracted from
+ nogvl_recvmsg_func.
+ (nogvl_recvmsg_func): use rsock_recvmsg.
+
+ * ext/socket/unixsocket.c (recvmsg_blocking): use rsock_recvmsg.
+
+Sun Nov 6 03:22:36 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * test/openssl/test_engine.rb: add test for engine cipher. RC4 is used
+ because AES is not supported by the "openssl" engine currently.
+
+Sun Nov 6 00:11:52 2011 Tanaka Akira <akr@fsij.org>
+
+ * lib/test/unit.rb (Test::Unit::Options#non_options): options[:ruby]
+ should be an array. This fixes
+ "./ruby test/runner.rb test/testunit/test_parallel.rb"
+ [ruby-dev:44782]
+
+Sat Nov 5 20:30:30 2011 Martin Duerst <duerst@it.aoyama.ac.jp>
+
+ * insns.def: Some fixes and tweaks to English explanations
+
+Sat Nov 5 19:11:50 2011 Tanaka Akira <akr@fsij.org>
+
+ * io.c (rb_cloexec_fcntl_dupfd): don't clear try_dupfd_cloexec if
+ fcntl(F_DUPFD) failed as fcntl(F_DUPFD_CLOEXEC).
+
+Sat Nov 5 18:05:12 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/socket.c (rsock_socketpair0): refactored.
+
+Sat Nov 5 17:55:52 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/init.c (rsock_socket0): don't clear try_sock_cloexec if
+ SOCK_CLOEXEC is not a reason for EINVAL.
+
+Sat Nov 5 16:27:52 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * ext/pathname/lib/pathname.rb, ext/tk/lib/multi-tk.rb,
+ ext/tk/sample/demos-en/widget, lib/benchmark.rb, lib/irb/cmd/fork.rb,
+ lib/mkmf.rb, lib/net/ftp.rb, lib/net/smtp.rb, lib/open3.rb,
+ lib/pstore.rb, lib/rexml/element.rb, lib/rexml/light/node.rb,
+ lib/rinda/tuplespace.rb, lib/rss/maker/base.rb,
+ lib/rss/maker/entry.rb, lib/scanf.rb, lib/set.rb, lib/shell.rb,
+ lib/shell/command-processor.rb, lib/shell/process-controller.rb,
+ lib/shell/system-command.rb, lib/uri/common.rb: remove unused block
+ arguments to avoid creating Proc objects.
+
+Sat Nov 5 15:45:04 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/init.c (rsock_socket0): extract single socket() call with
+ CLOEXEC handling from rsock_socket.
+
+Sat Nov 5 13:49:40 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * lib/pathname.rb (Pathname#find): return an enumerator if
+ no block is given.
+
+ * test/pathname/test_pathname.rb: add tests for above.
+
+ [ruby-dev:44797] [Feature #5572]
+
+Sat Nov 5 11:18:12 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/socket.c (rsock_socketpair0): don't clear
+ try_sock_cloexec if SOCK_CLOEXEC is not a reason for EINVAL.
+
+Fri Nov 4 14:08:19 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * ext/openssl/ossl_pkey_rsa.c (rsa_generate): [SECURITY] Set RSA
+ exponent value correctly. Awful bug. This bug caused exponent of
+ generated key to be always '1'. By default, and regardless of e
+ given as a parameter.
+
+ !!! Keys generated by this code (trunk after 2011-09-01) must be
+ re-generated !!! (ruby_1_9_3 is safe)
+
+ * test/openssl/test_pkey_rsa.rb: Add tests for default exponent and
+ specifying exponent by a parameter.
+
+Fri Nov 4 01:31:25 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * test/openssl/test_engine.rb: add first tests for builtin "openssl"
+ engine.
+
+Fri Nov 4 08:41:26 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/extconf.rb:
+ * ext/openssl/ossl_engine.c: add some missing OpenSSL engines.
+ Thanks, Yui Naruse, for providing the patch!
+ [Bug #5548] [ruby-core:40670]
+
+Fri Nov 4 04:54:10 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/configure.bat: disable delayed expansion of enironment variable.
+ [Bug #5517] [ruby-core:40531]
+
+Fri Nov 4 03:45:22 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * io.c (make_writeconv): fixed typo of previous commit.
+
+Fri Nov 4 01:56:30 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * io.c (make_writeconv): unversal_newline converter is for reading.
+ so, if the io is text mode and has ECONV_UNIVERSAL_NEWLINE_DECORATOR
+ flag, use crlf_newline converter for writing.
+ this change fixes the problem about the luck of CR up Kernel.p and
+ Kernel.puts to stdout/stderr on Windows.
+
+Fri Nov 4 01:04:48 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/readline/readline.c (Init_readline): like r18313, libedit's
+ replace_history_entry may use offset instead of which.
+ so introduce history_replace_offset_func and initialize it.
+
+ * ext/readline/readline.c (hist_set): use history_replace_offset_func.
+
+Fri Nov 4 00:53:35 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/readline/readline.c (Init_readline): fix wrong condition.
+
+Thu Nov 3 23:53:04 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * encoding.c (rb_locale_charmap): ignore calling nl_langinfo_codeset()
+ on Windows except cygwin. [experimental]
+
+Thu Nov 3 22:45:09 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/socket.c (rsock_socketpair0): extracted from
+ rsock_socketpair to set close-on-exec flag for each socketpair()
+ call.
+
+Thu Nov 3 22:12:41 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * ext/socket/init.c (rsock_socket): set close-on-exec flag when
+ SOCK_CLOEXEC is not available.
+
+Thu Nov 3 08:36:00 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * test/openssl/test_engine.rb: call Engine::cleanup on exit.
+ Patch provided by Yui Naruse, thanks!
+ [Bug #5547] [ruby-core:40669]
+
+Wed Nov 2 21:36:00 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * complex.c (nucomp_rationalize): fix function. [ruby-core:40667]
+ [Bug #5546]
+
+Wed Nov 2 08:16:45 2011 Tanaka Akira <akr@fsij.org>
+
+ * lib/webrick/utils.rb: fix fcntl call.
+
+ * lib/drb/unix.rb: ditto.
+
+Wed Nov 2 00:43:59 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * test/psych/test_yamldbm.rb: avoid platform dependency.
+ patch by Naohisa Goto. [ruby-dev:44763] [Bug #5535]
+ * test/syck/test_yamldbm.rb: ditto.
+
+Wed Nov 2 00:14:15 2011 Shugo Maeda <shugo@ruby-lang.org>
+
+ * test/ruby/test_marshal.rb: renamed methods duplicated with those
+ of marshaltestlib.rb.
+
+Tue Nov 1 22:08:27 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: reject llvm-gcc.
+
+Tue Nov 1 21:39:00 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * io.c (rb_cloexec_pipe): remove workaround of r33587.
+ The bug of NetBSD is fixed on Mon Oct 31 21:31:29 UTC 2011.
+ http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=45545
+
+Tue Nov 1 19:49:08 2011 Tanaka Akira <akr@fsij.org>
+
+ * io.c (rb_io_reopen): call rb_fd_fix_cloexec instead of
+ rb_maygvl_fd_fix_cloexec.
+
+Tue Nov 1 19:00:30 2011 Tanaka Akira <akr@fsij.org>
+
+ * io.c (rb_io_reopen): call rb_maygvl_fd_fix_cloexec after freopen().
+
+Tue Nov 1 17:17:26 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * file.c (file_expand_path): reset coderange after expanding path.
+
+Tue Nov 1 14:55:29 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * io.c (nogvl_io_cntl): rb_cloexec_fcntl_dupfd's 2nd argument is int.
+
+ * process.c (move_fds_to_avoid_crash): ditto.
+
+Tue Nov 1 13:14:33 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * vsnprintf.c (BSD_vfprintf): support 'll' prefix.
+
+ * vsnprintf.c (__sfeof): rename to avoid the collision with NetBSD's
+ one.
+
+ * vsnprintf.c (__sferror): ditto.
+
+ * vsnprintf.c (__sclearerr): ditto.
+
+ * vsnprintf.c (__sfileno): ditto.
+
+Tue Nov 1 12:36:16 2011 Tanaka Akira <akr@fsij.org>
+
+ * internal.h (rb_maygvl_fd_fix_cloexec): change the visibility for
+ ext/socket.
+
+Tue Nov 1 12:00:53 2011 Tanaka Akira <akr@fsij.org>
+
+ * io.c (rb_maygvl_fd_fix_cloexec): renamed from fd_set_cloexec.
+
+ * internal.h (rb_maygvl_fd_fix_cloexec): declared.
+
+ * ext/socket/init.c (cloexec_accept): use rb_maygvl_fd_fix_cloexec.
+ (rsock_s_accept_nonblock): use rb_update_max_fd.
+ (rsock_s_accept): use rb_update_max_fd.
+
+Tue Nov 1 08:24:40 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/init.c (cloexec_accept): new function to use accept4 if
+ available.
+ (rsock_s_accept_nonblock): use cloexec_accept.
+ (accept_blocking): ditto.
+
+ * ext/socket/extconf.rb: check accept4.
+
+Tue Nov 1 07:31:55 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/ancdata.c (nogvl_recvmsg_func): use MSG_CMSG_CLOEXEC if
+ available.
+
+ * ext/socket/unixsocket.c (recvmsg_blocking): ditto.
+
+Tue Nov 1 05:59:41 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/socket.c (rsock_socketpair): use SOCK_CLOEXEC if
+ available.
+
+Tue Nov 1 02:56:17 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ruby.c (load_file_internal): convert the encoding of load path if
+ needed by platform. calling open() was replaced by rb_cloexec_open()
+ at r33549, but the function expected UTF-8 pathname on Windows.
+ (open() expected "locale" pathname.)
+ reported by taco via IRC.
+
+ * ruby.c (load_file): change the type of the 2nd parameter to pass its
+ encoding to load_file_internal().
+
+ * ruby.c (process_options, rb_load_file): follow above change.
+ NOTE: we should pass encoding information to rb_load_file().
+
+Mon Oct 31 23:49:38 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/socket.c (rsock_socketpair): extracted from
+ rsock_sock_s_socketpair.
+
+Mon Oct 31 23:31:53 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/init.c (rsock_socket): use SOCK_CLOEXEC if available.
+
+Mon Oct 31 21:47:44 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * io.c (rb_cloexec_pipe): NetBSD 6.0 will support pipe2(2),
+ but its return value is -1 or larger than 0.
+
+Mon Oct 31 22:04:54 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/dbm/dbm.c (fdbm_initialize): use O_CLOEXEC if available.
+
+Mon Oct 31 21:47:48 2011 Tanaka Akira <akr@fsij.org>
+
+ * include/ruby/intern.h (rb_fd_fix_cloexec): renamed from
+ rb_fd_set_cloexec.
+
+ * io.c: follow the above renaming.
+
+ * ext/pty/pty.c: ditto.
+
+ * ext/socket/init.c: ditto.
+
+ * ext/socket/socket.c: ditto.
+
+ * ext/socket/ancdata.c: ditto.
+
+ * ext/socket/unixsocket.c: ditto.
+
+Mon Oct 31 21:02:43 2011 Tanaka Akira <akr@fsij.org>
+
+ * lib/resolv.rb (Resolv::DNS): retry IO.select for premature wakeup.
+
+Mon Oct 31 20:14:22 2011 Tanaka Akira <akr@fsij.org>
+
+ * io.c (fd_set_cloexec): clear CLOEXEC flag for standard file
+ descriptors.
+ (rb_cloexec_dup): use rb_cloexec_fcntl_dupfd.
+ (rb_cloexec_fcntl_dupfd): use F_DUPFD_CLOEXEC if available.
+
+Mon Oct 31 19:14:11 2011 Tanaka Akira <akr@fsij.org>
+
+ * test/resolv/test_dns.rb: don't check maximum slept time.
+ ruby doesn't guarantee the maximum time because it is not a
+ realtime application.
+
+Mon Oct 31 13:10:06 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (setfl): extract from fcntl().
+
+ * win32/win32.c (dupfd): new function to support F_DUPFD. based on a
+ patch written by akr.
+
+ * win32/win32.c (fcntl): use above functions.
+
+ * include/ruby/win32.h (F_DUPFD): define. [experimental]
+
+ * include/ruby/win32.h (F_SETFL): change the value to correspond with
+ other platforms.
+
+Mon Oct 31 12:37:50 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/pty/pty.c (get_device_once): use O_CLOEXEC for posix_openpt if
+ available.
+
+Mon Oct 31 12:05:24 2011 Tanaka Akira <akr@fsij.org>
+
+ * io.c (rb_cloexec_dup2): check oldfd == newfd at first.
+ pointed by KOSAKI Motohiro. [ruby-dev:44713]
+
+Mon Oct 31 10:50:26 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * io.c (rb_cloexec_fcntl_dupfd): this function needs F_DUPFD.
+
+ * io.c (nogvl_io_cntl): use rb_cloexec_fcntl_dupfd() only if the
+ platform has F_DUPFD.
+
+Mon Oct 31 00:50:00 2011 Luis Lavena <luislavena@gmail.com>
+
+ * configure.in: check -fno-omit-frame-pointer acceptance and usage
+ under MinGW. [ruby-core:39957] [Bug #5407]
+
+Mon Oct 31 00:16:11 2011 Tanaka Akira <akr@fsij.org>
+
+ * include/ruby/intern.h (rb_cloexec_fcntl_dupfd): declared.
+
+ * io.c (rb_cloexec_fcntl_dupfd): new function.
+ (nogvl_io_cntl): use rb_cloexec_fcntl_dupfd.
+
+ * process.c (move_fds_to_avoid_crash): use rb_cloexec_fcntl_dupfd.
+
+Sun Oct 30 22:46:46 2011 Tanaka Akira <akr@fsij.org>
+
+ * configure.in: check pipe2.
+
+ * io.c (rb_cloexec_pipe): use pipe2 if available.
+
+Sun Oct 30 22:32:44 2011 Tanaka Akira <akr@fsij.org>
+
+ * ruby.c (fill_standard_fds): use fstat() instead of fcntl(F_GETFD)
+ for MinGW. reported by Luis Lavena. [ruby-core:40526] [Bug #5516]
+
+Sun Oct 30 21:12:47 2011 Tanaka Akira <akr@fsij.org>
+
+ * include/ruby/intern.h (rb_cloexec_pipe): declared.
+
+ * io.c (rb_cloexec_pipe): new function.
+ (rb_pipe): use rb_cloexec_pipe.
+
+ * thread_pthread.c (rb_thread_create_timer_thread): use
+ rb_cloexec_pipe.
+
+Sun Oct 30 20:06:07 2011 Tanaka Akira <akr@fsij.org>
+
+ * io.c (rb_cloexec_dup): refine control flow.
+ (rb_cloexec_dup2): ditto.
+
+Sun Oct 30 18:45:50 2011 Tanaka Akira <akr@fsij.org>
+
+ * ruby.c (fill_standard_fds): new function to open closed standard
+ file descriptors.
+ (ruby_sysinit): call fill_standard_fds.
+
+Sun Oct 30 10:50:36 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * tool/rbinstall.rb (install_recursive, bin-comm): split mere
+ string not path name. [ruby-core:40462] [Bug #5492]
+
+Sun Oct 30 10:47:20 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (rb_cloexec_dup, rb_cloexec_dup2): CLOEXEC has been set if
+ dup3 succeeded.
+
+Sun Oct 30 09:58:48 2011 Tanaka Akira <akr@fsij.org>
+
+ * io.c (rb_cloexec_dup): don't allocate standard file descriptors.
+
+Sun Oct 30 08:29:51 2011 Tanaka Akira <akr@fsij.org>
+
+ * io.c (rb_cloexec_dup2): don't set CLOEXEC for standard file
+ descriptors.
+
+Sun Oct 30 07:47:10 2011 Tanaka Akira <akr@fsij.org>
+
+ * configure.in: check dup3.
+
+ * io.c (rb_cloexec_dup2): use dup3 if available.
+
+Sat Oct 29 22:06:37 2011 Tanaka Akira <akr@fsij.org>
+
+ * include/ruby/intern.h (rb_cloexec_dup2): declared.
+
+ * io.c (rb_cloexec_dup2): new function.
+ (io_reopen): use rb_cloexec_dup2.
+
+Sat Oct 20 21:08:18 2011 Tajima Akio <artonx@yahoo.co.jp>
+
+ * win32/Makefile.sub (CONFIG_H): have stdint.h if VC2010.
+ [Bug #5243]
+
+Sat Oct 29 20:59:08 2011 Tanaka Akira <akr@fsij.org>
+
+ * io.c (rb_cloexec_dup): use F_DUPFD_CLOEXEC if available.
+
+Sat Oct 29 20:00:26 2011 Tanaka Akira <akr@fsij.org>
+
+ * include/ruby/intern.h (rb_cloexec_dup): declared.
+
+ * io.c (rb_cloexec_dup): new function.
+ (ruby_dup): use rb_cloexec_dup.
+
+ * ext/pty/pty.c (pty_getpty): use rb_cloexec_dup.
+
+ * ext/openssl/ossl_bio.c (ossl_obj2bio): ditto.
+
+Sat Oct 29 16:11:34 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/sdbm/_sdbm.c (sdbm_prep): use O_CLOEXEC if available.
+
+Sat Oct 29 14:26:56 2011 Tanaka Akira <akr@fsij.org>
+
+ * io.c (rb_cloexec_open): use O_CLOEXEC if available.
+
+Sat Oct 29 12:57:15 2011 Tanaka Akira <akr@fsij.org>
+
+ * process.c (ruby_setsid): use rb_cloexec_open.
+ (rb_daemon): ditto.
+
+ * ruby.c (load_file_internal): ditto.
+
+ * file.c (rb_file_s_truncate): ditto.
+ (file_load_ok): ditto.
+
+ * random.c (fill_random_seed): ditto.
+
+ * ext/pty/pty.c (chfunc): ditto.
+ (get_device_once): ditto.
+
+ * ext/io/console/console.c (console_dev): ditto.
+
+Sat Oct 29 10:40:19 2011 Tanaka Akira <akr@fsij.org>
+
+ * include/ruby/intern.h (rb_cloexec_open): declared.
+
+ * io.c (fd_set_cloexec): extracted from rb_fd_set_cloexec.
+ (rb_cloexec_open): new function.
+ (sysopen_func): use rb_cloexec_open.
+ (rb_sysopen_internal): use rb_update_max_fd instead of
+ rb_fd_set_cloexec.
+
+Sat Oct 29 09:05:07 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread_pthread.h: no Structured Exception Handling like macros.
+ [ruby-core:40432] [Bug #5491]
+
+Fri Oct 28 22:05:34 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/sdbm/_sdbm.c: RCS $Id$ removed.
+
+Thu Oct 27 18:58:00 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * parse.y (parser_nextc): set encoding for the buffer of ripper.
+
+Fri Oct 28 06:06:08 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/sdbm/_sdbm.c (sdbm_prep): set FD_CLOEXEC flags for file
+ descriptors.
+ (fd_set_cloexec): new function.
+
+Fri Oct 28 03:01:27 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * vm_insnhelper.c (vm_call_cfunc): adding back useless hack. For some
+ reason, this fixes CFP errors on OS X 10.7.
+
+Fri Oct 28 00:09:31 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/sdbm/_sdbm.c (sdbm_prep): refactored for less nesting.
+
+Thu Oct 27 18:28:18 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (RUBY_DEFINE_IF): revert r33534 partially to get
+ rid of AS_ECHO which is not available in autoconf 2.61.
+ [ruby-dev:44702]
+
+Thu Oct 27 16:10:46 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * bignum.c (rb_big_divide): raise ZeroDivisionError if divisor is
+ zero, as well as Fixnum. [ruby-core:40429] [Bug #5490]
+
+Thu Oct 27 14:56:22 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (RUBY_FUNC_ATTRIBUTE): unset temporary variable.
+
+ * configure.in (RUBY_STACK_GROW_DIRECTION): substitute CPU name as
+ shell variable name. based on the patch by The Written Word Inc. at
+ [ruby-core:40421]. [Bug #5488]
+
+Thu Oct 27 09:57:56 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * include/ruby/ruby.h (SIZE_MAX): define SIZE_MAX if not defined.
+ patched by The Written Word Inc. [ruby-core:40422] [Bug #5489]
+
+Thu Oct 27 08:47:38 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/psych/parser.c: remove unused variable.
+
+Thu Oct 27 08:38:41 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/extconf.rb: add -Wall flag by default when compiler is
+ GCC.
+
+Wed Oct 26 15:24:25 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * file.c (rb_file_join): honor input encodings than ASCII-8BIT.
+ [ruby-core:40338] [Bug #5483]
+
+Tue Oct 25 21:52:31 2011 Tanaka Akira <akr@fsij.org>
+
+ * include/ruby/defines.h: use "__sparc" instead of "sparc" and
+ "__sparc__".
+
+ * dln.c: ditto.
+
+ [ruby-dev:44694]
+
+Tue Oct 25 06:34:39 2011 Eric Hodel <drbrain@segment7.net>
+
+ * re.c (match_aref): Use <code> around indexing examples to prevent
+ hyperlinks. [ruby-talk:389396]
+
+Mon Oct 24 23:55:31 2011 Tanaka Akira <akr@fsij.org>
+
+ * complex.c: use "__sun" instead of "__sun__" to detect SunOS.
+
+ * math.c: ditto.
+
+ * hash.c: ditto.
+
+ * atomic.h: ditto.
+
+ * ext/io/wait/wait.c: ditto.
+
+ [ruby-dev:44693]
+
+Mon Oct 24 22:45:37 2011 Tanaka Akira <akr@fsij.org>
+
+ * io.c: use "__sun" instead of "sun" to detect SunOS.
+
+ * dln.c: ditto.
+
+ * cont.c: ditto.
+
+ * ext/sdbm/_sdbm.c: ditto.
+
+ [ruby-dev:44693]
+
+Mon Oct 24 22:38:08 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/pty/pty.c (get_device_once): delay rb_fd_set_cloexec() until
+ grantpt() on Solaris. grantpt() doesn't work with CLOEXEC on
+ Solaris 10.
+ reported by Naohisa GOTO. [ruby-dev:44688] [Bug #5475]
+
+Mon Oct 24 08:18:14 2011 Tanaka Akira <akr@fsij.org>
+
+ * io.c (copy_stream_fallback_body): check nil for EOF of read method.
+ patch by Eric Wong. [ruby-core:39134] [Bug #5237]
+
+Sun Oct 23 18:21:23 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * ext/tk/MANUAL_tcltklib.eng: fix typo.
+
+Sun Oct 23 18:03:31 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * numeric.c (rb_infinity, rb_nan): aggregated member initializers
+ need braces.
+
+Sun Oct 23 16:43:43 2011 Naohisa Goto <ngotogenome@gmail.com>
+
+ * ext/io/wait/wait.c: ioctl(2) is declared in unistd.h on Solaris.
+
+Sun Oct 23 16:33:35 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * ext/tk/MANUAL_tcltklib.eng: fix typo. reported by Mimura-san.
+ [ruby-dev:44683] [Bug #5471]
+
+Sun Oct 23 08:01:29 2011 Tanaka Akira <akr@fsij.org>
+
+ * io.c (rb_fd_set_cloexec): set close-on-exec flag only if F_GETFD is
+ defined. reported by Luis Lavena. [ruby-core:40281] [Bug #5470]
+
+Sat Oct 22 19:48:50 2011 Tanaka Akira <akr@fsij.org>
+
+ * test/openssl/test_ssl.rb (test_multibyte_read_write): start server
+ for each length to avoid race condition.
+
+Sat Oct 22 18:49:24 2011 Tanaka Akira <akr@fsij.org>
+
+ * include/ruby/intern.h (rb_fd_set_cloexec): declared.
+
+ * io.c (rb_fd_set_cloexec): new function.
+ (ruby_dup): call rb_fd_set_cloexec to set close-on-exec flag.
+ (rb_sysopen_internal): ditto.
+ (rb_pipe): ditto.
+ (io_reopen): ditto.
+ (io_cntl): ditto.
+
+ * process.c (rb_f_exec): change the default :close_others option to
+ true.
+ (rb_f_system): ditto.
+ (move_fds_to_avoid_crash): call rb_fd_set_cloexec to set
+ close-on-exec flag.
+ (ruby_setsid): ditto.
+ (rb_daemon): ditto.
+
+ * thread_pthread.c (rb_thread_create_timer_thread): call
+ rb_fd_set_cloexec to set close-on-exec flag.
+
+ * ruby.c (load_file_internal): ditto.
+
+ * file.c (rb_file_s_truncate): ditto.
+ (file_load_ok): ditto.
+
+ * random.c (fill_random_seed): ditto.
+
+ * ext/pty/pty.c (chfunc): ditto.
+ (get_device_once): ditto.
+
+ * ext/openssl/ossl_bio.c (ossl_obj2bio): ditto.
+
+ * ext/socket/init.c (rsock_socket): ditto.
+ (rsock_s_accept_nonblock): ditto.
+ (rsock_s_accept): ditto.
+
+ * ext/socket/socket.c (rsock_sock_s_socketpair): ditto.
+
+ * ext/socket/ancdata.c (discard_cmsg): ditto.
+ (make_io_for_unix_rights): ditto.
+
+ * ext/socket/unixsocket.c (unix_recv_io): ditto.
+
+ * ext/io/console/console.c (console_dev): ditto.
+
+ [ruby-core:38140] [Feature #5041]
+
+Sat Oct 22 17:46:27 2011 Tanaka Akira <akr@fsij.org>
+
+ * lib/resolv.rb: fix a exception name in previous patch.
+
+Sat Oct 22 17:43:33 2011 Tanaka Akira <akr@fsij.org>
+
+ * lib/resolv.rb: make timeout configurable for DNS query.
+ patch by Eric Wong. [ruby-core:38533] [Feature #5100]
+
+Sat Oct 22 02:07:48 2011 Naohisa Goto <ngotogenome@gmail.com>
+
+ * numeric.c (rb_infinity, rb_nan): use union to prevent bus error
+ caused by misalignment. [Bug #5469] [ruby-dev:44657]
+
+ * include/ruby/missing.h (INFINITY, NAN): ditto
+
+Fri Oct 21 22:02:17 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * gc.c (initial_params): pack in a struct.
+
+ * gc.c (rb_gc_set_params): set parameters always.
+ [ruby-dev:44648] [Bug #5467]
+
+Fri Oct 21 12:10:20 2011 Naohisa Goto <ngotogenome@gmail.com>
+
+ * atomic.h: change Solaris checking macro because atomic_ops can work
+ not only with Sun Studio but also with Fujitsu C Compiler.
+
+Fri Oct 21 02:11:00 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_ns_spki.c: Complete documentation.
+ * test/openssl/test_ns_spki.rb: Integrate SPKI#to_text.
+
+Thu Oct 20 22:47:28 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (socklist_insert, socklist_lookup, socklist_delete):
+ new functions to wrap of st_insert(), st_lookup() and st_delete() to
+ socklist.
+ allocating socklist is deferred until it is really needed.
+
+ * win32/win32.c (exit_handler): delete socklist only if it is
+ initialized.
+
+ * win32/win32.c (rb_w32_sysinit, StartSockets): refactoring: move
+ initialization of select_mutex to StartSockets().
+
+ * win32/win32.c (exit_handler): refactoring: delete select_mutex only
+ if winsock is used.
+
+Thu Oct 20 22:38:53 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_pkcs5.c: add note on timing attacks and general
+ documentation.
+
+Thu Oct 20 21:19:15 2011 Naohisa Goto <ngotogenome@gmail.com>
+
+ * vm_eval.c (check_funcall): set array elements one-by-one to fix
+ compile error with Fujitsu C Compiler 5.6 on Solaris 10 on Sparc.
+ [Bug #5464] [ruby-dev:44632]
+
+Thu Oct 20 13:09:35 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/defines.h (flush_register_windows): use software
+ trap on Debian Sparc 32-bit userspace. [Bug #5244]
+
+Thu Oct 20 12:28:22 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * test/openssl/test_pkcs5.rb: add RFC 6070 tests for PBKDF2 with
+ HMAC-SHA1
+
+Thu Oct 20 11:42:23 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * util.c (mmprepare): fix for fragmental size.
+
+ * util.c (mmswap_, mmrot3_): portability improvement.
+
+Thu Oct 20 05:58:02 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/openssl/ossl_ns_spki.c (Init_ossl_ns_spki): Stub documentation
+ for Netscape SPKI.
+
+Thu Oct 20 05:13:39 2011 Ryan Davis <ryand-ruby@zenspider.com>
+
+ * lib/minitest/*: Imported minitest 2.6.2 (r6712)
+ * test/minitest/*: ditto
+
+Thu Oct 20 06:55:32 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * lib/openssl/buffering.rb: Force multi-byte strings to be treated as
+ binary data.
+ * test/openssl/test_ssl.rb: Add test for it.
+
+ Thanks to Niklas Baumstark for reporting the issue!
+
+ [Ruby 1.9 - Bug #5233] [ruby-core:39120]
+
+Wed Oct 19 17:06:54 2011 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * version.h (RUBY_VERSION): finally declare start of 2.0 work!
+
+Wed Oct 19 11:48:44 2011 Eric Hodel <drbrain@segment7.net>
+
+ * error.c (Init_Exception): Document $! and $@. Provide
+ recommendations for creating exceptions for a library.
+
+Wed Oct 19 11:25:46 2011 Eric Hodel <drbrain@segment7.net>
+
+ * error.c (Init_Exception): Add hierarchy of Exception subclasses.
+ Based on patch by Sylvain Daubert. [Ruby 1.9 - Bug #5438]
+
+Wed Oct 19 11:04:47 2011 Eric Hodel <drbrain@segment7.net>
+
+ * enum.c: Reformat block args to a single standard, { |args| ... }.
+ Patch by b t. [Ruby 1.9 - Bug #5393]
+
+Wed Oct 19 12:11:26 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_ssl.c: Remove set, but unused variables.
+ ext/openssl/ossl_pkey.c: ditto
+
+ * ext/openssl/ossl_pkey_dh.c: Make functions passed to
+ rb_thread_blocking_region return VALUE instead of void.
+ ext/openssl/ossl_pkey_dsa.c: ditto
+ ext/openssl/ossl_pkey_rsa.c: ditto
+
+Tue Oct 18 23:28:53 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * hash.c (identhash): share with type_numhash.
+
+ * st.c (st_hashtype_num): rename from type_numhash.
+
+Tue Oct 18 23:07:30 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_core.h (ruby_current_thread): probeprofiler has been removed
+ long ago.
+
+Tue Oct 18 23:05:49 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/ripper/eventids2.c (ripper_init_eventids2): separate
+ initializations of IDs and objects.
+
+ * ext/ripper/tools/generate.rb (generate_eventids1): ditto.
+
+ * parse.y (Init_ripper, InitVM_ripper): fix inversed roles.
+
+Sun Oct 16 19:46:16 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/bigdecimal/bigdecimal.gemspec (files): fixed typo, and
+ removed nonexistent file.
+
+ * ext/bigdecimal/bigdecimal.gemspec (homepage): added.
+
+ * ext/io/console/io-console.gemspec (homepage): ditto.
+
+Fri Oct 14 12:13:57 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/pty/pty.c (pty_check): should return nil until the child
+ terminates or stops. [ruby-dev:44600] [Bug #2642]
+
+Fri Oct 14 11:19:37 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/intern.h (rb_ary_rotate): export.
+
+Fri Oct 14 05:58:05 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * atomic.h (ATOMIC_INC, ATOMIC_DEC): return old values.
+ [ruby-dev:44596] [Bug #5439]
+
+ * signal.c (ruby_atomic_exchange): no needs to define on the
+ platforms where atomic.h is available.
+
+Thu Oct 13 19:29:40 2011 Naohisa Goto <ngotogenome@gmail.com>
+
+ * atomic.h (ATOMIC_*): use atomic_ops(3C) when SunStudio on Solaris.
+ [ruby-dev:44596] [Bug #5439]
+
+Thu Oct 13 18:13:04 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * atomic.h(ATOMIC_SET): add cast to void to prevent misuse.
+ [ruby-dev:44596] [Bug #5439]
+
+Thu Oct 13 18:04:27 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * gc.c (rb_gc_finalize_deferred, rb_objspace_call_finalizer):
+ should use ATOMIC_EXCHANGE() to check the previous value.
+ [ruby-dev:44596] [Bug #5439]
+
+Wed Oct 12 23:39:58 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * test/openssl/test_ssl.rb: Move duplicated tests for SSL::Session to
+ test_ssl_session.rb
+
+Tue Oct 11 08:49:40 2011 Eric Hodel <drbrain@segment7.net>
+
+ * array.c (rb_ary_initialize): Improve explanation of Array.new
+ parameters. Patch by Alvaro Pereyra Rabanal. [Ruby 1.9 - Bug #5425]
+ * array.c (rb_ary_s_try_convert): Fix typo (try => tries)
+ * array.c (rb_ary_rindex): Add spacing for block.
+ * array.c (rb_ary_uniq_bang): Describe block
+ * array.c (rb_ary_uniq): ditto
+
+Tue Oct 11 07:55:38 2011 Eric Hodel <drbrain@segment7.net>
+
+ * array.c: Add a description to Array, minor cleanups. Patch by
+ Andrea Singh. [Ruby 1.9 - Bug #5412]
+
+Tue Oct 11 06:09:52 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/pp.rb: Move PP documentation to top of class PP. Patch by
+ Sylvain Daubert. [Ruby 1.9 - Bug #5430]
+
+Tue Oct 11 06:06:29 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/coverage/coverage.c (Init_coverage): Change list format and
+ describe Coverage.result output. Patch by Sylvain Daubert.
+ [Ruby 1.9 - Bug #5428]
+
+Tue Oct 11 05:53:23 2011 Eric Hodel <drbrain@segment7.net>
+
+ * object.c (Init_Object): Add reference to BasicObject, brief
+ explanation of constant lookup. Based on patch by Alvaro Pereyra
+ Rabanal.
+ [Ruby 1.9 - Bug #5426]
+
+Sun Oct 9 11:06:52 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * test/psych/test_yamldbm.rb: don't run test if the system
+ don't support yaml/dbm.
+
+ * test/syck/test_yamldbm.rb: ditto.
+
+Sat Oct 8 08:54:56 2011 Eric Hodel <drbrain@segment7.net>
+
+ * enum.c (group_by): Improve group_by description. Patch by b t.
+ [#5411]
+
+Sat Oct 8 03:17:51 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/shell.rb: Document some methods of Shell. Patch by Carol
+ Nichols. [Ruby 1.9 - Bug #5417]
+
+Fri Oct 7 17:54:28 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit/assertions.rb (assert_send, assert_not_send):
+ parenthesize non-empty arguments.
+
+Fri Oct 7 06:35:50 2011 Eric Hodel <drbrain@segment7.net>
+
+ * array.c: Use + for arguments described in documentation to allow
+ rdoc -C2 to work better. Remove <code> from method references to
+ allow cross-references in HTML documentation.
+
+Thu Oct 6 18:46:23 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * vm_eval.c (make_no_method_exception): fix typo.
+
+ * vm_insnhelper.c, vm_insnhelper.h: ditto.
+
+Thu Oct 6 16:29:30 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_eval.c (make_no_method_execption): extract from
+ raise_method_missing().
+
+ * vm_eval.c (send_internal): remove inadvertent symbol creation
+ from public_send. based on a patch by Jeremy Evans <code AT
+ jeremyevans.net> in [ruby-core:38576]. [Feature #5112]
+
+ * vm_insnhelper.c (vm_call_method): remove inadvertent symbol
+ creation from send and __send__, too.
+
+Thu Oct 6 14:59:11 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/time.rb: Clean up Time documentation. Patch by Jake Goulding.
+ [Ruby 1.9 - Bug #5416]
+
+Thu Oct 6 10:00:54 2011 Eric Hodel <drbrain@segment7.net>
+
+ * enum.c (group_by): Improve documentation based on patch by b t.
+
+Thu Oct 6 09:56:30 2011 Eric Hodel <drbrain@segment7.net>
+
+ * enum.c: Clean up wording in Enumerable documentation. Patch by b t.
+ [Ruby 1.9 - Bug #5411]
+
+Thu Oct 6 09:17:18 2011 Eric Hodel <drbrain@segment7.net>
+
+ * time.c (Init_Time): Remove editorial comments from Time
+ documentation, fix link.
+
+Thu Oct 6 09:14:20 2011 Eric Hodel <drbrain@segment7.net>
+
+ * time.c (Init_Time): Improve Time documentation. Patch by Shane
+ Emmons. [Ruby 1.9 - Bug #5404]
+ * lib/time.rb: Improve time.rb documentation including Time.strptime.
+ Patch by Shane Emmons. [Ruby 1.9 - Bug #5402]
+
+Thu Oct 6 08:54:05 2011 Eric Hodel <drbrain@segment7.net>
+
+ * random.c: Improve documentation of Random. Patch by Gregory
+ Parkhurst. [Ruby 1.9 - Bug #5410]
+
+Thu Oct 6 01:44:51 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * cont.c (cont_mark): mark original Thread object from saved_thread.
+ [ruby-dev:44571] [Bug #5386]
+
+Wed Oct 5 16:33:04 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_call_cfunc): remove useless hack.
+
+Wed Oct 5 05:56:39 2011 Eric Hodel <drbrain@segment7.net>
+
+ * hash.c (Init_Hash): Improve Hash documentation. Patch by Alvaro
+ Pereyra Rabanal. [Ruby 1.9 - Bug #5405]
+
+Wed Oct 5 05:47:59 2011 Eric Hodel <drbrain@segment7.net>
+
+ * random.c (Init_Random): Add a top-level comment for Random. Patch
+ by Brett Bim. [Ruby 1.9 - Bug #5403]
+
+Wed Oct 5 02:50:27 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/syntax_error.rb: Add file, line, offset, and
+ message attributes during parse failure.
+ * ext/psych/parser.c: Update parser to raise exception with correct
+ values.
+ * test/psych/test_exception.rb: corresponding tests.
+
+Wed Oct 5 01:52:16 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/parser.c (parse): Use context_mark for indicating error
+ line and column.
+
+Wed Oct 5 01:22:08 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/scalar_scanner.rb: use normal begin / rescue
+ since postfix rescue cannot receive the exception class. Thanks
+ nagachika!
+
+Tue Oct 4 21:10:08 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * class.c (class_alloc): allocate extra memory after containing
+ object setup to get rid of rare-but-potential memory leak.
+
+ * gc.c (gc_mark_children): skip marking extended members if ptr is
+ NULL.
+
+Tue Oct 4 16:17:50 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/time.rb (Time.strptime): use Time.at if d[:seconds] is set.
+ Reported by Christopher Eberz. [ruby-core:39903] Bug #5399
+
+Tue Oct 4 11:44:10 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * gc.c (rb_gc_set_params): ruby_verbose can be Qnil, so use RTEST.
+
+Tue Oct 4 08:33:41 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/etc/etc.c: Document Etc, Etc.sysconfdir, Etc.systmpdir. Patch
+ by mathew murphy. [Ruby 1.9 - Bug #5396]
+
+Tue Oct 4 08:21:51 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/shellwords.rb: Update toplevel comment with an example. Patch
+ by Samnang Chhun. [Ruby 1.9 - Bug #5388]
+
+Tue Oct 4 08:15:50 2011 Eric Hodel <drbrain@segment7.net>
+
+ * proc.c (proc_call): Update documentation to match argument handling
+ of proc/Proc.new/lambda/->()
+
+Tue Oct 4 07:59:16 2011 Eric Hodel <drbrain@segment7.net>
+
+ * proc.c (proc_call): Fix documentation of Proc#call vs Proc#===.
+ [Ruby 1.9 - Bug #5349]
+
+Tue Oct 4 07:43:18 2011 Eric Hodel <drbrain@segment7.net>
+
+ * array.c (rb_ary_initialize): Make Array.new description match
+ call-seq. Patch by Henry Maddocks. [Ruby 1.9 - Bug #5344]
+
+Tue Oct 4 07:35:23 2011 Eric Hodel <drbrain@segment7.net>
+
+ * array.c (rb_ary_initialize): Add output for examples. Patch by
+ Jonathan Mukai. [Ruby 1.9 - Bug #5216]
+
+Tue Oct 4 07:30:50 2011 Eric Hodel <drbrain@segment7.net>
+
+ * array.c (rb_ary_s_create): Add example results for Array::[]. Patch
+ by Jonathan Mukai. [Ruby 1.9 - Bug #5215]
+
+Tue Oct 4 07:15:17 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems: Update to RubyGems 1.8.11. Move Deprecate into the
+ Gem namespace.
+
+Tue Oct 4 06:43:47 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych.rb: update psych version.
+ * ext/psych/psych.gemspec: generate new gemspec for new version.
+
+Tue Oct 4 06:29:55 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych.rb: calling `yaml` rather than `to_yaml`.
+ * ext/psych/lib/psych/nodes/node.rb: Rename `to_yaml` to just `yaml`
+ in order to avoid YAML::ENGINE switching from replacing this method.
+ * test/psych/helper.rb: fix tests for method name change.
+ * test/psych/test_document.rb: ditto
+ * test/psych/visitors/test_emitter.rb: ditto
+
+Tue Oct 4 06:20:19 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/scalar_scanner.rb: Match values against the
+ floating point spec defined in YAML to avoid erroneous parses.
+ * test/psych/test_numeric.rb: corresponding test.
+
+Tue Oct 4 05:59:24 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/to_ruby.rb: ToRuby visitor can be
+ constructed with a ScalarScanner.
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: ScalarScanner can be
+ passed to the YAMLTree visitor.
+
+Tue Oct 4 05:47:23 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/to_ruby.rb: Define Regexp::NOENCODING
+ for 1.9.2 backwards compatibility.
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: Fix Date string
+ generation for 1.9.2 backwards compatibility.
+
+Mon Oct 3 23:56:39 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * gc.c (rb_gc_set_params): output GC parameter change messages only
+ if -w/-v options are specified. these messages are output to stderr,
+ not to stdout. [ruby-core:39795] [Bug #5380]
+
+ * test/ruby/test_gc.rb (test_gc_parameter): add test for it.
+
+Sun Oct 2 20:05:32 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * vm.c (rb_thread_mark), cont.c (cont_mark): revert r33369 and r33371
+ that may cause SEGV in certain environments.
+
+Sun Oct 2 12:14:06 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * test/psych/test_yamldbm.rb: add test case.
+ * test/syck/test_yamldbm.rb: ditto.
+
+Sun Oct 2 11:28:09 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * lib/yaml/store.rb: make initialize method signature match the
+ superclass signature.
+
+Sun Oct 2 10:44:01 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * io.c: fix documentation of ARGF.lineno=.
+
+Sat Oct 1 20:03:19 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (have_framework): try as Objective-C.
+ https://twitter.com/nagachika/status/120294447660539904
+
+Sun Oct 2 08:43:25 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * vm.c (rb_thread_mark), cont.c (cont_mark): self pointer should not
+ be marked by itself. Patch by Koichi Sasada.
+ [ruby-dev:44567] [Bug #5386]
+
+Sun Oct 2 00:42:14 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * vm.c (rb_thread_mark): rb_thread_t needs self to be marked.
+ [ruby-dev:44566] [Bug #5386]
+
+Sat Oct 1 09:48:53 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * gc.c (add_heap_slots, init_heap): reset heaps_inc zero when
+ heap slots are expanded by environment variable RUBY_HEAP_MIN_SLOTS.
+ [ruby-core:39777] [Bug #5380]
+
+ * test/ruby/test_gc.rb (test_gc_parameter): add test for it.
+
+ * test/ruby/envutil.rb (assert_normal_exit): add :child_env option to
+ enable pass environment variables to child process.
+
+Thu Sep 29 13:17:51 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (ary_join_1): should not copy the encoding of non-string
+ element after string element. [ruby-core:39776] [Bug #5379]
+
+Thu Sep 29 11:53:56 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * gc.c (slot_sweep, rb_gc_finalize_deferred)
+ (rb_objspace_call_finalizer, rb_gc): run finalizers
+ sequentially. [ruby-dev:44562]
+
+Thu Sep 29 20:37:38 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/gdbm/gdbm.c (rb_gdbm_fatal): adjust argument type.
+
+Thu Sep 29 20:10:42 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * gc.c (is_id_value, is_live_object): extract from id2ref().
+
+ * gc.c (run_finalizer): use object instead of object id.
+
+Thu Sep 29 20:07:36 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * use RB_TYPE_P which is optimized for constant types, instead of
+ comparison with TYPE.
+
+Wed Sep 28 09:20:37 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (pthread_np.h): needs pthread.h to be included
+ previously on OpenBSD. a patch by George Koehler <xkernigh AT
+ netscape.net> at [ruby-core:39752]. [Bug #5376]
+
+Wed Sep 28 04:41:35 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * test/psych/test_yamlstore.rb: use tmpdir for tmpfile.
+ * test/syck/test_yamlstore.rb: ditto.
+
+Wed Sep 28 04:10:46 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * ext/bigdecimal/README: update report to.
+
+Tue Sep 28 04:05:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal_en.html: removed because this file isn't
+ maintained now.
+
+ * ext/bigdecimal/bigdecimal_ja.html: ditto.
+
+Tue Sep 27 09:55:40 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c: make native_fd_select().
+ * thread.c (do_select): remove #ifdef _WIN32. Instead, use
+ native_fd_select() always.
+
+Tue Sep 27 09:44:59 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (do_select): remove cygwin specific hack. It's layer
+ violation and too large hack.
+ * thread.c (cmp_tv, subtract_tv): removed.
+
+Tue Sep 27 03:50:19 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * test/rexml/test_sax.rb: add require 'rexml/document'.
+
+Tue Sep 27 03:32:27 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * test/psych/test_yamldbm.rb: fix #setup and #teardown.
+ [Bug #5370] [ruby-core:39730]
+ * test/syck/test_yamldbm.rb: ditto.
+
+Mon Sep 26 11:27:38 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/webrick/httputils.rb: Add MIME Type definition of .js and .svg.
+ patched by Hal Brodigan. [ruby-core:39704] [Bug #5365]
+
+Mon Sep 26 09:20:44 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in: remove DJGPP support. It's not longer supported
+ since ruby 1.9.0.
+
+Mon Sep 26 09:07:46 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * include/ruby/defines.h: remove NextStep, OpenStep, Rhapsody
+ support. Last activity of their OSes are 7 years ago.
+ * configure.in: ditto.
+ * dir.c: ditto.
+ * ext/tk/extconf.rb: ditto.
+
+Mon Sep 26 09:02:49 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in: remove a code for human68k. it's no longer
+ supported since r19677.
+
+Sun Sep 25 23:43:32 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_asn1.c: fix int_ossl_asn1_decode0_cons when being
+ fed arbitrary string values.
+ Clearly distinguish between the cases "universal, infinite and
+ not a SEQUENCE or SET" and "universal SEQUENCE or SET, possibly
+ infinite". Raise error for universal tags that are not infinite.
+ * test/openssl/test_asn1.rb: add a test for this.
+
+ Thanks to Hiroshi Yoshida for reporting this bug.
+ [Bug #5363] [ruby-dev:44542]
+
+Sun Sep 25 20:57:18 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * test/syck/test/yamldbm.rb: add test for Syck::DBM.
+ * test/psych/test_yamldbm.rb: add test for Psych::DBM.
+ * test/psych/test_yamlstore.rb: add test for Psych::PStore.
+
+Sun Sep 25 20:54:10 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * lib/yaml/dbm/dbm.rb: fix #update, add #key for using instead #index.
+ [Bug #5305][ruby-dev:44485]
+
+Sun Sep 25 16:54:33 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * encoding.c (require_enc): reject only loading from untrusted
+ load paths. [ruby-dev:44541] [Bug #5279]
+
+ * transcode.c (load_transcoder_entry): ditto.
+
+Sun Sep 25 16:45:05 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in: ignore all warnings from an arbitrary
+ header in /usr/local/include.
+
+Sun Sep 25 03:43:03 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * enum.c (slice_before_i): use rb_attr_get to suppress wrong warning
+ for internal instance variable slicebefore_initial_state.
+
+Fri Sep 23 14:20:14 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_asn1.c: remove unused variable.
+
+Fri Sep 23 13:46:59 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * test/openssl/test_ssl_session.rb: execute test_session_exts_read
+ only for OpenSSL versions >= 0.9.8k. Thanks, Eric Wong, for
+ reporting this.
+ [Bug #4961] [ruby-core:37726]
+
+Fri Sep 23 11:59:08 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * test/openssl/test_ssl_session.rb: ensure server calls callbacks in
+ test_ctx_server_session_cb. Thanks to Eric Wong for the patch.
+ [Bug #5336] [ruby-core:39619]
+
+Thu Sep 22 02:53:19 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_call_cfunc): suppress a warning. note that
+ `volatile type *var' doesn't make var itself volatile.
+
+Thu Sep 22 01:52:48 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * thread_pthread.c (ubf_select): activate timer thread when interrupt
+ blocking thread.
+ A patch created by Koichi Sasada. [ruby-core:39634] [Bug #5343]
+ to cover race condition, timer thread periodically send SIGVTARLM to
+ threads in signal thread list. so you should activate timer thread
+ when interrupt a thread.
+
+Wed Sep 21 16:55:26 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/io/wait/test_io_wait.rb (TestIOWait#setup): of course, the
+ behavior of mingw is just same with mswin.
+
+Tue Sep 20 18:08:51 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_get_cvar_base): reduce duplicated checks and
+ move a warning outside the loop.
+
+Mon Sep 19 18:55:51 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * lib/fileutils.rb (module FileUtils): improve performance of
+ FileUtils.compare_stream. a patch by Masaki Matsushita.
+ [Feature #5337] [ruby-core:39622]
+
+Mon Sep 19 18:42:58 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * test/-ext-/old_thread_select/test_old_thread_select.rb:
+ select() with timeout may return early in old Linux kernels
+ with 250 Hz tickrate and no dynticks, so skip everything older
+ than 2.6.32 (which has long term support).
+ And, Make the timing assertions consistently use assert_operator with
+ timing difference in error message
+ Patch by Eric Wong. [Bug #5335] [ruby-core:39618]
+
+Mon Sep 19 09:28:06 2011 Eric Hodel <drbrain@segment7.net>
+
+ * test/openssl/test_ssl.rb (class OpenSSL): Test
+ OpenSSL::SSL::SSLSocket#session and #session=.
+
+Mon Sep 19 07:54:17 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * object.c (rb_obj_clone): singleton class should be attached
+ singleton object to. a patch by Satoshi Shiba <shiba AT rvm.jp>
+ at [ruby-dev:44460]. [Bug #5274]
+
+Sat Sep 17 23:34:10 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (parser_data_type): inherit the core type in ripper so
+ that checks in core would work. [ruby-core:39591] [Bug #5331]
+
+Sat Sep 17 12:44:04 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * lib/find.rb (Find.find): add documentation that Find.find
+ without block returns an enumerator.
+
+Thu Sep 15 11:39:43 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * gc.c (mark_entry, mark_key, mark_keyvalue): adjust callback
+ argument types.
+
+Thu Sep 15 01:44:10 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * ext/tk/*: Change encoding from EUC-JP to UTF-8
+
+Wed Sep 14 11:43:37 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_fd_rcopy): added an argument guard.
+ Patch by NAKAMURA Usaku. [Bug #5306] [ruby-core:39435]
+
+Tue Sep 13 20:21:49 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/pstore.rb, test/test_pstore.rb: suppress warnings with -v.
+
+ * lib/pstore.rb (PStore): always open in binary mode even if
+ default encodings are set. [Bug #5311] [ruby-core:39503]
+
+Tue Sep 13 05:37:15 2011 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * io.c (Init_IO): update BINARY comment. it should not change the
+ encoding of the result to ASCII-8BIT. [ruby-talk:387719]
+
+Mon Sep 12 19:55:00 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_thread_select): fix to ignore an argument
+ modification of rb_thread_fd_select().
+ based on a patch by Eric Wong. [Bug #5306] [ruby-core:39435]
+ * thread.c (rb_fd_rcopy): New. for reverse fd copy.
+
+ * test/-ext-/old_thread_select/test_old_thread_select.rb
+ (test_old_select_false_positive): test for bug5306.
+
+ * ext/-test-/old_thread_select/old_thread_select.c (fdset2array):
+ New. convert fdsets to array.
+ * ext/-test-/old_thread_select/old_thread_select.c (old_thread_select):
+ return 'read', 'write', 'except' argument of rb_thread_select()
+ to ruby script.
+
+Mon Sep 12 13:38:12 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * README.EXT, README.EXT.ja (2.2.2), parse.y (rb_check_id): add
+ documents for rb_check_id().
+
+Mon Sep 12 12:53:39 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * lib/rake/file_list.rb (Rake::FileList#egrep): there is no need to
+ open files in binary mode.
+ see more details in https://github.com/jimweirich/rake/issues/74
+
+Mon Sep 12 12:42:36 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/ruby/test_exception.rb (TestException#test_exit_success_p):
+ assert also the cases when exiting with true and false.
+
+ * lib/test/unit/assertions.rb (assert_send): make arguments in
+ the default message clearer.
+
+Sun Sep 11 05:23:14 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * lib/matrix.rb: Deal with subclasses of Matrix [redmine #5307]
+
+Sat Sep 10 13:38:20 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * dir.c (dir_s_aref):
+ * dir.c (dir_entries): Two small documentation fixes.
+ A patch from Aaron Lerch. [Bug #5302] [ruby-core:39404]
+
+Sat Sep 10 08:30:03 2011 Koichi Sasada <ko1@atdot.net>
+
+ * gc.c (GC_PROFILE_MORE_DETAIL, CALC_EXACT_MALLOC_SIZE):
+ define macros only if they are not defined.
+ fixes: [Ruby 1.9 - Feature #5291]
+
+Sat Sep 10 08:25:47 2011 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * parse.y (bv_decls): parse.y relies on $$ = $1 before action
+ routines. a patch from Michael Edgar. [Bug #5303]
+ [ruby-core:39429]
+
+Sat Sep 10 01:37:55 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * sample/drb/dhasenc.rb: coding cookie of Emacs is coding,
+ not encoding.
+
+ * sample/mine.rb: ditto.
+
+Fri Sep 9 21:56:40 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_sqrt): Fix comment.
+ BigDecimal#sqrt requires argument. Reported by Makoto Kishimoto.
+ Thanks for your contribution. [Bug #5267] [ruby-dev:44452]
+
+Fri Sep 9 11:00:55 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * test/rubygems/test_gem_commands_help_command.rb: Add one
+ `require` because if run test-all with test/unit parallel
+ running, sometimes this test fails by some constants not found.
+ The error reason is some worker doesn't require the file needed by
+ this test. This issue is related to [ruby-core:36168].
+
+Fri Sep 9 10:22:03 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread.c (rb_thread_select): fix a typo to initialize efds
+ properly. [Bug #5299] [ruby-core:39380]
+
+Fri Sep 9 02:02:09 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * template/yarvarch.ja:
+ Change encoding from Shift_JIS to UTF-8
+
+Thu Sep 9 01:14:00 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * sample/drb/README.rd.ja:
+ * sample/drb/dhasenc.rb:
+ * sample/mine.rb:
+ Change encoding from EUC-JP to UTF-8
+
+Thu Sep 8 21:03:22 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/nkf/nkf-utf8/nkf.c: import nkf 2.1.2 (be9c280)
+ Bump version number/release date only.
+
+Thu Sep 8 12:43:18 2011 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c (Init_GC): defined GC::Profiler.raw_data. based on the
+ patch by Eric Hodel. [ruby-core:37857] [Bug #4991]
+
+Thu Sep 8 09:02:53 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * gc.c (id2ref): objects which are unmarked but not in sweep_slots
+ are not dead.
+
+Thu Sep 8 07:44:25 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * transcode.c (rb_declare_transcoder, load_transcoder_entry): no
+ longer need to limit the length of transcoder library name.
+
+Thu Sep 8 07:36:36 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/syck/lib/syck/types.rb: use toplevel Syck.
+ for the case someone define Syck::Syck (or YAML::Syck).
+
+Thu Sep 8 07:33:12 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * gc.c (id2ref): unmarked object is already dead while lazy
+ sweeping, and to it cannot come back since other objects
+ referred from it might have been freed already.
+
+Wed Sep 8 03:48:00 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * ext/readline/README.ja:
+ Change encoding from EUC-JP to UTF-8
+
+Wed Sep 8 02:59:00 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * test/rexml/test_encoding.rb:
+ Add require 'require 'rexml/document'
+
+Wed Sep 8 02:53:00 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * ext/nkf/nkf-utf8/nkf.c:
+ Change encoding from ISO-2022 to UTF-8
+
+Wed Sep 7 23:41:24 2011 Kouhei Sutou <kou@cozmixng.org>
+
+ * lib/rexml/parsers/baseparser.rb, test/rexml/test_comment.rb:
+ allow a single hyphen in comment. [Bug #5278] [ruby-core:39289]
+ Reported by Thomas Fritzsche. Thanks!!!
+
+Wed Sep 7 17:27:18 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/yaml.rb: explicitly specify ::Object to avoid the collision with
+ Syck::Object.
+
+Tue Sep 6 21:06:49 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/test/unit.rb (_run_suites): Now reports are written the
+ following order: Skip, Failure, Error. [Feature #5282]
+
+ * test_sorting.rb: test for above.
+
+ * test4test_sorting.rb: Ditto.
+
+ * lib/test/unit.rb (run): Put RUBY_DESCRIPTION before quitting.
+ [Feature #5282]
+
+Tue Sep 6 21:13:47 2011 Masaya Tarui <tarui@ruby-lang.org>
+
+ * win32/Makefile.sub (INSNS): change command line option -Ks to -Ku
+ for generate *.inc. because insns.def encoding has been changed SJIS
+ to UTF-8. if $BASERUBY is 1.9, -Ks cause an error. [Feature #5128]
+ (same as r33194)
+
+Tue Sep 6 15:55:24 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * transcode.c (load_transcoder_entry): concatenate paths directly.
+
+ * encoding.c (load_encoding): predefined encoding names are safe.
+ [ruby-dev:44469] [Bug #5279]
+
+ * transcode.c (load_transcoder_entry): ditto.
+
+Tue Sep 6 12:07:10 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * transcode.c: enabled econv newline option.
+
+Tue Sep 6 06:44:57 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * numeric.c (dbl2ival): Fix Float#divmod and #round for 32 bit
+ platform. part 1 of [bug #5276]
+
+Tue Sep 6 06:44:25 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * numeric.c (flo_round): Fix criteria for 32 bits platform
+ part 2 of [bug #5276]
+
+Tue Sep 6 05:37:11 2011 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
+
+ * test/rinda/test_rinda.rb (test_core_03_notify): Fixed test failures
+ [ruby-dev:44430] [Ruby 1.9 - Bug #372]
+
+Mon Sep 5 20:59:30 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * insns.def: change encoding pragma for emacs (shift_jis to utf-8).
+
+Mon Sep 5 19:32:15 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * Makefile.in (INSNS): change command line option -Ks to -Ku for
+ generate *.inc. because insns.def encoding has been changed SJIS to
+ UTF-8. if $BASERUBY is 1.9, -Ks cause an error. [Feature #5128]
+
+Mon Sep 5 18:10:56 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * transcode.c (rb_econv_binmode): newline decorators are
+ exclusive.
+
+Mon Sep 5 15:03:37 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * test/rubygems/test_gem_security.rb
+ (test_class_build_self_signed_cert): reset opt[:trust_dir] to apply
+ temporary Gem.user_home.
+
+Mon Sep 5 10:04:35 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * README.ja, README.EXT.ja: resolve conflicts. [ruby-dev:44459]
+
+Mon Sep 5 05:13:22 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * numeric.c (flo_round): Make Float#round round big values [bug
+ #5272]
+
+Mon Sep 5 04:28:25 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * numeric.c (int_round): Integer#round always returns an Integer [Bug
+ #5271]
+
+Sun Sep 4 22:28:50 2011 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb (default_port, default_imap_port,
+ default_tls_port, default_ssl_port, default_imaps_port):
+ added methods for consistency with Net::POP.
+ based on the patch by art lussos. [ruby-core:38997] [Bug #5198]
+
+Sun Sep 4 21:19:19 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
+
+ * Change encoding from EUC-JP to UTF-8. [Feature #5128]
+
+Sun Sep 4 00:47:39 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * test/ruby/test_fiber.rb (TestFiber#test_no_valid_cfp):
+ add a test. Unlike TestThread#test_no_valid_cfp,
+ this test succeeds even if win32ole is required (see r33153).
+
+Sun Sep 4 00:11:49 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * variable.c (rb_const_set): show the previous definition
+ location. [EXPERIMENTAL]
+
+Sat Sep 3 23:56:24 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (sizeof_struct_dirent_too_small): check if struct
+ dirent.d_name is too small.
+
+ * configure.in (RUBY_MINGW32): take tool prefix from CC.
+
+Sat Sep 3 23:52:08 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (argf_next_argv): open in default text mode.
+ [ruby-core:39234] [Bug #5268]
+
+Sat Sep 3 18:40:57 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * lib/thread.rb (SizedQueue#max=): raise ArgumentError if max is not
+ positive number. patch by Masaki Matsushita.
+ [ruby-dev:44449] [Bug #5259]
+
+ * test/thread/test_queue.rb (test_sized_queue_initialize,
+ test_sized_queue_assign_max): add tests for it.
+
+Fri Sep 2 21:11:16 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (validate_enc_binmode, prep_stdio): default to text mode on
+ dosish platforms. [ruby-core:38822] [Bug #5164]
+
+ * transcode.c (rb_econv_prepare_options): keep default ecflags
+ unchanged if no options.
+
+Fri Sep 2 14:36:47 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_search_const_defined_class): search
+ ancestors only when global scope. [ruby-core:39227] [Bug #5264]
+
+Fri Sep 2 09:58:08 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (parser_tokadd_string, parser_yylex): ignore a backslash
+ which prefixes an non-ascii character, which has no escape
+ syntax. [ruby-core:39222] [Ruby 1.9 - Bug #5262]
+
+Fri Sep 2 04:05:25 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/visitors/yaml_tree.rb: emit strings tagged as
+ ascii-8bit as binary in YAML.
+ * test/psych/test_string.rb: corresponding test.
+
+Fri Sep 2 01:07:14 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * numeric.c (flo_round): substitute machine dependent magic number.
+
+Thu Sep 1 17:31:22 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * insns.def (defineclass), vm_insnhelper.c (vm_get_cvar_base): see
+ also inherited constants for classes without superclass and
+ modules. [ruby-core:37698] [Bug #3423]
+
+Thu Sep 1 16:18:44 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * Release GVL while OpenSSL's public key generation.
+
+ t = Thread.new { print "."; sleep 0.1 }
+ key = OpenSSL::PKey::RSA.new(2048)
+ #=> Thread t works in parallel with public key generation if
+ OS/machine allows it.
+
+ This works with OpenSSL >= 0.9.8. From this version, it has new
+ public key generation function which allows us to interrupt the
+ execution while pkey generation iterations.
+
+ * ext/openssl/extconf.rb: Check existence of OpenSSL's new public key
+ generation function. (DH_generate_parameters_ex,
+ DSA_generate_parameters_ex and RSA_generate_key_ex.
+
+ * ext/openssl/ossl_pkey.{h,c} (ossl_generate_cb_2,
+ ossl_generate_cb_stop): Added new callback function for OpenSSL pkey
+ generation which handles Thread interruption by Ruby.
+ ossl_generate_cb_stop is the unblock function(ubf) for Ruby which
+ sets a stop flag. New pkey generation callback ossl_generate_cb_2
+ checks the stop flag at each iterations of OpenSSL and interrupts
+ pkey generation when the flag is set.
+
+ * ext/openssl/ossl_pkey_dsa.c (dsa_generate): Call
+ rb_thread_blocking_region with the above unblock function to release
+ GVL while pkey generation.
+
+ * ext/openssl/ossl_pkey_rsa.c (rsa_generate): ditto.
+
+ * ext/openssl/ossl_pkey_dh.c (dh_generate): ditto.
+
+ * test/openssl/test_pkey_{dh,dsa,rsa}.rb: Test it.
+
+Thu Sep 1 14:06:54 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_thread.rb (TestThread#test_no_valid_cfp): skip when
+ win32ole is required. in such case, win32ole redefines
+ Thread#initialize, and the block argument becomes to be not the top
+ of the thread, then this testcase always fails.
+
+Thu Sep 1 10:20:50 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_io_m17n.rb (TestIO_M17N#test_{default_mode_on_dosish,
+ default_mode_on_unix,text_mode,binary_mode}): sorry for wrong test
+ committed in r33144. I'd misunderstood the spec of ruby's universal
+ newline.
+
+Thu Sep 1 09:27:57 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * variable.c (rb_autoloading_value): Fix the order of definitions.
+ It is used by autoload_defined_p.
+
+Wed Aug 31 17:28:23 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * variable.c (rb_autoload): There was a chance to run GC (from
+ rb_str_new2()) before finishing autoload_data_i construction. It
+ caused SEGV at rb_gc_mark() at autoload_i_mark.
+
+ * variable.c (rb_autoload_load): Move RB_GC_GUARD() to proper
+ position based on suggestion by CHIKANAGA Tomoyuki at
+ http://d.hatena.ne.jp/nagachika/20110826/ruby_trunk_changes_33070_33078
+
+ * variable.c (autoload_defined_p): Fix incompatible autoload behavior
+ that causes Rails crash. Class definition instruction defined in
+ 'defineclass' in insns.def always invokes rb_autoload_load for a
+ constant. It's invoked for every class definition regardless of
+ existence of autoload definition. rb_autoload_load checks if a
+ constant is defined as autoloaded, but new thread-safe autoload
+ returned different value if the constant is under autoloading.
+
+Wed Aug 31 17:20:56 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * Re-apply r33078, thread-safe autoload which is reverted at r33093.
+
+Wed Aug 31 16:28:04 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_io_m17n.rb (TestIO_M17N#test_{default_mode_on_dosish,
+ default_mode_on_unix,text_mode,binary_mode}): tests for [Bug #5164].
+
+Wed Aug 31 15:54:11 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/json: Merge json gem v1.5.4 (3dab4c5a6a97fac03dac).
+
+Wed Aug 31 13:09:41 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * numeric.c (flo_round): Avoid overflow by optimizing for trivial
+ cases [Bug #5227]
+
+Wed Aug 31 00:50:01 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (rb_w32_select_with_thread): and my typo. we all must
+ be more careful.
+
+Wed Aug 31 00:48:38 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * thread.c (rb_thread_select): critical typo in r33117.
+
+Wed Aug 31 00:30:49 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/-ext-/old_thread_select/test_old_thread_select.rb
+ (TestOldThreadSelect#test_old_select_read_timeout): if the machine
+ is fast enough, the time used by code around IO.select may be smaller
+ than Time implement threshold.
+
+Wed Aug 31 00:04:38 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * ext/-test-/old_thread_select/old_thread_select.c (old_thread_select):
+ typo.
+
+ * test/-ext-/old_thread_select/test_old_thread_select.rb
+ (TestOldThreadSelect#test_old_select_signal_safe): use SIGINT instead
+ of SIGUSR1 because the former is general and the latter is platform
+ dependent.
+
+Tue Aug 30 23:59:36 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c, include/ruby/intern.h (rb_w32_fd_copy): implement
+ for rb_thread_select() in thread.c. the use of rb_fd_copy() is
+ introduced in r33117.
+ [Bug #5251] [ruby-core:39195]
+
+ * thread.c (rb_thread_select): must call rb_fd_init() before using
+ rb_fdset_t. see the implementations of rb_fd_init()s if you want to
+ know the reason.
+
+Tue Aug 30 22:34:45 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * test/dl/test_callback.rb (test_callback_with_string): prevents
+ temporary string from GC.
+
+Tue Aug 30 22:25:38 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_call_cfunc): revert r33112. RB_GC_GUARD macro
+ protect a VALUE from GC. It's not for general anti-optimizing
+ purpose.
+
+Tue Aug 30 11:06:19 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/json: Merge json gem 1.5.4+ (2149f4185c598fb97db1).
+ [Bug #5173] [ruby-core:38866]
+
+Tue Aug 30 09:57:50 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * lib/thread.rb (Queue#pop): fix a race against Thread.wakeup.
+ Patch by Masaki Matsushita <glass.saga at gmail dot com>
+ [Bug #5195] [ruby-dev:44400]
+
+Tue Aug 30 09:48:07 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * cont.c (fiber_entry): fix stack allocation failure on Debian
+ GNU/kFreeBSD.
+ Patch by Lucas Nussbaum <lucas at lucas-nussbaum dot net>.
+ [Bug #5241] [ruby-core:39147]
+
+Tue Aug 30 09:28:01 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread.c (rb_thread_select): rewrite by using
+ rb_thread_fd_select(). old one is EINTR unsafe.
+ Patch by Eric Wong. [Bug #5229] [ruby-core:39102]
+
+ * test/-ext-/old_thread_select/test_old_thread_select.rb:
+ a testcase for rb_thread_select().
+ * ext/-test-/old_thread_select/old_thread_select.c: ditto.
+ * ext/-test-/old_thread_select/depend: ditto.
+ * ext/-test-/old_thread_select/extconf.rb: ditto.
+
+Tue Aug 30 09:08:22 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in: fix a build failure on GNU Hurd.
+ Patch by Samuel Thibault <sthibault at debian dot org>. Thank you!
+ [Bug #5250] [ruby-core:39185]
+
+Sun Aug 29 23:22:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * test/ruby/test_numeric.rb (test_num2long): modify a test against the
+ change by r33108.
+
+Sun Aug 29 09:58:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * numeric.c (bit_coerce): A Fixnum and a Bignum are only permitted for
+ bitwise arithmetic with a Fixnum. #1792
+
+ * test/ruby/test_fixnum.rb: add tests for the above change.
+
+ * bignum.c (bit_coerce): A Fixnum and a Bignum are only permitted for
+ bitwise arithmetic with a Bignum. #1792
+
+ * test/ruby/test_bignum.rb: add tests for the above change.
+
+Sun Aug 28 15:38:17 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * ext/date/date_parse.c (date_zone_to_diff): keep a temporary string
+ stored in variable while the contents buffer is being used.
+
+ * ext/date/date_parse.c (date_zone_to_diff): get rid of out of bounds
+ memory read. [ruby-dev:44409] [Bug #5213]
+
+Sun Aug 28 05:29:50 2011 Ryan Davis <ryand-ruby@zenspider.com>
+
+ * lib/minitest/*: Imported minitest 2.5.1 (r6596)
+ * test/minitest/*: ditto
+
+Sat Aug 27 20:46:05 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * vm.c (rb_vm_rewrite_dfp_in_errinfo): change return type
+ to suppress a warning.
+
+ * vm_core.h: ditto.
+
+Sat Aug 27 19:04:06 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * internal.h (rb_strftime_timespec): moved from time.c and define only
+ if ruby/encoding.h is included.
+
+ * internal.h (rb_strftime): ditto.
+
+Sat Aug 27 18:53:51 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * proc.c (proc_new): force to rewrite errinfo when calling Proc.new in ensure.
+ [Bug #5234] [ruby-core:39125]
+ This code will be removed after changing throw mechanism (see r33064).
+
+ * vm.c (rb_vm_rewrite_dfp_in_errinfo): new function.
+
+ * vm.c (vm_make_env_each): changed accordingly.
+
+ * vm_core.h: ditto.
+
+ * bootstraptest/test_flow.rb: add tests for above.
+
+Sat Aug 27 18:44:06 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * internal.h (rb_strftime_timespec): move to time.c because it depends
+ encoding.h.
+
+Sat Aug 27 18:17:58 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * strftime.c (rb_strftime_with_timespec): get enc argument to specify
+ the encoding of the format. On Windows (at least Japanese Windows),
+ Time#strftime("%Z") includes non ASCII in locale encoding (CP932).
+ So convert locale to default internal. [ruby-core:39092] [Bug #5226]
+
+ * strftime.c (rb_strftime): ditto.
+
+ * strftime.c (rb_strftime_timespec): ditto.
+
+ * internal.h (rb_strftime_timespec): follow above.
+
+ * time.c (rb_strftime_alloc): ditto.
+
+ * time.c (strftimev): ditto.
+
+ * time.c (time_strftime): ditto.
+
+ * time.c (time_to_s): the resulted string of Time#to_s is always
+ ascii only, so this should be US-ASCII.
+
+ * time.c (time_asctime): ditto.
+
+Sat Aug 27 11:18:12 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * Revert r33078. It caused a Rails application NoMethodError.
+
+ /home/nahi/git/emptyApp/ruby/1.9.1/gems/rack-mount-0.6.14/lib/rack/mount/utils.rb:157: warning: toplevel constant ScanError referenced by Regin::Parser::ScanError
+ /home/nahi/git/emptyApp/ruby/1.9.1/gems/rack-mount-0.6.14/lib/rack/mount/vendor/regin/regin/parser.rb:17:in `parse_regexp': undefined method `scan_str' for #<Regin::Parser:0x00000002344548> (NoMethodError)
+
+Sat Aug 27 08:44:58 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc: Import RDoc 3.9.4. Typo and grammar fixes by Luke Gruber.
+ [Ruby 1.9 - Bug #5203]
+
+Sat Aug 27 07:53:34 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/open-uri.rb: Fix indentation of OpenURI::OpenRead#open. Use ++
+ instead of `' for method arguments in open-uri.rb
+
+Sat Aug 27 07:22:07 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/pathname/lib/pathname.rb: Fix typos and grammar mistakes. Patch
+ by Luke Gruber. [#5203]
+ * ext/pty/lib/expect.rb: ditto
+ * lib/mathn.rb: ditto
+ * lib/net/http.rb: ditto
+ * lib/open-uri.rb: ditto
+ * lib/ostruct.rb: ditto
+ * lib/tempfile.rb: ditto
+ * lib/thread.rb: ditto
+ * lib/weakref.rb: ditto
+ * sample/webrick/httpproxy.rb: ditto
+
+Sat Aug 27 04:03:18 2011 Koichi Sasada <ko1@atdot.net>
+
+ * iseq.c (iseq_data_to_ary): fix type of variable
+ (long -> unsigned long) to suppress a warning.
+
+Sat Aug 27 04:02:11 2011 Koichi Sasada <ko1@atdot.net>
+
+ * vm_core.h: add a decl. of rb_autoloading_value().
+
+Fri Aug 26 19:12:08 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * variable.c: Make autoload thread-safe. See #921.
+
+ What's the problem?
+ autoload is thread unsafe. When we define a constant to be
+ autoloaded, we expect the constant construction is invariant. But
+ current autoload implementation allows other threads to access the
+ constant while the first thread is loading a file.
+
+ What's happening inside?
+ The current implementation uses Qundef as a marker of autoload in
+ Constant table. Once the first thread find Qundef as a value at
+ constant lookup, it starts loading a defined feature. Generally a
+ loaded file overrides the Qundef in Constant table by module/class
+ declaration at very beginning lines of the file, so other threads
+ can see the new Module/Class object before feature loading is
+ finished. It breaks invariant construction.
+
+ How to solve?
+ To ensure invariant constant construction, we need to override
+ Qundef with defined Object after the feature loading. For keeping
+ Qundef in Constant table, I expanded autoload_data struct in
+ Module to have a slot for keeping the defined object while feature
+ loading. And changed Module's constant lookup/update logic a
+ little so that the slot is only visible from the thread which
+ invokes feature loading. (== the first thread which accessed the
+ autoload constant)
+
+ Evaluation?
+ All test passes (bootstrap test, test-all and RubySpec) and added
+ 8 tests for threading behavior. Extra logics are executed only
+ when Qundef is found, so no perf drop should happen except
+ autoloading.
+
+ * variable.c (rb_autoload): Prepare new autoload_data struct.
+
+ * variable.c (rb_autoload_load): Load feature and update Constant
+ table after feature loading is finished.
+
+ * variable.c (rb_const_get_0): When the fetched constant is under
+ autoloading, it returns the object only for the thread which starts
+ autoloading.
+
+ * variable.c (rb_const_defined_0): Ditto.
+
+ * variable.c (rb_const_set): When the specified constant is under
+ autoloading, it sets the object only for the thread which starts
+ autoloading. Otherwise, simply overrides Qundef with constant
+ override warning.
+
+ * vm_insnhelper.c (vm_get_ev_const): Apply same change as
+ rb_const_get_0 in variable.c.
+
+ * test/ruby/test_autoload.rb: Added tests for threading behavior.
+
+Fri Aug 26 10:10:37 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems: Update to RubyGems 1.8.10. Fixes security issue in
+ creating ruby-format gemspecs. Fixes Gem.dir not being at the front
+ of Gem.path to fix uninstall and cleanup commands. Fixes gem
+ uninstall stopping on the first missing gem.
+
+Fri Aug 26 08:21:10 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * time.c (strftimev): Make Time#to_s default to US-ASCII encoding but
+ respect Encoding.default_internal. [ruby-core:39092]
+ * test/ruby/test_time.rb (class TestTime): Corresponding test.
+
+Thu Aug 25 09:43:16 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/openssl/lib/openssl/bn.rb: Hide copyright info from RDoc.
+ * ext/openssl/lib/openssl/digest.rb: ditto
+ * ext/openssl/lib/openssl/x509.rb: ditto
+ * ext/openssl/lib/openssl/cipher.rb: ditto
+
+Thu Aug 25 09:25:48 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/openssl/ossl_digest.c: Document OpenSSL::Digest::digest and add
+ an example to OpenSSL::Digest. Patch by Sylvain Daubert.
+ [Ruby 1.9 - Bug #5166]
+ * ext/openssl/lib/openssl/digest.rb (module OpenSSL): ditto
+
+Thu Aug 25 08:19:43 2011 Koichi Sasada <ko1@atdot.net>
+
+ * vm.c (vm_make_env_each): work around to solve Bug #2729.
+ fixes: Bug #2729
+ a patch from Kazuki Tsujimoto <kazuki@callcc.net>
+ This problem is caused by changing dfp (dynamic env pointer)
+ from saved dfp. Saved dfp is pointed env in VM stack. However,
+ the dfp can be moved because VM copies env from VM stack to
+ the heap. At this copying, dfp was also changed. To solve this
+ problem, I'll try to change throw mechanism (not save target dfp,
+ but save target cfp).
+
+ * bootstraptest/test_flow.rb: add a test for above.
+
+Thu Aug 25 07:57:33 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * numeric.c (int_round): Fix Integer#round [ruby-core:39096]
+
+Thu Aug 25 07:00:00 2011 Koichi Sasada <ko1@atdot.net>
+
+ * vm_insnhelper.h, vm_insnhelper.c, vm.c, vm_method.c, insns.def:
+ Manage a redefinition of special methods for each classes.
+ A patch from Joel Gouly <joel.gouly@gmail.com>. Thanks!
+
+Thu Aug 25 06:51:08 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych.rb: Fixing psych version number.
+ * ext/psych/psych.gemspec: updating the gemspec.
+
+Thu Aug 25 06:11:35 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/nodes/node.rb: default `to_yaml` encoding to be
+ UTF-8.
+ * test/psych/test_encoding.rb: test yaml dump encoding.
+
+Thu Aug 25 01:24:33 2011 Naohisa Goto <ngotogenome@gmail.com>
+
+ * test/fileutils/test_fileutils.rb (test_chmod_symbol_mode): Solaris
+ seems to behave the same as FreeBSD.
+
+Thu Aug 25 01:11:36 2011 Naohisa Goto <ngotogenome@gmail.com>
+
+ * test/ruby/test_rubyoptions.rb (test_script_from_stdin): slave pty
+ should be manipulated because master pty may not be a tty on some
+ environment (e.g. Solaris). [Bug:#5222] [ruby-dev:44420]
+
+Wed Aug 24 15:13:56 2011 Koichi Sasada <ko1@atdot.net>
+
+ * iseq.h, iseq.c, compile.c: Change the line number data structure
+ to solve an issue reported at [ruby-dev:44413] [Ruby 1.9 - Bug #5217].
+ Before this fix, each instruction has an information including
+ line number (iseq::iseq_insn_info_table). Instead of this data
+ structure, recording only line number changing places
+ (iseq::iseq_line_info_table).
+ The order of entries in iseq_line_info_table is ascending order of
+ iseq_line_info_table_entry::position. You can get a line number
+ by an iseq and a program counter with this data structure.
+ This fix reduces memory consumption of iseq (bytecode).
+ On my measurement, a rails application consumes 21.8MB for
+ iseq with this fix on the 32bit CPU. Without this fix, it
+ consumes 24.7MB for iseq [ruby-dev:44415].
+
+ * proc.c: ditto.
+
+ * vm_insnhelper.c: ditto.
+
+ * vm_method.c: ditto.
+
+ * vm.c (rb_vm_get_sourceline): change to use rb_iseq_line_no().
+
+Wed Aug 24 09:49:10 2011 Koichi Sasada <ko1@atdot.net>
+
+ * insns.def (defined): fix to checking class variable.
+ A patch by Magnus Holm <judofyr@gmail.com>. Thanks!
+
+ * test/ruby/test_variable.rb: add a test for above.
+
+Wed Aug 24 08:53:06 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc: Update to RDoc 3.9.3. Fixes RDoc with `ruby -Ku`. Allows
+ HTTPS image paths to be turned into <img> tags. Prevents special
+ markup inside <tt> from being processed.
+
+Wed Aug 24 07:57:43 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems: Update to RubyGems 1.8.9. Fixes uninstalling multiple
+ gems and gem cleanup.
+
+Wed Aug 24 06:45:20 2011 Ryan Davis <ryand-ruby@zenspider.com>
+
+ * lib/minitest/*: Imported minitest 2.5.0 (r6557)
+ * test/minitest/*: ditto
+
+Wed Aug 24 00:38:22 2011 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * thread.c (update_coverage): skip coverage count up if the current
+ line is out of the way. rb_sourceline() is unreliable when source
+ code is big. [ruby-dev:44413]
+
+ * test/coverage/test_coverage.rb: add a test for above.
+
+Tue Aug 23 15:23:56 2011 Eric Hodel <drbrain@segment7.net>
+
+ * load.c (rb_f_require): Improve documentation of Kernel#require.
+ [Ruby 1.9 - Bug #5210]
+
+Tue Aug 23 11:27:26 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * ext/zlib/zlib.c (gzfile_read_header): Ensure that each section of
+ gzip header is readable to avoid SEGV.
+
+ * test/zlib/test_zlib.rb (test_corrupted_header): Test it.
+
+Mon Aug 22 23:43:33 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * sprintf.c (rb_str_format): add RB_GC_GUARD to prevent temporary
+ strings from GC.
+
+Sun Aug 21 17:49:53 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * iseq.c (iseq_s_disasm): remove variable which is no longer used
+ since r33013.
+
+Sun Aug 21 14:20:58 2011 Naohisa Goto <ngotogenome@gmail.com>
+
+ * configure.in: use LD_LIBRARY_PATH_64 on 64-bit Solaris.
+
+Sat Aug 20 13:19:52 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * iseq.c (iseq_s_disasm): fix a bug that may cause SEGV.
+
+ * test/ruby/test_method.rb (test_body): add a test for the above change.
+
+Sat Aug 20 10:43:24 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/stringio/stringio.c (strio_read): return new string if nil
+ is explicitly given as a buffer ([Bug #5207]), otherwise set the
+ encoding. also removed dead code.
+
+Fri Aug 19 14:25:51 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * process.c (proc_spawn_v, proc_spawn): should not wait the
+ spawned process.
+
+ * process.c (proc_spawn_v): fix missing argument, and try with
+ /bin/sh only if failed with ENOEXEC.
+
+Fri Aug 19 14:12:57 2011 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb (idle): raises a Net::IMAP::Error when the
+ connection is closed. based on the patch by Hugo Barauna.
+ [Bug #5190] [ruby-core:38930]
+
+Fri Aug 19 13:18:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * configure.in: defines _DARWIN_UNLIMITED_SELECT if the target_os
+ is darwin.
+
+Fri Aug 19 13:14:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * thread.c: add a description for the behavior of select(2) on
+ Mac OS X 10.7 (Lion).
+
+Fri Aug 19 11:28:58 2011 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/net/imap.rb (msg_att): accepts extra space before ')'.
+ based on the patch by art lussos. [Bug #5163] [ruby-core:38820]
+
+Wed Aug 17 23:01:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (cannot_be_coerced_into_BigDecimal):
+ remove duplication.
+
+Wed Aug 17 15:27:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (cannot_be_coerced_into_BigDecimal):
+ add a new function for raising error when an object cannot coerce
+ into BigDecimal. [Bug #5172]
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimalValueWithPrec): use
+ cannot_be_coerced_into_BigDecimal function.
+
+ * ext/bigdecimal/bigdecimal.c (BigMath_s_exp): ditto.
+
+ * ext/bigdecimal/bigdecimal.c (BigMath_s_log): ditto.
+
+ * test/bigdecimal/test_bigdecimal.rb: test for the above changes.
+
+ * test/bigdecimal/testbase.rb (under_gc_stress): add a new utility
+ method to run tests under the condition of GC.stress = true.
+
+Wed Aug 17 10:16:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * rational.c (nurat_coerce): Rational#coerce should converts itself
+ into Complex if the argument is a Complex with non-zero imaginary
+ part. [Bug #5020] [ruby-dev:44088]
+
+ * test/ruby/test_rational.rb (test_coerce): test for the above change.
+
+Wed Aug 17 06:33:19 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_x509cert.c: Add class documentation for
+ OpenSSL::X509::Certificate.
+
+Wed Aug 17 04:54:25 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_pkey.c: corrected docs, OpenSSL::PKey::DH does
+ *not* support #sign/verify.
+
+Tue Aug 16 18:56:54 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm.c (ruby_threadptr_data_type): rename to hide.
+ [ruby-core:38972]
+
+Tue Aug 16 18:52:08 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * win32/mkexports.rb (Exports::Mswin#each_export): exclude Init_
+ and _threadptr_ functions, as well as mingw.
+
+Tue Aug 16 09:31:44 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/dl: Add documentation. Patch by Vincent Batts.
+ [Ruby 1.9 - Bug #5192]
+
+Tue Aug 16 08:48:26 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/.document (fiddle): Remove duplicate entry
+ * ext/fiddle: Complete documentation of Fiddle. Patch by Vincent
+ Batts. [#5192]
+
+Tue Aug 16 08:00:15 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/socket: Make Socket documentation appear. Add documentation for
+ Socket, TCPServer, SOCKSSocket. Patch by Sylvain Daubert.
+ [Ruby 1.9 - Feature #5182]
+
+Mon Aug 15 09:58:55 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_ssl.c: Support disabling OpenSSL compression.
+
+ * test/openssl/test_ssl.rb: Add a test for it.
+ Thanks to Eric Wong for the patch.
+ [Ruby 1.9 - Feature #5183] [ruby-core:38911]
+
+Sun Aug 14 05:57:01 2011 Tanaka Akira <akr@fsij.org>
+
+ * test/socket/test_socket.rb (test_connect_timeout): added a test
+ based on a patch by Eric Wong. [ruby-core:38910]
+
+Sat Aug 13 22:17:27 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * tool/mkconfig.rb: do not make the entries related to sitedir and
+ verdordir if disabled by --without options. [ruby-core:38922]
+ [Bug #5187]
+
+Sat Aug 13 17:03:22 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: [ruby-core:38861]
+
+Sat Aug 13 09:39:07 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * test/date/test_*.rb: added tests.
+
+Sat Aug 13 09:36:19 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * ext/date/date_parse.c (parse_ddd_cb): fix r32896. RB_GC_GUARD
+ insertion position was mistaken. [ruby-dev:44337] [Bug #5152]
+
+Sat Aug 13 09:26:24 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/core_ext.rb: Make Kernel#y private.
+ [ruby-core:38913]
+
+ * test/psych/test_yaml.rb: corresponding test.
+
+Sat Aug 13 09:05:16 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c (date_strftime_alloc): followed the change
+ of r32885.
+
+ * doc/NEWS-1.9.3: followed the above change.
+
+Sat Aug 13 08:55:38 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/scalar_scanner.rb: Only consider strings
+ with fewer than 2 dots to be numbers. [ruby-core:38915]
+
+Sat Aug 13 08:47:20 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: [ruby-core:38855].
+
+Sat Aug 13 03:41:37 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/uri/common.rb: Fix documentation of URI::Parser.new. Patch by
+ Steve Klabnik. [Ruby 1.9 - Bug #5177]
+
+Sat Aug 13 02:19:57 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/digest/digest.c: Add documentation for the Digest module. Patch
+ by Sylvain Daubert. [Ruby 1.9 - Bug #5167]
+
+Sat Aug 13 01:56:11 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rake: Update to Rake 0.9.2.2. Prevent pollution of toplevel
+ namespace by Commands. Remove unused variable and debugging
+ statement in tests.
+
+Fri Aug 12 11:39:35 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in: Describe "no" configure option for site_ruby
+ and vendor_ruby. Patch by Vit Ondruch. [Bug #5187][ruby-core:38921]
+
+Fri Aug 12 09:00:24 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems: Import RubyGems 1.8.8. Fixes encoding of YAML gemspec
+ from gems. Github Issue #149
+
+Fri Aug 12 08:17:46 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/ipsocket.c (init_inetsock_internal): use SOMAXCONN for
+ listen backlog.
+
+ * ext/socket/unixsocket.c (rsock_init_unixsock): ditto.
+
+ * ext/socket/lib/socket.rb (Addrinfo#listen): ditto.
+ (Socket.tcp_server_sockets_port0): ditto.
+
+ * ext/socket/mkconstants.rb: define SOMAXCONN as 5 if not available.
+
+ [ruby-core:38493]
+
+Fri Aug 12 03:24:35 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc: Import RDoc 3.9.2. Fixes TIDYLINK for HTML output.
+
+Thu Aug 11 15:37:42 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * variable.c (autoload_delete): An autoload entry is still in a
+ RCLASS_IV_TBL, not in a RCLASS_CONST_TBL, so take back the table
+ changed in r29600. And an autoload entry keeps not a
+ rb_const_entry_t but a NODE so remove rb_const_entry_t thing added
+ in r29602.
+
+Thu Aug 11 15:07:36 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (link_command): use LIBRUBYARG in rbconfig for
+ unbundled extensions. [ruby-core:38802] [Bug #5147]
+
+ * lib/mkmf.rb (init_mkmf): revert r32902. [ruby-core:38903]
+
+Wed Aug 10 23:03:55 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/lib/socket.rb: fix argument check in the previous commit.
+
+Wed Aug 10 22:12:28 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/lib/socket.rb (Socket.tcp): add :connect_timeout option.
+ (Addrinfo#connect_from): add :timeout option.
+ (Addrinfo#connect): ditto.
+ (Addrinfo#connect_to): ditto.
+ [ruby-core:38538]
+
+Wed Aug 10 21:27:19 2011 Tanaka Akira <akr@fsij.org>
+
+ * lib/net/pop.rb: fix typo in document.
+
+ * lib/net/http.rb: ditto.
+
+ * lib/net/imap.rb: ditto.
+
+Wed Aug 10 19:30:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * complex.c (nucomp_rationalize): calls rationalize of real part if
+ imaginary part is exactly zero. The patch is made by Marc-Andre
+ Lafortune. fixes [Bug #5178] [ruby-core:38885]
+
+ * test/ruby/test_complex.rb (test_rationalize): add a test for the
+ above change.
+
+ * complex.c (nucomp_to_r): fix RDoc comment. The patch is made by
+ Marc-Andre Lafortune.
+
+Wed Aug 10 14:11:07 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (init_mkmf): set $LIBRUBYARG regardless of shared
+ option. [ruby-core:38802] [Bug #5147]
+
+Wed Aug 10 02:53:27 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/net/http.rb: come back autoload. OpenSSL constant is used
+ some places, so it leads mistakes like HTTP.start.
+
+Tue Aug 9 22:57:45 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * ext/date/date_parse.c (date_zone_to_diff): add RB_GC_GUARD.
+ [ruby-dev:44337] [Bug #5152]
+
+ * ext/date/data_parse.c (parse_ddd_cb): ditto.
+
+Tue Aug 9 14:25:47 2011 Naohisa Goto <ngotogenome@gmail.com>
+
+ * ext/fiddle/conversions.c (generic_to_value): ffi_arg and ffi_sarg
+ should be used to handle shorter return value. fix [Bug #3861]
+ [ruby-core:32504]
+
+ * ext/fiddle/closure.c (callback): ditto
+
+ * ext/fiddle/conversions.h (fiddle_generic): ditto
+
+ * ext/fiddle/conversions.c (value_to_generic): char, short and int
+ are strictly distinguished on big-endian CPU, e.g. sparc64.
+
+Tue Aug 9 11:21:08 2011 Narihiro Nakamura <authornari@gmail.com>
+
+ * gc.c (gc_lazy_sweep): if sweep target slots are not found, we
+ try heap_increment() because it might be able to expand the
+ heap. [Bug #5127] [ruby-dev:44285]
+
+ * gc.c (gc_clear_mark_on_sweep_slots): if a sweeping was
+ interrupted, we expand the heap if at all possible.
+
+Tue Aug 9 12:20:33 2011 Naohisa Goto <ngotogenome@gmail.com>
+
+ * test/fiddle/helper.rb (libc_so, libm_so): Solaris support added.
+ [ruby-core:38853] [Bug #5168]
+
+ * test/dl/test_base.rb (libc_so, libm_so): on Solaris, remove libc
+ and libm version numbers for detecting default libc and libm.
+
+Tue Aug 9 09:18:04 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/zlib/zlib.c (gzfile_wrap): Document encoding options.
+
+ * ext/zlib/zlib.c (rb_gzwriter_s_open): ditto
+
+ * ext/zlib/zlib.c (rb_gzreader_s_open): ditto
+
+Sun Aug 7 23:31:32 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * time.c (rb_strftime_alloc): raise ERANGE if width is too large.
+ Patch by Nobuyoshi Nakada. [Bug #4457] [ruby-dev:43285]
+
+ * test/ruby/test_time.rb (class TestTime): add a test for the
+ above change.
+
+Sun Aug 7 22:51:45 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * ext/openssl/ossl_asn1.c (decode_eoc): remove unused variables.
+ Patch by Eric Wong. [Feature #5157] [ruby-core:38798]
+
+ * ext/openssl/ossl_asn1.c (ossl_asn1_decode): ditto.
+
+ * ext/openssl/ossl_pkey.c (ossl_pkey_new_from_data): ditto.
+
+Sun Aug 7 22:37:08 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * configure.in: add -Wunused-variable to default CFLAGS.
+ Patch by Eric Wong. [Feature #5157] [ruby-core:38798]
+
+Sun Aug 7 15:37:35 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/digest/sha2/sha2ossl.c: use original SHA384_Final on DragonFly.
+
+Sun Aug 7 14:08:16 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * ext/objspace/objspace.c: fix typos in a document.
+
+Sun Aug 7 07:14:57 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * cont.c (HAVE_GETCONTEXT): see getcontext(3) because DragonFly BSD
+ x64 port doesn't have it.
+
+Sun Aug 7 00:42:55 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/tk/lib/tk/wm.rb (Tk::Wm.command): Add the missing receiver
+ before calling epath. patched by flori
+ https://github.com/flori/ruby/commit/aa9474d32e5f2c57f8b0e2e0c528a03f06a4d433
+
+Sat Aug 6 07:06:34 2011 Eric Hodel <drbrain@segment7.net>
+
+ * marshal.c (w_object): Fix exception message when _dump_data is not
+ defined on a T_DATA object.
+
+Fri Aug 5 22:16:20 2011 Naohisa Goto <ngotogenome@gmail.com>
+
+ * numeric.c (rb_infinity, rb_nan): use WORDS_BIGENDIAN to get endian.
+ fix [Bug #5160] [ruby-dev:44356]
+
+Fri Aug 5 17:14:11 2011 Akinori MUSHA <knu@iDaemons.org>
+
+ * test/test_syslog.rb (TestSyslog#test_log): Do not be too
+ specific about the log line format. Fixes #5081.
+
+Fri Aug 5 15:57:10 2011 Naohisa Goto <ngotogenome@gmail.com>
+
+ * complex.c (f_signbit): fix compile error in gcc4 on Solaris with
+ CFLAGS="-std=gnu99". [ruby-dev:44355] fix [Bug #5159]
+
+ * math.c: ditto.
+
+Fri Aug 5 15:55:33 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/ruby/test_object.rb: tests that respond_to? returns false.
+
+Fri Aug 5 13:32:43 2011 Shugo Maeda <shugo@ruby-lang.org>
+
+ * lib/xmlrpc/client.rb, lib/xmlrpc/server.rb: should use
+ String#bytesize instead of String#size.
+
+Fri Aug 5 12:18:20 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_eval.c (check_funcall): try respond_to? first if redefined.
+ [Bug #5158]
+
+Fri Aug 5 09:48:22 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems: Import RubyGems 1.8.7:
+ Added missing require for `gem uninstall --format-executable`.
+
+ The correct name of the executable being uninstalled is now displayed
+ with --format-executable.
+
+ Fixed `gem unpack uninstalled_gem` default version picker.
+
+ RubyGems no longer claims a nonexistent gem can be uninstalled.
+
+ `gem which` no longer claims directories are requirable files.
+
+ `gem cleanup` continues cleaning up gems if one can't be uninstalled
+ due to permissions. Issue #82.
+
+ Gem repository directories are no longer created world-writable.
+ Patch by Sakuro OZAWA. [Ruby 1.9 - Bug #4930]
+
+Fri Aug 5 07:00:31 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * test/io/console/test_io_console.rb (test_noctty): daemon() on
+ Fedora Rawhide seems not to detach the controlling terminal,
+ when the argument noclose is non-zero. ref: [Bug #5135]
+
+Thu Aug 4 23:48:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * thread_pthread.c (native_cond_signal): retry to call pthread_cond_signal
+ and pthread_cond_broadcast if they return EAGAIN in
+ native_cond_signal and native_cond_broadcast, respectively.
+ It is for the pthread implementation of Mac OS X 10.7 (Lion).
+ fixes #5155. [ruby-dev:44342].
+
+ * thread_pthread.c (native_cond_broadcast): ditto.
+
+ * thread_pthread.c (struct cached_thread_entry): stop using
+ pthread_cond_t and its functions directly.
+
+ * thread_pthread.c (register_cached_thread_and_wait): ditto.
+
+ * thread_pthread.c (use_cached_thread): ditto.
+
+Thu Aug 4 20:29:41 2011 Naohisa Goto <ngotogenome@gmail.com>
+
+ * configure.in: when Solaris cc, use $(CC) to link shared libs.
+
+Thu Aug 4 20:19:11 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * error.c (report_bug): use a small message buffer instead of BUFSIZ.
+ It is needed for avoiding nested SIGSEGV on Linux.
+ Note: BUFSIZ is not proper buffer size. It's unrelated with maximum
+ filename length. :-/
+ [Bug #5139] [ruby-dev:44315]
+
+Thu Aug 4 16:08:45 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * tool/rbinstall.rb (gem): install all gemspecs under lib and ext.
+
+ * tool/rbinstall.rb (Gem::Specification): may not be defined when
+ cross-compiling and BASERUBY is 1.8.
+
+Thu Aug 4 11:30:36 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * include/ruby/missing.h: define __syscall on OpenBSD as r32702.
+
+Thu Aug 4 03:02:54 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * tool/rbinstall.rb: use rubygems to load gemspecs, copy actual
+ gemspecs on install rather than generate fake ones for all gems.
+
+Thu Aug 4 02:45:10 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * configure.in: set CXX variable to the C++ compiler that matches the
+ C compiler specified by CC variable (e.g. use g++-4.2 for gcc-4.2).
+
+Thu Aug 4 02:21:10 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/mkmf.rb (link_command): use static library only for bundled
+ extensions. [Bug #5147]
+
+Thu Aug 4 02:02:10 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/psych.gemspec: installing psych as a gem.
+
+Wed Aug 3 16:01:35 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * util.c, include/ruby/util.h (ruby_add_suffix): remove the function.
+ [Bug #5153] [ruby-core:38736]
+
+ * io.c (argf_next_argv): remove the call of above function.
+
+ * ext/-test-/add_suffix, test/-ext-/test_add_suffix.rb: remove the test
+ extension module because this is only for testing ruby_add_suffix().
+
+ * LEGAL: remove the mention about a part of util.c, because now we
+ removed the part.
+
+ * io.c (argf_next_argv): now the new filename is not guaranteed to
+ use, so should check the return value of rename(2).
+
+ * test/ruby/test_argf.rb (TestArgf#test_inplace_rename_impossible):
+ now we expect same result with other platforms on no_safe_rename
+ platforms (=Windows).
+
+Wed Aug 3 09:18:08 2011 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * test/xmlrpc/webrick_testing.rb (WEBrick_Testing#start_server):
+ Like r32795, bind address should be specified.
+
+Wed Aug 3 07:46:30 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * encoding.c (enc_find): mistakenly remained !. [Bug #5150]
+
+Wed Aug 3 00:11:08 2011 Tanaka Akira <akr@fsij.org>
+
+ * lib/prettyprint.rb: update document. [ruby-core:36776]
+
+Tue Aug 2 22:04:46 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * gc.c (init_heap): allocate sigaltstack after heaps are allocated.
+ [ruby-dev:44315] [Bug #5139]
+
+ * vm.c (thread_free): use free because objspace is not ready.
+
+ * vm.c (th_init): use malloc because objspace is not ready.
+
+Tue Aug 2 20:10:16 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * test/testunit/test_parallel.rb: pass "--ruby" option to
+ test/testunit/tests_for_parallel/runner.rb. [Bug #5132] [ruby-dev:44303]
+
+Tue Aug 2 15:53:37 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * encoding.c (str_to_encoding): rename from to_encoding and
+ use str_to_encindex.
+
+ * encoding.c (str_to_encindex): split from to_encoding.
+
+ * encoding.c (rb_to_encoding): use str_to_encoding.
+
+ * encoding.c (rb_obj_encoding): don't bypass rb_encoding*.
+ If it uses rb_encoding*, it bypass encindex. If it uses encindex,
+ it doesn't bypass.
+
+ * encoding.c (enc_find): add shortcut for encoding object, use
+ str_to_encindex, and avoid bypass rb_encoding*.
+
+Tue Aug 2 12:03:16 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * hash.c (recursive_hash): hash value of emptied hash should be
+ equal to an empty hash. [ruby-core:38650]
+
+Tue Aug 2 11:42:15 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (rb_enc_symname2_p): :! is valid symbol. [Bug #5136]
+
+Tue Aug 2 07:33:29 2011 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * test/net/http/test_http.rb (TestNetHTTP_version_1_1_methods#test_timeout_during_HTTP_session):
+ If you connect to localhost, you should listen localhost.
+
+ * test/net/http/test_https.rb (TestNetHTTPS#test_timeout_during_SSL_handshake):
+ ditto.
+
+Tue Aug 2 06:18:15 2011 Luis Lavena <luislavena@gmail.com>
+
+ * lib/rubygems/installer.rb (class Gem): Correct path check on Windows
+ Possible fix for [Ruby 1.9 - Bug #5111]
+ * test/rubygems/test_gem_installer.rb (load Gem): ditto
+
+Mon Aug 1 20:12:03 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/ruby/test_process.rb (TestProcess#windows?): new method.
+
+ * test/ruby/test_process.rb (TestProcess#*): use above method.
+
+ * test/ruby/test_process.rb (TestProcess#test_execopts_redirect):
+ windows doesn't support FD_CLOEXEC.
+
+Mon Aug 1 15:45:23 2011 Eric Hodel <drbrain@segment7.net>
+
+ * test/rake/test_rake_functional.rb: Don't assume the binary name of
+ ruby is "ruby". [Ruby 1.9 - Bug #5114]
+ * test/rake/helper.rb: ditto
+
+Mon Aug 1 15:31:14 2011 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * test/io/console/test_io_console.rb (TestIO_Console#test_sync):
+ Skip when PTY allocation failed (that's not our fault).
+
+Mon Aug 1 15:04:12 2011 URABE Shyouhei <shyouhei@ruby-lang.org>
+
+ * test/xmlrpc/test_webrick_server.rb (Test_Webrick#setup_http_server):
+ XMLRPC::Client.new3(), when called without host: argument, tries
+ to connect to a host where "localhost" resolves to. On the
+ other hand a WEBrick::HTTPServer.new(), when called without
+ BindAddress: argument, tries to listen all the address where
+ getaddrinfo(AF_UNSPEC) resolves to. This is a mismatch because
+ "localhost" might not resolve to one of those listening sockets.
+ We would better explicitly specify "localhost" here and if
+ failed, just skip the whole test.
+
+Mon Aug 1 14:24:56 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc.rb: Import RDoc 3.9.1. Fixes bugs in the RDoc::Markup
+ parser.
+
+Mon Aug 1 12:00:35 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * insns.def (concatstrings): don't use initial ASCII-8BIT string.
+ [ruby-core:38635] [Bug #5126]
+
+Sun Jul 31 22:57:16 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * enc/Makefile.in (ECHO1): Same as the recent fix in common.mk.
+ ":" in a make variable replacement cause a syntax error with
+ /usr/ccs/bin/make on Solaris. Uses $(NULLCMD) instead.
+
+Sun Jul 31 21:16:02 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * complex.c (f_signbit): gcc4 on Solaris DOES have signbit but does
+ not have it on header.
+
+ * math.c: ditto.
+
+Sun Jul 31 21:09:04 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * common.mk (node_name.inc): Use $(Q) for consistency.
+
+ * Makefile.in (INSNS): ditto.
+
+Sun Jul 31 21:19:51 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * lib/mkmf.rb (configuration:ECHO1): Same as the recent fix in
+ common.mk.
+ ":" in a make variable replacement cause a syntax error with
+ /usr/ccs/bin/make on Solaris. Uses $(NULLCMD) instead.
+
+Sun Jul 31 20:39:12 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * common.mk (ECHO1): nmake does not allow parenthesis in make variable
+ replacement.
+
+Sun Jul 31 23:06:57 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * vm.c (check_env): print debug messages to stderr.
+ [Feature #4871] [ruby-dev:43743]
+
+Sun Jul 31 22:50:23 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * vm.c (vm_make_env_each): don't save prev env value.
+ It is no longer used. [Feature #4871] [ruby-dev:43743]
+
+ * vm.c (check_env): changed accordingly.
+
+Sun Jul 31 20:21:36 2011 "Yuki Sonoda (Yugui)" <yugui@yugui.jp>
+
+ * common.mk (ECHO1): ":" in a make variable replacement cause a syntax
+ error with /usr/ccs/bin/make on Solaris. Uses $(NULLCMD) instead.
+
+ * configure.in (NULLCMD): new check.
+
+ * Makefile.in (NULLCMD): Reflects checking in configure.
+
+ * win32/Makefile.sub (NULLCMD): new assignment.
+
+Sun Jul 31 18:58:59 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (rb_pipe): pipe on cygwin can succeed half but fail
+ half.
+
+Sun Jul 31 11:31:07 2011 Kazuki Tsujimoto <kazuki@callcc.net>
+
+ * vm.c: check if cfp is valid. [Bug #5083] [ruby-dev:44208]
+
+Sun Jul 31 09:18:28 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rdoc: Update to RDoc 3.9. Fixed `ri []`, stopdoc creating an
+ object reference, nodoc for class aliases, verbatim === lines.
+
+Sun Jul 31 01:29:08 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * io.c (rb_io_each_byte): remove unused variable e.
+
+Sat Jul 31 01:23:45 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * test/bigdecimal/test_bigdecimal.rb (test_version): removed.
+
+Sat Jul 30 23:19:09 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * defs/default_gems: separate from tool/rbinstall.rb.
+
+Sat Jul 30 23:14:44 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * io.c (rb_io_each_byte): rbuf can be refreshed during yield.
+ [Bug #5119]
+
+Sat Jul 30 22:35:50 2011 Naohisa Goto <ngotogenome@gmail.com>
+
+ * strftime.c (NEEDS): avoid SEGV due to integer overflow in
+ sparc-solaris2.10 and i686-linux. fix [Bug #4456] [ruby-dev:43284]
+
+Sat Jul 30 17:26:26 2011 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * test/win32ole/test_win32ole_variant.rb: use skip method to skip the test.
+
+ * test/win32ole/test_win32ole_variant_outarg.rb: ditto.
+
+Sat Jul 30 14:27:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/bigdecimal.c (BigDecimal_version): version 1.1.0.
+
+ * ext/bigdecimal/bigdecimal.gemspec: turn into a default gem.
+
+ * tool/rbinstall.rb: ditto.
+
+Sat Jul 30 11:21:55 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * vm_core.h (ALT_STACK_SIZE): use MINSIGSTKSZ*2 instead of SIGSTKSZ*2.
+ [ruby-core:38607]
+
+Sat Jul 30 10:39:14 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * vm.c (th_init): preallocate alternative stack.
+ NoMemoryError is better than rb_bug, of course.
+ Patch by Eric Wong. [ruby-core:38572][ruby-core:38594].
+
+ * signal.c (rb_register_sigaltstack): ditto.
+
+ * vm_core.h: moved ALT_STACK_SIZE definition from signal.c.
+ * vm.c (thread_free): use xfree() instead of free().
+
+Sat Jul 30 07:20:49 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/lib/socket.rb (udp_server_sockets): unused variable
+ removed.
+ patch by Jeremy Evans. [ruby-core:38600]
+
+Fri Jul 29 23:56:32 2011 Tanaka Akira <akr@fsij.org>
+
+ * lib/securerandom.rb: call OpenSSL::Random.seed at the
+ SecureRandom.random_bytes call.
+ based on the patch by Masahiro Tomita. [ruby-dev:44270]
+
+Fri Jul 29 23:53:48 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * array.c (rb_ary_set_len): new function to set array length.
+
+ * vm_eval.c (method_missing): set the length of argv array, to mark
+ arguments.
+
+ * vm_eval.c (rb_apply): get rid of too large alloca.
+
+Fri Jul 29 20:48:39 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/mkconstants.rb: fix typos.
+
+Fri Jul 29 20:28:56 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/mkconstants.rb: use whitespaces as a separator.
+
+Fri Jul 29 18:59:07 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/mkconstants.rb: add documents for constants.
+ patch by Eric Hodel. [ruby-core:37853] [Bug #4989]
+
+Fri Jul 29 16:00:43 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * configure.in (enable_pthread): use -pthread on OpenBSD without
+ explicit option. patched by Jeremy Evans. [ruby-core:38572]
+
+Thu Jul 28 23:36:28 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * ext/fiddle/closure.c (callback): use rb_ary_tmp_new() instead of
+ xmalloc() to allocate an array for arguments of callback procedure,
+ to prevent arguments from being swept by GC. [ruby-core:38546]
+ [Bug #4929]
+
+Thu Jul 28 22:36:06 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * ext/openssl/ossl_cipher.c (ossl_cipher_initialize): Avoid possible
+ SEGV from AES encryption/decryption. Processing data by
+ Cipher#update without initializing key (meaningless usage of Cipher
+ object since we don't offer a way to export a key) could cause SEGV.
+
+ In OpenSSL, 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. See
+ #2768.
+
+ * test/openssl/test_cipher.rb: test it.
+
+Thu Jul 28 14:25:08 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * lib/rubygems/user_interaction.rb (Gem::StreamUI#tty?): typo.
+
+Thu Jul 28 12:32:53 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/dl/callback/mkcallback.rb (gencallback): use PTR2NUM.
+
+ * ext/dl/cptr.c (rb_dlptr_aref, rb_dlptr_aset): check NULL pointer
+ dereference.
+
+ * ext/dl/cptr.c (rb_dlptr_s_to_ptr): use rb_check_funcall.
+
+ * ext/dl/cptr.c (rb_dlptr_s_to_ptr): fix wrapping condition.
+
+Thu Jul 28 04:53:31 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/delegate.rb: Move file-level documentation to the appropriate
+ classes.
+
+Thu Jul 28 02:15:04 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/dl/cfunc.c (dlcfunc_mark), ext/dl/cptr.c (dlptr_mark):
+ workaround to mark wrapped object. this is not a true fix,
+ because [Bug #4929] is caused by the interface design of DL.
+
+Thu Jul 28 00:28:15 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * test/fileutils/test_fileutils.rb: add OpenBSD case.
+ patched by Jeremy Evans [ruby-core:38530] see #5097
+
+ * test/ruby/test_process.rb: ditto.
+
+Wed Jul 27 22:46:59 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * test/rinda/test_rinda.rb (test_remote_array_and_hash):
+ add local variables to protect objects from GC. [ruby-dev:44253]
+ [Bug #5104]
+
+Wed Jul 27 17:55:54 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * include/ruby/missing.h: define __syscall if the platform has
+ __syscall in the library but doesn't define it in headers
+ for example Mac OS X.
+
+Wed Jul 27 15:39:14 2011 Eric Hodel <drbrain@segment7.net>
+
+ * object.c: Add usage documentation for BasicObject. Based on patch
+ by Thomas Sawyer. [Ruby 1.9 - Bug #5067]
+
+Wed Jul 27 12:24:17 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/uninstaller.rb: Add missing require and update
+ messaging to avoid confusion with uninstall --format-executable.
+ [Ruby 1.9 - Bug #4062]
+
+Wed Jul 27 09:34:24 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems: Update to RubyGems 1.8.6.1.
+
+Wed Jul 27 09:27:59 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * test/openssl/test_pkcs12.rb: Add test and intermediate certificates.
+ [ Ruby 1.9 - Feature #3793 ] [ruby-core:32088]
+
+Wed Jul 27 01:05:32 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * eval_error.c (rb_print_undef_str): new function to raise
+ NameError for undefined method.
+
+ * load.c (rb_mod_autoload_p), object.c (rb_mod_const_get),
+ variable.c (rb_f_untrace_var, set_const_visibility), vm_method.c
+ (rb_mod_{remove,undef,alias}_method, set_method_visibility):
+ remove inadvertent symbol creation. based on the first patch by
+ Jeremy Evans at [ruby-core:38447]. [Feature #5089]
+
+ * vm_method.c (obj_respond_to): fix the respond_to_missing? override
+ case. based on the patch by Jeremy Evans at [ruby-core:38417].
+ [Feature #5072]
+
+ * parse.y (rb_check_id): make the given name a symbol or a string.
+ based on the second patch by Jeremy Evans at [ruby-core:38447]
+
+Wed Jul 27 00:50:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/lib/bigdecimal/util.rb (Rational#to_d):
+ zero or negative precision is error. fixes #5098.
+ [ruby-dev:44210]
+
+ * test/bigdecimal/test_bigdecimal_util.rb: add test for the above
+ change.
+
+Wed Jul 27 00:48:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/lib/bigdecimal/util.rb (Float#to_d): modified for
+ specifying precision. fixes #5098. [ruby-dev:44210]
+
+ * test/bigdecimal/test_bigdecimal_util.rb: add test for the above
+ change.
+
+Wed Jul 27 00:45:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/lib/bigdecimal/util.rb (Integer#to_d): added
+ for symmetry to BigDecimal() function with an Integer.
+ fixes #5098. [ruby-dev:44210]
+
+ * test/bigdecimal/test_bigdecimal_util.rb: add test for the above
+ change.
+
+Wed Jul 27 00:30:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * ext/bigdecimal/lib/bigdecimal/util.rb (BigDecimal#to_d): added
+ for adapting other Numeric subclasses. [ruby-dev:44245]
+
+ * test/bigdecimal/test_bigdecimal_util.rb: test for the above change.
+
+Wed Jul 27 00:27:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * bigdecimal/bigdecimal.c (VpDup) a new function for duplicating
+ a BigDecimal.
+
+ * bigdecimal/bigdecimal.c (BigDecimal_new): support generating a new
+ BigDecimal from another BigDecimal using BigDecimal global function
+ or constructor. [ruby-dev:44245]
+
+Tue Jul 26 23:33:24 2011 Igor Zubkov <igor.zubkov@gmail.com>
+
+ * array.c: Fix typo. https://github.com/ruby/ruby/pull/36
+
+Mon Jul 25 23:51:01 2011 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * proc.c: pre-allocate the unlinked_method_entry_list_entry struct to
+ avoid memory allocation during GC. based on a patch from Eric Wong.
+ [ruby-core:38498]
+
+Mon Jul 25 23:39:33 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * test/rake/test_rake_directory_task.rb (TestRakeDirectoryTask#
+ test_directory_win32): fixed wrong test.
+
+Mon Jul 25 22:36:11 2011 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * proc.c (struct METHOD), gc.c (gc_marks), vm_method.c
+ (rb_gc_mark_unlinked_live_method_entries): fix SEGV bug.
+ rb_method_entry_t was free'd even when the method is still on the
+ stack if it is BMETHOD (i.e., Method#call). This is because
+ rb_method_entry_t is embedded in struct METHOD. This commit
+ separates them and marks the live method entries.
+ See [ruby-core:38449] in detail. fix [Bug #5047] [ruby-core:38171]
+
+Mon Jul 25 22:14:37 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * lib/xmlrpc/client.rb: Fix possible HTTP header formatting failure by
+ 'Basic' header. Long username caused the base64 String truncation in
+ HTTP header which is not allowed. See #5046.
+
+ * test/xmlrpc/test_webrick_server.rb: test it.
+
+Mon Jul 25 15:04:33 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * ext/openssl/lib/openssl.rb: End of transition period introduced by
+ [ruby-dev:38018]. From the next version of 1.9.3, you should use
+ require "openssl"
+ instead of
+ require "openssl/ssl"
+ and
+ require "openssl/x509"
+
+Mon Jul 25 13:46:38 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * ext/openssl/lib/openssl/x509.rb: Cosmetic change: move definition
+ introduced in r30152 to x509-internal.rb.
+
+Mon Jul 25 13:09:42 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * ext/openssl/ossl_ssl.c (ossl_ssl_shutdown): Avoid randomly generated
+ SSLError from SSLSocket just after invoking SSLSocket#close.
+ OpenSSL's SSL_shutdown could try to send alert packet and it might
+ set SSLerr(global error stack) as the result. It causes the next
+ SSL read/write operation to fail by unrelated reason.
+
+ By design, we're ignoring any error at SSL_shutdown() so we clear
+ global error stack after SSL_shutdown is called. See #5039.
+
+Sun Jul 24 20:29:53 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/extconf.rb: refine the recvmsg test.
+
+Sun Jul 24 20:02:31 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/extconf.rb: fix the recvmsg test.
+
+Sun Jul 24 08:42:51 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/extconf.rb: test recvmsg allocates file descriptors for
+ fd passing even with MSG_PEEK.
+
+ * ext/socket/ancdata.c: use the above test result.
+
+Sun Jul 24 01:04:50 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/rubygems/specification.rb: Restore behavior of
+ Gem::Specification#loaded. [Ruby 1.9 - Bug #5032]
+
+Sun Jul 24 00:05:00 2011 Jeremy Evans <merch-redmine@jeremyevans.net>
+
+ * error.c (rb_name_error_str): new function to raise NameError
+ with the name string but not ID.
+
+ * object.c, proc.c, variable.c: more removal of inadvertent symbol
+ creation. [Feature #5079]
+
+Sat Jul 23 21:14:00 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/cmath.rb (cbrt): should return a real number if possible.
+
+Sat Jul 23 20:12:52 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * test/rake/test_rake_functional.rb (setup): Use __FILE__ for the base
+ directory. Current directory is not the top source directory when
+ the building process runs on other than there.
+
+ * test/rake/test_rake_rake_test_loader.rb: ditto.
+
+ * test/rake/test_rake_task_argument_parsing.rb
+ (test_terminal_width_using_hardcoded_80): hardcoded 80 is used
+ when app.unix? is false.
+
+Sat Jul 23 20:11:50 2011 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_core.c: an issue that is same as [ruby-dev:44071].
+ * ext/date/date_strftime.c: identical to [ruby-dev:44112].
+
+Sat Jul 23 19:12:53 2011 Masaki Suketa <masaki.suketa@nifty.ne.jp>
+
+ * test/win32ole/test_err_in_callback.rb (test_err_in_callback):
+ skip test if ADODB.connection is not available.
+
+Sat Jul 23 15:37:04 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * parse.y (rb_enc_symname_type): :$a!, @a! and so on are not
+ valid symbols, so they should be inspected with quotes.
+
+Sat Jul 23 17:06:25 2011 Tanaka Akira <akr@fsij.org>
+
+ * io.c (rb_update_max_fd): validate fd.
+
+ * ext/socket/rubysocket.h (rsock_discard_cmsg_resource): add
+ msg_peek_p argument for the declaration.
+
+ * ext/socket/ancdata.c (discard_cmsg): add msg_peek_p argument.
+ assume FreeBSD, NetBSD and MacOS X doesn't generate passed fd
+ when MSG_PEEK.
+ (rsock_discard_cmsg_resource): add msg_peek_p argument.
+ (bsock_recvmsg_internal): call rsock_discard_cmsg_resource with
+ msg_peek_p argument.
+
+ * ext/socket/unixsocket.c (unix_recv_io): call
+ rsock_discard_cmsg_resource with msg_peek_p argument.
+
+Sat Jul 23 14:38:28 2011 Eric Hodel <drbrain@segment7.net>
+
+ * test/rake*: Remove dependencies on flexmock and session gems.
+ [Ruby 1.9 - Bug #4987]
+
+Sat Jul 23 12:19:04 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (rb_check_id): take care of attrset ID created
+ implicitly by local ID. [Bug #5084]
+
+ * parse.y (rb_check_id): conversion condition was inverse.
+ [Bug #5084]
+
+Fri Jul 22 21:46:54 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * vm_insnhelper.c (vm_call_cfunc): added volatile for a workaround
+ of cfp consistency error problem on OS X 10.7 (Lion). It's
+ suspected llvm optimization bug.
+ [Bug #5074] [ruby-dev:44185]
+
+Fri Jul 22 21:18:20 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/uri/generic.rb (WFKV_): unroll the loop of regexp.
+
+ * lib/uri/generic.rb (URI.decode_www_form_component): ditto.
+
+Fri Jul 22 21:06:39 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * object.c (rb_mod_{const,cvar}_defined, rb_obj_ivar_defined):
+ avoid inadvertent symbol creation in reflection methods. based
+ on a patch by Jeremy Evans at [ruby-core:38367]. [Feature #5072]
+
+ * vm_method.c (rb_mod_method_defined)
+ (rb_mod_{public,private,protected}_method_defined)
+ (obj_respond_to): ditto.
+
+ * parse.y (rb_check_id): new function returns already interned ID
+ or 0.
+
+Fri Jul 22 20:44:49 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (rb_is_global_id, rb_is_attrset_id): add missing
+ predicates.
+
+Fri Jul 22 20:24:38 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * test/ruby/test_object.rb (TestObject#test_respond_to_missing):
+ 2nd argument of respond_to_missing? is not optional.
+
+Fri Jul 22 19:05:47 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * parse.y (rb_enc_symname2_p): get rid of potential out-of-bound
+ access.
+
+Fri Jul 22 13:55:59 2011 Eric Hodel <drbrain@segment7.net>
+
+ * lib/net/http.rb: Net::HTTP#finish is used to manually close
+ connections. [Ruby 1.9 - Bug #5045]
+
+Fri Jul 22 13:51:29 2011 Eric Hodel <drbrain@segment7.net>
+
+ * ext/readline/readline.c: Add examples for Readline.completion_proc=.
+ [Ruby 1.9 - Bug #5057]
+
+Fri Jul 22 13:03:12 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_hmac.c: Revert checking return type of
+ HMAC_Init_ex as it is not compatible with OpenSSL < 1.0.0.
+
+Fri Jul 22 12:10:21 2011 Eric Hodel <drbrain@segment7.net>
+
+ * tool/rbinstall.rb (default gems): Install executables into the fake
+ gem dir for Gem.bin_path. [#4485]
+
+Fri Jul 22 11:20:20 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_digest.c: Check return value of EVP_DigestInit_ex.
+ * ext/openssl/ossl_hmac.c: Check return value of HMAC_Init_ex.
+ Thanks, Jared Jennings, for the patch.
+ [ Ruby 1.9 - Bug #4944 ] [ruby-core:37670]
+
+Fri Jul 22 09:09:43 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * ext/openssl/ossl_engine.c: Avoid double free of ENGINE reference.
+ * test/openssl/test_engine.rb: Add a test for it.
+ Thanks to Ippei Obayashi for providing the patch.
+ [ Ruby 1.9 - Bug #5062 ] [ruby-dev:44173]
+
+Fri Jul 22 06:37:13 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * lib/csv.rb: Do not modify CSV.generate's argument [ruby-core:38356]
+
+Thu Jul 21 20:59:59 2011 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/ancdata.c (discard_cmsg): workaround for MacOS X Lion.
+
+Thu Jul 21 20:02:11 2011 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * thread.c (set_trace_func, thread_set_trace_func_m): reset tracing
+ state when set_trace_func hook is removed. This is workaround patch
+ to force to reset tracing state that is broken by continuation call.
+ a patch from James M. Lawrence. [Feature #4347] [ruby-core:34998]
+
+ * test/ruby/test_continuation.rb (class TestContinuation): add a test
+ for above. a patch from James M. Lawrence.
+
+Thu Jul 21 19:27:19 2011 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * node.c (dump_node): add today's knowledge. "init arguments (m)" and
+ "init arguments (p)" of compile.c indicates a Ruby code that
+ evaluates multiple assignments that is in method or block
+ parameters: def foo((m1,m2), (m3,m4), *r, (p1,p2), (p3,p4)); end
+ The former (init arguments (m)) evaluates the multiple assignments
+ before rest argument, that are (m1,m2) and (m3,m4). The letter
+ (init arguments (p)) does ones after rest argument, that are
+ (p1,p2) and (p3, p4).
+
+Thu Jul 21 18:11:07 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * enum.c (enum_inject): remove empty line to notify rdoc
+ Enumerable#reduce is alias. patched by milki@github.
+ https://github.com/ruby/ruby/pull/26
+
+Thu Jul 21 17:30:21 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * array.c (rb_ary_delete_at_m): use simple array literal in rdoc.
+ patched by samuel tonini. [ruby-core:38310] [Bug #5066]
+
+Thu Jul 21 17:14:21 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/webrick/httprequest.rb (WEBrick::HTTPRequest#each):
+ Allow HTTP/0.9 request which doesn't has any header or body.
+ patched by Felix Jodoin. [ruby-core:38040] [Bug #5022]
+
+Wed Jul 20 23:02:18 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * io.c (rb_update_max_fd): remove parentheses. they are not in
+ macro.
+
+Wed Jul 20 22:22:23 2011 Tanaka Akira <akr@fsij.org>
+
+ * include/ruby/intern.h (rb_update_max_fd): declaration moved from
+ internal.h.
+
+ * file.c: ditto.
+
+ * io.c: call rb_update_max_fd for each new fds.
+
+ * process.c: ditto.
+
+ * random.c: ditto.
+
+ * ruby.c: ditto.
+
+ * ext/io/console/console.c: ditto.
+
+ * ext/openssl/ossl_bio.c: ditto.
+
+ * ext/pty/pty.c: ditto.
+
+ * ext/socket/init.c: ditto.
+
+ * ext/socket/socket.c: ditto.
+
+ * ext/socket/ancdata.c: ditto.
+
+ * ext/socket/unixsocket.c: ditto.
+
+Wed Jul 20 15:16:22 2011 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ext/dl/handle.c (dlhandle_sym): clear previous error with dlerror()
+ before calling dlsym(). [ruby-dev:44091] [Bug #5021]
+
+Wed Jul 20 07:16:26 2011 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
+
+ * NEWS: mention Kernel#warn. [ruby-core:38119] [Feature #5029]
+
+Tue Jul 19 16:40:45 2011 TAKANO Mitsuhiro (takano32) <tak@no32.tk>
+
+ * cont.c (cont_save_thread): fix missing semicolon.
+
+Tue Jul 19 16:25:15 2011 Tanaka Akira <akr@fsij.org>
+
+ * io.c (UPDATE_MAXFD): removed.
+
+Tue Jul 19 16:07:45 2011 Tanaka Akira <akr@fsij.org>
+
+ * io.c (rb_update_max_fd): new function.
+
+ * internal.h (rb_update_max_fd): declare rb_update_max_fd.
+
+ * thread_pthread.c (rb_thread_create_timer_thread): update max fd when
+ timer thread pipe is created.
+
+Mon Jul 18 13:36:47 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych.rb: define a new BadAlias error class.
+
+ * ext/psych/lib/psych/visitors/to_ruby.rb: raise an exception when
+ deserializing an alias that does not exist.
+
+ * test/psych/test_merge_keys.rb: corresponding test.
+
+Mon Jul 18 00:00:46 2011 Shugo Maeda <shugo@ruby-lang.org>
+
+ * ext/curses/curses.c: added the new class Curses::Pad, which
+ supports scrolling. patch by Eric Hodel. [Feature #4896]
+ [ruby-core:37206]
+
+Sun Jul 17 16:26:40 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * error.c (rb_check_trusted): new function to check an object is
+ trusted.
+
+ * struct.c (rb_struct_modify), time.c (time_modify): check by the
+ above function to show proper class names. [Bug #5036]
+
+Sun Jul 17 15:30:04 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * error.c (rb_warn_m): accept multiple args in like puts. rdoc
+ patch by Erik Price at [ruby-core:38119]. [Feature #5029]
+
+Sun Jul 17 07:56:31 2011 Martin Bosslet <Martin.Bosslet@googlemail.com>
+
+ * test/openssl/test_ssl_session.rb: add PEM SSL session without TLS
+ extensions. Use this as the default for the tests to ensure
+ compatibility with OpenSSL 0.9.7.
+ [ Ruby 1.9 - Bug #4961 ] [ruby-core:37726]
+
+Sat Jul 16 17:29:20 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (RUBY_UNIVERSAL_ARCH): restore arch flag.
+ Bug #4977
+
+Sat Jul 16 06:27:51 2011 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * lib/uri/common.rb (module): Remove optional parser argument to
+ Kernel#URI
+ [ruby-core:38061]
+
+ * lib/uri/generic.rb (module): ditto
+
+Sat Jul 16 03:19:45 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (is_socket, is_console): add prototypes to fix compile
+ problem with gcc introduced at r32549.
+ reported by Jon Forums. [Bug #5030] [ruby-core:38079]
+
+Sat Jul 16 00:55:38 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * time.c (time_dup): used rb_obj_class() instead of CLASS_OF().
+ The patch is made by Kazuki Tsujimoto. [Bug #5012] [ruby-dev:44071]
+
+ * test/ruby/test_time.rb (TestTime#test_getlocal_dont_share_eigenclass):
+ added a new test for eigenclass of time object.
+
+Fri Jul 15 19:11:00 2011 Kenta Murata <mrkn@mrkn.jp>
+
+ * bignum.c (bigsub_int): add RB_GC_GUARD. This patch is made by
+ Makoto Kishimoto. fixes #4223 [ruby-dev:42907]
+
+ * bignum.c (bigadd_int): ditto.
+
+Fri Jul 15 14:27:53 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c, include/ruby/win32.h (rb_w32_io_cancelable_p): renamed
+ from rb_w32_has_cancel_io(). now it takes a parameter as fd to check
+ the fd is console or not, because we cannot cancel console input even
+ if we have cancel_io function.
+
+ * io.c (WAIT_FD_IN_WIN32): call above function instead of the old one,
+ so now we can kill the thread which calls STDIN.gets.
+ the problem was reported by ko1 via IRC.
+
+Fri Jul 15 09:10:41 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * ext/digest/sha2/sha2.c (SHA256_Update, SHA512_Update): avoid Bus
+ Error caused by unalignment access on Sparc-Solaris (and possibly on
+ other similar environment.) This patch just do memcpy always instead
+ of checking architecture. I see no perf drop on my 64bit env. For
+ more details, see #4320.
+
+ * test/digest/test_digest.rb: add test for unalignment access.
+
+Fri Jul 15 01:51:25 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * regint.h (PLATFORM_UNALIGNED_WORD_ACCESS): Power PC does not
+ allow unaligned word access.
+
+ * st.c (UNALIGNED_WORD_ACCESS): x86_64 allows unaligned word
+ access as well as i386.
+
+Thu Jul 14 12:19:34 2011 Hiroshi Nakamura <nahi@ruby-lang.org>
+
+ * ext/openssl/ossl.c (ossl_verify_cb): trap the exception from
+ verify callback of SSLContext and X509Store and make the
+ verification fail normally. Raising exception directly from callback
+ causes orphan resources in OpenSSL stack. Patched by Ippei Obayashi.
+ See #4445.
+
+ * test/openssl/test_ssl.rb
+ (test_exception_in_verify_callback_is_ignored): test it.
+
+Tue Jul 12 23:41:49 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * NEWS: add a description of Signal.trap change.
+
+Tue Jul 12 20:02:35 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * signal.c (reserved_signal_p): reverted a part of r32523.
+ chikanaga noticed trap(:CHLD) has some realworld usecase.
+ * test/ruby/test_signal.rb (TestSignal#test_reserved_signal):
+ ditto.
+
+Tue Jul 12 17:12:45 2011 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * vm_method.c (rb_add_method): should not call method_added hook
+ for undef operation. [Bug #5015]
+
+Tue Jul 12 16:58:44 2011 Shota Fukumori <sorah@tubusu.net>
+
+ * lib/test/unit.rb(Test::Unit::Options#process_args): Fix bug.
+ Fix process_args didn't return `@option` after r30939.
+
+Tue Jul 12 14:07:46 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * signal.c (install_sighandler): fixed a race.
+
+Tue Jul 12 13:49:32 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * signal.c (sig_trap): don't permit to change a signal handler which
+ the interpreter reserved.
+ * signal.c (reserved_signal_p): ditto.
+ [Bug #2616] [ruby-core:27625]
+
+ * test/ruby/test_signal.rb (TestSignal#test_reserved_signal):
+ added a test for reserved signal.
+
+Tue Jul 12 11:58:28 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/setup.mak: support x86-amd64 cross compile environment.
+
+Mon Jul 11 23:22:28 2011 Yutaka Kanemoto <kanemoto@ruby-lang.org>
+
+ * time.c: can't compile time.c on AIX due to missing declaration for
+ ffs(). It is declared in strings.h on AIX.
+
+Mon Jul 11 15:54:24 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * process.c: removed signal() macro. It's no longer used.
+
+Mon Jul 11 15:02:24 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * numeric.c (rb_num2ull): use FIX2LONG instead of FIX2ULONG. see
+ rb_num2ulong(). fixed the problem of ObjectSpace._id2ref of IL32LLP64
+ platforms, introduced at r32433.
+
+Mon Jul 11 05:38:05 2011 Yutaka Kanemoto <kanemoto@ruby-lang.org>
+
+ * thread_pthread.c (get_stack): need to adjust stack addr for
+ [Bug #1813] on AIX.
+
+Mon Jul 11 01:16:27 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c (rb_thread_create_timer_thread): removed
+ rb_disable_interrupt()/rb_enable_interrupt().
+ * vm_core.h: ditto.
+ * process.c (static void before_exec): ditto.
+ * process.c (static void after_exec): ditto.
+ [Bug #4765] [ruby-dev:43571]
+
+ * eval_intern.h: removed rb_trap_restore_mask().
+ * vm_eval.c (rb_throw_obj): ditto.
+ * eval.c (setup_exception): ditto.
+
+ * signal.c: removed trap_last_mask.
+ * signal.c (trap_restore_mask): removed.
+ * signal.c (init_sigchld): comment clarification why signal block
+ is needed. and removed trap_last_mask operation.
+ * signal.c (trap_ensure): removed trap_last_mask operation.
+
+ * signal.c (rb_disable_interrupt, rb_enable_interrupt): made
+ static and removed sigdelset(SIGVTALRM) and sigdelset(SIGSEGV).
+
+ * process.c (rb_syswait): removed implicit signal handler change.
+
+Sun Jul 10 23:49:12 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * docs/NEWS-1.9.3: moved from NEWS.
+
+ * docs/ChangeLog-1.9.3: merged ChangeLog for 1.9.3.
+
+ * NEWS: NEWS for 1.9.4 that describes changes since 1.9.3
+
+ * ChangeLog: new ChangeLog for 1.9.4.
+
+Sun Jul 10 23:30:52 2011 Yuki Sonoda (Yugui) <yugui@yugui.jp>
+
+ * version.h (RUBY_VERSION): ruby_1_9_3 branch was forked.
+
+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.1.0 b/doc/ChangeLog-2.1.0
new file mode 100644
index 0000000000..f80b2d6bd1
--- /dev/null
+++ b/doc/ChangeLog-2.1.0
@@ -0,0 +1,18060 @@
+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-YARV b/doc/ChangeLog-YARV
index cbc51c5593..529854586c 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
@@ -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 definision of
+ * yarvcore.h : move definition 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
@@ -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
@@ -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
diff --git a/doc/NEWS-2.0.0 b/doc/NEWS-2.0.0
new file mode 100644
index 0000000000..9ad7254317
--- /dev/null
+++ b/doc/NEWS-2.0.0
@@ -0,0 +1,531 @@
+# -*- rdoc -*-
+
+= NEWS for Ruby 2.0.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 1.9.3 release
+
+=== Language changes
+
+* Added keyword arguments.
+
+* Added %i and %I for symbol list creation (similar to %w and %W).
+
+* Default source encoding is changed to UTF-8. (was US-ASCII)
+
+* No warning for unused variables starting with '_'
+
+=== Core classes updates (outstanding ones only)
+
+* ARGF
+ * added method:
+ * added ARGF#codepoints and ARGF#each_codepoint, like the corresponding
+ methods for IO.
+
+* Array
+ * added method:
+ * added Array#bsearch for binary search.
+ * incompatible changes:
+ * random parameter of Array#shuffle! and Array#sample now
+ will be called with one argument, maximum value.
+ * when given Range arguments, Array#values_at now returns nil for each
+ value that is out-of-range.
+
+* Enumerable
+ * added method:
+ * added Enumerable#lazy method for lazy enumeration.
+
+* Enumerator
+ * added method:
+ * added Enumerator#size for lazy size evaluation.
+ * extended method:
+ * Enumerator.new accept an argument for lazy size evaluation.
+ * new class Enumerator::Lazy for lazy enumeration
+
+* ENV
+ * aliased method:
+ * ENV.to_h is a new alias for ENV.to_hash
+
+* Fiber
+ * incompatible changes:
+ * Fiber#resume cannot resume a fiber which invokes "Fiber#transfer".
+
+* File
+ * extended method:
+ * File.fnmatch? now expands braces in the pattern if
+ File::FNM_EXTGLOB option is given.
+
+* GC
+ * improvements:
+ * introduced the bitmap marking which suppresses to copy a memory page
+ with Copy-on-Write.
+ * introduced the non-recursive marking which avoids unexpected stack overflow.
+
+* GC::Profiler
+ * added method:
+ * added GC::Profiler.raw_data which returns raw profile data for GC.
+
+* Hash
+ * added method:
+ * added Hash#to_h as explicit conversion method, like Array#to_a.
+ * extended method:
+ * Hash#default_proc= can be passed nil to clear the default proc.
+
+* IO
+ * deprecated methods:
+ * IO#lines, #bytes, #chars and #codepoints are deprecated.
+
+* Kernel
+ * added method:
+ * added Kernel#Hash conversion method like Array() or Float().
+ * added Kernel#__dir__ which returns the absolute path of the
+ directory of the file from which this method is called.
+ * added Kernel#caller_locations which returns an array of
+ frame information objects.
+ * extended method:
+ * Kernel#warn accepts multiple args in like puts.
+ * Kernel#caller accepts second optional argument `n' which specify
+ required caller size.
+ * Kernel#to_enum and enum_for accept a block for lazy size evaluation.
+ * incompatible changes:
+ * system() and exec() closes non-standard file descriptors
+ (The default of :close_others option is changed to true by default.)
+ * respond_to? against a protected method now returns false unless
+ the second argument is true.
+ * __callee__ has returned to the original behavior, and now
+ returns the called name but not the original name in an
+ aliased method.
+ * Kernel#inspect does not call #to_s anymore
+ (it used to call redefined #to_s).
+
+* LoadError
+ * added method:
+ * added LoadError#path method to return the file name that could not be
+ loaded.
+
+* Module
+ * added method:
+ * added Module#prepend which is similar to Module#include,
+ however a method in the prepended module overrides the
+ corresponding method in the prepending module.
+ * added Module.prepended and Module.prepend_features, similar
+ to included and append_features.
+ * added Module#refine, which extends a class or module locally.
+ [experimental]
+ * extended method:
+ * Module#define_method accepts a UnboundMethod from a Module.
+ * Module#const_get accepts a qualified constant string, e.g.
+ Object.const_get("Foo::Bar::Baz")
+
+* Mutex
+ * added method:
+ * added Mutex#owned? which returns the mutex is held by current
+ thread or not. [experimental]
+ * incompatible changes:
+ * Mutex#lock, Mutex#unlock, Mutex#try_lock, Mutex#synchronize
+ and Mutex#sleep are no longer allowed to be used from trap handler
+ and raise a ThreadError in such case.
+ * Mutex#sleep may spurious wakeup. Check after wakeup.
+
+* NilClass
+ * added method:
+ * added nil.to_h which returns {}
+
+* ObjectSpace::WeakMap
+ * new low level class to hold weak references to objects.
+
+* Proc
+ * incompatible change:
+ * removed Proc#== and #eql? so two procs are == only when they are
+ the same object.
+
+* Process
+ * added method:
+ * added getsid for getting session id (unix only).
+
+* Range
+ * added method:
+ * added Range#size for lazy size evaluation.
+ * added Range#bsearch for binary search.
+
+* RubyVM (MRI specific)
+ * added RubyVM::InstructionSequence.of to get the instruction sequence
+ from a method or a block.
+ * added RubyVM::InstructionSequence#path, #absolute_path, #label,
+ #base_label and #first_lineno to retrieve information from where
+ the instruction sequence was defined.
+ * added Environment variables to specify stack usage:
+ * RUBY_THREAD_VM_STACK_SIZE: vm stack size used at thread creation.
+ default: 128KB (32bit CPU) or 256KB (64bit CPU).
+ * RUBY_THREAD_MACHINE_STACK_SIZE: machine stack size used at thread
+ creation. default: 512KB or 1024KB.
+ * 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.
+ These variables are checked only at launched time.
+ * added constant DEFAULT_PARAMS to get above default parameters.
+
+* Signal
+ * added method:
+ * added Signal.signame which returns signal name
+
+ * incompatible changes:
+ * Signal.trap raises ArgumentError when :SEGV, :BUS, :ILL, :FPE, :VTALRM
+ are specified.
+
+* String
+ * added method:
+ * added String#b returning a copied string whose encoding is ASCII-8BIT.
+ * change return value:
+ * String#lines now returns an array instead of an enumerator.
+ * String#chars now returns an array instead of an enumerator.
+ * String#codepoints now returns an array instead of an enumerator.
+ * String#bytes now returns an array instead of an enumerator.
+
+* Struct
+ * added method:
+ * added Struct#to_h returning values with keys corresponding to the
+ instance variable names.
+
+* Thread
+ * added method:
+ * added Thread#thread_variable_get for getting thread local variables
+ (these are different than Fiber local variables).
+ * added Thread#thread_variable_set for setting thread local variables.
+ * added Thread#thread_variables for getting a list of the thread local
+ variable keys.
+ * added Thread#thread_variable? for testing to see if a particular thread
+ variable has been set.
+ * added Thread.handle_interrupt as well as instance and singleton methods
+ pending_interrupt? for asynchronous handling of exceptions
+ * added Thread#backtrace_locations which returns similar information of
+ Kernel#caller_locations.
+ * new class Thread::Backtrace::Location to hold backtrace location
+ information. These are returned by Thread#backtrace_locations and
+ Kernel#caller_locations.
+ * incompatible changes:
+ * Thread#join and Thread#value now raises a ThreadError if target thread
+ is the current or main thread.
+
+* Time
+ * change return value:
+ * Time#to_s now returns US-ASCII encoding instead of BINARY.
+
+* TracePoint
+ * new class. This class is replacement of set_trace_func.
+ Easy to use and efficient implementation.
+
+* toplevel
+ * added method:
+ * added main.define_method which defines a global function.
+ * added main.using, which imports refinements into the current file or
+ eval string. [experimental]
+
+=== Core classes compatibility issues (excluding feature bug fixes)
+
+* Array#values_at
+
+ See above.
+
+* String#lines
+* String#chars
+* String#codepoints
+* String#bytes
+
+ These methods no longer return an Enumerator, although passing a
+ block is still supported for backwards compatibility.
+
+ Code like str.lines.with_index(1) { |line, lineno| ... } no longer
+ works because str.lines returns an array. Replace lines with
+ each_line in such cases.
+
+* IO#lines
+* IO#chars
+* IO#codepoints
+* IO#bytes
+* ARGF#lines
+* ARGF#chars
+* ARGF#bytes
+* StringIO#lines
+* StringIO#chars
+* StringIO#codepoints
+* StringIO#bytes
+* Zlib::GzipReader#lines
+* Zlib::GzipReader#bytes
+
+ These methods are deprecated in favor of each_line, each_byte,
+ each_char and each_codepoint.
+
+* Proc#==
+* Proc#eql?
+
+ These methods were removed. Two procs are == only when they are
+ the same object.
+
+* Fixnum
+* Bignum
+* Float
+
+ Fixnums, Bignums and Floats are frozen.
+
+* Signal.trap
+
+ See above.
+
+* Merge Onigmo.
+ https://github.com/k-takata/Onigmo
+
+* The :close_others option is true by default for system() and exec().
+ Also, the close-on-exec flag is set by default for all new file descriptors.
+ This means file descriptors doesn't inherit to spawned process unless
+ explicitly requested such as system(..., fd=>fd).
+
+* Kernel#respond_to? against a protected method now returns false
+ unless the second argument is true.
+
+* Kernel#respond_to_missing?
+* Kernel#initialize_clone
+* Kernel#initialize_dup
+
+ These methods are now private.
+
+* Thread#join, Thread#value
+
+ See above.
+
+* Mutex#lock, Mutex#unlock, Mutex#try_lock, Mutex#synchronize and Mutex#sleep
+
+ See above.
+
+=== Stdlib updates (outstanding ones only)
+
+* cgi
+ * Add HTML5 tag maker.
+ * CGI#header has been renamed to CGI#http_header and
+ aliased to CGI#header.
+ * When HTML5 tagmaker called, overwrite CGI#header,
+ CGI#header function is to create a <header> element.
+
+* CSV
+ * Removed CSV::dump and CSV::load to protect users from dangerous
+ serialization vulnerability
+
+* iconv
+ * Iconv has been removed. Use String#encode instead.
+
+* io/console
+ * new methods:
+ * added IO#cooked which sets the terminal to cooked mode within the given block.
+ * added IO#cooked! which sets the terminal to cooked.
+ * extended method:
+ * IO#raw, IO#raw!, and IO#getch accept keyword arguments, :min and :time.
+
+* io/wait
+ * new features:
+ * added IO#wait_writable method.
+ * added IO#wait_readable method as alias of IO#wait.
+
+* json
+ * updated to 1.7.7.
+
+* net/http
+ * new features:
+ * Proxies are now automatically detected from the http_proxy environment
+ variable. See Net::HTTP::new for details.
+ * gzip and deflate compression are now requested for all requests by
+ default. See Net::HTTP for details.
+ * SSL sessions are now reused across connections for a single instance.
+ This speeds up connection by using a previously negotiated session.
+ * Requests may be created from a URI which sets the request_uri and host
+ header of the request (but does not change the host connected to).
+ * Responses contain the URI requested which allows easier implementation of
+ redirect following.
+ * new methods:
+ * Net::HTTP#local_host
+ * Net::HTTP#local_host=
+ * Net::HTTP#local_port
+ * Net::HTTP#local_port=
+ * extended method:
+ * Net::HTTP#connect uses local_host and local_port if specified.
+
+* net/imap
+ * new methods:
+ * Net::IMAP.default_port
+ * Net::IMAP.default_imap_port
+ * Net::IMAP.default_tls_port
+ * Net::IMAP.default_ssl_port
+ * Net::IMAP.default_imaps_port
+
+* objspace
+ * new method:
+ * ObjectSpace.reachable_objects_from(obj)
+
+* openssl
+ * Consistently raise an error when trying to encode nil values. All instances
+ of OpenSSL::ASN1::Primitive now raise TypeError when calling to_der on an
+ instance whose value is nil. All instances of OpenSSL::ASN1::Constructive
+ raise NoMethodError in the same case. Constructing such values is still
+ permitted.
+ * TLS 1.1 & 1.2 support by setting OpenSSL::SSL::SSLContext#ssl_version to
+ :TLSv1_2, :TLSv1_2_server, :TLSv1_2_client or :TLSv1_1, :TLSv1_1_server
+ :TLSv1_1_client. The version being effectively used can be queried
+ with OpenSSL::SSL#ssl_version. Furthermore, it is also possible to
+ blacklist the new TLS versions with OpenSSL::SSL:OP_NO_TLSv1_1 and
+ OpenSSL::SSL::OP_NO_TLSv1_2.
+ * Added OpenSSL::SSL::SSLContext#renegotiation_cb. A user-defined callback
+ may be set which gets called whenever a new handshake is negotiated. This
+ also allows to programmatically decline (client) renegotiation attempts.
+ * Support for "0/n" splitting of records as BEAST mitigation via
+ OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS.
+ * The default options for OpenSSL::SSL::SSLContext have changed to
+ OpenSSL::SSL::OP_ALL & ~OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS
+ instead of OpenSSL::SSL::OP_ALL only. This enables the countermeasure for
+ the BEAST attack by default.
+ * OpenSSL requires passwords for decrypting PEM-encoded files to be at least
+ four characters long. This led to awkward situations where an export with
+ a password with fewer than four characters was possible, but accessing the
+ file afterwards failed. OpenSSL::PKey::RSA, OpenSSL::PKey::DSA and
+ OpenSSL::PKey::EC therefore now enforce the same check when exporting a
+ private key to PEM with a password - it has to be at least four characters
+ long.
+ * SSL/TLS support for the Next Protocol Negotiation extension. Supported
+ with OpenSSL 1.0.1 and higher.
+ * OpenSSL::OPENSSL_FIPS allows client applications to detect whether OpenSSL
+ is FIPS-enabled. OpenSSL.fips_mode= allows turning on and off FIPS mode
+ manually in order to adapt to situations where FIPS mode would be an
+ explicit requirement.
+ * Authenticated Encryption with Associated Data (AEAD) is supported via
+ Cipher#auth_data= and Cipher#auth_tag/Cipher#auth_tag=.
+ Currently (OpenSSL 1.0.1c), only GCM mode is supported.
+
+* ostruct
+ * new methods:
+ * OpenStruct#[], []=
+ * OpenStruct#each_pair
+ * OpenStruct#eql?
+ * OpenStruct#hash
+ * OpenStruct#to_h converts the struct to a hash.
+ * extended method:
+ * OpenStruct.new also accepts an OpenStruct / Struct.
+
+* pathname
+ * extended method:
+ * Pathname#find returns an enumerator if no block is given.
+
+* rake
+ * rake has been updated to version 0.9.5.
+
+ This version is backwards-compatible with previous rake versions and
+ contains many bug fixes.
+
+ See
+ http://rake.rubyforge.org/doc/release_notes/rake-0_9_5_rdoc.html for a list
+ of changes in rake 0.9.3, 0.9.4 and 0.9.5.
+
+* RDoc
+ * RDoc has been updated to version 4.0
+
+ This version is largely backwards-compatible with previous rdoc versions.
+ The most notable change is an update to the ri data format (ri data must
+ be regenerated for gems shared across rdoc versions). Further API changes
+ are internal and won't affect most users.
+
+ Notable changes include:
+
+ * Page support for ri. Try `ri ruby:` for a list of pages in ruby or
+ `ri ruby:syntax/literals` for the syntax documentation for literals.
+
+ This also works for gems such as `ri rspec:README` for the rspec gem's
+ README file.
+ * Markdown support. See ri RDoc::Markdown for details.
+
+ See https://github.com/rdoc/rdoc/blob/master/History.rdoc for a full list
+ of changes in rdoc 4.0.
+
+* resolv
+ * new methods:
+ * Resolv::DNS#timeouts=
+ * Resolv::DNS::Config#timeouts=
+
+* rexml
+ * REXML::Document#write supports Hash arguments.
+ * REXML::Document#write supports new :encoding option. It changes
+ XML document encoding. Without :encoding option, encoding in
+ XML declaration is used for XML document encoding.
+
+* RubyGems
+ * Updated to 2.0.0
+
+ RubyGems 2.0.0 features the following improvements:
+
+ * Improved support for default gems shipping with ruby 2.0.0+
+ * A gem can have arbitrary metadata through Gem::Specification#metadata
+ * `gem search` now defaults to --remote and is anchored like gem list.
+ * Added --document to replace --rdoc and --ri. Use --no-document to
+ disable documentation, --document=rdoc to only generate rdoc.
+ * Only ri-format documentation is generated by default.
+ * `gem server` uses RDoc::Servlet from RDoc 4.0 to generate HTML
+ documentation.
+
+ For an expanded list of updates and bug fixes see:
+ https://github.com/rubygems/rubygems/blob/master/History.txt
+
+* shellwords
+ * Shellwords#shellescape now stringifies the given object using to_s.
+ * Shellwords#shelljoin accepts non-string objects in the given
+ array, each of which is stringified using to_s.
+
+* stringio
+ * deprecated methods:
+ * StringIO#lines, #bytes, #chars and #codepoints are deprecated.
+
+* syslog
+ * Added Syslog::Logger which provides a Logger API atop Syslog.
+ * Syslog::Priority, Syslog::Level, Syslog::Option and Syslog::Macros
+ are introduced for easy detection of available constants on a
+ running system.
+
+* tmpdir
+ * incompatible changes:
+ * Dir.mktmpdir uses FileUtils.remove_entry instead of
+ FileUtils.remove_entry_secure. This means that applications should not
+ change the permission of the created temporary directory to make
+ accessible from other users.
+
+* yaml
+ * Syck has been removed. YAML now completely depends on libyaml being
+ installed.
+ * libyaml is now bundled with ruby, for cases where the library is not
+ installed locally.
+
+* zlib
+ * Added streaming support for Zlib::Inflate and Zlib::Deflate. This allows
+ processing of a stream without the use of large amounts of memory.
+ * Added support for the new deflate strategies Zlib::RLE and Zlib::FIXED.
+ * Zlib streams are now processed without the GVL. This allows gzip, zlib and
+ deflate streams to be processed in parallel.
+ * deprecated methods:
+ * Zlib::GzipReader#lines and #bytes are deprecated.
+
+=== Stdlib compatibility issues (excluding feature bug fixes)
+
+* OpenStruct new methods can conflict with custom attributes named
+ "each_pair", "eql?", "hash" or "to_h".
+
+* Dir.mktmpdir in lib/tmpdir.rb
+
+ See above.
+
+=== C API updates
+
+* NUM2SHORT() and NUM2USHORT() added. They are similar to NUM2INT, but short.
+
+* rb_newobj_of() and NEWOBJ_OF() added. They create a new object of a given class.
+
diff --git a/doc/NEWS-2.1.0 b/doc/NEWS-2.1.0
new file mode 100644
index 0000000000..5d4152b8dc
--- /dev/null
+++ b/doc/NEWS-2.1.0
@@ -0,0 +1,376 @@
+# -*- 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/contributing.rdoc b/doc/contributing.rdoc
new file mode 100644
index 0000000000..c6ccc68302
--- /dev/null
+++ b/doc/contributing.rdoc
@@ -0,0 +1,466 @@
+= Contributing to Ruby
+
+Ruby has a vast and friendly community with hundreds of people contributing to
+a thriving open-source ecosystem. This guide is designed to cover ways for
+participating in the development of CRuby.
+
+There are plenty of ways for you to help even if you're not ready to write
+code or documentation. You can help by reporting issues, testing patches, and
+trying out beta releases with your applications.
+
+== How To Report
+
+If you've encountered a bug in Ruby please report it to the redmine issue
+tracker available at {bugs.ruby-lang.org}[http://bugs.ruby-lang.org/]. Do not
+report security vulnerabilities here, there is a {separate
+channel}[rdoc-label:label-Reporting+Security+Issues] for them.
+
+There are a few simple steps you should follow in order to receive feedback
+on your ticket.
+
+* If you haven't already,
+ {sign up for an account}[https://bugs.ruby-lang.org/account/register] on the
+ bug tracker.
+* Try the latest version.
+
+ If you aren't already using the latest version, try installing a newer
+ stable release. See
+ {Downloading Ruby}[http://www.ruby-lang.org/en/downloads/].
+* Look to see if anyone already reported your issue, try
+ {searching on redmine}[https://bugs.ruby-lang.org/projects/ruby-trunk/issues]
+ for your problem.
+* If you can't find a ticket addressing your issue,
+ {create a new one}[https://bugs.ruby-lang.org/projects/ruby-trunk/issues/new].
+* Choose the target version, usually current. Bugs will be first fixed in the
+ current release and then {backported}[rdoc-label:label-Backport+Requests].
+* Fill in the Ruby version you're using when experiencing this issue
+ (<code>ruby -v</code>).
+* Attach any logs or reproducible programs to provide additional information.
+ Reproducible scripts should be as small as possible.
+* Briefly describe your problem. A 2-3 sentence description will help give a
+ quick response.
+* Pick a category, such as core for common problems, or lib for a standard
+ library.
+* Check the {Maintainers
+ list}[https://bugs.ruby-lang.org/projects/ruby/wiki/Maintainers] and assign
+ the ticket if there is an active maintainer for the library or feature.
+* If the ticket doesn't have any replies after 10 days, you can send a
+ reminder.
+* 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 reports downstream issues for the following distributions via their bugtracker:
+
+* {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 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
+affect many users. There is a private mailing list that all security issues
+should be reported to and will be handled discretely. Email the
+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'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'll find lots
+of delinquent bugs that require attention.
+
+You can help by verifying the existing tickets, try to reproduce the reported
+issue on your own and comment if you still experience the bug. Some issues
+lack attention because of too much ambiguity, to help you can narrow down the
+problem and provide more specific details or instructions to reproduce the
+bug. You might also try contributing a failing test in the form of a patch,
+which we will cover later in this guide.
+
+It may also help to try out patches other contributors have submitted to
+redmine, if gone without notice. In this case the +patch+ command is your
+friend, see <code>man patch</code> for more information. Basically this would
+go something like this:
+
+ cd path/to/ruby/trunk
+ patch -p0 < path/to/patch
+
+You will then be prompted to apply the patch with the associated files. After
+building ruby again, you should try to run the tests and verify if the change
+actually worked or fixed the bug. It's important to provide valuable feedback
+on the patch that can help reach the overall goal, try to answer some of these
+questions:
+
+* What do you like about this change?
+* What would you do differently?
+* Are there any other edge cases not tested?
+* Is there any documentation that would be affected by this change?
+
+If you can answer some or all of these questions, you're on the right track.
+If your comment simply says "+1", then odds are that other reviewers aren't
+going to take it too seriously. Show that you took the time to review the
+patch.
+
+== How To Request Features
+
+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'
+tracker}[https://bugs.ruby-lang.org/projects/ruby-trunk/issues?set_filter=1&tracker_id=2]
+on ruby-trunk. For non-CRuby dependent features, features that would apply to
+alternate Ruby implementations such as JRuby and Rubinius, use the {CommonRuby
+tracker}[https://bugs.ruby-lang.org/projects/common-ruby].
+
+When writing a proposal be sure to check for previous discussions on the
+topic and have a solid use case. You will need to be persuasive and convince
+Matz on your new feature. You should also consider the potential compatibility
+issues that this new feature might raise.
+
+Consider making your feature into a gem, and if there are enough people who
+benefit from your feature it could help persuade ruby-core. Although feature
+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 feature proposal should look something like this:
+
+[Abstract]
+ Summary of your feature
+[Background]
+ Describe current behavior and why it is problem. Related work, such as
+ solutions in other language helps us to understand the problem.
+[Proposal]
+ Describe your proposal in details
+[Details]
+ If it has complicated feature, describe it
+[Usecase]
+ How would your feature be used? Who will benefit from it?
+[Discussion]
+ Discuss about this proposal. A list of pros and cons will help start
+ discussion.
+[Limitation]
+ Limitation of your proposal
+[Another alternative proposal]
+ If there are alternative proposals, show them.
+[See also]
+ Links to the other related resources
+
+=== Slideshow
+
+On Ruby Developer Meeting Japan, committers discuss about Feature Proposals together at Tokyo. We'll judge proposals accept, reject, or feedback. 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 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
+means only security related vulnerabilities will be backported. Versions in
+End-of-life (EOL) will not receive any updates and it is recommended you
+upgrade as soon as possible.
+
+If a major security issue is found or after a certain amount of time since the
+last patch level release, a new patch-level release will be made.
+
+When submitting a backport request please confirm the bug has been fixed in
+newer versions and exists in maintenance mode versions. There is a backport
+tracker for each major version still in maintenance where you can request a
+particular revision merged in the affected version of Ruby.
+
+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_0_0]
+ Chikanaga Tomoyuki (nagachika)
+[ruby_1_9_3]
+ NAKAMURA Usaku (usa)
+[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
+need to be able to run the test suite.
+
+CRuby uses subversion for source control, you can find installation
+instructions and lots of great info to learn subversion on the
+{svnbook.red-bean.com}[http://svnbook.red-bean.com/]. For other resources see
+the {ruby-core documentation on
+ruby-lang.org}[http://www.ruby-lang.org/en/community/ruby-core/].
+
+This guide will use git for contributing. The {git
+homepage}[http://git-scm.com/] has installation instructions with links to
+documentation for learning more about git. There is a mirror of the subversion
+repository on {github}[https://github.com/ruby/ruby].
+
+Install the prerequisite dependencies for building the CRuby interpreter to
+run tests.
+
+* C compiler
+* autoconf
+* bison
+* gperf
+* ruby - Ruby itself is prerequisite in order to build Ruby from source. It
+ can be 1.8.
+
+You should also have access to development headers for the following
+libraries, but these are not required:
+
+* Tcl/Tk
+* NDBM/QDBM
+* GDBM
+* OpenSSL
+* readline/editline(libedit)
+* zlib
+* libffi
+* libyaml
+* libexecinfo (FreeBSD)
+
+Now let's build CRuby:
+
+* Checkout the CRuby source code:
+
+ git clone git://github.com/ruby/ruby.git ruby-trunk
+
+* Generate the configuration files and build:
+
+ cd ruby-trunk
+ 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=~/.rubies/ruby-trunk
+ make && make install
+
+After adding Ruby to your PATH, you should be ready to run the test suite:
+
+ make test
+
+You can also use +test-all+ to run all of the tests with the RUNRUBY
+interpreter just built. Use TESTS or RUNRUBYOPT to pass parameters, such as:
+
+ make test-all TESTS=-v
+
+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'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:
+
+ git clone git://github.com/ruby/ruby.git --branch ruby_1_9_3
+
+== Contributing Documentation
+
+If you're interested in contributing documentation directly to CRuby there is
+a wealth of information available at
+{documenting-ruby.org}[http://documenting-ruby.org/].
+
+There is also the {Ruby Reference
+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
+
+Now create a dedicated branch:
+
+ cd ruby-trunk
+ git checkout -b my_new_branch
+
+The name of your branch doesn't really matter because it will only exist on
+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)
+* Indent 2 space tabs for Ruby
+* Do not use TABs in ruby codes
+* ANSI C style for 1.9+ for function declarations
+* Follow C90 (not C99) Standard
+* PascalStyle for class/module names.
+* UNDERSCORE_SEPARATED_UPPER_CASE for other constants.
+* Capitalize words.
+* 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>
+
+ * filename (function): short description of this commit.
+ This should include your intention of this change.
+ [bug:#number] [mailinglist:number]
+
+ * filename2 (function2): additional description for this file/function.
+
+This follows {GNU Coding Standards for Change
+Logs}[http://www.gnu.org/prep/standards/html_node/Change-Logs.html#Change-Logs],
+some other requirements and tips:
+
+* Timestamps must be in JST (+09:00) in the style as above.
+* Two spaces between the timestamp and your name. Two spaces between
+ your name and your mail address.
+* One blank line between the timestamp and the description.
+* Indent the description with TAB. 2nd line should begin with TAB+2SP.
+* Write a entry (*) for each change.
+* Refer to redmine issue or discussion on the mailing list.
+* For GitHub issues, use [GH-#] (such as [Fixes GH-234]
+* One blank line between entries.
+* Do as other committers do.
+
+You can generate the ChangeLog entry by running <code>make change</code>
+
+When you're ready to commit, copy your ChangeLog entry into the commit message,
+keeping the same formatting and select your files:
+
+ git commit ChangeLog path/to/files
+
+In the likely event that your branch becomes outdated, you will have to update
+your working branch:
+
+ git fetch origin
+ git rebase remotes/origin/master
+
+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.
+here. You will only need a github account if you intend to host your repository
+on github.
+
+Next copy the writable url for your fork and add it as a git remote, replace
+"my_username" with your github account name:
+
+ git remote add my_fork git@github.com:my_username/ruby.git
+ # Now we can push our branch to our fork
+ git push my_fork my_new_branch
+
+In order to generate a patch that you can upload to the bug tracker, we can use
+the github interface to review our changes just visit
+https://github.com/my_username/ruby/compare/trunk...my_new_branch
+
+Next, you can simply add '.patch' to the end of this URL and it will generate
+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 {publically 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
new file mode 100644
index 0000000000..96fe887e4e
--- /dev/null
+++ b/doc/contributors.rdoc
@@ -0,0 +1,778 @@
+= Contributors to Ruby
+
+The following list might be imcomplete. 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
new file mode 100644
index 0000000000..a1e0fff3b0
--- /dev/null
+++ b/doc/dtrace_probes.rdoc
@@ -0,0 +1,178 @@
+= 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:::function-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 "function-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:::function-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:::function-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:::function-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/globals.rdoc b/doc/globals.rdoc
index 060764f54e..3bc7e05623 100644
--- a/doc/globals.rdoc
+++ b/doc/globals.rdoc
@@ -22,7 +22,8 @@ $_:: The last input line of string by gets or readline.
$0:: Contains the name of the script being executed. May be assignable.
$*:: Command line arguments given for the script sans args.
$$:: The process number of the Ruby running this script.
-$?:: The status of the last executed child process.
+$?:: The status of the last executed child process. This value is
+ thread-local.
$::: Load path for scripts and binary modules by load or require.
$":: The array contains the module names loaded by require.
$DEBUG:: The debug flag, which is set by the -d switch. Enabling debug
@@ -30,6 +31,7 @@ $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.
@@ -41,7 +43,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 discusison.
+$-d:: The alias of $DEBUG. See $DEBUG above for further discussion.
$-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.rd.ja b/doc/irb/irb.rd.ja
index 6c213a178c..416dec3906 100644
--- a/doc/irb/irb.rd.ja
+++ b/doc/irb/irb.rd.ja
@@ -12,7 +12,7 @@ irbはinteractive rubyの略です. rubyの式を標準入力から簡単に入
% irb
-で行ないます.
+で行ないます.
= 使い方
@@ -30,7 +30,7 @@ irbの使い方は, Rubyさえ知っていればいたって簡単です. 基本
irb(main):005:2> end
irb(main):006:1> end
nil
- irb(main):007:0>
+ irb(main):007:0>
また, irbはReadlineモジュールにも対応しています. Readlineモジュールが
インストールされている時には, それを使うのが標準の動作になります.
@@ -48,19 +48,19 @@ irbの使い方は, Rubyさえ知っていればいたって簡単です. 基本
--noverbose これから実行する行を表示しない
--echo 実行結果を表示する(デフォルト)
--noecho 実行結果を表示しない
- --inspect 結果出力にinspectを用いる(bcモード以外はデフォルト).
+ --inspect 結果出力にinspectを用いる(bcモード以外はデフォルト).
--noinspect 結果出力にinspectを用いない.
--readline readlineライブラリを利用する.
--noreadline readlineライブラリを利用しない. デフォルトの動作は,
inf-ruby-mode以外でreadlineライブラリを利用しよう
- とする.
+ とする.
--prompt prompt-mode
--prompt-mode prompt-mode
プロンプトモードを切替えます. 現在定義されているプ
ロンプトモードは, default, simple, xmp, inf-rubyが
用意されています. デフォルトはdefaultプロンプトモー
ドになっています.
-
+
--inf-ruby-mode emacsのinf-ruby-mode用のプロンプト表示を行なう. 特
に指定がない限り, readlineライブラリは使わなくなる.
--simple-prompt
@@ -69,7 +69,7 @@ irbの使い方は, Rubyさえ知っていればいたって簡単です. 基本
--tracer コマンド実行時にトレースを行なう.
--back-trace-limit n
バックトレース表示をバックトレースの頭から n, 後ろ
- からnだけ行なう. デフォルトは16
+ からnだけ行なう. デフォルトは16
--irb_debug n irbのデバッグデバッグレベルをnに設定する(利用しな
い方が無難でしょう).
-v, --version irbのバージョンを表示する
@@ -96,14 +96,14 @@ irb起動時に``~/.irbrc''を読み込みます. もし存在しない場合は
IRB.conf[:USE_TRACER] = false
IRB.conf[:IGNORE_SIGINT] = true
IRB.conf[:IGNORE_EOF] = false
- IRB.conf[:PROMPT_MODE] = :DEFALUT
+ IRB.conf[:PROMPT_MODE] = :DEFAULT
IRB.conf[:PROMPT] = {...}
IRB.conf[:DEBUG_LEVEL]=0
IRB.conf[:VERBOSE]=true
== プロンプトの設定
-プロンプトをカスタマイズしたい時には,
+プロンプトをカスタマイズしたい時には,
IRB.conf[:PROMPT]
@@ -145,7 +145,7 @@ PROMPT_I, PROMPT_N, PROMPT_S, PROMPT_Cは, フォーマットを指定します.
:PROMPT_S => "%N(%m):%03n:%i%l ",
:PROMPT_C => "%N(%m):%03n:%i* ",
:RETURN => "%s\n"
- }
+ }
となっています.
@@ -167,34 +167,34 @@ procをirbのコンテキストを引数として呼び出します. これに
irb拡張コマンドは, 簡単な名前と頭に`irb_'をつけた名前と両方定義されて
います. これは, 簡単な名前がoverrideされた時のためです.
---- exit, quit, irb_exit
- 終了する.
+--- exit, quit, irb_exit
+ 終了する.
サブirbの場合, そのサブirbを終了する.
--- conf, irb_context
irbの現在の設定を表示する. 設定の変更は, confにメッセージを送るこ
- とによって行なえる.
+ とによって行なえる.
--- conf.eval_history = N
実行結果のヒストリ機能の設定.
nnは整数かnilで nn>0 であればその数だけヒストリにためる。nn==0の時は
- 無制限に記憶する、nilだとヒストリ機能はやめる(デフォルト).
+ 無制限に記憶する、nilだとヒストリ機能はやめる(デフォルト).
--- Conf.back_trace_limit
バックトレース表示をバックトレースの頭からn, 後ろからnだけ行なう.
デフォルトは16
-
+
--- conf.debug_level = N
irb用のデバッグレベルの設定
--- conf.ignore_eof = true/false
^Dが入力された時の動作を設定する. trueの時は^Dを無視する, falseの
- 時はirbを終了する.
+ 時はirbを終了する.
--- conf.ignore_sigint= true/false
^Cが入力された時の動作を設定する. false時は, irbを終了する. trueの
時の動作は以下のようになる:
- 入力中: これまで入力したものをキャンセルしトップレベルに戻る.
+ 入力中: これまで入力したものをキャンセルしトップレベルに戻る.
実行中: 実行を中止する.
--- conf.inf_ruby_mode = true/false
@@ -205,7 +205,7 @@ irb拡張コマンドは, 簡単な名前と頭に`irb_'をつけた名前と両
true: インスペクトして表示する.
false: 通常のprintで表示する.
nil: 通常モードであれば, inspect modeとなり, mathモードの時は, non
- inspect modeとなる.
+ inspect modeとなる.
--- conf.math_mode
参照のみ. bcモード(分数, 行列の計算ができます)かどうか?
@@ -234,7 +234,7 @@ irb拡張コマンドは, 簡単な名前と頭に`irb_'をつけた名前と両
true: readlineを使う.
false: readlineを使わない.
nil: (デフォルト)inf-ruby-mode以外でreadlineライブラリを利用しよ
- うとする.
+ うとする.
#
#--- conf.verbose=T/F
# irbからいろいろなメッセージを出力するか?
@@ -276,9 +276,9 @@ irb拡張コマンドは, 簡単な名前と頭に`irb_'をつけた名前と両
= システム変数
---- _
+--- _
前の計算の実行結果を覚えている(ローカル変数).
---- __
+--- __
実行結果の履歴を覚えている.
__[line_no]で、その行で実行した結果を得ることができる. line_noが負の
時には、最新の結果から-line_no前の結果を得ることができる.
@@ -321,7 +321,7 @@ irb拡張コマンドは, 簡単な名前と頭に`irb_'をつけた名前と両
nil
irb#2(Foo):010:0> Foo.instance_methods
["bar", "foo"]
- irb#2(Foo):011:0> fg 0
+ irb#2(Foo):011:0> fg 0
nil
irb(main):007:0> f = Foo.new
#<Foo:0x4010af3c>
@@ -343,7 +343,7 @@ irb拡張コマンドは, 簡単な名前と頭に`irb_'をつけた名前と両
#0->irb on main (#<Thread:0x400fb7e4> : running)
nil
irb(main):010:0> exit # 終了
- dim%
+ dim%
= 使用上の制限
@@ -372,11 +372,11 @@ rubyでは, 以下のプログラムはエラーになります.
となり, エラーを起こしません. これは, rubyが最初にスクリプト全体をコン
パイルしてローカル変数を決定するからです. それに対し, irbは実行可能に
-なる(式が閉じる)と自動的に評価しているからです. 上記の例では,
+なる(式が閉じる)と自動的に評価しているからです. 上記の例では,
- evel "foo = 0"
+ evel "foo = 0"
-を行なった時点で評価を行ない, その時点で変数が定義されるため, 次式で
+を行なった時点で評価を行ない, その時点で変数が定義されるため, 次式で
変数fooは定義されているからです.
このようなrubyとirbの動作の違いを解決したい場合は, begin...endで括って
@@ -392,7 +392,7 @@ rubyでは, 以下のプログラムはエラーになります.
== ヒアドキュメント
-現在のところヒアドキュメントの実装は不完全です.
+現在のところヒアドキュメントの実装は不完全です.
== シンボル
diff --git a/doc/keywords.rdoc b/doc/keywords.rdoc
new file mode 100644
index 0000000000..98bbd5e864
--- /dev/null
+++ b/doc/keywords.rdoc
@@ -0,0 +1,158 @@
+== 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
new file mode 100644
index 0000000000..82b8004662
--- /dev/null
+++ b/doc/maintainers.rdoc
@@ -0,0 +1,322 @@
+= 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]
+ Hiroshi Nakamura (nahi)
+[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/telnet.rb]
+ _unmaintained_
+[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/marshal.rdoc b/doc/marshal.rdoc
new file mode 100644
index 0000000000..f97db00a49
--- /dev/null
+++ b/doc/marshal.rdoc
@@ -0,0 +1,313 @@
+= Marshal Format
+
+The Marshal format is used to serialize ruby objects. The format can store
+arbitrary objects through three user-defined extension mechanisms.
+
+For documentation on using Marshal to serialize and deserialize objects, see
+the Marshal module.
+
+This document calls a serialized set of objects a stream. The Ruby
+implementation can load a set of objects from a String, an IO or an object
+that implements a +getc+ method.
+
+== Stream Format
+
+The first two bytes of the stream contain the major and minor version, each as
+a single byte encoding a digit. The version implemented in Ruby is 4.8
+(stored as "\x04\x08") and is supported by ruby 1.8.0 and newer.
+
+Different major versions of the Marshal format are not compatible and cannot
+be understood by other major versions. Lesser minor versions of the format
+can be understood by newer minor versions. Format 4.7 can be loaded by a 4.8
+implementation but format 4.8 cannot be loaded by a 4.7 implementation.
+
+Following the version bytes is a stream describing the serialized object. The
+stream contains nested objects (the same as a Ruby object) but objects in the
+stream do not necessarily have a direct mapping to the Ruby object model.
+
+Each object in the stream is described by a byte indicating its type followed
+by one or more bytes describing the object. When "object" is mentioned below
+it means any of the types below that defines a Ruby object.
+
+=== true, false, nil
+
+These objects are each one byte long. "T" is represents +true+, "F"
+represents +false+ and "0" represents +nil+.
+
+=== Fixnum and long
+
+"i" represents a signed 32 bit value using a packed format. One through five
+bytes follows the type. The value loaded will always be a Fixnum. On
+32 bit platforms (where the precision of a Fixnum is less than 32 bits)
+loading large values will cause overflow on CRuby.
+
+The fixnum type is used to represent both ruby Fixnum objects and the sizes of
+marshaled arrays, hashes, instance variables and other types. In the
+following sections "long" will mean the format described below, which supports
+full 32 bit precision.
+
+The first byte has the following special values:
+
+"\x00"::
+ The value of the integer is 0. No bytes follow.
+
+"\x01"::
+ The total size of the integer is two bytes. The following byte is a
+ positive integer in the range of 0 through 255. Only values between 123
+ and 255 should be represented this way to save bytes.
+
+"\xff"::
+ The total size of the integer is two bytes. The following byte is a
+ negative integer in the range of -1 through -256.
+
+"\x02"::
+ The total size of the integer is three bytes. The following two bytes are a
+ positive little-endian integer.
+
+"\xfe"::
+ The total size of the integer is three bytes. The following two bytes are a
+ negative little-endian integer.
+
+"\x03"::
+ The total size of the integer is four bytes. The following three bytes are
+ a positive little-endian integer.
+
+"\xfd"::
+ The total size of the integer is two bytes. The following three bytes are a
+ negative little-endian integer.
+
+"\x04"::
+ The total size of the integer is five bytes. The following four bytes are a
+ positive little-endian integer. For compatibility with 32 bit ruby,
+ only Fixnums less than 1073741824 should be represented this way. For sizes
+ of stream objects full precision may be used.
+
+"\xfc"::
+ The total size of the integer is two bytes. The following four bytes are a
+ negative little-endian integer. For compatibility with 32 bit ruby,
+ only Fixnums greater than -10737341824 should be represented this way. For
+ sizes of stream objects full precision may be used.
+
+Otherwise the first byte is a sign-extended eight-bit value with an offset.
+If the value is positive the value is determined by subtracting 5 from the
+value. If the value is negative the value is determined by adding 5 to the
+value.
+
+There are multiple representations for many values. CRuby always outputs the
+shortest representation possible.
+
+=== Symbols and Byte Sequence
+
+":" represents a real symbol. A real symbol contains the data needed to
+define the symbol for the rest of the stream as future occurrences in the
+stream will instead be references (a symbol link) to this one. The reference
+is a zero-indexed 32 bit value (so the first occurrence of <code>:hello</code>
+is 0).
+
+Following the type byte is byte sequence which consists of a long indicating
+the number of bytes in the sequence followed by that many bytes of data. Byte
+sequences have no encoding.
+
+For example, the following stream contains the Symbol <code>:hello</code>:
+
+ "\x04\x08:\x0ahello"
+
+";" represents a Symbol link which references a previously defined Symbol.
+Following the type byte is a long containing the index in the lookup table for
+the linked (referenced) Symbol.
+
+For example, the following stream contains <code>[:hello, :hello]</code>:
+
+ "\x04\b[\a:\nhello;\x00"
+
+When a "symbol" is referenced below it may be either a real symbol or a
+symbol link.
+
+=== Object References
+
+Separate from but similar to symbol references, the stream contains only one
+copy of each object (as determined by #object_id) for all objects except
+true, false, nil, Fixnums and Symbols (which are stored separately as
+described above) a one-indexed 32 bit value will be stored and reused when the
+object is encountered again. (The first object has an index of 1).
+
+"@" represents an object link. Following the type byte is a long giving the
+index of the object.
+
+For example, the following stream contains an Array of the object
+<code>"hello"</code> twice:
+
+ "\004\b[\a\"\nhello@\006"
+
+=== Instance Variables
+
+"I" indicates that instance variables follow the next object. An object
+follows the type byte. Following the object is a length indicating the number
+of instance variables for the object. Following the length is a set of
+name-value pairs. The names are symbols while the values are objects. The
+symbols must be instance variable names (<code>:@name</code>).
+
+An Object ("o" type, described below) uses the same format for its instance
+variables as described here.
+
+For a String and Regexp (described below) a special instance variable
+<code>:E</code> is used to indicate the Encoding.
+
+=== Extended
+
+"e" indicates that the next object is extended by a module. An object follows
+the type byte. Following the object is a symbol that contains the name of the
+module the object is extended by.
+
+=== Array
+
+"[" represents an Array. Following the type byte is a long indicating the
+number of objects in the array. The given number of objects follow the
+length.
+
+=== Bignum
+
+"l" represents a Bignum which is composed of three parts:
+
+sign::
+ A single byte containing "+" for a positive value or "-" for a negative
+ value.
+length::
+ A long indicating the number of bytes of Bignum data follows, divided by
+ two. Multiply the length by two to determine the number of bytes of data
+ that follow.
+data::
+ Bytes of Bignum data representing the number.
+
+The following ruby code will reconstruct the Bignum value from an array of
+bytes:
+
+ result = 0
+
+ bytes.each_with_index do |byte, exp|
+ result += (byte * 2 ** (exp * 8))
+ end
+
+=== Class and Module
+
+"c" represents a Class object, "m" represents a Module and "M" represents
+either a class or module (this is an old-style for compatibility). No class
+or module content is included, this type is only a reference. Following the
+type byte is a byte sequence which is used to look up an existing class or
+module, respectively.
+
+Instance variables are not allowed on a class or module.
+
+If no class or module exists an exception should be raised.
+
+For "c" and "m" types, the loaded object must be a class or module,
+respectively.
+
+=== Data
+
+"d" represents a Data object. (Data objects are wrapped pointers from ruby
+extensions.) Following the type byte is a symbol indicating the class for the
+Data object and an object that contains the state of the Data object.
+
+To dump a Data object Ruby calls _dump_data. To load a Data object Ruby calls
+_load_data with the state of the object on a newly allocated instance.
+
+=== Float
+
+"f" represents a Float object. Following the type byte is a byte sequence
+containing the float value. The following values are special:
+
+"inf"::
+ Positive infinity
+
+"-inf"::
+ Negative infinity
+
+"nan"::
+ Not a Number
+
+Otherwise the byte sequence contains a C double (loadable by strtod(3)).
+Older minor versions of Marshal also stored extra mantissa bits to ensure
+portability across platforms but 4.8 does not include these. See
+[ruby-talk:69518] for some explanation.
+
+=== Hash and Hash with Default Value
+
+"{" represents a Hash object while "}" represents a Hash with a default value
+set (<code>Hash.new 0</code>). Following the type byte is a long indicating
+the number of key-value pairs in the Hash, the size. Double the given number
+of objects follow the size.
+
+For a Hash with a default value, the default value follows all the pairs.
+
+=== Module and Old Module
+
+=== Object
+
+"o" represents an object that doesn't have any other special form (such as
+a user-defined or built-in format). Following the type byte is a symbol
+containing the class name of the object. Following the class name is a long
+indicating the number of instance variable names and values for the object.
+Double the given number of pairs of objects follow the size.
+
+The keys in the pairs must be symbols containing instance variable names.
+
+=== Regular Expression
+
+"/" represents a regular expression. Following the type byte is a byte
+sequence containing the regular expression source. Following the type byte is
+a byte containing the regular expression options (case-insensitive, etc.) as a
+signed 8-bit value.
+
+Regular expressions can have an encoding attached through instance variables
+(see above). If no encoding is attached escapes for the following regexp
+specials not present in ruby 1.8 must be removed: g-m, o-q, u, y, E, F, H-L,
+N-V, X, Y.
+
+=== String
+
+'"' represents a String. Following the type byte is a byte sequence
+containing the string content. When dumped from ruby 1.9 an encoding instance
+variable (<code>:E</code> see above) should be included unless the encoding is
+binary.
+
+=== Struct
+
+"S" represents a Struct. Following the type byte is a symbol containing the
+name of the struct. Following the name is a long indicating the number of
+members in the struct. Double the number of objects follow the member count.
+Each member is a pair containing the member's symbol and an object for the
+value of that member.
+
+If the struct name does not match a Struct subclass in the running ruby an
+exception should be raised.
+
+If there is a mismatch between the struct in the currently running ruby and
+the member count in the marshaled struct an exception should be raised.
+
+=== User Class
+
+"C" represents a subclass of a String, Regexp, Array or Hash. Following the
+type byte is a symbol containing the name of the subclass. Following the name
+is the wrapped object.
+
+=== User Defined
+
+"u" represents an object with a user-defined serialization format using the
++_dump+ instance method and +_load+ class method. Following the type byte is
+a symbol containing the class name. Following the class name is a byte
+sequence containing the user-defined representation of the object.
+
+The class method +_load+ is called on the class with a string created from the
+byte-sequence.
+
+=== User Marshal
+
+"U" represents an object with a user-defined serialization format using the
++marshal_dump+ and +marshal_load+ instance methods. Following the type byte
+is a symbol containing the class name. Following the class name is an object
+containing the data.
+
+Upon loading a new instance must be allocated and +marshal_load+ must be
+called on the instance with the data.
+
diff --git a/doc/rake/CHANGES b/doc/rake/CHANGES
deleted file mode 100644
index 1caac6f024..0000000000
--- a/doc/rake/CHANGES
+++ /dev/null
@@ -1,440 +0,0 @@
-
-= Rake Changelog
-
-== Version 0.8.7
-
-* Fixed EXEEXT for JRuby on windows.
-
-== Version 0.8.6
-
-* Minor fixes to the RDoc generation (removed dependency on darkfish
- and removed inline source option).
-
-== Version 0.8.5
-
-* Better support for the system command on Windows.
-
-== Version 0.8.4
-
-* Preserve case when locating rakefiles (patch from James
- M. Lawrence/quix)
-
-* Better support for windows paths in the test task (patch from Simon
- Chiang/bahuvrihi)
-
-* Windows system dir search order is now: HOME, HOMEDRIVE + HOMEPATH,
- APPDATA, USERPROFILE (patch from Luis Lavena)
-
-* MingGW is now recognized as a windows platform. (patch from Luis
- Lavena)
-
-* Numerous fixes to the windows test suite (patch from Luis Lavena).
-
-* Improved Rakefile case insensitivity testing (patch from Luis
- Lavena).
-
-* Fixed stray ARGV option problem that was interfering with
- Test::Unit::Runner.
-
-* Fixed default verbose mode (was accidently changed to false).
-
-* Removed reference to manage_gem to fix the warning produced by the
- gem package task.
-
-== Version 0.8.3
-
-* Enhanced the system directory detection in windows. We now check
- HOMEDRIVE/HOMEPATH and USERPROFILE if APPDATA isn't found. (Patch
- supplied by James Tucker). Rake no long aborts if it can't find the
- directory.
-
-* Added fix to handle ruby installations in directories with spaces in
- their name.
-
-== Version 0.8.2
-
-* Fixed bug in package task so that it will include the subdir
- directory in the package for testing. (Bug found by Adam Majer)
-
-* Added ENV var to rakefile to prevent OS X from including extended
- attribute junk in a tar file. (Bug found by Adam Majer)
-
-* Fixed filename dependency order bug in test_inspect_pending and
- test_to_s_pending. (Bug found by Adam Majer)
-
-* Fixed check for file utils options to make them immune to the
- symbol/string differences. (Patch supplied by Edwin Pratomo)
-
-* Fixed bug with rules involving multiple source (Patch supplied by
- Emanuel Indermühle)
-
-* Switched from getoptlong to optparse (patches supplied by Edwin
- Pratomo)
-
-* The -T option will now attempt to dynamically sense the size of the
- terminal. RAKE_COLUMNS will override any dynamic sensing.
-
-* FileList#clone and FileList#dup have better sematics w.r.t. taint
- and freeze.
-
-* Added ability clear prerequisites, and/or actions from an existing
- task.
-
-* Added the ability to reenable a task to be invoked a second time.
-
-* Changed RDoc test task to have no default template. This makes it
- easier for the tempate to pick up the template from the environment.
-
-* Changed from using Mutex to Monitor. Evidently Mutex causes thread
- join errors when Ruby is compiled with -disable-pthreads. (Patch
- supplied by Ittay Dror)
-
-* Fixed bug in makefile parser that had problems with extra spaces in
- file task names. (Patch supplied by Ittay Dror)
-
-* Added a performance patch for reading large makefile dependency
- files. (Patch supplied by Ittay Dror)
-
-* Default values for task arguments can easily be specified with the
- :with_defaults method. (Idea for default argument merging supplied
- by (Adam Q. Salter)
-
-* The -T output will only self-truncate if the output is a tty.
- However, if RAKE_COLUMNS is explicitly set, it will be honored in
- any case. (Patch provided by Gavin Stark).
-
-* Numerous fixes for running under windows. A big thanks to Bheeshmar
- Redheendran for spending a good part of the afternoon at the
- Lonestar Ruby Conference to help me work out these issues.
-
-== Version 0.8.1
-
-* Removed requires on parsedate.rb (in Ftptools)
-* Removed ftools from rake.rb. Made it options in sys.rb
-
-== Version 0.8.0
-
-* Added task parameters (e.g. "rake build[version7]")
-* Made task parameters passable to prerequisites.
-* Comments are limited to 80 columns or so (suggested by Jamis Buck).
-* Added -D to display full comments (suggested by Jamis Buck).
-* The rake program will set the status value used in any explicit
- exit(n) calls. (patch provided by Stephen Touset)
-* Fixed error in functional tests that were not including session (and
- silently skipping the functionl tests.
-* Removed --usage and make -h the same as -H.
-* Make a prettier inspect for tasks.
-
-== Version 0.7.3
-
-* Added existing and existing! methods to FileList
-* FileLists now claim to be Arrays (via is_a?) to get better support
- from the FileUtil module.
-* Added init and top_level for custom rake applications.
-
-== Version 0.7.2
-
-* Error messages are now send to stderr rather than stdout (from
- Payton Quackenbush).
-* Better error handling on invalid command line arguments (from Payton
- Quackenbush).
-* Added rcov task and updated unit testing for better code coverage.
-* Fixed some bugs where the application object was going to the global
- appliation instead of using its own data.
-* Added square and curly bracket patterns to FileList#include (Tilman
- Sauerbeck).
-* Added plain filename support to rule dependents (suggested by Nobu
- Nakada).
-* Added pathmap support to rule dependents.
-* Added a 'tasks' method to a namespace to get a list of tasks
- associated with the namespace.
-* Fixed the method name leak from FileUtils (bug found by Glenn
- Vanderburg).
-* Added rake_extension to handle detection of extension collisions.
-* Added test for noop, bad_option and verbose flags to sh command.
-* Removed dependency on internal fu_xxx functions from FileUtils.
-* Added a 'shame' task to the Rakefile.
-* Added tar_command and zip_command options to the Package task.
-* Added a description to the gem task in GemPackageTask.
-* Fixed a bug when rules have multiple prerequisites (patch by Joel
- VanderWerf)
-* Added a protected 'require "rubygems"' to test/test_application to
- unbreak cruisecontrol.rb.
-* Added the handful of RakeFileUtils to the private method as well.
-* Added block based exclusion.
-* The clean task will no longer delete 'core' if it is a directory.
-* Removed rake_dup. Now we just simply rescue a bad dup.
-* Refactored the FileList reject logic to remove duplication.
-* Removed if __FILE__ at the end of the rake.rb file.
-
-== Version 0.7.1
-
-* Added optional filter parameter to the --tasks command line option.
-* Added flatten to allow rule transform procs to return lists of
- prereqs (Joel VanderWerf provided patch).
-* Added pathmap to String and FileList.
-* The -r option will now load .rake files (but a straight require
- doesn't yet). NOTE: This is experimental ... it may be
- discontinued.
-* The -f option without a value will disable the search for a
- Rakefile. The assumption is that the -r files are adequate.
-* Fixed the safe_ln function to fall back to cp in more error
- scenarios.
-
-== Version 0.7.0
-
-* Added Rake.original_dir to return the original starting directory of
- the rake application.
-* Added safe_ln support for openAFS (from Ludvig Omholt).
-* Added --trace reminder on short exception messages (David Heinemeier
- Hansson suggestion).
-* Added multitask declaration that executes prerequisites in
- parallel. (Doug Young providied an initial implementation).
-* Fixed missing_const hack to be compatible with Rails. (Jamis Buck
- supplied test case).
-* Made the RDoc task default to internal (in-process) RDoc formatting.
- The old behavior is still available by setting the +external+ flag
- to true.
-* Rakefiles are now loaded with the expanded path to prevent
- accidental polution from the Ruby load path.
-* The +namespace+ command now returns a NameSpace object that can be
- used to lookup tasks defined in that namespace. This allows for
- better anonymous namespace behavior.
-* Task objects my now be used in prerequisite lists directly.
-
-== Version 0.6.1
-
-* Rebuilt 0.6.0 gem without signing.
-
-== Version 0.6.0
-
-* Fixed file creation bug in the unit tests (caused infinite loop on
- windows).
-* Fixed bug where session based functional tests were run under
- windows.
-* Fixed bug in directory tasks so that updating a directory will not
- retrigger file tasks depending on the directory (see
- FileCreationTask and EarlyTime).
-* Added egrep to FileList
-* ruby command now runs same ruby version as rake.
-* Added investigation to task object. (suggested by Martin Fowler)
-* Added ruby_opts to the test task to allow arbitrary ruby options to
- be passed to the test script. (Greg Fast)
-* Fixed the test loader to ignore options. (Greg Fast)
-* Moved Task, FileTask, FileCreationTask and RakeApp into the Rake
- module namespace. Old style namespace behavior can be invoked via
- the --classic-namespace option. (requested by Kelly Felkins).
-* GemTask is now sensitive to the gem platform (Masao Mutoh).
-* A non-existing file prerequisite will no longer cause an exception
- (Philipp Neubeck).
-* Multiple prerequisites on Rake rules now allowed (initial patch
- supplied by Stuart Jansen).
-
-== Version 0.5.4
-
-* Added double quotes to the test runner.
-* Added .svn to default ignore list.
-* Updated FileList#include to support nested arrays and filelists.
-
-== Version 0.5.3
-
-* Added support for importing Rakefile and other dependencies.
-* Fixed bug so that now rules can chain off of existing tasks as well
- as existing files.
-* Fixed verbose flag bug in the testing task. Shortened some failure
- messages.
-* Make FileUtils methods private at the top level module to avoid
- accidental method leaking into other objects.
-* Added test loader option to test task. "testrb" is no longer the
- default test loader. It is now eating syntax errors that should
- halt the unit tests.
-* Revamped FileList so that it works more like and array (addressed
- flatten bug). Added many tests around file list.
-* Added +ext+ method to both String and FileList.
-
-== Version 0.5.0
-
-* Fixed documentation that was lacking the Rake module name (Tilman
- Sauerbeck).
-* Added tar.gz and tar.bz2 support to package task (Tilman Sauerbeck).
-* Recursive rules are now supported (Tilman Sauerbeck).
-* Added warning option for the Test Task (requested by Eric Hodel).
-* The jamis rdoc template is only used if it exists.
-* Added fix for Ruby 1.8.2 test/unit and rails problem.
-* Added contributed rake man file (Jani Monoses).
-* Added Brian Candler's fix for problems in --trace and --dry-run
- mode.
-
-== Version 0.4.15
-
-* Fixed a bug that prevented the TESTOPTS flag from working with the
- revised for 1.8.2 test task.
-* Updated the docs on --trace to indicate that it also enables a full
- backtrace on errors.
-
-== Version 0.4.14
-
-* Modified the TestTask to workaround the Ruby 1.8.2 change in
- autoexecuting unit tests.
-
-== Version 0.4.13
-
-* Fixed the dry-run flag so it is operating again.
-* Multiple arguments to sh and ruby commands will not be interpreted
- by the shell (patch provided by Jonathan Paisley).
-
-== Version 0.4.12
-
-* Added --silent (-s) to suppress the (in directory) rake message.
-
-== Version 0.4.11
-
-* Changed the "don't know how to rake" message (finally)
-* Changes references to a literal "Rakefile" to reference the global
- variable $rakefile (which contains the actual name of the rakefile).
-
-== Version 0.4.10
-
-* Added block support to the "sh" command, allowing users to take
- special actions on the result of the system call. E.g.
-
- sh "shell_command" do |ok, res|
- puts "Program returned #{res.exitstatus}" if ! ok
- end
-
-== Version 0.4.9
-
-* Switched to Jamis Buck's RDoc template.
-* Removed autorequire from Rake's gem spec. This prevents the Rake
- libraries from loading while using rails.
-
-== Version 0.4.8
-
-* Added support for .rb versions of Rakefile.
-* Removed \\\n's from test task.
-* Fixed Ruby 1.9 compatibility issue with FileList.
-
-== Version 0.4.7
-
-* Fixed problem in FileList that caused Ruby 1.9 to go into infinite
- recursion. Since to_a was removed from Object, it does not need to
- added back into the list of methods to rewrite in FileList. (Thanks
- to Kent Sibilev for pointing this out).
-
-== Version 0.4.6
-* Removed test version of ln in FileUtils that prevented safe_ln from
- using ln.
-
-== Version 0.4.5
-* Upgraded comments in TestTask.
-* FileList to_s and inspect now automatically resolve pending changes.
-* FileList#exclude properly returns the FileList.
-
-== Version 0.4.4
-* Fixed initialization problem with @comment.
-* Now using multi -r technique in TestTask. Switch Rakefile back to
- using the built-in test task macros because the rake runtime is no
- longer needed.
-* Added 'TEST=filename' and 'TESTOPTS=options' to the Test Task
- macros.
-* Allow a +test_files+ attribute in test tasks. This allows more
- flexibility in specifying test files.
-
-== Version 0.4.3
-* Fixed Comment leakage.
-
-== Version 0.4.2
-* Added safe_ln that falls back to a copy if a file link is not supported.
-* Package builder now uses safe_ln.
-
-== Version 0.4.1
-* Task comments are now additive, combined with "/".
-* Works with (soon to be released) rubygems 0.6.2 (or 0.7.0)
-
-== Version 0.4.0
-* FileList now uses deferred loading. The file system is not searched
- until the first call that needs the file names.
-* VAR=VALUE options are now accepted on the command line and are
- treated like environment variables. The values may be tested in a
- Rakefile by referencing ENV['VAR'].
-* File.mtime is now used (instead of File.new().mtime).
-
-== Version 0.3.2.x
-
-* Removed some hidden dependencies on rubygems. Tests now will test
- gems only if they are installed.
-* Removed Sys from some example files. I believe that is that last
- reference to Sys outside of the contrib area.
-* Updated all copyright notices to include 2004.
-
-== Version 0.3.2
-
-* GEM Installation now works with the application stub.
-
-== Version 0.3.1
-
-* FileLists now automatically ignore CVS, .bak, !
-* GEM Installation now works.
-
-== Version 0.3.0
-
-Promoted 0.2.10.
-
-== Version 0.2.10
-General
-
-* Added title to Rake's rdocs
-* Contrib packages are no longer included in the documentation.
-
-RDoc Issues
-
-* Removed default for the '--main' option
-* Fixed rendering of the rdoc options
-* Fixed clean/clobber confusion with rerdoc
-* 'title' attribute added
-
-Package Task Library Issues
-
-* Version (or explicit :noversion) is required.
-* +package_file+ attribute is now writable
-
-FileList Issues
-
-* Dropped bang version of exclude. Now using ant-like include/exclude semantics.
-* Enabled the "yield self" idiom in FileList#initialize.
-
-== Version 0.2.9
-
-This version contains numerous changes as the RubyConf.new(2003)
-presentation was being prepared. The changes include:
-
-* The monolithic rubyapp task library is in the process of being
- dropped in favor of lighter weight task libraries.
-
-== Version 0.2.7
-
-* Added "desc" for task descriptions.
-* -T will now display tasks with descriptions.
-* -P will display tasks and prerequisites.
-* Dropped the Sys module in favor of the 1.8.x FileUtils module. Sys
- is still supported in the contrib area.
-
-== Version 0.2.6
-
-* Moved to RubyForge
-
-== Version 0.2.5
-
-* Switched to standard ruby app builder.
-* Added no_match option to file matcher.
-
-== Version 0.2.4
-
-* Fixed indir, which neglected to actually change directories.
-
-== Version 0.2.3
-
-* Added rake module for a help target
-* Added 'for_files' to Sys
-* Added a $rakefile constant
-* Added test for selecting proper rule with multiple targets.
diff --git a/doc/rake/README b/doc/rake/README
deleted file mode 100644
index 41668dd727..0000000000
--- a/doc/rake/README
+++ /dev/null
@@ -1,196 +0,0 @@
-= RAKE -- Ruby Make
-
-Supporting Rake version: 0.8.6
-
-This package contains Rake, a simple ruby build program with
-capabilities similar to make.
-
-Rake has the following features:
-
-* 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?)
-
-* Users can specify tasks with prerequisites.
-
-* Rake supports rule patterns to synthesize implicit tasks.
-
-* Flexible FileLists that act like arrays but know about manipulating
- file names and paths.
-
-* A library of prepackaged tasks to make building rakefiles easier. For example,
- tasks for building tarballs, gems and RDoc output are provided.
-
-* Supports parallel execution of tasks.
-
-
-== Installation
-
-=== Gem Installation
-
-Download and install rake with the following.
-
- gem install rake
-
-=== Normal Installation
-
-You can download the source tarball of the latest version of Rake from
-
-* http://rubyforge.org/project/showfiles.php?group_id=50
-
-Extract the tarball and run
-
- % ruby install.rb
-
-from its distribution directory.
-
-== Usage
-
-=== Simple Example
-
-First, you must write a "Rakefile" file which contains the build rules. Here's
-a simple example:
-
- task :default => [:test]
-
- task :test do
- ruby "test/unittest.rb"
- end
-
-This Rakefile has two tasks:
-
-* A task named "test", which - upon invocation - will run a unit test file in
- Ruby.
-* A task named "default". This task does nothing by itself, but it has exactly
- one dependency, namely the "test" task. Invoking the "default" task will
- cause Rake to invoke the "test" task as well.
-
-Running the "rake" command without any options will cause it to run the
-"default" task in the Rakefile:
-
- % ls
- Rakefile test/
- % rake
- (in /home/some_user/Projects/rake)
- ruby test/unittest.rb
- ....unit test output here...
-
-Type "rake --help" for all available options.
-
-
-=== More Information
-
-* For details on Rake's command-line invocation, read
- doc/command_line_usage.rdoc[http://rake.rubyforge.org/files/doc/command_line_usage_rdoc.html]
-* For details on writing Rakefiles, see
- doc/rakefile.rdoc[http://rake.rubyforge.org/files/doc/rakefile_rdoc.html].
-* For the original announcement of Rake, see
- doc/rational.rdoc[http://rake.rubyforge.org/files/doc/rational_rdoc.html].
-* For a glossary of terms, see
- doc/glossary.rdoc[http://rake.rubyforge.org/files/doc/glossary_rdoc.html].
-
-
-== Development
-
-=== Source Repository
-
-Rake is currently hosted at github. The github web page is
-http://github.com/jimweirich/rake. The public git clone URL is
-
-* git://github.com/jimweirich/rake.git
-
-=== Running the Rake Test Suite
-
-If you wish to run the unit and functional tests that come with Rake:
-
-* Install the 'session' gem in order to run the functional tests.
-* CD into the top project directory of rake.
-* Type one of the following:
-
- rake # If you have a version of rake installed
- ruby -Ilib bin/rake # If you do not have a version of rake installed.
-
-=== Issues and Bug Reports
-
-Bugs, features requests and other issues can be logged at
-
-* http://onestepback.org/redmine/projects/show/rake
-
-You will need an account to before you can post issues. Register at
-http://onestepback.org/redmine/account/register. Or you can send me
-an email (at jim dot weirich at gmail dot com)
-
-
-== Online Resources
-
-=== Rake References
-
-* Rake Documentation Home: http://docs.rubyrake.org
-* Rake Project Page: http://rubyforge.org/projects/rake
-* Rake API Documents: http://rake.rubyforge.org
-* Rake Source Code Repo: http://github.com/jimweirich/rake
-* Rake Git Repo Clone URL: git://github.com/jimweirich/rake.git
-
-=== Presentations and Articles about Rake
-
-* Jim Weirich's 2003 RubyConf presentation: http://onestepback.org/articles/buildingwithrake/
-* Martin Fowler's article on Rake: http://martinfowler.com/articles/rake.html
-
-== Other Make Reinvisionings ...
-
-Rake is a late entry in the make replacement field. Here are links to
-other projects with similar (and not so similar) goals.
-
-* http://directory.fsf.org/bras.html -- Bras, one of earliest
- implementations of "make in a scripting language".
-* http://www.a-a-p.org -- Make in Python
-* http://www.aromatic.com/tools/jam.txt -- JAM, Java Automated Make
-* http://ant.apache.org -- The Ant project
-* http://ppt.perl.org/commands/make/index.html -- Make from the Perl
- Power Tools implementation.
-* http://search.cpan.org/search?query=PerlBuildSystem -- The Perl Build System
-* http://make.rubyforge.org -- Rant, another Ruby make tool.
-
-== Credits
-
-[<b>Ryan Dlugosz</b>] For the initial conversation that sparked Rake.
-
-[<b>nobu.nokada@softhome.net</b>] For the initial patch for rule support.
-
-[<b>Tilman Sauerbeck <tilman@code-monkey.de></b>] For the recursive rule patch.
-
-== License
-
-Rake is available under an MIT-style license.
-
-:include: MIT-LICENSE
-
-== Support
-
-The Rake homepage is http://rake.rubyforge.org. You can find the Rake
-RubyForge page at http://rubyforge.org/projects/rake.
-
-Feel free to submit commits or feature requests. If you send a patch,
-remember to update the corresponding unit tests. If fact, I prefer
-new feature to be submitted in the form of new unit tests.
-
-For other information, feel free to ask on the ruby-talk mailing list
-(which is mirrored to comp.lang.ruby) or contact
-jim dot weirich at gmail.com.
-
----
-
-= Other stuff
-
-Author:: Jim Weirich <jim.weirich@gmail.com>
-Requires:: Ruby 1.8.0 or later
-License:: Copyright 2003-2008 by Jim Weirich.
- Released under an MIT-style license. See the LICENSE file
- included in the distribution.
-
-== Warranty
-
-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.
diff --git a/doc/rake/command_line_usage.rdoc b/doc/rake/command_line_usage.rdoc
deleted file mode 100644
index 688e55a9af..0000000000
--- a/doc/rake/command_line_usage.rdoc
+++ /dev/null
@@ -1,169 +0,0 @@
-= Rake Command Line Usage
-
-Rake is invoked from the command line using:
-
- % rake [options ...] [VAR=VALUE ...] [targets ...]
-
-Options are:
-
-[<tt><em>name</em>=<em>value</em></tt>]
- Set the environment variable <em>name</em> to <em>value</em>
- during the execution of the <b>rake</b> command. You can access
- the value by using ENV['<em>name</em>'].
-
-[<tt>--all</tt> (-A)]
- Used in combination with the -T and -D options, will force
- those options to show all the tasks, even the ones without comments.
-
-[<tt>--backtrace</tt>{=_output_} (-n)]
- Enable a full backtrace (i.e. like --trace, but without the task
- tracing details). The _output_ parameter is optional, but if
- specified it controls where the backtrace output is sent. If
- _output_ is <tt>stdout</tt>, then backtrace output is directed to
- stardard output. If _output_ is <tt>stderr</tt>, or if it is
- missing, then the backtrace output is sent to standard error.
-
-[<tt>--classic-namespace</tt> (-n)]
- Import the Task, FileTask, and FileCreateTask into the top-level
- scope to be compatible with older versions of Rake. Alternatively
- you can include the line <code>require
- 'rake/classic_namespace'</code> in your Rakefile to get the
- classic behavior.
-
-[<tt>--comments</tt>]
- Used in combination with the -W options to force the output to
- contain commented options only. This is the reverse of
- <tt>--all</tt>.
-
-[<tt>--describe</tt> _pattern_ (-D)]
- Describe the tasks (matching optional PATTERN), then exit.
-
-[<tt>--dry-run</tt> (-n)]
- Do a dry run. Print the tasks invoked and executed, but do not
- actually execute any of the actions.
-
-[<tt>--execute</tt> _code_ (-e)]
- Execute some Ruby code and exit.
-
-[<tt>--execute-print</tt> _code_ (-p)]
- Execute some Ruby code, print the result, and exit.
-
-[<tt>--execute-continue</tt> _code_ (-E)]
- Execute some Ruby code, then continue with normal task processing.
-
-[<tt>--help</tt> (-H)]
- Display some help text and exit.
-
-[<tt>--jobs</tt> _number_ (-j)]
- Specifies the number of active concurrent tasks used. The
- suggested value is equal to the number of CPUs. The concurrent
- tasks are used to execute the <tt>multitask</tt> prerequisites.
- Also see the <tt>-m</tt> option which turns all tasks into
- multitasks.
-
- Sample values:
- (no -j) : unlimited concurrent tasks (standard rake behavior)
- -j : 2 concurrent tasks (exact number may change)
- -j 16 : 16 concurrent tasks
-
-[<tt>--job-stats</tt> _level_]
-
- Display job statistics at the completion of the run. By default,
- this will display the requested number of active tasks (from the
- -j options) and the maximum number of tasks in play at any given
- time.
-
- If the optional _level_ is <tt>history</tt>, then a complete trace
- of task history will be displayed on standard output.
-
-[<tt>--libdir</tt> _directory_ (-I)]
- Add _directory_ to the list of directories searched for require.
-
-[<tt>--multitask</tt> (-m)]
- Treat all tasks as multitasks. ('make/drake' semantics)
-
-[<tt>--nosearch</tt> (-N)]
- Do not search for a Rakefile in parent directories.
-
-[<tt>--prereqs</tt> (-P)]
- Display a list of all tasks and their immediate prerequisites.
-
-[<tt>--quiet</tt> (-q)]
- Do not echo commands from FileUtils.
-
-[<tt>--rakefile</tt> _filename_ (-f)]
- Use _filename_ as the name of the rakefile. The default rakefile
- names are +rakefile+ and +Rakefile+ (with +rakefile+ taking
- precedence). If the rakefile is not found in the current
- directory, +rake+ will search parent directories for a match. The
- directory where the Rakefile is found will become the current
- directory for the actions executed in the Rakefile.
-
-[<tt>--rakelibdir</tt> _rakelibdir_ (-R)]
- Auto-import any .rake files in RAKELIBDIR. (default is 'rakelib')
-
-[<tt>--reduce-compat</tt>]
-
- Remove the DSL commands from the Object inheritance hierarchy and
- do not define top level constants. This reduces the backwards
- compatibility of Rake, but allows rake to be used with software
- that would otherwise have conflicting definitions.
-
- *NOTE:* The next major version of Rake will only be able to be run
- in "reduce-compat" mode.
-
-[<tt>--require</tt> _name_ (-r)]
- Require _name_ before executing the Rakefile.
-
-[<tt>--rules</tt>]
- Trace the rules resolution.
-
-[<tt>--silent (-s)</tt>]
- Like --quiet, but also suppresses the 'in directory' announcement.
-
-[<tt>--suppress-backtrace _pattern_ </tt>]
- Line matching the regular expression _pattern_ will be removed
- from the backtrace output. Note that the --backtrace option is the
- full backtrace without these lines suppressed.
-
-[<tt>--system</tt> (-g)]
- Use the system wide (global) rakefiles. The project Rakefile is
- ignored. By default, the system wide rakefiles are used only if no
- project Rakefile is found. On Unix-like system, the system wide
- rake files are located in $HOME/.rake. On a windows system they
- are stored in $APPDATA/Rake.
-
-[<tt>--no-system</tt> (-G)]
- Use the project level Rakefile, ignoring the system-wide (global)
- rakefiles.
-
-[<tt>--tasks</tt> <em>pattern</em> (-T)]
- Display a list of the major tasks and their comments. Comments
- are defined using the "desc" command. If a pattern is given, then
- only tasks matching the pattern are displayed.
-
-[<tt>--trace</tt>{=_output_} (-t)]
- Turn on invoke/execute tracing. Also enable full backtrace on
- errors. The _output_ parameter is optional, but if specified it
- controls where the trace output is sent. If _output_ is
- <tt>stdout</tt>, then trace output is directed to stardard output.
- If _output_ is <tt>stderr</tt>, or if it is missing, then trace
- output is sent to standard error.
-
-[<tt>--verbose</tt> (-v)]
- Echo the Sys commands to standard output.
-
-[<tt>--version</tt> (-V)]
- Display the program version and exit.
-
-[<tt>--where</tt> <em>pattern</em> (-W)]
- Display tasks that match <em>pattern</em> and the file and line
- number where the task is defined. By default this option will
- display all tasks, not just the tasks that have descriptions.
-
-[<tt>--no-deprecation-warnings</tt> (-W)]
- Do not display the deprecation warnings.
-
-In addition, any command line option of the form
-<em>VAR</em>=<em>VALUE</em> will be added to the environment hash
-<tt>ENV</tt> and may be tested in the Rakefile.
diff --git a/doc/rake/example/Rakefile1 b/doc/rake/example/Rakefile1
deleted file mode 100644
index 39f8bcceb0..0000000000
--- a/doc/rake/example/Rakefile1
+++ /dev/null
@@ -1,38 +0,0 @@
-# Example Rakefile -*- ruby -*-
-
-task :default => [:main]
-
-file "a.o" => ["a.c"] do |t|
- src = t.name.sub(/\.o$/, '.c')
- sh "gcc #{src} -c -o #{t.name}"
-end
-
-file "b.o" => ["b.c"] do |t|
- src = t.name.sub(/\.o$/, '.c')
- sh "gcc #{src} -c -o #{t.name}"
-end
-
-file "main.o" => ["main.c"] do |t|
- src = t.name.sub(/\.o$/, '.c')
- sh "gcc #{src} -c -o #{t.name}"
-end
-
-OBJFILES = ["a.o", "b.o", "main.o"]
-task :obj => OBJFILES
-
-file "main" => OBJFILES do |t|
- sh "gcc -o #{t.name} main.o a.o b.o"
-end
-
-task :clean do
- rm_f FileList['*.o']
- Dir['*~'].each { |fn| rm_f fn }
-end
-
-task :clobber => [:clean] do
- rm_f "main"
-end
-
-task :run => ["main"] do
- sh "./main"
-end
diff --git a/doc/rake/example/Rakefile2 b/doc/rake/example/Rakefile2
deleted file mode 100644
index 35310eceb5..0000000000
--- a/doc/rake/example/Rakefile2
+++ /dev/null
@@ -1,35 +0,0 @@
-# Example Rakefile -*- ruby -*-
-# Using the power of Ruby
-
-task :default => [:main]
-
-def ext(fn, newext)
- fn.sub(/\.[^.]+$/, newext)
-end
-
-SRCFILES = Dir['*.c']
-OBJFILES = SRCFILES.collect { |fn| ext(fn,".o") }
-
-OBJFILES.each do |objfile|
- srcfile = ext(objfile, ".c")
- file objfile => [srcfile] do |t|
- sh "gcc #{srcfile} -c -o #{t.name}"
- end
-end
-
-file "main" => OBJFILES do |t|
- sh "gcc -o #{t.name} main.o a.o b.o"
-end
-
-task :clean do
- rm_f FileList['*.o']
- Dir['*~'].each { |fn| rm_f fn }
-end
-
-task :clobber => [:clean] do
- rm_f "main"
-end
-
-task :run => ["main"] do
- sh "./main"
-end
diff --git a/doc/rake/example/a.c b/doc/rake/example/a.c
deleted file mode 100644
index 620e6f8007..0000000000
--- a/doc/rake/example/a.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <stdio.h>
-
-void a()
-{
- printf ("In function a\n");
-}
diff --git a/doc/rake/example/b.c b/doc/rake/example/b.c
deleted file mode 100644
index 9b24aa1273..0000000000
--- a/doc/rake/example/b.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <stdio.h>
-
-void b()
-{
- printf ("In function b\n");
-}
diff --git a/doc/rake/example/main.c b/doc/rake/example/main.c
deleted file mode 100644
index a04558a251..0000000000
--- a/doc/rake/example/main.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <stdio.h>
-
-extern void a();
-extern void b();
-
-int main ()
-{
- a();
- b();
- return 0;
-}
diff --git a/doc/rake/glossary.rdoc b/doc/rake/glossary.rdoc
deleted file mode 100644
index a811764091..0000000000
--- a/doc/rake/glossary.rdoc
+++ /dev/null
@@ -1,51 +0,0 @@
-= Glossary
-
-[<b>action</b>]
- Code to be executed in order to perform a task. Actions in a
- rakefile are specified in a code block (usually delimited by
- +do+/+end+ pairs.
-
-[<b>execute</b>]
- When a task is executed, all of its actions are performed, in
- the order they were defined. Note that unlike
- <tt>invoke</tt>, <tt>execute</tt> always executes the actions
- (without invoking or executing the prerequisites).
-
-[<b>file task</b> (FileTask)]
- A file task is a task whose purpose is to create a file
- (which has the same name as the task). When invoked, a file
- task will only execute if one or more of the following
- conditions are true.
-
- 1. The associated file does not exist.
- 2. A prerequisite has a later time stamp than the existing file.
-
- Because normal Tasks always have the current time as
- timestamp, a FileTask that has a normal Task prerequisite
- will always execute.
-
-[<b>invoke</b>]
- When a task is invoked, first we check to see if it has been
- invoked before. if it has been, then nothing else is done.
- If this is the first time its been invoked, then we invoke
- each of its prerequisites. Finally, we check to see if we
- need to execute the actions of this task by calling
- <tt>needed?</tt>. Finally, if the task is needed, we execute
- its actions.
-
- NOTE: Currently prerequisites are invoked even if the task is
- not needed. This may change in the future.
-
-[<b>prerequisites</b>]
- Every task has a set (possibly empty) of prerequisites. A
- prerequisite P to Task T is itself a task that must be invoked
- before Task T.
-
-[<b>rule</b>]
- A rule is a recipe for synthesizing a task when no task is
- explicitly defined. Rules generally synthesize file tasks.
-
-[<b>task</b> (Task)]
- Basic unit of work in a rakefile. A task has a name, a set of
- prerequisites and a list of actions to be performed.
-
diff --git a/doc/rake/jamis.rb b/doc/rake/jamis.rb
deleted file mode 100644
index c7bc84ac5b..0000000000
--- a/doc/rake/jamis.rb
+++ /dev/null
@@ -1,591 +0,0 @@
-module RDoc
-module Page
-
-FONTS = "\"Bitstream Vera Sans\", Verdana, Arial, Helvetica, sans-serif"
-
-STYLE = <<CSS
-a {
- color: #00F;
- text-decoration: none;
-}
-
-a:hover {
- color: #77F;
- text-decoration: underline;
-}
-
-body, td, p {
- font-family: %fonts%;
- background: #FFF;
- color: #000;
- margin: 0px;
- font-size: small;
-}
-
-#content {
- margin: 2em;
-}
-
-#description p {
- margin-bottom: 0.5em;
-}
-
-.sectiontitle {
- margin-top: 1em;
- margin-bottom: 1em;
- padding: 0.5em;
- padding-left: 2em;
- background: #005;
- color: #FFF;
- font-weight: bold;
- border: 1px dotted black;
-}
-
-.attr-rw {
- padding-left: 1em;
- padding-right: 1em;
- text-align: center;
- color: #055;
-}
-
-.attr-name {
- font-weight: bold;
-}
-
-.attr-desc {
-}
-
-.attr-value {
- font-family: monospace;
-}
-
-.file-title-prefix {
- font-size: large;
-}
-
-.file-title {
- font-size: large;
- font-weight: bold;
- background: #005;
- color: #FFF;
-}
-
-.banner {
- background: #005;
- color: #FFF;
- border: 1px solid black;
- padding: 1em;
-}
-
-.banner td {
- background: transparent;
- color: #FFF;
-}
-
-h1 a, h2 a, .sectiontitle a, .banner a {
- color: #FF0;
-}
-
-h1 a:hover, h2 a:hover, .sectiontitle a:hover, .banner a:hover {
- color: #FF7;
-}
-
-.dyn-source {
- display: none;
- background: #FFE;
- color: #000;
- border: 1px dotted black;
- margin: 0.5em 2em 0.5em 2em;
- padding: 0.5em;
-}
-
-.dyn-source .cmt {
- color: #00F;
- font-style: italic;
-}
-
-.dyn-source .kw {
- color: #070;
- font-weight: bold;
-}
-
-.method {
- margin-left: 1em;
- margin-right: 1em;
- margin-bottom: 1em;
-}
-
-.description pre {
- padding: 0.5em;
- border: 1px dotted black;
- background: #FFE;
-}
-
-.method .title {
- font-family: monospace;
- font-size: large;
- border-bottom: 1px dashed black;
- margin-bottom: 0.3em;
- padding-bottom: 0.1em;
-}
-
-.method .description, .method .sourcecode {
- margin-left: 1em;
-}
-
-.description p, .sourcecode p {
- margin-bottom: 0.5em;
-}
-
-.method .sourcecode p.source-link {
- text-indent: 0em;
- margin-top: 0.5em;
-}
-
-.method .aka {
- margin-top: 0.3em;
- margin-left: 1em;
- font-style: italic;
- text-indent: 2em;
-}
-
-h1 {
- padding: 1em;
- border: 1px solid black;
- font-size: x-large;
- font-weight: bold;
- color: #FFF;
- background: #007;
-}
-
-h2 {
- padding: 0.5em 1em 0.5em 1em;
- border: 1px solid black;
- font-size: large;
- font-weight: bold;
- color: #FFF;
- background: #009;
-}
-
-h3, h4, h5, h6 {
- padding: 0.2em 1em 0.2em 1em;
- border: 1px dashed black;
- color: #000;
- background: #AAF;
-}
-
-.sourcecode > pre {
- padding: 0.5em;
- border: 1px dotted black;
- background: #FFE;
-}
-
-CSS
-
-XHTML_PREAMBLE = %{<?xml version="1.0" encoding="%charset%"?>
-<!DOCTYPE html
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-}
-
-HEADER = XHTML_PREAMBLE + <<ENDHEADER
-<html>
- <head>
- <title>%title%</title>
- <meta http-equiv="Content-Type" content="text/html; charset=%charset%" />
- <link rel="stylesheet" href="%style_url%" type="text/css" media="screen" />
-
- <script language="JavaScript" type="text/javascript">
- // <![CDATA[
-
- function toggleSource( id )
- {
- var elem
- var link
-
- if( document.getElementById )
- {
- elem = document.getElementById( id )
- link = document.getElementById( "l_" + id )
- }
- else if ( document.all )
- {
- elem = eval( "document.all." + id )
- link = eval( "document.all.l_" + id )
- }
- else
- return false;
-
- if( elem.style.display == "block" )
- {
- elem.style.display = "none"
- link.innerHTML = "show source"
- }
- else
- {
- elem.style.display = "block"
- link.innerHTML = "hide source"
- }
- }
-
- function openCode( url )
- {
- window.open( url, "SOURCE_CODE", "width=400,height=400,scrollbars=yes" )
- }
- // ]]>
- </script>
- </head>
-
- <body>
-ENDHEADER
-
-FILE_PAGE = <<HTML
-<table border='0' cellpadding='0' cellspacing='0' width="100%" class='banner'>
- <tr><td>
- <table width="100%" border='0' cellpadding='0' cellspacing='0'><tr>
- <td class="file-title" colspan="2"><span class="file-title-prefix">File</span><br />%short_name%</td>
- <td align="right">
- <table border='0' cellspacing="0" cellpadding="2">
- <tr>
- <td>Path:</td>
- <td>%full_path%
-IF:cvsurl
- &nbsp;(<a href="%cvsurl%">CVS</a>)
-ENDIF:cvsurl
- </td>
- </tr>
- <tr>
- <td>Modified:</td>
- <td>%dtm_modified%</td>
- </tr>
- </table>
- </td></tr>
- </table>
- </td></tr>
-</table><br>
-HTML
-
-###################################################################
-
-CLASS_PAGE = <<HTML
-<table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr>
- <td class="file-title"><span class="file-title-prefix">%classmod%</span><br />%full_name%</td>
- <td align="right">
- <table cellspacing=0 cellpadding=2>
- <tr valign="top">
- <td>In:</td>
- <td>
-START:infiles
-HREF:full_path_url:full_path:
-IF:cvsurl
-&nbsp;(<a href="%cvsurl%">CVS</a>)
-ENDIF:cvsurl
-END:infiles
- </td>
- </tr>
-IF:parent
- <tr>
- <td>Parent:</td>
- <td>
-IF:par_url
- <a href="%par_url%">
-ENDIF:par_url
-%parent%
-IF:par_url
- </a>
-ENDIF:par_url
- </td>
- </tr>
-ENDIF:parent
- </table>
- </td>
- </tr>
- </table>
-HTML
-
-###################################################################
-
-METHOD_LIST = <<HTML
- <div id="content">
-IF:diagram
- <table cellpadding='0' cellspacing='0' border='0' width="100%"><tr><td align="center">
- %diagram%
- </td></tr></table>
-ENDIF:diagram
-
-IF:description
- <div class="description">%description%</div>
-ENDIF:description
-
-IF:requires
- <div class="sectiontitle">Required Files</div>
- <ul>
-START:requires
- <li>HREF:aref:name:</li>
-END:requires
- </ul>
-ENDIF:requires
-
-IF:toc
- <div class="sectiontitle">Contents</div>
- <ul>
-START:toc
- <li><a href="#%href%">%secname%</a></li>
-END:toc
- </ul>
-ENDIF:toc
-
-IF:methods
- <div class="sectiontitle">Methods</div>
- <ul>
-START:methods
- <li>HREF:aref:name:</li>
-END:methods
- </ul>
-ENDIF:methods
-
-IF:includes
-<div class="sectiontitle">Included Modules</div>
-<ul>
-START:includes
- <li>HREF:aref:name:</li>
-END:includes
-</ul>
-ENDIF:includes
-
-START:sections
-IF:sectitle
-<div class="sectiontitle"><a nem="%secsequence%">%sectitle%</a></div>
-IF:seccomment
-<div class="description">
-%seccomment%
-</div>
-ENDIF:seccomment
-ENDIF:sectitle
-
-IF:classlist
- <div class="sectiontitle">Classes and Modules</div>
- %classlist%
-ENDIF:classlist
-
-IF:constants
- <div class="sectiontitle">Constants</div>
- <table border='0' cellpadding='5'>
-START:constants
- <tr valign='top'>
- <td class="attr-name">%name%</td>
- <td>=</td>
- <td class="attr-value">%value%</td>
- </tr>
-IF:desc
- <tr valign='top'>
- <td>&nbsp;</td>
- <td colspan="2" class="attr-desc">%desc%</td>
- </tr>
-ENDIF:desc
-END:constants
- </table>
-ENDIF:constants
-
-IF:attributes
- <div class="sectiontitle">Attributes</div>
- <table border='0' cellpadding='5'>
-START:attributes
- <tr valign='top'>
- <td class='attr-rw'>
-IF:rw
-[%rw%]
-ENDIF:rw
- </td>
- <td class='attr-name'>%name%</td>
- <td class='attr-desc'>%a_desc%</td>
- </tr>
-END:attributes
- </table>
-ENDIF:attributes
-
-IF:method_list
-START:method_list
-IF:methods
-<div class="sectiontitle">%type% %category% methods</div>
-START:methods
-<div class="method">
- <div class="title">
-IF:callseq
- <a name="%aref%"></a><b>%callseq%</b>
-ENDIF:callseq
-IFNOT:callseq
- <a name="%aref%"></a><b>%name%</b>%params%
-ENDIF:callseq
-IF:codeurl
-[ <a href="javascript:openCode('%codeurl%')">source</a> ]
-ENDIF:codeurl
- </div>
-IF:m_desc
- <div class="description">
- %m_desc%
- </div>
-ENDIF:m_desc
-IF:aka
-<div class="aka">
- This method is also aliased as
-START:aka
- <a href="%aref%">%name%</a>
-END:aka
-</div>
-ENDIF:aka
-IF:sourcecode
-<div class="sourcecode">
- <p class="source-link">[ <a href="javascript:toggleSource('%aref%_source')" id="l_%aref%_source">show source</a> ]</p>
- <div id="%aref%_source" class="dyn-source">
-<pre>
-%sourcecode%
-</pre>
- </div>
-</div>
-ENDIF:sourcecode
-</div>
-END:methods
-ENDIF:methods
-END:method_list
-ENDIF:method_list
-END:sections
-</div>
-HTML
-
-FOOTER = <<ENDFOOTER
- </body>
-</html>
-ENDFOOTER
-
-BODY = HEADER + <<ENDBODY
- !INCLUDE! <!-- banner header -->
-
- <div id="bodyContent">
- #{METHOD_LIST}
- </div>
-
- #{FOOTER}
-ENDBODY
-
-########################## Source code ##########################
-
-SRC_PAGE = XHTML_PREAMBLE + <<HTML
-<html>
-<head><title>%title%</title>
-<meta http-equiv="Content-Type" content="text/html; charset=%charset%">
-<style>
-.ruby-comment { color: green; font-style: italic }
-.ruby-constant { color: #4433aa; font-weight: bold; }
-.ruby-identifier { color: #222222; }
-.ruby-ivar { color: #2233dd; }
-.ruby-keyword { color: #3333FF; font-weight: bold }
-.ruby-node { color: #777777; }
-.ruby-operator { color: #111111; }
-.ruby-regexp { color: #662222; }
-.ruby-value { color: #662222; font-style: italic }
- .kw { color: #3333FF; font-weight: bold }
- .cmt { color: green; font-style: italic }
- .str { color: #662222; font-style: italic }
- .re { color: #662222; }
-</style>
-</head>
-<body bgcolor="white">
-<pre>%code%</pre>
-</body>
-</html>
-HTML
-
-########################## Index ################################
-
-FR_INDEX_BODY = <<HTML
-!INCLUDE!
-HTML
-
-FILE_INDEX = XHTML_PREAMBLE + <<HTML
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=%charset%">
-<style>
-<!--
- body {
- background-color: #EEE;
- font-family: #{FONTS};
- color: #000;
- margin: 0px;
- }
- .banner {
- background: #005;
- color: #FFF;
- padding: 0.2em;
- font-size: small;
- font-weight: bold;
- text-align: center;
- }
- .entries {
- margin: 0.25em 1em 0 1em;
- font-size: x-small;
- }
- a {
- color: #00F;
- text-decoration: none;
- white-space: nowrap;
- }
- a:hover {
- color: #77F;
- text-decoration: underline;
- }
--->
-</style>
-<base target="docwin">
-</head>
-<body>
-<div class="banner">%list_title%</div>
-<div class="entries">
-START:entries
-<a href="%href%">%name%</a><br>
-END:entries
-</div>
-</body></html>
-HTML
-
-CLASS_INDEX = FILE_INDEX
-METHOD_INDEX = FILE_INDEX
-
-INDEX = XHTML_PREAMBLE + <<HTML
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>%title%</title>
- <meta http-equiv="Content-Type" content="text/html; charset=%charset%">
-</head>
-
-<frameset cols="20%,*">
- <frameset rows="15%,35%,50%">
- <frame src="fr_file_index.html" title="Files" name="Files" />
- <frame src="fr_class_index.html" name="Classes" />
- <frame src="fr_method_index.html" name="Methods" />
- </frameset>
-IF:inline_source
- <frame src="%initial_page%" name="docwin">
-ENDIF:inline_source
-IFNOT:inline_source
- <frameset rows="80%,20%">
- <frame src="%initial_page%" name="docwin">
- <frame src="blank.html" name="source">
- </frameset>
-ENDIF:inline_source
- <noframes>
- <body bgcolor="white">
- Click <a href="html/index.html">here</a> for a non-frames
- version of this page.
- </body>
- </noframes>
-</frameset>
-
-</html>
-HTML
-
-end
-end
-
-
diff --git a/doc/rake/proto_rake.rdoc b/doc/rake/proto_rake.rdoc
deleted file mode 100644
index a9e33d11da..0000000000
--- a/doc/rake/proto_rake.rdoc
+++ /dev/null
@@ -1,127 +0,0 @@
-= Original Prototype Rake
-
-This is the original 100 line prototype rake program.
-
----
- #!/usr/bin/env ruby
-
- require 'ftools'
-
- class Task
- TASKS = Hash.new
-
- attr_reader :prerequisites
-
- def initialize(task_name)
- @name = task_name
- @prerequisites = []
- @actions = []
- end
-
- def enhance(deps=nil, &block)
- @prerequisites |= deps if deps
- @actions << block if block_given?
- self
- end
-
- def name
- @name.to_s
- end
-
- def invoke
- @prerequisites.each { |n| Task[n].invoke }
- execute if needed?
- end
-
- def execute
- return if @triggered
- @triggered = true
- @actions.collect { |act| result = act.call(self) }.last
- end
-
- def needed?
- true
- end
-
- def timestamp
- Time.now
- end
-
- class << self
- def [](task_name)
- TASKS[intern(task_name)] or fail "Don't know how to rake #{task_name}"
- end
-
- def define_task(args, &block)
- case args
- when Hash
- fail "Too Many Target Names: #{args.keys.join(' ')}" if args.size > 1
- fail "No Task Name Given" if args.size < 1
- task_name = args.keys[0]
- deps = args[task_name]
- else
- task_name = args
- deps = []
- end
- deps = deps.collect {|d| intern(d) }
- get(task_name).enhance(deps, &block)
- end
-
- def get(task_name)
- name = intern(task_name)
- TASKS[name] ||= self.new(name)
- end
-
- def intern(task_name)
- (Symbol === task_name) ? task_name : task_name.intern
- end
- end
- end
-
- class FileTask < Task
- def needed?
- return true unless File.exist?(name)
- latest_prereq = @prerequisites.collect{|n| Task[n].timestamp}.max
- return false if latest_prereq.nil?
- timestamp < latest_prereq
- end
-
- def timestamp
- File.new(name.to_s).mtime
- end
- end
-
- def task(args, &block)
- Task.define_task(args, &block)
- end
-
- def file(args, &block)
- FileTask.define_task(args, &block)
- end
-
- def sys(cmd)
- puts cmd
- system(cmd) or fail "Command Failed: [#{cmd}]"
- end
-
- def rake
- begin
- here = Dir.pwd
- while ! File.exist?("Rakefile")
- Dir.chdir("..")
- fail "No Rakefile found" if Dir.pwd == here
- here = Dir.pwd
- end
- puts "(in #{Dir.pwd})"
- load "./Rakefile"
- ARGV.push("default") if ARGV.size == 0
- ARGV.each { |task_name| Task[task_name].invoke }
- rescue Exception => ex
- puts "rake aborted ... #{ex.message}"
- puts ex.backtrace.find {|str| str =~ /Rakefile/ } || ""
- end
- end
-
- if __FILE__ == $0 then
- rake
- end
diff --git a/doc/rake/rakefile.rdoc b/doc/rake/rakefile.rdoc
deleted file mode 100644
index a00c9fd21e..0000000000
--- a/doc/rake/rakefile.rdoc
+++ /dev/null
@@ -1,557 +0,0 @@
-= Rakefile Format (as of version 0.8.7)
-
-First of all, there is no special format for a Rakefile. A Rakefile
-contains executable Ruby code. Anything legal in a ruby script is
-allowed in a Rakefile.
-
-Now that we understand there is no special syntax in a Rakefile, there
-are some conventions that are used in a Rakefile that are a little
-unusual in a typical Ruby program. Since a Rakefile is tailored to
-specifying tasks and actions, the idioms used in a Rakefile are
-designed to support that.
-
-So, what goes into a Rakefile?
-
-== Tasks
-
-Tasks are the main unit of work in a Rakefile. Tasks have a name
-(usually given as a symbol or a string), a list of prerequisites (more
-symbols or strings) and a list of actions (given as a block).
-
-=== Simple Tasks
-
-A task is declared by using the +task+ method. +task+ takes a single
-parameter that is the name of the task.
-
- task :name
-
-=== Tasks with Prerequisites
-
-Any prerequisites are given as a list (enclosed in square brackets)
-following the name and an arrow (=>).
-
- task :name => [:prereq1, :prereq2]
-
-<b>NOTE:</b> Although this syntax looks a little funky, it is legal
-Ruby. We are constructing a hash where the key is :name and the value
-for that key is the list of prerequisites. It is equivalent to the
-following ...
-
- hash = Hash.new
- hash[:name] = [:prereq1, :prereq2]
- task(hash)
-
-=== Tasks with Actions
-
-Actions are defined by passing a block to the +task+ method. Any Ruby
-code can be placed in the block. The block may reference the task
-object via the block parameter.
-
- task :name => [:prereq1, :prereq2] do |t|
- # actions (may reference t)
- end
-
-=== Multiple Definitions
-
-A task may be specified more than once. Each specification adds its
-prerequisites and actions to the existing definition. This allows one
-part of a rakefile to specify the actions and a different rakefile
-(perhaps separately generated) to specify the dependencies.
-
-For example, the following is equivalent to the single task
-specification given above.
-
- task :name
- task :name => [:prereq1]
- task :name => [:prereq2]
- task :name do |t|
- # actions
- end
-
-== File Tasks
-
-Some tasks are designed to create a file from one or more other files.
-Tasks that generate these files may be skipped if the file already
-exists. File tasks are used to specify file creation tasks.
-
-File tasks are declared using the +file+ method (instead of the +task+
-method). In addition, file tasks are usually named with a string
-rather than a symbol.
-
-The following file task creates a executable program (named +prog+)
-given two object files name <tt>a.o</tt> and <tt>b.o</tt>. The tasks
-for creating <tt>a.o</tt> and <tt>b.o</tt> are not shown.
-
- file "prog" => ["a.o", "b.o"] do |t|
- sh "cc -o #{t.name} #{t.prerequisites.join(' ')}"
- end
-
-== Directory Tasks
-
-It is common to need to create directories upon demand. The
-+directory+ convenience method is a short-hand for creating a FileTask
-that creates the directory. For example, the following declaration
-...
-
- directory "testdata/examples/doc"
-
-is equivalent to ...
-
- file "testdata" do |t| mkdir t.name end
- file "testdata/examples" do |t| mkdir t.name end
- file "testdata/examples/doc" do |t| mkdir t.name end
-
-The +directory+ method does not accept prerequisites or actions, but
-both prerequisites and actions can be added later. For example ...
-
- directory "testdata"
- file "testdata" => ["otherdata"]
- file "testdata" do
- cp Dir["standard_data/*.data"], "testdata"
- end
-
-== Tasks with Parallel Prerequisites
-
-Rake allows parallel execution of prerequisites using the following syntax:
-
- multitask :copy_files => [:copy_src, :copy_doc, :copy_bin] do
- puts "All Copies Complete"
- end
-
-In this example, +copy_files+ is a normal rake task. Its actions are
-executed whenever all of its prerequisites are done. The big
-difference is that the prerequisites (+copy_src+, +copy_bin+ and
-+copy_doc+) are executed in parallel. Each of the prerequisites are
-run in their own Ruby thread, possibly allowing faster overall runtime.
-
-=== Secondary Prerequisites
-
-If any of the primary prerequisites of a multitask have common secondary
-prerequisites, all of the primary/parallel prerequisites will wait
-until the common prerequisites have been run.
-
-For example, if the <tt>copy_<em>xxx</em></tt> tasks have the
-following prerequisites:
-
- task :copy_src => [:prep_for_copy]
- task :copy_bin => [:prep_for_copy]
- task :copy_doc => [:prep_for_copy]
-
-Then the +prep_for_copy+ task is run before starting all the copies in
-parallel. Once +prep_for_copy+ is complete, +copy_src+, +copy_bin+,
-and +copy_doc+ are all run in parallel. Note that +prep_for_copy+ is
-run only once, even though it is referenced in multiple threads.
-
-=== Thread Safety
-
-The Rake internal data structures are thread-safe with respect
-to the multitask parallel execution, so there is no need for the user
-to do extra synchronization for Rake's benefit. However, if there are
-user data structures shared between the parallel prerequisites, the
-user must do whatever is necessary to prevent race conditions.
-
-== Tasks with Arguments
-
-Prior to version 0.8.0, rake was only able to handle command line
-arguments of the form NAME=VALUE that were passed into Rake via the
-ENV hash. Many folks had asked for some kind of simple command line
-arguments, perhaps using "--" to separate regular task names from
-argument values on the command line. The problem is that there was no
-easy way to associate positional arguments on the command line with
-different tasks. Suppose both tasks :a and :b expect a command line
-argument: does the first value go with :a? What if :b is run first?
-Should it then get the first command line argument.
-
-Rake 0.8.0 solves this problem by explicitly passing values directly
-to the tasks that need them. For example, if I had a release task
-that required a version number, I could say:
-
- rake release[0.8.2]
-
-And the string "0.8.2" will be passed to the :release task. Multiple
-arguments can be passed by separating them with a comma, for example:
-
- rake name[john,doe]
-
-Just a few words of caution. The rake task name and its arguments
-need to be a single command line argument to rake. This generally
-means no spaces. If spaces are needed, then the entire rake +
-argument string should be quoted. Something like this:
-
- rake "name[billy bob, smith]"
-
-(Quoting rules vary between operating systems and shells, so make sure
-you consult the proper docs for your OS/shell).
-
-=== Tasks Arguments and the Environment
-
-Task argument values can also be picked up from the environment. For
-example, if the "release" task expected a parameter named
-"release_version", then either
-
- rake release[0.8.2]
-
-or
-
- RELEASE_VERSION rake release
-
-will work. Environment variable names must either match the task
-parameter exactly, or match an all-uppercase version of the task
-parameter.
-
-=== Tasks that Expect Parameters
-
-Parameters are only given to tasks that are setup to expect them. In
-order to handle named parameters, the task declaration syntax for
-tasks has been extended slightly.
-
-For example, a task that needs a first name and last name might be
-declared as:
-
- task :name, [:first_name, :last_name]
-
-The first argument is still the name of the task (:name in this case).
-The next two arguments are the names of the parameters expected by
-:name in an array (:first_name and :last_name in the example).
-
-To access the values of the parameters, the block defining the task
-behaviour can now accept a second parameter:
-
- task :name, [:first_name, :last_name] do |t, args|
- puts "First name is #{args.first_name}"
- puts "Last name is #{args.last_name}"
- end
-
-The first argument of the block "t" is always bound to the current
-task object. The second argument "args" is an open-struct like object
-that allows access to the task arguments. Extra command line
-arguments to a task are ignored. Missing command line arguments are
-picked up from matching environment variables. If there are no
-matching environment variables, they are given the nil value.
-
-If you wish to specify default values for the arguments, you can use
-the with_defaults method in the task body. Here is the above example
-where we specify default values for the first and last names:
-
- task :name, [:first_name, :last_name] do |t, args|
- args.with_defaults(:first_name => "John", :last_name => "Dough")
- puts "First name is #{args.first_name}"
- puts "Last name is #{args.last_name}"
- end
-
-=== Tasks that Expect Parameters and Have Prerequisites
-
-Tasks that use parameters have a slightly different format for
-prerequisites. Use the arrow notation to indicate the prerequisites
-for tasks with arguments. For example:
-
- task :name, [:first_name, :last_name] => [:pre_name] do |t, args|
- args.with_defaults(:first_name => "John", :last_name => "Dough")
- puts "First name is #{args.first_name}"
- puts "Last name is #{args.last_name}"
- end
-
-=== Deprecated Task Parameters Format
-
-There is an older format for declaring task parameters that omitted
-the task argument array and used the :needs keyword to introduce the
-dependencies. That format is still supported for compatibility, but
-is not recommended for use. The older format may be dropped in future
-versions of rake.
-
-== Accessing Task Programmatically
-
-Sometimes it is useful to manipulate tasks programmatically in a
-Rakefile. To find a task object, use the <tt>:[]</tt> operator on the
-<tt>Rake::Task</tt>.
-
-=== Programmatic Task Example
-
-For example, the following Rakefile defines two tasks. The :doit task
-simply prints a simple "DONE" message. The :dont class will lookup
-the doit class and remove (clear) all of its prerequisites and
-actions.
-
- task :doit do
- puts "DONE"
- end
-
- task :dont do
- Rake::Task[:doit].clear
- end
-
-Running this example:
-
- $ rake doit
- (in /Users/jim/working/git/rake/x)
- DONE
- $ rake dont doit
- (in /Users/jim/working/git/rake/x)
- $
-
-The ability to programmatically manipulate tasks gives rake very
-powerful meta-programming capabilities w.r.t. task execution, but
-should be used with cation.
-
-== Rules
-
-When a file is named as a prerequisite, but does not have a file task
-defined for it, Rake will attempt to synthesize a task by looking at a
-list of rules supplied in the Rakefile.
-
-Suppose we were trying to invoke task "mycode.o", but no task is
-defined for it. But the rakefile has a rule that look like this ...
-
- rule '.o' => ['.c'] do |t|
- sh "cc #{t.source} -c -o #{t.name}"
- end
-
-This rule will synthesize any task that ends in ".o". It has a
-prerequisite a source file with an extension of ".c" must exist. If
-Rake is able to find a file named "mycode.c", it will automatically
-create a task that builds "mycode.o" from "mycode.c".
-
-If the file "mycode.c" does not exist, rake will attempt
-to recursively synthesize a rule for it.
-
-When a task is synthesized from a rule, the +source+ attribute of the
-task is set to the matching source file. This allows us to write
-rules with actions that reference the source file.
-
-=== Advanced Rules
-
-Any regular expression may be used as the rule pattern. Additionally,
-a proc may be used to calculate the name of the source file. This
-allows for complex patterns and sources.
-
-The following rule is equivalent to the example above.
-
- rule( /\.o$/ => [
- proc {|task_name| task_name.sub(/\.[^.]+$/, '.c') }
- ]) do |t|
- sh "cc #{t.source} -c -o #{t.name}"
- end
-
-<b>NOTE:</b> Because of a _quirk_ in Ruby syntax, parenthesis are
-required on *rule* when the first argument is a regular expression.
-
-The following rule might be used for Java files ...
-
- rule '.java' => [
- proc { |tn| tn.sub(/\.class$/, '.java').sub(/^classes\//, 'src/') }
- ] do |t|
- java_compile(t.source, t.name)
- end
-
-<b>NOTE:</b> +java_compile+ is a hypothetical method that invokes the
-java compiler.
-
-== Importing Dependencies
-
-Any ruby file (including other rakefiles) can be included with a
-standard Ruby +require+ command. The rules and declarations in the
-required file are just added to the definitions already accumulated.
-
-Because the files are loaded _before_ the rake targets are evaluated,
-the loaded files must be "ready to go" when the rake command is
-invoked. This make generated dependency files difficult to use. By
-the time rake gets around to updating the dependencies file, it is too
-late to load it.
-
-The +Rake.import+ command addresses this by specifying a file to be
-loaded _after_ the main rakefile is loaded, but _before_ any targets
-on the command line are invoked. In addition, if the file name
-matches an explicit task, that task is invoked before loading the
-file. This allows dependency files to be generated and used in a
-single rake command invocation.
-
-<b>NOTE:</b> Starting in Rake version 0.9.0, the top level +import+
-command is deprecated and we recommend using the scoped
-"+Rake.import+" command mentioned above. Future versions of Rake will
-drop support for the top level +import+ command.
-
-=== Example:
-
- require 'rake/loaders/makefile'
-
- file ".depends.mf" => [SRC_LIST] do |t|
- sh "makedepend -f- -- #{CFLAGS} -- #{t.prerequisites} > #{t.name}"
- end
-
- Rake.import ".depends.mf"
-
-If ".depends" does not exist, or is out of date w.r.t. the source
-files, a new ".depends" file is generated using +makedepend+ before
-loading.
-
-== Comments
-
-Standard Ruby comments (beginning with "#") can be used anywhere it is
-legal in Ruby source code, including comments for tasks and rules.
-However, if you wish a task to be described using the "-T" switch,
-then you need to use the +desc+ command to describe the task.
-
-=== Example:
-
- desc "Create a distribution package"
- task :package => [ ... ] do ... end
-
-The "-T" switch (or "--tasks" if you like to spell things out) will
-display a list of tasks that have a description. If you use +desc+ to
-describe your major tasks, you have a semi-automatic way of generating
-a summary of your Rake file.
-
- traken$ rake -T
- (in /home/.../rake)
- rake clean # Remove any temporary products.
- rake clobber # Remove any generated file.
- rake clobber_rdoc # Remove rdoc products
- rake contrib_test # Run tests for contrib_test
- rake default # Default Task
- rake install # Install the application
- rake lines # Count lines in the main rake file
- rake rdoc # Build the rdoc HTML Files
- rake rerdoc # Force a rebuild of the RDOC files
- rake test # Run tests
- rake testall # Run all test targets
-
-Only tasks with descriptions will be displayed with the "-T" switch.
-Use "-P" (or "--prereqs") to get a list of all tasks and their
-prerequisites.
-
-== Namespaces
-
-As projects grow (and along with it, the number of tasks), it is
-common for task names to begin to clash. For example, if you might
-have a main program and a set of sample programs built by a single
-Rakefile. By placing the tasks related to the main program in one
-namespace, and the tasks for building the sample programs in a
-different namespace, the task names will not will not interfere with
-each other.
-
-For example:
-
- namespace "main" do
- task :build do
- # Build the main program
- end
- end
-
- namespace "samples" do
- task :build do
- # Build the sample programs
- end
- end
-
- task :build => ["main:build", "samples:build"]
-
-Referencing a task in a separate namespace can be achieved by
-prefixing the task name with the namespace and a colon
-(e.g. "main:build" refers to the :build task in the +main+ namespace).
-Nested namespaces are supported, so
-
-Note that the name given in the +task+ command is always the unadorned
-task name without any namespace prefixes. The +task+ command always
-defines a task in the current namespace.
-
-=== FileTasks
-
-File task names are not scoped by the namespace command. Since the
-name of a file task is the name of an actual file in the file system,
-it makes little sense to include file task names in name space.
-Directory tasks (created by the +directory+ command) are a type of
-file task and are also not affected by namespaces.
-
-=== Name Resolution
-
-When looking up a task name, rake will start with the current
-namespace and attempt to find the name there. If it fails to find a
-name in the current namespace, it will search the parent namespaces
-until a match is found (or an error occurs if there is no match).
-
-The "rake" namespace is a special implicit namespace that refers to
-the toplevel names.
-
-If a task name begins with a "^" character, the name resolution will
-start in the parent namespace. Multiple "^" characters are allowed.
-
-Here is an example file with multiple :run tasks and how various names
-resolve in different locations.
-
- task :run
-
- namespace "one" do
- task :run
-
- namespace "two" do
- task :run
-
- # :run => "one:two:run"
- # "two:run" => "one:two:run"
- # "one:two:run" => "one:two:run"
- # "one:run" => "one:run"
- # "^run" => "one:run"
- # "^^run" => "rake:run" (the top level task)
- # "rake:run" => "rake:run" (the top level task)
- end
-
- # :run => "one:run"
- # "two:run" => "one:two:run"
- # "^run" => "rake:run"
- end
-
- # :run => "rake:run"
- # "one:run" => "one:run"
- # "one:two:run" => "one:two:run"
-
-== FileLists
-
-FileLists are the way Rake manages lists of files. You can treat a
-FileList as an array of strings for the most part, but FileLists
-support some additional operations.
-
-=== Creating a FileList
-
-Creating a file list is easy. Just give it the list of file names:
-
- fl = FileList['file1.rb', file2.rb']
-
-Or give it a glob pattern:
-
- fl = FileList['*.rb']
-
-== Odds and Ends
-
-=== do/end versus { }
-
-Blocks may be specified with either a +do+/+end+ pair, or with curly
-braces in Ruby. We _strongly_ recommend using +do+/+end+ to specify the
-actions for tasks and rules. Because the rakefile idiom tends to
-leave off parentheses on the task/file/rule methods, unusual
-ambiguities can arise when using curly braces.
-
-For example, suppose that the method +object_files+ returns a list of
-object files in a project. Now we use +object_files+ as the
-prerequisites in a rule specified with actions in curly braces.
-
- # DON'T DO THIS!
- file "prog" => object_files {
- # Actions are expected here (but it doesn't work)!
- }
-
-Because curly braces have a higher precedence than +do+/+end+, the
-block is associated with the +object_files+ method rather than the
-+file+ method.
-
-This is the proper way to specify the task ...
-
- # THIS IS FINE
- file "prog" => object_files do
- # Actions go here
- end
-
-----
-
-== See
-
-* README.rdoc -- Main documentation for Rake.
diff --git a/doc/rake/rational.rdoc b/doc/rake/rational.rdoc
deleted file mode 100644
index 0e1c33873d..0000000000
--- a/doc/rake/rational.rdoc
+++ /dev/null
@@ -1,151 +0,0 @@
-= Why rake?
-
-Ok, let me state from the beginning that I never intended to write this
-code. I'm not convinced it is useful, and I'm not convinced anyone
-would even be interested in it. All I can say is that Why's onion truck
-must by been passing through the Ohio valley.
-
-What am I talking about? ... A Ruby version of Make.
-
-See, I can sense you cringing already, and I agree. The world certainly
-doesn't need yet another reworking of the "make" program. I mean, we
-already have "ant". Isn't that enough?
-
-It started yesterday. I was helping a coworker fix a problem in one of
-the Makefiles we use in our project. Not a particularly tough problem,
-but during the course of the conversation I began lamenting some of the
-shortcomings of make. In particular, in one of my makefiles I wanted to
-determine the name of a file dynamically and had to resort to some
-simple scripting (in Ruby) to make it work. "Wouldn't it be nice if you
-could just use Ruby inside a Makefile" I said.
-
-My coworker (a recent convert to Ruby) agreed, but wondered what it
-would look like. So I sketched the following on the whiteboard...
-
- "What if you could specify the make tasks in Ruby, like this ..."
-
- task "build" do
- java_compile(...args, etc ...)
- end
-
- "The task function would register "build" as a target to be made,
- and the block would be the action executed whenever the build
- system determined that it was time to do the build target."
-
-We agreed that would be cool, but writing make from scratch would be WAY
-too much work. And that was the end of that!
-
-... Except I couldn't get the thought out of my head. What exactly
-would be needed to make the about syntax work as a make file? Hmmm, you
-would need to register the tasks, you need some way of specifying
-dependencies between tasks, and some way of kicking off the process.
-Hey! What if we did ... and fifteen minutes later I had a working
-prototype of Ruby make, complete with dependencies and actions.
-
-I showed the code to my coworker and we had a good laugh. It was just
-about a page worth of code that reproduced an amazing amount of the
-functionality of make. We were both truly stunned with the power of
-Ruby.
-
-But it didn't do everything make did. In particular, it didn't have
-timestamp based file dependencies (where a file is rebuilt if any of its
-prerequisite files have a later timestamp). Obviously THAT would be a
-pain to add and so Ruby Make would remain an interesting experiment.
-
-... Except as I walked back to my desk, I started thinking about what
-file based dependencies would really need. Rats! I was hooked again,
-and by adding a new class and two new methods, file/timestamp
-dependencies were implemented.
-
-Ok, now I was really hooked. Last night (during CSI!) I massaged the
-code and cleaned it up a bit. The result is a bare-bones replacement
-for make in exactly 100 lines of code.
-
-For the curious, you can see it at ...
-* doc/proto_rake.rdoc
-
-Oh, about the name. When I wrote the example Ruby Make task on my
-whiteboard, my coworker exclaimed "Oh! I have the perfect name: Rake ...
-Get it? Ruby-Make. Rake!" He said he envisioned the tasks as leaves
-and Rake would clean them up ... or something like that. Anyways, the
-name stuck.
-
-Some quick examples ...
-
-A simple task to delete backup files ...
-
- task :clean do
- Dir['*~'].each {|fn| rm fn rescue nil}
- end
-
-Note that task names are symbols (they are slightly easier to type
-than quoted strings ... but you may use quoted string if you would
-rather). Rake makes the methods of the FileUtils module directly
-available, so we take advantage of the <tt>rm</tt> command. Also note
-the use of "rescue nil" to trap and ignore errors in the <tt>rm</tt>
-command.
-
-To run it, just type "rake clean". Rake will automatically find a
-Rakefile in the current directory (or above!) and will invoke the
-targets named on the command line. If there are no targets explicitly
-named, rake will invoke the task "default".
-
-Here's another task with dependencies ...
-
- task :clobber => [:clean] do
- rm_r "tempdir"
- end
-
-Task :clobber depends upon task :clean, so :clean will be run before
-:clobber is executed.
-
-Files are specified by using the "file" command. It is similar to the
-task command, except that the task name represents a file, and the task
-will be run only if the file doesn't exist, or if its modification time
-is earlier than any of its prerequisites.
-
-Here is a file based dependency that will compile "hello.cc" to
-"hello.o".
-
- file "hello.cc"
- file "hello.o" => ["hello.cc"] do |t|
- srcfile = t.name.sub(/\.o$/, ".cc")
- sh %{g++ #{srcfile} -c -o #{t.name}}
- end
-
-I normally specify file tasks with string (rather than symbols). Some
-file names can't be represented by symbols. Plus it makes the
-distinction between them more clear to the casual reader.
-
-Currently writing a task for each and every file in the project would be
-tedious at best. I envision a set of libraries to make this job
-easier. For instance, perhaps something like this ...
-
- require 'rake/ctools'
- Dir['*.c'].each do |fn|
- c_source_file(fn)
- end
-
-where "c_source_file" will create all the tasks need to compile all the
-C source files in a directory. Any number of useful libraries could be
-created for rake.
-
-That's it. There's no documentation (other than whats in this
-message). Does this sound interesting to anyone? If so, I'll continue
-to clean it up and write it up and publish it on RAA. Otherwise, I'll
-leave it as an interesting exercise and a tribute to the power of Ruby.
-
-Why /might/ rake be interesting to Ruby programmers. I don't know,
-perhaps ...
-
-* No weird make syntax (only weird Ruby syntax :-)
-* No need to edit or read XML (a la ant)
-* Platform independent build scripts.
-* Will run anywhere Ruby exists, so no need to have "make" installed.
- If you stay away from the "sys" command and use things like
- 'ftools', you can have a perfectly platform independent
- build script. Also rake is only 100 lines of code, so it can
- easily be packaged along with the rest of your code.
-
-So ... Sorry for the long rambling message. Like I said, I never
-intended to write this code at all.
diff --git a/doc/rake/release_notes/rake-0.8.7.rdoc b/doc/rake/release_notes/rake-0.8.7.rdoc
deleted file mode 100644
index 884f4c659e..0000000000
--- a/doc/rake/release_notes/rake-0.8.7.rdoc
+++ /dev/null
@@ -1,55 +0,0 @@
-= Rake 0.8.7 Released
-
-Rake version 0.8.5 introduced greatly improved support for executing
-commands on Windows. The "sh" command now has the same semantics on
-Windows that it has on Unix based platforms.
-
-Rake version 0.8.6 includes minor fixes the the RDoc generation.
-Rake version 0.8.7 includes a minor fix for JRuby running on windows.
-
-== Changes
-
-=== New Features / Enhancements in Version 0.8.5
-
-* Improved implementation of the Rake system command for Windows.
- (patch from James M. Lawrence/quix)
-
-* Support for Ruby 1.9's improved system command. (patch from James
- M. Lawrence/quix)
-
-* Rake now includes the configured extension when invoking an
- executable (Config::CONFIG['EXEEXT])
-
-=== Bug Fixes in Version 0.8.5
-
-* Environment variable keys are now correctly cased (it matters in
- some implementations).
-
-== What is Rake
-
-Rake is a build tool similar to the make program in many ways. But
-instead of cryptic make recipes, Rake uses standard Ruby code to
-declare tasks and dependencies. You have the full power of a modern
-scripting language built right into your build tool.
-
-== Availability
-
-The easiest way to get and install rake is via RubyGems ...
-
- gem install rake (you may need root/admin privileges)
-
-Otherwise, you can get it from the more traditional places:
-
-Home Page:: http://rake.rubyforge.org/
-Download:: http://rubyforge.org/project/showfiles.php?group_id=50
-GitHub:: git://github.com/jimweirich/rake.git
-
-== Thanks
-
-As usual, it was input from users that drove a alot of these changes. The
-following people either contributed patches, made suggestions or made
-otherwise helpful comments. Thanks to ...
-
-* Charles Nutter
-
--- Jim Weirich
diff --git a/doc/rake/release_notes/rake-0.9.0.rdoc b/doc/rake/release_notes/rake-0.9.0.rdoc
deleted file mode 100644
index 823483cc27..0000000000
--- a/doc/rake/release_notes/rake-0.9.0.rdoc
+++ /dev/null
@@ -1,112 +0,0 @@
-= Rake 0.9.0 Released
-
-Rake version 0.9.0 has a number of bug fixes and enhancments (see
-below for more details). Additionally, the internals have be slightly
-restructured and improved.
-
-== Changes
-
-=== New Features / Enhancements / Bug Fixes in Version 0.9.0
-
-* Rake now warns when the deprecated :needs syntax used (and suggests
- the proper syntax in the warning).
-
-* Moved Rake DSL commands to top level ruby object 'main'. Rake DSL
- commands are no longer private methods in Object. (Suggested by
- James M. Lawrence/quix)
-
-* Rake now uses case-insensitive comparisons to find the Rakefile on Windows.
- Based on patch by Roger Pack.
-
-* Rake now requires (instead of loads) files in the test task. Patch by Cezary
- Baginski.
-
-* Fixed typos. Patches by Sean Scot August Moon and R.T. Lechow.
-
-* Rake now prints the Rakefile directory only when it's different from the
- current directory. Patch by Alex Chaffee.
-
-* Improved rakefile_location discovery on Windows. Patch by James Tucker.
-
-* Rake now recognizes "Windows Server" as a windows system. Patch by Matthias
- Lüdtke
-
-* Rake::RDocTask is deprecated. Use RDoc::Task from RDoc 2.4.2+ (require
- 'rdoc/task')
-
-* Rake::GemPackageTask is deprecated. Use Gem::PackageTask (require
- 'rubygems/package_task')
-
-* Rake now outputs various messages to $stderr instead of $stdout.
-
-* Rake no longer emits warnings for Config. Patch by Santiago Pastorino.
-
-* Removed Rake's DSL methods from the top level scope. If you need to
- call 'task :xzy' in your code, include Rake::DSL into your class, or
- put the code in a Rake::DSL.environment do ... end block.
-
-* Split rake.rb into individual files.
-
-* Support for the --where (-W) flag for showing where a task is defined.
-
-* Fixed quoting in test task.
- (http://onestepback.org/redmine/issues/show/44,
- http://www.pivotaltracker.com/story/show/1223138)
-
-* Fixed the silent option parsing problem.
- (http://onestepback.org/redmine/issues/show/47)
-
-* Fixed :verbose=>false flag on sh and ruby commands.
-
-* Rake command line options may be given by default in a RAKEOPT
- environment variable.
-
-* Errors in Rake will now display the task invocation chain in effect
- at the time of the error.
-
-* Accepted change by warnickr to not expand test patterns in shell
- (allowing more files in the test suite).
-
-* Fixed that file tasks did not perform prereq lookups in scope
- (Redmine #57).
-
-== What is Rake
-
-Rake is a build tool similar to the make program in many ways. But
-instead of cryptic make recipes, Rake uses standard Ruby code to
-declare tasks and dependencies. You have the full power of a modern
-scripting language built right into your build tool.
-
-== Availability
-
-The easiest way to get and install rake is via RubyGems ...
-
- gem install rake (you may need root/admin privileges)
-
-Otherwise, you can get it from the more traditional places:
-
-Home Page:: http://rake.rubyforge.org/
-Download:: http://rubyforge.org/project/showfiles.php?group_id=50
-GitHub:: git://github.com/jimweirich/rake.git
-
-== Thanks
-
-As usual, it was input from users that drove a alot of these changes. The
-following people either contributed patches, made suggestions or made
-otherwise helpful comments. Thanks to ...
-
-* James M. Lawrence (quix)
-* Roger Pack
-* Cezary Baginski
-* Sean Scot August Moon
-* R.T. Lechow
-* Alex Chaffee
-* James Tucker
-* Matthias Lüdtke
-* Santiago Pastorino
-
-Also, bit thanks to Eric Hodel for assisting with getting this release
-out the door (where "assisting" includes, but is not by any means
-limited to, "pushing" me to get it done).
-
--- Jim Weirich
diff --git a/doc/rake/release_notes/rake-0.9.1.rdoc b/doc/rake/release_notes/rake-0.9.1.rdoc
deleted file mode 100644
index 70be8b5688..0000000000
--- a/doc/rake/release_notes/rake-0.9.1.rdoc
+++ /dev/null
@@ -1,52 +0,0 @@
-= Rake 0.9.1 Released
-
-Rake version 0.9.1 has a number of bug fixes and enhancments (see
-below for more details). Additionally, the internals have be slightly
-restructured and improved.
-
-== Changes
-
-Rake 0.9.1 adds back the global DSL methods, but with deprecation
-messages. This allows Rake 0.9.1 to be used with older rakefiles with
-warning messages.
-
-== What is Rake
-
-Rake is a build tool similar to the make program in many ways. But
-instead of cryptic make recipes, Rake uses standard Ruby code to
-declare tasks and dependencies. You have the full power of a modern
-scripting language built right into your build tool.
-
-== Availability
-
-The easiest way to get and install rake is via RubyGems ...
-
- gem install rake (you may need root/admin privileges)
-
-Otherwise, you can get it from the more traditional places:
-
-Home Page:: http://rake.rubyforge.org/
-Download:: http://rubyforge.org/project/showfiles.php?group_id=50
-GitHub:: git://github.com/jimweirich/rake.git
-
-== Thanks
-
-As usual, it was input from users that drove a alot of these changes. The
-following people either contributed patches, made suggestions or made
-otherwise helpful comments. Thanks to ...
-
-* James M. Lawrence (quix)
-* Roger Pack
-* Cezary Baginski
-* Sean Scot August Moon
-* R.T. Lechow
-* Alex Chaffee
-* James Tucker
-* Matthias Lüdtke
-* Santiago Pastorino
-
-Also, bit thanks to Eric Hodel for assisting with getting this release
-out the door (where "assisting" includes, but is not by any means
-limited to, "pushing" me to get it done).
-
--- Jim Weirich
diff --git a/doc/rake/release_notes/rake-0.9.2.2.rdoc b/doc/rake/release_notes/rake-0.9.2.2.rdoc
deleted file mode 100644
index d804aba81c..0000000000
--- a/doc/rake/release_notes/rake-0.9.2.2.rdoc
+++ /dev/null
@@ -1,55 +0,0 @@
-= Rake 0.9.3 Released
-
-Rake version 0.9.3 is mainly bug fixes.
-
-== Changes
-
-* The rake test loader now removes arguments it has processed. Issue #51
-* Rake::TaskArguments now responds to #values_at
-* RakeFileUtils.verbose_flag = nil silences output the same as 0.8.7
-* Rake tests are now directory-independent
-* Rake tests are no longer require flexmock
-* Commands constant is no longer polluting top level namespace.
-* Show only the interesting portion of the backtrace by default (James M. Lawrence).
-* Added --reduce-compat option to remove backward compatible DSL hacks (James M. Lawrence).
-
-== What is Rake
-
-Rake is a build tool similar to the make program in many ways. But
-instead of cryptic make recipes, Rake uses standard Ruby code to
-declare tasks and dependencies. You have the full power of a modern
-scripting language built right into your build tool.
-
-== Availability
-
-The easiest way to get and install rake is via RubyGems ...
-
- gem install rake (you may need root/admin privileges)
-
-Otherwise, you can get it from the more traditional places:
-
-Home Page:: http://rake.rubyforge.org/
-Download:: http://rubyforge.org/project/showfiles.php?group_id=50
-GitHub:: git://github.com/jimweirich/rake.git
-
-== Thanks
-
-As usual, it was input from users that drove a alot of these changes. The
-following people either contributed patches, made suggestions or made
-otherwise helpful comments. Thanks to ...
-
-* James M. Lawrence (quix)
-* Roger Pack
-* Cezary Baginski
-* Sean Scot August Moon
-* R.T. Lechow
-* Alex Chaffee
-* James Tucker
-* Matthias Lüdtke
-* Santiago Pastorino
-
-Also, bit thanks to Eric Hodel for assisting with getting this release
-out the door (where "assisting" includes, but is not by any means
-limited to, "pushing" me to get it done).
-
--- Jim Weirich
diff --git a/doc/rake/release_notes/rake-0.9.2.rdoc b/doc/rake/release_notes/rake-0.9.2.rdoc
deleted file mode 100644
index 2314193f5e..0000000000
--- a/doc/rake/release_notes/rake-0.9.2.rdoc
+++ /dev/null
@@ -1,49 +0,0 @@
-= Rake 0.9.2 Released
-
-Rake version 0.9.2 has a few small fixes. See below for details.
-
-== Changes
-
-* Support for Ruby 1.8.6 was fixed.
-* Global DSL warnings now honor --no-deprecate
-
-== What is Rake
-
-Rake is a build tool similar to the make program in many ways. But
-instead of cryptic make recipes, Rake uses standard Ruby code to
-declare tasks and dependencies. You have the full power of a modern
-scripting language built right into your build tool.
-
-== Availability
-
-The easiest way to get and install rake is via RubyGems ...
-
- gem install rake (you may need root/admin privileges)
-
-Otherwise, you can get it from the more traditional places:
-
-Home Page:: http://rake.rubyforge.org/
-Download:: http://rubyforge.org/project/showfiles.php?group_id=50
-GitHub:: git://github.com/jimweirich/rake.git
-
-== Thanks
-
-As usual, it was input from users that drove a alot of these changes. The
-following people either contributed patches, made suggestions or made
-otherwise helpful comments. Thanks to ...
-
-* James M. Lawrence (quix)
-* Roger Pack
-* Cezary Baginski
-* Sean Scot August Moon
-* R.T. Lechow
-* Alex Chaffee
-* James Tucker
-* Matthias Lüdtke
-* Santiago Pastorino
-
-Also, bit thanks to Eric Hodel for assisting with getting this release
-out the door (where "assisting" includes, but is not by any means
-limited to, "pushing" me to get it done).
-
--- Jim Weirich
diff --git a/doc/rake/release_notes/rake-0.9.3.rdoc b/doc/rake/release_notes/rake-0.9.3.rdoc
deleted file mode 100644
index 4476b4f184..0000000000
--- a/doc/rake/release_notes/rake-0.9.3.rdoc
+++ /dev/null
@@ -1,102 +0,0 @@
-= Rake 0.9.3 Released
-
-Rake version 0.9.3 contains some new, backwards compatible features and
-a number of bug fixes.
-
-== Changes
-
-=== New Features
-
-* Multitask tasks now use a thread pool. Use -j to limit the number of
- available threads.
-
-* Use -m to turn regular tasks into multitasks (use at your own risk).
-
-* You can now do "Rake.add_rakelib 'dir'" in your Rakefile to
- programatically add rake task libraries.
-
-* You can specific backtrace suppression patterns (see
- --supress-backtrace)
-
-* Directory tasks can now take prerequisites and actions
-
-* Use --backtrace to request a full backtrace without the task trace.
-
-* You can say "--backtrace=stdout" and "--trace=stdout" to route trace
- output to standard output rather than standard error.
-
-* Optional 'phony' target (enable with 'require 'rake/phony'") for
- special purpose builds.
-
-* Task#clear now clears task comments as well as actions and
- prerequisites. Task#clear_comment will specifically target comments.
-
-* The --all option will force -T and -D to consider all the tasks,
- with and without descriptions.
-
-=== Bug Fixes
-
-* Semi-colons in windows rakefile paths now work.
-
-* Improved Control-C support when invoking multiple test suites.
-
-* egrep method now reads files in text mode (better support for
- Windows)
-
-* Better deprecation line number reporting.
-
-* The -W option now works with all tasks, whether they have a
- description or not.
-
-* File globs in rake should not be sorted alphabetically, independent
- of file system and platform.
-
-* Numerous internal improvements.
-
-* Documentation typos and fixes.
-
-== What is Rake
-
-Rake is a build tool similar to the make program in many ways. But
-instead of cryptic make recipes, Rake uses standard Ruby code to
-declare tasks and dependencies. You have the full power of a modern
-scripting language built right into your build tool.
-
-== Availability
-
-The easiest way to get and install rake is via RubyGems ...
-
- gem install rake (you may need root/admin privileges)
-
-Otherwise, you can get it from the more traditional places:
-
-Home Page:: http://github.com/jimweirich/rake
-Download:: http://rubyforge.org/project/showfiles.php?group_id=50
-GitHub:: git://github.com/jimweirich/rake.git
-
-== Thanks
-
-As usual, it was input from users that drove a alot of these changes. The
-following people either contributed patches, made suggestions or made
-otherwise helpful comments. Thanks to ...
-
-* Aaron Patterson
-* Dylan Smith
-* Jo Liss
-* Jonas Pfenniger
-* Kazuki Tsujimoto
-* Michael Bishop
-* Michael Elufimov
-* NAKAMURA Usaku
-* Ryan Davis
-* Sam Grönblom
-* Sam Phippen
-* Sergio Wong
-* Tay Ray Chuan
-* grosser
-* quix
-
-Also, many thanks to Eric Hodel for assisting with getting this release
-out the door.
-
--- Jim Weirich
diff --git a/doc/rake/release_notes/rake-0.9.4.rdoc b/doc/rake/release_notes/rake-0.9.4.rdoc
deleted file mode 100644
index e5d45b46ab..0000000000
--- a/doc/rake/release_notes/rake-0.9.4.rdoc
+++ /dev/null
@@ -1,110 +0,0 @@
-= Rake 0.9.4 Released
-
-Rake version 0.9.4 contains a number of bug fixes.
-
-== Changes
-
-=== New Features (in 0.9.3)
-
-* Multitask tasks now use a thread pool. Use -j to limit the number of
- available threads.
-
-* Use -m to turn regular tasks into multitasks (use at your own risk).
-
-* You can now do "Rake.add_rakelib 'dir'" in your Rakefile to
- programatically add rake task libraries.
-
-* You can specific backtrace suppression patterns (see
- --supress-backtrace)
-
-* Directory tasks can now take prerequisites and actions
-
-* Use --backtrace to request a full backtrace without the task trace.
-
-* You can say "--backtrace=stdout" and "--trace=stdout" to route trace
- output to standard output rather than standard error.
-
-* Optional 'phony' target (enable with 'require 'rake/phony'") for
- special purpose builds.
-
-* Task#clear now clears task comments as well as actions and
- prerequisites. Task#clear_comment will specifically target comments.
-
-* The --all option will force -T and -D to consider all the tasks,
- with and without descriptions.
-
-=== Bug Fixes (0.9.3)
-
-* Semi-colons in windows rakefile paths now work.
-
-* Improved Control-C support when invoking multiple test suites.
-
-* egrep method now reads files in text mode (better support for
- Windows)
-
-* Better deprecation line number reporting.
-
-* The -W option now works with all tasks, whether they have a
- description or not.
-
-* File globs in rake should not be sorted alphabetically, independent
- of file system and platform.
-
-* Numerous internal improvements.
-
-* Documentation typos and fixes.
-
-=== Bug Fixes (0.9.4)
-
-* Exit status with failing tests is not correctly set to non-zero.
-
-* Simplified syntax for phony task (for older versions of RDoc).
-
-* Stand alone FileList usage gets glob function (without loading in
- extra dependencies)
-
-== What is Rake
-
-Rake is a build tool similar to the make program in many ways. But
-instead of cryptic make recipes, Rake uses standard Ruby code to
-declare tasks and dependencies. You have the full power of a modern
-scripting language built right into your build tool.
-
-== Availability
-
-The easiest way to get and install rake is via RubyGems ...
-
- gem install rake (you may need root/admin privileges)
-
-Otherwise, you can get it from the more traditional places:
-
-Home Page:: http://github.com/jimweirich/rake
-Download:: http://rubyforge.org/project/showfiles.php?group_id=50
-GitHub:: git://github.com/jimweirich/rake.git
-
-== Thanks
-
-As usual, it was input from users that drove a alot of these changes. The
-following people either contributed patches, made suggestions or made
-otherwise helpful comments. Thanks to ...
-
-* Aaron Patterson
-* Dylan Smith
-* Jo Liss
-* Jonas Pfenniger
-* Kazuki Tsujimoto
-* Michael Bishop
-* Michael Elufimov
-* NAKAMURA Usaku
-* Ryan Davis
-* Sam Grönblom
-* Sam Phippen
-* Sergio Wong
-* Tay Ray Chuan
-* grosser
-* quix
-
-Also, many thanks to Eric Hodel for assisting with getting this release
-out the door.
-
--- Jim Weirich
diff --git a/doc/rake/release_notes/rake-0.9.5.rdoc b/doc/rake/release_notes/rake-0.9.5.rdoc
deleted file mode 100644
index 88e2d7cf3b..0000000000
--- a/doc/rake/release_notes/rake-0.9.5.rdoc
+++ /dev/null
@@ -1,114 +0,0 @@
-= Rake 0.9.5 Released
-
-Rake version 0.9.5 contains a number of bug fixes.
-
-== Changes
-
-=== New Features (in 0.9.3)
-
-* Multitask tasks now use a thread pool. Use -j to limit the number of
- available threads.
-
-* Use -m to turn regular tasks into multitasks (use at your own risk).
-
-* You can now do "Rake.add_rakelib 'dir'" in your Rakefile to
- programatically add rake task libraries.
-
-* You can specific backtrace suppression patterns (see
- --supress-backtrace)
-
-* Directory tasks can now take prerequisites and actions
-
-* Use --backtrace to request a full backtrace without the task trace.
-
-* You can say "--backtrace=stdout" and "--trace=stdout" to route trace
- output to standard output rather than standard error.
-
-* Optional 'phony' target (enable with 'require 'rake/phony'") for
- special purpose builds.
-
-* Task#clear now clears task comments as well as actions and
- prerequisites. Task#clear_comment will specifically target comments.
-
-* The --all option will force -T and -D to consider all the tasks,
- with and without descriptions.
-
-=== Bug Fixes (0.9.3)
-
-* Semi-colons in windows rakefile paths now work.
-
-* Improved Control-C support when invoking multiple test suites.
-
-* egrep method now reads files in text mode (better support for
- Windows)
-
-* Better deprecation line number reporting.
-
-* The -W option now works with all tasks, whether they have a
- description or not.
-
-* File globs in rake should not be sorted alphabetically, independent
- of file system and platform.
-
-* Numerous internal improvements.
-
-* Documentation typos and fixes.
-
-=== Bug Fixes (0.9.4)
-
-* Exit status with failing tests is not correctly set to non-zero.
-
-* Simplified syntax for phony task (for older versions of RDoc).
-
-* Stand alone FileList usage gets glob function (without loading in
- extra dependencies)
-
-=== Bug Fixes (0.9.5)
-
-* --trace and --backtrace no longer swallow following task names.
-
-== What is Rake
-
-Rake is a build tool similar to the make program in many ways. But
-instead of cryptic make recipes, Rake uses standard Ruby code to
-declare tasks and dependencies. You have the full power of a modern
-scripting language built right into your build tool.
-
-== Availability
-
-The easiest way to get and install rake is via RubyGems ...
-
- gem install rake (you may need root/admin privileges)
-
-Otherwise, you can get it from the more traditional places:
-
-Home Page:: http://github.com/jimweirich/rake
-Download:: http://rubyforge.org/project/showfiles.php?group_id=50
-GitHub:: git://github.com/jimweirich/rake.git
-
-== Thanks
-
-As usual, it was input from users that drove a alot of these changes. The
-following people either contributed patches, made suggestions or made
-otherwise helpful comments. Thanks to ...
-
-* Aaron Patterson
-* Dylan Smith
-* Jo Liss
-* Jonas Pfenniger
-* Kazuki Tsujimoto
-* Michael Bishop
-* Michael Elufimov
-* NAKAMURA Usaku
-* Ryan Davis
-* Sam Grönblom
-* Sam Phippen
-* Sergio Wong
-* Tay Ray Chuan
-* grosser
-* quix
-
-Also, many thanks to Eric Hodel for assisting with getting this release
-out the door.
-
--- Jim Weirich
diff --git a/doc/rake/release_notes/rake-0.9.6.rdoc b/doc/rake/release_notes/rake-0.9.6.rdoc
deleted file mode 100644
index e1c5f88ca7..0000000000
--- a/doc/rake/release_notes/rake-0.9.6.rdoc
+++ /dev/null
@@ -1,127 +0,0 @@
-= Rake 0.9.6 Released
-
-Rake version 0.9.6 contains a number of fixes mainly for merging
-Rake into the Ruby source tree and fixing tests.
-
-== Changes
-
-=== New Features (in 0.9.3)
-
-* Multitask tasks now use a thread pool. Use -j to limit the number of
- available threads.
-
-* Use -m to turn regular tasks into multitasks (use at your own risk).
-
-* You can now do "Rake.add_rakelib 'dir'" in your Rakefile to
- programatically add rake task libraries.
-
-* You can specific backtrace suppression patterns (see
- --supress-backtrace)
-
-* Directory tasks can now take prerequisites and actions
-
-* Use --backtrace to request a full backtrace without the task trace.
-
-* You can say "--backtrace=stdout" and "--trace=stdout" to route trace
- output to standard output rather than standard error.
-
-* Optional 'phony' target (enable with 'require 'rake/phony'") for
- special purpose builds.
-
-* Task#clear now clears task comments as well as actions and
- prerequisites. Task#clear_comment will specifically target comments.
-
-* The --all option will force -T and -D to consider all the tasks,
- with and without descriptions.
-
-=== Bug Fixes (0.9.3)
-
-* Semi-colons in windows rakefile paths now work.
-
-* Improved Control-C support when invoking multiple test suites.
-
-* egrep method now reads files in text mode (better support for
- Windows)
-
-* Better deprecation line number reporting.
-
-* The -W option now works with all tasks, whether they have a
- description or not.
-
-* File globs in rake should not be sorted alphabetically, independent
- of file system and platform.
-
-* Numerous internal improvements.
-
-* Documentation typos and fixes.
-
-=== Bug Fixes (0.9.4)
-
-* Exit status with failing tests is not correctly set to non-zero.
-
-* Simplified syntax for phony task (for older versions of RDoc).
-
-* Stand alone FileList usage gets glob function (without loading in
- extra dependencies)
-
-=== Bug Fixes (0.9.5)
-
-* --trace and --backtrace no longer swallow following task names.
-
-=== Bug Fixes (0.9.6)
-
-* Better trace output when using a multi-threaded Rakefile.
-* Arg parsing is now consistent for tasks and multitasks.
-* Skip exit code test in versions of Ruby that don't support it well.
-
-Changes for better integration with the Ruby source tree:
-
-* Fix version literal for Ruby source tree build.
-* Better loading of libraries for testing in Ruby build.
-* Use the ruby version provided by Ruby's tests.
-
-== What is Rake
-
-Rake is a build tool similar to the make program in many ways. But
-instead of cryptic make recipes, Rake uses standard Ruby code to
-declare tasks and dependencies. You have the full power of a modern
-scripting language built right into your build tool.
-
-== Availability
-
-The easiest way to get and install rake is via RubyGems ...
-
- gem install rake (you may need root/admin privileges)
-
-Otherwise, you can get it from the more traditional places:
-
-Home Page:: http://github.com/jimweirich/rake
-Download:: http://rubyforge.org/project/showfiles.php?group_id=50
-GitHub:: git://github.com/jimweirich/rake.git
-
-== Thanks
-
-As usual, it was input from users that drove a alot of these changes. The
-following people either contributed patches, made suggestions or made
-otherwise helpful comments. Thanks to ...
-
-* Aaron Patterson
-* Dylan Smith
-* Jo Liss
-* Jonas Pfenniger
-* Kazuki Tsujimoto
-* Michael Bishop
-* Michael Elufimov
-* NAKAMURA Usaku
-* Ryan Davis
-* Sam Grönblom
-* Sam Phippen
-* Sergio Wong
-* Tay Ray Chuan
-* grosser
-* quix
-
-Also, many thanks to Eric Hodel for assisting with getting this release
-out the door.
-
--- Jim Weirich
diff --git a/doc/re.rdoc b/doc/regexp.rdoc
index 1c68533a8d..810f15ce1a 100644
--- a/doc/re.rdoc
+++ b/doc/regexp.rdoc
@@ -16,9 +16,12 @@ example:
If a string contains the pattern it is said to <i>match</i>. A literal
string matches itself.
- # 'haystack' does not contain the pattern 'needle', so doesn't match.
+Here 'haystack' does not contain the pattern 'needle', so it doesn't match:
+
/needle/.match('haystack') #=> nil
- # 'haystack' does contain the pattern 'hay', so it matches
+
+Here 'haystack' contains the pattern 'hay', so it matches:
+
/hay/.match('haystack') #=> #<MatchData "hay">
Specifically, <tt>/st/</tt> requires that the string contains the letter
@@ -50,7 +53,7 @@ object. Regexp.last_match is equivalent to <tt>$~</tt>.
=== Regexp#match method
-#match method return a MatchData object :
+The #match method returns a MatchData object:
/st/.match('haystack') #=> #<MatchData "st">
@@ -108,7 +111,9 @@ operator which performs set intersection on its arguments. The two can be
combined as follows:
/[a-w&&[^c-g]z]/ # ([a-w] AND ([^c-g] OR z))
- # This is equivalent to:
+
+This is equivalent to:
+
/[abh-w]/
The following metacharacters also behave like character classes:
@@ -116,7 +121,9 @@ The following metacharacters also behave like character classes:
* <tt>/./</tt> - Any character except a newline.
* <tt>/./m</tt> - Any character (the +m+ modifier enables multiline mode)
* <tt>/\w/</tt> - A word character (<tt>[a-zA-Z0-9_]</tt>)
-* <tt>/\W/</tt> - A non-word character (<tt>[^a-zA-Z0-9_]</tt>)
+* <tt>/\W/</tt> - A non-word character (<tt>[^a-zA-Z0-9_]</tt>).
+ Please take a look at {Bug #4044}[https://bugs.ruby-lang.org/issues/4044] if
+ using <tt>/\W/</tt> with the <tt>/i</tt> modifier.
* <tt>/\d/</tt> - A digit character (<tt>[0-9]</tt>)
* <tt>/\D/</tt> - A non-digit character (<tt>[^0-9]</tt>)
* <tt>/\h/</tt> - A hexdigit character (<tt>[0-9a-fA-F]</tt>)
@@ -173,8 +180,9 @@ to occur. Such metacharacters are called <i>quantifiers</i>.
* <tt>{</tt><i>n</i><tt>,</tt><i>m</i><tt>}</tt> - At least <i>n</i> and
at most <i>m</i> times
- # At least one uppercase character ('H'), at least one lowercase
- # character ('e'), two 'l' characters, then one 'o'
+At least one uppercase character ('H'), at least one lowercase character
+('e'), two 'l' characters, then one 'o':
+
"Hello".match(/[[:upper:]]+[[:lower:]]+l{2}o/) #=> #<MatchData "Hello">
Repetition is <i>greedy</i> by default: as many occurrences as possible
@@ -183,9 +191,10 @@ contrast, <i>lazy</i> matching makes the minimal amount of matches
necessary for overall success. A greedy metacharacter can be made lazy by
following it with <tt>?</tt>.
- # Both patterns below match the string. The first uses a greedy
- # quantifier so '.+' matches '<a><b>'; the second uses a lazy
- # quantifier so '.+?' matches '<a>'.
+Both patterns below match the string. The first uses a greedy quantifier so
+'.+' matches '<a><b>'; the second uses a lazy quantifier so '.+?' matches
+'<a>':
+
/<.+>/.match("<a><b>") #=> #<MatchData "<a><b>">
/<.+?>/.match("<a><b>") #=> #<MatchData "<a>">
@@ -202,12 +211,15 @@ with <i>n</i>. Within a pattern use the <i>backreference</i>
<tt>\n</tt>; outside of the pattern use
<tt>MatchData[</tt><i>n</i><tt>]</tt>.
- # 'at' is captured by the first group of parentheses, then referred to
- # later with \1
+'at' is captured by the first group of parentheses, then referred to later
+with <tt>\1</tt>:
+
/[csh](..) [csh]\1 in/.match("The cat sat in the hat")
#=> #<MatchData "cat sat in" 1:"at">
- # Regexp#match returns a MatchData object which makes the captured
- # text available with its #[] method.
+
+Regexp#match returns a MatchData object which makes the captured text
+available with its #[] method:
+
/[csh](..) [csh]\1 in/.match("The cat sat in the hat")[1] #=> 'at'
Capture groups can be referred to by name when defined with the
@@ -239,11 +251,13 @@ also assigned to local variables with corresponding names.
Parentheses also <i>group</i> the terms they enclose, allowing them to be
quantified as one <i>atomic</i> whole.
- # The pattern below matches a vowel followed by 2 word characters:
- # 'aen'
+The pattern below matches a vowel followed by 2 word characters:
+
/[aeiou]\w{2}/.match("Caenorhabditis elegans") #=> #<MatchData "aen">
- # Whereas the following pattern matches a vowel followed by a word
- # character, twice, i.e. <tt>[aeiou]\w[aeiou]\w</tt>: 'enor'.
+
+Whereas the following pattern matches a vowel followed by a word character,
+twice, i.e. <tt>[aeiou]\w[aeiou]\w</tt>: 'enor'.
+
/([aeiou]\w){2}/.match("Caenorhabditis elegans")
#=> #<MatchData "enor" 1:"or">
@@ -252,13 +266,16 @@ capturing. That is, it combines the terms it contains into an atomic whole
without creating a backreference. This benefits performance at the slight
expense of readability.
- # The group of parentheses captures 'n' and the second 'ti'. The
- # second group is referred to later with the backreference \2
+The first group of parentheses captures 'n' and the second 'ti'. The second
+group is referred to later with the backreference <tt>\2</tt>:
+
/I(n)ves(ti)ga\2ons/.match("Investigations")
#=> #<MatchData "Investigations" 1:"n" 2:"ti">
- # The first group of parentheses is now made non-capturing with '?:',
- # so it still matches 'n', but doesn't create the backreference. Thus,
- # the backreference \1 now refers to 'ti'.
+
+The first group of parentheses is now made non-capturing with '?:', so it
+still matches 'n', but doesn't create the backreference. Thus, the
+backreference <tt>\1</tt> now refers to 'ti'.
+
/I(?:n)ves(ti)ga\1ons/.match("Investigations")
#=> #<MatchData "Investigations" 1:"ti">
@@ -273,14 +290,16 @@ way <i>pat</i> is treated as a non-divisible whole. Atomic grouping is
typically used to optimise patterns so as to prevent the regular
expression engine from backtracking needlessly.
- # The <tt>"</tt> in the pattern below matches the first character of
- # the string, then <tt>.*</tt> matches <i>Quote"</i>. This causes the
- # overall match to fail, so the text matched by <tt>.*</tt> is
- # backtracked by one position, which leaves the final character of the
- # string available to match <tt>"</tt>
+The <tt>"</tt> in the pattern below matches the first character of the string,
+then <tt>.*</tt> matches <i>Quote"</i>. This causes the overall match to fail,
+so the text matched by <tt>.*</tt> is backtracked by one position, which
+leaves the final character of the string available to match <tt>"</tt>
+
/".*"/.match('"Quote"') #=> #<MatchData "\"Quote\"">
- # If <tt>.*</tt> is grouped atomically, it refuses to backtrack
- # <i>Quote"</i>, even though this means that the overall match fails
+
+If <tt>.*</tt> is grouped atomically, it refuses to backtrack <i>Quote"</i>,
+even though this means that the overall match fails
+
/"(?>.*)"/.match('"Quote"') #=> nil
== Subexpression Calls
@@ -290,9 +309,10 @@ subexpression named _name_, which can be a group name or number, again.
This differs from backreferences in that it re-executes the group rather
than simply trying to re-match the same text.
- # Matches a <i>(</i> character and assigns it to the <tt>paren</tt>
- # group, tries to call that the <tt>paren</tt> sub-expression again
- # but fails, then matches a literal <i>)</i>.
+This pattern matches a <i>(</i> character and assigns it to the <tt>paren</tt>
+group, tries to call that the <tt>paren</tt> sub-expression again but fails,
+then matches a literal <i>)</i>:
+
/\A(?<paren>\(\g<paren>*\))*\z/ =~ '()'
@@ -426,15 +446,17 @@ following scripts are supported: <i>Arabic</i>, <i>Armenian</i>,
<i>Tamil</i>, <i>Telugu</i>, <i>Thaana</i>, <i>Thai</i>, <i>Tibetan</i>,
<i>Tifinagh</i>, <i>Ugaritic</i>, <i>Vai</i>, and <i>Yi</i>.
- # Unicode codepoint U+06E9 is named "ARABIC PLACE OF SAJDAH" and
- # belongs to the Arabic script.
+Unicode codepoint U+06E9 is named "ARABIC PLACE OF SAJDAH" and belongs to the
+Arabic script:
+
/\p{Arabic}/.match("\u06E9") #=> #<MatchData "\u06E9">
All character properties can be inverted by prefixing their name with a
caret (<tt>^</tt>).
- # Letter 'A' is not in the Unicode Ll (Letter; Lowercase) category, so
- # this match succeeds
+Letter 'A' is not in the Unicode Ll (Letter; Lowercase) category, so this
+match succeeds:
+
/\p{^Ll}/.match("A") #=> #<MatchData "A">
== Anchors
@@ -465,22 +487,30 @@ characters, <i>anchoring</i> the match to a specific position.
assertion: ensures that the preceding characters do not match
<i>pat</i>, but doesn't include those characters in the matched text
- # If a pattern isn't anchored it can begin at any point in the string
+If a pattern isn't anchored it can begin at any point in the string:
+
/real/.match("surrealist") #=> #<MatchData "real">
- # Anchoring the pattern to the beginning of the string forces the
- # match to start there. 'real' doesn't occur at the beginning of the
- # string, so now the match fails
+
+Anchoring the pattern to the beginning of the string forces the match to start
+there. 'real' doesn't occur at the beginning of the string, so now the match
+fails:
+
/\Areal/.match("surrealist") #=> nil
- # The match below fails because although 'Demand' contains 'and', the
- pattern does not occur at a word boundary.
+
+The match below fails because although 'Demand' contains 'and', the pattern
+does not occur at a word boundary.
+
/\band/.match("Demand")
- # Whereas in the following example 'and' has been anchored to a
- # non-word boundary so instead of matching the first 'and' it matches
- # from the fourth letter of 'demand' instead
+
+Whereas in the following example 'and' has been anchored to a non-word
+boundary so instead of matching the first 'and' it matches from the fourth
+letter of 'demand' instead:
+
/\Band.+/.match("Supply and demand curve") #=> #<MatchData "and curve">
- # The pattern below uses positive lookahead and positive lookbehind to
- # match text appearing in <b></b> tags without including the tags in the
- # match
+
+The pattern below uses positive lookahead and positive lookbehind to match
+text appearing in <b></b> tags without including the tags in the match:
+
/(?<=<b>)\w+(?=<\/b>)/.match("Fortune favours the <b>bold</b>")
#=> #<MatchData "bold">
@@ -515,10 +545,11 @@ 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 organised in a
+the line. This allows the components of the pattern to be organized in a
potentially more readable fashion.
- # A contrived pattern to match a number with optional decimal places
+A contrived pattern to match a number with optional decimal places:
+
float_pat = /\A
[[:digit:]]+ # 1 or more digits before the decimal point
(\. # Decimal point
@@ -527,8 +558,11 @@ potentially more readable fashion.
\Z/x
float_pat.match('3.14') #=> #<MatchData "3.14" 1:".14">
-*Note*: To match whitespace in an <tt>x</tt> pattern use an escape such as
-<tt>\s</tt> or <tt>\p{Space}</tt>.
+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>.
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
@@ -577,7 +611,7 @@ Example:
m = /s(\w{2}).*(c)/.match('haystack') #=> #<MatchData "stac" 1:"ta" 2:"c">
$~ #=> #<MatchData "stac" 1:"ta" 2:"c">
- Regexp.latch_match #=> #<MatchData "stac" 1:"ta" 2:"c">
+ Regexp.last_match #=> #<MatchData "stac" 1:"ta" 2:"c">
$& #=> "stac"
# same as m[0]
@@ -611,7 +645,7 @@ The following patterns match instantly as you would expect:
/(b|a)/ =~ s #=> 0
/(b|a+)/ =~ s #=> 0
- /(b|a+)*\/ =~ s #=> 0
+ /(b|a+)*/ =~ s #=> 0
However, the following pattern takes appreciably longer:
@@ -634,8 +668,9 @@ backtracking:
A similar case is typified by the following example, which takes
approximately 60 seconds to execute for me:
- # Match a string of 29 <i>a</i>s against a pattern of 29 optional
- # <i>a</i>s followed by 29 mandatory <i>a</i>s.
+Match a string of 29 <i>a</i>s against a pattern of 29 optional <i>a</i>s
+followed by 29 mandatory <i>a</i>s:
+
Regexp.new('a?' * 29 + 'a' * 29) =~ 'a' * 29
The 29 optional <i>a</i>s match the string, but this prevents the 29
diff --git a/doc/security.rdoc b/doc/security.rdoc
index 2cf6531785..d8efca0042 100644
--- a/doc/security.rdoc
+++ b/doc/security.rdoc
@@ -21,12 +21,7 @@ Ruby provides a mechanism to restrict what operations can be performed by Ruby
code in the form of the <code>$SAFE</code> variable.
However, <code>$SAFE</code> does not provide a secure environment for executing
-untrusted code even at its maximum level of +4+. <code>$SAFE</code> is
-inherently flawed as a security mechanism, as it relies on every unsafe
-operation performed by any C method to be guarded by a <code>$SAFE</code>
-check. If this check is ever missed, the entire security of the system is
-compromised. <code>$SAFE</code> also does not offer any protection against
-denial of service attacks.
+untrusted code.
If you need to execute untrusted code, you should use an operating system level
sandboxing mechanism. On Linux, ptrace or LXC can be used to sandbox
@@ -51,7 +46,7 @@ manually. Never deserialize to a user specified class.
== YAML
YAML is a popular human readable data serialization format used by many Ruby
-programs for configuration and database persistance of Ruby object trees.
+programs for configuration and database persistence of Ruby object trees.
Similar to +Marshal+, it is able to deserialize into arbitrary Ruby classes.
For example, the following YAML data will create an +ERB+ object when
diff --git a/doc/standard_library.rdoc b/doc/standard_library.rdoc
index e94727f913..448635758b 100644
--- a/doc/standard_library.rdoc
+++ b/doc/standard_library.rdoc
@@ -92,7 +92,6 @@ 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
diff --git a/doc/syntax/assignment.rdoc b/doc/syntax/assignment.rdoc
index 7424d4885f..adfe6485a4 100644
--- a/doc/syntax/assignment.rdoc
+++ b/doc/syntax/assignment.rdoc
@@ -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 left-hand side of the assignment:
+You can splat anywhere in the right-hand side of the assignment:
a = 1, *[2, 3]
@@ -382,7 +382,7 @@ You can splat anywhere in the left-hand side of the assignment:
== Multiple Assignment
-You can assign multiple values on the left-hand side to multiple variables:
+You can assign multiple values on the right-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 left hand side of the assignment than variables
-on the right hand side the extra values are ignored:
+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:
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 right-hand side:
+The <code>*</code> can appear anywhere on the left-hand side:
*a, b = 1, 2, 3
diff --git a/doc/syntax/literals.rdoc b/doc/syntax/literals.rdoc
index bfe070b0ab..32e10edd30 100644
--- a/doc/syntax/literals.rdoc
+++ b/doc/syntax/literals.rdoc
@@ -100,7 +100,8 @@ 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>).
+escape sequences except for the single-quote (<tt>\'</tt>) and backslash
+(<tt>\\\\</tt>).
You may also create strings using <tt>%</tt>:
@@ -111,6 +112,18 @@ 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.
+Adjacent string literals are automatically concatenated by the interpreter:
+
+ "con" "cat" "en" "at" "ion" #=> "concatenation"
+ "This string contains "\
+ "no newlines." #=> "This string contains no newlines."
+
+Any combination of adjacent single-quote, double-quote, percent strings will
+be concatenated as long as a percent-string is not last.
+
+ %q{a} 'b' "c" #=> "abc"
+ "a" 'b' %q{c} #=> NameError: uninitialized constant q
+
=== Here Documents
If you are writing a large block of text you may use a "here document" or
@@ -191,7 +204,7 @@ symbols using interpolation.
Like strings, a single-quote may be used to disable interpolation:
- :"my_symbol#{1 + 1}" #=> :"my_symbol\#{1 + 1}"
+ :'my_symbol#{1 + 1}' #=> :"my_symbol\#{1 + 1}"
When creating a Hash there is a special syntax for referencing a Symbol as
well.
diff --git a/doc/syntax/methods.rdoc b/doc/syntax/methods.rdoc
index 7fd69983f3..648843e753 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, then the +end+ keyword. When called the method will execute the
-body of the method. This method returns +2+.
+the method, +return+ value and 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,27 +17,50 @@ 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. Typically method names are US-ASCII compatible since
-the keys to type them exist on all keyboards.
+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:
-(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 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
+
+ def こんにちは
+ puts "means hello in Japanese"
+ end
-Method names may contain letters, numbers, an <code>_</code> (underscore or
-low line) or a character with the eight bit set.
+Typically method names are US-ASCII compatible since the keys to type them
+exist on all keyboards.
Method names may end with a <code>!</code> (bang or exclamation mark), a
<code>?</code> (question mark) or <code>=</code> equals sign.
-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).
+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 has does not
+modify the receiver. This convention is typically true for ruby core libary but
+may/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 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, the arguments are returned
@@ -360,7 +383,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_method.call(self)
+ my_block.call(self)
end
Most frequently the block argument is used to pass a block to another method:
diff --git a/doc/syntax/modules_and_classes.rdoc b/doc/syntax/modules_and_classes.rdoc
index f4ab1ea6f9..a82a6f27ed 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
-Curses namespace provides functionality for curses that prevents a collision
-for the common name "Window".
+IRB namespace provides functionality for irb that prevents a collision
+for the common name "Context".
Mix-in functionality allows sharing common methods across multiple classes or
modules. Ruby comes with the Enumerable mix-in module which provides many
diff --git a/doc/syntax/refinements.rdoc b/doc/syntax/refinements.rdoc
index 7b3f0f6127..62405a78b7 100644
--- a/doc/syntax/refinements.rdoc
+++ b/doc/syntax/refinements.rdoc
@@ -42,15 +42,16 @@ Activate the refinement with #using:
using M
- x = C.new
+ c = C.new
c.foo # prints "C#foo in M"
== Scope
-You may only activate refinements at top-level to the end of the file or in a
-string passed to Kernel#eval, Kernel#instance_eval or Kernel#module_eval until
-the end of the 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. When control is transferred outside the
scope the refinement is deactivated. This means that if you require or load a
@@ -186,6 +187,25 @@ 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
When looking up a method for an instance of class +C+ Ruby checks:
@@ -232,6 +252,12 @@ 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
diff --git a/enc/big5.c b/enc/big5.c
index 9d7738d8f9..27315c4ba9 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 014fc4f584..d3e1f3c74b 100644
--- a/enc/depend
+++ b/enc/depend
@@ -12,6 +12,7 @@
% transvpath_prefix = (rule_subst.dup.sub!(/\{[^{}]+\}/, '{$(TRANSVPATH)}') || "%s") % ""
% CONFIG['ARFLAGS'] = 'rcu ' if (CONFIG['ARFLAGS'] || "").empty?
% CONFIG['RANLIB'] = ':' if (CONFIG['RANLIB'] || "").empty?
+% CONFIG['CPPFLAGS'] += " -DRUBY_EXPORT=1" if CONFIG["EXTSTATIC"] == "static"
% if File::ALT_SEPARATOR
% pathrep = proc {|path| path.gsub('/', File::ALT_SEPARATOR).gsub(/\$\(([@<?*]\w?|\w+)\)/, "$(\\1:/=\\#{File::ALT_SEPARATOR})")}
% else
@@ -82,13 +83,13 @@ srcs: $(TRANSCSRCS)
% unless ENCS.empty? or TRANS.empty?
% unless ENCS.empty?
-$(ENCOBJS): regenc.h oniguruma.h config.h defines.h
+$(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): ruby.h intern.h config.h defines.h missing.h encoding.h oniguruma.h st.h transcode_data.h
+$(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"
@@ -143,6 +144,7 @@ clean:
% @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|
@@ -153,7 +155,9 @@ 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 : -%>
diff --git a/enc/encdb.c b/enc/encdb.c
index 32def53aeb..fa04a5f7f6 100644
--- a/enc/encdb.c
+++ b/enc/encdb.c
@@ -14,13 +14,15 @@ 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)
#define ENC_DEFINE(name) rb_encdb_declare(name)
#define ENC_SET_BASE(name, orig) rb_enc_set_base((name), (orig))
-#define ENC_DUMMY_UNICODE(name) rb_encdb_set_unicode(ENC_DUMMY(name))
+#define ENC_SET_DUMMY(name, orig) rb_enc_set_dummy(name)
+#define ENC_DUMMY_UNICODE(name) rb_encdb_set_unicode(rb_enc_set_dummy(ENC_REPLICATE((name), name "BE")))
void
Init_encdb(void)
diff --git a/enc/euc_jp.c b/enc/euc_jp.c
index d794145b49..61bb8ba65a 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(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
+ numberof(CaseFoldMap), CaseFoldMap, 0,
flag, f, arg);
}
@@ -418,12 +418,6 @@ 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
@@ -504,41 +498,20 @@ static const OnigCodePoint CR_Cyrillic[] = {
/* TODO: add JIS X 0212 row 7 */
}; /* CR_Cyrillic */
-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;
-}
+#include "enc/jis/props.h"
static int
property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
{
- st_data_t ctype;
- UChar *s, *e;
-
- PROPERTY_LIST_INIT_CHECK;
+ UChar *s = p, *e = end;
+ const struct enc_property *prop =
+ onig_jis_property((const char* )s, (unsigned int )(e - s));
- 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) {
+ if (!prop) {
return onigenc_minimum_property_name_to_ctype(enc, s, e);
}
- return (int )ctype;
+ return (int )prop->ctype;
}
static int
@@ -554,8 +527,6 @@ 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;
@@ -576,8 +547,6 @@ 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;
@@ -637,8 +606,8 @@ ENC_ALIAS("euc-jp-ms", "eucJP-ms")
ENC_REPLICATE("CP51932", "EUC-JP")
/*
- * Name: EUC-JP-2004
- * Link: http://ja.wikipedia.org/wiki/EUC-JP-2004
+ * Name: EUC-JIS-2004
+ * Link: http://ja.wikipedia.org/wiki/EUC-JIS-2004
*/
-ENC_REPLICATE("EUC-JP-2004", "EUC-JP") /* defined at JIS X 0213:2004 */
-ENC_ALIAS("EUC-JISX0213", "EUC-JP-2004") /* defined at JIS X 0213:2000, and obsolete at JIS X 0213:2004 */
+ENC_REPLICATE("EUC-JIS-2004", "EUC-JP") /* defined at JIS X 0213:2004 */
+ENC_ALIAS("EUC-JISX0213", "EUC-JIS-2004") /* defined at JIS X 0213:2000, and obsolete at JIS X 0213:2004 */
diff --git a/enc/iso_8859_1.c b/enc/iso_8859_1.c
index 92dc14f978..088b427d1c 100644
--- a/enc/iso_8859_1.c
+++ b/enc/iso_8859_1.c
@@ -29,8 +29,6 @@
#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)
diff --git a/enc/iso_8859_10.c b/enc/iso_8859_10.c
index ec20a15baa..ab71a5adcf 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(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
+ numberof(CaseFoldMap), 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(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
+ numberof(CaseFoldMap), CaseFoldMap, 1,
flag, p, end, items);
}
diff --git a/enc/iso_8859_13.c b/enc/iso_8859_13.c
index 4d7b328818..11b3dda1c9 100644
--- a/enc/iso_8859_13.c
+++ b/enc/iso_8859_13.c
@@ -197,7 +197,7 @@ apply_all_case_fold(OnigCaseFoldType flag,
OnigEncoding enc ARG_UNUSED)
{
return onigenc_apply_all_case_fold_with_map(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
+ numberof(CaseFoldMap), 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(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
+ numberof(CaseFoldMap), CaseFoldMap, 1,
flag, p, end, items);
}
diff --git a/enc/iso_8859_14.c b/enc/iso_8859_14.c
index 1271c8a7a6..2939e89b7b 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(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
+ numberof(CaseFoldMap), 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(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
+ numberof(CaseFoldMap), CaseFoldMap, 1,
flag, p, end, items);
}
diff --git a/enc/iso_8859_15.c b/enc/iso_8859_15.c
index 451033e158..fdb7ca12d7 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(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
+ numberof(CaseFoldMap), 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(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
+ numberof(CaseFoldMap), CaseFoldMap, 1,
flag, p, end, items);
}
diff --git a/enc/iso_8859_16.c b/enc/iso_8859_16.c
index 5234cf0e7f..5e53f3b6d0 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(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
+ numberof(CaseFoldMap), 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(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
+ numberof(CaseFoldMap), CaseFoldMap, 1,
flag, p, end, items);
}
diff --git a/enc/iso_8859_2.c b/enc/iso_8859_2.c
index f4cb9100df..94613e661b 100644
--- a/enc/iso_8859_2.c
+++ b/enc/iso_8859_2.c
@@ -29,8 +29,6 @@
#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)
diff --git a/enc/iso_8859_3.c b/enc/iso_8859_3.c
index 85572574b8..863a575020 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(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
+ numberof(CaseFoldMap), 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(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
+ numberof(CaseFoldMap), CaseFoldMap, 1,
flag, p, end, items);
}
diff --git a/enc/iso_8859_4.c b/enc/iso_8859_4.c
index 771a2cf6e7..48b999e756 100644
--- a/enc/iso_8859_4.c
+++ b/enc/iso_8859_4.c
@@ -206,7 +206,7 @@ apply_all_case_fold(OnigCaseFoldType flag,
OnigEncoding enc ARG_UNUSED)
{
return onigenc_apply_all_case_fold_with_map(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
+ numberof(CaseFoldMap), 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(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
+ numberof(CaseFoldMap), CaseFoldMap, 1,
flag, p, end, items);
}
diff --git a/enc/iso_8859_5.c b/enc/iso_8859_5.c
index 4ee27b10d8..e71a488c4c 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(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
+ numberof(CaseFoldMap), 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(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
+ numberof(CaseFoldMap), CaseFoldMap, 0,
flag, p, end, items);
}
diff --git a/enc/iso_8859_7.c b/enc/iso_8859_7.c
index aa82f880f9..8d07cb6310 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(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
+ numberof(CaseFoldMap), 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(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
+ numberof(CaseFoldMap), CaseFoldMap, 0,
flag, p, end, items);
}
diff --git a/enc/iso_8859_9.c b/enc/iso_8859_9.c
index 0adafa3ed4..211ba3b2f3 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(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
+ numberof(CaseFoldMap), 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(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 1,
+ numberof(CaseFoldMap), CaseFoldMap, 1,
flag, p, end, items);
}
diff --git a/enc/jis/props.h b/enc/jis/props.h
new file mode 100644
index 0000000000..4ae2e1fd23
--- /dev/null
+++ b/enc/jis/props.h
@@ -0,0 +1,227 @@
+/* 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
new file mode 100644
index 0000000000..4ae2e1fd23
--- /dev/null
+++ b/enc/jis/props.h.blt
@@ -0,0 +1,227 @@
+/* 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
new file mode 100644
index 0000000000..f3235c0100
--- /dev/null
+++ b/enc/jis/props.kwd
@@ -0,0 +1,52 @@
+%{/* -*- 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
new file mode 100644
index 0000000000..f3235c0100
--- /dev/null
+++ b/enc/jis/props.src
@@ -0,0 +1,52 @@
+%{/* -*- 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 8ec48747f8..85fa72287e 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(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
+ numberof(CaseFoldMap), 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(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
+ numberof(CaseFoldMap), CaseFoldMap, 0,
flag, p, end, items);
}
diff --git a/enc/koi8_u.c b/enc/koi8_u.c
index 0e51b6eb80..0ae449ca21 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(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
+ numberof(CaseFoldMap), 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(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
+ numberof(CaseFoldMap), CaseFoldMap, 0,
flag, p, end, items);
}
diff --git a/enc/shift_jis.c b/enc/shift_jis.c
index 5f5a802874..cbd3f02051 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(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
+ numberof(CaseFoldMap), CaseFoldMap, 0,
flag, f, arg);
}
@@ -433,12 +433,6 @@ 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
@@ -493,41 +487,20 @@ static const OnigCodePoint CR_Cyrillic[] = {
0x8480, 0x8491,
}; /* CR_Cyrillic */
-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;
-}
+#include "enc/jis/props.h"
static int
property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
{
- hash_data_type ctype;
- UChar *s, *e;
-
- PROPERTY_LIST_INIT_CHECK;
+ UChar *s = p, *e = end;
+ const struct enc_property *prop =
+ onig_jis_property((const char* )s, (unsigned int )(e - s));
- 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) {
+ if (!prop) {
return onigenc_minimum_property_name_to_ctype(enc, s, e);
}
- return (int )ctype;
+ return (int )prop->ctype;
}
static int
@@ -543,8 +516,6 @@ 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;
@@ -565,8 +536,6 @@ 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/escape.trans b/enc/trans/escape.trans
index 550e4ac767..c76ffa0e06 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 773cd90122..4ce8521a8a 100644
--- a/enc/trans/euckr-tbl.rb
+++ b/enc/trans/euckr-tbl.rb
@@ -162,6 +162,8 @@ 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 94c866eb39..f42f8fd2d5 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/trans/japanese_euc.trans b/enc/trans/japanese_euc.trans
index 0f63272321..d96f69feda 100644
--- a/enc/trans/japanese_euc.trans
+++ b/enc/trans/japanese_euc.trans
@@ -18,7 +18,7 @@
citrus_decode_mapsrc("euc", 0x8080, "JISX0208VDC:NEC/UCS,CP932VDC:NEC_IBM/UCS,JISX0208:MS/UCS") +
citrus_decode_mapsrc("euc", 0x0080, "JISX0201-KANA/UCS")
- transcode_tblgen "EUC-JP-2004", "UTF-8",
+ transcode_tblgen "EUC-JIS-2004", "UTF-8",
[["{00-7f}", :nomap]] +
citrus_decode_mapsrc("euc", 0x8080, "JISX0208:1990/UCS,JISX0213-1/UCS@BMP,JISX0213-1/UCS@SIP") +
citrus_decode_mapsrc("euc", 0x0080, "JISX0201-KANA/UCS") +
@@ -42,7 +42,7 @@
citrus_decode_mapsrc("euc", 0x8080, "UCS/JISX0208:MS,UCS/JISX0208VDC:NEC,UCS/CP932VDC:NEC_IBM") +
citrus_decode_mapsrc("euc", 0x0080, "UCS/JISX0201-KANA")
- transcode_tblgen "UTF-8", "EUC-JP-2004",
+ transcode_tblgen "UTF-8", "EUC-JIS-2004",
[["{00-7f}", :nomap]] +
citrus_decode_mapsrc("euc", 0x8080, "UCS/JISX0208:1990,UCS@BMP/JISX0213-1,UCS@SIP/JISX0213-1") +
citrus_decode_mapsrc("euc", 0x0080, "UCS/JISX0201-KANA") +
diff --git a/enc/trans/utf8_mac-tbl.rb b/enc/trans/utf8_mac-tbl.rb
index f43478bd3e..80bd049114 100644
--- a/enc/trans/utf8_mac-tbl.rb
+++ b/enc/trans/utf8_mac-tbl.rb
@@ -1,856 +1,23099 @@
-# http://developer.apple.com/technotes/tn/tn1150table.html
MAC_DECOMPOSE_TBL = [
+ ["cdbe", "3b"],
["c380", "41cc80"],
["c381", "41cc81"],
["c382", "41cc82"],
+ ["e1baa6", "41cc82cc80"],
+ ["e1baa6", "c382cc80"],
+ ["e1baa4", "41cc82cc81"],
+ ["e1baa4", "c382cc81"],
+ ["e1baaa", "41cc82cc83"],
+ ["e1baaa", "c382cc83"],
+ ["e1baa8", "41cc82cc89"],
+ ["e1baa8", "c382cc89"],
["c383", "41cc83"],
- ["c384", "41cc88"],
- ["c385", "41cc8a"],
- ["c387", "43cca7"],
- ["c388", "45cc80"],
- ["c389", "45cc81"],
- ["c38a", "45cc82"],
- ["c38b", "45cc88"],
- ["c38c", "49cc80"],
- ["c38d", "49cc81"],
- ["c38e", "49cc82"],
- ["c38f", "49cc88"],
- ["c391", "4ecc83"],
- ["c392", "4fcc80"],
- ["c393", "4fcc81"],
- ["c394", "4fcc82"],
- ["c395", "4fcc83"],
- ["c396", "4fcc88"],
- ["c399", "55cc80"],
- ["c39a", "55cc81"],
- ["c39b", "55cc82"],
- ["c39c", "55cc88"],
- ["c39d", "59cc81"],
- ["c3a0", "61cc80"],
- ["c3a1", "61cc81"],
- ["c3a2", "61cc82"],
- ["c3a3", "61cc83"],
- ["c3a4", "61cc88"],
- ["c3a5", "61cc8a"],
- ["c3a7", "63cca7"],
- ["c3a8", "65cc80"],
- ["c3a9", "65cc81"],
- ["c3aa", "65cc82"],
- ["c3ab", "65cc88"],
- ["c3ac", "69cc80"],
- ["c3ad", "69cc81"],
- ["c3ae", "69cc82"],
- ["c3af", "69cc88"],
- ["c3b1", "6ecc83"],
- ["c3b2", "6fcc80"],
- ["c3b3", "6fcc81"],
- ["c3b4", "6fcc82"],
- ["c3b5", "6fcc83"],
- ["c3b6", "6fcc88"],
- ["c3b9", "75cc80"],
- ["c3ba", "75cc81"],
- ["c3bb", "75cc82"],
- ["c3bc", "75cc88"],
- ["c3bd", "79cc81"],
- ["c3bf", "79cc88"],
["c480", "41cc84"],
- ["c481", "61cc84"],
["c482", "41cc86"],
- ["c483", "61cc86"],
+ ["e1bab0", "41cc86cc80"],
+ ["e1bab0", "c482cc80"],
+ ["e1baae", "41cc86cc81"],
+ ["e1baae", "c482cc81"],
+ ["e1bab4", "41cc86cc83"],
+ ["e1bab4", "c482cc83"],
+ ["e1bab2", "41cc86cc89"],
+ ["e1bab2", "c482cc89"],
+ ["c8a6", "41cc87"],
+ ["c7a0", "41cc87cc84"],
+ ["c7a0", "c8a6cc84"],
+ ["c384", "41cc88"],
+ ["c79e", "41cc88cc84"],
+ ["c79e", "c384cc84"],
+ ["e1baa2", "41cc89"],
+ ["c385", "41cc8a"],
+ ["c7ba", "41cc8acc81"],
+ ["c7ba", "c385cc81"],
+ ["c78d", "41cc8c"],
+ ["c880", "41cc8f"],
+ ["c882", "41cc91"],
+ ["e1baa0", "41cca3"],
+ ["e1baac", "41cca3cc82"],
+ ["e1baac", "e1baa0cc82"],
+ ["e1bab6", "41cca3cc86"],
+ ["e1bab6", "e1baa0cc86"],
+ ["e1b880", "41cca5"],
["c484", "41cca8"],
- ["c485", "61cca8"],
+ ["e1b882", "42cc87"],
+ ["e1b884", "42cca3"],
+ ["e1b886", "42ccb1"],
["c486", "43cc81"],
- ["c487", "63cc81"],
["c488", "43cc82"],
- ["c489", "63cc82"],
["c48a", "43cc87"],
- ["c48b", "63cc87"],
["c48c", "43cc8c"],
- ["c48d", "63cc8c"],
+ ["c387", "43cca7"],
+ ["e1b888", "43cca7cc81"],
+ ["e1b888", "c387cc81"],
+ ["e1b88a", "44cc87"],
["c48e", "44cc8c"],
- ["c48f", "64cc8c"],
+ ["e1b88c", "44cca3"],
+ ["e1b890", "44cca7"],
+ ["e1b892", "44ccad"],
+ ["e1b88e", "44ccb1"],
+ ["c388", "45cc80"],
+ ["c389", "45cc81"],
+ ["c38a", "45cc82"],
+ ["e1bb80", "45cc82cc80"],
+ ["e1bb80", "c38acc80"],
+ ["e1babe", "45cc82cc81"],
+ ["e1babe", "c38acc81"],
+ ["e1bb84", "45cc82cc83"],
+ ["e1bb84", "c38acc83"],
+ ["e1bb82", "45cc82cc89"],
+ ["e1bb82", "c38acc89"],
+ ["e1babc", "45cc83"],
["c492", "45cc84"],
- ["c493", "65cc84"],
+ ["e1b894", "45cc84cc80"],
+ ["e1b894", "c492cc80"],
+ ["e1b896", "45cc84cc81"],
+ ["e1b896", "c492cc81"],
["c494", "45cc86"],
- ["c495", "65cc86"],
["c496", "45cc87"],
- ["c497", "65cc87"],
- ["c498", "45cca8"],
- ["c499", "65cca8"],
+ ["c38b", "45cc88"],
+ ["e1baba", "45cc89"],
["c49a", "45cc8c"],
- ["c49b", "65cc8c"],
+ ["c884", "45cc8f"],
+ ["c886", "45cc91"],
+ ["e1bab8", "45cca3"],
+ ["e1bb86", "45cca3cc82"],
+ ["e1bb86", "e1bab8cc82"],
+ ["c8a8", "45cca7"],
+ ["e1b89c", "45cca7cc86"],
+ ["e1b89c", "c8a8cc86"],
+ ["c498", "45cca8"],
+ ["e1b898", "45ccad"],
+ ["e1b89a", "45ccb0"],
+ ["e1b89e", "46cc87"],
+ ["c7b4", "47cc81"],
["c49c", "47cc82"],
- ["c49d", "67cc82"],
+ ["e1b8a0", "47cc84"],
["c49e", "47cc86"],
- ["c49f", "67cc86"],
["c4a0", "47cc87"],
- ["c4a1", "67cc87"],
+ ["c7a6", "47cc8c"],
["c4a2", "47cca7"],
- ["c4a3", "67cca7"],
["c4a4", "48cc82"],
- ["c4a5", "68cc82"],
+ ["e1b8a2", "48cc87"],
+ ["e1b8a6", "48cc88"],
+ ["c89e", "48cc8c"],
+ ["e1b8a4", "48cca3"],
+ ["e1b8a8", "48cca7"],
+ ["e1b8aa", "48ccae"],
+ ["c38c", "49cc80"],
+ ["c38d", "49cc81"],
+ ["c38e", "49cc82"],
["c4a8", "49cc83"],
- ["c4a9", "69cc83"],
["c4aa", "49cc84"],
- ["c4ab", "69cc84"],
["c4ac", "49cc86"],
- ["c4ad", "69cc86"],
- ["c4ae", "49cca8"],
- ["c4af", "69cca8"],
["c4b0", "49cc87"],
+ ["c38f", "49cc88"],
+ ["e1b8ae", "49cc88cc81"],
+ ["e1b8ae", "c38fcc81"],
+ ["e1bb88", "49cc89"],
+ ["c78f", "49cc8c"],
+ ["c888", "49cc8f"],
+ ["c88a", "49cc91"],
+ ["e1bb8a", "49cca3"],
+ ["c4ae", "49cca8"],
+ ["e1b8ac", "49ccb0"],
["c4b4", "4acc82"],
- ["c4b5", "6acc82"],
+ ["e1b8b0", "4bcc81"],
+ ["c7a8", "4bcc8c"],
+ ["e1b8b2", "4bcca3"],
["c4b6", "4bcca7"],
- ["c4b7", "6bcca7"],
+ ["e1b8b4", "4bccb1"],
["c4b9", "4ccc81"],
- ["c4ba", "6ccc81"],
- ["c4bb", "4ccca7"],
- ["c4bc", "6ccca7"],
["c4bd", "4ccc8c"],
- ["c4be", "6ccc8c"],
+ ["e1b8b6", "4ccca3"],
+ ["e1b8b8", "4ccca3cc84"],
+ ["e1b8b8", "e1b8b6cc84"],
+ ["c4bb", "4ccca7"],
+ ["e1b8bc", "4cccad"],
+ ["e1b8ba", "4cccb1"],
+ ["e1b8be", "4dcc81"],
+ ["e1b980", "4dcc87"],
+ ["e1b982", "4dcca3"],
+ ["c7b8", "4ecc80"],
["c583", "4ecc81"],
- ["c584", "6ecc81"],
- ["c585", "4ecca7"],
- ["c586", "6ecca7"],
+ ["c391", "4ecc83"],
+ ["e1b984", "4ecc87"],
["c587", "4ecc8c"],
- ["c588", "6ecc8c"],
+ ["e1b986", "4ecca3"],
+ ["c585", "4ecca7"],
+ ["e1b98a", "4eccad"],
+ ["e1b988", "4eccb1"],
+ ["c392", "4fcc80"],
+ ["c393", "4fcc81"],
+ ["c394", "4fcc82"],
+ ["e1bb92", "4fcc82cc80"],
+ ["e1bb92", "c394cc80"],
+ ["e1bb90", "4fcc82cc81"],
+ ["e1bb90", "c394cc81"],
+ ["e1bb96", "4fcc82cc83"],
+ ["e1bb96", "c394cc83"],
+ ["e1bb94", "4fcc82cc89"],
+ ["e1bb94", "c394cc89"],
+ ["c395", "4fcc83"],
+ ["e1b98c", "4fcc83cc81"],
+ ["e1b98c", "c395cc81"],
+ ["c8ac", "4fcc83cc84"],
+ ["c8ac", "c395cc84"],
+ ["e1b98e", "4fcc83cc88"],
+ ["e1b98e", "c395cc88"],
["c58c", "4fcc84"],
- ["c58d", "6fcc84"],
+ ["e1b990", "4fcc84cc80"],
+ ["e1b990", "c58ccc80"],
+ ["e1b992", "4fcc84cc81"],
+ ["e1b992", "c58ccc81"],
["c58e", "4fcc86"],
- ["c58f", "6fcc86"],
+ ["c8ae", "4fcc87"],
+ ["c8b0", "4fcc87cc84"],
+ ["c8b0", "c8aecc84"],
+ ["c396", "4fcc88"],
+ ["c8aa", "4fcc88cc84"],
+ ["c8aa", "c396cc84"],
+ ["e1bb8e", "4fcc89"],
["c590", "4fcc8b"],
- ["c591", "6fcc8b"],
+ ["c791", "4fcc8c"],
+ ["c88c", "4fcc8f"],
+ ["c88e", "4fcc91"],
+ ["c6a0", "4fcc9b"],
+ ["e1bb9c", "4fcc9bcc80"],
+ ["e1bb9c", "c6a0cc80"],
+ ["e1bb9a", "4fcc9bcc81"],
+ ["e1bb9a", "c6a0cc81"],
+ ["e1bba0", "4fcc9bcc83"],
+ ["e1bba0", "c6a0cc83"],
+ ["e1bb9e", "4fcc9bcc89"],
+ ["e1bb9e", "c6a0cc89"],
+ ["e1bba2", "4fcc9bcca3"],
+ ["e1bba2", "c6a0cca3"],
+ ["e1bb8c", "4fcca3"],
+ ["e1bb98", "4fcca3cc82"],
+ ["e1bb98", "e1bb8ccc82"],
+ ["c7aa", "4fcca8"],
+ ["c7ac", "4fcca8cc84"],
+ ["c7ac", "c7aacc84"],
+ ["e1b994", "50cc81"],
+ ["e1b996", "50cc87"],
["c594", "52cc81"],
- ["c595", "72cc81"],
- ["c596", "52cca7"],
- ["c597", "72cca7"],
+ ["e1b998", "52cc87"],
["c598", "52cc8c"],
- ["c599", "72cc8c"],
+ ["c890", "52cc8f"],
+ ["c892", "52cc91"],
+ ["e1b99a", "52cca3"],
+ ["e1b99c", "52cca3cc84"],
+ ["e1b99c", "e1b99acc84"],
+ ["c596", "52cca7"],
+ ["e1b99e", "52ccb1"],
["c59a", "53cc81"],
- ["c59b", "73cc81"],
+ ["e1b9a4", "53cc81cc87"],
+ ["e1b9a4", "c59acc87"],
["c59c", "53cc82"],
- ["c59d", "73cc82"],
- ["c59e", "53cca7"],
- ["c59f", "73cca7"],
+ ["e1b9a0", "53cc87"],
["c5a0", "53cc8c"],
- ["c5a1", "73cc8c"],
- ["c5a2", "54cca7"],
- ["c5a3", "74cca7"],
+ ["e1b9a6", "53cc8ccc87"],
+ ["e1b9a6", "c5a0cc87"],
+ ["e1b9a2", "53cca3"],
+ ["e1b9a8", "53cca3cc87"],
+ ["e1b9a8", "e1b9a2cc87"],
+ ["c898", "53cca6"],
+ ["c59e", "53cca7"],
+ ["e1b9aa", "54cc87"],
["c5a4", "54cc8c"],
- ["c5a5", "74cc8c"],
+ ["e1b9ac", "54cca3"],
+ ["c89a", "54cca6"],
+ ["c5a2", "54cca7"],
+ ["e1b9b0", "54ccad"],
+ ["e1b9ae", "54ccb1"],
+ ["c399", "55cc80"],
+ ["c39a", "55cc81"],
+ ["c39b", "55cc82"],
["c5a8", "55cc83"],
- ["c5a9", "75cc83"],
+ ["e1b9b8", "55cc83cc81"],
+ ["e1b9b8", "c5a8cc81"],
["c5aa", "55cc84"],
- ["c5ab", "75cc84"],
+ ["e1b9ba", "55cc84cc88"],
+ ["e1b9ba", "c5aacc88"],
["c5ac", "55cc86"],
- ["c5ad", "75cc86"],
+ ["c39c", "55cc88"],
+ ["c79b", "55cc88cc80"],
+ ["c79b", "c39ccc80"],
+ ["c797", "55cc88cc81"],
+ ["c797", "c39ccc81"],
+ ["c795", "55cc88cc84"],
+ ["c795", "c39ccc84"],
+ ["c799", "55cc88cc8c"],
+ ["c799", "c39ccc8c"],
+ ["e1bba6", "55cc89"],
["c5ae", "55cc8a"],
- ["c5af", "75cc8a"],
["c5b0", "55cc8b"],
- ["c5b1", "75cc8b"],
+ ["c793", "55cc8c"],
+ ["c894", "55cc8f"],
+ ["c896", "55cc91"],
+ ["c6af", "55cc9b"],
+ ["e1bbaa", "55cc9bcc80"],
+ ["e1bbaa", "c6afcc80"],
+ ["e1bba8", "55cc9bcc81"],
+ ["e1bba8", "c6afcc81"],
+ ["e1bbae", "55cc9bcc83"],
+ ["e1bbae", "c6afcc83"],
+ ["e1bbac", "55cc9bcc89"],
+ ["e1bbac", "c6afcc89"],
+ ["e1bbb0", "55cc9bcca3"],
+ ["e1bbb0", "c6afcca3"],
+ ["e1bba4", "55cca3"],
+ ["e1b9b2", "55cca4"],
["c5b2", "55cca8"],
- ["c5b3", "75cca8"],
+ ["e1b9b6", "55ccad"],
+ ["e1b9b4", "55ccb0"],
+ ["e1b9bc", "56cc83"],
+ ["e1b9be", "56cca3"],
+ ["e1ba80", "57cc80"],
+ ["e1ba82", "57cc81"],
["c5b4", "57cc82"],
- ["c5b5", "77cc82"],
+ ["e1ba86", "57cc87"],
+ ["e1ba84", "57cc88"],
+ ["e1ba88", "57cca3"],
+ ["e1ba8a", "58cc87"],
+ ["e1ba8c", "58cc88"],
+ ["e1bbb2", "59cc80"],
+ ["c39d", "59cc81"],
["c5b6", "59cc82"],
- ["c5b7", "79cc82"],
+ ["e1bbb8", "59cc83"],
+ ["c8b2", "59cc84"],
+ ["e1ba8e", "59cc87"],
["c5b8", "59cc88"],
+ ["e1bbb6", "59cc89"],
+ ["e1bbb4", "59cca3"],
["c5b9", "5acc81"],
- ["c5ba", "7acc81"],
+ ["e1ba90", "5acc82"],
["c5bb", "5acc87"],
- ["c5bc", "7acc87"],
["c5bd", "5acc8c"],
- ["c5be", "7acc8c"],
- ["c6a0", "4fcc9b"],
- ["c6a1", "6fcc9b"],
- ["c6af", "55cc9b"],
- ["c6b0", "75cc9b"],
- ["c78d", "41cc8c"],
- ["c78e", "61cc8c"],
- ["c78f", "49cc8c"],
- ["c790", "69cc8c"],
- ["c791", "4fcc8c"],
- ["c792", "6fcc8c"],
- ["c793", "55cc8c"],
- ["c794", "75cc8c"],
- ["c795", "55cc88cc84"],
- ["c796", "75cc88cc84"],
- ["c797", "55cc88cc81"],
- ["c798", "75cc88cc81"],
- ["c799", "55cc88cc8c"],
- ["c79a", "75cc88cc8c"],
- ["c79b", "55cc88cc80"],
- ["c79c", "75cc88cc80"],
- ["c79e", "41cc88cc84"],
- ["c79f", "61cc88cc84"],
- ["c7a0", "41cc87cc84"],
+ ["e1ba92", "5acca3"],
+ ["e1ba94", "5accb1"],
+ ["e1bfaf", "60"],
+ ["c3a0", "61cc80"],
+ ["c3a1", "61cc81"],
+ ["c3a2", "61cc82"],
+ ["e1baa7", "61cc82cc80"],
+ ["e1baa7", "c3a2cc80"],
+ ["e1baa5", "61cc82cc81"],
+ ["e1baa5", "c3a2cc81"],
+ ["e1baab", "61cc82cc83"],
+ ["e1baab", "c3a2cc83"],
+ ["e1baa9", "61cc82cc89"],
+ ["e1baa9", "c3a2cc89"],
+ ["c3a3", "61cc83"],
+ ["c481", "61cc84"],
+ ["c483", "61cc86"],
+ ["e1bab1", "61cc86cc80"],
+ ["e1bab1", "c483cc80"],
+ ["e1baaf", "61cc86cc81"],
+ ["e1baaf", "c483cc81"],
+ ["e1bab5", "61cc86cc83"],
+ ["e1bab5", "c483cc83"],
+ ["e1bab3", "61cc86cc89"],
+ ["e1bab3", "c483cc89"],
+ ["c8a7", "61cc87"],
["c7a1", "61cc87cc84"],
- ["c7a2", "c386cc84"],
- ["c7a3", "c3a6cc84"],
- ["c7a6", "47cc8c"],
- ["c7a7", "67cc8c"],
- ["c7a8", "4bcc8c"],
- ["c7a9", "6bcc8c"],
- ["c7aa", "4fcca8"],
- ["c7ab", "6fcca8"],
- ["c7ac", "4fcca8cc84"],
- ["c7ad", "6fcca8cc84"],
- ["c7ae", "c6b7cc8c"],
- ["c7af", "ca92cc8c"],
- ["c7b0", "6acc8c"],
- ["c7b4", "47cc81"],
- ["c7b5", "67cc81"],
- ["c7ba", "41cc8acc81"],
+ ["c7a1", "c8a7cc84"],
+ ["c3a4", "61cc88"],
+ ["c79f", "61cc88cc84"],
+ ["c79f", "c3a4cc84"],
+ ["e1baa3", "61cc89"],
+ ["c3a5", "61cc8a"],
["c7bb", "61cc8acc81"],
- ["c7bc", "c386cc81"],
- ["c7bd", "c3a6cc81"],
- ["c7be", "c398cc81"],
- ["c7bf", "c3b8cc81"],
- ["c880", "41cc8f"],
+ ["c7bb", "c3a5cc81"],
+ ["c78e", "61cc8c"],
["c881", "61cc8f"],
- ["c882", "41cc91"],
["c883", "61cc91"],
- ["c884", "45cc8f"],
- ["c885", "65cc8f"],
- ["c886", "45cc91"],
- ["c887", "65cc91"],
- ["c888", "49cc8f"],
- ["c889", "69cc8f"],
- ["c88a", "49cc91"],
- ["c88b", "69cc91"],
- ["c88c", "4fcc8f"],
- ["c88d", "6fcc8f"],
- ["c88e", "4fcc91"],
- ["c88f", "6fcc91"],
- ["c890", "52cc8f"],
- ["c891", "72cc8f"],
- ["c892", "52cc91"],
- ["c893", "72cc91"],
- ["c894", "55cc8f"],
- ["c895", "75cc8f"],
- ["c896", "55cc91"],
- ["c897", "75cc91"],
- ["cc90", "cc86cc87"],
- ["cd80", "cc80"],
- ["cd81", "cc81"],
- ["cd83", "cc93"],
- ["cd84", "cc88cc8d"],
- ["cdb4", "cab9"],
- ["cdbe", "3b"],
- ["ce85", "c2a8cc8d"],
- ["ce86", "ce91cc8d"],
- ["ce87", "c2b7"],
- ["ce88", "ce95cc8d"],
- ["ce89", "ce97cc8d"],
- ["ce8a", "ce99cc8d"],
- ["ce8c", "ce9fcc8d"],
- ["ce8e", "cea5cc8d"],
- ["ce8f", "cea9cc8d"],
- ["ce90", "ceb9cc88cc8d"],
- ["ceaa", "ce99cc88"],
- ["ceab", "cea5cc88"],
- ["ceac", "ceb1cc8d"],
- ["cead", "ceb5cc8d"],
- ["ceae", "ceb7cc8d"],
- ["ceaf", "ceb9cc8d"],
- ["ceb0", "cf85cc88cc8d"],
- ["cf8a", "ceb9cc88"],
- ["cf8b", "cf85cc88"],
- ["cf8c", "cebfcc8d"],
- ["cf8d", "cf85cc8d"],
- ["cf8e", "cf89cc8d"],
- ["cf93", "cf92cc8d"],
- ["cf94", "cf92cc88"],
- ["d081", "d095cc88"],
- ["d083", "d093cc81"],
- ["d087", "d086cc88"],
- ["d08c", "d09acc81"],
- ["d08e", "d0a3cc86"],
- ["d099", "d098cc86"],
- ["d0b9", "d0b8cc86"],
- ["d191", "d0b5cc88"],
- ["d193", "d0b3cc81"],
- ["d197", "d196cc88"],
- ["d19c", "d0bacc81"],
- ["d19e", "d183cc86"],
- ["d1b6", "d1b4cc8f"],
- ["d1b7", "d1b5cc8f"],
- ["d381", "d096cc86"],
- ["d382", "d0b6cc86"],
- ["d390", "d090cc86"],
- ["d391", "d0b0cc86"],
- ["d392", "d090cc88"],
- ["d393", "d0b0cc88"],
- ["d394", "c386"],
- ["d395", "c3a6"],
- ["d396", "d095cc86"],
- ["d397", "d0b5cc86"],
- ["d398", "c68f"],
- ["d399", "c999"],
- ["d39a", "c68fcc88"],
- ["d39b", "c999cc88"],
- ["d39c", "d096cc88"],
- ["d39d", "d0b6cc88"],
- ["d39e", "d097cc88"],
- ["d39f", "d0b7cc88"],
- ["d3a0", "c6b7"],
- ["d3a1", "ca92"],
- ["d3a2", "d098cc84"],
- ["d3a3", "d0b8cc84"],
- ["d3a4", "d098cc88"],
- ["d3a5", "d0b8cc88"],
- ["d3a6", "d09ecc88"],
- ["d3a7", "d0becc88"],
- ["d3a8", "c69f"],
- ["d3a9", "c9b5"],
- ["d3aa", "c69fcc88"],
- ["d3ab", "c9b5cc88"],
- ["d3ae", "d0a3cc84"],
- ["d3af", "d183cc84"],
- ["d3b0", "d0a3cc88"],
- ["d3b1", "d183cc88"],
- ["d3b2", "d0a3cc8b"],
- ["d3b3", "d183cc8b"],
- ["d3b4", "d0a7cc88"],
- ["d3b5", "d187cc88"],
- ["d3b8", "d0abcc88"],
- ["d3b9", "d18bcc88"],
- ["e0a4a9", "e0a4a8e0a4bc"],
- ["e0a4b1", "e0a4b0e0a4bc"],
- ["e0a4b4", "e0a4b3e0a4bc"],
- ["e0a598", "e0a495e0a4bc"],
- ["e0a599", "e0a496e0a4bc"],
- ["e0a59a", "e0a497e0a4bc"],
- ["e0a59b", "e0a49ce0a4bc"],
- ["e0a59c", "e0a4a1e0a4bc"],
- ["e0a59d", "e0a4a2e0a4bc"],
- ["e0a59e", "e0a4abe0a4bc"],
- ["e0a59f", "e0a4afe0a4bc"],
- ["e0a6b0", "e0a6ace0a6bc"],
- ["e0a78b", "e0a787e0a6be"],
- ["e0a78c", "e0a787e0a797"],
- ["e0a79c", "e0a6a1e0a6bc"],
- ["e0a79d", "e0a6a2e0a6bc"],
- ["e0a79f", "e0a6afe0a6bc"],
- ["e0a999", "e0a896e0a8bc"],
- ["e0a99a", "e0a897e0a8bc"],
- ["e0a99b", "e0a89ce0a8bc"],
- ["e0a99c", "e0a8a1e0a8bc"],
- ["e0a99e", "e0a8abe0a8bc"],
- ["e0ad88", "e0ad87e0ad96"],
- ["e0ad8b", "e0ad87e0acbe"],
- ["e0ad8c", "e0ad87e0ad97"],
- ["e0ad9c", "e0aca1e0acbc"],
- ["e0ad9d", "e0aca2e0acbc"],
- ["e0ad9f", "e0acafe0acbc"],
- ["e0ae94", "e0ae92e0af97"],
- ["e0af8a", "e0af86e0aebe"],
- ["e0af8b", "e0af87e0aebe"],
- ["e0af8c", "e0af86e0af97"],
- ["e0b188", "e0b186e0b196"],
- ["e0b380", "e0b2bfe0b395"],
- ["e0b387", "e0b386e0b395"],
- ["e0b388", "e0b386e0b396"],
- ["e0b38a", "e0b386e0b382"],
- ["e0b38b", "e0b386e0b382e0b395"],
- ["e0b58a", "e0b586e0b4be"],
- ["e0b58b", "e0b587e0b4be"],
- ["e0b58c", "e0b586e0b597"],
- ["e0b8b3", "e0b98de0b8b2"],
- ["e0bab3", "e0bb8de0bab2"],
- ["e0bd83", "e0bd82e0beb7"],
- ["e0bd8d", "e0bd8ce0beb7"],
- ["e0bd92", "e0bd91e0beb7"],
- ["e0bd97", "e0bd96e0beb7"],
- ["e0bd9c", "e0bd9be0beb7"],
- ["e0bda9", "e0bd80e0beb5"],
- ["e0bdb3", "e0bdb2e0bdb1"],
- ["e0bdb5", "e0bdb4e0bdb1"],
- ["e0bdb6", "e0beb2e0be80"],
- ["e0bdb7", "e0beb2e0be80e0bdb1"],
- ["e0bdb8", "e0beb3e0be80"],
- ["e0bdb9", "e0beb3e0be80e0bdb1"],
- ["e0be81", "e0be80e0bdb1"],
- ["e0be93", "e0be92e0beb7"],
- ["e0be9d", "e0be9ce0beb7"],
- ["e0bea2", "e0bea1e0beb7"],
- ["e0bea7", "e0bea6e0beb7"],
- ["e0beac", "e0beabe0beb7"],
- ["e0beb9", "e0be90e0beb5"],
- ["e1b880", "41cca5"],
+ ["e1baa1", "61cca3"],
+ ["e1baad", "61cca3cc82"],
+ ["e1baad", "e1baa1cc82"],
+ ["e1bab7", "61cca3cc86"],
+ ["e1bab7", "e1baa1cc86"],
["e1b881", "61cca5"],
- ["e1b882", "42cc87"],
+ ["c485", "61cca8"],
["e1b883", "62cc87"],
- ["e1b884", "42cca3"],
["e1b885", "62cca3"],
- ["e1b886", "42ccb1"],
["e1b887", "62ccb1"],
- ["e1b888", "43cca7cc81"],
+ ["c487", "63cc81"],
+ ["c489", "63cc82"],
+ ["c48b", "63cc87"],
+ ["c48d", "63cc8c"],
+ ["c3a7", "63cca7"],
["e1b889", "63cca7cc81"],
- ["e1b88a", "44cc87"],
+ ["e1b889", "c3a7cc81"],
["e1b88b", "64cc87"],
- ["e1b88c", "44cca3"],
+ ["c48f", "64cc8c"],
["e1b88d", "64cca3"],
- ["e1b88e", "44ccb1"],
- ["e1b88f", "64ccb1"],
- ["e1b890", "44cca7"],
["e1b891", "64cca7"],
- ["e1b892", "44ccad"],
["e1b893", "64ccad"],
- ["e1b894", "45cc84cc80"],
+ ["e1b88f", "64ccb1"],
+ ["c3a8", "65cc80"],
+ ["c3a9", "65cc81"],
+ ["c3aa", "65cc82"],
+ ["e1bb81", "65cc82cc80"],
+ ["e1bb81", "c3aacc80"],
+ ["e1babf", "65cc82cc81"],
+ ["e1babf", "c3aacc81"],
+ ["e1bb85", "65cc82cc83"],
+ ["e1bb85", "c3aacc83"],
+ ["e1bb83", "65cc82cc89"],
+ ["e1bb83", "c3aacc89"],
+ ["e1babd", "65cc83"],
+ ["c493", "65cc84"],
["e1b895", "65cc84cc80"],
- ["e1b896", "45cc84cc81"],
+ ["e1b895", "c493cc80"],
["e1b897", "65cc84cc81"],
- ["e1b898", "45ccad"],
+ ["e1b897", "c493cc81"],
+ ["c495", "65cc86"],
+ ["c497", "65cc87"],
+ ["c3ab", "65cc88"],
+ ["e1babb", "65cc89"],
+ ["c49b", "65cc8c"],
+ ["c885", "65cc8f"],
+ ["c887", "65cc91"],
+ ["e1bab9", "65cca3"],
+ ["e1bb87", "65cca3cc82"],
+ ["e1bb87", "e1bab9cc82"],
+ ["c8a9", "65cca7"],
+ ["e1b89d", "65cca7cc86"],
+ ["e1b89d", "c8a9cc86"],
+ ["c499", "65cca8"],
["e1b899", "65ccad"],
- ["e1b89a", "45ccb0"],
["e1b89b", "65ccb0"],
- ["e1b89c", "45cca7cc86"],
- ["e1b89d", "65cca7cc86"],
- ["e1b89e", "46cc87"],
["e1b89f", "66cc87"],
- ["e1b8a0", "47cc84"],
+ ["c7b5", "67cc81"],
+ ["c49d", "67cc82"],
["e1b8a1", "67cc84"],
- ["e1b8a2", "48cc87"],
+ ["c49f", "67cc86"],
+ ["c4a1", "67cc87"],
+ ["c7a7", "67cc8c"],
+ ["c4a3", "67cca7"],
+ ["c4a5", "68cc82"],
["e1b8a3", "68cc87"],
- ["e1b8a4", "48cca3"],
- ["e1b8a5", "68cca3"],
- ["e1b8a6", "48cc88"],
["e1b8a7", "68cc88"],
- ["e1b8a8", "48cca7"],
+ ["c89f", "68cc8c"],
+ ["e1b8a5", "68cca3"],
["e1b8a9", "68cca7"],
- ["e1b8aa", "48ccae"],
["e1b8ab", "68ccae"],
- ["e1b8ac", "49ccb0"],
- ["e1b8ad", "69ccb0"],
- ["e1b8ae", "49cc88cc81"],
+ ["e1ba96", "68ccb1"],
+ ["c3ac", "69cc80"],
+ ["c3ad", "69cc81"],
+ ["c3ae", "69cc82"],
+ ["c4a9", "69cc83"],
+ ["c4ab", "69cc84"],
+ ["c4ad", "69cc86"],
+ ["c3af", "69cc88"],
["e1b8af", "69cc88cc81"],
- ["e1b8b0", "4bcc81"],
+ ["e1b8af", "c3afcc81"],
+ ["e1bb89", "69cc89"],
+ ["c790", "69cc8c"],
+ ["c889", "69cc8f"],
+ ["c88b", "69cc91"],
+ ["e1bb8b", "69cca3"],
+ ["c4af", "69cca8"],
+ ["e1b8ad", "69ccb0"],
+ ["c4b5", "6acc82"],
+ ["c7b0", "6acc8c"],
["e1b8b1", "6bcc81"],
- ["e1b8b2", "4bcca3"],
+ ["c7a9", "6bcc8c"],
["e1b8b3", "6bcca3"],
- ["e1b8b4", "4bccb1"],
+ ["c4b7", "6bcca7"],
["e1b8b5", "6bccb1"],
- ["e1b8b6", "4ccca3"],
+ ["c4ba", "6ccc81"],
+ ["c4be", "6ccc8c"],
["e1b8b7", "6ccca3"],
- ["e1b8b8", "4ccca3cc84"],
["e1b8b9", "6ccca3cc84"],
- ["e1b8ba", "4cccb1"],
- ["e1b8bb", "6cccb1"],
- ["e1b8bc", "4cccad"],
+ ["e1b8b9", "e1b8b7cc84"],
+ ["c4bc", "6ccca7"],
["e1b8bd", "6cccad"],
- ["e1b8be", "4dcc81"],
+ ["e1b8bb", "6cccb1"],
["e1b8bf", "6dcc81"],
- ["e1b980", "4dcc87"],
["e1b981", "6dcc87"],
- ["e1b982", "4dcca3"],
["e1b983", "6dcca3"],
- ["e1b984", "4ecc87"],
+ ["c7b9", "6ecc80"],
+ ["c584", "6ecc81"],
+ ["c3b1", "6ecc83"],
["e1b985", "6ecc87"],
- ["e1b986", "4ecca3"],
+ ["c588", "6ecc8c"],
["e1b987", "6ecca3"],
- ["e1b988", "4eccb1"],
- ["e1b989", "6eccb1"],
- ["e1b98a", "4eccad"],
+ ["c586", "6ecca7"],
["e1b98b", "6eccad"],
- ["e1b98c", "4fcc83cc81"],
+ ["e1b989", "6eccb1"],
+ ["c3b2", "6fcc80"],
+ ["c3b3", "6fcc81"],
+ ["c3b4", "6fcc82"],
+ ["e1bb93", "6fcc82cc80"],
+ ["e1bb93", "c3b4cc80"],
+ ["e1bb91", "6fcc82cc81"],
+ ["e1bb91", "c3b4cc81"],
+ ["e1bb97", "6fcc82cc83"],
+ ["e1bb97", "c3b4cc83"],
+ ["e1bb95", "6fcc82cc89"],
+ ["e1bb95", "c3b4cc89"],
+ ["c3b5", "6fcc83"],
["e1b98d", "6fcc83cc81"],
- ["e1b98e", "4fcc83cc88"],
+ ["e1b98d", "c3b5cc81"],
+ ["c8ad", "6fcc83cc84"],
+ ["c8ad", "c3b5cc84"],
["e1b98f", "6fcc83cc88"],
- ["e1b990", "4fcc84cc80"],
+ ["e1b98f", "c3b5cc88"],
+ ["c58d", "6fcc84"],
["e1b991", "6fcc84cc80"],
- ["e1b992", "4fcc84cc81"],
+ ["e1b991", "c58dcc80"],
["e1b993", "6fcc84cc81"],
- ["e1b994", "50cc81"],
+ ["e1b993", "c58dcc81"],
+ ["c58f", "6fcc86"],
+ ["c8af", "6fcc87"],
+ ["c8b1", "6fcc87cc84"],
+ ["c8b1", "c8afcc84"],
+ ["c3b6", "6fcc88"],
+ ["c8ab", "6fcc88cc84"],
+ ["c8ab", "c3b6cc84"],
+ ["e1bb8f", "6fcc89"],
+ ["c591", "6fcc8b"],
+ ["c792", "6fcc8c"],
+ ["c88d", "6fcc8f"],
+ ["c88f", "6fcc91"],
+ ["c6a1", "6fcc9b"],
+ ["e1bb9d", "6fcc9bcc80"],
+ ["e1bb9d", "c6a1cc80"],
+ ["e1bb9b", "6fcc9bcc81"],
+ ["e1bb9b", "c6a1cc81"],
+ ["e1bba1", "6fcc9bcc83"],
+ ["e1bba1", "c6a1cc83"],
+ ["e1bb9f", "6fcc9bcc89"],
+ ["e1bb9f", "c6a1cc89"],
+ ["e1bba3", "6fcc9bcca3"],
+ ["e1bba3", "c6a1cca3"],
+ ["e1bb8d", "6fcca3"],
+ ["e1bb99", "6fcca3cc82"],
+ ["e1bb99", "e1bb8dcc82"],
+ ["c7ab", "6fcca8"],
+ ["c7ad", "6fcca8cc84"],
+ ["c7ad", "c7abcc84"],
["e1b995", "70cc81"],
- ["e1b996", "50cc87"],
["e1b997", "70cc87"],
- ["e1b998", "52cc87"],
+ ["c595", "72cc81"],
["e1b999", "72cc87"],
- ["e1b99a", "52cca3"],
+ ["c599", "72cc8c"],
+ ["c891", "72cc8f"],
+ ["c893", "72cc91"],
["e1b99b", "72cca3"],
- ["e1b99c", "52cca3cc84"],
["e1b99d", "72cca3cc84"],
- ["e1b99e", "52ccb1"],
+ ["e1b99d", "e1b99bcc84"],
+ ["c597", "72cca7"],
["e1b99f", "72ccb1"],
- ["e1b9a0", "53cc87"],
- ["e1b9a1", "73cc87"],
- ["e1b9a2", "53cca3"],
- ["e1b9a3", "73cca3"],
- ["e1b9a4", "53cc81cc87"],
+ ["c59b", "73cc81"],
["e1b9a5", "73cc81cc87"],
- ["e1b9a6", "53cc8ccc87"],
+ ["e1b9a5", "c59bcc87"],
+ ["c59d", "73cc82"],
+ ["e1b9a1", "73cc87"],
+ ["c5a1", "73cc8c"],
["e1b9a7", "73cc8ccc87"],
- ["e1b9a8", "53cca3cc87"],
+ ["e1b9a7", "c5a1cc87"],
+ ["e1b9a3", "73cca3"],
["e1b9a9", "73cca3cc87"],
- ["e1b9aa", "54cc87"],
+ ["e1b9a9", "e1b9a3cc87"],
+ ["c899", "73cca6"],
+ ["c59f", "73cca7"],
["e1b9ab", "74cc87"],
- ["e1b9ac", "54cca3"],
+ ["e1ba97", "74cc88"],
+ ["c5a5", "74cc8c"],
["e1b9ad", "74cca3"],
- ["e1b9ae", "54ccb1"],
- ["e1b9af", "74ccb1"],
- ["e1b9b0", "54ccad"],
+ ["c89b", "74cca6"],
+ ["c5a3", "74cca7"],
["e1b9b1", "74ccad"],
- ["e1b9b2", "55cca4"],
- ["e1b9b3", "75cca4"],
- ["e1b9b4", "55ccb0"],
- ["e1b9b5", "75ccb0"],
- ["e1b9b6", "55ccad"],
- ["e1b9b7", "75ccad"],
- ["e1b9b8", "55cc83cc81"],
+ ["e1b9af", "74ccb1"],
+ ["c3b9", "75cc80"],
+ ["c3ba", "75cc81"],
+ ["c3bb", "75cc82"],
+ ["c5a9", "75cc83"],
["e1b9b9", "75cc83cc81"],
- ["e1b9ba", "55cc84cc88"],
+ ["e1b9b9", "c5a9cc81"],
+ ["c5ab", "75cc84"],
["e1b9bb", "75cc84cc88"],
- ["e1b9bc", "56cc83"],
+ ["e1b9bb", "c5abcc88"],
+ ["c5ad", "75cc86"],
+ ["c3bc", "75cc88"],
+ ["c79c", "75cc88cc80"],
+ ["c79c", "c3bccc80"],
+ ["c798", "75cc88cc81"],
+ ["c798", "c3bccc81"],
+ ["c796", "75cc88cc84"],
+ ["c796", "c3bccc84"],
+ ["c79a", "75cc88cc8c"],
+ ["c79a", "c3bccc8c"],
+ ["e1bba7", "75cc89"],
+ ["c5af", "75cc8a"],
+ ["c5b1", "75cc8b"],
+ ["c794", "75cc8c"],
+ ["c895", "75cc8f"],
+ ["c897", "75cc91"],
+ ["c6b0", "75cc9b"],
+ ["e1bbab", "75cc9bcc80"],
+ ["e1bbab", "c6b0cc80"],
+ ["e1bba9", "75cc9bcc81"],
+ ["e1bba9", "c6b0cc81"],
+ ["e1bbaf", "75cc9bcc83"],
+ ["e1bbaf", "c6b0cc83"],
+ ["e1bbad", "75cc9bcc89"],
+ ["e1bbad", "c6b0cc89"],
+ ["e1bbb1", "75cc9bcca3"],
+ ["e1bbb1", "c6b0cca3"],
+ ["e1bba5", "75cca3"],
+ ["e1b9b3", "75cca4"],
+ ["c5b3", "75cca8"],
+ ["e1b9b7", "75ccad"],
+ ["e1b9b5", "75ccb0"],
["e1b9bd", "76cc83"],
- ["e1b9be", "56cca3"],
["e1b9bf", "76cca3"],
- ["e1ba80", "57cc80"],
["e1ba81", "77cc80"],
- ["e1ba82", "57cc81"],
["e1ba83", "77cc81"],
- ["e1ba84", "57cc88"],
- ["e1ba85", "77cc88"],
- ["e1ba86", "57cc87"],
+ ["c5b5", "77cc82"],
["e1ba87", "77cc87"],
- ["e1ba88", "57cca3"],
+ ["e1ba85", "77cc88"],
+ ["e1ba98", "77cc8a"],
["e1ba89", "77cca3"],
- ["e1ba8a", "58cc87"],
["e1ba8b", "78cc87"],
- ["e1ba8c", "58cc88"],
["e1ba8d", "78cc88"],
- ["e1ba8e", "59cc87"],
+ ["e1bbb3", "79cc80"],
+ ["c3bd", "79cc81"],
+ ["c5b7", "79cc82"],
+ ["e1bbb9", "79cc83"],
+ ["c8b3", "79cc84"],
["e1ba8f", "79cc87"],
- ["e1ba90", "5acc82"],
+ ["c3bf", "79cc88"],
+ ["e1bbb7", "79cc89"],
+ ["e1ba99", "79cc8a"],
+ ["e1bbb5", "79cca3"],
+ ["c5ba", "7acc81"],
["e1ba91", "7acc82"],
- ["e1ba92", "5acca3"],
+ ["c5bc", "7acc87"],
+ ["c5be", "7acc8c"],
["e1ba93", "7acca3"],
- ["e1ba94", "5accb1"],
["e1ba95", "7accb1"],
- ["e1ba96", "68ccb1"],
- ["e1ba97", "74cc88"],
- ["e1ba98", "77cc8a"],
- ["e1ba99", "79cc8a"],
+ ["e1bfad", "c2a8cc80"],
+ ["ce85", "c2a8cc81"],
+ ["e1bf81", "c2a8cd82"],
+ ["e1bfbd", "c2b4"],
+ ["ce87", "c2b7"],
+ ["c7bc", "c386cc81"],
+ ["c7a2", "c386cc84"],
+ ["c7be", "c398cc81"],
+ ["c7bd", "c3a6cc81"],
+ ["c7a3", "c3a6cc84"],
+ ["c7bf", "c3b8cc81"],
["e1ba9b", "c5bfcc87"],
- ["e1baa0", "41cca3"],
- ["e1baa1", "61cca3"],
- ["e1baa2", "41cc89"],
- ["e1baa3", "61cc89"],
- ["e1baa4", "41cc82cc81"],
- ["e1baa5", "61cc82cc81"],
- ["e1baa6", "41cc82cc80"],
- ["e1baa7", "61cc82cc80"],
- ["e1baa8", "41cc82cc89"],
- ["e1baa9", "61cc82cc89"],
- ["e1baaa", "41cc82cc83"],
- ["e1baab", "61cc82cc83"],
- ["e1baac", "41cca3cc82"],
- ["e1baad", "61cca3cc82"],
- ["e1baae", "41cc86cc81"],
- ["e1baaf", "61cc86cc81"],
- ["e1bab0", "41cc86cc80"],
- ["e1bab1", "61cc86cc80"],
- ["e1bab2", "41cc86cc89"],
- ["e1bab3", "61cc86cc89"],
- ["e1bab4", "41cc86cc83"],
- ["e1bab5", "61cc86cc83"],
- ["e1bab6", "41cca3cc86"],
- ["e1bab7", "61cca3cc86"],
- ["e1bab8", "45cca3"],
- ["e1bab9", "65cca3"],
- ["e1baba", "45cc89"],
- ["e1babb", "65cc89"],
- ["e1babc", "45cc83"],
- ["e1babd", "65cc83"],
- ["e1babe", "45cc82cc81"],
- ["e1babf", "65cc82cc81"],
- ["e1bb80", "45cc82cc80"],
- ["e1bb81", "65cc82cc80"],
- ["e1bb82", "45cc82cc89"],
- ["e1bb83", "65cc82cc89"],
- ["e1bb84", "45cc82cc83"],
- ["e1bb85", "65cc82cc83"],
- ["e1bb86", "45cca3cc82"],
- ["e1bb87", "65cca3cc82"],
- ["e1bb88", "49cc89"],
- ["e1bb89", "69cc89"],
- ["e1bb8a", "49cca3"],
- ["e1bb8b", "69cca3"],
- ["e1bb8c", "4fcca3"],
- ["e1bb8d", "6fcca3"],
- ["e1bb8e", "4fcc89"],
- ["e1bb8f", "6fcc89"],
- ["e1bb90", "4fcc82cc81"],
- ["e1bb91", "6fcc82cc81"],
- ["e1bb92", "4fcc82cc80"],
- ["e1bb93", "6fcc82cc80"],
- ["e1bb94", "4fcc82cc89"],
- ["e1bb95", "6fcc82cc89"],
- ["e1bb96", "4fcc82cc83"],
- ["e1bb97", "6fcc82cc83"],
- ["e1bb98", "4fcca3cc82"],
- ["e1bb99", "6fcca3cc82"],
- ["e1bb9a", "4fcc9bcc81"],
- ["e1bb9b", "6fcc9bcc81"],
- ["e1bb9c", "4fcc9bcc80"],
- ["e1bb9d", "6fcc9bcc80"],
- ["e1bb9e", "4fcc9bcc89"],
- ["e1bb9f", "6fcc9bcc89"],
- ["e1bba0", "4fcc9bcc83"],
- ["e1bba1", "6fcc9bcc83"],
- ["e1bba2", "4fcc9bcca3"],
- ["e1bba3", "6fcc9bcca3"],
- ["e1bba4", "55cca3"],
- ["e1bba5", "75cca3"],
- ["e1bba6", "55cc89"],
- ["e1bba7", "75cc89"],
- ["e1bba8", "55cc9bcc81"],
- ["e1bba9", "75cc9bcc81"],
- ["e1bbaa", "55cc9bcc80"],
- ["e1bbab", "75cc9bcc80"],
- ["e1bbac", "55cc9bcc89"],
- ["e1bbad", "75cc9bcc89"],
- ["e1bbae", "55cc9bcc83"],
- ["e1bbaf", "75cc9bcc83"],
- ["e1bbb0", "55cc9bcca3"],
- ["e1bbb1", "75cc9bcca3"],
- ["e1bbb2", "59cc80"],
- ["e1bbb3", "79cc80"],
- ["e1bbb4", "59cca3"],
- ["e1bbb5", "79cca3"],
- ["e1bbb6", "59cc89"],
- ["e1bbb7", "79cc89"],
- ["e1bbb8", "59cc83"],
- ["e1bbb9", "79cc83"],
- ["e1bc80", "ceb1cc93"],
- ["e1bc81", "ceb1cc94"],
- ["e1bc82", "ceb1cc93cc80"],
- ["e1bc83", "ceb1cc94cc80"],
- ["e1bc84", "ceb1cc93cc81"],
- ["e1bc85", "ceb1cc94cc81"],
- ["e1bc86", "ceb1cc93cd82"],
- ["e1bc87", "ceb1cc94cd82"],
+ ["c7ae", "c6b7cc8c"],
+ ["c7af", "ca92cc8c"],
+ ["cdb4", "cab9"],
+ ["cd80", "cc80"],
+ ["cd81", "cc81"],
+ ["cd84", "cc88cc81"],
+ ["cd83", "cc93"],
+ ["e1beba", "ce91cc80"],
+ ["ce86", "ce91cc81"],
+ ["e1beb9", "ce91cc84"],
+ ["e1beb8", "ce91cc86"],
["e1bc88", "ce91cc93"],
- ["e1bc89", "ce91cc94"],
["e1bc8a", "ce91cc93cc80"],
- ["e1bc8b", "ce91cc94cc80"],
+ ["e1bc8a", "e1bc88cc80"],
+ ["e1be8a", "ce91cc93cc80cd85"],
+ ["e1be8a", "e1bc8acd85"],
["e1bc8c", "ce91cc93cc81"],
- ["e1bc8d", "ce91cc94cc81"],
+ ["e1bc8c", "e1bc88cc81"],
+ ["e1be8c", "ce91cc93cc81cd85"],
+ ["e1be8c", "e1bc8ccd85"],
["e1bc8e", "ce91cc93cd82"],
+ ["e1bc8e", "e1bc88cd82"],
+ ["e1be8e", "ce91cc93cd82cd85"],
+ ["e1be8e", "e1bc8ecd85"],
+ ["e1be88", "ce91cc93cd85"],
+ ["e1be88", "e1bc88cd85"],
+ ["e1bc89", "ce91cc94"],
+ ["e1bc8b", "ce91cc94cc80"],
+ ["e1bc8b", "e1bc89cc80"],
+ ["e1be8b", "ce91cc94cc80cd85"],
+ ["e1be8b", "e1bc8bcd85"],
+ ["e1bc8d", "ce91cc94cc81"],
+ ["e1bc8d", "e1bc89cc81"],
+ ["e1be8d", "ce91cc94cc81cd85"],
+ ["e1be8d", "e1bc8dcd85"],
["e1bc8f", "ce91cc94cd82"],
- ["e1bc90", "ceb5cc93"],
- ["e1bc91", "ceb5cc94"],
- ["e1bc92", "ceb5cc93cc80"],
- ["e1bc93", "ceb5cc94cc80"],
- ["e1bc94", "ceb5cc93cc81"],
- ["e1bc95", "ceb5cc94cc81"],
+ ["e1bc8f", "e1bc89cd82"],
+ ["e1be8f", "ce91cc94cd82cd85"],
+ ["e1be8f", "e1bc8fcd85"],
+ ["e1be89", "ce91cc94cd85"],
+ ["e1be89", "e1bc89cd85"],
+ ["e1bebc", "ce91cd85"],
+ ["e1bf88", "ce95cc80"],
+ ["ce88", "ce95cc81"],
["e1bc98", "ce95cc93"],
- ["e1bc99", "ce95cc94"],
["e1bc9a", "ce95cc93cc80"],
- ["e1bc9b", "ce95cc94cc80"],
+ ["e1bc9a", "e1bc98cc80"],
["e1bc9c", "ce95cc93cc81"],
+ ["e1bc9c", "e1bc98cc81"],
+ ["e1bc99", "ce95cc94"],
+ ["e1bc9b", "ce95cc94cc80"],
+ ["e1bc9b", "e1bc99cc80"],
["e1bc9d", "ce95cc94cc81"],
- ["e1bca0", "ceb7cc93"],
- ["e1bca1", "ceb7cc94"],
- ["e1bca2", "ceb7cc93cc80"],
- ["e1bca3", "ceb7cc94cc80"],
- ["e1bca4", "ceb7cc93cc81"],
- ["e1bca5", "ceb7cc94cc81"],
- ["e1bca6", "ceb7cc93cd82"],
- ["e1bca7", "ceb7cc94cd82"],
+ ["e1bc9d", "e1bc99cc81"],
+ ["e1bf8a", "ce97cc80"],
+ ["ce89", "ce97cc81"],
["e1bca8", "ce97cc93"],
- ["e1bca9", "ce97cc94"],
["e1bcaa", "ce97cc93cc80"],
- ["e1bcab", "ce97cc94cc80"],
+ ["e1bcaa", "e1bca8cc80"],
+ ["e1be9a", "ce97cc93cc80cd85"],
+ ["e1be9a", "e1bcaacd85"],
["e1bcac", "ce97cc93cc81"],
- ["e1bcad", "ce97cc94cc81"],
+ ["e1bcac", "e1bca8cc81"],
+ ["e1be9c", "ce97cc93cc81cd85"],
+ ["e1be9c", "e1bcaccd85"],
["e1bcae", "ce97cc93cd82"],
+ ["e1bcae", "e1bca8cd82"],
+ ["e1be9e", "ce97cc93cd82cd85"],
+ ["e1be9e", "e1bcaecd85"],
+ ["e1be98", "ce97cc93cd85"],
+ ["e1be98", "e1bca8cd85"],
+ ["e1bca9", "ce97cc94"],
+ ["e1bcab", "ce97cc94cc80"],
+ ["e1bcab", "e1bca9cc80"],
+ ["e1be9b", "ce97cc94cc80cd85"],
+ ["e1be9b", "e1bcabcd85"],
+ ["e1bcad", "ce97cc94cc81"],
+ ["e1bcad", "e1bca9cc81"],
+ ["e1be9d", "ce97cc94cc81cd85"],
+ ["e1be9d", "e1bcadcd85"],
["e1bcaf", "ce97cc94cd82"],
- ["e1bcb0", "ceb9cc93"],
- ["e1bcb1", "ceb9cc94"],
- ["e1bcb2", "ceb9cc93cc80"],
- ["e1bcb3", "ceb9cc94cc80"],
- ["e1bcb4", "ceb9cc93cc81"],
- ["e1bcb5", "ceb9cc94cc81"],
- ["e1bcb6", "ceb9cc93cd82"],
- ["e1bcb7", "ceb9cc94cd82"],
+ ["e1bcaf", "e1bca9cd82"],
+ ["e1be9f", "ce97cc94cd82cd85"],
+ ["e1be9f", "e1bcafcd85"],
+ ["e1be99", "ce97cc94cd85"],
+ ["e1be99", "e1bca9cd85"],
+ ["e1bf8c", "ce97cd85"],
+ ["e1bf9a", "ce99cc80"],
+ ["ce8a", "ce99cc81"],
+ ["e1bf99", "ce99cc84"],
+ ["e1bf98", "ce99cc86"],
+ ["ceaa", "ce99cc88"],
["e1bcb8", "ce99cc93"],
- ["e1bcb9", "ce99cc94"],
["e1bcba", "ce99cc93cc80"],
- ["e1bcbb", "ce99cc94cc80"],
+ ["e1bcba", "e1bcb8cc80"],
["e1bcbc", "ce99cc93cc81"],
- ["e1bcbd", "ce99cc94cc81"],
+ ["e1bcbc", "e1bcb8cc81"],
["e1bcbe", "ce99cc93cd82"],
+ ["e1bcbe", "e1bcb8cd82"],
+ ["e1bcb9", "ce99cc94"],
+ ["e1bcbb", "ce99cc94cc80"],
+ ["e1bcbb", "e1bcb9cc80"],
+ ["e1bcbd", "ce99cc94cc81"],
+ ["e1bcbd", "e1bcb9cc81"],
["e1bcbf", "ce99cc94cd82"],
- ["e1bd80", "cebfcc93"],
- ["e1bd81", "cebfcc94"],
- ["e1bd82", "cebfcc93cc80"],
- ["e1bd83", "cebfcc94cc80"],
- ["e1bd84", "cebfcc93cc81"],
- ["e1bd85", "cebfcc94cc81"],
+ ["e1bcbf", "e1bcb9cd82"],
+ ["e1bfb8", "ce9fcc80"],
+ ["ce8c", "ce9fcc81"],
["e1bd88", "ce9fcc93"],
- ["e1bd89", "ce9fcc94"],
["e1bd8a", "ce9fcc93cc80"],
- ["e1bd8b", "ce9fcc94cc80"],
+ ["e1bd8a", "e1bd88cc80"],
["e1bd8c", "ce9fcc93cc81"],
+ ["e1bd8c", "e1bd88cc81"],
+ ["e1bd89", "ce9fcc94"],
+ ["e1bd8b", "ce9fcc94cc80"],
+ ["e1bd8b", "e1bd89cc80"],
["e1bd8d", "ce9fcc94cc81"],
- ["e1bd90", "cf85cc93"],
- ["e1bd91", "cf85cc94"],
- ["e1bd92", "cf85cc93cc80"],
- ["e1bd93", "cf85cc94cc80"],
- ["e1bd94", "cf85cc93cc81"],
- ["e1bd95", "cf85cc94cc81"],
- ["e1bd96", "cf85cc93cd82"],
- ["e1bd97", "cf85cc94cd82"],
+ ["e1bd8d", "e1bd89cc81"],
+ ["e1bfac", "cea1cc94"],
+ ["e1bfaa", "cea5cc80"],
+ ["ce8e", "cea5cc81"],
+ ["e1bfa9", "cea5cc84"],
+ ["e1bfa8", "cea5cc86"],
+ ["ceab", "cea5cc88"],
["e1bd99", "cea5cc94"],
["e1bd9b", "cea5cc94cc80"],
+ ["e1bd9b", "e1bd99cc80"],
["e1bd9d", "cea5cc94cc81"],
+ ["e1bd9d", "e1bd99cc81"],
["e1bd9f", "cea5cc94cd82"],
- ["e1bda0", "cf89cc93"],
- ["e1bda1", "cf89cc94"],
- ["e1bda2", "cf89cc93cc80"],
- ["e1bda3", "cf89cc94cc80"],
- ["e1bda4", "cf89cc93cc81"],
- ["e1bda5", "cf89cc94cc81"],
- ["e1bda6", "cf89cc93cd82"],
- ["e1bda7", "cf89cc94cd82"],
+ ["e1bd9f", "e1bd99cd82"],
+ ["e1bfba", "cea9cc80"],
+ ["ce8f", "cea9cc81"],
["e1bda8", "cea9cc93"],
- ["e1bda9", "cea9cc94"],
["e1bdaa", "cea9cc93cc80"],
- ["e1bdab", "cea9cc94cc80"],
+ ["e1bdaa", "e1bda8cc80"],
+ ["e1beaa", "cea9cc93cc80cd85"],
+ ["e1beaa", "e1bdaacd85"],
["e1bdac", "cea9cc93cc81"],
- ["e1bdad", "cea9cc94cc81"],
+ ["e1bdac", "e1bda8cc81"],
+ ["e1beac", "cea9cc93cc81cd85"],
+ ["e1beac", "e1bdaccd85"],
["e1bdae", "cea9cc93cd82"],
+ ["e1bdae", "e1bda8cd82"],
+ ["e1beae", "cea9cc93cd82cd85"],
+ ["e1beae", "e1bdaecd85"],
+ ["e1bea8", "cea9cc93cd85"],
+ ["e1bea8", "e1bda8cd85"],
+ ["e1bda9", "cea9cc94"],
+ ["e1bdab", "cea9cc94cc80"],
+ ["e1bdab", "e1bda9cc80"],
+ ["e1beab", "cea9cc94cc80cd85"],
+ ["e1beab", "e1bdabcd85"],
+ ["e1bdad", "cea9cc94cc81"],
+ ["e1bdad", "e1bda9cc81"],
+ ["e1bead", "cea9cc94cc81cd85"],
+ ["e1bead", "e1bdadcd85"],
["e1bdaf", "cea9cc94cd82"],
+ ["e1bdaf", "e1bda9cd82"],
+ ["e1beaf", "cea9cc94cd82cd85"],
+ ["e1beaf", "e1bdafcd85"],
+ ["e1bea9", "cea9cc94cd85"],
+ ["e1bea9", "e1bda9cd85"],
+ ["e1bfbc", "cea9cd85"],
["e1bdb0", "ceb1cc80"],
- ["e1bdb1", "ceb1cc81"],
- ["e1bdb2", "ceb5cc80"],
- ["e1bdb3", "ceb5cc81"],
- ["e1bdb4", "ceb7cc80"],
- ["e1bdb5", "ceb7cc81"],
- ["e1bdb6", "ceb9cc80"],
- ["e1bdb7", "ceb9cc81"],
- ["e1bdb8", "cebfcc80"],
- ["e1bdb9", "cebfcc81"],
- ["e1bdba", "cf85cc80"],
- ["e1bdbb", "cf85cc81"],
- ["e1bdbc", "cf89cc80"],
- ["e1bdbd", "cf89cc81"],
- ["e1be80", "ceb1cd85cc93"],
- ["e1be81", "ceb1cd85cc94"],
- ["e1be82", "ceb1cd85cc93cc80"],
- ["e1be83", "ceb1cd85cc94cc80"],
- ["e1be84", "ceb1cd85cc93cc81"],
- ["e1be85", "ceb1cd85cc94cc81"],
- ["e1be86", "ceb1cd85cc93cd82"],
- ["e1be87", "ceb1cd85cc94cd82"],
- ["e1be88", "ce91cd85cc93"],
- ["e1be89", "ce91cd85cc94"],
- ["e1be8a", "ce91cd85cc93cc80"],
- ["e1be8b", "ce91cd85cc94cc80"],
- ["e1be8c", "ce91cd85cc93cc81"],
- ["e1be8d", "ce91cd85cc94cc81"],
- ["e1be8e", "ce91cd85cc93cd82"],
- ["e1be8f", "ce91cd85cc94cd82"],
- ["e1be90", "ceb7cd85cc93"],
- ["e1be91", "ceb7cd85cc94"],
- ["e1be92", "ceb7cd85cc93cc80"],
- ["e1be93", "ceb7cd85cc94cc80"],
- ["e1be94", "ceb7cd85cc93cc81"],
- ["e1be95", "ceb7cd85cc94cc81"],
- ["e1be96", "ceb7cd85cc93cd82"],
- ["e1be97", "ceb7cd85cc94cd82"],
- ["e1be98", "ce97cd85cc93"],
- ["e1be99", "ce97cd85cc94"],
- ["e1be9a", "ce97cd85cc93cc80"],
- ["e1be9b", "ce97cd85cc94cc80"],
- ["e1be9c", "ce97cd85cc93cc81"],
- ["e1be9d", "ce97cd85cc94cc81"],
- ["e1be9e", "ce97cd85cc93cd82"],
- ["e1be9f", "ce97cd85cc94cd82"],
- ["e1bea0", "cf89cd85cc93"],
- ["e1bea1", "cf89cd85cc94"],
- ["e1bea2", "cf89cd85cc93cc80"],
- ["e1bea3", "cf89cd85cc94cc80"],
- ["e1bea4", "cf89cd85cc93cc81"],
- ["e1bea5", "cf89cd85cc94cc81"],
- ["e1bea6", "cf89cd85cc93cd82"],
- ["e1bea7", "cf89cd85cc94cd82"],
- ["e1bea8", "cea9cd85cc93"],
- ["e1bea9", "cea9cd85cc94"],
- ["e1beaa", "cea9cd85cc93cc80"],
- ["e1beab", "cea9cd85cc94cc80"],
- ["e1beac", "cea9cd85cc93cc81"],
- ["e1bead", "cea9cd85cc94cc81"],
- ["e1beae", "cea9cd85cc93cd82"],
- ["e1beaf", "cea9cd85cc94cd82"],
- ["e1beb0", "ceb1cc86"],
+ ["e1beb2", "ceb1cc80cd85"],
+ ["e1beb2", "e1bdb0cd85"],
+ ["ceac", "ceb1cc81"],
+ ["e1beb4", "ceb1cc81cd85"],
+ ["e1beb4", "ceaccd85"],
["e1beb1", "ceb1cc84"],
- ["e1beb2", "ceb1cd85cc80"],
- ["e1beb3", "ceb1cd85"],
- ["e1beb4", "ceb1cd85cc81"],
+ ["e1beb0", "ceb1cc86"],
+ ["e1bc80", "ceb1cc93"],
+ ["e1bc82", "ceb1cc93cc80"],
+ ["e1bc82", "e1bc80cc80"],
+ ["e1be82", "ceb1cc93cc80cd85"],
+ ["e1be82", "e1bc82cd85"],
+ ["e1bc84", "ceb1cc93cc81"],
+ ["e1bc84", "e1bc80cc81"],
+ ["e1be84", "ceb1cc93cc81cd85"],
+ ["e1be84", "e1bc84cd85"],
+ ["e1bc86", "ceb1cc93cd82"],
+ ["e1bc86", "e1bc80cd82"],
+ ["e1be86", "ceb1cc93cd82cd85"],
+ ["e1be86", "e1bc86cd85"],
+ ["e1be80", "ceb1cc93cd85"],
+ ["e1be80", "e1bc80cd85"],
+ ["e1bc81", "ceb1cc94"],
+ ["e1bc83", "ceb1cc94cc80"],
+ ["e1bc83", "e1bc81cc80"],
+ ["e1be83", "ceb1cc94cc80cd85"],
+ ["e1be83", "e1bc83cd85"],
+ ["e1bc85", "ceb1cc94cc81"],
+ ["e1bc85", "e1bc81cc81"],
+ ["e1be85", "ceb1cc94cc81cd85"],
+ ["e1be85", "e1bc85cd85"],
+ ["e1bc87", "ceb1cc94cd82"],
+ ["e1bc87", "e1bc81cd82"],
+ ["e1be87", "ceb1cc94cd82cd85"],
+ ["e1be87", "e1bc87cd85"],
+ ["e1be81", "ceb1cc94cd85"],
+ ["e1be81", "e1bc81cd85"],
["e1beb6", "ceb1cd82"],
- ["e1beb7", "ceb1cd85cd82"],
- ["e1beb8", "ce91cc86"],
- ["e1beb9", "ce91cc84"],
- ["e1beba", "ce91cc80"],
- ["e1bebb", "ce91cc81"],
- ["e1bebc", "ce91cd85"],
- ["e1bebe", "ceb9"],
- ["e1bf81", "c2a8cd82"],
- ["e1bf82", "ceb7cd85cc80"],
- ["e1bf83", "ceb7cd85"],
- ["e1bf84", "ceb7cd85cc81"],
+ ["e1beb7", "ceb1cd82cd85"],
+ ["e1beb7", "e1beb6cd85"],
+ ["e1beb3", "ceb1cd85"],
+ ["e1bdb2", "ceb5cc80"],
+ ["cead", "ceb5cc81"],
+ ["e1bc90", "ceb5cc93"],
+ ["e1bc92", "ceb5cc93cc80"],
+ ["e1bc92", "e1bc90cc80"],
+ ["e1bc94", "ceb5cc93cc81"],
+ ["e1bc94", "e1bc90cc81"],
+ ["e1bc91", "ceb5cc94"],
+ ["e1bc93", "ceb5cc94cc80"],
+ ["e1bc93", "e1bc91cc80"],
+ ["e1bc95", "ceb5cc94cc81"],
+ ["e1bc95", "e1bc91cc81"],
+ ["e1bdb4", "ceb7cc80"],
+ ["e1bf82", "ceb7cc80cd85"],
+ ["e1bf82", "e1bdb4cd85"],
+ ["ceae", "ceb7cc81"],
+ ["e1bf84", "ceb7cc81cd85"],
+ ["e1bf84", "ceaecd85"],
+ ["e1bca0", "ceb7cc93"],
+ ["e1bca2", "ceb7cc93cc80"],
+ ["e1bca2", "e1bca0cc80"],
+ ["e1be92", "ceb7cc93cc80cd85"],
+ ["e1be92", "e1bca2cd85"],
+ ["e1bca4", "ceb7cc93cc81"],
+ ["e1bca4", "e1bca0cc81"],
+ ["e1be94", "ceb7cc93cc81cd85"],
+ ["e1be94", "e1bca4cd85"],
+ ["e1bca6", "ceb7cc93cd82"],
+ ["e1bca6", "e1bca0cd82"],
+ ["e1be96", "ceb7cc93cd82cd85"],
+ ["e1be96", "e1bca6cd85"],
+ ["e1be90", "ceb7cc93cd85"],
+ ["e1be90", "e1bca0cd85"],
+ ["e1bca1", "ceb7cc94"],
+ ["e1bca3", "ceb7cc94cc80"],
+ ["e1bca3", "e1bca1cc80"],
+ ["e1be93", "ceb7cc94cc80cd85"],
+ ["e1be93", "e1bca3cd85"],
+ ["e1bca5", "ceb7cc94cc81"],
+ ["e1bca5", "e1bca1cc81"],
+ ["e1be95", "ceb7cc94cc81cd85"],
+ ["e1be95", "e1bca5cd85"],
+ ["e1bca7", "ceb7cc94cd82"],
+ ["e1bca7", "e1bca1cd82"],
+ ["e1be97", "ceb7cc94cd82cd85"],
+ ["e1be97", "e1bca7cd85"],
+ ["e1be91", "ceb7cc94cd85"],
+ ["e1be91", "e1bca1cd85"],
["e1bf86", "ceb7cd82"],
- ["e1bf87", "ceb7cd85cd82"],
- ["e1bf88", "ce95cc80"],
- ["e1bf89", "ce95cc81"],
- ["e1bf8a", "ce97cc80"],
- ["e1bf8b", "ce97cc81"],
- ["e1bf8c", "ce97cd85"],
- ["e1bf8d", "e1bebfcc80"],
- ["e1bf8e", "e1bebfcc81"],
- ["e1bf8f", "e1bebfcd82"],
- ["e1bf90", "ceb9cc86"],
+ ["e1bf87", "ceb7cd82cd85"],
+ ["e1bf87", "e1bf86cd85"],
+ ["e1bf83", "ceb7cd85"],
+ ["e1bebe", "ceb9"],
+ ["e1bdb6", "ceb9cc80"],
+ ["ceaf", "ceb9cc81"],
["e1bf91", "ceb9cc84"],
+ ["e1bf90", "ceb9cc86"],
+ ["cf8a", "ceb9cc88"],
["e1bf92", "ceb9cc88cc80"],
+ ["e1bf92", "cf8acc80"],
["e1bf93", "ceb9cc88cc81"],
- ["e1bf96", "ceb9cd82"],
+ ["e1bf93", "cf8acc81"],
["e1bf97", "ceb9cc88cd82"],
- ["e1bf98", "ce99cc86"],
- ["e1bf99", "ce99cc84"],
- ["e1bf9a", "ce99cc80"],
- ["e1bf9b", "ce99cc81"],
- ["e1bf9d", "e1bfbecc80"],
- ["e1bf9e", "e1bfbecc81"],
- ["e1bf9f", "e1bfbecd82"],
- ["e1bfa0", "cf85cc86"],
+ ["e1bf97", "cf8acd82"],
+ ["e1bcb0", "ceb9cc93"],
+ ["e1bcb2", "ceb9cc93cc80"],
+ ["e1bcb2", "e1bcb0cc80"],
+ ["e1bcb4", "ceb9cc93cc81"],
+ ["e1bcb4", "e1bcb0cc81"],
+ ["e1bcb6", "ceb9cc93cd82"],
+ ["e1bcb6", "e1bcb0cd82"],
+ ["e1bcb1", "ceb9cc94"],
+ ["e1bcb3", "ceb9cc94cc80"],
+ ["e1bcb3", "e1bcb1cc80"],
+ ["e1bcb5", "ceb9cc94cc81"],
+ ["e1bcb5", "e1bcb1cc81"],
+ ["e1bcb7", "ceb9cc94cd82"],
+ ["e1bcb7", "e1bcb1cd82"],
+ ["e1bf96", "ceb9cd82"],
+ ["e1bdb8", "cebfcc80"],
+ ["cf8c", "cebfcc81"],
+ ["e1bd80", "cebfcc93"],
+ ["e1bd82", "cebfcc93cc80"],
+ ["e1bd82", "e1bd80cc80"],
+ ["e1bd84", "cebfcc93cc81"],
+ ["e1bd84", "e1bd80cc81"],
+ ["e1bd81", "cebfcc94"],
+ ["e1bd83", "cebfcc94cc80"],
+ ["e1bd83", "e1bd81cc80"],
+ ["e1bd85", "cebfcc94cc81"],
+ ["e1bd85", "e1bd81cc81"],
+ ["e1bfa4", "cf81cc93"],
+ ["e1bfa5", "cf81cc94"],
+ ["e1bdba", "cf85cc80"],
+ ["cf8d", "cf85cc81"],
["e1bfa1", "cf85cc84"],
+ ["e1bfa0", "cf85cc86"],
+ ["cf8b", "cf85cc88"],
["e1bfa2", "cf85cc88cc80"],
+ ["e1bfa2", "cf8bcc80"],
["e1bfa3", "cf85cc88cc81"],
- ["e1bfa4", "cf81cc93"],
- ["e1bfa5", "cf81cc94"],
- ["e1bfa6", "cf85cd82"],
+ ["e1bfa3", "cf8bcc81"],
["e1bfa7", "cf85cc88cd82"],
- ["e1bfa8", "cea5cc86"],
- ["e1bfa9", "cea5cc84"],
- ["e1bfaa", "cea5cc80"],
- ["e1bfab", "cea5cc81"],
- ["e1bfac", "cea1cc94"],
- ["e1bfad", "c2a8cc80"],
- ["e1bfae", "c2a8cc81"],
- ["e1bfaf", "60"],
- ["e1bfb2", "cf89cd85cc80"],
- ["e1bfb3", "cf89cd85"],
- ["e1bfb4", "cebfcd85cc81"],
+ ["e1bfa7", "cf8bcd82"],
+ ["e1bd90", "cf85cc93"],
+ ["e1bd92", "cf85cc93cc80"],
+ ["e1bd92", "e1bd90cc80"],
+ ["e1bd94", "cf85cc93cc81"],
+ ["e1bd94", "e1bd90cc81"],
+ ["e1bd96", "cf85cc93cd82"],
+ ["e1bd96", "e1bd90cd82"],
+ ["e1bd91", "cf85cc94"],
+ ["e1bd93", "cf85cc94cc80"],
+ ["e1bd93", "e1bd91cc80"],
+ ["e1bd95", "cf85cc94cc81"],
+ ["e1bd95", "e1bd91cc81"],
+ ["e1bd97", "cf85cc94cd82"],
+ ["e1bd97", "e1bd91cd82"],
+ ["e1bfa6", "cf85cd82"],
+ ["e1bdbc", "cf89cc80"],
+ ["e1bfb2", "cf89cc80cd85"],
+ ["e1bfb2", "e1bdbccd85"],
+ ["cf8e", "cf89cc81"],
+ ["e1bfb4", "cf89cc81cd85"],
+ ["e1bfb4", "cf8ecd85"],
+ ["e1bda0", "cf89cc93"],
+ ["e1bda2", "cf89cc93cc80"],
+ ["e1bda2", "e1bda0cc80"],
+ ["e1bea2", "cf89cc93cc80cd85"],
+ ["e1bea2", "e1bda2cd85"],
+ ["e1bda4", "cf89cc93cc81"],
+ ["e1bda4", "e1bda0cc81"],
+ ["e1bea4", "cf89cc93cc81cd85"],
+ ["e1bea4", "e1bda4cd85"],
+ ["e1bda6", "cf89cc93cd82"],
+ ["e1bda6", "e1bda0cd82"],
+ ["e1bea6", "cf89cc93cd82cd85"],
+ ["e1bea6", "e1bda6cd85"],
+ ["e1bea0", "cf89cc93cd85"],
+ ["e1bea0", "e1bda0cd85"],
+ ["e1bda1", "cf89cc94"],
+ ["e1bda3", "cf89cc94cc80"],
+ ["e1bda3", "e1bda1cc80"],
+ ["e1bea3", "cf89cc94cc80cd85"],
+ ["e1bea3", "e1bda3cd85"],
+ ["e1bda5", "cf89cc94cc81"],
+ ["e1bda5", "e1bda1cc81"],
+ ["e1bea5", "cf89cc94cc81cd85"],
+ ["e1bea5", "e1bda5cd85"],
+ ["e1bda7", "cf89cc94cd82"],
+ ["e1bda7", "e1bda1cd82"],
+ ["e1bea7", "cf89cc94cd82cd85"],
+ ["e1bea7", "e1bda7cd85"],
+ ["e1bea1", "cf89cc94cd85"],
+ ["e1bea1", "e1bda1cd85"],
["e1bfb6", "cf89cd82"],
- ["e1bfb7", "cf89cd85cd82"],
- ["e1bfb8", "ce9fcc80"],
- ["e1bfb9", "ce9fcc81"],
- ["e1bfba", "cea9cc80"],
- ["e1bfbb", "cea9cc81"],
- ["e1bfbc", "cea9cd85"],
- ["e1bfbd", "c2b4"],
+ ["e1bfb7", "cf89cd82cd85"],
+ ["e1bfb7", "e1bfb6cd85"],
+ ["e1bfb3", "cf89cd85"],
+ ["cf93", "cf92cc81"],
+ ["cf94", "cf92cc88"],
+ ["d087", "d086cc88"],
+ ["d390", "d090cc86"],
+ ["d392", "d090cc88"],
+ ["d083", "d093cc81"],
+ ["d080", "d095cc80"],
+ ["d396", "d095cc86"],
+ ["d081", "d095cc88"],
+ ["d381", "d096cc86"],
+ ["d39c", "d096cc88"],
+ ["d39e", "d097cc88"],
+ ["d08d", "d098cc80"],
+ ["d3a2", "d098cc84"],
+ ["d099", "d098cc86"],
+ ["d3a4", "d098cc88"],
+ ["d08c", "d09acc81"],
+ ["d3a6", "d09ecc88"],
+ ["d3ae", "d0a3cc84"],
+ ["d08e", "d0a3cc86"],
+ ["d3b0", "d0a3cc88"],
+ ["d3b2", "d0a3cc8b"],
+ ["d3b4", "d0a7cc88"],
+ ["d3b8", "d0abcc88"],
+ ["d3ac", "d0adcc88"],
+ ["d391", "d0b0cc86"],
+ ["d393", "d0b0cc88"],
+ ["d193", "d0b3cc81"],
+ ["d190", "d0b5cc80"],
+ ["d397", "d0b5cc86"],
+ ["d191", "d0b5cc88"],
+ ["d382", "d0b6cc86"],
+ ["d39d", "d0b6cc88"],
+ ["d39f", "d0b7cc88"],
+ ["d19d", "d0b8cc80"],
+ ["d3a3", "d0b8cc84"],
+ ["d0b9", "d0b8cc86"],
+ ["d3a5", "d0b8cc88"],
+ ["d19c", "d0bacc81"],
+ ["d3a7", "d0becc88"],
+ ["d3af", "d183cc84"],
+ ["d19e", "d183cc86"],
+ ["d3b1", "d183cc88"],
+ ["d3b3", "d183cc8b"],
+ ["d3b5", "d187cc88"],
+ ["d3b9", "d18bcc88"],
+ ["d3ad", "d18dcc88"],
+ ["d197", "d196cc88"],
+ ["d1b6", "d1b4cc8f"],
+ ["d1b7", "d1b5cc8f"],
+ ["d39a", "d398cc88"],
+ ["d39b", "d399cc88"],
+ ["d3aa", "d3a8cc88"],
+ ["d3ab", "d3a9cc88"],
+ ["efacae", "d790d6b7"],
+ ["efacaf", "d790d6b8"],
+ ["efacb0", "d790d6bc"],
+ ["efacb1", "d791d6bc"],
+ ["efad8c", "d791d6bf"],
+ ["efacb2", "d792d6bc"],
+ ["efacb3", "d793d6bc"],
+ ["efacb4", "d794d6bc"],
+ ["efad8b", "d795d6b9"],
+ ["efacb5", "d795d6bc"],
+ ["efacb6", "d796d6bc"],
+ ["efacb8", "d798d6bc"],
+ ["efac9d", "d799d6b4"],
+ ["efacb9", "d799d6bc"],
+ ["efacba", "d79ad6bc"],
+ ["efacbb", "d79bd6bc"],
+ ["efad8d", "d79bd6bf"],
+ ["efacbc", "d79cd6bc"],
+ ["efacbe", "d79ed6bc"],
+ ["efad80", "d7a0d6bc"],
+ ["efad81", "d7a1d6bc"],
+ ["efad83", "d7a3d6bc"],
+ ["efad84", "d7a4d6bc"],
+ ["efad8e", "d7a4d6bf"],
+ ["efad86", "d7a6d6bc"],
+ ["efad87", "d7a7d6bc"],
+ ["efad88", "d7a8d6bc"],
+ ["efad89", "d7a9d6bc"],
+ ["efacac", "d7a9d6bcd781"],
+ ["efacac", "efad89d781"],
+ ["efacad", "d7a9d6bcd782"],
+ ["efacad", "efad89d782"],
+ ["efacaa", "d7a9d781"],
+ ["efacab", "d7a9d782"],
+ ["efad8a", "d7aad6bc"],
+ ["efac9f", "d7b2d6b7"],
+ ["d8a2", "d8a7d993"],
+ ["d8a3", "d8a7d994"],
+ ["d8a5", "d8a7d995"],
+ ["d8a4", "d988d994"],
+ ["d8a6", "d98ad994"],
+ ["db82", "db81d994"],
+ ["db93", "db92d994"],
+ ["db80", "db95d994"],
+ ["e0a598", "e0a495e0a4bc"],
+ ["e0a599", "e0a496e0a4bc"],
+ ["e0a59a", "e0a497e0a4bc"],
+ ["e0a59b", "e0a49ce0a4bc"],
+ ["e0a59c", "e0a4a1e0a4bc"],
+ ["e0a59d", "e0a4a2e0a4bc"],
+ ["e0a4a9", "e0a4a8e0a4bc"],
+ ["e0a59e", "e0a4abe0a4bc"],
+ ["e0a59f", "e0a4afe0a4bc"],
+ ["e0a4b1", "e0a4b0e0a4bc"],
+ ["e0a4b4", "e0a4b3e0a4bc"],
+ ["e0a79c", "e0a6a1e0a6bc"],
+ ["e0a79d", "e0a6a2e0a6bc"],
+ ["e0a79f", "e0a6afe0a6bc"],
+ ["e0a78b", "e0a787e0a6be"],
+ ["e0a78c", "e0a787e0a797"],
+ ["e0a999", "e0a896e0a8bc"],
+ ["e0a99a", "e0a897e0a8bc"],
+ ["e0a99b", "e0a89ce0a8bc"],
+ ["e0a99e", "e0a8abe0a8bc"],
+ ["e0a8b3", "e0a8b2e0a8bc"],
+ ["e0a8b6", "e0a8b8e0a8bc"],
+ ["e0ad9c", "e0aca1e0acbc"],
+ ["e0ad9d", "e0aca2e0acbc"],
+ ["e0ad8b", "e0ad87e0acbe"],
+ ["e0ad88", "e0ad87e0ad96"],
+ ["e0ad8c", "e0ad87e0ad97"],
+ ["e0ae94", "e0ae92e0af97"],
+ ["e0af8a", "e0af86e0aebe"],
+ ["e0af8c", "e0af86e0af97"],
+ ["e0af8b", "e0af87e0aebe"],
+ ["e0b188", "e0b186e0b196"],
+ ["e0b380", "e0b2bfe0b395"],
+ ["e0b38a", "e0b386e0b382"],
+ ["e0b38b", "e0b386e0b382e0b395"],
+ ["e0b38b", "e0b38ae0b395"],
+ ["e0b387", "e0b386e0b395"],
+ ["e0b388", "e0b386e0b396"],
+ ["e0b58a", "e0b586e0b4be"],
+ ["e0b58c", "e0b586e0b597"],
+ ["e0b58b", "e0b587e0b4be"],
+ ["e0b79a", "e0b799e0b78a"],
+ ["e0b79c", "e0b799e0b78f"],
+ ["e0b79d", "e0b799e0b78fe0b78a"],
+ ["e0b79d", "e0b79ce0b78a"],
+ ["e0b79e", "e0b799e0b79f"],
+ ["e0bda9", "e0bd80e0beb5"],
+ ["e0bd83", "e0bd82e0beb7"],
+ ["e0bd8d", "e0bd8ce0beb7"],
+ ["e0bd92", "e0bd91e0beb7"],
+ ["e0bd97", "e0bd96e0beb7"],
+ ["e0bd9c", "e0bd9be0beb7"],
+ ["e0bdb3", "e0bdb1e0bdb2"],
+ ["e0bdb5", "e0bdb1e0bdb4"],
+ ["e0be81", "e0bdb1e0be80"],
+ ["e0beb9", "e0be90e0beb5"],
+ ["e0be93", "e0be92e0beb7"],
+ ["e0be9d", "e0be9ce0beb7"],
+ ["e0bea2", "e0bea1e0beb7"],
+ ["e0bea7", "e0bea6e0beb7"],
+ ["e0beac", "e0beabe0beb7"],
+ ["e0bdb6", "e0beb2e0be80"],
+ ["e0bdb8", "e0beb3e0be80"],
+ ["e180a6", "e180a5e180ae"],
+ ["eab080", "e18480e185a1"],
+ ["eab081", "e18480e185a1e186a8"],
+ ["eab081", "eab080e186a8"],
+ ["eab082", "e18480e185a1e186a9"],
+ ["eab082", "eab080e186a9"],
+ ["eab083", "e18480e185a1e186aa"],
+ ["eab083", "eab080e186aa"],
+ ["eab084", "e18480e185a1e186ab"],
+ ["eab084", "eab080e186ab"],
+ ["eab085", "e18480e185a1e186ac"],
+ ["eab085", "eab080e186ac"],
+ ["eab086", "e18480e185a1e186ad"],
+ ["eab086", "eab080e186ad"],
+ ["eab087", "e18480e185a1e186ae"],
+ ["eab087", "eab080e186ae"],
+ ["eab088", "e18480e185a1e186af"],
+ ["eab088", "eab080e186af"],
+ ["eab089", "e18480e185a1e186b0"],
+ ["eab089", "eab080e186b0"],
+ ["eab08a", "e18480e185a1e186b1"],
+ ["eab08a", "eab080e186b1"],
+ ["eab08b", "e18480e185a1e186b2"],
+ ["eab08b", "eab080e186b2"],
+ ["eab08c", "e18480e185a1e186b3"],
+ ["eab08c", "eab080e186b3"],
+ ["eab08d", "e18480e185a1e186b4"],
+ ["eab08d", "eab080e186b4"],
+ ["eab08e", "e18480e185a1e186b5"],
+ ["eab08e", "eab080e186b5"],
+ ["eab08f", "e18480e185a1e186b6"],
+ ["eab08f", "eab080e186b6"],
+ ["eab090", "e18480e185a1e186b7"],
+ ["eab090", "eab080e186b7"],
+ ["eab091", "e18480e185a1e186b8"],
+ ["eab091", "eab080e186b8"],
+ ["eab092", "e18480e185a1e186b9"],
+ ["eab092", "eab080e186b9"],
+ ["eab093", "e18480e185a1e186ba"],
+ ["eab093", "eab080e186ba"],
+ ["eab094", "e18480e185a1e186bb"],
+ ["eab094", "eab080e186bb"],
+ ["eab095", "e18480e185a1e186bc"],
+ ["eab095", "eab080e186bc"],
+ ["eab096", "e18480e185a1e186bd"],
+ ["eab096", "eab080e186bd"],
+ ["eab097", "e18480e185a1e186be"],
+ ["eab097", "eab080e186be"],
+ ["eab098", "e18480e185a1e186bf"],
+ ["eab098", "eab080e186bf"],
+ ["eab099", "e18480e185a1e18780"],
+ ["eab099", "eab080e18780"],
+ ["eab09a", "e18480e185a1e18781"],
+ ["eab09a", "eab080e18781"],
+ ["eab09b", "e18480e185a1e18782"],
+ ["eab09b", "eab080e18782"],
+ ["eab09c", "e18480e185a2"],
+ ["eab09d", "e18480e185a2e186a8"],
+ ["eab09d", "eab09ce186a8"],
+ ["eab09e", "e18480e185a2e186a9"],
+ ["eab09e", "eab09ce186a9"],
+ ["eab09f", "e18480e185a2e186aa"],
+ ["eab09f", "eab09ce186aa"],
+ ["eab0a0", "e18480e185a2e186ab"],
+ ["eab0a0", "eab09ce186ab"],
+ ["eab0a1", "e18480e185a2e186ac"],
+ ["eab0a1", "eab09ce186ac"],
+ ["eab0a2", "e18480e185a2e186ad"],
+ ["eab0a2", "eab09ce186ad"],
+ ["eab0a3", "e18480e185a2e186ae"],
+ ["eab0a3", "eab09ce186ae"],
+ ["eab0a4", "e18480e185a2e186af"],
+ ["eab0a4", "eab09ce186af"],
+ ["eab0a5", "e18480e185a2e186b0"],
+ ["eab0a5", "eab09ce186b0"],
+ ["eab0a6", "e18480e185a2e186b1"],
+ ["eab0a6", "eab09ce186b1"],
+ ["eab0a7", "e18480e185a2e186b2"],
+ ["eab0a7", "eab09ce186b2"],
+ ["eab0a8", "e18480e185a2e186b3"],
+ ["eab0a8", "eab09ce186b3"],
+ ["eab0a9", "e18480e185a2e186b4"],
+ ["eab0a9", "eab09ce186b4"],
+ ["eab0aa", "e18480e185a2e186b5"],
+ ["eab0aa", "eab09ce186b5"],
+ ["eab0ab", "e18480e185a2e186b6"],
+ ["eab0ab", "eab09ce186b6"],
+ ["eab0ac", "e18480e185a2e186b7"],
+ ["eab0ac", "eab09ce186b7"],
+ ["eab0ad", "e18480e185a2e186b8"],
+ ["eab0ad", "eab09ce186b8"],
+ ["eab0ae", "e18480e185a2e186b9"],
+ ["eab0ae", "eab09ce186b9"],
+ ["eab0af", "e18480e185a2e186ba"],
+ ["eab0af", "eab09ce186ba"],
+ ["eab0b0", "e18480e185a2e186bb"],
+ ["eab0b0", "eab09ce186bb"],
+ ["eab0b1", "e18480e185a2e186bc"],
+ ["eab0b1", "eab09ce186bc"],
+ ["eab0b2", "e18480e185a2e186bd"],
+ ["eab0b2", "eab09ce186bd"],
+ ["eab0b3", "e18480e185a2e186be"],
+ ["eab0b3", "eab09ce186be"],
+ ["eab0b4", "e18480e185a2e186bf"],
+ ["eab0b4", "eab09ce186bf"],
+ ["eab0b5", "e18480e185a2e18780"],
+ ["eab0b5", "eab09ce18780"],
+ ["eab0b6", "e18480e185a2e18781"],
+ ["eab0b6", "eab09ce18781"],
+ ["eab0b7", "e18480e185a2e18782"],
+ ["eab0b7", "eab09ce18782"],
+ ["eab0b8", "e18480e185a3"],
+ ["eab0b9", "e18480e185a3e186a8"],
+ ["eab0b9", "eab0b8e186a8"],
+ ["eab0ba", "e18480e185a3e186a9"],
+ ["eab0ba", "eab0b8e186a9"],
+ ["eab0bb", "e18480e185a3e186aa"],
+ ["eab0bb", "eab0b8e186aa"],
+ ["eab0bc", "e18480e185a3e186ab"],
+ ["eab0bc", "eab0b8e186ab"],
+ ["eab0bd", "e18480e185a3e186ac"],
+ ["eab0bd", "eab0b8e186ac"],
+ ["eab0be", "e18480e185a3e186ad"],
+ ["eab0be", "eab0b8e186ad"],
+ ["eab0bf", "e18480e185a3e186ae"],
+ ["eab0bf", "eab0b8e186ae"],
+ ["eab180", "e18480e185a3e186af"],
+ ["eab180", "eab0b8e186af"],
+ ["eab181", "e18480e185a3e186b0"],
+ ["eab181", "eab0b8e186b0"],
+ ["eab182", "e18480e185a3e186b1"],
+ ["eab182", "eab0b8e186b1"],
+ ["eab183", "e18480e185a3e186b2"],
+ ["eab183", "eab0b8e186b2"],
+ ["eab184", "e18480e185a3e186b3"],
+ ["eab184", "eab0b8e186b3"],
+ ["eab185", "e18480e185a3e186b4"],
+ ["eab185", "eab0b8e186b4"],
+ ["eab186", "e18480e185a3e186b5"],
+ ["eab186", "eab0b8e186b5"],
+ ["eab187", "e18480e185a3e186b6"],
+ ["eab187", "eab0b8e186b6"],
+ ["eab188", "e18480e185a3e186b7"],
+ ["eab188", "eab0b8e186b7"],
+ ["eab189", "e18480e185a3e186b8"],
+ ["eab189", "eab0b8e186b8"],
+ ["eab18a", "e18480e185a3e186b9"],
+ ["eab18a", "eab0b8e186b9"],
+ ["eab18b", "e18480e185a3e186ba"],
+ ["eab18b", "eab0b8e186ba"],
+ ["eab18c", "e18480e185a3e186bb"],
+ ["eab18c", "eab0b8e186bb"],
+ ["eab18d", "e18480e185a3e186bc"],
+ ["eab18d", "eab0b8e186bc"],
+ ["eab18e", "e18480e185a3e186bd"],
+ ["eab18e", "eab0b8e186bd"],
+ ["eab18f", "e18480e185a3e186be"],
+ ["eab18f", "eab0b8e186be"],
+ ["eab190", "e18480e185a3e186bf"],
+ ["eab190", "eab0b8e186bf"],
+ ["eab191", "e18480e185a3e18780"],
+ ["eab191", "eab0b8e18780"],
+ ["eab192", "e18480e185a3e18781"],
+ ["eab192", "eab0b8e18781"],
+ ["eab193", "e18480e185a3e18782"],
+ ["eab193", "eab0b8e18782"],
+ ["eab194", "e18480e185a4"],
+ ["eab195", "e18480e185a4e186a8"],
+ ["eab195", "eab194e186a8"],
+ ["eab196", "e18480e185a4e186a9"],
+ ["eab196", "eab194e186a9"],
+ ["eab197", "e18480e185a4e186aa"],
+ ["eab197", "eab194e186aa"],
+ ["eab198", "e18480e185a4e186ab"],
+ ["eab198", "eab194e186ab"],
+ ["eab199", "e18480e185a4e186ac"],
+ ["eab199", "eab194e186ac"],
+ ["eab19a", "e18480e185a4e186ad"],
+ ["eab19a", "eab194e186ad"],
+ ["eab19b", "e18480e185a4e186ae"],
+ ["eab19b", "eab194e186ae"],
+ ["eab19c", "e18480e185a4e186af"],
+ ["eab19c", "eab194e186af"],
+ ["eab19d", "e18480e185a4e186b0"],
+ ["eab19d", "eab194e186b0"],
+ ["eab19e", "e18480e185a4e186b1"],
+ ["eab19e", "eab194e186b1"],
+ ["eab19f", "e18480e185a4e186b2"],
+ ["eab19f", "eab194e186b2"],
+ ["eab1a0", "e18480e185a4e186b3"],
+ ["eab1a0", "eab194e186b3"],
+ ["eab1a1", "e18480e185a4e186b4"],
+ ["eab1a1", "eab194e186b4"],
+ ["eab1a2", "e18480e185a4e186b5"],
+ ["eab1a2", "eab194e186b5"],
+ ["eab1a3", "e18480e185a4e186b6"],
+ ["eab1a3", "eab194e186b6"],
+ ["eab1a4", "e18480e185a4e186b7"],
+ ["eab1a4", "eab194e186b7"],
+ ["eab1a5", "e18480e185a4e186b8"],
+ ["eab1a5", "eab194e186b8"],
+ ["eab1a6", "e18480e185a4e186b9"],
+ ["eab1a6", "eab194e186b9"],
+ ["eab1a7", "e18480e185a4e186ba"],
+ ["eab1a7", "eab194e186ba"],
+ ["eab1a8", "e18480e185a4e186bb"],
+ ["eab1a8", "eab194e186bb"],
+ ["eab1a9", "e18480e185a4e186bc"],
+ ["eab1a9", "eab194e186bc"],
+ ["eab1aa", "e18480e185a4e186bd"],
+ ["eab1aa", "eab194e186bd"],
+ ["eab1ab", "e18480e185a4e186be"],
+ ["eab1ab", "eab194e186be"],
+ ["eab1ac", "e18480e185a4e186bf"],
+ ["eab1ac", "eab194e186bf"],
+ ["eab1ad", "e18480e185a4e18780"],
+ ["eab1ad", "eab194e18780"],
+ ["eab1ae", "e18480e185a4e18781"],
+ ["eab1ae", "eab194e18781"],
+ ["eab1af", "e18480e185a4e18782"],
+ ["eab1af", "eab194e18782"],
+ ["eab1b0", "e18480e185a5"],
+ ["eab1b1", "e18480e185a5e186a8"],
+ ["eab1b1", "eab1b0e186a8"],
+ ["eab1b2", "e18480e185a5e186a9"],
+ ["eab1b2", "eab1b0e186a9"],
+ ["eab1b3", "e18480e185a5e186aa"],
+ ["eab1b3", "eab1b0e186aa"],
+ ["eab1b4", "e18480e185a5e186ab"],
+ ["eab1b4", "eab1b0e186ab"],
+ ["eab1b5", "e18480e185a5e186ac"],
+ ["eab1b5", "eab1b0e186ac"],
+ ["eab1b6", "e18480e185a5e186ad"],
+ ["eab1b6", "eab1b0e186ad"],
+ ["eab1b7", "e18480e185a5e186ae"],
+ ["eab1b7", "eab1b0e186ae"],
+ ["eab1b8", "e18480e185a5e186af"],
+ ["eab1b8", "eab1b0e186af"],
+ ["eab1b9", "e18480e185a5e186b0"],
+ ["eab1b9", "eab1b0e186b0"],
+ ["eab1ba", "e18480e185a5e186b1"],
+ ["eab1ba", "eab1b0e186b1"],
+ ["eab1bb", "e18480e185a5e186b2"],
+ ["eab1bb", "eab1b0e186b2"],
+ ["eab1bc", "e18480e185a5e186b3"],
+ ["eab1bc", "eab1b0e186b3"],
+ ["eab1bd", "e18480e185a5e186b4"],
+ ["eab1bd", "eab1b0e186b4"],
+ ["eab1be", "e18480e185a5e186b5"],
+ ["eab1be", "eab1b0e186b5"],
+ ["eab1bf", "e18480e185a5e186b6"],
+ ["eab1bf", "eab1b0e186b6"],
+ ["eab280", "e18480e185a5e186b7"],
+ ["eab280", "eab1b0e186b7"],
+ ["eab281", "e18480e185a5e186b8"],
+ ["eab281", "eab1b0e186b8"],
+ ["eab282", "e18480e185a5e186b9"],
+ ["eab282", "eab1b0e186b9"],
+ ["eab283", "e18480e185a5e186ba"],
+ ["eab283", "eab1b0e186ba"],
+ ["eab284", "e18480e185a5e186bb"],
+ ["eab284", "eab1b0e186bb"],
+ ["eab285", "e18480e185a5e186bc"],
+ ["eab285", "eab1b0e186bc"],
+ ["eab286", "e18480e185a5e186bd"],
+ ["eab286", "eab1b0e186bd"],
+ ["eab287", "e18480e185a5e186be"],
+ ["eab287", "eab1b0e186be"],
+ ["eab288", "e18480e185a5e186bf"],
+ ["eab288", "eab1b0e186bf"],
+ ["eab289", "e18480e185a5e18780"],
+ ["eab289", "eab1b0e18780"],
+ ["eab28a", "e18480e185a5e18781"],
+ ["eab28a", "eab1b0e18781"],
+ ["eab28b", "e18480e185a5e18782"],
+ ["eab28b", "eab1b0e18782"],
+ ["eab28c", "e18480e185a6"],
+ ["eab28d", "e18480e185a6e186a8"],
+ ["eab28d", "eab28ce186a8"],
+ ["eab28e", "e18480e185a6e186a9"],
+ ["eab28e", "eab28ce186a9"],
+ ["eab28f", "e18480e185a6e186aa"],
+ ["eab28f", "eab28ce186aa"],
+ ["eab290", "e18480e185a6e186ab"],
+ ["eab290", "eab28ce186ab"],
+ ["eab291", "e18480e185a6e186ac"],
+ ["eab291", "eab28ce186ac"],
+ ["eab292", "e18480e185a6e186ad"],
+ ["eab292", "eab28ce186ad"],
+ ["eab293", "e18480e185a6e186ae"],
+ ["eab293", "eab28ce186ae"],
+ ["eab294", "e18480e185a6e186af"],
+ ["eab294", "eab28ce186af"],
+ ["eab295", "e18480e185a6e186b0"],
+ ["eab295", "eab28ce186b0"],
+ ["eab296", "e18480e185a6e186b1"],
+ ["eab296", "eab28ce186b1"],
+ ["eab297", "e18480e185a6e186b2"],
+ ["eab297", "eab28ce186b2"],
+ ["eab298", "e18480e185a6e186b3"],
+ ["eab298", "eab28ce186b3"],
+ ["eab299", "e18480e185a6e186b4"],
+ ["eab299", "eab28ce186b4"],
+ ["eab29a", "e18480e185a6e186b5"],
+ ["eab29a", "eab28ce186b5"],
+ ["eab29b", "e18480e185a6e186b6"],
+ ["eab29b", "eab28ce186b6"],
+ ["eab29c", "e18480e185a6e186b7"],
+ ["eab29c", "eab28ce186b7"],
+ ["eab29d", "e18480e185a6e186b8"],
+ ["eab29d", "eab28ce186b8"],
+ ["eab29e", "e18480e185a6e186b9"],
+ ["eab29e", "eab28ce186b9"],
+ ["eab29f", "e18480e185a6e186ba"],
+ ["eab29f", "eab28ce186ba"],
+ ["eab2a0", "e18480e185a6e186bb"],
+ ["eab2a0", "eab28ce186bb"],
+ ["eab2a1", "e18480e185a6e186bc"],
+ ["eab2a1", "eab28ce186bc"],
+ ["eab2a2", "e18480e185a6e186bd"],
+ ["eab2a2", "eab28ce186bd"],
+ ["eab2a3", "e18480e185a6e186be"],
+ ["eab2a3", "eab28ce186be"],
+ ["eab2a4", "e18480e185a6e186bf"],
+ ["eab2a4", "eab28ce186bf"],
+ ["eab2a5", "e18480e185a6e18780"],
+ ["eab2a5", "eab28ce18780"],
+ ["eab2a6", "e18480e185a6e18781"],
+ ["eab2a6", "eab28ce18781"],
+ ["eab2a7", "e18480e185a6e18782"],
+ ["eab2a7", "eab28ce18782"],
+ ["eab2a8", "e18480e185a7"],
+ ["eab2a9", "e18480e185a7e186a8"],
+ ["eab2a9", "eab2a8e186a8"],
+ ["eab2aa", "e18480e185a7e186a9"],
+ ["eab2aa", "eab2a8e186a9"],
+ ["eab2ab", "e18480e185a7e186aa"],
+ ["eab2ab", "eab2a8e186aa"],
+ ["eab2ac", "e18480e185a7e186ab"],
+ ["eab2ac", "eab2a8e186ab"],
+ ["eab2ad", "e18480e185a7e186ac"],
+ ["eab2ad", "eab2a8e186ac"],
+ ["eab2ae", "e18480e185a7e186ad"],
+ ["eab2ae", "eab2a8e186ad"],
+ ["eab2af", "e18480e185a7e186ae"],
+ ["eab2af", "eab2a8e186ae"],
+ ["eab2b0", "e18480e185a7e186af"],
+ ["eab2b0", "eab2a8e186af"],
+ ["eab2b1", "e18480e185a7e186b0"],
+ ["eab2b1", "eab2a8e186b0"],
+ ["eab2b2", "e18480e185a7e186b1"],
+ ["eab2b2", "eab2a8e186b1"],
+ ["eab2b3", "e18480e185a7e186b2"],
+ ["eab2b3", "eab2a8e186b2"],
+ ["eab2b4", "e18480e185a7e186b3"],
+ ["eab2b4", "eab2a8e186b3"],
+ ["eab2b5", "e18480e185a7e186b4"],
+ ["eab2b5", "eab2a8e186b4"],
+ ["eab2b6", "e18480e185a7e186b5"],
+ ["eab2b6", "eab2a8e186b5"],
+ ["eab2b7", "e18480e185a7e186b6"],
+ ["eab2b7", "eab2a8e186b6"],
+ ["eab2b8", "e18480e185a7e186b7"],
+ ["eab2b8", "eab2a8e186b7"],
+ ["eab2b9", "e18480e185a7e186b8"],
+ ["eab2b9", "eab2a8e186b8"],
+ ["eab2ba", "e18480e185a7e186b9"],
+ ["eab2ba", "eab2a8e186b9"],
+ ["eab2bb", "e18480e185a7e186ba"],
+ ["eab2bb", "eab2a8e186ba"],
+ ["eab2bc", "e18480e185a7e186bb"],
+ ["eab2bc", "eab2a8e186bb"],
+ ["eab2bd", "e18480e185a7e186bc"],
+ ["eab2bd", "eab2a8e186bc"],
+ ["eab2be", "e18480e185a7e186bd"],
+ ["eab2be", "eab2a8e186bd"],
+ ["eab2bf", "e18480e185a7e186be"],
+ ["eab2bf", "eab2a8e186be"],
+ ["eab380", "e18480e185a7e186bf"],
+ ["eab380", "eab2a8e186bf"],
+ ["eab381", "e18480e185a7e18780"],
+ ["eab381", "eab2a8e18780"],
+ ["eab382", "e18480e185a7e18781"],
+ ["eab382", "eab2a8e18781"],
+ ["eab383", "e18480e185a7e18782"],
+ ["eab383", "eab2a8e18782"],
+ ["eab384", "e18480e185a8"],
+ ["eab385", "e18480e185a8e186a8"],
+ ["eab385", "eab384e186a8"],
+ ["eab386", "e18480e185a8e186a9"],
+ ["eab386", "eab384e186a9"],
+ ["eab387", "e18480e185a8e186aa"],
+ ["eab387", "eab384e186aa"],
+ ["eab388", "e18480e185a8e186ab"],
+ ["eab388", "eab384e186ab"],
+ ["eab389", "e18480e185a8e186ac"],
+ ["eab389", "eab384e186ac"],
+ ["eab38a", "e18480e185a8e186ad"],
+ ["eab38a", "eab384e186ad"],
+ ["eab38b", "e18480e185a8e186ae"],
+ ["eab38b", "eab384e186ae"],
+ ["eab38c", "e18480e185a8e186af"],
+ ["eab38c", "eab384e186af"],
+ ["eab38d", "e18480e185a8e186b0"],
+ ["eab38d", "eab384e186b0"],
+ ["eab38e", "e18480e185a8e186b1"],
+ ["eab38e", "eab384e186b1"],
+ ["eab38f", "e18480e185a8e186b2"],
+ ["eab38f", "eab384e186b2"],
+ ["eab390", "e18480e185a8e186b3"],
+ ["eab390", "eab384e186b3"],
+ ["eab391", "e18480e185a8e186b4"],
+ ["eab391", "eab384e186b4"],
+ ["eab392", "e18480e185a8e186b5"],
+ ["eab392", "eab384e186b5"],
+ ["eab393", "e18480e185a8e186b6"],
+ ["eab393", "eab384e186b6"],
+ ["eab394", "e18480e185a8e186b7"],
+ ["eab394", "eab384e186b7"],
+ ["eab395", "e18480e185a8e186b8"],
+ ["eab395", "eab384e186b8"],
+ ["eab396", "e18480e185a8e186b9"],
+ ["eab396", "eab384e186b9"],
+ ["eab397", "e18480e185a8e186ba"],
+ ["eab397", "eab384e186ba"],
+ ["eab398", "e18480e185a8e186bb"],
+ ["eab398", "eab384e186bb"],
+ ["eab399", "e18480e185a8e186bc"],
+ ["eab399", "eab384e186bc"],
+ ["eab39a", "e18480e185a8e186bd"],
+ ["eab39a", "eab384e186bd"],
+ ["eab39b", "e18480e185a8e186be"],
+ ["eab39b", "eab384e186be"],
+ ["eab39c", "e18480e185a8e186bf"],
+ ["eab39c", "eab384e186bf"],
+ ["eab39d", "e18480e185a8e18780"],
+ ["eab39d", "eab384e18780"],
+ ["eab39e", "e18480e185a8e18781"],
+ ["eab39e", "eab384e18781"],
+ ["eab39f", "e18480e185a8e18782"],
+ ["eab39f", "eab384e18782"],
+ ["eab3a0", "e18480e185a9"],
+ ["eab3a1", "e18480e185a9e186a8"],
+ ["eab3a1", "eab3a0e186a8"],
+ ["eab3a2", "e18480e185a9e186a9"],
+ ["eab3a2", "eab3a0e186a9"],
+ ["eab3a3", "e18480e185a9e186aa"],
+ ["eab3a3", "eab3a0e186aa"],
+ ["eab3a4", "e18480e185a9e186ab"],
+ ["eab3a4", "eab3a0e186ab"],
+ ["eab3a5", "e18480e185a9e186ac"],
+ ["eab3a5", "eab3a0e186ac"],
+ ["eab3a6", "e18480e185a9e186ad"],
+ ["eab3a6", "eab3a0e186ad"],
+ ["eab3a7", "e18480e185a9e186ae"],
+ ["eab3a7", "eab3a0e186ae"],
+ ["eab3a8", "e18480e185a9e186af"],
+ ["eab3a8", "eab3a0e186af"],
+ ["eab3a9", "e18480e185a9e186b0"],
+ ["eab3a9", "eab3a0e186b0"],
+ ["eab3aa", "e18480e185a9e186b1"],
+ ["eab3aa", "eab3a0e186b1"],
+ ["eab3ab", "e18480e185a9e186b2"],
+ ["eab3ab", "eab3a0e186b2"],
+ ["eab3ac", "e18480e185a9e186b3"],
+ ["eab3ac", "eab3a0e186b3"],
+ ["eab3ad", "e18480e185a9e186b4"],
+ ["eab3ad", "eab3a0e186b4"],
+ ["eab3ae", "e18480e185a9e186b5"],
+ ["eab3ae", "eab3a0e186b5"],
+ ["eab3af", "e18480e185a9e186b6"],
+ ["eab3af", "eab3a0e186b6"],
+ ["eab3b0", "e18480e185a9e186b7"],
+ ["eab3b0", "eab3a0e186b7"],
+ ["eab3b1", "e18480e185a9e186b8"],
+ ["eab3b1", "eab3a0e186b8"],
+ ["eab3b2", "e18480e185a9e186b9"],
+ ["eab3b2", "eab3a0e186b9"],
+ ["eab3b3", "e18480e185a9e186ba"],
+ ["eab3b3", "eab3a0e186ba"],
+ ["eab3b4", "e18480e185a9e186bb"],
+ ["eab3b4", "eab3a0e186bb"],
+ ["eab3b5", "e18480e185a9e186bc"],
+ ["eab3b5", "eab3a0e186bc"],
+ ["eab3b6", "e18480e185a9e186bd"],
+ ["eab3b6", "eab3a0e186bd"],
+ ["eab3b7", "e18480e185a9e186be"],
+ ["eab3b7", "eab3a0e186be"],
+ ["eab3b8", "e18480e185a9e186bf"],
+ ["eab3b8", "eab3a0e186bf"],
+ ["eab3b9", "e18480e185a9e18780"],
+ ["eab3b9", "eab3a0e18780"],
+ ["eab3ba", "e18480e185a9e18781"],
+ ["eab3ba", "eab3a0e18781"],
+ ["eab3bb", "e18480e185a9e18782"],
+ ["eab3bb", "eab3a0e18782"],
+ ["eab3bc", "e18480e185aa"],
+ ["eab3bd", "e18480e185aae186a8"],
+ ["eab3bd", "eab3bce186a8"],
+ ["eab3be", "e18480e185aae186a9"],
+ ["eab3be", "eab3bce186a9"],
+ ["eab3bf", "e18480e185aae186aa"],
+ ["eab3bf", "eab3bce186aa"],
+ ["eab480", "e18480e185aae186ab"],
+ ["eab480", "eab3bce186ab"],
+ ["eab481", "e18480e185aae186ac"],
+ ["eab481", "eab3bce186ac"],
+ ["eab482", "e18480e185aae186ad"],
+ ["eab482", "eab3bce186ad"],
+ ["eab483", "e18480e185aae186ae"],
+ ["eab483", "eab3bce186ae"],
+ ["eab484", "e18480e185aae186af"],
+ ["eab484", "eab3bce186af"],
+ ["eab485", "e18480e185aae186b0"],
+ ["eab485", "eab3bce186b0"],
+ ["eab486", "e18480e185aae186b1"],
+ ["eab486", "eab3bce186b1"],
+ ["eab487", "e18480e185aae186b2"],
+ ["eab487", "eab3bce186b2"],
+ ["eab488", "e18480e185aae186b3"],
+ ["eab488", "eab3bce186b3"],
+ ["eab489", "e18480e185aae186b4"],
+ ["eab489", "eab3bce186b4"],
+ ["eab48a", "e18480e185aae186b5"],
+ ["eab48a", "eab3bce186b5"],
+ ["eab48b", "e18480e185aae186b6"],
+ ["eab48b", "eab3bce186b6"],
+ ["eab48c", "e18480e185aae186b7"],
+ ["eab48c", "eab3bce186b7"],
+ ["eab48d", "e18480e185aae186b8"],
+ ["eab48d", "eab3bce186b8"],
+ ["eab48e", "e18480e185aae186b9"],
+ ["eab48e", "eab3bce186b9"],
+ ["eab48f", "e18480e185aae186ba"],
+ ["eab48f", "eab3bce186ba"],
+ ["eab490", "e18480e185aae186bb"],
+ ["eab490", "eab3bce186bb"],
+ ["eab491", "e18480e185aae186bc"],
+ ["eab491", "eab3bce186bc"],
+ ["eab492", "e18480e185aae186bd"],
+ ["eab492", "eab3bce186bd"],
+ ["eab493", "e18480e185aae186be"],
+ ["eab493", "eab3bce186be"],
+ ["eab494", "e18480e185aae186bf"],
+ ["eab494", "eab3bce186bf"],
+ ["eab495", "e18480e185aae18780"],
+ ["eab495", "eab3bce18780"],
+ ["eab496", "e18480e185aae18781"],
+ ["eab496", "eab3bce18781"],
+ ["eab497", "e18480e185aae18782"],
+ ["eab497", "eab3bce18782"],
+ ["eab498", "e18480e185ab"],
+ ["eab499", "e18480e185abe186a8"],
+ ["eab499", "eab498e186a8"],
+ ["eab49a", "e18480e185abe186a9"],
+ ["eab49a", "eab498e186a9"],
+ ["eab49b", "e18480e185abe186aa"],
+ ["eab49b", "eab498e186aa"],
+ ["eab49c", "e18480e185abe186ab"],
+ ["eab49c", "eab498e186ab"],
+ ["eab49d", "e18480e185abe186ac"],
+ ["eab49d", "eab498e186ac"],
+ ["eab49e", "e18480e185abe186ad"],
+ ["eab49e", "eab498e186ad"],
+ ["eab49f", "e18480e185abe186ae"],
+ ["eab49f", "eab498e186ae"],
+ ["eab4a0", "e18480e185abe186af"],
+ ["eab4a0", "eab498e186af"],
+ ["eab4a1", "e18480e185abe186b0"],
+ ["eab4a1", "eab498e186b0"],
+ ["eab4a2", "e18480e185abe186b1"],
+ ["eab4a2", "eab498e186b1"],
+ ["eab4a3", "e18480e185abe186b2"],
+ ["eab4a3", "eab498e186b2"],
+ ["eab4a4", "e18480e185abe186b3"],
+ ["eab4a4", "eab498e186b3"],
+ ["eab4a5", "e18480e185abe186b4"],
+ ["eab4a5", "eab498e186b4"],
+ ["eab4a6", "e18480e185abe186b5"],
+ ["eab4a6", "eab498e186b5"],
+ ["eab4a7", "e18480e185abe186b6"],
+ ["eab4a7", "eab498e186b6"],
+ ["eab4a8", "e18480e185abe186b7"],
+ ["eab4a8", "eab498e186b7"],
+ ["eab4a9", "e18480e185abe186b8"],
+ ["eab4a9", "eab498e186b8"],
+ ["eab4aa", "e18480e185abe186b9"],
+ ["eab4aa", "eab498e186b9"],
+ ["eab4ab", "e18480e185abe186ba"],
+ ["eab4ab", "eab498e186ba"],
+ ["eab4ac", "e18480e185abe186bb"],
+ ["eab4ac", "eab498e186bb"],
+ ["eab4ad", "e18480e185abe186bc"],
+ ["eab4ad", "eab498e186bc"],
+ ["eab4ae", "e18480e185abe186bd"],
+ ["eab4ae", "eab498e186bd"],
+ ["eab4af", "e18480e185abe186be"],
+ ["eab4af", "eab498e186be"],
+ ["eab4b0", "e18480e185abe186bf"],
+ ["eab4b0", "eab498e186bf"],
+ ["eab4b1", "e18480e185abe18780"],
+ ["eab4b1", "eab498e18780"],
+ ["eab4b2", "e18480e185abe18781"],
+ ["eab4b2", "eab498e18781"],
+ ["eab4b3", "e18480e185abe18782"],
+ ["eab4b3", "eab498e18782"],
+ ["eab4b4", "e18480e185ac"],
+ ["eab4b5", "e18480e185ace186a8"],
+ ["eab4b5", "eab4b4e186a8"],
+ ["eab4b6", "e18480e185ace186a9"],
+ ["eab4b6", "eab4b4e186a9"],
+ ["eab4b7", "e18480e185ace186aa"],
+ ["eab4b7", "eab4b4e186aa"],
+ ["eab4b8", "e18480e185ace186ab"],
+ ["eab4b8", "eab4b4e186ab"],
+ ["eab4b9", "e18480e185ace186ac"],
+ ["eab4b9", "eab4b4e186ac"],
+ ["eab4ba", "e18480e185ace186ad"],
+ ["eab4ba", "eab4b4e186ad"],
+ ["eab4bb", "e18480e185ace186ae"],
+ ["eab4bb", "eab4b4e186ae"],
+ ["eab4bc", "e18480e185ace186af"],
+ ["eab4bc", "eab4b4e186af"],
+ ["eab4bd", "e18480e185ace186b0"],
+ ["eab4bd", "eab4b4e186b0"],
+ ["eab4be", "e18480e185ace186b1"],
+ ["eab4be", "eab4b4e186b1"],
+ ["eab4bf", "e18480e185ace186b2"],
+ ["eab4bf", "eab4b4e186b2"],
+ ["eab580", "e18480e185ace186b3"],
+ ["eab580", "eab4b4e186b3"],
+ ["eab581", "e18480e185ace186b4"],
+ ["eab581", "eab4b4e186b4"],
+ ["eab582", "e18480e185ace186b5"],
+ ["eab582", "eab4b4e186b5"],
+ ["eab583", "e18480e185ace186b6"],
+ ["eab583", "eab4b4e186b6"],
+ ["eab584", "e18480e185ace186b7"],
+ ["eab584", "eab4b4e186b7"],
+ ["eab585", "e18480e185ace186b8"],
+ ["eab585", "eab4b4e186b8"],
+ ["eab586", "e18480e185ace186b9"],
+ ["eab586", "eab4b4e186b9"],
+ ["eab587", "e18480e185ace186ba"],
+ ["eab587", "eab4b4e186ba"],
+ ["eab588", "e18480e185ace186bb"],
+ ["eab588", "eab4b4e186bb"],
+ ["eab589", "e18480e185ace186bc"],
+ ["eab589", "eab4b4e186bc"],
+ ["eab58a", "e18480e185ace186bd"],
+ ["eab58a", "eab4b4e186bd"],
+ ["eab58b", "e18480e185ace186be"],
+ ["eab58b", "eab4b4e186be"],
+ ["eab58c", "e18480e185ace186bf"],
+ ["eab58c", "eab4b4e186bf"],
+ ["eab58d", "e18480e185ace18780"],
+ ["eab58d", "eab4b4e18780"],
+ ["eab58e", "e18480e185ace18781"],
+ ["eab58e", "eab4b4e18781"],
+ ["eab58f", "e18480e185ace18782"],
+ ["eab58f", "eab4b4e18782"],
+ ["eab590", "e18480e185ad"],
+ ["eab591", "e18480e185ade186a8"],
+ ["eab591", "eab590e186a8"],
+ ["eab592", "e18480e185ade186a9"],
+ ["eab592", "eab590e186a9"],
+ ["eab593", "e18480e185ade186aa"],
+ ["eab593", "eab590e186aa"],
+ ["eab594", "e18480e185ade186ab"],
+ ["eab594", "eab590e186ab"],
+ ["eab595", "e18480e185ade186ac"],
+ ["eab595", "eab590e186ac"],
+ ["eab596", "e18480e185ade186ad"],
+ ["eab596", "eab590e186ad"],
+ ["eab597", "e18480e185ade186ae"],
+ ["eab597", "eab590e186ae"],
+ ["eab598", "e18480e185ade186af"],
+ ["eab598", "eab590e186af"],
+ ["eab599", "e18480e185ade186b0"],
+ ["eab599", "eab590e186b0"],
+ ["eab59a", "e18480e185ade186b1"],
+ ["eab59a", "eab590e186b1"],
+ ["eab59b", "e18480e185ade186b2"],
+ ["eab59b", "eab590e186b2"],
+ ["eab59c", "e18480e185ade186b3"],
+ ["eab59c", "eab590e186b3"],
+ ["eab59d", "e18480e185ade186b4"],
+ ["eab59d", "eab590e186b4"],
+ ["eab59e", "e18480e185ade186b5"],
+ ["eab59e", "eab590e186b5"],
+ ["eab59f", "e18480e185ade186b6"],
+ ["eab59f", "eab590e186b6"],
+ ["eab5a0", "e18480e185ade186b7"],
+ ["eab5a0", "eab590e186b7"],
+ ["eab5a1", "e18480e185ade186b8"],
+ ["eab5a1", "eab590e186b8"],
+ ["eab5a2", "e18480e185ade186b9"],
+ ["eab5a2", "eab590e186b9"],
+ ["eab5a3", "e18480e185ade186ba"],
+ ["eab5a3", "eab590e186ba"],
+ ["eab5a4", "e18480e185ade186bb"],
+ ["eab5a4", "eab590e186bb"],
+ ["eab5a5", "e18480e185ade186bc"],
+ ["eab5a5", "eab590e186bc"],
+ ["eab5a6", "e18480e185ade186bd"],
+ ["eab5a6", "eab590e186bd"],
+ ["eab5a7", "e18480e185ade186be"],
+ ["eab5a7", "eab590e186be"],
+ ["eab5a8", "e18480e185ade186bf"],
+ ["eab5a8", "eab590e186bf"],
+ ["eab5a9", "e18480e185ade18780"],
+ ["eab5a9", "eab590e18780"],
+ ["eab5aa", "e18480e185ade18781"],
+ ["eab5aa", "eab590e18781"],
+ ["eab5ab", "e18480e185ade18782"],
+ ["eab5ab", "eab590e18782"],
+ ["eab5ac", "e18480e185ae"],
+ ["eab5ad", "e18480e185aee186a8"],
+ ["eab5ad", "eab5ace186a8"],
+ ["eab5ae", "e18480e185aee186a9"],
+ ["eab5ae", "eab5ace186a9"],
+ ["eab5af", "e18480e185aee186aa"],
+ ["eab5af", "eab5ace186aa"],
+ ["eab5b0", "e18480e185aee186ab"],
+ ["eab5b0", "eab5ace186ab"],
+ ["eab5b1", "e18480e185aee186ac"],
+ ["eab5b1", "eab5ace186ac"],
+ ["eab5b2", "e18480e185aee186ad"],
+ ["eab5b2", "eab5ace186ad"],
+ ["eab5b3", "e18480e185aee186ae"],
+ ["eab5b3", "eab5ace186ae"],
+ ["eab5b4", "e18480e185aee186af"],
+ ["eab5b4", "eab5ace186af"],
+ ["eab5b5", "e18480e185aee186b0"],
+ ["eab5b5", "eab5ace186b0"],
+ ["eab5b6", "e18480e185aee186b1"],
+ ["eab5b6", "eab5ace186b1"],
+ ["eab5b7", "e18480e185aee186b2"],
+ ["eab5b7", "eab5ace186b2"],
+ ["eab5b8", "e18480e185aee186b3"],
+ ["eab5b8", "eab5ace186b3"],
+ ["eab5b9", "e18480e185aee186b4"],
+ ["eab5b9", "eab5ace186b4"],
+ ["eab5ba", "e18480e185aee186b5"],
+ ["eab5ba", "eab5ace186b5"],
+ ["eab5bb", "e18480e185aee186b6"],
+ ["eab5bb", "eab5ace186b6"],
+ ["eab5bc", "e18480e185aee186b7"],
+ ["eab5bc", "eab5ace186b7"],
+ ["eab5bd", "e18480e185aee186b8"],
+ ["eab5bd", "eab5ace186b8"],
+ ["eab5be", "e18480e185aee186b9"],
+ ["eab5be", "eab5ace186b9"],
+ ["eab5bf", "e18480e185aee186ba"],
+ ["eab5bf", "eab5ace186ba"],
+ ["eab680", "e18480e185aee186bb"],
+ ["eab680", "eab5ace186bb"],
+ ["eab681", "e18480e185aee186bc"],
+ ["eab681", "eab5ace186bc"],
+ ["eab682", "e18480e185aee186bd"],
+ ["eab682", "eab5ace186bd"],
+ ["eab683", "e18480e185aee186be"],
+ ["eab683", "eab5ace186be"],
+ ["eab684", "e18480e185aee186bf"],
+ ["eab684", "eab5ace186bf"],
+ ["eab685", "e18480e185aee18780"],
+ ["eab685", "eab5ace18780"],
+ ["eab686", "e18480e185aee18781"],
+ ["eab686", "eab5ace18781"],
+ ["eab687", "e18480e185aee18782"],
+ ["eab687", "eab5ace18782"],
+ ["eab688", "e18480e185af"],
+ ["eab689", "e18480e185afe186a8"],
+ ["eab689", "eab688e186a8"],
+ ["eab68a", "e18480e185afe186a9"],
+ ["eab68a", "eab688e186a9"],
+ ["eab68b", "e18480e185afe186aa"],
+ ["eab68b", "eab688e186aa"],
+ ["eab68c", "e18480e185afe186ab"],
+ ["eab68c", "eab688e186ab"],
+ ["eab68d", "e18480e185afe186ac"],
+ ["eab68d", "eab688e186ac"],
+ ["eab68e", "e18480e185afe186ad"],
+ ["eab68e", "eab688e186ad"],
+ ["eab68f", "e18480e185afe186ae"],
+ ["eab68f", "eab688e186ae"],
+ ["eab690", "e18480e185afe186af"],
+ ["eab690", "eab688e186af"],
+ ["eab691", "e18480e185afe186b0"],
+ ["eab691", "eab688e186b0"],
+ ["eab692", "e18480e185afe186b1"],
+ ["eab692", "eab688e186b1"],
+ ["eab693", "e18480e185afe186b2"],
+ ["eab693", "eab688e186b2"],
+ ["eab694", "e18480e185afe186b3"],
+ ["eab694", "eab688e186b3"],
+ ["eab695", "e18480e185afe186b4"],
+ ["eab695", "eab688e186b4"],
+ ["eab696", "e18480e185afe186b5"],
+ ["eab696", "eab688e186b5"],
+ ["eab697", "e18480e185afe186b6"],
+ ["eab697", "eab688e186b6"],
+ ["eab698", "e18480e185afe186b7"],
+ ["eab698", "eab688e186b7"],
+ ["eab699", "e18480e185afe186b8"],
+ ["eab699", "eab688e186b8"],
+ ["eab69a", "e18480e185afe186b9"],
+ ["eab69a", "eab688e186b9"],
+ ["eab69b", "e18480e185afe186ba"],
+ ["eab69b", "eab688e186ba"],
+ ["eab69c", "e18480e185afe186bb"],
+ ["eab69c", "eab688e186bb"],
+ ["eab69d", "e18480e185afe186bc"],
+ ["eab69d", "eab688e186bc"],
+ ["eab69e", "e18480e185afe186bd"],
+ ["eab69e", "eab688e186bd"],
+ ["eab69f", "e18480e185afe186be"],
+ ["eab69f", "eab688e186be"],
+ ["eab6a0", "e18480e185afe186bf"],
+ ["eab6a0", "eab688e186bf"],
+ ["eab6a1", "e18480e185afe18780"],
+ ["eab6a1", "eab688e18780"],
+ ["eab6a2", "e18480e185afe18781"],
+ ["eab6a2", "eab688e18781"],
+ ["eab6a3", "e18480e185afe18782"],
+ ["eab6a3", "eab688e18782"],
+ ["eab6a4", "e18480e185b0"],
+ ["eab6a5", "e18480e185b0e186a8"],
+ ["eab6a5", "eab6a4e186a8"],
+ ["eab6a6", "e18480e185b0e186a9"],
+ ["eab6a6", "eab6a4e186a9"],
+ ["eab6a7", "e18480e185b0e186aa"],
+ ["eab6a7", "eab6a4e186aa"],
+ ["eab6a8", "e18480e185b0e186ab"],
+ ["eab6a8", "eab6a4e186ab"],
+ ["eab6a9", "e18480e185b0e186ac"],
+ ["eab6a9", "eab6a4e186ac"],
+ ["eab6aa", "e18480e185b0e186ad"],
+ ["eab6aa", "eab6a4e186ad"],
+ ["eab6ab", "e18480e185b0e186ae"],
+ ["eab6ab", "eab6a4e186ae"],
+ ["eab6ac", "e18480e185b0e186af"],
+ ["eab6ac", "eab6a4e186af"],
+ ["eab6ad", "e18480e185b0e186b0"],
+ ["eab6ad", "eab6a4e186b0"],
+ ["eab6ae", "e18480e185b0e186b1"],
+ ["eab6ae", "eab6a4e186b1"],
+ ["eab6af", "e18480e185b0e186b2"],
+ ["eab6af", "eab6a4e186b2"],
+ ["eab6b0", "e18480e185b0e186b3"],
+ ["eab6b0", "eab6a4e186b3"],
+ ["eab6b1", "e18480e185b0e186b4"],
+ ["eab6b1", "eab6a4e186b4"],
+ ["eab6b2", "e18480e185b0e186b5"],
+ ["eab6b2", "eab6a4e186b5"],
+ ["eab6b3", "e18480e185b0e186b6"],
+ ["eab6b3", "eab6a4e186b6"],
+ ["eab6b4", "e18480e185b0e186b7"],
+ ["eab6b4", "eab6a4e186b7"],
+ ["eab6b5", "e18480e185b0e186b8"],
+ ["eab6b5", "eab6a4e186b8"],
+ ["eab6b6", "e18480e185b0e186b9"],
+ ["eab6b6", "eab6a4e186b9"],
+ ["eab6b7", "e18480e185b0e186ba"],
+ ["eab6b7", "eab6a4e186ba"],
+ ["eab6b8", "e18480e185b0e186bb"],
+ ["eab6b8", "eab6a4e186bb"],
+ ["eab6b9", "e18480e185b0e186bc"],
+ ["eab6b9", "eab6a4e186bc"],
+ ["eab6ba", "e18480e185b0e186bd"],
+ ["eab6ba", "eab6a4e186bd"],
+ ["eab6bb", "e18480e185b0e186be"],
+ ["eab6bb", "eab6a4e186be"],
+ ["eab6bc", "e18480e185b0e186bf"],
+ ["eab6bc", "eab6a4e186bf"],
+ ["eab6bd", "e18480e185b0e18780"],
+ ["eab6bd", "eab6a4e18780"],
+ ["eab6be", "e18480e185b0e18781"],
+ ["eab6be", "eab6a4e18781"],
+ ["eab6bf", "e18480e185b0e18782"],
+ ["eab6bf", "eab6a4e18782"],
+ ["eab780", "e18480e185b1"],
+ ["eab781", "e18480e185b1e186a8"],
+ ["eab781", "eab780e186a8"],
+ ["eab782", "e18480e185b1e186a9"],
+ ["eab782", "eab780e186a9"],
+ ["eab783", "e18480e185b1e186aa"],
+ ["eab783", "eab780e186aa"],
+ ["eab784", "e18480e185b1e186ab"],
+ ["eab784", "eab780e186ab"],
+ ["eab785", "e18480e185b1e186ac"],
+ ["eab785", "eab780e186ac"],
+ ["eab786", "e18480e185b1e186ad"],
+ ["eab786", "eab780e186ad"],
+ ["eab787", "e18480e185b1e186ae"],
+ ["eab787", "eab780e186ae"],
+ ["eab788", "e18480e185b1e186af"],
+ ["eab788", "eab780e186af"],
+ ["eab789", "e18480e185b1e186b0"],
+ ["eab789", "eab780e186b0"],
+ ["eab78a", "e18480e185b1e186b1"],
+ ["eab78a", "eab780e186b1"],
+ ["eab78b", "e18480e185b1e186b2"],
+ ["eab78b", "eab780e186b2"],
+ ["eab78c", "e18480e185b1e186b3"],
+ ["eab78c", "eab780e186b3"],
+ ["eab78d", "e18480e185b1e186b4"],
+ ["eab78d", "eab780e186b4"],
+ ["eab78e", "e18480e185b1e186b5"],
+ ["eab78e", "eab780e186b5"],
+ ["eab78f", "e18480e185b1e186b6"],
+ ["eab78f", "eab780e186b6"],
+ ["eab790", "e18480e185b1e186b7"],
+ ["eab790", "eab780e186b7"],
+ ["eab791", "e18480e185b1e186b8"],
+ ["eab791", "eab780e186b8"],
+ ["eab792", "e18480e185b1e186b9"],
+ ["eab792", "eab780e186b9"],
+ ["eab793", "e18480e185b1e186ba"],
+ ["eab793", "eab780e186ba"],
+ ["eab794", "e18480e185b1e186bb"],
+ ["eab794", "eab780e186bb"],
+ ["eab795", "e18480e185b1e186bc"],
+ ["eab795", "eab780e186bc"],
+ ["eab796", "e18480e185b1e186bd"],
+ ["eab796", "eab780e186bd"],
+ ["eab797", "e18480e185b1e186be"],
+ ["eab797", "eab780e186be"],
+ ["eab798", "e18480e185b1e186bf"],
+ ["eab798", "eab780e186bf"],
+ ["eab799", "e18480e185b1e18780"],
+ ["eab799", "eab780e18780"],
+ ["eab79a", "e18480e185b1e18781"],
+ ["eab79a", "eab780e18781"],
+ ["eab79b", "e18480e185b1e18782"],
+ ["eab79b", "eab780e18782"],
+ ["eab79c", "e18480e185b2"],
+ ["eab79d", "e18480e185b2e186a8"],
+ ["eab79d", "eab79ce186a8"],
+ ["eab79e", "e18480e185b2e186a9"],
+ ["eab79e", "eab79ce186a9"],
+ ["eab79f", "e18480e185b2e186aa"],
+ ["eab79f", "eab79ce186aa"],
+ ["eab7a0", "e18480e185b2e186ab"],
+ ["eab7a0", "eab79ce186ab"],
+ ["eab7a1", "e18480e185b2e186ac"],
+ ["eab7a1", "eab79ce186ac"],
+ ["eab7a2", "e18480e185b2e186ad"],
+ ["eab7a2", "eab79ce186ad"],
+ ["eab7a3", "e18480e185b2e186ae"],
+ ["eab7a3", "eab79ce186ae"],
+ ["eab7a4", "e18480e185b2e186af"],
+ ["eab7a4", "eab79ce186af"],
+ ["eab7a5", "e18480e185b2e186b0"],
+ ["eab7a5", "eab79ce186b0"],
+ ["eab7a6", "e18480e185b2e186b1"],
+ ["eab7a6", "eab79ce186b1"],
+ ["eab7a7", "e18480e185b2e186b2"],
+ ["eab7a7", "eab79ce186b2"],
+ ["eab7a8", "e18480e185b2e186b3"],
+ ["eab7a8", "eab79ce186b3"],
+ ["eab7a9", "e18480e185b2e186b4"],
+ ["eab7a9", "eab79ce186b4"],
+ ["eab7aa", "e18480e185b2e186b5"],
+ ["eab7aa", "eab79ce186b5"],
+ ["eab7ab", "e18480e185b2e186b6"],
+ ["eab7ab", "eab79ce186b6"],
+ ["eab7ac", "e18480e185b2e186b7"],
+ ["eab7ac", "eab79ce186b7"],
+ ["eab7ad", "e18480e185b2e186b8"],
+ ["eab7ad", "eab79ce186b8"],
+ ["eab7ae", "e18480e185b2e186b9"],
+ ["eab7ae", "eab79ce186b9"],
+ ["eab7af", "e18480e185b2e186ba"],
+ ["eab7af", "eab79ce186ba"],
+ ["eab7b0", "e18480e185b2e186bb"],
+ ["eab7b0", "eab79ce186bb"],
+ ["eab7b1", "e18480e185b2e186bc"],
+ ["eab7b1", "eab79ce186bc"],
+ ["eab7b2", "e18480e185b2e186bd"],
+ ["eab7b2", "eab79ce186bd"],
+ ["eab7b3", "e18480e185b2e186be"],
+ ["eab7b3", "eab79ce186be"],
+ ["eab7b4", "e18480e185b2e186bf"],
+ ["eab7b4", "eab79ce186bf"],
+ ["eab7b5", "e18480e185b2e18780"],
+ ["eab7b5", "eab79ce18780"],
+ ["eab7b6", "e18480e185b2e18781"],
+ ["eab7b6", "eab79ce18781"],
+ ["eab7b7", "e18480e185b2e18782"],
+ ["eab7b7", "eab79ce18782"],
+ ["eab7b8", "e18480e185b3"],
+ ["eab7b9", "e18480e185b3e186a8"],
+ ["eab7b9", "eab7b8e186a8"],
+ ["eab7ba", "e18480e185b3e186a9"],
+ ["eab7ba", "eab7b8e186a9"],
+ ["eab7bb", "e18480e185b3e186aa"],
+ ["eab7bb", "eab7b8e186aa"],
+ ["eab7bc", "e18480e185b3e186ab"],
+ ["eab7bc", "eab7b8e186ab"],
+ ["eab7bd", "e18480e185b3e186ac"],
+ ["eab7bd", "eab7b8e186ac"],
+ ["eab7be", "e18480e185b3e186ad"],
+ ["eab7be", "eab7b8e186ad"],
+ ["eab7bf", "e18480e185b3e186ae"],
+ ["eab7bf", "eab7b8e186ae"],
+ ["eab880", "e18480e185b3e186af"],
+ ["eab880", "eab7b8e186af"],
+ ["eab881", "e18480e185b3e186b0"],
+ ["eab881", "eab7b8e186b0"],
+ ["eab882", "e18480e185b3e186b1"],
+ ["eab882", "eab7b8e186b1"],
+ ["eab883", "e18480e185b3e186b2"],
+ ["eab883", "eab7b8e186b2"],
+ ["eab884", "e18480e185b3e186b3"],
+ ["eab884", "eab7b8e186b3"],
+ ["eab885", "e18480e185b3e186b4"],
+ ["eab885", "eab7b8e186b4"],
+ ["eab886", "e18480e185b3e186b5"],
+ ["eab886", "eab7b8e186b5"],
+ ["eab887", "e18480e185b3e186b6"],
+ ["eab887", "eab7b8e186b6"],
+ ["eab888", "e18480e185b3e186b7"],
+ ["eab888", "eab7b8e186b7"],
+ ["eab889", "e18480e185b3e186b8"],
+ ["eab889", "eab7b8e186b8"],
+ ["eab88a", "e18480e185b3e186b9"],
+ ["eab88a", "eab7b8e186b9"],
+ ["eab88b", "e18480e185b3e186ba"],
+ ["eab88b", "eab7b8e186ba"],
+ ["eab88c", "e18480e185b3e186bb"],
+ ["eab88c", "eab7b8e186bb"],
+ ["eab88d", "e18480e185b3e186bc"],
+ ["eab88d", "eab7b8e186bc"],
+ ["eab88e", "e18480e185b3e186bd"],
+ ["eab88e", "eab7b8e186bd"],
+ ["eab88f", "e18480e185b3e186be"],
+ ["eab88f", "eab7b8e186be"],
+ ["eab890", "e18480e185b3e186bf"],
+ ["eab890", "eab7b8e186bf"],
+ ["eab891", "e18480e185b3e18780"],
+ ["eab891", "eab7b8e18780"],
+ ["eab892", "e18480e185b3e18781"],
+ ["eab892", "eab7b8e18781"],
+ ["eab893", "e18480e185b3e18782"],
+ ["eab893", "eab7b8e18782"],
+ ["eab894", "e18480e185b4"],
+ ["eab895", "e18480e185b4e186a8"],
+ ["eab895", "eab894e186a8"],
+ ["eab896", "e18480e185b4e186a9"],
+ ["eab896", "eab894e186a9"],
+ ["eab897", "e18480e185b4e186aa"],
+ ["eab897", "eab894e186aa"],
+ ["eab898", "e18480e185b4e186ab"],
+ ["eab898", "eab894e186ab"],
+ ["eab899", "e18480e185b4e186ac"],
+ ["eab899", "eab894e186ac"],
+ ["eab89a", "e18480e185b4e186ad"],
+ ["eab89a", "eab894e186ad"],
+ ["eab89b", "e18480e185b4e186ae"],
+ ["eab89b", "eab894e186ae"],
+ ["eab89c", "e18480e185b4e186af"],
+ ["eab89c", "eab894e186af"],
+ ["eab89d", "e18480e185b4e186b0"],
+ ["eab89d", "eab894e186b0"],
+ ["eab89e", "e18480e185b4e186b1"],
+ ["eab89e", "eab894e186b1"],
+ ["eab89f", "e18480e185b4e186b2"],
+ ["eab89f", "eab894e186b2"],
+ ["eab8a0", "e18480e185b4e186b3"],
+ ["eab8a0", "eab894e186b3"],
+ ["eab8a1", "e18480e185b4e186b4"],
+ ["eab8a1", "eab894e186b4"],
+ ["eab8a2", "e18480e185b4e186b5"],
+ ["eab8a2", "eab894e186b5"],
+ ["eab8a3", "e18480e185b4e186b6"],
+ ["eab8a3", "eab894e186b6"],
+ ["eab8a4", "e18480e185b4e186b7"],
+ ["eab8a4", "eab894e186b7"],
+ ["eab8a5", "e18480e185b4e186b8"],
+ ["eab8a5", "eab894e186b8"],
+ ["eab8a6", "e18480e185b4e186b9"],
+ ["eab8a6", "eab894e186b9"],
+ ["eab8a7", "e18480e185b4e186ba"],
+ ["eab8a7", "eab894e186ba"],
+ ["eab8a8", "e18480e185b4e186bb"],
+ ["eab8a8", "eab894e186bb"],
+ ["eab8a9", "e18480e185b4e186bc"],
+ ["eab8a9", "eab894e186bc"],
+ ["eab8aa", "e18480e185b4e186bd"],
+ ["eab8aa", "eab894e186bd"],
+ ["eab8ab", "e18480e185b4e186be"],
+ ["eab8ab", "eab894e186be"],
+ ["eab8ac", "e18480e185b4e186bf"],
+ ["eab8ac", "eab894e186bf"],
+ ["eab8ad", "e18480e185b4e18780"],
+ ["eab8ad", "eab894e18780"],
+ ["eab8ae", "e18480e185b4e18781"],
+ ["eab8ae", "eab894e18781"],
+ ["eab8af", "e18480e185b4e18782"],
+ ["eab8af", "eab894e18782"],
+ ["eab8b0", "e18480e185b5"],
+ ["eab8b1", "e18480e185b5e186a8"],
+ ["eab8b1", "eab8b0e186a8"],
+ ["eab8b2", "e18480e185b5e186a9"],
+ ["eab8b2", "eab8b0e186a9"],
+ ["eab8b3", "e18480e185b5e186aa"],
+ ["eab8b3", "eab8b0e186aa"],
+ ["eab8b4", "e18480e185b5e186ab"],
+ ["eab8b4", "eab8b0e186ab"],
+ ["eab8b5", "e18480e185b5e186ac"],
+ ["eab8b5", "eab8b0e186ac"],
+ ["eab8b6", "e18480e185b5e186ad"],
+ ["eab8b6", "eab8b0e186ad"],
+ ["eab8b7", "e18480e185b5e186ae"],
+ ["eab8b7", "eab8b0e186ae"],
+ ["eab8b8", "e18480e185b5e186af"],
+ ["eab8b8", "eab8b0e186af"],
+ ["eab8b9", "e18480e185b5e186b0"],
+ ["eab8b9", "eab8b0e186b0"],
+ ["eab8ba", "e18480e185b5e186b1"],
+ ["eab8ba", "eab8b0e186b1"],
+ ["eab8bb", "e18480e185b5e186b2"],
+ ["eab8bb", "eab8b0e186b2"],
+ ["eab8bc", "e18480e185b5e186b3"],
+ ["eab8bc", "eab8b0e186b3"],
+ ["eab8bd", "e18480e185b5e186b4"],
+ ["eab8bd", "eab8b0e186b4"],
+ ["eab8be", "e18480e185b5e186b5"],
+ ["eab8be", "eab8b0e186b5"],
+ ["eab8bf", "e18480e185b5e186b6"],
+ ["eab8bf", "eab8b0e186b6"],
+ ["eab980", "e18480e185b5e186b7"],
+ ["eab980", "eab8b0e186b7"],
+ ["eab981", "e18480e185b5e186b8"],
+ ["eab981", "eab8b0e186b8"],
+ ["eab982", "e18480e185b5e186b9"],
+ ["eab982", "eab8b0e186b9"],
+ ["eab983", "e18480e185b5e186ba"],
+ ["eab983", "eab8b0e186ba"],
+ ["eab984", "e18480e185b5e186bb"],
+ ["eab984", "eab8b0e186bb"],
+ ["eab985", "e18480e185b5e186bc"],
+ ["eab985", "eab8b0e186bc"],
+ ["eab986", "e18480e185b5e186bd"],
+ ["eab986", "eab8b0e186bd"],
+ ["eab987", "e18480e185b5e186be"],
+ ["eab987", "eab8b0e186be"],
+ ["eab988", "e18480e185b5e186bf"],
+ ["eab988", "eab8b0e186bf"],
+ ["eab989", "e18480e185b5e18780"],
+ ["eab989", "eab8b0e18780"],
+ ["eab98a", "e18480e185b5e18781"],
+ ["eab98a", "eab8b0e18781"],
+ ["eab98b", "e18480e185b5e18782"],
+ ["eab98b", "eab8b0e18782"],
+ ["eab98c", "e18481e185a1"],
+ ["eab98d", "e18481e185a1e186a8"],
+ ["eab98d", "eab98ce186a8"],
+ ["eab98e", "e18481e185a1e186a9"],
+ ["eab98e", "eab98ce186a9"],
+ ["eab98f", "e18481e185a1e186aa"],
+ ["eab98f", "eab98ce186aa"],
+ ["eab990", "e18481e185a1e186ab"],
+ ["eab990", "eab98ce186ab"],
+ ["eab991", "e18481e185a1e186ac"],
+ ["eab991", "eab98ce186ac"],
+ ["eab992", "e18481e185a1e186ad"],
+ ["eab992", "eab98ce186ad"],
+ ["eab993", "e18481e185a1e186ae"],
+ ["eab993", "eab98ce186ae"],
+ ["eab994", "e18481e185a1e186af"],
+ ["eab994", "eab98ce186af"],
+ ["eab995", "e18481e185a1e186b0"],
+ ["eab995", "eab98ce186b0"],
+ ["eab996", "e18481e185a1e186b1"],
+ ["eab996", "eab98ce186b1"],
+ ["eab997", "e18481e185a1e186b2"],
+ ["eab997", "eab98ce186b2"],
+ ["eab998", "e18481e185a1e186b3"],
+ ["eab998", "eab98ce186b3"],
+ ["eab999", "e18481e185a1e186b4"],
+ ["eab999", "eab98ce186b4"],
+ ["eab99a", "e18481e185a1e186b5"],
+ ["eab99a", "eab98ce186b5"],
+ ["eab99b", "e18481e185a1e186b6"],
+ ["eab99b", "eab98ce186b6"],
+ ["eab99c", "e18481e185a1e186b7"],
+ ["eab99c", "eab98ce186b7"],
+ ["eab99d", "e18481e185a1e186b8"],
+ ["eab99d", "eab98ce186b8"],
+ ["eab99e", "e18481e185a1e186b9"],
+ ["eab99e", "eab98ce186b9"],
+ ["eab99f", "e18481e185a1e186ba"],
+ ["eab99f", "eab98ce186ba"],
+ ["eab9a0", "e18481e185a1e186bb"],
+ ["eab9a0", "eab98ce186bb"],
+ ["eab9a1", "e18481e185a1e186bc"],
+ ["eab9a1", "eab98ce186bc"],
+ ["eab9a2", "e18481e185a1e186bd"],
+ ["eab9a2", "eab98ce186bd"],
+ ["eab9a3", "e18481e185a1e186be"],
+ ["eab9a3", "eab98ce186be"],
+ ["eab9a4", "e18481e185a1e186bf"],
+ ["eab9a4", "eab98ce186bf"],
+ ["eab9a5", "e18481e185a1e18780"],
+ ["eab9a5", "eab98ce18780"],
+ ["eab9a6", "e18481e185a1e18781"],
+ ["eab9a6", "eab98ce18781"],
+ ["eab9a7", "e18481e185a1e18782"],
+ ["eab9a7", "eab98ce18782"],
+ ["eab9a8", "e18481e185a2"],
+ ["eab9a9", "e18481e185a2e186a8"],
+ ["eab9a9", "eab9a8e186a8"],
+ ["eab9aa", "e18481e185a2e186a9"],
+ ["eab9aa", "eab9a8e186a9"],
+ ["eab9ab", "e18481e185a2e186aa"],
+ ["eab9ab", "eab9a8e186aa"],
+ ["eab9ac", "e18481e185a2e186ab"],
+ ["eab9ac", "eab9a8e186ab"],
+ ["eab9ad", "e18481e185a2e186ac"],
+ ["eab9ad", "eab9a8e186ac"],
+ ["eab9ae", "e18481e185a2e186ad"],
+ ["eab9ae", "eab9a8e186ad"],
+ ["eab9af", "e18481e185a2e186ae"],
+ ["eab9af", "eab9a8e186ae"],
+ ["eab9b0", "e18481e185a2e186af"],
+ ["eab9b0", "eab9a8e186af"],
+ ["eab9b1", "e18481e185a2e186b0"],
+ ["eab9b1", "eab9a8e186b0"],
+ ["eab9b2", "e18481e185a2e186b1"],
+ ["eab9b2", "eab9a8e186b1"],
+ ["eab9b3", "e18481e185a2e186b2"],
+ ["eab9b3", "eab9a8e186b2"],
+ ["eab9b4", "e18481e185a2e186b3"],
+ ["eab9b4", "eab9a8e186b3"],
+ ["eab9b5", "e18481e185a2e186b4"],
+ ["eab9b5", "eab9a8e186b4"],
+ ["eab9b6", "e18481e185a2e186b5"],
+ ["eab9b6", "eab9a8e186b5"],
+ ["eab9b7", "e18481e185a2e186b6"],
+ ["eab9b7", "eab9a8e186b6"],
+ ["eab9b8", "e18481e185a2e186b7"],
+ ["eab9b8", "eab9a8e186b7"],
+ ["eab9b9", "e18481e185a2e186b8"],
+ ["eab9b9", "eab9a8e186b8"],
+ ["eab9ba", "e18481e185a2e186b9"],
+ ["eab9ba", "eab9a8e186b9"],
+ ["eab9bb", "e18481e185a2e186ba"],
+ ["eab9bb", "eab9a8e186ba"],
+ ["eab9bc", "e18481e185a2e186bb"],
+ ["eab9bc", "eab9a8e186bb"],
+ ["eab9bd", "e18481e185a2e186bc"],
+ ["eab9bd", "eab9a8e186bc"],
+ ["eab9be", "e18481e185a2e186bd"],
+ ["eab9be", "eab9a8e186bd"],
+ ["eab9bf", "e18481e185a2e186be"],
+ ["eab9bf", "eab9a8e186be"],
+ ["eaba80", "e18481e185a2e186bf"],
+ ["eaba80", "eab9a8e186bf"],
+ ["eaba81", "e18481e185a2e18780"],
+ ["eaba81", "eab9a8e18780"],
+ ["eaba82", "e18481e185a2e18781"],
+ ["eaba82", "eab9a8e18781"],
+ ["eaba83", "e18481e185a2e18782"],
+ ["eaba83", "eab9a8e18782"],
+ ["eaba84", "e18481e185a3"],
+ ["eaba85", "e18481e185a3e186a8"],
+ ["eaba85", "eaba84e186a8"],
+ ["eaba86", "e18481e185a3e186a9"],
+ ["eaba86", "eaba84e186a9"],
+ ["eaba87", "e18481e185a3e186aa"],
+ ["eaba87", "eaba84e186aa"],
+ ["eaba88", "e18481e185a3e186ab"],
+ ["eaba88", "eaba84e186ab"],
+ ["eaba89", "e18481e185a3e186ac"],
+ ["eaba89", "eaba84e186ac"],
+ ["eaba8a", "e18481e185a3e186ad"],
+ ["eaba8a", "eaba84e186ad"],
+ ["eaba8b", "e18481e185a3e186ae"],
+ ["eaba8b", "eaba84e186ae"],
+ ["eaba8c", "e18481e185a3e186af"],
+ ["eaba8c", "eaba84e186af"],
+ ["eaba8d", "e18481e185a3e186b0"],
+ ["eaba8d", "eaba84e186b0"],
+ ["eaba8e", "e18481e185a3e186b1"],
+ ["eaba8e", "eaba84e186b1"],
+ ["eaba8f", "e18481e185a3e186b2"],
+ ["eaba8f", "eaba84e186b2"],
+ ["eaba90", "e18481e185a3e186b3"],
+ ["eaba90", "eaba84e186b3"],
+ ["eaba91", "e18481e185a3e186b4"],
+ ["eaba91", "eaba84e186b4"],
+ ["eaba92", "e18481e185a3e186b5"],
+ ["eaba92", "eaba84e186b5"],
+ ["eaba93", "e18481e185a3e186b6"],
+ ["eaba93", "eaba84e186b6"],
+ ["eaba94", "e18481e185a3e186b7"],
+ ["eaba94", "eaba84e186b7"],
+ ["eaba95", "e18481e185a3e186b8"],
+ ["eaba95", "eaba84e186b8"],
+ ["eaba96", "e18481e185a3e186b9"],
+ ["eaba96", "eaba84e186b9"],
+ ["eaba97", "e18481e185a3e186ba"],
+ ["eaba97", "eaba84e186ba"],
+ ["eaba98", "e18481e185a3e186bb"],
+ ["eaba98", "eaba84e186bb"],
+ ["eaba99", "e18481e185a3e186bc"],
+ ["eaba99", "eaba84e186bc"],
+ ["eaba9a", "e18481e185a3e186bd"],
+ ["eaba9a", "eaba84e186bd"],
+ ["eaba9b", "e18481e185a3e186be"],
+ ["eaba9b", "eaba84e186be"],
+ ["eaba9c", "e18481e185a3e186bf"],
+ ["eaba9c", "eaba84e186bf"],
+ ["eaba9d", "e18481e185a3e18780"],
+ ["eaba9d", "eaba84e18780"],
+ ["eaba9e", "e18481e185a3e18781"],
+ ["eaba9e", "eaba84e18781"],
+ ["eaba9f", "e18481e185a3e18782"],
+ ["eaba9f", "eaba84e18782"],
+ ["eabaa0", "e18481e185a4"],
+ ["eabaa1", "e18481e185a4e186a8"],
+ ["eabaa1", "eabaa0e186a8"],
+ ["eabaa2", "e18481e185a4e186a9"],
+ ["eabaa2", "eabaa0e186a9"],
+ ["eabaa3", "e18481e185a4e186aa"],
+ ["eabaa3", "eabaa0e186aa"],
+ ["eabaa4", "e18481e185a4e186ab"],
+ ["eabaa4", "eabaa0e186ab"],
+ ["eabaa5", "e18481e185a4e186ac"],
+ ["eabaa5", "eabaa0e186ac"],
+ ["eabaa6", "e18481e185a4e186ad"],
+ ["eabaa6", "eabaa0e186ad"],
+ ["eabaa7", "e18481e185a4e186ae"],
+ ["eabaa7", "eabaa0e186ae"],
+ ["eabaa8", "e18481e185a4e186af"],
+ ["eabaa8", "eabaa0e186af"],
+ ["eabaa9", "e18481e185a4e186b0"],
+ ["eabaa9", "eabaa0e186b0"],
+ ["eabaaa", "e18481e185a4e186b1"],
+ ["eabaaa", "eabaa0e186b1"],
+ ["eabaab", "e18481e185a4e186b2"],
+ ["eabaab", "eabaa0e186b2"],
+ ["eabaac", "e18481e185a4e186b3"],
+ ["eabaac", "eabaa0e186b3"],
+ ["eabaad", "e18481e185a4e186b4"],
+ ["eabaad", "eabaa0e186b4"],
+ ["eabaae", "e18481e185a4e186b5"],
+ ["eabaae", "eabaa0e186b5"],
+ ["eabaaf", "e18481e185a4e186b6"],
+ ["eabaaf", "eabaa0e186b6"],
+ ["eabab0", "e18481e185a4e186b7"],
+ ["eabab0", "eabaa0e186b7"],
+ ["eabab1", "e18481e185a4e186b8"],
+ ["eabab1", "eabaa0e186b8"],
+ ["eabab2", "e18481e185a4e186b9"],
+ ["eabab2", "eabaa0e186b9"],
+ ["eabab3", "e18481e185a4e186ba"],
+ ["eabab3", "eabaa0e186ba"],
+ ["eabab4", "e18481e185a4e186bb"],
+ ["eabab4", "eabaa0e186bb"],
+ ["eabab5", "e18481e185a4e186bc"],
+ ["eabab5", "eabaa0e186bc"],
+ ["eabab6", "e18481e185a4e186bd"],
+ ["eabab6", "eabaa0e186bd"],
+ ["eabab7", "e18481e185a4e186be"],
+ ["eabab7", "eabaa0e186be"],
+ ["eabab8", "e18481e185a4e186bf"],
+ ["eabab8", "eabaa0e186bf"],
+ ["eabab9", "e18481e185a4e18780"],
+ ["eabab9", "eabaa0e18780"],
+ ["eababa", "e18481e185a4e18781"],
+ ["eababa", "eabaa0e18781"],
+ ["eababb", "e18481e185a4e18782"],
+ ["eababb", "eabaa0e18782"],
+ ["eababc", "e18481e185a5"],
+ ["eababd", "e18481e185a5e186a8"],
+ ["eababd", "eababce186a8"],
+ ["eababe", "e18481e185a5e186a9"],
+ ["eababe", "eababce186a9"],
+ ["eababf", "e18481e185a5e186aa"],
+ ["eababf", "eababce186aa"],
+ ["eabb80", "e18481e185a5e186ab"],
+ ["eabb80", "eababce186ab"],
+ ["eabb81", "e18481e185a5e186ac"],
+ ["eabb81", "eababce186ac"],
+ ["eabb82", "e18481e185a5e186ad"],
+ ["eabb82", "eababce186ad"],
+ ["eabb83", "e18481e185a5e186ae"],
+ ["eabb83", "eababce186ae"],
+ ["eabb84", "e18481e185a5e186af"],
+ ["eabb84", "eababce186af"],
+ ["eabb85", "e18481e185a5e186b0"],
+ ["eabb85", "eababce186b0"],
+ ["eabb86", "e18481e185a5e186b1"],
+ ["eabb86", "eababce186b1"],
+ ["eabb87", "e18481e185a5e186b2"],
+ ["eabb87", "eababce186b2"],
+ ["eabb88", "e18481e185a5e186b3"],
+ ["eabb88", "eababce186b3"],
+ ["eabb89", "e18481e185a5e186b4"],
+ ["eabb89", "eababce186b4"],
+ ["eabb8a", "e18481e185a5e186b5"],
+ ["eabb8a", "eababce186b5"],
+ ["eabb8b", "e18481e185a5e186b6"],
+ ["eabb8b", "eababce186b6"],
+ ["eabb8c", "e18481e185a5e186b7"],
+ ["eabb8c", "eababce186b7"],
+ ["eabb8d", "e18481e185a5e186b8"],
+ ["eabb8d", "eababce186b8"],
+ ["eabb8e", "e18481e185a5e186b9"],
+ ["eabb8e", "eababce186b9"],
+ ["eabb8f", "e18481e185a5e186ba"],
+ ["eabb8f", "eababce186ba"],
+ ["eabb90", "e18481e185a5e186bb"],
+ ["eabb90", "eababce186bb"],
+ ["eabb91", "e18481e185a5e186bc"],
+ ["eabb91", "eababce186bc"],
+ ["eabb92", "e18481e185a5e186bd"],
+ ["eabb92", "eababce186bd"],
+ ["eabb93", "e18481e185a5e186be"],
+ ["eabb93", "eababce186be"],
+ ["eabb94", "e18481e185a5e186bf"],
+ ["eabb94", "eababce186bf"],
+ ["eabb95", "e18481e185a5e18780"],
+ ["eabb95", "eababce18780"],
+ ["eabb96", "e18481e185a5e18781"],
+ ["eabb96", "eababce18781"],
+ ["eabb97", "e18481e185a5e18782"],
+ ["eabb97", "eababce18782"],
+ ["eabb98", "e18481e185a6"],
+ ["eabb99", "e18481e185a6e186a8"],
+ ["eabb99", "eabb98e186a8"],
+ ["eabb9a", "e18481e185a6e186a9"],
+ ["eabb9a", "eabb98e186a9"],
+ ["eabb9b", "e18481e185a6e186aa"],
+ ["eabb9b", "eabb98e186aa"],
+ ["eabb9c", "e18481e185a6e186ab"],
+ ["eabb9c", "eabb98e186ab"],
+ ["eabb9d", "e18481e185a6e186ac"],
+ ["eabb9d", "eabb98e186ac"],
+ ["eabb9e", "e18481e185a6e186ad"],
+ ["eabb9e", "eabb98e186ad"],
+ ["eabb9f", "e18481e185a6e186ae"],
+ ["eabb9f", "eabb98e186ae"],
+ ["eabba0", "e18481e185a6e186af"],
+ ["eabba0", "eabb98e186af"],
+ ["eabba1", "e18481e185a6e186b0"],
+ ["eabba1", "eabb98e186b0"],
+ ["eabba2", "e18481e185a6e186b1"],
+ ["eabba2", "eabb98e186b1"],
+ ["eabba3", "e18481e185a6e186b2"],
+ ["eabba3", "eabb98e186b2"],
+ ["eabba4", "e18481e185a6e186b3"],
+ ["eabba4", "eabb98e186b3"],
+ ["eabba5", "e18481e185a6e186b4"],
+ ["eabba5", "eabb98e186b4"],
+ ["eabba6", "e18481e185a6e186b5"],
+ ["eabba6", "eabb98e186b5"],
+ ["eabba7", "e18481e185a6e186b6"],
+ ["eabba7", "eabb98e186b6"],
+ ["eabba8", "e18481e185a6e186b7"],
+ ["eabba8", "eabb98e186b7"],
+ ["eabba9", "e18481e185a6e186b8"],
+ ["eabba9", "eabb98e186b8"],
+ ["eabbaa", "e18481e185a6e186b9"],
+ ["eabbaa", "eabb98e186b9"],
+ ["eabbab", "e18481e185a6e186ba"],
+ ["eabbab", "eabb98e186ba"],
+ ["eabbac", "e18481e185a6e186bb"],
+ ["eabbac", "eabb98e186bb"],
+ ["eabbad", "e18481e185a6e186bc"],
+ ["eabbad", "eabb98e186bc"],
+ ["eabbae", "e18481e185a6e186bd"],
+ ["eabbae", "eabb98e186bd"],
+ ["eabbaf", "e18481e185a6e186be"],
+ ["eabbaf", "eabb98e186be"],
+ ["eabbb0", "e18481e185a6e186bf"],
+ ["eabbb0", "eabb98e186bf"],
+ ["eabbb1", "e18481e185a6e18780"],
+ ["eabbb1", "eabb98e18780"],
+ ["eabbb2", "e18481e185a6e18781"],
+ ["eabbb2", "eabb98e18781"],
+ ["eabbb3", "e18481e185a6e18782"],
+ ["eabbb3", "eabb98e18782"],
+ ["eabbb4", "e18481e185a7"],
+ ["eabbb5", "e18481e185a7e186a8"],
+ ["eabbb5", "eabbb4e186a8"],
+ ["eabbb6", "e18481e185a7e186a9"],
+ ["eabbb6", "eabbb4e186a9"],
+ ["eabbb7", "e18481e185a7e186aa"],
+ ["eabbb7", "eabbb4e186aa"],
+ ["eabbb8", "e18481e185a7e186ab"],
+ ["eabbb8", "eabbb4e186ab"],
+ ["eabbb9", "e18481e185a7e186ac"],
+ ["eabbb9", "eabbb4e186ac"],
+ ["eabbba", "e18481e185a7e186ad"],
+ ["eabbba", "eabbb4e186ad"],
+ ["eabbbb", "e18481e185a7e186ae"],
+ ["eabbbb", "eabbb4e186ae"],
+ ["eabbbc", "e18481e185a7e186af"],
+ ["eabbbc", "eabbb4e186af"],
+ ["eabbbd", "e18481e185a7e186b0"],
+ ["eabbbd", "eabbb4e186b0"],
+ ["eabbbe", "e18481e185a7e186b1"],
+ ["eabbbe", "eabbb4e186b1"],
+ ["eabbbf", "e18481e185a7e186b2"],
+ ["eabbbf", "eabbb4e186b2"],
+ ["eabc80", "e18481e185a7e186b3"],
+ ["eabc80", "eabbb4e186b3"],
+ ["eabc81", "e18481e185a7e186b4"],
+ ["eabc81", "eabbb4e186b4"],
+ ["eabc82", "e18481e185a7e186b5"],
+ ["eabc82", "eabbb4e186b5"],
+ ["eabc83", "e18481e185a7e186b6"],
+ ["eabc83", "eabbb4e186b6"],
+ ["eabc84", "e18481e185a7e186b7"],
+ ["eabc84", "eabbb4e186b7"],
+ ["eabc85", "e18481e185a7e186b8"],
+ ["eabc85", "eabbb4e186b8"],
+ ["eabc86", "e18481e185a7e186b9"],
+ ["eabc86", "eabbb4e186b9"],
+ ["eabc87", "e18481e185a7e186ba"],
+ ["eabc87", "eabbb4e186ba"],
+ ["eabc88", "e18481e185a7e186bb"],
+ ["eabc88", "eabbb4e186bb"],
+ ["eabc89", "e18481e185a7e186bc"],
+ ["eabc89", "eabbb4e186bc"],
+ ["eabc8a", "e18481e185a7e186bd"],
+ ["eabc8a", "eabbb4e186bd"],
+ ["eabc8b", "e18481e185a7e186be"],
+ ["eabc8b", "eabbb4e186be"],
+ ["eabc8c", "e18481e185a7e186bf"],
+ ["eabc8c", "eabbb4e186bf"],
+ ["eabc8d", "e18481e185a7e18780"],
+ ["eabc8d", "eabbb4e18780"],
+ ["eabc8e", "e18481e185a7e18781"],
+ ["eabc8e", "eabbb4e18781"],
+ ["eabc8f", "e18481e185a7e18782"],
+ ["eabc8f", "eabbb4e18782"],
+ ["eabc90", "e18481e185a8"],
+ ["eabc91", "e18481e185a8e186a8"],
+ ["eabc91", "eabc90e186a8"],
+ ["eabc92", "e18481e185a8e186a9"],
+ ["eabc92", "eabc90e186a9"],
+ ["eabc93", "e18481e185a8e186aa"],
+ ["eabc93", "eabc90e186aa"],
+ ["eabc94", "e18481e185a8e186ab"],
+ ["eabc94", "eabc90e186ab"],
+ ["eabc95", "e18481e185a8e186ac"],
+ ["eabc95", "eabc90e186ac"],
+ ["eabc96", "e18481e185a8e186ad"],
+ ["eabc96", "eabc90e186ad"],
+ ["eabc97", "e18481e185a8e186ae"],
+ ["eabc97", "eabc90e186ae"],
+ ["eabc98", "e18481e185a8e186af"],
+ ["eabc98", "eabc90e186af"],
+ ["eabc99", "e18481e185a8e186b0"],
+ ["eabc99", "eabc90e186b0"],
+ ["eabc9a", "e18481e185a8e186b1"],
+ ["eabc9a", "eabc90e186b1"],
+ ["eabc9b", "e18481e185a8e186b2"],
+ ["eabc9b", "eabc90e186b2"],
+ ["eabc9c", "e18481e185a8e186b3"],
+ ["eabc9c", "eabc90e186b3"],
+ ["eabc9d", "e18481e185a8e186b4"],
+ ["eabc9d", "eabc90e186b4"],
+ ["eabc9e", "e18481e185a8e186b5"],
+ ["eabc9e", "eabc90e186b5"],
+ ["eabc9f", "e18481e185a8e186b6"],
+ ["eabc9f", "eabc90e186b6"],
+ ["eabca0", "e18481e185a8e186b7"],
+ ["eabca0", "eabc90e186b7"],
+ ["eabca1", "e18481e185a8e186b8"],
+ ["eabca1", "eabc90e186b8"],
+ ["eabca2", "e18481e185a8e186b9"],
+ ["eabca2", "eabc90e186b9"],
+ ["eabca3", "e18481e185a8e186ba"],
+ ["eabca3", "eabc90e186ba"],
+ ["eabca4", "e18481e185a8e186bb"],
+ ["eabca4", "eabc90e186bb"],
+ ["eabca5", "e18481e185a8e186bc"],
+ ["eabca5", "eabc90e186bc"],
+ ["eabca6", "e18481e185a8e186bd"],
+ ["eabca6", "eabc90e186bd"],
+ ["eabca7", "e18481e185a8e186be"],
+ ["eabca7", "eabc90e186be"],
+ ["eabca8", "e18481e185a8e186bf"],
+ ["eabca8", "eabc90e186bf"],
+ ["eabca9", "e18481e185a8e18780"],
+ ["eabca9", "eabc90e18780"],
+ ["eabcaa", "e18481e185a8e18781"],
+ ["eabcaa", "eabc90e18781"],
+ ["eabcab", "e18481e185a8e18782"],
+ ["eabcab", "eabc90e18782"],
+ ["eabcac", "e18481e185a9"],
+ ["eabcad", "e18481e185a9e186a8"],
+ ["eabcad", "eabcace186a8"],
+ ["eabcae", "e18481e185a9e186a9"],
+ ["eabcae", "eabcace186a9"],
+ ["eabcaf", "e18481e185a9e186aa"],
+ ["eabcaf", "eabcace186aa"],
+ ["eabcb0", "e18481e185a9e186ab"],
+ ["eabcb0", "eabcace186ab"],
+ ["eabcb1", "e18481e185a9e186ac"],
+ ["eabcb1", "eabcace186ac"],
+ ["eabcb2", "e18481e185a9e186ad"],
+ ["eabcb2", "eabcace186ad"],
+ ["eabcb3", "e18481e185a9e186ae"],
+ ["eabcb3", "eabcace186ae"],
+ ["eabcb4", "e18481e185a9e186af"],
+ ["eabcb4", "eabcace186af"],
+ ["eabcb5", "e18481e185a9e186b0"],
+ ["eabcb5", "eabcace186b0"],
+ ["eabcb6", "e18481e185a9e186b1"],
+ ["eabcb6", "eabcace186b1"],
+ ["eabcb7", "e18481e185a9e186b2"],
+ ["eabcb7", "eabcace186b2"],
+ ["eabcb8", "e18481e185a9e186b3"],
+ ["eabcb8", "eabcace186b3"],
+ ["eabcb9", "e18481e185a9e186b4"],
+ ["eabcb9", "eabcace186b4"],
+ ["eabcba", "e18481e185a9e186b5"],
+ ["eabcba", "eabcace186b5"],
+ ["eabcbb", "e18481e185a9e186b6"],
+ ["eabcbb", "eabcace186b6"],
+ ["eabcbc", "e18481e185a9e186b7"],
+ ["eabcbc", "eabcace186b7"],
+ ["eabcbd", "e18481e185a9e186b8"],
+ ["eabcbd", "eabcace186b8"],
+ ["eabcbe", "e18481e185a9e186b9"],
+ ["eabcbe", "eabcace186b9"],
+ ["eabcbf", "e18481e185a9e186ba"],
+ ["eabcbf", "eabcace186ba"],
+ ["eabd80", "e18481e185a9e186bb"],
+ ["eabd80", "eabcace186bb"],
+ ["eabd81", "e18481e185a9e186bc"],
+ ["eabd81", "eabcace186bc"],
+ ["eabd82", "e18481e185a9e186bd"],
+ ["eabd82", "eabcace186bd"],
+ ["eabd83", "e18481e185a9e186be"],
+ ["eabd83", "eabcace186be"],
+ ["eabd84", "e18481e185a9e186bf"],
+ ["eabd84", "eabcace186bf"],
+ ["eabd85", "e18481e185a9e18780"],
+ ["eabd85", "eabcace18780"],
+ ["eabd86", "e18481e185a9e18781"],
+ ["eabd86", "eabcace18781"],
+ ["eabd87", "e18481e185a9e18782"],
+ ["eabd87", "eabcace18782"],
+ ["eabd88", "e18481e185aa"],
+ ["eabd89", "e18481e185aae186a8"],
+ ["eabd89", "eabd88e186a8"],
+ ["eabd8a", "e18481e185aae186a9"],
+ ["eabd8a", "eabd88e186a9"],
+ ["eabd8b", "e18481e185aae186aa"],
+ ["eabd8b", "eabd88e186aa"],
+ ["eabd8c", "e18481e185aae186ab"],
+ ["eabd8c", "eabd88e186ab"],
+ ["eabd8d", "e18481e185aae186ac"],
+ ["eabd8d", "eabd88e186ac"],
+ ["eabd8e", "e18481e185aae186ad"],
+ ["eabd8e", "eabd88e186ad"],
+ ["eabd8f", "e18481e185aae186ae"],
+ ["eabd8f", "eabd88e186ae"],
+ ["eabd90", "e18481e185aae186af"],
+ ["eabd90", "eabd88e186af"],
+ ["eabd91", "e18481e185aae186b0"],
+ ["eabd91", "eabd88e186b0"],
+ ["eabd92", "e18481e185aae186b1"],
+ ["eabd92", "eabd88e186b1"],
+ ["eabd93", "e18481e185aae186b2"],
+ ["eabd93", "eabd88e186b2"],
+ ["eabd94", "e18481e185aae186b3"],
+ ["eabd94", "eabd88e186b3"],
+ ["eabd95", "e18481e185aae186b4"],
+ ["eabd95", "eabd88e186b4"],
+ ["eabd96", "e18481e185aae186b5"],
+ ["eabd96", "eabd88e186b5"],
+ ["eabd97", "e18481e185aae186b6"],
+ ["eabd97", "eabd88e186b6"],
+ ["eabd98", "e18481e185aae186b7"],
+ ["eabd98", "eabd88e186b7"],
+ ["eabd99", "e18481e185aae186b8"],
+ ["eabd99", "eabd88e186b8"],
+ ["eabd9a", "e18481e185aae186b9"],
+ ["eabd9a", "eabd88e186b9"],
+ ["eabd9b", "e18481e185aae186ba"],
+ ["eabd9b", "eabd88e186ba"],
+ ["eabd9c", "e18481e185aae186bb"],
+ ["eabd9c", "eabd88e186bb"],
+ ["eabd9d", "e18481e185aae186bc"],
+ ["eabd9d", "eabd88e186bc"],
+ ["eabd9e", "e18481e185aae186bd"],
+ ["eabd9e", "eabd88e186bd"],
+ ["eabd9f", "e18481e185aae186be"],
+ ["eabd9f", "eabd88e186be"],
+ ["eabda0", "e18481e185aae186bf"],
+ ["eabda0", "eabd88e186bf"],
+ ["eabda1", "e18481e185aae18780"],
+ ["eabda1", "eabd88e18780"],
+ ["eabda2", "e18481e185aae18781"],
+ ["eabda2", "eabd88e18781"],
+ ["eabda3", "e18481e185aae18782"],
+ ["eabda3", "eabd88e18782"],
+ ["eabda4", "e18481e185ab"],
+ ["eabda5", "e18481e185abe186a8"],
+ ["eabda5", "eabda4e186a8"],
+ ["eabda6", "e18481e185abe186a9"],
+ ["eabda6", "eabda4e186a9"],
+ ["eabda7", "e18481e185abe186aa"],
+ ["eabda7", "eabda4e186aa"],
+ ["eabda8", "e18481e185abe186ab"],
+ ["eabda8", "eabda4e186ab"],
+ ["eabda9", "e18481e185abe186ac"],
+ ["eabda9", "eabda4e186ac"],
+ ["eabdaa", "e18481e185abe186ad"],
+ ["eabdaa", "eabda4e186ad"],
+ ["eabdab", "e18481e185abe186ae"],
+ ["eabdab", "eabda4e186ae"],
+ ["eabdac", "e18481e185abe186af"],
+ ["eabdac", "eabda4e186af"],
+ ["eabdad", "e18481e185abe186b0"],
+ ["eabdad", "eabda4e186b0"],
+ ["eabdae", "e18481e185abe186b1"],
+ ["eabdae", "eabda4e186b1"],
+ ["eabdaf", "e18481e185abe186b2"],
+ ["eabdaf", "eabda4e186b2"],
+ ["eabdb0", "e18481e185abe186b3"],
+ ["eabdb0", "eabda4e186b3"],
+ ["eabdb1", "e18481e185abe186b4"],
+ ["eabdb1", "eabda4e186b4"],
+ ["eabdb2", "e18481e185abe186b5"],
+ ["eabdb2", "eabda4e186b5"],
+ ["eabdb3", "e18481e185abe186b6"],
+ ["eabdb3", "eabda4e186b6"],
+ ["eabdb4", "e18481e185abe186b7"],
+ ["eabdb4", "eabda4e186b7"],
+ ["eabdb5", "e18481e185abe186b8"],
+ ["eabdb5", "eabda4e186b8"],
+ ["eabdb6", "e18481e185abe186b9"],
+ ["eabdb6", "eabda4e186b9"],
+ ["eabdb7", "e18481e185abe186ba"],
+ ["eabdb7", "eabda4e186ba"],
+ ["eabdb8", "e18481e185abe186bb"],
+ ["eabdb8", "eabda4e186bb"],
+ ["eabdb9", "e18481e185abe186bc"],
+ ["eabdb9", "eabda4e186bc"],
+ ["eabdba", "e18481e185abe186bd"],
+ ["eabdba", "eabda4e186bd"],
+ ["eabdbb", "e18481e185abe186be"],
+ ["eabdbb", "eabda4e186be"],
+ ["eabdbc", "e18481e185abe186bf"],
+ ["eabdbc", "eabda4e186bf"],
+ ["eabdbd", "e18481e185abe18780"],
+ ["eabdbd", "eabda4e18780"],
+ ["eabdbe", "e18481e185abe18781"],
+ ["eabdbe", "eabda4e18781"],
+ ["eabdbf", "e18481e185abe18782"],
+ ["eabdbf", "eabda4e18782"],
+ ["eabe80", "e18481e185ac"],
+ ["eabe81", "e18481e185ace186a8"],
+ ["eabe81", "eabe80e186a8"],
+ ["eabe82", "e18481e185ace186a9"],
+ ["eabe82", "eabe80e186a9"],
+ ["eabe83", "e18481e185ace186aa"],
+ ["eabe83", "eabe80e186aa"],
+ ["eabe84", "e18481e185ace186ab"],
+ ["eabe84", "eabe80e186ab"],
+ ["eabe85", "e18481e185ace186ac"],
+ ["eabe85", "eabe80e186ac"],
+ ["eabe86", "e18481e185ace186ad"],
+ ["eabe86", "eabe80e186ad"],
+ ["eabe87", "e18481e185ace186ae"],
+ ["eabe87", "eabe80e186ae"],
+ ["eabe88", "e18481e185ace186af"],
+ ["eabe88", "eabe80e186af"],
+ ["eabe89", "e18481e185ace186b0"],
+ ["eabe89", "eabe80e186b0"],
+ ["eabe8a", "e18481e185ace186b1"],
+ ["eabe8a", "eabe80e186b1"],
+ ["eabe8b", "e18481e185ace186b2"],
+ ["eabe8b", "eabe80e186b2"],
+ ["eabe8c", "e18481e185ace186b3"],
+ ["eabe8c", "eabe80e186b3"],
+ ["eabe8d", "e18481e185ace186b4"],
+ ["eabe8d", "eabe80e186b4"],
+ ["eabe8e", "e18481e185ace186b5"],
+ ["eabe8e", "eabe80e186b5"],
+ ["eabe8f", "e18481e185ace186b6"],
+ ["eabe8f", "eabe80e186b6"],
+ ["eabe90", "e18481e185ace186b7"],
+ ["eabe90", "eabe80e186b7"],
+ ["eabe91", "e18481e185ace186b8"],
+ ["eabe91", "eabe80e186b8"],
+ ["eabe92", "e18481e185ace186b9"],
+ ["eabe92", "eabe80e186b9"],
+ ["eabe93", "e18481e185ace186ba"],
+ ["eabe93", "eabe80e186ba"],
+ ["eabe94", "e18481e185ace186bb"],
+ ["eabe94", "eabe80e186bb"],
+ ["eabe95", "e18481e185ace186bc"],
+ ["eabe95", "eabe80e186bc"],
+ ["eabe96", "e18481e185ace186bd"],
+ ["eabe96", "eabe80e186bd"],
+ ["eabe97", "e18481e185ace186be"],
+ ["eabe97", "eabe80e186be"],
+ ["eabe98", "e18481e185ace186bf"],
+ ["eabe98", "eabe80e186bf"],
+ ["eabe99", "e18481e185ace18780"],
+ ["eabe99", "eabe80e18780"],
+ ["eabe9a", "e18481e185ace18781"],
+ ["eabe9a", "eabe80e18781"],
+ ["eabe9b", "e18481e185ace18782"],
+ ["eabe9b", "eabe80e18782"],
+ ["eabe9c", "e18481e185ad"],
+ ["eabe9d", "e18481e185ade186a8"],
+ ["eabe9d", "eabe9ce186a8"],
+ ["eabe9e", "e18481e185ade186a9"],
+ ["eabe9e", "eabe9ce186a9"],
+ ["eabe9f", "e18481e185ade186aa"],
+ ["eabe9f", "eabe9ce186aa"],
+ ["eabea0", "e18481e185ade186ab"],
+ ["eabea0", "eabe9ce186ab"],
+ ["eabea1", "e18481e185ade186ac"],
+ ["eabea1", "eabe9ce186ac"],
+ ["eabea2", "e18481e185ade186ad"],
+ ["eabea2", "eabe9ce186ad"],
+ ["eabea3", "e18481e185ade186ae"],
+ ["eabea3", "eabe9ce186ae"],
+ ["eabea4", "e18481e185ade186af"],
+ ["eabea4", "eabe9ce186af"],
+ ["eabea5", "e18481e185ade186b0"],
+ ["eabea5", "eabe9ce186b0"],
+ ["eabea6", "e18481e185ade186b1"],
+ ["eabea6", "eabe9ce186b1"],
+ ["eabea7", "e18481e185ade186b2"],
+ ["eabea7", "eabe9ce186b2"],
+ ["eabea8", "e18481e185ade186b3"],
+ ["eabea8", "eabe9ce186b3"],
+ ["eabea9", "e18481e185ade186b4"],
+ ["eabea9", "eabe9ce186b4"],
+ ["eabeaa", "e18481e185ade186b5"],
+ ["eabeaa", "eabe9ce186b5"],
+ ["eabeab", "e18481e185ade186b6"],
+ ["eabeab", "eabe9ce186b6"],
+ ["eabeac", "e18481e185ade186b7"],
+ ["eabeac", "eabe9ce186b7"],
+ ["eabead", "e18481e185ade186b8"],
+ ["eabead", "eabe9ce186b8"],
+ ["eabeae", "e18481e185ade186b9"],
+ ["eabeae", "eabe9ce186b9"],
+ ["eabeaf", "e18481e185ade186ba"],
+ ["eabeaf", "eabe9ce186ba"],
+ ["eabeb0", "e18481e185ade186bb"],
+ ["eabeb0", "eabe9ce186bb"],
+ ["eabeb1", "e18481e185ade186bc"],
+ ["eabeb1", "eabe9ce186bc"],
+ ["eabeb2", "e18481e185ade186bd"],
+ ["eabeb2", "eabe9ce186bd"],
+ ["eabeb3", "e18481e185ade186be"],
+ ["eabeb3", "eabe9ce186be"],
+ ["eabeb4", "e18481e185ade186bf"],
+ ["eabeb4", "eabe9ce186bf"],
+ ["eabeb5", "e18481e185ade18780"],
+ ["eabeb5", "eabe9ce18780"],
+ ["eabeb6", "e18481e185ade18781"],
+ ["eabeb6", "eabe9ce18781"],
+ ["eabeb7", "e18481e185ade18782"],
+ ["eabeb7", "eabe9ce18782"],
+ ["eabeb8", "e18481e185ae"],
+ ["eabeb9", "e18481e185aee186a8"],
+ ["eabeb9", "eabeb8e186a8"],
+ ["eabeba", "e18481e185aee186a9"],
+ ["eabeba", "eabeb8e186a9"],
+ ["eabebb", "e18481e185aee186aa"],
+ ["eabebb", "eabeb8e186aa"],
+ ["eabebc", "e18481e185aee186ab"],
+ ["eabebc", "eabeb8e186ab"],
+ ["eabebd", "e18481e185aee186ac"],
+ ["eabebd", "eabeb8e186ac"],
+ ["eabebe", "e18481e185aee186ad"],
+ ["eabebe", "eabeb8e186ad"],
+ ["eabebf", "e18481e185aee186ae"],
+ ["eabebf", "eabeb8e186ae"],
+ ["eabf80", "e18481e185aee186af"],
+ ["eabf80", "eabeb8e186af"],
+ ["eabf81", "e18481e185aee186b0"],
+ ["eabf81", "eabeb8e186b0"],
+ ["eabf82", "e18481e185aee186b1"],
+ ["eabf82", "eabeb8e186b1"],
+ ["eabf83", "e18481e185aee186b2"],
+ ["eabf83", "eabeb8e186b2"],
+ ["eabf84", "e18481e185aee186b3"],
+ ["eabf84", "eabeb8e186b3"],
+ ["eabf85", "e18481e185aee186b4"],
+ ["eabf85", "eabeb8e186b4"],
+ ["eabf86", "e18481e185aee186b5"],
+ ["eabf86", "eabeb8e186b5"],
+ ["eabf87", "e18481e185aee186b6"],
+ ["eabf87", "eabeb8e186b6"],
+ ["eabf88", "e18481e185aee186b7"],
+ ["eabf88", "eabeb8e186b7"],
+ ["eabf89", "e18481e185aee186b8"],
+ ["eabf89", "eabeb8e186b8"],
+ ["eabf8a", "e18481e185aee186b9"],
+ ["eabf8a", "eabeb8e186b9"],
+ ["eabf8b", "e18481e185aee186ba"],
+ ["eabf8b", "eabeb8e186ba"],
+ ["eabf8c", "e18481e185aee186bb"],
+ ["eabf8c", "eabeb8e186bb"],
+ ["eabf8d", "e18481e185aee186bc"],
+ ["eabf8d", "eabeb8e186bc"],
+ ["eabf8e", "e18481e185aee186bd"],
+ ["eabf8e", "eabeb8e186bd"],
+ ["eabf8f", "e18481e185aee186be"],
+ ["eabf8f", "eabeb8e186be"],
+ ["eabf90", "e18481e185aee186bf"],
+ ["eabf90", "eabeb8e186bf"],
+ ["eabf91", "e18481e185aee18780"],
+ ["eabf91", "eabeb8e18780"],
+ ["eabf92", "e18481e185aee18781"],
+ ["eabf92", "eabeb8e18781"],
+ ["eabf93", "e18481e185aee18782"],
+ ["eabf93", "eabeb8e18782"],
+ ["eabf94", "e18481e185af"],
+ ["eabf95", "e18481e185afe186a8"],
+ ["eabf95", "eabf94e186a8"],
+ ["eabf96", "e18481e185afe186a9"],
+ ["eabf96", "eabf94e186a9"],
+ ["eabf97", "e18481e185afe186aa"],
+ ["eabf97", "eabf94e186aa"],
+ ["eabf98", "e18481e185afe186ab"],
+ ["eabf98", "eabf94e186ab"],
+ ["eabf99", "e18481e185afe186ac"],
+ ["eabf99", "eabf94e186ac"],
+ ["eabf9a", "e18481e185afe186ad"],
+ ["eabf9a", "eabf94e186ad"],
+ ["eabf9b", "e18481e185afe186ae"],
+ ["eabf9b", "eabf94e186ae"],
+ ["eabf9c", "e18481e185afe186af"],
+ ["eabf9c", "eabf94e186af"],
+ ["eabf9d", "e18481e185afe186b0"],
+ ["eabf9d", "eabf94e186b0"],
+ ["eabf9e", "e18481e185afe186b1"],
+ ["eabf9e", "eabf94e186b1"],
+ ["eabf9f", "e18481e185afe186b2"],
+ ["eabf9f", "eabf94e186b2"],
+ ["eabfa0", "e18481e185afe186b3"],
+ ["eabfa0", "eabf94e186b3"],
+ ["eabfa1", "e18481e185afe186b4"],
+ ["eabfa1", "eabf94e186b4"],
+ ["eabfa2", "e18481e185afe186b5"],
+ ["eabfa2", "eabf94e186b5"],
+ ["eabfa3", "e18481e185afe186b6"],
+ ["eabfa3", "eabf94e186b6"],
+ ["eabfa4", "e18481e185afe186b7"],
+ ["eabfa4", "eabf94e186b7"],
+ ["eabfa5", "e18481e185afe186b8"],
+ ["eabfa5", "eabf94e186b8"],
+ ["eabfa6", "e18481e185afe186b9"],
+ ["eabfa6", "eabf94e186b9"],
+ ["eabfa7", "e18481e185afe186ba"],
+ ["eabfa7", "eabf94e186ba"],
+ ["eabfa8", "e18481e185afe186bb"],
+ ["eabfa8", "eabf94e186bb"],
+ ["eabfa9", "e18481e185afe186bc"],
+ ["eabfa9", "eabf94e186bc"],
+ ["eabfaa", "e18481e185afe186bd"],
+ ["eabfaa", "eabf94e186bd"],
+ ["eabfab", "e18481e185afe186be"],
+ ["eabfab", "eabf94e186be"],
+ ["eabfac", "e18481e185afe186bf"],
+ ["eabfac", "eabf94e186bf"],
+ ["eabfad", "e18481e185afe18780"],
+ ["eabfad", "eabf94e18780"],
+ ["eabfae", "e18481e185afe18781"],
+ ["eabfae", "eabf94e18781"],
+ ["eabfaf", "e18481e185afe18782"],
+ ["eabfaf", "eabf94e18782"],
+ ["eabfb0", "e18481e185b0"],
+ ["eabfb1", "e18481e185b0e186a8"],
+ ["eabfb1", "eabfb0e186a8"],
+ ["eabfb2", "e18481e185b0e186a9"],
+ ["eabfb2", "eabfb0e186a9"],
+ ["eabfb3", "e18481e185b0e186aa"],
+ ["eabfb3", "eabfb0e186aa"],
+ ["eabfb4", "e18481e185b0e186ab"],
+ ["eabfb4", "eabfb0e186ab"],
+ ["eabfb5", "e18481e185b0e186ac"],
+ ["eabfb5", "eabfb0e186ac"],
+ ["eabfb6", "e18481e185b0e186ad"],
+ ["eabfb6", "eabfb0e186ad"],
+ ["eabfb7", "e18481e185b0e186ae"],
+ ["eabfb7", "eabfb0e186ae"],
+ ["eabfb8", "e18481e185b0e186af"],
+ ["eabfb8", "eabfb0e186af"],
+ ["eabfb9", "e18481e185b0e186b0"],
+ ["eabfb9", "eabfb0e186b0"],
+ ["eabfba", "e18481e185b0e186b1"],
+ ["eabfba", "eabfb0e186b1"],
+ ["eabfbb", "e18481e185b0e186b2"],
+ ["eabfbb", "eabfb0e186b2"],
+ ["eabfbc", "e18481e185b0e186b3"],
+ ["eabfbc", "eabfb0e186b3"],
+ ["eabfbd", "e18481e185b0e186b4"],
+ ["eabfbd", "eabfb0e186b4"],
+ ["eabfbe", "e18481e185b0e186b5"],
+ ["eabfbe", "eabfb0e186b5"],
+ ["eabfbf", "e18481e185b0e186b6"],
+ ["eabfbf", "eabfb0e186b6"],
+ ["eb8080", "e18481e185b0e186b7"],
+ ["eb8080", "eabfb0e186b7"],
+ ["eb8081", "e18481e185b0e186b8"],
+ ["eb8081", "eabfb0e186b8"],
+ ["eb8082", "e18481e185b0e186b9"],
+ ["eb8082", "eabfb0e186b9"],
+ ["eb8083", "e18481e185b0e186ba"],
+ ["eb8083", "eabfb0e186ba"],
+ ["eb8084", "e18481e185b0e186bb"],
+ ["eb8084", "eabfb0e186bb"],
+ ["eb8085", "e18481e185b0e186bc"],
+ ["eb8085", "eabfb0e186bc"],
+ ["eb8086", "e18481e185b0e186bd"],
+ ["eb8086", "eabfb0e186bd"],
+ ["eb8087", "e18481e185b0e186be"],
+ ["eb8087", "eabfb0e186be"],
+ ["eb8088", "e18481e185b0e186bf"],
+ ["eb8088", "eabfb0e186bf"],
+ ["eb8089", "e18481e185b0e18780"],
+ ["eb8089", "eabfb0e18780"],
+ ["eb808a", "e18481e185b0e18781"],
+ ["eb808a", "eabfb0e18781"],
+ ["eb808b", "e18481e185b0e18782"],
+ ["eb808b", "eabfb0e18782"],
+ ["eb808c", "e18481e185b1"],
+ ["eb808d", "e18481e185b1e186a8"],
+ ["eb808d", "eb808ce186a8"],
+ ["eb808e", "e18481e185b1e186a9"],
+ ["eb808e", "eb808ce186a9"],
+ ["eb808f", "e18481e185b1e186aa"],
+ ["eb808f", "eb808ce186aa"],
+ ["eb8090", "e18481e185b1e186ab"],
+ ["eb8090", "eb808ce186ab"],
+ ["eb8091", "e18481e185b1e186ac"],
+ ["eb8091", "eb808ce186ac"],
+ ["eb8092", "e18481e185b1e186ad"],
+ ["eb8092", "eb808ce186ad"],
+ ["eb8093", "e18481e185b1e186ae"],
+ ["eb8093", "eb808ce186ae"],
+ ["eb8094", "e18481e185b1e186af"],
+ ["eb8094", "eb808ce186af"],
+ ["eb8095", "e18481e185b1e186b0"],
+ ["eb8095", "eb808ce186b0"],
+ ["eb8096", "e18481e185b1e186b1"],
+ ["eb8096", "eb808ce186b1"],
+ ["eb8097", "e18481e185b1e186b2"],
+ ["eb8097", "eb808ce186b2"],
+ ["eb8098", "e18481e185b1e186b3"],
+ ["eb8098", "eb808ce186b3"],
+ ["eb8099", "e18481e185b1e186b4"],
+ ["eb8099", "eb808ce186b4"],
+ ["eb809a", "e18481e185b1e186b5"],
+ ["eb809a", "eb808ce186b5"],
+ ["eb809b", "e18481e185b1e186b6"],
+ ["eb809b", "eb808ce186b6"],
+ ["eb809c", "e18481e185b1e186b7"],
+ ["eb809c", "eb808ce186b7"],
+ ["eb809d", "e18481e185b1e186b8"],
+ ["eb809d", "eb808ce186b8"],
+ ["eb809e", "e18481e185b1e186b9"],
+ ["eb809e", "eb808ce186b9"],
+ ["eb809f", "e18481e185b1e186ba"],
+ ["eb809f", "eb808ce186ba"],
+ ["eb80a0", "e18481e185b1e186bb"],
+ ["eb80a0", "eb808ce186bb"],
+ ["eb80a1", "e18481e185b1e186bc"],
+ ["eb80a1", "eb808ce186bc"],
+ ["eb80a2", "e18481e185b1e186bd"],
+ ["eb80a2", "eb808ce186bd"],
+ ["eb80a3", "e18481e185b1e186be"],
+ ["eb80a3", "eb808ce186be"],
+ ["eb80a4", "e18481e185b1e186bf"],
+ ["eb80a4", "eb808ce186bf"],
+ ["eb80a5", "e18481e185b1e18780"],
+ ["eb80a5", "eb808ce18780"],
+ ["eb80a6", "e18481e185b1e18781"],
+ ["eb80a6", "eb808ce18781"],
+ ["eb80a7", "e18481e185b1e18782"],
+ ["eb80a7", "eb808ce18782"],
+ ["eb80a8", "e18481e185b2"],
+ ["eb80a9", "e18481e185b2e186a8"],
+ ["eb80a9", "eb80a8e186a8"],
+ ["eb80aa", "e18481e185b2e186a9"],
+ ["eb80aa", "eb80a8e186a9"],
+ ["eb80ab", "e18481e185b2e186aa"],
+ ["eb80ab", "eb80a8e186aa"],
+ ["eb80ac", "e18481e185b2e186ab"],
+ ["eb80ac", "eb80a8e186ab"],
+ ["eb80ad", "e18481e185b2e186ac"],
+ ["eb80ad", "eb80a8e186ac"],
+ ["eb80ae", "e18481e185b2e186ad"],
+ ["eb80ae", "eb80a8e186ad"],
+ ["eb80af", "e18481e185b2e186ae"],
+ ["eb80af", "eb80a8e186ae"],
+ ["eb80b0", "e18481e185b2e186af"],
+ ["eb80b0", "eb80a8e186af"],
+ ["eb80b1", "e18481e185b2e186b0"],
+ ["eb80b1", "eb80a8e186b0"],
+ ["eb80b2", "e18481e185b2e186b1"],
+ ["eb80b2", "eb80a8e186b1"],
+ ["eb80b3", "e18481e185b2e186b2"],
+ ["eb80b3", "eb80a8e186b2"],
+ ["eb80b4", "e18481e185b2e186b3"],
+ ["eb80b4", "eb80a8e186b3"],
+ ["eb80b5", "e18481e185b2e186b4"],
+ ["eb80b5", "eb80a8e186b4"],
+ ["eb80b6", "e18481e185b2e186b5"],
+ ["eb80b6", "eb80a8e186b5"],
+ ["eb80b7", "e18481e185b2e186b6"],
+ ["eb80b7", "eb80a8e186b6"],
+ ["eb80b8", "e18481e185b2e186b7"],
+ ["eb80b8", "eb80a8e186b7"],
+ ["eb80b9", "e18481e185b2e186b8"],
+ ["eb80b9", "eb80a8e186b8"],
+ ["eb80ba", "e18481e185b2e186b9"],
+ ["eb80ba", "eb80a8e186b9"],
+ ["eb80bb", "e18481e185b2e186ba"],
+ ["eb80bb", "eb80a8e186ba"],
+ ["eb80bc", "e18481e185b2e186bb"],
+ ["eb80bc", "eb80a8e186bb"],
+ ["eb80bd", "e18481e185b2e186bc"],
+ ["eb80bd", "eb80a8e186bc"],
+ ["eb80be", "e18481e185b2e186bd"],
+ ["eb80be", "eb80a8e186bd"],
+ ["eb80bf", "e18481e185b2e186be"],
+ ["eb80bf", "eb80a8e186be"],
+ ["eb8180", "e18481e185b2e186bf"],
+ ["eb8180", "eb80a8e186bf"],
+ ["eb8181", "e18481e185b2e18780"],
+ ["eb8181", "eb80a8e18780"],
+ ["eb8182", "e18481e185b2e18781"],
+ ["eb8182", "eb80a8e18781"],
+ ["eb8183", "e18481e185b2e18782"],
+ ["eb8183", "eb80a8e18782"],
+ ["eb8184", "e18481e185b3"],
+ ["eb8185", "e18481e185b3e186a8"],
+ ["eb8185", "eb8184e186a8"],
+ ["eb8186", "e18481e185b3e186a9"],
+ ["eb8186", "eb8184e186a9"],
+ ["eb8187", "e18481e185b3e186aa"],
+ ["eb8187", "eb8184e186aa"],
+ ["eb8188", "e18481e185b3e186ab"],
+ ["eb8188", "eb8184e186ab"],
+ ["eb8189", "e18481e185b3e186ac"],
+ ["eb8189", "eb8184e186ac"],
+ ["eb818a", "e18481e185b3e186ad"],
+ ["eb818a", "eb8184e186ad"],
+ ["eb818b", "e18481e185b3e186ae"],
+ ["eb818b", "eb8184e186ae"],
+ ["eb818c", "e18481e185b3e186af"],
+ ["eb818c", "eb8184e186af"],
+ ["eb818d", "e18481e185b3e186b0"],
+ ["eb818d", "eb8184e186b0"],
+ ["eb818e", "e18481e185b3e186b1"],
+ ["eb818e", "eb8184e186b1"],
+ ["eb818f", "e18481e185b3e186b2"],
+ ["eb818f", "eb8184e186b2"],
+ ["eb8190", "e18481e185b3e186b3"],
+ ["eb8190", "eb8184e186b3"],
+ ["eb8191", "e18481e185b3e186b4"],
+ ["eb8191", "eb8184e186b4"],
+ ["eb8192", "e18481e185b3e186b5"],
+ ["eb8192", "eb8184e186b5"],
+ ["eb8193", "e18481e185b3e186b6"],
+ ["eb8193", "eb8184e186b6"],
+ ["eb8194", "e18481e185b3e186b7"],
+ ["eb8194", "eb8184e186b7"],
+ ["eb8195", "e18481e185b3e186b8"],
+ ["eb8195", "eb8184e186b8"],
+ ["eb8196", "e18481e185b3e186b9"],
+ ["eb8196", "eb8184e186b9"],
+ ["eb8197", "e18481e185b3e186ba"],
+ ["eb8197", "eb8184e186ba"],
+ ["eb8198", "e18481e185b3e186bb"],
+ ["eb8198", "eb8184e186bb"],
+ ["eb8199", "e18481e185b3e186bc"],
+ ["eb8199", "eb8184e186bc"],
+ ["eb819a", "e18481e185b3e186bd"],
+ ["eb819a", "eb8184e186bd"],
+ ["eb819b", "e18481e185b3e186be"],
+ ["eb819b", "eb8184e186be"],
+ ["eb819c", "e18481e185b3e186bf"],
+ ["eb819c", "eb8184e186bf"],
+ ["eb819d", "e18481e185b3e18780"],
+ ["eb819d", "eb8184e18780"],
+ ["eb819e", "e18481e185b3e18781"],
+ ["eb819e", "eb8184e18781"],
+ ["eb819f", "e18481e185b3e18782"],
+ ["eb819f", "eb8184e18782"],
+ ["eb81a0", "e18481e185b4"],
+ ["eb81a1", "e18481e185b4e186a8"],
+ ["eb81a1", "eb81a0e186a8"],
+ ["eb81a2", "e18481e185b4e186a9"],
+ ["eb81a2", "eb81a0e186a9"],
+ ["eb81a3", "e18481e185b4e186aa"],
+ ["eb81a3", "eb81a0e186aa"],
+ ["eb81a4", "e18481e185b4e186ab"],
+ ["eb81a4", "eb81a0e186ab"],
+ ["eb81a5", "e18481e185b4e186ac"],
+ ["eb81a5", "eb81a0e186ac"],
+ ["eb81a6", "e18481e185b4e186ad"],
+ ["eb81a6", "eb81a0e186ad"],
+ ["eb81a7", "e18481e185b4e186ae"],
+ ["eb81a7", "eb81a0e186ae"],
+ ["eb81a8", "e18481e185b4e186af"],
+ ["eb81a8", "eb81a0e186af"],
+ ["eb81a9", "e18481e185b4e186b0"],
+ ["eb81a9", "eb81a0e186b0"],
+ ["eb81aa", "e18481e185b4e186b1"],
+ ["eb81aa", "eb81a0e186b1"],
+ ["eb81ab", "e18481e185b4e186b2"],
+ ["eb81ab", "eb81a0e186b2"],
+ ["eb81ac", "e18481e185b4e186b3"],
+ ["eb81ac", "eb81a0e186b3"],
+ ["eb81ad", "e18481e185b4e186b4"],
+ ["eb81ad", "eb81a0e186b4"],
+ ["eb81ae", "e18481e185b4e186b5"],
+ ["eb81ae", "eb81a0e186b5"],
+ ["eb81af", "e18481e185b4e186b6"],
+ ["eb81af", "eb81a0e186b6"],
+ ["eb81b0", "e18481e185b4e186b7"],
+ ["eb81b0", "eb81a0e186b7"],
+ ["eb81b1", "e18481e185b4e186b8"],
+ ["eb81b1", "eb81a0e186b8"],
+ ["eb81b2", "e18481e185b4e186b9"],
+ ["eb81b2", "eb81a0e186b9"],
+ ["eb81b3", "e18481e185b4e186ba"],
+ ["eb81b3", "eb81a0e186ba"],
+ ["eb81b4", "e18481e185b4e186bb"],
+ ["eb81b4", "eb81a0e186bb"],
+ ["eb81b5", "e18481e185b4e186bc"],
+ ["eb81b5", "eb81a0e186bc"],
+ ["eb81b6", "e18481e185b4e186bd"],
+ ["eb81b6", "eb81a0e186bd"],
+ ["eb81b7", "e18481e185b4e186be"],
+ ["eb81b7", "eb81a0e186be"],
+ ["eb81b8", "e18481e185b4e186bf"],
+ ["eb81b8", "eb81a0e186bf"],
+ ["eb81b9", "e18481e185b4e18780"],
+ ["eb81b9", "eb81a0e18780"],
+ ["eb81ba", "e18481e185b4e18781"],
+ ["eb81ba", "eb81a0e18781"],
+ ["eb81bb", "e18481e185b4e18782"],
+ ["eb81bb", "eb81a0e18782"],
+ ["eb81bc", "e18481e185b5"],
+ ["eb81bd", "e18481e185b5e186a8"],
+ ["eb81bd", "eb81bce186a8"],
+ ["eb81be", "e18481e185b5e186a9"],
+ ["eb81be", "eb81bce186a9"],
+ ["eb81bf", "e18481e185b5e186aa"],
+ ["eb81bf", "eb81bce186aa"],
+ ["eb8280", "e18481e185b5e186ab"],
+ ["eb8280", "eb81bce186ab"],
+ ["eb8281", "e18481e185b5e186ac"],
+ ["eb8281", "eb81bce186ac"],
+ ["eb8282", "e18481e185b5e186ad"],
+ ["eb8282", "eb81bce186ad"],
+ ["eb8283", "e18481e185b5e186ae"],
+ ["eb8283", "eb81bce186ae"],
+ ["eb8284", "e18481e185b5e186af"],
+ ["eb8284", "eb81bce186af"],
+ ["eb8285", "e18481e185b5e186b0"],
+ ["eb8285", "eb81bce186b0"],
+ ["eb8286", "e18481e185b5e186b1"],
+ ["eb8286", "eb81bce186b1"],
+ ["eb8287", "e18481e185b5e186b2"],
+ ["eb8287", "eb81bce186b2"],
+ ["eb8288", "e18481e185b5e186b3"],
+ ["eb8288", "eb81bce186b3"],
+ ["eb8289", "e18481e185b5e186b4"],
+ ["eb8289", "eb81bce186b4"],
+ ["eb828a", "e18481e185b5e186b5"],
+ ["eb828a", "eb81bce186b5"],
+ ["eb828b", "e18481e185b5e186b6"],
+ ["eb828b", "eb81bce186b6"],
+ ["eb828c", "e18481e185b5e186b7"],
+ ["eb828c", "eb81bce186b7"],
+ ["eb828d", "e18481e185b5e186b8"],
+ ["eb828d", "eb81bce186b8"],
+ ["eb828e", "e18481e185b5e186b9"],
+ ["eb828e", "eb81bce186b9"],
+ ["eb828f", "e18481e185b5e186ba"],
+ ["eb828f", "eb81bce186ba"],
+ ["eb8290", "e18481e185b5e186bb"],
+ ["eb8290", "eb81bce186bb"],
+ ["eb8291", "e18481e185b5e186bc"],
+ ["eb8291", "eb81bce186bc"],
+ ["eb8292", "e18481e185b5e186bd"],
+ ["eb8292", "eb81bce186bd"],
+ ["eb8293", "e18481e185b5e186be"],
+ ["eb8293", "eb81bce186be"],
+ ["eb8294", "e18481e185b5e186bf"],
+ ["eb8294", "eb81bce186bf"],
+ ["eb8295", "e18481e185b5e18780"],
+ ["eb8295", "eb81bce18780"],
+ ["eb8296", "e18481e185b5e18781"],
+ ["eb8296", "eb81bce18781"],
+ ["eb8297", "e18481e185b5e18782"],
+ ["eb8297", "eb81bce18782"],
+ ["eb8298", "e18482e185a1"],
+ ["eb8299", "e18482e185a1e186a8"],
+ ["eb8299", "eb8298e186a8"],
+ ["eb829a", "e18482e185a1e186a9"],
+ ["eb829a", "eb8298e186a9"],
+ ["eb829b", "e18482e185a1e186aa"],
+ ["eb829b", "eb8298e186aa"],
+ ["eb829c", "e18482e185a1e186ab"],
+ ["eb829c", "eb8298e186ab"],
+ ["eb829d", "e18482e185a1e186ac"],
+ ["eb829d", "eb8298e186ac"],
+ ["eb829e", "e18482e185a1e186ad"],
+ ["eb829e", "eb8298e186ad"],
+ ["eb829f", "e18482e185a1e186ae"],
+ ["eb829f", "eb8298e186ae"],
+ ["eb82a0", "e18482e185a1e186af"],
+ ["eb82a0", "eb8298e186af"],
+ ["eb82a1", "e18482e185a1e186b0"],
+ ["eb82a1", "eb8298e186b0"],
+ ["eb82a2", "e18482e185a1e186b1"],
+ ["eb82a2", "eb8298e186b1"],
+ ["eb82a3", "e18482e185a1e186b2"],
+ ["eb82a3", "eb8298e186b2"],
+ ["eb82a4", "e18482e185a1e186b3"],
+ ["eb82a4", "eb8298e186b3"],
+ ["eb82a5", "e18482e185a1e186b4"],
+ ["eb82a5", "eb8298e186b4"],
+ ["eb82a6", "e18482e185a1e186b5"],
+ ["eb82a6", "eb8298e186b5"],
+ ["eb82a7", "e18482e185a1e186b6"],
+ ["eb82a7", "eb8298e186b6"],
+ ["eb82a8", "e18482e185a1e186b7"],
+ ["eb82a8", "eb8298e186b7"],
+ ["eb82a9", "e18482e185a1e186b8"],
+ ["eb82a9", "eb8298e186b8"],
+ ["eb82aa", "e18482e185a1e186b9"],
+ ["eb82aa", "eb8298e186b9"],
+ ["eb82ab", "e18482e185a1e186ba"],
+ ["eb82ab", "eb8298e186ba"],
+ ["eb82ac", "e18482e185a1e186bb"],
+ ["eb82ac", "eb8298e186bb"],
+ ["eb82ad", "e18482e185a1e186bc"],
+ ["eb82ad", "eb8298e186bc"],
+ ["eb82ae", "e18482e185a1e186bd"],
+ ["eb82ae", "eb8298e186bd"],
+ ["eb82af", "e18482e185a1e186be"],
+ ["eb82af", "eb8298e186be"],
+ ["eb82b0", "e18482e185a1e186bf"],
+ ["eb82b0", "eb8298e186bf"],
+ ["eb82b1", "e18482e185a1e18780"],
+ ["eb82b1", "eb8298e18780"],
+ ["eb82b2", "e18482e185a1e18781"],
+ ["eb82b2", "eb8298e18781"],
+ ["eb82b3", "e18482e185a1e18782"],
+ ["eb82b3", "eb8298e18782"],
+ ["eb82b4", "e18482e185a2"],
+ ["eb82b5", "e18482e185a2e186a8"],
+ ["eb82b5", "eb82b4e186a8"],
+ ["eb82b6", "e18482e185a2e186a9"],
+ ["eb82b6", "eb82b4e186a9"],
+ ["eb82b7", "e18482e185a2e186aa"],
+ ["eb82b7", "eb82b4e186aa"],
+ ["eb82b8", "e18482e185a2e186ab"],
+ ["eb82b8", "eb82b4e186ab"],
+ ["eb82b9", "e18482e185a2e186ac"],
+ ["eb82b9", "eb82b4e186ac"],
+ ["eb82ba", "e18482e185a2e186ad"],
+ ["eb82ba", "eb82b4e186ad"],
+ ["eb82bb", "e18482e185a2e186ae"],
+ ["eb82bb", "eb82b4e186ae"],
+ ["eb82bc", "e18482e185a2e186af"],
+ ["eb82bc", "eb82b4e186af"],
+ ["eb82bd", "e18482e185a2e186b0"],
+ ["eb82bd", "eb82b4e186b0"],
+ ["eb82be", "e18482e185a2e186b1"],
+ ["eb82be", "eb82b4e186b1"],
+ ["eb82bf", "e18482e185a2e186b2"],
+ ["eb82bf", "eb82b4e186b2"],
+ ["eb8380", "e18482e185a2e186b3"],
+ ["eb8380", "eb82b4e186b3"],
+ ["eb8381", "e18482e185a2e186b4"],
+ ["eb8381", "eb82b4e186b4"],
+ ["eb8382", "e18482e185a2e186b5"],
+ ["eb8382", "eb82b4e186b5"],
+ ["eb8383", "e18482e185a2e186b6"],
+ ["eb8383", "eb82b4e186b6"],
+ ["eb8384", "e18482e185a2e186b7"],
+ ["eb8384", "eb82b4e186b7"],
+ ["eb8385", "e18482e185a2e186b8"],
+ ["eb8385", "eb82b4e186b8"],
+ ["eb8386", "e18482e185a2e186b9"],
+ ["eb8386", "eb82b4e186b9"],
+ ["eb8387", "e18482e185a2e186ba"],
+ ["eb8387", "eb82b4e186ba"],
+ ["eb8388", "e18482e185a2e186bb"],
+ ["eb8388", "eb82b4e186bb"],
+ ["eb8389", "e18482e185a2e186bc"],
+ ["eb8389", "eb82b4e186bc"],
+ ["eb838a", "e18482e185a2e186bd"],
+ ["eb838a", "eb82b4e186bd"],
+ ["eb838b", "e18482e185a2e186be"],
+ ["eb838b", "eb82b4e186be"],
+ ["eb838c", "e18482e185a2e186bf"],
+ ["eb838c", "eb82b4e186bf"],
+ ["eb838d", "e18482e185a2e18780"],
+ ["eb838d", "eb82b4e18780"],
+ ["eb838e", "e18482e185a2e18781"],
+ ["eb838e", "eb82b4e18781"],
+ ["eb838f", "e18482e185a2e18782"],
+ ["eb838f", "eb82b4e18782"],
+ ["eb8390", "e18482e185a3"],
+ ["eb8391", "e18482e185a3e186a8"],
+ ["eb8391", "eb8390e186a8"],
+ ["eb8392", "e18482e185a3e186a9"],
+ ["eb8392", "eb8390e186a9"],
+ ["eb8393", "e18482e185a3e186aa"],
+ ["eb8393", "eb8390e186aa"],
+ ["eb8394", "e18482e185a3e186ab"],
+ ["eb8394", "eb8390e186ab"],
+ ["eb8395", "e18482e185a3e186ac"],
+ ["eb8395", "eb8390e186ac"],
+ ["eb8396", "e18482e185a3e186ad"],
+ ["eb8396", "eb8390e186ad"],
+ ["eb8397", "e18482e185a3e186ae"],
+ ["eb8397", "eb8390e186ae"],
+ ["eb8398", "e18482e185a3e186af"],
+ ["eb8398", "eb8390e186af"],
+ ["eb8399", "e18482e185a3e186b0"],
+ ["eb8399", "eb8390e186b0"],
+ ["eb839a", "e18482e185a3e186b1"],
+ ["eb839a", "eb8390e186b1"],
+ ["eb839b", "e18482e185a3e186b2"],
+ ["eb839b", "eb8390e186b2"],
+ ["eb839c", "e18482e185a3e186b3"],
+ ["eb839c", "eb8390e186b3"],
+ ["eb839d", "e18482e185a3e186b4"],
+ ["eb839d", "eb8390e186b4"],
+ ["eb839e", "e18482e185a3e186b5"],
+ ["eb839e", "eb8390e186b5"],
+ ["eb839f", "e18482e185a3e186b6"],
+ ["eb839f", "eb8390e186b6"],
+ ["eb83a0", "e18482e185a3e186b7"],
+ ["eb83a0", "eb8390e186b7"],
+ ["eb83a1", "e18482e185a3e186b8"],
+ ["eb83a1", "eb8390e186b8"],
+ ["eb83a2", "e18482e185a3e186b9"],
+ ["eb83a2", "eb8390e186b9"],
+ ["eb83a3", "e18482e185a3e186ba"],
+ ["eb83a3", "eb8390e186ba"],
+ ["eb83a4", "e18482e185a3e186bb"],
+ ["eb83a4", "eb8390e186bb"],
+ ["eb83a5", "e18482e185a3e186bc"],
+ ["eb83a5", "eb8390e186bc"],
+ ["eb83a6", "e18482e185a3e186bd"],
+ ["eb83a6", "eb8390e186bd"],
+ ["eb83a7", "e18482e185a3e186be"],
+ ["eb83a7", "eb8390e186be"],
+ ["eb83a8", "e18482e185a3e186bf"],
+ ["eb83a8", "eb8390e186bf"],
+ ["eb83a9", "e18482e185a3e18780"],
+ ["eb83a9", "eb8390e18780"],
+ ["eb83aa", "e18482e185a3e18781"],
+ ["eb83aa", "eb8390e18781"],
+ ["eb83ab", "e18482e185a3e18782"],
+ ["eb83ab", "eb8390e18782"],
+ ["eb83ac", "e18482e185a4"],
+ ["eb83ad", "e18482e185a4e186a8"],
+ ["eb83ad", "eb83ace186a8"],
+ ["eb83ae", "e18482e185a4e186a9"],
+ ["eb83ae", "eb83ace186a9"],
+ ["eb83af", "e18482e185a4e186aa"],
+ ["eb83af", "eb83ace186aa"],
+ ["eb83b0", "e18482e185a4e186ab"],
+ ["eb83b0", "eb83ace186ab"],
+ ["eb83b1", "e18482e185a4e186ac"],
+ ["eb83b1", "eb83ace186ac"],
+ ["eb83b2", "e18482e185a4e186ad"],
+ ["eb83b2", "eb83ace186ad"],
+ ["eb83b3", "e18482e185a4e186ae"],
+ ["eb83b3", "eb83ace186ae"],
+ ["eb83b4", "e18482e185a4e186af"],
+ ["eb83b4", "eb83ace186af"],
+ ["eb83b5", "e18482e185a4e186b0"],
+ ["eb83b5", "eb83ace186b0"],
+ ["eb83b6", "e18482e185a4e186b1"],
+ ["eb83b6", "eb83ace186b1"],
+ ["eb83b7", "e18482e185a4e186b2"],
+ ["eb83b7", "eb83ace186b2"],
+ ["eb83b8", "e18482e185a4e186b3"],
+ ["eb83b8", "eb83ace186b3"],
+ ["eb83b9", "e18482e185a4e186b4"],
+ ["eb83b9", "eb83ace186b4"],
+ ["eb83ba", "e18482e185a4e186b5"],
+ ["eb83ba", "eb83ace186b5"],
+ ["eb83bb", "e18482e185a4e186b6"],
+ ["eb83bb", "eb83ace186b6"],
+ ["eb83bc", "e18482e185a4e186b7"],
+ ["eb83bc", "eb83ace186b7"],
+ ["eb83bd", "e18482e185a4e186b8"],
+ ["eb83bd", "eb83ace186b8"],
+ ["eb83be", "e18482e185a4e186b9"],
+ ["eb83be", "eb83ace186b9"],
+ ["eb83bf", "e18482e185a4e186ba"],
+ ["eb83bf", "eb83ace186ba"],
+ ["eb8480", "e18482e185a4e186bb"],
+ ["eb8480", "eb83ace186bb"],
+ ["eb8481", "e18482e185a4e186bc"],
+ ["eb8481", "eb83ace186bc"],
+ ["eb8482", "e18482e185a4e186bd"],
+ ["eb8482", "eb83ace186bd"],
+ ["eb8483", "e18482e185a4e186be"],
+ ["eb8483", "eb83ace186be"],
+ ["eb8484", "e18482e185a4e186bf"],
+ ["eb8484", "eb83ace186bf"],
+ ["eb8485", "e18482e185a4e18780"],
+ ["eb8485", "eb83ace18780"],
+ ["eb8486", "e18482e185a4e18781"],
+ ["eb8486", "eb83ace18781"],
+ ["eb8487", "e18482e185a4e18782"],
+ ["eb8487", "eb83ace18782"],
+ ["eb8488", "e18482e185a5"],
+ ["eb8489", "e18482e185a5e186a8"],
+ ["eb8489", "eb8488e186a8"],
+ ["eb848a", "e18482e185a5e186a9"],
+ ["eb848a", "eb8488e186a9"],
+ ["eb848b", "e18482e185a5e186aa"],
+ ["eb848b", "eb8488e186aa"],
+ ["eb848c", "e18482e185a5e186ab"],
+ ["eb848c", "eb8488e186ab"],
+ ["eb848d", "e18482e185a5e186ac"],
+ ["eb848d", "eb8488e186ac"],
+ ["eb848e", "e18482e185a5e186ad"],
+ ["eb848e", "eb8488e186ad"],
+ ["eb848f", "e18482e185a5e186ae"],
+ ["eb848f", "eb8488e186ae"],
+ ["eb8490", "e18482e185a5e186af"],
+ ["eb8490", "eb8488e186af"],
+ ["eb8491", "e18482e185a5e186b0"],
+ ["eb8491", "eb8488e186b0"],
+ ["eb8492", "e18482e185a5e186b1"],
+ ["eb8492", "eb8488e186b1"],
+ ["eb8493", "e18482e185a5e186b2"],
+ ["eb8493", "eb8488e186b2"],
+ ["eb8494", "e18482e185a5e186b3"],
+ ["eb8494", "eb8488e186b3"],
+ ["eb8495", "e18482e185a5e186b4"],
+ ["eb8495", "eb8488e186b4"],
+ ["eb8496", "e18482e185a5e186b5"],
+ ["eb8496", "eb8488e186b5"],
+ ["eb8497", "e18482e185a5e186b6"],
+ ["eb8497", "eb8488e186b6"],
+ ["eb8498", "e18482e185a5e186b7"],
+ ["eb8498", "eb8488e186b7"],
+ ["eb8499", "e18482e185a5e186b8"],
+ ["eb8499", "eb8488e186b8"],
+ ["eb849a", "e18482e185a5e186b9"],
+ ["eb849a", "eb8488e186b9"],
+ ["eb849b", "e18482e185a5e186ba"],
+ ["eb849b", "eb8488e186ba"],
+ ["eb849c", "e18482e185a5e186bb"],
+ ["eb849c", "eb8488e186bb"],
+ ["eb849d", "e18482e185a5e186bc"],
+ ["eb849d", "eb8488e186bc"],
+ ["eb849e", "e18482e185a5e186bd"],
+ ["eb849e", "eb8488e186bd"],
+ ["eb849f", "e18482e185a5e186be"],
+ ["eb849f", "eb8488e186be"],
+ ["eb84a0", "e18482e185a5e186bf"],
+ ["eb84a0", "eb8488e186bf"],
+ ["eb84a1", "e18482e185a5e18780"],
+ ["eb84a1", "eb8488e18780"],
+ ["eb84a2", "e18482e185a5e18781"],
+ ["eb84a2", "eb8488e18781"],
+ ["eb84a3", "e18482e185a5e18782"],
+ ["eb84a3", "eb8488e18782"],
+ ["eb84a4", "e18482e185a6"],
+ ["eb84a5", "e18482e185a6e186a8"],
+ ["eb84a5", "eb84a4e186a8"],
+ ["eb84a6", "e18482e185a6e186a9"],
+ ["eb84a6", "eb84a4e186a9"],
+ ["eb84a7", "e18482e185a6e186aa"],
+ ["eb84a7", "eb84a4e186aa"],
+ ["eb84a8", "e18482e185a6e186ab"],
+ ["eb84a8", "eb84a4e186ab"],
+ ["eb84a9", "e18482e185a6e186ac"],
+ ["eb84a9", "eb84a4e186ac"],
+ ["eb84aa", "e18482e185a6e186ad"],
+ ["eb84aa", "eb84a4e186ad"],
+ ["eb84ab", "e18482e185a6e186ae"],
+ ["eb84ab", "eb84a4e186ae"],
+ ["eb84ac", "e18482e185a6e186af"],
+ ["eb84ac", "eb84a4e186af"],
+ ["eb84ad", "e18482e185a6e186b0"],
+ ["eb84ad", "eb84a4e186b0"],
+ ["eb84ae", "e18482e185a6e186b1"],
+ ["eb84ae", "eb84a4e186b1"],
+ ["eb84af", "e18482e185a6e186b2"],
+ ["eb84af", "eb84a4e186b2"],
+ ["eb84b0", "e18482e185a6e186b3"],
+ ["eb84b0", "eb84a4e186b3"],
+ ["eb84b1", "e18482e185a6e186b4"],
+ ["eb84b1", "eb84a4e186b4"],
+ ["eb84b2", "e18482e185a6e186b5"],
+ ["eb84b2", "eb84a4e186b5"],
+ ["eb84b3", "e18482e185a6e186b6"],
+ ["eb84b3", "eb84a4e186b6"],
+ ["eb84b4", "e18482e185a6e186b7"],
+ ["eb84b4", "eb84a4e186b7"],
+ ["eb84b5", "e18482e185a6e186b8"],
+ ["eb84b5", "eb84a4e186b8"],
+ ["eb84b6", "e18482e185a6e186b9"],
+ ["eb84b6", "eb84a4e186b9"],
+ ["eb84b7", "e18482e185a6e186ba"],
+ ["eb84b7", "eb84a4e186ba"],
+ ["eb84b8", "e18482e185a6e186bb"],
+ ["eb84b8", "eb84a4e186bb"],
+ ["eb84b9", "e18482e185a6e186bc"],
+ ["eb84b9", "eb84a4e186bc"],
+ ["eb84ba", "e18482e185a6e186bd"],
+ ["eb84ba", "eb84a4e186bd"],
+ ["eb84bb", "e18482e185a6e186be"],
+ ["eb84bb", "eb84a4e186be"],
+ ["eb84bc", "e18482e185a6e186bf"],
+ ["eb84bc", "eb84a4e186bf"],
+ ["eb84bd", "e18482e185a6e18780"],
+ ["eb84bd", "eb84a4e18780"],
+ ["eb84be", "e18482e185a6e18781"],
+ ["eb84be", "eb84a4e18781"],
+ ["eb84bf", "e18482e185a6e18782"],
+ ["eb84bf", "eb84a4e18782"],
+ ["eb8580", "e18482e185a7"],
+ ["eb8581", "e18482e185a7e186a8"],
+ ["eb8581", "eb8580e186a8"],
+ ["eb8582", "e18482e185a7e186a9"],
+ ["eb8582", "eb8580e186a9"],
+ ["eb8583", "e18482e185a7e186aa"],
+ ["eb8583", "eb8580e186aa"],
+ ["eb8584", "e18482e185a7e186ab"],
+ ["eb8584", "eb8580e186ab"],
+ ["eb8585", "e18482e185a7e186ac"],
+ ["eb8585", "eb8580e186ac"],
+ ["eb8586", "e18482e185a7e186ad"],
+ ["eb8586", "eb8580e186ad"],
+ ["eb8587", "e18482e185a7e186ae"],
+ ["eb8587", "eb8580e186ae"],
+ ["eb8588", "e18482e185a7e186af"],
+ ["eb8588", "eb8580e186af"],
+ ["eb8589", "e18482e185a7e186b0"],
+ ["eb8589", "eb8580e186b0"],
+ ["eb858a", "e18482e185a7e186b1"],
+ ["eb858a", "eb8580e186b1"],
+ ["eb858b", "e18482e185a7e186b2"],
+ ["eb858b", "eb8580e186b2"],
+ ["eb858c", "e18482e185a7e186b3"],
+ ["eb858c", "eb8580e186b3"],
+ ["eb858d", "e18482e185a7e186b4"],
+ ["eb858d", "eb8580e186b4"],
+ ["eb858e", "e18482e185a7e186b5"],
+ ["eb858e", "eb8580e186b5"],
+ ["eb858f", "e18482e185a7e186b6"],
+ ["eb858f", "eb8580e186b6"],
+ ["eb8590", "e18482e185a7e186b7"],
+ ["eb8590", "eb8580e186b7"],
+ ["eb8591", "e18482e185a7e186b8"],
+ ["eb8591", "eb8580e186b8"],
+ ["eb8592", "e18482e185a7e186b9"],
+ ["eb8592", "eb8580e186b9"],
+ ["eb8593", "e18482e185a7e186ba"],
+ ["eb8593", "eb8580e186ba"],
+ ["eb8594", "e18482e185a7e186bb"],
+ ["eb8594", "eb8580e186bb"],
+ ["eb8595", "e18482e185a7e186bc"],
+ ["eb8595", "eb8580e186bc"],
+ ["eb8596", "e18482e185a7e186bd"],
+ ["eb8596", "eb8580e186bd"],
+ ["eb8597", "e18482e185a7e186be"],
+ ["eb8597", "eb8580e186be"],
+ ["eb8598", "e18482e185a7e186bf"],
+ ["eb8598", "eb8580e186bf"],
+ ["eb8599", "e18482e185a7e18780"],
+ ["eb8599", "eb8580e18780"],
+ ["eb859a", "e18482e185a7e18781"],
+ ["eb859a", "eb8580e18781"],
+ ["eb859b", "e18482e185a7e18782"],
+ ["eb859b", "eb8580e18782"],
+ ["eb859c", "e18482e185a8"],
+ ["eb859d", "e18482e185a8e186a8"],
+ ["eb859d", "eb859ce186a8"],
+ ["eb859e", "e18482e185a8e186a9"],
+ ["eb859e", "eb859ce186a9"],
+ ["eb859f", "e18482e185a8e186aa"],
+ ["eb859f", "eb859ce186aa"],
+ ["eb85a0", "e18482e185a8e186ab"],
+ ["eb85a0", "eb859ce186ab"],
+ ["eb85a1", "e18482e185a8e186ac"],
+ ["eb85a1", "eb859ce186ac"],
+ ["eb85a2", "e18482e185a8e186ad"],
+ ["eb85a2", "eb859ce186ad"],
+ ["eb85a3", "e18482e185a8e186ae"],
+ ["eb85a3", "eb859ce186ae"],
+ ["eb85a4", "e18482e185a8e186af"],
+ ["eb85a4", "eb859ce186af"],
+ ["eb85a5", "e18482e185a8e186b0"],
+ ["eb85a5", "eb859ce186b0"],
+ ["eb85a6", "e18482e185a8e186b1"],
+ ["eb85a6", "eb859ce186b1"],
+ ["eb85a7", "e18482e185a8e186b2"],
+ ["eb85a7", "eb859ce186b2"],
+ ["eb85a8", "e18482e185a8e186b3"],
+ ["eb85a8", "eb859ce186b3"],
+ ["eb85a9", "e18482e185a8e186b4"],
+ ["eb85a9", "eb859ce186b4"],
+ ["eb85aa", "e18482e185a8e186b5"],
+ ["eb85aa", "eb859ce186b5"],
+ ["eb85ab", "e18482e185a8e186b6"],
+ ["eb85ab", "eb859ce186b6"],
+ ["eb85ac", "e18482e185a8e186b7"],
+ ["eb85ac", "eb859ce186b7"],
+ ["eb85ad", "e18482e185a8e186b8"],
+ ["eb85ad", "eb859ce186b8"],
+ ["eb85ae", "e18482e185a8e186b9"],
+ ["eb85ae", "eb859ce186b9"],
+ ["eb85af", "e18482e185a8e186ba"],
+ ["eb85af", "eb859ce186ba"],
+ ["eb85b0", "e18482e185a8e186bb"],
+ ["eb85b0", "eb859ce186bb"],
+ ["eb85b1", "e18482e185a8e186bc"],
+ ["eb85b1", "eb859ce186bc"],
+ ["eb85b2", "e18482e185a8e186bd"],
+ ["eb85b2", "eb859ce186bd"],
+ ["eb85b3", "e18482e185a8e186be"],
+ ["eb85b3", "eb859ce186be"],
+ ["eb85b4", "e18482e185a8e186bf"],
+ ["eb85b4", "eb859ce186bf"],
+ ["eb85b5", "e18482e185a8e18780"],
+ ["eb85b5", "eb859ce18780"],
+ ["eb85b6", "e18482e185a8e18781"],
+ ["eb85b6", "eb859ce18781"],
+ ["eb85b7", "e18482e185a8e18782"],
+ ["eb85b7", "eb859ce18782"],
+ ["eb85b8", "e18482e185a9"],
+ ["eb85b9", "e18482e185a9e186a8"],
+ ["eb85b9", "eb85b8e186a8"],
+ ["eb85ba", "e18482e185a9e186a9"],
+ ["eb85ba", "eb85b8e186a9"],
+ ["eb85bb", "e18482e185a9e186aa"],
+ ["eb85bb", "eb85b8e186aa"],
+ ["eb85bc", "e18482e185a9e186ab"],
+ ["eb85bc", "eb85b8e186ab"],
+ ["eb85bd", "e18482e185a9e186ac"],
+ ["eb85bd", "eb85b8e186ac"],
+ ["eb85be", "e18482e185a9e186ad"],
+ ["eb85be", "eb85b8e186ad"],
+ ["eb85bf", "e18482e185a9e186ae"],
+ ["eb85bf", "eb85b8e186ae"],
+ ["eb8680", "e18482e185a9e186af"],
+ ["eb8680", "eb85b8e186af"],
+ ["eb8681", "e18482e185a9e186b0"],
+ ["eb8681", "eb85b8e186b0"],
+ ["eb8682", "e18482e185a9e186b1"],
+ ["eb8682", "eb85b8e186b1"],
+ ["eb8683", "e18482e185a9e186b2"],
+ ["eb8683", "eb85b8e186b2"],
+ ["eb8684", "e18482e185a9e186b3"],
+ ["eb8684", "eb85b8e186b3"],
+ ["eb8685", "e18482e185a9e186b4"],
+ ["eb8685", "eb85b8e186b4"],
+ ["eb8686", "e18482e185a9e186b5"],
+ ["eb8686", "eb85b8e186b5"],
+ ["eb8687", "e18482e185a9e186b6"],
+ ["eb8687", "eb85b8e186b6"],
+ ["eb8688", "e18482e185a9e186b7"],
+ ["eb8688", "eb85b8e186b7"],
+ ["eb8689", "e18482e185a9e186b8"],
+ ["eb8689", "eb85b8e186b8"],
+ ["eb868a", "e18482e185a9e186b9"],
+ ["eb868a", "eb85b8e186b9"],
+ ["eb868b", "e18482e185a9e186ba"],
+ ["eb868b", "eb85b8e186ba"],
+ ["eb868c", "e18482e185a9e186bb"],
+ ["eb868c", "eb85b8e186bb"],
+ ["eb868d", "e18482e185a9e186bc"],
+ ["eb868d", "eb85b8e186bc"],
+ ["eb868e", "e18482e185a9e186bd"],
+ ["eb868e", "eb85b8e186bd"],
+ ["eb868f", "e18482e185a9e186be"],
+ ["eb868f", "eb85b8e186be"],
+ ["eb8690", "e18482e185a9e186bf"],
+ ["eb8690", "eb85b8e186bf"],
+ ["eb8691", "e18482e185a9e18780"],
+ ["eb8691", "eb85b8e18780"],
+ ["eb8692", "e18482e185a9e18781"],
+ ["eb8692", "eb85b8e18781"],
+ ["eb8693", "e18482e185a9e18782"],
+ ["eb8693", "eb85b8e18782"],
+ ["eb8694", "e18482e185aa"],
+ ["eb8695", "e18482e185aae186a8"],
+ ["eb8695", "eb8694e186a8"],
+ ["eb8696", "e18482e185aae186a9"],
+ ["eb8696", "eb8694e186a9"],
+ ["eb8697", "e18482e185aae186aa"],
+ ["eb8697", "eb8694e186aa"],
+ ["eb8698", "e18482e185aae186ab"],
+ ["eb8698", "eb8694e186ab"],
+ ["eb8699", "e18482e185aae186ac"],
+ ["eb8699", "eb8694e186ac"],
+ ["eb869a", "e18482e185aae186ad"],
+ ["eb869a", "eb8694e186ad"],
+ ["eb869b", "e18482e185aae186ae"],
+ ["eb869b", "eb8694e186ae"],
+ ["eb869c", "e18482e185aae186af"],
+ ["eb869c", "eb8694e186af"],
+ ["eb869d", "e18482e185aae186b0"],
+ ["eb869d", "eb8694e186b0"],
+ ["eb869e", "e18482e185aae186b1"],
+ ["eb869e", "eb8694e186b1"],
+ ["eb869f", "e18482e185aae186b2"],
+ ["eb869f", "eb8694e186b2"],
+ ["eb86a0", "e18482e185aae186b3"],
+ ["eb86a0", "eb8694e186b3"],
+ ["eb86a1", "e18482e185aae186b4"],
+ ["eb86a1", "eb8694e186b4"],
+ ["eb86a2", "e18482e185aae186b5"],
+ ["eb86a2", "eb8694e186b5"],
+ ["eb86a3", "e18482e185aae186b6"],
+ ["eb86a3", "eb8694e186b6"],
+ ["eb86a4", "e18482e185aae186b7"],
+ ["eb86a4", "eb8694e186b7"],
+ ["eb86a5", "e18482e185aae186b8"],
+ ["eb86a5", "eb8694e186b8"],
+ ["eb86a6", "e18482e185aae186b9"],
+ ["eb86a6", "eb8694e186b9"],
+ ["eb86a7", "e18482e185aae186ba"],
+ ["eb86a7", "eb8694e186ba"],
+ ["eb86a8", "e18482e185aae186bb"],
+ ["eb86a8", "eb8694e186bb"],
+ ["eb86a9", "e18482e185aae186bc"],
+ ["eb86a9", "eb8694e186bc"],
+ ["eb86aa", "e18482e185aae186bd"],
+ ["eb86aa", "eb8694e186bd"],
+ ["eb86ab", "e18482e185aae186be"],
+ ["eb86ab", "eb8694e186be"],
+ ["eb86ac", "e18482e185aae186bf"],
+ ["eb86ac", "eb8694e186bf"],
+ ["eb86ad", "e18482e185aae18780"],
+ ["eb86ad", "eb8694e18780"],
+ ["eb86ae", "e18482e185aae18781"],
+ ["eb86ae", "eb8694e18781"],
+ ["eb86af", "e18482e185aae18782"],
+ ["eb86af", "eb8694e18782"],
+ ["eb86b0", "e18482e185ab"],
+ ["eb86b1", "e18482e185abe186a8"],
+ ["eb86b1", "eb86b0e186a8"],
+ ["eb86b2", "e18482e185abe186a9"],
+ ["eb86b2", "eb86b0e186a9"],
+ ["eb86b3", "e18482e185abe186aa"],
+ ["eb86b3", "eb86b0e186aa"],
+ ["eb86b4", "e18482e185abe186ab"],
+ ["eb86b4", "eb86b0e186ab"],
+ ["eb86b5", "e18482e185abe186ac"],
+ ["eb86b5", "eb86b0e186ac"],
+ ["eb86b6", "e18482e185abe186ad"],
+ ["eb86b6", "eb86b0e186ad"],
+ ["eb86b7", "e18482e185abe186ae"],
+ ["eb86b7", "eb86b0e186ae"],
+ ["eb86b8", "e18482e185abe186af"],
+ ["eb86b8", "eb86b0e186af"],
+ ["eb86b9", "e18482e185abe186b0"],
+ ["eb86b9", "eb86b0e186b0"],
+ ["eb86ba", "e18482e185abe186b1"],
+ ["eb86ba", "eb86b0e186b1"],
+ ["eb86bb", "e18482e185abe186b2"],
+ ["eb86bb", "eb86b0e186b2"],
+ ["eb86bc", "e18482e185abe186b3"],
+ ["eb86bc", "eb86b0e186b3"],
+ ["eb86bd", "e18482e185abe186b4"],
+ ["eb86bd", "eb86b0e186b4"],
+ ["eb86be", "e18482e185abe186b5"],
+ ["eb86be", "eb86b0e186b5"],
+ ["eb86bf", "e18482e185abe186b6"],
+ ["eb86bf", "eb86b0e186b6"],
+ ["eb8780", "e18482e185abe186b7"],
+ ["eb8780", "eb86b0e186b7"],
+ ["eb8781", "e18482e185abe186b8"],
+ ["eb8781", "eb86b0e186b8"],
+ ["eb8782", "e18482e185abe186b9"],
+ ["eb8782", "eb86b0e186b9"],
+ ["eb8783", "e18482e185abe186ba"],
+ ["eb8783", "eb86b0e186ba"],
+ ["eb8784", "e18482e185abe186bb"],
+ ["eb8784", "eb86b0e186bb"],
+ ["eb8785", "e18482e185abe186bc"],
+ ["eb8785", "eb86b0e186bc"],
+ ["eb8786", "e18482e185abe186bd"],
+ ["eb8786", "eb86b0e186bd"],
+ ["eb8787", "e18482e185abe186be"],
+ ["eb8787", "eb86b0e186be"],
+ ["eb8788", "e18482e185abe186bf"],
+ ["eb8788", "eb86b0e186bf"],
+ ["eb8789", "e18482e185abe18780"],
+ ["eb8789", "eb86b0e18780"],
+ ["eb878a", "e18482e185abe18781"],
+ ["eb878a", "eb86b0e18781"],
+ ["eb878b", "e18482e185abe18782"],
+ ["eb878b", "eb86b0e18782"],
+ ["eb878c", "e18482e185ac"],
+ ["eb878d", "e18482e185ace186a8"],
+ ["eb878d", "eb878ce186a8"],
+ ["eb878e", "e18482e185ace186a9"],
+ ["eb878e", "eb878ce186a9"],
+ ["eb878f", "e18482e185ace186aa"],
+ ["eb878f", "eb878ce186aa"],
+ ["eb8790", "e18482e185ace186ab"],
+ ["eb8790", "eb878ce186ab"],
+ ["eb8791", "e18482e185ace186ac"],
+ ["eb8791", "eb878ce186ac"],
+ ["eb8792", "e18482e185ace186ad"],
+ ["eb8792", "eb878ce186ad"],
+ ["eb8793", "e18482e185ace186ae"],
+ ["eb8793", "eb878ce186ae"],
+ ["eb8794", "e18482e185ace186af"],
+ ["eb8794", "eb878ce186af"],
+ ["eb8795", "e18482e185ace186b0"],
+ ["eb8795", "eb878ce186b0"],
+ ["eb8796", "e18482e185ace186b1"],
+ ["eb8796", "eb878ce186b1"],
+ ["eb8797", "e18482e185ace186b2"],
+ ["eb8797", "eb878ce186b2"],
+ ["eb8798", "e18482e185ace186b3"],
+ ["eb8798", "eb878ce186b3"],
+ ["eb8799", "e18482e185ace186b4"],
+ ["eb8799", "eb878ce186b4"],
+ ["eb879a", "e18482e185ace186b5"],
+ ["eb879a", "eb878ce186b5"],
+ ["eb879b", "e18482e185ace186b6"],
+ ["eb879b", "eb878ce186b6"],
+ ["eb879c", "e18482e185ace186b7"],
+ ["eb879c", "eb878ce186b7"],
+ ["eb879d", "e18482e185ace186b8"],
+ ["eb879d", "eb878ce186b8"],
+ ["eb879e", "e18482e185ace186b9"],
+ ["eb879e", "eb878ce186b9"],
+ ["eb879f", "e18482e185ace186ba"],
+ ["eb879f", "eb878ce186ba"],
+ ["eb87a0", "e18482e185ace186bb"],
+ ["eb87a0", "eb878ce186bb"],
+ ["eb87a1", "e18482e185ace186bc"],
+ ["eb87a1", "eb878ce186bc"],
+ ["eb87a2", "e18482e185ace186bd"],
+ ["eb87a2", "eb878ce186bd"],
+ ["eb87a3", "e18482e185ace186be"],
+ ["eb87a3", "eb878ce186be"],
+ ["eb87a4", "e18482e185ace186bf"],
+ ["eb87a4", "eb878ce186bf"],
+ ["eb87a5", "e18482e185ace18780"],
+ ["eb87a5", "eb878ce18780"],
+ ["eb87a6", "e18482e185ace18781"],
+ ["eb87a6", "eb878ce18781"],
+ ["eb87a7", "e18482e185ace18782"],
+ ["eb87a7", "eb878ce18782"],
+ ["eb87a8", "e18482e185ad"],
+ ["eb87a9", "e18482e185ade186a8"],
+ ["eb87a9", "eb87a8e186a8"],
+ ["eb87aa", "e18482e185ade186a9"],
+ ["eb87aa", "eb87a8e186a9"],
+ ["eb87ab", "e18482e185ade186aa"],
+ ["eb87ab", "eb87a8e186aa"],
+ ["eb87ac", "e18482e185ade186ab"],
+ ["eb87ac", "eb87a8e186ab"],
+ ["eb87ad", "e18482e185ade186ac"],
+ ["eb87ad", "eb87a8e186ac"],
+ ["eb87ae", "e18482e185ade186ad"],
+ ["eb87ae", "eb87a8e186ad"],
+ ["eb87af", "e18482e185ade186ae"],
+ ["eb87af", "eb87a8e186ae"],
+ ["eb87b0", "e18482e185ade186af"],
+ ["eb87b0", "eb87a8e186af"],
+ ["eb87b1", "e18482e185ade186b0"],
+ ["eb87b1", "eb87a8e186b0"],
+ ["eb87b2", "e18482e185ade186b1"],
+ ["eb87b2", "eb87a8e186b1"],
+ ["eb87b3", "e18482e185ade186b2"],
+ ["eb87b3", "eb87a8e186b2"],
+ ["eb87b4", "e18482e185ade186b3"],
+ ["eb87b4", "eb87a8e186b3"],
+ ["eb87b5", "e18482e185ade186b4"],
+ ["eb87b5", "eb87a8e186b4"],
+ ["eb87b6", "e18482e185ade186b5"],
+ ["eb87b6", "eb87a8e186b5"],
+ ["eb87b7", "e18482e185ade186b6"],
+ ["eb87b7", "eb87a8e186b6"],
+ ["eb87b8", "e18482e185ade186b7"],
+ ["eb87b8", "eb87a8e186b7"],
+ ["eb87b9", "e18482e185ade186b8"],
+ ["eb87b9", "eb87a8e186b8"],
+ ["eb87ba", "e18482e185ade186b9"],
+ ["eb87ba", "eb87a8e186b9"],
+ ["eb87bb", "e18482e185ade186ba"],
+ ["eb87bb", "eb87a8e186ba"],
+ ["eb87bc", "e18482e185ade186bb"],
+ ["eb87bc", "eb87a8e186bb"],
+ ["eb87bd", "e18482e185ade186bc"],
+ ["eb87bd", "eb87a8e186bc"],
+ ["eb87be", "e18482e185ade186bd"],
+ ["eb87be", "eb87a8e186bd"],
+ ["eb87bf", "e18482e185ade186be"],
+ ["eb87bf", "eb87a8e186be"],
+ ["eb8880", "e18482e185ade186bf"],
+ ["eb8880", "eb87a8e186bf"],
+ ["eb8881", "e18482e185ade18780"],
+ ["eb8881", "eb87a8e18780"],
+ ["eb8882", "e18482e185ade18781"],
+ ["eb8882", "eb87a8e18781"],
+ ["eb8883", "e18482e185ade18782"],
+ ["eb8883", "eb87a8e18782"],
+ ["eb8884", "e18482e185ae"],
+ ["eb8885", "e18482e185aee186a8"],
+ ["eb8885", "eb8884e186a8"],
+ ["eb8886", "e18482e185aee186a9"],
+ ["eb8886", "eb8884e186a9"],
+ ["eb8887", "e18482e185aee186aa"],
+ ["eb8887", "eb8884e186aa"],
+ ["eb8888", "e18482e185aee186ab"],
+ ["eb8888", "eb8884e186ab"],
+ ["eb8889", "e18482e185aee186ac"],
+ ["eb8889", "eb8884e186ac"],
+ ["eb888a", "e18482e185aee186ad"],
+ ["eb888a", "eb8884e186ad"],
+ ["eb888b", "e18482e185aee186ae"],
+ ["eb888b", "eb8884e186ae"],
+ ["eb888c", "e18482e185aee186af"],
+ ["eb888c", "eb8884e186af"],
+ ["eb888d", "e18482e185aee186b0"],
+ ["eb888d", "eb8884e186b0"],
+ ["eb888e", "e18482e185aee186b1"],
+ ["eb888e", "eb8884e186b1"],
+ ["eb888f", "e18482e185aee186b2"],
+ ["eb888f", "eb8884e186b2"],
+ ["eb8890", "e18482e185aee186b3"],
+ ["eb8890", "eb8884e186b3"],
+ ["eb8891", "e18482e185aee186b4"],
+ ["eb8891", "eb8884e186b4"],
+ ["eb8892", "e18482e185aee186b5"],
+ ["eb8892", "eb8884e186b5"],
+ ["eb8893", "e18482e185aee186b6"],
+ ["eb8893", "eb8884e186b6"],
+ ["eb8894", "e18482e185aee186b7"],
+ ["eb8894", "eb8884e186b7"],
+ ["eb8895", "e18482e185aee186b8"],
+ ["eb8895", "eb8884e186b8"],
+ ["eb8896", "e18482e185aee186b9"],
+ ["eb8896", "eb8884e186b9"],
+ ["eb8897", "e18482e185aee186ba"],
+ ["eb8897", "eb8884e186ba"],
+ ["eb8898", "e18482e185aee186bb"],
+ ["eb8898", "eb8884e186bb"],
+ ["eb8899", "e18482e185aee186bc"],
+ ["eb8899", "eb8884e186bc"],
+ ["eb889a", "e18482e185aee186bd"],
+ ["eb889a", "eb8884e186bd"],
+ ["eb889b", "e18482e185aee186be"],
+ ["eb889b", "eb8884e186be"],
+ ["eb889c", "e18482e185aee186bf"],
+ ["eb889c", "eb8884e186bf"],
+ ["eb889d", "e18482e185aee18780"],
+ ["eb889d", "eb8884e18780"],
+ ["eb889e", "e18482e185aee18781"],
+ ["eb889e", "eb8884e18781"],
+ ["eb889f", "e18482e185aee18782"],
+ ["eb889f", "eb8884e18782"],
+ ["eb88a0", "e18482e185af"],
+ ["eb88a1", "e18482e185afe186a8"],
+ ["eb88a1", "eb88a0e186a8"],
+ ["eb88a2", "e18482e185afe186a9"],
+ ["eb88a2", "eb88a0e186a9"],
+ ["eb88a3", "e18482e185afe186aa"],
+ ["eb88a3", "eb88a0e186aa"],
+ ["eb88a4", "e18482e185afe186ab"],
+ ["eb88a4", "eb88a0e186ab"],
+ ["eb88a5", "e18482e185afe186ac"],
+ ["eb88a5", "eb88a0e186ac"],
+ ["eb88a6", "e18482e185afe186ad"],
+ ["eb88a6", "eb88a0e186ad"],
+ ["eb88a7", "e18482e185afe186ae"],
+ ["eb88a7", "eb88a0e186ae"],
+ ["eb88a8", "e18482e185afe186af"],
+ ["eb88a8", "eb88a0e186af"],
+ ["eb88a9", "e18482e185afe186b0"],
+ ["eb88a9", "eb88a0e186b0"],
+ ["eb88aa", "e18482e185afe186b1"],
+ ["eb88aa", "eb88a0e186b1"],
+ ["eb88ab", "e18482e185afe186b2"],
+ ["eb88ab", "eb88a0e186b2"],
+ ["eb88ac", "e18482e185afe186b3"],
+ ["eb88ac", "eb88a0e186b3"],
+ ["eb88ad", "e18482e185afe186b4"],
+ ["eb88ad", "eb88a0e186b4"],
+ ["eb88ae", "e18482e185afe186b5"],
+ ["eb88ae", "eb88a0e186b5"],
+ ["eb88af", "e18482e185afe186b6"],
+ ["eb88af", "eb88a0e186b6"],
+ ["eb88b0", "e18482e185afe186b7"],
+ ["eb88b0", "eb88a0e186b7"],
+ ["eb88b1", "e18482e185afe186b8"],
+ ["eb88b1", "eb88a0e186b8"],
+ ["eb88b2", "e18482e185afe186b9"],
+ ["eb88b2", "eb88a0e186b9"],
+ ["eb88b3", "e18482e185afe186ba"],
+ ["eb88b3", "eb88a0e186ba"],
+ ["eb88b4", "e18482e185afe186bb"],
+ ["eb88b4", "eb88a0e186bb"],
+ ["eb88b5", "e18482e185afe186bc"],
+ ["eb88b5", "eb88a0e186bc"],
+ ["eb88b6", "e18482e185afe186bd"],
+ ["eb88b6", "eb88a0e186bd"],
+ ["eb88b7", "e18482e185afe186be"],
+ ["eb88b7", "eb88a0e186be"],
+ ["eb88b8", "e18482e185afe186bf"],
+ ["eb88b8", "eb88a0e186bf"],
+ ["eb88b9", "e18482e185afe18780"],
+ ["eb88b9", "eb88a0e18780"],
+ ["eb88ba", "e18482e185afe18781"],
+ ["eb88ba", "eb88a0e18781"],
+ ["eb88bb", "e18482e185afe18782"],
+ ["eb88bb", "eb88a0e18782"],
+ ["eb88bc", "e18482e185b0"],
+ ["eb88bd", "e18482e185b0e186a8"],
+ ["eb88bd", "eb88bce186a8"],
+ ["eb88be", "e18482e185b0e186a9"],
+ ["eb88be", "eb88bce186a9"],
+ ["eb88bf", "e18482e185b0e186aa"],
+ ["eb88bf", "eb88bce186aa"],
+ ["eb8980", "e18482e185b0e186ab"],
+ ["eb8980", "eb88bce186ab"],
+ ["eb8981", "e18482e185b0e186ac"],
+ ["eb8981", "eb88bce186ac"],
+ ["eb8982", "e18482e185b0e186ad"],
+ ["eb8982", "eb88bce186ad"],
+ ["eb8983", "e18482e185b0e186ae"],
+ ["eb8983", "eb88bce186ae"],
+ ["eb8984", "e18482e185b0e186af"],
+ ["eb8984", "eb88bce186af"],
+ ["eb8985", "e18482e185b0e186b0"],
+ ["eb8985", "eb88bce186b0"],
+ ["eb8986", "e18482e185b0e186b1"],
+ ["eb8986", "eb88bce186b1"],
+ ["eb8987", "e18482e185b0e186b2"],
+ ["eb8987", "eb88bce186b2"],
+ ["eb8988", "e18482e185b0e186b3"],
+ ["eb8988", "eb88bce186b3"],
+ ["eb8989", "e18482e185b0e186b4"],
+ ["eb8989", "eb88bce186b4"],
+ ["eb898a", "e18482e185b0e186b5"],
+ ["eb898a", "eb88bce186b5"],
+ ["eb898b", "e18482e185b0e186b6"],
+ ["eb898b", "eb88bce186b6"],
+ ["eb898c", "e18482e185b0e186b7"],
+ ["eb898c", "eb88bce186b7"],
+ ["eb898d", "e18482e185b0e186b8"],
+ ["eb898d", "eb88bce186b8"],
+ ["eb898e", "e18482e185b0e186b9"],
+ ["eb898e", "eb88bce186b9"],
+ ["eb898f", "e18482e185b0e186ba"],
+ ["eb898f", "eb88bce186ba"],
+ ["eb8990", "e18482e185b0e186bb"],
+ ["eb8990", "eb88bce186bb"],
+ ["eb8991", "e18482e185b0e186bc"],
+ ["eb8991", "eb88bce186bc"],
+ ["eb8992", "e18482e185b0e186bd"],
+ ["eb8992", "eb88bce186bd"],
+ ["eb8993", "e18482e185b0e186be"],
+ ["eb8993", "eb88bce186be"],
+ ["eb8994", "e18482e185b0e186bf"],
+ ["eb8994", "eb88bce186bf"],
+ ["eb8995", "e18482e185b0e18780"],
+ ["eb8995", "eb88bce18780"],
+ ["eb8996", "e18482e185b0e18781"],
+ ["eb8996", "eb88bce18781"],
+ ["eb8997", "e18482e185b0e18782"],
+ ["eb8997", "eb88bce18782"],
+ ["eb8998", "e18482e185b1"],
+ ["eb8999", "e18482e185b1e186a8"],
+ ["eb8999", "eb8998e186a8"],
+ ["eb899a", "e18482e185b1e186a9"],
+ ["eb899a", "eb8998e186a9"],
+ ["eb899b", "e18482e185b1e186aa"],
+ ["eb899b", "eb8998e186aa"],
+ ["eb899c", "e18482e185b1e186ab"],
+ ["eb899c", "eb8998e186ab"],
+ ["eb899d", "e18482e185b1e186ac"],
+ ["eb899d", "eb8998e186ac"],
+ ["eb899e", "e18482e185b1e186ad"],
+ ["eb899e", "eb8998e186ad"],
+ ["eb899f", "e18482e185b1e186ae"],
+ ["eb899f", "eb8998e186ae"],
+ ["eb89a0", "e18482e185b1e186af"],
+ ["eb89a0", "eb8998e186af"],
+ ["eb89a1", "e18482e185b1e186b0"],
+ ["eb89a1", "eb8998e186b0"],
+ ["eb89a2", "e18482e185b1e186b1"],
+ ["eb89a2", "eb8998e186b1"],
+ ["eb89a3", "e18482e185b1e186b2"],
+ ["eb89a3", "eb8998e186b2"],
+ ["eb89a4", "e18482e185b1e186b3"],
+ ["eb89a4", "eb8998e186b3"],
+ ["eb89a5", "e18482e185b1e186b4"],
+ ["eb89a5", "eb8998e186b4"],
+ ["eb89a6", "e18482e185b1e186b5"],
+ ["eb89a6", "eb8998e186b5"],
+ ["eb89a7", "e18482e185b1e186b6"],
+ ["eb89a7", "eb8998e186b6"],
+ ["eb89a8", "e18482e185b1e186b7"],
+ ["eb89a8", "eb8998e186b7"],
+ ["eb89a9", "e18482e185b1e186b8"],
+ ["eb89a9", "eb8998e186b8"],
+ ["eb89aa", "e18482e185b1e186b9"],
+ ["eb89aa", "eb8998e186b9"],
+ ["eb89ab", "e18482e185b1e186ba"],
+ ["eb89ab", "eb8998e186ba"],
+ ["eb89ac", "e18482e185b1e186bb"],
+ ["eb89ac", "eb8998e186bb"],
+ ["eb89ad", "e18482e185b1e186bc"],
+ ["eb89ad", "eb8998e186bc"],
+ ["eb89ae", "e18482e185b1e186bd"],
+ ["eb89ae", "eb8998e186bd"],
+ ["eb89af", "e18482e185b1e186be"],
+ ["eb89af", "eb8998e186be"],
+ ["eb89b0", "e18482e185b1e186bf"],
+ ["eb89b0", "eb8998e186bf"],
+ ["eb89b1", "e18482e185b1e18780"],
+ ["eb89b1", "eb8998e18780"],
+ ["eb89b2", "e18482e185b1e18781"],
+ ["eb89b2", "eb8998e18781"],
+ ["eb89b3", "e18482e185b1e18782"],
+ ["eb89b3", "eb8998e18782"],
+ ["eb89b4", "e18482e185b2"],
+ ["eb89b5", "e18482e185b2e186a8"],
+ ["eb89b5", "eb89b4e186a8"],
+ ["eb89b6", "e18482e185b2e186a9"],
+ ["eb89b6", "eb89b4e186a9"],
+ ["eb89b7", "e18482e185b2e186aa"],
+ ["eb89b7", "eb89b4e186aa"],
+ ["eb89b8", "e18482e185b2e186ab"],
+ ["eb89b8", "eb89b4e186ab"],
+ ["eb89b9", "e18482e185b2e186ac"],
+ ["eb89b9", "eb89b4e186ac"],
+ ["eb89ba", "e18482e185b2e186ad"],
+ ["eb89ba", "eb89b4e186ad"],
+ ["eb89bb", "e18482e185b2e186ae"],
+ ["eb89bb", "eb89b4e186ae"],
+ ["eb89bc", "e18482e185b2e186af"],
+ ["eb89bc", "eb89b4e186af"],
+ ["eb89bd", "e18482e185b2e186b0"],
+ ["eb89bd", "eb89b4e186b0"],
+ ["eb89be", "e18482e185b2e186b1"],
+ ["eb89be", "eb89b4e186b1"],
+ ["eb89bf", "e18482e185b2e186b2"],
+ ["eb89bf", "eb89b4e186b2"],
+ ["eb8a80", "e18482e185b2e186b3"],
+ ["eb8a80", "eb89b4e186b3"],
+ ["eb8a81", "e18482e185b2e186b4"],
+ ["eb8a81", "eb89b4e186b4"],
+ ["eb8a82", "e18482e185b2e186b5"],
+ ["eb8a82", "eb89b4e186b5"],
+ ["eb8a83", "e18482e185b2e186b6"],
+ ["eb8a83", "eb89b4e186b6"],
+ ["eb8a84", "e18482e185b2e186b7"],
+ ["eb8a84", "eb89b4e186b7"],
+ ["eb8a85", "e18482e185b2e186b8"],
+ ["eb8a85", "eb89b4e186b8"],
+ ["eb8a86", "e18482e185b2e186b9"],
+ ["eb8a86", "eb89b4e186b9"],
+ ["eb8a87", "e18482e185b2e186ba"],
+ ["eb8a87", "eb89b4e186ba"],
+ ["eb8a88", "e18482e185b2e186bb"],
+ ["eb8a88", "eb89b4e186bb"],
+ ["eb8a89", "e18482e185b2e186bc"],
+ ["eb8a89", "eb89b4e186bc"],
+ ["eb8a8a", "e18482e185b2e186bd"],
+ ["eb8a8a", "eb89b4e186bd"],
+ ["eb8a8b", "e18482e185b2e186be"],
+ ["eb8a8b", "eb89b4e186be"],
+ ["eb8a8c", "e18482e185b2e186bf"],
+ ["eb8a8c", "eb89b4e186bf"],
+ ["eb8a8d", "e18482e185b2e18780"],
+ ["eb8a8d", "eb89b4e18780"],
+ ["eb8a8e", "e18482e185b2e18781"],
+ ["eb8a8e", "eb89b4e18781"],
+ ["eb8a8f", "e18482e185b2e18782"],
+ ["eb8a8f", "eb89b4e18782"],
+ ["eb8a90", "e18482e185b3"],
+ ["eb8a91", "e18482e185b3e186a8"],
+ ["eb8a91", "eb8a90e186a8"],
+ ["eb8a92", "e18482e185b3e186a9"],
+ ["eb8a92", "eb8a90e186a9"],
+ ["eb8a93", "e18482e185b3e186aa"],
+ ["eb8a93", "eb8a90e186aa"],
+ ["eb8a94", "e18482e185b3e186ab"],
+ ["eb8a94", "eb8a90e186ab"],
+ ["eb8a95", "e18482e185b3e186ac"],
+ ["eb8a95", "eb8a90e186ac"],
+ ["eb8a96", "e18482e185b3e186ad"],
+ ["eb8a96", "eb8a90e186ad"],
+ ["eb8a97", "e18482e185b3e186ae"],
+ ["eb8a97", "eb8a90e186ae"],
+ ["eb8a98", "e18482e185b3e186af"],
+ ["eb8a98", "eb8a90e186af"],
+ ["eb8a99", "e18482e185b3e186b0"],
+ ["eb8a99", "eb8a90e186b0"],
+ ["eb8a9a", "e18482e185b3e186b1"],
+ ["eb8a9a", "eb8a90e186b1"],
+ ["eb8a9b", "e18482e185b3e186b2"],
+ ["eb8a9b", "eb8a90e186b2"],
+ ["eb8a9c", "e18482e185b3e186b3"],
+ ["eb8a9c", "eb8a90e186b3"],
+ ["eb8a9d", "e18482e185b3e186b4"],
+ ["eb8a9d", "eb8a90e186b4"],
+ ["eb8a9e", "e18482e185b3e186b5"],
+ ["eb8a9e", "eb8a90e186b5"],
+ ["eb8a9f", "e18482e185b3e186b6"],
+ ["eb8a9f", "eb8a90e186b6"],
+ ["eb8aa0", "e18482e185b3e186b7"],
+ ["eb8aa0", "eb8a90e186b7"],
+ ["eb8aa1", "e18482e185b3e186b8"],
+ ["eb8aa1", "eb8a90e186b8"],
+ ["eb8aa2", "e18482e185b3e186b9"],
+ ["eb8aa2", "eb8a90e186b9"],
+ ["eb8aa3", "e18482e185b3e186ba"],
+ ["eb8aa3", "eb8a90e186ba"],
+ ["eb8aa4", "e18482e185b3e186bb"],
+ ["eb8aa4", "eb8a90e186bb"],
+ ["eb8aa5", "e18482e185b3e186bc"],
+ ["eb8aa5", "eb8a90e186bc"],
+ ["eb8aa6", "e18482e185b3e186bd"],
+ ["eb8aa6", "eb8a90e186bd"],
+ ["eb8aa7", "e18482e185b3e186be"],
+ ["eb8aa7", "eb8a90e186be"],
+ ["eb8aa8", "e18482e185b3e186bf"],
+ ["eb8aa8", "eb8a90e186bf"],
+ ["eb8aa9", "e18482e185b3e18780"],
+ ["eb8aa9", "eb8a90e18780"],
+ ["eb8aaa", "e18482e185b3e18781"],
+ ["eb8aaa", "eb8a90e18781"],
+ ["eb8aab", "e18482e185b3e18782"],
+ ["eb8aab", "eb8a90e18782"],
+ ["eb8aac", "e18482e185b4"],
+ ["eb8aad", "e18482e185b4e186a8"],
+ ["eb8aad", "eb8aace186a8"],
+ ["eb8aae", "e18482e185b4e186a9"],
+ ["eb8aae", "eb8aace186a9"],
+ ["eb8aaf", "e18482e185b4e186aa"],
+ ["eb8aaf", "eb8aace186aa"],
+ ["eb8ab0", "e18482e185b4e186ab"],
+ ["eb8ab0", "eb8aace186ab"],
+ ["eb8ab1", "e18482e185b4e186ac"],
+ ["eb8ab1", "eb8aace186ac"],
+ ["eb8ab2", "e18482e185b4e186ad"],
+ ["eb8ab2", "eb8aace186ad"],
+ ["eb8ab3", "e18482e185b4e186ae"],
+ ["eb8ab3", "eb8aace186ae"],
+ ["eb8ab4", "e18482e185b4e186af"],
+ ["eb8ab4", "eb8aace186af"],
+ ["eb8ab5", "e18482e185b4e186b0"],
+ ["eb8ab5", "eb8aace186b0"],
+ ["eb8ab6", "e18482e185b4e186b1"],
+ ["eb8ab6", "eb8aace186b1"],
+ ["eb8ab7", "e18482e185b4e186b2"],
+ ["eb8ab7", "eb8aace186b2"],
+ ["eb8ab8", "e18482e185b4e186b3"],
+ ["eb8ab8", "eb8aace186b3"],
+ ["eb8ab9", "e18482e185b4e186b4"],
+ ["eb8ab9", "eb8aace186b4"],
+ ["eb8aba", "e18482e185b4e186b5"],
+ ["eb8aba", "eb8aace186b5"],
+ ["eb8abb", "e18482e185b4e186b6"],
+ ["eb8abb", "eb8aace186b6"],
+ ["eb8abc", "e18482e185b4e186b7"],
+ ["eb8abc", "eb8aace186b7"],
+ ["eb8abd", "e18482e185b4e186b8"],
+ ["eb8abd", "eb8aace186b8"],
+ ["eb8abe", "e18482e185b4e186b9"],
+ ["eb8abe", "eb8aace186b9"],
+ ["eb8abf", "e18482e185b4e186ba"],
+ ["eb8abf", "eb8aace186ba"],
+ ["eb8b80", "e18482e185b4e186bb"],
+ ["eb8b80", "eb8aace186bb"],
+ ["eb8b81", "e18482e185b4e186bc"],
+ ["eb8b81", "eb8aace186bc"],
+ ["eb8b82", "e18482e185b4e186bd"],
+ ["eb8b82", "eb8aace186bd"],
+ ["eb8b83", "e18482e185b4e186be"],
+ ["eb8b83", "eb8aace186be"],
+ ["eb8b84", "e18482e185b4e186bf"],
+ ["eb8b84", "eb8aace186bf"],
+ ["eb8b85", "e18482e185b4e18780"],
+ ["eb8b85", "eb8aace18780"],
+ ["eb8b86", "e18482e185b4e18781"],
+ ["eb8b86", "eb8aace18781"],
+ ["eb8b87", "e18482e185b4e18782"],
+ ["eb8b87", "eb8aace18782"],
+ ["eb8b88", "e18482e185b5"],
+ ["eb8b89", "e18482e185b5e186a8"],
+ ["eb8b89", "eb8b88e186a8"],
+ ["eb8b8a", "e18482e185b5e186a9"],
+ ["eb8b8a", "eb8b88e186a9"],
+ ["eb8b8b", "e18482e185b5e186aa"],
+ ["eb8b8b", "eb8b88e186aa"],
+ ["eb8b8c", "e18482e185b5e186ab"],
+ ["eb8b8c", "eb8b88e186ab"],
+ ["eb8b8d", "e18482e185b5e186ac"],
+ ["eb8b8d", "eb8b88e186ac"],
+ ["eb8b8e", "e18482e185b5e186ad"],
+ ["eb8b8e", "eb8b88e186ad"],
+ ["eb8b8f", "e18482e185b5e186ae"],
+ ["eb8b8f", "eb8b88e186ae"],
+ ["eb8b90", "e18482e185b5e186af"],
+ ["eb8b90", "eb8b88e186af"],
+ ["eb8b91", "e18482e185b5e186b0"],
+ ["eb8b91", "eb8b88e186b0"],
+ ["eb8b92", "e18482e185b5e186b1"],
+ ["eb8b92", "eb8b88e186b1"],
+ ["eb8b93", "e18482e185b5e186b2"],
+ ["eb8b93", "eb8b88e186b2"],
+ ["eb8b94", "e18482e185b5e186b3"],
+ ["eb8b94", "eb8b88e186b3"],
+ ["eb8b95", "e18482e185b5e186b4"],
+ ["eb8b95", "eb8b88e186b4"],
+ ["eb8b96", "e18482e185b5e186b5"],
+ ["eb8b96", "eb8b88e186b5"],
+ ["eb8b97", "e18482e185b5e186b6"],
+ ["eb8b97", "eb8b88e186b6"],
+ ["eb8b98", "e18482e185b5e186b7"],
+ ["eb8b98", "eb8b88e186b7"],
+ ["eb8b99", "e18482e185b5e186b8"],
+ ["eb8b99", "eb8b88e186b8"],
+ ["eb8b9a", "e18482e185b5e186b9"],
+ ["eb8b9a", "eb8b88e186b9"],
+ ["eb8b9b", "e18482e185b5e186ba"],
+ ["eb8b9b", "eb8b88e186ba"],
+ ["eb8b9c", "e18482e185b5e186bb"],
+ ["eb8b9c", "eb8b88e186bb"],
+ ["eb8b9d", "e18482e185b5e186bc"],
+ ["eb8b9d", "eb8b88e186bc"],
+ ["eb8b9e", "e18482e185b5e186bd"],
+ ["eb8b9e", "eb8b88e186bd"],
+ ["eb8b9f", "e18482e185b5e186be"],
+ ["eb8b9f", "eb8b88e186be"],
+ ["eb8ba0", "e18482e185b5e186bf"],
+ ["eb8ba0", "eb8b88e186bf"],
+ ["eb8ba1", "e18482e185b5e18780"],
+ ["eb8ba1", "eb8b88e18780"],
+ ["eb8ba2", "e18482e185b5e18781"],
+ ["eb8ba2", "eb8b88e18781"],
+ ["eb8ba3", "e18482e185b5e18782"],
+ ["eb8ba3", "eb8b88e18782"],
+ ["eb8ba4", "e18483e185a1"],
+ ["eb8ba5", "e18483e185a1e186a8"],
+ ["eb8ba5", "eb8ba4e186a8"],
+ ["eb8ba6", "e18483e185a1e186a9"],
+ ["eb8ba6", "eb8ba4e186a9"],
+ ["eb8ba7", "e18483e185a1e186aa"],
+ ["eb8ba7", "eb8ba4e186aa"],
+ ["eb8ba8", "e18483e185a1e186ab"],
+ ["eb8ba8", "eb8ba4e186ab"],
+ ["eb8ba9", "e18483e185a1e186ac"],
+ ["eb8ba9", "eb8ba4e186ac"],
+ ["eb8baa", "e18483e185a1e186ad"],
+ ["eb8baa", "eb8ba4e186ad"],
+ ["eb8bab", "e18483e185a1e186ae"],
+ ["eb8bab", "eb8ba4e186ae"],
+ ["eb8bac", "e18483e185a1e186af"],
+ ["eb8bac", "eb8ba4e186af"],
+ ["eb8bad", "e18483e185a1e186b0"],
+ ["eb8bad", "eb8ba4e186b0"],
+ ["eb8bae", "e18483e185a1e186b1"],
+ ["eb8bae", "eb8ba4e186b1"],
+ ["eb8baf", "e18483e185a1e186b2"],
+ ["eb8baf", "eb8ba4e186b2"],
+ ["eb8bb0", "e18483e185a1e186b3"],
+ ["eb8bb0", "eb8ba4e186b3"],
+ ["eb8bb1", "e18483e185a1e186b4"],
+ ["eb8bb1", "eb8ba4e186b4"],
+ ["eb8bb2", "e18483e185a1e186b5"],
+ ["eb8bb2", "eb8ba4e186b5"],
+ ["eb8bb3", "e18483e185a1e186b6"],
+ ["eb8bb3", "eb8ba4e186b6"],
+ ["eb8bb4", "e18483e185a1e186b7"],
+ ["eb8bb4", "eb8ba4e186b7"],
+ ["eb8bb5", "e18483e185a1e186b8"],
+ ["eb8bb5", "eb8ba4e186b8"],
+ ["eb8bb6", "e18483e185a1e186b9"],
+ ["eb8bb6", "eb8ba4e186b9"],
+ ["eb8bb7", "e18483e185a1e186ba"],
+ ["eb8bb7", "eb8ba4e186ba"],
+ ["eb8bb8", "e18483e185a1e186bb"],
+ ["eb8bb8", "eb8ba4e186bb"],
+ ["eb8bb9", "e18483e185a1e186bc"],
+ ["eb8bb9", "eb8ba4e186bc"],
+ ["eb8bba", "e18483e185a1e186bd"],
+ ["eb8bba", "eb8ba4e186bd"],
+ ["eb8bbb", "e18483e185a1e186be"],
+ ["eb8bbb", "eb8ba4e186be"],
+ ["eb8bbc", "e18483e185a1e186bf"],
+ ["eb8bbc", "eb8ba4e186bf"],
+ ["eb8bbd", "e18483e185a1e18780"],
+ ["eb8bbd", "eb8ba4e18780"],
+ ["eb8bbe", "e18483e185a1e18781"],
+ ["eb8bbe", "eb8ba4e18781"],
+ ["eb8bbf", "e18483e185a1e18782"],
+ ["eb8bbf", "eb8ba4e18782"],
+ ["eb8c80", "e18483e185a2"],
+ ["eb8c81", "e18483e185a2e186a8"],
+ ["eb8c81", "eb8c80e186a8"],
+ ["eb8c82", "e18483e185a2e186a9"],
+ ["eb8c82", "eb8c80e186a9"],
+ ["eb8c83", "e18483e185a2e186aa"],
+ ["eb8c83", "eb8c80e186aa"],
+ ["eb8c84", "e18483e185a2e186ab"],
+ ["eb8c84", "eb8c80e186ab"],
+ ["eb8c85", "e18483e185a2e186ac"],
+ ["eb8c85", "eb8c80e186ac"],
+ ["eb8c86", "e18483e185a2e186ad"],
+ ["eb8c86", "eb8c80e186ad"],
+ ["eb8c87", "e18483e185a2e186ae"],
+ ["eb8c87", "eb8c80e186ae"],
+ ["eb8c88", "e18483e185a2e186af"],
+ ["eb8c88", "eb8c80e186af"],
+ ["eb8c89", "e18483e185a2e186b0"],
+ ["eb8c89", "eb8c80e186b0"],
+ ["eb8c8a", "e18483e185a2e186b1"],
+ ["eb8c8a", "eb8c80e186b1"],
+ ["eb8c8b", "e18483e185a2e186b2"],
+ ["eb8c8b", "eb8c80e186b2"],
+ ["eb8c8c", "e18483e185a2e186b3"],
+ ["eb8c8c", "eb8c80e186b3"],
+ ["eb8c8d", "e18483e185a2e186b4"],
+ ["eb8c8d", "eb8c80e186b4"],
+ ["eb8c8e", "e18483e185a2e186b5"],
+ ["eb8c8e", "eb8c80e186b5"],
+ ["eb8c8f", "e18483e185a2e186b6"],
+ ["eb8c8f", "eb8c80e186b6"],
+ ["eb8c90", "e18483e185a2e186b7"],
+ ["eb8c90", "eb8c80e186b7"],
+ ["eb8c91", "e18483e185a2e186b8"],
+ ["eb8c91", "eb8c80e186b8"],
+ ["eb8c92", "e18483e185a2e186b9"],
+ ["eb8c92", "eb8c80e186b9"],
+ ["eb8c93", "e18483e185a2e186ba"],
+ ["eb8c93", "eb8c80e186ba"],
+ ["eb8c94", "e18483e185a2e186bb"],
+ ["eb8c94", "eb8c80e186bb"],
+ ["eb8c95", "e18483e185a2e186bc"],
+ ["eb8c95", "eb8c80e186bc"],
+ ["eb8c96", "e18483e185a2e186bd"],
+ ["eb8c96", "eb8c80e186bd"],
+ ["eb8c97", "e18483e185a2e186be"],
+ ["eb8c97", "eb8c80e186be"],
+ ["eb8c98", "e18483e185a2e186bf"],
+ ["eb8c98", "eb8c80e186bf"],
+ ["eb8c99", "e18483e185a2e18780"],
+ ["eb8c99", "eb8c80e18780"],
+ ["eb8c9a", "e18483e185a2e18781"],
+ ["eb8c9a", "eb8c80e18781"],
+ ["eb8c9b", "e18483e185a2e18782"],
+ ["eb8c9b", "eb8c80e18782"],
+ ["eb8c9c", "e18483e185a3"],
+ ["eb8c9d", "e18483e185a3e186a8"],
+ ["eb8c9d", "eb8c9ce186a8"],
+ ["eb8c9e", "e18483e185a3e186a9"],
+ ["eb8c9e", "eb8c9ce186a9"],
+ ["eb8c9f", "e18483e185a3e186aa"],
+ ["eb8c9f", "eb8c9ce186aa"],
+ ["eb8ca0", "e18483e185a3e186ab"],
+ ["eb8ca0", "eb8c9ce186ab"],
+ ["eb8ca1", "e18483e185a3e186ac"],
+ ["eb8ca1", "eb8c9ce186ac"],
+ ["eb8ca2", "e18483e185a3e186ad"],
+ ["eb8ca2", "eb8c9ce186ad"],
+ ["eb8ca3", "e18483e185a3e186ae"],
+ ["eb8ca3", "eb8c9ce186ae"],
+ ["eb8ca4", "e18483e185a3e186af"],
+ ["eb8ca4", "eb8c9ce186af"],
+ ["eb8ca5", "e18483e185a3e186b0"],
+ ["eb8ca5", "eb8c9ce186b0"],
+ ["eb8ca6", "e18483e185a3e186b1"],
+ ["eb8ca6", "eb8c9ce186b1"],
+ ["eb8ca7", "e18483e185a3e186b2"],
+ ["eb8ca7", "eb8c9ce186b2"],
+ ["eb8ca8", "e18483e185a3e186b3"],
+ ["eb8ca8", "eb8c9ce186b3"],
+ ["eb8ca9", "e18483e185a3e186b4"],
+ ["eb8ca9", "eb8c9ce186b4"],
+ ["eb8caa", "e18483e185a3e186b5"],
+ ["eb8caa", "eb8c9ce186b5"],
+ ["eb8cab", "e18483e185a3e186b6"],
+ ["eb8cab", "eb8c9ce186b6"],
+ ["eb8cac", "e18483e185a3e186b7"],
+ ["eb8cac", "eb8c9ce186b7"],
+ ["eb8cad", "e18483e185a3e186b8"],
+ ["eb8cad", "eb8c9ce186b8"],
+ ["eb8cae", "e18483e185a3e186b9"],
+ ["eb8cae", "eb8c9ce186b9"],
+ ["eb8caf", "e18483e185a3e186ba"],
+ ["eb8caf", "eb8c9ce186ba"],
+ ["eb8cb0", "e18483e185a3e186bb"],
+ ["eb8cb0", "eb8c9ce186bb"],
+ ["eb8cb1", "e18483e185a3e186bc"],
+ ["eb8cb1", "eb8c9ce186bc"],
+ ["eb8cb2", "e18483e185a3e186bd"],
+ ["eb8cb2", "eb8c9ce186bd"],
+ ["eb8cb3", "e18483e185a3e186be"],
+ ["eb8cb3", "eb8c9ce186be"],
+ ["eb8cb4", "e18483e185a3e186bf"],
+ ["eb8cb4", "eb8c9ce186bf"],
+ ["eb8cb5", "e18483e185a3e18780"],
+ ["eb8cb5", "eb8c9ce18780"],
+ ["eb8cb6", "e18483e185a3e18781"],
+ ["eb8cb6", "eb8c9ce18781"],
+ ["eb8cb7", "e18483e185a3e18782"],
+ ["eb8cb7", "eb8c9ce18782"],
+ ["eb8cb8", "e18483e185a4"],
+ ["eb8cb9", "e18483e185a4e186a8"],
+ ["eb8cb9", "eb8cb8e186a8"],
+ ["eb8cba", "e18483e185a4e186a9"],
+ ["eb8cba", "eb8cb8e186a9"],
+ ["eb8cbb", "e18483e185a4e186aa"],
+ ["eb8cbb", "eb8cb8e186aa"],
+ ["eb8cbc", "e18483e185a4e186ab"],
+ ["eb8cbc", "eb8cb8e186ab"],
+ ["eb8cbd", "e18483e185a4e186ac"],
+ ["eb8cbd", "eb8cb8e186ac"],
+ ["eb8cbe", "e18483e185a4e186ad"],
+ ["eb8cbe", "eb8cb8e186ad"],
+ ["eb8cbf", "e18483e185a4e186ae"],
+ ["eb8cbf", "eb8cb8e186ae"],
+ ["eb8d80", "e18483e185a4e186af"],
+ ["eb8d80", "eb8cb8e186af"],
+ ["eb8d81", "e18483e185a4e186b0"],
+ ["eb8d81", "eb8cb8e186b0"],
+ ["eb8d82", "e18483e185a4e186b1"],
+ ["eb8d82", "eb8cb8e186b1"],
+ ["eb8d83", "e18483e185a4e186b2"],
+ ["eb8d83", "eb8cb8e186b2"],
+ ["eb8d84", "e18483e185a4e186b3"],
+ ["eb8d84", "eb8cb8e186b3"],
+ ["eb8d85", "e18483e185a4e186b4"],
+ ["eb8d85", "eb8cb8e186b4"],
+ ["eb8d86", "e18483e185a4e186b5"],
+ ["eb8d86", "eb8cb8e186b5"],
+ ["eb8d87", "e18483e185a4e186b6"],
+ ["eb8d87", "eb8cb8e186b6"],
+ ["eb8d88", "e18483e185a4e186b7"],
+ ["eb8d88", "eb8cb8e186b7"],
+ ["eb8d89", "e18483e185a4e186b8"],
+ ["eb8d89", "eb8cb8e186b8"],
+ ["eb8d8a", "e18483e185a4e186b9"],
+ ["eb8d8a", "eb8cb8e186b9"],
+ ["eb8d8b", "e18483e185a4e186ba"],
+ ["eb8d8b", "eb8cb8e186ba"],
+ ["eb8d8c", "e18483e185a4e186bb"],
+ ["eb8d8c", "eb8cb8e186bb"],
+ ["eb8d8d", "e18483e185a4e186bc"],
+ ["eb8d8d", "eb8cb8e186bc"],
+ ["eb8d8e", "e18483e185a4e186bd"],
+ ["eb8d8e", "eb8cb8e186bd"],
+ ["eb8d8f", "e18483e185a4e186be"],
+ ["eb8d8f", "eb8cb8e186be"],
+ ["eb8d90", "e18483e185a4e186bf"],
+ ["eb8d90", "eb8cb8e186bf"],
+ ["eb8d91", "e18483e185a4e18780"],
+ ["eb8d91", "eb8cb8e18780"],
+ ["eb8d92", "e18483e185a4e18781"],
+ ["eb8d92", "eb8cb8e18781"],
+ ["eb8d93", "e18483e185a4e18782"],
+ ["eb8d93", "eb8cb8e18782"],
+ ["eb8d94", "e18483e185a5"],
+ ["eb8d95", "e18483e185a5e186a8"],
+ ["eb8d95", "eb8d94e186a8"],
+ ["eb8d96", "e18483e185a5e186a9"],
+ ["eb8d96", "eb8d94e186a9"],
+ ["eb8d97", "e18483e185a5e186aa"],
+ ["eb8d97", "eb8d94e186aa"],
+ ["eb8d98", "e18483e185a5e186ab"],
+ ["eb8d98", "eb8d94e186ab"],
+ ["eb8d99", "e18483e185a5e186ac"],
+ ["eb8d99", "eb8d94e186ac"],
+ ["eb8d9a", "e18483e185a5e186ad"],
+ ["eb8d9a", "eb8d94e186ad"],
+ ["eb8d9b", "e18483e185a5e186ae"],
+ ["eb8d9b", "eb8d94e186ae"],
+ ["eb8d9c", "e18483e185a5e186af"],
+ ["eb8d9c", "eb8d94e186af"],
+ ["eb8d9d", "e18483e185a5e186b0"],
+ ["eb8d9d", "eb8d94e186b0"],
+ ["eb8d9e", "e18483e185a5e186b1"],
+ ["eb8d9e", "eb8d94e186b1"],
+ ["eb8d9f", "e18483e185a5e186b2"],
+ ["eb8d9f", "eb8d94e186b2"],
+ ["eb8da0", "e18483e185a5e186b3"],
+ ["eb8da0", "eb8d94e186b3"],
+ ["eb8da1", "e18483e185a5e186b4"],
+ ["eb8da1", "eb8d94e186b4"],
+ ["eb8da2", "e18483e185a5e186b5"],
+ ["eb8da2", "eb8d94e186b5"],
+ ["eb8da3", "e18483e185a5e186b6"],
+ ["eb8da3", "eb8d94e186b6"],
+ ["eb8da4", "e18483e185a5e186b7"],
+ ["eb8da4", "eb8d94e186b7"],
+ ["eb8da5", "e18483e185a5e186b8"],
+ ["eb8da5", "eb8d94e186b8"],
+ ["eb8da6", "e18483e185a5e186b9"],
+ ["eb8da6", "eb8d94e186b9"],
+ ["eb8da7", "e18483e185a5e186ba"],
+ ["eb8da7", "eb8d94e186ba"],
+ ["eb8da8", "e18483e185a5e186bb"],
+ ["eb8da8", "eb8d94e186bb"],
+ ["eb8da9", "e18483e185a5e186bc"],
+ ["eb8da9", "eb8d94e186bc"],
+ ["eb8daa", "e18483e185a5e186bd"],
+ ["eb8daa", "eb8d94e186bd"],
+ ["eb8dab", "e18483e185a5e186be"],
+ ["eb8dab", "eb8d94e186be"],
+ ["eb8dac", "e18483e185a5e186bf"],
+ ["eb8dac", "eb8d94e186bf"],
+ ["eb8dad", "e18483e185a5e18780"],
+ ["eb8dad", "eb8d94e18780"],
+ ["eb8dae", "e18483e185a5e18781"],
+ ["eb8dae", "eb8d94e18781"],
+ ["eb8daf", "e18483e185a5e18782"],
+ ["eb8daf", "eb8d94e18782"],
+ ["eb8db0", "e18483e185a6"],
+ ["eb8db1", "e18483e185a6e186a8"],
+ ["eb8db1", "eb8db0e186a8"],
+ ["eb8db2", "e18483e185a6e186a9"],
+ ["eb8db2", "eb8db0e186a9"],
+ ["eb8db3", "e18483e185a6e186aa"],
+ ["eb8db3", "eb8db0e186aa"],
+ ["eb8db4", "e18483e185a6e186ab"],
+ ["eb8db4", "eb8db0e186ab"],
+ ["eb8db5", "e18483e185a6e186ac"],
+ ["eb8db5", "eb8db0e186ac"],
+ ["eb8db6", "e18483e185a6e186ad"],
+ ["eb8db6", "eb8db0e186ad"],
+ ["eb8db7", "e18483e185a6e186ae"],
+ ["eb8db7", "eb8db0e186ae"],
+ ["eb8db8", "e18483e185a6e186af"],
+ ["eb8db8", "eb8db0e186af"],
+ ["eb8db9", "e18483e185a6e186b0"],
+ ["eb8db9", "eb8db0e186b0"],
+ ["eb8dba", "e18483e185a6e186b1"],
+ ["eb8dba", "eb8db0e186b1"],
+ ["eb8dbb", "e18483e185a6e186b2"],
+ ["eb8dbb", "eb8db0e186b2"],
+ ["eb8dbc", "e18483e185a6e186b3"],
+ ["eb8dbc", "eb8db0e186b3"],
+ ["eb8dbd", "e18483e185a6e186b4"],
+ ["eb8dbd", "eb8db0e186b4"],
+ ["eb8dbe", "e18483e185a6e186b5"],
+ ["eb8dbe", "eb8db0e186b5"],
+ ["eb8dbf", "e18483e185a6e186b6"],
+ ["eb8dbf", "eb8db0e186b6"],
+ ["eb8e80", "e18483e185a6e186b7"],
+ ["eb8e80", "eb8db0e186b7"],
+ ["eb8e81", "e18483e185a6e186b8"],
+ ["eb8e81", "eb8db0e186b8"],
+ ["eb8e82", "e18483e185a6e186b9"],
+ ["eb8e82", "eb8db0e186b9"],
+ ["eb8e83", "e18483e185a6e186ba"],
+ ["eb8e83", "eb8db0e186ba"],
+ ["eb8e84", "e18483e185a6e186bb"],
+ ["eb8e84", "eb8db0e186bb"],
+ ["eb8e85", "e18483e185a6e186bc"],
+ ["eb8e85", "eb8db0e186bc"],
+ ["eb8e86", "e18483e185a6e186bd"],
+ ["eb8e86", "eb8db0e186bd"],
+ ["eb8e87", "e18483e185a6e186be"],
+ ["eb8e87", "eb8db0e186be"],
+ ["eb8e88", "e18483e185a6e186bf"],
+ ["eb8e88", "eb8db0e186bf"],
+ ["eb8e89", "e18483e185a6e18780"],
+ ["eb8e89", "eb8db0e18780"],
+ ["eb8e8a", "e18483e185a6e18781"],
+ ["eb8e8a", "eb8db0e18781"],
+ ["eb8e8b", "e18483e185a6e18782"],
+ ["eb8e8b", "eb8db0e18782"],
+ ["eb8e8c", "e18483e185a7"],
+ ["eb8e8d", "e18483e185a7e186a8"],
+ ["eb8e8d", "eb8e8ce186a8"],
+ ["eb8e8e", "e18483e185a7e186a9"],
+ ["eb8e8e", "eb8e8ce186a9"],
+ ["eb8e8f", "e18483e185a7e186aa"],
+ ["eb8e8f", "eb8e8ce186aa"],
+ ["eb8e90", "e18483e185a7e186ab"],
+ ["eb8e90", "eb8e8ce186ab"],
+ ["eb8e91", "e18483e185a7e186ac"],
+ ["eb8e91", "eb8e8ce186ac"],
+ ["eb8e92", "e18483e185a7e186ad"],
+ ["eb8e92", "eb8e8ce186ad"],
+ ["eb8e93", "e18483e185a7e186ae"],
+ ["eb8e93", "eb8e8ce186ae"],
+ ["eb8e94", "e18483e185a7e186af"],
+ ["eb8e94", "eb8e8ce186af"],
+ ["eb8e95", "e18483e185a7e186b0"],
+ ["eb8e95", "eb8e8ce186b0"],
+ ["eb8e96", "e18483e185a7e186b1"],
+ ["eb8e96", "eb8e8ce186b1"],
+ ["eb8e97", "e18483e185a7e186b2"],
+ ["eb8e97", "eb8e8ce186b2"],
+ ["eb8e98", "e18483e185a7e186b3"],
+ ["eb8e98", "eb8e8ce186b3"],
+ ["eb8e99", "e18483e185a7e186b4"],
+ ["eb8e99", "eb8e8ce186b4"],
+ ["eb8e9a", "e18483e185a7e186b5"],
+ ["eb8e9a", "eb8e8ce186b5"],
+ ["eb8e9b", "e18483e185a7e186b6"],
+ ["eb8e9b", "eb8e8ce186b6"],
+ ["eb8e9c", "e18483e185a7e186b7"],
+ ["eb8e9c", "eb8e8ce186b7"],
+ ["eb8e9d", "e18483e185a7e186b8"],
+ ["eb8e9d", "eb8e8ce186b8"],
+ ["eb8e9e", "e18483e185a7e186b9"],
+ ["eb8e9e", "eb8e8ce186b9"],
+ ["eb8e9f", "e18483e185a7e186ba"],
+ ["eb8e9f", "eb8e8ce186ba"],
+ ["eb8ea0", "e18483e185a7e186bb"],
+ ["eb8ea0", "eb8e8ce186bb"],
+ ["eb8ea1", "e18483e185a7e186bc"],
+ ["eb8ea1", "eb8e8ce186bc"],
+ ["eb8ea2", "e18483e185a7e186bd"],
+ ["eb8ea2", "eb8e8ce186bd"],
+ ["eb8ea3", "e18483e185a7e186be"],
+ ["eb8ea3", "eb8e8ce186be"],
+ ["eb8ea4", "e18483e185a7e186bf"],
+ ["eb8ea4", "eb8e8ce186bf"],
+ ["eb8ea5", "e18483e185a7e18780"],
+ ["eb8ea5", "eb8e8ce18780"],
+ ["eb8ea6", "e18483e185a7e18781"],
+ ["eb8ea6", "eb8e8ce18781"],
+ ["eb8ea7", "e18483e185a7e18782"],
+ ["eb8ea7", "eb8e8ce18782"],
+ ["eb8ea8", "e18483e185a8"],
+ ["eb8ea9", "e18483e185a8e186a8"],
+ ["eb8ea9", "eb8ea8e186a8"],
+ ["eb8eaa", "e18483e185a8e186a9"],
+ ["eb8eaa", "eb8ea8e186a9"],
+ ["eb8eab", "e18483e185a8e186aa"],
+ ["eb8eab", "eb8ea8e186aa"],
+ ["eb8eac", "e18483e185a8e186ab"],
+ ["eb8eac", "eb8ea8e186ab"],
+ ["eb8ead", "e18483e185a8e186ac"],
+ ["eb8ead", "eb8ea8e186ac"],
+ ["eb8eae", "e18483e185a8e186ad"],
+ ["eb8eae", "eb8ea8e186ad"],
+ ["eb8eaf", "e18483e185a8e186ae"],
+ ["eb8eaf", "eb8ea8e186ae"],
+ ["eb8eb0", "e18483e185a8e186af"],
+ ["eb8eb0", "eb8ea8e186af"],
+ ["eb8eb1", "e18483e185a8e186b0"],
+ ["eb8eb1", "eb8ea8e186b0"],
+ ["eb8eb2", "e18483e185a8e186b1"],
+ ["eb8eb2", "eb8ea8e186b1"],
+ ["eb8eb3", "e18483e185a8e186b2"],
+ ["eb8eb3", "eb8ea8e186b2"],
+ ["eb8eb4", "e18483e185a8e186b3"],
+ ["eb8eb4", "eb8ea8e186b3"],
+ ["eb8eb5", "e18483e185a8e186b4"],
+ ["eb8eb5", "eb8ea8e186b4"],
+ ["eb8eb6", "e18483e185a8e186b5"],
+ ["eb8eb6", "eb8ea8e186b5"],
+ ["eb8eb7", "e18483e185a8e186b6"],
+ ["eb8eb7", "eb8ea8e186b6"],
+ ["eb8eb8", "e18483e185a8e186b7"],
+ ["eb8eb8", "eb8ea8e186b7"],
+ ["eb8eb9", "e18483e185a8e186b8"],
+ ["eb8eb9", "eb8ea8e186b8"],
+ ["eb8eba", "e18483e185a8e186b9"],
+ ["eb8eba", "eb8ea8e186b9"],
+ ["eb8ebb", "e18483e185a8e186ba"],
+ ["eb8ebb", "eb8ea8e186ba"],
+ ["eb8ebc", "e18483e185a8e186bb"],
+ ["eb8ebc", "eb8ea8e186bb"],
+ ["eb8ebd", "e18483e185a8e186bc"],
+ ["eb8ebd", "eb8ea8e186bc"],
+ ["eb8ebe", "e18483e185a8e186bd"],
+ ["eb8ebe", "eb8ea8e186bd"],
+ ["eb8ebf", "e18483e185a8e186be"],
+ ["eb8ebf", "eb8ea8e186be"],
+ ["eb8f80", "e18483e185a8e186bf"],
+ ["eb8f80", "eb8ea8e186bf"],
+ ["eb8f81", "e18483e185a8e18780"],
+ ["eb8f81", "eb8ea8e18780"],
+ ["eb8f82", "e18483e185a8e18781"],
+ ["eb8f82", "eb8ea8e18781"],
+ ["eb8f83", "e18483e185a8e18782"],
+ ["eb8f83", "eb8ea8e18782"],
+ ["eb8f84", "e18483e185a9"],
+ ["eb8f85", "e18483e185a9e186a8"],
+ ["eb8f85", "eb8f84e186a8"],
+ ["eb8f86", "e18483e185a9e186a9"],
+ ["eb8f86", "eb8f84e186a9"],
+ ["eb8f87", "e18483e185a9e186aa"],
+ ["eb8f87", "eb8f84e186aa"],
+ ["eb8f88", "e18483e185a9e186ab"],
+ ["eb8f88", "eb8f84e186ab"],
+ ["eb8f89", "e18483e185a9e186ac"],
+ ["eb8f89", "eb8f84e186ac"],
+ ["eb8f8a", "e18483e185a9e186ad"],
+ ["eb8f8a", "eb8f84e186ad"],
+ ["eb8f8b", "e18483e185a9e186ae"],
+ ["eb8f8b", "eb8f84e186ae"],
+ ["eb8f8c", "e18483e185a9e186af"],
+ ["eb8f8c", "eb8f84e186af"],
+ ["eb8f8d", "e18483e185a9e186b0"],
+ ["eb8f8d", "eb8f84e186b0"],
+ ["eb8f8e", "e18483e185a9e186b1"],
+ ["eb8f8e", "eb8f84e186b1"],
+ ["eb8f8f", "e18483e185a9e186b2"],
+ ["eb8f8f", "eb8f84e186b2"],
+ ["eb8f90", "e18483e185a9e186b3"],
+ ["eb8f90", "eb8f84e186b3"],
+ ["eb8f91", "e18483e185a9e186b4"],
+ ["eb8f91", "eb8f84e186b4"],
+ ["eb8f92", "e18483e185a9e186b5"],
+ ["eb8f92", "eb8f84e186b5"],
+ ["eb8f93", "e18483e185a9e186b6"],
+ ["eb8f93", "eb8f84e186b6"],
+ ["eb8f94", "e18483e185a9e186b7"],
+ ["eb8f94", "eb8f84e186b7"],
+ ["eb8f95", "e18483e185a9e186b8"],
+ ["eb8f95", "eb8f84e186b8"],
+ ["eb8f96", "e18483e185a9e186b9"],
+ ["eb8f96", "eb8f84e186b9"],
+ ["eb8f97", "e18483e185a9e186ba"],
+ ["eb8f97", "eb8f84e186ba"],
+ ["eb8f98", "e18483e185a9e186bb"],
+ ["eb8f98", "eb8f84e186bb"],
+ ["eb8f99", "e18483e185a9e186bc"],
+ ["eb8f99", "eb8f84e186bc"],
+ ["eb8f9a", "e18483e185a9e186bd"],
+ ["eb8f9a", "eb8f84e186bd"],
+ ["eb8f9b", "e18483e185a9e186be"],
+ ["eb8f9b", "eb8f84e186be"],
+ ["eb8f9c", "e18483e185a9e186bf"],
+ ["eb8f9c", "eb8f84e186bf"],
+ ["eb8f9d", "e18483e185a9e18780"],
+ ["eb8f9d", "eb8f84e18780"],
+ ["eb8f9e", "e18483e185a9e18781"],
+ ["eb8f9e", "eb8f84e18781"],
+ ["eb8f9f", "e18483e185a9e18782"],
+ ["eb8f9f", "eb8f84e18782"],
+ ["eb8fa0", "e18483e185aa"],
+ ["eb8fa1", "e18483e185aae186a8"],
+ ["eb8fa1", "eb8fa0e186a8"],
+ ["eb8fa2", "e18483e185aae186a9"],
+ ["eb8fa2", "eb8fa0e186a9"],
+ ["eb8fa3", "e18483e185aae186aa"],
+ ["eb8fa3", "eb8fa0e186aa"],
+ ["eb8fa4", "e18483e185aae186ab"],
+ ["eb8fa4", "eb8fa0e186ab"],
+ ["eb8fa5", "e18483e185aae186ac"],
+ ["eb8fa5", "eb8fa0e186ac"],
+ ["eb8fa6", "e18483e185aae186ad"],
+ ["eb8fa6", "eb8fa0e186ad"],
+ ["eb8fa7", "e18483e185aae186ae"],
+ ["eb8fa7", "eb8fa0e186ae"],
+ ["eb8fa8", "e18483e185aae186af"],
+ ["eb8fa8", "eb8fa0e186af"],
+ ["eb8fa9", "e18483e185aae186b0"],
+ ["eb8fa9", "eb8fa0e186b0"],
+ ["eb8faa", "e18483e185aae186b1"],
+ ["eb8faa", "eb8fa0e186b1"],
+ ["eb8fab", "e18483e185aae186b2"],
+ ["eb8fab", "eb8fa0e186b2"],
+ ["eb8fac", "e18483e185aae186b3"],
+ ["eb8fac", "eb8fa0e186b3"],
+ ["eb8fad", "e18483e185aae186b4"],
+ ["eb8fad", "eb8fa0e186b4"],
+ ["eb8fae", "e18483e185aae186b5"],
+ ["eb8fae", "eb8fa0e186b5"],
+ ["eb8faf", "e18483e185aae186b6"],
+ ["eb8faf", "eb8fa0e186b6"],
+ ["eb8fb0", "e18483e185aae186b7"],
+ ["eb8fb0", "eb8fa0e186b7"],
+ ["eb8fb1", "e18483e185aae186b8"],
+ ["eb8fb1", "eb8fa0e186b8"],
+ ["eb8fb2", "e18483e185aae186b9"],
+ ["eb8fb2", "eb8fa0e186b9"],
+ ["eb8fb3", "e18483e185aae186ba"],
+ ["eb8fb3", "eb8fa0e186ba"],
+ ["eb8fb4", "e18483e185aae186bb"],
+ ["eb8fb4", "eb8fa0e186bb"],
+ ["eb8fb5", "e18483e185aae186bc"],
+ ["eb8fb5", "eb8fa0e186bc"],
+ ["eb8fb6", "e18483e185aae186bd"],
+ ["eb8fb6", "eb8fa0e186bd"],
+ ["eb8fb7", "e18483e185aae186be"],
+ ["eb8fb7", "eb8fa0e186be"],
+ ["eb8fb8", "e18483e185aae186bf"],
+ ["eb8fb8", "eb8fa0e186bf"],
+ ["eb8fb9", "e18483e185aae18780"],
+ ["eb8fb9", "eb8fa0e18780"],
+ ["eb8fba", "e18483e185aae18781"],
+ ["eb8fba", "eb8fa0e18781"],
+ ["eb8fbb", "e18483e185aae18782"],
+ ["eb8fbb", "eb8fa0e18782"],
+ ["eb8fbc", "e18483e185ab"],
+ ["eb8fbd", "e18483e185abe186a8"],
+ ["eb8fbd", "eb8fbce186a8"],
+ ["eb8fbe", "e18483e185abe186a9"],
+ ["eb8fbe", "eb8fbce186a9"],
+ ["eb8fbf", "e18483e185abe186aa"],
+ ["eb8fbf", "eb8fbce186aa"],
+ ["eb9080", "e18483e185abe186ab"],
+ ["eb9080", "eb8fbce186ab"],
+ ["eb9081", "e18483e185abe186ac"],
+ ["eb9081", "eb8fbce186ac"],
+ ["eb9082", "e18483e185abe186ad"],
+ ["eb9082", "eb8fbce186ad"],
+ ["eb9083", "e18483e185abe186ae"],
+ ["eb9083", "eb8fbce186ae"],
+ ["eb9084", "e18483e185abe186af"],
+ ["eb9084", "eb8fbce186af"],
+ ["eb9085", "e18483e185abe186b0"],
+ ["eb9085", "eb8fbce186b0"],
+ ["eb9086", "e18483e185abe186b1"],
+ ["eb9086", "eb8fbce186b1"],
+ ["eb9087", "e18483e185abe186b2"],
+ ["eb9087", "eb8fbce186b2"],
+ ["eb9088", "e18483e185abe186b3"],
+ ["eb9088", "eb8fbce186b3"],
+ ["eb9089", "e18483e185abe186b4"],
+ ["eb9089", "eb8fbce186b4"],
+ ["eb908a", "e18483e185abe186b5"],
+ ["eb908a", "eb8fbce186b5"],
+ ["eb908b", "e18483e185abe186b6"],
+ ["eb908b", "eb8fbce186b6"],
+ ["eb908c", "e18483e185abe186b7"],
+ ["eb908c", "eb8fbce186b7"],
+ ["eb908d", "e18483e185abe186b8"],
+ ["eb908d", "eb8fbce186b8"],
+ ["eb908e", "e18483e185abe186b9"],
+ ["eb908e", "eb8fbce186b9"],
+ ["eb908f", "e18483e185abe186ba"],
+ ["eb908f", "eb8fbce186ba"],
+ ["eb9090", "e18483e185abe186bb"],
+ ["eb9090", "eb8fbce186bb"],
+ ["eb9091", "e18483e185abe186bc"],
+ ["eb9091", "eb8fbce186bc"],
+ ["eb9092", "e18483e185abe186bd"],
+ ["eb9092", "eb8fbce186bd"],
+ ["eb9093", "e18483e185abe186be"],
+ ["eb9093", "eb8fbce186be"],
+ ["eb9094", "e18483e185abe186bf"],
+ ["eb9094", "eb8fbce186bf"],
+ ["eb9095", "e18483e185abe18780"],
+ ["eb9095", "eb8fbce18780"],
+ ["eb9096", "e18483e185abe18781"],
+ ["eb9096", "eb8fbce18781"],
+ ["eb9097", "e18483e185abe18782"],
+ ["eb9097", "eb8fbce18782"],
+ ["eb9098", "e18483e185ac"],
+ ["eb9099", "e18483e185ace186a8"],
+ ["eb9099", "eb9098e186a8"],
+ ["eb909a", "e18483e185ace186a9"],
+ ["eb909a", "eb9098e186a9"],
+ ["eb909b", "e18483e185ace186aa"],
+ ["eb909b", "eb9098e186aa"],
+ ["eb909c", "e18483e185ace186ab"],
+ ["eb909c", "eb9098e186ab"],
+ ["eb909d", "e18483e185ace186ac"],
+ ["eb909d", "eb9098e186ac"],
+ ["eb909e", "e18483e185ace186ad"],
+ ["eb909e", "eb9098e186ad"],
+ ["eb909f", "e18483e185ace186ae"],
+ ["eb909f", "eb9098e186ae"],
+ ["eb90a0", "e18483e185ace186af"],
+ ["eb90a0", "eb9098e186af"],
+ ["eb90a1", "e18483e185ace186b0"],
+ ["eb90a1", "eb9098e186b0"],
+ ["eb90a2", "e18483e185ace186b1"],
+ ["eb90a2", "eb9098e186b1"],
+ ["eb90a3", "e18483e185ace186b2"],
+ ["eb90a3", "eb9098e186b2"],
+ ["eb90a4", "e18483e185ace186b3"],
+ ["eb90a4", "eb9098e186b3"],
+ ["eb90a5", "e18483e185ace186b4"],
+ ["eb90a5", "eb9098e186b4"],
+ ["eb90a6", "e18483e185ace186b5"],
+ ["eb90a6", "eb9098e186b5"],
+ ["eb90a7", "e18483e185ace186b6"],
+ ["eb90a7", "eb9098e186b6"],
+ ["eb90a8", "e18483e185ace186b7"],
+ ["eb90a8", "eb9098e186b7"],
+ ["eb90a9", "e18483e185ace186b8"],
+ ["eb90a9", "eb9098e186b8"],
+ ["eb90aa", "e18483e185ace186b9"],
+ ["eb90aa", "eb9098e186b9"],
+ ["eb90ab", "e18483e185ace186ba"],
+ ["eb90ab", "eb9098e186ba"],
+ ["eb90ac", "e18483e185ace186bb"],
+ ["eb90ac", "eb9098e186bb"],
+ ["eb90ad", "e18483e185ace186bc"],
+ ["eb90ad", "eb9098e186bc"],
+ ["eb90ae", "e18483e185ace186bd"],
+ ["eb90ae", "eb9098e186bd"],
+ ["eb90af", "e18483e185ace186be"],
+ ["eb90af", "eb9098e186be"],
+ ["eb90b0", "e18483e185ace186bf"],
+ ["eb90b0", "eb9098e186bf"],
+ ["eb90b1", "e18483e185ace18780"],
+ ["eb90b1", "eb9098e18780"],
+ ["eb90b2", "e18483e185ace18781"],
+ ["eb90b2", "eb9098e18781"],
+ ["eb90b3", "e18483e185ace18782"],
+ ["eb90b3", "eb9098e18782"],
+ ["eb90b4", "e18483e185ad"],
+ ["eb90b5", "e18483e185ade186a8"],
+ ["eb90b5", "eb90b4e186a8"],
+ ["eb90b6", "e18483e185ade186a9"],
+ ["eb90b6", "eb90b4e186a9"],
+ ["eb90b7", "e18483e185ade186aa"],
+ ["eb90b7", "eb90b4e186aa"],
+ ["eb90b8", "e18483e185ade186ab"],
+ ["eb90b8", "eb90b4e186ab"],
+ ["eb90b9", "e18483e185ade186ac"],
+ ["eb90b9", "eb90b4e186ac"],
+ ["eb90ba", "e18483e185ade186ad"],
+ ["eb90ba", "eb90b4e186ad"],
+ ["eb90bb", "e18483e185ade186ae"],
+ ["eb90bb", "eb90b4e186ae"],
+ ["eb90bc", "e18483e185ade186af"],
+ ["eb90bc", "eb90b4e186af"],
+ ["eb90bd", "e18483e185ade186b0"],
+ ["eb90bd", "eb90b4e186b0"],
+ ["eb90be", "e18483e185ade186b1"],
+ ["eb90be", "eb90b4e186b1"],
+ ["eb90bf", "e18483e185ade186b2"],
+ ["eb90bf", "eb90b4e186b2"],
+ ["eb9180", "e18483e185ade186b3"],
+ ["eb9180", "eb90b4e186b3"],
+ ["eb9181", "e18483e185ade186b4"],
+ ["eb9181", "eb90b4e186b4"],
+ ["eb9182", "e18483e185ade186b5"],
+ ["eb9182", "eb90b4e186b5"],
+ ["eb9183", "e18483e185ade186b6"],
+ ["eb9183", "eb90b4e186b6"],
+ ["eb9184", "e18483e185ade186b7"],
+ ["eb9184", "eb90b4e186b7"],
+ ["eb9185", "e18483e185ade186b8"],
+ ["eb9185", "eb90b4e186b8"],
+ ["eb9186", "e18483e185ade186b9"],
+ ["eb9186", "eb90b4e186b9"],
+ ["eb9187", "e18483e185ade186ba"],
+ ["eb9187", "eb90b4e186ba"],
+ ["eb9188", "e18483e185ade186bb"],
+ ["eb9188", "eb90b4e186bb"],
+ ["eb9189", "e18483e185ade186bc"],
+ ["eb9189", "eb90b4e186bc"],
+ ["eb918a", "e18483e185ade186bd"],
+ ["eb918a", "eb90b4e186bd"],
+ ["eb918b", "e18483e185ade186be"],
+ ["eb918b", "eb90b4e186be"],
+ ["eb918c", "e18483e185ade186bf"],
+ ["eb918c", "eb90b4e186bf"],
+ ["eb918d", "e18483e185ade18780"],
+ ["eb918d", "eb90b4e18780"],
+ ["eb918e", "e18483e185ade18781"],
+ ["eb918e", "eb90b4e18781"],
+ ["eb918f", "e18483e185ade18782"],
+ ["eb918f", "eb90b4e18782"],
+ ["eb9190", "e18483e185ae"],
+ ["eb9191", "e18483e185aee186a8"],
+ ["eb9191", "eb9190e186a8"],
+ ["eb9192", "e18483e185aee186a9"],
+ ["eb9192", "eb9190e186a9"],
+ ["eb9193", "e18483e185aee186aa"],
+ ["eb9193", "eb9190e186aa"],
+ ["eb9194", "e18483e185aee186ab"],
+ ["eb9194", "eb9190e186ab"],
+ ["eb9195", "e18483e185aee186ac"],
+ ["eb9195", "eb9190e186ac"],
+ ["eb9196", "e18483e185aee186ad"],
+ ["eb9196", "eb9190e186ad"],
+ ["eb9197", "e18483e185aee186ae"],
+ ["eb9197", "eb9190e186ae"],
+ ["eb9198", "e18483e185aee186af"],
+ ["eb9198", "eb9190e186af"],
+ ["eb9199", "e18483e185aee186b0"],
+ ["eb9199", "eb9190e186b0"],
+ ["eb919a", "e18483e185aee186b1"],
+ ["eb919a", "eb9190e186b1"],
+ ["eb919b", "e18483e185aee186b2"],
+ ["eb919b", "eb9190e186b2"],
+ ["eb919c", "e18483e185aee186b3"],
+ ["eb919c", "eb9190e186b3"],
+ ["eb919d", "e18483e185aee186b4"],
+ ["eb919d", "eb9190e186b4"],
+ ["eb919e", "e18483e185aee186b5"],
+ ["eb919e", "eb9190e186b5"],
+ ["eb919f", "e18483e185aee186b6"],
+ ["eb919f", "eb9190e186b6"],
+ ["eb91a0", "e18483e185aee186b7"],
+ ["eb91a0", "eb9190e186b7"],
+ ["eb91a1", "e18483e185aee186b8"],
+ ["eb91a1", "eb9190e186b8"],
+ ["eb91a2", "e18483e185aee186b9"],
+ ["eb91a2", "eb9190e186b9"],
+ ["eb91a3", "e18483e185aee186ba"],
+ ["eb91a3", "eb9190e186ba"],
+ ["eb91a4", "e18483e185aee186bb"],
+ ["eb91a4", "eb9190e186bb"],
+ ["eb91a5", "e18483e185aee186bc"],
+ ["eb91a5", "eb9190e186bc"],
+ ["eb91a6", "e18483e185aee186bd"],
+ ["eb91a6", "eb9190e186bd"],
+ ["eb91a7", "e18483e185aee186be"],
+ ["eb91a7", "eb9190e186be"],
+ ["eb91a8", "e18483e185aee186bf"],
+ ["eb91a8", "eb9190e186bf"],
+ ["eb91a9", "e18483e185aee18780"],
+ ["eb91a9", "eb9190e18780"],
+ ["eb91aa", "e18483e185aee18781"],
+ ["eb91aa", "eb9190e18781"],
+ ["eb91ab", "e18483e185aee18782"],
+ ["eb91ab", "eb9190e18782"],
+ ["eb91ac", "e18483e185af"],
+ ["eb91ad", "e18483e185afe186a8"],
+ ["eb91ad", "eb91ace186a8"],
+ ["eb91ae", "e18483e185afe186a9"],
+ ["eb91ae", "eb91ace186a9"],
+ ["eb91af", "e18483e185afe186aa"],
+ ["eb91af", "eb91ace186aa"],
+ ["eb91b0", "e18483e185afe186ab"],
+ ["eb91b0", "eb91ace186ab"],
+ ["eb91b1", "e18483e185afe186ac"],
+ ["eb91b1", "eb91ace186ac"],
+ ["eb91b2", "e18483e185afe186ad"],
+ ["eb91b2", "eb91ace186ad"],
+ ["eb91b3", "e18483e185afe186ae"],
+ ["eb91b3", "eb91ace186ae"],
+ ["eb91b4", "e18483e185afe186af"],
+ ["eb91b4", "eb91ace186af"],
+ ["eb91b5", "e18483e185afe186b0"],
+ ["eb91b5", "eb91ace186b0"],
+ ["eb91b6", "e18483e185afe186b1"],
+ ["eb91b6", "eb91ace186b1"],
+ ["eb91b7", "e18483e185afe186b2"],
+ ["eb91b7", "eb91ace186b2"],
+ ["eb91b8", "e18483e185afe186b3"],
+ ["eb91b8", "eb91ace186b3"],
+ ["eb91b9", "e18483e185afe186b4"],
+ ["eb91b9", "eb91ace186b4"],
+ ["eb91ba", "e18483e185afe186b5"],
+ ["eb91ba", "eb91ace186b5"],
+ ["eb91bb", "e18483e185afe186b6"],
+ ["eb91bb", "eb91ace186b6"],
+ ["eb91bc", "e18483e185afe186b7"],
+ ["eb91bc", "eb91ace186b7"],
+ ["eb91bd", "e18483e185afe186b8"],
+ ["eb91bd", "eb91ace186b8"],
+ ["eb91be", "e18483e185afe186b9"],
+ ["eb91be", "eb91ace186b9"],
+ ["eb91bf", "e18483e185afe186ba"],
+ ["eb91bf", "eb91ace186ba"],
+ ["eb9280", "e18483e185afe186bb"],
+ ["eb9280", "eb91ace186bb"],
+ ["eb9281", "e18483e185afe186bc"],
+ ["eb9281", "eb91ace186bc"],
+ ["eb9282", "e18483e185afe186bd"],
+ ["eb9282", "eb91ace186bd"],
+ ["eb9283", "e18483e185afe186be"],
+ ["eb9283", "eb91ace186be"],
+ ["eb9284", "e18483e185afe186bf"],
+ ["eb9284", "eb91ace186bf"],
+ ["eb9285", "e18483e185afe18780"],
+ ["eb9285", "eb91ace18780"],
+ ["eb9286", "e18483e185afe18781"],
+ ["eb9286", "eb91ace18781"],
+ ["eb9287", "e18483e185afe18782"],
+ ["eb9287", "eb91ace18782"],
+ ["eb9288", "e18483e185b0"],
+ ["eb9289", "e18483e185b0e186a8"],
+ ["eb9289", "eb9288e186a8"],
+ ["eb928a", "e18483e185b0e186a9"],
+ ["eb928a", "eb9288e186a9"],
+ ["eb928b", "e18483e185b0e186aa"],
+ ["eb928b", "eb9288e186aa"],
+ ["eb928c", "e18483e185b0e186ab"],
+ ["eb928c", "eb9288e186ab"],
+ ["eb928d", "e18483e185b0e186ac"],
+ ["eb928d", "eb9288e186ac"],
+ ["eb928e", "e18483e185b0e186ad"],
+ ["eb928e", "eb9288e186ad"],
+ ["eb928f", "e18483e185b0e186ae"],
+ ["eb928f", "eb9288e186ae"],
+ ["eb9290", "e18483e185b0e186af"],
+ ["eb9290", "eb9288e186af"],
+ ["eb9291", "e18483e185b0e186b0"],
+ ["eb9291", "eb9288e186b0"],
+ ["eb9292", "e18483e185b0e186b1"],
+ ["eb9292", "eb9288e186b1"],
+ ["eb9293", "e18483e185b0e186b2"],
+ ["eb9293", "eb9288e186b2"],
+ ["eb9294", "e18483e185b0e186b3"],
+ ["eb9294", "eb9288e186b3"],
+ ["eb9295", "e18483e185b0e186b4"],
+ ["eb9295", "eb9288e186b4"],
+ ["eb9296", "e18483e185b0e186b5"],
+ ["eb9296", "eb9288e186b5"],
+ ["eb9297", "e18483e185b0e186b6"],
+ ["eb9297", "eb9288e186b6"],
+ ["eb9298", "e18483e185b0e186b7"],
+ ["eb9298", "eb9288e186b7"],
+ ["eb9299", "e18483e185b0e186b8"],
+ ["eb9299", "eb9288e186b8"],
+ ["eb929a", "e18483e185b0e186b9"],
+ ["eb929a", "eb9288e186b9"],
+ ["eb929b", "e18483e185b0e186ba"],
+ ["eb929b", "eb9288e186ba"],
+ ["eb929c", "e18483e185b0e186bb"],
+ ["eb929c", "eb9288e186bb"],
+ ["eb929d", "e18483e185b0e186bc"],
+ ["eb929d", "eb9288e186bc"],
+ ["eb929e", "e18483e185b0e186bd"],
+ ["eb929e", "eb9288e186bd"],
+ ["eb929f", "e18483e185b0e186be"],
+ ["eb929f", "eb9288e186be"],
+ ["eb92a0", "e18483e185b0e186bf"],
+ ["eb92a0", "eb9288e186bf"],
+ ["eb92a1", "e18483e185b0e18780"],
+ ["eb92a1", "eb9288e18780"],
+ ["eb92a2", "e18483e185b0e18781"],
+ ["eb92a2", "eb9288e18781"],
+ ["eb92a3", "e18483e185b0e18782"],
+ ["eb92a3", "eb9288e18782"],
+ ["eb92a4", "e18483e185b1"],
+ ["eb92a5", "e18483e185b1e186a8"],
+ ["eb92a5", "eb92a4e186a8"],
+ ["eb92a6", "e18483e185b1e186a9"],
+ ["eb92a6", "eb92a4e186a9"],
+ ["eb92a7", "e18483e185b1e186aa"],
+ ["eb92a7", "eb92a4e186aa"],
+ ["eb92a8", "e18483e185b1e186ab"],
+ ["eb92a8", "eb92a4e186ab"],
+ ["eb92a9", "e18483e185b1e186ac"],
+ ["eb92a9", "eb92a4e186ac"],
+ ["eb92aa", "e18483e185b1e186ad"],
+ ["eb92aa", "eb92a4e186ad"],
+ ["eb92ab", "e18483e185b1e186ae"],
+ ["eb92ab", "eb92a4e186ae"],
+ ["eb92ac", "e18483e185b1e186af"],
+ ["eb92ac", "eb92a4e186af"],
+ ["eb92ad", "e18483e185b1e186b0"],
+ ["eb92ad", "eb92a4e186b0"],
+ ["eb92ae", "e18483e185b1e186b1"],
+ ["eb92ae", "eb92a4e186b1"],
+ ["eb92af", "e18483e185b1e186b2"],
+ ["eb92af", "eb92a4e186b2"],
+ ["eb92b0", "e18483e185b1e186b3"],
+ ["eb92b0", "eb92a4e186b3"],
+ ["eb92b1", "e18483e185b1e186b4"],
+ ["eb92b1", "eb92a4e186b4"],
+ ["eb92b2", "e18483e185b1e186b5"],
+ ["eb92b2", "eb92a4e186b5"],
+ ["eb92b3", "e18483e185b1e186b6"],
+ ["eb92b3", "eb92a4e186b6"],
+ ["eb92b4", "e18483e185b1e186b7"],
+ ["eb92b4", "eb92a4e186b7"],
+ ["eb92b5", "e18483e185b1e186b8"],
+ ["eb92b5", "eb92a4e186b8"],
+ ["eb92b6", "e18483e185b1e186b9"],
+ ["eb92b6", "eb92a4e186b9"],
+ ["eb92b7", "e18483e185b1e186ba"],
+ ["eb92b7", "eb92a4e186ba"],
+ ["eb92b8", "e18483e185b1e186bb"],
+ ["eb92b8", "eb92a4e186bb"],
+ ["eb92b9", "e18483e185b1e186bc"],
+ ["eb92b9", "eb92a4e186bc"],
+ ["eb92ba", "e18483e185b1e186bd"],
+ ["eb92ba", "eb92a4e186bd"],
+ ["eb92bb", "e18483e185b1e186be"],
+ ["eb92bb", "eb92a4e186be"],
+ ["eb92bc", "e18483e185b1e186bf"],
+ ["eb92bc", "eb92a4e186bf"],
+ ["eb92bd", "e18483e185b1e18780"],
+ ["eb92bd", "eb92a4e18780"],
+ ["eb92be", "e18483e185b1e18781"],
+ ["eb92be", "eb92a4e18781"],
+ ["eb92bf", "e18483e185b1e18782"],
+ ["eb92bf", "eb92a4e18782"],
+ ["eb9380", "e18483e185b2"],
+ ["eb9381", "e18483e185b2e186a8"],
+ ["eb9381", "eb9380e186a8"],
+ ["eb9382", "e18483e185b2e186a9"],
+ ["eb9382", "eb9380e186a9"],
+ ["eb9383", "e18483e185b2e186aa"],
+ ["eb9383", "eb9380e186aa"],
+ ["eb9384", "e18483e185b2e186ab"],
+ ["eb9384", "eb9380e186ab"],
+ ["eb9385", "e18483e185b2e186ac"],
+ ["eb9385", "eb9380e186ac"],
+ ["eb9386", "e18483e185b2e186ad"],
+ ["eb9386", "eb9380e186ad"],
+ ["eb9387", "e18483e185b2e186ae"],
+ ["eb9387", "eb9380e186ae"],
+ ["eb9388", "e18483e185b2e186af"],
+ ["eb9388", "eb9380e186af"],
+ ["eb9389", "e18483e185b2e186b0"],
+ ["eb9389", "eb9380e186b0"],
+ ["eb938a", "e18483e185b2e186b1"],
+ ["eb938a", "eb9380e186b1"],
+ ["eb938b", "e18483e185b2e186b2"],
+ ["eb938b", "eb9380e186b2"],
+ ["eb938c", "e18483e185b2e186b3"],
+ ["eb938c", "eb9380e186b3"],
+ ["eb938d", "e18483e185b2e186b4"],
+ ["eb938d", "eb9380e186b4"],
+ ["eb938e", "e18483e185b2e186b5"],
+ ["eb938e", "eb9380e186b5"],
+ ["eb938f", "e18483e185b2e186b6"],
+ ["eb938f", "eb9380e186b6"],
+ ["eb9390", "e18483e185b2e186b7"],
+ ["eb9390", "eb9380e186b7"],
+ ["eb9391", "e18483e185b2e186b8"],
+ ["eb9391", "eb9380e186b8"],
+ ["eb9392", "e18483e185b2e186b9"],
+ ["eb9392", "eb9380e186b9"],
+ ["eb9393", "e18483e185b2e186ba"],
+ ["eb9393", "eb9380e186ba"],
+ ["eb9394", "e18483e185b2e186bb"],
+ ["eb9394", "eb9380e186bb"],
+ ["eb9395", "e18483e185b2e186bc"],
+ ["eb9395", "eb9380e186bc"],
+ ["eb9396", "e18483e185b2e186bd"],
+ ["eb9396", "eb9380e186bd"],
+ ["eb9397", "e18483e185b2e186be"],
+ ["eb9397", "eb9380e186be"],
+ ["eb9398", "e18483e185b2e186bf"],
+ ["eb9398", "eb9380e186bf"],
+ ["eb9399", "e18483e185b2e18780"],
+ ["eb9399", "eb9380e18780"],
+ ["eb939a", "e18483e185b2e18781"],
+ ["eb939a", "eb9380e18781"],
+ ["eb939b", "e18483e185b2e18782"],
+ ["eb939b", "eb9380e18782"],
+ ["eb939c", "e18483e185b3"],
+ ["eb939d", "e18483e185b3e186a8"],
+ ["eb939d", "eb939ce186a8"],
+ ["eb939e", "e18483e185b3e186a9"],
+ ["eb939e", "eb939ce186a9"],
+ ["eb939f", "e18483e185b3e186aa"],
+ ["eb939f", "eb939ce186aa"],
+ ["eb93a0", "e18483e185b3e186ab"],
+ ["eb93a0", "eb939ce186ab"],
+ ["eb93a1", "e18483e185b3e186ac"],
+ ["eb93a1", "eb939ce186ac"],
+ ["eb93a2", "e18483e185b3e186ad"],
+ ["eb93a2", "eb939ce186ad"],
+ ["eb93a3", "e18483e185b3e186ae"],
+ ["eb93a3", "eb939ce186ae"],
+ ["eb93a4", "e18483e185b3e186af"],
+ ["eb93a4", "eb939ce186af"],
+ ["eb93a5", "e18483e185b3e186b0"],
+ ["eb93a5", "eb939ce186b0"],
+ ["eb93a6", "e18483e185b3e186b1"],
+ ["eb93a6", "eb939ce186b1"],
+ ["eb93a7", "e18483e185b3e186b2"],
+ ["eb93a7", "eb939ce186b2"],
+ ["eb93a8", "e18483e185b3e186b3"],
+ ["eb93a8", "eb939ce186b3"],
+ ["eb93a9", "e18483e185b3e186b4"],
+ ["eb93a9", "eb939ce186b4"],
+ ["eb93aa", "e18483e185b3e186b5"],
+ ["eb93aa", "eb939ce186b5"],
+ ["eb93ab", "e18483e185b3e186b6"],
+ ["eb93ab", "eb939ce186b6"],
+ ["eb93ac", "e18483e185b3e186b7"],
+ ["eb93ac", "eb939ce186b7"],
+ ["eb93ad", "e18483e185b3e186b8"],
+ ["eb93ad", "eb939ce186b8"],
+ ["eb93ae", "e18483e185b3e186b9"],
+ ["eb93ae", "eb939ce186b9"],
+ ["eb93af", "e18483e185b3e186ba"],
+ ["eb93af", "eb939ce186ba"],
+ ["eb93b0", "e18483e185b3e186bb"],
+ ["eb93b0", "eb939ce186bb"],
+ ["eb93b1", "e18483e185b3e186bc"],
+ ["eb93b1", "eb939ce186bc"],
+ ["eb93b2", "e18483e185b3e186bd"],
+ ["eb93b2", "eb939ce186bd"],
+ ["eb93b3", "e18483e185b3e186be"],
+ ["eb93b3", "eb939ce186be"],
+ ["eb93b4", "e18483e185b3e186bf"],
+ ["eb93b4", "eb939ce186bf"],
+ ["eb93b5", "e18483e185b3e18780"],
+ ["eb93b5", "eb939ce18780"],
+ ["eb93b6", "e18483e185b3e18781"],
+ ["eb93b6", "eb939ce18781"],
+ ["eb93b7", "e18483e185b3e18782"],
+ ["eb93b7", "eb939ce18782"],
+ ["eb93b8", "e18483e185b4"],
+ ["eb93b9", "e18483e185b4e186a8"],
+ ["eb93b9", "eb93b8e186a8"],
+ ["eb93ba", "e18483e185b4e186a9"],
+ ["eb93ba", "eb93b8e186a9"],
+ ["eb93bb", "e18483e185b4e186aa"],
+ ["eb93bb", "eb93b8e186aa"],
+ ["eb93bc", "e18483e185b4e186ab"],
+ ["eb93bc", "eb93b8e186ab"],
+ ["eb93bd", "e18483e185b4e186ac"],
+ ["eb93bd", "eb93b8e186ac"],
+ ["eb93be", "e18483e185b4e186ad"],
+ ["eb93be", "eb93b8e186ad"],
+ ["eb93bf", "e18483e185b4e186ae"],
+ ["eb93bf", "eb93b8e186ae"],
+ ["eb9480", "e18483e185b4e186af"],
+ ["eb9480", "eb93b8e186af"],
+ ["eb9481", "e18483e185b4e186b0"],
+ ["eb9481", "eb93b8e186b0"],
+ ["eb9482", "e18483e185b4e186b1"],
+ ["eb9482", "eb93b8e186b1"],
+ ["eb9483", "e18483e185b4e186b2"],
+ ["eb9483", "eb93b8e186b2"],
+ ["eb9484", "e18483e185b4e186b3"],
+ ["eb9484", "eb93b8e186b3"],
+ ["eb9485", "e18483e185b4e186b4"],
+ ["eb9485", "eb93b8e186b4"],
+ ["eb9486", "e18483e185b4e186b5"],
+ ["eb9486", "eb93b8e186b5"],
+ ["eb9487", "e18483e185b4e186b6"],
+ ["eb9487", "eb93b8e186b6"],
+ ["eb9488", "e18483e185b4e186b7"],
+ ["eb9488", "eb93b8e186b7"],
+ ["eb9489", "e18483e185b4e186b8"],
+ ["eb9489", "eb93b8e186b8"],
+ ["eb948a", "e18483e185b4e186b9"],
+ ["eb948a", "eb93b8e186b9"],
+ ["eb948b", "e18483e185b4e186ba"],
+ ["eb948b", "eb93b8e186ba"],
+ ["eb948c", "e18483e185b4e186bb"],
+ ["eb948c", "eb93b8e186bb"],
+ ["eb948d", "e18483e185b4e186bc"],
+ ["eb948d", "eb93b8e186bc"],
+ ["eb948e", "e18483e185b4e186bd"],
+ ["eb948e", "eb93b8e186bd"],
+ ["eb948f", "e18483e185b4e186be"],
+ ["eb948f", "eb93b8e186be"],
+ ["eb9490", "e18483e185b4e186bf"],
+ ["eb9490", "eb93b8e186bf"],
+ ["eb9491", "e18483e185b4e18780"],
+ ["eb9491", "eb93b8e18780"],
+ ["eb9492", "e18483e185b4e18781"],
+ ["eb9492", "eb93b8e18781"],
+ ["eb9493", "e18483e185b4e18782"],
+ ["eb9493", "eb93b8e18782"],
+ ["eb9494", "e18483e185b5"],
+ ["eb9495", "e18483e185b5e186a8"],
+ ["eb9495", "eb9494e186a8"],
+ ["eb9496", "e18483e185b5e186a9"],
+ ["eb9496", "eb9494e186a9"],
+ ["eb9497", "e18483e185b5e186aa"],
+ ["eb9497", "eb9494e186aa"],
+ ["eb9498", "e18483e185b5e186ab"],
+ ["eb9498", "eb9494e186ab"],
+ ["eb9499", "e18483e185b5e186ac"],
+ ["eb9499", "eb9494e186ac"],
+ ["eb949a", "e18483e185b5e186ad"],
+ ["eb949a", "eb9494e186ad"],
+ ["eb949b", "e18483e185b5e186ae"],
+ ["eb949b", "eb9494e186ae"],
+ ["eb949c", "e18483e185b5e186af"],
+ ["eb949c", "eb9494e186af"],
+ ["eb949d", "e18483e185b5e186b0"],
+ ["eb949d", "eb9494e186b0"],
+ ["eb949e", "e18483e185b5e186b1"],
+ ["eb949e", "eb9494e186b1"],
+ ["eb949f", "e18483e185b5e186b2"],
+ ["eb949f", "eb9494e186b2"],
+ ["eb94a0", "e18483e185b5e186b3"],
+ ["eb94a0", "eb9494e186b3"],
+ ["eb94a1", "e18483e185b5e186b4"],
+ ["eb94a1", "eb9494e186b4"],
+ ["eb94a2", "e18483e185b5e186b5"],
+ ["eb94a2", "eb9494e186b5"],
+ ["eb94a3", "e18483e185b5e186b6"],
+ ["eb94a3", "eb9494e186b6"],
+ ["eb94a4", "e18483e185b5e186b7"],
+ ["eb94a4", "eb9494e186b7"],
+ ["eb94a5", "e18483e185b5e186b8"],
+ ["eb94a5", "eb9494e186b8"],
+ ["eb94a6", "e18483e185b5e186b9"],
+ ["eb94a6", "eb9494e186b9"],
+ ["eb94a7", "e18483e185b5e186ba"],
+ ["eb94a7", "eb9494e186ba"],
+ ["eb94a8", "e18483e185b5e186bb"],
+ ["eb94a8", "eb9494e186bb"],
+ ["eb94a9", "e18483e185b5e186bc"],
+ ["eb94a9", "eb9494e186bc"],
+ ["eb94aa", "e18483e185b5e186bd"],
+ ["eb94aa", "eb9494e186bd"],
+ ["eb94ab", "e18483e185b5e186be"],
+ ["eb94ab", "eb9494e186be"],
+ ["eb94ac", "e18483e185b5e186bf"],
+ ["eb94ac", "eb9494e186bf"],
+ ["eb94ad", "e18483e185b5e18780"],
+ ["eb94ad", "eb9494e18780"],
+ ["eb94ae", "e18483e185b5e18781"],
+ ["eb94ae", "eb9494e18781"],
+ ["eb94af", "e18483e185b5e18782"],
+ ["eb94af", "eb9494e18782"],
+ ["eb94b0", "e18484e185a1"],
+ ["eb94b1", "e18484e185a1e186a8"],
+ ["eb94b1", "eb94b0e186a8"],
+ ["eb94b2", "e18484e185a1e186a9"],
+ ["eb94b2", "eb94b0e186a9"],
+ ["eb94b3", "e18484e185a1e186aa"],
+ ["eb94b3", "eb94b0e186aa"],
+ ["eb94b4", "e18484e185a1e186ab"],
+ ["eb94b4", "eb94b0e186ab"],
+ ["eb94b5", "e18484e185a1e186ac"],
+ ["eb94b5", "eb94b0e186ac"],
+ ["eb94b6", "e18484e185a1e186ad"],
+ ["eb94b6", "eb94b0e186ad"],
+ ["eb94b7", "e18484e185a1e186ae"],
+ ["eb94b7", "eb94b0e186ae"],
+ ["eb94b8", "e18484e185a1e186af"],
+ ["eb94b8", "eb94b0e186af"],
+ ["eb94b9", "e18484e185a1e186b0"],
+ ["eb94b9", "eb94b0e186b0"],
+ ["eb94ba", "e18484e185a1e186b1"],
+ ["eb94ba", "eb94b0e186b1"],
+ ["eb94bb", "e18484e185a1e186b2"],
+ ["eb94bb", "eb94b0e186b2"],
+ ["eb94bc", "e18484e185a1e186b3"],
+ ["eb94bc", "eb94b0e186b3"],
+ ["eb94bd", "e18484e185a1e186b4"],
+ ["eb94bd", "eb94b0e186b4"],
+ ["eb94be", "e18484e185a1e186b5"],
+ ["eb94be", "eb94b0e186b5"],
+ ["eb94bf", "e18484e185a1e186b6"],
+ ["eb94bf", "eb94b0e186b6"],
+ ["eb9580", "e18484e185a1e186b7"],
+ ["eb9580", "eb94b0e186b7"],
+ ["eb9581", "e18484e185a1e186b8"],
+ ["eb9581", "eb94b0e186b8"],
+ ["eb9582", "e18484e185a1e186b9"],
+ ["eb9582", "eb94b0e186b9"],
+ ["eb9583", "e18484e185a1e186ba"],
+ ["eb9583", "eb94b0e186ba"],
+ ["eb9584", "e18484e185a1e186bb"],
+ ["eb9584", "eb94b0e186bb"],
+ ["eb9585", "e18484e185a1e186bc"],
+ ["eb9585", "eb94b0e186bc"],
+ ["eb9586", "e18484e185a1e186bd"],
+ ["eb9586", "eb94b0e186bd"],
+ ["eb9587", "e18484e185a1e186be"],
+ ["eb9587", "eb94b0e186be"],
+ ["eb9588", "e18484e185a1e186bf"],
+ ["eb9588", "eb94b0e186bf"],
+ ["eb9589", "e18484e185a1e18780"],
+ ["eb9589", "eb94b0e18780"],
+ ["eb958a", "e18484e185a1e18781"],
+ ["eb958a", "eb94b0e18781"],
+ ["eb958b", "e18484e185a1e18782"],
+ ["eb958b", "eb94b0e18782"],
+ ["eb958c", "e18484e185a2"],
+ ["eb958d", "e18484e185a2e186a8"],
+ ["eb958d", "eb958ce186a8"],
+ ["eb958e", "e18484e185a2e186a9"],
+ ["eb958e", "eb958ce186a9"],
+ ["eb958f", "e18484e185a2e186aa"],
+ ["eb958f", "eb958ce186aa"],
+ ["eb9590", "e18484e185a2e186ab"],
+ ["eb9590", "eb958ce186ab"],
+ ["eb9591", "e18484e185a2e186ac"],
+ ["eb9591", "eb958ce186ac"],
+ ["eb9592", "e18484e185a2e186ad"],
+ ["eb9592", "eb958ce186ad"],
+ ["eb9593", "e18484e185a2e186ae"],
+ ["eb9593", "eb958ce186ae"],
+ ["eb9594", "e18484e185a2e186af"],
+ ["eb9594", "eb958ce186af"],
+ ["eb9595", "e18484e185a2e186b0"],
+ ["eb9595", "eb958ce186b0"],
+ ["eb9596", "e18484e185a2e186b1"],
+ ["eb9596", "eb958ce186b1"],
+ ["eb9597", "e18484e185a2e186b2"],
+ ["eb9597", "eb958ce186b2"],
+ ["eb9598", "e18484e185a2e186b3"],
+ ["eb9598", "eb958ce186b3"],
+ ["eb9599", "e18484e185a2e186b4"],
+ ["eb9599", "eb958ce186b4"],
+ ["eb959a", "e18484e185a2e186b5"],
+ ["eb959a", "eb958ce186b5"],
+ ["eb959b", "e18484e185a2e186b6"],
+ ["eb959b", "eb958ce186b6"],
+ ["eb959c", "e18484e185a2e186b7"],
+ ["eb959c", "eb958ce186b7"],
+ ["eb959d", "e18484e185a2e186b8"],
+ ["eb959d", "eb958ce186b8"],
+ ["eb959e", "e18484e185a2e186b9"],
+ ["eb959e", "eb958ce186b9"],
+ ["eb959f", "e18484e185a2e186ba"],
+ ["eb959f", "eb958ce186ba"],
+ ["eb95a0", "e18484e185a2e186bb"],
+ ["eb95a0", "eb958ce186bb"],
+ ["eb95a1", "e18484e185a2e186bc"],
+ ["eb95a1", "eb958ce186bc"],
+ ["eb95a2", "e18484e185a2e186bd"],
+ ["eb95a2", "eb958ce186bd"],
+ ["eb95a3", "e18484e185a2e186be"],
+ ["eb95a3", "eb958ce186be"],
+ ["eb95a4", "e18484e185a2e186bf"],
+ ["eb95a4", "eb958ce186bf"],
+ ["eb95a5", "e18484e185a2e18780"],
+ ["eb95a5", "eb958ce18780"],
+ ["eb95a6", "e18484e185a2e18781"],
+ ["eb95a6", "eb958ce18781"],
+ ["eb95a7", "e18484e185a2e18782"],
+ ["eb95a7", "eb958ce18782"],
+ ["eb95a8", "e18484e185a3"],
+ ["eb95a9", "e18484e185a3e186a8"],
+ ["eb95a9", "eb95a8e186a8"],
+ ["eb95aa", "e18484e185a3e186a9"],
+ ["eb95aa", "eb95a8e186a9"],
+ ["eb95ab", "e18484e185a3e186aa"],
+ ["eb95ab", "eb95a8e186aa"],
+ ["eb95ac", "e18484e185a3e186ab"],
+ ["eb95ac", "eb95a8e186ab"],
+ ["eb95ad", "e18484e185a3e186ac"],
+ ["eb95ad", "eb95a8e186ac"],
+ ["eb95ae", "e18484e185a3e186ad"],
+ ["eb95ae", "eb95a8e186ad"],
+ ["eb95af", "e18484e185a3e186ae"],
+ ["eb95af", "eb95a8e186ae"],
+ ["eb95b0", "e18484e185a3e186af"],
+ ["eb95b0", "eb95a8e186af"],
+ ["eb95b1", "e18484e185a3e186b0"],
+ ["eb95b1", "eb95a8e186b0"],
+ ["eb95b2", "e18484e185a3e186b1"],
+ ["eb95b2", "eb95a8e186b1"],
+ ["eb95b3", "e18484e185a3e186b2"],
+ ["eb95b3", "eb95a8e186b2"],
+ ["eb95b4", "e18484e185a3e186b3"],
+ ["eb95b4", "eb95a8e186b3"],
+ ["eb95b5", "e18484e185a3e186b4"],
+ ["eb95b5", "eb95a8e186b4"],
+ ["eb95b6", "e18484e185a3e186b5"],
+ ["eb95b6", "eb95a8e186b5"],
+ ["eb95b7", "e18484e185a3e186b6"],
+ ["eb95b7", "eb95a8e186b6"],
+ ["eb95b8", "e18484e185a3e186b7"],
+ ["eb95b8", "eb95a8e186b7"],
+ ["eb95b9", "e18484e185a3e186b8"],
+ ["eb95b9", "eb95a8e186b8"],
+ ["eb95ba", "e18484e185a3e186b9"],
+ ["eb95ba", "eb95a8e186b9"],
+ ["eb95bb", "e18484e185a3e186ba"],
+ ["eb95bb", "eb95a8e186ba"],
+ ["eb95bc", "e18484e185a3e186bb"],
+ ["eb95bc", "eb95a8e186bb"],
+ ["eb95bd", "e18484e185a3e186bc"],
+ ["eb95bd", "eb95a8e186bc"],
+ ["eb95be", "e18484e185a3e186bd"],
+ ["eb95be", "eb95a8e186bd"],
+ ["eb95bf", "e18484e185a3e186be"],
+ ["eb95bf", "eb95a8e186be"],
+ ["eb9680", "e18484e185a3e186bf"],
+ ["eb9680", "eb95a8e186bf"],
+ ["eb9681", "e18484e185a3e18780"],
+ ["eb9681", "eb95a8e18780"],
+ ["eb9682", "e18484e185a3e18781"],
+ ["eb9682", "eb95a8e18781"],
+ ["eb9683", "e18484e185a3e18782"],
+ ["eb9683", "eb95a8e18782"],
+ ["eb9684", "e18484e185a4"],
+ ["eb9685", "e18484e185a4e186a8"],
+ ["eb9685", "eb9684e186a8"],
+ ["eb9686", "e18484e185a4e186a9"],
+ ["eb9686", "eb9684e186a9"],
+ ["eb9687", "e18484e185a4e186aa"],
+ ["eb9687", "eb9684e186aa"],
+ ["eb9688", "e18484e185a4e186ab"],
+ ["eb9688", "eb9684e186ab"],
+ ["eb9689", "e18484e185a4e186ac"],
+ ["eb9689", "eb9684e186ac"],
+ ["eb968a", "e18484e185a4e186ad"],
+ ["eb968a", "eb9684e186ad"],
+ ["eb968b", "e18484e185a4e186ae"],
+ ["eb968b", "eb9684e186ae"],
+ ["eb968c", "e18484e185a4e186af"],
+ ["eb968c", "eb9684e186af"],
+ ["eb968d", "e18484e185a4e186b0"],
+ ["eb968d", "eb9684e186b0"],
+ ["eb968e", "e18484e185a4e186b1"],
+ ["eb968e", "eb9684e186b1"],
+ ["eb968f", "e18484e185a4e186b2"],
+ ["eb968f", "eb9684e186b2"],
+ ["eb9690", "e18484e185a4e186b3"],
+ ["eb9690", "eb9684e186b3"],
+ ["eb9691", "e18484e185a4e186b4"],
+ ["eb9691", "eb9684e186b4"],
+ ["eb9692", "e18484e185a4e186b5"],
+ ["eb9692", "eb9684e186b5"],
+ ["eb9693", "e18484e185a4e186b6"],
+ ["eb9693", "eb9684e186b6"],
+ ["eb9694", "e18484e185a4e186b7"],
+ ["eb9694", "eb9684e186b7"],
+ ["eb9695", "e18484e185a4e186b8"],
+ ["eb9695", "eb9684e186b8"],
+ ["eb9696", "e18484e185a4e186b9"],
+ ["eb9696", "eb9684e186b9"],
+ ["eb9697", "e18484e185a4e186ba"],
+ ["eb9697", "eb9684e186ba"],
+ ["eb9698", "e18484e185a4e186bb"],
+ ["eb9698", "eb9684e186bb"],
+ ["eb9699", "e18484e185a4e186bc"],
+ ["eb9699", "eb9684e186bc"],
+ ["eb969a", "e18484e185a4e186bd"],
+ ["eb969a", "eb9684e186bd"],
+ ["eb969b", "e18484e185a4e186be"],
+ ["eb969b", "eb9684e186be"],
+ ["eb969c", "e18484e185a4e186bf"],
+ ["eb969c", "eb9684e186bf"],
+ ["eb969d", "e18484e185a4e18780"],
+ ["eb969d", "eb9684e18780"],
+ ["eb969e", "e18484e185a4e18781"],
+ ["eb969e", "eb9684e18781"],
+ ["eb969f", "e18484e185a4e18782"],
+ ["eb969f", "eb9684e18782"],
+ ["eb96a0", "e18484e185a5"],
+ ["eb96a1", "e18484e185a5e186a8"],
+ ["eb96a1", "eb96a0e186a8"],
+ ["eb96a2", "e18484e185a5e186a9"],
+ ["eb96a2", "eb96a0e186a9"],
+ ["eb96a3", "e18484e185a5e186aa"],
+ ["eb96a3", "eb96a0e186aa"],
+ ["eb96a4", "e18484e185a5e186ab"],
+ ["eb96a4", "eb96a0e186ab"],
+ ["eb96a5", "e18484e185a5e186ac"],
+ ["eb96a5", "eb96a0e186ac"],
+ ["eb96a6", "e18484e185a5e186ad"],
+ ["eb96a6", "eb96a0e186ad"],
+ ["eb96a7", "e18484e185a5e186ae"],
+ ["eb96a7", "eb96a0e186ae"],
+ ["eb96a8", "e18484e185a5e186af"],
+ ["eb96a8", "eb96a0e186af"],
+ ["eb96a9", "e18484e185a5e186b0"],
+ ["eb96a9", "eb96a0e186b0"],
+ ["eb96aa", "e18484e185a5e186b1"],
+ ["eb96aa", "eb96a0e186b1"],
+ ["eb96ab", "e18484e185a5e186b2"],
+ ["eb96ab", "eb96a0e186b2"],
+ ["eb96ac", "e18484e185a5e186b3"],
+ ["eb96ac", "eb96a0e186b3"],
+ ["eb96ad", "e18484e185a5e186b4"],
+ ["eb96ad", "eb96a0e186b4"],
+ ["eb96ae", "e18484e185a5e186b5"],
+ ["eb96ae", "eb96a0e186b5"],
+ ["eb96af", "e18484e185a5e186b6"],
+ ["eb96af", "eb96a0e186b6"],
+ ["eb96b0", "e18484e185a5e186b7"],
+ ["eb96b0", "eb96a0e186b7"],
+ ["eb96b1", "e18484e185a5e186b8"],
+ ["eb96b1", "eb96a0e186b8"],
+ ["eb96b2", "e18484e185a5e186b9"],
+ ["eb96b2", "eb96a0e186b9"],
+ ["eb96b3", "e18484e185a5e186ba"],
+ ["eb96b3", "eb96a0e186ba"],
+ ["eb96b4", "e18484e185a5e186bb"],
+ ["eb96b4", "eb96a0e186bb"],
+ ["eb96b5", "e18484e185a5e186bc"],
+ ["eb96b5", "eb96a0e186bc"],
+ ["eb96b6", "e18484e185a5e186bd"],
+ ["eb96b6", "eb96a0e186bd"],
+ ["eb96b7", "e18484e185a5e186be"],
+ ["eb96b7", "eb96a0e186be"],
+ ["eb96b8", "e18484e185a5e186bf"],
+ ["eb96b8", "eb96a0e186bf"],
+ ["eb96b9", "e18484e185a5e18780"],
+ ["eb96b9", "eb96a0e18780"],
+ ["eb96ba", "e18484e185a5e18781"],
+ ["eb96ba", "eb96a0e18781"],
+ ["eb96bb", "e18484e185a5e18782"],
+ ["eb96bb", "eb96a0e18782"],
+ ["eb96bc", "e18484e185a6"],
+ ["eb96bd", "e18484e185a6e186a8"],
+ ["eb96bd", "eb96bce186a8"],
+ ["eb96be", "e18484e185a6e186a9"],
+ ["eb96be", "eb96bce186a9"],
+ ["eb96bf", "e18484e185a6e186aa"],
+ ["eb96bf", "eb96bce186aa"],
+ ["eb9780", "e18484e185a6e186ab"],
+ ["eb9780", "eb96bce186ab"],
+ ["eb9781", "e18484e185a6e186ac"],
+ ["eb9781", "eb96bce186ac"],
+ ["eb9782", "e18484e185a6e186ad"],
+ ["eb9782", "eb96bce186ad"],
+ ["eb9783", "e18484e185a6e186ae"],
+ ["eb9783", "eb96bce186ae"],
+ ["eb9784", "e18484e185a6e186af"],
+ ["eb9784", "eb96bce186af"],
+ ["eb9785", "e18484e185a6e186b0"],
+ ["eb9785", "eb96bce186b0"],
+ ["eb9786", "e18484e185a6e186b1"],
+ ["eb9786", "eb96bce186b1"],
+ ["eb9787", "e18484e185a6e186b2"],
+ ["eb9787", "eb96bce186b2"],
+ ["eb9788", "e18484e185a6e186b3"],
+ ["eb9788", "eb96bce186b3"],
+ ["eb9789", "e18484e185a6e186b4"],
+ ["eb9789", "eb96bce186b4"],
+ ["eb978a", "e18484e185a6e186b5"],
+ ["eb978a", "eb96bce186b5"],
+ ["eb978b", "e18484e185a6e186b6"],
+ ["eb978b", "eb96bce186b6"],
+ ["eb978c", "e18484e185a6e186b7"],
+ ["eb978c", "eb96bce186b7"],
+ ["eb978d", "e18484e185a6e186b8"],
+ ["eb978d", "eb96bce186b8"],
+ ["eb978e", "e18484e185a6e186b9"],
+ ["eb978e", "eb96bce186b9"],
+ ["eb978f", "e18484e185a6e186ba"],
+ ["eb978f", "eb96bce186ba"],
+ ["eb9790", "e18484e185a6e186bb"],
+ ["eb9790", "eb96bce186bb"],
+ ["eb9791", "e18484e185a6e186bc"],
+ ["eb9791", "eb96bce186bc"],
+ ["eb9792", "e18484e185a6e186bd"],
+ ["eb9792", "eb96bce186bd"],
+ ["eb9793", "e18484e185a6e186be"],
+ ["eb9793", "eb96bce186be"],
+ ["eb9794", "e18484e185a6e186bf"],
+ ["eb9794", "eb96bce186bf"],
+ ["eb9795", "e18484e185a6e18780"],
+ ["eb9795", "eb96bce18780"],
+ ["eb9796", "e18484e185a6e18781"],
+ ["eb9796", "eb96bce18781"],
+ ["eb9797", "e18484e185a6e18782"],
+ ["eb9797", "eb96bce18782"],
+ ["eb9798", "e18484e185a7"],
+ ["eb9799", "e18484e185a7e186a8"],
+ ["eb9799", "eb9798e186a8"],
+ ["eb979a", "e18484e185a7e186a9"],
+ ["eb979a", "eb9798e186a9"],
+ ["eb979b", "e18484e185a7e186aa"],
+ ["eb979b", "eb9798e186aa"],
+ ["eb979c", "e18484e185a7e186ab"],
+ ["eb979c", "eb9798e186ab"],
+ ["eb979d", "e18484e185a7e186ac"],
+ ["eb979d", "eb9798e186ac"],
+ ["eb979e", "e18484e185a7e186ad"],
+ ["eb979e", "eb9798e186ad"],
+ ["eb979f", "e18484e185a7e186ae"],
+ ["eb979f", "eb9798e186ae"],
+ ["eb97a0", "e18484e185a7e186af"],
+ ["eb97a0", "eb9798e186af"],
+ ["eb97a1", "e18484e185a7e186b0"],
+ ["eb97a1", "eb9798e186b0"],
+ ["eb97a2", "e18484e185a7e186b1"],
+ ["eb97a2", "eb9798e186b1"],
+ ["eb97a3", "e18484e185a7e186b2"],
+ ["eb97a3", "eb9798e186b2"],
+ ["eb97a4", "e18484e185a7e186b3"],
+ ["eb97a4", "eb9798e186b3"],
+ ["eb97a5", "e18484e185a7e186b4"],
+ ["eb97a5", "eb9798e186b4"],
+ ["eb97a6", "e18484e185a7e186b5"],
+ ["eb97a6", "eb9798e186b5"],
+ ["eb97a7", "e18484e185a7e186b6"],
+ ["eb97a7", "eb9798e186b6"],
+ ["eb97a8", "e18484e185a7e186b7"],
+ ["eb97a8", "eb9798e186b7"],
+ ["eb97a9", "e18484e185a7e186b8"],
+ ["eb97a9", "eb9798e186b8"],
+ ["eb97aa", "e18484e185a7e186b9"],
+ ["eb97aa", "eb9798e186b9"],
+ ["eb97ab", "e18484e185a7e186ba"],
+ ["eb97ab", "eb9798e186ba"],
+ ["eb97ac", "e18484e185a7e186bb"],
+ ["eb97ac", "eb9798e186bb"],
+ ["eb97ad", "e18484e185a7e186bc"],
+ ["eb97ad", "eb9798e186bc"],
+ ["eb97ae", "e18484e185a7e186bd"],
+ ["eb97ae", "eb9798e186bd"],
+ ["eb97af", "e18484e185a7e186be"],
+ ["eb97af", "eb9798e186be"],
+ ["eb97b0", "e18484e185a7e186bf"],
+ ["eb97b0", "eb9798e186bf"],
+ ["eb97b1", "e18484e185a7e18780"],
+ ["eb97b1", "eb9798e18780"],
+ ["eb97b2", "e18484e185a7e18781"],
+ ["eb97b2", "eb9798e18781"],
+ ["eb97b3", "e18484e185a7e18782"],
+ ["eb97b3", "eb9798e18782"],
+ ["eb97b4", "e18484e185a8"],
+ ["eb97b5", "e18484e185a8e186a8"],
+ ["eb97b5", "eb97b4e186a8"],
+ ["eb97b6", "e18484e185a8e186a9"],
+ ["eb97b6", "eb97b4e186a9"],
+ ["eb97b7", "e18484e185a8e186aa"],
+ ["eb97b7", "eb97b4e186aa"],
+ ["eb97b8", "e18484e185a8e186ab"],
+ ["eb97b8", "eb97b4e186ab"],
+ ["eb97b9", "e18484e185a8e186ac"],
+ ["eb97b9", "eb97b4e186ac"],
+ ["eb97ba", "e18484e185a8e186ad"],
+ ["eb97ba", "eb97b4e186ad"],
+ ["eb97bb", "e18484e185a8e186ae"],
+ ["eb97bb", "eb97b4e186ae"],
+ ["eb97bc", "e18484e185a8e186af"],
+ ["eb97bc", "eb97b4e186af"],
+ ["eb97bd", "e18484e185a8e186b0"],
+ ["eb97bd", "eb97b4e186b0"],
+ ["eb97be", "e18484e185a8e186b1"],
+ ["eb97be", "eb97b4e186b1"],
+ ["eb97bf", "e18484e185a8e186b2"],
+ ["eb97bf", "eb97b4e186b2"],
+ ["eb9880", "e18484e185a8e186b3"],
+ ["eb9880", "eb97b4e186b3"],
+ ["eb9881", "e18484e185a8e186b4"],
+ ["eb9881", "eb97b4e186b4"],
+ ["eb9882", "e18484e185a8e186b5"],
+ ["eb9882", "eb97b4e186b5"],
+ ["eb9883", "e18484e185a8e186b6"],
+ ["eb9883", "eb97b4e186b6"],
+ ["eb9884", "e18484e185a8e186b7"],
+ ["eb9884", "eb97b4e186b7"],
+ ["eb9885", "e18484e185a8e186b8"],
+ ["eb9885", "eb97b4e186b8"],
+ ["eb9886", "e18484e185a8e186b9"],
+ ["eb9886", "eb97b4e186b9"],
+ ["eb9887", "e18484e185a8e186ba"],
+ ["eb9887", "eb97b4e186ba"],
+ ["eb9888", "e18484e185a8e186bb"],
+ ["eb9888", "eb97b4e186bb"],
+ ["eb9889", "e18484e185a8e186bc"],
+ ["eb9889", "eb97b4e186bc"],
+ ["eb988a", "e18484e185a8e186bd"],
+ ["eb988a", "eb97b4e186bd"],
+ ["eb988b", "e18484e185a8e186be"],
+ ["eb988b", "eb97b4e186be"],
+ ["eb988c", "e18484e185a8e186bf"],
+ ["eb988c", "eb97b4e186bf"],
+ ["eb988d", "e18484e185a8e18780"],
+ ["eb988d", "eb97b4e18780"],
+ ["eb988e", "e18484e185a8e18781"],
+ ["eb988e", "eb97b4e18781"],
+ ["eb988f", "e18484e185a8e18782"],
+ ["eb988f", "eb97b4e18782"],
+ ["eb9890", "e18484e185a9"],
+ ["eb9891", "e18484e185a9e186a8"],
+ ["eb9891", "eb9890e186a8"],
+ ["eb9892", "e18484e185a9e186a9"],
+ ["eb9892", "eb9890e186a9"],
+ ["eb9893", "e18484e185a9e186aa"],
+ ["eb9893", "eb9890e186aa"],
+ ["eb9894", "e18484e185a9e186ab"],
+ ["eb9894", "eb9890e186ab"],
+ ["eb9895", "e18484e185a9e186ac"],
+ ["eb9895", "eb9890e186ac"],
+ ["eb9896", "e18484e185a9e186ad"],
+ ["eb9896", "eb9890e186ad"],
+ ["eb9897", "e18484e185a9e186ae"],
+ ["eb9897", "eb9890e186ae"],
+ ["eb9898", "e18484e185a9e186af"],
+ ["eb9898", "eb9890e186af"],
+ ["eb9899", "e18484e185a9e186b0"],
+ ["eb9899", "eb9890e186b0"],
+ ["eb989a", "e18484e185a9e186b1"],
+ ["eb989a", "eb9890e186b1"],
+ ["eb989b", "e18484e185a9e186b2"],
+ ["eb989b", "eb9890e186b2"],
+ ["eb989c", "e18484e185a9e186b3"],
+ ["eb989c", "eb9890e186b3"],
+ ["eb989d", "e18484e185a9e186b4"],
+ ["eb989d", "eb9890e186b4"],
+ ["eb989e", "e18484e185a9e186b5"],
+ ["eb989e", "eb9890e186b5"],
+ ["eb989f", "e18484e185a9e186b6"],
+ ["eb989f", "eb9890e186b6"],
+ ["eb98a0", "e18484e185a9e186b7"],
+ ["eb98a0", "eb9890e186b7"],
+ ["eb98a1", "e18484e185a9e186b8"],
+ ["eb98a1", "eb9890e186b8"],
+ ["eb98a2", "e18484e185a9e186b9"],
+ ["eb98a2", "eb9890e186b9"],
+ ["eb98a3", "e18484e185a9e186ba"],
+ ["eb98a3", "eb9890e186ba"],
+ ["eb98a4", "e18484e185a9e186bb"],
+ ["eb98a4", "eb9890e186bb"],
+ ["eb98a5", "e18484e185a9e186bc"],
+ ["eb98a5", "eb9890e186bc"],
+ ["eb98a6", "e18484e185a9e186bd"],
+ ["eb98a6", "eb9890e186bd"],
+ ["eb98a7", "e18484e185a9e186be"],
+ ["eb98a7", "eb9890e186be"],
+ ["eb98a8", "e18484e185a9e186bf"],
+ ["eb98a8", "eb9890e186bf"],
+ ["eb98a9", "e18484e185a9e18780"],
+ ["eb98a9", "eb9890e18780"],
+ ["eb98aa", "e18484e185a9e18781"],
+ ["eb98aa", "eb9890e18781"],
+ ["eb98ab", "e18484e185a9e18782"],
+ ["eb98ab", "eb9890e18782"],
+ ["eb98ac", "e18484e185aa"],
+ ["eb98ad", "e18484e185aae186a8"],
+ ["eb98ad", "eb98ace186a8"],
+ ["eb98ae", "e18484e185aae186a9"],
+ ["eb98ae", "eb98ace186a9"],
+ ["eb98af", "e18484e185aae186aa"],
+ ["eb98af", "eb98ace186aa"],
+ ["eb98b0", "e18484e185aae186ab"],
+ ["eb98b0", "eb98ace186ab"],
+ ["eb98b1", "e18484e185aae186ac"],
+ ["eb98b1", "eb98ace186ac"],
+ ["eb98b2", "e18484e185aae186ad"],
+ ["eb98b2", "eb98ace186ad"],
+ ["eb98b3", "e18484e185aae186ae"],
+ ["eb98b3", "eb98ace186ae"],
+ ["eb98b4", "e18484e185aae186af"],
+ ["eb98b4", "eb98ace186af"],
+ ["eb98b5", "e18484e185aae186b0"],
+ ["eb98b5", "eb98ace186b0"],
+ ["eb98b6", "e18484e185aae186b1"],
+ ["eb98b6", "eb98ace186b1"],
+ ["eb98b7", "e18484e185aae186b2"],
+ ["eb98b7", "eb98ace186b2"],
+ ["eb98b8", "e18484e185aae186b3"],
+ ["eb98b8", "eb98ace186b3"],
+ ["eb98b9", "e18484e185aae186b4"],
+ ["eb98b9", "eb98ace186b4"],
+ ["eb98ba", "e18484e185aae186b5"],
+ ["eb98ba", "eb98ace186b5"],
+ ["eb98bb", "e18484e185aae186b6"],
+ ["eb98bb", "eb98ace186b6"],
+ ["eb98bc", "e18484e185aae186b7"],
+ ["eb98bc", "eb98ace186b7"],
+ ["eb98bd", "e18484e185aae186b8"],
+ ["eb98bd", "eb98ace186b8"],
+ ["eb98be", "e18484e185aae186b9"],
+ ["eb98be", "eb98ace186b9"],
+ ["eb98bf", "e18484e185aae186ba"],
+ ["eb98bf", "eb98ace186ba"],
+ ["eb9980", "e18484e185aae186bb"],
+ ["eb9980", "eb98ace186bb"],
+ ["eb9981", "e18484e185aae186bc"],
+ ["eb9981", "eb98ace186bc"],
+ ["eb9982", "e18484e185aae186bd"],
+ ["eb9982", "eb98ace186bd"],
+ ["eb9983", "e18484e185aae186be"],
+ ["eb9983", "eb98ace186be"],
+ ["eb9984", "e18484e185aae186bf"],
+ ["eb9984", "eb98ace186bf"],
+ ["eb9985", "e18484e185aae18780"],
+ ["eb9985", "eb98ace18780"],
+ ["eb9986", "e18484e185aae18781"],
+ ["eb9986", "eb98ace18781"],
+ ["eb9987", "e18484e185aae18782"],
+ ["eb9987", "eb98ace18782"],
+ ["eb9988", "e18484e185ab"],
+ ["eb9989", "e18484e185abe186a8"],
+ ["eb9989", "eb9988e186a8"],
+ ["eb998a", "e18484e185abe186a9"],
+ ["eb998a", "eb9988e186a9"],
+ ["eb998b", "e18484e185abe186aa"],
+ ["eb998b", "eb9988e186aa"],
+ ["eb998c", "e18484e185abe186ab"],
+ ["eb998c", "eb9988e186ab"],
+ ["eb998d", "e18484e185abe186ac"],
+ ["eb998d", "eb9988e186ac"],
+ ["eb998e", "e18484e185abe186ad"],
+ ["eb998e", "eb9988e186ad"],
+ ["eb998f", "e18484e185abe186ae"],
+ ["eb998f", "eb9988e186ae"],
+ ["eb9990", "e18484e185abe186af"],
+ ["eb9990", "eb9988e186af"],
+ ["eb9991", "e18484e185abe186b0"],
+ ["eb9991", "eb9988e186b0"],
+ ["eb9992", "e18484e185abe186b1"],
+ ["eb9992", "eb9988e186b1"],
+ ["eb9993", "e18484e185abe186b2"],
+ ["eb9993", "eb9988e186b2"],
+ ["eb9994", "e18484e185abe186b3"],
+ ["eb9994", "eb9988e186b3"],
+ ["eb9995", "e18484e185abe186b4"],
+ ["eb9995", "eb9988e186b4"],
+ ["eb9996", "e18484e185abe186b5"],
+ ["eb9996", "eb9988e186b5"],
+ ["eb9997", "e18484e185abe186b6"],
+ ["eb9997", "eb9988e186b6"],
+ ["eb9998", "e18484e185abe186b7"],
+ ["eb9998", "eb9988e186b7"],
+ ["eb9999", "e18484e185abe186b8"],
+ ["eb9999", "eb9988e186b8"],
+ ["eb999a", "e18484e185abe186b9"],
+ ["eb999a", "eb9988e186b9"],
+ ["eb999b", "e18484e185abe186ba"],
+ ["eb999b", "eb9988e186ba"],
+ ["eb999c", "e18484e185abe186bb"],
+ ["eb999c", "eb9988e186bb"],
+ ["eb999d", "e18484e185abe186bc"],
+ ["eb999d", "eb9988e186bc"],
+ ["eb999e", "e18484e185abe186bd"],
+ ["eb999e", "eb9988e186bd"],
+ ["eb999f", "e18484e185abe186be"],
+ ["eb999f", "eb9988e186be"],
+ ["eb99a0", "e18484e185abe186bf"],
+ ["eb99a0", "eb9988e186bf"],
+ ["eb99a1", "e18484e185abe18780"],
+ ["eb99a1", "eb9988e18780"],
+ ["eb99a2", "e18484e185abe18781"],
+ ["eb99a2", "eb9988e18781"],
+ ["eb99a3", "e18484e185abe18782"],
+ ["eb99a3", "eb9988e18782"],
+ ["eb99a4", "e18484e185ac"],
+ ["eb99a5", "e18484e185ace186a8"],
+ ["eb99a5", "eb99a4e186a8"],
+ ["eb99a6", "e18484e185ace186a9"],
+ ["eb99a6", "eb99a4e186a9"],
+ ["eb99a7", "e18484e185ace186aa"],
+ ["eb99a7", "eb99a4e186aa"],
+ ["eb99a8", "e18484e185ace186ab"],
+ ["eb99a8", "eb99a4e186ab"],
+ ["eb99a9", "e18484e185ace186ac"],
+ ["eb99a9", "eb99a4e186ac"],
+ ["eb99aa", "e18484e185ace186ad"],
+ ["eb99aa", "eb99a4e186ad"],
+ ["eb99ab", "e18484e185ace186ae"],
+ ["eb99ab", "eb99a4e186ae"],
+ ["eb99ac", "e18484e185ace186af"],
+ ["eb99ac", "eb99a4e186af"],
+ ["eb99ad", "e18484e185ace186b0"],
+ ["eb99ad", "eb99a4e186b0"],
+ ["eb99ae", "e18484e185ace186b1"],
+ ["eb99ae", "eb99a4e186b1"],
+ ["eb99af", "e18484e185ace186b2"],
+ ["eb99af", "eb99a4e186b2"],
+ ["eb99b0", "e18484e185ace186b3"],
+ ["eb99b0", "eb99a4e186b3"],
+ ["eb99b1", "e18484e185ace186b4"],
+ ["eb99b1", "eb99a4e186b4"],
+ ["eb99b2", "e18484e185ace186b5"],
+ ["eb99b2", "eb99a4e186b5"],
+ ["eb99b3", "e18484e185ace186b6"],
+ ["eb99b3", "eb99a4e186b6"],
+ ["eb99b4", "e18484e185ace186b7"],
+ ["eb99b4", "eb99a4e186b7"],
+ ["eb99b5", "e18484e185ace186b8"],
+ ["eb99b5", "eb99a4e186b8"],
+ ["eb99b6", "e18484e185ace186b9"],
+ ["eb99b6", "eb99a4e186b9"],
+ ["eb99b7", "e18484e185ace186ba"],
+ ["eb99b7", "eb99a4e186ba"],
+ ["eb99b8", "e18484e185ace186bb"],
+ ["eb99b8", "eb99a4e186bb"],
+ ["eb99b9", "e18484e185ace186bc"],
+ ["eb99b9", "eb99a4e186bc"],
+ ["eb99ba", "e18484e185ace186bd"],
+ ["eb99ba", "eb99a4e186bd"],
+ ["eb99bb", "e18484e185ace186be"],
+ ["eb99bb", "eb99a4e186be"],
+ ["eb99bc", "e18484e185ace186bf"],
+ ["eb99bc", "eb99a4e186bf"],
+ ["eb99bd", "e18484e185ace18780"],
+ ["eb99bd", "eb99a4e18780"],
+ ["eb99be", "e18484e185ace18781"],
+ ["eb99be", "eb99a4e18781"],
+ ["eb99bf", "e18484e185ace18782"],
+ ["eb99bf", "eb99a4e18782"],
+ ["eb9a80", "e18484e185ad"],
+ ["eb9a81", "e18484e185ade186a8"],
+ ["eb9a81", "eb9a80e186a8"],
+ ["eb9a82", "e18484e185ade186a9"],
+ ["eb9a82", "eb9a80e186a9"],
+ ["eb9a83", "e18484e185ade186aa"],
+ ["eb9a83", "eb9a80e186aa"],
+ ["eb9a84", "e18484e185ade186ab"],
+ ["eb9a84", "eb9a80e186ab"],
+ ["eb9a85", "e18484e185ade186ac"],
+ ["eb9a85", "eb9a80e186ac"],
+ ["eb9a86", "e18484e185ade186ad"],
+ ["eb9a86", "eb9a80e186ad"],
+ ["eb9a87", "e18484e185ade186ae"],
+ ["eb9a87", "eb9a80e186ae"],
+ ["eb9a88", "e18484e185ade186af"],
+ ["eb9a88", "eb9a80e186af"],
+ ["eb9a89", "e18484e185ade186b0"],
+ ["eb9a89", "eb9a80e186b0"],
+ ["eb9a8a", "e18484e185ade186b1"],
+ ["eb9a8a", "eb9a80e186b1"],
+ ["eb9a8b", "e18484e185ade186b2"],
+ ["eb9a8b", "eb9a80e186b2"],
+ ["eb9a8c", "e18484e185ade186b3"],
+ ["eb9a8c", "eb9a80e186b3"],
+ ["eb9a8d", "e18484e185ade186b4"],
+ ["eb9a8d", "eb9a80e186b4"],
+ ["eb9a8e", "e18484e185ade186b5"],
+ ["eb9a8e", "eb9a80e186b5"],
+ ["eb9a8f", "e18484e185ade186b6"],
+ ["eb9a8f", "eb9a80e186b6"],
+ ["eb9a90", "e18484e185ade186b7"],
+ ["eb9a90", "eb9a80e186b7"],
+ ["eb9a91", "e18484e185ade186b8"],
+ ["eb9a91", "eb9a80e186b8"],
+ ["eb9a92", "e18484e185ade186b9"],
+ ["eb9a92", "eb9a80e186b9"],
+ ["eb9a93", "e18484e185ade186ba"],
+ ["eb9a93", "eb9a80e186ba"],
+ ["eb9a94", "e18484e185ade186bb"],
+ ["eb9a94", "eb9a80e186bb"],
+ ["eb9a95", "e18484e185ade186bc"],
+ ["eb9a95", "eb9a80e186bc"],
+ ["eb9a96", "e18484e185ade186bd"],
+ ["eb9a96", "eb9a80e186bd"],
+ ["eb9a97", "e18484e185ade186be"],
+ ["eb9a97", "eb9a80e186be"],
+ ["eb9a98", "e18484e185ade186bf"],
+ ["eb9a98", "eb9a80e186bf"],
+ ["eb9a99", "e18484e185ade18780"],
+ ["eb9a99", "eb9a80e18780"],
+ ["eb9a9a", "e18484e185ade18781"],
+ ["eb9a9a", "eb9a80e18781"],
+ ["eb9a9b", "e18484e185ade18782"],
+ ["eb9a9b", "eb9a80e18782"],
+ ["eb9a9c", "e18484e185ae"],
+ ["eb9a9d", "e18484e185aee186a8"],
+ ["eb9a9d", "eb9a9ce186a8"],
+ ["eb9a9e", "e18484e185aee186a9"],
+ ["eb9a9e", "eb9a9ce186a9"],
+ ["eb9a9f", "e18484e185aee186aa"],
+ ["eb9a9f", "eb9a9ce186aa"],
+ ["eb9aa0", "e18484e185aee186ab"],
+ ["eb9aa0", "eb9a9ce186ab"],
+ ["eb9aa1", "e18484e185aee186ac"],
+ ["eb9aa1", "eb9a9ce186ac"],
+ ["eb9aa2", "e18484e185aee186ad"],
+ ["eb9aa2", "eb9a9ce186ad"],
+ ["eb9aa3", "e18484e185aee186ae"],
+ ["eb9aa3", "eb9a9ce186ae"],
+ ["eb9aa4", "e18484e185aee186af"],
+ ["eb9aa4", "eb9a9ce186af"],
+ ["eb9aa5", "e18484e185aee186b0"],
+ ["eb9aa5", "eb9a9ce186b0"],
+ ["eb9aa6", "e18484e185aee186b1"],
+ ["eb9aa6", "eb9a9ce186b1"],
+ ["eb9aa7", "e18484e185aee186b2"],
+ ["eb9aa7", "eb9a9ce186b2"],
+ ["eb9aa8", "e18484e185aee186b3"],
+ ["eb9aa8", "eb9a9ce186b3"],
+ ["eb9aa9", "e18484e185aee186b4"],
+ ["eb9aa9", "eb9a9ce186b4"],
+ ["eb9aaa", "e18484e185aee186b5"],
+ ["eb9aaa", "eb9a9ce186b5"],
+ ["eb9aab", "e18484e185aee186b6"],
+ ["eb9aab", "eb9a9ce186b6"],
+ ["eb9aac", "e18484e185aee186b7"],
+ ["eb9aac", "eb9a9ce186b7"],
+ ["eb9aad", "e18484e185aee186b8"],
+ ["eb9aad", "eb9a9ce186b8"],
+ ["eb9aae", "e18484e185aee186b9"],
+ ["eb9aae", "eb9a9ce186b9"],
+ ["eb9aaf", "e18484e185aee186ba"],
+ ["eb9aaf", "eb9a9ce186ba"],
+ ["eb9ab0", "e18484e185aee186bb"],
+ ["eb9ab0", "eb9a9ce186bb"],
+ ["eb9ab1", "e18484e185aee186bc"],
+ ["eb9ab1", "eb9a9ce186bc"],
+ ["eb9ab2", "e18484e185aee186bd"],
+ ["eb9ab2", "eb9a9ce186bd"],
+ ["eb9ab3", "e18484e185aee186be"],
+ ["eb9ab3", "eb9a9ce186be"],
+ ["eb9ab4", "e18484e185aee186bf"],
+ ["eb9ab4", "eb9a9ce186bf"],
+ ["eb9ab5", "e18484e185aee18780"],
+ ["eb9ab5", "eb9a9ce18780"],
+ ["eb9ab6", "e18484e185aee18781"],
+ ["eb9ab6", "eb9a9ce18781"],
+ ["eb9ab7", "e18484e185aee18782"],
+ ["eb9ab7", "eb9a9ce18782"],
+ ["eb9ab8", "e18484e185af"],
+ ["eb9ab9", "e18484e185afe186a8"],
+ ["eb9ab9", "eb9ab8e186a8"],
+ ["eb9aba", "e18484e185afe186a9"],
+ ["eb9aba", "eb9ab8e186a9"],
+ ["eb9abb", "e18484e185afe186aa"],
+ ["eb9abb", "eb9ab8e186aa"],
+ ["eb9abc", "e18484e185afe186ab"],
+ ["eb9abc", "eb9ab8e186ab"],
+ ["eb9abd", "e18484e185afe186ac"],
+ ["eb9abd", "eb9ab8e186ac"],
+ ["eb9abe", "e18484e185afe186ad"],
+ ["eb9abe", "eb9ab8e186ad"],
+ ["eb9abf", "e18484e185afe186ae"],
+ ["eb9abf", "eb9ab8e186ae"],
+ ["eb9b80", "e18484e185afe186af"],
+ ["eb9b80", "eb9ab8e186af"],
+ ["eb9b81", "e18484e185afe186b0"],
+ ["eb9b81", "eb9ab8e186b0"],
+ ["eb9b82", "e18484e185afe186b1"],
+ ["eb9b82", "eb9ab8e186b1"],
+ ["eb9b83", "e18484e185afe186b2"],
+ ["eb9b83", "eb9ab8e186b2"],
+ ["eb9b84", "e18484e185afe186b3"],
+ ["eb9b84", "eb9ab8e186b3"],
+ ["eb9b85", "e18484e185afe186b4"],
+ ["eb9b85", "eb9ab8e186b4"],
+ ["eb9b86", "e18484e185afe186b5"],
+ ["eb9b86", "eb9ab8e186b5"],
+ ["eb9b87", "e18484e185afe186b6"],
+ ["eb9b87", "eb9ab8e186b6"],
+ ["eb9b88", "e18484e185afe186b7"],
+ ["eb9b88", "eb9ab8e186b7"],
+ ["eb9b89", "e18484e185afe186b8"],
+ ["eb9b89", "eb9ab8e186b8"],
+ ["eb9b8a", "e18484e185afe186b9"],
+ ["eb9b8a", "eb9ab8e186b9"],
+ ["eb9b8b", "e18484e185afe186ba"],
+ ["eb9b8b", "eb9ab8e186ba"],
+ ["eb9b8c", "e18484e185afe186bb"],
+ ["eb9b8c", "eb9ab8e186bb"],
+ ["eb9b8d", "e18484e185afe186bc"],
+ ["eb9b8d", "eb9ab8e186bc"],
+ ["eb9b8e", "e18484e185afe186bd"],
+ ["eb9b8e", "eb9ab8e186bd"],
+ ["eb9b8f", "e18484e185afe186be"],
+ ["eb9b8f", "eb9ab8e186be"],
+ ["eb9b90", "e18484e185afe186bf"],
+ ["eb9b90", "eb9ab8e186bf"],
+ ["eb9b91", "e18484e185afe18780"],
+ ["eb9b91", "eb9ab8e18780"],
+ ["eb9b92", "e18484e185afe18781"],
+ ["eb9b92", "eb9ab8e18781"],
+ ["eb9b93", "e18484e185afe18782"],
+ ["eb9b93", "eb9ab8e18782"],
+ ["eb9b94", "e18484e185b0"],
+ ["eb9b95", "e18484e185b0e186a8"],
+ ["eb9b95", "eb9b94e186a8"],
+ ["eb9b96", "e18484e185b0e186a9"],
+ ["eb9b96", "eb9b94e186a9"],
+ ["eb9b97", "e18484e185b0e186aa"],
+ ["eb9b97", "eb9b94e186aa"],
+ ["eb9b98", "e18484e185b0e186ab"],
+ ["eb9b98", "eb9b94e186ab"],
+ ["eb9b99", "e18484e185b0e186ac"],
+ ["eb9b99", "eb9b94e186ac"],
+ ["eb9b9a", "e18484e185b0e186ad"],
+ ["eb9b9a", "eb9b94e186ad"],
+ ["eb9b9b", "e18484e185b0e186ae"],
+ ["eb9b9b", "eb9b94e186ae"],
+ ["eb9b9c", "e18484e185b0e186af"],
+ ["eb9b9c", "eb9b94e186af"],
+ ["eb9b9d", "e18484e185b0e186b0"],
+ ["eb9b9d", "eb9b94e186b0"],
+ ["eb9b9e", "e18484e185b0e186b1"],
+ ["eb9b9e", "eb9b94e186b1"],
+ ["eb9b9f", "e18484e185b0e186b2"],
+ ["eb9b9f", "eb9b94e186b2"],
+ ["eb9ba0", "e18484e185b0e186b3"],
+ ["eb9ba0", "eb9b94e186b3"],
+ ["eb9ba1", "e18484e185b0e186b4"],
+ ["eb9ba1", "eb9b94e186b4"],
+ ["eb9ba2", "e18484e185b0e186b5"],
+ ["eb9ba2", "eb9b94e186b5"],
+ ["eb9ba3", "e18484e185b0e186b6"],
+ ["eb9ba3", "eb9b94e186b6"],
+ ["eb9ba4", "e18484e185b0e186b7"],
+ ["eb9ba4", "eb9b94e186b7"],
+ ["eb9ba5", "e18484e185b0e186b8"],
+ ["eb9ba5", "eb9b94e186b8"],
+ ["eb9ba6", "e18484e185b0e186b9"],
+ ["eb9ba6", "eb9b94e186b9"],
+ ["eb9ba7", "e18484e185b0e186ba"],
+ ["eb9ba7", "eb9b94e186ba"],
+ ["eb9ba8", "e18484e185b0e186bb"],
+ ["eb9ba8", "eb9b94e186bb"],
+ ["eb9ba9", "e18484e185b0e186bc"],
+ ["eb9ba9", "eb9b94e186bc"],
+ ["eb9baa", "e18484e185b0e186bd"],
+ ["eb9baa", "eb9b94e186bd"],
+ ["eb9bab", "e18484e185b0e186be"],
+ ["eb9bab", "eb9b94e186be"],
+ ["eb9bac", "e18484e185b0e186bf"],
+ ["eb9bac", "eb9b94e186bf"],
+ ["eb9bad", "e18484e185b0e18780"],
+ ["eb9bad", "eb9b94e18780"],
+ ["eb9bae", "e18484e185b0e18781"],
+ ["eb9bae", "eb9b94e18781"],
+ ["eb9baf", "e18484e185b0e18782"],
+ ["eb9baf", "eb9b94e18782"],
+ ["eb9bb0", "e18484e185b1"],
+ ["eb9bb1", "e18484e185b1e186a8"],
+ ["eb9bb1", "eb9bb0e186a8"],
+ ["eb9bb2", "e18484e185b1e186a9"],
+ ["eb9bb2", "eb9bb0e186a9"],
+ ["eb9bb3", "e18484e185b1e186aa"],
+ ["eb9bb3", "eb9bb0e186aa"],
+ ["eb9bb4", "e18484e185b1e186ab"],
+ ["eb9bb4", "eb9bb0e186ab"],
+ ["eb9bb5", "e18484e185b1e186ac"],
+ ["eb9bb5", "eb9bb0e186ac"],
+ ["eb9bb6", "e18484e185b1e186ad"],
+ ["eb9bb6", "eb9bb0e186ad"],
+ ["eb9bb7", "e18484e185b1e186ae"],
+ ["eb9bb7", "eb9bb0e186ae"],
+ ["eb9bb8", "e18484e185b1e186af"],
+ ["eb9bb8", "eb9bb0e186af"],
+ ["eb9bb9", "e18484e185b1e186b0"],
+ ["eb9bb9", "eb9bb0e186b0"],
+ ["eb9bba", "e18484e185b1e186b1"],
+ ["eb9bba", "eb9bb0e186b1"],
+ ["eb9bbb", "e18484e185b1e186b2"],
+ ["eb9bbb", "eb9bb0e186b2"],
+ ["eb9bbc", "e18484e185b1e186b3"],
+ ["eb9bbc", "eb9bb0e186b3"],
+ ["eb9bbd", "e18484e185b1e186b4"],
+ ["eb9bbd", "eb9bb0e186b4"],
+ ["eb9bbe", "e18484e185b1e186b5"],
+ ["eb9bbe", "eb9bb0e186b5"],
+ ["eb9bbf", "e18484e185b1e186b6"],
+ ["eb9bbf", "eb9bb0e186b6"],
+ ["eb9c80", "e18484e185b1e186b7"],
+ ["eb9c80", "eb9bb0e186b7"],
+ ["eb9c81", "e18484e185b1e186b8"],
+ ["eb9c81", "eb9bb0e186b8"],
+ ["eb9c82", "e18484e185b1e186b9"],
+ ["eb9c82", "eb9bb0e186b9"],
+ ["eb9c83", "e18484e185b1e186ba"],
+ ["eb9c83", "eb9bb0e186ba"],
+ ["eb9c84", "e18484e185b1e186bb"],
+ ["eb9c84", "eb9bb0e186bb"],
+ ["eb9c85", "e18484e185b1e186bc"],
+ ["eb9c85", "eb9bb0e186bc"],
+ ["eb9c86", "e18484e185b1e186bd"],
+ ["eb9c86", "eb9bb0e186bd"],
+ ["eb9c87", "e18484e185b1e186be"],
+ ["eb9c87", "eb9bb0e186be"],
+ ["eb9c88", "e18484e185b1e186bf"],
+ ["eb9c88", "eb9bb0e186bf"],
+ ["eb9c89", "e18484e185b1e18780"],
+ ["eb9c89", "eb9bb0e18780"],
+ ["eb9c8a", "e18484e185b1e18781"],
+ ["eb9c8a", "eb9bb0e18781"],
+ ["eb9c8b", "e18484e185b1e18782"],
+ ["eb9c8b", "eb9bb0e18782"],
+ ["eb9c8c", "e18484e185b2"],
+ ["eb9c8d", "e18484e185b2e186a8"],
+ ["eb9c8d", "eb9c8ce186a8"],
+ ["eb9c8e", "e18484e185b2e186a9"],
+ ["eb9c8e", "eb9c8ce186a9"],
+ ["eb9c8f", "e18484e185b2e186aa"],
+ ["eb9c8f", "eb9c8ce186aa"],
+ ["eb9c90", "e18484e185b2e186ab"],
+ ["eb9c90", "eb9c8ce186ab"],
+ ["eb9c91", "e18484e185b2e186ac"],
+ ["eb9c91", "eb9c8ce186ac"],
+ ["eb9c92", "e18484e185b2e186ad"],
+ ["eb9c92", "eb9c8ce186ad"],
+ ["eb9c93", "e18484e185b2e186ae"],
+ ["eb9c93", "eb9c8ce186ae"],
+ ["eb9c94", "e18484e185b2e186af"],
+ ["eb9c94", "eb9c8ce186af"],
+ ["eb9c95", "e18484e185b2e186b0"],
+ ["eb9c95", "eb9c8ce186b0"],
+ ["eb9c96", "e18484e185b2e186b1"],
+ ["eb9c96", "eb9c8ce186b1"],
+ ["eb9c97", "e18484e185b2e186b2"],
+ ["eb9c97", "eb9c8ce186b2"],
+ ["eb9c98", "e18484e185b2e186b3"],
+ ["eb9c98", "eb9c8ce186b3"],
+ ["eb9c99", "e18484e185b2e186b4"],
+ ["eb9c99", "eb9c8ce186b4"],
+ ["eb9c9a", "e18484e185b2e186b5"],
+ ["eb9c9a", "eb9c8ce186b5"],
+ ["eb9c9b", "e18484e185b2e186b6"],
+ ["eb9c9b", "eb9c8ce186b6"],
+ ["eb9c9c", "e18484e185b2e186b7"],
+ ["eb9c9c", "eb9c8ce186b7"],
+ ["eb9c9d", "e18484e185b2e186b8"],
+ ["eb9c9d", "eb9c8ce186b8"],
+ ["eb9c9e", "e18484e185b2e186b9"],
+ ["eb9c9e", "eb9c8ce186b9"],
+ ["eb9c9f", "e18484e185b2e186ba"],
+ ["eb9c9f", "eb9c8ce186ba"],
+ ["eb9ca0", "e18484e185b2e186bb"],
+ ["eb9ca0", "eb9c8ce186bb"],
+ ["eb9ca1", "e18484e185b2e186bc"],
+ ["eb9ca1", "eb9c8ce186bc"],
+ ["eb9ca2", "e18484e185b2e186bd"],
+ ["eb9ca2", "eb9c8ce186bd"],
+ ["eb9ca3", "e18484e185b2e186be"],
+ ["eb9ca3", "eb9c8ce186be"],
+ ["eb9ca4", "e18484e185b2e186bf"],
+ ["eb9ca4", "eb9c8ce186bf"],
+ ["eb9ca5", "e18484e185b2e18780"],
+ ["eb9ca5", "eb9c8ce18780"],
+ ["eb9ca6", "e18484e185b2e18781"],
+ ["eb9ca6", "eb9c8ce18781"],
+ ["eb9ca7", "e18484e185b2e18782"],
+ ["eb9ca7", "eb9c8ce18782"],
+ ["eb9ca8", "e18484e185b3"],
+ ["eb9ca9", "e18484e185b3e186a8"],
+ ["eb9ca9", "eb9ca8e186a8"],
+ ["eb9caa", "e18484e185b3e186a9"],
+ ["eb9caa", "eb9ca8e186a9"],
+ ["eb9cab", "e18484e185b3e186aa"],
+ ["eb9cab", "eb9ca8e186aa"],
+ ["eb9cac", "e18484e185b3e186ab"],
+ ["eb9cac", "eb9ca8e186ab"],
+ ["eb9cad", "e18484e185b3e186ac"],
+ ["eb9cad", "eb9ca8e186ac"],
+ ["eb9cae", "e18484e185b3e186ad"],
+ ["eb9cae", "eb9ca8e186ad"],
+ ["eb9caf", "e18484e185b3e186ae"],
+ ["eb9caf", "eb9ca8e186ae"],
+ ["eb9cb0", "e18484e185b3e186af"],
+ ["eb9cb0", "eb9ca8e186af"],
+ ["eb9cb1", "e18484e185b3e186b0"],
+ ["eb9cb1", "eb9ca8e186b0"],
+ ["eb9cb2", "e18484e185b3e186b1"],
+ ["eb9cb2", "eb9ca8e186b1"],
+ ["eb9cb3", "e18484e185b3e186b2"],
+ ["eb9cb3", "eb9ca8e186b2"],
+ ["eb9cb4", "e18484e185b3e186b3"],
+ ["eb9cb4", "eb9ca8e186b3"],
+ ["eb9cb5", "e18484e185b3e186b4"],
+ ["eb9cb5", "eb9ca8e186b4"],
+ ["eb9cb6", "e18484e185b3e186b5"],
+ ["eb9cb6", "eb9ca8e186b5"],
+ ["eb9cb7", "e18484e185b3e186b6"],
+ ["eb9cb7", "eb9ca8e186b6"],
+ ["eb9cb8", "e18484e185b3e186b7"],
+ ["eb9cb8", "eb9ca8e186b7"],
+ ["eb9cb9", "e18484e185b3e186b8"],
+ ["eb9cb9", "eb9ca8e186b8"],
+ ["eb9cba", "e18484e185b3e186b9"],
+ ["eb9cba", "eb9ca8e186b9"],
+ ["eb9cbb", "e18484e185b3e186ba"],
+ ["eb9cbb", "eb9ca8e186ba"],
+ ["eb9cbc", "e18484e185b3e186bb"],
+ ["eb9cbc", "eb9ca8e186bb"],
+ ["eb9cbd", "e18484e185b3e186bc"],
+ ["eb9cbd", "eb9ca8e186bc"],
+ ["eb9cbe", "e18484e185b3e186bd"],
+ ["eb9cbe", "eb9ca8e186bd"],
+ ["eb9cbf", "e18484e185b3e186be"],
+ ["eb9cbf", "eb9ca8e186be"],
+ ["eb9d80", "e18484e185b3e186bf"],
+ ["eb9d80", "eb9ca8e186bf"],
+ ["eb9d81", "e18484e185b3e18780"],
+ ["eb9d81", "eb9ca8e18780"],
+ ["eb9d82", "e18484e185b3e18781"],
+ ["eb9d82", "eb9ca8e18781"],
+ ["eb9d83", "e18484e185b3e18782"],
+ ["eb9d83", "eb9ca8e18782"],
+ ["eb9d84", "e18484e185b4"],
+ ["eb9d85", "e18484e185b4e186a8"],
+ ["eb9d85", "eb9d84e186a8"],
+ ["eb9d86", "e18484e185b4e186a9"],
+ ["eb9d86", "eb9d84e186a9"],
+ ["eb9d87", "e18484e185b4e186aa"],
+ ["eb9d87", "eb9d84e186aa"],
+ ["eb9d88", "e18484e185b4e186ab"],
+ ["eb9d88", "eb9d84e186ab"],
+ ["eb9d89", "e18484e185b4e186ac"],
+ ["eb9d89", "eb9d84e186ac"],
+ ["eb9d8a", "e18484e185b4e186ad"],
+ ["eb9d8a", "eb9d84e186ad"],
+ ["eb9d8b", "e18484e185b4e186ae"],
+ ["eb9d8b", "eb9d84e186ae"],
+ ["eb9d8c", "e18484e185b4e186af"],
+ ["eb9d8c", "eb9d84e186af"],
+ ["eb9d8d", "e18484e185b4e186b0"],
+ ["eb9d8d", "eb9d84e186b0"],
+ ["eb9d8e", "e18484e185b4e186b1"],
+ ["eb9d8e", "eb9d84e186b1"],
+ ["eb9d8f", "e18484e185b4e186b2"],
+ ["eb9d8f", "eb9d84e186b2"],
+ ["eb9d90", "e18484e185b4e186b3"],
+ ["eb9d90", "eb9d84e186b3"],
+ ["eb9d91", "e18484e185b4e186b4"],
+ ["eb9d91", "eb9d84e186b4"],
+ ["eb9d92", "e18484e185b4e186b5"],
+ ["eb9d92", "eb9d84e186b5"],
+ ["eb9d93", "e18484e185b4e186b6"],
+ ["eb9d93", "eb9d84e186b6"],
+ ["eb9d94", "e18484e185b4e186b7"],
+ ["eb9d94", "eb9d84e186b7"],
+ ["eb9d95", "e18484e185b4e186b8"],
+ ["eb9d95", "eb9d84e186b8"],
+ ["eb9d96", "e18484e185b4e186b9"],
+ ["eb9d96", "eb9d84e186b9"],
+ ["eb9d97", "e18484e185b4e186ba"],
+ ["eb9d97", "eb9d84e186ba"],
+ ["eb9d98", "e18484e185b4e186bb"],
+ ["eb9d98", "eb9d84e186bb"],
+ ["eb9d99", "e18484e185b4e186bc"],
+ ["eb9d99", "eb9d84e186bc"],
+ ["eb9d9a", "e18484e185b4e186bd"],
+ ["eb9d9a", "eb9d84e186bd"],
+ ["eb9d9b", "e18484e185b4e186be"],
+ ["eb9d9b", "eb9d84e186be"],
+ ["eb9d9c", "e18484e185b4e186bf"],
+ ["eb9d9c", "eb9d84e186bf"],
+ ["eb9d9d", "e18484e185b4e18780"],
+ ["eb9d9d", "eb9d84e18780"],
+ ["eb9d9e", "e18484e185b4e18781"],
+ ["eb9d9e", "eb9d84e18781"],
+ ["eb9d9f", "e18484e185b4e18782"],
+ ["eb9d9f", "eb9d84e18782"],
+ ["eb9da0", "e18484e185b5"],
+ ["eb9da1", "e18484e185b5e186a8"],
+ ["eb9da1", "eb9da0e186a8"],
+ ["eb9da2", "e18484e185b5e186a9"],
+ ["eb9da2", "eb9da0e186a9"],
+ ["eb9da3", "e18484e185b5e186aa"],
+ ["eb9da3", "eb9da0e186aa"],
+ ["eb9da4", "e18484e185b5e186ab"],
+ ["eb9da4", "eb9da0e186ab"],
+ ["eb9da5", "e18484e185b5e186ac"],
+ ["eb9da5", "eb9da0e186ac"],
+ ["eb9da6", "e18484e185b5e186ad"],
+ ["eb9da6", "eb9da0e186ad"],
+ ["eb9da7", "e18484e185b5e186ae"],
+ ["eb9da7", "eb9da0e186ae"],
+ ["eb9da8", "e18484e185b5e186af"],
+ ["eb9da8", "eb9da0e186af"],
+ ["eb9da9", "e18484e185b5e186b0"],
+ ["eb9da9", "eb9da0e186b0"],
+ ["eb9daa", "e18484e185b5e186b1"],
+ ["eb9daa", "eb9da0e186b1"],
+ ["eb9dab", "e18484e185b5e186b2"],
+ ["eb9dab", "eb9da0e186b2"],
+ ["eb9dac", "e18484e185b5e186b3"],
+ ["eb9dac", "eb9da0e186b3"],
+ ["eb9dad", "e18484e185b5e186b4"],
+ ["eb9dad", "eb9da0e186b4"],
+ ["eb9dae", "e18484e185b5e186b5"],
+ ["eb9dae", "eb9da0e186b5"],
+ ["eb9daf", "e18484e185b5e186b6"],
+ ["eb9daf", "eb9da0e186b6"],
+ ["eb9db0", "e18484e185b5e186b7"],
+ ["eb9db0", "eb9da0e186b7"],
+ ["eb9db1", "e18484e185b5e186b8"],
+ ["eb9db1", "eb9da0e186b8"],
+ ["eb9db2", "e18484e185b5e186b9"],
+ ["eb9db2", "eb9da0e186b9"],
+ ["eb9db3", "e18484e185b5e186ba"],
+ ["eb9db3", "eb9da0e186ba"],
+ ["eb9db4", "e18484e185b5e186bb"],
+ ["eb9db4", "eb9da0e186bb"],
+ ["eb9db5", "e18484e185b5e186bc"],
+ ["eb9db5", "eb9da0e186bc"],
+ ["eb9db6", "e18484e185b5e186bd"],
+ ["eb9db6", "eb9da0e186bd"],
+ ["eb9db7", "e18484e185b5e186be"],
+ ["eb9db7", "eb9da0e186be"],
+ ["eb9db8", "e18484e185b5e186bf"],
+ ["eb9db8", "eb9da0e186bf"],
+ ["eb9db9", "e18484e185b5e18780"],
+ ["eb9db9", "eb9da0e18780"],
+ ["eb9dba", "e18484e185b5e18781"],
+ ["eb9dba", "eb9da0e18781"],
+ ["eb9dbb", "e18484e185b5e18782"],
+ ["eb9dbb", "eb9da0e18782"],
+ ["eb9dbc", "e18485e185a1"],
+ ["eb9dbd", "e18485e185a1e186a8"],
+ ["eb9dbd", "eb9dbce186a8"],
+ ["eb9dbe", "e18485e185a1e186a9"],
+ ["eb9dbe", "eb9dbce186a9"],
+ ["eb9dbf", "e18485e185a1e186aa"],
+ ["eb9dbf", "eb9dbce186aa"],
+ ["eb9e80", "e18485e185a1e186ab"],
+ ["eb9e80", "eb9dbce186ab"],
+ ["eb9e81", "e18485e185a1e186ac"],
+ ["eb9e81", "eb9dbce186ac"],
+ ["eb9e82", "e18485e185a1e186ad"],
+ ["eb9e82", "eb9dbce186ad"],
+ ["eb9e83", "e18485e185a1e186ae"],
+ ["eb9e83", "eb9dbce186ae"],
+ ["eb9e84", "e18485e185a1e186af"],
+ ["eb9e84", "eb9dbce186af"],
+ ["eb9e85", "e18485e185a1e186b0"],
+ ["eb9e85", "eb9dbce186b0"],
+ ["eb9e86", "e18485e185a1e186b1"],
+ ["eb9e86", "eb9dbce186b1"],
+ ["eb9e87", "e18485e185a1e186b2"],
+ ["eb9e87", "eb9dbce186b2"],
+ ["eb9e88", "e18485e185a1e186b3"],
+ ["eb9e88", "eb9dbce186b3"],
+ ["eb9e89", "e18485e185a1e186b4"],
+ ["eb9e89", "eb9dbce186b4"],
+ ["eb9e8a", "e18485e185a1e186b5"],
+ ["eb9e8a", "eb9dbce186b5"],
+ ["eb9e8b", "e18485e185a1e186b6"],
+ ["eb9e8b", "eb9dbce186b6"],
+ ["eb9e8c", "e18485e185a1e186b7"],
+ ["eb9e8c", "eb9dbce186b7"],
+ ["eb9e8d", "e18485e185a1e186b8"],
+ ["eb9e8d", "eb9dbce186b8"],
+ ["eb9e8e", "e18485e185a1e186b9"],
+ ["eb9e8e", "eb9dbce186b9"],
+ ["eb9e8f", "e18485e185a1e186ba"],
+ ["eb9e8f", "eb9dbce186ba"],
+ ["eb9e90", "e18485e185a1e186bb"],
+ ["eb9e90", "eb9dbce186bb"],
+ ["eb9e91", "e18485e185a1e186bc"],
+ ["eb9e91", "eb9dbce186bc"],
+ ["eb9e92", "e18485e185a1e186bd"],
+ ["eb9e92", "eb9dbce186bd"],
+ ["eb9e93", "e18485e185a1e186be"],
+ ["eb9e93", "eb9dbce186be"],
+ ["eb9e94", "e18485e185a1e186bf"],
+ ["eb9e94", "eb9dbce186bf"],
+ ["eb9e95", "e18485e185a1e18780"],
+ ["eb9e95", "eb9dbce18780"],
+ ["eb9e96", "e18485e185a1e18781"],
+ ["eb9e96", "eb9dbce18781"],
+ ["eb9e97", "e18485e185a1e18782"],
+ ["eb9e97", "eb9dbce18782"],
+ ["eb9e98", "e18485e185a2"],
+ ["eb9e99", "e18485e185a2e186a8"],
+ ["eb9e99", "eb9e98e186a8"],
+ ["eb9e9a", "e18485e185a2e186a9"],
+ ["eb9e9a", "eb9e98e186a9"],
+ ["eb9e9b", "e18485e185a2e186aa"],
+ ["eb9e9b", "eb9e98e186aa"],
+ ["eb9e9c", "e18485e185a2e186ab"],
+ ["eb9e9c", "eb9e98e186ab"],
+ ["eb9e9d", "e18485e185a2e186ac"],
+ ["eb9e9d", "eb9e98e186ac"],
+ ["eb9e9e", "e18485e185a2e186ad"],
+ ["eb9e9e", "eb9e98e186ad"],
+ ["eb9e9f", "e18485e185a2e186ae"],
+ ["eb9e9f", "eb9e98e186ae"],
+ ["eb9ea0", "e18485e185a2e186af"],
+ ["eb9ea0", "eb9e98e186af"],
+ ["eb9ea1", "e18485e185a2e186b0"],
+ ["eb9ea1", "eb9e98e186b0"],
+ ["eb9ea2", "e18485e185a2e186b1"],
+ ["eb9ea2", "eb9e98e186b1"],
+ ["eb9ea3", "e18485e185a2e186b2"],
+ ["eb9ea3", "eb9e98e186b2"],
+ ["eb9ea4", "e18485e185a2e186b3"],
+ ["eb9ea4", "eb9e98e186b3"],
+ ["eb9ea5", "e18485e185a2e186b4"],
+ ["eb9ea5", "eb9e98e186b4"],
+ ["eb9ea6", "e18485e185a2e186b5"],
+ ["eb9ea6", "eb9e98e186b5"],
+ ["eb9ea7", "e18485e185a2e186b6"],
+ ["eb9ea7", "eb9e98e186b6"],
+ ["eb9ea8", "e18485e185a2e186b7"],
+ ["eb9ea8", "eb9e98e186b7"],
+ ["eb9ea9", "e18485e185a2e186b8"],
+ ["eb9ea9", "eb9e98e186b8"],
+ ["eb9eaa", "e18485e185a2e186b9"],
+ ["eb9eaa", "eb9e98e186b9"],
+ ["eb9eab", "e18485e185a2e186ba"],
+ ["eb9eab", "eb9e98e186ba"],
+ ["eb9eac", "e18485e185a2e186bb"],
+ ["eb9eac", "eb9e98e186bb"],
+ ["eb9ead", "e18485e185a2e186bc"],
+ ["eb9ead", "eb9e98e186bc"],
+ ["eb9eae", "e18485e185a2e186bd"],
+ ["eb9eae", "eb9e98e186bd"],
+ ["eb9eaf", "e18485e185a2e186be"],
+ ["eb9eaf", "eb9e98e186be"],
+ ["eb9eb0", "e18485e185a2e186bf"],
+ ["eb9eb0", "eb9e98e186bf"],
+ ["eb9eb1", "e18485e185a2e18780"],
+ ["eb9eb1", "eb9e98e18780"],
+ ["eb9eb2", "e18485e185a2e18781"],
+ ["eb9eb2", "eb9e98e18781"],
+ ["eb9eb3", "e18485e185a2e18782"],
+ ["eb9eb3", "eb9e98e18782"],
+ ["eb9eb4", "e18485e185a3"],
+ ["eb9eb5", "e18485e185a3e186a8"],
+ ["eb9eb5", "eb9eb4e186a8"],
+ ["eb9eb6", "e18485e185a3e186a9"],
+ ["eb9eb6", "eb9eb4e186a9"],
+ ["eb9eb7", "e18485e185a3e186aa"],
+ ["eb9eb7", "eb9eb4e186aa"],
+ ["eb9eb8", "e18485e185a3e186ab"],
+ ["eb9eb8", "eb9eb4e186ab"],
+ ["eb9eb9", "e18485e185a3e186ac"],
+ ["eb9eb9", "eb9eb4e186ac"],
+ ["eb9eba", "e18485e185a3e186ad"],
+ ["eb9eba", "eb9eb4e186ad"],
+ ["eb9ebb", "e18485e185a3e186ae"],
+ ["eb9ebb", "eb9eb4e186ae"],
+ ["eb9ebc", "e18485e185a3e186af"],
+ ["eb9ebc", "eb9eb4e186af"],
+ ["eb9ebd", "e18485e185a3e186b0"],
+ ["eb9ebd", "eb9eb4e186b0"],
+ ["eb9ebe", "e18485e185a3e186b1"],
+ ["eb9ebe", "eb9eb4e186b1"],
+ ["eb9ebf", "e18485e185a3e186b2"],
+ ["eb9ebf", "eb9eb4e186b2"],
+ ["eb9f80", "e18485e185a3e186b3"],
+ ["eb9f80", "eb9eb4e186b3"],
+ ["eb9f81", "e18485e185a3e186b4"],
+ ["eb9f81", "eb9eb4e186b4"],
+ ["eb9f82", "e18485e185a3e186b5"],
+ ["eb9f82", "eb9eb4e186b5"],
+ ["eb9f83", "e18485e185a3e186b6"],
+ ["eb9f83", "eb9eb4e186b6"],
+ ["eb9f84", "e18485e185a3e186b7"],
+ ["eb9f84", "eb9eb4e186b7"],
+ ["eb9f85", "e18485e185a3e186b8"],
+ ["eb9f85", "eb9eb4e186b8"],
+ ["eb9f86", "e18485e185a3e186b9"],
+ ["eb9f86", "eb9eb4e186b9"],
+ ["eb9f87", "e18485e185a3e186ba"],
+ ["eb9f87", "eb9eb4e186ba"],
+ ["eb9f88", "e18485e185a3e186bb"],
+ ["eb9f88", "eb9eb4e186bb"],
+ ["eb9f89", "e18485e185a3e186bc"],
+ ["eb9f89", "eb9eb4e186bc"],
+ ["eb9f8a", "e18485e185a3e186bd"],
+ ["eb9f8a", "eb9eb4e186bd"],
+ ["eb9f8b", "e18485e185a3e186be"],
+ ["eb9f8b", "eb9eb4e186be"],
+ ["eb9f8c", "e18485e185a3e186bf"],
+ ["eb9f8c", "eb9eb4e186bf"],
+ ["eb9f8d", "e18485e185a3e18780"],
+ ["eb9f8d", "eb9eb4e18780"],
+ ["eb9f8e", "e18485e185a3e18781"],
+ ["eb9f8e", "eb9eb4e18781"],
+ ["eb9f8f", "e18485e185a3e18782"],
+ ["eb9f8f", "eb9eb4e18782"],
+ ["eb9f90", "e18485e185a4"],
+ ["eb9f91", "e18485e185a4e186a8"],
+ ["eb9f91", "eb9f90e186a8"],
+ ["eb9f92", "e18485e185a4e186a9"],
+ ["eb9f92", "eb9f90e186a9"],
+ ["eb9f93", "e18485e185a4e186aa"],
+ ["eb9f93", "eb9f90e186aa"],
+ ["eb9f94", "e18485e185a4e186ab"],
+ ["eb9f94", "eb9f90e186ab"],
+ ["eb9f95", "e18485e185a4e186ac"],
+ ["eb9f95", "eb9f90e186ac"],
+ ["eb9f96", "e18485e185a4e186ad"],
+ ["eb9f96", "eb9f90e186ad"],
+ ["eb9f97", "e18485e185a4e186ae"],
+ ["eb9f97", "eb9f90e186ae"],
+ ["eb9f98", "e18485e185a4e186af"],
+ ["eb9f98", "eb9f90e186af"],
+ ["eb9f99", "e18485e185a4e186b0"],
+ ["eb9f99", "eb9f90e186b0"],
+ ["eb9f9a", "e18485e185a4e186b1"],
+ ["eb9f9a", "eb9f90e186b1"],
+ ["eb9f9b", "e18485e185a4e186b2"],
+ ["eb9f9b", "eb9f90e186b2"],
+ ["eb9f9c", "e18485e185a4e186b3"],
+ ["eb9f9c", "eb9f90e186b3"],
+ ["eb9f9d", "e18485e185a4e186b4"],
+ ["eb9f9d", "eb9f90e186b4"],
+ ["eb9f9e", "e18485e185a4e186b5"],
+ ["eb9f9e", "eb9f90e186b5"],
+ ["eb9f9f", "e18485e185a4e186b6"],
+ ["eb9f9f", "eb9f90e186b6"],
+ ["eb9fa0", "e18485e185a4e186b7"],
+ ["eb9fa0", "eb9f90e186b7"],
+ ["eb9fa1", "e18485e185a4e186b8"],
+ ["eb9fa1", "eb9f90e186b8"],
+ ["eb9fa2", "e18485e185a4e186b9"],
+ ["eb9fa2", "eb9f90e186b9"],
+ ["eb9fa3", "e18485e185a4e186ba"],
+ ["eb9fa3", "eb9f90e186ba"],
+ ["eb9fa4", "e18485e185a4e186bb"],
+ ["eb9fa4", "eb9f90e186bb"],
+ ["eb9fa5", "e18485e185a4e186bc"],
+ ["eb9fa5", "eb9f90e186bc"],
+ ["eb9fa6", "e18485e185a4e186bd"],
+ ["eb9fa6", "eb9f90e186bd"],
+ ["eb9fa7", "e18485e185a4e186be"],
+ ["eb9fa7", "eb9f90e186be"],
+ ["eb9fa8", "e18485e185a4e186bf"],
+ ["eb9fa8", "eb9f90e186bf"],
+ ["eb9fa9", "e18485e185a4e18780"],
+ ["eb9fa9", "eb9f90e18780"],
+ ["eb9faa", "e18485e185a4e18781"],
+ ["eb9faa", "eb9f90e18781"],
+ ["eb9fab", "e18485e185a4e18782"],
+ ["eb9fab", "eb9f90e18782"],
+ ["eb9fac", "e18485e185a5"],
+ ["eb9fad", "e18485e185a5e186a8"],
+ ["eb9fad", "eb9face186a8"],
+ ["eb9fae", "e18485e185a5e186a9"],
+ ["eb9fae", "eb9face186a9"],
+ ["eb9faf", "e18485e185a5e186aa"],
+ ["eb9faf", "eb9face186aa"],
+ ["eb9fb0", "e18485e185a5e186ab"],
+ ["eb9fb0", "eb9face186ab"],
+ ["eb9fb1", "e18485e185a5e186ac"],
+ ["eb9fb1", "eb9face186ac"],
+ ["eb9fb2", "e18485e185a5e186ad"],
+ ["eb9fb2", "eb9face186ad"],
+ ["eb9fb3", "e18485e185a5e186ae"],
+ ["eb9fb3", "eb9face186ae"],
+ ["eb9fb4", "e18485e185a5e186af"],
+ ["eb9fb4", "eb9face186af"],
+ ["eb9fb5", "e18485e185a5e186b0"],
+ ["eb9fb5", "eb9face186b0"],
+ ["eb9fb6", "e18485e185a5e186b1"],
+ ["eb9fb6", "eb9face186b1"],
+ ["eb9fb7", "e18485e185a5e186b2"],
+ ["eb9fb7", "eb9face186b2"],
+ ["eb9fb8", "e18485e185a5e186b3"],
+ ["eb9fb8", "eb9face186b3"],
+ ["eb9fb9", "e18485e185a5e186b4"],
+ ["eb9fb9", "eb9face186b4"],
+ ["eb9fba", "e18485e185a5e186b5"],
+ ["eb9fba", "eb9face186b5"],
+ ["eb9fbb", "e18485e185a5e186b6"],
+ ["eb9fbb", "eb9face186b6"],
+ ["eb9fbc", "e18485e185a5e186b7"],
+ ["eb9fbc", "eb9face186b7"],
+ ["eb9fbd", "e18485e185a5e186b8"],
+ ["eb9fbd", "eb9face186b8"],
+ ["eb9fbe", "e18485e185a5e186b9"],
+ ["eb9fbe", "eb9face186b9"],
+ ["eb9fbf", "e18485e185a5e186ba"],
+ ["eb9fbf", "eb9face186ba"],
+ ["eba080", "e18485e185a5e186bb"],
+ ["eba080", "eb9face186bb"],
+ ["eba081", "e18485e185a5e186bc"],
+ ["eba081", "eb9face186bc"],
+ ["eba082", "e18485e185a5e186bd"],
+ ["eba082", "eb9face186bd"],
+ ["eba083", "e18485e185a5e186be"],
+ ["eba083", "eb9face186be"],
+ ["eba084", "e18485e185a5e186bf"],
+ ["eba084", "eb9face186bf"],
+ ["eba085", "e18485e185a5e18780"],
+ ["eba085", "eb9face18780"],
+ ["eba086", "e18485e185a5e18781"],
+ ["eba086", "eb9face18781"],
+ ["eba087", "e18485e185a5e18782"],
+ ["eba087", "eb9face18782"],
+ ["eba088", "e18485e185a6"],
+ ["eba089", "e18485e185a6e186a8"],
+ ["eba089", "eba088e186a8"],
+ ["eba08a", "e18485e185a6e186a9"],
+ ["eba08a", "eba088e186a9"],
+ ["eba08b", "e18485e185a6e186aa"],
+ ["eba08b", "eba088e186aa"],
+ ["eba08c", "e18485e185a6e186ab"],
+ ["eba08c", "eba088e186ab"],
+ ["eba08d", "e18485e185a6e186ac"],
+ ["eba08d", "eba088e186ac"],
+ ["eba08e", "e18485e185a6e186ad"],
+ ["eba08e", "eba088e186ad"],
+ ["eba08f", "e18485e185a6e186ae"],
+ ["eba08f", "eba088e186ae"],
+ ["eba090", "e18485e185a6e186af"],
+ ["eba090", "eba088e186af"],
+ ["eba091", "e18485e185a6e186b0"],
+ ["eba091", "eba088e186b0"],
+ ["eba092", "e18485e185a6e186b1"],
+ ["eba092", "eba088e186b1"],
+ ["eba093", "e18485e185a6e186b2"],
+ ["eba093", "eba088e186b2"],
+ ["eba094", "e18485e185a6e186b3"],
+ ["eba094", "eba088e186b3"],
+ ["eba095", "e18485e185a6e186b4"],
+ ["eba095", "eba088e186b4"],
+ ["eba096", "e18485e185a6e186b5"],
+ ["eba096", "eba088e186b5"],
+ ["eba097", "e18485e185a6e186b6"],
+ ["eba097", "eba088e186b6"],
+ ["eba098", "e18485e185a6e186b7"],
+ ["eba098", "eba088e186b7"],
+ ["eba099", "e18485e185a6e186b8"],
+ ["eba099", "eba088e186b8"],
+ ["eba09a", "e18485e185a6e186b9"],
+ ["eba09a", "eba088e186b9"],
+ ["eba09b", "e18485e185a6e186ba"],
+ ["eba09b", "eba088e186ba"],
+ ["eba09c", "e18485e185a6e186bb"],
+ ["eba09c", "eba088e186bb"],
+ ["eba09d", "e18485e185a6e186bc"],
+ ["eba09d", "eba088e186bc"],
+ ["eba09e", "e18485e185a6e186bd"],
+ ["eba09e", "eba088e186bd"],
+ ["eba09f", "e18485e185a6e186be"],
+ ["eba09f", "eba088e186be"],
+ ["eba0a0", "e18485e185a6e186bf"],
+ ["eba0a0", "eba088e186bf"],
+ ["eba0a1", "e18485e185a6e18780"],
+ ["eba0a1", "eba088e18780"],
+ ["eba0a2", "e18485e185a6e18781"],
+ ["eba0a2", "eba088e18781"],
+ ["eba0a3", "e18485e185a6e18782"],
+ ["eba0a3", "eba088e18782"],
+ ["eba0a4", "e18485e185a7"],
+ ["eba0a5", "e18485e185a7e186a8"],
+ ["eba0a5", "eba0a4e186a8"],
+ ["eba0a6", "e18485e185a7e186a9"],
+ ["eba0a6", "eba0a4e186a9"],
+ ["eba0a7", "e18485e185a7e186aa"],
+ ["eba0a7", "eba0a4e186aa"],
+ ["eba0a8", "e18485e185a7e186ab"],
+ ["eba0a8", "eba0a4e186ab"],
+ ["eba0a9", "e18485e185a7e186ac"],
+ ["eba0a9", "eba0a4e186ac"],
+ ["eba0aa", "e18485e185a7e186ad"],
+ ["eba0aa", "eba0a4e186ad"],
+ ["eba0ab", "e18485e185a7e186ae"],
+ ["eba0ab", "eba0a4e186ae"],
+ ["eba0ac", "e18485e185a7e186af"],
+ ["eba0ac", "eba0a4e186af"],
+ ["eba0ad", "e18485e185a7e186b0"],
+ ["eba0ad", "eba0a4e186b0"],
+ ["eba0ae", "e18485e185a7e186b1"],
+ ["eba0ae", "eba0a4e186b1"],
+ ["eba0af", "e18485e185a7e186b2"],
+ ["eba0af", "eba0a4e186b2"],
+ ["eba0b0", "e18485e185a7e186b3"],
+ ["eba0b0", "eba0a4e186b3"],
+ ["eba0b1", "e18485e185a7e186b4"],
+ ["eba0b1", "eba0a4e186b4"],
+ ["eba0b2", "e18485e185a7e186b5"],
+ ["eba0b2", "eba0a4e186b5"],
+ ["eba0b3", "e18485e185a7e186b6"],
+ ["eba0b3", "eba0a4e186b6"],
+ ["eba0b4", "e18485e185a7e186b7"],
+ ["eba0b4", "eba0a4e186b7"],
+ ["eba0b5", "e18485e185a7e186b8"],
+ ["eba0b5", "eba0a4e186b8"],
+ ["eba0b6", "e18485e185a7e186b9"],
+ ["eba0b6", "eba0a4e186b9"],
+ ["eba0b7", "e18485e185a7e186ba"],
+ ["eba0b7", "eba0a4e186ba"],
+ ["eba0b8", "e18485e185a7e186bb"],
+ ["eba0b8", "eba0a4e186bb"],
+ ["eba0b9", "e18485e185a7e186bc"],
+ ["eba0b9", "eba0a4e186bc"],
+ ["eba0ba", "e18485e185a7e186bd"],
+ ["eba0ba", "eba0a4e186bd"],
+ ["eba0bb", "e18485e185a7e186be"],
+ ["eba0bb", "eba0a4e186be"],
+ ["eba0bc", "e18485e185a7e186bf"],
+ ["eba0bc", "eba0a4e186bf"],
+ ["eba0bd", "e18485e185a7e18780"],
+ ["eba0bd", "eba0a4e18780"],
+ ["eba0be", "e18485e185a7e18781"],
+ ["eba0be", "eba0a4e18781"],
+ ["eba0bf", "e18485e185a7e18782"],
+ ["eba0bf", "eba0a4e18782"],
+ ["eba180", "e18485e185a8"],
+ ["eba181", "e18485e185a8e186a8"],
+ ["eba181", "eba180e186a8"],
+ ["eba182", "e18485e185a8e186a9"],
+ ["eba182", "eba180e186a9"],
+ ["eba183", "e18485e185a8e186aa"],
+ ["eba183", "eba180e186aa"],
+ ["eba184", "e18485e185a8e186ab"],
+ ["eba184", "eba180e186ab"],
+ ["eba185", "e18485e185a8e186ac"],
+ ["eba185", "eba180e186ac"],
+ ["eba186", "e18485e185a8e186ad"],
+ ["eba186", "eba180e186ad"],
+ ["eba187", "e18485e185a8e186ae"],
+ ["eba187", "eba180e186ae"],
+ ["eba188", "e18485e185a8e186af"],
+ ["eba188", "eba180e186af"],
+ ["eba189", "e18485e185a8e186b0"],
+ ["eba189", "eba180e186b0"],
+ ["eba18a", "e18485e185a8e186b1"],
+ ["eba18a", "eba180e186b1"],
+ ["eba18b", "e18485e185a8e186b2"],
+ ["eba18b", "eba180e186b2"],
+ ["eba18c", "e18485e185a8e186b3"],
+ ["eba18c", "eba180e186b3"],
+ ["eba18d", "e18485e185a8e186b4"],
+ ["eba18d", "eba180e186b4"],
+ ["eba18e", "e18485e185a8e186b5"],
+ ["eba18e", "eba180e186b5"],
+ ["eba18f", "e18485e185a8e186b6"],
+ ["eba18f", "eba180e186b6"],
+ ["eba190", "e18485e185a8e186b7"],
+ ["eba190", "eba180e186b7"],
+ ["eba191", "e18485e185a8e186b8"],
+ ["eba191", "eba180e186b8"],
+ ["eba192", "e18485e185a8e186b9"],
+ ["eba192", "eba180e186b9"],
+ ["eba193", "e18485e185a8e186ba"],
+ ["eba193", "eba180e186ba"],
+ ["eba194", "e18485e185a8e186bb"],
+ ["eba194", "eba180e186bb"],
+ ["eba195", "e18485e185a8e186bc"],
+ ["eba195", "eba180e186bc"],
+ ["eba196", "e18485e185a8e186bd"],
+ ["eba196", "eba180e186bd"],
+ ["eba197", "e18485e185a8e186be"],
+ ["eba197", "eba180e186be"],
+ ["eba198", "e18485e185a8e186bf"],
+ ["eba198", "eba180e186bf"],
+ ["eba199", "e18485e185a8e18780"],
+ ["eba199", "eba180e18780"],
+ ["eba19a", "e18485e185a8e18781"],
+ ["eba19a", "eba180e18781"],
+ ["eba19b", "e18485e185a8e18782"],
+ ["eba19b", "eba180e18782"],
+ ["eba19c", "e18485e185a9"],
+ ["eba19d", "e18485e185a9e186a8"],
+ ["eba19d", "eba19ce186a8"],
+ ["eba19e", "e18485e185a9e186a9"],
+ ["eba19e", "eba19ce186a9"],
+ ["eba19f", "e18485e185a9e186aa"],
+ ["eba19f", "eba19ce186aa"],
+ ["eba1a0", "e18485e185a9e186ab"],
+ ["eba1a0", "eba19ce186ab"],
+ ["eba1a1", "e18485e185a9e186ac"],
+ ["eba1a1", "eba19ce186ac"],
+ ["eba1a2", "e18485e185a9e186ad"],
+ ["eba1a2", "eba19ce186ad"],
+ ["eba1a3", "e18485e185a9e186ae"],
+ ["eba1a3", "eba19ce186ae"],
+ ["eba1a4", "e18485e185a9e186af"],
+ ["eba1a4", "eba19ce186af"],
+ ["eba1a5", "e18485e185a9e186b0"],
+ ["eba1a5", "eba19ce186b0"],
+ ["eba1a6", "e18485e185a9e186b1"],
+ ["eba1a6", "eba19ce186b1"],
+ ["eba1a7", "e18485e185a9e186b2"],
+ ["eba1a7", "eba19ce186b2"],
+ ["eba1a8", "e18485e185a9e186b3"],
+ ["eba1a8", "eba19ce186b3"],
+ ["eba1a9", "e18485e185a9e186b4"],
+ ["eba1a9", "eba19ce186b4"],
+ ["eba1aa", "e18485e185a9e186b5"],
+ ["eba1aa", "eba19ce186b5"],
+ ["eba1ab", "e18485e185a9e186b6"],
+ ["eba1ab", "eba19ce186b6"],
+ ["eba1ac", "e18485e185a9e186b7"],
+ ["eba1ac", "eba19ce186b7"],
+ ["eba1ad", "e18485e185a9e186b8"],
+ ["eba1ad", "eba19ce186b8"],
+ ["eba1ae", "e18485e185a9e186b9"],
+ ["eba1ae", "eba19ce186b9"],
+ ["eba1af", "e18485e185a9e186ba"],
+ ["eba1af", "eba19ce186ba"],
+ ["eba1b0", "e18485e185a9e186bb"],
+ ["eba1b0", "eba19ce186bb"],
+ ["eba1b1", "e18485e185a9e186bc"],
+ ["eba1b1", "eba19ce186bc"],
+ ["eba1b2", "e18485e185a9e186bd"],
+ ["eba1b2", "eba19ce186bd"],
+ ["eba1b3", "e18485e185a9e186be"],
+ ["eba1b3", "eba19ce186be"],
+ ["eba1b4", "e18485e185a9e186bf"],
+ ["eba1b4", "eba19ce186bf"],
+ ["eba1b5", "e18485e185a9e18780"],
+ ["eba1b5", "eba19ce18780"],
+ ["eba1b6", "e18485e185a9e18781"],
+ ["eba1b6", "eba19ce18781"],
+ ["eba1b7", "e18485e185a9e18782"],
+ ["eba1b7", "eba19ce18782"],
+ ["eba1b8", "e18485e185aa"],
+ ["eba1b9", "e18485e185aae186a8"],
+ ["eba1b9", "eba1b8e186a8"],
+ ["eba1ba", "e18485e185aae186a9"],
+ ["eba1ba", "eba1b8e186a9"],
+ ["eba1bb", "e18485e185aae186aa"],
+ ["eba1bb", "eba1b8e186aa"],
+ ["eba1bc", "e18485e185aae186ab"],
+ ["eba1bc", "eba1b8e186ab"],
+ ["eba1bd", "e18485e185aae186ac"],
+ ["eba1bd", "eba1b8e186ac"],
+ ["eba1be", "e18485e185aae186ad"],
+ ["eba1be", "eba1b8e186ad"],
+ ["eba1bf", "e18485e185aae186ae"],
+ ["eba1bf", "eba1b8e186ae"],
+ ["eba280", "e18485e185aae186af"],
+ ["eba280", "eba1b8e186af"],
+ ["eba281", "e18485e185aae186b0"],
+ ["eba281", "eba1b8e186b0"],
+ ["eba282", "e18485e185aae186b1"],
+ ["eba282", "eba1b8e186b1"],
+ ["eba283", "e18485e185aae186b2"],
+ ["eba283", "eba1b8e186b2"],
+ ["eba284", "e18485e185aae186b3"],
+ ["eba284", "eba1b8e186b3"],
+ ["eba285", "e18485e185aae186b4"],
+ ["eba285", "eba1b8e186b4"],
+ ["eba286", "e18485e185aae186b5"],
+ ["eba286", "eba1b8e186b5"],
+ ["eba287", "e18485e185aae186b6"],
+ ["eba287", "eba1b8e186b6"],
+ ["eba288", "e18485e185aae186b7"],
+ ["eba288", "eba1b8e186b7"],
+ ["eba289", "e18485e185aae186b8"],
+ ["eba289", "eba1b8e186b8"],
+ ["eba28a", "e18485e185aae186b9"],
+ ["eba28a", "eba1b8e186b9"],
+ ["eba28b", "e18485e185aae186ba"],
+ ["eba28b", "eba1b8e186ba"],
+ ["eba28c", "e18485e185aae186bb"],
+ ["eba28c", "eba1b8e186bb"],
+ ["eba28d", "e18485e185aae186bc"],
+ ["eba28d", "eba1b8e186bc"],
+ ["eba28e", "e18485e185aae186bd"],
+ ["eba28e", "eba1b8e186bd"],
+ ["eba28f", "e18485e185aae186be"],
+ ["eba28f", "eba1b8e186be"],
+ ["eba290", "e18485e185aae186bf"],
+ ["eba290", "eba1b8e186bf"],
+ ["eba291", "e18485e185aae18780"],
+ ["eba291", "eba1b8e18780"],
+ ["eba292", "e18485e185aae18781"],
+ ["eba292", "eba1b8e18781"],
+ ["eba293", "e18485e185aae18782"],
+ ["eba293", "eba1b8e18782"],
+ ["eba294", "e18485e185ab"],
+ ["eba295", "e18485e185abe186a8"],
+ ["eba295", "eba294e186a8"],
+ ["eba296", "e18485e185abe186a9"],
+ ["eba296", "eba294e186a9"],
+ ["eba297", "e18485e185abe186aa"],
+ ["eba297", "eba294e186aa"],
+ ["eba298", "e18485e185abe186ab"],
+ ["eba298", "eba294e186ab"],
+ ["eba299", "e18485e185abe186ac"],
+ ["eba299", "eba294e186ac"],
+ ["eba29a", "e18485e185abe186ad"],
+ ["eba29a", "eba294e186ad"],
+ ["eba29b", "e18485e185abe186ae"],
+ ["eba29b", "eba294e186ae"],
+ ["eba29c", "e18485e185abe186af"],
+ ["eba29c", "eba294e186af"],
+ ["eba29d", "e18485e185abe186b0"],
+ ["eba29d", "eba294e186b0"],
+ ["eba29e", "e18485e185abe186b1"],
+ ["eba29e", "eba294e186b1"],
+ ["eba29f", "e18485e185abe186b2"],
+ ["eba29f", "eba294e186b2"],
+ ["eba2a0", "e18485e185abe186b3"],
+ ["eba2a0", "eba294e186b3"],
+ ["eba2a1", "e18485e185abe186b4"],
+ ["eba2a1", "eba294e186b4"],
+ ["eba2a2", "e18485e185abe186b5"],
+ ["eba2a2", "eba294e186b5"],
+ ["eba2a3", "e18485e185abe186b6"],
+ ["eba2a3", "eba294e186b6"],
+ ["eba2a4", "e18485e185abe186b7"],
+ ["eba2a4", "eba294e186b7"],
+ ["eba2a5", "e18485e185abe186b8"],
+ ["eba2a5", "eba294e186b8"],
+ ["eba2a6", "e18485e185abe186b9"],
+ ["eba2a6", "eba294e186b9"],
+ ["eba2a7", "e18485e185abe186ba"],
+ ["eba2a7", "eba294e186ba"],
+ ["eba2a8", "e18485e185abe186bb"],
+ ["eba2a8", "eba294e186bb"],
+ ["eba2a9", "e18485e185abe186bc"],
+ ["eba2a9", "eba294e186bc"],
+ ["eba2aa", "e18485e185abe186bd"],
+ ["eba2aa", "eba294e186bd"],
+ ["eba2ab", "e18485e185abe186be"],
+ ["eba2ab", "eba294e186be"],
+ ["eba2ac", "e18485e185abe186bf"],
+ ["eba2ac", "eba294e186bf"],
+ ["eba2ad", "e18485e185abe18780"],
+ ["eba2ad", "eba294e18780"],
+ ["eba2ae", "e18485e185abe18781"],
+ ["eba2ae", "eba294e18781"],
+ ["eba2af", "e18485e185abe18782"],
+ ["eba2af", "eba294e18782"],
+ ["eba2b0", "e18485e185ac"],
+ ["eba2b1", "e18485e185ace186a8"],
+ ["eba2b1", "eba2b0e186a8"],
+ ["eba2b2", "e18485e185ace186a9"],
+ ["eba2b2", "eba2b0e186a9"],
+ ["eba2b3", "e18485e185ace186aa"],
+ ["eba2b3", "eba2b0e186aa"],
+ ["eba2b4", "e18485e185ace186ab"],
+ ["eba2b4", "eba2b0e186ab"],
+ ["eba2b5", "e18485e185ace186ac"],
+ ["eba2b5", "eba2b0e186ac"],
+ ["eba2b6", "e18485e185ace186ad"],
+ ["eba2b6", "eba2b0e186ad"],
+ ["eba2b7", "e18485e185ace186ae"],
+ ["eba2b7", "eba2b0e186ae"],
+ ["eba2b8", "e18485e185ace186af"],
+ ["eba2b8", "eba2b0e186af"],
+ ["eba2b9", "e18485e185ace186b0"],
+ ["eba2b9", "eba2b0e186b0"],
+ ["eba2ba", "e18485e185ace186b1"],
+ ["eba2ba", "eba2b0e186b1"],
+ ["eba2bb", "e18485e185ace186b2"],
+ ["eba2bb", "eba2b0e186b2"],
+ ["eba2bc", "e18485e185ace186b3"],
+ ["eba2bc", "eba2b0e186b3"],
+ ["eba2bd", "e18485e185ace186b4"],
+ ["eba2bd", "eba2b0e186b4"],
+ ["eba2be", "e18485e185ace186b5"],
+ ["eba2be", "eba2b0e186b5"],
+ ["eba2bf", "e18485e185ace186b6"],
+ ["eba2bf", "eba2b0e186b6"],
+ ["eba380", "e18485e185ace186b7"],
+ ["eba380", "eba2b0e186b7"],
+ ["eba381", "e18485e185ace186b8"],
+ ["eba381", "eba2b0e186b8"],
+ ["eba382", "e18485e185ace186b9"],
+ ["eba382", "eba2b0e186b9"],
+ ["eba383", "e18485e185ace186ba"],
+ ["eba383", "eba2b0e186ba"],
+ ["eba384", "e18485e185ace186bb"],
+ ["eba384", "eba2b0e186bb"],
+ ["eba385", "e18485e185ace186bc"],
+ ["eba385", "eba2b0e186bc"],
+ ["eba386", "e18485e185ace186bd"],
+ ["eba386", "eba2b0e186bd"],
+ ["eba387", "e18485e185ace186be"],
+ ["eba387", "eba2b0e186be"],
+ ["eba388", "e18485e185ace186bf"],
+ ["eba388", "eba2b0e186bf"],
+ ["eba389", "e18485e185ace18780"],
+ ["eba389", "eba2b0e18780"],
+ ["eba38a", "e18485e185ace18781"],
+ ["eba38a", "eba2b0e18781"],
+ ["eba38b", "e18485e185ace18782"],
+ ["eba38b", "eba2b0e18782"],
+ ["eba38c", "e18485e185ad"],
+ ["eba38d", "e18485e185ade186a8"],
+ ["eba38d", "eba38ce186a8"],
+ ["eba38e", "e18485e185ade186a9"],
+ ["eba38e", "eba38ce186a9"],
+ ["eba38f", "e18485e185ade186aa"],
+ ["eba38f", "eba38ce186aa"],
+ ["eba390", "e18485e185ade186ab"],
+ ["eba390", "eba38ce186ab"],
+ ["eba391", "e18485e185ade186ac"],
+ ["eba391", "eba38ce186ac"],
+ ["eba392", "e18485e185ade186ad"],
+ ["eba392", "eba38ce186ad"],
+ ["eba393", "e18485e185ade186ae"],
+ ["eba393", "eba38ce186ae"],
+ ["eba394", "e18485e185ade186af"],
+ ["eba394", "eba38ce186af"],
+ ["eba395", "e18485e185ade186b0"],
+ ["eba395", "eba38ce186b0"],
+ ["eba396", "e18485e185ade186b1"],
+ ["eba396", "eba38ce186b1"],
+ ["eba397", "e18485e185ade186b2"],
+ ["eba397", "eba38ce186b2"],
+ ["eba398", "e18485e185ade186b3"],
+ ["eba398", "eba38ce186b3"],
+ ["eba399", "e18485e185ade186b4"],
+ ["eba399", "eba38ce186b4"],
+ ["eba39a", "e18485e185ade186b5"],
+ ["eba39a", "eba38ce186b5"],
+ ["eba39b", "e18485e185ade186b6"],
+ ["eba39b", "eba38ce186b6"],
+ ["eba39c", "e18485e185ade186b7"],
+ ["eba39c", "eba38ce186b7"],
+ ["eba39d", "e18485e185ade186b8"],
+ ["eba39d", "eba38ce186b8"],
+ ["eba39e", "e18485e185ade186b9"],
+ ["eba39e", "eba38ce186b9"],
+ ["eba39f", "e18485e185ade186ba"],
+ ["eba39f", "eba38ce186ba"],
+ ["eba3a0", "e18485e185ade186bb"],
+ ["eba3a0", "eba38ce186bb"],
+ ["eba3a1", "e18485e185ade186bc"],
+ ["eba3a1", "eba38ce186bc"],
+ ["eba3a2", "e18485e185ade186bd"],
+ ["eba3a2", "eba38ce186bd"],
+ ["eba3a3", "e18485e185ade186be"],
+ ["eba3a3", "eba38ce186be"],
+ ["eba3a4", "e18485e185ade186bf"],
+ ["eba3a4", "eba38ce186bf"],
+ ["eba3a5", "e18485e185ade18780"],
+ ["eba3a5", "eba38ce18780"],
+ ["eba3a6", "e18485e185ade18781"],
+ ["eba3a6", "eba38ce18781"],
+ ["eba3a7", "e18485e185ade18782"],
+ ["eba3a7", "eba38ce18782"],
+ ["eba3a8", "e18485e185ae"],
+ ["eba3a9", "e18485e185aee186a8"],
+ ["eba3a9", "eba3a8e186a8"],
+ ["eba3aa", "e18485e185aee186a9"],
+ ["eba3aa", "eba3a8e186a9"],
+ ["eba3ab", "e18485e185aee186aa"],
+ ["eba3ab", "eba3a8e186aa"],
+ ["eba3ac", "e18485e185aee186ab"],
+ ["eba3ac", "eba3a8e186ab"],
+ ["eba3ad", "e18485e185aee186ac"],
+ ["eba3ad", "eba3a8e186ac"],
+ ["eba3ae", "e18485e185aee186ad"],
+ ["eba3ae", "eba3a8e186ad"],
+ ["eba3af", "e18485e185aee186ae"],
+ ["eba3af", "eba3a8e186ae"],
+ ["eba3b0", "e18485e185aee186af"],
+ ["eba3b0", "eba3a8e186af"],
+ ["eba3b1", "e18485e185aee186b0"],
+ ["eba3b1", "eba3a8e186b0"],
+ ["eba3b2", "e18485e185aee186b1"],
+ ["eba3b2", "eba3a8e186b1"],
+ ["eba3b3", "e18485e185aee186b2"],
+ ["eba3b3", "eba3a8e186b2"],
+ ["eba3b4", "e18485e185aee186b3"],
+ ["eba3b4", "eba3a8e186b3"],
+ ["eba3b5", "e18485e185aee186b4"],
+ ["eba3b5", "eba3a8e186b4"],
+ ["eba3b6", "e18485e185aee186b5"],
+ ["eba3b6", "eba3a8e186b5"],
+ ["eba3b7", "e18485e185aee186b6"],
+ ["eba3b7", "eba3a8e186b6"],
+ ["eba3b8", "e18485e185aee186b7"],
+ ["eba3b8", "eba3a8e186b7"],
+ ["eba3b9", "e18485e185aee186b8"],
+ ["eba3b9", "eba3a8e186b8"],
+ ["eba3ba", "e18485e185aee186b9"],
+ ["eba3ba", "eba3a8e186b9"],
+ ["eba3bb", "e18485e185aee186ba"],
+ ["eba3bb", "eba3a8e186ba"],
+ ["eba3bc", "e18485e185aee186bb"],
+ ["eba3bc", "eba3a8e186bb"],
+ ["eba3bd", "e18485e185aee186bc"],
+ ["eba3bd", "eba3a8e186bc"],
+ ["eba3be", "e18485e185aee186bd"],
+ ["eba3be", "eba3a8e186bd"],
+ ["eba3bf", "e18485e185aee186be"],
+ ["eba3bf", "eba3a8e186be"],
+ ["eba480", "e18485e185aee186bf"],
+ ["eba480", "eba3a8e186bf"],
+ ["eba481", "e18485e185aee18780"],
+ ["eba481", "eba3a8e18780"],
+ ["eba482", "e18485e185aee18781"],
+ ["eba482", "eba3a8e18781"],
+ ["eba483", "e18485e185aee18782"],
+ ["eba483", "eba3a8e18782"],
+ ["eba484", "e18485e185af"],
+ ["eba485", "e18485e185afe186a8"],
+ ["eba485", "eba484e186a8"],
+ ["eba486", "e18485e185afe186a9"],
+ ["eba486", "eba484e186a9"],
+ ["eba487", "e18485e185afe186aa"],
+ ["eba487", "eba484e186aa"],
+ ["eba488", "e18485e185afe186ab"],
+ ["eba488", "eba484e186ab"],
+ ["eba489", "e18485e185afe186ac"],
+ ["eba489", "eba484e186ac"],
+ ["eba48a", "e18485e185afe186ad"],
+ ["eba48a", "eba484e186ad"],
+ ["eba48b", "e18485e185afe186ae"],
+ ["eba48b", "eba484e186ae"],
+ ["eba48c", "e18485e185afe186af"],
+ ["eba48c", "eba484e186af"],
+ ["eba48d", "e18485e185afe186b0"],
+ ["eba48d", "eba484e186b0"],
+ ["eba48e", "e18485e185afe186b1"],
+ ["eba48e", "eba484e186b1"],
+ ["eba48f", "e18485e185afe186b2"],
+ ["eba48f", "eba484e186b2"],
+ ["eba490", "e18485e185afe186b3"],
+ ["eba490", "eba484e186b3"],
+ ["eba491", "e18485e185afe186b4"],
+ ["eba491", "eba484e186b4"],
+ ["eba492", "e18485e185afe186b5"],
+ ["eba492", "eba484e186b5"],
+ ["eba493", "e18485e185afe186b6"],
+ ["eba493", "eba484e186b6"],
+ ["eba494", "e18485e185afe186b7"],
+ ["eba494", "eba484e186b7"],
+ ["eba495", "e18485e185afe186b8"],
+ ["eba495", "eba484e186b8"],
+ ["eba496", "e18485e185afe186b9"],
+ ["eba496", "eba484e186b9"],
+ ["eba497", "e18485e185afe186ba"],
+ ["eba497", "eba484e186ba"],
+ ["eba498", "e18485e185afe186bb"],
+ ["eba498", "eba484e186bb"],
+ ["eba499", "e18485e185afe186bc"],
+ ["eba499", "eba484e186bc"],
+ ["eba49a", "e18485e185afe186bd"],
+ ["eba49a", "eba484e186bd"],
+ ["eba49b", "e18485e185afe186be"],
+ ["eba49b", "eba484e186be"],
+ ["eba49c", "e18485e185afe186bf"],
+ ["eba49c", "eba484e186bf"],
+ ["eba49d", "e18485e185afe18780"],
+ ["eba49d", "eba484e18780"],
+ ["eba49e", "e18485e185afe18781"],
+ ["eba49e", "eba484e18781"],
+ ["eba49f", "e18485e185afe18782"],
+ ["eba49f", "eba484e18782"],
+ ["eba4a0", "e18485e185b0"],
+ ["eba4a1", "e18485e185b0e186a8"],
+ ["eba4a1", "eba4a0e186a8"],
+ ["eba4a2", "e18485e185b0e186a9"],
+ ["eba4a2", "eba4a0e186a9"],
+ ["eba4a3", "e18485e185b0e186aa"],
+ ["eba4a3", "eba4a0e186aa"],
+ ["eba4a4", "e18485e185b0e186ab"],
+ ["eba4a4", "eba4a0e186ab"],
+ ["eba4a5", "e18485e185b0e186ac"],
+ ["eba4a5", "eba4a0e186ac"],
+ ["eba4a6", "e18485e185b0e186ad"],
+ ["eba4a6", "eba4a0e186ad"],
+ ["eba4a7", "e18485e185b0e186ae"],
+ ["eba4a7", "eba4a0e186ae"],
+ ["eba4a8", "e18485e185b0e186af"],
+ ["eba4a8", "eba4a0e186af"],
+ ["eba4a9", "e18485e185b0e186b0"],
+ ["eba4a9", "eba4a0e186b0"],
+ ["eba4aa", "e18485e185b0e186b1"],
+ ["eba4aa", "eba4a0e186b1"],
+ ["eba4ab", "e18485e185b0e186b2"],
+ ["eba4ab", "eba4a0e186b2"],
+ ["eba4ac", "e18485e185b0e186b3"],
+ ["eba4ac", "eba4a0e186b3"],
+ ["eba4ad", "e18485e185b0e186b4"],
+ ["eba4ad", "eba4a0e186b4"],
+ ["eba4ae", "e18485e185b0e186b5"],
+ ["eba4ae", "eba4a0e186b5"],
+ ["eba4af", "e18485e185b0e186b6"],
+ ["eba4af", "eba4a0e186b6"],
+ ["eba4b0", "e18485e185b0e186b7"],
+ ["eba4b0", "eba4a0e186b7"],
+ ["eba4b1", "e18485e185b0e186b8"],
+ ["eba4b1", "eba4a0e186b8"],
+ ["eba4b2", "e18485e185b0e186b9"],
+ ["eba4b2", "eba4a0e186b9"],
+ ["eba4b3", "e18485e185b0e186ba"],
+ ["eba4b3", "eba4a0e186ba"],
+ ["eba4b4", "e18485e185b0e186bb"],
+ ["eba4b4", "eba4a0e186bb"],
+ ["eba4b5", "e18485e185b0e186bc"],
+ ["eba4b5", "eba4a0e186bc"],
+ ["eba4b6", "e18485e185b0e186bd"],
+ ["eba4b6", "eba4a0e186bd"],
+ ["eba4b7", "e18485e185b0e186be"],
+ ["eba4b7", "eba4a0e186be"],
+ ["eba4b8", "e18485e185b0e186bf"],
+ ["eba4b8", "eba4a0e186bf"],
+ ["eba4b9", "e18485e185b0e18780"],
+ ["eba4b9", "eba4a0e18780"],
+ ["eba4ba", "e18485e185b0e18781"],
+ ["eba4ba", "eba4a0e18781"],
+ ["eba4bb", "e18485e185b0e18782"],
+ ["eba4bb", "eba4a0e18782"],
+ ["eba4bc", "e18485e185b1"],
+ ["eba4bd", "e18485e185b1e186a8"],
+ ["eba4bd", "eba4bce186a8"],
+ ["eba4be", "e18485e185b1e186a9"],
+ ["eba4be", "eba4bce186a9"],
+ ["eba4bf", "e18485e185b1e186aa"],
+ ["eba4bf", "eba4bce186aa"],
+ ["eba580", "e18485e185b1e186ab"],
+ ["eba580", "eba4bce186ab"],
+ ["eba581", "e18485e185b1e186ac"],
+ ["eba581", "eba4bce186ac"],
+ ["eba582", "e18485e185b1e186ad"],
+ ["eba582", "eba4bce186ad"],
+ ["eba583", "e18485e185b1e186ae"],
+ ["eba583", "eba4bce186ae"],
+ ["eba584", "e18485e185b1e186af"],
+ ["eba584", "eba4bce186af"],
+ ["eba585", "e18485e185b1e186b0"],
+ ["eba585", "eba4bce186b0"],
+ ["eba586", "e18485e185b1e186b1"],
+ ["eba586", "eba4bce186b1"],
+ ["eba587", "e18485e185b1e186b2"],
+ ["eba587", "eba4bce186b2"],
+ ["eba588", "e18485e185b1e186b3"],
+ ["eba588", "eba4bce186b3"],
+ ["eba589", "e18485e185b1e186b4"],
+ ["eba589", "eba4bce186b4"],
+ ["eba58a", "e18485e185b1e186b5"],
+ ["eba58a", "eba4bce186b5"],
+ ["eba58b", "e18485e185b1e186b6"],
+ ["eba58b", "eba4bce186b6"],
+ ["eba58c", "e18485e185b1e186b7"],
+ ["eba58c", "eba4bce186b7"],
+ ["eba58d", "e18485e185b1e186b8"],
+ ["eba58d", "eba4bce186b8"],
+ ["eba58e", "e18485e185b1e186b9"],
+ ["eba58e", "eba4bce186b9"],
+ ["eba58f", "e18485e185b1e186ba"],
+ ["eba58f", "eba4bce186ba"],
+ ["eba590", "e18485e185b1e186bb"],
+ ["eba590", "eba4bce186bb"],
+ ["eba591", "e18485e185b1e186bc"],
+ ["eba591", "eba4bce186bc"],
+ ["eba592", "e18485e185b1e186bd"],
+ ["eba592", "eba4bce186bd"],
+ ["eba593", "e18485e185b1e186be"],
+ ["eba593", "eba4bce186be"],
+ ["eba594", "e18485e185b1e186bf"],
+ ["eba594", "eba4bce186bf"],
+ ["eba595", "e18485e185b1e18780"],
+ ["eba595", "eba4bce18780"],
+ ["eba596", "e18485e185b1e18781"],
+ ["eba596", "eba4bce18781"],
+ ["eba597", "e18485e185b1e18782"],
+ ["eba597", "eba4bce18782"],
+ ["eba598", "e18485e185b2"],
+ ["eba599", "e18485e185b2e186a8"],
+ ["eba599", "eba598e186a8"],
+ ["eba59a", "e18485e185b2e186a9"],
+ ["eba59a", "eba598e186a9"],
+ ["eba59b", "e18485e185b2e186aa"],
+ ["eba59b", "eba598e186aa"],
+ ["eba59c", "e18485e185b2e186ab"],
+ ["eba59c", "eba598e186ab"],
+ ["eba59d", "e18485e185b2e186ac"],
+ ["eba59d", "eba598e186ac"],
+ ["eba59e", "e18485e185b2e186ad"],
+ ["eba59e", "eba598e186ad"],
+ ["eba59f", "e18485e185b2e186ae"],
+ ["eba59f", "eba598e186ae"],
+ ["eba5a0", "e18485e185b2e186af"],
+ ["eba5a0", "eba598e186af"],
+ ["eba5a1", "e18485e185b2e186b0"],
+ ["eba5a1", "eba598e186b0"],
+ ["eba5a2", "e18485e185b2e186b1"],
+ ["eba5a2", "eba598e186b1"],
+ ["eba5a3", "e18485e185b2e186b2"],
+ ["eba5a3", "eba598e186b2"],
+ ["eba5a4", "e18485e185b2e186b3"],
+ ["eba5a4", "eba598e186b3"],
+ ["eba5a5", "e18485e185b2e186b4"],
+ ["eba5a5", "eba598e186b4"],
+ ["eba5a6", "e18485e185b2e186b5"],
+ ["eba5a6", "eba598e186b5"],
+ ["eba5a7", "e18485e185b2e186b6"],
+ ["eba5a7", "eba598e186b6"],
+ ["eba5a8", "e18485e185b2e186b7"],
+ ["eba5a8", "eba598e186b7"],
+ ["eba5a9", "e18485e185b2e186b8"],
+ ["eba5a9", "eba598e186b8"],
+ ["eba5aa", "e18485e185b2e186b9"],
+ ["eba5aa", "eba598e186b9"],
+ ["eba5ab", "e18485e185b2e186ba"],
+ ["eba5ab", "eba598e186ba"],
+ ["eba5ac", "e18485e185b2e186bb"],
+ ["eba5ac", "eba598e186bb"],
+ ["eba5ad", "e18485e185b2e186bc"],
+ ["eba5ad", "eba598e186bc"],
+ ["eba5ae", "e18485e185b2e186bd"],
+ ["eba5ae", "eba598e186bd"],
+ ["eba5af", "e18485e185b2e186be"],
+ ["eba5af", "eba598e186be"],
+ ["eba5b0", "e18485e185b2e186bf"],
+ ["eba5b0", "eba598e186bf"],
+ ["eba5b1", "e18485e185b2e18780"],
+ ["eba5b1", "eba598e18780"],
+ ["eba5b2", "e18485e185b2e18781"],
+ ["eba5b2", "eba598e18781"],
+ ["eba5b3", "e18485e185b2e18782"],
+ ["eba5b3", "eba598e18782"],
+ ["eba5b4", "e18485e185b3"],
+ ["eba5b5", "e18485e185b3e186a8"],
+ ["eba5b5", "eba5b4e186a8"],
+ ["eba5b6", "e18485e185b3e186a9"],
+ ["eba5b6", "eba5b4e186a9"],
+ ["eba5b7", "e18485e185b3e186aa"],
+ ["eba5b7", "eba5b4e186aa"],
+ ["eba5b8", "e18485e185b3e186ab"],
+ ["eba5b8", "eba5b4e186ab"],
+ ["eba5b9", "e18485e185b3e186ac"],
+ ["eba5b9", "eba5b4e186ac"],
+ ["eba5ba", "e18485e185b3e186ad"],
+ ["eba5ba", "eba5b4e186ad"],
+ ["eba5bb", "e18485e185b3e186ae"],
+ ["eba5bb", "eba5b4e186ae"],
+ ["eba5bc", "e18485e185b3e186af"],
+ ["eba5bc", "eba5b4e186af"],
+ ["eba5bd", "e18485e185b3e186b0"],
+ ["eba5bd", "eba5b4e186b0"],
+ ["eba5be", "e18485e185b3e186b1"],
+ ["eba5be", "eba5b4e186b1"],
+ ["eba5bf", "e18485e185b3e186b2"],
+ ["eba5bf", "eba5b4e186b2"],
+ ["eba680", "e18485e185b3e186b3"],
+ ["eba680", "eba5b4e186b3"],
+ ["eba681", "e18485e185b3e186b4"],
+ ["eba681", "eba5b4e186b4"],
+ ["eba682", "e18485e185b3e186b5"],
+ ["eba682", "eba5b4e186b5"],
+ ["eba683", "e18485e185b3e186b6"],
+ ["eba683", "eba5b4e186b6"],
+ ["eba684", "e18485e185b3e186b7"],
+ ["eba684", "eba5b4e186b7"],
+ ["eba685", "e18485e185b3e186b8"],
+ ["eba685", "eba5b4e186b8"],
+ ["eba686", "e18485e185b3e186b9"],
+ ["eba686", "eba5b4e186b9"],
+ ["eba687", "e18485e185b3e186ba"],
+ ["eba687", "eba5b4e186ba"],
+ ["eba688", "e18485e185b3e186bb"],
+ ["eba688", "eba5b4e186bb"],
+ ["eba689", "e18485e185b3e186bc"],
+ ["eba689", "eba5b4e186bc"],
+ ["eba68a", "e18485e185b3e186bd"],
+ ["eba68a", "eba5b4e186bd"],
+ ["eba68b", "e18485e185b3e186be"],
+ ["eba68b", "eba5b4e186be"],
+ ["eba68c", "e18485e185b3e186bf"],
+ ["eba68c", "eba5b4e186bf"],
+ ["eba68d", "e18485e185b3e18780"],
+ ["eba68d", "eba5b4e18780"],
+ ["eba68e", "e18485e185b3e18781"],
+ ["eba68e", "eba5b4e18781"],
+ ["eba68f", "e18485e185b3e18782"],
+ ["eba68f", "eba5b4e18782"],
+ ["eba690", "e18485e185b4"],
+ ["eba691", "e18485e185b4e186a8"],
+ ["eba691", "eba690e186a8"],
+ ["eba692", "e18485e185b4e186a9"],
+ ["eba692", "eba690e186a9"],
+ ["eba693", "e18485e185b4e186aa"],
+ ["eba693", "eba690e186aa"],
+ ["eba694", "e18485e185b4e186ab"],
+ ["eba694", "eba690e186ab"],
+ ["eba695", "e18485e185b4e186ac"],
+ ["eba695", "eba690e186ac"],
+ ["eba696", "e18485e185b4e186ad"],
+ ["eba696", "eba690e186ad"],
+ ["eba697", "e18485e185b4e186ae"],
+ ["eba697", "eba690e186ae"],
+ ["eba698", "e18485e185b4e186af"],
+ ["eba698", "eba690e186af"],
+ ["eba699", "e18485e185b4e186b0"],
+ ["eba699", "eba690e186b0"],
+ ["eba69a", "e18485e185b4e186b1"],
+ ["eba69a", "eba690e186b1"],
+ ["eba69b", "e18485e185b4e186b2"],
+ ["eba69b", "eba690e186b2"],
+ ["eba69c", "e18485e185b4e186b3"],
+ ["eba69c", "eba690e186b3"],
+ ["eba69d", "e18485e185b4e186b4"],
+ ["eba69d", "eba690e186b4"],
+ ["eba69e", "e18485e185b4e186b5"],
+ ["eba69e", "eba690e186b5"],
+ ["eba69f", "e18485e185b4e186b6"],
+ ["eba69f", "eba690e186b6"],
+ ["eba6a0", "e18485e185b4e186b7"],
+ ["eba6a0", "eba690e186b7"],
+ ["eba6a1", "e18485e185b4e186b8"],
+ ["eba6a1", "eba690e186b8"],
+ ["eba6a2", "e18485e185b4e186b9"],
+ ["eba6a2", "eba690e186b9"],
+ ["eba6a3", "e18485e185b4e186ba"],
+ ["eba6a3", "eba690e186ba"],
+ ["eba6a4", "e18485e185b4e186bb"],
+ ["eba6a4", "eba690e186bb"],
+ ["eba6a5", "e18485e185b4e186bc"],
+ ["eba6a5", "eba690e186bc"],
+ ["eba6a6", "e18485e185b4e186bd"],
+ ["eba6a6", "eba690e186bd"],
+ ["eba6a7", "e18485e185b4e186be"],
+ ["eba6a7", "eba690e186be"],
+ ["eba6a8", "e18485e185b4e186bf"],
+ ["eba6a8", "eba690e186bf"],
+ ["eba6a9", "e18485e185b4e18780"],
+ ["eba6a9", "eba690e18780"],
+ ["eba6aa", "e18485e185b4e18781"],
+ ["eba6aa", "eba690e18781"],
+ ["eba6ab", "e18485e185b4e18782"],
+ ["eba6ab", "eba690e18782"],
+ ["eba6ac", "e18485e185b5"],
+ ["eba6ad", "e18485e185b5e186a8"],
+ ["eba6ad", "eba6ace186a8"],
+ ["eba6ae", "e18485e185b5e186a9"],
+ ["eba6ae", "eba6ace186a9"],
+ ["eba6af", "e18485e185b5e186aa"],
+ ["eba6af", "eba6ace186aa"],
+ ["eba6b0", "e18485e185b5e186ab"],
+ ["eba6b0", "eba6ace186ab"],
+ ["eba6b1", "e18485e185b5e186ac"],
+ ["eba6b1", "eba6ace186ac"],
+ ["eba6b2", "e18485e185b5e186ad"],
+ ["eba6b2", "eba6ace186ad"],
+ ["eba6b3", "e18485e185b5e186ae"],
+ ["eba6b3", "eba6ace186ae"],
+ ["eba6b4", "e18485e185b5e186af"],
+ ["eba6b4", "eba6ace186af"],
+ ["eba6b5", "e18485e185b5e186b0"],
+ ["eba6b5", "eba6ace186b0"],
+ ["eba6b6", "e18485e185b5e186b1"],
+ ["eba6b6", "eba6ace186b1"],
+ ["eba6b7", "e18485e185b5e186b2"],
+ ["eba6b7", "eba6ace186b2"],
+ ["eba6b8", "e18485e185b5e186b3"],
+ ["eba6b8", "eba6ace186b3"],
+ ["eba6b9", "e18485e185b5e186b4"],
+ ["eba6b9", "eba6ace186b4"],
+ ["eba6ba", "e18485e185b5e186b5"],
+ ["eba6ba", "eba6ace186b5"],
+ ["eba6bb", "e18485e185b5e186b6"],
+ ["eba6bb", "eba6ace186b6"],
+ ["eba6bc", "e18485e185b5e186b7"],
+ ["eba6bc", "eba6ace186b7"],
+ ["eba6bd", "e18485e185b5e186b8"],
+ ["eba6bd", "eba6ace186b8"],
+ ["eba6be", "e18485e185b5e186b9"],
+ ["eba6be", "eba6ace186b9"],
+ ["eba6bf", "e18485e185b5e186ba"],
+ ["eba6bf", "eba6ace186ba"],
+ ["eba780", "e18485e185b5e186bb"],
+ ["eba780", "eba6ace186bb"],
+ ["eba781", "e18485e185b5e186bc"],
+ ["eba781", "eba6ace186bc"],
+ ["eba782", "e18485e185b5e186bd"],
+ ["eba782", "eba6ace186bd"],
+ ["eba783", "e18485e185b5e186be"],
+ ["eba783", "eba6ace186be"],
+ ["eba784", "e18485e185b5e186bf"],
+ ["eba784", "eba6ace186bf"],
+ ["eba785", "e18485e185b5e18780"],
+ ["eba785", "eba6ace18780"],
+ ["eba786", "e18485e185b5e18781"],
+ ["eba786", "eba6ace18781"],
+ ["eba787", "e18485e185b5e18782"],
+ ["eba787", "eba6ace18782"],
+ ["eba788", "e18486e185a1"],
+ ["eba789", "e18486e185a1e186a8"],
+ ["eba789", "eba788e186a8"],
+ ["eba78a", "e18486e185a1e186a9"],
+ ["eba78a", "eba788e186a9"],
+ ["eba78b", "e18486e185a1e186aa"],
+ ["eba78b", "eba788e186aa"],
+ ["eba78c", "e18486e185a1e186ab"],
+ ["eba78c", "eba788e186ab"],
+ ["eba78d", "e18486e185a1e186ac"],
+ ["eba78d", "eba788e186ac"],
+ ["eba78e", "e18486e185a1e186ad"],
+ ["eba78e", "eba788e186ad"],
+ ["eba78f", "e18486e185a1e186ae"],
+ ["eba78f", "eba788e186ae"],
+ ["eba790", "e18486e185a1e186af"],
+ ["eba790", "eba788e186af"],
+ ["eba791", "e18486e185a1e186b0"],
+ ["eba791", "eba788e186b0"],
+ ["eba792", "e18486e185a1e186b1"],
+ ["eba792", "eba788e186b1"],
+ ["eba793", "e18486e185a1e186b2"],
+ ["eba793", "eba788e186b2"],
+ ["eba794", "e18486e185a1e186b3"],
+ ["eba794", "eba788e186b3"],
+ ["eba795", "e18486e185a1e186b4"],
+ ["eba795", "eba788e186b4"],
+ ["eba796", "e18486e185a1e186b5"],
+ ["eba796", "eba788e186b5"],
+ ["eba797", "e18486e185a1e186b6"],
+ ["eba797", "eba788e186b6"],
+ ["eba798", "e18486e185a1e186b7"],
+ ["eba798", "eba788e186b7"],
+ ["eba799", "e18486e185a1e186b8"],
+ ["eba799", "eba788e186b8"],
+ ["eba79a", "e18486e185a1e186b9"],
+ ["eba79a", "eba788e186b9"],
+ ["eba79b", "e18486e185a1e186ba"],
+ ["eba79b", "eba788e186ba"],
+ ["eba79c", "e18486e185a1e186bb"],
+ ["eba79c", "eba788e186bb"],
+ ["eba79d", "e18486e185a1e186bc"],
+ ["eba79d", "eba788e186bc"],
+ ["eba79e", "e18486e185a1e186bd"],
+ ["eba79e", "eba788e186bd"],
+ ["eba79f", "e18486e185a1e186be"],
+ ["eba79f", "eba788e186be"],
+ ["eba7a0", "e18486e185a1e186bf"],
+ ["eba7a0", "eba788e186bf"],
+ ["eba7a1", "e18486e185a1e18780"],
+ ["eba7a1", "eba788e18780"],
+ ["eba7a2", "e18486e185a1e18781"],
+ ["eba7a2", "eba788e18781"],
+ ["eba7a3", "e18486e185a1e18782"],
+ ["eba7a3", "eba788e18782"],
+ ["eba7a4", "e18486e185a2"],
+ ["eba7a5", "e18486e185a2e186a8"],
+ ["eba7a5", "eba7a4e186a8"],
+ ["eba7a6", "e18486e185a2e186a9"],
+ ["eba7a6", "eba7a4e186a9"],
+ ["eba7a7", "e18486e185a2e186aa"],
+ ["eba7a7", "eba7a4e186aa"],
+ ["eba7a8", "e18486e185a2e186ab"],
+ ["eba7a8", "eba7a4e186ab"],
+ ["eba7a9", "e18486e185a2e186ac"],
+ ["eba7a9", "eba7a4e186ac"],
+ ["eba7aa", "e18486e185a2e186ad"],
+ ["eba7aa", "eba7a4e186ad"],
+ ["eba7ab", "e18486e185a2e186ae"],
+ ["eba7ab", "eba7a4e186ae"],
+ ["eba7ac", "e18486e185a2e186af"],
+ ["eba7ac", "eba7a4e186af"],
+ ["eba7ad", "e18486e185a2e186b0"],
+ ["eba7ad", "eba7a4e186b0"],
+ ["eba7ae", "e18486e185a2e186b1"],
+ ["eba7ae", "eba7a4e186b1"],
+ ["eba7af", "e18486e185a2e186b2"],
+ ["eba7af", "eba7a4e186b2"],
+ ["eba7b0", "e18486e185a2e186b3"],
+ ["eba7b0", "eba7a4e186b3"],
+ ["eba7b1", "e18486e185a2e186b4"],
+ ["eba7b1", "eba7a4e186b4"],
+ ["eba7b2", "e18486e185a2e186b5"],
+ ["eba7b2", "eba7a4e186b5"],
+ ["eba7b3", "e18486e185a2e186b6"],
+ ["eba7b3", "eba7a4e186b6"],
+ ["eba7b4", "e18486e185a2e186b7"],
+ ["eba7b4", "eba7a4e186b7"],
+ ["eba7b5", "e18486e185a2e186b8"],
+ ["eba7b5", "eba7a4e186b8"],
+ ["eba7b6", "e18486e185a2e186b9"],
+ ["eba7b6", "eba7a4e186b9"],
+ ["eba7b7", "e18486e185a2e186ba"],
+ ["eba7b7", "eba7a4e186ba"],
+ ["eba7b8", "e18486e185a2e186bb"],
+ ["eba7b8", "eba7a4e186bb"],
+ ["eba7b9", "e18486e185a2e186bc"],
+ ["eba7b9", "eba7a4e186bc"],
+ ["eba7ba", "e18486e185a2e186bd"],
+ ["eba7ba", "eba7a4e186bd"],
+ ["eba7bb", "e18486e185a2e186be"],
+ ["eba7bb", "eba7a4e186be"],
+ ["eba7bc", "e18486e185a2e186bf"],
+ ["eba7bc", "eba7a4e186bf"],
+ ["eba7bd", "e18486e185a2e18780"],
+ ["eba7bd", "eba7a4e18780"],
+ ["eba7be", "e18486e185a2e18781"],
+ ["eba7be", "eba7a4e18781"],
+ ["eba7bf", "e18486e185a2e18782"],
+ ["eba7bf", "eba7a4e18782"],
+ ["eba880", "e18486e185a3"],
+ ["eba881", "e18486e185a3e186a8"],
+ ["eba881", "eba880e186a8"],
+ ["eba882", "e18486e185a3e186a9"],
+ ["eba882", "eba880e186a9"],
+ ["eba883", "e18486e185a3e186aa"],
+ ["eba883", "eba880e186aa"],
+ ["eba884", "e18486e185a3e186ab"],
+ ["eba884", "eba880e186ab"],
+ ["eba885", "e18486e185a3e186ac"],
+ ["eba885", "eba880e186ac"],
+ ["eba886", "e18486e185a3e186ad"],
+ ["eba886", "eba880e186ad"],
+ ["eba887", "e18486e185a3e186ae"],
+ ["eba887", "eba880e186ae"],
+ ["eba888", "e18486e185a3e186af"],
+ ["eba888", "eba880e186af"],
+ ["eba889", "e18486e185a3e186b0"],
+ ["eba889", "eba880e186b0"],
+ ["eba88a", "e18486e185a3e186b1"],
+ ["eba88a", "eba880e186b1"],
+ ["eba88b", "e18486e185a3e186b2"],
+ ["eba88b", "eba880e186b2"],
+ ["eba88c", "e18486e185a3e186b3"],
+ ["eba88c", "eba880e186b3"],
+ ["eba88d", "e18486e185a3e186b4"],
+ ["eba88d", "eba880e186b4"],
+ ["eba88e", "e18486e185a3e186b5"],
+ ["eba88e", "eba880e186b5"],
+ ["eba88f", "e18486e185a3e186b6"],
+ ["eba88f", "eba880e186b6"],
+ ["eba890", "e18486e185a3e186b7"],
+ ["eba890", "eba880e186b7"],
+ ["eba891", "e18486e185a3e186b8"],
+ ["eba891", "eba880e186b8"],
+ ["eba892", "e18486e185a3e186b9"],
+ ["eba892", "eba880e186b9"],
+ ["eba893", "e18486e185a3e186ba"],
+ ["eba893", "eba880e186ba"],
+ ["eba894", "e18486e185a3e186bb"],
+ ["eba894", "eba880e186bb"],
+ ["eba895", "e18486e185a3e186bc"],
+ ["eba895", "eba880e186bc"],
+ ["eba896", "e18486e185a3e186bd"],
+ ["eba896", "eba880e186bd"],
+ ["eba897", "e18486e185a3e186be"],
+ ["eba897", "eba880e186be"],
+ ["eba898", "e18486e185a3e186bf"],
+ ["eba898", "eba880e186bf"],
+ ["eba899", "e18486e185a3e18780"],
+ ["eba899", "eba880e18780"],
+ ["eba89a", "e18486e185a3e18781"],
+ ["eba89a", "eba880e18781"],
+ ["eba89b", "e18486e185a3e18782"],
+ ["eba89b", "eba880e18782"],
+ ["eba89c", "e18486e185a4"],
+ ["eba89d", "e18486e185a4e186a8"],
+ ["eba89d", "eba89ce186a8"],
+ ["eba89e", "e18486e185a4e186a9"],
+ ["eba89e", "eba89ce186a9"],
+ ["eba89f", "e18486e185a4e186aa"],
+ ["eba89f", "eba89ce186aa"],
+ ["eba8a0", "e18486e185a4e186ab"],
+ ["eba8a0", "eba89ce186ab"],
+ ["eba8a1", "e18486e185a4e186ac"],
+ ["eba8a1", "eba89ce186ac"],
+ ["eba8a2", "e18486e185a4e186ad"],
+ ["eba8a2", "eba89ce186ad"],
+ ["eba8a3", "e18486e185a4e186ae"],
+ ["eba8a3", "eba89ce186ae"],
+ ["eba8a4", "e18486e185a4e186af"],
+ ["eba8a4", "eba89ce186af"],
+ ["eba8a5", "e18486e185a4e186b0"],
+ ["eba8a5", "eba89ce186b0"],
+ ["eba8a6", "e18486e185a4e186b1"],
+ ["eba8a6", "eba89ce186b1"],
+ ["eba8a7", "e18486e185a4e186b2"],
+ ["eba8a7", "eba89ce186b2"],
+ ["eba8a8", "e18486e185a4e186b3"],
+ ["eba8a8", "eba89ce186b3"],
+ ["eba8a9", "e18486e185a4e186b4"],
+ ["eba8a9", "eba89ce186b4"],
+ ["eba8aa", "e18486e185a4e186b5"],
+ ["eba8aa", "eba89ce186b5"],
+ ["eba8ab", "e18486e185a4e186b6"],
+ ["eba8ab", "eba89ce186b6"],
+ ["eba8ac", "e18486e185a4e186b7"],
+ ["eba8ac", "eba89ce186b7"],
+ ["eba8ad", "e18486e185a4e186b8"],
+ ["eba8ad", "eba89ce186b8"],
+ ["eba8ae", "e18486e185a4e186b9"],
+ ["eba8ae", "eba89ce186b9"],
+ ["eba8af", "e18486e185a4e186ba"],
+ ["eba8af", "eba89ce186ba"],
+ ["eba8b0", "e18486e185a4e186bb"],
+ ["eba8b0", "eba89ce186bb"],
+ ["eba8b1", "e18486e185a4e186bc"],
+ ["eba8b1", "eba89ce186bc"],
+ ["eba8b2", "e18486e185a4e186bd"],
+ ["eba8b2", "eba89ce186bd"],
+ ["eba8b3", "e18486e185a4e186be"],
+ ["eba8b3", "eba89ce186be"],
+ ["eba8b4", "e18486e185a4e186bf"],
+ ["eba8b4", "eba89ce186bf"],
+ ["eba8b5", "e18486e185a4e18780"],
+ ["eba8b5", "eba89ce18780"],
+ ["eba8b6", "e18486e185a4e18781"],
+ ["eba8b6", "eba89ce18781"],
+ ["eba8b7", "e18486e185a4e18782"],
+ ["eba8b7", "eba89ce18782"],
+ ["eba8b8", "e18486e185a5"],
+ ["eba8b9", "e18486e185a5e186a8"],
+ ["eba8b9", "eba8b8e186a8"],
+ ["eba8ba", "e18486e185a5e186a9"],
+ ["eba8ba", "eba8b8e186a9"],
+ ["eba8bb", "e18486e185a5e186aa"],
+ ["eba8bb", "eba8b8e186aa"],
+ ["eba8bc", "e18486e185a5e186ab"],
+ ["eba8bc", "eba8b8e186ab"],
+ ["eba8bd", "e18486e185a5e186ac"],
+ ["eba8bd", "eba8b8e186ac"],
+ ["eba8be", "e18486e185a5e186ad"],
+ ["eba8be", "eba8b8e186ad"],
+ ["eba8bf", "e18486e185a5e186ae"],
+ ["eba8bf", "eba8b8e186ae"],
+ ["eba980", "e18486e185a5e186af"],
+ ["eba980", "eba8b8e186af"],
+ ["eba981", "e18486e185a5e186b0"],
+ ["eba981", "eba8b8e186b0"],
+ ["eba982", "e18486e185a5e186b1"],
+ ["eba982", "eba8b8e186b1"],
+ ["eba983", "e18486e185a5e186b2"],
+ ["eba983", "eba8b8e186b2"],
+ ["eba984", "e18486e185a5e186b3"],
+ ["eba984", "eba8b8e186b3"],
+ ["eba985", "e18486e185a5e186b4"],
+ ["eba985", "eba8b8e186b4"],
+ ["eba986", "e18486e185a5e186b5"],
+ ["eba986", "eba8b8e186b5"],
+ ["eba987", "e18486e185a5e186b6"],
+ ["eba987", "eba8b8e186b6"],
+ ["eba988", "e18486e185a5e186b7"],
+ ["eba988", "eba8b8e186b7"],
+ ["eba989", "e18486e185a5e186b8"],
+ ["eba989", "eba8b8e186b8"],
+ ["eba98a", "e18486e185a5e186b9"],
+ ["eba98a", "eba8b8e186b9"],
+ ["eba98b", "e18486e185a5e186ba"],
+ ["eba98b", "eba8b8e186ba"],
+ ["eba98c", "e18486e185a5e186bb"],
+ ["eba98c", "eba8b8e186bb"],
+ ["eba98d", "e18486e185a5e186bc"],
+ ["eba98d", "eba8b8e186bc"],
+ ["eba98e", "e18486e185a5e186bd"],
+ ["eba98e", "eba8b8e186bd"],
+ ["eba98f", "e18486e185a5e186be"],
+ ["eba98f", "eba8b8e186be"],
+ ["eba990", "e18486e185a5e186bf"],
+ ["eba990", "eba8b8e186bf"],
+ ["eba991", "e18486e185a5e18780"],
+ ["eba991", "eba8b8e18780"],
+ ["eba992", "e18486e185a5e18781"],
+ ["eba992", "eba8b8e18781"],
+ ["eba993", "e18486e185a5e18782"],
+ ["eba993", "eba8b8e18782"],
+ ["eba994", "e18486e185a6"],
+ ["eba995", "e18486e185a6e186a8"],
+ ["eba995", "eba994e186a8"],
+ ["eba996", "e18486e185a6e186a9"],
+ ["eba996", "eba994e186a9"],
+ ["eba997", "e18486e185a6e186aa"],
+ ["eba997", "eba994e186aa"],
+ ["eba998", "e18486e185a6e186ab"],
+ ["eba998", "eba994e186ab"],
+ ["eba999", "e18486e185a6e186ac"],
+ ["eba999", "eba994e186ac"],
+ ["eba99a", "e18486e185a6e186ad"],
+ ["eba99a", "eba994e186ad"],
+ ["eba99b", "e18486e185a6e186ae"],
+ ["eba99b", "eba994e186ae"],
+ ["eba99c", "e18486e185a6e186af"],
+ ["eba99c", "eba994e186af"],
+ ["eba99d", "e18486e185a6e186b0"],
+ ["eba99d", "eba994e186b0"],
+ ["eba99e", "e18486e185a6e186b1"],
+ ["eba99e", "eba994e186b1"],
+ ["eba99f", "e18486e185a6e186b2"],
+ ["eba99f", "eba994e186b2"],
+ ["eba9a0", "e18486e185a6e186b3"],
+ ["eba9a0", "eba994e186b3"],
+ ["eba9a1", "e18486e185a6e186b4"],
+ ["eba9a1", "eba994e186b4"],
+ ["eba9a2", "e18486e185a6e186b5"],
+ ["eba9a2", "eba994e186b5"],
+ ["eba9a3", "e18486e185a6e186b6"],
+ ["eba9a3", "eba994e186b6"],
+ ["eba9a4", "e18486e185a6e186b7"],
+ ["eba9a4", "eba994e186b7"],
+ ["eba9a5", "e18486e185a6e186b8"],
+ ["eba9a5", "eba994e186b8"],
+ ["eba9a6", "e18486e185a6e186b9"],
+ ["eba9a6", "eba994e186b9"],
+ ["eba9a7", "e18486e185a6e186ba"],
+ ["eba9a7", "eba994e186ba"],
+ ["eba9a8", "e18486e185a6e186bb"],
+ ["eba9a8", "eba994e186bb"],
+ ["eba9a9", "e18486e185a6e186bc"],
+ ["eba9a9", "eba994e186bc"],
+ ["eba9aa", "e18486e185a6e186bd"],
+ ["eba9aa", "eba994e186bd"],
+ ["eba9ab", "e18486e185a6e186be"],
+ ["eba9ab", "eba994e186be"],
+ ["eba9ac", "e18486e185a6e186bf"],
+ ["eba9ac", "eba994e186bf"],
+ ["eba9ad", "e18486e185a6e18780"],
+ ["eba9ad", "eba994e18780"],
+ ["eba9ae", "e18486e185a6e18781"],
+ ["eba9ae", "eba994e18781"],
+ ["eba9af", "e18486e185a6e18782"],
+ ["eba9af", "eba994e18782"],
+ ["eba9b0", "e18486e185a7"],
+ ["eba9b1", "e18486e185a7e186a8"],
+ ["eba9b1", "eba9b0e186a8"],
+ ["eba9b2", "e18486e185a7e186a9"],
+ ["eba9b2", "eba9b0e186a9"],
+ ["eba9b3", "e18486e185a7e186aa"],
+ ["eba9b3", "eba9b0e186aa"],
+ ["eba9b4", "e18486e185a7e186ab"],
+ ["eba9b4", "eba9b0e186ab"],
+ ["eba9b5", "e18486e185a7e186ac"],
+ ["eba9b5", "eba9b0e186ac"],
+ ["eba9b6", "e18486e185a7e186ad"],
+ ["eba9b6", "eba9b0e186ad"],
+ ["eba9b7", "e18486e185a7e186ae"],
+ ["eba9b7", "eba9b0e186ae"],
+ ["eba9b8", "e18486e185a7e186af"],
+ ["eba9b8", "eba9b0e186af"],
+ ["eba9b9", "e18486e185a7e186b0"],
+ ["eba9b9", "eba9b0e186b0"],
+ ["eba9ba", "e18486e185a7e186b1"],
+ ["eba9ba", "eba9b0e186b1"],
+ ["eba9bb", "e18486e185a7e186b2"],
+ ["eba9bb", "eba9b0e186b2"],
+ ["eba9bc", "e18486e185a7e186b3"],
+ ["eba9bc", "eba9b0e186b3"],
+ ["eba9bd", "e18486e185a7e186b4"],
+ ["eba9bd", "eba9b0e186b4"],
+ ["eba9be", "e18486e185a7e186b5"],
+ ["eba9be", "eba9b0e186b5"],
+ ["eba9bf", "e18486e185a7e186b6"],
+ ["eba9bf", "eba9b0e186b6"],
+ ["ebaa80", "e18486e185a7e186b7"],
+ ["ebaa80", "eba9b0e186b7"],
+ ["ebaa81", "e18486e185a7e186b8"],
+ ["ebaa81", "eba9b0e186b8"],
+ ["ebaa82", "e18486e185a7e186b9"],
+ ["ebaa82", "eba9b0e186b9"],
+ ["ebaa83", "e18486e185a7e186ba"],
+ ["ebaa83", "eba9b0e186ba"],
+ ["ebaa84", "e18486e185a7e186bb"],
+ ["ebaa84", "eba9b0e186bb"],
+ ["ebaa85", "e18486e185a7e186bc"],
+ ["ebaa85", "eba9b0e186bc"],
+ ["ebaa86", "e18486e185a7e186bd"],
+ ["ebaa86", "eba9b0e186bd"],
+ ["ebaa87", "e18486e185a7e186be"],
+ ["ebaa87", "eba9b0e186be"],
+ ["ebaa88", "e18486e185a7e186bf"],
+ ["ebaa88", "eba9b0e186bf"],
+ ["ebaa89", "e18486e185a7e18780"],
+ ["ebaa89", "eba9b0e18780"],
+ ["ebaa8a", "e18486e185a7e18781"],
+ ["ebaa8a", "eba9b0e18781"],
+ ["ebaa8b", "e18486e185a7e18782"],
+ ["ebaa8b", "eba9b0e18782"],
+ ["ebaa8c", "e18486e185a8"],
+ ["ebaa8d", "e18486e185a8e186a8"],
+ ["ebaa8d", "ebaa8ce186a8"],
+ ["ebaa8e", "e18486e185a8e186a9"],
+ ["ebaa8e", "ebaa8ce186a9"],
+ ["ebaa8f", "e18486e185a8e186aa"],
+ ["ebaa8f", "ebaa8ce186aa"],
+ ["ebaa90", "e18486e185a8e186ab"],
+ ["ebaa90", "ebaa8ce186ab"],
+ ["ebaa91", "e18486e185a8e186ac"],
+ ["ebaa91", "ebaa8ce186ac"],
+ ["ebaa92", "e18486e185a8e186ad"],
+ ["ebaa92", "ebaa8ce186ad"],
+ ["ebaa93", "e18486e185a8e186ae"],
+ ["ebaa93", "ebaa8ce186ae"],
+ ["ebaa94", "e18486e185a8e186af"],
+ ["ebaa94", "ebaa8ce186af"],
+ ["ebaa95", "e18486e185a8e186b0"],
+ ["ebaa95", "ebaa8ce186b0"],
+ ["ebaa96", "e18486e185a8e186b1"],
+ ["ebaa96", "ebaa8ce186b1"],
+ ["ebaa97", "e18486e185a8e186b2"],
+ ["ebaa97", "ebaa8ce186b2"],
+ ["ebaa98", "e18486e185a8e186b3"],
+ ["ebaa98", "ebaa8ce186b3"],
+ ["ebaa99", "e18486e185a8e186b4"],
+ ["ebaa99", "ebaa8ce186b4"],
+ ["ebaa9a", "e18486e185a8e186b5"],
+ ["ebaa9a", "ebaa8ce186b5"],
+ ["ebaa9b", "e18486e185a8e186b6"],
+ ["ebaa9b", "ebaa8ce186b6"],
+ ["ebaa9c", "e18486e185a8e186b7"],
+ ["ebaa9c", "ebaa8ce186b7"],
+ ["ebaa9d", "e18486e185a8e186b8"],
+ ["ebaa9d", "ebaa8ce186b8"],
+ ["ebaa9e", "e18486e185a8e186b9"],
+ ["ebaa9e", "ebaa8ce186b9"],
+ ["ebaa9f", "e18486e185a8e186ba"],
+ ["ebaa9f", "ebaa8ce186ba"],
+ ["ebaaa0", "e18486e185a8e186bb"],
+ ["ebaaa0", "ebaa8ce186bb"],
+ ["ebaaa1", "e18486e185a8e186bc"],
+ ["ebaaa1", "ebaa8ce186bc"],
+ ["ebaaa2", "e18486e185a8e186bd"],
+ ["ebaaa2", "ebaa8ce186bd"],
+ ["ebaaa3", "e18486e185a8e186be"],
+ ["ebaaa3", "ebaa8ce186be"],
+ ["ebaaa4", "e18486e185a8e186bf"],
+ ["ebaaa4", "ebaa8ce186bf"],
+ ["ebaaa5", "e18486e185a8e18780"],
+ ["ebaaa5", "ebaa8ce18780"],
+ ["ebaaa6", "e18486e185a8e18781"],
+ ["ebaaa6", "ebaa8ce18781"],
+ ["ebaaa7", "e18486e185a8e18782"],
+ ["ebaaa7", "ebaa8ce18782"],
+ ["ebaaa8", "e18486e185a9"],
+ ["ebaaa9", "e18486e185a9e186a8"],
+ ["ebaaa9", "ebaaa8e186a8"],
+ ["ebaaaa", "e18486e185a9e186a9"],
+ ["ebaaaa", "ebaaa8e186a9"],
+ ["ebaaab", "e18486e185a9e186aa"],
+ ["ebaaab", "ebaaa8e186aa"],
+ ["ebaaac", "e18486e185a9e186ab"],
+ ["ebaaac", "ebaaa8e186ab"],
+ ["ebaaad", "e18486e185a9e186ac"],
+ ["ebaaad", "ebaaa8e186ac"],
+ ["ebaaae", "e18486e185a9e186ad"],
+ ["ebaaae", "ebaaa8e186ad"],
+ ["ebaaaf", "e18486e185a9e186ae"],
+ ["ebaaaf", "ebaaa8e186ae"],
+ ["ebaab0", "e18486e185a9e186af"],
+ ["ebaab0", "ebaaa8e186af"],
+ ["ebaab1", "e18486e185a9e186b0"],
+ ["ebaab1", "ebaaa8e186b0"],
+ ["ebaab2", "e18486e185a9e186b1"],
+ ["ebaab2", "ebaaa8e186b1"],
+ ["ebaab3", "e18486e185a9e186b2"],
+ ["ebaab3", "ebaaa8e186b2"],
+ ["ebaab4", "e18486e185a9e186b3"],
+ ["ebaab4", "ebaaa8e186b3"],
+ ["ebaab5", "e18486e185a9e186b4"],
+ ["ebaab5", "ebaaa8e186b4"],
+ ["ebaab6", "e18486e185a9e186b5"],
+ ["ebaab6", "ebaaa8e186b5"],
+ ["ebaab7", "e18486e185a9e186b6"],
+ ["ebaab7", "ebaaa8e186b6"],
+ ["ebaab8", "e18486e185a9e186b7"],
+ ["ebaab8", "ebaaa8e186b7"],
+ ["ebaab9", "e18486e185a9e186b8"],
+ ["ebaab9", "ebaaa8e186b8"],
+ ["ebaaba", "e18486e185a9e186b9"],
+ ["ebaaba", "ebaaa8e186b9"],
+ ["ebaabb", "e18486e185a9e186ba"],
+ ["ebaabb", "ebaaa8e186ba"],
+ ["ebaabc", "e18486e185a9e186bb"],
+ ["ebaabc", "ebaaa8e186bb"],
+ ["ebaabd", "e18486e185a9e186bc"],
+ ["ebaabd", "ebaaa8e186bc"],
+ ["ebaabe", "e18486e185a9e186bd"],
+ ["ebaabe", "ebaaa8e186bd"],
+ ["ebaabf", "e18486e185a9e186be"],
+ ["ebaabf", "ebaaa8e186be"],
+ ["ebab80", "e18486e185a9e186bf"],
+ ["ebab80", "ebaaa8e186bf"],
+ ["ebab81", "e18486e185a9e18780"],
+ ["ebab81", "ebaaa8e18780"],
+ ["ebab82", "e18486e185a9e18781"],
+ ["ebab82", "ebaaa8e18781"],
+ ["ebab83", "e18486e185a9e18782"],
+ ["ebab83", "ebaaa8e18782"],
+ ["ebab84", "e18486e185aa"],
+ ["ebab85", "e18486e185aae186a8"],
+ ["ebab85", "ebab84e186a8"],
+ ["ebab86", "e18486e185aae186a9"],
+ ["ebab86", "ebab84e186a9"],
+ ["ebab87", "e18486e185aae186aa"],
+ ["ebab87", "ebab84e186aa"],
+ ["ebab88", "e18486e185aae186ab"],
+ ["ebab88", "ebab84e186ab"],
+ ["ebab89", "e18486e185aae186ac"],
+ ["ebab89", "ebab84e186ac"],
+ ["ebab8a", "e18486e185aae186ad"],
+ ["ebab8a", "ebab84e186ad"],
+ ["ebab8b", "e18486e185aae186ae"],
+ ["ebab8b", "ebab84e186ae"],
+ ["ebab8c", "e18486e185aae186af"],
+ ["ebab8c", "ebab84e186af"],
+ ["ebab8d", "e18486e185aae186b0"],
+ ["ebab8d", "ebab84e186b0"],
+ ["ebab8e", "e18486e185aae186b1"],
+ ["ebab8e", "ebab84e186b1"],
+ ["ebab8f", "e18486e185aae186b2"],
+ ["ebab8f", "ebab84e186b2"],
+ ["ebab90", "e18486e185aae186b3"],
+ ["ebab90", "ebab84e186b3"],
+ ["ebab91", "e18486e185aae186b4"],
+ ["ebab91", "ebab84e186b4"],
+ ["ebab92", "e18486e185aae186b5"],
+ ["ebab92", "ebab84e186b5"],
+ ["ebab93", "e18486e185aae186b6"],
+ ["ebab93", "ebab84e186b6"],
+ ["ebab94", "e18486e185aae186b7"],
+ ["ebab94", "ebab84e186b7"],
+ ["ebab95", "e18486e185aae186b8"],
+ ["ebab95", "ebab84e186b8"],
+ ["ebab96", "e18486e185aae186b9"],
+ ["ebab96", "ebab84e186b9"],
+ ["ebab97", "e18486e185aae186ba"],
+ ["ebab97", "ebab84e186ba"],
+ ["ebab98", "e18486e185aae186bb"],
+ ["ebab98", "ebab84e186bb"],
+ ["ebab99", "e18486e185aae186bc"],
+ ["ebab99", "ebab84e186bc"],
+ ["ebab9a", "e18486e185aae186bd"],
+ ["ebab9a", "ebab84e186bd"],
+ ["ebab9b", "e18486e185aae186be"],
+ ["ebab9b", "ebab84e186be"],
+ ["ebab9c", "e18486e185aae186bf"],
+ ["ebab9c", "ebab84e186bf"],
+ ["ebab9d", "e18486e185aae18780"],
+ ["ebab9d", "ebab84e18780"],
+ ["ebab9e", "e18486e185aae18781"],
+ ["ebab9e", "ebab84e18781"],
+ ["ebab9f", "e18486e185aae18782"],
+ ["ebab9f", "ebab84e18782"],
+ ["ebaba0", "e18486e185ab"],
+ ["ebaba1", "e18486e185abe186a8"],
+ ["ebaba1", "ebaba0e186a8"],
+ ["ebaba2", "e18486e185abe186a9"],
+ ["ebaba2", "ebaba0e186a9"],
+ ["ebaba3", "e18486e185abe186aa"],
+ ["ebaba3", "ebaba0e186aa"],
+ ["ebaba4", "e18486e185abe186ab"],
+ ["ebaba4", "ebaba0e186ab"],
+ ["ebaba5", "e18486e185abe186ac"],
+ ["ebaba5", "ebaba0e186ac"],
+ ["ebaba6", "e18486e185abe186ad"],
+ ["ebaba6", "ebaba0e186ad"],
+ ["ebaba7", "e18486e185abe186ae"],
+ ["ebaba7", "ebaba0e186ae"],
+ ["ebaba8", "e18486e185abe186af"],
+ ["ebaba8", "ebaba0e186af"],
+ ["ebaba9", "e18486e185abe186b0"],
+ ["ebaba9", "ebaba0e186b0"],
+ ["ebabaa", "e18486e185abe186b1"],
+ ["ebabaa", "ebaba0e186b1"],
+ ["ebabab", "e18486e185abe186b2"],
+ ["ebabab", "ebaba0e186b2"],
+ ["ebabac", "e18486e185abe186b3"],
+ ["ebabac", "ebaba0e186b3"],
+ ["ebabad", "e18486e185abe186b4"],
+ ["ebabad", "ebaba0e186b4"],
+ ["ebabae", "e18486e185abe186b5"],
+ ["ebabae", "ebaba0e186b5"],
+ ["ebabaf", "e18486e185abe186b6"],
+ ["ebabaf", "ebaba0e186b6"],
+ ["ebabb0", "e18486e185abe186b7"],
+ ["ebabb0", "ebaba0e186b7"],
+ ["ebabb1", "e18486e185abe186b8"],
+ ["ebabb1", "ebaba0e186b8"],
+ ["ebabb2", "e18486e185abe186b9"],
+ ["ebabb2", "ebaba0e186b9"],
+ ["ebabb3", "e18486e185abe186ba"],
+ ["ebabb3", "ebaba0e186ba"],
+ ["ebabb4", "e18486e185abe186bb"],
+ ["ebabb4", "ebaba0e186bb"],
+ ["ebabb5", "e18486e185abe186bc"],
+ ["ebabb5", "ebaba0e186bc"],
+ ["ebabb6", "e18486e185abe186bd"],
+ ["ebabb6", "ebaba0e186bd"],
+ ["ebabb7", "e18486e185abe186be"],
+ ["ebabb7", "ebaba0e186be"],
+ ["ebabb8", "e18486e185abe186bf"],
+ ["ebabb8", "ebaba0e186bf"],
+ ["ebabb9", "e18486e185abe18780"],
+ ["ebabb9", "ebaba0e18780"],
+ ["ebabba", "e18486e185abe18781"],
+ ["ebabba", "ebaba0e18781"],
+ ["ebabbb", "e18486e185abe18782"],
+ ["ebabbb", "ebaba0e18782"],
+ ["ebabbc", "e18486e185ac"],
+ ["ebabbd", "e18486e185ace186a8"],
+ ["ebabbd", "ebabbce186a8"],
+ ["ebabbe", "e18486e185ace186a9"],
+ ["ebabbe", "ebabbce186a9"],
+ ["ebabbf", "e18486e185ace186aa"],
+ ["ebabbf", "ebabbce186aa"],
+ ["ebac80", "e18486e185ace186ab"],
+ ["ebac80", "ebabbce186ab"],
+ ["ebac81", "e18486e185ace186ac"],
+ ["ebac81", "ebabbce186ac"],
+ ["ebac82", "e18486e185ace186ad"],
+ ["ebac82", "ebabbce186ad"],
+ ["ebac83", "e18486e185ace186ae"],
+ ["ebac83", "ebabbce186ae"],
+ ["ebac84", "e18486e185ace186af"],
+ ["ebac84", "ebabbce186af"],
+ ["ebac85", "e18486e185ace186b0"],
+ ["ebac85", "ebabbce186b0"],
+ ["ebac86", "e18486e185ace186b1"],
+ ["ebac86", "ebabbce186b1"],
+ ["ebac87", "e18486e185ace186b2"],
+ ["ebac87", "ebabbce186b2"],
+ ["ebac88", "e18486e185ace186b3"],
+ ["ebac88", "ebabbce186b3"],
+ ["ebac89", "e18486e185ace186b4"],
+ ["ebac89", "ebabbce186b4"],
+ ["ebac8a", "e18486e185ace186b5"],
+ ["ebac8a", "ebabbce186b5"],
+ ["ebac8b", "e18486e185ace186b6"],
+ ["ebac8b", "ebabbce186b6"],
+ ["ebac8c", "e18486e185ace186b7"],
+ ["ebac8c", "ebabbce186b7"],
+ ["ebac8d", "e18486e185ace186b8"],
+ ["ebac8d", "ebabbce186b8"],
+ ["ebac8e", "e18486e185ace186b9"],
+ ["ebac8e", "ebabbce186b9"],
+ ["ebac8f", "e18486e185ace186ba"],
+ ["ebac8f", "ebabbce186ba"],
+ ["ebac90", "e18486e185ace186bb"],
+ ["ebac90", "ebabbce186bb"],
+ ["ebac91", "e18486e185ace186bc"],
+ ["ebac91", "ebabbce186bc"],
+ ["ebac92", "e18486e185ace186bd"],
+ ["ebac92", "ebabbce186bd"],
+ ["ebac93", "e18486e185ace186be"],
+ ["ebac93", "ebabbce186be"],
+ ["ebac94", "e18486e185ace186bf"],
+ ["ebac94", "ebabbce186bf"],
+ ["ebac95", "e18486e185ace18780"],
+ ["ebac95", "ebabbce18780"],
+ ["ebac96", "e18486e185ace18781"],
+ ["ebac96", "ebabbce18781"],
+ ["ebac97", "e18486e185ace18782"],
+ ["ebac97", "ebabbce18782"],
+ ["ebac98", "e18486e185ad"],
+ ["ebac99", "e18486e185ade186a8"],
+ ["ebac99", "ebac98e186a8"],
+ ["ebac9a", "e18486e185ade186a9"],
+ ["ebac9a", "ebac98e186a9"],
+ ["ebac9b", "e18486e185ade186aa"],
+ ["ebac9b", "ebac98e186aa"],
+ ["ebac9c", "e18486e185ade186ab"],
+ ["ebac9c", "ebac98e186ab"],
+ ["ebac9d", "e18486e185ade186ac"],
+ ["ebac9d", "ebac98e186ac"],
+ ["ebac9e", "e18486e185ade186ad"],
+ ["ebac9e", "ebac98e186ad"],
+ ["ebac9f", "e18486e185ade186ae"],
+ ["ebac9f", "ebac98e186ae"],
+ ["ebaca0", "e18486e185ade186af"],
+ ["ebaca0", "ebac98e186af"],
+ ["ebaca1", "e18486e185ade186b0"],
+ ["ebaca1", "ebac98e186b0"],
+ ["ebaca2", "e18486e185ade186b1"],
+ ["ebaca2", "ebac98e186b1"],
+ ["ebaca3", "e18486e185ade186b2"],
+ ["ebaca3", "ebac98e186b2"],
+ ["ebaca4", "e18486e185ade186b3"],
+ ["ebaca4", "ebac98e186b3"],
+ ["ebaca5", "e18486e185ade186b4"],
+ ["ebaca5", "ebac98e186b4"],
+ ["ebaca6", "e18486e185ade186b5"],
+ ["ebaca6", "ebac98e186b5"],
+ ["ebaca7", "e18486e185ade186b6"],
+ ["ebaca7", "ebac98e186b6"],
+ ["ebaca8", "e18486e185ade186b7"],
+ ["ebaca8", "ebac98e186b7"],
+ ["ebaca9", "e18486e185ade186b8"],
+ ["ebaca9", "ebac98e186b8"],
+ ["ebacaa", "e18486e185ade186b9"],
+ ["ebacaa", "ebac98e186b9"],
+ ["ebacab", "e18486e185ade186ba"],
+ ["ebacab", "ebac98e186ba"],
+ ["ebacac", "e18486e185ade186bb"],
+ ["ebacac", "ebac98e186bb"],
+ ["ebacad", "e18486e185ade186bc"],
+ ["ebacad", "ebac98e186bc"],
+ ["ebacae", "e18486e185ade186bd"],
+ ["ebacae", "ebac98e186bd"],
+ ["ebacaf", "e18486e185ade186be"],
+ ["ebacaf", "ebac98e186be"],
+ ["ebacb0", "e18486e185ade186bf"],
+ ["ebacb0", "ebac98e186bf"],
+ ["ebacb1", "e18486e185ade18780"],
+ ["ebacb1", "ebac98e18780"],
+ ["ebacb2", "e18486e185ade18781"],
+ ["ebacb2", "ebac98e18781"],
+ ["ebacb3", "e18486e185ade18782"],
+ ["ebacb3", "ebac98e18782"],
+ ["ebacb4", "e18486e185ae"],
+ ["ebacb5", "e18486e185aee186a8"],
+ ["ebacb5", "ebacb4e186a8"],
+ ["ebacb6", "e18486e185aee186a9"],
+ ["ebacb6", "ebacb4e186a9"],
+ ["ebacb7", "e18486e185aee186aa"],
+ ["ebacb7", "ebacb4e186aa"],
+ ["ebacb8", "e18486e185aee186ab"],
+ ["ebacb8", "ebacb4e186ab"],
+ ["ebacb9", "e18486e185aee186ac"],
+ ["ebacb9", "ebacb4e186ac"],
+ ["ebacba", "e18486e185aee186ad"],
+ ["ebacba", "ebacb4e186ad"],
+ ["ebacbb", "e18486e185aee186ae"],
+ ["ebacbb", "ebacb4e186ae"],
+ ["ebacbc", "e18486e185aee186af"],
+ ["ebacbc", "ebacb4e186af"],
+ ["ebacbd", "e18486e185aee186b0"],
+ ["ebacbd", "ebacb4e186b0"],
+ ["ebacbe", "e18486e185aee186b1"],
+ ["ebacbe", "ebacb4e186b1"],
+ ["ebacbf", "e18486e185aee186b2"],
+ ["ebacbf", "ebacb4e186b2"],
+ ["ebad80", "e18486e185aee186b3"],
+ ["ebad80", "ebacb4e186b3"],
+ ["ebad81", "e18486e185aee186b4"],
+ ["ebad81", "ebacb4e186b4"],
+ ["ebad82", "e18486e185aee186b5"],
+ ["ebad82", "ebacb4e186b5"],
+ ["ebad83", "e18486e185aee186b6"],
+ ["ebad83", "ebacb4e186b6"],
+ ["ebad84", "e18486e185aee186b7"],
+ ["ebad84", "ebacb4e186b7"],
+ ["ebad85", "e18486e185aee186b8"],
+ ["ebad85", "ebacb4e186b8"],
+ ["ebad86", "e18486e185aee186b9"],
+ ["ebad86", "ebacb4e186b9"],
+ ["ebad87", "e18486e185aee186ba"],
+ ["ebad87", "ebacb4e186ba"],
+ ["ebad88", "e18486e185aee186bb"],
+ ["ebad88", "ebacb4e186bb"],
+ ["ebad89", "e18486e185aee186bc"],
+ ["ebad89", "ebacb4e186bc"],
+ ["ebad8a", "e18486e185aee186bd"],
+ ["ebad8a", "ebacb4e186bd"],
+ ["ebad8b", "e18486e185aee186be"],
+ ["ebad8b", "ebacb4e186be"],
+ ["ebad8c", "e18486e185aee186bf"],
+ ["ebad8c", "ebacb4e186bf"],
+ ["ebad8d", "e18486e185aee18780"],
+ ["ebad8d", "ebacb4e18780"],
+ ["ebad8e", "e18486e185aee18781"],
+ ["ebad8e", "ebacb4e18781"],
+ ["ebad8f", "e18486e185aee18782"],
+ ["ebad8f", "ebacb4e18782"],
+ ["ebad90", "e18486e185af"],
+ ["ebad91", "e18486e185afe186a8"],
+ ["ebad91", "ebad90e186a8"],
+ ["ebad92", "e18486e185afe186a9"],
+ ["ebad92", "ebad90e186a9"],
+ ["ebad93", "e18486e185afe186aa"],
+ ["ebad93", "ebad90e186aa"],
+ ["ebad94", "e18486e185afe186ab"],
+ ["ebad94", "ebad90e186ab"],
+ ["ebad95", "e18486e185afe186ac"],
+ ["ebad95", "ebad90e186ac"],
+ ["ebad96", "e18486e185afe186ad"],
+ ["ebad96", "ebad90e186ad"],
+ ["ebad97", "e18486e185afe186ae"],
+ ["ebad97", "ebad90e186ae"],
+ ["ebad98", "e18486e185afe186af"],
+ ["ebad98", "ebad90e186af"],
+ ["ebad99", "e18486e185afe186b0"],
+ ["ebad99", "ebad90e186b0"],
+ ["ebad9a", "e18486e185afe186b1"],
+ ["ebad9a", "ebad90e186b1"],
+ ["ebad9b", "e18486e185afe186b2"],
+ ["ebad9b", "ebad90e186b2"],
+ ["ebad9c", "e18486e185afe186b3"],
+ ["ebad9c", "ebad90e186b3"],
+ ["ebad9d", "e18486e185afe186b4"],
+ ["ebad9d", "ebad90e186b4"],
+ ["ebad9e", "e18486e185afe186b5"],
+ ["ebad9e", "ebad90e186b5"],
+ ["ebad9f", "e18486e185afe186b6"],
+ ["ebad9f", "ebad90e186b6"],
+ ["ebada0", "e18486e185afe186b7"],
+ ["ebada0", "ebad90e186b7"],
+ ["ebada1", "e18486e185afe186b8"],
+ ["ebada1", "ebad90e186b8"],
+ ["ebada2", "e18486e185afe186b9"],
+ ["ebada2", "ebad90e186b9"],
+ ["ebada3", "e18486e185afe186ba"],
+ ["ebada3", "ebad90e186ba"],
+ ["ebada4", "e18486e185afe186bb"],
+ ["ebada4", "ebad90e186bb"],
+ ["ebada5", "e18486e185afe186bc"],
+ ["ebada5", "ebad90e186bc"],
+ ["ebada6", "e18486e185afe186bd"],
+ ["ebada6", "ebad90e186bd"],
+ ["ebada7", "e18486e185afe186be"],
+ ["ebada7", "ebad90e186be"],
+ ["ebada8", "e18486e185afe186bf"],
+ ["ebada8", "ebad90e186bf"],
+ ["ebada9", "e18486e185afe18780"],
+ ["ebada9", "ebad90e18780"],
+ ["ebadaa", "e18486e185afe18781"],
+ ["ebadaa", "ebad90e18781"],
+ ["ebadab", "e18486e185afe18782"],
+ ["ebadab", "ebad90e18782"],
+ ["ebadac", "e18486e185b0"],
+ ["ebadad", "e18486e185b0e186a8"],
+ ["ebadad", "ebadace186a8"],
+ ["ebadae", "e18486e185b0e186a9"],
+ ["ebadae", "ebadace186a9"],
+ ["ebadaf", "e18486e185b0e186aa"],
+ ["ebadaf", "ebadace186aa"],
+ ["ebadb0", "e18486e185b0e186ab"],
+ ["ebadb0", "ebadace186ab"],
+ ["ebadb1", "e18486e185b0e186ac"],
+ ["ebadb1", "ebadace186ac"],
+ ["ebadb2", "e18486e185b0e186ad"],
+ ["ebadb2", "ebadace186ad"],
+ ["ebadb3", "e18486e185b0e186ae"],
+ ["ebadb3", "ebadace186ae"],
+ ["ebadb4", "e18486e185b0e186af"],
+ ["ebadb4", "ebadace186af"],
+ ["ebadb5", "e18486e185b0e186b0"],
+ ["ebadb5", "ebadace186b0"],
+ ["ebadb6", "e18486e185b0e186b1"],
+ ["ebadb6", "ebadace186b1"],
+ ["ebadb7", "e18486e185b0e186b2"],
+ ["ebadb7", "ebadace186b2"],
+ ["ebadb8", "e18486e185b0e186b3"],
+ ["ebadb8", "ebadace186b3"],
+ ["ebadb9", "e18486e185b0e186b4"],
+ ["ebadb9", "ebadace186b4"],
+ ["ebadba", "e18486e185b0e186b5"],
+ ["ebadba", "ebadace186b5"],
+ ["ebadbb", "e18486e185b0e186b6"],
+ ["ebadbb", "ebadace186b6"],
+ ["ebadbc", "e18486e185b0e186b7"],
+ ["ebadbc", "ebadace186b7"],
+ ["ebadbd", "e18486e185b0e186b8"],
+ ["ebadbd", "ebadace186b8"],
+ ["ebadbe", "e18486e185b0e186b9"],
+ ["ebadbe", "ebadace186b9"],
+ ["ebadbf", "e18486e185b0e186ba"],
+ ["ebadbf", "ebadace186ba"],
+ ["ebae80", "e18486e185b0e186bb"],
+ ["ebae80", "ebadace186bb"],
+ ["ebae81", "e18486e185b0e186bc"],
+ ["ebae81", "ebadace186bc"],
+ ["ebae82", "e18486e185b0e186bd"],
+ ["ebae82", "ebadace186bd"],
+ ["ebae83", "e18486e185b0e186be"],
+ ["ebae83", "ebadace186be"],
+ ["ebae84", "e18486e185b0e186bf"],
+ ["ebae84", "ebadace186bf"],
+ ["ebae85", "e18486e185b0e18780"],
+ ["ebae85", "ebadace18780"],
+ ["ebae86", "e18486e185b0e18781"],
+ ["ebae86", "ebadace18781"],
+ ["ebae87", "e18486e185b0e18782"],
+ ["ebae87", "ebadace18782"],
+ ["ebae88", "e18486e185b1"],
+ ["ebae89", "e18486e185b1e186a8"],
+ ["ebae89", "ebae88e186a8"],
+ ["ebae8a", "e18486e185b1e186a9"],
+ ["ebae8a", "ebae88e186a9"],
+ ["ebae8b", "e18486e185b1e186aa"],
+ ["ebae8b", "ebae88e186aa"],
+ ["ebae8c", "e18486e185b1e186ab"],
+ ["ebae8c", "ebae88e186ab"],
+ ["ebae8d", "e18486e185b1e186ac"],
+ ["ebae8d", "ebae88e186ac"],
+ ["ebae8e", "e18486e185b1e186ad"],
+ ["ebae8e", "ebae88e186ad"],
+ ["ebae8f", "e18486e185b1e186ae"],
+ ["ebae8f", "ebae88e186ae"],
+ ["ebae90", "e18486e185b1e186af"],
+ ["ebae90", "ebae88e186af"],
+ ["ebae91", "e18486e185b1e186b0"],
+ ["ebae91", "ebae88e186b0"],
+ ["ebae92", "e18486e185b1e186b1"],
+ ["ebae92", "ebae88e186b1"],
+ ["ebae93", "e18486e185b1e186b2"],
+ ["ebae93", "ebae88e186b2"],
+ ["ebae94", "e18486e185b1e186b3"],
+ ["ebae94", "ebae88e186b3"],
+ ["ebae95", "e18486e185b1e186b4"],
+ ["ebae95", "ebae88e186b4"],
+ ["ebae96", "e18486e185b1e186b5"],
+ ["ebae96", "ebae88e186b5"],
+ ["ebae97", "e18486e185b1e186b6"],
+ ["ebae97", "ebae88e186b6"],
+ ["ebae98", "e18486e185b1e186b7"],
+ ["ebae98", "ebae88e186b7"],
+ ["ebae99", "e18486e185b1e186b8"],
+ ["ebae99", "ebae88e186b8"],
+ ["ebae9a", "e18486e185b1e186b9"],
+ ["ebae9a", "ebae88e186b9"],
+ ["ebae9b", "e18486e185b1e186ba"],
+ ["ebae9b", "ebae88e186ba"],
+ ["ebae9c", "e18486e185b1e186bb"],
+ ["ebae9c", "ebae88e186bb"],
+ ["ebae9d", "e18486e185b1e186bc"],
+ ["ebae9d", "ebae88e186bc"],
+ ["ebae9e", "e18486e185b1e186bd"],
+ ["ebae9e", "ebae88e186bd"],
+ ["ebae9f", "e18486e185b1e186be"],
+ ["ebae9f", "ebae88e186be"],
+ ["ebaea0", "e18486e185b1e186bf"],
+ ["ebaea0", "ebae88e186bf"],
+ ["ebaea1", "e18486e185b1e18780"],
+ ["ebaea1", "ebae88e18780"],
+ ["ebaea2", "e18486e185b1e18781"],
+ ["ebaea2", "ebae88e18781"],
+ ["ebaea3", "e18486e185b1e18782"],
+ ["ebaea3", "ebae88e18782"],
+ ["ebaea4", "e18486e185b2"],
+ ["ebaea5", "e18486e185b2e186a8"],
+ ["ebaea5", "ebaea4e186a8"],
+ ["ebaea6", "e18486e185b2e186a9"],
+ ["ebaea6", "ebaea4e186a9"],
+ ["ebaea7", "e18486e185b2e186aa"],
+ ["ebaea7", "ebaea4e186aa"],
+ ["ebaea8", "e18486e185b2e186ab"],
+ ["ebaea8", "ebaea4e186ab"],
+ ["ebaea9", "e18486e185b2e186ac"],
+ ["ebaea9", "ebaea4e186ac"],
+ ["ebaeaa", "e18486e185b2e186ad"],
+ ["ebaeaa", "ebaea4e186ad"],
+ ["ebaeab", "e18486e185b2e186ae"],
+ ["ebaeab", "ebaea4e186ae"],
+ ["ebaeac", "e18486e185b2e186af"],
+ ["ebaeac", "ebaea4e186af"],
+ ["ebaead", "e18486e185b2e186b0"],
+ ["ebaead", "ebaea4e186b0"],
+ ["ebaeae", "e18486e185b2e186b1"],
+ ["ebaeae", "ebaea4e186b1"],
+ ["ebaeaf", "e18486e185b2e186b2"],
+ ["ebaeaf", "ebaea4e186b2"],
+ ["ebaeb0", "e18486e185b2e186b3"],
+ ["ebaeb0", "ebaea4e186b3"],
+ ["ebaeb1", "e18486e185b2e186b4"],
+ ["ebaeb1", "ebaea4e186b4"],
+ ["ebaeb2", "e18486e185b2e186b5"],
+ ["ebaeb2", "ebaea4e186b5"],
+ ["ebaeb3", "e18486e185b2e186b6"],
+ ["ebaeb3", "ebaea4e186b6"],
+ ["ebaeb4", "e18486e185b2e186b7"],
+ ["ebaeb4", "ebaea4e186b7"],
+ ["ebaeb5", "e18486e185b2e186b8"],
+ ["ebaeb5", "ebaea4e186b8"],
+ ["ebaeb6", "e18486e185b2e186b9"],
+ ["ebaeb6", "ebaea4e186b9"],
+ ["ebaeb7", "e18486e185b2e186ba"],
+ ["ebaeb7", "ebaea4e186ba"],
+ ["ebaeb8", "e18486e185b2e186bb"],
+ ["ebaeb8", "ebaea4e186bb"],
+ ["ebaeb9", "e18486e185b2e186bc"],
+ ["ebaeb9", "ebaea4e186bc"],
+ ["ebaeba", "e18486e185b2e186bd"],
+ ["ebaeba", "ebaea4e186bd"],
+ ["ebaebb", "e18486e185b2e186be"],
+ ["ebaebb", "ebaea4e186be"],
+ ["ebaebc", "e18486e185b2e186bf"],
+ ["ebaebc", "ebaea4e186bf"],
+ ["ebaebd", "e18486e185b2e18780"],
+ ["ebaebd", "ebaea4e18780"],
+ ["ebaebe", "e18486e185b2e18781"],
+ ["ebaebe", "ebaea4e18781"],
+ ["ebaebf", "e18486e185b2e18782"],
+ ["ebaebf", "ebaea4e18782"],
+ ["ebaf80", "e18486e185b3"],
+ ["ebaf81", "e18486e185b3e186a8"],
+ ["ebaf81", "ebaf80e186a8"],
+ ["ebaf82", "e18486e185b3e186a9"],
+ ["ebaf82", "ebaf80e186a9"],
+ ["ebaf83", "e18486e185b3e186aa"],
+ ["ebaf83", "ebaf80e186aa"],
+ ["ebaf84", "e18486e185b3e186ab"],
+ ["ebaf84", "ebaf80e186ab"],
+ ["ebaf85", "e18486e185b3e186ac"],
+ ["ebaf85", "ebaf80e186ac"],
+ ["ebaf86", "e18486e185b3e186ad"],
+ ["ebaf86", "ebaf80e186ad"],
+ ["ebaf87", "e18486e185b3e186ae"],
+ ["ebaf87", "ebaf80e186ae"],
+ ["ebaf88", "e18486e185b3e186af"],
+ ["ebaf88", "ebaf80e186af"],
+ ["ebaf89", "e18486e185b3e186b0"],
+ ["ebaf89", "ebaf80e186b0"],
+ ["ebaf8a", "e18486e185b3e186b1"],
+ ["ebaf8a", "ebaf80e186b1"],
+ ["ebaf8b", "e18486e185b3e186b2"],
+ ["ebaf8b", "ebaf80e186b2"],
+ ["ebaf8c", "e18486e185b3e186b3"],
+ ["ebaf8c", "ebaf80e186b3"],
+ ["ebaf8d", "e18486e185b3e186b4"],
+ ["ebaf8d", "ebaf80e186b4"],
+ ["ebaf8e", "e18486e185b3e186b5"],
+ ["ebaf8e", "ebaf80e186b5"],
+ ["ebaf8f", "e18486e185b3e186b6"],
+ ["ebaf8f", "ebaf80e186b6"],
+ ["ebaf90", "e18486e185b3e186b7"],
+ ["ebaf90", "ebaf80e186b7"],
+ ["ebaf91", "e18486e185b3e186b8"],
+ ["ebaf91", "ebaf80e186b8"],
+ ["ebaf92", "e18486e185b3e186b9"],
+ ["ebaf92", "ebaf80e186b9"],
+ ["ebaf93", "e18486e185b3e186ba"],
+ ["ebaf93", "ebaf80e186ba"],
+ ["ebaf94", "e18486e185b3e186bb"],
+ ["ebaf94", "ebaf80e186bb"],
+ ["ebaf95", "e18486e185b3e186bc"],
+ ["ebaf95", "ebaf80e186bc"],
+ ["ebaf96", "e18486e185b3e186bd"],
+ ["ebaf96", "ebaf80e186bd"],
+ ["ebaf97", "e18486e185b3e186be"],
+ ["ebaf97", "ebaf80e186be"],
+ ["ebaf98", "e18486e185b3e186bf"],
+ ["ebaf98", "ebaf80e186bf"],
+ ["ebaf99", "e18486e185b3e18780"],
+ ["ebaf99", "ebaf80e18780"],
+ ["ebaf9a", "e18486e185b3e18781"],
+ ["ebaf9a", "ebaf80e18781"],
+ ["ebaf9b", "e18486e185b3e18782"],
+ ["ebaf9b", "ebaf80e18782"],
+ ["ebaf9c", "e18486e185b4"],
+ ["ebaf9d", "e18486e185b4e186a8"],
+ ["ebaf9d", "ebaf9ce186a8"],
+ ["ebaf9e", "e18486e185b4e186a9"],
+ ["ebaf9e", "ebaf9ce186a9"],
+ ["ebaf9f", "e18486e185b4e186aa"],
+ ["ebaf9f", "ebaf9ce186aa"],
+ ["ebafa0", "e18486e185b4e186ab"],
+ ["ebafa0", "ebaf9ce186ab"],
+ ["ebafa1", "e18486e185b4e186ac"],
+ ["ebafa1", "ebaf9ce186ac"],
+ ["ebafa2", "e18486e185b4e186ad"],
+ ["ebafa2", "ebaf9ce186ad"],
+ ["ebafa3", "e18486e185b4e186ae"],
+ ["ebafa3", "ebaf9ce186ae"],
+ ["ebafa4", "e18486e185b4e186af"],
+ ["ebafa4", "ebaf9ce186af"],
+ ["ebafa5", "e18486e185b4e186b0"],
+ ["ebafa5", "ebaf9ce186b0"],
+ ["ebafa6", "e18486e185b4e186b1"],
+ ["ebafa6", "ebaf9ce186b1"],
+ ["ebafa7", "e18486e185b4e186b2"],
+ ["ebafa7", "ebaf9ce186b2"],
+ ["ebafa8", "e18486e185b4e186b3"],
+ ["ebafa8", "ebaf9ce186b3"],
+ ["ebafa9", "e18486e185b4e186b4"],
+ ["ebafa9", "ebaf9ce186b4"],
+ ["ebafaa", "e18486e185b4e186b5"],
+ ["ebafaa", "ebaf9ce186b5"],
+ ["ebafab", "e18486e185b4e186b6"],
+ ["ebafab", "ebaf9ce186b6"],
+ ["ebafac", "e18486e185b4e186b7"],
+ ["ebafac", "ebaf9ce186b7"],
+ ["ebafad", "e18486e185b4e186b8"],
+ ["ebafad", "ebaf9ce186b8"],
+ ["ebafae", "e18486e185b4e186b9"],
+ ["ebafae", "ebaf9ce186b9"],
+ ["ebafaf", "e18486e185b4e186ba"],
+ ["ebafaf", "ebaf9ce186ba"],
+ ["ebafb0", "e18486e185b4e186bb"],
+ ["ebafb0", "ebaf9ce186bb"],
+ ["ebafb1", "e18486e185b4e186bc"],
+ ["ebafb1", "ebaf9ce186bc"],
+ ["ebafb2", "e18486e185b4e186bd"],
+ ["ebafb2", "ebaf9ce186bd"],
+ ["ebafb3", "e18486e185b4e186be"],
+ ["ebafb3", "ebaf9ce186be"],
+ ["ebafb4", "e18486e185b4e186bf"],
+ ["ebafb4", "ebaf9ce186bf"],
+ ["ebafb5", "e18486e185b4e18780"],
+ ["ebafb5", "ebaf9ce18780"],
+ ["ebafb6", "e18486e185b4e18781"],
+ ["ebafb6", "ebaf9ce18781"],
+ ["ebafb7", "e18486e185b4e18782"],
+ ["ebafb7", "ebaf9ce18782"],
+ ["ebafb8", "e18486e185b5"],
+ ["ebafb9", "e18486e185b5e186a8"],
+ ["ebafb9", "ebafb8e186a8"],
+ ["ebafba", "e18486e185b5e186a9"],
+ ["ebafba", "ebafb8e186a9"],
+ ["ebafbb", "e18486e185b5e186aa"],
+ ["ebafbb", "ebafb8e186aa"],
+ ["ebafbc", "e18486e185b5e186ab"],
+ ["ebafbc", "ebafb8e186ab"],
+ ["ebafbd", "e18486e185b5e186ac"],
+ ["ebafbd", "ebafb8e186ac"],
+ ["ebafbe", "e18486e185b5e186ad"],
+ ["ebafbe", "ebafb8e186ad"],
+ ["ebafbf", "e18486e185b5e186ae"],
+ ["ebafbf", "ebafb8e186ae"],
+ ["ebb080", "e18486e185b5e186af"],
+ ["ebb080", "ebafb8e186af"],
+ ["ebb081", "e18486e185b5e186b0"],
+ ["ebb081", "ebafb8e186b0"],
+ ["ebb082", "e18486e185b5e186b1"],
+ ["ebb082", "ebafb8e186b1"],
+ ["ebb083", "e18486e185b5e186b2"],
+ ["ebb083", "ebafb8e186b2"],
+ ["ebb084", "e18486e185b5e186b3"],
+ ["ebb084", "ebafb8e186b3"],
+ ["ebb085", "e18486e185b5e186b4"],
+ ["ebb085", "ebafb8e186b4"],
+ ["ebb086", "e18486e185b5e186b5"],
+ ["ebb086", "ebafb8e186b5"],
+ ["ebb087", "e18486e185b5e186b6"],
+ ["ebb087", "ebafb8e186b6"],
+ ["ebb088", "e18486e185b5e186b7"],
+ ["ebb088", "ebafb8e186b7"],
+ ["ebb089", "e18486e185b5e186b8"],
+ ["ebb089", "ebafb8e186b8"],
+ ["ebb08a", "e18486e185b5e186b9"],
+ ["ebb08a", "ebafb8e186b9"],
+ ["ebb08b", "e18486e185b5e186ba"],
+ ["ebb08b", "ebafb8e186ba"],
+ ["ebb08c", "e18486e185b5e186bb"],
+ ["ebb08c", "ebafb8e186bb"],
+ ["ebb08d", "e18486e185b5e186bc"],
+ ["ebb08d", "ebafb8e186bc"],
+ ["ebb08e", "e18486e185b5e186bd"],
+ ["ebb08e", "ebafb8e186bd"],
+ ["ebb08f", "e18486e185b5e186be"],
+ ["ebb08f", "ebafb8e186be"],
+ ["ebb090", "e18486e185b5e186bf"],
+ ["ebb090", "ebafb8e186bf"],
+ ["ebb091", "e18486e185b5e18780"],
+ ["ebb091", "ebafb8e18780"],
+ ["ebb092", "e18486e185b5e18781"],
+ ["ebb092", "ebafb8e18781"],
+ ["ebb093", "e18486e185b5e18782"],
+ ["ebb093", "ebafb8e18782"],
+ ["ebb094", "e18487e185a1"],
+ ["ebb095", "e18487e185a1e186a8"],
+ ["ebb095", "ebb094e186a8"],
+ ["ebb096", "e18487e185a1e186a9"],
+ ["ebb096", "ebb094e186a9"],
+ ["ebb097", "e18487e185a1e186aa"],
+ ["ebb097", "ebb094e186aa"],
+ ["ebb098", "e18487e185a1e186ab"],
+ ["ebb098", "ebb094e186ab"],
+ ["ebb099", "e18487e185a1e186ac"],
+ ["ebb099", "ebb094e186ac"],
+ ["ebb09a", "e18487e185a1e186ad"],
+ ["ebb09a", "ebb094e186ad"],
+ ["ebb09b", "e18487e185a1e186ae"],
+ ["ebb09b", "ebb094e186ae"],
+ ["ebb09c", "e18487e185a1e186af"],
+ ["ebb09c", "ebb094e186af"],
+ ["ebb09d", "e18487e185a1e186b0"],
+ ["ebb09d", "ebb094e186b0"],
+ ["ebb09e", "e18487e185a1e186b1"],
+ ["ebb09e", "ebb094e186b1"],
+ ["ebb09f", "e18487e185a1e186b2"],
+ ["ebb09f", "ebb094e186b2"],
+ ["ebb0a0", "e18487e185a1e186b3"],
+ ["ebb0a0", "ebb094e186b3"],
+ ["ebb0a1", "e18487e185a1e186b4"],
+ ["ebb0a1", "ebb094e186b4"],
+ ["ebb0a2", "e18487e185a1e186b5"],
+ ["ebb0a2", "ebb094e186b5"],
+ ["ebb0a3", "e18487e185a1e186b6"],
+ ["ebb0a3", "ebb094e186b6"],
+ ["ebb0a4", "e18487e185a1e186b7"],
+ ["ebb0a4", "ebb094e186b7"],
+ ["ebb0a5", "e18487e185a1e186b8"],
+ ["ebb0a5", "ebb094e186b8"],
+ ["ebb0a6", "e18487e185a1e186b9"],
+ ["ebb0a6", "ebb094e186b9"],
+ ["ebb0a7", "e18487e185a1e186ba"],
+ ["ebb0a7", "ebb094e186ba"],
+ ["ebb0a8", "e18487e185a1e186bb"],
+ ["ebb0a8", "ebb094e186bb"],
+ ["ebb0a9", "e18487e185a1e186bc"],
+ ["ebb0a9", "ebb094e186bc"],
+ ["ebb0aa", "e18487e185a1e186bd"],
+ ["ebb0aa", "ebb094e186bd"],
+ ["ebb0ab", "e18487e185a1e186be"],
+ ["ebb0ab", "ebb094e186be"],
+ ["ebb0ac", "e18487e185a1e186bf"],
+ ["ebb0ac", "ebb094e186bf"],
+ ["ebb0ad", "e18487e185a1e18780"],
+ ["ebb0ad", "ebb094e18780"],
+ ["ebb0ae", "e18487e185a1e18781"],
+ ["ebb0ae", "ebb094e18781"],
+ ["ebb0af", "e18487e185a1e18782"],
+ ["ebb0af", "ebb094e18782"],
+ ["ebb0b0", "e18487e185a2"],
+ ["ebb0b1", "e18487e185a2e186a8"],
+ ["ebb0b1", "ebb0b0e186a8"],
+ ["ebb0b2", "e18487e185a2e186a9"],
+ ["ebb0b2", "ebb0b0e186a9"],
+ ["ebb0b3", "e18487e185a2e186aa"],
+ ["ebb0b3", "ebb0b0e186aa"],
+ ["ebb0b4", "e18487e185a2e186ab"],
+ ["ebb0b4", "ebb0b0e186ab"],
+ ["ebb0b5", "e18487e185a2e186ac"],
+ ["ebb0b5", "ebb0b0e186ac"],
+ ["ebb0b6", "e18487e185a2e186ad"],
+ ["ebb0b6", "ebb0b0e186ad"],
+ ["ebb0b7", "e18487e185a2e186ae"],
+ ["ebb0b7", "ebb0b0e186ae"],
+ ["ebb0b8", "e18487e185a2e186af"],
+ ["ebb0b8", "ebb0b0e186af"],
+ ["ebb0b9", "e18487e185a2e186b0"],
+ ["ebb0b9", "ebb0b0e186b0"],
+ ["ebb0ba", "e18487e185a2e186b1"],
+ ["ebb0ba", "ebb0b0e186b1"],
+ ["ebb0bb", "e18487e185a2e186b2"],
+ ["ebb0bb", "ebb0b0e186b2"],
+ ["ebb0bc", "e18487e185a2e186b3"],
+ ["ebb0bc", "ebb0b0e186b3"],
+ ["ebb0bd", "e18487e185a2e186b4"],
+ ["ebb0bd", "ebb0b0e186b4"],
+ ["ebb0be", "e18487e185a2e186b5"],
+ ["ebb0be", "ebb0b0e186b5"],
+ ["ebb0bf", "e18487e185a2e186b6"],
+ ["ebb0bf", "ebb0b0e186b6"],
+ ["ebb180", "e18487e185a2e186b7"],
+ ["ebb180", "ebb0b0e186b7"],
+ ["ebb181", "e18487e185a2e186b8"],
+ ["ebb181", "ebb0b0e186b8"],
+ ["ebb182", "e18487e185a2e186b9"],
+ ["ebb182", "ebb0b0e186b9"],
+ ["ebb183", "e18487e185a2e186ba"],
+ ["ebb183", "ebb0b0e186ba"],
+ ["ebb184", "e18487e185a2e186bb"],
+ ["ebb184", "ebb0b0e186bb"],
+ ["ebb185", "e18487e185a2e186bc"],
+ ["ebb185", "ebb0b0e186bc"],
+ ["ebb186", "e18487e185a2e186bd"],
+ ["ebb186", "ebb0b0e186bd"],
+ ["ebb187", "e18487e185a2e186be"],
+ ["ebb187", "ebb0b0e186be"],
+ ["ebb188", "e18487e185a2e186bf"],
+ ["ebb188", "ebb0b0e186bf"],
+ ["ebb189", "e18487e185a2e18780"],
+ ["ebb189", "ebb0b0e18780"],
+ ["ebb18a", "e18487e185a2e18781"],
+ ["ebb18a", "ebb0b0e18781"],
+ ["ebb18b", "e18487e185a2e18782"],
+ ["ebb18b", "ebb0b0e18782"],
+ ["ebb18c", "e18487e185a3"],
+ ["ebb18d", "e18487e185a3e186a8"],
+ ["ebb18d", "ebb18ce186a8"],
+ ["ebb18e", "e18487e185a3e186a9"],
+ ["ebb18e", "ebb18ce186a9"],
+ ["ebb18f", "e18487e185a3e186aa"],
+ ["ebb18f", "ebb18ce186aa"],
+ ["ebb190", "e18487e185a3e186ab"],
+ ["ebb190", "ebb18ce186ab"],
+ ["ebb191", "e18487e185a3e186ac"],
+ ["ebb191", "ebb18ce186ac"],
+ ["ebb192", "e18487e185a3e186ad"],
+ ["ebb192", "ebb18ce186ad"],
+ ["ebb193", "e18487e185a3e186ae"],
+ ["ebb193", "ebb18ce186ae"],
+ ["ebb194", "e18487e185a3e186af"],
+ ["ebb194", "ebb18ce186af"],
+ ["ebb195", "e18487e185a3e186b0"],
+ ["ebb195", "ebb18ce186b0"],
+ ["ebb196", "e18487e185a3e186b1"],
+ ["ebb196", "ebb18ce186b1"],
+ ["ebb197", "e18487e185a3e186b2"],
+ ["ebb197", "ebb18ce186b2"],
+ ["ebb198", "e18487e185a3e186b3"],
+ ["ebb198", "ebb18ce186b3"],
+ ["ebb199", "e18487e185a3e186b4"],
+ ["ebb199", "ebb18ce186b4"],
+ ["ebb19a", "e18487e185a3e186b5"],
+ ["ebb19a", "ebb18ce186b5"],
+ ["ebb19b", "e18487e185a3e186b6"],
+ ["ebb19b", "ebb18ce186b6"],
+ ["ebb19c", "e18487e185a3e186b7"],
+ ["ebb19c", "ebb18ce186b7"],
+ ["ebb19d", "e18487e185a3e186b8"],
+ ["ebb19d", "ebb18ce186b8"],
+ ["ebb19e", "e18487e185a3e186b9"],
+ ["ebb19e", "ebb18ce186b9"],
+ ["ebb19f", "e18487e185a3e186ba"],
+ ["ebb19f", "ebb18ce186ba"],
+ ["ebb1a0", "e18487e185a3e186bb"],
+ ["ebb1a0", "ebb18ce186bb"],
+ ["ebb1a1", "e18487e185a3e186bc"],
+ ["ebb1a1", "ebb18ce186bc"],
+ ["ebb1a2", "e18487e185a3e186bd"],
+ ["ebb1a2", "ebb18ce186bd"],
+ ["ebb1a3", "e18487e185a3e186be"],
+ ["ebb1a3", "ebb18ce186be"],
+ ["ebb1a4", "e18487e185a3e186bf"],
+ ["ebb1a4", "ebb18ce186bf"],
+ ["ebb1a5", "e18487e185a3e18780"],
+ ["ebb1a5", "ebb18ce18780"],
+ ["ebb1a6", "e18487e185a3e18781"],
+ ["ebb1a6", "ebb18ce18781"],
+ ["ebb1a7", "e18487e185a3e18782"],
+ ["ebb1a7", "ebb18ce18782"],
+ ["ebb1a8", "e18487e185a4"],
+ ["ebb1a9", "e18487e185a4e186a8"],
+ ["ebb1a9", "ebb1a8e186a8"],
+ ["ebb1aa", "e18487e185a4e186a9"],
+ ["ebb1aa", "ebb1a8e186a9"],
+ ["ebb1ab", "e18487e185a4e186aa"],
+ ["ebb1ab", "ebb1a8e186aa"],
+ ["ebb1ac", "e18487e185a4e186ab"],
+ ["ebb1ac", "ebb1a8e186ab"],
+ ["ebb1ad", "e18487e185a4e186ac"],
+ ["ebb1ad", "ebb1a8e186ac"],
+ ["ebb1ae", "e18487e185a4e186ad"],
+ ["ebb1ae", "ebb1a8e186ad"],
+ ["ebb1af", "e18487e185a4e186ae"],
+ ["ebb1af", "ebb1a8e186ae"],
+ ["ebb1b0", "e18487e185a4e186af"],
+ ["ebb1b0", "ebb1a8e186af"],
+ ["ebb1b1", "e18487e185a4e186b0"],
+ ["ebb1b1", "ebb1a8e186b0"],
+ ["ebb1b2", "e18487e185a4e186b1"],
+ ["ebb1b2", "ebb1a8e186b1"],
+ ["ebb1b3", "e18487e185a4e186b2"],
+ ["ebb1b3", "ebb1a8e186b2"],
+ ["ebb1b4", "e18487e185a4e186b3"],
+ ["ebb1b4", "ebb1a8e186b3"],
+ ["ebb1b5", "e18487e185a4e186b4"],
+ ["ebb1b5", "ebb1a8e186b4"],
+ ["ebb1b6", "e18487e185a4e186b5"],
+ ["ebb1b6", "ebb1a8e186b5"],
+ ["ebb1b7", "e18487e185a4e186b6"],
+ ["ebb1b7", "ebb1a8e186b6"],
+ ["ebb1b8", "e18487e185a4e186b7"],
+ ["ebb1b8", "ebb1a8e186b7"],
+ ["ebb1b9", "e18487e185a4e186b8"],
+ ["ebb1b9", "ebb1a8e186b8"],
+ ["ebb1ba", "e18487e185a4e186b9"],
+ ["ebb1ba", "ebb1a8e186b9"],
+ ["ebb1bb", "e18487e185a4e186ba"],
+ ["ebb1bb", "ebb1a8e186ba"],
+ ["ebb1bc", "e18487e185a4e186bb"],
+ ["ebb1bc", "ebb1a8e186bb"],
+ ["ebb1bd", "e18487e185a4e186bc"],
+ ["ebb1bd", "ebb1a8e186bc"],
+ ["ebb1be", "e18487e185a4e186bd"],
+ ["ebb1be", "ebb1a8e186bd"],
+ ["ebb1bf", "e18487e185a4e186be"],
+ ["ebb1bf", "ebb1a8e186be"],
+ ["ebb280", "e18487e185a4e186bf"],
+ ["ebb280", "ebb1a8e186bf"],
+ ["ebb281", "e18487e185a4e18780"],
+ ["ebb281", "ebb1a8e18780"],
+ ["ebb282", "e18487e185a4e18781"],
+ ["ebb282", "ebb1a8e18781"],
+ ["ebb283", "e18487e185a4e18782"],
+ ["ebb283", "ebb1a8e18782"],
+ ["ebb284", "e18487e185a5"],
+ ["ebb285", "e18487e185a5e186a8"],
+ ["ebb285", "ebb284e186a8"],
+ ["ebb286", "e18487e185a5e186a9"],
+ ["ebb286", "ebb284e186a9"],
+ ["ebb287", "e18487e185a5e186aa"],
+ ["ebb287", "ebb284e186aa"],
+ ["ebb288", "e18487e185a5e186ab"],
+ ["ebb288", "ebb284e186ab"],
+ ["ebb289", "e18487e185a5e186ac"],
+ ["ebb289", "ebb284e186ac"],
+ ["ebb28a", "e18487e185a5e186ad"],
+ ["ebb28a", "ebb284e186ad"],
+ ["ebb28b", "e18487e185a5e186ae"],
+ ["ebb28b", "ebb284e186ae"],
+ ["ebb28c", "e18487e185a5e186af"],
+ ["ebb28c", "ebb284e186af"],
+ ["ebb28d", "e18487e185a5e186b0"],
+ ["ebb28d", "ebb284e186b0"],
+ ["ebb28e", "e18487e185a5e186b1"],
+ ["ebb28e", "ebb284e186b1"],
+ ["ebb28f", "e18487e185a5e186b2"],
+ ["ebb28f", "ebb284e186b2"],
+ ["ebb290", "e18487e185a5e186b3"],
+ ["ebb290", "ebb284e186b3"],
+ ["ebb291", "e18487e185a5e186b4"],
+ ["ebb291", "ebb284e186b4"],
+ ["ebb292", "e18487e185a5e186b5"],
+ ["ebb292", "ebb284e186b5"],
+ ["ebb293", "e18487e185a5e186b6"],
+ ["ebb293", "ebb284e186b6"],
+ ["ebb294", "e18487e185a5e186b7"],
+ ["ebb294", "ebb284e186b7"],
+ ["ebb295", "e18487e185a5e186b8"],
+ ["ebb295", "ebb284e186b8"],
+ ["ebb296", "e18487e185a5e186b9"],
+ ["ebb296", "ebb284e186b9"],
+ ["ebb297", "e18487e185a5e186ba"],
+ ["ebb297", "ebb284e186ba"],
+ ["ebb298", "e18487e185a5e186bb"],
+ ["ebb298", "ebb284e186bb"],
+ ["ebb299", "e18487e185a5e186bc"],
+ ["ebb299", "ebb284e186bc"],
+ ["ebb29a", "e18487e185a5e186bd"],
+ ["ebb29a", "ebb284e186bd"],
+ ["ebb29b", "e18487e185a5e186be"],
+ ["ebb29b", "ebb284e186be"],
+ ["ebb29c", "e18487e185a5e186bf"],
+ ["ebb29c", "ebb284e186bf"],
+ ["ebb29d", "e18487e185a5e18780"],
+ ["ebb29d", "ebb284e18780"],
+ ["ebb29e", "e18487e185a5e18781"],
+ ["ebb29e", "ebb284e18781"],
+ ["ebb29f", "e18487e185a5e18782"],
+ ["ebb29f", "ebb284e18782"],
+ ["ebb2a0", "e18487e185a6"],
+ ["ebb2a1", "e18487e185a6e186a8"],
+ ["ebb2a1", "ebb2a0e186a8"],
+ ["ebb2a2", "e18487e185a6e186a9"],
+ ["ebb2a2", "ebb2a0e186a9"],
+ ["ebb2a3", "e18487e185a6e186aa"],
+ ["ebb2a3", "ebb2a0e186aa"],
+ ["ebb2a4", "e18487e185a6e186ab"],
+ ["ebb2a4", "ebb2a0e186ab"],
+ ["ebb2a5", "e18487e185a6e186ac"],
+ ["ebb2a5", "ebb2a0e186ac"],
+ ["ebb2a6", "e18487e185a6e186ad"],
+ ["ebb2a6", "ebb2a0e186ad"],
+ ["ebb2a7", "e18487e185a6e186ae"],
+ ["ebb2a7", "ebb2a0e186ae"],
+ ["ebb2a8", "e18487e185a6e186af"],
+ ["ebb2a8", "ebb2a0e186af"],
+ ["ebb2a9", "e18487e185a6e186b0"],
+ ["ebb2a9", "ebb2a0e186b0"],
+ ["ebb2aa", "e18487e185a6e186b1"],
+ ["ebb2aa", "ebb2a0e186b1"],
+ ["ebb2ab", "e18487e185a6e186b2"],
+ ["ebb2ab", "ebb2a0e186b2"],
+ ["ebb2ac", "e18487e185a6e186b3"],
+ ["ebb2ac", "ebb2a0e186b3"],
+ ["ebb2ad", "e18487e185a6e186b4"],
+ ["ebb2ad", "ebb2a0e186b4"],
+ ["ebb2ae", "e18487e185a6e186b5"],
+ ["ebb2ae", "ebb2a0e186b5"],
+ ["ebb2af", "e18487e185a6e186b6"],
+ ["ebb2af", "ebb2a0e186b6"],
+ ["ebb2b0", "e18487e185a6e186b7"],
+ ["ebb2b0", "ebb2a0e186b7"],
+ ["ebb2b1", "e18487e185a6e186b8"],
+ ["ebb2b1", "ebb2a0e186b8"],
+ ["ebb2b2", "e18487e185a6e186b9"],
+ ["ebb2b2", "ebb2a0e186b9"],
+ ["ebb2b3", "e18487e185a6e186ba"],
+ ["ebb2b3", "ebb2a0e186ba"],
+ ["ebb2b4", "e18487e185a6e186bb"],
+ ["ebb2b4", "ebb2a0e186bb"],
+ ["ebb2b5", "e18487e185a6e186bc"],
+ ["ebb2b5", "ebb2a0e186bc"],
+ ["ebb2b6", "e18487e185a6e186bd"],
+ ["ebb2b6", "ebb2a0e186bd"],
+ ["ebb2b7", "e18487e185a6e186be"],
+ ["ebb2b7", "ebb2a0e186be"],
+ ["ebb2b8", "e18487e185a6e186bf"],
+ ["ebb2b8", "ebb2a0e186bf"],
+ ["ebb2b9", "e18487e185a6e18780"],
+ ["ebb2b9", "ebb2a0e18780"],
+ ["ebb2ba", "e18487e185a6e18781"],
+ ["ebb2ba", "ebb2a0e18781"],
+ ["ebb2bb", "e18487e185a6e18782"],
+ ["ebb2bb", "ebb2a0e18782"],
+ ["ebb2bc", "e18487e185a7"],
+ ["ebb2bd", "e18487e185a7e186a8"],
+ ["ebb2bd", "ebb2bce186a8"],
+ ["ebb2be", "e18487e185a7e186a9"],
+ ["ebb2be", "ebb2bce186a9"],
+ ["ebb2bf", "e18487e185a7e186aa"],
+ ["ebb2bf", "ebb2bce186aa"],
+ ["ebb380", "e18487e185a7e186ab"],
+ ["ebb380", "ebb2bce186ab"],
+ ["ebb381", "e18487e185a7e186ac"],
+ ["ebb381", "ebb2bce186ac"],
+ ["ebb382", "e18487e185a7e186ad"],
+ ["ebb382", "ebb2bce186ad"],
+ ["ebb383", "e18487e185a7e186ae"],
+ ["ebb383", "ebb2bce186ae"],
+ ["ebb384", "e18487e185a7e186af"],
+ ["ebb384", "ebb2bce186af"],
+ ["ebb385", "e18487e185a7e186b0"],
+ ["ebb385", "ebb2bce186b0"],
+ ["ebb386", "e18487e185a7e186b1"],
+ ["ebb386", "ebb2bce186b1"],
+ ["ebb387", "e18487e185a7e186b2"],
+ ["ebb387", "ebb2bce186b2"],
+ ["ebb388", "e18487e185a7e186b3"],
+ ["ebb388", "ebb2bce186b3"],
+ ["ebb389", "e18487e185a7e186b4"],
+ ["ebb389", "ebb2bce186b4"],
+ ["ebb38a", "e18487e185a7e186b5"],
+ ["ebb38a", "ebb2bce186b5"],
+ ["ebb38b", "e18487e185a7e186b6"],
+ ["ebb38b", "ebb2bce186b6"],
+ ["ebb38c", "e18487e185a7e186b7"],
+ ["ebb38c", "ebb2bce186b7"],
+ ["ebb38d", "e18487e185a7e186b8"],
+ ["ebb38d", "ebb2bce186b8"],
+ ["ebb38e", "e18487e185a7e186b9"],
+ ["ebb38e", "ebb2bce186b9"],
+ ["ebb38f", "e18487e185a7e186ba"],
+ ["ebb38f", "ebb2bce186ba"],
+ ["ebb390", "e18487e185a7e186bb"],
+ ["ebb390", "ebb2bce186bb"],
+ ["ebb391", "e18487e185a7e186bc"],
+ ["ebb391", "ebb2bce186bc"],
+ ["ebb392", "e18487e185a7e186bd"],
+ ["ebb392", "ebb2bce186bd"],
+ ["ebb393", "e18487e185a7e186be"],
+ ["ebb393", "ebb2bce186be"],
+ ["ebb394", "e18487e185a7e186bf"],
+ ["ebb394", "ebb2bce186bf"],
+ ["ebb395", "e18487e185a7e18780"],
+ ["ebb395", "ebb2bce18780"],
+ ["ebb396", "e18487e185a7e18781"],
+ ["ebb396", "ebb2bce18781"],
+ ["ebb397", "e18487e185a7e18782"],
+ ["ebb397", "ebb2bce18782"],
+ ["ebb398", "e18487e185a8"],
+ ["ebb399", "e18487e185a8e186a8"],
+ ["ebb399", "ebb398e186a8"],
+ ["ebb39a", "e18487e185a8e186a9"],
+ ["ebb39a", "ebb398e186a9"],
+ ["ebb39b", "e18487e185a8e186aa"],
+ ["ebb39b", "ebb398e186aa"],
+ ["ebb39c", "e18487e185a8e186ab"],
+ ["ebb39c", "ebb398e186ab"],
+ ["ebb39d", "e18487e185a8e186ac"],
+ ["ebb39d", "ebb398e186ac"],
+ ["ebb39e", "e18487e185a8e186ad"],
+ ["ebb39e", "ebb398e186ad"],
+ ["ebb39f", "e18487e185a8e186ae"],
+ ["ebb39f", "ebb398e186ae"],
+ ["ebb3a0", "e18487e185a8e186af"],
+ ["ebb3a0", "ebb398e186af"],
+ ["ebb3a1", "e18487e185a8e186b0"],
+ ["ebb3a1", "ebb398e186b0"],
+ ["ebb3a2", "e18487e185a8e186b1"],
+ ["ebb3a2", "ebb398e186b1"],
+ ["ebb3a3", "e18487e185a8e186b2"],
+ ["ebb3a3", "ebb398e186b2"],
+ ["ebb3a4", "e18487e185a8e186b3"],
+ ["ebb3a4", "ebb398e186b3"],
+ ["ebb3a5", "e18487e185a8e186b4"],
+ ["ebb3a5", "ebb398e186b4"],
+ ["ebb3a6", "e18487e185a8e186b5"],
+ ["ebb3a6", "ebb398e186b5"],
+ ["ebb3a7", "e18487e185a8e186b6"],
+ ["ebb3a7", "ebb398e186b6"],
+ ["ebb3a8", "e18487e185a8e186b7"],
+ ["ebb3a8", "ebb398e186b7"],
+ ["ebb3a9", "e18487e185a8e186b8"],
+ ["ebb3a9", "ebb398e186b8"],
+ ["ebb3aa", "e18487e185a8e186b9"],
+ ["ebb3aa", "ebb398e186b9"],
+ ["ebb3ab", "e18487e185a8e186ba"],
+ ["ebb3ab", "ebb398e186ba"],
+ ["ebb3ac", "e18487e185a8e186bb"],
+ ["ebb3ac", "ebb398e186bb"],
+ ["ebb3ad", "e18487e185a8e186bc"],
+ ["ebb3ad", "ebb398e186bc"],
+ ["ebb3ae", "e18487e185a8e186bd"],
+ ["ebb3ae", "ebb398e186bd"],
+ ["ebb3af", "e18487e185a8e186be"],
+ ["ebb3af", "ebb398e186be"],
+ ["ebb3b0", "e18487e185a8e186bf"],
+ ["ebb3b0", "ebb398e186bf"],
+ ["ebb3b1", "e18487e185a8e18780"],
+ ["ebb3b1", "ebb398e18780"],
+ ["ebb3b2", "e18487e185a8e18781"],
+ ["ebb3b2", "ebb398e18781"],
+ ["ebb3b3", "e18487e185a8e18782"],
+ ["ebb3b3", "ebb398e18782"],
+ ["ebb3b4", "e18487e185a9"],
+ ["ebb3b5", "e18487e185a9e186a8"],
+ ["ebb3b5", "ebb3b4e186a8"],
+ ["ebb3b6", "e18487e185a9e186a9"],
+ ["ebb3b6", "ebb3b4e186a9"],
+ ["ebb3b7", "e18487e185a9e186aa"],
+ ["ebb3b7", "ebb3b4e186aa"],
+ ["ebb3b8", "e18487e185a9e186ab"],
+ ["ebb3b8", "ebb3b4e186ab"],
+ ["ebb3b9", "e18487e185a9e186ac"],
+ ["ebb3b9", "ebb3b4e186ac"],
+ ["ebb3ba", "e18487e185a9e186ad"],
+ ["ebb3ba", "ebb3b4e186ad"],
+ ["ebb3bb", "e18487e185a9e186ae"],
+ ["ebb3bb", "ebb3b4e186ae"],
+ ["ebb3bc", "e18487e185a9e186af"],
+ ["ebb3bc", "ebb3b4e186af"],
+ ["ebb3bd", "e18487e185a9e186b0"],
+ ["ebb3bd", "ebb3b4e186b0"],
+ ["ebb3be", "e18487e185a9e186b1"],
+ ["ebb3be", "ebb3b4e186b1"],
+ ["ebb3bf", "e18487e185a9e186b2"],
+ ["ebb3bf", "ebb3b4e186b2"],
+ ["ebb480", "e18487e185a9e186b3"],
+ ["ebb480", "ebb3b4e186b3"],
+ ["ebb481", "e18487e185a9e186b4"],
+ ["ebb481", "ebb3b4e186b4"],
+ ["ebb482", "e18487e185a9e186b5"],
+ ["ebb482", "ebb3b4e186b5"],
+ ["ebb483", "e18487e185a9e186b6"],
+ ["ebb483", "ebb3b4e186b6"],
+ ["ebb484", "e18487e185a9e186b7"],
+ ["ebb484", "ebb3b4e186b7"],
+ ["ebb485", "e18487e185a9e186b8"],
+ ["ebb485", "ebb3b4e186b8"],
+ ["ebb486", "e18487e185a9e186b9"],
+ ["ebb486", "ebb3b4e186b9"],
+ ["ebb487", "e18487e185a9e186ba"],
+ ["ebb487", "ebb3b4e186ba"],
+ ["ebb488", "e18487e185a9e186bb"],
+ ["ebb488", "ebb3b4e186bb"],
+ ["ebb489", "e18487e185a9e186bc"],
+ ["ebb489", "ebb3b4e186bc"],
+ ["ebb48a", "e18487e185a9e186bd"],
+ ["ebb48a", "ebb3b4e186bd"],
+ ["ebb48b", "e18487e185a9e186be"],
+ ["ebb48b", "ebb3b4e186be"],
+ ["ebb48c", "e18487e185a9e186bf"],
+ ["ebb48c", "ebb3b4e186bf"],
+ ["ebb48d", "e18487e185a9e18780"],
+ ["ebb48d", "ebb3b4e18780"],
+ ["ebb48e", "e18487e185a9e18781"],
+ ["ebb48e", "ebb3b4e18781"],
+ ["ebb48f", "e18487e185a9e18782"],
+ ["ebb48f", "ebb3b4e18782"],
+ ["ebb490", "e18487e185aa"],
+ ["ebb491", "e18487e185aae186a8"],
+ ["ebb491", "ebb490e186a8"],
+ ["ebb492", "e18487e185aae186a9"],
+ ["ebb492", "ebb490e186a9"],
+ ["ebb493", "e18487e185aae186aa"],
+ ["ebb493", "ebb490e186aa"],
+ ["ebb494", "e18487e185aae186ab"],
+ ["ebb494", "ebb490e186ab"],
+ ["ebb495", "e18487e185aae186ac"],
+ ["ebb495", "ebb490e186ac"],
+ ["ebb496", "e18487e185aae186ad"],
+ ["ebb496", "ebb490e186ad"],
+ ["ebb497", "e18487e185aae186ae"],
+ ["ebb497", "ebb490e186ae"],
+ ["ebb498", "e18487e185aae186af"],
+ ["ebb498", "ebb490e186af"],
+ ["ebb499", "e18487e185aae186b0"],
+ ["ebb499", "ebb490e186b0"],
+ ["ebb49a", "e18487e185aae186b1"],
+ ["ebb49a", "ebb490e186b1"],
+ ["ebb49b", "e18487e185aae186b2"],
+ ["ebb49b", "ebb490e186b2"],
+ ["ebb49c", "e18487e185aae186b3"],
+ ["ebb49c", "ebb490e186b3"],
+ ["ebb49d", "e18487e185aae186b4"],
+ ["ebb49d", "ebb490e186b4"],
+ ["ebb49e", "e18487e185aae186b5"],
+ ["ebb49e", "ebb490e186b5"],
+ ["ebb49f", "e18487e185aae186b6"],
+ ["ebb49f", "ebb490e186b6"],
+ ["ebb4a0", "e18487e185aae186b7"],
+ ["ebb4a0", "ebb490e186b7"],
+ ["ebb4a1", "e18487e185aae186b8"],
+ ["ebb4a1", "ebb490e186b8"],
+ ["ebb4a2", "e18487e185aae186b9"],
+ ["ebb4a2", "ebb490e186b9"],
+ ["ebb4a3", "e18487e185aae186ba"],
+ ["ebb4a3", "ebb490e186ba"],
+ ["ebb4a4", "e18487e185aae186bb"],
+ ["ebb4a4", "ebb490e186bb"],
+ ["ebb4a5", "e18487e185aae186bc"],
+ ["ebb4a5", "ebb490e186bc"],
+ ["ebb4a6", "e18487e185aae186bd"],
+ ["ebb4a6", "ebb490e186bd"],
+ ["ebb4a7", "e18487e185aae186be"],
+ ["ebb4a7", "ebb490e186be"],
+ ["ebb4a8", "e18487e185aae186bf"],
+ ["ebb4a8", "ebb490e186bf"],
+ ["ebb4a9", "e18487e185aae18780"],
+ ["ebb4a9", "ebb490e18780"],
+ ["ebb4aa", "e18487e185aae18781"],
+ ["ebb4aa", "ebb490e18781"],
+ ["ebb4ab", "e18487e185aae18782"],
+ ["ebb4ab", "ebb490e18782"],
+ ["ebb4ac", "e18487e185ab"],
+ ["ebb4ad", "e18487e185abe186a8"],
+ ["ebb4ad", "ebb4ace186a8"],
+ ["ebb4ae", "e18487e185abe186a9"],
+ ["ebb4ae", "ebb4ace186a9"],
+ ["ebb4af", "e18487e185abe186aa"],
+ ["ebb4af", "ebb4ace186aa"],
+ ["ebb4b0", "e18487e185abe186ab"],
+ ["ebb4b0", "ebb4ace186ab"],
+ ["ebb4b1", "e18487e185abe186ac"],
+ ["ebb4b1", "ebb4ace186ac"],
+ ["ebb4b2", "e18487e185abe186ad"],
+ ["ebb4b2", "ebb4ace186ad"],
+ ["ebb4b3", "e18487e185abe186ae"],
+ ["ebb4b3", "ebb4ace186ae"],
+ ["ebb4b4", "e18487e185abe186af"],
+ ["ebb4b4", "ebb4ace186af"],
+ ["ebb4b5", "e18487e185abe186b0"],
+ ["ebb4b5", "ebb4ace186b0"],
+ ["ebb4b6", "e18487e185abe186b1"],
+ ["ebb4b6", "ebb4ace186b1"],
+ ["ebb4b7", "e18487e185abe186b2"],
+ ["ebb4b7", "ebb4ace186b2"],
+ ["ebb4b8", "e18487e185abe186b3"],
+ ["ebb4b8", "ebb4ace186b3"],
+ ["ebb4b9", "e18487e185abe186b4"],
+ ["ebb4b9", "ebb4ace186b4"],
+ ["ebb4ba", "e18487e185abe186b5"],
+ ["ebb4ba", "ebb4ace186b5"],
+ ["ebb4bb", "e18487e185abe186b6"],
+ ["ebb4bb", "ebb4ace186b6"],
+ ["ebb4bc", "e18487e185abe186b7"],
+ ["ebb4bc", "ebb4ace186b7"],
+ ["ebb4bd", "e18487e185abe186b8"],
+ ["ebb4bd", "ebb4ace186b8"],
+ ["ebb4be", "e18487e185abe186b9"],
+ ["ebb4be", "ebb4ace186b9"],
+ ["ebb4bf", "e18487e185abe186ba"],
+ ["ebb4bf", "ebb4ace186ba"],
+ ["ebb580", "e18487e185abe186bb"],
+ ["ebb580", "ebb4ace186bb"],
+ ["ebb581", "e18487e185abe186bc"],
+ ["ebb581", "ebb4ace186bc"],
+ ["ebb582", "e18487e185abe186bd"],
+ ["ebb582", "ebb4ace186bd"],
+ ["ebb583", "e18487e185abe186be"],
+ ["ebb583", "ebb4ace186be"],
+ ["ebb584", "e18487e185abe186bf"],
+ ["ebb584", "ebb4ace186bf"],
+ ["ebb585", "e18487e185abe18780"],
+ ["ebb585", "ebb4ace18780"],
+ ["ebb586", "e18487e185abe18781"],
+ ["ebb586", "ebb4ace18781"],
+ ["ebb587", "e18487e185abe18782"],
+ ["ebb587", "ebb4ace18782"],
+ ["ebb588", "e18487e185ac"],
+ ["ebb589", "e18487e185ace186a8"],
+ ["ebb589", "ebb588e186a8"],
+ ["ebb58a", "e18487e185ace186a9"],
+ ["ebb58a", "ebb588e186a9"],
+ ["ebb58b", "e18487e185ace186aa"],
+ ["ebb58b", "ebb588e186aa"],
+ ["ebb58c", "e18487e185ace186ab"],
+ ["ebb58c", "ebb588e186ab"],
+ ["ebb58d", "e18487e185ace186ac"],
+ ["ebb58d", "ebb588e186ac"],
+ ["ebb58e", "e18487e185ace186ad"],
+ ["ebb58e", "ebb588e186ad"],
+ ["ebb58f", "e18487e185ace186ae"],
+ ["ebb58f", "ebb588e186ae"],
+ ["ebb590", "e18487e185ace186af"],
+ ["ebb590", "ebb588e186af"],
+ ["ebb591", "e18487e185ace186b0"],
+ ["ebb591", "ebb588e186b0"],
+ ["ebb592", "e18487e185ace186b1"],
+ ["ebb592", "ebb588e186b1"],
+ ["ebb593", "e18487e185ace186b2"],
+ ["ebb593", "ebb588e186b2"],
+ ["ebb594", "e18487e185ace186b3"],
+ ["ebb594", "ebb588e186b3"],
+ ["ebb595", "e18487e185ace186b4"],
+ ["ebb595", "ebb588e186b4"],
+ ["ebb596", "e18487e185ace186b5"],
+ ["ebb596", "ebb588e186b5"],
+ ["ebb597", "e18487e185ace186b6"],
+ ["ebb597", "ebb588e186b6"],
+ ["ebb598", "e18487e185ace186b7"],
+ ["ebb598", "ebb588e186b7"],
+ ["ebb599", "e18487e185ace186b8"],
+ ["ebb599", "ebb588e186b8"],
+ ["ebb59a", "e18487e185ace186b9"],
+ ["ebb59a", "ebb588e186b9"],
+ ["ebb59b", "e18487e185ace186ba"],
+ ["ebb59b", "ebb588e186ba"],
+ ["ebb59c", "e18487e185ace186bb"],
+ ["ebb59c", "ebb588e186bb"],
+ ["ebb59d", "e18487e185ace186bc"],
+ ["ebb59d", "ebb588e186bc"],
+ ["ebb59e", "e18487e185ace186bd"],
+ ["ebb59e", "ebb588e186bd"],
+ ["ebb59f", "e18487e185ace186be"],
+ ["ebb59f", "ebb588e186be"],
+ ["ebb5a0", "e18487e185ace186bf"],
+ ["ebb5a0", "ebb588e186bf"],
+ ["ebb5a1", "e18487e185ace18780"],
+ ["ebb5a1", "ebb588e18780"],
+ ["ebb5a2", "e18487e185ace18781"],
+ ["ebb5a2", "ebb588e18781"],
+ ["ebb5a3", "e18487e185ace18782"],
+ ["ebb5a3", "ebb588e18782"],
+ ["ebb5a4", "e18487e185ad"],
+ ["ebb5a5", "e18487e185ade186a8"],
+ ["ebb5a5", "ebb5a4e186a8"],
+ ["ebb5a6", "e18487e185ade186a9"],
+ ["ebb5a6", "ebb5a4e186a9"],
+ ["ebb5a7", "e18487e185ade186aa"],
+ ["ebb5a7", "ebb5a4e186aa"],
+ ["ebb5a8", "e18487e185ade186ab"],
+ ["ebb5a8", "ebb5a4e186ab"],
+ ["ebb5a9", "e18487e185ade186ac"],
+ ["ebb5a9", "ebb5a4e186ac"],
+ ["ebb5aa", "e18487e185ade186ad"],
+ ["ebb5aa", "ebb5a4e186ad"],
+ ["ebb5ab", "e18487e185ade186ae"],
+ ["ebb5ab", "ebb5a4e186ae"],
+ ["ebb5ac", "e18487e185ade186af"],
+ ["ebb5ac", "ebb5a4e186af"],
+ ["ebb5ad", "e18487e185ade186b0"],
+ ["ebb5ad", "ebb5a4e186b0"],
+ ["ebb5ae", "e18487e185ade186b1"],
+ ["ebb5ae", "ebb5a4e186b1"],
+ ["ebb5af", "e18487e185ade186b2"],
+ ["ebb5af", "ebb5a4e186b2"],
+ ["ebb5b0", "e18487e185ade186b3"],
+ ["ebb5b0", "ebb5a4e186b3"],
+ ["ebb5b1", "e18487e185ade186b4"],
+ ["ebb5b1", "ebb5a4e186b4"],
+ ["ebb5b2", "e18487e185ade186b5"],
+ ["ebb5b2", "ebb5a4e186b5"],
+ ["ebb5b3", "e18487e185ade186b6"],
+ ["ebb5b3", "ebb5a4e186b6"],
+ ["ebb5b4", "e18487e185ade186b7"],
+ ["ebb5b4", "ebb5a4e186b7"],
+ ["ebb5b5", "e18487e185ade186b8"],
+ ["ebb5b5", "ebb5a4e186b8"],
+ ["ebb5b6", "e18487e185ade186b9"],
+ ["ebb5b6", "ebb5a4e186b9"],
+ ["ebb5b7", "e18487e185ade186ba"],
+ ["ebb5b7", "ebb5a4e186ba"],
+ ["ebb5b8", "e18487e185ade186bb"],
+ ["ebb5b8", "ebb5a4e186bb"],
+ ["ebb5b9", "e18487e185ade186bc"],
+ ["ebb5b9", "ebb5a4e186bc"],
+ ["ebb5ba", "e18487e185ade186bd"],
+ ["ebb5ba", "ebb5a4e186bd"],
+ ["ebb5bb", "e18487e185ade186be"],
+ ["ebb5bb", "ebb5a4e186be"],
+ ["ebb5bc", "e18487e185ade186bf"],
+ ["ebb5bc", "ebb5a4e186bf"],
+ ["ebb5bd", "e18487e185ade18780"],
+ ["ebb5bd", "ebb5a4e18780"],
+ ["ebb5be", "e18487e185ade18781"],
+ ["ebb5be", "ebb5a4e18781"],
+ ["ebb5bf", "e18487e185ade18782"],
+ ["ebb5bf", "ebb5a4e18782"],
+ ["ebb680", "e18487e185ae"],
+ ["ebb681", "e18487e185aee186a8"],
+ ["ebb681", "ebb680e186a8"],
+ ["ebb682", "e18487e185aee186a9"],
+ ["ebb682", "ebb680e186a9"],
+ ["ebb683", "e18487e185aee186aa"],
+ ["ebb683", "ebb680e186aa"],
+ ["ebb684", "e18487e185aee186ab"],
+ ["ebb684", "ebb680e186ab"],
+ ["ebb685", "e18487e185aee186ac"],
+ ["ebb685", "ebb680e186ac"],
+ ["ebb686", "e18487e185aee186ad"],
+ ["ebb686", "ebb680e186ad"],
+ ["ebb687", "e18487e185aee186ae"],
+ ["ebb687", "ebb680e186ae"],
+ ["ebb688", "e18487e185aee186af"],
+ ["ebb688", "ebb680e186af"],
+ ["ebb689", "e18487e185aee186b0"],
+ ["ebb689", "ebb680e186b0"],
+ ["ebb68a", "e18487e185aee186b1"],
+ ["ebb68a", "ebb680e186b1"],
+ ["ebb68b", "e18487e185aee186b2"],
+ ["ebb68b", "ebb680e186b2"],
+ ["ebb68c", "e18487e185aee186b3"],
+ ["ebb68c", "ebb680e186b3"],
+ ["ebb68d", "e18487e185aee186b4"],
+ ["ebb68d", "ebb680e186b4"],
+ ["ebb68e", "e18487e185aee186b5"],
+ ["ebb68e", "ebb680e186b5"],
+ ["ebb68f", "e18487e185aee186b6"],
+ ["ebb68f", "ebb680e186b6"],
+ ["ebb690", "e18487e185aee186b7"],
+ ["ebb690", "ebb680e186b7"],
+ ["ebb691", "e18487e185aee186b8"],
+ ["ebb691", "ebb680e186b8"],
+ ["ebb692", "e18487e185aee186b9"],
+ ["ebb692", "ebb680e186b9"],
+ ["ebb693", "e18487e185aee186ba"],
+ ["ebb693", "ebb680e186ba"],
+ ["ebb694", "e18487e185aee186bb"],
+ ["ebb694", "ebb680e186bb"],
+ ["ebb695", "e18487e185aee186bc"],
+ ["ebb695", "ebb680e186bc"],
+ ["ebb696", "e18487e185aee186bd"],
+ ["ebb696", "ebb680e186bd"],
+ ["ebb697", "e18487e185aee186be"],
+ ["ebb697", "ebb680e186be"],
+ ["ebb698", "e18487e185aee186bf"],
+ ["ebb698", "ebb680e186bf"],
+ ["ebb699", "e18487e185aee18780"],
+ ["ebb699", "ebb680e18780"],
+ ["ebb69a", "e18487e185aee18781"],
+ ["ebb69a", "ebb680e18781"],
+ ["ebb69b", "e18487e185aee18782"],
+ ["ebb69b", "ebb680e18782"],
+ ["ebb69c", "e18487e185af"],
+ ["ebb69d", "e18487e185afe186a8"],
+ ["ebb69d", "ebb69ce186a8"],
+ ["ebb69e", "e18487e185afe186a9"],
+ ["ebb69e", "ebb69ce186a9"],
+ ["ebb69f", "e18487e185afe186aa"],
+ ["ebb69f", "ebb69ce186aa"],
+ ["ebb6a0", "e18487e185afe186ab"],
+ ["ebb6a0", "ebb69ce186ab"],
+ ["ebb6a1", "e18487e185afe186ac"],
+ ["ebb6a1", "ebb69ce186ac"],
+ ["ebb6a2", "e18487e185afe186ad"],
+ ["ebb6a2", "ebb69ce186ad"],
+ ["ebb6a3", "e18487e185afe186ae"],
+ ["ebb6a3", "ebb69ce186ae"],
+ ["ebb6a4", "e18487e185afe186af"],
+ ["ebb6a4", "ebb69ce186af"],
+ ["ebb6a5", "e18487e185afe186b0"],
+ ["ebb6a5", "ebb69ce186b0"],
+ ["ebb6a6", "e18487e185afe186b1"],
+ ["ebb6a6", "ebb69ce186b1"],
+ ["ebb6a7", "e18487e185afe186b2"],
+ ["ebb6a7", "ebb69ce186b2"],
+ ["ebb6a8", "e18487e185afe186b3"],
+ ["ebb6a8", "ebb69ce186b3"],
+ ["ebb6a9", "e18487e185afe186b4"],
+ ["ebb6a9", "ebb69ce186b4"],
+ ["ebb6aa", "e18487e185afe186b5"],
+ ["ebb6aa", "ebb69ce186b5"],
+ ["ebb6ab", "e18487e185afe186b6"],
+ ["ebb6ab", "ebb69ce186b6"],
+ ["ebb6ac", "e18487e185afe186b7"],
+ ["ebb6ac", "ebb69ce186b7"],
+ ["ebb6ad", "e18487e185afe186b8"],
+ ["ebb6ad", "ebb69ce186b8"],
+ ["ebb6ae", "e18487e185afe186b9"],
+ ["ebb6ae", "ebb69ce186b9"],
+ ["ebb6af", "e18487e185afe186ba"],
+ ["ebb6af", "ebb69ce186ba"],
+ ["ebb6b0", "e18487e185afe186bb"],
+ ["ebb6b0", "ebb69ce186bb"],
+ ["ebb6b1", "e18487e185afe186bc"],
+ ["ebb6b1", "ebb69ce186bc"],
+ ["ebb6b2", "e18487e185afe186bd"],
+ ["ebb6b2", "ebb69ce186bd"],
+ ["ebb6b3", "e18487e185afe186be"],
+ ["ebb6b3", "ebb69ce186be"],
+ ["ebb6b4", "e18487e185afe186bf"],
+ ["ebb6b4", "ebb69ce186bf"],
+ ["ebb6b5", "e18487e185afe18780"],
+ ["ebb6b5", "ebb69ce18780"],
+ ["ebb6b6", "e18487e185afe18781"],
+ ["ebb6b6", "ebb69ce18781"],
+ ["ebb6b7", "e18487e185afe18782"],
+ ["ebb6b7", "ebb69ce18782"],
+ ["ebb6b8", "e18487e185b0"],
+ ["ebb6b9", "e18487e185b0e186a8"],
+ ["ebb6b9", "ebb6b8e186a8"],
+ ["ebb6ba", "e18487e185b0e186a9"],
+ ["ebb6ba", "ebb6b8e186a9"],
+ ["ebb6bb", "e18487e185b0e186aa"],
+ ["ebb6bb", "ebb6b8e186aa"],
+ ["ebb6bc", "e18487e185b0e186ab"],
+ ["ebb6bc", "ebb6b8e186ab"],
+ ["ebb6bd", "e18487e185b0e186ac"],
+ ["ebb6bd", "ebb6b8e186ac"],
+ ["ebb6be", "e18487e185b0e186ad"],
+ ["ebb6be", "ebb6b8e186ad"],
+ ["ebb6bf", "e18487e185b0e186ae"],
+ ["ebb6bf", "ebb6b8e186ae"],
+ ["ebb780", "e18487e185b0e186af"],
+ ["ebb780", "ebb6b8e186af"],
+ ["ebb781", "e18487e185b0e186b0"],
+ ["ebb781", "ebb6b8e186b0"],
+ ["ebb782", "e18487e185b0e186b1"],
+ ["ebb782", "ebb6b8e186b1"],
+ ["ebb783", "e18487e185b0e186b2"],
+ ["ebb783", "ebb6b8e186b2"],
+ ["ebb784", "e18487e185b0e186b3"],
+ ["ebb784", "ebb6b8e186b3"],
+ ["ebb785", "e18487e185b0e186b4"],
+ ["ebb785", "ebb6b8e186b4"],
+ ["ebb786", "e18487e185b0e186b5"],
+ ["ebb786", "ebb6b8e186b5"],
+ ["ebb787", "e18487e185b0e186b6"],
+ ["ebb787", "ebb6b8e186b6"],
+ ["ebb788", "e18487e185b0e186b7"],
+ ["ebb788", "ebb6b8e186b7"],
+ ["ebb789", "e18487e185b0e186b8"],
+ ["ebb789", "ebb6b8e186b8"],
+ ["ebb78a", "e18487e185b0e186b9"],
+ ["ebb78a", "ebb6b8e186b9"],
+ ["ebb78b", "e18487e185b0e186ba"],
+ ["ebb78b", "ebb6b8e186ba"],
+ ["ebb78c", "e18487e185b0e186bb"],
+ ["ebb78c", "ebb6b8e186bb"],
+ ["ebb78d", "e18487e185b0e186bc"],
+ ["ebb78d", "ebb6b8e186bc"],
+ ["ebb78e", "e18487e185b0e186bd"],
+ ["ebb78e", "ebb6b8e186bd"],
+ ["ebb78f", "e18487e185b0e186be"],
+ ["ebb78f", "ebb6b8e186be"],
+ ["ebb790", "e18487e185b0e186bf"],
+ ["ebb790", "ebb6b8e186bf"],
+ ["ebb791", "e18487e185b0e18780"],
+ ["ebb791", "ebb6b8e18780"],
+ ["ebb792", "e18487e185b0e18781"],
+ ["ebb792", "ebb6b8e18781"],
+ ["ebb793", "e18487e185b0e18782"],
+ ["ebb793", "ebb6b8e18782"],
+ ["ebb794", "e18487e185b1"],
+ ["ebb795", "e18487e185b1e186a8"],
+ ["ebb795", "ebb794e186a8"],
+ ["ebb796", "e18487e185b1e186a9"],
+ ["ebb796", "ebb794e186a9"],
+ ["ebb797", "e18487e185b1e186aa"],
+ ["ebb797", "ebb794e186aa"],
+ ["ebb798", "e18487e185b1e186ab"],
+ ["ebb798", "ebb794e186ab"],
+ ["ebb799", "e18487e185b1e186ac"],
+ ["ebb799", "ebb794e186ac"],
+ ["ebb79a", "e18487e185b1e186ad"],
+ ["ebb79a", "ebb794e186ad"],
+ ["ebb79b", "e18487e185b1e186ae"],
+ ["ebb79b", "ebb794e186ae"],
+ ["ebb79c", "e18487e185b1e186af"],
+ ["ebb79c", "ebb794e186af"],
+ ["ebb79d", "e18487e185b1e186b0"],
+ ["ebb79d", "ebb794e186b0"],
+ ["ebb79e", "e18487e185b1e186b1"],
+ ["ebb79e", "ebb794e186b1"],
+ ["ebb79f", "e18487e185b1e186b2"],
+ ["ebb79f", "ebb794e186b2"],
+ ["ebb7a0", "e18487e185b1e186b3"],
+ ["ebb7a0", "ebb794e186b3"],
+ ["ebb7a1", "e18487e185b1e186b4"],
+ ["ebb7a1", "ebb794e186b4"],
+ ["ebb7a2", "e18487e185b1e186b5"],
+ ["ebb7a2", "ebb794e186b5"],
+ ["ebb7a3", "e18487e185b1e186b6"],
+ ["ebb7a3", "ebb794e186b6"],
+ ["ebb7a4", "e18487e185b1e186b7"],
+ ["ebb7a4", "ebb794e186b7"],
+ ["ebb7a5", "e18487e185b1e186b8"],
+ ["ebb7a5", "ebb794e186b8"],
+ ["ebb7a6", "e18487e185b1e186b9"],
+ ["ebb7a6", "ebb794e186b9"],
+ ["ebb7a7", "e18487e185b1e186ba"],
+ ["ebb7a7", "ebb794e186ba"],
+ ["ebb7a8", "e18487e185b1e186bb"],
+ ["ebb7a8", "ebb794e186bb"],
+ ["ebb7a9", "e18487e185b1e186bc"],
+ ["ebb7a9", "ebb794e186bc"],
+ ["ebb7aa", "e18487e185b1e186bd"],
+ ["ebb7aa", "ebb794e186bd"],
+ ["ebb7ab", "e18487e185b1e186be"],
+ ["ebb7ab", "ebb794e186be"],
+ ["ebb7ac", "e18487e185b1e186bf"],
+ ["ebb7ac", "ebb794e186bf"],
+ ["ebb7ad", "e18487e185b1e18780"],
+ ["ebb7ad", "ebb794e18780"],
+ ["ebb7ae", "e18487e185b1e18781"],
+ ["ebb7ae", "ebb794e18781"],
+ ["ebb7af", "e18487e185b1e18782"],
+ ["ebb7af", "ebb794e18782"],
+ ["ebb7b0", "e18487e185b2"],
+ ["ebb7b1", "e18487e185b2e186a8"],
+ ["ebb7b1", "ebb7b0e186a8"],
+ ["ebb7b2", "e18487e185b2e186a9"],
+ ["ebb7b2", "ebb7b0e186a9"],
+ ["ebb7b3", "e18487e185b2e186aa"],
+ ["ebb7b3", "ebb7b0e186aa"],
+ ["ebb7b4", "e18487e185b2e186ab"],
+ ["ebb7b4", "ebb7b0e186ab"],
+ ["ebb7b5", "e18487e185b2e186ac"],
+ ["ebb7b5", "ebb7b0e186ac"],
+ ["ebb7b6", "e18487e185b2e186ad"],
+ ["ebb7b6", "ebb7b0e186ad"],
+ ["ebb7b7", "e18487e185b2e186ae"],
+ ["ebb7b7", "ebb7b0e186ae"],
+ ["ebb7b8", "e18487e185b2e186af"],
+ ["ebb7b8", "ebb7b0e186af"],
+ ["ebb7b9", "e18487e185b2e186b0"],
+ ["ebb7b9", "ebb7b0e186b0"],
+ ["ebb7ba", "e18487e185b2e186b1"],
+ ["ebb7ba", "ebb7b0e186b1"],
+ ["ebb7bb", "e18487e185b2e186b2"],
+ ["ebb7bb", "ebb7b0e186b2"],
+ ["ebb7bc", "e18487e185b2e186b3"],
+ ["ebb7bc", "ebb7b0e186b3"],
+ ["ebb7bd", "e18487e185b2e186b4"],
+ ["ebb7bd", "ebb7b0e186b4"],
+ ["ebb7be", "e18487e185b2e186b5"],
+ ["ebb7be", "ebb7b0e186b5"],
+ ["ebb7bf", "e18487e185b2e186b6"],
+ ["ebb7bf", "ebb7b0e186b6"],
+ ["ebb880", "e18487e185b2e186b7"],
+ ["ebb880", "ebb7b0e186b7"],
+ ["ebb881", "e18487e185b2e186b8"],
+ ["ebb881", "ebb7b0e186b8"],
+ ["ebb882", "e18487e185b2e186b9"],
+ ["ebb882", "ebb7b0e186b9"],
+ ["ebb883", "e18487e185b2e186ba"],
+ ["ebb883", "ebb7b0e186ba"],
+ ["ebb884", "e18487e185b2e186bb"],
+ ["ebb884", "ebb7b0e186bb"],
+ ["ebb885", "e18487e185b2e186bc"],
+ ["ebb885", "ebb7b0e186bc"],
+ ["ebb886", "e18487e185b2e186bd"],
+ ["ebb886", "ebb7b0e186bd"],
+ ["ebb887", "e18487e185b2e186be"],
+ ["ebb887", "ebb7b0e186be"],
+ ["ebb888", "e18487e185b2e186bf"],
+ ["ebb888", "ebb7b0e186bf"],
+ ["ebb889", "e18487e185b2e18780"],
+ ["ebb889", "ebb7b0e18780"],
+ ["ebb88a", "e18487e185b2e18781"],
+ ["ebb88a", "ebb7b0e18781"],
+ ["ebb88b", "e18487e185b2e18782"],
+ ["ebb88b", "ebb7b0e18782"],
+ ["ebb88c", "e18487e185b3"],
+ ["ebb88d", "e18487e185b3e186a8"],
+ ["ebb88d", "ebb88ce186a8"],
+ ["ebb88e", "e18487e185b3e186a9"],
+ ["ebb88e", "ebb88ce186a9"],
+ ["ebb88f", "e18487e185b3e186aa"],
+ ["ebb88f", "ebb88ce186aa"],
+ ["ebb890", "e18487e185b3e186ab"],
+ ["ebb890", "ebb88ce186ab"],
+ ["ebb891", "e18487e185b3e186ac"],
+ ["ebb891", "ebb88ce186ac"],
+ ["ebb892", "e18487e185b3e186ad"],
+ ["ebb892", "ebb88ce186ad"],
+ ["ebb893", "e18487e185b3e186ae"],
+ ["ebb893", "ebb88ce186ae"],
+ ["ebb894", "e18487e185b3e186af"],
+ ["ebb894", "ebb88ce186af"],
+ ["ebb895", "e18487e185b3e186b0"],
+ ["ebb895", "ebb88ce186b0"],
+ ["ebb896", "e18487e185b3e186b1"],
+ ["ebb896", "ebb88ce186b1"],
+ ["ebb897", "e18487e185b3e186b2"],
+ ["ebb897", "ebb88ce186b2"],
+ ["ebb898", "e18487e185b3e186b3"],
+ ["ebb898", "ebb88ce186b3"],
+ ["ebb899", "e18487e185b3e186b4"],
+ ["ebb899", "ebb88ce186b4"],
+ ["ebb89a", "e18487e185b3e186b5"],
+ ["ebb89a", "ebb88ce186b5"],
+ ["ebb89b", "e18487e185b3e186b6"],
+ ["ebb89b", "ebb88ce186b6"],
+ ["ebb89c", "e18487e185b3e186b7"],
+ ["ebb89c", "ebb88ce186b7"],
+ ["ebb89d", "e18487e185b3e186b8"],
+ ["ebb89d", "ebb88ce186b8"],
+ ["ebb89e", "e18487e185b3e186b9"],
+ ["ebb89e", "ebb88ce186b9"],
+ ["ebb89f", "e18487e185b3e186ba"],
+ ["ebb89f", "ebb88ce186ba"],
+ ["ebb8a0", "e18487e185b3e186bb"],
+ ["ebb8a0", "ebb88ce186bb"],
+ ["ebb8a1", "e18487e185b3e186bc"],
+ ["ebb8a1", "ebb88ce186bc"],
+ ["ebb8a2", "e18487e185b3e186bd"],
+ ["ebb8a2", "ebb88ce186bd"],
+ ["ebb8a3", "e18487e185b3e186be"],
+ ["ebb8a3", "ebb88ce186be"],
+ ["ebb8a4", "e18487e185b3e186bf"],
+ ["ebb8a4", "ebb88ce186bf"],
+ ["ebb8a5", "e18487e185b3e18780"],
+ ["ebb8a5", "ebb88ce18780"],
+ ["ebb8a6", "e18487e185b3e18781"],
+ ["ebb8a6", "ebb88ce18781"],
+ ["ebb8a7", "e18487e185b3e18782"],
+ ["ebb8a7", "ebb88ce18782"],
+ ["ebb8a8", "e18487e185b4"],
+ ["ebb8a9", "e18487e185b4e186a8"],
+ ["ebb8a9", "ebb8a8e186a8"],
+ ["ebb8aa", "e18487e185b4e186a9"],
+ ["ebb8aa", "ebb8a8e186a9"],
+ ["ebb8ab", "e18487e185b4e186aa"],
+ ["ebb8ab", "ebb8a8e186aa"],
+ ["ebb8ac", "e18487e185b4e186ab"],
+ ["ebb8ac", "ebb8a8e186ab"],
+ ["ebb8ad", "e18487e185b4e186ac"],
+ ["ebb8ad", "ebb8a8e186ac"],
+ ["ebb8ae", "e18487e185b4e186ad"],
+ ["ebb8ae", "ebb8a8e186ad"],
+ ["ebb8af", "e18487e185b4e186ae"],
+ ["ebb8af", "ebb8a8e186ae"],
+ ["ebb8b0", "e18487e185b4e186af"],
+ ["ebb8b0", "ebb8a8e186af"],
+ ["ebb8b1", "e18487e185b4e186b0"],
+ ["ebb8b1", "ebb8a8e186b0"],
+ ["ebb8b2", "e18487e185b4e186b1"],
+ ["ebb8b2", "ebb8a8e186b1"],
+ ["ebb8b3", "e18487e185b4e186b2"],
+ ["ebb8b3", "ebb8a8e186b2"],
+ ["ebb8b4", "e18487e185b4e186b3"],
+ ["ebb8b4", "ebb8a8e186b3"],
+ ["ebb8b5", "e18487e185b4e186b4"],
+ ["ebb8b5", "ebb8a8e186b4"],
+ ["ebb8b6", "e18487e185b4e186b5"],
+ ["ebb8b6", "ebb8a8e186b5"],
+ ["ebb8b7", "e18487e185b4e186b6"],
+ ["ebb8b7", "ebb8a8e186b6"],
+ ["ebb8b8", "e18487e185b4e186b7"],
+ ["ebb8b8", "ebb8a8e186b7"],
+ ["ebb8b9", "e18487e185b4e186b8"],
+ ["ebb8b9", "ebb8a8e186b8"],
+ ["ebb8ba", "e18487e185b4e186b9"],
+ ["ebb8ba", "ebb8a8e186b9"],
+ ["ebb8bb", "e18487e185b4e186ba"],
+ ["ebb8bb", "ebb8a8e186ba"],
+ ["ebb8bc", "e18487e185b4e186bb"],
+ ["ebb8bc", "ebb8a8e186bb"],
+ ["ebb8bd", "e18487e185b4e186bc"],
+ ["ebb8bd", "ebb8a8e186bc"],
+ ["ebb8be", "e18487e185b4e186bd"],
+ ["ebb8be", "ebb8a8e186bd"],
+ ["ebb8bf", "e18487e185b4e186be"],
+ ["ebb8bf", "ebb8a8e186be"],
+ ["ebb980", "e18487e185b4e186bf"],
+ ["ebb980", "ebb8a8e186bf"],
+ ["ebb981", "e18487e185b4e18780"],
+ ["ebb981", "ebb8a8e18780"],
+ ["ebb982", "e18487e185b4e18781"],
+ ["ebb982", "ebb8a8e18781"],
+ ["ebb983", "e18487e185b4e18782"],
+ ["ebb983", "ebb8a8e18782"],
+ ["ebb984", "e18487e185b5"],
+ ["ebb985", "e18487e185b5e186a8"],
+ ["ebb985", "ebb984e186a8"],
+ ["ebb986", "e18487e185b5e186a9"],
+ ["ebb986", "ebb984e186a9"],
+ ["ebb987", "e18487e185b5e186aa"],
+ ["ebb987", "ebb984e186aa"],
+ ["ebb988", "e18487e185b5e186ab"],
+ ["ebb988", "ebb984e186ab"],
+ ["ebb989", "e18487e185b5e186ac"],
+ ["ebb989", "ebb984e186ac"],
+ ["ebb98a", "e18487e185b5e186ad"],
+ ["ebb98a", "ebb984e186ad"],
+ ["ebb98b", "e18487e185b5e186ae"],
+ ["ebb98b", "ebb984e186ae"],
+ ["ebb98c", "e18487e185b5e186af"],
+ ["ebb98c", "ebb984e186af"],
+ ["ebb98d", "e18487e185b5e186b0"],
+ ["ebb98d", "ebb984e186b0"],
+ ["ebb98e", "e18487e185b5e186b1"],
+ ["ebb98e", "ebb984e186b1"],
+ ["ebb98f", "e18487e185b5e186b2"],
+ ["ebb98f", "ebb984e186b2"],
+ ["ebb990", "e18487e185b5e186b3"],
+ ["ebb990", "ebb984e186b3"],
+ ["ebb991", "e18487e185b5e186b4"],
+ ["ebb991", "ebb984e186b4"],
+ ["ebb992", "e18487e185b5e186b5"],
+ ["ebb992", "ebb984e186b5"],
+ ["ebb993", "e18487e185b5e186b6"],
+ ["ebb993", "ebb984e186b6"],
+ ["ebb994", "e18487e185b5e186b7"],
+ ["ebb994", "ebb984e186b7"],
+ ["ebb995", "e18487e185b5e186b8"],
+ ["ebb995", "ebb984e186b8"],
+ ["ebb996", "e18487e185b5e186b9"],
+ ["ebb996", "ebb984e186b9"],
+ ["ebb997", "e18487e185b5e186ba"],
+ ["ebb997", "ebb984e186ba"],
+ ["ebb998", "e18487e185b5e186bb"],
+ ["ebb998", "ebb984e186bb"],
+ ["ebb999", "e18487e185b5e186bc"],
+ ["ebb999", "ebb984e186bc"],
+ ["ebb99a", "e18487e185b5e186bd"],
+ ["ebb99a", "ebb984e186bd"],
+ ["ebb99b", "e18487e185b5e186be"],
+ ["ebb99b", "ebb984e186be"],
+ ["ebb99c", "e18487e185b5e186bf"],
+ ["ebb99c", "ebb984e186bf"],
+ ["ebb99d", "e18487e185b5e18780"],
+ ["ebb99d", "ebb984e18780"],
+ ["ebb99e", "e18487e185b5e18781"],
+ ["ebb99e", "ebb984e18781"],
+ ["ebb99f", "e18487e185b5e18782"],
+ ["ebb99f", "ebb984e18782"],
+ ["ebb9a0", "e18488e185a1"],
+ ["ebb9a1", "e18488e185a1e186a8"],
+ ["ebb9a1", "ebb9a0e186a8"],
+ ["ebb9a2", "e18488e185a1e186a9"],
+ ["ebb9a2", "ebb9a0e186a9"],
+ ["ebb9a3", "e18488e185a1e186aa"],
+ ["ebb9a3", "ebb9a0e186aa"],
+ ["ebb9a4", "e18488e185a1e186ab"],
+ ["ebb9a4", "ebb9a0e186ab"],
+ ["ebb9a5", "e18488e185a1e186ac"],
+ ["ebb9a5", "ebb9a0e186ac"],
+ ["ebb9a6", "e18488e185a1e186ad"],
+ ["ebb9a6", "ebb9a0e186ad"],
+ ["ebb9a7", "e18488e185a1e186ae"],
+ ["ebb9a7", "ebb9a0e186ae"],
+ ["ebb9a8", "e18488e185a1e186af"],
+ ["ebb9a8", "ebb9a0e186af"],
+ ["ebb9a9", "e18488e185a1e186b0"],
+ ["ebb9a9", "ebb9a0e186b0"],
+ ["ebb9aa", "e18488e185a1e186b1"],
+ ["ebb9aa", "ebb9a0e186b1"],
+ ["ebb9ab", "e18488e185a1e186b2"],
+ ["ebb9ab", "ebb9a0e186b2"],
+ ["ebb9ac", "e18488e185a1e186b3"],
+ ["ebb9ac", "ebb9a0e186b3"],
+ ["ebb9ad", "e18488e185a1e186b4"],
+ ["ebb9ad", "ebb9a0e186b4"],
+ ["ebb9ae", "e18488e185a1e186b5"],
+ ["ebb9ae", "ebb9a0e186b5"],
+ ["ebb9af", "e18488e185a1e186b6"],
+ ["ebb9af", "ebb9a0e186b6"],
+ ["ebb9b0", "e18488e185a1e186b7"],
+ ["ebb9b0", "ebb9a0e186b7"],
+ ["ebb9b1", "e18488e185a1e186b8"],
+ ["ebb9b1", "ebb9a0e186b8"],
+ ["ebb9b2", "e18488e185a1e186b9"],
+ ["ebb9b2", "ebb9a0e186b9"],
+ ["ebb9b3", "e18488e185a1e186ba"],
+ ["ebb9b3", "ebb9a0e186ba"],
+ ["ebb9b4", "e18488e185a1e186bb"],
+ ["ebb9b4", "ebb9a0e186bb"],
+ ["ebb9b5", "e18488e185a1e186bc"],
+ ["ebb9b5", "ebb9a0e186bc"],
+ ["ebb9b6", "e18488e185a1e186bd"],
+ ["ebb9b6", "ebb9a0e186bd"],
+ ["ebb9b7", "e18488e185a1e186be"],
+ ["ebb9b7", "ebb9a0e186be"],
+ ["ebb9b8", "e18488e185a1e186bf"],
+ ["ebb9b8", "ebb9a0e186bf"],
+ ["ebb9b9", "e18488e185a1e18780"],
+ ["ebb9b9", "ebb9a0e18780"],
+ ["ebb9ba", "e18488e185a1e18781"],
+ ["ebb9ba", "ebb9a0e18781"],
+ ["ebb9bb", "e18488e185a1e18782"],
+ ["ebb9bb", "ebb9a0e18782"],
+ ["ebb9bc", "e18488e185a2"],
+ ["ebb9bd", "e18488e185a2e186a8"],
+ ["ebb9bd", "ebb9bce186a8"],
+ ["ebb9be", "e18488e185a2e186a9"],
+ ["ebb9be", "ebb9bce186a9"],
+ ["ebb9bf", "e18488e185a2e186aa"],
+ ["ebb9bf", "ebb9bce186aa"],
+ ["ebba80", "e18488e185a2e186ab"],
+ ["ebba80", "ebb9bce186ab"],
+ ["ebba81", "e18488e185a2e186ac"],
+ ["ebba81", "ebb9bce186ac"],
+ ["ebba82", "e18488e185a2e186ad"],
+ ["ebba82", "ebb9bce186ad"],
+ ["ebba83", "e18488e185a2e186ae"],
+ ["ebba83", "ebb9bce186ae"],
+ ["ebba84", "e18488e185a2e186af"],
+ ["ebba84", "ebb9bce186af"],
+ ["ebba85", "e18488e185a2e186b0"],
+ ["ebba85", "ebb9bce186b0"],
+ ["ebba86", "e18488e185a2e186b1"],
+ ["ebba86", "ebb9bce186b1"],
+ ["ebba87", "e18488e185a2e186b2"],
+ ["ebba87", "ebb9bce186b2"],
+ ["ebba88", "e18488e185a2e186b3"],
+ ["ebba88", "ebb9bce186b3"],
+ ["ebba89", "e18488e185a2e186b4"],
+ ["ebba89", "ebb9bce186b4"],
+ ["ebba8a", "e18488e185a2e186b5"],
+ ["ebba8a", "ebb9bce186b5"],
+ ["ebba8b", "e18488e185a2e186b6"],
+ ["ebba8b", "ebb9bce186b6"],
+ ["ebba8c", "e18488e185a2e186b7"],
+ ["ebba8c", "ebb9bce186b7"],
+ ["ebba8d", "e18488e185a2e186b8"],
+ ["ebba8d", "ebb9bce186b8"],
+ ["ebba8e", "e18488e185a2e186b9"],
+ ["ebba8e", "ebb9bce186b9"],
+ ["ebba8f", "e18488e185a2e186ba"],
+ ["ebba8f", "ebb9bce186ba"],
+ ["ebba90", "e18488e185a2e186bb"],
+ ["ebba90", "ebb9bce186bb"],
+ ["ebba91", "e18488e185a2e186bc"],
+ ["ebba91", "ebb9bce186bc"],
+ ["ebba92", "e18488e185a2e186bd"],
+ ["ebba92", "ebb9bce186bd"],
+ ["ebba93", "e18488e185a2e186be"],
+ ["ebba93", "ebb9bce186be"],
+ ["ebba94", "e18488e185a2e186bf"],
+ ["ebba94", "ebb9bce186bf"],
+ ["ebba95", "e18488e185a2e18780"],
+ ["ebba95", "ebb9bce18780"],
+ ["ebba96", "e18488e185a2e18781"],
+ ["ebba96", "ebb9bce18781"],
+ ["ebba97", "e18488e185a2e18782"],
+ ["ebba97", "ebb9bce18782"],
+ ["ebba98", "e18488e185a3"],
+ ["ebba99", "e18488e185a3e186a8"],
+ ["ebba99", "ebba98e186a8"],
+ ["ebba9a", "e18488e185a3e186a9"],
+ ["ebba9a", "ebba98e186a9"],
+ ["ebba9b", "e18488e185a3e186aa"],
+ ["ebba9b", "ebba98e186aa"],
+ ["ebba9c", "e18488e185a3e186ab"],
+ ["ebba9c", "ebba98e186ab"],
+ ["ebba9d", "e18488e185a3e186ac"],
+ ["ebba9d", "ebba98e186ac"],
+ ["ebba9e", "e18488e185a3e186ad"],
+ ["ebba9e", "ebba98e186ad"],
+ ["ebba9f", "e18488e185a3e186ae"],
+ ["ebba9f", "ebba98e186ae"],
+ ["ebbaa0", "e18488e185a3e186af"],
+ ["ebbaa0", "ebba98e186af"],
+ ["ebbaa1", "e18488e185a3e186b0"],
+ ["ebbaa1", "ebba98e186b0"],
+ ["ebbaa2", "e18488e185a3e186b1"],
+ ["ebbaa2", "ebba98e186b1"],
+ ["ebbaa3", "e18488e185a3e186b2"],
+ ["ebbaa3", "ebba98e186b2"],
+ ["ebbaa4", "e18488e185a3e186b3"],
+ ["ebbaa4", "ebba98e186b3"],
+ ["ebbaa5", "e18488e185a3e186b4"],
+ ["ebbaa5", "ebba98e186b4"],
+ ["ebbaa6", "e18488e185a3e186b5"],
+ ["ebbaa6", "ebba98e186b5"],
+ ["ebbaa7", "e18488e185a3e186b6"],
+ ["ebbaa7", "ebba98e186b6"],
+ ["ebbaa8", "e18488e185a3e186b7"],
+ ["ebbaa8", "ebba98e186b7"],
+ ["ebbaa9", "e18488e185a3e186b8"],
+ ["ebbaa9", "ebba98e186b8"],
+ ["ebbaaa", "e18488e185a3e186b9"],
+ ["ebbaaa", "ebba98e186b9"],
+ ["ebbaab", "e18488e185a3e186ba"],
+ ["ebbaab", "ebba98e186ba"],
+ ["ebbaac", "e18488e185a3e186bb"],
+ ["ebbaac", "ebba98e186bb"],
+ ["ebbaad", "e18488e185a3e186bc"],
+ ["ebbaad", "ebba98e186bc"],
+ ["ebbaae", "e18488e185a3e186bd"],
+ ["ebbaae", "ebba98e186bd"],
+ ["ebbaaf", "e18488e185a3e186be"],
+ ["ebbaaf", "ebba98e186be"],
+ ["ebbab0", "e18488e185a3e186bf"],
+ ["ebbab0", "ebba98e186bf"],
+ ["ebbab1", "e18488e185a3e18780"],
+ ["ebbab1", "ebba98e18780"],
+ ["ebbab2", "e18488e185a3e18781"],
+ ["ebbab2", "ebba98e18781"],
+ ["ebbab3", "e18488e185a3e18782"],
+ ["ebbab3", "ebba98e18782"],
+ ["ebbab4", "e18488e185a4"],
+ ["ebbab5", "e18488e185a4e186a8"],
+ ["ebbab5", "ebbab4e186a8"],
+ ["ebbab6", "e18488e185a4e186a9"],
+ ["ebbab6", "ebbab4e186a9"],
+ ["ebbab7", "e18488e185a4e186aa"],
+ ["ebbab7", "ebbab4e186aa"],
+ ["ebbab8", "e18488e185a4e186ab"],
+ ["ebbab8", "ebbab4e186ab"],
+ ["ebbab9", "e18488e185a4e186ac"],
+ ["ebbab9", "ebbab4e186ac"],
+ ["ebbaba", "e18488e185a4e186ad"],
+ ["ebbaba", "ebbab4e186ad"],
+ ["ebbabb", "e18488e185a4e186ae"],
+ ["ebbabb", "ebbab4e186ae"],
+ ["ebbabc", "e18488e185a4e186af"],
+ ["ebbabc", "ebbab4e186af"],
+ ["ebbabd", "e18488e185a4e186b0"],
+ ["ebbabd", "ebbab4e186b0"],
+ ["ebbabe", "e18488e185a4e186b1"],
+ ["ebbabe", "ebbab4e186b1"],
+ ["ebbabf", "e18488e185a4e186b2"],
+ ["ebbabf", "ebbab4e186b2"],
+ ["ebbb80", "e18488e185a4e186b3"],
+ ["ebbb80", "ebbab4e186b3"],
+ ["ebbb81", "e18488e185a4e186b4"],
+ ["ebbb81", "ebbab4e186b4"],
+ ["ebbb82", "e18488e185a4e186b5"],
+ ["ebbb82", "ebbab4e186b5"],
+ ["ebbb83", "e18488e185a4e186b6"],
+ ["ebbb83", "ebbab4e186b6"],
+ ["ebbb84", "e18488e185a4e186b7"],
+ ["ebbb84", "ebbab4e186b7"],
+ ["ebbb85", "e18488e185a4e186b8"],
+ ["ebbb85", "ebbab4e186b8"],
+ ["ebbb86", "e18488e185a4e186b9"],
+ ["ebbb86", "ebbab4e186b9"],
+ ["ebbb87", "e18488e185a4e186ba"],
+ ["ebbb87", "ebbab4e186ba"],
+ ["ebbb88", "e18488e185a4e186bb"],
+ ["ebbb88", "ebbab4e186bb"],
+ ["ebbb89", "e18488e185a4e186bc"],
+ ["ebbb89", "ebbab4e186bc"],
+ ["ebbb8a", "e18488e185a4e186bd"],
+ ["ebbb8a", "ebbab4e186bd"],
+ ["ebbb8b", "e18488e185a4e186be"],
+ ["ebbb8b", "ebbab4e186be"],
+ ["ebbb8c", "e18488e185a4e186bf"],
+ ["ebbb8c", "ebbab4e186bf"],
+ ["ebbb8d", "e18488e185a4e18780"],
+ ["ebbb8d", "ebbab4e18780"],
+ ["ebbb8e", "e18488e185a4e18781"],
+ ["ebbb8e", "ebbab4e18781"],
+ ["ebbb8f", "e18488e185a4e18782"],
+ ["ebbb8f", "ebbab4e18782"],
+ ["ebbb90", "e18488e185a5"],
+ ["ebbb91", "e18488e185a5e186a8"],
+ ["ebbb91", "ebbb90e186a8"],
+ ["ebbb92", "e18488e185a5e186a9"],
+ ["ebbb92", "ebbb90e186a9"],
+ ["ebbb93", "e18488e185a5e186aa"],
+ ["ebbb93", "ebbb90e186aa"],
+ ["ebbb94", "e18488e185a5e186ab"],
+ ["ebbb94", "ebbb90e186ab"],
+ ["ebbb95", "e18488e185a5e186ac"],
+ ["ebbb95", "ebbb90e186ac"],
+ ["ebbb96", "e18488e185a5e186ad"],
+ ["ebbb96", "ebbb90e186ad"],
+ ["ebbb97", "e18488e185a5e186ae"],
+ ["ebbb97", "ebbb90e186ae"],
+ ["ebbb98", "e18488e185a5e186af"],
+ ["ebbb98", "ebbb90e186af"],
+ ["ebbb99", "e18488e185a5e186b0"],
+ ["ebbb99", "ebbb90e186b0"],
+ ["ebbb9a", "e18488e185a5e186b1"],
+ ["ebbb9a", "ebbb90e186b1"],
+ ["ebbb9b", "e18488e185a5e186b2"],
+ ["ebbb9b", "ebbb90e186b2"],
+ ["ebbb9c", "e18488e185a5e186b3"],
+ ["ebbb9c", "ebbb90e186b3"],
+ ["ebbb9d", "e18488e185a5e186b4"],
+ ["ebbb9d", "ebbb90e186b4"],
+ ["ebbb9e", "e18488e185a5e186b5"],
+ ["ebbb9e", "ebbb90e186b5"],
+ ["ebbb9f", "e18488e185a5e186b6"],
+ ["ebbb9f", "ebbb90e186b6"],
+ ["ebbba0", "e18488e185a5e186b7"],
+ ["ebbba0", "ebbb90e186b7"],
+ ["ebbba1", "e18488e185a5e186b8"],
+ ["ebbba1", "ebbb90e186b8"],
+ ["ebbba2", "e18488e185a5e186b9"],
+ ["ebbba2", "ebbb90e186b9"],
+ ["ebbba3", "e18488e185a5e186ba"],
+ ["ebbba3", "ebbb90e186ba"],
+ ["ebbba4", "e18488e185a5e186bb"],
+ ["ebbba4", "ebbb90e186bb"],
+ ["ebbba5", "e18488e185a5e186bc"],
+ ["ebbba5", "ebbb90e186bc"],
+ ["ebbba6", "e18488e185a5e186bd"],
+ ["ebbba6", "ebbb90e186bd"],
+ ["ebbba7", "e18488e185a5e186be"],
+ ["ebbba7", "ebbb90e186be"],
+ ["ebbba8", "e18488e185a5e186bf"],
+ ["ebbba8", "ebbb90e186bf"],
+ ["ebbba9", "e18488e185a5e18780"],
+ ["ebbba9", "ebbb90e18780"],
+ ["ebbbaa", "e18488e185a5e18781"],
+ ["ebbbaa", "ebbb90e18781"],
+ ["ebbbab", "e18488e185a5e18782"],
+ ["ebbbab", "ebbb90e18782"],
+ ["ebbbac", "e18488e185a6"],
+ ["ebbbad", "e18488e185a6e186a8"],
+ ["ebbbad", "ebbbace186a8"],
+ ["ebbbae", "e18488e185a6e186a9"],
+ ["ebbbae", "ebbbace186a9"],
+ ["ebbbaf", "e18488e185a6e186aa"],
+ ["ebbbaf", "ebbbace186aa"],
+ ["ebbbb0", "e18488e185a6e186ab"],
+ ["ebbbb0", "ebbbace186ab"],
+ ["ebbbb1", "e18488e185a6e186ac"],
+ ["ebbbb1", "ebbbace186ac"],
+ ["ebbbb2", "e18488e185a6e186ad"],
+ ["ebbbb2", "ebbbace186ad"],
+ ["ebbbb3", "e18488e185a6e186ae"],
+ ["ebbbb3", "ebbbace186ae"],
+ ["ebbbb4", "e18488e185a6e186af"],
+ ["ebbbb4", "ebbbace186af"],
+ ["ebbbb5", "e18488e185a6e186b0"],
+ ["ebbbb5", "ebbbace186b0"],
+ ["ebbbb6", "e18488e185a6e186b1"],
+ ["ebbbb6", "ebbbace186b1"],
+ ["ebbbb7", "e18488e185a6e186b2"],
+ ["ebbbb7", "ebbbace186b2"],
+ ["ebbbb8", "e18488e185a6e186b3"],
+ ["ebbbb8", "ebbbace186b3"],
+ ["ebbbb9", "e18488e185a6e186b4"],
+ ["ebbbb9", "ebbbace186b4"],
+ ["ebbbba", "e18488e185a6e186b5"],
+ ["ebbbba", "ebbbace186b5"],
+ ["ebbbbb", "e18488e185a6e186b6"],
+ ["ebbbbb", "ebbbace186b6"],
+ ["ebbbbc", "e18488e185a6e186b7"],
+ ["ebbbbc", "ebbbace186b7"],
+ ["ebbbbd", "e18488e185a6e186b8"],
+ ["ebbbbd", "ebbbace186b8"],
+ ["ebbbbe", "e18488e185a6e186b9"],
+ ["ebbbbe", "ebbbace186b9"],
+ ["ebbbbf", "e18488e185a6e186ba"],
+ ["ebbbbf", "ebbbace186ba"],
+ ["ebbc80", "e18488e185a6e186bb"],
+ ["ebbc80", "ebbbace186bb"],
+ ["ebbc81", "e18488e185a6e186bc"],
+ ["ebbc81", "ebbbace186bc"],
+ ["ebbc82", "e18488e185a6e186bd"],
+ ["ebbc82", "ebbbace186bd"],
+ ["ebbc83", "e18488e185a6e186be"],
+ ["ebbc83", "ebbbace186be"],
+ ["ebbc84", "e18488e185a6e186bf"],
+ ["ebbc84", "ebbbace186bf"],
+ ["ebbc85", "e18488e185a6e18780"],
+ ["ebbc85", "ebbbace18780"],
+ ["ebbc86", "e18488e185a6e18781"],
+ ["ebbc86", "ebbbace18781"],
+ ["ebbc87", "e18488e185a6e18782"],
+ ["ebbc87", "ebbbace18782"],
+ ["ebbc88", "e18488e185a7"],
+ ["ebbc89", "e18488e185a7e186a8"],
+ ["ebbc89", "ebbc88e186a8"],
+ ["ebbc8a", "e18488e185a7e186a9"],
+ ["ebbc8a", "ebbc88e186a9"],
+ ["ebbc8b", "e18488e185a7e186aa"],
+ ["ebbc8b", "ebbc88e186aa"],
+ ["ebbc8c", "e18488e185a7e186ab"],
+ ["ebbc8c", "ebbc88e186ab"],
+ ["ebbc8d", "e18488e185a7e186ac"],
+ ["ebbc8d", "ebbc88e186ac"],
+ ["ebbc8e", "e18488e185a7e186ad"],
+ ["ebbc8e", "ebbc88e186ad"],
+ ["ebbc8f", "e18488e185a7e186ae"],
+ ["ebbc8f", "ebbc88e186ae"],
+ ["ebbc90", "e18488e185a7e186af"],
+ ["ebbc90", "ebbc88e186af"],
+ ["ebbc91", "e18488e185a7e186b0"],
+ ["ebbc91", "ebbc88e186b0"],
+ ["ebbc92", "e18488e185a7e186b1"],
+ ["ebbc92", "ebbc88e186b1"],
+ ["ebbc93", "e18488e185a7e186b2"],
+ ["ebbc93", "ebbc88e186b2"],
+ ["ebbc94", "e18488e185a7e186b3"],
+ ["ebbc94", "ebbc88e186b3"],
+ ["ebbc95", "e18488e185a7e186b4"],
+ ["ebbc95", "ebbc88e186b4"],
+ ["ebbc96", "e18488e185a7e186b5"],
+ ["ebbc96", "ebbc88e186b5"],
+ ["ebbc97", "e18488e185a7e186b6"],
+ ["ebbc97", "ebbc88e186b6"],
+ ["ebbc98", "e18488e185a7e186b7"],
+ ["ebbc98", "ebbc88e186b7"],
+ ["ebbc99", "e18488e185a7e186b8"],
+ ["ebbc99", "ebbc88e186b8"],
+ ["ebbc9a", "e18488e185a7e186b9"],
+ ["ebbc9a", "ebbc88e186b9"],
+ ["ebbc9b", "e18488e185a7e186ba"],
+ ["ebbc9b", "ebbc88e186ba"],
+ ["ebbc9c", "e18488e185a7e186bb"],
+ ["ebbc9c", "ebbc88e186bb"],
+ ["ebbc9d", "e18488e185a7e186bc"],
+ ["ebbc9d", "ebbc88e186bc"],
+ ["ebbc9e", "e18488e185a7e186bd"],
+ ["ebbc9e", "ebbc88e186bd"],
+ ["ebbc9f", "e18488e185a7e186be"],
+ ["ebbc9f", "ebbc88e186be"],
+ ["ebbca0", "e18488e185a7e186bf"],
+ ["ebbca0", "ebbc88e186bf"],
+ ["ebbca1", "e18488e185a7e18780"],
+ ["ebbca1", "ebbc88e18780"],
+ ["ebbca2", "e18488e185a7e18781"],
+ ["ebbca2", "ebbc88e18781"],
+ ["ebbca3", "e18488e185a7e18782"],
+ ["ebbca3", "ebbc88e18782"],
+ ["ebbca4", "e18488e185a8"],
+ ["ebbca5", "e18488e185a8e186a8"],
+ ["ebbca5", "ebbca4e186a8"],
+ ["ebbca6", "e18488e185a8e186a9"],
+ ["ebbca6", "ebbca4e186a9"],
+ ["ebbca7", "e18488e185a8e186aa"],
+ ["ebbca7", "ebbca4e186aa"],
+ ["ebbca8", "e18488e185a8e186ab"],
+ ["ebbca8", "ebbca4e186ab"],
+ ["ebbca9", "e18488e185a8e186ac"],
+ ["ebbca9", "ebbca4e186ac"],
+ ["ebbcaa", "e18488e185a8e186ad"],
+ ["ebbcaa", "ebbca4e186ad"],
+ ["ebbcab", "e18488e185a8e186ae"],
+ ["ebbcab", "ebbca4e186ae"],
+ ["ebbcac", "e18488e185a8e186af"],
+ ["ebbcac", "ebbca4e186af"],
+ ["ebbcad", "e18488e185a8e186b0"],
+ ["ebbcad", "ebbca4e186b0"],
+ ["ebbcae", "e18488e185a8e186b1"],
+ ["ebbcae", "ebbca4e186b1"],
+ ["ebbcaf", "e18488e185a8e186b2"],
+ ["ebbcaf", "ebbca4e186b2"],
+ ["ebbcb0", "e18488e185a8e186b3"],
+ ["ebbcb0", "ebbca4e186b3"],
+ ["ebbcb1", "e18488e185a8e186b4"],
+ ["ebbcb1", "ebbca4e186b4"],
+ ["ebbcb2", "e18488e185a8e186b5"],
+ ["ebbcb2", "ebbca4e186b5"],
+ ["ebbcb3", "e18488e185a8e186b6"],
+ ["ebbcb3", "ebbca4e186b6"],
+ ["ebbcb4", "e18488e185a8e186b7"],
+ ["ebbcb4", "ebbca4e186b7"],
+ ["ebbcb5", "e18488e185a8e186b8"],
+ ["ebbcb5", "ebbca4e186b8"],
+ ["ebbcb6", "e18488e185a8e186b9"],
+ ["ebbcb6", "ebbca4e186b9"],
+ ["ebbcb7", "e18488e185a8e186ba"],
+ ["ebbcb7", "ebbca4e186ba"],
+ ["ebbcb8", "e18488e185a8e186bb"],
+ ["ebbcb8", "ebbca4e186bb"],
+ ["ebbcb9", "e18488e185a8e186bc"],
+ ["ebbcb9", "ebbca4e186bc"],
+ ["ebbcba", "e18488e185a8e186bd"],
+ ["ebbcba", "ebbca4e186bd"],
+ ["ebbcbb", "e18488e185a8e186be"],
+ ["ebbcbb", "ebbca4e186be"],
+ ["ebbcbc", "e18488e185a8e186bf"],
+ ["ebbcbc", "ebbca4e186bf"],
+ ["ebbcbd", "e18488e185a8e18780"],
+ ["ebbcbd", "ebbca4e18780"],
+ ["ebbcbe", "e18488e185a8e18781"],
+ ["ebbcbe", "ebbca4e18781"],
+ ["ebbcbf", "e18488e185a8e18782"],
+ ["ebbcbf", "ebbca4e18782"],
+ ["ebbd80", "e18488e185a9"],
+ ["ebbd81", "e18488e185a9e186a8"],
+ ["ebbd81", "ebbd80e186a8"],
+ ["ebbd82", "e18488e185a9e186a9"],
+ ["ebbd82", "ebbd80e186a9"],
+ ["ebbd83", "e18488e185a9e186aa"],
+ ["ebbd83", "ebbd80e186aa"],
+ ["ebbd84", "e18488e185a9e186ab"],
+ ["ebbd84", "ebbd80e186ab"],
+ ["ebbd85", "e18488e185a9e186ac"],
+ ["ebbd85", "ebbd80e186ac"],
+ ["ebbd86", "e18488e185a9e186ad"],
+ ["ebbd86", "ebbd80e186ad"],
+ ["ebbd87", "e18488e185a9e186ae"],
+ ["ebbd87", "ebbd80e186ae"],
+ ["ebbd88", "e18488e185a9e186af"],
+ ["ebbd88", "ebbd80e186af"],
+ ["ebbd89", "e18488e185a9e186b0"],
+ ["ebbd89", "ebbd80e186b0"],
+ ["ebbd8a", "e18488e185a9e186b1"],
+ ["ebbd8a", "ebbd80e186b1"],
+ ["ebbd8b", "e18488e185a9e186b2"],
+ ["ebbd8b", "ebbd80e186b2"],
+ ["ebbd8c", "e18488e185a9e186b3"],
+ ["ebbd8c", "ebbd80e186b3"],
+ ["ebbd8d", "e18488e185a9e186b4"],
+ ["ebbd8d", "ebbd80e186b4"],
+ ["ebbd8e", "e18488e185a9e186b5"],
+ ["ebbd8e", "ebbd80e186b5"],
+ ["ebbd8f", "e18488e185a9e186b6"],
+ ["ebbd8f", "ebbd80e186b6"],
+ ["ebbd90", "e18488e185a9e186b7"],
+ ["ebbd90", "ebbd80e186b7"],
+ ["ebbd91", "e18488e185a9e186b8"],
+ ["ebbd91", "ebbd80e186b8"],
+ ["ebbd92", "e18488e185a9e186b9"],
+ ["ebbd92", "ebbd80e186b9"],
+ ["ebbd93", "e18488e185a9e186ba"],
+ ["ebbd93", "ebbd80e186ba"],
+ ["ebbd94", "e18488e185a9e186bb"],
+ ["ebbd94", "ebbd80e186bb"],
+ ["ebbd95", "e18488e185a9e186bc"],
+ ["ebbd95", "ebbd80e186bc"],
+ ["ebbd96", "e18488e185a9e186bd"],
+ ["ebbd96", "ebbd80e186bd"],
+ ["ebbd97", "e18488e185a9e186be"],
+ ["ebbd97", "ebbd80e186be"],
+ ["ebbd98", "e18488e185a9e186bf"],
+ ["ebbd98", "ebbd80e186bf"],
+ ["ebbd99", "e18488e185a9e18780"],
+ ["ebbd99", "ebbd80e18780"],
+ ["ebbd9a", "e18488e185a9e18781"],
+ ["ebbd9a", "ebbd80e18781"],
+ ["ebbd9b", "e18488e185a9e18782"],
+ ["ebbd9b", "ebbd80e18782"],
+ ["ebbd9c", "e18488e185aa"],
+ ["ebbd9d", "e18488e185aae186a8"],
+ ["ebbd9d", "ebbd9ce186a8"],
+ ["ebbd9e", "e18488e185aae186a9"],
+ ["ebbd9e", "ebbd9ce186a9"],
+ ["ebbd9f", "e18488e185aae186aa"],
+ ["ebbd9f", "ebbd9ce186aa"],
+ ["ebbda0", "e18488e185aae186ab"],
+ ["ebbda0", "ebbd9ce186ab"],
+ ["ebbda1", "e18488e185aae186ac"],
+ ["ebbda1", "ebbd9ce186ac"],
+ ["ebbda2", "e18488e185aae186ad"],
+ ["ebbda2", "ebbd9ce186ad"],
+ ["ebbda3", "e18488e185aae186ae"],
+ ["ebbda3", "ebbd9ce186ae"],
+ ["ebbda4", "e18488e185aae186af"],
+ ["ebbda4", "ebbd9ce186af"],
+ ["ebbda5", "e18488e185aae186b0"],
+ ["ebbda5", "ebbd9ce186b0"],
+ ["ebbda6", "e18488e185aae186b1"],
+ ["ebbda6", "ebbd9ce186b1"],
+ ["ebbda7", "e18488e185aae186b2"],
+ ["ebbda7", "ebbd9ce186b2"],
+ ["ebbda8", "e18488e185aae186b3"],
+ ["ebbda8", "ebbd9ce186b3"],
+ ["ebbda9", "e18488e185aae186b4"],
+ ["ebbda9", "ebbd9ce186b4"],
+ ["ebbdaa", "e18488e185aae186b5"],
+ ["ebbdaa", "ebbd9ce186b5"],
+ ["ebbdab", "e18488e185aae186b6"],
+ ["ebbdab", "ebbd9ce186b6"],
+ ["ebbdac", "e18488e185aae186b7"],
+ ["ebbdac", "ebbd9ce186b7"],
+ ["ebbdad", "e18488e185aae186b8"],
+ ["ebbdad", "ebbd9ce186b8"],
+ ["ebbdae", "e18488e185aae186b9"],
+ ["ebbdae", "ebbd9ce186b9"],
+ ["ebbdaf", "e18488e185aae186ba"],
+ ["ebbdaf", "ebbd9ce186ba"],
+ ["ebbdb0", "e18488e185aae186bb"],
+ ["ebbdb0", "ebbd9ce186bb"],
+ ["ebbdb1", "e18488e185aae186bc"],
+ ["ebbdb1", "ebbd9ce186bc"],
+ ["ebbdb2", "e18488e185aae186bd"],
+ ["ebbdb2", "ebbd9ce186bd"],
+ ["ebbdb3", "e18488e185aae186be"],
+ ["ebbdb3", "ebbd9ce186be"],
+ ["ebbdb4", "e18488e185aae186bf"],
+ ["ebbdb4", "ebbd9ce186bf"],
+ ["ebbdb5", "e18488e185aae18780"],
+ ["ebbdb5", "ebbd9ce18780"],
+ ["ebbdb6", "e18488e185aae18781"],
+ ["ebbdb6", "ebbd9ce18781"],
+ ["ebbdb7", "e18488e185aae18782"],
+ ["ebbdb7", "ebbd9ce18782"],
+ ["ebbdb8", "e18488e185ab"],
+ ["ebbdb9", "e18488e185abe186a8"],
+ ["ebbdb9", "ebbdb8e186a8"],
+ ["ebbdba", "e18488e185abe186a9"],
+ ["ebbdba", "ebbdb8e186a9"],
+ ["ebbdbb", "e18488e185abe186aa"],
+ ["ebbdbb", "ebbdb8e186aa"],
+ ["ebbdbc", "e18488e185abe186ab"],
+ ["ebbdbc", "ebbdb8e186ab"],
+ ["ebbdbd", "e18488e185abe186ac"],
+ ["ebbdbd", "ebbdb8e186ac"],
+ ["ebbdbe", "e18488e185abe186ad"],
+ ["ebbdbe", "ebbdb8e186ad"],
+ ["ebbdbf", "e18488e185abe186ae"],
+ ["ebbdbf", "ebbdb8e186ae"],
+ ["ebbe80", "e18488e185abe186af"],
+ ["ebbe80", "ebbdb8e186af"],
+ ["ebbe81", "e18488e185abe186b0"],
+ ["ebbe81", "ebbdb8e186b0"],
+ ["ebbe82", "e18488e185abe186b1"],
+ ["ebbe82", "ebbdb8e186b1"],
+ ["ebbe83", "e18488e185abe186b2"],
+ ["ebbe83", "ebbdb8e186b2"],
+ ["ebbe84", "e18488e185abe186b3"],
+ ["ebbe84", "ebbdb8e186b3"],
+ ["ebbe85", "e18488e185abe186b4"],
+ ["ebbe85", "ebbdb8e186b4"],
+ ["ebbe86", "e18488e185abe186b5"],
+ ["ebbe86", "ebbdb8e186b5"],
+ ["ebbe87", "e18488e185abe186b6"],
+ ["ebbe87", "ebbdb8e186b6"],
+ ["ebbe88", "e18488e185abe186b7"],
+ ["ebbe88", "ebbdb8e186b7"],
+ ["ebbe89", "e18488e185abe186b8"],
+ ["ebbe89", "ebbdb8e186b8"],
+ ["ebbe8a", "e18488e185abe186b9"],
+ ["ebbe8a", "ebbdb8e186b9"],
+ ["ebbe8b", "e18488e185abe186ba"],
+ ["ebbe8b", "ebbdb8e186ba"],
+ ["ebbe8c", "e18488e185abe186bb"],
+ ["ebbe8c", "ebbdb8e186bb"],
+ ["ebbe8d", "e18488e185abe186bc"],
+ ["ebbe8d", "ebbdb8e186bc"],
+ ["ebbe8e", "e18488e185abe186bd"],
+ ["ebbe8e", "ebbdb8e186bd"],
+ ["ebbe8f", "e18488e185abe186be"],
+ ["ebbe8f", "ebbdb8e186be"],
+ ["ebbe90", "e18488e185abe186bf"],
+ ["ebbe90", "ebbdb8e186bf"],
+ ["ebbe91", "e18488e185abe18780"],
+ ["ebbe91", "ebbdb8e18780"],
+ ["ebbe92", "e18488e185abe18781"],
+ ["ebbe92", "ebbdb8e18781"],
+ ["ebbe93", "e18488e185abe18782"],
+ ["ebbe93", "ebbdb8e18782"],
+ ["ebbe94", "e18488e185ac"],
+ ["ebbe95", "e18488e185ace186a8"],
+ ["ebbe95", "ebbe94e186a8"],
+ ["ebbe96", "e18488e185ace186a9"],
+ ["ebbe96", "ebbe94e186a9"],
+ ["ebbe97", "e18488e185ace186aa"],
+ ["ebbe97", "ebbe94e186aa"],
+ ["ebbe98", "e18488e185ace186ab"],
+ ["ebbe98", "ebbe94e186ab"],
+ ["ebbe99", "e18488e185ace186ac"],
+ ["ebbe99", "ebbe94e186ac"],
+ ["ebbe9a", "e18488e185ace186ad"],
+ ["ebbe9a", "ebbe94e186ad"],
+ ["ebbe9b", "e18488e185ace186ae"],
+ ["ebbe9b", "ebbe94e186ae"],
+ ["ebbe9c", "e18488e185ace186af"],
+ ["ebbe9c", "ebbe94e186af"],
+ ["ebbe9d", "e18488e185ace186b0"],
+ ["ebbe9d", "ebbe94e186b0"],
+ ["ebbe9e", "e18488e185ace186b1"],
+ ["ebbe9e", "ebbe94e186b1"],
+ ["ebbe9f", "e18488e185ace186b2"],
+ ["ebbe9f", "ebbe94e186b2"],
+ ["ebbea0", "e18488e185ace186b3"],
+ ["ebbea0", "ebbe94e186b3"],
+ ["ebbea1", "e18488e185ace186b4"],
+ ["ebbea1", "ebbe94e186b4"],
+ ["ebbea2", "e18488e185ace186b5"],
+ ["ebbea2", "ebbe94e186b5"],
+ ["ebbea3", "e18488e185ace186b6"],
+ ["ebbea3", "ebbe94e186b6"],
+ ["ebbea4", "e18488e185ace186b7"],
+ ["ebbea4", "ebbe94e186b7"],
+ ["ebbea5", "e18488e185ace186b8"],
+ ["ebbea5", "ebbe94e186b8"],
+ ["ebbea6", "e18488e185ace186b9"],
+ ["ebbea6", "ebbe94e186b9"],
+ ["ebbea7", "e18488e185ace186ba"],
+ ["ebbea7", "ebbe94e186ba"],
+ ["ebbea8", "e18488e185ace186bb"],
+ ["ebbea8", "ebbe94e186bb"],
+ ["ebbea9", "e18488e185ace186bc"],
+ ["ebbea9", "ebbe94e186bc"],
+ ["ebbeaa", "e18488e185ace186bd"],
+ ["ebbeaa", "ebbe94e186bd"],
+ ["ebbeab", "e18488e185ace186be"],
+ ["ebbeab", "ebbe94e186be"],
+ ["ebbeac", "e18488e185ace186bf"],
+ ["ebbeac", "ebbe94e186bf"],
+ ["ebbead", "e18488e185ace18780"],
+ ["ebbead", "ebbe94e18780"],
+ ["ebbeae", "e18488e185ace18781"],
+ ["ebbeae", "ebbe94e18781"],
+ ["ebbeaf", "e18488e185ace18782"],
+ ["ebbeaf", "ebbe94e18782"],
+ ["ebbeb0", "e18488e185ad"],
+ ["ebbeb1", "e18488e185ade186a8"],
+ ["ebbeb1", "ebbeb0e186a8"],
+ ["ebbeb2", "e18488e185ade186a9"],
+ ["ebbeb2", "ebbeb0e186a9"],
+ ["ebbeb3", "e18488e185ade186aa"],
+ ["ebbeb3", "ebbeb0e186aa"],
+ ["ebbeb4", "e18488e185ade186ab"],
+ ["ebbeb4", "ebbeb0e186ab"],
+ ["ebbeb5", "e18488e185ade186ac"],
+ ["ebbeb5", "ebbeb0e186ac"],
+ ["ebbeb6", "e18488e185ade186ad"],
+ ["ebbeb6", "ebbeb0e186ad"],
+ ["ebbeb7", "e18488e185ade186ae"],
+ ["ebbeb7", "ebbeb0e186ae"],
+ ["ebbeb8", "e18488e185ade186af"],
+ ["ebbeb8", "ebbeb0e186af"],
+ ["ebbeb9", "e18488e185ade186b0"],
+ ["ebbeb9", "ebbeb0e186b0"],
+ ["ebbeba", "e18488e185ade186b1"],
+ ["ebbeba", "ebbeb0e186b1"],
+ ["ebbebb", "e18488e185ade186b2"],
+ ["ebbebb", "ebbeb0e186b2"],
+ ["ebbebc", "e18488e185ade186b3"],
+ ["ebbebc", "ebbeb0e186b3"],
+ ["ebbebd", "e18488e185ade186b4"],
+ ["ebbebd", "ebbeb0e186b4"],
+ ["ebbebe", "e18488e185ade186b5"],
+ ["ebbebe", "ebbeb0e186b5"],
+ ["ebbebf", "e18488e185ade186b6"],
+ ["ebbebf", "ebbeb0e186b6"],
+ ["ebbf80", "e18488e185ade186b7"],
+ ["ebbf80", "ebbeb0e186b7"],
+ ["ebbf81", "e18488e185ade186b8"],
+ ["ebbf81", "ebbeb0e186b8"],
+ ["ebbf82", "e18488e185ade186b9"],
+ ["ebbf82", "ebbeb0e186b9"],
+ ["ebbf83", "e18488e185ade186ba"],
+ ["ebbf83", "ebbeb0e186ba"],
+ ["ebbf84", "e18488e185ade186bb"],
+ ["ebbf84", "ebbeb0e186bb"],
+ ["ebbf85", "e18488e185ade186bc"],
+ ["ebbf85", "ebbeb0e186bc"],
+ ["ebbf86", "e18488e185ade186bd"],
+ ["ebbf86", "ebbeb0e186bd"],
+ ["ebbf87", "e18488e185ade186be"],
+ ["ebbf87", "ebbeb0e186be"],
+ ["ebbf88", "e18488e185ade186bf"],
+ ["ebbf88", "ebbeb0e186bf"],
+ ["ebbf89", "e18488e185ade18780"],
+ ["ebbf89", "ebbeb0e18780"],
+ ["ebbf8a", "e18488e185ade18781"],
+ ["ebbf8a", "ebbeb0e18781"],
+ ["ebbf8b", "e18488e185ade18782"],
+ ["ebbf8b", "ebbeb0e18782"],
+ ["ebbf8c", "e18488e185ae"],
+ ["ebbf8d", "e18488e185aee186a8"],
+ ["ebbf8d", "ebbf8ce186a8"],
+ ["ebbf8e", "e18488e185aee186a9"],
+ ["ebbf8e", "ebbf8ce186a9"],
+ ["ebbf8f", "e18488e185aee186aa"],
+ ["ebbf8f", "ebbf8ce186aa"],
+ ["ebbf90", "e18488e185aee186ab"],
+ ["ebbf90", "ebbf8ce186ab"],
+ ["ebbf91", "e18488e185aee186ac"],
+ ["ebbf91", "ebbf8ce186ac"],
+ ["ebbf92", "e18488e185aee186ad"],
+ ["ebbf92", "ebbf8ce186ad"],
+ ["ebbf93", "e18488e185aee186ae"],
+ ["ebbf93", "ebbf8ce186ae"],
+ ["ebbf94", "e18488e185aee186af"],
+ ["ebbf94", "ebbf8ce186af"],
+ ["ebbf95", "e18488e185aee186b0"],
+ ["ebbf95", "ebbf8ce186b0"],
+ ["ebbf96", "e18488e185aee186b1"],
+ ["ebbf96", "ebbf8ce186b1"],
+ ["ebbf97", "e18488e185aee186b2"],
+ ["ebbf97", "ebbf8ce186b2"],
+ ["ebbf98", "e18488e185aee186b3"],
+ ["ebbf98", "ebbf8ce186b3"],
+ ["ebbf99", "e18488e185aee186b4"],
+ ["ebbf99", "ebbf8ce186b4"],
+ ["ebbf9a", "e18488e185aee186b5"],
+ ["ebbf9a", "ebbf8ce186b5"],
+ ["ebbf9b", "e18488e185aee186b6"],
+ ["ebbf9b", "ebbf8ce186b6"],
+ ["ebbf9c", "e18488e185aee186b7"],
+ ["ebbf9c", "ebbf8ce186b7"],
+ ["ebbf9d", "e18488e185aee186b8"],
+ ["ebbf9d", "ebbf8ce186b8"],
+ ["ebbf9e", "e18488e185aee186b9"],
+ ["ebbf9e", "ebbf8ce186b9"],
+ ["ebbf9f", "e18488e185aee186ba"],
+ ["ebbf9f", "ebbf8ce186ba"],
+ ["ebbfa0", "e18488e185aee186bb"],
+ ["ebbfa0", "ebbf8ce186bb"],
+ ["ebbfa1", "e18488e185aee186bc"],
+ ["ebbfa1", "ebbf8ce186bc"],
+ ["ebbfa2", "e18488e185aee186bd"],
+ ["ebbfa2", "ebbf8ce186bd"],
+ ["ebbfa3", "e18488e185aee186be"],
+ ["ebbfa3", "ebbf8ce186be"],
+ ["ebbfa4", "e18488e185aee186bf"],
+ ["ebbfa4", "ebbf8ce186bf"],
+ ["ebbfa5", "e18488e185aee18780"],
+ ["ebbfa5", "ebbf8ce18780"],
+ ["ebbfa6", "e18488e185aee18781"],
+ ["ebbfa6", "ebbf8ce18781"],
+ ["ebbfa7", "e18488e185aee18782"],
+ ["ebbfa7", "ebbf8ce18782"],
+ ["ebbfa8", "e18488e185af"],
+ ["ebbfa9", "e18488e185afe186a8"],
+ ["ebbfa9", "ebbfa8e186a8"],
+ ["ebbfaa", "e18488e185afe186a9"],
+ ["ebbfaa", "ebbfa8e186a9"],
+ ["ebbfab", "e18488e185afe186aa"],
+ ["ebbfab", "ebbfa8e186aa"],
+ ["ebbfac", "e18488e185afe186ab"],
+ ["ebbfac", "ebbfa8e186ab"],
+ ["ebbfad", "e18488e185afe186ac"],
+ ["ebbfad", "ebbfa8e186ac"],
+ ["ebbfae", "e18488e185afe186ad"],
+ ["ebbfae", "ebbfa8e186ad"],
+ ["ebbfaf", "e18488e185afe186ae"],
+ ["ebbfaf", "ebbfa8e186ae"],
+ ["ebbfb0", "e18488e185afe186af"],
+ ["ebbfb0", "ebbfa8e186af"],
+ ["ebbfb1", "e18488e185afe186b0"],
+ ["ebbfb1", "ebbfa8e186b0"],
+ ["ebbfb2", "e18488e185afe186b1"],
+ ["ebbfb2", "ebbfa8e186b1"],
+ ["ebbfb3", "e18488e185afe186b2"],
+ ["ebbfb3", "ebbfa8e186b2"],
+ ["ebbfb4", "e18488e185afe186b3"],
+ ["ebbfb4", "ebbfa8e186b3"],
+ ["ebbfb5", "e18488e185afe186b4"],
+ ["ebbfb5", "ebbfa8e186b4"],
+ ["ebbfb6", "e18488e185afe186b5"],
+ ["ebbfb6", "ebbfa8e186b5"],
+ ["ebbfb7", "e18488e185afe186b6"],
+ ["ebbfb7", "ebbfa8e186b6"],
+ ["ebbfb8", "e18488e185afe186b7"],
+ ["ebbfb8", "ebbfa8e186b7"],
+ ["ebbfb9", "e18488e185afe186b8"],
+ ["ebbfb9", "ebbfa8e186b8"],
+ ["ebbfba", "e18488e185afe186b9"],
+ ["ebbfba", "ebbfa8e186b9"],
+ ["ebbfbb", "e18488e185afe186ba"],
+ ["ebbfbb", "ebbfa8e186ba"],
+ ["ebbfbc", "e18488e185afe186bb"],
+ ["ebbfbc", "ebbfa8e186bb"],
+ ["ebbfbd", "e18488e185afe186bc"],
+ ["ebbfbd", "ebbfa8e186bc"],
+ ["ebbfbe", "e18488e185afe186bd"],
+ ["ebbfbe", "ebbfa8e186bd"],
+ ["ebbfbf", "e18488e185afe186be"],
+ ["ebbfbf", "ebbfa8e186be"],
+ ["ec8080", "e18488e185afe186bf"],
+ ["ec8080", "ebbfa8e186bf"],
+ ["ec8081", "e18488e185afe18780"],
+ ["ec8081", "ebbfa8e18780"],
+ ["ec8082", "e18488e185afe18781"],
+ ["ec8082", "ebbfa8e18781"],
+ ["ec8083", "e18488e185afe18782"],
+ ["ec8083", "ebbfa8e18782"],
+ ["ec8084", "e18488e185b0"],
+ ["ec8085", "e18488e185b0e186a8"],
+ ["ec8085", "ec8084e186a8"],
+ ["ec8086", "e18488e185b0e186a9"],
+ ["ec8086", "ec8084e186a9"],
+ ["ec8087", "e18488e185b0e186aa"],
+ ["ec8087", "ec8084e186aa"],
+ ["ec8088", "e18488e185b0e186ab"],
+ ["ec8088", "ec8084e186ab"],
+ ["ec8089", "e18488e185b0e186ac"],
+ ["ec8089", "ec8084e186ac"],
+ ["ec808a", "e18488e185b0e186ad"],
+ ["ec808a", "ec8084e186ad"],
+ ["ec808b", "e18488e185b0e186ae"],
+ ["ec808b", "ec8084e186ae"],
+ ["ec808c", "e18488e185b0e186af"],
+ ["ec808c", "ec8084e186af"],
+ ["ec808d", "e18488e185b0e186b0"],
+ ["ec808d", "ec8084e186b0"],
+ ["ec808e", "e18488e185b0e186b1"],
+ ["ec808e", "ec8084e186b1"],
+ ["ec808f", "e18488e185b0e186b2"],
+ ["ec808f", "ec8084e186b2"],
+ ["ec8090", "e18488e185b0e186b3"],
+ ["ec8090", "ec8084e186b3"],
+ ["ec8091", "e18488e185b0e186b4"],
+ ["ec8091", "ec8084e186b4"],
+ ["ec8092", "e18488e185b0e186b5"],
+ ["ec8092", "ec8084e186b5"],
+ ["ec8093", "e18488e185b0e186b6"],
+ ["ec8093", "ec8084e186b6"],
+ ["ec8094", "e18488e185b0e186b7"],
+ ["ec8094", "ec8084e186b7"],
+ ["ec8095", "e18488e185b0e186b8"],
+ ["ec8095", "ec8084e186b8"],
+ ["ec8096", "e18488e185b0e186b9"],
+ ["ec8096", "ec8084e186b9"],
+ ["ec8097", "e18488e185b0e186ba"],
+ ["ec8097", "ec8084e186ba"],
+ ["ec8098", "e18488e185b0e186bb"],
+ ["ec8098", "ec8084e186bb"],
+ ["ec8099", "e18488e185b0e186bc"],
+ ["ec8099", "ec8084e186bc"],
+ ["ec809a", "e18488e185b0e186bd"],
+ ["ec809a", "ec8084e186bd"],
+ ["ec809b", "e18488e185b0e186be"],
+ ["ec809b", "ec8084e186be"],
+ ["ec809c", "e18488e185b0e186bf"],
+ ["ec809c", "ec8084e186bf"],
+ ["ec809d", "e18488e185b0e18780"],
+ ["ec809d", "ec8084e18780"],
+ ["ec809e", "e18488e185b0e18781"],
+ ["ec809e", "ec8084e18781"],
+ ["ec809f", "e18488e185b0e18782"],
+ ["ec809f", "ec8084e18782"],
+ ["ec80a0", "e18488e185b1"],
+ ["ec80a1", "e18488e185b1e186a8"],
+ ["ec80a1", "ec80a0e186a8"],
+ ["ec80a2", "e18488e185b1e186a9"],
+ ["ec80a2", "ec80a0e186a9"],
+ ["ec80a3", "e18488e185b1e186aa"],
+ ["ec80a3", "ec80a0e186aa"],
+ ["ec80a4", "e18488e185b1e186ab"],
+ ["ec80a4", "ec80a0e186ab"],
+ ["ec80a5", "e18488e185b1e186ac"],
+ ["ec80a5", "ec80a0e186ac"],
+ ["ec80a6", "e18488e185b1e186ad"],
+ ["ec80a6", "ec80a0e186ad"],
+ ["ec80a7", "e18488e185b1e186ae"],
+ ["ec80a7", "ec80a0e186ae"],
+ ["ec80a8", "e18488e185b1e186af"],
+ ["ec80a8", "ec80a0e186af"],
+ ["ec80a9", "e18488e185b1e186b0"],
+ ["ec80a9", "ec80a0e186b0"],
+ ["ec80aa", "e18488e185b1e186b1"],
+ ["ec80aa", "ec80a0e186b1"],
+ ["ec80ab", "e18488e185b1e186b2"],
+ ["ec80ab", "ec80a0e186b2"],
+ ["ec80ac", "e18488e185b1e186b3"],
+ ["ec80ac", "ec80a0e186b3"],
+ ["ec80ad", "e18488e185b1e186b4"],
+ ["ec80ad", "ec80a0e186b4"],
+ ["ec80ae", "e18488e185b1e186b5"],
+ ["ec80ae", "ec80a0e186b5"],
+ ["ec80af", "e18488e185b1e186b6"],
+ ["ec80af", "ec80a0e186b6"],
+ ["ec80b0", "e18488e185b1e186b7"],
+ ["ec80b0", "ec80a0e186b7"],
+ ["ec80b1", "e18488e185b1e186b8"],
+ ["ec80b1", "ec80a0e186b8"],
+ ["ec80b2", "e18488e185b1e186b9"],
+ ["ec80b2", "ec80a0e186b9"],
+ ["ec80b3", "e18488e185b1e186ba"],
+ ["ec80b3", "ec80a0e186ba"],
+ ["ec80b4", "e18488e185b1e186bb"],
+ ["ec80b4", "ec80a0e186bb"],
+ ["ec80b5", "e18488e185b1e186bc"],
+ ["ec80b5", "ec80a0e186bc"],
+ ["ec80b6", "e18488e185b1e186bd"],
+ ["ec80b6", "ec80a0e186bd"],
+ ["ec80b7", "e18488e185b1e186be"],
+ ["ec80b7", "ec80a0e186be"],
+ ["ec80b8", "e18488e185b1e186bf"],
+ ["ec80b8", "ec80a0e186bf"],
+ ["ec80b9", "e18488e185b1e18780"],
+ ["ec80b9", "ec80a0e18780"],
+ ["ec80ba", "e18488e185b1e18781"],
+ ["ec80ba", "ec80a0e18781"],
+ ["ec80bb", "e18488e185b1e18782"],
+ ["ec80bb", "ec80a0e18782"],
+ ["ec80bc", "e18488e185b2"],
+ ["ec80bd", "e18488e185b2e186a8"],
+ ["ec80bd", "ec80bce186a8"],
+ ["ec80be", "e18488e185b2e186a9"],
+ ["ec80be", "ec80bce186a9"],
+ ["ec80bf", "e18488e185b2e186aa"],
+ ["ec80bf", "ec80bce186aa"],
+ ["ec8180", "e18488e185b2e186ab"],
+ ["ec8180", "ec80bce186ab"],
+ ["ec8181", "e18488e185b2e186ac"],
+ ["ec8181", "ec80bce186ac"],
+ ["ec8182", "e18488e185b2e186ad"],
+ ["ec8182", "ec80bce186ad"],
+ ["ec8183", "e18488e185b2e186ae"],
+ ["ec8183", "ec80bce186ae"],
+ ["ec8184", "e18488e185b2e186af"],
+ ["ec8184", "ec80bce186af"],
+ ["ec8185", "e18488e185b2e186b0"],
+ ["ec8185", "ec80bce186b0"],
+ ["ec8186", "e18488e185b2e186b1"],
+ ["ec8186", "ec80bce186b1"],
+ ["ec8187", "e18488e185b2e186b2"],
+ ["ec8187", "ec80bce186b2"],
+ ["ec8188", "e18488e185b2e186b3"],
+ ["ec8188", "ec80bce186b3"],
+ ["ec8189", "e18488e185b2e186b4"],
+ ["ec8189", "ec80bce186b4"],
+ ["ec818a", "e18488e185b2e186b5"],
+ ["ec818a", "ec80bce186b5"],
+ ["ec818b", "e18488e185b2e186b6"],
+ ["ec818b", "ec80bce186b6"],
+ ["ec818c", "e18488e185b2e186b7"],
+ ["ec818c", "ec80bce186b7"],
+ ["ec818d", "e18488e185b2e186b8"],
+ ["ec818d", "ec80bce186b8"],
+ ["ec818e", "e18488e185b2e186b9"],
+ ["ec818e", "ec80bce186b9"],
+ ["ec818f", "e18488e185b2e186ba"],
+ ["ec818f", "ec80bce186ba"],
+ ["ec8190", "e18488e185b2e186bb"],
+ ["ec8190", "ec80bce186bb"],
+ ["ec8191", "e18488e185b2e186bc"],
+ ["ec8191", "ec80bce186bc"],
+ ["ec8192", "e18488e185b2e186bd"],
+ ["ec8192", "ec80bce186bd"],
+ ["ec8193", "e18488e185b2e186be"],
+ ["ec8193", "ec80bce186be"],
+ ["ec8194", "e18488e185b2e186bf"],
+ ["ec8194", "ec80bce186bf"],
+ ["ec8195", "e18488e185b2e18780"],
+ ["ec8195", "ec80bce18780"],
+ ["ec8196", "e18488e185b2e18781"],
+ ["ec8196", "ec80bce18781"],
+ ["ec8197", "e18488e185b2e18782"],
+ ["ec8197", "ec80bce18782"],
+ ["ec8198", "e18488e185b3"],
+ ["ec8199", "e18488e185b3e186a8"],
+ ["ec8199", "ec8198e186a8"],
+ ["ec819a", "e18488e185b3e186a9"],
+ ["ec819a", "ec8198e186a9"],
+ ["ec819b", "e18488e185b3e186aa"],
+ ["ec819b", "ec8198e186aa"],
+ ["ec819c", "e18488e185b3e186ab"],
+ ["ec819c", "ec8198e186ab"],
+ ["ec819d", "e18488e185b3e186ac"],
+ ["ec819d", "ec8198e186ac"],
+ ["ec819e", "e18488e185b3e186ad"],
+ ["ec819e", "ec8198e186ad"],
+ ["ec819f", "e18488e185b3e186ae"],
+ ["ec819f", "ec8198e186ae"],
+ ["ec81a0", "e18488e185b3e186af"],
+ ["ec81a0", "ec8198e186af"],
+ ["ec81a1", "e18488e185b3e186b0"],
+ ["ec81a1", "ec8198e186b0"],
+ ["ec81a2", "e18488e185b3e186b1"],
+ ["ec81a2", "ec8198e186b1"],
+ ["ec81a3", "e18488e185b3e186b2"],
+ ["ec81a3", "ec8198e186b2"],
+ ["ec81a4", "e18488e185b3e186b3"],
+ ["ec81a4", "ec8198e186b3"],
+ ["ec81a5", "e18488e185b3e186b4"],
+ ["ec81a5", "ec8198e186b4"],
+ ["ec81a6", "e18488e185b3e186b5"],
+ ["ec81a6", "ec8198e186b5"],
+ ["ec81a7", "e18488e185b3e186b6"],
+ ["ec81a7", "ec8198e186b6"],
+ ["ec81a8", "e18488e185b3e186b7"],
+ ["ec81a8", "ec8198e186b7"],
+ ["ec81a9", "e18488e185b3e186b8"],
+ ["ec81a9", "ec8198e186b8"],
+ ["ec81aa", "e18488e185b3e186b9"],
+ ["ec81aa", "ec8198e186b9"],
+ ["ec81ab", "e18488e185b3e186ba"],
+ ["ec81ab", "ec8198e186ba"],
+ ["ec81ac", "e18488e185b3e186bb"],
+ ["ec81ac", "ec8198e186bb"],
+ ["ec81ad", "e18488e185b3e186bc"],
+ ["ec81ad", "ec8198e186bc"],
+ ["ec81ae", "e18488e185b3e186bd"],
+ ["ec81ae", "ec8198e186bd"],
+ ["ec81af", "e18488e185b3e186be"],
+ ["ec81af", "ec8198e186be"],
+ ["ec81b0", "e18488e185b3e186bf"],
+ ["ec81b0", "ec8198e186bf"],
+ ["ec81b1", "e18488e185b3e18780"],
+ ["ec81b1", "ec8198e18780"],
+ ["ec81b2", "e18488e185b3e18781"],
+ ["ec81b2", "ec8198e18781"],
+ ["ec81b3", "e18488e185b3e18782"],
+ ["ec81b3", "ec8198e18782"],
+ ["ec81b4", "e18488e185b4"],
+ ["ec81b5", "e18488e185b4e186a8"],
+ ["ec81b5", "ec81b4e186a8"],
+ ["ec81b6", "e18488e185b4e186a9"],
+ ["ec81b6", "ec81b4e186a9"],
+ ["ec81b7", "e18488e185b4e186aa"],
+ ["ec81b7", "ec81b4e186aa"],
+ ["ec81b8", "e18488e185b4e186ab"],
+ ["ec81b8", "ec81b4e186ab"],
+ ["ec81b9", "e18488e185b4e186ac"],
+ ["ec81b9", "ec81b4e186ac"],
+ ["ec81ba", "e18488e185b4e186ad"],
+ ["ec81ba", "ec81b4e186ad"],
+ ["ec81bb", "e18488e185b4e186ae"],
+ ["ec81bb", "ec81b4e186ae"],
+ ["ec81bc", "e18488e185b4e186af"],
+ ["ec81bc", "ec81b4e186af"],
+ ["ec81bd", "e18488e185b4e186b0"],
+ ["ec81bd", "ec81b4e186b0"],
+ ["ec81be", "e18488e185b4e186b1"],
+ ["ec81be", "ec81b4e186b1"],
+ ["ec81bf", "e18488e185b4e186b2"],
+ ["ec81bf", "ec81b4e186b2"],
+ ["ec8280", "e18488e185b4e186b3"],
+ ["ec8280", "ec81b4e186b3"],
+ ["ec8281", "e18488e185b4e186b4"],
+ ["ec8281", "ec81b4e186b4"],
+ ["ec8282", "e18488e185b4e186b5"],
+ ["ec8282", "ec81b4e186b5"],
+ ["ec8283", "e18488e185b4e186b6"],
+ ["ec8283", "ec81b4e186b6"],
+ ["ec8284", "e18488e185b4e186b7"],
+ ["ec8284", "ec81b4e186b7"],
+ ["ec8285", "e18488e185b4e186b8"],
+ ["ec8285", "ec81b4e186b8"],
+ ["ec8286", "e18488e185b4e186b9"],
+ ["ec8286", "ec81b4e186b9"],
+ ["ec8287", "e18488e185b4e186ba"],
+ ["ec8287", "ec81b4e186ba"],
+ ["ec8288", "e18488e185b4e186bb"],
+ ["ec8288", "ec81b4e186bb"],
+ ["ec8289", "e18488e185b4e186bc"],
+ ["ec8289", "ec81b4e186bc"],
+ ["ec828a", "e18488e185b4e186bd"],
+ ["ec828a", "ec81b4e186bd"],
+ ["ec828b", "e18488e185b4e186be"],
+ ["ec828b", "ec81b4e186be"],
+ ["ec828c", "e18488e185b4e186bf"],
+ ["ec828c", "ec81b4e186bf"],
+ ["ec828d", "e18488e185b4e18780"],
+ ["ec828d", "ec81b4e18780"],
+ ["ec828e", "e18488e185b4e18781"],
+ ["ec828e", "ec81b4e18781"],
+ ["ec828f", "e18488e185b4e18782"],
+ ["ec828f", "ec81b4e18782"],
+ ["ec8290", "e18488e185b5"],
+ ["ec8291", "e18488e185b5e186a8"],
+ ["ec8291", "ec8290e186a8"],
+ ["ec8292", "e18488e185b5e186a9"],
+ ["ec8292", "ec8290e186a9"],
+ ["ec8293", "e18488e185b5e186aa"],
+ ["ec8293", "ec8290e186aa"],
+ ["ec8294", "e18488e185b5e186ab"],
+ ["ec8294", "ec8290e186ab"],
+ ["ec8295", "e18488e185b5e186ac"],
+ ["ec8295", "ec8290e186ac"],
+ ["ec8296", "e18488e185b5e186ad"],
+ ["ec8296", "ec8290e186ad"],
+ ["ec8297", "e18488e185b5e186ae"],
+ ["ec8297", "ec8290e186ae"],
+ ["ec8298", "e18488e185b5e186af"],
+ ["ec8298", "ec8290e186af"],
+ ["ec8299", "e18488e185b5e186b0"],
+ ["ec8299", "ec8290e186b0"],
+ ["ec829a", "e18488e185b5e186b1"],
+ ["ec829a", "ec8290e186b1"],
+ ["ec829b", "e18488e185b5e186b2"],
+ ["ec829b", "ec8290e186b2"],
+ ["ec829c", "e18488e185b5e186b3"],
+ ["ec829c", "ec8290e186b3"],
+ ["ec829d", "e18488e185b5e186b4"],
+ ["ec829d", "ec8290e186b4"],
+ ["ec829e", "e18488e185b5e186b5"],
+ ["ec829e", "ec8290e186b5"],
+ ["ec829f", "e18488e185b5e186b6"],
+ ["ec829f", "ec8290e186b6"],
+ ["ec82a0", "e18488e185b5e186b7"],
+ ["ec82a0", "ec8290e186b7"],
+ ["ec82a1", "e18488e185b5e186b8"],
+ ["ec82a1", "ec8290e186b8"],
+ ["ec82a2", "e18488e185b5e186b9"],
+ ["ec82a2", "ec8290e186b9"],
+ ["ec82a3", "e18488e185b5e186ba"],
+ ["ec82a3", "ec8290e186ba"],
+ ["ec82a4", "e18488e185b5e186bb"],
+ ["ec82a4", "ec8290e186bb"],
+ ["ec82a5", "e18488e185b5e186bc"],
+ ["ec82a5", "ec8290e186bc"],
+ ["ec82a6", "e18488e185b5e186bd"],
+ ["ec82a6", "ec8290e186bd"],
+ ["ec82a7", "e18488e185b5e186be"],
+ ["ec82a7", "ec8290e186be"],
+ ["ec82a8", "e18488e185b5e186bf"],
+ ["ec82a8", "ec8290e186bf"],
+ ["ec82a9", "e18488e185b5e18780"],
+ ["ec82a9", "ec8290e18780"],
+ ["ec82aa", "e18488e185b5e18781"],
+ ["ec82aa", "ec8290e18781"],
+ ["ec82ab", "e18488e185b5e18782"],
+ ["ec82ab", "ec8290e18782"],
+ ["ec82ac", "e18489e185a1"],
+ ["ec82ad", "e18489e185a1e186a8"],
+ ["ec82ad", "ec82ace186a8"],
+ ["ec82ae", "e18489e185a1e186a9"],
+ ["ec82ae", "ec82ace186a9"],
+ ["ec82af", "e18489e185a1e186aa"],
+ ["ec82af", "ec82ace186aa"],
+ ["ec82b0", "e18489e185a1e186ab"],
+ ["ec82b0", "ec82ace186ab"],
+ ["ec82b1", "e18489e185a1e186ac"],
+ ["ec82b1", "ec82ace186ac"],
+ ["ec82b2", "e18489e185a1e186ad"],
+ ["ec82b2", "ec82ace186ad"],
+ ["ec82b3", "e18489e185a1e186ae"],
+ ["ec82b3", "ec82ace186ae"],
+ ["ec82b4", "e18489e185a1e186af"],
+ ["ec82b4", "ec82ace186af"],
+ ["ec82b5", "e18489e185a1e186b0"],
+ ["ec82b5", "ec82ace186b0"],
+ ["ec82b6", "e18489e185a1e186b1"],
+ ["ec82b6", "ec82ace186b1"],
+ ["ec82b7", "e18489e185a1e186b2"],
+ ["ec82b7", "ec82ace186b2"],
+ ["ec82b8", "e18489e185a1e186b3"],
+ ["ec82b8", "ec82ace186b3"],
+ ["ec82b9", "e18489e185a1e186b4"],
+ ["ec82b9", "ec82ace186b4"],
+ ["ec82ba", "e18489e185a1e186b5"],
+ ["ec82ba", "ec82ace186b5"],
+ ["ec82bb", "e18489e185a1e186b6"],
+ ["ec82bb", "ec82ace186b6"],
+ ["ec82bc", "e18489e185a1e186b7"],
+ ["ec82bc", "ec82ace186b7"],
+ ["ec82bd", "e18489e185a1e186b8"],
+ ["ec82bd", "ec82ace186b8"],
+ ["ec82be", "e18489e185a1e186b9"],
+ ["ec82be", "ec82ace186b9"],
+ ["ec82bf", "e18489e185a1e186ba"],
+ ["ec82bf", "ec82ace186ba"],
+ ["ec8380", "e18489e185a1e186bb"],
+ ["ec8380", "ec82ace186bb"],
+ ["ec8381", "e18489e185a1e186bc"],
+ ["ec8381", "ec82ace186bc"],
+ ["ec8382", "e18489e185a1e186bd"],
+ ["ec8382", "ec82ace186bd"],
+ ["ec8383", "e18489e185a1e186be"],
+ ["ec8383", "ec82ace186be"],
+ ["ec8384", "e18489e185a1e186bf"],
+ ["ec8384", "ec82ace186bf"],
+ ["ec8385", "e18489e185a1e18780"],
+ ["ec8385", "ec82ace18780"],
+ ["ec8386", "e18489e185a1e18781"],
+ ["ec8386", "ec82ace18781"],
+ ["ec8387", "e18489e185a1e18782"],
+ ["ec8387", "ec82ace18782"],
+ ["ec8388", "e18489e185a2"],
+ ["ec8389", "e18489e185a2e186a8"],
+ ["ec8389", "ec8388e186a8"],
+ ["ec838a", "e18489e185a2e186a9"],
+ ["ec838a", "ec8388e186a9"],
+ ["ec838b", "e18489e185a2e186aa"],
+ ["ec838b", "ec8388e186aa"],
+ ["ec838c", "e18489e185a2e186ab"],
+ ["ec838c", "ec8388e186ab"],
+ ["ec838d", "e18489e185a2e186ac"],
+ ["ec838d", "ec8388e186ac"],
+ ["ec838e", "e18489e185a2e186ad"],
+ ["ec838e", "ec8388e186ad"],
+ ["ec838f", "e18489e185a2e186ae"],
+ ["ec838f", "ec8388e186ae"],
+ ["ec8390", "e18489e185a2e186af"],
+ ["ec8390", "ec8388e186af"],
+ ["ec8391", "e18489e185a2e186b0"],
+ ["ec8391", "ec8388e186b0"],
+ ["ec8392", "e18489e185a2e186b1"],
+ ["ec8392", "ec8388e186b1"],
+ ["ec8393", "e18489e185a2e186b2"],
+ ["ec8393", "ec8388e186b2"],
+ ["ec8394", "e18489e185a2e186b3"],
+ ["ec8394", "ec8388e186b3"],
+ ["ec8395", "e18489e185a2e186b4"],
+ ["ec8395", "ec8388e186b4"],
+ ["ec8396", "e18489e185a2e186b5"],
+ ["ec8396", "ec8388e186b5"],
+ ["ec8397", "e18489e185a2e186b6"],
+ ["ec8397", "ec8388e186b6"],
+ ["ec8398", "e18489e185a2e186b7"],
+ ["ec8398", "ec8388e186b7"],
+ ["ec8399", "e18489e185a2e186b8"],
+ ["ec8399", "ec8388e186b8"],
+ ["ec839a", "e18489e185a2e186b9"],
+ ["ec839a", "ec8388e186b9"],
+ ["ec839b", "e18489e185a2e186ba"],
+ ["ec839b", "ec8388e186ba"],
+ ["ec839c", "e18489e185a2e186bb"],
+ ["ec839c", "ec8388e186bb"],
+ ["ec839d", "e18489e185a2e186bc"],
+ ["ec839d", "ec8388e186bc"],
+ ["ec839e", "e18489e185a2e186bd"],
+ ["ec839e", "ec8388e186bd"],
+ ["ec839f", "e18489e185a2e186be"],
+ ["ec839f", "ec8388e186be"],
+ ["ec83a0", "e18489e185a2e186bf"],
+ ["ec83a0", "ec8388e186bf"],
+ ["ec83a1", "e18489e185a2e18780"],
+ ["ec83a1", "ec8388e18780"],
+ ["ec83a2", "e18489e185a2e18781"],
+ ["ec83a2", "ec8388e18781"],
+ ["ec83a3", "e18489e185a2e18782"],
+ ["ec83a3", "ec8388e18782"],
+ ["ec83a4", "e18489e185a3"],
+ ["ec83a5", "e18489e185a3e186a8"],
+ ["ec83a5", "ec83a4e186a8"],
+ ["ec83a6", "e18489e185a3e186a9"],
+ ["ec83a6", "ec83a4e186a9"],
+ ["ec83a7", "e18489e185a3e186aa"],
+ ["ec83a7", "ec83a4e186aa"],
+ ["ec83a8", "e18489e185a3e186ab"],
+ ["ec83a8", "ec83a4e186ab"],
+ ["ec83a9", "e18489e185a3e186ac"],
+ ["ec83a9", "ec83a4e186ac"],
+ ["ec83aa", "e18489e185a3e186ad"],
+ ["ec83aa", "ec83a4e186ad"],
+ ["ec83ab", "e18489e185a3e186ae"],
+ ["ec83ab", "ec83a4e186ae"],
+ ["ec83ac", "e18489e185a3e186af"],
+ ["ec83ac", "ec83a4e186af"],
+ ["ec83ad", "e18489e185a3e186b0"],
+ ["ec83ad", "ec83a4e186b0"],
+ ["ec83ae", "e18489e185a3e186b1"],
+ ["ec83ae", "ec83a4e186b1"],
+ ["ec83af", "e18489e185a3e186b2"],
+ ["ec83af", "ec83a4e186b2"],
+ ["ec83b0", "e18489e185a3e186b3"],
+ ["ec83b0", "ec83a4e186b3"],
+ ["ec83b1", "e18489e185a3e186b4"],
+ ["ec83b1", "ec83a4e186b4"],
+ ["ec83b2", "e18489e185a3e186b5"],
+ ["ec83b2", "ec83a4e186b5"],
+ ["ec83b3", "e18489e185a3e186b6"],
+ ["ec83b3", "ec83a4e186b6"],
+ ["ec83b4", "e18489e185a3e186b7"],
+ ["ec83b4", "ec83a4e186b7"],
+ ["ec83b5", "e18489e185a3e186b8"],
+ ["ec83b5", "ec83a4e186b8"],
+ ["ec83b6", "e18489e185a3e186b9"],
+ ["ec83b6", "ec83a4e186b9"],
+ ["ec83b7", "e18489e185a3e186ba"],
+ ["ec83b7", "ec83a4e186ba"],
+ ["ec83b8", "e18489e185a3e186bb"],
+ ["ec83b8", "ec83a4e186bb"],
+ ["ec83b9", "e18489e185a3e186bc"],
+ ["ec83b9", "ec83a4e186bc"],
+ ["ec83ba", "e18489e185a3e186bd"],
+ ["ec83ba", "ec83a4e186bd"],
+ ["ec83bb", "e18489e185a3e186be"],
+ ["ec83bb", "ec83a4e186be"],
+ ["ec83bc", "e18489e185a3e186bf"],
+ ["ec83bc", "ec83a4e186bf"],
+ ["ec83bd", "e18489e185a3e18780"],
+ ["ec83bd", "ec83a4e18780"],
+ ["ec83be", "e18489e185a3e18781"],
+ ["ec83be", "ec83a4e18781"],
+ ["ec83bf", "e18489e185a3e18782"],
+ ["ec83bf", "ec83a4e18782"],
+ ["ec8480", "e18489e185a4"],
+ ["ec8481", "e18489e185a4e186a8"],
+ ["ec8481", "ec8480e186a8"],
+ ["ec8482", "e18489e185a4e186a9"],
+ ["ec8482", "ec8480e186a9"],
+ ["ec8483", "e18489e185a4e186aa"],
+ ["ec8483", "ec8480e186aa"],
+ ["ec8484", "e18489e185a4e186ab"],
+ ["ec8484", "ec8480e186ab"],
+ ["ec8485", "e18489e185a4e186ac"],
+ ["ec8485", "ec8480e186ac"],
+ ["ec8486", "e18489e185a4e186ad"],
+ ["ec8486", "ec8480e186ad"],
+ ["ec8487", "e18489e185a4e186ae"],
+ ["ec8487", "ec8480e186ae"],
+ ["ec8488", "e18489e185a4e186af"],
+ ["ec8488", "ec8480e186af"],
+ ["ec8489", "e18489e185a4e186b0"],
+ ["ec8489", "ec8480e186b0"],
+ ["ec848a", "e18489e185a4e186b1"],
+ ["ec848a", "ec8480e186b1"],
+ ["ec848b", "e18489e185a4e186b2"],
+ ["ec848b", "ec8480e186b2"],
+ ["ec848c", "e18489e185a4e186b3"],
+ ["ec848c", "ec8480e186b3"],
+ ["ec848d", "e18489e185a4e186b4"],
+ ["ec848d", "ec8480e186b4"],
+ ["ec848e", "e18489e185a4e186b5"],
+ ["ec848e", "ec8480e186b5"],
+ ["ec848f", "e18489e185a4e186b6"],
+ ["ec848f", "ec8480e186b6"],
+ ["ec8490", "e18489e185a4e186b7"],
+ ["ec8490", "ec8480e186b7"],
+ ["ec8491", "e18489e185a4e186b8"],
+ ["ec8491", "ec8480e186b8"],
+ ["ec8492", "e18489e185a4e186b9"],
+ ["ec8492", "ec8480e186b9"],
+ ["ec8493", "e18489e185a4e186ba"],
+ ["ec8493", "ec8480e186ba"],
+ ["ec8494", "e18489e185a4e186bb"],
+ ["ec8494", "ec8480e186bb"],
+ ["ec8495", "e18489e185a4e186bc"],
+ ["ec8495", "ec8480e186bc"],
+ ["ec8496", "e18489e185a4e186bd"],
+ ["ec8496", "ec8480e186bd"],
+ ["ec8497", "e18489e185a4e186be"],
+ ["ec8497", "ec8480e186be"],
+ ["ec8498", "e18489e185a4e186bf"],
+ ["ec8498", "ec8480e186bf"],
+ ["ec8499", "e18489e185a4e18780"],
+ ["ec8499", "ec8480e18780"],
+ ["ec849a", "e18489e185a4e18781"],
+ ["ec849a", "ec8480e18781"],
+ ["ec849b", "e18489e185a4e18782"],
+ ["ec849b", "ec8480e18782"],
+ ["ec849c", "e18489e185a5"],
+ ["ec849d", "e18489e185a5e186a8"],
+ ["ec849d", "ec849ce186a8"],
+ ["ec849e", "e18489e185a5e186a9"],
+ ["ec849e", "ec849ce186a9"],
+ ["ec849f", "e18489e185a5e186aa"],
+ ["ec849f", "ec849ce186aa"],
+ ["ec84a0", "e18489e185a5e186ab"],
+ ["ec84a0", "ec849ce186ab"],
+ ["ec84a1", "e18489e185a5e186ac"],
+ ["ec84a1", "ec849ce186ac"],
+ ["ec84a2", "e18489e185a5e186ad"],
+ ["ec84a2", "ec849ce186ad"],
+ ["ec84a3", "e18489e185a5e186ae"],
+ ["ec84a3", "ec849ce186ae"],
+ ["ec84a4", "e18489e185a5e186af"],
+ ["ec84a4", "ec849ce186af"],
+ ["ec84a5", "e18489e185a5e186b0"],
+ ["ec84a5", "ec849ce186b0"],
+ ["ec84a6", "e18489e185a5e186b1"],
+ ["ec84a6", "ec849ce186b1"],
+ ["ec84a7", "e18489e185a5e186b2"],
+ ["ec84a7", "ec849ce186b2"],
+ ["ec84a8", "e18489e185a5e186b3"],
+ ["ec84a8", "ec849ce186b3"],
+ ["ec84a9", "e18489e185a5e186b4"],
+ ["ec84a9", "ec849ce186b4"],
+ ["ec84aa", "e18489e185a5e186b5"],
+ ["ec84aa", "ec849ce186b5"],
+ ["ec84ab", "e18489e185a5e186b6"],
+ ["ec84ab", "ec849ce186b6"],
+ ["ec84ac", "e18489e185a5e186b7"],
+ ["ec84ac", "ec849ce186b7"],
+ ["ec84ad", "e18489e185a5e186b8"],
+ ["ec84ad", "ec849ce186b8"],
+ ["ec84ae", "e18489e185a5e186b9"],
+ ["ec84ae", "ec849ce186b9"],
+ ["ec84af", "e18489e185a5e186ba"],
+ ["ec84af", "ec849ce186ba"],
+ ["ec84b0", "e18489e185a5e186bb"],
+ ["ec84b0", "ec849ce186bb"],
+ ["ec84b1", "e18489e185a5e186bc"],
+ ["ec84b1", "ec849ce186bc"],
+ ["ec84b2", "e18489e185a5e186bd"],
+ ["ec84b2", "ec849ce186bd"],
+ ["ec84b3", "e18489e185a5e186be"],
+ ["ec84b3", "ec849ce186be"],
+ ["ec84b4", "e18489e185a5e186bf"],
+ ["ec84b4", "ec849ce186bf"],
+ ["ec84b5", "e18489e185a5e18780"],
+ ["ec84b5", "ec849ce18780"],
+ ["ec84b6", "e18489e185a5e18781"],
+ ["ec84b6", "ec849ce18781"],
+ ["ec84b7", "e18489e185a5e18782"],
+ ["ec84b7", "ec849ce18782"],
+ ["ec84b8", "e18489e185a6"],
+ ["ec84b9", "e18489e185a6e186a8"],
+ ["ec84b9", "ec84b8e186a8"],
+ ["ec84ba", "e18489e185a6e186a9"],
+ ["ec84ba", "ec84b8e186a9"],
+ ["ec84bb", "e18489e185a6e186aa"],
+ ["ec84bb", "ec84b8e186aa"],
+ ["ec84bc", "e18489e185a6e186ab"],
+ ["ec84bc", "ec84b8e186ab"],
+ ["ec84bd", "e18489e185a6e186ac"],
+ ["ec84bd", "ec84b8e186ac"],
+ ["ec84be", "e18489e185a6e186ad"],
+ ["ec84be", "ec84b8e186ad"],
+ ["ec84bf", "e18489e185a6e186ae"],
+ ["ec84bf", "ec84b8e186ae"],
+ ["ec8580", "e18489e185a6e186af"],
+ ["ec8580", "ec84b8e186af"],
+ ["ec8581", "e18489e185a6e186b0"],
+ ["ec8581", "ec84b8e186b0"],
+ ["ec8582", "e18489e185a6e186b1"],
+ ["ec8582", "ec84b8e186b1"],
+ ["ec8583", "e18489e185a6e186b2"],
+ ["ec8583", "ec84b8e186b2"],
+ ["ec8584", "e18489e185a6e186b3"],
+ ["ec8584", "ec84b8e186b3"],
+ ["ec8585", "e18489e185a6e186b4"],
+ ["ec8585", "ec84b8e186b4"],
+ ["ec8586", "e18489e185a6e186b5"],
+ ["ec8586", "ec84b8e186b5"],
+ ["ec8587", "e18489e185a6e186b6"],
+ ["ec8587", "ec84b8e186b6"],
+ ["ec8588", "e18489e185a6e186b7"],
+ ["ec8588", "ec84b8e186b7"],
+ ["ec8589", "e18489e185a6e186b8"],
+ ["ec8589", "ec84b8e186b8"],
+ ["ec858a", "e18489e185a6e186b9"],
+ ["ec858a", "ec84b8e186b9"],
+ ["ec858b", "e18489e185a6e186ba"],
+ ["ec858b", "ec84b8e186ba"],
+ ["ec858c", "e18489e185a6e186bb"],
+ ["ec858c", "ec84b8e186bb"],
+ ["ec858d", "e18489e185a6e186bc"],
+ ["ec858d", "ec84b8e186bc"],
+ ["ec858e", "e18489e185a6e186bd"],
+ ["ec858e", "ec84b8e186bd"],
+ ["ec858f", "e18489e185a6e186be"],
+ ["ec858f", "ec84b8e186be"],
+ ["ec8590", "e18489e185a6e186bf"],
+ ["ec8590", "ec84b8e186bf"],
+ ["ec8591", "e18489e185a6e18780"],
+ ["ec8591", "ec84b8e18780"],
+ ["ec8592", "e18489e185a6e18781"],
+ ["ec8592", "ec84b8e18781"],
+ ["ec8593", "e18489e185a6e18782"],
+ ["ec8593", "ec84b8e18782"],
+ ["ec8594", "e18489e185a7"],
+ ["ec8595", "e18489e185a7e186a8"],
+ ["ec8595", "ec8594e186a8"],
+ ["ec8596", "e18489e185a7e186a9"],
+ ["ec8596", "ec8594e186a9"],
+ ["ec8597", "e18489e185a7e186aa"],
+ ["ec8597", "ec8594e186aa"],
+ ["ec8598", "e18489e185a7e186ab"],
+ ["ec8598", "ec8594e186ab"],
+ ["ec8599", "e18489e185a7e186ac"],
+ ["ec8599", "ec8594e186ac"],
+ ["ec859a", "e18489e185a7e186ad"],
+ ["ec859a", "ec8594e186ad"],
+ ["ec859b", "e18489e185a7e186ae"],
+ ["ec859b", "ec8594e186ae"],
+ ["ec859c", "e18489e185a7e186af"],
+ ["ec859c", "ec8594e186af"],
+ ["ec859d", "e18489e185a7e186b0"],
+ ["ec859d", "ec8594e186b0"],
+ ["ec859e", "e18489e185a7e186b1"],
+ ["ec859e", "ec8594e186b1"],
+ ["ec859f", "e18489e185a7e186b2"],
+ ["ec859f", "ec8594e186b2"],
+ ["ec85a0", "e18489e185a7e186b3"],
+ ["ec85a0", "ec8594e186b3"],
+ ["ec85a1", "e18489e185a7e186b4"],
+ ["ec85a1", "ec8594e186b4"],
+ ["ec85a2", "e18489e185a7e186b5"],
+ ["ec85a2", "ec8594e186b5"],
+ ["ec85a3", "e18489e185a7e186b6"],
+ ["ec85a3", "ec8594e186b6"],
+ ["ec85a4", "e18489e185a7e186b7"],
+ ["ec85a4", "ec8594e186b7"],
+ ["ec85a5", "e18489e185a7e186b8"],
+ ["ec85a5", "ec8594e186b8"],
+ ["ec85a6", "e18489e185a7e186b9"],
+ ["ec85a6", "ec8594e186b9"],
+ ["ec85a7", "e18489e185a7e186ba"],
+ ["ec85a7", "ec8594e186ba"],
+ ["ec85a8", "e18489e185a7e186bb"],
+ ["ec85a8", "ec8594e186bb"],
+ ["ec85a9", "e18489e185a7e186bc"],
+ ["ec85a9", "ec8594e186bc"],
+ ["ec85aa", "e18489e185a7e186bd"],
+ ["ec85aa", "ec8594e186bd"],
+ ["ec85ab", "e18489e185a7e186be"],
+ ["ec85ab", "ec8594e186be"],
+ ["ec85ac", "e18489e185a7e186bf"],
+ ["ec85ac", "ec8594e186bf"],
+ ["ec85ad", "e18489e185a7e18780"],
+ ["ec85ad", "ec8594e18780"],
+ ["ec85ae", "e18489e185a7e18781"],
+ ["ec85ae", "ec8594e18781"],
+ ["ec85af", "e18489e185a7e18782"],
+ ["ec85af", "ec8594e18782"],
+ ["ec85b0", "e18489e185a8"],
+ ["ec85b1", "e18489e185a8e186a8"],
+ ["ec85b1", "ec85b0e186a8"],
+ ["ec85b2", "e18489e185a8e186a9"],
+ ["ec85b2", "ec85b0e186a9"],
+ ["ec85b3", "e18489e185a8e186aa"],
+ ["ec85b3", "ec85b0e186aa"],
+ ["ec85b4", "e18489e185a8e186ab"],
+ ["ec85b4", "ec85b0e186ab"],
+ ["ec85b5", "e18489e185a8e186ac"],
+ ["ec85b5", "ec85b0e186ac"],
+ ["ec85b6", "e18489e185a8e186ad"],
+ ["ec85b6", "ec85b0e186ad"],
+ ["ec85b7", "e18489e185a8e186ae"],
+ ["ec85b7", "ec85b0e186ae"],
+ ["ec85b8", "e18489e185a8e186af"],
+ ["ec85b8", "ec85b0e186af"],
+ ["ec85b9", "e18489e185a8e186b0"],
+ ["ec85b9", "ec85b0e186b0"],
+ ["ec85ba", "e18489e185a8e186b1"],
+ ["ec85ba", "ec85b0e186b1"],
+ ["ec85bb", "e18489e185a8e186b2"],
+ ["ec85bb", "ec85b0e186b2"],
+ ["ec85bc", "e18489e185a8e186b3"],
+ ["ec85bc", "ec85b0e186b3"],
+ ["ec85bd", "e18489e185a8e186b4"],
+ ["ec85bd", "ec85b0e186b4"],
+ ["ec85be", "e18489e185a8e186b5"],
+ ["ec85be", "ec85b0e186b5"],
+ ["ec85bf", "e18489e185a8e186b6"],
+ ["ec85bf", "ec85b0e186b6"],
+ ["ec8680", "e18489e185a8e186b7"],
+ ["ec8680", "ec85b0e186b7"],
+ ["ec8681", "e18489e185a8e186b8"],
+ ["ec8681", "ec85b0e186b8"],
+ ["ec8682", "e18489e185a8e186b9"],
+ ["ec8682", "ec85b0e186b9"],
+ ["ec8683", "e18489e185a8e186ba"],
+ ["ec8683", "ec85b0e186ba"],
+ ["ec8684", "e18489e185a8e186bb"],
+ ["ec8684", "ec85b0e186bb"],
+ ["ec8685", "e18489e185a8e186bc"],
+ ["ec8685", "ec85b0e186bc"],
+ ["ec8686", "e18489e185a8e186bd"],
+ ["ec8686", "ec85b0e186bd"],
+ ["ec8687", "e18489e185a8e186be"],
+ ["ec8687", "ec85b0e186be"],
+ ["ec8688", "e18489e185a8e186bf"],
+ ["ec8688", "ec85b0e186bf"],
+ ["ec8689", "e18489e185a8e18780"],
+ ["ec8689", "ec85b0e18780"],
+ ["ec868a", "e18489e185a8e18781"],
+ ["ec868a", "ec85b0e18781"],
+ ["ec868b", "e18489e185a8e18782"],
+ ["ec868b", "ec85b0e18782"],
+ ["ec868c", "e18489e185a9"],
+ ["ec868d", "e18489e185a9e186a8"],
+ ["ec868d", "ec868ce186a8"],
+ ["ec868e", "e18489e185a9e186a9"],
+ ["ec868e", "ec868ce186a9"],
+ ["ec868f", "e18489e185a9e186aa"],
+ ["ec868f", "ec868ce186aa"],
+ ["ec8690", "e18489e185a9e186ab"],
+ ["ec8690", "ec868ce186ab"],
+ ["ec8691", "e18489e185a9e186ac"],
+ ["ec8691", "ec868ce186ac"],
+ ["ec8692", "e18489e185a9e186ad"],
+ ["ec8692", "ec868ce186ad"],
+ ["ec8693", "e18489e185a9e186ae"],
+ ["ec8693", "ec868ce186ae"],
+ ["ec8694", "e18489e185a9e186af"],
+ ["ec8694", "ec868ce186af"],
+ ["ec8695", "e18489e185a9e186b0"],
+ ["ec8695", "ec868ce186b0"],
+ ["ec8696", "e18489e185a9e186b1"],
+ ["ec8696", "ec868ce186b1"],
+ ["ec8697", "e18489e185a9e186b2"],
+ ["ec8697", "ec868ce186b2"],
+ ["ec8698", "e18489e185a9e186b3"],
+ ["ec8698", "ec868ce186b3"],
+ ["ec8699", "e18489e185a9e186b4"],
+ ["ec8699", "ec868ce186b4"],
+ ["ec869a", "e18489e185a9e186b5"],
+ ["ec869a", "ec868ce186b5"],
+ ["ec869b", "e18489e185a9e186b6"],
+ ["ec869b", "ec868ce186b6"],
+ ["ec869c", "e18489e185a9e186b7"],
+ ["ec869c", "ec868ce186b7"],
+ ["ec869d", "e18489e185a9e186b8"],
+ ["ec869d", "ec868ce186b8"],
+ ["ec869e", "e18489e185a9e186b9"],
+ ["ec869e", "ec868ce186b9"],
+ ["ec869f", "e18489e185a9e186ba"],
+ ["ec869f", "ec868ce186ba"],
+ ["ec86a0", "e18489e185a9e186bb"],
+ ["ec86a0", "ec868ce186bb"],
+ ["ec86a1", "e18489e185a9e186bc"],
+ ["ec86a1", "ec868ce186bc"],
+ ["ec86a2", "e18489e185a9e186bd"],
+ ["ec86a2", "ec868ce186bd"],
+ ["ec86a3", "e18489e185a9e186be"],
+ ["ec86a3", "ec868ce186be"],
+ ["ec86a4", "e18489e185a9e186bf"],
+ ["ec86a4", "ec868ce186bf"],
+ ["ec86a5", "e18489e185a9e18780"],
+ ["ec86a5", "ec868ce18780"],
+ ["ec86a6", "e18489e185a9e18781"],
+ ["ec86a6", "ec868ce18781"],
+ ["ec86a7", "e18489e185a9e18782"],
+ ["ec86a7", "ec868ce18782"],
+ ["ec86a8", "e18489e185aa"],
+ ["ec86a9", "e18489e185aae186a8"],
+ ["ec86a9", "ec86a8e186a8"],
+ ["ec86aa", "e18489e185aae186a9"],
+ ["ec86aa", "ec86a8e186a9"],
+ ["ec86ab", "e18489e185aae186aa"],
+ ["ec86ab", "ec86a8e186aa"],
+ ["ec86ac", "e18489e185aae186ab"],
+ ["ec86ac", "ec86a8e186ab"],
+ ["ec86ad", "e18489e185aae186ac"],
+ ["ec86ad", "ec86a8e186ac"],
+ ["ec86ae", "e18489e185aae186ad"],
+ ["ec86ae", "ec86a8e186ad"],
+ ["ec86af", "e18489e185aae186ae"],
+ ["ec86af", "ec86a8e186ae"],
+ ["ec86b0", "e18489e185aae186af"],
+ ["ec86b0", "ec86a8e186af"],
+ ["ec86b1", "e18489e185aae186b0"],
+ ["ec86b1", "ec86a8e186b0"],
+ ["ec86b2", "e18489e185aae186b1"],
+ ["ec86b2", "ec86a8e186b1"],
+ ["ec86b3", "e18489e185aae186b2"],
+ ["ec86b3", "ec86a8e186b2"],
+ ["ec86b4", "e18489e185aae186b3"],
+ ["ec86b4", "ec86a8e186b3"],
+ ["ec86b5", "e18489e185aae186b4"],
+ ["ec86b5", "ec86a8e186b4"],
+ ["ec86b6", "e18489e185aae186b5"],
+ ["ec86b6", "ec86a8e186b5"],
+ ["ec86b7", "e18489e185aae186b6"],
+ ["ec86b7", "ec86a8e186b6"],
+ ["ec86b8", "e18489e185aae186b7"],
+ ["ec86b8", "ec86a8e186b7"],
+ ["ec86b9", "e18489e185aae186b8"],
+ ["ec86b9", "ec86a8e186b8"],
+ ["ec86ba", "e18489e185aae186b9"],
+ ["ec86ba", "ec86a8e186b9"],
+ ["ec86bb", "e18489e185aae186ba"],
+ ["ec86bb", "ec86a8e186ba"],
+ ["ec86bc", "e18489e185aae186bb"],
+ ["ec86bc", "ec86a8e186bb"],
+ ["ec86bd", "e18489e185aae186bc"],
+ ["ec86bd", "ec86a8e186bc"],
+ ["ec86be", "e18489e185aae186bd"],
+ ["ec86be", "ec86a8e186bd"],
+ ["ec86bf", "e18489e185aae186be"],
+ ["ec86bf", "ec86a8e186be"],
+ ["ec8780", "e18489e185aae186bf"],
+ ["ec8780", "ec86a8e186bf"],
+ ["ec8781", "e18489e185aae18780"],
+ ["ec8781", "ec86a8e18780"],
+ ["ec8782", "e18489e185aae18781"],
+ ["ec8782", "ec86a8e18781"],
+ ["ec8783", "e18489e185aae18782"],
+ ["ec8783", "ec86a8e18782"],
+ ["ec8784", "e18489e185ab"],
+ ["ec8785", "e18489e185abe186a8"],
+ ["ec8785", "ec8784e186a8"],
+ ["ec8786", "e18489e185abe186a9"],
+ ["ec8786", "ec8784e186a9"],
+ ["ec8787", "e18489e185abe186aa"],
+ ["ec8787", "ec8784e186aa"],
+ ["ec8788", "e18489e185abe186ab"],
+ ["ec8788", "ec8784e186ab"],
+ ["ec8789", "e18489e185abe186ac"],
+ ["ec8789", "ec8784e186ac"],
+ ["ec878a", "e18489e185abe186ad"],
+ ["ec878a", "ec8784e186ad"],
+ ["ec878b", "e18489e185abe186ae"],
+ ["ec878b", "ec8784e186ae"],
+ ["ec878c", "e18489e185abe186af"],
+ ["ec878c", "ec8784e186af"],
+ ["ec878d", "e18489e185abe186b0"],
+ ["ec878d", "ec8784e186b0"],
+ ["ec878e", "e18489e185abe186b1"],
+ ["ec878e", "ec8784e186b1"],
+ ["ec878f", "e18489e185abe186b2"],
+ ["ec878f", "ec8784e186b2"],
+ ["ec8790", "e18489e185abe186b3"],
+ ["ec8790", "ec8784e186b3"],
+ ["ec8791", "e18489e185abe186b4"],
+ ["ec8791", "ec8784e186b4"],
+ ["ec8792", "e18489e185abe186b5"],
+ ["ec8792", "ec8784e186b5"],
+ ["ec8793", "e18489e185abe186b6"],
+ ["ec8793", "ec8784e186b6"],
+ ["ec8794", "e18489e185abe186b7"],
+ ["ec8794", "ec8784e186b7"],
+ ["ec8795", "e18489e185abe186b8"],
+ ["ec8795", "ec8784e186b8"],
+ ["ec8796", "e18489e185abe186b9"],
+ ["ec8796", "ec8784e186b9"],
+ ["ec8797", "e18489e185abe186ba"],
+ ["ec8797", "ec8784e186ba"],
+ ["ec8798", "e18489e185abe186bb"],
+ ["ec8798", "ec8784e186bb"],
+ ["ec8799", "e18489e185abe186bc"],
+ ["ec8799", "ec8784e186bc"],
+ ["ec879a", "e18489e185abe186bd"],
+ ["ec879a", "ec8784e186bd"],
+ ["ec879b", "e18489e185abe186be"],
+ ["ec879b", "ec8784e186be"],
+ ["ec879c", "e18489e185abe186bf"],
+ ["ec879c", "ec8784e186bf"],
+ ["ec879d", "e18489e185abe18780"],
+ ["ec879d", "ec8784e18780"],
+ ["ec879e", "e18489e185abe18781"],
+ ["ec879e", "ec8784e18781"],
+ ["ec879f", "e18489e185abe18782"],
+ ["ec879f", "ec8784e18782"],
+ ["ec87a0", "e18489e185ac"],
+ ["ec87a1", "e18489e185ace186a8"],
+ ["ec87a1", "ec87a0e186a8"],
+ ["ec87a2", "e18489e185ace186a9"],
+ ["ec87a2", "ec87a0e186a9"],
+ ["ec87a3", "e18489e185ace186aa"],
+ ["ec87a3", "ec87a0e186aa"],
+ ["ec87a4", "e18489e185ace186ab"],
+ ["ec87a4", "ec87a0e186ab"],
+ ["ec87a5", "e18489e185ace186ac"],
+ ["ec87a5", "ec87a0e186ac"],
+ ["ec87a6", "e18489e185ace186ad"],
+ ["ec87a6", "ec87a0e186ad"],
+ ["ec87a7", "e18489e185ace186ae"],
+ ["ec87a7", "ec87a0e186ae"],
+ ["ec87a8", "e18489e185ace186af"],
+ ["ec87a8", "ec87a0e186af"],
+ ["ec87a9", "e18489e185ace186b0"],
+ ["ec87a9", "ec87a0e186b0"],
+ ["ec87aa", "e18489e185ace186b1"],
+ ["ec87aa", "ec87a0e186b1"],
+ ["ec87ab", "e18489e185ace186b2"],
+ ["ec87ab", "ec87a0e186b2"],
+ ["ec87ac", "e18489e185ace186b3"],
+ ["ec87ac", "ec87a0e186b3"],
+ ["ec87ad", "e18489e185ace186b4"],
+ ["ec87ad", "ec87a0e186b4"],
+ ["ec87ae", "e18489e185ace186b5"],
+ ["ec87ae", "ec87a0e186b5"],
+ ["ec87af", "e18489e185ace186b6"],
+ ["ec87af", "ec87a0e186b6"],
+ ["ec87b0", "e18489e185ace186b7"],
+ ["ec87b0", "ec87a0e186b7"],
+ ["ec87b1", "e18489e185ace186b8"],
+ ["ec87b1", "ec87a0e186b8"],
+ ["ec87b2", "e18489e185ace186b9"],
+ ["ec87b2", "ec87a0e186b9"],
+ ["ec87b3", "e18489e185ace186ba"],
+ ["ec87b3", "ec87a0e186ba"],
+ ["ec87b4", "e18489e185ace186bb"],
+ ["ec87b4", "ec87a0e186bb"],
+ ["ec87b5", "e18489e185ace186bc"],
+ ["ec87b5", "ec87a0e186bc"],
+ ["ec87b6", "e18489e185ace186bd"],
+ ["ec87b6", "ec87a0e186bd"],
+ ["ec87b7", "e18489e185ace186be"],
+ ["ec87b7", "ec87a0e186be"],
+ ["ec87b8", "e18489e185ace186bf"],
+ ["ec87b8", "ec87a0e186bf"],
+ ["ec87b9", "e18489e185ace18780"],
+ ["ec87b9", "ec87a0e18780"],
+ ["ec87ba", "e18489e185ace18781"],
+ ["ec87ba", "ec87a0e18781"],
+ ["ec87bb", "e18489e185ace18782"],
+ ["ec87bb", "ec87a0e18782"],
+ ["ec87bc", "e18489e185ad"],
+ ["ec87bd", "e18489e185ade186a8"],
+ ["ec87bd", "ec87bce186a8"],
+ ["ec87be", "e18489e185ade186a9"],
+ ["ec87be", "ec87bce186a9"],
+ ["ec87bf", "e18489e185ade186aa"],
+ ["ec87bf", "ec87bce186aa"],
+ ["ec8880", "e18489e185ade186ab"],
+ ["ec8880", "ec87bce186ab"],
+ ["ec8881", "e18489e185ade186ac"],
+ ["ec8881", "ec87bce186ac"],
+ ["ec8882", "e18489e185ade186ad"],
+ ["ec8882", "ec87bce186ad"],
+ ["ec8883", "e18489e185ade186ae"],
+ ["ec8883", "ec87bce186ae"],
+ ["ec8884", "e18489e185ade186af"],
+ ["ec8884", "ec87bce186af"],
+ ["ec8885", "e18489e185ade186b0"],
+ ["ec8885", "ec87bce186b0"],
+ ["ec8886", "e18489e185ade186b1"],
+ ["ec8886", "ec87bce186b1"],
+ ["ec8887", "e18489e185ade186b2"],
+ ["ec8887", "ec87bce186b2"],
+ ["ec8888", "e18489e185ade186b3"],
+ ["ec8888", "ec87bce186b3"],
+ ["ec8889", "e18489e185ade186b4"],
+ ["ec8889", "ec87bce186b4"],
+ ["ec888a", "e18489e185ade186b5"],
+ ["ec888a", "ec87bce186b5"],
+ ["ec888b", "e18489e185ade186b6"],
+ ["ec888b", "ec87bce186b6"],
+ ["ec888c", "e18489e185ade186b7"],
+ ["ec888c", "ec87bce186b7"],
+ ["ec888d", "e18489e185ade186b8"],
+ ["ec888d", "ec87bce186b8"],
+ ["ec888e", "e18489e185ade186b9"],
+ ["ec888e", "ec87bce186b9"],
+ ["ec888f", "e18489e185ade186ba"],
+ ["ec888f", "ec87bce186ba"],
+ ["ec8890", "e18489e185ade186bb"],
+ ["ec8890", "ec87bce186bb"],
+ ["ec8891", "e18489e185ade186bc"],
+ ["ec8891", "ec87bce186bc"],
+ ["ec8892", "e18489e185ade186bd"],
+ ["ec8892", "ec87bce186bd"],
+ ["ec8893", "e18489e185ade186be"],
+ ["ec8893", "ec87bce186be"],
+ ["ec8894", "e18489e185ade186bf"],
+ ["ec8894", "ec87bce186bf"],
+ ["ec8895", "e18489e185ade18780"],
+ ["ec8895", "ec87bce18780"],
+ ["ec8896", "e18489e185ade18781"],
+ ["ec8896", "ec87bce18781"],
+ ["ec8897", "e18489e185ade18782"],
+ ["ec8897", "ec87bce18782"],
+ ["ec8898", "e18489e185ae"],
+ ["ec8899", "e18489e185aee186a8"],
+ ["ec8899", "ec8898e186a8"],
+ ["ec889a", "e18489e185aee186a9"],
+ ["ec889a", "ec8898e186a9"],
+ ["ec889b", "e18489e185aee186aa"],
+ ["ec889b", "ec8898e186aa"],
+ ["ec889c", "e18489e185aee186ab"],
+ ["ec889c", "ec8898e186ab"],
+ ["ec889d", "e18489e185aee186ac"],
+ ["ec889d", "ec8898e186ac"],
+ ["ec889e", "e18489e185aee186ad"],
+ ["ec889e", "ec8898e186ad"],
+ ["ec889f", "e18489e185aee186ae"],
+ ["ec889f", "ec8898e186ae"],
+ ["ec88a0", "e18489e185aee186af"],
+ ["ec88a0", "ec8898e186af"],
+ ["ec88a1", "e18489e185aee186b0"],
+ ["ec88a1", "ec8898e186b0"],
+ ["ec88a2", "e18489e185aee186b1"],
+ ["ec88a2", "ec8898e186b1"],
+ ["ec88a3", "e18489e185aee186b2"],
+ ["ec88a3", "ec8898e186b2"],
+ ["ec88a4", "e18489e185aee186b3"],
+ ["ec88a4", "ec8898e186b3"],
+ ["ec88a5", "e18489e185aee186b4"],
+ ["ec88a5", "ec8898e186b4"],
+ ["ec88a6", "e18489e185aee186b5"],
+ ["ec88a6", "ec8898e186b5"],
+ ["ec88a7", "e18489e185aee186b6"],
+ ["ec88a7", "ec8898e186b6"],
+ ["ec88a8", "e18489e185aee186b7"],
+ ["ec88a8", "ec8898e186b7"],
+ ["ec88a9", "e18489e185aee186b8"],
+ ["ec88a9", "ec8898e186b8"],
+ ["ec88aa", "e18489e185aee186b9"],
+ ["ec88aa", "ec8898e186b9"],
+ ["ec88ab", "e18489e185aee186ba"],
+ ["ec88ab", "ec8898e186ba"],
+ ["ec88ac", "e18489e185aee186bb"],
+ ["ec88ac", "ec8898e186bb"],
+ ["ec88ad", "e18489e185aee186bc"],
+ ["ec88ad", "ec8898e186bc"],
+ ["ec88ae", "e18489e185aee186bd"],
+ ["ec88ae", "ec8898e186bd"],
+ ["ec88af", "e18489e185aee186be"],
+ ["ec88af", "ec8898e186be"],
+ ["ec88b0", "e18489e185aee186bf"],
+ ["ec88b0", "ec8898e186bf"],
+ ["ec88b1", "e18489e185aee18780"],
+ ["ec88b1", "ec8898e18780"],
+ ["ec88b2", "e18489e185aee18781"],
+ ["ec88b2", "ec8898e18781"],
+ ["ec88b3", "e18489e185aee18782"],
+ ["ec88b3", "ec8898e18782"],
+ ["ec88b4", "e18489e185af"],
+ ["ec88b5", "e18489e185afe186a8"],
+ ["ec88b5", "ec88b4e186a8"],
+ ["ec88b6", "e18489e185afe186a9"],
+ ["ec88b6", "ec88b4e186a9"],
+ ["ec88b7", "e18489e185afe186aa"],
+ ["ec88b7", "ec88b4e186aa"],
+ ["ec88b8", "e18489e185afe186ab"],
+ ["ec88b8", "ec88b4e186ab"],
+ ["ec88b9", "e18489e185afe186ac"],
+ ["ec88b9", "ec88b4e186ac"],
+ ["ec88ba", "e18489e185afe186ad"],
+ ["ec88ba", "ec88b4e186ad"],
+ ["ec88bb", "e18489e185afe186ae"],
+ ["ec88bb", "ec88b4e186ae"],
+ ["ec88bc", "e18489e185afe186af"],
+ ["ec88bc", "ec88b4e186af"],
+ ["ec88bd", "e18489e185afe186b0"],
+ ["ec88bd", "ec88b4e186b0"],
+ ["ec88be", "e18489e185afe186b1"],
+ ["ec88be", "ec88b4e186b1"],
+ ["ec88bf", "e18489e185afe186b2"],
+ ["ec88bf", "ec88b4e186b2"],
+ ["ec8980", "e18489e185afe186b3"],
+ ["ec8980", "ec88b4e186b3"],
+ ["ec8981", "e18489e185afe186b4"],
+ ["ec8981", "ec88b4e186b4"],
+ ["ec8982", "e18489e185afe186b5"],
+ ["ec8982", "ec88b4e186b5"],
+ ["ec8983", "e18489e185afe186b6"],
+ ["ec8983", "ec88b4e186b6"],
+ ["ec8984", "e18489e185afe186b7"],
+ ["ec8984", "ec88b4e186b7"],
+ ["ec8985", "e18489e185afe186b8"],
+ ["ec8985", "ec88b4e186b8"],
+ ["ec8986", "e18489e185afe186b9"],
+ ["ec8986", "ec88b4e186b9"],
+ ["ec8987", "e18489e185afe186ba"],
+ ["ec8987", "ec88b4e186ba"],
+ ["ec8988", "e18489e185afe186bb"],
+ ["ec8988", "ec88b4e186bb"],
+ ["ec8989", "e18489e185afe186bc"],
+ ["ec8989", "ec88b4e186bc"],
+ ["ec898a", "e18489e185afe186bd"],
+ ["ec898a", "ec88b4e186bd"],
+ ["ec898b", "e18489e185afe186be"],
+ ["ec898b", "ec88b4e186be"],
+ ["ec898c", "e18489e185afe186bf"],
+ ["ec898c", "ec88b4e186bf"],
+ ["ec898d", "e18489e185afe18780"],
+ ["ec898d", "ec88b4e18780"],
+ ["ec898e", "e18489e185afe18781"],
+ ["ec898e", "ec88b4e18781"],
+ ["ec898f", "e18489e185afe18782"],
+ ["ec898f", "ec88b4e18782"],
+ ["ec8990", "e18489e185b0"],
+ ["ec8991", "e18489e185b0e186a8"],
+ ["ec8991", "ec8990e186a8"],
+ ["ec8992", "e18489e185b0e186a9"],
+ ["ec8992", "ec8990e186a9"],
+ ["ec8993", "e18489e185b0e186aa"],
+ ["ec8993", "ec8990e186aa"],
+ ["ec8994", "e18489e185b0e186ab"],
+ ["ec8994", "ec8990e186ab"],
+ ["ec8995", "e18489e185b0e186ac"],
+ ["ec8995", "ec8990e186ac"],
+ ["ec8996", "e18489e185b0e186ad"],
+ ["ec8996", "ec8990e186ad"],
+ ["ec8997", "e18489e185b0e186ae"],
+ ["ec8997", "ec8990e186ae"],
+ ["ec8998", "e18489e185b0e186af"],
+ ["ec8998", "ec8990e186af"],
+ ["ec8999", "e18489e185b0e186b0"],
+ ["ec8999", "ec8990e186b0"],
+ ["ec899a", "e18489e185b0e186b1"],
+ ["ec899a", "ec8990e186b1"],
+ ["ec899b", "e18489e185b0e186b2"],
+ ["ec899b", "ec8990e186b2"],
+ ["ec899c", "e18489e185b0e186b3"],
+ ["ec899c", "ec8990e186b3"],
+ ["ec899d", "e18489e185b0e186b4"],
+ ["ec899d", "ec8990e186b4"],
+ ["ec899e", "e18489e185b0e186b5"],
+ ["ec899e", "ec8990e186b5"],
+ ["ec899f", "e18489e185b0e186b6"],
+ ["ec899f", "ec8990e186b6"],
+ ["ec89a0", "e18489e185b0e186b7"],
+ ["ec89a0", "ec8990e186b7"],
+ ["ec89a1", "e18489e185b0e186b8"],
+ ["ec89a1", "ec8990e186b8"],
+ ["ec89a2", "e18489e185b0e186b9"],
+ ["ec89a2", "ec8990e186b9"],
+ ["ec89a3", "e18489e185b0e186ba"],
+ ["ec89a3", "ec8990e186ba"],
+ ["ec89a4", "e18489e185b0e186bb"],
+ ["ec89a4", "ec8990e186bb"],
+ ["ec89a5", "e18489e185b0e186bc"],
+ ["ec89a5", "ec8990e186bc"],
+ ["ec89a6", "e18489e185b0e186bd"],
+ ["ec89a6", "ec8990e186bd"],
+ ["ec89a7", "e18489e185b0e186be"],
+ ["ec89a7", "ec8990e186be"],
+ ["ec89a8", "e18489e185b0e186bf"],
+ ["ec89a8", "ec8990e186bf"],
+ ["ec89a9", "e18489e185b0e18780"],
+ ["ec89a9", "ec8990e18780"],
+ ["ec89aa", "e18489e185b0e18781"],
+ ["ec89aa", "ec8990e18781"],
+ ["ec89ab", "e18489e185b0e18782"],
+ ["ec89ab", "ec8990e18782"],
+ ["ec89ac", "e18489e185b1"],
+ ["ec89ad", "e18489e185b1e186a8"],
+ ["ec89ad", "ec89ace186a8"],
+ ["ec89ae", "e18489e185b1e186a9"],
+ ["ec89ae", "ec89ace186a9"],
+ ["ec89af", "e18489e185b1e186aa"],
+ ["ec89af", "ec89ace186aa"],
+ ["ec89b0", "e18489e185b1e186ab"],
+ ["ec89b0", "ec89ace186ab"],
+ ["ec89b1", "e18489e185b1e186ac"],
+ ["ec89b1", "ec89ace186ac"],
+ ["ec89b2", "e18489e185b1e186ad"],
+ ["ec89b2", "ec89ace186ad"],
+ ["ec89b3", "e18489e185b1e186ae"],
+ ["ec89b3", "ec89ace186ae"],
+ ["ec89b4", "e18489e185b1e186af"],
+ ["ec89b4", "ec89ace186af"],
+ ["ec89b5", "e18489e185b1e186b0"],
+ ["ec89b5", "ec89ace186b0"],
+ ["ec89b6", "e18489e185b1e186b1"],
+ ["ec89b6", "ec89ace186b1"],
+ ["ec89b7", "e18489e185b1e186b2"],
+ ["ec89b7", "ec89ace186b2"],
+ ["ec89b8", "e18489e185b1e186b3"],
+ ["ec89b8", "ec89ace186b3"],
+ ["ec89b9", "e18489e185b1e186b4"],
+ ["ec89b9", "ec89ace186b4"],
+ ["ec89ba", "e18489e185b1e186b5"],
+ ["ec89ba", "ec89ace186b5"],
+ ["ec89bb", "e18489e185b1e186b6"],
+ ["ec89bb", "ec89ace186b6"],
+ ["ec89bc", "e18489e185b1e186b7"],
+ ["ec89bc", "ec89ace186b7"],
+ ["ec89bd", "e18489e185b1e186b8"],
+ ["ec89bd", "ec89ace186b8"],
+ ["ec89be", "e18489e185b1e186b9"],
+ ["ec89be", "ec89ace186b9"],
+ ["ec89bf", "e18489e185b1e186ba"],
+ ["ec89bf", "ec89ace186ba"],
+ ["ec8a80", "e18489e185b1e186bb"],
+ ["ec8a80", "ec89ace186bb"],
+ ["ec8a81", "e18489e185b1e186bc"],
+ ["ec8a81", "ec89ace186bc"],
+ ["ec8a82", "e18489e185b1e186bd"],
+ ["ec8a82", "ec89ace186bd"],
+ ["ec8a83", "e18489e185b1e186be"],
+ ["ec8a83", "ec89ace186be"],
+ ["ec8a84", "e18489e185b1e186bf"],
+ ["ec8a84", "ec89ace186bf"],
+ ["ec8a85", "e18489e185b1e18780"],
+ ["ec8a85", "ec89ace18780"],
+ ["ec8a86", "e18489e185b1e18781"],
+ ["ec8a86", "ec89ace18781"],
+ ["ec8a87", "e18489e185b1e18782"],
+ ["ec8a87", "ec89ace18782"],
+ ["ec8a88", "e18489e185b2"],
+ ["ec8a89", "e18489e185b2e186a8"],
+ ["ec8a89", "ec8a88e186a8"],
+ ["ec8a8a", "e18489e185b2e186a9"],
+ ["ec8a8a", "ec8a88e186a9"],
+ ["ec8a8b", "e18489e185b2e186aa"],
+ ["ec8a8b", "ec8a88e186aa"],
+ ["ec8a8c", "e18489e185b2e186ab"],
+ ["ec8a8c", "ec8a88e186ab"],
+ ["ec8a8d", "e18489e185b2e186ac"],
+ ["ec8a8d", "ec8a88e186ac"],
+ ["ec8a8e", "e18489e185b2e186ad"],
+ ["ec8a8e", "ec8a88e186ad"],
+ ["ec8a8f", "e18489e185b2e186ae"],
+ ["ec8a8f", "ec8a88e186ae"],
+ ["ec8a90", "e18489e185b2e186af"],
+ ["ec8a90", "ec8a88e186af"],
+ ["ec8a91", "e18489e185b2e186b0"],
+ ["ec8a91", "ec8a88e186b0"],
+ ["ec8a92", "e18489e185b2e186b1"],
+ ["ec8a92", "ec8a88e186b1"],
+ ["ec8a93", "e18489e185b2e186b2"],
+ ["ec8a93", "ec8a88e186b2"],
+ ["ec8a94", "e18489e185b2e186b3"],
+ ["ec8a94", "ec8a88e186b3"],
+ ["ec8a95", "e18489e185b2e186b4"],
+ ["ec8a95", "ec8a88e186b4"],
+ ["ec8a96", "e18489e185b2e186b5"],
+ ["ec8a96", "ec8a88e186b5"],
+ ["ec8a97", "e18489e185b2e186b6"],
+ ["ec8a97", "ec8a88e186b6"],
+ ["ec8a98", "e18489e185b2e186b7"],
+ ["ec8a98", "ec8a88e186b7"],
+ ["ec8a99", "e18489e185b2e186b8"],
+ ["ec8a99", "ec8a88e186b8"],
+ ["ec8a9a", "e18489e185b2e186b9"],
+ ["ec8a9a", "ec8a88e186b9"],
+ ["ec8a9b", "e18489e185b2e186ba"],
+ ["ec8a9b", "ec8a88e186ba"],
+ ["ec8a9c", "e18489e185b2e186bb"],
+ ["ec8a9c", "ec8a88e186bb"],
+ ["ec8a9d", "e18489e185b2e186bc"],
+ ["ec8a9d", "ec8a88e186bc"],
+ ["ec8a9e", "e18489e185b2e186bd"],
+ ["ec8a9e", "ec8a88e186bd"],
+ ["ec8a9f", "e18489e185b2e186be"],
+ ["ec8a9f", "ec8a88e186be"],
+ ["ec8aa0", "e18489e185b2e186bf"],
+ ["ec8aa0", "ec8a88e186bf"],
+ ["ec8aa1", "e18489e185b2e18780"],
+ ["ec8aa1", "ec8a88e18780"],
+ ["ec8aa2", "e18489e185b2e18781"],
+ ["ec8aa2", "ec8a88e18781"],
+ ["ec8aa3", "e18489e185b2e18782"],
+ ["ec8aa3", "ec8a88e18782"],
+ ["ec8aa4", "e18489e185b3"],
+ ["ec8aa5", "e18489e185b3e186a8"],
+ ["ec8aa5", "ec8aa4e186a8"],
+ ["ec8aa6", "e18489e185b3e186a9"],
+ ["ec8aa6", "ec8aa4e186a9"],
+ ["ec8aa7", "e18489e185b3e186aa"],
+ ["ec8aa7", "ec8aa4e186aa"],
+ ["ec8aa8", "e18489e185b3e186ab"],
+ ["ec8aa8", "ec8aa4e186ab"],
+ ["ec8aa9", "e18489e185b3e186ac"],
+ ["ec8aa9", "ec8aa4e186ac"],
+ ["ec8aaa", "e18489e185b3e186ad"],
+ ["ec8aaa", "ec8aa4e186ad"],
+ ["ec8aab", "e18489e185b3e186ae"],
+ ["ec8aab", "ec8aa4e186ae"],
+ ["ec8aac", "e18489e185b3e186af"],
+ ["ec8aac", "ec8aa4e186af"],
+ ["ec8aad", "e18489e185b3e186b0"],
+ ["ec8aad", "ec8aa4e186b0"],
+ ["ec8aae", "e18489e185b3e186b1"],
+ ["ec8aae", "ec8aa4e186b1"],
+ ["ec8aaf", "e18489e185b3e186b2"],
+ ["ec8aaf", "ec8aa4e186b2"],
+ ["ec8ab0", "e18489e185b3e186b3"],
+ ["ec8ab0", "ec8aa4e186b3"],
+ ["ec8ab1", "e18489e185b3e186b4"],
+ ["ec8ab1", "ec8aa4e186b4"],
+ ["ec8ab2", "e18489e185b3e186b5"],
+ ["ec8ab2", "ec8aa4e186b5"],
+ ["ec8ab3", "e18489e185b3e186b6"],
+ ["ec8ab3", "ec8aa4e186b6"],
+ ["ec8ab4", "e18489e185b3e186b7"],
+ ["ec8ab4", "ec8aa4e186b7"],
+ ["ec8ab5", "e18489e185b3e186b8"],
+ ["ec8ab5", "ec8aa4e186b8"],
+ ["ec8ab6", "e18489e185b3e186b9"],
+ ["ec8ab6", "ec8aa4e186b9"],
+ ["ec8ab7", "e18489e185b3e186ba"],
+ ["ec8ab7", "ec8aa4e186ba"],
+ ["ec8ab8", "e18489e185b3e186bb"],
+ ["ec8ab8", "ec8aa4e186bb"],
+ ["ec8ab9", "e18489e185b3e186bc"],
+ ["ec8ab9", "ec8aa4e186bc"],
+ ["ec8aba", "e18489e185b3e186bd"],
+ ["ec8aba", "ec8aa4e186bd"],
+ ["ec8abb", "e18489e185b3e186be"],
+ ["ec8abb", "ec8aa4e186be"],
+ ["ec8abc", "e18489e185b3e186bf"],
+ ["ec8abc", "ec8aa4e186bf"],
+ ["ec8abd", "e18489e185b3e18780"],
+ ["ec8abd", "ec8aa4e18780"],
+ ["ec8abe", "e18489e185b3e18781"],
+ ["ec8abe", "ec8aa4e18781"],
+ ["ec8abf", "e18489e185b3e18782"],
+ ["ec8abf", "ec8aa4e18782"],
+ ["ec8b80", "e18489e185b4"],
+ ["ec8b81", "e18489e185b4e186a8"],
+ ["ec8b81", "ec8b80e186a8"],
+ ["ec8b82", "e18489e185b4e186a9"],
+ ["ec8b82", "ec8b80e186a9"],
+ ["ec8b83", "e18489e185b4e186aa"],
+ ["ec8b83", "ec8b80e186aa"],
+ ["ec8b84", "e18489e185b4e186ab"],
+ ["ec8b84", "ec8b80e186ab"],
+ ["ec8b85", "e18489e185b4e186ac"],
+ ["ec8b85", "ec8b80e186ac"],
+ ["ec8b86", "e18489e185b4e186ad"],
+ ["ec8b86", "ec8b80e186ad"],
+ ["ec8b87", "e18489e185b4e186ae"],
+ ["ec8b87", "ec8b80e186ae"],
+ ["ec8b88", "e18489e185b4e186af"],
+ ["ec8b88", "ec8b80e186af"],
+ ["ec8b89", "e18489e185b4e186b0"],
+ ["ec8b89", "ec8b80e186b0"],
+ ["ec8b8a", "e18489e185b4e186b1"],
+ ["ec8b8a", "ec8b80e186b1"],
+ ["ec8b8b", "e18489e185b4e186b2"],
+ ["ec8b8b", "ec8b80e186b2"],
+ ["ec8b8c", "e18489e185b4e186b3"],
+ ["ec8b8c", "ec8b80e186b3"],
+ ["ec8b8d", "e18489e185b4e186b4"],
+ ["ec8b8d", "ec8b80e186b4"],
+ ["ec8b8e", "e18489e185b4e186b5"],
+ ["ec8b8e", "ec8b80e186b5"],
+ ["ec8b8f", "e18489e185b4e186b6"],
+ ["ec8b8f", "ec8b80e186b6"],
+ ["ec8b90", "e18489e185b4e186b7"],
+ ["ec8b90", "ec8b80e186b7"],
+ ["ec8b91", "e18489e185b4e186b8"],
+ ["ec8b91", "ec8b80e186b8"],
+ ["ec8b92", "e18489e185b4e186b9"],
+ ["ec8b92", "ec8b80e186b9"],
+ ["ec8b93", "e18489e185b4e186ba"],
+ ["ec8b93", "ec8b80e186ba"],
+ ["ec8b94", "e18489e185b4e186bb"],
+ ["ec8b94", "ec8b80e186bb"],
+ ["ec8b95", "e18489e185b4e186bc"],
+ ["ec8b95", "ec8b80e186bc"],
+ ["ec8b96", "e18489e185b4e186bd"],
+ ["ec8b96", "ec8b80e186bd"],
+ ["ec8b97", "e18489e185b4e186be"],
+ ["ec8b97", "ec8b80e186be"],
+ ["ec8b98", "e18489e185b4e186bf"],
+ ["ec8b98", "ec8b80e186bf"],
+ ["ec8b99", "e18489e185b4e18780"],
+ ["ec8b99", "ec8b80e18780"],
+ ["ec8b9a", "e18489e185b4e18781"],
+ ["ec8b9a", "ec8b80e18781"],
+ ["ec8b9b", "e18489e185b4e18782"],
+ ["ec8b9b", "ec8b80e18782"],
+ ["ec8b9c", "e18489e185b5"],
+ ["ec8b9d", "e18489e185b5e186a8"],
+ ["ec8b9d", "ec8b9ce186a8"],
+ ["ec8b9e", "e18489e185b5e186a9"],
+ ["ec8b9e", "ec8b9ce186a9"],
+ ["ec8b9f", "e18489e185b5e186aa"],
+ ["ec8b9f", "ec8b9ce186aa"],
+ ["ec8ba0", "e18489e185b5e186ab"],
+ ["ec8ba0", "ec8b9ce186ab"],
+ ["ec8ba1", "e18489e185b5e186ac"],
+ ["ec8ba1", "ec8b9ce186ac"],
+ ["ec8ba2", "e18489e185b5e186ad"],
+ ["ec8ba2", "ec8b9ce186ad"],
+ ["ec8ba3", "e18489e185b5e186ae"],
+ ["ec8ba3", "ec8b9ce186ae"],
+ ["ec8ba4", "e18489e185b5e186af"],
+ ["ec8ba4", "ec8b9ce186af"],
+ ["ec8ba5", "e18489e185b5e186b0"],
+ ["ec8ba5", "ec8b9ce186b0"],
+ ["ec8ba6", "e18489e185b5e186b1"],
+ ["ec8ba6", "ec8b9ce186b1"],
+ ["ec8ba7", "e18489e185b5e186b2"],
+ ["ec8ba7", "ec8b9ce186b2"],
+ ["ec8ba8", "e18489e185b5e186b3"],
+ ["ec8ba8", "ec8b9ce186b3"],
+ ["ec8ba9", "e18489e185b5e186b4"],
+ ["ec8ba9", "ec8b9ce186b4"],
+ ["ec8baa", "e18489e185b5e186b5"],
+ ["ec8baa", "ec8b9ce186b5"],
+ ["ec8bab", "e18489e185b5e186b6"],
+ ["ec8bab", "ec8b9ce186b6"],
+ ["ec8bac", "e18489e185b5e186b7"],
+ ["ec8bac", "ec8b9ce186b7"],
+ ["ec8bad", "e18489e185b5e186b8"],
+ ["ec8bad", "ec8b9ce186b8"],
+ ["ec8bae", "e18489e185b5e186b9"],
+ ["ec8bae", "ec8b9ce186b9"],
+ ["ec8baf", "e18489e185b5e186ba"],
+ ["ec8baf", "ec8b9ce186ba"],
+ ["ec8bb0", "e18489e185b5e186bb"],
+ ["ec8bb0", "ec8b9ce186bb"],
+ ["ec8bb1", "e18489e185b5e186bc"],
+ ["ec8bb1", "ec8b9ce186bc"],
+ ["ec8bb2", "e18489e185b5e186bd"],
+ ["ec8bb2", "ec8b9ce186bd"],
+ ["ec8bb3", "e18489e185b5e186be"],
+ ["ec8bb3", "ec8b9ce186be"],
+ ["ec8bb4", "e18489e185b5e186bf"],
+ ["ec8bb4", "ec8b9ce186bf"],
+ ["ec8bb5", "e18489e185b5e18780"],
+ ["ec8bb5", "ec8b9ce18780"],
+ ["ec8bb6", "e18489e185b5e18781"],
+ ["ec8bb6", "ec8b9ce18781"],
+ ["ec8bb7", "e18489e185b5e18782"],
+ ["ec8bb7", "ec8b9ce18782"],
+ ["ec8bb8", "e1848ae185a1"],
+ ["ec8bb9", "e1848ae185a1e186a8"],
+ ["ec8bb9", "ec8bb8e186a8"],
+ ["ec8bba", "e1848ae185a1e186a9"],
+ ["ec8bba", "ec8bb8e186a9"],
+ ["ec8bbb", "e1848ae185a1e186aa"],
+ ["ec8bbb", "ec8bb8e186aa"],
+ ["ec8bbc", "e1848ae185a1e186ab"],
+ ["ec8bbc", "ec8bb8e186ab"],
+ ["ec8bbd", "e1848ae185a1e186ac"],
+ ["ec8bbd", "ec8bb8e186ac"],
+ ["ec8bbe", "e1848ae185a1e186ad"],
+ ["ec8bbe", "ec8bb8e186ad"],
+ ["ec8bbf", "e1848ae185a1e186ae"],
+ ["ec8bbf", "ec8bb8e186ae"],
+ ["ec8c80", "e1848ae185a1e186af"],
+ ["ec8c80", "ec8bb8e186af"],
+ ["ec8c81", "e1848ae185a1e186b0"],
+ ["ec8c81", "ec8bb8e186b0"],
+ ["ec8c82", "e1848ae185a1e186b1"],
+ ["ec8c82", "ec8bb8e186b1"],
+ ["ec8c83", "e1848ae185a1e186b2"],
+ ["ec8c83", "ec8bb8e186b2"],
+ ["ec8c84", "e1848ae185a1e186b3"],
+ ["ec8c84", "ec8bb8e186b3"],
+ ["ec8c85", "e1848ae185a1e186b4"],
+ ["ec8c85", "ec8bb8e186b4"],
+ ["ec8c86", "e1848ae185a1e186b5"],
+ ["ec8c86", "ec8bb8e186b5"],
+ ["ec8c87", "e1848ae185a1e186b6"],
+ ["ec8c87", "ec8bb8e186b6"],
+ ["ec8c88", "e1848ae185a1e186b7"],
+ ["ec8c88", "ec8bb8e186b7"],
+ ["ec8c89", "e1848ae185a1e186b8"],
+ ["ec8c89", "ec8bb8e186b8"],
+ ["ec8c8a", "e1848ae185a1e186b9"],
+ ["ec8c8a", "ec8bb8e186b9"],
+ ["ec8c8b", "e1848ae185a1e186ba"],
+ ["ec8c8b", "ec8bb8e186ba"],
+ ["ec8c8c", "e1848ae185a1e186bb"],
+ ["ec8c8c", "ec8bb8e186bb"],
+ ["ec8c8d", "e1848ae185a1e186bc"],
+ ["ec8c8d", "ec8bb8e186bc"],
+ ["ec8c8e", "e1848ae185a1e186bd"],
+ ["ec8c8e", "ec8bb8e186bd"],
+ ["ec8c8f", "e1848ae185a1e186be"],
+ ["ec8c8f", "ec8bb8e186be"],
+ ["ec8c90", "e1848ae185a1e186bf"],
+ ["ec8c90", "ec8bb8e186bf"],
+ ["ec8c91", "e1848ae185a1e18780"],
+ ["ec8c91", "ec8bb8e18780"],
+ ["ec8c92", "e1848ae185a1e18781"],
+ ["ec8c92", "ec8bb8e18781"],
+ ["ec8c93", "e1848ae185a1e18782"],
+ ["ec8c93", "ec8bb8e18782"],
+ ["ec8c94", "e1848ae185a2"],
+ ["ec8c95", "e1848ae185a2e186a8"],
+ ["ec8c95", "ec8c94e186a8"],
+ ["ec8c96", "e1848ae185a2e186a9"],
+ ["ec8c96", "ec8c94e186a9"],
+ ["ec8c97", "e1848ae185a2e186aa"],
+ ["ec8c97", "ec8c94e186aa"],
+ ["ec8c98", "e1848ae185a2e186ab"],
+ ["ec8c98", "ec8c94e186ab"],
+ ["ec8c99", "e1848ae185a2e186ac"],
+ ["ec8c99", "ec8c94e186ac"],
+ ["ec8c9a", "e1848ae185a2e186ad"],
+ ["ec8c9a", "ec8c94e186ad"],
+ ["ec8c9b", "e1848ae185a2e186ae"],
+ ["ec8c9b", "ec8c94e186ae"],
+ ["ec8c9c", "e1848ae185a2e186af"],
+ ["ec8c9c", "ec8c94e186af"],
+ ["ec8c9d", "e1848ae185a2e186b0"],
+ ["ec8c9d", "ec8c94e186b0"],
+ ["ec8c9e", "e1848ae185a2e186b1"],
+ ["ec8c9e", "ec8c94e186b1"],
+ ["ec8c9f", "e1848ae185a2e186b2"],
+ ["ec8c9f", "ec8c94e186b2"],
+ ["ec8ca0", "e1848ae185a2e186b3"],
+ ["ec8ca0", "ec8c94e186b3"],
+ ["ec8ca1", "e1848ae185a2e186b4"],
+ ["ec8ca1", "ec8c94e186b4"],
+ ["ec8ca2", "e1848ae185a2e186b5"],
+ ["ec8ca2", "ec8c94e186b5"],
+ ["ec8ca3", "e1848ae185a2e186b6"],
+ ["ec8ca3", "ec8c94e186b6"],
+ ["ec8ca4", "e1848ae185a2e186b7"],
+ ["ec8ca4", "ec8c94e186b7"],
+ ["ec8ca5", "e1848ae185a2e186b8"],
+ ["ec8ca5", "ec8c94e186b8"],
+ ["ec8ca6", "e1848ae185a2e186b9"],
+ ["ec8ca6", "ec8c94e186b9"],
+ ["ec8ca7", "e1848ae185a2e186ba"],
+ ["ec8ca7", "ec8c94e186ba"],
+ ["ec8ca8", "e1848ae185a2e186bb"],
+ ["ec8ca8", "ec8c94e186bb"],
+ ["ec8ca9", "e1848ae185a2e186bc"],
+ ["ec8ca9", "ec8c94e186bc"],
+ ["ec8caa", "e1848ae185a2e186bd"],
+ ["ec8caa", "ec8c94e186bd"],
+ ["ec8cab", "e1848ae185a2e186be"],
+ ["ec8cab", "ec8c94e186be"],
+ ["ec8cac", "e1848ae185a2e186bf"],
+ ["ec8cac", "ec8c94e186bf"],
+ ["ec8cad", "e1848ae185a2e18780"],
+ ["ec8cad", "ec8c94e18780"],
+ ["ec8cae", "e1848ae185a2e18781"],
+ ["ec8cae", "ec8c94e18781"],
+ ["ec8caf", "e1848ae185a2e18782"],
+ ["ec8caf", "ec8c94e18782"],
+ ["ec8cb0", "e1848ae185a3"],
+ ["ec8cb1", "e1848ae185a3e186a8"],
+ ["ec8cb1", "ec8cb0e186a8"],
+ ["ec8cb2", "e1848ae185a3e186a9"],
+ ["ec8cb2", "ec8cb0e186a9"],
+ ["ec8cb3", "e1848ae185a3e186aa"],
+ ["ec8cb3", "ec8cb0e186aa"],
+ ["ec8cb4", "e1848ae185a3e186ab"],
+ ["ec8cb4", "ec8cb0e186ab"],
+ ["ec8cb5", "e1848ae185a3e186ac"],
+ ["ec8cb5", "ec8cb0e186ac"],
+ ["ec8cb6", "e1848ae185a3e186ad"],
+ ["ec8cb6", "ec8cb0e186ad"],
+ ["ec8cb7", "e1848ae185a3e186ae"],
+ ["ec8cb7", "ec8cb0e186ae"],
+ ["ec8cb8", "e1848ae185a3e186af"],
+ ["ec8cb8", "ec8cb0e186af"],
+ ["ec8cb9", "e1848ae185a3e186b0"],
+ ["ec8cb9", "ec8cb0e186b0"],
+ ["ec8cba", "e1848ae185a3e186b1"],
+ ["ec8cba", "ec8cb0e186b1"],
+ ["ec8cbb", "e1848ae185a3e186b2"],
+ ["ec8cbb", "ec8cb0e186b2"],
+ ["ec8cbc", "e1848ae185a3e186b3"],
+ ["ec8cbc", "ec8cb0e186b3"],
+ ["ec8cbd", "e1848ae185a3e186b4"],
+ ["ec8cbd", "ec8cb0e186b4"],
+ ["ec8cbe", "e1848ae185a3e186b5"],
+ ["ec8cbe", "ec8cb0e186b5"],
+ ["ec8cbf", "e1848ae185a3e186b6"],
+ ["ec8cbf", "ec8cb0e186b6"],
+ ["ec8d80", "e1848ae185a3e186b7"],
+ ["ec8d80", "ec8cb0e186b7"],
+ ["ec8d81", "e1848ae185a3e186b8"],
+ ["ec8d81", "ec8cb0e186b8"],
+ ["ec8d82", "e1848ae185a3e186b9"],
+ ["ec8d82", "ec8cb0e186b9"],
+ ["ec8d83", "e1848ae185a3e186ba"],
+ ["ec8d83", "ec8cb0e186ba"],
+ ["ec8d84", "e1848ae185a3e186bb"],
+ ["ec8d84", "ec8cb0e186bb"],
+ ["ec8d85", "e1848ae185a3e186bc"],
+ ["ec8d85", "ec8cb0e186bc"],
+ ["ec8d86", "e1848ae185a3e186bd"],
+ ["ec8d86", "ec8cb0e186bd"],
+ ["ec8d87", "e1848ae185a3e186be"],
+ ["ec8d87", "ec8cb0e186be"],
+ ["ec8d88", "e1848ae185a3e186bf"],
+ ["ec8d88", "ec8cb0e186bf"],
+ ["ec8d89", "e1848ae185a3e18780"],
+ ["ec8d89", "ec8cb0e18780"],
+ ["ec8d8a", "e1848ae185a3e18781"],
+ ["ec8d8a", "ec8cb0e18781"],
+ ["ec8d8b", "e1848ae185a3e18782"],
+ ["ec8d8b", "ec8cb0e18782"],
+ ["ec8d8c", "e1848ae185a4"],
+ ["ec8d8d", "e1848ae185a4e186a8"],
+ ["ec8d8d", "ec8d8ce186a8"],
+ ["ec8d8e", "e1848ae185a4e186a9"],
+ ["ec8d8e", "ec8d8ce186a9"],
+ ["ec8d8f", "e1848ae185a4e186aa"],
+ ["ec8d8f", "ec8d8ce186aa"],
+ ["ec8d90", "e1848ae185a4e186ab"],
+ ["ec8d90", "ec8d8ce186ab"],
+ ["ec8d91", "e1848ae185a4e186ac"],
+ ["ec8d91", "ec8d8ce186ac"],
+ ["ec8d92", "e1848ae185a4e186ad"],
+ ["ec8d92", "ec8d8ce186ad"],
+ ["ec8d93", "e1848ae185a4e186ae"],
+ ["ec8d93", "ec8d8ce186ae"],
+ ["ec8d94", "e1848ae185a4e186af"],
+ ["ec8d94", "ec8d8ce186af"],
+ ["ec8d95", "e1848ae185a4e186b0"],
+ ["ec8d95", "ec8d8ce186b0"],
+ ["ec8d96", "e1848ae185a4e186b1"],
+ ["ec8d96", "ec8d8ce186b1"],
+ ["ec8d97", "e1848ae185a4e186b2"],
+ ["ec8d97", "ec8d8ce186b2"],
+ ["ec8d98", "e1848ae185a4e186b3"],
+ ["ec8d98", "ec8d8ce186b3"],
+ ["ec8d99", "e1848ae185a4e186b4"],
+ ["ec8d99", "ec8d8ce186b4"],
+ ["ec8d9a", "e1848ae185a4e186b5"],
+ ["ec8d9a", "ec8d8ce186b5"],
+ ["ec8d9b", "e1848ae185a4e186b6"],
+ ["ec8d9b", "ec8d8ce186b6"],
+ ["ec8d9c", "e1848ae185a4e186b7"],
+ ["ec8d9c", "ec8d8ce186b7"],
+ ["ec8d9d", "e1848ae185a4e186b8"],
+ ["ec8d9d", "ec8d8ce186b8"],
+ ["ec8d9e", "e1848ae185a4e186b9"],
+ ["ec8d9e", "ec8d8ce186b9"],
+ ["ec8d9f", "e1848ae185a4e186ba"],
+ ["ec8d9f", "ec8d8ce186ba"],
+ ["ec8da0", "e1848ae185a4e186bb"],
+ ["ec8da0", "ec8d8ce186bb"],
+ ["ec8da1", "e1848ae185a4e186bc"],
+ ["ec8da1", "ec8d8ce186bc"],
+ ["ec8da2", "e1848ae185a4e186bd"],
+ ["ec8da2", "ec8d8ce186bd"],
+ ["ec8da3", "e1848ae185a4e186be"],
+ ["ec8da3", "ec8d8ce186be"],
+ ["ec8da4", "e1848ae185a4e186bf"],
+ ["ec8da4", "ec8d8ce186bf"],
+ ["ec8da5", "e1848ae185a4e18780"],
+ ["ec8da5", "ec8d8ce18780"],
+ ["ec8da6", "e1848ae185a4e18781"],
+ ["ec8da6", "ec8d8ce18781"],
+ ["ec8da7", "e1848ae185a4e18782"],
+ ["ec8da7", "ec8d8ce18782"],
+ ["ec8da8", "e1848ae185a5"],
+ ["ec8da9", "e1848ae185a5e186a8"],
+ ["ec8da9", "ec8da8e186a8"],
+ ["ec8daa", "e1848ae185a5e186a9"],
+ ["ec8daa", "ec8da8e186a9"],
+ ["ec8dab", "e1848ae185a5e186aa"],
+ ["ec8dab", "ec8da8e186aa"],
+ ["ec8dac", "e1848ae185a5e186ab"],
+ ["ec8dac", "ec8da8e186ab"],
+ ["ec8dad", "e1848ae185a5e186ac"],
+ ["ec8dad", "ec8da8e186ac"],
+ ["ec8dae", "e1848ae185a5e186ad"],
+ ["ec8dae", "ec8da8e186ad"],
+ ["ec8daf", "e1848ae185a5e186ae"],
+ ["ec8daf", "ec8da8e186ae"],
+ ["ec8db0", "e1848ae185a5e186af"],
+ ["ec8db0", "ec8da8e186af"],
+ ["ec8db1", "e1848ae185a5e186b0"],
+ ["ec8db1", "ec8da8e186b0"],
+ ["ec8db2", "e1848ae185a5e186b1"],
+ ["ec8db2", "ec8da8e186b1"],
+ ["ec8db3", "e1848ae185a5e186b2"],
+ ["ec8db3", "ec8da8e186b2"],
+ ["ec8db4", "e1848ae185a5e186b3"],
+ ["ec8db4", "ec8da8e186b3"],
+ ["ec8db5", "e1848ae185a5e186b4"],
+ ["ec8db5", "ec8da8e186b4"],
+ ["ec8db6", "e1848ae185a5e186b5"],
+ ["ec8db6", "ec8da8e186b5"],
+ ["ec8db7", "e1848ae185a5e186b6"],
+ ["ec8db7", "ec8da8e186b6"],
+ ["ec8db8", "e1848ae185a5e186b7"],
+ ["ec8db8", "ec8da8e186b7"],
+ ["ec8db9", "e1848ae185a5e186b8"],
+ ["ec8db9", "ec8da8e186b8"],
+ ["ec8dba", "e1848ae185a5e186b9"],
+ ["ec8dba", "ec8da8e186b9"],
+ ["ec8dbb", "e1848ae185a5e186ba"],
+ ["ec8dbb", "ec8da8e186ba"],
+ ["ec8dbc", "e1848ae185a5e186bb"],
+ ["ec8dbc", "ec8da8e186bb"],
+ ["ec8dbd", "e1848ae185a5e186bc"],
+ ["ec8dbd", "ec8da8e186bc"],
+ ["ec8dbe", "e1848ae185a5e186bd"],
+ ["ec8dbe", "ec8da8e186bd"],
+ ["ec8dbf", "e1848ae185a5e186be"],
+ ["ec8dbf", "ec8da8e186be"],
+ ["ec8e80", "e1848ae185a5e186bf"],
+ ["ec8e80", "ec8da8e186bf"],
+ ["ec8e81", "e1848ae185a5e18780"],
+ ["ec8e81", "ec8da8e18780"],
+ ["ec8e82", "e1848ae185a5e18781"],
+ ["ec8e82", "ec8da8e18781"],
+ ["ec8e83", "e1848ae185a5e18782"],
+ ["ec8e83", "ec8da8e18782"],
+ ["ec8e84", "e1848ae185a6"],
+ ["ec8e85", "e1848ae185a6e186a8"],
+ ["ec8e85", "ec8e84e186a8"],
+ ["ec8e86", "e1848ae185a6e186a9"],
+ ["ec8e86", "ec8e84e186a9"],
+ ["ec8e87", "e1848ae185a6e186aa"],
+ ["ec8e87", "ec8e84e186aa"],
+ ["ec8e88", "e1848ae185a6e186ab"],
+ ["ec8e88", "ec8e84e186ab"],
+ ["ec8e89", "e1848ae185a6e186ac"],
+ ["ec8e89", "ec8e84e186ac"],
+ ["ec8e8a", "e1848ae185a6e186ad"],
+ ["ec8e8a", "ec8e84e186ad"],
+ ["ec8e8b", "e1848ae185a6e186ae"],
+ ["ec8e8b", "ec8e84e186ae"],
+ ["ec8e8c", "e1848ae185a6e186af"],
+ ["ec8e8c", "ec8e84e186af"],
+ ["ec8e8d", "e1848ae185a6e186b0"],
+ ["ec8e8d", "ec8e84e186b0"],
+ ["ec8e8e", "e1848ae185a6e186b1"],
+ ["ec8e8e", "ec8e84e186b1"],
+ ["ec8e8f", "e1848ae185a6e186b2"],
+ ["ec8e8f", "ec8e84e186b2"],
+ ["ec8e90", "e1848ae185a6e186b3"],
+ ["ec8e90", "ec8e84e186b3"],
+ ["ec8e91", "e1848ae185a6e186b4"],
+ ["ec8e91", "ec8e84e186b4"],
+ ["ec8e92", "e1848ae185a6e186b5"],
+ ["ec8e92", "ec8e84e186b5"],
+ ["ec8e93", "e1848ae185a6e186b6"],
+ ["ec8e93", "ec8e84e186b6"],
+ ["ec8e94", "e1848ae185a6e186b7"],
+ ["ec8e94", "ec8e84e186b7"],
+ ["ec8e95", "e1848ae185a6e186b8"],
+ ["ec8e95", "ec8e84e186b8"],
+ ["ec8e96", "e1848ae185a6e186b9"],
+ ["ec8e96", "ec8e84e186b9"],
+ ["ec8e97", "e1848ae185a6e186ba"],
+ ["ec8e97", "ec8e84e186ba"],
+ ["ec8e98", "e1848ae185a6e186bb"],
+ ["ec8e98", "ec8e84e186bb"],
+ ["ec8e99", "e1848ae185a6e186bc"],
+ ["ec8e99", "ec8e84e186bc"],
+ ["ec8e9a", "e1848ae185a6e186bd"],
+ ["ec8e9a", "ec8e84e186bd"],
+ ["ec8e9b", "e1848ae185a6e186be"],
+ ["ec8e9b", "ec8e84e186be"],
+ ["ec8e9c", "e1848ae185a6e186bf"],
+ ["ec8e9c", "ec8e84e186bf"],
+ ["ec8e9d", "e1848ae185a6e18780"],
+ ["ec8e9d", "ec8e84e18780"],
+ ["ec8e9e", "e1848ae185a6e18781"],
+ ["ec8e9e", "ec8e84e18781"],
+ ["ec8e9f", "e1848ae185a6e18782"],
+ ["ec8e9f", "ec8e84e18782"],
+ ["ec8ea0", "e1848ae185a7"],
+ ["ec8ea1", "e1848ae185a7e186a8"],
+ ["ec8ea1", "ec8ea0e186a8"],
+ ["ec8ea2", "e1848ae185a7e186a9"],
+ ["ec8ea2", "ec8ea0e186a9"],
+ ["ec8ea3", "e1848ae185a7e186aa"],
+ ["ec8ea3", "ec8ea0e186aa"],
+ ["ec8ea4", "e1848ae185a7e186ab"],
+ ["ec8ea4", "ec8ea0e186ab"],
+ ["ec8ea5", "e1848ae185a7e186ac"],
+ ["ec8ea5", "ec8ea0e186ac"],
+ ["ec8ea6", "e1848ae185a7e186ad"],
+ ["ec8ea6", "ec8ea0e186ad"],
+ ["ec8ea7", "e1848ae185a7e186ae"],
+ ["ec8ea7", "ec8ea0e186ae"],
+ ["ec8ea8", "e1848ae185a7e186af"],
+ ["ec8ea8", "ec8ea0e186af"],
+ ["ec8ea9", "e1848ae185a7e186b0"],
+ ["ec8ea9", "ec8ea0e186b0"],
+ ["ec8eaa", "e1848ae185a7e186b1"],
+ ["ec8eaa", "ec8ea0e186b1"],
+ ["ec8eab", "e1848ae185a7e186b2"],
+ ["ec8eab", "ec8ea0e186b2"],
+ ["ec8eac", "e1848ae185a7e186b3"],
+ ["ec8eac", "ec8ea0e186b3"],
+ ["ec8ead", "e1848ae185a7e186b4"],
+ ["ec8ead", "ec8ea0e186b4"],
+ ["ec8eae", "e1848ae185a7e186b5"],
+ ["ec8eae", "ec8ea0e186b5"],
+ ["ec8eaf", "e1848ae185a7e186b6"],
+ ["ec8eaf", "ec8ea0e186b6"],
+ ["ec8eb0", "e1848ae185a7e186b7"],
+ ["ec8eb0", "ec8ea0e186b7"],
+ ["ec8eb1", "e1848ae185a7e186b8"],
+ ["ec8eb1", "ec8ea0e186b8"],
+ ["ec8eb2", "e1848ae185a7e186b9"],
+ ["ec8eb2", "ec8ea0e186b9"],
+ ["ec8eb3", "e1848ae185a7e186ba"],
+ ["ec8eb3", "ec8ea0e186ba"],
+ ["ec8eb4", "e1848ae185a7e186bb"],
+ ["ec8eb4", "ec8ea0e186bb"],
+ ["ec8eb5", "e1848ae185a7e186bc"],
+ ["ec8eb5", "ec8ea0e186bc"],
+ ["ec8eb6", "e1848ae185a7e186bd"],
+ ["ec8eb6", "ec8ea0e186bd"],
+ ["ec8eb7", "e1848ae185a7e186be"],
+ ["ec8eb7", "ec8ea0e186be"],
+ ["ec8eb8", "e1848ae185a7e186bf"],
+ ["ec8eb8", "ec8ea0e186bf"],
+ ["ec8eb9", "e1848ae185a7e18780"],
+ ["ec8eb9", "ec8ea0e18780"],
+ ["ec8eba", "e1848ae185a7e18781"],
+ ["ec8eba", "ec8ea0e18781"],
+ ["ec8ebb", "e1848ae185a7e18782"],
+ ["ec8ebb", "ec8ea0e18782"],
+ ["ec8ebc", "e1848ae185a8"],
+ ["ec8ebd", "e1848ae185a8e186a8"],
+ ["ec8ebd", "ec8ebce186a8"],
+ ["ec8ebe", "e1848ae185a8e186a9"],
+ ["ec8ebe", "ec8ebce186a9"],
+ ["ec8ebf", "e1848ae185a8e186aa"],
+ ["ec8ebf", "ec8ebce186aa"],
+ ["ec8f80", "e1848ae185a8e186ab"],
+ ["ec8f80", "ec8ebce186ab"],
+ ["ec8f81", "e1848ae185a8e186ac"],
+ ["ec8f81", "ec8ebce186ac"],
+ ["ec8f82", "e1848ae185a8e186ad"],
+ ["ec8f82", "ec8ebce186ad"],
+ ["ec8f83", "e1848ae185a8e186ae"],
+ ["ec8f83", "ec8ebce186ae"],
+ ["ec8f84", "e1848ae185a8e186af"],
+ ["ec8f84", "ec8ebce186af"],
+ ["ec8f85", "e1848ae185a8e186b0"],
+ ["ec8f85", "ec8ebce186b0"],
+ ["ec8f86", "e1848ae185a8e186b1"],
+ ["ec8f86", "ec8ebce186b1"],
+ ["ec8f87", "e1848ae185a8e186b2"],
+ ["ec8f87", "ec8ebce186b2"],
+ ["ec8f88", "e1848ae185a8e186b3"],
+ ["ec8f88", "ec8ebce186b3"],
+ ["ec8f89", "e1848ae185a8e186b4"],
+ ["ec8f89", "ec8ebce186b4"],
+ ["ec8f8a", "e1848ae185a8e186b5"],
+ ["ec8f8a", "ec8ebce186b5"],
+ ["ec8f8b", "e1848ae185a8e186b6"],
+ ["ec8f8b", "ec8ebce186b6"],
+ ["ec8f8c", "e1848ae185a8e186b7"],
+ ["ec8f8c", "ec8ebce186b7"],
+ ["ec8f8d", "e1848ae185a8e186b8"],
+ ["ec8f8d", "ec8ebce186b8"],
+ ["ec8f8e", "e1848ae185a8e186b9"],
+ ["ec8f8e", "ec8ebce186b9"],
+ ["ec8f8f", "e1848ae185a8e186ba"],
+ ["ec8f8f", "ec8ebce186ba"],
+ ["ec8f90", "e1848ae185a8e186bb"],
+ ["ec8f90", "ec8ebce186bb"],
+ ["ec8f91", "e1848ae185a8e186bc"],
+ ["ec8f91", "ec8ebce186bc"],
+ ["ec8f92", "e1848ae185a8e186bd"],
+ ["ec8f92", "ec8ebce186bd"],
+ ["ec8f93", "e1848ae185a8e186be"],
+ ["ec8f93", "ec8ebce186be"],
+ ["ec8f94", "e1848ae185a8e186bf"],
+ ["ec8f94", "ec8ebce186bf"],
+ ["ec8f95", "e1848ae185a8e18780"],
+ ["ec8f95", "ec8ebce18780"],
+ ["ec8f96", "e1848ae185a8e18781"],
+ ["ec8f96", "ec8ebce18781"],
+ ["ec8f97", "e1848ae185a8e18782"],
+ ["ec8f97", "ec8ebce18782"],
+ ["ec8f98", "e1848ae185a9"],
+ ["ec8f99", "e1848ae185a9e186a8"],
+ ["ec8f99", "ec8f98e186a8"],
+ ["ec8f9a", "e1848ae185a9e186a9"],
+ ["ec8f9a", "ec8f98e186a9"],
+ ["ec8f9b", "e1848ae185a9e186aa"],
+ ["ec8f9b", "ec8f98e186aa"],
+ ["ec8f9c", "e1848ae185a9e186ab"],
+ ["ec8f9c", "ec8f98e186ab"],
+ ["ec8f9d", "e1848ae185a9e186ac"],
+ ["ec8f9d", "ec8f98e186ac"],
+ ["ec8f9e", "e1848ae185a9e186ad"],
+ ["ec8f9e", "ec8f98e186ad"],
+ ["ec8f9f", "e1848ae185a9e186ae"],
+ ["ec8f9f", "ec8f98e186ae"],
+ ["ec8fa0", "e1848ae185a9e186af"],
+ ["ec8fa0", "ec8f98e186af"],
+ ["ec8fa1", "e1848ae185a9e186b0"],
+ ["ec8fa1", "ec8f98e186b0"],
+ ["ec8fa2", "e1848ae185a9e186b1"],
+ ["ec8fa2", "ec8f98e186b1"],
+ ["ec8fa3", "e1848ae185a9e186b2"],
+ ["ec8fa3", "ec8f98e186b2"],
+ ["ec8fa4", "e1848ae185a9e186b3"],
+ ["ec8fa4", "ec8f98e186b3"],
+ ["ec8fa5", "e1848ae185a9e186b4"],
+ ["ec8fa5", "ec8f98e186b4"],
+ ["ec8fa6", "e1848ae185a9e186b5"],
+ ["ec8fa6", "ec8f98e186b5"],
+ ["ec8fa7", "e1848ae185a9e186b6"],
+ ["ec8fa7", "ec8f98e186b6"],
+ ["ec8fa8", "e1848ae185a9e186b7"],
+ ["ec8fa8", "ec8f98e186b7"],
+ ["ec8fa9", "e1848ae185a9e186b8"],
+ ["ec8fa9", "ec8f98e186b8"],
+ ["ec8faa", "e1848ae185a9e186b9"],
+ ["ec8faa", "ec8f98e186b9"],
+ ["ec8fab", "e1848ae185a9e186ba"],
+ ["ec8fab", "ec8f98e186ba"],
+ ["ec8fac", "e1848ae185a9e186bb"],
+ ["ec8fac", "ec8f98e186bb"],
+ ["ec8fad", "e1848ae185a9e186bc"],
+ ["ec8fad", "ec8f98e186bc"],
+ ["ec8fae", "e1848ae185a9e186bd"],
+ ["ec8fae", "ec8f98e186bd"],
+ ["ec8faf", "e1848ae185a9e186be"],
+ ["ec8faf", "ec8f98e186be"],
+ ["ec8fb0", "e1848ae185a9e186bf"],
+ ["ec8fb0", "ec8f98e186bf"],
+ ["ec8fb1", "e1848ae185a9e18780"],
+ ["ec8fb1", "ec8f98e18780"],
+ ["ec8fb2", "e1848ae185a9e18781"],
+ ["ec8fb2", "ec8f98e18781"],
+ ["ec8fb3", "e1848ae185a9e18782"],
+ ["ec8fb3", "ec8f98e18782"],
+ ["ec8fb4", "e1848ae185aa"],
+ ["ec8fb5", "e1848ae185aae186a8"],
+ ["ec8fb5", "ec8fb4e186a8"],
+ ["ec8fb6", "e1848ae185aae186a9"],
+ ["ec8fb6", "ec8fb4e186a9"],
+ ["ec8fb7", "e1848ae185aae186aa"],
+ ["ec8fb7", "ec8fb4e186aa"],
+ ["ec8fb8", "e1848ae185aae186ab"],
+ ["ec8fb8", "ec8fb4e186ab"],
+ ["ec8fb9", "e1848ae185aae186ac"],
+ ["ec8fb9", "ec8fb4e186ac"],
+ ["ec8fba", "e1848ae185aae186ad"],
+ ["ec8fba", "ec8fb4e186ad"],
+ ["ec8fbb", "e1848ae185aae186ae"],
+ ["ec8fbb", "ec8fb4e186ae"],
+ ["ec8fbc", "e1848ae185aae186af"],
+ ["ec8fbc", "ec8fb4e186af"],
+ ["ec8fbd", "e1848ae185aae186b0"],
+ ["ec8fbd", "ec8fb4e186b0"],
+ ["ec8fbe", "e1848ae185aae186b1"],
+ ["ec8fbe", "ec8fb4e186b1"],
+ ["ec8fbf", "e1848ae185aae186b2"],
+ ["ec8fbf", "ec8fb4e186b2"],
+ ["ec9080", "e1848ae185aae186b3"],
+ ["ec9080", "ec8fb4e186b3"],
+ ["ec9081", "e1848ae185aae186b4"],
+ ["ec9081", "ec8fb4e186b4"],
+ ["ec9082", "e1848ae185aae186b5"],
+ ["ec9082", "ec8fb4e186b5"],
+ ["ec9083", "e1848ae185aae186b6"],
+ ["ec9083", "ec8fb4e186b6"],
+ ["ec9084", "e1848ae185aae186b7"],
+ ["ec9084", "ec8fb4e186b7"],
+ ["ec9085", "e1848ae185aae186b8"],
+ ["ec9085", "ec8fb4e186b8"],
+ ["ec9086", "e1848ae185aae186b9"],
+ ["ec9086", "ec8fb4e186b9"],
+ ["ec9087", "e1848ae185aae186ba"],
+ ["ec9087", "ec8fb4e186ba"],
+ ["ec9088", "e1848ae185aae186bb"],
+ ["ec9088", "ec8fb4e186bb"],
+ ["ec9089", "e1848ae185aae186bc"],
+ ["ec9089", "ec8fb4e186bc"],
+ ["ec908a", "e1848ae185aae186bd"],
+ ["ec908a", "ec8fb4e186bd"],
+ ["ec908b", "e1848ae185aae186be"],
+ ["ec908b", "ec8fb4e186be"],
+ ["ec908c", "e1848ae185aae186bf"],
+ ["ec908c", "ec8fb4e186bf"],
+ ["ec908d", "e1848ae185aae18780"],
+ ["ec908d", "ec8fb4e18780"],
+ ["ec908e", "e1848ae185aae18781"],
+ ["ec908e", "ec8fb4e18781"],
+ ["ec908f", "e1848ae185aae18782"],
+ ["ec908f", "ec8fb4e18782"],
+ ["ec9090", "e1848ae185ab"],
+ ["ec9091", "e1848ae185abe186a8"],
+ ["ec9091", "ec9090e186a8"],
+ ["ec9092", "e1848ae185abe186a9"],
+ ["ec9092", "ec9090e186a9"],
+ ["ec9093", "e1848ae185abe186aa"],
+ ["ec9093", "ec9090e186aa"],
+ ["ec9094", "e1848ae185abe186ab"],
+ ["ec9094", "ec9090e186ab"],
+ ["ec9095", "e1848ae185abe186ac"],
+ ["ec9095", "ec9090e186ac"],
+ ["ec9096", "e1848ae185abe186ad"],
+ ["ec9096", "ec9090e186ad"],
+ ["ec9097", "e1848ae185abe186ae"],
+ ["ec9097", "ec9090e186ae"],
+ ["ec9098", "e1848ae185abe186af"],
+ ["ec9098", "ec9090e186af"],
+ ["ec9099", "e1848ae185abe186b0"],
+ ["ec9099", "ec9090e186b0"],
+ ["ec909a", "e1848ae185abe186b1"],
+ ["ec909a", "ec9090e186b1"],
+ ["ec909b", "e1848ae185abe186b2"],
+ ["ec909b", "ec9090e186b2"],
+ ["ec909c", "e1848ae185abe186b3"],
+ ["ec909c", "ec9090e186b3"],
+ ["ec909d", "e1848ae185abe186b4"],
+ ["ec909d", "ec9090e186b4"],
+ ["ec909e", "e1848ae185abe186b5"],
+ ["ec909e", "ec9090e186b5"],
+ ["ec909f", "e1848ae185abe186b6"],
+ ["ec909f", "ec9090e186b6"],
+ ["ec90a0", "e1848ae185abe186b7"],
+ ["ec90a0", "ec9090e186b7"],
+ ["ec90a1", "e1848ae185abe186b8"],
+ ["ec90a1", "ec9090e186b8"],
+ ["ec90a2", "e1848ae185abe186b9"],
+ ["ec90a2", "ec9090e186b9"],
+ ["ec90a3", "e1848ae185abe186ba"],
+ ["ec90a3", "ec9090e186ba"],
+ ["ec90a4", "e1848ae185abe186bb"],
+ ["ec90a4", "ec9090e186bb"],
+ ["ec90a5", "e1848ae185abe186bc"],
+ ["ec90a5", "ec9090e186bc"],
+ ["ec90a6", "e1848ae185abe186bd"],
+ ["ec90a6", "ec9090e186bd"],
+ ["ec90a7", "e1848ae185abe186be"],
+ ["ec90a7", "ec9090e186be"],
+ ["ec90a8", "e1848ae185abe186bf"],
+ ["ec90a8", "ec9090e186bf"],
+ ["ec90a9", "e1848ae185abe18780"],
+ ["ec90a9", "ec9090e18780"],
+ ["ec90aa", "e1848ae185abe18781"],
+ ["ec90aa", "ec9090e18781"],
+ ["ec90ab", "e1848ae185abe18782"],
+ ["ec90ab", "ec9090e18782"],
+ ["ec90ac", "e1848ae185ac"],
+ ["ec90ad", "e1848ae185ace186a8"],
+ ["ec90ad", "ec90ace186a8"],
+ ["ec90ae", "e1848ae185ace186a9"],
+ ["ec90ae", "ec90ace186a9"],
+ ["ec90af", "e1848ae185ace186aa"],
+ ["ec90af", "ec90ace186aa"],
+ ["ec90b0", "e1848ae185ace186ab"],
+ ["ec90b0", "ec90ace186ab"],
+ ["ec90b1", "e1848ae185ace186ac"],
+ ["ec90b1", "ec90ace186ac"],
+ ["ec90b2", "e1848ae185ace186ad"],
+ ["ec90b2", "ec90ace186ad"],
+ ["ec90b3", "e1848ae185ace186ae"],
+ ["ec90b3", "ec90ace186ae"],
+ ["ec90b4", "e1848ae185ace186af"],
+ ["ec90b4", "ec90ace186af"],
+ ["ec90b5", "e1848ae185ace186b0"],
+ ["ec90b5", "ec90ace186b0"],
+ ["ec90b6", "e1848ae185ace186b1"],
+ ["ec90b6", "ec90ace186b1"],
+ ["ec90b7", "e1848ae185ace186b2"],
+ ["ec90b7", "ec90ace186b2"],
+ ["ec90b8", "e1848ae185ace186b3"],
+ ["ec90b8", "ec90ace186b3"],
+ ["ec90b9", "e1848ae185ace186b4"],
+ ["ec90b9", "ec90ace186b4"],
+ ["ec90ba", "e1848ae185ace186b5"],
+ ["ec90ba", "ec90ace186b5"],
+ ["ec90bb", "e1848ae185ace186b6"],
+ ["ec90bb", "ec90ace186b6"],
+ ["ec90bc", "e1848ae185ace186b7"],
+ ["ec90bc", "ec90ace186b7"],
+ ["ec90bd", "e1848ae185ace186b8"],
+ ["ec90bd", "ec90ace186b8"],
+ ["ec90be", "e1848ae185ace186b9"],
+ ["ec90be", "ec90ace186b9"],
+ ["ec90bf", "e1848ae185ace186ba"],
+ ["ec90bf", "ec90ace186ba"],
+ ["ec9180", "e1848ae185ace186bb"],
+ ["ec9180", "ec90ace186bb"],
+ ["ec9181", "e1848ae185ace186bc"],
+ ["ec9181", "ec90ace186bc"],
+ ["ec9182", "e1848ae185ace186bd"],
+ ["ec9182", "ec90ace186bd"],
+ ["ec9183", "e1848ae185ace186be"],
+ ["ec9183", "ec90ace186be"],
+ ["ec9184", "e1848ae185ace186bf"],
+ ["ec9184", "ec90ace186bf"],
+ ["ec9185", "e1848ae185ace18780"],
+ ["ec9185", "ec90ace18780"],
+ ["ec9186", "e1848ae185ace18781"],
+ ["ec9186", "ec90ace18781"],
+ ["ec9187", "e1848ae185ace18782"],
+ ["ec9187", "ec90ace18782"],
+ ["ec9188", "e1848ae185ad"],
+ ["ec9189", "e1848ae185ade186a8"],
+ ["ec9189", "ec9188e186a8"],
+ ["ec918a", "e1848ae185ade186a9"],
+ ["ec918a", "ec9188e186a9"],
+ ["ec918b", "e1848ae185ade186aa"],
+ ["ec918b", "ec9188e186aa"],
+ ["ec918c", "e1848ae185ade186ab"],
+ ["ec918c", "ec9188e186ab"],
+ ["ec918d", "e1848ae185ade186ac"],
+ ["ec918d", "ec9188e186ac"],
+ ["ec918e", "e1848ae185ade186ad"],
+ ["ec918e", "ec9188e186ad"],
+ ["ec918f", "e1848ae185ade186ae"],
+ ["ec918f", "ec9188e186ae"],
+ ["ec9190", "e1848ae185ade186af"],
+ ["ec9190", "ec9188e186af"],
+ ["ec9191", "e1848ae185ade186b0"],
+ ["ec9191", "ec9188e186b0"],
+ ["ec9192", "e1848ae185ade186b1"],
+ ["ec9192", "ec9188e186b1"],
+ ["ec9193", "e1848ae185ade186b2"],
+ ["ec9193", "ec9188e186b2"],
+ ["ec9194", "e1848ae185ade186b3"],
+ ["ec9194", "ec9188e186b3"],
+ ["ec9195", "e1848ae185ade186b4"],
+ ["ec9195", "ec9188e186b4"],
+ ["ec9196", "e1848ae185ade186b5"],
+ ["ec9196", "ec9188e186b5"],
+ ["ec9197", "e1848ae185ade186b6"],
+ ["ec9197", "ec9188e186b6"],
+ ["ec9198", "e1848ae185ade186b7"],
+ ["ec9198", "ec9188e186b7"],
+ ["ec9199", "e1848ae185ade186b8"],
+ ["ec9199", "ec9188e186b8"],
+ ["ec919a", "e1848ae185ade186b9"],
+ ["ec919a", "ec9188e186b9"],
+ ["ec919b", "e1848ae185ade186ba"],
+ ["ec919b", "ec9188e186ba"],
+ ["ec919c", "e1848ae185ade186bb"],
+ ["ec919c", "ec9188e186bb"],
+ ["ec919d", "e1848ae185ade186bc"],
+ ["ec919d", "ec9188e186bc"],
+ ["ec919e", "e1848ae185ade186bd"],
+ ["ec919e", "ec9188e186bd"],
+ ["ec919f", "e1848ae185ade186be"],
+ ["ec919f", "ec9188e186be"],
+ ["ec91a0", "e1848ae185ade186bf"],
+ ["ec91a0", "ec9188e186bf"],
+ ["ec91a1", "e1848ae185ade18780"],
+ ["ec91a1", "ec9188e18780"],
+ ["ec91a2", "e1848ae185ade18781"],
+ ["ec91a2", "ec9188e18781"],
+ ["ec91a3", "e1848ae185ade18782"],
+ ["ec91a3", "ec9188e18782"],
+ ["ec91a4", "e1848ae185ae"],
+ ["ec91a5", "e1848ae185aee186a8"],
+ ["ec91a5", "ec91a4e186a8"],
+ ["ec91a6", "e1848ae185aee186a9"],
+ ["ec91a6", "ec91a4e186a9"],
+ ["ec91a7", "e1848ae185aee186aa"],
+ ["ec91a7", "ec91a4e186aa"],
+ ["ec91a8", "e1848ae185aee186ab"],
+ ["ec91a8", "ec91a4e186ab"],
+ ["ec91a9", "e1848ae185aee186ac"],
+ ["ec91a9", "ec91a4e186ac"],
+ ["ec91aa", "e1848ae185aee186ad"],
+ ["ec91aa", "ec91a4e186ad"],
+ ["ec91ab", "e1848ae185aee186ae"],
+ ["ec91ab", "ec91a4e186ae"],
+ ["ec91ac", "e1848ae185aee186af"],
+ ["ec91ac", "ec91a4e186af"],
+ ["ec91ad", "e1848ae185aee186b0"],
+ ["ec91ad", "ec91a4e186b0"],
+ ["ec91ae", "e1848ae185aee186b1"],
+ ["ec91ae", "ec91a4e186b1"],
+ ["ec91af", "e1848ae185aee186b2"],
+ ["ec91af", "ec91a4e186b2"],
+ ["ec91b0", "e1848ae185aee186b3"],
+ ["ec91b0", "ec91a4e186b3"],
+ ["ec91b1", "e1848ae185aee186b4"],
+ ["ec91b1", "ec91a4e186b4"],
+ ["ec91b2", "e1848ae185aee186b5"],
+ ["ec91b2", "ec91a4e186b5"],
+ ["ec91b3", "e1848ae185aee186b6"],
+ ["ec91b3", "ec91a4e186b6"],
+ ["ec91b4", "e1848ae185aee186b7"],
+ ["ec91b4", "ec91a4e186b7"],
+ ["ec91b5", "e1848ae185aee186b8"],
+ ["ec91b5", "ec91a4e186b8"],
+ ["ec91b6", "e1848ae185aee186b9"],
+ ["ec91b6", "ec91a4e186b9"],
+ ["ec91b7", "e1848ae185aee186ba"],
+ ["ec91b7", "ec91a4e186ba"],
+ ["ec91b8", "e1848ae185aee186bb"],
+ ["ec91b8", "ec91a4e186bb"],
+ ["ec91b9", "e1848ae185aee186bc"],
+ ["ec91b9", "ec91a4e186bc"],
+ ["ec91ba", "e1848ae185aee186bd"],
+ ["ec91ba", "ec91a4e186bd"],
+ ["ec91bb", "e1848ae185aee186be"],
+ ["ec91bb", "ec91a4e186be"],
+ ["ec91bc", "e1848ae185aee186bf"],
+ ["ec91bc", "ec91a4e186bf"],
+ ["ec91bd", "e1848ae185aee18780"],
+ ["ec91bd", "ec91a4e18780"],
+ ["ec91be", "e1848ae185aee18781"],
+ ["ec91be", "ec91a4e18781"],
+ ["ec91bf", "e1848ae185aee18782"],
+ ["ec91bf", "ec91a4e18782"],
+ ["ec9280", "e1848ae185af"],
+ ["ec9281", "e1848ae185afe186a8"],
+ ["ec9281", "ec9280e186a8"],
+ ["ec9282", "e1848ae185afe186a9"],
+ ["ec9282", "ec9280e186a9"],
+ ["ec9283", "e1848ae185afe186aa"],
+ ["ec9283", "ec9280e186aa"],
+ ["ec9284", "e1848ae185afe186ab"],
+ ["ec9284", "ec9280e186ab"],
+ ["ec9285", "e1848ae185afe186ac"],
+ ["ec9285", "ec9280e186ac"],
+ ["ec9286", "e1848ae185afe186ad"],
+ ["ec9286", "ec9280e186ad"],
+ ["ec9287", "e1848ae185afe186ae"],
+ ["ec9287", "ec9280e186ae"],
+ ["ec9288", "e1848ae185afe186af"],
+ ["ec9288", "ec9280e186af"],
+ ["ec9289", "e1848ae185afe186b0"],
+ ["ec9289", "ec9280e186b0"],
+ ["ec928a", "e1848ae185afe186b1"],
+ ["ec928a", "ec9280e186b1"],
+ ["ec928b", "e1848ae185afe186b2"],
+ ["ec928b", "ec9280e186b2"],
+ ["ec928c", "e1848ae185afe186b3"],
+ ["ec928c", "ec9280e186b3"],
+ ["ec928d", "e1848ae185afe186b4"],
+ ["ec928d", "ec9280e186b4"],
+ ["ec928e", "e1848ae185afe186b5"],
+ ["ec928e", "ec9280e186b5"],
+ ["ec928f", "e1848ae185afe186b6"],
+ ["ec928f", "ec9280e186b6"],
+ ["ec9290", "e1848ae185afe186b7"],
+ ["ec9290", "ec9280e186b7"],
+ ["ec9291", "e1848ae185afe186b8"],
+ ["ec9291", "ec9280e186b8"],
+ ["ec9292", "e1848ae185afe186b9"],
+ ["ec9292", "ec9280e186b9"],
+ ["ec9293", "e1848ae185afe186ba"],
+ ["ec9293", "ec9280e186ba"],
+ ["ec9294", "e1848ae185afe186bb"],
+ ["ec9294", "ec9280e186bb"],
+ ["ec9295", "e1848ae185afe186bc"],
+ ["ec9295", "ec9280e186bc"],
+ ["ec9296", "e1848ae185afe186bd"],
+ ["ec9296", "ec9280e186bd"],
+ ["ec9297", "e1848ae185afe186be"],
+ ["ec9297", "ec9280e186be"],
+ ["ec9298", "e1848ae185afe186bf"],
+ ["ec9298", "ec9280e186bf"],
+ ["ec9299", "e1848ae185afe18780"],
+ ["ec9299", "ec9280e18780"],
+ ["ec929a", "e1848ae185afe18781"],
+ ["ec929a", "ec9280e18781"],
+ ["ec929b", "e1848ae185afe18782"],
+ ["ec929b", "ec9280e18782"],
+ ["ec929c", "e1848ae185b0"],
+ ["ec929d", "e1848ae185b0e186a8"],
+ ["ec929d", "ec929ce186a8"],
+ ["ec929e", "e1848ae185b0e186a9"],
+ ["ec929e", "ec929ce186a9"],
+ ["ec929f", "e1848ae185b0e186aa"],
+ ["ec929f", "ec929ce186aa"],
+ ["ec92a0", "e1848ae185b0e186ab"],
+ ["ec92a0", "ec929ce186ab"],
+ ["ec92a1", "e1848ae185b0e186ac"],
+ ["ec92a1", "ec929ce186ac"],
+ ["ec92a2", "e1848ae185b0e186ad"],
+ ["ec92a2", "ec929ce186ad"],
+ ["ec92a3", "e1848ae185b0e186ae"],
+ ["ec92a3", "ec929ce186ae"],
+ ["ec92a4", "e1848ae185b0e186af"],
+ ["ec92a4", "ec929ce186af"],
+ ["ec92a5", "e1848ae185b0e186b0"],
+ ["ec92a5", "ec929ce186b0"],
+ ["ec92a6", "e1848ae185b0e186b1"],
+ ["ec92a6", "ec929ce186b1"],
+ ["ec92a7", "e1848ae185b0e186b2"],
+ ["ec92a7", "ec929ce186b2"],
+ ["ec92a8", "e1848ae185b0e186b3"],
+ ["ec92a8", "ec929ce186b3"],
+ ["ec92a9", "e1848ae185b0e186b4"],
+ ["ec92a9", "ec929ce186b4"],
+ ["ec92aa", "e1848ae185b0e186b5"],
+ ["ec92aa", "ec929ce186b5"],
+ ["ec92ab", "e1848ae185b0e186b6"],
+ ["ec92ab", "ec929ce186b6"],
+ ["ec92ac", "e1848ae185b0e186b7"],
+ ["ec92ac", "ec929ce186b7"],
+ ["ec92ad", "e1848ae185b0e186b8"],
+ ["ec92ad", "ec929ce186b8"],
+ ["ec92ae", "e1848ae185b0e186b9"],
+ ["ec92ae", "ec929ce186b9"],
+ ["ec92af", "e1848ae185b0e186ba"],
+ ["ec92af", "ec929ce186ba"],
+ ["ec92b0", "e1848ae185b0e186bb"],
+ ["ec92b0", "ec929ce186bb"],
+ ["ec92b1", "e1848ae185b0e186bc"],
+ ["ec92b1", "ec929ce186bc"],
+ ["ec92b2", "e1848ae185b0e186bd"],
+ ["ec92b2", "ec929ce186bd"],
+ ["ec92b3", "e1848ae185b0e186be"],
+ ["ec92b3", "ec929ce186be"],
+ ["ec92b4", "e1848ae185b0e186bf"],
+ ["ec92b4", "ec929ce186bf"],
+ ["ec92b5", "e1848ae185b0e18780"],
+ ["ec92b5", "ec929ce18780"],
+ ["ec92b6", "e1848ae185b0e18781"],
+ ["ec92b6", "ec929ce18781"],
+ ["ec92b7", "e1848ae185b0e18782"],
+ ["ec92b7", "ec929ce18782"],
+ ["ec92b8", "e1848ae185b1"],
+ ["ec92b9", "e1848ae185b1e186a8"],
+ ["ec92b9", "ec92b8e186a8"],
+ ["ec92ba", "e1848ae185b1e186a9"],
+ ["ec92ba", "ec92b8e186a9"],
+ ["ec92bb", "e1848ae185b1e186aa"],
+ ["ec92bb", "ec92b8e186aa"],
+ ["ec92bc", "e1848ae185b1e186ab"],
+ ["ec92bc", "ec92b8e186ab"],
+ ["ec92bd", "e1848ae185b1e186ac"],
+ ["ec92bd", "ec92b8e186ac"],
+ ["ec92be", "e1848ae185b1e186ad"],
+ ["ec92be", "ec92b8e186ad"],
+ ["ec92bf", "e1848ae185b1e186ae"],
+ ["ec92bf", "ec92b8e186ae"],
+ ["ec9380", "e1848ae185b1e186af"],
+ ["ec9380", "ec92b8e186af"],
+ ["ec9381", "e1848ae185b1e186b0"],
+ ["ec9381", "ec92b8e186b0"],
+ ["ec9382", "e1848ae185b1e186b1"],
+ ["ec9382", "ec92b8e186b1"],
+ ["ec9383", "e1848ae185b1e186b2"],
+ ["ec9383", "ec92b8e186b2"],
+ ["ec9384", "e1848ae185b1e186b3"],
+ ["ec9384", "ec92b8e186b3"],
+ ["ec9385", "e1848ae185b1e186b4"],
+ ["ec9385", "ec92b8e186b4"],
+ ["ec9386", "e1848ae185b1e186b5"],
+ ["ec9386", "ec92b8e186b5"],
+ ["ec9387", "e1848ae185b1e186b6"],
+ ["ec9387", "ec92b8e186b6"],
+ ["ec9388", "e1848ae185b1e186b7"],
+ ["ec9388", "ec92b8e186b7"],
+ ["ec9389", "e1848ae185b1e186b8"],
+ ["ec9389", "ec92b8e186b8"],
+ ["ec938a", "e1848ae185b1e186b9"],
+ ["ec938a", "ec92b8e186b9"],
+ ["ec938b", "e1848ae185b1e186ba"],
+ ["ec938b", "ec92b8e186ba"],
+ ["ec938c", "e1848ae185b1e186bb"],
+ ["ec938c", "ec92b8e186bb"],
+ ["ec938d", "e1848ae185b1e186bc"],
+ ["ec938d", "ec92b8e186bc"],
+ ["ec938e", "e1848ae185b1e186bd"],
+ ["ec938e", "ec92b8e186bd"],
+ ["ec938f", "e1848ae185b1e186be"],
+ ["ec938f", "ec92b8e186be"],
+ ["ec9390", "e1848ae185b1e186bf"],
+ ["ec9390", "ec92b8e186bf"],
+ ["ec9391", "e1848ae185b1e18780"],
+ ["ec9391", "ec92b8e18780"],
+ ["ec9392", "e1848ae185b1e18781"],
+ ["ec9392", "ec92b8e18781"],
+ ["ec9393", "e1848ae185b1e18782"],
+ ["ec9393", "ec92b8e18782"],
+ ["ec9394", "e1848ae185b2"],
+ ["ec9395", "e1848ae185b2e186a8"],
+ ["ec9395", "ec9394e186a8"],
+ ["ec9396", "e1848ae185b2e186a9"],
+ ["ec9396", "ec9394e186a9"],
+ ["ec9397", "e1848ae185b2e186aa"],
+ ["ec9397", "ec9394e186aa"],
+ ["ec9398", "e1848ae185b2e186ab"],
+ ["ec9398", "ec9394e186ab"],
+ ["ec9399", "e1848ae185b2e186ac"],
+ ["ec9399", "ec9394e186ac"],
+ ["ec939a", "e1848ae185b2e186ad"],
+ ["ec939a", "ec9394e186ad"],
+ ["ec939b", "e1848ae185b2e186ae"],
+ ["ec939b", "ec9394e186ae"],
+ ["ec939c", "e1848ae185b2e186af"],
+ ["ec939c", "ec9394e186af"],
+ ["ec939d", "e1848ae185b2e186b0"],
+ ["ec939d", "ec9394e186b0"],
+ ["ec939e", "e1848ae185b2e186b1"],
+ ["ec939e", "ec9394e186b1"],
+ ["ec939f", "e1848ae185b2e186b2"],
+ ["ec939f", "ec9394e186b2"],
+ ["ec93a0", "e1848ae185b2e186b3"],
+ ["ec93a0", "ec9394e186b3"],
+ ["ec93a1", "e1848ae185b2e186b4"],
+ ["ec93a1", "ec9394e186b4"],
+ ["ec93a2", "e1848ae185b2e186b5"],
+ ["ec93a2", "ec9394e186b5"],
+ ["ec93a3", "e1848ae185b2e186b6"],
+ ["ec93a3", "ec9394e186b6"],
+ ["ec93a4", "e1848ae185b2e186b7"],
+ ["ec93a4", "ec9394e186b7"],
+ ["ec93a5", "e1848ae185b2e186b8"],
+ ["ec93a5", "ec9394e186b8"],
+ ["ec93a6", "e1848ae185b2e186b9"],
+ ["ec93a6", "ec9394e186b9"],
+ ["ec93a7", "e1848ae185b2e186ba"],
+ ["ec93a7", "ec9394e186ba"],
+ ["ec93a8", "e1848ae185b2e186bb"],
+ ["ec93a8", "ec9394e186bb"],
+ ["ec93a9", "e1848ae185b2e186bc"],
+ ["ec93a9", "ec9394e186bc"],
+ ["ec93aa", "e1848ae185b2e186bd"],
+ ["ec93aa", "ec9394e186bd"],
+ ["ec93ab", "e1848ae185b2e186be"],
+ ["ec93ab", "ec9394e186be"],
+ ["ec93ac", "e1848ae185b2e186bf"],
+ ["ec93ac", "ec9394e186bf"],
+ ["ec93ad", "e1848ae185b2e18780"],
+ ["ec93ad", "ec9394e18780"],
+ ["ec93ae", "e1848ae185b2e18781"],
+ ["ec93ae", "ec9394e18781"],
+ ["ec93af", "e1848ae185b2e18782"],
+ ["ec93af", "ec9394e18782"],
+ ["ec93b0", "e1848ae185b3"],
+ ["ec93b1", "e1848ae185b3e186a8"],
+ ["ec93b1", "ec93b0e186a8"],
+ ["ec93b2", "e1848ae185b3e186a9"],
+ ["ec93b2", "ec93b0e186a9"],
+ ["ec93b3", "e1848ae185b3e186aa"],
+ ["ec93b3", "ec93b0e186aa"],
+ ["ec93b4", "e1848ae185b3e186ab"],
+ ["ec93b4", "ec93b0e186ab"],
+ ["ec93b5", "e1848ae185b3e186ac"],
+ ["ec93b5", "ec93b0e186ac"],
+ ["ec93b6", "e1848ae185b3e186ad"],
+ ["ec93b6", "ec93b0e186ad"],
+ ["ec93b7", "e1848ae185b3e186ae"],
+ ["ec93b7", "ec93b0e186ae"],
+ ["ec93b8", "e1848ae185b3e186af"],
+ ["ec93b8", "ec93b0e186af"],
+ ["ec93b9", "e1848ae185b3e186b0"],
+ ["ec93b9", "ec93b0e186b0"],
+ ["ec93ba", "e1848ae185b3e186b1"],
+ ["ec93ba", "ec93b0e186b1"],
+ ["ec93bb", "e1848ae185b3e186b2"],
+ ["ec93bb", "ec93b0e186b2"],
+ ["ec93bc", "e1848ae185b3e186b3"],
+ ["ec93bc", "ec93b0e186b3"],
+ ["ec93bd", "e1848ae185b3e186b4"],
+ ["ec93bd", "ec93b0e186b4"],
+ ["ec93be", "e1848ae185b3e186b5"],
+ ["ec93be", "ec93b0e186b5"],
+ ["ec93bf", "e1848ae185b3e186b6"],
+ ["ec93bf", "ec93b0e186b6"],
+ ["ec9480", "e1848ae185b3e186b7"],
+ ["ec9480", "ec93b0e186b7"],
+ ["ec9481", "e1848ae185b3e186b8"],
+ ["ec9481", "ec93b0e186b8"],
+ ["ec9482", "e1848ae185b3e186b9"],
+ ["ec9482", "ec93b0e186b9"],
+ ["ec9483", "e1848ae185b3e186ba"],
+ ["ec9483", "ec93b0e186ba"],
+ ["ec9484", "e1848ae185b3e186bb"],
+ ["ec9484", "ec93b0e186bb"],
+ ["ec9485", "e1848ae185b3e186bc"],
+ ["ec9485", "ec93b0e186bc"],
+ ["ec9486", "e1848ae185b3e186bd"],
+ ["ec9486", "ec93b0e186bd"],
+ ["ec9487", "e1848ae185b3e186be"],
+ ["ec9487", "ec93b0e186be"],
+ ["ec9488", "e1848ae185b3e186bf"],
+ ["ec9488", "ec93b0e186bf"],
+ ["ec9489", "e1848ae185b3e18780"],
+ ["ec9489", "ec93b0e18780"],
+ ["ec948a", "e1848ae185b3e18781"],
+ ["ec948a", "ec93b0e18781"],
+ ["ec948b", "e1848ae185b3e18782"],
+ ["ec948b", "ec93b0e18782"],
+ ["ec948c", "e1848ae185b4"],
+ ["ec948d", "e1848ae185b4e186a8"],
+ ["ec948d", "ec948ce186a8"],
+ ["ec948e", "e1848ae185b4e186a9"],
+ ["ec948e", "ec948ce186a9"],
+ ["ec948f", "e1848ae185b4e186aa"],
+ ["ec948f", "ec948ce186aa"],
+ ["ec9490", "e1848ae185b4e186ab"],
+ ["ec9490", "ec948ce186ab"],
+ ["ec9491", "e1848ae185b4e186ac"],
+ ["ec9491", "ec948ce186ac"],
+ ["ec9492", "e1848ae185b4e186ad"],
+ ["ec9492", "ec948ce186ad"],
+ ["ec9493", "e1848ae185b4e186ae"],
+ ["ec9493", "ec948ce186ae"],
+ ["ec9494", "e1848ae185b4e186af"],
+ ["ec9494", "ec948ce186af"],
+ ["ec9495", "e1848ae185b4e186b0"],
+ ["ec9495", "ec948ce186b0"],
+ ["ec9496", "e1848ae185b4e186b1"],
+ ["ec9496", "ec948ce186b1"],
+ ["ec9497", "e1848ae185b4e186b2"],
+ ["ec9497", "ec948ce186b2"],
+ ["ec9498", "e1848ae185b4e186b3"],
+ ["ec9498", "ec948ce186b3"],
+ ["ec9499", "e1848ae185b4e186b4"],
+ ["ec9499", "ec948ce186b4"],
+ ["ec949a", "e1848ae185b4e186b5"],
+ ["ec949a", "ec948ce186b5"],
+ ["ec949b", "e1848ae185b4e186b6"],
+ ["ec949b", "ec948ce186b6"],
+ ["ec949c", "e1848ae185b4e186b7"],
+ ["ec949c", "ec948ce186b7"],
+ ["ec949d", "e1848ae185b4e186b8"],
+ ["ec949d", "ec948ce186b8"],
+ ["ec949e", "e1848ae185b4e186b9"],
+ ["ec949e", "ec948ce186b9"],
+ ["ec949f", "e1848ae185b4e186ba"],
+ ["ec949f", "ec948ce186ba"],
+ ["ec94a0", "e1848ae185b4e186bb"],
+ ["ec94a0", "ec948ce186bb"],
+ ["ec94a1", "e1848ae185b4e186bc"],
+ ["ec94a1", "ec948ce186bc"],
+ ["ec94a2", "e1848ae185b4e186bd"],
+ ["ec94a2", "ec948ce186bd"],
+ ["ec94a3", "e1848ae185b4e186be"],
+ ["ec94a3", "ec948ce186be"],
+ ["ec94a4", "e1848ae185b4e186bf"],
+ ["ec94a4", "ec948ce186bf"],
+ ["ec94a5", "e1848ae185b4e18780"],
+ ["ec94a5", "ec948ce18780"],
+ ["ec94a6", "e1848ae185b4e18781"],
+ ["ec94a6", "ec948ce18781"],
+ ["ec94a7", "e1848ae185b4e18782"],
+ ["ec94a7", "ec948ce18782"],
+ ["ec94a8", "e1848ae185b5"],
+ ["ec94a9", "e1848ae185b5e186a8"],
+ ["ec94a9", "ec94a8e186a8"],
+ ["ec94aa", "e1848ae185b5e186a9"],
+ ["ec94aa", "ec94a8e186a9"],
+ ["ec94ab", "e1848ae185b5e186aa"],
+ ["ec94ab", "ec94a8e186aa"],
+ ["ec94ac", "e1848ae185b5e186ab"],
+ ["ec94ac", "ec94a8e186ab"],
+ ["ec94ad", "e1848ae185b5e186ac"],
+ ["ec94ad", "ec94a8e186ac"],
+ ["ec94ae", "e1848ae185b5e186ad"],
+ ["ec94ae", "ec94a8e186ad"],
+ ["ec94af", "e1848ae185b5e186ae"],
+ ["ec94af", "ec94a8e186ae"],
+ ["ec94b0", "e1848ae185b5e186af"],
+ ["ec94b0", "ec94a8e186af"],
+ ["ec94b1", "e1848ae185b5e186b0"],
+ ["ec94b1", "ec94a8e186b0"],
+ ["ec94b2", "e1848ae185b5e186b1"],
+ ["ec94b2", "ec94a8e186b1"],
+ ["ec94b3", "e1848ae185b5e186b2"],
+ ["ec94b3", "ec94a8e186b2"],
+ ["ec94b4", "e1848ae185b5e186b3"],
+ ["ec94b4", "ec94a8e186b3"],
+ ["ec94b5", "e1848ae185b5e186b4"],
+ ["ec94b5", "ec94a8e186b4"],
+ ["ec94b6", "e1848ae185b5e186b5"],
+ ["ec94b6", "ec94a8e186b5"],
+ ["ec94b7", "e1848ae185b5e186b6"],
+ ["ec94b7", "ec94a8e186b6"],
+ ["ec94b8", "e1848ae185b5e186b7"],
+ ["ec94b8", "ec94a8e186b7"],
+ ["ec94b9", "e1848ae185b5e186b8"],
+ ["ec94b9", "ec94a8e186b8"],
+ ["ec94ba", "e1848ae185b5e186b9"],
+ ["ec94ba", "ec94a8e186b9"],
+ ["ec94bb", "e1848ae185b5e186ba"],
+ ["ec94bb", "ec94a8e186ba"],
+ ["ec94bc", "e1848ae185b5e186bb"],
+ ["ec94bc", "ec94a8e186bb"],
+ ["ec94bd", "e1848ae185b5e186bc"],
+ ["ec94bd", "ec94a8e186bc"],
+ ["ec94be", "e1848ae185b5e186bd"],
+ ["ec94be", "ec94a8e186bd"],
+ ["ec94bf", "e1848ae185b5e186be"],
+ ["ec94bf", "ec94a8e186be"],
+ ["ec9580", "e1848ae185b5e186bf"],
+ ["ec9580", "ec94a8e186bf"],
+ ["ec9581", "e1848ae185b5e18780"],
+ ["ec9581", "ec94a8e18780"],
+ ["ec9582", "e1848ae185b5e18781"],
+ ["ec9582", "ec94a8e18781"],
+ ["ec9583", "e1848ae185b5e18782"],
+ ["ec9583", "ec94a8e18782"],
+ ["ec9584", "e1848be185a1"],
+ ["ec9585", "e1848be185a1e186a8"],
+ ["ec9585", "ec9584e186a8"],
+ ["ec9586", "e1848be185a1e186a9"],
+ ["ec9586", "ec9584e186a9"],
+ ["ec9587", "e1848be185a1e186aa"],
+ ["ec9587", "ec9584e186aa"],
+ ["ec9588", "e1848be185a1e186ab"],
+ ["ec9588", "ec9584e186ab"],
+ ["ec9589", "e1848be185a1e186ac"],
+ ["ec9589", "ec9584e186ac"],
+ ["ec958a", "e1848be185a1e186ad"],
+ ["ec958a", "ec9584e186ad"],
+ ["ec958b", "e1848be185a1e186ae"],
+ ["ec958b", "ec9584e186ae"],
+ ["ec958c", "e1848be185a1e186af"],
+ ["ec958c", "ec9584e186af"],
+ ["ec958d", "e1848be185a1e186b0"],
+ ["ec958d", "ec9584e186b0"],
+ ["ec958e", "e1848be185a1e186b1"],
+ ["ec958e", "ec9584e186b1"],
+ ["ec958f", "e1848be185a1e186b2"],
+ ["ec958f", "ec9584e186b2"],
+ ["ec9590", "e1848be185a1e186b3"],
+ ["ec9590", "ec9584e186b3"],
+ ["ec9591", "e1848be185a1e186b4"],
+ ["ec9591", "ec9584e186b4"],
+ ["ec9592", "e1848be185a1e186b5"],
+ ["ec9592", "ec9584e186b5"],
+ ["ec9593", "e1848be185a1e186b6"],
+ ["ec9593", "ec9584e186b6"],
+ ["ec9594", "e1848be185a1e186b7"],
+ ["ec9594", "ec9584e186b7"],
+ ["ec9595", "e1848be185a1e186b8"],
+ ["ec9595", "ec9584e186b8"],
+ ["ec9596", "e1848be185a1e186b9"],
+ ["ec9596", "ec9584e186b9"],
+ ["ec9597", "e1848be185a1e186ba"],
+ ["ec9597", "ec9584e186ba"],
+ ["ec9598", "e1848be185a1e186bb"],
+ ["ec9598", "ec9584e186bb"],
+ ["ec9599", "e1848be185a1e186bc"],
+ ["ec9599", "ec9584e186bc"],
+ ["ec959a", "e1848be185a1e186bd"],
+ ["ec959a", "ec9584e186bd"],
+ ["ec959b", "e1848be185a1e186be"],
+ ["ec959b", "ec9584e186be"],
+ ["ec959c", "e1848be185a1e186bf"],
+ ["ec959c", "ec9584e186bf"],
+ ["ec959d", "e1848be185a1e18780"],
+ ["ec959d", "ec9584e18780"],
+ ["ec959e", "e1848be185a1e18781"],
+ ["ec959e", "ec9584e18781"],
+ ["ec959f", "e1848be185a1e18782"],
+ ["ec959f", "ec9584e18782"],
+ ["ec95a0", "e1848be185a2"],
+ ["ec95a1", "e1848be185a2e186a8"],
+ ["ec95a1", "ec95a0e186a8"],
+ ["ec95a2", "e1848be185a2e186a9"],
+ ["ec95a2", "ec95a0e186a9"],
+ ["ec95a3", "e1848be185a2e186aa"],
+ ["ec95a3", "ec95a0e186aa"],
+ ["ec95a4", "e1848be185a2e186ab"],
+ ["ec95a4", "ec95a0e186ab"],
+ ["ec95a5", "e1848be185a2e186ac"],
+ ["ec95a5", "ec95a0e186ac"],
+ ["ec95a6", "e1848be185a2e186ad"],
+ ["ec95a6", "ec95a0e186ad"],
+ ["ec95a7", "e1848be185a2e186ae"],
+ ["ec95a7", "ec95a0e186ae"],
+ ["ec95a8", "e1848be185a2e186af"],
+ ["ec95a8", "ec95a0e186af"],
+ ["ec95a9", "e1848be185a2e186b0"],
+ ["ec95a9", "ec95a0e186b0"],
+ ["ec95aa", "e1848be185a2e186b1"],
+ ["ec95aa", "ec95a0e186b1"],
+ ["ec95ab", "e1848be185a2e186b2"],
+ ["ec95ab", "ec95a0e186b2"],
+ ["ec95ac", "e1848be185a2e186b3"],
+ ["ec95ac", "ec95a0e186b3"],
+ ["ec95ad", "e1848be185a2e186b4"],
+ ["ec95ad", "ec95a0e186b4"],
+ ["ec95ae", "e1848be185a2e186b5"],
+ ["ec95ae", "ec95a0e186b5"],
+ ["ec95af", "e1848be185a2e186b6"],
+ ["ec95af", "ec95a0e186b6"],
+ ["ec95b0", "e1848be185a2e186b7"],
+ ["ec95b0", "ec95a0e186b7"],
+ ["ec95b1", "e1848be185a2e186b8"],
+ ["ec95b1", "ec95a0e186b8"],
+ ["ec95b2", "e1848be185a2e186b9"],
+ ["ec95b2", "ec95a0e186b9"],
+ ["ec95b3", "e1848be185a2e186ba"],
+ ["ec95b3", "ec95a0e186ba"],
+ ["ec95b4", "e1848be185a2e186bb"],
+ ["ec95b4", "ec95a0e186bb"],
+ ["ec95b5", "e1848be185a2e186bc"],
+ ["ec95b5", "ec95a0e186bc"],
+ ["ec95b6", "e1848be185a2e186bd"],
+ ["ec95b6", "ec95a0e186bd"],
+ ["ec95b7", "e1848be185a2e186be"],
+ ["ec95b7", "ec95a0e186be"],
+ ["ec95b8", "e1848be185a2e186bf"],
+ ["ec95b8", "ec95a0e186bf"],
+ ["ec95b9", "e1848be185a2e18780"],
+ ["ec95b9", "ec95a0e18780"],
+ ["ec95ba", "e1848be185a2e18781"],
+ ["ec95ba", "ec95a0e18781"],
+ ["ec95bb", "e1848be185a2e18782"],
+ ["ec95bb", "ec95a0e18782"],
+ ["ec95bc", "e1848be185a3"],
+ ["ec95bd", "e1848be185a3e186a8"],
+ ["ec95bd", "ec95bce186a8"],
+ ["ec95be", "e1848be185a3e186a9"],
+ ["ec95be", "ec95bce186a9"],
+ ["ec95bf", "e1848be185a3e186aa"],
+ ["ec95bf", "ec95bce186aa"],
+ ["ec9680", "e1848be185a3e186ab"],
+ ["ec9680", "ec95bce186ab"],
+ ["ec9681", "e1848be185a3e186ac"],
+ ["ec9681", "ec95bce186ac"],
+ ["ec9682", "e1848be185a3e186ad"],
+ ["ec9682", "ec95bce186ad"],
+ ["ec9683", "e1848be185a3e186ae"],
+ ["ec9683", "ec95bce186ae"],
+ ["ec9684", "e1848be185a3e186af"],
+ ["ec9684", "ec95bce186af"],
+ ["ec9685", "e1848be185a3e186b0"],
+ ["ec9685", "ec95bce186b0"],
+ ["ec9686", "e1848be185a3e186b1"],
+ ["ec9686", "ec95bce186b1"],
+ ["ec9687", "e1848be185a3e186b2"],
+ ["ec9687", "ec95bce186b2"],
+ ["ec9688", "e1848be185a3e186b3"],
+ ["ec9688", "ec95bce186b3"],
+ ["ec9689", "e1848be185a3e186b4"],
+ ["ec9689", "ec95bce186b4"],
+ ["ec968a", "e1848be185a3e186b5"],
+ ["ec968a", "ec95bce186b5"],
+ ["ec968b", "e1848be185a3e186b6"],
+ ["ec968b", "ec95bce186b6"],
+ ["ec968c", "e1848be185a3e186b7"],
+ ["ec968c", "ec95bce186b7"],
+ ["ec968d", "e1848be185a3e186b8"],
+ ["ec968d", "ec95bce186b8"],
+ ["ec968e", "e1848be185a3e186b9"],
+ ["ec968e", "ec95bce186b9"],
+ ["ec968f", "e1848be185a3e186ba"],
+ ["ec968f", "ec95bce186ba"],
+ ["ec9690", "e1848be185a3e186bb"],
+ ["ec9690", "ec95bce186bb"],
+ ["ec9691", "e1848be185a3e186bc"],
+ ["ec9691", "ec95bce186bc"],
+ ["ec9692", "e1848be185a3e186bd"],
+ ["ec9692", "ec95bce186bd"],
+ ["ec9693", "e1848be185a3e186be"],
+ ["ec9693", "ec95bce186be"],
+ ["ec9694", "e1848be185a3e186bf"],
+ ["ec9694", "ec95bce186bf"],
+ ["ec9695", "e1848be185a3e18780"],
+ ["ec9695", "ec95bce18780"],
+ ["ec9696", "e1848be185a3e18781"],
+ ["ec9696", "ec95bce18781"],
+ ["ec9697", "e1848be185a3e18782"],
+ ["ec9697", "ec95bce18782"],
+ ["ec9698", "e1848be185a4"],
+ ["ec9699", "e1848be185a4e186a8"],
+ ["ec9699", "ec9698e186a8"],
+ ["ec969a", "e1848be185a4e186a9"],
+ ["ec969a", "ec9698e186a9"],
+ ["ec969b", "e1848be185a4e186aa"],
+ ["ec969b", "ec9698e186aa"],
+ ["ec969c", "e1848be185a4e186ab"],
+ ["ec969c", "ec9698e186ab"],
+ ["ec969d", "e1848be185a4e186ac"],
+ ["ec969d", "ec9698e186ac"],
+ ["ec969e", "e1848be185a4e186ad"],
+ ["ec969e", "ec9698e186ad"],
+ ["ec969f", "e1848be185a4e186ae"],
+ ["ec969f", "ec9698e186ae"],
+ ["ec96a0", "e1848be185a4e186af"],
+ ["ec96a0", "ec9698e186af"],
+ ["ec96a1", "e1848be185a4e186b0"],
+ ["ec96a1", "ec9698e186b0"],
+ ["ec96a2", "e1848be185a4e186b1"],
+ ["ec96a2", "ec9698e186b1"],
+ ["ec96a3", "e1848be185a4e186b2"],
+ ["ec96a3", "ec9698e186b2"],
+ ["ec96a4", "e1848be185a4e186b3"],
+ ["ec96a4", "ec9698e186b3"],
+ ["ec96a5", "e1848be185a4e186b4"],
+ ["ec96a5", "ec9698e186b4"],
+ ["ec96a6", "e1848be185a4e186b5"],
+ ["ec96a6", "ec9698e186b5"],
+ ["ec96a7", "e1848be185a4e186b6"],
+ ["ec96a7", "ec9698e186b6"],
+ ["ec96a8", "e1848be185a4e186b7"],
+ ["ec96a8", "ec9698e186b7"],
+ ["ec96a9", "e1848be185a4e186b8"],
+ ["ec96a9", "ec9698e186b8"],
+ ["ec96aa", "e1848be185a4e186b9"],
+ ["ec96aa", "ec9698e186b9"],
+ ["ec96ab", "e1848be185a4e186ba"],
+ ["ec96ab", "ec9698e186ba"],
+ ["ec96ac", "e1848be185a4e186bb"],
+ ["ec96ac", "ec9698e186bb"],
+ ["ec96ad", "e1848be185a4e186bc"],
+ ["ec96ad", "ec9698e186bc"],
+ ["ec96ae", "e1848be185a4e186bd"],
+ ["ec96ae", "ec9698e186bd"],
+ ["ec96af", "e1848be185a4e186be"],
+ ["ec96af", "ec9698e186be"],
+ ["ec96b0", "e1848be185a4e186bf"],
+ ["ec96b0", "ec9698e186bf"],
+ ["ec96b1", "e1848be185a4e18780"],
+ ["ec96b1", "ec9698e18780"],
+ ["ec96b2", "e1848be185a4e18781"],
+ ["ec96b2", "ec9698e18781"],
+ ["ec96b3", "e1848be185a4e18782"],
+ ["ec96b3", "ec9698e18782"],
+ ["ec96b4", "e1848be185a5"],
+ ["ec96b5", "e1848be185a5e186a8"],
+ ["ec96b5", "ec96b4e186a8"],
+ ["ec96b6", "e1848be185a5e186a9"],
+ ["ec96b6", "ec96b4e186a9"],
+ ["ec96b7", "e1848be185a5e186aa"],
+ ["ec96b7", "ec96b4e186aa"],
+ ["ec96b8", "e1848be185a5e186ab"],
+ ["ec96b8", "ec96b4e186ab"],
+ ["ec96b9", "e1848be185a5e186ac"],
+ ["ec96b9", "ec96b4e186ac"],
+ ["ec96ba", "e1848be185a5e186ad"],
+ ["ec96ba", "ec96b4e186ad"],
+ ["ec96bb", "e1848be185a5e186ae"],
+ ["ec96bb", "ec96b4e186ae"],
+ ["ec96bc", "e1848be185a5e186af"],
+ ["ec96bc", "ec96b4e186af"],
+ ["ec96bd", "e1848be185a5e186b0"],
+ ["ec96bd", "ec96b4e186b0"],
+ ["ec96be", "e1848be185a5e186b1"],
+ ["ec96be", "ec96b4e186b1"],
+ ["ec96bf", "e1848be185a5e186b2"],
+ ["ec96bf", "ec96b4e186b2"],
+ ["ec9780", "e1848be185a5e186b3"],
+ ["ec9780", "ec96b4e186b3"],
+ ["ec9781", "e1848be185a5e186b4"],
+ ["ec9781", "ec96b4e186b4"],
+ ["ec9782", "e1848be185a5e186b5"],
+ ["ec9782", "ec96b4e186b5"],
+ ["ec9783", "e1848be185a5e186b6"],
+ ["ec9783", "ec96b4e186b6"],
+ ["ec9784", "e1848be185a5e186b7"],
+ ["ec9784", "ec96b4e186b7"],
+ ["ec9785", "e1848be185a5e186b8"],
+ ["ec9785", "ec96b4e186b8"],
+ ["ec9786", "e1848be185a5e186b9"],
+ ["ec9786", "ec96b4e186b9"],
+ ["ec9787", "e1848be185a5e186ba"],
+ ["ec9787", "ec96b4e186ba"],
+ ["ec9788", "e1848be185a5e186bb"],
+ ["ec9788", "ec96b4e186bb"],
+ ["ec9789", "e1848be185a5e186bc"],
+ ["ec9789", "ec96b4e186bc"],
+ ["ec978a", "e1848be185a5e186bd"],
+ ["ec978a", "ec96b4e186bd"],
+ ["ec978b", "e1848be185a5e186be"],
+ ["ec978b", "ec96b4e186be"],
+ ["ec978c", "e1848be185a5e186bf"],
+ ["ec978c", "ec96b4e186bf"],
+ ["ec978d", "e1848be185a5e18780"],
+ ["ec978d", "ec96b4e18780"],
+ ["ec978e", "e1848be185a5e18781"],
+ ["ec978e", "ec96b4e18781"],
+ ["ec978f", "e1848be185a5e18782"],
+ ["ec978f", "ec96b4e18782"],
+ ["ec9790", "e1848be185a6"],
+ ["ec9791", "e1848be185a6e186a8"],
+ ["ec9791", "ec9790e186a8"],
+ ["ec9792", "e1848be185a6e186a9"],
+ ["ec9792", "ec9790e186a9"],
+ ["ec9793", "e1848be185a6e186aa"],
+ ["ec9793", "ec9790e186aa"],
+ ["ec9794", "e1848be185a6e186ab"],
+ ["ec9794", "ec9790e186ab"],
+ ["ec9795", "e1848be185a6e186ac"],
+ ["ec9795", "ec9790e186ac"],
+ ["ec9796", "e1848be185a6e186ad"],
+ ["ec9796", "ec9790e186ad"],
+ ["ec9797", "e1848be185a6e186ae"],
+ ["ec9797", "ec9790e186ae"],
+ ["ec9798", "e1848be185a6e186af"],
+ ["ec9798", "ec9790e186af"],
+ ["ec9799", "e1848be185a6e186b0"],
+ ["ec9799", "ec9790e186b0"],
+ ["ec979a", "e1848be185a6e186b1"],
+ ["ec979a", "ec9790e186b1"],
+ ["ec979b", "e1848be185a6e186b2"],
+ ["ec979b", "ec9790e186b2"],
+ ["ec979c", "e1848be185a6e186b3"],
+ ["ec979c", "ec9790e186b3"],
+ ["ec979d", "e1848be185a6e186b4"],
+ ["ec979d", "ec9790e186b4"],
+ ["ec979e", "e1848be185a6e186b5"],
+ ["ec979e", "ec9790e186b5"],
+ ["ec979f", "e1848be185a6e186b6"],
+ ["ec979f", "ec9790e186b6"],
+ ["ec97a0", "e1848be185a6e186b7"],
+ ["ec97a0", "ec9790e186b7"],
+ ["ec97a1", "e1848be185a6e186b8"],
+ ["ec97a1", "ec9790e186b8"],
+ ["ec97a2", "e1848be185a6e186b9"],
+ ["ec97a2", "ec9790e186b9"],
+ ["ec97a3", "e1848be185a6e186ba"],
+ ["ec97a3", "ec9790e186ba"],
+ ["ec97a4", "e1848be185a6e186bb"],
+ ["ec97a4", "ec9790e186bb"],
+ ["ec97a5", "e1848be185a6e186bc"],
+ ["ec97a5", "ec9790e186bc"],
+ ["ec97a6", "e1848be185a6e186bd"],
+ ["ec97a6", "ec9790e186bd"],
+ ["ec97a7", "e1848be185a6e186be"],
+ ["ec97a7", "ec9790e186be"],
+ ["ec97a8", "e1848be185a6e186bf"],
+ ["ec97a8", "ec9790e186bf"],
+ ["ec97a9", "e1848be185a6e18780"],
+ ["ec97a9", "ec9790e18780"],
+ ["ec97aa", "e1848be185a6e18781"],
+ ["ec97aa", "ec9790e18781"],
+ ["ec97ab", "e1848be185a6e18782"],
+ ["ec97ab", "ec9790e18782"],
+ ["ec97ac", "e1848be185a7"],
+ ["ec97ad", "e1848be185a7e186a8"],
+ ["ec97ad", "ec97ace186a8"],
+ ["ec97ae", "e1848be185a7e186a9"],
+ ["ec97ae", "ec97ace186a9"],
+ ["ec97af", "e1848be185a7e186aa"],
+ ["ec97af", "ec97ace186aa"],
+ ["ec97b0", "e1848be185a7e186ab"],
+ ["ec97b0", "ec97ace186ab"],
+ ["ec97b1", "e1848be185a7e186ac"],
+ ["ec97b1", "ec97ace186ac"],
+ ["ec97b2", "e1848be185a7e186ad"],
+ ["ec97b2", "ec97ace186ad"],
+ ["ec97b3", "e1848be185a7e186ae"],
+ ["ec97b3", "ec97ace186ae"],
+ ["ec97b4", "e1848be185a7e186af"],
+ ["ec97b4", "ec97ace186af"],
+ ["ec97b5", "e1848be185a7e186b0"],
+ ["ec97b5", "ec97ace186b0"],
+ ["ec97b6", "e1848be185a7e186b1"],
+ ["ec97b6", "ec97ace186b1"],
+ ["ec97b7", "e1848be185a7e186b2"],
+ ["ec97b7", "ec97ace186b2"],
+ ["ec97b8", "e1848be185a7e186b3"],
+ ["ec97b8", "ec97ace186b3"],
+ ["ec97b9", "e1848be185a7e186b4"],
+ ["ec97b9", "ec97ace186b4"],
+ ["ec97ba", "e1848be185a7e186b5"],
+ ["ec97ba", "ec97ace186b5"],
+ ["ec97bb", "e1848be185a7e186b6"],
+ ["ec97bb", "ec97ace186b6"],
+ ["ec97bc", "e1848be185a7e186b7"],
+ ["ec97bc", "ec97ace186b7"],
+ ["ec97bd", "e1848be185a7e186b8"],
+ ["ec97bd", "ec97ace186b8"],
+ ["ec97be", "e1848be185a7e186b9"],
+ ["ec97be", "ec97ace186b9"],
+ ["ec97bf", "e1848be185a7e186ba"],
+ ["ec97bf", "ec97ace186ba"],
+ ["ec9880", "e1848be185a7e186bb"],
+ ["ec9880", "ec97ace186bb"],
+ ["ec9881", "e1848be185a7e186bc"],
+ ["ec9881", "ec97ace186bc"],
+ ["ec9882", "e1848be185a7e186bd"],
+ ["ec9882", "ec97ace186bd"],
+ ["ec9883", "e1848be185a7e186be"],
+ ["ec9883", "ec97ace186be"],
+ ["ec9884", "e1848be185a7e186bf"],
+ ["ec9884", "ec97ace186bf"],
+ ["ec9885", "e1848be185a7e18780"],
+ ["ec9885", "ec97ace18780"],
+ ["ec9886", "e1848be185a7e18781"],
+ ["ec9886", "ec97ace18781"],
+ ["ec9887", "e1848be185a7e18782"],
+ ["ec9887", "ec97ace18782"],
+ ["ec9888", "e1848be185a8"],
+ ["ec9889", "e1848be185a8e186a8"],
+ ["ec9889", "ec9888e186a8"],
+ ["ec988a", "e1848be185a8e186a9"],
+ ["ec988a", "ec9888e186a9"],
+ ["ec988b", "e1848be185a8e186aa"],
+ ["ec988b", "ec9888e186aa"],
+ ["ec988c", "e1848be185a8e186ab"],
+ ["ec988c", "ec9888e186ab"],
+ ["ec988d", "e1848be185a8e186ac"],
+ ["ec988d", "ec9888e186ac"],
+ ["ec988e", "e1848be185a8e186ad"],
+ ["ec988e", "ec9888e186ad"],
+ ["ec988f", "e1848be185a8e186ae"],
+ ["ec988f", "ec9888e186ae"],
+ ["ec9890", "e1848be185a8e186af"],
+ ["ec9890", "ec9888e186af"],
+ ["ec9891", "e1848be185a8e186b0"],
+ ["ec9891", "ec9888e186b0"],
+ ["ec9892", "e1848be185a8e186b1"],
+ ["ec9892", "ec9888e186b1"],
+ ["ec9893", "e1848be185a8e186b2"],
+ ["ec9893", "ec9888e186b2"],
+ ["ec9894", "e1848be185a8e186b3"],
+ ["ec9894", "ec9888e186b3"],
+ ["ec9895", "e1848be185a8e186b4"],
+ ["ec9895", "ec9888e186b4"],
+ ["ec9896", "e1848be185a8e186b5"],
+ ["ec9896", "ec9888e186b5"],
+ ["ec9897", "e1848be185a8e186b6"],
+ ["ec9897", "ec9888e186b6"],
+ ["ec9898", "e1848be185a8e186b7"],
+ ["ec9898", "ec9888e186b7"],
+ ["ec9899", "e1848be185a8e186b8"],
+ ["ec9899", "ec9888e186b8"],
+ ["ec989a", "e1848be185a8e186b9"],
+ ["ec989a", "ec9888e186b9"],
+ ["ec989b", "e1848be185a8e186ba"],
+ ["ec989b", "ec9888e186ba"],
+ ["ec989c", "e1848be185a8e186bb"],
+ ["ec989c", "ec9888e186bb"],
+ ["ec989d", "e1848be185a8e186bc"],
+ ["ec989d", "ec9888e186bc"],
+ ["ec989e", "e1848be185a8e186bd"],
+ ["ec989e", "ec9888e186bd"],
+ ["ec989f", "e1848be185a8e186be"],
+ ["ec989f", "ec9888e186be"],
+ ["ec98a0", "e1848be185a8e186bf"],
+ ["ec98a0", "ec9888e186bf"],
+ ["ec98a1", "e1848be185a8e18780"],
+ ["ec98a1", "ec9888e18780"],
+ ["ec98a2", "e1848be185a8e18781"],
+ ["ec98a2", "ec9888e18781"],
+ ["ec98a3", "e1848be185a8e18782"],
+ ["ec98a3", "ec9888e18782"],
+ ["ec98a4", "e1848be185a9"],
+ ["ec98a5", "e1848be185a9e186a8"],
+ ["ec98a5", "ec98a4e186a8"],
+ ["ec98a6", "e1848be185a9e186a9"],
+ ["ec98a6", "ec98a4e186a9"],
+ ["ec98a7", "e1848be185a9e186aa"],
+ ["ec98a7", "ec98a4e186aa"],
+ ["ec98a8", "e1848be185a9e186ab"],
+ ["ec98a8", "ec98a4e186ab"],
+ ["ec98a9", "e1848be185a9e186ac"],
+ ["ec98a9", "ec98a4e186ac"],
+ ["ec98aa", "e1848be185a9e186ad"],
+ ["ec98aa", "ec98a4e186ad"],
+ ["ec98ab", "e1848be185a9e186ae"],
+ ["ec98ab", "ec98a4e186ae"],
+ ["ec98ac", "e1848be185a9e186af"],
+ ["ec98ac", "ec98a4e186af"],
+ ["ec98ad", "e1848be185a9e186b0"],
+ ["ec98ad", "ec98a4e186b0"],
+ ["ec98ae", "e1848be185a9e186b1"],
+ ["ec98ae", "ec98a4e186b1"],
+ ["ec98af", "e1848be185a9e186b2"],
+ ["ec98af", "ec98a4e186b2"],
+ ["ec98b0", "e1848be185a9e186b3"],
+ ["ec98b0", "ec98a4e186b3"],
+ ["ec98b1", "e1848be185a9e186b4"],
+ ["ec98b1", "ec98a4e186b4"],
+ ["ec98b2", "e1848be185a9e186b5"],
+ ["ec98b2", "ec98a4e186b5"],
+ ["ec98b3", "e1848be185a9e186b6"],
+ ["ec98b3", "ec98a4e186b6"],
+ ["ec98b4", "e1848be185a9e186b7"],
+ ["ec98b4", "ec98a4e186b7"],
+ ["ec98b5", "e1848be185a9e186b8"],
+ ["ec98b5", "ec98a4e186b8"],
+ ["ec98b6", "e1848be185a9e186b9"],
+ ["ec98b6", "ec98a4e186b9"],
+ ["ec98b7", "e1848be185a9e186ba"],
+ ["ec98b7", "ec98a4e186ba"],
+ ["ec98b8", "e1848be185a9e186bb"],
+ ["ec98b8", "ec98a4e186bb"],
+ ["ec98b9", "e1848be185a9e186bc"],
+ ["ec98b9", "ec98a4e186bc"],
+ ["ec98ba", "e1848be185a9e186bd"],
+ ["ec98ba", "ec98a4e186bd"],
+ ["ec98bb", "e1848be185a9e186be"],
+ ["ec98bb", "ec98a4e186be"],
+ ["ec98bc", "e1848be185a9e186bf"],
+ ["ec98bc", "ec98a4e186bf"],
+ ["ec98bd", "e1848be185a9e18780"],
+ ["ec98bd", "ec98a4e18780"],
+ ["ec98be", "e1848be185a9e18781"],
+ ["ec98be", "ec98a4e18781"],
+ ["ec98bf", "e1848be185a9e18782"],
+ ["ec98bf", "ec98a4e18782"],
+ ["ec9980", "e1848be185aa"],
+ ["ec9981", "e1848be185aae186a8"],
+ ["ec9981", "ec9980e186a8"],
+ ["ec9982", "e1848be185aae186a9"],
+ ["ec9982", "ec9980e186a9"],
+ ["ec9983", "e1848be185aae186aa"],
+ ["ec9983", "ec9980e186aa"],
+ ["ec9984", "e1848be185aae186ab"],
+ ["ec9984", "ec9980e186ab"],
+ ["ec9985", "e1848be185aae186ac"],
+ ["ec9985", "ec9980e186ac"],
+ ["ec9986", "e1848be185aae186ad"],
+ ["ec9986", "ec9980e186ad"],
+ ["ec9987", "e1848be185aae186ae"],
+ ["ec9987", "ec9980e186ae"],
+ ["ec9988", "e1848be185aae186af"],
+ ["ec9988", "ec9980e186af"],
+ ["ec9989", "e1848be185aae186b0"],
+ ["ec9989", "ec9980e186b0"],
+ ["ec998a", "e1848be185aae186b1"],
+ ["ec998a", "ec9980e186b1"],
+ ["ec998b", "e1848be185aae186b2"],
+ ["ec998b", "ec9980e186b2"],
+ ["ec998c", "e1848be185aae186b3"],
+ ["ec998c", "ec9980e186b3"],
+ ["ec998d", "e1848be185aae186b4"],
+ ["ec998d", "ec9980e186b4"],
+ ["ec998e", "e1848be185aae186b5"],
+ ["ec998e", "ec9980e186b5"],
+ ["ec998f", "e1848be185aae186b6"],
+ ["ec998f", "ec9980e186b6"],
+ ["ec9990", "e1848be185aae186b7"],
+ ["ec9990", "ec9980e186b7"],
+ ["ec9991", "e1848be185aae186b8"],
+ ["ec9991", "ec9980e186b8"],
+ ["ec9992", "e1848be185aae186b9"],
+ ["ec9992", "ec9980e186b9"],
+ ["ec9993", "e1848be185aae186ba"],
+ ["ec9993", "ec9980e186ba"],
+ ["ec9994", "e1848be185aae186bb"],
+ ["ec9994", "ec9980e186bb"],
+ ["ec9995", "e1848be185aae186bc"],
+ ["ec9995", "ec9980e186bc"],
+ ["ec9996", "e1848be185aae186bd"],
+ ["ec9996", "ec9980e186bd"],
+ ["ec9997", "e1848be185aae186be"],
+ ["ec9997", "ec9980e186be"],
+ ["ec9998", "e1848be185aae186bf"],
+ ["ec9998", "ec9980e186bf"],
+ ["ec9999", "e1848be185aae18780"],
+ ["ec9999", "ec9980e18780"],
+ ["ec999a", "e1848be185aae18781"],
+ ["ec999a", "ec9980e18781"],
+ ["ec999b", "e1848be185aae18782"],
+ ["ec999b", "ec9980e18782"],
+ ["ec999c", "e1848be185ab"],
+ ["ec999d", "e1848be185abe186a8"],
+ ["ec999d", "ec999ce186a8"],
+ ["ec999e", "e1848be185abe186a9"],
+ ["ec999e", "ec999ce186a9"],
+ ["ec999f", "e1848be185abe186aa"],
+ ["ec999f", "ec999ce186aa"],
+ ["ec99a0", "e1848be185abe186ab"],
+ ["ec99a0", "ec999ce186ab"],
+ ["ec99a1", "e1848be185abe186ac"],
+ ["ec99a1", "ec999ce186ac"],
+ ["ec99a2", "e1848be185abe186ad"],
+ ["ec99a2", "ec999ce186ad"],
+ ["ec99a3", "e1848be185abe186ae"],
+ ["ec99a3", "ec999ce186ae"],
+ ["ec99a4", "e1848be185abe186af"],
+ ["ec99a4", "ec999ce186af"],
+ ["ec99a5", "e1848be185abe186b0"],
+ ["ec99a5", "ec999ce186b0"],
+ ["ec99a6", "e1848be185abe186b1"],
+ ["ec99a6", "ec999ce186b1"],
+ ["ec99a7", "e1848be185abe186b2"],
+ ["ec99a7", "ec999ce186b2"],
+ ["ec99a8", "e1848be185abe186b3"],
+ ["ec99a8", "ec999ce186b3"],
+ ["ec99a9", "e1848be185abe186b4"],
+ ["ec99a9", "ec999ce186b4"],
+ ["ec99aa", "e1848be185abe186b5"],
+ ["ec99aa", "ec999ce186b5"],
+ ["ec99ab", "e1848be185abe186b6"],
+ ["ec99ab", "ec999ce186b6"],
+ ["ec99ac", "e1848be185abe186b7"],
+ ["ec99ac", "ec999ce186b7"],
+ ["ec99ad", "e1848be185abe186b8"],
+ ["ec99ad", "ec999ce186b8"],
+ ["ec99ae", "e1848be185abe186b9"],
+ ["ec99ae", "ec999ce186b9"],
+ ["ec99af", "e1848be185abe186ba"],
+ ["ec99af", "ec999ce186ba"],
+ ["ec99b0", "e1848be185abe186bb"],
+ ["ec99b0", "ec999ce186bb"],
+ ["ec99b1", "e1848be185abe186bc"],
+ ["ec99b1", "ec999ce186bc"],
+ ["ec99b2", "e1848be185abe186bd"],
+ ["ec99b2", "ec999ce186bd"],
+ ["ec99b3", "e1848be185abe186be"],
+ ["ec99b3", "ec999ce186be"],
+ ["ec99b4", "e1848be185abe186bf"],
+ ["ec99b4", "ec999ce186bf"],
+ ["ec99b5", "e1848be185abe18780"],
+ ["ec99b5", "ec999ce18780"],
+ ["ec99b6", "e1848be185abe18781"],
+ ["ec99b6", "ec999ce18781"],
+ ["ec99b7", "e1848be185abe18782"],
+ ["ec99b7", "ec999ce18782"],
+ ["ec99b8", "e1848be185ac"],
+ ["ec99b9", "e1848be185ace186a8"],
+ ["ec99b9", "ec99b8e186a8"],
+ ["ec99ba", "e1848be185ace186a9"],
+ ["ec99ba", "ec99b8e186a9"],
+ ["ec99bb", "e1848be185ace186aa"],
+ ["ec99bb", "ec99b8e186aa"],
+ ["ec99bc", "e1848be185ace186ab"],
+ ["ec99bc", "ec99b8e186ab"],
+ ["ec99bd", "e1848be185ace186ac"],
+ ["ec99bd", "ec99b8e186ac"],
+ ["ec99be", "e1848be185ace186ad"],
+ ["ec99be", "ec99b8e186ad"],
+ ["ec99bf", "e1848be185ace186ae"],
+ ["ec99bf", "ec99b8e186ae"],
+ ["ec9a80", "e1848be185ace186af"],
+ ["ec9a80", "ec99b8e186af"],
+ ["ec9a81", "e1848be185ace186b0"],
+ ["ec9a81", "ec99b8e186b0"],
+ ["ec9a82", "e1848be185ace186b1"],
+ ["ec9a82", "ec99b8e186b1"],
+ ["ec9a83", "e1848be185ace186b2"],
+ ["ec9a83", "ec99b8e186b2"],
+ ["ec9a84", "e1848be185ace186b3"],
+ ["ec9a84", "ec99b8e186b3"],
+ ["ec9a85", "e1848be185ace186b4"],
+ ["ec9a85", "ec99b8e186b4"],
+ ["ec9a86", "e1848be185ace186b5"],
+ ["ec9a86", "ec99b8e186b5"],
+ ["ec9a87", "e1848be185ace186b6"],
+ ["ec9a87", "ec99b8e186b6"],
+ ["ec9a88", "e1848be185ace186b7"],
+ ["ec9a88", "ec99b8e186b7"],
+ ["ec9a89", "e1848be185ace186b8"],
+ ["ec9a89", "ec99b8e186b8"],
+ ["ec9a8a", "e1848be185ace186b9"],
+ ["ec9a8a", "ec99b8e186b9"],
+ ["ec9a8b", "e1848be185ace186ba"],
+ ["ec9a8b", "ec99b8e186ba"],
+ ["ec9a8c", "e1848be185ace186bb"],
+ ["ec9a8c", "ec99b8e186bb"],
+ ["ec9a8d", "e1848be185ace186bc"],
+ ["ec9a8d", "ec99b8e186bc"],
+ ["ec9a8e", "e1848be185ace186bd"],
+ ["ec9a8e", "ec99b8e186bd"],
+ ["ec9a8f", "e1848be185ace186be"],
+ ["ec9a8f", "ec99b8e186be"],
+ ["ec9a90", "e1848be185ace186bf"],
+ ["ec9a90", "ec99b8e186bf"],
+ ["ec9a91", "e1848be185ace18780"],
+ ["ec9a91", "ec99b8e18780"],
+ ["ec9a92", "e1848be185ace18781"],
+ ["ec9a92", "ec99b8e18781"],
+ ["ec9a93", "e1848be185ace18782"],
+ ["ec9a93", "ec99b8e18782"],
+ ["ec9a94", "e1848be185ad"],
+ ["ec9a95", "e1848be185ade186a8"],
+ ["ec9a95", "ec9a94e186a8"],
+ ["ec9a96", "e1848be185ade186a9"],
+ ["ec9a96", "ec9a94e186a9"],
+ ["ec9a97", "e1848be185ade186aa"],
+ ["ec9a97", "ec9a94e186aa"],
+ ["ec9a98", "e1848be185ade186ab"],
+ ["ec9a98", "ec9a94e186ab"],
+ ["ec9a99", "e1848be185ade186ac"],
+ ["ec9a99", "ec9a94e186ac"],
+ ["ec9a9a", "e1848be185ade186ad"],
+ ["ec9a9a", "ec9a94e186ad"],
+ ["ec9a9b", "e1848be185ade186ae"],
+ ["ec9a9b", "ec9a94e186ae"],
+ ["ec9a9c", "e1848be185ade186af"],
+ ["ec9a9c", "ec9a94e186af"],
+ ["ec9a9d", "e1848be185ade186b0"],
+ ["ec9a9d", "ec9a94e186b0"],
+ ["ec9a9e", "e1848be185ade186b1"],
+ ["ec9a9e", "ec9a94e186b1"],
+ ["ec9a9f", "e1848be185ade186b2"],
+ ["ec9a9f", "ec9a94e186b2"],
+ ["ec9aa0", "e1848be185ade186b3"],
+ ["ec9aa0", "ec9a94e186b3"],
+ ["ec9aa1", "e1848be185ade186b4"],
+ ["ec9aa1", "ec9a94e186b4"],
+ ["ec9aa2", "e1848be185ade186b5"],
+ ["ec9aa2", "ec9a94e186b5"],
+ ["ec9aa3", "e1848be185ade186b6"],
+ ["ec9aa3", "ec9a94e186b6"],
+ ["ec9aa4", "e1848be185ade186b7"],
+ ["ec9aa4", "ec9a94e186b7"],
+ ["ec9aa5", "e1848be185ade186b8"],
+ ["ec9aa5", "ec9a94e186b8"],
+ ["ec9aa6", "e1848be185ade186b9"],
+ ["ec9aa6", "ec9a94e186b9"],
+ ["ec9aa7", "e1848be185ade186ba"],
+ ["ec9aa7", "ec9a94e186ba"],
+ ["ec9aa8", "e1848be185ade186bb"],
+ ["ec9aa8", "ec9a94e186bb"],
+ ["ec9aa9", "e1848be185ade186bc"],
+ ["ec9aa9", "ec9a94e186bc"],
+ ["ec9aaa", "e1848be185ade186bd"],
+ ["ec9aaa", "ec9a94e186bd"],
+ ["ec9aab", "e1848be185ade186be"],
+ ["ec9aab", "ec9a94e186be"],
+ ["ec9aac", "e1848be185ade186bf"],
+ ["ec9aac", "ec9a94e186bf"],
+ ["ec9aad", "e1848be185ade18780"],
+ ["ec9aad", "ec9a94e18780"],
+ ["ec9aae", "e1848be185ade18781"],
+ ["ec9aae", "ec9a94e18781"],
+ ["ec9aaf", "e1848be185ade18782"],
+ ["ec9aaf", "ec9a94e18782"],
+ ["ec9ab0", "e1848be185ae"],
+ ["ec9ab1", "e1848be185aee186a8"],
+ ["ec9ab1", "ec9ab0e186a8"],
+ ["ec9ab2", "e1848be185aee186a9"],
+ ["ec9ab2", "ec9ab0e186a9"],
+ ["ec9ab3", "e1848be185aee186aa"],
+ ["ec9ab3", "ec9ab0e186aa"],
+ ["ec9ab4", "e1848be185aee186ab"],
+ ["ec9ab4", "ec9ab0e186ab"],
+ ["ec9ab5", "e1848be185aee186ac"],
+ ["ec9ab5", "ec9ab0e186ac"],
+ ["ec9ab6", "e1848be185aee186ad"],
+ ["ec9ab6", "ec9ab0e186ad"],
+ ["ec9ab7", "e1848be185aee186ae"],
+ ["ec9ab7", "ec9ab0e186ae"],
+ ["ec9ab8", "e1848be185aee186af"],
+ ["ec9ab8", "ec9ab0e186af"],
+ ["ec9ab9", "e1848be185aee186b0"],
+ ["ec9ab9", "ec9ab0e186b0"],
+ ["ec9aba", "e1848be185aee186b1"],
+ ["ec9aba", "ec9ab0e186b1"],
+ ["ec9abb", "e1848be185aee186b2"],
+ ["ec9abb", "ec9ab0e186b2"],
+ ["ec9abc", "e1848be185aee186b3"],
+ ["ec9abc", "ec9ab0e186b3"],
+ ["ec9abd", "e1848be185aee186b4"],
+ ["ec9abd", "ec9ab0e186b4"],
+ ["ec9abe", "e1848be185aee186b5"],
+ ["ec9abe", "ec9ab0e186b5"],
+ ["ec9abf", "e1848be185aee186b6"],
+ ["ec9abf", "ec9ab0e186b6"],
+ ["ec9b80", "e1848be185aee186b7"],
+ ["ec9b80", "ec9ab0e186b7"],
+ ["ec9b81", "e1848be185aee186b8"],
+ ["ec9b81", "ec9ab0e186b8"],
+ ["ec9b82", "e1848be185aee186b9"],
+ ["ec9b82", "ec9ab0e186b9"],
+ ["ec9b83", "e1848be185aee186ba"],
+ ["ec9b83", "ec9ab0e186ba"],
+ ["ec9b84", "e1848be185aee186bb"],
+ ["ec9b84", "ec9ab0e186bb"],
+ ["ec9b85", "e1848be185aee186bc"],
+ ["ec9b85", "ec9ab0e186bc"],
+ ["ec9b86", "e1848be185aee186bd"],
+ ["ec9b86", "ec9ab0e186bd"],
+ ["ec9b87", "e1848be185aee186be"],
+ ["ec9b87", "ec9ab0e186be"],
+ ["ec9b88", "e1848be185aee186bf"],
+ ["ec9b88", "ec9ab0e186bf"],
+ ["ec9b89", "e1848be185aee18780"],
+ ["ec9b89", "ec9ab0e18780"],
+ ["ec9b8a", "e1848be185aee18781"],
+ ["ec9b8a", "ec9ab0e18781"],
+ ["ec9b8b", "e1848be185aee18782"],
+ ["ec9b8b", "ec9ab0e18782"],
+ ["ec9b8c", "e1848be185af"],
+ ["ec9b8d", "e1848be185afe186a8"],
+ ["ec9b8d", "ec9b8ce186a8"],
+ ["ec9b8e", "e1848be185afe186a9"],
+ ["ec9b8e", "ec9b8ce186a9"],
+ ["ec9b8f", "e1848be185afe186aa"],
+ ["ec9b8f", "ec9b8ce186aa"],
+ ["ec9b90", "e1848be185afe186ab"],
+ ["ec9b90", "ec9b8ce186ab"],
+ ["ec9b91", "e1848be185afe186ac"],
+ ["ec9b91", "ec9b8ce186ac"],
+ ["ec9b92", "e1848be185afe186ad"],
+ ["ec9b92", "ec9b8ce186ad"],
+ ["ec9b93", "e1848be185afe186ae"],
+ ["ec9b93", "ec9b8ce186ae"],
+ ["ec9b94", "e1848be185afe186af"],
+ ["ec9b94", "ec9b8ce186af"],
+ ["ec9b95", "e1848be185afe186b0"],
+ ["ec9b95", "ec9b8ce186b0"],
+ ["ec9b96", "e1848be185afe186b1"],
+ ["ec9b96", "ec9b8ce186b1"],
+ ["ec9b97", "e1848be185afe186b2"],
+ ["ec9b97", "ec9b8ce186b2"],
+ ["ec9b98", "e1848be185afe186b3"],
+ ["ec9b98", "ec9b8ce186b3"],
+ ["ec9b99", "e1848be185afe186b4"],
+ ["ec9b99", "ec9b8ce186b4"],
+ ["ec9b9a", "e1848be185afe186b5"],
+ ["ec9b9a", "ec9b8ce186b5"],
+ ["ec9b9b", "e1848be185afe186b6"],
+ ["ec9b9b", "ec9b8ce186b6"],
+ ["ec9b9c", "e1848be185afe186b7"],
+ ["ec9b9c", "ec9b8ce186b7"],
+ ["ec9b9d", "e1848be185afe186b8"],
+ ["ec9b9d", "ec9b8ce186b8"],
+ ["ec9b9e", "e1848be185afe186b9"],
+ ["ec9b9e", "ec9b8ce186b9"],
+ ["ec9b9f", "e1848be185afe186ba"],
+ ["ec9b9f", "ec9b8ce186ba"],
+ ["ec9ba0", "e1848be185afe186bb"],
+ ["ec9ba0", "ec9b8ce186bb"],
+ ["ec9ba1", "e1848be185afe186bc"],
+ ["ec9ba1", "ec9b8ce186bc"],
+ ["ec9ba2", "e1848be185afe186bd"],
+ ["ec9ba2", "ec9b8ce186bd"],
+ ["ec9ba3", "e1848be185afe186be"],
+ ["ec9ba3", "ec9b8ce186be"],
+ ["ec9ba4", "e1848be185afe186bf"],
+ ["ec9ba4", "ec9b8ce186bf"],
+ ["ec9ba5", "e1848be185afe18780"],
+ ["ec9ba5", "ec9b8ce18780"],
+ ["ec9ba6", "e1848be185afe18781"],
+ ["ec9ba6", "ec9b8ce18781"],
+ ["ec9ba7", "e1848be185afe18782"],
+ ["ec9ba7", "ec9b8ce18782"],
+ ["ec9ba8", "e1848be185b0"],
+ ["ec9ba9", "e1848be185b0e186a8"],
+ ["ec9ba9", "ec9ba8e186a8"],
+ ["ec9baa", "e1848be185b0e186a9"],
+ ["ec9baa", "ec9ba8e186a9"],
+ ["ec9bab", "e1848be185b0e186aa"],
+ ["ec9bab", "ec9ba8e186aa"],
+ ["ec9bac", "e1848be185b0e186ab"],
+ ["ec9bac", "ec9ba8e186ab"],
+ ["ec9bad", "e1848be185b0e186ac"],
+ ["ec9bad", "ec9ba8e186ac"],
+ ["ec9bae", "e1848be185b0e186ad"],
+ ["ec9bae", "ec9ba8e186ad"],
+ ["ec9baf", "e1848be185b0e186ae"],
+ ["ec9baf", "ec9ba8e186ae"],
+ ["ec9bb0", "e1848be185b0e186af"],
+ ["ec9bb0", "ec9ba8e186af"],
+ ["ec9bb1", "e1848be185b0e186b0"],
+ ["ec9bb1", "ec9ba8e186b0"],
+ ["ec9bb2", "e1848be185b0e186b1"],
+ ["ec9bb2", "ec9ba8e186b1"],
+ ["ec9bb3", "e1848be185b0e186b2"],
+ ["ec9bb3", "ec9ba8e186b2"],
+ ["ec9bb4", "e1848be185b0e186b3"],
+ ["ec9bb4", "ec9ba8e186b3"],
+ ["ec9bb5", "e1848be185b0e186b4"],
+ ["ec9bb5", "ec9ba8e186b4"],
+ ["ec9bb6", "e1848be185b0e186b5"],
+ ["ec9bb6", "ec9ba8e186b5"],
+ ["ec9bb7", "e1848be185b0e186b6"],
+ ["ec9bb7", "ec9ba8e186b6"],
+ ["ec9bb8", "e1848be185b0e186b7"],
+ ["ec9bb8", "ec9ba8e186b7"],
+ ["ec9bb9", "e1848be185b0e186b8"],
+ ["ec9bb9", "ec9ba8e186b8"],
+ ["ec9bba", "e1848be185b0e186b9"],
+ ["ec9bba", "ec9ba8e186b9"],
+ ["ec9bbb", "e1848be185b0e186ba"],
+ ["ec9bbb", "ec9ba8e186ba"],
+ ["ec9bbc", "e1848be185b0e186bb"],
+ ["ec9bbc", "ec9ba8e186bb"],
+ ["ec9bbd", "e1848be185b0e186bc"],
+ ["ec9bbd", "ec9ba8e186bc"],
+ ["ec9bbe", "e1848be185b0e186bd"],
+ ["ec9bbe", "ec9ba8e186bd"],
+ ["ec9bbf", "e1848be185b0e186be"],
+ ["ec9bbf", "ec9ba8e186be"],
+ ["ec9c80", "e1848be185b0e186bf"],
+ ["ec9c80", "ec9ba8e186bf"],
+ ["ec9c81", "e1848be185b0e18780"],
+ ["ec9c81", "ec9ba8e18780"],
+ ["ec9c82", "e1848be185b0e18781"],
+ ["ec9c82", "ec9ba8e18781"],
+ ["ec9c83", "e1848be185b0e18782"],
+ ["ec9c83", "ec9ba8e18782"],
+ ["ec9c84", "e1848be185b1"],
+ ["ec9c85", "e1848be185b1e186a8"],
+ ["ec9c85", "ec9c84e186a8"],
+ ["ec9c86", "e1848be185b1e186a9"],
+ ["ec9c86", "ec9c84e186a9"],
+ ["ec9c87", "e1848be185b1e186aa"],
+ ["ec9c87", "ec9c84e186aa"],
+ ["ec9c88", "e1848be185b1e186ab"],
+ ["ec9c88", "ec9c84e186ab"],
+ ["ec9c89", "e1848be185b1e186ac"],
+ ["ec9c89", "ec9c84e186ac"],
+ ["ec9c8a", "e1848be185b1e186ad"],
+ ["ec9c8a", "ec9c84e186ad"],
+ ["ec9c8b", "e1848be185b1e186ae"],
+ ["ec9c8b", "ec9c84e186ae"],
+ ["ec9c8c", "e1848be185b1e186af"],
+ ["ec9c8c", "ec9c84e186af"],
+ ["ec9c8d", "e1848be185b1e186b0"],
+ ["ec9c8d", "ec9c84e186b0"],
+ ["ec9c8e", "e1848be185b1e186b1"],
+ ["ec9c8e", "ec9c84e186b1"],
+ ["ec9c8f", "e1848be185b1e186b2"],
+ ["ec9c8f", "ec9c84e186b2"],
+ ["ec9c90", "e1848be185b1e186b3"],
+ ["ec9c90", "ec9c84e186b3"],
+ ["ec9c91", "e1848be185b1e186b4"],
+ ["ec9c91", "ec9c84e186b4"],
+ ["ec9c92", "e1848be185b1e186b5"],
+ ["ec9c92", "ec9c84e186b5"],
+ ["ec9c93", "e1848be185b1e186b6"],
+ ["ec9c93", "ec9c84e186b6"],
+ ["ec9c94", "e1848be185b1e186b7"],
+ ["ec9c94", "ec9c84e186b7"],
+ ["ec9c95", "e1848be185b1e186b8"],
+ ["ec9c95", "ec9c84e186b8"],
+ ["ec9c96", "e1848be185b1e186b9"],
+ ["ec9c96", "ec9c84e186b9"],
+ ["ec9c97", "e1848be185b1e186ba"],
+ ["ec9c97", "ec9c84e186ba"],
+ ["ec9c98", "e1848be185b1e186bb"],
+ ["ec9c98", "ec9c84e186bb"],
+ ["ec9c99", "e1848be185b1e186bc"],
+ ["ec9c99", "ec9c84e186bc"],
+ ["ec9c9a", "e1848be185b1e186bd"],
+ ["ec9c9a", "ec9c84e186bd"],
+ ["ec9c9b", "e1848be185b1e186be"],
+ ["ec9c9b", "ec9c84e186be"],
+ ["ec9c9c", "e1848be185b1e186bf"],
+ ["ec9c9c", "ec9c84e186bf"],
+ ["ec9c9d", "e1848be185b1e18780"],
+ ["ec9c9d", "ec9c84e18780"],
+ ["ec9c9e", "e1848be185b1e18781"],
+ ["ec9c9e", "ec9c84e18781"],
+ ["ec9c9f", "e1848be185b1e18782"],
+ ["ec9c9f", "ec9c84e18782"],
+ ["ec9ca0", "e1848be185b2"],
+ ["ec9ca1", "e1848be185b2e186a8"],
+ ["ec9ca1", "ec9ca0e186a8"],
+ ["ec9ca2", "e1848be185b2e186a9"],
+ ["ec9ca2", "ec9ca0e186a9"],
+ ["ec9ca3", "e1848be185b2e186aa"],
+ ["ec9ca3", "ec9ca0e186aa"],
+ ["ec9ca4", "e1848be185b2e186ab"],
+ ["ec9ca4", "ec9ca0e186ab"],
+ ["ec9ca5", "e1848be185b2e186ac"],
+ ["ec9ca5", "ec9ca0e186ac"],
+ ["ec9ca6", "e1848be185b2e186ad"],
+ ["ec9ca6", "ec9ca0e186ad"],
+ ["ec9ca7", "e1848be185b2e186ae"],
+ ["ec9ca7", "ec9ca0e186ae"],
+ ["ec9ca8", "e1848be185b2e186af"],
+ ["ec9ca8", "ec9ca0e186af"],
+ ["ec9ca9", "e1848be185b2e186b0"],
+ ["ec9ca9", "ec9ca0e186b0"],
+ ["ec9caa", "e1848be185b2e186b1"],
+ ["ec9caa", "ec9ca0e186b1"],
+ ["ec9cab", "e1848be185b2e186b2"],
+ ["ec9cab", "ec9ca0e186b2"],
+ ["ec9cac", "e1848be185b2e186b3"],
+ ["ec9cac", "ec9ca0e186b3"],
+ ["ec9cad", "e1848be185b2e186b4"],
+ ["ec9cad", "ec9ca0e186b4"],
+ ["ec9cae", "e1848be185b2e186b5"],
+ ["ec9cae", "ec9ca0e186b5"],
+ ["ec9caf", "e1848be185b2e186b6"],
+ ["ec9caf", "ec9ca0e186b6"],
+ ["ec9cb0", "e1848be185b2e186b7"],
+ ["ec9cb0", "ec9ca0e186b7"],
+ ["ec9cb1", "e1848be185b2e186b8"],
+ ["ec9cb1", "ec9ca0e186b8"],
+ ["ec9cb2", "e1848be185b2e186b9"],
+ ["ec9cb2", "ec9ca0e186b9"],
+ ["ec9cb3", "e1848be185b2e186ba"],
+ ["ec9cb3", "ec9ca0e186ba"],
+ ["ec9cb4", "e1848be185b2e186bb"],
+ ["ec9cb4", "ec9ca0e186bb"],
+ ["ec9cb5", "e1848be185b2e186bc"],
+ ["ec9cb5", "ec9ca0e186bc"],
+ ["ec9cb6", "e1848be185b2e186bd"],
+ ["ec9cb6", "ec9ca0e186bd"],
+ ["ec9cb7", "e1848be185b2e186be"],
+ ["ec9cb7", "ec9ca0e186be"],
+ ["ec9cb8", "e1848be185b2e186bf"],
+ ["ec9cb8", "ec9ca0e186bf"],
+ ["ec9cb9", "e1848be185b2e18780"],
+ ["ec9cb9", "ec9ca0e18780"],
+ ["ec9cba", "e1848be185b2e18781"],
+ ["ec9cba", "ec9ca0e18781"],
+ ["ec9cbb", "e1848be185b2e18782"],
+ ["ec9cbb", "ec9ca0e18782"],
+ ["ec9cbc", "e1848be185b3"],
+ ["ec9cbd", "e1848be185b3e186a8"],
+ ["ec9cbd", "ec9cbce186a8"],
+ ["ec9cbe", "e1848be185b3e186a9"],
+ ["ec9cbe", "ec9cbce186a9"],
+ ["ec9cbf", "e1848be185b3e186aa"],
+ ["ec9cbf", "ec9cbce186aa"],
+ ["ec9d80", "e1848be185b3e186ab"],
+ ["ec9d80", "ec9cbce186ab"],
+ ["ec9d81", "e1848be185b3e186ac"],
+ ["ec9d81", "ec9cbce186ac"],
+ ["ec9d82", "e1848be185b3e186ad"],
+ ["ec9d82", "ec9cbce186ad"],
+ ["ec9d83", "e1848be185b3e186ae"],
+ ["ec9d83", "ec9cbce186ae"],
+ ["ec9d84", "e1848be185b3e186af"],
+ ["ec9d84", "ec9cbce186af"],
+ ["ec9d85", "e1848be185b3e186b0"],
+ ["ec9d85", "ec9cbce186b0"],
+ ["ec9d86", "e1848be185b3e186b1"],
+ ["ec9d86", "ec9cbce186b1"],
+ ["ec9d87", "e1848be185b3e186b2"],
+ ["ec9d87", "ec9cbce186b2"],
+ ["ec9d88", "e1848be185b3e186b3"],
+ ["ec9d88", "ec9cbce186b3"],
+ ["ec9d89", "e1848be185b3e186b4"],
+ ["ec9d89", "ec9cbce186b4"],
+ ["ec9d8a", "e1848be185b3e186b5"],
+ ["ec9d8a", "ec9cbce186b5"],
+ ["ec9d8b", "e1848be185b3e186b6"],
+ ["ec9d8b", "ec9cbce186b6"],
+ ["ec9d8c", "e1848be185b3e186b7"],
+ ["ec9d8c", "ec9cbce186b7"],
+ ["ec9d8d", "e1848be185b3e186b8"],
+ ["ec9d8d", "ec9cbce186b8"],
+ ["ec9d8e", "e1848be185b3e186b9"],
+ ["ec9d8e", "ec9cbce186b9"],
+ ["ec9d8f", "e1848be185b3e186ba"],
+ ["ec9d8f", "ec9cbce186ba"],
+ ["ec9d90", "e1848be185b3e186bb"],
+ ["ec9d90", "ec9cbce186bb"],
+ ["ec9d91", "e1848be185b3e186bc"],
+ ["ec9d91", "ec9cbce186bc"],
+ ["ec9d92", "e1848be185b3e186bd"],
+ ["ec9d92", "ec9cbce186bd"],
+ ["ec9d93", "e1848be185b3e186be"],
+ ["ec9d93", "ec9cbce186be"],
+ ["ec9d94", "e1848be185b3e186bf"],
+ ["ec9d94", "ec9cbce186bf"],
+ ["ec9d95", "e1848be185b3e18780"],
+ ["ec9d95", "ec9cbce18780"],
+ ["ec9d96", "e1848be185b3e18781"],
+ ["ec9d96", "ec9cbce18781"],
+ ["ec9d97", "e1848be185b3e18782"],
+ ["ec9d97", "ec9cbce18782"],
+ ["ec9d98", "e1848be185b4"],
+ ["ec9d99", "e1848be185b4e186a8"],
+ ["ec9d99", "ec9d98e186a8"],
+ ["ec9d9a", "e1848be185b4e186a9"],
+ ["ec9d9a", "ec9d98e186a9"],
+ ["ec9d9b", "e1848be185b4e186aa"],
+ ["ec9d9b", "ec9d98e186aa"],
+ ["ec9d9c", "e1848be185b4e186ab"],
+ ["ec9d9c", "ec9d98e186ab"],
+ ["ec9d9d", "e1848be185b4e186ac"],
+ ["ec9d9d", "ec9d98e186ac"],
+ ["ec9d9e", "e1848be185b4e186ad"],
+ ["ec9d9e", "ec9d98e186ad"],
+ ["ec9d9f", "e1848be185b4e186ae"],
+ ["ec9d9f", "ec9d98e186ae"],
+ ["ec9da0", "e1848be185b4e186af"],
+ ["ec9da0", "ec9d98e186af"],
+ ["ec9da1", "e1848be185b4e186b0"],
+ ["ec9da1", "ec9d98e186b0"],
+ ["ec9da2", "e1848be185b4e186b1"],
+ ["ec9da2", "ec9d98e186b1"],
+ ["ec9da3", "e1848be185b4e186b2"],
+ ["ec9da3", "ec9d98e186b2"],
+ ["ec9da4", "e1848be185b4e186b3"],
+ ["ec9da4", "ec9d98e186b3"],
+ ["ec9da5", "e1848be185b4e186b4"],
+ ["ec9da5", "ec9d98e186b4"],
+ ["ec9da6", "e1848be185b4e186b5"],
+ ["ec9da6", "ec9d98e186b5"],
+ ["ec9da7", "e1848be185b4e186b6"],
+ ["ec9da7", "ec9d98e186b6"],
+ ["ec9da8", "e1848be185b4e186b7"],
+ ["ec9da8", "ec9d98e186b7"],
+ ["ec9da9", "e1848be185b4e186b8"],
+ ["ec9da9", "ec9d98e186b8"],
+ ["ec9daa", "e1848be185b4e186b9"],
+ ["ec9daa", "ec9d98e186b9"],
+ ["ec9dab", "e1848be185b4e186ba"],
+ ["ec9dab", "ec9d98e186ba"],
+ ["ec9dac", "e1848be185b4e186bb"],
+ ["ec9dac", "ec9d98e186bb"],
+ ["ec9dad", "e1848be185b4e186bc"],
+ ["ec9dad", "ec9d98e186bc"],
+ ["ec9dae", "e1848be185b4e186bd"],
+ ["ec9dae", "ec9d98e186bd"],
+ ["ec9daf", "e1848be185b4e186be"],
+ ["ec9daf", "ec9d98e186be"],
+ ["ec9db0", "e1848be185b4e186bf"],
+ ["ec9db0", "ec9d98e186bf"],
+ ["ec9db1", "e1848be185b4e18780"],
+ ["ec9db1", "ec9d98e18780"],
+ ["ec9db2", "e1848be185b4e18781"],
+ ["ec9db2", "ec9d98e18781"],
+ ["ec9db3", "e1848be185b4e18782"],
+ ["ec9db3", "ec9d98e18782"],
+ ["ec9db4", "e1848be185b5"],
+ ["ec9db5", "e1848be185b5e186a8"],
+ ["ec9db5", "ec9db4e186a8"],
+ ["ec9db6", "e1848be185b5e186a9"],
+ ["ec9db6", "ec9db4e186a9"],
+ ["ec9db7", "e1848be185b5e186aa"],
+ ["ec9db7", "ec9db4e186aa"],
+ ["ec9db8", "e1848be185b5e186ab"],
+ ["ec9db8", "ec9db4e186ab"],
+ ["ec9db9", "e1848be185b5e186ac"],
+ ["ec9db9", "ec9db4e186ac"],
+ ["ec9dba", "e1848be185b5e186ad"],
+ ["ec9dba", "ec9db4e186ad"],
+ ["ec9dbb", "e1848be185b5e186ae"],
+ ["ec9dbb", "ec9db4e186ae"],
+ ["ec9dbc", "e1848be185b5e186af"],
+ ["ec9dbc", "ec9db4e186af"],
+ ["ec9dbd", "e1848be185b5e186b0"],
+ ["ec9dbd", "ec9db4e186b0"],
+ ["ec9dbe", "e1848be185b5e186b1"],
+ ["ec9dbe", "ec9db4e186b1"],
+ ["ec9dbf", "e1848be185b5e186b2"],
+ ["ec9dbf", "ec9db4e186b2"],
+ ["ec9e80", "e1848be185b5e186b3"],
+ ["ec9e80", "ec9db4e186b3"],
+ ["ec9e81", "e1848be185b5e186b4"],
+ ["ec9e81", "ec9db4e186b4"],
+ ["ec9e82", "e1848be185b5e186b5"],
+ ["ec9e82", "ec9db4e186b5"],
+ ["ec9e83", "e1848be185b5e186b6"],
+ ["ec9e83", "ec9db4e186b6"],
+ ["ec9e84", "e1848be185b5e186b7"],
+ ["ec9e84", "ec9db4e186b7"],
+ ["ec9e85", "e1848be185b5e186b8"],
+ ["ec9e85", "ec9db4e186b8"],
+ ["ec9e86", "e1848be185b5e186b9"],
+ ["ec9e86", "ec9db4e186b9"],
+ ["ec9e87", "e1848be185b5e186ba"],
+ ["ec9e87", "ec9db4e186ba"],
+ ["ec9e88", "e1848be185b5e186bb"],
+ ["ec9e88", "ec9db4e186bb"],
+ ["ec9e89", "e1848be185b5e186bc"],
+ ["ec9e89", "ec9db4e186bc"],
+ ["ec9e8a", "e1848be185b5e186bd"],
+ ["ec9e8a", "ec9db4e186bd"],
+ ["ec9e8b", "e1848be185b5e186be"],
+ ["ec9e8b", "ec9db4e186be"],
+ ["ec9e8c", "e1848be185b5e186bf"],
+ ["ec9e8c", "ec9db4e186bf"],
+ ["ec9e8d", "e1848be185b5e18780"],
+ ["ec9e8d", "ec9db4e18780"],
+ ["ec9e8e", "e1848be185b5e18781"],
+ ["ec9e8e", "ec9db4e18781"],
+ ["ec9e8f", "e1848be185b5e18782"],
+ ["ec9e8f", "ec9db4e18782"],
+ ["ec9e90", "e1848ce185a1"],
+ ["ec9e91", "e1848ce185a1e186a8"],
+ ["ec9e91", "ec9e90e186a8"],
+ ["ec9e92", "e1848ce185a1e186a9"],
+ ["ec9e92", "ec9e90e186a9"],
+ ["ec9e93", "e1848ce185a1e186aa"],
+ ["ec9e93", "ec9e90e186aa"],
+ ["ec9e94", "e1848ce185a1e186ab"],
+ ["ec9e94", "ec9e90e186ab"],
+ ["ec9e95", "e1848ce185a1e186ac"],
+ ["ec9e95", "ec9e90e186ac"],
+ ["ec9e96", "e1848ce185a1e186ad"],
+ ["ec9e96", "ec9e90e186ad"],
+ ["ec9e97", "e1848ce185a1e186ae"],
+ ["ec9e97", "ec9e90e186ae"],
+ ["ec9e98", "e1848ce185a1e186af"],
+ ["ec9e98", "ec9e90e186af"],
+ ["ec9e99", "e1848ce185a1e186b0"],
+ ["ec9e99", "ec9e90e186b0"],
+ ["ec9e9a", "e1848ce185a1e186b1"],
+ ["ec9e9a", "ec9e90e186b1"],
+ ["ec9e9b", "e1848ce185a1e186b2"],
+ ["ec9e9b", "ec9e90e186b2"],
+ ["ec9e9c", "e1848ce185a1e186b3"],
+ ["ec9e9c", "ec9e90e186b3"],
+ ["ec9e9d", "e1848ce185a1e186b4"],
+ ["ec9e9d", "ec9e90e186b4"],
+ ["ec9e9e", "e1848ce185a1e186b5"],
+ ["ec9e9e", "ec9e90e186b5"],
+ ["ec9e9f", "e1848ce185a1e186b6"],
+ ["ec9e9f", "ec9e90e186b6"],
+ ["ec9ea0", "e1848ce185a1e186b7"],
+ ["ec9ea0", "ec9e90e186b7"],
+ ["ec9ea1", "e1848ce185a1e186b8"],
+ ["ec9ea1", "ec9e90e186b8"],
+ ["ec9ea2", "e1848ce185a1e186b9"],
+ ["ec9ea2", "ec9e90e186b9"],
+ ["ec9ea3", "e1848ce185a1e186ba"],
+ ["ec9ea3", "ec9e90e186ba"],
+ ["ec9ea4", "e1848ce185a1e186bb"],
+ ["ec9ea4", "ec9e90e186bb"],
+ ["ec9ea5", "e1848ce185a1e186bc"],
+ ["ec9ea5", "ec9e90e186bc"],
+ ["ec9ea6", "e1848ce185a1e186bd"],
+ ["ec9ea6", "ec9e90e186bd"],
+ ["ec9ea7", "e1848ce185a1e186be"],
+ ["ec9ea7", "ec9e90e186be"],
+ ["ec9ea8", "e1848ce185a1e186bf"],
+ ["ec9ea8", "ec9e90e186bf"],
+ ["ec9ea9", "e1848ce185a1e18780"],
+ ["ec9ea9", "ec9e90e18780"],
+ ["ec9eaa", "e1848ce185a1e18781"],
+ ["ec9eaa", "ec9e90e18781"],
+ ["ec9eab", "e1848ce185a1e18782"],
+ ["ec9eab", "ec9e90e18782"],
+ ["ec9eac", "e1848ce185a2"],
+ ["ec9ead", "e1848ce185a2e186a8"],
+ ["ec9ead", "ec9eace186a8"],
+ ["ec9eae", "e1848ce185a2e186a9"],
+ ["ec9eae", "ec9eace186a9"],
+ ["ec9eaf", "e1848ce185a2e186aa"],
+ ["ec9eaf", "ec9eace186aa"],
+ ["ec9eb0", "e1848ce185a2e186ab"],
+ ["ec9eb0", "ec9eace186ab"],
+ ["ec9eb1", "e1848ce185a2e186ac"],
+ ["ec9eb1", "ec9eace186ac"],
+ ["ec9eb2", "e1848ce185a2e186ad"],
+ ["ec9eb2", "ec9eace186ad"],
+ ["ec9eb3", "e1848ce185a2e186ae"],
+ ["ec9eb3", "ec9eace186ae"],
+ ["ec9eb4", "e1848ce185a2e186af"],
+ ["ec9eb4", "ec9eace186af"],
+ ["ec9eb5", "e1848ce185a2e186b0"],
+ ["ec9eb5", "ec9eace186b0"],
+ ["ec9eb6", "e1848ce185a2e186b1"],
+ ["ec9eb6", "ec9eace186b1"],
+ ["ec9eb7", "e1848ce185a2e186b2"],
+ ["ec9eb7", "ec9eace186b2"],
+ ["ec9eb8", "e1848ce185a2e186b3"],
+ ["ec9eb8", "ec9eace186b3"],
+ ["ec9eb9", "e1848ce185a2e186b4"],
+ ["ec9eb9", "ec9eace186b4"],
+ ["ec9eba", "e1848ce185a2e186b5"],
+ ["ec9eba", "ec9eace186b5"],
+ ["ec9ebb", "e1848ce185a2e186b6"],
+ ["ec9ebb", "ec9eace186b6"],
+ ["ec9ebc", "e1848ce185a2e186b7"],
+ ["ec9ebc", "ec9eace186b7"],
+ ["ec9ebd", "e1848ce185a2e186b8"],
+ ["ec9ebd", "ec9eace186b8"],
+ ["ec9ebe", "e1848ce185a2e186b9"],
+ ["ec9ebe", "ec9eace186b9"],
+ ["ec9ebf", "e1848ce185a2e186ba"],
+ ["ec9ebf", "ec9eace186ba"],
+ ["ec9f80", "e1848ce185a2e186bb"],
+ ["ec9f80", "ec9eace186bb"],
+ ["ec9f81", "e1848ce185a2e186bc"],
+ ["ec9f81", "ec9eace186bc"],
+ ["ec9f82", "e1848ce185a2e186bd"],
+ ["ec9f82", "ec9eace186bd"],
+ ["ec9f83", "e1848ce185a2e186be"],
+ ["ec9f83", "ec9eace186be"],
+ ["ec9f84", "e1848ce185a2e186bf"],
+ ["ec9f84", "ec9eace186bf"],
+ ["ec9f85", "e1848ce185a2e18780"],
+ ["ec9f85", "ec9eace18780"],
+ ["ec9f86", "e1848ce185a2e18781"],
+ ["ec9f86", "ec9eace18781"],
+ ["ec9f87", "e1848ce185a2e18782"],
+ ["ec9f87", "ec9eace18782"],
+ ["ec9f88", "e1848ce185a3"],
+ ["ec9f89", "e1848ce185a3e186a8"],
+ ["ec9f89", "ec9f88e186a8"],
+ ["ec9f8a", "e1848ce185a3e186a9"],
+ ["ec9f8a", "ec9f88e186a9"],
+ ["ec9f8b", "e1848ce185a3e186aa"],
+ ["ec9f8b", "ec9f88e186aa"],
+ ["ec9f8c", "e1848ce185a3e186ab"],
+ ["ec9f8c", "ec9f88e186ab"],
+ ["ec9f8d", "e1848ce185a3e186ac"],
+ ["ec9f8d", "ec9f88e186ac"],
+ ["ec9f8e", "e1848ce185a3e186ad"],
+ ["ec9f8e", "ec9f88e186ad"],
+ ["ec9f8f", "e1848ce185a3e186ae"],
+ ["ec9f8f", "ec9f88e186ae"],
+ ["ec9f90", "e1848ce185a3e186af"],
+ ["ec9f90", "ec9f88e186af"],
+ ["ec9f91", "e1848ce185a3e186b0"],
+ ["ec9f91", "ec9f88e186b0"],
+ ["ec9f92", "e1848ce185a3e186b1"],
+ ["ec9f92", "ec9f88e186b1"],
+ ["ec9f93", "e1848ce185a3e186b2"],
+ ["ec9f93", "ec9f88e186b2"],
+ ["ec9f94", "e1848ce185a3e186b3"],
+ ["ec9f94", "ec9f88e186b3"],
+ ["ec9f95", "e1848ce185a3e186b4"],
+ ["ec9f95", "ec9f88e186b4"],
+ ["ec9f96", "e1848ce185a3e186b5"],
+ ["ec9f96", "ec9f88e186b5"],
+ ["ec9f97", "e1848ce185a3e186b6"],
+ ["ec9f97", "ec9f88e186b6"],
+ ["ec9f98", "e1848ce185a3e186b7"],
+ ["ec9f98", "ec9f88e186b7"],
+ ["ec9f99", "e1848ce185a3e186b8"],
+ ["ec9f99", "ec9f88e186b8"],
+ ["ec9f9a", "e1848ce185a3e186b9"],
+ ["ec9f9a", "ec9f88e186b9"],
+ ["ec9f9b", "e1848ce185a3e186ba"],
+ ["ec9f9b", "ec9f88e186ba"],
+ ["ec9f9c", "e1848ce185a3e186bb"],
+ ["ec9f9c", "ec9f88e186bb"],
+ ["ec9f9d", "e1848ce185a3e186bc"],
+ ["ec9f9d", "ec9f88e186bc"],
+ ["ec9f9e", "e1848ce185a3e186bd"],
+ ["ec9f9e", "ec9f88e186bd"],
+ ["ec9f9f", "e1848ce185a3e186be"],
+ ["ec9f9f", "ec9f88e186be"],
+ ["ec9fa0", "e1848ce185a3e186bf"],
+ ["ec9fa0", "ec9f88e186bf"],
+ ["ec9fa1", "e1848ce185a3e18780"],
+ ["ec9fa1", "ec9f88e18780"],
+ ["ec9fa2", "e1848ce185a3e18781"],
+ ["ec9fa2", "ec9f88e18781"],
+ ["ec9fa3", "e1848ce185a3e18782"],
+ ["ec9fa3", "ec9f88e18782"],
+ ["ec9fa4", "e1848ce185a4"],
+ ["ec9fa5", "e1848ce185a4e186a8"],
+ ["ec9fa5", "ec9fa4e186a8"],
+ ["ec9fa6", "e1848ce185a4e186a9"],
+ ["ec9fa6", "ec9fa4e186a9"],
+ ["ec9fa7", "e1848ce185a4e186aa"],
+ ["ec9fa7", "ec9fa4e186aa"],
+ ["ec9fa8", "e1848ce185a4e186ab"],
+ ["ec9fa8", "ec9fa4e186ab"],
+ ["ec9fa9", "e1848ce185a4e186ac"],
+ ["ec9fa9", "ec9fa4e186ac"],
+ ["ec9faa", "e1848ce185a4e186ad"],
+ ["ec9faa", "ec9fa4e186ad"],
+ ["ec9fab", "e1848ce185a4e186ae"],
+ ["ec9fab", "ec9fa4e186ae"],
+ ["ec9fac", "e1848ce185a4e186af"],
+ ["ec9fac", "ec9fa4e186af"],
+ ["ec9fad", "e1848ce185a4e186b0"],
+ ["ec9fad", "ec9fa4e186b0"],
+ ["ec9fae", "e1848ce185a4e186b1"],
+ ["ec9fae", "ec9fa4e186b1"],
+ ["ec9faf", "e1848ce185a4e186b2"],
+ ["ec9faf", "ec9fa4e186b2"],
+ ["ec9fb0", "e1848ce185a4e186b3"],
+ ["ec9fb0", "ec9fa4e186b3"],
+ ["ec9fb1", "e1848ce185a4e186b4"],
+ ["ec9fb1", "ec9fa4e186b4"],
+ ["ec9fb2", "e1848ce185a4e186b5"],
+ ["ec9fb2", "ec9fa4e186b5"],
+ ["ec9fb3", "e1848ce185a4e186b6"],
+ ["ec9fb3", "ec9fa4e186b6"],
+ ["ec9fb4", "e1848ce185a4e186b7"],
+ ["ec9fb4", "ec9fa4e186b7"],
+ ["ec9fb5", "e1848ce185a4e186b8"],
+ ["ec9fb5", "ec9fa4e186b8"],
+ ["ec9fb6", "e1848ce185a4e186b9"],
+ ["ec9fb6", "ec9fa4e186b9"],
+ ["ec9fb7", "e1848ce185a4e186ba"],
+ ["ec9fb7", "ec9fa4e186ba"],
+ ["ec9fb8", "e1848ce185a4e186bb"],
+ ["ec9fb8", "ec9fa4e186bb"],
+ ["ec9fb9", "e1848ce185a4e186bc"],
+ ["ec9fb9", "ec9fa4e186bc"],
+ ["ec9fba", "e1848ce185a4e186bd"],
+ ["ec9fba", "ec9fa4e186bd"],
+ ["ec9fbb", "e1848ce185a4e186be"],
+ ["ec9fbb", "ec9fa4e186be"],
+ ["ec9fbc", "e1848ce185a4e186bf"],
+ ["ec9fbc", "ec9fa4e186bf"],
+ ["ec9fbd", "e1848ce185a4e18780"],
+ ["ec9fbd", "ec9fa4e18780"],
+ ["ec9fbe", "e1848ce185a4e18781"],
+ ["ec9fbe", "ec9fa4e18781"],
+ ["ec9fbf", "e1848ce185a4e18782"],
+ ["ec9fbf", "ec9fa4e18782"],
+ ["eca080", "e1848ce185a5"],
+ ["eca081", "e1848ce185a5e186a8"],
+ ["eca081", "eca080e186a8"],
+ ["eca082", "e1848ce185a5e186a9"],
+ ["eca082", "eca080e186a9"],
+ ["eca083", "e1848ce185a5e186aa"],
+ ["eca083", "eca080e186aa"],
+ ["eca084", "e1848ce185a5e186ab"],
+ ["eca084", "eca080e186ab"],
+ ["eca085", "e1848ce185a5e186ac"],
+ ["eca085", "eca080e186ac"],
+ ["eca086", "e1848ce185a5e186ad"],
+ ["eca086", "eca080e186ad"],
+ ["eca087", "e1848ce185a5e186ae"],
+ ["eca087", "eca080e186ae"],
+ ["eca088", "e1848ce185a5e186af"],
+ ["eca088", "eca080e186af"],
+ ["eca089", "e1848ce185a5e186b0"],
+ ["eca089", "eca080e186b0"],
+ ["eca08a", "e1848ce185a5e186b1"],
+ ["eca08a", "eca080e186b1"],
+ ["eca08b", "e1848ce185a5e186b2"],
+ ["eca08b", "eca080e186b2"],
+ ["eca08c", "e1848ce185a5e186b3"],
+ ["eca08c", "eca080e186b3"],
+ ["eca08d", "e1848ce185a5e186b4"],
+ ["eca08d", "eca080e186b4"],
+ ["eca08e", "e1848ce185a5e186b5"],
+ ["eca08e", "eca080e186b5"],
+ ["eca08f", "e1848ce185a5e186b6"],
+ ["eca08f", "eca080e186b6"],
+ ["eca090", "e1848ce185a5e186b7"],
+ ["eca090", "eca080e186b7"],
+ ["eca091", "e1848ce185a5e186b8"],
+ ["eca091", "eca080e186b8"],
+ ["eca092", "e1848ce185a5e186b9"],
+ ["eca092", "eca080e186b9"],
+ ["eca093", "e1848ce185a5e186ba"],
+ ["eca093", "eca080e186ba"],
+ ["eca094", "e1848ce185a5e186bb"],
+ ["eca094", "eca080e186bb"],
+ ["eca095", "e1848ce185a5e186bc"],
+ ["eca095", "eca080e186bc"],
+ ["eca096", "e1848ce185a5e186bd"],
+ ["eca096", "eca080e186bd"],
+ ["eca097", "e1848ce185a5e186be"],
+ ["eca097", "eca080e186be"],
+ ["eca098", "e1848ce185a5e186bf"],
+ ["eca098", "eca080e186bf"],
+ ["eca099", "e1848ce185a5e18780"],
+ ["eca099", "eca080e18780"],
+ ["eca09a", "e1848ce185a5e18781"],
+ ["eca09a", "eca080e18781"],
+ ["eca09b", "e1848ce185a5e18782"],
+ ["eca09b", "eca080e18782"],
+ ["eca09c", "e1848ce185a6"],
+ ["eca09d", "e1848ce185a6e186a8"],
+ ["eca09d", "eca09ce186a8"],
+ ["eca09e", "e1848ce185a6e186a9"],
+ ["eca09e", "eca09ce186a9"],
+ ["eca09f", "e1848ce185a6e186aa"],
+ ["eca09f", "eca09ce186aa"],
+ ["eca0a0", "e1848ce185a6e186ab"],
+ ["eca0a0", "eca09ce186ab"],
+ ["eca0a1", "e1848ce185a6e186ac"],
+ ["eca0a1", "eca09ce186ac"],
+ ["eca0a2", "e1848ce185a6e186ad"],
+ ["eca0a2", "eca09ce186ad"],
+ ["eca0a3", "e1848ce185a6e186ae"],
+ ["eca0a3", "eca09ce186ae"],
+ ["eca0a4", "e1848ce185a6e186af"],
+ ["eca0a4", "eca09ce186af"],
+ ["eca0a5", "e1848ce185a6e186b0"],
+ ["eca0a5", "eca09ce186b0"],
+ ["eca0a6", "e1848ce185a6e186b1"],
+ ["eca0a6", "eca09ce186b1"],
+ ["eca0a7", "e1848ce185a6e186b2"],
+ ["eca0a7", "eca09ce186b2"],
+ ["eca0a8", "e1848ce185a6e186b3"],
+ ["eca0a8", "eca09ce186b3"],
+ ["eca0a9", "e1848ce185a6e186b4"],
+ ["eca0a9", "eca09ce186b4"],
+ ["eca0aa", "e1848ce185a6e186b5"],
+ ["eca0aa", "eca09ce186b5"],
+ ["eca0ab", "e1848ce185a6e186b6"],
+ ["eca0ab", "eca09ce186b6"],
+ ["eca0ac", "e1848ce185a6e186b7"],
+ ["eca0ac", "eca09ce186b7"],
+ ["eca0ad", "e1848ce185a6e186b8"],
+ ["eca0ad", "eca09ce186b8"],
+ ["eca0ae", "e1848ce185a6e186b9"],
+ ["eca0ae", "eca09ce186b9"],
+ ["eca0af", "e1848ce185a6e186ba"],
+ ["eca0af", "eca09ce186ba"],
+ ["eca0b0", "e1848ce185a6e186bb"],
+ ["eca0b0", "eca09ce186bb"],
+ ["eca0b1", "e1848ce185a6e186bc"],
+ ["eca0b1", "eca09ce186bc"],
+ ["eca0b2", "e1848ce185a6e186bd"],
+ ["eca0b2", "eca09ce186bd"],
+ ["eca0b3", "e1848ce185a6e186be"],
+ ["eca0b3", "eca09ce186be"],
+ ["eca0b4", "e1848ce185a6e186bf"],
+ ["eca0b4", "eca09ce186bf"],
+ ["eca0b5", "e1848ce185a6e18780"],
+ ["eca0b5", "eca09ce18780"],
+ ["eca0b6", "e1848ce185a6e18781"],
+ ["eca0b6", "eca09ce18781"],
+ ["eca0b7", "e1848ce185a6e18782"],
+ ["eca0b7", "eca09ce18782"],
+ ["eca0b8", "e1848ce185a7"],
+ ["eca0b9", "e1848ce185a7e186a8"],
+ ["eca0b9", "eca0b8e186a8"],
+ ["eca0ba", "e1848ce185a7e186a9"],
+ ["eca0ba", "eca0b8e186a9"],
+ ["eca0bb", "e1848ce185a7e186aa"],
+ ["eca0bb", "eca0b8e186aa"],
+ ["eca0bc", "e1848ce185a7e186ab"],
+ ["eca0bc", "eca0b8e186ab"],
+ ["eca0bd", "e1848ce185a7e186ac"],
+ ["eca0bd", "eca0b8e186ac"],
+ ["eca0be", "e1848ce185a7e186ad"],
+ ["eca0be", "eca0b8e186ad"],
+ ["eca0bf", "e1848ce185a7e186ae"],
+ ["eca0bf", "eca0b8e186ae"],
+ ["eca180", "e1848ce185a7e186af"],
+ ["eca180", "eca0b8e186af"],
+ ["eca181", "e1848ce185a7e186b0"],
+ ["eca181", "eca0b8e186b0"],
+ ["eca182", "e1848ce185a7e186b1"],
+ ["eca182", "eca0b8e186b1"],
+ ["eca183", "e1848ce185a7e186b2"],
+ ["eca183", "eca0b8e186b2"],
+ ["eca184", "e1848ce185a7e186b3"],
+ ["eca184", "eca0b8e186b3"],
+ ["eca185", "e1848ce185a7e186b4"],
+ ["eca185", "eca0b8e186b4"],
+ ["eca186", "e1848ce185a7e186b5"],
+ ["eca186", "eca0b8e186b5"],
+ ["eca187", "e1848ce185a7e186b6"],
+ ["eca187", "eca0b8e186b6"],
+ ["eca188", "e1848ce185a7e186b7"],
+ ["eca188", "eca0b8e186b7"],
+ ["eca189", "e1848ce185a7e186b8"],
+ ["eca189", "eca0b8e186b8"],
+ ["eca18a", "e1848ce185a7e186b9"],
+ ["eca18a", "eca0b8e186b9"],
+ ["eca18b", "e1848ce185a7e186ba"],
+ ["eca18b", "eca0b8e186ba"],
+ ["eca18c", "e1848ce185a7e186bb"],
+ ["eca18c", "eca0b8e186bb"],
+ ["eca18d", "e1848ce185a7e186bc"],
+ ["eca18d", "eca0b8e186bc"],
+ ["eca18e", "e1848ce185a7e186bd"],
+ ["eca18e", "eca0b8e186bd"],
+ ["eca18f", "e1848ce185a7e186be"],
+ ["eca18f", "eca0b8e186be"],
+ ["eca190", "e1848ce185a7e186bf"],
+ ["eca190", "eca0b8e186bf"],
+ ["eca191", "e1848ce185a7e18780"],
+ ["eca191", "eca0b8e18780"],
+ ["eca192", "e1848ce185a7e18781"],
+ ["eca192", "eca0b8e18781"],
+ ["eca193", "e1848ce185a7e18782"],
+ ["eca193", "eca0b8e18782"],
+ ["eca194", "e1848ce185a8"],
+ ["eca195", "e1848ce185a8e186a8"],
+ ["eca195", "eca194e186a8"],
+ ["eca196", "e1848ce185a8e186a9"],
+ ["eca196", "eca194e186a9"],
+ ["eca197", "e1848ce185a8e186aa"],
+ ["eca197", "eca194e186aa"],
+ ["eca198", "e1848ce185a8e186ab"],
+ ["eca198", "eca194e186ab"],
+ ["eca199", "e1848ce185a8e186ac"],
+ ["eca199", "eca194e186ac"],
+ ["eca19a", "e1848ce185a8e186ad"],
+ ["eca19a", "eca194e186ad"],
+ ["eca19b", "e1848ce185a8e186ae"],
+ ["eca19b", "eca194e186ae"],
+ ["eca19c", "e1848ce185a8e186af"],
+ ["eca19c", "eca194e186af"],
+ ["eca19d", "e1848ce185a8e186b0"],
+ ["eca19d", "eca194e186b0"],
+ ["eca19e", "e1848ce185a8e186b1"],
+ ["eca19e", "eca194e186b1"],
+ ["eca19f", "e1848ce185a8e186b2"],
+ ["eca19f", "eca194e186b2"],
+ ["eca1a0", "e1848ce185a8e186b3"],
+ ["eca1a0", "eca194e186b3"],
+ ["eca1a1", "e1848ce185a8e186b4"],
+ ["eca1a1", "eca194e186b4"],
+ ["eca1a2", "e1848ce185a8e186b5"],
+ ["eca1a2", "eca194e186b5"],
+ ["eca1a3", "e1848ce185a8e186b6"],
+ ["eca1a3", "eca194e186b6"],
+ ["eca1a4", "e1848ce185a8e186b7"],
+ ["eca1a4", "eca194e186b7"],
+ ["eca1a5", "e1848ce185a8e186b8"],
+ ["eca1a5", "eca194e186b8"],
+ ["eca1a6", "e1848ce185a8e186b9"],
+ ["eca1a6", "eca194e186b9"],
+ ["eca1a7", "e1848ce185a8e186ba"],
+ ["eca1a7", "eca194e186ba"],
+ ["eca1a8", "e1848ce185a8e186bb"],
+ ["eca1a8", "eca194e186bb"],
+ ["eca1a9", "e1848ce185a8e186bc"],
+ ["eca1a9", "eca194e186bc"],
+ ["eca1aa", "e1848ce185a8e186bd"],
+ ["eca1aa", "eca194e186bd"],
+ ["eca1ab", "e1848ce185a8e186be"],
+ ["eca1ab", "eca194e186be"],
+ ["eca1ac", "e1848ce185a8e186bf"],
+ ["eca1ac", "eca194e186bf"],
+ ["eca1ad", "e1848ce185a8e18780"],
+ ["eca1ad", "eca194e18780"],
+ ["eca1ae", "e1848ce185a8e18781"],
+ ["eca1ae", "eca194e18781"],
+ ["eca1af", "e1848ce185a8e18782"],
+ ["eca1af", "eca194e18782"],
+ ["eca1b0", "e1848ce185a9"],
+ ["eca1b1", "e1848ce185a9e186a8"],
+ ["eca1b1", "eca1b0e186a8"],
+ ["eca1b2", "e1848ce185a9e186a9"],
+ ["eca1b2", "eca1b0e186a9"],
+ ["eca1b3", "e1848ce185a9e186aa"],
+ ["eca1b3", "eca1b0e186aa"],
+ ["eca1b4", "e1848ce185a9e186ab"],
+ ["eca1b4", "eca1b0e186ab"],
+ ["eca1b5", "e1848ce185a9e186ac"],
+ ["eca1b5", "eca1b0e186ac"],
+ ["eca1b6", "e1848ce185a9e186ad"],
+ ["eca1b6", "eca1b0e186ad"],
+ ["eca1b7", "e1848ce185a9e186ae"],
+ ["eca1b7", "eca1b0e186ae"],
+ ["eca1b8", "e1848ce185a9e186af"],
+ ["eca1b8", "eca1b0e186af"],
+ ["eca1b9", "e1848ce185a9e186b0"],
+ ["eca1b9", "eca1b0e186b0"],
+ ["eca1ba", "e1848ce185a9e186b1"],
+ ["eca1ba", "eca1b0e186b1"],
+ ["eca1bb", "e1848ce185a9e186b2"],
+ ["eca1bb", "eca1b0e186b2"],
+ ["eca1bc", "e1848ce185a9e186b3"],
+ ["eca1bc", "eca1b0e186b3"],
+ ["eca1bd", "e1848ce185a9e186b4"],
+ ["eca1bd", "eca1b0e186b4"],
+ ["eca1be", "e1848ce185a9e186b5"],
+ ["eca1be", "eca1b0e186b5"],
+ ["eca1bf", "e1848ce185a9e186b6"],
+ ["eca1bf", "eca1b0e186b6"],
+ ["eca280", "e1848ce185a9e186b7"],
+ ["eca280", "eca1b0e186b7"],
+ ["eca281", "e1848ce185a9e186b8"],
+ ["eca281", "eca1b0e186b8"],
+ ["eca282", "e1848ce185a9e186b9"],
+ ["eca282", "eca1b0e186b9"],
+ ["eca283", "e1848ce185a9e186ba"],
+ ["eca283", "eca1b0e186ba"],
+ ["eca284", "e1848ce185a9e186bb"],
+ ["eca284", "eca1b0e186bb"],
+ ["eca285", "e1848ce185a9e186bc"],
+ ["eca285", "eca1b0e186bc"],
+ ["eca286", "e1848ce185a9e186bd"],
+ ["eca286", "eca1b0e186bd"],
+ ["eca287", "e1848ce185a9e186be"],
+ ["eca287", "eca1b0e186be"],
+ ["eca288", "e1848ce185a9e186bf"],
+ ["eca288", "eca1b0e186bf"],
+ ["eca289", "e1848ce185a9e18780"],
+ ["eca289", "eca1b0e18780"],
+ ["eca28a", "e1848ce185a9e18781"],
+ ["eca28a", "eca1b0e18781"],
+ ["eca28b", "e1848ce185a9e18782"],
+ ["eca28b", "eca1b0e18782"],
+ ["eca28c", "e1848ce185aa"],
+ ["eca28d", "e1848ce185aae186a8"],
+ ["eca28d", "eca28ce186a8"],
+ ["eca28e", "e1848ce185aae186a9"],
+ ["eca28e", "eca28ce186a9"],
+ ["eca28f", "e1848ce185aae186aa"],
+ ["eca28f", "eca28ce186aa"],
+ ["eca290", "e1848ce185aae186ab"],
+ ["eca290", "eca28ce186ab"],
+ ["eca291", "e1848ce185aae186ac"],
+ ["eca291", "eca28ce186ac"],
+ ["eca292", "e1848ce185aae186ad"],
+ ["eca292", "eca28ce186ad"],
+ ["eca293", "e1848ce185aae186ae"],
+ ["eca293", "eca28ce186ae"],
+ ["eca294", "e1848ce185aae186af"],
+ ["eca294", "eca28ce186af"],
+ ["eca295", "e1848ce185aae186b0"],
+ ["eca295", "eca28ce186b0"],
+ ["eca296", "e1848ce185aae186b1"],
+ ["eca296", "eca28ce186b1"],
+ ["eca297", "e1848ce185aae186b2"],
+ ["eca297", "eca28ce186b2"],
+ ["eca298", "e1848ce185aae186b3"],
+ ["eca298", "eca28ce186b3"],
+ ["eca299", "e1848ce185aae186b4"],
+ ["eca299", "eca28ce186b4"],
+ ["eca29a", "e1848ce185aae186b5"],
+ ["eca29a", "eca28ce186b5"],
+ ["eca29b", "e1848ce185aae186b6"],
+ ["eca29b", "eca28ce186b6"],
+ ["eca29c", "e1848ce185aae186b7"],
+ ["eca29c", "eca28ce186b7"],
+ ["eca29d", "e1848ce185aae186b8"],
+ ["eca29d", "eca28ce186b8"],
+ ["eca29e", "e1848ce185aae186b9"],
+ ["eca29e", "eca28ce186b9"],
+ ["eca29f", "e1848ce185aae186ba"],
+ ["eca29f", "eca28ce186ba"],
+ ["eca2a0", "e1848ce185aae186bb"],
+ ["eca2a0", "eca28ce186bb"],
+ ["eca2a1", "e1848ce185aae186bc"],
+ ["eca2a1", "eca28ce186bc"],
+ ["eca2a2", "e1848ce185aae186bd"],
+ ["eca2a2", "eca28ce186bd"],
+ ["eca2a3", "e1848ce185aae186be"],
+ ["eca2a3", "eca28ce186be"],
+ ["eca2a4", "e1848ce185aae186bf"],
+ ["eca2a4", "eca28ce186bf"],
+ ["eca2a5", "e1848ce185aae18780"],
+ ["eca2a5", "eca28ce18780"],
+ ["eca2a6", "e1848ce185aae18781"],
+ ["eca2a6", "eca28ce18781"],
+ ["eca2a7", "e1848ce185aae18782"],
+ ["eca2a7", "eca28ce18782"],
+ ["eca2a8", "e1848ce185ab"],
+ ["eca2a9", "e1848ce185abe186a8"],
+ ["eca2a9", "eca2a8e186a8"],
+ ["eca2aa", "e1848ce185abe186a9"],
+ ["eca2aa", "eca2a8e186a9"],
+ ["eca2ab", "e1848ce185abe186aa"],
+ ["eca2ab", "eca2a8e186aa"],
+ ["eca2ac", "e1848ce185abe186ab"],
+ ["eca2ac", "eca2a8e186ab"],
+ ["eca2ad", "e1848ce185abe186ac"],
+ ["eca2ad", "eca2a8e186ac"],
+ ["eca2ae", "e1848ce185abe186ad"],
+ ["eca2ae", "eca2a8e186ad"],
+ ["eca2af", "e1848ce185abe186ae"],
+ ["eca2af", "eca2a8e186ae"],
+ ["eca2b0", "e1848ce185abe186af"],
+ ["eca2b0", "eca2a8e186af"],
+ ["eca2b1", "e1848ce185abe186b0"],
+ ["eca2b1", "eca2a8e186b0"],
+ ["eca2b2", "e1848ce185abe186b1"],
+ ["eca2b2", "eca2a8e186b1"],
+ ["eca2b3", "e1848ce185abe186b2"],
+ ["eca2b3", "eca2a8e186b2"],
+ ["eca2b4", "e1848ce185abe186b3"],
+ ["eca2b4", "eca2a8e186b3"],
+ ["eca2b5", "e1848ce185abe186b4"],
+ ["eca2b5", "eca2a8e186b4"],
+ ["eca2b6", "e1848ce185abe186b5"],
+ ["eca2b6", "eca2a8e186b5"],
+ ["eca2b7", "e1848ce185abe186b6"],
+ ["eca2b7", "eca2a8e186b6"],
+ ["eca2b8", "e1848ce185abe186b7"],
+ ["eca2b8", "eca2a8e186b7"],
+ ["eca2b9", "e1848ce185abe186b8"],
+ ["eca2b9", "eca2a8e186b8"],
+ ["eca2ba", "e1848ce185abe186b9"],
+ ["eca2ba", "eca2a8e186b9"],
+ ["eca2bb", "e1848ce185abe186ba"],
+ ["eca2bb", "eca2a8e186ba"],
+ ["eca2bc", "e1848ce185abe186bb"],
+ ["eca2bc", "eca2a8e186bb"],
+ ["eca2bd", "e1848ce185abe186bc"],
+ ["eca2bd", "eca2a8e186bc"],
+ ["eca2be", "e1848ce185abe186bd"],
+ ["eca2be", "eca2a8e186bd"],
+ ["eca2bf", "e1848ce185abe186be"],
+ ["eca2bf", "eca2a8e186be"],
+ ["eca380", "e1848ce185abe186bf"],
+ ["eca380", "eca2a8e186bf"],
+ ["eca381", "e1848ce185abe18780"],
+ ["eca381", "eca2a8e18780"],
+ ["eca382", "e1848ce185abe18781"],
+ ["eca382", "eca2a8e18781"],
+ ["eca383", "e1848ce185abe18782"],
+ ["eca383", "eca2a8e18782"],
+ ["eca384", "e1848ce185ac"],
+ ["eca385", "e1848ce185ace186a8"],
+ ["eca385", "eca384e186a8"],
+ ["eca386", "e1848ce185ace186a9"],
+ ["eca386", "eca384e186a9"],
+ ["eca387", "e1848ce185ace186aa"],
+ ["eca387", "eca384e186aa"],
+ ["eca388", "e1848ce185ace186ab"],
+ ["eca388", "eca384e186ab"],
+ ["eca389", "e1848ce185ace186ac"],
+ ["eca389", "eca384e186ac"],
+ ["eca38a", "e1848ce185ace186ad"],
+ ["eca38a", "eca384e186ad"],
+ ["eca38b", "e1848ce185ace186ae"],
+ ["eca38b", "eca384e186ae"],
+ ["eca38c", "e1848ce185ace186af"],
+ ["eca38c", "eca384e186af"],
+ ["eca38d", "e1848ce185ace186b0"],
+ ["eca38d", "eca384e186b0"],
+ ["eca38e", "e1848ce185ace186b1"],
+ ["eca38e", "eca384e186b1"],
+ ["eca38f", "e1848ce185ace186b2"],
+ ["eca38f", "eca384e186b2"],
+ ["eca390", "e1848ce185ace186b3"],
+ ["eca390", "eca384e186b3"],
+ ["eca391", "e1848ce185ace186b4"],
+ ["eca391", "eca384e186b4"],
+ ["eca392", "e1848ce185ace186b5"],
+ ["eca392", "eca384e186b5"],
+ ["eca393", "e1848ce185ace186b6"],
+ ["eca393", "eca384e186b6"],
+ ["eca394", "e1848ce185ace186b7"],
+ ["eca394", "eca384e186b7"],
+ ["eca395", "e1848ce185ace186b8"],
+ ["eca395", "eca384e186b8"],
+ ["eca396", "e1848ce185ace186b9"],
+ ["eca396", "eca384e186b9"],
+ ["eca397", "e1848ce185ace186ba"],
+ ["eca397", "eca384e186ba"],
+ ["eca398", "e1848ce185ace186bb"],
+ ["eca398", "eca384e186bb"],
+ ["eca399", "e1848ce185ace186bc"],
+ ["eca399", "eca384e186bc"],
+ ["eca39a", "e1848ce185ace186bd"],
+ ["eca39a", "eca384e186bd"],
+ ["eca39b", "e1848ce185ace186be"],
+ ["eca39b", "eca384e186be"],
+ ["eca39c", "e1848ce185ace186bf"],
+ ["eca39c", "eca384e186bf"],
+ ["eca39d", "e1848ce185ace18780"],
+ ["eca39d", "eca384e18780"],
+ ["eca39e", "e1848ce185ace18781"],
+ ["eca39e", "eca384e18781"],
+ ["eca39f", "e1848ce185ace18782"],
+ ["eca39f", "eca384e18782"],
+ ["eca3a0", "e1848ce185ad"],
+ ["eca3a1", "e1848ce185ade186a8"],
+ ["eca3a1", "eca3a0e186a8"],
+ ["eca3a2", "e1848ce185ade186a9"],
+ ["eca3a2", "eca3a0e186a9"],
+ ["eca3a3", "e1848ce185ade186aa"],
+ ["eca3a3", "eca3a0e186aa"],
+ ["eca3a4", "e1848ce185ade186ab"],
+ ["eca3a4", "eca3a0e186ab"],
+ ["eca3a5", "e1848ce185ade186ac"],
+ ["eca3a5", "eca3a0e186ac"],
+ ["eca3a6", "e1848ce185ade186ad"],
+ ["eca3a6", "eca3a0e186ad"],
+ ["eca3a7", "e1848ce185ade186ae"],
+ ["eca3a7", "eca3a0e186ae"],
+ ["eca3a8", "e1848ce185ade186af"],
+ ["eca3a8", "eca3a0e186af"],
+ ["eca3a9", "e1848ce185ade186b0"],
+ ["eca3a9", "eca3a0e186b0"],
+ ["eca3aa", "e1848ce185ade186b1"],
+ ["eca3aa", "eca3a0e186b1"],
+ ["eca3ab", "e1848ce185ade186b2"],
+ ["eca3ab", "eca3a0e186b2"],
+ ["eca3ac", "e1848ce185ade186b3"],
+ ["eca3ac", "eca3a0e186b3"],
+ ["eca3ad", "e1848ce185ade186b4"],
+ ["eca3ad", "eca3a0e186b4"],
+ ["eca3ae", "e1848ce185ade186b5"],
+ ["eca3ae", "eca3a0e186b5"],
+ ["eca3af", "e1848ce185ade186b6"],
+ ["eca3af", "eca3a0e186b6"],
+ ["eca3b0", "e1848ce185ade186b7"],
+ ["eca3b0", "eca3a0e186b7"],
+ ["eca3b1", "e1848ce185ade186b8"],
+ ["eca3b1", "eca3a0e186b8"],
+ ["eca3b2", "e1848ce185ade186b9"],
+ ["eca3b2", "eca3a0e186b9"],
+ ["eca3b3", "e1848ce185ade186ba"],
+ ["eca3b3", "eca3a0e186ba"],
+ ["eca3b4", "e1848ce185ade186bb"],
+ ["eca3b4", "eca3a0e186bb"],
+ ["eca3b5", "e1848ce185ade186bc"],
+ ["eca3b5", "eca3a0e186bc"],
+ ["eca3b6", "e1848ce185ade186bd"],
+ ["eca3b6", "eca3a0e186bd"],
+ ["eca3b7", "e1848ce185ade186be"],
+ ["eca3b7", "eca3a0e186be"],
+ ["eca3b8", "e1848ce185ade186bf"],
+ ["eca3b8", "eca3a0e186bf"],
+ ["eca3b9", "e1848ce185ade18780"],
+ ["eca3b9", "eca3a0e18780"],
+ ["eca3ba", "e1848ce185ade18781"],
+ ["eca3ba", "eca3a0e18781"],
+ ["eca3bb", "e1848ce185ade18782"],
+ ["eca3bb", "eca3a0e18782"],
+ ["eca3bc", "e1848ce185ae"],
+ ["eca3bd", "e1848ce185aee186a8"],
+ ["eca3bd", "eca3bce186a8"],
+ ["eca3be", "e1848ce185aee186a9"],
+ ["eca3be", "eca3bce186a9"],
+ ["eca3bf", "e1848ce185aee186aa"],
+ ["eca3bf", "eca3bce186aa"],
+ ["eca480", "e1848ce185aee186ab"],
+ ["eca480", "eca3bce186ab"],
+ ["eca481", "e1848ce185aee186ac"],
+ ["eca481", "eca3bce186ac"],
+ ["eca482", "e1848ce185aee186ad"],
+ ["eca482", "eca3bce186ad"],
+ ["eca483", "e1848ce185aee186ae"],
+ ["eca483", "eca3bce186ae"],
+ ["eca484", "e1848ce185aee186af"],
+ ["eca484", "eca3bce186af"],
+ ["eca485", "e1848ce185aee186b0"],
+ ["eca485", "eca3bce186b0"],
+ ["eca486", "e1848ce185aee186b1"],
+ ["eca486", "eca3bce186b1"],
+ ["eca487", "e1848ce185aee186b2"],
+ ["eca487", "eca3bce186b2"],
+ ["eca488", "e1848ce185aee186b3"],
+ ["eca488", "eca3bce186b3"],
+ ["eca489", "e1848ce185aee186b4"],
+ ["eca489", "eca3bce186b4"],
+ ["eca48a", "e1848ce185aee186b5"],
+ ["eca48a", "eca3bce186b5"],
+ ["eca48b", "e1848ce185aee186b6"],
+ ["eca48b", "eca3bce186b6"],
+ ["eca48c", "e1848ce185aee186b7"],
+ ["eca48c", "eca3bce186b7"],
+ ["eca48d", "e1848ce185aee186b8"],
+ ["eca48d", "eca3bce186b8"],
+ ["eca48e", "e1848ce185aee186b9"],
+ ["eca48e", "eca3bce186b9"],
+ ["eca48f", "e1848ce185aee186ba"],
+ ["eca48f", "eca3bce186ba"],
+ ["eca490", "e1848ce185aee186bb"],
+ ["eca490", "eca3bce186bb"],
+ ["eca491", "e1848ce185aee186bc"],
+ ["eca491", "eca3bce186bc"],
+ ["eca492", "e1848ce185aee186bd"],
+ ["eca492", "eca3bce186bd"],
+ ["eca493", "e1848ce185aee186be"],
+ ["eca493", "eca3bce186be"],
+ ["eca494", "e1848ce185aee186bf"],
+ ["eca494", "eca3bce186bf"],
+ ["eca495", "e1848ce185aee18780"],
+ ["eca495", "eca3bce18780"],
+ ["eca496", "e1848ce185aee18781"],
+ ["eca496", "eca3bce18781"],
+ ["eca497", "e1848ce185aee18782"],
+ ["eca497", "eca3bce18782"],
+ ["eca498", "e1848ce185af"],
+ ["eca499", "e1848ce185afe186a8"],
+ ["eca499", "eca498e186a8"],
+ ["eca49a", "e1848ce185afe186a9"],
+ ["eca49a", "eca498e186a9"],
+ ["eca49b", "e1848ce185afe186aa"],
+ ["eca49b", "eca498e186aa"],
+ ["eca49c", "e1848ce185afe186ab"],
+ ["eca49c", "eca498e186ab"],
+ ["eca49d", "e1848ce185afe186ac"],
+ ["eca49d", "eca498e186ac"],
+ ["eca49e", "e1848ce185afe186ad"],
+ ["eca49e", "eca498e186ad"],
+ ["eca49f", "e1848ce185afe186ae"],
+ ["eca49f", "eca498e186ae"],
+ ["eca4a0", "e1848ce185afe186af"],
+ ["eca4a0", "eca498e186af"],
+ ["eca4a1", "e1848ce185afe186b0"],
+ ["eca4a1", "eca498e186b0"],
+ ["eca4a2", "e1848ce185afe186b1"],
+ ["eca4a2", "eca498e186b1"],
+ ["eca4a3", "e1848ce185afe186b2"],
+ ["eca4a3", "eca498e186b2"],
+ ["eca4a4", "e1848ce185afe186b3"],
+ ["eca4a4", "eca498e186b3"],
+ ["eca4a5", "e1848ce185afe186b4"],
+ ["eca4a5", "eca498e186b4"],
+ ["eca4a6", "e1848ce185afe186b5"],
+ ["eca4a6", "eca498e186b5"],
+ ["eca4a7", "e1848ce185afe186b6"],
+ ["eca4a7", "eca498e186b6"],
+ ["eca4a8", "e1848ce185afe186b7"],
+ ["eca4a8", "eca498e186b7"],
+ ["eca4a9", "e1848ce185afe186b8"],
+ ["eca4a9", "eca498e186b8"],
+ ["eca4aa", "e1848ce185afe186b9"],
+ ["eca4aa", "eca498e186b9"],
+ ["eca4ab", "e1848ce185afe186ba"],
+ ["eca4ab", "eca498e186ba"],
+ ["eca4ac", "e1848ce185afe186bb"],
+ ["eca4ac", "eca498e186bb"],
+ ["eca4ad", "e1848ce185afe186bc"],
+ ["eca4ad", "eca498e186bc"],
+ ["eca4ae", "e1848ce185afe186bd"],
+ ["eca4ae", "eca498e186bd"],
+ ["eca4af", "e1848ce185afe186be"],
+ ["eca4af", "eca498e186be"],
+ ["eca4b0", "e1848ce185afe186bf"],
+ ["eca4b0", "eca498e186bf"],
+ ["eca4b1", "e1848ce185afe18780"],
+ ["eca4b1", "eca498e18780"],
+ ["eca4b2", "e1848ce185afe18781"],
+ ["eca4b2", "eca498e18781"],
+ ["eca4b3", "e1848ce185afe18782"],
+ ["eca4b3", "eca498e18782"],
+ ["eca4b4", "e1848ce185b0"],
+ ["eca4b5", "e1848ce185b0e186a8"],
+ ["eca4b5", "eca4b4e186a8"],
+ ["eca4b6", "e1848ce185b0e186a9"],
+ ["eca4b6", "eca4b4e186a9"],
+ ["eca4b7", "e1848ce185b0e186aa"],
+ ["eca4b7", "eca4b4e186aa"],
+ ["eca4b8", "e1848ce185b0e186ab"],
+ ["eca4b8", "eca4b4e186ab"],
+ ["eca4b9", "e1848ce185b0e186ac"],
+ ["eca4b9", "eca4b4e186ac"],
+ ["eca4ba", "e1848ce185b0e186ad"],
+ ["eca4ba", "eca4b4e186ad"],
+ ["eca4bb", "e1848ce185b0e186ae"],
+ ["eca4bb", "eca4b4e186ae"],
+ ["eca4bc", "e1848ce185b0e186af"],
+ ["eca4bc", "eca4b4e186af"],
+ ["eca4bd", "e1848ce185b0e186b0"],
+ ["eca4bd", "eca4b4e186b0"],
+ ["eca4be", "e1848ce185b0e186b1"],
+ ["eca4be", "eca4b4e186b1"],
+ ["eca4bf", "e1848ce185b0e186b2"],
+ ["eca4bf", "eca4b4e186b2"],
+ ["eca580", "e1848ce185b0e186b3"],
+ ["eca580", "eca4b4e186b3"],
+ ["eca581", "e1848ce185b0e186b4"],
+ ["eca581", "eca4b4e186b4"],
+ ["eca582", "e1848ce185b0e186b5"],
+ ["eca582", "eca4b4e186b5"],
+ ["eca583", "e1848ce185b0e186b6"],
+ ["eca583", "eca4b4e186b6"],
+ ["eca584", "e1848ce185b0e186b7"],
+ ["eca584", "eca4b4e186b7"],
+ ["eca585", "e1848ce185b0e186b8"],
+ ["eca585", "eca4b4e186b8"],
+ ["eca586", "e1848ce185b0e186b9"],
+ ["eca586", "eca4b4e186b9"],
+ ["eca587", "e1848ce185b0e186ba"],
+ ["eca587", "eca4b4e186ba"],
+ ["eca588", "e1848ce185b0e186bb"],
+ ["eca588", "eca4b4e186bb"],
+ ["eca589", "e1848ce185b0e186bc"],
+ ["eca589", "eca4b4e186bc"],
+ ["eca58a", "e1848ce185b0e186bd"],
+ ["eca58a", "eca4b4e186bd"],
+ ["eca58b", "e1848ce185b0e186be"],
+ ["eca58b", "eca4b4e186be"],
+ ["eca58c", "e1848ce185b0e186bf"],
+ ["eca58c", "eca4b4e186bf"],
+ ["eca58d", "e1848ce185b0e18780"],
+ ["eca58d", "eca4b4e18780"],
+ ["eca58e", "e1848ce185b0e18781"],
+ ["eca58e", "eca4b4e18781"],
+ ["eca58f", "e1848ce185b0e18782"],
+ ["eca58f", "eca4b4e18782"],
+ ["eca590", "e1848ce185b1"],
+ ["eca591", "e1848ce185b1e186a8"],
+ ["eca591", "eca590e186a8"],
+ ["eca592", "e1848ce185b1e186a9"],
+ ["eca592", "eca590e186a9"],
+ ["eca593", "e1848ce185b1e186aa"],
+ ["eca593", "eca590e186aa"],
+ ["eca594", "e1848ce185b1e186ab"],
+ ["eca594", "eca590e186ab"],
+ ["eca595", "e1848ce185b1e186ac"],
+ ["eca595", "eca590e186ac"],
+ ["eca596", "e1848ce185b1e186ad"],
+ ["eca596", "eca590e186ad"],
+ ["eca597", "e1848ce185b1e186ae"],
+ ["eca597", "eca590e186ae"],
+ ["eca598", "e1848ce185b1e186af"],
+ ["eca598", "eca590e186af"],
+ ["eca599", "e1848ce185b1e186b0"],
+ ["eca599", "eca590e186b0"],
+ ["eca59a", "e1848ce185b1e186b1"],
+ ["eca59a", "eca590e186b1"],
+ ["eca59b", "e1848ce185b1e186b2"],
+ ["eca59b", "eca590e186b2"],
+ ["eca59c", "e1848ce185b1e186b3"],
+ ["eca59c", "eca590e186b3"],
+ ["eca59d", "e1848ce185b1e186b4"],
+ ["eca59d", "eca590e186b4"],
+ ["eca59e", "e1848ce185b1e186b5"],
+ ["eca59e", "eca590e186b5"],
+ ["eca59f", "e1848ce185b1e186b6"],
+ ["eca59f", "eca590e186b6"],
+ ["eca5a0", "e1848ce185b1e186b7"],
+ ["eca5a0", "eca590e186b7"],
+ ["eca5a1", "e1848ce185b1e186b8"],
+ ["eca5a1", "eca590e186b8"],
+ ["eca5a2", "e1848ce185b1e186b9"],
+ ["eca5a2", "eca590e186b9"],
+ ["eca5a3", "e1848ce185b1e186ba"],
+ ["eca5a3", "eca590e186ba"],
+ ["eca5a4", "e1848ce185b1e186bb"],
+ ["eca5a4", "eca590e186bb"],
+ ["eca5a5", "e1848ce185b1e186bc"],
+ ["eca5a5", "eca590e186bc"],
+ ["eca5a6", "e1848ce185b1e186bd"],
+ ["eca5a6", "eca590e186bd"],
+ ["eca5a7", "e1848ce185b1e186be"],
+ ["eca5a7", "eca590e186be"],
+ ["eca5a8", "e1848ce185b1e186bf"],
+ ["eca5a8", "eca590e186bf"],
+ ["eca5a9", "e1848ce185b1e18780"],
+ ["eca5a9", "eca590e18780"],
+ ["eca5aa", "e1848ce185b1e18781"],
+ ["eca5aa", "eca590e18781"],
+ ["eca5ab", "e1848ce185b1e18782"],
+ ["eca5ab", "eca590e18782"],
+ ["eca5ac", "e1848ce185b2"],
+ ["eca5ad", "e1848ce185b2e186a8"],
+ ["eca5ad", "eca5ace186a8"],
+ ["eca5ae", "e1848ce185b2e186a9"],
+ ["eca5ae", "eca5ace186a9"],
+ ["eca5af", "e1848ce185b2e186aa"],
+ ["eca5af", "eca5ace186aa"],
+ ["eca5b0", "e1848ce185b2e186ab"],
+ ["eca5b0", "eca5ace186ab"],
+ ["eca5b1", "e1848ce185b2e186ac"],
+ ["eca5b1", "eca5ace186ac"],
+ ["eca5b2", "e1848ce185b2e186ad"],
+ ["eca5b2", "eca5ace186ad"],
+ ["eca5b3", "e1848ce185b2e186ae"],
+ ["eca5b3", "eca5ace186ae"],
+ ["eca5b4", "e1848ce185b2e186af"],
+ ["eca5b4", "eca5ace186af"],
+ ["eca5b5", "e1848ce185b2e186b0"],
+ ["eca5b5", "eca5ace186b0"],
+ ["eca5b6", "e1848ce185b2e186b1"],
+ ["eca5b6", "eca5ace186b1"],
+ ["eca5b7", "e1848ce185b2e186b2"],
+ ["eca5b7", "eca5ace186b2"],
+ ["eca5b8", "e1848ce185b2e186b3"],
+ ["eca5b8", "eca5ace186b3"],
+ ["eca5b9", "e1848ce185b2e186b4"],
+ ["eca5b9", "eca5ace186b4"],
+ ["eca5ba", "e1848ce185b2e186b5"],
+ ["eca5ba", "eca5ace186b5"],
+ ["eca5bb", "e1848ce185b2e186b6"],
+ ["eca5bb", "eca5ace186b6"],
+ ["eca5bc", "e1848ce185b2e186b7"],
+ ["eca5bc", "eca5ace186b7"],
+ ["eca5bd", "e1848ce185b2e186b8"],
+ ["eca5bd", "eca5ace186b8"],
+ ["eca5be", "e1848ce185b2e186b9"],
+ ["eca5be", "eca5ace186b9"],
+ ["eca5bf", "e1848ce185b2e186ba"],
+ ["eca5bf", "eca5ace186ba"],
+ ["eca680", "e1848ce185b2e186bb"],
+ ["eca680", "eca5ace186bb"],
+ ["eca681", "e1848ce185b2e186bc"],
+ ["eca681", "eca5ace186bc"],
+ ["eca682", "e1848ce185b2e186bd"],
+ ["eca682", "eca5ace186bd"],
+ ["eca683", "e1848ce185b2e186be"],
+ ["eca683", "eca5ace186be"],
+ ["eca684", "e1848ce185b2e186bf"],
+ ["eca684", "eca5ace186bf"],
+ ["eca685", "e1848ce185b2e18780"],
+ ["eca685", "eca5ace18780"],
+ ["eca686", "e1848ce185b2e18781"],
+ ["eca686", "eca5ace18781"],
+ ["eca687", "e1848ce185b2e18782"],
+ ["eca687", "eca5ace18782"],
+ ["eca688", "e1848ce185b3"],
+ ["eca689", "e1848ce185b3e186a8"],
+ ["eca689", "eca688e186a8"],
+ ["eca68a", "e1848ce185b3e186a9"],
+ ["eca68a", "eca688e186a9"],
+ ["eca68b", "e1848ce185b3e186aa"],
+ ["eca68b", "eca688e186aa"],
+ ["eca68c", "e1848ce185b3e186ab"],
+ ["eca68c", "eca688e186ab"],
+ ["eca68d", "e1848ce185b3e186ac"],
+ ["eca68d", "eca688e186ac"],
+ ["eca68e", "e1848ce185b3e186ad"],
+ ["eca68e", "eca688e186ad"],
+ ["eca68f", "e1848ce185b3e186ae"],
+ ["eca68f", "eca688e186ae"],
+ ["eca690", "e1848ce185b3e186af"],
+ ["eca690", "eca688e186af"],
+ ["eca691", "e1848ce185b3e186b0"],
+ ["eca691", "eca688e186b0"],
+ ["eca692", "e1848ce185b3e186b1"],
+ ["eca692", "eca688e186b1"],
+ ["eca693", "e1848ce185b3e186b2"],
+ ["eca693", "eca688e186b2"],
+ ["eca694", "e1848ce185b3e186b3"],
+ ["eca694", "eca688e186b3"],
+ ["eca695", "e1848ce185b3e186b4"],
+ ["eca695", "eca688e186b4"],
+ ["eca696", "e1848ce185b3e186b5"],
+ ["eca696", "eca688e186b5"],
+ ["eca697", "e1848ce185b3e186b6"],
+ ["eca697", "eca688e186b6"],
+ ["eca698", "e1848ce185b3e186b7"],
+ ["eca698", "eca688e186b7"],
+ ["eca699", "e1848ce185b3e186b8"],
+ ["eca699", "eca688e186b8"],
+ ["eca69a", "e1848ce185b3e186b9"],
+ ["eca69a", "eca688e186b9"],
+ ["eca69b", "e1848ce185b3e186ba"],
+ ["eca69b", "eca688e186ba"],
+ ["eca69c", "e1848ce185b3e186bb"],
+ ["eca69c", "eca688e186bb"],
+ ["eca69d", "e1848ce185b3e186bc"],
+ ["eca69d", "eca688e186bc"],
+ ["eca69e", "e1848ce185b3e186bd"],
+ ["eca69e", "eca688e186bd"],
+ ["eca69f", "e1848ce185b3e186be"],
+ ["eca69f", "eca688e186be"],
+ ["eca6a0", "e1848ce185b3e186bf"],
+ ["eca6a0", "eca688e186bf"],
+ ["eca6a1", "e1848ce185b3e18780"],
+ ["eca6a1", "eca688e18780"],
+ ["eca6a2", "e1848ce185b3e18781"],
+ ["eca6a2", "eca688e18781"],
+ ["eca6a3", "e1848ce185b3e18782"],
+ ["eca6a3", "eca688e18782"],
+ ["eca6a4", "e1848ce185b4"],
+ ["eca6a5", "e1848ce185b4e186a8"],
+ ["eca6a5", "eca6a4e186a8"],
+ ["eca6a6", "e1848ce185b4e186a9"],
+ ["eca6a6", "eca6a4e186a9"],
+ ["eca6a7", "e1848ce185b4e186aa"],
+ ["eca6a7", "eca6a4e186aa"],
+ ["eca6a8", "e1848ce185b4e186ab"],
+ ["eca6a8", "eca6a4e186ab"],
+ ["eca6a9", "e1848ce185b4e186ac"],
+ ["eca6a9", "eca6a4e186ac"],
+ ["eca6aa", "e1848ce185b4e186ad"],
+ ["eca6aa", "eca6a4e186ad"],
+ ["eca6ab", "e1848ce185b4e186ae"],
+ ["eca6ab", "eca6a4e186ae"],
+ ["eca6ac", "e1848ce185b4e186af"],
+ ["eca6ac", "eca6a4e186af"],
+ ["eca6ad", "e1848ce185b4e186b0"],
+ ["eca6ad", "eca6a4e186b0"],
+ ["eca6ae", "e1848ce185b4e186b1"],
+ ["eca6ae", "eca6a4e186b1"],
+ ["eca6af", "e1848ce185b4e186b2"],
+ ["eca6af", "eca6a4e186b2"],
+ ["eca6b0", "e1848ce185b4e186b3"],
+ ["eca6b0", "eca6a4e186b3"],
+ ["eca6b1", "e1848ce185b4e186b4"],
+ ["eca6b1", "eca6a4e186b4"],
+ ["eca6b2", "e1848ce185b4e186b5"],
+ ["eca6b2", "eca6a4e186b5"],
+ ["eca6b3", "e1848ce185b4e186b6"],
+ ["eca6b3", "eca6a4e186b6"],
+ ["eca6b4", "e1848ce185b4e186b7"],
+ ["eca6b4", "eca6a4e186b7"],
+ ["eca6b5", "e1848ce185b4e186b8"],
+ ["eca6b5", "eca6a4e186b8"],
+ ["eca6b6", "e1848ce185b4e186b9"],
+ ["eca6b6", "eca6a4e186b9"],
+ ["eca6b7", "e1848ce185b4e186ba"],
+ ["eca6b7", "eca6a4e186ba"],
+ ["eca6b8", "e1848ce185b4e186bb"],
+ ["eca6b8", "eca6a4e186bb"],
+ ["eca6b9", "e1848ce185b4e186bc"],
+ ["eca6b9", "eca6a4e186bc"],
+ ["eca6ba", "e1848ce185b4e186bd"],
+ ["eca6ba", "eca6a4e186bd"],
+ ["eca6bb", "e1848ce185b4e186be"],
+ ["eca6bb", "eca6a4e186be"],
+ ["eca6bc", "e1848ce185b4e186bf"],
+ ["eca6bc", "eca6a4e186bf"],
+ ["eca6bd", "e1848ce185b4e18780"],
+ ["eca6bd", "eca6a4e18780"],
+ ["eca6be", "e1848ce185b4e18781"],
+ ["eca6be", "eca6a4e18781"],
+ ["eca6bf", "e1848ce185b4e18782"],
+ ["eca6bf", "eca6a4e18782"],
+ ["eca780", "e1848ce185b5"],
+ ["eca781", "e1848ce185b5e186a8"],
+ ["eca781", "eca780e186a8"],
+ ["eca782", "e1848ce185b5e186a9"],
+ ["eca782", "eca780e186a9"],
+ ["eca783", "e1848ce185b5e186aa"],
+ ["eca783", "eca780e186aa"],
+ ["eca784", "e1848ce185b5e186ab"],
+ ["eca784", "eca780e186ab"],
+ ["eca785", "e1848ce185b5e186ac"],
+ ["eca785", "eca780e186ac"],
+ ["eca786", "e1848ce185b5e186ad"],
+ ["eca786", "eca780e186ad"],
+ ["eca787", "e1848ce185b5e186ae"],
+ ["eca787", "eca780e186ae"],
+ ["eca788", "e1848ce185b5e186af"],
+ ["eca788", "eca780e186af"],
+ ["eca789", "e1848ce185b5e186b0"],
+ ["eca789", "eca780e186b0"],
+ ["eca78a", "e1848ce185b5e186b1"],
+ ["eca78a", "eca780e186b1"],
+ ["eca78b", "e1848ce185b5e186b2"],
+ ["eca78b", "eca780e186b2"],
+ ["eca78c", "e1848ce185b5e186b3"],
+ ["eca78c", "eca780e186b3"],
+ ["eca78d", "e1848ce185b5e186b4"],
+ ["eca78d", "eca780e186b4"],
+ ["eca78e", "e1848ce185b5e186b5"],
+ ["eca78e", "eca780e186b5"],
+ ["eca78f", "e1848ce185b5e186b6"],
+ ["eca78f", "eca780e186b6"],
+ ["eca790", "e1848ce185b5e186b7"],
+ ["eca790", "eca780e186b7"],
+ ["eca791", "e1848ce185b5e186b8"],
+ ["eca791", "eca780e186b8"],
+ ["eca792", "e1848ce185b5e186b9"],
+ ["eca792", "eca780e186b9"],
+ ["eca793", "e1848ce185b5e186ba"],
+ ["eca793", "eca780e186ba"],
+ ["eca794", "e1848ce185b5e186bb"],
+ ["eca794", "eca780e186bb"],
+ ["eca795", "e1848ce185b5e186bc"],
+ ["eca795", "eca780e186bc"],
+ ["eca796", "e1848ce185b5e186bd"],
+ ["eca796", "eca780e186bd"],
+ ["eca797", "e1848ce185b5e186be"],
+ ["eca797", "eca780e186be"],
+ ["eca798", "e1848ce185b5e186bf"],
+ ["eca798", "eca780e186bf"],
+ ["eca799", "e1848ce185b5e18780"],
+ ["eca799", "eca780e18780"],
+ ["eca79a", "e1848ce185b5e18781"],
+ ["eca79a", "eca780e18781"],
+ ["eca79b", "e1848ce185b5e18782"],
+ ["eca79b", "eca780e18782"],
+ ["eca79c", "e1848de185a1"],
+ ["eca79d", "e1848de185a1e186a8"],
+ ["eca79d", "eca79ce186a8"],
+ ["eca79e", "e1848de185a1e186a9"],
+ ["eca79e", "eca79ce186a9"],
+ ["eca79f", "e1848de185a1e186aa"],
+ ["eca79f", "eca79ce186aa"],
+ ["eca7a0", "e1848de185a1e186ab"],
+ ["eca7a0", "eca79ce186ab"],
+ ["eca7a1", "e1848de185a1e186ac"],
+ ["eca7a1", "eca79ce186ac"],
+ ["eca7a2", "e1848de185a1e186ad"],
+ ["eca7a2", "eca79ce186ad"],
+ ["eca7a3", "e1848de185a1e186ae"],
+ ["eca7a3", "eca79ce186ae"],
+ ["eca7a4", "e1848de185a1e186af"],
+ ["eca7a4", "eca79ce186af"],
+ ["eca7a5", "e1848de185a1e186b0"],
+ ["eca7a5", "eca79ce186b0"],
+ ["eca7a6", "e1848de185a1e186b1"],
+ ["eca7a6", "eca79ce186b1"],
+ ["eca7a7", "e1848de185a1e186b2"],
+ ["eca7a7", "eca79ce186b2"],
+ ["eca7a8", "e1848de185a1e186b3"],
+ ["eca7a8", "eca79ce186b3"],
+ ["eca7a9", "e1848de185a1e186b4"],
+ ["eca7a9", "eca79ce186b4"],
+ ["eca7aa", "e1848de185a1e186b5"],
+ ["eca7aa", "eca79ce186b5"],
+ ["eca7ab", "e1848de185a1e186b6"],
+ ["eca7ab", "eca79ce186b6"],
+ ["eca7ac", "e1848de185a1e186b7"],
+ ["eca7ac", "eca79ce186b7"],
+ ["eca7ad", "e1848de185a1e186b8"],
+ ["eca7ad", "eca79ce186b8"],
+ ["eca7ae", "e1848de185a1e186b9"],
+ ["eca7ae", "eca79ce186b9"],
+ ["eca7af", "e1848de185a1e186ba"],
+ ["eca7af", "eca79ce186ba"],
+ ["eca7b0", "e1848de185a1e186bb"],
+ ["eca7b0", "eca79ce186bb"],
+ ["eca7b1", "e1848de185a1e186bc"],
+ ["eca7b1", "eca79ce186bc"],
+ ["eca7b2", "e1848de185a1e186bd"],
+ ["eca7b2", "eca79ce186bd"],
+ ["eca7b3", "e1848de185a1e186be"],
+ ["eca7b3", "eca79ce186be"],
+ ["eca7b4", "e1848de185a1e186bf"],
+ ["eca7b4", "eca79ce186bf"],
+ ["eca7b5", "e1848de185a1e18780"],
+ ["eca7b5", "eca79ce18780"],
+ ["eca7b6", "e1848de185a1e18781"],
+ ["eca7b6", "eca79ce18781"],
+ ["eca7b7", "e1848de185a1e18782"],
+ ["eca7b7", "eca79ce18782"],
+ ["eca7b8", "e1848de185a2"],
+ ["eca7b9", "e1848de185a2e186a8"],
+ ["eca7b9", "eca7b8e186a8"],
+ ["eca7ba", "e1848de185a2e186a9"],
+ ["eca7ba", "eca7b8e186a9"],
+ ["eca7bb", "e1848de185a2e186aa"],
+ ["eca7bb", "eca7b8e186aa"],
+ ["eca7bc", "e1848de185a2e186ab"],
+ ["eca7bc", "eca7b8e186ab"],
+ ["eca7bd", "e1848de185a2e186ac"],
+ ["eca7bd", "eca7b8e186ac"],
+ ["eca7be", "e1848de185a2e186ad"],
+ ["eca7be", "eca7b8e186ad"],
+ ["eca7bf", "e1848de185a2e186ae"],
+ ["eca7bf", "eca7b8e186ae"],
+ ["eca880", "e1848de185a2e186af"],
+ ["eca880", "eca7b8e186af"],
+ ["eca881", "e1848de185a2e186b0"],
+ ["eca881", "eca7b8e186b0"],
+ ["eca882", "e1848de185a2e186b1"],
+ ["eca882", "eca7b8e186b1"],
+ ["eca883", "e1848de185a2e186b2"],
+ ["eca883", "eca7b8e186b2"],
+ ["eca884", "e1848de185a2e186b3"],
+ ["eca884", "eca7b8e186b3"],
+ ["eca885", "e1848de185a2e186b4"],
+ ["eca885", "eca7b8e186b4"],
+ ["eca886", "e1848de185a2e186b5"],
+ ["eca886", "eca7b8e186b5"],
+ ["eca887", "e1848de185a2e186b6"],
+ ["eca887", "eca7b8e186b6"],
+ ["eca888", "e1848de185a2e186b7"],
+ ["eca888", "eca7b8e186b7"],
+ ["eca889", "e1848de185a2e186b8"],
+ ["eca889", "eca7b8e186b8"],
+ ["eca88a", "e1848de185a2e186b9"],
+ ["eca88a", "eca7b8e186b9"],
+ ["eca88b", "e1848de185a2e186ba"],
+ ["eca88b", "eca7b8e186ba"],
+ ["eca88c", "e1848de185a2e186bb"],
+ ["eca88c", "eca7b8e186bb"],
+ ["eca88d", "e1848de185a2e186bc"],
+ ["eca88d", "eca7b8e186bc"],
+ ["eca88e", "e1848de185a2e186bd"],
+ ["eca88e", "eca7b8e186bd"],
+ ["eca88f", "e1848de185a2e186be"],
+ ["eca88f", "eca7b8e186be"],
+ ["eca890", "e1848de185a2e186bf"],
+ ["eca890", "eca7b8e186bf"],
+ ["eca891", "e1848de185a2e18780"],
+ ["eca891", "eca7b8e18780"],
+ ["eca892", "e1848de185a2e18781"],
+ ["eca892", "eca7b8e18781"],
+ ["eca893", "e1848de185a2e18782"],
+ ["eca893", "eca7b8e18782"],
+ ["eca894", "e1848de185a3"],
+ ["eca895", "e1848de185a3e186a8"],
+ ["eca895", "eca894e186a8"],
+ ["eca896", "e1848de185a3e186a9"],
+ ["eca896", "eca894e186a9"],
+ ["eca897", "e1848de185a3e186aa"],
+ ["eca897", "eca894e186aa"],
+ ["eca898", "e1848de185a3e186ab"],
+ ["eca898", "eca894e186ab"],
+ ["eca899", "e1848de185a3e186ac"],
+ ["eca899", "eca894e186ac"],
+ ["eca89a", "e1848de185a3e186ad"],
+ ["eca89a", "eca894e186ad"],
+ ["eca89b", "e1848de185a3e186ae"],
+ ["eca89b", "eca894e186ae"],
+ ["eca89c", "e1848de185a3e186af"],
+ ["eca89c", "eca894e186af"],
+ ["eca89d", "e1848de185a3e186b0"],
+ ["eca89d", "eca894e186b0"],
+ ["eca89e", "e1848de185a3e186b1"],
+ ["eca89e", "eca894e186b1"],
+ ["eca89f", "e1848de185a3e186b2"],
+ ["eca89f", "eca894e186b2"],
+ ["eca8a0", "e1848de185a3e186b3"],
+ ["eca8a0", "eca894e186b3"],
+ ["eca8a1", "e1848de185a3e186b4"],
+ ["eca8a1", "eca894e186b4"],
+ ["eca8a2", "e1848de185a3e186b5"],
+ ["eca8a2", "eca894e186b5"],
+ ["eca8a3", "e1848de185a3e186b6"],
+ ["eca8a3", "eca894e186b6"],
+ ["eca8a4", "e1848de185a3e186b7"],
+ ["eca8a4", "eca894e186b7"],
+ ["eca8a5", "e1848de185a3e186b8"],
+ ["eca8a5", "eca894e186b8"],
+ ["eca8a6", "e1848de185a3e186b9"],
+ ["eca8a6", "eca894e186b9"],
+ ["eca8a7", "e1848de185a3e186ba"],
+ ["eca8a7", "eca894e186ba"],
+ ["eca8a8", "e1848de185a3e186bb"],
+ ["eca8a8", "eca894e186bb"],
+ ["eca8a9", "e1848de185a3e186bc"],
+ ["eca8a9", "eca894e186bc"],
+ ["eca8aa", "e1848de185a3e186bd"],
+ ["eca8aa", "eca894e186bd"],
+ ["eca8ab", "e1848de185a3e186be"],
+ ["eca8ab", "eca894e186be"],
+ ["eca8ac", "e1848de185a3e186bf"],
+ ["eca8ac", "eca894e186bf"],
+ ["eca8ad", "e1848de185a3e18780"],
+ ["eca8ad", "eca894e18780"],
+ ["eca8ae", "e1848de185a3e18781"],
+ ["eca8ae", "eca894e18781"],
+ ["eca8af", "e1848de185a3e18782"],
+ ["eca8af", "eca894e18782"],
+ ["eca8b0", "e1848de185a4"],
+ ["eca8b1", "e1848de185a4e186a8"],
+ ["eca8b1", "eca8b0e186a8"],
+ ["eca8b2", "e1848de185a4e186a9"],
+ ["eca8b2", "eca8b0e186a9"],
+ ["eca8b3", "e1848de185a4e186aa"],
+ ["eca8b3", "eca8b0e186aa"],
+ ["eca8b4", "e1848de185a4e186ab"],
+ ["eca8b4", "eca8b0e186ab"],
+ ["eca8b5", "e1848de185a4e186ac"],
+ ["eca8b5", "eca8b0e186ac"],
+ ["eca8b6", "e1848de185a4e186ad"],
+ ["eca8b6", "eca8b0e186ad"],
+ ["eca8b7", "e1848de185a4e186ae"],
+ ["eca8b7", "eca8b0e186ae"],
+ ["eca8b8", "e1848de185a4e186af"],
+ ["eca8b8", "eca8b0e186af"],
+ ["eca8b9", "e1848de185a4e186b0"],
+ ["eca8b9", "eca8b0e186b0"],
+ ["eca8ba", "e1848de185a4e186b1"],
+ ["eca8ba", "eca8b0e186b1"],
+ ["eca8bb", "e1848de185a4e186b2"],
+ ["eca8bb", "eca8b0e186b2"],
+ ["eca8bc", "e1848de185a4e186b3"],
+ ["eca8bc", "eca8b0e186b3"],
+ ["eca8bd", "e1848de185a4e186b4"],
+ ["eca8bd", "eca8b0e186b4"],
+ ["eca8be", "e1848de185a4e186b5"],
+ ["eca8be", "eca8b0e186b5"],
+ ["eca8bf", "e1848de185a4e186b6"],
+ ["eca8bf", "eca8b0e186b6"],
+ ["eca980", "e1848de185a4e186b7"],
+ ["eca980", "eca8b0e186b7"],
+ ["eca981", "e1848de185a4e186b8"],
+ ["eca981", "eca8b0e186b8"],
+ ["eca982", "e1848de185a4e186b9"],
+ ["eca982", "eca8b0e186b9"],
+ ["eca983", "e1848de185a4e186ba"],
+ ["eca983", "eca8b0e186ba"],
+ ["eca984", "e1848de185a4e186bb"],
+ ["eca984", "eca8b0e186bb"],
+ ["eca985", "e1848de185a4e186bc"],
+ ["eca985", "eca8b0e186bc"],
+ ["eca986", "e1848de185a4e186bd"],
+ ["eca986", "eca8b0e186bd"],
+ ["eca987", "e1848de185a4e186be"],
+ ["eca987", "eca8b0e186be"],
+ ["eca988", "e1848de185a4e186bf"],
+ ["eca988", "eca8b0e186bf"],
+ ["eca989", "e1848de185a4e18780"],
+ ["eca989", "eca8b0e18780"],
+ ["eca98a", "e1848de185a4e18781"],
+ ["eca98a", "eca8b0e18781"],
+ ["eca98b", "e1848de185a4e18782"],
+ ["eca98b", "eca8b0e18782"],
+ ["eca98c", "e1848de185a5"],
+ ["eca98d", "e1848de185a5e186a8"],
+ ["eca98d", "eca98ce186a8"],
+ ["eca98e", "e1848de185a5e186a9"],
+ ["eca98e", "eca98ce186a9"],
+ ["eca98f", "e1848de185a5e186aa"],
+ ["eca98f", "eca98ce186aa"],
+ ["eca990", "e1848de185a5e186ab"],
+ ["eca990", "eca98ce186ab"],
+ ["eca991", "e1848de185a5e186ac"],
+ ["eca991", "eca98ce186ac"],
+ ["eca992", "e1848de185a5e186ad"],
+ ["eca992", "eca98ce186ad"],
+ ["eca993", "e1848de185a5e186ae"],
+ ["eca993", "eca98ce186ae"],
+ ["eca994", "e1848de185a5e186af"],
+ ["eca994", "eca98ce186af"],
+ ["eca995", "e1848de185a5e186b0"],
+ ["eca995", "eca98ce186b0"],
+ ["eca996", "e1848de185a5e186b1"],
+ ["eca996", "eca98ce186b1"],
+ ["eca997", "e1848de185a5e186b2"],
+ ["eca997", "eca98ce186b2"],
+ ["eca998", "e1848de185a5e186b3"],
+ ["eca998", "eca98ce186b3"],
+ ["eca999", "e1848de185a5e186b4"],
+ ["eca999", "eca98ce186b4"],
+ ["eca99a", "e1848de185a5e186b5"],
+ ["eca99a", "eca98ce186b5"],
+ ["eca99b", "e1848de185a5e186b6"],
+ ["eca99b", "eca98ce186b6"],
+ ["eca99c", "e1848de185a5e186b7"],
+ ["eca99c", "eca98ce186b7"],
+ ["eca99d", "e1848de185a5e186b8"],
+ ["eca99d", "eca98ce186b8"],
+ ["eca99e", "e1848de185a5e186b9"],
+ ["eca99e", "eca98ce186b9"],
+ ["eca99f", "e1848de185a5e186ba"],
+ ["eca99f", "eca98ce186ba"],
+ ["eca9a0", "e1848de185a5e186bb"],
+ ["eca9a0", "eca98ce186bb"],
+ ["eca9a1", "e1848de185a5e186bc"],
+ ["eca9a1", "eca98ce186bc"],
+ ["eca9a2", "e1848de185a5e186bd"],
+ ["eca9a2", "eca98ce186bd"],
+ ["eca9a3", "e1848de185a5e186be"],
+ ["eca9a3", "eca98ce186be"],
+ ["eca9a4", "e1848de185a5e186bf"],
+ ["eca9a4", "eca98ce186bf"],
+ ["eca9a5", "e1848de185a5e18780"],
+ ["eca9a5", "eca98ce18780"],
+ ["eca9a6", "e1848de185a5e18781"],
+ ["eca9a6", "eca98ce18781"],
+ ["eca9a7", "e1848de185a5e18782"],
+ ["eca9a7", "eca98ce18782"],
+ ["eca9a8", "e1848de185a6"],
+ ["eca9a9", "e1848de185a6e186a8"],
+ ["eca9a9", "eca9a8e186a8"],
+ ["eca9aa", "e1848de185a6e186a9"],
+ ["eca9aa", "eca9a8e186a9"],
+ ["eca9ab", "e1848de185a6e186aa"],
+ ["eca9ab", "eca9a8e186aa"],
+ ["eca9ac", "e1848de185a6e186ab"],
+ ["eca9ac", "eca9a8e186ab"],
+ ["eca9ad", "e1848de185a6e186ac"],
+ ["eca9ad", "eca9a8e186ac"],
+ ["eca9ae", "e1848de185a6e186ad"],
+ ["eca9ae", "eca9a8e186ad"],
+ ["eca9af", "e1848de185a6e186ae"],
+ ["eca9af", "eca9a8e186ae"],
+ ["eca9b0", "e1848de185a6e186af"],
+ ["eca9b0", "eca9a8e186af"],
+ ["eca9b1", "e1848de185a6e186b0"],
+ ["eca9b1", "eca9a8e186b0"],
+ ["eca9b2", "e1848de185a6e186b1"],
+ ["eca9b2", "eca9a8e186b1"],
+ ["eca9b3", "e1848de185a6e186b2"],
+ ["eca9b3", "eca9a8e186b2"],
+ ["eca9b4", "e1848de185a6e186b3"],
+ ["eca9b4", "eca9a8e186b3"],
+ ["eca9b5", "e1848de185a6e186b4"],
+ ["eca9b5", "eca9a8e186b4"],
+ ["eca9b6", "e1848de185a6e186b5"],
+ ["eca9b6", "eca9a8e186b5"],
+ ["eca9b7", "e1848de185a6e186b6"],
+ ["eca9b7", "eca9a8e186b6"],
+ ["eca9b8", "e1848de185a6e186b7"],
+ ["eca9b8", "eca9a8e186b7"],
+ ["eca9b9", "e1848de185a6e186b8"],
+ ["eca9b9", "eca9a8e186b8"],
+ ["eca9ba", "e1848de185a6e186b9"],
+ ["eca9ba", "eca9a8e186b9"],
+ ["eca9bb", "e1848de185a6e186ba"],
+ ["eca9bb", "eca9a8e186ba"],
+ ["eca9bc", "e1848de185a6e186bb"],
+ ["eca9bc", "eca9a8e186bb"],
+ ["eca9bd", "e1848de185a6e186bc"],
+ ["eca9bd", "eca9a8e186bc"],
+ ["eca9be", "e1848de185a6e186bd"],
+ ["eca9be", "eca9a8e186bd"],
+ ["eca9bf", "e1848de185a6e186be"],
+ ["eca9bf", "eca9a8e186be"],
+ ["ecaa80", "e1848de185a6e186bf"],
+ ["ecaa80", "eca9a8e186bf"],
+ ["ecaa81", "e1848de185a6e18780"],
+ ["ecaa81", "eca9a8e18780"],
+ ["ecaa82", "e1848de185a6e18781"],
+ ["ecaa82", "eca9a8e18781"],
+ ["ecaa83", "e1848de185a6e18782"],
+ ["ecaa83", "eca9a8e18782"],
+ ["ecaa84", "e1848de185a7"],
+ ["ecaa85", "e1848de185a7e186a8"],
+ ["ecaa85", "ecaa84e186a8"],
+ ["ecaa86", "e1848de185a7e186a9"],
+ ["ecaa86", "ecaa84e186a9"],
+ ["ecaa87", "e1848de185a7e186aa"],
+ ["ecaa87", "ecaa84e186aa"],
+ ["ecaa88", "e1848de185a7e186ab"],
+ ["ecaa88", "ecaa84e186ab"],
+ ["ecaa89", "e1848de185a7e186ac"],
+ ["ecaa89", "ecaa84e186ac"],
+ ["ecaa8a", "e1848de185a7e186ad"],
+ ["ecaa8a", "ecaa84e186ad"],
+ ["ecaa8b", "e1848de185a7e186ae"],
+ ["ecaa8b", "ecaa84e186ae"],
+ ["ecaa8c", "e1848de185a7e186af"],
+ ["ecaa8c", "ecaa84e186af"],
+ ["ecaa8d", "e1848de185a7e186b0"],
+ ["ecaa8d", "ecaa84e186b0"],
+ ["ecaa8e", "e1848de185a7e186b1"],
+ ["ecaa8e", "ecaa84e186b1"],
+ ["ecaa8f", "e1848de185a7e186b2"],
+ ["ecaa8f", "ecaa84e186b2"],
+ ["ecaa90", "e1848de185a7e186b3"],
+ ["ecaa90", "ecaa84e186b3"],
+ ["ecaa91", "e1848de185a7e186b4"],
+ ["ecaa91", "ecaa84e186b4"],
+ ["ecaa92", "e1848de185a7e186b5"],
+ ["ecaa92", "ecaa84e186b5"],
+ ["ecaa93", "e1848de185a7e186b6"],
+ ["ecaa93", "ecaa84e186b6"],
+ ["ecaa94", "e1848de185a7e186b7"],
+ ["ecaa94", "ecaa84e186b7"],
+ ["ecaa95", "e1848de185a7e186b8"],
+ ["ecaa95", "ecaa84e186b8"],
+ ["ecaa96", "e1848de185a7e186b9"],
+ ["ecaa96", "ecaa84e186b9"],
+ ["ecaa97", "e1848de185a7e186ba"],
+ ["ecaa97", "ecaa84e186ba"],
+ ["ecaa98", "e1848de185a7e186bb"],
+ ["ecaa98", "ecaa84e186bb"],
+ ["ecaa99", "e1848de185a7e186bc"],
+ ["ecaa99", "ecaa84e186bc"],
+ ["ecaa9a", "e1848de185a7e186bd"],
+ ["ecaa9a", "ecaa84e186bd"],
+ ["ecaa9b", "e1848de185a7e186be"],
+ ["ecaa9b", "ecaa84e186be"],
+ ["ecaa9c", "e1848de185a7e186bf"],
+ ["ecaa9c", "ecaa84e186bf"],
+ ["ecaa9d", "e1848de185a7e18780"],
+ ["ecaa9d", "ecaa84e18780"],
+ ["ecaa9e", "e1848de185a7e18781"],
+ ["ecaa9e", "ecaa84e18781"],
+ ["ecaa9f", "e1848de185a7e18782"],
+ ["ecaa9f", "ecaa84e18782"],
+ ["ecaaa0", "e1848de185a8"],
+ ["ecaaa1", "e1848de185a8e186a8"],
+ ["ecaaa1", "ecaaa0e186a8"],
+ ["ecaaa2", "e1848de185a8e186a9"],
+ ["ecaaa2", "ecaaa0e186a9"],
+ ["ecaaa3", "e1848de185a8e186aa"],
+ ["ecaaa3", "ecaaa0e186aa"],
+ ["ecaaa4", "e1848de185a8e186ab"],
+ ["ecaaa4", "ecaaa0e186ab"],
+ ["ecaaa5", "e1848de185a8e186ac"],
+ ["ecaaa5", "ecaaa0e186ac"],
+ ["ecaaa6", "e1848de185a8e186ad"],
+ ["ecaaa6", "ecaaa0e186ad"],
+ ["ecaaa7", "e1848de185a8e186ae"],
+ ["ecaaa7", "ecaaa0e186ae"],
+ ["ecaaa8", "e1848de185a8e186af"],
+ ["ecaaa8", "ecaaa0e186af"],
+ ["ecaaa9", "e1848de185a8e186b0"],
+ ["ecaaa9", "ecaaa0e186b0"],
+ ["ecaaaa", "e1848de185a8e186b1"],
+ ["ecaaaa", "ecaaa0e186b1"],
+ ["ecaaab", "e1848de185a8e186b2"],
+ ["ecaaab", "ecaaa0e186b2"],
+ ["ecaaac", "e1848de185a8e186b3"],
+ ["ecaaac", "ecaaa0e186b3"],
+ ["ecaaad", "e1848de185a8e186b4"],
+ ["ecaaad", "ecaaa0e186b4"],
+ ["ecaaae", "e1848de185a8e186b5"],
+ ["ecaaae", "ecaaa0e186b5"],
+ ["ecaaaf", "e1848de185a8e186b6"],
+ ["ecaaaf", "ecaaa0e186b6"],
+ ["ecaab0", "e1848de185a8e186b7"],
+ ["ecaab0", "ecaaa0e186b7"],
+ ["ecaab1", "e1848de185a8e186b8"],
+ ["ecaab1", "ecaaa0e186b8"],
+ ["ecaab2", "e1848de185a8e186b9"],
+ ["ecaab2", "ecaaa0e186b9"],
+ ["ecaab3", "e1848de185a8e186ba"],
+ ["ecaab3", "ecaaa0e186ba"],
+ ["ecaab4", "e1848de185a8e186bb"],
+ ["ecaab4", "ecaaa0e186bb"],
+ ["ecaab5", "e1848de185a8e186bc"],
+ ["ecaab5", "ecaaa0e186bc"],
+ ["ecaab6", "e1848de185a8e186bd"],
+ ["ecaab6", "ecaaa0e186bd"],
+ ["ecaab7", "e1848de185a8e186be"],
+ ["ecaab7", "ecaaa0e186be"],
+ ["ecaab8", "e1848de185a8e186bf"],
+ ["ecaab8", "ecaaa0e186bf"],
+ ["ecaab9", "e1848de185a8e18780"],
+ ["ecaab9", "ecaaa0e18780"],
+ ["ecaaba", "e1848de185a8e18781"],
+ ["ecaaba", "ecaaa0e18781"],
+ ["ecaabb", "e1848de185a8e18782"],
+ ["ecaabb", "ecaaa0e18782"],
+ ["ecaabc", "e1848de185a9"],
+ ["ecaabd", "e1848de185a9e186a8"],
+ ["ecaabd", "ecaabce186a8"],
+ ["ecaabe", "e1848de185a9e186a9"],
+ ["ecaabe", "ecaabce186a9"],
+ ["ecaabf", "e1848de185a9e186aa"],
+ ["ecaabf", "ecaabce186aa"],
+ ["ecab80", "e1848de185a9e186ab"],
+ ["ecab80", "ecaabce186ab"],
+ ["ecab81", "e1848de185a9e186ac"],
+ ["ecab81", "ecaabce186ac"],
+ ["ecab82", "e1848de185a9e186ad"],
+ ["ecab82", "ecaabce186ad"],
+ ["ecab83", "e1848de185a9e186ae"],
+ ["ecab83", "ecaabce186ae"],
+ ["ecab84", "e1848de185a9e186af"],
+ ["ecab84", "ecaabce186af"],
+ ["ecab85", "e1848de185a9e186b0"],
+ ["ecab85", "ecaabce186b0"],
+ ["ecab86", "e1848de185a9e186b1"],
+ ["ecab86", "ecaabce186b1"],
+ ["ecab87", "e1848de185a9e186b2"],
+ ["ecab87", "ecaabce186b2"],
+ ["ecab88", "e1848de185a9e186b3"],
+ ["ecab88", "ecaabce186b3"],
+ ["ecab89", "e1848de185a9e186b4"],
+ ["ecab89", "ecaabce186b4"],
+ ["ecab8a", "e1848de185a9e186b5"],
+ ["ecab8a", "ecaabce186b5"],
+ ["ecab8b", "e1848de185a9e186b6"],
+ ["ecab8b", "ecaabce186b6"],
+ ["ecab8c", "e1848de185a9e186b7"],
+ ["ecab8c", "ecaabce186b7"],
+ ["ecab8d", "e1848de185a9e186b8"],
+ ["ecab8d", "ecaabce186b8"],
+ ["ecab8e", "e1848de185a9e186b9"],
+ ["ecab8e", "ecaabce186b9"],
+ ["ecab8f", "e1848de185a9e186ba"],
+ ["ecab8f", "ecaabce186ba"],
+ ["ecab90", "e1848de185a9e186bb"],
+ ["ecab90", "ecaabce186bb"],
+ ["ecab91", "e1848de185a9e186bc"],
+ ["ecab91", "ecaabce186bc"],
+ ["ecab92", "e1848de185a9e186bd"],
+ ["ecab92", "ecaabce186bd"],
+ ["ecab93", "e1848de185a9e186be"],
+ ["ecab93", "ecaabce186be"],
+ ["ecab94", "e1848de185a9e186bf"],
+ ["ecab94", "ecaabce186bf"],
+ ["ecab95", "e1848de185a9e18780"],
+ ["ecab95", "ecaabce18780"],
+ ["ecab96", "e1848de185a9e18781"],
+ ["ecab96", "ecaabce18781"],
+ ["ecab97", "e1848de185a9e18782"],
+ ["ecab97", "ecaabce18782"],
+ ["ecab98", "e1848de185aa"],
+ ["ecab99", "e1848de185aae186a8"],
+ ["ecab99", "ecab98e186a8"],
+ ["ecab9a", "e1848de185aae186a9"],
+ ["ecab9a", "ecab98e186a9"],
+ ["ecab9b", "e1848de185aae186aa"],
+ ["ecab9b", "ecab98e186aa"],
+ ["ecab9c", "e1848de185aae186ab"],
+ ["ecab9c", "ecab98e186ab"],
+ ["ecab9d", "e1848de185aae186ac"],
+ ["ecab9d", "ecab98e186ac"],
+ ["ecab9e", "e1848de185aae186ad"],
+ ["ecab9e", "ecab98e186ad"],
+ ["ecab9f", "e1848de185aae186ae"],
+ ["ecab9f", "ecab98e186ae"],
+ ["ecaba0", "e1848de185aae186af"],
+ ["ecaba0", "ecab98e186af"],
+ ["ecaba1", "e1848de185aae186b0"],
+ ["ecaba1", "ecab98e186b0"],
+ ["ecaba2", "e1848de185aae186b1"],
+ ["ecaba2", "ecab98e186b1"],
+ ["ecaba3", "e1848de185aae186b2"],
+ ["ecaba3", "ecab98e186b2"],
+ ["ecaba4", "e1848de185aae186b3"],
+ ["ecaba4", "ecab98e186b3"],
+ ["ecaba5", "e1848de185aae186b4"],
+ ["ecaba5", "ecab98e186b4"],
+ ["ecaba6", "e1848de185aae186b5"],
+ ["ecaba6", "ecab98e186b5"],
+ ["ecaba7", "e1848de185aae186b6"],
+ ["ecaba7", "ecab98e186b6"],
+ ["ecaba8", "e1848de185aae186b7"],
+ ["ecaba8", "ecab98e186b7"],
+ ["ecaba9", "e1848de185aae186b8"],
+ ["ecaba9", "ecab98e186b8"],
+ ["ecabaa", "e1848de185aae186b9"],
+ ["ecabaa", "ecab98e186b9"],
+ ["ecabab", "e1848de185aae186ba"],
+ ["ecabab", "ecab98e186ba"],
+ ["ecabac", "e1848de185aae186bb"],
+ ["ecabac", "ecab98e186bb"],
+ ["ecabad", "e1848de185aae186bc"],
+ ["ecabad", "ecab98e186bc"],
+ ["ecabae", "e1848de185aae186bd"],
+ ["ecabae", "ecab98e186bd"],
+ ["ecabaf", "e1848de185aae186be"],
+ ["ecabaf", "ecab98e186be"],
+ ["ecabb0", "e1848de185aae186bf"],
+ ["ecabb0", "ecab98e186bf"],
+ ["ecabb1", "e1848de185aae18780"],
+ ["ecabb1", "ecab98e18780"],
+ ["ecabb2", "e1848de185aae18781"],
+ ["ecabb2", "ecab98e18781"],
+ ["ecabb3", "e1848de185aae18782"],
+ ["ecabb3", "ecab98e18782"],
+ ["ecabb4", "e1848de185ab"],
+ ["ecabb5", "e1848de185abe186a8"],
+ ["ecabb5", "ecabb4e186a8"],
+ ["ecabb6", "e1848de185abe186a9"],
+ ["ecabb6", "ecabb4e186a9"],
+ ["ecabb7", "e1848de185abe186aa"],
+ ["ecabb7", "ecabb4e186aa"],
+ ["ecabb8", "e1848de185abe186ab"],
+ ["ecabb8", "ecabb4e186ab"],
+ ["ecabb9", "e1848de185abe186ac"],
+ ["ecabb9", "ecabb4e186ac"],
+ ["ecabba", "e1848de185abe186ad"],
+ ["ecabba", "ecabb4e186ad"],
+ ["ecabbb", "e1848de185abe186ae"],
+ ["ecabbb", "ecabb4e186ae"],
+ ["ecabbc", "e1848de185abe186af"],
+ ["ecabbc", "ecabb4e186af"],
+ ["ecabbd", "e1848de185abe186b0"],
+ ["ecabbd", "ecabb4e186b0"],
+ ["ecabbe", "e1848de185abe186b1"],
+ ["ecabbe", "ecabb4e186b1"],
+ ["ecabbf", "e1848de185abe186b2"],
+ ["ecabbf", "ecabb4e186b2"],
+ ["ecac80", "e1848de185abe186b3"],
+ ["ecac80", "ecabb4e186b3"],
+ ["ecac81", "e1848de185abe186b4"],
+ ["ecac81", "ecabb4e186b4"],
+ ["ecac82", "e1848de185abe186b5"],
+ ["ecac82", "ecabb4e186b5"],
+ ["ecac83", "e1848de185abe186b6"],
+ ["ecac83", "ecabb4e186b6"],
+ ["ecac84", "e1848de185abe186b7"],
+ ["ecac84", "ecabb4e186b7"],
+ ["ecac85", "e1848de185abe186b8"],
+ ["ecac85", "ecabb4e186b8"],
+ ["ecac86", "e1848de185abe186b9"],
+ ["ecac86", "ecabb4e186b9"],
+ ["ecac87", "e1848de185abe186ba"],
+ ["ecac87", "ecabb4e186ba"],
+ ["ecac88", "e1848de185abe186bb"],
+ ["ecac88", "ecabb4e186bb"],
+ ["ecac89", "e1848de185abe186bc"],
+ ["ecac89", "ecabb4e186bc"],
+ ["ecac8a", "e1848de185abe186bd"],
+ ["ecac8a", "ecabb4e186bd"],
+ ["ecac8b", "e1848de185abe186be"],
+ ["ecac8b", "ecabb4e186be"],
+ ["ecac8c", "e1848de185abe186bf"],
+ ["ecac8c", "ecabb4e186bf"],
+ ["ecac8d", "e1848de185abe18780"],
+ ["ecac8d", "ecabb4e18780"],
+ ["ecac8e", "e1848de185abe18781"],
+ ["ecac8e", "ecabb4e18781"],
+ ["ecac8f", "e1848de185abe18782"],
+ ["ecac8f", "ecabb4e18782"],
+ ["ecac90", "e1848de185ac"],
+ ["ecac91", "e1848de185ace186a8"],
+ ["ecac91", "ecac90e186a8"],
+ ["ecac92", "e1848de185ace186a9"],
+ ["ecac92", "ecac90e186a9"],
+ ["ecac93", "e1848de185ace186aa"],
+ ["ecac93", "ecac90e186aa"],
+ ["ecac94", "e1848de185ace186ab"],
+ ["ecac94", "ecac90e186ab"],
+ ["ecac95", "e1848de185ace186ac"],
+ ["ecac95", "ecac90e186ac"],
+ ["ecac96", "e1848de185ace186ad"],
+ ["ecac96", "ecac90e186ad"],
+ ["ecac97", "e1848de185ace186ae"],
+ ["ecac97", "ecac90e186ae"],
+ ["ecac98", "e1848de185ace186af"],
+ ["ecac98", "ecac90e186af"],
+ ["ecac99", "e1848de185ace186b0"],
+ ["ecac99", "ecac90e186b0"],
+ ["ecac9a", "e1848de185ace186b1"],
+ ["ecac9a", "ecac90e186b1"],
+ ["ecac9b", "e1848de185ace186b2"],
+ ["ecac9b", "ecac90e186b2"],
+ ["ecac9c", "e1848de185ace186b3"],
+ ["ecac9c", "ecac90e186b3"],
+ ["ecac9d", "e1848de185ace186b4"],
+ ["ecac9d", "ecac90e186b4"],
+ ["ecac9e", "e1848de185ace186b5"],
+ ["ecac9e", "ecac90e186b5"],
+ ["ecac9f", "e1848de185ace186b6"],
+ ["ecac9f", "ecac90e186b6"],
+ ["ecaca0", "e1848de185ace186b7"],
+ ["ecaca0", "ecac90e186b7"],
+ ["ecaca1", "e1848de185ace186b8"],
+ ["ecaca1", "ecac90e186b8"],
+ ["ecaca2", "e1848de185ace186b9"],
+ ["ecaca2", "ecac90e186b9"],
+ ["ecaca3", "e1848de185ace186ba"],
+ ["ecaca3", "ecac90e186ba"],
+ ["ecaca4", "e1848de185ace186bb"],
+ ["ecaca4", "ecac90e186bb"],
+ ["ecaca5", "e1848de185ace186bc"],
+ ["ecaca5", "ecac90e186bc"],
+ ["ecaca6", "e1848de185ace186bd"],
+ ["ecaca6", "ecac90e186bd"],
+ ["ecaca7", "e1848de185ace186be"],
+ ["ecaca7", "ecac90e186be"],
+ ["ecaca8", "e1848de185ace186bf"],
+ ["ecaca8", "ecac90e186bf"],
+ ["ecaca9", "e1848de185ace18780"],
+ ["ecaca9", "ecac90e18780"],
+ ["ecacaa", "e1848de185ace18781"],
+ ["ecacaa", "ecac90e18781"],
+ ["ecacab", "e1848de185ace18782"],
+ ["ecacab", "ecac90e18782"],
+ ["ecacac", "e1848de185ad"],
+ ["ecacad", "e1848de185ade186a8"],
+ ["ecacad", "ecacace186a8"],
+ ["ecacae", "e1848de185ade186a9"],
+ ["ecacae", "ecacace186a9"],
+ ["ecacaf", "e1848de185ade186aa"],
+ ["ecacaf", "ecacace186aa"],
+ ["ecacb0", "e1848de185ade186ab"],
+ ["ecacb0", "ecacace186ab"],
+ ["ecacb1", "e1848de185ade186ac"],
+ ["ecacb1", "ecacace186ac"],
+ ["ecacb2", "e1848de185ade186ad"],
+ ["ecacb2", "ecacace186ad"],
+ ["ecacb3", "e1848de185ade186ae"],
+ ["ecacb3", "ecacace186ae"],
+ ["ecacb4", "e1848de185ade186af"],
+ ["ecacb4", "ecacace186af"],
+ ["ecacb5", "e1848de185ade186b0"],
+ ["ecacb5", "ecacace186b0"],
+ ["ecacb6", "e1848de185ade186b1"],
+ ["ecacb6", "ecacace186b1"],
+ ["ecacb7", "e1848de185ade186b2"],
+ ["ecacb7", "ecacace186b2"],
+ ["ecacb8", "e1848de185ade186b3"],
+ ["ecacb8", "ecacace186b3"],
+ ["ecacb9", "e1848de185ade186b4"],
+ ["ecacb9", "ecacace186b4"],
+ ["ecacba", "e1848de185ade186b5"],
+ ["ecacba", "ecacace186b5"],
+ ["ecacbb", "e1848de185ade186b6"],
+ ["ecacbb", "ecacace186b6"],
+ ["ecacbc", "e1848de185ade186b7"],
+ ["ecacbc", "ecacace186b7"],
+ ["ecacbd", "e1848de185ade186b8"],
+ ["ecacbd", "ecacace186b8"],
+ ["ecacbe", "e1848de185ade186b9"],
+ ["ecacbe", "ecacace186b9"],
+ ["ecacbf", "e1848de185ade186ba"],
+ ["ecacbf", "ecacace186ba"],
+ ["ecad80", "e1848de185ade186bb"],
+ ["ecad80", "ecacace186bb"],
+ ["ecad81", "e1848de185ade186bc"],
+ ["ecad81", "ecacace186bc"],
+ ["ecad82", "e1848de185ade186bd"],
+ ["ecad82", "ecacace186bd"],
+ ["ecad83", "e1848de185ade186be"],
+ ["ecad83", "ecacace186be"],
+ ["ecad84", "e1848de185ade186bf"],
+ ["ecad84", "ecacace186bf"],
+ ["ecad85", "e1848de185ade18780"],
+ ["ecad85", "ecacace18780"],
+ ["ecad86", "e1848de185ade18781"],
+ ["ecad86", "ecacace18781"],
+ ["ecad87", "e1848de185ade18782"],
+ ["ecad87", "ecacace18782"],
+ ["ecad88", "e1848de185ae"],
+ ["ecad89", "e1848de185aee186a8"],
+ ["ecad89", "ecad88e186a8"],
+ ["ecad8a", "e1848de185aee186a9"],
+ ["ecad8a", "ecad88e186a9"],
+ ["ecad8b", "e1848de185aee186aa"],
+ ["ecad8b", "ecad88e186aa"],
+ ["ecad8c", "e1848de185aee186ab"],
+ ["ecad8c", "ecad88e186ab"],
+ ["ecad8d", "e1848de185aee186ac"],
+ ["ecad8d", "ecad88e186ac"],
+ ["ecad8e", "e1848de185aee186ad"],
+ ["ecad8e", "ecad88e186ad"],
+ ["ecad8f", "e1848de185aee186ae"],
+ ["ecad8f", "ecad88e186ae"],
+ ["ecad90", "e1848de185aee186af"],
+ ["ecad90", "ecad88e186af"],
+ ["ecad91", "e1848de185aee186b0"],
+ ["ecad91", "ecad88e186b0"],
+ ["ecad92", "e1848de185aee186b1"],
+ ["ecad92", "ecad88e186b1"],
+ ["ecad93", "e1848de185aee186b2"],
+ ["ecad93", "ecad88e186b2"],
+ ["ecad94", "e1848de185aee186b3"],
+ ["ecad94", "ecad88e186b3"],
+ ["ecad95", "e1848de185aee186b4"],
+ ["ecad95", "ecad88e186b4"],
+ ["ecad96", "e1848de185aee186b5"],
+ ["ecad96", "ecad88e186b5"],
+ ["ecad97", "e1848de185aee186b6"],
+ ["ecad97", "ecad88e186b6"],
+ ["ecad98", "e1848de185aee186b7"],
+ ["ecad98", "ecad88e186b7"],
+ ["ecad99", "e1848de185aee186b8"],
+ ["ecad99", "ecad88e186b8"],
+ ["ecad9a", "e1848de185aee186b9"],
+ ["ecad9a", "ecad88e186b9"],
+ ["ecad9b", "e1848de185aee186ba"],
+ ["ecad9b", "ecad88e186ba"],
+ ["ecad9c", "e1848de185aee186bb"],
+ ["ecad9c", "ecad88e186bb"],
+ ["ecad9d", "e1848de185aee186bc"],
+ ["ecad9d", "ecad88e186bc"],
+ ["ecad9e", "e1848de185aee186bd"],
+ ["ecad9e", "ecad88e186bd"],
+ ["ecad9f", "e1848de185aee186be"],
+ ["ecad9f", "ecad88e186be"],
+ ["ecada0", "e1848de185aee186bf"],
+ ["ecada0", "ecad88e186bf"],
+ ["ecada1", "e1848de185aee18780"],
+ ["ecada1", "ecad88e18780"],
+ ["ecada2", "e1848de185aee18781"],
+ ["ecada2", "ecad88e18781"],
+ ["ecada3", "e1848de185aee18782"],
+ ["ecada3", "ecad88e18782"],
+ ["ecada4", "e1848de185af"],
+ ["ecada5", "e1848de185afe186a8"],
+ ["ecada5", "ecada4e186a8"],
+ ["ecada6", "e1848de185afe186a9"],
+ ["ecada6", "ecada4e186a9"],
+ ["ecada7", "e1848de185afe186aa"],
+ ["ecada7", "ecada4e186aa"],
+ ["ecada8", "e1848de185afe186ab"],
+ ["ecada8", "ecada4e186ab"],
+ ["ecada9", "e1848de185afe186ac"],
+ ["ecada9", "ecada4e186ac"],
+ ["ecadaa", "e1848de185afe186ad"],
+ ["ecadaa", "ecada4e186ad"],
+ ["ecadab", "e1848de185afe186ae"],
+ ["ecadab", "ecada4e186ae"],
+ ["ecadac", "e1848de185afe186af"],
+ ["ecadac", "ecada4e186af"],
+ ["ecadad", "e1848de185afe186b0"],
+ ["ecadad", "ecada4e186b0"],
+ ["ecadae", "e1848de185afe186b1"],
+ ["ecadae", "ecada4e186b1"],
+ ["ecadaf", "e1848de185afe186b2"],
+ ["ecadaf", "ecada4e186b2"],
+ ["ecadb0", "e1848de185afe186b3"],
+ ["ecadb0", "ecada4e186b3"],
+ ["ecadb1", "e1848de185afe186b4"],
+ ["ecadb1", "ecada4e186b4"],
+ ["ecadb2", "e1848de185afe186b5"],
+ ["ecadb2", "ecada4e186b5"],
+ ["ecadb3", "e1848de185afe186b6"],
+ ["ecadb3", "ecada4e186b6"],
+ ["ecadb4", "e1848de185afe186b7"],
+ ["ecadb4", "ecada4e186b7"],
+ ["ecadb5", "e1848de185afe186b8"],
+ ["ecadb5", "ecada4e186b8"],
+ ["ecadb6", "e1848de185afe186b9"],
+ ["ecadb6", "ecada4e186b9"],
+ ["ecadb7", "e1848de185afe186ba"],
+ ["ecadb7", "ecada4e186ba"],
+ ["ecadb8", "e1848de185afe186bb"],
+ ["ecadb8", "ecada4e186bb"],
+ ["ecadb9", "e1848de185afe186bc"],
+ ["ecadb9", "ecada4e186bc"],
+ ["ecadba", "e1848de185afe186bd"],
+ ["ecadba", "ecada4e186bd"],
+ ["ecadbb", "e1848de185afe186be"],
+ ["ecadbb", "ecada4e186be"],
+ ["ecadbc", "e1848de185afe186bf"],
+ ["ecadbc", "ecada4e186bf"],
+ ["ecadbd", "e1848de185afe18780"],
+ ["ecadbd", "ecada4e18780"],
+ ["ecadbe", "e1848de185afe18781"],
+ ["ecadbe", "ecada4e18781"],
+ ["ecadbf", "e1848de185afe18782"],
+ ["ecadbf", "ecada4e18782"],
+ ["ecae80", "e1848de185b0"],
+ ["ecae81", "e1848de185b0e186a8"],
+ ["ecae81", "ecae80e186a8"],
+ ["ecae82", "e1848de185b0e186a9"],
+ ["ecae82", "ecae80e186a9"],
+ ["ecae83", "e1848de185b0e186aa"],
+ ["ecae83", "ecae80e186aa"],
+ ["ecae84", "e1848de185b0e186ab"],
+ ["ecae84", "ecae80e186ab"],
+ ["ecae85", "e1848de185b0e186ac"],
+ ["ecae85", "ecae80e186ac"],
+ ["ecae86", "e1848de185b0e186ad"],
+ ["ecae86", "ecae80e186ad"],
+ ["ecae87", "e1848de185b0e186ae"],
+ ["ecae87", "ecae80e186ae"],
+ ["ecae88", "e1848de185b0e186af"],
+ ["ecae88", "ecae80e186af"],
+ ["ecae89", "e1848de185b0e186b0"],
+ ["ecae89", "ecae80e186b0"],
+ ["ecae8a", "e1848de185b0e186b1"],
+ ["ecae8a", "ecae80e186b1"],
+ ["ecae8b", "e1848de185b0e186b2"],
+ ["ecae8b", "ecae80e186b2"],
+ ["ecae8c", "e1848de185b0e186b3"],
+ ["ecae8c", "ecae80e186b3"],
+ ["ecae8d", "e1848de185b0e186b4"],
+ ["ecae8d", "ecae80e186b4"],
+ ["ecae8e", "e1848de185b0e186b5"],
+ ["ecae8e", "ecae80e186b5"],
+ ["ecae8f", "e1848de185b0e186b6"],
+ ["ecae8f", "ecae80e186b6"],
+ ["ecae90", "e1848de185b0e186b7"],
+ ["ecae90", "ecae80e186b7"],
+ ["ecae91", "e1848de185b0e186b8"],
+ ["ecae91", "ecae80e186b8"],
+ ["ecae92", "e1848de185b0e186b9"],
+ ["ecae92", "ecae80e186b9"],
+ ["ecae93", "e1848de185b0e186ba"],
+ ["ecae93", "ecae80e186ba"],
+ ["ecae94", "e1848de185b0e186bb"],
+ ["ecae94", "ecae80e186bb"],
+ ["ecae95", "e1848de185b0e186bc"],
+ ["ecae95", "ecae80e186bc"],
+ ["ecae96", "e1848de185b0e186bd"],
+ ["ecae96", "ecae80e186bd"],
+ ["ecae97", "e1848de185b0e186be"],
+ ["ecae97", "ecae80e186be"],
+ ["ecae98", "e1848de185b0e186bf"],
+ ["ecae98", "ecae80e186bf"],
+ ["ecae99", "e1848de185b0e18780"],
+ ["ecae99", "ecae80e18780"],
+ ["ecae9a", "e1848de185b0e18781"],
+ ["ecae9a", "ecae80e18781"],
+ ["ecae9b", "e1848de185b0e18782"],
+ ["ecae9b", "ecae80e18782"],
+ ["ecae9c", "e1848de185b1"],
+ ["ecae9d", "e1848de185b1e186a8"],
+ ["ecae9d", "ecae9ce186a8"],
+ ["ecae9e", "e1848de185b1e186a9"],
+ ["ecae9e", "ecae9ce186a9"],
+ ["ecae9f", "e1848de185b1e186aa"],
+ ["ecae9f", "ecae9ce186aa"],
+ ["ecaea0", "e1848de185b1e186ab"],
+ ["ecaea0", "ecae9ce186ab"],
+ ["ecaea1", "e1848de185b1e186ac"],
+ ["ecaea1", "ecae9ce186ac"],
+ ["ecaea2", "e1848de185b1e186ad"],
+ ["ecaea2", "ecae9ce186ad"],
+ ["ecaea3", "e1848de185b1e186ae"],
+ ["ecaea3", "ecae9ce186ae"],
+ ["ecaea4", "e1848de185b1e186af"],
+ ["ecaea4", "ecae9ce186af"],
+ ["ecaea5", "e1848de185b1e186b0"],
+ ["ecaea5", "ecae9ce186b0"],
+ ["ecaea6", "e1848de185b1e186b1"],
+ ["ecaea6", "ecae9ce186b1"],
+ ["ecaea7", "e1848de185b1e186b2"],
+ ["ecaea7", "ecae9ce186b2"],
+ ["ecaea8", "e1848de185b1e186b3"],
+ ["ecaea8", "ecae9ce186b3"],
+ ["ecaea9", "e1848de185b1e186b4"],
+ ["ecaea9", "ecae9ce186b4"],
+ ["ecaeaa", "e1848de185b1e186b5"],
+ ["ecaeaa", "ecae9ce186b5"],
+ ["ecaeab", "e1848de185b1e186b6"],
+ ["ecaeab", "ecae9ce186b6"],
+ ["ecaeac", "e1848de185b1e186b7"],
+ ["ecaeac", "ecae9ce186b7"],
+ ["ecaead", "e1848de185b1e186b8"],
+ ["ecaead", "ecae9ce186b8"],
+ ["ecaeae", "e1848de185b1e186b9"],
+ ["ecaeae", "ecae9ce186b9"],
+ ["ecaeaf", "e1848de185b1e186ba"],
+ ["ecaeaf", "ecae9ce186ba"],
+ ["ecaeb0", "e1848de185b1e186bb"],
+ ["ecaeb0", "ecae9ce186bb"],
+ ["ecaeb1", "e1848de185b1e186bc"],
+ ["ecaeb1", "ecae9ce186bc"],
+ ["ecaeb2", "e1848de185b1e186bd"],
+ ["ecaeb2", "ecae9ce186bd"],
+ ["ecaeb3", "e1848de185b1e186be"],
+ ["ecaeb3", "ecae9ce186be"],
+ ["ecaeb4", "e1848de185b1e186bf"],
+ ["ecaeb4", "ecae9ce186bf"],
+ ["ecaeb5", "e1848de185b1e18780"],
+ ["ecaeb5", "ecae9ce18780"],
+ ["ecaeb6", "e1848de185b1e18781"],
+ ["ecaeb6", "ecae9ce18781"],
+ ["ecaeb7", "e1848de185b1e18782"],
+ ["ecaeb7", "ecae9ce18782"],
+ ["ecaeb8", "e1848de185b2"],
+ ["ecaeb9", "e1848de185b2e186a8"],
+ ["ecaeb9", "ecaeb8e186a8"],
+ ["ecaeba", "e1848de185b2e186a9"],
+ ["ecaeba", "ecaeb8e186a9"],
+ ["ecaebb", "e1848de185b2e186aa"],
+ ["ecaebb", "ecaeb8e186aa"],
+ ["ecaebc", "e1848de185b2e186ab"],
+ ["ecaebc", "ecaeb8e186ab"],
+ ["ecaebd", "e1848de185b2e186ac"],
+ ["ecaebd", "ecaeb8e186ac"],
+ ["ecaebe", "e1848de185b2e186ad"],
+ ["ecaebe", "ecaeb8e186ad"],
+ ["ecaebf", "e1848de185b2e186ae"],
+ ["ecaebf", "ecaeb8e186ae"],
+ ["ecaf80", "e1848de185b2e186af"],
+ ["ecaf80", "ecaeb8e186af"],
+ ["ecaf81", "e1848de185b2e186b0"],
+ ["ecaf81", "ecaeb8e186b0"],
+ ["ecaf82", "e1848de185b2e186b1"],
+ ["ecaf82", "ecaeb8e186b1"],
+ ["ecaf83", "e1848de185b2e186b2"],
+ ["ecaf83", "ecaeb8e186b2"],
+ ["ecaf84", "e1848de185b2e186b3"],
+ ["ecaf84", "ecaeb8e186b3"],
+ ["ecaf85", "e1848de185b2e186b4"],
+ ["ecaf85", "ecaeb8e186b4"],
+ ["ecaf86", "e1848de185b2e186b5"],
+ ["ecaf86", "ecaeb8e186b5"],
+ ["ecaf87", "e1848de185b2e186b6"],
+ ["ecaf87", "ecaeb8e186b6"],
+ ["ecaf88", "e1848de185b2e186b7"],
+ ["ecaf88", "ecaeb8e186b7"],
+ ["ecaf89", "e1848de185b2e186b8"],
+ ["ecaf89", "ecaeb8e186b8"],
+ ["ecaf8a", "e1848de185b2e186b9"],
+ ["ecaf8a", "ecaeb8e186b9"],
+ ["ecaf8b", "e1848de185b2e186ba"],
+ ["ecaf8b", "ecaeb8e186ba"],
+ ["ecaf8c", "e1848de185b2e186bb"],
+ ["ecaf8c", "ecaeb8e186bb"],
+ ["ecaf8d", "e1848de185b2e186bc"],
+ ["ecaf8d", "ecaeb8e186bc"],
+ ["ecaf8e", "e1848de185b2e186bd"],
+ ["ecaf8e", "ecaeb8e186bd"],
+ ["ecaf8f", "e1848de185b2e186be"],
+ ["ecaf8f", "ecaeb8e186be"],
+ ["ecaf90", "e1848de185b2e186bf"],
+ ["ecaf90", "ecaeb8e186bf"],
+ ["ecaf91", "e1848de185b2e18780"],
+ ["ecaf91", "ecaeb8e18780"],
+ ["ecaf92", "e1848de185b2e18781"],
+ ["ecaf92", "ecaeb8e18781"],
+ ["ecaf93", "e1848de185b2e18782"],
+ ["ecaf93", "ecaeb8e18782"],
+ ["ecaf94", "e1848de185b3"],
+ ["ecaf95", "e1848de185b3e186a8"],
+ ["ecaf95", "ecaf94e186a8"],
+ ["ecaf96", "e1848de185b3e186a9"],
+ ["ecaf96", "ecaf94e186a9"],
+ ["ecaf97", "e1848de185b3e186aa"],
+ ["ecaf97", "ecaf94e186aa"],
+ ["ecaf98", "e1848de185b3e186ab"],
+ ["ecaf98", "ecaf94e186ab"],
+ ["ecaf99", "e1848de185b3e186ac"],
+ ["ecaf99", "ecaf94e186ac"],
+ ["ecaf9a", "e1848de185b3e186ad"],
+ ["ecaf9a", "ecaf94e186ad"],
+ ["ecaf9b", "e1848de185b3e186ae"],
+ ["ecaf9b", "ecaf94e186ae"],
+ ["ecaf9c", "e1848de185b3e186af"],
+ ["ecaf9c", "ecaf94e186af"],
+ ["ecaf9d", "e1848de185b3e186b0"],
+ ["ecaf9d", "ecaf94e186b0"],
+ ["ecaf9e", "e1848de185b3e186b1"],
+ ["ecaf9e", "ecaf94e186b1"],
+ ["ecaf9f", "e1848de185b3e186b2"],
+ ["ecaf9f", "ecaf94e186b2"],
+ ["ecafa0", "e1848de185b3e186b3"],
+ ["ecafa0", "ecaf94e186b3"],
+ ["ecafa1", "e1848de185b3e186b4"],
+ ["ecafa1", "ecaf94e186b4"],
+ ["ecafa2", "e1848de185b3e186b5"],
+ ["ecafa2", "ecaf94e186b5"],
+ ["ecafa3", "e1848de185b3e186b6"],
+ ["ecafa3", "ecaf94e186b6"],
+ ["ecafa4", "e1848de185b3e186b7"],
+ ["ecafa4", "ecaf94e186b7"],
+ ["ecafa5", "e1848de185b3e186b8"],
+ ["ecafa5", "ecaf94e186b8"],
+ ["ecafa6", "e1848de185b3e186b9"],
+ ["ecafa6", "ecaf94e186b9"],
+ ["ecafa7", "e1848de185b3e186ba"],
+ ["ecafa7", "ecaf94e186ba"],
+ ["ecafa8", "e1848de185b3e186bb"],
+ ["ecafa8", "ecaf94e186bb"],
+ ["ecafa9", "e1848de185b3e186bc"],
+ ["ecafa9", "ecaf94e186bc"],
+ ["ecafaa", "e1848de185b3e186bd"],
+ ["ecafaa", "ecaf94e186bd"],
+ ["ecafab", "e1848de185b3e186be"],
+ ["ecafab", "ecaf94e186be"],
+ ["ecafac", "e1848de185b3e186bf"],
+ ["ecafac", "ecaf94e186bf"],
+ ["ecafad", "e1848de185b3e18780"],
+ ["ecafad", "ecaf94e18780"],
+ ["ecafae", "e1848de185b3e18781"],
+ ["ecafae", "ecaf94e18781"],
+ ["ecafaf", "e1848de185b3e18782"],
+ ["ecafaf", "ecaf94e18782"],
+ ["ecafb0", "e1848de185b4"],
+ ["ecafb1", "e1848de185b4e186a8"],
+ ["ecafb1", "ecafb0e186a8"],
+ ["ecafb2", "e1848de185b4e186a9"],
+ ["ecafb2", "ecafb0e186a9"],
+ ["ecafb3", "e1848de185b4e186aa"],
+ ["ecafb3", "ecafb0e186aa"],
+ ["ecafb4", "e1848de185b4e186ab"],
+ ["ecafb4", "ecafb0e186ab"],
+ ["ecafb5", "e1848de185b4e186ac"],
+ ["ecafb5", "ecafb0e186ac"],
+ ["ecafb6", "e1848de185b4e186ad"],
+ ["ecafb6", "ecafb0e186ad"],
+ ["ecafb7", "e1848de185b4e186ae"],
+ ["ecafb7", "ecafb0e186ae"],
+ ["ecafb8", "e1848de185b4e186af"],
+ ["ecafb8", "ecafb0e186af"],
+ ["ecafb9", "e1848de185b4e186b0"],
+ ["ecafb9", "ecafb0e186b0"],
+ ["ecafba", "e1848de185b4e186b1"],
+ ["ecafba", "ecafb0e186b1"],
+ ["ecafbb", "e1848de185b4e186b2"],
+ ["ecafbb", "ecafb0e186b2"],
+ ["ecafbc", "e1848de185b4e186b3"],
+ ["ecafbc", "ecafb0e186b3"],
+ ["ecafbd", "e1848de185b4e186b4"],
+ ["ecafbd", "ecafb0e186b4"],
+ ["ecafbe", "e1848de185b4e186b5"],
+ ["ecafbe", "ecafb0e186b5"],
+ ["ecafbf", "e1848de185b4e186b6"],
+ ["ecafbf", "ecafb0e186b6"],
+ ["ecb080", "e1848de185b4e186b7"],
+ ["ecb080", "ecafb0e186b7"],
+ ["ecb081", "e1848de185b4e186b8"],
+ ["ecb081", "ecafb0e186b8"],
+ ["ecb082", "e1848de185b4e186b9"],
+ ["ecb082", "ecafb0e186b9"],
+ ["ecb083", "e1848de185b4e186ba"],
+ ["ecb083", "ecafb0e186ba"],
+ ["ecb084", "e1848de185b4e186bb"],
+ ["ecb084", "ecafb0e186bb"],
+ ["ecb085", "e1848de185b4e186bc"],
+ ["ecb085", "ecafb0e186bc"],
+ ["ecb086", "e1848de185b4e186bd"],
+ ["ecb086", "ecafb0e186bd"],
+ ["ecb087", "e1848de185b4e186be"],
+ ["ecb087", "ecafb0e186be"],
+ ["ecb088", "e1848de185b4e186bf"],
+ ["ecb088", "ecafb0e186bf"],
+ ["ecb089", "e1848de185b4e18780"],
+ ["ecb089", "ecafb0e18780"],
+ ["ecb08a", "e1848de185b4e18781"],
+ ["ecb08a", "ecafb0e18781"],
+ ["ecb08b", "e1848de185b4e18782"],
+ ["ecb08b", "ecafb0e18782"],
+ ["ecb08c", "e1848de185b5"],
+ ["ecb08d", "e1848de185b5e186a8"],
+ ["ecb08d", "ecb08ce186a8"],
+ ["ecb08e", "e1848de185b5e186a9"],
+ ["ecb08e", "ecb08ce186a9"],
+ ["ecb08f", "e1848de185b5e186aa"],
+ ["ecb08f", "ecb08ce186aa"],
+ ["ecb090", "e1848de185b5e186ab"],
+ ["ecb090", "ecb08ce186ab"],
+ ["ecb091", "e1848de185b5e186ac"],
+ ["ecb091", "ecb08ce186ac"],
+ ["ecb092", "e1848de185b5e186ad"],
+ ["ecb092", "ecb08ce186ad"],
+ ["ecb093", "e1848de185b5e186ae"],
+ ["ecb093", "ecb08ce186ae"],
+ ["ecb094", "e1848de185b5e186af"],
+ ["ecb094", "ecb08ce186af"],
+ ["ecb095", "e1848de185b5e186b0"],
+ ["ecb095", "ecb08ce186b0"],
+ ["ecb096", "e1848de185b5e186b1"],
+ ["ecb096", "ecb08ce186b1"],
+ ["ecb097", "e1848de185b5e186b2"],
+ ["ecb097", "ecb08ce186b2"],
+ ["ecb098", "e1848de185b5e186b3"],
+ ["ecb098", "ecb08ce186b3"],
+ ["ecb099", "e1848de185b5e186b4"],
+ ["ecb099", "ecb08ce186b4"],
+ ["ecb09a", "e1848de185b5e186b5"],
+ ["ecb09a", "ecb08ce186b5"],
+ ["ecb09b", "e1848de185b5e186b6"],
+ ["ecb09b", "ecb08ce186b6"],
+ ["ecb09c", "e1848de185b5e186b7"],
+ ["ecb09c", "ecb08ce186b7"],
+ ["ecb09d", "e1848de185b5e186b8"],
+ ["ecb09d", "ecb08ce186b8"],
+ ["ecb09e", "e1848de185b5e186b9"],
+ ["ecb09e", "ecb08ce186b9"],
+ ["ecb09f", "e1848de185b5e186ba"],
+ ["ecb09f", "ecb08ce186ba"],
+ ["ecb0a0", "e1848de185b5e186bb"],
+ ["ecb0a0", "ecb08ce186bb"],
+ ["ecb0a1", "e1848de185b5e186bc"],
+ ["ecb0a1", "ecb08ce186bc"],
+ ["ecb0a2", "e1848de185b5e186bd"],
+ ["ecb0a2", "ecb08ce186bd"],
+ ["ecb0a3", "e1848de185b5e186be"],
+ ["ecb0a3", "ecb08ce186be"],
+ ["ecb0a4", "e1848de185b5e186bf"],
+ ["ecb0a4", "ecb08ce186bf"],
+ ["ecb0a5", "e1848de185b5e18780"],
+ ["ecb0a5", "ecb08ce18780"],
+ ["ecb0a6", "e1848de185b5e18781"],
+ ["ecb0a6", "ecb08ce18781"],
+ ["ecb0a7", "e1848de185b5e18782"],
+ ["ecb0a7", "ecb08ce18782"],
+ ["ecb0a8", "e1848ee185a1"],
+ ["ecb0a9", "e1848ee185a1e186a8"],
+ ["ecb0a9", "ecb0a8e186a8"],
+ ["ecb0aa", "e1848ee185a1e186a9"],
+ ["ecb0aa", "ecb0a8e186a9"],
+ ["ecb0ab", "e1848ee185a1e186aa"],
+ ["ecb0ab", "ecb0a8e186aa"],
+ ["ecb0ac", "e1848ee185a1e186ab"],
+ ["ecb0ac", "ecb0a8e186ab"],
+ ["ecb0ad", "e1848ee185a1e186ac"],
+ ["ecb0ad", "ecb0a8e186ac"],
+ ["ecb0ae", "e1848ee185a1e186ad"],
+ ["ecb0ae", "ecb0a8e186ad"],
+ ["ecb0af", "e1848ee185a1e186ae"],
+ ["ecb0af", "ecb0a8e186ae"],
+ ["ecb0b0", "e1848ee185a1e186af"],
+ ["ecb0b0", "ecb0a8e186af"],
+ ["ecb0b1", "e1848ee185a1e186b0"],
+ ["ecb0b1", "ecb0a8e186b0"],
+ ["ecb0b2", "e1848ee185a1e186b1"],
+ ["ecb0b2", "ecb0a8e186b1"],
+ ["ecb0b3", "e1848ee185a1e186b2"],
+ ["ecb0b3", "ecb0a8e186b2"],
+ ["ecb0b4", "e1848ee185a1e186b3"],
+ ["ecb0b4", "ecb0a8e186b3"],
+ ["ecb0b5", "e1848ee185a1e186b4"],
+ ["ecb0b5", "ecb0a8e186b4"],
+ ["ecb0b6", "e1848ee185a1e186b5"],
+ ["ecb0b6", "ecb0a8e186b5"],
+ ["ecb0b7", "e1848ee185a1e186b6"],
+ ["ecb0b7", "ecb0a8e186b6"],
+ ["ecb0b8", "e1848ee185a1e186b7"],
+ ["ecb0b8", "ecb0a8e186b7"],
+ ["ecb0b9", "e1848ee185a1e186b8"],
+ ["ecb0b9", "ecb0a8e186b8"],
+ ["ecb0ba", "e1848ee185a1e186b9"],
+ ["ecb0ba", "ecb0a8e186b9"],
+ ["ecb0bb", "e1848ee185a1e186ba"],
+ ["ecb0bb", "ecb0a8e186ba"],
+ ["ecb0bc", "e1848ee185a1e186bb"],
+ ["ecb0bc", "ecb0a8e186bb"],
+ ["ecb0bd", "e1848ee185a1e186bc"],
+ ["ecb0bd", "ecb0a8e186bc"],
+ ["ecb0be", "e1848ee185a1e186bd"],
+ ["ecb0be", "ecb0a8e186bd"],
+ ["ecb0bf", "e1848ee185a1e186be"],
+ ["ecb0bf", "ecb0a8e186be"],
+ ["ecb180", "e1848ee185a1e186bf"],
+ ["ecb180", "ecb0a8e186bf"],
+ ["ecb181", "e1848ee185a1e18780"],
+ ["ecb181", "ecb0a8e18780"],
+ ["ecb182", "e1848ee185a1e18781"],
+ ["ecb182", "ecb0a8e18781"],
+ ["ecb183", "e1848ee185a1e18782"],
+ ["ecb183", "ecb0a8e18782"],
+ ["ecb184", "e1848ee185a2"],
+ ["ecb185", "e1848ee185a2e186a8"],
+ ["ecb185", "ecb184e186a8"],
+ ["ecb186", "e1848ee185a2e186a9"],
+ ["ecb186", "ecb184e186a9"],
+ ["ecb187", "e1848ee185a2e186aa"],
+ ["ecb187", "ecb184e186aa"],
+ ["ecb188", "e1848ee185a2e186ab"],
+ ["ecb188", "ecb184e186ab"],
+ ["ecb189", "e1848ee185a2e186ac"],
+ ["ecb189", "ecb184e186ac"],
+ ["ecb18a", "e1848ee185a2e186ad"],
+ ["ecb18a", "ecb184e186ad"],
+ ["ecb18b", "e1848ee185a2e186ae"],
+ ["ecb18b", "ecb184e186ae"],
+ ["ecb18c", "e1848ee185a2e186af"],
+ ["ecb18c", "ecb184e186af"],
+ ["ecb18d", "e1848ee185a2e186b0"],
+ ["ecb18d", "ecb184e186b0"],
+ ["ecb18e", "e1848ee185a2e186b1"],
+ ["ecb18e", "ecb184e186b1"],
+ ["ecb18f", "e1848ee185a2e186b2"],
+ ["ecb18f", "ecb184e186b2"],
+ ["ecb190", "e1848ee185a2e186b3"],
+ ["ecb190", "ecb184e186b3"],
+ ["ecb191", "e1848ee185a2e186b4"],
+ ["ecb191", "ecb184e186b4"],
+ ["ecb192", "e1848ee185a2e186b5"],
+ ["ecb192", "ecb184e186b5"],
+ ["ecb193", "e1848ee185a2e186b6"],
+ ["ecb193", "ecb184e186b6"],
+ ["ecb194", "e1848ee185a2e186b7"],
+ ["ecb194", "ecb184e186b7"],
+ ["ecb195", "e1848ee185a2e186b8"],
+ ["ecb195", "ecb184e186b8"],
+ ["ecb196", "e1848ee185a2e186b9"],
+ ["ecb196", "ecb184e186b9"],
+ ["ecb197", "e1848ee185a2e186ba"],
+ ["ecb197", "ecb184e186ba"],
+ ["ecb198", "e1848ee185a2e186bb"],
+ ["ecb198", "ecb184e186bb"],
+ ["ecb199", "e1848ee185a2e186bc"],
+ ["ecb199", "ecb184e186bc"],
+ ["ecb19a", "e1848ee185a2e186bd"],
+ ["ecb19a", "ecb184e186bd"],
+ ["ecb19b", "e1848ee185a2e186be"],
+ ["ecb19b", "ecb184e186be"],
+ ["ecb19c", "e1848ee185a2e186bf"],
+ ["ecb19c", "ecb184e186bf"],
+ ["ecb19d", "e1848ee185a2e18780"],
+ ["ecb19d", "ecb184e18780"],
+ ["ecb19e", "e1848ee185a2e18781"],
+ ["ecb19e", "ecb184e18781"],
+ ["ecb19f", "e1848ee185a2e18782"],
+ ["ecb19f", "ecb184e18782"],
+ ["ecb1a0", "e1848ee185a3"],
+ ["ecb1a1", "e1848ee185a3e186a8"],
+ ["ecb1a1", "ecb1a0e186a8"],
+ ["ecb1a2", "e1848ee185a3e186a9"],
+ ["ecb1a2", "ecb1a0e186a9"],
+ ["ecb1a3", "e1848ee185a3e186aa"],
+ ["ecb1a3", "ecb1a0e186aa"],
+ ["ecb1a4", "e1848ee185a3e186ab"],
+ ["ecb1a4", "ecb1a0e186ab"],
+ ["ecb1a5", "e1848ee185a3e186ac"],
+ ["ecb1a5", "ecb1a0e186ac"],
+ ["ecb1a6", "e1848ee185a3e186ad"],
+ ["ecb1a6", "ecb1a0e186ad"],
+ ["ecb1a7", "e1848ee185a3e186ae"],
+ ["ecb1a7", "ecb1a0e186ae"],
+ ["ecb1a8", "e1848ee185a3e186af"],
+ ["ecb1a8", "ecb1a0e186af"],
+ ["ecb1a9", "e1848ee185a3e186b0"],
+ ["ecb1a9", "ecb1a0e186b0"],
+ ["ecb1aa", "e1848ee185a3e186b1"],
+ ["ecb1aa", "ecb1a0e186b1"],
+ ["ecb1ab", "e1848ee185a3e186b2"],
+ ["ecb1ab", "ecb1a0e186b2"],
+ ["ecb1ac", "e1848ee185a3e186b3"],
+ ["ecb1ac", "ecb1a0e186b3"],
+ ["ecb1ad", "e1848ee185a3e186b4"],
+ ["ecb1ad", "ecb1a0e186b4"],
+ ["ecb1ae", "e1848ee185a3e186b5"],
+ ["ecb1ae", "ecb1a0e186b5"],
+ ["ecb1af", "e1848ee185a3e186b6"],
+ ["ecb1af", "ecb1a0e186b6"],
+ ["ecb1b0", "e1848ee185a3e186b7"],
+ ["ecb1b0", "ecb1a0e186b7"],
+ ["ecb1b1", "e1848ee185a3e186b8"],
+ ["ecb1b1", "ecb1a0e186b8"],
+ ["ecb1b2", "e1848ee185a3e186b9"],
+ ["ecb1b2", "ecb1a0e186b9"],
+ ["ecb1b3", "e1848ee185a3e186ba"],
+ ["ecb1b3", "ecb1a0e186ba"],
+ ["ecb1b4", "e1848ee185a3e186bb"],
+ ["ecb1b4", "ecb1a0e186bb"],
+ ["ecb1b5", "e1848ee185a3e186bc"],
+ ["ecb1b5", "ecb1a0e186bc"],
+ ["ecb1b6", "e1848ee185a3e186bd"],
+ ["ecb1b6", "ecb1a0e186bd"],
+ ["ecb1b7", "e1848ee185a3e186be"],
+ ["ecb1b7", "ecb1a0e186be"],
+ ["ecb1b8", "e1848ee185a3e186bf"],
+ ["ecb1b8", "ecb1a0e186bf"],
+ ["ecb1b9", "e1848ee185a3e18780"],
+ ["ecb1b9", "ecb1a0e18780"],
+ ["ecb1ba", "e1848ee185a3e18781"],
+ ["ecb1ba", "ecb1a0e18781"],
+ ["ecb1bb", "e1848ee185a3e18782"],
+ ["ecb1bb", "ecb1a0e18782"],
+ ["ecb1bc", "e1848ee185a4"],
+ ["ecb1bd", "e1848ee185a4e186a8"],
+ ["ecb1bd", "ecb1bce186a8"],
+ ["ecb1be", "e1848ee185a4e186a9"],
+ ["ecb1be", "ecb1bce186a9"],
+ ["ecb1bf", "e1848ee185a4e186aa"],
+ ["ecb1bf", "ecb1bce186aa"],
+ ["ecb280", "e1848ee185a4e186ab"],
+ ["ecb280", "ecb1bce186ab"],
+ ["ecb281", "e1848ee185a4e186ac"],
+ ["ecb281", "ecb1bce186ac"],
+ ["ecb282", "e1848ee185a4e186ad"],
+ ["ecb282", "ecb1bce186ad"],
+ ["ecb283", "e1848ee185a4e186ae"],
+ ["ecb283", "ecb1bce186ae"],
+ ["ecb284", "e1848ee185a4e186af"],
+ ["ecb284", "ecb1bce186af"],
+ ["ecb285", "e1848ee185a4e186b0"],
+ ["ecb285", "ecb1bce186b0"],
+ ["ecb286", "e1848ee185a4e186b1"],
+ ["ecb286", "ecb1bce186b1"],
+ ["ecb287", "e1848ee185a4e186b2"],
+ ["ecb287", "ecb1bce186b2"],
+ ["ecb288", "e1848ee185a4e186b3"],
+ ["ecb288", "ecb1bce186b3"],
+ ["ecb289", "e1848ee185a4e186b4"],
+ ["ecb289", "ecb1bce186b4"],
+ ["ecb28a", "e1848ee185a4e186b5"],
+ ["ecb28a", "ecb1bce186b5"],
+ ["ecb28b", "e1848ee185a4e186b6"],
+ ["ecb28b", "ecb1bce186b6"],
+ ["ecb28c", "e1848ee185a4e186b7"],
+ ["ecb28c", "ecb1bce186b7"],
+ ["ecb28d", "e1848ee185a4e186b8"],
+ ["ecb28d", "ecb1bce186b8"],
+ ["ecb28e", "e1848ee185a4e186b9"],
+ ["ecb28e", "ecb1bce186b9"],
+ ["ecb28f", "e1848ee185a4e186ba"],
+ ["ecb28f", "ecb1bce186ba"],
+ ["ecb290", "e1848ee185a4e186bb"],
+ ["ecb290", "ecb1bce186bb"],
+ ["ecb291", "e1848ee185a4e186bc"],
+ ["ecb291", "ecb1bce186bc"],
+ ["ecb292", "e1848ee185a4e186bd"],
+ ["ecb292", "ecb1bce186bd"],
+ ["ecb293", "e1848ee185a4e186be"],
+ ["ecb293", "ecb1bce186be"],
+ ["ecb294", "e1848ee185a4e186bf"],
+ ["ecb294", "ecb1bce186bf"],
+ ["ecb295", "e1848ee185a4e18780"],
+ ["ecb295", "ecb1bce18780"],
+ ["ecb296", "e1848ee185a4e18781"],
+ ["ecb296", "ecb1bce18781"],
+ ["ecb297", "e1848ee185a4e18782"],
+ ["ecb297", "ecb1bce18782"],
+ ["ecb298", "e1848ee185a5"],
+ ["ecb299", "e1848ee185a5e186a8"],
+ ["ecb299", "ecb298e186a8"],
+ ["ecb29a", "e1848ee185a5e186a9"],
+ ["ecb29a", "ecb298e186a9"],
+ ["ecb29b", "e1848ee185a5e186aa"],
+ ["ecb29b", "ecb298e186aa"],
+ ["ecb29c", "e1848ee185a5e186ab"],
+ ["ecb29c", "ecb298e186ab"],
+ ["ecb29d", "e1848ee185a5e186ac"],
+ ["ecb29d", "ecb298e186ac"],
+ ["ecb29e", "e1848ee185a5e186ad"],
+ ["ecb29e", "ecb298e186ad"],
+ ["ecb29f", "e1848ee185a5e186ae"],
+ ["ecb29f", "ecb298e186ae"],
+ ["ecb2a0", "e1848ee185a5e186af"],
+ ["ecb2a0", "ecb298e186af"],
+ ["ecb2a1", "e1848ee185a5e186b0"],
+ ["ecb2a1", "ecb298e186b0"],
+ ["ecb2a2", "e1848ee185a5e186b1"],
+ ["ecb2a2", "ecb298e186b1"],
+ ["ecb2a3", "e1848ee185a5e186b2"],
+ ["ecb2a3", "ecb298e186b2"],
+ ["ecb2a4", "e1848ee185a5e186b3"],
+ ["ecb2a4", "ecb298e186b3"],
+ ["ecb2a5", "e1848ee185a5e186b4"],
+ ["ecb2a5", "ecb298e186b4"],
+ ["ecb2a6", "e1848ee185a5e186b5"],
+ ["ecb2a6", "ecb298e186b5"],
+ ["ecb2a7", "e1848ee185a5e186b6"],
+ ["ecb2a7", "ecb298e186b6"],
+ ["ecb2a8", "e1848ee185a5e186b7"],
+ ["ecb2a8", "ecb298e186b7"],
+ ["ecb2a9", "e1848ee185a5e186b8"],
+ ["ecb2a9", "ecb298e186b8"],
+ ["ecb2aa", "e1848ee185a5e186b9"],
+ ["ecb2aa", "ecb298e186b9"],
+ ["ecb2ab", "e1848ee185a5e186ba"],
+ ["ecb2ab", "ecb298e186ba"],
+ ["ecb2ac", "e1848ee185a5e186bb"],
+ ["ecb2ac", "ecb298e186bb"],
+ ["ecb2ad", "e1848ee185a5e186bc"],
+ ["ecb2ad", "ecb298e186bc"],
+ ["ecb2ae", "e1848ee185a5e186bd"],
+ ["ecb2ae", "ecb298e186bd"],
+ ["ecb2af", "e1848ee185a5e186be"],
+ ["ecb2af", "ecb298e186be"],
+ ["ecb2b0", "e1848ee185a5e186bf"],
+ ["ecb2b0", "ecb298e186bf"],
+ ["ecb2b1", "e1848ee185a5e18780"],
+ ["ecb2b1", "ecb298e18780"],
+ ["ecb2b2", "e1848ee185a5e18781"],
+ ["ecb2b2", "ecb298e18781"],
+ ["ecb2b3", "e1848ee185a5e18782"],
+ ["ecb2b3", "ecb298e18782"],
+ ["ecb2b4", "e1848ee185a6"],
+ ["ecb2b5", "e1848ee185a6e186a8"],
+ ["ecb2b5", "ecb2b4e186a8"],
+ ["ecb2b6", "e1848ee185a6e186a9"],
+ ["ecb2b6", "ecb2b4e186a9"],
+ ["ecb2b7", "e1848ee185a6e186aa"],
+ ["ecb2b7", "ecb2b4e186aa"],
+ ["ecb2b8", "e1848ee185a6e186ab"],
+ ["ecb2b8", "ecb2b4e186ab"],
+ ["ecb2b9", "e1848ee185a6e186ac"],
+ ["ecb2b9", "ecb2b4e186ac"],
+ ["ecb2ba", "e1848ee185a6e186ad"],
+ ["ecb2ba", "ecb2b4e186ad"],
+ ["ecb2bb", "e1848ee185a6e186ae"],
+ ["ecb2bb", "ecb2b4e186ae"],
+ ["ecb2bc", "e1848ee185a6e186af"],
+ ["ecb2bc", "ecb2b4e186af"],
+ ["ecb2bd", "e1848ee185a6e186b0"],
+ ["ecb2bd", "ecb2b4e186b0"],
+ ["ecb2be", "e1848ee185a6e186b1"],
+ ["ecb2be", "ecb2b4e186b1"],
+ ["ecb2bf", "e1848ee185a6e186b2"],
+ ["ecb2bf", "ecb2b4e186b2"],
+ ["ecb380", "e1848ee185a6e186b3"],
+ ["ecb380", "ecb2b4e186b3"],
+ ["ecb381", "e1848ee185a6e186b4"],
+ ["ecb381", "ecb2b4e186b4"],
+ ["ecb382", "e1848ee185a6e186b5"],
+ ["ecb382", "ecb2b4e186b5"],
+ ["ecb383", "e1848ee185a6e186b6"],
+ ["ecb383", "ecb2b4e186b6"],
+ ["ecb384", "e1848ee185a6e186b7"],
+ ["ecb384", "ecb2b4e186b7"],
+ ["ecb385", "e1848ee185a6e186b8"],
+ ["ecb385", "ecb2b4e186b8"],
+ ["ecb386", "e1848ee185a6e186b9"],
+ ["ecb386", "ecb2b4e186b9"],
+ ["ecb387", "e1848ee185a6e186ba"],
+ ["ecb387", "ecb2b4e186ba"],
+ ["ecb388", "e1848ee185a6e186bb"],
+ ["ecb388", "ecb2b4e186bb"],
+ ["ecb389", "e1848ee185a6e186bc"],
+ ["ecb389", "ecb2b4e186bc"],
+ ["ecb38a", "e1848ee185a6e186bd"],
+ ["ecb38a", "ecb2b4e186bd"],
+ ["ecb38b", "e1848ee185a6e186be"],
+ ["ecb38b", "ecb2b4e186be"],
+ ["ecb38c", "e1848ee185a6e186bf"],
+ ["ecb38c", "ecb2b4e186bf"],
+ ["ecb38d", "e1848ee185a6e18780"],
+ ["ecb38d", "ecb2b4e18780"],
+ ["ecb38e", "e1848ee185a6e18781"],
+ ["ecb38e", "ecb2b4e18781"],
+ ["ecb38f", "e1848ee185a6e18782"],
+ ["ecb38f", "ecb2b4e18782"],
+ ["ecb390", "e1848ee185a7"],
+ ["ecb391", "e1848ee185a7e186a8"],
+ ["ecb391", "ecb390e186a8"],
+ ["ecb392", "e1848ee185a7e186a9"],
+ ["ecb392", "ecb390e186a9"],
+ ["ecb393", "e1848ee185a7e186aa"],
+ ["ecb393", "ecb390e186aa"],
+ ["ecb394", "e1848ee185a7e186ab"],
+ ["ecb394", "ecb390e186ab"],
+ ["ecb395", "e1848ee185a7e186ac"],
+ ["ecb395", "ecb390e186ac"],
+ ["ecb396", "e1848ee185a7e186ad"],
+ ["ecb396", "ecb390e186ad"],
+ ["ecb397", "e1848ee185a7e186ae"],
+ ["ecb397", "ecb390e186ae"],
+ ["ecb398", "e1848ee185a7e186af"],
+ ["ecb398", "ecb390e186af"],
+ ["ecb399", "e1848ee185a7e186b0"],
+ ["ecb399", "ecb390e186b0"],
+ ["ecb39a", "e1848ee185a7e186b1"],
+ ["ecb39a", "ecb390e186b1"],
+ ["ecb39b", "e1848ee185a7e186b2"],
+ ["ecb39b", "ecb390e186b2"],
+ ["ecb39c", "e1848ee185a7e186b3"],
+ ["ecb39c", "ecb390e186b3"],
+ ["ecb39d", "e1848ee185a7e186b4"],
+ ["ecb39d", "ecb390e186b4"],
+ ["ecb39e", "e1848ee185a7e186b5"],
+ ["ecb39e", "ecb390e186b5"],
+ ["ecb39f", "e1848ee185a7e186b6"],
+ ["ecb39f", "ecb390e186b6"],
+ ["ecb3a0", "e1848ee185a7e186b7"],
+ ["ecb3a0", "ecb390e186b7"],
+ ["ecb3a1", "e1848ee185a7e186b8"],
+ ["ecb3a1", "ecb390e186b8"],
+ ["ecb3a2", "e1848ee185a7e186b9"],
+ ["ecb3a2", "ecb390e186b9"],
+ ["ecb3a3", "e1848ee185a7e186ba"],
+ ["ecb3a3", "ecb390e186ba"],
+ ["ecb3a4", "e1848ee185a7e186bb"],
+ ["ecb3a4", "ecb390e186bb"],
+ ["ecb3a5", "e1848ee185a7e186bc"],
+ ["ecb3a5", "ecb390e186bc"],
+ ["ecb3a6", "e1848ee185a7e186bd"],
+ ["ecb3a6", "ecb390e186bd"],
+ ["ecb3a7", "e1848ee185a7e186be"],
+ ["ecb3a7", "ecb390e186be"],
+ ["ecb3a8", "e1848ee185a7e186bf"],
+ ["ecb3a8", "ecb390e186bf"],
+ ["ecb3a9", "e1848ee185a7e18780"],
+ ["ecb3a9", "ecb390e18780"],
+ ["ecb3aa", "e1848ee185a7e18781"],
+ ["ecb3aa", "ecb390e18781"],
+ ["ecb3ab", "e1848ee185a7e18782"],
+ ["ecb3ab", "ecb390e18782"],
+ ["ecb3ac", "e1848ee185a8"],
+ ["ecb3ad", "e1848ee185a8e186a8"],
+ ["ecb3ad", "ecb3ace186a8"],
+ ["ecb3ae", "e1848ee185a8e186a9"],
+ ["ecb3ae", "ecb3ace186a9"],
+ ["ecb3af", "e1848ee185a8e186aa"],
+ ["ecb3af", "ecb3ace186aa"],
+ ["ecb3b0", "e1848ee185a8e186ab"],
+ ["ecb3b0", "ecb3ace186ab"],
+ ["ecb3b1", "e1848ee185a8e186ac"],
+ ["ecb3b1", "ecb3ace186ac"],
+ ["ecb3b2", "e1848ee185a8e186ad"],
+ ["ecb3b2", "ecb3ace186ad"],
+ ["ecb3b3", "e1848ee185a8e186ae"],
+ ["ecb3b3", "ecb3ace186ae"],
+ ["ecb3b4", "e1848ee185a8e186af"],
+ ["ecb3b4", "ecb3ace186af"],
+ ["ecb3b5", "e1848ee185a8e186b0"],
+ ["ecb3b5", "ecb3ace186b0"],
+ ["ecb3b6", "e1848ee185a8e186b1"],
+ ["ecb3b6", "ecb3ace186b1"],
+ ["ecb3b7", "e1848ee185a8e186b2"],
+ ["ecb3b7", "ecb3ace186b2"],
+ ["ecb3b8", "e1848ee185a8e186b3"],
+ ["ecb3b8", "ecb3ace186b3"],
+ ["ecb3b9", "e1848ee185a8e186b4"],
+ ["ecb3b9", "ecb3ace186b4"],
+ ["ecb3ba", "e1848ee185a8e186b5"],
+ ["ecb3ba", "ecb3ace186b5"],
+ ["ecb3bb", "e1848ee185a8e186b6"],
+ ["ecb3bb", "ecb3ace186b6"],
+ ["ecb3bc", "e1848ee185a8e186b7"],
+ ["ecb3bc", "ecb3ace186b7"],
+ ["ecb3bd", "e1848ee185a8e186b8"],
+ ["ecb3bd", "ecb3ace186b8"],
+ ["ecb3be", "e1848ee185a8e186b9"],
+ ["ecb3be", "ecb3ace186b9"],
+ ["ecb3bf", "e1848ee185a8e186ba"],
+ ["ecb3bf", "ecb3ace186ba"],
+ ["ecb480", "e1848ee185a8e186bb"],
+ ["ecb480", "ecb3ace186bb"],
+ ["ecb481", "e1848ee185a8e186bc"],
+ ["ecb481", "ecb3ace186bc"],
+ ["ecb482", "e1848ee185a8e186bd"],
+ ["ecb482", "ecb3ace186bd"],
+ ["ecb483", "e1848ee185a8e186be"],
+ ["ecb483", "ecb3ace186be"],
+ ["ecb484", "e1848ee185a8e186bf"],
+ ["ecb484", "ecb3ace186bf"],
+ ["ecb485", "e1848ee185a8e18780"],
+ ["ecb485", "ecb3ace18780"],
+ ["ecb486", "e1848ee185a8e18781"],
+ ["ecb486", "ecb3ace18781"],
+ ["ecb487", "e1848ee185a8e18782"],
+ ["ecb487", "ecb3ace18782"],
+ ["ecb488", "e1848ee185a9"],
+ ["ecb489", "e1848ee185a9e186a8"],
+ ["ecb489", "ecb488e186a8"],
+ ["ecb48a", "e1848ee185a9e186a9"],
+ ["ecb48a", "ecb488e186a9"],
+ ["ecb48b", "e1848ee185a9e186aa"],
+ ["ecb48b", "ecb488e186aa"],
+ ["ecb48c", "e1848ee185a9e186ab"],
+ ["ecb48c", "ecb488e186ab"],
+ ["ecb48d", "e1848ee185a9e186ac"],
+ ["ecb48d", "ecb488e186ac"],
+ ["ecb48e", "e1848ee185a9e186ad"],
+ ["ecb48e", "ecb488e186ad"],
+ ["ecb48f", "e1848ee185a9e186ae"],
+ ["ecb48f", "ecb488e186ae"],
+ ["ecb490", "e1848ee185a9e186af"],
+ ["ecb490", "ecb488e186af"],
+ ["ecb491", "e1848ee185a9e186b0"],
+ ["ecb491", "ecb488e186b0"],
+ ["ecb492", "e1848ee185a9e186b1"],
+ ["ecb492", "ecb488e186b1"],
+ ["ecb493", "e1848ee185a9e186b2"],
+ ["ecb493", "ecb488e186b2"],
+ ["ecb494", "e1848ee185a9e186b3"],
+ ["ecb494", "ecb488e186b3"],
+ ["ecb495", "e1848ee185a9e186b4"],
+ ["ecb495", "ecb488e186b4"],
+ ["ecb496", "e1848ee185a9e186b5"],
+ ["ecb496", "ecb488e186b5"],
+ ["ecb497", "e1848ee185a9e186b6"],
+ ["ecb497", "ecb488e186b6"],
+ ["ecb498", "e1848ee185a9e186b7"],
+ ["ecb498", "ecb488e186b7"],
+ ["ecb499", "e1848ee185a9e186b8"],
+ ["ecb499", "ecb488e186b8"],
+ ["ecb49a", "e1848ee185a9e186b9"],
+ ["ecb49a", "ecb488e186b9"],
+ ["ecb49b", "e1848ee185a9e186ba"],
+ ["ecb49b", "ecb488e186ba"],
+ ["ecb49c", "e1848ee185a9e186bb"],
+ ["ecb49c", "ecb488e186bb"],
+ ["ecb49d", "e1848ee185a9e186bc"],
+ ["ecb49d", "ecb488e186bc"],
+ ["ecb49e", "e1848ee185a9e186bd"],
+ ["ecb49e", "ecb488e186bd"],
+ ["ecb49f", "e1848ee185a9e186be"],
+ ["ecb49f", "ecb488e186be"],
+ ["ecb4a0", "e1848ee185a9e186bf"],
+ ["ecb4a0", "ecb488e186bf"],
+ ["ecb4a1", "e1848ee185a9e18780"],
+ ["ecb4a1", "ecb488e18780"],
+ ["ecb4a2", "e1848ee185a9e18781"],
+ ["ecb4a2", "ecb488e18781"],
+ ["ecb4a3", "e1848ee185a9e18782"],
+ ["ecb4a3", "ecb488e18782"],
+ ["ecb4a4", "e1848ee185aa"],
+ ["ecb4a5", "e1848ee185aae186a8"],
+ ["ecb4a5", "ecb4a4e186a8"],
+ ["ecb4a6", "e1848ee185aae186a9"],
+ ["ecb4a6", "ecb4a4e186a9"],
+ ["ecb4a7", "e1848ee185aae186aa"],
+ ["ecb4a7", "ecb4a4e186aa"],
+ ["ecb4a8", "e1848ee185aae186ab"],
+ ["ecb4a8", "ecb4a4e186ab"],
+ ["ecb4a9", "e1848ee185aae186ac"],
+ ["ecb4a9", "ecb4a4e186ac"],
+ ["ecb4aa", "e1848ee185aae186ad"],
+ ["ecb4aa", "ecb4a4e186ad"],
+ ["ecb4ab", "e1848ee185aae186ae"],
+ ["ecb4ab", "ecb4a4e186ae"],
+ ["ecb4ac", "e1848ee185aae186af"],
+ ["ecb4ac", "ecb4a4e186af"],
+ ["ecb4ad", "e1848ee185aae186b0"],
+ ["ecb4ad", "ecb4a4e186b0"],
+ ["ecb4ae", "e1848ee185aae186b1"],
+ ["ecb4ae", "ecb4a4e186b1"],
+ ["ecb4af", "e1848ee185aae186b2"],
+ ["ecb4af", "ecb4a4e186b2"],
+ ["ecb4b0", "e1848ee185aae186b3"],
+ ["ecb4b0", "ecb4a4e186b3"],
+ ["ecb4b1", "e1848ee185aae186b4"],
+ ["ecb4b1", "ecb4a4e186b4"],
+ ["ecb4b2", "e1848ee185aae186b5"],
+ ["ecb4b2", "ecb4a4e186b5"],
+ ["ecb4b3", "e1848ee185aae186b6"],
+ ["ecb4b3", "ecb4a4e186b6"],
+ ["ecb4b4", "e1848ee185aae186b7"],
+ ["ecb4b4", "ecb4a4e186b7"],
+ ["ecb4b5", "e1848ee185aae186b8"],
+ ["ecb4b5", "ecb4a4e186b8"],
+ ["ecb4b6", "e1848ee185aae186b9"],
+ ["ecb4b6", "ecb4a4e186b9"],
+ ["ecb4b7", "e1848ee185aae186ba"],
+ ["ecb4b7", "ecb4a4e186ba"],
+ ["ecb4b8", "e1848ee185aae186bb"],
+ ["ecb4b8", "ecb4a4e186bb"],
+ ["ecb4b9", "e1848ee185aae186bc"],
+ ["ecb4b9", "ecb4a4e186bc"],
+ ["ecb4ba", "e1848ee185aae186bd"],
+ ["ecb4ba", "ecb4a4e186bd"],
+ ["ecb4bb", "e1848ee185aae186be"],
+ ["ecb4bb", "ecb4a4e186be"],
+ ["ecb4bc", "e1848ee185aae186bf"],
+ ["ecb4bc", "ecb4a4e186bf"],
+ ["ecb4bd", "e1848ee185aae18780"],
+ ["ecb4bd", "ecb4a4e18780"],
+ ["ecb4be", "e1848ee185aae18781"],
+ ["ecb4be", "ecb4a4e18781"],
+ ["ecb4bf", "e1848ee185aae18782"],
+ ["ecb4bf", "ecb4a4e18782"],
+ ["ecb580", "e1848ee185ab"],
+ ["ecb581", "e1848ee185abe186a8"],
+ ["ecb581", "ecb580e186a8"],
+ ["ecb582", "e1848ee185abe186a9"],
+ ["ecb582", "ecb580e186a9"],
+ ["ecb583", "e1848ee185abe186aa"],
+ ["ecb583", "ecb580e186aa"],
+ ["ecb584", "e1848ee185abe186ab"],
+ ["ecb584", "ecb580e186ab"],
+ ["ecb585", "e1848ee185abe186ac"],
+ ["ecb585", "ecb580e186ac"],
+ ["ecb586", "e1848ee185abe186ad"],
+ ["ecb586", "ecb580e186ad"],
+ ["ecb587", "e1848ee185abe186ae"],
+ ["ecb587", "ecb580e186ae"],
+ ["ecb588", "e1848ee185abe186af"],
+ ["ecb588", "ecb580e186af"],
+ ["ecb589", "e1848ee185abe186b0"],
+ ["ecb589", "ecb580e186b0"],
+ ["ecb58a", "e1848ee185abe186b1"],
+ ["ecb58a", "ecb580e186b1"],
+ ["ecb58b", "e1848ee185abe186b2"],
+ ["ecb58b", "ecb580e186b2"],
+ ["ecb58c", "e1848ee185abe186b3"],
+ ["ecb58c", "ecb580e186b3"],
+ ["ecb58d", "e1848ee185abe186b4"],
+ ["ecb58d", "ecb580e186b4"],
+ ["ecb58e", "e1848ee185abe186b5"],
+ ["ecb58e", "ecb580e186b5"],
+ ["ecb58f", "e1848ee185abe186b6"],
+ ["ecb58f", "ecb580e186b6"],
+ ["ecb590", "e1848ee185abe186b7"],
+ ["ecb590", "ecb580e186b7"],
+ ["ecb591", "e1848ee185abe186b8"],
+ ["ecb591", "ecb580e186b8"],
+ ["ecb592", "e1848ee185abe186b9"],
+ ["ecb592", "ecb580e186b9"],
+ ["ecb593", "e1848ee185abe186ba"],
+ ["ecb593", "ecb580e186ba"],
+ ["ecb594", "e1848ee185abe186bb"],
+ ["ecb594", "ecb580e186bb"],
+ ["ecb595", "e1848ee185abe186bc"],
+ ["ecb595", "ecb580e186bc"],
+ ["ecb596", "e1848ee185abe186bd"],
+ ["ecb596", "ecb580e186bd"],
+ ["ecb597", "e1848ee185abe186be"],
+ ["ecb597", "ecb580e186be"],
+ ["ecb598", "e1848ee185abe186bf"],
+ ["ecb598", "ecb580e186bf"],
+ ["ecb599", "e1848ee185abe18780"],
+ ["ecb599", "ecb580e18780"],
+ ["ecb59a", "e1848ee185abe18781"],
+ ["ecb59a", "ecb580e18781"],
+ ["ecb59b", "e1848ee185abe18782"],
+ ["ecb59b", "ecb580e18782"],
+ ["ecb59c", "e1848ee185ac"],
+ ["ecb59d", "e1848ee185ace186a8"],
+ ["ecb59d", "ecb59ce186a8"],
+ ["ecb59e", "e1848ee185ace186a9"],
+ ["ecb59e", "ecb59ce186a9"],
+ ["ecb59f", "e1848ee185ace186aa"],
+ ["ecb59f", "ecb59ce186aa"],
+ ["ecb5a0", "e1848ee185ace186ab"],
+ ["ecb5a0", "ecb59ce186ab"],
+ ["ecb5a1", "e1848ee185ace186ac"],
+ ["ecb5a1", "ecb59ce186ac"],
+ ["ecb5a2", "e1848ee185ace186ad"],
+ ["ecb5a2", "ecb59ce186ad"],
+ ["ecb5a3", "e1848ee185ace186ae"],
+ ["ecb5a3", "ecb59ce186ae"],
+ ["ecb5a4", "e1848ee185ace186af"],
+ ["ecb5a4", "ecb59ce186af"],
+ ["ecb5a5", "e1848ee185ace186b0"],
+ ["ecb5a5", "ecb59ce186b0"],
+ ["ecb5a6", "e1848ee185ace186b1"],
+ ["ecb5a6", "ecb59ce186b1"],
+ ["ecb5a7", "e1848ee185ace186b2"],
+ ["ecb5a7", "ecb59ce186b2"],
+ ["ecb5a8", "e1848ee185ace186b3"],
+ ["ecb5a8", "ecb59ce186b3"],
+ ["ecb5a9", "e1848ee185ace186b4"],
+ ["ecb5a9", "ecb59ce186b4"],
+ ["ecb5aa", "e1848ee185ace186b5"],
+ ["ecb5aa", "ecb59ce186b5"],
+ ["ecb5ab", "e1848ee185ace186b6"],
+ ["ecb5ab", "ecb59ce186b6"],
+ ["ecb5ac", "e1848ee185ace186b7"],
+ ["ecb5ac", "ecb59ce186b7"],
+ ["ecb5ad", "e1848ee185ace186b8"],
+ ["ecb5ad", "ecb59ce186b8"],
+ ["ecb5ae", "e1848ee185ace186b9"],
+ ["ecb5ae", "ecb59ce186b9"],
+ ["ecb5af", "e1848ee185ace186ba"],
+ ["ecb5af", "ecb59ce186ba"],
+ ["ecb5b0", "e1848ee185ace186bb"],
+ ["ecb5b0", "ecb59ce186bb"],
+ ["ecb5b1", "e1848ee185ace186bc"],
+ ["ecb5b1", "ecb59ce186bc"],
+ ["ecb5b2", "e1848ee185ace186bd"],
+ ["ecb5b2", "ecb59ce186bd"],
+ ["ecb5b3", "e1848ee185ace186be"],
+ ["ecb5b3", "ecb59ce186be"],
+ ["ecb5b4", "e1848ee185ace186bf"],
+ ["ecb5b4", "ecb59ce186bf"],
+ ["ecb5b5", "e1848ee185ace18780"],
+ ["ecb5b5", "ecb59ce18780"],
+ ["ecb5b6", "e1848ee185ace18781"],
+ ["ecb5b6", "ecb59ce18781"],
+ ["ecb5b7", "e1848ee185ace18782"],
+ ["ecb5b7", "ecb59ce18782"],
+ ["ecb5b8", "e1848ee185ad"],
+ ["ecb5b9", "e1848ee185ade186a8"],
+ ["ecb5b9", "ecb5b8e186a8"],
+ ["ecb5ba", "e1848ee185ade186a9"],
+ ["ecb5ba", "ecb5b8e186a9"],
+ ["ecb5bb", "e1848ee185ade186aa"],
+ ["ecb5bb", "ecb5b8e186aa"],
+ ["ecb5bc", "e1848ee185ade186ab"],
+ ["ecb5bc", "ecb5b8e186ab"],
+ ["ecb5bd", "e1848ee185ade186ac"],
+ ["ecb5bd", "ecb5b8e186ac"],
+ ["ecb5be", "e1848ee185ade186ad"],
+ ["ecb5be", "ecb5b8e186ad"],
+ ["ecb5bf", "e1848ee185ade186ae"],
+ ["ecb5bf", "ecb5b8e186ae"],
+ ["ecb680", "e1848ee185ade186af"],
+ ["ecb680", "ecb5b8e186af"],
+ ["ecb681", "e1848ee185ade186b0"],
+ ["ecb681", "ecb5b8e186b0"],
+ ["ecb682", "e1848ee185ade186b1"],
+ ["ecb682", "ecb5b8e186b1"],
+ ["ecb683", "e1848ee185ade186b2"],
+ ["ecb683", "ecb5b8e186b2"],
+ ["ecb684", "e1848ee185ade186b3"],
+ ["ecb684", "ecb5b8e186b3"],
+ ["ecb685", "e1848ee185ade186b4"],
+ ["ecb685", "ecb5b8e186b4"],
+ ["ecb686", "e1848ee185ade186b5"],
+ ["ecb686", "ecb5b8e186b5"],
+ ["ecb687", "e1848ee185ade186b6"],
+ ["ecb687", "ecb5b8e186b6"],
+ ["ecb688", "e1848ee185ade186b7"],
+ ["ecb688", "ecb5b8e186b7"],
+ ["ecb689", "e1848ee185ade186b8"],
+ ["ecb689", "ecb5b8e186b8"],
+ ["ecb68a", "e1848ee185ade186b9"],
+ ["ecb68a", "ecb5b8e186b9"],
+ ["ecb68b", "e1848ee185ade186ba"],
+ ["ecb68b", "ecb5b8e186ba"],
+ ["ecb68c", "e1848ee185ade186bb"],
+ ["ecb68c", "ecb5b8e186bb"],
+ ["ecb68d", "e1848ee185ade186bc"],
+ ["ecb68d", "ecb5b8e186bc"],
+ ["ecb68e", "e1848ee185ade186bd"],
+ ["ecb68e", "ecb5b8e186bd"],
+ ["ecb68f", "e1848ee185ade186be"],
+ ["ecb68f", "ecb5b8e186be"],
+ ["ecb690", "e1848ee185ade186bf"],
+ ["ecb690", "ecb5b8e186bf"],
+ ["ecb691", "e1848ee185ade18780"],
+ ["ecb691", "ecb5b8e18780"],
+ ["ecb692", "e1848ee185ade18781"],
+ ["ecb692", "ecb5b8e18781"],
+ ["ecb693", "e1848ee185ade18782"],
+ ["ecb693", "ecb5b8e18782"],
+ ["ecb694", "e1848ee185ae"],
+ ["ecb695", "e1848ee185aee186a8"],
+ ["ecb695", "ecb694e186a8"],
+ ["ecb696", "e1848ee185aee186a9"],
+ ["ecb696", "ecb694e186a9"],
+ ["ecb697", "e1848ee185aee186aa"],
+ ["ecb697", "ecb694e186aa"],
+ ["ecb698", "e1848ee185aee186ab"],
+ ["ecb698", "ecb694e186ab"],
+ ["ecb699", "e1848ee185aee186ac"],
+ ["ecb699", "ecb694e186ac"],
+ ["ecb69a", "e1848ee185aee186ad"],
+ ["ecb69a", "ecb694e186ad"],
+ ["ecb69b", "e1848ee185aee186ae"],
+ ["ecb69b", "ecb694e186ae"],
+ ["ecb69c", "e1848ee185aee186af"],
+ ["ecb69c", "ecb694e186af"],
+ ["ecb69d", "e1848ee185aee186b0"],
+ ["ecb69d", "ecb694e186b0"],
+ ["ecb69e", "e1848ee185aee186b1"],
+ ["ecb69e", "ecb694e186b1"],
+ ["ecb69f", "e1848ee185aee186b2"],
+ ["ecb69f", "ecb694e186b2"],
+ ["ecb6a0", "e1848ee185aee186b3"],
+ ["ecb6a0", "ecb694e186b3"],
+ ["ecb6a1", "e1848ee185aee186b4"],
+ ["ecb6a1", "ecb694e186b4"],
+ ["ecb6a2", "e1848ee185aee186b5"],
+ ["ecb6a2", "ecb694e186b5"],
+ ["ecb6a3", "e1848ee185aee186b6"],
+ ["ecb6a3", "ecb694e186b6"],
+ ["ecb6a4", "e1848ee185aee186b7"],
+ ["ecb6a4", "ecb694e186b7"],
+ ["ecb6a5", "e1848ee185aee186b8"],
+ ["ecb6a5", "ecb694e186b8"],
+ ["ecb6a6", "e1848ee185aee186b9"],
+ ["ecb6a6", "ecb694e186b9"],
+ ["ecb6a7", "e1848ee185aee186ba"],
+ ["ecb6a7", "ecb694e186ba"],
+ ["ecb6a8", "e1848ee185aee186bb"],
+ ["ecb6a8", "ecb694e186bb"],
+ ["ecb6a9", "e1848ee185aee186bc"],
+ ["ecb6a9", "ecb694e186bc"],
+ ["ecb6aa", "e1848ee185aee186bd"],
+ ["ecb6aa", "ecb694e186bd"],
+ ["ecb6ab", "e1848ee185aee186be"],
+ ["ecb6ab", "ecb694e186be"],
+ ["ecb6ac", "e1848ee185aee186bf"],
+ ["ecb6ac", "ecb694e186bf"],
+ ["ecb6ad", "e1848ee185aee18780"],
+ ["ecb6ad", "ecb694e18780"],
+ ["ecb6ae", "e1848ee185aee18781"],
+ ["ecb6ae", "ecb694e18781"],
+ ["ecb6af", "e1848ee185aee18782"],
+ ["ecb6af", "ecb694e18782"],
+ ["ecb6b0", "e1848ee185af"],
+ ["ecb6b1", "e1848ee185afe186a8"],
+ ["ecb6b1", "ecb6b0e186a8"],
+ ["ecb6b2", "e1848ee185afe186a9"],
+ ["ecb6b2", "ecb6b0e186a9"],
+ ["ecb6b3", "e1848ee185afe186aa"],
+ ["ecb6b3", "ecb6b0e186aa"],
+ ["ecb6b4", "e1848ee185afe186ab"],
+ ["ecb6b4", "ecb6b0e186ab"],
+ ["ecb6b5", "e1848ee185afe186ac"],
+ ["ecb6b5", "ecb6b0e186ac"],
+ ["ecb6b6", "e1848ee185afe186ad"],
+ ["ecb6b6", "ecb6b0e186ad"],
+ ["ecb6b7", "e1848ee185afe186ae"],
+ ["ecb6b7", "ecb6b0e186ae"],
+ ["ecb6b8", "e1848ee185afe186af"],
+ ["ecb6b8", "ecb6b0e186af"],
+ ["ecb6b9", "e1848ee185afe186b0"],
+ ["ecb6b9", "ecb6b0e186b0"],
+ ["ecb6ba", "e1848ee185afe186b1"],
+ ["ecb6ba", "ecb6b0e186b1"],
+ ["ecb6bb", "e1848ee185afe186b2"],
+ ["ecb6bb", "ecb6b0e186b2"],
+ ["ecb6bc", "e1848ee185afe186b3"],
+ ["ecb6bc", "ecb6b0e186b3"],
+ ["ecb6bd", "e1848ee185afe186b4"],
+ ["ecb6bd", "ecb6b0e186b4"],
+ ["ecb6be", "e1848ee185afe186b5"],
+ ["ecb6be", "ecb6b0e186b5"],
+ ["ecb6bf", "e1848ee185afe186b6"],
+ ["ecb6bf", "ecb6b0e186b6"],
+ ["ecb780", "e1848ee185afe186b7"],
+ ["ecb780", "ecb6b0e186b7"],
+ ["ecb781", "e1848ee185afe186b8"],
+ ["ecb781", "ecb6b0e186b8"],
+ ["ecb782", "e1848ee185afe186b9"],
+ ["ecb782", "ecb6b0e186b9"],
+ ["ecb783", "e1848ee185afe186ba"],
+ ["ecb783", "ecb6b0e186ba"],
+ ["ecb784", "e1848ee185afe186bb"],
+ ["ecb784", "ecb6b0e186bb"],
+ ["ecb785", "e1848ee185afe186bc"],
+ ["ecb785", "ecb6b0e186bc"],
+ ["ecb786", "e1848ee185afe186bd"],
+ ["ecb786", "ecb6b0e186bd"],
+ ["ecb787", "e1848ee185afe186be"],
+ ["ecb787", "ecb6b0e186be"],
+ ["ecb788", "e1848ee185afe186bf"],
+ ["ecb788", "ecb6b0e186bf"],
+ ["ecb789", "e1848ee185afe18780"],
+ ["ecb789", "ecb6b0e18780"],
+ ["ecb78a", "e1848ee185afe18781"],
+ ["ecb78a", "ecb6b0e18781"],
+ ["ecb78b", "e1848ee185afe18782"],
+ ["ecb78b", "ecb6b0e18782"],
+ ["ecb78c", "e1848ee185b0"],
+ ["ecb78d", "e1848ee185b0e186a8"],
+ ["ecb78d", "ecb78ce186a8"],
+ ["ecb78e", "e1848ee185b0e186a9"],
+ ["ecb78e", "ecb78ce186a9"],
+ ["ecb78f", "e1848ee185b0e186aa"],
+ ["ecb78f", "ecb78ce186aa"],
+ ["ecb790", "e1848ee185b0e186ab"],
+ ["ecb790", "ecb78ce186ab"],
+ ["ecb791", "e1848ee185b0e186ac"],
+ ["ecb791", "ecb78ce186ac"],
+ ["ecb792", "e1848ee185b0e186ad"],
+ ["ecb792", "ecb78ce186ad"],
+ ["ecb793", "e1848ee185b0e186ae"],
+ ["ecb793", "ecb78ce186ae"],
+ ["ecb794", "e1848ee185b0e186af"],
+ ["ecb794", "ecb78ce186af"],
+ ["ecb795", "e1848ee185b0e186b0"],
+ ["ecb795", "ecb78ce186b0"],
+ ["ecb796", "e1848ee185b0e186b1"],
+ ["ecb796", "ecb78ce186b1"],
+ ["ecb797", "e1848ee185b0e186b2"],
+ ["ecb797", "ecb78ce186b2"],
+ ["ecb798", "e1848ee185b0e186b3"],
+ ["ecb798", "ecb78ce186b3"],
+ ["ecb799", "e1848ee185b0e186b4"],
+ ["ecb799", "ecb78ce186b4"],
+ ["ecb79a", "e1848ee185b0e186b5"],
+ ["ecb79a", "ecb78ce186b5"],
+ ["ecb79b", "e1848ee185b0e186b6"],
+ ["ecb79b", "ecb78ce186b6"],
+ ["ecb79c", "e1848ee185b0e186b7"],
+ ["ecb79c", "ecb78ce186b7"],
+ ["ecb79d", "e1848ee185b0e186b8"],
+ ["ecb79d", "ecb78ce186b8"],
+ ["ecb79e", "e1848ee185b0e186b9"],
+ ["ecb79e", "ecb78ce186b9"],
+ ["ecb79f", "e1848ee185b0e186ba"],
+ ["ecb79f", "ecb78ce186ba"],
+ ["ecb7a0", "e1848ee185b0e186bb"],
+ ["ecb7a0", "ecb78ce186bb"],
+ ["ecb7a1", "e1848ee185b0e186bc"],
+ ["ecb7a1", "ecb78ce186bc"],
+ ["ecb7a2", "e1848ee185b0e186bd"],
+ ["ecb7a2", "ecb78ce186bd"],
+ ["ecb7a3", "e1848ee185b0e186be"],
+ ["ecb7a3", "ecb78ce186be"],
+ ["ecb7a4", "e1848ee185b0e186bf"],
+ ["ecb7a4", "ecb78ce186bf"],
+ ["ecb7a5", "e1848ee185b0e18780"],
+ ["ecb7a5", "ecb78ce18780"],
+ ["ecb7a6", "e1848ee185b0e18781"],
+ ["ecb7a6", "ecb78ce18781"],
+ ["ecb7a7", "e1848ee185b0e18782"],
+ ["ecb7a7", "ecb78ce18782"],
+ ["ecb7a8", "e1848ee185b1"],
+ ["ecb7a9", "e1848ee185b1e186a8"],
+ ["ecb7a9", "ecb7a8e186a8"],
+ ["ecb7aa", "e1848ee185b1e186a9"],
+ ["ecb7aa", "ecb7a8e186a9"],
+ ["ecb7ab", "e1848ee185b1e186aa"],
+ ["ecb7ab", "ecb7a8e186aa"],
+ ["ecb7ac", "e1848ee185b1e186ab"],
+ ["ecb7ac", "ecb7a8e186ab"],
+ ["ecb7ad", "e1848ee185b1e186ac"],
+ ["ecb7ad", "ecb7a8e186ac"],
+ ["ecb7ae", "e1848ee185b1e186ad"],
+ ["ecb7ae", "ecb7a8e186ad"],
+ ["ecb7af", "e1848ee185b1e186ae"],
+ ["ecb7af", "ecb7a8e186ae"],
+ ["ecb7b0", "e1848ee185b1e186af"],
+ ["ecb7b0", "ecb7a8e186af"],
+ ["ecb7b1", "e1848ee185b1e186b0"],
+ ["ecb7b1", "ecb7a8e186b0"],
+ ["ecb7b2", "e1848ee185b1e186b1"],
+ ["ecb7b2", "ecb7a8e186b1"],
+ ["ecb7b3", "e1848ee185b1e186b2"],
+ ["ecb7b3", "ecb7a8e186b2"],
+ ["ecb7b4", "e1848ee185b1e186b3"],
+ ["ecb7b4", "ecb7a8e186b3"],
+ ["ecb7b5", "e1848ee185b1e186b4"],
+ ["ecb7b5", "ecb7a8e186b4"],
+ ["ecb7b6", "e1848ee185b1e186b5"],
+ ["ecb7b6", "ecb7a8e186b5"],
+ ["ecb7b7", "e1848ee185b1e186b6"],
+ ["ecb7b7", "ecb7a8e186b6"],
+ ["ecb7b8", "e1848ee185b1e186b7"],
+ ["ecb7b8", "ecb7a8e186b7"],
+ ["ecb7b9", "e1848ee185b1e186b8"],
+ ["ecb7b9", "ecb7a8e186b8"],
+ ["ecb7ba", "e1848ee185b1e186b9"],
+ ["ecb7ba", "ecb7a8e186b9"],
+ ["ecb7bb", "e1848ee185b1e186ba"],
+ ["ecb7bb", "ecb7a8e186ba"],
+ ["ecb7bc", "e1848ee185b1e186bb"],
+ ["ecb7bc", "ecb7a8e186bb"],
+ ["ecb7bd", "e1848ee185b1e186bc"],
+ ["ecb7bd", "ecb7a8e186bc"],
+ ["ecb7be", "e1848ee185b1e186bd"],
+ ["ecb7be", "ecb7a8e186bd"],
+ ["ecb7bf", "e1848ee185b1e186be"],
+ ["ecb7bf", "ecb7a8e186be"],
+ ["ecb880", "e1848ee185b1e186bf"],
+ ["ecb880", "ecb7a8e186bf"],
+ ["ecb881", "e1848ee185b1e18780"],
+ ["ecb881", "ecb7a8e18780"],
+ ["ecb882", "e1848ee185b1e18781"],
+ ["ecb882", "ecb7a8e18781"],
+ ["ecb883", "e1848ee185b1e18782"],
+ ["ecb883", "ecb7a8e18782"],
+ ["ecb884", "e1848ee185b2"],
+ ["ecb885", "e1848ee185b2e186a8"],
+ ["ecb885", "ecb884e186a8"],
+ ["ecb886", "e1848ee185b2e186a9"],
+ ["ecb886", "ecb884e186a9"],
+ ["ecb887", "e1848ee185b2e186aa"],
+ ["ecb887", "ecb884e186aa"],
+ ["ecb888", "e1848ee185b2e186ab"],
+ ["ecb888", "ecb884e186ab"],
+ ["ecb889", "e1848ee185b2e186ac"],
+ ["ecb889", "ecb884e186ac"],
+ ["ecb88a", "e1848ee185b2e186ad"],
+ ["ecb88a", "ecb884e186ad"],
+ ["ecb88b", "e1848ee185b2e186ae"],
+ ["ecb88b", "ecb884e186ae"],
+ ["ecb88c", "e1848ee185b2e186af"],
+ ["ecb88c", "ecb884e186af"],
+ ["ecb88d", "e1848ee185b2e186b0"],
+ ["ecb88d", "ecb884e186b0"],
+ ["ecb88e", "e1848ee185b2e186b1"],
+ ["ecb88e", "ecb884e186b1"],
+ ["ecb88f", "e1848ee185b2e186b2"],
+ ["ecb88f", "ecb884e186b2"],
+ ["ecb890", "e1848ee185b2e186b3"],
+ ["ecb890", "ecb884e186b3"],
+ ["ecb891", "e1848ee185b2e186b4"],
+ ["ecb891", "ecb884e186b4"],
+ ["ecb892", "e1848ee185b2e186b5"],
+ ["ecb892", "ecb884e186b5"],
+ ["ecb893", "e1848ee185b2e186b6"],
+ ["ecb893", "ecb884e186b6"],
+ ["ecb894", "e1848ee185b2e186b7"],
+ ["ecb894", "ecb884e186b7"],
+ ["ecb895", "e1848ee185b2e186b8"],
+ ["ecb895", "ecb884e186b8"],
+ ["ecb896", "e1848ee185b2e186b9"],
+ ["ecb896", "ecb884e186b9"],
+ ["ecb897", "e1848ee185b2e186ba"],
+ ["ecb897", "ecb884e186ba"],
+ ["ecb898", "e1848ee185b2e186bb"],
+ ["ecb898", "ecb884e186bb"],
+ ["ecb899", "e1848ee185b2e186bc"],
+ ["ecb899", "ecb884e186bc"],
+ ["ecb89a", "e1848ee185b2e186bd"],
+ ["ecb89a", "ecb884e186bd"],
+ ["ecb89b", "e1848ee185b2e186be"],
+ ["ecb89b", "ecb884e186be"],
+ ["ecb89c", "e1848ee185b2e186bf"],
+ ["ecb89c", "ecb884e186bf"],
+ ["ecb89d", "e1848ee185b2e18780"],
+ ["ecb89d", "ecb884e18780"],
+ ["ecb89e", "e1848ee185b2e18781"],
+ ["ecb89e", "ecb884e18781"],
+ ["ecb89f", "e1848ee185b2e18782"],
+ ["ecb89f", "ecb884e18782"],
+ ["ecb8a0", "e1848ee185b3"],
+ ["ecb8a1", "e1848ee185b3e186a8"],
+ ["ecb8a1", "ecb8a0e186a8"],
+ ["ecb8a2", "e1848ee185b3e186a9"],
+ ["ecb8a2", "ecb8a0e186a9"],
+ ["ecb8a3", "e1848ee185b3e186aa"],
+ ["ecb8a3", "ecb8a0e186aa"],
+ ["ecb8a4", "e1848ee185b3e186ab"],
+ ["ecb8a4", "ecb8a0e186ab"],
+ ["ecb8a5", "e1848ee185b3e186ac"],
+ ["ecb8a5", "ecb8a0e186ac"],
+ ["ecb8a6", "e1848ee185b3e186ad"],
+ ["ecb8a6", "ecb8a0e186ad"],
+ ["ecb8a7", "e1848ee185b3e186ae"],
+ ["ecb8a7", "ecb8a0e186ae"],
+ ["ecb8a8", "e1848ee185b3e186af"],
+ ["ecb8a8", "ecb8a0e186af"],
+ ["ecb8a9", "e1848ee185b3e186b0"],
+ ["ecb8a9", "ecb8a0e186b0"],
+ ["ecb8aa", "e1848ee185b3e186b1"],
+ ["ecb8aa", "ecb8a0e186b1"],
+ ["ecb8ab", "e1848ee185b3e186b2"],
+ ["ecb8ab", "ecb8a0e186b2"],
+ ["ecb8ac", "e1848ee185b3e186b3"],
+ ["ecb8ac", "ecb8a0e186b3"],
+ ["ecb8ad", "e1848ee185b3e186b4"],
+ ["ecb8ad", "ecb8a0e186b4"],
+ ["ecb8ae", "e1848ee185b3e186b5"],
+ ["ecb8ae", "ecb8a0e186b5"],
+ ["ecb8af", "e1848ee185b3e186b6"],
+ ["ecb8af", "ecb8a0e186b6"],
+ ["ecb8b0", "e1848ee185b3e186b7"],
+ ["ecb8b0", "ecb8a0e186b7"],
+ ["ecb8b1", "e1848ee185b3e186b8"],
+ ["ecb8b1", "ecb8a0e186b8"],
+ ["ecb8b2", "e1848ee185b3e186b9"],
+ ["ecb8b2", "ecb8a0e186b9"],
+ ["ecb8b3", "e1848ee185b3e186ba"],
+ ["ecb8b3", "ecb8a0e186ba"],
+ ["ecb8b4", "e1848ee185b3e186bb"],
+ ["ecb8b4", "ecb8a0e186bb"],
+ ["ecb8b5", "e1848ee185b3e186bc"],
+ ["ecb8b5", "ecb8a0e186bc"],
+ ["ecb8b6", "e1848ee185b3e186bd"],
+ ["ecb8b6", "ecb8a0e186bd"],
+ ["ecb8b7", "e1848ee185b3e186be"],
+ ["ecb8b7", "ecb8a0e186be"],
+ ["ecb8b8", "e1848ee185b3e186bf"],
+ ["ecb8b8", "ecb8a0e186bf"],
+ ["ecb8b9", "e1848ee185b3e18780"],
+ ["ecb8b9", "ecb8a0e18780"],
+ ["ecb8ba", "e1848ee185b3e18781"],
+ ["ecb8ba", "ecb8a0e18781"],
+ ["ecb8bb", "e1848ee185b3e18782"],
+ ["ecb8bb", "ecb8a0e18782"],
+ ["ecb8bc", "e1848ee185b4"],
+ ["ecb8bd", "e1848ee185b4e186a8"],
+ ["ecb8bd", "ecb8bce186a8"],
+ ["ecb8be", "e1848ee185b4e186a9"],
+ ["ecb8be", "ecb8bce186a9"],
+ ["ecb8bf", "e1848ee185b4e186aa"],
+ ["ecb8bf", "ecb8bce186aa"],
+ ["ecb980", "e1848ee185b4e186ab"],
+ ["ecb980", "ecb8bce186ab"],
+ ["ecb981", "e1848ee185b4e186ac"],
+ ["ecb981", "ecb8bce186ac"],
+ ["ecb982", "e1848ee185b4e186ad"],
+ ["ecb982", "ecb8bce186ad"],
+ ["ecb983", "e1848ee185b4e186ae"],
+ ["ecb983", "ecb8bce186ae"],
+ ["ecb984", "e1848ee185b4e186af"],
+ ["ecb984", "ecb8bce186af"],
+ ["ecb985", "e1848ee185b4e186b0"],
+ ["ecb985", "ecb8bce186b0"],
+ ["ecb986", "e1848ee185b4e186b1"],
+ ["ecb986", "ecb8bce186b1"],
+ ["ecb987", "e1848ee185b4e186b2"],
+ ["ecb987", "ecb8bce186b2"],
+ ["ecb988", "e1848ee185b4e186b3"],
+ ["ecb988", "ecb8bce186b3"],
+ ["ecb989", "e1848ee185b4e186b4"],
+ ["ecb989", "ecb8bce186b4"],
+ ["ecb98a", "e1848ee185b4e186b5"],
+ ["ecb98a", "ecb8bce186b5"],
+ ["ecb98b", "e1848ee185b4e186b6"],
+ ["ecb98b", "ecb8bce186b6"],
+ ["ecb98c", "e1848ee185b4e186b7"],
+ ["ecb98c", "ecb8bce186b7"],
+ ["ecb98d", "e1848ee185b4e186b8"],
+ ["ecb98d", "ecb8bce186b8"],
+ ["ecb98e", "e1848ee185b4e186b9"],
+ ["ecb98e", "ecb8bce186b9"],
+ ["ecb98f", "e1848ee185b4e186ba"],
+ ["ecb98f", "ecb8bce186ba"],
+ ["ecb990", "e1848ee185b4e186bb"],
+ ["ecb990", "ecb8bce186bb"],
+ ["ecb991", "e1848ee185b4e186bc"],
+ ["ecb991", "ecb8bce186bc"],
+ ["ecb992", "e1848ee185b4e186bd"],
+ ["ecb992", "ecb8bce186bd"],
+ ["ecb993", "e1848ee185b4e186be"],
+ ["ecb993", "ecb8bce186be"],
+ ["ecb994", "e1848ee185b4e186bf"],
+ ["ecb994", "ecb8bce186bf"],
+ ["ecb995", "e1848ee185b4e18780"],
+ ["ecb995", "ecb8bce18780"],
+ ["ecb996", "e1848ee185b4e18781"],
+ ["ecb996", "ecb8bce18781"],
+ ["ecb997", "e1848ee185b4e18782"],
+ ["ecb997", "ecb8bce18782"],
+ ["ecb998", "e1848ee185b5"],
+ ["ecb999", "e1848ee185b5e186a8"],
+ ["ecb999", "ecb998e186a8"],
+ ["ecb99a", "e1848ee185b5e186a9"],
+ ["ecb99a", "ecb998e186a9"],
+ ["ecb99b", "e1848ee185b5e186aa"],
+ ["ecb99b", "ecb998e186aa"],
+ ["ecb99c", "e1848ee185b5e186ab"],
+ ["ecb99c", "ecb998e186ab"],
+ ["ecb99d", "e1848ee185b5e186ac"],
+ ["ecb99d", "ecb998e186ac"],
+ ["ecb99e", "e1848ee185b5e186ad"],
+ ["ecb99e", "ecb998e186ad"],
+ ["ecb99f", "e1848ee185b5e186ae"],
+ ["ecb99f", "ecb998e186ae"],
+ ["ecb9a0", "e1848ee185b5e186af"],
+ ["ecb9a0", "ecb998e186af"],
+ ["ecb9a1", "e1848ee185b5e186b0"],
+ ["ecb9a1", "ecb998e186b0"],
+ ["ecb9a2", "e1848ee185b5e186b1"],
+ ["ecb9a2", "ecb998e186b1"],
+ ["ecb9a3", "e1848ee185b5e186b2"],
+ ["ecb9a3", "ecb998e186b2"],
+ ["ecb9a4", "e1848ee185b5e186b3"],
+ ["ecb9a4", "ecb998e186b3"],
+ ["ecb9a5", "e1848ee185b5e186b4"],
+ ["ecb9a5", "ecb998e186b4"],
+ ["ecb9a6", "e1848ee185b5e186b5"],
+ ["ecb9a6", "ecb998e186b5"],
+ ["ecb9a7", "e1848ee185b5e186b6"],
+ ["ecb9a7", "ecb998e186b6"],
+ ["ecb9a8", "e1848ee185b5e186b7"],
+ ["ecb9a8", "ecb998e186b7"],
+ ["ecb9a9", "e1848ee185b5e186b8"],
+ ["ecb9a9", "ecb998e186b8"],
+ ["ecb9aa", "e1848ee185b5e186b9"],
+ ["ecb9aa", "ecb998e186b9"],
+ ["ecb9ab", "e1848ee185b5e186ba"],
+ ["ecb9ab", "ecb998e186ba"],
+ ["ecb9ac", "e1848ee185b5e186bb"],
+ ["ecb9ac", "ecb998e186bb"],
+ ["ecb9ad", "e1848ee185b5e186bc"],
+ ["ecb9ad", "ecb998e186bc"],
+ ["ecb9ae", "e1848ee185b5e186bd"],
+ ["ecb9ae", "ecb998e186bd"],
+ ["ecb9af", "e1848ee185b5e186be"],
+ ["ecb9af", "ecb998e186be"],
+ ["ecb9b0", "e1848ee185b5e186bf"],
+ ["ecb9b0", "ecb998e186bf"],
+ ["ecb9b1", "e1848ee185b5e18780"],
+ ["ecb9b1", "ecb998e18780"],
+ ["ecb9b2", "e1848ee185b5e18781"],
+ ["ecb9b2", "ecb998e18781"],
+ ["ecb9b3", "e1848ee185b5e18782"],
+ ["ecb9b3", "ecb998e18782"],
+ ["ecb9b4", "e1848fe185a1"],
+ ["ecb9b5", "e1848fe185a1e186a8"],
+ ["ecb9b5", "ecb9b4e186a8"],
+ ["ecb9b6", "e1848fe185a1e186a9"],
+ ["ecb9b6", "ecb9b4e186a9"],
+ ["ecb9b7", "e1848fe185a1e186aa"],
+ ["ecb9b7", "ecb9b4e186aa"],
+ ["ecb9b8", "e1848fe185a1e186ab"],
+ ["ecb9b8", "ecb9b4e186ab"],
+ ["ecb9b9", "e1848fe185a1e186ac"],
+ ["ecb9b9", "ecb9b4e186ac"],
+ ["ecb9ba", "e1848fe185a1e186ad"],
+ ["ecb9ba", "ecb9b4e186ad"],
+ ["ecb9bb", "e1848fe185a1e186ae"],
+ ["ecb9bb", "ecb9b4e186ae"],
+ ["ecb9bc", "e1848fe185a1e186af"],
+ ["ecb9bc", "ecb9b4e186af"],
+ ["ecb9bd", "e1848fe185a1e186b0"],
+ ["ecb9bd", "ecb9b4e186b0"],
+ ["ecb9be", "e1848fe185a1e186b1"],
+ ["ecb9be", "ecb9b4e186b1"],
+ ["ecb9bf", "e1848fe185a1e186b2"],
+ ["ecb9bf", "ecb9b4e186b2"],
+ ["ecba80", "e1848fe185a1e186b3"],
+ ["ecba80", "ecb9b4e186b3"],
+ ["ecba81", "e1848fe185a1e186b4"],
+ ["ecba81", "ecb9b4e186b4"],
+ ["ecba82", "e1848fe185a1e186b5"],
+ ["ecba82", "ecb9b4e186b5"],
+ ["ecba83", "e1848fe185a1e186b6"],
+ ["ecba83", "ecb9b4e186b6"],
+ ["ecba84", "e1848fe185a1e186b7"],
+ ["ecba84", "ecb9b4e186b7"],
+ ["ecba85", "e1848fe185a1e186b8"],
+ ["ecba85", "ecb9b4e186b8"],
+ ["ecba86", "e1848fe185a1e186b9"],
+ ["ecba86", "ecb9b4e186b9"],
+ ["ecba87", "e1848fe185a1e186ba"],
+ ["ecba87", "ecb9b4e186ba"],
+ ["ecba88", "e1848fe185a1e186bb"],
+ ["ecba88", "ecb9b4e186bb"],
+ ["ecba89", "e1848fe185a1e186bc"],
+ ["ecba89", "ecb9b4e186bc"],
+ ["ecba8a", "e1848fe185a1e186bd"],
+ ["ecba8a", "ecb9b4e186bd"],
+ ["ecba8b", "e1848fe185a1e186be"],
+ ["ecba8b", "ecb9b4e186be"],
+ ["ecba8c", "e1848fe185a1e186bf"],
+ ["ecba8c", "ecb9b4e186bf"],
+ ["ecba8d", "e1848fe185a1e18780"],
+ ["ecba8d", "ecb9b4e18780"],
+ ["ecba8e", "e1848fe185a1e18781"],
+ ["ecba8e", "ecb9b4e18781"],
+ ["ecba8f", "e1848fe185a1e18782"],
+ ["ecba8f", "ecb9b4e18782"],
+ ["ecba90", "e1848fe185a2"],
+ ["ecba91", "e1848fe185a2e186a8"],
+ ["ecba91", "ecba90e186a8"],
+ ["ecba92", "e1848fe185a2e186a9"],
+ ["ecba92", "ecba90e186a9"],
+ ["ecba93", "e1848fe185a2e186aa"],
+ ["ecba93", "ecba90e186aa"],
+ ["ecba94", "e1848fe185a2e186ab"],
+ ["ecba94", "ecba90e186ab"],
+ ["ecba95", "e1848fe185a2e186ac"],
+ ["ecba95", "ecba90e186ac"],
+ ["ecba96", "e1848fe185a2e186ad"],
+ ["ecba96", "ecba90e186ad"],
+ ["ecba97", "e1848fe185a2e186ae"],
+ ["ecba97", "ecba90e186ae"],
+ ["ecba98", "e1848fe185a2e186af"],
+ ["ecba98", "ecba90e186af"],
+ ["ecba99", "e1848fe185a2e186b0"],
+ ["ecba99", "ecba90e186b0"],
+ ["ecba9a", "e1848fe185a2e186b1"],
+ ["ecba9a", "ecba90e186b1"],
+ ["ecba9b", "e1848fe185a2e186b2"],
+ ["ecba9b", "ecba90e186b2"],
+ ["ecba9c", "e1848fe185a2e186b3"],
+ ["ecba9c", "ecba90e186b3"],
+ ["ecba9d", "e1848fe185a2e186b4"],
+ ["ecba9d", "ecba90e186b4"],
+ ["ecba9e", "e1848fe185a2e186b5"],
+ ["ecba9e", "ecba90e186b5"],
+ ["ecba9f", "e1848fe185a2e186b6"],
+ ["ecba9f", "ecba90e186b6"],
+ ["ecbaa0", "e1848fe185a2e186b7"],
+ ["ecbaa0", "ecba90e186b7"],
+ ["ecbaa1", "e1848fe185a2e186b8"],
+ ["ecbaa1", "ecba90e186b8"],
+ ["ecbaa2", "e1848fe185a2e186b9"],
+ ["ecbaa2", "ecba90e186b9"],
+ ["ecbaa3", "e1848fe185a2e186ba"],
+ ["ecbaa3", "ecba90e186ba"],
+ ["ecbaa4", "e1848fe185a2e186bb"],
+ ["ecbaa4", "ecba90e186bb"],
+ ["ecbaa5", "e1848fe185a2e186bc"],
+ ["ecbaa5", "ecba90e186bc"],
+ ["ecbaa6", "e1848fe185a2e186bd"],
+ ["ecbaa6", "ecba90e186bd"],
+ ["ecbaa7", "e1848fe185a2e186be"],
+ ["ecbaa7", "ecba90e186be"],
+ ["ecbaa8", "e1848fe185a2e186bf"],
+ ["ecbaa8", "ecba90e186bf"],
+ ["ecbaa9", "e1848fe185a2e18780"],
+ ["ecbaa9", "ecba90e18780"],
+ ["ecbaaa", "e1848fe185a2e18781"],
+ ["ecbaaa", "ecba90e18781"],
+ ["ecbaab", "e1848fe185a2e18782"],
+ ["ecbaab", "ecba90e18782"],
+ ["ecbaac", "e1848fe185a3"],
+ ["ecbaad", "e1848fe185a3e186a8"],
+ ["ecbaad", "ecbaace186a8"],
+ ["ecbaae", "e1848fe185a3e186a9"],
+ ["ecbaae", "ecbaace186a9"],
+ ["ecbaaf", "e1848fe185a3e186aa"],
+ ["ecbaaf", "ecbaace186aa"],
+ ["ecbab0", "e1848fe185a3e186ab"],
+ ["ecbab0", "ecbaace186ab"],
+ ["ecbab1", "e1848fe185a3e186ac"],
+ ["ecbab1", "ecbaace186ac"],
+ ["ecbab2", "e1848fe185a3e186ad"],
+ ["ecbab2", "ecbaace186ad"],
+ ["ecbab3", "e1848fe185a3e186ae"],
+ ["ecbab3", "ecbaace186ae"],
+ ["ecbab4", "e1848fe185a3e186af"],
+ ["ecbab4", "ecbaace186af"],
+ ["ecbab5", "e1848fe185a3e186b0"],
+ ["ecbab5", "ecbaace186b0"],
+ ["ecbab6", "e1848fe185a3e186b1"],
+ ["ecbab6", "ecbaace186b1"],
+ ["ecbab7", "e1848fe185a3e186b2"],
+ ["ecbab7", "ecbaace186b2"],
+ ["ecbab8", "e1848fe185a3e186b3"],
+ ["ecbab8", "ecbaace186b3"],
+ ["ecbab9", "e1848fe185a3e186b4"],
+ ["ecbab9", "ecbaace186b4"],
+ ["ecbaba", "e1848fe185a3e186b5"],
+ ["ecbaba", "ecbaace186b5"],
+ ["ecbabb", "e1848fe185a3e186b6"],
+ ["ecbabb", "ecbaace186b6"],
+ ["ecbabc", "e1848fe185a3e186b7"],
+ ["ecbabc", "ecbaace186b7"],
+ ["ecbabd", "e1848fe185a3e186b8"],
+ ["ecbabd", "ecbaace186b8"],
+ ["ecbabe", "e1848fe185a3e186b9"],
+ ["ecbabe", "ecbaace186b9"],
+ ["ecbabf", "e1848fe185a3e186ba"],
+ ["ecbabf", "ecbaace186ba"],
+ ["ecbb80", "e1848fe185a3e186bb"],
+ ["ecbb80", "ecbaace186bb"],
+ ["ecbb81", "e1848fe185a3e186bc"],
+ ["ecbb81", "ecbaace186bc"],
+ ["ecbb82", "e1848fe185a3e186bd"],
+ ["ecbb82", "ecbaace186bd"],
+ ["ecbb83", "e1848fe185a3e186be"],
+ ["ecbb83", "ecbaace186be"],
+ ["ecbb84", "e1848fe185a3e186bf"],
+ ["ecbb84", "ecbaace186bf"],
+ ["ecbb85", "e1848fe185a3e18780"],
+ ["ecbb85", "ecbaace18780"],
+ ["ecbb86", "e1848fe185a3e18781"],
+ ["ecbb86", "ecbaace18781"],
+ ["ecbb87", "e1848fe185a3e18782"],
+ ["ecbb87", "ecbaace18782"],
+ ["ecbb88", "e1848fe185a4"],
+ ["ecbb89", "e1848fe185a4e186a8"],
+ ["ecbb89", "ecbb88e186a8"],
+ ["ecbb8a", "e1848fe185a4e186a9"],
+ ["ecbb8a", "ecbb88e186a9"],
+ ["ecbb8b", "e1848fe185a4e186aa"],
+ ["ecbb8b", "ecbb88e186aa"],
+ ["ecbb8c", "e1848fe185a4e186ab"],
+ ["ecbb8c", "ecbb88e186ab"],
+ ["ecbb8d", "e1848fe185a4e186ac"],
+ ["ecbb8d", "ecbb88e186ac"],
+ ["ecbb8e", "e1848fe185a4e186ad"],
+ ["ecbb8e", "ecbb88e186ad"],
+ ["ecbb8f", "e1848fe185a4e186ae"],
+ ["ecbb8f", "ecbb88e186ae"],
+ ["ecbb90", "e1848fe185a4e186af"],
+ ["ecbb90", "ecbb88e186af"],
+ ["ecbb91", "e1848fe185a4e186b0"],
+ ["ecbb91", "ecbb88e186b0"],
+ ["ecbb92", "e1848fe185a4e186b1"],
+ ["ecbb92", "ecbb88e186b1"],
+ ["ecbb93", "e1848fe185a4e186b2"],
+ ["ecbb93", "ecbb88e186b2"],
+ ["ecbb94", "e1848fe185a4e186b3"],
+ ["ecbb94", "ecbb88e186b3"],
+ ["ecbb95", "e1848fe185a4e186b4"],
+ ["ecbb95", "ecbb88e186b4"],
+ ["ecbb96", "e1848fe185a4e186b5"],
+ ["ecbb96", "ecbb88e186b5"],
+ ["ecbb97", "e1848fe185a4e186b6"],
+ ["ecbb97", "ecbb88e186b6"],
+ ["ecbb98", "e1848fe185a4e186b7"],
+ ["ecbb98", "ecbb88e186b7"],
+ ["ecbb99", "e1848fe185a4e186b8"],
+ ["ecbb99", "ecbb88e186b8"],
+ ["ecbb9a", "e1848fe185a4e186b9"],
+ ["ecbb9a", "ecbb88e186b9"],
+ ["ecbb9b", "e1848fe185a4e186ba"],
+ ["ecbb9b", "ecbb88e186ba"],
+ ["ecbb9c", "e1848fe185a4e186bb"],
+ ["ecbb9c", "ecbb88e186bb"],
+ ["ecbb9d", "e1848fe185a4e186bc"],
+ ["ecbb9d", "ecbb88e186bc"],
+ ["ecbb9e", "e1848fe185a4e186bd"],
+ ["ecbb9e", "ecbb88e186bd"],
+ ["ecbb9f", "e1848fe185a4e186be"],
+ ["ecbb9f", "ecbb88e186be"],
+ ["ecbba0", "e1848fe185a4e186bf"],
+ ["ecbba0", "ecbb88e186bf"],
+ ["ecbba1", "e1848fe185a4e18780"],
+ ["ecbba1", "ecbb88e18780"],
+ ["ecbba2", "e1848fe185a4e18781"],
+ ["ecbba2", "ecbb88e18781"],
+ ["ecbba3", "e1848fe185a4e18782"],
+ ["ecbba3", "ecbb88e18782"],
+ ["ecbba4", "e1848fe185a5"],
+ ["ecbba5", "e1848fe185a5e186a8"],
+ ["ecbba5", "ecbba4e186a8"],
+ ["ecbba6", "e1848fe185a5e186a9"],
+ ["ecbba6", "ecbba4e186a9"],
+ ["ecbba7", "e1848fe185a5e186aa"],
+ ["ecbba7", "ecbba4e186aa"],
+ ["ecbba8", "e1848fe185a5e186ab"],
+ ["ecbba8", "ecbba4e186ab"],
+ ["ecbba9", "e1848fe185a5e186ac"],
+ ["ecbba9", "ecbba4e186ac"],
+ ["ecbbaa", "e1848fe185a5e186ad"],
+ ["ecbbaa", "ecbba4e186ad"],
+ ["ecbbab", "e1848fe185a5e186ae"],
+ ["ecbbab", "ecbba4e186ae"],
+ ["ecbbac", "e1848fe185a5e186af"],
+ ["ecbbac", "ecbba4e186af"],
+ ["ecbbad", "e1848fe185a5e186b0"],
+ ["ecbbad", "ecbba4e186b0"],
+ ["ecbbae", "e1848fe185a5e186b1"],
+ ["ecbbae", "ecbba4e186b1"],
+ ["ecbbaf", "e1848fe185a5e186b2"],
+ ["ecbbaf", "ecbba4e186b2"],
+ ["ecbbb0", "e1848fe185a5e186b3"],
+ ["ecbbb0", "ecbba4e186b3"],
+ ["ecbbb1", "e1848fe185a5e186b4"],
+ ["ecbbb1", "ecbba4e186b4"],
+ ["ecbbb2", "e1848fe185a5e186b5"],
+ ["ecbbb2", "ecbba4e186b5"],
+ ["ecbbb3", "e1848fe185a5e186b6"],
+ ["ecbbb3", "ecbba4e186b6"],
+ ["ecbbb4", "e1848fe185a5e186b7"],
+ ["ecbbb4", "ecbba4e186b7"],
+ ["ecbbb5", "e1848fe185a5e186b8"],
+ ["ecbbb5", "ecbba4e186b8"],
+ ["ecbbb6", "e1848fe185a5e186b9"],
+ ["ecbbb6", "ecbba4e186b9"],
+ ["ecbbb7", "e1848fe185a5e186ba"],
+ ["ecbbb7", "ecbba4e186ba"],
+ ["ecbbb8", "e1848fe185a5e186bb"],
+ ["ecbbb8", "ecbba4e186bb"],
+ ["ecbbb9", "e1848fe185a5e186bc"],
+ ["ecbbb9", "ecbba4e186bc"],
+ ["ecbbba", "e1848fe185a5e186bd"],
+ ["ecbbba", "ecbba4e186bd"],
+ ["ecbbbb", "e1848fe185a5e186be"],
+ ["ecbbbb", "ecbba4e186be"],
+ ["ecbbbc", "e1848fe185a5e186bf"],
+ ["ecbbbc", "ecbba4e186bf"],
+ ["ecbbbd", "e1848fe185a5e18780"],
+ ["ecbbbd", "ecbba4e18780"],
+ ["ecbbbe", "e1848fe185a5e18781"],
+ ["ecbbbe", "ecbba4e18781"],
+ ["ecbbbf", "e1848fe185a5e18782"],
+ ["ecbbbf", "ecbba4e18782"],
+ ["ecbc80", "e1848fe185a6"],
+ ["ecbc81", "e1848fe185a6e186a8"],
+ ["ecbc81", "ecbc80e186a8"],
+ ["ecbc82", "e1848fe185a6e186a9"],
+ ["ecbc82", "ecbc80e186a9"],
+ ["ecbc83", "e1848fe185a6e186aa"],
+ ["ecbc83", "ecbc80e186aa"],
+ ["ecbc84", "e1848fe185a6e186ab"],
+ ["ecbc84", "ecbc80e186ab"],
+ ["ecbc85", "e1848fe185a6e186ac"],
+ ["ecbc85", "ecbc80e186ac"],
+ ["ecbc86", "e1848fe185a6e186ad"],
+ ["ecbc86", "ecbc80e186ad"],
+ ["ecbc87", "e1848fe185a6e186ae"],
+ ["ecbc87", "ecbc80e186ae"],
+ ["ecbc88", "e1848fe185a6e186af"],
+ ["ecbc88", "ecbc80e186af"],
+ ["ecbc89", "e1848fe185a6e186b0"],
+ ["ecbc89", "ecbc80e186b0"],
+ ["ecbc8a", "e1848fe185a6e186b1"],
+ ["ecbc8a", "ecbc80e186b1"],
+ ["ecbc8b", "e1848fe185a6e186b2"],
+ ["ecbc8b", "ecbc80e186b2"],
+ ["ecbc8c", "e1848fe185a6e186b3"],
+ ["ecbc8c", "ecbc80e186b3"],
+ ["ecbc8d", "e1848fe185a6e186b4"],
+ ["ecbc8d", "ecbc80e186b4"],
+ ["ecbc8e", "e1848fe185a6e186b5"],
+ ["ecbc8e", "ecbc80e186b5"],
+ ["ecbc8f", "e1848fe185a6e186b6"],
+ ["ecbc8f", "ecbc80e186b6"],
+ ["ecbc90", "e1848fe185a6e186b7"],
+ ["ecbc90", "ecbc80e186b7"],
+ ["ecbc91", "e1848fe185a6e186b8"],
+ ["ecbc91", "ecbc80e186b8"],
+ ["ecbc92", "e1848fe185a6e186b9"],
+ ["ecbc92", "ecbc80e186b9"],
+ ["ecbc93", "e1848fe185a6e186ba"],
+ ["ecbc93", "ecbc80e186ba"],
+ ["ecbc94", "e1848fe185a6e186bb"],
+ ["ecbc94", "ecbc80e186bb"],
+ ["ecbc95", "e1848fe185a6e186bc"],
+ ["ecbc95", "ecbc80e186bc"],
+ ["ecbc96", "e1848fe185a6e186bd"],
+ ["ecbc96", "ecbc80e186bd"],
+ ["ecbc97", "e1848fe185a6e186be"],
+ ["ecbc97", "ecbc80e186be"],
+ ["ecbc98", "e1848fe185a6e186bf"],
+ ["ecbc98", "ecbc80e186bf"],
+ ["ecbc99", "e1848fe185a6e18780"],
+ ["ecbc99", "ecbc80e18780"],
+ ["ecbc9a", "e1848fe185a6e18781"],
+ ["ecbc9a", "ecbc80e18781"],
+ ["ecbc9b", "e1848fe185a6e18782"],
+ ["ecbc9b", "ecbc80e18782"],
+ ["ecbc9c", "e1848fe185a7"],
+ ["ecbc9d", "e1848fe185a7e186a8"],
+ ["ecbc9d", "ecbc9ce186a8"],
+ ["ecbc9e", "e1848fe185a7e186a9"],
+ ["ecbc9e", "ecbc9ce186a9"],
+ ["ecbc9f", "e1848fe185a7e186aa"],
+ ["ecbc9f", "ecbc9ce186aa"],
+ ["ecbca0", "e1848fe185a7e186ab"],
+ ["ecbca0", "ecbc9ce186ab"],
+ ["ecbca1", "e1848fe185a7e186ac"],
+ ["ecbca1", "ecbc9ce186ac"],
+ ["ecbca2", "e1848fe185a7e186ad"],
+ ["ecbca2", "ecbc9ce186ad"],
+ ["ecbca3", "e1848fe185a7e186ae"],
+ ["ecbca3", "ecbc9ce186ae"],
+ ["ecbca4", "e1848fe185a7e186af"],
+ ["ecbca4", "ecbc9ce186af"],
+ ["ecbca5", "e1848fe185a7e186b0"],
+ ["ecbca5", "ecbc9ce186b0"],
+ ["ecbca6", "e1848fe185a7e186b1"],
+ ["ecbca6", "ecbc9ce186b1"],
+ ["ecbca7", "e1848fe185a7e186b2"],
+ ["ecbca7", "ecbc9ce186b2"],
+ ["ecbca8", "e1848fe185a7e186b3"],
+ ["ecbca8", "ecbc9ce186b3"],
+ ["ecbca9", "e1848fe185a7e186b4"],
+ ["ecbca9", "ecbc9ce186b4"],
+ ["ecbcaa", "e1848fe185a7e186b5"],
+ ["ecbcaa", "ecbc9ce186b5"],
+ ["ecbcab", "e1848fe185a7e186b6"],
+ ["ecbcab", "ecbc9ce186b6"],
+ ["ecbcac", "e1848fe185a7e186b7"],
+ ["ecbcac", "ecbc9ce186b7"],
+ ["ecbcad", "e1848fe185a7e186b8"],
+ ["ecbcad", "ecbc9ce186b8"],
+ ["ecbcae", "e1848fe185a7e186b9"],
+ ["ecbcae", "ecbc9ce186b9"],
+ ["ecbcaf", "e1848fe185a7e186ba"],
+ ["ecbcaf", "ecbc9ce186ba"],
+ ["ecbcb0", "e1848fe185a7e186bb"],
+ ["ecbcb0", "ecbc9ce186bb"],
+ ["ecbcb1", "e1848fe185a7e186bc"],
+ ["ecbcb1", "ecbc9ce186bc"],
+ ["ecbcb2", "e1848fe185a7e186bd"],
+ ["ecbcb2", "ecbc9ce186bd"],
+ ["ecbcb3", "e1848fe185a7e186be"],
+ ["ecbcb3", "ecbc9ce186be"],
+ ["ecbcb4", "e1848fe185a7e186bf"],
+ ["ecbcb4", "ecbc9ce186bf"],
+ ["ecbcb5", "e1848fe185a7e18780"],
+ ["ecbcb5", "ecbc9ce18780"],
+ ["ecbcb6", "e1848fe185a7e18781"],
+ ["ecbcb6", "ecbc9ce18781"],
+ ["ecbcb7", "e1848fe185a7e18782"],
+ ["ecbcb7", "ecbc9ce18782"],
+ ["ecbcb8", "e1848fe185a8"],
+ ["ecbcb9", "e1848fe185a8e186a8"],
+ ["ecbcb9", "ecbcb8e186a8"],
+ ["ecbcba", "e1848fe185a8e186a9"],
+ ["ecbcba", "ecbcb8e186a9"],
+ ["ecbcbb", "e1848fe185a8e186aa"],
+ ["ecbcbb", "ecbcb8e186aa"],
+ ["ecbcbc", "e1848fe185a8e186ab"],
+ ["ecbcbc", "ecbcb8e186ab"],
+ ["ecbcbd", "e1848fe185a8e186ac"],
+ ["ecbcbd", "ecbcb8e186ac"],
+ ["ecbcbe", "e1848fe185a8e186ad"],
+ ["ecbcbe", "ecbcb8e186ad"],
+ ["ecbcbf", "e1848fe185a8e186ae"],
+ ["ecbcbf", "ecbcb8e186ae"],
+ ["ecbd80", "e1848fe185a8e186af"],
+ ["ecbd80", "ecbcb8e186af"],
+ ["ecbd81", "e1848fe185a8e186b0"],
+ ["ecbd81", "ecbcb8e186b0"],
+ ["ecbd82", "e1848fe185a8e186b1"],
+ ["ecbd82", "ecbcb8e186b1"],
+ ["ecbd83", "e1848fe185a8e186b2"],
+ ["ecbd83", "ecbcb8e186b2"],
+ ["ecbd84", "e1848fe185a8e186b3"],
+ ["ecbd84", "ecbcb8e186b3"],
+ ["ecbd85", "e1848fe185a8e186b4"],
+ ["ecbd85", "ecbcb8e186b4"],
+ ["ecbd86", "e1848fe185a8e186b5"],
+ ["ecbd86", "ecbcb8e186b5"],
+ ["ecbd87", "e1848fe185a8e186b6"],
+ ["ecbd87", "ecbcb8e186b6"],
+ ["ecbd88", "e1848fe185a8e186b7"],
+ ["ecbd88", "ecbcb8e186b7"],
+ ["ecbd89", "e1848fe185a8e186b8"],
+ ["ecbd89", "ecbcb8e186b8"],
+ ["ecbd8a", "e1848fe185a8e186b9"],
+ ["ecbd8a", "ecbcb8e186b9"],
+ ["ecbd8b", "e1848fe185a8e186ba"],
+ ["ecbd8b", "ecbcb8e186ba"],
+ ["ecbd8c", "e1848fe185a8e186bb"],
+ ["ecbd8c", "ecbcb8e186bb"],
+ ["ecbd8d", "e1848fe185a8e186bc"],
+ ["ecbd8d", "ecbcb8e186bc"],
+ ["ecbd8e", "e1848fe185a8e186bd"],
+ ["ecbd8e", "ecbcb8e186bd"],
+ ["ecbd8f", "e1848fe185a8e186be"],
+ ["ecbd8f", "ecbcb8e186be"],
+ ["ecbd90", "e1848fe185a8e186bf"],
+ ["ecbd90", "ecbcb8e186bf"],
+ ["ecbd91", "e1848fe185a8e18780"],
+ ["ecbd91", "ecbcb8e18780"],
+ ["ecbd92", "e1848fe185a8e18781"],
+ ["ecbd92", "ecbcb8e18781"],
+ ["ecbd93", "e1848fe185a8e18782"],
+ ["ecbd93", "ecbcb8e18782"],
+ ["ecbd94", "e1848fe185a9"],
+ ["ecbd95", "e1848fe185a9e186a8"],
+ ["ecbd95", "ecbd94e186a8"],
+ ["ecbd96", "e1848fe185a9e186a9"],
+ ["ecbd96", "ecbd94e186a9"],
+ ["ecbd97", "e1848fe185a9e186aa"],
+ ["ecbd97", "ecbd94e186aa"],
+ ["ecbd98", "e1848fe185a9e186ab"],
+ ["ecbd98", "ecbd94e186ab"],
+ ["ecbd99", "e1848fe185a9e186ac"],
+ ["ecbd99", "ecbd94e186ac"],
+ ["ecbd9a", "e1848fe185a9e186ad"],
+ ["ecbd9a", "ecbd94e186ad"],
+ ["ecbd9b", "e1848fe185a9e186ae"],
+ ["ecbd9b", "ecbd94e186ae"],
+ ["ecbd9c", "e1848fe185a9e186af"],
+ ["ecbd9c", "ecbd94e186af"],
+ ["ecbd9d", "e1848fe185a9e186b0"],
+ ["ecbd9d", "ecbd94e186b0"],
+ ["ecbd9e", "e1848fe185a9e186b1"],
+ ["ecbd9e", "ecbd94e186b1"],
+ ["ecbd9f", "e1848fe185a9e186b2"],
+ ["ecbd9f", "ecbd94e186b2"],
+ ["ecbda0", "e1848fe185a9e186b3"],
+ ["ecbda0", "ecbd94e186b3"],
+ ["ecbda1", "e1848fe185a9e186b4"],
+ ["ecbda1", "ecbd94e186b4"],
+ ["ecbda2", "e1848fe185a9e186b5"],
+ ["ecbda2", "ecbd94e186b5"],
+ ["ecbda3", "e1848fe185a9e186b6"],
+ ["ecbda3", "ecbd94e186b6"],
+ ["ecbda4", "e1848fe185a9e186b7"],
+ ["ecbda4", "ecbd94e186b7"],
+ ["ecbda5", "e1848fe185a9e186b8"],
+ ["ecbda5", "ecbd94e186b8"],
+ ["ecbda6", "e1848fe185a9e186b9"],
+ ["ecbda6", "ecbd94e186b9"],
+ ["ecbda7", "e1848fe185a9e186ba"],
+ ["ecbda7", "ecbd94e186ba"],
+ ["ecbda8", "e1848fe185a9e186bb"],
+ ["ecbda8", "ecbd94e186bb"],
+ ["ecbda9", "e1848fe185a9e186bc"],
+ ["ecbda9", "ecbd94e186bc"],
+ ["ecbdaa", "e1848fe185a9e186bd"],
+ ["ecbdaa", "ecbd94e186bd"],
+ ["ecbdab", "e1848fe185a9e186be"],
+ ["ecbdab", "ecbd94e186be"],
+ ["ecbdac", "e1848fe185a9e186bf"],
+ ["ecbdac", "ecbd94e186bf"],
+ ["ecbdad", "e1848fe185a9e18780"],
+ ["ecbdad", "ecbd94e18780"],
+ ["ecbdae", "e1848fe185a9e18781"],
+ ["ecbdae", "ecbd94e18781"],
+ ["ecbdaf", "e1848fe185a9e18782"],
+ ["ecbdaf", "ecbd94e18782"],
+ ["ecbdb0", "e1848fe185aa"],
+ ["ecbdb1", "e1848fe185aae186a8"],
+ ["ecbdb1", "ecbdb0e186a8"],
+ ["ecbdb2", "e1848fe185aae186a9"],
+ ["ecbdb2", "ecbdb0e186a9"],
+ ["ecbdb3", "e1848fe185aae186aa"],
+ ["ecbdb3", "ecbdb0e186aa"],
+ ["ecbdb4", "e1848fe185aae186ab"],
+ ["ecbdb4", "ecbdb0e186ab"],
+ ["ecbdb5", "e1848fe185aae186ac"],
+ ["ecbdb5", "ecbdb0e186ac"],
+ ["ecbdb6", "e1848fe185aae186ad"],
+ ["ecbdb6", "ecbdb0e186ad"],
+ ["ecbdb7", "e1848fe185aae186ae"],
+ ["ecbdb7", "ecbdb0e186ae"],
+ ["ecbdb8", "e1848fe185aae186af"],
+ ["ecbdb8", "ecbdb0e186af"],
+ ["ecbdb9", "e1848fe185aae186b0"],
+ ["ecbdb9", "ecbdb0e186b0"],
+ ["ecbdba", "e1848fe185aae186b1"],
+ ["ecbdba", "ecbdb0e186b1"],
+ ["ecbdbb", "e1848fe185aae186b2"],
+ ["ecbdbb", "ecbdb0e186b2"],
+ ["ecbdbc", "e1848fe185aae186b3"],
+ ["ecbdbc", "ecbdb0e186b3"],
+ ["ecbdbd", "e1848fe185aae186b4"],
+ ["ecbdbd", "ecbdb0e186b4"],
+ ["ecbdbe", "e1848fe185aae186b5"],
+ ["ecbdbe", "ecbdb0e186b5"],
+ ["ecbdbf", "e1848fe185aae186b6"],
+ ["ecbdbf", "ecbdb0e186b6"],
+ ["ecbe80", "e1848fe185aae186b7"],
+ ["ecbe80", "ecbdb0e186b7"],
+ ["ecbe81", "e1848fe185aae186b8"],
+ ["ecbe81", "ecbdb0e186b8"],
+ ["ecbe82", "e1848fe185aae186b9"],
+ ["ecbe82", "ecbdb0e186b9"],
+ ["ecbe83", "e1848fe185aae186ba"],
+ ["ecbe83", "ecbdb0e186ba"],
+ ["ecbe84", "e1848fe185aae186bb"],
+ ["ecbe84", "ecbdb0e186bb"],
+ ["ecbe85", "e1848fe185aae186bc"],
+ ["ecbe85", "ecbdb0e186bc"],
+ ["ecbe86", "e1848fe185aae186bd"],
+ ["ecbe86", "ecbdb0e186bd"],
+ ["ecbe87", "e1848fe185aae186be"],
+ ["ecbe87", "ecbdb0e186be"],
+ ["ecbe88", "e1848fe185aae186bf"],
+ ["ecbe88", "ecbdb0e186bf"],
+ ["ecbe89", "e1848fe185aae18780"],
+ ["ecbe89", "ecbdb0e18780"],
+ ["ecbe8a", "e1848fe185aae18781"],
+ ["ecbe8a", "ecbdb0e18781"],
+ ["ecbe8b", "e1848fe185aae18782"],
+ ["ecbe8b", "ecbdb0e18782"],
+ ["ecbe8c", "e1848fe185ab"],
+ ["ecbe8d", "e1848fe185abe186a8"],
+ ["ecbe8d", "ecbe8ce186a8"],
+ ["ecbe8e", "e1848fe185abe186a9"],
+ ["ecbe8e", "ecbe8ce186a9"],
+ ["ecbe8f", "e1848fe185abe186aa"],
+ ["ecbe8f", "ecbe8ce186aa"],
+ ["ecbe90", "e1848fe185abe186ab"],
+ ["ecbe90", "ecbe8ce186ab"],
+ ["ecbe91", "e1848fe185abe186ac"],
+ ["ecbe91", "ecbe8ce186ac"],
+ ["ecbe92", "e1848fe185abe186ad"],
+ ["ecbe92", "ecbe8ce186ad"],
+ ["ecbe93", "e1848fe185abe186ae"],
+ ["ecbe93", "ecbe8ce186ae"],
+ ["ecbe94", "e1848fe185abe186af"],
+ ["ecbe94", "ecbe8ce186af"],
+ ["ecbe95", "e1848fe185abe186b0"],
+ ["ecbe95", "ecbe8ce186b0"],
+ ["ecbe96", "e1848fe185abe186b1"],
+ ["ecbe96", "ecbe8ce186b1"],
+ ["ecbe97", "e1848fe185abe186b2"],
+ ["ecbe97", "ecbe8ce186b2"],
+ ["ecbe98", "e1848fe185abe186b3"],
+ ["ecbe98", "ecbe8ce186b3"],
+ ["ecbe99", "e1848fe185abe186b4"],
+ ["ecbe99", "ecbe8ce186b4"],
+ ["ecbe9a", "e1848fe185abe186b5"],
+ ["ecbe9a", "ecbe8ce186b5"],
+ ["ecbe9b", "e1848fe185abe186b6"],
+ ["ecbe9b", "ecbe8ce186b6"],
+ ["ecbe9c", "e1848fe185abe186b7"],
+ ["ecbe9c", "ecbe8ce186b7"],
+ ["ecbe9d", "e1848fe185abe186b8"],
+ ["ecbe9d", "ecbe8ce186b8"],
+ ["ecbe9e", "e1848fe185abe186b9"],
+ ["ecbe9e", "ecbe8ce186b9"],
+ ["ecbe9f", "e1848fe185abe186ba"],
+ ["ecbe9f", "ecbe8ce186ba"],
+ ["ecbea0", "e1848fe185abe186bb"],
+ ["ecbea0", "ecbe8ce186bb"],
+ ["ecbea1", "e1848fe185abe186bc"],
+ ["ecbea1", "ecbe8ce186bc"],
+ ["ecbea2", "e1848fe185abe186bd"],
+ ["ecbea2", "ecbe8ce186bd"],
+ ["ecbea3", "e1848fe185abe186be"],
+ ["ecbea3", "ecbe8ce186be"],
+ ["ecbea4", "e1848fe185abe186bf"],
+ ["ecbea4", "ecbe8ce186bf"],
+ ["ecbea5", "e1848fe185abe18780"],
+ ["ecbea5", "ecbe8ce18780"],
+ ["ecbea6", "e1848fe185abe18781"],
+ ["ecbea6", "ecbe8ce18781"],
+ ["ecbea7", "e1848fe185abe18782"],
+ ["ecbea7", "ecbe8ce18782"],
+ ["ecbea8", "e1848fe185ac"],
+ ["ecbea9", "e1848fe185ace186a8"],
+ ["ecbea9", "ecbea8e186a8"],
+ ["ecbeaa", "e1848fe185ace186a9"],
+ ["ecbeaa", "ecbea8e186a9"],
+ ["ecbeab", "e1848fe185ace186aa"],
+ ["ecbeab", "ecbea8e186aa"],
+ ["ecbeac", "e1848fe185ace186ab"],
+ ["ecbeac", "ecbea8e186ab"],
+ ["ecbead", "e1848fe185ace186ac"],
+ ["ecbead", "ecbea8e186ac"],
+ ["ecbeae", "e1848fe185ace186ad"],
+ ["ecbeae", "ecbea8e186ad"],
+ ["ecbeaf", "e1848fe185ace186ae"],
+ ["ecbeaf", "ecbea8e186ae"],
+ ["ecbeb0", "e1848fe185ace186af"],
+ ["ecbeb0", "ecbea8e186af"],
+ ["ecbeb1", "e1848fe185ace186b0"],
+ ["ecbeb1", "ecbea8e186b0"],
+ ["ecbeb2", "e1848fe185ace186b1"],
+ ["ecbeb2", "ecbea8e186b1"],
+ ["ecbeb3", "e1848fe185ace186b2"],
+ ["ecbeb3", "ecbea8e186b2"],
+ ["ecbeb4", "e1848fe185ace186b3"],
+ ["ecbeb4", "ecbea8e186b3"],
+ ["ecbeb5", "e1848fe185ace186b4"],
+ ["ecbeb5", "ecbea8e186b4"],
+ ["ecbeb6", "e1848fe185ace186b5"],
+ ["ecbeb6", "ecbea8e186b5"],
+ ["ecbeb7", "e1848fe185ace186b6"],
+ ["ecbeb7", "ecbea8e186b6"],
+ ["ecbeb8", "e1848fe185ace186b7"],
+ ["ecbeb8", "ecbea8e186b7"],
+ ["ecbeb9", "e1848fe185ace186b8"],
+ ["ecbeb9", "ecbea8e186b8"],
+ ["ecbeba", "e1848fe185ace186b9"],
+ ["ecbeba", "ecbea8e186b9"],
+ ["ecbebb", "e1848fe185ace186ba"],
+ ["ecbebb", "ecbea8e186ba"],
+ ["ecbebc", "e1848fe185ace186bb"],
+ ["ecbebc", "ecbea8e186bb"],
+ ["ecbebd", "e1848fe185ace186bc"],
+ ["ecbebd", "ecbea8e186bc"],
+ ["ecbebe", "e1848fe185ace186bd"],
+ ["ecbebe", "ecbea8e186bd"],
+ ["ecbebf", "e1848fe185ace186be"],
+ ["ecbebf", "ecbea8e186be"],
+ ["ecbf80", "e1848fe185ace186bf"],
+ ["ecbf80", "ecbea8e186bf"],
+ ["ecbf81", "e1848fe185ace18780"],
+ ["ecbf81", "ecbea8e18780"],
+ ["ecbf82", "e1848fe185ace18781"],
+ ["ecbf82", "ecbea8e18781"],
+ ["ecbf83", "e1848fe185ace18782"],
+ ["ecbf83", "ecbea8e18782"],
+ ["ecbf84", "e1848fe185ad"],
+ ["ecbf85", "e1848fe185ade186a8"],
+ ["ecbf85", "ecbf84e186a8"],
+ ["ecbf86", "e1848fe185ade186a9"],
+ ["ecbf86", "ecbf84e186a9"],
+ ["ecbf87", "e1848fe185ade186aa"],
+ ["ecbf87", "ecbf84e186aa"],
+ ["ecbf88", "e1848fe185ade186ab"],
+ ["ecbf88", "ecbf84e186ab"],
+ ["ecbf89", "e1848fe185ade186ac"],
+ ["ecbf89", "ecbf84e186ac"],
+ ["ecbf8a", "e1848fe185ade186ad"],
+ ["ecbf8a", "ecbf84e186ad"],
+ ["ecbf8b", "e1848fe185ade186ae"],
+ ["ecbf8b", "ecbf84e186ae"],
+ ["ecbf8c", "e1848fe185ade186af"],
+ ["ecbf8c", "ecbf84e186af"],
+ ["ecbf8d", "e1848fe185ade186b0"],
+ ["ecbf8d", "ecbf84e186b0"],
+ ["ecbf8e", "e1848fe185ade186b1"],
+ ["ecbf8e", "ecbf84e186b1"],
+ ["ecbf8f", "e1848fe185ade186b2"],
+ ["ecbf8f", "ecbf84e186b2"],
+ ["ecbf90", "e1848fe185ade186b3"],
+ ["ecbf90", "ecbf84e186b3"],
+ ["ecbf91", "e1848fe185ade186b4"],
+ ["ecbf91", "ecbf84e186b4"],
+ ["ecbf92", "e1848fe185ade186b5"],
+ ["ecbf92", "ecbf84e186b5"],
+ ["ecbf93", "e1848fe185ade186b6"],
+ ["ecbf93", "ecbf84e186b6"],
+ ["ecbf94", "e1848fe185ade186b7"],
+ ["ecbf94", "ecbf84e186b7"],
+ ["ecbf95", "e1848fe185ade186b8"],
+ ["ecbf95", "ecbf84e186b8"],
+ ["ecbf96", "e1848fe185ade186b9"],
+ ["ecbf96", "ecbf84e186b9"],
+ ["ecbf97", "e1848fe185ade186ba"],
+ ["ecbf97", "ecbf84e186ba"],
+ ["ecbf98", "e1848fe185ade186bb"],
+ ["ecbf98", "ecbf84e186bb"],
+ ["ecbf99", "e1848fe185ade186bc"],
+ ["ecbf99", "ecbf84e186bc"],
+ ["ecbf9a", "e1848fe185ade186bd"],
+ ["ecbf9a", "ecbf84e186bd"],
+ ["ecbf9b", "e1848fe185ade186be"],
+ ["ecbf9b", "ecbf84e186be"],
+ ["ecbf9c", "e1848fe185ade186bf"],
+ ["ecbf9c", "ecbf84e186bf"],
+ ["ecbf9d", "e1848fe185ade18780"],
+ ["ecbf9d", "ecbf84e18780"],
+ ["ecbf9e", "e1848fe185ade18781"],
+ ["ecbf9e", "ecbf84e18781"],
+ ["ecbf9f", "e1848fe185ade18782"],
+ ["ecbf9f", "ecbf84e18782"],
+ ["ecbfa0", "e1848fe185ae"],
+ ["ecbfa1", "e1848fe185aee186a8"],
+ ["ecbfa1", "ecbfa0e186a8"],
+ ["ecbfa2", "e1848fe185aee186a9"],
+ ["ecbfa2", "ecbfa0e186a9"],
+ ["ecbfa3", "e1848fe185aee186aa"],
+ ["ecbfa3", "ecbfa0e186aa"],
+ ["ecbfa4", "e1848fe185aee186ab"],
+ ["ecbfa4", "ecbfa0e186ab"],
+ ["ecbfa5", "e1848fe185aee186ac"],
+ ["ecbfa5", "ecbfa0e186ac"],
+ ["ecbfa6", "e1848fe185aee186ad"],
+ ["ecbfa6", "ecbfa0e186ad"],
+ ["ecbfa7", "e1848fe185aee186ae"],
+ ["ecbfa7", "ecbfa0e186ae"],
+ ["ecbfa8", "e1848fe185aee186af"],
+ ["ecbfa8", "ecbfa0e186af"],
+ ["ecbfa9", "e1848fe185aee186b0"],
+ ["ecbfa9", "ecbfa0e186b0"],
+ ["ecbfaa", "e1848fe185aee186b1"],
+ ["ecbfaa", "ecbfa0e186b1"],
+ ["ecbfab", "e1848fe185aee186b2"],
+ ["ecbfab", "ecbfa0e186b2"],
+ ["ecbfac", "e1848fe185aee186b3"],
+ ["ecbfac", "ecbfa0e186b3"],
+ ["ecbfad", "e1848fe185aee186b4"],
+ ["ecbfad", "ecbfa0e186b4"],
+ ["ecbfae", "e1848fe185aee186b5"],
+ ["ecbfae", "ecbfa0e186b5"],
+ ["ecbfaf", "e1848fe185aee186b6"],
+ ["ecbfaf", "ecbfa0e186b6"],
+ ["ecbfb0", "e1848fe185aee186b7"],
+ ["ecbfb0", "ecbfa0e186b7"],
+ ["ecbfb1", "e1848fe185aee186b8"],
+ ["ecbfb1", "ecbfa0e186b8"],
+ ["ecbfb2", "e1848fe185aee186b9"],
+ ["ecbfb2", "ecbfa0e186b9"],
+ ["ecbfb3", "e1848fe185aee186ba"],
+ ["ecbfb3", "ecbfa0e186ba"],
+ ["ecbfb4", "e1848fe185aee186bb"],
+ ["ecbfb4", "ecbfa0e186bb"],
+ ["ecbfb5", "e1848fe185aee186bc"],
+ ["ecbfb5", "ecbfa0e186bc"],
+ ["ecbfb6", "e1848fe185aee186bd"],
+ ["ecbfb6", "ecbfa0e186bd"],
+ ["ecbfb7", "e1848fe185aee186be"],
+ ["ecbfb7", "ecbfa0e186be"],
+ ["ecbfb8", "e1848fe185aee186bf"],
+ ["ecbfb8", "ecbfa0e186bf"],
+ ["ecbfb9", "e1848fe185aee18780"],
+ ["ecbfb9", "ecbfa0e18780"],
+ ["ecbfba", "e1848fe185aee18781"],
+ ["ecbfba", "ecbfa0e18781"],
+ ["ecbfbb", "e1848fe185aee18782"],
+ ["ecbfbb", "ecbfa0e18782"],
+ ["ecbfbc", "e1848fe185af"],
+ ["ecbfbd", "e1848fe185afe186a8"],
+ ["ecbfbd", "ecbfbce186a8"],
+ ["ecbfbe", "e1848fe185afe186a9"],
+ ["ecbfbe", "ecbfbce186a9"],
+ ["ecbfbf", "e1848fe185afe186aa"],
+ ["ecbfbf", "ecbfbce186aa"],
+ ["ed8080", "e1848fe185afe186ab"],
+ ["ed8080", "ecbfbce186ab"],
+ ["ed8081", "e1848fe185afe186ac"],
+ ["ed8081", "ecbfbce186ac"],
+ ["ed8082", "e1848fe185afe186ad"],
+ ["ed8082", "ecbfbce186ad"],
+ ["ed8083", "e1848fe185afe186ae"],
+ ["ed8083", "ecbfbce186ae"],
+ ["ed8084", "e1848fe185afe186af"],
+ ["ed8084", "ecbfbce186af"],
+ ["ed8085", "e1848fe185afe186b0"],
+ ["ed8085", "ecbfbce186b0"],
+ ["ed8086", "e1848fe185afe186b1"],
+ ["ed8086", "ecbfbce186b1"],
+ ["ed8087", "e1848fe185afe186b2"],
+ ["ed8087", "ecbfbce186b2"],
+ ["ed8088", "e1848fe185afe186b3"],
+ ["ed8088", "ecbfbce186b3"],
+ ["ed8089", "e1848fe185afe186b4"],
+ ["ed8089", "ecbfbce186b4"],
+ ["ed808a", "e1848fe185afe186b5"],
+ ["ed808a", "ecbfbce186b5"],
+ ["ed808b", "e1848fe185afe186b6"],
+ ["ed808b", "ecbfbce186b6"],
+ ["ed808c", "e1848fe185afe186b7"],
+ ["ed808c", "ecbfbce186b7"],
+ ["ed808d", "e1848fe185afe186b8"],
+ ["ed808d", "ecbfbce186b8"],
+ ["ed808e", "e1848fe185afe186b9"],
+ ["ed808e", "ecbfbce186b9"],
+ ["ed808f", "e1848fe185afe186ba"],
+ ["ed808f", "ecbfbce186ba"],
+ ["ed8090", "e1848fe185afe186bb"],
+ ["ed8090", "ecbfbce186bb"],
+ ["ed8091", "e1848fe185afe186bc"],
+ ["ed8091", "ecbfbce186bc"],
+ ["ed8092", "e1848fe185afe186bd"],
+ ["ed8092", "ecbfbce186bd"],
+ ["ed8093", "e1848fe185afe186be"],
+ ["ed8093", "ecbfbce186be"],
+ ["ed8094", "e1848fe185afe186bf"],
+ ["ed8094", "ecbfbce186bf"],
+ ["ed8095", "e1848fe185afe18780"],
+ ["ed8095", "ecbfbce18780"],
+ ["ed8096", "e1848fe185afe18781"],
+ ["ed8096", "ecbfbce18781"],
+ ["ed8097", "e1848fe185afe18782"],
+ ["ed8097", "ecbfbce18782"],
+ ["ed8098", "e1848fe185b0"],
+ ["ed8099", "e1848fe185b0e186a8"],
+ ["ed8099", "ed8098e186a8"],
+ ["ed809a", "e1848fe185b0e186a9"],
+ ["ed809a", "ed8098e186a9"],
+ ["ed809b", "e1848fe185b0e186aa"],
+ ["ed809b", "ed8098e186aa"],
+ ["ed809c", "e1848fe185b0e186ab"],
+ ["ed809c", "ed8098e186ab"],
+ ["ed809d", "e1848fe185b0e186ac"],
+ ["ed809d", "ed8098e186ac"],
+ ["ed809e", "e1848fe185b0e186ad"],
+ ["ed809e", "ed8098e186ad"],
+ ["ed809f", "e1848fe185b0e186ae"],
+ ["ed809f", "ed8098e186ae"],
+ ["ed80a0", "e1848fe185b0e186af"],
+ ["ed80a0", "ed8098e186af"],
+ ["ed80a1", "e1848fe185b0e186b0"],
+ ["ed80a1", "ed8098e186b0"],
+ ["ed80a2", "e1848fe185b0e186b1"],
+ ["ed80a2", "ed8098e186b1"],
+ ["ed80a3", "e1848fe185b0e186b2"],
+ ["ed80a3", "ed8098e186b2"],
+ ["ed80a4", "e1848fe185b0e186b3"],
+ ["ed80a4", "ed8098e186b3"],
+ ["ed80a5", "e1848fe185b0e186b4"],
+ ["ed80a5", "ed8098e186b4"],
+ ["ed80a6", "e1848fe185b0e186b5"],
+ ["ed80a6", "ed8098e186b5"],
+ ["ed80a7", "e1848fe185b0e186b6"],
+ ["ed80a7", "ed8098e186b6"],
+ ["ed80a8", "e1848fe185b0e186b7"],
+ ["ed80a8", "ed8098e186b7"],
+ ["ed80a9", "e1848fe185b0e186b8"],
+ ["ed80a9", "ed8098e186b8"],
+ ["ed80aa", "e1848fe185b0e186b9"],
+ ["ed80aa", "ed8098e186b9"],
+ ["ed80ab", "e1848fe185b0e186ba"],
+ ["ed80ab", "ed8098e186ba"],
+ ["ed80ac", "e1848fe185b0e186bb"],
+ ["ed80ac", "ed8098e186bb"],
+ ["ed80ad", "e1848fe185b0e186bc"],
+ ["ed80ad", "ed8098e186bc"],
+ ["ed80ae", "e1848fe185b0e186bd"],
+ ["ed80ae", "ed8098e186bd"],
+ ["ed80af", "e1848fe185b0e186be"],
+ ["ed80af", "ed8098e186be"],
+ ["ed80b0", "e1848fe185b0e186bf"],
+ ["ed80b0", "ed8098e186bf"],
+ ["ed80b1", "e1848fe185b0e18780"],
+ ["ed80b1", "ed8098e18780"],
+ ["ed80b2", "e1848fe185b0e18781"],
+ ["ed80b2", "ed8098e18781"],
+ ["ed80b3", "e1848fe185b0e18782"],
+ ["ed80b3", "ed8098e18782"],
+ ["ed80b4", "e1848fe185b1"],
+ ["ed80b5", "e1848fe185b1e186a8"],
+ ["ed80b5", "ed80b4e186a8"],
+ ["ed80b6", "e1848fe185b1e186a9"],
+ ["ed80b6", "ed80b4e186a9"],
+ ["ed80b7", "e1848fe185b1e186aa"],
+ ["ed80b7", "ed80b4e186aa"],
+ ["ed80b8", "e1848fe185b1e186ab"],
+ ["ed80b8", "ed80b4e186ab"],
+ ["ed80b9", "e1848fe185b1e186ac"],
+ ["ed80b9", "ed80b4e186ac"],
+ ["ed80ba", "e1848fe185b1e186ad"],
+ ["ed80ba", "ed80b4e186ad"],
+ ["ed80bb", "e1848fe185b1e186ae"],
+ ["ed80bb", "ed80b4e186ae"],
+ ["ed80bc", "e1848fe185b1e186af"],
+ ["ed80bc", "ed80b4e186af"],
+ ["ed80bd", "e1848fe185b1e186b0"],
+ ["ed80bd", "ed80b4e186b0"],
+ ["ed80be", "e1848fe185b1e186b1"],
+ ["ed80be", "ed80b4e186b1"],
+ ["ed80bf", "e1848fe185b1e186b2"],
+ ["ed80bf", "ed80b4e186b2"],
+ ["ed8180", "e1848fe185b1e186b3"],
+ ["ed8180", "ed80b4e186b3"],
+ ["ed8181", "e1848fe185b1e186b4"],
+ ["ed8181", "ed80b4e186b4"],
+ ["ed8182", "e1848fe185b1e186b5"],
+ ["ed8182", "ed80b4e186b5"],
+ ["ed8183", "e1848fe185b1e186b6"],
+ ["ed8183", "ed80b4e186b6"],
+ ["ed8184", "e1848fe185b1e186b7"],
+ ["ed8184", "ed80b4e186b7"],
+ ["ed8185", "e1848fe185b1e186b8"],
+ ["ed8185", "ed80b4e186b8"],
+ ["ed8186", "e1848fe185b1e186b9"],
+ ["ed8186", "ed80b4e186b9"],
+ ["ed8187", "e1848fe185b1e186ba"],
+ ["ed8187", "ed80b4e186ba"],
+ ["ed8188", "e1848fe185b1e186bb"],
+ ["ed8188", "ed80b4e186bb"],
+ ["ed8189", "e1848fe185b1e186bc"],
+ ["ed8189", "ed80b4e186bc"],
+ ["ed818a", "e1848fe185b1e186bd"],
+ ["ed818a", "ed80b4e186bd"],
+ ["ed818b", "e1848fe185b1e186be"],
+ ["ed818b", "ed80b4e186be"],
+ ["ed818c", "e1848fe185b1e186bf"],
+ ["ed818c", "ed80b4e186bf"],
+ ["ed818d", "e1848fe185b1e18780"],
+ ["ed818d", "ed80b4e18780"],
+ ["ed818e", "e1848fe185b1e18781"],
+ ["ed818e", "ed80b4e18781"],
+ ["ed818f", "e1848fe185b1e18782"],
+ ["ed818f", "ed80b4e18782"],
+ ["ed8190", "e1848fe185b2"],
+ ["ed8191", "e1848fe185b2e186a8"],
+ ["ed8191", "ed8190e186a8"],
+ ["ed8192", "e1848fe185b2e186a9"],
+ ["ed8192", "ed8190e186a9"],
+ ["ed8193", "e1848fe185b2e186aa"],
+ ["ed8193", "ed8190e186aa"],
+ ["ed8194", "e1848fe185b2e186ab"],
+ ["ed8194", "ed8190e186ab"],
+ ["ed8195", "e1848fe185b2e186ac"],
+ ["ed8195", "ed8190e186ac"],
+ ["ed8196", "e1848fe185b2e186ad"],
+ ["ed8196", "ed8190e186ad"],
+ ["ed8197", "e1848fe185b2e186ae"],
+ ["ed8197", "ed8190e186ae"],
+ ["ed8198", "e1848fe185b2e186af"],
+ ["ed8198", "ed8190e186af"],
+ ["ed8199", "e1848fe185b2e186b0"],
+ ["ed8199", "ed8190e186b0"],
+ ["ed819a", "e1848fe185b2e186b1"],
+ ["ed819a", "ed8190e186b1"],
+ ["ed819b", "e1848fe185b2e186b2"],
+ ["ed819b", "ed8190e186b2"],
+ ["ed819c", "e1848fe185b2e186b3"],
+ ["ed819c", "ed8190e186b3"],
+ ["ed819d", "e1848fe185b2e186b4"],
+ ["ed819d", "ed8190e186b4"],
+ ["ed819e", "e1848fe185b2e186b5"],
+ ["ed819e", "ed8190e186b5"],
+ ["ed819f", "e1848fe185b2e186b6"],
+ ["ed819f", "ed8190e186b6"],
+ ["ed81a0", "e1848fe185b2e186b7"],
+ ["ed81a0", "ed8190e186b7"],
+ ["ed81a1", "e1848fe185b2e186b8"],
+ ["ed81a1", "ed8190e186b8"],
+ ["ed81a2", "e1848fe185b2e186b9"],
+ ["ed81a2", "ed8190e186b9"],
+ ["ed81a3", "e1848fe185b2e186ba"],
+ ["ed81a3", "ed8190e186ba"],
+ ["ed81a4", "e1848fe185b2e186bb"],
+ ["ed81a4", "ed8190e186bb"],
+ ["ed81a5", "e1848fe185b2e186bc"],
+ ["ed81a5", "ed8190e186bc"],
+ ["ed81a6", "e1848fe185b2e186bd"],
+ ["ed81a6", "ed8190e186bd"],
+ ["ed81a7", "e1848fe185b2e186be"],
+ ["ed81a7", "ed8190e186be"],
+ ["ed81a8", "e1848fe185b2e186bf"],
+ ["ed81a8", "ed8190e186bf"],
+ ["ed81a9", "e1848fe185b2e18780"],
+ ["ed81a9", "ed8190e18780"],
+ ["ed81aa", "e1848fe185b2e18781"],
+ ["ed81aa", "ed8190e18781"],
+ ["ed81ab", "e1848fe185b2e18782"],
+ ["ed81ab", "ed8190e18782"],
+ ["ed81ac", "e1848fe185b3"],
+ ["ed81ad", "e1848fe185b3e186a8"],
+ ["ed81ad", "ed81ace186a8"],
+ ["ed81ae", "e1848fe185b3e186a9"],
+ ["ed81ae", "ed81ace186a9"],
+ ["ed81af", "e1848fe185b3e186aa"],
+ ["ed81af", "ed81ace186aa"],
+ ["ed81b0", "e1848fe185b3e186ab"],
+ ["ed81b0", "ed81ace186ab"],
+ ["ed81b1", "e1848fe185b3e186ac"],
+ ["ed81b1", "ed81ace186ac"],
+ ["ed81b2", "e1848fe185b3e186ad"],
+ ["ed81b2", "ed81ace186ad"],
+ ["ed81b3", "e1848fe185b3e186ae"],
+ ["ed81b3", "ed81ace186ae"],
+ ["ed81b4", "e1848fe185b3e186af"],
+ ["ed81b4", "ed81ace186af"],
+ ["ed81b5", "e1848fe185b3e186b0"],
+ ["ed81b5", "ed81ace186b0"],
+ ["ed81b6", "e1848fe185b3e186b1"],
+ ["ed81b6", "ed81ace186b1"],
+ ["ed81b7", "e1848fe185b3e186b2"],
+ ["ed81b7", "ed81ace186b2"],
+ ["ed81b8", "e1848fe185b3e186b3"],
+ ["ed81b8", "ed81ace186b3"],
+ ["ed81b9", "e1848fe185b3e186b4"],
+ ["ed81b9", "ed81ace186b4"],
+ ["ed81ba", "e1848fe185b3e186b5"],
+ ["ed81ba", "ed81ace186b5"],
+ ["ed81bb", "e1848fe185b3e186b6"],
+ ["ed81bb", "ed81ace186b6"],
+ ["ed81bc", "e1848fe185b3e186b7"],
+ ["ed81bc", "ed81ace186b7"],
+ ["ed81bd", "e1848fe185b3e186b8"],
+ ["ed81bd", "ed81ace186b8"],
+ ["ed81be", "e1848fe185b3e186b9"],
+ ["ed81be", "ed81ace186b9"],
+ ["ed81bf", "e1848fe185b3e186ba"],
+ ["ed81bf", "ed81ace186ba"],
+ ["ed8280", "e1848fe185b3e186bb"],
+ ["ed8280", "ed81ace186bb"],
+ ["ed8281", "e1848fe185b3e186bc"],
+ ["ed8281", "ed81ace186bc"],
+ ["ed8282", "e1848fe185b3e186bd"],
+ ["ed8282", "ed81ace186bd"],
+ ["ed8283", "e1848fe185b3e186be"],
+ ["ed8283", "ed81ace186be"],
+ ["ed8284", "e1848fe185b3e186bf"],
+ ["ed8284", "ed81ace186bf"],
+ ["ed8285", "e1848fe185b3e18780"],
+ ["ed8285", "ed81ace18780"],
+ ["ed8286", "e1848fe185b3e18781"],
+ ["ed8286", "ed81ace18781"],
+ ["ed8287", "e1848fe185b3e18782"],
+ ["ed8287", "ed81ace18782"],
+ ["ed8288", "e1848fe185b4"],
+ ["ed8289", "e1848fe185b4e186a8"],
+ ["ed8289", "ed8288e186a8"],
+ ["ed828a", "e1848fe185b4e186a9"],
+ ["ed828a", "ed8288e186a9"],
+ ["ed828b", "e1848fe185b4e186aa"],
+ ["ed828b", "ed8288e186aa"],
+ ["ed828c", "e1848fe185b4e186ab"],
+ ["ed828c", "ed8288e186ab"],
+ ["ed828d", "e1848fe185b4e186ac"],
+ ["ed828d", "ed8288e186ac"],
+ ["ed828e", "e1848fe185b4e186ad"],
+ ["ed828e", "ed8288e186ad"],
+ ["ed828f", "e1848fe185b4e186ae"],
+ ["ed828f", "ed8288e186ae"],
+ ["ed8290", "e1848fe185b4e186af"],
+ ["ed8290", "ed8288e186af"],
+ ["ed8291", "e1848fe185b4e186b0"],
+ ["ed8291", "ed8288e186b0"],
+ ["ed8292", "e1848fe185b4e186b1"],
+ ["ed8292", "ed8288e186b1"],
+ ["ed8293", "e1848fe185b4e186b2"],
+ ["ed8293", "ed8288e186b2"],
+ ["ed8294", "e1848fe185b4e186b3"],
+ ["ed8294", "ed8288e186b3"],
+ ["ed8295", "e1848fe185b4e186b4"],
+ ["ed8295", "ed8288e186b4"],
+ ["ed8296", "e1848fe185b4e186b5"],
+ ["ed8296", "ed8288e186b5"],
+ ["ed8297", "e1848fe185b4e186b6"],
+ ["ed8297", "ed8288e186b6"],
+ ["ed8298", "e1848fe185b4e186b7"],
+ ["ed8298", "ed8288e186b7"],
+ ["ed8299", "e1848fe185b4e186b8"],
+ ["ed8299", "ed8288e186b8"],
+ ["ed829a", "e1848fe185b4e186b9"],
+ ["ed829a", "ed8288e186b9"],
+ ["ed829b", "e1848fe185b4e186ba"],
+ ["ed829b", "ed8288e186ba"],
+ ["ed829c", "e1848fe185b4e186bb"],
+ ["ed829c", "ed8288e186bb"],
+ ["ed829d", "e1848fe185b4e186bc"],
+ ["ed829d", "ed8288e186bc"],
+ ["ed829e", "e1848fe185b4e186bd"],
+ ["ed829e", "ed8288e186bd"],
+ ["ed829f", "e1848fe185b4e186be"],
+ ["ed829f", "ed8288e186be"],
+ ["ed82a0", "e1848fe185b4e186bf"],
+ ["ed82a0", "ed8288e186bf"],
+ ["ed82a1", "e1848fe185b4e18780"],
+ ["ed82a1", "ed8288e18780"],
+ ["ed82a2", "e1848fe185b4e18781"],
+ ["ed82a2", "ed8288e18781"],
+ ["ed82a3", "e1848fe185b4e18782"],
+ ["ed82a3", "ed8288e18782"],
+ ["ed82a4", "e1848fe185b5"],
+ ["ed82a5", "e1848fe185b5e186a8"],
+ ["ed82a5", "ed82a4e186a8"],
+ ["ed82a6", "e1848fe185b5e186a9"],
+ ["ed82a6", "ed82a4e186a9"],
+ ["ed82a7", "e1848fe185b5e186aa"],
+ ["ed82a7", "ed82a4e186aa"],
+ ["ed82a8", "e1848fe185b5e186ab"],
+ ["ed82a8", "ed82a4e186ab"],
+ ["ed82a9", "e1848fe185b5e186ac"],
+ ["ed82a9", "ed82a4e186ac"],
+ ["ed82aa", "e1848fe185b5e186ad"],
+ ["ed82aa", "ed82a4e186ad"],
+ ["ed82ab", "e1848fe185b5e186ae"],
+ ["ed82ab", "ed82a4e186ae"],
+ ["ed82ac", "e1848fe185b5e186af"],
+ ["ed82ac", "ed82a4e186af"],
+ ["ed82ad", "e1848fe185b5e186b0"],
+ ["ed82ad", "ed82a4e186b0"],
+ ["ed82ae", "e1848fe185b5e186b1"],
+ ["ed82ae", "ed82a4e186b1"],
+ ["ed82af", "e1848fe185b5e186b2"],
+ ["ed82af", "ed82a4e186b2"],
+ ["ed82b0", "e1848fe185b5e186b3"],
+ ["ed82b0", "ed82a4e186b3"],
+ ["ed82b1", "e1848fe185b5e186b4"],
+ ["ed82b1", "ed82a4e186b4"],
+ ["ed82b2", "e1848fe185b5e186b5"],
+ ["ed82b2", "ed82a4e186b5"],
+ ["ed82b3", "e1848fe185b5e186b6"],
+ ["ed82b3", "ed82a4e186b6"],
+ ["ed82b4", "e1848fe185b5e186b7"],
+ ["ed82b4", "ed82a4e186b7"],
+ ["ed82b5", "e1848fe185b5e186b8"],
+ ["ed82b5", "ed82a4e186b8"],
+ ["ed82b6", "e1848fe185b5e186b9"],
+ ["ed82b6", "ed82a4e186b9"],
+ ["ed82b7", "e1848fe185b5e186ba"],
+ ["ed82b7", "ed82a4e186ba"],
+ ["ed82b8", "e1848fe185b5e186bb"],
+ ["ed82b8", "ed82a4e186bb"],
+ ["ed82b9", "e1848fe185b5e186bc"],
+ ["ed82b9", "ed82a4e186bc"],
+ ["ed82ba", "e1848fe185b5e186bd"],
+ ["ed82ba", "ed82a4e186bd"],
+ ["ed82bb", "e1848fe185b5e186be"],
+ ["ed82bb", "ed82a4e186be"],
+ ["ed82bc", "e1848fe185b5e186bf"],
+ ["ed82bc", "ed82a4e186bf"],
+ ["ed82bd", "e1848fe185b5e18780"],
+ ["ed82bd", "ed82a4e18780"],
+ ["ed82be", "e1848fe185b5e18781"],
+ ["ed82be", "ed82a4e18781"],
+ ["ed82bf", "e1848fe185b5e18782"],
+ ["ed82bf", "ed82a4e18782"],
+ ["ed8380", "e18490e185a1"],
+ ["ed8381", "e18490e185a1e186a8"],
+ ["ed8381", "ed8380e186a8"],
+ ["ed8382", "e18490e185a1e186a9"],
+ ["ed8382", "ed8380e186a9"],
+ ["ed8383", "e18490e185a1e186aa"],
+ ["ed8383", "ed8380e186aa"],
+ ["ed8384", "e18490e185a1e186ab"],
+ ["ed8384", "ed8380e186ab"],
+ ["ed8385", "e18490e185a1e186ac"],
+ ["ed8385", "ed8380e186ac"],
+ ["ed8386", "e18490e185a1e186ad"],
+ ["ed8386", "ed8380e186ad"],
+ ["ed8387", "e18490e185a1e186ae"],
+ ["ed8387", "ed8380e186ae"],
+ ["ed8388", "e18490e185a1e186af"],
+ ["ed8388", "ed8380e186af"],
+ ["ed8389", "e18490e185a1e186b0"],
+ ["ed8389", "ed8380e186b0"],
+ ["ed838a", "e18490e185a1e186b1"],
+ ["ed838a", "ed8380e186b1"],
+ ["ed838b", "e18490e185a1e186b2"],
+ ["ed838b", "ed8380e186b2"],
+ ["ed838c", "e18490e185a1e186b3"],
+ ["ed838c", "ed8380e186b3"],
+ ["ed838d", "e18490e185a1e186b4"],
+ ["ed838d", "ed8380e186b4"],
+ ["ed838e", "e18490e185a1e186b5"],
+ ["ed838e", "ed8380e186b5"],
+ ["ed838f", "e18490e185a1e186b6"],
+ ["ed838f", "ed8380e186b6"],
+ ["ed8390", "e18490e185a1e186b7"],
+ ["ed8390", "ed8380e186b7"],
+ ["ed8391", "e18490e185a1e186b8"],
+ ["ed8391", "ed8380e186b8"],
+ ["ed8392", "e18490e185a1e186b9"],
+ ["ed8392", "ed8380e186b9"],
+ ["ed8393", "e18490e185a1e186ba"],
+ ["ed8393", "ed8380e186ba"],
+ ["ed8394", "e18490e185a1e186bb"],
+ ["ed8394", "ed8380e186bb"],
+ ["ed8395", "e18490e185a1e186bc"],
+ ["ed8395", "ed8380e186bc"],
+ ["ed8396", "e18490e185a1e186bd"],
+ ["ed8396", "ed8380e186bd"],
+ ["ed8397", "e18490e185a1e186be"],
+ ["ed8397", "ed8380e186be"],
+ ["ed8398", "e18490e185a1e186bf"],
+ ["ed8398", "ed8380e186bf"],
+ ["ed8399", "e18490e185a1e18780"],
+ ["ed8399", "ed8380e18780"],
+ ["ed839a", "e18490e185a1e18781"],
+ ["ed839a", "ed8380e18781"],
+ ["ed839b", "e18490e185a1e18782"],
+ ["ed839b", "ed8380e18782"],
+ ["ed839c", "e18490e185a2"],
+ ["ed839d", "e18490e185a2e186a8"],
+ ["ed839d", "ed839ce186a8"],
+ ["ed839e", "e18490e185a2e186a9"],
+ ["ed839e", "ed839ce186a9"],
+ ["ed839f", "e18490e185a2e186aa"],
+ ["ed839f", "ed839ce186aa"],
+ ["ed83a0", "e18490e185a2e186ab"],
+ ["ed83a0", "ed839ce186ab"],
+ ["ed83a1", "e18490e185a2e186ac"],
+ ["ed83a1", "ed839ce186ac"],
+ ["ed83a2", "e18490e185a2e186ad"],
+ ["ed83a2", "ed839ce186ad"],
+ ["ed83a3", "e18490e185a2e186ae"],
+ ["ed83a3", "ed839ce186ae"],
+ ["ed83a4", "e18490e185a2e186af"],
+ ["ed83a4", "ed839ce186af"],
+ ["ed83a5", "e18490e185a2e186b0"],
+ ["ed83a5", "ed839ce186b0"],
+ ["ed83a6", "e18490e185a2e186b1"],
+ ["ed83a6", "ed839ce186b1"],
+ ["ed83a7", "e18490e185a2e186b2"],
+ ["ed83a7", "ed839ce186b2"],
+ ["ed83a8", "e18490e185a2e186b3"],
+ ["ed83a8", "ed839ce186b3"],
+ ["ed83a9", "e18490e185a2e186b4"],
+ ["ed83a9", "ed839ce186b4"],
+ ["ed83aa", "e18490e185a2e186b5"],
+ ["ed83aa", "ed839ce186b5"],
+ ["ed83ab", "e18490e185a2e186b6"],
+ ["ed83ab", "ed839ce186b6"],
+ ["ed83ac", "e18490e185a2e186b7"],
+ ["ed83ac", "ed839ce186b7"],
+ ["ed83ad", "e18490e185a2e186b8"],
+ ["ed83ad", "ed839ce186b8"],
+ ["ed83ae", "e18490e185a2e186b9"],
+ ["ed83ae", "ed839ce186b9"],
+ ["ed83af", "e18490e185a2e186ba"],
+ ["ed83af", "ed839ce186ba"],
+ ["ed83b0", "e18490e185a2e186bb"],
+ ["ed83b0", "ed839ce186bb"],
+ ["ed83b1", "e18490e185a2e186bc"],
+ ["ed83b1", "ed839ce186bc"],
+ ["ed83b2", "e18490e185a2e186bd"],
+ ["ed83b2", "ed839ce186bd"],
+ ["ed83b3", "e18490e185a2e186be"],
+ ["ed83b3", "ed839ce186be"],
+ ["ed83b4", "e18490e185a2e186bf"],
+ ["ed83b4", "ed839ce186bf"],
+ ["ed83b5", "e18490e185a2e18780"],
+ ["ed83b5", "ed839ce18780"],
+ ["ed83b6", "e18490e185a2e18781"],
+ ["ed83b6", "ed839ce18781"],
+ ["ed83b7", "e18490e185a2e18782"],
+ ["ed83b7", "ed839ce18782"],
+ ["ed83b8", "e18490e185a3"],
+ ["ed83b9", "e18490e185a3e186a8"],
+ ["ed83b9", "ed83b8e186a8"],
+ ["ed83ba", "e18490e185a3e186a9"],
+ ["ed83ba", "ed83b8e186a9"],
+ ["ed83bb", "e18490e185a3e186aa"],
+ ["ed83bb", "ed83b8e186aa"],
+ ["ed83bc", "e18490e185a3e186ab"],
+ ["ed83bc", "ed83b8e186ab"],
+ ["ed83bd", "e18490e185a3e186ac"],
+ ["ed83bd", "ed83b8e186ac"],
+ ["ed83be", "e18490e185a3e186ad"],
+ ["ed83be", "ed83b8e186ad"],
+ ["ed83bf", "e18490e185a3e186ae"],
+ ["ed83bf", "ed83b8e186ae"],
+ ["ed8480", "e18490e185a3e186af"],
+ ["ed8480", "ed83b8e186af"],
+ ["ed8481", "e18490e185a3e186b0"],
+ ["ed8481", "ed83b8e186b0"],
+ ["ed8482", "e18490e185a3e186b1"],
+ ["ed8482", "ed83b8e186b1"],
+ ["ed8483", "e18490e185a3e186b2"],
+ ["ed8483", "ed83b8e186b2"],
+ ["ed8484", "e18490e185a3e186b3"],
+ ["ed8484", "ed83b8e186b3"],
+ ["ed8485", "e18490e185a3e186b4"],
+ ["ed8485", "ed83b8e186b4"],
+ ["ed8486", "e18490e185a3e186b5"],
+ ["ed8486", "ed83b8e186b5"],
+ ["ed8487", "e18490e185a3e186b6"],
+ ["ed8487", "ed83b8e186b6"],
+ ["ed8488", "e18490e185a3e186b7"],
+ ["ed8488", "ed83b8e186b7"],
+ ["ed8489", "e18490e185a3e186b8"],
+ ["ed8489", "ed83b8e186b8"],
+ ["ed848a", "e18490e185a3e186b9"],
+ ["ed848a", "ed83b8e186b9"],
+ ["ed848b", "e18490e185a3e186ba"],
+ ["ed848b", "ed83b8e186ba"],
+ ["ed848c", "e18490e185a3e186bb"],
+ ["ed848c", "ed83b8e186bb"],
+ ["ed848d", "e18490e185a3e186bc"],
+ ["ed848d", "ed83b8e186bc"],
+ ["ed848e", "e18490e185a3e186bd"],
+ ["ed848e", "ed83b8e186bd"],
+ ["ed848f", "e18490e185a3e186be"],
+ ["ed848f", "ed83b8e186be"],
+ ["ed8490", "e18490e185a3e186bf"],
+ ["ed8490", "ed83b8e186bf"],
+ ["ed8491", "e18490e185a3e18780"],
+ ["ed8491", "ed83b8e18780"],
+ ["ed8492", "e18490e185a3e18781"],
+ ["ed8492", "ed83b8e18781"],
+ ["ed8493", "e18490e185a3e18782"],
+ ["ed8493", "ed83b8e18782"],
+ ["ed8494", "e18490e185a4"],
+ ["ed8495", "e18490e185a4e186a8"],
+ ["ed8495", "ed8494e186a8"],
+ ["ed8496", "e18490e185a4e186a9"],
+ ["ed8496", "ed8494e186a9"],
+ ["ed8497", "e18490e185a4e186aa"],
+ ["ed8497", "ed8494e186aa"],
+ ["ed8498", "e18490e185a4e186ab"],
+ ["ed8498", "ed8494e186ab"],
+ ["ed8499", "e18490e185a4e186ac"],
+ ["ed8499", "ed8494e186ac"],
+ ["ed849a", "e18490e185a4e186ad"],
+ ["ed849a", "ed8494e186ad"],
+ ["ed849b", "e18490e185a4e186ae"],
+ ["ed849b", "ed8494e186ae"],
+ ["ed849c", "e18490e185a4e186af"],
+ ["ed849c", "ed8494e186af"],
+ ["ed849d", "e18490e185a4e186b0"],
+ ["ed849d", "ed8494e186b0"],
+ ["ed849e", "e18490e185a4e186b1"],
+ ["ed849e", "ed8494e186b1"],
+ ["ed849f", "e18490e185a4e186b2"],
+ ["ed849f", "ed8494e186b2"],
+ ["ed84a0", "e18490e185a4e186b3"],
+ ["ed84a0", "ed8494e186b3"],
+ ["ed84a1", "e18490e185a4e186b4"],
+ ["ed84a1", "ed8494e186b4"],
+ ["ed84a2", "e18490e185a4e186b5"],
+ ["ed84a2", "ed8494e186b5"],
+ ["ed84a3", "e18490e185a4e186b6"],
+ ["ed84a3", "ed8494e186b6"],
+ ["ed84a4", "e18490e185a4e186b7"],
+ ["ed84a4", "ed8494e186b7"],
+ ["ed84a5", "e18490e185a4e186b8"],
+ ["ed84a5", "ed8494e186b8"],
+ ["ed84a6", "e18490e185a4e186b9"],
+ ["ed84a6", "ed8494e186b9"],
+ ["ed84a7", "e18490e185a4e186ba"],
+ ["ed84a7", "ed8494e186ba"],
+ ["ed84a8", "e18490e185a4e186bb"],
+ ["ed84a8", "ed8494e186bb"],
+ ["ed84a9", "e18490e185a4e186bc"],
+ ["ed84a9", "ed8494e186bc"],
+ ["ed84aa", "e18490e185a4e186bd"],
+ ["ed84aa", "ed8494e186bd"],
+ ["ed84ab", "e18490e185a4e186be"],
+ ["ed84ab", "ed8494e186be"],
+ ["ed84ac", "e18490e185a4e186bf"],
+ ["ed84ac", "ed8494e186bf"],
+ ["ed84ad", "e18490e185a4e18780"],
+ ["ed84ad", "ed8494e18780"],
+ ["ed84ae", "e18490e185a4e18781"],
+ ["ed84ae", "ed8494e18781"],
+ ["ed84af", "e18490e185a4e18782"],
+ ["ed84af", "ed8494e18782"],
+ ["ed84b0", "e18490e185a5"],
+ ["ed84b1", "e18490e185a5e186a8"],
+ ["ed84b1", "ed84b0e186a8"],
+ ["ed84b2", "e18490e185a5e186a9"],
+ ["ed84b2", "ed84b0e186a9"],
+ ["ed84b3", "e18490e185a5e186aa"],
+ ["ed84b3", "ed84b0e186aa"],
+ ["ed84b4", "e18490e185a5e186ab"],
+ ["ed84b4", "ed84b0e186ab"],
+ ["ed84b5", "e18490e185a5e186ac"],
+ ["ed84b5", "ed84b0e186ac"],
+ ["ed84b6", "e18490e185a5e186ad"],
+ ["ed84b6", "ed84b0e186ad"],
+ ["ed84b7", "e18490e185a5e186ae"],
+ ["ed84b7", "ed84b0e186ae"],
+ ["ed84b8", "e18490e185a5e186af"],
+ ["ed84b8", "ed84b0e186af"],
+ ["ed84b9", "e18490e185a5e186b0"],
+ ["ed84b9", "ed84b0e186b0"],
+ ["ed84ba", "e18490e185a5e186b1"],
+ ["ed84ba", "ed84b0e186b1"],
+ ["ed84bb", "e18490e185a5e186b2"],
+ ["ed84bb", "ed84b0e186b2"],
+ ["ed84bc", "e18490e185a5e186b3"],
+ ["ed84bc", "ed84b0e186b3"],
+ ["ed84bd", "e18490e185a5e186b4"],
+ ["ed84bd", "ed84b0e186b4"],
+ ["ed84be", "e18490e185a5e186b5"],
+ ["ed84be", "ed84b0e186b5"],
+ ["ed84bf", "e18490e185a5e186b6"],
+ ["ed84bf", "ed84b0e186b6"],
+ ["ed8580", "e18490e185a5e186b7"],
+ ["ed8580", "ed84b0e186b7"],
+ ["ed8581", "e18490e185a5e186b8"],
+ ["ed8581", "ed84b0e186b8"],
+ ["ed8582", "e18490e185a5e186b9"],
+ ["ed8582", "ed84b0e186b9"],
+ ["ed8583", "e18490e185a5e186ba"],
+ ["ed8583", "ed84b0e186ba"],
+ ["ed8584", "e18490e185a5e186bb"],
+ ["ed8584", "ed84b0e186bb"],
+ ["ed8585", "e18490e185a5e186bc"],
+ ["ed8585", "ed84b0e186bc"],
+ ["ed8586", "e18490e185a5e186bd"],
+ ["ed8586", "ed84b0e186bd"],
+ ["ed8587", "e18490e185a5e186be"],
+ ["ed8587", "ed84b0e186be"],
+ ["ed8588", "e18490e185a5e186bf"],
+ ["ed8588", "ed84b0e186bf"],
+ ["ed8589", "e18490e185a5e18780"],
+ ["ed8589", "ed84b0e18780"],
+ ["ed858a", "e18490e185a5e18781"],
+ ["ed858a", "ed84b0e18781"],
+ ["ed858b", "e18490e185a5e18782"],
+ ["ed858b", "ed84b0e18782"],
+ ["ed858c", "e18490e185a6"],
+ ["ed858d", "e18490e185a6e186a8"],
+ ["ed858d", "ed858ce186a8"],
+ ["ed858e", "e18490e185a6e186a9"],
+ ["ed858e", "ed858ce186a9"],
+ ["ed858f", "e18490e185a6e186aa"],
+ ["ed858f", "ed858ce186aa"],
+ ["ed8590", "e18490e185a6e186ab"],
+ ["ed8590", "ed858ce186ab"],
+ ["ed8591", "e18490e185a6e186ac"],
+ ["ed8591", "ed858ce186ac"],
+ ["ed8592", "e18490e185a6e186ad"],
+ ["ed8592", "ed858ce186ad"],
+ ["ed8593", "e18490e185a6e186ae"],
+ ["ed8593", "ed858ce186ae"],
+ ["ed8594", "e18490e185a6e186af"],
+ ["ed8594", "ed858ce186af"],
+ ["ed8595", "e18490e185a6e186b0"],
+ ["ed8595", "ed858ce186b0"],
+ ["ed8596", "e18490e185a6e186b1"],
+ ["ed8596", "ed858ce186b1"],
+ ["ed8597", "e18490e185a6e186b2"],
+ ["ed8597", "ed858ce186b2"],
+ ["ed8598", "e18490e185a6e186b3"],
+ ["ed8598", "ed858ce186b3"],
+ ["ed8599", "e18490e185a6e186b4"],
+ ["ed8599", "ed858ce186b4"],
+ ["ed859a", "e18490e185a6e186b5"],
+ ["ed859a", "ed858ce186b5"],
+ ["ed859b", "e18490e185a6e186b6"],
+ ["ed859b", "ed858ce186b6"],
+ ["ed859c", "e18490e185a6e186b7"],
+ ["ed859c", "ed858ce186b7"],
+ ["ed859d", "e18490e185a6e186b8"],
+ ["ed859d", "ed858ce186b8"],
+ ["ed859e", "e18490e185a6e186b9"],
+ ["ed859e", "ed858ce186b9"],
+ ["ed859f", "e18490e185a6e186ba"],
+ ["ed859f", "ed858ce186ba"],
+ ["ed85a0", "e18490e185a6e186bb"],
+ ["ed85a0", "ed858ce186bb"],
+ ["ed85a1", "e18490e185a6e186bc"],
+ ["ed85a1", "ed858ce186bc"],
+ ["ed85a2", "e18490e185a6e186bd"],
+ ["ed85a2", "ed858ce186bd"],
+ ["ed85a3", "e18490e185a6e186be"],
+ ["ed85a3", "ed858ce186be"],
+ ["ed85a4", "e18490e185a6e186bf"],
+ ["ed85a4", "ed858ce186bf"],
+ ["ed85a5", "e18490e185a6e18780"],
+ ["ed85a5", "ed858ce18780"],
+ ["ed85a6", "e18490e185a6e18781"],
+ ["ed85a6", "ed858ce18781"],
+ ["ed85a7", "e18490e185a6e18782"],
+ ["ed85a7", "ed858ce18782"],
+ ["ed85a8", "e18490e185a7"],
+ ["ed85a9", "e18490e185a7e186a8"],
+ ["ed85a9", "ed85a8e186a8"],
+ ["ed85aa", "e18490e185a7e186a9"],
+ ["ed85aa", "ed85a8e186a9"],
+ ["ed85ab", "e18490e185a7e186aa"],
+ ["ed85ab", "ed85a8e186aa"],
+ ["ed85ac", "e18490e185a7e186ab"],
+ ["ed85ac", "ed85a8e186ab"],
+ ["ed85ad", "e18490e185a7e186ac"],
+ ["ed85ad", "ed85a8e186ac"],
+ ["ed85ae", "e18490e185a7e186ad"],
+ ["ed85ae", "ed85a8e186ad"],
+ ["ed85af", "e18490e185a7e186ae"],
+ ["ed85af", "ed85a8e186ae"],
+ ["ed85b0", "e18490e185a7e186af"],
+ ["ed85b0", "ed85a8e186af"],
+ ["ed85b1", "e18490e185a7e186b0"],
+ ["ed85b1", "ed85a8e186b0"],
+ ["ed85b2", "e18490e185a7e186b1"],
+ ["ed85b2", "ed85a8e186b1"],
+ ["ed85b3", "e18490e185a7e186b2"],
+ ["ed85b3", "ed85a8e186b2"],
+ ["ed85b4", "e18490e185a7e186b3"],
+ ["ed85b4", "ed85a8e186b3"],
+ ["ed85b5", "e18490e185a7e186b4"],
+ ["ed85b5", "ed85a8e186b4"],
+ ["ed85b6", "e18490e185a7e186b5"],
+ ["ed85b6", "ed85a8e186b5"],
+ ["ed85b7", "e18490e185a7e186b6"],
+ ["ed85b7", "ed85a8e186b6"],
+ ["ed85b8", "e18490e185a7e186b7"],
+ ["ed85b8", "ed85a8e186b7"],
+ ["ed85b9", "e18490e185a7e186b8"],
+ ["ed85b9", "ed85a8e186b8"],
+ ["ed85ba", "e18490e185a7e186b9"],
+ ["ed85ba", "ed85a8e186b9"],
+ ["ed85bb", "e18490e185a7e186ba"],
+ ["ed85bb", "ed85a8e186ba"],
+ ["ed85bc", "e18490e185a7e186bb"],
+ ["ed85bc", "ed85a8e186bb"],
+ ["ed85bd", "e18490e185a7e186bc"],
+ ["ed85bd", "ed85a8e186bc"],
+ ["ed85be", "e18490e185a7e186bd"],
+ ["ed85be", "ed85a8e186bd"],
+ ["ed85bf", "e18490e185a7e186be"],
+ ["ed85bf", "ed85a8e186be"],
+ ["ed8680", "e18490e185a7e186bf"],
+ ["ed8680", "ed85a8e186bf"],
+ ["ed8681", "e18490e185a7e18780"],
+ ["ed8681", "ed85a8e18780"],
+ ["ed8682", "e18490e185a7e18781"],
+ ["ed8682", "ed85a8e18781"],
+ ["ed8683", "e18490e185a7e18782"],
+ ["ed8683", "ed85a8e18782"],
+ ["ed8684", "e18490e185a8"],
+ ["ed8685", "e18490e185a8e186a8"],
+ ["ed8685", "ed8684e186a8"],
+ ["ed8686", "e18490e185a8e186a9"],
+ ["ed8686", "ed8684e186a9"],
+ ["ed8687", "e18490e185a8e186aa"],
+ ["ed8687", "ed8684e186aa"],
+ ["ed8688", "e18490e185a8e186ab"],
+ ["ed8688", "ed8684e186ab"],
+ ["ed8689", "e18490e185a8e186ac"],
+ ["ed8689", "ed8684e186ac"],
+ ["ed868a", "e18490e185a8e186ad"],
+ ["ed868a", "ed8684e186ad"],
+ ["ed868b", "e18490e185a8e186ae"],
+ ["ed868b", "ed8684e186ae"],
+ ["ed868c", "e18490e185a8e186af"],
+ ["ed868c", "ed8684e186af"],
+ ["ed868d", "e18490e185a8e186b0"],
+ ["ed868d", "ed8684e186b0"],
+ ["ed868e", "e18490e185a8e186b1"],
+ ["ed868e", "ed8684e186b1"],
+ ["ed868f", "e18490e185a8e186b2"],
+ ["ed868f", "ed8684e186b2"],
+ ["ed8690", "e18490e185a8e186b3"],
+ ["ed8690", "ed8684e186b3"],
+ ["ed8691", "e18490e185a8e186b4"],
+ ["ed8691", "ed8684e186b4"],
+ ["ed8692", "e18490e185a8e186b5"],
+ ["ed8692", "ed8684e186b5"],
+ ["ed8693", "e18490e185a8e186b6"],
+ ["ed8693", "ed8684e186b6"],
+ ["ed8694", "e18490e185a8e186b7"],
+ ["ed8694", "ed8684e186b7"],
+ ["ed8695", "e18490e185a8e186b8"],
+ ["ed8695", "ed8684e186b8"],
+ ["ed8696", "e18490e185a8e186b9"],
+ ["ed8696", "ed8684e186b9"],
+ ["ed8697", "e18490e185a8e186ba"],
+ ["ed8697", "ed8684e186ba"],
+ ["ed8698", "e18490e185a8e186bb"],
+ ["ed8698", "ed8684e186bb"],
+ ["ed8699", "e18490e185a8e186bc"],
+ ["ed8699", "ed8684e186bc"],
+ ["ed869a", "e18490e185a8e186bd"],
+ ["ed869a", "ed8684e186bd"],
+ ["ed869b", "e18490e185a8e186be"],
+ ["ed869b", "ed8684e186be"],
+ ["ed869c", "e18490e185a8e186bf"],
+ ["ed869c", "ed8684e186bf"],
+ ["ed869d", "e18490e185a8e18780"],
+ ["ed869d", "ed8684e18780"],
+ ["ed869e", "e18490e185a8e18781"],
+ ["ed869e", "ed8684e18781"],
+ ["ed869f", "e18490e185a8e18782"],
+ ["ed869f", "ed8684e18782"],
+ ["ed86a0", "e18490e185a9"],
+ ["ed86a1", "e18490e185a9e186a8"],
+ ["ed86a1", "ed86a0e186a8"],
+ ["ed86a2", "e18490e185a9e186a9"],
+ ["ed86a2", "ed86a0e186a9"],
+ ["ed86a3", "e18490e185a9e186aa"],
+ ["ed86a3", "ed86a0e186aa"],
+ ["ed86a4", "e18490e185a9e186ab"],
+ ["ed86a4", "ed86a0e186ab"],
+ ["ed86a5", "e18490e185a9e186ac"],
+ ["ed86a5", "ed86a0e186ac"],
+ ["ed86a6", "e18490e185a9e186ad"],
+ ["ed86a6", "ed86a0e186ad"],
+ ["ed86a7", "e18490e185a9e186ae"],
+ ["ed86a7", "ed86a0e186ae"],
+ ["ed86a8", "e18490e185a9e186af"],
+ ["ed86a8", "ed86a0e186af"],
+ ["ed86a9", "e18490e185a9e186b0"],
+ ["ed86a9", "ed86a0e186b0"],
+ ["ed86aa", "e18490e185a9e186b1"],
+ ["ed86aa", "ed86a0e186b1"],
+ ["ed86ab", "e18490e185a9e186b2"],
+ ["ed86ab", "ed86a0e186b2"],
+ ["ed86ac", "e18490e185a9e186b3"],
+ ["ed86ac", "ed86a0e186b3"],
+ ["ed86ad", "e18490e185a9e186b4"],
+ ["ed86ad", "ed86a0e186b4"],
+ ["ed86ae", "e18490e185a9e186b5"],
+ ["ed86ae", "ed86a0e186b5"],
+ ["ed86af", "e18490e185a9e186b6"],
+ ["ed86af", "ed86a0e186b6"],
+ ["ed86b0", "e18490e185a9e186b7"],
+ ["ed86b0", "ed86a0e186b7"],
+ ["ed86b1", "e18490e185a9e186b8"],
+ ["ed86b1", "ed86a0e186b8"],
+ ["ed86b2", "e18490e185a9e186b9"],
+ ["ed86b2", "ed86a0e186b9"],
+ ["ed86b3", "e18490e185a9e186ba"],
+ ["ed86b3", "ed86a0e186ba"],
+ ["ed86b4", "e18490e185a9e186bb"],
+ ["ed86b4", "ed86a0e186bb"],
+ ["ed86b5", "e18490e185a9e186bc"],
+ ["ed86b5", "ed86a0e186bc"],
+ ["ed86b6", "e18490e185a9e186bd"],
+ ["ed86b6", "ed86a0e186bd"],
+ ["ed86b7", "e18490e185a9e186be"],
+ ["ed86b7", "ed86a0e186be"],
+ ["ed86b8", "e18490e185a9e186bf"],
+ ["ed86b8", "ed86a0e186bf"],
+ ["ed86b9", "e18490e185a9e18780"],
+ ["ed86b9", "ed86a0e18780"],
+ ["ed86ba", "e18490e185a9e18781"],
+ ["ed86ba", "ed86a0e18781"],
+ ["ed86bb", "e18490e185a9e18782"],
+ ["ed86bb", "ed86a0e18782"],
+ ["ed86bc", "e18490e185aa"],
+ ["ed86bd", "e18490e185aae186a8"],
+ ["ed86bd", "ed86bce186a8"],
+ ["ed86be", "e18490e185aae186a9"],
+ ["ed86be", "ed86bce186a9"],
+ ["ed86bf", "e18490e185aae186aa"],
+ ["ed86bf", "ed86bce186aa"],
+ ["ed8780", "e18490e185aae186ab"],
+ ["ed8780", "ed86bce186ab"],
+ ["ed8781", "e18490e185aae186ac"],
+ ["ed8781", "ed86bce186ac"],
+ ["ed8782", "e18490e185aae186ad"],
+ ["ed8782", "ed86bce186ad"],
+ ["ed8783", "e18490e185aae186ae"],
+ ["ed8783", "ed86bce186ae"],
+ ["ed8784", "e18490e185aae186af"],
+ ["ed8784", "ed86bce186af"],
+ ["ed8785", "e18490e185aae186b0"],
+ ["ed8785", "ed86bce186b0"],
+ ["ed8786", "e18490e185aae186b1"],
+ ["ed8786", "ed86bce186b1"],
+ ["ed8787", "e18490e185aae186b2"],
+ ["ed8787", "ed86bce186b2"],
+ ["ed8788", "e18490e185aae186b3"],
+ ["ed8788", "ed86bce186b3"],
+ ["ed8789", "e18490e185aae186b4"],
+ ["ed8789", "ed86bce186b4"],
+ ["ed878a", "e18490e185aae186b5"],
+ ["ed878a", "ed86bce186b5"],
+ ["ed878b", "e18490e185aae186b6"],
+ ["ed878b", "ed86bce186b6"],
+ ["ed878c", "e18490e185aae186b7"],
+ ["ed878c", "ed86bce186b7"],
+ ["ed878d", "e18490e185aae186b8"],
+ ["ed878d", "ed86bce186b8"],
+ ["ed878e", "e18490e185aae186b9"],
+ ["ed878e", "ed86bce186b9"],
+ ["ed878f", "e18490e185aae186ba"],
+ ["ed878f", "ed86bce186ba"],
+ ["ed8790", "e18490e185aae186bb"],
+ ["ed8790", "ed86bce186bb"],
+ ["ed8791", "e18490e185aae186bc"],
+ ["ed8791", "ed86bce186bc"],
+ ["ed8792", "e18490e185aae186bd"],
+ ["ed8792", "ed86bce186bd"],
+ ["ed8793", "e18490e185aae186be"],
+ ["ed8793", "ed86bce186be"],
+ ["ed8794", "e18490e185aae186bf"],
+ ["ed8794", "ed86bce186bf"],
+ ["ed8795", "e18490e185aae18780"],
+ ["ed8795", "ed86bce18780"],
+ ["ed8796", "e18490e185aae18781"],
+ ["ed8796", "ed86bce18781"],
+ ["ed8797", "e18490e185aae18782"],
+ ["ed8797", "ed86bce18782"],
+ ["ed8798", "e18490e185ab"],
+ ["ed8799", "e18490e185abe186a8"],
+ ["ed8799", "ed8798e186a8"],
+ ["ed879a", "e18490e185abe186a9"],
+ ["ed879a", "ed8798e186a9"],
+ ["ed879b", "e18490e185abe186aa"],
+ ["ed879b", "ed8798e186aa"],
+ ["ed879c", "e18490e185abe186ab"],
+ ["ed879c", "ed8798e186ab"],
+ ["ed879d", "e18490e185abe186ac"],
+ ["ed879d", "ed8798e186ac"],
+ ["ed879e", "e18490e185abe186ad"],
+ ["ed879e", "ed8798e186ad"],
+ ["ed879f", "e18490e185abe186ae"],
+ ["ed879f", "ed8798e186ae"],
+ ["ed87a0", "e18490e185abe186af"],
+ ["ed87a0", "ed8798e186af"],
+ ["ed87a1", "e18490e185abe186b0"],
+ ["ed87a1", "ed8798e186b0"],
+ ["ed87a2", "e18490e185abe186b1"],
+ ["ed87a2", "ed8798e186b1"],
+ ["ed87a3", "e18490e185abe186b2"],
+ ["ed87a3", "ed8798e186b2"],
+ ["ed87a4", "e18490e185abe186b3"],
+ ["ed87a4", "ed8798e186b3"],
+ ["ed87a5", "e18490e185abe186b4"],
+ ["ed87a5", "ed8798e186b4"],
+ ["ed87a6", "e18490e185abe186b5"],
+ ["ed87a6", "ed8798e186b5"],
+ ["ed87a7", "e18490e185abe186b6"],
+ ["ed87a7", "ed8798e186b6"],
+ ["ed87a8", "e18490e185abe186b7"],
+ ["ed87a8", "ed8798e186b7"],
+ ["ed87a9", "e18490e185abe186b8"],
+ ["ed87a9", "ed8798e186b8"],
+ ["ed87aa", "e18490e185abe186b9"],
+ ["ed87aa", "ed8798e186b9"],
+ ["ed87ab", "e18490e185abe186ba"],
+ ["ed87ab", "ed8798e186ba"],
+ ["ed87ac", "e18490e185abe186bb"],
+ ["ed87ac", "ed8798e186bb"],
+ ["ed87ad", "e18490e185abe186bc"],
+ ["ed87ad", "ed8798e186bc"],
+ ["ed87ae", "e18490e185abe186bd"],
+ ["ed87ae", "ed8798e186bd"],
+ ["ed87af", "e18490e185abe186be"],
+ ["ed87af", "ed8798e186be"],
+ ["ed87b0", "e18490e185abe186bf"],
+ ["ed87b0", "ed8798e186bf"],
+ ["ed87b1", "e18490e185abe18780"],
+ ["ed87b1", "ed8798e18780"],
+ ["ed87b2", "e18490e185abe18781"],
+ ["ed87b2", "ed8798e18781"],
+ ["ed87b3", "e18490e185abe18782"],
+ ["ed87b3", "ed8798e18782"],
+ ["ed87b4", "e18490e185ac"],
+ ["ed87b5", "e18490e185ace186a8"],
+ ["ed87b5", "ed87b4e186a8"],
+ ["ed87b6", "e18490e185ace186a9"],
+ ["ed87b6", "ed87b4e186a9"],
+ ["ed87b7", "e18490e185ace186aa"],
+ ["ed87b7", "ed87b4e186aa"],
+ ["ed87b8", "e18490e185ace186ab"],
+ ["ed87b8", "ed87b4e186ab"],
+ ["ed87b9", "e18490e185ace186ac"],
+ ["ed87b9", "ed87b4e186ac"],
+ ["ed87ba", "e18490e185ace186ad"],
+ ["ed87ba", "ed87b4e186ad"],
+ ["ed87bb", "e18490e185ace186ae"],
+ ["ed87bb", "ed87b4e186ae"],
+ ["ed87bc", "e18490e185ace186af"],
+ ["ed87bc", "ed87b4e186af"],
+ ["ed87bd", "e18490e185ace186b0"],
+ ["ed87bd", "ed87b4e186b0"],
+ ["ed87be", "e18490e185ace186b1"],
+ ["ed87be", "ed87b4e186b1"],
+ ["ed87bf", "e18490e185ace186b2"],
+ ["ed87bf", "ed87b4e186b2"],
+ ["ed8880", "e18490e185ace186b3"],
+ ["ed8880", "ed87b4e186b3"],
+ ["ed8881", "e18490e185ace186b4"],
+ ["ed8881", "ed87b4e186b4"],
+ ["ed8882", "e18490e185ace186b5"],
+ ["ed8882", "ed87b4e186b5"],
+ ["ed8883", "e18490e185ace186b6"],
+ ["ed8883", "ed87b4e186b6"],
+ ["ed8884", "e18490e185ace186b7"],
+ ["ed8884", "ed87b4e186b7"],
+ ["ed8885", "e18490e185ace186b8"],
+ ["ed8885", "ed87b4e186b8"],
+ ["ed8886", "e18490e185ace186b9"],
+ ["ed8886", "ed87b4e186b9"],
+ ["ed8887", "e18490e185ace186ba"],
+ ["ed8887", "ed87b4e186ba"],
+ ["ed8888", "e18490e185ace186bb"],
+ ["ed8888", "ed87b4e186bb"],
+ ["ed8889", "e18490e185ace186bc"],
+ ["ed8889", "ed87b4e186bc"],
+ ["ed888a", "e18490e185ace186bd"],
+ ["ed888a", "ed87b4e186bd"],
+ ["ed888b", "e18490e185ace186be"],
+ ["ed888b", "ed87b4e186be"],
+ ["ed888c", "e18490e185ace186bf"],
+ ["ed888c", "ed87b4e186bf"],
+ ["ed888d", "e18490e185ace18780"],
+ ["ed888d", "ed87b4e18780"],
+ ["ed888e", "e18490e185ace18781"],
+ ["ed888e", "ed87b4e18781"],
+ ["ed888f", "e18490e185ace18782"],
+ ["ed888f", "ed87b4e18782"],
+ ["ed8890", "e18490e185ad"],
+ ["ed8891", "e18490e185ade186a8"],
+ ["ed8891", "ed8890e186a8"],
+ ["ed8892", "e18490e185ade186a9"],
+ ["ed8892", "ed8890e186a9"],
+ ["ed8893", "e18490e185ade186aa"],
+ ["ed8893", "ed8890e186aa"],
+ ["ed8894", "e18490e185ade186ab"],
+ ["ed8894", "ed8890e186ab"],
+ ["ed8895", "e18490e185ade186ac"],
+ ["ed8895", "ed8890e186ac"],
+ ["ed8896", "e18490e185ade186ad"],
+ ["ed8896", "ed8890e186ad"],
+ ["ed8897", "e18490e185ade186ae"],
+ ["ed8897", "ed8890e186ae"],
+ ["ed8898", "e18490e185ade186af"],
+ ["ed8898", "ed8890e186af"],
+ ["ed8899", "e18490e185ade186b0"],
+ ["ed8899", "ed8890e186b0"],
+ ["ed889a", "e18490e185ade186b1"],
+ ["ed889a", "ed8890e186b1"],
+ ["ed889b", "e18490e185ade186b2"],
+ ["ed889b", "ed8890e186b2"],
+ ["ed889c", "e18490e185ade186b3"],
+ ["ed889c", "ed8890e186b3"],
+ ["ed889d", "e18490e185ade186b4"],
+ ["ed889d", "ed8890e186b4"],
+ ["ed889e", "e18490e185ade186b5"],
+ ["ed889e", "ed8890e186b5"],
+ ["ed889f", "e18490e185ade186b6"],
+ ["ed889f", "ed8890e186b6"],
+ ["ed88a0", "e18490e185ade186b7"],
+ ["ed88a0", "ed8890e186b7"],
+ ["ed88a1", "e18490e185ade186b8"],
+ ["ed88a1", "ed8890e186b8"],
+ ["ed88a2", "e18490e185ade186b9"],
+ ["ed88a2", "ed8890e186b9"],
+ ["ed88a3", "e18490e185ade186ba"],
+ ["ed88a3", "ed8890e186ba"],
+ ["ed88a4", "e18490e185ade186bb"],
+ ["ed88a4", "ed8890e186bb"],
+ ["ed88a5", "e18490e185ade186bc"],
+ ["ed88a5", "ed8890e186bc"],
+ ["ed88a6", "e18490e185ade186bd"],
+ ["ed88a6", "ed8890e186bd"],
+ ["ed88a7", "e18490e185ade186be"],
+ ["ed88a7", "ed8890e186be"],
+ ["ed88a8", "e18490e185ade186bf"],
+ ["ed88a8", "ed8890e186bf"],
+ ["ed88a9", "e18490e185ade18780"],
+ ["ed88a9", "ed8890e18780"],
+ ["ed88aa", "e18490e185ade18781"],
+ ["ed88aa", "ed8890e18781"],
+ ["ed88ab", "e18490e185ade18782"],
+ ["ed88ab", "ed8890e18782"],
+ ["ed88ac", "e18490e185ae"],
+ ["ed88ad", "e18490e185aee186a8"],
+ ["ed88ad", "ed88ace186a8"],
+ ["ed88ae", "e18490e185aee186a9"],
+ ["ed88ae", "ed88ace186a9"],
+ ["ed88af", "e18490e185aee186aa"],
+ ["ed88af", "ed88ace186aa"],
+ ["ed88b0", "e18490e185aee186ab"],
+ ["ed88b0", "ed88ace186ab"],
+ ["ed88b1", "e18490e185aee186ac"],
+ ["ed88b1", "ed88ace186ac"],
+ ["ed88b2", "e18490e185aee186ad"],
+ ["ed88b2", "ed88ace186ad"],
+ ["ed88b3", "e18490e185aee186ae"],
+ ["ed88b3", "ed88ace186ae"],
+ ["ed88b4", "e18490e185aee186af"],
+ ["ed88b4", "ed88ace186af"],
+ ["ed88b5", "e18490e185aee186b0"],
+ ["ed88b5", "ed88ace186b0"],
+ ["ed88b6", "e18490e185aee186b1"],
+ ["ed88b6", "ed88ace186b1"],
+ ["ed88b7", "e18490e185aee186b2"],
+ ["ed88b7", "ed88ace186b2"],
+ ["ed88b8", "e18490e185aee186b3"],
+ ["ed88b8", "ed88ace186b3"],
+ ["ed88b9", "e18490e185aee186b4"],
+ ["ed88b9", "ed88ace186b4"],
+ ["ed88ba", "e18490e185aee186b5"],
+ ["ed88ba", "ed88ace186b5"],
+ ["ed88bb", "e18490e185aee186b6"],
+ ["ed88bb", "ed88ace186b6"],
+ ["ed88bc", "e18490e185aee186b7"],
+ ["ed88bc", "ed88ace186b7"],
+ ["ed88bd", "e18490e185aee186b8"],
+ ["ed88bd", "ed88ace186b8"],
+ ["ed88be", "e18490e185aee186b9"],
+ ["ed88be", "ed88ace186b9"],
+ ["ed88bf", "e18490e185aee186ba"],
+ ["ed88bf", "ed88ace186ba"],
+ ["ed8980", "e18490e185aee186bb"],
+ ["ed8980", "ed88ace186bb"],
+ ["ed8981", "e18490e185aee186bc"],
+ ["ed8981", "ed88ace186bc"],
+ ["ed8982", "e18490e185aee186bd"],
+ ["ed8982", "ed88ace186bd"],
+ ["ed8983", "e18490e185aee186be"],
+ ["ed8983", "ed88ace186be"],
+ ["ed8984", "e18490e185aee186bf"],
+ ["ed8984", "ed88ace186bf"],
+ ["ed8985", "e18490e185aee18780"],
+ ["ed8985", "ed88ace18780"],
+ ["ed8986", "e18490e185aee18781"],
+ ["ed8986", "ed88ace18781"],
+ ["ed8987", "e18490e185aee18782"],
+ ["ed8987", "ed88ace18782"],
+ ["ed8988", "e18490e185af"],
+ ["ed8989", "e18490e185afe186a8"],
+ ["ed8989", "ed8988e186a8"],
+ ["ed898a", "e18490e185afe186a9"],
+ ["ed898a", "ed8988e186a9"],
+ ["ed898b", "e18490e185afe186aa"],
+ ["ed898b", "ed8988e186aa"],
+ ["ed898c", "e18490e185afe186ab"],
+ ["ed898c", "ed8988e186ab"],
+ ["ed898d", "e18490e185afe186ac"],
+ ["ed898d", "ed8988e186ac"],
+ ["ed898e", "e18490e185afe186ad"],
+ ["ed898e", "ed8988e186ad"],
+ ["ed898f", "e18490e185afe186ae"],
+ ["ed898f", "ed8988e186ae"],
+ ["ed8990", "e18490e185afe186af"],
+ ["ed8990", "ed8988e186af"],
+ ["ed8991", "e18490e185afe186b0"],
+ ["ed8991", "ed8988e186b0"],
+ ["ed8992", "e18490e185afe186b1"],
+ ["ed8992", "ed8988e186b1"],
+ ["ed8993", "e18490e185afe186b2"],
+ ["ed8993", "ed8988e186b2"],
+ ["ed8994", "e18490e185afe186b3"],
+ ["ed8994", "ed8988e186b3"],
+ ["ed8995", "e18490e185afe186b4"],
+ ["ed8995", "ed8988e186b4"],
+ ["ed8996", "e18490e185afe186b5"],
+ ["ed8996", "ed8988e186b5"],
+ ["ed8997", "e18490e185afe186b6"],
+ ["ed8997", "ed8988e186b6"],
+ ["ed8998", "e18490e185afe186b7"],
+ ["ed8998", "ed8988e186b7"],
+ ["ed8999", "e18490e185afe186b8"],
+ ["ed8999", "ed8988e186b8"],
+ ["ed899a", "e18490e185afe186b9"],
+ ["ed899a", "ed8988e186b9"],
+ ["ed899b", "e18490e185afe186ba"],
+ ["ed899b", "ed8988e186ba"],
+ ["ed899c", "e18490e185afe186bb"],
+ ["ed899c", "ed8988e186bb"],
+ ["ed899d", "e18490e185afe186bc"],
+ ["ed899d", "ed8988e186bc"],
+ ["ed899e", "e18490e185afe186bd"],
+ ["ed899e", "ed8988e186bd"],
+ ["ed899f", "e18490e185afe186be"],
+ ["ed899f", "ed8988e186be"],
+ ["ed89a0", "e18490e185afe186bf"],
+ ["ed89a0", "ed8988e186bf"],
+ ["ed89a1", "e18490e185afe18780"],
+ ["ed89a1", "ed8988e18780"],
+ ["ed89a2", "e18490e185afe18781"],
+ ["ed89a2", "ed8988e18781"],
+ ["ed89a3", "e18490e185afe18782"],
+ ["ed89a3", "ed8988e18782"],
+ ["ed89a4", "e18490e185b0"],
+ ["ed89a5", "e18490e185b0e186a8"],
+ ["ed89a5", "ed89a4e186a8"],
+ ["ed89a6", "e18490e185b0e186a9"],
+ ["ed89a6", "ed89a4e186a9"],
+ ["ed89a7", "e18490e185b0e186aa"],
+ ["ed89a7", "ed89a4e186aa"],
+ ["ed89a8", "e18490e185b0e186ab"],
+ ["ed89a8", "ed89a4e186ab"],
+ ["ed89a9", "e18490e185b0e186ac"],
+ ["ed89a9", "ed89a4e186ac"],
+ ["ed89aa", "e18490e185b0e186ad"],
+ ["ed89aa", "ed89a4e186ad"],
+ ["ed89ab", "e18490e185b0e186ae"],
+ ["ed89ab", "ed89a4e186ae"],
+ ["ed89ac", "e18490e185b0e186af"],
+ ["ed89ac", "ed89a4e186af"],
+ ["ed89ad", "e18490e185b0e186b0"],
+ ["ed89ad", "ed89a4e186b0"],
+ ["ed89ae", "e18490e185b0e186b1"],
+ ["ed89ae", "ed89a4e186b1"],
+ ["ed89af", "e18490e185b0e186b2"],
+ ["ed89af", "ed89a4e186b2"],
+ ["ed89b0", "e18490e185b0e186b3"],
+ ["ed89b0", "ed89a4e186b3"],
+ ["ed89b1", "e18490e185b0e186b4"],
+ ["ed89b1", "ed89a4e186b4"],
+ ["ed89b2", "e18490e185b0e186b5"],
+ ["ed89b2", "ed89a4e186b5"],
+ ["ed89b3", "e18490e185b0e186b6"],
+ ["ed89b3", "ed89a4e186b6"],
+ ["ed89b4", "e18490e185b0e186b7"],
+ ["ed89b4", "ed89a4e186b7"],
+ ["ed89b5", "e18490e185b0e186b8"],
+ ["ed89b5", "ed89a4e186b8"],
+ ["ed89b6", "e18490e185b0e186b9"],
+ ["ed89b6", "ed89a4e186b9"],
+ ["ed89b7", "e18490e185b0e186ba"],
+ ["ed89b7", "ed89a4e186ba"],
+ ["ed89b8", "e18490e185b0e186bb"],
+ ["ed89b8", "ed89a4e186bb"],
+ ["ed89b9", "e18490e185b0e186bc"],
+ ["ed89b9", "ed89a4e186bc"],
+ ["ed89ba", "e18490e185b0e186bd"],
+ ["ed89ba", "ed89a4e186bd"],
+ ["ed89bb", "e18490e185b0e186be"],
+ ["ed89bb", "ed89a4e186be"],
+ ["ed89bc", "e18490e185b0e186bf"],
+ ["ed89bc", "ed89a4e186bf"],
+ ["ed89bd", "e18490e185b0e18780"],
+ ["ed89bd", "ed89a4e18780"],
+ ["ed89be", "e18490e185b0e18781"],
+ ["ed89be", "ed89a4e18781"],
+ ["ed89bf", "e18490e185b0e18782"],
+ ["ed89bf", "ed89a4e18782"],
+ ["ed8a80", "e18490e185b1"],
+ ["ed8a81", "e18490e185b1e186a8"],
+ ["ed8a81", "ed8a80e186a8"],
+ ["ed8a82", "e18490e185b1e186a9"],
+ ["ed8a82", "ed8a80e186a9"],
+ ["ed8a83", "e18490e185b1e186aa"],
+ ["ed8a83", "ed8a80e186aa"],
+ ["ed8a84", "e18490e185b1e186ab"],
+ ["ed8a84", "ed8a80e186ab"],
+ ["ed8a85", "e18490e185b1e186ac"],
+ ["ed8a85", "ed8a80e186ac"],
+ ["ed8a86", "e18490e185b1e186ad"],
+ ["ed8a86", "ed8a80e186ad"],
+ ["ed8a87", "e18490e185b1e186ae"],
+ ["ed8a87", "ed8a80e186ae"],
+ ["ed8a88", "e18490e185b1e186af"],
+ ["ed8a88", "ed8a80e186af"],
+ ["ed8a89", "e18490e185b1e186b0"],
+ ["ed8a89", "ed8a80e186b0"],
+ ["ed8a8a", "e18490e185b1e186b1"],
+ ["ed8a8a", "ed8a80e186b1"],
+ ["ed8a8b", "e18490e185b1e186b2"],
+ ["ed8a8b", "ed8a80e186b2"],
+ ["ed8a8c", "e18490e185b1e186b3"],
+ ["ed8a8c", "ed8a80e186b3"],
+ ["ed8a8d", "e18490e185b1e186b4"],
+ ["ed8a8d", "ed8a80e186b4"],
+ ["ed8a8e", "e18490e185b1e186b5"],
+ ["ed8a8e", "ed8a80e186b5"],
+ ["ed8a8f", "e18490e185b1e186b6"],
+ ["ed8a8f", "ed8a80e186b6"],
+ ["ed8a90", "e18490e185b1e186b7"],
+ ["ed8a90", "ed8a80e186b7"],
+ ["ed8a91", "e18490e185b1e186b8"],
+ ["ed8a91", "ed8a80e186b8"],
+ ["ed8a92", "e18490e185b1e186b9"],
+ ["ed8a92", "ed8a80e186b9"],
+ ["ed8a93", "e18490e185b1e186ba"],
+ ["ed8a93", "ed8a80e186ba"],
+ ["ed8a94", "e18490e185b1e186bb"],
+ ["ed8a94", "ed8a80e186bb"],
+ ["ed8a95", "e18490e185b1e186bc"],
+ ["ed8a95", "ed8a80e186bc"],
+ ["ed8a96", "e18490e185b1e186bd"],
+ ["ed8a96", "ed8a80e186bd"],
+ ["ed8a97", "e18490e185b1e186be"],
+ ["ed8a97", "ed8a80e186be"],
+ ["ed8a98", "e18490e185b1e186bf"],
+ ["ed8a98", "ed8a80e186bf"],
+ ["ed8a99", "e18490e185b1e18780"],
+ ["ed8a99", "ed8a80e18780"],
+ ["ed8a9a", "e18490e185b1e18781"],
+ ["ed8a9a", "ed8a80e18781"],
+ ["ed8a9b", "e18490e185b1e18782"],
+ ["ed8a9b", "ed8a80e18782"],
+ ["ed8a9c", "e18490e185b2"],
+ ["ed8a9d", "e18490e185b2e186a8"],
+ ["ed8a9d", "ed8a9ce186a8"],
+ ["ed8a9e", "e18490e185b2e186a9"],
+ ["ed8a9e", "ed8a9ce186a9"],
+ ["ed8a9f", "e18490e185b2e186aa"],
+ ["ed8a9f", "ed8a9ce186aa"],
+ ["ed8aa0", "e18490e185b2e186ab"],
+ ["ed8aa0", "ed8a9ce186ab"],
+ ["ed8aa1", "e18490e185b2e186ac"],
+ ["ed8aa1", "ed8a9ce186ac"],
+ ["ed8aa2", "e18490e185b2e186ad"],
+ ["ed8aa2", "ed8a9ce186ad"],
+ ["ed8aa3", "e18490e185b2e186ae"],
+ ["ed8aa3", "ed8a9ce186ae"],
+ ["ed8aa4", "e18490e185b2e186af"],
+ ["ed8aa4", "ed8a9ce186af"],
+ ["ed8aa5", "e18490e185b2e186b0"],
+ ["ed8aa5", "ed8a9ce186b0"],
+ ["ed8aa6", "e18490e185b2e186b1"],
+ ["ed8aa6", "ed8a9ce186b1"],
+ ["ed8aa7", "e18490e185b2e186b2"],
+ ["ed8aa7", "ed8a9ce186b2"],
+ ["ed8aa8", "e18490e185b2e186b3"],
+ ["ed8aa8", "ed8a9ce186b3"],
+ ["ed8aa9", "e18490e185b2e186b4"],
+ ["ed8aa9", "ed8a9ce186b4"],
+ ["ed8aaa", "e18490e185b2e186b5"],
+ ["ed8aaa", "ed8a9ce186b5"],
+ ["ed8aab", "e18490e185b2e186b6"],
+ ["ed8aab", "ed8a9ce186b6"],
+ ["ed8aac", "e18490e185b2e186b7"],
+ ["ed8aac", "ed8a9ce186b7"],
+ ["ed8aad", "e18490e185b2e186b8"],
+ ["ed8aad", "ed8a9ce186b8"],
+ ["ed8aae", "e18490e185b2e186b9"],
+ ["ed8aae", "ed8a9ce186b9"],
+ ["ed8aaf", "e18490e185b2e186ba"],
+ ["ed8aaf", "ed8a9ce186ba"],
+ ["ed8ab0", "e18490e185b2e186bb"],
+ ["ed8ab0", "ed8a9ce186bb"],
+ ["ed8ab1", "e18490e185b2e186bc"],
+ ["ed8ab1", "ed8a9ce186bc"],
+ ["ed8ab2", "e18490e185b2e186bd"],
+ ["ed8ab2", "ed8a9ce186bd"],
+ ["ed8ab3", "e18490e185b2e186be"],
+ ["ed8ab3", "ed8a9ce186be"],
+ ["ed8ab4", "e18490e185b2e186bf"],
+ ["ed8ab4", "ed8a9ce186bf"],
+ ["ed8ab5", "e18490e185b2e18780"],
+ ["ed8ab5", "ed8a9ce18780"],
+ ["ed8ab6", "e18490e185b2e18781"],
+ ["ed8ab6", "ed8a9ce18781"],
+ ["ed8ab7", "e18490e185b2e18782"],
+ ["ed8ab7", "ed8a9ce18782"],
+ ["ed8ab8", "e18490e185b3"],
+ ["ed8ab9", "e18490e185b3e186a8"],
+ ["ed8ab9", "ed8ab8e186a8"],
+ ["ed8aba", "e18490e185b3e186a9"],
+ ["ed8aba", "ed8ab8e186a9"],
+ ["ed8abb", "e18490e185b3e186aa"],
+ ["ed8abb", "ed8ab8e186aa"],
+ ["ed8abc", "e18490e185b3e186ab"],
+ ["ed8abc", "ed8ab8e186ab"],
+ ["ed8abd", "e18490e185b3e186ac"],
+ ["ed8abd", "ed8ab8e186ac"],
+ ["ed8abe", "e18490e185b3e186ad"],
+ ["ed8abe", "ed8ab8e186ad"],
+ ["ed8abf", "e18490e185b3e186ae"],
+ ["ed8abf", "ed8ab8e186ae"],
+ ["ed8b80", "e18490e185b3e186af"],
+ ["ed8b80", "ed8ab8e186af"],
+ ["ed8b81", "e18490e185b3e186b0"],
+ ["ed8b81", "ed8ab8e186b0"],
+ ["ed8b82", "e18490e185b3e186b1"],
+ ["ed8b82", "ed8ab8e186b1"],
+ ["ed8b83", "e18490e185b3e186b2"],
+ ["ed8b83", "ed8ab8e186b2"],
+ ["ed8b84", "e18490e185b3e186b3"],
+ ["ed8b84", "ed8ab8e186b3"],
+ ["ed8b85", "e18490e185b3e186b4"],
+ ["ed8b85", "ed8ab8e186b4"],
+ ["ed8b86", "e18490e185b3e186b5"],
+ ["ed8b86", "ed8ab8e186b5"],
+ ["ed8b87", "e18490e185b3e186b6"],
+ ["ed8b87", "ed8ab8e186b6"],
+ ["ed8b88", "e18490e185b3e186b7"],
+ ["ed8b88", "ed8ab8e186b7"],
+ ["ed8b89", "e18490e185b3e186b8"],
+ ["ed8b89", "ed8ab8e186b8"],
+ ["ed8b8a", "e18490e185b3e186b9"],
+ ["ed8b8a", "ed8ab8e186b9"],
+ ["ed8b8b", "e18490e185b3e186ba"],
+ ["ed8b8b", "ed8ab8e186ba"],
+ ["ed8b8c", "e18490e185b3e186bb"],
+ ["ed8b8c", "ed8ab8e186bb"],
+ ["ed8b8d", "e18490e185b3e186bc"],
+ ["ed8b8d", "ed8ab8e186bc"],
+ ["ed8b8e", "e18490e185b3e186bd"],
+ ["ed8b8e", "ed8ab8e186bd"],
+ ["ed8b8f", "e18490e185b3e186be"],
+ ["ed8b8f", "ed8ab8e186be"],
+ ["ed8b90", "e18490e185b3e186bf"],
+ ["ed8b90", "ed8ab8e186bf"],
+ ["ed8b91", "e18490e185b3e18780"],
+ ["ed8b91", "ed8ab8e18780"],
+ ["ed8b92", "e18490e185b3e18781"],
+ ["ed8b92", "ed8ab8e18781"],
+ ["ed8b93", "e18490e185b3e18782"],
+ ["ed8b93", "ed8ab8e18782"],
+ ["ed8b94", "e18490e185b4"],
+ ["ed8b95", "e18490e185b4e186a8"],
+ ["ed8b95", "ed8b94e186a8"],
+ ["ed8b96", "e18490e185b4e186a9"],
+ ["ed8b96", "ed8b94e186a9"],
+ ["ed8b97", "e18490e185b4e186aa"],
+ ["ed8b97", "ed8b94e186aa"],
+ ["ed8b98", "e18490e185b4e186ab"],
+ ["ed8b98", "ed8b94e186ab"],
+ ["ed8b99", "e18490e185b4e186ac"],
+ ["ed8b99", "ed8b94e186ac"],
+ ["ed8b9a", "e18490e185b4e186ad"],
+ ["ed8b9a", "ed8b94e186ad"],
+ ["ed8b9b", "e18490e185b4e186ae"],
+ ["ed8b9b", "ed8b94e186ae"],
+ ["ed8b9c", "e18490e185b4e186af"],
+ ["ed8b9c", "ed8b94e186af"],
+ ["ed8b9d", "e18490e185b4e186b0"],
+ ["ed8b9d", "ed8b94e186b0"],
+ ["ed8b9e", "e18490e185b4e186b1"],
+ ["ed8b9e", "ed8b94e186b1"],
+ ["ed8b9f", "e18490e185b4e186b2"],
+ ["ed8b9f", "ed8b94e186b2"],
+ ["ed8ba0", "e18490e185b4e186b3"],
+ ["ed8ba0", "ed8b94e186b3"],
+ ["ed8ba1", "e18490e185b4e186b4"],
+ ["ed8ba1", "ed8b94e186b4"],
+ ["ed8ba2", "e18490e185b4e186b5"],
+ ["ed8ba2", "ed8b94e186b5"],
+ ["ed8ba3", "e18490e185b4e186b6"],
+ ["ed8ba3", "ed8b94e186b6"],
+ ["ed8ba4", "e18490e185b4e186b7"],
+ ["ed8ba4", "ed8b94e186b7"],
+ ["ed8ba5", "e18490e185b4e186b8"],
+ ["ed8ba5", "ed8b94e186b8"],
+ ["ed8ba6", "e18490e185b4e186b9"],
+ ["ed8ba6", "ed8b94e186b9"],
+ ["ed8ba7", "e18490e185b4e186ba"],
+ ["ed8ba7", "ed8b94e186ba"],
+ ["ed8ba8", "e18490e185b4e186bb"],
+ ["ed8ba8", "ed8b94e186bb"],
+ ["ed8ba9", "e18490e185b4e186bc"],
+ ["ed8ba9", "ed8b94e186bc"],
+ ["ed8baa", "e18490e185b4e186bd"],
+ ["ed8baa", "ed8b94e186bd"],
+ ["ed8bab", "e18490e185b4e186be"],
+ ["ed8bab", "ed8b94e186be"],
+ ["ed8bac", "e18490e185b4e186bf"],
+ ["ed8bac", "ed8b94e186bf"],
+ ["ed8bad", "e18490e185b4e18780"],
+ ["ed8bad", "ed8b94e18780"],
+ ["ed8bae", "e18490e185b4e18781"],
+ ["ed8bae", "ed8b94e18781"],
+ ["ed8baf", "e18490e185b4e18782"],
+ ["ed8baf", "ed8b94e18782"],
+ ["ed8bb0", "e18490e185b5"],
+ ["ed8bb1", "e18490e185b5e186a8"],
+ ["ed8bb1", "ed8bb0e186a8"],
+ ["ed8bb2", "e18490e185b5e186a9"],
+ ["ed8bb2", "ed8bb0e186a9"],
+ ["ed8bb3", "e18490e185b5e186aa"],
+ ["ed8bb3", "ed8bb0e186aa"],
+ ["ed8bb4", "e18490e185b5e186ab"],
+ ["ed8bb4", "ed8bb0e186ab"],
+ ["ed8bb5", "e18490e185b5e186ac"],
+ ["ed8bb5", "ed8bb0e186ac"],
+ ["ed8bb6", "e18490e185b5e186ad"],
+ ["ed8bb6", "ed8bb0e186ad"],
+ ["ed8bb7", "e18490e185b5e186ae"],
+ ["ed8bb7", "ed8bb0e186ae"],
+ ["ed8bb8", "e18490e185b5e186af"],
+ ["ed8bb8", "ed8bb0e186af"],
+ ["ed8bb9", "e18490e185b5e186b0"],
+ ["ed8bb9", "ed8bb0e186b0"],
+ ["ed8bba", "e18490e185b5e186b1"],
+ ["ed8bba", "ed8bb0e186b1"],
+ ["ed8bbb", "e18490e185b5e186b2"],
+ ["ed8bbb", "ed8bb0e186b2"],
+ ["ed8bbc", "e18490e185b5e186b3"],
+ ["ed8bbc", "ed8bb0e186b3"],
+ ["ed8bbd", "e18490e185b5e186b4"],
+ ["ed8bbd", "ed8bb0e186b4"],
+ ["ed8bbe", "e18490e185b5e186b5"],
+ ["ed8bbe", "ed8bb0e186b5"],
+ ["ed8bbf", "e18490e185b5e186b6"],
+ ["ed8bbf", "ed8bb0e186b6"],
+ ["ed8c80", "e18490e185b5e186b7"],
+ ["ed8c80", "ed8bb0e186b7"],
+ ["ed8c81", "e18490e185b5e186b8"],
+ ["ed8c81", "ed8bb0e186b8"],
+ ["ed8c82", "e18490e185b5e186b9"],
+ ["ed8c82", "ed8bb0e186b9"],
+ ["ed8c83", "e18490e185b5e186ba"],
+ ["ed8c83", "ed8bb0e186ba"],
+ ["ed8c84", "e18490e185b5e186bb"],
+ ["ed8c84", "ed8bb0e186bb"],
+ ["ed8c85", "e18490e185b5e186bc"],
+ ["ed8c85", "ed8bb0e186bc"],
+ ["ed8c86", "e18490e185b5e186bd"],
+ ["ed8c86", "ed8bb0e186bd"],
+ ["ed8c87", "e18490e185b5e186be"],
+ ["ed8c87", "ed8bb0e186be"],
+ ["ed8c88", "e18490e185b5e186bf"],
+ ["ed8c88", "ed8bb0e186bf"],
+ ["ed8c89", "e18490e185b5e18780"],
+ ["ed8c89", "ed8bb0e18780"],
+ ["ed8c8a", "e18490e185b5e18781"],
+ ["ed8c8a", "ed8bb0e18781"],
+ ["ed8c8b", "e18490e185b5e18782"],
+ ["ed8c8b", "ed8bb0e18782"],
+ ["ed8c8c", "e18491e185a1"],
+ ["ed8c8d", "e18491e185a1e186a8"],
+ ["ed8c8d", "ed8c8ce186a8"],
+ ["ed8c8e", "e18491e185a1e186a9"],
+ ["ed8c8e", "ed8c8ce186a9"],
+ ["ed8c8f", "e18491e185a1e186aa"],
+ ["ed8c8f", "ed8c8ce186aa"],
+ ["ed8c90", "e18491e185a1e186ab"],
+ ["ed8c90", "ed8c8ce186ab"],
+ ["ed8c91", "e18491e185a1e186ac"],
+ ["ed8c91", "ed8c8ce186ac"],
+ ["ed8c92", "e18491e185a1e186ad"],
+ ["ed8c92", "ed8c8ce186ad"],
+ ["ed8c93", "e18491e185a1e186ae"],
+ ["ed8c93", "ed8c8ce186ae"],
+ ["ed8c94", "e18491e185a1e186af"],
+ ["ed8c94", "ed8c8ce186af"],
+ ["ed8c95", "e18491e185a1e186b0"],
+ ["ed8c95", "ed8c8ce186b0"],
+ ["ed8c96", "e18491e185a1e186b1"],
+ ["ed8c96", "ed8c8ce186b1"],
+ ["ed8c97", "e18491e185a1e186b2"],
+ ["ed8c97", "ed8c8ce186b2"],
+ ["ed8c98", "e18491e185a1e186b3"],
+ ["ed8c98", "ed8c8ce186b3"],
+ ["ed8c99", "e18491e185a1e186b4"],
+ ["ed8c99", "ed8c8ce186b4"],
+ ["ed8c9a", "e18491e185a1e186b5"],
+ ["ed8c9a", "ed8c8ce186b5"],
+ ["ed8c9b", "e18491e185a1e186b6"],
+ ["ed8c9b", "ed8c8ce186b6"],
+ ["ed8c9c", "e18491e185a1e186b7"],
+ ["ed8c9c", "ed8c8ce186b7"],
+ ["ed8c9d", "e18491e185a1e186b8"],
+ ["ed8c9d", "ed8c8ce186b8"],
+ ["ed8c9e", "e18491e185a1e186b9"],
+ ["ed8c9e", "ed8c8ce186b9"],
+ ["ed8c9f", "e18491e185a1e186ba"],
+ ["ed8c9f", "ed8c8ce186ba"],
+ ["ed8ca0", "e18491e185a1e186bb"],
+ ["ed8ca0", "ed8c8ce186bb"],
+ ["ed8ca1", "e18491e185a1e186bc"],
+ ["ed8ca1", "ed8c8ce186bc"],
+ ["ed8ca2", "e18491e185a1e186bd"],
+ ["ed8ca2", "ed8c8ce186bd"],
+ ["ed8ca3", "e18491e185a1e186be"],
+ ["ed8ca3", "ed8c8ce186be"],
+ ["ed8ca4", "e18491e185a1e186bf"],
+ ["ed8ca4", "ed8c8ce186bf"],
+ ["ed8ca5", "e18491e185a1e18780"],
+ ["ed8ca5", "ed8c8ce18780"],
+ ["ed8ca6", "e18491e185a1e18781"],
+ ["ed8ca6", "ed8c8ce18781"],
+ ["ed8ca7", "e18491e185a1e18782"],
+ ["ed8ca7", "ed8c8ce18782"],
+ ["ed8ca8", "e18491e185a2"],
+ ["ed8ca9", "e18491e185a2e186a8"],
+ ["ed8ca9", "ed8ca8e186a8"],
+ ["ed8caa", "e18491e185a2e186a9"],
+ ["ed8caa", "ed8ca8e186a9"],
+ ["ed8cab", "e18491e185a2e186aa"],
+ ["ed8cab", "ed8ca8e186aa"],
+ ["ed8cac", "e18491e185a2e186ab"],
+ ["ed8cac", "ed8ca8e186ab"],
+ ["ed8cad", "e18491e185a2e186ac"],
+ ["ed8cad", "ed8ca8e186ac"],
+ ["ed8cae", "e18491e185a2e186ad"],
+ ["ed8cae", "ed8ca8e186ad"],
+ ["ed8caf", "e18491e185a2e186ae"],
+ ["ed8caf", "ed8ca8e186ae"],
+ ["ed8cb0", "e18491e185a2e186af"],
+ ["ed8cb0", "ed8ca8e186af"],
+ ["ed8cb1", "e18491e185a2e186b0"],
+ ["ed8cb1", "ed8ca8e186b0"],
+ ["ed8cb2", "e18491e185a2e186b1"],
+ ["ed8cb2", "ed8ca8e186b1"],
+ ["ed8cb3", "e18491e185a2e186b2"],
+ ["ed8cb3", "ed8ca8e186b2"],
+ ["ed8cb4", "e18491e185a2e186b3"],
+ ["ed8cb4", "ed8ca8e186b3"],
+ ["ed8cb5", "e18491e185a2e186b4"],
+ ["ed8cb5", "ed8ca8e186b4"],
+ ["ed8cb6", "e18491e185a2e186b5"],
+ ["ed8cb6", "ed8ca8e186b5"],
+ ["ed8cb7", "e18491e185a2e186b6"],
+ ["ed8cb7", "ed8ca8e186b6"],
+ ["ed8cb8", "e18491e185a2e186b7"],
+ ["ed8cb8", "ed8ca8e186b7"],
+ ["ed8cb9", "e18491e185a2e186b8"],
+ ["ed8cb9", "ed8ca8e186b8"],
+ ["ed8cba", "e18491e185a2e186b9"],
+ ["ed8cba", "ed8ca8e186b9"],
+ ["ed8cbb", "e18491e185a2e186ba"],
+ ["ed8cbb", "ed8ca8e186ba"],
+ ["ed8cbc", "e18491e185a2e186bb"],
+ ["ed8cbc", "ed8ca8e186bb"],
+ ["ed8cbd", "e18491e185a2e186bc"],
+ ["ed8cbd", "ed8ca8e186bc"],
+ ["ed8cbe", "e18491e185a2e186bd"],
+ ["ed8cbe", "ed8ca8e186bd"],
+ ["ed8cbf", "e18491e185a2e186be"],
+ ["ed8cbf", "ed8ca8e186be"],
+ ["ed8d80", "e18491e185a2e186bf"],
+ ["ed8d80", "ed8ca8e186bf"],
+ ["ed8d81", "e18491e185a2e18780"],
+ ["ed8d81", "ed8ca8e18780"],
+ ["ed8d82", "e18491e185a2e18781"],
+ ["ed8d82", "ed8ca8e18781"],
+ ["ed8d83", "e18491e185a2e18782"],
+ ["ed8d83", "ed8ca8e18782"],
+ ["ed8d84", "e18491e185a3"],
+ ["ed8d85", "e18491e185a3e186a8"],
+ ["ed8d85", "ed8d84e186a8"],
+ ["ed8d86", "e18491e185a3e186a9"],
+ ["ed8d86", "ed8d84e186a9"],
+ ["ed8d87", "e18491e185a3e186aa"],
+ ["ed8d87", "ed8d84e186aa"],
+ ["ed8d88", "e18491e185a3e186ab"],
+ ["ed8d88", "ed8d84e186ab"],
+ ["ed8d89", "e18491e185a3e186ac"],
+ ["ed8d89", "ed8d84e186ac"],
+ ["ed8d8a", "e18491e185a3e186ad"],
+ ["ed8d8a", "ed8d84e186ad"],
+ ["ed8d8b", "e18491e185a3e186ae"],
+ ["ed8d8b", "ed8d84e186ae"],
+ ["ed8d8c", "e18491e185a3e186af"],
+ ["ed8d8c", "ed8d84e186af"],
+ ["ed8d8d", "e18491e185a3e186b0"],
+ ["ed8d8d", "ed8d84e186b0"],
+ ["ed8d8e", "e18491e185a3e186b1"],
+ ["ed8d8e", "ed8d84e186b1"],
+ ["ed8d8f", "e18491e185a3e186b2"],
+ ["ed8d8f", "ed8d84e186b2"],
+ ["ed8d90", "e18491e185a3e186b3"],
+ ["ed8d90", "ed8d84e186b3"],
+ ["ed8d91", "e18491e185a3e186b4"],
+ ["ed8d91", "ed8d84e186b4"],
+ ["ed8d92", "e18491e185a3e186b5"],
+ ["ed8d92", "ed8d84e186b5"],
+ ["ed8d93", "e18491e185a3e186b6"],
+ ["ed8d93", "ed8d84e186b6"],
+ ["ed8d94", "e18491e185a3e186b7"],
+ ["ed8d94", "ed8d84e186b7"],
+ ["ed8d95", "e18491e185a3e186b8"],
+ ["ed8d95", "ed8d84e186b8"],
+ ["ed8d96", "e18491e185a3e186b9"],
+ ["ed8d96", "ed8d84e186b9"],
+ ["ed8d97", "e18491e185a3e186ba"],
+ ["ed8d97", "ed8d84e186ba"],
+ ["ed8d98", "e18491e185a3e186bb"],
+ ["ed8d98", "ed8d84e186bb"],
+ ["ed8d99", "e18491e185a3e186bc"],
+ ["ed8d99", "ed8d84e186bc"],
+ ["ed8d9a", "e18491e185a3e186bd"],
+ ["ed8d9a", "ed8d84e186bd"],
+ ["ed8d9b", "e18491e185a3e186be"],
+ ["ed8d9b", "ed8d84e186be"],
+ ["ed8d9c", "e18491e185a3e186bf"],
+ ["ed8d9c", "ed8d84e186bf"],
+ ["ed8d9d", "e18491e185a3e18780"],
+ ["ed8d9d", "ed8d84e18780"],
+ ["ed8d9e", "e18491e185a3e18781"],
+ ["ed8d9e", "ed8d84e18781"],
+ ["ed8d9f", "e18491e185a3e18782"],
+ ["ed8d9f", "ed8d84e18782"],
+ ["ed8da0", "e18491e185a4"],
+ ["ed8da1", "e18491e185a4e186a8"],
+ ["ed8da1", "ed8da0e186a8"],
+ ["ed8da2", "e18491e185a4e186a9"],
+ ["ed8da2", "ed8da0e186a9"],
+ ["ed8da3", "e18491e185a4e186aa"],
+ ["ed8da3", "ed8da0e186aa"],
+ ["ed8da4", "e18491e185a4e186ab"],
+ ["ed8da4", "ed8da0e186ab"],
+ ["ed8da5", "e18491e185a4e186ac"],
+ ["ed8da5", "ed8da0e186ac"],
+ ["ed8da6", "e18491e185a4e186ad"],
+ ["ed8da6", "ed8da0e186ad"],
+ ["ed8da7", "e18491e185a4e186ae"],
+ ["ed8da7", "ed8da0e186ae"],
+ ["ed8da8", "e18491e185a4e186af"],
+ ["ed8da8", "ed8da0e186af"],
+ ["ed8da9", "e18491e185a4e186b0"],
+ ["ed8da9", "ed8da0e186b0"],
+ ["ed8daa", "e18491e185a4e186b1"],
+ ["ed8daa", "ed8da0e186b1"],
+ ["ed8dab", "e18491e185a4e186b2"],
+ ["ed8dab", "ed8da0e186b2"],
+ ["ed8dac", "e18491e185a4e186b3"],
+ ["ed8dac", "ed8da0e186b3"],
+ ["ed8dad", "e18491e185a4e186b4"],
+ ["ed8dad", "ed8da0e186b4"],
+ ["ed8dae", "e18491e185a4e186b5"],
+ ["ed8dae", "ed8da0e186b5"],
+ ["ed8daf", "e18491e185a4e186b6"],
+ ["ed8daf", "ed8da0e186b6"],
+ ["ed8db0", "e18491e185a4e186b7"],
+ ["ed8db0", "ed8da0e186b7"],
+ ["ed8db1", "e18491e185a4e186b8"],
+ ["ed8db1", "ed8da0e186b8"],
+ ["ed8db2", "e18491e185a4e186b9"],
+ ["ed8db2", "ed8da0e186b9"],
+ ["ed8db3", "e18491e185a4e186ba"],
+ ["ed8db3", "ed8da0e186ba"],
+ ["ed8db4", "e18491e185a4e186bb"],
+ ["ed8db4", "ed8da0e186bb"],
+ ["ed8db5", "e18491e185a4e186bc"],
+ ["ed8db5", "ed8da0e186bc"],
+ ["ed8db6", "e18491e185a4e186bd"],
+ ["ed8db6", "ed8da0e186bd"],
+ ["ed8db7", "e18491e185a4e186be"],
+ ["ed8db7", "ed8da0e186be"],
+ ["ed8db8", "e18491e185a4e186bf"],
+ ["ed8db8", "ed8da0e186bf"],
+ ["ed8db9", "e18491e185a4e18780"],
+ ["ed8db9", "ed8da0e18780"],
+ ["ed8dba", "e18491e185a4e18781"],
+ ["ed8dba", "ed8da0e18781"],
+ ["ed8dbb", "e18491e185a4e18782"],
+ ["ed8dbb", "ed8da0e18782"],
+ ["ed8dbc", "e18491e185a5"],
+ ["ed8dbd", "e18491e185a5e186a8"],
+ ["ed8dbd", "ed8dbce186a8"],
+ ["ed8dbe", "e18491e185a5e186a9"],
+ ["ed8dbe", "ed8dbce186a9"],
+ ["ed8dbf", "e18491e185a5e186aa"],
+ ["ed8dbf", "ed8dbce186aa"],
+ ["ed8e80", "e18491e185a5e186ab"],
+ ["ed8e80", "ed8dbce186ab"],
+ ["ed8e81", "e18491e185a5e186ac"],
+ ["ed8e81", "ed8dbce186ac"],
+ ["ed8e82", "e18491e185a5e186ad"],
+ ["ed8e82", "ed8dbce186ad"],
+ ["ed8e83", "e18491e185a5e186ae"],
+ ["ed8e83", "ed8dbce186ae"],
+ ["ed8e84", "e18491e185a5e186af"],
+ ["ed8e84", "ed8dbce186af"],
+ ["ed8e85", "e18491e185a5e186b0"],
+ ["ed8e85", "ed8dbce186b0"],
+ ["ed8e86", "e18491e185a5e186b1"],
+ ["ed8e86", "ed8dbce186b1"],
+ ["ed8e87", "e18491e185a5e186b2"],
+ ["ed8e87", "ed8dbce186b2"],
+ ["ed8e88", "e18491e185a5e186b3"],
+ ["ed8e88", "ed8dbce186b3"],
+ ["ed8e89", "e18491e185a5e186b4"],
+ ["ed8e89", "ed8dbce186b4"],
+ ["ed8e8a", "e18491e185a5e186b5"],
+ ["ed8e8a", "ed8dbce186b5"],
+ ["ed8e8b", "e18491e185a5e186b6"],
+ ["ed8e8b", "ed8dbce186b6"],
+ ["ed8e8c", "e18491e185a5e186b7"],
+ ["ed8e8c", "ed8dbce186b7"],
+ ["ed8e8d", "e18491e185a5e186b8"],
+ ["ed8e8d", "ed8dbce186b8"],
+ ["ed8e8e", "e18491e185a5e186b9"],
+ ["ed8e8e", "ed8dbce186b9"],
+ ["ed8e8f", "e18491e185a5e186ba"],
+ ["ed8e8f", "ed8dbce186ba"],
+ ["ed8e90", "e18491e185a5e186bb"],
+ ["ed8e90", "ed8dbce186bb"],
+ ["ed8e91", "e18491e185a5e186bc"],
+ ["ed8e91", "ed8dbce186bc"],
+ ["ed8e92", "e18491e185a5e186bd"],
+ ["ed8e92", "ed8dbce186bd"],
+ ["ed8e93", "e18491e185a5e186be"],
+ ["ed8e93", "ed8dbce186be"],
+ ["ed8e94", "e18491e185a5e186bf"],
+ ["ed8e94", "ed8dbce186bf"],
+ ["ed8e95", "e18491e185a5e18780"],
+ ["ed8e95", "ed8dbce18780"],
+ ["ed8e96", "e18491e185a5e18781"],
+ ["ed8e96", "ed8dbce18781"],
+ ["ed8e97", "e18491e185a5e18782"],
+ ["ed8e97", "ed8dbce18782"],
+ ["ed8e98", "e18491e185a6"],
+ ["ed8e99", "e18491e185a6e186a8"],
+ ["ed8e99", "ed8e98e186a8"],
+ ["ed8e9a", "e18491e185a6e186a9"],
+ ["ed8e9a", "ed8e98e186a9"],
+ ["ed8e9b", "e18491e185a6e186aa"],
+ ["ed8e9b", "ed8e98e186aa"],
+ ["ed8e9c", "e18491e185a6e186ab"],
+ ["ed8e9c", "ed8e98e186ab"],
+ ["ed8e9d", "e18491e185a6e186ac"],
+ ["ed8e9d", "ed8e98e186ac"],
+ ["ed8e9e", "e18491e185a6e186ad"],
+ ["ed8e9e", "ed8e98e186ad"],
+ ["ed8e9f", "e18491e185a6e186ae"],
+ ["ed8e9f", "ed8e98e186ae"],
+ ["ed8ea0", "e18491e185a6e186af"],
+ ["ed8ea0", "ed8e98e186af"],
+ ["ed8ea1", "e18491e185a6e186b0"],
+ ["ed8ea1", "ed8e98e186b0"],
+ ["ed8ea2", "e18491e185a6e186b1"],
+ ["ed8ea2", "ed8e98e186b1"],
+ ["ed8ea3", "e18491e185a6e186b2"],
+ ["ed8ea3", "ed8e98e186b2"],
+ ["ed8ea4", "e18491e185a6e186b3"],
+ ["ed8ea4", "ed8e98e186b3"],
+ ["ed8ea5", "e18491e185a6e186b4"],
+ ["ed8ea5", "ed8e98e186b4"],
+ ["ed8ea6", "e18491e185a6e186b5"],
+ ["ed8ea6", "ed8e98e186b5"],
+ ["ed8ea7", "e18491e185a6e186b6"],
+ ["ed8ea7", "ed8e98e186b6"],
+ ["ed8ea8", "e18491e185a6e186b7"],
+ ["ed8ea8", "ed8e98e186b7"],
+ ["ed8ea9", "e18491e185a6e186b8"],
+ ["ed8ea9", "ed8e98e186b8"],
+ ["ed8eaa", "e18491e185a6e186b9"],
+ ["ed8eaa", "ed8e98e186b9"],
+ ["ed8eab", "e18491e185a6e186ba"],
+ ["ed8eab", "ed8e98e186ba"],
+ ["ed8eac", "e18491e185a6e186bb"],
+ ["ed8eac", "ed8e98e186bb"],
+ ["ed8ead", "e18491e185a6e186bc"],
+ ["ed8ead", "ed8e98e186bc"],
+ ["ed8eae", "e18491e185a6e186bd"],
+ ["ed8eae", "ed8e98e186bd"],
+ ["ed8eaf", "e18491e185a6e186be"],
+ ["ed8eaf", "ed8e98e186be"],
+ ["ed8eb0", "e18491e185a6e186bf"],
+ ["ed8eb0", "ed8e98e186bf"],
+ ["ed8eb1", "e18491e185a6e18780"],
+ ["ed8eb1", "ed8e98e18780"],
+ ["ed8eb2", "e18491e185a6e18781"],
+ ["ed8eb2", "ed8e98e18781"],
+ ["ed8eb3", "e18491e185a6e18782"],
+ ["ed8eb3", "ed8e98e18782"],
+ ["ed8eb4", "e18491e185a7"],
+ ["ed8eb5", "e18491e185a7e186a8"],
+ ["ed8eb5", "ed8eb4e186a8"],
+ ["ed8eb6", "e18491e185a7e186a9"],
+ ["ed8eb6", "ed8eb4e186a9"],
+ ["ed8eb7", "e18491e185a7e186aa"],
+ ["ed8eb7", "ed8eb4e186aa"],
+ ["ed8eb8", "e18491e185a7e186ab"],
+ ["ed8eb8", "ed8eb4e186ab"],
+ ["ed8eb9", "e18491e185a7e186ac"],
+ ["ed8eb9", "ed8eb4e186ac"],
+ ["ed8eba", "e18491e185a7e186ad"],
+ ["ed8eba", "ed8eb4e186ad"],
+ ["ed8ebb", "e18491e185a7e186ae"],
+ ["ed8ebb", "ed8eb4e186ae"],
+ ["ed8ebc", "e18491e185a7e186af"],
+ ["ed8ebc", "ed8eb4e186af"],
+ ["ed8ebd", "e18491e185a7e186b0"],
+ ["ed8ebd", "ed8eb4e186b0"],
+ ["ed8ebe", "e18491e185a7e186b1"],
+ ["ed8ebe", "ed8eb4e186b1"],
+ ["ed8ebf", "e18491e185a7e186b2"],
+ ["ed8ebf", "ed8eb4e186b2"],
+ ["ed8f80", "e18491e185a7e186b3"],
+ ["ed8f80", "ed8eb4e186b3"],
+ ["ed8f81", "e18491e185a7e186b4"],
+ ["ed8f81", "ed8eb4e186b4"],
+ ["ed8f82", "e18491e185a7e186b5"],
+ ["ed8f82", "ed8eb4e186b5"],
+ ["ed8f83", "e18491e185a7e186b6"],
+ ["ed8f83", "ed8eb4e186b6"],
+ ["ed8f84", "e18491e185a7e186b7"],
+ ["ed8f84", "ed8eb4e186b7"],
+ ["ed8f85", "e18491e185a7e186b8"],
+ ["ed8f85", "ed8eb4e186b8"],
+ ["ed8f86", "e18491e185a7e186b9"],
+ ["ed8f86", "ed8eb4e186b9"],
+ ["ed8f87", "e18491e185a7e186ba"],
+ ["ed8f87", "ed8eb4e186ba"],
+ ["ed8f88", "e18491e185a7e186bb"],
+ ["ed8f88", "ed8eb4e186bb"],
+ ["ed8f89", "e18491e185a7e186bc"],
+ ["ed8f89", "ed8eb4e186bc"],
+ ["ed8f8a", "e18491e185a7e186bd"],
+ ["ed8f8a", "ed8eb4e186bd"],
+ ["ed8f8b", "e18491e185a7e186be"],
+ ["ed8f8b", "ed8eb4e186be"],
+ ["ed8f8c", "e18491e185a7e186bf"],
+ ["ed8f8c", "ed8eb4e186bf"],
+ ["ed8f8d", "e18491e185a7e18780"],
+ ["ed8f8d", "ed8eb4e18780"],
+ ["ed8f8e", "e18491e185a7e18781"],
+ ["ed8f8e", "ed8eb4e18781"],
+ ["ed8f8f", "e18491e185a7e18782"],
+ ["ed8f8f", "ed8eb4e18782"],
+ ["ed8f90", "e18491e185a8"],
+ ["ed8f91", "e18491e185a8e186a8"],
+ ["ed8f91", "ed8f90e186a8"],
+ ["ed8f92", "e18491e185a8e186a9"],
+ ["ed8f92", "ed8f90e186a9"],
+ ["ed8f93", "e18491e185a8e186aa"],
+ ["ed8f93", "ed8f90e186aa"],
+ ["ed8f94", "e18491e185a8e186ab"],
+ ["ed8f94", "ed8f90e186ab"],
+ ["ed8f95", "e18491e185a8e186ac"],
+ ["ed8f95", "ed8f90e186ac"],
+ ["ed8f96", "e18491e185a8e186ad"],
+ ["ed8f96", "ed8f90e186ad"],
+ ["ed8f97", "e18491e185a8e186ae"],
+ ["ed8f97", "ed8f90e186ae"],
+ ["ed8f98", "e18491e185a8e186af"],
+ ["ed8f98", "ed8f90e186af"],
+ ["ed8f99", "e18491e185a8e186b0"],
+ ["ed8f99", "ed8f90e186b0"],
+ ["ed8f9a", "e18491e185a8e186b1"],
+ ["ed8f9a", "ed8f90e186b1"],
+ ["ed8f9b", "e18491e185a8e186b2"],
+ ["ed8f9b", "ed8f90e186b2"],
+ ["ed8f9c", "e18491e185a8e186b3"],
+ ["ed8f9c", "ed8f90e186b3"],
+ ["ed8f9d", "e18491e185a8e186b4"],
+ ["ed8f9d", "ed8f90e186b4"],
+ ["ed8f9e", "e18491e185a8e186b5"],
+ ["ed8f9e", "ed8f90e186b5"],
+ ["ed8f9f", "e18491e185a8e186b6"],
+ ["ed8f9f", "ed8f90e186b6"],
+ ["ed8fa0", "e18491e185a8e186b7"],
+ ["ed8fa0", "ed8f90e186b7"],
+ ["ed8fa1", "e18491e185a8e186b8"],
+ ["ed8fa1", "ed8f90e186b8"],
+ ["ed8fa2", "e18491e185a8e186b9"],
+ ["ed8fa2", "ed8f90e186b9"],
+ ["ed8fa3", "e18491e185a8e186ba"],
+ ["ed8fa3", "ed8f90e186ba"],
+ ["ed8fa4", "e18491e185a8e186bb"],
+ ["ed8fa4", "ed8f90e186bb"],
+ ["ed8fa5", "e18491e185a8e186bc"],
+ ["ed8fa5", "ed8f90e186bc"],
+ ["ed8fa6", "e18491e185a8e186bd"],
+ ["ed8fa6", "ed8f90e186bd"],
+ ["ed8fa7", "e18491e185a8e186be"],
+ ["ed8fa7", "ed8f90e186be"],
+ ["ed8fa8", "e18491e185a8e186bf"],
+ ["ed8fa8", "ed8f90e186bf"],
+ ["ed8fa9", "e18491e185a8e18780"],
+ ["ed8fa9", "ed8f90e18780"],
+ ["ed8faa", "e18491e185a8e18781"],
+ ["ed8faa", "ed8f90e18781"],
+ ["ed8fab", "e18491e185a8e18782"],
+ ["ed8fab", "ed8f90e18782"],
+ ["ed8fac", "e18491e185a9"],
+ ["ed8fad", "e18491e185a9e186a8"],
+ ["ed8fad", "ed8face186a8"],
+ ["ed8fae", "e18491e185a9e186a9"],
+ ["ed8fae", "ed8face186a9"],
+ ["ed8faf", "e18491e185a9e186aa"],
+ ["ed8faf", "ed8face186aa"],
+ ["ed8fb0", "e18491e185a9e186ab"],
+ ["ed8fb0", "ed8face186ab"],
+ ["ed8fb1", "e18491e185a9e186ac"],
+ ["ed8fb1", "ed8face186ac"],
+ ["ed8fb2", "e18491e185a9e186ad"],
+ ["ed8fb2", "ed8face186ad"],
+ ["ed8fb3", "e18491e185a9e186ae"],
+ ["ed8fb3", "ed8face186ae"],
+ ["ed8fb4", "e18491e185a9e186af"],
+ ["ed8fb4", "ed8face186af"],
+ ["ed8fb5", "e18491e185a9e186b0"],
+ ["ed8fb5", "ed8face186b0"],
+ ["ed8fb6", "e18491e185a9e186b1"],
+ ["ed8fb6", "ed8face186b1"],
+ ["ed8fb7", "e18491e185a9e186b2"],
+ ["ed8fb7", "ed8face186b2"],
+ ["ed8fb8", "e18491e185a9e186b3"],
+ ["ed8fb8", "ed8face186b3"],
+ ["ed8fb9", "e18491e185a9e186b4"],
+ ["ed8fb9", "ed8face186b4"],
+ ["ed8fba", "e18491e185a9e186b5"],
+ ["ed8fba", "ed8face186b5"],
+ ["ed8fbb", "e18491e185a9e186b6"],
+ ["ed8fbb", "ed8face186b6"],
+ ["ed8fbc", "e18491e185a9e186b7"],
+ ["ed8fbc", "ed8face186b7"],
+ ["ed8fbd", "e18491e185a9e186b8"],
+ ["ed8fbd", "ed8face186b8"],
+ ["ed8fbe", "e18491e185a9e186b9"],
+ ["ed8fbe", "ed8face186b9"],
+ ["ed8fbf", "e18491e185a9e186ba"],
+ ["ed8fbf", "ed8face186ba"],
+ ["ed9080", "e18491e185a9e186bb"],
+ ["ed9080", "ed8face186bb"],
+ ["ed9081", "e18491e185a9e186bc"],
+ ["ed9081", "ed8face186bc"],
+ ["ed9082", "e18491e185a9e186bd"],
+ ["ed9082", "ed8face186bd"],
+ ["ed9083", "e18491e185a9e186be"],
+ ["ed9083", "ed8face186be"],
+ ["ed9084", "e18491e185a9e186bf"],
+ ["ed9084", "ed8face186bf"],
+ ["ed9085", "e18491e185a9e18780"],
+ ["ed9085", "ed8face18780"],
+ ["ed9086", "e18491e185a9e18781"],
+ ["ed9086", "ed8face18781"],
+ ["ed9087", "e18491e185a9e18782"],
+ ["ed9087", "ed8face18782"],
+ ["ed9088", "e18491e185aa"],
+ ["ed9089", "e18491e185aae186a8"],
+ ["ed9089", "ed9088e186a8"],
+ ["ed908a", "e18491e185aae186a9"],
+ ["ed908a", "ed9088e186a9"],
+ ["ed908b", "e18491e185aae186aa"],
+ ["ed908b", "ed9088e186aa"],
+ ["ed908c", "e18491e185aae186ab"],
+ ["ed908c", "ed9088e186ab"],
+ ["ed908d", "e18491e185aae186ac"],
+ ["ed908d", "ed9088e186ac"],
+ ["ed908e", "e18491e185aae186ad"],
+ ["ed908e", "ed9088e186ad"],
+ ["ed908f", "e18491e185aae186ae"],
+ ["ed908f", "ed9088e186ae"],
+ ["ed9090", "e18491e185aae186af"],
+ ["ed9090", "ed9088e186af"],
+ ["ed9091", "e18491e185aae186b0"],
+ ["ed9091", "ed9088e186b0"],
+ ["ed9092", "e18491e185aae186b1"],
+ ["ed9092", "ed9088e186b1"],
+ ["ed9093", "e18491e185aae186b2"],
+ ["ed9093", "ed9088e186b2"],
+ ["ed9094", "e18491e185aae186b3"],
+ ["ed9094", "ed9088e186b3"],
+ ["ed9095", "e18491e185aae186b4"],
+ ["ed9095", "ed9088e186b4"],
+ ["ed9096", "e18491e185aae186b5"],
+ ["ed9096", "ed9088e186b5"],
+ ["ed9097", "e18491e185aae186b6"],
+ ["ed9097", "ed9088e186b6"],
+ ["ed9098", "e18491e185aae186b7"],
+ ["ed9098", "ed9088e186b7"],
+ ["ed9099", "e18491e185aae186b8"],
+ ["ed9099", "ed9088e186b8"],
+ ["ed909a", "e18491e185aae186b9"],
+ ["ed909a", "ed9088e186b9"],
+ ["ed909b", "e18491e185aae186ba"],
+ ["ed909b", "ed9088e186ba"],
+ ["ed909c", "e18491e185aae186bb"],
+ ["ed909c", "ed9088e186bb"],
+ ["ed909d", "e18491e185aae186bc"],
+ ["ed909d", "ed9088e186bc"],
+ ["ed909e", "e18491e185aae186bd"],
+ ["ed909e", "ed9088e186bd"],
+ ["ed909f", "e18491e185aae186be"],
+ ["ed909f", "ed9088e186be"],
+ ["ed90a0", "e18491e185aae186bf"],
+ ["ed90a0", "ed9088e186bf"],
+ ["ed90a1", "e18491e185aae18780"],
+ ["ed90a1", "ed9088e18780"],
+ ["ed90a2", "e18491e185aae18781"],
+ ["ed90a2", "ed9088e18781"],
+ ["ed90a3", "e18491e185aae18782"],
+ ["ed90a3", "ed9088e18782"],
+ ["ed90a4", "e18491e185ab"],
+ ["ed90a5", "e18491e185abe186a8"],
+ ["ed90a5", "ed90a4e186a8"],
+ ["ed90a6", "e18491e185abe186a9"],
+ ["ed90a6", "ed90a4e186a9"],
+ ["ed90a7", "e18491e185abe186aa"],
+ ["ed90a7", "ed90a4e186aa"],
+ ["ed90a8", "e18491e185abe186ab"],
+ ["ed90a8", "ed90a4e186ab"],
+ ["ed90a9", "e18491e185abe186ac"],
+ ["ed90a9", "ed90a4e186ac"],
+ ["ed90aa", "e18491e185abe186ad"],
+ ["ed90aa", "ed90a4e186ad"],
+ ["ed90ab", "e18491e185abe186ae"],
+ ["ed90ab", "ed90a4e186ae"],
+ ["ed90ac", "e18491e185abe186af"],
+ ["ed90ac", "ed90a4e186af"],
+ ["ed90ad", "e18491e185abe186b0"],
+ ["ed90ad", "ed90a4e186b0"],
+ ["ed90ae", "e18491e185abe186b1"],
+ ["ed90ae", "ed90a4e186b1"],
+ ["ed90af", "e18491e185abe186b2"],
+ ["ed90af", "ed90a4e186b2"],
+ ["ed90b0", "e18491e185abe186b3"],
+ ["ed90b0", "ed90a4e186b3"],
+ ["ed90b1", "e18491e185abe186b4"],
+ ["ed90b1", "ed90a4e186b4"],
+ ["ed90b2", "e18491e185abe186b5"],
+ ["ed90b2", "ed90a4e186b5"],
+ ["ed90b3", "e18491e185abe186b6"],
+ ["ed90b3", "ed90a4e186b6"],
+ ["ed90b4", "e18491e185abe186b7"],
+ ["ed90b4", "ed90a4e186b7"],
+ ["ed90b5", "e18491e185abe186b8"],
+ ["ed90b5", "ed90a4e186b8"],
+ ["ed90b6", "e18491e185abe186b9"],
+ ["ed90b6", "ed90a4e186b9"],
+ ["ed90b7", "e18491e185abe186ba"],
+ ["ed90b7", "ed90a4e186ba"],
+ ["ed90b8", "e18491e185abe186bb"],
+ ["ed90b8", "ed90a4e186bb"],
+ ["ed90b9", "e18491e185abe186bc"],
+ ["ed90b9", "ed90a4e186bc"],
+ ["ed90ba", "e18491e185abe186bd"],
+ ["ed90ba", "ed90a4e186bd"],
+ ["ed90bb", "e18491e185abe186be"],
+ ["ed90bb", "ed90a4e186be"],
+ ["ed90bc", "e18491e185abe186bf"],
+ ["ed90bc", "ed90a4e186bf"],
+ ["ed90bd", "e18491e185abe18780"],
+ ["ed90bd", "ed90a4e18780"],
+ ["ed90be", "e18491e185abe18781"],
+ ["ed90be", "ed90a4e18781"],
+ ["ed90bf", "e18491e185abe18782"],
+ ["ed90bf", "ed90a4e18782"],
+ ["ed9180", "e18491e185ac"],
+ ["ed9181", "e18491e185ace186a8"],
+ ["ed9181", "ed9180e186a8"],
+ ["ed9182", "e18491e185ace186a9"],
+ ["ed9182", "ed9180e186a9"],
+ ["ed9183", "e18491e185ace186aa"],
+ ["ed9183", "ed9180e186aa"],
+ ["ed9184", "e18491e185ace186ab"],
+ ["ed9184", "ed9180e186ab"],
+ ["ed9185", "e18491e185ace186ac"],
+ ["ed9185", "ed9180e186ac"],
+ ["ed9186", "e18491e185ace186ad"],
+ ["ed9186", "ed9180e186ad"],
+ ["ed9187", "e18491e185ace186ae"],
+ ["ed9187", "ed9180e186ae"],
+ ["ed9188", "e18491e185ace186af"],
+ ["ed9188", "ed9180e186af"],
+ ["ed9189", "e18491e185ace186b0"],
+ ["ed9189", "ed9180e186b0"],
+ ["ed918a", "e18491e185ace186b1"],
+ ["ed918a", "ed9180e186b1"],
+ ["ed918b", "e18491e185ace186b2"],
+ ["ed918b", "ed9180e186b2"],
+ ["ed918c", "e18491e185ace186b3"],
+ ["ed918c", "ed9180e186b3"],
+ ["ed918d", "e18491e185ace186b4"],
+ ["ed918d", "ed9180e186b4"],
+ ["ed918e", "e18491e185ace186b5"],
+ ["ed918e", "ed9180e186b5"],
+ ["ed918f", "e18491e185ace186b6"],
+ ["ed918f", "ed9180e186b6"],
+ ["ed9190", "e18491e185ace186b7"],
+ ["ed9190", "ed9180e186b7"],
+ ["ed9191", "e18491e185ace186b8"],
+ ["ed9191", "ed9180e186b8"],
+ ["ed9192", "e18491e185ace186b9"],
+ ["ed9192", "ed9180e186b9"],
+ ["ed9193", "e18491e185ace186ba"],
+ ["ed9193", "ed9180e186ba"],
+ ["ed9194", "e18491e185ace186bb"],
+ ["ed9194", "ed9180e186bb"],
+ ["ed9195", "e18491e185ace186bc"],
+ ["ed9195", "ed9180e186bc"],
+ ["ed9196", "e18491e185ace186bd"],
+ ["ed9196", "ed9180e186bd"],
+ ["ed9197", "e18491e185ace186be"],
+ ["ed9197", "ed9180e186be"],
+ ["ed9198", "e18491e185ace186bf"],
+ ["ed9198", "ed9180e186bf"],
+ ["ed9199", "e18491e185ace18780"],
+ ["ed9199", "ed9180e18780"],
+ ["ed919a", "e18491e185ace18781"],
+ ["ed919a", "ed9180e18781"],
+ ["ed919b", "e18491e185ace18782"],
+ ["ed919b", "ed9180e18782"],
+ ["ed919c", "e18491e185ad"],
+ ["ed919d", "e18491e185ade186a8"],
+ ["ed919d", "ed919ce186a8"],
+ ["ed919e", "e18491e185ade186a9"],
+ ["ed919e", "ed919ce186a9"],
+ ["ed919f", "e18491e185ade186aa"],
+ ["ed919f", "ed919ce186aa"],
+ ["ed91a0", "e18491e185ade186ab"],
+ ["ed91a0", "ed919ce186ab"],
+ ["ed91a1", "e18491e185ade186ac"],
+ ["ed91a1", "ed919ce186ac"],
+ ["ed91a2", "e18491e185ade186ad"],
+ ["ed91a2", "ed919ce186ad"],
+ ["ed91a3", "e18491e185ade186ae"],
+ ["ed91a3", "ed919ce186ae"],
+ ["ed91a4", "e18491e185ade186af"],
+ ["ed91a4", "ed919ce186af"],
+ ["ed91a5", "e18491e185ade186b0"],
+ ["ed91a5", "ed919ce186b0"],
+ ["ed91a6", "e18491e185ade186b1"],
+ ["ed91a6", "ed919ce186b1"],
+ ["ed91a7", "e18491e185ade186b2"],
+ ["ed91a7", "ed919ce186b2"],
+ ["ed91a8", "e18491e185ade186b3"],
+ ["ed91a8", "ed919ce186b3"],
+ ["ed91a9", "e18491e185ade186b4"],
+ ["ed91a9", "ed919ce186b4"],
+ ["ed91aa", "e18491e185ade186b5"],
+ ["ed91aa", "ed919ce186b5"],
+ ["ed91ab", "e18491e185ade186b6"],
+ ["ed91ab", "ed919ce186b6"],
+ ["ed91ac", "e18491e185ade186b7"],
+ ["ed91ac", "ed919ce186b7"],
+ ["ed91ad", "e18491e185ade186b8"],
+ ["ed91ad", "ed919ce186b8"],
+ ["ed91ae", "e18491e185ade186b9"],
+ ["ed91ae", "ed919ce186b9"],
+ ["ed91af", "e18491e185ade186ba"],
+ ["ed91af", "ed919ce186ba"],
+ ["ed91b0", "e18491e185ade186bb"],
+ ["ed91b0", "ed919ce186bb"],
+ ["ed91b1", "e18491e185ade186bc"],
+ ["ed91b1", "ed919ce186bc"],
+ ["ed91b2", "e18491e185ade186bd"],
+ ["ed91b2", "ed919ce186bd"],
+ ["ed91b3", "e18491e185ade186be"],
+ ["ed91b3", "ed919ce186be"],
+ ["ed91b4", "e18491e185ade186bf"],
+ ["ed91b4", "ed919ce186bf"],
+ ["ed91b5", "e18491e185ade18780"],
+ ["ed91b5", "ed919ce18780"],
+ ["ed91b6", "e18491e185ade18781"],
+ ["ed91b6", "ed919ce18781"],
+ ["ed91b7", "e18491e185ade18782"],
+ ["ed91b7", "ed919ce18782"],
+ ["ed91b8", "e18491e185ae"],
+ ["ed91b9", "e18491e185aee186a8"],
+ ["ed91b9", "ed91b8e186a8"],
+ ["ed91ba", "e18491e185aee186a9"],
+ ["ed91ba", "ed91b8e186a9"],
+ ["ed91bb", "e18491e185aee186aa"],
+ ["ed91bb", "ed91b8e186aa"],
+ ["ed91bc", "e18491e185aee186ab"],
+ ["ed91bc", "ed91b8e186ab"],
+ ["ed91bd", "e18491e185aee186ac"],
+ ["ed91bd", "ed91b8e186ac"],
+ ["ed91be", "e18491e185aee186ad"],
+ ["ed91be", "ed91b8e186ad"],
+ ["ed91bf", "e18491e185aee186ae"],
+ ["ed91bf", "ed91b8e186ae"],
+ ["ed9280", "e18491e185aee186af"],
+ ["ed9280", "ed91b8e186af"],
+ ["ed9281", "e18491e185aee186b0"],
+ ["ed9281", "ed91b8e186b0"],
+ ["ed9282", "e18491e185aee186b1"],
+ ["ed9282", "ed91b8e186b1"],
+ ["ed9283", "e18491e185aee186b2"],
+ ["ed9283", "ed91b8e186b2"],
+ ["ed9284", "e18491e185aee186b3"],
+ ["ed9284", "ed91b8e186b3"],
+ ["ed9285", "e18491e185aee186b4"],
+ ["ed9285", "ed91b8e186b4"],
+ ["ed9286", "e18491e185aee186b5"],
+ ["ed9286", "ed91b8e186b5"],
+ ["ed9287", "e18491e185aee186b6"],
+ ["ed9287", "ed91b8e186b6"],
+ ["ed9288", "e18491e185aee186b7"],
+ ["ed9288", "ed91b8e186b7"],
+ ["ed9289", "e18491e185aee186b8"],
+ ["ed9289", "ed91b8e186b8"],
+ ["ed928a", "e18491e185aee186b9"],
+ ["ed928a", "ed91b8e186b9"],
+ ["ed928b", "e18491e185aee186ba"],
+ ["ed928b", "ed91b8e186ba"],
+ ["ed928c", "e18491e185aee186bb"],
+ ["ed928c", "ed91b8e186bb"],
+ ["ed928d", "e18491e185aee186bc"],
+ ["ed928d", "ed91b8e186bc"],
+ ["ed928e", "e18491e185aee186bd"],
+ ["ed928e", "ed91b8e186bd"],
+ ["ed928f", "e18491e185aee186be"],
+ ["ed928f", "ed91b8e186be"],
+ ["ed9290", "e18491e185aee186bf"],
+ ["ed9290", "ed91b8e186bf"],
+ ["ed9291", "e18491e185aee18780"],
+ ["ed9291", "ed91b8e18780"],
+ ["ed9292", "e18491e185aee18781"],
+ ["ed9292", "ed91b8e18781"],
+ ["ed9293", "e18491e185aee18782"],
+ ["ed9293", "ed91b8e18782"],
+ ["ed9294", "e18491e185af"],
+ ["ed9295", "e18491e185afe186a8"],
+ ["ed9295", "ed9294e186a8"],
+ ["ed9296", "e18491e185afe186a9"],
+ ["ed9296", "ed9294e186a9"],
+ ["ed9297", "e18491e185afe186aa"],
+ ["ed9297", "ed9294e186aa"],
+ ["ed9298", "e18491e185afe186ab"],
+ ["ed9298", "ed9294e186ab"],
+ ["ed9299", "e18491e185afe186ac"],
+ ["ed9299", "ed9294e186ac"],
+ ["ed929a", "e18491e185afe186ad"],
+ ["ed929a", "ed9294e186ad"],
+ ["ed929b", "e18491e185afe186ae"],
+ ["ed929b", "ed9294e186ae"],
+ ["ed929c", "e18491e185afe186af"],
+ ["ed929c", "ed9294e186af"],
+ ["ed929d", "e18491e185afe186b0"],
+ ["ed929d", "ed9294e186b0"],
+ ["ed929e", "e18491e185afe186b1"],
+ ["ed929e", "ed9294e186b1"],
+ ["ed929f", "e18491e185afe186b2"],
+ ["ed929f", "ed9294e186b2"],
+ ["ed92a0", "e18491e185afe186b3"],
+ ["ed92a0", "ed9294e186b3"],
+ ["ed92a1", "e18491e185afe186b4"],
+ ["ed92a1", "ed9294e186b4"],
+ ["ed92a2", "e18491e185afe186b5"],
+ ["ed92a2", "ed9294e186b5"],
+ ["ed92a3", "e18491e185afe186b6"],
+ ["ed92a3", "ed9294e186b6"],
+ ["ed92a4", "e18491e185afe186b7"],
+ ["ed92a4", "ed9294e186b7"],
+ ["ed92a5", "e18491e185afe186b8"],
+ ["ed92a5", "ed9294e186b8"],
+ ["ed92a6", "e18491e185afe186b9"],
+ ["ed92a6", "ed9294e186b9"],
+ ["ed92a7", "e18491e185afe186ba"],
+ ["ed92a7", "ed9294e186ba"],
+ ["ed92a8", "e18491e185afe186bb"],
+ ["ed92a8", "ed9294e186bb"],
+ ["ed92a9", "e18491e185afe186bc"],
+ ["ed92a9", "ed9294e186bc"],
+ ["ed92aa", "e18491e185afe186bd"],
+ ["ed92aa", "ed9294e186bd"],
+ ["ed92ab", "e18491e185afe186be"],
+ ["ed92ab", "ed9294e186be"],
+ ["ed92ac", "e18491e185afe186bf"],
+ ["ed92ac", "ed9294e186bf"],
+ ["ed92ad", "e18491e185afe18780"],
+ ["ed92ad", "ed9294e18780"],
+ ["ed92ae", "e18491e185afe18781"],
+ ["ed92ae", "ed9294e18781"],
+ ["ed92af", "e18491e185afe18782"],
+ ["ed92af", "ed9294e18782"],
+ ["ed92b0", "e18491e185b0"],
+ ["ed92b1", "e18491e185b0e186a8"],
+ ["ed92b1", "ed92b0e186a8"],
+ ["ed92b2", "e18491e185b0e186a9"],
+ ["ed92b2", "ed92b0e186a9"],
+ ["ed92b3", "e18491e185b0e186aa"],
+ ["ed92b3", "ed92b0e186aa"],
+ ["ed92b4", "e18491e185b0e186ab"],
+ ["ed92b4", "ed92b0e186ab"],
+ ["ed92b5", "e18491e185b0e186ac"],
+ ["ed92b5", "ed92b0e186ac"],
+ ["ed92b6", "e18491e185b0e186ad"],
+ ["ed92b6", "ed92b0e186ad"],
+ ["ed92b7", "e18491e185b0e186ae"],
+ ["ed92b7", "ed92b0e186ae"],
+ ["ed92b8", "e18491e185b0e186af"],
+ ["ed92b8", "ed92b0e186af"],
+ ["ed92b9", "e18491e185b0e186b0"],
+ ["ed92b9", "ed92b0e186b0"],
+ ["ed92ba", "e18491e185b0e186b1"],
+ ["ed92ba", "ed92b0e186b1"],
+ ["ed92bb", "e18491e185b0e186b2"],
+ ["ed92bb", "ed92b0e186b2"],
+ ["ed92bc", "e18491e185b0e186b3"],
+ ["ed92bc", "ed92b0e186b3"],
+ ["ed92bd", "e18491e185b0e186b4"],
+ ["ed92bd", "ed92b0e186b4"],
+ ["ed92be", "e18491e185b0e186b5"],
+ ["ed92be", "ed92b0e186b5"],
+ ["ed92bf", "e18491e185b0e186b6"],
+ ["ed92bf", "ed92b0e186b6"],
+ ["ed9380", "e18491e185b0e186b7"],
+ ["ed9380", "ed92b0e186b7"],
+ ["ed9381", "e18491e185b0e186b8"],
+ ["ed9381", "ed92b0e186b8"],
+ ["ed9382", "e18491e185b0e186b9"],
+ ["ed9382", "ed92b0e186b9"],
+ ["ed9383", "e18491e185b0e186ba"],
+ ["ed9383", "ed92b0e186ba"],
+ ["ed9384", "e18491e185b0e186bb"],
+ ["ed9384", "ed92b0e186bb"],
+ ["ed9385", "e18491e185b0e186bc"],
+ ["ed9385", "ed92b0e186bc"],
+ ["ed9386", "e18491e185b0e186bd"],
+ ["ed9386", "ed92b0e186bd"],
+ ["ed9387", "e18491e185b0e186be"],
+ ["ed9387", "ed92b0e186be"],
+ ["ed9388", "e18491e185b0e186bf"],
+ ["ed9388", "ed92b0e186bf"],
+ ["ed9389", "e18491e185b0e18780"],
+ ["ed9389", "ed92b0e18780"],
+ ["ed938a", "e18491e185b0e18781"],
+ ["ed938a", "ed92b0e18781"],
+ ["ed938b", "e18491e185b0e18782"],
+ ["ed938b", "ed92b0e18782"],
+ ["ed938c", "e18491e185b1"],
+ ["ed938d", "e18491e185b1e186a8"],
+ ["ed938d", "ed938ce186a8"],
+ ["ed938e", "e18491e185b1e186a9"],
+ ["ed938e", "ed938ce186a9"],
+ ["ed938f", "e18491e185b1e186aa"],
+ ["ed938f", "ed938ce186aa"],
+ ["ed9390", "e18491e185b1e186ab"],
+ ["ed9390", "ed938ce186ab"],
+ ["ed9391", "e18491e185b1e186ac"],
+ ["ed9391", "ed938ce186ac"],
+ ["ed9392", "e18491e185b1e186ad"],
+ ["ed9392", "ed938ce186ad"],
+ ["ed9393", "e18491e185b1e186ae"],
+ ["ed9393", "ed938ce186ae"],
+ ["ed9394", "e18491e185b1e186af"],
+ ["ed9394", "ed938ce186af"],
+ ["ed9395", "e18491e185b1e186b0"],
+ ["ed9395", "ed938ce186b0"],
+ ["ed9396", "e18491e185b1e186b1"],
+ ["ed9396", "ed938ce186b1"],
+ ["ed9397", "e18491e185b1e186b2"],
+ ["ed9397", "ed938ce186b2"],
+ ["ed9398", "e18491e185b1e186b3"],
+ ["ed9398", "ed938ce186b3"],
+ ["ed9399", "e18491e185b1e186b4"],
+ ["ed9399", "ed938ce186b4"],
+ ["ed939a", "e18491e185b1e186b5"],
+ ["ed939a", "ed938ce186b5"],
+ ["ed939b", "e18491e185b1e186b6"],
+ ["ed939b", "ed938ce186b6"],
+ ["ed939c", "e18491e185b1e186b7"],
+ ["ed939c", "ed938ce186b7"],
+ ["ed939d", "e18491e185b1e186b8"],
+ ["ed939d", "ed938ce186b8"],
+ ["ed939e", "e18491e185b1e186b9"],
+ ["ed939e", "ed938ce186b9"],
+ ["ed939f", "e18491e185b1e186ba"],
+ ["ed939f", "ed938ce186ba"],
+ ["ed93a0", "e18491e185b1e186bb"],
+ ["ed93a0", "ed938ce186bb"],
+ ["ed93a1", "e18491e185b1e186bc"],
+ ["ed93a1", "ed938ce186bc"],
+ ["ed93a2", "e18491e185b1e186bd"],
+ ["ed93a2", "ed938ce186bd"],
+ ["ed93a3", "e18491e185b1e186be"],
+ ["ed93a3", "ed938ce186be"],
+ ["ed93a4", "e18491e185b1e186bf"],
+ ["ed93a4", "ed938ce186bf"],
+ ["ed93a5", "e18491e185b1e18780"],
+ ["ed93a5", "ed938ce18780"],
+ ["ed93a6", "e18491e185b1e18781"],
+ ["ed93a6", "ed938ce18781"],
+ ["ed93a7", "e18491e185b1e18782"],
+ ["ed93a7", "ed938ce18782"],
+ ["ed93a8", "e18491e185b2"],
+ ["ed93a9", "e18491e185b2e186a8"],
+ ["ed93a9", "ed93a8e186a8"],
+ ["ed93aa", "e18491e185b2e186a9"],
+ ["ed93aa", "ed93a8e186a9"],
+ ["ed93ab", "e18491e185b2e186aa"],
+ ["ed93ab", "ed93a8e186aa"],
+ ["ed93ac", "e18491e185b2e186ab"],
+ ["ed93ac", "ed93a8e186ab"],
+ ["ed93ad", "e18491e185b2e186ac"],
+ ["ed93ad", "ed93a8e186ac"],
+ ["ed93ae", "e18491e185b2e186ad"],
+ ["ed93ae", "ed93a8e186ad"],
+ ["ed93af", "e18491e185b2e186ae"],
+ ["ed93af", "ed93a8e186ae"],
+ ["ed93b0", "e18491e185b2e186af"],
+ ["ed93b0", "ed93a8e186af"],
+ ["ed93b1", "e18491e185b2e186b0"],
+ ["ed93b1", "ed93a8e186b0"],
+ ["ed93b2", "e18491e185b2e186b1"],
+ ["ed93b2", "ed93a8e186b1"],
+ ["ed93b3", "e18491e185b2e186b2"],
+ ["ed93b3", "ed93a8e186b2"],
+ ["ed93b4", "e18491e185b2e186b3"],
+ ["ed93b4", "ed93a8e186b3"],
+ ["ed93b5", "e18491e185b2e186b4"],
+ ["ed93b5", "ed93a8e186b4"],
+ ["ed93b6", "e18491e185b2e186b5"],
+ ["ed93b6", "ed93a8e186b5"],
+ ["ed93b7", "e18491e185b2e186b6"],
+ ["ed93b7", "ed93a8e186b6"],
+ ["ed93b8", "e18491e185b2e186b7"],
+ ["ed93b8", "ed93a8e186b7"],
+ ["ed93b9", "e18491e185b2e186b8"],
+ ["ed93b9", "ed93a8e186b8"],
+ ["ed93ba", "e18491e185b2e186b9"],
+ ["ed93ba", "ed93a8e186b9"],
+ ["ed93bb", "e18491e185b2e186ba"],
+ ["ed93bb", "ed93a8e186ba"],
+ ["ed93bc", "e18491e185b2e186bb"],
+ ["ed93bc", "ed93a8e186bb"],
+ ["ed93bd", "e18491e185b2e186bc"],
+ ["ed93bd", "ed93a8e186bc"],
+ ["ed93be", "e18491e185b2e186bd"],
+ ["ed93be", "ed93a8e186bd"],
+ ["ed93bf", "e18491e185b2e186be"],
+ ["ed93bf", "ed93a8e186be"],
+ ["ed9480", "e18491e185b2e186bf"],
+ ["ed9480", "ed93a8e186bf"],
+ ["ed9481", "e18491e185b2e18780"],
+ ["ed9481", "ed93a8e18780"],
+ ["ed9482", "e18491e185b2e18781"],
+ ["ed9482", "ed93a8e18781"],
+ ["ed9483", "e18491e185b2e18782"],
+ ["ed9483", "ed93a8e18782"],
+ ["ed9484", "e18491e185b3"],
+ ["ed9485", "e18491e185b3e186a8"],
+ ["ed9485", "ed9484e186a8"],
+ ["ed9486", "e18491e185b3e186a9"],
+ ["ed9486", "ed9484e186a9"],
+ ["ed9487", "e18491e185b3e186aa"],
+ ["ed9487", "ed9484e186aa"],
+ ["ed9488", "e18491e185b3e186ab"],
+ ["ed9488", "ed9484e186ab"],
+ ["ed9489", "e18491e185b3e186ac"],
+ ["ed9489", "ed9484e186ac"],
+ ["ed948a", "e18491e185b3e186ad"],
+ ["ed948a", "ed9484e186ad"],
+ ["ed948b", "e18491e185b3e186ae"],
+ ["ed948b", "ed9484e186ae"],
+ ["ed948c", "e18491e185b3e186af"],
+ ["ed948c", "ed9484e186af"],
+ ["ed948d", "e18491e185b3e186b0"],
+ ["ed948d", "ed9484e186b0"],
+ ["ed948e", "e18491e185b3e186b1"],
+ ["ed948e", "ed9484e186b1"],
+ ["ed948f", "e18491e185b3e186b2"],
+ ["ed948f", "ed9484e186b2"],
+ ["ed9490", "e18491e185b3e186b3"],
+ ["ed9490", "ed9484e186b3"],
+ ["ed9491", "e18491e185b3e186b4"],
+ ["ed9491", "ed9484e186b4"],
+ ["ed9492", "e18491e185b3e186b5"],
+ ["ed9492", "ed9484e186b5"],
+ ["ed9493", "e18491e185b3e186b6"],
+ ["ed9493", "ed9484e186b6"],
+ ["ed9494", "e18491e185b3e186b7"],
+ ["ed9494", "ed9484e186b7"],
+ ["ed9495", "e18491e185b3e186b8"],
+ ["ed9495", "ed9484e186b8"],
+ ["ed9496", "e18491e185b3e186b9"],
+ ["ed9496", "ed9484e186b9"],
+ ["ed9497", "e18491e185b3e186ba"],
+ ["ed9497", "ed9484e186ba"],
+ ["ed9498", "e18491e185b3e186bb"],
+ ["ed9498", "ed9484e186bb"],
+ ["ed9499", "e18491e185b3e186bc"],
+ ["ed9499", "ed9484e186bc"],
+ ["ed949a", "e18491e185b3e186bd"],
+ ["ed949a", "ed9484e186bd"],
+ ["ed949b", "e18491e185b3e186be"],
+ ["ed949b", "ed9484e186be"],
+ ["ed949c", "e18491e185b3e186bf"],
+ ["ed949c", "ed9484e186bf"],
+ ["ed949d", "e18491e185b3e18780"],
+ ["ed949d", "ed9484e18780"],
+ ["ed949e", "e18491e185b3e18781"],
+ ["ed949e", "ed9484e18781"],
+ ["ed949f", "e18491e185b3e18782"],
+ ["ed949f", "ed9484e18782"],
+ ["ed94a0", "e18491e185b4"],
+ ["ed94a1", "e18491e185b4e186a8"],
+ ["ed94a1", "ed94a0e186a8"],
+ ["ed94a2", "e18491e185b4e186a9"],
+ ["ed94a2", "ed94a0e186a9"],
+ ["ed94a3", "e18491e185b4e186aa"],
+ ["ed94a3", "ed94a0e186aa"],
+ ["ed94a4", "e18491e185b4e186ab"],
+ ["ed94a4", "ed94a0e186ab"],
+ ["ed94a5", "e18491e185b4e186ac"],
+ ["ed94a5", "ed94a0e186ac"],
+ ["ed94a6", "e18491e185b4e186ad"],
+ ["ed94a6", "ed94a0e186ad"],
+ ["ed94a7", "e18491e185b4e186ae"],
+ ["ed94a7", "ed94a0e186ae"],
+ ["ed94a8", "e18491e185b4e186af"],
+ ["ed94a8", "ed94a0e186af"],
+ ["ed94a9", "e18491e185b4e186b0"],
+ ["ed94a9", "ed94a0e186b0"],
+ ["ed94aa", "e18491e185b4e186b1"],
+ ["ed94aa", "ed94a0e186b1"],
+ ["ed94ab", "e18491e185b4e186b2"],
+ ["ed94ab", "ed94a0e186b2"],
+ ["ed94ac", "e18491e185b4e186b3"],
+ ["ed94ac", "ed94a0e186b3"],
+ ["ed94ad", "e18491e185b4e186b4"],
+ ["ed94ad", "ed94a0e186b4"],
+ ["ed94ae", "e18491e185b4e186b5"],
+ ["ed94ae", "ed94a0e186b5"],
+ ["ed94af", "e18491e185b4e186b6"],
+ ["ed94af", "ed94a0e186b6"],
+ ["ed94b0", "e18491e185b4e186b7"],
+ ["ed94b0", "ed94a0e186b7"],
+ ["ed94b1", "e18491e185b4e186b8"],
+ ["ed94b1", "ed94a0e186b8"],
+ ["ed94b2", "e18491e185b4e186b9"],
+ ["ed94b2", "ed94a0e186b9"],
+ ["ed94b3", "e18491e185b4e186ba"],
+ ["ed94b3", "ed94a0e186ba"],
+ ["ed94b4", "e18491e185b4e186bb"],
+ ["ed94b4", "ed94a0e186bb"],
+ ["ed94b5", "e18491e185b4e186bc"],
+ ["ed94b5", "ed94a0e186bc"],
+ ["ed94b6", "e18491e185b4e186bd"],
+ ["ed94b6", "ed94a0e186bd"],
+ ["ed94b7", "e18491e185b4e186be"],
+ ["ed94b7", "ed94a0e186be"],
+ ["ed94b8", "e18491e185b4e186bf"],
+ ["ed94b8", "ed94a0e186bf"],
+ ["ed94b9", "e18491e185b4e18780"],
+ ["ed94b9", "ed94a0e18780"],
+ ["ed94ba", "e18491e185b4e18781"],
+ ["ed94ba", "ed94a0e18781"],
+ ["ed94bb", "e18491e185b4e18782"],
+ ["ed94bb", "ed94a0e18782"],
+ ["ed94bc", "e18491e185b5"],
+ ["ed94bd", "e18491e185b5e186a8"],
+ ["ed94bd", "ed94bce186a8"],
+ ["ed94be", "e18491e185b5e186a9"],
+ ["ed94be", "ed94bce186a9"],
+ ["ed94bf", "e18491e185b5e186aa"],
+ ["ed94bf", "ed94bce186aa"],
+ ["ed9580", "e18491e185b5e186ab"],
+ ["ed9580", "ed94bce186ab"],
+ ["ed9581", "e18491e185b5e186ac"],
+ ["ed9581", "ed94bce186ac"],
+ ["ed9582", "e18491e185b5e186ad"],
+ ["ed9582", "ed94bce186ad"],
+ ["ed9583", "e18491e185b5e186ae"],
+ ["ed9583", "ed94bce186ae"],
+ ["ed9584", "e18491e185b5e186af"],
+ ["ed9584", "ed94bce186af"],
+ ["ed9585", "e18491e185b5e186b0"],
+ ["ed9585", "ed94bce186b0"],
+ ["ed9586", "e18491e185b5e186b1"],
+ ["ed9586", "ed94bce186b1"],
+ ["ed9587", "e18491e185b5e186b2"],
+ ["ed9587", "ed94bce186b2"],
+ ["ed9588", "e18491e185b5e186b3"],
+ ["ed9588", "ed94bce186b3"],
+ ["ed9589", "e18491e185b5e186b4"],
+ ["ed9589", "ed94bce186b4"],
+ ["ed958a", "e18491e185b5e186b5"],
+ ["ed958a", "ed94bce186b5"],
+ ["ed958b", "e18491e185b5e186b6"],
+ ["ed958b", "ed94bce186b6"],
+ ["ed958c", "e18491e185b5e186b7"],
+ ["ed958c", "ed94bce186b7"],
+ ["ed958d", "e18491e185b5e186b8"],
+ ["ed958d", "ed94bce186b8"],
+ ["ed958e", "e18491e185b5e186b9"],
+ ["ed958e", "ed94bce186b9"],
+ ["ed958f", "e18491e185b5e186ba"],
+ ["ed958f", "ed94bce186ba"],
+ ["ed9590", "e18491e185b5e186bb"],
+ ["ed9590", "ed94bce186bb"],
+ ["ed9591", "e18491e185b5e186bc"],
+ ["ed9591", "ed94bce186bc"],
+ ["ed9592", "e18491e185b5e186bd"],
+ ["ed9592", "ed94bce186bd"],
+ ["ed9593", "e18491e185b5e186be"],
+ ["ed9593", "ed94bce186be"],
+ ["ed9594", "e18491e185b5e186bf"],
+ ["ed9594", "ed94bce186bf"],
+ ["ed9595", "e18491e185b5e18780"],
+ ["ed9595", "ed94bce18780"],
+ ["ed9596", "e18491e185b5e18781"],
+ ["ed9596", "ed94bce18781"],
+ ["ed9597", "e18491e185b5e18782"],
+ ["ed9597", "ed94bce18782"],
+ ["ed9598", "e18492e185a1"],
+ ["ed9599", "e18492e185a1e186a8"],
+ ["ed9599", "ed9598e186a8"],
+ ["ed959a", "e18492e185a1e186a9"],
+ ["ed959a", "ed9598e186a9"],
+ ["ed959b", "e18492e185a1e186aa"],
+ ["ed959b", "ed9598e186aa"],
+ ["ed959c", "e18492e185a1e186ab"],
+ ["ed959c", "ed9598e186ab"],
+ ["ed959d", "e18492e185a1e186ac"],
+ ["ed959d", "ed9598e186ac"],
+ ["ed959e", "e18492e185a1e186ad"],
+ ["ed959e", "ed9598e186ad"],
+ ["ed959f", "e18492e185a1e186ae"],
+ ["ed959f", "ed9598e186ae"],
+ ["ed95a0", "e18492e185a1e186af"],
+ ["ed95a0", "ed9598e186af"],
+ ["ed95a1", "e18492e185a1e186b0"],
+ ["ed95a1", "ed9598e186b0"],
+ ["ed95a2", "e18492e185a1e186b1"],
+ ["ed95a2", "ed9598e186b1"],
+ ["ed95a3", "e18492e185a1e186b2"],
+ ["ed95a3", "ed9598e186b2"],
+ ["ed95a4", "e18492e185a1e186b3"],
+ ["ed95a4", "ed9598e186b3"],
+ ["ed95a5", "e18492e185a1e186b4"],
+ ["ed95a5", "ed9598e186b4"],
+ ["ed95a6", "e18492e185a1e186b5"],
+ ["ed95a6", "ed9598e186b5"],
+ ["ed95a7", "e18492e185a1e186b6"],
+ ["ed95a7", "ed9598e186b6"],
+ ["ed95a8", "e18492e185a1e186b7"],
+ ["ed95a8", "ed9598e186b7"],
+ ["ed95a9", "e18492e185a1e186b8"],
+ ["ed95a9", "ed9598e186b8"],
+ ["ed95aa", "e18492e185a1e186b9"],
+ ["ed95aa", "ed9598e186b9"],
+ ["ed95ab", "e18492e185a1e186ba"],
+ ["ed95ab", "ed9598e186ba"],
+ ["ed95ac", "e18492e185a1e186bb"],
+ ["ed95ac", "ed9598e186bb"],
+ ["ed95ad", "e18492e185a1e186bc"],
+ ["ed95ad", "ed9598e186bc"],
+ ["ed95ae", "e18492e185a1e186bd"],
+ ["ed95ae", "ed9598e186bd"],
+ ["ed95af", "e18492e185a1e186be"],
+ ["ed95af", "ed9598e186be"],
+ ["ed95b0", "e18492e185a1e186bf"],
+ ["ed95b0", "ed9598e186bf"],
+ ["ed95b1", "e18492e185a1e18780"],
+ ["ed95b1", "ed9598e18780"],
+ ["ed95b2", "e18492e185a1e18781"],
+ ["ed95b2", "ed9598e18781"],
+ ["ed95b3", "e18492e185a1e18782"],
+ ["ed95b3", "ed9598e18782"],
+ ["ed95b4", "e18492e185a2"],
+ ["ed95b5", "e18492e185a2e186a8"],
+ ["ed95b5", "ed95b4e186a8"],
+ ["ed95b6", "e18492e185a2e186a9"],
+ ["ed95b6", "ed95b4e186a9"],
+ ["ed95b7", "e18492e185a2e186aa"],
+ ["ed95b7", "ed95b4e186aa"],
+ ["ed95b8", "e18492e185a2e186ab"],
+ ["ed95b8", "ed95b4e186ab"],
+ ["ed95b9", "e18492e185a2e186ac"],
+ ["ed95b9", "ed95b4e186ac"],
+ ["ed95ba", "e18492e185a2e186ad"],
+ ["ed95ba", "ed95b4e186ad"],
+ ["ed95bb", "e18492e185a2e186ae"],
+ ["ed95bb", "ed95b4e186ae"],
+ ["ed95bc", "e18492e185a2e186af"],
+ ["ed95bc", "ed95b4e186af"],
+ ["ed95bd", "e18492e185a2e186b0"],
+ ["ed95bd", "ed95b4e186b0"],
+ ["ed95be", "e18492e185a2e186b1"],
+ ["ed95be", "ed95b4e186b1"],
+ ["ed95bf", "e18492e185a2e186b2"],
+ ["ed95bf", "ed95b4e186b2"],
+ ["ed9680", "e18492e185a2e186b3"],
+ ["ed9680", "ed95b4e186b3"],
+ ["ed9681", "e18492e185a2e186b4"],
+ ["ed9681", "ed95b4e186b4"],
+ ["ed9682", "e18492e185a2e186b5"],
+ ["ed9682", "ed95b4e186b5"],
+ ["ed9683", "e18492e185a2e186b6"],
+ ["ed9683", "ed95b4e186b6"],
+ ["ed9684", "e18492e185a2e186b7"],
+ ["ed9684", "ed95b4e186b7"],
+ ["ed9685", "e18492e185a2e186b8"],
+ ["ed9685", "ed95b4e186b8"],
+ ["ed9686", "e18492e185a2e186b9"],
+ ["ed9686", "ed95b4e186b9"],
+ ["ed9687", "e18492e185a2e186ba"],
+ ["ed9687", "ed95b4e186ba"],
+ ["ed9688", "e18492e185a2e186bb"],
+ ["ed9688", "ed95b4e186bb"],
+ ["ed9689", "e18492e185a2e186bc"],
+ ["ed9689", "ed95b4e186bc"],
+ ["ed968a", "e18492e185a2e186bd"],
+ ["ed968a", "ed95b4e186bd"],
+ ["ed968b", "e18492e185a2e186be"],
+ ["ed968b", "ed95b4e186be"],
+ ["ed968c", "e18492e185a2e186bf"],
+ ["ed968c", "ed95b4e186bf"],
+ ["ed968d", "e18492e185a2e18780"],
+ ["ed968d", "ed95b4e18780"],
+ ["ed968e", "e18492e185a2e18781"],
+ ["ed968e", "ed95b4e18781"],
+ ["ed968f", "e18492e185a2e18782"],
+ ["ed968f", "ed95b4e18782"],
+ ["ed9690", "e18492e185a3"],
+ ["ed9691", "e18492e185a3e186a8"],
+ ["ed9691", "ed9690e186a8"],
+ ["ed9692", "e18492e185a3e186a9"],
+ ["ed9692", "ed9690e186a9"],
+ ["ed9693", "e18492e185a3e186aa"],
+ ["ed9693", "ed9690e186aa"],
+ ["ed9694", "e18492e185a3e186ab"],
+ ["ed9694", "ed9690e186ab"],
+ ["ed9695", "e18492e185a3e186ac"],
+ ["ed9695", "ed9690e186ac"],
+ ["ed9696", "e18492e185a3e186ad"],
+ ["ed9696", "ed9690e186ad"],
+ ["ed9697", "e18492e185a3e186ae"],
+ ["ed9697", "ed9690e186ae"],
+ ["ed9698", "e18492e185a3e186af"],
+ ["ed9698", "ed9690e186af"],
+ ["ed9699", "e18492e185a3e186b0"],
+ ["ed9699", "ed9690e186b0"],
+ ["ed969a", "e18492e185a3e186b1"],
+ ["ed969a", "ed9690e186b1"],
+ ["ed969b", "e18492e185a3e186b2"],
+ ["ed969b", "ed9690e186b2"],
+ ["ed969c", "e18492e185a3e186b3"],
+ ["ed969c", "ed9690e186b3"],
+ ["ed969d", "e18492e185a3e186b4"],
+ ["ed969d", "ed9690e186b4"],
+ ["ed969e", "e18492e185a3e186b5"],
+ ["ed969e", "ed9690e186b5"],
+ ["ed969f", "e18492e185a3e186b6"],
+ ["ed969f", "ed9690e186b6"],
+ ["ed96a0", "e18492e185a3e186b7"],
+ ["ed96a0", "ed9690e186b7"],
+ ["ed96a1", "e18492e185a3e186b8"],
+ ["ed96a1", "ed9690e186b8"],
+ ["ed96a2", "e18492e185a3e186b9"],
+ ["ed96a2", "ed9690e186b9"],
+ ["ed96a3", "e18492e185a3e186ba"],
+ ["ed96a3", "ed9690e186ba"],
+ ["ed96a4", "e18492e185a3e186bb"],
+ ["ed96a4", "ed9690e186bb"],
+ ["ed96a5", "e18492e185a3e186bc"],
+ ["ed96a5", "ed9690e186bc"],
+ ["ed96a6", "e18492e185a3e186bd"],
+ ["ed96a6", "ed9690e186bd"],
+ ["ed96a7", "e18492e185a3e186be"],
+ ["ed96a7", "ed9690e186be"],
+ ["ed96a8", "e18492e185a3e186bf"],
+ ["ed96a8", "ed9690e186bf"],
+ ["ed96a9", "e18492e185a3e18780"],
+ ["ed96a9", "ed9690e18780"],
+ ["ed96aa", "e18492e185a3e18781"],
+ ["ed96aa", "ed9690e18781"],
+ ["ed96ab", "e18492e185a3e18782"],
+ ["ed96ab", "ed9690e18782"],
+ ["ed96ac", "e18492e185a4"],
+ ["ed96ad", "e18492e185a4e186a8"],
+ ["ed96ad", "ed96ace186a8"],
+ ["ed96ae", "e18492e185a4e186a9"],
+ ["ed96ae", "ed96ace186a9"],
+ ["ed96af", "e18492e185a4e186aa"],
+ ["ed96af", "ed96ace186aa"],
+ ["ed96b0", "e18492e185a4e186ab"],
+ ["ed96b0", "ed96ace186ab"],
+ ["ed96b1", "e18492e185a4e186ac"],
+ ["ed96b1", "ed96ace186ac"],
+ ["ed96b2", "e18492e185a4e186ad"],
+ ["ed96b2", "ed96ace186ad"],
+ ["ed96b3", "e18492e185a4e186ae"],
+ ["ed96b3", "ed96ace186ae"],
+ ["ed96b4", "e18492e185a4e186af"],
+ ["ed96b4", "ed96ace186af"],
+ ["ed96b5", "e18492e185a4e186b0"],
+ ["ed96b5", "ed96ace186b0"],
+ ["ed96b6", "e18492e185a4e186b1"],
+ ["ed96b6", "ed96ace186b1"],
+ ["ed96b7", "e18492e185a4e186b2"],
+ ["ed96b7", "ed96ace186b2"],
+ ["ed96b8", "e18492e185a4e186b3"],
+ ["ed96b8", "ed96ace186b3"],
+ ["ed96b9", "e18492e185a4e186b4"],
+ ["ed96b9", "ed96ace186b4"],
+ ["ed96ba", "e18492e185a4e186b5"],
+ ["ed96ba", "ed96ace186b5"],
+ ["ed96bb", "e18492e185a4e186b6"],
+ ["ed96bb", "ed96ace186b6"],
+ ["ed96bc", "e18492e185a4e186b7"],
+ ["ed96bc", "ed96ace186b7"],
+ ["ed96bd", "e18492e185a4e186b8"],
+ ["ed96bd", "ed96ace186b8"],
+ ["ed96be", "e18492e185a4e186b9"],
+ ["ed96be", "ed96ace186b9"],
+ ["ed96bf", "e18492e185a4e186ba"],
+ ["ed96bf", "ed96ace186ba"],
+ ["ed9780", "e18492e185a4e186bb"],
+ ["ed9780", "ed96ace186bb"],
+ ["ed9781", "e18492e185a4e186bc"],
+ ["ed9781", "ed96ace186bc"],
+ ["ed9782", "e18492e185a4e186bd"],
+ ["ed9782", "ed96ace186bd"],
+ ["ed9783", "e18492e185a4e186be"],
+ ["ed9783", "ed96ace186be"],
+ ["ed9784", "e18492e185a4e186bf"],
+ ["ed9784", "ed96ace186bf"],
+ ["ed9785", "e18492e185a4e18780"],
+ ["ed9785", "ed96ace18780"],
+ ["ed9786", "e18492e185a4e18781"],
+ ["ed9786", "ed96ace18781"],
+ ["ed9787", "e18492e185a4e18782"],
+ ["ed9787", "ed96ace18782"],
+ ["ed9788", "e18492e185a5"],
+ ["ed9789", "e18492e185a5e186a8"],
+ ["ed9789", "ed9788e186a8"],
+ ["ed978a", "e18492e185a5e186a9"],
+ ["ed978a", "ed9788e186a9"],
+ ["ed978b", "e18492e185a5e186aa"],
+ ["ed978b", "ed9788e186aa"],
+ ["ed978c", "e18492e185a5e186ab"],
+ ["ed978c", "ed9788e186ab"],
+ ["ed978d", "e18492e185a5e186ac"],
+ ["ed978d", "ed9788e186ac"],
+ ["ed978e", "e18492e185a5e186ad"],
+ ["ed978e", "ed9788e186ad"],
+ ["ed978f", "e18492e185a5e186ae"],
+ ["ed978f", "ed9788e186ae"],
+ ["ed9790", "e18492e185a5e186af"],
+ ["ed9790", "ed9788e186af"],
+ ["ed9791", "e18492e185a5e186b0"],
+ ["ed9791", "ed9788e186b0"],
+ ["ed9792", "e18492e185a5e186b1"],
+ ["ed9792", "ed9788e186b1"],
+ ["ed9793", "e18492e185a5e186b2"],
+ ["ed9793", "ed9788e186b2"],
+ ["ed9794", "e18492e185a5e186b3"],
+ ["ed9794", "ed9788e186b3"],
+ ["ed9795", "e18492e185a5e186b4"],
+ ["ed9795", "ed9788e186b4"],
+ ["ed9796", "e18492e185a5e186b5"],
+ ["ed9796", "ed9788e186b5"],
+ ["ed9797", "e18492e185a5e186b6"],
+ ["ed9797", "ed9788e186b6"],
+ ["ed9798", "e18492e185a5e186b7"],
+ ["ed9798", "ed9788e186b7"],
+ ["ed9799", "e18492e185a5e186b8"],
+ ["ed9799", "ed9788e186b8"],
+ ["ed979a", "e18492e185a5e186b9"],
+ ["ed979a", "ed9788e186b9"],
+ ["ed979b", "e18492e185a5e186ba"],
+ ["ed979b", "ed9788e186ba"],
+ ["ed979c", "e18492e185a5e186bb"],
+ ["ed979c", "ed9788e186bb"],
+ ["ed979d", "e18492e185a5e186bc"],
+ ["ed979d", "ed9788e186bc"],
+ ["ed979e", "e18492e185a5e186bd"],
+ ["ed979e", "ed9788e186bd"],
+ ["ed979f", "e18492e185a5e186be"],
+ ["ed979f", "ed9788e186be"],
+ ["ed97a0", "e18492e185a5e186bf"],
+ ["ed97a0", "ed9788e186bf"],
+ ["ed97a1", "e18492e185a5e18780"],
+ ["ed97a1", "ed9788e18780"],
+ ["ed97a2", "e18492e185a5e18781"],
+ ["ed97a2", "ed9788e18781"],
+ ["ed97a3", "e18492e185a5e18782"],
+ ["ed97a3", "ed9788e18782"],
+ ["ed97a4", "e18492e185a6"],
+ ["ed97a5", "e18492e185a6e186a8"],
+ ["ed97a5", "ed97a4e186a8"],
+ ["ed97a6", "e18492e185a6e186a9"],
+ ["ed97a6", "ed97a4e186a9"],
+ ["ed97a7", "e18492e185a6e186aa"],
+ ["ed97a7", "ed97a4e186aa"],
+ ["ed97a8", "e18492e185a6e186ab"],
+ ["ed97a8", "ed97a4e186ab"],
+ ["ed97a9", "e18492e185a6e186ac"],
+ ["ed97a9", "ed97a4e186ac"],
+ ["ed97aa", "e18492e185a6e186ad"],
+ ["ed97aa", "ed97a4e186ad"],
+ ["ed97ab", "e18492e185a6e186ae"],
+ ["ed97ab", "ed97a4e186ae"],
+ ["ed97ac", "e18492e185a6e186af"],
+ ["ed97ac", "ed97a4e186af"],
+ ["ed97ad", "e18492e185a6e186b0"],
+ ["ed97ad", "ed97a4e186b0"],
+ ["ed97ae", "e18492e185a6e186b1"],
+ ["ed97ae", "ed97a4e186b1"],
+ ["ed97af", "e18492e185a6e186b2"],
+ ["ed97af", "ed97a4e186b2"],
+ ["ed97b0", "e18492e185a6e186b3"],
+ ["ed97b0", "ed97a4e186b3"],
+ ["ed97b1", "e18492e185a6e186b4"],
+ ["ed97b1", "ed97a4e186b4"],
+ ["ed97b2", "e18492e185a6e186b5"],
+ ["ed97b2", "ed97a4e186b5"],
+ ["ed97b3", "e18492e185a6e186b6"],
+ ["ed97b3", "ed97a4e186b6"],
+ ["ed97b4", "e18492e185a6e186b7"],
+ ["ed97b4", "ed97a4e186b7"],
+ ["ed97b5", "e18492e185a6e186b8"],
+ ["ed97b5", "ed97a4e186b8"],
+ ["ed97b6", "e18492e185a6e186b9"],
+ ["ed97b6", "ed97a4e186b9"],
+ ["ed97b7", "e18492e185a6e186ba"],
+ ["ed97b7", "ed97a4e186ba"],
+ ["ed97b8", "e18492e185a6e186bb"],
+ ["ed97b8", "ed97a4e186bb"],
+ ["ed97b9", "e18492e185a6e186bc"],
+ ["ed97b9", "ed97a4e186bc"],
+ ["ed97ba", "e18492e185a6e186bd"],
+ ["ed97ba", "ed97a4e186bd"],
+ ["ed97bb", "e18492e185a6e186be"],
+ ["ed97bb", "ed97a4e186be"],
+ ["ed97bc", "e18492e185a6e186bf"],
+ ["ed97bc", "ed97a4e186bf"],
+ ["ed97bd", "e18492e185a6e18780"],
+ ["ed97bd", "ed97a4e18780"],
+ ["ed97be", "e18492e185a6e18781"],
+ ["ed97be", "ed97a4e18781"],
+ ["ed97bf", "e18492e185a6e18782"],
+ ["ed97bf", "ed97a4e18782"],
+ ["ed9880", "e18492e185a7"],
+ ["ed9881", "e18492e185a7e186a8"],
+ ["ed9881", "ed9880e186a8"],
+ ["ed9882", "e18492e185a7e186a9"],
+ ["ed9882", "ed9880e186a9"],
+ ["ed9883", "e18492e185a7e186aa"],
+ ["ed9883", "ed9880e186aa"],
+ ["ed9884", "e18492e185a7e186ab"],
+ ["ed9884", "ed9880e186ab"],
+ ["ed9885", "e18492e185a7e186ac"],
+ ["ed9885", "ed9880e186ac"],
+ ["ed9886", "e18492e185a7e186ad"],
+ ["ed9886", "ed9880e186ad"],
+ ["ed9887", "e18492e185a7e186ae"],
+ ["ed9887", "ed9880e186ae"],
+ ["ed9888", "e18492e185a7e186af"],
+ ["ed9888", "ed9880e186af"],
+ ["ed9889", "e18492e185a7e186b0"],
+ ["ed9889", "ed9880e186b0"],
+ ["ed988a", "e18492e185a7e186b1"],
+ ["ed988a", "ed9880e186b1"],
+ ["ed988b", "e18492e185a7e186b2"],
+ ["ed988b", "ed9880e186b2"],
+ ["ed988c", "e18492e185a7e186b3"],
+ ["ed988c", "ed9880e186b3"],
+ ["ed988d", "e18492e185a7e186b4"],
+ ["ed988d", "ed9880e186b4"],
+ ["ed988e", "e18492e185a7e186b5"],
+ ["ed988e", "ed9880e186b5"],
+ ["ed988f", "e18492e185a7e186b6"],
+ ["ed988f", "ed9880e186b6"],
+ ["ed9890", "e18492e185a7e186b7"],
+ ["ed9890", "ed9880e186b7"],
+ ["ed9891", "e18492e185a7e186b8"],
+ ["ed9891", "ed9880e186b8"],
+ ["ed9892", "e18492e185a7e186b9"],
+ ["ed9892", "ed9880e186b9"],
+ ["ed9893", "e18492e185a7e186ba"],
+ ["ed9893", "ed9880e186ba"],
+ ["ed9894", "e18492e185a7e186bb"],
+ ["ed9894", "ed9880e186bb"],
+ ["ed9895", "e18492e185a7e186bc"],
+ ["ed9895", "ed9880e186bc"],
+ ["ed9896", "e18492e185a7e186bd"],
+ ["ed9896", "ed9880e186bd"],
+ ["ed9897", "e18492e185a7e186be"],
+ ["ed9897", "ed9880e186be"],
+ ["ed9898", "e18492e185a7e186bf"],
+ ["ed9898", "ed9880e186bf"],
+ ["ed9899", "e18492e185a7e18780"],
+ ["ed9899", "ed9880e18780"],
+ ["ed989a", "e18492e185a7e18781"],
+ ["ed989a", "ed9880e18781"],
+ ["ed989b", "e18492e185a7e18782"],
+ ["ed989b", "ed9880e18782"],
+ ["ed989c", "e18492e185a8"],
+ ["ed989d", "e18492e185a8e186a8"],
+ ["ed989d", "ed989ce186a8"],
+ ["ed989e", "e18492e185a8e186a9"],
+ ["ed989e", "ed989ce186a9"],
+ ["ed989f", "e18492e185a8e186aa"],
+ ["ed989f", "ed989ce186aa"],
+ ["ed98a0", "e18492e185a8e186ab"],
+ ["ed98a0", "ed989ce186ab"],
+ ["ed98a1", "e18492e185a8e186ac"],
+ ["ed98a1", "ed989ce186ac"],
+ ["ed98a2", "e18492e185a8e186ad"],
+ ["ed98a2", "ed989ce186ad"],
+ ["ed98a3", "e18492e185a8e186ae"],
+ ["ed98a3", "ed989ce186ae"],
+ ["ed98a4", "e18492e185a8e186af"],
+ ["ed98a4", "ed989ce186af"],
+ ["ed98a5", "e18492e185a8e186b0"],
+ ["ed98a5", "ed989ce186b0"],
+ ["ed98a6", "e18492e185a8e186b1"],
+ ["ed98a6", "ed989ce186b1"],
+ ["ed98a7", "e18492e185a8e186b2"],
+ ["ed98a7", "ed989ce186b2"],
+ ["ed98a8", "e18492e185a8e186b3"],
+ ["ed98a8", "ed989ce186b3"],
+ ["ed98a9", "e18492e185a8e186b4"],
+ ["ed98a9", "ed989ce186b4"],
+ ["ed98aa", "e18492e185a8e186b5"],
+ ["ed98aa", "ed989ce186b5"],
+ ["ed98ab", "e18492e185a8e186b6"],
+ ["ed98ab", "ed989ce186b6"],
+ ["ed98ac", "e18492e185a8e186b7"],
+ ["ed98ac", "ed989ce186b7"],
+ ["ed98ad", "e18492e185a8e186b8"],
+ ["ed98ad", "ed989ce186b8"],
+ ["ed98ae", "e18492e185a8e186b9"],
+ ["ed98ae", "ed989ce186b9"],
+ ["ed98af", "e18492e185a8e186ba"],
+ ["ed98af", "ed989ce186ba"],
+ ["ed98b0", "e18492e185a8e186bb"],
+ ["ed98b0", "ed989ce186bb"],
+ ["ed98b1", "e18492e185a8e186bc"],
+ ["ed98b1", "ed989ce186bc"],
+ ["ed98b2", "e18492e185a8e186bd"],
+ ["ed98b2", "ed989ce186bd"],
+ ["ed98b3", "e18492e185a8e186be"],
+ ["ed98b3", "ed989ce186be"],
+ ["ed98b4", "e18492e185a8e186bf"],
+ ["ed98b4", "ed989ce186bf"],
+ ["ed98b5", "e18492e185a8e18780"],
+ ["ed98b5", "ed989ce18780"],
+ ["ed98b6", "e18492e185a8e18781"],
+ ["ed98b6", "ed989ce18781"],
+ ["ed98b7", "e18492e185a8e18782"],
+ ["ed98b7", "ed989ce18782"],
+ ["ed98b8", "e18492e185a9"],
+ ["ed98b9", "e18492e185a9e186a8"],
+ ["ed98b9", "ed98b8e186a8"],
+ ["ed98ba", "e18492e185a9e186a9"],
+ ["ed98ba", "ed98b8e186a9"],
+ ["ed98bb", "e18492e185a9e186aa"],
+ ["ed98bb", "ed98b8e186aa"],
+ ["ed98bc", "e18492e185a9e186ab"],
+ ["ed98bc", "ed98b8e186ab"],
+ ["ed98bd", "e18492e185a9e186ac"],
+ ["ed98bd", "ed98b8e186ac"],
+ ["ed98be", "e18492e185a9e186ad"],
+ ["ed98be", "ed98b8e186ad"],
+ ["ed98bf", "e18492e185a9e186ae"],
+ ["ed98bf", "ed98b8e186ae"],
+ ["ed9980", "e18492e185a9e186af"],
+ ["ed9980", "ed98b8e186af"],
+ ["ed9981", "e18492e185a9e186b0"],
+ ["ed9981", "ed98b8e186b0"],
+ ["ed9982", "e18492e185a9e186b1"],
+ ["ed9982", "ed98b8e186b1"],
+ ["ed9983", "e18492e185a9e186b2"],
+ ["ed9983", "ed98b8e186b2"],
+ ["ed9984", "e18492e185a9e186b3"],
+ ["ed9984", "ed98b8e186b3"],
+ ["ed9985", "e18492e185a9e186b4"],
+ ["ed9985", "ed98b8e186b4"],
+ ["ed9986", "e18492e185a9e186b5"],
+ ["ed9986", "ed98b8e186b5"],
+ ["ed9987", "e18492e185a9e186b6"],
+ ["ed9987", "ed98b8e186b6"],
+ ["ed9988", "e18492e185a9e186b7"],
+ ["ed9988", "ed98b8e186b7"],
+ ["ed9989", "e18492e185a9e186b8"],
+ ["ed9989", "ed98b8e186b8"],
+ ["ed998a", "e18492e185a9e186b9"],
+ ["ed998a", "ed98b8e186b9"],
+ ["ed998b", "e18492e185a9e186ba"],
+ ["ed998b", "ed98b8e186ba"],
+ ["ed998c", "e18492e185a9e186bb"],
+ ["ed998c", "ed98b8e186bb"],
+ ["ed998d", "e18492e185a9e186bc"],
+ ["ed998d", "ed98b8e186bc"],
+ ["ed998e", "e18492e185a9e186bd"],
+ ["ed998e", "ed98b8e186bd"],
+ ["ed998f", "e18492e185a9e186be"],
+ ["ed998f", "ed98b8e186be"],
+ ["ed9990", "e18492e185a9e186bf"],
+ ["ed9990", "ed98b8e186bf"],
+ ["ed9991", "e18492e185a9e18780"],
+ ["ed9991", "ed98b8e18780"],
+ ["ed9992", "e18492e185a9e18781"],
+ ["ed9992", "ed98b8e18781"],
+ ["ed9993", "e18492e185a9e18782"],
+ ["ed9993", "ed98b8e18782"],
+ ["ed9994", "e18492e185aa"],
+ ["ed9995", "e18492e185aae186a8"],
+ ["ed9995", "ed9994e186a8"],
+ ["ed9996", "e18492e185aae186a9"],
+ ["ed9996", "ed9994e186a9"],
+ ["ed9997", "e18492e185aae186aa"],
+ ["ed9997", "ed9994e186aa"],
+ ["ed9998", "e18492e185aae186ab"],
+ ["ed9998", "ed9994e186ab"],
+ ["ed9999", "e18492e185aae186ac"],
+ ["ed9999", "ed9994e186ac"],
+ ["ed999a", "e18492e185aae186ad"],
+ ["ed999a", "ed9994e186ad"],
+ ["ed999b", "e18492e185aae186ae"],
+ ["ed999b", "ed9994e186ae"],
+ ["ed999c", "e18492e185aae186af"],
+ ["ed999c", "ed9994e186af"],
+ ["ed999d", "e18492e185aae186b0"],
+ ["ed999d", "ed9994e186b0"],
+ ["ed999e", "e18492e185aae186b1"],
+ ["ed999e", "ed9994e186b1"],
+ ["ed999f", "e18492e185aae186b2"],
+ ["ed999f", "ed9994e186b2"],
+ ["ed99a0", "e18492e185aae186b3"],
+ ["ed99a0", "ed9994e186b3"],
+ ["ed99a1", "e18492e185aae186b4"],
+ ["ed99a1", "ed9994e186b4"],
+ ["ed99a2", "e18492e185aae186b5"],
+ ["ed99a2", "ed9994e186b5"],
+ ["ed99a3", "e18492e185aae186b6"],
+ ["ed99a3", "ed9994e186b6"],
+ ["ed99a4", "e18492e185aae186b7"],
+ ["ed99a4", "ed9994e186b7"],
+ ["ed99a5", "e18492e185aae186b8"],
+ ["ed99a5", "ed9994e186b8"],
+ ["ed99a6", "e18492e185aae186b9"],
+ ["ed99a6", "ed9994e186b9"],
+ ["ed99a7", "e18492e185aae186ba"],
+ ["ed99a7", "ed9994e186ba"],
+ ["ed99a8", "e18492e185aae186bb"],
+ ["ed99a8", "ed9994e186bb"],
+ ["ed99a9", "e18492e185aae186bc"],
+ ["ed99a9", "ed9994e186bc"],
+ ["ed99aa", "e18492e185aae186bd"],
+ ["ed99aa", "ed9994e186bd"],
+ ["ed99ab", "e18492e185aae186be"],
+ ["ed99ab", "ed9994e186be"],
+ ["ed99ac", "e18492e185aae186bf"],
+ ["ed99ac", "ed9994e186bf"],
+ ["ed99ad", "e18492e185aae18780"],
+ ["ed99ad", "ed9994e18780"],
+ ["ed99ae", "e18492e185aae18781"],
+ ["ed99ae", "ed9994e18781"],
+ ["ed99af", "e18492e185aae18782"],
+ ["ed99af", "ed9994e18782"],
+ ["ed99b0", "e18492e185ab"],
+ ["ed99b1", "e18492e185abe186a8"],
+ ["ed99b1", "ed99b0e186a8"],
+ ["ed99b2", "e18492e185abe186a9"],
+ ["ed99b2", "ed99b0e186a9"],
+ ["ed99b3", "e18492e185abe186aa"],
+ ["ed99b3", "ed99b0e186aa"],
+ ["ed99b4", "e18492e185abe186ab"],
+ ["ed99b4", "ed99b0e186ab"],
+ ["ed99b5", "e18492e185abe186ac"],
+ ["ed99b5", "ed99b0e186ac"],
+ ["ed99b6", "e18492e185abe186ad"],
+ ["ed99b6", "ed99b0e186ad"],
+ ["ed99b7", "e18492e185abe186ae"],
+ ["ed99b7", "ed99b0e186ae"],
+ ["ed99b8", "e18492e185abe186af"],
+ ["ed99b8", "ed99b0e186af"],
+ ["ed99b9", "e18492e185abe186b0"],
+ ["ed99b9", "ed99b0e186b0"],
+ ["ed99ba", "e18492e185abe186b1"],
+ ["ed99ba", "ed99b0e186b1"],
+ ["ed99bb", "e18492e185abe186b2"],
+ ["ed99bb", "ed99b0e186b2"],
+ ["ed99bc", "e18492e185abe186b3"],
+ ["ed99bc", "ed99b0e186b3"],
+ ["ed99bd", "e18492e185abe186b4"],
+ ["ed99bd", "ed99b0e186b4"],
+ ["ed99be", "e18492e185abe186b5"],
+ ["ed99be", "ed99b0e186b5"],
+ ["ed99bf", "e18492e185abe186b6"],
+ ["ed99bf", "ed99b0e186b6"],
+ ["ed9a80", "e18492e185abe186b7"],
+ ["ed9a80", "ed99b0e186b7"],
+ ["ed9a81", "e18492e185abe186b8"],
+ ["ed9a81", "ed99b0e186b8"],
+ ["ed9a82", "e18492e185abe186b9"],
+ ["ed9a82", "ed99b0e186b9"],
+ ["ed9a83", "e18492e185abe186ba"],
+ ["ed9a83", "ed99b0e186ba"],
+ ["ed9a84", "e18492e185abe186bb"],
+ ["ed9a84", "ed99b0e186bb"],
+ ["ed9a85", "e18492e185abe186bc"],
+ ["ed9a85", "ed99b0e186bc"],
+ ["ed9a86", "e18492e185abe186bd"],
+ ["ed9a86", "ed99b0e186bd"],
+ ["ed9a87", "e18492e185abe186be"],
+ ["ed9a87", "ed99b0e186be"],
+ ["ed9a88", "e18492e185abe186bf"],
+ ["ed9a88", "ed99b0e186bf"],
+ ["ed9a89", "e18492e185abe18780"],
+ ["ed9a89", "ed99b0e18780"],
+ ["ed9a8a", "e18492e185abe18781"],
+ ["ed9a8a", "ed99b0e18781"],
+ ["ed9a8b", "e18492e185abe18782"],
+ ["ed9a8b", "ed99b0e18782"],
+ ["ed9a8c", "e18492e185ac"],
+ ["ed9a8d", "e18492e185ace186a8"],
+ ["ed9a8d", "ed9a8ce186a8"],
+ ["ed9a8e", "e18492e185ace186a9"],
+ ["ed9a8e", "ed9a8ce186a9"],
+ ["ed9a8f", "e18492e185ace186aa"],
+ ["ed9a8f", "ed9a8ce186aa"],
+ ["ed9a90", "e18492e185ace186ab"],
+ ["ed9a90", "ed9a8ce186ab"],
+ ["ed9a91", "e18492e185ace186ac"],
+ ["ed9a91", "ed9a8ce186ac"],
+ ["ed9a92", "e18492e185ace186ad"],
+ ["ed9a92", "ed9a8ce186ad"],
+ ["ed9a93", "e18492e185ace186ae"],
+ ["ed9a93", "ed9a8ce186ae"],
+ ["ed9a94", "e18492e185ace186af"],
+ ["ed9a94", "ed9a8ce186af"],
+ ["ed9a95", "e18492e185ace186b0"],
+ ["ed9a95", "ed9a8ce186b0"],
+ ["ed9a96", "e18492e185ace186b1"],
+ ["ed9a96", "ed9a8ce186b1"],
+ ["ed9a97", "e18492e185ace186b2"],
+ ["ed9a97", "ed9a8ce186b2"],
+ ["ed9a98", "e18492e185ace186b3"],
+ ["ed9a98", "ed9a8ce186b3"],
+ ["ed9a99", "e18492e185ace186b4"],
+ ["ed9a99", "ed9a8ce186b4"],
+ ["ed9a9a", "e18492e185ace186b5"],
+ ["ed9a9a", "ed9a8ce186b5"],
+ ["ed9a9b", "e18492e185ace186b6"],
+ ["ed9a9b", "ed9a8ce186b6"],
+ ["ed9a9c", "e18492e185ace186b7"],
+ ["ed9a9c", "ed9a8ce186b7"],
+ ["ed9a9d", "e18492e185ace186b8"],
+ ["ed9a9d", "ed9a8ce186b8"],
+ ["ed9a9e", "e18492e185ace186b9"],
+ ["ed9a9e", "ed9a8ce186b9"],
+ ["ed9a9f", "e18492e185ace186ba"],
+ ["ed9a9f", "ed9a8ce186ba"],
+ ["ed9aa0", "e18492e185ace186bb"],
+ ["ed9aa0", "ed9a8ce186bb"],
+ ["ed9aa1", "e18492e185ace186bc"],
+ ["ed9aa1", "ed9a8ce186bc"],
+ ["ed9aa2", "e18492e185ace186bd"],
+ ["ed9aa2", "ed9a8ce186bd"],
+ ["ed9aa3", "e18492e185ace186be"],
+ ["ed9aa3", "ed9a8ce186be"],
+ ["ed9aa4", "e18492e185ace186bf"],
+ ["ed9aa4", "ed9a8ce186bf"],
+ ["ed9aa5", "e18492e185ace18780"],
+ ["ed9aa5", "ed9a8ce18780"],
+ ["ed9aa6", "e18492e185ace18781"],
+ ["ed9aa6", "ed9a8ce18781"],
+ ["ed9aa7", "e18492e185ace18782"],
+ ["ed9aa7", "ed9a8ce18782"],
+ ["ed9aa8", "e18492e185ad"],
+ ["ed9aa9", "e18492e185ade186a8"],
+ ["ed9aa9", "ed9aa8e186a8"],
+ ["ed9aaa", "e18492e185ade186a9"],
+ ["ed9aaa", "ed9aa8e186a9"],
+ ["ed9aab", "e18492e185ade186aa"],
+ ["ed9aab", "ed9aa8e186aa"],
+ ["ed9aac", "e18492e185ade186ab"],
+ ["ed9aac", "ed9aa8e186ab"],
+ ["ed9aad", "e18492e185ade186ac"],
+ ["ed9aad", "ed9aa8e186ac"],
+ ["ed9aae", "e18492e185ade186ad"],
+ ["ed9aae", "ed9aa8e186ad"],
+ ["ed9aaf", "e18492e185ade186ae"],
+ ["ed9aaf", "ed9aa8e186ae"],
+ ["ed9ab0", "e18492e185ade186af"],
+ ["ed9ab0", "ed9aa8e186af"],
+ ["ed9ab1", "e18492e185ade186b0"],
+ ["ed9ab1", "ed9aa8e186b0"],
+ ["ed9ab2", "e18492e185ade186b1"],
+ ["ed9ab2", "ed9aa8e186b1"],
+ ["ed9ab3", "e18492e185ade186b2"],
+ ["ed9ab3", "ed9aa8e186b2"],
+ ["ed9ab4", "e18492e185ade186b3"],
+ ["ed9ab4", "ed9aa8e186b3"],
+ ["ed9ab5", "e18492e185ade186b4"],
+ ["ed9ab5", "ed9aa8e186b4"],
+ ["ed9ab6", "e18492e185ade186b5"],
+ ["ed9ab6", "ed9aa8e186b5"],
+ ["ed9ab7", "e18492e185ade186b6"],
+ ["ed9ab7", "ed9aa8e186b6"],
+ ["ed9ab8", "e18492e185ade186b7"],
+ ["ed9ab8", "ed9aa8e186b7"],
+ ["ed9ab9", "e18492e185ade186b8"],
+ ["ed9ab9", "ed9aa8e186b8"],
+ ["ed9aba", "e18492e185ade186b9"],
+ ["ed9aba", "ed9aa8e186b9"],
+ ["ed9abb", "e18492e185ade186ba"],
+ ["ed9abb", "ed9aa8e186ba"],
+ ["ed9abc", "e18492e185ade186bb"],
+ ["ed9abc", "ed9aa8e186bb"],
+ ["ed9abd", "e18492e185ade186bc"],
+ ["ed9abd", "ed9aa8e186bc"],
+ ["ed9abe", "e18492e185ade186bd"],
+ ["ed9abe", "ed9aa8e186bd"],
+ ["ed9abf", "e18492e185ade186be"],
+ ["ed9abf", "ed9aa8e186be"],
+ ["ed9b80", "e18492e185ade186bf"],
+ ["ed9b80", "ed9aa8e186bf"],
+ ["ed9b81", "e18492e185ade18780"],
+ ["ed9b81", "ed9aa8e18780"],
+ ["ed9b82", "e18492e185ade18781"],
+ ["ed9b82", "ed9aa8e18781"],
+ ["ed9b83", "e18492e185ade18782"],
+ ["ed9b83", "ed9aa8e18782"],
+ ["ed9b84", "e18492e185ae"],
+ ["ed9b85", "e18492e185aee186a8"],
+ ["ed9b85", "ed9b84e186a8"],
+ ["ed9b86", "e18492e185aee186a9"],
+ ["ed9b86", "ed9b84e186a9"],
+ ["ed9b87", "e18492e185aee186aa"],
+ ["ed9b87", "ed9b84e186aa"],
+ ["ed9b88", "e18492e185aee186ab"],
+ ["ed9b88", "ed9b84e186ab"],
+ ["ed9b89", "e18492e185aee186ac"],
+ ["ed9b89", "ed9b84e186ac"],
+ ["ed9b8a", "e18492e185aee186ad"],
+ ["ed9b8a", "ed9b84e186ad"],
+ ["ed9b8b", "e18492e185aee186ae"],
+ ["ed9b8b", "ed9b84e186ae"],
+ ["ed9b8c", "e18492e185aee186af"],
+ ["ed9b8c", "ed9b84e186af"],
+ ["ed9b8d", "e18492e185aee186b0"],
+ ["ed9b8d", "ed9b84e186b0"],
+ ["ed9b8e", "e18492e185aee186b1"],
+ ["ed9b8e", "ed9b84e186b1"],
+ ["ed9b8f", "e18492e185aee186b2"],
+ ["ed9b8f", "ed9b84e186b2"],
+ ["ed9b90", "e18492e185aee186b3"],
+ ["ed9b90", "ed9b84e186b3"],
+ ["ed9b91", "e18492e185aee186b4"],
+ ["ed9b91", "ed9b84e186b4"],
+ ["ed9b92", "e18492e185aee186b5"],
+ ["ed9b92", "ed9b84e186b5"],
+ ["ed9b93", "e18492e185aee186b6"],
+ ["ed9b93", "ed9b84e186b6"],
+ ["ed9b94", "e18492e185aee186b7"],
+ ["ed9b94", "ed9b84e186b7"],
+ ["ed9b95", "e18492e185aee186b8"],
+ ["ed9b95", "ed9b84e186b8"],
+ ["ed9b96", "e18492e185aee186b9"],
+ ["ed9b96", "ed9b84e186b9"],
+ ["ed9b97", "e18492e185aee186ba"],
+ ["ed9b97", "ed9b84e186ba"],
+ ["ed9b98", "e18492e185aee186bb"],
+ ["ed9b98", "ed9b84e186bb"],
+ ["ed9b99", "e18492e185aee186bc"],
+ ["ed9b99", "ed9b84e186bc"],
+ ["ed9b9a", "e18492e185aee186bd"],
+ ["ed9b9a", "ed9b84e186bd"],
+ ["ed9b9b", "e18492e185aee186be"],
+ ["ed9b9b", "ed9b84e186be"],
+ ["ed9b9c", "e18492e185aee186bf"],
+ ["ed9b9c", "ed9b84e186bf"],
+ ["ed9b9d", "e18492e185aee18780"],
+ ["ed9b9d", "ed9b84e18780"],
+ ["ed9b9e", "e18492e185aee18781"],
+ ["ed9b9e", "ed9b84e18781"],
+ ["ed9b9f", "e18492e185aee18782"],
+ ["ed9b9f", "ed9b84e18782"],
+ ["ed9ba0", "e18492e185af"],
+ ["ed9ba1", "e18492e185afe186a8"],
+ ["ed9ba1", "ed9ba0e186a8"],
+ ["ed9ba2", "e18492e185afe186a9"],
+ ["ed9ba2", "ed9ba0e186a9"],
+ ["ed9ba3", "e18492e185afe186aa"],
+ ["ed9ba3", "ed9ba0e186aa"],
+ ["ed9ba4", "e18492e185afe186ab"],
+ ["ed9ba4", "ed9ba0e186ab"],
+ ["ed9ba5", "e18492e185afe186ac"],
+ ["ed9ba5", "ed9ba0e186ac"],
+ ["ed9ba6", "e18492e185afe186ad"],
+ ["ed9ba6", "ed9ba0e186ad"],
+ ["ed9ba7", "e18492e185afe186ae"],
+ ["ed9ba7", "ed9ba0e186ae"],
+ ["ed9ba8", "e18492e185afe186af"],
+ ["ed9ba8", "ed9ba0e186af"],
+ ["ed9ba9", "e18492e185afe186b0"],
+ ["ed9ba9", "ed9ba0e186b0"],
+ ["ed9baa", "e18492e185afe186b1"],
+ ["ed9baa", "ed9ba0e186b1"],
+ ["ed9bab", "e18492e185afe186b2"],
+ ["ed9bab", "ed9ba0e186b2"],
+ ["ed9bac", "e18492e185afe186b3"],
+ ["ed9bac", "ed9ba0e186b3"],
+ ["ed9bad", "e18492e185afe186b4"],
+ ["ed9bad", "ed9ba0e186b4"],
+ ["ed9bae", "e18492e185afe186b5"],
+ ["ed9bae", "ed9ba0e186b5"],
+ ["ed9baf", "e18492e185afe186b6"],
+ ["ed9baf", "ed9ba0e186b6"],
+ ["ed9bb0", "e18492e185afe186b7"],
+ ["ed9bb0", "ed9ba0e186b7"],
+ ["ed9bb1", "e18492e185afe186b8"],
+ ["ed9bb1", "ed9ba0e186b8"],
+ ["ed9bb2", "e18492e185afe186b9"],
+ ["ed9bb2", "ed9ba0e186b9"],
+ ["ed9bb3", "e18492e185afe186ba"],
+ ["ed9bb3", "ed9ba0e186ba"],
+ ["ed9bb4", "e18492e185afe186bb"],
+ ["ed9bb4", "ed9ba0e186bb"],
+ ["ed9bb5", "e18492e185afe186bc"],
+ ["ed9bb5", "ed9ba0e186bc"],
+ ["ed9bb6", "e18492e185afe186bd"],
+ ["ed9bb6", "ed9ba0e186bd"],
+ ["ed9bb7", "e18492e185afe186be"],
+ ["ed9bb7", "ed9ba0e186be"],
+ ["ed9bb8", "e18492e185afe186bf"],
+ ["ed9bb8", "ed9ba0e186bf"],
+ ["ed9bb9", "e18492e185afe18780"],
+ ["ed9bb9", "ed9ba0e18780"],
+ ["ed9bba", "e18492e185afe18781"],
+ ["ed9bba", "ed9ba0e18781"],
+ ["ed9bbb", "e18492e185afe18782"],
+ ["ed9bbb", "ed9ba0e18782"],
+ ["ed9bbc", "e18492e185b0"],
+ ["ed9bbd", "e18492e185b0e186a8"],
+ ["ed9bbd", "ed9bbce186a8"],
+ ["ed9bbe", "e18492e185b0e186a9"],
+ ["ed9bbe", "ed9bbce186a9"],
+ ["ed9bbf", "e18492e185b0e186aa"],
+ ["ed9bbf", "ed9bbce186aa"],
+ ["ed9c80", "e18492e185b0e186ab"],
+ ["ed9c80", "ed9bbce186ab"],
+ ["ed9c81", "e18492e185b0e186ac"],
+ ["ed9c81", "ed9bbce186ac"],
+ ["ed9c82", "e18492e185b0e186ad"],
+ ["ed9c82", "ed9bbce186ad"],
+ ["ed9c83", "e18492e185b0e186ae"],
+ ["ed9c83", "ed9bbce186ae"],
+ ["ed9c84", "e18492e185b0e186af"],
+ ["ed9c84", "ed9bbce186af"],
+ ["ed9c85", "e18492e185b0e186b0"],
+ ["ed9c85", "ed9bbce186b0"],
+ ["ed9c86", "e18492e185b0e186b1"],
+ ["ed9c86", "ed9bbce186b1"],
+ ["ed9c87", "e18492e185b0e186b2"],
+ ["ed9c87", "ed9bbce186b2"],
+ ["ed9c88", "e18492e185b0e186b3"],
+ ["ed9c88", "ed9bbce186b3"],
+ ["ed9c89", "e18492e185b0e186b4"],
+ ["ed9c89", "ed9bbce186b4"],
+ ["ed9c8a", "e18492e185b0e186b5"],
+ ["ed9c8a", "ed9bbce186b5"],
+ ["ed9c8b", "e18492e185b0e186b6"],
+ ["ed9c8b", "ed9bbce186b6"],
+ ["ed9c8c", "e18492e185b0e186b7"],
+ ["ed9c8c", "ed9bbce186b7"],
+ ["ed9c8d", "e18492e185b0e186b8"],
+ ["ed9c8d", "ed9bbce186b8"],
+ ["ed9c8e", "e18492e185b0e186b9"],
+ ["ed9c8e", "ed9bbce186b9"],
+ ["ed9c8f", "e18492e185b0e186ba"],
+ ["ed9c8f", "ed9bbce186ba"],
+ ["ed9c90", "e18492e185b0e186bb"],
+ ["ed9c90", "ed9bbce186bb"],
+ ["ed9c91", "e18492e185b0e186bc"],
+ ["ed9c91", "ed9bbce186bc"],
+ ["ed9c92", "e18492e185b0e186bd"],
+ ["ed9c92", "ed9bbce186bd"],
+ ["ed9c93", "e18492e185b0e186be"],
+ ["ed9c93", "ed9bbce186be"],
+ ["ed9c94", "e18492e185b0e186bf"],
+ ["ed9c94", "ed9bbce186bf"],
+ ["ed9c95", "e18492e185b0e18780"],
+ ["ed9c95", "ed9bbce18780"],
+ ["ed9c96", "e18492e185b0e18781"],
+ ["ed9c96", "ed9bbce18781"],
+ ["ed9c97", "e18492e185b0e18782"],
+ ["ed9c97", "ed9bbce18782"],
+ ["ed9c98", "e18492e185b1"],
+ ["ed9c99", "e18492e185b1e186a8"],
+ ["ed9c99", "ed9c98e186a8"],
+ ["ed9c9a", "e18492e185b1e186a9"],
+ ["ed9c9a", "ed9c98e186a9"],
+ ["ed9c9b", "e18492e185b1e186aa"],
+ ["ed9c9b", "ed9c98e186aa"],
+ ["ed9c9c", "e18492e185b1e186ab"],
+ ["ed9c9c", "ed9c98e186ab"],
+ ["ed9c9d", "e18492e185b1e186ac"],
+ ["ed9c9d", "ed9c98e186ac"],
+ ["ed9c9e", "e18492e185b1e186ad"],
+ ["ed9c9e", "ed9c98e186ad"],
+ ["ed9c9f", "e18492e185b1e186ae"],
+ ["ed9c9f", "ed9c98e186ae"],
+ ["ed9ca0", "e18492e185b1e186af"],
+ ["ed9ca0", "ed9c98e186af"],
+ ["ed9ca1", "e18492e185b1e186b0"],
+ ["ed9ca1", "ed9c98e186b0"],
+ ["ed9ca2", "e18492e185b1e186b1"],
+ ["ed9ca2", "ed9c98e186b1"],
+ ["ed9ca3", "e18492e185b1e186b2"],
+ ["ed9ca3", "ed9c98e186b2"],
+ ["ed9ca4", "e18492e185b1e186b3"],
+ ["ed9ca4", "ed9c98e186b3"],
+ ["ed9ca5", "e18492e185b1e186b4"],
+ ["ed9ca5", "ed9c98e186b4"],
+ ["ed9ca6", "e18492e185b1e186b5"],
+ ["ed9ca6", "ed9c98e186b5"],
+ ["ed9ca7", "e18492e185b1e186b6"],
+ ["ed9ca7", "ed9c98e186b6"],
+ ["ed9ca8", "e18492e185b1e186b7"],
+ ["ed9ca8", "ed9c98e186b7"],
+ ["ed9ca9", "e18492e185b1e186b8"],
+ ["ed9ca9", "ed9c98e186b8"],
+ ["ed9caa", "e18492e185b1e186b9"],
+ ["ed9caa", "ed9c98e186b9"],
+ ["ed9cab", "e18492e185b1e186ba"],
+ ["ed9cab", "ed9c98e186ba"],
+ ["ed9cac", "e18492e185b1e186bb"],
+ ["ed9cac", "ed9c98e186bb"],
+ ["ed9cad", "e18492e185b1e186bc"],
+ ["ed9cad", "ed9c98e186bc"],
+ ["ed9cae", "e18492e185b1e186bd"],
+ ["ed9cae", "ed9c98e186bd"],
+ ["ed9caf", "e18492e185b1e186be"],
+ ["ed9caf", "ed9c98e186be"],
+ ["ed9cb0", "e18492e185b1e186bf"],
+ ["ed9cb0", "ed9c98e186bf"],
+ ["ed9cb1", "e18492e185b1e18780"],
+ ["ed9cb1", "ed9c98e18780"],
+ ["ed9cb2", "e18492e185b1e18781"],
+ ["ed9cb2", "ed9c98e18781"],
+ ["ed9cb3", "e18492e185b1e18782"],
+ ["ed9cb3", "ed9c98e18782"],
+ ["ed9cb4", "e18492e185b2"],
+ ["ed9cb5", "e18492e185b2e186a8"],
+ ["ed9cb5", "ed9cb4e186a8"],
+ ["ed9cb6", "e18492e185b2e186a9"],
+ ["ed9cb6", "ed9cb4e186a9"],
+ ["ed9cb7", "e18492e185b2e186aa"],
+ ["ed9cb7", "ed9cb4e186aa"],
+ ["ed9cb8", "e18492e185b2e186ab"],
+ ["ed9cb8", "ed9cb4e186ab"],
+ ["ed9cb9", "e18492e185b2e186ac"],
+ ["ed9cb9", "ed9cb4e186ac"],
+ ["ed9cba", "e18492e185b2e186ad"],
+ ["ed9cba", "ed9cb4e186ad"],
+ ["ed9cbb", "e18492e185b2e186ae"],
+ ["ed9cbb", "ed9cb4e186ae"],
+ ["ed9cbc", "e18492e185b2e186af"],
+ ["ed9cbc", "ed9cb4e186af"],
+ ["ed9cbd", "e18492e185b2e186b0"],
+ ["ed9cbd", "ed9cb4e186b0"],
+ ["ed9cbe", "e18492e185b2e186b1"],
+ ["ed9cbe", "ed9cb4e186b1"],
+ ["ed9cbf", "e18492e185b2e186b2"],
+ ["ed9cbf", "ed9cb4e186b2"],
+ ["ed9d80", "e18492e185b2e186b3"],
+ ["ed9d80", "ed9cb4e186b3"],
+ ["ed9d81", "e18492e185b2e186b4"],
+ ["ed9d81", "ed9cb4e186b4"],
+ ["ed9d82", "e18492e185b2e186b5"],
+ ["ed9d82", "ed9cb4e186b5"],
+ ["ed9d83", "e18492e185b2e186b6"],
+ ["ed9d83", "ed9cb4e186b6"],
+ ["ed9d84", "e18492e185b2e186b7"],
+ ["ed9d84", "ed9cb4e186b7"],
+ ["ed9d85", "e18492e185b2e186b8"],
+ ["ed9d85", "ed9cb4e186b8"],
+ ["ed9d86", "e18492e185b2e186b9"],
+ ["ed9d86", "ed9cb4e186b9"],
+ ["ed9d87", "e18492e185b2e186ba"],
+ ["ed9d87", "ed9cb4e186ba"],
+ ["ed9d88", "e18492e185b2e186bb"],
+ ["ed9d88", "ed9cb4e186bb"],
+ ["ed9d89", "e18492e185b2e186bc"],
+ ["ed9d89", "ed9cb4e186bc"],
+ ["ed9d8a", "e18492e185b2e186bd"],
+ ["ed9d8a", "ed9cb4e186bd"],
+ ["ed9d8b", "e18492e185b2e186be"],
+ ["ed9d8b", "ed9cb4e186be"],
+ ["ed9d8c", "e18492e185b2e186bf"],
+ ["ed9d8c", "ed9cb4e186bf"],
+ ["ed9d8d", "e18492e185b2e18780"],
+ ["ed9d8d", "ed9cb4e18780"],
+ ["ed9d8e", "e18492e185b2e18781"],
+ ["ed9d8e", "ed9cb4e18781"],
+ ["ed9d8f", "e18492e185b2e18782"],
+ ["ed9d8f", "ed9cb4e18782"],
+ ["ed9d90", "e18492e185b3"],
+ ["ed9d91", "e18492e185b3e186a8"],
+ ["ed9d91", "ed9d90e186a8"],
+ ["ed9d92", "e18492e185b3e186a9"],
+ ["ed9d92", "ed9d90e186a9"],
+ ["ed9d93", "e18492e185b3e186aa"],
+ ["ed9d93", "ed9d90e186aa"],
+ ["ed9d94", "e18492e185b3e186ab"],
+ ["ed9d94", "ed9d90e186ab"],
+ ["ed9d95", "e18492e185b3e186ac"],
+ ["ed9d95", "ed9d90e186ac"],
+ ["ed9d96", "e18492e185b3e186ad"],
+ ["ed9d96", "ed9d90e186ad"],
+ ["ed9d97", "e18492e185b3e186ae"],
+ ["ed9d97", "ed9d90e186ae"],
+ ["ed9d98", "e18492e185b3e186af"],
+ ["ed9d98", "ed9d90e186af"],
+ ["ed9d99", "e18492e185b3e186b0"],
+ ["ed9d99", "ed9d90e186b0"],
+ ["ed9d9a", "e18492e185b3e186b1"],
+ ["ed9d9a", "ed9d90e186b1"],
+ ["ed9d9b", "e18492e185b3e186b2"],
+ ["ed9d9b", "ed9d90e186b2"],
+ ["ed9d9c", "e18492e185b3e186b3"],
+ ["ed9d9c", "ed9d90e186b3"],
+ ["ed9d9d", "e18492e185b3e186b4"],
+ ["ed9d9d", "ed9d90e186b4"],
+ ["ed9d9e", "e18492e185b3e186b5"],
+ ["ed9d9e", "ed9d90e186b5"],
+ ["ed9d9f", "e18492e185b3e186b6"],
+ ["ed9d9f", "ed9d90e186b6"],
+ ["ed9da0", "e18492e185b3e186b7"],
+ ["ed9da0", "ed9d90e186b7"],
+ ["ed9da1", "e18492e185b3e186b8"],
+ ["ed9da1", "ed9d90e186b8"],
+ ["ed9da2", "e18492e185b3e186b9"],
+ ["ed9da2", "ed9d90e186b9"],
+ ["ed9da3", "e18492e185b3e186ba"],
+ ["ed9da3", "ed9d90e186ba"],
+ ["ed9da4", "e18492e185b3e186bb"],
+ ["ed9da4", "ed9d90e186bb"],
+ ["ed9da5", "e18492e185b3e186bc"],
+ ["ed9da5", "ed9d90e186bc"],
+ ["ed9da6", "e18492e185b3e186bd"],
+ ["ed9da6", "ed9d90e186bd"],
+ ["ed9da7", "e18492e185b3e186be"],
+ ["ed9da7", "ed9d90e186be"],
+ ["ed9da8", "e18492e185b3e186bf"],
+ ["ed9da8", "ed9d90e186bf"],
+ ["ed9da9", "e18492e185b3e18780"],
+ ["ed9da9", "ed9d90e18780"],
+ ["ed9daa", "e18492e185b3e18781"],
+ ["ed9daa", "ed9d90e18781"],
+ ["ed9dab", "e18492e185b3e18782"],
+ ["ed9dab", "ed9d90e18782"],
+ ["ed9dac", "e18492e185b4"],
+ ["ed9dad", "e18492e185b4e186a8"],
+ ["ed9dad", "ed9dace186a8"],
+ ["ed9dae", "e18492e185b4e186a9"],
+ ["ed9dae", "ed9dace186a9"],
+ ["ed9daf", "e18492e185b4e186aa"],
+ ["ed9daf", "ed9dace186aa"],
+ ["ed9db0", "e18492e185b4e186ab"],
+ ["ed9db0", "ed9dace186ab"],
+ ["ed9db1", "e18492e185b4e186ac"],
+ ["ed9db1", "ed9dace186ac"],
+ ["ed9db2", "e18492e185b4e186ad"],
+ ["ed9db2", "ed9dace186ad"],
+ ["ed9db3", "e18492e185b4e186ae"],
+ ["ed9db3", "ed9dace186ae"],
+ ["ed9db4", "e18492e185b4e186af"],
+ ["ed9db4", "ed9dace186af"],
+ ["ed9db5", "e18492e185b4e186b0"],
+ ["ed9db5", "ed9dace186b0"],
+ ["ed9db6", "e18492e185b4e186b1"],
+ ["ed9db6", "ed9dace186b1"],
+ ["ed9db7", "e18492e185b4e186b2"],
+ ["ed9db7", "ed9dace186b2"],
+ ["ed9db8", "e18492e185b4e186b3"],
+ ["ed9db8", "ed9dace186b3"],
+ ["ed9db9", "e18492e185b4e186b4"],
+ ["ed9db9", "ed9dace186b4"],
+ ["ed9dba", "e18492e185b4e186b5"],
+ ["ed9dba", "ed9dace186b5"],
+ ["ed9dbb", "e18492e185b4e186b6"],
+ ["ed9dbb", "ed9dace186b6"],
+ ["ed9dbc", "e18492e185b4e186b7"],
+ ["ed9dbc", "ed9dace186b7"],
+ ["ed9dbd", "e18492e185b4e186b8"],
+ ["ed9dbd", "ed9dace186b8"],
+ ["ed9dbe", "e18492e185b4e186b9"],
+ ["ed9dbe", "ed9dace186b9"],
+ ["ed9dbf", "e18492e185b4e186ba"],
+ ["ed9dbf", "ed9dace186ba"],
+ ["ed9e80", "e18492e185b4e186bb"],
+ ["ed9e80", "ed9dace186bb"],
+ ["ed9e81", "e18492e185b4e186bc"],
+ ["ed9e81", "ed9dace186bc"],
+ ["ed9e82", "e18492e185b4e186bd"],
+ ["ed9e82", "ed9dace186bd"],
+ ["ed9e83", "e18492e185b4e186be"],
+ ["ed9e83", "ed9dace186be"],
+ ["ed9e84", "e18492e185b4e186bf"],
+ ["ed9e84", "ed9dace186bf"],
+ ["ed9e85", "e18492e185b4e18780"],
+ ["ed9e85", "ed9dace18780"],
+ ["ed9e86", "e18492e185b4e18781"],
+ ["ed9e86", "ed9dace18781"],
+ ["ed9e87", "e18492e185b4e18782"],
+ ["ed9e87", "ed9dace18782"],
+ ["ed9e88", "e18492e185b5"],
+ ["ed9e89", "e18492e185b5e186a8"],
+ ["ed9e89", "ed9e88e186a8"],
+ ["ed9e8a", "e18492e185b5e186a9"],
+ ["ed9e8a", "ed9e88e186a9"],
+ ["ed9e8b", "e18492e185b5e186aa"],
+ ["ed9e8b", "ed9e88e186aa"],
+ ["ed9e8c", "e18492e185b5e186ab"],
+ ["ed9e8c", "ed9e88e186ab"],
+ ["ed9e8d", "e18492e185b5e186ac"],
+ ["ed9e8d", "ed9e88e186ac"],
+ ["ed9e8e", "e18492e185b5e186ad"],
+ ["ed9e8e", "ed9e88e186ad"],
+ ["ed9e8f", "e18492e185b5e186ae"],
+ ["ed9e8f", "ed9e88e186ae"],
+ ["ed9e90", "e18492e185b5e186af"],
+ ["ed9e90", "ed9e88e186af"],
+ ["ed9e91", "e18492e185b5e186b0"],
+ ["ed9e91", "ed9e88e186b0"],
+ ["ed9e92", "e18492e185b5e186b1"],
+ ["ed9e92", "ed9e88e186b1"],
+ ["ed9e93", "e18492e185b5e186b2"],
+ ["ed9e93", "ed9e88e186b2"],
+ ["ed9e94", "e18492e185b5e186b3"],
+ ["ed9e94", "ed9e88e186b3"],
+ ["ed9e95", "e18492e185b5e186b4"],
+ ["ed9e95", "ed9e88e186b4"],
+ ["ed9e96", "e18492e185b5e186b5"],
+ ["ed9e96", "ed9e88e186b5"],
+ ["ed9e97", "e18492e185b5e186b6"],
+ ["ed9e97", "ed9e88e186b6"],
+ ["ed9e98", "e18492e185b5e186b7"],
+ ["ed9e98", "ed9e88e186b7"],
+ ["ed9e99", "e18492e185b5e186b8"],
+ ["ed9e99", "ed9e88e186b8"],
+ ["ed9e9a", "e18492e185b5e186b9"],
+ ["ed9e9a", "ed9e88e186b9"],
+ ["ed9e9b", "e18492e185b5e186ba"],
+ ["ed9e9b", "ed9e88e186ba"],
+ ["ed9e9c", "e18492e185b5e186bb"],
+ ["ed9e9c", "ed9e88e186bb"],
+ ["ed9e9d", "e18492e185b5e186bc"],
+ ["ed9e9d", "ed9e88e186bc"],
+ ["ed9e9e", "e18492e185b5e186bd"],
+ ["ed9e9e", "ed9e88e186bd"],
+ ["ed9e9f", "e18492e185b5e186be"],
+ ["ed9e9f", "ed9e88e186be"],
+ ["ed9ea0", "e18492e185b5e186bf"],
+ ["ed9ea0", "ed9e88e186bf"],
+ ["ed9ea1", "e18492e185b5e18780"],
+ ["ed9ea1", "ed9e88e18780"],
+ ["ed9ea2", "e18492e185b5e18781"],
+ ["ed9ea2", "ed9e88e18781"],
+ ["ed9ea3", "e18492e185b5e18782"],
+ ["ed9ea3", "ed9e88e18782"],
+ ["e1bf8d", "e1bebfcc80"],
+ ["e1bf8e", "e1bebfcc81"],
+ ["e1bf8f", "e1bebfcd82"],
+ ["e1bf9d", "e1bfbecc80"],
+ ["e1bf9e", "e1bfbecc81"],
+ ["e1bf9f", "e1bfbecd82"],
+ ["e38294", "e38186e38299"],
["e3818c", "e3818be38299"],
["e3818e", "e3818de38299"],
["e38190", "e3818fe38299"],
@@ -876,8 +23119,8 @@ MAC_DECOMPOSE_TBL = [
["e381ba", "e381b8e3829a"],
["e381bc", "e381bbe38299"],
["e381bd", "e381bbe3829a"],
- ["e38294", "e38186e38299"],
["e3829e", "e3829de38299"],
+ ["e383b4", "e382a6e38299"],
["e382ac", "e382abe38299"],
["e382ae", "e382ade38299"],
["e382b0", "e382afe38299"],
@@ -903,43 +23146,9 @@ MAC_DECOMPOSE_TBL = [
["e3839a", "e38398e3829a"],
["e3839c", "e3839be38299"],
["e3839d", "e3839be3829a"],
- ["e383b4", "e382a6e38299"],
["e383b7", "e383afe38299"],
["e383b8", "e383b0e38299"],
["e383b9", "e383b1e38299"],
["e383ba", "e383b2e38299"],
["e383be", "e383bde38299"],
- ["efac9f", "d7b2d6b7"],
- ["efacaa", "d7a9d781"],
- ["efacab", "d7a9d782"],
- ["efacac", "d7a9d6bcd781"],
- ["efacad", "d7a9d6bcd782"],
- ["efacae", "d790d6b7"],
- ["efacaf", "d790d6b8"],
- ["efacb0", "d790d6bc"],
- ["efacb1", "d791d6bc"],
- ["efacb2", "d792d6bc"],
- ["efacb3", "d793d6bc"],
- ["efacb4", "d794d6bc"],
- ["efacb5", "d795d6bc"],
- ["efacb6", "d796d6bc"],
- ["efacb8", "d798d6bc"],
- ["efacb9", "d799d6bc"],
- ["efacba", "d79ad6bc"],
- ["efacbb", "d79bd6bc"],
- ["efacbc", "d79cd6bc"],
- ["efacbe", "d79ed6bc"],
- ["efad80", "d7a0d6bc"],
- ["efad81", "d7a1d6bc"],
- ["efad83", "d7a3d6bc"],
- ["efad84", "d7a4d6bc"],
- ["efad86", "d7a6d6bc"],
- ["efad87", "d7a7d6bc"],
- ["efad88", "d7a8d6bc"],
- ["efad89", "d7a9d6bc"],
- ["efad8a", "d7aad6bc"],
- ["efad8b", "d795d6b9"],
- ["efad8c", "d791d6bf"],
- ["efad8d", "d79bd6bf"],
- ["efad8e", "d7a4d6bf"],
]
diff --git a/enc/trans/utf8_mac.trans b/enc/trans/utf8_mac.trans
index 11ce35e212..bcaa785ead 100644
--- a/enc/trans/utf8_mac.trans
+++ b/enc/trans/utf8_mac.trans
@@ -3,8 +3,18 @@
<%
require 'utf8_mac-tbl'
+ def charlen(v)
+ v.gsub(/[0-7].|[c-d].{3}|e.{5}/, '.').size
+ end
+
+ map = {}
+ MAC_DECOMPOSE_TBL.each do |c, d|
+ v = map[c]
+ next if v && charlen(v) > charlen(d)
+ map[c] = d
+ end
transcode_tblgen("UTF-8", "UTF8-MAC",
- MAC_DECOMPOSE_TBL + [
+ map.to_a + [
["{00-7F}", :nomap],
["{c2-df}{80-bf}", :nomap0],
["e0{a0-bf}{80-bf}", :nomap0],
@@ -27,11 +37,41 @@
map["f4{80-8f}{80-bf}{80-bf}"] = :func_so
transcode_generate_node(ActionMap.parse(map), "from_UTF8_MAC")
- ary = MAC_DECOMPOSE_TBL.select{|k,v|v.scan(/[0-7C-F].(?:[89AB].)*/i).length == 3}
- transcode_generate_node(ActionMap.parse(ary.map{|k,v|[v,k]}), "from_utf8_mac_nfc3")
-
- ary = MAC_DECOMPOSE_TBL.select{|k,v|v.scan(/[0-7C-F].(?:[89AB].)*/i).length == 2}
- transcode_generate_node(ActionMap.parse(ary.map{|k,v|[v,k]}), "from_utf8_mac_nfc2")
+ # http://www.unicode.org/Public/UNIDATA/CompositionExclusions.txt
+ composition_exclusions = [
+ 0x0958,0x0959,0x095A,0x095B,0x095C,0x095D,0x095E,0x095F,
+ 0x09DC,0x09DD,0x09DF,0x0A33,0x0A36,0x0A59,0x0A5A,0x0A5B,
+ 0x0A5E,0x0B5C,0x0B5D,0x0F43,0x0F4D,0x0F52,0x0F57,0x0F5C,
+ 0x0F69,0x0F76,0x0F78,0x0F93,0x0F9D,0x0FA2,0x0FA7,0x0FAC,
+ 0x0FB9,0xFB1D,0xFB1F,0xFB2A,0xFB2B,0xFB2C,0xFB2D,0xFB2E,
+ 0xFB2F,0xFB30,0xFB31,0xFB32,0xFB33,0xFB34,0xFB35,0xFB36,
+ 0xFB38,0xFB39,0xFB3A,0xFB3B,0xFB3C,0xFB3E,0xFB40,0xFB41,
+ 0xFB43,0xFB44,0xFB46,0xFB47,0xFB48,0xFB49,0xFB4A,0xFB4B,
+ 0xFB4C,0xFB4D,0xFB4E,0x2ADC,
+# 0x1D15E,0x1D15F,0x1D160,0x1D161,0x1D162,0x1D163,0x1D164,
+# 0x1D1BB,0x1D1BC,0x1D1BD,0x1D1BE,0x1D1BF,0x1D1C0,
+ 0x0340..0x0341,0x0343,0x0374,0x037E,0x0387,
+ 0x1F71,0x1F73,0x1F75,0x1F77,0x1F79,0x1F7B,0x1F7D,0x1FBB,
+ 0x1FBE,0x1FC9,0x1FCB,0x1FD3,0x1FDB,0x1FE3,0x1FEB,0x1FEE..0x1FEF,
+ 0x1FF9,0x1FFB,0x1FFD,0x2000..0x2001,0x2126,0x212A..0x212B,0x2329,0x232A,
+ 0xF900..0xFA0D,0xFA10,0xFA12,0xFA15..0xFA1E,0xFA20,0xFA22,0xFA25..0xFA26,
+ 0xFA2A..0xFA6D,0xFA70..0xFAD9,
+# 0x2F800..0x2FA1D,
+ 0x0344,0x0F73,0x0F75,0x0F81
+ ]
+ extbl = {}
+ composition_exclusions.each do |x|
+ case x
+ when Range
+ x.each do |n|
+ extbl[[n].pack("U").unpack("H*")[0]] = true
+ end
+ when Integer
+ extbl[[x].pack("U").unpack("H*")[0]] = true
+ end
+ end
+ ary = MAC_DECOMPOSE_TBL.reject{|k,v|charlen(v)!=2||extbl[k]}.map{|k,v|[v,k]}
+ transcode_generate_node(ActionMap.parse(ary), "from_utf8_mac_nfc2")
%>
<%= transcode_generated_code %>
@@ -50,54 +90,38 @@ struct from_utf8_mac_status {
unsigned char buf[STATUS_BUF_SIZE];
int beg;
int end;
- int len;
};
-#define buf_length(sp) ((sp)->len)
-
-int
-buf_bytesize(struct from_utf8_mac_status *sp)
-{
- int size = sp->end - sp->beg + STATUS_BUF_SIZE;
- size %= STATUS_BUF_SIZE;
- return size;
-}
+#define buf_empty_p(p) ((p)->beg == (p)->end)
+#define buf_bytesize(p) (((p)->end - (p)->beg + STATUS_BUF_SIZE) % STATUS_BUF_SIZE)
+#define utf8_trailbyte(c) (((c) & 0xC0) == 0x80)
-void
+static void
buf_push(struct from_utf8_mac_status *sp, const unsigned char *p, ssize_t l)
{
const unsigned char *pend = p + l;
while (p < pend) {
+ /* if (sp->beg == sp->end) */
sp->buf[sp->end++] = *p++;
sp->end %= STATUS_BUF_SIZE;
}
- sp->len++;
}
-unsigned char
+static unsigned char
buf_shift(struct from_utf8_mac_status *sp)
{
+ /* if (sp->beg == sp->end) */
unsigned char c = sp->buf[sp->beg++];
sp->beg %= STATUS_BUF_SIZE;
- if ((c & 0xC0) != 0x80) sp->len--;
return c;
}
-void
-buf_shift_char(struct from_utf8_mac_status *sp)
-{
- if (sp->beg == sp->end) return;
- do {
- buf_shift(sp);
- } while (sp->beg != sp->end && (sp->buf[sp->beg] & 0xC0) == 0x80);
-}
-
-void
+static void
buf_clear(struct from_utf8_mac_status *sp)
{
- sp->beg = sp->end = sp->len = 0;
+ sp->beg = sp->end = 0;
}
-unsigned char
+static unsigned char
buf_at(struct from_utf8_mac_status *sp, int pos)
{
pos += sp->beg;
@@ -105,28 +129,28 @@ buf_at(struct from_utf8_mac_status *sp, int pos)
return sp->buf[pos];
}
-int
+static size_t
buf_output_char(struct from_utf8_mac_status *sp, unsigned char *o)
{
- int n = 0;
- while (sp->beg != sp->end) {
+ size_t n = 0;
+ while (!buf_empty_p(sp)) {
o[n++] = buf_shift(sp);
- if ((sp->buf[sp->beg] & 0xC0) != 0x80) break;
+ if (!utf8_trailbyte(sp->buf[sp->beg])) break;
}
return n;
}
-int
+static size_t
buf_output_all(struct from_utf8_mac_status *sp, unsigned char *o)
{
- int n = 0;
- while (sp->beg != sp->end) {
+ size_t n = 0;
+ while (!buf_empty_p(sp)) {
o[n++] = buf_shift(sp);
}
return n;
}
-VALUE
+static VALUE
get_info(VALUE next_info, struct from_utf8_mac_status *sp) {
int pos = 0;
while (pos < buf_bytesize(sp)) {
@@ -142,30 +166,32 @@ get_info(VALUE next_info, struct from_utf8_mac_status *sp) {
return next_info;
}
-int
-buf_apply(int mode, struct from_utf8_mac_status *sp, unsigned char *o)
+static size_t
+buf_apply(struct from_utf8_mac_status *sp, unsigned char *o)
{
- int n = 0;
- VALUE next_info = mode == 3 ? from_utf8_mac_nfc3 : from_utf8_mac_nfc2;
- next_info = get_info(next_info, sp);
+ size_t n = 0;
+ VALUE next_info;
+ unsigned char buf[3];
+ if (buf_bytesize(sp) < 3 || (buf_bytesize(sp) == 3 && buf_at(sp, 0) >= 0xE0)) {
+ /* char length is less than 2 */
+ return 0;
+ }
+ next_info = get_info(from_utf8_mac_nfc2, sp);
switch (next_info & 0x1F) {
case THREEbt:
case TWObt:
- o[n++] = getBT1(next_info);
- o[n++] = getBT2(next_info);
- if (THREEbt == (next_info & 0x1F)) o[n++] = getBT3(next_info);
- if (mode == 3) {
- buf_clear(sp);
- }
- else {
- buf_shift_char(sp);
- buf_shift_char(sp);
- }
+ buf[n++] = getBT1(next_info);
+ buf[n++] = getBT2(next_info);
+ if (THREEbt == (next_info & 0x1F))
+ buf[n++] = getBT3(next_info);
+ buf_clear(sp);
+ buf_push(sp, buf, n);
+ return 0;
break;
default:
- return 0;
+ return buf_output_char(sp, o);
+ break;
}
- return n;
}
static int
@@ -181,10 +207,7 @@ from_utf8_mac_finish(void *statep,
unsigned char *o, size_t osize)
{
struct from_utf8_mac_status *sp = statep;
- int n;
- if (buf_length(sp) == 0) return 0;
- n = buf_apply(2, sp, o) + buf_output_all(sp, o);
- return n;
+ return buf_output_all(sp, o);
}
static ssize_t
@@ -209,15 +232,8 @@ fun_so_from_utf8_mac(void *statep,
}
buf_push(sp, s, l);
- if (buf_length(sp) < 3) return n;
-
- n = buf_apply(3, sp, o);
- if (n > 0) return n;
-
- n = buf_apply(2, sp, o);
- if (n > 0) return n;
-
- return buf_output_char(sp, o);
+ n += buf_apply(sp, o);
+ return n;
}
static const rb_transcoder
@@ -238,4 +254,3 @@ TRANS_INIT(utf8_mac)
<%= transcode_register_code %>
rb_register_transcoder(&rb_from_UTF8_MAC);
}
-
diff --git a/enc/unicode.c b/enc/unicode.c
index 20990c1e54..f0ef89880f 100644
--- a/enc/unicode.c
+++ b/enc/unicode.c
@@ -71,8 +71,6 @@ 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];
@@ -103,10 +101,46 @@ 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
@@ -143,7 +177,7 @@ 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[],
- struct OnigEncodingTypeST* enc ARG_UNUSED)
+ OnigEncoding enc ARG_UNUSED)
{
*sb_out = 0x00;
return onigenc_unicode_ctype_code_range(ctype, ranges);
@@ -184,120 +218,21 @@ onigenc_unicode_property_name_to_ctype(OnigEncoding enc, UChar* name, UChar* end
return ctype;
}
-
-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;
-}
+#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
extern int
onigenc_unicode_mbc_case_fold(OnigEncoding enc,
OnigCaseFoldType flag ARG_UNUSED, const UChar** pp, const UChar* end,
UChar* fold)
{
- CodePointList3 *to;
+ const 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;
@@ -313,7 +248,7 @@ onigenc_unicode_mbc_case_fold(OnigEncoding enc,
}
#endif
- if (onig_st_lookup(FoldTable, (st_data_t )code, (void* )&to) != 0) {
+ if ((to = onigenc_unicode_fold_lookup(code)) != 0) {
if (to->n == 1) {
return ONIGENC_CODE_TO_MBC(enc, to->code[0], fold);
}
@@ -349,8 +284,6 @@ 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++) {
@@ -483,10 +416,8 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding enc,
{
int n, i, j, k, len;
OnigCodePoint code, codes[3];
- CodePointList3 *to, *z3;
- CodePointList2 *z2;
-
- if (CaseFoldInited == 0) init_case_fold_table();
+ const CodePointList3 *to, *z3;
+ const CodePointList2 *z2;
n = 0;
@@ -522,7 +453,7 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding enc,
}
#endif
- if (onig_st_lookup(FoldTable, (st_data_t )code, (void* )&to) != 0) {
+ if ((to = onigenc_unicode_fold_lookup(code)) != 0) {
if (to->n == 1) {
OnigCodePoint orig_code = code;
@@ -532,7 +463,7 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding enc,
n++;
code = to->code[0];
- if (onig_st_lookup(Unfold1Table, (st_data_t )code, (void* )&to) != 0) {
+ if ((to = onigenc_unicode_unfold1_lookup(code)) != 0) {
for (i = 0; i < to->n; i++) {
if (to->code[i] != orig_code) {
items[n].byte_len = len;
@@ -549,8 +480,7 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding enc,
for (fn = 0; fn < to->n; fn++) {
cs[fn][0] = to->code[fn];
- if (onig_st_lookup(Unfold1Table, (st_data_t )cs[fn][0],
- (void* )&z3) != 0) {
+ if ((z3 = onigenc_unicode_unfold1_lookup(cs[fn][0])) != 0) {
for (i = 0; i < z3->n; i++) {
cs[fn][i+1] = z3->code[i];
}
@@ -571,8 +501,7 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding enc,
}
}
- if (onig_st_lookup(Unfold2Table, (st_data_t )to->code,
- (void* )&z2) != 0) {
+ if ((z2 = onigenc_unicode_unfold2_lookup(to->code)) != 0) {
for (i = 0; i < z2->n; i++) {
if (z2->code[i] == code) continue;
@@ -597,8 +526,7 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding enc,
}
}
- if (onig_st_lookup(Unfold3Table, (st_data_t )to->code,
- (void* )&z2) != 0) {
+ if ((z2 = onigenc_unicode_unfold3_lookup(to->code)) != 0) {
for (i = 0; i < z2->n; i++) {
if (z2->code[i] == code) continue;
@@ -615,7 +543,7 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding enc,
}
}
else {
- if (onig_st_lookup(Unfold1Table, (st_data_t )code, (void* )&to) != 0) {
+ if ((to = onigenc_unicode_unfold1_lookup(code)) != 0) {
for (i = 0; i < to->n; i++) {
items[n].byte_len = len;
items[n].code_len = 1;
@@ -633,7 +561,7 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding enc,
codes[0] = code;
code = ONIGENC_MBC_TO_CODE(enc, p, end);
- if (onig_st_lookup(FoldTable, (st_data_t )code, (void* )&to) != 0
+ if ((to = onigenc_unicode_fold_lookup(code)) != 0
&& to->n == 1) {
codes[1] = to->code[0];
}
@@ -642,7 +570,7 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding enc,
clen = enclen(enc, p, end);
len += clen;
- if (onig_st_lookup(Unfold2Table, (st_data_t )codes, (void* )&z2) != 0) {
+ if ((z2 = onigenc_unicode_unfold2_lookup(codes)) != 0) {
for (i = 0; i < z2->n; i++) {
items[n].byte_len = len;
items[n].code_len = 1;
@@ -654,7 +582,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 (onig_st_lookup(FoldTable, (st_data_t )code, (void* )&to) != 0
+ if ((to = onigenc_unicode_fold_lookup(code)) != 0
&& to->n == 1) {
codes[2] = to->code[0];
}
@@ -663,8 +591,7 @@ onigenc_unicode_get_case_fold_codes_by_str(OnigEncoding enc,
clen = enclen(enc, p, end);
len += clen;
- if (onig_st_lookup(Unfold3Table, (st_data_t )codes,
- (void* )&z2) != 0) {
+ if ((z2 = onigenc_unicode_unfold3_lookup(codes)) != 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
new file mode 100755
index 0000000000..d93de6581b
--- /dev/null
+++ b/enc/unicode/case-folding.rb
@@ -0,0 +1,196 @@
+#!/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 b9559de4a3..475a20a48e 100644
--- a/enc/unicode/casefold.h
+++ b/enc/unicode/casefold.h
@@ -1,2238 +1,5619 @@
/* DO NOT EDIT THIS FILE. */
-/* Generated by tool/CaseFolding.py */
+/* Generated by enc/unicode/case-folding.rb */
-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}}},
+static const CaseFold_11_Type CaseFold_11_Table[] = {
+#define CaseFold (*(CaseFold_11_Type (*)[1178])(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}}},
+ {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}}},
+ {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}}},
+ {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+1178))
+ {0x0049, {1, {0x0069}}},
+ {0x0130, {2, {0x0069, 0x0307}}},
};
-static const CaseFold_11_Type CaseFold_Locale[] = {
- { 0x0049, {1, {0x0069}}},
- { 0x0130, {2, {0x0069, 0x0307}}},
-};
+/* C code produced by gperf version 3.0.3 */
+/* 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 */
-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 }}},
-};
+/* maximum key range = 1867, duplicates = 0 */
-static const CaseUnfold_11_Type CaseUnfold_11_Locale[] = {
- { 0x0069, {1, {0x0049 }}},
-};
+#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[] =
+ {
+ 12, 212, 5, 217, 6, 1878, 173, 13, 2, 11,
+ 123, 5, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878,
+ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878,
+ 1878, 1878, 1878, 220, 1878, 1878, 1878, 1878, 1878, 1878,
+ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 382,
+ 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878, 1878,
+ 8, 4, 219, 1, 1878, 343, 607, 274, 1202, 305,
+ 1362, 209, 259, 412, 1443, 174, 290, 35, 442, 21,
+ 1434, 70, 1472, 105, 362, 193, 591, 51, 3, 7,
+ 1414, 86, 1391, 371, 1358, 398, 1456, 149, 1266, 245,
+ 1263, 135, 1231, 121, 1096, 446, 932, 323, 1033, 428,
+ 1155, 466, 1084, 991, 1160, 474, 1131, 977, 298, 749,
+ 990, 491, 1010, 482, 1021, 696, 161, 729, 46, 966,
+ 1209, 813, 1043, 616, 848, 917, 1019, 594, 1201, 526,
+ 1127, 540, 943, 900, 171, 774, 1283, 760, 626, 935,
+ 1025, 554, 288, 955, 103, 788, 423, 1113, 24, 1005,
+ 20, 711, 9, 573, 358, 668, 5, 885, 228, 649,
+ 102, 628, 612, 515, 800, 871, 77, 1132, 17, 1072,
+ 1, 1188, 47, 1276, 244, 1326, 887, 1289, 202, 740,
+ 258, 1168, 222
+ };
+ return asso_values[bits_of(code, 2)+65] + asso_values[bits_of(code, 1)] + asso_values[bits_of(code, 0)];
+}
+
+#ifdef __GNUC__
+__inline
+#ifdef __GNUC_STDC_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 = 1180,
+ MIN_WORD_LENGTH = 3,
+ MAX_WORD_LENGTH = 3,
+ MIN_HASH_VALUE = 11,
+ MAX_HASH_VALUE = 1877
+ };
+
+ static const short wordlist[] =
+ {
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1,
+ /*0x10417*/ 1129,
+ -1, -1,
+ /*0x1ff3*/ 794,
+ /*0x10418*/ 1130,
+ /*0x1f97*/ 729,
+ /*0x0417*/ 320,
+ /*0x2c17*/ 873,
+ /*0x1e97*/ 600,
+ /*0x1f98*/ 730,
+ /*0x0418*/ 321,
+ /*0x2c18*/ 874,
+ /*0x1e98*/ 601,
+ /*0x0118*/ 69,
+ /*0x0218*/ 202,
+ /*0x2c98*/ 924,
+ /*0x1e18*/ 536,
+ /*0x0397*/ 248,
+ /*0x1040e*/ 1120,
+ /*0x0498*/ 369,
+ -1,
+ /*0x0398*/ 249,
+ /*0xa798*/ 1053,
+ /*0x1f8e*/ 720,
+ /*0x040e*/ 311,
+ /*0x2c0e*/ 864,
+ /*0x1e8e*/ 595,
+ /*0x010e*/ 64,
+ /*0x020e*/ 197,
+ /*0x2c8e*/ 919,
+ /*0x1e0e*/ 531,
+ /*0x03f1*/ 288,
+ /*0x1040c*/ 1118,
+ /*0x048e*/ 364,
+ -1,
+ /*0x038e*/ 239,
+ /*0xa698*/ 1000,
+ /*0x1f8c*/ 718,
+ /*0x040c*/ 309,
+ /*0x2c0c*/ 862,
+ /*0x1e8c*/ 594,
+ /*0x010c*/ 63,
+ /*0x020c*/ 196,
+ /*0x2c8c*/ 918,
+ /*0x1e0c*/ 530,
+ -1, -1,
+ /*0x048c*/ 363,
+ /*0x10416*/ 1128,
+ /*0x038c*/ 238,
+ /*0xa68e*/ 995,
+ /*0x2c75*/ 909,
+ /*0x013f*/ 87,
+ /*0x1f96*/ 728,
+ /*0x0416*/ 319,
+ /*0x2c16*/ 872,
+ /*0x1e96*/ 599,
+ /*0x0116*/ 68,
+ /*0x0216*/ 201,
+ /*0x2c96*/ 923,
+ /*0x1e16*/ 535,
+ /*0x03f5*/ 290,
+ -1,
+ /*0x0496*/ 368,
+ /*0xa68c*/ 994,
+ /*0x0396*/ 247,
+ /*0xa796*/ 1052,
+ /*0x10410*/ 1122,
+ -1, -1, -1, -1,
+ /*0x1f90*/ 722,
+ /*0x0410*/ 313,
+ /*0x2c10*/ 866,
+ /*0x1e90*/ 596,
+ /*0x0110*/ 65,
+ /*0x0210*/ 198,
+ /*0x2c90*/ 920,
+ /*0x1e10*/ 532,
+ /*0xa696*/ 999,
+ /*0x2c6f*/ 906,
+ /*0x0490*/ 365,
+ /*0x1041a*/ 1132,
+ /*0x0390*/ 241,
+ /*0xa790*/ 1050,
+ -1, -1,
+ /*0x1f9a*/ 732,
+ /*0x041a*/ 323,
+ /*0x2c1a*/ 876,
+ /*0x1e9a*/ 603,
+ /*0x011a*/ 70,
+ /*0x021a*/ 203,
+ /*0x2c9a*/ 925,
+ /*0x1e1a*/ 537,
+ -1, -1,
+ /*0x049a*/ 370,
+ /*0xa690*/ 996,
+ /*0x039a*/ 251,
+ /*0xa79a*/ 1054,
+ /*0x10412*/ 1124,
+ -1,
+ /*0x1fe9*/ 789,
+ /*0x1fd9*/ 780,
+ /*0x2c69*/ 902,
+ /*0x1f92*/ 724,
+ /*0x0412*/ 315,
+ /*0x2c12*/ 868,
+ /*0x1e92*/ 597,
+ /*0x0112*/ 66,
+ /*0x0212*/ 199,
+ /*0x2c92*/ 921,
+ /*0x1e12*/ 533,
+ /*0xa69a*/ 1001,
+ /*0x0059*/ 23,
+ /*0x0492*/ 366,
+ /*0x10426*/ 1144,
+ /*0x0392*/ 243,
+ /*0xa792*/ 1051,
+ -1, -1,
+ /*0x1fa6*/ 744,
+ /*0x0426*/ 335,
+ /*0x2c26*/ 888,
+ /*0x1ea6*/ 609,
+ /*0x0126*/ 76,
+ /*0x0226*/ 209,
+ /*0x2ca6*/ 931,
+ /*0x1e26*/ 543,
+ /*0x0518*/ 433,
+ /*0x10424*/ 1142,
+ /*0x04a6*/ 376,
+ /*0xa692*/ 997,
+ /*0x03a6*/ 262,
+ /*0xa7a6*/ 1060,
+ /*0x1fa4*/ 742,
+ /*0x0424*/ 333,
+ /*0x2c24*/ 886,
+ /*0x1ea4*/ 608,
+ /*0x0124*/ 75,
+ /*0x0224*/ 208,
+ /*0x2ca4*/ 930,
+ /*0x1e24*/ 542,
+ /*0x050e*/ 428,
+ /*0x10420*/ 1138,
+ /*0x04a4*/ 375,
+ -1,
+ /*0x03a4*/ 260,
+ /*0xa7a4*/ 1059,
+ /*0x1fa0*/ 738,
+ /*0x0420*/ 329,
+ /*0x2c20*/ 882,
+ /*0x1ea0*/ 606,
+ /*0x0120*/ 73,
+ /*0x0220*/ 206,
+ /*0x2ca0*/ 928,
+ /*0x1e20*/ 540,
+ /*0x050c*/ 427,
+ -1,
+ /*0x04a0*/ 373,
+ -1,
+ /*0x03a0*/ 257,
+ /*0xa7a0*/ 1057,
+ -1, -1,
+ /*0x013d*/ 86,
+ /*0x023d*/ 218,
+ -1,
+ /*0x053f*/ 459,
+ /*0x1040a*/ 1116,
+ -1, -1, -1,
+ /*0x0516*/ 432,
+ /*0x1f8a*/ 716,
+ /*0x040a*/ 307,
+ /*0x2c0a*/ 860,
+ /*0x1e8a*/ 593,
+ /*0x010a*/ 62,
+ /*0x020a*/ 195,
+ /*0x2c8a*/ 917,
+ /*0x1e0a*/ 529,
+ /*0x004f*/ 13,
+ /*0x03cf*/ 270,
+ /*0x048a*/ 362,
+ -1,
+ /*0x038a*/ 237,
+ -1,
+ /*0x10414*/ 1126,
+ -1, -1, -1,
+ /*0x0510*/ 429,
+ /*0x1f94*/ 726,
+ /*0x0414*/ 317,
+ /*0x2c14*/ 870,
+ /*0x1e94*/ 598,
+ /*0x0114*/ 67,
+ /*0x0214*/ 200,
+ /*0x2c94*/ 922,
+ /*0x1e14*/ 534,
+ /*0xa68a*/ 993,
+ /*0x1ffb*/ 801,
+ /*0x0494*/ 367,
+ /*0x10406*/ 1112,
+ /*0x0394*/ 245,
+ /*0x017b*/ 118,
+ -1,
+ /*0x051a*/ 434,
+ /*0x1f86*/ 712,
+ /*0x0406*/ 303,
+ /*0x2c06*/ 856,
+ /*0x1e86*/ 591,
+ /*0x0106*/ 60,
+ /*0x0206*/ 193,
+ /*0x2c86*/ 915,
+ /*0x1e06*/ 527,
+ -1, -1,
+ /*0x0197*/ 136,
+ /*0xa694*/ 998,
+ /*0x0386*/ 234,
+ /*0xa786*/ 1047,
+ /*0x0198*/ 137,
+ /*0x2c7f*/ 911,
+ /*0x1f18*/ 662,
+ /*0x017f*/ 120,
+ /*0x0512*/ 430,
+ /*0x1fe7*/ 787,
+ -1,
+ /*0x2c67*/ 901,
+ /*0x00df*/ 56,
+ -1,
+ /*0x01f1*/ 181,
+ /*0x03ff*/ 296,
+ /*0x00dd*/ 54,
+ /*0xa686*/ 991,
+ /*0x018e*/ 129,
+ /*0x1f5f*/ 697,
+ /*0x1f0e*/ 660,
+ /*0x10422*/ 1140,
+ -1,
+ /*0x1f5d*/ 696,
+ /*0x0526*/ 440,
+ /*0x1ff7*/ 797,
+ /*0x1fa2*/ 740,
+ /*0x0422*/ 331,
+ /*0x2c22*/ 884,
+ /*0x1ea2*/ 607,
+ /*0x0122*/ 74,
+ /*0x0222*/ 207,
+ /*0x2ca2*/ 929,
+ /*0x1e22*/ 541,
+ /*0x1f0c*/ 658,
+ /*0x10407*/ 1113,
+ /*0x04a2*/ 374,
+ /*0x03f7*/ 291,
+ /*0x0524*/ 439,
+ /*0xa7a2*/ 1058,
+ /*0x1f87*/ 713,
+ /*0x0407*/ 304,
+ /*0x2c07*/ 857,
+ /*0x017d*/ 119,
+ /*0x0587*/ 483,
+ /*0x1f3f*/ 683,
+ /*0x10bf*/ 515,
+ -1,
+ /*0x0196*/ 135,
+ -1,
+ /*0x10402*/ 1108,
+ /*0x03fd*/ 294,
+ /*0x0520*/ 437,
+ -1, -1,
+ /*0x1f82*/ 708,
+ /*0x0402*/ 299,
+ /*0x2c02*/ 852,
+ /*0x1e82*/ 589,
+ /*0x0102*/ 58,
+ /*0x0202*/ 191,
+ /*0x2c82*/ 913,
+ /*0x1e02*/ 525,
+ -1,
+ /*0x053d*/ 457,
+ -1,
+ /*0x1040b*/ 1117,
+ /*0x0190*/ 131,
+ /*0xa782*/ 1045,
+ /*0x1fd7*/ 778,
+ -1,
+ /*0x1f8b*/ 717,
+ /*0x040b*/ 308,
+ /*0x2c0b*/ 861,
+ /*0x054f*/ 475,
+ -1,
+ /*0x1f6f*/ 705,
+ /*0x050a*/ 426,
+ -1, -1,
+ /*0x0057*/ 21,
+ /*0x10404*/ 1110,
+ /*0xa682*/ 989,
+ -1,
+ /*0xa78b*/ 1048,
+ /*0x1f1a*/ 664,
+ /*0x1f84*/ 710,
+ /*0x0404*/ 301,
+ /*0x2c04*/ 854,
+ /*0x1e84*/ 590,
+ /*0x0104*/ 59,
+ /*0x0204*/ 192,
+ /*0x2c84*/ 914,
+ /*0x1e04*/ 526,
+ -1,
+ /*0x00d9*/ 50,
+ /*0x0514*/ 431,
+ -1, -1,
+ /*0xa784*/ 1046,
+ /*0x01d9*/ 169,
+ /*0x1f69*/ 699,
+ /*0x1f59*/ 694,
+ -1,
+ /*0x1faa*/ 748,
+ /*0x042a*/ 339,
+ /*0x2c2a*/ 892,
+ /*0x1eaa*/ 611,
+ /*0x012a*/ 78,
+ /*0x022a*/ 211,
+ /*0x2caa*/ 933,
+ /*0x1e2a*/ 545,
+ /*0x0506*/ 424,
+ /*0xa684*/ 990,
+ /*0x04aa*/ 378,
+ -1,
+ /*0x03aa*/ 266,
+ /*0xa7aa*/ 1062,
+ /*0x01a6*/ 144,
+ /*0x10400*/ 1106,
+ -1,
+ /*0x10a6*/ 490,
+ -1, -1,
+ /*0x1f80*/ 706,
+ /*0x0400*/ 297,
+ /*0x2c00*/ 850,
+ /*0x1e80*/ 588,
+ /*0x0100*/ 57,
+ /*0x0200*/ 190,
+ /*0x2c80*/ 912,
+ /*0x1e00*/ 524,
+ /*0x01a4*/ 143,
+ -1,
+ /*0x0480*/ 361,
+ /*0x10a4*/ 488,
+ -1,
+ /*0xa780*/ 1044,
+ /*0x10413*/ 1125,
+ /*0x1fe3*/ 784,
+ -1,
+ /*0x2c63*/ 899,
+ -1,
+ /*0x1f93*/ 725,
+ /*0x0413*/ 316,
+ /*0x2c13*/ 869,
+ /*0x01a0*/ 141,
+ /*0x1041c*/ 1134,
+ /*0x0522*/ 438,
+ /*0x10a0*/ 484,
+ -1,
+ /*0xa680*/ 988,
+ /*0x1f9c*/ 734,
+ /*0x041c*/ 325,
+ /*0x2c1c*/ 878,
+ /*0x0393*/ 244,
+ /*0x011c*/ 71,
+ /*0x021c*/ 204,
+ /*0x2c9c*/ 926,
+ /*0x1e1c*/ 538,
+ /*0x1f3d*/ 681,
+ /*0x10bd*/ 513,
+ /*0x049c*/ 371,
+ /*0x00cf*/ 41,
+ /*0x039c*/ 253,
+ /*0xa79c*/ 1055,
+ -1, -1,
+ /*0x01cf*/ 164,
+ -1, -1,
+ /*0x018a*/ 127,
+ -1,
+ /*0x1f0a*/ 656,
+ /*0x1041e*/ 1136,
+ /*0x037f*/ 233,
+ -1,
+ /*0x0502*/ 422,
+ -1,
+ /*0x1f9e*/ 736,
+ /*0x041e*/ 327,
+ /*0x2c1e*/ 880,
+ /*0x1e9e*/ 605,
+ /*0x011e*/ 72,
+ /*0x021e*/ 205,
+ /*0x2c9e*/ 927,
+ /*0x1e1e*/ 539,
+ -1,
+ /*0x10408*/ 1114,
+ /*0x049e*/ 372,
+ /*0x0194*/ 134,
+ /*0x039e*/ 255,
+ /*0xa79e*/ 1056,
+ /*0x1f88*/ 714,
+ /*0x0408*/ 305,
+ /*0x2c08*/ 858,
+ /*0x1e88*/ 592,
+ /*0x0108*/ 61,
+ /*0x0208*/ 194,
+ /*0x2c88*/ 916,
+ /*0x1e08*/ 528,
+ /*0x0535*/ 449,
+ /*0x118bf*/ 1177,
+ -1,
+ /*0x1fdb*/ 782,
+ /*0x0388*/ 235,
+ /*0x0186*/ 124,
+ -1,
+ /*0x0504*/ 423,
+ /*0x1fac*/ 750,
+ /*0x042c*/ 341,
+ /*0x2c2c*/ 894,
+ /*0x1eac*/ 612,
+ /*0x012c*/ 79,
+ /*0x022c*/ 212,
+ /*0x2cac*/ 934,
+ /*0x1e2c*/ 546,
+ -1,
+ /*0x1040d*/ 1119,
+ /*0x04ac*/ 379,
+ /*0xa688*/ 992,
+ -1,
+ /*0xa7ac*/ 1064,
+ /*0x1f8d*/ 719,
+ /*0x040d*/ 310,
+ /*0x2c0d*/ 863,
+ /*0x052a*/ 442,
+ /*0x1fa8*/ 746,
+ /*0x0428*/ 337,
+ /*0x2c28*/ 890,
+ /*0x1ea8*/ 610,
+ /*0x0128*/ 77,
+ /*0x0228*/ 210,
+ /*0x2ca8*/ 932,
+ /*0x1e28*/ 544,
+ -1,
+ /*0xa78d*/ 1049,
+ /*0x04a8*/ 377,
+ /*0x24bf*/ 833,
+ /*0x03a8*/ 264,
+ /*0xa7a8*/ 1061,
+ /*0x01f7*/ 185,
+ /*0x01a2*/ 142,
+ -1, -1,
+ /*0x10a2*/ 486,
+ /*0x0500*/ 421,
+ /*0x1fae*/ 752,
+ /*0x042e*/ 343,
+ /*0x2c2e*/ 896,
+ /*0x1eae*/ 613,
+ /*0x012e*/ 80,
+ /*0x022e*/ 213,
+ /*0x2cae*/ 935,
+ /*0x1e2e*/ 547,
+ /*0x1fb2*/ 754,
+ /*0x0187*/ 125,
+ /*0x04ae*/ 380,
+ /*0x1eb2*/ 615,
+ /*0x0132*/ 81,
+ /*0x0232*/ 215,
+ /*0x2cb2*/ 937,
+ /*0x1e32*/ 549,
+ /*0x1fba*/ 761,
+ -1,
+ /*0x04b2*/ 382,
+ /*0x1eba*/ 619,
+ /*0xff26*/ 1085,
+ /*0x023a*/ 216,
+ /*0x2cba*/ 941,
+ /*0x1e3a*/ 553,
+ /*0x0182*/ 122,
+ /*0x1fb8*/ 759,
+ /*0x04ba*/ 386,
+ /*0x051c*/ 435,
+ /*0x1eb8*/ 618,
+ -1,
+ /*0x118a6*/ 1152,
+ /*0x2cb8*/ 940,
+ /*0x1e38*/ 552,
+ -1,
+ /*0xff24*/ 1083,
+ /*0x04b8*/ 385,
+ -1, -1,
+ /*0x01d7*/ 168,
+ /*0xfb17*/ 1079,
+ /*0x018b*/ 128,
+ -1,
+ /*0x1f0b*/ 657,
+ /*0x00b5*/ 25,
+ /*0x118a4*/ 1150,
+ -1, -1, -1,
+ /*0x01b5*/ 153,
+ /*0x1fec*/ 792,
+ /*0x046c*/ 351,
+ /*0x10b5*/ 505,
+ /*0x1eec*/ 644,
+ /*0x016c*/ 110,
+ /*0x051e*/ 436,
+ /*0x0184*/ 123,
+ /*0x1e6c*/ 578,
+ -1,
+ /*0x118a0*/ 1146,
+ /*0x04ec*/ 411,
+ /*0x1fca*/ 772,
+ /*0x03ec*/ 285,
+ -1,
+ /*0x1eca*/ 627,
+ /*0x014a*/ 93,
+ /*0x024a*/ 226,
+ /*0x2cca*/ 949,
+ /*0x1e4a*/ 561,
+ /*0x0508*/ 425,
+ -1,
+ /*0x118bd*/ 1175,
+ /*0x004a*/ 8,
+ -1, -1,
+ /*0x1fcc*/ 774,
+ /*0x1f2a*/ 670,
+ /*0x10aa*/ 494,
+ /*0x1ecc*/ 628,
+ /*0x014c*/ 94,
+ /*0x024c*/ 227,
+ /*0x2ccc*/ 950,
+ /*0x1e4c*/ 562,
+ -1, -1,
+ /*0x052c*/ 443,
+ /*0x004c*/ 10,
+ -1,
+ /*0xfb16*/ 1078,
+ /*0x1fd6*/ 777,
+ /*0xa726*/ 1004,
+ -1,
+ /*0x1ed6*/ 633,
+ /*0x0156*/ 99,
+ -1,
+ /*0x2cd6*/ 955,
+ /*0x1e56*/ 567,
+ -1, -1,
+ /*0x04d6*/ 400,
+ /*0x0056*/ 20,
+ /*0x03d6*/ 274,
+ -1,
+ /*0x0528*/ 441,
+ /*0xa724*/ 1003,
+ -1, -1,
+ /*0x24bd*/ 831,
+ /*0x1fe2*/ 783,
+ /*0x0462*/ 346,
+ /*0x2c62*/ 898,
+ /*0x1ee2*/ 639,
+ /*0x0162*/ 105,
+ /*0x0193*/ 133,
+ /*0x2ce2*/ 961,
+ /*0x1e62*/ 573,
+ -1,
+ /*0x24cf*/ 849,
+ /*0x04e2*/ 406,
+ -1,
+ /*0x03e2*/ 280,
+ /*0x10415*/ 1127,
+ /*0x019c*/ 138,
+ /*0x052e*/ 444,
+ /*0x1f1c*/ 666,
+ -1,
+ /*0x1f95*/ 727,
+ /*0x0415*/ 318,
+ /*0x2c15*/ 871,
+ /*0x1fc8*/ 770,
+ -1,
+ /*0x0532*/ 446,
+ /*0x1ec8*/ 626,
+ -1,
+ /*0x0248*/ 225,
+ /*0x2cc8*/ 948,
+ /*0x1e48*/ 560,
+ /*0x10401*/ 1107,
+ /*0x0395*/ 246,
+ /*0x053a*/ 454,
+ /*0x0048*/ 7,
+ -1,
+ /*0x1f81*/ 707,
+ /*0x0401*/ 298,
+ /*0x2c01*/ 851,
+ /*0xff22*/ 1081,
+ /*0x2165*/ 812,
+ /*0x1feb*/ 791,
+ /*0x0538*/ 452,
+ /*0x2c6b*/ 903,
+ /*0x2161*/ 808,
+ /*0x1fc4*/ 767,
+ -1,
+ /*0x2ceb*/ 962,
+ /*0x1ec4*/ 624,
+ /*0x118a2*/ 1148,
+ /*0x0244*/ 222,
+ /*0x2cc4*/ 946,
+ /*0x1e44*/ 558,
+ -1, -1,
+ /*0x1fd3*/ 776,
+ /*0x0044*/ 3,
+ /*0x1fea*/ 790,
+ /*0x046a*/ 350,
+ /*0x1f08*/ 654,
+ /*0x1eea*/ 643,
+ /*0x016a*/ 109,
+ -1,
+ /*0x00db*/ 52,
+ /*0x1e6a*/ 577,
+ /*0xa77b*/ 1041,
+ /*0x0053*/ 17,
+ /*0x04ea*/ 410,
+ /*0x01db*/ 170,
+ /*0x03ea*/ 284,
+ /*0x1f5b*/ 695,
+ -1, -1,
+ /*0x01ac*/ 147,
+ -1,
+ /*0x1f2c*/ 672,
+ /*0x10ac*/ 496,
+ /*0x054a*/ 470,
+ /*0x1fe8*/ 788,
+ /*0x0468*/ 349,
+ -1,
+ /*0x1ee8*/ 642,
+ /*0x0168*/ 108,
+ -1, -1,
+ /*0x1e68*/ 576,
+ -1, -1,
+ /*0x04e8*/ 409,
+ /*0x1f0d*/ 659,
+ /*0x03e8*/ 283,
+ /*0x054c*/ 472,
+ /*0xff35*/ 1100,
+ /*0x1f28*/ 668,
+ /*0x10a8*/ 492,
+ -1, -1,
+ /*0x1fe4*/ 785,
+ /*0x0464*/ 347,
+ /*0x2c64*/ 900,
+ /*0x1ee4*/ 640,
+ /*0x0164*/ 106,
+ /*0x118b5*/ 1167,
+ -1,
+ /*0x1e64*/ 574,
+ /*0x0556*/ 482,
+ -1,
+ /*0x04e4*/ 407,
+ /*0xa722*/ 1002,
+ /*0x03e4*/ 281,
+ -1,
+ /*0x01ae*/ 148,
+ /*0x216f*/ 822,
+ /*0x1f2e*/ 674,
+ /*0x10ae*/ 498,
+ -1, -1,
+ /*0xff2a*/ 1089,
+ -1,
+ /*0x01b2*/ 151,
+ -1,
+ /*0xa77d*/ 1042,
+ /*0x10b2*/ 502,
+ -1,
+ /*0xfb14*/ 1076,
+ /*0x1fbc*/ 763,
+ -1,
+ /*0x118aa*/ 1156,
+ /*0x1ebc*/ 620,
+ /*0x1f3a*/ 678,
+ /*0x10ba*/ 510,
+ /*0x2cbc*/ 942,
+ /*0x1e3c*/ 554,
+ -1, -1,
+ /*0x04bc*/ 387,
+ /*0x01b8*/ 155,
+ /*0x2169*/ 816,
+ /*0x1f38*/ 676,
+ /*0x10b8*/ 508,
+ /*0xfb06*/ 1074,
+ /*0x0460*/ 345,
+ /*0x2c60*/ 897,
+ /*0x1ee0*/ 638,
+ /*0x0160*/ 104,
+ /*0x0548*/ 468,
+ /*0x2ce0*/ 960,
+ /*0x1e60*/ 572,
+ -1, -1,
+ /*0x04e0*/ 405,
+ -1,
+ /*0x03e0*/ 279,
+ -1, -1, -1,
+ /*0x2126*/ 803,
+ -1,
+ /*0x1fbe*/ 764,
+ -1,
+ /*0x01ec*/ 178,
+ /*0x1ebe*/ 621,
+ /*0x1f6c*/ 702,
+ /*0x023e*/ 219,
+ /*0x2cbe*/ 943,
+ /*0x1e3e*/ 555,
+ /*0x00ca*/ 36,
+ /*0x0544*/ 464,
+ /*0x04be*/ 388,
+ /*0x1ffc*/ 802,
+ /*0x047c*/ 359,
+ /*0x01ca*/ 161,
+ /*0x1efc*/ 652,
+ /*0x1f4a*/ 686,
+ -1, -1,
+ /*0x1e7c*/ 586,
+ /*0x0553*/ 479,
+ /*0x1fb6*/ 757,
+ /*0x04fc*/ 419,
+ /*0x00cc*/ 38,
+ /*0x1eb6*/ 617,
+ /*0x0136*/ 83,
+ -1,
+ /*0x2cb6*/ 939,
+ /*0x1e36*/ 551,
+ /*0xa72a*/ 1006,
+ /*0x1f4c*/ 688,
+ /*0x04b6*/ 384,
+ /*0x1fd2*/ 775,
+ -1, -1,
+ /*0x1ed2*/ 631,
+ /*0x0152*/ 97,
+ /*0x00d6*/ 48,
+ /*0x2cd2*/ 953,
+ /*0x1e52*/ 565,
+ -1, -1,
+ /*0x04d2*/ 398,
+ /*0x0052*/ 16,
+ /*0x1f56*/ 693,
+ -1, -1, -1,
+ /*0xfb02*/ 1070,
+ /*0x1ed0*/ 630,
+ /*0x0150*/ 96,
+ -1,
+ /*0x2cd0*/ 952,
+ /*0x1e50*/ 564,
+ -1, -1,
+ /*0x04d0*/ 397,
+ /*0x0050*/ 14,
+ /*0x03d0*/ 271,
+ -1,
+ /*0x1fda*/ 781,
+ /*0x01e2*/ 173,
+ -1,
+ /*0x1eda*/ 635,
+ /*0x015a*/ 101,
+ /*0xff2c*/ 1091,
+ /*0x2cda*/ 957,
+ /*0x1e5a*/ 569,
+ -1,
+ /*0xa66c*/ 987,
+ /*0x04da*/ 402,
+ /*0x005a*/ 24,
+ /*0x03da*/ 276,
+ -1,
+ /*0x2c6d*/ 904,
+ /*0x118ac*/ 1158,
+ -1,
+ /*0x00c8*/ 34,
+ /*0x2ced*/ 963,
+ /*0xfb04*/ 1072,
+ /*0xa64a*/ 970,
+ -1,
+ /*0x01c8*/ 160,
+ /*0xff28*/ 1087,
+ /*0x1f48*/ 684,
+ /*0x1fc2*/ 765,
+ -1, -1,
+ /*0x1ec2*/ 623,
+ -1,
+ /*0x053c*/ 456,
+ /*0x2cc2*/ 945,
+ /*0x1e42*/ 557,
+ /*0x118a8*/ 1154,
+ /*0xa64c*/ 971,
+ /*0x0181*/ 121,
+ /*0x0042*/ 1,
+ /*0x03c2*/ 269,
+ -1,
+ /*0x00c4*/ 30,
+ -1, -1,
+ /*0x1f6b*/ 701,
+ /*0xff2e*/ 1093,
+ /*0x01c4*/ 157,
+ -1,
+ /*0x2167*/ 814,
+ /*0x10c4*/ 520,
+ /*0xa656*/ 976,
+ /*0x00d3*/ 45,
+ -1,
+ /*0xff32*/ 1097,
+ -1,
+ /*0x118ae*/ 1160,
+ /*0x01d3*/ 166,
+ -1,
+ /*0x01ea*/ 177,
+ /*0xfb00*/ 1068,
+ /*0x1f6a*/ 700,
+ /*0xff3a*/ 1105,
+ -1,
+ /*0x118b2*/ 1164,
+ -1,
+ /*0x053e*/ 458,
+ /*0x0145*/ 90,
+ /*0x0245*/ 223,
+ -1,
+ /*0xa662*/ 982,
+ /*0xff38*/ 1103,
+ /*0x118ba*/ 1172,
+ /*0x04c5*/ 392,
+ /*0x0045*/ 4,
+ -1, -1,
+ /*0xa72c*/ 1007,
+ -1,
+ /*0xfb13*/ 1075,
+ /*0x01e8*/ 176,
+ /*0x118b8*/ 1170,
+ /*0x1f68*/ 698,
+ -1, -1, -1,
+ /*0x0536*/ 450,
+ /*0x046e*/ 352,
+ /*0x2c6e*/ 905,
+ /*0x1eee*/ 645,
+ /*0x016e*/ 111,
+ /*0xa648*/ 969,
+ -1,
+ /*0x1e6e*/ 579,
+ -1,
+ /*0xa728*/ 1005,
+ /*0x04ee*/ 412,
+ /*0x0552*/ 478,
+ /*0x03ee*/ 286,
+ /*0x01e4*/ 174,
+ /*0x1fe6*/ 786,
+ /*0x0466*/ 348,
+ /*0x1ff9*/ 799,
+ /*0x1ee6*/ 641,
+ /*0x0166*/ 107,
+ -1,
+ /*0x0179*/ 117,
+ /*0x1e66*/ 575,
+ /*0x24ba*/ 828,
+ -1,
+ /*0x04e6*/ 408,
+ /*0x0550*/ 476,
+ /*0x03e6*/ 282,
+ /*0xa644*/ 967,
+ /*0x03f9*/ 292,
+ /*0xa72e*/ 1008,
+ -1,
+ /*0x24b8*/ 826,
+ /*0x1ece*/ 629,
+ /*0x014e*/ 95,
+ /*0x024e*/ 228,
+ /*0x2cce*/ 951,
+ /*0x1e4e*/ 563,
+ /*0xa732*/ 1009,
+ -1,
+ /*0xa66a*/ 986,
+ /*0x004e*/ 12,
+ /*0x01bc*/ 156,
+ -1,
+ /*0x1f3c*/ 680,
+ /*0x10bc*/ 512,
+ /*0xa73a*/ 1013,
+ /*0x1fc6*/ 768,
+ -1, -1,
+ /*0x1ec6*/ 625,
+ -1,
+ /*0x0246*/ 224,
+ /*0x2cc6*/ 947,
+ /*0x1e46*/ 559,
+ /*0xa738*/ 1012,
+ -1,
+ /*0x01e0*/ 172,
+ /*0x0046*/ 5,
+ /*0x212a*/ 804,
+ -1,
+ /*0xa668*/ 985,
+ /*0x1fa9*/ 747,
+ /*0x0429*/ 338,
+ /*0x2c29*/ 891,
+ /*0x0542*/ 462,
+ -1,
+ /*0x24ca*/ 844,
+ /*0x1ed4*/ 632,
+ /*0x0154*/ 98,
+ -1,
+ /*0x2cd4*/ 954,
+ /*0x1e54*/ 566,
+ -1,
+ /*0x03a9*/ 265,
+ /*0x04d4*/ 399,
+ /*0x0054*/ 18,
+ /*0x1f3e*/ 682,
+ /*0x10be*/ 514,
+ /*0xa76c*/ 1038,
+ /*0xa664*/ 983,
+ /*0x24cc*/ 846,
+ -1,
+ /*0x04cd*/ 396,
+ /*0x004d*/ 11,
+ /*0x1fd8*/ 779,
+ /*0x01fc*/ 188,
+ -1,
+ /*0x1ed8*/ 634,
+ /*0x0158*/ 100,
+ /*0xa74a*/ 1021,
+ /*0x2cd8*/ 956,
+ /*0x1e58*/ 568,
+ -1,
+ /*0x2163*/ 810,
+ /*0x04d8*/ 401,
+ /*0x0058*/ 22,
+ /*0x03d8*/ 275,
+ /*0x10b6*/ 506,
+ /*0x1ec0*/ 622,
+ /*0x0545*/ 465,
+ /*0x00d2*/ 44,
+ /*0x2cc0*/ 944,
+ /*0x1e40*/ 556,
+ /*0xa74c*/ 1022,
+ -1,
+ /*0x04c0*/ 389,
+ /*0x1fb4*/ 756,
+ /*0x1f52*/ 691,
+ -1,
+ /*0x1eb4*/ 616,
+ /*0x0134*/ 82,
+ -1,
+ /*0x2cb4*/ 938,
+ /*0x1e34*/ 550,
+ /*0x00d0*/ 42,
+ -1,
+ /*0x04b4*/ 383,
+ /*0xa756*/ 1027,
+ -1,
+ /*0x1fb7*/ 758,
+ -1,
+ /*0x1f50*/ 690,
+ /*0xa660*/ 981,
+ /*0x1eb0*/ 614,
+ /*0x0130*/ 1179,
+ /*0x0230*/ 214,
+ /*0x2cb0*/ 936,
+ /*0x1e30*/ 548,
+ /*0x00da*/ 51,
+ -1,
+ /*0x04b0*/ 381,
+ -1,
+ /*0x03b0*/ 268,
+ /*0xa7b0*/ 1066,
+ /*0x24c8*/ 842,
+ -1,
+ /*0xa762*/ 1033,
+ /*0x1ede*/ 637,
+ /*0x015e*/ 103,
+ /*0x1fb9*/ 760,
+ /*0x2cde*/ 959,
+ /*0x1e5e*/ 571,
+ -1,
+ /*0x0139*/ 84,
+ /*0x04de*/ 404,
+ -1,
+ /*0x03de*/ 278,
+ /*0x1f6d*/ 703,
+ /*0x1fc7*/ 769,
+ /*0x0345*/ 229,
+ /*0x1fbb*/ 762,
+ /*0x054e*/ 474,
+ /*0x0147*/ 91,
+ /*0x00c2*/ 28,
+ /*0x013b*/ 85,
+ /*0x023b*/ 217,
+ /*0x24c4*/ 838,
+ /*0xa748*/ 1020,
+ /*0x04c7*/ 393,
+ /*0x0047*/ 6,
+ -1,
+ /*0x10c2*/ 518,
+ /*0x1fab*/ 749,
+ /*0x042b*/ 340,
+ /*0x2c2b*/ 893,
+ /*0x0055*/ 19,
+ /*0x03d5*/ 273,
+ -1,
+ /*0x0546*/ 466,
+ -1, -1,
+ /*0xa652*/ 974,
+ /*0x1fc3*/ 766,
+ -1,
+ /*0x03ab*/ 267,
+ /*0xa7ab*/ 1063,
+ /*0x0143*/ 89,
+ /*0x0243*/ 221,
+ -1,
+ /*0xa744*/ 1018,
+ -1, -1,
+ /*0x04c3*/ 391,
+ /*0x0043*/ 2,
+ -1,
+ /*0xa650*/ 973,
+ /*0x0554*/ 480,
+ -1,
+ /*0x00c5*/ 31,
+ -1, -1,
+ /*0xa76a*/ 1037,
+ -1,
+ /*0x01c5*/ 158,
+ /*0x054d*/ 473,
+ -1,
+ /*0x10c5*/ 521,
+ -1, -1,
+ /*0xa65a*/ 978,
+ /*0x118bc*/ 1174,
+ /*0x1ff2*/ 793,
+ /*0x0472*/ 354,
+ /*0x2c72*/ 908,
+ /*0x1ef2*/ 647,
+ /*0x0172*/ 113,
+ -1,
+ /*0x2cf2*/ 964,
+ /*0x1e72*/ 581,
+ /*0x2132*/ 806,
+ -1,
+ /*0x04f2*/ 414,
+ /*0xa768*/ 1036,
+ /*0x1faf*/ 753,
+ /*0x042f*/ 344,
+ -1,
+ /*0x01ee*/ 179,
+ /*0x0540*/ 460,
+ /*0x1f6e*/ 704,
+ -1,
+ /*0x10427*/ 1145,
+ -1,
+ /*0xfb15*/ 1077,
+ -1,
+ /*0xa642*/ 966,
+ /*0x1fa7*/ 745,
+ /*0x0427*/ 336,
+ /*0x2c27*/ 889,
+ /*0x0534*/ 448,
+ -1,
+ /*0x01e6*/ 175,
+ /*0xa764*/ 1034,
+ -1,
+ /*0x118be*/ 1176,
+ -1, -1,
+ /*0x24bc*/ 830,
+ /*0x03a7*/ 263,
+ /*0xfb01*/ 1069,
+ -1,
+ /*0x00ce*/ 40,
+ /*0x0537*/ 451,
+ -1,
+ /*0xff36*/ 1101,
+ -1,
+ /*0x1edc*/ 636,
+ /*0x015c*/ 102,
+ -1,
+ /*0x2cdc*/ 958,
+ /*0x1e5c*/ 570,
+ /*0x216c*/ 819,
+ -1,
+ /*0x04dc*/ 403,
+ /*0x118b6*/ 1168,
+ /*0x03dc*/ 277,
+ -1,
+ /*0x1fcb*/ 773,
+ /*0x00c6*/ 32,
+ -1,
+ /*0xa73c*/ 1014,
+ /*0x1fb3*/ 755,
+ /*0x0539*/ 453,
+ /*0x0470*/ 353,
+ /*0x2c70*/ 907,
+ /*0x1ef0*/ 646,
+ /*0x0170*/ 112,
+ /*0x04cb*/ 395,
+ /*0x004b*/ 9,
+ /*0x1e70*/ 580,
+ /*0x24be*/ 832,
+ /*0x0547*/ 467,
+ /*0x04f0*/ 413,
+ /*0x053b*/ 455,
+ /*0x03f0*/ 287,
+ /*0xa760*/ 1032,
+ /*0x00d4*/ 46,
+ /*0x0555*/ 481,
+ /*0x01a9*/ 146,
+ -1,
+ /*0x1f29*/ 669,
+ /*0x10a9*/ 493,
+ -1,
+ /*0x1f54*/ 692,
+ /*0x00cd*/ 39,
+ /*0x1fad*/ 751,
+ /*0x042d*/ 342,
+ /*0x2c2d*/ 895,
+ -1,
+ /*0x01cd*/ 163,
+ /*0x24b6*/ 824,
+ /*0x1f4d*/ 689,
+ /*0x10cd*/ 523,
+ /*0xa73e*/ 1015,
+ -1,
+ /*0x0543*/ 463,
+ /*0x00d8*/ 49,
+ /*0xa666*/ 984,
+ /*0xa7ad*/ 1065,
+ /*0x047e*/ 360,
+ /*0x2c7e*/ 910,
+ /*0x1efe*/ 653,
+ -1,
+ /*0xa7b1*/ 1067,
+ -1,
+ /*0x1e7e*/ 587,
+ -1,
+ /*0x00c0*/ 26,
+ /*0x04fe*/ 420,
+ /*0x2162*/ 809,
+ /*0x03fe*/ 295,
+ -1,
+ /*0xa64e*/ 972,
+ /*0xa736*/ 1011,
+ -1,
+ /*0x10c0*/ 516,
+ -1, -1,
+ /*0x1ff4*/ 795,
+ /*0x0474*/ 355,
+ -1,
+ /*0x1ef4*/ 648,
+ /*0x0174*/ 114,
+ -1,
+ /*0xa752*/ 1025,
+ /*0x1e74*/ 582,
+ /*0x10b4*/ 504,
+ /*0x10403*/ 1109,
+ /*0x04f4*/ 415,
+ /*0xa646*/ 968,
+ /*0x03f4*/ 289,
+ /*0x1fc9*/ 771,
+ /*0x1f83*/ 709,
+ /*0x0403*/ 300,
+ /*0x2c03*/ 853,
+ /*0x0149*/ 92,
+ /*0x01b7*/ 154,
+ -1,
+ /*0xa750*/ 1024,
+ /*0x10b7*/ 507,
+ /*0x10b0*/ 500,
+ /*0x04c9*/ 394,
+ /*0x0049*/ 1178,
+ /*0x0141*/ 88,
+ /*0x0241*/ 220,
+ -1,
+ /*0x00de*/ 55,
+ /*0xa654*/ 975,
+ /*0x216b*/ 818,
+ /*0x04c1*/ 390,
+ /*0x0041*/ 0,
+ /*0x01de*/ 171,
+ /*0xa75a*/ 1029,
+ -1,
+ /*0x24c2*/ 836,
+ -1,
+ /*0x10425*/ 1143,
+ -1,
+ /*0x1f39*/ 677,
+ /*0x10b9*/ 509,
+ /*0x00c7*/ 33,
+ /*0x1fa5*/ 743,
+ /*0x0425*/ 334,
+ /*0x2c25*/ 887,
+ /*0x216a*/ 817,
+ /*0x01c7*/ 159,
+ /*0x00d5*/ 47,
+ /*0xa658*/ 977,
+ /*0x10c7*/ 522,
+ /*0x1f3b*/ 679,
+ /*0x10bb*/ 511,
+ /*0x01d5*/ 167,
+ -1,
+ /*0x03a5*/ 261,
+ /*0x0372*/ 231,
+ -1, -1,
+ /*0xa742*/ 1017,
+ /*0xa640*/ 965,
+ /*0x054b*/ 471,
+ -1,
+ /*0x1f2b*/ 671,
+ /*0x10ab*/ 495,
+ /*0x0533*/ 447,
+ /*0x00c3*/ 29,
+ /*0x2168*/ 815,
+ -1, -1,
+ /*0x10423*/ 1141,
+ /*0x24c5*/ 839,
+ -1,
+ /*0x10421*/ 1139,
+ /*0x10c3*/ 519,
+ /*0x1fa3*/ 741,
+ /*0x0423*/ 332,
+ /*0x2c23*/ 885,
+ /*0x1fa1*/ 739,
+ /*0x0421*/ 330,
+ /*0x2c21*/ 883,
+ -1, -1, -1, -1, -1,
+ /*0x2164*/ 811,
+ /*0x03a3*/ 259,
+ /*0x1ff6*/ 796,
+ /*0x0476*/ 356,
+ /*0x03a1*/ 258,
+ /*0x1ef6*/ 649,
+ /*0x0176*/ 115,
+ -1,
+ /*0x0531*/ 445,
+ /*0x1e76*/ 583,
+ -1, -1,
+ /*0x04f6*/ 416,
+ /*0xa65e*/ 980,
+ /*0x01f2*/ 182,
+ /*0x1ffa*/ 800,
+ /*0x047a*/ 358,
+ -1,
+ /*0x1efa*/ 651,
+ -1,
+ /*0x0051*/ 15,
+ /*0x03d1*/ 272,
+ /*0x1e7a*/ 585,
+ /*0xff29*/ 1088,
+ -1,
+ /*0x04fa*/ 418,
+ /*0x01af*/ 149,
+ /*0x03fa*/ 293,
+ /*0x1f2f*/ 675,
+ /*0x10af*/ 499,
+ /*0x0370*/ 230,
+ /*0xa76e*/ 1039,
+ -1,
+ /*0x118a9*/ 1155,
+ -1, -1, -1,
+ /*0x24ce*/ 848,
+ /*0x01a7*/ 145,
+ -1, -1,
+ /*0x10a7*/ 491,
+ -1,
+ /*0x2160*/ 807,
+ -1,
+ /*0xa766*/ 1035,
+ -1,
+ /*0xa779*/ 1040,
+ -1,
+ /*0x0549*/ 469,
+ /*0x00dc*/ 53,
+ -1,
+ /*0x1ff8*/ 798,
+ /*0x0478*/ 357,
+ /*0x24c6*/ 840,
+ /*0x1ef8*/ 650,
+ /*0x0178*/ 116,
+ /*0x0541*/ 461,
+ -1,
+ /*0x1e78*/ 584,
+ /*0xa74e*/ 1023,
+ -1,
+ /*0x04f8*/ 417,
+ -1,
+ /*0x00cb*/ 37,
+ -1, -1, -1,
+ /*0xff34*/ 1099,
+ /*0x01cb*/ 162,
+ -1,
+ /*0x1f4b*/ 687,
+ -1,
+ /*0x01b3*/ 152,
+ /*0x01f0*/ 180,
+ -1,
+ /*0x10b3*/ 503,
+ /*0xa746*/ 1019,
+ /*0x118b4*/ 1166,
+ /*0x1041d*/ 1135,
+ /*0x24cd*/ 847,
+ /*0xff37*/ 1102,
+ /*0xff30*/ 1095,
+ /*0x10405*/ 1111,
+ /*0x1f9d*/ 735,
+ /*0x041d*/ 326,
+ /*0x2c1d*/ 879,
+ -1,
+ /*0x1f85*/ 711,
+ /*0x0405*/ 302,
+ /*0x2c05*/ 855,
+ /*0x118b7*/ 1169,
+ /*0x118b0*/ 1162,
+ -1, -1,
+ /*0xa754*/ 1026,
+ /*0x039d*/ 254,
+ -1, -1,
+ /*0x1f2d*/ 673,
+ /*0x10ad*/ 497,
+ /*0xff39*/ 1104,
+ /*0x01b1*/ 150,
+ /*0x24c0*/ 834,
+ -1,
+ /*0x10b1*/ 501,
+ -1, -1, -1, -1,
+ /*0x01fe*/ 189,
+ /*0x118b9*/ 1171,
+ /*0x1041b*/ 1133,
+ -1, -1,
+ /*0xa758*/ 1028,
+ -1,
+ /*0x1f9b*/ 733,
+ /*0x041b*/ 324,
+ /*0x2c1b*/ 877,
+ /*0x1e9b*/ 604,
+ /*0xa65c*/ 979,
+ /*0x118bb*/ 1173,
+ -1,
+ /*0xff2b*/ 1090,
+ -1,
+ /*0xa740*/ 1016,
+ /*0x24b7*/ 825,
+ -1,
+ /*0x039b*/ 252,
+ /*0x01f4*/ 183,
+ /*0x0551*/ 477,
+ /*0x216d*/ 820,
+ -1,
+ /*0x118ab*/ 1157,
+ /*0x10419*/ 1131,
+ -1,
+ /*0xa734*/ 1010,
+ /*0x00c9*/ 35,
+ -1,
+ /*0x1f99*/ 731,
+ /*0x0419*/ 322,
+ /*0x2c19*/ 875,
+ /*0x1e99*/ 602,
+ -1,
+ /*0x1f49*/ 685,
+ /*0x00c1*/ 27,
+ /*0x24b9*/ 827,
+ -1, -1, -1, -1,
+ /*0x0399*/ 250,
+ -1,
+ /*0x10c1*/ 517,
+ /*0x1040f*/ 1121,
+ /*0x24c7*/ 841,
+ -1,
+ /*0x24bb*/ 829,
+ -1,
+ /*0x1f8f*/ 721,
+ /*0x040f*/ 312,
+ /*0x2c0f*/ 865,
+ -1,
+ /*0x10409*/ 1115,
+ /*0xa75e*/ 1031,
+ -1, -1, -1,
+ /*0x1f89*/ 715,
+ /*0x0409*/ 306,
+ /*0x2c09*/ 859,
+ /*0x038f*/ 240,
+ -1,
+ /*0x0376*/ 232,
+ /*0xff2f*/ 1094,
+ /*0x10a5*/ 489,
+ /*0x1041f*/ 1137,
+ -1, -1,
+ /*0x24c3*/ 837,
+ /*0x0389*/ 236,
+ /*0x1f9f*/ 737,
+ /*0x041f*/ 328,
+ /*0x2c1f*/ 881,
+ /*0x118af*/ 1161,
+ -1,
+ /*0xff27*/ 1086,
+ -1, -1, -1, -1, -1,
+ /*0x10411*/ 1123,
+ /*0x039f*/ 256,
+ -1, -1,
+ /*0x118a7*/ 1153,
+ /*0x1f91*/ 723,
+ /*0x0411*/ 314,
+ /*0x2c11*/ 867,
+ /*0x2183*/ 823,
+ -1,
+ /*0x216e*/ 821,
+ -1, -1, -1, -1,
+ /*0x10a3*/ 487,
+ -1,
+ /*0x0391*/ 242,
+ /*0x10a1*/ 485,
+ -1, -1, -1, -1, -1,
+ /*0x2166*/ 813,
+ /*0x01f6*/ 184,
+ -1,
+ /*0x00d1*/ 43,
+ -1,
+ /*0xff33*/ 1098,
+ -1, -1,
+ /*0x01d1*/ 165,
+ -1, -1, -1, -1, -1,
+ /*0x01fa*/ 187,
+ /*0x118b3*/ 1165,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1,
+ /*0xff2d*/ 1092,
+ -1, -1, -1, -1,
+ /*0xff31*/ 1096,
+ -1, -1, -1, -1,
+ /*0x118ad*/ 1159,
+ -1, -1, -1, -1,
+ /*0x118b1*/ 1163,
+ -1, -1,
+ /*0x24cb*/ 845,
+ -1, -1, -1,
+ /*0x01f8*/ 186,
+ -1, -1, -1, -1,
+ /*0xa75c*/ 1030,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1,
+ /*0x019d*/ 139,
+ -1,
+ /*0x1f1d*/ 667,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1,
+ /*0xff25*/ 1084,
+ -1, -1, -1, -1, -1,
+ /*0xa77e*/ 1043,
+ -1, -1, -1,
+ /*0x118a5*/ 1151,
+ -1, -1,
+ /*0x1f1b*/ 665,
+ -1, -1,
+ /*0x24c9*/ 843,
+ -1, -1, -1, -1, -1, -1,
+ -1,
+ /*0x24c1*/ 835,
+ -1, -1, -1, -1, -1, -1,
+ -1,
+ /*0xff23*/ 1082,
+ -1, -1,
+ /*0xff21*/ 1080,
+ /*0x1f19*/ 663,
+ -1, -1, -1, -1, -1,
+ /*0x118a3*/ 1149,
+ /*0x212b*/ 805,
+ -1,
+ /*0x118a1*/ 1147,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1,
+ /*0x018f*/ 130,
+ -1,
+ /*0x1f0f*/ 661,
+ -1, -1, -1, -1, -1, -1,
+ /*0x0189*/ 126,
+ -1,
+ /*0x1f09*/ 655,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1,
+ /*0x019f*/ 140,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1,
+ /*0x0191*/ 132,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1,
+ /*0xfb03*/ 1071,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -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*/ 1073
+ };
+
+ 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_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 }}},
+static const CaseUnfold_11_Type CaseUnfold_11_Table[] = {
+#define CaseUnfold_11 (*(CaseUnfold_11_Type (*)[1054])(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}}},
+ {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}}},
+ {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}}},
+ {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}}},
+ {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+1054))
+ {0x0069, {1, {0x0049}}},
};
-static const CaseUnfold_12_Type CaseUnfold_12_Locale[] = {
- { {0x0069, 0x0307}, {1, {0x0130 }}},
+/* C code produced by gperf version 3.0.3 */
+/* 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 = 1907, 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, 1915, 4, 12, 199, 716, 4, 230, 6, 134,
+ 355, 116, 9, 3, 7, 13, 1915, 1915, 1915, 1915,
+ 1915, 1915, 1915, 1915, 1915, 1915, 1915, 1915, 1915, 1915,
+ 1915, 1915, 1915, 1915, 1915, 1915, 1915, 1915, 1915, 1915,
+ 1915, 1915, 1915, 1915, 1915, 1915, 1915, 1915, 1915, 1915,
+ 1915, 1915, 1915, 40, 1915, 1915, 1915, 1915, 1915, 1915,
+ 1915, 1915, 21, 1915, 2, 1, 11, 49, 50, 667,
+ 131, 651, 26, 872, 251, 1136, 24, 42, 295, 1145,
+ 111, 27, 47, 12, 812, 806, 107, 786, 21, 1070,
+ 13, 967, 41, 5, 523, 1152, 71, 1077, 73, 948,
+ 14, 601, 10, 575, 15, 764, 1, 929, 27, 1057,
+ 23, 498, 15, 918, 1208, 753, 1211, 512, 1180, 736,
+ 1082, 711, 441, 898, 410, 1028, 277, 887, 238, 684,
+ 336, 425, 740, 406, 1016, 360, 972, 382, 1006, 354,
+ 1168, 302, 999, 286, 901, 252, 546, 106, 1159, 148,
+ 1121, 224, 1061, 132, 1152, 182, 871, 210, 1163, 235,
+ 1183, 371, 1197, 64, 954, 90, 339, 79, 604, 168,
+ 982, 159, 448, 328, 525, 634, 195, 620, 261, 852,
+ 934, 312, 210, 836, 668, 983, 586, 823, 460, 955,
+ 1176, 697, 119, 998
+ };
+ return asso_values[bits_of(code, 2)+66] + asso_values[bits_of(code, 1)+4] + asso_values[bits_of(code, 0)];
+}
+
+#ifdef __GNUC__
+__inline
+#ifdef __GNUC_STDC_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 = 1055,
+ MIN_WORD_LENGTH = 3,
+ MAX_WORD_LENGTH = 3,
+ MIN_HASH_VALUE = 8,
+ MAX_HASH_VALUE = 1914
+ };
+
+ static const short wordlist[] =
+ {
+ -1, -1, -1, -1, -1, -1,
+ -1, -1,
+ /*0x1e1b*/ 490,
+ /*0x049b*/ 362,
+ /*0x011b*/ 69,
+ /*0x2c9b*/ 781,
+ /*0x021b*/ 178,
+ /*0x051b*/ 426,
+ /*0x1e91*/ 549,
+ /*0x1e11*/ 485,
+ /*0x0491*/ 357,
+ /*0x0111*/ 64,
+ /*0x2c91*/ 776,
+ /*0x0211*/ 173,
+ /*0x0511*/ 421,
+ /*0xa79b*/ 948,
+ /*0x1f24*/ 618,
+ /*0x1f00*/ 600,
+ /*0x1f11*/ 609,
+ /*0x0580*/ 468,
+ /*0x1f22*/ 616,
+ /*0x1f26*/ 620,
+ /*0xa791*/ 944,
+ /*0x1e8f*/ 548,
+ /*0x1e0f*/ 484,
+ /*0x048f*/ 356,
+ /*0x010f*/ 63,
+ /*0x2c8f*/ 775,
+ /*0x020f*/ 172,
+ /*0x050f*/ 420,
+ /*0xa69b*/ 897,
+ -1,
+ /*0x1f06*/ 606,
+ -1,
+ /*0x0586*/ 474,
+ -1, -1,
+ /*0xa691*/ 892,
+ /*0x1e8b*/ 546,
+ /*0x1e0b*/ 482,
+ /*0x048b*/ 354,
+ /*0x010b*/ 61,
+ /*0x2c8b*/ 773,
+ /*0x020b*/ 170,
+ /*0x050b*/ 418,
+ /*0x1e81*/ 541,
+ /*0x1e01*/ 477,
+ /*0x0481*/ 353,
+ /*0x0101*/ 56,
+ /*0x2c81*/ 768,
+ /*0x0201*/ 165,
+ /*0x0501*/ 413,
+ /*0xa68f*/ 891,
+ /*0x1f10*/ 608,
+ -1,
+ /*0x1f01*/ 601,
+ /*0x1f02*/ 602,
+ /*0x0581*/ 469,
+ /*0x0582*/ 470,
+ /*0xa781*/ 939,
+ /*0x1ee1*/ 584,
+ /*0x1e61*/ 525,
+ /*0x04e1*/ 397,
+ /*0x0161*/ 102,
+ /*0x2ce1*/ 816,
+ /*0x0261*/ 210,
+ /*0x0561*/ 437,
+ /*0xa68b*/ 889,
+ /*0x0461*/ 337,
+ -1,
+ /*0x1f61*/ 641,
+ -1, -1, -1,
+ /*0xa681*/ 884,
+ /*0x1ee5*/ 586,
+ /*0x1e65*/ 527,
+ /*0x04e5*/ 399,
+ /*0x0165*/ 104,
+ /*0x1f20*/ 614,
+ /*0x0265*/ 212,
+ /*0x0565*/ 441,
+ -1,
+ /*0x0465*/ 339,
+ -1,
+ /*0x1f65*/ 645,
+ /*0x1ee3*/ 585,
+ /*0x1e63*/ 526,
+ /*0x04e3*/ 398,
+ /*0x0163*/ 103,
+ /*0x2ce3*/ 817,
+ /*0x0263*/ 211,
+ /*0x0563*/ 439,
+ -1,
+ /*0x0463*/ 338,
+ -1,
+ /*0x1f63*/ 643,
+ -1, -1, -1,
+ /*0x2c61*/ 760,
+ /*0x24e1*/ 704,
+ /*0x1ed1*/ 576,
+ /*0x1e51*/ 517,
+ /*0x04d1*/ 389,
+ /*0x0151*/ 94,
+ /*0x2cd1*/ 808,
+ /*0x0251*/ 200,
+ /*0x1fe1*/ 667,
+ /*0xa761*/ 928,
+ /*0x0451*/ 322,
+ -1,
+ /*0x1f51*/ 636,
+ /*0x1f14*/ 612,
+ -1,
+ /*0x2c65*/ 761,
+ /*0x24e5*/ 708,
+ -1,
+ /*0x017e*/ 116,
+ -1, -1,
+ /*0x057e*/ 466,
+ -1,
+ /*0x1fe5*/ 668,
+ /*0xa765*/ 930,
+ -1,
+ /*0x03ae*/ 241,
+ /*0x24e3*/ 706,
+ /*0x1ed7*/ 579,
+ /*0x1e57*/ 520,
+ /*0x04d7*/ 392,
+ /*0x0157*/ 97,
+ /*0x2cd7*/ 811,
+ /*0x0257*/ 205,
+ /*0x03ac*/ 239,
+ /*0xa763*/ 929,
+ /*0x0457*/ 328,
+ /*0x1f04*/ 604,
+ /*0x1f57*/ 639,
+ /*0x0584*/ 472,
+ /*0x0280*/ 223,
+ -1,
+ /*0x2c51*/ 746,
+ /*0x24d1*/ 688,
+ /*0x1ed3*/ 577,
+ /*0x1e53*/ 518,
+ /*0x04d3*/ 390,
+ /*0x0153*/ 95,
+ /*0x2cd3*/ 809,
+ /*0x0253*/ 202,
+ /*0x1fd1*/ 665,
+ /*0xa751*/ 920,
+ /*0x0453*/ 324,
+ /*0x028a*/ 228,
+ /*0x1f53*/ 637,
+ /*0x1ee9*/ 588,
+ /*0x1e69*/ 529,
+ /*0x04e9*/ 401,
+ /*0x0169*/ 106,
+ -1,
+ /*0x0269*/ 215,
+ /*0x0569*/ 445,
+ -1,
+ /*0x0469*/ 341,
+ /*0x1ee7*/ 587,
+ /*0x1e67*/ 528,
+ /*0x04e7*/ 400,
+ /*0x0167*/ 105,
+ /*0x2c57*/ 752,
+ /*0x24d7*/ 694,
+ /*0x0567*/ 443,
+ /*0x028b*/ 229,
+ /*0x0467*/ 340,
+ /*0xa661*/ 877,
+ /*0x1f67*/ 647,
+ /*0x03e1*/ 277,
+ -1,
+ /*0xa757*/ 923,
+ /*0x1ed9*/ 580,
+ /*0x1e59*/ 521,
+ /*0x04d9*/ 393,
+ /*0x0159*/ 98,
+ /*0x2cd9*/ 812,
+ /*0x0259*/ 206,
+ /*0x2c53*/ 748,
+ /*0x24d3*/ 690,
+ /*0x0459*/ 330,
+ -1,
+ /*0xa665*/ 879,
+ -1,
+ /*0x03e5*/ 279,
+ -1, -1,
+ /*0xa753*/ 921,
+ -1,
+ /*0x2cee*/ 819,
+ /*0x24e9*/ 712,
+ /*0x056e*/ 450,
+ -1,
+ /*0xa663*/ 878,
+ /*0x029e*/ 232,
+ /*0x03e3*/ 278,
+ -1,
+ /*0x10428*/ 982,
+ /*0xa769*/ 932,
+ /*0x24e7*/ 710,
+ /*0x1edb*/ 581,
+ /*0x1e5b*/ 522,
+ /*0x04db*/ 394,
+ /*0x015b*/ 99,
+ /*0x2cdb*/ 813,
+ /*0x025b*/ 207,
+ /*0x0574*/ 456,
+ /*0xa767*/ 931,
+ /*0x045b*/ 332,
+ /*0xa651*/ 869,
+ /*0x1f74*/ 652,
+ /*0x1042e*/ 988,
+ /*0x2c59*/ 754,
+ /*0x24d9*/ 696,
+ /*0x1ed5*/ 578,
+ /*0x1e55*/ 519,
+ /*0x04d5*/ 391,
+ /*0x0155*/ 96,
+ /*0x2cd5*/ 810,
+ /*0x1042c*/ 986,
+ /*0x01a8*/ 130,
+ /*0xa759*/ 924,
+ /*0x0455*/ 326,
+ /*0x1042a*/ 984,
+ /*0x1f55*/ 638,
+ /*0x1edd*/ 582,
+ /*0x1e5d*/ 523,
+ /*0x04dd*/ 395,
+ /*0x015d*/ 100,
+ /*0x2cdd*/ 814,
+ /*0x0180*/ 117,
+ /*0x013e*/ 85,
+ -1,
+ /*0x045d*/ 334,
+ -1,
+ /*0xa657*/ 872,
+ /*0x043e*/ 303,
+ /*0x03d7*/ 272,
+ -1,
+ /*0x217e*/ 684,
+ /*0x2c5b*/ 756,
+ /*0x24db*/ 698,
+ /*0x1ecf*/ 575,
+ /*0x1e4f*/ 516,
+ /*0x04cf*/ 388,
+ /*0x014f*/ 93,
+ /*0x2ccf*/ 807,
+ /*0x024f*/ 198,
+ -1,
+ /*0xa75b*/ 925,
+ /*0x044f*/ 320,
+ /*0xa653*/ 870,
+ /*0x0061*/ 0,
+ -1,
+ /*0x2c55*/ 750,
+ /*0x24d5*/ 692,
+ -1,
+ /*0x0570*/ 452,
+ -1, -1,
+ /*0x019a*/ 125,
+ /*0x1f70*/ 648,
+ /*0xa669*/ 881,
+ /*0xa755*/ 922,
+ /*0x03e9*/ 281,
+ /*0x2c5d*/ 758,
+ /*0x24dd*/ 700,
+ /*0x0065*/ 4,
+ /*0x2c3e*/ 727,
+ -1,
+ /*0x013c*/ 84,
+ /*0xa667*/ 880,
+ /*0x023c*/ 190,
+ /*0x03e7*/ 280,
+ /*0xa75d*/ 926,
+ /*0x043c*/ 301,
+ /*0x1ecd*/ 574,
+ /*0x1e4d*/ 515,
+ /*0x0063*/ 2,
+ /*0x014d*/ 92,
+ /*0x2ccd*/ 806,
+ /*0x024d*/ 197,
+ /*0x2c4f*/ 744,
+ /*0x01e1*/ 151,
+ /*0x044d*/ 318,
+ /*0xa659*/ 873,
+ -1,
+ /*0x03d9*/ 273,
+ -1, -1,
+ /*0x019e*/ 126,
+ /*0xa74f*/ 919,
+ /*0x1ecb*/ 573,
+ /*0x1e4b*/ 514,
+ -1,
+ /*0x014b*/ 91,
+ /*0x2ccb*/ 805,
+ /*0x024b*/ 196,
+ /*0x01e5*/ 153,
+ /*0xa78c*/ 943,
+ /*0x044b*/ 316,
+ -1,
+ /*0x1ef3*/ 593,
+ /*0x1e73*/ 534,
+ /*0x04f3*/ 406,
+ /*0x0173*/ 111,
+ /*0x2cf3*/ 820,
+ /*0x2c3c*/ 725,
+ /*0x0573*/ 455,
+ /*0x01e3*/ 152,
+ /*0x0473*/ 346,
+ -1,
+ /*0x1f73*/ 651,
+ /*0xa65b*/ 874,
+ -1,
+ /*0x03db*/ 274,
+ /*0x2c4d*/ 742,
+ -1,
+ /*0x1eeb*/ 589,
+ /*0x1e6b*/ 530,
+ /*0x04eb*/ 402,
+ /*0x016b*/ 107,
+ -1,
+ /*0x026b*/ 216,
+ /*0x056b*/ 447,
+ /*0xa74d*/ 918,
+ /*0x046b*/ 342,
+ /*0xa655*/ 871,
+ -1,
+ /*0x0140*/ 86,
+ /*0x2174*/ 674,
+ /*0x0240*/ 192,
+ /*0x2c4b*/ 740,
+ /*0x118d1*/ 1039,
+ /*0x0440*/ 305,
+ /*0x0564*/ 440,
+ /*0x1f40*/ 630,
+ -1,
+ /*0xa65d*/ 875,
+ /*0x1f64*/ 644,
+ /*0x03dd*/ 275,
+ /*0xa74b*/ 917,
+ /*0x2c73*/ 766,
+ /*0x03be*/ 256,
+ /*0x1ec9*/ 572,
+ /*0x1e49*/ 513,
+ -1,
+ /*0x0069*/ 1054,
+ /*0x2cc9*/ 804,
+ /*0x0249*/ 195,
+ /*0x1ec5*/ 570,
+ /*0x1e45*/ 511,
+ /*0x0449*/ 314,
+ -1,
+ /*0x2cc5*/ 802,
+ /*0xa64f*/ 868,
+ /*0x0067*/ 6,
+ -1,
+ /*0x0445*/ 310,
+ /*0x118d7*/ 1045,
+ /*0x1f45*/ 635,
+ /*0x1edf*/ 583,
+ /*0x1e5f*/ 524,
+ /*0x04df*/ 396,
+ /*0x015f*/ 101,
+ /*0x2cdf*/ 815,
+ /*0x2c40*/ 729,
+ /*0xa76b*/ 933,
+ -1,
+ /*0x045f*/ 336,
+ /*0x24e4*/ 707,
+ -1,
+ /*0x1ec7*/ 571,
+ /*0x1e47*/ 512,
+ /*0x0288*/ 226,
+ /*0x118d3*/ 1041,
+ /*0x2cc7*/ 803,
+ /*0x0247*/ 194,
+ /*0x01e9*/ 155,
+ -1,
+ /*0x0447*/ 312,
+ /*0x2170*/ 670,
+ /*0x03bc*/ 254,
+ /*0x006e*/ 12,
+ /*0x2c49*/ 738,
+ -1, -1,
+ /*0x01e7*/ 154,
+ -1,
+ /*0xa64d*/ 867,
+ /*0x2c45*/ 734,
+ /*0x03cd*/ 270,
+ -1,
+ /*0xa749*/ 916,
+ -1, -1,
+ /*0x1ec3*/ 569,
+ /*0x1e43*/ 510,
+ /*0x0074*/ 18,
+ /*0xa745*/ 914,
+ /*0x2cc3*/ 801,
+ -1,
+ /*0x24df*/ 702,
+ /*0x013a*/ 83,
+ /*0x0443*/ 308,
+ /*0xa64b*/ 866,
+ /*0x1f43*/ 633,
+ /*0x03cb*/ 268,
+ /*0x043a*/ 299,
+ /*0x118d9*/ 1047,
+ /*0xa75f*/ 927,
+ -1,
+ /*0x2c47*/ 736,
+ -1, -1,
+ /*0x1ec1*/ 568,
+ /*0x1e41*/ 509,
+ /*0x03f3*/ 286,
+ /*0x028c*/ 230,
+ /*0x2cc1*/ 800,
+ -1,
+ /*0xa747*/ 915,
+ -1,
+ /*0x0441*/ 306,
+ -1,
+ /*0x1f41*/ 631,
+ -1, -1, -1, -1, -1,
+ /*0xa66b*/ 882,
+ /*0x2173*/ 673,
+ /*0x03eb*/ 282,
+ /*0x1043e*/ 1004,
+ -1,
+ /*0x2c43*/ 732,
+ /*0x118db*/ 1049,
+ -1,
+ /*0x0438*/ 297,
+ /*0x2c3a*/ 723,
+ /*0x03c0*/ 258,
+ /*0xff51*/ 972,
+ -1,
+ /*0x056a*/ 446,
+ /*0xa743*/ 913,
+ -1, -1,
+ /*0x1044f*/ 1021,
+ /*0x0070*/ 14,
+ -1,
+ /*0x118d5*/ 1043,
+ -1,
+ /*0x017a*/ 114,
+ /*0x01dd*/ 149,
+ /*0x2c41*/ 730,
+ /*0x057a*/ 462,
+ /*0xa649*/ 865,
+ -1,
+ /*0x03c9*/ 266,
+ /*0x1f7a*/ 658,
+ -1,
+ /*0x118dd*/ 1051,
+ /*0xa645*/ 863,
+ /*0xa741*/ 912,
+ /*0x03c5*/ 262,
+ -1, -1,
+ /*0xff57*/ 978,
+ -1,
+ /*0x0188*/ 120,
+ /*0x2c38*/ 721,
+ -1,
+ /*0x1043c*/ 1002,
+ /*0xa65f*/ 876,
+ -1,
+ /*0x03df*/ 276,
+ -1,
+ /*0x2c6a*/ 764,
+ /*0x118cf*/ 1037,
+ -1, -1,
+ /*0x1044d*/ 1019,
+ -1,
+ /*0xff53*/ 974,
+ /*0xa647*/ 864,
+ -1,
+ /*0x03c7*/ 264,
+ /*0x1ead*/ 558,
+ /*0x1e2d*/ 499,
+ /*0x04ad*/ 371,
+ /*0x012d*/ 78,
+ /*0x2cad*/ 790,
+ /*0x022d*/ 186,
+ /*0x052d*/ 435,
+ -1, -1, -1,
+ /*0x1044b*/ 1017,
+ /*0xa77a*/ 936,
+ /*0x0073*/ 17,
+ -1,
+ /*0x1eb3*/ 561,
+ /*0x1e33*/ 502,
+ /*0x04b3*/ 374,
+ /*0x0133*/ 80,
+ /*0x2cb3*/ 793,
+ /*0x0233*/ 189,
+ -1,
+ /*0xa643*/ 862,
+ /*0x0433*/ 292,
+ /*0x03c3*/ 260,
+ /*0x1f33*/ 625,
+ /*0x118cd*/ 1035,
+ /*0x018c*/ 121,
+ /*0x03ba*/ 252,
+ /*0x006b*/ 9,
+ /*0x2d1b*/ 848,
+ /*0xff59*/ 980,
+ /*0x2cec*/ 818,
+ /*0x026c*/ 217,
+ /*0x056c*/ 448,
+ /*0x2d24*/ 857,
+ /*0x2d00*/ 821,
+ /*0x2d11*/ 838,
+ /*0x2d18*/ 845,
+ /*0x2d22*/ 855,
+ /*0x0064*/ 3,
+ /*0xa641*/ 861,
+ /*0x118cb*/ 1033,
+ /*0x03c1*/ 259,
+ /*0x01f3*/ 159,
+ /*0x10440*/ 1006,
+ /*0x2d16*/ 843,
+ -1, -1,
+ /*0x2d0a*/ 831,
+ /*0xa72d*/ 903,
+ /*0x2d06*/ 827,
+ /*0x2d0f*/ 836,
+ -1,
+ /*0x0250*/ 199,
+ /*0x2c33*/ 716,
+ -1,
+ /*0x0450*/ 321,
+ -1,
+ /*0x03b8*/ 250,
+ /*0x01eb*/ 156,
+ -1, -1,
+ /*0x10449*/ 1015,
+ /*0xa733*/ 905,
+ -1,
+ /*0x2d1a*/ 847,
+ /*0x2d0b*/ 832,
+ /*0x2c6c*/ 765,
+ /*0x10445*/ 1011,
+ -1, -1,
+ /*0x2d10*/ 837,
+ /*0xff55*/ 976,
+ /*0x2d01*/ 822,
+ /*0x2d02*/ 823,
+ /*0x118c0*/ 1022,
+ -1,
+ /*0x1ea5*/ 554,
+ /*0x1e25*/ 495,
+ /*0x04a5*/ 367,
+ /*0x0125*/ 74,
+ /*0x2ca5*/ 786,
+ /*0x0225*/ 182,
+ /*0x0525*/ 431,
+ -1,
+ /*0x01c9*/ 139,
+ -1,
+ /*0x1f25*/ 619,
+ /*0x2c50*/ 745,
+ /*0x24d0*/ 687,
+ /*0x10447*/ 1013,
+ /*0xa7a5*/ 953,
+ /*0x217a*/ 680,
+ /*0x118c9*/ 1031,
+ /*0x0578*/ 460,
+ /*0x2d1e*/ 851,
+ /*0x1fd0*/ 664,
+ /*0x2d20*/ 853,
+ /*0x1f78*/ 656,
+ /*0x118c5*/ 1027,
+ /*0xff4f*/ 970,
+ -1,
+ /*0x01df*/ 150,
+ /*0x1ea3*/ 553,
+ /*0x1e23*/ 494,
+ /*0x04a3*/ 366,
+ /*0x0123*/ 73,
+ /*0x2ca3*/ 785,
+ /*0x0223*/ 181,
+ /*0x0523*/ 430,
+ /*0x118df*/ 1053,
+ /*0x0266*/ 213,
+ /*0x0566*/ 442,
+ /*0x1f23*/ 617,
+ /*0x10443*/ 1009,
+ /*0x03ad*/ 240,
+ /*0x1f66*/ 646,
+ /*0xa7a3*/ 952,
+ /*0x1043a*/ 1000,
+ -1, -1,
+ /*0x118c7*/ 1029,
+ /*0x1eef*/ 591,
+ /*0x1e6f*/ 532,
+ /*0x04ef*/ 404,
+ /*0x016f*/ 109,
+ /*0xa725*/ 899,
+ /*0x026f*/ 218,
+ /*0x056f*/ 451,
+ /*0x03b3*/ 245,
+ /*0x046f*/ 344,
+ /*0x2d14*/ 841,
+ -1,
+ /*0x10441*/ 1007,
+ /*0xff4d*/ 968,
+ /*0x2d0e*/ 835,
+ /*0x1eed*/ 590,
+ /*0x1e6d*/ 531,
+ /*0x04ed*/ 403,
+ /*0x016d*/ 108,
+ -1, -1,
+ /*0x056d*/ 449,
+ -1,
+ /*0x046d*/ 343,
+ /*0x118c3*/ 1025,
+ /*0x2c66*/ 762,
+ /*0x24e6*/ 709,
+ /*0x006a*/ 8,
+ /*0x10438*/ 998,
+ /*0xff4b*/ 966,
+ -1,
+ /*0xa723*/ 898,
+ /*0x1e85*/ 543,
+ /*0x1e05*/ 479,
+ /*0x2d04*/ 825,
+ /*0x0105*/ 58,
+ /*0x2c85*/ 770,
+ /*0x0205*/ 167,
+ /*0x0505*/ 415,
+ /*0x007a*/ 24,
+ -1, -1,
+ /*0x1f05*/ 605,
+ /*0x118c1*/ 1023,
+ /*0x0585*/ 473,
+ -1,
+ /*0xa785*/ 941,
+ /*0x0373*/ 234,
+ /*0x1e83*/ 542,
+ /*0x1e03*/ 478,
+ /*0xa76f*/ 935,
+ /*0x0103*/ 57,
+ /*0x2c83*/ 769,
+ /*0x0203*/ 166,
+ /*0x0503*/ 414,
+ /*0x0576*/ 458,
+ -1, -1,
+ /*0x1f03*/ 603,
+ /*0x1f76*/ 654,
+ /*0x0583*/ 471,
+ /*0xa685*/ 886,
+ /*0xa783*/ 940,
+ -1,
+ /*0xa76d*/ 934,
+ /*0x1ebf*/ 567,
+ /*0x1e3f*/ 508,
+ /*0x04bf*/ 380,
+ -1,
+ /*0x2cbf*/ 799,
+ /*0x023f*/ 191,
+ -1, -1,
+ /*0x043f*/ 304,
+ -1, -1, -1,
+ /*0xa683*/ 885,
+ /*0x1efd*/ 598,
+ /*0x1e7d*/ 539,
+ /*0x04fd*/ 411,
+ /*0xff49*/ 964,
+ /*0x03f8*/ 287,
+ /*0x027d*/ 222,
+ /*0x057d*/ 465,
+ /*0x1042d*/ 987,
+ /*0x047d*/ 351,
+ /*0xff45*/ 960,
+ /*0x1f7d*/ 661,
+ /*0x2c76*/ 767,
+ -1, -1,
+ /*0x1eb7*/ 563,
+ /*0x1e37*/ 504,
+ /*0x04b7*/ 376,
+ /*0x0137*/ 82,
+ /*0x2cb7*/ 795,
+ /*0x2178*/ 678,
+ /*0x1d7d*/ 476,
+ /*0x10433*/ 993,
+ /*0x0437*/ 296,
+ -1,
+ /*0x1f37*/ 629,
+ -1,
+ /*0x006c*/ 10,
+ /*0x2c3f*/ 728,
+ -1, -1,
+ /*0x01ad*/ 131,
+ /*0xff47*/ 962,
+ -1, -1, -1, -1,
+ /*0xa73f*/ 911,
+ -1,
+ /*0x03ef*/ 284,
+ /*0x1eb5*/ 562,
+ /*0x1e35*/ 503,
+ /*0x04b5*/ 375,
+ /*0x0135*/ 81,
+ /*0x2cb5*/ 794,
+ -1,
+ /*0x04c2*/ 381,
+ /*0x0142*/ 87,
+ /*0x0435*/ 294,
+ /*0x0242*/ 193,
+ /*0x1f35*/ 627,
+ /*0xa66d*/ 883,
+ /*0x0442*/ 307,
+ /*0x03ed*/ 283,
+ /*0x1f42*/ 632,
+ /*0x2c37*/ 720,
+ /*0xff43*/ 958,
+ /*0x1eb1*/ 560,
+ /*0x1e31*/ 501,
+ /*0x04b1*/ 373,
+ -1,
+ /*0x2cb1*/ 792,
+ /*0x0231*/ 188,
+ -1,
+ /*0xa737*/ 907,
+ /*0x0431*/ 290,
+ -1,
+ /*0x1f31*/ 623,
+ /*0x1ea7*/ 555,
+ /*0x1e27*/ 496,
+ /*0x04a7*/ 368,
+ /*0x0127*/ 75,
+ /*0x2ca7*/ 787,
+ /*0x0227*/ 183,
+ /*0x0527*/ 432,
+ /*0xff41*/ 956,
+ -1,
+ /*0x2d08*/ 829,
+ /*0x1f27*/ 621,
+ /*0x01d0*/ 142,
+ /*0x2c35*/ 718,
+ -1,
+ /*0xa7a7*/ 954,
+ /*0x00e1*/ 26,
+ /*0x2c42*/ 731,
+ /*0x2184*/ 686,
+ -1,
+ /*0x118d0*/ 1038,
+ /*0x0078*/ 22,
+ /*0xa735*/ 906,
+ /*0x1e95*/ 551,
+ /*0x1e15*/ 487,
+ /*0x0495*/ 359,
+ /*0x0115*/ 66,
+ /*0x2c95*/ 778,
+ /*0x0215*/ 175,
+ /*0x0515*/ 423,
+ /*0x2c31*/ 714,
+ /*0x00e5*/ 30,
+ -1,
+ /*0x1f15*/ 613,
+ -1,
+ /*0x2176*/ 676,
+ /*0x03bf*/ 257,
+ /*0x0283*/ 224,
+ /*0x1fb1*/ 663,
+ /*0x0066*/ 5,
+ -1,
+ /*0x01a5*/ 129,
+ /*0x00e3*/ 28,
+ /*0x1e93*/ 550,
+ /*0x1e13*/ 486,
+ /*0x0493*/ 358,
+ /*0x0113*/ 65,
+ /*0x2c93*/ 777,
+ /*0x0213*/ 174,
+ /*0x0513*/ 422,
+ /*0xa727*/ 900,
+ -1,
+ /*0xa695*/ 894,
+ /*0x1f13*/ 611,
+ /*0x2d0c*/ 833,
+ /*0x006f*/ 13,
+ -1,
+ /*0xa793*/ 945,
+ -1,
+ /*0x1f12*/ 610,
+ /*0x1ef9*/ 596,
+ /*0x1e79*/ 537,
+ /*0x04f9*/ 409,
+ /*0x03b7*/ 249,
+ /*0x217d*/ 683,
+ -1,
+ /*0x0579*/ 461,
+ /*0x01a3*/ 128,
+ /*0x0479*/ 349,
+ /*0x006d*/ 11,
+ /*0x1f79*/ 657,
+ /*0x00fe*/ 54,
+ /*0xa693*/ 893,
+ /*0x1ef5*/ 594,
+ /*0x1e75*/ 535,
+ /*0x04f5*/ 407,
+ /*0x0175*/ 112,
+ -1,
+ /*0x0275*/ 221,
+ /*0x0575*/ 457,
+ /*0x1d79*/ 475,
+ /*0x0475*/ 347,
+ -1,
+ /*0x1f75*/ 653,
+ -1, -1,
+ /*0x01ef*/ 158,
+ -1,
+ /*0x03b5*/ 247,
+ /*0x1ef1*/ 592,
+ /*0x1e71*/ 533,
+ /*0x04f1*/ 405,
+ /*0x0171*/ 110,
+ -1,
+ /*0x0271*/ 219,
+ /*0x0571*/ 453,
+ -1,
+ /*0x0471*/ 345,
+ -1,
+ /*0x1f71*/ 649,
+ /*0x01ed*/ 157,
+ -1, -1,
+ /*0x0076*/ 20,
+ -1,
+ /*0x03b1*/ 243,
+ -1, -1, -1,
+ /*0x1e87*/ 544,
+ /*0x1e07*/ 480,
+ /*0x00e9*/ 34,
+ /*0x0107*/ 59,
+ /*0x2c87*/ 771,
+ /*0x0207*/ 168,
+ /*0x0507*/ 416,
+ /*0x045a*/ 331,
+ /*0x0185*/ 119,
+ -1,
+ /*0x1f07*/ 607,
+ /*0x00e7*/ 32,
+ -1, -1,
+ /*0xa787*/ 942,
+ /*0x1ebd*/ 566,
+ /*0x1e3d*/ 507,
+ /*0x04bd*/ 379,
+ /*0x1043f*/ 1005,
+ /*0x2cbd*/ 798,
+ /*0xff50*/ 971,
+ -1, -1,
+ /*0x043d*/ 302,
+ /*0x0183*/ 118,
+ -1,
+ /*0x1eb9*/ 564,
+ /*0x1e39*/ 505,
+ /*0x04b9*/ 377,
+ /*0xa687*/ 887,
+ /*0x2cb9*/ 796,
+ /*0x04ce*/ 387,
+ -1, -1,
+ /*0x0439*/ 298,
+ -1, -1,
+ /*0x044e*/ 319,
+ /*0x00ee*/ 39,
+ /*0x2c5a*/ 755,
+ /*0x24da*/ 697,
+ /*0x01bf*/ 137,
+ -1, -1, -1,
+ /*0x10437*/ 997,
+ /*0x1eaf*/ 559,
+ /*0x1e2f*/ 500,
+ /*0x04af*/ 372,
+ /*0x012f*/ 79,
+ /*0x2caf*/ 791,
+ /*0x022f*/ 187,
+ /*0x052f*/ 436,
+ /*0x00f4*/ 45,
+ /*0x01fd*/ 163,
+ /*0x2c3d*/ 726,
+ -1,
+ /*0x1ea9*/ 556,
+ /*0x1e29*/ 497,
+ /*0x04a9*/ 369,
+ /*0x0129*/ 76,
+ /*0x2ca9*/ 788,
+ /*0x0229*/ 184,
+ /*0x0529*/ 433,
+ /*0xa73d*/ 910,
+ -1,
+ /*0x2c39*/ 722,
+ /*0x0272*/ 220,
+ /*0x0572*/ 454,
+ /*0x2c4e*/ 743,
+ /*0x10435*/ 995,
+ /*0xa7a9*/ 955,
+ /*0x1f72*/ 650,
+ /*0x0292*/ 231,
+ /*0x10442*/ 1008,
+ /*0xa739*/ 908,
+ /*0x1ea1*/ 552,
+ /*0x1e21*/ 493,
+ /*0x04a1*/ 365,
+ /*0x0121*/ 72,
+ /*0x2ca1*/ 784,
+ /*0x2179*/ 679,
+ /*0x0521*/ 429,
+ /*0x1efb*/ 597,
+ /*0x1e7b*/ 538,
+ /*0x04fb*/ 410,
+ /*0x1f21*/ 615,
+ /*0x10431*/ 991,
+ /*0x0562*/ 438,
+ /*0x057b*/ 463,
+ /*0xa7a1*/ 951,
+ /*0x047b*/ 350,
+ /*0x1f62*/ 642,
+ /*0x1f7b*/ 659,
+ /*0x2175*/ 675,
+ /*0xa72f*/ 904,
+ /*0x1e19*/ 489,
+ /*0x0499*/ 361,
+ /*0x0119*/ 68,
+ /*0x2c99*/ 780,
+ /*0x0219*/ 177,
+ /*0x0519*/ 425,
+ /*0x04c6*/ 383,
+ /*0x0146*/ 89,
+ /*0x00f0*/ 41,
+ /*0x118c2*/ 1024,
+ /*0xa729*/ 901,
+ -1,
+ /*0x0446*/ 311,
+ /*0xa799*/ 947,
+ /*0x2171*/ 671,
+ /*0x1ef7*/ 595,
+ /*0x1e77*/ 536,
+ /*0x04f7*/ 408,
+ /*0x0177*/ 113,
+ /*0x0268*/ 214,
+ /*0x0568*/ 444,
+ /*0x0577*/ 459,
+ -1,
+ /*0x0477*/ 348,
+ -1,
+ /*0x1f77*/ 655,
+ -1,
+ /*0x24e2*/ 705,
+ /*0xa699*/ 896,
+ -1,
+ /*0x1eff*/ 599,
+ /*0x1e7f*/ 540,
+ /*0x04ff*/ 412,
+ /*0x04cc*/ 386,
+ /*0x03bd*/ 255,
+ -1,
+ /*0x057f*/ 467,
+ /*0x0287*/ 225,
+ /*0x047f*/ 352,
+ /*0x044c*/ 317,
+ /*0x04c8*/ 384,
+ /*0x0148*/ 90,
+ -1, -1,
+ /*0x2c46*/ 735,
+ /*0x03b9*/ 251,
+ /*0x0448*/ 313,
+ /*0x0195*/ 123,
+ /*0x03ce*/ 271,
+ -1,
+ /*0x04c4*/ 382,
+ /*0x0144*/ 88,
+ /*0x2d2d*/ 860,
+ /*0x0079*/ 23,
+ /*0x2c68*/ 763,
+ /*0x24e8*/ 711,
+ /*0x0444*/ 309,
+ -1,
+ /*0x1f44*/ 634,
+ /*0x00f3*/ 44,
+ /*0x1ebb*/ 565,
+ /*0x1e3b*/ 506,
+ /*0x04bb*/ 378,
+ /*0x214e*/ 669,
+ /*0x2cbb*/ 797,
+ /*0x03af*/ 242,
+ /*0x0075*/ 19,
+ -1,
+ /*0x043b*/ 300,
+ -1, -1,
+ /*0x2c4c*/ 741,
+ -1,
+ /*0x0192*/ 122,
+ -1,
+ /*0x00eb*/ 36,
+ -1,
+ /*0x2d1c*/ 849,
+ /*0x2c48*/ 737,
+ /*0xa77f*/ 938,
+ -1,
+ /*0x03f2*/ 285,
+ /*0x0071*/ 15,
+ /*0x037d*/ 238,
+ /*0x01f9*/ 161,
+ -1,
+ /*0x00e4*/ 29,
+ -1,
+ /*0x2c44*/ 733,
+ /*0x1eab*/ 557,
+ /*0x1e2b*/ 498,
+ /*0x04ab*/ 370,
+ /*0x012b*/ 77,
+ /*0x2cab*/ 789,
+ /*0x022b*/ 185,
+ /*0x052b*/ 434,
+ /*0x2172*/ 672,
+ /*0x01f5*/ 160,
+ /*0x0256*/ 204,
+ -1,
+ /*0x2c3b*/ 724,
+ /*0x0456*/ 327,
+ /*0x03fb*/ 288,
+ /*0x1e17*/ 488,
+ /*0x0497*/ 360,
+ /*0x0117*/ 67,
+ /*0x2c97*/ 779,
+ /*0x0217*/ 176,
+ /*0x0517*/ 424,
+ /*0xa73b*/ 909,
+ /*0x1e1f*/ 492,
+ /*0x049f*/ 364,
+ /*0x011f*/ 71,
+ /*0x2c9f*/ 783,
+ /*0x021f*/ 180,
+ /*0x051f*/ 428,
+ /*0xa797*/ 946,
+ /*0x217b*/ 681,
+ /*0xff42*/ 957,
+ /*0x03c6*/ 263,
+ -1, -1,
+ /*0x0436*/ 295,
+ /*0xa79f*/ 950,
+ /*0x1f36*/ 628,
+ /*0x1043d*/ 1003,
+ -1, -1, -1,
+ /*0x2d25*/ 858,
+ -1,
+ /*0xa697*/ 895,
+ /*0x01da*/ 147,
+ /*0x2c56*/ 751,
+ /*0x24d6*/ 693,
+ -1,
+ /*0x10439*/ 999,
+ -1,
+ /*0xa72b*/ 902,
+ /*0x1044e*/ 1020,
+ /*0x118da*/ 1048,
+ -1, -1, -1, -1,
+ /*0x2177*/ 677,
+ /*0x03cc*/ 269,
+ -1,
+ /*0x01bd*/ 136,
+ -1, -1, -1, -1,
+ /*0x03c8*/ 265,
+ /*0x2c36*/ 719,
+ /*0x2d23*/ 856,
+ /*0x1042f*/ 989,
+ -1,
+ /*0x0254*/ 203,
+ /*0x01b9*/ 135,
+ /*0x217f*/ 685,
+ /*0x0454*/ 325,
+ /*0x01ce*/ 141,
+ /*0x03c4*/ 261,
+ /*0x0072*/ 16,
+ -1, -1,
+ /*0x10429*/ 983,
+ /*0x1e89*/ 545,
+ /*0x1e09*/ 481,
+ /*0x118ce*/ 1036,
+ /*0x0109*/ 60,
+ /*0x2c89*/ 772,
+ /*0x0209*/ 169,
+ /*0x0509*/ 417,
+ /*0x03bb*/ 253,
+ -1,
+ /*0x1e8d*/ 547,
+ /*0x1e0d*/ 483,
+ /*0x048d*/ 355,
+ /*0x010d*/ 62,
+ /*0x2c8d*/ 774,
+ /*0x020d*/ 171,
+ /*0x050d*/ 419,
+ /*0x0062*/ 1,
+ /*0x1e1d*/ 491,
+ /*0x049d*/ 363,
+ /*0x011d*/ 70,
+ /*0x2c9d*/ 782,
+ /*0x021d*/ 179,
+ /*0x051d*/ 427,
+ -1,
+ /*0x0458*/ 329,
+ /*0x2c54*/ 749,
+ /*0x24d4*/ 691,
+ /*0x00ea*/ 35,
+ /*0x0252*/ 201,
+ /*0xa689*/ 888,
+ /*0xa79d*/ 949,
+ /*0x0452*/ 323,
+ /*0x025c*/ 208,
+ -1,
+ /*0x04ca*/ 385,
+ /*0x045c*/ 333,
+ -1,
+ /*0x2d05*/ 826,
+ /*0xa68d*/ 890,
+ /*0x00fa*/ 50,
+ /*0x044a*/ 315,
+ /*0x01a1*/ 127,
+ /*0x10446*/ 1012,
+ /*0x017c*/ 115,
+ /*0x0068*/ 7,
+ /*0x0077*/ 21,
+ /*0x057c*/ 464,
+ -1,
+ /*0x01fb*/ 162,
+ -1,
+ /*0x1f7c*/ 660,
+ -1,
+ /*0x0434*/ 293,
+ /*0x2d03*/ 824,
+ /*0x1f34*/ 626,
+ /*0x045e*/ 335,
+ /*0x2c58*/ 753,
+ /*0x24d8*/ 695,
+ -1, -1,
+ /*0x0199*/ 124,
+ /*0x03b6*/ 248,
+ -1,
+ /*0x2c52*/ 747,
+ /*0x24d2*/ 689,
+ /*0x01c6*/ 138,
+ /*0x0260*/ 209,
+ /*0x2c5c*/ 757,
+ /*0x24dc*/ 699,
+ /*0x1044c*/ 1018,
+ /*0x0371*/ 233,
+ /*0x1f60*/ 640,
+ /*0x2c4a*/ 739,
+ /*0x118c6*/ 1028,
+ -1, -1,
+ /*0x10448*/ 1014,
+ -1, -1, -1,
+ /*0x0430*/ 289,
+ /*0xff5a*/ 981,
+ /*0x1f30*/ 622,
+ /*0x0432*/ 291,
+ /*0x2c34*/ 717,
+ /*0x1f32*/ 624,
+ /*0x10444*/ 1010,
+ /*0x2c5e*/ 759,
+ /*0x24de*/ 701,
+ /*0xa77c*/ 937,
+ -1,
+ /*0x01ff*/ 164,
+ /*0x01cc*/ 140,
+ -1, -1, -1, -1, -1,
+ /*0x1043b*/ 1001,
+ -1,
+ /*0x118cc*/ 1034,
+ -1,
+ /*0x24e0*/ 703,
+ -1,
+ /*0x00ec*/ 37,
+ -1, -1,
+ /*0x118c8*/ 1030,
+ -1,
+ /*0x1fe0*/ 666,
+ -1,
+ /*0xff4e*/ 969,
+ /*0x2c30*/ 713,
+ -1, -1,
+ /*0x2c32*/ 715,
+ -1,
+ /*0x118c4*/ 1026,
+ -1, -1,
+ /*0x1fb0*/ 662,
+ -1, -1, -1, -1, -1, -1,
+ /*0x1042b*/ 985,
+ -1, -1, -1, -1, -1,
+ /*0x0289*/ 227,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1,
+ /*0x03ca*/ 267,
+ -1, -1,
+ /*0x2d27*/ 859,
+ -1,
+ /*0x10436*/ 996,
+ -1,
+ /*0x01d6*/ 145,
+ -1, -1, -1, -1,
+ /*0x03b4*/ 246,
+ -1, -1,
+ /*0x118d6*/ 1044,
+ -1, -1,
+ /*0x00f8*/ 48,
+ -1, -1, -1, -1,
+ /*0x217c*/ 682,
+ -1,
+ /*0x2d15*/ 842,
+ /*0x037b*/ 236,
+ -1,
+ /*0x01b6*/ 134,
+ -1, -1, -1, -1, -1, -1,
+ /*0xff46*/ 961,
+ /*0x00e6*/ 31,
+ -1, -1, -1, -1, -1, -1,
+ /*0x03b2*/ 244,
+ -1,
+ /*0x2d13*/ 840,
+ -1, -1, -1, -1, -1,
+ /*0x2d12*/ 839,
+ /*0x00ef*/ 40,
+ -1,
+ /*0x0377*/ 235,
+ -1, -1, -1, -1, -1, -1,
+ -1,
+ /*0xff4c*/ 967,
+ -1, -1, -1,
+ /*0x00ed*/ 38,
+ /*0x01d4*/ 144,
+ -1,
+ /*0xff48*/ 963,
+ -1, -1, -1, -1, -1,
+ /*0x118d4*/ 1042,
+ -1, -1, -1,
+ /*0xff44*/ 959,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1,
+ /*0x1044a*/ 1016,
+ -1, -1, -1, -1, -1, -1,
+ /*0x01d8*/ 146,
+ -1,
+ /*0x00f6*/ 47,
+ -1, -1,
+ /*0x10434*/ 994,
+ -1,
+ /*0x01d2*/ 143,
+ /*0x118d8*/ 1046,
+ -1, -1,
+ /*0x01dc*/ 148,
+ -1,
+ /*0x2d07*/ 828,
+ -1,
+ /*0x118d2*/ 1040,
+ -1, -1, -1,
+ /*0x118dc*/ 1050,
+ -1, -1, -1, -1,
+ /*0x118ca*/ 1032,
+ -1,
+ /*0xff56*/ 977,
+ -1,
+ /*0x01b4*/ 133,
+ -1, -1,
+ /*0x00fd*/ 53,
+ -1,
+ /*0x10430*/ 990,
+ -1, -1,
+ /*0x10432*/ 992,
+ -1, -1,
+ /*0x118de*/ 1052,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1,
+ /*0x01b0*/ 132,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1,
+ /*0xff54*/ 975,
+ -1, -1,
+ /*0x2d21*/ 854,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ /*0x2d19*/ 846,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1,
+ /*0xff58*/ 979,
+ -1, -1, -1, -1, -1, -1,
+ /*0xff52*/ 973,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1,
+ /*0xff4a*/ 965,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1,
+ /*0x037c*/ 237,
+ -1, -1, -1, -1, -1, -1,
+ -1,
+ /*0x00f9*/ 49,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ /*0x00f5*/ 46,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1,
+ /*0x00f1*/ 42,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ /*0x2d17*/ 844,
+ -1, -1, -1, -1, -1, -1,
+ /*0x2d1f*/ 852,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1,
+ /*0x00f2*/ 43,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1,
+ /*0x2d09*/ 830,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1,
+ /*0x2d0d*/ 834,
+ -1,
+ /*0x00e2*/ 27,
+ /*0x00fb*/ 51,
+ -1, -1, -1,
+ /*0x2d1d*/ 850,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1,
+ /*0x00e8*/ 33,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1,
+ /*0x00ff*/ 55,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1,
+ /*0x00fc*/ 52,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1,
+ -1, -1,
+ /*0x00e0*/ 25
+ };
+
+ 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_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 }}},
+/* C code produced by gperf version 3.0.3 */
+/* 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
+#ifdef __GNUC_STDC_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}}},
};
-#define FOLD_TABLE_SIZE 1357
-#define UNFOLD1_TABLE_SIZE 1207
-#define UNFOLD2_TABLE_SIZE 88
-#define UNFOLD3_TABLE_SIZE 23
+/* C code produced by gperf version 3.0.3 */
+/* 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
+#ifdef __GNUC_STDC_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);
+
+ if (key <= MAX_HASH_VALUE && key >= 0)
+ {
+ register short s = wordlist[key];
+
+ if (s >= 0 && code3_equal(codes, CaseUnfold_13_Table[s].from))
+ return &CaseUnfold_13_Table[s].to;
+ }
+ }
+ return 0;
+}
+
diff --git a/enc/unicode/name2ctype.h b/enc/unicode/name2ctype.h
index 2e80edf525..80b79abc3e 100644
--- a/enc/unicode/name2ctype.h
+++ b/enc/unicode/name2ctype.h
@@ -44,7 +44,7 @@ static const OnigCodePoint CR_NEWLINE[] = {
/* 'Alpha': [[:Alpha:]] */
static const OnigCodePoint CR_Alpha[] = {
- 540,
+ 600,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -61,13 +61,14 @@ 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, 0x0527,
+ 0x048a, 0x052f,
0x0531, 0x0556,
0x0559, 0x0559,
0x0561, 0x0587,
@@ -95,17 +96,13 @@ static const OnigCodePoint CR_Alpha[] = {
0x0800, 0x0817,
0x081a, 0x082c,
0x0840, 0x0858,
- 0x08a0, 0x08a0,
- 0x08a2, 0x08ac,
+ 0x08a0, 0x08b2,
0x08e4, 0x08e9,
- 0x08f0, 0x08fe,
- 0x0900, 0x093b,
+ 0x08f0, 0x093b,
0x093d, 0x094c,
0x094e, 0x0950,
0x0955, 0x0963,
- 0x0971, 0x0977,
- 0x0979, 0x097f,
- 0x0981, 0x0983,
+ 0x0971, 0x0983,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -176,19 +173,18 @@ static const OnigCodePoint CR_Alpha[] = {
0x0bca, 0x0bcc,
0x0bd0, 0x0bd0,
0x0bd7, 0x0bd7,
- 0x0c01, 0x0c03,
+ 0x0c00, 0x0c03,
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c33,
- 0x0c35, 0x0c39,
+ 0x0c2a, 0x0c39,
0x0c3d, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4c,
0x0c55, 0x0c56,
0x0c58, 0x0c59,
0x0c60, 0x0c63,
- 0x0c82, 0x0c83,
+ 0x0c81, 0x0c83,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
0x0c92, 0x0ca8,
@@ -201,7 +197,7 @@ static const OnigCodePoint CR_Alpha[] = {
0x0cde, 0x0cde,
0x0ce0, 0x0ce3,
0x0cf1, 0x0cf2,
- 0x0d02, 0x0d03,
+ 0x0d01, 0x0d03,
0x0d05, 0x0d0c,
0x0d0e, 0x0d10,
0x0d12, 0x0d3a,
@@ -283,7 +279,7 @@ static const OnigCodePoint CR_Alpha[] = {
0x166f, 0x167f,
0x1681, 0x169a,
0x16a0, 0x16ea,
- 0x16ee, 0x16f0,
+ 0x16ee, 0x16f8,
0x1700, 0x170c,
0x170e, 0x1713,
0x1720, 0x1733,
@@ -298,7 +294,7 @@ static const OnigCodePoint CR_Alpha[] = {
0x1820, 0x1877,
0x1880, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191c,
+ 0x1900, 0x191e,
0x1920, 0x192b,
0x1930, 0x1938,
0x1950, 0x196d,
@@ -323,6 +319,7 @@ static const OnigCodePoint CR_Alpha[] = {
0x1cee, 0x1cf3,
0x1cf5, 0x1cf6,
0x1d00, 0x1dbf,
+ 0x1de7, 0x1df4,
0x1e00, 0x1f15,
0x1f18, 0x1f1d,
0x1f20, 0x1f45,
@@ -402,14 +399,14 @@ static const OnigCodePoint CR_Alpha[] = {
0xa62a, 0xa62b,
0xa640, 0xa66e,
0xa674, 0xa67b,
- 0xa67f, 0xa697,
+ 0xa67f, 0xa69d,
0xa69f, 0xa6ef,
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa793,
- 0xa7a0, 0xa7aa,
- 0xa7f8, 0xa801,
+ 0xa790, 0xa7ad,
+ 0xa7b0, 0xa7b1,
+ 0xa7f7, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa827,
@@ -423,11 +420,14 @@ 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,
- 0xaa80, 0xaabe,
+ 0xaa7e, 0xaabe,
0xaac0, 0xaac0,
0xaac2, 0xaac2,
0xaadb, 0xaadd,
@@ -438,6 +438,9 @@ static const OnigCodePoint CR_Alpha[] = {
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
+ 0xab30, 0xab5a,
+ 0xab5c, 0xab5f,
+ 0xab64, 0xab65,
0xabc0, 0xabea,
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
@@ -476,19 +479,27 @@ static const OnigCodePoint CR_Alpha[] = {
0x10140, 0x10174,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x10300, 0x1031e,
+ 0x10300, 0x1031f,
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,
@@ -499,25 +510,70 @@ 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,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
+ 0x118a0, 0x118df,
+ 0x118ff, 0x118ff,
+ 0x11ac0, 0x11af8,
+ 0x12000, 0x12398,
+ 0x12400, 0x1246e,
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,
@@ -548,6 +604,7 @@ static const OnigCodePoint CR_Alpha[] = {
0x1d78a, 0x1d7a8,
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
+ 0x1e800, 0x1e8c4,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -581,6 +638,9 @@ static const OnigCodePoint CR_Alpha[] = {
0x1eea1, 0x1eea3,
0x1eea5, 0x1eea9,
0x1eeab, 0x1eebb,
+ 0x1f130, 0x1f149,
+ 0x1f150, 0x1f169,
+ 0x1f170, 0x1f189,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -589,12 +649,11 @@ static const OnigCodePoint CR_Alpha[] = {
/* 'Blank': [[:Blank:]] */
static const OnigCodePoint CR_Blank[] = {
- 9,
+ 8,
0x0009, 0x0009,
0x0020, 0x0020,
0x00a0, 0x00a0,
0x1680, 0x1680,
- 0x180e, 0x180e,
0x2000, 0x200a,
0x202f, 0x202f,
0x205f, 0x205f,
@@ -610,7 +669,7 @@ static const OnigCodePoint CR_Cntrl[] = {
/* 'Digit': [[:Digit:]] */
static const OnigCodePoint CR_Digit[] = {
- 42,
+ 50,
0x0030, 0x0039,
0x0660, 0x0669,
0x06f0, 0x06f9,
@@ -624,6 +683,7 @@ static const OnigCodePoint CR_Digit[] = {
0x0c66, 0x0c6f,
0x0ce6, 0x0cef,
0x0d66, 0x0d6f,
+ 0x0de6, 0x0def,
0x0e50, 0x0e59,
0x0ed0, 0x0ed9,
0x0f20, 0x0f29,
@@ -643,6 +703,7 @@ static const OnigCodePoint CR_Digit[] = {
0xa8d0, 0xa8d9,
0xa900, 0xa909,
0xa9d0, 0xa9d9,
+ 0xa9f0, 0xa9f9,
0xaa50, 0xaa59,
0xabf0, 0xabf9,
0xff10, 0xff19,
@@ -651,30 +712,35 @@ 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[] = {
- 544,
+ 605,
0x0021, 0x007e,
0x00a1, 0x0377,
- 0x037a, 0x037e,
+ 0x037a, 0x037f,
0x0384, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
- 0x03a3, 0x0527,
+ 0x03a3, 0x052f,
0x0531, 0x0556,
0x0559, 0x055f,
0x0561, 0x0587,
0x0589, 0x058a,
- 0x058f, 0x058f,
+ 0x058d, 0x058f,
0x0591, 0x05c7,
0x05d0, 0x05ea,
0x05f0, 0x05f4,
- 0x0600, 0x0604,
- 0x0606, 0x061b,
+ 0x0600, 0x061c,
0x061e, 0x070d,
0x070f, 0x074a,
0x074d, 0x07b1,
@@ -683,12 +749,8 @@ static const OnigCodePoint CR_Graph[] = {
0x0830, 0x083e,
0x0840, 0x085b,
0x085e, 0x085e,
- 0x08a0, 0x08a0,
- 0x08a2, 0x08ac,
- 0x08e4, 0x08fe,
- 0x0900, 0x0977,
- 0x0979, 0x097f,
- 0x0981, 0x0983,
+ 0x08a0, 0x08b2,
+ 0x08e4, 0x0983,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -761,12 +823,11 @@ static const OnigCodePoint CR_Graph[] = {
0x0bd0, 0x0bd0,
0x0bd7, 0x0bd7,
0x0be6, 0x0bfa,
- 0x0c01, 0x0c03,
+ 0x0c00, 0x0c03,
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c33,
- 0x0c35, 0x0c39,
+ 0x0c2a, 0x0c39,
0x0c3d, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4d,
@@ -775,7 +836,7 @@ static const OnigCodePoint CR_Graph[] = {
0x0c60, 0x0c63,
0x0c66, 0x0c6f,
0x0c78, 0x0c7f,
- 0x0c82, 0x0c83,
+ 0x0c81, 0x0c83,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
0x0c92, 0x0ca8,
@@ -789,7 +850,7 @@ static const OnigCodePoint CR_Graph[] = {
0x0ce0, 0x0ce3,
0x0ce6, 0x0cef,
0x0cf1, 0x0cf2,
- 0x0d02, 0x0d03,
+ 0x0d01, 0x0d03,
0x0d05, 0x0d0c,
0x0d0e, 0x0d10,
0x0d12, 0x0d3a,
@@ -810,6 +871,7 @@ static const OnigCodePoint CR_Graph[] = {
0x0dcf, 0x0dd4,
0x0dd6, 0x0dd6,
0x0dd8, 0x0ddf,
+ 0x0de6, 0x0def,
0x0df2, 0x0df4,
0x0e01, 0x0e3a,
0x0e3f, 0x0e5b,
@@ -861,7 +923,7 @@ static const OnigCodePoint CR_Graph[] = {
0x13a0, 0x13f4,
0x1400, 0x167f,
0x1681, 0x169c,
- 0x16a0, 0x16f0,
+ 0x16a0, 0x16f8,
0x1700, 0x170c,
0x170e, 0x1714,
0x1720, 0x1736,
@@ -872,12 +934,12 @@ static const OnigCodePoint CR_Graph[] = {
0x1780, 0x17dd,
0x17e0, 0x17e9,
0x17f0, 0x17f9,
- 0x1800, 0x180d,
+ 0x1800, 0x180e,
0x1810, 0x1819,
0x1820, 0x1877,
0x1880, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191c,
+ 0x1900, 0x191e,
0x1920, 0x192b,
0x1930, 0x193b,
0x1940, 0x1940,
@@ -892,6 +954,7 @@ static const OnigCodePoint CR_Graph[] = {
0x1a7f, 0x1a89,
0x1a90, 0x1a99,
0x1aa0, 0x1aad,
+ 0x1ab0, 0x1abe,
0x1b00, 0x1b4b,
0x1b50, 0x1b7c,
0x1b80, 0x1bf3,
@@ -900,7 +963,8 @@ static const OnigCodePoint CR_Graph[] = {
0x1c4d, 0x1c7f,
0x1cc0, 0x1cc7,
0x1cd0, 0x1cf6,
- 0x1d00, 0x1de6,
+ 0x1cf8, 0x1cf9,
+ 0x1d00, 0x1df5,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
0x1f20, 0x1f45,
@@ -921,18 +985,20 @@ static const OnigCodePoint CR_Graph[] = {
0x202a, 0x202e,
0x2030, 0x205e,
0x2060, 0x2064,
- 0x206a, 0x2071,
+ 0x2066, 0x2071,
0x2074, 0x208e,
0x2090, 0x209c,
- 0x20a0, 0x20b9,
+ 0x20a0, 0x20bd,
0x20d0, 0x20f0,
0x2100, 0x2189,
- 0x2190, 0x23f3,
+ 0x2190, 0x23fa,
0x2400, 0x2426,
0x2440, 0x244a,
- 0x2460, 0x26ff,
- 0x2701, 0x2b4c,
- 0x2b50, 0x2b59,
+ 0x2460, 0x2b73,
+ 0x2b76, 0x2b95,
+ 0x2b98, 0x2bb9,
+ 0x2bbd, 0x2bc8,
+ 0x2bca, 0x2bd1,
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
0x2c60, 0x2cf3,
@@ -950,7 +1016,7 @@ static const OnigCodePoint CR_Graph[] = {
0x2dc8, 0x2dce,
0x2dd0, 0x2dd6,
0x2dd8, 0x2dde,
- 0x2de0, 0x2e3b,
+ 0x2de0, 0x2e42,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
0x2f00, 0x2fd5,
@@ -969,12 +1035,12 @@ static const OnigCodePoint CR_Graph[] = {
0xa000, 0xa48c,
0xa490, 0xa4c6,
0xa4d0, 0xa62b,
- 0xa640, 0xa697,
+ 0xa640, 0xa69d,
0xa69f, 0xa6f7,
0xa700, 0xa78e,
- 0xa790, 0xa793,
- 0xa7a0, 0xa7aa,
- 0xa7f8, 0xa82b,
+ 0xa790, 0xa7ad,
+ 0xa7b0, 0xa7b1,
+ 0xa7f7, 0xa82b,
0xa830, 0xa839,
0xa840, 0xa877,
0xa880, 0xa8c4,
@@ -984,18 +1050,19 @@ static const OnigCodePoint CR_Graph[] = {
0xa95f, 0xa97c,
0xa980, 0xa9cd,
0xa9cf, 0xa9d9,
- 0xa9de, 0xa9df,
+ 0xa9de, 0xa9fe,
0xaa00, 0xaa36,
0xaa40, 0xaa4d,
0xaa50, 0xaa59,
- 0xaa5c, 0xaa7b,
- 0xaa80, 0xaac2,
+ 0xaa5c, 0xaac2,
0xaadb, 0xaaf6,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
+ 0xab30, 0xab5f,
+ 0xab64, 0xab65,
0xabc0, 0xabed,
0xabf0, 0xabf9,
0xac00, 0xd7a3,
@@ -1016,7 +1083,7 @@ static const OnigCodePoint CR_Graph[] = {
0xfd92, 0xfdc7,
0xfdf0, 0xfdfd,
0xfe00, 0xfe19,
- 0xfe20, 0xfe26,
+ 0xfe20, 0xfe2d,
0xfe30, 0xfe52,
0xfe54, 0xfe66,
0xfe68, 0xfe6b,
@@ -1040,26 +1107,35 @@ static const OnigCodePoint CR_Graph[] = {
0x10080, 0x100fa,
0x10100, 0x10102,
0x10107, 0x10133,
- 0x10137, 0x1018a,
+ 0x10137, 0x1018c,
0x10190, 0x1019b,
+ 0x101a0, 0x101a0,
0x101d0, 0x101fd,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x10300, 0x1031e,
- 0x10320, 0x10323,
+ 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, 0x1085f,
+ 0x10857, 0x1089e,
+ 0x108a7, 0x108af,
0x10900, 0x1091b,
0x1091f, 0x10939,
0x1093f, 0x1093f,
@@ -1073,33 +1149,82 @@ static const OnigCodePoint CR_Graph[] = {
0x10a38, 0x10a3a,
0x10a3f, 0x10a47,
0x10a50, 0x10a58,
- 0x10a60, 0x10a7f,
+ 0x10a60, 0x10a9f,
+ 0x10ac0, 0x10ae6,
+ 0x10aeb, 0x10af6,
0x10b00, 0x10b35,
0x10b39, 0x10b55,
0x10b58, 0x10b72,
- 0x10b78, 0x10b7f,
+ 0x10b78, 0x10b91,
+ 0x10b99, 0x10b9c,
+ 0x10ba9, 0x10baf,
0x10c00, 0x10c48,
0x10e60, 0x10e7e,
0x11000, 0x1104d,
0x11052, 0x1106f,
- 0x11080, 0x110c1,
+ 0x1107f, 0x110c1,
0x110d0, 0x110e8,
0x110f0, 0x110f9,
0x11100, 0x11134,
0x11136, 0x11143,
+ 0x11150, 0x11176,
0x11180, 0x111c8,
- 0x111d0, 0x111d9,
+ 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,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
- 0x12470, 0x12473,
+ 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,
@@ -1127,6 +1252,8 @@ static const OnigCodePoint CR_Graph[] = {
0x1d552, 0x1d6a5,
0x1d6a8, 0x1d7cb,
0x1d7ce, 0x1d7ff,
+ 0x1e800, 0x1e8c4,
+ 0x1e8c7, 0x1e8d6,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -1164,10 +1291,10 @@ static const OnigCodePoint CR_Graph[] = {
0x1f000, 0x1f02b,
0x1f030, 0x1f093,
0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0be,
+ 0x1f0b1, 0x1f0bf,
0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0df,
- 0x1f100, 0x1f10a,
+ 0x1f0d1, 0x1f0f5,
+ 0x1f100, 0x1f10c,
0x1f110, 0x1f12e,
0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
@@ -1175,24 +1302,25 @@ static const OnigCodePoint CR_Graph[] = {
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,
+ 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,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -1206,7 +1334,7 @@ static const OnigCodePoint CR_Graph[] = {
/* 'Lower': [[:Lower:]] */
static const OnigCodePoint CR_Lower[] = {
- 618,
+ 633,
0x0061, 0x007a,
0x00aa, 0x00aa,
0x00b5, 0x00b5,
@@ -1477,6 +1605,10 @@ 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,
@@ -1738,6 +1870,8 @@ static const OnigCodePoint CR_Lower[] = {
0xa693, 0xa693,
0xa695, 0xa695,
0xa697, 0xa697,
+ 0xa699, 0xa699,
+ 0xa69b, 0xa69d,
0xa723, 0xa723,
0xa725, 0xa725,
0xa727, 0xa727,
@@ -1786,17 +1920,26 @@ static const OnigCodePoint CR_Lower[] = {
0xa78c, 0xa78c,
0xa78e, 0xa78e,
0xa791, 0xa791,
- 0xa793, 0xa793,
+ 0xa793, 0xa795,
+ 0xa797, 0xa797,
+ 0xa799, 0xa799,
+ 0xa79b, 0xa79b,
+ 0xa79d, 0xa79d,
+ 0xa79f, 0xa79f,
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,
@@ -1829,24 +1972,23 @@ static const OnigCodePoint CR_Lower[] = {
/* 'Print': [[:Print:]] */
static const OnigCodePoint CR_Print[] = {
- 541,
+ 602,
0x0020, 0x007e,
0x00a0, 0x0377,
- 0x037a, 0x037e,
+ 0x037a, 0x037f,
0x0384, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
- 0x03a3, 0x0527,
+ 0x03a3, 0x052f,
0x0531, 0x0556,
0x0559, 0x055f,
0x0561, 0x0587,
0x0589, 0x058a,
- 0x058f, 0x058f,
+ 0x058d, 0x058f,
0x0591, 0x05c7,
0x05d0, 0x05ea,
0x05f0, 0x05f4,
- 0x0600, 0x0604,
- 0x0606, 0x061b,
+ 0x0600, 0x061c,
0x061e, 0x070d,
0x070f, 0x074a,
0x074d, 0x07b1,
@@ -1855,12 +1997,8 @@ static const OnigCodePoint CR_Print[] = {
0x0830, 0x083e,
0x0840, 0x085b,
0x085e, 0x085e,
- 0x08a0, 0x08a0,
- 0x08a2, 0x08ac,
- 0x08e4, 0x08fe,
- 0x0900, 0x0977,
- 0x0979, 0x097f,
- 0x0981, 0x0983,
+ 0x08a0, 0x08b2,
+ 0x08e4, 0x0983,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -1933,12 +2071,11 @@ static const OnigCodePoint CR_Print[] = {
0x0bd0, 0x0bd0,
0x0bd7, 0x0bd7,
0x0be6, 0x0bfa,
- 0x0c01, 0x0c03,
+ 0x0c00, 0x0c03,
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c33,
- 0x0c35, 0x0c39,
+ 0x0c2a, 0x0c39,
0x0c3d, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4d,
@@ -1947,7 +2084,7 @@ static const OnigCodePoint CR_Print[] = {
0x0c60, 0x0c63,
0x0c66, 0x0c6f,
0x0c78, 0x0c7f,
- 0x0c82, 0x0c83,
+ 0x0c81, 0x0c83,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
0x0c92, 0x0ca8,
@@ -1961,7 +2098,7 @@ static const OnigCodePoint CR_Print[] = {
0x0ce0, 0x0ce3,
0x0ce6, 0x0cef,
0x0cf1, 0x0cf2,
- 0x0d02, 0x0d03,
+ 0x0d01, 0x0d03,
0x0d05, 0x0d0c,
0x0d0e, 0x0d10,
0x0d12, 0x0d3a,
@@ -1982,6 +2119,7 @@ static const OnigCodePoint CR_Print[] = {
0x0dcf, 0x0dd4,
0x0dd6, 0x0dd6,
0x0dd8, 0x0ddf,
+ 0x0de6, 0x0def,
0x0df2, 0x0df4,
0x0e01, 0x0e3a,
0x0e3f, 0x0e5b,
@@ -2032,7 +2170,7 @@ static const OnigCodePoint CR_Print[] = {
0x1380, 0x1399,
0x13a0, 0x13f4,
0x1400, 0x169c,
- 0x16a0, 0x16f0,
+ 0x16a0, 0x16f8,
0x1700, 0x170c,
0x170e, 0x1714,
0x1720, 0x1736,
@@ -2048,7 +2186,7 @@ static const OnigCodePoint CR_Print[] = {
0x1820, 0x1877,
0x1880, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191c,
+ 0x1900, 0x191e,
0x1920, 0x192b,
0x1930, 0x193b,
0x1940, 0x1940,
@@ -2063,6 +2201,7 @@ static const OnigCodePoint CR_Print[] = {
0x1a7f, 0x1a89,
0x1a90, 0x1a99,
0x1aa0, 0x1aad,
+ 0x1ab0, 0x1abe,
0x1b00, 0x1b4b,
0x1b50, 0x1b7c,
0x1b80, 0x1bf3,
@@ -2071,7 +2210,8 @@ static const OnigCodePoint CR_Print[] = {
0x1c4d, 0x1c7f,
0x1cc0, 0x1cc7,
0x1cd0, 0x1cf6,
- 0x1d00, 0x1de6,
+ 0x1cf8, 0x1cf9,
+ 0x1d00, 0x1df5,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
0x1f20, 0x1f45,
@@ -2090,18 +2230,20 @@ static const OnigCodePoint CR_Print[] = {
0x1ff6, 0x1ffe,
0x2000, 0x2027,
0x202a, 0x2064,
- 0x206a, 0x2071,
+ 0x2066, 0x2071,
0x2074, 0x208e,
0x2090, 0x209c,
- 0x20a0, 0x20b9,
+ 0x20a0, 0x20bd,
0x20d0, 0x20f0,
0x2100, 0x2189,
- 0x2190, 0x23f3,
+ 0x2190, 0x23fa,
0x2400, 0x2426,
0x2440, 0x244a,
- 0x2460, 0x26ff,
- 0x2701, 0x2b4c,
- 0x2b50, 0x2b59,
+ 0x2460, 0x2b73,
+ 0x2b76, 0x2b95,
+ 0x2b98, 0x2bb9,
+ 0x2bbd, 0x2bc8,
+ 0x2bca, 0x2bd1,
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
0x2c60, 0x2cf3,
@@ -2119,7 +2261,7 @@ static const OnigCodePoint CR_Print[] = {
0x2dc8, 0x2dce,
0x2dd0, 0x2dd6,
0x2dd8, 0x2dde,
- 0x2de0, 0x2e3b,
+ 0x2de0, 0x2e42,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
0x2f00, 0x2fd5,
@@ -2138,12 +2280,12 @@ static const OnigCodePoint CR_Print[] = {
0xa000, 0xa48c,
0xa490, 0xa4c6,
0xa4d0, 0xa62b,
- 0xa640, 0xa697,
+ 0xa640, 0xa69d,
0xa69f, 0xa6f7,
0xa700, 0xa78e,
- 0xa790, 0xa793,
- 0xa7a0, 0xa7aa,
- 0xa7f8, 0xa82b,
+ 0xa790, 0xa7ad,
+ 0xa7b0, 0xa7b1,
+ 0xa7f7, 0xa82b,
0xa830, 0xa839,
0xa840, 0xa877,
0xa880, 0xa8c4,
@@ -2153,18 +2295,19 @@ static const OnigCodePoint CR_Print[] = {
0xa95f, 0xa97c,
0xa980, 0xa9cd,
0xa9cf, 0xa9d9,
- 0xa9de, 0xa9df,
+ 0xa9de, 0xa9fe,
0xaa00, 0xaa36,
0xaa40, 0xaa4d,
0xaa50, 0xaa59,
- 0xaa5c, 0xaa7b,
- 0xaa80, 0xaac2,
+ 0xaa5c, 0xaac2,
0xaadb, 0xaaf6,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
+ 0xab30, 0xab5f,
+ 0xab64, 0xab65,
0xabc0, 0xabed,
0xabf0, 0xabf9,
0xac00, 0xd7a3,
@@ -2185,7 +2328,7 @@ static const OnigCodePoint CR_Print[] = {
0xfd92, 0xfdc7,
0xfdf0, 0xfdfd,
0xfe00, 0xfe19,
- 0xfe20, 0xfe26,
+ 0xfe20, 0xfe2d,
0xfe30, 0xfe52,
0xfe54, 0xfe66,
0xfe68, 0xfe6b,
@@ -2209,26 +2352,35 @@ static const OnigCodePoint CR_Print[] = {
0x10080, 0x100fa,
0x10100, 0x10102,
0x10107, 0x10133,
- 0x10137, 0x1018a,
+ 0x10137, 0x1018c,
0x10190, 0x1019b,
+ 0x101a0, 0x101a0,
0x101d0, 0x101fd,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x10300, 0x1031e,
- 0x10320, 0x10323,
+ 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, 0x1085f,
+ 0x10857, 0x1089e,
+ 0x108a7, 0x108af,
0x10900, 0x1091b,
0x1091f, 0x10939,
0x1093f, 0x1093f,
@@ -2242,33 +2394,82 @@ static const OnigCodePoint CR_Print[] = {
0x10a38, 0x10a3a,
0x10a3f, 0x10a47,
0x10a50, 0x10a58,
- 0x10a60, 0x10a7f,
+ 0x10a60, 0x10a9f,
+ 0x10ac0, 0x10ae6,
+ 0x10aeb, 0x10af6,
0x10b00, 0x10b35,
0x10b39, 0x10b55,
0x10b58, 0x10b72,
- 0x10b78, 0x10b7f,
+ 0x10b78, 0x10b91,
+ 0x10b99, 0x10b9c,
+ 0x10ba9, 0x10baf,
0x10c00, 0x10c48,
0x10e60, 0x10e7e,
0x11000, 0x1104d,
0x11052, 0x1106f,
- 0x11080, 0x110c1,
+ 0x1107f, 0x110c1,
0x110d0, 0x110e8,
0x110f0, 0x110f9,
0x11100, 0x11134,
0x11136, 0x11143,
+ 0x11150, 0x11176,
0x11180, 0x111c8,
- 0x111d0, 0x111d9,
+ 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,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
- 0x12470, 0x12473,
+ 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,
@@ -2296,6 +2497,8 @@ static const OnigCodePoint CR_Print[] = {
0x1d552, 0x1d6a5,
0x1d6a8, 0x1d7cb,
0x1d7ce, 0x1d7ff,
+ 0x1e800, 0x1e8c4,
+ 0x1e8c7, 0x1e8d6,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -2333,10 +2536,10 @@ static const OnigCodePoint CR_Print[] = {
0x1f000, 0x1f02b,
0x1f030, 0x1f093,
0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0be,
+ 0x1f0b1, 0x1f0bf,
0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0df,
- 0x1f100, 0x1f10a,
+ 0x1f0d1, 0x1f0f5,
+ 0x1f100, 0x1f10c,
0x1f110, 0x1f12e,
0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
@@ -2344,24 +2547,25 @@ static const OnigCodePoint CR_Print[] = {
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,
+ 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,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -2375,7 +2579,7 @@ static const OnigCodePoint CR_Print[] = {
/* 'Punct': [[:Punct:]] */
static const OnigCodePoint CR_Punct[] = {
- 140,
+ 155,
0x0021, 0x0023,
0x0025, 0x002a,
0x002c, 0x002f,
@@ -2449,6 +2653,7 @@ static const OnigCodePoint CR_Punct[] = {
0x2053, 0x205e,
0x207d, 0x207e,
0x208d, 0x208e,
+ 0x2308, 0x230b,
0x2329, 0x232a,
0x2768, 0x2775,
0x27c5, 0x27c6,
@@ -2460,7 +2665,7 @@ static const OnigCodePoint CR_Punct[] = {
0x2cfe, 0x2cff,
0x2d70, 0x2d70,
0x2e00, 0x2e2e,
- 0x2e30, 0x2e3b,
+ 0x2e30, 0x2e42,
0x3001, 0x3003,
0x3008, 0x3011,
0x3014, 0x301f,
@@ -2504,29 +2709,42 @@ 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,
- 0x12470, 0x12473,
+ 0x111cd, 0x111cd,
+ 0x11238, 0x1123d,
+ 0x114c6, 0x114c6,
+ 0x115c1, 0x115c9,
+ 0x11641, 0x11643,
+ 0x12470, 0x12474,
+ 0x16a6e, 0x16a6f,
+ 0x16af5, 0x16af5,
+ 0x16b37, 0x16b3b,
+ 0x16b44, 0x16b44,
+ 0x1bc9f, 0x1bc9f,
}; /* CR_Punct */
/* 'Space': [[:Space:]] */
static const OnigCodePoint CR_Space[] = {
- 11,
+ 10,
0x0009, 0x000d,
0x0020, 0x0020,
0x0085, 0x0085,
0x00a0, 0x00a0,
0x1680, 0x1680,
- 0x180e, 0x180e,
0x2000, 0x200a,
0x2028, 0x2029,
0x202f, 0x202f,
@@ -2536,7 +2754,7 @@ static const OnigCodePoint CR_Space[] = {
/* 'Upper': [[:Upper:]] */
static const OnigCodePoint CR_Upper[] = {
- 610,
+ 627,
0x0041, 0x005a,
0x00c0, 0x00d6,
0x00d8, 0x00de,
@@ -2684,6 +2902,7 @@ static const OnigCodePoint CR_Upper[] = {
0x0370, 0x0370,
0x0372, 0x0372,
0x0376, 0x0376,
+ 0x037f, 0x037f,
0x0386, 0x0386,
0x0388, 0x038a,
0x038c, 0x038c,
@@ -2803,6 +3022,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,
@@ -3059,6 +3282,8 @@ static const OnigCodePoint CR_Upper[] = {
0xa692, 0xa692,
0xa694, 0xa694,
0xa696, 0xa696,
+ 0xa698, 0xa698,
+ 0xa69a, 0xa69a,
0xa722, 0xa722,
0xa724, 0xa724,
0xa726, 0xa726,
@@ -3108,14 +3333,21 @@ 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, 0xa7aa,
+ 0xa7aa, 0xa7ad,
+ 0xa7b0, 0xa7b1,
0xff21, 0xff3a,
0x10400, 0x10427,
+ 0x118a0, 0x118bf,
0x1d400, 0x1d419,
0x1d434, 0x1d44d,
0x1d468, 0x1d481,
@@ -3147,6 +3379,9 @@ static const OnigCodePoint CR_Upper[] = {
0x1d756, 0x1d76e,
0x1d790, 0x1d7a8,
0x1d7ca, 0x1d7ca,
+ 0x1f130, 0x1f149,
+ 0x1f150, 0x1f169,
+ 0x1f170, 0x1f189,
}; /* CR_Upper */
/* 'XDigit': [[:XDigit:]] */
@@ -3159,7 +3394,7 @@ static const OnigCodePoint CR_XDigit[] = {
/* 'Word': [[:Word:]] */
static const OnigCodePoint CR_Word[] = {
- 564,
+ 629,
0x0030, 0x0039,
0x0041, 0x005a,
0x005f, 0x005f,
@@ -3177,13 +3412,14 @@ 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, 0x0527,
+ 0x0483, 0x052f,
0x0531, 0x0556,
0x0559, 0x0559,
0x0561, 0x0587,
@@ -3207,14 +3443,10 @@ static const OnigCodePoint CR_Word[] = {
0x07fa, 0x07fa,
0x0800, 0x082d,
0x0840, 0x085b,
- 0x08a0, 0x08a0,
- 0x08a2, 0x08ac,
- 0x08e4, 0x08fe,
- 0x0900, 0x0963,
+ 0x08a0, 0x08b2,
+ 0x08e4, 0x0963,
0x0966, 0x096f,
- 0x0971, 0x0977,
- 0x0979, 0x097f,
- 0x0981, 0x0983,
+ 0x0971, 0x0983,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -3288,12 +3520,11 @@ static const OnigCodePoint CR_Word[] = {
0x0bd0, 0x0bd0,
0x0bd7, 0x0bd7,
0x0be6, 0x0bef,
- 0x0c01, 0x0c03,
+ 0x0c00, 0x0c03,
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c33,
- 0x0c35, 0x0c39,
+ 0x0c2a, 0x0c39,
0x0c3d, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4d,
@@ -3301,7 +3532,7 @@ static const OnigCodePoint CR_Word[] = {
0x0c58, 0x0c59,
0x0c60, 0x0c63,
0x0c66, 0x0c6f,
- 0x0c82, 0x0c83,
+ 0x0c81, 0x0c83,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
0x0c92, 0x0ca8,
@@ -3315,7 +3546,7 @@ static const OnigCodePoint CR_Word[] = {
0x0ce0, 0x0ce3,
0x0ce6, 0x0cef,
0x0cf1, 0x0cf2,
- 0x0d02, 0x0d03,
+ 0x0d01, 0x0d03,
0x0d05, 0x0d0c,
0x0d0e, 0x0d10,
0x0d12, 0x0d3a,
@@ -3336,6 +3567,7 @@ static const OnigCodePoint CR_Word[] = {
0x0dcf, 0x0dd4,
0x0dd6, 0x0dd6,
0x0dd8, 0x0ddf,
+ 0x0de6, 0x0def,
0x0df2, 0x0df3,
0x0e01, 0x0e3a,
0x0e40, 0x0e4e,
@@ -3399,7 +3631,7 @@ static const OnigCodePoint CR_Word[] = {
0x166f, 0x167f,
0x1681, 0x169a,
0x16a0, 0x16ea,
- 0x16ee, 0x16f0,
+ 0x16ee, 0x16f8,
0x1700, 0x170c,
0x170e, 0x1714,
0x1720, 0x1734,
@@ -3416,7 +3648,7 @@ static const OnigCodePoint CR_Word[] = {
0x1820, 0x1877,
0x1880, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191c,
+ 0x1900, 0x191e,
0x1920, 0x192b,
0x1930, 0x193b,
0x1946, 0x196d,
@@ -3430,6 +3662,7 @@ static const OnigCodePoint CR_Word[] = {
0x1a7f, 0x1a89,
0x1a90, 0x1a99,
0x1aa7, 0x1aa7,
+ 0x1ab0, 0x1abe,
0x1b00, 0x1b4b,
0x1b50, 0x1b59,
0x1b6b, 0x1b73,
@@ -3439,7 +3672,8 @@ static const OnigCodePoint CR_Word[] = {
0x1c4d, 0x1c7d,
0x1cd0, 0x1cd2,
0x1cd4, 0x1cf6,
- 0x1d00, 0x1de6,
+ 0x1cf8, 0x1cf9,
+ 0x1d00, 0x1df5,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
0x1f20, 0x1f45,
@@ -3521,14 +3755,14 @@ static const OnigCodePoint CR_Word[] = {
0xa610, 0xa62b,
0xa640, 0xa672,
0xa674, 0xa67d,
- 0xa67f, 0xa697,
+ 0xa67f, 0xa69d,
0xa69f, 0xa6f1,
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa793,
- 0xa7a0, 0xa7aa,
- 0xa7f8, 0xa827,
+ 0xa790, 0xa7ad,
+ 0xa7b0, 0xa7b1,
+ 0xa7f7, 0xa827,
0xa840, 0xa873,
0xa880, 0xa8c4,
0xa8d0, 0xa8d9,
@@ -3539,12 +3773,12 @@ static const OnigCodePoint CR_Word[] = {
0xa960, 0xa97c,
0xa980, 0xa9c0,
0xa9cf, 0xa9d9,
+ 0xa9e0, 0xa9fe,
0xaa00, 0xaa36,
0xaa40, 0xaa4d,
0xaa50, 0xaa59,
0xaa60, 0xaa76,
- 0xaa7a, 0xaa7b,
- 0xaa80, 0xaac2,
+ 0xaa7a, 0xaac2,
0xaadb, 0xaadd,
0xaae0, 0xaaef,
0xaaf2, 0xaaf6,
@@ -3553,6 +3787,9 @@ static const OnigCodePoint CR_Word[] = {
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
+ 0xab30, 0xab5a,
+ 0xab5c, 0xab5f,
+ 0xab64, 0xab65,
0xabc0, 0xabea,
0xabec, 0xabed,
0xabf0, 0xabf9,
@@ -3575,7 +3812,7 @@ static const OnigCodePoint CR_Word[] = {
0xfd92, 0xfdc7,
0xfdf0, 0xfdfb,
0xfe00, 0xfe0f,
- 0xfe20, 0xfe26,
+ 0xfe20, 0xfe2d,
0xfe33, 0xfe34,
0xfe4d, 0xfe4f,
0xfe70, 0xfe74,
@@ -3600,20 +3837,29 @@ static const OnigCodePoint CR_Word[] = {
0x101fd, 0x101fd,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x10300, 0x1031e,
+ 0x102e0, 0x102e0,
+ 0x10300, 0x1031f,
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,
@@ -3626,29 +3872,78 @@ 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,
- 0x11080, 0x110ba,
+ 0x1107f, 0x110ba,
0x110d0, 0x110e8,
0x110f0, 0x110f9,
0x11100, 0x11134,
0x11136, 0x1113f,
+ 0x11150, 0x11173,
+ 0x11176, 0x11176,
0x11180, 0x111c4,
- 0x111d0, 0x111d9,
+ 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,
0x11680, 0x116b7,
0x116c0, 0x116c9,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
+ 0x118a0, 0x118e9,
+ 0x118ff, 0x118ff,
+ 0x11ac0, 0x11af8,
+ 0x12000, 0x12398,
+ 0x12400, 0x1246e,
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,
@@ -3686,6 +3981,8 @@ static const OnigCodePoint CR_Word[] = {
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
0x1d7ce, 0x1d7ff,
+ 0x1e800, 0x1e8c4,
+ 0x1e8d0, 0x1e8d6,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -3719,6 +4016,9 @@ static const OnigCodePoint CR_Word[] = {
0x1eea1, 0x1eea3,
0x1eea5, 0x1eea9,
0x1eeab, 0x1eebb,
+ 0x1f130, 0x1f149,
+ 0x1f150, 0x1f169,
+ 0x1f170, 0x1f189,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -3728,7 +4028,7 @@ static const OnigCodePoint CR_Word[] = {
/* 'Alnum': [[:Alnum:]] */
static const OnigCodePoint CR_Alnum[] = {
- 566,
+ 630,
0x0030, 0x0039,
0x0041, 0x005a,
0x0061, 0x007a,
@@ -3746,13 +4046,14 @@ 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, 0x0527,
+ 0x048a, 0x052f,
0x0531, 0x0556,
0x0559, 0x0559,
0x0561, 0x0587,
@@ -3779,18 +4080,14 @@ static const OnigCodePoint CR_Alnum[] = {
0x0800, 0x0817,
0x081a, 0x082c,
0x0840, 0x0858,
- 0x08a0, 0x08a0,
- 0x08a2, 0x08ac,
+ 0x08a0, 0x08b2,
0x08e4, 0x08e9,
- 0x08f0, 0x08fe,
- 0x0900, 0x093b,
+ 0x08f0, 0x093b,
0x093d, 0x094c,
0x094e, 0x0950,
0x0955, 0x0963,
0x0966, 0x096f,
- 0x0971, 0x0977,
- 0x0979, 0x097f,
- 0x0981, 0x0983,
+ 0x0971, 0x0983,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -3864,12 +4161,11 @@ static const OnigCodePoint CR_Alnum[] = {
0x0bd0, 0x0bd0,
0x0bd7, 0x0bd7,
0x0be6, 0x0bef,
- 0x0c01, 0x0c03,
+ 0x0c00, 0x0c03,
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c33,
- 0x0c35, 0x0c39,
+ 0x0c2a, 0x0c39,
0x0c3d, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4c,
@@ -3877,7 +4173,7 @@ static const OnigCodePoint CR_Alnum[] = {
0x0c58, 0x0c59,
0x0c60, 0x0c63,
0x0c66, 0x0c6f,
- 0x0c82, 0x0c83,
+ 0x0c81, 0x0c83,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
0x0c92, 0x0ca8,
@@ -3891,7 +4187,7 @@ static const OnigCodePoint CR_Alnum[] = {
0x0ce0, 0x0ce3,
0x0ce6, 0x0cef,
0x0cf1, 0x0cf2,
- 0x0d02, 0x0d03,
+ 0x0d01, 0x0d03,
0x0d05, 0x0d0c,
0x0d0e, 0x0d10,
0x0d12, 0x0d3a,
@@ -3912,6 +4208,7 @@ static const OnigCodePoint CR_Alnum[] = {
0x0dcf, 0x0dd4,
0x0dd6, 0x0dd6,
0x0dd8, 0x0ddf,
+ 0x0de6, 0x0def,
0x0df2, 0x0df3,
0x0e01, 0x0e3a,
0x0e40, 0x0e46,
@@ -3978,7 +4275,7 @@ static const OnigCodePoint CR_Alnum[] = {
0x166f, 0x167f,
0x1681, 0x169a,
0x16a0, 0x16ea,
- 0x16ee, 0x16f0,
+ 0x16ee, 0x16f8,
0x1700, 0x170c,
0x170e, 0x1713,
0x1720, 0x1733,
@@ -3995,7 +4292,7 @@ static const OnigCodePoint CR_Alnum[] = {
0x1820, 0x1877,
0x1880, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191c,
+ 0x1900, 0x191e,
0x1920, 0x192b,
0x1930, 0x1938,
0x1946, 0x196d,
@@ -4023,6 +4320,7 @@ static const OnigCodePoint CR_Alnum[] = {
0x1cee, 0x1cf3,
0x1cf5, 0x1cf6,
0x1d00, 0x1dbf,
+ 0x1de7, 0x1df4,
0x1e00, 0x1f15,
0x1f18, 0x1f1d,
0x1f20, 0x1f45,
@@ -4101,14 +4399,14 @@ static const OnigCodePoint CR_Alnum[] = {
0xa610, 0xa62b,
0xa640, 0xa66e,
0xa674, 0xa67b,
- 0xa67f, 0xa697,
+ 0xa67f, 0xa69d,
0xa69f, 0xa6ef,
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa793,
- 0xa7a0, 0xa7aa,
- 0xa7f8, 0xa801,
+ 0xa790, 0xa7ad,
+ 0xa7b0, 0xa7b1,
+ 0xa7f7, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa827,
@@ -4123,12 +4421,14 @@ 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,
- 0xaa80, 0xaabe,
+ 0xaa7e, 0xaabe,
0xaac0, 0xaac0,
0xaac2, 0xaac2,
0xaadb, 0xaadd,
@@ -4139,6 +4439,9 @@ static const OnigCodePoint CR_Alnum[] = {
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
+ 0xab30, 0xab5a,
+ 0xab5c, 0xab5f,
+ 0xab64, 0xab65,
0xabc0, 0xabea,
0xabf0, 0xabf9,
0xac00, 0xd7a3,
@@ -4179,20 +4482,28 @@ static const OnigCodePoint CR_Alnum[] = {
0x10140, 0x10174,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x10300, 0x1031e,
+ 0x10300, 0x1031f,
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,
@@ -4203,9 +4514,13 @@ 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,
@@ -4214,19 +4529,64 @@ static const OnigCodePoint CR_Alnum[] = {
0x110f0, 0x110f9,
0x11100, 0x11132,
0x11136, 0x1113f,
+ 0x11150, 0x11172,
+ 0x11176, 0x11176,
0x11180, 0x111bf,
0x111c1, 0x111c4,
- 0x111d0, 0x111d9,
+ 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,
0x11680, 0x116b5,
0x116c0, 0x116c9,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
+ 0x118a0, 0x118e9,
+ 0x118ff, 0x118ff,
+ 0x11ac0, 0x11af8,
+ 0x12000, 0x12398,
+ 0x12400, 0x1246e,
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,
@@ -4258,6 +4618,7 @@ static const OnigCodePoint CR_Alnum[] = {
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
0x1d7ce, 0x1d7ff,
+ 0x1e800, 0x1e8c4,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -4291,6 +4652,9 @@ static const OnigCodePoint CR_Alnum[] = {
0x1eea1, 0x1eea3,
0x1eea5, 0x1eea9,
0x1eeab, 0x1eebb,
+ 0x1f130, 0x1f149,
+ 0x1f150, 0x1f169,
+ 0x1f170, 0x1f189,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -4312,23 +4676,22 @@ static const OnigCodePoint CR_Any[] = {
/* 'Assigned': - */
static const OnigCodePoint CR_Assigned[] = {
- 539,
+ 600,
0x0000, 0x0377,
- 0x037a, 0x037e,
+ 0x037a, 0x037f,
0x0384, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
- 0x03a3, 0x0527,
+ 0x03a3, 0x052f,
0x0531, 0x0556,
0x0559, 0x055f,
0x0561, 0x0587,
0x0589, 0x058a,
- 0x058f, 0x058f,
+ 0x058d, 0x058f,
0x0591, 0x05c7,
0x05d0, 0x05ea,
0x05f0, 0x05f4,
- 0x0600, 0x0604,
- 0x0606, 0x061b,
+ 0x0600, 0x061c,
0x061e, 0x070d,
0x070f, 0x074a,
0x074d, 0x07b1,
@@ -4337,12 +4700,8 @@ static const OnigCodePoint CR_Assigned[] = {
0x0830, 0x083e,
0x0840, 0x085b,
0x085e, 0x085e,
- 0x08a0, 0x08a0,
- 0x08a2, 0x08ac,
- 0x08e4, 0x08fe,
- 0x0900, 0x0977,
- 0x0979, 0x097f,
- 0x0981, 0x0983,
+ 0x08a0, 0x08b2,
+ 0x08e4, 0x0983,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -4415,12 +4774,11 @@ static const OnigCodePoint CR_Assigned[] = {
0x0bd0, 0x0bd0,
0x0bd7, 0x0bd7,
0x0be6, 0x0bfa,
- 0x0c01, 0x0c03,
+ 0x0c00, 0x0c03,
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c33,
- 0x0c35, 0x0c39,
+ 0x0c2a, 0x0c39,
0x0c3d, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4d,
@@ -4429,7 +4787,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x0c60, 0x0c63,
0x0c66, 0x0c6f,
0x0c78, 0x0c7f,
- 0x0c82, 0x0c83,
+ 0x0c81, 0x0c83,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
0x0c92, 0x0ca8,
@@ -4443,7 +4801,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x0ce0, 0x0ce3,
0x0ce6, 0x0cef,
0x0cf1, 0x0cf2,
- 0x0d02, 0x0d03,
+ 0x0d01, 0x0d03,
0x0d05, 0x0d0c,
0x0d0e, 0x0d10,
0x0d12, 0x0d3a,
@@ -4464,6 +4822,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x0dcf, 0x0dd4,
0x0dd6, 0x0dd6,
0x0dd8, 0x0ddf,
+ 0x0de6, 0x0def,
0x0df2, 0x0df4,
0x0e01, 0x0e3a,
0x0e3f, 0x0e5b,
@@ -4514,7 +4873,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x1380, 0x1399,
0x13a0, 0x13f4,
0x1400, 0x169c,
- 0x16a0, 0x16f0,
+ 0x16a0, 0x16f8,
0x1700, 0x170c,
0x170e, 0x1714,
0x1720, 0x1736,
@@ -4530,7 +4889,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x1820, 0x1877,
0x1880, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191c,
+ 0x1900, 0x191e,
0x1920, 0x192b,
0x1930, 0x193b,
0x1940, 0x1940,
@@ -4545,6 +4904,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x1a7f, 0x1a89,
0x1a90, 0x1a99,
0x1aa0, 0x1aad,
+ 0x1ab0, 0x1abe,
0x1b00, 0x1b4b,
0x1b50, 0x1b7c,
0x1b80, 0x1bf3,
@@ -4553,7 +4913,8 @@ static const OnigCodePoint CR_Assigned[] = {
0x1c4d, 0x1c7f,
0x1cc0, 0x1cc7,
0x1cd0, 0x1cf6,
- 0x1d00, 0x1de6,
+ 0x1cf8, 0x1cf9,
+ 0x1d00, 0x1df5,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
0x1f20, 0x1f45,
@@ -4571,18 +4932,20 @@ static const OnigCodePoint CR_Assigned[] = {
0x1ff2, 0x1ff4,
0x1ff6, 0x1ffe,
0x2000, 0x2064,
- 0x206a, 0x2071,
+ 0x2066, 0x2071,
0x2074, 0x208e,
0x2090, 0x209c,
- 0x20a0, 0x20b9,
+ 0x20a0, 0x20bd,
0x20d0, 0x20f0,
0x2100, 0x2189,
- 0x2190, 0x23f3,
+ 0x2190, 0x23fa,
0x2400, 0x2426,
0x2440, 0x244a,
- 0x2460, 0x26ff,
- 0x2701, 0x2b4c,
- 0x2b50, 0x2b59,
+ 0x2460, 0x2b73,
+ 0x2b76, 0x2b95,
+ 0x2b98, 0x2bb9,
+ 0x2bbd, 0x2bc8,
+ 0x2bca, 0x2bd1,
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
0x2c60, 0x2cf3,
@@ -4600,7 +4963,7 @@ static const OnigCodePoint CR_Assigned[] = {
0x2dc8, 0x2dce,
0x2dd0, 0x2dd6,
0x2dd8, 0x2dde,
- 0x2de0, 0x2e3b,
+ 0x2de0, 0x2e42,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
0x2f00, 0x2fd5,
@@ -4619,12 +4982,12 @@ static const OnigCodePoint CR_Assigned[] = {
0xa000, 0xa48c,
0xa490, 0xa4c6,
0xa4d0, 0xa62b,
- 0xa640, 0xa697,
+ 0xa640, 0xa69d,
0xa69f, 0xa6f7,
0xa700, 0xa78e,
- 0xa790, 0xa793,
- 0xa7a0, 0xa7aa,
- 0xa7f8, 0xa82b,
+ 0xa790, 0xa7ad,
+ 0xa7b0, 0xa7b1,
+ 0xa7f7, 0xa82b,
0xa830, 0xa839,
0xa840, 0xa877,
0xa880, 0xa8c4,
@@ -4634,18 +4997,19 @@ static const OnigCodePoint CR_Assigned[] = {
0xa95f, 0xa97c,
0xa980, 0xa9cd,
0xa9cf, 0xa9d9,
- 0xa9de, 0xa9df,
+ 0xa9de, 0xa9fe,
0xaa00, 0xaa36,
0xaa40, 0xaa4d,
0xaa50, 0xaa59,
- 0xaa5c, 0xaa7b,
- 0xaa80, 0xaac2,
+ 0xaa5c, 0xaac2,
0xaadb, 0xaaf6,
0xab01, 0xab06,
0xab09, 0xab0e,
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
+ 0xab30, 0xab5f,
+ 0xab64, 0xab65,
0xabc0, 0xabed,
0xabf0, 0xabf9,
0xac00, 0xd7a3,
@@ -4666,7 +5030,7 @@ static const OnigCodePoint CR_Assigned[] = {
0xfd92, 0xfdc7,
0xfdf0, 0xfdfd,
0xfe00, 0xfe19,
- 0xfe20, 0xfe26,
+ 0xfe20, 0xfe2d,
0xfe30, 0xfe52,
0xfe54, 0xfe66,
0xfe68, 0xfe6b,
@@ -4690,26 +5054,35 @@ static const OnigCodePoint CR_Assigned[] = {
0x10080, 0x100fa,
0x10100, 0x10102,
0x10107, 0x10133,
- 0x10137, 0x1018a,
+ 0x10137, 0x1018c,
0x10190, 0x1019b,
+ 0x101a0, 0x101a0,
0x101d0, 0x101fd,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x10300, 0x1031e,
- 0x10320, 0x10323,
+ 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, 0x1085f,
+ 0x10857, 0x1089e,
+ 0x108a7, 0x108af,
0x10900, 0x1091b,
0x1091f, 0x10939,
0x1093f, 0x1093f,
@@ -4723,33 +5096,82 @@ static const OnigCodePoint CR_Assigned[] = {
0x10a38, 0x10a3a,
0x10a3f, 0x10a47,
0x10a50, 0x10a58,
- 0x10a60, 0x10a7f,
+ 0x10a60, 0x10a9f,
+ 0x10ac0, 0x10ae6,
+ 0x10aeb, 0x10af6,
0x10b00, 0x10b35,
0x10b39, 0x10b55,
0x10b58, 0x10b72,
- 0x10b78, 0x10b7f,
+ 0x10b78, 0x10b91,
+ 0x10b99, 0x10b9c,
+ 0x10ba9, 0x10baf,
0x10c00, 0x10c48,
0x10e60, 0x10e7e,
0x11000, 0x1104d,
0x11052, 0x1106f,
- 0x11080, 0x110c1,
+ 0x1107f, 0x110c1,
0x110d0, 0x110e8,
0x110f0, 0x110f9,
0x11100, 0x11134,
0x11136, 0x11143,
+ 0x11150, 0x11176,
0x11180, 0x111c8,
- 0x111d0, 0x111d9,
+ 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,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
- 0x12470, 0x12473,
+ 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,
@@ -4777,6 +5199,8 @@ static const OnigCodePoint CR_Assigned[] = {
0x1d552, 0x1d6a5,
0x1d6a8, 0x1d7cb,
0x1d7ce, 0x1d7ff,
+ 0x1e800, 0x1e8c4,
+ 0x1e8c7, 0x1e8d6,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -4814,10 +5238,10 @@ static const OnigCodePoint CR_Assigned[] = {
0x1f000, 0x1f02b,
0x1f030, 0x1f093,
0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0be,
+ 0x1f0b1, 0x1f0bf,
0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0df,
- 0x1f100, 0x1f10a,
+ 0x1f0d1, 0x1f0f5,
+ 0x1f100, 0x1f10c,
0x1f110, 0x1f12e,
0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
@@ -4825,24 +5249,25 @@ static const OnigCodePoint CR_Assigned[] = {
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,
+ 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,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -4856,20 +5281,20 @@ static const OnigCodePoint CR_Assigned[] = {
/* 'C': Major Category */
static const OnigCodePoint CR_C[] = {
- 541,
+ 603,
0x0000, 0x001f,
0x007f, 0x009f,
0x00ad, 0x00ad,
0x0378, 0x0379,
- 0x037f, 0x0383,
+ 0x0380, 0x0383,
0x038b, 0x038b,
0x038d, 0x038d,
0x03a2, 0x03a2,
- 0x0528, 0x0530,
+ 0x0530, 0x0530,
0x0557, 0x0558,
0x0560, 0x0560,
0x0588, 0x0588,
- 0x058b, 0x058e,
+ 0x058b, 0x058c,
0x0590, 0x0590,
0x05c8, 0x05cf,
0x05eb, 0x05ef,
@@ -4884,11 +5309,7 @@ static const OnigCodePoint CR_C[] = {
0x083f, 0x083f,
0x085c, 0x085d,
0x085f, 0x089f,
- 0x08a1, 0x08a1,
- 0x08ad, 0x08e3,
- 0x08ff, 0x08ff,
- 0x0978, 0x0978,
- 0x0980, 0x0980,
+ 0x08b3, 0x08e3,
0x0984, 0x0984,
0x098d, 0x098e,
0x0991, 0x0992,
@@ -4961,12 +5382,11 @@ static const OnigCodePoint CR_C[] = {
0x0bce, 0x0bcf,
0x0bd1, 0x0bd6,
0x0bd8, 0x0be5,
- 0x0bfb, 0x0c00,
+ 0x0bfb, 0x0bff,
0x0c04, 0x0c04,
0x0c0d, 0x0c0d,
0x0c11, 0x0c11,
0x0c29, 0x0c29,
- 0x0c34, 0x0c34,
0x0c3a, 0x0c3c,
0x0c45, 0x0c45,
0x0c49, 0x0c49,
@@ -4975,7 +5395,7 @@ static const OnigCodePoint CR_C[] = {
0x0c5a, 0x0c5f,
0x0c64, 0x0c65,
0x0c70, 0x0c77,
- 0x0c80, 0x0c81,
+ 0x0c80, 0x0c80,
0x0c84, 0x0c84,
0x0c8d, 0x0c8d,
0x0c91, 0x0c91,
@@ -4989,7 +5409,7 @@ static const OnigCodePoint CR_C[] = {
0x0cdf, 0x0cdf,
0x0ce4, 0x0ce5,
0x0cf0, 0x0cf0,
- 0x0cf3, 0x0d01,
+ 0x0cf3, 0x0d00,
0x0d04, 0x0d04,
0x0d0d, 0x0d0d,
0x0d11, 0x0d11,
@@ -5010,7 +5430,8 @@ static const OnigCodePoint CR_C[] = {
0x0dcb, 0x0dce,
0x0dd5, 0x0dd5,
0x0dd7, 0x0dd7,
- 0x0de0, 0x0df1,
+ 0x0de0, 0x0de5,
+ 0x0df0, 0x0df1,
0x0df5, 0x0e00,
0x0e3b, 0x0e3e,
0x0e5c, 0x0e80,
@@ -5061,7 +5482,7 @@ static const OnigCodePoint CR_C[] = {
0x139a, 0x139f,
0x13f5, 0x13ff,
0x169d, 0x169f,
- 0x16f1, 0x16ff,
+ 0x16f9, 0x16ff,
0x170d, 0x170d,
0x1715, 0x171f,
0x1737, 0x173f,
@@ -5072,12 +5493,12 @@ static const OnigCodePoint CR_C[] = {
0x17de, 0x17df,
0x17ea, 0x17ef,
0x17fa, 0x17ff,
- 0x180f, 0x180f,
+ 0x180e, 0x180f,
0x181a, 0x181f,
0x1878, 0x187f,
0x18ab, 0x18af,
0x18f6, 0x18ff,
- 0x191d, 0x191f,
+ 0x191f, 0x191f,
0x192c, 0x192f,
0x193c, 0x193f,
0x1941, 0x1943,
@@ -5091,7 +5512,8 @@ static const OnigCodePoint CR_C[] = {
0x1a7d, 0x1a7e,
0x1a8a, 0x1a8f,
0x1a9a, 0x1a9f,
- 0x1aae, 0x1aff,
+ 0x1aae, 0x1aaf,
+ 0x1abf, 0x1aff,
0x1b4c, 0x1b4f,
0x1b7d, 0x1b7f,
0x1bf4, 0x1bfb,
@@ -5099,8 +5521,9 @@ static const OnigCodePoint CR_C[] = {
0x1c4a, 0x1c4c,
0x1c80, 0x1cbf,
0x1cc8, 0x1ccf,
- 0x1cf7, 0x1cff,
- 0x1de7, 0x1dfb,
+ 0x1cf7, 0x1cf7,
+ 0x1cfa, 0x1cff,
+ 0x1df6, 0x1dfb,
0x1f16, 0x1f17,
0x1f1e, 0x1f1f,
0x1f46, 0x1f47,
@@ -5123,15 +5546,17 @@ static const OnigCodePoint CR_C[] = {
0x2072, 0x2073,
0x208f, 0x208f,
0x209d, 0x209f,
- 0x20ba, 0x20cf,
+ 0x20be, 0x20cf,
0x20f1, 0x20ff,
0x218a, 0x218f,
- 0x23f4, 0x23ff,
+ 0x23fb, 0x23ff,
0x2427, 0x243f,
0x244b, 0x245f,
- 0x2700, 0x2700,
- 0x2b4d, 0x2b4f,
- 0x2b5a, 0x2bff,
+ 0x2b74, 0x2b75,
+ 0x2b96, 0x2b97,
+ 0x2bba, 0x2bbc,
+ 0x2bc9, 0x2bc9,
+ 0x2bd2, 0x2bff,
0x2c2f, 0x2c2f,
0x2c5f, 0x2c5f,
0x2cf4, 0x2cf8,
@@ -5149,7 +5574,7 @@ static const OnigCodePoint CR_C[] = {
0x2dcf, 0x2dcf,
0x2dd7, 0x2dd7,
0x2ddf, 0x2ddf,
- 0x2e3c, 0x2e7f,
+ 0x2e43, 0x2e7f,
0x2e9a, 0x2e9a,
0x2ef4, 0x2eff,
0x2fd6, 0x2fef,
@@ -5168,11 +5593,11 @@ static const OnigCodePoint CR_C[] = {
0xa48d, 0xa48f,
0xa4c7, 0xa4cf,
0xa62c, 0xa63f,
- 0xa698, 0xa69e,
+ 0xa69e, 0xa69e,
0xa6f8, 0xa6ff,
0xa78f, 0xa78f,
- 0xa794, 0xa79f,
- 0xa7ab, 0xa7f7,
+ 0xa7ae, 0xa7af,
+ 0xa7b2, 0xa7f6,
0xa82c, 0xa82f,
0xa83a, 0xa83f,
0xa878, 0xa87f,
@@ -5183,18 +5608,19 @@ static const OnigCodePoint CR_C[] = {
0xa97d, 0xa97f,
0xa9ce, 0xa9ce,
0xa9da, 0xa9dd,
- 0xa9e0, 0xa9ff,
+ 0xa9ff, 0xa9ff,
0xaa37, 0xaa3f,
0xaa4e, 0xaa4f,
0xaa5a, 0xaa5b,
- 0xaa7c, 0xaa7f,
0xaac3, 0xaada,
0xaaf7, 0xab00,
0xab07, 0xab08,
0xab0f, 0xab10,
0xab17, 0xab1f,
0xab27, 0xab27,
- 0xab2f, 0xabbf,
+ 0xab2f, 0xab2f,
+ 0xab60, 0xab63,
+ 0xab66, 0xabbf,
0xabee, 0xabef,
0xabfa, 0xabff,
0xd7a4, 0xd7af,
@@ -5215,7 +5641,7 @@ static const OnigCodePoint CR_C[] = {
0xfdc8, 0xfdef,
0xfdfe, 0xfdff,
0xfe1a, 0xfe1f,
- 0xfe27, 0xfe2f,
+ 0xfe2e, 0xfe2f,
0xfe53, 0xfe53,
0xfe67, 0xfe67,
0xfe6c, 0xfe6f,
@@ -5238,26 +5664,35 @@ static const OnigCodePoint CR_C[] = {
0x100fb, 0x100ff,
0x10103, 0x10106,
0x10134, 0x10136,
- 0x1018b, 0x1018f,
- 0x1019c, 0x101cf,
+ 0x1018d, 0x1018f,
+ 0x1019c, 0x1019f,
+ 0x101a1, 0x101cf,
0x101fe, 0x1027f,
0x1029d, 0x1029f,
- 0x102d1, 0x102ff,
- 0x1031f, 0x1031f,
+ 0x102d1, 0x102df,
+ 0x102fc, 0x102ff,
0x10324, 0x1032f,
- 0x1034b, 0x1037f,
+ 0x1034b, 0x1034f,
+ 0x1037b, 0x1037f,
0x1039e, 0x1039e,
0x103c4, 0x103c7,
0x103d6, 0x103ff,
0x1049e, 0x1049f,
- 0x104aa, 0x107ff,
+ 0x104aa, 0x104ff,
+ 0x10528, 0x1052f,
+ 0x10564, 0x1056e,
+ 0x10570, 0x105ff,
+ 0x10737, 0x1073f,
+ 0x10756, 0x1075f,
+ 0x10768, 0x107ff,
0x10806, 0x10807,
0x10809, 0x10809,
0x10836, 0x10836,
0x10839, 0x1083b,
0x1083d, 0x1083e,
0x10856, 0x10856,
- 0x10860, 0x108ff,
+ 0x1089f, 0x108a6,
+ 0x108b0, 0x108ff,
0x1091c, 0x1091e,
0x1093a, 0x1093e,
0x10940, 0x1097f,
@@ -5271,34 +5706,83 @@ static const OnigCodePoint CR_C[] = {
0x10a3b, 0x10a3e,
0x10a48, 0x10a4f,
0x10a59, 0x10a5f,
- 0x10a80, 0x10aff,
+ 0x10aa0, 0x10abf,
+ 0x10ae7, 0x10aea,
+ 0x10af7, 0x10aff,
0x10b36, 0x10b38,
0x10b56, 0x10b57,
0x10b73, 0x10b77,
- 0x10b80, 0x10bff,
+ 0x10b92, 0x10b98,
+ 0x10b9d, 0x10ba8,
+ 0x10bb0, 0x10bff,
0x10c49, 0x10e5f,
0x10e7f, 0x10fff,
0x1104e, 0x11051,
- 0x11070, 0x1107f,
+ 0x11070, 0x1107e,
0x110bd, 0x110bd,
0x110c2, 0x110cf,
0x110e9, 0x110ef,
0x110fa, 0x110ff,
0x11135, 0x11135,
- 0x11144, 0x1117f,
- 0x111c9, 0x111cf,
- 0x111da, 0x1167f,
+ 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,
0x116b8, 0x116bf,
- 0x116ca, 0x11fff,
- 0x1236f, 0x123ff,
- 0x12463, 0x1246f,
- 0x12474, 0x12fff,
+ 0x116ca, 0x1189f,
+ 0x118f3, 0x118fe,
+ 0x11900, 0x11abf,
+ 0x11af9, 0x11fff,
+ 0x12399, 0x123ff,
+ 0x1246f, 0x1246f,
+ 0x12475, 0x12fff,
0x1342f, 0x167ff,
- 0x16a39, 0x16eff,
+ 0x16a39, 0x16a3f,
+ 0x16a5f, 0x16a5f,
+ 0x16a6a, 0x16a6d,
+ 0x16a70, 0x16acf,
+ 0x16aee, 0x16aef,
+ 0x16af6, 0x16aff,
+ 0x16b46, 0x16b4f,
+ 0x16b5a, 0x16b5a,
+ 0x16b62, 0x16b62,
+ 0x16b78, 0x16b7c,
+ 0x16b90, 0x16eff,
0x16f45, 0x16f4f,
0x16f7f, 0x16f8e,
0x16fa0, 0x1afff,
- 0x1b002, 0x1cfff,
+ 0x1b002, 0x1bbff,
+ 0x1bc6b, 0x1bc6f,
+ 0x1bc7d, 0x1bc7f,
+ 0x1bc89, 0x1bc8f,
+ 0x1bc9a, 0x1bc9b,
+ 0x1bca0, 0x1cfff,
0x1d0f6, 0x1d0ff,
0x1d127, 0x1d128,
0x1d173, 0x1d17a,
@@ -5326,7 +5810,9 @@ static const OnigCodePoint CR_C[] = {
0x1d551, 0x1d551,
0x1d6a6, 0x1d6a7,
0x1d7cc, 0x1d7cd,
- 0x1d800, 0x1edff,
+ 0x1d800, 0x1e7ff,
+ 0x1e8c5, 0x1e8c6,
+ 0x1e8d7, 0x1edff,
0x1ee04, 0x1ee04,
0x1ee20, 0x1ee20,
0x1ee23, 0x1ee23,
@@ -5364,10 +5850,10 @@ static const OnigCodePoint CR_C[] = {
0x1f02c, 0x1f02f,
0x1f094, 0x1f09f,
0x1f0af, 0x1f0b0,
- 0x1f0bf, 0x1f0c0,
+ 0x1f0c0, 0x1f0c0,
0x1f0d0, 0x1f0d0,
- 0x1f0e0, 0x1f0ff,
- 0x1f10b, 0x1f10f,
+ 0x1f0f6, 0x1f0ff,
+ 0x1f10d, 0x1f10f,
0x1f12f, 0x1f12f,
0x1f16c, 0x1f16f,
0x1f19b, 0x1f1e5,
@@ -5375,24 +5861,25 @@ static const OnigCodePoint CR_C[] = {
0x1f23b, 0x1f23f,
0x1f249, 0x1f24f,
0x1f252, 0x1f2ff,
- 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,
+ 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,
0x2a6d7, 0x2a6ff,
0x2b735, 0x2b73f,
0x2b81e, 0x2f7ff,
@@ -5405,18 +5892,21 @@ static const OnigCodePoint CR_C[] = {
/* 'Cf': General Category */
static const OnigCodePoint CR_Cf[] = {
- 14,
+ 17,
0x00ad, 0x00ad,
- 0x0600, 0x0604,
+ 0x0600, 0x0605,
+ 0x061c, 0x061c,
0x06dd, 0x06dd,
0x070f, 0x070f,
+ 0x180e, 0x180e,
0x200b, 0x200f,
0x202a, 0x202e,
0x2060, 0x2064,
- 0x206a, 0x206f,
+ 0x2066, 0x206f,
0xfeff, 0xfeff,
0xfff9, 0xfffb,
0x110bd, 0x110bd,
+ 0x1bca0, 0x1bca3,
0x1d173, 0x1d17a,
0xe0001, 0xe0001,
0xe0020, 0xe007f,
@@ -5424,23 +5914,22 @@ static const OnigCodePoint CR_Cf[] = {
/* 'Cn': General Category */
static const OnigCodePoint CR_Cn[] = {
- 539,
+ 600,
0x0378, 0x0379,
- 0x037f, 0x0383,
+ 0x0380, 0x0383,
0x038b, 0x038b,
0x038d, 0x038d,
0x03a2, 0x03a2,
- 0x0528, 0x0530,
+ 0x0530, 0x0530,
0x0557, 0x0558,
0x0560, 0x0560,
0x0588, 0x0588,
- 0x058b, 0x058e,
+ 0x058b, 0x058c,
0x0590, 0x0590,
0x05c8, 0x05cf,
0x05eb, 0x05ef,
0x05f5, 0x05ff,
- 0x0605, 0x0605,
- 0x061c, 0x061d,
+ 0x061d, 0x061d,
0x070e, 0x070e,
0x074b, 0x074c,
0x07b2, 0x07bf,
@@ -5449,11 +5938,7 @@ static const OnigCodePoint CR_Cn[] = {
0x083f, 0x083f,
0x085c, 0x085d,
0x085f, 0x089f,
- 0x08a1, 0x08a1,
- 0x08ad, 0x08e3,
- 0x08ff, 0x08ff,
- 0x0978, 0x0978,
- 0x0980, 0x0980,
+ 0x08b3, 0x08e3,
0x0984, 0x0984,
0x098d, 0x098e,
0x0991, 0x0992,
@@ -5526,12 +6011,11 @@ static const OnigCodePoint CR_Cn[] = {
0x0bce, 0x0bcf,
0x0bd1, 0x0bd6,
0x0bd8, 0x0be5,
- 0x0bfb, 0x0c00,
+ 0x0bfb, 0x0bff,
0x0c04, 0x0c04,
0x0c0d, 0x0c0d,
0x0c11, 0x0c11,
0x0c29, 0x0c29,
- 0x0c34, 0x0c34,
0x0c3a, 0x0c3c,
0x0c45, 0x0c45,
0x0c49, 0x0c49,
@@ -5540,7 +6024,7 @@ static const OnigCodePoint CR_Cn[] = {
0x0c5a, 0x0c5f,
0x0c64, 0x0c65,
0x0c70, 0x0c77,
- 0x0c80, 0x0c81,
+ 0x0c80, 0x0c80,
0x0c84, 0x0c84,
0x0c8d, 0x0c8d,
0x0c91, 0x0c91,
@@ -5554,7 +6038,7 @@ static const OnigCodePoint CR_Cn[] = {
0x0cdf, 0x0cdf,
0x0ce4, 0x0ce5,
0x0cf0, 0x0cf0,
- 0x0cf3, 0x0d01,
+ 0x0cf3, 0x0d00,
0x0d04, 0x0d04,
0x0d0d, 0x0d0d,
0x0d11, 0x0d11,
@@ -5575,7 +6059,8 @@ static const OnigCodePoint CR_Cn[] = {
0x0dcb, 0x0dce,
0x0dd5, 0x0dd5,
0x0dd7, 0x0dd7,
- 0x0de0, 0x0df1,
+ 0x0de0, 0x0de5,
+ 0x0df0, 0x0df1,
0x0df5, 0x0e00,
0x0e3b, 0x0e3e,
0x0e5c, 0x0e80,
@@ -5626,7 +6111,7 @@ static const OnigCodePoint CR_Cn[] = {
0x139a, 0x139f,
0x13f5, 0x13ff,
0x169d, 0x169f,
- 0x16f1, 0x16ff,
+ 0x16f9, 0x16ff,
0x170d, 0x170d,
0x1715, 0x171f,
0x1737, 0x173f,
@@ -5642,7 +6127,7 @@ static const OnigCodePoint CR_Cn[] = {
0x1878, 0x187f,
0x18ab, 0x18af,
0x18f6, 0x18ff,
- 0x191d, 0x191f,
+ 0x191f, 0x191f,
0x192c, 0x192f,
0x193c, 0x193f,
0x1941, 0x1943,
@@ -5656,7 +6141,8 @@ static const OnigCodePoint CR_Cn[] = {
0x1a7d, 0x1a7e,
0x1a8a, 0x1a8f,
0x1a9a, 0x1a9f,
- 0x1aae, 0x1aff,
+ 0x1aae, 0x1aaf,
+ 0x1abf, 0x1aff,
0x1b4c, 0x1b4f,
0x1b7d, 0x1b7f,
0x1bf4, 0x1bfb,
@@ -5664,8 +6150,9 @@ static const OnigCodePoint CR_Cn[] = {
0x1c4a, 0x1c4c,
0x1c80, 0x1cbf,
0x1cc8, 0x1ccf,
- 0x1cf7, 0x1cff,
- 0x1de7, 0x1dfb,
+ 0x1cf7, 0x1cf7,
+ 0x1cfa, 0x1cff,
+ 0x1df6, 0x1dfb,
0x1f16, 0x1f17,
0x1f1e, 0x1f1f,
0x1f46, 0x1f47,
@@ -5682,19 +6169,21 @@ static const OnigCodePoint CR_Cn[] = {
0x1ff0, 0x1ff1,
0x1ff5, 0x1ff5,
0x1fff, 0x1fff,
- 0x2065, 0x2069,
+ 0x2065, 0x2065,
0x2072, 0x2073,
0x208f, 0x208f,
0x209d, 0x209f,
- 0x20ba, 0x20cf,
+ 0x20be, 0x20cf,
0x20f1, 0x20ff,
0x218a, 0x218f,
- 0x23f4, 0x23ff,
+ 0x23fb, 0x23ff,
0x2427, 0x243f,
0x244b, 0x245f,
- 0x2700, 0x2700,
- 0x2b4d, 0x2b4f,
- 0x2b5a, 0x2bff,
+ 0x2b74, 0x2b75,
+ 0x2b96, 0x2b97,
+ 0x2bba, 0x2bbc,
+ 0x2bc9, 0x2bc9,
+ 0x2bd2, 0x2bff,
0x2c2f, 0x2c2f,
0x2c5f, 0x2c5f,
0x2cf4, 0x2cf8,
@@ -5712,7 +6201,7 @@ static const OnigCodePoint CR_Cn[] = {
0x2dcf, 0x2dcf,
0x2dd7, 0x2dd7,
0x2ddf, 0x2ddf,
- 0x2e3c, 0x2e7f,
+ 0x2e43, 0x2e7f,
0x2e9a, 0x2e9a,
0x2ef4, 0x2eff,
0x2fd6, 0x2fef,
@@ -5731,11 +6220,11 @@ static const OnigCodePoint CR_Cn[] = {
0xa48d, 0xa48f,
0xa4c7, 0xa4cf,
0xa62c, 0xa63f,
- 0xa698, 0xa69e,
+ 0xa69e, 0xa69e,
0xa6f8, 0xa6ff,
0xa78f, 0xa78f,
- 0xa794, 0xa79f,
- 0xa7ab, 0xa7f7,
+ 0xa7ae, 0xa7af,
+ 0xa7b2, 0xa7f6,
0xa82c, 0xa82f,
0xa83a, 0xa83f,
0xa878, 0xa87f,
@@ -5746,18 +6235,19 @@ static const OnigCodePoint CR_Cn[] = {
0xa97d, 0xa97f,
0xa9ce, 0xa9ce,
0xa9da, 0xa9dd,
- 0xa9e0, 0xa9ff,
+ 0xa9ff, 0xa9ff,
0xaa37, 0xaa3f,
0xaa4e, 0xaa4f,
0xaa5a, 0xaa5b,
- 0xaa7c, 0xaa7f,
0xaac3, 0xaada,
0xaaf7, 0xab00,
0xab07, 0xab08,
0xab0f, 0xab10,
0xab17, 0xab1f,
0xab27, 0xab27,
- 0xab2f, 0xabbf,
+ 0xab2f, 0xab2f,
+ 0xab60, 0xab63,
+ 0xab66, 0xabbf,
0xabee, 0xabef,
0xabfa, 0xabff,
0xd7a4, 0xd7af,
@@ -5778,7 +6268,7 @@ static const OnigCodePoint CR_Cn[] = {
0xfdc8, 0xfdef,
0xfdfe, 0xfdff,
0xfe1a, 0xfe1f,
- 0xfe27, 0xfe2f,
+ 0xfe2e, 0xfe2f,
0xfe53, 0xfe53,
0xfe67, 0xfe67,
0xfe6c, 0xfe6f,
@@ -5802,26 +6292,35 @@ static const OnigCodePoint CR_Cn[] = {
0x100fb, 0x100ff,
0x10103, 0x10106,
0x10134, 0x10136,
- 0x1018b, 0x1018f,
- 0x1019c, 0x101cf,
+ 0x1018d, 0x1018f,
+ 0x1019c, 0x1019f,
+ 0x101a1, 0x101cf,
0x101fe, 0x1027f,
0x1029d, 0x1029f,
- 0x102d1, 0x102ff,
- 0x1031f, 0x1031f,
+ 0x102d1, 0x102df,
+ 0x102fc, 0x102ff,
0x10324, 0x1032f,
- 0x1034b, 0x1037f,
+ 0x1034b, 0x1034f,
+ 0x1037b, 0x1037f,
0x1039e, 0x1039e,
0x103c4, 0x103c7,
0x103d6, 0x103ff,
0x1049e, 0x1049f,
- 0x104aa, 0x107ff,
+ 0x104aa, 0x104ff,
+ 0x10528, 0x1052f,
+ 0x10564, 0x1056e,
+ 0x10570, 0x105ff,
+ 0x10737, 0x1073f,
+ 0x10756, 0x1075f,
+ 0x10768, 0x107ff,
0x10806, 0x10807,
0x10809, 0x10809,
0x10836, 0x10836,
0x10839, 0x1083b,
0x1083d, 0x1083e,
0x10856, 0x10856,
- 0x10860, 0x108ff,
+ 0x1089f, 0x108a6,
+ 0x108b0, 0x108ff,
0x1091c, 0x1091e,
0x1093a, 0x1093e,
0x10940, 0x1097f,
@@ -5835,33 +6334,82 @@ static const OnigCodePoint CR_Cn[] = {
0x10a3b, 0x10a3e,
0x10a48, 0x10a4f,
0x10a59, 0x10a5f,
- 0x10a80, 0x10aff,
+ 0x10aa0, 0x10abf,
+ 0x10ae7, 0x10aea,
+ 0x10af7, 0x10aff,
0x10b36, 0x10b38,
0x10b56, 0x10b57,
0x10b73, 0x10b77,
- 0x10b80, 0x10bff,
+ 0x10b92, 0x10b98,
+ 0x10b9d, 0x10ba8,
+ 0x10bb0, 0x10bff,
0x10c49, 0x10e5f,
0x10e7f, 0x10fff,
0x1104e, 0x11051,
- 0x11070, 0x1107f,
+ 0x11070, 0x1107e,
0x110c2, 0x110cf,
0x110e9, 0x110ef,
0x110fa, 0x110ff,
0x11135, 0x11135,
- 0x11144, 0x1117f,
- 0x111c9, 0x111cf,
- 0x111da, 0x1167f,
+ 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,
0x116b8, 0x116bf,
- 0x116ca, 0x11fff,
- 0x1236f, 0x123ff,
- 0x12463, 0x1246f,
- 0x12474, 0x12fff,
+ 0x116ca, 0x1189f,
+ 0x118f3, 0x118fe,
+ 0x11900, 0x11abf,
+ 0x11af9, 0x11fff,
+ 0x12399, 0x123ff,
+ 0x1246f, 0x1246f,
+ 0x12475, 0x12fff,
0x1342f, 0x167ff,
- 0x16a39, 0x16eff,
+ 0x16a39, 0x16a3f,
+ 0x16a5f, 0x16a5f,
+ 0x16a6a, 0x16a6d,
+ 0x16a70, 0x16acf,
+ 0x16aee, 0x16aef,
+ 0x16af6, 0x16aff,
+ 0x16b46, 0x16b4f,
+ 0x16b5a, 0x16b5a,
+ 0x16b62, 0x16b62,
+ 0x16b78, 0x16b7c,
+ 0x16b90, 0x16eff,
0x16f45, 0x16f4f,
0x16f7f, 0x16f8e,
0x16fa0, 0x1afff,
- 0x1b002, 0x1cfff,
+ 0x1b002, 0x1bbff,
+ 0x1bc6b, 0x1bc6f,
+ 0x1bc7d, 0x1bc7f,
+ 0x1bc89, 0x1bc8f,
+ 0x1bc9a, 0x1bc9b,
+ 0x1bca4, 0x1cfff,
0x1d0f6, 0x1d0ff,
0x1d127, 0x1d128,
0x1d1de, 0x1d1ff,
@@ -5888,7 +6436,9 @@ static const OnigCodePoint CR_Cn[] = {
0x1d551, 0x1d551,
0x1d6a6, 0x1d6a7,
0x1d7cc, 0x1d7cd,
- 0x1d800, 0x1edff,
+ 0x1d800, 0x1e7ff,
+ 0x1e8c5, 0x1e8c6,
+ 0x1e8d7, 0x1edff,
0x1ee04, 0x1ee04,
0x1ee20, 0x1ee20,
0x1ee23, 0x1ee23,
@@ -5926,10 +6476,10 @@ static const OnigCodePoint CR_Cn[] = {
0x1f02c, 0x1f02f,
0x1f094, 0x1f09f,
0x1f0af, 0x1f0b0,
- 0x1f0bf, 0x1f0c0,
+ 0x1f0c0, 0x1f0c0,
0x1f0d0, 0x1f0d0,
- 0x1f0e0, 0x1f0ff,
- 0x1f10b, 0x1f10f,
+ 0x1f0f6, 0x1f0ff,
+ 0x1f10d, 0x1f10f,
0x1f12f, 0x1f12f,
0x1f16c, 0x1f16f,
0x1f19b, 0x1f1e5,
@@ -5937,24 +6487,25 @@ static const OnigCodePoint CR_Cn[] = {
0x1f23b, 0x1f23f,
0x1f249, 0x1f24f,
0x1f252, 0x1f2ff,
- 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,
+ 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,
0x2a6d7, 0x2a6ff,
0x2b735, 0x2b73f,
0x2b81e, 0x2f7ff,
@@ -5982,7 +6533,7 @@ static const OnigCodePoint CR_Cs[] = {
/* 'L': Major Category */
static const OnigCodePoint CR_L[] = {
- 486,
+ 537,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -5998,13 +6549,14 @@ 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, 0x0527,
+ 0x048a, 0x052f,
0x0531, 0x0556,
0x0559, 0x0559,
0x0561, 0x0587,
@@ -6030,14 +6582,12 @@ static const OnigCodePoint CR_L[] = {
0x0824, 0x0824,
0x0828, 0x0828,
0x0840, 0x0858,
- 0x08a0, 0x08a0,
- 0x08a2, 0x08ac,
+ 0x08a0, 0x08b2,
0x0904, 0x0939,
0x093d, 0x093d,
0x0950, 0x0950,
0x0958, 0x0961,
- 0x0971, 0x0977,
- 0x0979, 0x097f,
+ 0x0971, 0x0980,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -6092,8 +6642,7 @@ static const OnigCodePoint CR_L[] = {
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c33,
- 0x0c35, 0x0c39,
+ 0x0c2a, 0x0c39,
0x0c3d, 0x0c3d,
0x0c58, 0x0c59,
0x0c60, 0x0c61,
@@ -6177,6 +6726,7 @@ static const OnigCodePoint CR_L[] = {
0x166f, 0x167f,
0x1681, 0x169a,
0x16a0, 0x16ea,
+ 0x16f1, 0x16f8,
0x1700, 0x170c,
0x170e, 0x1711,
0x1720, 0x1731,
@@ -6190,7 +6740,7 @@ static const OnigCodePoint CR_L[] = {
0x1880, 0x18a8,
0x18aa, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191c,
+ 0x1900, 0x191e,
0x1950, 0x196d,
0x1970, 0x1974,
0x1980, 0x19ab,
@@ -6285,14 +6835,14 @@ static const OnigCodePoint CR_L[] = {
0xa610, 0xa61f,
0xa62a, 0xa62b,
0xa640, 0xa66e,
- 0xa67f, 0xa697,
+ 0xa67f, 0xa69d,
0xa6a0, 0xa6e5,
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa793,
- 0xa7a0, 0xa7aa,
- 0xa7f8, 0xa801,
+ 0xa790, 0xa7ad,
+ 0xa7b0, 0xa7b1,
+ 0xa7f7, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa822,
@@ -6305,12 +6855,15 @@ 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,
- 0xaa80, 0xaaaf,
+ 0xaa7e, 0xaaaf,
0xaab1, 0xaab1,
0xaab5, 0xaab6,
0xaab9, 0xaabd,
@@ -6324,6 +6877,9 @@ static const OnigCodePoint CR_L[] = {
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
+ 0xab30, 0xab5a,
+ 0xab5c, 0xab5f,
+ 0xab64, 0xab65,
0xabc0, 0xabe2,
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
@@ -6362,19 +6918,27 @@ static const OnigCodePoint CR_L[] = {
0x10080, 0x100fa,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x10300, 0x1031e,
+ 0x10300, 0x1031f,
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,
@@ -6384,24 +6948,61 @@ 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,
- 0x12000, 0x1236e,
+ 0x118a0, 0x118df,
+ 0x118ff, 0x118ff,
+ 0x11ac0, 0x11af8,
+ 0x12000, 0x12398,
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,
@@ -6432,6 +7033,7 @@ static const OnigCodePoint CR_L[] = {
0x1d78a, 0x1d7a8,
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
+ 0x1e800, 0x1e8c4,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -6473,7 +7075,7 @@ static const OnigCodePoint CR_L[] = {
/* 'LC': General Category */
static const OnigCodePoint CR_LC[] = {
- 113,
+ 117,
0x0041, 0x005a,
0x0061, 0x007a,
0x00b5, 0x00b5,
@@ -6486,13 +7088,14 @@ 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, 0x0527,
+ 0x048a, 0x052f,
0x0531, 0x0556,
0x0561, 0x0587,
0x10a0, 0x10c5,
@@ -6545,18 +7148,21 @@ static const OnigCodePoint CR_LC[] = {
0x2d27, 0x2d27,
0x2d2d, 0x2d2d,
0xa640, 0xa66d,
- 0xa680, 0xa697,
+ 0xa680, 0xa69b,
0xa722, 0xa76f,
0xa771, 0xa787,
0xa78b, 0xa78e,
- 0xa790, 0xa793,
- 0xa7a0, 0xa7aa,
+ 0xa790, 0xa7ad,
+ 0xa7b0, 0xa7b1,
0xa7fa, 0xa7fa,
+ 0xab30, 0xab5a,
+ 0xab64, 0xab65,
0xfb00, 0xfb06,
0xfb13, 0xfb17,
0xff21, 0xff3a,
0xff41, 0xff5a,
0x10400, 0x1044f,
+ 0x118a0, 0x118df,
0x1d400, 0x1d454,
0x1d456, 0x1d49c,
0x1d49e, 0x1d49f,
@@ -6591,7 +7197,7 @@ static const OnigCodePoint CR_LC[] = {
/* 'Ll': General Category */
static const OnigCodePoint CR_Ll[] = {
- 611,
+ 625,
0x0061, 0x007a,
0x00b5, 0x00b5,
0x00df, 0x00f6,
@@ -6857,6 +7463,10 @@ 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,
@@ -7115,6 +7725,8 @@ static const OnigCodePoint CR_Ll[] = {
0xa693, 0xa693,
0xa695, 0xa695,
0xa697, 0xa697,
+ 0xa699, 0xa699,
+ 0xa69b, 0xa69b,
0xa723, 0xa723,
0xa725, 0xa725,
0xa727, 0xa727,
@@ -7164,17 +7776,25 @@ static const OnigCodePoint CR_Ll[] = {
0xa78c, 0xa78c,
0xa78e, 0xa78e,
0xa791, 0xa791,
- 0xa793, 0xa793,
+ 0xa793, 0xa795,
+ 0xa797, 0xa797,
+ 0xa799, 0xa799,
+ 0xa79b, 0xa79b,
+ 0xa79d, 0xa79d,
+ 0xa79f, 0xa79f,
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,
@@ -7207,7 +7827,7 @@ static const OnigCodePoint CR_Ll[] = {
/* 'Lm': General Category */
static const OnigCodePoint CR_Lm[] = {
- 52,
+ 56,
0x02b0, 0x02c1,
0x02c6, 0x02d1,
0x02e0, 0x02e4,
@@ -7249,22 +7869,26 @@ 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[] = {
- 371,
+ 417,
0x00aa, 0x00aa,
0x00ba, 0x00ba,
0x01bb, 0x01bb,
@@ -7287,14 +7911,12 @@ static const OnigCodePoint CR_Lo[] = {
0x07ca, 0x07ea,
0x0800, 0x0815,
0x0840, 0x0858,
- 0x08a0, 0x08a0,
- 0x08a2, 0x08ac,
+ 0x08a0, 0x08b2,
0x0904, 0x0939,
0x093d, 0x093d,
0x0950, 0x0950,
0x0958, 0x0961,
- 0x0972, 0x0977,
- 0x0979, 0x097f,
+ 0x0972, 0x0980,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -7349,8 +7971,7 @@ static const OnigCodePoint CR_Lo[] = {
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c33,
- 0x0c35, 0x0c39,
+ 0x0c2a, 0x0c39,
0x0c3d, 0x0c3d,
0x0c58, 0x0c59,
0x0c60, 0x0c61,
@@ -7430,6 +8051,7 @@ static const OnigCodePoint CR_Lo[] = {
0x166f, 0x167f,
0x1681, 0x169a,
0x16a0, 0x16ea,
+ 0x16f1, 0x16f8,
0x1700, 0x170c,
0x170e, 0x1711,
0x1720, 0x1731,
@@ -7443,7 +8065,7 @@ static const OnigCodePoint CR_Lo[] = {
0x1880, 0x18a8,
0x18aa, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191c,
+ 0x1900, 0x191e,
0x1950, 0x196d,
0x1970, 0x1974,
0x1980, 0x19ab,
@@ -7492,6 +8114,7 @@ static const OnigCodePoint CR_Lo[] = {
0xa62a, 0xa62b,
0xa66e, 0xa66e,
0xa6a0, 0xa6e5,
+ 0xa7f7, 0xa7f7,
0xa7fb, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
@@ -7504,13 +8127,16 @@ 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,
- 0xaa80, 0xaaaf,
+ 0xaa7e, 0xaaaf,
0xaab1, 0xaab1,
0xaab5, 0xaab6,
0xaab9, 0xaabd,
@@ -7560,19 +8186,27 @@ static const OnigCodePoint CR_Lo[] = {
0x10080, 0x100fa,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x10300, 0x1031e,
+ 0x10300, 0x1031f,
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,
@@ -7582,23 +8216,59 @@ 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,
- 0x12000, 0x1236e,
+ 0x118ff, 0x118ff,
+ 0x11ac0, 0x11af8,
+ 0x12000, 0x12398,
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,
@@ -7655,7 +8325,7 @@ static const OnigCodePoint CR_Lt[] = {
/* 'Lu': General Category */
static const OnigCodePoint CR_Lu[] = {
- 608,
+ 622,
0x0041, 0x005a,
0x00c0, 0x00d6,
0x00d8, 0x00de,
@@ -7803,6 +8473,7 @@ static const OnigCodePoint CR_Lu[] = {
0x0370, 0x0370,
0x0372, 0x0372,
0x0376, 0x0376,
+ 0x037f, 0x037f,
0x0386, 0x0386,
0x0388, 0x038a,
0x038c, 0x038c,
@@ -7922,6 +8593,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,
@@ -8176,6 +8851,8 @@ static const OnigCodePoint CR_Lu[] = {
0xa692, 0xa692,
0xa694, 0xa694,
0xa696, 0xa696,
+ 0xa698, 0xa698,
+ 0xa69a, 0xa69a,
0xa722, 0xa722,
0xa724, 0xa724,
0xa726, 0xa726,
@@ -8225,14 +8902,21 @@ 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, 0xa7aa,
+ 0xa7aa, 0xa7ad,
+ 0xa7b0, 0xa7b1,
0xff21, 0xff3a,
0x10400, 0x10427,
+ 0x118a0, 0x118bf,
0x1d400, 0x1d419,
0x1d434, 0x1d44d,
0x1d468, 0x1d481,
@@ -8268,7 +8952,7 @@ static const OnigCodePoint CR_Lu[] = {
/* 'M': Major Category */
static const OnigCodePoint CR_M[] = {
- 204,
+ 229,
0x0300, 0x036f,
0x0483, 0x0489,
0x0591, 0x05bd,
@@ -8292,8 +8976,7 @@ static const OnigCodePoint CR_M[] = {
0x0825, 0x0827,
0x0829, 0x082d,
0x0859, 0x085b,
- 0x08e4, 0x08fe,
- 0x0900, 0x0903,
+ 0x08e4, 0x0903,
0x093a, 0x093c,
0x093e, 0x094f,
0x0951, 0x0957,
@@ -8331,20 +9014,20 @@ static const OnigCodePoint CR_M[] = {
0x0bc6, 0x0bc8,
0x0bca, 0x0bcd,
0x0bd7, 0x0bd7,
- 0x0c01, 0x0c03,
+ 0x0c00, 0x0c03,
0x0c3e, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4d,
0x0c55, 0x0c56,
0x0c62, 0x0c63,
- 0x0c82, 0x0c83,
+ 0x0c81, 0x0c83,
0x0cbc, 0x0cbc,
0x0cbe, 0x0cc4,
0x0cc6, 0x0cc8,
0x0cca, 0x0ccd,
0x0cd5, 0x0cd6,
0x0ce2, 0x0ce3,
- 0x0d02, 0x0d03,
+ 0x0d01, 0x0d03,
0x0d3e, 0x0d44,
0x0d46, 0x0d48,
0x0d4a, 0x0d4d,
@@ -8399,6 +9082,7 @@ static const OnigCodePoint CR_M[] = {
0x1a55, 0x1a5e,
0x1a60, 0x1a7c,
0x1a7f, 0x1a7f,
+ 0x1ab0, 0x1abe,
0x1b00, 0x1b04,
0x1b34, 0x1b44,
0x1b6b, 0x1b73,
@@ -8410,7 +9094,8 @@ static const OnigCodePoint CR_M[] = {
0x1cd4, 0x1ce8,
0x1ced, 0x1ced,
0x1cf2, 0x1cf4,
- 0x1dc0, 0x1de6,
+ 0x1cf8, 0x1cf9,
+ 0x1dc0, 0x1df5,
0x1dfc, 0x1dff,
0x20d0, 0x20f0,
0x2cef, 0x2cf1,
@@ -8433,10 +9118,11 @@ static const OnigCodePoint CR_M[] = {
0xa947, 0xa953,
0xa980, 0xa983,
0xa9b3, 0xa9c0,
+ 0xa9e5, 0xa9e5,
0xaa29, 0xaa36,
0xaa43, 0xaa43,
0xaa4c, 0xaa4d,
- 0xaa7b, 0xaa7b,
+ 0xaa7b, 0xaa7d,
0xaab0, 0xaab0,
0xaab2, 0xaab4,
0xaab7, 0xaab8,
@@ -8448,36 +9134,59 @@ static const OnigCodePoint CR_M[] = {
0xabec, 0xabed,
0xfb1e, 0xfb1e,
0xfe00, 0xfe0f,
- 0xfe20, 0xfe26,
+ 0xfe20, 0xfe2d,
0x101fd, 0x101fd,
+ 0x102e0, 0x102e0,
+ 0x10376, 0x1037a,
0x10a01, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a0f,
0x10a38, 0x10a3a,
0x10a3f, 0x10a3f,
+ 0x10ae5, 0x10ae6,
0x11000, 0x11002,
0x11038, 0x11046,
- 0x11080, 0x11082,
+ 0x1107f, 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[] = {
- 126,
+ 147,
0x0903, 0x0903,
0x093b, 0x093b,
0x093e, 0x0940,
@@ -8544,7 +9253,7 @@ static const OnigCodePoint CR_Mc[] = {
0x1933, 0x1938,
0x19b0, 0x19c0,
0x19c8, 0x19c9,
- 0x1a19, 0x1a1b,
+ 0x1a19, 0x1a1a,
0x1a55, 0x1a55,
0x1a57, 0x1a57,
0x1a61, 0x1a61,
@@ -8559,7 +9268,6 @@ static const OnigCodePoint CR_Mc[] = {
0x1ba1, 0x1ba1,
0x1ba6, 0x1ba7,
0x1baa, 0x1baa,
- 0x1bac, 0x1bad,
0x1be7, 0x1be7,
0x1bea, 0x1bec,
0x1bee, 0x1bee,
@@ -8582,6 +9290,7 @@ static const OnigCodePoint CR_Mc[] = {
0xaa33, 0xaa34,
0xaa4d, 0xaa4d,
0xaa7b, 0xaa7b,
+ 0xaa7d, 0xaa7d,
0xaaeb, 0xaaeb,
0xaaee, 0xaaef,
0xaaf5, 0xaaf5,
@@ -8598,6 +9307,27 @@ 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,
@@ -8608,8 +9338,9 @@ static const OnigCodePoint CR_Mc[] = {
/* 'Me': General Category */
static const OnigCodePoint CR_Me[] = {
- 4,
+ 5,
0x0488, 0x0489,
+ 0x1abe, 0x1abe,
0x20dd, 0x20e0,
0x20e2, 0x20e4,
0xa670, 0xa672,
@@ -8617,7 +9348,7 @@ static const OnigCodePoint CR_Me[] = {
/* 'Mn': General Category */
static const OnigCodePoint CR_Mn[] = {
- 220,
+ 255,
0x0300, 0x036f,
0x0483, 0x0487,
0x0591, 0x05bd,
@@ -8641,8 +9372,7 @@ static const OnigCodePoint CR_Mn[] = {
0x0825, 0x0827,
0x0829, 0x082d,
0x0859, 0x085b,
- 0x08e4, 0x08fe,
- 0x0900, 0x0902,
+ 0x08e4, 0x0902,
0x093a, 0x093a,
0x093c, 0x093c,
0x0941, 0x0948,
@@ -8678,16 +9408,19 @@ 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,
@@ -8739,6 +9472,7 @@ static const OnigCodePoint CR_Mn[] = {
0x1932, 0x1932,
0x1939, 0x193b,
0x1a17, 0x1a18,
+ 0x1a1b, 0x1a1b,
0x1a56, 0x1a56,
0x1a58, 0x1a5e,
0x1a60, 0x1a60,
@@ -8746,6 +9480,7 @@ static const OnigCodePoint CR_Mn[] = {
0x1a65, 0x1a6c,
0x1a73, 0x1a7c,
0x1a7f, 0x1a7f,
+ 0x1ab0, 0x1abd,
0x1b00, 0x1b03,
0x1b34, 0x1b34,
0x1b36, 0x1b3a,
@@ -8755,7 +9490,7 @@ static const OnigCodePoint CR_Mn[] = {
0x1b80, 0x1b81,
0x1ba2, 0x1ba5,
0x1ba8, 0x1ba9,
- 0x1bab, 0x1bab,
+ 0x1bab, 0x1bad,
0x1be6, 0x1be6,
0x1be8, 0x1be9,
0x1bed, 0x1bed,
@@ -8767,7 +9502,8 @@ static const OnigCodePoint CR_Mn[] = {
0x1ce2, 0x1ce8,
0x1ced, 0x1ced,
0x1cf4, 0x1cf4,
- 0x1dc0, 0x1de6,
+ 0x1cf8, 0x1cf9,
+ 0x1dc0, 0x1df5,
0x1dfc, 0x1dff,
0x20d0, 0x20dc,
0x20e1, 0x20e1,
@@ -8793,11 +9529,13 @@ 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,
@@ -8810,39 +9548,67 @@ static const OnigCodePoint CR_Mn[] = {
0xabed, 0xabed,
0xfb1e, 0xfb1e,
0xfe00, 0xfe0f,
- 0xfe20, 0xfe26,
+ 0xfe20, 0xfe2d,
0x101fd, 0x101fd,
+ 0x102e0, 0x102e0,
+ 0x10376, 0x1037a,
0x10a01, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a0f,
0x10a38, 0x10a3a,
0x10a3f, 0x10a3f,
+ 0x10ae5, 0x10ae6,
0x11001, 0x11001,
0x11038, 0x11046,
- 0x11080, 0x11081,
+ 0x1107f, 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[] = {
- 88,
+ 105,
0x0030, 0x0039,
0x00b2, 0x00b3,
0x00b9, 0x00b9,
@@ -8862,6 +9628,7 @@ static const OnigCodePoint CR_N[] = {
0x0c78, 0x0c7e,
0x0ce6, 0x0cef,
0x0d66, 0x0d75,
+ 0x0de6, 0x0def,
0x0e50, 0x0e59,
0x0ed0, 0x0ed9,
0x0f20, 0x0f33,
@@ -8904,33 +9671,49 @@ static const OnigCodePoint CR_N[] = {
0xa8d0, 0xa8d9,
0xa900, 0xa909,
0xa9d0, 0xa9d9,
+ 0xa9f0, 0xa9f9,
0xaa50, 0xaa59,
0xabf0, 0xabf9,
0xff10, 0xff19,
0x10107, 0x10133,
0x10140, 0x10178,
- 0x1018a, 0x1018a,
+ 0x1018a, 0x1018b,
+ 0x102e1, 0x102fb,
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,
- 0x12400, 0x12462,
+ 0x118e0, 0x118f2,
+ 0x12400, 0x1246e,
+ 0x16a60, 0x16a69,
+ 0x16b50, 0x16b59,
+ 0x16b5b, 0x16b61,
0x1d360, 0x1d371,
0x1d7ce, 0x1d7ff,
- 0x1f100, 0x1f10a,
+ 0x1e8c7, 0x1e8cf,
+ 0x1f100, 0x1f10c,
}; /* CR_N */
/* 'Nd': General Category */
@@ -8950,12 +9733,12 @@ static const OnigCodePoint CR_Nl[] = {
0x10341, 0x10341,
0x1034a, 0x1034a,
0x103d1, 0x103d5,
- 0x12400, 0x12462,
+ 0x12400, 0x1246e,
}; /* CR_Nl */
/* 'No': General Category */
static const OnigCodePoint CR_No[] = {
- 42,
+ 52,
0x00b2, 0x00b3,
0x00b9, 0x00b9,
0x00bc, 0x00be,
@@ -8986,18 +9769,28 @@ static const OnigCodePoint CR_No[] = {
0xa830, 0xa835,
0x10107, 0x10133,
0x10175, 0x10178,
- 0x1018a, 0x1018a,
+ 0x1018a, 0x1018b,
+ 0x102e1, 0x102fb,
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,
- 0x1f100, 0x1f10a,
+ 0x1e8c7, 0x1e8cf,
+ 0x1f100, 0x1f10c,
}; /* CR_No */
/* 'P': Major Category */
@@ -9016,7 +9809,7 @@ static const OnigCodePoint CR_Pc[] = {
/* 'Pd': General Category */
static const OnigCodePoint CR_Pd[] = {
- 16,
+ 17,
0x002d, 0x002d,
0x058a, 0x058a,
0x05be, 0x05be,
@@ -9026,6 +9819,7 @@ static const OnigCodePoint CR_Pd[] = {
0x2e17, 0x2e17,
0x2e1a, 0x2e1a,
0x2e3a, 0x2e3b,
+ 0x2e40, 0x2e40,
0x301c, 0x301c,
0x3030, 0x3030,
0x30a0, 0x30a0,
@@ -9037,7 +9831,7 @@ static const OnigCodePoint CR_Pd[] = {
/* 'Pe': General Category */
static const OnigCodePoint CR_Pe[] = {
- 70,
+ 72,
0x0029, 0x0029,
0x005d, 0x005d,
0x007d, 0x007d,
@@ -9047,6 +9841,8 @@ static const OnigCodePoint CR_Pe[] = {
0x2046, 0x2046,
0x207e, 0x207e,
0x208e, 0x208e,
+ 0x2309, 0x2309,
+ 0x230b, 0x230b,
0x232a, 0x232a,
0x2769, 0x2769,
0x276b, 0x276b,
@@ -9089,7 +9885,7 @@ static const OnigCodePoint CR_Pe[] = {
0x3019, 0x3019,
0x301b, 0x301b,
0x301e, 0x301f,
- 0xfd3f, 0xfd3f,
+ 0xfd3e, 0xfd3e,
0xfe18, 0xfe18,
0xfe36, 0xfe36,
0xfe38, 0xfe38,
@@ -9143,7 +9939,7 @@ static const OnigCodePoint CR_Pi[] = {
/* 'Po': General Category */
static const OnigCodePoint CR_Po[] = {
- 135,
+ 151,
0x0021, 0x0023,
0x0025, 0x0027,
0x002a, 0x002a,
@@ -9225,6 +10021,8 @@ static const OnigCodePoint CR_Po[] = {
0x2e1e, 0x2e1f,
0x2e2a, 0x2e2e,
0x2e30, 0x2e39,
+ 0x2e3c, 0x2e3f,
+ 0x2e41, 0x2e41,
0x3001, 0x3003,
0x303d, 0x303d,
0x30fb, 0x30fb,
@@ -9267,23 +10065,37 @@ 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,
- 0x12470, 0x12473,
+ 0x111cd, 0x111cd,
+ 0x11238, 0x1123d,
+ 0x114c6, 0x114c6,
+ 0x115c1, 0x115c9,
+ 0x11641, 0x11643,
+ 0x12470, 0x12474,
+ 0x16a6e, 0x16a6f,
+ 0x16af5, 0x16af5,
+ 0x16b37, 0x16b3b,
+ 0x16b44, 0x16b44,
+ 0x1bc9f, 0x1bc9f,
}; /* CR_Po */
/* 'Ps': General Category */
static const OnigCodePoint CR_Ps[] = {
- 72,
+ 75,
0x0028, 0x0028,
0x005b, 0x005b,
0x007b, 0x007b,
@@ -9295,6 +10107,8 @@ static const OnigCodePoint CR_Ps[] = {
0x2045, 0x2045,
0x207d, 0x207d,
0x208d, 0x208d,
+ 0x2308, 0x2308,
+ 0x230a, 0x230a,
0x2329, 0x2329,
0x2768, 0x2768,
0x276a, 0x276a,
@@ -9327,6 +10141,7 @@ static const OnigCodePoint CR_Ps[] = {
0x2e24, 0x2e24,
0x2e26, 0x2e26,
0x2e28, 0x2e28,
+ 0x2e42, 0x2e42,
0x3008, 0x3008,
0x300a, 0x300a,
0x300c, 0x300c,
@@ -9337,7 +10152,7 @@ static const OnigCodePoint CR_Ps[] = {
0x3018, 0x3018,
0x301a, 0x301a,
0x301d, 0x301d,
- 0xfd3e, 0xfd3e,
+ 0xfd3f, 0xfd3f,
0xfe17, 0xfe17,
0xfe35, 0xfe35,
0xfe37, 0xfe37,
@@ -9360,7 +10175,7 @@ static const OnigCodePoint CR_Ps[] = {
/* 'S': Major Category */
static const OnigCodePoint CR_S[] = {
- 198,
+ 210,
0x0024, 0x0024,
0x002b, 0x002b,
0x003c, 0x003e,
@@ -9385,7 +10200,7 @@ static const OnigCodePoint CR_S[] = {
0x0384, 0x0385,
0x03f6, 0x03f6,
0x0482, 0x0482,
- 0x058f, 0x058f,
+ 0x058d, 0x058f,
0x0606, 0x0608,
0x060b, 0x060b,
0x060e, 0x060f,
@@ -9429,7 +10244,7 @@ static const OnigCodePoint CR_S[] = {
0x2052, 0x2052,
0x207a, 0x207c,
0x208a, 0x208c,
- 0x20a0, 0x20b9,
+ 0x20a0, 0x20bd,
0x2100, 0x2101,
0x2103, 0x2106,
0x2108, 0x2109,
@@ -9444,20 +10259,23 @@ static const OnigCodePoint CR_S[] = {
0x2140, 0x2144,
0x214a, 0x214d,
0x214f, 0x214f,
- 0x2190, 0x2328,
- 0x232b, 0x23f3,
+ 0x2190, 0x2307,
+ 0x230c, 0x2328,
+ 0x232b, 0x23fa,
0x2400, 0x2426,
0x2440, 0x244a,
0x249c, 0x24e9,
- 0x2500, 0x26ff,
- 0x2701, 0x2767,
+ 0x2500, 0x2767,
0x2794, 0x27c4,
0x27c7, 0x27e5,
0x27f0, 0x2982,
0x2999, 0x29d7,
0x29dc, 0x29fb,
- 0x29fe, 0x2b4c,
- 0x2b50, 0x2b59,
+ 0x29fe, 0x2b73,
+ 0x2b76, 0x2b95,
+ 0x2b98, 0x2bb9,
+ 0x2bbd, 0x2bc8,
+ 0x2bca, 0x2bd1,
0x2ce5, 0x2cea,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
@@ -9487,6 +10305,7 @@ static const OnigCodePoint CR_S[] = {
0xa828, 0xa82b,
0xa836, 0xa839,
0xaa77, 0xaa79,
+ 0xab5b, 0xab5b,
0xfb29, 0xfb29,
0xfbb2, 0xfbc1,
0xfdfc, 0xfdfd,
@@ -9505,8 +10324,15 @@ 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,
@@ -9531,9 +10357,9 @@ static const OnigCodePoint CR_S[] = {
0x1f000, 0x1f02b,
0x1f030, 0x1f093,
0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0be,
+ 0x1f0b1, 0x1f0bf,
0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0df,
+ 0x1f0d1, 0x1f0f5,
0x1f110, 0x1f12e,
0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
@@ -9541,24 +10367,25 @@ static const OnigCodePoint CR_S[] = {
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,
+ 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,
}; /* CR_S */
/* 'Sc': General Category */
@@ -9574,7 +10401,7 @@ static const OnigCodePoint CR_Sc[] = {
0x0bf9, 0x0bf9,
0x0e3f, 0x0e3f,
0x17db, 0x17db,
- 0x20a0, 0x20b9,
+ 0x20a0, 0x20bd,
0xa838, 0xa838,
0xfdfc, 0xfdfc,
0xfe69, 0xfe69,
@@ -9585,7 +10412,7 @@ static const OnigCodePoint CR_Sc[] = {
/* 'Sk': General Category */
static const OnigCodePoint CR_Sk[] = {
- 27,
+ 28,
0x005e, 0x005e,
0x0060, 0x0060,
0x00a8, 0x00a8,
@@ -9609,6 +10436,7 @@ static const OnigCodePoint CR_Sk[] = {
0xa700, 0xa716,
0xa720, 0xa721,
0xa789, 0xa78a,
+ 0xab5b, 0xab5b,
0xfbb2, 0xfbc1,
0xff3e, 0xff3e,
0xff40, 0xff40,
@@ -9617,7 +10445,7 @@ static const OnigCodePoint CR_Sk[] = {
/* 'Sm': General Category */
static const OnigCodePoint CR_Sm[] = {
- 65,
+ 64,
0x002b, 0x002b,
0x003c, 0x003e,
0x007c, 0x007c,
@@ -9645,7 +10473,6 @@ static const OnigCodePoint CR_Sm[] = {
0x21d2, 0x21d2,
0x21d4, 0x21d4,
0x21f4, 0x22ff,
- 0x2308, 0x230b,
0x2320, 0x2321,
0x237c, 0x237c,
0x239b, 0x23b3,
@@ -9687,12 +10514,13 @@ static const OnigCodePoint CR_Sm[] = {
/* 'So': General Category */
static const OnigCodePoint CR_So[] = {
- 153,
+ 165,
0x00a6, 0x00a6,
0x00a9, 0x00a9,
0x00ae, 0x00ae,
0x00b0, 0x00b0,
0x0482, 0x0482,
+ 0x058d, 0x058e,
0x060e, 0x060f,
0x06de, 0x06de,
0x06e9, 0x06e9,
@@ -9750,7 +10578,7 @@ static const OnigCodePoint CR_So[] = {
0x232b, 0x237b,
0x237d, 0x239a,
0x23b4, 0x23db,
- 0x23e2, 0x23f3,
+ 0x23e2, 0x23fa,
0x2400, 0x2426,
0x2440, 0x244a,
0x249c, 0x24e9,
@@ -9758,13 +10586,16 @@ static const OnigCodePoint CR_So[] = {
0x25b8, 0x25c0,
0x25c2, 0x25f7,
0x2600, 0x266e,
- 0x2670, 0x26ff,
- 0x2701, 0x2767,
+ 0x2670, 0x2767,
0x2794, 0x27bf,
0x2800, 0x28ff,
0x2b00, 0x2b2f,
0x2b45, 0x2b46,
- 0x2b50, 0x2b59,
+ 0x2b4d, 0x2b73,
+ 0x2b76, 0x2b95,
+ 0x2b98, 0x2bb9,
+ 0x2bbd, 0x2bc8,
+ 0x2bca, 0x2bd1,
0x2ce5, 0x2cea,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
@@ -9798,8 +10629,15 @@ 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,
@@ -9813,9 +10651,9 @@ static const OnigCodePoint CR_So[] = {
0x1f000, 0x1f02b,
0x1f030, 0x1f093,
0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0be,
+ 0x1f0b1, 0x1f0bf,
0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0df,
+ 0x1f0d1, 0x1f0f5,
0x1f110, 0x1f12e,
0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
@@ -9823,33 +10661,33 @@ static const OnigCodePoint CR_So[] = {
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,
+ 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,
}; /* CR_So */
/* 'Z': Major Category */
static const OnigCodePoint CR_Z[] = {
- 9,
+ 8,
0x0020, 0x0020,
0x00a0, 0x00a0,
0x1680, 0x1680,
- 0x180e, 0x180e,
0x2000, 0x200a,
0x2028, 0x2029,
0x202f, 0x202f,
@@ -9871,11 +10709,10 @@ static const OnigCodePoint CR_Zp[] = {
/* 'Zs': General Category */
static const OnigCodePoint CR_Zs[] = {
- 8,
+ 7,
0x0020, 0x0020,
0x00a0, 0x00a0,
0x1680, 0x1680,
- 0x180e, 0x180e,
0x2000, 0x200a,
0x202f, 0x202f,
0x205f, 0x205f,
@@ -10036,7 +10873,7 @@ static const OnigCodePoint CR_Math[] = {
/* 'Cased': Derived Property */
static const OnigCodePoint CR_Cased[] = {
- 119,
+ 127,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -10054,13 +10891,14 @@ 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, 0x0527,
+ 0x048a, 0x052f,
0x0531, 0x0556,
0x0561, 0x0587,
0x10a0, 0x10c5,
@@ -10115,17 +10953,21 @@ static const OnigCodePoint CR_Cased[] = {
0x2d27, 0x2d27,
0x2d2d, 0x2d2d,
0xa640, 0xa66d,
- 0xa680, 0xa697,
+ 0xa680, 0xa69d,
0xa722, 0xa787,
0xa78b, 0xa78e,
- 0xa790, 0xa793,
- 0xa7a0, 0xa7aa,
+ 0xa790, 0xa7ad,
+ 0xa7b0, 0xa7b1,
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,
@@ -10156,11 +10998,14 @@ 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[] = {
- 295,
+ 335,
0x0027, 0x0027,
0x002e, 0x002e,
0x003a, 0x003a,
@@ -10184,8 +11029,9 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x05c4, 0x05c5,
0x05c7, 0x05c7,
0x05f4, 0x05f4,
- 0x0600, 0x0604,
+ 0x0600, 0x0605,
0x0610, 0x061a,
+ 0x061c, 0x061c,
0x0640, 0x0640,
0x064b, 0x065f,
0x0670, 0x0670,
@@ -10200,8 +11046,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x07fa, 0x07fa,
0x0816, 0x082d,
0x0859, 0x085b,
- 0x08e4, 0x08fe,
- 0x0900, 0x0902,
+ 0x08e4, 0x0902,
0x093a, 0x093a,
0x093c, 0x093c,
0x0941, 0x0948,
@@ -10238,16 +11083,19 @@ 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,
@@ -10295,7 +11143,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x17c9, 0x17d3,
0x17d7, 0x17d7,
0x17dd, 0x17dd,
- 0x180b, 0x180d,
+ 0x180b, 0x180e,
0x1843, 0x1843,
0x18a9, 0x18a9,
0x1920, 0x1922,
@@ -10303,6 +11151,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x1932, 0x1932,
0x1939, 0x193b,
0x1a17, 0x1a18,
+ 0x1a1b, 0x1a1b,
0x1a56, 0x1a56,
0x1a58, 0x1a5e,
0x1a60, 0x1a60,
@@ -10311,6 +11160,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x1a73, 0x1a7c,
0x1a7f, 0x1a7f,
0x1aa7, 0x1aa7,
+ 0x1ab0, 0x1abe,
0x1b00, 0x1b03,
0x1b34, 0x1b34,
0x1b36, 0x1b3a,
@@ -10320,7 +11170,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x1b80, 0x1b81,
0x1ba2, 0x1ba5,
0x1ba8, 0x1ba9,
- 0x1bab, 0x1bab,
+ 0x1bab, 0x1bad,
0x1be6, 0x1be6,
0x1be8, 0x1be9,
0x1bed, 0x1bed,
@@ -10333,9 +11183,10 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x1ce2, 0x1ce8,
0x1ced, 0x1ced,
0x1cf4, 0x1cf4,
+ 0x1cf8, 0x1cf9,
0x1d2c, 0x1d6a,
0x1d78, 0x1d78,
- 0x1d9b, 0x1de6,
+ 0x1d9b, 0x1df5,
0x1dfc, 0x1dff,
0x1fbd, 0x1fbd,
0x1fbf, 0x1fc1,
@@ -10349,7 +11200,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0x2027, 0x2027,
0x202a, 0x202e,
0x2060, 0x2064,
- 0x206a, 0x206f,
+ 0x2066, 0x206f,
0x2071, 0x2071,
0x207f, 0x207f,
0x2090, 0x209c,
@@ -10372,6 +11223,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0xa66f, 0xa672,
0xa674, 0xa67d,
0xa67f, 0xa67f,
+ 0xa69c, 0xa69d,
0xa69f, 0xa69f,
0xa6f0, 0xa6f1,
0xa700, 0xa721,
@@ -10391,12 +11243,14 @@ 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,
@@ -10406,6 +11260,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0xaaec, 0xaaed,
0xaaf3, 0xaaf4,
0xaaf6, 0xaaf6,
+ 0xab5b, 0xab5f,
0xabe5, 0xabe5,
0xabe8, 0xabe8,
0xabed, 0xabed,
@@ -10413,7 +11268,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
0xfbb2, 0xfbc1,
0xfe00, 0xfe0f,
0xfe13, 0xfe13,
- 0xfe20, 0xfe26,
+ 0xfe20, 0xfe2d,
0xfe52, 0xfe52,
0xfe55, 0xfe55,
0xfeff, 0xfeff,
@@ -10427,32 +11282,62 @@ 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,
- 0x11080, 0x11081,
+ 0x1107f, 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,
@@ -10460,7 +11345,7 @@ static const OnigCodePoint CR_Case_Ignorable[] = {
/* 'Changes_When_Lowercased': Derived Property */
static const OnigCodePoint CR_Changes_When_Lowercased[] = {
- 571,
+ 585,
0x0041, 0x005a,
0x00c0, 0x00d6,
0x00d8, 0x00de,
@@ -10608,6 +11493,7 @@ static const OnigCodePoint CR_Changes_When_Lowercased[] = {
0x0370, 0x0370,
0x0372, 0x0372,
0x0376, 0x0376,
+ 0x037f, 0x037f,
0x0386, 0x0386,
0x0388, 0x038a,
0x038c, 0x038c,
@@ -10726,6 +11612,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,
@@ -10975,6 +11865,8 @@ static const OnigCodePoint CR_Changes_When_Lowercased[] = {
0xa692, 0xa692,
0xa694, 0xa694,
0xa696, 0xa696,
+ 0xa698, 0xa698,
+ 0xa69a, 0xa69a,
0xa722, 0xa722,
0xa724, 0xa724,
0xa726, 0xa726,
@@ -11024,19 +11916,26 @@ 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, 0xa7aa,
+ 0xa7aa, 0xa7ad,
+ 0xa7b0, 0xa7b1,
0xff21, 0xff3a,
0x10400, 0x10427,
+ 0x118a0, 0x118bf,
}; /* CR_Changes_When_Lowercased */
/* 'Changes_When_Uppercased': Derived Property */
static const OnigCodePoint CR_Changes_When_Uppercased[] = {
- 586,
+ 599,
0x0061, 0x007a,
0x00b5, 0x00b5,
0x00df, 0x00f6,
@@ -11183,20 +12082,21 @@ static const OnigCodePoint CR_Changes_When_Uppercased[] = {
0x024f, 0x0254,
0x0256, 0x0257,
0x0259, 0x0259,
- 0x025b, 0x025b,
- 0x0260, 0x0260,
+ 0x025b, 0x025c,
+ 0x0260, 0x0261,
0x0263, 0x0263,
0x0265, 0x0266,
0x0268, 0x0269,
- 0x026b, 0x026b,
+ 0x026b, 0x026c,
0x026f, 0x026f,
0x0271, 0x0272,
0x0275, 0x0275,
0x027d, 0x027d,
0x0280, 0x0280,
0x0283, 0x0283,
- 0x0288, 0x028c,
+ 0x0287, 0x028c,
0x0292, 0x0292,
+ 0x029e, 0x029e,
0x0345, 0x0345,
0x0371, 0x0371,
0x0373, 0x0373,
@@ -11217,7 +12117,7 @@ static const OnigCodePoint CR_Changes_When_Uppercased[] = {
0x03e9, 0x03e9,
0x03eb, 0x03eb,
0x03ed, 0x03ed,
- 0x03ef, 0x03f2,
+ 0x03ef, 0x03f3,
0x03f5, 0x03f5,
0x03f8, 0x03f8,
0x03fb, 0x03fb,
@@ -11317,6 +12217,10 @@ 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,
@@ -11566,6 +12470,8 @@ static const OnigCodePoint CR_Changes_When_Uppercased[] = {
0xa693, 0xa693,
0xa695, 0xa695,
0xa697, 0xa697,
+ 0xa699, 0xa699,
+ 0xa69b, 0xa69b,
0xa723, 0xa723,
0xa725, 0xa725,
0xa727, 0xa727,
@@ -11614,6 +12520,11 @@ 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,
@@ -11623,11 +12534,12 @@ 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[] = {
- 587,
+ 600,
0x0061, 0x007a,
0x00b5, 0x00b5,
0x00df, 0x00f6,
@@ -11775,20 +12687,21 @@ static const OnigCodePoint CR_Changes_When_Titlecased[] = {
0x024f, 0x0254,
0x0256, 0x0257,
0x0259, 0x0259,
- 0x025b, 0x025b,
- 0x0260, 0x0260,
+ 0x025b, 0x025c,
+ 0x0260, 0x0261,
0x0263, 0x0263,
0x0265, 0x0266,
0x0268, 0x0269,
- 0x026b, 0x026b,
+ 0x026b, 0x026c,
0x026f, 0x026f,
0x0271, 0x0272,
0x0275, 0x0275,
0x027d, 0x027d,
0x0280, 0x0280,
0x0283, 0x0283,
- 0x0288, 0x028c,
+ 0x0287, 0x028c,
0x0292, 0x0292,
+ 0x029e, 0x029e,
0x0345, 0x0345,
0x0371, 0x0371,
0x0373, 0x0373,
@@ -11809,7 +12722,7 @@ static const OnigCodePoint CR_Changes_When_Titlecased[] = {
0x03e9, 0x03e9,
0x03eb, 0x03eb,
0x03ed, 0x03ed,
- 0x03ef, 0x03f2,
+ 0x03ef, 0x03f3,
0x03f5, 0x03f5,
0x03f8, 0x03f8,
0x03fb, 0x03fb,
@@ -11909,6 +12822,10 @@ 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,
@@ -12158,6 +13075,8 @@ static const OnigCodePoint CR_Changes_When_Titlecased[] = {
0xa693, 0xa693,
0xa695, 0xa695,
0xa697, 0xa697,
+ 0xa699, 0xa699,
+ 0xa69b, 0xa69b,
0xa723, 0xa723,
0xa725, 0xa725,
0xa727, 0xa727,
@@ -12206,6 +13125,11 @@ 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,
@@ -12215,11 +13139,12 @@ 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[] = {
- 582,
+ 596,
0x0041, 0x005a,
0x00b5, 0x00b5,
0x00c0, 0x00d6,
@@ -12370,6 +13295,7 @@ static const OnigCodePoint CR_Changes_When_Casefolded[] = {
0x0370, 0x0370,
0x0372, 0x0372,
0x0376, 0x0376,
+ 0x037f, 0x037f,
0x0386, 0x0386,
0x0388, 0x038a,
0x038c, 0x038c,
@@ -12491,6 +13417,10 @@ 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,
@@ -12743,6 +13673,8 @@ static const OnigCodePoint CR_Changes_When_Casefolded[] = {
0xa692, 0xa692,
0xa694, 0xa694,
0xa696, 0xa696,
+ 0xa698, 0xa698,
+ 0xa69a, 0xa69a,
0xa722, 0xa722,
0xa724, 0xa724,
0xa726, 0xa726,
@@ -12792,21 +13724,28 @@ 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, 0xa7aa,
+ 0xa7aa, 0xa7ad,
+ 0xa7b0, 0xa7b1,
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[] = {
- 104,
+ 107,
0x0041, 0x005a,
0x0061, 0x007a,
0x00b5, 0x00b5,
@@ -12824,34 +13763,35 @@ static const OnigCodePoint CR_Changes_When_Casemapped[] = {
0x023a, 0x0254,
0x0256, 0x0257,
0x0259, 0x0259,
- 0x025b, 0x025b,
- 0x0260, 0x0260,
+ 0x025b, 0x025c,
+ 0x0260, 0x0261,
0x0263, 0x0263,
0x0265, 0x0266,
0x0268, 0x0269,
- 0x026b, 0x026b,
+ 0x026b, 0x026c,
0x026f, 0x026f,
0x0271, 0x0272,
0x0275, 0x0275,
0x027d, 0x027d,
0x0280, 0x0280,
0x0283, 0x0283,
- 0x0288, 0x028c,
+ 0x0287, 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, 0x03f2,
- 0x03f4, 0x03f5,
+ 0x03d5, 0x03f5,
0x03f7, 0x03fb,
0x03fd, 0x0481,
- 0x048a, 0x0527,
+ 0x048a, 0x052f,
0x0531, 0x0556,
0x0561, 0x0587,
0x10a0, 0x10c5,
@@ -12899,23 +13839,25 @@ static const OnigCodePoint CR_Changes_When_Casemapped[] = {
0x2d27, 0x2d27,
0x2d2d, 0x2d2d,
0xa640, 0xa66d,
- 0xa680, 0xa697,
+ 0xa680, 0xa69b,
0xa722, 0xa72f,
0xa732, 0xa76f,
0xa779, 0xa787,
0xa78b, 0xa78d,
0xa790, 0xa793,
- 0xa7a0, 0xa7aa,
+ 0xa796, 0xa7ad,
+ 0xa7b0, 0xa7b1,
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[] = {
- 488,
+ 538,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -12931,13 +13873,14 @@ 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, 0x0527,
+ 0x048a, 0x052f,
0x0531, 0x0556,
0x0559, 0x0559,
0x0561, 0x0587,
@@ -12963,14 +13906,12 @@ static const OnigCodePoint CR_ID_Start[] = {
0x0824, 0x0824,
0x0828, 0x0828,
0x0840, 0x0858,
- 0x08a0, 0x08a0,
- 0x08a2, 0x08ac,
+ 0x08a0, 0x08b2,
0x0904, 0x0939,
0x093d, 0x093d,
0x0950, 0x0950,
0x0958, 0x0961,
- 0x0971, 0x0977,
- 0x0979, 0x097f,
+ 0x0971, 0x0980,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -13025,8 +13966,7 @@ static const OnigCodePoint CR_ID_Start[] = {
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c33,
- 0x0c35, 0x0c39,
+ 0x0c2a, 0x0c39,
0x0c3d, 0x0c3d,
0x0c58, 0x0c59,
0x0c60, 0x0c61,
@@ -13110,7 +14050,7 @@ static const OnigCodePoint CR_ID_Start[] = {
0x166f, 0x167f,
0x1681, 0x169a,
0x16a0, 0x16ea,
- 0x16ee, 0x16f0,
+ 0x16ee, 0x16f8,
0x1700, 0x170c,
0x170e, 0x1711,
0x1720, 0x1731,
@@ -13124,7 +14064,7 @@ static const OnigCodePoint CR_ID_Start[] = {
0x1880, 0x18a8,
0x18aa, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191c,
+ 0x1900, 0x191e,
0x1950, 0x196d,
0x1970, 0x1974,
0x1980, 0x19ab,
@@ -13218,14 +14158,14 @@ static const OnigCodePoint CR_ID_Start[] = {
0xa610, 0xa61f,
0xa62a, 0xa62b,
0xa640, 0xa66e,
- 0xa67f, 0xa697,
+ 0xa67f, 0xa69d,
0xa6a0, 0xa6ef,
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa793,
- 0xa7a0, 0xa7aa,
- 0xa7f8, 0xa801,
+ 0xa790, 0xa7ad,
+ 0xa7b0, 0xa7b1,
+ 0xa7f7, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa822,
@@ -13238,12 +14178,15 @@ 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,
- 0xaa80, 0xaaaf,
+ 0xaa7e, 0xaaaf,
0xaab1, 0xaab1,
0xaab5, 0xaab6,
0xaab9, 0xaabd,
@@ -13257,6 +14200,9 @@ static const OnigCodePoint CR_ID_Start[] = {
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
+ 0xab30, 0xab5a,
+ 0xab5c, 0xab5f,
+ 0xab64, 0xab65,
0xabc0, 0xabe2,
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
@@ -13296,19 +14242,27 @@ static const OnigCodePoint CR_ID_Start[] = {
0x10140, 0x10174,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x10300, 0x1031e,
+ 0x10300, 0x1031f,
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,
@@ -13318,25 +14272,62 @@ 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,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
+ 0x118a0, 0x118df,
+ 0x118ff, 0x118ff,
+ 0x11ac0, 0x11af8,
+ 0x12000, 0x12398,
+ 0x12400, 0x1246e,
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,
@@ -13367,6 +14358,7 @@ static const OnigCodePoint CR_ID_Start[] = {
0x1d78a, 0x1d7a8,
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
+ 0x1e800, 0x1e8c4,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -13408,7 +14400,7 @@ static const OnigCodePoint CR_ID_Start[] = {
/* 'ID_Continue': Derived Property */
static const OnigCodePoint CR_ID_Continue[] = {
- 564,
+ 626,
0x0030, 0x0039,
0x0041, 0x005a,
0x005f, 0x005f,
@@ -13427,13 +14419,14 @@ 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, 0x0527,
+ 0x048a, 0x052f,
0x0531, 0x0556,
0x0559, 0x0559,
0x0561, 0x0587,
@@ -13457,14 +14450,10 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x07fa, 0x07fa,
0x0800, 0x082d,
0x0840, 0x085b,
- 0x08a0, 0x08a0,
- 0x08a2, 0x08ac,
- 0x08e4, 0x08fe,
- 0x0900, 0x0963,
+ 0x08a0, 0x08b2,
+ 0x08e4, 0x0963,
0x0966, 0x096f,
- 0x0971, 0x0977,
- 0x0979, 0x097f,
- 0x0981, 0x0983,
+ 0x0971, 0x0983,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -13538,12 +14527,11 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x0bd0, 0x0bd0,
0x0bd7, 0x0bd7,
0x0be6, 0x0bef,
- 0x0c01, 0x0c03,
+ 0x0c00, 0x0c03,
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c33,
- 0x0c35, 0x0c39,
+ 0x0c2a, 0x0c39,
0x0c3d, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4d,
@@ -13551,7 +14539,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x0c58, 0x0c59,
0x0c60, 0x0c63,
0x0c66, 0x0c6f,
- 0x0c82, 0x0c83,
+ 0x0c81, 0x0c83,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
0x0c92, 0x0ca8,
@@ -13565,7 +14553,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x0ce0, 0x0ce3,
0x0ce6, 0x0cef,
0x0cf1, 0x0cf2,
- 0x0d02, 0x0d03,
+ 0x0d01, 0x0d03,
0x0d05, 0x0d0c,
0x0d0e, 0x0d10,
0x0d12, 0x0d3a,
@@ -13586,6 +14574,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x0dcf, 0x0dd4,
0x0dd6, 0x0dd6,
0x0dd8, 0x0ddf,
+ 0x0de6, 0x0def,
0x0df2, 0x0df3,
0x0e01, 0x0e3a,
0x0e40, 0x0e4e,
@@ -13650,7 +14639,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x166f, 0x167f,
0x1681, 0x169a,
0x16a0, 0x16ea,
- 0x16ee, 0x16f0,
+ 0x16ee, 0x16f8,
0x1700, 0x170c,
0x170e, 0x1714,
0x1720, 0x1734,
@@ -13667,7 +14656,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1820, 0x1877,
0x1880, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191c,
+ 0x1900, 0x191e,
0x1920, 0x192b,
0x1930, 0x193b,
0x1946, 0x196d,
@@ -13681,6 +14670,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1a7f, 0x1a89,
0x1a90, 0x1a99,
0x1aa7, 0x1aa7,
+ 0x1ab0, 0x1abd,
0x1b00, 0x1b4b,
0x1b50, 0x1b59,
0x1b6b, 0x1b73,
@@ -13690,7 +14680,8 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1c4d, 0x1c7d,
0x1cd0, 0x1cd2,
0x1cd4, 0x1cf6,
- 0x1d00, 0x1de6,
+ 0x1cf8, 0x1cf9,
+ 0x1d00, 0x1df5,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
0x1f20, 0x1f45,
@@ -13770,14 +14761,14 @@ static const OnigCodePoint CR_ID_Continue[] = {
0xa610, 0xa62b,
0xa640, 0xa66f,
0xa674, 0xa67d,
- 0xa67f, 0xa697,
+ 0xa67f, 0xa69d,
0xa69f, 0xa6f1,
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa793,
- 0xa7a0, 0xa7aa,
- 0xa7f8, 0xa827,
+ 0xa790, 0xa7ad,
+ 0xa7b0, 0xa7b1,
+ 0xa7f7, 0xa827,
0xa840, 0xa873,
0xa880, 0xa8c4,
0xa8d0, 0xa8d9,
@@ -13788,12 +14779,12 @@ static const OnigCodePoint CR_ID_Continue[] = {
0xa960, 0xa97c,
0xa980, 0xa9c0,
0xa9cf, 0xa9d9,
+ 0xa9e0, 0xa9fe,
0xaa00, 0xaa36,
0xaa40, 0xaa4d,
0xaa50, 0xaa59,
0xaa60, 0xaa76,
- 0xaa7a, 0xaa7b,
- 0xaa80, 0xaac2,
+ 0xaa7a, 0xaac2,
0xaadb, 0xaadd,
0xaae0, 0xaaef,
0xaaf2, 0xaaf6,
@@ -13802,6 +14793,9 @@ static const OnigCodePoint CR_ID_Continue[] = {
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
+ 0xab30, 0xab5a,
+ 0xab5c, 0xab5f,
+ 0xab64, 0xab65,
0xabc0, 0xabea,
0xabec, 0xabed,
0xabf0, 0xabf9,
@@ -13824,7 +14818,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
0xfd92, 0xfdc7,
0xfdf0, 0xfdfb,
0xfe00, 0xfe0f,
- 0xfe20, 0xfe26,
+ 0xfe20, 0xfe2d,
0xfe33, 0xfe34,
0xfe4d, 0xfe4f,
0xfe70, 0xfe74,
@@ -13849,20 +14843,29 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x101fd, 0x101fd,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x10300, 0x1031e,
+ 0x102e0, 0x102e0,
+ 0x10300, 0x1031f,
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,
@@ -13875,29 +14878,78 @@ 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,
- 0x11080, 0x110ba,
+ 0x1107f, 0x110ba,
0x110d0, 0x110e8,
0x110f0, 0x110f9,
0x11100, 0x11134,
0x11136, 0x1113f,
+ 0x11150, 0x11173,
+ 0x11176, 0x11176,
0x11180, 0x111c4,
- 0x111d0, 0x111d9,
+ 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,
0x11680, 0x116b7,
0x116c0, 0x116c9,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
+ 0x118a0, 0x118e9,
+ 0x118ff, 0x118ff,
+ 0x11ac0, 0x11af8,
+ 0x12000, 0x12398,
+ 0x12400, 0x1246e,
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,
@@ -13935,6 +14987,8 @@ static const OnigCodePoint CR_ID_Continue[] = {
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
0x1d7ce, 0x1d7ff,
+ 0x1e800, 0x1e8c4,
+ 0x1e8d0, 0x1e8d6,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -13977,7 +15031,7 @@ static const OnigCodePoint CR_ID_Continue[] = {
/* 'XID_Start': Derived Property */
static const OnigCodePoint CR_XID_Start[] = {
- 495,
+ 545,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -13993,13 +15047,14 @@ 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, 0x0527,
+ 0x048a, 0x052f,
0x0531, 0x0556,
0x0559, 0x0559,
0x0561, 0x0587,
@@ -14025,14 +15080,12 @@ static const OnigCodePoint CR_XID_Start[] = {
0x0824, 0x0824,
0x0828, 0x0828,
0x0840, 0x0858,
- 0x08a0, 0x08a0,
- 0x08a2, 0x08ac,
+ 0x08a0, 0x08b2,
0x0904, 0x0939,
0x093d, 0x093d,
0x0950, 0x0950,
0x0958, 0x0961,
- 0x0971, 0x0977,
- 0x0979, 0x097f,
+ 0x0971, 0x0980,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -14087,8 +15140,7 @@ static const OnigCodePoint CR_XID_Start[] = {
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c33,
- 0x0c35, 0x0c39,
+ 0x0c2a, 0x0c39,
0x0c3d, 0x0c3d,
0x0c58, 0x0c59,
0x0c60, 0x0c61,
@@ -14172,7 +15224,7 @@ static const OnigCodePoint CR_XID_Start[] = {
0x166f, 0x167f,
0x1681, 0x169a,
0x16a0, 0x16ea,
- 0x16ee, 0x16f0,
+ 0x16ee, 0x16f8,
0x1700, 0x170c,
0x170e, 0x1711,
0x1720, 0x1731,
@@ -14186,7 +15238,7 @@ static const OnigCodePoint CR_XID_Start[] = {
0x1880, 0x18a8,
0x18aa, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191c,
+ 0x1900, 0x191e,
0x1950, 0x196d,
0x1970, 0x1974,
0x1980, 0x19ab,
@@ -14280,14 +15332,14 @@ static const OnigCodePoint CR_XID_Start[] = {
0xa610, 0xa61f,
0xa62a, 0xa62b,
0xa640, 0xa66e,
- 0xa67f, 0xa697,
+ 0xa67f, 0xa69d,
0xa6a0, 0xa6ef,
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa793,
- 0xa7a0, 0xa7aa,
- 0xa7f8, 0xa801,
+ 0xa790, 0xa7ad,
+ 0xa7b0, 0xa7b1,
+ 0xa7f7, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa822,
@@ -14300,12 +15352,15 @@ 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,
- 0xaa80, 0xaaaf,
+ 0xaa7e, 0xaaaf,
0xaab1, 0xaab1,
0xaab5, 0xaab6,
0xaab9, 0xaabd,
@@ -14319,6 +15374,9 @@ static const OnigCodePoint CR_XID_Start[] = {
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
+ 0xab30, 0xab5a,
+ 0xab5c, 0xab5f,
+ 0xab64, 0xab65,
0xabc0, 0xabe2,
0xac00, 0xd7a3,
0xd7b0, 0xd7c6,
@@ -14365,19 +15423,27 @@ static const OnigCodePoint CR_XID_Start[] = {
0x10140, 0x10174,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x10300, 0x1031e,
+ 0x10300, 0x1031f,
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,
@@ -14387,25 +15453,62 @@ 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,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
+ 0x118a0, 0x118df,
+ 0x118ff, 0x118ff,
+ 0x11ac0, 0x11af8,
+ 0x12000, 0x12398,
+ 0x12400, 0x1246e,
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,
@@ -14436,6 +15539,7 @@ static const OnigCodePoint CR_XID_Start[] = {
0x1d78a, 0x1d7a8,
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
+ 0x1e800, 0x1e8c4,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -14477,7 +15581,7 @@ static const OnigCodePoint CR_XID_Start[] = {
/* 'XID_Continue': Derived Property */
static const OnigCodePoint CR_XID_Continue[] = {
- 571,
+ 633,
0x0030, 0x0039,
0x0041, 0x005a,
0x005f, 0x005f,
@@ -14496,13 +15600,14 @@ 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, 0x0527,
+ 0x048a, 0x052f,
0x0531, 0x0556,
0x0559, 0x0559,
0x0561, 0x0587,
@@ -14526,14 +15631,10 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x07fa, 0x07fa,
0x0800, 0x082d,
0x0840, 0x085b,
- 0x08a0, 0x08a0,
- 0x08a2, 0x08ac,
- 0x08e4, 0x08fe,
- 0x0900, 0x0963,
+ 0x08a0, 0x08b2,
+ 0x08e4, 0x0963,
0x0966, 0x096f,
- 0x0971, 0x0977,
- 0x0979, 0x097f,
- 0x0981, 0x0983,
+ 0x0971, 0x0983,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -14607,12 +15708,11 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x0bd0, 0x0bd0,
0x0bd7, 0x0bd7,
0x0be6, 0x0bef,
- 0x0c01, 0x0c03,
+ 0x0c00, 0x0c03,
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c33,
- 0x0c35, 0x0c39,
+ 0x0c2a, 0x0c39,
0x0c3d, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4d,
@@ -14620,7 +15720,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x0c58, 0x0c59,
0x0c60, 0x0c63,
0x0c66, 0x0c6f,
- 0x0c82, 0x0c83,
+ 0x0c81, 0x0c83,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
0x0c92, 0x0ca8,
@@ -14634,7 +15734,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x0ce0, 0x0ce3,
0x0ce6, 0x0cef,
0x0cf1, 0x0cf2,
- 0x0d02, 0x0d03,
+ 0x0d01, 0x0d03,
0x0d05, 0x0d0c,
0x0d0e, 0x0d10,
0x0d12, 0x0d3a,
@@ -14655,6 +15755,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x0dcf, 0x0dd4,
0x0dd6, 0x0dd6,
0x0dd8, 0x0ddf,
+ 0x0de6, 0x0def,
0x0df2, 0x0df3,
0x0e01, 0x0e3a,
0x0e40, 0x0e4e,
@@ -14719,7 +15820,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x166f, 0x167f,
0x1681, 0x169a,
0x16a0, 0x16ea,
- 0x16ee, 0x16f0,
+ 0x16ee, 0x16f8,
0x1700, 0x170c,
0x170e, 0x1714,
0x1720, 0x1734,
@@ -14736,7 +15837,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1820, 0x1877,
0x1880, 0x18aa,
0x18b0, 0x18f5,
- 0x1900, 0x191c,
+ 0x1900, 0x191e,
0x1920, 0x192b,
0x1930, 0x193b,
0x1946, 0x196d,
@@ -14750,6 +15851,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1a7f, 0x1a89,
0x1a90, 0x1a99,
0x1aa7, 0x1aa7,
+ 0x1ab0, 0x1abd,
0x1b00, 0x1b4b,
0x1b50, 0x1b59,
0x1b6b, 0x1b73,
@@ -14759,7 +15861,8 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1c4d, 0x1c7d,
0x1cd0, 0x1cd2,
0x1cd4, 0x1cf6,
- 0x1d00, 0x1de6,
+ 0x1cf8, 0x1cf9,
+ 0x1d00, 0x1df5,
0x1dfc, 0x1f15,
0x1f18, 0x1f1d,
0x1f20, 0x1f45,
@@ -14840,14 +15943,14 @@ static const OnigCodePoint CR_XID_Continue[] = {
0xa610, 0xa62b,
0xa640, 0xa66f,
0xa674, 0xa67d,
- 0xa67f, 0xa697,
+ 0xa67f, 0xa69d,
0xa69f, 0xa6f1,
0xa717, 0xa71f,
0xa722, 0xa788,
0xa78b, 0xa78e,
- 0xa790, 0xa793,
- 0xa7a0, 0xa7aa,
- 0xa7f8, 0xa827,
+ 0xa790, 0xa7ad,
+ 0xa7b0, 0xa7b1,
+ 0xa7f7, 0xa827,
0xa840, 0xa873,
0xa880, 0xa8c4,
0xa8d0, 0xa8d9,
@@ -14858,12 +15961,12 @@ static const OnigCodePoint CR_XID_Continue[] = {
0xa960, 0xa97c,
0xa980, 0xa9c0,
0xa9cf, 0xa9d9,
+ 0xa9e0, 0xa9fe,
0xaa00, 0xaa36,
0xaa40, 0xaa4d,
0xaa50, 0xaa59,
0xaa60, 0xaa76,
- 0xaa7a, 0xaa7b,
- 0xaa80, 0xaac2,
+ 0xaa7a, 0xaac2,
0xaadb, 0xaadd,
0xaae0, 0xaaef,
0xaaf2, 0xaaf6,
@@ -14872,6 +15975,9 @@ static const OnigCodePoint CR_XID_Continue[] = {
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
+ 0xab30, 0xab5a,
+ 0xab5c, 0xab5f,
+ 0xab64, 0xab65,
0xabc0, 0xabea,
0xabec, 0xabed,
0xabf0, 0xabf9,
@@ -14895,7 +16001,7 @@ static const OnigCodePoint CR_XID_Continue[] = {
0xfd92, 0xfdc7,
0xfdf0, 0xfdf9,
0xfe00, 0xfe0f,
- 0xfe20, 0xfe26,
+ 0xfe20, 0xfe2d,
0xfe33, 0xfe34,
0xfe4d, 0xfe4f,
0xfe71, 0xfe71,
@@ -14925,20 +16031,29 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x101fd, 0x101fd,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x10300, 0x1031e,
+ 0x102e0, 0x102e0,
+ 0x10300, 0x1031f,
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,
@@ -14951,29 +16066,78 @@ 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,
- 0x11080, 0x110ba,
+ 0x1107f, 0x110ba,
0x110d0, 0x110e8,
0x110f0, 0x110f9,
0x11100, 0x11134,
0x11136, 0x1113f,
+ 0x11150, 0x11173,
+ 0x11176, 0x11176,
0x11180, 0x111c4,
- 0x111d0, 0x111d9,
+ 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,
0x11680, 0x116b7,
0x116c0, 0x116c9,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
+ 0x118a0, 0x118e9,
+ 0x118ff, 0x118ff,
+ 0x11ac0, 0x11af8,
+ 0x12000, 0x12398,
+ 0x12400, 0x1246e,
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,
@@ -15011,6 +16175,8 @@ static const OnigCodePoint CR_XID_Continue[] = {
0x1d7aa, 0x1d7c2,
0x1d7c4, 0x1d7cb,
0x1d7ce, 0x1d7ff,
+ 0x1e800, 0x1e8c4,
+ 0x1e8d0, 0x1e8d6,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -15053,12 +16219,13 @@ static const OnigCodePoint CR_XID_Continue[] = {
/* 'Default_Ignorable_Code_Point': Derived Property */
static const OnigCodePoint CR_Default_Ignorable_Code_Point[] = {
- 15,
+ 17,
0x00ad, 0x00ad,
0x034f, 0x034f,
+ 0x061c, 0x061c,
0x115f, 0x1160,
0x17b4, 0x17b5,
- 0x180b, 0x180d,
+ 0x180b, 0x180e,
0x200b, 0x200f,
0x202a, 0x202e,
0x2060, 0x206f,
@@ -15067,13 +16234,14 @@ 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[] = {
- 232,
+ 272,
0x0300, 0x036f,
0x0483, 0x0489,
0x0591, 0x05bd,
@@ -15097,8 +16265,7 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x0825, 0x0827,
0x0829, 0x082d,
0x0859, 0x085b,
- 0x08e4, 0x08fe,
- 0x0900, 0x0902,
+ 0x08e4, 0x0902,
0x093a, 0x093a,
0x093c, 0x093c,
0x0941, 0x0948,
@@ -15138,11 +16305,13 @@ 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,
@@ -15150,6 +16319,7 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x0ccc, 0x0ccd,
0x0cd5, 0x0cd6,
0x0ce2, 0x0ce3,
+ 0x0d01, 0x0d01,
0x0d3e, 0x0d3e,
0x0d41, 0x0d44,
0x0d4d, 0x0d4d,
@@ -15205,6 +16375,7 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x1932, 0x1932,
0x1939, 0x193b,
0x1a17, 0x1a18,
+ 0x1a1b, 0x1a1b,
0x1a56, 0x1a56,
0x1a58, 0x1a5e,
0x1a60, 0x1a60,
@@ -15212,6 +16383,7 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x1a65, 0x1a6c,
0x1a73, 0x1a7c,
0x1a7f, 0x1a7f,
+ 0x1ab0, 0x1abe,
0x1b00, 0x1b03,
0x1b34, 0x1b34,
0x1b36, 0x1b3a,
@@ -15221,7 +16393,7 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x1b80, 0x1b81,
0x1ba2, 0x1ba5,
0x1ba8, 0x1ba9,
- 0x1bab, 0x1bab,
+ 0x1bab, 0x1bad,
0x1be6, 0x1be6,
0x1be8, 0x1be9,
0x1bed, 0x1bed,
@@ -15233,7 +16405,8 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0x1ce2, 0x1ce8,
0x1ced, 0x1ced,
0x1cf4, 0x1cf4,
- 0x1dc0, 0x1de6,
+ 0x1cf8, 0x1cf9,
+ 0x1dc0, 0x1df5,
0x1dfc, 0x1dff,
0x200c, 0x200d,
0x20d0, 0x20f0,
@@ -15258,11 +16431,13 @@ 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,
@@ -15275,29 +16450,61 @@ static const OnigCodePoint CR_Grapheme_Extend[] = {
0xabed, 0xabed,
0xfb1e, 0xfb1e,
0xfe00, 0xfe0f,
- 0xfe20, 0xfe26,
+ 0xfe20, 0xfe2d,
0xff9e, 0xff9f,
0x101fd, 0x101fd,
+ 0x102e0, 0x102e0,
+ 0x10376, 0x1037a,
0x10a01, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a0f,
0x10a38, 0x10a3a,
0x10a3f, 0x10a3f,
+ 0x10ae5, 0x10ae6,
0x11001, 0x11001,
0x11038, 0x11046,
- 0x11080, 0x11081,
+ 0x1107f, 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,
@@ -15305,27 +16512,28 @@ 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[] = {
- 643,
+ 724,
0x0020, 0x007e,
0x00a0, 0x00ac,
0x00ae, 0x02ff,
0x0370, 0x0377,
- 0x037a, 0x037e,
+ 0x037a, 0x037f,
0x0384, 0x038a,
0x038c, 0x038c,
0x038e, 0x03a1,
0x03a3, 0x0482,
- 0x048a, 0x0527,
+ 0x048a, 0x052f,
0x0531, 0x0556,
0x0559, 0x055f,
0x0561, 0x0587,
0x0589, 0x058a,
- 0x058f, 0x058f,
+ 0x058d, 0x058f,
0x05be, 0x05be,
0x05c0, 0x05c0,
0x05c3, 0x05c3,
@@ -15354,16 +16562,14 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x0830, 0x083e,
0x0840, 0x0858,
0x085e, 0x085e,
- 0x08a0, 0x08a0,
- 0x08a2, 0x08ac,
+ 0x08a0, 0x08b2,
0x0903, 0x0939,
0x093b, 0x093b,
0x093d, 0x0940,
0x0949, 0x094c,
0x094e, 0x0950,
0x0958, 0x0961,
- 0x0964, 0x0977,
- 0x0979, 0x097f,
+ 0x0964, 0x0980,
0x0982, 0x0983,
0x0985, 0x098c,
0x098f, 0x0990,
@@ -15439,8 +16645,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c33,
- 0x0c35, 0x0c39,
+ 0x0c2a, 0x0c39,
0x0c3d, 0x0c3d,
0x0c41, 0x0c44,
0x0c58, 0x0c59,
@@ -15482,6 +16687,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x0dc0, 0x0dc6,
0x0dd0, 0x0dd1,
0x0dd8, 0x0dde,
+ 0x0de6, 0x0def,
0x0df2, 0x0df4,
0x0e01, 0x0e30,
0x0e32, 0x0e33,
@@ -15551,7 +16757,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1380, 0x1399,
0x13a0, 0x13f4,
0x1400, 0x169c,
- 0x16a0, 0x16f0,
+ 0x16a0, 0x16f8,
0x1700, 0x170c,
0x170e, 0x1711,
0x1720, 0x1731,
@@ -15567,13 +16773,12 @@ 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, 0x191c,
+ 0x1900, 0x191e,
0x1923, 0x1926,
0x1929, 0x192b,
0x1930, 0x1931,
@@ -15585,7 +16790,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x19b0, 0x19c9,
0x19d0, 0x19da,
0x19de, 0x1a16,
- 0x1a19, 0x1a1b,
+ 0x1a19, 0x1a1a,
0x1a1e, 0x1a55,
0x1a57, 0x1a57,
0x1a61, 0x1a61,
@@ -15604,7 +16809,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1b82, 0x1ba1,
0x1ba6, 0x1ba7,
0x1baa, 0x1baa,
- 0x1bac, 0x1be5,
+ 0x1bae, 0x1be5,
0x1be7, 0x1be7,
0x1bea, 0x1bec,
0x1bee, 0x1bee,
@@ -15642,14 +16847,16 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x2070, 0x2071,
0x2074, 0x208e,
0x2090, 0x209c,
- 0x20a0, 0x20b9,
+ 0x20a0, 0x20bd,
0x2100, 0x2189,
- 0x2190, 0x23f3,
+ 0x2190, 0x23fa,
0x2400, 0x2426,
0x2440, 0x244a,
- 0x2460, 0x26ff,
- 0x2701, 0x2b4c,
- 0x2b50, 0x2b59,
+ 0x2460, 0x2b73,
+ 0x2b76, 0x2b95,
+ 0x2b98, 0x2bb9,
+ 0x2bbd, 0x2bc8,
+ 0x2bca, 0x2bd1,
0x2c00, 0x2c2e,
0x2c30, 0x2c5e,
0x2c60, 0x2cee,
@@ -15668,7 +16875,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x2dc8, 0x2dce,
0x2dd0, 0x2dd6,
0x2dd8, 0x2dde,
- 0x2e00, 0x2e3b,
+ 0x2e00, 0x2e42,
0x2e80, 0x2e99,
0x2e9b, 0x2ef3,
0x2f00, 0x2fd5,
@@ -15690,13 +16897,13 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0xa4d0, 0xa62b,
0xa640, 0xa66e,
0xa673, 0xa673,
- 0xa67e, 0xa697,
+ 0xa67e, 0xa69d,
0xa6a0, 0xa6ef,
0xa6f2, 0xa6f7,
0xa700, 0xa78e,
- 0xa790, 0xa793,
- 0xa7a0, 0xa7aa,
- 0xa7f8, 0xa801,
+ 0xa790, 0xa7ad,
+ 0xa7b0, 0xa7b1,
+ 0xa7f7, 0xa801,
0xa803, 0xa805,
0xa807, 0xa80a,
0xa80c, 0xa824,
@@ -15715,7 +16922,8 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0xa9ba, 0xa9bb,
0xa9bd, 0xa9cd,
0xa9cf, 0xa9d9,
- 0xa9de, 0xa9df,
+ 0xa9de, 0xa9e4,
+ 0xa9e6, 0xa9fe,
0xaa00, 0xaa28,
0xaa2f, 0xaa30,
0xaa33, 0xaa34,
@@ -15724,7 +16932,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0xaa4d, 0xaa4d,
0xaa50, 0xaa59,
0xaa5c, 0xaa7b,
- 0xaa80, 0xaaaf,
+ 0xaa7d, 0xaaaf,
0xaab1, 0xaab1,
0xaab5, 0xaab6,
0xaab9, 0xaabd,
@@ -15737,6 +16945,8 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0xab11, 0xab16,
0xab20, 0xab26,
0xab28, 0xab2e,
+ 0xab30, 0xab5f,
+ 0xab64, 0xab65,
0xabc0, 0xabe4,
0xabe6, 0xabe7,
0xabe9, 0xabec,
@@ -15783,26 +16993,35 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x10080, 0x100fa,
0x10100, 0x10102,
0x10107, 0x10133,
- 0x10137, 0x1018a,
+ 0x10137, 0x1018c,
0x10190, 0x1019b,
+ 0x101a0, 0x101a0,
0x101d0, 0x101fc,
0x10280, 0x1029c,
0x102a0, 0x102d0,
- 0x10300, 0x1031e,
- 0x10320, 0x10323,
+ 0x102e1, 0x102fb,
+ 0x10300, 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, 0x1085f,
+ 0x10857, 0x1089e,
+ 0x108a7, 0x108af,
0x10900, 0x1091b,
0x1091f, 0x10939,
0x1093f, 0x1093f,
@@ -15814,11 +17033,15 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x10a19, 0x10a33,
0x10a40, 0x10a47,
0x10a50, 0x10a58,
- 0x10a60, 0x10a7f,
+ 0x10a60, 0x10a9f,
+ 0x10ac0, 0x10ae4,
+ 0x10aeb, 0x10af6,
0x10b00, 0x10b35,
0x10b39, 0x10b55,
0x10b58, 0x10b72,
- 0x10b78, 0x10b7f,
+ 0x10b78, 0x10b91,
+ 0x10b99, 0x10b9c,
+ 0x10ba9, 0x10baf,
0x10c00, 0x10c48,
0x10e60, 0x10e7e,
0x11000, 0x11000,
@@ -15834,23 +17057,86 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x11103, 0x11126,
0x1112c, 0x1112c,
0x11136, 0x11143,
+ 0x11150, 0x11172,
+ 0x11174, 0x11176,
0x11182, 0x111b5,
0x111bf, 0x111c8,
- 0x111d0, 0x111d9,
+ 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,
0x11680, 0x116aa,
0x116ac, 0x116ac,
0x116ae, 0x116af,
0x116b6, 0x116b6,
0x116c0, 0x116c9,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
- 0x12470, 0x12473,
+ 0x118a0, 0x118f2,
+ 0x118ff, 0x118ff,
+ 0x11ac0, 0x11af8,
+ 0x12000, 0x12398,
+ 0x12400, 0x1246e,
+ 0x12470, 0x12474,
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,
@@ -15884,6 +17170,8 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1d552, 0x1d6a5,
0x1d6a8, 0x1d7cb,
0x1d7ce, 0x1d7ff,
+ 0x1e800, 0x1e8c4,
+ 0x1e8c7, 0x1e8cf,
0x1ee00, 0x1ee03,
0x1ee05, 0x1ee1f,
0x1ee21, 0x1ee22,
@@ -15921,10 +17209,10 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
0x1f000, 0x1f02b,
0x1f030, 0x1f093,
0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0be,
+ 0x1f0b1, 0x1f0bf,
0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0df,
- 0x1f100, 0x1f10a,
+ 0x1f0d1, 0x1f0f5,
+ 0x1f100, 0x1f10c,
0x1f110, 0x1f12e,
0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
@@ -15932,24 +17220,25 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
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,
+ 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,
0x20000, 0x2a6d6,
0x2a700, 0x2b734,
0x2b740, 0x2b81d,
@@ -15958,7 +17247,7 @@ static const OnigCodePoint CR_Grapheme_Base[] = {
/* 'Grapheme_Link': Derived Property */
static const OnigCodePoint CR_Grapheme_Link[] = {
- 33,
+ 40,
0x094d, 0x094d,
0x09cd, 0x09cd,
0x0a4d, 0x0a4d,
@@ -15988,15 +17277,22 @@ 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[] = {
- 157,
+ 165,
0x0000, 0x0040,
0x005b, 0x0060,
0x007b, 0x00a9,
@@ -16012,8 +17308,9 @@ static const OnigCodePoint CR_Common[] = {
0x0385, 0x0385,
0x0387, 0x0387,
0x0589, 0x0589,
+ 0x0605, 0x0605,
0x060c, 0x060c,
- 0x061b, 0x061b,
+ 0x061b, 0x061c,
0x061f, 0x061f,
0x0640, 0x0640,
0x0660, 0x0669,
@@ -16033,24 +17330,26 @@ static const OnigCodePoint CR_Common[] = {
0x1cf5, 0x1cf6,
0x2000, 0x200b,
0x200e, 0x2064,
- 0x206a, 0x2070,
+ 0x2066, 0x2070,
0x2074, 0x207e,
0x2080, 0x208e,
- 0x20a0, 0x20b9,
+ 0x20a0, 0x20bd,
0x2100, 0x2125,
0x2127, 0x2129,
0x212c, 0x2131,
0x2133, 0x214d,
0x214f, 0x215f,
0x2189, 0x2189,
- 0x2190, 0x23f3,
+ 0x2190, 0x23fa,
0x2400, 0x2426,
0x2440, 0x244a,
- 0x2460, 0x26ff,
- 0x2701, 0x27ff,
- 0x2900, 0x2b4c,
- 0x2b50, 0x2b59,
- 0x2e00, 0x2e3b,
+ 0x2460, 0x27ff,
+ 0x2900, 0x2b73,
+ 0x2b76, 0x2b95,
+ 0x2b98, 0x2bb9,
+ 0x2bbd, 0x2bc8,
+ 0x2bca, 0x2bd1,
+ 0x2e00, 0x2e42,
0x2ff0, 0x2ffb,
0x3000, 0x3004,
0x3006, 0x3006,
@@ -16069,8 +17368,10 @@ 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,
@@ -16089,6 +17390,8 @@ static const OnigCodePoint CR_Common[] = {
0x10137, 0x1013f,
0x10190, 0x1019b,
0x101d0, 0x101fc,
+ 0x102e1, 0x102fb,
+ 0x1bca0, 0x1bca3,
0x1d000, 0x1d0f5,
0x1d100, 0x1d126,
0x1d129, 0x1d166,
@@ -16122,10 +17425,10 @@ static const OnigCodePoint CR_Common[] = {
0x1f000, 0x1f02b,
0x1f030, 0x1f093,
0x1f0a0, 0x1f0ae,
- 0x1f0b1, 0x1f0be,
+ 0x1f0b1, 0x1f0bf,
0x1f0c1, 0x1f0cf,
- 0x1f0d1, 0x1f0df,
- 0x1f100, 0x1f10a,
+ 0x1f0d1, 0x1f0f5,
+ 0x1f100, 0x1f10c,
0x1f110, 0x1f12e,
0x1f130, 0x1f16b,
0x1f170, 0x1f19a,
@@ -16134,31 +17437,32 @@ static const OnigCodePoint CR_Common[] = {
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,
+ 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,
0xe0001, 0xe0001,
0xe0020, 0xe007f,
}; /* CR_Common */
/* 'Latin': Script */
static const OnigCodePoint CR_Latin[] = {
- 30,
+ 33,
0x0041, 0x005a,
0x0061, 0x007a,
0x00aa, 0x00aa,
@@ -16183,9 +17487,12 @@ static const OnigCodePoint CR_Latin[] = {
0x2c60, 0x2c7f,
0xa722, 0xa787,
0xa78b, 0xa78e,
- 0xa790, 0xa793,
- 0xa7a0, 0xa7aa,
- 0xa7f8, 0xa7ff,
+ 0xa790, 0xa7ad,
+ 0xa7b0, 0xa7b1,
+ 0xa7f7, 0xa7ff,
+ 0xab30, 0xab5a,
+ 0xab5c, 0xab5f,
+ 0xab64, 0xab64,
0xfb00, 0xfb06,
0xff21, 0xff3a,
0xff41, 0xff5a,
@@ -16193,10 +17500,11 @@ static const OnigCodePoint CR_Latin[] = {
/* 'Greek': Script */
static const OnigCodePoint CR_Greek[] = {
- 33,
+ 36,
0x0370, 0x0373,
0x0375, 0x0377,
0x037a, 0x037d,
+ 0x037f, 0x037f,
0x0384, 0x0384,
0x0386, 0x0386,
0x0388, 0x038a,
@@ -16225,7 +17533,9 @@ static const OnigCodePoint CR_Greek[] = {
0x1ff2, 0x1ff4,
0x1ff6, 0x1ffe,
0x2126, 0x2126,
- 0x10140, 0x1018a,
+ 0xab65, 0xab65,
+ 0x10140, 0x1018c,
+ 0x101a0, 0x101a0,
0x1d200, 0x1d245,
}; /* CR_Greek */
@@ -16233,11 +17543,11 @@ static const OnigCodePoint CR_Greek[] = {
static const OnigCodePoint CR_Cyrillic[] = {
7,
0x0400, 0x0484,
- 0x0487, 0x0527,
+ 0x0487, 0x052f,
0x1d2b, 0x1d2b,
0x1d78, 0x1d78,
0x2de0, 0x2dff,
- 0xa640, 0xa697,
+ 0xa640, 0xa69d,
0xa69f, 0xa69f,
}; /* CR_Cyrillic */
@@ -16248,7 +17558,7 @@ static const OnigCodePoint CR_Armenian[] = {
0x0559, 0x055f,
0x0561, 0x0587,
0x058a, 0x058a,
- 0x058f, 0x058f,
+ 0x058d, 0x058f,
0xfb13, 0xfb17,
}; /* CR_Armenian */
@@ -16268,26 +17578,25 @@ static const OnigCodePoint CR_Hebrew[] = {
/* 'Arabic': Script */
static const OnigCodePoint CR_Arabic[] = {
- 56,
+ 55,
0x0600, 0x0604,
0x0606, 0x060b,
0x060d, 0x061a,
0x061e, 0x061e,
0x0620, 0x063f,
0x0641, 0x064a,
- 0x0656, 0x065e,
+ 0x0656, 0x065f,
0x066a, 0x066f,
0x0671, 0x06dc,
0x06de, 0x06ff,
0x0750, 0x077f,
- 0x08a0, 0x08a0,
- 0x08a2, 0x08ac,
- 0x08e4, 0x08fe,
+ 0x08a0, 0x08b2,
+ 0x08e4, 0x08ff,
0xfb50, 0xfbc1,
0xfbd3, 0xfd3d,
0xfd50, 0xfd8f,
0xfd92, 0xfdc7,
- 0xfdf0, 0xfdfc,
+ 0xfdf0, 0xfdfd,
0xfe70, 0xfe74,
0xfe76, 0xfefc,
0x10e60, 0x10e7e,
@@ -16343,18 +17652,17 @@ static const OnigCodePoint CR_Thaana[] = {
/* 'Devanagari': Script */
static const OnigCodePoint CR_Devanagari[] = {
- 5,
+ 4,
0x0900, 0x0950,
0x0953, 0x0963,
- 0x0966, 0x0977,
- 0x0979, 0x097f,
+ 0x0966, 0x097f,
0xa8e0, 0xa8fb,
}; /* CR_Devanagari */
/* 'Bengali': Script */
static const OnigCodePoint CR_Bengali[] = {
14,
- 0x0981, 0x0983,
+ 0x0980, 0x0983,
0x0985, 0x098c,
0x098f, 0x0990,
0x0993, 0x09a8,
@@ -16451,13 +17759,12 @@ static const OnigCodePoint CR_Tamil[] = {
/* 'Telugu': Script */
static const OnigCodePoint CR_Telugu[] = {
- 14,
- 0x0c01, 0x0c03,
+ 13,
+ 0x0c00, 0x0c03,
0x0c05, 0x0c0c,
0x0c0e, 0x0c10,
0x0c12, 0x0c28,
- 0x0c2a, 0x0c33,
- 0x0c35, 0x0c39,
+ 0x0c2a, 0x0c39,
0x0c3d, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4d,
@@ -16471,7 +17778,7 @@ static const OnigCodePoint CR_Telugu[] = {
/* 'Kannada': Script */
static const OnigCodePoint CR_Kannada[] = {
14,
- 0x0c82, 0x0c83,
+ 0x0c81, 0x0c83,
0x0c85, 0x0c8c,
0x0c8e, 0x0c90,
0x0c92, 0x0ca8,
@@ -16490,7 +17797,7 @@ static const OnigCodePoint CR_Kannada[] = {
/* 'Malayalam': Script */
static const OnigCodePoint CR_Malayalam[] = {
11,
- 0x0d02, 0x0d03,
+ 0x0d01, 0x0d03,
0x0d05, 0x0d0c,
0x0d0e, 0x0d10,
0x0d12, 0x0d3a,
@@ -16505,7 +17812,7 @@ static const OnigCodePoint CR_Malayalam[] = {
/* 'Sinhala': Script */
static const OnigCodePoint CR_Sinhala[] = {
- 11,
+ 13,
0x0d82, 0x0d83,
0x0d85, 0x0d96,
0x0d9a, 0x0db1,
@@ -16516,7 +17823,9 @@ static const OnigCodePoint CR_Sinhala[] = {
0x0dcf, 0x0dd4,
0x0dd6, 0x0dd6,
0x0dd8, 0x0ddf,
+ 0x0de6, 0x0def,
0x0df2, 0x0df4,
+ 0x111e1, 0x111f4,
}; /* CR_Sinhala */
/* 'Thai': Script */
@@ -16563,9 +17872,10 @@ static const OnigCodePoint CR_Tibetan[] = {
/* 'Myanmar': Script */
static const OnigCodePoint CR_Myanmar[] = {
- 2,
+ 3,
0x1000, 0x109f,
- 0xaa60, 0xaa7b,
+ 0xa9e0, 0xa9fe,
+ 0xaa60, 0xaa7f,
}; /* CR_Myanmar */
/* 'Georgian': Script */
@@ -16660,7 +17970,7 @@ static const OnigCodePoint CR_Ogham[] = {
static const OnigCodePoint CR_Runic[] = {
2,
0x16a0, 0x16ea,
- 0x16ee, 0x16f0,
+ 0x16ee, 0x16f8,
}; /* CR_Runic */
/* 'Khmer': Script */
@@ -16742,9 +18052,8 @@ static const OnigCodePoint CR_Yi[] = {
/* 'Old_Italic': Script */
static const OnigCodePoint CR_Old_Italic[] = {
- 2,
- 0x10300, 0x1031e,
- 0x10320, 0x10323,
+ 1,
+ 0x10300, 0x10323,
}; /* CR_Old_Italic */
/* 'Gothic': Script */
@@ -16761,27 +18070,29 @@ static const OnigCodePoint CR_Deseret[] = {
/* 'Inherited': Script */
static const OnigCodePoint CR_Inherited[] = {
- 25,
+ 27,
0x0300, 0x036f,
0x0485, 0x0486,
0x064b, 0x0655,
- 0x065f, 0x065f,
0x0670, 0x0670,
0x0951, 0x0952,
+ 0x1ab0, 0x1abe,
0x1cd0, 0x1cd2,
0x1cd4, 0x1ce0,
0x1ce2, 0x1ce8,
0x1ced, 0x1ced,
0x1cf4, 0x1cf4,
- 0x1dc0, 0x1de6,
+ 0x1cf8, 0x1cf9,
+ 0x1dc0, 0x1df5,
0x1dfc, 0x1dff,
0x200c, 0x200d,
0x20d0, 0x20f0,
0x302a, 0x302d,
0x3099, 0x309a,
0xfe00, 0xfe0f,
- 0xfe20, 0xfe26,
+ 0xfe20, 0xfe2d,
0x101fd, 0x101fd,
+ 0x102e0, 0x102e0,
0x1d167, 0x1d169,
0x1d17b, 0x1d182,
0x1d185, 0x1d18b,
@@ -16819,7 +18130,7 @@ static const OnigCodePoint CR_Tagbanwa[] = {
/* 'Limbu': Script */
static const OnigCodePoint CR_Limbu[] = {
5,
- 0x1900, 0x191c,
+ 0x1900, 0x191e,
0x1920, 0x192b,
0x1930, 0x193b,
0x1940, 0x1940,
@@ -16957,9 +18268,9 @@ static const OnigCodePoint CR_Balinese[] = {
/* 'Cuneiform': Script */
static const OnigCodePoint CR_Cuneiform[] = {
3,
- 0x12000, 0x1236e,
- 0x12400, 0x12462,
- 0x12470, 0x12473,
+ 0x12000, 0x12398,
+ 0x12400, 0x1246e,
+ 0x12470, 0x12474,
}; /* CR_Cuneiform */
/* 'Phoenician': Script */
@@ -17017,8 +18328,9 @@ static const OnigCodePoint CR_Saurashtra[] = {
/* 'Kayah_Li': Script */
static const OnigCodePoint CR_Kayah_Li[] = {
- 1,
- 0xa900, 0xa92f,
+ 2,
+ 0xa900, 0xa92d,
+ 0xa92f, 0xa92f,
}; /* CR_Kayah_Li */
/* 'Rejang': Script */
@@ -17110,7 +18422,7 @@ static const OnigCodePoint CR_Bamum[] = {
static const OnigCodePoint CR_Javanese[] = {
3,
0xa980, 0xa9cd,
- 0xa9cf, 0xa9d9,
+ 0xa9d0, 0xa9d9,
0xa9de, 0xa9df,
}; /* CR_Javanese */
@@ -17170,9 +18482,10 @@ static const OnigCodePoint CR_Batak[] = {
/* 'Brahmi': Script */
static const OnigCodePoint CR_Brahmi[] = {
- 2,
+ 3,
0x11000, 0x1104d,
0x11052, 0x1106f,
+ 0x1107f, 0x1107f,
}; /* CR_Brahmi */
/* 'Mandaic': Script */
@@ -17212,9 +18525,10 @@ static const OnigCodePoint CR_Miao[] = {
/* 'Sharada': Script */
static const OnigCodePoint CR_Sharada[] = {
- 2,
+ 3,
0x11180, 0x111c8,
- 0x111d0, 0x111d9,
+ 0x111cd, 0x111cd,
+ 0x111d0, 0x111da,
}; /* CR_Sharada */
/* 'Sora_Sompeng': Script */
@@ -17231,14 +18545,192 @@ 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[] = {
- 2,
+ 4,
+ 0x061c, 0x061c,
0x200e, 0x200f,
0x202a, 0x202e,
+ 0x2066, 0x2069,
}; /* CR_Bidi_Control */
/* 'Join_Control': Binary Property */
@@ -17249,7 +18741,7 @@ static const OnigCodePoint CR_Join_Control[] = {
/* 'Dash': Binary Property */
static const OnigCodePoint CR_Dash[] = {
- 20,
+ 21,
0x002d, 0x002d,
0x058a, 0x058a,
0x05be, 0x05be,
@@ -17263,6 +18755,7 @@ static const OnigCodePoint CR_Dash[] = {
0x2e17, 0x2e17,
0x2e1a, 0x2e1a,
0x2e3a, 0x2e3b,
+ 0x2e40, 0x2e40,
0x301c, 0x301c,
0x3030, 0x3030,
0x30a0, 0x30a0,
@@ -17289,13 +18782,14 @@ static const OnigCodePoint CR_Hyphen[] = {
/* 'Quotation_Mark': Binary Property */
static const OnigCodePoint CR_Quotation_Mark[] = {
- 12,
+ 13,
0x0022, 0x0022,
0x0027, 0x0027,
0x00ab, 0x00ab,
0x00bb, 0x00bb,
0x2018, 0x201f,
0x2039, 0x203a,
+ 0x2e42, 0x2e42,
0x300c, 0x300f,
0x301d, 0x301f,
0xfe41, 0xfe44,
@@ -17306,7 +18800,7 @@ static const OnigCodePoint CR_Quotation_Mark[] = {
/* 'Terminal_Punctuation': Binary Property */
static const OnigCodePoint CR_Terminal_Punctuation[] = {
- 70,
+ 86,
0x0021, 0x0021,
0x002c, 0x002c,
0x002e, 0x002e,
@@ -17333,6 +18827,7 @@ static const OnigCodePoint CR_Terminal_Punctuation[] = {
0x1361, 0x1368,
0x166d, 0x166e,
0x16eb, 0x16ed,
+ 0x1735, 0x1736,
0x17d4, 0x17d6,
0x17da, 0x17da,
0x1802, 0x1805,
@@ -17346,6 +18841,8 @@ static const OnigCodePoint CR_Terminal_Punctuation[] = {
0x203c, 0x203d,
0x2047, 0x2049,
0x2e2e, 0x2e2e,
+ 0x2e3c, 0x2e3c,
+ 0x2e41, 0x2e41,
0x3001, 0x3002,
0xa4fe, 0xa4ff,
0xa60d, 0xa60f,
@@ -17371,17 +18868,30 @@ 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,
- 0x12470, 0x12473,
+ 0x111cd, 0x111cd,
+ 0x11238, 0x1123c,
+ 0x115c2, 0x115c5,
+ 0x115c9, 0x115c9,
+ 0x11641, 0x11642,
+ 0x12470, 0x12474,
+ 0x16a6e, 0x16a6f,
+ 0x16af5, 0x16af5,
+ 0x16b37, 0x16b39,
+ 0x16b44, 0x16b44,
+ 0x1bc9f, 0x1bc9f,
}; /* CR_Terminal_Punctuation */
/* 'Other_Math': Binary Property */
static const OnigCodePoint CR_Other_Math[] = {
- 133,
+ 134,
0x005e, 0x005e,
0x03d0, 0x03d2,
0x03d5, 0x03d5,
@@ -17423,6 +18933,7 @@ static const OnigCodePoint CR_Other_Math[] = {
0x21d5, 0x21db,
0x21dd, 0x21dd,
0x21e4, 0x21e5,
+ 0x2308, 0x230b,
0x23b4, 0x23b5,
0x23b7, 0x23b7,
0x23d0, 0x23d0,
@@ -17533,7 +19044,7 @@ static const OnigCodePoint CR_Hex_Digit[] = {
/* 'Other_Alphabetic': Binary Property */
static const OnigCodePoint CR_Other_Alphabetic[] = {
- 158,
+ 178,
0x0345, 0x0345,
0x05b0, 0x05bd,
0x05bf, 0x05bf,
@@ -17556,8 +19067,7 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0x0825, 0x0827,
0x0829, 0x082c,
0x08e4, 0x08e9,
- 0x08f0, 0x08fe,
- 0x0900, 0x0903,
+ 0x08f0, 0x0903,
0x093a, 0x093b,
0x093e, 0x094c,
0x094e, 0x094f,
@@ -17592,19 +19102,19 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0x0bc6, 0x0bc8,
0x0bca, 0x0bcc,
0x0bd7, 0x0bd7,
- 0x0c01, 0x0c03,
+ 0x0c00, 0x0c03,
0x0c3e, 0x0c44,
0x0c46, 0x0c48,
0x0c4a, 0x0c4c,
0x0c55, 0x0c56,
0x0c62, 0x0c63,
- 0x0c82, 0x0c83,
+ 0x0c81, 0x0c83,
0x0cbe, 0x0cc4,
0x0cc6, 0x0cc8,
0x0cca, 0x0ccc,
0x0cd5, 0x0cd6,
0x0ce2, 0x0ce3,
- 0x0d02, 0x0d03,
+ 0x0d01, 0x0d03,
0x0d3e, 0x0d44,
0x0d46, 0x0d48,
0x0d4a, 0x0d4c,
@@ -17657,6 +19167,7 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0x1be7, 0x1bf1,
0x1c24, 0x1c35,
0x1cf2, 0x1cf3,
+ 0x1de7, 0x1df4,
0x24b6, 0x24e9,
0x2de0, 0x2dff,
0xa674, 0xa67b,
@@ -17679,6 +19190,7 @@ static const OnigCodePoint CR_Other_Alphabetic[] = {
0xaaf5, 0xaaf5,
0xabe3, 0xabea,
0xfb1e, 0xfb1e,
+ 0x10376, 0x1037a,
0x10a01, 0x10a03,
0x10a05, 0x10a06,
0x10a0c, 0x10a0f,
@@ -17690,8 +19202,27 @@ 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 */
@@ -17712,7 +19243,7 @@ static const OnigCodePoint CR_Ideographic[] = {
/* 'Diacritic': Binary Property */
static const OnigCodePoint CR_Diacritic[] = {
- 125,
+ 145,
0x005e, 0x005e,
0x0060, 0x0060,
0x00a8, 0x00a8,
@@ -17781,6 +19312,7 @@ static const OnigCodePoint CR_Diacritic[] = {
0x1939, 0x193b,
0x1a75, 0x1a7c,
0x1a7f, 0x1a7f,
+ 0x1ab0, 0x1abd,
0x1b34, 0x1b34,
0x1b44, 0x1b44,
0x1b6b, 0x1b73,
@@ -17790,8 +19322,10 @@ 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,
@@ -17807,6 +19341,7 @@ static const OnigCodePoint CR_Diacritic[] = {
0xa66f, 0xa66f,
0xa67c, 0xa67d,
0xa67f, 0xa67f,
+ 0xa69c, 0xa69d,
0xa6f0, 0xa6f1,
0xa717, 0xa721,
0xa788, 0xa788,
@@ -17817,32 +19352,48 @@ static const OnigCodePoint CR_Diacritic[] = {
0xa953, 0xa953,
0xa9b3, 0xa9b3,
0xa9c0, 0xa9c0,
- 0xaa7b, 0xaa7b,
+ 0xa9e5, 0xa9e5,
+ 0xaa7b, 0xaa7d,
0xaabf, 0xaac2,
0xaaf6, 0xaaf6,
+ 0xab5b, 0xab5f,
0xabec, 0xabed,
0xfb1e, 0xfb1e,
- 0xfe20, 0xfe26,
+ 0xfe20, 0xfe2d,
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[] = {
- 22,
+ 26,
0x00b7, 0x00b7,
0x02d0, 0x02d1,
0x0640, 0x0640,
@@ -17861,15 +19412,19 @@ 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[] = {
- 18,
+ 20,
0x00aa, 0x00aa,
0x00ba, 0x00ba,
0x02b0, 0x02b8,
@@ -17886,15 +19441,20 @@ 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[] = {
- 2,
+ 5,
0x2160, 0x216f,
0x24b6, 0x24cf,
+ 0x1f130, 0x1f149,
+ 0x1f150, 0x1f169,
+ 0x1f170, 0x1f189,
}; /* CR_Other_Uppercase */
/* 'Noncharacter_Code_Point': Binary Property */
@@ -17922,7 +19482,7 @@ static const OnigCodePoint CR_Noncharacter_Code_Point[] = {
/* 'Other_Grapheme_Extend': Binary Property */
static const OnigCodePoint CR_Other_Grapheme_Extend[] = {
- 17,
+ 22,
0x09be, 0x09be,
0x09d7, 0x09d7,
0x0b3e, 0x0b3e,
@@ -17938,6 +19498,11 @@ 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 */
@@ -17986,7 +19551,7 @@ static const OnigCodePoint CR_Other_Default_Ignorable_Code_Point[] = {
0x034f, 0x034f,
0x115f, 0x1160,
0x17b4, 0x17b5,
- 0x2065, 0x2069,
+ 0x2065, 0x2065,
0x3164, 0x3164,
0xffa0, 0xffa0,
0xfff0, 0xfff8,
@@ -18075,12 +19640,10 @@ static const OnigCodePoint CR_Other_ID_Continue[] = {
/* 'STerm': Binary Property */
static const OnigCodePoint CR_STerm[] = {
- 50,
+ 60,
0x0021, 0x0021,
0x002e, 0x002e,
0x003f, 0x003f,
- 0x055c, 0x055c,
- 0x055e, 0x055e,
0x0589, 0x0589,
0x061f, 0x061f,
0x06d4, 0x06d4,
@@ -18103,6 +19666,7 @@ static const OnigCodePoint CR_STerm[] = {
0x203c, 0x203d,
0x2047, 0x2049,
0x2e2e, 0x2e2e,
+ 0x2e3c, 0x2e3c,
0x3002, 0x3002,
0xa4ff, 0xa4ff,
0xa60e, 0xa60f,
@@ -18126,6 +19690,17 @@ 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 */
@@ -18181,23 +19756,22 @@ static const OnigCodePoint CR_Pattern_Syntax[] = {
/* 'Unknown': Script */
static const OnigCodePoint CR_Unknown[] = {
- 537,
+ 598,
0x0378, 0x0379,
- 0x037f, 0x0383,
+ 0x0380, 0x0383,
0x038b, 0x038b,
0x038d, 0x038d,
0x03a2, 0x03a2,
- 0x0528, 0x0530,
+ 0x0530, 0x0530,
0x0557, 0x0558,
0x0560, 0x0560,
0x0588, 0x0588,
- 0x058b, 0x058e,
+ 0x058b, 0x058c,
0x0590, 0x0590,
0x05c8, 0x05cf,
0x05eb, 0x05ef,
0x05f5, 0x05ff,
- 0x0605, 0x0605,
- 0x061c, 0x061d,
+ 0x061d, 0x061d,
0x070e, 0x070e,
0x074b, 0x074c,
0x07b2, 0x07bf,
@@ -18206,11 +19780,7 @@ static const OnigCodePoint CR_Unknown[] = {
0x083f, 0x083f,
0x085c, 0x085d,
0x085f, 0x089f,
- 0x08a1, 0x08a1,
- 0x08ad, 0x08e3,
- 0x08ff, 0x08ff,
- 0x0978, 0x0978,
- 0x0980, 0x0980,
+ 0x08b3, 0x08e3,
0x0984, 0x0984,
0x098d, 0x098e,
0x0991, 0x0992,
@@ -18283,12 +19853,11 @@ static const OnigCodePoint CR_Unknown[] = {
0x0bce, 0x0bcf,
0x0bd1, 0x0bd6,
0x0bd8, 0x0be5,
- 0x0bfb, 0x0c00,
+ 0x0bfb, 0x0bff,
0x0c04, 0x0c04,
0x0c0d, 0x0c0d,
0x0c11, 0x0c11,
0x0c29, 0x0c29,
- 0x0c34, 0x0c34,
0x0c3a, 0x0c3c,
0x0c45, 0x0c45,
0x0c49, 0x0c49,
@@ -18297,7 +19866,7 @@ static const OnigCodePoint CR_Unknown[] = {
0x0c5a, 0x0c5f,
0x0c64, 0x0c65,
0x0c70, 0x0c77,
- 0x0c80, 0x0c81,
+ 0x0c80, 0x0c80,
0x0c84, 0x0c84,
0x0c8d, 0x0c8d,
0x0c91, 0x0c91,
@@ -18311,7 +19880,7 @@ static const OnigCodePoint CR_Unknown[] = {
0x0cdf, 0x0cdf,
0x0ce4, 0x0ce5,
0x0cf0, 0x0cf0,
- 0x0cf3, 0x0d01,
+ 0x0cf3, 0x0d00,
0x0d04, 0x0d04,
0x0d0d, 0x0d0d,
0x0d11, 0x0d11,
@@ -18332,7 +19901,8 @@ static const OnigCodePoint CR_Unknown[] = {
0x0dcb, 0x0dce,
0x0dd5, 0x0dd5,
0x0dd7, 0x0dd7,
- 0x0de0, 0x0df1,
+ 0x0de0, 0x0de5,
+ 0x0df0, 0x0df1,
0x0df5, 0x0e00,
0x0e3b, 0x0e3e,
0x0e5c, 0x0e80,
@@ -18383,7 +19953,7 @@ static const OnigCodePoint CR_Unknown[] = {
0x139a, 0x139f,
0x13f5, 0x13ff,
0x169d, 0x169f,
- 0x16f1, 0x16ff,
+ 0x16f9, 0x16ff,
0x170d, 0x170d,
0x1715, 0x171f,
0x1737, 0x173f,
@@ -18399,7 +19969,7 @@ static const OnigCodePoint CR_Unknown[] = {
0x1878, 0x187f,
0x18ab, 0x18af,
0x18f6, 0x18ff,
- 0x191d, 0x191f,
+ 0x191f, 0x191f,
0x192c, 0x192f,
0x193c, 0x193f,
0x1941, 0x1943,
@@ -18413,7 +19983,8 @@ static const OnigCodePoint CR_Unknown[] = {
0x1a7d, 0x1a7e,
0x1a8a, 0x1a8f,
0x1a9a, 0x1a9f,
- 0x1aae, 0x1aff,
+ 0x1aae, 0x1aaf,
+ 0x1abf, 0x1aff,
0x1b4c, 0x1b4f,
0x1b7d, 0x1b7f,
0x1bf4, 0x1bfb,
@@ -18421,8 +19992,9 @@ static const OnigCodePoint CR_Unknown[] = {
0x1c4a, 0x1c4c,
0x1c80, 0x1cbf,
0x1cc8, 0x1ccf,
- 0x1cf7, 0x1cff,
- 0x1de7, 0x1dfb,
+ 0x1cf7, 0x1cf7,
+ 0x1cfa, 0x1cff,
+ 0x1df6, 0x1dfb,
0x1f16, 0x1f17,
0x1f1e, 0x1f1f,
0x1f46, 0x1f47,
@@ -18439,19 +20011,21 @@ static const OnigCodePoint CR_Unknown[] = {
0x1ff0, 0x1ff1,
0x1ff5, 0x1ff5,
0x1fff, 0x1fff,
- 0x2065, 0x2069,
+ 0x2065, 0x2065,
0x2072, 0x2073,
0x208f, 0x208f,
0x209d, 0x209f,
- 0x20ba, 0x20cf,
+ 0x20be, 0x20cf,
0x20f1, 0x20ff,
0x218a, 0x218f,
- 0x23f4, 0x23ff,
+ 0x23fb, 0x23ff,
0x2427, 0x243f,
0x244b, 0x245f,
- 0x2700, 0x2700,
- 0x2b4d, 0x2b4f,
- 0x2b5a, 0x2bff,
+ 0x2b74, 0x2b75,
+ 0x2b96, 0x2b97,
+ 0x2bba, 0x2bbc,
+ 0x2bc9, 0x2bc9,
+ 0x2bd2, 0x2bff,
0x2c2f, 0x2c2f,
0x2c5f, 0x2c5f,
0x2cf4, 0x2cf8,
@@ -18469,7 +20043,7 @@ static const OnigCodePoint CR_Unknown[] = {
0x2dcf, 0x2dcf,
0x2dd7, 0x2dd7,
0x2ddf, 0x2ddf,
- 0x2e3c, 0x2e7f,
+ 0x2e43, 0x2e7f,
0x2e9a, 0x2e9a,
0x2ef4, 0x2eff,
0x2fd6, 0x2fef,
@@ -18488,11 +20062,11 @@ static const OnigCodePoint CR_Unknown[] = {
0xa48d, 0xa48f,
0xa4c7, 0xa4cf,
0xa62c, 0xa63f,
- 0xa698, 0xa69e,
+ 0xa69e, 0xa69e,
0xa6f8, 0xa6ff,
0xa78f, 0xa78f,
- 0xa794, 0xa79f,
- 0xa7ab, 0xa7f7,
+ 0xa7ae, 0xa7af,
+ 0xa7b2, 0xa7f6,
0xa82c, 0xa82f,
0xa83a, 0xa83f,
0xa878, 0xa87f,
@@ -18503,18 +20077,19 @@ static const OnigCodePoint CR_Unknown[] = {
0xa97d, 0xa97f,
0xa9ce, 0xa9ce,
0xa9da, 0xa9dd,
- 0xa9e0, 0xa9ff,
+ 0xa9ff, 0xa9ff,
0xaa37, 0xaa3f,
0xaa4e, 0xaa4f,
0xaa5a, 0xaa5b,
- 0xaa7c, 0xaa7f,
0xaac3, 0xaada,
0xaaf7, 0xab00,
0xab07, 0xab08,
0xab0f, 0xab10,
0xab17, 0xab1f,
0xab27, 0xab27,
- 0xab2f, 0xabbf,
+ 0xab2f, 0xab2f,
+ 0xab60, 0xab63,
+ 0xab66, 0xabbf,
0xabee, 0xabef,
0xabfa, 0xabff,
0xd7a4, 0xd7af,
@@ -18535,7 +20110,7 @@ static const OnigCodePoint CR_Unknown[] = {
0xfdc8, 0xfdef,
0xfdfe, 0xfdff,
0xfe1a, 0xfe1f,
- 0xfe27, 0xfe2f,
+ 0xfe2e, 0xfe2f,
0xfe53, 0xfe53,
0xfe67, 0xfe67,
0xfe6c, 0xfe6f,
@@ -18559,26 +20134,35 @@ static const OnigCodePoint CR_Unknown[] = {
0x100fb, 0x100ff,
0x10103, 0x10106,
0x10134, 0x10136,
- 0x1018b, 0x1018f,
- 0x1019c, 0x101cf,
+ 0x1018d, 0x1018f,
+ 0x1019c, 0x1019f,
+ 0x101a1, 0x101cf,
0x101fe, 0x1027f,
0x1029d, 0x1029f,
- 0x102d1, 0x102ff,
- 0x1031f, 0x1031f,
+ 0x102d1, 0x102df,
+ 0x102fc, 0x102ff,
0x10324, 0x1032f,
- 0x1034b, 0x1037f,
+ 0x1034b, 0x1034f,
+ 0x1037b, 0x1037f,
0x1039e, 0x1039e,
0x103c4, 0x103c7,
0x103d6, 0x103ff,
0x1049e, 0x1049f,
- 0x104aa, 0x107ff,
+ 0x104aa, 0x104ff,
+ 0x10528, 0x1052f,
+ 0x10564, 0x1056e,
+ 0x10570, 0x105ff,
+ 0x10737, 0x1073f,
+ 0x10756, 0x1075f,
+ 0x10768, 0x107ff,
0x10806, 0x10807,
0x10809, 0x10809,
0x10836, 0x10836,
0x10839, 0x1083b,
0x1083d, 0x1083e,
0x10856, 0x10856,
- 0x10860, 0x108ff,
+ 0x1089f, 0x108a6,
+ 0x108b0, 0x108ff,
0x1091c, 0x1091e,
0x1093a, 0x1093e,
0x10940, 0x1097f,
@@ -18592,33 +20176,82 @@ static const OnigCodePoint CR_Unknown[] = {
0x10a3b, 0x10a3e,
0x10a48, 0x10a4f,
0x10a59, 0x10a5f,
- 0x10a80, 0x10aff,
+ 0x10aa0, 0x10abf,
+ 0x10ae7, 0x10aea,
+ 0x10af7, 0x10aff,
0x10b36, 0x10b38,
0x10b56, 0x10b57,
0x10b73, 0x10b77,
- 0x10b80, 0x10bff,
+ 0x10b92, 0x10b98,
+ 0x10b9d, 0x10ba8,
+ 0x10bb0, 0x10bff,
0x10c49, 0x10e5f,
0x10e7f, 0x10fff,
0x1104e, 0x11051,
- 0x11070, 0x1107f,
+ 0x11070, 0x1107e,
0x110c2, 0x110cf,
0x110e9, 0x110ef,
0x110fa, 0x110ff,
0x11135, 0x11135,
- 0x11144, 0x1117f,
- 0x111c9, 0x111cf,
- 0x111da, 0x1167f,
+ 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,
0x116b8, 0x116bf,
- 0x116ca, 0x11fff,
- 0x1236f, 0x123ff,
- 0x12463, 0x1246f,
- 0x12474, 0x12fff,
+ 0x116ca, 0x1189f,
+ 0x118f3, 0x118fe,
+ 0x11900, 0x11abf,
+ 0x11af9, 0x11fff,
+ 0x12399, 0x123ff,
+ 0x1246f, 0x1246f,
+ 0x12475, 0x12fff,
0x1342f, 0x167ff,
- 0x16a39, 0x16eff,
+ 0x16a39, 0x16a3f,
+ 0x16a5f, 0x16a5f,
+ 0x16a6a, 0x16a6d,
+ 0x16a70, 0x16acf,
+ 0x16aee, 0x16aef,
+ 0x16af6, 0x16aff,
+ 0x16b46, 0x16b4f,
+ 0x16b5a, 0x16b5a,
+ 0x16b62, 0x16b62,
+ 0x16b78, 0x16b7c,
+ 0x16b90, 0x16eff,
0x16f45, 0x16f4f,
0x16f7f, 0x16f8e,
0x16fa0, 0x1afff,
- 0x1b002, 0x1cfff,
+ 0x1b002, 0x1bbff,
+ 0x1bc6b, 0x1bc6f,
+ 0x1bc7d, 0x1bc7f,
+ 0x1bc89, 0x1bc8f,
+ 0x1bc9a, 0x1bc9b,
+ 0x1bca4, 0x1cfff,
0x1d0f6, 0x1d0ff,
0x1d127, 0x1d128,
0x1d1de, 0x1d1ff,
@@ -18645,7 +20278,9 @@ static const OnigCodePoint CR_Unknown[] = {
0x1d551, 0x1d551,
0x1d6a6, 0x1d6a7,
0x1d7cc, 0x1d7cd,
- 0x1d800, 0x1edff,
+ 0x1d800, 0x1e7ff,
+ 0x1e8c5, 0x1e8c6,
+ 0x1e8d7, 0x1edff,
0x1ee04, 0x1ee04,
0x1ee20, 0x1ee20,
0x1ee23, 0x1ee23,
@@ -18683,10 +20318,10 @@ static const OnigCodePoint CR_Unknown[] = {
0x1f02c, 0x1f02f,
0x1f094, 0x1f09f,
0x1f0af, 0x1f0b0,
- 0x1f0bf, 0x1f0c0,
+ 0x1f0c0, 0x1f0c0,
0x1f0d0, 0x1f0d0,
- 0x1f0e0, 0x1f0ff,
- 0x1f10b, 0x1f10f,
+ 0x1f0f6, 0x1f0ff,
+ 0x1f10d, 0x1f10f,
0x1f12f, 0x1f12f,
0x1f16c, 0x1f16f,
0x1f19b, 0x1f1e5,
@@ -18694,24 +20329,25 @@ static const OnigCodePoint CR_Unknown[] = {
0x1f23b, 0x1f23f,
0x1f249, 0x1f24f,
0x1f252, 0x1f2ff,
- 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,
+ 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,
0x2a6d7, 0x2a6ff,
0x2b735, 0x2b73f,
0x2b81e, 0x2f7ff,
@@ -18721,6 +20357,7 @@ 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,
@@ -24158,6 +25795,1730 @@ 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
@@ -24485,6 +27846,12 @@ 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,
@@ -24921,7 +28288,10 @@ static const OnigCodePoint CR_In_Devanagari_Extended[] = {
}; /* CR_In_Devanagari_Extended */
/* 'In_Kayah_Li': Block */
-#define CR_In_Kayah_Li CR_Kayah_Li
+static const OnigCodePoint CR_In_Kayah_Li[] = {
+ 1,
+ 0xa900, 0xa92f,
+}; /* CR_In_Kayah_Li */
/* 'In_Rejang': Block */
static const OnigCodePoint CR_In_Rejang[] = {
@@ -24941,6 +28311,12 @@ 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,
@@ -24971,6 +28347,12 @@ 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,
@@ -25127,6 +28509,12 @@ 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,
@@ -25139,6 +28527,12 @@ 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,
@@ -25163,6 +28557,24 @@ 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,
@@ -25175,6 +28587,15 @@ 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,
@@ -25205,6 +28626,15 @@ 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,
@@ -25223,6 +28653,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,
@@ -25259,18 +28695,78 @@ 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,
@@ -25295,6 +28791,24 @@ 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,
@@ -25307,6 +28821,18 @@ 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,
@@ -25343,6 +28869,12 @@ 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,
@@ -25379,11 +28911,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[] = {
@@ -25391,11 +28923,17 @@ static const OnigCodePoint CR_In_Emoticons[] = {
0x1f600, 0x1f64f,
}; /* CR_In_Emoticons */
-/* 'In_Transport_And_Map_Symbols': Block */
-static const OnigCodePoint CR_In_Transport_And_Map_Symbols[] = {
+/* '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[] = {
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[] = {
@@ -25403,6 +28941,18 @@ 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,
@@ -25453,38 +29003,42 @@ static const OnigCodePoint CR_In_Supplementary_Private_Use_Area_B[] = {
/* 'In_No_Block': Block */
static const OnigCodePoint CR_In_No_Block[] = {
- 36,
+ 40,
0x0860, 0x089f,
- 0x1ab0, 0x1aff,
0x1c80, 0x1cbf,
0x2fe0, 0x2fef,
- 0xa9e0, 0xa9ff,
- 0xab30, 0xabbf,
+ 0xab70, 0xabbf,
0x10200, 0x1027f,
- 0x102e0, 0x102ff,
- 0x10350, 0x1037f,
0x103e0, 0x103ff,
- 0x104b0, 0x107ff,
- 0x10860, 0x108ff,
+ 0x104b0, 0x104ff,
+ 0x10570, 0x105ff,
+ 0x10780, 0x107ff,
+ 0x108b0, 0x108ff,
0x10940, 0x1097f,
- 0x10a80, 0x10aff,
- 0x10b80, 0x10bff,
+ 0x10aa0, 0x10abf,
+ 0x10bb0, 0x10bff,
0x10c50, 0x10e5f,
0x10e80, 0x10fff,
- 0x11150, 0x1117f,
- 0x111e0, 0x1167f,
- 0x116d0, 0x11fff,
+ 0x11250, 0x112af,
+ 0x11380, 0x1147f,
+ 0x114e0, 0x1157f,
+ 0x11660, 0x1167f,
+ 0x116d0, 0x1189f,
+ 0x11900, 0x11abf,
+ 0x11b00, 0x11fff,
0x12480, 0x12fff,
0x13430, 0x167ff,
- 0x16a40, 0x16eff,
+ 0x16a70, 0x16acf,
+ 0x16b90, 0x16eff,
0x16fa0, 0x1afff,
- 0x1b100, 0x1cfff,
+ 0x1b100, 0x1bbff,
+ 0x1bcb0, 0x1cfff,
0x1d250, 0x1d2ff,
0x1d380, 0x1d3ff,
- 0x1d800, 0x1edff,
+ 0x1d800, 0x1e7ff,
+ 0x1e8e0, 0x1edff,
0x1ef00, 0x1efff,
- 0x1f650, 0x1f67f,
- 0x1f780, 0x1ffff,
+ 0x1f900, 0x1ffff,
0x2a6e0, 0x2a6ff,
0x2b820, 0x2f7ff,
0x2fa20, 0xdffff,
@@ -25671,6 +29225,29 @@ 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,
@@ -25704,6 +29281,7 @@ 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,
@@ -25717,6 +29295,10 @@ 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,
@@ -25772,6 +29354,7 @@ 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,
@@ -25850,11 +29433,13 @@ 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,
@@ -25881,54 +29466,83 @@ 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_Transport_And_Map_Symbols,
+ CR_In_Ornamental_Dingbats,
+ 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,
@@ -25954,12 +29568,16 @@ 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 */
-#define TOTAL_KEYWORDS 625
+#ifndef USE_UNICODE_AGE_PROPERTIES
+#define TOTAL_KEYWORDS 689
+#else /* USE_UNICODE_AGE_PROPERTIES */
+#define TOTAL_KEYWORDS 705
+#endif /* USE_UNICODE_AGE_PROPERTIES */
#define MIN_WORD_LENGTH 1
#define MAX_WORD_LENGTH 44
#define MIN_HASH_VALUE 3
-#define MAX_HASH_VALUE 4167
-/* maximum key range = 4165, duplicates = 0 */
+#define MAX_HASH_VALUE 4322
+/* maximum key range = 4320, duplicates = 0 */
#endif /* USE_UNICODE_PROPERTIES */
#ifdef __GNUC__
@@ -25995,19 +29613,24 @@ 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 */
- 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
+ 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
#endif /* USE_UNICODE_PROPERTIES */
};
#ifndef USE_UNICODE_PROPERTIES
@@ -26071,630 +29694,722 @@ struct uniname2ctype_pool_t
char uniname2ctype_pool_str19[sizeof("blank")];
#else /* USE_UNICODE_PROPERTIES */
char uniname2ctype_pool_str3[sizeof("n")];
- 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_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_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_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_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_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_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_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_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")];
+ 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")];
#endif /* USE_UNICODE_PROPERTIES */
};
static const struct uniname2ctype_pool_t uniname2ctype_pool_contents =
@@ -26709,644 +30424,736 @@ static const struct uniname2ctype_pool_t uniname2ctype_pool_contents =
"upper",
#else /* USE_UNICODE_PROPERTIES */
"n",
- "s",
- "z",
- "zs",
- "zzzz",
"cn",
- "cs",
- "ci",
+ "mn",
"c",
- "cf",
+ "m",
+ "ci",
+ "z",
+ "cc",
+ "mc",
+ "mani",
+ "inmanichaean",
+ "qaai",
+ "zzzz",
+ "qaac",
+ "incham",
"sc",
+ "sm",
+ "mandaic",
+ "incuneiform",
"cans",
- "qaai",
- "mn",
+ "me",
+ "inarmenian",
#endif /* USE_UNICODE_PROPERTIES */
"ascii",
#ifdef USE_UNICODE_PROPERTIES
- "cc",
- "qaac",
- "inavestan",
- "inspecials",
- "inipaextensions",
- "mc",
+ "s",
"insamaritan",
- "m",
- "sm",
- "me",
- "inarmenian",
- "incuneiform",
- "mandaic",
- "inancientsymbols",
+ "cs",
+ "zs",
+ "inavestan",
+ "incommonindicnumberforms",
"incuneiformnumbersandpunctuation",
"inthai",
- "inmusicalsymbols",
- "inmiscellaneoussymbols",
- "incham",
- "inmiscellaneoussymbolsandarrows",
+ "inipaextensions",
+ "mtei",
+ "inspecials",
"initialpunctuation",
- "inmiscellaneoussymbolsandpictographs",
+ "inancientsymbols",
"inthaana",
- "taile",
- "mtei",
- "lc",
- "lana",
- "inlycian",
- "intransportandmapsymbols",
- "incontrolpictures",
- "sinhala",
- "incommonindicnumberforms",
"inmiscellaneousmathematicalsymbolsa",
+ "lc",
+ "inmusicalsymbols",
+ "lm",
+ "taile",
"sterm",
+ "lina",
+ "inlycian",
"inmyanmarextendeda",
- "lm",
- "taiviet",
- "inlinearbideograms",
+ "lana",
+ "alnum",
"intaitham",
+ "incontrolpictures",
+ "inmiscellaneoussymbols",
+ "inmalayalam",
+ "intransportandmapsymbols",
+ "inmiscellaneoussymbolsandarrows",
+ "inlineara",
+ "inmiscellaneoussymbolsandpictographs",
+ "taiviet",
+ "cwcm",
+ "sinhala",
"latn",
"latin",
"ital",
- "alnum",
- "inmalayalam",
+ "intamil",
+ "taml",
+ "inlatinextendedc",
"intaile",
"tale",
+ "inlatinextendeda",
+ "inlinearbideograms",
+ "newtailue",
"l",
"nl",
+ "inmeeteimayekextensions",
"zl",
- "intamil",
- "taml",
- "inlatinextendeda",
- "inlatinextendedc",
+ "lt",
"inrunic",
"incarian",
- "insyriac",
- "cari",
- "inmeeteimayekextensions",
- "osma",
- "lt",
- "miao",
- "insharada",
- "incyrillic",
- "carian",
"armn",
- "samr",
+ "cari",
"armi",
- "inideographicdescriptioncharacters",
- "inosmanya",
+ "inlatinextendede",
+ "incyrillic",
"armenian",
"inmyanmar",
- "samaritan",
- "arabic",
- "incherokee",
- "connectorpunctuation",
+ "innewtailue",
+ "carian",
"merc",
+ "arabic",
"inmiscellaneoustechnical",
- "inenclosedalphanumerics",
- "inemoticons",
- "joinc",
+ "insyriac",
+ "samr",
+ "zinh",
+ "han",
+ "samaritan",
+ "hani",
+ "cwt",
+ "incherokee",
+ "insharada",
+ "cham",
+ "manichaean",
+ "inmahajani",
#endif /* USE_UNICODE_PROPERTIES */
"cntrl",
#ifdef USE_UNICODE_PROPERTIES
- "inenclosedcjklettersandmonths",
- "cwcf",
+ "sinh",
"inruminumeralsymbols",
- "ll",
- "term",
- "inlatinextendedadditional",
+ "inethiopic",
"tamil",
- "loe",
- "newtailue",
- "cwcm",
- "inenclosedalphanumericsupplement",
- "sinh",
- "zinh",
- "meroiticcursive",
- "han",
- "hani",
- "inopticalcharacterrecognition",
- "no",
- "so",
- "innewtailue",
+ "miao",
+ "inenclosedalphanumerics",
+ "term",
+ "chakma",
"insinhala",
- "innko",
- "co",
"shavian",
- "terminalpunctuation",
- "intaixuanjingsymbols",
- "inethiopic",
- "sora",
- "inarrows",
- "cham",
- "inlowsurrogates",
- "oriya",
- "ext",
- "cwt",
- "common",
- "inmiao",
+ "inosmanya",
+ "inlatinextendedadditional",
+ "osma",
+ "ll",
"thai",
- "intifinagh",
- "ethi",
- "mero",
- "chakma",
+ "math",
"thaa",
- "inscriptionalparthian",
- "tifinagh",
- "titlecaseletter",
+ "inenclosedalphanumericsupplement",
+ "ethi",
+ "connectorpunctuation",
+ "inlowsurrogates",
+ "insinhalaarchaicnumbers",
+ "taitham",
"thaana",
- "asciihexdigit",
- "math",
+ "lineara",
"di",
- "ids",
- "lo",
- "inlao",
- "taitham",
- "lao",
- "laoo",
- "dia",
"idc",
- "ps",
+ "meroiticcursive",
+ "mand",
+ "inmodi",
+ "inmandaic",
+ "cwl",
+ "asciihexdigit",
+ "dia",
+ "terminalpunctuation",
+ "mend",
+ "sind",
+ "wara",
+ "inwarangciti",
+ "inideographicdescriptioncharacters",
+ "inemoticons",
+ "ids",
"insundanese",
"pi",
- "cwl",
- "pf",
- "mand",
- "insylotinagri",
- "vs",
- "mongolian",
+ "indominotiles",
"pc",
- "inmandaic",
- "invai",
- "lineseparator",
- "pe",
- "vai",
- "vaii",
+ "loe",
+ "titlecaseletter",
+ "inopticalcharacterrecognition",
"idst",
- "indominotiles",
- "inshavian",
- "inspacingmodifierletters",
- "format",
+ "shaw",
+ "cwcf",
+ "idcontinue",
"inphaistosdisc",
- "hano",
-#endif /* USE_UNICODE_PROPERTIES */
- "space",
-#ifdef USE_UNICODE_PROPERTIES
+ "pe",
"indeseret",
- "inolchiki",
- "hira",
- "joincontrol",
- "idcontinue",
- "inmahjongtiles",
- "patws",
+ "inspacingmodifierletters",
"inlydian",
+ "ps",
+ "hira",
+ "whitespace",
+ "inscriptionalparthian",
"cher",
+ "inmathematicalalphanumericsymbols",
+ "incoptic",
"inhiragana",
- "inogham",
- "avst",
+ "inenclosedcjklettersandmonths",
+#endif /* USE_UNICODE_PROPERTIES */
+ "space",
+#ifdef USE_UNICODE_PROPERTIES
+ "oriya",
+ "mero",
+ "mahj",
+ "tirh",
+ "sora",
"inscriptionalpahlavi",
- "incoptic",
- "java",
- "inmathematicalalphanumericsymbols",
- "letter",
- "injavanese",
- "avestan",
- "age=1.1",
- "lepc",
- "age=2.1",
+ "inarrows",
+ "mahajani",
+ "joinc",
+ "incopticepactnumbers",
+ "hano",
+ "palm",
+ "intirhuta",
+ "patws",
+ "inolchiki",
"inlepcha",
- "javanese",
- "shaw",
- "finalpunctuation",
+ "no",
+ "lepc",
+ "inogham",
+ "co",
+ "innko",
"alpha",
- "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",
+ "psalterpahlavi",
+ "inmro",
+ "inpalmyrene",
+ "common",
+ "cf",
+ "inmiao",
+ "so",
+ "diacritic",
"insundanesesupplement",
- "age=3.2",
- "age=4.1",
+ "intifinagh",
+ "tifinagh",
+ "odi",
"oidc",
- "tfng",
- "insmallformvariants",
- "ideo",
- "intags",
- "age=6.0",
- "age=3.0",
- "whitespace",
- "age=4.0",
+ "modi",
+ "decimalnumber",
+ "letter",
+ "dash",
+ "insylotinagri",
"inolditalic",
- "oalpha",
- "ingujarati",
- "control",
- "diacritic",
- "tagbanwa",
- "inphoenician",
- "ininscriptionalparthian",
- "ininscriptionalpahlavi",
- "coptic",
+ "wspace",
"dsrt",
- "inmodifiertoneletters",
- "xids",
- "hanunoo",
- "inoldturkic",
- "xidc",
+ "ideo",
+ "siddham",
+ "perm",
+ "oids",
+ "inmahjongtiles",
+ "lo",
+ "lineseparator",
+ "imperialaramaic",
"idstart",
+ "inlao",
+ "sharada",
+ "lao",
+ "laoo",
+ "mongolian",
+ "oalpha",
"inimperialaramaic",
- "invariationselectors",
- "copt",
- "caseignorable",
- "prti",
"nchar",
- "deseret",
- "decimalnumber",
- "cprt",
"inlatin1supplement",
- "imperialaramaic",
- "privateuse",
- "casedletter",
- "lowercase",
- "spaceseparator",
+ "prti",
+ "cprt",
+ "nd",
+ "deseret",
+ "inoldturkic",
"radical",
- "mong",
"canadianaboriginal",
- "letternumber",
- "insorasompeng",
- "dash",
- "wspace",
- "ogam",
- "invariationselectorssupplement",
+ "inmodifiertoneletters",
+ "incaucasianalbanian",
+ "coptic",
+ "casedletter",
+ "sd",
+ "inphoenician",
+ "sidd",
+ "privateuse",
+ "sundanese",
+ "inancientgreekmusicalnotation",
+ "insiddham",
+ "cased",
"print",
- "otheridcontinue",
- "ingurmukhi",
- "closepunctuation",
+ "ininscriptionalparthian",
+ "ininscriptionalpahlavi",
+ "copt",
+ "inancientgreeknumbers",
+ "saurashtra",
+ "mro",
+ "mroo",
+ "inalphabeticpresentationforms",
+ "lowercase",
+ "phli",
+ "patternwhitespace",
+ "inenclosedideographicsupplement",
+ "spaceseparator",
+ "inmathematicaloperators",
+ "omath",
+ "lisu",
+ "inpsalterpahlavi",
"olditalic",
- "noncharactercodepoint",
- "sharada",
- "ingeometricshapes",
+ "hanunoo",
+ "inherited",
+ "lepcha",
+ "p",
+ "inmongolian",
+ "zp",
+ "finalpunctuation",
+ "otheridcontinue",
+ "shrd",
+ "ingrantha",
+ "talu",
"otheralphabetic",
- "patternwhitespace",
- "po",
- "rjng",
- "ingreekandcoptic",
- "xdigit",
- "gothic",
+ "noncharactercodepoint",
+#ifdef USE_UNICODE_AGE_PROPERTIES
+ "age=1.1",
+ "age=2.1",
+#endif /* USE_UNICODE_AGE_PROPERTIES */
+ "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",
"inoldsoutharabian",
- "xidstart",
- "inrejang",
- "idsbinaryoperator",
- "olower",
- "hex",
- "inenclosedideographicsupplement",
- "inalphabeticpresentationforms",
"inbasiclatin",
- "othersymbol",
- "nd",
- "sd",
- "omath",
+ "format",
+ "innumberforms",
+ "inugaritic",
"separator",
- "inarabic",
- "xidcontinue",
+ "idsbinaryoperator",
+ "tagbanwa",
+ "bass",
+ "saur",
+ "nbat",
+ "intaixuanjingsymbols",
+ "joincontrol",
"otheridstart",
- "grext",
+ "inbyzantinemusicalsymbols",
+ "intags",
+ "nabataean",
+ "insuperscriptsandsubscripts",
+ "intibetan",
+ "insaurashtra",
+ "othersymbol",
+ "ext",
+ "inarabicpresentationformsa",
+ "inmiscellaneousmathematicalsymbolsb",
"otherlowercase",
- "phli",
- "cased",
- "hang",
- "xpeo",
+ "phoenician",
#endif /* USE_UNICODE_PROPERTIES */
"lower",
#ifndef USE_UNICODE_PROPERTIES
"graph",
#else /* USE_UNICODE_PROPERTIES */
- "modifierletter",
- "inphoneticextensions",
- "inarabicpresentationformsa",
- "innumberforms",
- "oldpersian",
- "incyrillicextendeda",
- "inverticalforms",
- "p",
- "inbyzantinemusicalsymbols",
- "inmathematicaloperators",
- "intibetan",
- "zp",
- "ingeorgian",
- "inbraillepatterns",
- "lepcha",
- "geor",
- "invedicextensions",
"linb",
- "other",
- "deva",
- "indevanagari",
- "othernumber",
- "bamum",
- "shrd",
- "bali",
- "devanagari",
- "extender",
- "inherited",
- "glagolitic",
+ "po",
+ "inmyanmarextendedb",
+ "limb",
+ "inbraillepatterns",
"tibt",
+ "cuneiform",
+ "bali",
+ "oldpersian",
+ "oldpermic",
+ "pf",
+ "word",
+ "tibetan",
+ "incyrillicsupplement",
+ "elba",
+ "insupplementalmathematicaloperators",
"inbalinese",
- "ingothic",
- "inmiscellaneousmathematicalsymbolsb",
- "limb",
"bengali",
- "phoenician",
- "insuperscriptsandsubscripts",
- "inmeroitichieroglyphs",
- "tibetan",
- "inphoneticextensionssupplement",
+ "caseignorable",
+ "incountingrodnumerals",
+ "other",
+ "tirhuta",
+ "othernumber",
"balinese",
+ "elbasan",
+ "inunifiedcanadianaboriginalsyllabics",
"lowercaseletter",
- "indingbats",
- "inprivateusearea",
- "assigned",
- "patternsyntax",
- "inhangulsyllables",
- "sarb",
+ "ethiopic",
+ "gran",
+ "ingurmukhi",
+ "sund",
+ "inethiopicsupplement",
+ "inoldpersian",
+ "inoldpermic",
+ "othermath",
+ "unassigned",
+ "hmng",
+ "narb",
"brai",
- "insupplementalmathematicaloperators",
- "phnx",
- "ingreekextended",
- "otherletter",
+ "hang",
+ "insorasompeng",
"arab",
- "inlatinextendedd",
- "word",
- "inphagspa",
- "inblockelements",
- "ethiopic",
- "inethiopicextendeda",
+ "plrd",
+ "ingujarati",
"brahmi",
- "logicalorderexception",
- "inoldpersian",
+ "runr",
+ "ahex",
+ "mong",
+ "pauc",
+ "sarb",
+ "ogam",
+ "olower",
+ "pd",
+ "number",
+ "inbrahmi",
+ "otherletter",
+ "ingothic",
+ "phagspa",
"inletterlikesymbols",
- "sorasompeng",
- "hiragana",
- "inhanguljamoextendeda",
- "othermath",
+ "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",
+ "assigned",
+ "otherpunctuation",
+ "inhangulsyllables",
+ "inarabicmathematicalalphabeticsymbols",
+ "inornamentaldingbats",
+ "inphagspa",
+ "lyci",
+ "mlym",
+ "inarabicextendeda",
+ "rjng",
+ "lycian",
+ "inalchemicalsymbols",
+ "xdigit",
#endif /* USE_UNICODE_PROPERTIES */
"digit",
#ifndef USE_UNICODE_PROPERTIES
"blank"
#else /* USE_UNICODE_PROPERTIES */
- "goth",
- "ogham",
- "sundanese",
- "saurashtra",
- "linearb",
- "graphemebase",
- "inunifiedcanadianaboriginalsyllabics",
- "cuneiform",
+ "xidstart",
+ "inrejang",
+ "malayalam",
+ "idstrinaryoperator",
+ "invai",
+ "vai",
+ "vaii",
+ "hiragana",
+ "ingeorgian",
+ "braille",
+ "geor",
+ "brah",
+ "glagolitic",
"inkannada",
+ "cakm",
"kana",
- "inancientgreeknumbers",
- "incjkstrokes",
- "inglagolitic",
- "inancientgreekmusicalnotation",
+ "hebr",
+ "inshavian",
+ "vs",
"inchakma",
- "plrd",
- "inbrahmi",
- "cakm",
+ "ogham",
+ "sylotinagri",
+ "inunifiedcanadianaboriginalsyllabicsextended",
+ "inmeroitichieroglyphs",
+ "grantha",
+ "graphemebase",
+ "mathsymbol",
+ "mymr",
+ "insupplementaryprivateuseareaa",
+ "mendekikakui",
"incjkcompatibilityforms",
- "lisu",
+ "inhalfwidthandfullwidthforms",
"incjkcompatibilityideographs",
- "intagalog",
"inkaithi",
- "insupplementalarrowsa",
+ "avst",
+ "inarabicsupplement",
"takri",
- "ideographic",
- "hexdigit",
- "glag",
- "softdotted",
- "variationselector",
- "inkatakana",
+ "syrc",
"meeteimayek",
- "otherpunctuation",
- "inhanguljamo",
- "kali",
- "braille",
- "incombininghalfmarks",
- "talu",
+ "myanmar",
+ "avestan",
+ "inhanguljamoextendeda",
+ "goth",
+ "inkatakana",
+ "incyrillicextendeda",
+ "alphabetic",
+ "syriac",
+ "ideographic",
+ "incjkstrokes",
+ "inlinearbsyllabary",
+ "tavt",
+ "intaiviet",
"incjkcompatibilityideographssupplement",
- "telu",
- "idsb",
- "tglg",
"inmeeteimayek",
- "yi",
- "phagspa",
- "yiii",
- "inarabicmathematicalalphabeticsymbols",
- "saur",
- "ogrext",
- "bidic",
- "inkanasupplement",
- "runic",
- "inalchemicalsymbols",
- "georgian",
- "inugaritic",
- "insaurashtra",
+ "kali",
+ "inyiradicals",
+ "lu",
+ "inoriya",
+ "hebrew",
+ "extender",
"inhighprivateusesurrogates",
- "pd",
- "incountingrodnumerals",
- "inarabicextendeda",
- "inkharoshthi",
- "idstrinaryoperator",
+ "limbu",
+ "inbuhid",
+ "inethiopicextendeda",
+ "xidcontinue",
+ "inyijinghexagramsymbols",
+ "logicalorderexception",
+ "inhebrew",
+ "cyrl",
+ "osmanya",
+ "phnx",
+ "incombiningdiacriticalmarks",
+ "inkanasupplement",
+ "inlisu",
+ "changeswhencasemapped",
+ "incombiningdiacriticalmarksforsymbols",
+ "cwu",
"phag",
- "brah",
+ "insmallformvariants",
+ "inpahawhhmong",
+ "otheruppercase",
+ "intelugu",
+ "incombiningdiacriticalmarkssupplement",
+ "ingeometricshapesextended",
+ "xpeo",
+ "bamu",
+ "inbamum",
"mark",
- "hebr",
- "inkhmersymbols",
- "dep",
+ "dupl",
+ "graph",
+ "dashpunctuation",
+ "patternsyntax",
+ "changeswhentitlecased",
+ "inkharoshthi",
"inkhmer",
- "deprecated",
- "rejang",
- "lyci",
+ "java",
+ "sylo",
+ "ugaritic",
+ "otherdefaultignorablecodepoint",
+ "softdotted",
+ "uideo",
+ "inphoneticextensions",
+ "injavanese",
+ "invariationselectors",
+ "kaithi",
+ "cyrillic",
"intakri",
"takr",
- "incyrillicsupplement",
- "changeswhencasefolded",
- "indevanagariextended",
- "lycian",
+ "javanese",
+ "bidicontrol",
+ "caucasianalbanian",
+ "lydi",
+ "insupplementalpunctuation",
+ "inphoneticextensionssupplement",
+ "lydian",
+ "oldturkic",
+ "invariationselectorssupplement",
+ "kthi",
+ "inhanguljamo",
+ "patsyn",
+ "inlimbu",
+ "sorasompeng",
+ "orya",
+ "inkhmersymbols",
+ "inglagolitic",
+ "indevanagari",
+ "deva",
+ "knda",
"inbengali",
+ "symbol",
+ "devanagari",
+ "inmendekikakui",
"beng",
- "graph",
- "inyijinghexagramsymbols",
- "olck",
- "inarabicsupplement",
+ "invedicextensions",
+ "graphemeextend",
+ "kannada",
"inbuginese",
- "changeswhencasemapped",
+ "olck",
+ "meroitichieroglyphs",
+ "ugar",
+ "intagalog",
+ "inbamumsupplement",
"olchiki",
- "inaegeannumbers",
- "mlym",
- "alphabetic",
- "sylotinagri",
- "changeswhentitlecased",
- "tagalog",
+ "incurrencysymbols",
"tagb",
- "runr",
- "malayalam",
- "inoriya",
+ "inaegeannumbers",
"intagbanwa",
- "syrc",
- "nko",
- "nkoo",
- "inethiopicextended",
- "kaithi",
- "mathsymbol",
- "inyiradicals",
- "insupplementaryprivateuseareaa",
- "osmanya",
- "syriac",
- "otherdefaultignorablecodepoint",
- "number",
- "inlinearbsyllabary",
- "kthi",
- "sund",
- "mymr",
- "incombiningdiacriticalmarks",
- "enclosingmark",
- "incombiningdiacriticalmarksforsymbols",
- "inethiopicsupplement",
- "unassigned",
- "sylo",
- "combiningmark",
- "myanmar",
- "graphemeextend",
- "bidicontrol",
- "inhalfwidthandfullwidthforms",
- "cyrl",
- "knda",
- "inunifiedcanadianaboriginalsyllabicsextended",
- "xsux",
- "modifiersymbol",
- "incombiningdiacriticalmarkssupplement",
- "inhanunoo",
- "inbuhid",
- "kannada",
- "inhebrew",
- "grbase",
- "spacingmark",
+ "uppercase",
+ "defaultignorablecodepoint",
+ "glag",
"inkatakanaphoneticextensions",
- "hangul",
+ "changeswhencasefolded",
+ "inpaucinhau",
+ "inprivateusearea",
+ "paucinhau",
+ "spacingmark",
+ "khmr",
+ "khar",
+ "inarabicpresentationformsb",
+ "changeswhenlowercased",
+ "tglg",
+ "inethiopicextended",
+ "incombiningdiacriticalmarksextended",
+ "oupper",
"incjksymbolsandpunctuation",
"bopo",
- "orya",
+ "punctuation",
+ "combiningmark",
+ "inplayingcards",
"inbopomofo",
+ "hyphen",
+ "inkhojki",
+ "nko",
+ "nkoo",
+ "enclosingmark",
+ "openpunctuation",
+ "currencysymbol",
+ "inverticalforms",
+ "hex",
+ "modifiersymbol",
+ "inlatinextendedb",
"kharoshthi",
- "khar",
- "changeswhenlowercased",
- "khmr",
- "punct",
- "symbol",
"cherokee",
- "cyrillic",
- "inkangxiradicals",
- "hebrew",
- "inarabicpresentationformsb",
- "incyrillicextendedb",
- "ugaritic",
- "incurrencysymbols",
- "meroitichieroglyphs",
- "inhighsurrogates",
- "nonspacingmark",
- "lydi",
- "patsyn",
- "orkh",
- "lydian",
- "ugar",
- "othergraphemeextend",
- "inlatinextendedb",
- "bopomofo",
- "khmer",
- "uideo",
- "otheruppercase",
- "grek",
+ "pahawhhmong",
+ "cypriot",
+ "incypriotsyllabary",
+ "palmyrene",
+ "upper",
+ "aghb",
+ "georgian",
"gujr",
+ "grbase",
"gujarati",
- "inhanguljamoextendedb",
- "defaultignorablecodepoint",
- "inplayingcards",
- "bamu",
- "inkanbun",
- "incjkradicalssupplement",
- "cypriot",
- "inbamum",
- "inmeroiticcursive",
- "oldturkic",
+ "hexdigit",
+ "khmer",
+ "uppercaseletter",
"insupplementalarrowsb",
"surrogate",
+ "unifiedideograph",
+ "nonspacingmark",
+ "othergraphemeextend",
+ "indevanagariextended",
+ "orkh",
+ "ingeorgiansupplement",
+ "oldnortharabian",
+ "tagalog",
+ "khoj",
+ "bopomofo",
+ "rejang",
+ "buhd",
+ "incjkradicalssupplement",
+ "inkanbun",
+ "variationselector",
+ "inkangxiradicals",
+ "inhighsurrogates",
+ "insupplementaryprivateuseareab",
+ "ogrext",
"batk",
+ "inhanguljamoextendedb",
"inbatak",
- "inlimbu",
- "incypriotsyllabary",
- "dashpunctuation",
+ "incyrillicextendedb",
"innoblock",
- "hyphen",
- "insupplementalpunctuation",
- "ingeorgiansupplement",
- "oupper",
+ "any",
+ "xsux",
+ "bugi",
+ "inkhudawadi",
+ "telugu",
+ "changeswhenuppercased",
+ "grek",
+ "guru",
"paragraphseparator",
- "inbamumsupplement",
- "uppercase",
- "currencysymbol",
- "sk",
- "lu",
- "openpunctuation",
- "inlisu",
- "qmark",
+ "buginese",
+ "inyisyllables",
"egyp",
- "insupplementaryprivateuseareab",
- "limbu",
+ "khudawadi",
+ "unknown",
+ "bassavah",
"inegyptianhieroglyphs",
- "unifiedideograph",
- "intelugu",
- "katakana",
- "inhangulcompatibilityjamo",
- "upper",
+ "buhid",
"inkayahli",
- "cwu",
+ "inmeroiticcursive",
"incjkcompatibility",
- "uppercaseletter",
- "bugi",
- "buginese",
- "any",
- "inyisyllables",
- "inbopomofoextended",
- "inboxdrawing",
- "changeswhenuppercased",
- "unknown",
- "quotationmark",
- "buhd",
- "punctuation",
"oldsoutharabian",
- "kayahli",
- "incjkunifiedideographs",
- "incjkunifiedideographsextensiona",
+ "quotationmark",
+ "inhangulcompatibilityjamo",
+ "qmark",
"incjkunifiedideographsextensionc",
- "telugu",
- "guru",
- "greek",
- "grlink",
- "buhid",
- "batak",
- "blank",
+ "sk",
+ "incjkunifiedideographsextensiona",
+ "incjkunifiedideographs",
+ "katakana",
+ "kayahli",
+ "duployan",
"incjkunifiedideographsextensiond",
- "graphemelink",
+ "inbopomofoextended",
+ "khojki",
+ "zyyy",
"egyptianhieroglyphs",
"incjkunifiedideographsextensionb",
- "zyyy",
- "gurmukhi"
+ "batak",
+ "blank",
+ "inboxdrawing",
+ "greek",
+ "gurmukhi",
+ "grlink",
+ "graphemelink"
#endif /* USE_UNICODE_PROPERTIES */
};
#define uniname2ctype_pool ((const char *) &uniname2ctype_pool_contents)
@@ -27366,1138 +31173,1296 @@ uniname2ctype_p (str, len)
#ifdef USE_UNICODE_PROPERTIES
{-1}, {-1}, {-1},
{(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3, 34},
- {-1},
- {(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_str16, 208},
+ {(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_str18, 20},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str13, 17},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str20, 22},
+ {(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},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str31, 438},
{-1}, {-1}, {-1},
- {(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},
+ {(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},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str44, 383},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str32, 47},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str46, 47},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str34, 101},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str35, 114},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str48, 49},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str38, 33},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str51, 168},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str42, 14},
+ {(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},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str44, 18},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str45, 128},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str61, 258},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str64, 14},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str65, 46},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str49, 401},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str69, 265},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str52, 377},
+ {(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_str62, 226},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str64, 31},
+ {(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},
+ {-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_str66, 239},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str69, 30},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str117, 263},
+ {-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},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str144, 413},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str72, 49},
+ {(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},
{-1},
- {(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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str153, 13},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str84, 412},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str155, 302},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str86, 168},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str157, 325},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str90, 382},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str161, 331},
{-1},
- {(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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str163, 276},
{-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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str166, 488},
{-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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str170, 339},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str173, 426},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str116, 237},
+ {(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_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_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_str172, 26},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str183, 152},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str175, 152},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str186, 65},
{-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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str190, 92},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str184, 75},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str203, 75},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str186, 75},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str187, 111},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str205, 75},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str206, 111},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str189, 13},
+ {(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_str199, 250},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str201, 272},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str202, 120},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str223, 341},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str205, 23},
+ {(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_str207, 36},
+ {(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_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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str243, 36},
+ {-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},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str220, 314},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str252, 28},
{-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},
+ {(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},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str227, 148},
+ {(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},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str263, 256},
{-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_str244, 78},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str245, 155},
+ {(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},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str247, 160},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str248, 323},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str272, 148},
+ {-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_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},
+ {(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},
+ {-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_str259, 260},
+ {(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},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str261, 39},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str335, 169},
{-1},
- {(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},
+ {(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},
+ {-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},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str279, 431},
+ {(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},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str380, 394},
{-1},
- {(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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str382, 451},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str301, 333},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str386, 151},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str388, 82},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str303, 64},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str304, 405},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str390, 183},
+ {-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},
{-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},
+ {(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},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str410, 266},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str412, 61},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str414, 208},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str415, 211},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str316, 287},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str418, 205},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str419, 186},
{-1}, {-1}, {-1},
- {(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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str423, 196},
{-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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str425, 198},
+ {-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},
{-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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str441, 486},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str375, 123},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str453, 66},
{-1}, {-1},
- {(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},
+ {(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_str389, 174},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str398, 295},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str468, 481},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str400, 150},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str403, 365},
+ {(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},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str485, 326},
{-1},
- {(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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str487, 218},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str489, 123},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str490, 64},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str412, 74},
+ {(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},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str414, 416},
+ {(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_str420, 93},
+ {(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},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str556, 9},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1},
- {(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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str570, 87},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str571, 171},
{-1},
- {(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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str573, 184},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str582, 197},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str584, 174},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str453, 70},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str454, 66},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str587, 163},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(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},
+ {(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_str470, 151},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str600, 191},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str601, 455},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str603, 229},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str604, 308},
{-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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str608, 307},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str609, 37},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str478, 67},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str611, 141},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str612, 288},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str480, 45},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str481, 278},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str614, 21},
{-1}, {-1},
- {(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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str617, 264},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str509, 341},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str620, 1},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str511, 52},
+ {(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},
{-1}, {-1},
- {(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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str627, 74},
{-1}, {-1},
- {(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},
+ {(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},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str531, 116},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str532, 9},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str640, 50},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str542, 390},
+ {(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},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str545, 281},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str699, 226},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str700, 187},
{-1}, {-1},
- {(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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str703, 35},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str555, 67},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str705, 23},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str558, 425},
+ {(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},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str560, 206},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str713, 199},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str715, 113},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str563, 396},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str564, 100},
+ {(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},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str568, 325},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str749, 428},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str572, 262},
+ {(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},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str574, 153},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str575, 163},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str763, 125},
{-1}, {-1}, {-1},
- {(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},
+ {(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},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str777, 101},
{-1},
- {(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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str779, 371},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str608, 153},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str783, 425},
{-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},
+ {(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},
{-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_str626, 210},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str627, 185},
- {-1}, {-1},
- {(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},
+ {(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},
{-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},
+ {(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},
{-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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str830, 440},
{-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_str660, 186},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str668, 245},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str832, 441},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str834, 128},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str672, 18},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str838, 410},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str679, 188},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str845, 144},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str682, 118},
+ {(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},
{-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},
- {-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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str858, 57},
{-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_str713, 116},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str861, 163},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str864, 229},
{-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_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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str866, 484},
{-1}, {-1},
- {(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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str869, 54},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str750, 223},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str871, 323},
{-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_str771, 160},
+ {(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},
{-1}, {-1}, {-1}, {-1},
- {(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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str932, 454},
{-1},
- {(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},
+ {(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
{-1}, {-1},
- {(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},
+#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
{-1}, {-1},
- {(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},
+#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
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str818, 41},
+#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
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str823, 111},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str824, 192},
+#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},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str826, 173},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str827, 303},
+#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},
{-1}, {-1},
- {(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},
+#endif /* USE_UNICODE_AGE_PROPERTIES */
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str970, 157},
{-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},
- {(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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str972, 18},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str854, 352},
+ {(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},
{-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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str982, 103},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str869, 184},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str870, 429},
+ {(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},
+ {-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},
+ {-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_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_str912, 69},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str913, 202},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str914, 71},
+ {(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_str917, 190},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1017, 475},
{-1},
- {(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},
+ {(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},
+ {-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_str933, 6},
+ {(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_str936, 26},
+ {(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},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1046, 398},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str938, 284},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str939, 369},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1048, 337},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1049, 213},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1052, 137},
+ {-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},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str943, 294},
+ {(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},
{-1},
- {(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},
+ {(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},
{-1},
- {(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},
+ {(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},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str956, 256},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1080, 42},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str960, 308},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1084, 12},
{-1},
- {(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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1086, 95},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1089, 257},
{-1}, {-1}, {-1},
- {(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},
+ {(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},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str981, 83},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1118, 197},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1121, 37},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str983, 189},
+ {(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},
{-1}, {-1}, {-1}, {-1},
- {(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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1134, 287},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1136, 25},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str994, 277},
+ {(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},
{-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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1151, 140},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1000, 84},
+ {(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},
{-1}, {-1},
- {(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_str1006, 397},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1007, 95},
+ {(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_str1010, 285},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1184, 126},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1186, 98},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1187, 447},
{-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},
+ {(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},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1035, 366},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1201, 103},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1202, 208},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1039, 16},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1206, 105},
{-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},
+ {(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},
{-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}, {-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},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1067, 126},
+ {(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},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1069, 311},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1070, 137},
+ {(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},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1072, 288},
+ {(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},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1074, 27},
+ {(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},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1076, 80},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1283, 71},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1078, 345},
+ {(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},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1081, 12},
+ {(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},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1084, 348},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1317, 329},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1318, 26},
{-1}, {-1},
- {(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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1321, 332},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1322, 222},
{-1},
- {(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_str1107, 167},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1324, 8},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1110, 201},
- {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1114, 389},
+ {(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},
{-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_str1129, 293},
+ {(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_str1133, 174},
- {-1},
- {(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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1368, 390},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1147, 183},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1373, 479},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1},
- {(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},
+ {(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},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1393, 91},
+ {-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},
+ {-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_str1162, 140},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1409, 11},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1412, 4},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1170, 144},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1420, 68},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1421, 379},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1173, 121},
+ {(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},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1179, 72},
+ {(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},
{-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},
+ {(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},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1188, 249},
+ {(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_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},
+ {(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},
{-1},
- {(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_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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1469, 79},
+ {-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},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1253, 187},
+ {(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},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1256, 184},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1495, 433},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1259, 130},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1498, 180},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1261, 200},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1262, 205},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1500, 72},
{-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_str1279, 257},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1502, 49},
{-1}, {-1},
- {(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},
+ {(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},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1300, 129},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1516, 402},
{-1},
- {(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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1518, 405},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1310, 115},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1521, 396},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1522, 446},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1313, 360},
+ {(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_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},
+ {(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},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1323, 424},
- {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1328, 144},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1542, 353},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1330, 193},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1544, 346},
+ {-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},
{-1}, {-1}, {-1},
- {(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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1555, 358},
{-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_str1362, 40},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1372, 422},
+ {(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},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1377, 241},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1564, 495},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1389, 399},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1576, 389},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1577, 145},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1393, 195},
+ {(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},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1396, 138},
- {-1},
- {(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},
+ {(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},
{-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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1598, 393},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1413, 199},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1416, 268},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1600, 119},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1422, 199},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1606, 292},
{-1},
- {(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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1608, 387},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1609, 69},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1431, 411},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1432, 175},
+ {(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},
{-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_str1438, 350},
+ {(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_str1442, 147},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1443, 243},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1632, 319},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1636, 62},
{-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},
+ {(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},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1452, 336},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1656, 467},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1457, 142},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1661, 214},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1662, 274},
{-1}, {-1},
- {(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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1665, 313},
{-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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1670, 490},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1671, 133},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-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_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_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}, {-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_str1519, 139},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1520, 139},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1689, 370},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1523, 318},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1692, 30},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1525, 165},
+ {(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},
+ {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1700, 230},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1530, 49},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1531, 339},
+ {(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},
{-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_str1540, 124},
+ {(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_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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1729, 220},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1732, 311},
{-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_str1569, 96},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1736, 381},
+ {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1742, 399},
{-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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1744, 165},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1581, 292},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1747, 77},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1583, 259},
+ {(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},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1757, 200},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1758, 176},
{-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_str1598, 96},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1765, 149},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1605, 71},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1606, 177},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1772, 347},
{-1}, {-1},
- {(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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1775, 312},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1620, 90},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-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_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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1797, 230},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1802, 297},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1645, 265},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1804, 174},
{-1}, {-1},
- {(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_str1664, 31},
- {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1670, 332},
+ {(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_str1676, 98},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1822, 300},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1824, 340},
{-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_str1688, 108},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1831, 268},
{-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_str1701, 134},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1835, 83},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1836, 90},
+ {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1841, 269},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1703, 134},
+ {(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},
{-1}, {-1}, {-1}, {-1}, {-1},
- {(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_str1859, 71},
{-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_str1729, 46},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1865, 90},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1866, 301},
{-1}, {-1},
- {(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},
+ {(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},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1759, 322},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1878, 464},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1761, 79},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1880, 142},
{-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_str1787, 342},
+ {(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},
{-1}, {-1},
- {(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},
+ {(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},
{-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_str1829, 291},
+ {(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},
{-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1831, 171},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1964, 404},
+ {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1967, 61},
{-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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1971, 115},
{-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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1976, 345},
{-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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1980, 303},
+ {-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},
{-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1899, 193},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1900, 225},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1997, 108},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1998, 38},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1904, 108},
+ {(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},
{-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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2021, 203},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1932, 191},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2028, 452},
{-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}, {-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}, {-1}, {-1},
- {(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},
+ {(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},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str1988, 70},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2080, 100},
{-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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2088, 181},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(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},
+ {(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},
{-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2033, 321},
+ {(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},
{-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_str2053, 398},
- {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2055, 164},
+ {(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},
{-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_str2094, 166},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(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}, {-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_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},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2141, 180},
+ {(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},
+ {-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_str2162, 320},
- {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2165, 316},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2227, 220},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2237, 33},
{-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2178, 191},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2241, 216},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2242, 377},
+ {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2252, 164},
{-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},
+ {(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},
+ {-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},
{-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}, {-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}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
{-1}, {-1}, {-1}, {-1}, {-1}, {-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_str2299, 58},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2406, 228},
{-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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2417, 349},
{-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},
+ {(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_str2371, 181},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2372, 154},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2449, 166},
{-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},
+ {(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},
- {(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},
- {-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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2502, 500},
+ {-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_str2429, 107},
+ {(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}, {-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}, {-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_str2454, 10},
+ {(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},
{-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},
{-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},
{-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_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_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},
+ {(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}, {-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_str2549, 127},
+ {-1},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2709, 117},
{-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},
{-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}, {-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_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},
- {(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},
- {(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}, {-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_str2727, 208},
- {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str2737, 181},
+ {(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},
{-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},
+ {-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},
@@ -28506,28 +32471,20 @@ 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}, {-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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3112, 145},
{-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
- {-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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3137, 178},
{-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},
@@ -28539,10 +32496,10 @@ 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},
+ {(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},
@@ -28550,27 +32507,39 @@ 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},
{-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},
- {(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},
@@ -28578,8 +32547,6 @@ 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},
@@ -28587,12 +32554,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_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},
@@ -28611,62 +32574,56 @@ 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},
-#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},
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3941, 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},
{-1}, {-1}, {-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},
@@ -28690,7 +32647,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_str4167, 85}
+ {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str4322, 73}
#endif /* USE_UNICODE_PROPERTIES */
};
diff --git a/enc/us_ascii.c b/enc/us_ascii.c
index 1b47778391..18d0685040 100644
--- a/enc/us_ascii.c
+++ b/enc/us_ascii.c
@@ -3,9 +3,9 @@
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) = {
diff --git a/enc/utf_16_32.h b/enc/utf_16_32.h
index b232767ee3..da58d1b23c 100644
--- a/enc/utf_16_32.h
+++ b/enc/utf_16_32.h
@@ -1,5 +1,5 @@
#include "regenc.h"
/* dummy for unsupported, statefull encoding */
-#define ENC_DUMMY_UNICODE(name) ENC_DUMMY(name)
+#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 8b25d473a7..a61ae00863 100644
--- a/enc/utf_16be.c
+++ b/enc/utf_16be.c
@@ -29,10 +29,7 @@
#include "regenc.h"
-#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)
-
+#if 0
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,
@@ -51,6 +48,7 @@ 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 8feb7ad769..7d176e710e 100644
--- a/enc/utf_16le.c
+++ b/enc/utf_16le.c
@@ -29,10 +29,7 @@
#include "regenc.h"
-#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)
-
+#if 0
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,
@@ -51,6 +48,7 @@ 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_8.c b/enc/utf_8.c
index dae1f3a1bc..b8f38e9d58 100644
--- a/enc/utf_8.c
+++ b/enc/utf_8.c
@@ -367,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;
@@ -395,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);
diff --git a/enc/windows_1251.c b/enc/windows_1251.c
index 73060962c3..191d631b88 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(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
+ numberof(CaseFoldMap), 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(
- sizeof(CaseFoldMap)/sizeof(OnigPairCaseFoldCodes), CaseFoldMap, 0,
+ numberof(CaseFoldMap), CaseFoldMap, 0,
flag, p, end, items);
}
diff --git a/encoding.c b/encoding.c
index 26a87913dc..e3a0978253 100644
--- a/encoding.c
+++ b/encoding.c
@@ -14,20 +14,19 @@
#include "internal.h"
#include "regenc.h"
#include <ctype.h>
-#ifndef NO_LOCALE_CHARMAP
-#ifdef __CYGWIN__
-#include <windows.h>
-#endif
-#ifdef HAVE_LANGINFO_H
-#include <langinfo.h>
-#endif
-#endif
#include "ruby/util.h"
+#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);
void rb_enc_set_base(const char *name, const char *orig);
+int rb_enc_set_dummy(int index);
void rb_encdb_declare(const char *name);
int rb_encdb_replicate(const char *name, const char *orig);
int rb_encdb_dummy(const char *name);
@@ -53,6 +52,13 @@ 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
@@ -74,14 +80,16 @@ enc_memsize(const void *p)
static const rb_data_type_t encoding_data_type = {
"encoding",
{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))
static VALUE
enc_new(rb_encoding *encoding)
{
- return TypedData_Wrap_Struct(rb_cEncoding, &encoding_data_type, encoding);
+ return TypedData_Wrap_Struct(rb_cEncoding, &encoding_data_type, (void *)encoding);
}
static VALUE
@@ -108,6 +116,18 @@ 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
@@ -125,21 +145,47 @@ check_encoding(rb_encoding *enc)
static int
enc_check_encoding(VALUE obj)
{
- if (SPECIAL_CONST_P(obj) || !rb_typeddata_is_kind_of(obj, &encoding_data_type)) {
+ if (!is_obj_encoding(obj)) {
return -1;
}
return check_encoding(RDATA(obj)->data);
}
-static int
+NORETURN(static void not_encoding(VALUE enc));
+static void
+not_encoding(VALUE enc)
+{
+ rb_raise(rb_eTypeError, "wrong argument type %"PRIsVALUE" (expected Encoding)",
+ rb_obj_class(enc));
+}
+
+static rb_encoding *
must_encoding(VALUE enc)
{
int index = enc_check_encoding(enc);
if (index < 0) {
- rb_raise(rb_eTypeError, "wrong argument type %s (expected Encoding)",
- rb_obj_classname(enc));
+ not_encoding(enc);
}
- return index;
+ return DATA_PTR(enc);
+}
+
+static rb_encoding *
+must_encindex(int index)
+{
+ rb_encoding *enc = rb_enc_from_index(index);
+ if (!enc) {
+ rb_raise(rb_eEncodingError, "encoding index out of bound: %d",
+ index);
+ }
+ if (ENC_TO_ENCINDEX(enc) != (int)(index & ENC_INDEX_MASK)) {
+ rb_raise(rb_eEncodingError, "wrong encoding index %d for %s (expected %d)",
+ index, rb_enc_name(enc), ENC_TO_ENCINDEX(enc));
+ }
+ if (enc_autoload_p(enc) && enc_autoload(enc) == -1) {
+ rb_loaderror("failed to load encoding (%s)",
+ rb_enc_name(enc));
+ }
+ return enc;
}
int
@@ -179,7 +225,7 @@ str_to_encindex(VALUE enc)
{
int idx = str_find_encindex(enc);
if (idx < 0) {
- rb_raise(rb_eArgError, "unknown encoding name - %s", RSTRING_PTR(enc));
+ rb_raise(rb_eArgError, "unknown encoding name - %"PRIsVALUE, enc);
}
return idx;
}
@@ -229,9 +275,10 @@ enc_table_expand(int newsize)
}
static int
-enc_register_at(int index, const char *name, rb_encoding *encoding)
+enc_register_at(int index, const char *name, rb_encoding *base_encoding)
{
struct rb_encoding_entry *ent = &enc_table.list[index];
+ rb_raw_encoding *encoding;
VALUE list;
if (!valid_encoding_name_p(name)) return -1;
@@ -241,18 +288,19 @@ enc_register_at(int index, const char *name, rb_encoding *encoding)
else if (STRCASECMP(name, ent->name)) {
return -1;
}
- if (!ent->enc) {
- ent->enc = xmalloc(sizeof(rb_encoding));
+ encoding = (rb_raw_encoding *)ent->enc;
+ if (!encoding) {
+ encoding = xmalloc(sizeof(rb_encoding));
}
- if (encoding) {
- *ent->enc = *encoding;
+ if (base_encoding) {
+ *encoding = *base_encoding;
}
else {
- memset(ent->enc, 0, sizeof(*ent->enc));
+ memset(encoding, 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))) {
@@ -323,7 +371,7 @@ set_base_encoding(int index, rb_encoding *base)
rb_encoding *enc = enc_table.list[index].enc;
enc_table.list[index].base = base;
- if (rb_enc_dummy_p(base)) ENC_SET_DUMMY(enc);
+ if (ENC_DUMMY_P(base)) ENC_SET_DUMMY((rb_raw_encoding *)enc);
return enc;
}
@@ -339,6 +387,18 @@ rb_enc_set_base(const char *name, const char *orig)
set_base_encoding(idx, rb_enc_from_index(origidx));
}
+/* for encdb.h
+ * Set encoding dummy.
+ */
+int
+rb_enc_set_dummy(int index)
+{
+ rb_encoding *enc = enc_table.list[index].enc;
+
+ ENC_SET_DUMMY((rb_raw_encoding *)enc);
+ return index;
+}
+
int
rb_enc_replicate(const char *name, rb_encoding *encoding)
{
@@ -402,7 +462,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(enc);
+ ENC_SET_DUMMY((rb_raw_encoding *)enc);
return index;
}
@@ -413,7 +473,7 @@ rb_encdb_dummy(const char *name)
rb_enc_registered(name));
rb_encoding *enc = enc_table.list[index].enc;
- ENC_SET_DUMMY(enc);
+ ENC_SET_DUMMY((rb_raw_encoding *)enc);
return index;
}
@@ -433,7 +493,7 @@ rb_encdb_dummy(const char *name)
static VALUE
enc_dummy_p(VALUE enc)
{
- return ENC_DUMMY_P(enc_table.list[must_encoding(enc)].enc) ? Qtrue : Qfalse;
+ return ENC_DUMMY_P(must_encoding(enc)) ? Qtrue : Qfalse;
}
/*
@@ -449,7 +509,7 @@ enc_dummy_p(VALUE enc)
static VALUE
enc_ascii_compatible_p(VALUE enc)
{
- return rb_enc_asciicompat(enc_table.list[must_encoding(enc)].enc) ? Qtrue : Qfalse;
+ return rb_enc_asciicompat(must_encoding(enc)) ? Qtrue : Qfalse;
}
/*
@@ -516,16 +576,9 @@ rb_encdb_alias(const char *alias, const char *orig)
void
rb_encdb_set_unicode(int index)
{
- rb_enc_from_index(index)->flags |= ONIGENC_FLAG_UNICODE;
+ ((rb_raw_encoding *)rb_enc_from_index(index))->flags |= ONIGENC_FLAG_UNICODE;
}
-enum {
- ENCINDEX_ASCII,
- ENCINDEX_UTF_8,
- ENCINDEX_US_ASCII,
- ENCINDEX_BUILTIN_MAX
-};
-
extern rb_encoding OnigEncodingUTF_8;
extern rb_encoding OnigEncodingUS_ASCII;
@@ -541,6 +594,18 @@ rb_enc_init(void)
ENC_REGISTER(UTF_8);
ENC_REGISTER(US_ASCII);
#undef ENC_REGISTER
+#define ENCDB_REGISTER(name, enc) enc_register_at(ENCINDEX_##enc, name, NULL)
+ ENCDB_REGISTER("UTF-16BE", UTF_16BE);
+ ENCDB_REGISTER("UTF-16LE", UTF_16LE);
+ ENCDB_REGISTER("UTF-32BE", UTF_32BE);
+ ENCDB_REGISTER("UTF-32LE", UTF_32LE);
+ ENCDB_REGISTER("UTF-16", UTF_16);
+ ENCDB_REGISTER("UTF-32", UTF_32);
+ ENCDB_REGISTER("UTF8-MAC", UTF8_MAC);
+
+ ENCDB_REGISTER("EUC-JP", EUC_JP);
+ ENCDB_REGISTER("Windows-31J", Windows_31J);
+#undef ENCDB_REGISTER
enc_table.count = ENCINDEX_BUILTIN_MAX;
}
@@ -550,12 +615,18 @@ rb_enc_from_index(int index)
if (!enc_table.list) {
rb_enc_init();
}
- if (index < 0 || enc_table.count <= index) {
+ if (index < 0 || enc_table.count <= (index &= ENC_INDEX_MASK)) {
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)
{
@@ -592,7 +663,7 @@ load_encoding(const char *name)
else if (ISUPPER(*s)) *s = (char)TOLOWER(*s);
++s;
}
- FL_UNSET(enclib, FL_TAINT|FL_UNTRUSTED);
+ FL_UNSET(enclib, FL_TAINT);
OBJ_FREEZE(enclib);
ruby_verbose = Qfalse;
ruby_debug = Qfalse;
@@ -621,8 +692,9 @@ enc_autoload(rb_encoding *enc)
if (enc_autoload_p(base)) {
if (enc_autoload(base) < 0) return -1;
}
- i = ENC_TO_ENCINDEX(enc);
- enc_register_at(i, rb_enc_name(enc), base);
+ 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;
}
else {
i = load_encoding(rb_enc_name(enc));
@@ -671,6 +743,7 @@ 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;
@@ -694,7 +767,7 @@ rb_enc_get_index(VALUE obj)
if (SPECIAL_CONST_P(obj)) {
if (!SYMBOL_P(obj)) return -1;
- obj = rb_id2str(SYM2ID(obj));
+ obj = rb_sym2str(obj);
}
switch (BUILTIN_TYPE(obj)) {
as_default:
@@ -741,23 +814,34 @@ void
rb_enc_set_index(VALUE obj, int idx)
{
rb_check_frozen(obj);
+ must_encindex(idx);
enc_set_index(obj, idx);
}
VALUE
rb_enc_associate_index(VALUE obj, int idx)
{
+ rb_encoding *enc;
+ int oldidx, oldtermlen, termlen;
+
/* enc_check_capable(obj);*/
rb_check_frozen(obj);
- if (rb_enc_get_index(obj) == idx)
+ oldidx = rb_enc_get_index(obj);
+ if (oldidx == idx)
return obj;
if (SPECIAL_CONST_P(obj)) {
rb_raise(rb_eArgError, "cannot set encoding");
}
+ enc = must_encindex(idx);
if (!ENC_CODERANGE_ASCIIONLY(obj) ||
- !rb_enc_asciicompat(rb_enc_from_index(idx))) {
+ !rb_enc_asciicompat(enc)) {
ENC_CODERANGE_CLEAR(obj);
}
+ 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_fill_terminator(obj, termlen);
+ }
enc_set_index(obj, idx);
return obj;
}
@@ -873,7 +957,7 @@ rb_obj_encoding(VALUE obj)
if (idx < 0) {
rb_raise(rb_eTypeError, "unknown encoding");
}
- return rb_enc_from_encoding_index(idx);
+ return rb_enc_from_encoding_index(idx & ENC_INDEX_MASK);
}
int
@@ -960,6 +1044,13 @@ rb_enc_codelen(int c, rb_encoding *enc)
return n;
}
+#undef rb_enc_code_to_mbclen
+int
+rb_enc_code_to_mbclen(int code, rb_encoding *enc)
+{
+ return ONIGENC_CODE_TO_MBCLEN(enc, code);
+}
+
int
rb_enc_toupper(int c, rb_encoding *enc)
{
@@ -984,16 +1075,25 @@ rb_enc_tolower(int c, rb_encoding *enc)
static VALUE
enc_inspect(VALUE self)
{
- VALUE str = rb_sprintf("#<%s:%s%s>", rb_obj_classname(self),
- rb_enc_name((rb_encoding*)DATA_PTR(self)),
- (enc_dummy_p(self) ? " (dummy)" : ""));
- ENCODING_CODERANGE_SET(str, rb_usascii_encindex(), ENC_CODERANGE_7BIT);
- return str;
+ rb_encoding *enc;
+
+ if (!is_data_encoding(self)) {
+ not_encoding(self);
+ }
+ if (!(enc = DATA_PTR(self)) || rb_enc_from_index(rb_enc_to_index(enc)) != enc) {
+ rb_raise(rb_eTypeError, "broken Encoding");
+ }
+ return rb_enc_sprintf(rb_usascii_encoding(),
+ "#<%"PRIsVALUE":%s%s%s>", rb_obj_class(self),
+ rb_enc_name(enc),
+ (ENC_DUMMY_P(enc) ? " (dummy)" : ""),
+ enc_autoload_p(enc) ? " (autoload)" : "");
}
/*
* call-seq:
* enc.name -> string
+ * enc.to_s -> string
*
* Returns the name of the encoding.
*
@@ -1066,13 +1166,11 @@ 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 or symbol.
+ * <i>name</i> should be a string.
*
* 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
@@ -1091,7 +1189,7 @@ static VALUE
enc_find(VALUE klass, VALUE enc)
{
int idx;
- if (RB_TYPE_P(enc, T_DATA) && is_data_encoding(enc))
+ if (is_obj_encoding(enc))
return enc;
idx = str_to_encindex(enc);
if (idx == UNSPECIFIED_ENCODING) return Qnil;
@@ -1201,11 +1299,17 @@ rb_locale_encindex(void)
int idx;
if (NIL_P(charmap))
- idx = rb_usascii_encindex();
+ idx = ENCINDEX_US_ASCII;
else if ((idx = rb_enc_find_index(StringValueCStr(charmap))) < 0)
- idx = rb_ascii8bit_encindex();
+ idx = ENCINDEX_ASCII;
- if (rb_enc_registered("locale") < 0) enc_alias_internal("locale", idx);
+ if (rb_enc_registered("locale") < 0) {
+# if defined _WIN32
+ void Init_w32_codepage(void);
+ Init_w32_codepage();
+# endif
+ enc_alias_internal("locale", idx);
+ }
return idx;
}
@@ -1216,31 +1320,12 @@ rb_locale_encoding(void)
return rb_enc_from_index(rb_locale_encindex());
}
-static int
-enc_set_filesystem_encoding(void)
-{
- int idx;
-#if defined NO_LOCALE_CHARMAP
- idx = rb_enc_to_index(rb_default_external_encoding());
-#elif defined _WIN32 || defined __CYGWIN__
- 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 = rb_ascii8bit_encindex();
-#else
- idx = rb_enc_to_index(rb_default_external_encoding());
-#endif
-
- enc_alias_internal("filesystem", idx);
- return idx;
-}
-
int
rb_filesystem_encindex(void)
{
int idx = rb_enc_registered("filesystem");
if (idx < 0)
- idx = rb_ascii8bit_encindex();
+ idx = ENCINDEX_ASCII;
return idx;
}
@@ -1257,6 +1342,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)
{
@@ -1279,7 +1366,7 @@ enc_set_default_encoding(struct default_encoding *def, VALUE encoding, const cha
}
if (def == &default_external)
- enc_set_filesystem_encoding();
+ enc_alias_internal("filesystem", Init_enc_set_filesystem_encoding());
return overridden;
}
@@ -1399,13 +1486,11 @@ 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.
@@ -1476,32 +1561,7 @@ set_default_internal(VALUE klass, VALUE encoding)
*
*/
VALUE
-rb_locale_charmap(VALUE klass)
-{
-#if defined NO_LOCALE_CHARMAP
- return rb_usascii_str_new2("ASCII-8BIT");
-#elif defined _WIN32 || defined __CYGWIN__
- const char *codeset = 0;
- char cp[sizeof(int) * 3 + 4];
-# ifdef __CYGWIN__
- const char *nl_langinfo_codeset(void);
- codeset = nl_langinfo_codeset();
-# endif
- if (!codeset) {
- UINT codepage = GetConsoleCP();
- if (!codepage) codepage = GetACP();
- snprintf(cp, sizeof(cp), "CP%d", codepage);
- codeset = cp;
- }
- return rb_usascii_str_new2(codeset);
-#elif defined HAVE_LANGINFO_H
- char *codeset;
- codeset = nl_langinfo(CODESET);
- return rb_usascii_str_new2(codeset);
-#else
- return Qnil;
-#endif
-}
+rb_locale_charmap(VALUE klass);
static void
set_encoding_const(const char *name, rb_encoding *enc)
@@ -1678,7 +1738,7 @@ rb_enc_aliases(VALUE klass)
* #=> "R\xC3\xA9sum\xC3\xA9"
* string.encoding
* #=> #<Encoding:ISO-8859-1>
- * string.force_encoding(Encoding::UTF-8)
+ * string.force_encoding(Encoding::UTF_8)
* #=> "R\u00E9sum\u00E9"
*
* Second, it is possible to transcode a string, i.e. translate its internal
@@ -1701,7 +1761,7 @@ rb_enc_aliases(VALUE klass)
* All Ruby script code has an associated Encoding which any String literal
* created in the source code will be associated to.
*
- * The default script encoding is <code>Encoding::US-ASCII</code>, but it can
+ * The default script encoding is <code>Encoding::UTF-8</code> after v2.0, but it can
* be changed by a magic comment on the first line of the source code file (or
* second line, if there is a shebang line on the first). The comment must
* contain the word <code>coding</code> or <code>encoding</code>, followed
@@ -1867,7 +1927,7 @@ Init_Encoding(void)
rb_define_singleton_method(rb_cEncoding, "locale_charmap", rb_locale_charmap, 0);
list = rb_ary_new2(enc_table.count);
- RBASIC(list)->klass = 0;
+ RBASIC_CLEAR_CLASS(list);
rb_encoding_list = list;
rb_gc_register_mark_object(list);
@@ -1906,3 +1966,8 @@ rb_toupper(int c)
return rb_isascii(c) ? ONIGENC_ASCII_CODE_TO_UPPER_CASE(c) : c;
}
+void
+rb_enc_foreach_name(int (*func)(st_data_t name, st_data_t idx, st_data_t arg), st_data_t arg)
+{
+ st_foreach(enc_table.names, func, arg);
+}
diff --git a/enum.c b/enum.c
index 18983bb36d..7920b93c55 100644
--- a/enum.c
+++ b/enum.c
@@ -15,7 +15,7 @@
#include "id.h"
#include "internal.h"
-#define STATIC_ASSERT(name, expr) typedef int static_assert_##name##_check[1 - 2*!(expr)]
+VALUE rb_f_send(int argc, VALUE *argv, VALUE recv);
VALUE rb_mEnumerable;
@@ -30,7 +30,7 @@ static ID id_size;
#define id_lshift idLTLT
VALUE
-rb_enum_values_pack(int argc, VALUE *argv)
+rb_enum_values_pack(int argc, const VALUE *argv)
{
if (argc == 0) return Qnil;
if (argc == 1) return argv[0];
@@ -44,7 +44,7 @@ rb_enum_values_pack(int argc, VALUE *argv)
#define enum_yield rb_yield_values2
static VALUE
-grep_i(VALUE i, VALUE args, int argc, VALUE *argv)
+grep_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
{
NODE *memo = RNODE(args);
ENUM_WANT_SVALUE();
@@ -56,7 +56,7 @@ grep_i(VALUE i, VALUE args, int argc, VALUE *argv)
}
static VALUE
-grep_iter_i(VALUE i, VALUE args, int argc, VALUE *argv)
+grep_iter_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
{
NODE *memo = RNODE(args);
ENUM_WANT_SVALUE();
@@ -97,7 +97,7 @@ enum_grep(VALUE obj, VALUE pat)
}
static VALUE
-count_i(VALUE i, VALUE memop, int argc, VALUE *argv)
+count_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop))
{
NODE *memo = RNODE(memop);
@@ -110,7 +110,7 @@ count_i(VALUE i, VALUE memop, int argc, VALUE *argv)
}
static VALUE
-count_iter_i(VALUE i, VALUE memop, int argc, VALUE *argv)
+count_iter_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop))
{
NODE *memo = RNODE(memop);
@@ -121,7 +121,7 @@ count_iter_i(VALUE i, VALUE memop, int argc, VALUE *argv)
}
static VALUE
-count_all_i(VALUE i, VALUE memop, int argc, VALUE *argv)
+count_all_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop))
{
NODE *memo = RNODE(memop);
@@ -176,7 +176,7 @@ enum_count(int argc, VALUE *argv, VALUE obj)
}
static VALUE
-find_i(VALUE i, VALUE memop, int argc, VALUE *argv)
+find_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop))
{
ENUM_WANT_SVALUE();
@@ -203,8 +203,8 @@ find_i(VALUE i, VALUE memop, int argc, VALUE *argv)
*
* If no block is given, an enumerator is returned instead.
*
- * (1..10).detect { |i| i % 5 == 0 and i % 7 == 0 } #=> nil
- * (1..100).detect { |i| i % 5 == 0 and i % 7 == 0 } #=> 35
+ * (1..10).detect { |i| i % 5 == 0 and i % 7 == 0 } #=> nil
+ * (1..100).find { |i| i % 5 == 0 and i % 7 == 0 } #=> 35
*
*/
@@ -228,7 +228,7 @@ enum_find(int argc, VALUE *argv, VALUE obj)
}
static VALUE
-find_index_i(VALUE i, VALUE memop, int argc, VALUE *argv)
+find_index_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop))
{
NODE *memo = RNODE(memop);
@@ -243,7 +243,7 @@ find_index_i(VALUE i, VALUE memop, int argc, VALUE *argv)
}
static VALUE
-find_index_iter_i(VALUE i, VALUE memop, int argc, VALUE *argv)
+find_index_iter_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop))
{
NODE *memo = RNODE(memop);
@@ -299,7 +299,7 @@ enum_find_index(int argc, VALUE *argv, VALUE obj)
}
static VALUE
-find_all_i(VALUE i, VALUE ary, int argc, VALUE *argv)
+find_all_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
{
ENUM_WANT_SVALUE();
@@ -310,7 +310,7 @@ find_all_i(VALUE i, VALUE ary, int argc, VALUE *argv)
}
static VALUE
-enum_size(VALUE self, VALUE args)
+enum_size(VALUE self, VALUE args, VALUE eobj)
{
VALUE r;
r = rb_check_funcall(self, id_size, 0, 0);
@@ -351,7 +351,7 @@ enum_find_all(VALUE obj)
}
static VALUE
-reject_i(VALUE i, VALUE ary, int argc, VALUE *argv)
+reject_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
{
ENUM_WANT_SVALUE();
@@ -392,7 +392,7 @@ enum_reject(VALUE obj)
}
static VALUE
-collect_i(VALUE i, VALUE ary, int argc, VALUE *argv)
+collect_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
{
rb_ary_push(ary, enum_yield(argc, argv));
@@ -400,7 +400,7 @@ collect_i(VALUE i, VALUE ary, int argc, VALUE *argv)
}
static VALUE
-collect_all(VALUE i, VALUE ary, int argc, VALUE *argv)
+collect_all(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
{
rb_thread_check_ints();
rb_ary_push(ary, rb_enum_values_pack(argc, argv));
@@ -420,7 +420,7 @@ collect_all(VALUE i, VALUE ary, int argc, VALUE *argv)
*
* If no block is given, an enumerator is returned instead.
*
- * (1..4).collect { |i| i*i } #=> [1, 4, 9, 16]
+ * (1..4).map { |i| i*i } #=> [1, 4, 9, 16]
* (1..4).collect { "cat" } #=> ["cat", "cat", "cat", "cat"]
*
*/
@@ -439,7 +439,7 @@ enum_collect(VALUE obj)
}
static VALUE
-flat_map_i(VALUE i, VALUE ary, int argc, VALUE *argv)
+flat_map_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
{
VALUE tmp;
@@ -487,13 +487,16 @@ enum_flat_map(VALUE obj)
/*
* call-seq:
- * enum.to_a -> array
- * enum.entries -> array
+ * enum.to_a(*args) -> array
+ * enum.entries(*args) -> array
*
* Returns an array containing the items in <i>enum</i>.
*
* (1..7).to_a #=> [1, 2, 3, 4, 5, 6, 7]
* { 'a'=>1, 'b'=>2, 'c'=>3 }.to_a #=> [["a", 1], ["b", 2], ["c", 3]]
+ *
+ * require 'prime'
+ * Prime.entries 10 #=> [2, 3, 5, 7]
*/
static VALUE
enum_to_a(int argc, VALUE *argv, VALUE obj)
@@ -507,7 +510,46 @@ enum_to_a(int argc, VALUE *argv, VALUE obj)
}
static VALUE
-inject_i(VALUE i, VALUE p, int argc, VALUE *argv)
+enum_to_h_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, hash))
+{
+ 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));
+ }
+ rb_hash_aset(hash, RARRAY_AREF(key_value_pair, 0), RARRAY_AREF(key_value_pair, 1));
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * enum.to_h(*args) -> hash
+ *
+ * Returns the result of interpreting <i>enum</i> as a list of
+ * <tt>[key, value]</tt> pairs.
+ *
+ * %i[hello world].each_with_index.to_h
+ * # => {:hello => 0, :world => 1}
+ */
+
+static VALUE
+enum_to_h(int argc, VALUE *argv, VALUE obj)
+{
+ VALUE hash = rb_hash_new();
+ rb_block_call(obj, id_each, argc, argv, enum_to_h_i, hash);
+ OBJ_INFECT(hash, obj);
+ return hash;
+}
+
+static VALUE
+inject_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, p))
{
NODE *memo = RNODE(p);
@@ -524,9 +566,10 @@ inject_i(VALUE i, VALUE p, int argc, VALUE *argv)
}
static VALUE
-inject_op_i(VALUE i, VALUE p, int argc, VALUE *argv)
+inject_op_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, p))
{
NODE *memo = RNODE(p);
+ VALUE name;
ENUM_WANT_SVALUE();
@@ -534,8 +577,14 @@ inject_op_i(VALUE i, VALUE p, int argc, VALUE *argv)
memo->u2.argc = 1;
memo->u1.value = i;
}
+ else if (SYMBOL_P(name = memo->u3.value)) {
+ memo->u1.value = rb_funcall(memo->u1.value, SYM2ID(name), 1, i);
+ }
else {
- memo->u1.value = rb_funcall(memo->u1.value, memo->u3.id, 1, i);
+ VALUE args[2];
+ args[0] = name;
+ args[1] = i;
+ memo->u1.value = rb_f_send(numberof(args), args, memo->u1.value);
}
return Qnil;
}
@@ -588,7 +637,8 @@ enum_inject(int argc, VALUE *argv, VALUE obj)
{
NODE *memo;
VALUE init, op;
- VALUE (*iter)(VALUE, VALUE, int, VALUE*) = inject_i;
+ rb_block_call_func *iter = inject_i;
+ ID id;
switch (rb_scan_args(argc, argv, "02", &init, &op)) {
case 0:
@@ -597,7 +647,8 @@ enum_inject(int argc, VALUE *argv, VALUE obj)
if (rb_block_given_p()) {
break;
}
- op = (VALUE)rb_to_id(init);
+ id = rb_check_id(&init);
+ op = id ? ID2SYM(id) : init;
argc = 0;
init = Qnil;
iter = inject_op_i;
@@ -606,7 +657,8 @@ enum_inject(int argc, VALUE *argv, VALUE obj)
if (rb_block_given_p()) {
rb_warning("given block not used");
}
- op = (VALUE)rb_to_id(op);
+ id = rb_check_id(&op);
+ if (id) op = ID2SYM(id);
iter = inject_op_i;
break;
}
@@ -616,7 +668,7 @@ enum_inject(int argc, VALUE *argv, VALUE obj)
}
static VALUE
-partition_i(VALUE i, VALUE arys, int argc, VALUE *argv)
+partition_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, arys))
{
NODE *memo = RNODE(arys);
VALUE ary;
@@ -661,7 +713,7 @@ enum_partition(VALUE obj)
}
static VALUE
-group_by_i(VALUE i, VALUE hash, int argc, VALUE *argv)
+group_by_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, hash))
{
VALUE group;
VALUE values;
@@ -710,7 +762,7 @@ enum_group_by(VALUE obj)
}
static VALUE
-first_i(VALUE i, VALUE params, int argc, VALUE *argv)
+first_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, params))
{
NODE *memo = RNODE(params);
ENUM_WANT_SVALUE();
@@ -786,7 +838,7 @@ struct sort_by_data {
};
static VALUE
-sort_by_i(VALUE i, VALUE _data, int argc, VALUE *argv)
+sort_by_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, _data))
{
struct sort_by_data *data = (struct sort_by_data *)&RNODE(_data)->u1;
VALUE ary = data->ary;
@@ -803,8 +855,8 @@ sort_by_i(VALUE i, VALUE _data, int argc, VALUE *argv)
rb_raise(rb_eRuntimeError, "sort_by reentered");
}
- RARRAY_PTR(data->buf)[data->n*2] = v;
- RARRAY_PTR(data->buf)[data->n*2+1] = i;
+ RARRAY_ASET(data->buf, data->n*2, v);
+ RARRAY_ASET(data->buf, data->n*2+1, i);
data->n++;
if (data->n == SORT_BY_BUFSIZE) {
rb_ary_concat(ary, data->buf);
@@ -917,7 +969,7 @@ enum_sort_by(VALUE obj)
else {
ary = rb_ary_new();
}
- RBASIC(ary)->klass = 0;
+ RBASIC_CLEAR_CLASS(ary);
buf = rb_ary_tmp_new(SORT_BY_BUFSIZE*2);
rb_ary_store(buf, SORT_BY_BUFSIZE*2-1, Qnil);
memo = NEW_MEMO(0, 0, 0);
@@ -934,17 +986,18 @@ enum_sort_by(VALUE obj)
rb_ary_concat(ary, buf);
}
if (RARRAY_LEN(ary) > 2) {
- ruby_qsort(RARRAY_PTR(ary), RARRAY_LEN(ary)/2, 2*sizeof(VALUE),
- sort_by_cmp, (void *)ary);
+ RARRAY_PTR_USE(ary, ptr,
+ ruby_qsort(ptr, RARRAY_LEN(ary)/2, 2*sizeof(VALUE),
+ sort_by_cmp, (void *)ary));
}
if (RBASIC(ary)->klass) {
rb_raise(rb_eRuntimeError, "sort_by reentered");
}
for (i=1; i<RARRAY_LEN(ary); i+=2) {
- RARRAY_PTR(ary)[i/2] = RARRAY_PTR(ary)[i];
+ RARRAY_ASET(ary, i/2, RARRAY_AREF(ary, i));
}
rb_ary_resize(ary, RARRAY_LEN(ary)/2);
- RBASIC(ary)->klass = rb_cArray;
+ RBASIC_SET_CLASS_RAW(ary, rb_cArray);
OBJ_INFECT(ary, memo);
return ary;
@@ -956,13 +1009,13 @@ enum_sort_by(VALUE obj)
static VALUE enum_##name##_func(VALUE result, NODE *memo); \
\
static VALUE \
-name##_i(VALUE i, VALUE memo, int argc, VALUE *argv) \
+name##_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memo)) \
{ \
return enum_##name##_func(rb_enum_values_pack(argc, argv), RNODE(memo)); \
} \
\
static VALUE \
-name##_iter_i(VALUE i, VALUE memo, int argc, VALUE *argv) \
+name##_iter_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memo)) \
{ \
return enum_##name##_func(enum_yield(argc, argv), RNODE(memo)); \
} \
@@ -1052,6 +1105,190 @@ DEFINE_ENUMFUNCS(one)
return Qnil;
}
+struct nmin_data {
+ long n;
+ long bufmax;
+ long curlen;
+ VALUE buf;
+ 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 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 store_index;
+ 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->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;
+
+ ENUM_WANT_SVALUE();
+
+ if (data->by)
+ rb_ary_push(data->buf, rb_yield(i));
+ 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.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);
+ }
+ *((VALUE *)&RBASIC(result)->klass) = rb_cArray;
+ return result;
+
+}
+
/*
* call-seq:
* enum.one? [{ |obj| block }] -> true or false
@@ -1069,7 +1306,6 @@ DEFINE_ENUMFUNCS(one)
* [ nil, true, false ].one? #=> true
*
*/
-
static VALUE
enum_one(VALUE obj)
{
@@ -1115,7 +1351,7 @@ enum_none(VALUE obj)
}
static VALUE
-min_i(VALUE i, VALUE args, int argc, VALUE *argv)
+min_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
{
VALUE cmp;
NODE *memo = RNODE(args);
@@ -1135,7 +1371,7 @@ min_i(VALUE i, VALUE args, int argc, VALUE *argv)
}
static VALUE
-min_ii(VALUE i, VALUE args, int argc, VALUE *argv)
+min_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
{
VALUE cmp;
NODE *memo = RNODE(args);
@@ -1157,8 +1393,10 @@ min_ii(VALUE i, VALUE args, int argc, VALUE *argv)
/*
* call-seq:
- * enum.min -> obj
- * enum.min { |a, b| block } -> obj
+ * enum.min -> obj
+ * enum.min {| a,b | block } -> obj
+ * enum.min(n) -> array
+ * enum.min(n) {| a,b | block } -> array
*
* Returns the object in <i>enum</i> with the minimum value. The
* first form assumes all objects implement <code>Comparable</code>;
@@ -1167,13 +1405,26 @@ min_ii(VALUE i, VALUE args, int argc, VALUE *argv)
* 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 an array.
+ *
+ * a = %w[albatross dog horse]
+ * a.min(2) #=> ["albatross", "dog"]
+ * a.min(2) {|a, b| a.length <=> b.length } #=> ["dog", "horse"]
*/
static VALUE
-enum_min(VALUE obj)
+enum_min(int argc, VALUE *argv, VALUE obj)
{
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);
@@ -1187,7 +1438,7 @@ enum_min(VALUE obj)
}
static VALUE
-max_i(VALUE i, VALUE args, int argc, VALUE *argv)
+max_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
{
NODE *memo = RNODE(args);
VALUE cmp;
@@ -1207,7 +1458,7 @@ max_i(VALUE i, VALUE args, int argc, VALUE *argv)
}
static VALUE
-max_ii(VALUE i, VALUE args, int argc, VALUE *argv)
+max_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
{
NODE *memo = RNODE(args);
VALUE cmp;
@@ -1228,8 +1479,10 @@ max_ii(VALUE i, VALUE args, int argc, VALUE *argv)
/*
* call-seq:
- * enum.max -> obj
- * enum.max { |a, b| block } -> obj
+ * enum.max -> obj
+ * enum.max { |a, b| block } -> obj
+ * enum.max(n) -> obj
+ * enum.max(n) {|a,b| block } -> obj
*
* Returns the object in _enum_ with the maximum value. The
* first form assumes all objects implement <code>Comparable</code>;
@@ -1238,13 +1491,26 @@ max_ii(VALUE i, VALUE args, int argc, VALUE *argv)
* 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.
+ *
+ * a = %w[albatross dog horse]
+ * a.max(2) #=> ["dog", "horse"]
+ * a.max(2) {|a, b| a.length <=> b.length } #=> ["horse", "albatross"]
*/
static VALUE
-enum_max(VALUE obj)
+enum_max(int argc, VALUE *argv, VALUE obj)
{
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);
@@ -1287,7 +1553,7 @@ minmax_i_update(VALUE i, VALUE j, struct minmax_t *memo)
}
static VALUE
-minmax_i(VALUE i, VALUE _memo, int argc, VALUE *argv)
+minmax_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, _memo))
{
struct minmax_t *memo = (struct minmax_t *)&RNODE(_memo)->u1.value;
int n;
@@ -1339,7 +1605,7 @@ minmax_ii_update(VALUE i, VALUE j, struct minmax_t *memo)
}
static VALUE
-minmax_ii(VALUE i, VALUE _memo, int argc, VALUE *argv)
+minmax_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, _memo))
{
struct minmax_t *memo = (struct minmax_t *)&RNODE(_memo)->u1.value;
int n;
@@ -1411,7 +1677,7 @@ enum_minmax(VALUE obj)
}
static VALUE
-min_by_i(VALUE i, VALUE args, int argc, VALUE *argv)
+min_by_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
{
NODE *memo = RNODE(args);
VALUE v;
@@ -1432,8 +1698,10 @@ min_by_i(VALUE i, VALUE args, int argc, VALUE *argv)
/*
* call-seq:
- * enum.min_by { |obj| block } -> obj
- * enum.min_by -> an_enumerator
+ * enum.min_by {|obj| block } -> obj
+ * enum.min_by -> an_enumerator
+ * enum.min_by(n) {|obj| block } -> array
+ * enum.min_by(n) -> an_enumerator
*
* Returns the object in <i>enum</i> that gives the minimum
* value from the given block.
@@ -1442,14 +1710,26 @@ min_by_i(VALUE i, VALUE args, int argc, VALUE *argv)
*
* 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.
+ *
+ * a = %w[albatross dog horse]
+ * p a.min_by(2) {|x| x.length } #=> ["dog", "horse"]
*/
static VALUE
-enum_min_by(VALUE obj)
+enum_min_by(int argc, VALUE *argv, VALUE obj)
{
NODE *memo;
+ VALUE num;
- RETURN_SIZED_ENUMERATOR(obj, 0, 0, enum_size);
+ 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, 0);
memo = NEW_MEMO(Qundef, Qnil, 0);
rb_block_call(obj, id_each, 0, 0, min_by_i, (VALUE)memo);
@@ -1457,7 +1737,7 @@ enum_min_by(VALUE obj)
}
static VALUE
-max_by_i(VALUE i, VALUE args, int argc, VALUE *argv)
+max_by_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
{
NODE *memo = RNODE(args);
VALUE v;
@@ -1478,8 +1758,10 @@ max_by_i(VALUE i, VALUE args, int argc, VALUE *argv)
/*
* call-seq:
- * enum.max_by { |obj| block } -> obj
- * enum.max_by -> an_enumerator
+ * enum.max_by {|obj| block } -> obj
+ * enum.max_by -> an_enumerator
+ * enum.max_by(n) {|obj| block } -> obj
+ * enum.max_by(n) -> an_enumerator
*
* Returns the object in <i>enum</i> that gives the maximum
* value from the given block.
@@ -1488,14 +1770,71 @@ max_by_i(VALUE i, VALUE args, int argc, VALUE *argv)
*
* a = %w(albatross dog horse)
* a.max_by { |x| x.length } #=> "albatross"
+ *
+ * If the +n+ argument is given, minimum +n+ elements are returned
+ * as an array.
+ *
+ * a = %w[albatross dog horse]
+ * a.max_by(2) {|x| x.length } #=> ["horse", "albatross"]
+ *
+ * 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(VALUE obj)
+enum_max_by(int argc, VALUE *argv, VALUE obj)
{
NODE *memo;
+ VALUE num;
- RETURN_SIZED_ENUMERATOR(obj, 0, 0, enum_size);
+ 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);
memo = NEW_MEMO(Qundef, Qnil, 0);
rb_block_call(obj, id_each, 0, 0, max_by_i, (VALUE)memo);
@@ -1533,7 +1872,7 @@ minmax_by_i_update(VALUE v1, VALUE v2, VALUE i1, VALUE i2, struct minmax_by_t *m
}
static VALUE
-minmax_by_i(VALUE i, VALUE _memo, int argc, VALUE *argv)
+minmax_by_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, _memo))
{
struct minmax_by_t *memo = MEMO_FOR(struct minmax_by_t, _memo);
VALUE vi, vj, j;
@@ -1609,7 +1948,7 @@ enum_minmax_by(VALUE obj)
}
static VALUE
-member_i(VALUE iter, VALUE args, int argc, VALUE *argv)
+member_i(RB_BLOCK_CALL_FUNC_ARGLIST(iter, args))
{
NODE *memo = RNODE(args);
@@ -1643,7 +1982,7 @@ enum_member(VALUE obj, VALUE val)
}
static VALUE
-each_with_index_i(VALUE i, VALUE memo, int argc, VALUE *argv)
+each_with_index_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memo))
{
long n = RNODE(memo)->u3.cnt++;
@@ -1711,7 +2050,7 @@ enum_reverse_each(int argc, VALUE *argv, VALUE obj)
ary = enum_to_a(argc, argv, obj);
for (i = RARRAY_LEN(ary); --i >= 0; ) {
- rb_yield(RARRAY_PTR(ary)[i]);
+ rb_yield(RARRAY_AREF(ary, i));
}
return obj;
@@ -1719,7 +2058,7 @@ enum_reverse_each(int argc, VALUE *argv, VALUE obj)
static VALUE
-each_val_i(VALUE i, VALUE p, int argc, VALUE *argv)
+each_val_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, p))
{
ENUM_WANT_SVALUE();
rb_yield(i);
@@ -1763,8 +2102,11 @@ enum_each_entry(int argc, VALUE *argv, VALUE obj)
return obj;
}
+#define dont_recycle_block_arg(arity) ((arity) == 1 || (arity) < 0)
+#define nd_no_recycle u2.value
+
static VALUE
-each_slice_i(VALUE i, VALUE m, int argc, VALUE *argv)
+each_slice_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, m))
{
NODE *memo = RNODE(m);
VALUE ary = memo->u1.value;
@@ -1776,20 +2118,26 @@ each_slice_i(VALUE i, VALUE m, int argc, VALUE *argv)
if (RARRAY_LEN(ary) == size) {
v = rb_yield(ary);
- memo->u1.value = rb_ary_new2(size);
+
+ if (memo->nd_no_recycle) {
+ memo->u1.value = rb_ary_new2(size);
+ }
+ else {
+ rb_ary_clear(ary);
+ }
}
return v;
}
static VALUE
-enum_each_slice_size(VALUE obj, VALUE args)
+enum_each_slice_size(VALUE obj, VALUE args, VALUE eobj)
{
VALUE n, size;
- long slice_size = NUM2LONG(RARRAY_PTR(args)[0]);
+ long slice_size = NUM2LONG(RARRAY_AREF(args, 0));
if (slice_size <= 0) rb_raise(rb_eArgError, "invalid slice size");
- size = enum_size(obj, 0);
+ size = enum_size(obj, 0, 0);
if (size == Qnil) return Qnil;
n = rb_funcall(size, '+', 1, LONG2NUM(slice_size-1));
@@ -1818,11 +2166,13 @@ enum_each_slice(VALUE obj, VALUE n)
long size = NUM2LONG(n);
VALUE ary;
NODE *memo;
+ int arity;
if (size <= 0) rb_raise(rb_eArgError, "invalid slice size");
RETURN_SIZED_ENUMERATOR(obj, 1, &n, enum_each_slice_size);
ary = rb_ary_new2(size);
- memo = NEW_MEMO(ary, 0, size);
+ arity = rb_block_arity();
+ memo = NEW_MEMO(ary, dont_recycle_block_arg(arity), size);
rb_block_call(obj, id_each, 0, 0, each_slice_i, (VALUE)memo);
ary = memo->u1.value;
if (RARRAY_LEN(ary) > 0) rb_yield(ary);
@@ -1831,7 +2181,7 @@ enum_each_slice(VALUE obj, VALUE n)
}
static VALUE
-each_cons_i(VALUE i, VALUE args, int argc, VALUE *argv)
+each_cons_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
{
NODE *memo = RNODE(args);
VALUE ary = memo->u1.value;
@@ -1844,19 +2194,22 @@ each_cons_i(VALUE i, VALUE args, int argc, VALUE *argv)
}
rb_ary_push(ary, i);
if (RARRAY_LEN(ary) == size) {
- v = rb_yield(rb_ary_dup(ary));
+ if (memo->nd_no_recycle) {
+ ary = rb_ary_dup(ary);
+ }
+ v = rb_yield(ary);
}
return v;
}
static VALUE
-enum_each_cons_size(VALUE obj, VALUE args)
+enum_each_cons_size(VALUE obj, VALUE args, VALUE eobj)
{
VALUE n, size;
- long cons_size = NUM2LONG(RARRAY_PTR(args)[0]);
+ long cons_size = NUM2LONG(RARRAY_AREF(args, 0));
if (cons_size <= 0) rb_raise(rb_eArgError, "invalid size");
- size = enum_size(obj, 0);
+ size = enum_size(obj, 0, 0);
if (size == Qnil) return Qnil;
n = rb_funcall(size, '+', 1, LONG2NUM(1 - cons_size));
@@ -1889,17 +2242,19 @@ enum_each_cons(VALUE obj, VALUE n)
{
long size = NUM2LONG(n);
NODE *memo;
+ int arity;
if (size <= 0) rb_raise(rb_eArgError, "invalid size");
RETURN_SIZED_ENUMERATOR(obj, 1, &n, enum_each_cons_size);
- memo = NEW_MEMO(rb_ary_new2(size), 0, size);
+ arity = rb_block_arity();
+ memo = NEW_MEMO(rb_ary_new2(size), dont_recycle_block_arg(arity), size);
rb_block_call(obj, id_each, 0, 0, each_cons_i, (VALUE)memo);
return Qnil;
}
static VALUE
-each_with_object_i(VALUE i, VALUE memo, int argc, VALUE *argv)
+each_with_object_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memo))
{
ENUM_WANT_SVALUE();
return rb_yield_values(2, i, memo);
@@ -1930,8 +2285,9 @@ enum_each_with_object(VALUE obj, VALUE memo)
}
static VALUE
-zip_ary(VALUE val, NODE *memo, int argc, VALUE *argv)
+zip_ary(RB_BLOCK_CALL_FUNC_ARGLIST(val, memoval))
{
+ NODE *memo = (NODE *)memoval;
volatile VALUE result = memo->u1.value;
volatile VALUE args = memo->u2.value;
long n = memo->u3.cnt++;
@@ -1941,13 +2297,13 @@ zip_ary(VALUE val, NODE *memo, int argc, VALUE *argv)
tmp = rb_ary_new2(RARRAY_LEN(args) + 1);
rb_ary_store(tmp, 0, rb_enum_values_pack(argc, argv));
for (i=0; i<RARRAY_LEN(args); i++) {
- VALUE e = RARRAY_PTR(args)[i];
+ VALUE e = RARRAY_AREF(args, i);
if (RARRAY_LEN(e) <= n) {
rb_ary_push(tmp, Qnil);
}
else {
- rb_ary_push(tmp, RARRAY_PTR(e)[n]);
+ rb_ary_push(tmp, RARRAY_AREF(e, n));
}
}
if (NIL_P(result)) {
@@ -1972,8 +2328,9 @@ call_stop(VALUE *v)
}
static VALUE
-zip_i(VALUE val, NODE *memo, int argc, VALUE *argv)
+zip_i(RB_BLOCK_CALL_FUNC_ARGLIST(val, memoval))
{
+ NODE *memo = (NODE *)memoval;
volatile VALUE result = memo->u1.value;
volatile VALUE args = memo->u2.value;
volatile VALUE tmp;
@@ -1982,16 +2339,16 @@ zip_i(VALUE val, NODE *memo, int argc, VALUE *argv)
tmp = rb_ary_new2(RARRAY_LEN(args) + 1);
rb_ary_store(tmp, 0, rb_enum_values_pack(argc, argv));
for (i=0; i<RARRAY_LEN(args); i++) {
- if (NIL_P(RARRAY_PTR(args)[i])) {
+ if (NIL_P(RARRAY_AREF(args, i))) {
rb_ary_push(tmp, Qnil);
}
else {
VALUE v[2];
- v[1] = RARRAY_PTR(args)[i];
+ v[1] = RARRAY_AREF(args, i);
rb_rescue2(call_next, (VALUE)v, call_stop, (VALUE)v, rb_eStopIteration, (VALUE)0);
if (v[0] == Qundef) {
- RARRAY_PTR(args)[i] = Qnil;
+ RARRAY_ASET(args, i, Qnil);
v[0] = Qnil;
}
rb_ary_push(tmp, v[0]);
@@ -2023,6 +2380,7 @@ zip_i(VALUE val, NODE *memo, int argc, VALUE *argv)
* 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]]
@@ -2069,7 +2427,7 @@ enum_zip(int argc, VALUE *argv, VALUE obj)
}
static VALUE
-take_i(VALUE i, VALUE args, int argc, VALUE *argv)
+take_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
{
NODE *memo = RNODE(args);
rb_ary_push(memo->u1.value, rb_enum_values_pack(argc, argv));
@@ -2085,6 +2443,7 @@ take_i(VALUE i, VALUE args, int argc, VALUE *argv)
*
* a = [1, 2, 3, 4, 5, 0]
* a.take(3) #=> [1, 2, 3]
+ * a.take(30) #=> [1, 2, 3, 4, 5, 0]
*
*/
@@ -2108,7 +2467,7 @@ enum_take(VALUE obj, VALUE n)
static VALUE
-take_while_i(VALUE i, VALUE ary, int argc, VALUE *argv)
+take_while_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
{
if (!RTEST(enum_yield(argc, argv))) rb_iter_break();
rb_ary_push(ary, rb_enum_values_pack(argc, argv));
@@ -2142,7 +2501,7 @@ enum_take_while(VALUE obj)
}
static VALUE
-drop_i(VALUE i, VALUE args, int argc, VALUE *argv)
+drop_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
{
NODE *memo = RNODE(args);
if (memo->u3.cnt == 0) {
@@ -2185,7 +2544,7 @@ enum_drop(VALUE obj, VALUE n)
static VALUE
-drop_while_i(VALUE i, VALUE args, int argc, VALUE *argv)
+drop_while_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
{
NODE *memo = RNODE(args);
ENUM_WANT_SVALUE();
@@ -2229,7 +2588,7 @@ enum_drop_while(VALUE obj)
}
static VALUE
-cycle_i(VALUE i, VALUE ary, int argc, VALUE *argv)
+cycle_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
{
ENUM_WANT_SVALUE();
@@ -2239,16 +2598,16 @@ cycle_i(VALUE i, VALUE ary, int argc, VALUE *argv)
}
static VALUE
-enum_cycle_size(VALUE self, VALUE args)
+enum_cycle_size(VALUE self, VALUE args, VALUE eobj)
{
long mul;
VALUE n = Qnil;
- VALUE size = enum_size(self, args);
+ VALUE size = enum_size(self, args, 0);
if (size == Qnil) return Qnil;
if (args && (RARRAY_LEN(args) > 0)) {
- n = RARRAY_PTR(args)[0];
+ n = RARRAY_AREF(args, 0);
}
if (n == Qnil) return DBL2NUM(INFINITY);
mul = NUM2LONG(n);
@@ -2295,13 +2654,13 @@ enum_cycle(int argc, VALUE *argv, VALUE obj)
if (n <= 0) return Qnil;
}
ary = rb_ary_new();
- RBASIC(ary)->klass = 0;
+ RBASIC_CLEAR_CLASS(ary);
rb_block_call(obj, id_each, 0, 0, cycle_i, ary);
len = RARRAY_LEN(ary);
if (len == 0) return Qnil;
while (n < 0 || 0 < --n) {
for (i=0; i<len; i++) {
- rb_yield(RARRAY_PTR(ary)[i]);
+ rb_yield(RARRAY_AREF(ary, i));
}
}
return Qnil;
@@ -2316,10 +2675,10 @@ struct chunk_arg {
};
static VALUE
-chunk_ii(VALUE i, VALUE _argp, int argc, VALUE *argv)
+chunk_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, _argp))
{
struct chunk_arg *argp = MEMO_FOR(struct chunk_arg, _argp);
- VALUE v;
+ VALUE v, s;
VALUE alone = ID2SYM(rb_intern("_alone"));
VALUE separator = ID2SYM(rb_intern("_separator"));
@@ -2343,8 +2702,8 @@ chunk_ii(VALUE i, VALUE _argp, int argc, VALUE *argv)
argp->prev_value = argp->prev_elts = Qnil;
}
}
- else if (SYMBOL_P(v) && rb_id2name(SYM2ID(v))[0] == '_') {
- rb_raise(rb_eRuntimeError, "symbol begins with an underscore is reserved");
+ else if (SYMBOL_P(v) && (s = rb_sym2str(v), RSTRING_PTR(s)[0] == '_')) {
+ rb_raise(rb_eRuntimeError, "symbols beginning with an underscore are reserved");
}
else {
if (NIL_P(argp->prev_value)) {
@@ -2366,7 +2725,7 @@ chunk_ii(VALUE i, VALUE _argp, int argc, VALUE *argv)
}
static VALUE
-chunk_i(VALUE yielder, VALUE enumerator, int argc, VALUE *argv)
+chunk_i(RB_BLOCK_CALL_FUNC_ARGLIST(yielder, enumerator))
{
VALUE enumerable;
VALUE arg;
@@ -2433,7 +2792,7 @@ chunk_i(VALUE yielder, VALUE enumerator, int argc, VALUE *argv)
* Any other symbols that begin with an underscore will raise an error:
*
* items.chunk { |item| :_underscore }
- * #=> RuntimeError: symbol begins with an underscore is reserved
+ * #=> RuntimeError: symbols beginning with an underscore are reserved
*
* +nil+ and +:_separator+ can be used to ignore some elements.
*
@@ -2511,7 +2870,7 @@ struct slicebefore_arg {
};
static VALUE
-slicebefore_ii(VALUE i, VALUE _argp, int argc, VALUE *argv)
+slicebefore_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, _argp))
{
struct slicebefore_arg *argp = MEMO_FOR(struct slicebefore_arg, _argp);
VALUE header_p;
@@ -2540,7 +2899,7 @@ slicebefore_ii(VALUE i, VALUE _argp, int argc, VALUE *argv)
}
static VALUE
-slicebefore_i(VALUE yielder, VALUE enumerator, int argc, VALUE *argv)
+slicebefore_i(RB_BLOCK_CALL_FUNC_ARGLIST(yielder, enumerator))
{
VALUE enumerable;
VALUE arg;
@@ -2723,6 +3082,130 @@ 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 pattan 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;
+}
+
/*
* The <code>Enumerable</code> mixin provides collection classes with
* several traversal and searching methods, and with the ability to
@@ -2744,6 +3227,7 @@ Init_Enumerable(void)
rb_define_method(rb_mEnumerable, "to_a", enum_to_a, -1);
rb_define_method(rb_mEnumerable, "entries", enum_to_a, -1);
+ rb_define_method(rb_mEnumerable, "to_h", enum_to_h, -1);
rb_define_method(rb_mEnumerable, "sort", enum_sort, 0);
rb_define_method(rb_mEnumerable, "sort_by", enum_sort_by, 0);
@@ -2768,11 +3252,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, 0);
- rb_define_method(rb_mEnumerable, "max", enum_max, 0);
+ rb_define_method(rb_mEnumerable, "min", enum_min, -1);
+ rb_define_method(rb_mEnumerable, "max", enum_max, -1);
rb_define_method(rb_mEnumerable, "minmax", enum_minmax, 0);
- 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, "min_by", enum_min_by, -1);
+ rb_define_method(rb_mEnumerable, "max_by", enum_max_by, -1);
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);
@@ -2790,6 +3274,7 @@ Init_Enumerable(void)
rb_define_method(rb_mEnumerable, "cycle", enum_cycle, -1);
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);
id_next = rb_intern("next");
id_call = rb_intern("call");
diff --git a/enumerator.c b/enumerator.c
index a273359115..eaa3d73464 100644
--- a/enumerator.c
+++ b/enumerator.c
@@ -120,7 +120,7 @@ struct enumerator {
VALUE feedvalue;
VALUE stop_exc;
VALUE size;
- VALUE (*size_fn)(ANYARGS);
+ rb_enumerator_size_func *size_fn;
};
static VALUE rb_cGenerator, rb_cYielder;
@@ -168,6 +168,7 @@ static const rb_data_type_t enumerator_data_type = {
enumerator_free,
enumerator_memsize,
},
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
static struct enumerator *
@@ -266,10 +267,11 @@ enumerator_allocate(VALUE klass)
}
static VALUE
-enumerator_init(VALUE enum_obj, VALUE obj, VALUE meth, int argc, VALUE *argv, VALUE (*size_fn)(ANYARGS), VALUE size)
+enumerator_init(VALUE enum_obj, VALUE obj, VALUE meth, int argc, const VALUE *argv, rb_enumerator_size_func *size_fn, VALUE size)
{
struct enumerator *ptr;
+ rb_check_frozen(enum_obj);
TypedData_Get_Struct(enum_obj, struct enumerator, &enumerator_data_type, ptr);
if (!ptr) {
@@ -338,10 +340,11 @@ enumerator_initialize(int argc, VALUE *argv, VALUE obj)
rb_check_arity(argc, 0, 1);
recv = generator_init(generator_allocate(rb_cGenerator), rb_block_proc());
if (argc) {
- if (NIL_P(argv[0]) || rb_obj_is_proc(argv[0]) ||
+ if (NIL_P(argv[0]) || rb_respond_to(argv[0], id_call) ||
(RB_TYPE_P(argv[0], T_FLOAT) && RFLOAT_VALUE(argv[0]) == INFINITY)) {
size = argv[0];
- } else {
+ }
+ else {
size = rb_to_int(argv[0]);
}
argc = 0;
@@ -395,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, VALUE *argv)
+rb_enumeratorize(VALUE obj, VALUE meth, int argc, const VALUE *argv)
{
return rb_enumeratorize_with_size(obj, meth, argc, argv, 0);
}
static VALUE
-lazy_to_enum_i(VALUE self, VALUE meth, int argc, VALUE *argv, VALUE (*size_fn)(ANYARGS));
+lazy_to_enum_i(VALUE self, VALUE meth, int argc, const VALUE *argv, rb_enumerator_size_func *size_fn);
VALUE
-rb_enumeratorize_with_size(VALUE obj, VALUE meth, int argc, VALUE *argv, VALUE (*size_fn)(ANYARGS))
+rb_enumeratorize_with_size(VALUE obj, VALUE meth, int argc, const 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 */
@@ -412,30 +415,58 @@ rb_enumeratorize_with_size(VALUE obj, VALUE meth, int argc, VALUE *argv, VALUE (
return lazy_to_enum_i(obj, meth, argc, argv, size_fn);
else
return enumerator_init(enumerator_allocate(rb_cEnumerator),
- obj, meth, argc, argv, size_fn, Qnil);
+ obj, meth, argc, argv, size_fn, Qnil);
}
static VALUE
enumerator_block_call(VALUE obj, rb_block_call_func *func, VALUE arg)
{
int argc = 0;
- VALUE *argv = 0;
+ const VALUE *argv = 0;
const struct enumerator *e = enumerator_ptr(obj);
ID meth = e->meth;
if (e->args) {
argc = RARRAY_LENINT(e->args);
- argv = RARRAY_PTR(e->args);
+ argv = RARRAY_CONST_PTR(e->args);
}
return rb_block_call(e->obj, meth, argc, argv, func, arg);
}
/*
* call-seq:
- * enum.each {...}
+ * enum.each { |elm| block } -> obj
+ * enum.each -> enum
+ * enum.each(*appending_args) { |elm| block } -> obj
+ * enum.each(*appending_args) -> an_enumerator
+ *
+ * Iterates over the block according to how this Enumerator was constructed.
+ * If no block and no arguments are given, returns self.
+ *
+ * === Examples
+ *
+ * "Hello, world!".scan(/\w+/) #=> ["Hello", "world"]
+ * "Hello, world!".to_enum(:scan, /\w+/).to_a #=> ["Hello", "world"]
+ * "Hello, world!".to_enum(:scan).each(/\w+/).to_a #=> ["Hello", "world"]
+ *
+ * obj = Object.new
*
- * Iterates over the block according to how this Enumerable was constructed.
- * If no block is given, returns self.
+ * def obj.each_arg(a, b=:b, *rest)
+ * yield a
+ * yield b
+ * yield rest
+ * :method_returned
+ * end
+ *
+ * enum = obj.to_enum :each_arg, :a, :x
+ *
+ * enum.each.to_a #=> [:a, :x, []]
+ * enum.each.equal?(enum) #=> true
+ * enum.each { |elm| elm } #=> :method_returned
+ *
+ * enum.each(:y, :z).to_a #=> [:a, :x, [:y, :z]]
+ * enum.each(:y, :z).equal?(enum) #=> false
+ * enum.each(:y, :z) { |elm| elm } #=> :method_returned
*
*/
static VALUE
@@ -445,6 +476,10 @@ enumerator_each(int argc, VALUE *argv, VALUE obj)
struct enumerator *e = enumerator_ptr(obj = rb_obj_dup(obj));
VALUE args = e->args;
if (args) {
+#if SIZEOF_INT < SIZEOF_LONG
+ /* check int range overflow */
+ rb_long2int(RARRAY_LEN(args) + argc);
+#endif
args = rb_ary_dup(args);
rb_ary_cat(args, argv, argc);
}
@@ -458,13 +493,11 @@ enumerator_each(int argc, VALUE *argv, VALUE obj)
}
static VALUE
-enumerator_with_index_i(VALUE val, VALUE m, int argc, VALUE *argv)
+enumerator_with_index_i(RB_BLOCK_CALL_FUNC_ARGLIST(val, m))
{
- VALUE idx;
- VALUE *memo = (VALUE *)m;
-
- idx = INT2FIX(*memo);
- ++*memo;
+ NODE *memo = (NODE *)m;
+ VALUE idx = memo->u1.value;
+ memo->u1.value = rb_int_succ(idx);
if (argc <= 1)
return rb_yield_values(2, val, idx);
@@ -475,6 +508,12 @@ enumerator_with_index_i(VALUE val, VALUE m, int argc, VALUE *argv)
static VALUE
enumerator_size(VALUE obj);
+static VALUE
+enumerator_enum_size(VALUE obj, VALUE args, VALUE eobj)
+{
+ return enumerator_size(obj);
+}
+
/*
* call-seq:
* e.with_index(offset = 0) {|(*args), idx| ... }
@@ -493,9 +532,12 @@ enumerator_with_index(int argc, VALUE *argv, VALUE obj)
VALUE memo;
rb_scan_args(argc, argv, "01", &memo);
- RETURN_SIZED_ENUMERATOR(obj, argc, argv, enumerator_size);
- memo = NIL_P(memo) ? 0 : (VALUE)NUM2LONG(memo);
- return enumerator_block_call(obj, enumerator_with_index_i, (VALUE)&memo);
+ RETURN_SIZED_ENUMERATOR(obj, argc, argv, enumerator_enum_size);
+ if (NIL_P(memo))
+ memo = INT2FIX(0);
+ else
+ memo = rb_to_int(memo);
+ return enumerator_block_call(obj, enumerator_with_index_i, (VALUE)NEW_MEMO(memo, 0, 0));
}
/*
@@ -515,7 +557,7 @@ enumerator_each_with_index(VALUE obj)
}
static VALUE
-enumerator_with_object_i(VALUE val, VALUE memo, int argc, VALUE *argv)
+enumerator_with_object_i(RB_BLOCK_CALL_FUNC_ARGLIST(val, memo))
{
if (argc <= 1)
return rb_yield_values(2, val, memo);
@@ -525,6 +567,8 @@ enumerator_with_object_i(VALUE val, VALUE memo, int argc, VALUE *argv)
/*
* call-seq:
+ * e.each_with_object(obj) {|(*args), obj| ... }
+ * e.each_with_object(obj)
* e.with_object(obj) {|(*args), obj| ... }
* e.with_object(obj)
*
@@ -553,14 +597,14 @@ enumerator_with_object_i(VALUE val, VALUE memo, int argc, VALUE *argv)
static VALUE
enumerator_with_object(VALUE obj, VALUE memo)
{
- RETURN_SIZED_ENUMERATOR(obj, 1, &memo, enumerator_size);
+ RETURN_SIZED_ENUMERATOR(obj, 1, &memo, enumerator_enum_size);
enumerator_block_call(obj, enumerator_with_object_i, memo);
return memo;
}
static VALUE
-next_ii(VALUE i, VALUE obj, int argc, VALUE *argv)
+next_ii(RB_BLOCK_CALL_FUNC_ARGLIST(i, obj))
{
struct enumerator *e = enumerator_ptr(obj);
VALUE feedvalue = Qnil;
@@ -693,7 +737,7 @@ ary2sv(VALUE args, int dup)
return Qnil;
case 1:
- return RARRAY_PTR(args)[0];
+ return RARRAY_AREF(args, 0);
default:
if (dup)
@@ -794,7 +838,7 @@ enumerator_peek_values_m(VALUE obj)
* p e.peek #=> 2
* p e.next #=> 2
* p e.next #=> 3
- * p e.next #raises StopIteration
+ * p e.peek #raises StopIteration
*
*/
@@ -815,6 +859,24 @@ enumerator_peek(VALUE obj)
*
* This value is cleared after being yielded.
*
+ * # Array#map passes the array's elements to "yield" and collects the
+ * # results of "yield" as an array.
+ * # Following example shows that "next" returns the passed elements and
+ * # values passed to "feed" are collected as an array which can be
+ * # obtained by StopIteration#result.
+ * e = [1,2,3].map
+ * p e.next #=> 1
+ * e.feed "a"
+ * p e.next #=> 2
+ * e.feed "b"
+ * p e.next #=> 3
+ * e.feed "c"
+ * begin
+ * e.next
+ * rescue StopIteration
+ * p $!.result #=> ["a", "b", "c"]
+ * end
+ *
* o = Object.new
* def o.each
* x = yield # (2) blocks
@@ -870,24 +932,24 @@ enumerator_rewind(VALUE obj)
return obj;
}
+static VALUE append_method(VALUE obj, VALUE str, ID default_method, VALUE default_args);
+
static VALUE
inspect_enumerator(VALUE obj, VALUE dummy, int recur)
{
struct enumerator *e;
- const char *cname;
- VALUE eobj, eargs, str, method;
- int tainted, untrusted;
+ VALUE eobj, str, cname;
TypedData_Get_Struct(obj, struct enumerator, &enumerator_data_type, e);
- cname = rb_obj_classname(obj);
+ cname = rb_obj_class(obj);
if (!e || e->obj == Qundef) {
- return rb_sprintf("#<%s: uninitialized>", cname);
+ return rb_sprintf("#<%"PRIsVALUE": uninitialized>", rb_class_path(cname));
}
if (recur) {
- str = rb_sprintf("#<%s: ...>", cname);
+ str = rb_sprintf("#<%"PRIsVALUE": ...>", rb_class_path(cname));
OBJ_TAINT(str);
return str;
}
@@ -897,30 +959,40 @@ inspect_enumerator(VALUE obj, VALUE dummy, int recur)
eobj = e->obj;
}
- tainted = OBJ_TAINTED(eobj);
- untrusted = OBJ_UNTRUSTED(eobj);
-
/* (1..100).each_cons(2) => "#<Enumerator: 1..100:each_cons(2)>" */
- str = rb_sprintf("#<%s: ", cname);
- rb_str_concat(str, rb_inspect(eobj));
+ str = rb_sprintf("#<%"PRIsVALUE": %+"PRIsVALUE, rb_class_path(cname), eobj);
+ append_method(obj, str, e->meth, e->args);
+
+ rb_str_buf_cat2(str, ">");
+
+ return str;
+}
+
+static VALUE
+append_method(VALUE obj, VALUE str, ID default_method, VALUE default_args)
+{
+ VALUE method, eargs;
+
method = rb_attr_get(obj, id_method);
- if (NIL_P(method)) {
- rb_str_buf_cat2(str, ":");
- rb_str_buf_cat2(str, rb_id2name(e->meth));
- }
- else if (method != Qfalse) {
- Check_Type(method, T_SYMBOL);
+ if (method != Qfalse) {
+ if (!NIL_P(method)) {
+ Check_Type(method, T_SYMBOL);
+ method = rb_sym2str(method);
+ }
+ else {
+ method = rb_id2str(default_method);
+ }
rb_str_buf_cat2(str, ":");
- rb_str_buf_cat2(str, rb_id2name(SYM2ID(method)));
+ rb_str_buf_append(str, method);
}
eargs = rb_attr_get(obj, id_arguments);
if (NIL_P(eargs)) {
- eargs = e->args;
+ eargs = default_args;
}
if (eargs != Qfalse) {
long argc = RARRAY_LEN(eargs);
- VALUE *argv = RARRAY_PTR(eargs);
+ const VALUE *argv = RARRAY_CONST_PTR(eargs); /* WB: no new reference */
if (argc > 0) {
rb_str_buf_cat2(str, "(");
@@ -928,19 +1000,13 @@ inspect_enumerator(VALUE obj, VALUE dummy, int recur)
while (argc--) {
VALUE arg = *argv++;
- rb_str_concat(str, rb_inspect(arg));
+ rb_str_append(str, rb_inspect(arg));
rb_str_buf_cat2(str, argc > 0 ? ", " : ")");
-
- if (OBJ_TAINTED(arg)) tainted = TRUE;
- if (OBJ_UNTRUSTED(arg)) untrusted = TRUE;
+ OBJ_INFECT(str, arg);
}
}
}
- rb_str_buf_cat2(str, ">");
-
- if (tainted) OBJ_TAINT(str);
- if (untrusted) OBJ_UNTRUST(str);
return str;
}
@@ -972,16 +1038,19 @@ static VALUE
enumerator_size(VALUE obj)
{
struct enumerator *e = enumerator_ptr(obj);
+ int argc = 0;
+ const VALUE *argv = NULL;
+ VALUE size;
if (e->size_fn) {
return (*e->size_fn)(e->obj, e->args, obj);
}
- if (rb_obj_is_proc(e->size)) {
- if (e->args)
- return rb_proc_call(e->size, e->args);
- else
- return rb_proc_call_with_block(e->size, 0, 0, Qnil);
+ if (e->args) {
+ argc = (int)RARRAY_LEN(e->args);
+ argv = RARRAY_CONST_PTR(e->args);
}
+ size = rb_check_funcall(e->size, id_call, argc, argv);
+ if (size != Qundef) return size;
return e->size;
}
@@ -1010,6 +1079,7 @@ static const rb_data_type_t yielder_data_type = {
yielder_free,
yielder_memsize,
},
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
static struct yielder *
@@ -1072,14 +1142,15 @@ 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(VALUE obj, VALUE memo, int argc, VALUE *argv)
+yielder_yield_i(RB_BLOCK_CALL_FUNC_ARGLIST(obj, memo))
{
return rb_yield_values2(argc, argv);
}
@@ -1115,6 +1186,7 @@ static const rb_data_type_t generator_data_type = {
generator_free,
generator_memsize,
},
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
static struct generator *
@@ -1147,6 +1219,7 @@ generator_init(VALUE obj, VALUE proc)
{
struct generator *ptr;
+ rb_check_frozen(obj);
TypedData_Get_Struct(obj, struct generator, &generator_data_type, ptr);
if (!ptr) {
@@ -1230,6 +1303,12 @@ enum_size(VALUE self)
}
static VALUE
+lazyenum_size(VALUE self, VALUE args, VALUE eobj)
+{
+ return enum_size(self);
+}
+
+static VALUE
lazy_size(VALUE self)
{
return enum_size(rb_ivar_get(self, id_receiver));
@@ -1242,7 +1321,7 @@ lazy_receiver_size(VALUE generator, VALUE args, VALUE lazy)
}
static VALUE
-lazy_init_iterator(VALUE val, VALUE m, int argc, VALUE *argv)
+lazy_init_iterator(RB_BLOCK_CALL_FUNC_ARGLIST(val, m))
{
VALUE result;
if (argc == 1) {
@@ -1260,7 +1339,7 @@ lazy_init_iterator(VALUE val, VALUE m, int argc, VALUE *argv)
if (argc > 0) {
rb_ary_cat(args, argv, argc);
}
- result = rb_yield_values2(len, RARRAY_PTR(args));
+ result = rb_yield_values2(len, RARRAY_CONST_PTR(args));
RB_GC_GUARD(args);
}
if (result == Qundef) rb_iter_break();
@@ -1268,7 +1347,7 @@ lazy_init_iterator(VALUE val, VALUE m, int argc, VALUE *argv)
}
static VALUE
-lazy_init_block_i(VALUE val, VALUE m, int argc, VALUE *argv)
+lazy_init_block_i(RB_BLOCK_CALL_FUNC_ARGLIST(val, m))
{
rb_block_call(m, id_each, argc-1, argv+1, lazy_init_iterator, val);
return Qnil;
@@ -1325,7 +1404,7 @@ lazy_initialize(int argc, VALUE *argv, VALUE self)
}
static VALUE
-lazy_set_method(VALUE lazy, VALUE args, VALUE (*size_fn)(ANYARGS))
+lazy_set_method(VALUE lazy, VALUE args, rb_enumerator_size_func *size_fn)
{
ID id = rb_frame_this_func();
struct enumerator *e = enumerator_ptr(lazy);
@@ -1375,17 +1454,17 @@ lazy_set_method(VALUE lazy, VALUE args, VALUE (*size_fn)(ANYARGS))
static VALUE
enumerable_lazy(VALUE obj)
{
- VALUE result = lazy_to_enum_i(obj, sym_each, 0, 0, enum_size);
+ VALUE result = lazy_to_enum_i(obj, sym_each, 0, 0, lazyenum_size);
/* Qfalse indicates that the Enumerator::Lazy has no method name */
rb_ivar_set(result, id_method, Qfalse);
return result;
}
static VALUE
-lazy_to_enum_i(VALUE obj, VALUE meth, int argc, VALUE *argv, VALUE (*size_fn)(ANYARGS))
+lazy_to_enum_i(VALUE obj, VALUE meth, int argc, const VALUE *argv, rb_enumerator_size_func *size_fn)
{
return enumerator_init(enumerator_allocate(rb_cLazy),
- obj, meth, argc, argv, size_fn, Qnil);
+ obj, meth, argc, argv, size_fn, Qnil);
}
/*
@@ -1428,7 +1507,7 @@ lazy_to_enum(int argc, VALUE *argv, VALUE self)
}
static VALUE
-lazy_map_func(VALUE val, VALUE m, int argc, VALUE *argv)
+lazy_map_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, m))
{
VALUE result = rb_yield_values2(argc - 1, &argv[1]);
@@ -1449,7 +1528,7 @@ lazy_map(VALUE obj)
}
static VALUE
-lazy_flat_map_i(VALUE i, VALUE yielder, int argc, VALUE *argv)
+lazy_flat_map_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, yielder))
{
return rb_funcall2(yielder, id_yield, argc, argv);
}
@@ -1471,20 +1550,20 @@ lazy_flat_map_to_ary(VALUE obj, VALUE yielder)
else {
long i;
for (i = 0; i < RARRAY_LEN(ary); i++) {
- rb_funcall(yielder, id_yield, 1, RARRAY_PTR(ary)[i]);
+ rb_funcall(yielder, id_yield, 1, RARRAY_AREF(ary, i));
}
}
return Qnil;
}
static VALUE
-lazy_flat_map_func(VALUE val, VALUE m, int argc, VALUE *argv)
+lazy_flat_map_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, m))
{
VALUE result = rb_yield_values2(argc - 1, &argv[1]);
if (RB_TYPE_P(result, T_ARRAY)) {
long i;
for (i = 0; i < RARRAY_LEN(result); i++) {
- rb_funcall(argv[0], id_yield, 1, RARRAY_PTR(result)[i]);
+ rb_funcall(argv[0], id_yield, 1, RARRAY_AREF(result, i));
}
}
else {
@@ -1500,6 +1579,7 @@ lazy_flat_map_func(VALUE val, VALUE m, int argc, VALUE *argv)
/*
* call-seq:
+ * lazy.collect_concat { |obj| block } -> a_lazy_enumerator
* lazy.flat_map { |obj| block } -> a_lazy_enumerator
*
* Returns a new lazy enumerator with the concatenated results of running
@@ -1533,7 +1613,7 @@ lazy_flat_map(VALUE obj)
}
static VALUE
-lazy_select_func(VALUE val, VALUE m, int argc, VALUE *argv)
+lazy_select_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, m))
{
VALUE element = rb_enum_values_pack(argc - 1, argv + 1);
@@ -1556,7 +1636,7 @@ lazy_select(VALUE obj)
}
static VALUE
-lazy_reject_func(VALUE val, VALUE m, int argc, VALUE *argv)
+lazy_reject_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, m))
{
VALUE element = rb_enum_values_pack(argc - 1, argv + 1);
@@ -1579,7 +1659,7 @@ lazy_reject(VALUE obj)
}
static VALUE
-lazy_grep_func(VALUE val, VALUE m, int argc, VALUE *argv)
+lazy_grep_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);
@@ -1591,7 +1671,7 @@ lazy_grep_func(VALUE val, VALUE m, int argc, VALUE *argv)
}
static VALUE
-lazy_grep_iter(VALUE val, VALUE m, int argc, VALUE *argv)
+lazy_grep_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);
@@ -1625,7 +1705,7 @@ next_stopped(VALUE obj)
}
static VALUE
-lazy_zip_arrays_func(VALUE val, VALUE arrays, int argc, VALUE *argv)
+lazy_zip_arrays_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, arrays))
{
VALUE yielder, ary, memo;
long i, count;
@@ -1637,7 +1717,7 @@ lazy_zip_arrays_func(VALUE val, VALUE arrays, int argc, VALUE *argv)
ary = rb_ary_new2(RARRAY_LEN(arrays) + 1);
rb_ary_push(ary, argv[1]);
for (i = 0; i < RARRAY_LEN(arrays); i++) {
- rb_ary_push(ary, rb_ary_entry(RARRAY_PTR(arrays)[i], count));
+ rb_ary_push(ary, rb_ary_entry(RARRAY_AREF(arrays, i), count));
}
rb_funcall(yielder, id_yield, 1, ary);
rb_ivar_set(yielder, id_memo, LONG2NUM(++count));
@@ -1645,7 +1725,7 @@ lazy_zip_arrays_func(VALUE val, VALUE arrays, int argc, VALUE *argv)
}
static VALUE
-lazy_zip_func(VALUE val, VALUE zip_args, int argc, VALUE *argv)
+lazy_zip_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, zip_args))
{
VALUE yielder, ary, arg, v;
long i;
@@ -1655,7 +1735,7 @@ lazy_zip_func(VALUE val, VALUE zip_args, int argc, VALUE *argv)
if (NIL_P(arg)) {
arg = rb_ary_new2(RARRAY_LEN(zip_args));
for (i = 0; i < RARRAY_LEN(zip_args); i++) {
- rb_ary_push(arg, rb_funcall(RARRAY_PTR(zip_args)[i], id_to_enum, 0));
+ rb_ary_push(arg, rb_funcall(RARRAY_AREF(zip_args, i), id_to_enum, 0));
}
rb_ivar_set(yielder, id_memo, arg);
}
@@ -1664,11 +1744,11 @@ lazy_zip_func(VALUE val, VALUE zip_args, int argc, VALUE *argv)
v = Qnil;
if (--argc > 0) {
++argv;
- v = argc > 1 ? rb_ary_new4(argc, argv) : *argv;
+ v = argc > 1 ? rb_ary_new_from_values(argc, argv) : *argv;
}
rb_ary_push(ary, v);
for (i = 0; i < RARRAY_LEN(arg); i++) {
- v = rb_rescue2(call_next, RARRAY_PTR(arg)[i], next_stopped, 0,
+ v = rb_rescue2(call_next, RARRAY_AREF(arg, i), next_stopped, 0,
rb_eStopIteration, (VALUE)0);
rb_ary_push(ary, v);
}
@@ -1710,7 +1790,7 @@ lazy_zip(int argc, VALUE *argv, VALUE obj)
}
static VALUE
-lazy_take_func(VALUE val, VALUE args, int argc, VALUE *argv)
+lazy_take_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, args))
{
long remain;
VALUE memo = rb_attr_get(argv[0], id_memo);
@@ -1732,7 +1812,7 @@ static VALUE
lazy_take_size(VALUE generator, VALUE args, VALUE lazy)
{
VALUE receiver = lazy_size(lazy);
- long len = NUM2LONG(RARRAY_PTR(rb_ivar_get(lazy, id_arguments))[0]);
+ long len = NUM2LONG(RARRAY_AREF(rb_ivar_get(lazy, id_arguments), 0));
if (NIL_P(receiver) || (FIXNUM_P(receiver) && FIX2LONG(receiver) < len))
return receiver;
return LONG2NUM(len);
@@ -1748,7 +1828,7 @@ lazy_take(VALUE obj, VALUE n)
rb_raise(rb_eArgError, "attempt to take negative size");
}
if (len == 0) {
- VALUE len = INT2NUM(0);
+ VALUE len = INT2FIX(0);
lazy = lazy_to_enum_i(obj, sym_cycle, 1, &len, 0);
}
else {
@@ -1759,7 +1839,7 @@ lazy_take(VALUE obj, VALUE n)
}
static VALUE
-lazy_take_while_func(VALUE val, VALUE args, int argc, VALUE *argv)
+lazy_take_while_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, args))
{
VALUE result = rb_yield_values2(argc - 1, &argv[1]);
if (!RTEST(result)) return Qundef;
@@ -1781,7 +1861,7 @@ lazy_take_while(VALUE obj)
static VALUE
lazy_drop_size(VALUE generator, VALUE args, VALUE lazy)
{
- long len = NUM2LONG(RARRAY_PTR(rb_ivar_get(lazy, id_arguments))[0]);
+ long len = NUM2LONG(RARRAY_AREF(rb_ivar_get(lazy, id_arguments), 0));
VALUE receiver = lazy_size(lazy);
if (NIL_P(receiver))
return receiver;
@@ -1793,7 +1873,7 @@ lazy_drop_size(VALUE generator, VALUE args, VALUE lazy)
}
static VALUE
-lazy_drop_func(VALUE val, VALUE args, int argc, VALUE *argv)
+lazy_drop_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, args))
{
long remain;
VALUE memo = rb_attr_get(argv[0], id_memo);
@@ -1823,7 +1903,7 @@ lazy_drop(VALUE obj, VALUE n)
}
static VALUE
-lazy_drop_while_func(VALUE val, VALUE args, int argc, VALUE *argv)
+lazy_drop_while_func(RB_BLOCK_CALL_FUNC_ARGLIST(val, args))
{
VALUE memo = rb_attr_get(argv[0], id_memo);
if (NIL_P(memo) && !RTEST(rb_yield_values2(argc - 1, &argv[1]))) {
@@ -1959,6 +2039,7 @@ 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_alias(rb_cLazy, "force", "to_a");
@@ -1983,6 +2064,7 @@ 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 5f8b98c1ed..3c2b60ba3b 100644
--- a/error.c
+++ b/error.c
@@ -25,8 +25,6 @@
#include <unistd.h>
#endif
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
-
#ifndef EXIT_SUCCESS
#define EXIT_SUCCESS 0
#endif
@@ -39,14 +37,23 @@
#define WEXITSTATUS(status) (status)
#endif
+VALUE rb_eEAGAIN;
+VALUE rb_eEWOULDBLOCK;
+VALUE rb_eEINPROGRESS;
+
extern const char ruby_description[];
-#define REPORTBUG_MSG \
+static const char REPORTBUG_MSG[] =
"[NOTE]\n" \
"You may have encountered a bug in the Ruby interpreter" \
" or extension libraries.\n" \
"Bug reports are welcome.\n" \
+ ""
+#if defined __APPLE__
+ "Don't forget to include the above Crash Report log file.\n"
+#endif
"For details: http://www.ruby-lang.org/bugreport.html\n\n" \
+ ;
static const char *
rb_strerrno(int err)
@@ -262,34 +269,101 @@ rb_warn_m(int argc, VALUE *argv, VALUE exc)
return Qnil;
}
-static void
-report_bug(const char *file, int line, const char *fmt, va_list args)
+#define MAX_BUG_REPORTERS 0x100
+
+static struct bug_reporters {
+ void (*func)(FILE *out, void *data);
+ void *data;
+} bug_reporters[MAX_BUG_REPORTERS];
+
+static int bug_reporters_size;
+
+int
+rb_bug_reporter_add(void (*func)(FILE *, void *), void *data)
{
- /* SIGSEGV handler might have a very small stack. Thus we need to use it carefully. */
- char buf[256];
+ struct bug_reporters *reporter;
+ if (bug_reporters_size >= MAX_BUG_REPORTERS) {
+ return 0; /* failed to register */
+ }
+ reporter = &bug_reporters[bug_reporters_size++];
+ reporter->func = func;
+ reporter->data = 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)
+{
+ char buf[REPORT_BUG_BUFSIZ];
FILE *out = stderr;
- int len = err_position_0(buf, 256, file, line);
+ int len = err_position_0(buf, sizeof(buf), 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;
+}
- fputs("[BUG] ", out);
- vsnprintf(buf, 256, fmt, args);
- fputs(buf, out);
- snprintf(buf, 256, "\n%s\n\n", ruby_description);
- fputs(buf, out);
+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);
+}
- rb_vm_bugreport();
+#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)
- fprintf(out, REPORTBUG_MSG);
+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);
+ }
}
+ 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;
@@ -298,17 +372,28 @@ rb_bug(const char *fmt, ...)
line = rb_sourceline();
}
- va_start(args, fmt);
- report_bug(file, line, fmt, args);
- va_end(args);
+ report_bug(file, line, fmt, NULL);
-#if defined(_WIN32) && defined(RUBY_MSVCRT_VERSION) && RUBY_MSVCRT_VERSION >= 80
- _set_abort_behavior( 0, _CALL_REPORTFAULT);
-#endif
+ die();
+}
- abort();
+void
+rb_bug_context(const void *ctx, const char *fmt, ...)
+{
+ const char *file = NULL;
+ int line = 0;
+
+ if (GET_THREAD()) {
+ file = rb_sourcefile();
+ line = rb_sourceline();
+ }
+
+ report_bug(file, line, fmt, ctx);
+
+ die();
}
+
void
rb_bug_errno(const char *mesg, int errno_arg)
{
@@ -357,11 +442,7 @@ rb_async_bug_errno(const char *mesg, int errno_arg)
void
rb_compile_bug(const char *file, int line, const char *fmt, ...)
{
- va_list args;
-
- va_start(args, fmt);
- report_bug(file, line, fmt, args);
- va_end(args);
+ report_bug(file, line, fmt, NULL);
abort();
}
@@ -530,7 +611,7 @@ VALUE rb_eSystemCallError;
VALUE rb_mErrno;
static VALUE rb_eNOERROR;
-#undef rb_exc_new2
+#undef rb_exc_new_cstr
VALUE
rb_exc_new(VALUE etype, const char *ptr, long len)
@@ -539,13 +620,13 @@ rb_exc_new(VALUE etype, const char *ptr, long len)
}
VALUE
-rb_exc_new2(VALUE etype, const char *s)
+rb_exc_new_cstr(VALUE etype, const char *s)
{
return rb_exc_new(etype, s, strlen(s));
}
VALUE
-rb_exc_new3(VALUE etype, VALUE str)
+rb_exc_new_str(VALUE etype, VALUE str)
{
StringValue(str);
return rb_funcall(etype, rb_intern("new"), 1, str);
@@ -609,11 +690,9 @@ static VALUE
exc_to_s(VALUE exc)
{
VALUE mesg = rb_attr_get(exc, rb_intern("mesg"));
- VALUE r = Qnil;
if (NIL_P(mesg)) return rb_class_name(CLASS_OF(exc));
- r = rb_String(mesg);
- return r;
+ return rb_String(mesg);
}
/*
@@ -706,6 +785,30 @@ exc_backtrace(VALUE exc)
return obj;
}
+/*
+ * 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)
+{
+ ID bt_locations;
+ VALUE obj;
+
+ CONST_ID(bt_locations, "bt_locations");
+ obj = rb_attr_get(exc, bt_locations);
+ if (!NIL_P(obj)) {
+ obj = rb_backtrace_to_location_ary(obj);
+ }
+ return obj;
+}
+
VALUE
rb_check_backtrace(VALUE bt)
{
@@ -719,7 +822,8 @@ rb_check_backtrace(VALUE bt)
rb_raise(rb_eTypeError, err);
}
for (i=0;i<RARRAY_LEN(bt);i++) {
- if (!RB_TYPE_P(RARRAY_PTR(bt)[i], T_STRING)) {
+ VALUE e = RARRAY_AREF(bt, i);
+ if (!RB_TYPE_P(e, T_STRING)) {
rb_raise(rb_eTypeError, err);
}
}
@@ -749,6 +853,23 @@ 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.
+ */
+
+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)
{
@@ -960,24 +1081,6 @@ name_err_name(VALUE self)
/*
* call-seq:
- * name_error.to_s -> string
- *
- * Produce a nicely-formatted string representing the +NameError+.
- */
-
-static VALUE
-name_err_to_s(VALUE exc)
-{
- VALUE mesg = rb_attr_get(exc, rb_intern("mesg"));
- VALUE str = mesg;
-
- if (NIL_P(mesg)) return rb_class_name(CLASS_OF(exc));
- StringValue(str);
- return str;
-}
-
-/*
- * call-seq:
* NoMethodError.new(msg, name [, args]) -> no_method_error
*
* Construct a NoMethodError exception for a method of the given name
@@ -1020,6 +1123,7 @@ static const rb_data_type_t name_err_mesg_data_type = {
name_err_mesg_free,
name_err_mesg_memsize,
},
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
/* :nodoc: */
@@ -1183,6 +1287,24 @@ set_syserr(int n, const char *name)
if (!st_lookup(syserr_tbl, n, &error)) {
error = rb_define_class_under(rb_mErrno, name, rb_eSystemCallError);
+
+ /* capture nonblock errnos for WaitReadable/WaitWritable subclasses */
+ switch (n) {
+ case EAGAIN:
+ rb_eEAGAIN = error;
+
+#if EAGAIN != EWOULDBLOCK
+ break;
+ case EWOULDBLOCK:
+#endif
+
+ rb_eEWOULDBLOCK = error;
+ break;
+ case EINPROGRESS:
+ rb_eEINPROGRESS = error;
+ break;
+ }
+
rb_define_const(error, "Errno", INT2NUM(n));
st_add_direct(syserr_tbl, n, error);
}
@@ -1224,12 +1346,12 @@ syserr_initialize(int argc, VALUE *argv, VALUE self)
char *strerror();
#endif
const char *err;
- VALUE mesg, error;
+ VALUE mesg, error, func;
VALUE klass = rb_obj_class(self);
if (klass == rb_eSystemCallError) {
st_data_t data = (st_data_t)klass;
- rb_scan_args(argc, argv, "11", &mesg, &error);
+ rb_scan_args(argc, argv, "12", &mesg, &error, &func);
if (argc == 1 && FIXNUM_P(mesg)) {
error = mesg; mesg = Qnil;
}
@@ -1239,11 +1361,11 @@ syserr_initialize(int argc, VALUE *argv, VALUE self)
if (!RB_TYPE_P(self, T_OBJECT)) { /* insurance to avoid type crash */
rb_raise(rb_eTypeError, "invalid instance type");
}
- RBASIC(self)->klass = klass;
+ RBASIC_SET_CLASS(self, klass);
}
}
else {
- rb_scan_args(argc, argv, "01", &mesg);
+ rb_scan_args(argc, argv, "02", &mesg, &func);
error = rb_const_get(klass, rb_intern("Errno"));
}
if (!NIL_P(error)) err = strerror(NUM2INT(error));
@@ -1253,7 +1375,10 @@ syserr_initialize(int argc, VALUE *argv, VALUE self)
VALUE str = StringValue(mesg);
rb_encoding *me = rb_enc_get(mesg);
- mesg = rb_sprintf("%s - %"PRIsVALUE, err, 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. */
@@ -1564,14 +1689,14 @@ syserr_eqq(VALUE self, VALUE exc)
*
* foo = "bar"
* proc = Proc.new do
- * $SAFE = 4
- * foo.gsub! "a", "*"
+ * $SAFE = 3
+ * foo.untaint
* end
* proc.call
*
* <em>raises the exception:</em>
*
- * SecurityError: Insecure: can't modify string
+ * SecurityError: Insecure: Insecure operation `untaint' at level 3
*/
/*
@@ -1706,7 +1831,9 @@ 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);
rb_eSystemExit = rb_define_class("SystemExit", rb_eException);
rb_define_method(rb_eSystemExit, "initialize", exit_initialize, -1);
@@ -1728,14 +1855,14 @@ Init_Exception(void)
rb_eSyntaxError = rb_define_class("SyntaxError", rb_eScriptError);
rb_eLoadError = rb_define_class("LoadError", rb_eScriptError);
- rb_attr(rb_eLoadError, rb_intern("path"), 1, 0, Qfalse);
+ /* the path failed to load */
+ rb_attr(rb_eLoadError, rb_intern_const("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, "to_s", name_err_to_s, 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);
@@ -1907,6 +2034,34 @@ rb_sys_fail_str(VALUE mesg)
rb_exc_raise(make_errno_exc_str(mesg));
}
+#ifdef RUBY_FUNCTION_NAME_STRING
+void
+rb_sys_fail_path_in(const char *func_name, VALUE path)
+{
+ int n = errno;
+
+ errno = 0;
+ rb_syserr_fail_path_in(func_name, n, path);
+}
+
+void
+rb_syserr_fail_path_in(const char *func_name, int n, VALUE path)
+{
+ VALUE args[2];
+
+ if (!path) path = Qnil;
+ if (n == 0) {
+ const char *s = !NIL_P(path) ? RSTRING_PTR(path) : "";
+ if (!func_name) func_name = "(null)";
+ rb_bug("rb_sys_fail_path_in(%s, %s) - errno == 0",
+ func_name, s);
+ }
+ args[0] = path;
+ args[1] = rb_str_new_cstr(func_name);
+ rb_exc_raise(rb_class_new_instance(2, args, get_syserr(n)));
+}
+#endif
+
void
rb_mod_sys_fail(VALUE mod, const char *mesg)
{
@@ -1984,17 +2139,12 @@ rb_check_frozen(VALUE obj)
void
rb_error_untrusted(VALUE obj)
{
- if (rb_safe_level() >= 4) {
- rb_raise(rb_eSecurityError, "Insecure: can't modify %s",
- rb_obj_classname(obj));
- }
}
#undef rb_check_trusted
void
rb_check_trusted(VALUE obj)
{
- rb_check_trusted_internal(obj);
}
void
@@ -2002,9 +2152,8 @@ rb_check_copyable(VALUE obj, VALUE orig)
{
if (!FL_ABLE(obj)) return;
rb_check_frozen_internal(obj);
- rb_check_trusted_internal(obj);
if (!FL_ABLE(orig)) return;
- if ((~RBASIC(obj)->flags & RBASIC(orig)->flags) & (FL_UNTRUSTED|FL_TAINT)) {
+ if ((~RBASIC(obj)->flags & RBASIC(orig)->flags) & FL_TAINT) {
if (rb_safe_level() > 0) {
rb_raise(rb_eSecurityError, "Insecure: can't modify %"PRIsVALUE,
RBASIC(obj)->klass);
diff --git a/eval.c b/eval.c
index 958daa8752..1dabe2e24b 100644
--- a/eval.c
+++ b/eval.c
@@ -20,11 +20,7 @@
#include "vm_core.h"
#include "probes_helper.h"
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
-
-NORETURN(void rb_raise_jump(VALUE));
-
-NODE *rb_vm_get_cref(const rb_iseq_t *, const VALUE *);
+NORETURN(void rb_raise_jump(VALUE, VALUE));
VALUE rb_eLocalJumpError;
VALUE rb_eSysStackError;
@@ -34,9 +30,13 @@ VALUE rb_eSysStackError;
#include "eval_error.c"
#include "eval_jump.c"
+#define CLASS_OR_MODULE_P(obj) \
+ (!SPECIAL_CONST_P(obj) && \
+ (BUILTIN_TYPE(obj) == T_CLASS || BUILTIN_TYPE(obj) == T_MODULE))
+
/* Initializes the Ruby VM and builtin libraries.
* @retval 0 if succeeded.
- * @retval non-zero an error occured.
+ * @retval non-zero an error occurred.
*/
int
ruby_setup(void)
@@ -51,6 +51,8 @@ ruby_setup(void)
ruby_init_stack((void *)&state);
Init_BareVM();
Init_heap();
+ Init_vm_objects();
+ Init_frozen_strings();
PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {
@@ -65,7 +67,7 @@ ruby_setup(void)
/* Calls ruby_setup() and check error.
*
- * Prints errors and calls exit(3) if an error occured.
+ * Prints errors and calls exit(3) if an error occurred.
*/
void
ruby_init(void)
@@ -80,7 +82,7 @@ ruby_init(void)
/*! Processes command line arguments and compiles the Ruby source to execute.
*
* This function does:
- * \li Processses 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
*
@@ -147,7 +149,7 @@ ruby_finalize(void)
* resources used by the VM.
*
* @param ex Default value to the return value.
- * @return If an error occured returns a non-zero. If otherwise, returns the
+ * @return If an error occurred returns a non-zero. If otherwise, returns the
* given ex.
* @note This function does not raise any exception.
*/
@@ -190,12 +192,6 @@ ruby_cleanup(volatile int ex)
}
th->errinfo = errs[1];
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) {
@@ -230,6 +226,13 @@ ruby_cleanup(volatile int ex)
ex = EXIT_FAILURE;
}
}
+
+ 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);
ruby_vm_destruct(GET_VM());
if (state) ruby_default_signal(state);
@@ -293,7 +296,7 @@ ruby_executable_node(void *n, int *status)
}
/*! Runs the given compiled source and exits this process.
- * @retval 0 if successfully run thhe source
+ * @retval 0 if successfully run the source
* @retval non-zero if an error occurred.
*/
int
@@ -377,8 +380,8 @@ rb_mod_s_constants(int argc, VALUE *argv, VALUE mod)
VALUE cbase = 0;
void *data = 0;
- if (argc > 0) {
- return rb_mod_constants(argc, argv, rb_cModule);
+ if (argc > 0 || mod != rb_cModule) {
+ return rb_mod_constants(argc, argv, mod);
}
while (cref) {
@@ -402,13 +405,30 @@ rb_mod_s_constants(int argc, VALUE *argv, VALUE mod)
void
rb_frozen_class_p(VALUE klass)
{
- const char *desc = "something(?!)";
-
+ if (SPECIAL_CONST_P(klass)) {
+ noclass:
+ Check_Type(klass, T_CLASS);
+ }
if (OBJ_FROZEN(klass)) {
- if (FL_TEST(klass, FL_SINGLETON))
+ const char *desc;
+
+ 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 (TYPE(klass)) {
+ switch (BUILTIN_TYPE(klass)) {
case T_MODULE:
case T_ICLASS:
desc = "module";
@@ -416,49 +436,97 @@ rb_frozen_class_p(VALUE klass)
case T_CLASS:
desc = "class";
break;
+ default:
+ goto noclass;
}
}
rb_error_frozen(desc);
}
}
-NORETURN(static void rb_longjmp(int, volatile VALUE));
+NORETURN(static void rb_longjmp(int, volatile VALUE, 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;
+ CONST_ID(id_true_cause, "true_cause");
+
+ cause = rb_attr_get(rb_eFatal, id_true_cause);
+ if (NIL_P(cause)) {
+ cause = rb_exc_new_cstr(rb_eFatal, "because using such Ruby");
+ rb_ivar_set(cause, id_cause, INT2FIX(42)); /* the answer */
+ OBJ_FREEZE(cause);
+ rb_ivar_set(rb_eFatal, id_true_cause, cause);
+ }
+ }
+#endif
+ if (!NIL_P(cause) && cause != 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 void
-setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg)
+setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg, VALUE cause)
{
- VALUE at;
VALUE e;
- const char *file;
+ const char *file = 0;
volatile int line = 0;
+ int nocause = 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;
+ }
+ if (cause == Qundef) {
+ cause = nocause ? Qnil : get_thread_errinfo(th);
}
+ exc_setup_cause(mesg, cause);
file = rb_sourcefile();
if (file) line = rb_sourceline();
if (file && !NIL_P(mesg)) {
- 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 {
- at = get_backtrace(mesg);
- if (NIL_P(at)) {
+ VALUE at;
+ if (sysstack_error_p(mesg)) {
+ if (NIL_P(rb_attr_get(mesg, idBt))) {
at = rb_vm_backtrace_object();
- if (OBJ_FROZEN(mesg)) {
- mesg = rb_obj_dup(mesg);
+ if (mesg == sysstack_error) {
+ VALUE ruby_vm_sysstack_error_copy(void);
+ mesg = ruby_vm_sysstack_error_copy();
}
- set_backtrace(mesg, at);
+ rb_ivar_set(mesg, idBt, at);
+ rb_ivar_set(mesg, idBt_locations, at);
}
}
+ else if (NIL_P(get_backtrace(mesg))) {
+ 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);
+ }
}
+
if (!NIL_P(mesg)) {
th->errinfo = mesg;
}
@@ -467,23 +535,23 @@ setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg)
!rb_obj_is_kind_of(e, rb_eSystemExit)) {
int status;
+ mesg = e;
PUSH_TAG();
if ((status = EXEC_TAG()) == 0) {
- RB_GC_GUARD(e) = rb_obj_as_string(e);
+ th->errinfo = Qnil;
+ e = rb_obj_as_string(mesg);
+ th->errinfo = mesg;
if (file && line) {
- warn_printf("Exception `%s' at %s:%d - %s\n",
- rb_obj_classname(th->errinfo),
- file, line, RSTRING_PTR(e));
+ warn_printf("Exception `%"PRIsVALUE"' at %s:%d - %"PRIsVALUE"\n",
+ rb_obj_class(mesg), file, line, e);
}
else if (file) {
- warn_printf("Exception `%s' at %s - %s\n",
- rb_obj_classname(th->errinfo),
- file, RSTRING_PTR(e));
+ warn_printf("Exception `%"PRIsVALUE"' at %s - %"PRIsVALUE"\n",
+ rb_obj_class(mesg), file, e);
}
else {
- warn_printf("Exception `%s' - %s\n",
- rb_obj_classname(th->errinfo),
- RSTRING_PTR(e));
+ warn_printf("Exception `%"PRIsVALUE"' - %"PRIsVALUE"\n",
+ rb_obj_class(mesg), e);
}
}
POP_TAG();
@@ -513,15 +581,15 @@ setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg)
}
static void
-rb_longjmp(int tag, volatile VALUE mesg)
+rb_longjmp(int tag, volatile VALUE mesg, VALUE cause)
{
rb_thread_t *th = GET_THREAD();
- setup_exception(th, tag, mesg);
+ setup_exception(th, tag, mesg, cause);
rb_thread_raised_clear(th);
JUMP_TAG(tag);
}
-static VALUE make_exception(int argc, VALUE *argv, int isstr);
+static VALUE make_exception(int argc, const VALUE *argv, int isstr);
void
rb_exc_raise(VALUE mesg)
@@ -529,7 +597,7 @@ rb_exc_raise(VALUE mesg)
if (!NIL_P(mesg)) {
mesg = make_exception(1, &mesg, FALSE);
}
- rb_longjmp(TAG_RAISE, mesg);
+ rb_longjmp(TAG_RAISE, mesg, Qundef);
}
void
@@ -538,7 +606,7 @@ rb_exc_fatal(VALUE mesg)
if (!NIL_P(mesg)) {
mesg = make_exception(1, &mesg, FALSE);
}
- rb_longjmp(TAG_FATAL, mesg);
+ rb_longjmp(TAG_FATAL, mesg, Qnil);
}
void
@@ -547,7 +615,29 @@ rb_interrupt(void)
rb_raise(rb_eInterrupt, "%s", "");
}
-static VALUE get_errinfo(void);
+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:
@@ -577,22 +667,28 @@ 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));
+ rb_raise_jump(rb_make_exception(argc, argv), *cause);
UNREACHABLE;
}
static VALUE
-make_exception(int argc, VALUE *argv, int isstr)
+make_exception(int argc, const VALUE *argv, int isstr)
{
- VALUE mesg;
+ VALUE mesg, exc;
ID exception;
int n;
@@ -601,10 +697,11 @@ make_exception(int argc, VALUE *argv, int isstr)
case 0:
break;
case 1:
- if (NIL_P(argv[0]))
+ exc = argv[0];
+ if (NIL_P(exc))
break;
if (isstr) {
- mesg = rb_check_string_type(argv[0]);
+ mesg = rb_check_string_type(exc);
if (!NIL_P(mesg)) {
mesg = rb_exc_new3(rb_eRuntimeError, mesg);
break;
@@ -615,11 +712,12 @@ make_exception(int argc, VALUE *argv, int isstr)
case 2:
case 3:
+ exc = argv[0];
n = 1;
exception_call:
- if (argv[0] == sysstack_error) return argv[0];
+ if (sysstack_error_p(exc)) return exc;
CONST_ID(exception, "exception");
- mesg = rb_check_funcall(argv[0], exception, n, argv+1);
+ mesg = rb_check_funcall(exc, exception, n, argv+1);
if (mesg == Qundef) {
rb_raise(rb_eTypeError, "exception class/object expected");
}
@@ -639,13 +737,13 @@ make_exception(int argc, VALUE *argv, int isstr)
}
VALUE
-rb_make_exception(int argc, VALUE *argv)
+rb_make_exception(int argc, const VALUE *argv)
{
return make_exception(argc, argv, TRUE);
}
void
-rb_raise_jump(VALUE mesg)
+rb_raise_jump(VALUE mesg, VALUE cause)
{
rb_thread_t *th = GET_THREAD();
rb_control_frame_t *cfp = th->cfp;
@@ -654,10 +752,10 @@ rb_raise_jump(VALUE mesg)
ID mid = cfp->me->called_id;
th->cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp);
+ EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, self, mid, klass, Qnil);
- setup_exception(th, TAG_RAISE, mesg);
+ setup_exception(th, TAG_RAISE, mesg, cause);
- EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, self, mid, klass, Qnil);
rb_thread_raised_clear(th);
JUMP_TAG(TAG_RAISE);
}
@@ -704,7 +802,7 @@ rb_rescue2(VALUE (* b_proc) (ANYARGS), VALUE data1,
int state;
rb_thread_t *th = GET_THREAD();
rb_control_frame_t *cfp = th->cfp;
- volatile VALUE result;
+ volatile VALUE result = Qfalse;
volatile VALUE e_info = th->errinfo;
va_list args;
@@ -713,8 +811,17 @@ 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 {
- th->cfp = cfp; /* restore */
+ rb_vm_rewind_cfp(th, cfp);
if (state == TAG_RAISE) {
int handle = FALSE;
@@ -730,25 +837,12 @@ rb_rescue2(VALUE (* b_proc) (ANYARGS), VALUE data1,
va_end(args);
if (handle) {
+ result = Qnil;
+ state = 0;
if (r_proc) {
- 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;
+ result = (*r_proc) (data2, th->errinfo);
}
+ th->errinfo = e_info;
}
}
}
@@ -771,7 +865,7 @@ VALUE
rb_protect(VALUE (* proc) (VALUE), VALUE data, int * state)
{
volatile VALUE result = Qnil;
- int status;
+ volatile int status;
rb_thread_t *th = GET_THREAD();
rb_control_frame_t *cfp = th->cfp;
struct rb_vm_protect_tag protect_tag;
@@ -785,6 +879,9 @@ rb_protect(VALUE (* proc) (VALUE), VALUE data, int * state)
if ((status = TH_EXEC_TAG()) == 0) {
SAVE_ROOT_JMPBUF(th, result = (*proc) (data));
}
+ else {
+ rb_vm_rewind_cfp(th, cfp);
+ }
MEMCPY(&(th)->root_jmpbuf, &org_jmpbuf, rb_jmpbuf_t, 1);
th->protect_tag = protect_tag.prev;
TH_POP_TAG();
@@ -792,10 +889,6 @@ rb_protect(VALUE (* proc) (VALUE), VALUE data, int * state)
if (state) {
*state = status;
}
- if (status != 0) {
- th->cfp = cfp;
- return Qnil;
- }
return result;
}
@@ -807,7 +900,12 @@ rb_ensure(VALUE (*b_proc)(ANYARGS), VALUE data1, VALUE (*e_proc)(ANYARGS), VALUE
volatile VALUE result = Qnil;
volatile VALUE errinfo;
rb_thread_t *const th = GET_THREAD();
-
+ rb_ensure_list_t ensure_list;
+ ensure_list.entry.marker = 0;
+ ensure_list.entry.e_proc = e_proc;
+ ensure_list.entry.data2 = data2;
+ ensure_list.next = th->ensure_list;
+ th->ensure_list = &ensure_list;
PUSH_TAG();
if ((state = EXEC_TAG()) == 0) {
result = (*b_proc) (data1);
@@ -816,7 +914,8 @@ rb_ensure(VALUE (*b_proc)(ANYARGS), VALUE data1, VALUE (*e_proc)(ANYARGS), VALUE
/* TODO: fix me */
/* retval = prot_tag ? prot_tag->retval : Qnil; */ /* save retval */
errinfo = th->errinfo;
- (*e_proc) (data2);
+ th->ensure_list=ensure_list.next;
+ (*ensure_list.entry.e_proc)(ensure_list.entry.data2);
th->errinfo = errinfo;
if (state)
JUMP_TAG(state);
@@ -850,7 +949,7 @@ frame_func_id(rb_control_frame_t *cfp)
if (RUBY_VM_IFUNC_P(iseq)) {
NODE *ifunc = (NODE *)iseq;
if (ifunc->nd_aid) return ifunc->nd_aid;
- return rb_intern("<ifunc>");
+ return idIFUNC;
}
me_local = method_entry_of_iseq(cfp, iseq);
if (me_local) {
@@ -880,7 +979,7 @@ frame_called_id(rb_control_frame_t *cfp)
if (RUBY_VM_IFUNC_P(iseq)) {
NODE *ifunc = (NODE *)iseq;
if (ifunc->nd_aid) return ifunc->nd_aid;
- return rb_intern("<ifunc>");
+ return idIFUNC;
}
me_local = method_entry_of_iseq(cfp, iseq);
if (me_local) {
@@ -904,6 +1003,12 @@ rb_frame_this_func(void)
return frame_func_id(GET_THREAD()->cfp);
}
+ID
+rb_frame_callee(void)
+{
+ return frame_called_id(GET_THREAD()->cfp);
+}
+
static rb_control_frame_t *
previous_frame(rb_thread_t *th)
{
@@ -915,8 +1020,8 @@ previous_frame(rb_thread_t *th)
return prev_cfp;
}
-ID
-rb_frame_callee(void)
+static ID
+prev_frame_callee(void)
{
rb_control_frame_t *prev_cfp = previous_frame(GET_THREAD());
if (!prev_cfp) return 0;
@@ -924,20 +1029,13 @@ rb_frame_callee(void)
}
static ID
-rb_frame_caller(void)
+prev_frame_func(void)
{
rb_control_frame_t *prev_cfp = previous_frame(GET_THREAD());
if (!prev_cfp) return 0;
return frame_func_id(prev_cfp);
}
-void
-rb_frame_pop(void)
-{
- rb_thread_t *th = GET_THREAD();
- th->cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp);
-}
-
/*
* call-seq:
* append_features(mod) -> mod
@@ -953,13 +1051,8 @@ rb_frame_pop(void)
static VALUE
rb_mod_append_features(VALUE module, VALUE include)
{
- switch (TYPE(include)) {
- case T_CLASS:
- case T_MODULE:
- break;
- default:
+ if (!CLASS_OR_MODULE_P(include)) {
Check_Type(include, T_CLASS);
- break;
}
rb_include_module(include, module);
@@ -1006,13 +1099,8 @@ rb_mod_include(int argc, VALUE *argv, VALUE module)
static VALUE
rb_mod_prepend_features(VALUE module, VALUE prepend)
{
- switch (TYPE(prepend)) {
- case T_CLASS:
- case T_MODULE:
- break;
- default:
+ if (!CLASS_OR_MODULE_P(prepend)) {
Check_Type(prepend, T_CLASS);
- break;
}
rb_prepend_module(prepend, module);
@@ -1043,24 +1131,13 @@ rb_mod_prepend(int argc, VALUE *argv, VALUE module)
return module;
}
-static void
-warn_refinements_once()
-{
- static int warned = 0;
-
- if (warned)
- return;
- rb_warn("Refinements are experimental, and the behavior may change in future versions of Ruby!");
- warned = 1;
-}
-
static VALUE
hidden_identity_hash_new()
{
VALUE hash = rb_hash_new();
rb_funcall(hash, rb_intern("compare_by_identity"), 0);
- RBASIC(hash)->klass = 0; /* hide from ObjectSpace */
+ RBASIC_CLEAR_CLASS(hash); /* hide from ObjectSpace */
return hash;
}
@@ -1072,11 +1149,11 @@ rb_using_refinement(NODE *cref, VALUE klass, VALUE module)
Check_Type(klass, T_CLASS);
Check_Type(module, T_MODULE);
if (NIL_P(cref->nd_refinements)) {
- cref->nd_refinements = hidden_identity_hash_new();
+ RB_OBJ_WRITE(cref, &cref->nd_refinements, hidden_identity_hash_new());
}
else {
if (cref->flags & NODE_FL_CREF_OMOD_SHARED) {
- cref->nd_refinements = rb_hash_dup(cref->nd_refinements);
+ RB_OBJ_WRITE(cref, &cref->nd_refinements, rb_hash_dup(cref->nd_refinements));
cref->flags &= ~NODE_FL_CREF_OMOD_SHARED;
}
if (!NIL_P(c = rb_hash_lookup(cref->nd_refinements, klass))) {
@@ -1093,11 +1170,14 @@ rb_using_refinement(NODE *cref, VALUE klass, VALUE module)
FL_SET(module, RMODULE_IS_OVERLAID);
c = iclass = rb_include_class_new(module, superclass);
RCLASS_REFINED_CLASS(c) = klass;
- RCLASS_M_TBL(c) = RCLASS_M_TBL(module);
+
+ RCLASS_M_TBL_WRAPPER(OBJ_WB_UNPROTECT(c)) =
+ RCLASS_M_TBL_WRAPPER(OBJ_WB_UNPROTECT(module));
+
module = RCLASS_SUPER(module);
while (module && module != klass) {
FL_SET(module, RMODULE_IS_OVERLAID);
- c = RCLASS_SUPER(c) = rb_include_class_new(module, RCLASS_SUPER(c));
+ c = RCLASS_SET_SUPER(c, rb_include_class_new(module, RCLASS_SUPER(c)));
RCLASS_REFINED_CLASS(c) = klass;
module = RCLASS_SUPER(module);
}
@@ -1113,20 +1193,46 @@ using_refinement(VALUE klass, VALUE module, VALUE arg)
return ST_CONTINUE;
}
-void
-rb_using_module(NODE *cref, VALUE module)
+static void
+using_module_recursive(NODE *cref, VALUE klass)
{
ID id_refinements;
- VALUE refinements;
+ VALUE super, module, refinements;
- Check_Type(module, T_MODULE);
+ super = RCLASS_SUPER(klass);
+ if (super) {
+ using_module_recursive(cref, super);
+ }
+ switch (BUILTIN_TYPE(klass)) {
+ case T_MODULE:
+ module = klass;
+ break;
+
+ case T_ICLASS:
+ module = RBASIC(klass)->klass;
+ break;
+
+ default:
+ rb_raise(rb_eTypeError, "wrong argument type %s (expected Module)",
+ rb_obj_classname(klass));
+ break;
+ }
CONST_ID(id_refinements, "__refinements__");
refinements = rb_attr_get(module, id_refinements);
if (NIL_P(refinements)) return;
rb_hash_foreach(refinements, using_refinement, (VALUE) cref);
}
-VALUE rb_refinement_module_get_refined_class(VALUE module)
+void
+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
+rb_refinement_module_get_refined_class(VALUE module)
{
ID id_refined_class;
@@ -1156,8 +1262,7 @@ add_activated_refinement(VALUE activated_refinements,
refinement = RCLASS_SUPER(refinement);
while (refinement) {
FL_SET(refinement, RMODULE_IS_OVERLAID);
- c = RCLASS_SUPER(c) =
- rb_include_class_new(refinement, RCLASS_SUPER(c));
+ c = RCLASS_SET_SUPER(c, rb_include_class_new(refinement, RCLASS_SUPER(c)));
RCLASS_REFINED_CLASS(c) = klass;
refinement = RCLASS_SUPER(refinement);
}
@@ -1185,7 +1290,6 @@ rb_mod_refine(VALUE module, VALUE klass)
rb_thread_t *th = GET_THREAD();
rb_block_t *block = rb_vm_control_frame_block_ptr(th->cfp);
- warn_refinements_once();
if (!block) {
rb_raise(rb_eArgError, "no block given");
}
@@ -1210,7 +1314,7 @@ rb_mod_refine(VALUE module, VALUE klass)
refinement = rb_hash_lookup(refinements, klass);
if (NIL_P(refinement)) {
refinement = rb_module_new();
- RCLASS_SUPER(refinement) = klass;
+ RCLASS_SET_SUPER(refinement, klass);
FL_SET(refinement, RMODULE_IS_REFINEMENT);
CONST_ID(id_refined_class, "__refined_class__");
rb_ivar_set(refinement, id_refined_class, klass);
@@ -1223,8 +1327,33 @@ rb_mod_refine(VALUE module, VALUE klass)
return refinement;
}
+/*
+ * call-seq:
+ * using(module) -> self
+ *
+ * Import class refinements from <i>module</i> into the current class or
+ * module definition.
+ */
+
+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()) {
+ rb_raise(rb_eRuntimeError,
+ "Module#using is not permitted in methods");
+ }
+ if (prev_cfp && prev_cfp->self != self) {
+ rb_raise(rb_eRuntimeError, "Module#using is not called on self");
+ }
+ rb_using_module(cref, module);
+ return self;
+}
+
void
-rb_obj_call_init(VALUE obj, int argc, VALUE *argv)
+rb_obj_call_init(VALUE obj, int argc, const VALUE *argv)
{
PASS_PASSED_BLOCK();
rb_funcall2(obj, idInitialize, argc, argv);
@@ -1328,7 +1457,6 @@ top_include(int argc, VALUE *argv, VALUE self)
{
rb_thread_t *th = GET_THREAD();
- rb_secure(4);
if (th->top_wrapper) {
rb_warning("main.include in the wrapped load is effective only in wrapper module");
return rb_mod_include(argc, argv, th->top_wrapper);
@@ -1350,13 +1478,11 @@ top_using(VALUE self, VALUE module)
NODE *cref = rb_vm_cref();
rb_control_frame_t *prev_cfp = previous_frame(GET_THREAD());
- warn_refinements_once();
if (cref->nd_next || (prev_cfp && prev_cfp->me)) {
- rb_raise(rb_eRuntimeError, "using is permitted only at toplevel");
+ rb_raise(rb_eRuntimeError,
+ "main.using is permitted only at toplevel");
}
- Check_Type(module, T_MODULE);
rb_using_module(cref, module);
- rb_clear_cache();
return self;
}
@@ -1472,9 +1598,9 @@ errat_setter(VALUE val, ID id, VALUE *var)
/*
* call-seq:
* __method__ -> symbol
- * __callee__ -> symbol
*
- * Returns the name of the current method as a Symbol.
+ * Returns the name at the definition of the current method as a
+ * Symbol.
* If called outside of a method, it returns <code>nil</code>.
*
*/
@@ -1482,7 +1608,7 @@ errat_setter(VALUE val, ID id, VALUE *var)
static VALUE
rb_f_method_name(void)
{
- ID fname = rb_frame_caller(); /* need *caller* ID */
+ ID fname = prev_frame_func(); /* need *method* ID */
if (fname) {
return ID2SYM(fname);
@@ -1492,10 +1618,19 @@ rb_f_method_name(void)
}
}
+/*
+ * call-seq:
+ * __callee__ -> symbol
+ *
+ * Returns the called name of the current method as a Symbol.
+ * If called outside of a method, it returns <code>nil</code>.
+ *
+ */
+
static VALUE
rb_f_callee_name(void)
{
- ID fname = rb_frame_callee(); /* need *callee* ID */
+ ID fname = prev_frame_callee(); /* need *callee* ID */
if (fname) {
return ID2SYM(fname);
@@ -1541,12 +1676,14 @@ Init_eval(void)
rb_define_global_function("__callee__", rb_f_callee_name, 0);
rb_define_global_function("__dir__", f_current_dirname, 0);
+ rb_define_method(rb_cModule, "include", rb_mod_include, -1);
+ rb_define_method(rb_cModule, "prepend", rb_mod_prepend, -1);
+
rb_define_private_method(rb_cModule, "append_features", rb_mod_append_features, 1);
rb_define_private_method(rb_cModule, "extend_object", rb_mod_extend_object, 1);
- rb_define_private_method(rb_cModule, "include", rb_mod_include, -1);
rb_define_private_method(rb_cModule, "prepend_features", rb_mod_prepend_features, 1);
- rb_define_private_method(rb_cModule, "prepend", rb_mod_prepend, -1);
rb_define_private_method(rb_cModule, "refine", rb_mod_refine, 1);
+ rb_define_private_method(rb_cModule, "using", mod_using, 1);
rb_undef_method(rb_cClass, "refine");
rb_undef_method(rb_cClass, "module_function");
@@ -1567,8 +1704,5 @@ 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 */
- exception_error = rb_exc_new3(rb_eFatal,
- rb_obj_freeze(rb_str_new2("exception reentered")));
- OBJ_TAINT(exception_error);
- OBJ_FREEZE(exception_error);
+ rb_vm_register_special_exception(ruby_error_reenter, rb_eFatal, "exception reentered");
}
diff --git a/eval_error.c b/eval_error.c
index c7ccf82a0a..0c323c21c7 100644
--- a/eval_error.c
+++ b/eval_error.c
@@ -6,17 +6,18 @@
static void
warn_printf(const char *fmt, ...)
{
- char buf[BUFSIZ];
+ VALUE str;
va_list args;
va_init_list(args, fmt);
- vsnprintf(buf, BUFSIZ, fmt, args);
+ str = rb_vsprintf(fmt, args);
va_end(args);
- rb_write_error(buf);
+ rb_write_error_str(str);
}
#define warn_print(x) rb_write_error(x)
#define warn_print2(x,l) rb_write_error2((x),(l))
+#define warn_print_str(x) rb_write_error_str(x)
static void
error_pos(void)
@@ -25,12 +26,13 @@ error_pos(void)
int sourceline = rb_sourceline();
if (sourcefile) {
+ ID caller_name;
if (sourceline == 0) {
warn_printf("%s", sourcefile);
}
- else if (rb_frame_callee()) {
+ else if ((caller_name = rb_frame_callee()) != 0) {
warn_printf("%s:%d:in `%s'", sourcefile, sourceline,
- rb_id2name(rb_frame_callee()));
+ rb_id2name(caller_name));
}
else {
warn_printf("%s:%d", sourcefile, sourceline);
@@ -77,11 +79,11 @@ set_backtrace(VALUE info, VALUE bt)
static void
error_print(void)
{
- volatile VALUE errat = Qnil; /* OK */
+ volatile VALUE errat = Qundef;
rb_thread_t *th = GET_THREAD();
VALUE errinfo = th->errinfo;
int raised_flag = th->raised_flag;
- volatile VALUE eclass, e;
+ volatile VALUE eclass = Qundef, e = Qundef;
const char *volatile einfo;
volatile long elen;
@@ -93,11 +95,15 @@ error_print(void)
if (TH_EXEC_TAG() == 0) {
errat = get_backtrace(errinfo);
}
- else {
+ else if (errat == Qundef) {
errat = Qnil;
}
- if (TH_EXEC_TAG())
+ else if (eclass == Qundef || e != Qundef) {
goto error;
+ }
+ else {
+ goto no_message;
+ }
if (NIL_P(errat)) {
const char *file = rb_sourcefile();
int line = rb_sourceline();
@@ -112,28 +118,27 @@ error_print(void)
error_pos();
}
else {
- VALUE mesg = RARRAY_PTR(errat)[0];
+ VALUE mesg = RARRAY_AREF(errat, 0);
if (NIL_P(mesg))
error_pos();
else {
- warn_print2(RSTRING_PTR(mesg), RSTRING_LEN(mesg));
+ warn_print_str(mesg);
}
}
eclass = CLASS_OF(errinfo);
- if (TH_EXEC_TAG() == 0) {
- e = rb_funcall(errinfo, rb_intern("message"), 0, 0);
- StringValue(e);
+ if (eclass != Qundef &&
+ (e = rb_check_funcall(errinfo, rb_intern("message"), 0, 0)) != Qundef &&
+ (RB_TYPE_P(e, T_STRING) || !NIL_P(e = rb_check_string_type(e)))) {
einfo = RSTRING_PTR(e);
elen = RSTRING_LEN(e);
}
else {
+ no_message:
einfo = "";
elen = 0;
}
- if (TH_EXEC_TAG())
- goto error;
if (eclass == rb_eRuntimeError && elen == 0) {
warn_print(": unhandled exception\n");
}
@@ -143,7 +148,7 @@ error_print(void)
epath = rb_class_name(eclass);
if (elen == 0) {
warn_print(": ");
- warn_print2(RSTRING_PTR(epath), RSTRING_LEN(epath));
+ warn_print_str(epath);
warn_print("\n");
}
else {
@@ -160,20 +165,19 @@ error_print(void)
warn_print2(einfo, len);
if (epath) {
warn_print(" (");
- warn_print2(RSTRING_PTR(epath), RSTRING_LEN(epath));
+ warn_print_str(epath);
warn_print(")\n");
}
if (tail) {
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);
}
}
if (!NIL_P(errat)) {
long i;
long len = RARRAY_LEN(errat);
- VALUE *ptr = RARRAY_PTR(errat);
int skip = eclass == rb_eSysStackError;
#define TRACE_MAX (TRACE_HEAD+TRACE_TAIL+5)
@@ -181,8 +185,9 @@ error_print(void)
#define TRACE_TAIL 5
for (i = 1; i < len; i++) {
- if (RB_TYPE_P(ptr[i], T_STRING)) {
- warn_printf("\tfrom %s\n", RSTRING_PTR(ptr[i]));
+ VALUE line = RARRAY_AREF(errat, i);
+ if (RB_TYPE_P(line, T_STRING)) {
+ warn_printf("\tfrom %"PRIsVALUE"\n", line);
}
if (skip && i == TRACE_HEAD && len > TRACE_MAX) {
warn_printf("\t ... %ld levels...\n",
@@ -193,6 +198,7 @@ error_print(void)
}
error:
TH_POP_TAG();
+ th->errinfo = errinfo;
rb_thread_raised_set(th, raised_flag);
}
@@ -202,8 +208,8 @@ ruby_error_print(void)
error_print();
}
-void
-rb_print_undef(VALUE klass, ID id, int scope)
+static const char *
+method_scope_name(int scope)
{
const char *v;
@@ -213,7 +219,14 @@ rb_print_undef(VALUE klass, ID id, int scope)
case NOEX_PRIVATE: v = " private"; break;
case NOEX_PROTECTED: v = " protected"; break;
}
- rb_name_error(id, "undefined%s method `%"PRIsVALUE"' for %s `%"PRIsVALUE"'", v,
+ return v;
+}
+
+void
+rb_print_undef(VALUE klass, ID id, int scope)
+{
+ const char *v = method_scope_name(scope);
+ 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));
@@ -222,12 +235,23 @@ rb_print_undef(VALUE klass, ID id, int scope)
void
rb_print_undef_str(VALUE klass, VALUE name)
{
- rb_name_error_str(name, "undefined method `%"PRIsVALUE"' for %s `%"PRIsVALUE"'",
+ 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));
}
+void
+rb_print_inaccessible(VALUE klass, ID id, int scope)
+{
+ const char *v = method_scope_name(scope);
+ rb_name_error(id, "method `%"PRIsVALUE"' for %s `% "PRIsVALUE"' is %s",
+ QUOTE_ID(id),
+ (RB_TYPE_P(klass, T_MODULE)) ? "module" : "class",
+ rb_class_name(klass),
+ v);
+}
+
static int
sysexit_status(VALUE err)
{
@@ -278,7 +302,8 @@ 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)) {
+ else if (rb_obj_is_instance_of(errinfo, rb_eSignal) &&
+ rb_iv_get(errinfo, "signo") != INT2FIX(SIGSEGV)) {
/* no message when exiting by signal */
}
else {
diff --git a/eval_intern.h b/eval_intern.h
index 334b8d439a..c457deb8db 100644
--- a/eval_intern.h
+++ b/eval_intern.h
@@ -83,9 +83,37 @@ extern int select_large_fdset(int, fd_set *, fd_set *, fd_set *, struct timeval
#include <sys/stat.h>
+#ifdef _MSC_VER
+#define SAVE_ROOT_JMPBUF_BEFORE_STMT \
+ __try {
+#define SAVE_ROOT_JMPBUF_AFTER_STMT \
+ } \
+ __except (GetExceptionCode() == EXCEPTION_STACK_OVERFLOW ? \
+ (rb_thread_raised_set(GET_THREAD(), RAISED_STACKOVERFLOW), \
+ raise(SIGSEGV), \
+ EXCEPTION_EXECUTE_HANDLER) : \
+ 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
+#endif
+
#define SAVE_ROOT_JMPBUF(th, stmt) do \
if (ruby_setjmp((th)->root_jmpbuf) == 0) { \
+ SAVE_ROOT_JMPBUF_BEFORE_STMT \
stmt; \
+ SAVE_ROOT_JMPBUF_AFTER_STMT \
} \
else { \
rb_fiber_start(); \
@@ -95,27 +123,56 @@ extern int select_large_fdset(int, fd_set *, fd_set *, fd_set *, struct timeval
rb_thread_t * const _th = (th); \
struct rb_vm_tag _tag; \
_tag.tag = 0; \
- _tag.prev = _th->tag; \
- _th->tag = &_tag;
+ _tag.prev = _th->tag;
#define TH_POP_TAG() \
_th->tag = _tag.prev; \
} while (0)
-#define TH_POP_TAG2() \
+#define TH_TMPPOP_TAG() \
_th->tag = _tag.prev
+#define TH_REPUSH_TAG() (void)(_th->tag = &_tag)
+
#define PUSH_TAG() TH_PUSH_TAG(GET_THREAD())
#define POP_TAG() TH_POP_TAG()
-#define TH_EXEC_TAG() ruby_setjmp(_th->tag->buf)
+#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)
+{
+ int state = th->state;
+ th->state = 0;
+ return state;
+}
+
+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);
+}
+
+/*
+ setjmp() in assignment expression rhs is undefined behavior
+ [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))
#define EXEC_TAG() \
TH_EXEC_TAG()
-#define TH_JUMP_TAG(th, st) do { \
- ruby_longjmp((th)->tag->buf,(st)); \
-} while (0)
+#define TH_JUMP_TAG(th, st) rb_threadptr_tag_jump(th, st)
#define JUMP_TAG(st) TH_JUMP_TAG(GET_THREAD(), (st))
@@ -172,8 +229,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, VALUE *argv, VALUE self);
-VALUE rb_make_exception(int argc, VALUE *argv);
+VALUE rb_f_eval(int argc, const VALUE *argv, VALUE self);
+VALUE rb_make_exception(int argc, const VALUE *argv);
NORETURN(void rb_method_name_error(VALUE, VALUE));
@@ -181,9 +238,10 @@ 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, int));
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, VALUE *argv,
+NORETURN(void rb_raise_method_missing(rb_thread_t *th, int argc, const VALUE *argv,
VALUE obj, int call_status));
VALUE rb_vm_make_jump_tag_but_local_jump(int state, VALUE val);
@@ -195,7 +253,11 @@ VALUE rb_vm_top_self();
VALUE rb_vm_cbase(void);
#ifndef CharNext /* defined as CharNext[AW] on Windows. */
-#define CharNext(p) ((p) + mblen((p), RUBY_MBCHAR_MAXSIZE))
+# ifdef HAVE_MBLEN
+# define CharNext(p) ((p) + mblen((p), RUBY_MBCHAR_MAXSIZE))
+# else
+# define CharNext(p) ((p) + 1)
+# endif
#endif
#if defined DOSISH || defined __CYGWIN__
diff --git a/eval_jump.c b/eval_jump.c
index 092ab8766a..5443ed224e 100644
--- a/eval_jump.c
+++ b/eval_jump.c
@@ -93,48 +93,45 @@ rb_mark_end_proc(void)
}
}
+static void
+exec_end_procs_chain(struct end_proc_data *volatile *procs)
+{
+ struct end_proc_data volatile endproc;
+ struct end_proc_data *link;
+
+ while ((link = *procs) != 0) {
+ *procs = link->next;
+ endproc = *link;
+ xfree(link);
+ rb_set_safe_level_force(endproc.safe);
+ (*endproc.func) (endproc.data);
+ }
+}
+
void
rb_exec_end_proc(void)
{
- struct end_proc_data *volatile link;
int status;
volatile int safe = rb_safe_level();
rb_thread_t *th = GET_THREAD();
volatile VALUE errinfo = th->errinfo;
- while (ephemeral_end_procs) {
- link = ephemeral_end_procs;
- ephemeral_end_procs = link->next;
-
- PUSH_TAG();
- if ((status = EXEC_TAG()) == 0) {
- rb_set_safe_level_force(link->safe);
- (*link->func) (link->data);
- }
- POP_TAG();
- if (status) {
- error_handle(status);
- if (!NIL_P(th->errinfo)) errinfo = th->errinfo;
- }
- xfree(link);
+ PUSH_TAG();
+ if ((status = EXEC_TAG()) == 0) {
+ again:
+ exec_end_procs_chain(&ephemeral_end_procs);
+ exec_end_procs_chain(&end_procs);
}
-
- while (end_procs) {
- link = end_procs;
- end_procs = link->next;
-
- PUSH_TAG();
- if ((status = EXEC_TAG()) == 0) {
- rb_set_safe_level_force(link->safe);
- (*link->func) (link->data);
- }
- POP_TAG();
- if (status) {
- error_handle(status);
- if (!NIL_P(th->errinfo)) errinfo = th->errinfo;
- }
- xfree(link);
+ else {
+ VAR_INITIALIZED(th);
+ TH_TMPPOP_TAG();
+ error_handle(status);
+ if (!NIL_P(th->errinfo)) errinfo = th->errinfo;
+ TH_REPUSH_TAG();
+ goto again;
}
+ POP_TAG();
+
rb_set_safe_level_force(safe);
th->errinfo = errinfo;
}
diff --git a/ext/-test-/bignum/big2str.c b/ext/-test-/bignum/big2str.c
new file mode 100644
index 0000000000..ce71fe37e2
--- /dev/null
+++ b/ext/-test-/bignum/big2str.c
@@ -0,0 +1,54 @@
+#include "ruby.h"
+#include "internal.h"
+
+static VALUE
+big(VALUE x)
+{
+ if (FIXNUM_P(x))
+ return rb_int2big(FIX2LONG(x));
+ if (RB_TYPE_P(x, T_BIGNUM))
+ return x;
+ rb_raise(rb_eTypeError, "can't convert %s to Bignum",
+ rb_obj_classname(x));
+}
+
+static VALUE
+big2str_generic(VALUE x, VALUE vbase)
+{
+ int base = NUM2INT(vbase);
+ if (base < 2 || 36 < base)
+ rb_raise(rb_eArgError, "invalid radix %d", base);
+ return rb_big2str_generic(big(x), base);
+}
+
+#define POW2_P(x) (((x)&((x)-1))==0)
+
+static VALUE
+big2str_poweroftwo(VALUE x, VALUE vbase)
+{
+ int base = NUM2INT(vbase);
+ if (base < 2 || 36 < base || !POW2_P(base))
+ rb_raise(rb_eArgError, "invalid radix %d", base);
+ return rb_big2str_poweroftwo(big(x), base);
+}
+
+#if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H)
+static VALUE
+big2str_gmp(VALUE x, VALUE vbase)
+{
+ int base = NUM2INT(vbase);
+ if (base < 2 || 36 < base)
+ rb_raise(rb_eArgError, "invalid radix %d", base);
+ return rb_big2str_gmp(big(x), base);
+}
+#else
+#define big2str_gmp rb_f_notimplement
+#endif
+
+void
+Init_big2str(VALUE klass)
+{
+ rb_define_method(rb_cInteger, "big2str_generic", big2str_generic, 1);
+ rb_define_method(rb_cInteger, "big2str_poweroftwo", big2str_poweroftwo, 1);
+ rb_define_method(rb_cInteger, "big2str_gmp", big2str_gmp, 1);
+}
diff --git a/ext/-test-/bignum/bigzero.c b/ext/-test-/bignum/bigzero.c
new file mode 100644
index 0000000000..a3bf8af459
--- /dev/null
+++ b/ext/-test-/bignum/bigzero.c
@@ -0,0 +1,27 @@
+#include "ruby.h"
+#include "internal.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);
+ return z;
+}
+
+static VALUE
+bug_big_negzero(VALUE self, VALUE length)
+{
+ long len = NUM2ULONG(length);
+ VALUE z = rb_big_new(len, 0);
+ MEMZERO(BIGNUM_DIGITS(z), BDIGIT, len);
+ return z;
+}
+
+void
+Init_bigzero(VALUE klass)
+{
+ rb_define_singleton_method(klass, "zero", bug_big_zero, 1);
+ rb_define_singleton_method(klass, "negzero", bug_big_negzero, 1);
+}
diff --git a/ext/-test-/bignum/depend b/ext/-test-/bignum/depend
new file mode 100644
index 0000000000..c65482236a
--- /dev/null
+++ b/ext/-test-/bignum/depend
@@ -0,0 +1,7 @@
+$(OBJS): $(HDRS) $(ruby_headers)
+
+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
new file mode 100644
index 0000000000..2853ebef1c
--- /dev/null
+++ b/ext/-test-/bignum/div.c
@@ -0,0 +1,36 @@
+#include "ruby.h"
+#include "internal.h"
+
+static VALUE
+big(VALUE x)
+{
+ if (FIXNUM_P(x))
+ return rb_int2big(FIX2LONG(x));
+ if (RB_TYPE_P(x, T_BIGNUM))
+ return x;
+ rb_raise(rb_eTypeError, "can't convert %s to Bignum",
+ rb_obj_classname(x));
+}
+
+static VALUE
+divrem_normal(VALUE x, VALUE y)
+{
+ return rb_big_norm(rb_big_divrem_normal(big(x), big(y)));
+}
+
+#if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H)
+static VALUE
+divrem_gmp(VALUE x, VALUE y)
+{
+ return rb_big_norm(rb_big_divrem_gmp(big(x), big(y)));
+}
+#else
+#define divrem_gmp rb_f_notimplement
+#endif
+
+void
+Init_div(VALUE klass)
+{
+ rb_define_method(rb_cInteger, "big_divrem_normal", divrem_normal, 1);
+ rb_define_method(rb_cInteger, "big_divrem_gmp", divrem_gmp, 1);
+}
diff --git a/ext/-test-/bignum/extconf.rb b/ext/-test-/bignum/extconf.rb
new file mode 100644
index 0000000000..e8c1febc82
--- /dev/null
+++ b/ext/-test-/bignum/extconf.rb
@@ -0,0 +1,7 @@
+$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-/bignum")
diff --git a/ext/-test-/bignum/init.c b/ext/-test-/bignum/init.c
new file mode 100644
index 0000000000..82a159bf1d
--- /dev/null
+++ b/ext/-test-/bignum/init.c
@@ -0,0 +1,11 @@
+#include "ruby.h"
+
+#define init(n) {void Init_##n(VALUE klass); Init_##n(klass);}
+
+void
+Init_bignum(void)
+{
+ VALUE mBug = rb_define_module("Bug");
+ VALUE klass = rb_define_class_under(mBug, "Bignum", rb_cString);
+ TEST_INIT_FUNCS(init);
+}
diff --git a/ext/-test-/bignum/intpack.c b/ext/-test-/bignum/intpack.c
new file mode 100644
index 0000000000..b7435b2025
--- /dev/null
+++ b/ext/-test-/bignum/intpack.c
@@ -0,0 +1,88 @@
+#include "ruby.h"
+#include "internal.h"
+
+static VALUE
+rb_integer_pack_raw_m(VALUE val, VALUE buf, VALUE numwords_arg, VALUE wordsize_arg, VALUE nails, VALUE flags)
+{
+ int sign;
+ size_t numwords = 0;
+ size_t wordsize = NUM2SIZET(wordsize_arg);
+
+ StringValue(buf);
+ rb_str_modify(buf);
+ sign = rb_integer_pack(val,
+ RSTRING_PTR(buf), NUM2SIZET(numwords_arg),
+ NUM2SIZET(wordsize_arg), NUM2SIZET(nails), NUM2INT(flags));
+
+ return rb_ary_new_from_args(2, INT2NUM(sign), rb_str_new(RSTRING_PTR(buf), wordsize * numwords));
+}
+
+static VALUE
+rb_integer_pack_m(VALUE val, VALUE numwords_arg, VALUE wordsize_arg, VALUE nails, VALUE flags)
+{
+ int sign;
+ size_t numwords = NUM2SIZET(numwords_arg);
+ size_t wordsize = NUM2SIZET(wordsize_arg);
+ VALUE buf;
+
+ if (numwords != 0 && wordsize != 0 && LONG_MAX / wordsize < numwords)
+ rb_raise(rb_eArgError, "too big numwords * wordsize");
+ buf = rb_str_new(NULL, numwords * wordsize);
+ sign = rb_integer_pack(val,
+ RSTRING_PTR(buf), numwords,
+ wordsize, NUM2SIZET(nails), NUM2INT(flags));
+
+ return rb_assoc_new(INT2NUM(sign), buf);
+}
+
+static VALUE
+rb_integer_unpack_m(VALUE klass, VALUE buf, VALUE numwords, VALUE wordsize, VALUE nails, VALUE flags)
+{
+ StringValue(buf);
+
+ return rb_integer_unpack(RSTRING_PTR(buf),
+ NUM2SIZET(numwords), NUM2SIZET(wordsize),
+ NUM2SIZET(nails), NUM2INT(flags));
+}
+
+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);
+ size = rb_absint_numwords(val, 1, NULL) - (neg && rb_absint_singlebit_p(val));
+ return SIZET2NUM(size);
+}
+
+static VALUE
+rb_integer_test_numbytes_2comp_with_sign(VALUE val)
+{
+ int neg = FIXNUM_P(val) ? FIX2LONG(val) < 0 : BIGNUM_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)))
+ size++;
+ return SIZET2NUM(size);
+}
+
+void
+Init_intpack(VALUE klass)
+{
+ rb_define_method(rb_cInteger, "test_pack_raw", rb_integer_pack_raw_m, 5);
+ rb_define_method(rb_cInteger, "test_pack", rb_integer_pack_m, 4);
+ rb_define_singleton_method(rb_cInteger, "test_unpack", rb_integer_unpack_m, 5);
+ rb_define_const(rb_cInteger, "INTEGER_PACK_MSWORD_FIRST", INT2NUM(INTEGER_PACK_MSWORD_FIRST));
+ rb_define_const(rb_cInteger, "INTEGER_PACK_LSWORD_FIRST", INT2NUM(INTEGER_PACK_LSWORD_FIRST));
+ rb_define_const(rb_cInteger, "INTEGER_PACK_MSBYTE_FIRST", INT2NUM(INTEGER_PACK_MSBYTE_FIRST));
+ rb_define_const(rb_cInteger, "INTEGER_PACK_LSBYTE_FIRST", INT2NUM(INTEGER_PACK_LSBYTE_FIRST));
+ rb_define_const(rb_cInteger, "INTEGER_PACK_NATIVE_BYTE_ORDER", INT2NUM(INTEGER_PACK_NATIVE_BYTE_ORDER));
+ rb_define_const(rb_cInteger, "INTEGER_PACK_2COMP", INT2NUM(INTEGER_PACK_2COMP));
+ rb_define_const(rb_cInteger, "INTEGER_PACK_LITTLE_ENDIAN", INT2NUM(INTEGER_PACK_LITTLE_ENDIAN));
+ rb_define_const(rb_cInteger, "INTEGER_PACK_BIG_ENDIAN", INT2NUM(INTEGER_PACK_BIG_ENDIAN));
+ rb_define_const(rb_cInteger, "INTEGER_PACK_FORCE_BIGNUM", INT2NUM(INTEGER_PACK_FORCE_BIGNUM));
+ rb_define_const(rb_cInteger, "INTEGER_PACK_NEGATIVE", INT2NUM(INTEGER_PACK_NEGATIVE));
+ rb_define_const(rb_cInteger, "INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION", INT2NUM(INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION));
+
+ rb_define_method(rb_cInteger, "test_numbits_2comp_without_sign", rb_integer_test_numbits_2comp_without_sign, 0);
+ rb_define_method(rb_cInteger, "test_numbytes_2comp_with_sign", rb_integer_test_numbytes_2comp_with_sign, 0);
+}
diff --git a/ext/-test-/bignum/mul.c b/ext/-test-/bignum/mul.c
new file mode 100644
index 0000000000..c0514a5a0d
--- /dev/null
+++ b/ext/-test-/bignum/mul.c
@@ -0,0 +1,66 @@
+#include "ruby.h"
+#include "internal.h"
+
+static VALUE
+big(VALUE x)
+{
+ if (FIXNUM_P(x))
+ return rb_int2big(FIX2LONG(x));
+ if (RB_TYPE_P(x, T_BIGNUM))
+ return x;
+ rb_raise(rb_eTypeError, "can't convert %s to Bignum",
+ rb_obj_classname(x));
+}
+
+static VALUE
+mul_normal(VALUE x, VALUE y)
+{
+ return rb_big_norm(rb_big_mul_normal(big(x), big(y)));
+}
+
+static VALUE
+sq_fast(VALUE x)
+{
+ return rb_big_norm(rb_big_sq_fast(big(x)));
+}
+
+static VALUE
+mul_balance(VALUE x, VALUE y)
+{
+ return rb_big_norm(rb_big_mul_balance(big(x), big(y)));
+}
+
+static VALUE
+mul_karatsuba(VALUE x, VALUE y)
+{
+ return rb_big_norm(rb_big_mul_karatsuba(big(x), big(y)));
+}
+
+static VALUE
+mul_toom3(VALUE x, VALUE y)
+{
+ return rb_big_norm(rb_big_mul_toom3(big(x), big(y)));
+}
+
+#if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H)
+static VALUE
+mul_gmp(VALUE x, VALUE y)
+{
+ return rb_big_norm(rb_big_mul_gmp(big(x), big(y)));
+}
+#else
+#define mul_gmp rb_f_notimplement
+#endif
+
+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_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);
+ rb_define_method(rb_cInteger, "big_mul_karatsuba", mul_karatsuba, 1);
+ rb_define_method(rb_cInteger, "big_mul_toom3", mul_toom3, 1);
+ rb_define_method(rb_cInteger, "big_mul_gmp", mul_gmp, 1);
+}
diff --git a/ext/-test-/bignum/str2big.c b/ext/-test-/bignum/str2big.c
new file mode 100644
index 0000000000..0fdcb53290
--- /dev/null
+++ b/ext/-test-/bignum/str2big.c
@@ -0,0 +1,39 @@
+#include "ruby.h"
+#include "internal.h"
+
+static VALUE
+str2big_poweroftwo(VALUE str, VALUE vbase, VALUE badcheck)
+{
+ return rb_str2big_poweroftwo(str, NUM2INT(vbase), RTEST(badcheck));
+}
+
+static VALUE
+str2big_normal(VALUE str, VALUE vbase, VALUE badcheck)
+{
+ return rb_str2big_normal(str, NUM2INT(vbase), RTEST(badcheck));
+}
+
+static VALUE
+str2big_karatsuba(VALUE str, VALUE vbase, VALUE badcheck)
+{
+ return rb_str2big_karatsuba(str, NUM2INT(vbase), RTEST(badcheck));
+}
+
+#if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H)
+static VALUE
+str2big_gmp(VALUE str, VALUE vbase, VALUE badcheck)
+{
+ return rb_str2big_gmp(str, NUM2INT(vbase), RTEST(badcheck));
+}
+#else
+#define str2big_gmp rb_f_notimplement
+#endif
+
+void
+Init_str2big(VALUE klass)
+{
+ rb_define_method(rb_cString, "str2big_poweroftwo", str2big_poweroftwo, 2);
+ rb_define_method(rb_cString, "str2big_normal", str2big_normal, 2);
+ rb_define_method(rb_cString, "str2big_karatsuba", str2big_karatsuba, 2);
+ rb_define_method(rb_cString, "str2big_gmp", str2big_gmp, 2);
+}
diff --git a/ext/-test-/bug-3571/bug.c b/ext/-test-/bug-3571/bug.c
index 72d6bd1021..87a5df0588 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(VALUE i, VALUE arg)
+bug_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, arg))
{
rb_notimplement();
return ID2SYM(rb_frame_this_func());
diff --git a/ext/-test-/bug_reporter/bug_reporter.c b/ext/-test-/bug_reporter/bug_reporter.c
new file mode 100644
index 0000000000..e9ea9e3db0
--- /dev/null
+++ b/ext/-test-/bug_reporter/bug_reporter.c
@@ -0,0 +1,24 @@
+#include <ruby.h>
+#include <stdio.h>
+
+int rb_bug_reporter_add(void (*func)(FILE *, void *), void *data);
+
+static void
+sample_bug_reporter(FILE *out, void *ptr)
+{
+ int n = (int)(uintptr_t)ptr;
+ fprintf(out, "Sample bug reporter: %d\n", n);
+}
+
+static VALUE
+register_sample_bug_reporter(VALUE self, VALUE obj)
+{
+ rb_bug_reporter_add(sample_bug_reporter, (void *)(uintptr_t)NUM2INT(obj));
+ return Qnil;
+}
+
+void
+Init_bug_reporter(void)
+{
+ rb_define_global_function("register_sample_bug_reporter", register_sample_bug_reporter, 1);
+}
diff --git a/ext/-test-/bug_reporter/extconf.rb b/ext/-test-/bug_reporter/extconf.rb
new file mode 100644
index 0000000000..0fccd81a41
--- /dev/null
+++ b/ext/-test-/bug_reporter/extconf.rb
@@ -0,0 +1 @@
+create_makefile("-test-/bug_reporter/bug_reporter")
diff --git a/ext/-test-/class/class2name.c b/ext/-test-/class/class2name.c
new file mode 100644
index 0000000000..c48df6fb2a
--- /dev/null
+++ b/ext/-test-/class/class2name.c
@@ -0,0 +1,14 @@
+#include <ruby/ruby.h>
+
+static VALUE
+class2name(VALUE self, VALUE klass)
+{
+ const char *name = rb_class2name(klass);
+ return name ? rb_str_new_cstr(name) : Qnil;
+}
+
+void
+Init_class2name(VALUE klass)
+{
+ rb_define_singleton_method(klass, "class2name", class2name, 1);
+}
diff --git a/ext/-test-/class/extconf.rb b/ext/-test-/class/extconf.rb
new file mode 100644
index 0000000000..a07d660b87
--- /dev/null
+++ b/ext/-test-/class/extconf.rb
@@ -0,0 +1,7 @@
+$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-/class")
diff --git a/ext/-test-/class/init.c b/ext/-test-/class/init.c
new file mode 100644
index 0000000000..ed715c1942
--- /dev/null
+++ b/ext/-test-/class/init.c
@@ -0,0 +1,11 @@
+#include "ruby.h"
+
+#define init(n) {void Init_##n(VALUE mod); Init_##n(mod);}
+
+void
+Init_class(void)
+{
+ VALUE mBug = rb_define_module("Bug");
+ VALUE mod = rb_define_module_under(mBug, "Class");
+ TEST_INIT_FUNCS(init);
+}
diff --git a/ext/-test-/debug/depend b/ext/-test-/debug/depend
new file mode 100644
index 0000000000..d5a2ef9a52
--- /dev/null
+++ b/ext/-test-/debug/depend
@@ -0,0 +1,3 @@
+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/profile_frames.c b/ext/-test-/debug/profile_frames.c
new file mode 100644
index 0000000000..1656ff7d4b
--- /dev/null
+++ b/ext/-test-/debug/profile_frames.c
@@ -0,0 +1,43 @@
+#include "ruby/ruby.h"
+#include "ruby/debug.h"
+
+#define MAX_BUF_SIZE 0x100
+
+static VALUE
+profile_frames(VALUE self, VALUE start_v, VALUE num_v)
+{
+ int i, collected_size;
+ int start = NUM2INT(start_v);
+ int buff_size = NUM2INT(num_v);
+ VALUE buff[MAX_BUF_SIZE];
+ int lines[MAX_BUF_SIZE];
+ VALUE result = rb_ary_new();
+
+ if (buff_size > MAX_BUF_SIZE) rb_raise(rb_eRuntimeError, "too long buff_size");
+
+ collected_size = rb_profile_frames(start, buff_size, buff, lines);
+
+ for (i=0; i<collected_size; i++) {
+ VALUE ary = rb_ary_new();
+ rb_ary_push(ary, rb_profile_frame_path(buff[i]));
+ rb_ary_push(ary, rb_profile_frame_absolute_path(buff[i]));
+ rb_ary_push(ary, rb_profile_frame_label(buff[i]));
+ rb_ary_push(ary, rb_profile_frame_base_label(buff[i]));
+ rb_ary_push(ary, rb_profile_frame_full_label(buff[i]));
+ rb_ary_push(ary, rb_profile_frame_first_lineno(buff[i]));
+ rb_ary_push(ary, rb_profile_frame_classpath(buff[i]));
+ rb_ary_push(ary, rb_profile_frame_singleton_method_p(buff[i]));
+ rb_ary_push(ary, rb_profile_frame_method_name(buff[i]));
+ rb_ary_push(ary, rb_profile_frame_qualified_method_name(buff[i]));
+
+ rb_ary_push(result, ary);
+ }
+
+ return result;
+}
+
+void
+Init_profile_frames(VALUE klass)
+{
+ rb_define_module_function(klass, "profile_frames", profile_frames, 2);
+}
diff --git a/ext/-test-/exception/dataerror.c b/ext/-test-/exception/dataerror.c
new file mode 100644
index 0000000000..d8beba8aa4
--- /dev/null
+++ b/ext/-test-/exception/dataerror.c
@@ -0,0 +1,31 @@
+#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
new file mode 100644
index 0000000000..79b6c53f50
--- /dev/null
+++ b/ext/-test-/exception/depend
@@ -0,0 +1,3 @@
+$(OBJS): $(HDRS) $(ruby_headers) \
+ $(hdrdir)/ruby/encoding.h \
+ $(hdrdir)/ruby/oniguruma.h
diff --git a/ext/-test-/file/depend b/ext/-test-/file/depend
new file mode 100644
index 0000000000..7555a235b5
--- /dev/null
+++ b/ext/-test-/file/depend
@@ -0,0 +1,2 @@
+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
new file mode 100644
index 0000000000..4e134dd1bf
--- /dev/null
+++ b/ext/-test-/file/extconf.rb
@@ -0,0 +1,7 @@
+$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-/file")
diff --git a/ext/-test-/file/fs.c b/ext/-test-/file/fs.c
new file mode 100644
index 0000000000..4a41bf33b9
--- /dev/null
+++ b/ext/-test-/file/fs.c
@@ -0,0 +1,60 @@
+#include "ruby/ruby.h"
+#include "ruby/io.h"
+
+#ifdef __linux__
+# define HAVE_GETMNTENT
+#endif
+
+#ifdef HAVE_GETMNTENT
+# include <stdio.h>
+# include <mntent.h>
+#endif
+
+VALUE
+get_fsname(VALUE self, VALUE str)
+{
+#ifdef HAVE_GETMNTENT
+ const char *path;
+ struct mntent mntbuf;
+ static const int buflen = 4096;
+ char *buf = alloca(buflen);
+ int len = 0;
+ FILE *fp;
+#define FSNAME_LEN 100
+ char name[FSNAME_LEN] = "";
+
+ FilePathValue(str);
+ path = RSTRING_PTR(str);
+ fp = setmntent("/etc/mtab", "r");
+ if (!fp) rb_sys_fail("setmntent(/etb/mtab)");;
+
+ while (getmntent_r(fp, &mntbuf, buf, buflen)) {
+ int i;
+ char *mnt_dir = mntbuf.mnt_dir;
+ for (i=0; mnt_dir[i]; i++) {
+ if (mnt_dir[i] != path[i]) {
+ goto next_entry;
+ }
+ }
+ if (i >= len) {
+ len = i;
+ strlcpy(name, mntbuf.mnt_type, FSNAME_LEN);
+ }
+next_entry:
+ ;
+ }
+ endmntent(fp);
+
+ if (!len) rb_sys_fail("no matching entry");;
+ return rb_str_new_cstr(name);
+#else
+ return Qnil;
+#endif
+}
+
+void
+Init_fs(VALUE module)
+{
+ VALUE fs = rb_define_module_under(module, "Fs");
+ rb_define_module_function(fs, "fsname", get_fsname, 1);
+}
diff --git a/ext/-test-/file/init.c b/ext/-test-/file/init.c
new file mode 100644
index 0000000000..1117993d6c
--- /dev/null
+++ b/ext/-test-/file/init.c
@@ -0,0 +1,11 @@
+#include "ruby.h"
+
+#define init(n) {void Init_##n(VALUE klass); Init_##n(module);}
+
+void
+Init_file(void)
+{
+ VALUE mBug = rb_define_module("Bug");
+ VALUE module = rb_define_module_under(mBug, "File");
+ TEST_INIT_FUNCS(init);
+}
diff --git a/ext/-test-/file/stat.c b/ext/-test-/file/stat.c
new file mode 100644
index 0000000000..fed5d389eb
--- /dev/null
+++ b/ext/-test-/file/stat.c
@@ -0,0 +1,27 @@
+#include "ruby/ruby.h"
+#include "ruby/io.h"
+
+static VALUE
+stat_for_fd(VALUE self, VALUE fileno)
+{
+ struct stat st;
+ if (fstat(NUM2INT(fileno), &st)) rb_sys_fail(0);
+ return rb_stat_new(&st);
+}
+
+static VALUE
+stat_for_path(VALUE self, VALUE path)
+{
+ struct stat st;
+ FilePathValue(path);
+ if (stat(RSTRING_PTR(path), &st)) rb_sys_fail(0);
+ return rb_stat_new(&st);
+}
+
+void
+Init_stat(VALUE module)
+{
+ VALUE st = rb_define_module_under(module, "Stat");
+ rb_define_module_function(st, "for_fd", stat_for_fd, 1);
+ rb_define_module_function(st, "for_path", stat_for_path, 1);
+}
diff --git a/ext/-test-/float/depend b/ext/-test-/float/depend
new file mode 100644
index 0000000000..dff14550f7
--- /dev/null
+++ b/ext/-test-/float/depend
@@ -0,0 +1,3 @@
+$(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
new file mode 100644
index 0000000000..0a9a299aa5
--- /dev/null
+++ b/ext/-test-/float/extconf.rb
@@ -0,0 +1,7 @@
+$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
new file mode 100644
index 0000000000..d962108e39
--- /dev/null
+++ b/ext/-test-/float/init.c
@@ -0,0 +1,11 @@
+#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
new file mode 100644
index 0000000000..30fb71f520
--- /dev/null
+++ b/ext/-test-/float/nextafter.c
@@ -0,0 +1,36 @@
+#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-/iter/break.c b/ext/-test-/iter/break.c
index 56ba7e7ffd..66ed26a9b8 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(void)
+Init_break(VALUE klass)
{
- VALUE breakable = rb_define_module_under(rb_define_module("Bug"), "Breakable");
+ VALUE breakable = rb_define_module_under(klass, "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 695b5e9f6d..0ba99691bd 100644
--- a/ext/-test-/iter/extconf.rb
+++ b/ext/-test-/iter/extconf.rb
@@ -1 +1,7 @@
-create_makefile("-test-/iter/break")
+$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")
diff --git a/ext/-test-/iter/init.c b/ext/-test-/iter/init.c
new file mode 100644
index 0000000000..a074ec46a9
--- /dev/null
+++ b/ext/-test-/iter/init.c
@@ -0,0 +1,11 @@
+#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
new file mode 100644
index 0000000000..3cd408a928
--- /dev/null
+++ b/ext/-test-/iter/yield.c
@@ -0,0 +1,16 @@
+#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-/num2int/depend b/ext/-test-/num2int/depend
deleted file mode 100644
index 7a85cdb6c0..0000000000
--- a/ext/-test-/num2int/depend
+++ /dev/null
@@ -1 +0,0 @@
-num2int.o: $(top_srcdir)/numeric.c $(hdrdir)/ruby/ruby.h
diff --git a/ext/-test-/num2int/num2int.c b/ext/-test-/num2int/num2int.c
index fb1ea9678d..3aec3ccf3b 100644
--- a/ext/-test-/num2int/num2int.c
+++ b/ext/-test-/num2int/num2int.c
@@ -1,120 +1,136 @@
#include <ruby.h>
static VALUE
-print_num2short(VALUE obj, VALUE num)
+test_num2short(VALUE obj, VALUE num)
{
char buf[128];
- VALUE str;
-
sprintf(buf, "%d", NUM2SHORT(num));
- str = rb_str_new_cstr(buf);
- rb_io_write(rb_stdout, str);
- return Qnil;
+ return rb_str_new_cstr(buf);
}
static VALUE
-print_num2ushort(VALUE obj, VALUE num)
+test_num2ushort(VALUE obj, VALUE num)
{
char buf[128];
- VALUE str;
-
sprintf(buf, "%u", NUM2USHORT(num));
- str = rb_str_new_cstr(buf);
- rb_io_write(rb_stdout, str);
- return Qnil;
+ return rb_str_new_cstr(buf);
}
static VALUE
-print_num2int(VALUE obj, VALUE num)
+test_num2int(VALUE obj, VALUE num)
{
char buf[128];
- VALUE str;
-
sprintf(buf, "%d", NUM2INT(num));
- str = rb_str_new_cstr(buf);
- rb_io_write(rb_stdout, str);
- return Qnil;
+ return rb_str_new_cstr(buf);
}
static VALUE
-print_num2uint(VALUE obj, VALUE num)
+test_num2uint(VALUE obj, VALUE num)
{
char buf[128];
- VALUE str;
-
sprintf(buf, "%u", NUM2UINT(num));
- str = rb_str_new_cstr(buf);
- rb_io_write(rb_stdout, str);
- return Qnil;
+ return rb_str_new_cstr(buf);
}
static VALUE
-print_num2long(VALUE obj, VALUE num)
+test_num2long(VALUE obj, VALUE num)
{
char buf[128];
- VALUE str;
-
sprintf(buf, "%ld", NUM2LONG(num));
- str = rb_str_new_cstr(buf);
- rb_io_write(rb_stdout, str);
- return Qnil;
+ return rb_str_new_cstr(buf);
}
static VALUE
-print_num2ulong(VALUE obj, VALUE num)
+test_num2ulong(VALUE obj, VALUE num)
{
char buf[128];
- VALUE str;
-
sprintf(buf, "%lu", NUM2ULONG(num));
- str = rb_str_new_cstr(buf);
- rb_io_write(rb_stdout, str);
- return Qnil;
+ return rb_str_new_cstr(buf);
}
#ifdef HAVE_LONG_LONG
static VALUE
-print_num2ll(VALUE obj, VALUE num)
+test_num2ll(VALUE obj, VALUE num)
{
char buf[128];
- VALUE str;
-
sprintf(buf, "%"PRI_LL_PREFIX"d", NUM2LL(num));
- str = rb_str_new_cstr(buf);
- rb_io_write(rb_stdout, str);
- return Qnil;
+ return rb_str_new_cstr(buf);
}
static VALUE
-print_num2ull(VALUE obj, VALUE num)
+test_num2ull(VALUE obj, VALUE num)
{
char buf[128];
- VALUE str;
-
sprintf(buf, "%"PRI_LL_PREFIX"u", NUM2ULL(num));
- str = rb_str_new_cstr(buf);
- rb_io_write(rb_stdout, str);
- return Qnil;
+ return rb_str_new_cstr(buf);
}
#endif
+static VALUE
+test_fix2short(VALUE obj, VALUE num)
+{
+ char buf[128];
+ sprintf(buf, "%d", FIX2SHORT(num));
+ return rb_str_new_cstr(buf);
+}
+
+static VALUE
+test_fix2int(VALUE obj, VALUE num)
+{
+ char buf[128];
+ sprintf(buf, "%d", FIX2INT(num));
+ return rb_str_new_cstr(buf);
+}
+
+static VALUE
+test_fix2uint(VALUE obj, VALUE num)
+{
+ char buf[128];
+ sprintf(buf, "%u", FIX2UINT(num));
+ return rb_str_new_cstr(buf);
+}
+
+static VALUE
+test_fix2long(VALUE obj, VALUE num)
+{
+ char buf[128];
+ sprintf(buf, "%ld", FIX2LONG(num));
+ return rb_str_new_cstr(buf);
+}
+
+static VALUE
+test_fix2ulong(VALUE obj, VALUE num)
+{
+ char buf[128];
+ sprintf(buf, "%lu", FIX2ULONG(num));
+ return rb_str_new_cstr(buf);
+}
+
void
Init_num2int(void)
{
- VALUE cNum2int = rb_path2class("TestNum2int::Num2int");
+ VALUE mNum2int = rb_define_module("Num2int");
- rb_define_singleton_method(cNum2int, "print_num2short", print_num2short, 1);
- rb_define_singleton_method(cNum2int, "print_num2ushort", print_num2ushort, 1);
+ rb_define_module_function(mNum2int, "NUM2SHORT", test_num2short, 1);
+ rb_define_module_function(mNum2int, "NUM2USHORT", test_num2ushort, 1);
- rb_define_singleton_method(cNum2int, "print_num2int", print_num2int, 1);
- rb_define_singleton_method(cNum2int, "print_num2uint", print_num2uint, 1);
+ rb_define_module_function(mNum2int, "NUM2INT", test_num2int, 1);
+ rb_define_module_function(mNum2int, "NUM2UINT", test_num2uint, 1);
- rb_define_singleton_method(cNum2int, "print_num2long", print_num2long, 1);
- rb_define_singleton_method(cNum2int, "print_num2ulong", print_num2ulong, 1);
+ rb_define_module_function(mNum2int, "NUM2LONG", test_num2long, 1);
+ rb_define_module_function(mNum2int, "NUM2ULONG", test_num2ulong, 1);
#ifdef HAVE_LONG_LONG
- rb_define_singleton_method(cNum2int, "print_num2ll", print_num2ll, 1);
- rb_define_singleton_method(cNum2int, "print_num2ull", print_num2ull, 1);
+ rb_define_module_function(mNum2int, "NUM2LL", test_num2ll, 1);
+ rb_define_module_function(mNum2int, "NUM2ULL", test_num2ull, 1);
#endif
+
+ rb_define_module_function(mNum2int, "FIX2SHORT", test_fix2short, 1);
+
+ rb_define_module_function(mNum2int, "FIX2INT", test_fix2int, 1);
+ rb_define_module_function(mNum2int, "FIX2UINT", test_fix2uint, 1);
+
+ rb_define_module_function(mNum2int, "FIX2LONG", test_fix2long, 1);
+ rb_define_module_function(mNum2int, "FIX2ULONG", test_fix2ulong, 1);
}
diff --git a/ext/-test-/old_thread_select/depend b/ext/-test-/old_thread_select/depend
deleted file mode 100644
index a2bc836e1f..0000000000
--- a/ext/-test-/old_thread_select/depend
+++ /dev/null
@@ -1,2 +0,0 @@
-old_thread_select.o: $(top_srcdir)/thread.c \
- $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/io.h
diff --git a/ext/-test-/old_thread_select/extconf.rb b/ext/-test-/old_thread_select/extconf.rb
deleted file mode 100644
index 730d9ec901..0000000000
--- a/ext/-test-/old_thread_select/extconf.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-$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
deleted file mode 100644
index e374f02355..0000000000
--- a/ext/-test-/old_thread_select/old_thread_select.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/* 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-/postponed_job/depend b/ext/-test-/postponed_job/depend
new file mode 100644
index 0000000000..d672e53f00
--- /dev/null
+++ b/ext/-test-/postponed_job/depend
@@ -0,0 +1 @@
+postponed_job.o: $(HDRS) $(ruby_headers) $(hdrdir)/ruby/debug.h
diff --git a/ext/-test-/postponed_job/extconf.rb b/ext/-test-/postponed_job/extconf.rb
new file mode 100644
index 0000000000..aa29b593f4
--- /dev/null
+++ b/ext/-test-/postponed_job/extconf.rb
@@ -0,0 +1 @@
+create_makefile('-test-/postponed_job')
diff --git a/ext/-test-/postponed_job/postponed_job.c b/ext/-test-/postponed_job/postponed_job.c
new file mode 100644
index 0000000000..157230e33b
--- /dev/null
+++ b/ext/-test-/postponed_job/postponed_job.c
@@ -0,0 +1,53 @@
+#include "ruby.h"
+#include "ruby/debug.h"
+
+static void
+pjob_callback(void *data)
+{
+ VALUE ary = (VALUE)data;
+ Check_Type(ary, T_ARRAY);
+
+ rb_ary_replace(ary, rb_funcall(Qnil, rb_intern("caller"), 0));
+}
+
+static VALUE
+pjob_register(VALUE self, VALUE obj)
+{
+ rb_postponed_job_register(0, pjob_callback, (void *)obj);
+ return self;
+}
+
+static void
+pjob_one_callback(void *data)
+{
+ VALUE ary = (VALUE)data;
+ Check_Type(ary, T_ARRAY);
+
+ rb_ary_push(ary, INT2FIX(1));
+}
+
+static VALUE
+pjob_register_one(VALUE self, VALUE obj)
+{
+ rb_postponed_job_register_one(0, pjob_one_callback, (void *)obj);
+ rb_postponed_job_register_one(0, pjob_one_callback, (void *)obj);
+ rb_postponed_job_register_one(0, pjob_one_callback, (void *)obj);
+ return self;
+}
+
+static VALUE
+pjob_call_direct(VALUE self, VALUE obj)
+{
+ pjob_callback((void *)obj);
+ return self;
+}
+
+void
+Init_postponed_job(VALUE self)
+{
+ VALUE mBug = rb_define_module("Bug");
+ rb_define_module_function(mBug, "postponed_job_register", pjob_register, 1);
+ rb_define_module_function(mBug, "postponed_job_register_one", pjob_register_one, 1);
+ rb_define_module_function(mBug, "postponed_job_call_direct", pjob_call_direct, 1);
+}
+
diff --git a/ext/-test-/printf/depend b/ext/-test-/printf/depend
new file mode 100644
index 0000000000..79b6c53f50
--- /dev/null
+++ b/ext/-test-/printf/depend
@@ -0,0 +1,3 @@
+$(OBJS): $(HDRS) $(ruby_headers) \
+ $(hdrdir)/ruby/encoding.h \
+ $(hdrdir)/ruby/oniguruma.h
diff --git a/ext/-test-/printf/printf.c b/ext/-test-/printf/printf.c
index 775eb33dc7..336f918986 100644
--- a/ext/-test-/printf/printf.c
+++ b/ext/-test-/printf/printf.c
@@ -21,6 +21,83 @@ printf_test_v(VALUE self, VALUE obj)
return rb_enc_sprintf(rb_usascii_encoding(), "{%+"PRIsVALUE"}", obj);
}
+static VALUE
+printf_test_q(VALUE self, VALUE obj)
+{
+ return rb_enc_sprintf(rb_usascii_encoding(), "[% "PRIsVALUE"]", obj);
+}
+
+static char *
+utoa(char *p, char *e, unsigned int x)
+{
+ char *e0 = e;
+ if (e <= p) return p;
+ do {
+ *--e = x % 10 + '0';
+ } while ((x /= 10) != 0 && e > p);
+ memmove(p, e, e0 - e);
+ return p + (e0 - e);
+}
+
+static VALUE
+printf_test_call(int argc, VALUE *argv, VALUE self)
+{
+ VALUE opt, type, num, result;
+ char format[sizeof(int) * 6 + 8], *p = format, cnv;
+ int n = 0;
+ const char *s = 0;
+
+ 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;
+ default: rb_raise(rb_eArgError, "wrong conversion(%c)", cnv);
+ }
+ *p++ = '%';
+ if (!NIL_P(opt)) {
+ VALUE v;
+ Check_Type(opt, T_HASH);
+ if (RTEST(rb_hash_aref(opt, ID2SYM(rb_intern("space"))))) {
+ *p++ = ' ';
+ }
+ if (RTEST(rb_hash_aref(opt, ID2SYM(rb_intern("hash"))))) {
+ *p++ = '#';
+ }
+ if (RTEST(rb_hash_aref(opt, ID2SYM(rb_intern("plus"))))) {
+ *p++ = '+';
+ }
+ if (RTEST(rb_hash_aref(opt, ID2SYM(rb_intern("minus"))))) {
+ *p++ = '-';
+ }
+ if (RTEST(rb_hash_aref(opt, ID2SYM(rb_intern("zero"))))) {
+ *p++ = '0';
+ }
+ if (!NIL_P(v = rb_hash_aref(opt, ID2SYM(rb_intern("width"))))) {
+ 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 = 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));
+}
+
void
Init_printf(void)
{
@@ -28,4 +105,6 @@ Init_printf(void)
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);
+ rb_define_singleton_method(m, "call", printf_test_call, -1);
}
diff --git a/ext/-test-/rational/depend b/ext/-test-/rational/depend
new file mode 100644
index 0000000000..a43589042b
--- /dev/null
+++ b/ext/-test-/rational/depend
@@ -0,0 +1,3 @@
+$(OBJS): $(HDRS) $(ruby_headers)
+
+rat.o: rat.c $(top_srcdir)/internal.h
diff --git a/ext/-test-/rational/extconf.rb b/ext/-test-/rational/extconf.rb
new file mode 100644
index 0000000000..bd658def46
--- /dev/null
+++ b/ext/-test-/rational/extconf.rb
@@ -0,0 +1,7 @@
+$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-/rational")
diff --git a/ext/-test-/rational/rat.c b/ext/-test-/rational/rat.c
new file mode 100644
index 0000000000..63ca849816
--- /dev/null
+++ b/ext/-test-/rational/rat.c
@@ -0,0 +1,38 @@
+#include "ruby.h"
+#include "internal.h"
+
+#if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H)
+static VALUE
+big(VALUE x)
+{
+ if (FIXNUM_P(x))
+ return rb_int2big(FIX2LONG(x));
+ if (RB_TYPE_P(x, T_BIGNUM))
+ return x;
+ rb_raise(rb_eTypeError, "can't convert %s to Bignum",
+ rb_obj_classname(x));
+}
+#endif
+
+static VALUE
+gcd_normal(VALUE x, VALUE y)
+{
+ return rb_big_norm(rb_gcd_normal(rb_to_int(x), rb_to_int(y)));
+}
+
+#if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H)
+static VALUE
+gcd_gmp(VALUE x, VALUE y)
+{
+ return rb_big_norm(rb_gcd_gmp(big(x), big(y)));
+}
+#else
+#define gcd_gmp rb_f_notimplement
+#endif
+
+void
+Init_rational(VALUE klass)
+{
+ rb_define_method(rb_cInteger, "gcd_normal", gcd_normal, 1);
+ rb_define_method(rb_cInteger, "gcd_gmp", gcd_gmp, 1);
+}
diff --git a/ext/-test-/recursion/extconf.rb b/ext/-test-/recursion/extconf.rb
new file mode 100644
index 0000000000..92b28657f0
--- /dev/null
+++ b/ext/-test-/recursion/extconf.rb
@@ -0,0 +1,2 @@
+require 'mkmf'
+create_makefile("-test-/recursion")
diff --git a/ext/-test-/recursion/recursion.c b/ext/-test-/recursion/recursion.c
new file mode 100644
index 0000000000..13d41f0ba8
--- /dev/null
+++ b/ext/-test-/recursion/recursion.c
@@ -0,0 +1,28 @@
+#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-/string/coderange.c b/ext/-test-/string/coderange.c
index 2f1e6a06a8..b93172d72d 100644
--- a/ext/-test-/string/coderange.c
+++ b/ext/-test-/string/coderange.c
@@ -2,10 +2,11 @@
#include "ruby/encoding.h"
static VALUE sym_7bit, sym_valid, sym_unknown, sym_broken;
+
static VALUE
-str_coderange(VALUE str)
+coderange_int2sym(int coderange)
{
- switch (ENC_CODERANGE(str)) {
+ switch (coderange) {
case ENC_CODERANGE_7BIT:
return sym_7bit;
case ENC_CODERANGE_VALID:
@@ -19,6 +20,21 @@ str_coderange(VALUE str)
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)
{
@@ -27,4 +43,5 @@ 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 d4ff360575..c2ed410b41 100644
--- a/ext/-test-/string/cstr.c
+++ b/ext/-test-/string/cstr.c
@@ -1,16 +1,22 @@
#include "ruby.h"
+#include "ruby/encoding.h"
static VALUE
bug_str_cstr_term(VALUE str)
{
long len;
char *s;
+ int c;
+ rb_encoding *enc;
+
rb_str_modify(str);
len = RSTRING_LEN(str);
RSTRING_PTR(str)[len] = 'x';
s = StringValueCStr(str);
rb_gc();
- return INT2NUM(s[len]);
+ enc = rb_enc_get(str);
+ c = rb_enc_codepoint(&s[len], &s[len+rb_enc_mbminlen(enc)], enc);
+ return INT2NUM(c);
}
void
diff --git a/ext/-test-/string/depend b/ext/-test-/string/depend
new file mode 100644
index 0000000000..86617ff289
--- /dev/null
+++ b/ext/-test-/string/depend
@@ -0,0 +1,5 @@
+$(OBJS): $(HDRS) $(ruby_headers) \
+ $(hdrdir)/ruby/encoding.h \
+ $(hdrdir)/ruby/oniguruma.h
+qsort.o: $(hdrdir)/ruby/util.h
+normalize.o: $(top_srcdir)/internal.h
diff --git a/ext/-test-/string/extconf.rb b/ext/-test-/string/extconf.rb
index 42c10b994b..10d33cbab9 100644
--- a/ext/-test-/string/extconf.rb
+++ b/ext/-test-/string/extconf.rb
@@ -1,3 +1,4 @@
+$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")
diff --git a/ext/-test-/string/normalize.c b/ext/-test-/string/normalize.c
new file mode 100644
index 0000000000..22bb6d7887
--- /dev/null
+++ b/ext/-test-/string/normalize.c
@@ -0,0 +1,18 @@
+#include "ruby.h"
+#include "internal.h"
+
+#ifdef __APPLE__
+static VALUE
+normalize_ospath(VALUE str)
+{
+ return rb_str_normalize_ospath(RSTRING_PTR(str), RSTRING_LEN(str));
+}
+#else
+#define normalize_ospath rb_f_notimplement
+#endif
+
+void
+Init_normalize(VALUE klass)
+{
+ rb_define_method(klass, "normalize_ospath", normalize_ospath, 0);
+}
diff --git a/ext/-test-/struct/extconf.rb b/ext/-test-/struct/extconf.rb
new file mode 100644
index 0000000000..0e4f9551f2
--- /dev/null
+++ b/ext/-test-/struct/extconf.rb
@@ -0,0 +1,7 @@
+$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
new file mode 100644
index 0000000000..459a939e79
--- /dev/null
+++ b/ext/-test-/struct/init.c
@@ -0,0 +1,11 @@
+#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
new file mode 100644
index 0000000000..1d404039b4
--- /dev/null
+++ b/ext/-test-/struct/member.c
@@ -0,0 +1,18 @@
+#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 d093ff682a..fc00ec9abf 100644
--- a/ext/-test-/symbol/extconf.rb
+++ b/ext/-test-/symbol/extconf.rb
@@ -3,4 +3,5 @@ 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-/symbol/symbol")
+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 e740345f2a..3b7cf15899 100644
--- a/ext/-test-/symbol/init.c
+++ b/ext/-test-/symbol/init.c
@@ -2,10 +2,17 @@
#define init(n) {void Init_##n(VALUE klass); Init_##n(klass);}
+static VALUE
+sym_find(VALUE dummy, VALUE sym)
+{
+ return rb_check_symbol(&sym);
+}
+
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);
TEST_INIT_FUNCS(init);
}
diff --git a/ext/-test-/symbol/intern.c b/ext/-test-/symbol/intern.c
deleted file mode 100644
index 6ae86a6104..0000000000
--- a/ext/-test-/symbol/intern.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#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
new file mode 100644
index 0000000000..e51e09eb26
--- /dev/null
+++ b/ext/-test-/symbol/type.c
@@ -0,0 +1,78 @@
+#include "ruby.h"
+
+#ifdef HAVE_RB_IS_CONST_NAME
+# define get_symbol_type(type, t, name) do { \
+ ID id = rb_check_id(&name); \
+ t = (id ? rb_is_##type##_id(id) : rb_is_##type##_name(name)); \
+ } while (0)
+#else
+# define get_symbol_type(type, t, name) do { \
+ t = rb_is_##type##_id(rb_to_id(name)); \
+ } while (0)
+#endif
+
+#define define_symbol_type_p(type) \
+static VALUE \
+bug_sym_##type##_p(VALUE self, VALUE name) \
+{ \
+ int t; \
+ get_symbol_type(type, t, name); \
+ return (t ? Qtrue : Qfalse); \
+}
+
+#define declare_symbol_type_p(type) \
+ rb_define_singleton_method(klass, #type"?", bug_sym_##type##_p, 1);
+
+#define FOREACH_ID_TYPES(x) x(const) x(class) x(global) x(instance) x(attrset) x(local) x(junk)
+
+FOREACH_ID_TYPES(define_symbol_type_p)
+
+static VALUE
+bug_sym_attrset(VALUE self, VALUE name)
+{
+ ID id = rb_to_id(name);
+ id = rb_id_attrset(id);
+ 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-/tracepoint/depend b/ext/-test-/tracepoint/depend
new file mode 100644
index 0000000000..8d4e5ab343
--- /dev/null
+++ b/ext/-test-/tracepoint/depend
@@ -0,0 +1 @@
+tracepoint.o: $(HDRS) $(ruby_headers) $(hdrdir)/ruby/debug.h
diff --git a/ext/-test-/tracepoint/extconf.rb b/ext/-test-/tracepoint/extconf.rb
new file mode 100644
index 0000000000..c0c2399eb4
--- /dev/null
+++ b/ext/-test-/tracepoint/extconf.rb
@@ -0,0 +1 @@
+create_makefile("-test-/tracepoint")
diff --git a/ext/-test-/tracepoint/gc_hook.c b/ext/-test-/tracepoint/gc_hook.c
new file mode 100644
index 0000000000..6d8485ecb1
--- /dev/null
+++ b/ext/-test-/tracepoint/gc_hook.c
@@ -0,0 +1,80 @@
+#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
new file mode 100644
index 0000000000..aa8c212f99
--- /dev/null
+++ b/ext/-test-/tracepoint/tracepoint.c
@@ -0,0 +1,96 @@
+#include "ruby/ruby.h"
+#include "ruby/debug.h"
+
+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 objects_count;
+ VALUE objects[10];
+};
+
+#define objects_max (sizeof(((struct tracepoint_track *)NULL)->objects)/sizeof(VALUE))
+
+static void
+tracepoint_track_objspace_events_i(VALUE tpval, void *data)
+{
+ rb_trace_arg_t *tparg = rb_tracearg_from_tracepoint(tpval);
+ struct tracepoint_track *track = data;
+
+ switch (rb_tracearg_event_flag(tparg)) {
+ case RUBY_INTERNAL_EVENT_NEWOBJ:
+ {
+ VALUE obj = rb_tracearg_object(tparg);
+ if (track->objects_count < objects_max)
+ track->objects[track->objects_count++] = obj;
+ track->newobj_count++;
+ break;
+ }
+ case RUBY_INTERNAL_EVENT_FREEOBJ:
+ {
+ track->free_count++;
+ break;
+ }
+ case RUBY_INTERNAL_EVENT_GC_START:
+ {
+ track->gc_start_count++;
+ break;
+ }
+ case RUBY_INTERNAL_EVENT_GC_END_MARK:
+ {
+ track->gc_end_mark_count++;
+ break;
+ }
+ case RUBY_INTERNAL_EVENT_GC_END_SWEEP:
+ {
+ track->gc_end_sweep_count++;
+ break;
+ }
+ default:
+ rb_raise(rb_eRuntimeError, "unknown event");
+ }
+}
+
+static VALUE
+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,
+ 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_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_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-/wait_for_single_fd/depend b/ext/-test-/wait_for_single_fd/depend
index d9cd50a542..b94e507631 100644
--- a/ext/-test-/wait_for_single_fd/depend
+++ b/ext/-test-/wait_for_single_fd/depend
@@ -1,2 +1,4 @@
-wait_for_single_fd.o: $(top_srcdir)/thread.c \
- $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/io.h
+$(OBJS): $(HDRS) $(ruby_headers) \
+ $(hdrdir)/ruby/encoding.h \
+ $(hdrdir)/ruby/oniguruma.h \
+ $(hdrdir)/ruby/io.h
diff --git a/ext/-test-/win32/console/attribute.c b/ext/-test-/win32/console/attribute.c
new file mode 100644
index 0000000000..8941272ea7
--- /dev/null
+++ b/ext/-test-/win32/console/attribute.c
@@ -0,0 +1,56 @@
+#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, 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
new file mode 100644
index 0000000000..f4f65adf9a
--- /dev/null
+++ b/ext/-test-/win32/console/depend
@@ -0,0 +1 @@
+attribute.o: $(ruby_headers) $(hdrdir)/ruby/win32.h
diff --git a/ext/-test-/win32/console/extconf.rb b/ext/-test-/win32/console/extconf.rb
new file mode 100644
index 0000000000..4de9fa7e4f
--- /dev/null
+++ b/ext/-test-/win32/console/extconf.rb
@@ -0,0 +1,8 @@
+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
new file mode 100644
index 0000000000..f2e0d1c821
--- /dev/null
+++ b/ext/-test-/win32/console/init.c
@@ -0,0 +1,11 @@
+#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/empty/empty.c b/ext/-test-/win32/dln/empty/empty.c
new file mode 100644
index 0000000000..c4f94f1644
--- /dev/null
+++ b/ext/-test-/win32/dln/empty/empty.c
@@ -0,0 +1,4 @@
+void
+Init_empty(void)
+{
+}
diff --git a/ext/-test-/win32/dln/empty/extconf.rb b/ext/-test-/win32/dln/empty/extconf.rb
new file mode 100644
index 0000000000..a4efed90c9
--- /dev/null
+++ b/ext/-test-/win32/dln/empty/extconf.rb
@@ -0,0 +1,3 @@
+if $mingw or $mswin
+ create_makefile("-test-/win32/dln/empty")
+end
diff --git a/ext/-test-/win32/dln/extconf.rb b/ext/-test-/win32/dln/extconf.rb
index 0b5089af14..57cee23b40 100644
--- a/ext/-test-/win32/dln/extconf.rb
+++ b/ext/-test-/win32/dln/extconf.rb
@@ -2,6 +2,7 @@ if $mingw or $mswin
$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")
diff --git a/ext/-test-/win32/dln/libdlntest.c b/ext/-test-/win32/dln/libdlntest.c
index 040ae8125d..5923b732c8 100644
--- a/ext/-test-/win32/dln/libdlntest.c
+++ b/ext/-test-/win32/dln/libdlntest.c
@@ -1,4 +1,4 @@
-extern __declspec(dllexport) void
+void
dlntest_ordinal(void)
{
}
diff --git a/ext/-test-/win32/fd_setsize/depend b/ext/-test-/win32/fd_setsize/depend
index 4936d6b28c..7d40e8d572 100644
--- a/ext/-test-/win32/fd_setsize/depend
+++ b/ext/-test-/win32/fd_setsize/depend
@@ -1,2 +1 @@
-fd_setsize.o: $(top_srcdir)/win32/win32.c \
- $(hdrdir)/ruby/ruby.h
+fd_setsize.o: $(ruby_headers) $(hdrdir)/ruby/win32.h
diff --git a/ext/.document b/ext/.document
index 6997dbe356..2e6fc78879 100644
--- a/ext/.document
+++ b/ext/.document
@@ -4,7 +4,6 @@ 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
@@ -44,6 +43,8 @@ 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
openssl/ossl_asn1.c
@@ -88,7 +89,6 @@ pty/lib
pty/pty.c
racc/cparse/cparse.c
readline/readline.c
-refinement/refinement.c
ripper/lib
ripper/ripper.c
sdbm/init.c
@@ -96,6 +96,8 @@ socket
stringio/stringio.c
strscan/strscan.c
syslog/syslog.c
+syslog/lib
+thread/thread.c
win32ole/lib
-win32ole/win32ole.c
+win32ole/*.c
zlib/zlib.c
diff --git a/ext/Setup b/ext/Setup
index 6870035e45..5deb604151 100644
--- a/ext/Setup
+++ b/ext/Setup
@@ -2,7 +2,6 @@
#Win32API
#bigdecimal
-#curses
#dbm
#digest
#digest/md5
diff --git a/ext/Setup.atheos b/ext/Setup.atheos
index c4028ef1f2..662ca57af1 100644
--- a/ext/Setup.atheos
+++ b/ext/Setup.atheos
@@ -2,7 +2,6 @@ option nodynamic
#Win32API
bigdecimal
-curses
dbm
digest
digest/md5
diff --git a/ext/Setup.emx b/ext/Setup.emx
index bf9e2e32f9..6c80812ac0 100644
--- a/ext/Setup.emx
+++ b/ext/Setup.emx
@@ -1,8 +1,9 @@
+# OS/2 environment w/ Autoconf 2.1x for EMX
+option platform os2-emx
option nodynamic
#Win32API
bigdecimal
-curses
#dbm
digest
digest/md5
diff --git a/ext/Setup.nacl b/ext/Setup.nacl
index 3e7f469f92..28eafb5082 100644
--- a/ext/Setup.nacl
+++ b/ext/Setup.nacl
@@ -1,10 +1,9 @@
# #option nodynamic
-#
+#
# #Win32API
# bigdecimal
# continuation
# coverage
-# #curses
# date
# #dbm
# digest/bubblebabble
diff --git a/ext/Setup.nt b/ext/Setup.nt
index 8aec238152..3936d2ed29 100644
--- a/ext/Setup.nt
+++ b/ext/Setup.nt
@@ -1,8 +1,8 @@
+#option platform cygwin|mingw|mswin
#option nodynamic
Win32API
bigdecimal
-#curses
#dbm
digest
digest/md5
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index a5ddd6b7c6..08febb5585 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -18,6 +18,7 @@
# define BIGDECIMAL_ENABLE_VPRINT 1
#endif
#include "bigdecimal.h"
+#include "ruby/util.h"
#ifndef BIGDECIMAL_DEBUG
# define NDEBUG
@@ -38,6 +39,16 @@
/* #define ENABLE_NUMERIC_STRING */
+#define MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, min, max) ( \
+ (a) == 0 ? 0 : \
+ (a) == -1 ? (b) < -(max) : \
+ (a) > 0 ? \
+ ((b) > 0 ? (max) / (a) < (b) : (min) / (a) > (b)) : \
+ ((b) > 0 ? (min) / (a) < (b) : (max) / (a) > (b)))
+#define SIGNED_VALUE_MAX INTPTR_MAX
+#define SIGNED_VALUE_MIN INTPTR_MIN
+#define MUL_OVERFLOW_SIGNED_VALUE_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, SIGNED_VALUE_MIN, SIGNED_VALUE_MAX)
+
VALUE rb_cBigDecimal;
VALUE rb_mBigMath;
@@ -61,9 +72,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
@@ -75,33 +86,29 @@ static ID id_eq;
#define DBLE_FIG (DBL_DIG+1) /* figure of double */
#endif
-#ifndef RBIGNUM_ZERO_P
-# define RBIGNUM_ZERO_P(x) (RBIGNUM_LEN(x) == 0 || \
- (RBIGNUM_DIGITS(x)[0] == 0 && \
- (RBIGNUM_LEN(x) == 1 || bigzero_p(x))))
-#endif
-
-static inline int
-bigzero_p(VALUE x)
-{
- long i;
- BDIGIT *ds = RBIGNUM_DIGITS(x);
-
- for (i = RBIGNUM_LEN(x) - 1; 0 <= i; i--) {
- if (ds[i]) return 0;
- }
- return 1;
-}
-
#ifndef RRATIONAL_ZERO_P
-# define RRATIONAL_ZERO_P(x) (FIXNUM_P(RRATIONAL(x)->num) && \
- FIX2LONG(RRATIONAL(x)->num) == 0)
+# define RRATIONAL_ZERO_P(x) (FIXNUM_P(rb_rational_num(x)) && \
+ FIX2LONG(rb_rational_num(x)) == 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
+
/*
* ================== Ruby Interface part ==========================
*/
@@ -130,6 +137,10 @@ 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 ****
*/
@@ -149,7 +160,10 @@ BigDecimal_memsize(const void *ptr)
static const rb_data_type_t BigDecimal_data_type = {
"BigDecimal",
- {0, BigDecimal_delete, BigDecimal_memsize,},
+ { 0, BigDecimal_delete, BigDecimal_memsize, },
+#ifdef RUBY_TYPED_FREE_IMMEDIATELY
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
+#endif
};
static inline int
@@ -161,12 +175,14 @@ is_kind_of_BigDecimal(VALUE const v)
static VALUE
ToValue(Real *p)
{
- if(VpIsNaN(p)) {
- VpException(VP_EXCEPTION_NaN,"Computation results to 'NaN'(Not a Number)",0);
- } else if(VpIsPosInf(p)) {
- VpException(VP_EXCEPTION_INFINITY,"Computation results to 'Infinity'",0);
- } else if(VpIsNegInf(p)) {
- VpException(VP_EXCEPTION_INFINITY,"Computation results to '-Infinity'",0);
+ if (VpIsNaN(p)) {
+ VpException(VP_EXCEPTION_NaN, "Computation results to 'NaN'(Not a Number)", 0);
+ }
+ else if (VpIsPosInf(p)) {
+ VpException(VP_EXCEPTION_INFINITY, "Computation results to 'Infinity'", 0);
+ }
+ else if (VpIsNegInf(p)) {
+ VpException(VP_EXCEPTION_INFINITY, "Computation results to '-Infinity'", 0);
}
return p->obj;
}
@@ -189,35 +205,41 @@ cannot_be_coerced_into_BigDecimal(VALUE exc_class, VALUE v)
rb_exc_raise(rb_exc_new3(exc_class, str));
}
-static VALUE BigDecimal_div2(int, VALUE*, VALUE);
+static inline VALUE BigDecimal_div2(VALUE, VALUE, VALUE);
static Real*
GetVpValueWithPrec(VALUE v, long prec, int must)
{
Real *pv;
- VALUE num, bg, args[2];
+ VALUE num, bg;
char szD[128];
VALUE orig = Qundef;
+ double d;
again:
- switch(TYPE(v))
- {
+ switch(TYPE(v)) {
case T_FLOAT:
if (prec < 0) goto unable_to_coerce_without_prec;
- if (prec > DBL_DIG+1)goto SomeOneMayDoIt;
- v = rb_funcall(v, id_to_r, 0);
- goto again;
+ if (prec > DBL_DIG+1) goto SomeOneMayDoIt;
+ d = RFLOAT_VALUE(v);
+ 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");
+
case T_RATIONAL:
if (prec < 0) goto unable_to_coerce_without_prec;
if (orig == Qundef ? (orig = v, 1) : orig != v) {
- num = RRATIONAL(v)->num;
+ num = rb_rational_num(v);
pv = GetVpValueWithPrec(num, -1, must);
if (pv == NULL) goto SomeOneMayDoIt;
- args[0] = RRATIONAL(v)->den;
- args[1] = LONG2NUM(prec);
- v = BigDecimal_div2(2, args, ToValue(pv));
+ v = BigDecimal_div2(ToValue(pv), rb_rational_den(v), LONG2NUM(prec));
goto again;
}
@@ -262,8 +284,8 @@ SomeOneMayDoIt:
unable_to_coerce_without_prec:
if (must) {
rb_raise(rb_eArgError,
- "%s can't be coerced into BigDecimal without a precision",
- rb_obj_classname(v));
+ "%"PRIsVALUE" can't be coerced into BigDecimal without a precision",
+ RB_OBJ_CLASSNAME(v));
}
return NULL;
}
@@ -303,7 +325,7 @@ BigDecimal_prec(VALUE self)
Real *p;
VALUE obj;
- GUARD_OBJ(p,GetVpValue(self,1));
+ GUARD_OBJ(p, GetVpValue(self, 1));
obj = rb_assoc_new(INT2NUM(p->Prec*VpBaseFig()),
INT2NUM(p->MaxPrec*VpBaseFig()));
return obj;
@@ -324,7 +346,7 @@ BigDecimal_hash(VALUE self)
Real *p;
st_index_t hash;
- GUARD_OBJ(p,GetVpValue(self,1));
+ GUARD_OBJ(p, GetVpValue(self, 1));
hash = (st_index_t)p->sign;
/* hash!=2: the case for 0(1),NaN(0) or +-Infinity(3) is sign itself */
if(hash == 2 || hash == (st_index_t)-2) {
@@ -356,8 +378,8 @@ BigDecimal_dump(int argc, VALUE *argv, VALUE self)
volatile VALUE dump;
rb_scan_args(argc, argv, "01", &dummy);
- GUARD_OBJ(vp,GetVpValue(self,1));
- dump = rb_str_new(0,VpNumOfChars(vp,"E")+50);
+ GUARD_OBJ(vp,GetVpValue(self, 1));
+ dump = rb_str_new(0, VpNumOfChars(vp, "E")+50);
psz = RSTRING_PTR(dump);
sprintf(psz, "%"PRIuSIZE":", VpMaxPrec(vp)*VpBaseFig());
VpToString(vp, psz+strlen(psz), 0, 0);
@@ -380,16 +402,18 @@ BigDecimal_load(VALUE self, VALUE str)
SafeStringValue(str);
pch = (unsigned char *)RSTRING_PTR(str);
/* First get max prec */
- while((*pch)!=(unsigned char)'\0' && (ch=*pch++)!=(unsigned char)':') {
+ while((*pch) != (unsigned char)'\0' && (ch = *pch++) != (unsigned char)':') {
if(!ISDIGIT(ch)) {
rb_raise(rb_eTypeError, "load failed: invalid character in the marshaled string");
}
m = m*10 + (unsigned long)(ch-'0');
}
- if(m>VpBaseFig()) m -= VpBaseFig();
- GUARD_OBJ(pv,VpNewRbClass(m,(char *)pch,self));
+ if (m > VpBaseFig()) m -= VpBaseFig();
+ GUARD_OBJ(pv, VpNewRbClass(m, (char *)pch, self));
m /= VpBaseFig();
- if(m && pv->MaxPrec>m) pv->MaxPrec = m+1;
+ if (m && pv->MaxPrec > m) {
+ pv->MaxPrec = m+1;
+ }
return ToValue(pv);
}
@@ -450,10 +474,10 @@ check_rounding_mode(VALUE const v)
* When computation continues, results are as follows:
*
* EXCEPTION_NaN:: NaN
- * EXCEPTION_INFINITY:: +infinity or -infinity
+ * EXCEPTION_INFINITY:: +Infinity or -Infinity
* EXCEPTION_UNDERFLOW:: 0
- * EXCEPTION_OVERFLOW:: +infinity or -infinity
- * EXCEPTION_ZERODIVIDE:: +infinity or -infinity
+ * EXCEPTION_OVERFLOW:: +Infinity or -Infinity
+ * EXCEPTION_ZERODIVIDE:: +Infinity or -Infinity
*
* One value of the mode parameter controls the rounding of numeric values:
* BigDecimal::ROUND_MODE. The values it can take are:
@@ -474,40 +498,39 @@ BigDecimal_mode(int argc, VALUE *argv, VALUE self)
VALUE val;
unsigned long f,fo;
- if(rb_scan_args(argc,argv,"11",&which,&val)==1) val = Qnil;
-
+ rb_scan_args(argc, argv, "11", &which, &val);
Check_Type(which, T_FIXNUM);
f = (unsigned long)FIX2INT(which);
- if(f&VP_EXCEPTION_ALL) {
- /* Exception mode setting */
- fo = VpGetException();
- if(val==Qnil) return INT2FIX(fo);
- if(val!=Qfalse && val!=Qtrue) {
- rb_raise(rb_eArgError, "second argument must be true or false");
- return Qnil; /* Not reached */
- }
- if(f&VP_EXCEPTION_INFINITY) {
- VpSetException((unsigned short)((val==Qtrue)?(fo|VP_EXCEPTION_INFINITY):
- (fo&(~VP_EXCEPTION_INFINITY))));
- }
- fo = VpGetException();
- if(f&VP_EXCEPTION_NaN) {
- VpSetException((unsigned short)((val==Qtrue)?(fo|VP_EXCEPTION_NaN):
- (fo&(~VP_EXCEPTION_NaN))));
- }
- fo = VpGetException();
- if(f&VP_EXCEPTION_UNDERFLOW) {
- VpSetException((unsigned short)((val==Qtrue)?(fo|VP_EXCEPTION_UNDERFLOW):
- (fo&(~VP_EXCEPTION_UNDERFLOW))));
- }
- fo = VpGetException();
- if(f&VP_EXCEPTION_ZERODIVIDE) {
- VpSetException((unsigned short)((val==Qtrue)?(fo|VP_EXCEPTION_ZERODIVIDE):
- (fo&(~VP_EXCEPTION_ZERODIVIDE))));
- }
- fo = VpGetException();
- return INT2FIX(fo);
+ if (f & VP_EXCEPTION_ALL) {
+ /* Exception mode setting */
+ fo = VpGetException();
+ if (val == Qnil) return INT2FIX(fo);
+ if (val != Qfalse && val!=Qtrue) {
+ rb_raise(rb_eArgError, "second argument must be true or false");
+ return Qnil; /* Not reached */
+ }
+ if (f & VP_EXCEPTION_INFINITY) {
+ VpSetException((unsigned short)((val == Qtrue) ? (fo | VP_EXCEPTION_INFINITY) :
+ (fo & (~VP_EXCEPTION_INFINITY))));
+ }
+ fo = VpGetException();
+ if (f & VP_EXCEPTION_NaN) {
+ VpSetException((unsigned short)((val == Qtrue) ? (fo | VP_EXCEPTION_NaN) :
+ (fo & (~VP_EXCEPTION_NaN))));
+ }
+ fo = VpGetException();
+ if (f & VP_EXCEPTION_UNDERFLOW) {
+ VpSetException((unsigned short)((val == Qtrue) ? (fo | VP_EXCEPTION_UNDERFLOW) :
+ (fo & (~VP_EXCEPTION_UNDERFLOW))));
+ }
+ fo = VpGetException();
+ if(f & VP_EXCEPTION_ZERODIVIDE) {
+ VpSetException((unsigned short)((val == Qtrue) ? (fo | VP_EXCEPTION_ZERODIVIDE) :
+ (fo & (~VP_EXCEPTION_ZERODIVIDE))));
+ }
+ fo = VpGetException();
+ return INT2FIX(fo);
}
if (VP_ROUND_MODE == f) {
/* Rounding mode setting */
@@ -529,16 +552,16 @@ GetAddSubPrec(Real *a, Real *b)
size_t mx = a->Prec;
SIGNED_VALUE d;
- if(!VpIsDef(a) || !VpIsDef(b)) return (size_t)-1L;
- if(mx < b->Prec) mx = b->Prec;
- if(a->exponent!=b->exponent) {
- mxs = mx;
- d = a->exponent - b->exponent;
- if (d < 0) d = -d;
- mx = mx + (size_t)d;
- if (mx<mxs) {
- return VpException(VP_EXCEPTION_INFINITY,"Exponent overflow",0);
- }
+ if (!VpIsDef(a) || !VpIsDef(b)) return (size_t)-1L;
+ if (mx < b->Prec) mx = b->Prec;
+ if (a->exponent != b->exponent) {
+ mxs = mx;
+ d = a->exponent - b->exponent;
+ if (d < 0) d = -d;
+ mx = mx + (size_t)d;
+ if (mx < mxs) {
+ return VpException(VP_EXCEPTION_INFINITY, "Exponent overflow", 0);
+ }
}
return mx;
}
@@ -550,7 +573,7 @@ GetPositiveInt(VALUE v)
Check_Type(v, T_FIXNUM);
n = FIX2INT(v);
if (n < 0) {
- rb_raise(rb_eArgError, "argument must be positive");
+ rb_raise(rb_eArgError, "argument must be positive");
}
return n;
}
@@ -594,20 +617,20 @@ VpCopy(Real *pv, Real const* const x)
static VALUE
BigDecimal_IsNaN(VALUE self)
{
- Real *p = GetVpValue(self,1);
- if(VpIsNaN(p)) return Qtrue;
+ Real *p = GetVpValue(self, 1);
+ if (VpIsNaN(p)) return Qtrue;
return Qfalse;
}
/* Returns nil, -1, or +1 depending on whether the value is finite,
- * -infinity, or +infinity.
+ * -Infinity, or +Infinity.
*/
static VALUE
BigDecimal_IsInfinite(VALUE self)
{
- Real *p = GetVpValue(self,1);
- if(VpIsPosInf(p)) return INT2FIX(1);
- if(VpIsNegInf(p)) return INT2FIX(-1);
+ Real *p = GetVpValue(self, 1);
+ if (VpIsPosInf(p)) return INT2FIX(1);
+ if (VpIsNegInf(p)) return INT2FIX(-1);
return Qnil;
}
@@ -615,21 +638,23 @@ BigDecimal_IsInfinite(VALUE self)
static VALUE
BigDecimal_IsFinite(VALUE self)
{
- Real *p = GetVpValue(self,1);
- if(VpIsNaN(p)) return Qfalse;
- if(VpIsInf(p)) return Qfalse;
+ Real *p = GetVpValue(self, 1);
+ if (VpIsNaN(p)) return Qfalse;
+ if (VpIsInf(p)) return Qfalse;
return Qtrue;
}
static void
BigDecimal_check_num(Real *p)
{
- if(VpIsNaN(p)) {
- VpException(VP_EXCEPTION_NaN,"Computation results to 'NaN'(Not a Number)",1);
- } else if(VpIsPosInf(p)) {
- VpException(VP_EXCEPTION_INFINITY,"Computation results to 'Infinity'",1);
- } else if(VpIsNegInf(p)) {
- VpException(VP_EXCEPTION_INFINITY,"Computation results to '-Infinity'",1);
+ if (VpIsNaN(p)) {
+ VpException(VP_EXCEPTION_NaN, "Computation results to 'NaN'(Not a Number)", 1);
+ }
+ else if (VpIsPosInf(p)) {
+ VpException(VP_EXCEPTION_INFINITY, "Computation results to 'Infinity'", 1);
+ }
+ else if (VpIsNegInf(p)) {
+ VpException(VP_EXCEPTION_INFINITY, "Computation results to '-Infinity'", 1);
}
}
@@ -646,14 +671,14 @@ BigDecimal_to_i(VALUE self)
ssize_t e, nf;
Real *p;
- GUARD_OBJ(p,GetVpValue(self,1));
+ GUARD_OBJ(p, GetVpValue(self, 1));
BigDecimal_check_num(p);
e = VpExponent10(p);
- if(e<=0) return INT2FIX(0);
+ if (e <= 0) return INT2FIX(0);
nf = VpBaseFig();
- if(e<=nf) {
- return LONG2NUM((long)(VpGetSign(p)*(BDIGIT_DBL_SIGNED)p->frac[0]));
+ if (e <= nf) {
+ return LONG2NUM((long)(VpGetSign(p) * (BDIGIT_DBL_SIGNED)p->frac[0]));
}
else {
VALUE a = BigDecimal_split(self);
@@ -670,12 +695,14 @@ BigDecimal_to_i(VALUE self)
rb_funcall(INT2FIX(10), rb_intern("**"), 1,
INT2FIX(-dpower)));
}
- else
+ else {
ret = rb_funcall(numerator, '*', 1,
rb_funcall(INT2FIX(10), rb_intern("**"), 1,
INT2FIX(dpower)));
- if (RB_TYPE_P(ret, T_FLOAT))
+ }
+ if (RB_TYPE_P(ret, T_FLOAT)) {
rb_raise(rb_eFloatDomainError, "Infinity");
+ }
return ret;
}
}
@@ -702,7 +729,7 @@ BigDecimal_to_f(VALUE self)
if (e < (SIGNED_VALUE)(DBL_MIN_10_EXP-BASE_FIG))
goto underflow;
- str = rb_str_new(0, VpNumOfChars(p,"E"));
+ str = rb_str_new(0, VpNumOfChars(p, "E"));
buf = RSTRING_PTR(str);
VpToString(p, buf, 0, 0);
errno = 0;
@@ -738,7 +765,7 @@ BigDecimal_to_r(VALUE self)
ssize_t sign, power, denomi_power;
VALUE a, digits, numerator;
- p = GetVpValue(self,1);
+ p = GetVpValue(self, 1);
BigDecimal_check_num(p);
sign = VpGetSign(p);
@@ -757,7 +784,7 @@ BigDecimal_to_r(VALUE self)
INT2FIX(-denomi_power)));
}
else {
- return rb_Rational1(rb_funcall(numerator, '*', 1,
+ return rb_Rational1(rb_funcall(numerator, '*', 1,
rb_funcall(INT2FIX(10), rb_intern("**"), 1,
INT2FIX(denomi_power))));
}
@@ -785,7 +812,8 @@ BigDecimal_coerce(VALUE self, VALUE other)
Real *b;
if (RB_TYPE_P(other, T_FLOAT)) {
- obj = rb_assoc_new(other, BigDecimal_to_f(self));
+ GUARD_OBJ(b, GetVpValueWithPrec(other, DBL_DIG+1, 1));
+ obj = rb_assoc_new(ToValue(b), self);
}
else {
if (RB_TYPE_P(other, T_RATIONAL)) {
@@ -847,7 +875,7 @@ BigDecimal_add(VALUE self, VALUE r)
b = GetVpValueWithPrec(r, a->Prec*VpBaseFig(), 1);
}
else {
- b = GetVpValue(r,0);
+ b = GetVpValue(r, 0);
}
if (!b) return DoSomeOne(self,r,'+');
@@ -874,17 +902,21 @@ BigDecimal_add(VALUE self, VALUE r)
}
/* call-seq:
- * sub(value, digits)
+ * value - digits -> bigdecimal
*
* Subtract the specified value.
*
* e.g.
- * c = a.sub(b,n)
* 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.
+ * The precision of the result value depends on the type of +b+.
+ *
+ * If +b+ is a Float, the precision of the result is Float::DIG+1.
+ *
+ * If +b+ is a BigDecimal, the precision of the result is +b+'s precision of
+ * internal representation from platform. So, it's return value is platform
+ * dependent.
+ *
*/
static VALUE
BigDecimal_sub(VALUE self, VALUE r)
@@ -893,7 +925,7 @@ BigDecimal_sub(VALUE self, VALUE r)
Real *c, *a, *b;
size_t mx;
- GUARD_OBJ(a,GetVpValue(self,1));
+ GUARD_OBJ(a, GetVpValue(self,1));
if (RB_TYPE_P(r, T_FLOAT)) {
b = GetVpValueWithPrec(r, DBL_DIG+1, 1);
}
@@ -904,23 +936,25 @@ BigDecimal_sub(VALUE self, VALUE r)
b = GetVpValue(r,0);
}
- if(!b) return DoSomeOne(self,r,'-');
+ if (!b) return DoSomeOne(self,r,'-');
SAVE(b);
- if(VpIsNaN(b)) return b->obj;
- if(VpIsNaN(a)) return a->obj;
+ if (VpIsNaN(b)) return b->obj;
+ if (VpIsNaN(a)) return a->obj;
mx = GetAddSubPrec(a,b);
if (mx == (size_t)-1L) {
- GUARD_OBJ(c,VpCreateRbObject(VpBaseFig() + 1, "0"));
- VpAddSub(c, a, b, -1);
- } else {
- GUARD_OBJ(c,VpCreateRbObject(mx *(VpBaseFig() + 1), "0"));
- if(!mx) {
- VpSetInf(c,VpGetSign(a));
- } else {
- VpAddSub(c, a, b, -1);
- }
+ GUARD_OBJ(c,VpCreateRbObject(VpBaseFig() + 1, "0"));
+ VpAddSub(c, a, b, -1);
+ }
+ else {
+ GUARD_OBJ(c,VpCreateRbObject(mx *(VpBaseFig() + 1), "0"));
+ if (!mx) {
+ VpSetInf(c,VpGetSign(a));
+ }
+ else {
+ VpAddSub(c, a, b, -1);
+ }
}
return ToValue(c);
}
@@ -931,7 +965,7 @@ BigDecimalCmp(VALUE self, VALUE r,char op)
ENTER(5);
SIGNED_VALUE e;
Real *a, *b=0;
- GUARD_OBJ(a,GetVpValue(self,1));
+ GUARD_OBJ(a, GetVpValue(self, 1));
switch (TYPE(r)) {
case T_DATA:
if (!is_kind_of_BigDecimal(r)) break;
@@ -939,7 +973,7 @@ BigDecimalCmp(VALUE self, VALUE r,char op)
case T_FIXNUM:
/* fall through */
case T_BIGNUM:
- GUARD_OBJ(b, GetVpValue(r,0));
+ GUARD_OBJ(b, GetVpValue(r, 0));
break;
case T_FLOAT:
@@ -991,23 +1025,23 @@ BigDecimalCmp(VALUE self, VALUE r,char op)
return INT2FIX(e); /* any op */
case '=':
- if(e==0) return Qtrue;
+ if (e == 0) return Qtrue;
return Qfalse;
case 'G':
- if(e>=0) return Qtrue;
+ if (e >= 0) return Qtrue;
return Qfalse;
case '>':
- if(e> 0) return Qtrue;
+ if (e > 0) return Qtrue;
return Qfalse;
case 'L':
- if(e<=0) return Qtrue;
+ if (e <= 0) return Qtrue;
return Qfalse;
case '<':
- if(e< 0) return Qtrue;
+ if (e < 0) return Qtrue;
return Qfalse;
default:
@@ -1023,7 +1057,7 @@ BigDecimalCmp(VALUE self, VALUE r,char op)
static VALUE
BigDecimal_zero(VALUE self)
{
- Real *a = GetVpValue(self,1);
+ Real *a = GetVpValue(self, 1);
return VpIsZero(a) ? Qtrue : Qfalse;
}
@@ -1031,7 +1065,7 @@ BigDecimal_zero(VALUE self)
static VALUE
BigDecimal_nonzero(VALUE self)
{
- Real *a = GetVpValue(self,1);
+ Real *a = GetVpValue(self, 1);
return VpIsZero(a) ? Qnil : self;
}
@@ -1126,8 +1160,8 @@ BigDecimal_neg(VALUE self)
{
ENTER(5);
Real *c, *a;
- GUARD_OBJ(a,GetVpValue(self,1));
- GUARD_OBJ(c,VpCreateRbObject(a->Prec *(VpBaseFig() + 1), "0"));
+ GUARD_OBJ(a, GetVpValue(self, 1));
+ GUARD_OBJ(c, VpCreateRbObject(a->Prec *(VpBaseFig() + 1), "0"));
VpAsgn(c, a, -1);
return ToValue(c);
}
@@ -1154,7 +1188,7 @@ BigDecimal_mult(VALUE self, VALUE r)
Real *c, *a, *b;
size_t mx;
- GUARD_OBJ(a,GetVpValue(self,1));
+ GUARD_OBJ(a, GetVpValue(self, 1));
if (RB_TYPE_P(r, T_FLOAT)) {
b = GetVpValueWithPrec(r, DBL_DIG+1, 1);
}
@@ -1165,11 +1199,11 @@ BigDecimal_mult(VALUE self, VALUE r)
b = GetVpValue(r,0);
}
- if(!b) return DoSomeOne(self,r,'*');
+ if (!b) return DoSomeOne(self, r, '*');
SAVE(b);
mx = a->Prec + b->Prec;
- GUARD_OBJ(c,VpCreateRbObject(mx *(VpBaseFig() + 1), "0"));
+ GUARD_OBJ(c, VpCreateRbObject(mx *(VpBaseFig() + 1), "0"));
VpMult(c, a, b);
return ToValue(c);
}
@@ -1182,28 +1216,30 @@ BigDecimal_divide(Real **c, Real **res, Real **div, VALUE self, VALUE r)
Real *a, *b;
size_t mx;
- GUARD_OBJ(a,GetVpValue(self,1));
+ GUARD_OBJ(a, GetVpValue(self, 1));
if (RB_TYPE_P(r, T_FLOAT)) {
b = GetVpValueWithPrec(r, DBL_DIG+1, 1);
}
else if (RB_TYPE_P(r, T_RATIONAL)) {
b = GetVpValueWithPrec(r, a->Prec*VpBaseFig(), 1);
- }
+ }
else {
- b = GetVpValue(r,0);
+ b = GetVpValue(r, 0);
}
- if(!b) return DoSomeOne(self,r,'/');
+ if (!b) return DoSomeOne(self, r, '/');
SAVE(b);
*div = b;
mx = a->Prec + vabs(a->exponent);
- 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"));
+ 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();
+ GUARD_OBJ((*c), VpCreateRbObject(mx, "#0"));
+ GUARD_OBJ((*res), VpCreateRbObject((mx+1) * 2 +(VpBaseFig() + 1), "#0"));
VpDivd(*c, *res, a, b);
- return (VALUE)0;
+ return Qnil;
}
/* call-seq:
@@ -1232,15 +1268,15 @@ BigDecimal_div(VALUE self, VALUE r)
ENTER(5);
Real *c=NULL, *res=NULL, *div = NULL;
r = BigDecimal_divide(&c, &res, &div, self, r);
- if(r!=(VALUE)0) return r; /* coerced by other */
- SAVE(c);SAVE(res);SAVE(div);
+ if (!NIL_P(r)) return r; /* coerced by other */
+ SAVE(c); SAVE(res); SAVE(div);
/* a/b = c + r/b */
/* c xxxxx
r 00000yyyyy ==> (y/b)*BASE >= HALF_BASE
*/
/* Round */
- if(VpHasVal(div)) { /* frac[0] must be zero for NaN,INF,Zero */
- VpInternalRound(c, 0, c->frac[c->Prec-1], (BDIGIT)(VpBaseVal()*(BDIGIT_DBL)res->frac[0]/div->frac[0]));
+ if (VpHasVal(div)) { /* frac[0] must be zero for NaN,INF,Zero */
+ VpInternalRound(c, 0, c->frac[c->Prec-1], (BDIGIT)(VpBaseVal() * (BDIGIT_DBL)res->frac[0] / div->frac[0]));
}
return ToValue(c);
}
@@ -1257,7 +1293,7 @@ BigDecimal_DoDivmod(VALUE self, VALUE r, Real **div, Real **mod)
Real *a, *b;
size_t mx;
- GUARD_OBJ(a,GetVpValue(self,1));
+ GUARD_OBJ(a, GetVpValue(self, 1));
if (RB_TYPE_P(r, T_FLOAT)) {
b = GetVpValueWithPrec(r, DBL_DIG+1, 1);
}
@@ -1265,65 +1301,65 @@ BigDecimal_DoDivmod(VALUE self, VALUE r, Real **div, Real **mod)
b = GetVpValueWithPrec(r, a->Prec*VpBaseFig(), 1);
}
else {
- b = GetVpValue(r,0);
+ b = GetVpValue(r, 0);
}
- if(!b) return Qfalse;
+ if (!b) return Qfalse;
SAVE(b);
- if(VpIsNaN(a) || VpIsNaN(b)) goto NaN;
- if(VpIsInf(a) && VpIsInf(b)) goto NaN;
- if(VpIsZero(b)) {
+ if (VpIsNaN(a) || VpIsNaN(b)) goto NaN;
+ if (VpIsInf(a) && VpIsInf(b)) goto NaN;
+ if (VpIsZero(b)) {
rb_raise(rb_eZeroDivError, "divided by 0");
}
- if(VpIsInf(a)) {
- GUARD_OBJ(d,VpCreateRbObject(1, "0"));
- VpSetInf(d, (SIGNED_VALUE)(VpGetSign(a) == VpGetSign(b) ? 1 : -1));
- GUARD_OBJ(c,VpCreateRbObject(1, "NaN"));
- *div = d;
- *mod = c;
- return Qtrue;
+ if (VpIsInf(a)) {
+ GUARD_OBJ(d, VpCreateRbObject(1, "0"));
+ VpSetInf(d, (SIGNED_VALUE)(VpGetSign(a) == VpGetSign(b) ? 1 : -1));
+ GUARD_OBJ(c, VpCreateRbObject(1, "NaN"));
+ *div = d;
+ *mod = c;
+ return Qtrue;
}
- if(VpIsInf(b)) {
- GUARD_OBJ(d,VpCreateRbObject(1, "0"));
- *div = d;
- *mod = a;
- return Qtrue;
+ if (VpIsInf(b)) {
+ GUARD_OBJ(d, VpCreateRbObject(1, "0"));
+ *div = d;
+ *mod = a;
+ return Qtrue;
}
- if(VpIsZero(a)) {
- GUARD_OBJ(c,VpCreateRbObject(1, "0"));
- GUARD_OBJ(d,VpCreateRbObject(1, "0"));
- *div = d;
- *mod = c;
- return Qtrue;
+ if (VpIsZero(a)) {
+ GUARD_OBJ(c, VpCreateRbObject(1, "0"));
+ GUARD_OBJ(d, VpCreateRbObject(1, "0"));
+ *div = d;
+ *mod = c;
+ return Qtrue;
}
mx = a->Prec + vabs(a->exponent);
- 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"));
+ 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);
- mx = c->Prec *(VpBaseFig() + 1);
- GUARD_OBJ(d,VpCreateRbObject(mx, "0"));
- VpActiveRound(d,c,VP_ROUND_DOWN,0);
- VpMult(res,d,b);
- VpAddSub(c,a,res,-1);
- if(!VpIsZero(c) && (VpGetSign(a)*VpGetSign(b)<0)) {
- VpAddSub(res,d,VpOne(),-1);
- GUARD_OBJ(d,VpCreateRbObject(GetAddSubPrec(c, b)*(VpBaseFig() + 1), "0"));
- VpAddSub(d ,c,b, 1);
- *div = res;
- *mod = d;
+ mx = c->Prec * (VpBaseFig() + 1);
+ GUARD_OBJ(d, VpCreateRbObject(mx, "0"));
+ VpActiveRound(d, c, VP_ROUND_DOWN, 0);
+ VpMult(res, d, b);
+ VpAddSub(c, a, res, -1);
+ if (!VpIsZero(c) && (VpGetSign(a) * VpGetSign(b) < 0)) {
+ VpAddSub(res, d, VpOne(), -1);
+ GUARD_OBJ(d, VpCreateRbObject(GetAddSubPrec(c, b)*(VpBaseFig() + 1), "0"));
+ VpAddSub(d, c, b, 1);
+ *div = res;
+ *mod = d;
} else {
- *div = d;
- *mod = c;
+ *div = d;
+ *mod = c;
}
return Qtrue;
NaN:
- GUARD_OBJ(c,VpCreateRbObject(1, "NaN"));
- GUARD_OBJ(d,VpCreateRbObject(1, "NaN"));
+ GUARD_OBJ(c, VpCreateRbObject(1, "NaN"));
+ GUARD_OBJ(d, VpCreateRbObject(1, "NaN"));
*div = d;
*mod = c;
return Qtrue;
@@ -1341,13 +1377,13 @@ static VALUE
BigDecimal_mod(VALUE self, VALUE r) /* %: a%b = a - (a.to_f/b).floor * b */
{
ENTER(3);
- Real *div=NULL, *mod=NULL;
+ Real *div = NULL, *mod = NULL;
- if(BigDecimal_DoDivmod(self,r,&div,&mod)) {
+ if (BigDecimal_DoDivmod(self, r, &div, &mod)) {
SAVE(div); SAVE(mod);
return ToValue(mod);
}
- return DoSomeOne(self,r,'%');
+ return DoSomeOne(self, r, '%');
}
static VALUE
@@ -1355,10 +1391,10 @@ BigDecimal_divremain(VALUE self, VALUE r, Real **dv, Real **rv)
{
ENTER(10);
size_t mx;
- Real *a=NULL, *b=NULL, *c=NULL, *res=NULL, *d=NULL, *rr=NULL, *ff=NULL;
- Real *f=NULL;
+ Real *a = NULL, *b = NULL, *c = NULL, *res = NULL, *d = NULL, *rr = NULL, *ff = NULL;
+ Real *f = NULL;
- GUARD_OBJ(a,GetVpValue(self,1));
+ GUARD_OBJ(a, GetVpValue(self, 1));
if (RB_TYPE_P(r, T_FLOAT)) {
b = GetVpValueWithPrec(r, DBL_DIG+1, 1);
}
@@ -1366,34 +1402,34 @@ BigDecimal_divremain(VALUE self, VALUE r, Real **dv, Real **rv)
b = GetVpValueWithPrec(r, a->Prec*VpBaseFig(), 1);
}
else {
- b = GetVpValue(r,0);
+ b = GetVpValue(r, 0);
}
- if(!b) return DoSomeOne(self,r,rb_intern("remainder"));
+ if (!b) return DoSomeOne(self, r, rb_intern("remainder"));
SAVE(b);
- mx =(a->MaxPrec + b->MaxPrec) *VpBaseFig();
- GUARD_OBJ(c ,VpCreateRbObject(mx, "0"));
- GUARD_OBJ(res,VpCreateRbObject((mx+1) * 2 +(VpBaseFig() + 1), "#0"));
- GUARD_OBJ(rr ,VpCreateRbObject((mx+1) * 2 +(VpBaseFig() + 1), "#0"));
- GUARD_OBJ(ff ,VpCreateRbObject((mx+1) * 2 +(VpBaseFig() + 1), "#0"));
+ mx = (a->MaxPrec + b->MaxPrec) *VpBaseFig();
+ GUARD_OBJ(c, VpCreateRbObject(mx, "0"));
+ GUARD_OBJ(res, VpCreateRbObject((mx+1) * 2 + (VpBaseFig() + 1), "#0"));
+ GUARD_OBJ(rr, VpCreateRbObject((mx+1) * 2 + (VpBaseFig() + 1), "#0"));
+ GUARD_OBJ(ff, VpCreateRbObject((mx+1) * 2 + (VpBaseFig() + 1), "#0"));
VpDivd(c, res, a, b);
mx = c->Prec *(VpBaseFig() + 1);
- GUARD_OBJ(d,VpCreateRbObject(mx, "0"));
- GUARD_OBJ(f,VpCreateRbObject(mx, "0"));
+ GUARD_OBJ(d, VpCreateRbObject(mx, "0"));
+ GUARD_OBJ(f, VpCreateRbObject(mx, "0"));
- VpActiveRound(d,c,VP_ROUND_DOWN,0); /* 0: round off */
+ VpActiveRound(d, c, VP_ROUND_DOWN, 0); /* 0: round off */
VpFrac(f, c);
- VpMult(rr,f,b);
- VpAddSub(ff,res,rr,1);
+ VpMult(rr, f, b);
+ VpAddSub(ff, res, rr, 1);
*dv = d;
*rv = ff;
- return (VALUE)0;
+ return Qnil;
}
/* Returns the remainder from dividing by the value.
@@ -1404,9 +1440,9 @@ static VALUE
BigDecimal_remainder(VALUE self, VALUE r) /* remainder */
{
VALUE f;
- Real *d,*rv=0;
- f = BigDecimal_divremain(self,r,&d,&rv);
- if(f!=(VALUE)0) return f;
+ Real *d, *rv = 0;
+ f = BigDecimal_divremain(self, r, &d, &rv);
+ if (!NIL_P(f)) return f;
return ToValue(rv);
}
@@ -1433,9 +1469,9 @@ static VALUE
BigDecimal_divmod(VALUE self, VALUE r)
{
ENTER(5);
- Real *div=NULL, *mod=NULL;
+ Real *div = NULL, *mod = NULL;
- if(BigDecimal_DoDivmod(self,r,&div,&mod)) {
+ if (BigDecimal_DoDivmod(self, r, &div, &mod)) {
SAVE(div); SAVE(mod);
return rb_assoc_new(ToValue(div), ToValue(mod));
}
@@ -1445,59 +1481,85 @@ BigDecimal_divmod(VALUE self, VALUE r)
/*
* See BigDecimal#quo
*/
-static VALUE
-BigDecimal_div2(int argc, VALUE *argv, VALUE self)
+static inline VALUE
+BigDecimal_div2(VALUE self, VALUE b, VALUE n)
{
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);
-
- 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);
- }
+ 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)
+{
+ VALUE b,n;
+
+ rb_scan_args(argc, argv, "11", &b, &n);
+
+ return BigDecimal_div2(self, b, n);
+}
+
+static VALUE
BigDecimal_add2(VALUE self, VALUE b, VALUE n)
{
ENTER(2);
- Real *cv;
+ Real *cv;
SIGNED_VALUE mx = GetPositiveInt(n);
if (mx == 0) return BigDecimal_add(self, b);
else {
- size_t pl = VpSetPrecLimit(0);
- VALUE c = BigDecimal_add(self,b);
- VpSetPrecLimit(pl);
- GUARD_OBJ(cv,GetVpValue(c,1));
- VpLeftRound(cv,VpGetRoundMode(),mx);
- return ToValue(cv);
+ size_t pl = VpSetPrecLimit(0);
+ VALUE c = BigDecimal_add(self, b);
+ VpSetPrecLimit(pl);
+ GUARD_OBJ(cv, GetVpValue(c, 1));
+ VpLeftRound(cv, VpGetRoundMode(), mx);
+ return ToValue(cv);
}
}
+/*
+ * sub(value, digits) -> bigdecimal
+ *
+ * Subtract the specified value.
+ *
+ * e.g.
+ * 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.
+ *
+ */
static VALUE
BigDecimal_sub2(VALUE self, VALUE b, VALUE n)
{
@@ -1506,15 +1568,16 @@ BigDecimal_sub2(VALUE self, VALUE b, VALUE n)
SIGNED_VALUE mx = GetPositiveInt(n);
if (mx == 0) return BigDecimal_sub(self, b);
else {
- size_t pl = VpSetPrecLimit(0);
- VALUE c = BigDecimal_sub(self,b);
- VpSetPrecLimit(pl);
- GUARD_OBJ(cv,GetVpValue(c,1));
- VpLeftRound(cv,VpGetRoundMode(),mx);
- return ToValue(cv);
+ size_t pl = VpSetPrecLimit(0);
+ VALUE c = BigDecimal_sub(self, b);
+ VpSetPrecLimit(pl);
+ GUARD_OBJ(cv, GetVpValue(c, 1));
+ VpLeftRound(cv, VpGetRoundMode(), mx);
+ return ToValue(cv);
}
}
+
static VALUE
BigDecimal_mult2(VALUE self, VALUE b, VALUE n)
{
@@ -1523,12 +1586,12 @@ BigDecimal_mult2(VALUE self, VALUE b, VALUE n)
SIGNED_VALUE mx = GetPositiveInt(n);
if (mx == 0) return BigDecimal_mult(self, b);
else {
- size_t pl = VpSetPrecLimit(0);
- VALUE c = BigDecimal_mult(self,b);
- VpSetPrecLimit(pl);
- GUARD_OBJ(cv,GetVpValue(c,1));
- VpLeftRound(cv,VpGetRoundMode(),mx);
- return ToValue(cv);
+ size_t pl = VpSetPrecLimit(0);
+ VALUE c = BigDecimal_mult(self, b);
+ VpSetPrecLimit(pl);
+ GUARD_OBJ(cv, GetVpValue(c, 1));
+ VpLeftRound(cv, VpGetRoundMode(), mx);
+ return ToValue(cv);
}
}
@@ -1545,9 +1608,9 @@ BigDecimal_abs(VALUE self)
Real *c, *a;
size_t mx;
- GUARD_OBJ(a,GetVpValue(self,1));
+ GUARD_OBJ(a, GetVpValue(self, 1));
mx = a->Prec *(VpBaseFig() + 1);
- GUARD_OBJ(c,VpCreateRbObject(mx, "0"));
+ GUARD_OBJ(c, VpCreateRbObject(mx, "0"));
VpAsgn(c, a, 1);
VpChangeSign(c, 1);
return ToValue(c);
@@ -1567,12 +1630,12 @@ BigDecimal_sqrt(VALUE self, VALUE nFig)
Real *c, *a;
size_t mx, n;
- GUARD_OBJ(a,GetVpValue(self,1));
- mx = a->Prec *(VpBaseFig() + 1);
+ GUARD_OBJ(a, GetVpValue(self, 1));
+ mx = a->Prec * (VpBaseFig() + 1);
- n = GetPositiveInt(nFig) + VpDblFig() + 1;
- if(mx <= n) mx = n;
- GUARD_OBJ(c,VpCreateRbObject(mx, "0"));
+ n = GetPositiveInt(nFig) + VpDblFig() + BASE_FIG;
+ if (mx <= n) mx = n;
+ GUARD_OBJ(c, VpCreateRbObject(mx, "0"));
VpSqrt(c, a);
return ToValue(c);
}
@@ -1586,10 +1649,10 @@ BigDecimal_fix(VALUE self)
Real *c, *a;
size_t mx;
- GUARD_OBJ(a,GetVpValue(self,1));
+ GUARD_OBJ(a, GetVpValue(self, 1));
mx = a->Prec *(VpBaseFig() + 1);
- GUARD_OBJ(c,VpCreateRbObject(mx, "0"));
- VpActiveRound(c,a,VP_ROUND_DOWN,0); /* 0: round off */
+ GUARD_OBJ(c, VpCreateRbObject(mx, "0"));
+ VpActiveRound(c, a, VP_ROUND_DOWN, 0); /* 0: round off */
return ToValue(c);
}
@@ -1626,26 +1689,28 @@ BigDecimal_round(int argc, VALUE *argv, VALUE self)
unsigned short sw = VpGetRoundMode();
switch (rb_scan_args(argc, argv, "02", &vLoc, &vRound)) {
- case 0:
- iLoc = 0;
- break;
- case 1:
- Check_Type(vLoc, T_FIXNUM);
- iLoc = FIX2INT(vLoc);
- break;
- case 2:
+ case 0:
+ iLoc = 0;
+ break;
+ case 1:
+ Check_Type(vLoc, T_FIXNUM);
+ iLoc = FIX2INT(vLoc);
+ break;
+ case 2:
Check_Type(vLoc, T_FIXNUM);
iLoc = FIX2INT(vLoc);
sw = check_rounding_mode(vRound);
break;
+ default:
+ break;
}
pl = VpSetPrecLimit(0);
- GUARD_OBJ(a,GetVpValue(self,1));
- mx = a->Prec *(VpBaseFig() + 1);
- GUARD_OBJ(c,VpCreateRbObject(mx, "0"));
+ GUARD_OBJ(a, GetVpValue(self, 1));
+ mx = a->Prec * (VpBaseFig() + 1);
+ GUARD_OBJ(c, VpCreateRbObject(mx, "0"));
VpSetPrecLimit(pl);
- VpActiveRound(c,a,sw,iLoc);
+ VpActiveRound(c, a, sw, iLoc);
if (argc == 0) {
return BigDecimal_to_i(ToValue(c));
}
@@ -1678,18 +1743,19 @@ BigDecimal_truncate(int argc, VALUE *argv, VALUE self)
VALUE vLoc;
size_t mx, pl = VpSetPrecLimit(0);
- if(rb_scan_args(argc,argv,"01",&vLoc)==0) {
- iLoc = 0;
- } else {
- Check_Type(vLoc, T_FIXNUM);
- iLoc = FIX2INT(vLoc);
+ if (rb_scan_args(argc, argv, "01", &vLoc) == 0) {
+ iLoc = 0;
+ }
+ else {
+ Check_Type(vLoc, T_FIXNUM);
+ iLoc = FIX2INT(vLoc);
}
- GUARD_OBJ(a,GetVpValue(self,1));
- mx = a->Prec *(VpBaseFig() + 1);
- GUARD_OBJ(c,VpCreateRbObject(mx, "0"));
+ GUARD_OBJ(a, GetVpValue(self, 1));
+ mx = a->Prec * (VpBaseFig() + 1);
+ GUARD_OBJ(c, VpCreateRbObject(mx, "0"));
VpSetPrecLimit(pl);
- VpActiveRound(c,a,VP_ROUND_DOWN,iLoc); /* 0: truncate */
+ VpActiveRound(c, a, VP_ROUND_DOWN, iLoc); /* 0: truncate */
if (argc == 0) {
return BigDecimal_to_i(ToValue(c));
}
@@ -1705,9 +1771,9 @@ BigDecimal_frac(VALUE self)
Real *c, *a;
size_t mx;
- GUARD_OBJ(a,GetVpValue(self,1));
- mx = a->Prec *(VpBaseFig() + 1);
- GUARD_OBJ(c,VpCreateRbObject(mx, "0"));
+ GUARD_OBJ(a, GetVpValue(self, 1));
+ mx = a->Prec * (VpBaseFig() + 1);
+ GUARD_OBJ(c, VpCreateRbObject(mx, "0"));
VpFrac(c, a);
return ToValue(c);
}
@@ -1738,18 +1804,19 @@ BigDecimal_floor(int argc, VALUE *argv, VALUE self)
VALUE vLoc;
size_t mx, pl = VpSetPrecLimit(0);
- if(rb_scan_args(argc,argv,"01",&vLoc)==0) {
- iLoc = 0;
- } else {
- Check_Type(vLoc, T_FIXNUM);
- iLoc = FIX2INT(vLoc);
+ if (rb_scan_args(argc, argv, "01", &vLoc)==0) {
+ iLoc = 0;
+ }
+ else {
+ Check_Type(vLoc, T_FIXNUM);
+ iLoc = FIX2INT(vLoc);
}
- GUARD_OBJ(a,GetVpValue(self,1));
- mx = a->Prec *(VpBaseFig() + 1);
- GUARD_OBJ(c,VpCreateRbObject(mx, "0"));
+ GUARD_OBJ(a, GetVpValue(self, 1));
+ mx = a->Prec * (VpBaseFig() + 1);
+ GUARD_OBJ(c, VpCreateRbObject(mx, "0"));
VpSetPrecLimit(pl);
- VpActiveRound(c,a,VP_ROUND_FLOOR,iLoc);
+ VpActiveRound(c, a, VP_ROUND_FLOOR, iLoc);
#ifdef BIGDECIMAL_DEBUG
VPrint(stderr, "floor: c=%\n", c);
#endif
@@ -1785,18 +1852,18 @@ BigDecimal_ceil(int argc, VALUE *argv, VALUE self)
VALUE vLoc;
size_t mx, pl = VpSetPrecLimit(0);
- if(rb_scan_args(argc,argv,"01",&vLoc)==0) {
- iLoc = 0;
+ if (rb_scan_args(argc, argv, "01", &vLoc) == 0) {
+ iLoc = 0;
} else {
- Check_Type(vLoc, T_FIXNUM);
- iLoc = FIX2INT(vLoc);
+ Check_Type(vLoc, T_FIXNUM);
+ iLoc = FIX2INT(vLoc);
}
- GUARD_OBJ(a,GetVpValue(self,1));
- mx = a->Prec *(VpBaseFig() + 1);
- GUARD_OBJ(c,VpCreateRbObject(mx, "0"));
+ GUARD_OBJ(a, GetVpValue(self, 1));
+ mx = a->Prec * (VpBaseFig() + 1);
+ GUARD_OBJ(c, VpCreateRbObject(mx, "0"));
VpSetPrecLimit(pl);
- VpActiveRound(c,a,VP_ROUND_CEIL,iLoc);
+ VpActiveRound(c, a, VP_ROUND_CEIL, iLoc);
if (argc == 0) {
return BigDecimal_to_i(ToValue(c));
}
@@ -1849,9 +1916,9 @@ BigDecimal_to_s(int argc, VALUE *argv, VALUE self)
size_t nc, mc = 0;
VALUE f;
- GUARD_OBJ(vp,GetVpValue(self,1));
+ GUARD_OBJ(vp, GetVpValue(self, 1));
- if (rb_scan_args(argc,argv,"01",&f)==1) {
+ if (rb_scan_args(argc, argv, "01", &f) == 1) {
if (RB_TYPE_P(f, T_STRING)) {
SafeStringValue(f);
psz = RSTRING_PTR(f);
@@ -1873,7 +1940,7 @@ BigDecimal_to_s(int argc, VALUE *argv, VALUE self)
}
break;
}
- mc = mc * 10 + ch - '0';
+ mc = mc*10 + ch - '0';
}
}
else {
@@ -1936,21 +2003,21 @@ BigDecimal_split(VALUE self)
ssize_t e, s;
char *psz1;
- GUARD_OBJ(vp,GetVpValue(self,1));
- str = rb_str_new(0, VpNumOfChars(vp,"E"));
+ GUARD_OBJ(vp, GetVpValue(self, 1));
+ str = rb_str_new(0, VpNumOfChars(vp, "E"));
psz1 = RSTRING_PTR(str);
- VpSzMantissa(vp,psz1);
+ VpSzMantissa(vp, psz1);
s = 1;
- if(psz1[0]=='-') {
- size_t len = strlen(psz1+1);
+ if(psz1[0] == '-') {
+ size_t len = strlen(psz1 + 1);
- memmove(psz1, psz1+1, len);
+ memmove(psz1, psz1 + 1, len);
psz1[len] = '\0';
s = -1;
}
- if(psz1[0]=='N') s=0; /* NaN */
+ if (psz1[0] == 'N') s = 0; /* NaN */
e = VpExponent10(vp);
- obj = rb_ary_new2(4);
+ obj = rb_ary_new2(4);
rb_ary_push(obj, INT2FIX(s));
rb_ary_push(obj, str);
rb_str_resize(str, strlen(psz1));
@@ -1990,13 +2057,13 @@ BigDecimal_inspect(VALUE self)
size_t nc;
char *psz, *tmp;
- GUARD_OBJ(vp,GetVpValue(self,1));
- nc = VpNumOfChars(vp,"E");
- nc +=(nc + 9) / 10;
+ GUARD_OBJ(vp, GetVpValue(self, 1));
+ nc = VpNumOfChars(vp, "E");
+ nc += (nc + 9) / 10;
obj = rb_str_new(0, nc+256);
psz = RSTRING_PTR(obj);
- sprintf(psz,"#<BigDecimal:%"PRIxVALUE",'",self);
+ sprintf(psz, "#<BigDecimal:%"PRIxVALUE",'", self);
tmp = psz + strlen(psz);
VpToString(vp, tmp, 10, 0);
tmp += strlen(tmp);
@@ -2024,7 +2091,7 @@ is_negative(VALUE x)
return FIX2LONG(x) < 0;
}
else if (RB_TYPE_P(x, T_BIGNUM)) {
- return RBIGNUM_NEGATIVE_P(x);
+ return FIX2INT(rb_big_cmp(x, INT2FIX(0))) < 0;
}
else if (RB_TYPE_P(x, T_FLOAT)) {
return RFLOAT_VALUE(x) < 0.0;
@@ -2047,7 +2114,7 @@ is_zero(VALUE x)
return Qfalse;
case T_RATIONAL:
- num = RRATIONAL(x)->num;
+ num = rb_rational_num(x);
return FIXNUM_P(num) && FIX2LONG(num) == 0;
default:
@@ -2070,8 +2137,8 @@ is_one(VALUE x)
return Qfalse;
case T_RATIONAL:
- num = RRATIONAL(x)->num;
- den = RRATIONAL(x)->den;
+ num = rb_rational_num(x);
+ den = rb_rational_den(x);
return FIXNUM_P(den) && FIX2LONG(den) == 1 &&
FIXNUM_P(num) && FIX2LONG(num) == 1;
@@ -2090,7 +2157,11 @@ is_even(VALUE x)
return (FIX2LONG(x) % 2) == 0;
case T_BIGNUM:
- return (RBIGNUM_DIGITS(x)[0] % 2) == 0;
+ {
+ unsigned long l;
+ rb_big_pack(x, &l, 1);
+ return l % 2 == 0;
+ }
default:
break;
@@ -2150,7 +2221,7 @@ BigDecimal_power(int argc, VALUE*argv, VALUE self)
return ToValue(y);
}
-retry:
+ retry:
switch (TYPE(vexp)) {
case T_FIXNUM:
break;
@@ -2161,21 +2232,26 @@ retry:
case T_FLOAT:
d = RFLOAT_VALUE(vexp);
if (d == round(d)) {
- vexp = LL2NUM((LONG_LONG)round(d));
+ if (FIXABLE(d)) {
+ vexp = LONG2FIX((long)d);
+ }
+ else {
+ vexp = rb_dbl2big(d);
+ }
goto retry;
}
exp = GetVpValueWithPrec(vexp, DBL_DIG+1, 1);
break;
case T_RATIONAL:
- if (is_zero(RRATIONAL(vexp)->num)) {
+ if (is_zero(rb_rational_num(vexp))) {
if (is_positive(vexp)) {
vexp = INT2FIX(0);
goto retry;
}
}
- else if (is_one(RRATIONAL(vexp)->den)) {
- vexp = RRATIONAL(vexp)->num;
+ else if (is_one(rb_rational_den(vexp))) {
+ vexp = rb_rational_num(vexp);
goto retry;
}
exp = GetVpValueWithPrec(vexp, n, 1);
@@ -2195,8 +2271,8 @@ retry:
/* fall through */
default:
rb_raise(rb_eTypeError,
- "wrong argument type %s (expected scalar Numeric)",
- rb_obj_classname(vexp));
+ "wrong argument type %"PRIsVALUE" (expected scalar Numeric)",
+ RB_OBJ_CLASSNAME(vexp));
}
if (VpIsZero(x)) {
@@ -2332,19 +2408,22 @@ retry:
}
}
- int_exp = FIX2INT(vexp);
+ int_exp = FIX2LONG(vexp);
ma = int_exp;
- if (ma < 0) ma = -ma;
+ if (ma < 0) ma = -ma;
if (ma == 0) ma = 1;
if (VpIsDef(x)) {
- mp = x->Prec * (VpBaseFig() + 1);
- GUARD_OBJ(y, VpCreateRbObject(mp * (ma + 1), "0"));
+ mp = x->Prec * (VpBaseFig() + 1);
+ GUARD_OBJ(y, VpCreateRbObject(mp * (ma + 1), "0"));
}
else {
- GUARD_OBJ(y, VpCreateRbObject(1, "0"));
+ GUARD_OBJ(y, VpCreateRbObject(1, "0"));
}
VpPower(y, x, int_exp);
+ if (!NIL_P(prec) && VpIsDef(y)) {
+ VpMidRound(y, VpGetRoundMode(), n);
+ }
return ToValue(y);
}
@@ -2384,13 +2463,28 @@ 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 = BigDecimal_new(argc, argv);
+ Real *x;
+ GUARD_OBJ(x, BigDecimal_new(argc, argv));
if (ToValue(x)) {
pv = VpCopy(pv, x);
}
@@ -2413,7 +2507,9 @@ 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);
- DATA_PTR(self) = VpCopy(pv, x);
+ if (self != other) {
+ DATA_PTR(self) = VpCopy(pv, x);
+ }
return self;
}
@@ -2451,8 +2547,8 @@ BigDecimal_new(int argc, VALUE *argv)
case T_RATIONAL:
if (NIL_P(nFig)) {
rb_raise(rb_eArgError,
- "can't omit precision for a %s.",
- rb_class2name(CLASS_OF(iniValue)));
+ "can't omit precision for a %"PRIsVALUE".",
+ RB_OBJ_CLASSNAME(iniValue));
}
return GetVpValueWithPrec(iniValue, mf, 1);
@@ -2465,10 +2561,14 @@ BigDecimal_new(int argc, VALUE *argv)
return VpAlloc(mf, RSTRING_PTR(iniValue));
}
+/* See also BigDecimal.new */
static VALUE
BigDecimal_global_new(int argc, VALUE *argv, VALUE self)
{
- Real *pv = BigDecimal_new(argc, argv);
+ ENTER(1);
+ Real *pv;
+
+ GUARD_OBJ(pv, BigDecimal_new(argc, argv));
if (ToValue(pv)) pv = VpCopy(NULL, pv);
pv->obj = TypedData_Wrap_Struct(rb_cBigDecimal, &BigDecimal_data_type, pv);
return pv->obj;
@@ -2492,15 +2592,15 @@ BigDecimal_limit(int argc, VALUE *argv, VALUE self)
VALUE nFig;
VALUE nCur = INT2NUM(VpGetPrecLimit());
- if(rb_scan_args(argc,argv,"01",&nFig)==1) {
- int nf;
- if(nFig==Qnil) return nCur;
- Check_Type(nFig, T_FIXNUM);
- nf = FIX2INT(nFig);
- if(nf<0) {
- rb_raise(rb_eArgError, "argument must be positive");
- }
- VpSetPrecLimit(nf);
+ if (rb_scan_args(argc, argv, "01", &nFig) == 1) {
+ int nf;
+ if (NIL_P(nFig)) return nCur;
+ Check_Type(nFig, T_FIXNUM);
+ nf = FIX2INT(nFig);
+ if (nf < 0) {
+ rb_raise(rb_eArgError, "argument must be positive");
+ }
+ VpSetPrecLimit(nf);
}
return nCur;
}
@@ -2516,22 +2616,22 @@ BigDecimal_limit(int argc, VALUE *argv, VALUE self)
* BigDecimal::SIGN_NaN:: value is Not a Number
* BigDecimal::SIGN_POSITIVE_ZERO:: value is +0
* BigDecimal::SIGN_NEGATIVE_ZERO:: value is -0
- * BigDecimal::SIGN_POSITIVE_INFINITE:: value is +infinity
- * BigDecimal::SIGN_NEGATIVE_INFINITE:: value is -infinity
+ * BigDecimal::SIGN_POSITIVE_INFINITE:: value is +Infinity
+ * BigDecimal::SIGN_NEGATIVE_INFINITE:: value is -Infinity
* BigDecimal::SIGN_POSITIVE_FINITE:: value is positive
* BigDecimal::SIGN_NEGATIVE_FINITE:: value is negative
*/
static VALUE
BigDecimal_sign(VALUE self)
{ /* sign */
- int s = GetVpValue(self,1)->sign;
+ int s = GetVpValue(self, 1)->sign;
return INT2FIX(s);
}
/*
* call-seq: BigDecimal.save_exception_mode { ... }
*
- * Excecute the provided block, but preserve the exception mode
+ * Execute the provided block, but preserve the exception mode
*
* BigDecimal.save_exception_mode do
* BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, false)
@@ -2560,9 +2660,9 @@ BigDecimal_save_exception_mode(VALUE self)
/*
* call-seq: BigDecimal.save_rounding_mode { ... }
*
- * Excecute the provided block, but preserve the rounding mode
+ * Execute the provided block, but preserve the rounding mode
*
- * BigDecimal.save_exception_mode do
+ * BigDecimal.save_rounding_mode do
* BigDecimal.mode(BigDecimal::ROUND_MODE, :up)
* puts BigDecimal.mode(BigDecimal::ROUND_MODE)
* end
@@ -2585,7 +2685,7 @@ BigDecimal_save_rounding_mode(VALUE self)
/*
* call-seq: BigDecimal.save_limit { ... }
*
- * Excecute the provided block, but preserve the precision limit
+ * Execute the provided block, but preserve the precision limit
*
* BigDecimal.limit(100)
* puts BigDecimal.limit
@@ -2608,21 +2708,21 @@ BigDecimal_save_limit(VALUE self)
}
/* call-seq:
- * BigMath.exp(x, prec)
+ * BigMath.exp(decimal, numeric) -> BigDecimal
*
* Computes the value of e (the base of natural logarithms) raised to the
- * power of x, to the specified number of digits of precision.
+ * power of +decimal+, to the specified number of digits of precision.
*
- * If x is infinity, returns Infinity.
+ * If +decimal+ is infinity, returns Infinity.
*
- * If x is NaN, returns NaN.
+ * If +decimal+ is NaN, returns NaN.
*/
static VALUE
BigMath_s_exp(VALUE klass, VALUE x, VALUE vprec)
{
ssize_t prec, n, i;
Real* vx = NULL;
- VALUE one, d, x1, y, z;
+ VALUE one, d, y;
int negative = 0;
int infinite = 0;
int nan = 0;
@@ -2637,18 +2737,18 @@ BigMath_s_exp(VALUE klass, VALUE x, VALUE vprec)
* BigDecimalCmp function. */
switch (TYPE(x)) {
case T_DATA:
- if (!is_kind_of_BigDecimal(x)) break;
- vx = DATA_PTR(x);
- negative = VpGetSign(vx) < 0;
- infinite = VpIsPosInf(vx) || VpIsNegInf(vx);
- nan = VpIsNaN(vx);
- break;
+ if (!is_kind_of_BigDecimal(x)) break;
+ vx = DATA_PTR(x);
+ negative = VpGetSign(vx) < 0;
+ infinite = VpIsPosInf(vx) || VpIsNegInf(vx);
+ nan = VpIsNaN(vx);
+ break;
case T_FIXNUM:
- /* fall through */
+ /* fall through */
case T_BIGNUM:
- vx = GetVpValue(x, 0);
- break;
+ vx = GetVpValue(x, 0);
+ break;
case T_FLOAT:
flo = RFLOAT_VALUE(x);
@@ -2669,27 +2769,27 @@ BigMath_s_exp(VALUE klass, VALUE x, VALUE vprec)
}
if (infinite) {
if (negative) {
- return ToValue(GetVpValueWithPrec(INT2NUM(0), prec, 1));
+ return ToValue(GetVpValueWithPrec(INT2FIX(0), prec, 1));
}
else {
Real* vy;
vy = VpCreateRbObject(prec, "#0");
- RB_GC_GUARD(vy->obj);
VpSetInf(vy, VP_SIGN_POSITIVE_INFINITE);
+ RB_GC_GUARD(vy->obj);
return ToValue(vy);
}
}
else if (nan) {
Real* vy;
vy = VpCreateRbObject(prec, "#0");
- RB_GC_GUARD(vy->obj);
VpSetNaN(vy);
+ RB_GC_GUARD(vy->obj);
return ToValue(vy);
}
else if (vx == NULL) {
cannot_be_coerced_into_BigDecimal(rb_eArgError, x);
}
- x = RB_GC_GUARD(vx->obj);
+ x = vx->obj;
n = prec + rmpd_double_figures();
negative = VpGetSign(vx) < 0;
@@ -2697,18 +2797,18 @@ BigMath_s_exp(VALUE klass, VALUE x, VALUE vprec)
VpSetSign(vx, 1);
}
- RB_GC_GUARD(one) = ToValue(VpCreateRbObject(1, "1"));
- RB_GC_GUARD(x1) = one;
- RB_GC_GUARD(y) = one;
- RB_GC_GUARD(d) = y;
- RB_GC_GUARD(z) = one;
- i = 0;
+ one = ToValue(VpCreateRbObject(1, "1"));
+ y = one;
+ d = y;
+ i = 1;
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);
+
+ rb_thread_check_ints();
+
if (m <= 0) {
break;
}
@@ -2716,38 +2816,37 @@ BigMath_s_exp(VALUE klass, VALUE x, VALUE vprec)
m = rmpd_double_figures();
}
- 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);
+ 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 */
}
if (negative) {
- VALUE argv[2];
- argv[0] = y;
- argv[1] = vprec;
- return BigDecimal_div2(2, argv, one);
+ return BigDecimal_div2(one, y, vprec);
}
else {
vprec = SSIZET2NUM(prec - VpExponent10(DATA_PTR(y)));
return BigDecimal_round(1, &vprec, y);
}
+
+ RB_GC_GUARD(one);
+ RB_GC_GUARD(x);
+ RB_GC_GUARD(y);
+ RB_GC_GUARD(d);
}
/* call-seq:
- * BigMath.log(x, prec)
+ * BigMath.log(decimal, numeric) -> BigDecimal
*
- * Computes the natural logarithm of x to the specified number of digits of
- * precision.
+ * Computes the natural logarithm of +decimal+ to the specified number of
+ * digits of precision, +numeric+.
*
- * If x is zero or negative, raises Math::DomainError.
+ * If +decimal+ is zero or negative, raises Math::DomainError.
*
- * If x is positive infinity, returns Infinity.
+ * If +decimal+ is positive infinity, returns Infinity.
*
- * If x is NaN, returns NaN.
+ * If +decimal+ is NaN, returns NaN.
*/
static VALUE
BigMath_s_log(VALUE klass, VALUE x, VALUE vprec)
@@ -2755,7 +2854,7 @@ BigMath_s_log(VALUE klass, VALUE x, VALUE vprec)
ssize_t prec, n, i;
SIGNED_VALUE expo;
Real* vx = NULL;
- VALUE argv[2], vn, one, two, w, x2, y, d;
+ VALUE vn, one, two, w, x2, y, d;
int zero = 0;
int negative = 0;
int infinite = 0;
@@ -2791,8 +2890,9 @@ BigMath_s_log(VALUE klass, VALUE x, VALUE vprec)
goto get_vp_value;
case T_BIGNUM:
- zero = RBIGNUM_ZERO_P(x);
- negative = RBIGNUM_NEGATIVE_P(x);
+ i = FIX2INT(rb_big_cmp(x, INT2FIX(0)));
+ zero = i == 0;
+ negative = i < 0;
get_vp_value:
if (zero || negative) break;
vx = GetVpValue(x, 0);
@@ -2853,17 +2953,15 @@ get_vp_value:
RB_GC_GUARD(vn) = SSIZET2NUM(n);
expo = VpExponent10(vx);
if (expo < 0 || expo >= 3) {
- char buf[16];
- snprintf(buf, 16, "1E%"PRIdVALUE, -expo);
+ char buf[DECIMAL_SIZE_OF_BITS(SIZEOF_VALUE * CHAR_BIT) + 4];
+ snprintf(buf, sizeof(buf), "1E%"PRIdVALUE, -expo);
x = BigDecimal_mult2(x, ToValue(VpCreateRbObject(1, buf)), vn);
}
else {
expo = 0;
}
w = BigDecimal_sub(x, one);
- argv[0] = BigDecimal_add(x, one);
- argv[1] = vn;
- x = BigDecimal_div2(2, argv, w);
+ x = BigDecimal_div2(w, BigDecimal_add(x, one), vn);
RB_GC_GUARD(x2) = BigDecimal_mult2(x, x, vn);
RB_GC_GUARD(y) = x;
RB_GC_GUARD(d) = y;
@@ -2881,9 +2979,7 @@ get_vp_value:
x = BigDecimal_mult2(x2, x, vn);
i += 2;
- argv[0] = SSIZET2NUM(i);
- argv[1] = SSIZET2NUM(m);
- d = BigDecimal_div2(2, argv, x);
+ d = BigDecimal_div2(x, SSIZET2NUM(i), SSIZET2NUM(m));
y = BigDecimal_add(y, d);
}
@@ -2902,15 +2998,7 @@ get_vp_value:
/* Document-class: BigDecimal
* BigDecimal provides arbitrary-precision floating point decimal arithmetic.
*
- * 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 the BigDecimal distribution.
- *
- * Documented by mathew <meta@pobox.com>.
- *
- * = Introduction
+ * == Introduction
*
* Ruby provides built-in support for arbitrary precision integer arithmetic.
*
@@ -2929,7 +3017,7 @@ get_vp_value:
* For example, try:
*
* sum = 0
- * for i in (1..10000)
+ * 10_000.times do
* sum = sum + 0.0001
* end
* print sum #=> 0.9999999999999062
@@ -2939,7 +3027,7 @@ get_vp_value:
* require 'bigdecimal'
*
* sum = BigDecimal.new("0")
- * for i in (1..10000)
+ * 10_000.times do
* sum = sum + BigDecimal.new("0.0001")
* end
* print sum #=> 0.1E1
@@ -2950,24 +3038,24 @@ get_vp_value:
*
* (1.2 - 1.0) == 0.2 #=> false
*
- * = Special features of accurate decimal arithmetic
+ * == Special features of accurate decimal arithmetic
*
* Because BigDecimal is more accurate than normal binary floating point
* arithmetic, it requires some special values.
*
- * == Infinity
+ * === Infinity
*
* BigDecimal sometimes needs to return infinity, for example if you divide
* a value by zero.
*
- * BigDecimal.new("1.0") / BigDecimal.new("0.0") #=> infinity
- * BigDecimal.new("-1.0") / BigDecimal.new("0.0") #=> -infinity
+ * BigDecimal.new("1.0") / BigDecimal.new("0.0") #=> Infinity
+ * BigDecimal.new("-1.0") / BigDecimal.new("0.0") #=> -Infinity
*
* You can represent infinite numbers to BigDecimal using the strings
* <code>'Infinity'</code>, <code>'+Infinity'</code> and
* <code>'-Infinity'</code> (case-sensitive)
*
- * == Not a Number
+ * === Not a Number
*
* When a computation results in an undefined value, the special value +NaN+
* (for 'not a number') is returned.
@@ -2981,10 +3069,10 @@ get_vp_value:
* NaN is never considered to be the same as any other value, even NaN itself:
*
* n = BigDecimal.new('NaN')
- * n == 0.0 #=> nil
- * n == n #=> nil
+ * n == 0.0 #=> false
+ * n == n #=> false
*
- * == Positive and negative zero
+ * === Positive and negative zero
*
* If a computation results in a value which is too small to be represented as
* a BigDecimal within the currently specified limits of precision, zero must
@@ -3006,6 +3094,19 @@ get_vp_value:
*
* Note also that in mathematics, there is no particular concept of negative
* or positive zero; true mathematical zero has no sign.
+ *
+ * == License
+ *
+ * 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 the BigDecimal distribution.
+ *
+ * Maintained by mrkn <mrkn@mrkn.jp> and ruby-core members.
+ *
+ * Documented by zzak <zachary@zacharyscott.net>, mathew <meta@pobox.com>, and
+ * many other contributors.
*/
void
Init_bigdecimal(void)
@@ -3020,7 +3121,7 @@ Init_bigdecimal(void)
VpInit(0UL);
/* Class and method registration */
- rb_cBigDecimal = rb_define_class("BigDecimal",rb_cNumeric);
+ rb_cBigDecimal = rb_define_class("BigDecimal", rb_cNumeric);
rb_define_alloc_func(rb_cBigDecimal, BigDecimal_s_allocate);
/* Global function */
@@ -3054,92 +3155,92 @@ Init_bigdecimal(void)
* 0xff: Determines whether overflow, underflow or zero divide result in
* an exception being thrown. See BigDecimal.mode.
*/
- rb_define_const(rb_cBigDecimal, "EXCEPTION_ALL",INT2FIX(VP_EXCEPTION_ALL));
+ rb_define_const(rb_cBigDecimal, "EXCEPTION_ALL", INT2FIX(VP_EXCEPTION_ALL));
/*
* 0x02: Determines what happens when the result of a computation is not a
* number (NaN). See BigDecimal.mode.
*/
- rb_define_const(rb_cBigDecimal, "EXCEPTION_NaN",INT2FIX(VP_EXCEPTION_NaN));
+ rb_define_const(rb_cBigDecimal, "EXCEPTION_NaN", INT2FIX(VP_EXCEPTION_NaN));
/*
* 0x01: Determines what happens when the result of a computation is
* infinity. See BigDecimal.mode.
*/
- rb_define_const(rb_cBigDecimal, "EXCEPTION_INFINITY",INT2FIX(VP_EXCEPTION_INFINITY));
+ rb_define_const(rb_cBigDecimal, "EXCEPTION_INFINITY", INT2FIX(VP_EXCEPTION_INFINITY));
/*
* 0x04: Determines what happens when the result of a computation is an
* underflow (a result too small to be represented). See BigDecimal.mode.
*/
- rb_define_const(rb_cBigDecimal, "EXCEPTION_UNDERFLOW",INT2FIX(VP_EXCEPTION_UNDERFLOW));
+ rb_define_const(rb_cBigDecimal, "EXCEPTION_UNDERFLOW", INT2FIX(VP_EXCEPTION_UNDERFLOW));
/*
* 0x01: Determines what happens when the result of a computation is an
* overflow (a result too large to be represented). See BigDecimal.mode.
*/
- rb_define_const(rb_cBigDecimal, "EXCEPTION_OVERFLOW",INT2FIX(VP_EXCEPTION_OVERFLOW));
+ rb_define_const(rb_cBigDecimal, "EXCEPTION_OVERFLOW", INT2FIX(VP_EXCEPTION_OVERFLOW));
/*
* 0x01: Determines what happens when a division by zero is performed.
* See BigDecimal.mode.
*/
- rb_define_const(rb_cBigDecimal, "EXCEPTION_ZERODIVIDE",INT2FIX(VP_EXCEPTION_ZERODIVIDE));
+ rb_define_const(rb_cBigDecimal, "EXCEPTION_ZERODIVIDE", INT2FIX(VP_EXCEPTION_ZERODIVIDE));
/*
* 0x100: Determines what happens when a result must be rounded in order to
* fit in the appropriate number of significant digits. See
* BigDecimal.mode.
*/
- rb_define_const(rb_cBigDecimal, "ROUND_MODE",INT2FIX(VP_ROUND_MODE));
+ rb_define_const(rb_cBigDecimal, "ROUND_MODE", INT2FIX(VP_ROUND_MODE));
/* 1: Indicates that values should be rounded away from zero. See
* BigDecimal.mode.
*/
- rb_define_const(rb_cBigDecimal, "ROUND_UP",INT2FIX(VP_ROUND_UP));
+ rb_define_const(rb_cBigDecimal, "ROUND_UP", INT2FIX(VP_ROUND_UP));
/* 2: Indicates that values should be rounded towards zero. See
* BigDecimal.mode.
*/
- rb_define_const(rb_cBigDecimal, "ROUND_DOWN",INT2FIX(VP_ROUND_DOWN));
+ rb_define_const(rb_cBigDecimal, "ROUND_DOWN", INT2FIX(VP_ROUND_DOWN));
/* 3: Indicates that digits >= 5 should be rounded up, others rounded down.
* See BigDecimal.mode. */
- rb_define_const(rb_cBigDecimal, "ROUND_HALF_UP",INT2FIX(VP_ROUND_HALF_UP));
+ rb_define_const(rb_cBigDecimal, "ROUND_HALF_UP", INT2FIX(VP_ROUND_HALF_UP));
/* 4: Indicates that digits >= 6 should be rounded up, others rounded down.
* See BigDecimal.mode.
*/
- rb_define_const(rb_cBigDecimal, "ROUND_HALF_DOWN",INT2FIX(VP_ROUND_HALF_DOWN));
- /* 5: Round towards +infinity. See BigDecimal.mode. */
- rb_define_const(rb_cBigDecimal, "ROUND_CEILING",INT2FIX(VP_ROUND_CEIL));
+ rb_define_const(rb_cBigDecimal, "ROUND_HALF_DOWN", INT2FIX(VP_ROUND_HALF_DOWN));
+ /* 5: Round towards +Infinity. See BigDecimal.mode. */
+ rb_define_const(rb_cBigDecimal, "ROUND_CEILING", INT2FIX(VP_ROUND_CEIL));
- /* 6: Round towards -infinity. See BigDecimal.mode. */
- rb_define_const(rb_cBigDecimal, "ROUND_FLOOR",INT2FIX(VP_ROUND_FLOOR));
+ /* 6: Round towards -Infinity. See BigDecimal.mode. */
+ rb_define_const(rb_cBigDecimal, "ROUND_FLOOR", INT2FIX(VP_ROUND_FLOOR));
/* 7: Round towards the even neighbor. See BigDecimal.mode. */
- rb_define_const(rb_cBigDecimal, "ROUND_HALF_EVEN",INT2FIX(VP_ROUND_HALF_EVEN));
+ rb_define_const(rb_cBigDecimal, "ROUND_HALF_EVEN", INT2FIX(VP_ROUND_HALF_EVEN));
/* 0: Indicates that a value is not a number. See BigDecimal.sign. */
- rb_define_const(rb_cBigDecimal, "SIGN_NaN",INT2FIX(VP_SIGN_NaN));
+ rb_define_const(rb_cBigDecimal, "SIGN_NaN", INT2FIX(VP_SIGN_NaN));
/* 1: Indicates that a value is +0. See BigDecimal.sign. */
- rb_define_const(rb_cBigDecimal, "SIGN_POSITIVE_ZERO",INT2FIX(VP_SIGN_POSITIVE_ZERO));
+ rb_define_const(rb_cBigDecimal, "SIGN_POSITIVE_ZERO", INT2FIX(VP_SIGN_POSITIVE_ZERO));
/* -1: Indicates that a value is -0. See BigDecimal.sign. */
- rb_define_const(rb_cBigDecimal, "SIGN_NEGATIVE_ZERO",INT2FIX(VP_SIGN_NEGATIVE_ZERO));
+ rb_define_const(rb_cBigDecimal, "SIGN_NEGATIVE_ZERO", INT2FIX(VP_SIGN_NEGATIVE_ZERO));
/* 2: Indicates that a value is positive and finite. See BigDecimal.sign. */
- rb_define_const(rb_cBigDecimal, "SIGN_POSITIVE_FINITE",INT2FIX(VP_SIGN_POSITIVE_FINITE));
+ rb_define_const(rb_cBigDecimal, "SIGN_POSITIVE_FINITE", INT2FIX(VP_SIGN_POSITIVE_FINITE));
/* -2: Indicates that a value is negative and finite. See BigDecimal.sign. */
- rb_define_const(rb_cBigDecimal, "SIGN_NEGATIVE_FINITE",INT2FIX(VP_SIGN_NEGATIVE_FINITE));
+ rb_define_const(rb_cBigDecimal, "SIGN_NEGATIVE_FINITE", INT2FIX(VP_SIGN_NEGATIVE_FINITE));
/* 3: Indicates that a value is positive and infinite. See BigDecimal.sign. */
- rb_define_const(rb_cBigDecimal, "SIGN_POSITIVE_INFINITE",INT2FIX(VP_SIGN_POSITIVE_INFINITE));
+ rb_define_const(rb_cBigDecimal, "SIGN_POSITIVE_INFINITE", INT2FIX(VP_SIGN_POSITIVE_INFINITE));
/* -3: Indicates that a value is negative and infinite. See BigDecimal.sign. */
- rb_define_const(rb_cBigDecimal, "SIGN_NEGATIVE_INFINITE",INT2FIX(VP_SIGN_NEGATIVE_INFINITE));
+ rb_define_const(rb_cBigDecimal, "SIGN_NEGATIVE_INFINITE", INT2FIX(VP_SIGN_NEGATIVE_INFINITE));
arg = rb_str_new2("+Infinity");
/* Positive infinity value. */
@@ -3157,7 +3258,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_div2, -1);
+ rb_define_method(rb_cBigDecimal, "div", BigDecimal_div3, -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);
@@ -3206,7 +3307,6 @@ Init_bigdecimal(void)
rb_define_method(rb_cBigDecimal, "truncate", BigDecimal_truncate, -1);
rb_define_method(rb_cBigDecimal, "_dump", BigDecimal_dump, -1);
- /* mathematical functions */
rb_mBigMath = rb_define_module("BigMath");
rb_define_singleton_method(rb_mBigMath, "exp", BigMath_s_exp, 2);
rb_define_singleton_method(rb_mBigMath, "log", BigMath_s_log, 2);
@@ -3244,7 +3344,7 @@ static int gfCheckVal = 1; /* Value checking flag in VpNmlz() */
static Real *VpConstOne; /* constant 1.0 */
static Real *VpPt5; /* constant 0.5 */
-#define maxnr 100UL /* Maximum iterations for calcurating sqrt. */
+#define maxnr 100UL /* Maximum iterations for calculating sqrt. */
/* used in VpSqrt() */
/* ETC */
@@ -3261,7 +3361,7 @@ static void VpFormatSt(char *psz, size_t fFmt);
static int VpRdup(Real *m, size_t ind_m);
#ifdef BIGDECIMAL_DEBUG
-static int gnAlloc=0; /* Memory allocation counter */
+static int gnAlloc = 0; /* Memory allocation counter */
#endif /* BIGDECIMAL_DEBUG */
VP_EXPORT void *
@@ -3269,7 +3369,7 @@ VpMemAlloc(size_t mb)
{
void *p = xmalloc(mb);
if (!p) {
- VpException(VP_EXCEPTION_MEMORY, "failed to allocate memory", 1);
+ VpException(VP_EXCEPTION_MEMORY, "failed to allocate memory", 1);
}
memset(p, 0, mb);
#ifdef BIGDECIMAL_DEBUG
@@ -3278,12 +3378,12 @@ VpMemAlloc(size_t mb)
return p;
}
-VP_EXPORT void *
+ VP_EXPORT void *
VpMemRealloc(void *ptr, size_t mb)
{
void *p = xrealloc(ptr, mb);
if (!p) {
- VpException(VP_EXCEPTION_MEMORY, "failed to allocate memory", 1);
+ VpException(VP_EXCEPTION_MEMORY, "failed to allocate memory", 1);
}
return p;
}
@@ -3291,18 +3391,18 @@ VpMemRealloc(void *ptr, size_t mb)
VP_EXPORT void
VpFree(Real *pv)
{
- if(pv != NULL) {
- xfree(pv);
+ if (pv != NULL) {
+ xfree(pv);
#ifdef BIGDECIMAL_DEBUG
- gnAlloc--; /* Decrement allocation count */
- if(gnAlloc==0) {
- printf(" *************** All memories allocated freed ****************");
- getchar();
- }
- if(gnAlloc<0) {
- printf(" ??????????? Too many memory free calls(%d) ?????????????\n",gnAlloc);
- getchar();
- }
+ gnAlloc--; /* Decrement allocation count */
+ if (gnAlloc == 0) {
+ printf(" *************** All memories allocated freed ****************");
+ getchar();
+ }
+ if (gnAlloc < 0) {
+ printf(" ??????????? Too many memory free calls(%d) ?????????????\n", gnAlloc);
+ getchar();
+ }
#endif /* BIGDECIMAL_DEBUG */
}
}
@@ -3473,7 +3573,7 @@ VP_EXPORT double
VpGetDoubleNaN(void) /* Returns the value of NaN */
{
static double fNaN = 0.0;
- if(fNaN==0.0) fNaN = Zero()/Zero();
+ if (fNaN == 0.0) fNaN = Zero()/Zero();
return fNaN;
}
@@ -3481,7 +3581,7 @@ VP_EXPORT double
VpGetDoublePosInf(void) /* Returns the value of +Infinity */
{
static double fInf = 0.0;
- if(fInf==0.0) fInf = One()/Zero();
+ if (fInf == 0.0) fInf = One()/Zero();
return fInf;
}
@@ -3489,7 +3589,7 @@ VP_EXPORT double
VpGetDoubleNegInf(void) /* Returns the value of -Infinity */
{
static double fInf = 0.0;
- if(fInf==0.0) fInf = -(One()/Zero());
+ if (fInf == 0.0) fInf = -(One()/Zero());
return fInf;
}
@@ -3497,7 +3597,7 @@ VP_EXPORT double
VpGetDoubleNegZero(void) /* Returns the value of -0 */
{
static double nzero = 1000.0;
- if(nzero!=0.0) nzero = (One()/VpGetDoubleNegInf());
+ if (nzero != 0.0) nzero = (One()/VpGetDoubleNegInf());
return nzero;
}
@@ -3513,39 +3613,26 @@ VpIsNegDoubleZero(double v)
VP_EXPORT int
VpException(unsigned short f, const char *str,int always)
{
- VALUE exc;
- int fatal=0;
unsigned short const exception_mode = VpGetException();
- if(f==VP_EXCEPTION_OP || f==VP_EXCEPTION_MEMORY) always = 1;
+ if (f == VP_EXCEPTION_OP || f == VP_EXCEPTION_MEMORY) always = 1;
if (always || (exception_mode & f)) {
- switch(f)
- {
- /*
- case VP_EXCEPTION_OVERFLOW:
- */
- case VP_EXCEPTION_ZERODIVIDE:
- case VP_EXCEPTION_INFINITY:
- case VP_EXCEPTION_NaN:
- case VP_EXCEPTION_UNDERFLOW:
- case VP_EXCEPTION_OP:
- exc = rb_eFloatDomainError;
- goto raise;
- case VP_EXCEPTION_MEMORY:
- fatal = 1;
- goto raise;
- default:
- fatal = 1;
- goto raise;
- }
+ switch(f) {
+ /* case VP_EXCEPTION_OVERFLOW: */
+ case VP_EXCEPTION_ZERODIVIDE:
+ case VP_EXCEPTION_INFINITY:
+ case VP_EXCEPTION_NaN:
+ case VP_EXCEPTION_UNDERFLOW:
+ case VP_EXCEPTION_OP:
+ rb_raise(rb_eFloatDomainError, "%s", str);
+ break;
+ case VP_EXCEPTION_MEMORY:
+ default:
+ rb_fatal("%s", str);
+ }
}
return 0; /* 0 Means VpException() raised no exception */
-
-raise:
- if(fatal) rb_fatal("%s", str);
- else rb_raise(exc, "%s", str);
- return 0;
}
/* Throw exception or returns 0,when resulting c is Inf or NaN */
@@ -3553,91 +3640,90 @@ raise:
static int
VpIsDefOP(Real *c,Real *a,Real *b,int sw)
{
- if(VpIsNaN(a) || VpIsNaN(b)) {
- /* at least a or b is NaN */
- VpSetNaN(c);
- goto NaN;
- }
-
- if(VpIsInf(a)) {
- if(VpIsInf(b)) {
- switch(sw)
- {
- case 1: /* + */
- if(VpGetSign(a)==VpGetSign(b)) {
- VpSetInf(c,VpGetSign(a));
- goto Inf;
- } else {
- VpSetNaN(c);
- goto NaN;
- }
- case 2: /* - */
- if(VpGetSign(a)!=VpGetSign(b)) {
- VpSetInf(c,VpGetSign(a));
- goto Inf;
- } else {
- VpSetNaN(c);
- goto NaN;
- }
- break;
- case 3: /* * */
- VpSetInf(c,VpGetSign(a)*VpGetSign(b));
- goto Inf;
- break;
- case 4: /* / */
- VpSetNaN(c);
- goto NaN;
- }
- VpSetNaN(c);
- goto NaN;
- }
- /* Inf op Finite */
- switch(sw)
- {
- case 1: /* + */
- case 2: /* - */
- VpSetInf(c,VpGetSign(a));
- break;
- case 3: /* * */
- if(VpIsZero(b)) {
- VpSetNaN(c);
- goto NaN;
- }
- VpSetInf(c,VpGetSign(a)*VpGetSign(b));
- break;
- case 4: /* / */
- VpSetInf(c,VpGetSign(a)*VpGetSign(b));
- }
- goto Inf;
+ if (VpIsNaN(a) || VpIsNaN(b)) {
+ /* at least a or b is NaN */
+ VpSetNaN(c);
+ goto NaN;
}
- if(VpIsInf(b)) {
- switch(sw)
- {
- case 1: /* + */
- VpSetInf(c,VpGetSign(b));
- break;
- case 2: /* - */
- VpSetInf(c,-VpGetSign(b));
- break;
- case 3: /* * */
- if(VpIsZero(a)) {
- VpSetNaN(c);
- goto NaN;
- }
- VpSetInf(c,VpGetSign(a)*VpGetSign(b));
- break;
- case 4: /* / */
- VpSetZero(c,VpGetSign(a)*VpGetSign(b));
- }
- goto Inf;
+ if (VpIsInf(a)) {
+ if (VpIsInf(b)) {
+ switch(sw) {
+ case 1: /* + */
+ if (VpGetSign(a) == VpGetSign(b)) {
+ VpSetInf(c, VpGetSign(a));
+ goto Inf;
+ }
+ else {
+ VpSetNaN(c);
+ goto NaN;
+ }
+ case 2: /* - */
+ if (VpGetSign(a) != VpGetSign(b)) {
+ VpSetInf(c, VpGetSign(a));
+ goto Inf;
+ }
+ else {
+ VpSetNaN(c);
+ goto NaN;
+ }
+ break;
+ case 3: /* * */
+ VpSetInf(c, VpGetSign(a)*VpGetSign(b));
+ goto Inf;
+ break;
+ case 4: /* / */
+ VpSetNaN(c);
+ goto NaN;
+ }
+ VpSetNaN(c);
+ goto NaN;
+ }
+ /* Inf op Finite */
+ switch(sw) {
+ case 1: /* + */
+ case 2: /* - */
+ VpSetInf(c, VpGetSign(a));
+ break;
+ case 3: /* * */
+ if (VpIsZero(b)) {
+ VpSetNaN(c);
+ goto NaN;
+ }
+ VpSetInf(c, VpGetSign(a)*VpGetSign(b));
+ break;
+ case 4: /* / */
+ VpSetInf(c, VpGetSign(a)*VpGetSign(b));
+ }
+ goto Inf;
+ }
+
+ if (VpIsInf(b)) {
+ switch(sw) {
+ case 1: /* + */
+ VpSetInf(c, VpGetSign(b));
+ break;
+ case 2: /* - */
+ VpSetInf(c, -VpGetSign(b));
+ break;
+ case 3: /* * */
+ if (VpIsZero(a)) {
+ VpSetNaN(c);
+ goto NaN;
+ }
+ VpSetInf(c, VpGetSign(a)*VpGetSign(b));
+ break;
+ case 4: /* / */
+ VpSetZero(c, VpGetSign(a)*VpGetSign(b));
+ }
+ goto Inf;
}
return 1; /* Results OK */
Inf:
- return VpException(VP_EXCEPTION_INFINITY,"Computation results to 'Infinity'",0);
+ return VpException(VP_EXCEPTION_INFINITY, "Computation results to 'Infinity'", 0);
NaN:
- return VpException(VP_EXCEPTION_NaN,"Computation results to 'NaN'",0);
+ return VpException(VP_EXCEPTION_NaN, "Computation results to 'NaN'", 0);
}
/*
@@ -3653,26 +3739,26 @@ VpNumOfChars(Real *vp,const char *pszFmt)
SIGNED_VALUE ex;
size_t nc;
- if(vp == NULL) return BASE_FIG*2+6;
- if(!VpIsDef(vp)) return 32; /* not sure,may be OK */
-
- switch(*pszFmt)
- {
- case 'F':
- nc = BASE_FIG*(vp->Prec + 1)+2;
- ex = vp->exponent;
- if(ex < 0) {
- nc += BASE_FIG*(size_t)(-ex);
- }
- else {
- if((size_t)ex > vp->Prec) {
- nc += BASE_FIG*((size_t)ex - vp->Prec);
- }
- }
- break;
- case 'E':
- default:
- nc = BASE_FIG*(vp->Prec + 2)+6; /* 3: sign + exponent chars */
+ if (vp == NULL) return BASE_FIG*2+6;
+ if (!VpIsDef(vp)) return 32; /* not sure,may be OK */
+
+ switch(*pszFmt) {
+ case 'F':
+ nc = BASE_FIG*(vp->Prec + 1)+2;
+ ex = vp->exponent;
+ if (ex < 0) {
+ nc += BASE_FIG*(size_t)(-ex);
+ }
+ else {
+ if ((size_t)ex > vp->Prec) {
+ nc += BASE_FIG*((size_t)ex - vp->Prec);
+ }
+ }
+ break;
+ case 'E':
+ /* fall through */
+ default:
+ nc = BASE_FIG*(vp->Prec + 2)+6; /* 3: sign + exponent chars */
}
return nc;
}
@@ -3682,7 +3768,7 @@ VpNumOfChars(Real *vp,const char *pszFmt)
* [Input]
* BaseVal: Base value(assigned to BASE) for Vp calculation.
* It must be the form BaseVal=10**n.(n=1,2,3,...)
- * If Base <= 0L,then the BASE will be calcurated so
+ * If Base <= 0L,then the BASE will be calculated so
* that BASE is as large as possible satisfying the
* relation MaxVal <= BASE*(BASE+1). Where the value
* MaxVal is the largest value which can be represented
@@ -3709,13 +3795,13 @@ VpInit(BDIGIT BaseVal)
#endif /* BIGDECIMAL_DEBUG */
#ifdef BIGDECIMAL_DEBUG
- if(gfDebug) {
- 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);
+ if (gfDebug) {
+ 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);
}
#endif /* BIGDECIMAL_DEBUG */
@@ -3735,28 +3821,35 @@ AddExponent(Real *a, SIGNED_VALUE n)
SIGNED_VALUE e = a->exponent;
SIGNED_VALUE m = e+n;
SIGNED_VALUE eb, mb;
- if(e>0) {
- if(n>0) {
- mb = m*(SIGNED_VALUE)BASE_FIG;
- eb = e*(SIGNED_VALUE)BASE_FIG;
- if(mb<eb) goto overflow;
- }
- } else if(n<0) {
- mb = m*(SIGNED_VALUE)BASE_FIG;
- eb = e*(SIGNED_VALUE)BASE_FIG;
- if(mb>eb) goto underflow;
+ if (e > 0) {
+ if (n > 0) {
+ if (MUL_OVERFLOW_SIGNED_VALUE_P(m, (SIGNED_VALUE)BASE_FIG) ||
+ MUL_OVERFLOW_SIGNED_VALUE_P(e, (SIGNED_VALUE)BASE_FIG))
+ goto overflow;
+ mb = m*(SIGNED_VALUE)BASE_FIG;
+ eb = e*(SIGNED_VALUE)BASE_FIG;
+ if (mb < eb) goto overflow;
+ }
+ }
+ else if (n < 0) {
+ if (MUL_OVERFLOW_SIGNED_VALUE_P(m, (SIGNED_VALUE)BASE_FIG) ||
+ MUL_OVERFLOW_SIGNED_VALUE_P(e, (SIGNED_VALUE)BASE_FIG))
+ goto underflow;
+ mb = m*(SIGNED_VALUE)BASE_FIG;
+ eb = e*(SIGNED_VALUE)BASE_FIG;
+ if (mb > eb) goto underflow;
}
a->exponent = m;
return 1;
/* Overflow/Underflow ==> Raise exception or returns 0 */
underflow:
- VpSetZero(a,VpGetSign(a));
- return VpException(VP_EXCEPTION_UNDERFLOW,"Exponent underflow",0);
+ VpSetZero(a, VpGetSign(a));
+ return VpException(VP_EXCEPTION_UNDERFLOW, "Exponent underflow", 0);
overflow:
- VpSetInf(a,VpGetSign(a));
- return VpException(VP_EXCEPTION_OVERFLOW,"Exponent overflow",0);
+ VpSetInf(a, VpGetSign(a));
+ return VpException(VP_EXCEPTION_OVERFLOW, "Exponent overflow", 0);
}
/*
@@ -3776,80 +3869,84 @@ VP_EXPORT Real *
VpAlloc(size_t mx, const char *szVal)
{
size_t i, ni, ipn, ipf, nf, ipe, ne, nalloc;
- char v,*psz;
+ char v, *psz;
int sign=1;
Real *vp = NULL;
size_t mf = VpGetPrecLimit();
VALUE buf;
- mx = (mx + BASE_FIG - 1) / BASE_FIG + 1; /* Determine allocation unit. */
+ mx = (mx + BASE_FIG - 1) / BASE_FIG; /* Determine allocation unit. */
+ 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;
- }
- }
- }
+ 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;
- }
+ ++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 */
ni = 0;
- buf = rb_str_tmp_new(strlen(szVal)+1);
+ buf = rb_str_tmp_new(strlen(szVal) + 1);
psz = RSTRING_PTR(buf);
i = 0;
ipn = 0;
- while ((psz[i]=szVal[ipn]) != 0) {
- if (ISDIGIT(psz[i])) ++ni;
- if (psz[i] == '_') {
- if (ni > 0) { ipn++; continue; }
- psz[i] = 0;
- break;
- }
- ++i;
+ while ((psz[i] = szVal[ipn]) != 0) {
+ 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;
+ 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;
+ if (StrCmp(szVal, SZ_PINF) == 0 || StrCmp(szVal, SZ_INF) == 0 ) {
+ 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[] */
@@ -3859,49 +3956,49 @@ 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 */
+ /* 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':
+ 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;
- }
+ 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[] */
- if (mx <= 0) mx = 1;
+ if (mx == 0) mx = 1;
nalloc = Max(nalloc, mx);
mx = nalloc;
vp = VpAllocReal(mx);
@@ -3929,37 +4026,39 @@ VP_EXPORT size_t
VpAsgn(Real *c, Real *a, int isw)
{
size_t n;
- if(VpIsNaN(a)) {
- VpSetNaN(c);
- return 0;
+ if (VpIsNaN(a)) {
+ VpSetNaN(c);
+ return 0;
}
- if(VpIsInf(a)) {
- VpSetInf(c,isw*VpGetSign(a));
- return 0;
+ if (VpIsInf(a)) {
+ VpSetInf(c, isw * VpGetSign(a));
+ return 0;
}
/* check if the RHS is zero */
- if(!VpIsZero(a)) {
- c->exponent = a->exponent; /* store exponent */
- VpSetSign(c,(isw*VpGetSign(a))); /* set sign */
- n =(a->Prec < c->MaxPrec) ?(a->Prec) :(c->MaxPrec);
- c->Prec = n;
- memcpy(c->frac, a->frac, n * sizeof(BDIGIT));
- /* Needs round ? */
- if(isw!=10) {
- /* Not in ActiveRound */
- if(c->Prec < a->Prec) {
- VpInternalRound(c,n,(n>0)?a->frac[n-1]:0,a->frac[n]);
- } else {
+ if (!VpIsZero(a)) {
+ c->exponent = a->exponent; /* store exponent */
+ VpSetSign(c, isw * VpGetSign(a)); /* set sign */
+ n = (a->Prec < c->MaxPrec) ? (a->Prec) : (c->MaxPrec);
+ c->Prec = n;
+ memcpy(c->frac, a->frac, n * sizeof(BDIGIT));
+ /* Needs round ? */
+ if (isw != 10) {
+ /* Not in ActiveRound */
+ if(c->Prec < a->Prec) {
+ VpInternalRound(c, n, (n>0) ? a->frac[n-1] : 0, a->frac[n]);
+ }
+ else {
VpLimitRound(c,0);
- }
- }
- } else {
- /* The value of 'a' is zero. */
- VpSetZero(c,isw*VpGetSign(a));
- return 1;
+ }
+ }
}
- return c->Prec*BASE_FIG;
+ else {
+ /* The value of 'a' is zero. */
+ VpSetZero(c, isw * VpGetSign(a));
+ return 1;
+ }
+ return c->Prec * BASE_FIG;
}
/*
@@ -3976,83 +4075,87 @@ VpAddSub(Real *c, Real *a, Real *b, int operation)
BDIGIT mrv;
#ifdef BIGDECIMAL_DEBUG
- if(gfDebug) {
- VPrint(stdout, "VpAddSub(enter) a=% \n", a);
- VPrint(stdout, " b=% \n", b);
- printf(" operation=%d\n", operation);
+ if (gfDebug) {
+ VPrint(stdout, "VpAddSub(enter) a=% \n", a);
+ VPrint(stdout, " b=% \n", b);
+ printf(" operation=%d\n", operation);
}
#endif /* BIGDECIMAL_DEBUG */
- if(!VpIsDefOP(c,a,b,(operation>0)?1:2)) return 0; /* No significant digits */
+ if (!VpIsDefOP(c, a, b, (operation > 0) ? 1 : 2)) return 0; /* No significant digits */
/* check if a or b is zero */
- if(VpIsZero(a)) {
- /* a is zero,then assign b to c */
- if(!VpIsZero(b)) {
- VpAsgn(c, b, operation);
- } else {
- /* Both a and b are zero. */
- if(VpGetSign(a)<0 && operation*VpGetSign(b)<0) {
- /* -0 -0 */
- VpSetZero(c,-1);
- } else {
- VpSetZero(c,1);
- }
- return 1; /* 0: 1 significant digits */
- }
- return c->Prec*BASE_FIG;
+ if (VpIsZero(a)) {
+ /* a is zero,then assign b to c */
+ if (!VpIsZero(b)) {
+ VpAsgn(c, b, operation);
+ }
+ else {
+ /* Both a and b are zero. */
+ if (VpGetSign(a) < 0 && operation * VpGetSign(b) < 0) {
+ /* -0 -0 */
+ VpSetZero(c, -1);
+ }
+ else {
+ VpSetZero(c, 1);
+ }
+ return 1; /* 0: 1 significant digits */
+ }
+ return c->Prec * BASE_FIG;
}
- if(VpIsZero(b)) {
- /* b is zero,then assign a to c. */
- VpAsgn(c, a, 1);
- return c->Prec*BASE_FIG;
+ if (VpIsZero(b)) {
+ /* b is zero,then assign a to c. */
+ VpAsgn(c, a, 1);
+ return c->Prec*BASE_FIG;
}
- if(operation < 0) sw = -1;
- else sw = 1;
+ if (operation < 0) sw = -1;
+ else sw = 1;
/* compare absolute value. As a result,|a_ptr|>=|b_ptr| */
- if(a->exponent > b->exponent) {
- a_ptr = a;
- b_ptr = b;
+ if (a->exponent > b->exponent) {
+ a_ptr = a;
+ b_ptr = b;
} /* |a|>|b| */
- else if(a->exponent < b->exponent) {
- a_ptr = b;
- b_ptr = a;
+ else if (a->exponent < b->exponent) {
+ a_ptr = b;
+ b_ptr = a;
} /* |a|<|b| */
else {
- /* Exponent part of a and b is the same,then compare fraction */
- /* part */
- na = a->Prec;
- nb = b->Prec;
- n = Min(na, nb);
- for(i=0;i < n; ++i) {
- if(a->frac[i] > b->frac[i]) {
- a_ptr = a;
- b_ptr = b;
- goto end_if;
- } else if(a->frac[i] < b->frac[i]) {
- a_ptr = b;
- b_ptr = a;
- goto end_if;
- }
- }
- if(na > nb) {
- a_ptr = a;
- b_ptr = b;
- goto end_if;
- } else if(na < nb) {
- a_ptr = b;
- b_ptr = a;
- goto end_if;
- }
- /* |a| == |b| */
- if(VpGetSign(a) + sw *VpGetSign(b) == 0) {
- VpSetZero(c,1); /* abs(a)=abs(b) and operation = '-' */
- return c->Prec*BASE_FIG;
- }
- a_ptr = a;
- b_ptr = b;
+ /* Exponent part of a and b is the same,then compare fraction */
+ /* part */
+ na = a->Prec;
+ nb = b->Prec;
+ n = Min(na, nb);
+ for (i=0; i < n; ++i) {
+ if (a->frac[i] > b->frac[i]) {
+ a_ptr = a;
+ b_ptr = b;
+ goto end_if;
+ }
+ else if (a->frac[i] < b->frac[i]) {
+ a_ptr = b;
+ b_ptr = a;
+ goto end_if;
+ }
+ }
+ if (na > nb) {
+ a_ptr = a;
+ b_ptr = b;
+ goto end_if;
+ }
+ else if (na < nb) {
+ a_ptr = b;
+ b_ptr = a;
+ goto end_if;
+ }
+ /* |a| == |b| */
+ if (VpGetSign(a) + sw *VpGetSign(b) == 0) {
+ VpSetZero(c, 1); /* abs(a)=abs(b) and operation = '-' */
+ return c->Prec * BASE_FIG;
+ }
+ a_ptr = a;
+ b_ptr = b;
}
end_if:
@@ -4063,31 +4166,33 @@ end_if:
* =-2 ...(-1)+(-1),(-1)-( 1)
* If isw==0, then c =(Sign a_ptr)(|a_ptr|-|b_ptr|)
* else c =(Sign ofisw)(|a_ptr|+|b_ptr|)
- */
- if(isw) { /* addition */
- VpSetSign(c, 1);
- mrv = VpAddAbs(a_ptr, b_ptr, c);
- VpSetSign(c, isw / 2);
- } else { /* subtraction */
- VpSetSign(c, 1);
- mrv = VpSubAbs(a_ptr, b_ptr, c);
- if(a_ptr == a) {
- VpSetSign(c,VpGetSign(a));
- } else {
- VpSetSign(c,VpGetSign(a_ptr) * sw);
- }
+ */
+ if (isw) { /* addition */
+ VpSetSign(c, 1);
+ mrv = VpAddAbs(a_ptr, b_ptr, c);
+ VpSetSign(c, isw / 2);
+ }
+ else { /* subtraction */
+ VpSetSign(c, 1);
+ mrv = VpSubAbs(a_ptr, b_ptr, c);
+ if (a_ptr == a) {
+ VpSetSign(c,VpGetSign(a));
+ }
+ else {
+ VpSetSign(c, VpGetSign(a_ptr) * sw);
+ }
}
- VpInternalRound(c,0,(c->Prec>0)?c->frac[c->Prec-1]:0,mrv);
+ VpInternalRound(c, 0, (c->Prec > 0) ? c->frac[c->Prec-1] : 0, mrv);
#ifdef BIGDECIMAL_DEBUG
- if(gfDebug) {
- VPrint(stdout, "VpAddSub(result) c=% \n", c);
- VPrint(stdout, " a=% \n", a);
- VPrint(stdout, " b=% \n", b);
- printf(" operation=%d\n", operation);
+ if (gfDebug) {
+ VPrint(stdout, "VpAddSub(result) c=% \n", c);
+ VPrint(stdout, " a=% \n", a);
+ VPrint(stdout, " b=% \n", b);
+ printf(" operation=%d\n", operation);
}
#endif /* BIGDECIMAL_DEBUG */
- return c->Prec*BASE_FIG;
+ return c->Prec * BASE_FIG;
}
/*
@@ -4108,9 +4213,9 @@ VpAddAbs(Real *a, Real *b, Real *c)
BDIGIT av, bv, carry, mrv;
#ifdef BIGDECIMAL_DEBUG
- if(gfDebug) {
- VPrint(stdout, "VpAddAbs called: a = %\n", a);
- VPrint(stdout, " b = %\n", b);
+ if (gfDebug) {
+ VPrint(stdout, "VpAddAbs called: a = %\n", a);
+ VPrint(stdout, " b = %\n", b);
}
#endif /* BIGDECIMAL_DEBUG */
@@ -4118,55 +4223,59 @@ 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;
+
+ if (word_shift == (size_t)-1L) return 0; /* Overflow */
+ if (b_pos == (size_t)-1L) goto Assign_a;
mrv = av + bv; /* Most right val. Used for round. */
/* Just assign the last few digits of b to c because a has no */
/* corresponding digits to be added. */
- while(b_pos + word_shift > a_pos) {
- --c_pos;
- if(b_pos > 0) {
- c->frac[c_pos] = b->frac[--b_pos];
- } else {
- --word_shift;
- c->frac[c_pos] = 0;
- }
+ if (b_pos > 0) {
+ while (b_pos > 0 && b_pos + word_shift > a_pos) {
+ 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;
+ }
}
/* Just assign the last few digits of a to c because b has no */
/* corresponding digits to be added. */
b_pos_with_word_shift = b_pos + word_shift;
- while(a_pos > b_pos_with_word_shift) {
- c->frac[--c_pos] = a->frac[--a_pos];
+ while (a_pos > b_pos_with_word_shift) {
+ c->frac[--c_pos] = a->frac[--a_pos];
}
carry = 0; /* set first carry be zero */
/* Now perform addition until every digits of b will be */
/* exhausted. */
- while(b_pos > 0) {
- c->frac[--c_pos] = a->frac[--a_pos] + b->frac[--b_pos] + carry;
- if(c->frac[c_pos] >= BASE) {
- c->frac[c_pos] -= BASE;
- carry = 1;
- } else {
- carry = 0;
- }
+ while (b_pos > 0) {
+ c->frac[--c_pos] = a->frac[--a_pos] + b->frac[--b_pos] + carry;
+ if (c->frac[c_pos] >= BASE) {
+ c->frac[c_pos] -= BASE;
+ carry = 1;
+ }
+ else {
+ carry = 0;
+ }
}
/* Just assign the first few digits of a with considering */
/* the carry obtained so far because b has been exhausted. */
- while(a_pos > 0) {
- c->frac[--c_pos] = a->frac[--a_pos] + carry;
- if(c->frac[c_pos] >= BASE) {
- c->frac[c_pos] -= BASE;
- carry = 1;
- } else {
- carry = 0;
- }
+ while (a_pos > 0) {
+ c->frac[--c_pos] = a->frac[--a_pos] + carry;
+ if (c->frac[c_pos] >= BASE) {
+ c->frac[c_pos] -= BASE;
+ carry = 1;
+ }
+ else {
+ carry = 0;
+ }
}
- if(c_pos) c->frac[c_pos - 1] += carry;
+ if (c_pos) c->frac[c_pos - 1] += carry;
goto Exit;
Assign_a:
@@ -4176,8 +4285,8 @@ Assign_a:
Exit:
#ifdef BIGDECIMAL_DEBUG
- if(gfDebug) {
- VPrint(stdout, "VpAddAbs exit: c=% \n", c);
+ if (gfDebug) {
+ VPrint(stdout, "VpAddAbs exit: c=% \n", c);
}
#endif /* BIGDECIMAL_DEBUG */
return mrv;
@@ -4199,9 +4308,9 @@ VpSubAbs(Real *a, Real *b, Real *c)
BDIGIT av, bv, borrow, mrv;
#ifdef BIGDECIMAL_DEBUG
- if(gfDebug) {
- VPrint(stdout, "VpSubAbs called: a = %\n", a);
- VPrint(stdout, " b = %\n", b);
+ if (gfDebug) {
+ VPrint(stdout, "VpSubAbs called: a = %\n", a);
+ VPrint(stdout, " b = %\n", b);
}
#endif /* BIGDECIMAL_DEBUG */
@@ -4209,66 +4318,70 @@ VpSubAbs(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;
+ if (word_shift == (size_t)-1L) return 0; /* Overflow */
+ if (b_pos == (size_t)-1L) goto Assign_a;
- if(av >= bv) {
- mrv = av - bv;
- borrow = 0;
- } else {
- mrv = 0;
- borrow = 1;
+ if (av >= bv) {
+ mrv = av - bv;
+ borrow = 0;
+ }
+ else {
+ mrv = 0;
+ borrow = 1;
}
/* Just assign the values which are the BASE subtracted by */
/* 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 + 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;
- }
+ 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) {
+ --word_shift;
+ c->frac[--c_pos] = BASE - borrow;
+ borrow = 1;
+ }
+ }
}
/* Just assign the last few digits of a to c because b has no */
/* corresponding digits to subtract. */
b_pos_with_word_shift = b_pos + word_shift;
- while(a_pos > b_pos_with_word_shift) {
- c->frac[--c_pos] = a->frac[--a_pos];
+ while (a_pos > b_pos_with_word_shift) {
+ c->frac[--c_pos] = a->frac[--a_pos];
}
/* Now perform subtraction until every digits of b will be */
/* exhausted. */
- while(b_pos > 0) {
- --c_pos;
- if(a->frac[--a_pos] < b->frac[--b_pos] + borrow) {
- c->frac[c_pos] = BASE + a->frac[a_pos] - b->frac[b_pos] - borrow;
- borrow = 1;
- } else {
- c->frac[c_pos] = a->frac[a_pos] - b->frac[b_pos] - borrow;
- borrow = 0;
- }
+ while (b_pos > 0) {
+ --c_pos;
+ if (a->frac[--a_pos] < b->frac[--b_pos] + borrow) {
+ c->frac[c_pos] = BASE + a->frac[a_pos] - b->frac[b_pos] - borrow;
+ borrow = 1;
+ }
+ else {
+ c->frac[c_pos] = a->frac[a_pos] - b->frac[b_pos] - borrow;
+ borrow = 0;
+ }
}
/* Just assign the first few digits of a with considering */
/* the borrow obtained so far because b has been exhausted. */
- while(a_pos > 0) {
- --c_pos;
- if(a->frac[--a_pos] < borrow) {
- c->frac[c_pos] = BASE + a->frac[a_pos] - borrow;
- borrow = 1;
- } else {
- c->frac[c_pos] = a->frac[a_pos] - borrow;
- borrow = 0;
- }
+ while (a_pos > 0) {
+ --c_pos;
+ if (a->frac[--a_pos] < borrow) {
+ c->frac[c_pos] = BASE + a->frac[a_pos] - borrow;
+ borrow = 1;
+ }
+ else {
+ c->frac[c_pos] = a->frac[a_pos] - borrow;
+ borrow = 0;
+ }
}
- if(c_pos) c->frac[c_pos - 1] -= borrow;
+ if (c_pos) c->frac[c_pos - 1] -= borrow;
goto Exit;
Assign_a:
@@ -4277,8 +4390,8 @@ Assign_a:
Exit:
#ifdef BIGDECIMAL_DEBUG
- if(gfDebug) {
- VPrint(stdout, "VpSubAbs exit: c=% \n", c);
+ if (gfDebug) {
+ VPrint(stdout, "VpSubAbs exit: c=% \n", c);
}
#endif /* BIGDECIMAL_DEBUG */
return mrv;
@@ -4302,84 +4415,99 @@ 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->expoennt);
+
c->frac[0] = 0;
*av = *bv = 0;
- word_shift =((a->exponent) -(b->exponent));
+
+ 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 */
+ right_word = Max(a->Prec, left_word);
+ left_word = c->MaxPrec - 1; /* -1 ... prepare for round up */
+
/*
* check if 'round' is needed.
*/
- if(right_word > left_word) { /* round ? */
- /*---------------------------------
- * Actual size of a = xxxxxxAxx
- * Actual size of b = xxxBxxxxx
- * Max. size of c = xxxxxx
- * Round off = |-----|
- * c_pos = |
- * right_word = |
- * a_pos = |
- */
- *c_pos = right_word = left_word + 1; /* Set resulting precision */
- /* be equal to that of c */
- if((a->Prec) >=(c->MaxPrec)) {
- /*
- * a = xxxxxxAxxx
- * c = xxxxxx
- * a_pos = |
- */
- *a_pos = left_word;
- *av = a->frac[*a_pos]; /* av is 'A' shown in above. */
- } else {
- /*
- * a = xxxxxxx
- * c = xxxxxxxxxx
- * a_pos = |
- */
- *a_pos = a->Prec;
- }
- if((b->Prec + word_shift) >= c->MaxPrec) {
- /*
- * a = xxxxxxxxx
- * b = xxxxxxxBxxx
- * c = xxxxxxxxxxx
- * b_pos = |
- */
- if(c->MaxPrec >=(word_shift + 1)) {
- *b_pos = c->MaxPrec - word_shift - 1;
- *bv = b->frac[*b_pos];
- } else {
- *b_pos = -1L;
- }
- } else {
- /*
- * a = xxxxxxxxxxxxxxxx
- * b = xxxxxx
- * c = xxxxxxxxxxxxx
- * b_pos = |
- */
- *b_pos = b->Prec;
- }
- } else { /* The MaxPrec of c - 1 > The Prec of a + b */
- /*
- * a = xxxxxxx
- * b = xxxxxx
- * c = xxxxxxxxxxx
- * c_pos = |
- */
- *b_pos = b->Prec;
- *a_pos = a->Prec;
- *c_pos = right_word + 1;
+ if (right_word > left_word) { /* round ? */
+ /*---------------------------------
+ * Actual size of a = xxxxxxAxx
+ * Actual size of b = xxxBxxxxx
+ * Max. size of c = xxxxxx
+ * Round off = |-----|
+ * c_pos = |
+ * right_word = |
+ * a_pos = |
+ */
+ *c_pos = right_word = left_word + 1; /* Set resulting precision */
+ /* be equal to that of c */
+ if (a->Prec >= c->MaxPrec) {
+ /*
+ * a = xxxxxxAxxx
+ * c = xxxxxx
+ * a_pos = |
+ */
+ *a_pos = left_word;
+ if (*a_pos <= round_limit) {
+ *av = a->frac[*a_pos]; /* av is 'A' shown in above. */
+ }
+ }
+ else {
+ /*
+ * a = xxxxxxx
+ * c = xxxxxxxxxx
+ * a_pos = |
+ */
+ *a_pos = a->Prec;
+ }
+ if (b->Prec + word_shift >= c->MaxPrec) {
+ /*
+ * a = xxxxxxxxx
+ * b = xxxxxxxBxxx
+ * c = xxxxxxxxxxx
+ * b_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];
+ }
+ }
+ else {
+ *b_pos = -1L;
+ }
+ }
+ else {
+ /*
+ * a = xxxxxxxxxxxxxxxx
+ * b = xxxxxx
+ * c = xxxxxxxxxxxxx
+ * b_pos = |
+ */
+ *b_pos = b->Prec;
+ }
+ }
+ else { /* The MaxPrec of c - 1 > The Prec of a + b */
+ /*
+ * a = xxxxxxx
+ * b = xxxxxx
+ * c = xxxxxxxxxxx
+ * c_pos = |
+ */
+ *b_pos = b->Prec;
+ *a_pos = a->Prec;
+ *c_pos = right_word + 1;
}
c->Prec = *c_pos;
c->exponent = a->exponent;
- if(!AddExponent(c,1)) return (size_t)-1L;
+ if (!AddExponent(c, 1)) return (size_t)-1L;
return word_shift;
}
/*
- * Return number og significant digits
+ * Return number of significant digits
* c = a * b , Where a = a0a1a2 ... an
* b = b0b1b2 ... bm
* c = c0c1c2 ... cl
@@ -4404,33 +4532,33 @@ VpMult(Real *c, Real *a, Real *b)
Real *w;
#ifdef BIGDECIMAL_DEBUG
- if(gfDebug) {
- VPrint(stdout, "VpMult(Enter): a=% \n", a);
- VPrint(stdout, " b=% \n", b);
+ if (gfDebug) {
+ VPrint(stdout, "VpMult(Enter): a=% \n", a);
+ VPrint(stdout, " b=% \n", b);
}
#endif /* BIGDECIMAL_DEBUG */
- if(!VpIsDefOP(c,a,b,3)) return 0; /* No significant digit */
+ if (!VpIsDefOP(c, a, b, 3)) return 0; /* No significant digit */
- if(VpIsZero(a) || VpIsZero(b)) {
- /* at least a or b is zero */
- VpSetZero(c,VpGetSign(a)*VpGetSign(b));
- return 1; /* 0: 1 significant digit */
+ if (VpIsZero(a) || VpIsZero(b)) {
+ /* at least a or b is zero */
+ VpSetZero(c, VpGetSign(a) * VpGetSign(b));
+ return 1; /* 0: 1 significant digit */
}
- if(VpIsOne(a)) {
- VpAsgn(c, b, VpGetSign(a));
- goto Exit;
+ if (VpIsOne(a)) {
+ VpAsgn(c, b, VpGetSign(a));
+ goto Exit;
}
- if(VpIsOne(b)) {
- VpAsgn(c, a, VpGetSign(b));
- goto Exit;
+ if (VpIsOne(b)) {
+ VpAsgn(c, a, VpGetSign(b));
+ goto Exit;
}
- if((b->Prec) >(a->Prec)) {
- /* Adjust so that digits(a)>digits(b) */
- w = a;
- a = b;
- b = w;
+ if (b->Prec > a->Prec) {
+ /* Adjust so that digits(a)>digits(b) */
+ w = a;
+ a = b;
+ b = w;
}
w = NULL;
MxIndA = a->Prec - 1;
@@ -4438,78 +4566,82 @@ VpMult(Real *c, Real *a, Real *b)
MxIndC = c->MaxPrec - 1;
MxIndAB = a->Prec + b->Prec - 1;
- if(MxIndC < MxIndAB) { /* The Max. prec. of c < Prec(a)+Prec(b) */
- w = c;
- c = VpAlloc((size_t)((MxIndAB + 1) * BASE_FIG), "#0");
- MxIndC = MxIndAB;
+ if (MxIndC < MxIndAB) { /* The Max. prec. of c < Prec(a)+Prec(b) */
+ w = c;
+ c = VpAlloc((size_t)((MxIndAB + 1) * BASE_FIG), "#0");
+ MxIndC = MxIndAB;
}
/* set LHSV c info */
c->exponent = a->exponent; /* set exponent */
- if(!AddExponent(c,b->exponent)) {
- if(w) VpFree(c);
+ if (!AddExponent(c, b->exponent)) {
+ if (w) VpFree(c);
return 0;
}
- VpSetSign(c,VpGetSign(a)*VpGetSign(b)); /* set sign */
+ VpSetSign(c, VpGetSign(a) * VpGetSign(b)); /* set sign */
carry = 0;
nc = ind_c = MxIndAB;
memset(c->frac, 0, (nc + 1) * sizeof(BDIGIT)); /* Initialize c */
c->Prec = nc + 1; /* set precision */
- for(nc = 0; nc < MxIndAB; ++nc, --ind_c) {
- if(nc < MxIndB) { /* The left triangle of the Fig. */
- ind_as = MxIndA - nc;
- ind_ae = MxIndA;
- ind_bs = MxIndB;
- } else if(nc <= MxIndA) { /* The middle rectangular of the Fig. */
- ind_as = MxIndA - nc;
- ind_ae = MxIndA -(nc - MxIndB);
- ind_bs = MxIndB;
- } else if(nc > MxIndA) { /* The right triangle of the Fig. */
- ind_as = 0;
- ind_ae = MxIndAB - nc - 1;
- ind_bs = MxIndB -(nc - MxIndA);
- }
+ for (nc = 0; nc < MxIndAB; ++nc, --ind_c) {
+ if (nc < MxIndB) { /* The left triangle of the Fig. */
+ ind_as = MxIndA - nc;
+ ind_ae = MxIndA;
+ ind_bs = MxIndB;
+ }
+ else if (nc <= MxIndA) { /* The middle rectangular of the Fig. */
+ ind_as = MxIndA - nc;
+ ind_ae = MxIndA - (nc - MxIndB);
+ ind_bs = MxIndB;
+ }
+ else /* if (nc > MxIndA) */ { /* The right triangle of the Fig. */
+ ind_as = 0;
+ ind_ae = MxIndAB - nc - 1;
+ ind_bs = MxIndB - (nc - MxIndA);
+ }
- for(i = ind_as; i <= ind_ae; ++i) {
- s = (BDIGIT_DBL)a->frac[i] * b->frac[ind_bs--];
- carry = (BDIGIT)(s / BASE);
- s -= (BDIGIT_DBL)carry * BASE;
- c->frac[ind_c] += (BDIGIT)s;
- if(c->frac[ind_c] >= BASE) {
- s = c->frac[ind_c] / BASE;
- carry += (BDIGIT)s;
- c->frac[ind_c] -= (BDIGIT)(s * BASE);
- }
- if(carry) {
- ii = ind_c;
- while(ii-- > 0) {
- c->frac[ii] += carry;
- if(c->frac[ii] >= BASE) {
- carry = c->frac[ii] / BASE;
- c->frac[ii] -= (carry * BASE);
- } else {
- break;
- }
- }
- }
- }
+ for (i = ind_as; i <= ind_ae; ++i) {
+ s = (BDIGIT_DBL)a->frac[i] * b->frac[ind_bs--];
+ carry = (BDIGIT)(s / BASE);
+ s -= (BDIGIT_DBL)carry * BASE;
+ c->frac[ind_c] += (BDIGIT)s;
+ if (c->frac[ind_c] >= BASE) {
+ s = c->frac[ind_c] / BASE;
+ carry += (BDIGIT)s;
+ c->frac[ind_c] -= (BDIGIT)(s * BASE);
+ }
+ if (carry) {
+ ii = ind_c;
+ while (ii-- > 0) {
+ c->frac[ii] += carry;
+ if (c->frac[ii] >= BASE) {
+ carry = c->frac[ii] / BASE;
+ c->frac[ii] -= (carry * BASE);
+ }
+ else {
+ break;
+ }
+ }
+ }
+ }
}
- if(w != NULL) { /* free work variable */
- VpNmlz(c);
- VpAsgn(w, c, 1);
- VpFree(c);
- c = w;
- } else {
- VpLimitRound(c,0);
+ if (w != NULL) { /* free work variable */
+ VpNmlz(c);
+ VpAsgn(w, c, 1);
+ VpFree(c);
+ c = w;
+ }
+ else {
+ VpLimitRound(c,0);
}
Exit:
#ifdef BIGDECIMAL_DEBUG
- if(gfDebug) {
- VPrint(stdout, "VpMult(c=a*b): c=% \n", c);
- VPrint(stdout, " a=% \n", a);
- VPrint(stdout, " b=% \n", b);
+ if (gfDebug) {
+ VPrint(stdout, "VpMult(c=a*b): c=% \n", c);
+ VPrint(stdout, " a=% \n", a);
+ VPrint(stdout, " b=% \n", b);
}
#endif /*BIGDECIMAL_DEBUG */
return c->Prec*BASE_FIG;
@@ -4518,7 +4650,7 @@ Exit:
/*
* c = a / b, remainder = r
*/
-VP_EXPORT size_t
+ VP_EXPORT size_t
VpDivd(Real *c, Real *r, Real *a, Real *b)
{
size_t word_a, word_b, word_c, word_r;
@@ -4529,33 +4661,33 @@ VpDivd(Real *c, Real *r, Real *a, Real *b)
BDIGIT_DBL qb;
#ifdef BIGDECIMAL_DEBUG
- if(gfDebug) {
- VPrint(stdout, " VpDivd(c=a/b) a=% \n", a);
- VPrint(stdout, " b=% \n", b);
+ if (gfDebug) {
+ VPrint(stdout, " VpDivd(c=a/b) a=% \n", a);
+ VPrint(stdout, " b=% \n", b);
}
#endif /*BIGDECIMAL_DEBUG */
VpSetNaN(r);
- if(!VpIsDefOP(c,a,b,4)) goto Exit;
- if(VpIsZero(a)&&VpIsZero(b)) {
- VpSetNaN(c);
- return VpException(VP_EXCEPTION_NaN,"(VpDivd) 0/0 not defined(NaN)",0);
+ if (!VpIsDefOP(c, a, b, 4)) goto Exit;
+ if (VpIsZero(a) && VpIsZero(b)) {
+ VpSetNaN(c);
+ return VpException(VP_EXCEPTION_NaN, "(VpDivd) 0/0 not defined(NaN)", 0);
}
- if(VpIsZero(b)) {
- VpSetInf(c,VpGetSign(a)*VpGetSign(b));
- return VpException(VP_EXCEPTION_ZERODIVIDE,"(VpDivd) Divide by zero",0);
+ if (VpIsZero(b)) {
+ VpSetInf(c, VpGetSign(a) * VpGetSign(b));
+ return VpException(VP_EXCEPTION_ZERODIVIDE, "(VpDivd) Divide by zero", 0);
}
- if(VpIsZero(a)) {
- /* numerator a is zero */
- VpSetZero(c,VpGetSign(a)*VpGetSign(b));
- VpSetZero(r,VpGetSign(a)*VpGetSign(b));
- goto Exit;
+ if (VpIsZero(a)) {
+ /* numerator a is zero */
+ VpSetZero(c, VpGetSign(a) * VpGetSign(b));
+ VpSetZero(r, VpGetSign(a) * VpGetSign(b));
+ goto Exit;
}
- if(VpIsOne(b)) {
- /* divide by one */
- VpAsgn(c, a, VpGetSign(b));
- VpSetZero(r,VpGetSign(a));
- goto Exit;
+ if (VpIsOne(b)) {
+ /* divide by one */
+ VpAsgn(c, a, VpGetSign(b));
+ VpSetZero(r, VpGetSign(a));
+ goto Exit;
}
word_a = a->Prec;
@@ -4566,25 +4698,26 @@ VpDivd(Real *c, Real *r, Real *a, Real *b)
ind_c = 0;
ind_r = 1;
- if(word_a >= word_r) goto space_error;
+ if (word_a >= word_r) goto space_error;
r->frac[0] = 0;
- while(ind_r <= word_a) {
- r->frac[ind_r] = a->frac[ind_r - 1];
- ++ind_r;
+ while (ind_r <= word_a) {
+ r->frac[ind_r] = a->frac[ind_r - 1];
+ ++ind_r;
}
- while(ind_r < word_r) r->frac[ind_r++] = 0;
- while(ind_c < word_c) c->frac[ind_c++] = 0;
+ while (ind_r < word_r) r->frac[ind_r++] = 0;
+ while (ind_c < word_c) c->frac[ind_c++] = 0;
/* initial procedure */
b1 = b1p1 = b->frac[0];
- if(b->Prec <= 1) {
- b1b2p1 = b1b2 = b1p1 * BASE;
- } else {
- b1p1 = b1 + 1;
- b1b2p1 = b1b2 = b1 * BASE + b->frac[1];
- if(b->Prec > 2) ++b1b2p1;
+ if (b->Prec <= 1) {
+ b1b2p1 = b1b2 = b1p1 * BASE;
+ }
+ else {
+ b1p1 = b1 + 1;
+ b1b2p1 = b1b2 = b1 * BASE + b->frac[1];
+ if (b->Prec > 2) ++b1b2p1;
}
/* */
@@ -4592,141 +4725,144 @@ VpDivd(Real *c, Real *r, Real *a, Real *b)
ind_c = word_r - 1;
nLoop = Min(word_c,ind_c);
ind_c = 1;
- while(ind_c < nLoop) {
- if(r->frac[ind_c] == 0) {
- ++ind_c;
- continue;
- }
- r1r2 = (BDIGIT_DBL)r->frac[ind_c] * BASE + r->frac[ind_c + 1];
- if(r1r2 == b1b2) {
- /* The first two word digits is the same */
- ind_b = 2;
- ind_a = ind_c + 2;
- while(ind_b < word_b) {
- if(r->frac[ind_a] < b->frac[ind_b]) goto div_b1p1;
- if(r->frac[ind_a] > b->frac[ind_b]) break;
- ++ind_a;
- ++ind_b;
- }
- /* The first few word digits of r and b is the same and */
- /* the first different word digit of w is greater than that */
- /* of b, so quotinet is 1 and just subtract b from r. */
- borrow = 0; /* quotient=1, then just r-b */
- ind_b = b->Prec - 1;
- ind_r = ind_c + ind_b;
- if(ind_r >= word_r) goto space_error;
- n = ind_b;
- for(i = 0; i <= n; ++i) {
- if(r->frac[ind_r] < b->frac[ind_b] + borrow) {
- r->frac[ind_r] += (BASE - (b->frac[ind_b] + borrow));
- borrow = 1;
- } else {
- r->frac[ind_r] = r->frac[ind_r] - b->frac[ind_b] - borrow;
- borrow = 0;
- }
- --ind_r;
- --ind_b;
- }
- ++c->frac[ind_c];
- goto carry;
- }
- /* The first two word digits is not the same, */
- /* then compare magnitude, and divide actually. */
- if(r1r2 >= b1b2p1) {
- q = r1r2 / b1b2p1; /* q == (BDIGIT)q */
- c->frac[ind_c] += (BDIGIT)q;
- ind_r = b->Prec + ind_c - 1;
- goto sub_mult;
- }
+ while (ind_c < nLoop) {
+ if (r->frac[ind_c] == 0) {
+ ++ind_c;
+ continue;
+ }
+ r1r2 = (BDIGIT_DBL)r->frac[ind_c] * BASE + r->frac[ind_c + 1];
+ if (r1r2 == b1b2) {
+ /* The first two word digits is the same */
+ ind_b = 2;
+ ind_a = ind_c + 2;
+ while (ind_b < word_b) {
+ if (r->frac[ind_a] < b->frac[ind_b]) goto div_b1p1;
+ if (r->frac[ind_a] > b->frac[ind_b]) break;
+ ++ind_a;
+ ++ind_b;
+ }
+ /* The first few word digits of r and b is the same and */
+ /* the first different word digit of w is greater than that */
+ /* of b, so quotient is 1 and just subtract b from r. */
+ borrow = 0; /* quotient=1, then just r-b */
+ ind_b = b->Prec - 1;
+ ind_r = ind_c + ind_b;
+ if (ind_r >= word_r) goto space_error;
+ n = ind_b;
+ for (i = 0; i <= n; ++i) {
+ if (r->frac[ind_r] < b->frac[ind_b] + borrow) {
+ r->frac[ind_r] += (BASE - (b->frac[ind_b] + borrow));
+ borrow = 1;
+ }
+ else {
+ r->frac[ind_r] = r->frac[ind_r] - b->frac[ind_b] - borrow;
+ borrow = 0;
+ }
+ --ind_r;
+ --ind_b;
+ }
+ ++c->frac[ind_c];
+ goto carry;
+ }
+ /* The first two word digits is not the same, */
+ /* then compare magnitude, and divide actually. */
+ if (r1r2 >= b1b2p1) {
+ q = r1r2 / b1b2p1; /* q == (BDIGIT)q */
+ c->frac[ind_c] += (BDIGIT)q;
+ ind_r = b->Prec + ind_c - 1;
+ goto sub_mult;
+ }
div_b1p1:
- if(ind_c + 1 >= word_c) goto out_side;
- q = r1r2 / b1p1; /* q == (BDIGIT)q */
- c->frac[ind_c + 1] += (BDIGIT)q;
- ind_r = b->Prec + ind_c;
+ if (ind_c + 1 >= word_c) goto out_side;
+ q = r1r2 / b1p1; /* q == (BDIGIT)q */
+ c->frac[ind_c + 1] += (BDIGIT)q;
+ ind_r = b->Prec + ind_c;
sub_mult:
- borrow1 = borrow2 = 0;
- ind_b = word_b - 1;
- if(ind_r >= word_r) goto space_error;
- n = ind_b;
- for(i = 0; i <= n; ++i) {
- /* now, perform r = r - q * b */
- qb = q * b->frac[ind_b];
- if (qb < BASE) borrow1 = 0;
- else {
- borrow1 = (BDIGIT)(qb / BASE);
- qb -= (BDIGIT_DBL)borrow1 * BASE; /* get qb < BASE */
- }
- if(r->frac[ind_r] < qb) {
- r->frac[ind_r] += (BDIGIT)(BASE - qb);
- borrow2 = borrow2 + borrow1 + 1;
- } else {
- r->frac[ind_r] -= (BDIGIT)qb;
- borrow2 += borrow1;
- }
- if(borrow2) {
- if(r->frac[ind_r - 1] < borrow2) {
- r->frac[ind_r - 1] += (BASE - borrow2);
- borrow2 = 1;
- } else {
- r->frac[ind_r - 1] -= borrow2;
- borrow2 = 0;
- }
- }
- --ind_r;
- --ind_b;
- }
+ borrow1 = borrow2 = 0;
+ ind_b = word_b - 1;
+ if (ind_r >= word_r) goto space_error;
+ n = ind_b;
+ for (i = 0; i <= n; ++i) {
+ /* now, perform r = r - q * b */
+ qb = q * b->frac[ind_b];
+ if (qb < BASE) borrow1 = 0;
+ else {
+ borrow1 = (BDIGIT)(qb / BASE);
+ qb -= (BDIGIT_DBL)borrow1 * BASE; /* get qb < BASE */
+ }
+ if(r->frac[ind_r] < qb) {
+ r->frac[ind_r] += (BDIGIT)(BASE - qb);
+ borrow2 = borrow2 + borrow1 + 1;
+ }
+ else {
+ r->frac[ind_r] -= (BDIGIT)qb;
+ borrow2 += borrow1;
+ }
+ if (borrow2) {
+ if(r->frac[ind_r - 1] < borrow2) {
+ r->frac[ind_r - 1] += (BASE - borrow2);
+ borrow2 = 1;
+ }
+ else {
+ r->frac[ind_r - 1] -= borrow2;
+ borrow2 = 0;
+ }
+ }
+ --ind_r;
+ --ind_b;
+ }
- r->frac[ind_r] -= borrow2;
+ r->frac[ind_r] -= borrow2;
carry:
- ind_r = ind_c;
- while(c->frac[ind_r] >= BASE) {
- c->frac[ind_r] -= BASE;
- --ind_r;
- ++c->frac[ind_r];
- }
+ ind_r = ind_c;
+ while (c->frac[ind_r] >= BASE) {
+ c->frac[ind_r] -= BASE;
+ --ind_r;
+ ++c->frac[ind_r];
+ }
}
/* End of operation, now final arrangement */
out_side:
c->Prec = word_c;
c->exponent = a->exponent;
- if(!AddExponent(c,2)) return 0;
- if(!AddExponent(c,-(b->exponent))) return 0;
+ if (!AddExponent(c, 2)) return 0;
+ if (!AddExponent(c, -(b->exponent))) return 0;
- VpSetSign(c,VpGetSign(a)*VpGetSign(b));
+ VpSetSign(c, VpGetSign(a) * VpGetSign(b));
VpNmlz(c); /* normalize c */
r->Prec = word_r;
r->exponent = a->exponent;
- if(!AddExponent(r,1)) return 0;
- VpSetSign(r,VpGetSign(a));
+ if (!AddExponent(r, 1)) return 0;
+ VpSetSign(r, VpGetSign(a));
VpNmlz(r); /* normalize r(remainder) */
goto Exit;
space_error:
#ifdef BIGDECIMAL_DEBUG
- if(gfDebug) {
- 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);
+ if (gfDebug) {
+ 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.");
Exit:
#ifdef BIGDECIMAL_DEBUG
- if(gfDebug) {
- VPrint(stdout, " VpDivd(c=a/b), c=% \n", c);
- VPrint(stdout, " r=% \n", r);
+ if (gfDebug) {
+ VPrint(stdout, " VpDivd(c=a/b), c=% \n", c);
+ VPrint(stdout, " r=% \n", r);
}
#endif /* BIGDECIMAL_DEBUG */
- return c->Prec*BASE_FIG;
+ return c->Prec * BASE_FIG;
}
/*
- * Input a = 00000xxxxxxxx En(5 preceeding zeros)
+ * Input a = 00000xxxxxxxx En(5 preceding zeros)
* Output a = xxxxxxxx En-5
*/
static int
@@ -4739,17 +4875,17 @@ VpNmlz(Real *a)
ind_a = a->Prec;
while (ind_a--) {
- if (a->frac[ind_a]) {
- a->Prec = ind_a + 1;
- i = 0;
- while (a->frac[i] == 0) ++i; /* skip the first few zeros */
- if (i) {
- a->Prec -= i;
- if (!AddExponent(a, -(SIGNED_VALUE)i)) return 0;
- memmove(&a->frac[0], &a->frac[i], a->Prec*sizeof(BDIGIT));
- }
- return 1;
- }
+ if (a->frac[ind_a]) {
+ a->Prec = ind_a + 1;
+ i = 0;
+ while (a->frac[i] == 0) ++i; /* skip the first few zeros */
+ if (i) {
+ a->Prec -= i;
+ if (!AddExponent(a, -(SIGNED_VALUE)i)) return 0;
+ memmove(&a->frac[0], &a->frac[i], a->Prec*sizeof(BDIGIT));
+ }
+ return 1;
+ }
}
/* a is zero(no non-zero digit) */
VpSetZero(a, VpGetSign(a));
@@ -4774,85 +4910,86 @@ VpComp(Real *a, Real *b)
size_t mx, ind;
int e;
val = 0;
- if(VpIsNaN(a)||VpIsNaN(b)) return 999;
- if(!VpIsDef(a)) {
- if(!VpIsDef(b)) e = a->sign - b->sign;
- else e = a->sign;
- if(e>0) return 1;
- else if(e<0) return -1;
- else return 0;
- }
- if(!VpIsDef(b)) {
- e = -b->sign;
- if(e>0) return 1;
- else return -1;
+ if (VpIsNaN(a) || VpIsNaN(b)) return 999;
+ if (!VpIsDef(a)) {
+ if (!VpIsDef(b)) e = a->sign - b->sign;
+ else e = a->sign;
+
+ if (e > 0) return 1;
+ else if (e < 0) return -1;
+ else return 0;
+ }
+ if (!VpIsDef(b)) {
+ e = -b->sign;
+ if (e > 0) return 1;
+ else return -1;
}
/* Zero check */
- if(VpIsZero(a)) {
- if(VpIsZero(b)) return 0; /* both zero */
- val = -VpGetSign(b);
- goto Exit;
+ if (VpIsZero(a)) {
+ if (VpIsZero(b)) return 0; /* both zero */
+ val = -VpGetSign(b);
+ goto Exit;
}
- if(VpIsZero(b)) {
- val = VpGetSign(a);
- goto Exit;
+ if (VpIsZero(b)) {
+ val = VpGetSign(a);
+ goto Exit;
}
/* compare sign */
- if(VpGetSign(a) > VpGetSign(b)) {
- val = 1; /* a>b */
- goto Exit;
+ if (VpGetSign(a) > VpGetSign(b)) {
+ val = 1; /* a>b */
+ goto Exit;
}
- if(VpGetSign(a) < VpGetSign(b)) {
- val = -1; /* a<b */
- goto Exit;
+ if (VpGetSign(a) < VpGetSign(b)) {
+ val = -1; /* a<b */
+ goto Exit;
}
- /* a and b have same sign, && signe!=0,then compare exponent */
- if((a->exponent) >(b->exponent)) {
- val = VpGetSign(a);
- goto Exit;
+ /* a and b have same sign, && sign!=0,then compare exponent */
+ if (a->exponent > b->exponent) {
+ val = VpGetSign(a);
+ goto Exit;
}
- if((a->exponent) <(b->exponent)) {
- val = -VpGetSign(b);
- goto Exit;
+ if (a->exponent < b->exponent) {
+ val = -VpGetSign(b);
+ goto Exit;
}
/* a and b have same exponent, then compare significand. */
- mx =((a->Prec) <(b->Prec)) ?(a->Prec) :(b->Prec);
+ mx = (a->Prec < b->Prec) ? a->Prec : b->Prec;
ind = 0;
- while(ind < mx) {
- if((a->frac[ind]) >(b->frac[ind])) {
- val = VpGetSign(a);
- goto Exit;
- }
- if((a->frac[ind]) <(b->frac[ind])) {
- val = -VpGetSign(b);
- goto Exit;
- }
- ++ind;
+ while (ind < mx) {
+ if (a->frac[ind] > b->frac[ind]) {
+ val = VpGetSign(a);
+ goto Exit;
+ }
+ if (a->frac[ind] < b->frac[ind]) {
+ val = -VpGetSign(b);
+ goto Exit;
+ }
+ ++ind;
+ }
+ if (a->Prec > b->Prec) {
+ val = VpGetSign(a);
}
- if((a->Prec) >(b->Prec)) {
- val = VpGetSign(a);
- } else if((a->Prec) <(b->Prec)) {
- val = -VpGetSign(b);
+ else if (a->Prec < b->Prec) {
+ val = -VpGetSign(b);
}
Exit:
- if (val> 1) val = 1;
- else if(val<-1) val = -1;
+ if (val > 1) val = 1;
+ else if (val < -1) val = -1;
#ifdef BIGDECIMAL_DEBUG
- if(gfDebug) {
- VPrint(stdout, " VpComp a=%\n", a);
- VPrint(stdout, " b=%\n", b);
- printf(" ans=%d\n", val);
+ if (gfDebug) {
+ VPrint(stdout, " VpComp a=%\n", a);
+ VPrint(stdout, " b=%\n", b);
+ printf(" ans=%d\n", val);
}
#endif /* BIGDECIMAL_DEBUG */
return (int)val;
}
-#ifdef BIGDECIMAL_ENABLE_VPRINT
/*
* cntl_chr ... ASCIIZ Character, print control characters
* Available control codes:
@@ -4863,98 +5000,114 @@ Exit:
* Note: % must must not appear more than once
* a ... VP variable to be printed
*/
-VP_EXPORT int
+#ifdef BIGDECIMAL_ENABLE_VPRINT
+static int
VPrint(FILE *fp, const char *cntl_chr, Real *a)
{
- size_t i, j, nc, nd, ZeroSup;
+ size_t i, j, nc, nd, ZeroSup, sep = 10;
BDIGIT m, e, nn;
/* Check if NaN & Inf. */
- if(VpIsNaN(a)) {
- fprintf(fp,SZ_NaN);
- return 8;
+ if (VpIsNaN(a)) {
+ fprintf(fp, SZ_NaN);
+ return 8;
}
- if(VpIsPosInf(a)) {
- fprintf(fp,SZ_INF);
- return 8;
+ if (VpIsPosInf(a)) {
+ fprintf(fp, SZ_INF);
+ return 8;
}
- if(VpIsNegInf(a)) {
- fprintf(fp,SZ_NINF);
- return 9;
+ if (VpIsNegInf(a)) {
+ fprintf(fp, SZ_NINF);
+ return 9;
}
- if(VpIsZero(a)) {
- fprintf(fp,"0.0");
- return 3;
+ if (VpIsZero(a)) {
+ fprintf(fp, "0.0");
+ return 3;
}
j = 0;
nd = nc = 0; /* nd : number of digits in fraction part(every 10 digits, */
/* nd<=10). */
- /* nc : number of caracters printed */
+ /* nc : number of characters printed */
ZeroSup = 1; /* Flag not to print the leading zeros as 0.00xxxxEnn */
- while(*(cntl_chr + j)) {
- if((*(cntl_chr + j) == '%') &&(*(cntl_chr + j + 1) != '%')) {
- nc = 0;
- if(!VpIsZero(a)) {
- if(VpGetSign(a) < 0) {
- fprintf(fp, "-");
- ++nc;
- }
- nc += fprintf(fp, "0.");
- for(i=0; i < a->Prec; ++i) {
+ while (*(cntl_chr + j)) {
+ if (*(cntl_chr + j) == '%' && *(cntl_chr + j + 1) != '%') {
+ nc = 0;
+ if (!VpIsZero(a)) {
+ if (VpGetSign(a) < 0) {
+ fprintf(fp, "-");
+ ++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];
- while(m) {
- nn = e / m;
- if((!ZeroSup) || nn) {
- nc += fprintf(fp, "%lu", (unsigned long)nn); /* The leading zero(s) */
- /* as 0.00xx will not */
- /* be printed. */
- ++nd;
- ZeroSup = 0; /* Set to print succeeding zeros */
- }
- if(nd >= 10) { /* print ' ' after every 10 digits */
- nd = 0;
- nc += fprintf(fp, " ");
- }
- e = e - nn * m;
- m /= 10;
- }
- }
- nc += fprintf(fp, "E%"PRIdSIZE, VpExponent10(a));
- } else {
- nc += fprintf(fp, "0.0");
- }
- } else {
- ++nc;
- if(*(cntl_chr + j) == '\\') {
- switch(*(cntl_chr + j + 1)) {
- case 'n':
- fprintf(fp, "\n");
- ++j;
- break;
- case 't':
- fprintf(fp, "\t");
- ++j;
- break;
- case 'b':
- fprintf(fp, "\n");
- ++j;
- break;
- default:
- fprintf(fp, "%c", *(cntl_chr + j));
- break;
- }
- } else {
- fprintf(fp, "%c", *(cntl_chr + j));
- if(*(cntl_chr + j) == '%') ++j;
- }
- }
- j++;
+ e = a->frac[i];
+ while (m) {
+ nn = e / m;
+ if (!ZeroSup || nn) {
+ nc += fprintf(fp, "%lu", (unsigned long)nn); /* The leading zero(s) */
+ /* as 0.00xx will not */
+ /* be printed. */
+ ++nd;
+ ZeroSup = 0; /* Set to print succeeding zeros */
+ }
+ if (nd >= sep) { /* print ' ' after every 10 digits */
+ nd = 0;
+ nc += fprintf(fp, " ");
+ }
+ e = e - nn * m;
+ m /= 10;
+ }
+ }
+ 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");
+ }
+ }
+ else {
+ ++nc;
+ if (*(cntl_chr + j) == '\\') {
+ switch (*(cntl_chr + j + 1)) {
+ case 'n':
+ fprintf(fp, "\n");
+ ++j;
+ break;
+ case 't':
+ fprintf(fp, "\t");
+ ++j;
+ break;
+ case 'b':
+ fprintf(fp, "\n");
+ ++j;
+ break;
+ default:
+ fprintf(fp, "%c", *(cntl_chr + j));
+ break;
+ }
+ }
+ else {
+ fprintf(fp, "%c", *(cntl_chr + j));
+ if (*(cntl_chr + j) == '%') ++j;
+ }
+ }
+ j++;
}
+
return (int)nc;
}
-#endif /* BIGDECIMAL_ENABLE_VPRINT */
+#endif
static void
VpFormatSt(char *psz, size_t fFmt)
@@ -4962,22 +5115,22 @@ VpFormatSt(char *psz, size_t fFmt)
size_t ie, i, nf = 0;
char ch;
- if(fFmt<=0) return;
+ if (fFmt == 0) return;
ie = strlen(psz);
- for(i = 0; i < ie; ++i) {
- ch = psz[i];
- if(!ch) break;
- if(ISSPACE(ch) || ch=='-' || ch=='+') continue;
- if(ch == '.') { nf = 0;continue;}
- if(ch == 'E') break;
- nf++;
- if(nf > fFmt) {
- memmove(psz + i + 1, psz + i, ie - i + 1);
- ++ie;
- nf = 0;
- psz[i] = ' ';
- }
+ for (i = 0; i < ie; ++i) {
+ ch = psz[i];
+ if (!ch) break;
+ if (ISSPACE(ch) || ch=='-' || ch=='+') continue;
+ if (ch == '.') { nf = 0; continue; }
+ if (ch == 'E') break;
+
+ if (++nf > fFmt) {
+ memmove(psz + i + 1, psz + i, ie - i + 1);
+ ++ie;
+ nf = 0;
+ psz[i] = ' ';
+ }
}
}
@@ -4992,8 +5145,8 @@ VpExponent10(Real *a)
ex = a->exponent * (ssize_t)BASE_FIG;
n = BASE1;
while ((a->frac[0] / n) == 0) {
- --ex;
- n /= 10;
+ --ex;
+ n /= 10;
}
return ex;
}
@@ -5004,75 +5157,78 @@ VpSzMantissa(Real *a,char *psz)
size_t i, n, ZeroSup;
BDIGIT_DBL m, e, nn;
- if(VpIsNaN(a)) {
- sprintf(psz,SZ_NaN);
- return;
+ if (VpIsNaN(a)) {
+ sprintf(psz, SZ_NaN);
+ return;
}
- if(VpIsPosInf(a)) {
- sprintf(psz,SZ_INF);
- return;
+ if (VpIsPosInf(a)) {
+ sprintf(psz, SZ_INF);
+ return;
}
- if(VpIsNegInf(a)) {
- sprintf(psz,SZ_NINF);
- return;
+ if (VpIsNegInf(a)) {
+ sprintf(psz, SZ_NINF);
+ return;
}
ZeroSup = 1; /* Flag not to print the leading zeros as 0.00xxxxEnn */
- if(!VpIsZero(a)) {
- if(VpGetSign(a) < 0) *psz++ = '-';
- n = a->Prec;
- for (i=0; i < n; ++i) {
- m = BASE1;
- e = a->frac[i];
- while (m) {
- nn = e / m;
- if((!ZeroSup) || nn) {
- sprintf(psz, "%lu", (unsigned long)nn); /* The leading zero(s) */
- psz += strlen(psz);
- /* as 0.00xx will be ignored. */
- ZeroSup = 0; /* Set to print succeeding zeros */
- }
- e = e - nn * m;
- m /= 10;
- }
- }
- *psz = 0;
- while(psz[-1]=='0') *(--psz) = 0;
- } else {
- if(VpIsPosZero(a)) sprintf(psz, "0");
- else sprintf(psz, "-0");
+ if (!VpIsZero(a)) {
+ if (VpGetSign(a) < 0) *psz++ = '-';
+ n = a->Prec;
+ for (i = 0; i < n; ++i) {
+ m = BASE1;
+ e = a->frac[i];
+ while (m) {
+ nn = e / m;
+ if (!ZeroSup || nn) {
+ sprintf(psz, "%lu", (unsigned long)nn); /* The leading zero(s) */
+ psz += strlen(psz);
+ /* as 0.00xx will be ignored. */
+ ZeroSup = 0; /* Set to print succeeding zeros */
+ }
+ e = e - nn * m;
+ m /= 10;
+ }
+ }
+ *psz = 0;
+ while (psz[-1] == '0') *(--psz) = 0;
+ }
+ else {
+ if (VpIsPosZero(a)) sprintf(psz, "0");
+ else sprintf(psz, "-0");
}
}
VP_EXPORT int
VpToSpecialString(Real *a,char *psz,int fPlus)
-/* fPlus =0:default, =1: set ' ' before digits , =2: set '+' before digits. */
+ /* fPlus =0:default, =1: set ' ' before digits , =2: set '+' before digits. */
{
- if(VpIsNaN(a)) {
- sprintf(psz,SZ_NaN);
- return 1;
+ if (VpIsNaN(a)) {
+ sprintf(psz,SZ_NaN);
+ return 1;
}
- if(VpIsPosInf(a)) {
- if(fPlus==1) {
- *psz++ = ' ';
- } else if(fPlus==2) {
- *psz++ = '+';
- }
- sprintf(psz,SZ_INF);
- return 1;
+ if (VpIsPosInf(a)) {
+ if (fPlus == 1) {
+ *psz++ = ' ';
+ }
+ else if (fPlus == 2) {
+ *psz++ = '+';
+ }
+ sprintf(psz, SZ_INF);
+ return 1;
}
- if(VpIsNegInf(a)) {
- sprintf(psz,SZ_NINF);
- return 1;
+ if (VpIsNegInf(a)) {
+ sprintf(psz, SZ_NINF);
+ return 1;
}
- if(VpIsZero(a)) {
- if(VpIsPosZero(a)) {
- if(fPlus==1) sprintf(psz, " 0.0");
- else if(fPlus==2) sprintf(psz, "+0.0");
- else sprintf(psz, "0.0");
- } else sprintf(psz, "-0.0");
- return 1;
+ if (VpIsZero(a)) {
+ if (VpIsPosZero(a)) {
+ if (fPlus == 1) sprintf(psz, " 0.0");
+ else if (fPlus == 2) sprintf(psz, "+0.0");
+ else sprintf(psz, "0.0");
+ }
+ else sprintf(psz, "-0.0");
+ return 1;
}
return 0;
}
@@ -5097,30 +5253,32 @@ VpToString(Real *a, char *psz, size_t fFmt, int fPlus)
*psz++ = '0';
*psz++ = '.';
n = a->Prec;
- for(i=0;i < n;++i) {
- m = BASE1;
- e = a->frac[i];
- while(m) {
- nn = e / m;
- if((!ZeroSup) || nn) {
- sprintf(psz, "%lu", (unsigned long)nn); /* The reading zero(s) */
- psz += strlen(psz);
- /* as 0.00xx will be ignored. */
- ZeroSup = 0; /* Set to print succeeding zeros */
- }
- e = e - nn * m;
- m /= 10;
- }
+ for (i = 0; i < n; ++i) {
+ m = BASE1;
+ e = a->frac[i];
+ while (m) {
+ nn = e / m;
+ if (!ZeroSup || nn) {
+ sprintf(psz, "%lu", (unsigned long)nn); /* The reading zero(s) */
+ psz += strlen(psz);
+ /* as 0.00xx will be ignored. */
+ ZeroSup = 0; /* Set to print succeeding zeros */
+ }
+ e = e - nn * m;
+ m /= 10;
+ }
}
ex = a->exponent * (ssize_t)BASE_FIG;
shift = BASE1;
- while(a->frac[0] / shift == 0) {
- --ex;
- shift /= 10;
+ while (a->frac[0] / shift == 0) {
+ --ex;
+ shift /= 10;
+ }
+ while (psz[-1] == '0') {
+ *(--psz) = 0;
}
- while(psz[-1]=='0') *(--psz) = 0;
sprintf(psz, "E%"PRIdSIZE, ex);
- if(fFmt) VpFormatSt(pszSav, fFmt);
+ if (fFmt) VpFormatSt(pszSav, fFmt);
}
VP_EXPORT void
@@ -5132,49 +5290,50 @@ VpToFString(Real *a, char *psz, size_t fFmt, int fPlus)
char *pszSav = psz;
ssize_t ex;
- if(VpToSpecialString(a,psz,fPlus)) return;
+ if (VpToSpecialString(a, psz, fPlus)) return;
- if(VpGetSign(a) < 0) *psz++ = '-';
- else if(fPlus==1) *psz++ = ' ';
- else if(fPlus==2) *psz++ = '+';
+ if (VpGetSign(a) < 0) *psz++ = '-';
+ else if (fPlus == 1) *psz++ = ' ';
+ else if (fPlus == 2) *psz++ = '+';
n = a->Prec;
ex = a->exponent;
- if(ex<=0) {
- *psz++ = '0';*psz++ = '.';
- while(ex<0) {
- for(i=0;i<BASE_FIG;++i) *psz++ = '0';
- ++ex;
- }
- ex = -1;
- }
-
- for(i=0;i < n;++i) {
- --ex;
- if(i==0 && ex >= 0) {
- sprintf(psz, "%lu", (unsigned long)a->frac[i]);
- psz += strlen(psz);
- } else {
- m = BASE1;
- e = a->frac[i];
- while(m) {
- nn = e / m;
- *psz++ = (char)(nn + '0');
- e = e - nn * m;
- m /= 10;
- }
- }
- if(ex == 0) *psz++ = '.';
- }
- while(--ex>=0) {
- m = BASE;
- while(m/=10) *psz++ = '0';
- if(ex == 0) *psz++ = '.';
+ if (ex <= 0) {
+ *psz++ = '0';*psz++ = '.';
+ while (ex < 0) {
+ for (i=0; i < BASE_FIG; ++i) *psz++ = '0';
+ ++ex;
+ }
+ ex = -1;
+ }
+
+ for (i = 0; i < n; ++i) {
+ --ex;
+ if (i == 0 && ex >= 0) {
+ sprintf(psz, "%lu", (unsigned long)a->frac[i]);
+ psz += strlen(psz);
+ }
+ else {
+ m = BASE1;
+ e = a->frac[i];
+ while (m) {
+ nn = e / m;
+ *psz++ = (char)(nn + '0');
+ e = e - nn * m;
+ m /= 10;
+ }
+ }
+ if (ex == 0) *psz++ = '.';
+ }
+ while (--ex>=0) {
+ m = BASE;
+ while (m /= 10) *psz++ = '0';
+ if (ex == 0) *psz++ = '.';
}
*psz = 0;
- while(psz[-1]=='0') *(--psz) = 0;
- if(psz[-1]=='.') sprintf(psz, "0");
- if(fFmt) VpFormatSt(pszSav, fFmt);
+ while (psz[-1] == '0') *(--psz) = 0;
+ if (psz[-1] == '.') sprintf(psz, "0");
+ if (fFmt) VpFormatSt(pszSav, fFmt);
}
/*
@@ -5204,40 +5363,51 @@ VpCtoV(Real *a, const char *int_chr, size_t ni, const char *frac, size_t nf, con
exponent_overflow = 0;
memset(a->frac, 0, ma * sizeof(BDIGIT));
if (ne > 0) {
- i = 0;
- if (exp_chr[0] == '-') {
- signe = -1;
- ++i;
- ++me;
- }
+ i = 0;
+ if (exp_chr[0] == '-') {
+ signe = -1;
+ ++i;
+ ++me;
+ }
else if (exp_chr[0] == '+') {
- ++i;
- ++me;
- }
- while (i < me) {
- es = e * (SIGNED_VALUE)BASE_FIG;
- e = e * 10 + exp_chr[i] - '0';
- if (es > (SIGNED_VALUE)(e*BASE_FIG)) {
+ ++i;
+ ++me;
+ }
+ while (i < me) {
+ if (MUL_OVERFLOW_SIGNED_VALUE_P(e, (SIGNED_VALUE)BASE_FIG)) {
+ es = e;
+ goto exp_overflow;
+ }
+ es = e * (SIGNED_VALUE)BASE_FIG;
+ if (MUL_OVERFLOW_SIGNED_VALUE_P(e, 10) ||
+ SIGNED_VALUE_MAX - (exp_chr[i] - '0') < e * 10)
+ goto exp_overflow;
+ e = e * 10 + exp_chr[i] - '0';
+ if (MUL_OVERFLOW_SIGNED_VALUE_P(e, (SIGNED_VALUE)BASE_FIG))
+ goto exp_overflow;
+ if (es > (SIGNED_VALUE)(e * BASE_FIG)) {
+ exp_overflow:
exponent_overflow = 1;
e = es; /* keep sign */
break;
- }
- ++i;
- }
+ }
+ ++i;
+ }
}
/* get integer part */
i = 0;
sign = 1;
- if(1 /*ni >= 0*/) {
- if(int_chr[0] == '-') {
- sign = -1;
- ++i;
- ++mi;
- } else if(int_chr[0] == '+') {
- ++i;
- ++mi;
- }
+ if (1 /*ni >= 0*/) {
+ if (int_chr[0] == '-') {
+ sign = -1;
+ ++i;
+ ++mi;
+ }
+ else if (int_chr[0] == '+') {
+ ++i;
+ ++mi;
+ }
}
e = signe * e; /* e: The value of exponent part. */
@@ -5250,14 +5420,14 @@ VpCtoV(Real *a, const char *int_chr, size_t ni, const char *frac, size_t nf, con
j = 0;
ef = 1;
while (ef) {
- if (e >= 0) eb = e;
- else eb = -e;
- ef = eb / (SIGNED_VALUE)BASE_FIG;
- ef = eb - ef * (SIGNED_VALUE)BASE_FIG;
- if (ef) {
- ++j; /* Means to add one more preceeding zero */
- ++e;
- }
+ if (e >= 0) eb = e;
+ else eb = -e;
+ ef = eb / (SIGNED_VALUE)BASE_FIG;
+ ef = eb - ef * (SIGNED_VALUE)BASE_FIG;
+ if (ef) {
+ ++j; /* Means to add one more preceding zero */
+ ++e;
+ }
}
eb = e / (SIGNED_VALUE)BASE_FIG;
@@ -5276,33 +5446,33 @@ VpCtoV(Real *a, const char *int_chr, size_t ni, const char *frac, size_t nf, con
ind_a = 0;
while (i < mi) {
- a->frac[ind_a] = 0;
- while ((j < BASE_FIG) && (i < mi)) {
- a->frac[ind_a] = a->frac[ind_a] * 10 + int_chr[i] - '0';
- ++j;
- ++i;
- }
- if (i < mi) {
- ++ind_a;
- if (ind_a >= ma) goto over_flow;
- j = 0;
- }
+ a->frac[ind_a] = 0;
+ while (j < BASE_FIG && i < mi) {
+ a->frac[ind_a] = a->frac[ind_a] * 10 + int_chr[i] - '0';
+ ++j;
+ ++i;
+ }
+ if (i < mi) {
+ ++ind_a;
+ if (ind_a >= ma) goto over_flow;
+ j = 0;
+ }
}
/* get fraction part */
i = 0;
- while(i < nf) {
- while((j < BASE_FIG) && (i < nf)) {
- a->frac[ind_a] = a->frac[ind_a] * 10 + frac[i] - '0';
- ++j;
- ++i;
- }
- if(i < nf) {
- ++ind_a;
- if(ind_a >= ma) goto over_flow;
- j = 0;
- }
+ while (i < nf) {
+ while (j < BASE_FIG && i < nf) {
+ a->frac[ind_a] = a->frac[ind_a] * 10 + frac[i] - '0';
+ ++j;
+ ++i;
+ }
+ if (i < nf) {
+ ++ind_a;
+ if (ind_a >= ma) goto over_flow;
+ j = 0;
+ }
}
goto Final;
@@ -5312,12 +5482,12 @@ over_flow:
Final:
if (ind_a >= ma) ind_a = ma - 1;
while (j < BASE_FIG) {
- a->frac[ind_a] = a->frac[ind_a] * 10;
- ++j;
+ a->frac[ind_a] = a->frac[ind_a] * 10;
+ ++j;
}
a->Prec = ind_a + 1;
a->exponent = eb;
- VpSetSign(a,sign);
+ VpSetSign(a, sign);
VpNmlz(a);
return 1;
}
@@ -5344,55 +5514,55 @@ VpVtoD(double *d, SIGNED_VALUE *e, Real *m)
double div;
int f = 1;
- if(VpIsNaN(m)) {
- *d = VpGetDoubleNaN();
- *e = 0;
- f = -1; /* NaN */
- goto Exit;
- } else
- if(VpIsPosZero(m)) {
- *d = 0.0;
- *e = 0;
- f = 0;
- goto Exit;
- } else
- if(VpIsNegZero(m)) {
- *d = VpGetDoubleNegZero();
- *e = 0;
- f = 0;
- goto Exit;
- } else
- if(VpIsPosInf(m)) {
- *d = VpGetDoublePosInf();
- *e = 0;
- f = 2;
- goto Exit;
- } else
- if(VpIsNegInf(m)) {
- *d = VpGetDoubleNegInf();
- *e = 0;
- f = 2;
- goto Exit;
+ if (VpIsNaN(m)) {
+ *d = VpGetDoubleNaN();
+ *e = 0;
+ f = -1; /* NaN */
+ goto Exit;
+ }
+ else if (VpIsPosZero(m)) {
+ *d = 0.0;
+ *e = 0;
+ f = 0;
+ goto Exit;
+ }
+ else if (VpIsNegZero(m)) {
+ *d = VpGetDoubleNegZero();
+ *e = 0;
+ f = 0;
+ goto Exit;
+ }
+ else if (VpIsPosInf(m)) {
+ *d = VpGetDoublePosInf();
+ *e = 0;
+ f = 2;
+ goto Exit;
+ }
+ else if (VpIsNegInf(m)) {
+ *d = VpGetDoubleNegInf();
+ *e = 0;
+ f = 2;
+ goto Exit;
}
/* Normal number */
- fig =(DBLE_FIG + BASE_FIG - 1) / BASE_FIG;
+ fig = (DBLE_FIG + BASE_FIG - 1) / BASE_FIG;
ind_m = 0;
- mm = Min(fig,(m->Prec));
+ mm = Min(fig, m->Prec);
*d = 0.0;
div = 1.;
- while(ind_m < mm) {
- div /= (double)BASE;
- *d = *d + (double)m->frac[ind_m++] * div;
+ while (ind_m < mm) {
+ div /= (double)BASE;
+ *d = *d + (double)m->frac[ind_m++] * div;
}
*e = m->exponent * (SIGNED_VALUE)BASE_FIG;
*d *= VpGetSign(m);
Exit:
#ifdef BIGDECIMAL_DEBUG
- if(gfDebug) {
- VPrint(stdout, " VpVtoD: m=%\n", m);
- printf(" d=%e * 10 **%ld\n", *d, *e);
- printf(" DBLE_FIG = %d\n", DBLE_FIG);
+ if (gfDebug) {
+ VPrint(stdout, " VpVtoD: m=%\n", m);
+ printf(" d=%e * 10 **%ld\n", *d, *e);
+ printf(" DBLE_FIG = %d\n", DBLE_FIG);
}
#endif /*BIGDECIMAL_DEBUG */
return f;
@@ -5409,57 +5579,58 @@ VpDtoV(Real *m, double d)
BDIGIT i;
double val, val2;
- if(isnan(d)) {
- VpSetNaN(m);
- goto Exit;
+ if (isnan(d)) {
+ VpSetNaN(m);
+ goto Exit;
}
- if(isinf(d)) {
- if(d>0.0) VpSetPosInf(m);
- else VpSetNegInf(m);
- goto Exit;
+ if (isinf(d)) {
+ if (d > 0.0) VpSetPosInf(m);
+ else VpSetNegInf(m);
+ goto Exit;
}
- if(d == 0.0) {
- VpSetZero(m,1);
- goto Exit;
+ if (d == 0.0) {
+ VpSetZero(m, 1);
+ goto Exit;
}
- val =(d > 0.) ? d :(-d);
+ val = (d > 0.) ? d : -d;
ne = 0;
- if(val >= 1.0) {
- while(val >= 1.0) {
- val /= (double)BASE;
- ++ne;
- }
- } else {
- val2 = 1.0 /(double)BASE;
- while(val < val2) {
- val *= (double)BASE;
- --ne;
- }
+ if (val >= 1.0) {
+ while (val >= 1.0) {
+ val /= (double)BASE;
+ ++ne;
+ }
+ }
+ else {
+ val2 = 1.0 / (double)BASE;
+ while (val < val2) {
+ val *= (double)BASE;
+ --ne;
+ }
}
/* Now val = 0.xxxxx*BASE**ne */
mm = m->MaxPrec;
memset(m->frac, 0, mm * sizeof(BDIGIT));
- for(ind_m = 0;val > 0.0 && ind_m < mm;ind_m++) {
- val *= (double)BASE;
- i = (BDIGIT)val;
- val -= (double)i;
- m->frac[ind_m] = i;
+ for (ind_m = 0; val > 0.0 && ind_m < mm; ind_m++) {
+ val *= (double)BASE;
+ i = (BDIGIT)val;
+ val -= (double)i;
+ m->frac[ind_m] = i;
}
- if(ind_m >= mm) ind_m = mm - 1;
+ if (ind_m >= mm) ind_m = mm - 1;
VpSetSign(m, (d > 0.0) ? 1 : -1);
m->Prec = ind_m + 1;
m->exponent = ne;
VpInternalRound(m, 0, (m->Prec > 0) ? m->frac[m->Prec-1] : 0,
- (BDIGIT)(val*(double)BASE));
+ (BDIGIT)(val*(double)BASE));
Exit:
#ifdef BIGDECIMAL_DEBUG
- if(gfDebug) {
- printf("VpDtoV d=%30.30e\n", d);
- VPrint(stdout, " m=%\n", m);
+ if (gfDebug) {
+ printf("VpDtoV d=%30.30e\n", d);
+ VPrint(stdout, " m=%\n", m);
}
#endif /* BIGDECIMAL_DEBUG */
return;
@@ -5477,51 +5648,52 @@ VpItoV(Real *m, SIGNED_VALUE ival)
int isign;
SIGNED_VALUE ne;
- if(ival == 0) {
- VpSetZero(m,1);
- goto Exit;
+ if (ival == 0) {
+ VpSetZero(m, 1);
+ goto Exit;
}
isign = 1;
val = ival;
- if(ival < 0) {
- isign = -1;
- val =(size_t)(-ival);
+ if (ival < 0) {
+ isign = -1;
+ val =(size_t)(-ival);
}
ne = 0;
ind_m = 0;
mm = m->MaxPrec;
- while(ind_m < mm) {
- m->frac[ind_m] = 0;
- ++ind_m;
+ while (ind_m < mm) {
+ m->frac[ind_m] = 0;
+ ++ind_m;
}
ind_m = 0;
- while(val > 0) {
- if(val) {
- v1 = val;
- v2 = 1;
- while(v1 >= BASE) {
- v1 /= BASE;
- v2 *= BASE;
- }
- val = val - v2 * v1;
- v = v1;
- } else {
- v = 0;
- }
- m->frac[ind_m] = v;
- ++ind_m;
- ++ne;
+ while (val > 0) {
+ if (val) {
+ v1 = val;
+ v2 = 1;
+ while (v1 >= BASE) {
+ v1 /= BASE;
+ v2 *= BASE;
+ }
+ val = val - v2 * v1;
+ v = v1;
+ }
+ else {
+ v = 0;
+ }
+ m->frac[ind_m] = v;
+ ++ind_m;
+ ++ne;
}
m->Prec = ind_m - 1;
m->exponent = ne;
- VpSetSign(m,isign);
+ VpSetSign(m, isign);
VpNmlz(m);
Exit:
#ifdef BIGDECIMAL_DEBUG
- if(gfDebug) {
- printf(" VpItoV i=%d\n", ival);
- VPrint(stdout, " m=%\n", m);
+ if (gfDebug) {
+ printf(" VpItoV i=%d\n", ival);
+ VPrint(stdout, " m=%\n", m);
}
#endif /* BIGDECIMAL_DEBUG */
return;
@@ -5543,30 +5715,31 @@ VpSqrt(Real *y, Real *x)
double val;
/* Zero, NaN or Infinity ? */
- if(!VpHasVal(x)) {
- if(VpIsZero(x)||VpGetSign(x)>0) {
- VpAsgn(y,x,1);
- goto Exit;
- }
- VpSetNaN(y);
- return VpException(VP_EXCEPTION_OP,"(VpSqrt) SQRT(NaN or negative value)",0);
- goto Exit;
+ if (!VpHasVal(x)) {
+ if (VpIsZero(x) || VpGetSign(x) > 0) {
+ VpAsgn(y,x,1);
+ goto Exit;
+ }
+ VpSetNaN(y);
+ return VpException(VP_EXCEPTION_OP, "(VpSqrt) SQRT(NaN or negative value)", 0);
+ goto Exit;
}
- /* Negative ? */
- if(VpGetSign(x) < 0) {
- VpSetNaN(y);
- return VpException(VP_EXCEPTION_OP,"(VpSqrt) SQRT(negative value)",0);
+ /* Negative ? */
+ if (VpGetSign(x) < 0) {
+ VpSetNaN(y);
+ return VpException(VP_EXCEPTION_OP, "(VpSqrt) SQRT(negative value)", 0);
}
/* One ? */
- if(VpIsOne(x)) {
- VpSetOne(y);
- goto Exit;
+ if (VpIsOne(x)) {
+ VpSetOne(y);
+ goto Exit;
}
n = (SIGNED_VALUE)y->MaxPrec;
if (x->MaxPrec > (size_t)n) n = (ssize_t)x->MaxPrec;
+
/* allocate temporally variables */
f = VpAlloc(y->MaxPrec * (BASE_FIG + 2), "#1");
r = VpAlloc((n + n) * (BASE_FIG + 2), "#1");
@@ -5584,8 +5757,8 @@ VpSqrt(Real *y, Real *x)
e /= (SIGNED_VALUE)BASE_FIG;
n = e / 2;
if (e - n * 2 != 0) {
- val /= BASE;
- n = (e + 1) / 2;
+ val /= BASE;
+ n = (e + 1) / 2;
}
VpDtoV(y, sqrt(val)); /* y <- sqrt(val) */
y->exponent += n;
@@ -5595,22 +5768,20 @@ VpSqrt(Real *y, Real *x)
n = (SIGNED_VALUE)(y_prec * BASE_FIG);
if (n < (SIGNED_VALUE)maxnr) n = (SIGNED_VALUE)maxnr;
do {
- y->MaxPrec *= 2;
- if (y->MaxPrec > y_prec) y->MaxPrec = y_prec;
- f->MaxPrec = y->MaxPrec;
- VpDivd(f, r, x, y); /* f = x/y */
- VpAddSub(r, f, y, -1); /* r = f - y */
- VpMult(f, VpPt5, r); /* f = 0.5*r */
- if(VpIsZero(f)) goto converge;
- VpAddSub(r, f, y, 1); /* r = y + f */
- VpAsgn(y, r, 1); /* y = r */
- if(f->exponent <= prec) goto converge;
- } while(++nr < n);
- /* */
+ y->MaxPrec *= 2;
+ if (y->MaxPrec > y_prec) y->MaxPrec = y_prec;
+ f->MaxPrec = y->MaxPrec;
+ VpDivd(f, r, x, y); /* f = x/y */
+ VpAddSub(r, f, y, -1); /* r = f - y */
+ VpMult(f, VpPt5, r); /* f = 0.5*r */
+ if (VpIsZero(f)) goto converge;
+ VpAddSub(r, f, y, 1); /* r = y + f */
+ VpAsgn(y, r, 1); /* y = r */
+ } while (++nr < n);
+
#ifdef BIGDECIMAL_DEBUG
- if(gfDebug) {
- printf("ERROR(VpSqrt): did not converge within %ld iterations.\n",
- nr);
+ if (gfDebug) {
+ printf("ERROR(VpSqrt): did not converge within %ld iterations.\n", nr);
}
#endif /* BIGDECIMAL_DEBUG */
y->MaxPrec = y_prec;
@@ -5618,13 +5789,13 @@ VpSqrt(Real *y, Real *x)
converge:
VpChangeSign(y, 1);
#ifdef BIGDECIMAL_DEBUG
- if(gfDebug) {
- VpMult(r, y, y);
- VpAddSub(f, x, r, -1);
- printf("VpSqrt: iterations = %"PRIdSIZE"\n", nr);
- VPrint(stdout, " y =% \n", y);
- VPrint(stdout, " x =% \n", x);
- VPrint(stdout, " x-y*y = % \n", f);
+ if (gfDebug) {
+ VpMult(r, y, y);
+ VpAddSub(f, x, r, -1);
+ printf("VpSqrt: iterations = %"PRIdSIZE"\n", nr);
+ VPrint(stdout, " y =% \n", y);
+ VPrint(stdout, " x =% \n", x);
+ VPrint(stdout, " x-y*y = % \n", f);
}
#endif /* BIGDECIMAL_DEBUG */
y->MaxPrec = y_prec;
@@ -5643,9 +5814,9 @@ Exit:
VP_EXPORT int
VpMidRound(Real *y, unsigned short f, ssize_t nf)
/*
- * Round reletively from the decimal point.
+ * Round relatively from the decimal point.
* f: rounding mode
- * nf: digit location to round from the the decimal point.
+ * nf: digit location to round from the decimal point.
*/
{
/* fracf: any positive digit under rounding position? */
@@ -5660,8 +5831,8 @@ VpMidRound(Real *y, unsigned short f, ssize_t nf)
exptoadd=0;
if (nf < 0) {
/* rounding position too left(large). */
- if((f!=VP_ROUND_CEIL) && (f!=VP_ROUND_FLOOR)) {
- VpSetZero(y,VpGetSign(y)); /* truncate everything */
+ if (f != VP_ROUND_CEIL && f != VP_ROUND_FLOOR) {
+ VpSetZero(y, VpGetSign(y)); /* truncate everything */
return 0;
}
exptoadd = -nf;
@@ -5674,7 +5845,7 @@ VpMidRound(Real *y, unsigned short f, ssize_t nf)
ioffset = nf - ix*(ssize_t)BASE_FIG;
n = (ssize_t)BASE_FIG - ioffset - 1;
- for (shifter=1,i=0; i<n; ++i) shifter *= 10;
+ for (shifter = 1, i = 0; i < n; ++i) shifter *= 10;
/* so the representation used (in y->frac) is an array of BDIGIT, where
each BDIGIT contains a value between 0 and BASE-1, consisting of BASE_FIG
@@ -5683,20 +5854,25 @@ VpMidRound(Real *y, unsigned short f, ssize_t nf)
(that numbers of decimal places are typed as ssize_t is somewhat confusing)
nf is now position (in decimal places) of the digit from the start of
- the array.
+ the array.
+
ix is the position (in BDIGITS) of the BDIGIT containing the decimal digit,
- from the start of the array.
+ from the start of the array.
+
v is the value of this BDIGIT
+
ioffset is the number of extra decimal places along of this decimal digit
- within v.
+ within v.
+
n is the number of decimal digits remaining within v after this decimal digit
shifter is 10**n,
+
v % shifter are the remaining digits within v
v % (shifter * 10) are the digit together with the remaining digits within v
v / shifter are the digit's predecessors together with the digit
div = v / shifter / 10 is just the digit's precessors
(v / shifter) - div*10 is just the digit, which is what v ends up being reassigned to.
- */
+ */
fracf = (v % (shifter * 10) > 0);
fracf_1further = ((v % shifter) > 0);
@@ -5707,15 +5883,15 @@ VpMidRound(Real *y, unsigned short f, ssize_t nf)
/* now v is just the digit required.
now fracf is whether the digit or any of the remaining digits within v are non-zero
now fracf_1further is whether any of the remaining digits within v are non-zero
- */
+ */
/* now check all the remaining BDIGITS for zero-ness a whole BDIGIT at a time.
- if we spot any non-zeroness, that means that we foudn a positive digit under
+ if we spot any non-zeroness, that means that we found a positive digit under
rounding position, and we also found a positive digit under one further than
the rounding position, so both searches (to see if any such non-zero digit exists)
can stop */
- for (i=ix+1; (size_t)i < y->Prec; i++) {
+ for (i = ix + 1; (size_t)i < y->Prec; i++) {
if (y->frac[i] % BASE) {
fracf = fracf_1further = 1;
break;
@@ -5728,31 +5904,31 @@ VpMidRound(Real *y, unsigned short f, ssize_t nf)
now v = the first digit under the rounding position */
/* drop digits after pointed digit */
- memset(y->frac+ix+1, 0, (y->Prec - (ix+1)) * sizeof(BDIGIT));
+ memset(y->frac + ix + 1, 0, (y->Prec - (ix + 1)) * sizeof(BDIGIT));
- switch(f) {
- case VP_ROUND_DOWN: /* Truncate */
- break;
- case VP_ROUND_UP: /* Roundup */
- if (fracf) ++div;
+ switch (f) {
+ case VP_ROUND_DOWN: /* Truncate */
+ break;
+ case VP_ROUND_UP: /* Roundup */
+ if (fracf) ++div;
+ break;
+ case VP_ROUND_HALF_UP:
+ if (v>=5) ++div;
break;
- case VP_ROUND_HALF_UP:
- if (v>=5) ++div;
- break;
- case VP_ROUND_HALF_DOWN:
+ case VP_ROUND_HALF_DOWN:
if (v > 5 || (v == 5 && fracf_1further)) ++div;
- break;
- case VP_ROUND_CEIL:
- if (fracf && (VpGetSign(y)>0)) ++div;
- break;
- case VP_ROUND_FLOOR:
- if (fracf && (VpGetSign(y)<0)) ++div;
- break;
- case VP_ROUND_HALF_EVEN: /* Banker's rounding */
+ break;
+ case VP_ROUND_CEIL:
+ if (fracf && (VpGetSign(y) > 0)) ++div;
+ break;
+ case VP_ROUND_FLOOR:
+ if (fracf && (VpGetSign(y) < 0)) ++div;
+ break;
+ case VP_ROUND_HALF_EVEN: /* Banker's rounding */
if (v > 5) ++div;
else if (v == 5) {
if (fracf_1further) {
- ++div;
+ ++div;
}
else {
if (ioffset == 0) {
@@ -5770,32 +5946,34 @@ VpMidRound(Real *y, unsigned short f, ssize_t nf)
}
break;
}
- for (i=0; i<=n; ++i) div *= 10;
- if (div>=BASE) {
- if(ix) {
- y->frac[ix] = 0;
- VpRdup(y,ix);
- } else {
- short s = VpGetSign(y);
- SIGNED_VALUE e = y->exponent;
- VpSetOne(y);
- VpSetSign(y, s);
- y->exponent = e+1;
- }
- } else {
- y->frac[ix] = div;
- VpNmlz(y);
+ for (i = 0; i <= n; ++i) div *= 10;
+ if (div >= BASE) {
+ if (ix) {
+ y->frac[ix] = 0;
+ VpRdup(y, ix);
+ }
+ else {
+ short s = VpGetSign(y);
+ SIGNED_VALUE e = y->exponent;
+ VpSetOne(y);
+ VpSetSign(y, s);
+ y->exponent = e + 1;
+ }
+ }
+ else {
+ y->frac[ix] = div;
+ VpNmlz(y);
}
if (exptoadd > 0) {
- y->exponent += (SIGNED_VALUE)(exptoadd/BASE_FIG);
- exptoadd %= (ssize_t)BASE_FIG;
- for(i=0;i<exptoadd;i++) {
- y->frac[0] *= 10;
- if (y->frac[0] >= BASE) {
- y->frac[0] /= BASE;
- y->exponent++;
- }
- }
+ y->exponent += (SIGNED_VALUE)(exptoadd / BASE_FIG);
+ exptoadd %= (ssize_t)BASE_FIG;
+ for (i = 0; i < exptoadd; i++) {
+ y->frac[0] *= 10;
+ if (y->frac[0] >= BASE) {
+ y->frac[0] /= BASE;
+ y->exponent++;
+ }
+ }
}
return 1;
}
@@ -5809,10 +5987,10 @@ VpLeftRound(Real *y, unsigned short f, ssize_t nf)
BDIGIT v;
if (!VpHasVal(y)) return 0; /* Unable to round */
v = y->frac[0];
- nf -= VpExponent(y)*(ssize_t)BASE_FIG;
+ nf -= VpExponent(y) * (ssize_t)BASE_FIG;
while ((v /= 10) != 0) nf--;
nf += (ssize_t)BASE_FIG-1;
- return VpMidRound(y,f,nf);
+ return VpMidRound(y, f, nf);
}
VP_EXPORT int
@@ -5820,17 +5998,17 @@ VpActiveRound(Real *y, Real *x, unsigned short f, ssize_t nf)
{
/* First,assign whole value in truncation mode */
if (VpAsgn(y, x, 10) <= 1) return 0; /* Zero,NaN,or Infinity */
- return VpMidRound(y,f,nf);
+ return VpMidRound(y, f, nf);
}
static int
VpLimitRound(Real *c, size_t ixDigit)
{
size_t ix = VpGetPrecLimit();
- if(!VpNmlz(c)) return -1;
- if(!ix) return 0;
- if(!ixDigit) ixDigit = c->Prec-1;
- if((ix+BASE_FIG-1)/BASE_FIG > ixDigit+1) return 0;
+ if (!VpNmlz(c)) return -1;
+ if (!ix) return 0;
+ if (!ixDigit) ixDigit = c->Prec-1;
+ if ((ix + BASE_FIG - 1) / BASE_FIG > ixDigit + 1) return 0;
return VpLeftRound(c, VpGetRoundMode(), (ssize_t)ix);
}
@@ -5848,27 +6026,27 @@ VpInternalRound(Real *c, size_t ixDigit, BDIGIT vPrev, BDIGIT v)
v /= BASE1;
switch (rounding_mode) {
- case VP_ROUND_DOWN:
+ case VP_ROUND_DOWN:
break;
- case VP_ROUND_UP:
+ case VP_ROUND_UP:
if (v) f = 1;
break;
- case VP_ROUND_HALF_UP:
+ case VP_ROUND_HALF_UP:
if (v >= 5) f = 1;
break;
- case VP_ROUND_HALF_DOWN:
+ case VP_ROUND_HALF_DOWN:
/* this is ok - because this is the last digit of precision,
the case where v == 5 and some further digits are nonzero
will never occur */
if (v >= 6) f = 1;
break;
- case VP_ROUND_CEIL:
+ case VP_ROUND_CEIL:
if (v && (VpGetSign(c) > 0)) f = 1;
break;
- case VP_ROUND_FLOOR:
+ case VP_ROUND_FLOOR:
if (v && (VpGetSign(c) < 0)) f = 1;
break;
- case VP_ROUND_HALF_EVEN: /* Banker's rounding */
+ case VP_ROUND_HALF_EVEN: /* Banker's rounding */
/* as per VP_ROUND_HALF_DOWN, because this is the last digit of precision,
there is no case to worry about where v == 5 and some further digits are nonzero */
if (v > 5) f = 1;
@@ -5892,16 +6070,17 @@ VpRdup(Real *m, size_t ind_m)
if (!ind_m) ind_m = m->Prec;
carry = 1;
- while (carry > 0 && (ind_m--)) {
- m->frac[ind_m] += carry;
- if (m->frac[ind_m] >= BASE) m->frac[ind_m] -= BASE;
- else carry = 0;
- }
- if(carry > 0) { /* Overflow,count exponent and set fraction part be 1 */
- if (!AddExponent(m, 1)) return 0;
- m->Prec = m->frac[0] = 1;
- } else {
- VpNmlz(m);
+ while (carry > 0 && ind_m--) {
+ m->frac[ind_m] += carry;
+ if (m->frac[ind_m] >= BASE) m->frac[ind_m] -= BASE;
+ else carry = 0;
+ }
+ if (carry > 0) { /* Overflow,count exponent and set fraction part be 1 */
+ if (!AddExponent(m, 1)) return 0;
+ m->Prec = m->frac[0] = 1;
+ }
+ else {
+ VpNmlz(m);
}
return 1;
}
@@ -5914,18 +6093,18 @@ VpFrac(Real *y, Real *x)
{
size_t my, ind_y, ind_x;
- if(!VpHasVal(x)) {
- VpAsgn(y,x,1);
- goto Exit;
+ if (!VpHasVal(x)) {
+ VpAsgn(y, x, 1);
+ goto Exit;
}
if (x->exponent > 0 && (size_t)x->exponent >= x->Prec) {
- VpSetZero(y,VpGetSign(x));
- goto Exit;
+ VpSetZero(y, VpGetSign(x));
+ goto Exit;
}
- else if(x->exponent <= 0) {
- VpAsgn(y, x, 1);
- goto Exit;
+ else if (x->exponent <= 0) {
+ VpAsgn(y, x, 1);
+ goto Exit;
}
/* satisfy: x->exponent > 0 */
@@ -5933,22 +6112,22 @@ VpFrac(Real *y, Real *x)
y->Prec = x->Prec - (size_t)x->exponent;
y->Prec = Min(y->Prec, y->MaxPrec);
y->exponent = 0;
- VpSetSign(y,VpGetSign(x));
+ VpSetSign(y, VpGetSign(x));
ind_y = 0;
my = y->Prec;
ind_x = x->exponent;
- while(ind_y < my) {
- y->frac[ind_y] = x->frac[ind_x];
- ++ind_y;
- ++ind_x;
+ while (ind_y < my) {
+ y->frac[ind_y] = x->frac[ind_x];
+ ++ind_y;
+ ++ind_x;
}
VpNmlz(y);
Exit:
#ifdef BIGDECIMAL_DEBUG
- if(gfDebug) {
- VPrint(stdout, "VpFrac y=%\n", y);
- VPrint(stdout, " x=%\n", x);
+ if (gfDebug) {
+ VPrint(stdout, "VpFrac y=%\n", y);
+ VPrint(stdout, " x=%\n", x);
}
#endif /* BIGDECIMAL_DEBUG */
return;
@@ -5965,55 +6144,57 @@ VpPower(Real *y, Real *x, SIGNED_VALUE n)
Real *w1 = NULL;
Real *w2 = NULL;
- if(VpIsZero(x)) {
- if(n==0) {
- VpSetOne(y);
- goto Exit;
- }
- sign = VpGetSign(x);
- if(n<0) {
- n = -n;
- if(sign<0) sign = (n%2)?(-1):(1);
- VpSetInf (y,sign);
- } else {
- if(sign<0) sign = (n%2)?(-1):(1);
- VpSetZero(y,sign);
- }
- goto Exit;
+ if (VpIsZero(x)) {
+ if (n == 0) {
+ VpSetOne(y);
+ goto Exit;
+ }
+ sign = VpGetSign(x);
+ if (n < 0) {
+ n = -n;
+ if (sign < 0) sign = (n % 2) ? -1 : 1;
+ VpSetInf(y, sign);
+ }
+ else {
+ if (sign < 0) sign = (n % 2) ? -1 : 1;
+ VpSetZero(y,sign);
+ }
+ goto Exit;
}
- if(VpIsNaN(x)) {
- VpSetNaN(y);
- goto Exit;
+ if (VpIsNaN(x)) {
+ VpSetNaN(y);
+ goto Exit;
}
- if(VpIsInf(x)) {
- if(n==0) {
- VpSetOne(y);
- goto Exit;
- }
- if(n>0) {
- VpSetInf(y, (n%2==0 || VpIsPosInf(x)) ? 1 : -1);
- goto Exit;
- }
- VpSetZero(y, (n%2==0 || VpIsPosInf(x)) ? 1 : -1);
- goto Exit;
+ if (VpIsInf(x)) {
+ if (n == 0) {
+ VpSetOne(y);
+ goto Exit;
+ }
+ if (n > 0) {
+ VpSetInf(y, (n % 2 == 0 || VpIsPosInf(x)) ? 1 : -1);
+ goto Exit;
+ }
+ VpSetZero(y, (n % 2 == 0 || VpIsPosInf(x)) ? 1 : -1);
+ goto Exit;
}
- if((x->exponent == 1) &&(x->Prec == 1) &&(x->frac[0] == 1)) {
- /* abs(x) = 1 */
- VpSetOne(y);
- if(VpGetSign(x) > 0) goto Exit;
- if((n % 2) == 0) goto Exit;
- VpSetSign(y, -1);
- goto Exit;
+ if (x->exponent == 1 && x->Prec == 1 && x->frac[0] == 1) {
+ /* abs(x) = 1 */
+ VpSetOne(y);
+ if (VpGetSign(x) > 0) goto Exit;
+ if ((n % 2) == 0) goto Exit;
+ VpSetSign(y, -1);
+ goto Exit;
}
- if(n > 0) sign = 1;
- else if(n < 0) {
- sign = -1;
- n = -n;
- } else {
- VpSetOne(y);
- goto Exit;
+ if (n > 0) sign = 1;
+ else if (n < 0) {
+ sign = -1;
+ n = -n;
+ }
+ else {
+ VpSetOne(y);
+ goto Exit;
}
/* Allocate working variables */
@@ -6024,28 +6205,28 @@ VpPower(Real *y, Real *x, SIGNED_VALUE n)
VpAsgn(y, x, 1);
--n;
- while(n > 0) {
- VpAsgn(w1, x, 1);
- s = 1;
+ while (n > 0) {
+ VpAsgn(w1, x, 1);
+ s = 1;
while (ss = s, (s += s) <= (size_t)n) {
VpMult(w2, w1, w1);
VpAsgn(w1, w2, 1);
}
- n -= (SIGNED_VALUE)ss;
- VpMult(w2, y, w1);
- VpAsgn(y, w2, 1);
+ n -= (SIGNED_VALUE)ss;
+ VpMult(w2, y, w1);
+ VpAsgn(y, w2, 1);
}
- if(sign < 0) {
- VpDivd(w1, w2, VpConstOne, y);
- VpAsgn(y, w1, 1);
+ if (sign < 0) {
+ VpDivd(w1, w2, VpConstOne, y);
+ VpAsgn(y, w1, 1);
}
Exit:
#ifdef BIGDECIMAL_DEBUG
- if(gfDebug) {
- VPrint(stdout, "VpPower y=%\n", y);
- VPrint(stdout, "VpPower x=%\n", x);
- printf(" n=%d\n", n);
+ if (gfDebug) {
+ VPrint(stdout, "VpPower y=%\n", y);
+ VPrint(stdout, "VpPower x=%\n", x);
+ printf(" n=%d\n", n);
}
#endif /* BIGDECIMAL_DEBUG */
VpFree(w2);
@@ -6067,25 +6248,25 @@ VpVarCheck(Real * v)
{
size_t i;
- if(v->MaxPrec <= 0) {
- printf("ERROR(VpVarCheck): Illegal Max. Precision(=%"PRIuSIZE")\n",
- v->MaxPrec);
- return 1;
- }
- if((v->Prec <= 0) ||((v->Prec) >(v->MaxPrec))) {
- printf("ERROR(VpVarCheck): Illegal Precision(=%"PRIuSIZE")\n", v->Prec);
- printf(" Max. Prec.=%"PRIuSIZE"\n", v->MaxPrec);
- return 2;
- }
- for(i = 0; i < v->Prec; ++i) {
- if((v->frac[i] >= BASE)) {
- printf("ERROR(VpVarCheck): Illegal fraction\n");
- printf(" Frac[%"PRIuSIZE"]=%lu\n", i, v->frac[i]);
- printf(" Prec. =%"PRIuSIZE"\n", v->Prec);
- printf(" Exp. =%"PRIdVALUE"\n", v->exponent);
- printf(" BASE =%lu\n", BASE);
- return 3;
- }
+ if (v->MaxPrec == 0) {
+ printf("ERROR(VpVarCheck): Illegal Max. Precision(=%"PRIuSIZE")\n",
+ v->MaxPrec);
+ return 1;
+ }
+ if (v->Prec == 0 || v->Prec > v->MaxPrec) {
+ printf("ERROR(VpVarCheck): Illegal Precision(=%"PRIuSIZE")\n", v->Prec);
+ printf(" Max. Prec.=%"PRIuSIZE"\n", v->MaxPrec);
+ return 2;
+ }
+ for (i = 0; i < v->Prec; ++i) {
+ if (v->frac[i] >= BASE) {
+ printf("ERROR(VpVarCheck): Illegal fraction\n");
+ printf(" Frac[%"PRIuSIZE"]=%lu\n", i, v->frac[i]);
+ printf(" Prec. =%"PRIuSIZE"\n", v->Prec);
+ printf(" Exp. =%"PRIdVALUE"\n", v->exponent);
+ printf(" BASE =%lu\n", BASE);
+ return 3;
+ }
}
return 0;
}
diff --git a/ext/bigdecimal/bigdecimal.gemspec b/ext/bigdecimal/bigdecimal.gemspec
index 4240f827e4..e4f58c1adf 100644
--- a/ext/bigdecimal/bigdecimal.gemspec
+++ b/ext/bigdecimal/bigdecimal.gemspec
@@ -1,15 +1,16 @@
# -*- ruby -*-
-_VERSION = "1.2.0"
+_VERSION = "1.2.5"
+date = %w$Date:: $[1]
Gem::Specification.new do |s|
s.name = "bigdecimal"
s.version = _VERSION
- s.date = "2012-02-19"
+ s.date = date
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", "Shigeo Kobayashi"]
+ s.authors = ["Kenta Murata", "Zachary Scott", "Shigeo Kobayashi"]
s.require_path = %[.]
s.files = %w[
bigdecimal.gemspec
diff --git a/ext/bigdecimal/bigdecimal.h b/ext/bigdecimal/bigdecimal.h
index a04d1bbfea..9d3e0fcd29 100644
--- a/ext/bigdecimal/bigdecimal.h
+++ b/ext/bigdecimal/bigdecimal.h
@@ -19,6 +19,37 @@
#include "ruby/ruby.h"
#include <float.h>
+#ifndef RB_UNUSED_VAR
+# ifdef __GNUC__
+# define RB_UNUSED_VAR(x) x __attribute__ ((unused))
+# else
+# define RB_UNUSED_VAR(x) x
+# endif
+#endif
+
+#ifndef UNREACHABLE
+# define UNREACHABLE /* unreachable */
+#endif
+
+#undef BDIGIT
+#undef SIZEOF_BDIGITS
+#undef BDIGIT_DBL
+#undef BDIGIT_DBL_SIGNED
+#undef PRI_BDIGIT_PREFIX
+#undef PRI_BDIGIT_DBL_PREFIX
+
+#ifdef HAVE_INT64_T
+# define BDIGIT uint32_t
+# define BDIGIT_DBL uint64_t
+# define BDIGIT_DBL_SIGNED int64_t
+# define SIZEOF_BDIGITS 4
+#else
+# define BDIGIT uint16_t
+# define BDIGIT_DBL uint32_t
+# define BDIGIT_DBL_SIGNED int32_t
+# define SIZEOF_BDIGITS 2
+#endif
+
#if defined(__cplusplus)
extern "C" {
#if 0
@@ -97,7 +128,7 @@ extern VALUE rb_cBigDecimal;
#define VP_EXCEPTION_OVERFLOW ((unsigned short)0x0001) /* 0x0008) */
#define VP_EXCEPTION_ZERODIVIDE ((unsigned short)0x0010)
-/* Following 2 exceptions cann't controlled by user */
+/* Following 2 exceptions can't controlled by user */
#define VP_EXCEPTION_OP ((unsigned short)0x0020)
#define VP_EXCEPTION_MEMORY ((unsigned short)0x0040)
@@ -260,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) ( ((s)>0)?VpSetPosZero(a):VpSetNegZero(a) )
+#define VpSetZero(a,s) (void)(((s)>0)?VpSetPosZero(a):VpSetNegZero(a))
/* NaN */
#define VpIsNaN(a) ((a)->sign==VP_SIGN_NaN)
@@ -273,13 +304,12 @@ 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) ( ((s)>0)?VpSetPosInf(a):VpSetNegInf(a) )
+#define VpSetInf(a,s) (void)(((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 402cae95dd..0a83c1f17f 100644
--- a/ext/bigdecimal/depend
+++ b/ext/bigdecimal/depend
@@ -1 +1 @@
-bigdecimal.o: bigdecimal.c bigdecimal.h $(hdrdir)/ruby.h
+bigdecimal.o: bigdecimal.c bigdecimal.h $(HDRS) $(ruby_headers) $(hdrdir)/ruby/util.h
diff --git a/ext/bigdecimal/lib/bigdecimal/jacobian.rb b/ext/bigdecimal/lib/bigdecimal/jacobian.rb
index a416e06832..d56caab0d3 100644
--- a/ext/bigdecimal/lib/bigdecimal/jacobian.rb
+++ b/ext/bigdecimal/lib/bigdecimal/jacobian.rb
@@ -51,7 +51,6 @@ module Jacobian
dx = fx[i].abs/ratio if isEqual(dx,f.zero,f.zero,f.eps)
dx = f.one/f.ten if isEqual(dx,f.zero,f.zero,f.eps)
until ok>0 do
- s = f.zero
deriv = []
nRetry += 1
if nRetry > 100
@@ -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/math.rb b/ext/bigdecimal/lib/bigdecimal/math.rb
index 16cf9c8731..4a4fcc2b06 100644
--- a/ext/bigdecimal/lib/bigdecimal/math.rb
+++ b/ext/bigdecimal/lib/bigdecimal/math.rb
@@ -20,30 +20,40 @@ require 'bigdecimal'
#
# Example:
#
-# require "bigdecimal"
# require "bigdecimal/math"
#
# include BigMath
#
# a = BigDecimal((PI(100)/2).to_s)
-# puts sin(a,100) # -> 0.10000000000000000000......E1
+# puts sin(a,100) # => 0.10000000000000000000......E1
#
module BigMath
module_function
- # Computes the square root of x to the specified number of digits of
- # precision.
+ # call-seq:
+ # sqrt(decimal, numeric) -> BigDecimal
#
- # BigDecimal.new('2').sqrt(16).to_s
- # -> "0.14142135623730950488016887242096975E1"
+ # Computes the square root of +decimal+ to the specified number of digits of
+ # precision, +numeric+.
#
- def sqrt(x,prec)
+ # BigMath.sqrt(BigDecimal.new('2'), 16).to_s
+ # #=> "0.1414213562373095048801688724E1"
+ #
+ def sqrt(x, prec)
x.sqrt(prec)
end
- # Computes the sine of x to the specified number of digits of precision.
+ # call-seq:
+ # sin(decimal, numeric) -> BigDecimal
+ #
+ # Computes the sine of +decimal+ to the specified number of digits of
+ # precision, +numeric+.
+ #
+ # If +decimal+ is Infinity or NaN, returns NaN.
+ #
+ # BigMath.sin(BigMath.PI(5)/4, 5).to_s
+ # #=> "0.70710678118654752440082036563292800375E0"
#
- # If x is infinite or NaN, returns NaN.
def sin(x, prec)
raise ArgumentError, "Zero or negative precision for sin" if prec <= 0
return BigDecimal("NaN") if x.infinite? || x.nan?
@@ -77,9 +87,17 @@ module BigMath
neg ? -y : y
end
- # Computes the cosine of x to the specified number of digits of precision.
+ # call-seq:
+ # cos(decimal, numeric) -> BigDecimal
+ #
+ # Computes the cosine of +decimal+ to the specified number of digits of
+ # precision, +numeric+.
+ #
+ # If +decimal+ is Infinity or NaN, returns NaN.
+ #
+ # BigMath.cos(BigMath.PI(4), 16).to_s
+ # #=> "-0.999999999999999999999999999999856613163740061349E0"
#
- # If x is infinite or NaN, returns NaN.
def cos(x, prec)
raise ArgumentError, "Zero or negative precision for cos" if prec <= 0
return BigDecimal("NaN") if x.infinite? || x.nan?
@@ -113,9 +131,17 @@ module BigMath
y
end
- # Computes the arctangent of x to the specified number of digits of precision.
+ # call-seq:
+ # atan(decimal, numeric) -> BigDecimal
+ #
+ # Computes the arctangent of +decimal+ to the specified number of digits of
+ # precision, +numeric+.
+ #
+ # If +decimal+ is NaN, returns NaN.
+ #
+ # BigMath.atan(BigDecimal.new('-1'), 16).to_s
+ # #=> "-0.785398163397448309615660845819878471907514682065E0"
#
- # If x is NaN, returns NaN.
def atan(x, prec)
raise ArgumentError, "Zero or negative precision for atan" if prec <= 0
return BigDecimal("NaN") if x.nan?
@@ -144,9 +170,17 @@ module BigMath
y
end
- # Computes the value of pi to the specified number of digits of precision.
+ # call-seq:
+ # PI(numeric) -> BigDecimal
+ #
+ # Computes the value of pi to the specified number of digits of precision,
+ # +numeric+.
+ #
+ # BigMath.PI(10).to_s
+ # #=> "0.3141592653589793238462643388813853786957412E1"
+ #
def PI(prec)
- raise ArgumentError, "Zero or negative argument for PI" if prec <= 0
+ raise ArgumentError, "Zero or negative precision for PI" if prec <= 0
n = prec + BigDecimal.double_fig
zero = BigDecimal("0")
one = BigDecimal("1")
@@ -159,7 +193,6 @@ module BigMath
d = one
k = one
- w = one
t = BigDecimal("-80")
while d.nonzero? && ((m = n - (pi.exponent - d.exponent).abs) > 0)
m = BigDecimal.double_fig if m < BigDecimal.double_fig
@@ -171,7 +204,6 @@ module BigMath
d = one
k = one
- w = one
t = BigDecimal("956")
while d.nonzero? && ((m = n - (pi.exponent - d.exponent).abs) > 0)
m = BigDecimal.double_fig if m < BigDecimal.double_fig
@@ -183,23 +215,17 @@ module BigMath
pi
end
+ # call-seq:
+ # E(numeric) -> BigDecimal
+ #
# Computes e (the base of natural logarithms) to the specified number of
- # digits of precision.
+ # digits of precision, +numeric+.
+ #
+ # BigMath.E(10).to_s
+ # #=> "0.271828182845904523536028752390026306410273E1"
+ #
def E(prec)
raise ArgumentError, "Zero or negative precision for E" if prec <= 0
- 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
+ BigMath.exp(1, prec)
end
end
diff --git a/ext/bigdecimal/lib/bigdecimal/newton.rb b/ext/bigdecimal/lib/bigdecimal/newton.rb
index 1110652801..db1a5ad99e 100644
--- a/ext/bigdecimal/lib/bigdecimal/newton.rb
+++ b/ext/bigdecimal/lib/bigdecimal/newton.rb
@@ -30,7 +30,7 @@ module Newton
include Jacobian
module_function
- def norm(fv,zero=0.0)
+ def norm(fv,zero=0.0) # :nodoc:
s = zero
n = fv.size
for i in 0...n do
@@ -39,6 +39,7 @@ module Newton
s
end
+ # See also Newton
def nlsolve(f,x)
nRetry = 0
n = x.size
diff --git a/ext/bigdecimal/lib/bigdecimal/util.rb b/ext/bigdecimal/lib/bigdecimal/util.rb
index b27e64c511..82c82c8e1e 100644
--- a/ext/bigdecimal/lib/bigdecimal/util.rb
+++ b/ext/bigdecimal/lib/bigdecimal/util.rb
@@ -1,3 +1,7 @@
+# BigDecimal extends the native Integer class to provide the #to_d method.
+#
+# When you require the BigDecimal library in your application, this methodwill
+# be available on Integer objects.
class Integer < Numeric
# call-seq:
# int.to_d -> bigdecimal
@@ -15,6 +19,10 @@ class Integer < Numeric
end
end
+# BigDecimal extends the native Float class to provide the #to_d method.
+#
+# When you require BigDecimal in your application, this method will be
+# available on Float objects.
class Float < Numeric
# call-seq:
# flt.to_d -> bigdecimal
@@ -28,10 +36,14 @@ class Float < Numeric
# # => #<BigDecimal:1dc69e0,'0.5E0',9(18)>
#
def to_d(precision=nil)
- BigDecimal(self, precision || Float::DIG+1)
+ BigDecimal(self, precision || Float::DIG)
end
end
+# BigDecimal extends the native String class to provide the #to_d method.
+#
+# When you require BigDecimal in your application, this method will be
+# available on String objects.
class String
# call-seq:
# string.to_d -> bigdecimal
@@ -49,6 +61,11 @@ class String
end
end
+# BigDecimal extends the native Numeric class to provide the #to_digits and
+# #to_d methods.
+#
+# When you require BigDecimal in your application, this method will be
+# available on BigDecimal objects.
class BigDecimal < Numeric
# call-seq:
# a.to_digits -> string
@@ -81,18 +98,23 @@ class BigDecimal < Numeric
end
end
+# BigDecimal extends the native Rational class to provide the #to_d method.
+#
+# When you require BigDecimal in your application, this method will be
+# available on Rational objects.
class Rational < Numeric
# call-seq:
- # r.to_d -> bigdecimal
- # r.to_d(sig) -> bigdecimal
+ # r.to_d(precision) -> bigdecimal
#
- # Converts a Rational to a BigDecimal. Takes an optional parameter +sig+ to
- # limit the amount of significant digits.
+ # Converts a Rational to a BigDecimal.
+ #
+ # The required +precision+ parameter is used to determine the amount of
+ # significant digits for the result. See BigDecimal#div for more information,
+ # as it is used along with the #denominator and the +precision+ for
+ # parameters.
#
# r = (22/7.0).to_r
# # => (7077085128725065/2251799813685248)
- # r.to_d
- # # => #<BigDecimal:1a52bd8,'0.3142857142 8571427937 0154144999 105E1',45(63)>
# r.to_d(3)
# # => #<BigDecimal:1a44d08,'0.314E1',18(36)>
def to_d(precision)
diff --git a/ext/bigdecimal/sample/linear.rb b/ext/bigdecimal/sample/linear.rb
index 88a62ffa71..a33255f591 100644
--- a/ext/bigdecimal/sample/linear.rb
+++ b/ext/bigdecimal/sample/linear.rb
@@ -10,13 +10,14 @@
# ruby linear.rb [input file solved]
#
+# :stopdoc:
require "bigdecimal"
require "bigdecimal/ludcmp"
#
# NOTE:
-# Change following BigDecimal::limit() if needed.
-BigDecimal::limit(100)
+# Change following BigDecimal.limit() if needed.
+BigDecimal.limit(100)
#
include LUSolve
@@ -26,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 = []
@@ -39,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.
@@ -52,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 7f729e6aaa..7fa921c2c3 100644
--- a/ext/bigdecimal/sample/nlsolve.rb
+++ b/ext/bigdecimal/sample/nlsolve.rb
@@ -9,13 +9,13 @@ require "bigdecimal"
require "bigdecimal/newton"
include Newton
-class Function
+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
@@ -31,8 +31,9 @@ class Function
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/coverage/coverage.c b/ext/coverage/coverage.c
index d2cdb357e0..93cb2a5c9e 100644
--- a/ext/coverage/coverage.c
+++ b/ext/coverage/coverage.c
@@ -25,7 +25,7 @@ rb_coverage_start(VALUE klass)
if (!RTEST(rb_get_coverages())) {
if (rb_coverages == Qundef) {
rb_coverages = rb_hash_new();
- RBASIC(rb_coverages)->klass = 0;
+ rb_obj_hide(rb_coverages);
}
rb_set_coverages(rb_coverages);
}
diff --git a/ext/coverage/depend b/ext/coverage/depend
new file mode 100644
index 0000000000..ad0ac1cdfa
--- /dev/null
+++ b/ext/coverage/depend
@@ -0,0 +1,11 @@
+$(OBJS): $(HDRS) $(ruby_headers) \
+ $(top_srcdir)/vm_core.h \
+ $(top_srcdir)/node.h \
+ $(top_srcdir)/vm_debug.h \
+ $(top_srcdir)/vm_opts.h \
+ {$(VPATH)}id.h \
+ $(top_srcdir)/method.h \
+ $(top_srcdir)/ruby_atomic.h \
+ $(top_srcdir)/thread_pthread.h \
+ $(top_srcdir)/internal.h \
+ $(top_srcdir)/include/ruby/thread_native.h
diff --git a/ext/coverage/extconf.rb b/ext/coverage/extconf.rb
index cf10ca89c5..769f85b6ef 100644
--- a/ext/coverage/extconf.rb
+++ b/ext/coverage/extconf.rb
@@ -1,3 +1,4 @@
require 'mkmf'
+$VPATH << '$(topdir)' << '$(top_srcdir)'
$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
create_makefile('coverage')
diff --git a/ext/curses/curses.c b/ext/curses/curses.c
deleted file mode 100644
index 88b1bdb3aa..0000000000
--- a/ext/curses/curses.c
+++ /dev/null
@@ -1,4329 +0,0 @@
-/* -*- 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)
- *
- * doumentation:
- * - 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
-
-#define NUM2CH NUM2CHR
-#define CH2FIX CHR2FIX
-
-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)
-{
- rb_secure(4);
- 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
- *
- * Flashs 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 CH2FIX(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 f 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 capbilities.
- */
-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)
- *
- * Contruct 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;
-
- rb_secure(4);
- 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)
- *
- * Contruct a new subwindow 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 coord) 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 coord) 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 coord) 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 coord) 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 CH2FIX(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 f 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 Interer (+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) ? CH2FIX(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)
- *
- * Contruct 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;
-
- rb_secure(4);
- 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)
- *
- * Contruct 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: hello.rb
- *
- *
- * * rain.rb
- * :include: 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: 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!"
- * win = Curses::Window.new( 8, (my_str.length + 10),
- * (Curses.lines - 8) / 2,
- * (Curses.cols - (my_str.length + 10)) / 2 )
- * win.box("|", "-")
- * 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 backware (reverse)
- */
- /* Document-const: SR
- * Scroll 1 line backware (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
deleted file mode 100644
index 66742b7208..0000000000
--- a/ext/curses/depend
+++ /dev/null
@@ -1 +0,0 @@
-curses.o: curses.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/thread.h
diff --git a/ext/curses/extconf.rb b/ext/curses/extconf.rb
deleted file mode 100644
index f63de1cd6c..0000000000
--- a/ext/curses/extconf.rb
+++ /dev/null
@@ -1,116 +0,0 @@
-require 'mkmf'
-
-def have_all(*args)
- 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.
-
- prolog = cpp_include(curses)
- if checking_for(checking_message('function curses_version', curses)) {
- try_run(<<-"End")
- #{prolog}
- int main(int argc, char *argv[])
- {
- curses_version();
- return EXIT_SUCCESS;
- }
- End
- }
- $defs << '-DHAVE_FUNC_CURSES_VERSION'
- end
-
- if checking_for(checking_message('variable curses_version', curses)) {
- try_run(<<-"End")
- #{prolog}
- 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
- }
- $defs << '-DHAVE_VAR_CURSES_VERSION'
- end
-
- create_makefile("curses")
-end
diff --git a/ext/curses/hello.rb b/ext/curses/hello.rb
deleted file mode 100644
index 7f57d801a3..0000000000
--- a/ext/curses/hello.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/local/bin/ruby
-
-require "curses"
-include Curses
-
-def show_message(message)
- width = message.length + 6
- win = Window.new(5, width,
- (lines - 5) / 2, (cols - width) / 2)
- win.box(?|, ?-)
- win.setpos(2, 3)
- win.addstr(message)
- win.refresh
- win.getch
- win.close
-end
-
-init_screen
-begin
- crmode
-# show_message("Hit any key")
- setpos((lines - 5) / 2, (cols - 10) / 2)
- addstr("Hit any key")
- refresh
- getch
- show_message("Hello, World!")
- refresh
-ensure
- close_screen
-end
diff --git a/ext/curses/mouse.rb b/ext/curses/mouse.rb
deleted file mode 100644
index c42bc31f33..0000000000
--- a/ext/curses/mouse.rb
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/local/bin/ruby
-
-require "curses"
-include Curses
-
-def show_message(*msgs)
- message = msgs.join
- width = message.length + 6
- win = Window.new(5, width,
- (lines - 5) / 2, (cols - width) / 2)
- win.keypad = true
- win.attron(color_pair(COLOR_RED)){
- win.box(?|, ?-, ?+)
- }
- win.setpos(2, 3)
- win.addstr(message)
- win.refresh
- win.getch
- win.close
-end
-
-init_screen
-start_color
-init_pair(COLOR_BLUE,COLOR_BLUE,COLOR_WHITE)
-init_pair(COLOR_RED,COLOR_RED,COLOR_WHITE)
-crmode
-noecho
-stdscr.keypad(true)
-
-begin
- mousemask(BUTTON1_CLICKED|BUTTON2_CLICKED|BUTTON3_CLICKED|BUTTON4_CLICKED)
- setpos((lines - 5) / 2, (cols - 10) / 2)
- attron(color_pair(COLOR_BLUE)|A_BOLD){
- addstr("click")
- }
- refresh
- while( true )
- c = getch
- case c
- when KEY_MOUSE
- m = 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
- refresh
-ensure
- close_screen
-end
diff --git a/ext/curses/rain.rb b/ext/curses/rain.rb
deleted file mode 100644
index a6019b26e0..0000000000
--- a/ext/curses/rain.rb
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/usr/local/bin/ruby
-# rain for a curses test
-
-require "curses"
-include Curses
-
-def onsig(sig)
- 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
-
-init_screen
-nl
-noecho
-srand
-
-xpos = {}
-ypos = {}
-r = lines - 4
-c = 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
-
-
- setpos(y, x); addstr(".")
-
- setpos(ypos[i], xpos[i]); addstr("o")
-
- i = if i == 0 then 4 else i - 1 end
- setpos(ypos[i], xpos[i]); addstr("O")
-
- i = if i == 0 then 4 else i - 1 end
- setpos(ypos[i] - 1, xpos[i]); addstr("-")
- setpos(ypos[i], xpos[i] - 1); addstr("|.|")
- setpos(ypos[i] + 1, xpos[i]); addstr("-")
-
- i = if i == 0 then 4 else i - 1 end
- setpos(ypos[i] - 2, xpos[i]); addstr("-")
- setpos(ypos[i] - 1, xpos[i] - 1); addstr("/ \\")
- setpos(ypos[i], xpos[i] - 2); addstr("| O |")
- setpos(ypos[i] + 1, xpos[i] - 1); addstr("\\ /")
- setpos(ypos[i] + 2, xpos[i]); addstr("-")
-
- i = if i == 0 then 4 else i - 1 end
- setpos(ypos[i] - 2, xpos[i]); addstr(" ")
- setpos(ypos[i] - 1, xpos[i] - 1); addstr(" ")
- setpos(ypos[i], xpos[i] - 2); addstr(" ")
- setpos(ypos[i] + 1, xpos[i] - 1); addstr(" ")
- setpos(ypos[i] + 2, xpos[i]); addstr(" ")
-
-
- xpos[i] = x
- ypos[i] = y
- refresh
- sleep(0.5)
-end
-
-# end of main
diff --git a/ext/curses/view.rb b/ext/curses/view.rb
deleted file mode 100644
index bc54aeb9af..0000000000
--- a/ext/curses/view.rb
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/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/ext/curses/view2.rb b/ext/curses/view2.rb
deleted file mode 100644
index 037771a226..0000000000
--- a/ext/curses/view2.rb
+++ /dev/null
@@ -1,149 +0,0 @@
-#!/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/ext/date/date_core.c b/ext/date/date_core.c
index e5aa4df171..7ed21db5fc 100644
--- a/ext/date/date_core.c
+++ b/ext/date/date_core.c
@@ -1,11 +1,14 @@
/*
- date_core.c: Coded by Tadayoshi Funaba 2010-2013
+ date_core.c: Coded by Tadayoshi Funaba 2010-2014
*/
#include "ruby.h"
#include "ruby/encoding.h"
#include <math.h>
#include <time.h>
+#if defined(HAVE_SYS_TIME_H)
+#include <sys/time.h>
+#endif
#define NDEBUG
#include <assert.h>
@@ -111,7 +114,7 @@ f_zero_p(VALUE x)
return Qfalse;
case T_RATIONAL:
{
- VALUE num = RRATIONAL(x)->num;
+ VALUE num = rb_rational_num(x);
return f_boolcast(FIXNUM_P(num) && FIX2LONG(num) == 0);
}
}
@@ -301,10 +304,10 @@ union DateData {
inline static VALUE
canon(VALUE x)
{
- if (TYPE(x) == T_RATIONAL) {
- VALUE den = RRATIONAL(x)->den;
+ if (RB_TYPE_P(x, T_RATIONAL)) {
+ VALUE den = rb_rational_den(x);
if (FIXNUM_P(den) && FIX2LONG(den) == 1)
- return RRATIONAL(x)->num;
+ return rb_rational_num(x);
}
return x;
}
@@ -679,7 +682,7 @@ c_julian_leap_p(int y)
inline static int
c_gregorian_leap_p(int y)
{
- return MOD(y, 4) == 0 && y % 100 != 0 || MOD(y, 400) == 0;
+ return (MOD(y, 4) == 0 && y % 100 != 0) || MOD(y, 400) == 0;
}
static int
@@ -1720,23 +1723,6 @@ 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)
{
@@ -1977,12 +1963,6 @@ 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);
@@ -2393,8 +2373,8 @@ offset_to_sec(VALUE vof, int *rof)
return 1;
}
#endif
- vn = RRATIONAL(vs)->num;
- vd = RRATIONAL(vs)->den;
+ vn = rb_rational_num(vs);
+ vd = rb_rational_den(vs);
if (FIXNUM_P(vn) && FIXNUM_P(vd) && (FIX2LONG(vd) == 1))
n = FIX2LONG(vn);
@@ -3117,7 +3097,7 @@ wholenum_p(VALUE x)
break;
case T_RATIONAL:
{
- VALUE den = RRATIONAL(x)->den;
+ VALUE den = rb_rational_den(x);
return FIXNUM_P(den) && FIX2LONG(den) == 1;
}
break;
@@ -3687,7 +3667,11 @@ rt_rewrite_frags(VALUE hash)
seconds = ref_hash("seconds");
if (!NIL_P(seconds)) {
- VALUE d, h, min, s, fr;
+ VALUE offset, d, h, min, s, fr;
+
+ offset = ref_hash("offset");
+ if (!NIL_P(offset))
+ seconds = f_add(seconds, offset);
d = f_idiv(seconds, INT2FIX(DAY_IN_SECONDS));
fr = f_mod(seconds, INT2FIX(DAY_IN_SECONDS));
@@ -3707,7 +3691,6 @@ rt_rewrite_frags(VALUE hash)
set_hash("sec", s);
set_hash("sec_fraction", fr);
del_hash("seconds");
- del_hash("offset");
}
return hash;
}
@@ -5724,7 +5707,7 @@ d_lite_plus(VALUE self, VALUE other)
int jd, df, s;
if (wholenum_p(other))
- return d_lite_plus(self, RRATIONAL(other)->num);
+ return d_lite_plus(self, rb_rational_num(other));
if (f_positive_p(other))
s = +1;
@@ -5860,7 +5843,7 @@ minus_dd(VALUE self, VALUE other)
if (f_nonzero_p(sf))
r = f_add(r, ns_to_day(sf));
- if (TYPE(r) == T_RATIONAL)
+ if (RB_TYPE_P(r, T_RATIONAL))
return r;
return rb_rational_new1(r);
}
@@ -5940,6 +5923,7 @@ d_lite_prev_day(int argc, VALUE *argv, VALUE self)
/*
* call-seq:
+ * d.succ -> date
* d.next -> date
*
* Returns a date object denoting the following day.
@@ -6281,8 +6265,7 @@ d_lite_cmp(VALUE self, VALUE other)
m_gregorian_p(adat) == m_gregorian_p(bdat)))
return cmp_dd(self, other);
- if (have_jd_p(adat) &&
- have_jd_p(bdat)) {
+ {
VALUE a_nth, b_nth;
int a_jd, b_jd;
@@ -6303,76 +6286,6 @@ d_lite_cmp(VALUE self, VALUE other)
return INT2FIX(1);
}
}
- else if (a_nth < b_nth) {
- return INT2FIX(-1);
- }
- else {
- return INT2FIX(1);
- }
- }
- else {
-#ifndef USE_PACK
- VALUE a_nth, b_nth;
- int a_year, b_year,
- a_mon, b_mon,
- a_mday, b_mday;
-#else
- VALUE a_nth, b_nth;
- int a_year, b_year,
- a_pd, b_pd;
-#endif
-
- 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)) {
- a_year = m_year(adat);
- b_year = m_year(bdat);
- if (a_year == b_year) {
-#ifndef USE_PACK
- a_mon = m_mon(adat);
- b_mon = m_mon(bdat);
- if (a_mon == b_mon) {
- a_mday = m_mday(adat);
- b_mday = m_mday(bdat);
- if (a_mday == b_mday) {
- return INT2FIX(0);
- }
- else if (a_mday < b_mday) {
- return INT2FIX(-1);
- }
- else {
- return INT2FIX(1);
- }
- }
- else if (a_mon < b_mon) {
- return INT2FIX(-1);
- }
- else {
- return INT2FIX(1);
- }
-#else
- a_pd = m_pc(adat);
- b_pd = m_pc(bdat);
- if (a_pd == b_pd) {
- return INT2FIX(0);
- }
- else if (a_pd < b_pd) {
- return INT2FIX(-1);
- }
- else {
- return INT2FIX(1);
- }
-#endif
- }
- else if (a_year < b_year) {
- return INT2FIX(-1);
- }
- else {
- return INT2FIX(1);
- }
- }
else if (f_lt_p(a_nth, b_nth)) {
return INT2FIX(-1);
}
@@ -6424,8 +6337,7 @@ d_lite_equal(VALUE self, VALUE other)
if (!(m_gregorian_p(adat) == m_gregorian_p(bdat)))
return equal_gen(self, other);
- if (have_jd_p(adat) &&
- have_jd_p(bdat)) {
+ {
VALUE a_nth, b_nth;
int a_jd, b_jd;
@@ -6440,47 +6352,6 @@ d_lite_equal(VALUE self, VALUE other)
return Qtrue;
return Qfalse;
}
- else {
-#ifndef USE_PACK
- VALUE a_nth, b_nth;
- int a_year, b_year,
- a_mon, b_mon,
- a_mday, b_mday;
-#else
- VALUE a_nth, b_nth;
- int a_year, b_year,
- a_pd, b_pd;
-#endif
-
- 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)) {
- a_year = m_year(adat);
- b_year = m_year(bdat);
- if (a_year == b_year) {
-#ifndef USE_PACK
- a_mon = m_mon(adat);
- b_mon = m_mon(bdat);
- if (a_mon == b_mon) {
- a_mday = m_mday(adat);
- b_mday = m_mday(bdat);
- if (a_mday == b_mday)
- return Qtrue;
- }
-#else
- /* mon and mday only */
- a_pd = (m_pc(adat) >> MDAY_SHIFT);
- b_pd = (m_pc(bdat) >> MDAY_SHIFT);
- if (a_pd == b_pd) {
- return Qtrue;
- }
-#endif
- }
- }
- return Qfalse;
- }
}
}
@@ -7177,7 +7048,7 @@ d_lite_marshal_load(VALUE self, VALUE a)
rb_check_frozen(self);
rb_check_trusted(self);
- if (TYPE(a) != T_ARRAY)
+ if (!RB_TYPE_P(a, T_ARRAY))
rb_raise(rb_eTypeError, "expected an array");
switch (RARRAY_LEN(a)) {
@@ -9330,23 +9201,23 @@ Init_date_core(void)
rb_include_module(cDate, rb_mComparable);
- /* An array of stirng of full month name in English. The first
+ /* An array of strings of full month names in English. The first
* element is nil.
*/
rb_define_const(cDate, "MONTHNAMES", mk_ary_of_str(13, monthnames));
- /* An array of string of abbreviated month name in English. The
+ /* An array of strings of abbreviated month names in English. The
* first element is nil.
*/
rb_define_const(cDate, "ABBR_MONTHNAMES",
mk_ary_of_str(13, abbr_monthnames));
- /* An array of string of full name of days of the week in English.
+ /* An array of strings of the full names of days of the week in English.
* The first is "Sunday".
*/
rb_define_const(cDate, "DAYNAMES", mk_ary_of_str(7, daynames));
- /* An array of string of abbreviated day name in English. The
+ /* An array of strings of abbreviated day names in English. The
* first is "Sun".
*/
rb_define_const(cDate, "ABBR_DAYNAMES", mk_ary_of_str(7, abbr_daynames));
diff --git a/ext/date/date_parse.c b/ext/date/date_parse.c
index 29dbb239bb..239e2643b0 100644
--- a/ext/date/date_parse.c
+++ b/ext/date/date_parse.c
@@ -70,7 +70,7 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE d, int bc)
{
VALUE c = Qnil;
- if (TYPE(m) != T_STRING)
+ if (!RB_TYPE_P(m, T_STRING))
m = f_to_s(m);
if (!NIL_P(y) && !NIL_P(m) && NIL_P(d)) {
@@ -585,12 +585,12 @@ date_zone_to_diff(VALUE str)
if (NIL_P(hour))
offset = INT2FIX(0);
else {
- if (TYPE(hour) == T_STRING)
+ if (RB_TYPE_P(hour, T_STRING))
hour = str2num(hour);
offset = f_mul(hour, INT2FIX(3600));
}
if (!NIL_P(min)) {
- if (TYPE(min) == T_STRING)
+ if (RB_TYPE_P(min, T_STRING))
min = str2num(min);
offset = f_add(offset, f_mul(min, INT2FIX(60)));
}
@@ -765,9 +765,9 @@ parse_time(VALUE str, VALUE hash)
"("
"(?:gmt|utc?)?[-+]\\d+(?:[,.:]\\d+(?::\\d+)?)?"
"|"
- "[[:alpha:].\\s]+(?:standard|daylight)\\stime\\b"
+ "(?-i:[[:alpha:].\\s]+)(?:standard|daylight)\\stime\\b"
"|"
- "[[:alpha:]]+(?:\\sdst)?\\b"
+ "(?-i:[[:alpha:]]+)(?:\\sdst)?\\b"
")"
")?";
static VALUE pat = Qnil;
diff --git a/ext/date/date_strptime.c b/ext/date/date_strptime.c
index c6a5969172..e318af19f3 100644
--- a/ext/date/date_strptime.c
+++ b/ext/date/date_strptime.c
@@ -291,8 +291,9 @@ date__strptime_internal(const char *str, size_t slen,
if (!valid_range_p(n, 0, 99))
fail();
set_hash("cwyear",n);
- set_hash("_cent",
- INT2FIX(f_ge_p(n, INT2FIX(69)) ? 19 : 20));
+ if (NIL_P(ref_hash("_cent")))
+ set_hash("_cent",
+ INT2FIX(f_ge_p(n, INT2FIX(69)) ? 19 : 20));
goto matched;
}
@@ -556,8 +557,9 @@ date__strptime_internal(const char *str, size_t slen,
if (sign == -1)
n = f_negate(n);
set_hash("year", n);
- set_hash("_cent",
- INT2FIX(f_ge_p(n, INT2FIX(69)) ? 19 : 20));
+ if (NIL_P(ref_hash("_cent")))
+ set_hash("_cent",
+ INT2FIX(f_ge_p(n, INT2FIX(69)) ? 19 : 20));
goto matched;
}
@@ -567,8 +569,8 @@ date__strptime_internal(const char *str, size_t slen,
static const char pat_source[] =
"\\A("
"(?:gmt|utc?)?[-+]\\d+(?:[,.:]\\d+(?::\\d+)?)?"
- "|[[:alpha:].\\s]+(?:standard|daylight)\\s+time\\b"
- "|[[:alpha:]]+(?:\\s+dst)?\\b"
+ "|(?-i:[[:alpha:].\\s]+)(?:standard|daylight)\\s+time\\b"
+ "|(?-i:[[:alpha:]]+)(?:\\s+dst)?\\b"
")";
static VALUE pat = Qnil;
VALUE m, b;
diff --git a/ext/date/depend b/ext/date/depend
index e6afa56162..3a13fcc9a9 100644
--- a/ext/date/depend
+++ b/ext/date/depend
@@ -1,3 +1,7 @@
$(OBJS): $(ruby_headers)
-date_core.o: date_tmx.h
+date_core.o: date_tmx.h $(hdrdir)/ruby/encoding.h $(hdrdir)/ruby/oniguruma.h
date_strftime.o: date_tmx.h
+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/lib/date.rb b/ext/date/lib/date.rb
index d235d76e6f..83234f458b 100644
--- a/ext/date/lib/date.rb
+++ b/ext/date/lib/date.rb
@@ -1,7 +1,6 @@
# date.rb: Written by Tadayoshi Funaba 1998-2011
require 'date_core'
-require 'date/format'
class Date
diff --git a/ext/date/lib/date/format.rb b/ext/date/lib/date/format.rb
deleted file mode 100644
index 892e7aacaa..0000000000
--- a/ext/date/lib/date/format.rb
+++ /dev/null
@@ -1 +0,0 @@
-# format.rb: Written by Tadayoshi Funaba 1999-2011
diff --git a/ext/dbm/dbm.c b/ext/dbm/dbm.c
index 57d227e8ad..527d6518d0 100644
--- a/ext/dbm/dbm.c
+++ b/ext/dbm/dbm.c
@@ -45,16 +45,16 @@ closed_dbm(void)
rb_raise(rb_eDBMError, "closed DBM file");
}
-#define GetDBM(obj, dbmp) {\
+#define GetDBM(obj, dbmp) do {\
Data_Get_Struct((obj), struct dbmdata, (dbmp));\
if ((dbmp) == 0) closed_dbm();\
if ((dbmp)->di_dbm == 0) closed_dbm();\
-}
+} while (0)
-#define GetDBM2(obj, data, dbm) {\
- GetDBM((obj), (data));\
- (dbm) = dbmp->di_dbm;\
-}
+#define GetDBM2(obj, dbmp, dbm) do {\
+ GetDBM((obj), (dbmp));\
+ (dbm) = (dbmp)->di_dbm;\
+} while (0)
static void
free_dbm(struct dbmdata *dbmp)
@@ -259,8 +259,11 @@ fdbm_fetch(VALUE obj, VALUE keystr, VALUE ifnone)
value = dbm_fetch(dbm, key);
if (value.dptr == 0) {
not_found:
- if (ifnone == Qnil && rb_block_given_p())
- return rb_yield(rb_tainted_str_new(key.dptr, key.dsize));
+ if (NIL_P(ifnone) && rb_block_given_p()) {
+ keystr = rb_str_dup(keystr);
+ OBJ_TAINT(keystr);
+ return rb_yield(keystr);
+ }
return ifnone;
}
return rb_tainted_str_new(value.dptr, value.dsize);
@@ -392,7 +395,6 @@ fdbm_values_at(int argc, VALUE *argv, VALUE obj)
static void
fdbm_modify(VALUE obj)
{
- rb_secure(4);
if (OBJ_FROZEN(obj)) rb_error_frozen("DBM");
}
@@ -575,7 +577,7 @@ fdbm_invert(VALUE obj)
static VALUE fdbm_store(VALUE,VALUE,VALUE);
static VALUE
-update_i(VALUE pair, VALUE dbm)
+update_i(RB_BLOCK_CALL_FUNC_ARGLIST(pair, dbm))
{
Check_Type(pair, T_ARRAY);
if (RARRAY_LEN(pair) < 2) {
@@ -655,6 +657,7 @@ fdbm_store(VALUE obj, VALUE keystr, VALUE valstr)
/*
* call-seq:
* dbm.length -> integer
+ * dbm.size -> integer
*
* Returns the number of entries in the database.
*/
@@ -832,7 +835,10 @@ fdbm_values(VALUE obj)
/*
* call-seq:
+ * dbm.include?(key) -> boolean
* dbm.has_key?(key) -> boolean
+ * dbm.member?(key) -> boolean
+ * dbm.key?(key) -> boolean
*
* Returns true if the database contains the specified key, false otherwise.
*/
@@ -859,6 +865,7 @@ fdbm_has_key(VALUE obj, VALUE keystr)
/*
* call-seq:
* dbm.has_value?(value) -> boolean
+ * dbm.value?(value) -> boolean
*
* Returns true if the database contains the specified string value, false
* otherwise.
@@ -953,8 +960,7 @@ fdbm_reject(VALUE obj)
}
/*
- * Documented by mathew meta@pobox.com.
- * = Introduction
+ * == Introduction
*
* The DBM class provides a wrapper to a Unix-style
* {dbm}[http://en.wikipedia.org/wiki/Dbm] or Database Manager library.
@@ -980,7 +986,7 @@ fdbm_reject(VALUE obj)
* All of these dbm implementations have their own Ruby interfaces
* available, which provide richer (but varying) APIs.
*
- * = Cautions
+ * == Cautions
*
* Before you decide to use DBM, there are some issues you should consider:
*
@@ -1005,10 +1011,10 @@ fdbm_reject(VALUE obj)
* important data. It is probably best used as a fast and easy alternative
* to a Hash for processing large amounts of data.
*
- * = Example
+ * == Example
*
* require 'dbm'
- * db = DBM.open('rfcs', 666, DBM::CREATRW)
+ * 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/depend b/ext/dbm/depend
deleted file mode 100644
index 5fae80b096..0000000000
--- a/ext/dbm/depend
+++ /dev/null
@@ -1 +0,0 @@
-dbm.o: dbm.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
diff --git a/ext/dbm/extconf.rb b/ext/dbm/extconf.rb
index 32a944634a..68070c9970 100644
--- a/ext/dbm/extconf.rb
+++ b/ext/dbm/extconf.rb
@@ -1,3 +1,20 @@
+# configure option:
+# --with-dbm-type=COMMA-SEPARATED-NDBM-TYPES
+#
+# ndbm type:
+# libc ndbm compatible library in libc.
+# db Berkeley DB (libdb)
+# db2 Berkeley DB (libdb2)
+# db1 Berkeley DB (libdb1)
+# db5 Berkeley DB (libdb5)
+# db4 Berkeley DB (libdb4)
+# db3 Berkeley DB (libdb3)
+# gdbm_compat GDBM since 1.8.1 (libgdbm_compat)
+# gdbm GDBM until 1.8.0 (libgdbm)
+# qdbm QDBM (libqdbm)
+# ndbm Some legacy OS may have libndbm.
+
+# :stopdoc:
require 'mkmf'
dir_config("dbm")
@@ -252,3 +269,4 @@ if dblib.any? {|db| headers.fetch(db, ["ndbm.h"]).any? {|hdr| headers.db_check(d
convertible_int("datum.dsize", headers.found, headers.defs)
create_makefile("dbm")
end
+# :startdoc:
diff --git a/ext/digest/bubblebabble/bubblebabble.c b/ext/digest/bubblebabble/bubblebabble.c
index c92ae52cd9..4bccd221b8 100644
--- a/ext/digest/bubblebabble/bubblebabble.c
+++ b/ext/digest/bubblebabble/bubblebabble.c
@@ -78,7 +78,8 @@ bubblebabble_str_new(VALUE str_digest)
return str;
}
-/*
+/* Document-method: Digest::bubblebabble
+ *
* call-seq:
* Digest.bubblebabble(string) -> bubblebabble_string
*
@@ -90,7 +91,8 @@ rb_digest_s_bubblebabble(VALUE klass, VALUE str)
return bubblebabble_str_new(str);
}
-/*
+/* Document-method: Digest::Class::bubblebabble
+ *
* call-seq:
* Digest::Class.bubblebabble(string, ...) -> hash_string
*
@@ -102,7 +104,8 @@ rb_digest_class_s_bubblebabble(int argc, VALUE *argv, VALUE klass)
return bubblebabble_str_new(rb_funcall2(klass, id_digest, argc, argv));
}
-/*
+/* Document-method: Digest::Instance#bubblebabble
+ *
* call-seq:
* digest_obj.bubblebabble -> hash_string
*
@@ -121,22 +124,23 @@ rb_digest_instance_bubblebabble(VALUE self)
void
Init_bubblebabble(void)
{
- VALUE mDigest, mDigest_Instance, cDigest_Class;
+ VALUE rb_mDigest, rb_mDigest_Instance, rb_cDigest_Class;
rb_require("digest");
- mDigest = rb_path2class("Digest");
- mDigest_Instance = rb_path2class("Digest::Instance");
- cDigest_Class = rb_path2class("Digest::Class");
-
- /* Digest::bubblebabble() */
- rb_define_module_function(mDigest, "bubblebabble", rb_digest_s_bubblebabble, 1);
+ rb_mDigest = rb_path2class("Digest");
+ rb_mDigest_Instance = rb_path2class("Digest::Instance");
+ rb_cDigest_Class = rb_path2class("Digest::Class");
- /* Digest::Class::bubblebabble() */
- rb_define_singleton_method(cDigest_Class, "bubblebabble", rb_digest_class_s_bubblebabble, -1);
+#if 0
+ rb_mDigest = rb_define_module("Digest");
+ rb_mDigest_Instance = rb_define_module_under(rb_mDigest, "Instance");
+ rb_cDigest_Class = rb_define_class_under(rb_mDigest, "Class", rb_cObject);
+#endif
- /* Digest::Instance#bubblebabble() */
- rb_define_method(mDigest_Instance, "bubblebabble", rb_digest_instance_bubblebabble, 0);
+ rb_define_module_function(rb_mDigest, "bubblebabble", rb_digest_s_bubblebabble, 1);
+ rb_define_singleton_method(rb_cDigest_Class, "bubblebabble", rb_digest_class_s_bubblebabble, -1);
+ rb_define_method(rb_mDigest_Instance, "bubblebabble", rb_digest_instance_bubblebabble, 0);
id_digest = rb_intern("digest");
}
diff --git a/ext/digest/bubblebabble/depend b/ext/digest/bubblebabble/depend
index b20148ded4..d13a156ce1 100644
--- a/ext/digest/bubblebabble/depend
+++ b/ext/digest/bubblebabble/depend
@@ -1,3 +1 @@
-bubblebabble.o: bubblebabble.c $(srcdir)/../digest.h $(hdrdir)/ruby.h \
- $(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/intern.h \
- $(srcdir)/../defs.h
+bubblebabble.o: bubblebabble.c $(srcdir)/../digest.h $(srcdir)/../defs.h $(HDRS) $(ruby_headers)
diff --git a/ext/digest/depend b/ext/digest/depend
index 43601a208f..2fbc6d9adf 100644
--- a/ext/digest/depend
+++ b/ext/digest/depend
@@ -1,2 +1 @@
-digest.o: digest.c digest.h $(hdrdir)/ruby.h $(topdir)/config.h \
- $(hdrdir)/defines.h $(hdrdir)/intern.h
+digest.o: digest.c digest.h $(HDRS) $(ruby_headers)
diff --git a/ext/digest/digest.c b/ext/digest/digest.c
index c603441409..2231452c42 100644
--- a/ext/digest/digest.c
+++ b/ext/digest/digest.c
@@ -30,40 +30,60 @@ RUBY_EXTERN void Init_digest_base(void);
*
* This module provides a framework for message digest libraries.
*
- * You may want to look at OpenSSL::Digest as it supports support more
- * algorithms.
+ * You may want to look at OpenSSL::Digest as it supports more algorithms.
*
- * A cryptographic hash function is a procedure that takes data and return a
- * fixed bit string : the hash value, also known as _digest_. Hash functions
+ * A cryptographic hash function is a procedure that takes data and returns a
+ * fixed bit string: the hash value, also known as _digest_. Hash functions
* are also called one-way functions, it is easy to compute a digest from
* a message, but it is infeasible to generate a message from a digest.
*
- * == Example
+ * == Examples
*
* require 'digest'
*
* # Compute a complete digest
+ * Digest::SHA256.digest 'message' #=> "\xABS\n\x13\xE4Y..."
+ *
* sha256 = Digest::SHA256.new
- * digest = sha256.digest message
+ * sha256.digest 'message' #=> "\xABS\n\x13\xE4Y..."
+ *
+ * # Other encoding formats
+ * Digest::SHA256.hexdigest 'message' #=> "ab530a13e459..."
+ * Digest::SHA256.base64digest 'message' #=> "q1MKE+RZFJgr..."
*
* # Compute digest by chunks
- * sha256 = Digest::SHA256.new
- * sha256.update message1
- * sha256 << message2 # << is an alias for update
+ * md5 = Digest::MD5.new
+ * md5.update 'message1'
+ * md5 << 'message2' # << is an alias for update
+ *
+ * md5.hexdigest #=> "94af09c09bb9..."
+ *
+ * # Compute digest for a file
+ * sha256 = Digest::SHA256.file 'testfile'
+ * sha256.hexdigest
+ *
+ * Additionally digests can be encoded in "bubble babble" format as a sequence
+ * of consonants and vowels which is more recognizable and comparable than a
+ * hexadecimal digest.
+ *
+ * require 'digest/bubblebabble'
*
- * digest = sha256.digest
+ * Digest::SHA256.bubblebabble 'message' #=> "xopoh-fedac-fenyh-..."
+ *
+ * See the bubble babble specification at
+ * http://web.mit.edu/kenta/www/one/bubblebabble/spec/jrtrjwzi/draft-huima-01.txt.
*
* == Digest algorithms
*
- * Different digest algorithms (or hash functions) are available :
+ * Different digest algorithms (or hash functions) are available:
*
* HMAC::
- * See FIPS PUB 198 The Keyed-Hash Message Authentication Code (HMAC)
+ * See FIPS PUB 198 The Keyed-Hash Message Authentication Code (HMAC).
* RIPEMD-160::
- * (as Digest::RMD160) see
- * http://homes.esat.kuleuven.be/~bosselae/ripemd160.html
+ * As Digest::RMD160.
+ * See http://homes.esat.kuleuven.be/~bosselae/ripemd160.html.
* SHA1::
- * See FIPS 180 Secure Hash Standard
+ * See FIPS 180 Secure Hash Standard.
* SHA2 family::
* See FIPS 180 Secure Hash Standard which defines the following algorithms:
* * SHA512
@@ -71,11 +91,7 @@ RUBY_EXTERN void Init_digest_base(void);
* * SHA256
*
* The latest versions of the FIPS publications can be found here:
- * http://csrc.nist.gov/publications/PubsFIPS.html
- *
- * Additionally Digest::BubbleBabble encodes a digest as a sequence of
- * consonants and vowels which is more recognizable and comparable than a
- * hexadecimal digest. See http://en.wikipedia.org/wiki/Bubblebabble
+ * http://csrc.nist.gov/publications/PubsFIPS.html.
*/
static VALUE
@@ -356,7 +372,8 @@ 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 = other;
+ str2 = rb_check_string_type(other);
+ if (NIL_P(str2)) return Qfalse;
}
/* never blindly assume that subclass methods return strings */
@@ -504,7 +521,7 @@ get_digest_base_metadata(VALUE klass)
Data_Get_Struct(obj, rb_digest_metadata_t, algo);
switch (algo->api_version) {
- case 2:
+ case 3:
break;
/*
@@ -518,6 +535,14 @@ get_digest_base_metadata(VALUE klass)
return algo;
}
+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)
{
@@ -532,7 +557,7 @@ rb_digest_base_alloc(VALUE klass)
algo = get_digest_base_metadata(klass);
pctx = xmalloc(algo->ctx_size);
- algo->init_func(pctx);
+ algo_init(algo, pctx);
obj = Data_Wrap_Struct(klass, 0, xfree, pctx);
@@ -570,7 +595,7 @@ rb_digest_base_reset(VALUE self)
Data_Get_Struct(self, void, pctx);
- algo->init_func(pctx);
+ algo_init(algo, pctx);
return self;
}
@@ -608,7 +633,7 @@ rb_digest_base_finish(VALUE self)
algo->finish_func(pctx, (unsigned char *)RSTRING_PTR(str));
/* avoid potential coredump caused by use of a finished context */
- algo->init_func(pctx);
+ algo_init(algo, pctx);
return str;
}
diff --git a/ext/digest/digest.h b/ext/digest/digest.h
index 6e4906c859..85848d5682 100644
--- a/ext/digest/digest.h
+++ b/ext/digest/digest.h
@@ -15,11 +15,11 @@
#include "ruby.h"
-#define RUBY_DIGEST_API_VERSION 2
+#define RUBY_DIGEST_API_VERSION 3
-typedef void (*rb_digest_hash_init_func_t)(void *);
+typedef int (*rb_digest_hash_init_func_t)(void *);
typedef void (*rb_digest_hash_update_func_t)(void *, unsigned char *, size_t);
-typedef void (*rb_digest_hash_finish_func_t)(void *, unsigned char *);
+typedef int (*rb_digest_hash_finish_func_t)(void *, unsigned char *);
typedef struct {
int api_version;
diff --git a/ext/digest/lib/digest.rb b/ext/digest/lib/digest.rb
index 4a98af2eae..5f7ebc2237 100644
--- a/ext/digest/lib/digest.rb
+++ b/ext/digest/lib/digest.rb
@@ -21,12 +21,14 @@ module Digest
end
class ::Digest::Class
- # creates a digest object and reads a given file, _name_.
+ # Creates a digest object and reads a given file, _name_.
+ # Optional arguments are passed to the constructor of the digest
+ # class.
#
# p Digest::SHA256.file("X11R6.8.2-src.tar.bz2").hexdigest
# # => "f02e3c85572dc9ad7cb77c2a638e3be24cc1b5bea9fdbb0b0299c9668475c534"
- def self.file(name)
- new.file(name)
+ def self.file(name, *args)
+ new(*args).file(name)
end
# Returns the base64 encoded hash value of a given _string_. The
@@ -38,7 +40,7 @@ module Digest
end
module Instance
- # updates the digest with the contents of a given file _name_ and
+ # Updates the digest with the contents of a given file _name_ and
# returns self.
def file(name)
File.open(name, "rb") {|f|
diff --git a/ext/digest/lib/digest/hmac.rb b/ext/digest/lib/digest/hmac.rb
deleted file mode 100644
index 470b0226d4..0000000000
--- a/ext/digest/lib/digest/hmac.rb
+++ /dev/null
@@ -1,302 +0,0 @@
-# == 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.bubblebabble
- #
- 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 8eaec20b4b..ca30d310e9 100644
--- a/ext/digest/md5/depend
+++ b/ext/digest/md5/depend
@@ -1,6 +1,3 @@
-md5.o: md5.c md5.h $(srcdir)/../defs.h $(hdrdir)/ruby.h $(topdir)/config.h \
- $(hdrdir)/defines.h $(hdrdir)/intern.h
-md5init.o: md5init.c $(srcdir)/../digest.h $(hdrdir)/ruby.h \
- $(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/intern.h md5.h \
- $(srcdir)/../defs.h
+md5.o: md5.c md5.h $(srcdir)/../defs.h
+md5init.o: md5init.c md5.h $(srcdir)/../digest.h $(srcdir)/../defs.h $(HDRS) $(ruby_headers)
md5ossl.o: md5ossl.h
diff --git a/ext/digest/md5/md5.c b/ext/digest/md5/md5.c
index 518f8239ed..4ff280bb0a 100644
--- a/ext/digest/md5/md5.c
+++ b/ext/digest/md5/md5.c
@@ -350,7 +350,7 @@ md5_process(MD5_CTX *pms, const uint8_t *data /*[64]*/)
pms->state[3] += d;
}
-void
+int
MD5_Init(MD5_CTX *pms)
{
pms->count[0] = pms->count[1] = 0;
@@ -358,6 +358,7 @@ 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
@@ -368,7 +369,7 @@ MD5_Update(MD5_CTX *pms, const uint8_t *data, size_t nbytes)
size_t offset = (pms->count[0] >> 3) & 63;
uint32_t nbits = (uint32_t)(nbytes << 3);
- if (nbytes <= 0)
+ if (nbytes == 0)
return;
/* Update the message length. */
@@ -398,7 +399,7 @@ MD5_Update(MD5_CTX *pms, const uint8_t *data, size_t nbytes)
memcpy(pms->buffer, p, left);
}
-void
+int
MD5_Finish(MD5_CTX *pms, uint8_t *digest)
{
static const uint8_t pad[64] = {
@@ -419,4 +420,5 @@ 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 f4580ef5e7..a0faa25e48 100644
--- a/ext/digest/md5/md5.h
+++ b/ext/digest/md5/md5.h
@@ -69,9 +69,9 @@ typedef struct md5_state_s {
#define MD5_Finish rb_Digest_MD5_Finish
#endif
-void MD5_Init _((MD5_CTX *pms));
+int MD5_Init _((MD5_CTX *pms));
void MD5_Update _((MD5_CTX *pms, const uint8_t *data, size_t nbytes));
-void MD5_Finish _((MD5_CTX *pms, uint8_t *digest));
+int MD5_Finish _((MD5_CTX *pms, uint8_t *digest));
#define MD5_BLOCK_LENGTH 64
#define MD5_DIGEST_LENGTH 16
diff --git a/ext/digest/rmd160/depend b/ext/digest/rmd160/depend
index a21d7188dc..c5524be459 100644
--- a/ext/digest/rmd160/depend
+++ b/ext/digest/rmd160/depend
@@ -1,6 +1,3 @@
-rmd160.o: rmd160.c rmd160.h $(srcdir)/../defs.h $(hdrdir)/ruby.h \
- $(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/intern.h
-rmd160init.o: rmd160init.c $(srcdir)/../digest.h $(hdrdir)/ruby.h \
- $(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/intern.h \
- rmd160.h $(srcdir)/../defs.h
+rmd160.o: rmd160.c rmd160.h $(srcdir)/../defs.h $(HDRS) $(ruby_headers)
+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/rmd160.c b/ext/digest/rmd160/rmd160.c
index bac77833b1..058d004f3a 100644
--- a/ext/digest/rmd160/rmd160.c
+++ b/ext/digest/rmd160/rmd160.c
@@ -124,7 +124,7 @@
/********************************************************************/
-void
+int
RMD160_Init(RMD160_CTX *context)
{
@@ -138,6 +138,7 @@ RMD160_Init(RMD160_CTX *context)
context->state[4] = 0xc3d2e1f0U;
context->length[0] = context->length[1] = 0;
context->buflen = 0;
+ return 1;
}
/********************************************************************/
@@ -412,7 +413,7 @@ RMD160_Update(RMD160_CTX *context, const uint8_t *data, size_t nbytes)
/********************************************************************/
-void
+int
RMD160_Finish(RMD160_CTX *context, uint8_t digest[20])
{
uint32_t i;
@@ -456,6 +457,7 @@ 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 2c98f11cd0..098fa05a88 100644
--- a/ext/digest/rmd160/rmd160.h
+++ b/ext/digest/rmd160/rmd160.h
@@ -43,10 +43,10 @@ typedef struct {
#endif
__BEGIN_DECLS
-void RMD160_Init _((RMD160_CTX *));
+int RMD160_Init _((RMD160_CTX *));
void RMD160_Transform _((uint32_t[5], const uint32_t[16]));
void RMD160_Update _((RMD160_CTX *, const uint8_t *, size_t));
-void RMD160_Finish _((RMD160_CTX *, uint8_t[20]));
+int RMD160_Finish _((RMD160_CTX *, uint8_t[20]));
__END_DECLS
#define RMD160_BLOCK_LENGTH 64
diff --git a/ext/digest/sha1/depend b/ext/digest/sha1/depend
index 61607844d0..6b6ee6a0bf 100644
--- a/ext/digest/sha1/depend
+++ b/ext/digest/sha1/depend
@@ -1,6 +1,3 @@
-sha1.o: sha1.c sha1.h $(srcdir)/../defs.h $(hdrdir)/ruby.h \
- $(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/intern.h
-sha1init.o: sha1init.c $(srcdir)/../digest.h $(hdrdir)/ruby.h \
- $(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/intern.h \
- sha1.h $(srcdir)/../defs.h
-sha1ossl.o: sha1ossl.h $(srcdir)/../defs.h
+sha1.o: sha1.c sha1.h $(srcdir)/../defs.h
+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/sha1.c b/ext/digest/sha1/sha1.c
index 6196ca6b82..5311227549 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
*/
-void SHA1_Init(SHA1_CTX *context)
+int SHA1_Init(SHA1_CTX *context)
{
_DIAGASSERT(context != 0);
@@ -211,6 +211,7 @@ void SHA1_Init(SHA1_CTX *context)
context->state[3] = 0x10325476;
context->state[4] = 0xC3D2E1F0;
context->count[0] = context->count[1] = 0;
+ return 1;
}
@@ -244,7 +245,7 @@ void SHA1_Update(SHA1_CTX *context, const uint8_t *data, size_t len)
/*
* Add padding and return the message digest.
*/
-void SHA1_Finish(SHA1_CTX* context, uint8_t digest[20])
+int SHA1_Finish(SHA1_CTX* context, uint8_t digest[20])
{
size_t i;
uint8_t finalcount[8];
@@ -266,4 +267,5 @@ void 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 55997e73dd..6f1c388cf2 100644
--- a/ext/digest/sha1/sha1.h
+++ b/ext/digest/sha1/sha1.h
@@ -28,9 +28,9 @@ typedef struct {
#endif
void SHA1_Transform _((uint32_t state[5], const uint8_t buffer[64]));
-void SHA1_Init _((SHA1_CTX *context));
+int SHA1_Init _((SHA1_CTX *context));
void SHA1_Update _((SHA1_CTX *context, const uint8_t *data, size_t len));
-void SHA1_Finish _((SHA1_CTX *context, uint8_t digest[20]));
+int SHA1_Finish _((SHA1_CTX *context, uint8_t digest[20]));
#define SHA1_BLOCK_LENGTH 64
#define SHA1_DIGEST_LENGTH 20
diff --git a/ext/digest/sha2/depend b/ext/digest/sha2/depend
index 00e18e158d..7373f46fc2 100644
--- a/ext/digest/sha2/depend
+++ b/ext/digest/sha2/depend
@@ -1,6 +1,3 @@
-sha2.o: sha2.c sha2.h $(srcdir)/../defs.h $(hdrdir)/ruby.h \
- $(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/intern.h
-sha2init.o: sha2init.c $(srcdir)/../digest.h $(hdrdir)/ruby.h \
- $(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/intern.h \
- sha2.h $(srcdir)/../defs.h
-sha2ossl.o: sha2ossl.h $(srcdir)/../defs.h
+sha2.o: sha2.c sha2.h $(srcdir)/../defs.h $(HDRS) $(ruby_headers)
+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/sha2.c b/ext/digest/sha2/sha2.c
index 0fe64489ab..d0629a2b64 100644
--- a/ext/digest/sha2/sha2.c
+++ b/ext/digest/sha2/sha2.c
@@ -341,13 +341,14 @@ static const char *sha2_hex_digits = "0123456789abcdef";
/*** SHA-256: *********************************************************/
-void SHA256_Init(SHA256_CTX* context) {
+int SHA256_Init(SHA256_CTX* context) {
if (context == (SHA256_CTX*)0) {
- return;
+ return 0;
}
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
@@ -574,7 +575,7 @@ void SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) {
usedspace = freespace = 0;
}
-void SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
+int SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
sha2_word32 *d = (sha2_word32*)digest;
unsigned int usedspace;
@@ -613,7 +614,8 @@ void SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
*context->buffer = 0x80;
}
/* Set the bit count: */
- *(sha2_word64*)&context->buffer[SHA256_SHORT_BLOCK_LENGTH] = context->bitcount;
+ MEMCPY_BCOPY(&context->buffer[SHA256_SHORT_BLOCK_LENGTH], &context->bitcount,
+ sizeof(sha2_word64));
/* Final transform: */
SHA256_Transform(context, (sha2_word32*)context->buffer);
@@ -635,6 +637,7 @@ void 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[]) {
@@ -669,13 +672,14 @@ char* SHA256_Data(const sha2_byte* data, size_t len, char digest[SHA256_DIGEST_S
/*** SHA-512: *********************************************************/
-void SHA512_Init(SHA512_CTX* context) {
+int SHA512_Init(SHA512_CTX* context) {
if (context == (SHA512_CTX*)0) {
- return;
+ return 0;
}
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
@@ -930,14 +934,16 @@ void SHA512_Last(SHA512_CTX* context) {
*context->buffer = 0x80;
}
/* Store the length of input data (in bits): */
- *(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH] = context->bitcount[1];
- *(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0];
+ MEMCPY_BCOPY(&context->buffer[SHA512_SHORT_BLOCK_LENGTH], &context->bitcount[1],
+ sizeof(sha2_word64));
+ MEMCPY_BCOPY(&context->buffer[SHA512_SHORT_BLOCK_LENGTH+8], &context->bitcount[0],
+ sizeof(sha2_word64));
/* Final transform: */
SHA512_Transform(context, (sha2_word64*)context->buffer);
}
-void SHA512_Final(sha2_byte digest[], SHA512_CTX* context) {
+int SHA512_Final(sha2_byte digest[], SHA512_CTX* context) {
sha2_word64 *d = (sha2_word64*)digest;
/* Sanity check: */
@@ -964,6 +970,7 @@ void 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[]) {
@@ -998,20 +1005,21 @@ char* SHA512_Data(const sha2_byte* data, size_t len, char digest[SHA512_DIGEST_S
/*** SHA-384: *********************************************************/
-void SHA384_Init(SHA384_CTX* context) {
+int SHA384_Init(SHA384_CTX* context) {
if (context == (SHA384_CTX*)0) {
- return;
+ return 0;
}
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);
}
-void SHA384_Final(sha2_byte digest[], SHA384_CTX* context) {
+int SHA384_Final(sha2_byte digest[], SHA384_CTX* context) {
sha2_word64 *d = (sha2_word64*)digest;
/* Sanity check: */
@@ -1038,6 +1046,7 @@ void 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 465398ee19..e58f15ae12 100644
--- a/ext/digest/sha2/sha2.h
+++ b/ext/digest/sha2/sha2.h
@@ -165,52 +165,52 @@ typedef SHA512_CTX SHA384_CTX;
#ifndef NOPROTO
-void SHA256_Init(SHA256_CTX *);
+int SHA256_Init(SHA256_CTX *);
void SHA256_Update(SHA256_CTX*, const uint8_t*, size_t);
-void SHA256_Final(uint8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*);
+int 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]);
-void SHA384_Init(SHA384_CTX*);
+int SHA384_Init(SHA384_CTX*);
void SHA384_Update(SHA384_CTX*, const uint8_t*, size_t);
-void SHA384_Final(uint8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*);
+int 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]);
-void SHA512_Init(SHA512_CTX*);
+int SHA512_Init(SHA512_CTX*);
void SHA512_Update(SHA512_CTX*, const uint8_t*, size_t);
-void SHA512_Final(uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*);
+int 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 */
-void SHA256_Init();
+int SHA256_Init();
void SHA256_Update();
#ifdef RUBY
-void SHA256_Finish();
+int SHA256_Finish();
#else
-void SHA256_Final();
+int SHA256_Final();
#endif /* RUBY */
char* SHA256_End();
char* SHA256_Data();
-void SHA384_Init();
+int SHA384_Init();
void SHA384_Update();
#ifdef RUBY
-void SHA384_Finish();
+int SHA384_Finish();
#else
-void SHA384_Final();
+int SHA384_Final();
#endif /* RUBY */
char* SHA384_End();
char* SHA384_Data();
-void SHA512_Init();
+int SHA512_Init();
void SHA512_Update();
#ifdef RUBY
-void SHA512_Finish();
+int SHA512_Finish();
#else
-void SHA512_Final();
+int SHA512_Final();
#endif /* RUBY */
char* SHA512_End();
char* SHA512_Data();
diff --git a/ext/dl/callback/depend b/ext/dl/callback/depend
index 7a1dc1ee62..c3b4fef1db 100644
--- a/ext/dl/callback/depend
+++ b/ext/dl/callback/depend
@@ -3,7 +3,7 @@ src: callback.c \
callback-3.c callback-4.c callback-5.c \
callback-6.c callback-7.c callback-8.c
-$(OBJS): $(hdrdir)/ruby.h
+$(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 \
diff --git a/ext/dl/callback/extconf.rb b/ext/dl/callback/extconf.rb
index 6c3387670d..f3b79b0a33 100644
--- a/ext/dl/callback/extconf.rb
+++ b/ext/dl/callback/extconf.rb
@@ -1,6 +1,6 @@
require 'mkmf'
-if compiled?("dl")
+begin
callbacks = (0..8).map{|i| "callback-#{i}"}.unshift("callback")
callback_srcs = callbacks.map{|basename| "#{basename}.c"}
callback_objs = callbacks.map{|basename| "#{basename}.o"}
diff --git a/ext/dl/cfunc.c b/ext/dl/cfunc.c
index 2a96b30bed..1f4958bbdc 100644
--- a/ext/dl/cfunc.c
+++ b/ext/dl/cfunc.c
@@ -86,7 +86,6 @@ rb_dlcfunc_new(void (*func)(), int type, const char *name, ID calltype)
VALUE val;
struct cfunc_data *data;
- rb_secure(4);
if( func ){
val = TypedData_Make_Struct(rb_cDLCFunc, struct cfunc_data, &dlcfunc_data_type, data);
data->ptr = (void *)(VALUE)func;
@@ -285,7 +284,9 @@ rb_dlcfunc_set_ptr(VALUE self, VALUE addr)
}
/*
- * call-seq: inspect
+ * call-seq:
+ * inspect
+ * to_s
*
* Returns a string formatted with an easily readable representation of the
* internal state of the DL::CFunc
@@ -344,8 +345,6 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
DLSTACK_TYPE stack[DLSTACK_SIZE];
VALUE result = Qnil;
- rb_secure_update(self);
-
memset(stack, 0, sizeof(DLSTACK_TYPE) * DLSTACK_SIZE);
Check_Type(ary, T_ARRAY);
@@ -367,11 +366,14 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
stack[i] = (DLSTACK_TYPE)FIX2LONG(arg);
}
else if (RB_TYPE_P(arg, T_BIGNUM)) {
-#if SIZEOF_VOIDP == SIZEOF_LONG
- stack[i] = (DLSTACK_TYPE)rb_big2ulong_pack(arg);
-#else
- stack[i] = (DLSTACK_TYPE)rb_big2ull(arg);
-#endif
+ 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);
@@ -637,7 +639,7 @@ Init_dlcfunc(void)
* => "/lib64/libc.so.6"
* libc = DL::dlopen(libc_so)
* => #<DL::Handle:0x00000000e05b00>
- * @cfunc = DL::CFunc.new(libc,['strcpy'], DL::TYPE_VOIDP, 'strcpy')
+ * @cfunc = DL::CFunc.new(libc['strcpy'], DL::TYPE_VOIDP, 'strcpy')
* => #<DL::CFunc:0x000000012daec0 ptr=0x007f62ca5a8300 type=1 name='strcpy'>
*
*/
diff --git a/ext/dl/cptr.c b/ext/dl/cptr.c
index 636099d1fd..7a82c7c3e0 100644
--- a/ext/dl/cptr.c
+++ b/ext/dl/cptr.c
@@ -49,6 +49,7 @@ dlptr_free(void *ptr)
(*(data->free))(data->ptr);
}
}
+ xfree(ptr);
}
static size_t
@@ -69,7 +70,6 @@ rb_dlptr_new2(VALUE klass, void *ptr, long size, freefunc_t func)
struct ptr_data *data;
VALUE val;
- rb_secure(4);
val = TypedData_Make_Struct(klass, struct ptr_data, &dlptr_data_type, data);
data->ptr = ptr;
data->free = func;
@@ -90,7 +90,6 @@ rb_dlptr_malloc(long size, freefunc_t func)
{
void *ptr;
- rb_secure(4);
ptr = ruby_xmalloc((size_t)size);
memset(ptr,0,(size_t)size);
return rb_dlptr_new(ptr, size, func);
@@ -122,7 +121,6 @@ rb_dlptr_s_allocate(VALUE klass)
VALUE obj;
struct ptr_data *data;
- rb_secure(4);
obj = TypedData_Make_Struct(klass, struct ptr_data, &dlptr_data_type, data);
data->ptr = 0;
data->size = 0;
@@ -391,12 +389,10 @@ 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);
+ return rb_sprintf("#<%"PRIsVALUE":%p ptr=%p size=%ld free=%p>",
+ rb_obj_class(self), data, data->ptr, data->size, data->free);
}
/*
diff --git a/ext/dl/depend b/ext/dl/depend
index 992c17c1b8..d0a3ab8ef0 100644
--- a/ext/dl/depend
+++ b/ext/dl/depend
@@ -1,7 +1,14 @@
-cfunc.o: cfunc.c dl.h $(hdrdir)/ruby.h
+cfunc.o: cfunc.c dl.h $(HDRS) $(ruby_headers) \
+ $(hdrdir)/ruby/util.h
-cptr.o: cptr.c dl.h $(hdrdir)/ruby.h $(hdrdir)/io.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 $(hdrdir)/ruby.h
+handle.o: handle.c dl.h $(HDRS) $(ruby_headers)
-dl.o: dl.c dl.h $(hdrdir)/ruby.h $(hdrdir)/io.h
+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
index 49fa7c81ac..7ad77dd6b2 100644
--- a/ext/dl/dl.c
+++ b/ext/dl/dl.c
@@ -1,7 +1,7 @@
/*
* ext/dl/dl.c
*
- * doumentation:
+ * documentation:
* - Vincent Batts (vbatts@hashbangbash.com)
*
*/
@@ -81,8 +81,7 @@ rb_dl_malloc(VALUE self, VALUE size)
{
void *ptr;
- rb_secure(4);
- ptr = (void*)ruby_xmalloc(NUM2INT(size));
+ ptr = (void*)ruby_xmalloc(NUM2SIZET(size));
return PTR2NUM(ptr);
}
@@ -98,8 +97,7 @@ rb_dl_realloc(VALUE self, VALUE addr, VALUE size)
{
void *ptr = NUM2PTR(addr);
- rb_secure(4);
- ptr = (void*)ruby_xrealloc(ptr, NUM2INT(size));
+ ptr = (void*)ruby_xrealloc(ptr, NUM2SIZET(size));
return PTR2NUM(ptr);
}
@@ -113,7 +111,6 @@ rb_dl_free(VALUE self, VALUE addr)
{
void *ptr = NUM2PTR(addr);
- rb_secure(4);
ruby_xfree(ptr);
return Qnil;
}
@@ -137,7 +134,6 @@ rb_dl_free(VALUE self, VALUE addr)
VALUE
rb_dl_ptr2value(VALUE self, VALUE addr)
{
- rb_secure(4);
return (VALUE)NUM2PTR(addr);
}
diff --git a/ext/dl/dl.h b/ext/dl/dl.h
index 07adbbf680..f8380a8471 100644
--- a/ext/dl/dl.h
+++ b/ext/dl/dl.h
@@ -22,7 +22,7 @@
#else
# if defined(_WIN32)
# include <windows.h>
-# define dlopen(name,flag) ((void*)LoadLibrary(name))
+# 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
diff --git a/ext/dl/extconf.rb b/ext/dl/extconf.rb
index 4ef46f85fb..53e73c3a8b 100644
--- a/ext/dl/extconf.rb
+++ b/ext/dl/extconf.rb
@@ -1,7 +1,12 @@
require 'mkmf'
if RbConfig::CONFIG['GCC'] == 'yes'
- (have_macro("__clang__") ? $LDFLAGS : $CFLAGS) << " -fno-defer-pop"
+ flag = " -fno-defer-pop"
+ if have_macro("__clang__")
+ $LDFLAGS << flag if try_ldflags(flag)
+ else
+ $CFLAGS << flag
+ end
$CFLAGS << " -fno-omit-frame-pointer"
end
diff --git a/ext/dl/handle.c b/ext/dl/handle.c
index ef182e816f..6b90e089ee 100644
--- a/ext/dl/handle.c
+++ b/ext/dl/handle.c
@@ -38,6 +38,7 @@ dlhandle_free(void *ptr)
if( dlhandle->ptr && dlhandle->open && dlhandle->enable_close ){
dlclose(dlhandle->ptr);
}
+ xfree(ptr);
}
static size_t
diff --git a/ext/dl/win32/extconf.rb b/ext/dl/win32/extconf.rb
deleted file mode 100644
index 03590f24fa..0000000000
--- a/ext/dl/win32/extconf.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-if compiled?('dl') and !compiled?('fiddle') and $mswin||$bccwin||$mingw||$cygwin
- create_makefile('win32')
-end
diff --git a/ext/etc/depend b/ext/etc/depend
index f2c04f5879..a73a18465a 100644
--- a/ext/etc/depend
+++ b/ext/etc/depend
@@ -1 +1,9 @@
-etc.o : etc.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
+etc.o : etc.c constdefs.h $(HDRS) $(ruby_headers) \
+ $(hdrdir)/ruby/io.h \
+ $(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 dbf854404b..6168ed1510 100644
--- a/ext/etc/etc.c
+++ b/ext/etc/etc.c
@@ -9,6 +9,7 @@
#include "ruby.h"
#include "ruby/encoding.h"
+#include "ruby/io.h"
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
@@ -23,6 +24,12 @@
#include <grp.h>
#endif
+#include <errno.h>
+
+#ifdef HAVE_SYS_UTSNAME_H
+#include <sys/utsname.h>
+#endif
+
static VALUE sPasswd;
#ifdef HAVE_GETGRENT
static VALUE sGroup;
@@ -33,6 +40,7 @@ static VALUE sGroup;
#ifndef CSIDL_COMMON_APPDATA
#define CSIDL_COMMON_APPDATA 35
#endif
+#define HAVE_UNAME 1
#endif
#ifndef _WIN32
@@ -40,6 +48,8 @@ char *getenv();
#endif
char *getlogin();
+#include "constdefs.h"
+
/* call-seq:
* getlogin -> String
*
@@ -60,7 +70,6 @@ etc_getlogin(VALUE obj)
{
char *login;
- rb_secure(4);
#ifdef HAVE_GETLOGIN
login = getlogin();
if (!login) login = getenv("USER");
@@ -80,6 +89,20 @@ safe_setup_str(const char *str)
if (str == 0) str = "";
return rb_tainted_str_new2(str);
}
+
+static VALUE
+safe_setup_locale_str(const char *str)
+{
+ if (str == 0) str = "";
+ return rb_locale_str_new_cstr(str);
+}
+
+static VALUE
+safe_setup_filesystem_str(const char *str)
+{
+ if (str == 0) str = "";
+ return rb_filesystem_str_new_cstr(str);
+}
#endif
#ifdef HAVE_GETPWENT
@@ -88,33 +111,33 @@ setup_passwd(struct passwd *pwd)
{
if (pwd == 0) rb_sys_fail("/etc/passwd");
return rb_struct_new(sPasswd,
- safe_setup_str(pwd->pw_name),
-#ifdef HAVE_ST_PW_PASSWD
+ safe_setup_locale_str(pwd->pw_name),
+#ifdef HAVE_STRUCT_PASSWD_PW_PASSWD
safe_setup_str(pwd->pw_passwd),
#endif
UIDT2NUM(pwd->pw_uid),
GIDT2NUM(pwd->pw_gid),
-#ifdef HAVE_ST_PW_GECOS
- safe_setup_str(pwd->pw_gecos),
+#ifdef HAVE_STRUCT_PASSWD_PW_GECOS
+ safe_setup_locale_str(pwd->pw_gecos),
#endif
- safe_setup_str(pwd->pw_dir),
- safe_setup_str(pwd->pw_shell),
-#ifdef HAVE_ST_PW_CHANGE
+ safe_setup_filesystem_str(pwd->pw_dir),
+ safe_setup_filesystem_str(pwd->pw_shell),
+#ifdef HAVE_STRUCT_PASSWD_PW_CHANGE
INT2NUM(pwd->pw_change),
#endif
-#ifdef HAVE_ST_PW_QUOTA
+#ifdef HAVE_STRUCT_PASSWD_PW_QUOTA
INT2NUM(pwd->pw_quota),
#endif
-#ifdef HAVE_ST_PW_AGE
+#ifdef HAVE_STRUCT_PASSWD_PW_AGE
PW_AGE2VAL(pwd->pw_age),
#endif
-#ifdef HAVE_ST_PW_CLASS
- safe_setup_str(pwd->pw_class),
+#ifdef HAVE_STRUCT_PASSWD_PW_CLASS
+ safe_setup_locale_str(pwd->pw_class),
#endif
-#ifdef HAVE_ST_PW_COMMENT
- safe_setup_str(pwd->pw_comment),
+#ifdef HAVE_STRUCT_PASSWD_PW_COMMENT
+ safe_setup_locale_str(pwd->pw_comment),
#endif
-#ifdef HAVE_ST_PW_EXPIRE
+#ifdef HAVE_STRUCT_PASSWD_PW_EXPIRE
INT2NUM(pwd->pw_expire),
#endif
0 /*dummy*/
@@ -137,7 +160,7 @@ setup_passwd(struct passwd *pwd)
* === Example:
*
* Etc.getpwuid(0)
- * #=> #<struct Struct::Passwd name="root", passwd="x", uid=0, gid=0, gecos="root",dir="/root", shell="/bin/bash">
+ * #=> #<struct Etc::Passwd name="root", passwd="x", uid=0, gid=0, gecos="root",dir="/root", shell="/bin/bash">
*/
static VALUE
etc_getpwuid(int argc, VALUE *argv, VALUE obj)
@@ -147,7 +170,6 @@ etc_getpwuid(int argc, VALUE *argv, VALUE obj)
rb_uid_t uid;
struct passwd *pwd;
- rb_secure(4);
if (rb_scan_args(argc, argv, "01", &id) == 1) {
uid = NUM2UIDT(id);
}
@@ -175,7 +197,7 @@ etc_getpwuid(int argc, VALUE *argv, VALUE obj)
* === Example:
*
* Etc.getpwnam('root')
- * #=> #<struct Struct::Passwd name="root", passwd="x", uid=0, gid=0, gecos="root",dir="/root", shell="/bin/bash">
+ * #=> #<struct Etc::Passwd name="root", passwd="x", uid=0, gid=0, gecos="root",dir="/root", shell="/bin/bash">
*/
static VALUE
etc_getpwnam(VALUE obj, VALUE nam)
@@ -251,7 +273,6 @@ etc_passwd(VALUE obj)
#ifdef HAVE_GETPWENT
struct passwd *pw;
- rb_secure(4);
if (rb_block_given_p()) {
each_passwd();
}
@@ -354,12 +375,12 @@ setup_group(struct group *grp)
mem = rb_ary_new();
tbl = grp->gr_mem;
while (*tbl) {
- rb_ary_push(mem, safe_setup_str(*tbl));
+ rb_ary_push(mem, safe_setup_locale_str(*tbl));
tbl++;
}
return rb_struct_new(sGroup,
- safe_setup_str(grp->gr_name),
-#ifdef HAVE_ST_GR_PASSWD
+ safe_setup_locale_str(grp->gr_name),
+#ifdef HAVE_STRUCT_GROUP_GR_PASSWD
safe_setup_str(grp->gr_passwd),
#endif
GIDT2NUM(grp->gr_gid),
@@ -380,7 +401,7 @@ setup_group(struct group *grp)
* === Example:
*
* Etc.getgrgid(100)
- * #=> #<struct Struct::Group name="users", passwd="x", gid=100, mem=["meta", "root"]>
+ * #=> #<struct Etc::Group name="users", passwd="x", gid=100, mem=["meta", "root"]>
*
*/
static VALUE
@@ -391,7 +412,6 @@ etc_getgrgid(int argc, VALUE *argv, VALUE obj)
gid_t gid;
struct group *grp;
- rb_secure(4);
if (rb_scan_args(argc, argv, "01", &id) == 1) {
gid = NUM2GIDT(id);
}
@@ -419,7 +439,7 @@ etc_getgrgid(int argc, VALUE *argv, VALUE obj)
* === Example:
*
* Etc.getgrnam('users')
- * #=> #<struct Struct::Group name="users", passwd="x", gid=100, mem=["meta", "root"]>
+ * #=> #<struct Etc::Group name="users", passwd="x", gid=100, mem=["meta", "root"]>
*
*/
static VALUE
@@ -428,7 +448,6 @@ etc_getgrnam(VALUE obj, VALUE nam)
#ifdef HAVE_GETGRENT
struct group *grp;
- rb_secure(4);
SafeStringValue(nam);
grp = getgrnam(RSTRING_PTR(nam));
if (grp == 0) rb_raise(rb_eArgError, "can't find group for %"PRIsVALUE, nam);
@@ -494,7 +513,6 @@ etc_group(VALUE obj)
#ifdef HAVE_GETGRENT
struct group *grp;
- rb_secure(4);
if (rb_block_given_p()) {
each_group();
}
@@ -624,10 +642,255 @@ etc_systmpdir(void)
#else
tmpdir = rb_filesystem_str_new_cstr("/tmp");
#endif
- FL_UNSET(tmpdir, FL_TAINT|FL_UNTRUSTED);
+ 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
+ *
+ * # Number of processors.
+ * # It is not standardized.
+ * Etc.sysconf(Etc::SC_NPROCESSORS_ONLN) #=> 4
+ *
+ */
+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
+
/*
* The Etc module provides access to information typically stored in
* files in the /etc directory on Unix systems.
@@ -660,6 +923,8 @@ 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);
@@ -677,32 +942,43 @@ 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);
- sPasswd = rb_struct_define("Passwd",
- "name", "passwd", "uid", "gid",
-#ifdef HAVE_ST_PW_GECOS
- "gecos",
+ sPasswd = rb_struct_define_under(mEtc, "Passwd",
+ "name",
+#ifdef HAVE_STRUCT_PASSWD_PW_PASSWD
+ "passwd",
+#endif
+ "uid",
+ "gid",
+#ifdef HAVE_STRUCT_PASSWD_PW_GECOS
+ "gecos",
#endif
- "dir", "shell",
-#ifdef HAVE_ST_PW_CHANGE
- "change",
+ "dir",
+ "shell",
+#ifdef HAVE_STRUCT_PASSWD_PW_CHANGE
+ "change",
#endif
-#ifdef HAVE_ST_PW_QUOTA
- "quota",
+#ifdef HAVE_STRUCT_PASSWD_PW_QUOTA
+ "quota",
#endif
-#ifdef HAVE_ST_PW_AGE
- "age",
+#ifdef HAVE_STRUCT_PASSWD_PW_AGE
+ "age",
#endif
-#ifdef HAVE_ST_PW_CLASS
- "uclass",
+#ifdef HAVE_STRUCT_PASSWD_PW_CLASS
+ "uclass",
#endif
-#ifdef HAVE_ST_PW_COMMENT
- "comment",
+#ifdef HAVE_STRUCT_PASSWD_PW_COMMENT
+ "comment",
#endif
-#ifdef HAVE_ST_PW_EXPIRE
- "expire",
+#ifdef HAVE_STRUCT_PASSWD_PW_EXPIRE
+ "expire",
#endif
- NULL);
+ NULL);
+#if 0
/* Define-const: Passwd
*
* Passwd is a Struct that contains the following members:
@@ -728,31 +1004,34 @@ Init_etc(void)
* contains a longer String description of the user, such as
* a full name. Some Unix systems provide structured information in the
* gecos field, but this is system-dependent.
- * must be compiled with +HAVE_ST_PW_GECOS+
+ * must be compiled with +HAVE_STRUCT_PASSWD_PW_GECOS+
* change::
- * password change time(integer) must be compiled with +HAVE_ST_PW_CHANGE+
+ * password change time(integer) must be compiled with +HAVE_STRUCT_PASSWD_PW_CHANGE+
* quota::
- * quota value(integer) must be compiled with +HAVE_ST_PW_QUOTA+
+ * quota value(integer) must be compiled with +HAVE_STRUCT_PASSWD_PW_QUOTA+
* age::
- * password age(integer) must be compiled with +HAVE_ST_PW_AGE+
+ * password age(integer) must be compiled with +HAVE_STRUCT_PASSWD_PW_AGE+
* class::
- * user access class(string) must be compiled with +HAVE_ST_PW_CLASS+
+ * user access class(string) must be compiled with +HAVE_STRUCT_PASSWD_PW_CLASS+
* comment::
- * comment(string) must be compiled with +HAVE_ST_PW_COMMENT+
+ * comment(string) must be compiled with +HAVE_STRUCT_PASSWD_PW_COMMENT+
* expire::
- * account expiration time(integer) must be compiled with +HAVE_ST_PW_EXPIRE+
+ * account expiration time(integer) must be compiled with +HAVE_STRUCT_PASSWD_PW_EXPIRE+
*/
rb_define_const(mEtc, "Passwd", sPasswd);
+#endif
+ rb_define_const(rb_cStruct, "Passwd", sPasswd); /* deprecated name */
rb_extend_object(sPasswd, rb_mEnumerable);
rb_define_singleton_method(sPasswd, "each", etc_each_passwd, 0);
#ifdef HAVE_GETGRENT
- sGroup = rb_struct_define("Group", "name",
-#ifdef HAVE_ST_GR_PASSWD
- "passwd",
+ sGroup = rb_struct_define_under(mEtc, "Group", "name",
+#ifdef HAVE_STRUCT_GROUP_GR_PASSWD
+ "passwd",
#endif
- "gid", "mem", NULL);
+ "gid", "mem", NULL);
+#if 0
/* Define-const: Group
*
* Group is a Struct that is only available when compiled with +HAVE_GETGRENT+.
@@ -767,7 +1046,7 @@ Init_etc(void)
* string is returned if no password is needed to obtain membership of
* the group.
*
- * Must be compiled with +HAVE_ST_GR_PASSWD+.
+ * Must be compiled with +HAVE_STRUCT_GROUP_GR_PASSWD+.
* gid::
* contains the group's numeric ID as an integer.
* mem::
@@ -775,6 +1054,8 @@ Init_etc(void)
* members of the group.
*/
rb_define_const(mEtc, "Group", sGroup);
+#endif
+ rb_define_const(rb_cStruct, "Group", sGroup); /* deprecated name */
rb_extend_object(sGroup, rb_mEnumerable);
rb_define_singleton_method(sGroup, "each", etc_each_group, 0);
#endif
diff --git a/ext/etc/extconf.rb b/ext/etc/extconf.rb
index 1967560cd4..c6b41a4c92 100644
--- a/ext/etc/extconf.rb
+++ b/ext/etc/extconf.rb
@@ -1,30 +1,43 @@
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
-a = have_func("getlogin")
-b = have_func("getpwent")
-c = have_func("getgrent")
+have_func("uname((struct utsname *)NULL)", headers)
+have_func("getlogin")
+have_func("getpwent")
+have_func("getgrent")
sysconfdir = RbConfig.expand(RbConfig::CONFIG["sysconfdir"].dup, "prefix"=>"", "DESTDIR"=>"")
$defs.push("-DSYSCONFDIR=#{Shellwords.escape(sysconfdir.dump)}")
-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)
+
+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"
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')
- create_makefile("etc")
+ $defs.push("-DPW_AGE2VAL="+f)
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
new file mode 100644
index 0000000000..c9fddfd132
--- /dev/null
+++ b/ext/etc/mkconstants.rb
@@ -0,0 +1,331 @@
+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 597fc78f60..3a240aad0b 100755
--- a/ext/extmk.rb
+++ b/ext/extmk.rb
@@ -1,6 +1,7 @@
#! /usr/local/bin/ruby
# -*- mode: ruby; coding: us-ascii -*-
+# :stopdoc:
$extension = nil
$extstatic = nil
$force_static = nil
@@ -68,6 +69,18 @@ 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)
if !(target = m[/^TARGET[ \t]*=[ \t]*(\S*)/, 1])
@@ -104,7 +117,9 @@ def extract_makefile(makefile, keep = true)
/^STATIC_LIB[ \t]*=[ \t]*\S+/ =~ m or $static = false
end
$preload = Shellwords.shellwords(m[/^preload[ \t]*=[ \t]*(.*)/, 1] || "")
- $DLDFLAGS += " " + (m[/^dldflags[ \t]*=[ \t]*(.*)/, 1] || "")
+ if dldflags = m[/^dldflags[ \t]*=[ \t]*(.*)/, 1] and !$DLDFLAGS.include?(dldflags)
+ $DLDFLAGS += " " + dldflags
+ end
if s = m[/^LIBS[ \t]*=[ \t]*(.*)/, 1]
s.sub!(/^#{Regexp.quote($LIBRUBYARG)} */, "")
s.sub!(/ *#{Regexp.quote($LIBS)}$/, "")
@@ -126,6 +141,16 @@ 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
@@ -144,8 +169,10 @@ def extmake(target)
$srcs = []
$compiled[target] = false
makefile = "./Makefile"
- ok = File.exist?(makefile)
- unless $ignore
+ static = $static
+ $static = nil if noinstall = File.fnmatch?("-*", target)
+ ok = parent && File.exist?(makefile)
+ if parent && !$ignore
rbconfig0 = RbConfig::CONFIG
mkconfig0 = CONFIG
rbconfig = {
@@ -214,10 +241,17 @@ def extmake(target)
$0 = $PROGRAM_NAME
end
end
- ok &&= File.open(makefile){|f| !f.gets[DUMMY_SIGNATURE]}
+ ok &&= File.open(makefile){|f| s = f.gets and !s[DUMMY_SIGNATURE]}
ok = yield(ok) if block_given?
- unless ok
- open(makefile, "w") 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
+ atomic_write_open(makefile) do |f|
f.puts "# " + DUMMY_SIGNATURE
f.print(*dummy_makefile(CONFIG["srcdir"]))
end
@@ -236,7 +270,7 @@ def extmake(target)
unless $destdir.to_s.empty? or $mflags.defined?("DESTDIR")
args += [sysquote("DESTDIR=" + relative_from($destdir, "../"+prefix))]
end
- if $static and ok and !$objs.empty? and !File.fnmatch?("-*", target)
+ if $static and ok and !$objs.empty? and !noinstall
args += ["static"] unless $clean
$extlist.push [$static, target, $target, $preload]
end
@@ -264,13 +298,15 @@ def extmake(target)
end
ensure
Logging::log_close
- unless $ignore
+ if rbconfig0
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)
@@ -279,6 +315,7 @@ def extmake(target)
$top_srcdir = top_srcdir
$topdir = topdir
$hdrdir = hdrdir
+ $static = static
Dir.chdir dir
end
begin
@@ -334,6 +371,9 @@ 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
end
begin
$optparser.parse!(ARGV)
@@ -482,6 +522,9 @@ 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
@@ -498,7 +541,7 @@ Dir::chdir('ext')
hdrdir = $hdrdir
$hdrdir = ($top_srcdir = relative_from(srcdir, $topdir = "..")) + "/include"
exts.each do |d|
- $static = $force_static ? true : $static_ext[target]
+ $static = $force_static ? true : $static_ext[d]
if $ignore or !$nodynamic or $static
extmake(d) or abort
@@ -543,17 +586,18 @@ unless $extlist.empty?
list = $extlist.dup
built = []
while e = list.shift
- s,t,i,r,os = e
- if r and !(r -= built).empty?
+ _, target, feature, required = e
+ if required and !(required -= built).empty?
l = list.size
- if (while l > 0; break true if r.include?(list[l-=1][1]) end)
+ if (while l > 0; break true if required.include?(list[l-=1][1]) end)
list.insert(l + 1, e)
end
next
end
- $extinit << " init(Init_#{File.basename i}, \"#{i}.so\");\n"
- $extobjs << format("ext/%s/%s.%s", t, File.basename(i), $LIBEXT)
- built << t
+ base = File.basename(feature)
+ $extinit << " init(Init_#{base}, \"#{feature}.so\");\n"
+ $extobjs << format("ext/%s/%s.%s", target, base, $LIBEXT)
+ built << target
end
src = %{\
@@ -622,7 +666,7 @@ $mflags.unshift("topdir=#$topdir")
ENV.delete("RUBYOPT")
if $configure_only and $command_output
exts.map! {|d| "ext/#{d}/."}
- open($command_output, "wb") do |mf|
+ atomic_write_open($command_output) do |mf|
mf.puts "V = 0"
mf.puts "Q1 = $(V:1=)"
mf.puts "Q = $(Q1:0=@)"
@@ -650,6 +694,17 @@ if $configure_only and $command_output
mf.macro "EXTOBJS", $extlist.empty? ? ["dmyext.#{$OBJEXT}"] : ["ext/extinit.#{$OBJEXT}", *$extobjs]
mf.macro "EXTLIBS", $extlibs
mf.macro "EXTLDFLAGS", $extflags.split
+ submakeopts = []
+ if enable_config("shared", $enable_shared)
+ submakeopts << 'DLDOBJS="$(EXTOBJS) $(ENCOBJS)"'
+ submakeopts << 'EXTSOLIBS="$(EXTLIBS)"'
+ submakeopts << 'LIBRUBY_SO_UPDATE=$(LIBRUBY_EXTS)'
+ else
+ submakeopts << 'EXTOBJS="$(EXTOBJS) $(ENCOBJS)"'
+ submakeopts << 'EXTLIBS="$(EXTLIBS)"'
+ end
+ submakeopts << 'EXTLDFLAGS="$(EXTLDFLAGS)"'
+ mf.macro "SUBMAKEOPTS", submakeopts
mf.puts
targets = %w[all install static install-so install-rb clean distclean realclean]
targets.each do |tgt|
@@ -660,27 +715,26 @@ if $configure_only and $command_output
mf.puts "distclean:\n\t-$(Q)$(RM) ext/extinit.c"
mf.puts
mf.puts "#{rubies.join(' ')}: $(extensions:/.=/#{$force_static ? 'static' : 'all'})"
- (["all static"] + rubies).each_with_index do |tgt, i|
- mf.print "#{tgt}:\n\t$(Q)$(MAKE) "
- mf.print "$(MFLAGS) "
- if enable_config("shared", $enable_shared)
- mf.print %[DLDOBJS="$(EXTOBJS) $(ENCOBJS)" EXTSOLIBS="$(EXTLIBS)" ]
- mf.print 'LIBRUBY_SO_UPDATE=$(LIBRUBY_EXTS) '
- else
- mf.print %[EXTOBJS="$(EXTOBJS) $(ENCOBJS)" EXTLIBS="$(EXTLIBS)" ]
- end
- mf.print 'EXTLDFLAGS="$(EXTLDFLAGS)" '
- if i == 0
- mf.puts rubies.join(' ')
- else
- mf.puts '$@'
- end
+ submake = "$(Q)$(MAKE) $(MFLAGS) $(SUBMAKEOPTS)"
+ mf.puts "all static: $(EXTOBJS)\n\t#{submake} #{rubies.join(' ')}\n"
+ $extobjs.each do |tgt|
+ mf.puts "#{tgt}: #{File.dirname(tgt)}/static"
+ end
+ mf.puts "#{rubies.join(' ')}: $(EXTOBJS)"
+ rubies.each do |tgt|
+ mf.puts "#{tgt}:\n\t#{submake} $@"
end
mf.puts
- exec = config_string("exec") {|str| str + " "}
+ if $gnumake == "yes"
+ submake = "$(MAKE) -C $(@D)"
+ else
+ submake = "cd $(@D) && "
+ config_string("exec") {|str| submake << str << " "}
+ submake << "$(MAKE)"
+ end
targets.each do |tgt|
exts.each do |d|
- mf.puts "#{d[0..-2]}#{tgt}:\n\t$(Q)cd $(@D) && #{exec}$(MAKE) $(MFLAGS) V=$(V) $(@F)"
+ mf.puts "#{d[0..-2]}#{tgt}:\n\t$(Q)#{submake} $(MFLAGS) V=$(V) $(@F)"
end
end
end
@@ -710,6 +764,7 @@ elsif !$configure_only
$mflags.concat(rubies)
system($make, *sysquote($mflags)) or exit($?.exitstatus)
end
+# :startdoc:
#Local variables:
# mode: ruby
diff --git a/ext/fcntl/depend b/ext/fcntl/depend
deleted file mode 100644
index 10eab64a46..0000000000
--- a/ext/fcntl/depend
+++ /dev/null
@@ -1 +0,0 @@
-fcntl.o: fcntl.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
diff --git a/ext/fiddle/closure.c b/ext/fiddle/closure.c
index d064f11991..e0f7e4b12d 100644
--- a/ext/fiddle/closure.c
+++ b/ext/fiddle/closure.c
@@ -10,18 +10,24 @@ typedef struct {
ffi_type **argv;
} fiddle_closure;
-#if defined(MACOSX) || defined(__linux__) || defined(__OpenBSD__)
-#define DONT_USE_FFI_CLOSURE_ALLOC
+#if defined(USE_FFI_CLOSURE_ALLOC)
+#elif defined(__OpenBSD__) || defined(__APPLE__) || defined(__linux__)
+# define USE_FFI_CLOSURE_ALLOC 0
+#elif defined(RUBY_LIBFFI_MODVERSION) && RUBY_LIBFFI_MODVERSION < 3000005 && \
+ (defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_AMD64))
+# define USE_FFI_CLOSURE_ALLOC 0
+#else
+# define USE_FFI_CLOSURE_ALLOC 1
#endif
static void
dealloc(void * ptr)
{
fiddle_closure * cls = (fiddle_closure *)ptr;
-#ifndef DONT_USE_FFI_CLOSURE_ALLOC
+#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);
@@ -170,7 +176,7 @@ allocate(VALUE klass)
VALUE i = TypedData_Make_Struct(klass, fiddle_closure,
&closure_data_type, closure);
-#ifndef DONT_USE_FFI_CLOSURE_ALLOC
+#if USE_FFI_CLOSURE_ALLOC
closure->pcl = ffi_closure_alloc(sizeof(ffi_closure), &closure->code);
#else
closure->pcl = mmap(NULL, sizeof(ffi_closure), PROT_READ | PROT_WRITE,
@@ -222,13 +228,13 @@ initialize(int rbargc, VALUE argv[], VALUE self)
if (FFI_OK != result)
rb_raise(rb_eRuntimeError, "error prepping CIF %d", result);
-#ifndef DONT_USE_FFI_CLOSURE_ALLOC
+#if USE_FFI_CLOSURE_ALLOC
result = ffi_prep_closure_loc(pcl, cif, callback,
(void *)self, cl->code);
#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");
}
diff --git a/ext/fiddle/depend b/ext/fiddle/depend
new file mode 100644
index 0000000000..e786dc71d2
--- /dev/null
+++ b/ext/fiddle/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/fiddle/extconf.rb b/ext/fiddle/extconf.rb
index 2cb9ae0ace..466d77e6dd 100644
--- a/ext/fiddle/extconf.rb
+++ b/ext/fiddle/extconf.rb
@@ -5,6 +5,12 @@ require 'mkmf'
dir_config 'libffi'
pkg_config("libffi")
+if ver = pkg_config("libffi", "modversion")
+ 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 }})
+end
+
unless have_header('ffi.h')
if have_header('ffi/ffi.h')
$defs.push(format('-DUSE_HEADER_HACKS'))
diff --git a/ext/fiddle/fiddle.c b/ext/fiddle/fiddle.c
index 89644301aa..9f3d1537d6 100644
--- a/ext/fiddle/fiddle.c
+++ b/ext/fiddle/fiddle.c
@@ -48,8 +48,7 @@ rb_fiddle_malloc(VALUE self, VALUE size)
{
void *ptr;
- rb_secure(4);
- ptr = (void*)ruby_xmalloc(NUM2INT(size));
+ ptr = (void*)ruby_xmalloc(NUM2SIZET(size));
return PTR2NUM(ptr);
}
@@ -65,8 +64,7 @@ rb_fiddle_realloc(VALUE self, VALUE addr, VALUE size)
{
void *ptr = NUM2PTR(addr);
- rb_secure(4);
- ptr = (void*)ruby_xrealloc(ptr, NUM2INT(size));
+ ptr = (void*)ruby_xrealloc(ptr, NUM2SIZET(size));
return PTR2NUM(ptr);
}
@@ -80,7 +78,6 @@ rb_fiddle_free(VALUE self, VALUE addr)
{
void *ptr = NUM2PTR(addr);
- rb_secure(4);
ruby_xfree(ptr);
return Qnil;
}
@@ -104,7 +101,6 @@ rb_fiddle_free(VALUE self, VALUE addr)
VALUE
rb_fiddle_ptr2value(VALUE self, VALUE addr)
{
- rb_secure(4);
return (VALUE)NUM2PTR(addr);
}
@@ -144,7 +140,7 @@ Init_fiddle(void)
*
* It wraps {libffi}[http://sourceware.org/libffi/], a popular C library
* which provides a portable interface that allows code written in one
- * language to clal code written in another language.
+ * language to call code written in another language.
*
* == Example
*
diff --git a/ext/fiddle/function.c b/ext/fiddle/function.c
index eecd755f1f..50366bb87f 100644
--- a/ext/fiddle/function.c
+++ b/ext/fiddle/function.c
@@ -1,7 +1,28 @@
#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 cFiddleFunction;
+#define MAX_ARGS (SIZE_MAX / (sizeof(void *) + sizeof(fiddle_generic)) - 1)
+
+#define Check_Max_Args(name, len) \
+ if ((size_t)(len) < MAX_ARGS) { \
+ /* OK */ \
+ } \
+ else { \
+ rb_raise(rb_eTypeError, \
+ name" is so large that it can cause integer overflow (%d)", \
+ (len)); \
+ }
+
static void
deallocate(void *p)
{
@@ -53,12 +74,13 @@ 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, key);
- }
- return ST_CONTINUE;
+ 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;
}
static VALUE
@@ -74,6 +96,7 @@ initialize(int argc, VALUE argv[], VALUE self)
if(NIL_P(abi)) abi = INT2NUM(FFI_DEFAULT_ABI);
Check_Type(args, T_ARRAY);
+ Check_Max_Args("args", RARRAY_LENINT(args));
rb_iv_set(self, "@ptr", ptr);
rb_iv_set(self, "@args", args);
@@ -114,11 +137,13 @@ function_call(int argc, VALUE argv[], VALUE self)
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 != RARRAY_LENINT(types)) {
rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)",
argc, RARRAY_LENINT(types));
@@ -135,8 +160,9 @@ function_call(int argc, VALUE argv[], VALUE self)
}
}
- values = xcalloc((size_t)argc + 1, (size_t)sizeof(void *));
- generic_args = xcalloc((size_t)argc, (size_t)sizeof(fiddle_generic));
+ generic_args = ALLOCV(alloc_buffer,
+ (size_t)(argc + 1) * sizeof(void *) + (size_t)argc * sizeof(fiddle_generic));
+ values = (void **)((char *)generic_args + (size_t)argc * sizeof(fiddle_generic));
for (i = 0; i < argc; i++) {
VALUE type = RARRAY_PTR(types)[i];
@@ -144,9 +170,9 @@ function_call(int argc, VALUE argv[], VALUE self)
if(NUM2INT(type) == TYPE_VOIDP) {
if(NIL_P(src)) {
- src = INT2NUM(0);
+ src = INT2FIX(0);
} else if(cPointer != CLASS_OF(src)) {
- src = rb_funcall(cPointer, rb_intern("[]"), 1, src);
+ src = rb_funcall(cPointer, rb_intern("[]"), 1, src);
}
src = rb_Integer(src);
}
@@ -163,8 +189,7 @@ function_call(int argc, VALUE argv[], VALUE self)
rb_funcall(mFiddle, rb_intern("win32_last_error="), 1, INT2NUM(errno));
#endif
- xfree(values);
- xfree(generic_args);
+ ALLOCV_END(alloc_buffer);
return GENERIC2VALUE(rb_iv_get(self, "@return_type"), retval);
}
diff --git a/ext/fiddle/handle.c b/ext/fiddle/handle.c
index 832ff3319a..36970a2248 100644
--- a/ext/fiddle/handle.c
+++ b/ext/fiddle/handle.c
@@ -40,6 +40,7 @@ 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
@@ -113,10 +114,18 @@ predefined_fiddle_handle(void *handle)
/*
* call-seq:
- * new(lib = nil, flags = Fiddle::RTLD_LAZY | Fiddle::RTLD_GLOBAL)
+ * new(library = nil, flags = Fiddle::RTLD_LAZY | Fiddle::RTLD_GLOBAL)
*
- * Create a new handler that opens library named +lib+ with +flags+. If no
- * library is specified, RTLD_DEFAULT is used.
+ * Create a new handler that opens +library+ with +flags+.
+ *
+ * If no +library+ is specified or +nil+ is given, DEFAULT is used, which is
+ * the equivalent to RTLD_DEFAULT. See <code>man 3 dlopen</code> for more.
+ *
+ * lib = Fiddle::Handle.new
+ *
+ * The default is dependent on OS, and provide a handle for all libraries
+ * already loaded. For example, in most cases you can use this to access +libc+
+ * functions, or ruby functions like +rb_str_new+.
*/
static VALUE
rb_fiddle_handle_initialize(int argc, VALUE argv[], VALUE self)
diff --git a/ext/fiddle/lib/fiddle.rb b/ext/fiddle/lib/fiddle.rb
index c8a7ef1b05..ae6e299637 100644
--- a/ext/fiddle/lib/fiddle.rb
+++ b/ext/fiddle/lib/fiddle.rb
@@ -32,6 +32,15 @@ module Fiddle
# Creates a new handler that opens +library+, and returns an instance of
# Fiddle::Handle.
#
+ # If +nil+ is given for the +library+, Fiddle::Handle::DEFAULT is used, which
+ # is the equivalent to RTLD_DEFAULT. See <code>man 3 dlopen</code> for more.
+ #
+ # lib = Fiddle.dlopen(nil)
+ #
+ # The default is dependent on OS, and provide a handle for all libraries
+ # already loaded. For example, in most cases you can use this to access
+ # +libc+ functions, or ruby functions like +rb_str_new+.
+ #
# See Fiddle::Handle.new for more.
def dlopen library
Fiddle::Handle.new library
diff --git a/ext/fiddle/lib/fiddle/import.rb b/ext/fiddle/lib/fiddle/import.rb
index 8b948e8f23..34f5d7f81c 100644
--- a/ext/fiddle/lib/fiddle/import.rb
+++ b/ext/fiddle/lib/fiddle/import.rb
@@ -63,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 istance of
+ # Fiddle::Handle, Fiddle::Importer, or will create a new instance of
# Fiddle::Handle using Fiddle.dlopen
#
# Raises a DLError if the library cannot be loaded.
@@ -112,7 +112,7 @@ module Fiddle
when TYPE_LONG
return SIZEOF_LONG
when TYPE_LONG_LONG
- return SIZEOF_LONG_LON
+ return SIZEOF_LONG_LONG
when TYPE_FLOAT
return SIZEOF_FLOAT
when TYPE_DOUBLE
diff --git a/ext/fiddle/pointer.c b/ext/fiddle/pointer.c
index fb9b31012f..a09daf77ea 100644
--- a/ext/fiddle/pointer.c
+++ b/ext/fiddle/pointer.c
@@ -7,6 +7,15 @@
#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*);
@@ -56,6 +65,7 @@ fiddle_ptr_free(void *ptr)
(*(data->free))(data->ptr);
}
}
+ xfree(ptr);
}
static size_t
@@ -76,7 +86,6 @@ rb_fiddle_ptr_new2(VALUE klass, void *ptr, long size, freefunc_t func)
struct ptr_data *data;
VALUE val;
- rb_secure(4);
val = TypedData_Make_Struct(klass, struct ptr_data, &fiddle_ptr_data_type, data);
data->ptr = ptr;
data->free = func;
@@ -97,7 +106,6 @@ rb_fiddle_ptr_malloc(long size, freefunc_t func)
{
void *ptr;
- rb_secure(4);
ptr = ruby_xmalloc((size_t)size);
memset(ptr,0,(size_t)size);
return rb_fiddle_ptr_new(ptr, size, func);
@@ -129,7 +137,6 @@ rb_fiddle_ptr_s_allocate(VALUE klass)
VALUE obj;
struct ptr_data *data;
- rb_secure(4);
obj = TypedData_Make_Struct(klass, struct ptr_data, &fiddle_ptr_data_type, data);
data->ptr = 0;
data->size = 0;
@@ -430,12 +437,10 @@ 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);
- 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);
+ return rb_sprintf("#<%"PRIsVALUE":%p ptr=%p size=%ld free=%p>",
+ RB_OBJ_CLASSNAME(self), data, data->ptr, data->size, data->free);
}
/*
diff --git a/ext/fiddle/win32/extconf.rb b/ext/fiddle/win32/extconf.rb
deleted file mode 100644
index c4efee8149..0000000000
--- a/ext/fiddle/win32/extconf.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-if compiled?('fiddle') and $mswin||$mingw||$cygwin
- create_makefile('win32')
-end
diff --git a/ext/fiddle/win32/lib/win32/registry.rb b/ext/fiddle/win32/lib/win32/registry.rb
deleted file mode 100644
index f1aa3640a8..0000000000
--- a/ext/fiddle/win32/lib/win32/registry.rb
+++ /dev/null
@@ -1,845 +0,0 @@
-require 'fiddle/import'
-module Win32
-
-=begin rdoc
-= Win32 Registry
-
-win32/registry is registry accessor library for Win32 platform.
-It uses fiddle/import to call Win32 Registry APIs.
-
-== example
- Win32::Registry::HKEY_CURRENT_USER.open('SOFTWARE\foo') do |reg|
- value = reg['foo'] # read a value
- value = reg['foo', Win32::Registry::REG_SZ] # read a value with type
- type, value = reg.read('foo') # read a value
- reg['foo'] = 'bar' # write a value
- reg['foo', Win32::Registry::REG_SZ] = 'bar' # write a value with type
- reg.write('foo', Win32::Registry::REG_SZ, 'bar') # write a value
-
- reg.each_value { |name, type, data| ... } # Enumerate values
- reg.each_key { |key, wtime| ... } # Enumerate subkeys
-
- reg.delete_value(name) # Delete a value
- reg.delete_key(name) # Delete a subkey
- reg.delete_key(name, true) # Delete a subkey recursively
- end
-
-= Reference
-
-== Win32::Registry class
-
---- info
-
---- num_keys
-
---- max_key_length
-
---- num_values
-
---- max_value_name_length
-
---- max_value_length
-
---- descriptor_length
-
---- wtime
- Returns an item of key information.
-
-=== constants
---- HKEY_CLASSES_ROOT
-
---- HKEY_CURRENT_USER
-
---- HKEY_LOCAL_MACHINE
-
---- HKEY_PERFORMANCE_DATA
-
---- HKEY_CURRENT_CONFIG
-
---- HKEY_DYN_DATA
-
- Win32::Registry object whose key is predefined key.
-For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/predefined_keys.asp] article.
-
-=end rdoc
-
- class Registry
-
- #
- # For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/registry.asp].
- #
- # --- HKEY_*
- #
- # Predefined key ((*handle*)).
- # These are Integer, not Win32::Registry.
- #
- # --- REG_*
- #
- # Registry value type.
- #
- # --- KEY_*
- #
- # Security access mask.
- #
- # --- KEY_OPTIONS_*
- #
- # Key options.
- #
- # --- REG_CREATED_NEW_KEY
- #
- # --- REG_OPENED_EXISTING_KEY
- #
- # If the key is created newly or opened existing key.
- # See also Registry#disposition method.
- module Constants
- HKEY_CLASSES_ROOT = 0x80000000
- HKEY_CURRENT_USER = 0x80000001
- HKEY_LOCAL_MACHINE = 0x80000002
- HKEY_USERS = 0x80000003
- HKEY_PERFORMANCE_DATA = 0x80000004
- HKEY_PERFORMANCE_TEXT = 0x80000050
- HKEY_PERFORMANCE_NLSTEXT = 0x80000060
- HKEY_CURRENT_CONFIG = 0x80000005
- HKEY_DYN_DATA = 0x80000006
-
- REG_NONE = 0
- REG_SZ = 1
- REG_EXPAND_SZ = 2
- REG_BINARY = 3
- REG_DWORD = 4
- REG_DWORD_LITTLE_ENDIAN = 4
- REG_DWORD_BIG_ENDIAN = 5
- REG_LINK = 6
- REG_MULTI_SZ = 7
- REG_RESOURCE_LIST = 8
- REG_FULL_RESOURCE_DESCRIPTOR = 9
- REG_RESOURCE_REQUIREMENTS_LIST = 10
- REG_QWORD = 11
- REG_QWORD_LITTLE_ENDIAN = 11
-
- STANDARD_RIGHTS_READ = 0x00020000
- STANDARD_RIGHTS_WRITE = 0x00020000
- KEY_QUERY_VALUE = 0x0001
- KEY_SET_VALUE = 0x0002
- KEY_CREATE_SUB_KEY = 0x0004
- KEY_ENUMERATE_SUB_KEYS = 0x0008
- KEY_NOTIFY = 0x0010
- KEY_CREATE_LINK = 0x0020
- KEY_READ = STANDARD_RIGHTS_READ |
- KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS | KEY_NOTIFY
- KEY_WRITE = STANDARD_RIGHTS_WRITE |
- KEY_SET_VALUE | KEY_CREATE_SUB_KEY
- KEY_EXECUTE = KEY_READ
- KEY_ALL_ACCESS = KEY_READ | KEY_WRITE | KEY_CREATE_LINK
-
- REG_OPTION_RESERVED = 0x0000
- REG_OPTION_NON_VOLATILE = 0x0000
- REG_OPTION_VOLATILE = 0x0001
- REG_OPTION_CREATE_LINK = 0x0002
- REG_OPTION_BACKUP_RESTORE = 0x0004
- REG_OPTION_OPEN_LINK = 0x0008
- REG_LEGAL_OPTION = REG_OPTION_RESERVED |
- REG_OPTION_NON_VOLATILE | REG_OPTION_CREATE_LINK |
- REG_OPTION_BACKUP_RESTORE | REG_OPTION_OPEN_LINK
-
- REG_CREATED_NEW_KEY = 1
- REG_OPENED_EXISTING_KEY = 2
-
- REG_WHOLE_HIVE_VOLATILE = 0x0001
- REG_REFRESH_HIVE = 0x0002
- REG_NO_LAZY_FLUSH = 0x0004
- REG_FORCE_RESTORE = 0x0008
-
- MAX_KEY_LENGTH = 514
- MAX_VALUE_LENGTH = 32768
- end
- include Constants
- include Enumerable
-
- #
- # Error
- #
- class Error < ::StandardError
- module Kernel32
- extend Fiddle::Importer
- dlload "kernel32.dll"
- end
- FormatMessageA = Kernel32.extern "int FormatMessageA(int, void *, int, int, void *, int, void *)", :stdcall
- def initialize(code)
- @code = code
- msg = "\0".force_encoding(Encoding::ASCII_8BIT) * 1024
- len = FormatMessageA.call(0x1200, 0, code, 0, msg, 1024, 0)
- msg = msg[0, len].force_encoding(Encoding.find(Encoding.locale_charmap))
- super msg.tr("\r", '').chomp
- end
- attr_reader :code
- end
-
- #
- # Predefined Keys
- #
- class PredefinedKey < Registry
- def initialize(hkey, keyname)
- @hkey = hkey
- @parent = nil
- @keyname = keyname
- @disposition = REG_OPENED_EXISTING_KEY
- end
-
- # Predefined keys cannot be closed
- def close
- raise Error.new(5) ## ERROR_ACCESS_DENIED
- end
-
- # Fake #class method for Registry#open, Registry#create
- def class
- Registry
- end
-
- # Make all
- Constants.constants.grep(/^HKEY_/) do |c|
- Registry.const_set c, new(Constants.const_get(c), c.to_s)
- end
- end
-
- #
- # Win32 APIs
- #
- module API
- extend Fiddle::Importer
- dlload "advapi32.dll"
- [
- "long RegOpenKeyExA(void *, void *, long, long, void *)",
- "long RegCreateKeyExA(void *, void *, long, long, long, long, void *, void *, void *)",
- "long RegEnumValueA(void *, long, void *, void *, void *, void *, void *, void *)",
- "long RegEnumKeyExA(void *, long, void *, void *, void *, void *, void *, void *)",
- "long RegQueryValueExA(void *, void *, void *, void *, void *, void *)",
- "long RegSetValueExA(void *, void *, long, long, void *, long)",
- "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 *)",
- ].each do |fn|
- cfunc = extern fn, :stdcall
- const_set cfunc.name.intern, cfunc
- end
-
- module_function
-
- def check(result)
- raise Error, result, caller(2) if result != 0
- end
-
- def packdw(dw)
- [dw].pack('V')
- end
-
- def unpackdw(dw)
- dw += [0].pack('V')
- dw.unpack('V')[0]
- end
-
- def packqw(qw)
- [ qw & 0xFFFFFFFF, qw >> 32 ].pack('VV')
- end
-
- def unpackqw(qw)
- qw = qw.unpack('VV')
- (qw[1] << 32) | qw[0]
- end
-
- def OpenKey(hkey, name, opt, desired)
- result = packdw(0)
- check RegOpenKeyExA.call(hkey, name, opt, desired, result)
- unpackdw(result)
- end
-
- def CreateKey(hkey, name, opt, desired)
- result = packdw(0)
- disp = packdw(0)
- check RegCreateKeyExA.call(hkey, name, 0, 0, opt, desired,
- 0, result, disp)
- [ unpackdw(result), unpackdw(disp) ]
- end
-
- def EnumValue(hkey, index)
- name = ' ' * Constants::MAX_KEY_LENGTH
- size = packdw(Constants::MAX_KEY_LENGTH)
- check RegEnumValueA.call(hkey, index, name, size, 0, 0, 0, 0)
- name[0, unpackdw(size)]
- end
-
- def EnumKey(hkey, index)
- name = ' ' * Constants::MAX_KEY_LENGTH
- size = packdw(Constants::MAX_KEY_LENGTH)
- wtime = ' ' * 8
- check RegEnumKeyExA.call(hkey, index, name, size, 0, 0, 0, wtime)
- [ name[0, unpackdw(size)], unpackqw(wtime) ]
- end
-
- def QueryValue(hkey, name)
- type = packdw(0)
- size = packdw(0)
- check RegQueryValueExA.call(hkey, name, 0, type, 0, size)
- data = ' ' * unpackdw(size)
- check RegQueryValueExA.call(hkey, name, 0, type, data, size)
- [ unpackdw(type), data[0, unpackdw(size)] ]
- end
-
- def SetValue(hkey, name, type, data, size)
- check RegSetValueExA.call(hkey, name, 0, type, data, size)
- end
-
- def DeleteValue(hkey, name)
- check RegDeleteValue.call(hkey, name)
- end
-
- def DeleteKey(hkey, name)
- check RegDeleteKey.call(hkey, name)
- end
-
- def FlushKey(hkey)
- check RegFlushKey.call(hkey)
- end
-
- def CloseKey(hkey)
- check RegCloseKey.call(hkey)
- end
-
- def QueryInfoKey(hkey)
- subkeys = packdw(0)
- maxsubkeylen = packdw(0)
- values = packdw(0)
- maxvaluenamelen = packdw(0)
- maxvaluelen = packdw(0)
- secdescs = packdw(0)
- wtime = ' ' * 8
- check RegQueryInfoKey.call(hkey, 0, 0, 0, subkeys, maxsubkeylen, 0,
- values, maxvaluenamelen, maxvaluelen, secdescs, wtime)
- [ unpackdw(subkeys), unpackdw(maxsubkeylen), unpackdw(values),
- unpackdw(maxvaluenamelen), unpackdw(maxvaluelen),
- unpackdw(secdescs), unpackqw(wtime) ]
- end
- end
-
- #
- # Replace %\w+% into the environment value of what is contained between the %'s
- # This method is used for REG_EXPAND_SZ.
- #
- # For detail, see expandEnvironmentStrings[http://msdn.microsoft.com/library/en-us/sysinfo/base/expandenvironmentstrings.asp] \Win32 \API.
- #
- def self.expand_environ(str)
- str.gsub(/%([^%]+)%/) { ENV[$1] || ENV[$1.upcase] || $& }
- end
-
- @@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
- ].each do |type|
- @@type2name[Constants.const_get(type)] = type
- end
-
- #
- # Convert registry type value to readable string.
- #
- def self.type2name(type)
- @@type2name[type] || type.to_s
- end
-
- #
- # Convert 64-bit FILETIME integer into Time object.
- #
- def self.wtime2time(wtime)
- Time.at((wtime - 116444736000000000) / 10000000)
- end
-
- #
- # Convert Time object or Integer object into 64-bit FILETIME.
- #
- def self.time2wtime(time)
- time.to_i * 10000000 + 116444736000000000
- end
-
- #
- # constructor
- #
- private_class_method :new
-
- #
- # --- Registry.open(key, subkey, desired = KEY_READ, opt = REG_OPTION_RESERVED)
- #
- # --- Registry.open(key, subkey, desired = KEY_READ, opt = REG_OPTION_RESERVED) { |reg| ... }
- #
- # Open the registry key subkey under key.
- # key is Win32::Registry object of parent key.
- # You can use predefined key HKEY_* (see Constants)
- # desired and opt is access mask and key option.
- # For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/regopenkeyex.asp].
- # If block is given, the key is closed automatically.
- def self.open(hkey, subkey, desired = KEY_READ, opt = REG_OPTION_RESERVED)
- subkey = subkey.chomp('\\')
- newkey = API.OpenKey(hkey.hkey, subkey, opt, desired)
- obj = new(newkey, hkey, subkey, REG_OPENED_EXISTING_KEY)
- if block_given?
- begin
- yield obj
- ensure
- obj.close
- end
- else
- obj
- end
- end
-
- #
- # --- Registry.create(key, subkey, desired = KEY_ALL_ACCESS, opt = REG_OPTION_RESERVED)
- #
- # --- Registry.create(key, subkey, desired = KEY_ALL_ACCESS, opt = REG_OPTION_RESERVED) { |reg| ... }
- #
- # Create or open the registry key subkey under key.
- # You can use predefined key HKEY_* (see Constants)
- #
- # If subkey is already exists, key is opened and Registry#created?
- # method will return false.
- #
- # If block is given, the key is closed automatically.
- #
- def self.create(hkey, subkey, desired = KEY_ALL_ACCESS, opt = REG_OPTION_RESERVED)
- newkey, disp = API.CreateKey(hkey.hkey, subkey, opt, desired)
- obj = new(newkey, hkey, subkey, disp)
- if block_given?
- begin
- yield obj
- ensure
- obj.close
- end
- else
- obj
- end
- end
-
- #
- # finalizer
- #
- @@final = proc { |hkey| proc { API.CloseKey(hkey[0]) if hkey[0] } }
-
- #
- # initialize
- #
- def initialize(hkey, parent, keyname, disposition)
- @hkey = hkey
- @parent = parent
- @keyname = keyname
- @disposition = disposition
- @hkeyfinal = [ hkey ]
- ObjectSpace.define_finalizer self, @@final.call(@hkeyfinal)
- end
-
- # Returns key handle value.
- attr_reader :hkey
- # Win32::Registry object of parent key, or nil if predefeined key.
- attr_reader :parent
- # Same as subkey value of Registry.open or
- # Registry.create method.
- attr_reader :keyname
- # Disposition value (REG_CREATED_NEW_KEY or REG_OPENED_EXISTING_KEY).
- attr_reader :disposition
-
- #
- # Returns if key is created ((*newly*)).
- # (see Registry.create) -- basically you call create
- # then when you call created? on the instance returned
- # it will tell if it was successful or not
- #
- def created?
- @disposition == REG_CREATED_NEW_KEY
- end
-
- #
- # Returns if key is not closed.
- #
- def open?
- !@hkey.nil?
- end
-
- #
- # Full path of key such as 'HKEY_CURRENT_USER\SOFTWARE\foo\bar'.
- #
- def name
- parent = self
- name = @keyname
- while parent = parent.parent
- name = parent.keyname + '\\' + name
- end
- name
- end
-
- def inspect
- "\#<Win32::Registry key=#{name.inspect}>"
- end
-
- #
- # marshalling is not allowed
- #
- def _dump(depth)
- raise TypeError, "can't dump Win32::Registry"
- end
-
- #
- # Same as Win32::Registry.open (self, subkey, desired, opt)
- #
- def open(subkey, desired = KEY_READ, opt = REG_OPTION_RESERVED, &blk)
- self.class.open(self, subkey, desired, opt, &blk)
- end
-
- #
- # Same as Win32::Registry.create (self, subkey, desired, opt)
- #
- def create(subkey, desired = KEY_ALL_ACCESS, opt = REG_OPTION_RESERVED, &blk)
- self.class.create(self, subkey, desired, opt, &blk)
- end
-
- #
- # Close key.
- #
- # After close, most method raise an error.
- #
- def close
- API.CloseKey(@hkey)
- @hkey = @parent = @keyname = nil
- @hkeyfinal[0] = nil
- end
-
- #
- # Enumerate values.
- #
- def each_value
- index = 0
- while true
- begin
- subkey = API.EnumValue(@hkey, index)
- rescue Error
- break
- end
- begin
- type, data = read(subkey)
- rescue Error
- next
- end
- yield subkey, type, data
- index += 1
- end
- index
- end
- alias each each_value
-
- #
- # Enumerate subkeys.
- #
- # subkey is String which contains name of subkey.
- # wtime is last write time as FILETIME (64-bit integer).
- # (see Registry.wtime2time)
- #
- def each_key
- index = 0
- while true
- begin
- subkey, wtime = API.EnumKey(@hkey, index)
- rescue Error
- break
- end
- yield subkey, wtime
- index += 1
- end
- index
- end
-
- #
- # return keys as an array
- #
- def keys
- keys_ary = []
- each_key { |key,| keys_ary << key }
- keys_ary
- end
-
- # Read a registry value named name and return array of
- # [ type, data ].
- # When name is nil, the `default' value is read.
- # type is value type. (see Win32::Registry::Constants module)
- # data is value data, its class is:
- # :REG_SZ, REG_EXPAND_SZ
- # String
- # :REG_MULTI_SZ
- # Array of String
- # :REG_DWORD, REG_DWORD_BIG_ENDIAN, REG_QWORD
- # Integer
- # :REG_BINARY
- # String (contains binary data)
- #
- # When rtype is specified, the value type must be included by
- # rtype array, or TypeError is raised.
- def read(name, *rtype)
- type, data = API.QueryValue(@hkey, name)
- unless rtype.empty? or rtype.include?(type)
- raise TypeError, "Type mismatch (expect #{rtype.inspect} but #{type} present)"
- end
- case type
- when REG_SZ, REG_EXPAND_SZ
- [ type, data.chop ]
- when REG_MULTI_SZ
- [ type, data.split(/\0/) ]
- when REG_BINARY
- [ type, data ]
- when REG_DWORD
- [ type, API.unpackdw(data) ]
- when REG_DWORD_BIG_ENDIAN
- [ type, data.unpack('N')[0] ]
- when REG_QWORD
- [ type, API.unpackqw(data) ]
- else
- raise TypeError, "Type #{type} is not supported."
- end
- end
-
- #
- # Read a registry value named name and return its value data.
- # The class of value is same as #read method returns.
- #
- # If the value type is REG_EXPAND_SZ, returns value data whose environment
- # variables are replaced.
- # If the value type is neither REG_SZ, REG_MULTI_SZ, REG_DWORD,
- # REG_DWORD_BIG_ENDIAN, nor REG_QWORD, TypeError is raised.
- #
- # The meaning of rtype is same as #read method.
- #
- def [](name, *rtype)
- type, data = read(name, *rtype)
- case type
- when REG_SZ, REG_DWORD, REG_QWORD, REG_MULTI_SZ
- data
- when REG_EXPAND_SZ
- Registry.expand_environ(data)
- else
- raise TypeError, "Type #{type} is not supported."
- end
- end
-
- # Read a REG_SZ(read_s), REG_DWORD(read_i), or REG_BINARY(read_bin)
- # registry value named name.
- #
- # If the values type does not match, TypeError is raised.
- def read_s(name)
- read(name, REG_SZ)[1]
- end
-
- #
- # Read a REG_SZ or REG_EXPAND_SZ registry value named name.
- #
- # If the value type is REG_EXPAND_SZ, environment variables are replaced.
- # Unless the value type is REG_SZ or REG_EXPAND_SZ, TypeError is raised.
- #
- def read_s_expand(name)
- type, data = read(name, REG_SZ, REG_EXPAND_SZ)
- if type == REG_EXPAND_SZ
- Registry.expand_environ(data)
- else
- data
- end
- end
-
- #
- # Read a REG_SZ(read_s), REG_DWORD(read_i), or REG_BINARY(read_bin)
- # registry value named name.
- #
- # If the values type does not match, TypeError is raised.
- #
- def read_i(name)
- read(name, REG_DWORD, REG_DWORD_BIG_ENDIAN, REG_QWORD)[1]
- end
-
- #
- # Read a REG_SZ(read_s), REG_DWORD(read_i), or REG_BINARY(read_bin)
- # registry value named name.
- #
- # If the values type does not match, TypeError is raised.
- #
- def read_bin(name)
- read(name, REG_BINARY)[1]
- end
-
- #
- # Write data to a registry value named name.
- # When name is nil, write to the `default' value.
- #
- # type is type value. (see Registry::Constants module)
- # Class of data must be same as which #read
- # method returns.
- #
- def write(name, type, data)
- case type
- when REG_SZ, REG_EXPAND_SZ
- data = data.to_s + "\0"
- when REG_MULTI_SZ
- data = data.to_a.join("\0") + "\0\0"
- when REG_BINARY
- data = data.to_s
- when REG_DWORD
- data = API.packdw(data.to_i)
- when REG_DWORD_BIG_ENDIAN
- data = [data.to_i].pack('N')
- when REG_QWORD
- data = API.packqw(data.to_i)
- else
- raise TypeError, "Unsupported type #{type}"
- end
- API.SetValue(@hkey, name, type, data, data.length)
- end
-
- #
- # Write value to a registry value named name.
- #
- # If wtype is specified, the value type is it.
- # Otherwise, the value type is depend on class of value:
- # :Integer
- # REG_DWORD
- # :String
- # REG_SZ
- # :Array
- # REG_MULTI_SZ
- #
- def []=(name, rtype, value = nil)
- if value
- write name, rtype, value
- else
- case value = rtype
- when Integer
- write name, REG_DWORD, value
- when String
- write name, REG_SZ, value
- when Array
- write name, REG_MULTI_SZ, value
- else
- raise TypeError, "Unexpected type #{value.class}"
- end
- end
- value
- end
-
- #
- # Write value to a registry value named name.
- #
- # The value type is REG_SZ(write_s), REG_DWORD(write_i), or
- # REG_BINARY(write_bin).
- #
- def write_s(name, value)
- write name, REG_SZ, value.to_s
- end
-
- #
- # Write value to a registry value named name.
- #
- # The value type is REG_SZ(write_s), REG_DWORD(write_i), or
- # REG_BINARY(write_bin).
- #
- def write_i(name, value)
- write name, REG_DWORD, value.to_i
- end
-
- #
- # Write value to a registry value named name.
- #
- # The value type is REG_SZ(write_s), REG_DWORD(write_i), or
- # REG_BINARY(write_bin).
- #
- def write_bin(name, value)
- write name, REG_BINARY, value.to_s
- end
-
- #
- # Delete a registry value named name.
- # We can not delete the `default' value.
- #
- def delete_value(name)
- API.DeleteValue(@hkey, name)
- end
- alias delete delete_value
-
- #
- # Delete a subkey named name and all its values.
- #
- # If recursive is false, the subkey must not have subkeys.
- # Otherwise, this method deletes all subkeys and values recursively.
- #
- def delete_key(name, recursive = false)
- if recursive
- open(name, KEY_ALL_ACCESS) do |reg|
- reg.keys.each do |key|
- begin
- reg.delete_key(key, true)
- rescue Error
- #
- end
- end
- end
- API.DeleteKey(@hkey, name)
- else
- begin
- API.EnumKey @hkey, 0
- rescue Error
- return API.DeleteKey(@hkey, name)
- end
- raise Error.new(5) ## ERROR_ACCESS_DENIED
- end
- end
-
- #
- # Write all the attributes into the registry file.
- #
- def flush
- API.FlushKey @hkey
- end
-
- #
- # Returns key information as Array of:
- # :num_keys
- # The number of subkeys.
- # :max_key_length
- # Maximum length of name of subkeys.
- # :num_values
- # The number of values.
- # :max_value_name_length
- # Maximum length of name of values.
- # :max_value_length
- # Maximum length of value of values.
- # :descriptor_length
- # Length of security descriptor.
- # :wtime
- # Last write time as FILETIME(64-bit integer)
- #
- # For detail, see RegQueryInfoKey[http://msdn.microsoft.com/library/en-us/sysinfo/base/regqueryinfokey.asp] Win32 API.
- #
- def info
- API.QueryInfoKey(@hkey)
- end
-
- #
- # Returns an item of key information.
- #
- %w[
- num_keys max_key_length
- num_values max_value_name_length max_value_length
- descriptor_length wtime
- ].each_with_index do |s, i|
- eval <<-__END__
- def #{s}
- info[#{i}]
- end
- __END__
- end
- end
-end
diff --git a/ext/fiddle/win32/lib/win32/resolv.rb b/ext/fiddle/win32/lib/win32/resolv.rb
deleted file mode 100644
index 1315f32c61..0000000000
--- a/ext/fiddle/win32/lib/win32/resolv.rb
+++ /dev/null
@@ -1,379 +0,0 @@
-=begin
-= Win32 DNS and DHCP I/F
-
-=end
-
-require "fiddle/import"
-require 'win32/registry'
-
-module Win32
- module Resolv
- API = Registry::API
-
- def self.get_hosts_path
- path = get_hosts_dir
- path = File.expand_path('hosts', path)
- File.exist?(path) ? path : nil
- end
-
- def self.get_resolv_info
- search, nameserver = get_info
- if search.empty?
- search = nil
- else
- search.delete("")
- search.uniq!
- end
- if nameserver.empty?
- nameserver = nil
- else
- nameserver.delete("")
- nameserver.delete("0.0.0.0")
- nameserver.uniq!
- end
- [ search, nameserver ]
- end
-
-module Kernel32
- extend Fiddle::Importer
- dlload "kernel32"
-end
-getv = Kernel32.extern "int GetVersionExA(void *)", :stdcall
-info = [ 148, 0, 0, 0, 0 ].pack('V5') + "\0" * 128
-getv.call(info)
-if info.unpack('V5')[4] == 2 # VER_PLATFORM_WIN32_NT
-#====================================================================
-# Windows NT
-#====================================================================
- module_eval <<-'__EOS__', __FILE__, __LINE__+1
- TCPIP_NT = 'SYSTEM\CurrentControlSet\Services\Tcpip\Parameters'
-
- class << self
- private
- def get_hosts_dir
- Registry::HKEY_LOCAL_MACHINE.open(TCPIP_NT) do |reg|
- reg.read_s_expand('DataBasePath')
- end
- end
-
- def get_info
- search = nil
- nameserver = []
- Registry::HKEY_LOCAL_MACHINE.open(TCPIP_NT) do |reg|
- begin
- slist = reg.read_s('SearchList')
- search = slist.split(/,\s*/) unless slist.empty?
- rescue Registry::Error
- end
-
- if add_search = search.nil?
- search = []
- begin
- nvdom = reg.read_s('NV Domain')
- unless nvdom.empty?
- @search = [ nvdom ]
- if reg.read_i('UseDomainNameDevolution') != 0
- if /^\w+\./ =~ nvdom
- devo = $'
- end
- end
- end
- rescue Registry::Error
- end
- end
-
- reg.open('Interfaces') do |h|
- h.each_key do |iface,|
- h.open(iface) do |regif|
- begin
- [ 'NameServer', 'DhcpNameServer' ].each do |key|
- begin
- ns = regif.read_s(key)
- rescue
- else
- unless ns.empty?
- nameserver.concat(ns.split(/[,\s]\s*/))
- break
- end
- end
- end
- rescue Registry::Error
- end
-
- if add_search
- begin
- [ 'Domain', 'DhcpDomain' ].each do |key|
- dom = regif.read_s(key)
- unless dom.empty?
- search.concat(dom.split(/,\s*/))
- break
- end
- end
- rescue Registry::Error
- end
- end
- end
- end
- end
- search << devo if add_search and devo
- end
- [ search.uniq, nameserver.uniq ]
- end
- end
- __EOS__
-else
-#====================================================================
-# Windows 9x
-#====================================================================
- module_eval <<-'__EOS__', __FILE__, __LINE__+1
- TCPIP_9X = 'SYSTEM\CurrentControlSet\Services\VxD\MSTCP'
- DHCP_9X = 'SYSTEM\CurrentControlSet\Services\VxD\DHCP'
- WINDOWS = 'Software\Microsoft\Windows\CurrentVersion'
-
- class << self
- # private
-
- def get_hosts_dir
- Registry::HKEY_LOCAL_MACHINE.open(WINDOWS) do |reg|
- reg.read_s_expand('SystemRoot')
- end
- end
-
- def get_info
- search = []
- nameserver = []
- begin
- Registry::HKEY_LOCAL_MACHINE.open(TCPIP_9X) do |reg|
- if reg.read_s("EnableDNS") == "1"
- domain = reg.read_s("Domain")
- ns = reg.read_s("NameServer")
- slist = reg.read_s("SearchList")
- search << domain unless domain.empty?
- search.concat(slist.split(/,\s*/))
- nameserver.concat(ns.split(/[,\s]\s*/))
- end
- end
- rescue Registry::Error
- end
-
- dhcpinfo = get_dhcpinfo
- search.concat(dhcpinfo[0])
- nameserver.concat(dhcpinfo[1])
- [ search, nameserver ]
- end
-
- def get_dhcpinfo
- macaddrs = {}
- ipaddrs = {}
- WsControl.get_iflist.each do |index, macaddr, *ipaddr|
- macaddrs[macaddr] = 1
- ipaddr.each { |ipaddr| ipaddrs[ipaddr] = 1 }
- end
- iflist = [ macaddrs, ipaddrs ]
-
- search = []
- nameserver = []
- version = -1
- Registry::HKEY_LOCAL_MACHINE.open(DHCP_9X) do |reg|
- begin
- version = API.unpackdw(reg.read_bin("Version"))
- rescue Registry::Error
- end
-
- reg.each_key do |key,|
- catch(:not_used) do
- reg.open(key) do |regdi|
- dom, ns = get_dhcpinfo_key(version, regdi, iflist)
- search << dom if dom
- nameserver.concat(ns) if ns
- end
- end
- end
- end
- [ search, nameserver ]
- end
-
- def get_dhcpinfo_95(reg)
- dhcp = reg.read_bin("DhcpInfo")
- [
- API.unpackdw(dhcp[4..7]),
- API.unpackdw(dhcp[8..11]),
- 1,
- dhcp[45..50],
- reg.read_bin("OptionInfo"),
- ]
- end
-
- def get_dhcpinfo_98(reg)
- [
- API.unpackdw(reg.read_bin("DhcpIPAddress")),
- API.unpackdw(reg.read_bin("DhcpSubnetMask")),
- API.unpackdw(reg.read_bin("HardwareType")),
- reg.read_bin("HardwareAddress"),
- reg.read_bin("OptionInfo"),
- ]
- end
-
- def get_dhcpinfo_key(version, reg, iflist)
- info = case version
- when 1
- get_dhcpinfo_95(reg)
- when 2
- get_dhcpinfo_98(reg)
- else
- begin
- get_dhcpinfo_98(reg)
- rescue Registry::Error
- get_dhcpinfo_95(reg)
- end
- end
- ipaddr, netmask, hwtype, macaddr, opt = info
- throw :not_used unless
- ipaddr and ipaddr != 0 and
- netmask and netmask != 0 and
- macaddr and macaddr.size == 6 and
- hwtype == 1 and
- iflist[0][macaddr] and iflist[1][ipaddr]
-
- size = opt.size
- idx = 0
- while idx <= size
- opttype = opt[idx]
- optsize = opt[idx + 1]
- optval = opt[idx + 2, optsize]
- case opttype
- when 0xFF ## term
- break
- when 0x0F ## domain
- domain = optval.chomp("\0")
- when 0x06 ## dns
- nameserver = optval.scan(/..../).collect { |addr|
- "%d.%d.%d.%d" % addr.unpack('C4')
- }
- end
- idx += optsize + 2
- end
- [ domain, nameserver ]
- rescue Registry::Error
- throw :not_used
- end
- end
-
- module WsControl
- module WSock32
- extend Fiddle::Importer
- dlload "wsock32.dll"
- end
- WsControl = WSock32.extern "int WsControl(int, int, void *, void *, void *, void *", :stdcall
- WSAGetLastError = WSock32.extern "int WSAGetLastError(void)", :stdcall
-
- MAX_TDI_ENTITIES = 512
- IPPROTO_TCP = 6
- WSCTL_TCP_QUERY_INFORMATION = 0
- INFO_CLASS_GENERIC = 0x100
- INFO_CLASS_PROTOCOL = 0x200
- INFO_TYPE_PROVIDER = 0x100
- ENTITY_LIST_ID = 0
- GENERIC_ENTITY = 0
- CL_NL_ENTITY = 0x301
- IF_ENTITY = 0x200
- ENTITY_TYPE_ID = 1
- CL_NL_IP = 0x303
- IF_MIB = 0x202
- IF_MIB_STATS_ID = 1
- IP_MIB_ADDRTABLE_ENTRY_ID = 0x102
-
- def self.wsctl(tei_entity, tei_instance,
- toi_class, toi_type, toi_id,
- buffsize)
- reqinfo = [
- ## TDIEntityID
- tei_entity, tei_instance,
- ## TDIObjectID
- toi_class, toi_type, toi_id,
- ## TCP_REQUEST_INFORMATION_EX
- ""
- ].pack('VVVVVa16')
- reqsize = API.packdw(reqinfo.size)
- buff = "\0" * buffsize
- buffsize = API.packdw(buffsize)
- result = WsControl.call(
- IPPROTO_TCP,
- WSCTL_TCP_QUERY_INFORMATION,
- reqinfo, reqsize,
- buff, buffsize)
- if result != 0
- raise RuntimeError, "WsControl failed.(#{result})"
- end
- [ buff, API.unpackdw(buffsize) ]
- end
- private_class_method :wsctl
-
- def self.get_iflist
- # Get TDI Entity List
- entities, size =
- wsctl(GENERIC_ENTITY, 0,
- INFO_CLASS_GENERIC,
- INFO_TYPE_PROVIDER,
- ENTITY_LIST_ID,
- MAX_TDI_ENTITIES * 8) # sizeof(TDIEntityID)
- entities = entities[0, size].
- scan(/.{8}/).
- collect { |e| e.unpack('VV') }
-
- # Get MIB Interface List
- iflist = []
- ifcount = 0
- entities.each do |entity, instance|
- if( (entity & IF_ENTITY)>0 )
- ifcount += 1
- etype, = wsctl(entity, instance,
- INFO_CLASS_GENERIC,
- INFO_TYPE_PROVIDER,
- ENTITY_TYPE_ID,
- 4)
- if( (API.unpackdw(etype) & IF_MIB)==IF_MIB )
- ifentry, = wsctl(entity, instance,
- INFO_CLASS_PROTOCOL,
- INFO_TYPE_PROVIDER,
- IF_MIB_STATS_ID,
- 21 * 4 + 8 + 130) # sizeof(IFEntry)
- iflist << [
- API.unpackdw(ifentry[0,4]),
- ifentry[20, 6]
- ]
- end
- end
- end
-
- # Get IP Addresses
- entities.each do |entity, instance|
- if entity == CL_NL_ENTITY
- etype, = wsctl(entity, instance,
- INFO_CLASS_GENERIC,
- INFO_TYPE_PROVIDER,
- ENTITY_TYPE_ID,
- 4)
- if API.unpackdw(etype) == CL_NL_IP
- ipentries, = wsctl(entity, instance,
- INFO_CLASS_PROTOCOL,
- INFO_TYPE_PROVIDER,
- IP_MIB_ADDRTABLE_ENTRY_ID,
- 24 * (ifcount+1)) # sizeof(IPAddrEntry)
- ipentries.scan(/.{24}/) do |ipentry|
- ipaddr, index = ipentry.unpack('VV')
- if ifitem = iflist.assoc(index)
- ifitem << ipaddr
- end
- end
- end
- end
- end
- iflist
- end
- end
- __EOS__
-end
-#====================================================================
- end
-end
diff --git a/ext/gdbm/depend b/ext/gdbm/depend
deleted file mode 100644
index c080a81619..0000000000
--- a/ext/gdbm/depend
+++ /dev/null
@@ -1 +0,0 @@
-gdbm.o: gdbm.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
diff --git a/ext/gdbm/gdbm.c b/ext/gdbm/gdbm.c
index 9d958d54a2..851afea497 100644
--- a/ext/gdbm/gdbm.c
+++ b/ext/gdbm/gdbm.c
@@ -106,10 +106,10 @@ closed_dbm(void)
if ((dbmp)->di_dbm == 0) closed_dbm();\
} while (0)
-#define GetDBM2(obj, data, dbm) {\
- GetDBM((obj), (data));\
- (dbm) = dbmp->di_dbm;\
-}
+#define GetDBM2(obj, dbmp, dbm) do {\
+ GetDBM((obj), (dbmp));\
+ (dbm) = (dbmp)->di_dbm;\
+} while (0)
static void
free_dbm(struct dbmdata *dbmp)
@@ -506,7 +506,6 @@ fgdbm_values_at(int argc, VALUE *argv, VALUE obj)
static void
rb_gdbm_modify(VALUE obj)
{
- rb_secure(4);
if (OBJ_FROZEN(obj)) rb_error_frozen("GDBM");
}
@@ -725,7 +724,7 @@ fgdbm_store(VALUE obj, VALUE keystr, VALUE valstr)
}
static VALUE
-update_i(VALUE pair, VALUE dbm)
+update_i(RB_BLOCK_CALL_FUNC_ARGLIST(pair, dbm))
{
Check_Type(pair, T_ARRAY);
if (RARRAY_LEN(pair) < 2) {
@@ -879,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
- * correspoding _value_ as a parameter.
+ * corresponding _value_ as a parameter.
*/
static VALUE
fgdbm_each_pair(VALUE obj)
@@ -953,7 +952,9 @@ fgdbm_values(VALUE obj)
/*
* call-seq:
+ * gdbm.include?(k) -> true or false
* gdbm.has_key?(k) -> true or false
+ * gdbm.member?(k) -> true or false
* gdbm.key?(k) -> true or false
*
* Returns true if the given key _k_ exists within the database.
@@ -1061,7 +1062,7 @@ fgdbm_reorganize(VALUE obj)
* gdbm.sync -> gdbm
*
* Unless the _gdbm_ object has been opened with the *SYNC* flag, it is not
- * guarenteed that database modification operations are immediately applied to
+ * guaranteed 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/console.c b/ext/io/console/console.c
index cab8207ce7..de5ca82558 100644
--- a/ext/io/console/console.c
+++ b/ext/io/console/console.c
@@ -7,6 +7,8 @@
#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
@@ -23,6 +25,10 @@ typedef OpenFile rb_io_t;
#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;
@@ -101,7 +107,23 @@ 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(rb_intern("min")));
VALUE vtime = rb_hash_aref(vopts, ID2SYM(rb_intern("time")));
@@ -588,6 +610,7 @@ console_iflush(VALUE io)
#if defined HAVE_TERMIOS_H || defined HAVE_TERMIO_H
if (tcflush(fd, TCIFLUSH)) rb_sys_fail(0);
#endif
+ (void)fd;
return io;
}
@@ -610,6 +633,7 @@ console_oflush(VALUE io)
#if defined HAVE_TERMIOS_H || defined HAVE_TERMIO_H
if (tcflush(fd, TCOFLUSH)) rb_sys_fail(0);
#endif
+ (void)fd;
return io;
}
@@ -686,7 +710,7 @@ console_dev(VALUE klass)
int fd;
#ifdef CONSOLE_DEVICE_FOR_WRITING
- fd = rb_cloexec_open(CONSOLE_DEVICE_FOR_WRITING, O_WRONLY, 0);
+ fd = rb_cloexec_open(CONSOLE_DEVICE_FOR_WRITING, O_RDWR, 0);
if (fd < 0) return Qnil;
rb_update_max_fd(fd);
args[1] = INT2FIX(O_WRONLY);
@@ -705,7 +729,11 @@ console_dev(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
@@ -723,6 +751,12 @@ console_dev(VALUE klass)
return con;
}
+/*
+ * call-seq:
+ * io.getch(min: nil, time: nil) -> char
+ *
+ * See IO#getch.
+ */
static VALUE
io_getch(int argc, VALUE *argv, VALUE io)
{
@@ -758,7 +792,7 @@ InitVM_console(void)
rb_define_method(rb_cIO, "ioflush", console_ioflush, 0);
rb_define_singleton_method(rb_cIO, "console", console_dev, 0);
{
- VALUE mReadable = rb_define_module_under(rb_cIO, "readable");
+ VALUE mReadable = rb_define_module_under(rb_cIO, "generic_readable");
rb_define_method(mReadable, "getch", io_getch, -1);
}
}
diff --git a/ext/io/console/depend b/ext/io/console/depend
new file mode 100644
index 0000000000..e786dc71d2
--- /dev/null
+++ b/ext/io/console/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/io/console/extconf.rb b/ext/io/console/extconf.rb
index 57cd7ad87f..bbd1235986 100644
--- a/ext/io/console/extconf.rb
+++ b/ext/io/console/extconf.rb
@@ -12,9 +12,15 @@ when have_header(hdr = "sgtty.h")
else
ok = false
end
-have_header("sys/ioctl.h")
-have_func("rb_io_get_write_io", "ruby/io.h")
-have_func("dup3", "unistd.h")
+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")
+ 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 fd8a9aaf3e..f71e1b9b8f 100644
--- a/ext/io/console/io-console.gemspec
+++ b/ext/io/console/io-console.gemspec
@@ -9,10 +9,13 @@ Gem::Specification.new do |s|
s.summary = "Console interface"
s.email = "nobu@ruby-lang.org"
s.description = "add console capabilities to IO instances."
+ s.required_ruby_version = ">= 2.0.0"
s.homepage = "http://www.ruby-lang.org"
s.authors = ["Nobu Nakada"]
s.require_path = %[.]
s.files = %w[console.c extconf.rb lib/console/size.rb]
s.extensions = %w[extconf.rb]
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 e9d8a1fbb6..519bc3be6d 100644
--- a/ext/io/console/lib/console/size.rb
+++ b/ext/io/console/lib/console/size.rb
@@ -1,3 +1,4 @@
+# fallback to console window size
def IO.default_console_size
[
ENV["LINES"].to_i.nonzero? || 25,
@@ -12,6 +13,7 @@ rescue LoadError
alias console_size default_console_size
end
else
+ # returns console window size
def IO.console_size
console.winsize
rescue NoMethodError
diff --git a/ext/io/nonblock/depend b/ext/io/nonblock/depend
new file mode 100644
index 0000000000..e786dc71d2
--- /dev/null
+++ b/ext/io/nonblock/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/io/nonblock/nonblock.c b/ext/io/nonblock/nonblock.c
index 1d866ceb0f..ccd8728a31 100644
--- a/ext/io/nonblock/nonblock.c
+++ b/ext/io/nonblock/nonblock.c
@@ -30,6 +30,12 @@ io_nonblock_mode(int fd)
#endif
#ifdef F_GETFL
+/*
+ * call-seq:
+ * io.nonblock? -> boolean
+ *
+ * Returns +true+ if an IO object is in non-blocking mode.
+ */
static VALUE
rb_io_nonblock_p(VALUE io)
{
@@ -61,6 +67,13 @@ io_nonblock_set(int fd, int f, int nb)
rb_sys_fail(0);
}
+/*
+ * call-seq:
+ * io.nonblock = boolean -> boolean
+ *
+ * Enables non-blocking mode on a stream when set to
+ * +true+, and blocking mode when set to +false+.
+ */
static VALUE
rb_io_nonblock_set(VALUE io, VALUE nb)
{
@@ -79,6 +92,16 @@ io_nonblock_restore(VALUE arg)
return Qnil;
}
+/*
+ * call-seq:
+ * io.nonblock {|io| } -> io
+ * io.nonblock(boolean) {|io| } -> io
+ *
+ * Yields +self+ in non-blocking mode.
+ *
+ * When +false+ is given as an argument, +self+ is yielded in blocking mode.
+ * The original mode is restored after the block is executed.
+ */
static VALUE
rb_io_nonblock_block(int argc, VALUE *argv, VALUE io)
{
@@ -106,9 +129,7 @@ rb_io_nonblock_block(int argc, VALUE *argv, VALUE io)
void
Init_nonblock(void)
{
- VALUE io = rb_cIO;
-
- rb_define_method(io, "nonblock?", rb_io_nonblock_p, 0);
- rb_define_method(io, "nonblock=", rb_io_nonblock_set, 1);
- rb_define_method(io, "nonblock", rb_io_nonblock_block, -1);
+ rb_define_method(rb_cIO, "nonblock?", rb_io_nonblock_p, 0);
+ rb_define_method(rb_cIO, "nonblock=", rb_io_nonblock_set, 1);
+ rb_define_method(rb_cIO, "nonblock", rb_io_nonblock_block, -1);
}
diff --git a/ext/io/wait/depend b/ext/io/wait/depend
new file mode 100644
index 0000000000..e786dc71d2
--- /dev/null
+++ b/ext/io/wait/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/io/wait/wait.c b/ext/io/wait/wait.c
index c7a290fd4f..d8bb55fc47 100644
--- a/ext/io/wait/wait.c
+++ b/ext/io/wait/wait.c
@@ -96,6 +96,8 @@ io_ready_p(VALUE io)
* call-seq:
* 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 input is available or times out and returns self or nil when
* EOF is reached.
diff --git a/ext/json/fbuffer/fbuffer.h b/ext/json/fbuffer/fbuffer.h
index af74187566..1e860eb790 100644
--- a/ext/json/fbuffer/fbuffer.h
+++ b/ext/json/fbuffer/fbuffer.h
@@ -25,6 +25,15 @@
#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())
diff --git a/ext/json/generator/depend b/ext/json/generator/depend
index 1a042a2501..593a8fbb54 100644
--- a/ext/json/generator/depend
+++ b/ext/json/generator/depend
@@ -1 +1,2 @@
+$(OBJS): $(ruby_headers)
generator.o: generator.c generator.h $(srcdir)/../fbuffer/fbuffer.h
diff --git a/ext/json/generator/generator.c b/ext/json/generator/generator.c
index ae4593c940..1b9652df24 100644
--- a/ext/json/generator/generator.c
+++ b/ext/json/generator/generator.c
@@ -273,7 +273,18 @@ static void convert_UTF8_to_JSON(FBuffer *buffer, VALUE string)
escape_len = 2;
break;
default:
- end++;
+ {
+ unsigned short clen = trailingBytesForUTF8[c] + 1;
+ if (end + clen > len) {
+ rb_raise(rb_path2class("JSON::GeneratorError"),
+ "partial character in source, but hit end");
+ }
+ if (!isLegalUTF8((UTF8 *) p, clen)) {
+ rb_raise(rb_path2class("JSON::GeneratorError"),
+ "source sequence is illegal/malformed utf-8");
+ }
+ end += clen;
+ }
continue;
break;
}
@@ -511,11 +522,8 @@ static VALUE cState_configure(VALUE self, VALUE opts)
{
VALUE tmp;
GET_STATE(self);
- tmp = rb_convert_type(opts, T_HASH, "Hash", "to_hash");
+ tmp = rb_check_convert_type(opts, T_HASH, "Hash", "to_hash");
if (NIL_P(tmp)) tmp = rb_convert_type(opts, T_HASH, "Hash", "to_h");
- if (NIL_P(tmp)) {
- rb_raise(rb_eArgError, "opts has to be hash like or convertable into a hash");
- }
opts = tmp;
tmp = rb_hash_aref(opts, ID2SYM(i_indent));
if (RTEST(tmp)) {
@@ -804,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: %s not allowed in JSON", __LINE__, StringValueCStr(tmp));
+ rb_raise(eGeneratorError, "%u: %"PRIsVALUE" not allowed in JSON", __LINE__, RB_OBJ_STRING(tmp));
} else if (isnan(value)) {
fbuffer_free(buffer);
- rb_raise(eGeneratorError, "%u: %s not allowed in JSON", __LINE__, StringValueCStr(tmp));
+ rb_raise(eGeneratorError, "%u: %"PRIsVALUE" not allowed in JSON", __LINE__, RB_OBJ_STRING(tmp));
}
}
fbuffer_append_str(buffer, tmp);
@@ -894,8 +902,8 @@ static int isArrayOrObject(VALUE string)
long string_len = RSTRING_LEN(string);
char *p = RSTRING_PTR(string), *q = p + string_len - 1;
if (string_len < 2) return 0;
- for (; p < q && isspace(*p); p++);
- for (; q > p && isspace(*q); q--);
+ for (; p < q && isspace((unsigned char)*p); p++);
+ for (; q > p && isspace((unsigned char)*q); q--);
return (*p == '[' && *q == ']') || (*p == '{' && *q == '}');
}
@@ -957,6 +965,7 @@ static VALUE cState_init_copy(VALUE obj, VALUE orig)
{
JSON_Generator_State *objState, *origState;
+ if (obj == orig) return obj;
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");
diff --git a/ext/json/lib/json/common.rb b/ext/json/lib/json/common.rb
index a547679962..8fbaa2baad 100644
--- a/ext/json/lib/json/common.rb
+++ b/ext/json/lib/json/common.rb
@@ -179,10 +179,9 @@ module JSON
end
# Generate a JSON document from the Ruby data structure _obj_ and return
- # it. _state_ is
- # * a JSON::State object,
+ # it. _state_ is * a JSON::State object,
# * or a Hash like object (responding to to_hash),
- # * or an object convertible into a hash by a to_h method,
+ # * an object convertible into a hash by a to_h method,
# that is used as or to configure a State object.
#
# It defaults to a state object, that creates the shortest possible JSON text
@@ -413,10 +412,7 @@ module JSON
end
# Shortuct for iconv.
- if ::String.method_defined?(:encode) &&
- # XXX Rubinius doesn't support ruby 1.9 encoding yet
- defined?(RUBY_ENGINE) && RUBY_ENGINE != 'rbx'
- then
+ if ::String.method_defined?(:encode)
# Encodes string using Ruby's _String.encode_
def self.iconv(to, from, string)
string.encode(to, from)
@@ -452,7 +448,7 @@ module ::Kernel
nil
end
- # Ouputs _objs_ to STDOUT as JSON strings in a pretty format, with
+ # Outputs _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/generic_object.rb b/ext/json/lib/json/generic_object.rb
index 8b1074c941..8b8fd53bef 100644
--- a/ext/json/lib/json/generic_object.rb
+++ b/ext/json/lib/json/generic_object.rb
@@ -31,6 +31,15 @@ module JSON
object
end
end
+
+ def load(source, proc = nil, opts = {})
+ result = ::JSON.load(source, proc, opts.merge(:object_class => self))
+ result.nil? ? new : result
+ end
+
+ def dump(obj, *args)
+ ::JSON.dump(obj, *args)
+ end
end
self.json_creatable = false
diff --git a/ext/json/lib/json/version.rb b/ext/json/lib/json/version.rb
index 1de3d696f2..47cdcd607c 100644
--- a/ext/json/lib/json/version.rb
+++ b/ext/json/lib/json/version.rb
@@ -1,6 +1,6 @@
module JSON
# JSON version
- VERSION = '1.7.7'
+ 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 498ffa964c..d188844670 100644
--- a/ext/json/parser/depend
+++ b/ext/json/parser/depend
@@ -1 +1,2 @@
+$(OBJS): $(ruby_headers)
parser.o: parser.c parser.h $(srcdir)/../fbuffer/fbuffer.h
diff --git a/ext/json/parser/parser.c b/ext/json/parser/parser.c
index df89f2c58b..29335541d4 100644
--- a/ext/json/parser/parser.c
+++ b/ext/json/parser/parser.c
@@ -89,11 +89,11 @@ static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions,
#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_start = 1};
+enum {JSON_object_first_final = 27};
+enum {JSON_object_error = 0};
-static const int JSON_object_en_main = 1;
+enum {JSON_object_en_main = 1};
#line 151 "parser.rl"
@@ -467,11 +467,11 @@ case 26:
#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_start = 1};
+enum {JSON_value_first_final = 21};
+enum {JSON_value_error = 0};
-static const int JSON_value_en_main = 1;
+enum {JSON_value_en_main = 1};
#line 271 "parser.rl"
@@ -776,11 +776,11 @@ case 20:
#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_start = 1};
+enum {JSON_integer_first_final = 3};
+enum {JSON_integer_error = 0};
-static const int JSON_integer_en_main = 1;
+enum {JSON_integer_en_main = 1};
#line 295 "parser.rl"
@@ -875,11 +875,11 @@ case 5:
#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_start = 1};
+enum {JSON_float_first_final = 8};
+enum {JSON_float_error = 0};
-static const int JSON_float_en_main = 1;
+enum {JSON_float_en_main = 1};
#line 329 "parser.rl"
@@ -1041,11 +1041,11 @@ case 7:
#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_start = 1};
+enum {JSON_array_first_final = 17};
+enum {JSON_array_error = 0};
-static const int JSON_array_en_main = 1;
+enum {JSON_array_en_main = 1};
#line 381 "parser.rl"
@@ -1373,11 +1373,11 @@ static VALUE json_string_unescape(VALUE result, char *string, char *stringEnd)
#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_start = 1};
+enum {JSON_string_first_final = 8};
+enum {JSON_string_error = 0};
-static const int JSON_string_en_main = 1;
+enum {JSON_string_en_main = 1};
#line 494 "parser.rl"
@@ -1730,11 +1730,11 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
#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_start = 1};
+enum {JSON_first_final = 10};
+enum {JSON_error = 0};
-static const int JSON_en_main = 1;
+enum {JSON_en_main = 1};
#line 740 "parser.rl"
@@ -1904,11 +1904,11 @@ case 9:
#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_start = 1};
+enum {JSON_quirks_mode_first_final = 10};
+enum {JSON_quirks_mode_error = 0};
-static const int JSON_quirks_mode_en_main = 1;
+enum {JSON_quirks_mode_en_main = 1};
#line 778 "parser.rl"
diff --git a/ext/json/parser/prereq.mk b/ext/json/parser/prereq.mk
index 440ef4017e..be7bcb4319 100644
--- a/ext/json/parser/prereq.mk
+++ b/ext/json/parser/prereq.mk
@@ -4,6 +4,7 @@ RAGEL = ragel
.rl.c:
$(RAGEL) -G2 $<
- $(BASERUBY) -pli -e '$$_.sub!(/[ \t]+$$/, "")' $@
+ $(BASERUBY) -pli -e '$$_.sub!(/[ \t]+$$/, "")' \
+ -e '$$_.sub!(/^static const int (JSON_.*=.*);$$/, "enum {\\1};")' $@
parser.c:
diff --git a/ext/nkf/depend b/ext/nkf/depend
index f028020a20..f368cd51d7 100644
--- a/ext/nkf/depend
+++ b/ext/nkf/depend
@@ -1,4 +1,6 @@
-nkf.o : nkf.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h \
+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/nkf-utf8/nkf.c b/ext/nkf/nkf-utf8/nkf.c
index 8e9d206471..65d2c190ec 100644
--- a/ext/nkf/nkf-utf8/nkf.c
+++ b/ext/nkf/nkf-utf8/nkf.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 1987, Fujitsu LTD. (Itaru ICHIKAWA).
- * Copyright (c) 1996-2010, The nkf Project.
+ * Copyright (c) 1996-2013, The nkf Project.
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
@@ -21,10 +21,10 @@
* 3. This notice may not be removed or altered from any source distribution.
*/
#define NKF_VERSION "2.1.3"
-#define NKF_RELEASE_DATE "2012-11-22"
+#define NKF_RELEASE_DATE "2013-11-22"
#define COPY_RIGHT \
"Copyright (C) 1987, FUJITSU LTD. (I.Ichikawa).\n" \
- "Copyright (C) 1996-2012, The nkf Project."
+ "Copyright (C) 1996-2013, The nkf Project."
#include "config.h"
#include "nkf.h"
@@ -4340,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, becase it contains ?= as
+ /* we don't keep eof of mime_input_buf, because 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++));
@@ -5713,9 +5713,9 @@ module_connection(void)
x0201_f = X0201_DEFAULT;
}
- /* replace continucation module, from output side */
+ /* replace continuation module, from output side */
- /* output redicrection */
+ /* output redirection */
#ifdef CHECK_OPTION
if (noout_f || guess_f){
o_putc = no_putc;
@@ -5752,7 +5752,7 @@ module_connection(void)
i_getc = std_getc;
i_ungetc = std_ungetc;
- /* input redicrection */
+ /* input redirection */
#ifdef INPUT_OPTION
if (cap_f){
i_cgetc = i_getc; i_getc = cap_getc;
@@ -5914,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 ambiguious */
+ /* It is still ambiguous */
if (h_conv(f, c2, c1)==EOF) {
LAST;
}
@@ -6150,9 +6150,10 @@ kanji_convert(FILE *f)
}
}
else {
+ i_ungetc(c1,f);
/* lonely ESC */
(*oconv)(0, ESC);
- SEND;
+ SKIP;
}
} else if (c1 == ESC && iconv == s_iconv) {
/* ESC in Shift_JIS */
@@ -6189,9 +6190,10 @@ kanji_convert(FILE *f)
}
}
else {
+ i_ungetc(c1,f);
/* lonely ESC */
(*oconv)(0, ESC);
- SEND;
+ SKIP;
}
} else if (c1 == LF || c1 == CR) {
if (broken_f&4) {
@@ -6896,7 +6898,7 @@ options(unsigned char *cp)
continue;
#endif
case SP:
- /* module muliple options in a string are allowed for Perl moudle */
+ /* module multiple options in a string are allowed for Perl module */
while(*cp && *cp++!='-');
continue;
default:
diff --git a/ext/nkf/nkf-utf8/nkf.h b/ext/nkf/nkf-utf8/nkf.h
index c174c9ac51..cd3037601b 100644
--- a/ext/nkf/nkf-utf8/nkf.h
+++ b/ext/nkf/nkf-utf8/nkf.h
@@ -1,8 +1,7 @@
/*
*
* nkf.h - Header file for nkf
- *
- * $Id$
+ *
*/
#ifndef NKF_H
@@ -153,6 +152,7 @@ void setbinmode(FILE *fp)
# ifndef HAVE_LOCALE_H
# define HAVE_LOCALE_H
# endif
+#elif defined(__BIONIC__) /* bionic doesn't have locale */
#else
# ifndef HAVE_LANGINFO_H
# define HAVE_LANGINFO_H
diff --git a/ext/nkf/nkf-utf8/utf8tbl.c b/ext/nkf/nkf-utf8/utf8tbl.c
index bbf5c5f109..e493c6beb5 100644
--- a/ext/nkf/nkf-utf8/utf8tbl.c
+++ b/ext/nkf/nkf-utf8/utf8tbl.c
@@ -1,7 +1,6 @@
/*
* utf8tbl.c - Convertion Table for nkf
*
- * $Id$
*/
#include "config.h"
diff --git a/ext/nkf/nkf-utf8/utf8tbl.h b/ext/nkf/nkf-utf8/utf8tbl.h
index 082fb01a5b..96b61ed5a4 100644
--- a/ext/nkf/nkf-utf8/utf8tbl.h
+++ b/ext/nkf/nkf-utf8/utf8tbl.h
@@ -1,7 +1,6 @@
/*
* utf8tbl.h - Header file for Convertion Table
*
- * $Id: utf8tbl.h,v 1.3 2008/01/23 09:10:25 naruse Exp $
*/
#ifndef _UTF8TBL_H_
diff --git a/ext/objspace/depend b/ext/objspace/depend
index 83a08f7078..270bd911d3 100644
--- a/ext/objspace/depend
+++ b/ext/objspace/depend
@@ -1,3 +1,14 @@
-objspace.o: $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/io.h \
+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/object_tracing.c b/ext/objspace/object_tracing.c
new file mode 100644
index 0000000000..975518c654
--- /dev/null
+++ b/ext/objspace/object_tracing.c
@@ -0,0 +1,493 @@
+/**********************************************************************
+
+ object_tracing.c - Object Tracing mechanism/ObjectSpace extender for MRI.
+
+ $Author$
+ created at: Mon May 27 16:27:44 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"
+#include "objspace.h"
+#include "internal.h"
+
+struct traceobj_arg {
+ int running;
+ int keep_remains;
+ VALUE newobj_trace;
+ VALUE freeobj_trace;
+ st_table *object_table; /* obj (VALUE) -> allocation_info */
+ st_table *str_table; /* cstr -> refcount */
+ struct traceobj_arg *prev_traceobj_arg;
+};
+
+static const char *
+make_unique_str(st_table *tbl, const char *str, long len)
+{
+ if (!str) {
+ return NULL;
+ }
+ else {
+ st_data_t n;
+ char *result;
+
+ if (st_lookup(tbl, (st_data_t)str, &n)) {
+ st_insert(tbl, (st_data_t)str, n+1);
+ st_get_key(tbl, (st_data_t)str, (st_data_t *)&result);
+ }
+ else {
+ result = (char *)ruby_xmalloc(len+1);
+ strncpy(result, str, len);
+ result[len] = 0;
+ st_add_direct(tbl, (st_data_t)result, 1);
+ }
+ return result;
+ }
+}
+
+static void
+delete_unique_str(st_table *tbl, const char *str)
+{
+ if (str) {
+ st_data_t n;
+
+ st_lookup(tbl, (st_data_t)str, &n);
+ if (n == 1) {
+ st_delete(tbl, (st_data_t *)&str, 0);
+ ruby_xfree((char *)str);
+ }
+ else {
+ st_insert(tbl, (st_data_t)str, n-1);
+ }
+ }
+}
+
+static void
+newobj_i(VALUE tpval, void *data)
+{
+ struct traceobj_arg *arg = (struct traceobj_arg *)data;
+ rb_trace_arg_t *tparg = rb_tracearg_from_tracepoint(tpval);
+ VALUE obj = rb_tracearg_object(tparg);
+ VALUE path = rb_tracearg_path(tparg);
+ VALUE line = rb_tracearg_lineno(tparg);
+ VALUE mid = rb_tracearg_method_id(tparg);
+ 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;
+ 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)) {
+ if (arg->keep_remains) {
+ if (info->living) {
+ /* do nothing. there is possibility to keep living if FREEOBJ events while suppressing tracing */
+ }
+ }
+ /* reuse info */
+ delete_unique_str(arg->str_table, info->path);
+ delete_unique_str(arg->str_table, info->class_path);
+ }
+ else {
+ info = (struct allocation_info *)ruby_xmalloc(sizeof(struct allocation_info));
+ }
+ info->living = 1;
+ info->flags = RBASIC(obj)->flags;
+ info->klass = RBASIC_CLASS(obj);
+
+ info->path = path_cstr;
+ info->line = NUM2INT(line);
+ info->mid = mid;
+ info->class_path = class_path_cstr;
+ info->generation = rb_gc_count();
+ st_insert(arg->object_table, (st_data_t)obj, (st_data_t)info);
+}
+
+static void
+freeobj_i(VALUE tpval, void *data)
+{
+ struct traceobj_arg *arg = (struct traceobj_arg *)data;
+ rb_trace_arg_t *tparg = rb_tracearg_from_tracepoint(tpval);
+ VALUE obj = rb_tracearg_object(tparg);
+ struct allocation_info *info;
+
+ if (st_lookup(arg->object_table, (st_data_t)obj, (st_data_t *)&info)) {
+ if (arg->keep_remains) {
+ info->living = 0;
+ }
+ else {
+ st_delete(arg->object_table, (st_data_t *)&obj, (st_data_t *)&info);
+ delete_unique_str(arg->str_table, info->path);
+ delete_unique_str(arg->str_table, info->class_path);
+ ruby_xfree(info);
+ }
+ }
+}
+
+static int
+free_keys_i(st_data_t key, st_data_t value, void *data)
+{
+ ruby_xfree((void *)key);
+ return ST_CONTINUE;
+}
+
+static int
+free_values_i(st_data_t key, st_data_t value, void *data)
+{
+ ruby_xfree((void *)value);
+ return ST_CONTINUE;
+}
+
+static struct traceobj_arg *tmp_trace_arg; /* TODO: Do not use global variables */
+static int tmp_keep_remains; /* TODO: Do not use global variables */
+
+static struct traceobj_arg *
+get_traceobj_arg(void)
+{
+ if (tmp_trace_arg == 0) {
+ tmp_trace_arg = ALLOC_N(struct traceobj_arg, 1);
+ tmp_trace_arg->running = 0;
+ tmp_trace_arg->keep_remains = tmp_keep_remains;
+ tmp_trace_arg->newobj_trace = 0;
+ tmp_trace_arg->freeobj_trace = 0;
+ tmp_trace_arg->object_table = st_init_numtable();
+ tmp_trace_arg->str_table = st_init_strtable();
+ }
+ return tmp_trace_arg;
+}
+
+/*
+ * call-seq: trace_object_allocations_start
+ *
+ * Starts tracing object allocations.
+ *
+ */
+static VALUE
+trace_object_allocations_start(VALUE self)
+{
+ struct traceobj_arg *arg = get_traceobj_arg();
+
+ if (arg->running++ > 0) {
+ /* do nothing */
+ }
+ else {
+ if (arg->newobj_trace == 0) {
+ arg->newobj_trace = rb_tracepoint_new(0, RUBY_INTERNAL_EVENT_NEWOBJ, newobj_i, arg);
+ arg->freeobj_trace = rb_tracepoint_new(0, RUBY_INTERNAL_EVENT_FREEOBJ, freeobj_i, arg);
+ }
+ rb_tracepoint_enable(arg->newobj_trace);
+ rb_tracepoint_enable(arg->freeobj_trace);
+ }
+
+ return Qnil;
+}
+
+/*
+ * call-seq: trace_object_allocations_stop
+ *
+ * Stop tracing object allocations.
+ *
+ * Note that if ::trace_object_allocations_start is called n-times, then
+ * tracing will stop after calling ::trace_object_allocations_stop n-times.
+ *
+ */
+static VALUE
+trace_object_allocations_stop(VALUE self)
+{
+ struct traceobj_arg *arg = get_traceobj_arg();
+
+ if (arg->running > 0) {
+ arg->running--;
+ }
+
+ if (arg->running == 0) {
+ rb_tracepoint_disable(arg->newobj_trace);
+ rb_tracepoint_disable(arg->freeobj_trace);
+ arg->newobj_trace = 0;
+ arg->freeobj_trace = 0;
+ }
+
+ return Qnil;
+}
+
+/*
+ * call-seq: trace_object_allocations_clear
+ *
+ * Clear recorded tracing information.
+ *
+ */
+static VALUE
+trace_object_allocations_clear(VALUE self)
+{
+ struct traceobj_arg *arg = get_traceobj_arg();
+
+ /* clear tables */
+ st_foreach(arg->object_table, free_values_i, 0);
+ st_clear(arg->object_table);
+ st_foreach(arg->str_table, free_keys_i, 0);
+ st_clear(arg->str_table);
+
+ /* do not touch TracePoints */
+
+ return Qnil;
+}
+
+/*
+ * call-seq: trace_object_allocations { block }
+ *
+ * Starts tracing object allocations from the ObjectSpace extension module.
+ *
+ * For example:
+ *
+ * require 'objspace'
+ *
+ * class C
+ * include ObjectSpace
+ *
+ * def foo
+ * trace_object_allocations do
+ * obj = Object.new
+ * p "#{allocation_sourcefile(obj)}:#{allocation_sourceline(obj)}"
+ * end
+ * end
+ * end
+ *
+ * C.new.foo #=> "objtrace.rb:8"
+ *
+ * This example has included the ObjectSpace module to make it easier to read,
+ * but you can also use the ::trace_object_allocations notation (recommended).
+ *
+ * Note that this feature introduces a huge performance decrease and huge
+ * memory consumption.
+ */
+static VALUE
+trace_object_allocations(VALUE self)
+{
+ trace_object_allocations_start(self);
+ return rb_ensure(rb_yield, Qnil, trace_object_allocations_stop, self);
+}
+
+int rb_bug_reporter_add(void (*func)(FILE *, void *), void *data);
+static int object_allocations_reporter_registered = 0;
+
+static int
+object_allocations_reporter_i(st_data_t key, st_data_t val, st_data_t ptr)
+{
+ FILE *out = (FILE *)ptr;
+ VALUE obj = (VALUE)key;
+ struct allocation_info *info = (struct allocation_info *)val;
+
+ fprintf(out, "-- %p (%s F: %p, ", (void *)obj, info->living ? "live" : "dead", (void *)info->flags);
+ 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));
+ }
+ fprintf(out, ")\n");
+
+ return ST_CONTINUE;
+}
+
+static void
+object_allocations_reporter(FILE *out, void *ptr)
+{
+ fprintf(out, "== object_allocations_reporter: START\n");
+ if (tmp_trace_arg) {
+ st_foreach(tmp_trace_arg->object_table, object_allocations_reporter_i, (st_data_t)out);
+ }
+ fprintf(out, "== object_allocations_reporter: END\n");
+}
+
+static VALUE
+trace_object_allocations_debug_start(VALUE self)
+{
+ tmp_keep_remains = 1;
+ if (object_allocations_reporter_registered == 0) {
+ object_allocations_reporter_registered = 1;
+ rb_bug_reporter_add(object_allocations_reporter, 0);
+ }
+
+ return trace_object_allocations_start(self);
+}
+
+static struct allocation_info *
+lookup_allocation_info(VALUE obj)
+{
+ if (tmp_trace_arg) {
+ struct allocation_info *info;
+ if (st_lookup(tmp_trace_arg->object_table, obj, (st_data_t *)&info)) {
+ return info;
+ }
+ }
+ return NULL;
+}
+
+struct allocation_info *
+objspace_lookup_allocation_info(VALUE obj)
+{
+ return lookup_allocation_info(obj);
+}
+
+/*
+ * call-seq: allocation_sourcefile(object) -> string
+ *
+ * Returns the source file origin from the given +object+.
+ *
+ * See ::trace_object_allocations for more information and examples.
+ */
+static VALUE
+allocation_sourcefile(VALUE self, VALUE obj)
+{
+ struct allocation_info *info = lookup_allocation_info(obj);
+
+ if (info && info->path) {
+ return rb_str_new2(info->path);
+ }
+ else {
+ return Qnil;
+ }
+}
+
+/*
+ * call-seq: allocation_sourceline(object) -> string
+ *
+ * Returns the original line from source for from the given +object+.
+ *
+ * See ::trace_object_allocations for more information and examples.
+ */
+static VALUE
+allocation_sourceline(VALUE self, VALUE obj)
+{
+ struct allocation_info *info = lookup_allocation_info(obj);
+
+ if (info) {
+ return INT2FIX(info->line);
+ }
+ else {
+ return Qnil;
+ }
+}
+
+/*
+ * call-seq: allocation_class_path(object) -> string
+ *
+ * Returns the class for the given +object+.
+ *
+ * class A
+ * def foo
+ * ObjectSpace::trace_object_allocations do
+ * obj = Object.new
+ * p "#{ObjectSpace::allocation_class_path(obj)}"
+ * end
+ * end
+ * end
+ *
+ * A.new.foo #=> "Class"
+ *
+ * See ::trace_object_allocations for more information and examples.
+ */
+static VALUE
+allocation_class_path(VALUE self, VALUE obj)
+{
+ struct allocation_info *info = lookup_allocation_info(obj);
+
+ if (info && info->class_path) {
+ return rb_str_new2(info->class_path);
+ }
+ else {
+ return Qnil;
+ }
+}
+
+/*
+ * call-seq: allocation_method_id(object) -> string
+ *
+ * Returns the method identifier for the given +object+.
+ *
+ * class A
+ * include ObjectSpace
+ *
+ * def foo
+ * trace_object_allocations do
+ * obj = Object.new
+ * p "#{allocation_class_path(obj)}##{allocation_method_id(obj)}"
+ * end
+ * end
+ * end
+ *
+ * A.new.foo #=> "Class#new"
+ *
+ * See ::trace_object_allocations for more information and examples.
+ */
+static VALUE
+allocation_method_id(VALUE self, VALUE obj)
+{
+ struct allocation_info *info = lookup_allocation_info(obj);
+ if (info) {
+ return info->mid;
+ }
+ else {
+ return Qnil;
+ }
+}
+
+/*
+ * call-seq: allocation_generation(object) -> Fixnum
+ *
+ * Returns garbage collector generation for the given +object+.
+ *
+ * class B
+ * include ObjectSpace
+ *
+ * def foo
+ * trace_object_allocations do
+ * obj = Object.new
+ * p "Generation is #{allocation_generation(obj)}"
+ * end
+ * end
+ * end
+ *
+ * B.new.foo #=> "Generation is 3"
+ *
+ * See ::trace_object_allocations for more information and examples.
+ */
+static VALUE
+allocation_generation(VALUE self, VALUE obj)
+{
+ struct allocation_info *info = lookup_allocation_info(obj);
+ if (info) {
+ return SIZET2NUM(info->generation);
+ }
+ else {
+ return Qnil;
+ }
+}
+
+void
+Init_object_tracing(VALUE rb_mObjSpace)
+{
+#if 0
+ rb_mObjSpace = rb_define_module("ObjectSpace"); /* let rdoc know */
+#endif
+
+ rb_define_module_function(rb_mObjSpace, "trace_object_allocations", trace_object_allocations, 0);
+ rb_define_module_function(rb_mObjSpace, "trace_object_allocations_start", trace_object_allocations_start, 0);
+ rb_define_module_function(rb_mObjSpace, "trace_object_allocations_stop", trace_object_allocations_stop, 0);
+ rb_define_module_function(rb_mObjSpace, "trace_object_allocations_clear", trace_object_allocations_clear, 0);
+
+ rb_define_module_function(rb_mObjSpace, "trace_object_allocations_debug_start", trace_object_allocations_debug_start, 0);
+
+ rb_define_module_function(rb_mObjSpace, "allocation_sourcefile", allocation_sourcefile, 1);
+ rb_define_module_function(rb_mObjSpace, "allocation_sourceline", allocation_sourceline, 1);
+ rb_define_module_function(rb_mObjSpace, "allocation_class_path", allocation_class_path, 1);
+ rb_define_module_function(rb_mObjSpace, "allocation_method_id", allocation_method_id, 1);
+ rb_define_module_function(rb_mObjSpace, "allocation_generation", allocation_generation, 1);
+}
diff --git a/ext/objspace/objspace.c b/ext/objspace/objspace.c
index 720c918555..88ebfca20e 100644
--- a/ext/objspace/objspace.c
+++ b/ext/objspace/objspace.c
@@ -5,173 +5,38 @@
$Author$
created at: Wed Jun 17 07:39:17 2009
- NOTE: This extension library is not expected to exist except C Ruby.
+ NOTE: This extension library is only expected to exist with C Ruby.
All the files in this distribution are covered under the Ruby's
license (see the file COPYING).
**********************************************************************/
-/* objspace library extends ObjectSpace module and add several
- * methods to get internal statistic information about
- * object/memory management.
- *
- * Generally, you *SHOULD NOT*use this library if you do not know
- * about the MRI implementation. Mainly, this library is for (memory)
- * profiler developers and MRI developers who need to know how MRI
- * memory usage.
- *
- */
-
#include <ruby/ruby.h>
#include <ruby/st.h>
#include <ruby/io.h>
#include <ruby/re.h>
#include "node.h"
#include "gc.h"
-#include "regint.h"
#include "internal.h"
-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);
-size_t rb_objspace_data_type_memsize(VALUE obj);
-
-static size_t
-memsize_of(VALUE obj)
-{
- size_t size = 0;
-
- if (SPECIAL_CONST_P(obj)) {
- return 0;
- }
-
- if (FL_TEST(obj, FL_EXIVAR)) {
- size += rb_generic_ivar_memsize(obj);
- }
-
- switch (BUILTIN_TYPE(obj)) {
- case T_OBJECT:
- if (!(RBASIC(obj)->flags & ROBJECT_EMBED) &&
- ROBJECT(obj)->as.heap.ivptr) {
- size += ROBJECT(obj)->as.heap.numiv * sizeof(VALUE);
- }
- break;
- case T_MODULE:
- case T_CLASS:
- if (RCLASS_M_TBL(obj)) {
- size += st_memsize(RCLASS_M_TBL(obj));
- }
- if (RCLASS_IV_TBL(obj)) {
- size += st_memsize(RCLASS_IV_TBL(obj));
- }
- if (RCLASS_IV_INDEX_TBL(obj)) {
- size += st_memsize(RCLASS_IV_INDEX_TBL(obj));
- }
- if (RCLASS(obj)->ptr->iv_tbl) {
- size += st_memsize(RCLASS(obj)->ptr->iv_tbl);
- }
- if (RCLASS(obj)->ptr->const_tbl) {
- size += st_memsize(RCLASS(obj)->ptr->const_tbl);
- }
- size += sizeof(rb_classext_t);
- break;
- case T_STRING:
- size += rb_str_memsize(obj);
- break;
- case T_ARRAY:
- size += rb_ary_memsize(obj);
- break;
- case T_HASH:
- if (RHASH(obj)->ntbl) {
- size += st_memsize(RHASH(obj)->ntbl);
- }
- break;
- case T_REGEXP:
- if (RREGEXP(obj)->ptr) {
- size += onig_memsize(RREGEXP(obj)->ptr);
- }
- break;
- case T_DATA:
- size += rb_objspace_data_type_memsize(obj);
- break;
- case T_MATCH:
- if (RMATCH(obj)->rmatch) {
- struct rmatch *rm = RMATCH(obj)->rmatch;
- size += onig_region_memsize(&rm->regs);
- size += sizeof(struct rmatch_offset) * rm->char_offset_num_allocated;
- size += sizeof(struct rmatch);
- }
- break;
- case T_FILE:
- if (RFILE(obj)->fptr) {
- size += rb_io_memsize(RFILE(obj)->fptr);
- }
- break;
- case T_RATIONAL:
- case T_COMPLEX:
- break;
- case T_ICLASS:
- /* iClass shares table with the module */
- break;
-
- case T_FLOAT:
- break;
-
- case T_BIGNUM:
- if (!(RBASIC(obj)->flags & RBIGNUM_EMBED_FLAG) && RBIGNUM_DIGITS(obj)) {
- size += RBIGNUM_LEN(obj) * sizeof(BDIGIT);
- }
- break;
- case T_NODE:
- 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 &&
- RSTRUCT(obj)->as.heap.ptr) {
- size += sizeof(VALUE) * RSTRUCT_LEN(obj);
- }
- break;
-
- case T_ZOMBIE:
- break;
-
- default:
- rb_bug("objspace/memsize_of(): unknown data type 0x%x(%p)",
- BUILTIN_TYPE(obj), (void*)obj);
- }
-
- return size;
-}
-
/*
* call-seq:
* ObjectSpace.memsize_of(obj) -> Integer
*
* Return consuming memory size of obj.
*
- * Note that the return size is incomplete. You need to deal with
- * this information as only a *HINT*. Especially, the size of
- * T_DATA may not be correct.
+ * Note that the return size is incomplete. You need to deal with this
+ * information as only a *HINT*. Especially, the size of +T_DATA+ may not be
+ * correct.
*
- * This method is not expected to work except C Ruby.
+ * This method is only expected to work with C Ruby.
*/
static VALUE
memsize_of_m(VALUE self, VALUE obj)
{
- return SIZET2NUM(memsize_of(obj));
+ return SIZET2NUM(rb_obj_memsize_of(obj));
}
struct total_data {
@@ -198,7 +63,7 @@ total_i(void *vstart, void *vend, size_t stride, void *ptr)
continue;
default:
if (data->klass == 0 || rb_obj_is_kind_of(v, data->klass)) {
- data->total += memsize_of(v);
+ data->total += rb_obj_memsize_of(v);
}
}
}
@@ -212,26 +77,27 @@ total_i(void *vstart, void *vend, size_t stride, void *ptr)
* ObjectSpace.memsize_of_all([klass]) -> Integer
*
* Return consuming memory size of all living objects.
- * If klass (should be Class object) is given, return the total
- * memory size of instances of the given class.
*
- * Note that the returned size is incomplete. You need to deal with
- * this information as only a *HINT*. Especially, the size of
- * T_DATA may not be correct.
+ * If +klass+ (should be Class object) is given, return the total memory size
+ * of instances of the given class.
+ *
+ * Note that the returned size is incomplete. You need to deal with this
+ * information as only a *HINT*. Especially, the size of +T_DATA+ may not be
+ * correct.
*
* Note that this method does *NOT* return total malloc'ed memory size.
*
* This method can be defined by the following Ruby code:
*
- * def memsize_of_all klass = false
- * total = 0
- * ObjectSpace.each_object{|e|
- * total += ObjectSpace.memsize_of(e) if klass == false || e.kind_of?(klass)
- * }
- * total
- * end
+ * def memsize_of_all klass = false
+ * total = 0
+ * ObjectSpace.each_object{|e|
+ * total += ObjectSpace.memsize_of(e) if klass == false || e.kind_of?(klass)
+ * }
+ * total
+ * end
*
- * This method is not expected to work except C Ruby.
+ * This method is only expected to work with C Ruby.
*/
static VALUE
@@ -264,7 +130,7 @@ cos_i(void *vstart, void *vend, size_t stride, void *data)
for (;v != (VALUE)vend; v += stride) {
if (RBASIC(v)->flags) {
- counts[BUILTIN_TYPE(v)] += memsize_of(v);
+ counts[BUILTIN_TYPE(v)] += rb_obj_memsize_of(v);
}
}
return 0;
@@ -327,7 +193,7 @@ type2sym(enum ruby_value_type i)
* The contents of the returned hash is implementation defined.
* It may be changed in future.
*
- * This method is not expected to work except C Ruby.
+ * This method is only expected to work with C Ruby.
*/
static VALUE
@@ -389,20 +255,21 @@ cn_i(void *vstart, void *vend, size_t stride, void *n)
*
* Counts nodes for each node type.
*
- * This method is not for ordinary Ruby programmers, but for MRI developers
- * who have interest in MRI performance and memory usage.
+ * This method is only for MRI developers interested in performance and memory
+ * usage of Ruby programs.
*
* It returns a hash as:
- * {:NODE_METHOD=>2027, :NODE_FBODY=>1927, :NODE_CFUNC=>1798, ...}
*
- * If the optional argument, result_hash, is given,
- * it is overwritten and returned.
- * This is intended to avoid probe effect.
+ * {:NODE_METHOD=>2027, :NODE_FBODY=>1927, :NODE_CFUNC=>1798, ...}
+ *
+ * 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 not expected to work except C Ruby.
+ * This method is only expected to work with C Ruby.
*/
static VALUE
@@ -586,32 +453,32 @@ cto_i(void *vstart, void *vend, size_t stride, void *data)
* call-seq:
* ObjectSpace.count_tdata_objects([result_hash]) -> hash
*
- * Counts objects for each T_DATA type.
+ * Counts objects for each +T_DATA+ type.
*
- * This method is not for ordinary Ruby programmers, but for MRI developers
- * who interest on MRI performance.
+ * This method is only for MRI developers interested in performance and memory
+ * usage of Ruby programs.
*
* It returns a hash as:
- * {RubyVM::InstructionSequence=>504, :parser=>5, :barrier=>6,
- * :mutex=>6, Proc=>60, RubyVM::Env=>57, Mutex=>1, Encoding=>99,
- * ThreadGroup=>1, Binding=>1, Thread=>1, RubyVM=>1, :iseq=>1,
- * Random=>1, ARGF.class=>1, Data=>1, :autoload=>3, Time=>2}
- * # T_DATA objects existing at startup on r32276.
*
- * If the optional argument, result_hash, is given,
- * it is overwritten and returned.
- * This is intended to avoid probe effect.
+ * {RubyVM::InstructionSequence=>504, :parser=>5, :barrier=>6,
+ * :mutex=>6, Proc=>60, RubyVM::Env=>57, Mutex=>1, Encoding=>99,
+ * ThreadGroup=>1, Binding=>1, Thread=>1, RubyVM=>1, :iseq=>1,
+ * Random=>1, ARGF.class=>1, Data=>1, :autoload=>3, Time=>2}
+ * # T_DATA objects existing at startup on r32276.
*
- * The contents of the returned hash is implementation defined.
- * It may be changed in future.
+ * 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 Class object or Symbol object.
+ *
* If object is kind of normal (accessible) object, the key is Class object.
* If object is not a kind of normal (internal) object, the key is symbol
* name, registered by rb_data_type_struct.
*
- * This method is not expected to work except C Ruby.
- *
+ * This method is only expected to work with C Ruby.
*/
static VALUE
@@ -646,12 +513,13 @@ static size_t
iow_size(const void *ptr)
{
VALUE obj = (VALUE)ptr;
- return memsize_of(obj);
+ return rb_obj_memsize_of(obj);
}
static const rb_data_type_t iow_data_type = {
"ObjectSpace::InternalObjectWrapper",
{iow_mark, 0, iow_size,},
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
static VALUE rb_mInternalObjectWrapper;
@@ -662,6 +530,7 @@ iow_newobj(VALUE obj)
return rb_data_typed_object_alloc(rb_mInternalObjectWrapper, (void *)obj, &iow_data_type);
}
+/* Returns the type of the internal object. */
static VALUE
iow_type(VALUE self)
{
@@ -669,15 +538,17 @@ iow_type(VALUE self)
return type2sym(BUILTIN_TYPE(obj));
}
+/* See Object#inspect. */
static VALUE
iow_inspect(VALUE self)
{
VALUE obj = (VALUE)DATA_PTR(self);
VALUE type = type2sym(BUILTIN_TYPE(obj));
- return rb_sprintf("#<InternalObject:%p %s>", (void *)obj, rb_id2name(SYM2ID(type)));
+ return rb_sprintf("#<InternalObject:%p %"PRIsVALUE">", (void *)obj, rb_sym2str(type));
}
+/* Returns the Object#object_id of the internal object. */
static VALUE
iow_internal_object_id(VALUE self)
{
@@ -721,24 +592,25 @@ collect_values(st_data_t key, st_data_t value, st_data_t data)
* [MRI specific feature] Return all reachable objects from `obj'.
*
* This method returns all reachable objects from `obj'.
- * If `obj' has references two or more references to same object `x',
- * them returned array only include one `x' object.
- * If `obj' is non-markable (non-heap management) object such as
- * true, false, nil, symbols and Fixnums (and Flonum) them it simply
- * returns nil.
*
- * If `obj' has references to internal object, then it returns
- * instances of `ObjectSpace::InternalObjectWrapper' class.
- * This object contains a reference to an internal object and
- * you can check the type of internal object with `type' method.
+ * If `obj' has two or more references to the same object `x', then returned
+ * array only includes one `x' object.
+ *
+ * If `obj' is a non-markable (non-heap management) object such as true,
+ * false, nil, symbols and Fixnums (and Flonum) then it simply returns nil.
*
- * If `obj' is instance of `ObjectSpace::InternalObjectWrapper'
- * class, then this method returns all reachable object from
- * an internal object, which is pointed by `obj'.
+ * If `obj' has references to an internal object, then it returns instances of
+ * ObjectSpace::InternalObjectWrapper class. This object contains a reference
+ * to an internal object and you can check the type of internal object with
+ * `type' method.
+ *
+ * If `obj' is instance of ObjectSpace::InternalObjectWrapper class, then this
+ * method returns all reachable object from an internal object, which is
+ * pointed by `obj'.
*
* With this method, you can find memory leaks.
*
- * This method is not expected to work except C Ruby.
+ * This method is only expected to work except with C Ruby.
*
* Example:
* ObjectSpace.reachable_objects_from(['a', 'b', 'c'])
@@ -779,20 +651,100 @@ reachable_objects_from(VALUE self, VALUE obj)
}
}
-/* objspace library extends ObjectSpace module and add several
+struct rofr_data {
+ VALUE categories;
+ const char *last_category;
+ VALUE last_category_str;
+ VALUE last_category_objects;
+};
+
+static void
+reachable_object_from_root_i(const char *category, VALUE obj, void *ptr)
+{
+ struct rofr_data *data = (struct rofr_data *)ptr;
+ VALUE category_str;
+ VALUE category_objects;
+
+ if (category == data->last_category) {
+ category_str = data->last_category_str;
+ category_objects = data->last_category_objects;
+ }
+ else {
+ data->last_category = category;
+ category_str = data->last_category_str = rb_str_new2(category);
+ category_objects = data->last_category_objects = rb_hash_new();
+ rb_funcall(category_objects, rb_intern("compare_by_identity"), 0);
+ 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_internal_object_p(obj)) {
+ obj = iow_newobj(obj);
+ }
+ rb_hash_aset(category_objects, obj, obj);
+ }
+}
+
+static int
+collect_values_of_values(VALUE category, VALUE category_objects, VALUE categories)
+{
+ VALUE ary = rb_ary_new();
+ st_foreach(rb_hash_tbl(category_objects), collect_values, ary);
+ rb_hash_aset(categories, category, ary);
+ return ST_CONTINUE;
+}
+
+/*
+ * call-seq:
+ * ObjectSpace.reachable_objects_from_root -> hash
+ *
+ * [MRI specific feature] Return all reachable objects from root.
+ */
+static VALUE
+reachable_objects_from_root(VALUE self)
+{
+ struct rofr_data data;
+ VALUE hash = data.categories = rb_hash_new();
+ data.last_category = 0;
+
+ rb_funcall(hash, rb_intern("compare_by_identity"), 0);
+ rb_objspace_reachable_objects_from_root(reachable_object_from_root_i, &data);
+ rb_hash_foreach(hash, collect_values_of_values, hash);
+
+ return hash;
+}
+
+void Init_object_tracing(VALUE rb_mObjSpace);
+void Init_objspace_dump(VALUE rb_mObjSpace);
+
+/*
+ * Document-module: ObjectSpace
+ *
+ * The objspace library extends the ObjectSpace module and adds several
* methods to get internal statistic information about
* object/memory management.
*
- * Generally, you *SHOULD NOT*use this library if you do not know
+ * You need to <code>require 'objspace'</code> to use this extension module.
+ *
+ * Generally, you *SHOULD NOT* use this library if you do not know
* about the MRI implementation. Mainly, this library is for (memory)
- * profiler developers and MRI developers who need to know how MRI
+ * profiler developers and MRI developers who need to know about MRI
* memory usage.
*/
void
Init_objspace(void)
{
- VALUE rb_mObjSpace = rb_const_get(rb_cObject, rb_intern("ObjectSpace"));
+ VALUE rb_mObjSpace;
+#if 0
+ rb_mObjSpace = rb_define_module("ObjectSpace"); /* let rdoc know */
+#endif
+ rb_mObjSpace = rb_const_get(rb_cObject, rb_intern("ObjectSpace"));
rb_define_module_function(rb_mObjSpace, "memsize_of", memsize_of_m, 1);
rb_define_module_function(rb_mObjSpace, "memsize_of_all", memsize_of_all_m, -1);
@@ -802,9 +754,22 @@ Init_objspace(void)
rb_define_module_function(rb_mObjSpace, "count_tdata_objects", count_tdata_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);
+
+ /*
+ * This class is used as a return value from
+ * ObjectSpace::reachable_objects_from.
+ *
+ * When ObjectSpace::reachable_objects_from returns an object with
+ * references to an internal object, an instance of this class is returned.
+ *
+ * You can use the #type method to check the type of the internal object.
+ */
rb_mInternalObjectWrapper = rb_define_class_under(rb_mObjSpace, "InternalObjectWrapper", rb_cObject);
rb_define_method(rb_mInternalObjectWrapper, "type", iow_type, 0);
rb_define_method(rb_mInternalObjectWrapper, "inspect", iow_inspect, 0);
rb_define_method(rb_mInternalObjectWrapper, "internal_object_id", iow_internal_object_id, 0);
+
+ Init_object_tracing(rb_mObjSpace);
+ Init_objspace_dump(rb_mObjSpace);
}
diff --git a/ext/objspace/objspace.h b/ext/objspace/objspace.h
new file mode 100644
index 0000000000..95b84d6c1e
--- /dev/null
+++ b/ext/objspace/objspace.h
@@ -0,0 +1,20 @@
+#ifndef OBJSPACE_H
+#define OBJSPACE_H 1
+
+/* object_tracing.c */
+struct allocation_info {
+ /* all of information don't need marking. */
+ int living;
+ VALUE flags;
+ VALUE klass;
+
+ /* allocation info */
+ const char *path;
+ unsigned long line;
+ const char *class_path;
+ VALUE mid;
+ size_t generation;
+};
+struct allocation_info *objspace_lookup_allocation_info(VALUE obj);
+
+#endif
diff --git a/ext/objspace/objspace_dump.c b/ext/objspace/objspace_dump.c
new file mode 100644
index 0000000000..cb8f943d97
--- /dev/null
+++ b/ext/objspace/objspace_dump.c
@@ -0,0 +1,431 @@
+/**********************************************************************
+
+ objspace_dump.c - Heap dumping ObjectSpace extender for MRI.
+
+ $Author$
+ created at: Sat Oct 11 10:11:00 2013
+
+ NOTE: This extension library is not expected to exist except C Ruby.
+
+ 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"
+#include "ruby/encoding.h"
+#include "ruby/io.h"
+#include "gc.h"
+#include "node.h"
+#include "vm_core.h"
+#include "objspace.h"
+#include "internal.h"
+
+static VALUE sym_output, sym_stdout, sym_string, sym_file;
+
+struct dump_config {
+ VALUE type;
+ FILE *stream;
+ VALUE string;
+ int roots;
+ const char *root_category;
+ VALUE cur_obj;
+ VALUE cur_obj_klass;
+ size_t cur_obj_references;
+};
+
+static void
+dump_append(struct dump_config *dc, const char *format, ...)
+{
+ va_list vl;
+ va_start(vl, format);
+
+ if (dc->stream) {
+ vfprintf(dc->stream, format, vl);
+ }
+ else if (dc->string)
+ rb_str_vcatf(dc->string, format, vl);
+
+ va_end(vl);
+}
+
+static void
+dump_append_string_value(struct dump_config *dc, VALUE obj)
+{
+ int i;
+ char c, *value;
+
+ dump_append(dc, "\"");
+ for (i = 0, value = RSTRING_PTR(obj); i < RSTRING_LEN(obj); i++) {
+ switch ((c = value[i])) {
+ case '\\':
+ case '"':
+ dump_append(dc, "\\%c", c);
+ break;
+ case '\0':
+ dump_append(dc, "\\u0000");
+ break;
+ case '\b':
+ dump_append(dc, "\\b");
+ break;
+ case '\t':
+ dump_append(dc, "\\t");
+ break;
+ case '\f':
+ dump_append(dc, "\\f");
+ break;
+ case '\n':
+ dump_append(dc, "\\n");
+ break;
+ case '\r':
+ dump_append(dc, "\\r");
+ break;
+ default:
+ if (c <= 0x1f)
+ dump_append(dc, "\\u%04d", c);
+ else
+ dump_append(dc, "%c", c);
+ }
+ }
+ dump_append(dc, "\"");
+}
+
+static inline const char *
+obj_type(VALUE obj)
+{
+ switch (BUILTIN_TYPE(obj)) {
+#define CASE_TYPE(type) case T_##type: return #type; break
+ CASE_TYPE(NONE);
+ CASE_TYPE(NIL);
+ CASE_TYPE(OBJECT);
+ CASE_TYPE(CLASS);
+ CASE_TYPE(ICLASS);
+ CASE_TYPE(MODULE);
+ CASE_TYPE(FLOAT);
+ CASE_TYPE(STRING);
+ CASE_TYPE(REGEXP);
+ CASE_TYPE(ARRAY);
+ CASE_TYPE(HASH);
+ CASE_TYPE(STRUCT);
+ CASE_TYPE(BIGNUM);
+ CASE_TYPE(FILE);
+ CASE_TYPE(FIXNUM);
+ CASE_TYPE(TRUE);
+ CASE_TYPE(FALSE);
+ CASE_TYPE(DATA);
+ CASE_TYPE(MATCH);
+ CASE_TYPE(SYMBOL);
+ CASE_TYPE(RATIONAL);
+ CASE_TYPE(COMPLEX);
+ CASE_TYPE(UNDEF);
+ CASE_TYPE(NODE);
+ CASE_TYPE(ZOMBIE);
+#undef CASE_TYPE
+ }
+ return "UNKNOWN";
+}
+
+static void
+reachable_object_i(VALUE ref, void *data)
+{
+ struct dump_config *dc = (struct dump_config *)data;
+
+ if (dc->cur_obj_klass == ref)
+ return;
+
+ if (dc->cur_obj_references == 0)
+ dump_append(dc, ", \"references\":[\"%p\"", (void *)ref);
+ else
+ dump_append(dc, ", \"%p\"", (void *)ref);
+
+ dc->cur_obj_references++;
+}
+
+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;
+
+ dc->cur_obj = obj;
+ dc->cur_obj_references = 0;
+ dc->cur_obj_klass = BUILTIN_TYPE(obj) == T_NODE ? 0 : RBASIC_CLASS(obj);
+
+ if (dc->cur_obj == dc->string)
+ return;
+
+ dump_append(dc, "{\"address\":\"%p\", \"type\":\"%s\"", (void *)obj, obj_type(obj));
+
+ if (dc->cur_obj_klass)
+ dump_append(dc, ", \"class\":\"%p\"", (void *)dc->cur_obj_klass);
+ if (rb_obj_frozen_p(obj))
+ dump_append(dc, ", \"frozen\":true");
+
+ switch (BUILTIN_TYPE(obj)) {
+ case T_NODE:
+ dump_append(dc, ", \"node_type\":\"%s\"", ruby_node_name(nd_type(obj)));
+ break;
+
+ case T_STRING:
+ if (STR_EMBED_P(obj))
+ dump_append(dc, ", \"embedded\":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(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);
+ }
+ }
+
+ if (!ENCODING_IS_ASCII8BIT(obj))
+ dump_append(dc, ", \"encoding\":\"%s\"", rb_enc_name(rb_enc_from_index(ENCODING_GET(obj))));
+ break;
+
+ case T_HASH:
+ dump_append(dc, ", \"size\":%ld", RHASH_SIZE(obj));
+ if (FL_TEST(obj, HASH_PROC_DEFAULT))
+ dump_append(dc, ", \"default\":\"%p\"", (void *)RHASH_IFNONE(obj));
+ break;
+
+ case T_ARRAY:
+ dump_append(dc, ", \"length\":%ld", RARRAY_LEN(obj));
+ if (RARRAY_LEN(obj) > 0 && FL_TEST(obj, ELTS_SHARED))
+ dump_append(dc, ", \"shared\":true");
+ if (RARRAY_LEN(obj) > 0 && FL_TEST(obj, RARRAY_EMBED_FLAG))
+ dump_append(dc, ", \"embedded\":true");
+ break;
+
+ case T_CLASS:
+ case T_MODULE:
+ if (dc->cur_obj_klass)
+ dump_append(dc, ", \"name\":\"%s\"", rb_class2name(obj));
+ break;
+
+ case T_DATA:
+ if (RTYPEDDATA_P(obj))
+ dump_append(dc, ", \"struct\":\"%s\"", RTYPEDDATA_TYPE(obj)->wrap_struct_name);
+ break;
+
+ case T_FLOAT:
+ dump_append(dc, ", \"value\":\"%g\"", RFLOAT_VALUE(obj));
+ break;
+
+ case T_OBJECT:
+ dump_append(dc, ", \"ivars\":%ld", ROBJECT_NUMIV(obj));
+ break;
+
+ case T_FILE:
+ fptr = RFILE(obj)->fptr;
+ if (fptr)
+ dump_append(dc, ", \"fd\":%d", fptr->fd);
+ break;
+
+ case T_ZOMBIE:
+ dump_append(dc, "}\n");
+ return;
+ }
+
+ rb_objspace_reachable_objects_from(obj, reachable_object_i, dc);
+ if (dc->cur_obj_references > 0)
+ dump_append(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 ((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, "}\n");
+}
+
+static int
+heap_i(void *vstart, void *vend, size_t stride, void *data)
+{
+ VALUE v = (VALUE)vstart;
+ for (; v != (VALUE)vend; v += stride) {
+ if (RBASIC(v)->flags)
+ dump_object(v, data);
+ }
+ return 0;
+}
+
+static void
+root_obj_i(const char *category, VALUE obj, void *data)
+{
+ struct dump_config *dc = (struct dump_config *)data;
+
+ if (dc->root_category != NULL && category != dc->root_category)
+ dump_append(dc, "]}\n");
+ if (dc->root_category == NULL || category != dc->root_category)
+ dump_append(dc, "{\"type\":\"ROOT\", \"root\":\"%s\", \"references\":[\"%p\"", category, (void *)obj);
+ else
+ dump_append(dc, ", \"%p\"", (void *)obj);
+
+ dc->root_category = category;
+ dc->roots++;
+}
+
+static VALUE
+dump_output(struct dump_config *dc, VALUE opts, VALUE output, const char *filename)
+{
+ VALUE tmp;
+
+ if (RTEST(opts))
+ output = rb_hash_aref(opts, sym_output);
+
+ if (output == sym_stdout) {
+ dc->stream = stdout;
+ dc->string = Qnil;
+ }
+ else if (output == sym_file) {
+ rb_io_t *fptr;
+ rb_require("tempfile");
+ tmp = rb_assoc_new(rb_str_new_cstr(filename), rb_str_new_cstr(".json"));
+ tmp = rb_funcallv(rb_path2class("Tempfile"), rb_intern("create"), 1, &tmp);
+ io:
+ dc->string = rb_io_get_write_io(tmp);
+ rb_io_flush(dc->string);
+ GetOpenFile(dc->string, fptr);
+ dc->stream = rb_io_stdio_file(fptr);
+ }
+ else if (output == sym_string) {
+ dc->string = rb_str_new_cstr("");
+ }
+ else if (!NIL_P(tmp = rb_io_check_io(output))) {
+ output = sym_file;
+ goto io;
+ }
+ else {
+ rb_raise(rb_eArgError, "wrong output option: %"PRIsVALUE, output);
+ }
+ return output;
+}
+
+static VALUE
+dump_result(struct dump_config *dc, VALUE output)
+{
+ if (output == sym_string) {
+ return dc->string;
+ }
+ else if (output == sym_file) {
+ rb_io_flush(dc->string);
+ return dc->string;
+ }
+ else {
+ return Qnil;
+ }
+}
+
+/*
+ * call-seq:
+ * ObjectSpace.dump(obj[, output: :string]) # => "{ ... }"
+ * ObjectSpace.dump(obj, output: :file) # => #<File:/tmp/rubyobj20131125-88733-1xkfmpv.json>
+ * ObjectSpace.dump(obj, output: :stdout) # => nil
+ *
+ * Dump the contents of a ruby object as JSON.
+ *
+ * This method is only expected to work with C Ruby.
+ * This is an experimental method and is subject to change.
+ * In particular, the function signature and output format are
+ * not guaranteed to be compatible in future versions of ruby.
+ */
+
+static VALUE
+objspace_dump(int argc, VALUE *argv, VALUE os)
+{
+ static const char filename[] = "rubyobj";
+ VALUE obj = Qnil, opts = Qnil, output;
+ struct dump_config dc = {0,};
+
+ rb_scan_args(argc, argv, "1:", &obj, &opts);
+
+ output = dump_output(&dc, opts, sym_string, filename);
+
+ dump_object(obj, &dc);
+
+ return dump_result(&dc, output);
+}
+
+/*
+ * call-seq:
+ * ObjectSpace.dump_all([output: :file]) # => #<File:/tmp/rubyheap20131125-88469-laoj3v.json>
+ * 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.
+ *
+ * This method is only expected to work with C Ruby.
+ * This is an experimental method and is subject to change.
+ * In particular, the function signature and output format are
+ * not guaranteed to be compatible in future versions of ruby.
+ */
+
+static VALUE
+objspace_dump_all(int argc, VALUE *argv, VALUE os)
+{
+ static const char filename[] = "rubyheap";
+ VALUE opts = Qnil, output;
+ struct dump_config dc = {0,};
+
+ rb_scan_args(argc, argv, "0:", &opts);
+
+ output = dump_output(&dc, opts, sym_file, filename);
+
+ /* dump roots */
+ rb_objspace_reachable_objects_from_root(root_obj_i, &dc);
+ if (dc.roots) dump_append(&dc, "]}\n");
+
+ /* dump all objects */
+ rb_objspace_each_objects(heap_i, &dc);
+
+ return dump_result(&dc, output);
+}
+
+void
+Init_objspace_dump(VALUE rb_mObjSpace)
+{
+#if 0
+ rb_mObjSpace = rb_define_module("ObjectSpace"); /* let rdoc know */
+#endif
+
+ rb_define_module_function(rb_mObjSpace, "dump", objspace_dump, -1);
+ rb_define_module_function(rb_mObjSpace, "dump_all", objspace_dump_all, -1);
+
+ sym_output = ID2SYM(rb_intern("output"));
+ 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
new file mode 100644
index 0000000000..23bebd8cc8
--- /dev/null
+++ b/ext/openssl/depend
@@ -0,0 +1,6 @@
+$(OBJS): $(HDRS) $(ruby_headers) \
+ $(hdrdir)/ruby/io.h \
+ $(hdrdir)/ruby/encoding.h \
+ $(hdrdir)/ruby/oniguruma.h \
+ $(hdrdir)/ruby/thread.h
+ossl.o: $(hdrdir)/ruby/thread_native.h
diff --git a/ext/openssl/extconf.rb b/ext/openssl/extconf.rb
index 848e1f2bdc..e272cba092 100644
--- a/ext/openssl/extconf.rb
+++ b/ext/openssl/extconf.rb
@@ -144,6 +144,7 @@ if checking_for('OpenSSL version is 0.9.7 or later') {
}
have_header("openssl/ocsp.h")
end
+have_struct_member("CRYPTO_THREADID", "ptr", "openssl/crypto.h")
have_struct_member("EVP_CIPHER_CTX", "flags", "openssl/evp.h")
have_struct_member("EVP_CIPHER_CTX", "engine", "openssl/evp.h")
have_struct_member("X509_ATTRIBUTE", "single", "openssl/x509.h")
@@ -153,5 +154,7 @@ have_macro("EVP_CTRL_GCM_GET_TAG", ['openssl/evp.h']) && $defs.push("-DHAVE_AUTH
Logging::message "=== Checking done. ===\n"
create_header
-create_makefile("openssl")
+create_makefile("openssl") {|conf|
+ conf << "THREAD_MODEL = #{CONFIG["THREAD_MODEL"]}\n"
+}
Logging::message "Done.\n"
diff --git a/ext/openssl/lib/openssl/bn.rb b/ext/openssl/lib/openssl/bn.rb
index 180de18db1..0e19c20d34 100644
--- a/ext/openssl/lib/openssl/bn.rb
+++ b/ext/openssl/lib/openssl/bn.rb
@@ -28,8 +28,11 @@ end # OpenSSL
# Add double dispatch to Integer
#
class Integer
+ # Casts an Integer as an OpenSSL::BN
+ #
+ # See `man bn` for more info.
def to_bn
- OpenSSL::BN::new(self.to_s(16), 16)
+ OpenSSL::BN::new(self)
end
end # Integer
diff --git a/ext/openssl/lib/openssl/buffering.rb b/ext/openssl/lib/openssl/buffering.rb
index 51bc968e3a..1223c5de15 100644
--- a/ext/openssl/lib/openssl/buffering.rb
+++ b/ext/openssl/lib/openssl/buffering.rb
@@ -1,23 +1,27 @@
-=begin
-= $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$
-=end
+# coding: binary
+#--
+#= $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$
+#++
##
# OpenSSL IO buffering mix-in module.
#
# This module allows an OpenSSL::SSL::SSLSocket to behave like an IO.
+#
+# You typically won't use this module directly, you can see it implemented in
+# OpenSSL::SSL::SSLSocket.
module OpenSSL::Buffering
include Enumerable
@@ -34,7 +38,11 @@ module OpenSSL::Buffering
BLOCK_SIZE = 1024*16
- def initialize(*args)
+ ##
+ # Creates an instance of OpenSSL's buffering IO module.
+
+ def initialize(*)
+ super
@eof = false
@rbuffer = ""
@sync = @io.sync
@@ -161,7 +169,7 @@ module OpenSSL::Buffering
# when the peer requests a new TLS/SSL handshake. See openssl the FAQ for
# more details. http://www.openssl.org/support/faq.html
- def read_nonblock(maxlen, buf=nil)
+ def read_nonblock(maxlen, buf=nil, exception: true)
if maxlen == 0
if buf
buf.clear
@@ -171,7 +179,7 @@ module OpenSSL::Buffering
end
end
if @rbuffer.empty?
- return sysread_nonblock(maxlen, buf)
+ return sysread_nonblock(maxlen, buf, exception: exception)
end
ret = consume_rbuff(maxlen)
if buf
@@ -370,9 +378,9 @@ module OpenSSL::Buffering
# is when the peer requests a new TLS/SSL handshake. See the openssl FAQ
# for more details. http://www.openssl.org/support/faq.html
- def write_nonblock(s)
+ def write_nonblock(s, exception: true)
flush
- syswrite_nonblock(s)
+ syswrite_nonblock(s, exception: exception)
end
##
diff --git a/ext/openssl/lib/openssl/config.rb b/ext/openssl/lib/openssl/config.rb
index 24a54c91ec..5716d59fd6 100644
--- a/ext/openssl/lib/openssl/config.rb
+++ b/ext/openssl/lib/openssl/config.rb
@@ -13,20 +13,41 @@
require 'stringio'
module OpenSSL
+ ##
+ # = OpenSSL::Config
+ #
+ # Configuration for the openssl library.
+ #
+ # Many system's installation of openssl library will depend on your system
+ # configuration. See the value of OpenSSL::Config::DEFAULT_CONFIG_FILE for
+ # the location of the file for your host.
+ #
+ # See also http://www.openssl.org/docs/apps/config.html
class Config
include Enumerable
class << self
- def parse(str)
+
+ ##
+ # Parses a given +string+ as a blob that contains configuration for openssl.
+ #
+ # If the source of the IO is a file, then consider using #parse_config.
+ def parse(string)
c = new()
- parse_config(StringIO.new(str)).each do |section, hash|
+ parse_config(StringIO.new(string)).each do |section, hash|
c[section] = hash
end
c
end
+ ##
+ # load is an alias to ::new
alias load new
+ ##
+ # Parses the configuration data read from +io+, see also #parse.
+ #
+ # Raises a ConfigError on invalid configuration data.
def parse_config(io)
begin
parse_config_lines(io)
@@ -209,6 +230,18 @@ module OpenSSL
end
end
+ ##
+ # Creates an instance of OpenSSL's configuration class.
+ #
+ # This can be used in contexts like OpenSSL::X509::ExtensionFactory.config=
+ #
+ # If the optional +filename+ parameter is provided, then it is read in and
+ # parsed via #parse_config.
+ #
+ # This can raise IO exceptions based on the access, or availability of the
+ # file. A ConfigError exception may be raised depending on the validity of
+ # the data being configured.
+ #
def initialize(filename = nil)
@data = {}
if filename
@@ -220,6 +253,23 @@ module OpenSSL
end
end
+ ##
+ # Gets the value of +key+ from the given +section+
+ #
+ # Given the following configurating file being loaded:
+ #
+ # config = OpenSSL::Config.load('foo.cnf')
+ # #=> #<OpenSSL::Config sections=["default"]>
+ # puts config.to_s
+ # #=> [ default ]
+ # # foo=bar
+ #
+ # You can get a specific value from the config if you know the +section+
+ # and +key+ like so:
+ #
+ # config.get_value('default','foo')
+ # #=> "bar"
+ #
def get_value(section, key)
if section.nil?
raise TypeError.new('nil not allowed')
@@ -228,7 +278,12 @@ module OpenSSL
get_key_string(section, key)
end
- def value(arg1, arg2 = nil)
+ ##
+ #
+ # *Deprecated*
+ #
+ # Use #get_value instead
+ def value(arg1, arg2 = nil) # :nodoc:
warn('Config#value is deprecated; use Config#get_value')
if arg2.nil?
section, key = 'default', arg1
@@ -240,20 +295,84 @@ module OpenSSL
get_key_string(section, key)
end
+ ##
+ # Set the target +key+ with a given +value+ under a specific +section+.
+ #
+ # Given the following configurating file being loaded:
+ #
+ # config = OpenSSL::Config.load('foo.cnf')
+ # #=> #<OpenSSL::Config sections=["default"]>
+ # puts config.to_s
+ # #=> [ default ]
+ # # foo=bar
+ #
+ # You can set the value of +foo+ under the +default+ section to a new
+ # value:
+ #
+ # config.add_value('default', 'foo', 'buzz')
+ # #=> "buzz"
+ # puts config.to_s
+ # #=> [ default ]
+ # # foo=buzz
+ #
def add_value(section, key, value)
check_modify
(@data[section] ||= {})[key] = value
end
+ ##
+ # Get a specific +section+ from the current configuration
+ #
+ # Given the following configurating file being loaded:
+ #
+ # config = OpenSSL::Config.load('foo.cnf')
+ # #=> #<OpenSSL::Config sections=["default"]>
+ # puts config.to_s
+ # #=> [ default ]
+ # # foo=bar
+ #
+ # You can get a hash of the specific section like so:
+ #
+ # config['default']
+ # #=> {"foo"=>"bar"}
+ #
def [](section)
@data[section] || {}
end
- def section(name)
+ ##
+ # Deprecated
+ #
+ # Use #[] instead
+ def section(name) # :nodoc:
warn('Config#section is deprecated; use Config#[]')
@data[name] || {}
end
+ ##
+ # Sets a specific +section+ name with a Hash +pairs+
+ #
+ # Given the following configuration being created:
+ #
+ # config = OpenSSL::Config.new
+ # #=> #<OpenSSL::Config sections=[]>
+ # config['default'] = {"foo"=>"bar","baz"=>"buz"}
+ # #=> {"foo"=>"bar", "baz"=>"buz"}
+ # puts config.to_s
+ # #=> [ default ]
+ # # foo=bar
+ # # baz=buz
+ #
+ # It's important to note that this will essentially merge any of the keys
+ # in +pairs+ with the existing +section+. For example:
+ #
+ # config['default']
+ # #=> {"foo"=>"bar", "baz"=>"buz"}
+ # config['default'] = {"foo" => "changed"}
+ # #=> {"foo"=>"changed"}
+ # config['default']
+ # #=> {"foo"=>"changed", "baz"=>"buz"}
+ #
def []=(section, pairs)
check_modify
@data[section] ||= {}
@@ -262,10 +381,38 @@ module OpenSSL
end
end
+ ##
+ # Get the names of all sections in the current configuration
def sections
@data.keys
end
+ ##
+ # Get the parsable form of the current configuration
+ #
+ # Given the following configuration being created:
+ #
+ # config = OpenSSL::Config.new
+ # #=> #<OpenSSL::Config sections=[]>
+ # config['default'] = {"foo"=>"bar","baz"=>"buz"}
+ # #=> {"foo"=>"bar", "baz"=>"buz"}
+ # puts config.to_s
+ # #=> [ default ]
+ # # foo=bar
+ # # baz=buz
+ #
+ # You can parse get the serialized configuration using #to_s and then parse
+ # it later:
+ #
+ # serialized_config = config.to_s
+ # # much later...
+ # new_config = OpenSSL::Config.parse(serialized_config)
+ # #=> #<OpenSSL::Config sections=["default"]>
+ # puts new_config
+ # #=> [ default ]
+ # foo=bar
+ # baz=buz
+ #
def to_s
ary = []
@data.keys.sort.each do |section|
@@ -278,6 +425,15 @@ module OpenSSL
ary.join
end
+ ##
+ # For a block.
+ #
+ # Receive the section and its pairs for the current configuration.
+ #
+ # config.each do |section, key, value|
+ # # ...
+ # end
+ #
def each
@data.each do |section, hash|
hash.each do |key, value|
@@ -286,13 +442,16 @@ module OpenSSL
end
end
+ ##
+ # String representation of this configuration object, including the class
+ # name and its sections.
def inspect
"#<#{self.class.name} sections=#{sections.inspect}>"
end
protected
- def data
+ def data # :nodoc:
@data
end
diff --git a/ext/openssl/lib/openssl/digest.rb b/ext/openssl/lib/openssl/digest.rb
index f2a47bfdf9..a7b641fd22 100644
--- a/ext/openssl/lib/openssl/digest.rb
+++ b/ext/openssl/lib/openssl/digest.rb
@@ -38,31 +38,30 @@ 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(Digest){
- define_method(:initialize){|*data|
- if data.length > 1
- raise ArgumentError,
- "wrong number of arguments (#{data.length} for 1)"
- end
- super(name, data.first)
- }
+ klass = Class.new(self) {
+ define_method(:initialize, ->(data = nil) {super(name, data)})
}
singleton = (class << klass; self; end)
singleton.class_eval{
- define_method(:digest){|data| Digest.digest(name, data) }
- define_method(:hexdigest){|data| Digest.hexdigest(name, data) }
+ define_method(:digest){|data| new.digest(data) }
+ define_method(:hexdigest){|data| new.hexdigest(data) }
}
const_set(name, klass)
}
- # This class is only provided for backwards compatibility. Use OpenSSL::Digest in the future.
- class Digest < Digest
+ # Deprecated.
+ #
+ # This class is only provided for backwards compatibility.
+ class Digest < Digest # :nodoc:
+ # Deprecated.
+ #
+ # See OpenSSL::Digest.new
def initialize(*args)
- # add warning
+ warn('Digest::Digest is deprecated; use Digest')
super(*args)
end
end
diff --git a/ext/openssl/lib/openssl/ssl.rb b/ext/openssl/lib/openssl/ssl.rb
index 741274a5f9..fb1045381f 100644
--- a/ext/openssl/lib/openssl/ssl.rb
+++ b/ext/openssl/lib/openssl/ssl.rb
@@ -23,10 +23,48 @@ module OpenSSL
DEFAULT_PARAMS = {
:ssl_version => "SSLv23",
:verify_mode => OpenSSL::SSL::VERIFY_PEER,
- :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,
+ :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)
+ }.call
}
DEFAULT_CERT_STORE = OpenSSL::X509::Store.new
@@ -148,10 +186,16 @@ module OpenSSL
end
end
+ ##
+ # SSLServer represents a TCP/IP server socket with Secure Sockets Layer.
class SSLServer
include SocketForwarder
+ # When true then #accept works exactly the same as TCPServer#accept
attr_accessor :start_immediately
+ # Creates a new instance of SSLServer.
+ # * +srv+ is an instance of TCPServer.
+ # * +ctx+ is an instance of OpenSSL::SSL::SSLContext.
def initialize(svr, ctx)
@svr = svr
@ctx = ctx
@@ -164,31 +208,43 @@ module OpenSSL
@start_immediately = true
end
+ # Returns the TCPServer passed to the SSLServer when initialized.
def to_io
@svr
end
+ # See TCPServer#listen for details.
def listen(backlog=5)
@svr.listen(backlog)
end
+ # See BasicSocket#shutdown for details.
def shutdown(how=Socket::SHUT_RDWR)
@svr.shutdown(how)
end
+ # Works similar to TCPServer#accept.
def accept
- sock = @svr.accept
+ # Socket#accept returns [socket, addrinfo].
+ # TCPServer#accept returns a socket.
+ # The following comma strips addrinfo.
+ sock, = @svr.accept
begin
ssl = OpenSSL::SSL::SSLSocket.new(sock, @ctx)
ssl.sync_close = true
ssl.accept if @start_immediately
ssl
- rescue SSLError => ex
- sock.close
+ rescue Exception => ex
+ if ssl
+ ssl.close
+ else
+ sock.close
+ end
raise ex
end
end
+ # See IO#close for details.
def close
@svr.close
end
diff --git a/ext/openssl/openssl_missing.c b/ext/openssl/openssl_missing.c
index f88dd403be..b5efaaf15d 100644
--- a/ext/openssl/openssl_missing.c
+++ b/ext/openssl/openssl_missing.c
@@ -10,7 +10,7 @@
*/
#include RUBY_EXTCONF_H
-#if defined(HAVE_OPENSSL_ENGINE_H) && defined(HAVE_ST_ENGINE)
+#if defined(HAVE_OPENSSL_ENGINE_H) && defined(HAVE_EVP_CIPHER_CTX_ENGINE)
# include <openssl/engine.h>
#endif
#include <openssl/x509_vfy.h>
@@ -122,7 +122,7 @@ EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, EVP_CIPHER_CTX *in)
{
memcpy(out, in, sizeof(EVP_CIPHER_CTX));
-#if defined(HAVE_ENGINE_ADD) && defined(HAVE_ST_ENGINE)
+#if defined(HAVE_ENGINE_ADD) && defined(HAVE_EVP_CIPHER_CTX_ENGINE)
if (in->engine) ENGINE_add(out->engine);
if (in->cipher_data) {
out->cipher_data = OPENSSL_malloc(in->cipher->ctx_size);
diff --git a/ext/openssl/ossl.c b/ext/openssl/ossl.c
index 99307b4a75..8b25c02990 100644
--- a/ext/openssl/ossl.c
+++ b/ext/openssl/ossl.c
@@ -18,11 +18,12 @@ int
string2hex(const unsigned char *buf, int buf_len, char **hexbuf, int *hexbuf_len)
{
static const char hex[]="0123456789abcdef";
- int i, len = 2 * buf_len;
+ int i, len;
- if (buf_len < 0 || len < buf_len) { /* PARANOIA? */
+ if (buf_len < 0 || buf_len > INT_MAX / 2) { /* PARANOIA? */
return -1;
}
+ len = 2 * buf_len;
if (!hexbuf) { /* if no buf, return calculated len */
if (hexbuf_len) {
*hexbuf_len = len;
@@ -293,10 +294,9 @@ ossl_to_der_if_possible(VALUE obj)
static VALUE
ossl_make_error(VALUE exc, const char *fmt, va_list args)
{
- char buf[BUFSIZ];
+ VALUE str = Qnil;
const char *msg;
long e;
- int len = 0;
#ifdef HAVE_ERR_PEEK_LAST_ERROR
e = ERR_peek_last_error();
@@ -304,14 +304,20 @@ ossl_make_error(VALUE exc, const char *fmt, va_list args)
e = ERR_peek_error();
#endif
if (fmt) {
- len = vsnprintf(buf, BUFSIZ, fmt, args);
+ str = rb_vsprintf(fmt, args);
}
- if (len < BUFSIZ && e) {
+ if (e) {
if (dOSSL == Qtrue) /* FULL INFO */
msg = ERR_error_string(e, NULL);
else
msg = ERR_reason_error_string(e);
- len += snprintf(buf+len, BUFSIZ-len, "%s%s", (len ? ": " : ""), msg);
+ 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)");
+ }
}
if (dOSSL == Qtrue){ /* show all errors on the stack */
while ((e = ERR_get_error()) != 0){
@@ -320,8 +326,8 @@ ossl_make_error(VALUE exc, const char *fmt, va_list args)
}
ERR_clear_error();
- if(len > BUFSIZ) len = rb_long2int(strlen(buf));
- return rb_exc_new(exc, buf, len);
+ if (NIL_P(str)) str = rb_str_new(0, 0);
+ return rb_exc_new3(exc, str);
}
void
@@ -458,6 +464,94 @@ ossl_fips_mode_set(VALUE self, VALUE enabled)
#endif
}
+/**
+ * Stores locks needed for OpenSSL thread safety
+ */
+#include "ruby/thread_native.h"
+static rb_nativethread_lock_t *ossl_locks;
+
+static void
+ossl_lock_unlock(int mode, rb_nativethread_lock_t *lock)
+{
+ if (mode & CRYPTO_LOCK) {
+ rb_nativethread_lock_lock(lock);
+ } else {
+ rb_nativethread_lock_unlock(lock);
+ }
+}
+
+static void
+ossl_lock_callback(int mode, int type, const char *file, int line)
+{
+ ossl_lock_unlock(mode, &ossl_locks[type]);
+}
+
+struct CRYPTO_dynlock_value {
+ rb_nativethread_lock_t lock;
+};
+
+static struct CRYPTO_dynlock_value *
+ossl_dyn_create_callback(const char *file, int line)
+{
+ struct CRYPTO_dynlock_value *dynlock = (struct CRYPTO_dynlock_value *)OPENSSL_malloc((int)sizeof(struct CRYPTO_dynlock_value));
+ rb_nativethread_lock_initialize(&dynlock->lock);
+ return dynlock;
+}
+
+static void
+ossl_dyn_lock_callback(int mode, struct CRYPTO_dynlock_value *l, const char *file, int line)
+{
+ ossl_lock_unlock(mode, &l->lock);
+}
+
+static void
+ossl_dyn_destroy_callback(struct CRYPTO_dynlock_value *l, const char *file, int line)
+{
+ rb_nativethread_lock_destroy(&l->lock);
+ OPENSSL_free(l);
+}
+
+#ifdef HAVE_CRYPTO_THREADID_PTR
+static void ossl_threadid_func(CRYPTO_THREADID *id)
+{
+ /* register native thread id */
+ CRYPTO_THREADID_set_pointer(id, (void *)rb_nativethread_self());
+}
+#else
+static unsigned long ossl_thread_id(void)
+{
+ /* before OpenSSL 1.0, this is 'unsigned long' */
+ return (unsigned long)rb_nativethread_self();
+}
+#endif
+
+static void Init_ossl_locks(void)
+{
+ int i;
+ int num_locks = CRYPTO_num_locks();
+
+ if ((unsigned)num_locks >= INT_MAX / (int)sizeof(VALUE)) {
+ rb_raise(rb_eRuntimeError, "CRYPTO_num_locks() is too big: %d", num_locks);
+ }
+ ossl_locks = (rb_nativethread_lock_t *) OPENSSL_malloc(num_locks * (int)sizeof(rb_nativethread_lock_t));
+ if (!ossl_locks) {
+ rb_raise(rb_eNoMemError, "CRYPTO_num_locks() is too big: %d", num_locks);
+ }
+ for (i = 0; i < num_locks; i++) {
+ rb_nativethread_lock_initialize(&ossl_locks[i]);
+ }
+
+#ifdef HAVE_CRYPTO_THREADID_PTR
+ CRYPTO_THREADID_set_callback(ossl_threadid_func);
+#else
+ CRYPTO_set_id_callback(ossl_thread_id);
+#endif
+ CRYPTO_set_locking_callback(ossl_lock_callback);
+ CRYPTO_set_dynlock_create_callback(ossl_dyn_create_callback);
+ CRYPTO_set_dynlock_lock_callback(ossl_dyn_lock_callback);
+ CRYPTO_set_dynlock_destroy_callback(ossl_dyn_destroy_callback);
+}
+
/*
* OpenSSL provides SSL, TLS and general purpose cryptography. It wraps the
* OpenSSL[http://www.openssl.org/] library.
@@ -654,27 +748,27 @@ ossl_fips_mode_set(VALUE self, VALUE enabled)
*
* First set up the cipher for encryption
*
- * encrypter = OpenSSL::Cipher.new 'AES-128-CBC'
- * encrypter.encrypt
- * encrypter.pkcs5_keyivgen pass_phrase, salt
+ * encryptor = OpenSSL::Cipher.new 'AES-128-CBC'
+ * encryptor.encrypt
+ * encryptor.pkcs5_keyivgen pass_phrase, salt
*
* Then pass the data you want to encrypt through
*
- * encrypted = encrypter.update 'top secret document'
- * encrypted << encrypter.final
+ * encrypted = encryptor.update 'top secret document'
+ * encrypted << encryptor.final
*
* === Decryption
*
* Use a new Cipher instance set up for decryption
*
- * decrypter = OpenSSL::Cipher.new 'AES-128-CBC'
- * decrypter.decrypt
- * decrypter.pkcs5_keyivgen pass_phrase, salt
+ * decryptor = OpenSSL::Cipher.new 'AES-128-CBC'
+ * decryptor.decrypt
+ * decryptor.pkcs5_keyivgen pass_phrase, salt
*
* Then pass the data you want to decrypt through
*
- * plain = decrypter.update encrypted
- * plain << decrypter.final
+ * plain = decryptor.update encrypted
+ * plain << decryptor.final
*
* == X509 Certificates
*
@@ -756,7 +850,7 @@ ossl_fips_mode_set(VALUE self, VALUE enabled)
* cipher = OpenSSL::Cipher::Cipher.new 'AES-128-CBC'
*
* open 'ca_key.pem', 'w', 0400 do |io|
- * io.write key.export(cipher, pass_phrase)
+ * io.write ca_key.export(cipher, pass_phrase)
* end
*
* === CA Certificate
@@ -977,6 +1071,7 @@ Init_openssl()
* Init main module
*/
mOSSL = rb_define_module("OpenSSL");
+ rb_global_variable(&mOSSL);
/*
* OpenSSL ruby extension version
@@ -989,6 +1084,11 @@ Init_openssl()
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)
*/
@@ -1009,6 +1109,7 @@ Init_openssl()
* common for all classes under OpenSSL module
*/
eOSSLError = rb_define_class_under(mOSSL,"OpenSSLError",rb_eStandardError);
+ rb_global_variable(&eOSSLError);
/*
* Verify callback Proc index for ext-data
@@ -1020,6 +1121,8 @@ Init_openssl()
* Init debug core
*/
dOSSL = Qfalse;
+ rb_global_variable(&dOSSL);
+
rb_define_module_function(mOSSL, "debug", ossl_debug_get, 0);
rb_define_module_function(mOSSL, "debug=", ossl_debug_set, 1);
rb_define_module_function(mOSSL, "errors", ossl_get_errors, 0);
@@ -1029,6 +1132,8 @@ Init_openssl()
*/
ossl_s_to_der = rb_intern("to_der");
+ Init_ossl_locks();
+
/*
* Init components
*/
diff --git a/ext/openssl/ossl.h b/ext/openssl/ossl.h
index 88e4506fa8..c843c06f5c 100644
--- a/ext/openssl/ossl.h
+++ b/ext/openssl/ossl.h
@@ -66,7 +66,7 @@ extern "C" {
#include <openssl/conf_api.h>
#undef X509_NAME
#undef PKCS7_SIGNER_INFO
-#if defined(HAVE_OPENSSL_ENGINE_H) && defined(HAVE_ST_ENGINE)
+#if defined(HAVE_OPENSSL_ENGINE_H) && defined(HAVE_EVP_CIPHER_CTX_ENGINE)
# define OSSL_ENGINE_ENABLED
# include <openssl/engine.h>
#endif
@@ -95,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 (%s)! (Expected kind of %s)",\
- rb_obj_classname(obj), rb_class2name(klass));\
+ ossl_raise(rb_eTypeError, "wrong argument (%"PRIsVALUE")! (Expected kind of %"PRIsVALUE")",\
+ rb_obj_class(obj), (klass));\
}\
} while (0)
#define OSSL_Check_Instance(obj, klass) do {\
if (!rb_obj_is_instance_of((obj), (klass))) {\
- ossl_raise(rb_eTypeError, "wrong argument (%s)! (Expected instance of %s)",\
- rb_obj_classname(obj), rb_class2name(klass));\
+ ossl_raise(rb_eTypeError, "wrong argument (%"PRIsVALUE")! (Expected instance of %"PRIsVALUE")",\
+ rb_obj_class(obj), (klass));\
}\
} while (0)
@@ -137,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{\
- int len = RSTRING_LENINT(str);\
- int newlen = rb_long2int((p) - (unsigned char*)RSTRING_PTR(str));\
+ long len = RSTRING_LEN(str);\
+ long newlen = (long)((p) - (unsigned char*)RSTRING_PTR(str));\
assert(newlen <= len);\
rb_str_set_len((str), newlen);\
}while(0)
diff --git a/ext/openssl/ossl_asn1.c b/ext/openssl/ossl_asn1.c
index 6b4d523ee3..65ae71e861 100644
--- a/ext/openssl/ossl_asn1.c
+++ b/ext/openssl/ossl_asn1.c
@@ -495,7 +495,7 @@ typedef struct {
VALUE *klass;
} ossl_asn1_info_t;
-static ossl_asn1_info_t ossl_asn1_info[] = {
+static const ossl_asn1_info_t ossl_asn1_info[] = {
{ "EOC", &cASN1EndOfContent, }, /* 0 */
{ "BOOLEAN", &cASN1Boolean, }, /* 1 */
{ "INTEGER", &cASN1Integer, }, /* 2 */
@@ -529,7 +529,7 @@ static ossl_asn1_info_t ossl_asn1_info[] = {
{ "BMPSTRING", &cASN1BMPString, }, /* 30 */
};
-int ossl_asn1_info_size = (sizeof(ossl_asn1_info)/sizeof(ossl_asn1_info[0]));
+enum {ossl_asn1_info_size = (sizeof(ossl_asn1_info)/sizeof(ossl_asn1_info[0]))};
static VALUE class_tag_map;
@@ -624,8 +624,8 @@ ossl_asn1_default_tag(VALUE obj)
}
tmp_class = rb_class_superclass(tmp_class);
}
- ossl_raise(eASN1Error, "universal tag for %s not found",
- rb_class2name(CLASS_OF(obj)));
+ ossl_raise(eASN1Error, "universal tag for %"PRIsVALUE" not found",
+ rb_obj_class(obj));
return -1; /* dummy */
}
@@ -733,7 +733,7 @@ ossl_asn1data_initialize(VALUE self, VALUE value, VALUE tag, VALUE tag_class)
}
static VALUE
-join_der_i(VALUE i, VALUE str)
+join_der_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, str))
{
i = ossl_to_der_if_possible(i);
StringValue(i);
@@ -1150,7 +1150,7 @@ ossl_asn1_initialize(int argc, VALUE *argv, VALUE self)
}
if(!SYMBOL_P(tag_class))
ossl_raise(eASN1Error, "invalid tag class");
- if(SYM2ID(tagging) == sIMPLICIT && NUM2INT(tag) > 31)
+ if(!NIL_P(tagging) && SYM2ID(tagging) == sIMPLICIT && NUM2INT(tag) > 31)
ossl_raise(eASN1Error, "tag number for Universal too large");
}
else{
@@ -1358,6 +1358,17 @@ ossl_asn1cons_each(VALUE self)
return self;
}
+/*
+ * call-seq:
+ * 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 ASN1Error otherwise.
+ *
+ */
static VALUE
ossl_asn1obj_s_register(VALUE self, VALUE oid, VALUE sn, VALUE ln)
{
@@ -1371,6 +1382,14 @@ ossl_asn1obj_s_register(VALUE self, VALUE oid, VALUE sn, VALUE ln)
return Qtrue;
}
+/* Document-method: OpenSSL::ASN1::ObjectId#sn
+ *
+ * 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
+ */
static VALUE
ossl_asn1obj_get_sn(VALUE self)
{
@@ -1384,6 +1403,14 @@ ossl_asn1obj_get_sn(VALUE self)
return ret;
}
+/* Document-method: OpenSSL::ASN1::ObjectId#ln
+ *
+ * The long name of the ObjectId, as defined in +openssl/objects.h+.
+ */
+/* Document-method: OpenSSL::ASN1::ObjectId.long_name
+ *
+ * #long_name is an alias to #ln
+ */
static VALUE
ossl_asn1obj_get_ln(VALUE self)
{
@@ -1397,6 +1424,10 @@ ossl_asn1obj_get_ln(VALUE self)
return ret;
}
+/* Document-method: OpenSSL::ASN1::ObjectId#oid
+ *
+ * The object identifier as a String.
+ */
static VALUE
ossl_asn1obj_get_oid(VALUE self)
{
@@ -1778,6 +1809,10 @@ Init_ossl_asn1()
*
* == OpenSSL::ASN1::ObjectId
*
+ * 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.
+ *
* === Additional attributes
* * +sn+: the short name as defined in <openssl/objects.h>.
* * +ln+: the long name as defined in <openssl/objects.h>.
@@ -1917,6 +1952,10 @@ do{\
OSSL_ASN1_DEFINE_CLASS(EndOfContent, Data);
+ /* Document-class: OpenSSL::ASN1::ObjectId
+ *
+ * Represents the primitive object id for OpenSSL::ASN1
+ */
#if 0
cASN1ObjectId = rb_define_class_under(mASN1, "ObjectId", cASN1Primitive); /* let rdoc know */
#endif
diff --git a/ext/openssl/ossl_bio.c b/ext/openssl/ossl_bio.c
index a11c08c1a3..e150de0ad9 100644
--- a/ext/openssl/ossl_bio.c
+++ b/ext/openssl/ossl_bio.c
@@ -18,7 +18,7 @@ ossl_obj2bio(VALUE obj)
{
BIO *bio;
- if (TYPE(obj) == T_FILE) {
+ if (RB_TYPE_P(obj, T_FILE)) {
rb_io_t *fptr;
FILE *fp;
int fd;
diff --git a/ext/openssl/ossl_bn.c b/ext/openssl/ossl_bn.c
index 822b854efe..bdaf077b5f 100644
--- a/ext/openssl/ossl_bn.c
+++ b/ext/openssl/ossl_bn.c
@@ -106,6 +106,7 @@ ossl_bn_alloc(VALUE klass)
* 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
*/
@@ -120,6 +121,45 @@ ossl_bn_initialize(int argc, VALUE *argv, VALUE self)
base = NUM2INT(bs);
}
+ if (RB_TYPE_P(str, T_FIXNUM)) {
+ long i;
+ unsigned char bin[sizeof(long)];
+ long n = FIX2LONG(str);
+ unsigned long un = labs(n);
+
+ for (i = sizeof(long) - 1; 0 <= i; i--) {
+ bin[i] = un&0xff;
+ un >>= 8;
+ }
+
+ GetBN(self, bn);
+ if (!BN_bin2bn(bin, sizeof(bin), bn)) {
+ ossl_raise(eBNError, NULL);
+ }
+ if (n < 0) BN_set_negative(bn, 1);
+ return self;
+ }
+ else if (RB_TYPE_P(str, T_BIGNUM)) {
+ size_t len = rb_absint_size(str, NULL);
+ unsigned char *bin;
+ 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);
+
+ GetBN(self, bn);
+ if (!BN_bin2bn(bin, (int)len, bn)) {
+ ALLOCV_END(buf);
+ ossl_raise(eBNError, NULL);
+ }
+ ALLOCV_END(buf);
+ if (sign < 0) BN_set_negative(bn, 1);
+ return self;
+ }
if (RTEST(rb_obj_is_kind_of(str, cBN))) {
BIGNUM *other;
@@ -226,10 +266,10 @@ ossl_bn_to_i(VALUE self)
GetBN(self, bn);
- if (!(txt = BN_bn2dec(bn))) {
+ if (!(txt = BN_bn2hex(bn))) {
ossl_raise(eBNError, NULL);
}
- num = rb_cstr_to_inum(txt, 10, Qtrue);
+ num = rb_cstr_to_inum(txt, 16, Qtrue);
OPENSSL_free(txt);
return num;
diff --git a/ext/openssl/ossl_cipher.c b/ext/openssl/ossl_cipher.c
index 03374372ad..1cd185e69c 100644
--- a/ext/openssl/ossl_cipher.c
+++ b/ext/openssl/ossl_cipher.c
@@ -158,7 +158,7 @@ add_cipher_name_to_ary(const OBJ_NAME *name, VALUE ary)
#ifdef HAVE_OBJ_NAME_DO_ALL_SORTED
/*
* call-seq:
- * Cipher.ciphers -> array[string...]
+ * OpenSSL::Cipher.ciphers -> array[string...]
*
* Returns the names of all available ciphers in an array.
*/
@@ -183,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 en- or decryption tasks.
+ * Cipher instance may be used several times for encryption or decryption tasks.
*
* Internally calls EVP_CipherInit_ex(ctx, NULL, NULL, NULL, NULL, -1).
*/
@@ -213,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.
*/
- 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",
+ 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",
cname, cname, cname);
StringValue(pass);
GetCipher(self, ctx);
diff --git a/ext/openssl/ossl_config.c b/ext/openssl/ossl_config.c
index e700833076..140f5c3ad0 100644
--- a/ext/openssl/ossl_config.c
+++ b/ext/openssl/ossl_config.c
@@ -15,6 +15,11 @@
* Classes
*/
VALUE cConfig;
+/* Document-class: OpenSSL::ConfigError
+ *
+ * General error for openssl library configuration files. Including formatting,
+ * parsing errors, etc.
+ */
VALUE eConfigError;
/*
@@ -55,6 +60,10 @@ GetConfigPtr(VALUE obj)
return conf;
}
+/* Document-const: DEFAULT_CONFIG_FILE
+ *
+ * The default system configuration file for openssl
+ */
/*
* INIT
diff --git a/ext/openssl/ossl_digest.c b/ext/openssl/ossl_digest.c
index fdf13e98e5..7e5e7ff1ab 100644
--- a/ext/openssl/ossl_digest.c
+++ b/ext/openssl/ossl_digest.c
@@ -38,7 +38,7 @@ GetDigestPtr(VALUE obj)
const EVP_MD *md;
ASN1_OBJECT *oid = NULL;
- if (TYPE(obj) == T_STRING) {
+ if (RB_TYPE_P(obj, T_STRING)) {
const char *name = StringValueCStr(obj);
md = EVP_get_digestbyname(name);
diff --git a/ext/openssl/ossl_engine.c b/ext/openssl/ossl_engine.c
index f85454108a..f99a30dfc3 100644
--- a/ext/openssl/ossl_engine.c
+++ b/ext/openssl/ossl_engine.c
@@ -32,7 +32,18 @@
/*
* Classes
*/
+/* Document-class: OpenSSL::Engine
+ *
+ * This class is the access to openssl's ENGINE cryptographic module
+ * implementation.
+ *
+ * See also, https://www.openssl.org/docs/crypto/engine.html
+ */
VALUE cEngine;
+/* Document-class: OpenSSL::Engine::EngineError
+ *
+ * This is the generic exception for OpenSSL::Engine related errors
+ */
VALUE eEngineError;
/*
@@ -46,6 +57,17 @@ do{\
}\
}while(0)
+/* Document-method: OpenSSL::Engine.load
+ *
+ * call-seq:
+ * load(enginename = nil)
+ *
+ * This method loads engines. If +name+ is nil, then all builtin engines are
+ * loaded. Otherwise, the given +name+, as a string, is loaded if available to
+ * your runtime, and returns true. If +name+ is not found, then nil is
+ * returned.
+ *
+ */
static VALUE
ossl_engine_s_load(int argc, VALUE *argv, VALUE klass)
{
@@ -116,6 +138,15 @@ ossl_engine_s_load(int argc, VALUE *argv, VALUE klass)
#endif /* HAVE_ENGINE_LOAD_BUILTIN_ENGINES */
}
+/* Document-method: OpenSSL::Engine.cleanup
+ * call-seq:
+ * OpenSSL::Engine.cleanup
+ *
+ * It is only necessary to run cleanup when engines are loaded via
+ * OpenSSL::Engine.load. However, running cleanup before exit is recommended.
+ *
+ * See also, https://www.openssl.org/docs/crypto/engine.html
+ */
static VALUE
ossl_engine_s_cleanup(VALUE self)
{
@@ -125,6 +156,10 @@ ossl_engine_s_cleanup(VALUE self)
return Qnil;
}
+/* Document-method: OpenSSL::Engine.engines
+ *
+ * Returns an array of currently loaded engines.
+ */
static VALUE
ossl_engine_s_engines(VALUE klass)
{
@@ -144,6 +179,18 @@ ossl_engine_s_engines(VALUE klass)
return ary;
}
+/* Document-method: OpenSSL::Engine.by_id
+ *
+ * call-seq:
+ * by_id(name) -> engine
+ *
+ * Fetch the engine as specified by the +id+ String
+ *
+ * OpenSSL::Engine.by_id("openssl")
+ * => #<OpenSSL::Engine id="openssl" name="Software engine support">
+ *
+ * See OpenSSL::Engine.engines for the currently loaded engines
+ */
static VALUE
ossl_engine_s_by_id(VALUE klass, VALUE id)
{
@@ -179,6 +226,15 @@ ossl_engine_s_alloc(VALUE klass)
return obj;
}
+/* Document-method: OpenSSL::Engine#id
+ *
+ * Get the id for this engine
+ *
+ * OpenSSL::Engine.load
+ * OpenSSL::Engine.engines #=> [#<OpenSSL::Engine#>, ...]
+ * OpenSSL::Engine.engines.first.id
+ * #=> "rsax"
+ */
static VALUE
ossl_engine_get_id(VALUE self)
{
@@ -187,6 +243,16 @@ ossl_engine_get_id(VALUE self)
return rb_str_new2(ENGINE_get_id(e));
}
+/* Document-method: OpenSSL::Engine#name
+ *
+ * Get the descriptive name for this engine
+ *
+ * OpenSSL::Engine.load
+ * OpenSSL::Engine.engines #=> [#<OpenSSL::Engine#>, ...]
+ * OpenSSL::Engine.engines.first.name
+ * #=> "RSAX engine support"
+ *
+ */
static VALUE
ossl_engine_get_name(VALUE self)
{
@@ -195,6 +261,12 @@ ossl_engine_get_name(VALUE self)
return rb_str_new2(ENGINE_get_name(e));
}
+/* Document-method: OpenSSL::Engine#finish
+ *
+ * Releases all internal structural references for this engine.
+ *
+ * May raise an EngineError if the engine is unavailable
+ */
static VALUE
ossl_engine_finish(VALUE self)
{
@@ -207,6 +279,22 @@ ossl_engine_finish(VALUE self)
}
#if defined(HAVE_ENGINE_GET_CIPHER)
+/* Document-method: OpenSSL::Engine#cipher
+ *
+ * call-seq:
+ * engine.cipher(name) -> OpenSSL::Cipher
+ *
+ * This returns an OpenSSL::Cipher by +name+, if it is available in this
+ * engine.
+ *
+ * A EngineError will be raised if the cipher is unavailable.
+ *
+ * e = OpenSSL::Engine.by_id("openssl")
+ * => #<OpenSSL::Engine id="openssl" name="Software engine support">
+ * e.cipher("RC4")
+ * => #<OpenSSL::Cipher:0x007fc5cacc3048>
+ *
+ */
static VALUE
ossl_engine_get_cipher(VALUE self, VALUE name)
{
@@ -230,6 +318,22 @@ ossl_engine_get_cipher(VALUE self, VALUE name)
#endif
#if defined(HAVE_ENGINE_GET_DIGEST)
+/* Document-method: OpenSSL::Engine#digest
+ *
+ * call-seq:
+ * engine.digest(name) -> OpenSSL::Digest
+ *
+ * This returns an OpenSSL::Digest by +name+.
+ *
+ * Will raise an EngineError if the digest is unavailable.
+ *
+ * e = OpenSSL::Engine.by_id("openssl")
+ * #=> #<OpenSSL::Engine id="openssl" name="Software engine support">
+ * e.digest("SHA1")
+ * #=> #<OpenSSL::Digest: da39a3ee5e6b4b0d3255bfef95601890afd80709>
+ * e.digest("zomg")
+ * #=> OpenSSL::Engine::EngineError: no such digest `zomg'
+ */
static VALUE
ossl_engine_get_digest(VALUE self, VALUE name)
{
@@ -252,6 +356,16 @@ ossl_engine_get_digest(VALUE self, VALUE name)
#define ossl_engine_get_digest rb_f_notimplement
#endif
+/* Document-method: OpenSSL::Engine#load_private_key
+ *
+ * call-seq:
+ * engine.load_private_key(id = nil, data = nil) -> OpenSSL::PKey
+ *
+ * Loads the given private key by +id+ and +data+.
+ *
+ * An EngineError is raised of the OpenSSL::PKey is unavailable.
+ *
+ */
static VALUE
ossl_engine_load_privkey(int argc, VALUE *argv, VALUE self)
{
@@ -276,6 +390,16 @@ ossl_engine_load_privkey(int argc, VALUE *argv, VALUE self)
return obj;
}
+/* Document-method: OpenSSL::Engine#load_public_key
+ *
+ * call-seq:
+ * engine.load_public_key(id = nil, data = nil) -> OpenSSL::PKey
+ *
+ * Loads the given private key by +id+ and +data+.
+ *
+ * An EngineError is raised of the OpenSSL::PKey is unavailable.
+ *
+ */
static VALUE
ossl_engine_load_pubkey(int argc, VALUE *argv, VALUE self)
{
@@ -298,6 +422,23 @@ ossl_engine_load_pubkey(int argc, VALUE *argv, VALUE self)
return ossl_pkey_new(pkey);
}
+/* Document-method: OpenSSL::Engine#set_default
+ *
+ * call-seq:
+ * engine.set_default(flag)
+ *
+ * Set the defaults for this engine with the given +flag+.
+ *
+ * These flags are used to control combinations of algorithm methods.
+ *
+ * +flag+ can be one of the following, other flags are available depending on
+ * your OS.
+ *
+ * [All flags] 0xFFFF
+ * [No flags] 0x0000
+ *
+ * See also <openssl/engine.h>
+ */
static VALUE
ossl_engine_set_default(VALUE self, VALUE flag)
{
@@ -310,6 +451,15 @@ ossl_engine_set_default(VALUE self, VALUE flag)
return Qtrue;
}
+/* Document-method: OpenSSL::Engine#ctrl_cmd
+ *
+ * call-seq:
+ * engine.ctrl_cmd(command, value = nil) -> engine
+ *
+ * Send the given +command+ to this engine.
+ *
+ * Raises an EngineError if the +command+ fails.
+ */
static VALUE
ossl_engine_ctrl_cmd(int argc, VALUE *argv, VALUE self)
{
@@ -340,6 +490,10 @@ ossl_engine_cmd_flag_to_name(int flag)
}
}
+/* Document-method: OpenSSL::Engine#cmds
+ *
+ * Returns an array of command definitions for the current engine
+ */
static VALUE
ossl_engine_get_cmds(VALUE self)
{
@@ -362,21 +516,18 @@ ossl_engine_get_cmds(VALUE self)
return ary;
}
+/* Document-method: OpenSSL::Engine#inspect
+ *
+ * Pretty print this engine
+ */
static VALUE
ossl_engine_inspect(VALUE 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, " 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;
+ 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));
}
#define DefEngineConst(x) rb_define_const(cEngine, #x, INT2NUM(ENGINE_##x))
diff --git a/ext/openssl/ossl_hmac.c b/ext/openssl/ossl_hmac.c
index 5220c9e73d..b1e853dde3 100644
--- a/ext/openssl/ossl_hmac.c
+++ b/ext/openssl/ossl_hmac.c
@@ -62,6 +62,36 @@ ossl_hmac_alloc(VALUE klass)
* call-seq:
* HMAC.new(key, digest) -> hmac
*
+ * Returns an instance of OpenSSL::HMAC set with the key and digest
+ * algorithm to be used. The instance represents the initial state of
+ * the message authentication code before any data has been processed.
+ * To process data with it, use the instance method #update with your
+ * data as an argument.
+ *
+ * === Example
+ *
+ * key = 'key'
+ * digest = OpenSSL::Digest.new('sha1')
+ * instance = OpenSSL::HMAC.new(key, digest)
+ * #=> f42bb0eeb018ebbd4597ae7213711ec60760843f
+ * instance.class
+ * #=> OpenSSL::HMAC
+ *
+ * === A note about comparisons
+ *
+ * Two instances won't be equal when they're compared, even if they have the
+ * same value. Use #to_s or #hexdigest to return the authentication code that
+ * the instance represents. For example:
+ *
+ * other_instance = OpenSSL::HMAC.new('key', OpenSSL::Digest.new('sha1'))
+ * #=> f42bb0eeb018ebbd4597ae7213711ec60760843f
+ * instance
+ * #=> f42bb0eeb018ebbd4597ae7213711ec60760843f
+ * instance == other_instance
+ * #=> false
+ * instance.to_s == other_instance.to_s
+ * #=> true
+ *
*/
static VALUE
ossl_hmac_initialize(VALUE self, VALUE key, VALUE digest)
@@ -95,6 +125,19 @@ ossl_hmac_copy(VALUE self, VALUE other)
* call-seq:
* hmac.update(string) -> self
*
+ * Returns +self+ updated with the message to be authenticated.
+ * Can be called repeatedly with chunks of the message.
+ *
+ * === Example
+ *
+ * first_chunk = 'The quick brown fox jumps '
+ * second_chunk = 'over the lazy dog'
+ *
+ * instance.update(first_chunk)
+ * #=> 5b9a8038a65d571076d97fe783989e52278a492a
+ * instance.update(second_chunk)
+ * #=> de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9
+ *
*/
static VALUE
ossl_hmac_update(VALUE self, VALUE data)
@@ -125,7 +168,16 @@ hmac_final(HMAC_CTX *ctx, unsigned char **buf, unsigned int *buf_len)
/*
* call-seq:
- * hmac.digest -> aString
+ * hmac.digest -> string
+ *
+ * Returns the authentication code an instance represents as a binary string.
+ *
+ * === Example
+ *
+ * instance = OpenSSL::HMAC.new('key', OpenSSL::Digest.new('sha1'))
+ * #=> f42bb0eeb018ebbd4597ae7213711ec60760843f
+ * instance.digest
+ * #=> "\xF4+\xB0\xEE\xB0\x18\xEB\xBDE\x97\xAEr\x13q\x1E\xC6\a`\x84?"
*
*/
static VALUE
@@ -145,7 +197,10 @@ ossl_hmac_digest(VALUE self)
/*
* call-seq:
- * hmac.hexdigest -> aString
+ * hmac.hexdigest -> string
+ *
+ * Returns the authentication code an instance represents as a hex-encoded
+ * string.
*
*/
static VALUE
@@ -173,6 +228,20 @@ ossl_hmac_hexdigest(VALUE self)
* call-seq:
* hmac.reset -> self
*
+ * Returns +self+ as it was when it was first initialized, with all processed
+ * data cleared from it.
+ *
+ * === Example
+ *
+ * data = "The quick brown fox jumps over the lazy dog"
+ * instance = OpenSSL::HMAC.new('key', OpenSSL::Digest.new('sha1'))
+ * #=> f42bb0eeb018ebbd4597ae7213711ec60760843f
+ *
+ * instance.update(data)
+ * #=> de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9
+ * instance.reset
+ * #=> f42bb0eeb018ebbd4597ae7213711ec60760843f
+ *
*/
static VALUE
ossl_hmac_reset(VALUE self)
@@ -189,6 +258,18 @@ ossl_hmac_reset(VALUE self)
* call-seq:
* HMAC.digest(digest, key, data) -> aString
*
+ * Returns the authentication code as a binary string. The +digest+ parameter
+ * must be an instance of OpenSSL::Digest.
+ *
+ * === Example
+ *
+ * key = 'key'
+ * data = 'The quick brown fox jumps over the lazy dog'
+ * digest = OpenSSL::Digest.new('sha1')
+ *
+ * hmac = OpenSSL::HMAC.digest(digest, key, data)
+ * #=> "\xDE|\x9B\x85\xB8\xB7\x8A\xA6\xBC\x8Az6\xF7\n\x90p\x1C\x9D\xB4\xD9"
+ *
*/
static VALUE
ossl_hmac_s_digest(VALUE klass, VALUE digest, VALUE key, VALUE data)
@@ -206,7 +287,19 @@ ossl_hmac_s_digest(VALUE klass, VALUE digest, VALUE key, VALUE data)
/*
* call-seq:
- * HMAC.digest(digest, key, data) -> aString
+ * HMAC.hexdigest(digest, key, data) -> aString
+ *
+ * Returns the authentication code as a hex-encoded string. The +digest+
+ * parameter must be an instance of OpenSSL::Digest.
+ *
+ * === Example
+ *
+ * key = 'key'
+ * data = 'The quick brown fox jumps over the lazy dog'
+ * digest = OpenSSL::Digest.new('sha1')
+ *
+ * hmac = OpenSSL::HMAC.hexdigest(digest, key, data)
+ * #=> "de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9"
*
*/
static VALUE
@@ -237,6 +330,7 @@ void
Init_ossl_hmac()
{
#if 0
+ /* :nodoc: */
mOSSL = rb_define_module("OpenSSL"); /* let rdoc know about mOSSL */
#endif
@@ -265,6 +359,6 @@ Init_ossl_hmac()
void
Init_ossl_hmac()
{
- rb_warning("HMAC will NOT be avaible: OpenSSL is compiled without HMAC.");
+ rb_warning("HMAC is not available: OpenSSL is compiled without HMAC.");
}
#endif /* NO_HMAC */
diff --git a/ext/openssl/ossl_ocsp.c b/ext/openssl/ossl_ocsp.c
index e82c2d859a..c959379324 100644
--- a/ext/openssl/ossl_ocsp.c
+++ b/ext/openssl/ossl_ocsp.c
@@ -99,6 +99,15 @@ ossl_ocspreq_alloc(VALUE klass)
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)
{
@@ -121,6 +130,17 @@ 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)
{
@@ -143,18 +163,25 @@ ossl_ocspreq_add_nonce(int argc, VALUE *argv, VALUE self)
return self;
}
-/* 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.
+/*
+ * call-seq:
+ * request.check_nonce(response) -> result
+ *
+ * Checks the nonce validity for this request and +response+.
+ *
+ * The return value is one of the following:
*
- * 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.
+ * -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.
+ *
+ * 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.
*/
+
static VALUE
ossl_ocspreq_check_nonce(VALUE self, VALUE basic_resp)
{
@@ -169,6 +196,13 @@ 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)
{
@@ -183,6 +217,13 @@ ossl_ocspreq_add_certid(VALUE self, VALUE certid)
return self;
}
+/*
+ * call-seq:
+ * request.certid -> [certificate_id, ...]
+ *
+ * Returns all certificate IDs in this request.
+ */
+
static VALUE
ossl_ocspreq_get_certid(VALUE self)
{
@@ -206,6 +247,17 @@ ossl_ocspreq_get_certid(VALUE self)
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)
{
@@ -234,6 +286,14 @@ 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)
{
@@ -255,6 +315,10 @@ 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)
{
@@ -278,6 +342,13 @@ 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)
{
@@ -308,6 +379,15 @@ ossl_ocspres_alloc(VALUE klass)
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)
{
@@ -330,6 +410,13 @@ 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)
{
@@ -342,6 +429,13 @@ 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)
{
@@ -354,6 +448,13 @@ 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)
{
@@ -369,6 +470,13 @@ ossl_ocspres_get_basic(VALUE self)
return ret;
}
+/*
+ * call-seq:
+ * response.to_der -> String
+ *
+ * Returns this response as a DER-encoded string.
+ */
+
static VALUE
ossl_ocspres_to_der(VALUE self)
{
@@ -405,12 +513,27 @@ ossl_ocspbres_alloc(VALUE klass)
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)
{
@@ -425,6 +548,14 @@ 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)
{
@@ -447,6 +578,22 @@ 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 revoked, 1 for success) 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,
@@ -515,6 +662,16 @@ 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 success, 1 for revoked), 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)
{
@@ -560,6 +717,16 @@ 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)
{
@@ -590,6 +757,14 @@ 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)
{
@@ -627,6 +802,15 @@ ossl_ocspcid_alloc(VALUE klass)
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)
{
@@ -657,6 +841,13 @@ 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)
{
@@ -670,6 +861,14 @@ 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)
{
@@ -683,6 +882,13 @@ 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)
{
@@ -696,10 +902,130 @@ ossl_ocspcid_get_serial(VALUE self)
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);
@@ -711,6 +1037,11 @@ Init_ossl_ocsp()
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);
@@ -720,6 +1051,12 @@ Init_ossl_ocsp()
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);
@@ -730,6 +1067,11 @@ Init_ossl_ocsp()
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);
@@ -737,45 +1079,105 @@ Init_ossl_ocsp()
rb_define_method(cOCSPCertId, "cmp_issuer", ossl_ocspcid_cmp_issuer, 1);
rb_define_method(cOCSPCertId, "serial", ossl_ocspcid_get_serial, 0);
-#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);
+ /* 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));
}
#else /* ! OSSL_OCSP_ENABLED */
diff --git a/ext/openssl/ossl_pkcs7.c b/ext/openssl/ossl_pkcs7.c
index b710280c9c..bd5dc78947 100644
--- a/ext/openssl/ossl_pkcs7.c
+++ b/ext/openssl/ossl_pkcs7.c
@@ -362,9 +362,10 @@ ossl_pkcs7_sym2typeid(VALUE sym)
{
int i, ret = Qnil;
const char *s;
+ size_t l;
- static struct {
- const char *name;
+ static const struct {
+ char name[20];
int nid;
} p7_type_tab[] = {
{ "signed", NID_pkcs7_signed },
@@ -373,14 +374,15 @@ ossl_pkcs7_sym2typeid(VALUE sym)
{ "enveloped", NID_pkcs7_enveloped },
{ "encrypted", NID_pkcs7_encrypted },
{ "digest", NID_pkcs7_digest },
- { NULL, 0 },
};
- 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)
+ 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))
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;
@@ -624,7 +626,7 @@ pkcs7_get_crls(VALUE self)
}
static VALUE
-ossl_pkcs7_set_certs_i(VALUE i, VALUE arg)
+ossl_pkcs7_set_certs_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, arg))
{
return ossl_pkcs7_add_certificate(arg, i);
}
@@ -664,7 +666,7 @@ ossl_pkcs7_add_crl(VALUE self, VALUE crl)
}
static VALUE
-ossl_pkcs7_set_crls_i(VALUE i, VALUE arg)
+ossl_pkcs7_set_crls_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, arg))
{
return ossl_pkcs7_add_crl(arg, i);
}
diff --git a/ext/openssl/ossl_pkey.c b/ext/openssl/ossl_pkey.c
index 0004d9d9b5..878b221270 100644
--- a/ext/openssl/ossl_pkey.c
+++ b/ext/openssl/ossl_pkey.c
@@ -318,13 +318,16 @@ 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));
- switch (EVP_VerifyFinal(&ctx, (unsigned char *)RSTRING_PTR(sig), RSTRING_LENINT(sig), pkey)) {
+ result = EVP_VerifyFinal(&ctx, (unsigned char *)RSTRING_PTR(sig), RSTRING_LENINT(sig), pkey);
+ EVP_MD_CTX_cleanup(&ctx);
+ switch (result) {
case 0:
return Qfalse;
case 1:
diff --git a/ext/openssl/ossl_pkey_dh.c b/ext/openssl/ossl_pkey_dh.c
index c8fb40e1ff..011b6f00b4 100644
--- a/ext/openssl/ossl_pkey_dh.c
+++ b/ext/openssl/ossl_pkey_dh.c
@@ -278,7 +278,9 @@ ossl_dh_is_private(VALUE self)
/*
* call-seq:
+ * dh.export -> aString
* dh.to_pem -> aString
+ * dh.to_s -> aString
*
* Encodes this DH to its PEM encoding. Note that any existing per-session
* public/private keys will *not* get encoded, just the Diffie-Hellman
@@ -428,7 +430,7 @@ ossl_dh_to_public_key(VALUE self)
/*
* call-seq:
- * dh.check_params -> true | false
+ * dh.params_ok? -> true | false
*
* Validates the Diffie-Hellman parameters associated with this instance.
* It checks whether a safe prime and a suitable generator are used. If this
@@ -619,7 +621,7 @@ Init_ossl_dh()
*
* === Example of a key exchange
* dh1 = OpenSSL::PKey::DH.new(2048)
- * params = dh1.public_key.to_der #you may send this publicly to the participating party
+ * der = 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)
@@ -662,4 +664,3 @@ Init_ossl_dh()
{
}
#endif /* NO_DH */
-
diff --git a/ext/openssl/ossl_pkey_dsa.c b/ext/openssl/ossl_pkey_dsa.c
index ba28ba028d..823b9b66e5 100644
--- a/ext/openssl/ossl_pkey_dsa.c
+++ b/ext/openssl/ossl_pkey_dsa.c
@@ -291,7 +291,9 @@ ossl_dsa_is_private(VALUE self)
/*
* call-seq:
+ * dsa.export([cipher, password]) -> aString
* dsa.to_pem([cipher, password]) -> aString
+ * dsa.to_s([cipher, password]) -> aString
*
* Encodes this DSA to its PEM encoding.
*
diff --git a/ext/openssl/ossl_pkey_ec.c b/ext/openssl/ossl_pkey_ec.c
index 29e28ca2f4..5e419bd167 100644
--- a/ext/openssl/ossl_pkey_ec.c
+++ b/ext/openssl/ossl_pkey_ec.c
@@ -533,8 +533,8 @@ static VALUE ossl_ec_key_to_string(VALUE self, VALUE ciph, VALUE pass, int forma
/*
* call-seq:
- * key.export => String
- * key.export(cipher, pass_phrase) => String
+ * key.export([cipher, pass_phrase]) => String
+ * key.to_pem([cipher, pass_phrase]) => String
*
* Outputs the EC key in PEM encoding. If +cipher+ and +pass_phrase+ are
* given they will be used to encrypt the key. +cipher+ must be an
@@ -847,6 +847,7 @@ static VALUE ossl_ec_group_initialize(int argc, VALUE *argv, VALUE self)
}
/* call-seq:
+ * group1.eql?(group2) => true | false
* group1 == group2 => true | false
*
*/
@@ -1316,6 +1317,7 @@ static VALUE ossl_ec_point_initialize(int argc, VALUE *argv, VALUE self)
/*
* call-seq:
+ * point1.eql?(point2) => true | false
* point1 == point2 => true | false
*
*/
diff --git a/ext/openssl/ossl_pkey_rsa.c b/ext/openssl/ossl_pkey_rsa.c
index e395e7108f..4c346a042f 100644
--- a/ext/openssl/ossl_pkey_rsa.c
+++ b/ext/openssl/ossl_pkey_rsa.c
@@ -291,8 +291,9 @@ ossl_rsa_is_private(VALUE self)
/*
* call-seq:
- * rsa.to_pem => PEM-format String
- * rsa.to_pem(cipher, pass_phrase) => PEM-format String
+ * rsa.export([cipher, pass_phrase]) => PEM-format String
+ * rsa.to_pem([cipher, pass_phrase]) => PEM-format String
+ * rsa.to_s([cipher, pass_phrase]) => PEM-format String
*
* Outputs this keypair in PEM encoding. If +cipher+ and +pass_phrase+ are
* given they will be used to encrypt the key. +cipher+ must be an
diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c
index 62a37b6c5b..d37e51c857 100644
--- a/ext/openssl/ossl_ssl.c
+++ b/ext/openssl/ossl_ssl.c
@@ -29,6 +29,9 @@ VALUE eSSLError;
VALUE cSSLContext;
VALUE cSSLSocket;
+static VALUE eSSLErrorWaitReadable;
+static VALUE eSSLErrorWaitWritable;
+
#define ossl_sslctx_set_cert(o,v) rb_iv_set((o),"@cert",(v))
#define ossl_sslctx_set_key(o,v) rb_iv_set((o),"@key",(v))
#define ossl_sslctx_set_client_ca(o,v) rb_iv_set((o),"@client_ca",(v))
@@ -100,10 +103,12 @@ static const char *ossl_ssl_attrs[] = {
ID ID_callback_state;
+static VALUE sym_exception;
+
/*
* SSLContext class
*/
-struct {
+static const struct {
const char *name;
SSL_METHOD *(*func)(void);
} ossl_ssl_method_tab[] = {
@@ -185,7 +190,7 @@ ossl_sslctx_set_ssl_version(VALUE self, VALUE ssl_method)
int i;
SSL_CTX *ctx;
- if(TYPE(ssl_method) == T_SYMBOL)
+ if (RB_TYPE_P(ssl_method, T_SYMBOL))
s = rb_id2name(SYM2ID(ssl_method));
else
s = StringValuePtr(ssl_method);
@@ -418,7 +423,7 @@ ossl_sslctx_session_new_cb(SSL *ssl, SSL_SESSION *sess)
}
/*
- * return 0 which means to OpenSSL that the the session is still
+ * return 0 which means to OpenSSL that the session is still
* valid (since we created Ruby Session object) and was not freed by us
* with SSL_SESSION_free(). Call SSLContext#remove_session(sess) in
* session_get_cb block if you don't want OpenSSL to cache the session
@@ -472,7 +477,7 @@ ossl_sslctx_session_remove_cb(SSL_CTX *ctx, SSL_SESSION *sess)
}
static VALUE
-ossl_sslctx_add_extra_chain_cert_i(VALUE i, VALUE arg)
+ossl_sslctx_add_extra_chain_cert_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, arg))
{
X509 *x509;
SSL_CTX *ctx;
@@ -711,7 +716,7 @@ ossl_sslctx_setup(VALUE self)
val = ossl_sslctx_get_client_ca(self);
if(!NIL_P(val)){
- if(TYPE(val) == T_ARRAY){
+ if (RB_TYPE_P(val, T_ARRAY)) {
for(i = 0; i < RARRAY_LEN(val); i++){
client_ca = GetX509CertPtr(RARRAY_PTR(val)[i]);
if (!SSL_CTX_add_client_CA(ctx, client_ca)){
@@ -877,11 +882,11 @@ ossl_sslctx_set_ciphers(VALUE self, VALUE v)
rb_check_frozen(self);
if (NIL_P(v))
return v;
- else if (TYPE(v) == T_ARRAY) {
+ else if (RB_TYPE_P(v, T_ARRAY)) {
str = rb_str_new(0, 0);
for (i = 0; i < RARRAY_LEN(v); i++) {
elem = rb_ary_entry(v, i);
- if (TYPE(elem) == T_ARRAY) elem = rb_ary_entry(elem, 0);
+ if (RB_TYPE_P(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, ":");
@@ -1092,6 +1097,7 @@ ossl_sslctx_flush_sessions(int argc, VALUE *argv, VALUE self)
/*
* SSLSocket class
*/
+#ifndef OPENSSL_NO_SOCK
static void
ossl_ssl_shutdown(SSL *ssl)
{
@@ -1131,7 +1137,7 @@ ossl_ssl_s_alloc(VALUE klass)
* 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.
+ * IO-like object that responds to read/write).
*
* If +ctx+ is provided the SSL Sockets initial params will be taken from
* the context.
@@ -1229,8 +1235,7 @@ static void
write_would_block(int nonblock)
{
if (nonblock) {
- VALUE exc = ossl_exc_new(eSSLError, "write would block");
- rb_extend_object(exc, rb_mWaitWritable);
+ VALUE exc = ossl_exc_new(eSSLErrorWaitWritable, "write would block");
rb_exc_raise(exc);
}
}
@@ -1239,8 +1244,7 @@ static void
read_would_block(int nonblock)
{
if (nonblock) {
- VALUE exc = ossl_exc_new(eSSLError, "read would block");
- rb_extend_object(exc, rb_mWaitReadable);
+ VALUE exc = ossl_exc_new(eSSLErrorWaitReadable, "read would block");
rb_exc_raise(exc);
}
}
@@ -1371,10 +1375,16 @@ 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;
+
+ rb_scan_args(argc, argv, "11:", &len, &str, &opts);
+
+ if (!NIL_P(opts) && Qfalse == rb_hash_aref(opts, sym_exception))
+ no_exception = 1;
- rb_scan_args(argc, argv, "11", &len, &str);
ilen = NUM2INT(len);
if(NIL_P(str)) str = rb_str_new(0, ilen);
else{
@@ -1395,17 +1405,23 @@ 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) { return Qnil; }
rb_eof_error();
case SSL_ERROR_WANT_WRITE:
+ 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) { 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) rb_eof_error();
+ if(ERR_peek_error() == 0 && nread == 0) {
+ if (no_exception) { return Qnil; }
+ rb_eof_error();
+ }
rb_sys_fail(0);
default:
ossl_raise(eSSLError, "SSL_read");
@@ -1415,7 +1431,11 @@ 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.");
- return rb_funcall(ossl_ssl_get_io(self), meth, 2, len, str);
+ 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);
+ }
}
end:
@@ -1443,9 +1463,11 @@ ossl_ssl_read(int argc, VALUE *argv, VALUE self)
* call-seq:
* ssl.sysread_nonblock(length) => string
* ssl.sysread_nonblock(length, buffer) => buffer
+ * ssl.sysread_nonblock(length[, buffer [, opts]) => buffer
*
* A non-blocking version of #sysread. Raises an SSLError if reading would
- * block.
+ * block. If "exception: false" is passed, this method returns a symbol of
+ * :wait_readable, :wait_writable, or nil, rather than raising an exception.
*
* Reads +length+ bytes from the SSL connection. If a pre-allocated +buffer+
* is provided the data will be written into it.
@@ -1457,7 +1479,7 @@ ossl_ssl_read_nonblock(int argc, VALUE *argv, VALUE self)
}
static VALUE
-ossl_ssl_write_internal(VALUE self, VALUE str, int nonblock)
+ossl_ssl_write_internal(VALUE self, VALUE str, int nonblock, int no_exception)
{
SSL *ssl;
int nwrite = 0;
@@ -1474,10 +1496,12 @@ ossl_ssl_write_internal(VALUE self, VALUE str, int nonblock)
case SSL_ERROR_NONE:
goto end;
case SSL_ERROR_WANT_WRITE:
+ 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) { return ID2SYM(rb_intern("wait_readable")); }
read_would_block(nonblock);
rb_io_wait_readable(FPTR_TO_FD(fptr));
continue;
@@ -1507,7 +1531,7 @@ ossl_ssl_write_internal(VALUE self, VALUE str, int nonblock)
static VALUE
ossl_ssl_write(VALUE self, VALUE str)
{
- return ossl_ssl_write_internal(self, str, 0);
+ return ossl_ssl_write_internal(self, str, 0, 0);
}
/*
@@ -1518,9 +1542,18 @@ ossl_ssl_write(VALUE self, VALUE str)
* SSLError if writing would block.
*/
static VALUE
-ossl_ssl_write_nonblock(VALUE self, VALUE str)
+ossl_ssl_write_nonblock(int argc, VALUE *argv, VALUE self)
{
- return ossl_ssl_write_internal(self, str, 1);
+ VALUE str;
+ VALUE opts = Qnil;
+ int no_exception = 0;
+
+ rb_scan_args(argc, argv, "1:", &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);
}
/*
@@ -1533,18 +1566,22 @@ static VALUE
ossl_ssl_close(VALUE self)
{
SSL *ssl;
+ VALUE io;
- ossl_ssl_data_get_struct(self, ssl);
+ /* ossl_ssl_data_get_struct() is not usable here because it may return
+ * from this function; */
- 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);
- }
+ Data_Get_Struct(self, SSL, ssl);
+
+ io = ossl_ssl_get_io(self);
+ if (!RTEST(rb_funcall(io, rb_intern("closed?"), 0))) {
+ if (ssl) {
+ 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;
@@ -1633,7 +1670,7 @@ ossl_ssl_get_peer_cert_chain(VALUE self)
/*
* call-seq:
-* ssl.version => String
+* ssl.ssl_version => String
*
* Returns a String representing the SSL/TLS version that was negotiated
* for the connection, for example "TLSv1.2".
@@ -1794,7 +1831,7 @@ ossl_ssl_get_client_ca_list(VALUE self)
return ossl_x509name_sk2ary(ca);
}
-#ifdef HAVE_OPENSSL_NPN_NEGOTIATED
+# ifdef HAVE_OPENSSL_NPN_NEGOTIATED
/*
* call-seq:
* ssl.npn_protocol => String
@@ -1817,7 +1854,8 @@ ossl_ssl_npn_protocol(VALUE self)
else
return rb_str_new((const char *) out, outlen);
}
-#endif
+# endif
+#endif /* !defined(OPENSSL_NO_SOCK) */
void
Init_ossl_ssl()
@@ -1852,6 +1890,10 @@ Init_ossl_ssl()
* Generic error class raised by SSLSocket and SSLContext.
*/
eSSLError = rb_define_class_under(mSSL, "SSLError", eOSSLError);
+ eSSLErrorWaitReadable = rb_define_class_under(mSSL, "SSLErrorWaitReadable", eSSLError);
+ rb_include_module(eSSLErrorWaitReadable, rb_mWaitReadable);
+ eSSLErrorWaitWritable = rb_define_class_under(mSSL, "SSLErrorWaitWritable", eSSLError);
+ rb_include_module(eSSLErrorWaitWritable, rb_mWaitWritable);
Init_ossl_ssl_session();
@@ -1970,7 +2012,7 @@ Init_ossl_ssl()
/*
* Sets the context in which a session can be reused. This allows
- * sessions for multiple applications to be distinguished, for exapmle, by
+ * sessions for multiple applications to be distinguished, for example, by
* name.
*/
rb_attr(cSSLContext, rb_intern("session_id_context"), 1, 1, Qfalse);
@@ -1985,7 +2027,7 @@ Init_ossl_ssl()
rb_attr(cSSLContext, rb_intern("session_get_cb"), 1, 1, Qfalse);
/*
- * A callback invoked when a new session was negotiatied.
+ * A callback invoked when a new session was negotiated.
*
* The callback is invoked with an SSLSocket. If false is returned the
* session will be removed from the internal cache.
@@ -2144,6 +2186,9 @@ Init_ossl_ssl()
*
*/
cSSLSocket = rb_define_class_under(mSSL, "SSLSocket", rb_cObject);
+#ifdef OPENSSL_NO_SOCK
+ rb_define_method(cSSLSocket, "initialize", rb_notimplement, -1);
+#else
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);
@@ -2158,7 +2203,7 @@ Init_ossl_ssl()
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, "syswrite_nonblock", ossl_ssl_write_nonblock, -1);
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);
@@ -2172,8 +2217,9 @@ Init_ossl_ssl()
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_OPENSSL_NPN_NEGOTIATED
+# 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, INT2NUM(SSL_##x))
@@ -2191,7 +2237,9 @@ Init_ossl_ssl()
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);
@@ -2228,4 +2276,6 @@ Init_ossl_ssl()
ossl_ssl_def_const(OP_PKCS1_CHECK_2);
ossl_ssl_def_const(OP_NETSCAPE_CA_DN_BUG);
ossl_ssl_def_const(OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG);
+
+ sym_exception = ID2SYM(rb_intern("exception"));
}
diff --git a/ext/openssl/ossl_x509attr.c b/ext/openssl/ossl_x509attr.c
index 1f36ca8b12..d50f88c969 100644
--- a/ext/openssl/ossl_x509attr.c
+++ b/ext/openssl/ossl_x509attr.c
@@ -165,8 +165,8 @@ ossl_x509attr_get_oid(VALUE self)
# define OSSL_X509ATTR_IS_SINGLE(attr) ((attr)->single)
# define OSSL_X509ATTR_SET_SINGLE(attr) ((attr)->single = 1)
#else
-# define OSSL_X509ATTR_IS_SINGLE(attr) (!(attr)->set)
-# define OSSL_X509ATTR_SET_SINGLE(attr) ((attr)->set = 0)
+# define OSSL_X509ATTR_IS_SINGLE(attr) (!(attr)->value.set)
+# define OSSL_X509ATTR_SET_SINGLE(attr) ((attr)->value.set = 0)
#endif
/*
diff --git a/ext/openssl/ossl_x509cert.c b/ext/openssl/ossl_x509cert.c
index 84cedc763a..85bbc0d081 100644
--- a/ext/openssl/ossl_x509cert.c
+++ b/ext/openssl/ossl_x509cert.c
@@ -693,35 +693,15 @@ ossl_x509_add_extension(VALUE self, VALUE extension)
static VALUE
ossl_x509_inspect(VALUE 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;
+ 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));
}
/*
diff --git a/ext/openssl/ossl_x509name.c b/ext/openssl/ossl_x509name.c
index 4b397055ab..be70dc1b12 100644
--- a/ext/openssl/ossl_x509name.c
+++ b/ext/openssl/ossl_x509name.c
@@ -92,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(VALUE i, VALUE args)
+ossl_x509name_init_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, args))
{
VALUE self = rb_ary_entry(args, 0);
VALUE template = rb_ary_entry(args, 1);
@@ -183,13 +183,14 @@ 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);
- StringValue(oid);
+ oid_name = StringValueCStr(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, RSTRING_PTR(oid), NUM2INT(type),
+ if (!X509_NAME_add_entry_by_txt(name, oid_name, NUM2INT(type),
(const unsigned char *)RSTRING_PTR(value), RSTRING_LENINT(value), -1, 0)) {
ossl_raise(eX509NameError, NULL);
}
@@ -459,7 +460,7 @@ Init_ossl_x509name()
*/
rb_define_const(cX509Name, "DEFAULT_OBJECT_TYPE", utf8str);
hash = rb_hash_new();
- RHASH(hash)->ifnone = utf8str;
+ RHASH_SET_IFNONE(hash, utf8str);
rb_hash_aset(hash, rb_str_new2("C"), ptrstr);
rb_hash_aset(hash, rb_str_new2("countryName"), ptrstr);
rb_hash_aset(hash, rb_str_new2("serialNumber"), ptrstr);
diff --git a/ext/openssl/ossl_x509store.c b/ext/openssl/ossl_x509store.c
index 5e3094ee9f..f59c376574 100644
--- a/ext/openssl/ossl_x509store.c
+++ b/ext/openssl/ossl_x509store.c
@@ -135,9 +135,9 @@ ossl_x509store_initialize(int argc, VALUE *argv, VALUE self)
ossl_x509store_set_vfy_cb(self, Qnil);
#if (OPENSSL_VERSION_NUMBER < 0x00907000L)
- rb_iv_set(self, "@flags", INT2NUM(0));
- rb_iv_set(self, "@purpose", INT2NUM(0));
- rb_iv_set(self, "@trust", INT2NUM(0));
+ rb_iv_set(self, "@flags", INT2FIX(0));
+ rb_iv_set(self, "@purpose", INT2FIX(0));
+ rb_iv_set(self, "@trust", INT2FIX(0));
#endif
/* last verification status */
@@ -257,7 +257,7 @@ ossl_x509store_add_path(VALUE self, VALUE dir)
/*
* call-seq:
- * store.set_default_path
+ * store.set_default_paths
*
* Adds the default certificates to the certificate store. These certificates
* are loaded from the default configuration directory which can usually be
diff --git a/ext/pathname/depend b/ext/pathname/depend
new file mode 100644
index 0000000000..79b6c53f50
--- /dev/null
+++ b/ext/pathname/depend
@@ -0,0 +1,3 @@
+$(OBJS): $(HDRS) $(ruby_headers) \
+ $(hdrdir)/ruby/encoding.h \
+ $(hdrdir)/ruby/oniguruma.h
diff --git a/ext/pathname/extconf.rb b/ext/pathname/extconf.rb
index 6720903e88..037f10065d 100644
--- a/ext/pathname/extconf.rb
+++ b/ext/pathname/extconf.rb
@@ -1,2 +1,3 @@
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 46fa72b784..82541e9b15 100644
--- a/ext/pathname/lib/pathname.rb
+++ b/ext/pathname/lib/pathname.rb
@@ -22,7 +22,8 @@ class Pathname
end
SAME_PATHS = if File::FNM_SYSCASE.nonzero?
- proc {|a, b| a.casecmp(b).zero?}
+ # Avoid #zero? here because #casecmp can return nil.
+ proc {|a, b| a.casecmp(b) == 0}
else
proc {|a, b| a == b}
end
@@ -113,6 +114,7 @@ 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
@@ -161,6 +163,7 @@ 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
@@ -324,12 +327,17 @@ 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
@@ -384,7 +392,7 @@ class Pathname
# #=> true
#
def join(*args)
- args.unshift self
+ return self if args.empty?
result = args.pop
result = Pathname.new(result) unless Pathname === result
return result if result.absolute?
@@ -393,7 +401,7 @@ class Pathname
result = arg + result
return result if result.absolute?
}
- result
+ self + result
end
#
@@ -534,13 +542,13 @@ class Pathname # * Find *
#
# See Find.find
#
- def find # :yield: pathname
- return to_enum(__method__) unless block_given?
+ def find(ignore_error: true) # :yield: pathname
+ return to_enum(__method__, ignore_error: ignore_error) unless block_given?
require 'find'
if @path == '.'
- Find.find(@path) {|f| yield self.class.new(f.sub(%r{\A\./}, '')) }
+ Find.find(@path, ignore_error: ignore_error) {|f| yield self.class.new(f.sub(%r{\A\./}, '')) }
else
- Find.find(@path) {|f| yield self.class.new(f) }
+ Find.find(@path, ignore_error: ignore_error) {|f| yield self.class.new(f) }
end
end
end
diff --git a/ext/pathname/pathname.c b/ext/pathname/pathname.c
index 2bb6ce2f3c..7c24598759 100644
--- a/ext/pathname/pathname.c
+++ b/ext/pathname/pathname.c
@@ -183,7 +183,7 @@ path_inspect(VALUE self)
{
const char *c = rb_obj_classname(self);
VALUE str = get_strpath(self);
- return rb_sprintf("#<%s:%s>", c, RSTRING_PTR(str));
+ return rb_sprintf("#<%s:%"PRIsVALUE">", c, str);
}
/*
@@ -346,6 +346,48 @@ path_binread(int argc, VALUE *argv, VALUE self)
/*
* call-seq:
+ * pathname.write(string, [offset] ) => fixnum
+ * pathname.write(string, [offset], open_args ) => fixnum
+ *
+ * Writes +contents+ to the file.
+ *
+ * See IO.write.
+ *
+ */
+static VALUE
+path_write(int argc, VALUE *argv, VALUE self)
+{
+ VALUE args[4];
+ int n;
+
+ args[0] = get_strpath(self);
+ n = rb_scan_args(argc, argv, "03", &args[1], &args[2], &args[3]);
+ return rb_funcall2(rb_cIO, rb_intern("write"), 1+n, args);
+}
+
+/*
+ * call-seq:
+ * pathname.binwrite(string, [offset] ) => fixnum
+ * pathname.binwrite(string, [offset], open_args ) => fixnum
+ *
+ * Writes +contents+ to the file, opening it in binary mode.
+ *
+ * See IO.binwrite.
+ *
+ */
+static VALUE
+path_binwrite(int argc, VALUE *argv, VALUE self)
+{
+ VALUE args[4];
+ int n;
+
+ args[0] = get_strpath(self);
+ n = rb_scan_args(argc, argv, "03", &args[1], &args[2], &args[3]);
+ return rb_funcall2(rb_cIO, rb_intern("binwrite"), 1+n, args);
+}
+
+/*
+ * call-seq:
* pathname.readlines(sep=$/ [, open_args]) -> array
* pathname.readlines(limit [, open_args]) -> array
* pathname.readlines(sep, limit [, open_args]) -> array
@@ -398,6 +440,25 @@ 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, returns <i>ctime</i>.
+ *
+ * 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
@@ -926,7 +987,7 @@ path_zero_p(VALUE self)
}
static VALUE
-glob_i(VALUE elt, VALUE klass, int argc, VALUE *argv)
+glob_i(RB_BLOCK_CALL_FUNC_ARGLIST(elt, klass))
{
return rb_yield(rb_class_new_instance(1, &elt, klass));
}
@@ -955,7 +1016,7 @@ path_s_glob(int argc, VALUE *argv, VALUE klass)
ary = rb_funcall2(rb_cDir, rb_intern("glob"), n, args);
ary = rb_convert_type(ary, T_ARRAY, "Array", "to_ary");
for (i = 0; i < RARRAY_LEN(ary); i++) {
- VALUE elt = RARRAY_PTR(ary)[i];
+ VALUE elt = RARRAY_AREF(ary, i);
elt = rb_class_new_instance(1, &elt, klass);
rb_ary_store(ary, i, elt);
}
@@ -1015,7 +1076,7 @@ path_entries(VALUE self)
ary = rb_funcall(rb_cDir, rb_intern("entries"), 1, str);
ary = rb_convert_type(ary, T_ARRAY, "Array", "to_ary");
for (i = 0; i < RARRAY_LEN(ary); i++) {
- VALUE elt = RARRAY_PTR(ary)[i];
+ VALUE elt = RARRAY_AREF(ary, i);
elt = rb_class_new_instance(1, &elt, klass);
rb_ary_store(ary, i, elt);
}
@@ -1064,7 +1125,7 @@ path_opendir(VALUE self)
}
static VALUE
-each_entry_i(VALUE elt, VALUE klass, int argc, VALUE *argv)
+each_entry_i(RB_BLOCK_CALL_FUNC_ARGLIST(elt, klass))
{
return rb_yield(rb_class_new_instance(1, &elt, klass));
}
@@ -1107,7 +1168,20 @@ path_unlink(VALUE self)
}
/*
- * Creates a new Pathname object.
+ * :call-seq:
+ * Pathname(path) -> pathname
+ *
+ * Creates a new Pathname object from the given string, +path+, and returns
+ * pathname object.
+ *
+ * In order to use this constructor, you must first require the Pathname
+ * standard library extension.
+ *
+ * require 'pathname'
+ * Pathname("/home/zzak")
+ * #=> #<Pathname:/home/zzak>
+ *
+ * See also Pathname::new for more information.
*/
static VALUE
path_f_pathname(VALUE self, VALUE str)
@@ -1233,6 +1307,7 @@ path_f_pathname(VALUE self, VALUE str)
*
* These methods are a facade for File:
* - #atime
+ * - #birthtime
* - #ctime
* - #mtime
* - #chmod(mode)
@@ -1321,8 +1396,11 @@ Init_pathname()
rb_define_method(rb_cPathname, "read", path_read, -1);
rb_define_method(rb_cPathname, "binread", path_binread, -1);
rb_define_method(rb_cPathname, "readlines", path_readlines, -1);
+ rb_define_method(rb_cPathname, "write", path_write, -1);
+ 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/depend b/ext/psych/depend
new file mode 100644
index 0000000000..79b6c53f50
--- /dev/null
+++ b/ext/psych/depend
@@ -0,0 +1,3 @@
+$(OBJS): $(HDRS) $(ruby_headers) \
+ $(hdrdir)/ruby/encoding.h \
+ $(hdrdir)/ruby/oniguruma.h
diff --git a/ext/psych/lib/psych.rb b/ext/psych/lib/psych.rb
index e9571b7414..40fcf610e2 100644
--- a/ext/psych/lib/psych.rb
+++ b/ext/psych/lib/psych.rb
@@ -14,13 +14,14 @@ 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 [Git repo: https://github.com/zerotao/libyaml] for its YAML parsing
+# or [HG repo: https://bitbucket.org/xi/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.
@@ -41,16 +42,74 @@ require 'psych/handlers/document_stream'
# Psych provides a range of interfaces for parsing a YAML document ranging from
# low level to high level, depending on your parsing needs. At the lowest
# level, is an event based parser. Mid level is access to the raw YAML AST,
-# and at the highest level is the ability to unmarshal YAML to ruby objects.
+# and at the highest level is the ability to unmarshal YAML to Ruby objects.
#
-# === Low level parsing
+# == YAML Emitting
#
-# The lowest level parser should be used when the YAML input is already known,
-# and the developer does not want to pay the price of building an AST or
-# automatic detection and conversion to ruby objects. See Psych::Parser for
-# more information on using the event based parser.
+# Psych provides a range of interfaces ranging from low to high level for
+# producing YAML documents. Very similar to the YAML parsing interfaces, Psych
+# provides at the lowest level, an event based system, mid-level is building
+# a YAML AST, and the highest level is converting a Ruby object straight to
+# a YAML document.
+#
+# == High-level API
+#
+# === Parsing
+#
+# The high level YAML parser provided by Psych simply takes YAML as input and
+# returns a Ruby data structure. For information on using the high level parser
+# see Psych.load
+#
+# ==== Reading from a string
+#
+# Psych.load("--- a") # => 'a'
+# Psych.load("---\n - a\n - b") # => ['a', 'b']
+#
+# ==== Reading from a file
+#
+# Psych.load_file("database.yml")
+#
+# ==== Exception handling
+#
+# begin
+# # The second argument changes only the exception contents
+# Psych.parse("--- `", "file.txt")
+# rescue Psych::SyntaxError => ex
+# ex.file # => 'file.txt'
+# ex.message # => "(file.txt): found character that cannot start any token"
+# end
+#
+# === Emitting
+#
+# The high level emitter has the easiest interface. Psych simply takes a Ruby
+# data structure and converts it to a YAML document. See Psych.dump for more
+# information on dumping a Ruby data structure.
+#
+# ==== Writing to a string
+#
+# # Dump an array, get back a YAML string
+# Psych.dump(['a', 'b']) # => "---\n- a\n- b\n"
+#
+# # Dump an array to an IO object
+# Psych.dump(['a', 'b'], StringIO.new) # => #<StringIO:0x000001009d0890>
+#
+# # Dump an array with indentation set
+# Psych.dump(['a', ['b']], :indentation => 3) # => "---\n- a\n- - b\n"
+#
+# # Dump an array to an IO with indentation set
+# Psych.dump(['a', ['b']], StringIO.new, :indentation => 3)
+#
+# ==== Writing to a file
#
-# === Mid level parsing
+# Currently there is no direct API for dumping Ruby structure to file:
+#
+# File.open('database.yml', 'w') do |file|
+# file.write(Psych.dump(['a', 'b']))
+# end
+#
+# == Mid-level API
+#
+# === Parsing
#
# Psych provides access to an AST produced from parsing a YAML document. This
# tree is built using the Psych::Parser and Psych::TreeBuilder. The AST can
@@ -58,28 +117,33 @@ require 'psych/handlers/document_stream'
# Psych::Nodes, and Psych::Nodes::Node for more information on dealing with
# YAML syntax trees.
#
-# === High level parsing
+# ==== Reading from a string
#
-# The high level YAML parser provided by Psych simply takes YAML as input and
-# returns a Ruby data structure. For information on using the high level parser
-# see Psych.load
+# # Returns Psych::Nodes::Stream
+# Psych.parse_stream("---\n - a\n - b")
#
-# == YAML Emitting
+# # Returns Psych::Nodes::Document
+# Psych.parse("---\n - a\n - b")
#
-# Psych provides a range of interfaces ranging from low to high level for
-# producing YAML documents. Very similar to the YAML parsing interfaces, Psych
-# provides at the lowest level, an event based system, mid-level is building
-# a YAML AST, and the highest level is converting a Ruby object straight to
-# a YAML document.
+# ==== Reading from a file
#
-# === Low level emitting
+# # Returns Psych::Nodes::Stream
+# Psych.parse_stream(File.read('database.yml'))
#
-# The lowest level emitter is an event based system. Events are sent to a
-# Psych::Emitter object. That object knows how to convert the events to a YAML
-# document. This interface should be used when document format is known in
-# advance or speed is a concern. See Psych::Emitter for more information.
+# # Returns Psych::Nodes::Document
+# Psych.parse_file('database.yml')
+#
+# ==== Exception handling
+#
+# begin
+# # The second argument changes only the exception contents
+# Psych.parse("--- `", "file.txt")
+# rescue Psych::SyntaxError => ex
+# ex.file # => 'file.txt'
+# ex.message # => "(file.txt): found character that cannot start any token"
+# end
#
-# === Mid level emitting
+# === Emitting
#
# At the mid level is building an AST. This AST is exactly the same as the AST
# used when parsing a YAML document. Users can build an AST by hand and the
@@ -87,25 +151,77 @@ require 'psych/handlers/document_stream'
# Psych::Nodes::Node, and Psych::TreeBuilder for more information on building
# a YAML AST.
#
-# === High level emitting
+# ==== Writing to a string
#
-# The high level emitter has the easiest interface. Psych simply takes a Ruby
-# data structure and converts it to a YAML document. See Psych.dump for more
-# information on dumping a Ruby data structure.
+# # We need Psych::Nodes::Stream (not Psych::Nodes::Document)
+# stream = Psych.parse_stream("---\n - a\n - b")
+#
+# stream.to_yaml # => "---\n- a\n- b\n"
+#
+# ==== Writing to a file
+#
+# # We need Psych::Nodes::Stream (not Psych::Nodes::Document)
+# stream = Psych.parse_stream(File.read('database.yml'))
+#
+# File.open('database.yml', 'w') do |file|
+# file.write(stream.to_yaml)
+# end
+#
+# == Low-level API
+#
+# === Parsing
+#
+# The lowest level parser should be used when the YAML input is already known,
+# and the developer does not want to pay the price of building an AST or
+# automatic detection and conversion to Ruby objects. See Psych::Parser for
+# more information on using the event based parser.
+#
+# ==== Reading to Psych::Nodes::Stream structure
+#
+# parser = Psych::Parser.new(TreeBuilder.new) # => #<Psych::Parser>
+# parser = Psych.parser # it's an alias for the above
+#
+# parser.parse("---\n - a\n - b") # => #<Psych::Parser>
+# parser.handler # => #<Psych::TreeBuilder>
+# parser.handler.root # => #<Psych::Nodes::Stream>
+#
+# ==== Receiving an events stream
+#
+# parser = Psych::Parser.new(Psych::Handlers::Recorder.new)
+#
+# parser.parse("---\n - a\n - b")
+# parser.events # => [list of [event, args] lists]
+# # event is one of: Psych::Handler::EVENTS
+# # args are the arguments passed to the event
+#
+# === Emitting
+#
+# The lowest level emitter is an event based system. Events are sent to a
+# Psych::Emitter object. That object knows how to convert the events to a YAML
+# document. This interface should be used when document format is known in
+# advance or speed is a concern. See Psych::Emitter for more information.
+#
+# ==== Writing to a Ruby structure
+#
+# Psych.parser.parse("--- a") # => #<Psych::Parser>
+#
+# parser.handler.first # => #<Psych::Nodes::Stream>
+# parser.handler.first.to_ruby # => ["a"]
+#
+# parser.handler.root.first # => #<Psych::Nodes::Document>
+# parser.handler.root.first.to_ruby # => "a"
+#
+# # You can instantiate an Emitter manually
+# Psych::Visitors::ToRuby.new.accept(parser.handler.root.first)
+# # => "a"
module Psych
# The version is Psych you're using
- VERSION = '2.0.0'
+ VERSION = '2.0.6'
# The version of libyaml Psych is using
LIBYAML_VERSION = Psych.libyaml_version.join '.'
- class Exception < RuntimeError
- end
-
- class BadAlias < Exception
- end
-
###
# Load +yaml+ in to a Ruby data structure. If multiple documents are
# provided, the object contained in the first document will be returned.
@@ -131,7 +247,56 @@ module Psych
end
###
- # Parse a YAML string in +yaml+. Returns the first object of a YAML AST.
+ # Safely load the yaml string in +yaml+. By default, only the following
+ # classes are allowed to be deserialized:
+ #
+ # * TrueClass
+ # * FalseClass
+ # * NilClass
+ # * Numeric
+ # * String
+ # * Array
+ # * Hash
+ #
+ # Recursive data structures are not allowed by default. Arbitrary classes
+ # can be allowed by adding those classes to the +whitelist+. They are
+ # additive. For example, to allow Date deserialization:
+ #
+ # Psych.safe_load(yaml, [Date])
+ #
+ # Now the Date class can be loaded in addition to the classes listed above.
+ #
+ # Aliases can be explicitly allowed by changing the +aliases+ parameter.
+ # For example:
+ #
+ # x = []
+ # x << x
+ # yaml = Psych.dump x
+ # Psych.safe_load yaml # => raises an exception
+ # Psych.safe_load yaml, [], [], true # => loads the aliases
+ #
+ # A Psych::DisallowedClass exception will be raised if the yaml contains a
+ # class that isn't in the whitelist.
+ #
+ # A Psych::BadAlias exception will be raised if the yaml contains aliases
+ # but the +aliases+ parameter is set to false.
+ def self.safe_load yaml, whitelist_classes = [], whitelist_symbols = [], aliases = false, filename = nil
+ result = parse(yaml, filename)
+ return unless result
+
+ class_loader = ClassLoader::Restricted.new(whitelist_classes.map(&:to_s),
+ whitelist_symbols.map(&:to_s))
+ scanner = ScalarScanner.new class_loader
+ if aliases
+ visitor = Visitors::ToRuby.new scanner, class_loader
+ else
+ visitor = Visitors::NoAliasRuby.new scanner, class_loader
+ end
+ visitor.accept result
+ end
+
+ ###
+ # Parse a YAML string in +yaml+. Returns the Psych::Nodes::Document.
# +filename+ is used in the exception message if a Psych::SyntaxError is
# raised.
#
@@ -139,7 +304,7 @@ module Psych
#
# Example:
#
- # Psych.parse("---\n - a\n - b") # => #<Psych::Nodes::Sequence:0x00>
+ # Psych.parse("---\n - a\n - b") # => #<Psych::Nodes::Document:0x00>
#
# begin
# Psych.parse("--- `", "file.txt")
@@ -157,7 +322,7 @@ module Psych
end
###
- # Parse a file at +filename+. Returns the YAML AST.
+ # Parse a file at +filename+. Returns the Psych::Nodes::Document.
#
# Raises a Psych::SyntaxError when a YAML syntax error is detected.
def self.parse_file filename
@@ -173,7 +338,7 @@ module Psych
end
###
- # Parse a YAML string in +yaml+. Returns the full AST for the YAML document.
+ # Parse a YAML string in +yaml+. Returns the Psych::Nodes::Stream.
# This method can handle multiple YAML documents contained in +yaml+.
# +filename+ is used in the exception message if a Psych::SyntaxError is
# raised.
@@ -240,7 +405,7 @@ module Psych
io = nil
end
- visitor = Psych::Visitors::YAMLTree.new options
+ visitor = Psych::Visitors::YAMLTree.create options
visitor << o
visitor.tree.yaml io, options
end
@@ -252,7 +417,7 @@ module Psych
#
# Psych.dump_stream("foo\n ", {}) # => "--- ! \"foo\\n \"\n--- {}\n"
def self.dump_stream *objects
- visitor = Psych::Visitors::YAMLTree.new {}
+ visitor = Psych::Visitors::YAMLTree.create({})
objects.each do |o|
visitor << o
end
@@ -260,16 +425,16 @@ module Psych
end
###
- # Dump Ruby object +o+ to a JSON string.
- def self.to_json o
- visitor = Psych::Visitors::JSONTree.new
- visitor << o
+ # Dump Ruby +object+ to a JSON string.
+ def self.to_json object
+ visitor = Psych::Visitors::JSONTree.create
+ visitor << object
visitor.tree.yaml
end
###
# Load multiple documents given in +yaml+. Returns the parsed documents
- # as a list. If a block is given, each document will be converted to ruby
+ # as a list. If a block is given, each document will be converted to Ruby
# and passed to the block during parsing
#
# Example:
@@ -294,7 +459,7 @@ module Psych
###
# Load the document contained in +filename+. Returns the yaml contained in
- # +filename+ as a ruby object
+ # +filename+ as a Ruby object
def self.load_file filename
File.open(filename, 'r:bom|utf-8') { |f| self.load f, filename }
end
@@ -320,7 +485,7 @@ module Psych
@load_tags = {}
@dump_tags = {}
def self.add_tag tag, klass
- @load_tags[tag] = klass
+ @load_tags[tag] = klass.name
@dump_tags[klass] = tag
end
diff --git a/ext/psych/lib/psych/class_loader.rb b/ext/psych/lib/psych/class_loader.rb
new file mode 100644
index 0000000000..46c6b93627
--- /dev/null
+++ b/ext/psych/lib/psych/class_loader.rb
@@ -0,0 +1,101 @@
+require 'psych/omap'
+require 'psych/set'
+
+module Psych
+ class ClassLoader # :nodoc:
+ BIG_DECIMAL = 'BigDecimal'
+ COMPLEX = 'Complex'
+ DATE = 'Date'
+ DATE_TIME = 'DateTime'
+ EXCEPTION = 'Exception'
+ OBJECT = 'Object'
+ PSYCH_OMAP = 'Psych::Omap'
+ PSYCH_SET = 'Psych::Set'
+ RANGE = 'Range'
+ RATIONAL = 'Rational'
+ REGEXP = 'Regexp'
+ STRUCT = 'Struct'
+ SYMBOL = 'Symbol'
+
+ def initialize
+ @cache = CACHE.dup
+ end
+
+ def load klassname
+ return nil if !klassname || klassname.empty?
+
+ find klassname
+ end
+
+ def symbolize sym
+ symbol
+ sym.to_sym
+ end
+
+ constants.each do |const|
+ konst = const_get const
+ define_method(const.to_s.downcase) do
+ load konst
+ end
+ end
+
+ private
+
+ def find klassname
+ @cache[klassname] ||= resolve(klassname)
+ end
+
+ def resolve klassname
+ name = klassname
+ retried = false
+
+ begin
+ path2class(name)
+ rescue ArgumentError, NameError => ex
+ unless retried
+ name = "Struct::#{name}"
+ retried = ex
+ retry
+ end
+ raise retried
+ end
+ end
+
+ CACHE = Hash[constants.map { |const|
+ val = const_get const
+ begin
+ [val, ::Object.const_get(val)]
+ rescue
+ nil
+ end
+ }.compact]
+
+ class Restricted < ClassLoader
+ def initialize classes, symbols
+ @classes = classes
+ @symbols = symbols
+ super()
+ end
+
+ def symbolize sym
+ return super if @symbols.empty?
+
+ if @symbols.include? sym
+ super
+ else
+ raise DisallowedClass, 'Symbol'
+ end
+ end
+
+ private
+
+ def find klassname
+ if @classes.include? klassname
+ super
+ else
+ raise DisallowedClass, klassname
+ end
+ end
+ end
+ end
+end
diff --git a/ext/psych/lib/psych/deprecated.rb b/ext/psych/lib/psych/deprecated.rb
index 1e42859b22..8c310b3207 100644
--- a/ext/psych/lib/psych/deprecated.rb
+++ b/ext/psych/lib/psych/deprecated.rb
@@ -35,7 +35,8 @@ module Psych
warn "#{caller[0]}: detect_implicit is deprecated" if $VERBOSE
return '' unless String === thing
return 'null' if '' == thing
- ScalarScanner.new.tokenize(thing).class.name.downcase
+ ss = ScalarScanner.new(ClassLoader.new)
+ ss.tokenize(thing).class.name.downcase
end
def self.add_ruby_type type_tag, &block
diff --git a/ext/psych/lib/psych/exception.rb b/ext/psych/lib/psych/exception.rb
new file mode 100644
index 0000000000..ce9d2caf3f
--- /dev/null
+++ b/ext/psych/lib/psych/exception.rb
@@ -0,0 +1,13 @@
+module Psych
+ class Exception < RuntimeError
+ end
+
+ class BadAlias < Exception
+ end
+
+ class DisallowedClass < Exception
+ def initialize klass_name
+ super "Tried to load unspecified class: #{klass_name}"
+ end
+ end
+end
diff --git a/ext/psych/lib/psych/json/stream.rb b/ext/psych/lib/psych/json/stream.rb
index be1a0a8a82..fe2a6e9116 100644
--- a/ext/psych/lib/psych/json/stream.rb
+++ b/ext/psych/lib/psych/json/stream.rb
@@ -6,6 +6,7 @@ module Psych
class Stream < Psych::Visitors::JSONTree
include Psych::JSON::RubyEvents
include Psych::Streaming
+ extend Psych::Streaming::ClassMethods
class Emitter < Psych::Stream::Emitter # :nodoc:
include Psych::JSON::YAMLEvents
diff --git a/ext/psych/lib/psych/nodes/node.rb b/ext/psych/lib/psych/nodes/node.rb
index 0cefe44e44..83233a61fd 100644
--- a/ext/psych/lib/psych/nodes/node.rb
+++ b/ext/psych/lib/psych/nodes/node.rb
@@ -1,4 +1,6 @@
require 'stringio'
+require 'psych/class_loader'
+require 'psych/scalar_scanner'
module Psych
module Nodes
@@ -32,7 +34,7 @@ module Psych
#
# See also Psych::Visitors::ToRuby
def to_ruby
- Visitors::ToRuby.new.accept self
+ Visitors::ToRuby.create.accept(self)
end
alias :transform :to_ruby
diff --git a/ext/psych/lib/psych/nodes/sequence.rb b/ext/psych/lib/psych/nodes/sequence.rb
index e4b833d330..7e907fe2c8 100644
--- a/ext/psych/lib/psych/nodes/sequence.rb
+++ b/ext/psych/lib/psych/nodes/sequence.rb
@@ -56,7 +56,7 @@ module Psych
# Is this sequence started implicitly?
attr_accessor :implicit
- # The sequece style used
+ # The sequence style used
attr_accessor :style
###
diff --git a/ext/psych/lib/psych/scalar_scanner.rb b/ext/psych/lib/psych/scalar_scanner.rb
index 8aa594e333..93007902a7 100644
--- a/ext/psych/lib/psych/scalar_scanner.rb
+++ b/ext/psych/lib/psych/scalar_scanner.rb
@@ -5,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)
@@ -19,13 +19,16 @@ module Psych
|[-+]?(?:0|[1-9][0-9_]*) (?# base 10)
|[-+]?0x[0-9a-fA-F_]+ (?# base 16))$/x
+ attr_reader :class_loader
+
# Create a new scanner
- def initialize
+ def initialize class_loader
@string_cache = {}
@symbol_cache = {}
+ @class_loader = class_loader
end
- # Tokenize +string+ returning the ruby object
+ # Tokenize +string+ returning the Ruby object
def tokenize string
return nil if string.empty?
return string if @string_cache.key?(string)
@@ -34,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!@#\$%\^&\*\(\)\{\}\<\>\|\/\\~;=]+/
+ when /^[^\d\.:-]?[A-Za-z_\s!@#\$%\^&\*\(\)\{\}\<\>\|\/\\~;=]+/, /\n/
if string.length > 5
@string_cache[string] = true
return string
@@ -63,7 +66,7 @@ module Psych
when /^\d{4}-(?:1[012]|0\d|\d)-(?:[12]\d|3[01]|0\d|\d)$/
require 'date'
begin
- Date.strptime(string, '%Y-%m-%d')
+ class_loader.date.strptime(string, '%Y-%m-%d')
rescue ArgumentError
string
end
@@ -75,9 +78,9 @@ module Psych
Float::NAN
when /^:./
if string =~ /^:(["'])(.*)\1/
- @symbol_cache[string] = $2.sub(/^:/, '').to_sym
+ @symbol_cache[string] = class_loader.symbolize($2.sub(/^:/, ''))
else
- @symbol_cache[string] = string.sub(/^:/, '').to_sym
+ @symbol_cache[string] = class_loader.symbolize(string.sub(/^:/, ''))
end
when /^[-+]?[0-9][0-9_]*(:[0-5]?[0-9])+$/
i = 0
@@ -92,7 +95,7 @@ module Psych
end
i
when FLOAT
- if string == '.'
+ if string =~ /\A[-+]?\.\Z/
@string_cache[string] = true
string
else
@@ -117,17 +120,19 @@ module Psych
###
# Parse and return a Time from +string+
def parse_time string
+ klass = class_loader.load 'Time'
+
date, time = *(string.split(/[ tT]/, 2))
- (yy, m, dd) = date.split('-').map { |x| x.to_i }
+ (yy, m, dd) = date.match(/^(-?\d{4})-(\d{1,2})-(\d{1,2})/).captures.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 }
us = (md[2] ? Rational("0.#{md[2]}") : 0) * 1000000
- time = Time.utc(yy, m, dd, hh, mm, ss, us)
+ time = klass.utc(yy, m, dd, hh, mm, ss, us)
return time if 'Z' == md[3]
- return Time.at(time.to_i, us) unless md[3]
+ return klass.at(time.to_i, us) unless md[3]
tz = md[3].match(/^([+\-]?\d{1,2})\:?(\d{1,2})?$/)[1..-1].compact.map { |digit| Integer(digit, 10) }
offset = tz.first * 3600
@@ -138,7 +143,7 @@ module Psych
offset += ((tz[1] || 0) * 60)
end
- Time.at((time - offset).to_i, us)
+ klass.at((time - offset).to_i, us)
end
end
end
diff --git a/ext/psych/lib/psych/stream.rb b/ext/psych/lib/psych/stream.rb
index 567c1bb790..88c4c4cb4e 100644
--- a/ext/psych/lib/psych/stream.rb
+++ b/ext/psych/lib/psych/stream.rb
@@ -32,5 +32,6 @@ module Psych
end
include Psych::Streaming
+ extend Psych::Streaming::ClassMethods
end
end
diff --git a/ext/psych/lib/psych/streaming.rb b/ext/psych/lib/psych/streaming.rb
index c6fa109d5a..9d94eb549f 100644
--- a/ext/psych/lib/psych/streaming.rb
+++ b/ext/psych/lib/psych/streaming.rb
@@ -1,10 +1,15 @@
module Psych
module Streaming
- ###
- # Create a new streaming emitter. Emitter will print to +io+. See
- # Psych::Stream for an example.
- def initialize io
- super({}, self.class.const_get(:Emitter).new(io))
+ module ClassMethods
+ ###
+ # Create a new streaming emitter. Emitter will print to +io+. See
+ # Psych::Stream for an example.
+ def new io
+ emitter = const_get(:Emitter).new(io)
+ class_loader = ClassLoader.new
+ ss = ScalarScanner.new class_loader
+ super(emitter, ss, {})
+ end
end
###
diff --git a/ext/psych/lib/psych/syntax_error.rb b/ext/psych/lib/psych/syntax_error.rb
index f972256f9e..e200ef0060 100644
--- a/ext/psych/lib/psych/syntax_error.rb
+++ b/ext/psych/lib/psych/syntax_error.rb
@@ -1,8 +1,7 @@
-module Psych
- class Error < RuntimeError
- end
+require 'psych/exception'
- class SyntaxError < Error
+module Psych
+ class SyntaxError < Psych::Exception
attr_reader :file, :line, :column, :offset, :problem, :context
def initialize file, line, col, offset, problem, context
diff --git a/ext/psych/lib/psych/visitors/json_tree.rb b/ext/psych/lib/psych/visitors/json_tree.rb
index 0350dd1faa..0127ac8aa8 100644
--- a/ext/psych/lib/psych/visitors/json_tree.rb
+++ b/ext/psych/lib/psych/visitors/json_tree.rb
@@ -5,8 +5,11 @@ module Psych
class JSONTree < YAMLTree
include Psych::JSON::RubyEvents
- def initialize options = {}, emitter = Psych::JSON::TreeBuilder.new
- super
+ def self.create options = {}
+ emitter = Psych::JSON::TreeBuilder.new
+ class_loader = ClassLoader.new
+ ss = ScalarScanner.new class_loader
+ new(emitter, ss, options)
end
def accept target
diff --git a/ext/psych/lib/psych/visitors/to_ruby.rb b/ext/psych/lib/psych/visitors/to_ruby.rb
index 9ccf420c34..e74d5d4bc5 100644
--- a/ext/psych/lib/psych/visitors/to_ruby.rb
+++ b/ext/psych/lib/psych/visitors/to_ruby.rb
@@ -1,4 +1,6 @@
require 'psych/scalar_scanner'
+require 'psych/class_loader'
+require 'psych/exception'
unless defined?(Regexp::NOENCODING)
Regexp::NOENCODING = 32
@@ -7,13 +9,22 @@ end
module Psych
module Visitors
###
- # This class walks a YAML AST, converting each node to ruby
+ # This class walks a YAML AST, converting each node to Ruby
class ToRuby < Psych::Visitors::Visitor
- def initialize ss = ScalarScanner.new
+ def self.create
+ class_loader = ClassLoader.new
+ scanner = ScalarScanner.new class_loader
+ new(scanner, class_loader)
+ end
+
+ attr_reader :class_loader
+
+ def initialize ss, class_loader
super()
@st = {}
@ss = ss
@domain_types = Psych.domain_types
+ @class_loader = class_loader
end
def accept target
@@ -32,7 +43,7 @@ module Psych
end
def deserialize o
- if klass = Psych.load_tags[o.tag]
+ if klass = resolve_class(Psych.load_tags[o.tag])
instance = klass.allocate
if instance.respond_to?(:init_with)
@@ -59,19 +70,25 @@ module Psych
end
when '!ruby/object:BigDecimal'
require 'bigdecimal'
- BigDecimal._load o.value
+ class_loader.big_decimal._load o.value
when "!ruby/object:DateTime"
+ 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)
when "!ruby/object:Rational"
+ class_loader.rational
Rational(o.value)
when "!ruby/class", "!ruby/module"
resolve_class o.value
when "tag:yaml.org,2002:float", "!float"
Float(@ss.tokenize(o.value))
when "!ruby/regexp"
+ klass = class_loader.regexp
o.value =~ /^\/(.*)\/([mixn]*)$/
source = $1
options = 0
@@ -85,15 +102,16 @@ module Psych
else lang = option
end
end
- Regexp.new(*[source, options, lang].compact)
+ klass.new(*[source, options, lang].compact)
when "!ruby/range"
+ klass = class_loader.range
args = o.value.split(/([.]{2,3})/, 2).map { |s|
accept Nodes::Scalar.new(s)
}
args.push(args.delete_at(1) == '...')
- Range.new(*args)
+ klass.new(*args)
when /^!ruby\/sym(bol)?:?(.*)?$/
- o.value.to_sym
+ class_loader.symbolize o.value
else
@ss.tokenize o.value
end
@@ -105,7 +123,7 @@ module Psych
end
def visit_Psych_Nodes_Sequence o
- if klass = Psych.load_tags[o.tag]
+ if klass = resolve_class(Psych.load_tags[o.tag])
instance = klass.allocate
if instance.respond_to?(:init_with)
@@ -137,22 +155,24 @@ module Psych
end
def visit_Psych_Nodes_Mapping o
- return revive(Psych.load_tags[o.tag], o) if Psych.load_tags[o.tag]
- return revive_hash({}, o) unless o.tag
+ if Psych.load_tags[o.tag]
+ return revive(resolve_class(Psych.load_tags[o.tag]), o)
+ end
+ return revive_hash(register(o, {}), o) unless o.tag
case o.tag
when /^!ruby\/struct:?(.*)?$/
- klass = resolve_class($1)
+ klass = resolve_class($1) if $1
if klass
s = register(o, klass.allocate)
members = {}
- struct_members = s.members.map { |x| x.to_sym }
+ struct_members = s.members.map { |x| class_loader.symbolize x }
o.children.each_slice(2) do |k,v|
member = accept(k)
value = accept(v)
- if struct_members.include?(member.to_sym)
+ if struct_members.include?(class_loader.symbolize(member))
s.send("#{member}=", value)
else
members[member.to_s.sub(/^@/, '')] = value
@@ -160,35 +180,54 @@ module Psych
end
init_with(s, members, o)
else
+ klass = class_loader.struct
members = o.children.map { |c| accept c }
h = Hash[*members]
- Struct.new(*h.map { |k,v| k.to_sym }).new(*h.map { |k,v| v })
+ s = klass.new(*h.map { |k,v|
+ class_loader.symbolize k
+ }).new(*h.map { |k,v| v })
+ register(o, s)
+ s
end
when /^!ruby\/object:?(.*)?$/
name = $1 || 'Object'
if name == 'Complex'
+ class_loader.complex
h = Hash[*o.children.map { |c| accept c }]
register o, Complex(h['real'], h['image'])
elsif name == 'Rational'
+ 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) || Object), o)
+ obj = revive((resolve_class(name) || class_loader.object), o)
obj
end
when /^!(?:str|ruby\/string)(?::(.*))?/, 'tag:yaml.org,2002:str'
- klass = resolve_class($1)
- members = Hash[*o.children.map { |c| accept c }]
- string = members.delete 'str'
+ klass = resolve_class($1)
+ members = {}
+ string = nil
- if klass
- string = klass.allocate.replace string
- register(o, string)
- end
+ o.children.each_slice(2) do |k,v|
+ key = accept k
+ value = accept v
+ if key == 'str'
+ if klass
+ string = klass.allocate.replace value
+ else
+ string = value
+ end
+ register(o, string)
+ else
+ members[key] = value
+ end
+ end
init_with(string, members.map { |k,v| [k.to_s.sub(/^@/, ''),v] }, o)
when /^!ruby\/array:(.*)$/
klass = resolve_class($1)
@@ -203,18 +242,19 @@ module Psych
list
when '!ruby/range'
+ klass = class_loader.range
h = Hash[*o.children.map { |c| accept c }]
- register o, Range.new(h['begin'], h['end'], h['excl'])
+ register o, klass.new(h['begin'], h['end'], h['excl'])
when /^!ruby\/exception:?(.*)?$/
h = Hash[*o.children.map { |c| accept c }]
- e = build_exception((resolve_class($1) || Exception),
+ e = build_exception((resolve_class($1) || class_loader.exception),
h.delete('message'))
init_with(e, h, o)
when '!set', 'tag:yaml.org,2002:set'
- set = Psych::Set.new
+ set = class_loader.psych_set.new
@st[o.anchor] = set if o.anchor
o.children.each_slice(2) do |k,v|
set[accept(k)] = accept(v)
@@ -222,17 +262,17 @@ module Psych
set
when /^!map:(.*)$/, /^!ruby\/hash:(.*)$/
- revive_hash resolve_class($1).new, o
+ revive_hash register(o, resolve_class($1).new), o
when '!omap', 'tag:yaml.org,2002:omap'
- map = register(o, Psych::Omap.new)
+ map = register(o, class_loader.psych_omap.new)
o.children.each_slice(2) do |l,r|
map[accept(l)] = accept r
end
map
else
- revive_hash({}, o)
+ revive_hash(register(o, {}), o)
end
end
@@ -261,15 +301,13 @@ module Psych
end
def revive_hash hash, o
- @st[o.anchor] = hash if o.anchor
-
o.children.each_slice(2) { |k,v|
key = accept(k)
val = accept(v)
- if key == '<<'
+ if key == '<<' && k.tag != "tag:yaml.org,2002:str"
case v
- when Nodes::Alias
+ when Nodes::Alias, Nodes::Mapping
begin
hash.merge! val
rescue TypeError
@@ -300,10 +338,8 @@ module Psych
end
def revive klass, node
- s = klass.allocate
- @st[node.anchor] = s if node.anchor
- h = Hash[*node.children.map { |c| accept c }]
- init_with(s, h, node)
+ s = register(node, klass.allocate)
+ init_with(s, revive_hash({}, node), node)
end
def init_with o, h, node
@@ -325,21 +361,13 @@ module Psych
# Convert +klassname+ to a Class
def resolve_class klassname
- return nil unless klassname and not klassname.empty?
-
- name = klassname
- retried = false
-
- begin
- path2class(name)
- rescue ArgumentError, NameError => ex
- unless retried
- name = "Struct::#{name}"
- retried = ex
- retry
- end
- raise retried
- end
+ class_loader.load klassname
+ end
+ end
+
+ class NoAliasRuby < ToRuby
+ def visit_Psych_Nodes_Alias o
+ raise BadAlias, "Unknown alias: #{o.anchor}"
end
end
end
diff --git a/ext/psych/lib/psych/visitors/yaml_tree.rb b/ext/psych/lib/psych/visitors/yaml_tree.rb
index 6b6a5ffa19..3f2427b8d0 100644
--- a/ext/psych/lib/psych/visitors/yaml_tree.rb
+++ b/ext/psych/lib/psych/visitors/yaml_tree.rb
@@ -1,7 +1,11 @@
+require 'psych/tree_builder'
+require 'psych/scalar_scanner'
+require 'psych/class_loader'
+
module Psych
module Visitors
###
- # YAMLTree builds a YAML ast given a ruby object. For example:
+ # YAMLTree builds a YAML ast given a Ruby object. For example:
#
# builder = Psych::Visitors::YAMLTree.new
# builder << { :foo => 'bar' }
@@ -12,10 +16,12 @@ module Psych
def initialize
@obj_to_id = {}
@obj_to_node = {}
+ @targets = []
@counter = 0
end
def register target, node
+ @targets << target
@obj_to_node[target.object_id] = node
end
@@ -36,7 +42,23 @@ module Psych
alias :finished? :finished
alias :started? :started
- def initialize options = {}, emitter = TreeBuilder.new, ss = ScalarScanner.new
+ def self.create options = {}, emitter = nil
+ emitter ||= TreeBuilder.new
+ class_loader = ClassLoader.new
+ ss = ScalarScanner.new class_loader
+ new(emitter, ss, options)
+ end
+
+ def self.new emitter = nil, ss = nil, options = nil
+ return super if emitter && ss && options
+
+ if $VERBOSE
+ warn "This API is deprecated, please pass an emitter, scalar scanner, and options or call #{self}.create() (#{caller.first})"
+ end
+ create emitter, ss
+ end
+
+ def initialize emitter, ss, options
super()
@started = false
@finished = false
@@ -137,6 +159,11 @@ module Psych
@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
@@ -184,19 +211,42 @@ 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 = format_time o.to_time
+ 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
tag = '!ruby/object:DateTime'
register o, @emitter.scalar(formatted, nil, tag, false, false, Nodes::Scalar::ANY)
end
def visit_Time o
formatted = format_time o
- @emitter.scalar formatted, nil, nil, true, false, Nodes::Scalar::ANY
+ register o, @emitter.scalar(formatted, nil, nil, true, false, Nodes::Scalar::ANY)
end
def visit_Rational o
@@ -244,14 +294,6 @@ module Psych
@emitter.scalar o._dump, nil, '!ruby/object:BigDecimal', false, false, Nodes::Scalar::ANY
end
- def binary? string
- (string.encoding == Encoding::ASCII_8BIT && !string.ascii_only?) ||
- string.index("\x00") ||
- string.count("\x00-\x7F", "^ -~\t\r\n").fdiv(string.length) > 0.3 ||
- string.class != String
- end
- private :binary?
-
def visit_String o
plain = true
quote = true
@@ -268,6 +310,13 @@ module Psych
quote = false
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 o =~ /^\W[^"]*$/
+ style = Nodes::Scalar::DOUBLE_QUOTED
else
unless String === @ss.tokenize(o)
style = Nodes::Scalar::SINGLE_QUOTED
@@ -279,6 +328,8 @@ module Psych
if ivars.empty?
unless o.class == ::String
tag = "!ruby/string:#{o.class}"
+ plain = false
+ quote = false
end
@emitter.scalar str, nil, tag, plain, quote, style
else
@@ -353,10 +404,25 @@ module Psych
end
def visit_Symbol o
- @emitter.scalar ":#{o}", nil, nil, true, false, Nodes::Scalar::ANY
+ 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
private
+ # FIXME: Remove the index and count checks in Psych 3.0
+ NULL = "\x00"
+ BINARY_RANGE = "\x00-\x7F"
+ WS_RANGE = "^ -~\t\r\n"
+
+ def binary? string
+ (string.encoding == Encoding::ASCII_8BIT && !string.ascii_only?) ||
+ string.index(NULL) ||
+ string.count(BINARY_RANGE, WS_RANGE).fdiv(string.length) > 0.3
+ end
+
def visit_array_subclass o
tag = "!ruby/array:#{o.class}"
if o.instance_variables.empty?
@@ -463,7 +529,7 @@ module Psych
when :map
@emitter.start_mapping nil, c.tag, c.implicit, c.style
c.map.each do |k,v|
- @emitter.scalar k, nil, nil, true, false, Nodes::Scalar::ANY
+ accept k
accept v
end
@emitter.end_mapping
diff --git a/ext/psych/psych.gemspec b/ext/psych/psych.gemspec
index c15449c6ae..de83d6b3d2 100644
--- a/ext/psych/psych.gemspec
+++ b/ext/psych/psych.gemspec
@@ -2,23 +2,22 @@
Gem::Specification.new do |s|
s.name = "psych"
- s.version = "2.0.0"
+ s.version = "2.0.6"
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 = "2012-11-28"
+ s.date = "2014-09-14"
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"]
- s.files = [".autotest", ".travis.yml", "CHANGELOG.rdoc", "Manifest.txt", "README.rdoc", "Rakefile", "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/coder.rb", "lib/psych/core_ext.rb", "lib/psych/deprecated.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_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.extra_rdoc_files = ["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/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_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.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.rubyforge_project = "psych"
- s.rubygems_version = "1.8.24"
+ s.rubygems_version = "2.2.2"
s.summary = "Psych is a YAML parser and emitter"
- 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_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.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_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_to_ruby.c b/ext/psych/psych_to_ruby.c
index ed5245e12e..3cc87a965e 100644
--- a/ext/psych/psych_to_ruby.c
+++ b/ext/psych/psych_to_ruby.c
@@ -31,11 +31,13 @@ static VALUE path2class(VALUE self, VALUE path)
void Init_psych_to_ruby(void)
{
VALUE psych = rb_define_module("Psych");
+ VALUE class_loader = rb_define_class_under(psych, "ClassLoader", rb_cObject);
+
VALUE visitors = rb_define_module_under(psych, "Visitors");
VALUE visitor = rb_define_class_under(visitors, "Visitor", rb_cObject);
cPsychVisitorsToRuby = rb_define_class_under(visitors, "ToRuby", visitor);
rb_define_private_method(cPsychVisitorsToRuby, "build_exception", build_exception, 2);
- rb_define_private_method(cPsychVisitorsToRuby, "path2class", path2class, 1);
+ rb_define_private_method(class_loader, "path2class", path2class, 1);
}
/* vim: set noet sws=4 sw=4: */
diff --git a/ext/psych/yaml/api.c b/ext/psych/yaml/api.c
index 0c4732e152..e0b9d979cc 100644
--- a/ext/psych/yaml/api.c
+++ b/ext/psych/yaml/api.c
@@ -395,7 +395,7 @@ yaml_emitter_delete(yaml_emitter_t *emitter)
}
QUEUE_DEL(emitter, emitter->events);
STACK_DEL(emitter, emitter->indents);
- while (!STACK_EMPTY(empty, emitter->tag_directives)) {
+ while (!STACK_EMPTY(emitter, emitter->tag_directives)) {
yaml_tag_directive_t tag_directive = POP(emitter, emitter->tag_directives);
yaml_free(tag_directive.handle);
yaml_free(tag_directive.prefix);
@@ -822,6 +822,7 @@ yaml_scalar_event_initialize(yaml_event_t *event,
yaml_char_t *anchor_copy = NULL;
yaml_char_t *tag_copy = NULL;
yaml_char_t *value_copy = NULL;
+ size_t value_length;
assert(event); /* Non-NULL event object is expected. */
assert(value); /* Non-NULL anchor is expected. */
@@ -839,16 +840,19 @@ yaml_scalar_event_initialize(yaml_event_t *event,
}
if (length < 0) {
- length = strlen((char *)value);
+ value_length = strlen((char *)value);
+ }
+ else {
+ value_length = (size_t)length;
}
- if (!yaml_check_utf8(value, length)) goto error;
- value_copy = yaml_malloc(length+1);
+ if (!yaml_check_utf8(value, value_length)) goto error;
+ value_copy = yaml_malloc(value_length+1);
if (!value_copy) goto error;
- memcpy(value_copy, value, length);
- value_copy[length] = '\0';
+ memcpy(value_copy, value, value_length);
+ value_copy[value_length] = '\0';
- SCALAR_EVENT_INIT(*event, anchor_copy, tag_copy, value_copy, length,
+ SCALAR_EVENT_INIT(*event, anchor_copy, tag_copy, value_copy, value_length,
plain_implicit, quoted_implicit, style, mark, mark);
return 1;
@@ -1202,6 +1206,8 @@ yaml_document_add_scalar(yaml_document_t *document,
yaml_char_t *tag_copy = NULL;
yaml_char_t *value_copy = NULL;
yaml_node_t node;
+ size_t value_length;
+ ptrdiff_t ret;
assert(document); /* Non-NULL document object is expected. */
assert(value); /* Non-NULL value is expected. */
@@ -1215,19 +1221,26 @@ yaml_document_add_scalar(yaml_document_t *document,
if (!tag_copy) goto error;
if (length < 0) {
- length = strlen((char *)value);
+ value_length = strlen((char *)value);
+ }
+ else {
+ value_length = (size_t)length;
}
- if (!yaml_check_utf8(value, length)) goto error;
- value_copy = yaml_malloc(length+1);
+ if (!yaml_check_utf8(value, value_length)) goto error;
+ value_copy = yaml_malloc(value_length+1);
if (!value_copy) goto error;
- memcpy(value_copy, value, length);
- value_copy[length] = '\0';
+ memcpy(value_copy, value, value_length);
+ value_copy[value_length] = '\0';
- SCALAR_NODE_INIT(node, tag_copy, value_copy, length, style, mark, mark);
+ SCALAR_NODE_INIT(node, tag_copy, value_copy, value_length, style, mark, mark);
if (!PUSH(&context, document->nodes, node)) goto error;
- return document->nodes.top - document->nodes.start;
+ ret = document->nodes.top - document->nodes.start;
+#if PTRDIFF_MAX > INT_MAX
+ if (ret > INT_MAX) goto error;
+#endif
+ return (int)ret;
error:
yaml_free(tag_copy);
@@ -1255,6 +1268,7 @@ yaml_document_add_sequence(yaml_document_t *document,
yaml_node_item_t *top;
} items = { NULL, NULL, NULL };
yaml_node_t node;
+ ptrdiff_t ret;
assert(document); /* Non-NULL document object is expected. */
@@ -1272,7 +1286,11 @@ yaml_document_add_sequence(yaml_document_t *document,
style, mark, mark);
if (!PUSH(&context, document->nodes, node)) goto error;
- return document->nodes.top - document->nodes.start;
+ ret = document->nodes.top - document->nodes.start;
+#if PTRDIFF_MAX > INT_MAX
+ if (ret > INT_MAX) goto error;
+#endif
+ return (int)ret;
error:
STACK_DEL(&context, items);
@@ -1300,6 +1318,7 @@ yaml_document_add_mapping(yaml_document_t *document,
yaml_node_pair_t *top;
} pairs = { NULL, NULL, NULL };
yaml_node_t node;
+ ptrdiff_t ret;
assert(document); /* Non-NULL document object is expected. */
@@ -1317,7 +1336,11 @@ yaml_document_add_mapping(yaml_document_t *document,
style, mark, mark);
if (!PUSH(&context, document->nodes, node)) goto error;
- return document->nodes.top - document->nodes.start;
+ ret = document->nodes.top - document->nodes.start;
+#if PTRDIFF_MAX > INT_MAX
+ if (ret > INT_MAX) goto error;
+#endif
+ return (int)ret;
error:
STACK_DEL(&context, pairs);
diff --git a/ext/psych/yaml/config.h b/ext/psych/yaml/config.h
index 6d6c25b3b1..f54c27d339 100644
--- a/ext/psych/yaml/config.h
+++ b/ext/psych/yaml/config.h
@@ -1,11 +1,10 @@
-
#define PACKAGE_NAME "yaml"
#define PACKAGE_TARNAME "yaml"
-#define PACKAGE_VERSION "0.1.4"
-#define PACKAGE_STRING "yaml 0.1.4"
+#define PACKAGE_VERSION "0.1.6"
+#define PACKAGE_STRING "yaml 0.1.6"
#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 4
-#define YAML_VERSION_STRING "0.1.4"
+#define YAML_VERSION_PATCH 6
+#define YAML_VERSION_STRING "0.1.6"
diff --git a/ext/psych/yaml/emitter.c b/ext/psych/yaml/emitter.c
index c852f9309f..bf84fafc51 100644
--- a/ext/psych/yaml/emitter.c
+++ b/ext/psych/yaml/emitter.c
@@ -53,7 +53,7 @@
#define WRITE_BREAK(emitter,string) \
(FLUSH(emitter) \
&& (CHECK(string,'\n') ? \
- (PUT_BREAK(emitter), \
+ ((void)PUT_BREAK(emitter), \
string.pointer ++, \
1) : \
(COPY(emitter->buffer,string), \
diff --git a/ext/psych/yaml/loader.c b/ext/psych/yaml/loader.c
index 9d3d912663..cb3ea93089 100644
--- a/ext/psych/yaml/loader.c
+++ b/ext/psych/yaml/loader.c
@@ -283,9 +283,12 @@ static int
yaml_parser_load_scalar(yaml_parser_t *parser, yaml_event_t *first_event)
{
yaml_node_t node;
+ ptrdiff_t node_index;
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);
@@ -298,7 +301,11 @@ yaml_parser_load_scalar(yaml_parser_t *parser, yaml_event_t *first_event)
if (!PUSH(parser, parser->document->nodes, node)) goto error;
- index = parser->document->nodes.top - parser->document->nodes.start;
+ node_index = parser->document->nodes.top - parser->document->nodes.start;
+#if PTRDIFF_MAX > INT_MAX
+ if (node_index > INT_MAX) goto error;
+#endif
+ index = (int)node_index;
if (!yaml_parser_register_anchor(parser, index,
first_event->data.scalar.anchor)) return 0;
@@ -327,8 +334,11 @@ yaml_parser_load_sequence(yaml_parser_t *parser, yaml_event_t *first_event)
yaml_node_item_t *top;
} items = { NULL, NULL, NULL };
int index, item_index;
+ ptrdiff_t node_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);
@@ -343,7 +353,11 @@ yaml_parser_load_sequence(yaml_parser_t *parser, yaml_event_t *first_event)
if (!PUSH(parser, parser->document->nodes, node)) goto error;
- index = parser->document->nodes.top - parser->document->nodes.start;
+ node_index = parser->document->nodes.top - parser->document->nodes.start;
+#if PTRDIFF_MAX > INT_MAX
+ if (node_index > INT_MAX) goto error;
+#endif
+ index = (int)node_index;
if (!yaml_parser_register_anchor(parser, index,
first_event->data.sequence_start.anchor)) return 0;
@@ -351,6 +365,9 @@ 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,
@@ -384,9 +401,12 @@ yaml_parser_load_mapping(yaml_parser_t *parser, yaml_event_t *first_event)
yaml_node_pair_t *top;
} pairs = { NULL, NULL, NULL };
int index;
+ ptrdiff_t node_index;
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);
@@ -401,7 +421,11 @@ yaml_parser_load_mapping(yaml_parser_t *parser, yaml_event_t *first_event)
if (!PUSH(parser, parser->document->nodes, node)) goto error;
- index = parser->document->nodes.top - parser->document->nodes.start;
+ node_index = parser->document->nodes.top - parser->document->nodes.start;
+#if PTRDIFF_MAX > INT_MAX
+ if (node_index > INT_MAX) goto error;
+#endif
+ index = (int)node_index;
if (!yaml_parser_register_anchor(parser, index,
first_event->data.mapping_start.anchor)) return 0;
@@ -409,6 +433,9 @@ 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/parser.c b/ext/psych/yaml/parser.c
index dc5430b09f..32671b252c 100644
--- a/ext/psych/yaml/parser.c
+++ b/ext/psych/yaml/parser.c
@@ -759,9 +759,8 @@ yaml_parser_parse_block_sequence_entry(yaml_parser_t *parser,
else if (token->type == YAML_BLOCK_END_TOKEN)
{
- yaml_mark_t dummy_mark; /* Used to eliminate a compiler warning. */
parser->state = POP(parser, parser->states);
- dummy_mark = POP(parser, parser->marks);
+ (void)POP(parser, parser->marks);
SEQUENCE_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
SKIP_TOKEN(parser);
return 1;
@@ -869,9 +868,8 @@ yaml_parser_parse_block_mapping_key(yaml_parser_t *parser,
else if (token->type == YAML_BLOCK_END_TOKEN)
{
- yaml_mark_t dummy_mark; /* Used to eliminate a compiler warning. */
parser->state = POP(parser, parser->states);
- dummy_mark = POP(parser, parser->marks);
+ (void)POP(parser, parser->marks);
MAPPING_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
SKIP_TOKEN(parser);
return 1;
@@ -952,7 +950,6 @@ yaml_parser_parse_flow_sequence_entry(yaml_parser_t *parser,
yaml_event_t *event, int first)
{
yaml_token_t *token;
- yaml_mark_t dummy_mark; /* Used to eliminate a compiler warning. */
if (first) {
token = PEEK_TOKEN(parser);
@@ -997,7 +994,7 @@ yaml_parser_parse_flow_sequence_entry(yaml_parser_t *parser,
}
parser->state = POP(parser, parser->states);
- dummy_mark = POP(parser, parser->marks);
+ (void)POP(parser, parser->marks);
SEQUENCE_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
SKIP_TOKEN(parser);
return 1;
@@ -1104,7 +1101,6 @@ yaml_parser_parse_flow_mapping_key(yaml_parser_t *parser,
yaml_event_t *event, int first)
{
yaml_token_t *token;
- yaml_mark_t dummy_mark; /* Used to eliminate a compiler warning. */
if (first) {
token = PEEK_TOKEN(parser);
@@ -1158,7 +1154,7 @@ yaml_parser_parse_flow_mapping_key(yaml_parser_t *parser,
}
parser->state = POP(parser, parser->states);
- dummy_mark = POP(parser, parser->marks);
+ (void)POP(parser, parser->marks);
MAPPING_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
SKIP_TOKEN(parser);
return 1;
diff --git a/ext/psych/yaml/reader.c b/ext/psych/yaml/reader.c
index 4e48add7b8..f1a06deb9d 100644
--- a/ext/psych/yaml/reader.c
+++ b/ext/psych/yaml/reader.c
@@ -460,6 +460,10 @@ 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 31fed0ed94..08ad8edb45 100644
--- a/ext/psych/yaml/scanner.c
+++ b/ext/psych/yaml/scanner.c
@@ -70,7 +70,7 @@
* %TAG !yaml! tag:yaml.org,2002:
* ---
*
- * The correspoding sequence of tokens:
+ * The corresponding 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, int column,
- int number, yaml_token_type_t type, yaml_mark_t mark);
+yaml_parser_roll_indent(yaml_parser_t *parser, ptrdiff_t column,
+ ptrdiff_t number, yaml_token_type_t type, yaml_mark_t mark);
static int
-yaml_parser_unroll_indent(yaml_parser_t *parser, int column);
+yaml_parser_unroll_indent(yaml_parser_t *parser, ptrdiff_t column);
/*
* Token fetchers.
@@ -1103,7 +1103,7 @@ yaml_parser_save_simple_key(yaml_parser_t *parser)
*/
int required = (!parser->flow_level
- && parser->indent == (int)parser->mark.column);
+ && parser->indent == (ptrdiff_t)parser->mark.column);
/*
* A simple key is required only when it is the first token in the current
@@ -1176,6 +1176,11 @@ 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;
@@ -1188,11 +1193,9 @@ yaml_parser_increase_flow_level(yaml_parser_t *parser)
static int
yaml_parser_decrease_flow_level(yaml_parser_t *parser)
{
- yaml_simple_key_t dummy_key; /* Used to eliminate a compiler warning. */
-
if (parser->flow_level) {
parser->flow_level --;
- dummy_key = POP(parser, parser->simple_keys);
+ (void)POP(parser, parser->simple_keys);
}
return 1;
@@ -1206,8 +1209,8 @@ yaml_parser_decrease_flow_level(yaml_parser_t *parser)
*/
static int
-yaml_parser_roll_indent(yaml_parser_t *parser, int column,
- int number, yaml_token_type_t type, yaml_mark_t mark)
+yaml_parser_roll_indent(yaml_parser_t *parser, ptrdiff_t column,
+ ptrdiff_t number, yaml_token_type_t type, yaml_mark_t mark)
{
yaml_token_t token;
@@ -1226,7 +1229,14 @@ yaml_parser_roll_indent(yaml_parser_t *parser, int column,
if (!PUSH(parser, parser->indents, parser->indent))
return 0;
- parser->indent = column;
+#if PTRDIFF_MAX > INT_MAX
+ if (column > INT_MAX) {
+ parser->error = YAML_MEMORY_ERROR;
+ return 0;
+ }
+#endif
+
+ parser->indent = (int)column;
/* Create a token and insert it into the queue. */
@@ -1248,13 +1258,13 @@ yaml_parser_roll_indent(yaml_parser_t *parser, int column,
/*
* Pop indentation levels from the indents stack until the current level
- * becomes less or equal to the column. For each indentation level, append
+ * becomes less or equal to the column. For each intendation level, append
* the BLOCK-END token.
*/
static int
-yaml_parser_unroll_indent(yaml_parser_t *parser, int column)
+yaml_parser_unroll_indent(yaml_parser_t *parser, ptrdiff_t column)
{
yaml_token_t token;
@@ -1263,7 +1273,7 @@ yaml_parser_unroll_indent(yaml_parser_t *parser, int column)
if (parser->flow_level)
return 1;
- /* Loop through the indentation levels in the stack. */
+ /* Loop through the intendation levels in the stack. */
while (parser->indent > column)
{
@@ -2574,7 +2584,7 @@ yaml_parser_scan_tag_uri(yaml_parser_t *parser, int directive,
/* Resize the string to include the head. */
- while (string.end - string.start <= (int)length) {
+ while ((size_t)(string.end - string.start) <= length) {
if (!yaml_string_extend(&string.start, &string.pointer, &string.end)) {
parser->error = YAML_MEMORY_ERROR;
goto error;
@@ -2619,6 +2629,9 @@ 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;
}
@@ -2769,15 +2782,15 @@ yaml_parser_scan_block_scalar(yaml_parser_t *parser, yaml_token_t *token,
if (IS_DIGIT(parser->buffer))
{
- /* Check that the indentation is greater than 0. */
+ /* Check that the intendation is greater than 0. */
if (CHECK(parser->buffer, '0')) {
yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
- start_mark, "found an indentation indicator equal to 0");
+ start_mark, "found an intendation indicator equal to 0");
goto error;
}
- /* Get the indentation level and eat the indicator. */
+ /* Get the intendation level and eat the indicator. */
increment = AS_DIGIT(parser->buffer);
@@ -2791,7 +2804,7 @@ yaml_parser_scan_block_scalar(yaml_parser_t *parser, yaml_token_t *token,
{
if (CHECK(parser->buffer, '0')) {
yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
- start_mark, "found an indentation indicator equal to 0");
+ start_mark, "found an intendation indicator equal to 0");
goto error;
}
@@ -2841,7 +2854,7 @@ yaml_parser_scan_block_scalar(yaml_parser_t *parser, yaml_token_t *token,
end_mark = parser->mark;
- /* Set the indentation level if it was specified. */
+ /* Set the intendation level if it was specified. */
if (increment) {
indent = parser->indent >= 0 ? parser->indent+increment : increment;
@@ -2907,7 +2920,7 @@ yaml_parser_scan_block_scalar(yaml_parser_t *parser, yaml_token_t *token,
if (!READ_LINE(parser, leading_break)) goto error;
- /* Eat the following indentation spaces and line breaks. */
+ /* Eat the following intendation spaces and line breaks. */
if (!yaml_parser_scan_block_scalar_breaks(parser,
&indent, &trailing_breaks, start_mark, &end_mark)) goto error;
@@ -2942,8 +2955,8 @@ error:
}
/*
- * Scan indentation spaces and line breaks for a block scalar. Determine the
- * indentation level if needed.
+ * Scan intendation spaces and line breaks for a block scalar. Determine the
+ * intendation level if needed.
*/
static int
@@ -2955,11 +2968,11 @@ yaml_parser_scan_block_scalar_breaks(yaml_parser_t *parser,
*end_mark = parser->mark;
- /* Eat the indentation spaces and line breaks. */
+ /* Eat the intendation spaces and line breaks. */
while (1)
{
- /* Eat the indentation spaces. */
+ /* Eat the intendation spaces. */
if (!CACHE(parser, 1)) return 0;
@@ -2972,12 +2985,12 @@ yaml_parser_scan_block_scalar_breaks(yaml_parser_t *parser,
if ((int)parser->mark.column > max_indent)
max_indent = (int)parser->mark.column;
- /* Check for a tab character messing the indentation. */
+ /* Check for a tab character messing the intendation. */
if ((!*indent || (int)parser->mark.column < *indent)
&& IS_TAB(parser->buffer)) {
return yaml_parser_set_scanner_error(parser, "while scanning a block scalar",
- start_mark, "found a tab character where an indentation space is expected");
+ start_mark, "found a tab character where an intendation space is expected");
}
/* Have we found a non-empty line? */
@@ -3498,12 +3511,12 @@ yaml_parser_scan_plain_scalar(yaml_parser_t *parser, yaml_token_t *token)
{
if (IS_BLANK(parser->buffer))
{
- /* Check for tab character that abuse indentation. */
+ /* Check for tab character that abuse intendation. */
if (leading_blanks && (int)parser->mark.column < indent
&& IS_TAB(parser->buffer)) {
yaml_parser_set_scanner_error(parser, "while scanning a plain scalar",
- start_mark, "found a tab character that violates indentation");
+ start_mark, "found a tab character that violate intendation");
goto error;
}
@@ -3536,7 +3549,7 @@ yaml_parser_scan_plain_scalar(yaml_parser_t *parser, yaml_token_t *token)
if (!CACHE(parser, 1)) goto error;
}
- /* Check indentation level. */
+ /* Check intendation level. */
if (!parser->flow_level && (int)parser->mark.column < indent)
break;
diff --git a/ext/psych/yaml/yaml.h b/ext/psych/yaml/yaml.h
index acd72ad3a3..f33a152594 100644
--- a/ext/psych/yaml/yaml.h
+++ b/ext/psych/yaml/yaml.h
@@ -1089,7 +1089,7 @@ typedef struct yaml_parser_s {
yaml_error_type_t error;
/** Error description. */
const char *problem;
- /** The byte about which the problem occured. */
+ /** The byte about which the problem occurred. */
size_t problem_offset;
/** The problematic value (@c -1 is none). */
int problem_value;
@@ -1851,7 +1851,7 @@ YAML_DECLARE(void)
yaml_emitter_set_canonical(yaml_emitter_t *emitter, int canonical);
/**
- * Set the intendation increment.
+ * Set the indentation increment.
*
* @param[in,out] emitter An emitter object.
* @param[in] indent The indentation increment (1 < . < 10).
diff --git a/ext/psych/yaml/yaml_private.h b/ext/psych/yaml/yaml_private.h
index af10c83973..944499c94e 100644
--- a/ext/psych/yaml/yaml_private.h
+++ b/ext/psych/yaml/yaml_private.h
@@ -10,6 +10,17 @@
#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.
@@ -135,9 +146,12 @@ 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))
+ &(string).pointer, &(string).end)) ? \
+ 1 : \
+ ((context)->error = YAML_MEMORY_ERROR, \
+ 0))
#define CLEAR(context,string) \
((string).pointer = (string).start, \
@@ -422,7 +436,14 @@ yaml_queue_extend(void **start, void **head, void **tail, void **end);
(stack).start = (stack).top = (stack).end = 0)
#define STACK_EMPTY(context,stack) \
- ((stack).start == (stack).top)
+ ((void)(context), \
+ ((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 \
diff --git a/ext/pty/depend b/ext/pty/depend
index 2249eb8fcd..cfcd3c910e 100644
--- a/ext/pty/depend
+++ b/ext/pty/depend
@@ -1 +1,6 @@
-pty.o: pty.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h $(hdrdir)/io.h
+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/pty.c b/ext/pty/pty.c
index 8ac731404a..ec255cf202 100644
--- a/ext/pty/pty.c
+++ b/ext/pty/pty.c
@@ -22,6 +22,10 @@
#ifdef HAVE_PTY_H
#include <pty.h>
#endif
+#if defined(HAVE_SYS_PARAM_H)
+ /* for __FreeBSD_version */
+# include <sys/param.h>
+#endif
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#else
@@ -140,7 +144,7 @@ chfunc(void *data, char *errbuf, size_t errbuf_len)
dup2(slave,2);
close(slave);
#if defined(HAVE_SETEUID) || defined(HAVE_SETREUID) || defined(HAVE_SETRESUID)
- seteuid(getuid());
+ if (seteuid(getuid())) ERROR_EXIT("seteuid()");
#endif
return rb_exec_async_signal_safe(carg->eargp, errbuf, sizeof(errbuf_len));
@@ -228,9 +232,9 @@ get_device_once(int *master, int *slave, char SlaveName[DEVICELEN], int nomesg,
dfl.sa_flags = 0;
sigemptyset(&dfl.sa_mask);
-#if defined(__sun) || defined(__FreeBSD__)
+#if defined(__sun) || (defined(__FreeBSD__) && __FreeBSD_version < 902000)
/* workaround for Solaris 10: grantpt() doesn't work if FD_CLOEXEC is set. [ruby-dev:44688] */
- /* FreeBSD 8 supported O_CLOEXEC for posix_openpt, but FreeBSD 9 removed it.
+ /* FreeBSD 9.2 or later supports O_CLOEXEC
* http://www.freebsd.org/cgi/query-pr.cgi?pr=162374 */
if ((masterfd = posix_openpt(O_RDWR|O_NOCTTY)) == -1) goto error;
if (sigaction(SIGCHLD, &dfl, &old) == -1) goto error;
@@ -534,6 +538,11 @@ 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;
}
@@ -604,12 +613,12 @@ pty_getpty(int argc, VALUE *argv, VALUE self)
return res;
}
-NORETURN(static void raise_from_check(pid_t pid, int status));
+NORETURN(static void raise_from_check(rb_pid_t pid, int status));
static void
-raise_from_check(pid_t pid, int status)
+raise_from_check(rb_pid_t pid, int status)
{
const char *state;
- char buf[1024];
+ VALUE msg;
VALUE exc;
#if defined(WIFSTOPPED)
@@ -627,8 +636,8 @@ raise_from_check(pid_t pid, int status)
else {
state = "exited";
}
- snprintf(buf, sizeof(buf), "pty - %s: %ld", state, (long)pid);
- exc = rb_exc_new2(eChildExited, buf);
+ msg = rb_sprintf("pty - %s: %ld", state, (long)pid);
+ exc = rb_exc_new_str(eChildExited, msg);
rb_iv_set(exc, "status", rb_last_status_get());
rb_exc_raise(exc);
}
@@ -654,7 +663,7 @@ static VALUE
pty_check(int argc, VALUE *argv, VALUE self)
{
VALUE pid, exc;
- pid_t cpid;
+ rb_pid_t cpid;
int status;
rb_scan_args(argc, argv, "11", &pid, &exc);
diff --git a/ext/racc/cparse/README b/ext/racc/cparse/README
index 80b4dce311..7771108b84 100644
--- a/ext/racc/cparse/README
+++ b/ext/racc/cparse/README
@@ -6,5 +6,6 @@ Racc parser generator. If you want to generate
your own parser, you must get Racc full package.
Get it from:
- http://raa.ruby-lang.org/list.rhtml?name=racc
+ - http://i.loveruby.net/en/projects/racc
+ - https://github.com/tenderlove/racc
diff --git a/ext/racc/cparse/cparse.c b/ext/racc/cparse/cparse.c
index 10a9a030ac..36ad959222 100644
--- a/ext/racc/cparse/cparse.c
+++ b/ext/racc/cparse/cparse.c
@@ -91,7 +91,7 @@ num_to_long(VALUE n)
}
#define AREF(s, idx) \
- ((0 <= idx && idx < RARRAY_LEN(s)) ? RARRAY_PTR(s)[idx] : Qnil)
+ ((0 <= idx && idx < RARRAY_LEN(s)) ? rb_ary_entry(s, idx) : Qnil)
/* -----------------------------------------------------------------------
Parser Stack Interfaces
@@ -105,7 +105,7 @@ get_stack_tail(VALUE stack, long len)
{
if (len < 0) return Qnil; /* system error */
if (len > RARRAY_LEN(stack)) len = RARRAY_LEN(stack);
- return rb_ary_new4(len, RARRAY_PTR(stack) + RARRAY_LEN(stack) - len);
+ return rb_ary_subseq(stack, RARRAY_LEN(stack) - len, len);
}
static void
@@ -122,7 +122,7 @@ cut_stack_tail(VALUE stack, long len)
#define PUSH(s, i) rb_ary_store(s, RARRAY_LEN(s), i)
#define POP(s) rb_ary_pop(s)
#define LAST_I(s) \
- ((RARRAY_LEN(s) > 0) ? RARRAY_PTR(s)[RARRAY_LEN(s) - 1] : Qnil)
+ ((RARRAY_LEN(s) > 0) ? rb_ary_entry(s, RARRAY_LEN(s) - 1) : Qnil)
#define GET_TAIL(s, len) get_stack_tail(s, len)
#define CUT_TAIL(s, len) cut_stack_tail(s, len)
@@ -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 _((VALUE block_args, VALUE data, VALUE self));
+static VALUE lexer_i _((RB_BLOCK_CALL_FUNC_ARGLIST(block_args, data)));
static VALUE assert_array _((VALUE a));
static long assert_integer _((VALUE n));
@@ -282,7 +282,7 @@ call_lexer(struct cparse_params *v)
#endif
static VALUE
-lexer_i(VALUE block_args, VALUE data, VALUE self)
+lexer_i(RB_BLOCK_CALL_FUNC_ARGLIST(block_args, data))
{
struct cparse_params *v;
VALUE tok, val;
@@ -334,21 +334,21 @@ initialize_params(VALUE vparams, VALUE parser, VALUE arg, VALUE lexer, VALUE lex
Check_Type(arg, T_ARRAY);
if (!(13 <= RARRAY_LEN(arg) && RARRAY_LEN(arg) <= 14))
rb_raise(RaccBug, "[Racc Bug] wrong arg.size %ld", RARRAY_LEN(arg));
- v->action_table = assert_array (RARRAY_PTR(arg)[ 0]);
- v->action_check = assert_array (RARRAY_PTR(arg)[ 1]);
- v->action_default = assert_array (RARRAY_PTR(arg)[ 2]);
- v->action_pointer = assert_array (RARRAY_PTR(arg)[ 3]);
- v->goto_table = assert_array (RARRAY_PTR(arg)[ 4]);
- v->goto_check = assert_array (RARRAY_PTR(arg)[ 5]);
- v->goto_default = assert_array (RARRAY_PTR(arg)[ 6]);
- v->goto_pointer = assert_array (RARRAY_PTR(arg)[ 7]);
- v->nt_base = assert_integer(RARRAY_PTR(arg)[ 8]);
- v->reduce_table = assert_array (RARRAY_PTR(arg)[ 9]);
- v->token_table = assert_hash (RARRAY_PTR(arg)[10]);
- v->shift_n = assert_integer(RARRAY_PTR(arg)[11]);
- v->reduce_n = assert_integer(RARRAY_PTR(arg)[12]);
+ v->action_table = assert_array (rb_ary_entry(arg, 0));
+ v->action_check = assert_array (rb_ary_entry(arg, 1));
+ v->action_default = assert_array (rb_ary_entry(arg, 2));
+ v->action_pointer = assert_array (rb_ary_entry(arg, 3));
+ v->goto_table = assert_array (rb_ary_entry(arg, 4));
+ v->goto_check = assert_array (rb_ary_entry(arg, 5));
+ v->goto_default = assert_array (rb_ary_entry(arg, 6));
+ v->goto_pointer = assert_array (rb_ary_entry(arg, 7));
+ v->nt_base = assert_integer(rb_ary_entry(arg, 8));
+ v->reduce_table = assert_array (rb_ary_entry(arg, 9));
+ v->token_table = assert_hash (rb_ary_entry(arg, 10));
+ v->shift_n = assert_integer(rb_ary_entry(arg, 11));
+ v->reduce_n = assert_integer(rb_ary_entry(arg, 12));
if (RARRAY_LEN(arg) > 13) {
- v->use_result_var = RTEST(RARRAY_PTR(arg)[13]);
+ v->use_result_var = RTEST(rb_ary_entry(arg, 13));
}
else {
v->use_result_var = TRUE;
@@ -418,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 %s (must be Array[2])",
+ "%s() %s %"PRIsVALUE" (must be Array[2])",
v->lex_is_iterator ? rb_id2name(v->lexmid) : "next_token",
v->lex_is_iterator ? "yielded" : "returned",
- rb_class2name(CLASS_OF(block_args)));
+ rb_obj_class(block_args));
}
if (RARRAY_LEN(block_args) != 2) {
rb_raise(rb_eArgError,
@@ -564,7 +564,7 @@ parse_main(struct cparse_params *v, VALUE tok, VALUE val, int resume)
accept:
if (v->debug) rb_funcall(v->parser, id_d_accept, 0);
- v->retval = RARRAY_PTR(v->vstack)[0];
+ v->retval = rb_ary_entry(v->vstack, 0);
v->fin = CP_FIN_ACCEPT;
return;
@@ -693,9 +693,9 @@ reduce0(VALUE val, VALUE data, VALUE self)
VALUE goto_state;
Data_Get_Struct(data, struct cparse_params, v);
- reduce_len = RARRAY_PTR(v->reduce_table)[v->ruleno];
- reduce_to = RARRAY_PTR(v->reduce_table)[v->ruleno+1];
- method_id = RARRAY_PTR(v->reduce_table)[v->ruleno+2];
+ 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);
len = NUM2LONG(reduce_len);
mid = value_to_id(method_id);
@@ -710,10 +710,10 @@ reduce0(VALUE val, VALUE data, VALUE self)
else {
if (mid != id_noreduce) {
tmp_v = GET_TAIL(v->vstack, len);
- tmp = RARRAY_PTR(tmp_v)[0];
+ tmp = rb_ary_entry(tmp_v, 0);
}
else {
- tmp = RARRAY_PTR(v->vstack)[ RARRAY_LEN(v->vstack) - len ];
+ tmp = rb_ary_entry(v->vstack, RARRAY_LEN(v->vstack) - len);
}
CUT_TAIL(v->vstack, len);
if (v->debug) {
diff --git a/ext/racc/cparse/depend b/ext/racc/cparse/depend
deleted file mode 100644
index 7b06a880f5..0000000000
--- a/ext/racc/cparse/depend
+++ /dev/null
@@ -1 +0,0 @@
-cparse.o: cparse.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
diff --git a/ext/rbconfig/sizeof/depend b/ext/rbconfig/sizeof/depend
new file mode 100644
index 0000000000..360b3386d3
--- /dev/null
+++ b/ext/rbconfig/sizeof/depend
@@ -0,0 +1,3 @@
+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
diff --git a/ext/rbconfig/sizeof/extconf.rb b/ext/rbconfig/sizeof/extconf.rb
new file mode 100644
index 0000000000..ac66b6ac26
--- /dev/null
+++ b/ext/rbconfig/sizeof/extconf.rb
@@ -0,0 +1,3 @@
+$srcs = %w[sizes.c]
+$distcleanfiles.concat($srcs)
+create_makefile('rbconfig/sizeof')
diff --git a/ext/readline/README.ja b/ext/readline/README.ja
index f1b42f25bc..57a6ee4126 100644
--- a/ext/readline/README.ja
+++ b/ext/readline/README.ja
@@ -25,8 +25,6 @@ GNU Readline のように入力の補完やEmacs のようなキー操作など
使用するライブラリにより、いくつかのメソッドで例外 NotImplementedError
が発生します。
-$SAFE が 4 の場合、多くのメソッドで例外 SecurityError が発生します。
-
== Readline モジュール
=== モジュール関数
@@ -112,8 +110,6 @@ readline([prompt, [add_hist]]) -> String | nil
print "-> ", buf, "\n"
end
- $SAFE が 4 の場合、例外 SecurityError が発生します。
-
=== クラスメソッド
Readline.input = input
@@ -121,15 +117,11 @@ Readline.input = input
Readline.readline メソッドで使用する入力用の File オブジェクト input
を指定します。
- $SAFE が 4 の場合、例外 SecurityError が発生します。
-
Readline.output = output
Readline.readline メソッドで使用する出力用の File オブジェクト
output を指定します。
- $SAFE が 4 の場合、例外 SecurityError が発生します。
-
Readline.completion_proc = proc
ユーザからの入力を補完する時の候補を取得する Proc オブジェクト proc を
@@ -146,22 +138,16 @@ Readline.completion_proc = proc
のを単語とすると、カーソルがある単語の最初の文字から現在のカーソル位
置までの文字列が proc の引数に渡されます。
- $SAFE が 4 の場合、例外 SecurityError が発生します。
-
Readline.completion_proc -> proc
ユーザからの入力を補完する時の候補を取得する Proc オブジェクト proc
を取得します。
- $SAFE が 4 の場合、例外 SecurityError が発生します。
-
Readline.completion_case_fold = bool
ユーザの入力を補完する際、大文字と小文字を区別する/しないを指定します。
bool が真ならば区別しません。bool が偽ならば区別します。
- $SAFE が 4 の場合、例外 SecurityError が発生します。
-
Readline.completion_case_fold -> bool
ユーザの入力を補完する際、大文字と小文字を区別する/しないを取得します。
@@ -175,8 +161,6 @@ Readline.completion_case_fold -> bool
Readline.completion_case_fold = "This is a String."
p Readline.completion_case_fold # => "This is a String."
- $SAFE が 4 の場合、例外 SecurityError が発生します。
-
Readline.line_buffer -> string
入力中の行全体を返します。complete_proc の中で使用することを想定し
@@ -199,8 +183,6 @@ Readline.vi_editing_mode -> nil
サポートしていない環境では、例外 NotImplementedError が発生します。
- $SAFE が 4 の場合、例外 SecurityError が発生します。
-
Readline.vi_editing_mode? -> bool
編集モードが vi モードの場合、true を返します。そうでなければ false
@@ -208,8 +190,6 @@ Readline.vi_editing_mode? -> bool
サポートしていない環境では、例外 NotImplementedError が発生します。
- $SAFE が 4 の場合、例外 SecurityError が発生します。
-
Readline.emacs_editing_mode -> nil
編集モードを Emacs モードにします。
@@ -218,8 +198,6 @@ Readline.emacs_editing_mode -> nil
サポートしていない環境では、例外 NotImplementedError が発生します。
- $SAFE が 4 の場合、例外 SecurityError が発生します。
-
Readline.emacs_editing_mode? -> bool
編集モードが Emacs モードの場合、true を返します。そうでなければ false
@@ -227,8 +205,6 @@ Readline.emacs_editing_mode? -> bool
サポートしていない環境では、例外 NotImplementedError が発生します。
- $SAFE が 4 の場合、例外 SecurityError が発生します。
-
Readline.completion_append_character = char
ユーザの入力の補完が完了した場合に、最後に付加する文字 char を指定し
@@ -265,8 +241,6 @@ Readline.completion_append_character = char
サポートしていない環境では、例外 NotImplementedError が発生します。
- $SAFE が 4 の場合、例外 SecurityError が発生します。
-
Readline.completion_append_character -> char
ユーザの入力の補完が完了した場合に、最後に付加する文字を取得します。
@@ -274,8 +248,6 @@ Readline.completion_append_character -> char
サポートしていない環境では、例外 NotImplementedError が発生します。
- $SAFE が 4 の場合、例外 SecurityError が発生します。
-
Readline.basic_word_break_characters = string
ユーザの入力の補完を行う際、単語の区切りを示す複数の文字で構成される
@@ -286,8 +258,6 @@ Readline.basic_word_break_characters = string
サポートしていない環境では、例外 NotImplementedError が発生します。
- $SAFE が 4 の場合、例外 SecurityError が発生します。
-
Readline.basic_word_break_characters -> string
ユーザの入力の補完を行う際、単語の区切りを示す複数の文字で構成される
@@ -295,8 +265,6 @@ Readline.basic_word_break_characters -> string
サポートしていない環境では、例外 NotImplementedError が発生します。
- $SAFE が 4 の場合、例外 SecurityError が発生します。
-
Readline.completer_word_break_characters = string
ユーザの入力の補完を行う際、単語の区切りを示す複数の文字で構成される
@@ -309,8 +277,6 @@ Readline.completer_word_break_characters = string
サポートしていない環境では、例外 NotImplementedError が発生します。
- $SAFE が 4 の場合、例外 SecurityError が発生します。
-
Readline.completer_word_break_characters -> string
ユーザの入力の補完を行う際、単語の区切りを示す複数の文字で構成された
@@ -318,8 +284,6 @@ Readline.completer_word_break_characters -> string
サポートしていない環境では、例外 NotImplementedError が発生します。
- $SAFE が 4 の場合、例外 SecurityError が発生します。
-
Readline.basic_quote_characters = string
スペースなどの単語の区切りをクオートするための複数の文字で構成される
@@ -327,8 +291,6 @@ Readline.basic_quote_characters = string
サポートしていない環境では、例外 NotImplementedError が発生します。
- $SAFE が 4 の場合、例外 SecurityError が発生します。
-
Readline.basic_quote_characters -> string
スペースなどの単語の区切りをクオートするための複数の文字で構成される
@@ -336,8 +298,6 @@ Readline.basic_quote_characters -> string
サポートしていない環境では、例外 NotImplementedError が発生します。
- $SAFE が 4 の場合、例外 SecurityError が発生します。
-
Readline.completer_quote_characters = string
ユーザの入力の補完を行う際、スペースなどの単語の区切りを
@@ -347,8 +307,6 @@ Readline.completer_quote_characters = string
サポートしていない環境では、例外 NotImplementedError が発生します。
- $SAFE が 4 の場合、例外 SecurityError が発生します。
-
Readline.completer_quote_characters -> string
ユーザの入力の補完を行う際、スペースなどの単語の区切りを
@@ -356,8 +314,6 @@ Readline.completer_quote_characters -> string
サポートしていない環境では、例外 NotImplementedError が発生します。
- $SAFE が 4 の場合、例外 SecurityError が発生します。
-
Readline.filename_quote_characters = string
ユーザの入力時にファイル名の補完を行う際、スペースなどの単語の区切りを
@@ -367,8 +323,6 @@ Readline.filename_quote_characters = string
サポートしていない環境では、例外 NotImplementedError が発生します。
- $SAFE が 4 の場合、例外 SecurityError が発生します。
-
Readline.filename_quote_characters -> string
ユーザの入力時にファイル名の補完を行う際、スペースなどの単語の区切りを
@@ -376,8 +330,6 @@ Readline.filename_quote_characters -> string
サポートしていない環境では、例外 NotImplementedError が発生します。
- $SAFE が 4 の場合、例外 SecurityError が発生します。
-
=== クラス定数
HISTORY
@@ -415,9 +367,6 @@ HISTORY
* HISTORY.delete_at(index) -> string
* HISTORY.clear -> self
- $SAFE が 4 の場合、ヒストリにアクセスしたときに例外 SecurityError が
- 発生します。
-
FILENAME_COMPLETION_PROC
ファイル名の補完を行う call メソッドを持つオブジェクトです。
diff --git a/ext/readline/depend b/ext/readline/depend
index 6570c5a036..5780d8d42a 100644
--- a/ext/readline/depend
+++ b/ext/readline/depend
@@ -1 +1,6 @@
-readline.o: readline.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
+readline.o: readline.c $(HDRS) $(ruby_headers) \
+ $(top_srcdir)/internal.h \
+ $(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 4920137bf1..c79370bf4c 100644
--- a/ext/readline/extconf.rb
+++ b/ext/readline/extconf.rb
@@ -19,6 +19,10 @@ 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')
@@ -93,4 +97,13 @@ readline.have_func("remove_history")
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 502e73e5c8..5ceaaf780b 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -6,12 +6,12 @@
created at: Wed Jan 20 13:59:32 JST 1999
Copyright (C) 1997-2008 Shugo Maeda
- Copyright (C) 2008-2009 TAKAO Kouji
+ Copyright (C) 2008-2013 Kouji Takao
$Id$
Contact:
- - TAKAO Kouji <kouji at takao7 dot net> (current maintainer)
+ - Kouji Takao <kouji dot takao at gmail dot com> (current maintainer)
************************************************/
@@ -35,6 +35,8 @@
#include "ruby/ruby.h"
#include "ruby/io.h"
+#include "ruby/thread.h"
+#include "internal.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
@@ -123,27 +125,33 @@ static char **readline_attempted_completion_function(const char *text,
* print("-> ", buf, "\n")
* end
*
- * Most of methods raise SecurityError exception if $SAFE is 4.
- *
- * Documented by TAKAO Kouji <kouji at takao7 dot net>.
+ * Documented by Kouji Takao <kouji dot takao at gmail dot com>.
*/
-#if defined HAVE_RL_GETC_FUNCTION
static VALUE readline_instream;
+static VALUE readline_outstream;
+static FILE *readline_rl_instream;
+static FILE *readline_rl_outstream;
+
+#if defined HAVE_RL_GETC_FUNCTION
#ifndef HAVE_RL_GETC
#define rl_getc(f) EOF
#endif
-static int readline_getc(FILE *);
+struct getc_struct {
+ FILE *input;
+ int fd;
+ int ret;
+ int err;
+};
+
static int
-readline_getc(FILE *input)
+getc_body(struct getc_struct *p)
{
- rb_io_t *ifp = 0;
- VALUE c;
- if (!readline_instream) return rl_getc(input);
- GetOpenFile(readline_instream, ifp);
- if (rl_instream != ifp->stdio_file) return rl_getc(input);
+ char ch;
+ ssize_t ss;
+
#if defined(_WIN32)
{
INPUT_RECORD ir;
@@ -151,19 +159,19 @@ readline_getc(FILE *input)
static int prior_key = '0';
for (;;) {
if (prior_key > 0xff) {
- prior_key = rl_getc(ifp->stdio_file);
+ prior_key = rl_getc(p->input);
return prior_key;
}
- if (PeekConsoleInput((HANDLE)_get_osfhandle(ifp->fd), &ir, 1, &n)) {
+ if (PeekConsoleInput((HANDLE)_get_osfhandle(p->fd), &ir, 1, &n)) {
if (n == 1) {
if (ir.EventType == KEY_EVENT && ir.Event.KeyEvent.bKeyDown) {
- prior_key = rl_getc(ifp->stdio_file);
+ prior_key = rl_getc(p->input);
return prior_key;
} else {
- ReadConsoleInput((HANDLE)_get_osfhandle(ifp->fd), &ir, 1, &n);
+ ReadConsoleInput((HANDLE)_get_osfhandle(p->fd), &ir, 1, &n);
}
} else {
- HANDLE h = (HANDLE)_get_osfhandle(ifp->fd);
+ HANDLE h = (HANDLE)_get_osfhandle(p->fd);
rb_w32_wait_events(&h, 1, INFINITE);
}
} else {
@@ -172,22 +180,62 @@ readline_getc(FILE *input)
}
}
#endif
- c = rb_io_getbyte(readline_instream);
- if (NIL_P(c)) return EOF;
-#ifdef ESC
- if (c == INT2FIX(ESC) &&
- RL_ISSTATE(RL_STATE_ISEARCH) && /* isn't needed in other states? */
- rb_io_read_pending(ifp)) {
- int meta = 0;
- c = rb_io_getbyte(readline_instream);
- if (FIXNUM_P(c) && isascii(FIX2INT(c))) meta = 1;
- rb_io_ungetbyte(readline_instream, c);
- if (meta) rl_execute_next(ESC);
- return ESC;
+
+ ss = read(p->fd, &ch, 1);
+ if (ss == 0) {
+ errno = 0;
+ return EOF;
}
-#endif
- return FIX2INT(c);
+ if (ss != 1)
+ return EOF;
+ return (unsigned char)ch;
}
+
+static void *
+getc_func(void *data1)
+{
+ struct getc_struct *p = data1;
+ errno = 0;
+ p->ret = getc_body(p);
+ p->err = errno;
+ return NULL;
+}
+
+static int
+readline_getc(FILE *input)
+{
+ struct getc_struct data;
+ if (input == NULL) /* editline may give NULL as input. */
+ input = stdin;
+ data.input = input;
+ data.fd = fileno(input);
+ again:
+ data.ret = EOF;
+ data.err = EINTR; /* getc_func is not called if already interrupted. */
+ rb_thread_call_without_gvl2(getc_func, &data, RUBY_UBF_IO, NULL);
+ if (data.ret == EOF) {
+ if (data.err == 0) {
+ return EOF;
+ }
+ if (data.err == EINTR) {
+ rb_thread_check_ints();
+ goto again;
+ }
+ if (data.err == EWOULDBLOCK || data.err == EAGAIN) {
+ int ret;
+ if (fileno(input) != data.fd)
+ rb_bug("readline_getc: input closed unexpectedly or memory corrupted");
+ ret = rb_wait_for_single_fd(data.fd, RB_WAITFD_IN, NULL);
+ if (ret != -1 || errno == EINTR)
+ goto again;
+ rb_sys_fail("rb_wait_for_single_fd");
+ }
+ errno = data.err;
+ rb_sys_fail("read");
+ }
+ return data.ret;
+}
+
#elif defined HAVE_RL_EVENT_HOOK
#define BUSY_WAIT 0
@@ -219,56 +267,56 @@ insert_ignore_escape(VALUE self, VALUE prompt)
if (orig_prompt == prompt) return last_prompt;
len = RSTRING_LEN(prompt);
if (NIL_P(last_prompt)) {
- last_prompt = rb_str_tmp_new(len);
+ last_prompt = rb_str_tmp_new(len);
}
s = s0 = RSTRING_PTR(prompt);
e = s0 + len;
rb_str_set_len(last_prompt, 0);
while (s < e && *s) {
- switch (*s) {
- case RL_PROMPT_START_IGNORE:
- ignoring = -1;
- rb_str_cat(last_prompt, s0, ++s - s0);
- s0 = s;
- break;
- case RL_PROMPT_END_IGNORE:
- ignoring = 0;
- rb_str_cat(last_prompt, s0, ++s - s0);
- s0 = s;
- break;
- case '\033':
- if (++s < e && *s == '[') {
- rb_str_cat(last_prompt, s0, s - s0 - 1);
- s0 = s - 1;
- while (++s < e && *s) {
- if (ISALPHA(*s)) {
- if (!ignoring) {
- ignoring = 1;
- rb_str_cat(last_prompt, ignore_code+0, 1);
- }
- rb_str_cat(last_prompt, s0, ++s - s0);
- s0 = s;
- break;
- }
- else if (!('0' <= *s && *s <= '9' || *s == ';')) {
- break;
- }
- }
- }
- break;
- default:
- if (ignoring > 0) {
- ignoring = 0;
- rb_str_cat(last_prompt, ignore_code+1, 1);
- }
- s++;
- break;
- }
+ switch (*s) {
+ case RL_PROMPT_START_IGNORE:
+ ignoring = -1;
+ rb_str_cat(last_prompt, s0, ++s - s0);
+ s0 = s;
+ break;
+ case RL_PROMPT_END_IGNORE:
+ ignoring = 0;
+ rb_str_cat(last_prompt, s0, ++s - s0);
+ s0 = s;
+ break;
+ case '\033':
+ if (++s < e && *s == '[') {
+ rb_str_cat(last_prompt, s0, s - s0 - 1);
+ s0 = s - 1;
+ while (++s < e && *s) {
+ if (ISALPHA(*(unsigned char *)s)) {
+ if (!ignoring) {
+ ignoring = 1;
+ rb_str_cat(last_prompt, ignore_code+0, 1);
+ }
+ rb_str_cat(last_prompt, s0, ++s - s0);
+ s0 = s;
+ break;
+ }
+ else if (!(('0' <= *s && *s <= '9') || *s == ';')) {
+ break;
+ }
+ }
+ }
+ break;
+ default:
+ if (ignoring > 0) {
+ ignoring = 0;
+ rb_str_cat(last_prompt, ignore_code+1, 1);
+ }
+ s++;
+ break;
+ }
}
if (ignoring > 0) {
- ignoring = 0;
- rb_str_cat(last_prompt, ignore_code+1, 1);
+ ignoring = 0;
+ rb_str_cat(last_prompt, ignore_code+1, 1);
}
rb_str_cat(last_prompt, s0, s - s0);
@@ -288,6 +336,30 @@ readline_get(VALUE prompt)
return (VALUE)readline((char *)prompt);
}
+static void
+clear_rl_instream(void)
+{
+ if (readline_rl_instream) {
+ fclose(readline_rl_instream);
+ if (rl_instream == readline_rl_instream)
+ rl_instream = NULL;
+ readline_rl_instream = NULL;
+ }
+ readline_instream = Qfalse;
+}
+
+static void
+clear_rl_outstream(void)
+{
+ if (readline_rl_outstream) {
+ fclose(readline_rl_outstream);
+ if (rl_outstream == readline_rl_outstream)
+ rl_outstream = NULL;
+ readline_rl_outstream = NULL;
+ }
+ readline_outstream = Qfalse;
+}
+
/*
* call-seq:
* Readline.readline(prompt = "", add_hist = false) -> string or nil
@@ -298,11 +370,11 @@ readline_get(VALUE prompt)
* Returns nil when the inputted line is empty and user inputs EOF
* (Presses ^D on UNIX).
*
- * Raises IOError exception if below conditions are satisfied.
- * 1. stdin is not tty.
- * 2. stdin was closed. (errno is EBADF after called isatty(2).)
+ * Raises IOError exception if one of below conditions are satisfied.
+ * 1. stdin was closed.
+ * 2. stdout was closed.
*
- * This method supports thread. Switchs the thread context when waits
+ * This method supports thread. Switches the thread context when waits
* inputting line.
*
* Supports line edit when inputs line. Provides VI and Emacs editing mode.
@@ -371,8 +443,6 @@ readline_get(VALUE prompt)
* # p Readline::HISTORY.to_a
* print "-> ", buf, "\n"
* end
- *
- * Raises SecurityError exception if $SAFE is 4.
*/
static VALUE
readline_readline(int argc, VALUE *argv, VALUE self)
@@ -382,23 +452,31 @@ readline_readline(int argc, VALUE *argv, VALUE self)
char *buff;
int status;
- rb_secure(4);
if (rb_scan_args(argc, argv, "02", &tmp, &add_hist) > 0) {
- OutputStringValue(tmp);
+ OutputStringValue(tmp);
#if USE_INSERT_IGNORE_ESCAPE
- tmp = insert_ignore_escape(self, tmp);
- rb_str_locktmp(tmp);
+ tmp = insert_ignore_escape(self, tmp);
+ rb_str_locktmp(tmp);
#endif
- prompt = RSTRING_PTR(tmp);
+ prompt = RSTRING_PTR(tmp);
}
- if (!isatty(fileno(rl_instream)) && errno == EBADF) rb_raise(rb_eIOError, "closed stdin");
- if (rl_outstream) {
- struct stat stbuf;
- int fd = fileno(rl_outstream);
- if (fd < 0 || fstat(fd, &stbuf) != 0) {
- rb_raise(rb_eIOError, "closed stdout");
- }
+ 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
@@ -407,7 +485,7 @@ readline_readline(int argc, VALUE *argv, VALUE self)
buff = (char*)rb_protect(readline_get, (VALUE)prompt, &status);
#if USE_INSERT_IGNORE_ESCAPE
if (prompt) {
- rb_str_unlocktmp(tmp);
+ rb_str_unlocktmp(tmp);
}
#endif
if (status) {
@@ -419,9 +497,9 @@ readline_readline(int argc, VALUE *argv, VALUE self)
rl_cleanup_after_signal();
#elif defined HAVE_RL_DEPREP_TERM_FUNCTION
/* restore terminal mode */
- if (rl_deprep_term_function != NULL) /* NULL in libedit. [ruby-dev:29116] */
- (*rl_deprep_term_function)();
- else
+ if (rl_deprep_term_function != NULL) /* NULL in libedit. [ruby-dev:29116] */
+ (*rl_deprep_term_function)();
+ else
#else
rl_deprep_terminal();
#endif
@@ -429,13 +507,13 @@ readline_readline(int argc, VALUE *argv, VALUE self)
}
if (RTEST(add_hist) && buff) {
- add_history(buff);
+ add_history(buff);
}
if (buff) {
- result = rb_locale_str_new_cstr(buff);
+ result = rb_locale_str_new_cstr(buff);
}
else
- result = Qnil;
+ result = Qnil;
if (buff) free(buff);
return result;
}
@@ -446,21 +524,34 @@ readline_readline(int argc, VALUE *argv, VALUE self)
*
* Specifies a File object +input+ that is input stream for
* Readline.readline method.
- *
- * Raises SecurityError exception if $SAFE is 4.
*/
static VALUE
readline_s_set_input(VALUE self, VALUE input)
{
rb_io_t *ifp;
+ int fd;
+ FILE *f;
- rb_secure(4);
- Check_Type(input, T_FILE);
- GetOpenFile(input, ifp);
- rl_instream = rb_io_stdio_file(ifp);
-#ifdef HAVE_RL_GETC_FUNCTION
- readline_instream = input;
-#endif
+ if (NIL_P(input)) {
+ clear_rl_instream();
+ }
+ else {
+ Check_Type(input, T_FILE);
+ GetOpenFile(input, ifp);
+ clear_rl_instream();
+ fd = rb_cloexec_dup(ifp->fd);
+ if (fd == -1)
+ rb_sys_fail("dup");
+ f = fdopen(fd, "r");
+ if (f == NULL) {
+ int save_errno = errno;
+ close(fd);
+ errno = save_errno;
+ rb_sys_fail("fdopen");
+ }
+ rl_instream = readline_rl_instream = f;
+ readline_instream = input;
+ }
return input;
}
@@ -470,18 +561,34 @@ readline_s_set_input(VALUE self, VALUE input)
*
* Specifies a File object +output+ that is output stream for
* Readline.readline method.
- *
- * Raises SecurityError exception if $SAFE is 4.
*/
static VALUE
readline_s_set_output(VALUE self, VALUE output)
{
rb_io_t *ofp;
+ int fd;
+ FILE *f;
- rb_secure(4);
- Check_Type(output, T_FILE);
- GetOpenFile(output, ofp);
- rl_outstream = rb_io_stdio_file(ofp);
+ if (NIL_P(output)) {
+ clear_rl_outstream();
+ }
+ else {
+ Check_Type(output, T_FILE);
+ GetOpenFile(output, ofp);
+ clear_rl_outstream();
+ fd = rb_cloexec_dup(ofp->fd);
+ if (fd == -1)
+ rb_sys_fail("dup");
+ f = fdopen(fd, "w");
+ if (f == NULL) {
+ int save_errno = errno;
+ close(fd);
+ errno = save_errno;
+ rb_sys_fail("fdopen");
+ }
+ rl_outstream = readline_rl_outstream = f;
+ readline_outstream = output;
+ }
return output;
}
@@ -498,14 +605,13 @@ readline_s_set_output(VALUE self, VALUE output)
*
* Raises ArgumentError if +proc+ does not respond to the call method.
*
- * Raises SecurityError if $SAFE is 4.
+ * Raises NotImplementedError if the using readline library does not support.
*/
static VALUE
readline_s_set_pre_input_hook(VALUE self, VALUE proc)
{
- rb_secure(4);
if (!NIL_P(proc) && !rb_respond_to(proc, rb_intern("call")))
- rb_raise(rb_eArgError, "argument must respond to `call'");
+ rb_raise(rb_eArgError, "argument must respond to `call'");
return rb_ivar_set(mReadline, id_pre_input_hook, proc);
}
@@ -517,12 +623,11 @@ readline_s_set_pre_input_hook(VALUE self, VALUE proc)
* been printed and just before readline starts reading input
* characters. The default is nil.
*
- * Raises SecurityError if $SAFE is 4.
+ * Raises NotImplementedError if the using readline library does not support.
*/
static VALUE
readline_s_get_pre_input_hook(VALUE self)
{
- rb_secure(4);
return rb_attr_get(mReadline, id_pre_input_hook);
}
@@ -533,7 +638,7 @@ readline_pre_input_hook(void)
proc = rb_attr_get(mReadline, id_pre_input_hook);
if (!NIL_P(proc))
- rb_funcall(proc, rb_intern("call"), 0);
+ rb_funcall(proc, rb_intern("call"), 0);
return 0;
}
#else
@@ -550,12 +655,11 @@ readline_pre_input_hook(void)
*
* See GNU Readline's rl_insert_text function.
*
- * Raises SecurityError if $SAFE is 4.
+ * Raises NotImplementedError if the using readline library does not support.
*/
static VALUE
readline_s_insert_text(VALUE self, VALUE str)
{
- rb_secure(4);
OutputStringValue(str);
rl_insert_text(RSTRING_PTR(str));
return self;
@@ -564,6 +668,52 @@ readline_s_insert_text(VALUE self, VALUE str)
#define readline_s_insert_text rb_f_notimplement
#endif
+#if defined(HAVE_RL_DELETE_TEXT)
+/*
+ * call-seq:
+ * Readline.delete_text([start[, length]]) -> self
+ * Readline.delete_text(start..end) -> self
+ * Readline.delete_text() -> self
+ *
+ * Delete text between start and end in the current line.
+ *
+ * See GNU Readline's rl_delete_text function.
+ *
+ * Raises NotImplementedError if the using readline library does not support.
+ */
+static VALUE
+readline_s_delete_text(int argc, VALUE *argv, VALUE self)
+{
+ rb_check_arity(argc, 0, 2);
+ if (rl_line_buffer) {
+ 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());
+ OBJ_FREEZE(str);
+ if (argc == 2) {
+ beg = NUM2LONG(argv[0]);
+ len = NUM2LONG(argv[1]);
+ num_pos:
+ p = rb_str_subpos(str, beg, &len);
+ if (!p) rb_raise(rb_eArgError, "invalid index");
+ beg = p - ptr;
+ }
+ else if (argc == 1) {
+ len = rb_str_strlen(str);
+ if (!rb_range_beg_len(argv[0], &beg, &len, len, 1)) {
+ beg = NUM2LONG(argv[0]);
+ goto num_pos;
+ }
+ }
+ rl_delete_text(rb_long2int(beg), rb_long2int(beg + len));
+ }
+ return self;
+}
+#else
+#define readline_s_delete_text rb_f_notimplement
+#endif
+
#if defined(HAVE_RL_REDISPLAY)
/*
* call-seq:
@@ -574,12 +724,11 @@ readline_s_insert_text(VALUE self, VALUE str)
*
* See GNU Readline's rl_redisplay function.
*
- * Raises SecurityError if $SAFE is 4.
+ * Raises NotImplementedError if the using readline library does not support.
*/
static VALUE
readline_s_redisplay(VALUE self)
{
- rb_secure(4);
rl_redisplay();
return self;
}
@@ -654,15 +803,12 @@ readline_s_redisplay(VALUE self)
* It may also be helpful to use the Abbrev library to generate completions.
*
* Raises ArgumentError if +proc+ does not respond to the call method.
- *
- * Raises SecurityError if $SAFE is 4.
*/
static VALUE
readline_s_set_completion_proc(VALUE self, VALUE proc)
{
- rb_secure(4);
if (!NIL_P(proc) && !rb_respond_to(proc, rb_intern("call")))
- rb_raise(rb_eArgError, "argument must respond to `call'");
+ rb_raise(rb_eArgError, "argument must respond to `call'");
return rb_ivar_set(mReadline, completion_proc, proc);
}
@@ -671,13 +817,10 @@ readline_s_set_completion_proc(VALUE self, VALUE proc)
* Readline.completion_proc -> proc
*
* Returns the completion Proc object.
- *
- * Raises SecurityError exception if $SAFE is 4.
*/
static VALUE
readline_s_get_completion_proc(VALUE self)
{
- rb_secure(4);
return rb_attr_get(mReadline, completion_proc);
}
@@ -686,13 +829,10 @@ readline_s_get_completion_proc(VALUE self)
* Readline.completion_case_fold = bool
*
* Sets whether or not to ignore case on completion.
- *
- * Raises SecurityError exception if $SAFE is 4.
*/
static VALUE
readline_s_set_completion_case_fold(VALUE self, VALUE val)
{
- rb_secure(4);
return rb_ivar_set(mReadline, completion_case_fold, val);
}
@@ -709,13 +849,10 @@ readline_s_set_completion_case_fold(VALUE self, VALUE val)
*
* Readline.completion_case_fold = "This is a String."
* p Readline.completion_case_fold # => "This is a String."
- *
- * Raises SecurityError exception if $SAFE is 4.
*/
static VALUE
readline_s_get_completion_case_fold(VALUE self)
{
- rb_secure(4);
return rb_attr_get(mReadline, completion_case_fold);
}
@@ -730,13 +867,14 @@ readline_s_get_completion_case_fold(VALUE self)
*
* The length of +Readline.line_buffer+ and GNU Readline's rl_end are
* same.
+ *
+ * Raises NotImplementedError if the using readline library does not support.
*/
static VALUE
readline_s_get_line_buffer(VALUE self)
{
- rb_secure(4);
if (rl_line_buffer == NULL)
- return Qnil;
+ return Qnil;
return rb_locale_str_new_cstr(rl_line_buffer);
}
#else
@@ -756,15 +894,35 @@ readline_s_get_line_buffer(VALUE self)
* the length of input-string from +Readline.point+.
*
* start = (the length of input-string) - Readline.point
+ *
+ * Raises NotImplementedError if the using readline library does not support.
*/
static VALUE
readline_s_get_point(VALUE self)
{
- rb_secure(4);
return INT2NUM(rl_point);
}
+
+/*
+ * call-seq:
+ * Readline.point = int
+ *
+ * Set the index of the current cursor position in
+ * +Readline.line_buffer+.
+ *
+ * Raises NotImplementedError if the using readline library does not support.
+ *
+ * See +Readline.point+.
+ */
+static VALUE
+readline_s_set_point(VALUE self, VALUE pos)
+{
+ rl_point = NUM2INT(pos);
+ return pos;
+}
#else
#define readline_s_get_point rb_f_notimplement
+#define readline_s_set_point rb_f_notimplement
#endif
static char **
@@ -779,7 +937,7 @@ readline_attempted_completion_function(const char *text, int start, int end)
proc = rb_attr_get(mReadline, completion_proc);
if (NIL_P(proc))
- return NULL;
+ return NULL;
#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER
rl_completion_append_character = readline_completion_append_character;
#endif
@@ -789,7 +947,7 @@ readline_attempted_completion_function(const char *text, int start, int end)
case_fold = RTEST(rb_attr_get(mReadline, completion_case_fold));
ary = rb_funcall(proc, rb_intern("call"), 1, rb_locale_str_new_cstr(text));
if (!RB_TYPE_P(ary, T_ARRAY))
- ary = rb_Array(ary);
+ ary = rb_Array(ary);
matches = RARRAY_LEN(ary);
if (matches == 0) return NULL;
result = (char**)malloc((matches + 2)*sizeof(char*));
@@ -797,12 +955,12 @@ 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_PTR(ary)[i]);
- StringValueCStr(temp); /* must be NUL-terminated */
- rb_enc_check(encobj, temp);
- result[i + 1] = (char*)malloc(RSTRING_LEN(temp) + 1);
- if (result[i + 1] == NULL) rb_memerror();
- strcpy(result[i + 1], RSTRING_PTR(temp));
+ 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);
+ if (result[i + 1] == NULL) rb_memerror();
+ strcpy(result[i + 1], RSTRING_PTR(temp));
}
result[matches + 1] = NULL;
@@ -810,32 +968,32 @@ readline_attempted_completion_function(const char *text, int start, int end)
result[0] = strdup(result[1]);
}
else {
- const char *result1 = result[1];
- long low = strlen(result1);
-
- for (i = 1; i < matches; ++i) {
- register int c1, c2;
- long i1, i2, l2;
- int n1, n2;
- const char *p2 = result[i + 1];
-
- l2 = strlen(p2);
- for (i1 = i2 = 0; i1 < low && i2 < l2; i1 += n1, i2 += n2) {
- c1 = rb_enc_codepoint_len(result1 + i1, result1 + low, &n1, enc);
- c2 = rb_enc_codepoint_len(p2 + i2, p2 + l2, &n2, enc);
- if (case_fold) {
- c1 = rb_tolower(c1);
- c2 = rb_tolower(c2);
- }
- if (c1 != c2) break;
- }
-
- low = i1;
- }
- result[0] = (char*)malloc(low + 1);
- if (result[0] == NULL) rb_memerror();
- strncpy(result[0], result[1], low);
- result[0][low] = '\0';
+ const char *result1 = result[1];
+ long low = strlen(result1);
+
+ for (i = 1; i < matches; ++i) {
+ register int c1, c2;
+ long i1, i2, l2;
+ int n1, n2;
+ const char *p2 = result[i + 1];
+
+ l2 = strlen(p2);
+ for (i1 = i2 = 0; i1 < low && i2 < l2; i1 += n1, i2 += n2) {
+ c1 = rb_enc_codepoint_len(result1 + i1, result1 + low, &n1, enc);
+ c2 = rb_enc_codepoint_len(p2 + i2, p2 + l2, &n2, enc);
+ if (case_fold) {
+ c1 = rb_tolower(c1);
+ c2 = rb_tolower(c2);
+ }
+ if (c1 != c2) break;
+ }
+
+ low = i1;
+ }
+ result[0] = (char*)malloc(low + 1);
+ if (result[0] == NULL) rb_memerror();
+ strncpy(result[0], result[1], low);
+ result[0][low] = '\0';
}
return result;
@@ -851,13 +1009,10 @@ readline_attempted_completion_function(const char *text, int start, int end)
* See GNU Readline's rl_set_screen_size function.
*
* Raises NotImplementedError if the using readline library does not support.
- *
- * Raises SecurityError exception if $SAFE is 4.
*/
static VALUE
readline_s_set_screen_size(VALUE self, VALUE rows, VALUE columns)
{
- rb_secure(4);
rl_set_screen_size(NUM2INT(rows), NUM2INT(columns));
return self;
}
@@ -875,8 +1030,6 @@ readline_s_set_screen_size(VALUE self, VALUE rows, VALUE columns)
* See GNU Readline's rl_get_screen_size function.
*
* Raises NotImplementedError if the using readline library does not support.
- *
- * Raises SecurityError exception if $SAFE is 4.
*/
static VALUE
readline_s_get_screen_size(VALUE self)
@@ -884,7 +1037,6 @@ readline_s_get_screen_size(VALUE self)
int rows, columns;
VALUE res;
- rb_secure(4);
rl_get_screen_size(&rows, &columns);
res = rb_ary_new();
rb_ary_push(res, INT2NUM(rows));
@@ -904,13 +1056,10 @@ readline_s_get_screen_size(VALUE self)
* details of VI editing mode.
*
* Raises NotImplementedError if the using readline library does not support.
- *
- * Raises SecurityError exception if $SAFE is 4.
*/
static VALUE
readline_s_vi_editing_mode(VALUE self)
{
- rb_secure(4);
rl_vi_editing_mode(1,0);
return Qnil;
}
@@ -926,13 +1075,10 @@ readline_s_vi_editing_mode(VALUE self)
* Returns true if vi mode is active. Returns false if not.
*
* Raises NotImplementedError if the using readline library does not support.
- *
- * Raises SecurityError exception if $SAFE is 4.
*/
static VALUE
readline_s_vi_editing_mode_p(VALUE self)
{
- rb_secure(4);
return rl_editing_mode == 0 ? Qtrue : Qfalse;
}
#else
@@ -948,13 +1094,10 @@ readline_s_vi_editing_mode_p(VALUE self)
* manual of GNU Readline for details of Emacs editing mode.
*
* Raises NotImplementedError if the using readline library does not support.
- *
- * Raises SecurityError exception if $SAFE is 4.
*/
static VALUE
readline_s_emacs_editing_mode(VALUE self)
{
- rb_secure(4);
rl_emacs_editing_mode(1,0);
return Qnil;
}
@@ -970,13 +1113,10 @@ readline_s_emacs_editing_mode(VALUE self)
* Returns true if emacs mode is active. Returns false if not.
*
* Raises NotImplementedError if the using readline library does not support.
- *
- * Raises SecurityError exception if $SAFE is 4.
*/
static VALUE
readline_s_emacs_editing_mode_p(VALUE self)
{
- rb_secure(4);
return rl_editing_mode == 1 ? Qtrue : Qfalse;
}
#else
@@ -1019,23 +1159,20 @@ readline_s_emacs_editing_mode_p(VALUE self)
* p Readline.completion_append_character # => "s"
*
* Raises NotImplementedError if the using readline library does not support.
- *
- * Raises SecurityError exception if $SAFE is 4.
*/
static VALUE
readline_s_set_completion_append_character(VALUE self, VALUE str)
{
- rb_secure(4);
if (NIL_P(str)) {
- rl_completion_append_character = '\0';
+ rl_completion_append_character = '\0';
}
else {
- OutputStringValue(str);
- if (RSTRING_LEN(str) == 0) {
- rl_completion_append_character = '\0';
- } else {
- rl_completion_append_character = RSTRING_PTR(str)[0];
- }
+ OutputStringValue(str);
+ if (RSTRING_LEN(str) == 0) {
+ rl_completion_append_character = '\0';
+ } else {
+ rl_completion_append_character = RSTRING_PTR(str)[0];
+ }
}
return self;
}
@@ -1052,17 +1189,14 @@ readline_s_set_completion_append_character(VALUE self, VALUE str)
* completion. The default is a space (" ").
*
* Raises NotImplementedError if the using readline library does not support.
- *
- * Raises SecurityError exception if $SAFE is 4.
*/
static VALUE
readline_s_get_completion_append_character(VALUE self)
{
char buf[1];
- rb_secure(4);
if (rl_completion_append_character == '\0')
- return Qnil;
+ return Qnil;
buf[0] = (char) rl_completion_append_character;
return rb_locale_str_new(buf, 1);
@@ -1081,25 +1215,22 @@ readline_s_get_completion_append_character(VALUE self)
* break words for completion in Bash: " \t\n\"\\'`@$><=;|&{(".
*
* Raises NotImplementedError if the using readline library does not support.
- *
- * Raises SecurityError exception if $SAFE is 4.
*/
static VALUE
readline_s_set_basic_word_break_characters(VALUE self, VALUE str)
{
static char *basic_word_break_characters = NULL;
- rb_secure(4);
OutputStringValue(str);
if (basic_word_break_characters == NULL) {
- basic_word_break_characters =
- ALLOC_N(char, RSTRING_LEN(str) + 1);
+ basic_word_break_characters =
+ ALLOC_N(char, RSTRING_LEN(str) + 1);
}
else {
- REALLOC_N(basic_word_break_characters, char, RSTRING_LEN(str) + 1);
+ REALLOC_N(basic_word_break_characters, char, RSTRING_LEN(str) + 1);
}
strncpy(basic_word_break_characters,
- RSTRING_PTR(str), RSTRING_LEN(str));
+ RSTRING_PTR(str), RSTRING_LEN(str));
basic_word_break_characters[RSTRING_LEN(str)] = '\0';
rl_basic_word_break_characters = basic_word_break_characters;
return self;
@@ -1117,15 +1248,12 @@ readline_s_set_basic_word_break_characters(VALUE self, VALUE str)
* for the completer routine.
*
* Raises NotImplementedError if the using readline library does not support.
- *
- * Raises SecurityError exception if $SAFE is 4.
*/
static VALUE
readline_s_get_basic_word_break_characters(VALUE self, VALUE str)
{
- rb_secure(4);
if (rl_basic_word_break_characters == NULL)
- return Qnil;
+ return Qnil;
return rb_locale_str_new_cstr(rl_basic_word_break_characters);
}
#else
@@ -1142,25 +1270,22 @@ readline_s_get_basic_word_break_characters(VALUE self, VALUE str)
* Readline.basic_word_break_characters.
*
* Raises NotImplementedError if the using readline library does not support.
- *
- * Raises SecurityError exception if $SAFE is 4.
*/
static VALUE
readline_s_set_completer_word_break_characters(VALUE self, VALUE str)
{
static char *completer_word_break_characters = NULL;
- rb_secure(4);
OutputStringValue(str);
if (completer_word_break_characters == NULL) {
- completer_word_break_characters =
- ALLOC_N(char, RSTRING_LEN(str) + 1);
+ completer_word_break_characters =
+ ALLOC_N(char, RSTRING_LEN(str) + 1);
}
else {
- REALLOC_N(completer_word_break_characters, char, RSTRING_LEN(str) + 1);
+ REALLOC_N(completer_word_break_characters, char, RSTRING_LEN(str) + 1);
}
strncpy(completer_word_break_characters,
- RSTRING_PTR(str), RSTRING_LEN(str));
+ RSTRING_PTR(str), RSTRING_LEN(str));
completer_word_break_characters[RSTRING_LEN(str)] = '\0';
rl_completer_word_break_characters = completer_word_break_characters;
return self;
@@ -1178,15 +1303,12 @@ readline_s_set_completer_word_break_characters(VALUE self, VALUE str)
* for rl_complete_internal().
*
* Raises NotImplementedError if the using readline library does not support.
- *
- * Raises SecurityError exception if $SAFE is 4.
*/
static VALUE
readline_s_get_completer_word_break_characters(VALUE self, VALUE str)
{
- rb_secure(4);
if (rl_completer_word_break_characters == NULL)
- return Qnil;
+ return Qnil;
return rb_locale_str_new_cstr(rl_completer_word_break_characters);
}
#else
@@ -1207,24 +1329,21 @@ readline_s_get_completer_word_break_characters(VALUE self, VALUE str)
* See GNU Readline's rl_special_prefixes variable.
*
* Raises NotImplementedError if the using readline library does not support.
- *
- * Raises SecurityError exception if $SAFE is 4.
*/
static VALUE
readline_s_set_special_prefixes(VALUE self, VALUE str)
{
- rb_secure(4);
if (!NIL_P(str)) {
- OutputStringValue(str);
- str = rb_str_dup_frozen(str);
- RBASIC(str)->klass = 0;
+ OutputStringValue(str);
+ str = rb_str_dup_frozen(str);
+ rb_obj_hide(str);
}
rb_ivar_set(mReadline, id_special_prefixes, str);
if (NIL_P(str)) {
- rl_special_prefixes = NULL;
+ rl_special_prefixes = NULL;
}
else {
- rl_special_prefixes = RSTRING_PTR(str);
+ rl_special_prefixes = RSTRING_PTR(str);
}
return self;
}
@@ -1240,19 +1359,16 @@ readline_s_set_special_prefixes(VALUE self, VALUE str)
* See GNU Readline's rl_special_prefixes variable.
*
* Raises NotImplementedError if the using readline library does not support.
- *
- * Raises SecurityError exception if $SAFE is 4.
*/
static VALUE
readline_s_get_special_prefixes(VALUE self)
{
VALUE str;
- rb_secure(4);
if (rl_special_prefixes == NULL) return Qnil;
str = rb_ivar_get(mReadline, id_special_prefixes);
if (!NIL_P(str)) {
- str = rb_str_dup_frozen(str);
- RBASIC(str)->klass = rb_cString;
+ str = rb_str_dup_frozen(str);
+ rb_obj_reveal(str, rb_cString);
}
return str;
}
@@ -1269,25 +1385,22 @@ readline_s_get_special_prefixes(VALUE self)
* Sets a list of quote characters which can cause a word break.
*
* Raises NotImplementedError if the using readline library does not support.
- *
- * Raises SecurityError exception if $SAFE is 4.
*/
static VALUE
readline_s_set_basic_quote_characters(VALUE self, VALUE str)
{
static char *basic_quote_characters = NULL;
- rb_secure(4);
OutputStringValue(str);
if (basic_quote_characters == NULL) {
- basic_quote_characters =
- ALLOC_N(char, RSTRING_LEN(str) + 1);
+ basic_quote_characters =
+ ALLOC_N(char, RSTRING_LEN(str) + 1);
}
else {
- REALLOC_N(basic_quote_characters, char, RSTRING_LEN(str) + 1);
+ REALLOC_N(basic_quote_characters, char, RSTRING_LEN(str) + 1);
}
strncpy(basic_quote_characters,
- RSTRING_PTR(str), RSTRING_LEN(str));
+ RSTRING_PTR(str), RSTRING_LEN(str));
basic_quote_characters[RSTRING_LEN(str)] = '\0';
rl_basic_quote_characters = basic_quote_characters;
@@ -1305,15 +1418,12 @@ readline_s_set_basic_quote_characters(VALUE self, VALUE str)
* Gets a list of quote characters which can cause a word break.
*
* Raises NotImplementedError if the using readline library does not support.
- *
- * Raises SecurityError exception if $SAFE is 4.
*/
static VALUE
readline_s_get_basic_quote_characters(VALUE self, VALUE str)
{
- rb_secure(4);
if (rl_basic_quote_characters == NULL)
- return Qnil;
+ return Qnil;
return rb_locale_str_new_cstr(rl_basic_quote_characters);
}
#else
@@ -1331,22 +1441,19 @@ readline_s_get_basic_quote_characters(VALUE self, VALUE str)
* as any other character, unless they also appear within this list.
*
* Raises NotImplementedError if the using readline library does not support.
- *
- * Raises SecurityError exception if $SAFE is 4.
*/
static VALUE
readline_s_set_completer_quote_characters(VALUE self, VALUE str)
{
static char *completer_quote_characters = NULL;
- rb_secure(4);
OutputStringValue(str);
if (completer_quote_characters == NULL) {
- completer_quote_characters =
- ALLOC_N(char, RSTRING_LEN(str) + 1);
+ completer_quote_characters =
+ ALLOC_N(char, RSTRING_LEN(str) + 1);
}
else {
- REALLOC_N(completer_quote_characters, char, RSTRING_LEN(str) + 1);
+ REALLOC_N(completer_quote_characters, char, RSTRING_LEN(str) + 1);
}
strncpy(completer_quote_characters, RSTRING_PTR(str), RSTRING_LEN(str));
completer_quote_characters[RSTRING_LEN(str)] = '\0';
@@ -1367,15 +1474,12 @@ readline_s_set_completer_quote_characters(VALUE self, VALUE str)
* the line.
*
* Raises NotImplementedError if the using readline library does not support.
- *
- * Raises SecurityError exception if $SAFE is 4.
*/
static VALUE
readline_s_get_completer_quote_characters(VALUE self, VALUE str)
{
- rb_secure(4);
if (rl_completer_quote_characters == NULL)
- return Qnil;
+ return Qnil;
return rb_locale_str_new_cstr(rl_completer_quote_characters);
}
#else
@@ -1391,22 +1495,19 @@ readline_s_get_completer_quote_characters(VALUE self, VALUE str)
* when they appear in a completed filename. The default is nil.
*
* Raises NotImplementedError if the using readline library does not support.
- *
- * Raises SecurityError exception if $SAFE is 4.
*/
static VALUE
readline_s_set_filename_quote_characters(VALUE self, VALUE str)
{
static char *filename_quote_characters = NULL;
- rb_secure(4);
OutputStringValue(str);
if (filename_quote_characters == NULL) {
- filename_quote_characters =
- ALLOC_N(char, RSTRING_LEN(str) + 1);
+ filename_quote_characters =
+ ALLOC_N(char, RSTRING_LEN(str) + 1);
}
else {
- REALLOC_N(filename_quote_characters, char, RSTRING_LEN(str) + 1);
+ REALLOC_N(filename_quote_characters, char, RSTRING_LEN(str) + 1);
}
strncpy(filename_quote_characters, RSTRING_PTR(str), RSTRING_LEN(str));
filename_quote_characters[RSTRING_LEN(str)] = '\0';
@@ -1427,15 +1528,12 @@ readline_s_set_filename_quote_characters(VALUE self, VALUE str)
* when they appear in a completed filename.
*
* Raises NotImplementedError if the using readline library does not support.
- *
- * Raises SecurityError exception if $SAFE is 4.
*/
static VALUE
readline_s_get_filename_quote_characters(VALUE self, VALUE str)
{
- rb_secure(4);
if (rl_filename_quote_characters == NULL)
- return Qnil;
+ return Qnil;
return rb_locale_str_new_cstr(rl_filename_quote_characters);
}
#else
@@ -1448,13 +1546,10 @@ readline_s_get_filename_quote_characters(VALUE self, VALUE str)
* Readline.refresh_line -> nil
*
* Clear the current input line.
- *
- * Raises SecurityError exception if $SAFE is 4.
*/
static VALUE
readline_s_refresh_line(VALUE self)
{
- rb_secure(4);
rl_refresh_line(0, 0);
return Qnil;
}
@@ -1486,16 +1581,15 @@ hist_get(VALUE self, VALUE index)
HIST_ENTRY *entry = NULL;
int i;
- rb_secure(4);
i = NUM2INT(index);
if (i < 0) {
i += history_length;
}
if (i >= 0) {
- entry = history_get(history_get_offset_func(i));
+ entry = history_get(history_get_offset_func(i));
}
if (entry == NULL) {
- rb_raise(rb_eIndexError, "invalid index");
+ rb_raise(rb_eIndexError, "invalid index");
}
return rb_locale_str_new_cstr(entry->line);
}
@@ -1507,17 +1601,16 @@ hist_set(VALUE self, VALUE index, VALUE str)
HIST_ENTRY *entry = NULL;
int i;
- rb_secure(4);
i = NUM2INT(index);
OutputStringValue(str);
if (i < 0) {
i += history_length;
}
if (i >= 0) {
- entry = replace_history_entry(history_replace_offset_func(i), RSTRING_PTR(str), NULL);
+ entry = replace_history_entry(history_replace_offset_func(i), RSTRING_PTR(str), NULL);
}
if (entry == NULL) {
- rb_raise(rb_eIndexError, "invalid index");
+ rb_raise(rb_eIndexError, "invalid index");
}
return str;
}
@@ -1528,7 +1621,6 @@ hist_set(VALUE self, VALUE index, VALUE str)
static VALUE
hist_push(VALUE self, VALUE str)
{
- rb_secure(4);
OutputStringValue(str);
add_history(RSTRING_PTR(str));
return self;
@@ -1539,11 +1631,10 @@ hist_push_method(int argc, VALUE *argv, VALUE self)
{
VALUE str;
- rb_secure(4);
while (argc--) {
- str = *argv++;
- OutputStringValue(str);
- add_history(RSTRING_PTR(str));
+ str = *argv++;
+ OutputStringValue(str);
+ add_history(RSTRING_PTR(str));
}
return self;
}
@@ -1555,7 +1646,6 @@ rb_remove_history(int index)
HIST_ENTRY *entry;
VALUE val;
- rb_secure(4);
entry = remove_history(index);
if (entry) {
val = rb_locale_str_new_cstr(entry->line);
@@ -1574,22 +1664,20 @@ rb_remove_history(int index)
static VALUE
hist_pop(VALUE self)
{
- rb_secure(4);
if (history_length > 0) {
- return rb_remove_history(history_length - 1);
+ return rb_remove_history(history_length - 1);
} else {
- return Qnil;
+ return Qnil;
}
}
static VALUE
hist_shift(VALUE self)
{
- rb_secure(4);
if (history_length > 0) {
- return rb_remove_history(0);
+ return rb_remove_history(0);
} else {
- return Qnil;
+ return Qnil;
}
}
@@ -1601,12 +1689,11 @@ hist_each(VALUE self)
RETURN_ENUMERATOR(self, 0, 0);
- rb_secure(4);
for (i = 0; i < history_length; i++) {
entry = history_get(history_get_offset_func(i));
if (entry == NULL)
break;
- rb_yield(rb_locale_str_new_cstr(entry->line));
+ rb_yield(rb_locale_str_new_cstr(entry->line));
}
return self;
}
@@ -1614,14 +1701,12 @@ hist_each(VALUE self)
static VALUE
hist_length(VALUE self)
{
- rb_secure(4);
return INT2NUM(history_length);
}
static VALUE
hist_empty_p(VALUE self)
{
- rb_secure(4);
return history_length == 0 ? Qtrue : Qfalse;
}
@@ -1630,12 +1715,11 @@ hist_delete_at(VALUE self, VALUE index)
{
int i;
- rb_secure(4);
i = NUM2INT(index);
if (i < 0)
i += history_length;
if (i < 0 || i > history_length - 1) {
- rb_raise(rb_eIndexError, "invalid index");
+ rb_raise(rb_eIndexError, "invalid index");
}
return rb_remove_history(i);
}
@@ -1644,7 +1728,6 @@ hist_delete_at(VALUE self, VALUE index)
static VALUE
hist_clear(VALUE self)
{
- rb_secure(4);
clear_history();
return self;
}
@@ -1660,19 +1743,19 @@ filename_completion_proc_call(VALUE self, VALUE str)
int i;
matches = rl_completion_matches(StringValuePtr(str),
- rl_filename_completion_function);
+ rl_filename_completion_function);
if (matches) {
- result = rb_ary_new();
- for (i = 0; matches[i]; i++) {
- rb_ary_push(result, rb_locale_str_new_cstr(matches[i]));
- free(matches[i]);
- }
- free(matches);
- if (RARRAY_LEN(result) >= 2)
- rb_ary_shift(result);
+ result = rb_ary_new();
+ for (i = 0; matches[i]; i++) {
+ rb_ary_push(result, rb_locale_str_new_cstr(matches[i]));
+ free(matches[i]);
+ }
+ free(matches);
+ if (RARRAY_LEN(result) >= 2)
+ rb_ary_shift(result);
}
else {
- result = Qnil;
+ result = Qnil;
}
return result;
}
@@ -1685,19 +1768,19 @@ username_completion_proc_call(VALUE self, VALUE str)
int i;
matches = rl_completion_matches(StringValuePtr(str),
- rl_username_completion_function);
+ rl_username_completion_function);
if (matches) {
- result = rb_ary_new();
- for (i = 0; matches[i]; i++) {
- rb_ary_push(result, rb_locale_str_new_cstr(matches[i]));
- free(matches[i]);
- }
- free(matches);
- if (RARRAY_LEN(result) >= 2)
- rb_ary_shift(result);
+ result = rb_ary_new();
+ for (i = 0; matches[i]; i++) {
+ rb_ary_push(result, rb_locale_str_new_cstr(matches[i]));
+ free(matches[i]);
+ }
+ free(matches);
+ if (RARRAY_LEN(result) >= 2)
+ rb_ary_shift(result);
}
else {
- result = Qnil;
+ result = Qnil;
}
return result;
}
@@ -1732,73 +1815,77 @@ Init_readline()
mReadline = rb_define_module("Readline");
rb_define_module_function(mReadline, "readline",
- readline_readline, -1);
+ readline_readline, -1);
rb_define_singleton_method(mReadline, "input=",
- readline_s_set_input, 1);
+ readline_s_set_input, 1);
rb_define_singleton_method(mReadline, "output=",
- readline_s_set_output, 1);
+ readline_s_set_output, 1);
rb_define_singleton_method(mReadline, "completion_proc=",
- readline_s_set_completion_proc, 1);
+ readline_s_set_completion_proc, 1);
rb_define_singleton_method(mReadline, "completion_proc",
- readline_s_get_completion_proc, 0);
+ readline_s_get_completion_proc, 0);
rb_define_singleton_method(mReadline, "completion_case_fold=",
- readline_s_set_completion_case_fold, 1);
+ readline_s_set_completion_case_fold, 1);
rb_define_singleton_method(mReadline, "completion_case_fold",
- readline_s_get_completion_case_fold, 0);
+ readline_s_get_completion_case_fold, 0);
rb_define_singleton_method(mReadline, "line_buffer",
- readline_s_get_line_buffer, 0);
+ readline_s_get_line_buffer, 0);
rb_define_singleton_method(mReadline, "point",
- readline_s_get_point, 0);
+ readline_s_get_point, 0);
+ rb_define_singleton_method(mReadline, "point=",
+ readline_s_set_point, 1);
rb_define_singleton_method(mReadline, "set_screen_size",
- readline_s_set_screen_size, 2);
+ readline_s_set_screen_size, 2);
rb_define_singleton_method(mReadline, "get_screen_size",
- readline_s_get_screen_size, 0);
+ readline_s_get_screen_size, 0);
rb_define_singleton_method(mReadline, "vi_editing_mode",
- readline_s_vi_editing_mode, 0);
+ readline_s_vi_editing_mode, 0);
rb_define_singleton_method(mReadline, "vi_editing_mode?",
- readline_s_vi_editing_mode_p, 0);
+ readline_s_vi_editing_mode_p, 0);
rb_define_singleton_method(mReadline, "emacs_editing_mode",
- readline_s_emacs_editing_mode, 0);
+ readline_s_emacs_editing_mode, 0);
rb_define_singleton_method(mReadline, "emacs_editing_mode?",
- readline_s_emacs_editing_mode_p, 0);
+ readline_s_emacs_editing_mode_p, 0);
rb_define_singleton_method(mReadline, "completion_append_character=",
- readline_s_set_completion_append_character, 1);
+ readline_s_set_completion_append_character, 1);
rb_define_singleton_method(mReadline, "completion_append_character",
- readline_s_get_completion_append_character, 0);
+ readline_s_get_completion_append_character, 0);
rb_define_singleton_method(mReadline, "basic_word_break_characters=",
- readline_s_set_basic_word_break_characters, 1);
+ readline_s_set_basic_word_break_characters, 1);
rb_define_singleton_method(mReadline, "basic_word_break_characters",
- readline_s_get_basic_word_break_characters, 0);
+ readline_s_get_basic_word_break_characters, 0);
rb_define_singleton_method(mReadline, "completer_word_break_characters=",
- readline_s_set_completer_word_break_characters, 1);
+ readline_s_set_completer_word_break_characters, 1);
rb_define_singleton_method(mReadline, "completer_word_break_characters",
- readline_s_get_completer_word_break_characters, 0);
+ readline_s_get_completer_word_break_characters, 0);
rb_define_singleton_method(mReadline, "basic_quote_characters=",
- readline_s_set_basic_quote_characters, 1);
+ readline_s_set_basic_quote_characters, 1);
rb_define_singleton_method(mReadline, "basic_quote_characters",
- readline_s_get_basic_quote_characters, 0);
+ readline_s_get_basic_quote_characters, 0);
rb_define_singleton_method(mReadline, "completer_quote_characters=",
- readline_s_set_completer_quote_characters, 1);
+ readline_s_set_completer_quote_characters, 1);
rb_define_singleton_method(mReadline, "completer_quote_characters",
- readline_s_get_completer_quote_characters, 0);
+ readline_s_get_completer_quote_characters, 0);
rb_define_singleton_method(mReadline, "filename_quote_characters=",
- readline_s_set_filename_quote_characters, 1);
+ readline_s_set_filename_quote_characters, 1);
rb_define_singleton_method(mReadline, "filename_quote_characters",
- readline_s_get_filename_quote_characters, 0);
+ readline_s_get_filename_quote_characters, 0);
rb_define_singleton_method(mReadline, "refresh_line",
- readline_s_refresh_line, 0);
+ readline_s_refresh_line, 0);
rb_define_singleton_method(mReadline, "pre_input_hook=",
- readline_s_set_pre_input_hook, 1);
+ readline_s_set_pre_input_hook, 1);
rb_define_singleton_method(mReadline, "pre_input_hook",
- readline_s_get_pre_input_hook, 0);
+ readline_s_get_pre_input_hook, 0);
rb_define_singleton_method(mReadline, "insert_text",
- readline_s_insert_text, 1);
+ readline_s_insert_text, 1);
+ rb_define_singleton_method(mReadline, "delete_text",
+ readline_s_delete_text, -1);
rb_define_singleton_method(mReadline, "redisplay",
- readline_s_redisplay, 0);
+ readline_s_redisplay, 0);
rb_define_singleton_method(mReadline, "special_prefixes=",
- readline_s_set_special_prefixes, 1);
+ readline_s_set_special_prefixes, 1);
rb_define_singleton_method(mReadline, "special_prefixes",
- readline_s_get_special_prefixes, 0);
+ readline_s_get_special_prefixes, 0);
#if USE_INSERT_IGNORE_ESCAPE
CONST_ID(id_orig_prompt, "orig_prompt");
@@ -1831,7 +1918,7 @@ Init_readline()
fcomp = rb_obj_alloc(rb_cObject);
rb_define_singleton_method(fcomp, "call",
- filename_completion_proc_call, 1);
+ filename_completion_proc_call, 1);
/*
* The Object with the call method that is a completion for filename.
* This is sets by Readline.completion_proc= method.
@@ -1840,7 +1927,7 @@ Init_readline()
ucomp = rb_obj_alloc(rb_cObject);
rb_define_singleton_method(ucomp, "call",
- username_completion_proc_call, 1);
+ username_completion_proc_call, 1);
/*
* The Object with the call method that is a completion for usernames.
* This is sets by Readline.completion_proc= method.
@@ -1852,26 +1939,26 @@ Init_readline()
version = rb_str_new_cstr(rl_library_version);
#if defined HAVE_CLEAR_HISTORY || defined HAVE_REMOVE_HISTORY
if (strncmp(rl_library_version, EDIT_LINE_LIBRARY_VERSION,
- strlen(EDIT_LINE_LIBRARY_VERSION)) == 0) {
- add_history("1");
- if (history_get(history_get_offset_func(0)) == NULL) {
- history_get_offset_func = history_get_offset_0;
- }
+ strlen(EDIT_LINE_LIBRARY_VERSION)) == 0) {
+ add_history("1");
+ if (history_get(history_get_offset_func(0)) == NULL) {
+ history_get_offset_func = history_get_offset_0;
+ }
#ifdef HAVE_REPLACE_HISTORY_ENTRY
- if (replace_history_entry(0, "a", NULL) == NULL) {
- history_replace_offset_func = history_get_offset_history_base;
- }
+ if (replace_history_entry(0, "a", NULL) == NULL) {
+ history_replace_offset_func = history_get_offset_history_base;
+ }
#endif
#ifdef HAVE_CLEAR_HISTORY
- clear_history();
+ clear_history();
#else
- {
- HIST_ENTRY *entry = remove_history(0);
- if (entry) {
- free((char *)entry->line);
- free(entry);
- }
- }
+ {
+ HIST_ENTRY *entry = remove_history(0);
+ if (entry) {
+ free((char *)entry->line);
+ free(entry);
+ }
+ }
#endif
}
#endif
@@ -1883,7 +1970,7 @@ Init_readline()
rl_attempted_completion_function = readline_attempted_completion_function;
#if defined(HAVE_RL_PRE_INPUT_HOOK)
- rl_pre_input_hook = (Function *)readline_pre_input_hook;
+ rl_pre_input_hook = (rl_hook_func_t *)readline_pre_input_hook;
#endif
#ifdef HAVE_RL_CATCH_SIGNALS
rl_catch_signals = 0;
@@ -1892,5 +1979,6 @@ Init_readline()
rl_clear_signals();
#endif
- readline_s_set_input(mReadline, rb_stdin);
+ rb_gc_register_address(&readline_instream);
+ rb_gc_register_address(&readline_outstream);
}
diff --git a/ext/ripper/depend b/ext/ripper/depend
index 776977847d..db7bea74ed 100644
--- a/ext/ripper/depend
+++ b/ext/ripper/depend
@@ -8,11 +8,18 @@ BISON = bison
src: ripper.c eventids1.c eventids2table.c
ripper.o: ripper.c id.c lex.c eventids1.c eventids2.c eventids2table.c \
- $(hdrdir)/ruby/ruby.h $(arch_hdrdir)/ruby/config.h \
- $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/intern.h \
- $(hdrdir)/ruby/encoding.h $(hdrdir)/missing.h \
- $(hdrdir)/../node.h $(hdrdir)/oniguruma.h \
- $(hdrdir)/regex.h $(hdrdir)/st.h $(hdrdir)/util.h
+ $(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 $<
diff --git a/ext/ripper/eventids2.c b/ext/ripper/eventids2.c
index 841a18c583..423f9d7e29 100644
--- a/ext/ripper/eventids2.c
+++ b/ext/ripper/eventids2.c
@@ -19,6 +19,7 @@ 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;
@@ -41,6 +42,7 @@ 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;
@@ -74,6 +76,7 @@ ripper_init_eventids2(void)
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");
@@ -96,6 +99,7 @@ ripper_init_eventids2(void)
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");
@@ -209,6 +213,7 @@ static const struct token_assoc {
{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},
@@ -234,6 +239,7 @@ static const struct token_assoc {
{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},
diff --git a/ext/ripper/lib/ripper/lexer.rb b/ext/ripper/lib/ripper/lexer.rb
index 5c99dfe8fa..c0a64d1ee5 100644
--- a/ext/ripper/lib/ripper/lexer.rb
+++ b/ext/ripper/lib/ripper/lexer.rb
@@ -12,7 +12,7 @@ require 'ripper/core'
class Ripper
- # Tokenizes the Ruby program and returns an Array of String.
+ # Tokenizes the Ruby program and returns an array of strings.
#
# p Ripper.tokenize("def m(a) nil end")
# # => ["def", " ", "m", "(", "a", ")", " ", "nil", " ", "end"]
@@ -21,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'
diff --git a/ext/sdbm/_sdbm.c b/ext/sdbm/_sdbm.c
index 874239a276..847eb2aaf6 100644
--- a/ext/sdbm/_sdbm.c
+++ b/ext/sdbm/_sdbm.c
@@ -156,7 +156,7 @@ sdbm_open(register char *file, register int flags, register int mode)
if (file == NULL || !*file)
return errno = EINVAL, (DBM *) NULL;
/*
- * need space for two seperate filenames
+ * need space for two separate filenames
*/
n = strlen(file) * 2 + strlen(DIRFEXT) + strlen(PAGFEXT) + 2;
@@ -392,7 +392,7 @@ makroom(register DBM *db, long int hash, int need)
newp = (hash & db->hmask) | (db->hmask + 1);
debug(("newp: %ld\n", newp));
/*
- * write delay, read avoidence/cache shuffle:
+ * write delay, read avoidance/cache shuffle:
* select the page for incoming pair: if key is to go to the new page,
* write out the previous one, and copy the new one over, thus making
* it the current page. If not, simply write the new page, and we are
diff --git a/ext/sdbm/depend b/ext/sdbm/depend
index f205edc611..09f171a511 100644
--- a/ext/sdbm/depend
+++ b/ext/sdbm/depend
@@ -1,2 +1,2 @@
-_sdbm.o: _sdbm.c sdbm.h $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
-init.o: init.c sdbm.h $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h
+_sdbm.o: _sdbm.c sdbm.h $(HDRS) $(ruby_headers)
+init.o: init.c sdbm.h $(HDRS) $(ruby_headers)
diff --git a/ext/sdbm/init.c b/ext/sdbm/init.c
index 0fd837db31..92901181a5 100644
--- a/ext/sdbm/init.c
+++ b/ext/sdbm/init.c
@@ -77,16 +77,16 @@ closed_sdbm()
rb_raise(rb_eDBMError, "closed SDBM file");
}
-#define GetDBM(obj, dbmp) {\
+#define GetDBM(obj, dbmp) do {\
Data_Get_Struct((obj), struct dbmdata, (dbmp));\
if ((dbmp) == 0) closed_sdbm();\
if ((dbmp)->di_dbm == 0) closed_sdbm();\
-}
+} while (0)
-#define GetDBM2(obj, data, dbm) {\
- GetDBM((obj), (data));\
- (dbm) = dbmp->di_dbm;\
-}
+#define GetDBM2(obj, dbmp, dbm) do {\
+ GetDBM((obj), (dbmp));\
+ (dbm) = (dbmp)->di_dbm;\
+} while (0)
static void
free_sdbm(struct dbmdata *dbmp)
@@ -117,11 +117,11 @@ fsdbm_close(VALUE obj)
}
/*
-* call-seq:
-* sdbm.closed? -> true or false
-*
-* Returns +true+ if the database is closed.
-*/
+ * call-seq:
+ * sdbm.closed? -> true or false
+ *
+ * Returns +true+ if the database is closed.
+ */
static VALUE
fsdbm_closed(VALUE obj)
{
@@ -142,20 +142,20 @@ fsdbm_alloc(VALUE klass)
return Data_Wrap_Struct(klass, 0, free_sdbm, 0);
}
/*
-* call-seq:
-* SDBM.new(filename, mode = 0666)
-*
-* Creates a new database handle by opening the given +filename+. SDBM actually
-* uses two physical files, with extensions '.dir' and '.pag'. These extensions
-* will automatically be appended to the +filename+.
-*
-* If the file does not exist, a new file will be created using the given
-* +mode+, unless +mode+ is explicitly set to nil. In the latter case, no
-* database will be created.
-*
-* If the file exists, it will be opened in read/write mode. If this fails, it
-* will be opened in read-only mode.
-*/
+ * call-seq:
+ * SDBM.new(filename, mode = 0666)
+ *
+ * Creates a new database handle by opening the given +filename+. SDBM actually
+ * uses two physical files, with extensions '.dir' and '.pag'. These extensions
+ * will automatically be appended to the +filename+.
+ *
+ * If the file does not exist, a new file will be created using the given
+ * +mode+, unless +mode+ is explicitly set to nil. In the latter case, no
+ * database will be created.
+ *
+ * If the file exists, it will be opened in read/write mode. If this fails, it
+ * will be opened in read-only mode.
+ */
static VALUE
fsdbm_initialize(int argc, VALUE *argv, VALUE obj)
{
@@ -396,7 +396,6 @@ fsdbm_values_at(int argc, VALUE *argv, VALUE obj)
static void
fdbm_modify(VALUE obj)
{
- rb_secure(4);
if (OBJ_FROZEN(obj)) rb_error_frozen("SDBM");
}
@@ -633,7 +632,7 @@ fsdbm_store(VALUE obj, VALUE keystr, VALUE valstr)
}
static VALUE
-update_i(VALUE pair, VALUE dbm)
+update_i(RB_BLOCK_CALL_FUNC_ARGLIST(pair, dbm))
{
Check_Type(pair, T_ARRAY);
if (RARRAY_LEN(pair) < 2) {
diff --git a/ext/socket/.document b/ext/socket/.document
index 0216c5aa45..53cfac0b10 100644
--- a/ext/socket/.document
+++ b/ext/socket/.document
@@ -2,6 +2,7 @@ ancdata.c
basicsocket.c
constants.c
constdefs.c
+ifaddr.c
init.c
ipsocket.c
option.c
diff --git a/ext/socket/ancdata.c b/ext/socket/ancdata.c
index 050da974c4..218085d5ce 100644
--- a/ext/socket/ancdata.c
+++ b/ext/socket/ancdata.c
@@ -2,7 +2,9 @@
#include <time.h>
-#if defined(HAVE_ST_MSG_CONTROL)
+int rsock_cmsg_cloexec_state = -1; /* <0: unknown, 0: ignored, >0: working */
+
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
static VALUE rb_cAncillaryData;
static VALUE
@@ -276,8 +278,8 @@ ancillary_unix_rights(VALUE self)
* returns the timestamp as a time object.
*
* _ancillarydata_ should be one of following type:
- * - SOL_SOCKET/SCM_TIMESTAMP (micro second) GNU/Linux, FreeBSD, NetBSD, OpenBSD, Solaris, MacOS X
- * - SOL_SOCKET/SCM_TIMESTAMPNS (nano second) GNU/Linux
+ * - SOL_SOCKET/SCM_TIMESTAMP (microsecond) GNU/Linux, FreeBSD, NetBSD, OpenBSD, Solaris, MacOS X
+ * - SOL_SOCKET/SCM_TIMESTAMPNS (nanosecond) GNU/Linux
* - SOL_SOCKET/SCM_BINTIME (2**(-64) second) FreeBSD
*
* Addrinfo.udp("127.0.0.1", 0).bind {|s1|
@@ -573,9 +575,7 @@ extract_ipv6_pktinfo(VALUE self, struct in6_pktinfo *pktinfo_ptr, struct sockadd
memcpy(pktinfo_ptr, RSTRING_PTR(data), sizeof(*pktinfo_ptr));
- memset(sa_ptr, 0, sizeof(*sa_ptr));
- SET_SA_LEN((struct sockaddr *)sa_ptr, sizeof(struct sockaddr_in6));
- sa_ptr->sin6_family = AF_INET6;
+ INIT_SOCKADDR((struct sockaddr *)sa_ptr, AF_INET6, sizeof(*sa_ptr));
memcpy(&sa_ptr->sin6_addr, &pktinfo_ptr->ipi6_addr, sizeof(sa_ptr->sin6_addr));
if (IN6_IS_ADDR_LINKLOCAL(&sa_ptr->sin6_addr))
sa_ptr->sin6_scope_id = pktinfo_ptr->ipi6_ifindex;
@@ -1054,7 +1054,7 @@ ancillary_inspect(VALUE self)
# if defined(IPPROTO_IPV6)
case IPPROTO_IPV6:
switch (type) {
-# if defined(IPV6_PKTINFO) /* RFC 3542 */
+# if defined(IPV6_PKTINFO) && defined(HAVE_TYPE_STRUCT_IN6_PKTINFO) /* RFC 3542 */
case IPV6_PKTINFO: inspected = anc_inspect_ipv6_pktinfo(level, type, data, ret); break;
# endif
}
@@ -1131,36 +1131,38 @@ bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
{
rb_io_t *fptr;
VALUE data, vflags, dest_sockaddr;
- VALUE *controls_ptr;
int controls_num;
struct msghdr mh;
struct iovec iov;
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
volatile VALUE controls_str = 0;
+ VALUE *controls_ptr = NULL;
+ int family;
#endif
int flags;
ssize_t ss;
- int family;
- rb_secure(4);
GetOpenFile(sock, fptr);
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
family = rsock_getfamily(fptr->fd);
+#endif
data = vflags = dest_sockaddr = Qnil;
- controls_ptr = NULL;
- controls_num = 0;
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];
- if (3 < argc) { controls_ptr = &argv[3]; controls_num = argc - 3; }
+ 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_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
int i;
size_t last_pad = 0;
#if defined(__NetBSD__)
@@ -1257,16 +1259,16 @@ bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
memset(&mh, 0, sizeof(mh));
if (!NIL_P(dest_sockaddr)) {
mh.msg_name = RSTRING_PTR(dest_sockaddr);
- mh.msg_namelen = RSTRING_LENINT(dest_sockaddr);
+ mh.msg_namelen = RSTRING_SOCKLEN(dest_sockaddr);
}
mh.msg_iovlen = 1;
mh.msg_iov = &iov;
iov.iov_base = RSTRING_PTR(data);
iov.iov_len = RSTRING_LEN(data);
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
if (controls_str) {
mh.msg_control = RSTRING_PTR(controls_str);
- mh.msg_controllen = RSTRING_LENINT(controls_str);
+ mh.msg_controllen = RSTRING_SOCKLEN(controls_str);
}
else {
mh.msg_control = NULL;
@@ -1280,14 +1282,13 @@ bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
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) {
+ if (!nonblock && rb_io_wait_writable(fptr->fd)) {
+ rb_io_check_closed(fptr);
+ goto retry;
+ }
if (nonblock && (errno == EWOULDBLOCK || errno == EAGAIN))
- rb_mod_sys_fail(rb_mWaitWritable, "sendmsg(2) would block");
+ rb_readwrite_sys_fail(RB_IO_WAIT_WRITABLE, "sendmsg(2) would block");
rb_sys_fail("sendmsg(2)");
}
@@ -1364,11 +1365,17 @@ struct recvmsg_args_struct {
ssize_t
rsock_recvmsg(int socket, struct msghdr *message, int flags)
{
+ ssize_t ret;
+ socklen_t len0;
#ifdef MSG_CMSG_CLOEXEC
/* MSG_CMSG_CLOEXEC is available since Linux 2.6.23. Linux 2.6.18 silently ignore it. */
flags |= MSG_CMSG_CLOEXEC;
#endif
- return recvmsg(socket, message, flags);
+ len0 = message->msg_namelen;
+ ret = recvmsg(socket, message, flags);
+ if (ret != -1 && len0 < message->msg_namelen)
+ message->msg_namelen = len0;
+ return ret;
}
static void *
@@ -1389,7 +1396,7 @@ rb_recvmsg(int fd, struct msghdr *msg, int flags)
return (ssize_t)rb_thread_call_without_gvl(nogvl_recvmsg_func, &args, RUBY_UBF_IO, 0);
}
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
static void
discard_cmsg(struct cmsghdr *cmh, char *msg_end, int msg_peek_p)
{
@@ -1410,7 +1417,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_fd_fix_cloexec(*fdp);
+ rb_update_max_fd(*fdp);
close(*fdp);
fdp++;
}
@@ -1421,7 +1428,7 @@ discard_cmsg(struct cmsghdr *cmh, char *msg_end, int msg_peek_p)
void
rsock_discard_cmsg_resource(struct msghdr *mh, int msg_peek_p)
{
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
struct cmsghdr *cmh;
char *msg_end;
@@ -1436,7 +1443,7 @@ rsock_discard_cmsg_resource(struct msghdr *mh, int msg_peek_p)
#endif
}
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
static void
make_io_for_unix_rights(VALUE ctl, struct cmsghdr *cmh, char *msg_end)
{
@@ -1453,7 +1460,11 @@ 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_fd_fix_cloexec(fd);
+ 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);
if (S_ISSOCK(stbuf.st_mode))
io = rsock_init_sock(rb_obj_alloc(rb_cSocket), fd);
else
@@ -1471,19 +1482,20 @@ static VALUE
bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
{
rb_io_t *fptr;
- VALUE vmaxdatlen, vmaxctllen, vflags, vopts;
+ VALUE vmaxdatlen, vmaxctllen, vflags;
+ VALUE vopts;
int grow_buffer;
size_t maxdatlen;
int flags, orig_flags;
- int request_scm_rights;
struct msghdr mh;
struct iovec iov;
- struct sockaddr_storage namebuf;
+ union_sockaddr namebuf;
char datbuf0[4096], *datbuf;
VALUE dat_str = Qnil;
VALUE ret;
ssize_t ss;
-#if defined(HAVE_ST_MSG_CONTROL)
+ int request_scm_rights;
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
struct cmsghdr *cmh;
size_t maxctllen;
union {
@@ -1496,16 +1508,11 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
int gc_done = 0;
#endif
- rb_secure(4);
-
- vopts = Qnil;
- if (0 < argc && RB_TYPE_P(argv[argc-1], T_HASH))
- vopts = argv[--argc];
- rb_scan_args(argc, argv, "03", &vmaxdatlen, &vflags, &vmaxctllen);
+ rb_scan_args(argc, argv, "03:", &vmaxdatlen, &vflags, &vmaxctllen, &vopts);
maxdatlen = NIL_P(vmaxdatlen) ? sizeof(datbuf0) : NUM2SIZET(vmaxdatlen);
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
maxctllen = NIL_P(vmaxctllen) ? sizeof(ctlbuf0) : NUM2SIZET(vmaxctllen);
#else
if (!NIL_P(vmaxctllen))
@@ -1523,13 +1530,17 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
request_scm_rights = 0;
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)
+ rb_raise(rb_eNotImpError, "control message for recvmsg is unimplemented");
+#endif
GetOpenFile(sock, fptr);
if (rb_io_read_pending(fptr)) {
rb_raise(rb_eIOError, "recvmsg for buffered IO");
}
-#if !defined(HAVE_ST_MSG_CONTROL)
+#if !defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
if (grow_buffer) {
int socktype;
socklen_t optlen = (socklen_t)sizeof(socktype);
@@ -1552,7 +1563,7 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
datbuf = RSTRING_PTR(dat_str);
}
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
if (maxctllen <= sizeof(ctlbuf0))
ctlbuf = ctlbuf0.bytes;
else {
@@ -1567,7 +1578,7 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
memset(&mh, 0, sizeof(mh));
memset(&namebuf, 0, sizeof(namebuf));
- mh.msg_name = (struct sockaddr *)&namebuf;
+ mh.msg_name = &namebuf.addr;
mh.msg_namelen = (socklen_t)sizeof(namebuf);
mh.msg_iov = &iov;
@@ -1575,7 +1586,7 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
iov.iov_base = datbuf;
iov.iov_len = maxdatlen;
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
mh.msg_control = ctlbuf;
mh.msg_controllen = (socklen_t)maxctllen;
#endif
@@ -1589,15 +1600,14 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
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) {
+ if (!nonblock && rb_io_wait_readable(fptr->fd)) {
+ rb_io_check_closed(fptr);
+ goto retry;
+ }
if (nonblock && (errno == EWOULDBLOCK || errno == EAGAIN))
- rb_mod_sys_fail(rb_mWaitReadable, "recvmsg(2) would block");
-#if defined(HAVE_ST_MSG_CONTROL)
+ rb_readwrite_sys_fail(RB_IO_WAIT_READABLE, "recvmsg(2) would block");
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
if (!gc_done && (errno == EMFILE || errno == EMSGSIZE)) {
/*
* When SCM_RIGHTS hit the file descriptors limit:
@@ -1616,7 +1626,7 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
if (grow_buffer) {
int grown = 0;
-#if defined(HAVE_ST_MSG_CONTROL)
+#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");
@@ -1626,7 +1636,7 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
if (NIL_P(vmaxctllen) && (mh.msg_flags & MSG_CTRUNC)) {
#define BIG_ENOUGH_SPACE 65536
if (BIG_ENOUGH_SPACE < maxctllen &&
- mh.msg_controllen < (socklen_t)(maxctllen - BIG_ENOUGH_SPACE)) {
+ (socklen_t)mh.msg_controllen < (socklen_t)(maxctllen - BIG_ENOUGH_SPACE)) {
/* there are big space bug truncated.
* file descriptors limit? */
if (!gc_done) {
@@ -1669,19 +1679,19 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
else {
rb_str_resize(dat_str, ss);
OBJ_TAINT(dat_str);
- RBASIC(dat_str)->klass = rb_cString;
+ rb_obj_reveal(dat_str, rb_cString);
}
ret = rb_ary_new3(3, dat_str,
rsock_io_socket_addrinfo(sock, mh.msg_name, mh.msg_namelen),
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
INT2NUM(mh.msg_flags)
#else
Qnil
#endif
);
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
family = rsock_getfamily(fptr->fd);
if (mh.msg_controllen) {
char *msg_end = (char *)mh.msg_control + mh.msg_controllen;
@@ -1791,7 +1801,7 @@ rsock_bsock_recvmsg_nonblock(int argc, VALUE *argv, VALUE sock)
void
rsock_init_ancdata(void)
{
-#if defined(HAVE_ST_MSG_CONTROL)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
/*
* Document-class: Socket::AncillaryData
*
diff --git a/ext/socket/basicsocket.c b/ext/socket/basicsocket.c
index 2ef4f32692..088234aa85 100644
--- a/ext/socket/basicsocket.c
+++ b/ext/socket/basicsocket.c
@@ -80,7 +80,7 @@ bsock_shutdown(int argc, VALUE *argv, VALUE sock)
}
GetOpenFile(sock, fptr);
if (shutdown(fptr->fd, how) == -1)
- rb_sys_fail(0);
+ rb_sys_fail("shutdown(2)");
return INT2FIX(0);
}
@@ -243,15 +243,13 @@ bsock_setsockopt(int argc, VALUE *argv, VALUE sock)
default:
StringValue(val);
v = RSTRING_PTR(val);
- vlen = RSTRING_LENINT(val);
+ vlen = RSTRING_SOCKLEN(val);
break;
}
-#define rb_sys_fail_path(path) rb_sys_fail_str(path)
-
rb_io_check_closed(fptr);
if (setsockopt(fptr->fd, level, option, v, vlen) < 0)
- rb_sys_fail_path(fptr->pathv);
+ rsock_sys_fail_path("setsockopt(2)", fptr->pathv);
return INT2FIX(0);
}
@@ -332,7 +330,7 @@ bsock_getsockopt(VALUE sock, VALUE lev, VALUE optname)
rb_io_check_closed(fptr);
if (getsockopt(fptr->fd, level, option, buf, &len) < 0)
- rb_sys_fail_path(fptr->pathv);
+ rsock_sys_fail_path("getsockopt(2)", fptr->pathv);
return rsock_sockopt_new(family, level, option, rb_str_new(buf, len));
}
@@ -356,13 +354,13 @@ bsock_getsockopt(VALUE sock, VALUE lev, VALUE optname)
static VALUE
bsock_getsockname(VALUE sock)
{
- struct sockaddr_storage buf;
+ union_sockaddr buf;
socklen_t len = (socklen_t)sizeof buf;
socklen_t len0 = len;
rb_io_t *fptr;
GetOpenFile(sock, fptr);
- if (getsockname(fptr->fd, (struct sockaddr*)&buf, &len) < 0)
+ if (getsockname(fptr->fd, &buf.addr, &len) < 0)
rb_sys_fail("getsockname(2)");
if (len0 < len) len = len0;
return rb_str_new((char*)&buf, len);
@@ -387,13 +385,13 @@ bsock_getsockname(VALUE sock)
static VALUE
bsock_getpeername(VALUE sock)
{
- struct sockaddr_storage buf;
+ union_sockaddr buf;
socklen_t len = (socklen_t)sizeof buf;
socklen_t len0 = len;
rb_io_t *fptr;
GetOpenFile(sock, fptr);
- if (getpeername(fptr->fd, (struct sockaddr*)&buf, &len) < 0)
+ if (getpeername(fptr->fd, &buf.addr, &len) < 0)
rb_sys_fail("getpeername(2)");
if (len0 < len) len = len0;
return rb_str_new((char*)&buf, len);
@@ -431,7 +429,7 @@ bsock_getpeereid(VALUE self)
gid_t egid;
GetOpenFile(self, fptr);
if (getpeereid(fptr->fd, &euid, &egid) == -1)
- rb_sys_fail("getpeereid");
+ rb_sys_fail("getpeereid(3)");
return rb_assoc_new(UIDT2NUM(euid), GIDT2NUM(egid));
#elif defined(SO_PEERCRED) /* GNU/Linux */
rb_io_t *fptr;
@@ -447,7 +445,7 @@ bsock_getpeereid(VALUE self)
VALUE ret;
GetOpenFile(self, fptr);
if (getpeerucred(fptr->fd, &uc) == -1)
- rb_sys_fail("getpeerucred");
+ rb_sys_fail("getpeerucred(3C)");
ret = rb_assoc_new(UIDT2NUM(ucred_geteuid(uc)), GIDT2NUM(ucred_getegid(uc)));
ucred_free(uc);
return ret;
@@ -477,16 +475,16 @@ bsock_getpeereid(VALUE self)
static VALUE
bsock_local_address(VALUE sock)
{
- struct sockaddr_storage buf;
+ union_sockaddr buf;
socklen_t len = (socklen_t)sizeof buf;
socklen_t len0 = len;
rb_io_t *fptr;
GetOpenFile(sock, fptr);
- if (getsockname(fptr->fd, (struct sockaddr*)&buf, &len) < 0)
+ if (getsockname(fptr->fd, &buf.addr, &len) < 0)
rb_sys_fail("getsockname(2)");
if (len0 < len) len = len0;
- return rsock_fd_socket_addrinfo(fptr->fd, (struct sockaddr *)&buf, len);
+ return rsock_fd_socket_addrinfo(fptr->fd, &buf.addr, len);
}
/*
@@ -511,16 +509,16 @@ bsock_local_address(VALUE sock)
static VALUE
bsock_remote_address(VALUE sock)
{
- struct sockaddr_storage buf;
+ union_sockaddr buf;
socklen_t len = (socklen_t)sizeof buf;
socklen_t len0 = len;
rb_io_t *fptr;
GetOpenFile(sock, fptr);
- if (getpeername(fptr->fd, (struct sockaddr*)&buf, &len) < 0)
+ if (getpeername(fptr->fd, &buf.addr, &len) < 0)
rb_sys_fail("getpeername(2)");
if (len0 < len) len = len0;
- return rsock_fd_socket_addrinfo(fptr->fd, (struct sockaddr *)&buf, len);
+ return rsock_fd_socket_addrinfo(fptr->fd, &buf.addr, len);
}
/*
@@ -549,7 +547,6 @@ rsock_bsock_send(int argc, VALUE *argv, VALUE sock)
int n;
rb_blocking_function_t *func;
- rb_secure(4);
rb_scan_args(argc, argv, "21", &arg.mesg, &flags, &to);
StringValue(arg.mesg);
@@ -557,7 +554,7 @@ rsock_bsock_send(int argc, VALUE *argv, VALUE sock)
SockAddrStringValue(to);
to = rb_str_new4(to);
arg.to = (struct sockaddr *)RSTRING_PTR(to);
- arg.tolen = (socklen_t)RSTRING_LENINT(to);
+ arg.tolen = RSTRING_SOCKLEN(to);
func = rsock_sendto_blocking;
}
else {
@@ -566,7 +563,7 @@ rsock_bsock_send(int argc, VALUE *argv, VALUE sock)
GetOpenFile(sock, fptr);
arg.fd = fptr->fd;
arg.flags = NUM2INT(flags);
- while (rb_thread_fd_writable(arg.fd),
+ while (rsock_maybe_fd_writable(arg.fd),
(n = (int)BLOCKING_REGION_FD(func, &arg)) < 0) {
if (rb_io_wait_writable(arg.fd)) {
continue;
@@ -615,7 +612,6 @@ bsock_do_not_reverse_lookup_set(VALUE sock, VALUE state)
{
rb_io_t *fptr;
- rb_secure(4);
GetOpenFile(sock, fptr);
if (RTEST(state)) {
fptr->mode |= FMODE_NOREVLOOKUP;
@@ -735,7 +731,6 @@ bsock_do_not_rev_lookup(void)
static VALUE
bsock_do_not_rev_lookup_set(VALUE self, VALUE val)
{
- rb_secure(4);
rsock_do_not_reverse_lookup = RTEST(val);
return val;
}
diff --git a/ext/socket/constants.c b/ext/socket/constants.c
index 39f985b316..bab27b23bb 100644
--- a/ext/socket/constants.c
+++ b/ext/socket/constants.c
@@ -105,7 +105,7 @@ rsock_cmsg_type_arg(int family, int level, VALUE type)
return constant_arg(type, rsock_scm_optname_to_int, "unknown UNIX control message");
case IPPROTO_IP:
return constant_arg(type, rsock_ip_optname_to_int, "unknown IP control message");
-#ifdef INET6
+#ifdef IPPROTO_IPV6
case IPPROTO_IPV6:
return constant_arg(type, rsock_ipv6_optname_to_int, "unknown IPv6 control message");
#endif
diff --git a/ext/socket/depend b/ext/socket/depend
index 1716f9cb89..cd3fae98ea 100644
--- a/ext/socket/depend
+++ b/ext/socket/depend
@@ -1,11 +1,15 @@
-SOCK_HEADERS = $(srcdir)/rubysocket.h $(hdrdir)/ruby/ruby.h $(arch_hdrdir)/ruby/config.h \
- $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/io.h $(hdrdir)/ruby/thread.h \
+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)
diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb
index 13937ac773..c4523da24d 100644
--- a/ext/socket/extconf.rb
+++ b/ext/socket/extconf.rb
@@ -1,49 +1,6 @@
require 'mkmf'
-$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
-
-case RUBY_PLATFORM
-when /(ms|bcc)win(32|64)|mingw/
- test_func = "WSACleanup"
- have_library("ws2_32", "WSACleanup")
-when /cygwin/
- test_func = "socket"
-when /beos/
- test_func = "socket"
- have_library("net", "socket")
-when /haiku/
- test_func = "socket"
- have_library("network", "socket")
-when /i386-os2_emx/
- test_func = "socket"
- have_library("socket", "socket")
-else
- test_func = "socket"
- have_library("nsl", "t_open")
- have_library("socket", "socket")
-end
-
-if /darwin/ =~ RUBY_PLATFORM
- # For IPv6 extension header access on OS X 10.7+ [Bug #8517]
- $CFLAGS << " -D__APPLE_USE_RFC_3542"
-end
-
-headers = []
-unless $mswin or $bccwin or $mingw
- headers = %w<sys/types.h netdb.h string.h sys/socket.h netinet/in.h>
-end
-if /solaris/ =~ RUBY_PLATFORM and !try_compile("")
- # bug of gcc 3.0 on Solaris 8 ?
- headers << "sys/feature_tests.h"
-end
-if have_header("arpa/inet.h")
- headers << "arpa/inet.h"
-end
-
-ipv6 = false
-default_ipv6 = /cygwin|beos|haiku/ !~ RUBY_PLATFORM
-if enable_config("ipv6", default_ipv6)
- if checking_for("ipv6") {try_link(<<EOF)}
+AF_INET6_SOCKET_CREATION_TEST = <<EOF
#include <sys/types.h>
#ifndef _WIN32
#include <sys/socket.h>
@@ -55,82 +12,116 @@ main(void)
return 0;
}
EOF
- $defs << "-DENABLE_IPV6" << "-DINET6"
- ipv6 = true
- end
-end
-
-if ipv6
- if $mingw
- $CPPFLAGS << " -D_WIN32_WINNT=0x501" unless $CPPFLAGS.include?("_WIN32_WINNT")
- end
- ipv6lib = nil
- class << (fmt = "unknown")
- def %(s) s || self end
- end
- idirs, ldirs = dir_config("inet6", %w[/usr/inet6 /usr/local/v6].find {|d| File.directory?(d)})
- checking_for("ipv6 type", fmt) do
- if have_macro("IPV6_INRIA_VERSION", "netinet/in.h")
- "inria"
- elsif have_macro("__KAME__", "netinet/in.h")
- have_library(ipv6lib = "inet6")
- "kame"
- elsif have_macro("_TOSHIBA_INET6", "sys/param.h")
- have_library(ipv6lib = "inet6") and "toshiba"
- elsif have_macro("__V6D__", "sys/v6config.h")
- have_library(ipv6lib = "v6") and "v6d"
- elsif have_macro("_ZETA_MINAMI_INET6", "sys/param.h")
- have_library(ipv6lib = "inet6") and "zeta"
- elsif ipv6lib = with_config("ipv6-lib")
- warn <<EOS
---with-ipv6-lib and --with-ipv6-libdir option will be obsolete, use
---with-inet6lib and --with-inet6-{include,lib} options instead.
-EOS
- find_library(ipv6lib, nil, with_config("ipv6-libdir", ldirs)) and
- ipv6lib
- elsif have_library("inet6")
- "inet6"
- end
- end or not ipv6lib or abort <<EOS
-Fatal: no #{ipv6lib} library found. cannot continue.
-You need to fetch lib#{ipv6lib}.a from appropriate
-ipv6 kit and compile beforehand.
-EOS
-end
+GETADDRINFO_GETNAMEINFO_TEST = <<EOF
+#include <stdlib.h>
-if have_struct_member("struct sockaddr_in", "sin_len", headers)
- $defs[-1] = "-DHAVE_SIN_LEN"
-end
+#ifndef EXIT_SUCCESS
+#define EXIT_SUCCESS 0
+#endif
+#ifndef EXIT_FAILURE
+#define EXIT_FAILURE 1
+#endif
-# doug's fix, NOW add -Dss_family... only if required!
-doug = proc {have_struct_member("struct sockaddr_storage", "ss_family", headers)}
-if (doug[] or
- with_cppflags($CPPFLAGS + " -Dss_family=__ss_family", &doug))
- $defs[-1] = "-DHAVE_SOCKADDR_STORAGE"
- doug = proc {have_struct_member("struct sockaddr_storage", "ss_len", headers)}
- doug[] or with_cppflags($CPPFLAGS + " -Dss_len=__ss_len", &doug)
-end
+#ifndef AF_LOCAL
+#define AF_LOCAL AF_UNIX
+#endif
-if have_struct_member("struct sockaddr", "sa_len", headers)
- $defs[-1] = "-DHAVE_SA_LEN "
-end
+int
+main(void)
+{
+ int passive, gaierr, inet4 = 0, inet6 = 0;
+ struct addrinfo hints, *ai, *aitop;
+ char straddr[INET6_ADDRSTRLEN], strport[16];
+#ifdef _WIN32
+ WSADATA retdata;
-have_header("netinet/tcp.h") if /cygwin/ !~ RUBY_PLATFORM # for cygwin 1.1.5
-have_header("netinet/udp.h")
+ WSAStartup(MAKEWORD(2, 0), &retdata);
+#endif
-if !have_macro("IPPROTO_IPV6", headers) && have_const("IPPROTO_IPV6", headers)
- IO.read(File.join(File.dirname(__FILE__), "mkconstants.rb")).sub(/\A.*^__END__$/m, '').split(/\r?\n/).grep(/\AIPPROTO_\w*/){$&}.each {|name|
- have_const(name, headers) unless $defs.include?("-DHAVE_CONST_#{name.upcase}")
+ for (passive = 0; passive <= 1; passive++) {
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = AF_UNSPEC;
+ hints.ai_protocol = IPPROTO_TCP;
+ hints.ai_flags = passive ? AI_PASSIVE : 0;
+ hints.ai_socktype = SOCK_STREAM;
+ if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
+ (void)gai_strerror(gaierr);
+ goto bad;
+ }
+ for (ai = aitop; ai; ai = ai->ai_next) {
+ if (ai->ai_family == AF_LOCAL) continue;
+ if (ai->ai_addr == NULL)
+ goto bad;
+#if defined(_AIX)
+ if (ai->ai_family == AF_INET6 && passive) {
+ inet6++;
+ continue;
+ }
+ ai->ai_addr->sa_len = ai->ai_addrlen;
+ ai->ai_addr->sa_family = ai->ai_family;
+#endif
+ if (ai->ai_addrlen == 0 ||
+ getnameinfo(ai->ai_addr, ai->ai_addrlen,
+ straddr, sizeof(straddr), strport, sizeof(strport),
+ NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
+ goto bad;
+ }
+ if (strcmp(strport, "54321") != 0) {
+ goto bad;
+ }
+ switch (ai->ai_family) {
+ case AF_INET:
+ if (passive) {
+ if (strcmp(straddr, "0.0.0.0") != 0) {
+ goto bad;
+ }
+ } else {
+ if (strcmp(straddr, "127.0.0.1") != 0) {
+ goto bad;
+ }
+ }
+ inet4++;
+ break;
+ case AF_INET6:
+ if (passive) {
+ if (strcmp(straddr, "::") != 0) {
+ goto bad;
+ }
+ } else {
+ if (strcmp(straddr, "::1") != 0) {
+ goto bad;
+ }
+ }
+ inet6++;
+ break;
+ case AF_UNSPEC:
+ goto bad;
+ break;
+ default:
+ /* another family support? */
+ break;
+ }
+ }
}
-end
-if have_func("sendmsg") | have_func("recvmsg")
- have_struct_member('struct msghdr', 'msg_control', ['sys/types.h', 'sys/socket.h'])
- have_struct_member('struct msghdr', 'msg_accrights', ['sys/types.h', 'sys/socket.h'])
-end
+ if (!(inet4 == 0 || inet4 == 2))
+ goto bad;
+ if (!(inet6 == 0 || inet6 == 2))
+ goto bad;
-if checking_for("recvmsg() with MSG_PEEK allocate file descriptors") {try_run(cpp_include(headers) + <<'EOF')}
+ if (aitop)
+ freeaddrinfo(aitop);
+ return EXIT_SUCCESS;
+
+ bad:
+ if (aitop)
+ freeaddrinfo(aitop);
+ return EXIT_FAILURE;
+}
+EOF
+
+RECVMSG_WITH_MSG_PEEK_ALLOCATE_FD_TEST = <<'EOF'
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -250,147 +241,224 @@ int main(int argc, char *argv[])
return EXIT_SUCCESS;
}
EOF
- $defs << "-DFD_PASSING_WORK_WITH_RECVMSG_MSG_PEEK"
+
+def test_recvmsg_with_msg_peek_creates_fds(headers)
+ case RUBY_PLATFORM
+ when /linux/
+ # Linux 2.6.38 allocate fds by recvmsg with MSG_PEEK.
+ close_fds = true
+ when /bsd|darwin/
+ # FreeBSD 8.2.0, NetBSD 5 and MacOS X Snow Leopard doesn't
+ # allocate fds by recvmsg with MSG_PEEK.
+ # [ruby-dev:44189]
+ # http://bugs.ruby-lang.org/issues/5075
+ close_fds = false
+ when /cygwin/
+ # Cygwin doesn't support fd passing.
+ # http://cygwin.com/ml/cygwin/2003-09/msg01808.html
+ close_fds = false
+ else
+ close_fds = nil
+ end
+ if !CROSS_COMPILING
+ if checking_for("recvmsg() with MSG_PEEK allocate file descriptors") {
+ try_run(cpp_include(headers) + RECVMSG_WITH_MSG_PEEK_ALLOCATE_FD_TEST)
+ }
+ if close_fds == false
+ warn "unexpected fd-passing recvmsg() with MSG_PEEK behavor on #{RUBY_PLATFORM}: fd allocation unexpected."
+ elsif close_fds == nil
+ puts "info: #{RUBY_PLATFORM} recvmsg() with MSG_PEEK allocates fds on fd-passing."
+ end
+ close_fds = true
+ else
+ if close_fds == true
+ warn "unexpected fd-passing recvmsg() with MSG_PEEK behavor on #{RUBY_PLATFORM}: fd allocation expected."
+ elsif close_fds == nil
+ puts "info: #{RUBY_PLATFORM}: recvmsg() with MSG_PEEK doesn't allocates fds on fd-passing."
+ end
+ close_fds = false
+ end
+ end
+ if close_fds == nil
+ abort <<EOS
+Fatal: cannot test fd-passing recvmsg() with MSG_PEEK behavor
+because cross-compilation for #{RUBY_PLATFORM}.
+If recvmsg() with MSG_PEEK allocates fds on fd passing:
+--enable-close-fds-by-recvmsg-with-peek
+If recvmsg() with MSG_PEEK doesn't allocate fds on fd passing:
+--disable-close-fds-by-recvmsg-with-peek
+EOS
+ end
+ close_fds
end
-getaddr_info_ok = (enable_config("wide-getaddrinfo") && :wide) ||
- (checking_for("wide getaddrinfo") {try_run(<<EOF)} && :os)
-#{cpp_include(headers)}
-#include <stdlib.h>
+$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
-#ifndef EXIT_SUCCESS
-#define EXIT_SUCCESS 0
-#endif
-#ifndef EXIT_FAILURE
-#define EXIT_FAILURE 1
-#endif
+if /darwin/ =~ RUBY_PLATFORM
+ # For IPv6 extension header access on OS X 10.7+ [Bug #8517]
+ $CFLAGS << " -D__APPLE_USE_RFC_3542"
+end
-#ifndef AF_LOCAL
-#define AF_LOCAL AF_UNIX
-#endif
+headers = []
+unless $mswin or $mingw
+ headers = %w<sys/types.h netdb.h string.h sys/socket.h netinet/in.h>
+end
-int
-main(void)
-{
- int passive, gaierr, inet4 = 0, inet6 = 0;
- struct addrinfo hints, *ai, *aitop;
- char straddr[INET6_ADDRSTRLEN], strport[16];
-#ifdef _WIN32
- WSADATA retdata;
+%w[
+ sys/uio.h
+ xti.h
+ netinet/in_systm.h
+ netinet/tcp.h
+ netinet/tcp_fsm.h
+ netinet/udp.h
+ arpa/inet.h
+ netpacket/packet.h
+ net/ethernet.h
+ sys/un.h
+ ifaddrs.h
+ sys/ioctl.h
+ sys/sockio.h
+ net/if.h
+ sys/param.h
+ sys/ucred.h
+ ucred.h
+ net/if_dl.h
+ arpa/nameser.h
+ resolv.h
+].each {|h|
+ if have_header(h, headers)
+ headers << h
+ end
+}
- WSAStartup(MAKEWORD(2, 0), &retdata);
-#endif
+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
- for (passive = 0; passive <= 1; passive++) {
- memset(&hints, 0, sizeof(hints));
- hints.ai_family = AF_UNSPEC;
- hints.ai_protocol = IPPROTO_TCP;
- hints.ai_flags = passive ? AI_PASSIVE : 0;
- hints.ai_socktype = SOCK_STREAM;
- if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
- (void)gai_strerror(gaierr);
- goto bad;
- }
- for (ai = aitop; ai; ai = ai->ai_next) {
- if (ai->ai_family == AF_LOCAL) continue;
- if (ai->ai_addr == NULL)
- goto bad;
-#if defined(_AIX)
- if (ai->ai_family == AF_INET6 && passive) {
- inet6++;
- continue;
- }
- ai->ai_addr->sa_len = ai->ai_addrlen;
- ai->ai_addr->sa_family = ai->ai_family;
-#endif
- if (ai->ai_addrlen == 0 ||
- getnameinfo(ai->ai_addr, ai->ai_addrlen,
- straddr, sizeof(straddr), strport, sizeof(strport),
- NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
- goto bad;
- }
- if (strcmp(strport, "54321") != 0) {
- goto bad;
- }
- switch (ai->ai_family) {
- case AF_INET:
- if (passive) {
- if (strcmp(straddr, "0.0.0.0") != 0) {
- goto bad;
- }
- } else {
- if (strcmp(straddr, "127.0.0.1") != 0) {
- goto bad;
- }
- }
- inet4++;
- break;
- case AF_INET6:
- if (passive) {
- if (strcmp(straddr, "::") != 0) {
- goto bad;
- }
- } else {
- if (strcmp(straddr, "::1") != 0) {
- goto bad;
- }
- }
- inet6++;
- break;
- case AF_UNSPEC:
- goto bad;
- break;
- default:
- /* another family support? */
- break;
- }
- }
- }
+if have_type("struct sockaddr_un", headers) # POSIX
+ have_struct_member("struct sockaddr_un", "sun_len", headers) # 4.4BSD
+end
- if (!(inet4 == 0 || inet4 == 2))
- goto bad;
- if (!(inet6 == 0 || inet6 == 2))
- goto bad;
+have_type("struct sockaddr_dl", headers) # AF_LINK address. 4.4BSD since Net2
- if (aitop)
- freeaddrinfo(aitop);
- return EXIT_SUCCESS;
+have_type("struct sockaddr_storage", headers)
- bad:
- if (aitop)
- freeaddrinfo(aitop);
- return EXIT_FAILURE;
+have_type("struct addrinfo", headers)
+
+if have_type("socklen_t", headers)
+ if try_static_assert("sizeof(socklen_t) >= sizeof(long)", headers)
+ $defs << "-DRSTRING_SOCKLEN=(socklen_t)RSTRING_LEN"
+ end
+end
+
+have_type("struct in_pktinfo", headers) {|src|
+ src.sub(%r'^/\*top\*/', '\&'"\n#if defined(IPPROTO_IP) && defined(IP_PKTINFO)") <<
+ "#else\n" << "#error\n" << ">>>>>> no in_pktinfo <<<<<<\n" << "#endif\n"
+} and have_struct_member("struct in_pktinfo", "ipi_spec_dst", headers)
+have_type("struct in6_pktinfo", headers) {|src|
+ src.sub(%r'^/\*top\*/', '\&'"\n#if defined(IPPROTO_IPV6) && defined(IPV6_PKTINFO)") <<
+ "#else\n" << "#error\n" << ">>>>>> no in6_pktinfo <<<<<<\n" << "#endif\n"
}
-EOF
-if ipv6 and not getaddr_info_ok
- abort <<EOS
-Fatal: --enable-ipv6 is specified, and your OS seems to support IPv6 feature.
-But your getaddrinfo() and getnameinfo() are appeared to be broken. Sorry,
-you cannot compile IPv6 socket classes with broken these functions.
-You can try --enable-wide-getaddrinfo.
-EOS
+have_type("struct sockcred", headers)
+have_type("struct cmsgcred", headers)
+
+have_type("struct ip_mreq", headers) # 4.4BSD
+have_type("struct ip_mreqn", headers) # Linux 2.4
+have_type("struct ipv6_mreq", headers) # RFC 3493
+
+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)
+ have_struct_member('struct tcp_info', 'tcpi_ca_state', headers)
+ 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 with_config("lookup-order-hack", "UNSPEC")
-when "INET"
- $defs << "-DLOOKUP_ORDER_HACK_INET"
-when "INET6"
- $defs << "-DLOOKUP_ORDER_HACK_INET6"
-when "UNSPEC"
- # nothing special
+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
- abort <<EOS
-
-Fatal: invalid value for --with-lookup-order-hack (expected INET, INET6 or UNSPEC)
-EOS
+ test_func = "socket(0,0,0)"
+ have_library("nsl", 't_open("", 0, (struct t_info *)NULL)', headers) # SunOS
+ have_library("socket", "socket(0,0,0)", headers) # SunOS
end
-have_type("struct addrinfo", headers)
-have_func("freehostent")
-have_func("freeaddrinfo")
-if /haiku/ !~ RUBY_PLATFORM and have_func("gai_strerror")
- if checking_for("gai_strerror() returns const pointer") {!try_compile(<<EOF)}
+if have_func(test_func, headers)
+
+ have_func("sendmsg(0, (struct msghdr *)NULL, 0)", headers) # POSIX
+ have_recvmsg = have_func("recvmsg(0, (struct msghdr *)NULL, 0)", headers) # POSIX
+
+ have_func("freehostent((struct hostent *)NULL)", headers) # RFC 2553
+ have_func("freeaddrinfo((struct addrinfo *)NULL)", headers) # RFC 2553
+
+ if /haiku/ !~ RUBY_PLATFORM and
+ have_func("gai_strerror(0)", headers) # POSIX
+ if checking_for("gai_strerror() returns const pointer") {!try_compile(<<EOF)}
#{cpp_include(headers)}
#include <stdlib.h>
void
@@ -399,103 +467,196 @@ conftest_gai_strerror_is_const()
*gai_strerror(0) = 0;
}
EOF
- $defs << "-DGAI_STRERROR_CONST"
+ $defs << "-DGAI_STRERROR_CONST"
+ end
end
-end
-have_func("accept4")
-
-$objs = [
- "init.#{$OBJEXT}",
- "constants.#{$OBJEXT}",
- "basicsocket.#{$OBJEXT}",
- "socket.#{$OBJEXT}",
- "ipsocket.#{$OBJEXT}",
- "tcpsocket.#{$OBJEXT}",
- "tcpserver.#{$OBJEXT}",
- "sockssocket.#{$OBJEXT}",
- "udpsocket.#{$OBJEXT}",
- "unixsocket.#{$OBJEXT}",
- "unixserver.#{$OBJEXT}",
- "option.#{$OBJEXT}",
- "ancdata.#{$OBJEXT}",
- "raddrinfo.#{$OBJEXT}"
-]
-
-if getaddr_info_ok == :wide or
- !have_func("getnameinfo", headers) or !have_func("getaddrinfo", headers)
- if have_struct_member("struct in6_addr", "s6_addr8", headers)
- $defs[-1] = "s6_addr=s6_addr8"
- end
- if ipv6 == "kame" && have_struct_member("struct in6_addr", "s6_addr32", headers)
- $defs[-1] = "-DFAITH"
- end
- $CPPFLAGS="-I. "+$CPPFLAGS
- $objs += ["getaddrinfo.#{$OBJEXT}"]
- $objs += ["getnameinfo.#{$OBJEXT}"]
- $defs << "-DGETADDRINFO_EMU"
-end
+ have_func("accept4", headers)
-have_func('inet_ntop(0, (const void *)0, (char *)0, 0)') or
- have_func("inet_ntoa(*(struct in_addr *)NULL)")
-have_func('inet_pton(0, "", (void *)0)') or have_func('inet_aton("", (struct in_addr *)0)')
-have_func('getservbyport(0, "")')
-have_header("arpa/nameser.h")
-have_header("resolv.h")
+ have_func('inet_ntop(0, (const void *)0, (char *)0, 0)', headers) or
+ have_func("inet_ntoa(*(struct in_addr *)NULL)", headers)
+ have_func('inet_pton(0, "", (void *)0)', headers) or
+ have_func('inet_aton("", (struct in_addr *)0)', headers)
+ have_func('getservbyport(0, "")', headers)
+ have_func("getifaddrs((struct ifaddrs **)NULL)", headers)
-have_header("ifaddrs.h")
-have_func("getifaddrs")
-have_header("sys/ioctl.h")
-have_header("sys/sockio.h")
-have_header("net/if.h", headers)
+ have_func("getpeereid", headers)
-have_header("sys/param.h", headers)
-have_header("sys/ucred.h", headers)
+ have_func("getpeerucred(0, (ucred_t **)NULL)", headers) # SunOS
-unless have_type("socklen_t", headers)
- $defs << "-Dsocklen_t=int"
-end
+ have_func_decl = proc do |name, headers|
+ if !checking_for("declaration of #{name}()") {!%w[int void].all? {|ret| try_compile(<<EOF)}}
+#{cpp_include(headers)}
+#{ret} #{name}(void);
+EOF
+ $defs << "-DNEED_#{name.tr_cpp}_DECL"
+ end
+ end
+ if have_func('if_indextoname(0, "")', headers)
+ have_func_decl["if_indextoname"]
+ end
+ if have_func('if_nametoindex("")', headers)
+ have_func_decl["if_nametoindex"]
+ end
-have_header("sys/un.h")
-have_header("sys/uio.h")
-have_type("struct in_pktinfo", headers) {|src|
- src.sub(%r'^/\*top\*/', '\&'"\n#if defined(IPPROTO_IP) && defined(IP_PKTINFO)") <<
- "#else\n" << "#error\n" << ">>>>>> no in_pktinfo <<<<<<\n" << "#endif\n"
-} and have_struct_member("struct in_pktinfo", "ipi_spec_dst", headers)
-have_type("struct in6_pktinfo", headers) {|src|
- src.sub(%r'^/\*top\*/', '\&'"\n#if defined(IPPROTO_IPV6) && defined(IPV6_PKTINFO)") <<
- "#else\n" << "#error\n" << ">>>>>> no in6_pktinfo <<<<<<\n" << "#endif\n"
-}
+ have_func("hsterror", headers)
+ have_func('getipnodebyname("", 0, 0, (int *)0)', headers) # RFC 2553
+ have_func('gethostbyname2("", 0)', headers) # RFC 2133
+ have_func("socketpair(0, 0, 0, 0)", headers)
+ unless have_func("gethostname((char *)0, 0)", headers)
+ have_func("uname((struct utsname *)NULL)", headers)
+ end
-have_type("struct sockcred", headers)
-have_type("struct cmsgcred", headers)
+ ipv6 = false
+ 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"
+ ipv6 = true
+ end
+ end
-have_func("getpeereid")
+ if ipv6
+ if $mingw
+ $CPPFLAGS << " -D_WIN32_WINNT=0x501" unless $CPPFLAGS.include?("_WIN32_WINNT")
+ end
+ ipv6lib = nil
+ class << (fmt = "unknown")
+ def %(s) s || self end
+ end
+ idirs, ldirs = dir_config("inet6", %w[/usr/inet6 /usr/local/v6].find {|d| File.directory?(d)})
+ checking_for("ipv6 type", fmt) do
+ if have_macro("IPV6_INRIA_VERSION", "netinet/in.h")
+ "inria"
+ elsif have_macro("__KAME__", "netinet/in.h")
+ have_library(ipv6lib = "inet6")
+ "kame"
+ elsif have_macro("_TOSHIBA_INET6", "sys/param.h")
+ have_library(ipv6lib = "inet6") and "toshiba"
+ elsif have_macro("__V6D__", "sys/v6config.h")
+ have_library(ipv6lib = "v6") and "v6d"
+ elsif have_macro("_ZETA_MINAMI_INET6", "sys/param.h")
+ have_library(ipv6lib = "inet6") and "zeta"
+ elsif have_library("inet6")
+ "inet6"
+ end
+ end or not ipv6lib or abort <<EOS
+
+Fatal: no #{ipv6lib} library found. cannot continue.
+You need to fetch lib#{ipv6lib}.a from appropriate
+ipv6 kit and compile beforehand.
+EOS
+ end
-have_header("ucred.h", headers)
-have_func("getpeerucred")
+ if !have_macro("IPPROTO_IPV6", headers) && have_const("IPPROTO_IPV6", headers)
+ IO.read(File.join(File.dirname(__FILE__), "mkconstants.rb")).sub(/\A.*^__END__$/m, '').split(/\r?\n/).grep(/\AIPPROTO_\w*/){$&}.each {|name|
+ have_const(name, headers) unless $defs.include?("-DHAVE_CONST_#{name.upcase}")
+ }
+ end
-have_func("if_indextoname")
+ if enable_config("close-fds-by-recvmsg-with-peek") {
+ have_msg_control && have_recvmsg &&
+ have_const('AF_UNIX', headers) && have_const('SCM_RIGHTS', headers) &&
+ test_recvmsg_with_msg_peek_creates_fds(headers)
+ }
+ $defs << "-DFD_PASSING_WORK_WITH_RECVMSG_MSG_PEEK"
+ end
-have_type("struct ip_mreq", headers) # 4.4BSD
-have_type("struct ip_mreqn", headers) # Linux 2.4
-have_type("struct ipv6_mreq", headers) # RFC 3493
+ case enable_config("wide-getaddrinfo")
+ when true
+ getaddr_info_ok = :wide
+ 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)
+ getaddr_info_ok = :os
+ if !CROSS_COMPILING &&
+ !checking_for("system getaddrinfo working") {
+ try_run(cpp_include(headers) + GETADDRINFO_GETNAMEINFO_TEST)
+ }
+ getaddr_info_ok = nil
+ end
+ else
+ getaddr_info_ok = nil
+ end
+ else
+ raise "unexpected enable_config() value"
+ end
+
+ if ipv6 and not getaddr_info_ok
+ abort <<EOS
-# workaround for recent Windows SDK
-$defs << "-DIPPROTO_IPV6=IPPROTO_IPV6" if $defs.include?("-DHAVE_CONST_IPPROTO_IPV6") && !have_macro("IPPROTO_IPV6")
+Fatal: --enable-ipv6 is specified, and your OS seems to support IPv6 feature.
+But your getaddrinfo() and getnameinfo() are appeared to be broken. Sorry,
+you cannot compile IPv6 socket classes with broken these functions.
+You can try --enable-wide-getaddrinfo.
+EOS
+ end
-$distcleanfiles << "constants.h" << "constdefs.*"
+ case with_config("lookup-order-hack", "UNSPEC")
+ when "INET"
+ $defs << "-DLOOKUP_ORDER_HACK_INET"
+ when "INET6"
+ $defs << "-DLOOKUP_ORDER_HACK_INET6"
+ when "UNSPEC"
+ # nothing special
+ else
+ abort <<EOS
-if have_func(test_func)
- have_func("hsterror")
- have_func("getipnodebyname") or have_func("gethostbyname2")
- if !have_func("socketpair(0, 0, 0, 0)") and have_func("rb_w32_socketpair(0, 0, 0, 0)")
- $defs << "-Dsocketpair(a,b,c,d)=rb_w32_socketpair((a),(b),(c),(d))"
- $defs << "-DHAVE_SOCKETPAIR"
+Fatal: invalid value for --with-lookup-order-hack (expected INET, INET6 or UNSPEC)
+EOS
end
- unless have_func("gethostname((char *)0, 0)")
- have_func("uname")
+
+ $objs = [
+ "init.#{$OBJEXT}",
+ "constants.#{$OBJEXT}",
+ "basicsocket.#{$OBJEXT}",
+ "socket.#{$OBJEXT}",
+ "ipsocket.#{$OBJEXT}",
+ "tcpsocket.#{$OBJEXT}",
+ "tcpserver.#{$OBJEXT}",
+ "sockssocket.#{$OBJEXT}",
+ "udpsocket.#{$OBJEXT}",
+ "unixsocket.#{$OBJEXT}",
+ "unixserver.#{$OBJEXT}",
+ "option.#{$OBJEXT}",
+ "ancdata.#{$OBJEXT}",
+ "raddrinfo.#{$OBJEXT}",
+ "ifaddr.#{$OBJEXT}"
+ ]
+
+ if getaddr_info_ok == :wide
+ if !have_type("struct in6_addr", headers) and have_type("struct in_addr6", headers)
+ $defs.pop(2)
+ $defs << "-Din_addr6=in6_addr"
+ end
+ if have_struct_member("struct in6_addr", "s6_addr8", headers)
+ $defs[-1] = "-Ds6_addr=s6_addr8"
+ end
+ if ipv6 == "kame" && have_struct_member("struct in6_addr", "s6_addr32", headers)
+ $defs[-1] = "-DFAITH"
+ end
+ $CPPFLAGS="-I. "+$CPPFLAGS
+ $objs += ["getaddrinfo.#{$OBJEXT}"]
+ $objs += ["getnameinfo.#{$OBJEXT}"]
+ $defs << "-DGETADDRINFO_EMU"
end
+
+ # workaround for recent Windows SDK
+ $defs << "-DIPPROTO_IPV6=IPPROTO_IPV6" if $defs.include?("-DHAVE_CONST_IPPROTO_IPV6") && !have_macro("IPPROTO_IPV6")
+
+ $distcleanfiles << "constants.h" << "constdefs.*"
+
if enable_config("socks", ENV["SOCKS_SERVER"])
if have_library("socks5", "SOCKSinit")
$defs << "-DSOCKS5" << "-DSOCKS"
@@ -503,6 +664,7 @@ if have_func(test_func)
$defs << "-DSOCKS"
end
end
+
hdr = "netinet6/in6.h"
if /darwin/ =~ RUBY_PLATFORM and !try_compile(<<"SRC", nil, :werror=>true)
#include <netinet/in.h>
diff --git a/ext/socket/getaddrinfo.c b/ext/socket/getaddrinfo.c
index aa966b3c52..a17d12b705 100644
--- a/ext/socket/getaddrinfo.c
+++ b/ext/socket/getaddrinfo.c
@@ -80,6 +80,10 @@
#include <socks.h>
#endif
+#ifndef HAVE_TYPE_SOCKLEN_T
+typedef int socklen_t;
+#endif
+
#include "addrinfo.h"
#include "sockport.h"
@@ -184,9 +188,9 @@ if (pai->ai_flags & AI_CANONNAME) {\
}\
memcpy((ai), pai, sizeof(struct addrinfo));\
(ai)->ai_addr = (struct sockaddr *)((ai) + 1);\
- memset((ai)->ai_addr, 0, (afd)->a_socklen);\
- SET_SA_LEN((ai)->ai_addr, (ai)->ai_addrlen = (afd)->a_socklen);\
- (ai)->ai_addr->sa_family = (ai)->ai_family = (afd)->a_af;\
+ (ai)->ai_family = (afd)->a_af;\
+ (ai)->ai_addrlen = (afd)->a_socklen;\
+ INIT_SOCKADDR((ai)->ai_addr, (afd)->a_af, (afd)->a_socklen);\
((struct sockinet *)(ai)->ai_addr)->si_port = (port);\
p = (char *)((ai)->ai_addr);\
memcpy(p + (afd)->a_off, (addr), (afd)->a_addrlen);\
diff --git a/ext/socket/getnameinfo.c b/ext/socket/getnameinfo.c
index d1d5ff6c73..4da9680ccb 100644
--- a/ext/socket/getnameinfo.c
+++ b/ext/socket/getnameinfo.c
@@ -71,6 +71,10 @@
#include <socks.h>
#endif
+#ifndef HAVE_TYPE_SOCKLEN_T
+typedef int socklen_t;
+#endif
+
#include "addrinfo.h"
#include "sockport.h"
@@ -151,8 +155,8 @@ getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, socklen_t ho
if (sa == NULL)
return ENI_NOSOCKET;
- len = SA_LEN(sa);
- if (len != salen) return ENI_SALEN;
+ if (!VALIDATE_SOCKLEN(sa, salen)) return ENI_SALEN;
+ len = salen;
family = sa->sa_family;
for (i = 0; afdl[i].a_af; i++)
diff --git a/ext/socket/ifaddr.c b/ext/socket/ifaddr.c
new file mode 100644
index 0000000000..15395d7088
--- /dev/null
+++ b/ext/socket/ifaddr.c
@@ -0,0 +1,459 @@
+#include "rubysocket.h"
+
+#ifdef HAVE_GETIFADDRS
+
+/*
+ * ifa_flags is usually unsigned int.
+ * However it is uint64_t on SunOS 5.11 (OpenIndiana).
+ */
+#ifdef HAVE_LONG_LONG
+typedef unsigned LONG_LONG ifa_flags_t;
+#define PRIxIFAFLAGS PRI_LL_PREFIX"x"
+#define IFAFLAGS2NUM(flags) ULL2NUM(flags)
+#else
+typedef unsigned int ifa_flags_t;
+#define PRIxIFAFLAGS "x"
+#define IFAFLAGS2NUM(flags) UINT2NUM(flags)
+#endif
+
+VALUE rb_cSockIfaddr;
+
+typedef struct rb_ifaddr_tag rb_ifaddr_t;
+typedef struct rb_ifaddr_root_tag rb_ifaddr_root_t;
+
+struct rb_ifaddr_tag {
+ int ord;
+ struct ifaddrs *ifaddr;
+ rb_ifaddr_root_t *root;
+};
+
+struct rb_ifaddr_root_tag {
+ int refcount;
+ int numifaddrs;
+ rb_ifaddr_t ary[1];
+};
+
+static rb_ifaddr_root_t *
+get_root(const rb_ifaddr_t *ifaddr)
+{
+ return (rb_ifaddr_root_t *)((char *)&ifaddr[-ifaddr->ord] -
+ offsetof(rb_ifaddr_root_t, ary));
+}
+
+static void
+ifaddr_mark(void *ptr)
+{
+}
+
+static void
+ifaddr_free(void *ptr)
+{
+ rb_ifaddr_t *ifaddr = ptr;
+ rb_ifaddr_root_t *root = get_root(ifaddr);
+ root->refcount--;
+ if (root->refcount == 0) {
+ freeifaddrs(root->ary[0].ifaddr);
+ xfree(root);
+ }
+}
+
+static size_t
+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);
+}
+
+static const rb_data_type_t ifaddr_type = {
+ "socket/ifaddr",
+ {ifaddr_mark, ifaddr_free, ifaddr_memsize,},
+};
+
+static inline rb_ifaddr_t *
+check_ifaddr(VALUE self)
+{
+ return rb_check_typeddata(self, &ifaddr_type);
+}
+
+static rb_ifaddr_t *
+get_ifaddr(VALUE self)
+{
+ rb_ifaddr_t *rifaddr = check_ifaddr(self);
+
+ if (!rifaddr) {
+ rb_raise(rb_eTypeError, "uninitialized ifaddr");
+ }
+ return rifaddr;
+}
+
+static VALUE
+rsock_getifaddrs(void)
+{
+ int ret;
+ int numifaddrs, i;
+ struct ifaddrs *ifaddrs, *ifa;
+ rb_ifaddr_root_t *root;
+ VALUE result;
+
+ ret = getifaddrs(&ifaddrs);
+ if (ret == -1)
+ rb_sys_fail("getifaddrs");
+
+ if (!ifaddrs) {
+ return rb_ary_new();
+ }
+
+ numifaddrs = 0;
+ for (ifa = ifaddrs; ifa != NULL; ifa = ifa->ifa_next)
+ numifaddrs++;
+
+ root = xmalloc(sizeof(rb_ifaddr_root_t) + (numifaddrs-1) * sizeof(rb_ifaddr_t));
+ root->refcount = root->numifaddrs = numifaddrs;
+
+ ifa = ifaddrs;
+ for (i = 0; i < numifaddrs; i++) {
+ root->ary[i].ord = i;
+ root->ary[i].ifaddr = ifa;
+ root->ary[i].root = root;
+ ifa = ifa->ifa_next;
+ }
+
+ result = rb_ary_new2(numifaddrs);
+ for (i = 0; i < numifaddrs; i++) {
+ rb_ary_push(result, TypedData_Wrap_Struct(rb_cSockIfaddr, &ifaddr_type, &root->ary[i]));
+ }
+
+ return result;
+}
+
+/*
+ * call-seq:
+ * ifaddr.name => string
+ *
+ * Returns the interface name of _ifaddr_.
+ */
+
+static VALUE
+ifaddr_name(VALUE self)
+{
+ rb_ifaddr_t *rifaddr = get_ifaddr(self);
+ struct ifaddrs *ifa = rifaddr->ifaddr;
+ return rb_str_new_cstr(ifa->ifa_name);
+}
+
+#ifdef HAVE_IF_NAMETOINDEX
+/*
+ * call-seq:
+ * ifaddr.ifindex => integer
+ *
+ * Returns the interface index of _ifaddr_.
+ */
+
+static VALUE
+ifaddr_ifindex(VALUE self)
+{
+ rb_ifaddr_t *rifaddr = get_ifaddr(self);
+ struct ifaddrs *ifa = rifaddr->ifaddr;
+ unsigned int ifindex = if_nametoindex(ifa->ifa_name);
+ if (ifindex == 0) {
+ rb_raise(rb_eArgError, "invalid interface name: %s", ifa->ifa_name);
+ }
+ return UINT2NUM(ifindex);
+}
+#else
+#define ifaddr_ifindex rb_f_notimplement
+#endif
+
+/*
+ * call-seq:
+ * ifaddr.flags => integer
+ *
+ * Returns the flags of _ifaddr_.
+ */
+
+static VALUE
+ifaddr_flags(VALUE self)
+{
+ rb_ifaddr_t *rifaddr = get_ifaddr(self);
+ struct ifaddrs *ifa = rifaddr->ifaddr;
+ return IFAFLAGS2NUM(ifa->ifa_flags);
+}
+
+/*
+ * call-seq:
+ * ifaddr.addr => addrinfo
+ *
+ * Returns the address of _ifaddr_.
+ * nil is returned if address is not available in _ifaddr_.
+ */
+
+static VALUE
+ifaddr_addr(VALUE self)
+{
+ rb_ifaddr_t *rifaddr = get_ifaddr(self);
+ struct ifaddrs *ifa = rifaddr->ifaddr;
+ if (ifa->ifa_addr)
+ return rsock_sockaddr_obj(ifa->ifa_addr, rsock_sockaddr_len(ifa->ifa_addr));
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * ifaddr.netmask => addrinfo
+ *
+ * Returns the netmask address of _ifaddr_.
+ * nil is returned if netmask is not available in _ifaddr_.
+ */
+
+static VALUE
+ifaddr_netmask(VALUE self)
+{
+ rb_ifaddr_t *rifaddr = get_ifaddr(self);
+ struct ifaddrs *ifa = rifaddr->ifaddr;
+ if (ifa->ifa_netmask)
+ return rsock_sockaddr_obj(ifa->ifa_netmask, rsock_sockaddr_len(ifa->ifa_netmask));
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * ifaddr.broadaddr => addrinfo
+ *
+ * Returns the broadcast address of _ifaddr_.
+ * nil is returned if the flags doesn't have IFF_BROADCAST.
+ */
+
+static VALUE
+ifaddr_broadaddr(VALUE self)
+{
+ rb_ifaddr_t *rifaddr = get_ifaddr(self);
+ struct ifaddrs *ifa = rifaddr->ifaddr;
+ if ((ifa->ifa_flags & IFF_BROADCAST) && ifa->ifa_broadaddr)
+ return rsock_sockaddr_obj(ifa->ifa_broadaddr, rsock_sockaddr_len(ifa->ifa_broadaddr));
+ return Qnil;
+}
+
+/*
+ * call-seq:
+ * ifaddr.dstaddr => addrinfo
+ *
+ * Returns the destination address of _ifaddr_.
+ * nil is returned if the flags doesn't have IFF_POINTOPOINT.
+ */
+
+static VALUE
+ifaddr_dstaddr(VALUE self)
+{
+ rb_ifaddr_t *rifaddr = get_ifaddr(self);
+ struct ifaddrs *ifa = rifaddr->ifaddr;
+ if ((ifa->ifa_flags & IFF_POINTOPOINT) && ifa->ifa_dstaddr)
+ return rsock_sockaddr_obj(ifa->ifa_dstaddr, rsock_sockaddr_len(ifa->ifa_dstaddr));
+ return Qnil;
+}
+
+static void
+ifaddr_inspect_flags(ifa_flags_t flags, VALUE result)
+{
+ const char *sep = " ";
+#define INSPECT_BIT(bit, name) \
+ if (flags & (bit)) { rb_str_catf(result, "%s" name, sep); flags &= ~(ifa_flags_t)(bit); sep = ","; }
+#ifdef IFF_UP
+ INSPECT_BIT(IFF_UP, "UP")
+#endif
+#ifdef IFF_BROADCAST
+ INSPECT_BIT(IFF_BROADCAST, "BROADCAST")
+#endif
+#ifdef IFF_DEBUG
+ INSPECT_BIT(IFF_DEBUG, "DEBUG")
+#endif
+#ifdef IFF_LOOPBACK
+ INSPECT_BIT(IFF_LOOPBACK, "LOOPBACK")
+#endif
+#ifdef IFF_POINTOPOINT
+ INSPECT_BIT(IFF_POINTOPOINT, "POINTOPOINT")
+#endif
+#ifdef IFF_RUNNING
+ INSPECT_BIT(IFF_RUNNING, "RUNNING")
+#endif
+#ifdef IFF_NOARP
+ INSPECT_BIT(IFF_NOARP, "NOARP")
+#endif
+#ifdef IFF_PROMISC
+ INSPECT_BIT(IFF_PROMISC, "PROMISC")
+#endif
+#ifdef IFF_NOTRAILERS
+ INSPECT_BIT(IFF_NOTRAILERS, "NOTRAILERS")
+#endif
+#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
+#ifdef IFF_SLAVE
+ INSPECT_BIT(IFF_SLAVE, "SLAVE")
+#endif
+#ifdef IFF_MULTICAST
+ INSPECT_BIT(IFF_MULTICAST, "MULTICAST")
+#endif
+#ifdef IFF_PORTSEL
+ INSPECT_BIT(IFF_PORTSEL, "PORTSEL")
+#endif
+#ifdef IFF_AUTOMEDIA
+ INSPECT_BIT(IFF_AUTOMEDIA, "AUTOMEDIA")
+#endif
+#ifdef IFF_DYNAMIC
+ INSPECT_BIT(IFF_DYNAMIC, "DYNAMIC")
+#endif
+#ifdef IFF_LOWER_UP
+ INSPECT_BIT(IFF_LOWER_UP, "LOWER_UP")
+#endif
+#ifdef IFF_DORMANT
+ INSPECT_BIT(IFF_DORMANT, "DORMANT")
+#endif
+#ifdef IFF_ECHO
+ INSPECT_BIT(IFF_ECHO, "ECHO")
+#endif
+#undef INSPECT_BIT
+ if (flags) {
+ rb_str_catf(result, "%s%#"PRIxIFAFLAGS, sep, flags);
+ }
+}
+
+/*
+ * call-seq:
+ * ifaddr.inspect => string
+ *
+ * Returns a string to show contents of _ifaddr_.
+ */
+
+static VALUE
+ifaddr_inspect(VALUE self)
+{
+ rb_ifaddr_t *rifaddr = get_ifaddr(self);
+ struct ifaddrs *ifa;
+ VALUE result;
+
+ ifa = rifaddr->ifaddr;
+
+ result = rb_str_new_cstr("#<");
+
+ rb_str_append(result, rb_class_name(CLASS_OF(self)));
+ rb_str_cat2(result, " ");
+ rb_str_cat2(result, ifa->ifa_name);
+
+ if (ifa->ifa_flags)
+ ifaddr_inspect_flags(ifa->ifa_flags, result);
+
+ if (ifa->ifa_addr) {
+ rb_str_cat2(result, " ");
+ rsock_inspect_sockaddr(ifa->ifa_addr,
+ rsock_sockaddr_len(ifa->ifa_addr),
+ result);
+ }
+ if (ifa->ifa_netmask) {
+ rb_str_cat2(result, " netmask=");
+ rsock_inspect_sockaddr(ifa->ifa_netmask,
+ rsock_sockaddr_len(ifa->ifa_netmask),
+ result);
+ }
+
+ if ((ifa->ifa_flags & IFF_BROADCAST) && ifa->ifa_broadaddr) {
+ rb_str_cat2(result, " broadcast=");
+ rsock_inspect_sockaddr(ifa->ifa_broadaddr,
+ rsock_sockaddr_len(ifa->ifa_broadaddr),
+ result);
+ }
+
+ if ((ifa->ifa_flags & IFF_POINTOPOINT) && ifa->ifa_dstaddr) {
+ rb_str_cat2(result, " dstaddr=");
+ rsock_inspect_sockaddr(ifa->ifa_dstaddr,
+ rsock_sockaddr_len(ifa->ifa_dstaddr),
+ result);
+ }
+
+ rb_str_cat2(result, ">");
+ return result;
+}
+#endif
+
+#ifdef HAVE_GETIFADDRS
+/*
+ * call-seq:
+ * Socket.getifaddrs => [ifaddr1, ...]
+ *
+ * Returns an array of interface addresses.
+ * An element of the array is an instance of Socket::Ifaddr.
+ *
+ * This method can be used to find multicast-enabled interfaces:
+ *
+ * pp Socket.getifaddrs.reject {|ifaddr|
+ * !ifaddr.addr.ip? || (ifaddr.flags & Socket::IFF_MULTICAST == 0)
+ * }.map {|ifaddr| [ifaddr.name, ifaddr.ifindex, ifaddr.addr] }
+ * #=> [["eth0", 2, #<Addrinfo: 221.186.184.67>],
+ * # ["eth0", 2, #<Addrinfo: fe80::216:3eff:fe95:88bb%eth0>]]
+ *
+ * Example result on GNU/Linux:
+ * pp Socket.getifaddrs
+ * #=> [#<Socket::Ifaddr lo UP,LOOPBACK,RUNNING,0x10000 PACKET[protocol=0 lo hatype=772 HOST hwaddr=00:00:00:00:00:00]>,
+ * # #<Socket::Ifaddr eth0 UP,BROADCAST,RUNNING,MULTICAST,0x10000 PACKET[protocol=0 eth0 hatype=1 HOST hwaddr=00:16:3e:95:88:bb] broadcast=PACKET[protocol=0 eth0 hatype=1 HOST hwaddr=ff:ff:ff:ff:ff:ff]>,
+ * # #<Socket::Ifaddr sit0 NOARP PACKET[protocol=0 sit0 hatype=776 HOST hwaddr=00:00:00:00]>,
+ * # #<Socket::Ifaddr lo UP,LOOPBACK,RUNNING,0x10000 127.0.0.1 netmask=255.0.0.0>,
+ * # #<Socket::Ifaddr eth0 UP,BROADCAST,RUNNING,MULTICAST,0x10000 221.186.184.67 netmask=255.255.255.240 broadcast=221.186.184.79>,
+ * # #<Socket::Ifaddr lo UP,LOOPBACK,RUNNING,0x10000 ::1 netmask=ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff>,
+ * # #<Socket::Ifaddr eth0 UP,BROADCAST,RUNNING,MULTICAST,0x10000 fe80::216:3eff:fe95:88bb%eth0 netmask=ffff:ffff:ffff:ffff::>]
+ *
+ * Example result on FreeBSD:
+ * pp Socket.getifaddrs
+ * #=> [#<Socket::Ifaddr usbus0 UP,0x10000 LINK[usbus0]>,
+ * # #<Socket::Ifaddr re0 UP,BROADCAST,RUNNING,MULTICAST,0x800 LINK[re0 3a:d0:40:9a:fe:e8]>,
+ * # #<Socket::Ifaddr re0 UP,BROADCAST,RUNNING,MULTICAST,0x800 10.250.10.18 netmask=255.255.255.? (7 bytes for 16 bytes sockaddr_in) broadcast=10.250.10.255>,
+ * # #<Socket::Ifaddr re0 UP,BROADCAST,RUNNING,MULTICAST,0x800 fe80:2::38d0:40ff:fe9a:fee8 netmask=ffff:ffff:ffff:ffff::>,
+ * # #<Socket::Ifaddr re0 UP,BROADCAST,RUNNING,MULTICAST,0x800 2001:2e8:408:10::12 netmask=UNSPEC>,
+ * # #<Socket::Ifaddr plip0 POINTOPOINT,MULTICAST,0x800 LINK[plip0]>,
+ * # #<Socket::Ifaddr lo0 UP,LOOPBACK,RUNNING,MULTICAST LINK[lo0]>,
+ * # #<Socket::Ifaddr lo0 UP,LOOPBACK,RUNNING,MULTICAST ::1 netmask=ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff>,
+ * # #<Socket::Ifaddr lo0 UP,LOOPBACK,RUNNING,MULTICAST fe80:4::1 netmask=ffff:ffff:ffff:ffff::>,
+ * # #<Socket::Ifaddr lo0 UP,LOOPBACK,RUNNING,MULTICAST 127.0.0.1 netmask=255.?.?.? (5 bytes for 16 bytes sockaddr_in)>]
+ *
+ */
+
+static VALUE
+socket_s_getifaddrs(VALUE self)
+{
+ return rsock_getifaddrs();
+}
+#else
+#define socket_s_getifaddrs rb_f_notimplement
+#endif
+
+void
+rsock_init_sockifaddr(void)
+{
+#ifdef HAVE_GETIFADDRS
+ /*
+ * Document-class: Socket::Ifaddr
+ *
+ * Socket::Ifaddr represents a result of getifaddrs() function.
+ */
+ rb_cSockIfaddr = rb_define_class_under(rb_cSocket, "Ifaddr", rb_cData);
+ rb_define_method(rb_cSockIfaddr, "inspect", ifaddr_inspect, 0);
+ rb_define_method(rb_cSockIfaddr, "name", ifaddr_name, 0);
+ rb_define_method(rb_cSockIfaddr, "ifindex", ifaddr_ifindex, 0);
+ rb_define_method(rb_cSockIfaddr, "flags", ifaddr_flags, 0);
+ rb_define_method(rb_cSockIfaddr, "addr", ifaddr_addr, 0);
+ rb_define_method(rb_cSockIfaddr, "netmask", ifaddr_netmask, 0);
+ rb_define_method(rb_cSockIfaddr, "broadaddr", ifaddr_broadaddr, 0);
+ rb_define_method(rb_cSockIfaddr, "dstaddr", ifaddr_dstaddr, 0);
+#endif
+
+ rb_define_singleton_method(rb_cSocket, "getifaddrs", socket_s_getifaddrs, 0);
+}
diff --git a/ext/socket/init.c b/ext/socket/init.c
index 9999c02969..f6cd2bce7b 100644
--- a/ext/socket/init.c
+++ b/ext/socket/init.c
@@ -47,7 +47,7 @@ rsock_init_sock(VALUE sock, int fd)
struct stat sbuf;
if (fstat(fd, &sbuf) < 0)
- rb_sys_fail(0);
+ rb_sys_fail("fstat(2)");
rb_update_max_fd(fd);
if (!S_ISSOCK(sbuf.st_mode))
rb_raise(rb_eArgError, "not a socket file descriptor");
@@ -91,15 +91,20 @@ struct recvfrom_arg {
int fd, flags;
VALUE str;
socklen_t alen;
- struct sockaddr_storage buf;
+ union_sockaddr buf;
};
static VALUE
recvfrom_blocking(void *data)
{
struct recvfrom_arg *arg = data;
- return (VALUE)recvfrom(arg->fd, RSTRING_PTR(arg->str), RSTRING_LEN(arg->str),
- arg->flags, (struct sockaddr*)&arg->buf, &arg->alen);
+ socklen_t len0 = arg->alen;
+ ssize_t ret;
+ ret = recvfrom(arg->fd, RSTRING_PTR(arg->str), RSTRING_LEN(arg->str),
+ arg->flags, &arg->buf.addr, &arg->alen);
+ if (ret != -1 && len0 < arg->alen)
+ arg->alen = len0;
+ return (VALUE)ret;
}
VALUE
@@ -127,10 +132,10 @@ rsock_s_recvfrom(VALUE sock, int argc, VALUE *argv, enum sock_recv_type from)
arg.str = str = rb_tainted_str_new(0, buflen);
klass = RBASIC(str)->klass;
- RBASIC(str)->klass = 0;
+ rb_obj_hide(str);
while (rb_io_check_closed(fptr),
- rb_thread_wait_fd(arg.fd),
+ rsock_maybe_wait_fd(arg.fd),
(slen = BLOCKING_REGION_FD(recvfrom_blocking, &arg)) < 0) {
if (!rb_io_wait_readable(fptr->fd)) {
rb_sys_fail("recvfrom(2)");
@@ -140,7 +145,7 @@ rsock_s_recvfrom(VALUE sock, int argc, VALUE *argv, enum sock_recv_type from)
}
}
- RBASIC(str)->klass = klass;
+ rb_obj_reveal(str, klass);
if (slen < RSTRING_LEN(str)) {
rb_str_set_len(str, slen);
}
@@ -155,16 +160,16 @@ rsock_s_recvfrom(VALUE sock, int argc, VALUE *argv, enum sock_recv_type from)
}
#endif
if (arg.alen && arg.alen != sizeof(arg.buf)) /* OSX doesn't return a from result for connection-oriented sockets */
- return rb_assoc_new(str, rsock_ipaddr((struct sockaddr*)&arg.buf, fptr->mode & FMODE_NOREVLOOKUP));
+ return rb_assoc_new(str, rsock_ipaddr(&arg.buf.addr, arg.alen, fptr->mode & FMODE_NOREVLOOKUP));
else
return rb_assoc_new(str, Qnil);
#ifdef HAVE_SYS_UN_H
case RECV_UNIX:
- return rb_assoc_new(str, rsock_unixaddr((struct sockaddr_un*)&arg.buf, arg.alen));
+ return rb_assoc_new(str, rsock_unixaddr(&arg.buf.un, arg.alen));
#endif
case RECV_SOCKET:
- return rb_assoc_new(str, rsock_io_socket_addrinfo(sock, (struct sockaddr*)&arg.buf, arg.alen));
+ return rb_assoc_new(str, rsock_io_socket_addrinfo(sock, &arg.buf.addr, arg.alen));
default:
rb_bug("rsock_s_recvfrom called with bad value");
}
@@ -175,13 +180,14 @@ rsock_s_recvfrom_nonblock(VALUE sock, int argc, VALUE *argv, enum sock_recv_type
{
rb_io_t *fptr;
VALUE str;
- struct sockaddr_storage buf;
+ 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;
rb_scan_args(argc, argv, "11", &len, &flg);
@@ -205,7 +211,10 @@ rsock_s_recvfrom_nonblock(VALUE sock, int argc, VALUE *argv, enum sock_recv_type
rb_io_check_closed(fptr);
rb_io_set_nonblock(fptr);
- slen = recvfrom(fd, RSTRING_PTR(str), buflen, flags, (struct sockaddr*)&buf, &alen);
+ len0 = alen;
+ slen = recvfrom(fd, RSTRING_PTR(str), buflen, flags, &buf.addr, &alen);
+ if (slen != -1 && len0 < alen)
+ alen = len0;
if (slen < 0) {
switch (errno) {
@@ -213,7 +222,7 @@ rsock_s_recvfrom_nonblock(VALUE sock, int argc, VALUE *argv, enum sock_recv_type
#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
case EWOULDBLOCK:
#endif
- rb_mod_sys_fail(rb_mWaitReadable, "recvfrom(2) would block");
+ rb_readwrite_sys_fail(RB_IO_WAIT_READABLE, "recvfrom(2) would block");
}
rb_sys_fail("recvfrom(2)");
}
@@ -227,11 +236,11 @@ rsock_s_recvfrom_nonblock(VALUE sock, int argc, VALUE *argv, enum sock_recv_type
case RECV_IP:
if (alen && alen != sizeof(buf)) /* connection-oriented socket may not return a from result */
- addr = rsock_ipaddr((struct sockaddr*)&buf, fptr->mode & FMODE_NOREVLOOKUP);
+ addr = rsock_ipaddr(&buf.addr, alen, fptr->mode & FMODE_NOREVLOOKUP);
break;
case RECV_SOCKET:
- addr = rsock_io_socket_addrinfo(sock, (struct sockaddr*)&buf, alen);
+ addr = rsock_io_socket_addrinfo(sock, &buf.addr, alen);
break;
default:
@@ -240,37 +249,78 @@ rsock_s_recvfrom_nonblock(VALUE sock, int argc, VALUE *argv, enum sock_recv_type
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 */
-#ifdef SOCK_CLOEXEC
- static int try_sock_cloexec = 1;
- if (try_sock_cloexec) {
+ if (cloexec_state > 0) { /* common path, if SOCK_CLOEXEC is defined */
ret = socket(domain, type|SOCK_CLOEXEC, proto);
- if (ret == -1 && errno == EINVAL) {
+ if (ret >= 0) {
+ if (ret <= 2)
+ goto fix_cloexec;
+ goto update_max_fd;
+ }
+ }
+ else if (cloexec_state < 0) { /* usually runs once only for detection */
+ 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) {
/* SOCK_CLOEXEC is available since Linux 2.6.27. Linux 2.6.18 fails with EINVAL */
ret = socket(domain, type, proto);
if (ret != -1) {
- try_sock_cloexec = 0;
+ cloexec_state = 0;
+ /* fall through to fix_cloexec */
}
}
}
- else {
+ else { /* cloexec_state == 0 */
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)
@@ -299,7 +349,7 @@ wait_connectable(int fd)
for (;;) {
/*
- * Stevens book says, succuessful finish turn on RB_WAITFD_OUT and
+ * Stevens book says, successful 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);
@@ -314,8 +364,12 @@ wait_connectable(int fd)
*/
if (ret < 0)
break;
- if (sockerr == 0)
- continue; /* workaround for winsock */
+ if (sockerr == 0) {
+ if (revents & RB_WAITFD_OUT)
+ break;
+ else
+ continue; /* workaround for winsock */
+ }
/* BSD and Linux use sockerr. */
errno = sockerr;
@@ -466,14 +520,14 @@ make_fd_nonblock(int fd)
#ifdef F_GETFL
flags = fcntl(fd, F_GETFL);
if (flags == -1) {
- rb_sys_fail(0);
+ rb_sys_fail("fnctl(2)");
}
#else
flags = 0;
#endif
flags |= O_NONBLOCK;
if (fcntl(fd, F_SETFL, flags) == -1) {
- rb_sys_fail(0);
+ rb_sys_fail("fnctl(2)");
}
}
@@ -532,7 +586,7 @@ rsock_s_accept_nonblock(VALUE klass, rb_io_t *fptr, struct sockaddr *sockaddr, s
#if defined EPROTO
case EPROTO:
#endif
- rb_mod_sys_fail(rb_mWaitReadable, "accept(2) would block");
+ rb_readwrite_sys_fail(RB_IO_WAIT_READABLE, "accept(2) would block");
}
rb_sys_fail("accept(2)");
}
@@ -566,7 +620,7 @@ rsock_s_accept(VALUE klass, int fd, struct sockaddr *sockaddr, socklen_t *len)
arg.sockaddr = sockaddr;
arg.len = len;
retry:
- rb_thread_wait_fd(fd);
+ rsock_maybe_wait_fd(fd);
fd2 = (int)BLOCKING_REGION_FD(accept_blocking, &arg);
if (fd2 < 0) {
switch (errno) {
@@ -581,7 +635,7 @@ rsock_s_accept(VALUE klass, int fd, struct sockaddr *sockaddr, socklen_t *len)
retry = 0;
goto retry;
}
- rb_sys_fail(0);
+ rb_sys_fail("accept(2)");
}
rb_update_max_fd(fd2);
if (!klass) return INT2NUM(fd2);
@@ -591,14 +645,14 @@ rsock_s_accept(VALUE klass, int fd, struct sockaddr *sockaddr, socklen_t *len)
int
rsock_getfamily(int sockfd)
{
- struct sockaddr_storage ss;
+ union_sockaddr ss;
socklen_t sslen = (socklen_t)sizeof(ss);
- ss.ss_family = AF_UNSPEC;
- if (getsockname(sockfd, (struct sockaddr*)&ss, &sslen) < 0)
+ ss.addr.sa_family = AF_UNSPEC;
+ if (getsockname(sockfd, &ss.addr, &sslen) < 0)
return AF_UNSPEC;
- return ss.ss_family;
+ return ss.addr.sa_family;
}
void
@@ -618,5 +672,6 @@ rsock_init_socket_init()
rsock_init_sockopt();
rsock_init_ancdata();
rsock_init_addrinfo();
+ rsock_init_sockifaddr();
rsock_init_socket_constants();
}
diff --git a/ext/socket/ipsocket.c b/ext/socket/ipsocket.c
index b1085cd70c..ef5ce763ec 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 addrinfo *res;
+ struct rb_addrinfo *res;
} remote, local;
int type;
int fd;
@@ -25,11 +25,11 @@ static VALUE
inetsock_cleanup(struct inetsock_arg *arg)
{
if (arg->remote.res) {
- freeaddrinfo(arg->remote.res);
+ rb_freeaddrinfo(arg->remote.res);
arg->remote.res = 0;
}
if (arg->local.res) {
- freeaddrinfo(arg->local.res);
+ rb_freeaddrinfo(arg->local.res);
arg->local.res = 0;
}
if (arg->fd >= 0) {
@@ -42,8 +42,8 @@ static VALUE
init_inetsock_internal(struct inetsock_arg *arg)
{
int type = arg->type;
- struct addrinfo *res;
- int fd, status = 0;
+ struct addrinfo *res, *lres;
+ int fd, status = 0, local = 0;
const char *syscall = 0;
arg->remote.res = rsock_addrinfo(arg->remote.host, arg->remote.serv, SOCK_STREAM,
@@ -57,11 +57,25 @@ init_inetsock_internal(struct inetsock_arg *arg)
}
arg->fd = fd = -1;
- for (res = arg->remote.res; res; res = res->ai_next) {
+ for (res = arg->remote.res->ai; 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) {
+ if (lres->ai_family == res->ai_family)
+ break;
+ }
+ if (!lres) {
+ if (res->ai_next || status < 0)
+ continue;
+ /* Use a different family local address if no choice, this
+ * will cause EAFNOSUPPORT. */
+ lres = arg->local.res->ai;
+ }
+ }
status = rsock_socket(res->ai_family,res->ai_socktype,res->ai_protocol);
syscall = "socket(2)";
fd = status;
@@ -79,8 +93,9 @@ init_inetsock_internal(struct inetsock_arg *arg)
syscall = "bind(2)";
}
else {
- if (arg->local.res) {
- status = bind(fd, arg->local.res->ai_addr, arg->local.res->ai_addrlen);
+ if (lres) {
+ status = bind(fd, lres->ai_addr, lres->ai_addrlen);
+ local = status;
syscall = "bind(2)";
}
@@ -99,7 +114,17 @@ init_inetsock_internal(struct inetsock_arg *arg)
break;
}
if (status < 0) {
- rb_sys_fail(syscall);
+ VALUE host, port;
+
+ if (local < 0) {
+ host = arg->local.host;
+ port = arg->local.serv;
+ } else {
+ host = arg->remote.host;
+ port = arg->remote.serv;
+ }
+
+ rsock_sys_fail_host_port(syscall, host, port);
}
arg->fd = -1;
@@ -184,7 +209,7 @@ static VALUE
ip_addr(int argc, VALUE *argv, VALUE sock)
{
rb_io_t *fptr;
- struct sockaddr_storage addr;
+ union_sockaddr addr;
socklen_t len = (socklen_t)sizeof addr;
int norevlookup;
@@ -192,9 +217,9 @@ ip_addr(int argc, VALUE *argv, VALUE sock)
if (argc < 1 || !rsock_revlookup_flag(argv[0], &norevlookup))
norevlookup = fptr->mode & FMODE_NOREVLOOKUP;
- if (getsockname(fptr->fd, (struct sockaddr*)&addr, &len) < 0)
+ if (getsockname(fptr->fd, &addr.addr, &len) < 0)
rb_sys_fail("getsockname(2)");
- return rsock_ipaddr((struct sockaddr*)&addr, norevlookup);
+ return rsock_ipaddr(&addr.addr, len, norevlookup);
}
/*
@@ -225,7 +250,7 @@ static VALUE
ip_peeraddr(int argc, VALUE *argv, VALUE sock)
{
rb_io_t *fptr;
- struct sockaddr_storage addr;
+ union_sockaddr addr;
socklen_t len = (socklen_t)sizeof addr;
int norevlookup;
@@ -233,9 +258,9 @@ ip_peeraddr(int argc, VALUE *argv, VALUE sock)
if (argc < 1 || !rsock_revlookup_flag(argv[0], &norevlookup))
norevlookup = fptr->mode & FMODE_NOREVLOOKUP;
- if (getpeername(fptr->fd, (struct sockaddr*)&addr, &len) < 0)
+ if (getpeername(fptr->fd, &addr.addr, &len) < 0)
rb_sys_fail("getpeername(2)");
- return rsock_ipaddr((struct sockaddr*)&addr, norevlookup);
+ return rsock_ipaddr(&addr.addr, len, norevlookup);
}
/*
@@ -278,14 +303,15 @@ ip_recvfrom(int argc, VALUE *argv, VALUE sock)
static VALUE
ip_s_getaddress(VALUE obj, VALUE host)
{
- struct sockaddr_storage addr;
- struct addrinfo *res = rsock_addrinfo(host, Qnil, SOCK_STREAM, 0);
+ union_sockaddr addr;
+ struct rb_addrinfo *res = rsock_addrinfo(host, Qnil, SOCK_STREAM, 0);
+ socklen_t len = res->ai->ai_addrlen;
/* just take the first one */
- memcpy(&addr, res->ai_addr, res->ai_addrlen);
- freeaddrinfo(res);
+ memcpy(&addr, res->ai->ai_addr, len);
+ rb_freeaddrinfo(res);
- return rsock_make_ipaddr((struct sockaddr*)&addr);
+ return rsock_make_ipaddr(&addr.addr, len);
}
void
diff --git a/ext/socket/lib/socket.rb b/ext/socket/lib/socket.rb
index ec3263c3fd..2cd7aeadf9 100644
--- a/ext/socket/lib/socket.rb
+++ b/ext/socket/lib/socket.rb
@@ -64,13 +64,18 @@ class Addrinfo
else
sock.connect(self)
end
- if block_given?
+ rescue Exception
+ sock.close
+ raise
+ end
+ if block_given?
+ begin
yield sock
- else
- sock
+ ensure
+ sock.close if !sock.closed?
end
- ensure
- sock.close if !sock.closed? && (block_given? || $!)
+ else
+ sock
end
end
private :connect_internal
@@ -177,13 +182,18 @@ class Addrinfo
sock.ipv6only! if self.ipv6?
sock.setsockopt(:SOCKET, :REUSEADDR, 1)
sock.bind(self)
- if block_given?
+ rescue Exception
+ sock.close
+ raise
+ end
+ if block_given?
+ begin
yield sock
- else
- sock
+ ensure
+ sock.close if !sock.closed?
end
- ensure
- sock.close if !sock.closed? && (block_given? || $!)
+ else
+ sock
end
end
@@ -195,13 +205,18 @@ class Addrinfo
sock.setsockopt(:SOCKET, :REUSEADDR, 1)
sock.bind(self)
sock.listen(backlog)
- if block_given?
+ rescue Exception
+ sock.close
+ raise
+ end
+ if block_given?
+ begin
yield sock
- else
- sock
+ ensure
+ sock.close if !sock.closed?
end
- ensure
- sock.close if !sock.closed? && (block_given? || $!)
+ else
+ sock
end
end
@@ -288,11 +303,6 @@ class Socket < BasicSocket
# The value of the block is returned.
# The socket is closed when this method returns.
#
- # The optional last argument _opts_ is options represented by a hash.
- # _opts_ may have following options:
- #
- # [:timeout] specify the timeout in seconds.
- #
# If no block is given, the socket is returned.
#
# Socket.tcp("www.ruby-lang.org", 80) {|sock|
@@ -353,8 +363,9 @@ class Socket < BasicSocket
# :stopdoc:
def self.ip_sockets_port0(ai_list, reuseaddr)
+ sockets = []
begin
- sockets = []
+ sockets.clear
port = nil
ai_list.each {|ai|
begin
@@ -375,14 +386,13 @@ 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
@@ -391,12 +401,15 @@ 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)
- sockets.each {|s|
- s.listen(Socket::SOMAXCONN)
- }
+ begin
+ sockets.each {|s|
+ s.listen(Socket::SOMAXCONN)
+ }
+ rescue Exception
+ sockets.each {|s| s.close }
+ raise
+ end
sockets
- ensure
- sockets.each {|s| s.close if !s.closed? } if $! && sockets
end
class << self
private :tcp_server_sockets_port0
@@ -440,9 +453,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
@@ -455,8 +468,9 @@ class Socket < BasicSocket
if sockets.empty?
raise last_error
end
- ensure
- sockets.each {|s| s.close if !s.closed? } if $!
+ rescue Exception
+ sockets.each {|s| s.close }
+ raise
end
end
if block_given?
diff --git a/ext/socket/mkconstants.rb b/ext/socket/mkconstants.rb
index 3b63c39eff..59fcb17682 100644
--- a/ext/socket/mkconstants.rb
+++ b/ext/socket/mkconstants.rb
@@ -56,17 +56,12 @@ DEFS = h.to_a
def each_const
DEFS.each {|name, default_value|
- if name =~ /\AINADDR_/
- make_value = "UINT2NUM"
- else
- make_value = "INT2NUM"
- end
guard = nil
if /\A(AF_INET6|PF_INET6|IPV6_.*)\z/ =~ name
- # IPv6 is not supported although AF_INET6 is defined on bcc32/mingw
+ # IPv6 is not supported although AF_INET6 is defined on mingw
guard = "defined(INET6)"
end
- yield guard, make_value, name, default_value
+ yield guard, name, default_value
}
end
@@ -78,7 +73,7 @@ def each_name(pat)
end
ERB.new(<<'EOS', nil, '%').def_method(Object, "gen_const_decls")
-% each_const {|guard, make_value, name, default_value|
+% each_const {|guard, name, default_value|
#if !defined(<%=name%>)
# if defined(HAVE_CONST_<%=name.upcase%>)
# define <%=name%> <%=name%>
@@ -91,23 +86,23 @@ ERB.new(<<'EOS', nil, '%').def_method(Object, "gen_const_decls")
% }
EOS
-ERB.new(<<'EOS', nil, '%').def_method(Object, "gen_const_defs_in_guard(make_value, name, default_value)")
+ERB.new(<<'EOS', nil, '%').def_method(Object, "gen_const_defs_in_guard(name, default_value)")
#if defined(<%=name%>)
/* <%= COMMENTS[name] %> */
- rb_define_const(rb_cSocket, <%=c_str name%>, <%=make_value%>(<%=name%>));
+ rb_define_const(rb_cSocket, <%=c_str name%>, INTEGER2NUM(<%=name%>));
/* <%= COMMENTS[name] %> */
- rb_define_const(rb_mSockConst, <%=c_str name%>, <%=make_value%>(<%=name%>));
+ rb_define_const(rb_mSockConst, <%=c_str name%>, INTEGER2NUM(<%=name%>));
#endif
EOS
ERB.new(<<'EOS', nil, '%').def_method(Object, "gen_const_defs")
-% each_const {|guard, make_value, name, default_value|
+% each_const {|guard, name, default_value|
% if guard
#if <%=guard%>
-<%= gen_const_defs_in_guard(make_value, name, default_value).chomp %>
+<%= gen_const_defs_in_guard(name, default_value).chomp %>
#endif
% else
-<%= gen_const_defs_in_guard(make_value, name, default_value).chomp %>
+<%= gen_const_defs_in_guard(name, default_value).chomp %>
% end
% }
EOS
@@ -284,6 +279,18 @@ result = ERB.new(<<'EOS', nil, '%').result(binding)
<%= INTERN_DEFS.map {|vardef, gen_hash, decl, func| vardef }.join("\n") %>
+#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(void)
{
@@ -446,6 +453,7 @@ MSG_RST
MSG_ERRQUEUE nil Fetch message from error queue
MSG_NOSIGNAL nil Do not generate SIGPIPE
MSG_MORE nil Sender will send more
+MSG_FASTOPEN nil Reduce step of the handshake process
SOL_SOCKET nil Socket-level options
SOL_IP nil IP socket options
@@ -532,6 +540,7 @@ 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
@@ -560,6 +569,8 @@ 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
@@ -586,6 +597,7 @@ 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)
@@ -593,6 +605,21 @@ 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
@@ -602,21 +629,32 @@ 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
-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_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_NOOPT nil Don't use TCP options
TCP_NOPUSH nil Don't push the last block of write
-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
-
-UDP_CORK nil Don't send partial frames
+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)
EAI_ADDRFAMILY nil Address family for hostname not supported
EAI_AGAIN nil Temporary failure in name resolution
@@ -695,11 +733,72 @@ 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
LOCAL_CONNWAIT nil Connect blocks until accepted
+
+IFF_802_1Q_VLAN nil 802.1Q VLAN device
+IFF_ALLMULTI nil receive all multicast packets
+IFF_ALTPHYS nil use alternate physical connection
+IFF_AUTOMEDIA nil auto media select active
+IFF_BONDING nil bonding master or slave
+IFF_BRIDGE_PORT nil device used as bridge port
+IFF_BROADCAST nil broadcast address valid
+IFF_CANTCONFIG nil unconfigurable using ioctl(2)
+IFF_DEBUG nil turn on debugging
+IFF_DISABLE_NETPOLL nil disable netpoll at run-time
+IFF_DONT_BRIDGE nil disallow bridging this ether dev
+IFF_DORMANT nil driver signals dormant
+IFF_DRV_OACTIVE nil tx hardware queue is full
+IFF_DRV_RUNNING nil resources allocated
+IFF_DYING nil interface is winding down
+IFF_DYNAMIC nil dialup device with changing addresses
+IFF_EBRIDGE nil ethernet bridging device
+IFF_ECHO nil echo sent packets
+IFF_ISATAP nil ISATAP interface (RFC4214)
+IFF_LINK0 nil per link layer defined bit 0
+IFF_LINK1 nil per link layer defined bit 1
+IFF_LINK2 nil per link layer defined bit 2
+IFF_LIVE_ADDR_CHANGE nil hardware address change when it's running
+IFF_LOOPBACK nil loopback net
+IFF_LOWER_UP nil driver signals L1 up
+IFF_MACVLAN_PORT nil device used as macvlan port
+IFF_MASTER nil master of a load balancer
+IFF_MASTER_8023AD nil bonding master, 802.3ad.
+IFF_MASTER_ALB nil bonding master, balance-alb.
+IFF_MASTER_ARPMON nil bonding master, ARP mon in use
+IFF_MONITOR nil user-requested monitor mode
+IFF_MULTICAST nil supports multicast
+IFF_NOARP nil no address resolution protocol
+IFF_NOTRAILERS nil avoid use of trailers
+IFF_OACTIVE nil transmission in progress
+IFF_OVS_DATAPATH nil device used as Open vSwitch datapath port
+IFF_POINTOPOINT nil point-to-point link
+IFF_PORTSEL nil can set media type
+IFF_PPROMISC nil user-requested promisc mode
+IFF_PROMISC nil receive all packets
+IFF_RENAMING nil interface is being renamed
+IFF_ROUTE nil routing entry installed
+IFF_RUNNING nil resources allocated
+IFF_SIMPLEX nil can't hear own transmissions
+IFF_SLAVE nil slave of a load balancer
+IFF_SLAVE_INACTIVE nil bonding slave not the curr. active
+IFF_SLAVE_NEEDARP nil need ARPs for validation
+IFF_SMART nil interface manages own routes
+IFF_STATICARP nil static ARP
+IFF_SUPP_NOFCS nil sending custom FCS
+IFF_TEAM_PORT nil used as team port
+IFF_TX_SKB_SHARING nil sharing skbs on transmit
+IFF_UNICAST_FLT nil unicast filtering
+IFF_UP nil interface is up
+IFF_WAN_HDLC nil WAN HDLC device
+IFF_XMIT_DST_RELEASE nil dev_hard_start_xmit() is allowed to release skb->dst
+IFF_VOLATILE nil volatile flags
+IFF_CANTCHANGE nil flags not changeable
diff --git a/ext/socket/option.c b/ext/socket/option.c
index e3e59cf0c5..a4a2a37c0f 100644
--- a/ext/socket/option.c
+++ b/ext/socket/option.c
@@ -2,6 +2,45 @@
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
+
+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))
{
@@ -21,7 +60,7 @@ optname_to_sym(int level, int optname)
return constant_to_sym(optname, rsock_intern_so_optname);
case IPPROTO_IP:
return constant_to_sym(optname, rsock_intern_ip_optname);
-#ifdef INET6
+#ifdef IPPROTO_IPV6
case IPPROTO_IPV6:
return constant_to_sym(optname, rsock_intern_ipv6_optname);
#endif
@@ -127,6 +166,7 @@ sockopt_optname_m(VALUE self)
/*
* call-seq:
* sockopt.data => string
+ * sockopt.to_s => string
*
* returns the socket option data as a string.
*
@@ -143,6 +183,45 @@ sockopt_data(VALUE self)
/*
* call-seq:
+ * Socket::Option.byte(family, level, optname, integer) => sockopt
+ *
+ * Creates a new Socket::Option object which contains a byte as data.
+ *
+ * p Socket::Option.byte(:INET, :SOCKET, :KEEPALIVE, 1)
+ * #=> #<Socket::Option: INET SOCKET KEEPALIVE 1>
+ */
+static VALUE
+sockopt_s_byte(VALUE klass, VALUE vfamily, VALUE vlevel, VALUE voptname, VALUE vint)
+{
+ 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));
+}
+
+/*
+ * call-seq:
+ * sockopt.byte => integer
+ *
+ * Returns the data in _sockopt_ as an byte.
+ *
+ * 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);
+ 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));
+}
+
+/*
+ * call-seq:
* Socket::Option.int(family, level, optname, integer) => sockopt
*
* Creates a new Socket::Option object which contains an int as data.
@@ -158,8 +237,7 @@ 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);
- int i = NUM2INT(vint);
- return rsock_sockopt_new(family, level, optname, rb_str_new((char*)&i, sizeof(i)));
+ return rsock_sockopt_new(family, level, optname, sockopt_pack_int(vint));
}
/*
@@ -207,7 +285,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, rb_str_new((char*)&i, sizeof(i)));
+ return rsock_sockopt_new(family, level, optname, pack_var(i));
}
/*
@@ -257,7 +335,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, rb_str_new((char*)&l, sizeof(l)));
+ return rsock_sockopt_new(AF_UNSPEC, SOL_SOCKET, SO_LINGER, pack_var(l));
}
/*
@@ -293,6 +371,112 @@ sockopt_linger(VALUE self)
return rb_assoc_new(vonoff, vsecs);
}
+/*
+ * call-seq:
+ * Socket::Option.ipv4_multicast_loop(integer) => sockopt
+ *
+ * Creates a new Socket::Option object for IP_MULTICAST_LOOP.
+ *
+ * The size is dependent on the platform.
+ *
+ * sockopt = Socket::Option.int(:INET, :IPPROTO_IP, :IP_MULTICAST_LOOP, 1)
+ * p sockopt.int => 1
+ *
+ * p Socket::Option.ipv4_multicast_loop(10)
+ * #=> #<Socket::Option: INET IP MULTICAST_LOOP 10>
+ *
+ */
+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);
+#else
+# error IPPROTO_IP or IP_MULTICAST_LOOP is not implemented
+#endif
+}
+
+/*
+ * call-seq:
+ * sockopt.ipv4_multicast_loop => integer
+ *
+ * Returns the ipv4_multicast_loop data in _sockopt_ as a integer.
+ *
+ * sockopt = Socket::Option.ipv4_multicast_loop(10)
+ * p sockopt.ipv4_multicast_loop => 10
+ */
+static VALUE
+sockopt_ipv4_multicast_loop(VALUE self)
+{
+ int family = NUM2INT(sockopt_family_m(self));
+ int level = sockopt_level(self);
+ int optname = sockopt_optname(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);
+ }
+#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)
+
+/*
+ * call-seq:
+ * Socket::Option.ipv4_multicast_ttl(integer) => sockopt
+ *
+ * Creates a new Socket::Option object for IP_MULTICAST_TTL.
+ *
+ * The size is dependent on the platform.
+ *
+ * p Socket::Option.ipv4_multicast_ttl(10)
+ * #=> #<Socket::Option: INET IP MULTICAST_TTL 10>
+ *
+ */
+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);
+#else
+# error IPPROTO_IP or IP_MULTICAST_TTL is not implemented
+#endif
+}
+
+/*
+ * call-seq:
+ * sockopt.ipv4_multicast_ttl => integer
+ *
+ * Returns the ipv4_multicast_ttl data in _sockopt_ as a integer.
+ *
+ * sockopt = Socket::Option.ipv4_multicast_ttl(10)
+ * p sockopt.ipv4_multicast_ttl => 10
+ */
+static VALUE
+sockopt_ipv4_multicast_ttl(VALUE self)
+{
+ int family = NUM2INT(sockopt_family_m(self));
+ int level = sockopt_level(self);
+ int optname = sockopt_optname(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);
+ }
+#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)
+
static int
inspect_int(int level, int optname, VALUE data, VALUE ret)
{
@@ -307,6 +491,20 @@ inspect_int(int level, int optname, VALUE data, VALUE ret)
}
}
+#ifdef USE_INSPECT_BYTE
+static int
+inspect_byte(int level, int optname, VALUE data, VALUE ret)
+{
+ if (RSTRING_LEN(data) == sizeof(unsigned char)) {
+ rb_str_catf(ret, " %d", (unsigned char)*RSTRING_PTR(data));
+ return 1;
+ }
+ else {
+ return 0;
+ }
+}
+#endif
+
static int
inspect_errno(int level, int optname, VALUE data, VALUE ret)
{
@@ -403,6 +601,15 @@ 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
@@ -601,6 +808,328 @@ 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, u_int8_t options)
+{
+ int sep = '=';
+
+ rb_str_cat2(ret, " options");
+#define INSPECT_TCPI_OPTION(optval, name) \
+ if (options & (optval)) { \
+ options &= ~(u_int8_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, u_int32_t t)
+{
+ rb_str_catf(ret, "%s%u.%06us", prefix, t / 1000000, t % 1000000);
+}
+
+#ifdef __linux__
+static void
+inspect_tcpi_msec(VALUE ret, const char *prefix, u_int32_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
@@ -804,6 +1333,12 @@ sockopt_inspect(VALUE self)
# if defined(IP_DROP_MEMBERSHIP) /* 4.4BSD, GNU/Linux */
case IP_DROP_MEMBERSHIP: inspected = inspect_ipv4_add_drop_membership(level, optname, data, ret); break;
# endif
+# if defined(IP_MULTICAST_LOOP) /* 4.4BSD, GNU/Linux */
+ case IP_MULTICAST_LOOP: inspected = inspect_ipv4_multicast_loop(level, optname, data, ret); break;
+# endif
+# if defined(IP_MULTICAST_TTL) /* 4.4BSD, GNU/Linux */
+ case IP_MULTICAST_TTL: inspected = inspect_ipv4_multicast_ttl(level, optname, data, ret); break;
+# endif
}
break;
# endif
@@ -842,6 +1377,9 @@ 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
@@ -911,12 +1449,21 @@ rsock_init_sockopt(void)
rb_define_singleton_method(rb_cSockOpt, "int", sockopt_s_int, 4);
rb_define_method(rb_cSockOpt, "int", sockopt_int, 0);
+ rb_define_singleton_method(rb_cSockOpt, "byte", sockopt_s_byte, 4);
+ rb_define_method(rb_cSockOpt, "byte", sockopt_byte, 0);
+
rb_define_singleton_method(rb_cSockOpt, "bool", sockopt_s_bool, 4);
rb_define_method(rb_cSockOpt, "bool", sockopt_bool, 0);
rb_define_singleton_method(rb_cSockOpt, "linger", sockopt_s_linger, 2);
rb_define_method(rb_cSockOpt, "linger", sockopt_linger, 0);
+ rb_define_singleton_method(rb_cSockOpt, "ipv4_multicast_ttl", sockopt_s_ipv4_multicast_ttl, 1);
+ rb_define_method(rb_cSockOpt, "ipv4_multicast_ttl", sockopt_ipv4_multicast_ttl, 0);
+
+ rb_define_singleton_method(rb_cSockOpt, "ipv4_multicast_loop", sockopt_s_ipv4_multicast_loop, 1);
+ rb_define_method(rb_cSockOpt, "ipv4_multicast_loop", sockopt_ipv4_multicast_loop, 0);
+
rb_define_method(rb_cSockOpt, "unpack", sockopt_unpack, 1);
rb_define_method(rb_cSockOpt, "to_s", sockopt_data, 0); /* compatibility for ruby before 1.9.2 */
diff --git a/ext/socket/raddrinfo.c b/ext/socket/raddrinfo.c
index a730a1b4c4..ceed9c3ac1 100644
--- a/ext/socket/raddrinfo.c
+++ b/ext/socket/raddrinfo.c
@@ -1,6 +1,6 @@
/************************************************
- ainfo.c -
+ raddrinfo.c -
created at: Thu Mar 31 12:21:29 JST 1994
@@ -157,30 +157,154 @@ struct getaddrinfo_arg
static void *
nogvl_getaddrinfo(void *arg)
{
+ int ret;
struct getaddrinfo_arg *ptr = arg;
- return (void *)(VALUE)getaddrinfo(ptr->node, ptr->service,
- ptr->hints, ptr->res);
+ ret = getaddrinfo(ptr->node, ptr->service, ptr->hints, ptr->res);
+#ifdef __linux__
+ /* On Linux (mainly Ubuntu 13.04) /etc/nsswitch.conf has mdns4 and
+ * it cause getaddrinfo to return EAI_SYSTEM/ENOENT. [ruby-list:49420]
+ */
+ if (ret == EAI_SYSTEM && errno == ENOENT)
+ ret = EAI_NONAME;
+#endif
+ return (void *)(VALUE)ret;
}
#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
+
+ if (node && (!service || strspn(service, "0123456789") == strlen(service))) {
+ static const struct {
+ int socktype;
+ int protocol;
+ } list[] = {
+ { SOCK_STREAM, IPPROTO_TCP },
+ { SOCK_DGRAM, IPPROTO_UDP },
+ { SOCK_RAW, 0 }
+ };
+ struct addrinfo *ai = NULL;
+ int port = service ? (unsigned short)atoi(service): 0;
+ 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 addrinfo **res)
+ struct rb_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
- return getaddrinfo(node, service, hints, res);
+ ret = getaddrinfo(node, service, hints, &ai);
#else
- 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;
+ 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;
+ }
+ 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);
}
#ifndef GETADDRINFO_EMU
@@ -229,35 +353,33 @@ rb_getnameinfo(const struct sockaddr *sa, socklen_t salen,
}
static void
-make_ipaddr0(struct sockaddr *addr, char *buf, size_t len)
+make_ipaddr0(struct sockaddr *addr, socklen_t addrlen, char *buf, size_t buflen)
{
int error;
- error = rb_getnameinfo(addr, SA_LEN(addr), buf, len, NULL, 0, NI_NUMERICHOST);
+ error = rb_getnameinfo(addr, addrlen, buf, buflen, NULL, 0, NI_NUMERICHOST);
if (error) {
rsock_raise_socket_error("getnameinfo", error);
}
}
VALUE
-rsock_make_ipaddr(struct sockaddr *addr)
+rsock_make_ipaddr(struct sockaddr *addr, socklen_t addrlen)
{
char hbuf[1024];
- make_ipaddr0(addr, hbuf, sizeof(hbuf));
+ make_ipaddr0(addr, addrlen, hbuf, sizeof(hbuf));
return rb_str_new2(hbuf);
}
static void
-make_inetaddr(unsigned int host, char *buf, size_t len)
+make_inetaddr(unsigned int host, char *buf, size_t buflen)
{
struct sockaddr_in sin;
- MEMZERO(&sin, struct sockaddr_in, 1);
- sin.sin_family = AF_INET;
- SET_SIN_LEN(&sin, sizeof(sin));
+ INIT_SOCKADDR_IN(&sin, sizeof(sin));
sin.sin_addr.s_addr = host;
- make_ipaddr0((struct sockaddr*)&sin, buf, len);
+ make_ipaddr0((struct sockaddr*)&sin, sizeof(sin), buf, buflen);
}
static int
@@ -276,7 +398,7 @@ str_is_number(const char *p)
}
static char*
-host_str(VALUE host, char *hbuf, size_t len, int *flags_ptr)
+host_str(VALUE host, char *hbuf, size_t hbuflen, int *flags_ptr)
{
if (NIL_P(host)) {
return NULL;
@@ -284,7 +406,7 @@ host_str(VALUE host, char *hbuf, size_t len, int *flags_ptr)
else if (rb_obj_is_kind_of(host, rb_cInteger)) {
unsigned int i = NUM2UINT(host);
- make_inetaddr(htonl(i), hbuf, len);
+ make_inetaddr(htonl(i), hbuf, hbuflen);
if (flags_ptr) *flags_ptr |= AI_NUMERICHOST;
return hbuf;
}
@@ -294,14 +416,14 @@ host_str(VALUE host, char *hbuf, size_t len, int *flags_ptr)
SafeStringValue(host);
name = RSTRING_PTR(host);
if (!name || *name == 0 || (name[0] == '<' && strcmp(name, "<any>") == 0)) {
- make_inetaddr(INADDR_ANY, hbuf, len);
+ make_inetaddr(INADDR_ANY, hbuf, hbuflen);
if (flags_ptr) *flags_ptr |= AI_NUMERICHOST;
}
else if (name[0] == '<' && strcmp(name, "<broadcast>") == 0) {
- make_inetaddr(INADDR_BROADCAST, hbuf, len);
+ make_inetaddr(INADDR_BROADCAST, hbuf, hbuflen);
if (flags_ptr) *flags_ptr |= AI_NUMERICHOST;
}
- else if (strlen(name) >= len) {
+ else if (strlen(name) >= hbuflen) {
rb_raise(rb_eArgError, "hostname too long (%"PRIuSIZE")",
strlen(name));
}
@@ -313,13 +435,13 @@ host_str(VALUE host, char *hbuf, size_t len, int *flags_ptr)
}
static char*
-port_str(VALUE port, char *pbuf, size_t len, int *flags_ptr)
+port_str(VALUE port, char *pbuf, size_t pbuflen, int *flags_ptr)
{
if (NIL_P(port)) {
return 0;
}
else if (FIXNUM_P(port)) {
- snprintf(pbuf, len, "%ld", FIX2LONG(port));
+ snprintf(pbuf, pbuflen, "%ld", FIX2LONG(port));
#ifdef AI_NUMERICSERV
if (flags_ptr) *flags_ptr |= AI_NUMERICSERV;
#endif
@@ -330,7 +452,7 @@ port_str(VALUE port, char *pbuf, size_t len, int *flags_ptr)
SafeStringValue(port);
serv = RSTRING_PTR(port);
- if (strlen(serv) >= len) {
+ if (strlen(serv) >= pbuflen) {
rb_raise(rb_eArgError, "service name too long (%"PRIuSIZE")",
strlen(serv));
}
@@ -339,10 +461,10 @@ port_str(VALUE port, char *pbuf, size_t len, int *flags_ptr)
}
}
-struct addrinfo*
+struct rb_addrinfo*
rsock_getaddrinfo(VALUE host, VALUE port, struct addrinfo *hints, int socktype_hack)
{
- struct addrinfo* res = NULL;
+ struct rb_addrinfo* res = NULL;
char *hostp, *portp;
int error;
char hbuf[NI_MAXHOST], pbuf[NI_MAXSERV];
@@ -367,7 +489,7 @@ rsock_getaddrinfo(VALUE host, VALUE port, struct addrinfo *hints, int socktype_h
return res;
}
-struct addrinfo*
+struct rb_addrinfo*
rsock_addrinfo(VALUE host, VALUE port, int socktype, int flags)
{
struct addrinfo hints;
@@ -380,7 +502,7 @@ rsock_addrinfo(VALUE host, VALUE port, int socktype, int flags)
}
VALUE
-rsock_ipaddr(struct sockaddr *sockaddr, int norevlookup)
+rsock_ipaddr(struct sockaddr *sockaddr, socklen_t sockaddrlen, int norevlookup)
{
VALUE family, port, addr1, addr2;
VALUE ary;
@@ -399,13 +521,13 @@ rsock_ipaddr(struct sockaddr *sockaddr, int norevlookup)
addr1 = Qnil;
if (!norevlookup) {
- error = rb_getnameinfo(sockaddr, SA_LEN(sockaddr), hbuf, sizeof(hbuf),
+ error = rb_getnameinfo(sockaddr, sockaddrlen, hbuf, sizeof(hbuf),
NULL, 0, 0);
if (! error) {
addr1 = rb_str_new2(hbuf);
}
}
- error = rb_getnameinfo(sockaddr, SA_LEN(sockaddr), hbuf, sizeof(hbuf),
+ error = rb_getnameinfo(sockaddr, sockaddrlen, hbuf, sizeof(hbuf),
pbuf, sizeof(pbuf), NI_NUMERICHOST | NI_NUMERICSERV);
if (error) {
rsock_raise_socket_error("getnameinfo", error);
@@ -452,8 +574,10 @@ rsock_unix_sockaddr_len(VALUE path)
}
else if (RSTRING_PTR(path)[0] == '\0') {
/* abstract namespace; see unix(7) for details. */
+ if (SOCKLEN_MAX - offsetof(struct sockaddr_un, sun_path) < (size_t)RSTRING_LEN(path))
+ rb_raise(rb_eArgError, "Linux abstract socket too long");
return (socklen_t) offsetof(struct sockaddr_un, sun_path) +
- RSTRING_LEN(path);
+ RSTRING_SOCKLEN(path);
}
else {
#endif
@@ -466,16 +590,16 @@ rsock_unix_sockaddr_len(VALUE path)
struct hostent_arg {
VALUE host;
- struct addrinfo* addr;
- VALUE (*ipaddr)(struct sockaddr*, size_t);
+ struct rb_addrinfo* addr;
+ VALUE (*ipaddr)(struct sockaddr*, socklen_t);
};
static VALUE
make_hostent_internal(struct hostent_arg *arg)
{
VALUE host = arg->host;
- struct addrinfo* addr = arg->addr;
- VALUE (*ipaddr)(struct sockaddr*, size_t) = arg->ipaddr;
+ struct addrinfo* addr = arg->addr->ai;
+ VALUE (*ipaddr)(struct sockaddr*, socklen_t) = arg->ipaddr;
struct addrinfo *ai;
struct hostent *h;
@@ -514,14 +638,15 @@ make_hostent_internal(struct hostent_arg *arg)
}
VALUE
-rsock_freeaddrinfo(struct addrinfo *addr)
+rsock_freeaddrinfo(VALUE arg)
{
- freeaddrinfo(addr);
+ struct rb_addrinfo *addr = (struct rb_addrinfo *)arg;
+ rb_freeaddrinfo(addr);
return Qnil;
}
VALUE
-rsock_make_hostent(VALUE host, struct addrinfo *addr, VALUE (*ipaddr)(struct sockaddr *, size_t))
+rsock_make_hostent(VALUE host, struct rb_addrinfo *addr, VALUE (*ipaddr)(struct sockaddr *, socklen_t))
{
struct hostent_arg arg;
@@ -539,7 +664,7 @@ typedef struct {
int socktype;
int protocol;
socklen_t sockaddr_len;
- struct sockaddr_storage addr;
+ union_sockaddr addr;
} rb_addrinfo_t;
static void
@@ -593,8 +718,7 @@ get_addrinfo(VALUE self)
static rb_addrinfo_t *
alloc_addrinfo()
{
- rb_addrinfo_t *rai = ALLOC(rb_addrinfo_t);
- memset(rai, 0, sizeof(rb_addrinfo_t));
+ rb_addrinfo_t *rai = ZALLOC(rb_addrinfo_t);
rai->inspectname = Qnil;
rai->canonname = Qnil;
return rai;
@@ -631,12 +755,13 @@ rsock_addrinfo_new(struct sockaddr *addr, socklen_t len,
return a;
}
-static struct addrinfo *
+static struct rb_addrinfo *
call_getaddrinfo(VALUE node, VALUE service,
VALUE family, VALUE socktype, VALUE protocol, VALUE flags,
int socktype_hack)
{
- struct addrinfo hints, *res;
+ struct addrinfo hints;
+ struct rb_addrinfo *res;
MEMZERO(&hints, struct addrinfo, 1);
hints.ai_family = NIL_P(family) ? PF_UNSPEC : rsock_family_arg(family);
@@ -664,21 +789,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 addrinfo *res = call_getaddrinfo(node, service, family, socktype, protocol, flags, 1);
+ struct rb_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);
+ VALUE inspectname = rb_str_equal(node, inspectnode) ? Qnil : make_inspectname(inspectnode, inspectservice, res->ai);
canonname = Qnil;
- if (res->ai_canonname) {
- canonname = rb_tainted_str_new_cstr(res->ai_canonname);
+ if (res->ai->ai_canonname) {
+ canonname = rb_tainted_str_new_cstr(res->ai->ai_canonname);
OBJ_FREEZE(canonname);
}
- init_addrinfo(rai, res->ai_addr, res->ai_addrlen,
+ init_addrinfo(rai, res->ai->ai_addr, res->ai->ai_addrlen,
NUM2INT(family), NUM2INT(socktype), NUM2INT(protocol),
canonname, inspectname);
- freeaddrinfo(res);
+ rb_freeaddrinfo(res);
}
static VALUE
@@ -734,21 +859,22 @@ addrinfo_firstonly_new(VALUE node, VALUE service, VALUE family, VALUE socktype,
VALUE canonname;
VALUE inspectname;
- struct addrinfo *res = call_getaddrinfo(node, service, family, socktype, protocol, flags, 0);
+ struct rb_addrinfo *res = call_getaddrinfo(node, service, family, socktype, protocol, flags, 0);
- inspectname = make_inspectname(node, service, res);
+ inspectname = make_inspectname(node, service, res->ai);
canonname = Qnil;
- if (res->ai_canonname) {
- canonname = rb_tainted_str_new_cstr(res->ai_canonname);
+ if (res->ai->ai_canonname) {
+ canonname = rb_tainted_str_new_cstr(res->ai->ai_canonname);
OBJ_FREEZE(canonname);
}
- ret = rsock_addrinfo_new(res->ai_addr, res->ai_addrlen,
- res->ai_family, res->ai_socktype, res->ai_protocol,
+ ret = rsock_addrinfo_new(res->ai->ai_addr, res->ai->ai_addrlen,
+ res->ai->ai_family, res->ai->ai_socktype,
+ res->ai->ai_protocol,
canonname, inspectname);
- freeaddrinfo(res);
+ rb_freeaddrinfo(res);
return ret;
}
@@ -759,12 +885,12 @@ addrinfo_list_new(VALUE node, VALUE service, VALUE family, VALUE socktype, VALUE
struct addrinfo *r;
VALUE inspectname;
- struct addrinfo *res = call_getaddrinfo(node, service, family, socktype, protocol, flags, 0);
+ struct rb_addrinfo *res = call_getaddrinfo(node, service, family, socktype, protocol, flags, 0);
- inspectname = make_inspectname(node, service, res);
+ inspectname = make_inspectname(node, service, res->ai);
ret = rb_ary_new();
- for (r = res; r; r = r->ai_next) {
+ for (r = res->ai; r; r = r->ai_next) {
VALUE addr;
VALUE canonname = Qnil;
@@ -780,7 +906,7 @@ addrinfo_list_new(VALUE node, VALUE service, VALUE family, VALUE socktype, VALUE
rb_ary_push(ret, addr);
}
- freeaddrinfo(res);
+ rb_freeaddrinfo(res);
return ret;
}
@@ -799,9 +925,7 @@ init_unix_addrinfo(rb_addrinfo_t *rai, VALUE path, int socktype)
"too long unix socket path (%"PRIuSIZE" bytes given but %"PRIuSIZE" bytes max)",
(size_t)RSTRING_LEN(path), sizeof(un.sun_path));
- MEMZERO(&un, struct sockaddr_un, 1);
-
- un.sun_family = AF_UNIX;
+ INIT_SOCKADDR_UN(&un, sizeof(struct sockaddr_un));
memcpy((void*)&un.sun_path, RSTRING_PTR(path), RSTRING_LEN(path));
len = rsock_unix_sockaddr_len(path);
@@ -927,7 +1051,7 @@ addrinfo_initialize(int argc, VALUE *argv, VALUE self)
else {
StringValue(sockaddr_arg);
sockaddr_ptr = (struct sockaddr *)RSTRING_PTR(sockaddr_arg);
- sockaddr_len = RSTRING_LENINT(sockaddr_arg);
+ sockaddr_len = RSTRING_SOCKLEN(sockaddr_arg);
init_addrinfo(rai, sockaddr_ptr, sockaddr_len,
i_pfamily, i_socktype, i_protocol,
canonname, inspectname);
@@ -948,41 +1072,69 @@ get_afamily(struct sockaddr *addr, socklen_t len)
static int
ai_get_afamily(rb_addrinfo_t *rai)
{
- return get_afamily((struct sockaddr *)&rai->addr, rai->sockaddr_len);
+ return get_afamily(&rai->addr.addr, rai->sockaddr_len);
}
static VALUE
inspect_sockaddr(VALUE addrinfo, VALUE ret)
{
rb_addrinfo_t *rai = get_addrinfo(addrinfo);
+ union_sockaddr *sockaddr = &rai->addr;
+ socklen_t socklen = rai->sockaddr_len;
+ return rsock_inspect_sockaddr((struct sockaddr *)sockaddr, socklen, ret);
+}
- if (rai->sockaddr_len == 0) {
+VALUE
+rsock_inspect_sockaddr(struct sockaddr *sockaddr_arg, socklen_t socklen, VALUE ret)
+{
+ union_sockaddr *sockaddr = (union_sockaddr *)sockaddr_arg;
+ if (socklen == 0) {
rb_str_cat2(ret, "empty-sockaddr");
}
- else if ((long)rai->sockaddr_len < ((char*)&rai->addr.ss_family + sizeof(rai->addr.ss_family)) - (char*)&rai->addr)
+ else if ((long)socklen < ((char*)&sockaddr->addr.sa_family + sizeof(sockaddr->addr.sa_family)) - (char*)sockaddr)
rb_str_cat2(ret, "too-short-sockaddr");
else {
- switch (rai->addr.ss_family) {
+ switch (sockaddr->addr.sa_family) {
+ case AF_UNSPEC:
+ {
+ rb_str_cat2(ret, "UNSPEC");
+ break;
+ }
+
case AF_INET:
{
struct sockaddr_in *addr;
int port;
- if (rai->sockaddr_len < (socklen_t)sizeof(struct sockaddr_in)) {
- rb_str_cat2(ret, "too-short-AF_INET-sockaddr");
- }
- else {
- addr = (struct sockaddr_in *)&rai->addr;
- rb_str_catf(ret, "%d.%d.%d.%d",
- ((unsigned char*)&addr->sin_addr)[0],
- ((unsigned char*)&addr->sin_addr)[1],
- ((unsigned char*)&addr->sin_addr)[2],
- ((unsigned char*)&addr->sin_addr)[3]);
- port = ntohs(addr->sin_port);
- if (port)
- rb_str_catf(ret, ":%d", port);
- if ((socklen_t)sizeof(struct sockaddr_in) < rai->sockaddr_len)
- rb_str_catf(ret, "(sockaddr %d bytes too long)", (int)(rai->sockaddr_len - sizeof(struct sockaddr_in)));
- }
+ addr = &sockaddr->in;
+ if ((socklen_t)(((char*)&addr->sin_addr)-(char*)addr+0+1) <= socklen)
+ rb_str_catf(ret, "%d", ((unsigned char*)&addr->sin_addr)[0]);
+ else
+ rb_str_cat2(ret, "?");
+ if ((socklen_t)(((char*)&addr->sin_addr)-(char*)addr+1+1) <= socklen)
+ rb_str_catf(ret, ".%d", ((unsigned char*)&addr->sin_addr)[1]);
+ else
+ rb_str_cat2(ret, ".?");
+ if ((socklen_t)(((char*)&addr->sin_addr)-(char*)addr+2+1) <= socklen)
+ rb_str_catf(ret, ".%d", ((unsigned char*)&addr->sin_addr)[2]);
+ else
+ rb_str_cat2(ret, ".?");
+ if ((socklen_t)(((char*)&addr->sin_addr)-(char*)addr+3+1) <= socklen)
+ rb_str_catf(ret, ".%d", ((unsigned char*)&addr->sin_addr)[3]);
+ else
+ rb_str_cat2(ret, ".?");
+
+ if ((socklen_t)(((char*)&addr->sin_port)-(char*)addr+(int)sizeof(addr->sin_port)) < socklen) {
+ port = ntohs(addr->sin_port);
+ if (port)
+ rb_str_catf(ret, ":%d", port);
+ }
+ else {
+ rb_str_cat2(ret, ":?");
+ }
+ if ((socklen_t)sizeof(struct sockaddr_in) != socklen)
+ rb_str_catf(ret, " (%d bytes for %d bytes sockaddr_in)",
+ (int)socklen,
+ (int)sizeof(struct sockaddr_in));
break;
}
@@ -993,16 +1145,16 @@ inspect_sockaddr(VALUE addrinfo, VALUE ret)
char hbuf[1024];
int port;
int error;
- if (rai->sockaddr_len < (socklen_t)sizeof(struct sockaddr_in6)) {
- rb_str_cat2(ret, "too-short-AF_INET6-sockaddr");
+ if (socklen < (socklen_t)sizeof(struct sockaddr_in6)) {
+ rb_str_catf(ret, "too-short-AF_INET6-sockaddr %d bytes", (int)socklen);
}
else {
- addr = (struct sockaddr_in6 *)&rai->addr;
+ addr = &sockaddr->in6;
/* use getnameinfo for scope_id.
* RFC 4007: IPv6 Scoped Address Architecture
* draft-ietf-ipv6-scope-api-00.txt: Scoped Address Extensions to the IPv6 Basic Socket API
*/
- error = getnameinfo((struct sockaddr *)&rai->addr, rai->sockaddr_len,
+ error = getnameinfo(&sockaddr->addr, socklen,
hbuf, (socklen_t)sizeof(hbuf), NULL, 0,
NI_NUMERICHOST|NI_NUMERICSERV);
if (error) {
@@ -1015,8 +1167,8 @@ inspect_sockaddr(VALUE addrinfo, VALUE ret)
port = ntohs(addr->sin6_port);
rb_str_catf(ret, "[%s]:%d", hbuf, port);
}
- if ((socklen_t)sizeof(struct sockaddr_in6) < rai->sockaddr_len)
- rb_str_catf(ret, "(sockaddr %d bytes too long)", (int)(rai->sockaddr_len - sizeof(struct sockaddr_in6)));
+ if ((socklen_t)sizeof(struct sockaddr_in6) < socklen)
+ rb_str_catf(ret, "(sockaddr %d bytes too long)", (int)(socklen - sizeof(struct sockaddr_in6)));
}
break;
}
@@ -1025,10 +1177,10 @@ inspect_sockaddr(VALUE addrinfo, VALUE ret)
#ifdef HAVE_SYS_UN_H
case AF_UNIX:
{
- struct sockaddr_un *addr = (struct sockaddr_un *)&rai->addr;
+ struct sockaddr_un *addr = &sockaddr->un;
char *p, *s, *e;
s = addr->sun_path;
- e = (char*)addr + rai->sockaddr_len;
+ e = (char*)addr + socklen;
while (s < e && *(e-1) == '\0')
e--;
if (e < s)
@@ -1044,27 +1196,170 @@ inspect_sockaddr(VALUE addrinfo, VALUE ret)
}
if (printable_only) { /* only printable, no space */
if (s[0] != '/') /* relative path */
- rb_str_cat2(ret, "AF_UNIX ");
+ rb_str_cat2(ret, "UNIX ");
rb_str_cat(ret, s, p - s);
}
else {
- rb_str_cat2(ret, "AF_UNIX");
+ rb_str_cat2(ret, "UNIX");
while (s < e)
rb_str_catf(ret, ":%02x", (unsigned char)*s++);
}
- if (addr->sun_path + sizeof(addr->sun_path) < (char*)&rai->addr + rai->sockaddr_len)
- rb_str_catf(ret, "(sockaddr %d bytes too long)",
- (int)(rai->sockaddr_len - (addr->sun_path + sizeof(addr->sun_path) - (char*)&rai->addr)));
}
break;
}
#endif
+#ifdef AF_PACKET
+ /* GNU/Linux */
+ case AF_PACKET:
+ {
+ struct sockaddr_ll *addr;
+ const char *sep = "[";
+#define CATSEP do { rb_str_cat2(ret, sep); sep = " "; } while (0);
+
+ addr = (struct sockaddr_ll *)sockaddr;
+
+ rb_str_cat2(ret, "PACKET");
+
+ if (offsetof(struct sockaddr_ll, sll_protocol) + sizeof(addr->sll_protocol) <= (size_t)socklen) {
+ CATSEP;
+ rb_str_catf(ret, "protocol=%d", ntohs(addr->sll_protocol));
+ }
+ if (offsetof(struct sockaddr_ll, sll_ifindex) + sizeof(addr->sll_ifindex) <= (size_t)socklen) {
+ char buf[IFNAMSIZ];
+ CATSEP;
+ if (if_indextoname(addr->sll_ifindex, buf) == NULL)
+ rb_str_catf(ret, "ifindex=%d", addr->sll_ifindex);
+ else
+ rb_str_catf(ret, "%s", buf);
+ }
+ if (offsetof(struct sockaddr_ll, sll_hatype) + sizeof(addr->sll_hatype) <= (size_t)socklen) {
+ CATSEP;
+ rb_str_catf(ret, "hatype=%d", addr->sll_hatype);
+ }
+ if (offsetof(struct sockaddr_ll, sll_pkttype) + sizeof(addr->sll_pkttype) <= (size_t)socklen) {
+ CATSEP;
+ if (addr->sll_pkttype == PACKET_HOST)
+ rb_str_cat2(ret, "HOST");
+ else if (addr->sll_pkttype == PACKET_BROADCAST)
+ rb_str_cat2(ret, "BROADCAST");
+ else if (addr->sll_pkttype == PACKET_MULTICAST)
+ rb_str_cat2(ret, "MULTICAST");
+ else if (addr->sll_pkttype == PACKET_OTHERHOST)
+ rb_str_cat2(ret, "OTHERHOST");
+ else if (addr->sll_pkttype == PACKET_OUTGOING)
+ rb_str_cat2(ret, "OUTGOING");
+ else
+ rb_str_catf(ret, "pkttype=%d", addr->sll_pkttype);
+ }
+ if (socklen != (socklen_t)(offsetof(struct sockaddr_ll, sll_addr) + addr->sll_halen)) {
+ CATSEP;
+ if (offsetof(struct sockaddr_ll, sll_halen) + sizeof(addr->sll_halen) <= (size_t)socklen) {
+ rb_str_catf(ret, "halen=%d", addr->sll_halen);
+ }
+ }
+ if (offsetof(struct sockaddr_ll, sll_addr) < (size_t)socklen) {
+ socklen_t len, i;
+ CATSEP;
+ rb_str_cat2(ret, "hwaddr");
+ len = addr->sll_halen;
+ if ((size_t)socklen < offsetof(struct sockaddr_ll, sll_addr) + len)
+ len = socklen - offsetof(struct sockaddr_ll, sll_addr);
+ for (i = 0; i < len; i++) {
+ rb_str_cat2(ret, i == 0 ? "=" : ":");
+ rb_str_catf(ret, "%02x", addr->sll_addr[i]);
+ }
+ }
+
+ if (socklen < (socklen_t)(offsetof(struct sockaddr_ll, sll_halen) + sizeof(addr->sll_halen)) ||
+ (socklen_t)(offsetof(struct sockaddr_ll, sll_addr) + addr->sll_halen) != socklen) {
+ CATSEP;
+ rb_str_catf(ret, "(%d bytes for %d bytes sockaddr_ll)",
+ (int)socklen, (int)sizeof(struct sockaddr_ll));
+ }
+
+ rb_str_cat2(ret, "]");
+#undef CATSEP
+
+ break;
+ }
+#endif
+
+#if defined(AF_LINK) && defined(HAVE_TYPE_STRUCT_SOCKADDR_DL)
+ /* AF_LINK is defined in 4.4BSD derivations since Net2.
+ link_ntoa is also defined at Net2.
+ However Debian GNU/kFreeBSD defines AF_LINK but
+ don't have link_ntoa. */
+ case AF_LINK:
+ {
+ /*
+ * Simple implementation using link_ntoa():
+ * This doesn't work on Debian GNU/kFreeBSD 6.0.7 (squeeze).
+ * Also, the format is bit different.
+ *
+ * rb_str_catf(ret, "LINK %s", link_ntoa(&sockaddr->dl));
+ * break;
+ */
+ struct sockaddr_dl *addr = &sockaddr->dl;
+ char *np = NULL, *ap = NULL, *endp;
+ int nlen = 0, alen = 0;
+ int i, off;
+ const char *sep = "[";
+#define CATSEP do { rb_str_cat2(ret, sep); sep = " "; } while (0);
+
+ rb_str_cat2(ret, "LINK");
+
+ endp = ((char *)addr) + socklen;
+
+ if (offsetof(struct sockaddr_dl, sdl_data) < socklen) {
+ np = addr->sdl_data;
+ nlen = addr->sdl_nlen;
+ if (endp - np < nlen)
+ nlen = (int)(endp - np);
+ }
+ off = addr->sdl_nlen;
+
+ if (offsetof(struct sockaddr_dl, sdl_data) + off < socklen) {
+ ap = addr->sdl_data + off;
+ alen = addr->sdl_alen;
+ if (endp - ap < alen)
+ alen = (int)(endp - ap);
+ }
+
+ CATSEP;
+ if (np)
+ rb_str_catf(ret, "%.*s", nlen, np);
+ else
+ rb_str_cat2(ret, "?");
+
+ if (ap && 0 < alen) {
+ CATSEP;
+ for (i = 0; i < alen; i++)
+ rb_str_catf(ret, "%s%02x", i == 0 ? "" : ":", (unsigned char)ap[i]);
+ }
+
+ if (socklen < (socklen_t)(offsetof(struct sockaddr_dl, sdl_nlen) + sizeof(addr->sdl_nlen)) ||
+ socklen < (socklen_t)(offsetof(struct sockaddr_dl, sdl_alen) + sizeof(addr->sdl_alen)) ||
+ socklen < (socklen_t)(offsetof(struct sockaddr_dl, sdl_slen) + sizeof(addr->sdl_slen)) ||
+ /* longer length is possible behavior because struct sockaddr_dl has "minimum work area, can be larger" as the last field.
+ * cf. Net2:/usr/src/sys/net/if_dl.h. */
+ socklen < (socklen_t)(offsetof(struct sockaddr_dl, sdl_data) + addr->sdl_nlen + addr->sdl_alen + addr->sdl_slen)) {
+ CATSEP;
+ rb_str_catf(ret, "(%d bytes for %d bytes sockaddr_dl)",
+ (int)socklen, (int)sizeof(struct sockaddr_dl));
+ }
+
+ rb_str_cat2(ret, "]");
+#undef CATSEP
+ break;
+ }
+#endif
+
default:
{
- ID id = rsock_intern_family(rai->addr.ss_family);
+ ID id = rsock_intern_family(sockaddr->addr.sa_family);
if (id == 0)
- rb_str_catf(ret, "unknown address family %d", rai->addr.ss_family);
+ rb_str_catf(ret, "unknown address family %d", sockaddr->addr.sa_family);
else
rb_str_catf(ret, "%s address format unknown", rb_id2name(id));
break;
@@ -1165,8 +1460,8 @@ addrinfo_inspect(VALUE self)
* Addrinfo.unix("/tmp/sock").inspect_sockaddr #=> "/tmp/sock"
*
*/
-static VALUE
-addrinfo_inspect_sockaddr(VALUE self)
+VALUE
+rsock_addrinfo_inspect_sockaddr(VALUE self)
{
return inspect_sockaddr(self, rb_str_new("", 0));
}
@@ -1219,7 +1514,7 @@ addrinfo_mdump(VALUE self)
#ifdef HAVE_SYS_UN_H
case AF_UNIX:
{
- struct sockaddr_un *su = (struct sockaddr_un *)&rai->addr;
+ struct sockaddr_un *su = &rai->addr.un;
char *s, *e;
s = su->sun_path;
e = (char*)su + rai->sockaddr_len;
@@ -1234,7 +1529,7 @@ addrinfo_mdump(VALUE self)
{
char hbuf[NI_MAXHOST], pbuf[NI_MAXSERV];
int error;
- error = getnameinfo((struct sockaddr *)&rai->addr, rai->sockaddr_len,
+ error = getnameinfo(&rai->addr.addr, rai->sockaddr_len,
hbuf, (socklen_t)sizeof(hbuf), pbuf, (socklen_t)sizeof(pbuf),
NI_NUMERICHOST|NI_NUMERICSERV);
if (error) {
@@ -1255,7 +1550,7 @@ addrinfo_mload(VALUE self, VALUE ary)
VALUE v;
VALUE canonname, inspectname;
int afamily, pfamily, socktype, protocol;
- struct sockaddr_storage ss;
+ union_sockaddr ss;
socklen_t len;
rb_addrinfo_t *rai;
@@ -1319,8 +1614,7 @@ addrinfo_mload(VALUE self, VALUE ary)
case AF_UNIX:
{
struct sockaddr_un uaddr;
- MEMZERO(&uaddr, struct sockaddr_un, 1);
- uaddr.sun_family = AF_UNIX;
+ INIT_SOCKADDR_UN(&uaddr, sizeof(struct sockaddr_un));
StringValue(v);
if (sizeof(uaddr.sun_path) < (size_t)RSTRING_LEN(v))
@@ -1337,7 +1631,7 @@ addrinfo_mload(VALUE self, VALUE ary)
default:
{
VALUE pair = rb_convert_type(v, T_ARRAY, "Array", "to_ary");
- struct addrinfo *res;
+ struct rb_addrinfo *res;
int flags = AI_NUMERICHOST;
#ifdef AI_NUMERICSERV
flags |= AI_NUMERICSERV;
@@ -1346,14 +1640,14 @@ addrinfo_mload(VALUE self, VALUE ary)
INT2NUM(pfamily), INT2NUM(socktype), INT2NUM(protocol),
INT2NUM(flags), 1);
- len = res->ai_addrlen;
- memcpy(&ss, res->ai_addr, res->ai_addrlen);
+ len = res->ai->ai_addrlen;
+ memcpy(&ss, res->ai->ai_addr, res->ai->ai_addrlen);
break;
}
}
DATA_PTR(self) = rai = alloc_addrinfo();
- init_addrinfo(rai, (struct sockaddr *)&ss, len,
+ init_addrinfo(rai, &ss.addr, len,
pfamily, socktype, protocol,
canonname, inspectname);
return self;
@@ -1581,7 +1875,7 @@ addrinfo_getnameinfo(int argc, VALUE *argv, VALUE self)
if (rai->socktype == SOCK_DGRAM)
flags |= NI_DGRAM;
- error = getnameinfo((struct sockaddr *)&rai->addr, rai->sockaddr_len,
+ error = getnameinfo(&rai->addr.addr, rai->sockaddr_len,
hbuf, (socklen_t)sizeof(hbuf), pbuf, (socklen_t)sizeof(pbuf),
flags);
if (error) {
@@ -1672,14 +1966,14 @@ addrinfo_ip_port(VALUE self)
case AF_INET:
if (rai->sockaddr_len != sizeof(struct sockaddr_in))
rb_raise(rb_eSocket, "unexpected sockaddr size for IPv4");
- port = ntohs(((struct sockaddr_in *)&rai->addr)->sin_port);
+ port = ntohs(rai->addr.in.sin_port);
break;
#ifdef AF_INET6
case AF_INET6:
if (rai->sockaddr_len != sizeof(struct sockaddr_in6))
rb_raise(rb_eSocket, "unexpected sockaddr size for IPv6");
- port = ntohs(((struct sockaddr_in6 *)&rai->addr)->sin6_port);
+ port = ntohs(rai->addr.in6.sin6_port);
break;
#endif
@@ -1696,7 +1990,7 @@ extract_in_addr(VALUE self, uint32_t *addrp)
rb_addrinfo_t *rai = get_addrinfo(self);
int family = ai_get_afamily(rai);
if (family != AF_INET) return 0;
- *addrp = ntohl(((struct sockaddr_in *)&rai->addr)->sin_addr.s_addr);
+ *addrp = ntohl(rai->addr.in.sin_addr.s_addr);
return 1;
}
@@ -1752,7 +2046,7 @@ extract_in6_addr(VALUE self)
rb_addrinfo_t *rai = get_addrinfo(self);
int family = ai_get_afamily(rai);
if (family != AF_INET6) return NULL;
- return &((struct sockaddr_in6 *)&rai->addr)->sin6_addr;
+ return &rai->addr.in6.sin6_addr;
}
/*
@@ -1928,12 +2222,10 @@ addrinfo_ipv6_to_ipv4(VALUE self)
struct in6_addr *addr;
int family = ai_get_afamily(rai);
if (family != AF_INET6) return Qnil;
- addr = &((struct sockaddr_in6 *)&rai->addr)->sin6_addr;
+ addr = &rai->addr.in6.sin6_addr;
if (IN6_IS_ADDR_V4MAPPED(addr) || IN6_IS_ADDR_V4COMPAT(addr)) {
struct sockaddr_in sin4;
- MEMZERO(&sin4, struct sockaddr_in, 1);
- sin4.sin_family = AF_INET;
- SET_SIN_LEN(&sin4, sizeof(sin4));
+ INIT_SOCKADDR_IN(&sin4, sizeof(sin4));
memcpy(&sin4.sin_addr, (char*)addr + sizeof(*addr) - sizeof(sin4.sin_addr), sizeof(sin4.sin_addr));
return rsock_addrinfo_new((struct sockaddr *)&sin4, (socklen_t)sizeof(sin4),
PF_INET, rai->socktype, rai->protocol,
@@ -1966,7 +2258,7 @@ addrinfo_unix_path(VALUE self)
if (family != AF_UNIX)
rb_raise(rb_eSocket, "need AF_UNIX address");
- addr = (struct sockaddr_un *)&rai->addr;
+ addr = &rai->addr.un;
s = addr->sun_path;
e = (char*)addr + rai->sockaddr_len;
@@ -2137,6 +2429,19 @@ rsock_sockaddr_string_value(volatile VALUE *v)
return *v;
}
+VALUE
+rsock_sockaddr_string_value_with_addrinfo(volatile VALUE *v, VALUE *rai_ret)
+{
+ VALUE val = *v;
+ *rai_ret = Qnil;
+ if (IS_ADDRINFO(val)) {
+ *v = addrinfo_to_sockaddr(val);
+ *rai_ret = val;
+ }
+ StringValue(*v);
+ return *v;
+}
+
char *
rsock_sockaddr_string_value_ptr(volatile VALUE *v)
{
@@ -2208,7 +2513,7 @@ rsock_init_addrinfo(void)
rb_define_alloc_func(rb_cAddrinfo, addrinfo_s_allocate);
rb_define_method(rb_cAddrinfo, "initialize", addrinfo_initialize, -1);
rb_define_method(rb_cAddrinfo, "inspect", addrinfo_inspect, 0);
- rb_define_method(rb_cAddrinfo, "inspect_sockaddr", addrinfo_inspect_sockaddr, 0);
+ rb_define_method(rb_cAddrinfo, "inspect_sockaddr", rsock_addrinfo_inspect_sockaddr, 0);
rb_define_singleton_method(rb_cAddrinfo, "getaddrinfo", addrinfo_s_getaddrinfo, -1);
rb_define_singleton_method(rb_cAddrinfo, "ip", addrinfo_s_ip, 1);
rb_define_singleton_method(rb_cAddrinfo, "tcp", addrinfo_s_tcp, 2);
diff --git a/ext/socket/rubysocket.h b/ext/socket/rubysocket.h
index ff91f51bb7..8beffd2e76 100644
--- a/ext/socket/rubysocket.h
+++ b/ext/socket/rubysocket.h
@@ -11,83 +11,122 @@
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
-#include <unistd.h>
+# include <unistd.h>
#endif
#ifdef HAVE_SYS_UIO_H
-#include <sys/uio.h>
+# include <sys/uio.h>
#endif
#ifdef HAVE_XTI_H
-#include <xti.h>
+# include <xti.h>
#endif
-#ifndef _WIN32
-#if defined(__BEOS__) && !defined(__HAIKU__) && !defined(BONE)
-# include <net/socket.h>
+#ifdef _WIN32
+# if defined(_MSC_VER)
+# undef HAVE_TYPE_STRUCT_SOCKADDR_DL
+# endif
#else
-# include <sys/socket.h>
-#endif
-#include <netinet/in.h>
-#ifdef HAVE_NETINET_IN_SYSTM_H
-# include <netinet/in_systm.h>
-#endif
-#ifdef HAVE_NETINET_TCP_H
-# include <netinet/tcp.h>
-#endif
-#ifdef HAVE_NETINET_UDP_H
-# include <netinet/udp.h>
-#endif
-#ifdef HAVE_ARPA_INET_H
-# include <arpa/inet.h>
-#endif
-#include <netdb.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>
+# endif
+# 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
+# ifdef HAVE_ARPA_INET_H
+# include <arpa/inet.h>
+# endif
+# include <netdb.h>
+#endif
+
+#ifdef HAVE_NETPACKET_PACKET_H
+# include <netpacket/packet.h>
+#endif
+#ifdef HAVE_NET_ETHERNET_H
+# include <net/ethernet.h>
#endif
+
#include <errno.h>
+
#ifdef HAVE_SYS_UN_H
-#include <sys/un.h>
+# include <sys/un.h>
#endif
#if defined(HAVE_FCNTL)
-#ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
+# ifdef HAVE_SYS_SELECT_H
+# include <sys/select.h>
+# endif
+# ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+# endif
+# ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+# endif
+# ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+# endif
#endif
#ifdef HAVE_IFADDRS_H
-#include <ifaddrs.h>
+# include <ifaddrs.h>
#endif
#ifdef HAVE_SYS_IOCTL_H
-#include <sys/ioctl.h>
+# include <sys/ioctl.h>
#endif
#ifdef HAVE_SYS_SOCKIO_H
-#include <sys/sockio.h>
+# include <sys/sockio.h>
#endif
#ifdef HAVE_NET_IF_H
-#include <net/if.h>
+# include <net/if.h>
#endif
#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
+# include <sys/param.h>
#endif
#ifdef HAVE_SYS_UCRED_H
-#include <sys/ucred.h>
+# include <sys/ucred.h>
#endif
#ifdef HAVE_UCRED_H
-#include <ucred.h>
+# include <ucred.h>
+#endif
+#ifdef HAVE_NET_IF_DL_H
+# include <net/if_dl.h>
+#endif
+
+#ifndef HAVE_TYPE_SOCKLEN_T
+typedef int socklen_t;
+#endif
+
+#ifdef NEED_IF_INDEXTONAME_DECL
+char *if_indextoname(unsigned int, char *);
+#endif
+#ifdef NEED_IF_NAMETOINDEX_DECL
+unsigned int if_nametoindex(const char *);
+#endif
+
+#define SOCKLEN_MAX \
+ (0 < (socklen_t)-1 ? \
+ ~(socklen_t)0 : \
+ (((((socklen_t)1) << (sizeof(socklen_t) * CHAR_BIT - 2)) - 1) * 2 + 1))
+
+#ifndef RSTRING_SOCKLEN
+# define RSTRING_SOCKLEN (socklen_t)RSTRING_LENINT
#endif
#ifndef EWOULDBLOCK
-#define EWOULDBLOCK EAGAIN
+# define EWOULDBLOCK EAGAIN
#endif
/*
@@ -100,72 +139,89 @@
#define pseudo_AF_FTIP pseudo_AF_RTIP
#ifndef HAVE_GETADDRINFO
-#include "addrinfo.h"
+# include "addrinfo.h"
#endif
+
#include "sockport.h"
#ifndef NI_MAXHOST
-# define NI_MAXHOST 1025
+# define NI_MAXHOST 1025
#endif
#ifndef NI_MAXSERV
-# define NI_MAXSERV 32
+# define NI_MAXSERV 32
#endif
#ifdef AF_INET6
-# define IS_IP_FAMILY(af) ((af) == AF_INET || (af) == AF_INET6)
+# define IS_IP_FAMILY(af) ((af) == AF_INET || (af) == AF_INET6)
#else
-# define IS_IP_FAMILY(af) ((af) == AF_INET)
+# define IS_IP_FAMILY(af) ((af) == AF_INET)
#endif
#ifndef IN6_IS_ADDR_UNIQUE_LOCAL
-# define IN6_IS_ADDR_UNIQUE_LOCAL(a) (((a)->s6_addr[0] == 0xfc) || ((a)->s6_addr[0] == 0xfd))
+# define IN6_IS_ADDR_UNIQUE_LOCAL(a) (((a)->s6_addr[0] == 0xfc) || ((a)->s6_addr[0] == 0xfd))
#endif
-#ifndef HAVE_SOCKADDR_STORAGE
+#ifndef HAVE_TYPE_STRUCT_SOCKADDR_STORAGE
/*
* RFC 2553: protocol-independent placeholder for socket addresses
*/
-#define _SS_MAXSIZE 128
-#define _SS_ALIGNSIZE (sizeof(double))
-#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(unsigned char) * 2)
-#define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(unsigned char) * 2 - \
+# define _SS_MAXSIZE 128
+# define _SS_ALIGNSIZE (sizeof(double))
+# define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(unsigned char) * 2)
+# define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(unsigned char) * 2 - \
_SS_PAD1SIZE - _SS_ALIGNSIZE)
struct sockaddr_storage {
-#ifdef HAVE_SA_LEN
+# ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
unsigned char ss_len; /* address length */
unsigned char ss_family; /* address family */
-#else
+# else
unsigned short ss_family;
-#endif
+# endif
char __ss_pad1[_SS_PAD1SIZE];
double __ss_align; /* force desired structure storage alignment */
char __ss_pad2[_SS_PAD2SIZE];
};
#endif
+typedef union {
+ struct sockaddr addr;
+ struct sockaddr_in in;
+#ifdef AF_INET6
+ struct sockaddr_in6 in6;
+#endif
+#ifdef HAVE_TYPE_STRUCT_SOCKADDR_UN
+ struct sockaddr_un un;
+#endif
+#ifdef HAVE_TYPE_STRUCT_SOCKADDR_DL
+ struct sockaddr_dl dl; /* AF_LINK */
+#endif
+ struct sockaddr_storage storage;
+ char place_holder[2048]; /* sockaddr_storage is not enough for Unix domain sockets on SunOS and Darwin. */
+} union_sockaddr;
+
#ifdef __APPLE__
/*
* CMSG_ macros are broken on 64bit darwin, because __DARWIN_ALIGN
* aligns up to __darwin_size_t which is 64bit, but CMSG_DATA is
* 32bit-aligned.
*/
-#undef __DARWIN_ALIGNBYTES
-#define __DARWIN_ALIGNBYTES (sizeof(unsigned int) - 1)
+# undef __DARWIN_ALIGNBYTES
+# define __DARWIN_ALIGNBYTES (sizeof(unsigned int) - 1)
#endif
#if defined(_AIX)
-#ifndef CMSG_SPACE
-# define CMSG_SPACE(len) (_CMSG_ALIGN(sizeof(struct cmsghdr)) + _CMSG_ALIGN(len))
-#endif
-#ifndef CMSG_LEN
-# define CMSG_LEN(len) (_CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
-#endif
+# ifndef CMSG_SPACE
+# define CMSG_SPACE(len) (_CMSG_ALIGN(sizeof(struct cmsghdr)) + _CMSG_ALIGN(len))
+# endif
+# ifndef CMSG_LEN
+# define CMSG_LEN(len) (_CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
+# endif
#endif
#ifdef __BEOS__
-#undef close
-#define close closesocket
+# undef close
+# define close closesocket
#endif
#define INET_CLIENT 0
@@ -173,6 +229,7 @@ struct sockaddr_storage {
#define INET_SOCKS 2
extern int rsock_do_not_reverse_lookup;
+extern int rsock_cmsg_cloexec_state;
#define FMODE_NOREVLOOKUP 0x100
extern VALUE rb_cBasicSocket;
@@ -192,23 +249,25 @@ extern VALUE rb_eSocket;
#ifdef SOCKS
extern VALUE rb_cSOCKSSocket;
-#ifdef SOCKS5
-#include <socks.h>
-#else
+# ifdef SOCKS5
+# include <socks.h>
+# else
void SOCKSinit();
int Rconnect();
-#endif
+# endif
#endif
#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))
#define SockAddrStringValuePtr(v) rsock_sockaddr_string_value_ptr(&(v))
+#define SockAddrStringValueWithAddrinfo(v, rai_ret) rsock_sockaddr_string_value_with_addrinfo(&(v), &(rai_ret))
VALUE rsock_sockaddr_string_value(volatile VALUE *);
char *rsock_sockaddr_string_value_ptr(volatile VALUE *);
+VALUE rsock_sockaddr_string_value_with_addrinfo(volatile VALUE *v, VALUE *ai_ret);
+
VALUE rb_check_sockaddr_string_type(VALUE);
NORETURN(void rsock_raise_socket_error(const char *, int));
@@ -222,18 +281,28 @@ int rsock_shutdown_how_arg(VALUE how);
int rsock_getfamily(int sockfd);
-int rb_getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res);
+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_getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, size_t hostlen, char *serv, size_t servlen, int flags);
-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);
+struct rb_addrinfo *rsock_addrinfo(VALUE host, VALUE port, int socktype, int flags);
+struct rb_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);
VALUE rsock_addrinfo_new(struct sockaddr *addr, socklen_t len, int family, int socktype, int protocol, VALUE canonname, VALUE inspectname);
+VALUE rsock_addrinfo_inspect_sockaddr(VALUE rai);
-VALUE rsock_make_ipaddr(struct sockaddr *addr);
-VALUE rsock_ipaddr(struct sockaddr *sockaddr, int norevlookup);
-VALUE rsock_make_hostent(VALUE host, struct addrinfo *addr, VALUE (*ipaddr)(struct sockaddr *, size_t));
+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_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);
int rsock_revlookup_flag(VALUE revlookup, int *norevlookup);
@@ -244,6 +313,7 @@ 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);
@@ -285,6 +355,7 @@ VALUE rsock_bsock_sendmsg_nonblock(int argc, VALUE *argv, VALUE sock);
#define rsock_bsock_sendmsg rb_f_notimplement
#define rsock_bsock_sendmsg_nonblock rb_f_notimplement
#endif
+
#if defined(HAVE_RECVMSG)
VALUE rsock_bsock_recvmsg(int argc, VALUE *argv, VALUE sock);
VALUE rsock_bsock_recvmsg_nonblock(int argc, VALUE *argv, VALUE sock);
@@ -294,7 +365,7 @@ ssize_t rsock_recvmsg(int socket, struct msghdr *message, int flags);
#define rsock_bsock_recvmsg_nonblock rb_f_notimplement
#endif
-#ifdef HAVE_ST_MSG_CONTROL
+#ifdef HAVE_STRUCT_MSGHDR_MSG_CONTROL
void rsock_discard_cmsg_resource(struct msghdr *mh, int msg_peek_p);
#endif
@@ -310,6 +381,35 @@ void rsock_init_socket_constants(void);
void rsock_init_ancdata(void);
void rsock_init_addrinfo(void);
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) { }
+#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
+
#endif
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 6900dbcca6..f27383d61c 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -10,6 +10,98 @@
#include "rubysocket.h"
+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);
+
+ rb_syserr_fail_str(err, message);
+}
+
+void
+rsock_sys_fail_path(const char *mesg, VALUE path)
+{
+ rsock_syserr_fail_path(errno, mesg, path);
+}
+
+void
+rsock_syserr_fail_path(int err, 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);
+ }
+ else {
+ rb_syserr_fail(err, 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);
+}
+
+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);
+
+ rb_syserr_fail_str(err, 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,
+ (struct sockaddr *)RSTRING_PTR(addr),
+ (socklen_t)RSTRING_LEN(addr)); /* overflow should be checked already */
+ }
+ else
+ rsock_syserr_fail_raddrinfo(err, mesg, rai);
+}
+
static void
setup_domain_and_type(VALUE domain, int *dv, VALUE type, int *tv)
{
@@ -76,16 +168,29 @@ 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 */
-#ifdef SOCK_CLOEXEC
- static int try_sock_cloexec = 1;
- if (try_sock_cloexec) {
+ if (cloexec_state > 0) { /* common path, if SOCK_CLOEXEC is defined */
ret = socketpair(domain, type|SOCK_CLOEXEC, protocol, sv);
- if (ret == -1 && errno == EINVAL) {
+ 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 */
+ 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) {
/* 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) {
@@ -93,26 +198,41 @@ 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.
*/
- try_sock_cloexec = 0;
+ cloexec_state = 0;
}
}
}
- else {
+ else { /* cloexec_state == 0 */
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])
@@ -142,6 +262,14 @@ rsock_socketpair(int domain, int type, int protocol, int sv[2])
* _protocol_ should be a protocol defined in the domain,
* defaults to 0 for the domain.
*
+ * s1, s2 = Socket.pair(:UNIX, :STREAM, 0)
+ * s1.send "a", 0
+ * s1.send "b", 0
+ * s1.close
+ * p s2.recv(10) #=> "ab"
+ * p s2.recv(10) #=> ""
+ * p s2.recv(10) #=> ""
+ *
* s1, s2 = Socket.pair(:UNIX, :DGRAM, 0)
* s1.send "a", 0
* s1.send "b", 0
@@ -167,8 +295,6 @@ 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]);
@@ -184,7 +310,7 @@ rsock_sock_s_socketpair(int argc, VALUE *argv, VALUE klass)
/*
* call-seq:
- * socket.connect(remote_sockaddr) => 0
+ * socket.connect(remote_sockaddr) => 0
*
* Requests a connection to be made on the given +remote_sockaddr+. Returns 0 if
* successful, otherwise an exception is raised.
@@ -296,16 +422,17 @@ rsock_sock_s_socketpair(int argc, VALUE *argv, VALUE klass)
static VALUE
sock_connect(VALUE sock, VALUE addr)
{
+ VALUE rai;
rb_io_t *fptr;
int fd, n;
- SockAddrStringValue(addr);
+ SockAddrStringValueWithAddrinfo(addr, rai);
addr = rb_str_new4(addr);
GetOpenFile(sock, fptr);
fd = fptr->fd;
- n = rsock_connect(fd, (struct sockaddr*)RSTRING_PTR(addr), RSTRING_LENINT(addr), 0);
+ n = rsock_connect(fd, (struct sockaddr*)RSTRING_PTR(addr), RSTRING_SOCKLEN(addr), 0);
if (n < 0) {
- rb_sys_fail("connect(2)");
+ rsock_sys_fail_raddrinfo_or_sockaddr("connect(2)", addr, rai);
}
return INT2FIX(n);
@@ -313,7 +440,7 @@ sock_connect(VALUE sock, VALUE addr)
/*
* call-seq:
- * socket.connect_nonblock(remote_sockaddr) => 0
+ * 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.
@@ -356,18 +483,19 @@ sock_connect(VALUE sock, VALUE addr)
static VALUE
sock_connect_nonblock(VALUE sock, VALUE addr)
{
+ VALUE rai;
rb_io_t *fptr;
int n;
- SockAddrStringValue(addr);
+ SockAddrStringValueWithAddrinfo(addr, rai);
addr = rb_str_new4(addr);
GetOpenFile(sock, fptr);
rb_io_set_nonblock(fptr);
- n = connect(fptr->fd, (struct sockaddr*)RSTRING_PTR(addr), RSTRING_LENINT(addr));
+ n = connect(fptr->fd, (struct sockaddr*)RSTRING_PTR(addr), RSTRING_SOCKLEN(addr));
if (n < 0) {
if (errno == EINPROGRESS)
- rb_mod_sys_fail(rb_mWaitWritable, "connect(2) would block");
- rb_sys_fail("connect(2)");
+ 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);
@@ -375,7 +503,7 @@ sock_connect_nonblock(VALUE sock, VALUE addr)
/*
* call-seq:
- * socket.bind(local_sockaddr) => 0
+ * socket.bind(local_sockaddr) => 0
*
* Binds to the given local address.
*
@@ -462,19 +590,20 @@ sock_connect_nonblock(VALUE sock, VALUE addr)
static VALUE
sock_bind(VALUE sock, VALUE addr)
{
+ VALUE rai;
rb_io_t *fptr;
- SockAddrStringValue(addr);
+ SockAddrStringValueWithAddrinfo(addr, rai);
GetOpenFile(sock, fptr);
- if (bind(fptr->fd, (struct sockaddr*)RSTRING_PTR(addr), RSTRING_LENINT(addr)) < 0)
- rb_sys_fail("bind(2)");
+ if (bind(fptr->fd, (struct sockaddr*)RSTRING_PTR(addr), RSTRING_SOCKLEN(addr)) < 0)
+ rsock_sys_fail_raddrinfo_or_sockaddr("bind(2)", addr, rai);
return INT2FIX(0);
}
/*
* call-seq:
- * socket.listen( int ) => 0
+ * socket.listen( int ) => 0
*
* Listens for connections, using the specified +int+ as the backlog. A call
* to _listen_ only applies if the +socket+ is of type SOCK_STREAM or
@@ -548,7 +677,6 @@ rsock_sock_listen(VALUE sock, VALUE log)
rb_io_t *fptr;
int backlog;
- rb_secure(4);
backlog = NUM2INT(log);
GetOpenFile(sock, fptr);
if (listen(fptr->fd, backlog) < 0)
@@ -559,8 +687,8 @@ rsock_sock_listen(VALUE sock, VALUE log)
/*
* call-seq:
- * socket.recvfrom(maxlen) => [mesg, sender_addrinfo]
- * socket.recvfrom(maxlen, flags) => [mesg, sender_addrinfo]
+ * socket.recvfrom(maxlen) => [mesg, sender_addrinfo]
+ * socket.recvfrom(maxlen, flags) => [mesg, sender_addrinfo]
*
* Receives up to _maxlen_ bytes from +socket+. _flags_ is zero or more
* of the +MSG_+ options. The first element of the results, _mesg_, is the data
@@ -670,8 +798,8 @@ sock_recvfrom(int argc, VALUE *argv, VALUE sock)
/*
* call-seq:
- * socket.recvfrom_nonblock(maxlen) => [mesg, sender_addrinfo]
- * socket.recvfrom_nonblock(maxlen, flags) => [mesg, sender_addrinfo]
+ * 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.
@@ -755,18 +883,18 @@ sock_accept(VALUE sock)
{
rb_io_t *fptr;
VALUE sock2;
- struct sockaddr_storage buf;
+ union_sockaddr buf;
socklen_t len = (socklen_t)sizeof buf;
GetOpenFile(sock, fptr);
- sock2 = rsock_s_accept(rb_cSocket,fptr->fd,(struct sockaddr*)&buf,&len);
+ sock2 = rsock_s_accept(rb_cSocket,fptr->fd,&buf.addr,&len);
- return rb_assoc_new(sock2, rsock_io_socket_addrinfo(sock2, (struct sockaddr*)&buf, len));
+ return rb_assoc_new(sock2, rsock_io_socket_addrinfo(sock2, &buf.addr, len));
}
/*
* call-seq:
- * socket.accept_nonblock => [client_socket, client_addrinfo]
+ * socket.accept_nonblock => [client_socket, client_addrinfo]
*
* Accepts an incoming connection using accept(2) after
* O_NONBLOCK is set for the underlying file descriptor.
@@ -820,17 +948,17 @@ sock_accept_nonblock(VALUE sock)
{
rb_io_t *fptr;
VALUE sock2;
- struct sockaddr_storage buf;
+ union_sockaddr buf;
socklen_t len = (socklen_t)sizeof buf;
GetOpenFile(sock, fptr);
- sock2 = rsock_s_accept_nonblock(rb_cSocket, fptr, (struct sockaddr *)&buf, &len);
- return rb_assoc_new(sock2, rsock_io_socket_addrinfo(sock2, (struct sockaddr*)&buf, len));
+ sock2 = rsock_s_accept_nonblock(rb_cSocket, fptr, &buf.addr, &len);
+ return rb_assoc_new(sock2, rsock_io_socket_addrinfo(sock2, &buf.addr, len));
}
/*
* call-seq:
- * socket.sysaccept => [client_socket_fd, client_addrinfo]
+ * socket.sysaccept => [client_socket_fd, client_addrinfo]
*
* Accepts an incoming connection returning an array containing the (integer)
* file descriptor for the incoming connection, _client_socket_fd_,
@@ -871,13 +999,13 @@ sock_sysaccept(VALUE sock)
{
rb_io_t *fptr;
VALUE sock2;
- struct sockaddr_storage buf;
+ union_sockaddr buf;
socklen_t len = (socklen_t)sizeof buf;
GetOpenFile(sock, fptr);
- sock2 = rsock_s_accept(0,fptr->fd,(struct sockaddr*)&buf,&len);
+ sock2 = rsock_s_accept(0,fptr->fd,&buf.addr,&len);
- return rb_assoc_new(sock2, rsock_io_socket_addrinfo(sock2, (struct sockaddr*)&buf, len));
+ return rb_assoc_new(sock2, rsock_io_socket_addrinfo(sock2, &buf.addr, len));
}
#ifdef HAVE_GETHOSTNAME
@@ -895,14 +1023,19 @@ sock_sysaccept(VALUE sock)
static VALUE
sock_gethostname(VALUE obj)
{
-#ifndef HOST_NAME_MAX
-# define HOST_NAME_MAX 1024
+#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
#endif
- char buf[HOST_NAME_MAX+1];
+
+ char buf[RUBY_MAX_HOST_NAME_LEN+1];
rb_secure(3);
if (gethostname(buf, (int)sizeof buf - 1) < 0)
- rb_sys_fail("gethostname");
+ rb_sys_fail("gethostname(3)");
buf[sizeof buf - 1] = '\0';
return rb_str_new2(buf);
@@ -927,7 +1060,7 @@ sock_gethostname(VALUE obj)
#endif
static VALUE
-make_addrinfo(struct addrinfo *res0, int norevlookup)
+make_addrinfo(struct rb_addrinfo *res0, int norevlookup)
{
VALUE base, ary;
struct addrinfo *res;
@@ -936,8 +1069,8 @@ make_addrinfo(struct addrinfo *res0, int norevlookup)
rb_raise(rb_eSocket, "host not found");
}
base = rb_ary_new();
- for (res = res0; res; res = res->ai_next) {
- ary = rsock_ipaddr(res->ai_addr, norevlookup);
+ for (res = res0->ai; res; res = res->ai_next) {
+ ary = rsock_ipaddr(res->ai_addr, res->ai_addrlen, norevlookup);
if (res->ai_canonname) {
RARRAY_PTR(ary)[2] = rb_str_new2(res->ai_canonname);
}
@@ -950,19 +1083,19 @@ make_addrinfo(struct addrinfo *res0, int norevlookup)
}
static VALUE
-sock_sockaddr(struct sockaddr *addr, size_t len)
+sock_sockaddr(struct sockaddr *addr, socklen_t len)
{
char *ptr;
switch (addr->sa_family) {
case AF_INET:
ptr = (char*)&((struct sockaddr_in*)addr)->sin_addr.s_addr;
- len = sizeof(((struct sockaddr_in*)addr)->sin_addr.s_addr);
+ len = (socklen_t)sizeof(((struct sockaddr_in*)addr)->sin_addr.s_addr);
break;
#ifdef AF_INET6
case AF_INET6:
ptr = (char*)&((struct sockaddr_in6*)addr)->sin6_addr.s6_addr;
- len = sizeof(((struct sockaddr_in6*)addr)->sin6_addr.s6_addr);
+ len = (socklen_t)sizeof(((struct sockaddr_in6*)addr)->sin6_addr.s6_addr);
break;
#endif
default:
@@ -1016,7 +1149,7 @@ sock_s_gethostbyaddr(int argc, VALUE *argv)
t = AF_INET6;
}
#endif
- h = gethostbyaddr(RSTRING_PTR(addr), RSTRING_LENINT(addr), t);
+ h = gethostbyaddr(RSTRING_PTR(addr), RSTRING_SOCKLEN(addr), t);
if (h == NULL) {
#ifdef HAVE_HSTRERROR
extern int h_errno;
@@ -1159,7 +1292,8 @@ static VALUE
sock_s_getaddrinfo(int argc, VALUE *argv)
{
VALUE host, port, family, socktype, protocol, flags, ret, revlookup;
- struct addrinfo hints, *res;
+ struct addrinfo hints;
+ struct rb_addrinfo *res;
int norevlookup;
rb_scan_args(argc, argv, "25", &host, &port, &family, &socktype, &protocol, &flags, &revlookup);
@@ -1182,7 +1316,7 @@ sock_s_getaddrinfo(int argc, VALUE *argv)
res = rsock_getaddrinfo(host, port, &hints, 0);
ret = make_addrinfo(res, norevlookup);
- freeaddrinfo(res);
+ rb_freeaddrinfo(res);
return ret;
}
@@ -1215,10 +1349,12 @@ sock_s_getnameinfo(int argc, VALUE *argv)
char *hptr, *pptr;
char hbuf[1024], pbuf[1024];
int fl;
- struct addrinfo hints, *res = NULL, *r;
- int error;
- struct sockaddr_storage ss;
+ struct rb_addrinfo *res = NULL;
+ struct addrinfo hints, *r;
+ int error, saved_errno;
+ union_sockaddr ss;
struct sockaddr *sap;
+ socklen_t salen;
sa = flags = Qnil;
rb_scan_args(argc, argv, "11", &sa, &flags);
@@ -1234,10 +1370,11 @@ sock_s_getnameinfo(int argc, VALUE *argv)
rb_raise(rb_eTypeError, "sockaddr length too big");
}
memcpy(&ss, RSTRING_PTR(sa), RSTRING_LEN(sa));
- if ((size_t)RSTRING_LEN(sa) != SS_LEN(&ss)) {
+ if (!VALIDATE_SOCKLEN(&ss.addr, RSTRING_LEN(sa))) {
rb_raise(rb_eTypeError, "sockaddr size differs - should not happen");
}
- sap = (struct sockaddr*)&ss;
+ sap = &ss.addr;
+ salen = RSTRING_SOCKLEN(sa);
goto call_nameinfo;
}
tmp = rb_check_array_type(sa);
@@ -1298,39 +1435,45 @@ 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_addr;
+ sap = res->ai->ai_addr;
+ salen = res->ai->ai_addrlen;
}
else {
rb_raise(rb_eTypeError, "expecting String or Array");
}
call_nameinfo:
- error = rb_getnameinfo(sap, SA_LEN(sap), hbuf, sizeof(hbuf),
+ error = rb_getnameinfo(sap, salen, hbuf, sizeof(hbuf),
pbuf, sizeof(pbuf), fl);
if (error) goto error_exit_name;
if (res) {
- for (r = res->ai_next; r; r = r->ai_next) {
+ for (r = res->ai->ai_next; r; r = r->ai_next) {
char hbuf2[1024], pbuf2[1024];
sap = r->ai_addr;
- error = rb_getnameinfo(sap, SA_LEN(sap), hbuf2, sizeof(hbuf2),
+ salen = r->ai_addrlen;
+ error = rb_getnameinfo(sap, salen, hbuf2, sizeof(hbuf2),
pbuf2, sizeof(pbuf2), fl);
if (error) goto error_exit_name;
if (strcmp(hbuf, hbuf2) != 0|| strcmp(pbuf, pbuf2) != 0) {
- freeaddrinfo(res);
+ rb_freeaddrinfo(res);
rb_raise(rb_eSocket, "sockaddr resolved to multiple nodename");
}
}
- freeaddrinfo(res);
+ rb_freeaddrinfo(res);
}
return rb_assoc_new(rb_str_new2(hbuf), rb_str_new2(pbuf));
error_exit_addr:
- if (res) freeaddrinfo(res);
+ saved_errno = errno;
+ if (res) rb_freeaddrinfo(res);
+ errno = saved_errno;
rsock_raise_socket_error("getaddrinfo", error);
error_exit_name:
- if (res) freeaddrinfo(res);
+ saved_errno = errno;
+ if (res) rb_freeaddrinfo(res);
+ errno = saved_errno;
rsock_raise_socket_error("getnameinfo", error);
UNREACHABLE;
@@ -1353,10 +1496,10 @@ sock_s_getnameinfo(int argc, VALUE *argv)
static VALUE
sock_s_pack_sockaddr_in(VALUE self, VALUE port, VALUE host)
{
- struct addrinfo *res = rsock_addrinfo(host, port, 0, 0);
- VALUE addr = rb_str_new((char*)res->ai_addr, res->ai_addrlen);
+ struct rb_addrinfo *res = rsock_addrinfo(host, port, 0, 0);
+ VALUE addr = rb_str_new((char*)res->ai->ai_addr, res->ai->ai_addrlen);
- freeaddrinfo(res);
+ rb_freeaddrinfo(res);
OBJ_INFECT(addr, port);
OBJ_INFECT(addr, host);
@@ -1399,7 +1542,7 @@ sock_s_unpack_sockaddr_in(VALUE self, VALUE addr)
rb_raise(rb_eArgError, "not an AF_INET sockaddr");
#endif
}
- host = rsock_make_ipaddr((struct sockaddr*)sockaddr);
+ host = rsock_make_ipaddr((struct sockaddr*)sockaddr, RSTRING_SOCKLEN(addr));
OBJ_INFECT(host, addr);
return rb_assoc_new(INT2NUM(ntohs(sockaddr->sin_port)), host);
}
@@ -1423,8 +1566,7 @@ sock_s_pack_sockaddr_un(VALUE self, VALUE path)
VALUE addr;
StringValue(path);
- MEMZERO(&sockaddr, struct sockaddr_un, 1);
- sockaddr.sun_family = AF_UNIX;
+ INIT_SOCKADDR_UN(&sockaddr, sizeof(struct sockaddr_un));
if (sizeof(sockaddr.sun_path) < (size_t)RSTRING_LEN(path)) {
rb_raise(rb_eArgError, "too long unix socket path (%"PRIuSIZE" bytes given but %"PRIuSIZE" bytes max)",
(size_t)RSTRING_LEN(path), sizeof(sockaddr.sun_path));
@@ -1467,17 +1609,58 @@ sock_s_unpack_sockaddr_un(VALUE self, VALUE addr)
rb_raise(rb_eTypeError, "too long sockaddr_un - %ld longer than %d",
RSTRING_LEN(addr), (int)sizeof(struct sockaddr_un));
}
- path = rsock_unixpath_str(sockaddr, RSTRING_LENINT(addr));
+ path = rsock_unixpath_str(sockaddr, RSTRING_SOCKLEN(addr));
OBJ_INFECT(path, addr);
return path;
}
#endif
#if defined(HAVE_GETIFADDRS) || defined(SIOCGLIFCONF) || defined(SIOCGIFCONF) || defined(_WIN32)
+
+static socklen_t
+sockaddr_len(struct sockaddr *addr)
+{
+ if (addr == NULL)
+ return 0;
+
+#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
+ if (addr->sa_len != 0)
+ return addr->sa_len;
+#endif
+
+ switch (addr->sa_family) {
+ case AF_INET:
+ return (socklen_t)sizeof(struct sockaddr_in);
+
+#ifdef AF_INET6
+ case AF_INET6:
+ return (socklen_t)sizeof(struct sockaddr_in6);
+#endif
+
+#ifdef HAVE_SYS_UN_H
+ case AF_UNIX:
+ return (socklen_t)sizeof(struct sockaddr_un);
+#endif
+
+#ifdef AF_PACKET
+ case AF_PACKET:
+ return (socklen_t)(offsetof(struct sockaddr_ll, sll_addr) + ((struct sockaddr_ll *)addr)->sll_halen);
+#endif
+
+ default:
+ return (socklen_t)(offsetof(struct sockaddr, sa_family) + sizeof(addr->sa_family));
+ }
+}
+
+socklen_t
+rsock_sockaddr_len(struct sockaddr *addr)
+{
+ return sockaddr_len(addr);
+}
+
static VALUE
-sockaddr_obj(struct sockaddr *addr)
+sockaddr_obj(struct sockaddr *addr, socklen_t len)
{
- socklen_t len;
#if defined(AF_INET6) && defined(__KAME__)
struct sockaddr_in6 addr6;
#endif
@@ -1485,18 +1668,14 @@ sockaddr_obj(struct sockaddr *addr)
if (addr == NULL)
return Qnil;
- switch (addr->sa_family) {
- case AF_INET:
- len = (socklen_t)sizeof(struct sockaddr_in);
- break;
+ len = sockaddr_len(addr);
-#ifdef AF_INET6
- case AF_INET6:
- len = (socklen_t)sizeof(struct sockaddr_in6);
-# ifdef __KAME__
+#if defined(__KAME__) && defined(AF_INET6)
+ if (addr->sa_family == AF_INET6) {
/* KAME uses the 2nd 16bit word of link local IPv6 address as interface index internally */
/* http://orange.kame.net/dev/cvsweb.cgi/kame/IMPLEMENTATION */
/* convert fe80:1::1 to fe80::1%1 */
+ len = (socklen_t)sizeof(struct sockaddr_in6);
memcpy(&addr6, addr, len);
addr = (struct sockaddr *)&addr6;
if (IN6_IS_ADDR_LINKLOCAL(&addr6.sin6_addr) &&
@@ -1506,27 +1685,18 @@ sockaddr_obj(struct sockaddr *addr)
addr6.sin6_addr.s6_addr[2] = 0;
addr6.sin6_addr.s6_addr[3] = 0;
}
-# endif
- break;
-#endif
-
-#ifdef HAVE_SYS_UN_H
- case AF_UNIX:
- len = (socklen_t)sizeof(struct sockaddr_un);
- break;
-#endif
-
- default:
- len = (socklen_t)sizeof(struct sockaddr_in);
- break;
}
-#ifdef SA_LEN
- if (len < (socklen_t)SA_LEN(addr))
- len = (socklen_t)SA_LEN(addr);
#endif
return rsock_addrinfo_new(addr, len, addr->sa_family, 0, 0, Qnil, Qnil);
}
+
+VALUE
+rsock_sockaddr_obj(struct sockaddr *addr, socklen_t len)
+{
+ return sockaddr_obj(addr, len);
+}
+
#endif
#if defined(HAVE_GETIFADDRS) || (defined(SIOCGLIFCONF) && defined(SIOCGLIFNUM) && !defined(__hpux)) || defined(SIOCGIFCONF) || defined(_WIN32)
@@ -1562,7 +1732,28 @@ socket_s_ip_address_list(VALUE self)
list = rb_ary_new();
for (p = ifp; p; p = p->ifa_next) {
if (p->ifa_addr != NULL && IS_IP_FAMILY(p->ifa_addr->sa_family)) {
- rb_ary_push(list, sockaddr_obj(p->ifa_addr));
+ struct sockaddr *addr = p->ifa_addr;
+#if defined(AF_INET6) && defined(__sun)
+ /*
+ * OpenIndiana SunOS 5.11 getifaddrs() returns IPv6 link local
+ * address with sin6_scope_id == 0.
+ * So fill it from the interface name (ifa_name).
+ */
+ struct sockaddr_in6 addr6;
+ if (addr->sa_family == AF_INET6) {
+ socklen_t len = (socklen_t)sizeof(struct sockaddr_in6);
+ memcpy(&addr6, addr, len);
+ addr = (struct sockaddr *)&addr6;
+ if (IN6_IS_ADDR_LINKLOCAL(&addr6.sin6_addr) &&
+ addr6.sin6_scope_id == 0) {
+ unsigned int ifindex = if_nametoindex(p->ifa_name);
+ if (ifindex != 0) {
+ addr6.sin6_scope_id = ifindex;
+ }
+ }
+ }
+#endif
+ rb_ary_push(list, sockaddr_obj(addr, sockaddr_len(addr)));
}
}
@@ -1585,7 +1776,7 @@ socket_s_ip_address_list(VALUE self)
fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd == -1)
- rb_sys_fail("socket");
+ rb_sys_fail("socket(2)");
memset(&ln, 0, sizeof(ln));
ln.lifn_family = AF_UNSPEC;
@@ -1624,7 +1815,7 @@ socket_s_ip_address_list(VALUE self)
}
((struct sockaddr_in6 *)(&req->lifr_addr))->sin6_scope_id = req2.lifr_index;
}
- rb_ary_push(list, sockaddr_obj((struct sockaddr *)&req->lifr_addr));
+ rb_ary_push(list, sockaddr_obj((struct sockaddr *)&req->lifr_addr, req->lifr_addrlen));
}
}
@@ -1643,7 +1834,7 @@ socket_s_ip_address_list(VALUE self)
#elif defined(SIOCGIFCONF)
int fd = -1;
int ret;
-#define EXTRA_SPACE (sizeof(struct ifconf) + sizeof(struct sockaddr_storage))
+#define EXTRA_SPACE ((int)(sizeof(struct ifconf) + sizeof(union_sockaddr)))
char initbuf[4096+EXTRA_SPACE];
char *buf = initbuf;
int bufsize;
@@ -1655,7 +1846,7 @@ socket_s_ip_address_list(VALUE self)
fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd == -1)
- rb_sys_fail("socket");
+ rb_sys_fail("socket(2)");
bufsize = sizeof(initbuf);
buf = initbuf;
@@ -1696,9 +1887,9 @@ socket_s_ip_address_list(VALUE self)
while ((char*)req < (char*)conf.ifc_req + conf.ifc_len) {
struct sockaddr *addr = &req->ifr_addr;
if (IS_IP_FAMILY(addr->sa_family)) {
- rb_ary_push(list, sockaddr_obj(addr));
+ rb_ary_push(list, sockaddr_obj(addr, sockaddr_len(addr)));
}
-#ifdef HAVE_SA_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
# ifndef _SIZEOF_ADDR_IFREQ
# define _SIZEOF_ADDR_IFREQ(r) \
(sizeof(struct ifreq) + \
@@ -1813,7 +2004,7 @@ socket_s_ip_address_list(VALUE self)
#else
if (IS_IP_FAMILY(uni->Address.lpSockaddr->sa_family))
#endif
- rb_ary_push(list, sockaddr_obj(uni->Address.lpSockaddr));
+ rb_ary_push(list, sockaddr_obj(uni->Address.lpSockaddr, uni->Address.iSockaddrLength));
}
for (any = adapters->FirstAnycastAddress; any; any = any->Next) {
#ifndef INET6
@@ -1821,7 +2012,7 @@ socket_s_ip_address_list(VALUE self)
#else
if (IS_IP_FAMILY(any->Address.lpSockaddr->sa_family))
#endif
- rb_ary_push(list, sockaddr_obj(any->Address.lpSockaddr));
+ rb_ary_push(list, sockaddr_obj(any->Address.lpSockaddr, any->Address.iSockaddrLength));
}
}
@@ -1852,7 +2043,7 @@ Init_socket()
*
* === What's a socket?
*
- * Sockets are endpoints of a bidirectionnal communication channel.
+ * Sockets are endpoints of a bidirectional 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.
@@ -1877,7 +2068,7 @@ Init_socket()
*
* *hostname:*
* The identifier of a network interface:
- * * a string (hostname, IPv4 or IPv6 adress or +broadcast+
+ * * a string (hostname, IPv4 or IPv6 address 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).
diff --git a/ext/socket/sockport.h b/ext/socket/sockport.h
index 5f2fd24530..2b58958ae7 100644
--- a/ext/socket/sockport.h
+++ b/ext/socket/sockport.h
@@ -10,42 +10,74 @@
#ifndef SOCKPORT_H
#define SOCKPORT_H
-#ifdef SA_LEN
-# define SS_LEN(ss) (ss)->ss_len
+#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
+# define VALIDATE_SOCKLEN(addr, len) ((addr)->sa_len == (len))
#else
-# ifdef HAVE_SA_LEN
-# define SA_LEN(sa) (sa)->sa_len
-# define SS_LEN(ss) (ss)->ss_len
-# else
-# ifdef AF_INET6
-# define SA_LEN(sa) \
- (((sa)->sa_family == AF_INET6) ? sizeof(struct sockaddr_in6) \
- : sizeof(struct sockaddr))
-# define SS_LEN(ss) \
- (((ss)->ss_family == AF_INET6) ? sizeof(struct sockaddr_in6) \
- : sizeof(struct sockaddr))
-# else
- /* by tradition, sizeof(struct sockaddr) covers most of the sockaddrs */
-# define SA_LEN(sa) (sizeof(struct sockaddr))
-# define SS_LEN(ss) (sizeof(struct sockaddr))
-# endif
-# endif
+# define VALIDATE_SOCKLEN(addr, len) ((void)(addr), (void)(len), 1)
#endif
-#ifdef HAVE_SA_LEN
+#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
# define SET_SA_LEN(sa, len) (void)((sa)->sa_len = (len))
-# define SET_SS_LEN(ss, len) (void)((ss)->ss_len = (len))
#else
# define SET_SA_LEN(sa, len) (void)(len)
-# define SET_SS_LEN(ss, len) (void)(len)
#endif
-#ifdef HAVE_SIN_LEN
-# define SIN_LEN(si) (si)->sin_len
-# define SET_SIN_LEN(si,len) (si)->sin_len = (len)
+/* for strict-aliasing rule */
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
+# define SET_SIN_LEN(sa, len) (void)((sa)->sin_len = (len))
+#else
+# 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 SIN_LEN(si) sizeof(struct sockaddr_in)
-# define SET_SIN_LEN(si,len)
+# 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); \
+ socklen_t init_sockaddr_len = (len); \
+ memset(init_sockaddr_ptr, 0, init_sockaddr_len); \
+ init_sockaddr_ptr->sa_family = (family); \
+ SET_SA_LEN(init_sockaddr_ptr, init_sockaddr_len); \
+ } while (0)
+
+#define INIT_SOCKADDR_IN(addr, len) \
+ do { \
+ struct sockaddr_in *init_sockaddr_ptr = (addr); \
+ socklen_t init_sockaddr_len = (len); \
+ memset(init_sockaddr_ptr, 0, init_sockaddr_len); \
+ init_sockaddr_ptr->sin_family = AF_INET; \
+ 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
+# ifdef HAVE_STRUCT_SOCKADDR_IN_SUN_LEN
+# define SET_SUN_LEN(sa, len) (void)((sa)->sun_len = (len))
+# else
+# define SET_SUN_LEN(sa, len) SET_SA_LEN((struct sockaddr *)(sa), (len))
+# endif
+# define INIT_SOCKADDR_UN(addr, len) \
+ do { \
+ struct sockaddr_un *init_sockaddr_ptr = (addr); \
+ socklen_t init_sockaddr_len = (len); \
+ memset(init_sockaddr_ptr, 0, init_sockaddr_len); \
+ init_sockaddr_ptr->sun_family = AF_UNIX; \
+ SET_SUN_LEN(init_sockaddr_ptr, init_sockaddr_len); \
+ } while (0)
#endif
#ifndef IN_MULTICAST
diff --git a/ext/socket/tcpserver.c b/ext/socket/tcpserver.c
index 6596733239..2245a0600d 100644
--- a/ext/socket/tcpserver.c
+++ b/ext/socket/tcpserver.c
@@ -12,7 +12,7 @@
/*
* call-seq:
- * TCPServer.new([hostname,] port) => tcpserver
+ * TCPServer.new([hostname,] port) => tcpserver
*
* Creates a new server socket bound to _port_.
*
@@ -22,6 +22,13 @@
* s = serv.accept
* s.puts Time.now
* s.close
+ *
+ * Internally, TCPServer.new calls getaddrinfo() function to
+ * obtain addresses.
+ * If getaddrinfo() returns multiple addresses,
+ * TCPServer.new tries to create a server socket for each address
+ * and returns first one that is successful.
+ *
*/
static VALUE
tcp_svr_init(int argc, VALUE *argv, VALUE sock)
@@ -36,6 +43,8 @@ tcp_svr_init(int argc, VALUE *argv, VALUE sock)
* call-seq:
* tcpserver.accept => tcpsocket
*
+ * Accepts an incoming connection. It returns a new TCPSocket object.
+ *
* TCPServer.open("127.0.0.1", 14641) {|serv|
* s = serv.accept
* s.puts Time.now
@@ -47,18 +56,17 @@ static VALUE
tcp_accept(VALUE sock)
{
rb_io_t *fptr;
- struct sockaddr_storage from;
+ union_sockaddr from;
socklen_t fromlen;
GetOpenFile(sock, fptr);
fromlen = (socklen_t)sizeof(from);
- return rsock_s_accept(rb_cTCPSocket, fptr->fd,
- (struct sockaddr*)&from, &fromlen);
+ return rsock_s_accept(rb_cTCPSocket, fptr->fd, &from.addr, &fromlen);
}
/*
* call-seq:
- * tcpserver.accept_nonblock => tcpsocket
+ * tcpserver.accept_nonblock => tcpsocket
*
* Accepts an incoming connection using accept(2) after
* O_NONBLOCK is set for the underlying file descriptor.
@@ -93,13 +101,12 @@ static VALUE
tcp_accept_nonblock(VALUE sock)
{
rb_io_t *fptr;
- struct sockaddr_storage from;
+ union_sockaddr from;
socklen_t fromlen;
GetOpenFile(sock, fptr);
fromlen = (socklen_t)sizeof(from);
- return rsock_s_accept_nonblock(rb_cTCPSocket, fptr,
- (struct sockaddr *)&from, &fromlen);
+ return rsock_s_accept_nonblock(rb_cTCPSocket, fptr, &from.addr, &fromlen);
}
/*
@@ -120,12 +127,12 @@ static VALUE
tcp_sysaccept(VALUE sock)
{
rb_io_t *fptr;
- struct sockaddr_storage from;
+ union_sockaddr from;
socklen_t fromlen;
GetOpenFile(sock, fptr);
fromlen = (socklen_t)sizeof(from);
- return rsock_s_accept(0, fptr->fd, (struct sockaddr*)&from, &fromlen);
+ return rsock_s_accept(0, fptr->fd, &from.addr, &fromlen);
}
void
diff --git a/ext/socket/tcpsocket.c b/ext/socket/tcpsocket.c
index 7eb6fc7aa2..6217e424d9 100644
--- a/ext/socket/tcpsocket.c
+++ b/ext/socket/tcpsocket.c
@@ -32,9 +32,9 @@ tcp_init(int argc, VALUE *argv, VALUE sock)
}
static VALUE
-tcp_sockaddr(struct sockaddr *addr, size_t len)
+tcp_sockaddr(struct sockaddr *addr, socklen_t len)
{
- return rsock_make_ipaddr(addr);
+ return rsock_make_ipaddr(addr, len);
}
/*
diff --git a/ext/socket/udpsocket.c b/ext/socket/udpsocket.c
index 0ba4371f1a..eb605cafc1 100644
--- a/ext/socket/udpsocket.c
+++ b/ext/socket/udpsocket.c
@@ -44,7 +44,7 @@ udp_init(int argc, VALUE *argv, VALUE sock)
struct udp_arg
{
- struct addrinfo *res;
+ struct rb_addrinfo *res;
int fd;
};
@@ -54,7 +54,7 @@ udp_connect_internal(struct udp_arg *arg)
int fd = arg->fd;
struct addrinfo *res;
- for (res = arg->res; res; res = res->ai_next) {
+ for (res = arg->res->ai; res; res = res->ai_next) {
if (rsock_connect(fd, res->ai_addr, res->ai_addrlen, 0) >= 0) {
return Qtrue;
}
@@ -62,8 +62,6 @@ udp_connect_internal(struct udp_arg *arg)
return Qfalse;
}
-VALUE rsock_freeaddrinfo(struct addrinfo *addr);
-
/*
* call-seq:
* udpsocket.connect(host, port) => 0
@@ -93,7 +91,7 @@ udp_connect(VALUE sock, VALUE host, VALUE port)
arg.fd = fptr->fd;
ret = rb_ensure(udp_connect_internal, (VALUE)&arg,
rsock_freeaddrinfo, (VALUE)arg.res);
- if (!ret) rb_sys_fail("connect(2)");
+ if (!ret) rsock_sys_fail_host_port("connect(2)", host, port);
return INT2FIX(0);
}
@@ -113,20 +111,23 @@ static VALUE
udp_bind(VALUE sock, VALUE host, VALUE port)
{
rb_io_t *fptr;
- struct addrinfo *res0, *res;
+ struct rb_addrinfo *res0;
+ struct addrinfo *res;
rb_secure(3);
res0 = rsock_addrinfo(host, port, SOCK_DGRAM, 0);
GetOpenFile(sock, fptr);
- for (res = res0; res; res = res->ai_next) {
+ for (res = res0->ai; res; res = res->ai_next) {
if (bind(fptr->fd, res->ai_addr, res->ai_addrlen) < 0) {
continue;
}
- freeaddrinfo(res0);
+ rb_freeaddrinfo(res0);
return INT2FIX(0);
}
- freeaddrinfo(res0);
- rb_sys_fail("bind(2)");
+ rb_freeaddrinfo(res0);
+
+ rsock_sys_fail_host_port("bind(2)", host, port);
+
return INT2FIX(0);
}
@@ -158,13 +159,13 @@ udp_send(int argc, VALUE *argv, VALUE sock)
VALUE flags, host, port;
rb_io_t *fptr;
int n;
- struct addrinfo *res0, *res;
+ struct rb_addrinfo *res0;
+ struct addrinfo *res;
struct rsock_send_arg arg;
if (argc == 2 || argc == 3) {
return rsock_bsock_send(argc, argv, sock);
}
- rb_secure(4);
rb_scan_args(argc, argv, "4", &arg.mesg, &flags, &host, &port);
StringValue(arg.mesg);
@@ -172,29 +173,29 @@ udp_send(int argc, VALUE *argv, VALUE sock)
GetOpenFile(sock, fptr);
arg.fd = fptr->fd;
arg.flags = NUM2INT(flags);
- for (res = res0; res; res = res->ai_next) {
+ for (res = res0->ai; res; res = res->ai_next) {
retry:
arg.to = res->ai_addr;
arg.tolen = res->ai_addrlen;
- rb_thread_fd_writable(arg.fd);
+ rsock_maybe_fd_writable(arg.fd);
n = (int)BLOCKING_REGION_FD(rsock_sendto_blocking, &arg);
if (n >= 0) {
- freeaddrinfo(res0);
+ rb_freeaddrinfo(res0);
return INT2FIX(n);
}
if (rb_io_wait_writable(fptr->fd)) {
goto retry;
}
}
- freeaddrinfo(res0);
- rb_sys_fail("sendto(2)");
+ rb_freeaddrinfo(res0);
+ rsock_sys_fail_host_port("sendto(2)", host, port);
return INT2FIX(n);
}
/*
* call-seq:
- * udpsocket.recvfrom_nonblock(maxlen) => [mesg, sender_inet_addr]
- * udpsocket.recvfrom_nonblock(maxlen, flags) => [mesg, sender_inet_addr]
+ * 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.
diff --git a/ext/socket/unixserver.c b/ext/socket/unixserver.c
index 9bd959d439..df9849703b 100644
--- a/ext/socket/unixserver.c
+++ b/ext/socket/unixserver.c
@@ -31,8 +31,8 @@ unix_svr_init(VALUE sock, VALUE path)
* call-seq:
* unixserver.accept => unixsocket
*
- * Accepts a new connection.
- * It returns new UNIXSocket object.
+ * Accepts an incoming connection.
+ * It returns a new UNIXSocket object.
*
* UNIXServer.open("/tmp/sock") {|serv|
* UNIXSocket.open("/tmp/sock") {|c|
@@ -59,7 +59,7 @@ unix_accept(VALUE sock)
/*
* call-seq:
- * unixserver.accept_nonblock => unixsocket
+ * unixserver.accept_nonblock => unixsocket
*
* Accepts an incoming connection using accept(2) after
* O_NONBLOCK is set for the underlying file descriptor.
diff --git a/ext/socket/unixsocket.c b/ext/socket/unixsocket.c
index 75da9c1a78..0a1b65a5b9 100644
--- a/ext/socket/unixsocket.c
+++ b/ext/socket/unixsocket.c
@@ -34,13 +34,8 @@ 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) {
- rb_sys_fail("socket(2)");
- }
- MEMZERO(&sockaddr, struct sockaddr_un, 1);
- sockaddr.sun_family = AF_UNIX;
+ INIT_SOCKADDR_UN(&sockaddr, sizeof(struct sockaddr_un));
if (sizeof(sockaddr.sun_path) < (size_t)RSTRING_LEN(path)) {
rb_raise(rb_eArgError, "too long unix socket path (%ldbytes given but %dbytes max)",
RSTRING_LEN(path), (int)sizeof(sockaddr.sun_path));
@@ -48,6 +43,11 @@ 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);
}
@@ -66,13 +66,13 @@ rsock_init_unixsock(VALUE sock, VALUE path, int server)
if (status < 0) {
close(fd);
- rb_sys_fail_str(rb_inspect(path));
+ rsock_sys_fail_path("connect(2)", path);
}
if (server) {
if (listen(fd, SOMAXCONN) < 0) {
close(fd);
- rb_sys_fail("listen(2)");
+ rsock_sys_fail_path("listen(2)", path);
}
}
@@ -122,7 +122,7 @@ unix_path(VALUE sock)
socklen_t len = (socklen_t)sizeof(addr);
socklen_t len0 = len;
if (getsockname(fptr->fd, (struct sockaddr*)&addr, &len) < 0)
- rb_sys_fail(0);
+ rsock_sys_fail_path("getsockname(2)", fptr->pathv);
if (len0 < len) len = len0;
fptr->pathv = rb_obj_freeze(rsock_unixpath_str(&addr, len));
}
@@ -158,13 +158,13 @@ unix_recvfrom(int argc, VALUE *argv, VALUE sock)
return rsock_s_recvfrom(sock, argc, argv, RECV_UNIX);
}
-#if defined(HAVE_ST_MSG_CONTROL) && defined(SCM_RIGHTS)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL) && defined(SCM_RIGHTS)
#define FD_PASSING_BY_MSG_CONTROL 1
#else
#define FD_PASSING_BY_MSG_CONTROL 0
#endif
-#if defined(HAVE_ST_MSG_ACCRIGHTS)
+#if defined(HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS)
#define FD_PASSING_BY_MSG_ACCRIGHTS 1
#else
#define FD_PASSING_BY_MSG_ACCRIGHTS 0
@@ -209,9 +209,9 @@ unix_send_io(VALUE sock, VALUE val)
char buf[1];
#if FD_PASSING_BY_MSG_CONTROL
- struct {
+ union {
struct cmsghdr hdr;
- char pad[8+sizeof(int)+8];
+ char pad[sizeof(struct cmsghdr)+8+sizeof(int)+8];
} cmsg;
#endif
@@ -256,7 +256,7 @@ unix_send_io(VALUE sock, VALUE val)
arg.fd = fptr->fd;
while ((int)BLOCKING_REGION_FD(sendmsg_blocking, &arg) == -1) {
if (!rb_io_wait_writable(arg.fd))
- rb_sys_fail("sendmsg(2)");
+ rsock_sys_fail_path("sendmsg(2)", fptr->pathv);
}
return Qnil;
@@ -304,9 +304,9 @@ unix_recv_io(int argc, VALUE *argv, VALUE sock)
int fd;
#if FD_PASSING_BY_MSG_CONTROL
- struct {
+ union {
struct cmsghdr hdr;
- char pad[8+sizeof(int)+8];
+ char pad[sizeof(struct cmsghdr)+8+sizeof(int)+8];
} cmsg;
#endif
@@ -344,7 +344,7 @@ unix_recv_io(int argc, VALUE *argv, VALUE sock)
arg.fd = fptr->fd;
while ((int)BLOCKING_REGION_FD(recvmsg_blocking, &arg) == -1) {
if (!rb_io_wait_readable(arg.fd))
- rb_sys_fail("recvmsg(2)");
+ rsock_sys_fail_path("recvmsg(2)", fptr->pathv);
}
#if FD_PASSING_BY_MSG_CONTROL
@@ -382,7 +382,7 @@ unix_recv_io(int argc, VALUE *argv, VALUE sock)
#else
if (arg.msg.msg_accrightslen != sizeof(fd)) {
rb_raise(rb_eSocket,
- "file descriptor was not passed (accrightslen) : %d != %d",
+ "file descriptor was not passed (accrightslen=%d, %d expected)",
arg.msg.msg_accrightslen, (int)sizeof(fd));
}
#endif
@@ -390,7 +390,13 @@ 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_fd_fix_cloexec(fd);
+
+ 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);
if (klass == Qnil)
return INT2FIX(fd);
@@ -431,7 +437,7 @@ unix_addr(VALUE sock)
GetOpenFile(sock, fptr);
if (getsockname(fptr->fd, (struct sockaddr*)&addr, &len) < 0)
- rb_sys_fail("getsockname(2)");
+ rsock_sys_fail_path("getsockname(2)", fptr->pathv);
if (len0 < len) len = len0;
return rsock_unixaddr(&addr, len);
}
@@ -459,7 +465,7 @@ unix_peeraddr(VALUE sock)
GetOpenFile(sock, fptr);
if (getpeername(fptr->fd, (struct sockaddr*)&addr, &len) < 0)
- rb_sys_fail("getpeername(2)");
+ rsock_sys_fail_path("getpeername(2)", fptr->pathv);
if (len0 < len) len = len0;
return rsock_unixaddr(&addr, len);
}
diff --git a/ext/stringio/depend b/ext/stringio/depend
index e3f3409ed7..db356dd6e0 100644
--- a/ext/stringio/depend
+++ b/ext/stringio/depend
@@ -1,3 +1,4 @@
-stringio.o: stringio.c $(hdrdir)/ruby/ruby.h $(arch_hdrdir)/ruby/config.h \
- $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/io.h \
- $(hdrdir)/ruby/encoding.h
+stringio.o: stringio.c $(HDRS) $(ruby_headers) \
+ $(hdrdir)/ruby/io.h \
+ $(hdrdir)/ruby/encoding.h \
+ $(hdrdir)/ruby/oniguruma.h
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c
index 26872e0978..2964adab40 100644
--- a/ext/stringio/stringio.c
+++ b/ext/stringio/stringio.c
@@ -78,6 +78,7 @@ static const rb_data_type_t strio_data_type = {
strio_free,
strio_memsize,
},
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
#define check_strio(self) ((struct StringIO*)rb_check_typeddata((self), &strio_data_type))
@@ -102,6 +103,7 @@ strio_substr(struct StringIO *ptr, long pos, long len)
if (len > rlen) len = rlen;
if (len < 0) len = 0;
+ if (len == 0) return rb_str_new(0,0);
return rb_enc_str_new(RSTRING_PTR(str)+pos, len, enc);
}
@@ -118,6 +120,8 @@ typedef char strio_flags_check[(STRIO_READABLE/FMODE_READABLE == STRIO_WRITABLE/
#define READABLE(strio) STRIO_MODE_SET_P(strio, READABLE)
#define WRITABLE(strio) STRIO_MODE_SET_P(strio, WRITABLE)
+static VALUE sym_exception;
+
static struct StringIO*
readable(VALUE strio)
{
@@ -136,7 +140,6 @@ writable(VALUE strio)
rb_raise(rb_eIOError, "not opened for writing");
}
if (!OBJ_TAINTED(ptr->string)) {
- rb_secure(4);
}
return ptr;
}
@@ -494,16 +497,12 @@ strio_set_lineno(VALUE self, VALUE lineno)
return lineno;
}
-/* call-seq: strio.binmode -> true */
#define strio_binmode strio_self
-/* call-seq: strio.fcntl */
#define strio_fcntl strio_unimpl
-/* call-seq: strio.flush -> strio */
#define strio_flush strio_self
-/* call-seq: strio.fsync -> 0 */
#define strio_fsync strio_0
/*
@@ -623,7 +622,6 @@ strio_get_sync(VALUE self)
return Qtrue;
}
-/* call-seq: strio.sync = boolean -> boolean */
#define strio_set_sync strio_first
#define strio_tell strio_get_pos
@@ -650,7 +648,7 @@ strio_each_byte(VALUE self)
}
/*
- * This is a deprecated alias for <code>each_byte</code>.
+ * This is a deprecated alias for #each_byte.
*/
static VALUE
strio_bytes(VALUE self)
@@ -1172,7 +1170,6 @@ strio_write(VALUE self, VALUE str)
long len, olen;
rb_encoding *enc, *enc2;
- RB_GC_GUARD(str);
if (!RB_TYPE_P(str, T_STRING))
str = rb_obj_as_string(str);
enc = rb_enc_get(ptr->string);
@@ -1188,7 +1185,13 @@ strio_write(VALUE self, VALUE str)
ptr->pos = olen;
}
if (ptr->pos == olen) {
- rb_str_cat(ptr->string, RSTRING_PTR(str), len);
+ if (enc2 == rb_ascii8bit_encoding()) {
+ 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);
+ }
}
else {
strio_extend(ptr, ptr->pos, len);
@@ -1196,6 +1199,7 @@ 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);
}
@@ -1235,17 +1239,17 @@ static VALUE
strio_putc(VALUE self, VALUE ch)
{
struct StringIO *ptr = writable(self);
- int c = NUM2CHR(ch);
- long olen;
+ VALUE str;
check_modifiable(ptr);
- olen = RSTRING_LEN(ptr->string);
- if (ptr->flags & FMODE_APPEND) {
- ptr->pos = olen;
+ if (RB_TYPE_P(ch, T_STRING)) {
+ str = rb_str_substr(ch, 0, 1);
}
- strio_extend(ptr, ptr->pos, 1);
- RSTRING_PTR(ptr->string)[ptr->pos++] = c;
- OBJ_INFECT(ptr->string, self);
+ else {
+ char c = NUM2CHR(ch);
+ str = rb_str_new(&c, 1);
+ }
+ strio_write(self, str);
return ch;
}
@@ -1331,6 +1335,7 @@ strio_read(int argc, VALUE *argv, VALUE self)
/*
* call-seq:
* strio.sysread(integer[, outbuf]) -> string
+ * strio.readpartial(integer[, outbuf]) -> string
*
* Similar to #read, but raises +EOFError+ at end of string instead of
* returning +nil+, as well as IO#sysread does.
@@ -1345,24 +1350,59 @@ strio_sysread(int argc, VALUE *argv, VALUE self)
return val;
}
-#define strio_syswrite rb_io_write
-
/*
* call-seq:
- * strio.isatty -> nil
- * strio.tty? -> nil
+ * strio.read_nonblock(integer[, outbuf [, opts]]) -> string
*
+ * Similar to #read, but raises +EOFError+ at end of string unless the
+ * +exception: false+ option is passed in.
*/
+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 (no_exception)
+ return Qnil;
+ else
+ rb_eof_error();
+ }
+
+ return val;
+}
+
+#define strio_syswrite rb_io_write
+
+static VALUE
+strio_syswrite_nonblock(int argc, VALUE *argv, VALUE self)
+{
+ VALUE str;
+
+ rb_scan_args(argc, argv, "10:", &str, NULL);
+ return strio_syswrite(self, str);
+}
+
#define strio_isatty strio_false
-/* call-seq: strio.pid -> nil */
#define strio_pid strio_nil
-/* call-seq: strio.fileno -> nil */
#define strio_fileno strio_nil
/*
* call-seq:
+ * strio.length -> integer
* strio.size -> integer
*
* Returns the size of the buffer string.
@@ -1459,6 +1499,16 @@ strio_set_encoding(int argc, VALUE *argv, VALUE 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"
*/
void
Init_stringio()
@@ -1477,6 +1527,8 @@ Init_stringio()
rb_define_method(StringIO, "lineno", strio_get_lineno, 0);
rb_define_method(StringIO, "lineno=", strio_set_lineno, 1);
+
+ /* call-seq: strio.binmode -> true */
rb_define_method(StringIO, "binmode", strio_binmode, 0);
rb_define_method(StringIO, "close", strio_close, 0);
rb_define_method(StringIO, "close_read", strio_close_read, 0);
@@ -1486,14 +1538,18 @@ Init_stringio()
rb_define_method(StringIO, "closed_write?", strio_closed_write, 0);
rb_define_method(StringIO, "eof", strio_eof, 0);
rb_define_method(StringIO, "eof?", strio_eof, 0);
+ /* call-seq: strio.fcntl */
rb_define_method(StringIO, "fcntl", strio_fcntl, -1);
+ /* call-seq: strio.flush -> strio */
rb_define_method(StringIO, "flush", strio_flush, 0);
+ /* call-seq: strio.fsync -> 0 */
rb_define_method(StringIO, "fsync", strio_fsync, 0);
rb_define_method(StringIO, "pos", strio_get_pos, 0);
rb_define_method(StringIO, "pos=", strio_set_pos, 1);
rb_define_method(StringIO, "rewind", strio_rewind, 0);
rb_define_method(StringIO, "seek", strio_seek, -1);
rb_define_method(StringIO, "sync", strio_get_sync, 0);
+ /* call-seq: strio.sync = boolean -> boolean */
rb_define_method(StringIO, "sync=", strio_set_sync, 1);
rb_define_method(StringIO, "tell", strio_tell, 0);
@@ -1517,9 +1573,19 @@ Init_stringio()
rb_define_method(StringIO, "write", strio_write, 1);
rb_define_method(StringIO, "putc", strio_putc, 1);
+ /*
+ * call-seq:
+ * strio.isatty -> nil
+ * strio.tty? -> nil
+ *
+ */
rb_define_method(StringIO, "isatty", strio_isatty, 0);
rb_define_method(StringIO, "tty?", strio_isatty, 0);
+
+ /* call-seq: strio.pid -> nil */
rb_define_method(StringIO, "pid", strio_pid, 0);
+
+ /* call-seq: strio.fileno -> nil */
rb_define_method(StringIO, "fileno", strio_fileno, 0);
rb_define_method(StringIO, "size", strio_size, 0);
rb_define_method(StringIO, "length", strio_size, 0);
@@ -1530,23 +1596,25 @@ Init_stringio()
rb_define_method(StringIO, "set_encoding", strio_set_encoding, -1);
{
- VALUE mReadable = rb_define_module_under(rb_cIO, "readable");
+ VALUE mReadable = rb_define_module_under(rb_cIO, "generic_readable");
rb_define_method(mReadable, "readchar", strio_readchar, 0);
rb_define_method(mReadable, "readbyte", strio_readbyte, 0);
rb_define_method(mReadable, "readline", strio_readline, -1);
rb_define_method(mReadable, "sysread", strio_sysread, -1);
rb_define_method(mReadable, "readpartial", strio_sysread, -1);
- rb_define_method(mReadable, "read_nonblock", strio_sysread, -1);
+ rb_define_method(mReadable, "read_nonblock", strio_read_nonblock, -1);
rb_include_module(StringIO, mReadable);
}
{
- VALUE mWritable = rb_define_module_under(rb_cIO, "writable");
+ VALUE mWritable = rb_define_module_under(rb_cIO, "generic_writable");
rb_define_method(mWritable, "<<", strio_addstr, 1);
rb_define_method(mWritable, "print", strio_print, -1);
rb_define_method(mWritable, "printf", strio_printf, -1);
rb_define_method(mWritable, "puts", strio_puts, -1);
rb_define_method(mWritable, "syswrite", strio_syswrite, 1);
- rb_define_method(mWritable, "write_nonblock", strio_syswrite, 1);
+ rb_define_method(mWritable, "write_nonblock", strio_syswrite_nonblock, -1);
rb_include_module(StringIO, mWritable);
}
+
+ sym_exception = ID2SYM(rb_intern("exception"));
}
diff --git a/ext/strscan/depend b/ext/strscan/depend
index 76f6e0b18b..689510ec66 100644
--- a/ext/strscan/depend
+++ b/ext/strscan/depend
@@ -1,2 +1,7 @@
-strscan.o: strscan.c $(hdrdir)/ruby.h $(hdrdir)/re.h $(hdrdir)/regex.h \
- $(hdrdir)/oniguruma.h $(topdir)/config.h $(hdrdir)/defines.h
+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/strscan.c b/ext/strscan/strscan.c
index b81e1f1833..7f93324dee 100644
--- a/ext/strscan/strscan.c
+++ b/ext/strscan/strscan.c
@@ -38,6 +38,9 @@ struct strscanner
/* the regexp register; legal only when MATCHED_P(s) */
struct re_registers regs;
+
+ /* regexp used for last scan */
+ VALUE regex;
};
#define MATCHED_P(s) ((s)->flags & FLAG_MATCHED)
@@ -187,7 +190,8 @@ strscan_memsize(const void *ptr)
static const rb_data_type_t strscanner_type = {
"StringScanner",
- {strscan_mark, strscan_free, strscan_memsize}
+ {strscan_mark, strscan_free, strscan_memsize},
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
static VALUE
@@ -195,8 +199,7 @@ strscan_s_allocate(VALUE klass)
{
struct strscanner *p;
- p = ALLOC(struct strscanner);
- MEMZERO(p, struct strscanner, 1);
+ p = ZALLOC(struct strscanner);
CLEAR_MATCH_STATUS(p);
onig_region_init(&(p->regs));
p->str = Qnil;
@@ -456,6 +459,8 @@ strscan_do_scan(VALUE self, VALUE regex, int succptr, int getstr, int headonly)
if (S_RESTLEN(p) < 0) {
return Qnil;
}
+
+ p->regex = regex;
re = rb_reg_prepare_re(regex, p->str);
tmpreg = re != RREGEXP(regex)->ptr;
if (!tmpreg) RREGEXP(regex)->usecnt++;
@@ -970,6 +975,24 @@ strscan_matched_size(VALUE self)
return INT2NUM(p->regs.end[0] - p->regs.beg[0]);
}
+static int
+name_to_backref_number(struct re_registers *regs, VALUE regexp, const char* name, const char* name_end, rb_encoding *enc)
+{
+ 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 {
+ rb_enc_raise(enc, rb_eIndexError, "undefined group name reference: %.*s",
+ rb_long2int(name_end - name), name);
+ }
+
+ UNREACHABLE;
+}
+
/*
* call-seq: [](n)
*
@@ -983,17 +1006,41 @@ strscan_matched_size(VALUE self)
* s[3] # -> "12"
* s.post_match # -> "1975 14:39"
* s.pre_match # -> ""
+ *
+ * s.reset
+ * s.scan(/(?<wday>\w+) (?<month>\w+) (?<day>\d+) /) # -> "Fri Dec 12 "
+ * s[0] # -> "Fri Dec 12 "
+ * s[1] # -> "Fri"
+ * s[2] # -> "Dec"
+ * s[3] # -> "12"
+ * s[:wday] # -> "Fri"
+ * s[:month] # -> "Dec"
+ * s[:day] # -> "12"
+ * s.post_match # -> "1975 14:39"
+ * s.pre_match # -> ""
*/
static VALUE
strscan_aref(VALUE self, VALUE idx)
{
+ const char *name;
struct strscanner *p;
long i;
GET_SCANNER(self, p);
if (! MATCHED_P(p)) return Qnil;
- i = NUM2LONG(idx);
+ switch (TYPE(idx)) {
+ case T_SYMBOL:
+ idx = rb_sym2str(idx);
+ /* fall through */
+ case T_STRING:
+ RSTRING_GETMEM(idx, name, i);
+ i = name_to_backref_number(&(p->regs), p->regex, name, name + i, rb_enc_get(idx));
+ break;
+ default:
+ i = NUM2LONG(idx);
+ }
+
if (i < 0)
i += p->regs.num_regs;
if (i < 0) return Qnil;
@@ -1087,7 +1134,6 @@ strscan_restsize(VALUE self)
}
#define INSPECT_LENGTH 5
-#define BUFSIZE 256
/*
* Returns a string that represents the StringScanner object, showing:
@@ -1104,76 +1150,69 @@ 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)) {
- len = snprintf(buf, BUFSIZE, "#<%s (uninitialized)>",
- rb_class2name(CLASS_OF(self)));
- return infect(rb_str_new(buf, len), p);
+ a = rb_sprintf("#<%"PRIsVALUE" (uninitialized)>", rb_obj_class(self));
+ return infect(a, p);
}
if (EOS_P(p)) {
- len = snprintf(buf, BUFSIZE, "#<%s fin>",
- rb_class2name(CLASS_OF(self)));
- return infect(rb_str_new(buf, len), p);
+ a = rb_sprintf("#<%"PRIsVALUE" fin>", rb_obj_class(self));
+ return infect(a, p);
}
if (p->curr == 0) {
- 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);
+ b = inspect2(p);
+ a = rb_sprintf("#<%"PRIsVALUE" %ld/%ld @ %"PRIsVALUE">",
+ rb_obj_class(self),
+ p->curr, S_LEN(p),
+ b);
+ return infect(a, p);
}
a = inspect1(p);
b = inspect2(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);
+ a = rb_sprintf("#<%"PRIsVALUE" %ld/%ld %"PRIsVALUE" @ %"PRIsVALUE">",
+ rb_obj_class(self),
+ p->curr, S_LEN(p),
+ a, b);
+ return infect(a, p);
}
static VALUE
inspect1(struct strscanner *p)
{
- char buf[BUFSIZE];
- char *bp = buf;
+ VALUE str;
long len;
if (p->curr == 0) return rb_str_new2("");
if (p->curr > INSPECT_LENGTH) {
- strcpy(bp, "..."); bp += 3;
- len = INSPECT_LENGTH;
+ str = rb_str_new_cstr("...");
+ len = INSPECT_LENGTH;
}
else {
- len = p->curr;
+ str = rb_str_new(0, 0);
+ len = p->curr;
}
- memcpy(bp, CURPTR(p) - len, len); bp += len;
- return rb_str_dump(rb_str_new(buf, bp - buf));
+ rb_str_cat(str, CURPTR(p) - len, len);
+ return rb_str_dump(str);
}
static VALUE
inspect2(struct strscanner *p)
{
- char buf[BUFSIZE];
- char *bp = buf;
+ VALUE str;
long len;
if (EOS_P(p)) return rb_str_new2("");
len = S_LEN(p) - p->curr;
if (len > INSPECT_LENGTH) {
- len = INSPECT_LENGTH;
- memcpy(bp, CURPTR(p), len); bp += len;
- strcpy(bp, "..."); bp += 3;
+ str = rb_str_new(CURPTR(p), INSPECT_LENGTH);
+ rb_str_cat2(str, "...");
}
else {
- memcpy(bp, CURPTR(p), len); bp += len;
+ str = rb_str_new(CURPTR(p), len);
}
- return rb_str_dump(rb_str_new(buf, bp - buf));
+ return rb_str_dump(str);
}
/* =======================================================================
diff --git a/ext/syslog/depend b/ext/syslog/depend
index 45cbea293a..0e2d76fbf6 100644
--- a/ext/syslog/depend
+++ b/ext/syslog/depend
@@ -1,2 +1,2 @@
-syslog.o: syslog.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h \
- $(hdrdir)/intern.h
+syslog.o: syslog.c $(HDRS) $(ruby_headers) \
+ $(hdrdir)/util.h
diff --git a/ext/syslog/lib/syslog/logger.rb b/ext/syslog/lib/syslog/logger.rb
index a8d089a094..086f83c591 100644
--- a/ext/syslog/lib/syslog/logger.rb
+++ b/ext/syslog/lib/syslog/logger.rb
@@ -24,6 +24,14 @@ require 'logger'
# log = Syslog::Logger.new 'my_program'
# log.info 'this line will be logged via syslog(3)'
#
+# Also the facility may be set to specify the facility level which will be used:
+#
+# log.info 'this line will be logged using Syslog default facility level'
+#
+# log_local1 = Syslog::Logger.new 'my_program', Syslog::LOG_LOCAL1
+# log_local1.info 'this line will be logged using local1 facility level'
+#
+#
# You may need to perform some syslog.conf setup first. For a BSD machine add
# the following lines to /etc/syslog.conf:
#
@@ -63,9 +71,9 @@ class Syslog::Logger
##
# Maps Logger warning types to syslog(3) warning types.
#
- # Messages from ruby applications are not considered as critical as messages
+ # Messages from Ruby applications are not considered as critical as messages
# from other system daemons using syslog(3), so most messages are reduced by
- # one level. For example, a fatal message for ruby's Logger is considered
+ # one level. For example, a fatal message for Ruby's Logger is considered
# an error for syslog(3).
LEVEL_MAP = {
@@ -168,17 +176,24 @@ class Syslog::Logger
attr_accessor :formatter
##
+ # The facility argument is used to specify what type of program is logging the message.
+
+ attr_accessor :facility
+
+ ##
# Fills in variables for Logger compatibility. If this is the first
# instance of Syslog::Logger, +program_name+ may be set to change the logged
- # program name.
+ # program name. The +facility+ may be set to specify the facility level which will be used.
#
# Due to the way syslog works, only one program name may be chosen.
- def initialize program_name = 'ruby'
+ def initialize program_name = 'ruby', facility = nil
@level = ::Logger::DEBUG
@formatter = Formatter.new
@@syslog ||= Syslog.open(program_name)
+
+ @facility = (facility || @@syslog.facility)
end
##
@@ -187,8 +202,7 @@ class Syslog::Logger
def add severity, message = nil, progname = nil, &block
severity ||= ::Logger::UNKNOWN
@level <= severity and
- @@syslog.log LEVEL_MAP[severity], '%s', formatter.call(severity, Time.now, progname, (message || block.call))
+ @@syslog.log( (LEVEL_MAP[severity] | @facility), '%s', formatter.call(severity, Time.now, progname, (message || block.call)) )
true
end
end
-
diff --git a/ext/syslog/syslog.c b/ext/syslog/syslog.c
index 34541837c4..8ef722e1c0 100644
--- a/ext/syslog/syslog.c
+++ b/ext/syslog/syslog.c
@@ -37,7 +37,6 @@ static void syslog_write(int pri, int argc, VALUE *argv)
{
VALUE str;
- rb_secure(4);
if (argc < 1) {
rb_raise(rb_eArgError, "no log message supplied");
}
@@ -56,7 +55,6 @@ static void syslog_write(int pri, int argc, VALUE *argv)
*/
static VALUE mSyslog_close(VALUE self)
{
- rb_secure(4);
if (!syslog_opened) {
rb_raise(rb_eRuntimeError, "syslog not opened");
}
@@ -263,7 +261,6 @@ static VALUE mSyslog_get_mask(VALUE self)
*/
static VALUE mSyslog_set_mask(VALUE self, VALUE mask)
{
- rb_secure(4);
if (!syslog_opened) {
rb_raise(rb_eRuntimeError, "must open syslog before setting log mask");
}
@@ -315,7 +312,7 @@ static VALUE mSyslog_log(int argc, VALUE *argv, VALUE self)
pri = *argv++;
if (!FIXNUM_P(pri)) {
- rb_raise(rb_eTypeError, "type mismatch: %s given", rb_class2name(CLASS_OF(pri)));
+ rb_raise(rb_eTypeError, "type mismatch: %"PRIsVALUE" given", rb_obj_class(pri));
}
syslog_write(FIX2INT(pri), argc, argv);
@@ -330,10 +327,10 @@ static VALUE mSyslog_inspect(VALUE self)
Check_Type(self, T_MODULE);
if (!syslog_opened)
- return rb_sprintf("<#%s: opened=false>", rb_class2name(self));
+ return rb_sprintf("<#%"PRIsVALUE": opened=false>", self);
- return rb_sprintf("<#%s: opened=true, ident=\"%s\", options=%d, facility=%d, mask=%d>",
- rb_class2name(self),
+ return rb_sprintf("<#%"PRIsVALUE": opened=true, ident=\"%s\", options=%d, facility=%d, mask=%d>",
+ self,
syslog_ident,
syslog_options,
syslog_facility,
@@ -446,7 +443,7 @@ void Init_syslog()
rb_define_module_function(mSyslog, "mask", mSyslog_get_mask, 0);
rb_define_module_function(mSyslog, "mask=", mSyslog_set_mask, 1);
- rb_define_module_function(mSyslog, "inspect", mSyslog_inspect, 0);
+ rb_define_singleton_method(mSyslog, "inspect", mSyslog_inspect, 0);
rb_define_module_function(mSyslog, "instance", mSyslog_instance, 0);
/* Syslog options */
diff --git a/ext/thread/extconf.rb b/ext/thread/extconf.rb
new file mode 100644
index 0000000000..f2f0890580
--- /dev/null
+++ b/ext/thread/extconf.rb
@@ -0,0 +1,3 @@
+require 'mkmf'
+
+create_makefile('thread')
diff --git a/ext/thread/thread.c b/ext/thread/thread.c
new file mode 100644
index 0000000000..c14443b06c
--- /dev/null
+++ b/ext/thread/thread.c
@@ -0,0 +1,653 @@
+#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) get_array((cv), CONDVAR_WAITERS)
+
+#define GET_QUEUE_QUE(q) get_array((q), QUEUE_QUE)
+#define GET_QUEUE_WAITERS(q) get_array((q), QUEUE_WAITERS)
+#define GET_SZQUEUE_WAITERS(q) get_array((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
+get_array(VALUE obj, int idx)
+{
+ VALUE ary = RSTRUCT_GET(obj, idx);
+ if (!RB_TYPE_P(ary, T_ARRAY)) {
+ rb_raise(rb_eTypeError, "%+"PRIsVALUE" not initialized", obj);
+ }
+ return ary;
+}
+
+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)
+ * enq(object)
+ * <<(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, int should_block)
+{
+ struct waiting_delete args;
+ args.waiting = GET_QUEUE_WAITERS(self);
+ args.th = rb_thread_current();
+
+ while (queue_length(self) == 0) {
+ if (!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 int
+queue_pop_should_block(int argc, const VALUE *argv)
+{
+ int should_block = 1;
+ rb_check_arity(argc, 0, 1);
+ if (argc > 0) {
+ should_block = !RTEST(argv[0]);
+ }
+ return should_block;
+}
+
+/*
+ * Document-method: Queue#pop
+ * call-seq:
+ * pop(non_block=false)
+ * deq(non_block=false)
+ * shift(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)
+{
+ int 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
+ * call-seq:
+ * length
+ * size
+ *
+ * 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_SZQUEUE_WAITERS(self)))) {
+ rb_thread_wakeup_alive(t);
+ }
+ return vmax;
+}
+
+static int
+szqueue_push_should_block(int argc, const VALUE *argv)
+{
+ int should_block = 1;
+ rb_check_arity(argc, 1, 2);
+ if (argc > 1) {
+ should_block = !RTEST(argv[1]);
+ }
+ return should_block;
+}
+
+/*
+ * Document-method: SizedQueue#push
+ * call-seq:
+ * push(object, non_block=false)
+ * enq(object, non_block=false)
+ * <<(object)
+ *
+ * Pushes +object+ to the queue.
+ *
+ * If there is no space left in the queue, waits until space becomes
+ * available, unless +non_block+ is true. If +non_block+ is true, the
+ * thread isn't suspended, and an exception is raised.
+ */
+
+static VALUE
+rb_szqueue_push(int argc, VALUE *argv, VALUE self)
+{
+ struct waiting_delete args;
+ int should_block = szqueue_push_should_block(argc, argv);
+ args.waiting = GET_SZQUEUE_WAITERS(self);
+ args.th = rb_thread_current();
+
+ while (queue_length(self) >= GET_SZQUEUE_ULONGMAX(self)) {
+ if (!should_block) {
+ rb_raise(rb_eThreadError, "queue full");
+ }
+ 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, argv[0]);
+}
+
+static VALUE
+szqueue_do_pop(VALUE self, int 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)
+ * deq(non_block=false)
+ * shift(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)
+{
+ int should_block = queue_pop_should_block(argc, argv);
+ return szqueue_do_pop(self, should_block);
+}
+
+/*
+ * Document-method: Queue#clear
+ *
+ * Removes all objects from the queue.
+ */
+
+static VALUE
+rb_szqueue_clear(VALUE self)
+{
+ rb_ary_clear(GET_QUEUE_QUE(self));
+ wakeup_all_threads(GET_SZQUEUE_WAITERS(self));
+ return self;
+}
+
+/*
+ * 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
+
+/* :nodoc: */
+static VALUE
+undumpable(VALUE obj)
+{
+ rb_raise(rb_eTypeError, "can't dump %"PRIsVALUE, rb_obj_class(obj));
+ UNREACHABLE;
+}
+
+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_undef_method(rb_cConditionVariable, "initialize_copy");
+ rb_define_method(rb_cConditionVariable, "marshal_dump", undumpable, 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_undef_method(rb_cQueue, "initialize_copy");
+ rb_define_method(rb_cQueue, "marshal_dump", undumpable, 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);
+
+ /* Alias for #push. */
+ rb_define_alias(rb_cQueue, "enq", "push");
+ /* Alias for #push. */
+ rb_define_alias(rb_cQueue, "<<", "push");
+ /* Alias for #pop. */
+ rb_define_alias(rb_cQueue, "deq", "pop");
+ /* Alias for #pop. */
+ rb_define_alias(rb_cQueue, "shift", "pop");
+ /* Alias for #length. */
+ rb_define_alias(rb_cQueue, "size", "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, "clear", rb_szqueue_clear, 0);
+ rb_define_method(rb_cSizedQueue, "num_waiting", rb_szqueue_num_waiting, 0);
+
+ /* Alias for #push. */
+ rb_define_alias(rb_cSizedQueue, "enq", "push");
+ /* Alias for #push. */
+ rb_define_alias(rb_cSizedQueue, "<<", "push");
+ /* Alias for #pop. */
+ rb_define_alias(rb_cSizedQueue, "deq", "pop");
+ /* Alias for #pop. */
+ rb_define_alias(rb_cSizedQueue, "shift", "pop");
+
+ rb_provide("thread.rb");
+ ALIAS_GLOBAL_CONST(ConditionVariable);
+ ALIAS_GLOBAL_CONST(Queue);
+ ALIAS_GLOBAL_CONST(SizedQueue);
+}
diff --git a/ext/tk/ChangeLog.tkextlib b/ext/tk/ChangeLog.tkextlib
index b4775c55fc..52a0b7ea3a 100644
--- a/ext/tk/ChangeLog.tkextlib
+++ b/ext/tk/ChangeLog.tkextlib
@@ -496,7 +496,7 @@ Sat Nov 22 10:31:25 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
2005-04-08 ocean <ocean@ruby-lang.org>
* sample/tkextlib/treectrl/random.rb: fixed typo. (drop node outside of
- widget, or reenter widget while draggging)
+ widget, or reenter widget while dragging)
2005-04-08 ocean <ocean@ruby-lang.org>
diff --git a/ext/tk/MANUAL_tcltklib.eng b/ext/tk/MANUAL_tcltklib.eng
index e9f6dc65ce..957e8ec840 100644
--- a/ext/tk/MANUAL_tcltklib.eng
+++ b/ext/tk/MANUAL_tcltklib.eng
@@ -37,7 +37,7 @@ module TclTklib
: Same to 'WINDOW | FILE | TIMER | IDLE'.
DONT_WAIT
- : Without this flag, 'do_one_event' waits the occurence of
+ : Without this flag, 'do_one_event' waits the occurrence of
: a target event. With this flag, doesn't wait and returns
: false if there is no target event for processing.
@@ -145,7 +145,7 @@ module TclTklib
mainloop(check_root = true)
: Starts the eventloop. If 'check_root' is true, this method
: doesn't return when a root widget exists.
- : If 'check_root' is false, doen't return by the other
+ : If 'check_root' is false, doesn't return by the other
: reasons than exceptions.
mainloop_thread?
@@ -181,7 +181,7 @@ module TclTklib
: is based on the count of processed events.
: ( see 'set_eventloop_weight' method )
: However, if the eventloop thread is the only thread,
- : timer_tick cannt be set to 0. If 0, then is set to 100 ms
+ : 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.
@@ -204,9 +204,9 @@ module TclTklib
: That is invalid when the eventloop is the only thread.
: 'loop_max' is the max events for thread-switching.
: 'no_event_tick' is the increment value of the event count
- : when no event for processing (And then, the eventloop thead
+ : 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 defalut.
+ : 'loop_max == 800' and 'no_event_tick == 10' are default.
: On $SAFE >= 4, cannot call this method.
get_eventloop_weight
@@ -215,8 +215,8 @@ 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 warinig message but ignore the exception.
- : If nil, no warning message and ignore the excepsion.
+ : 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
: admins all Tk interpreters, sometimes exception on a
@@ -277,11 +277,11 @@ class TclTkIp
: The information is used to generate the root widget of the
: interpreter.
: ( e.g. TclTkIp.new('FOO', '-geometry 500x200 -use 0x2200009') )
- : If is given nil or falsr for the 'option' argument, generates
+ : If is given nil or false for the 'option' argument, generates
: the Tcl interpreter without Tk library. Then the interpreter
: doesn't need GUI environment. Therefore, even if a window
: system doesn't exist or cannot be used, Ruby can control the
- : Tcl interpreter and the extention libraries loaded on the
+ : Tcl interpreter and the extension libraries loaded on the
: interpreter.
[instance methods]
@@ -350,7 +350,7 @@ class TclTkIp
: So _invoke can call only the command which already
: registered on the interpreter by 'load' command and so on.
: On _eval command, auto_load mechanism words. So if succeed
- : to _eval and regist the command once, after that, the
+ : to _eval and register the command once, after that, the
: command can be called by _invoke.
_cancel_eval(str)
@@ -464,8 +464,8 @@ class TkCallbackContinue < StandardError
: 'break' code to Tk interpreter (Then the Tk interpreter will
: break the operation for the current event).
: If raise TkCallbackContinue, returns 'continue' code (Then the Tk
- : interpreter will break the operateion for the current bindtag and
- : starts the operation for the next buindtag for the current event).
+ : interpreter will break the operation for the current bindtag and
+ : starts the operation for the next bindtag for the current event).
: However, current tcltklib supports Ruby's 'break' and 'next' to
: get the same effect. That is, those classes are obsolete. Those
: exist for backward compatibility.
diff --git a/ext/tk/MANUAL_tcltklib.eucj b/ext/tk/MANUAL_tcltklib.ja
index 1de1736f9f..1de1736f9f 100644
--- a/ext/tk/MANUAL_tcltklib.eucj
+++ b/ext/tk/MANUAL_tcltklib.ja
diff --git a/ext/tk/README.1st b/ext/tk/README.1st
index 96564cc67b..4ffef34f1d 100644
--- a/ext/tk/README.1st
+++ b/ext/tk/README.1st
@@ -1,7 +1,7 @@
If you want to use Ruby/Tk (tk.rb and so on), you must have tcltklib.so
which is working correctly. When you have some troubles on compiling,
please read README.tcltklib and README.ActiveTcl.
-Even if there is a tcltklib.so on your Ruby library directry, it will not
+Even if there is a tcltklib.so on your Ruby library directory, it will not
work without Tcl/Tk libraries (e.g. libtcl8.4.so) on your environment.
You must also check that your Tcl/Tk is installed properly.
diff --git a/ext/tk/README.ActiveTcl b/ext/tk/README.ActiveTcl
index b7f023c91b..990f612648 100644
--- a/ext/tk/README.ActiveTcl
+++ b/ext/tk/README.ActiveTcl
@@ -57,6 +57,6 @@ Based on it, the Tcl interpreter changes auto_path variable's value.
Then, you'll be able to use Tcl/Tk extension libraries included in the
ActiveTcl package (e.g. call TkPackage.require('BWidget'), and then,
-use functions/widgets of BWidget extention).
+use functions/widgets of BWidget extension).
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
diff --git a/ext/tk/README.tcltklib b/ext/tk/README.tcltklib
index 0064586373..da343a4f3e 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 libaray
+ force version of Tcl/Tk library
(e.g. libtcl8.4g.so & libtk8.4g.so ==> --with-tcltkversion=8.4g
libtcl8.4.so & libtk8.4g.so ==> --with-tcltkversion=8.4,8.4g)
@@ -52,7 +52,7 @@ some or all of the following options.
--with-tclConfig-file=<file>/--without-tclConfig-file
--with-tkConfig-file=<file>/--without-tkConfig-file
- file path of tclConfig.sh/tkConfig.sh, or don't
+ file path of tclConfig.sh/tkConfig.sh, or don't
refer those.
If you want use non-standard filenames of config
files (e.g. tclConfig-static.sh), you must use
@@ -80,11 +80,11 @@ some or all of the following options.
--with-tk-dir=<path>
equal to "--with-tk-include=<path>/include --with-tk-lib=<path>/lib"
- --with-tcl-include=<dir> the directry contains 'tcl.h'
- --with-tk-include=<dir> the directry contains 'tk.h'
+ --with-tcl-include=<dir> the directory contains 'tcl.h'
+ --with-tk-include=<dir> the directory contains 'tk.h'
- --with-tcl-lib=<dir> the directry contains 'libtcl<version>.so'
- --with-tk-lib=<dir> the directry contains 'libtk<version>.so'
+ --with-tcl-lib=<dir> the directory contains 'libtcl<version>.so'
+ --with-tk-lib=<dir> the directory contains 'libtk<version>.so'
--enable-mac-tcltk-framework (MacOS X) use Tcl/Tk framework
(Obsolete. Please use '--enable-tcltk-framework'.)
@@ -116,12 +116,12 @@ some or all of the following options.
--with-X11-dir=<path>
equal to "--with-X11-include=<path>/include --with-X11-lib=<path>/lib"
- --with-X11-include=<dir> the directry contais X11 header files
- --with-X11-lib=<dir> the directry contais X11 libraries
+ --with-X11-include=<dir> the directory contais X11 header files
+ --with-X11-lib=<dir> the directory contais X11 libraries
If you forgot to give the options when do 'configure' on toplevel
-directry of Ruby sources, please try something like as the followings.
+directory of Ruby sources, please try something like as the followings.
$ cd ext/tcltklib
$ rm Makefile
diff --git a/ext/tk/extconf.rb b/ext/tk/extconf.rb
index 709e4d2d25..99a7367782 100644
--- a/ext/tk/extconf.rb
+++ b/ext/tk/extconf.rb
@@ -11,10 +11,18 @@ TkLib_Config['search_versions'] =
# %w[8.7 8.6 8.5 8.4 8.0] # to shorten search steps
%w[8.5 8.4] # At present, Tcl/Tk8.6 is not supported.
+TkLib_Config['unsupported_versions'] =
+ %w[8.8 8.7 8.6] # 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')
@@ -543,13 +551,13 @@ end
def get_ext_list()
exts = [CONFIG['DLEXT']]
- exts.concat %w(dll lib) if is_win32?
+ exts.concat %w(dll) if is_win32?
exts.concat %w(bundle dylib) if is_macosx?
- if enable_config("shared") == false
- [CONFIG['LIBEXT'], "a"].concat exts
- else
- exts.concat [CONFIG['LIBEXT'], "a"]
+ if TkLib_Config["tcltk-stubs"] || TkLib_Config['enable-shared'] == false
+ exts.unshift "lib" if is_win32?
+ exts.unshift "a"
+ exts.unshift CONFIG['LIBEXT']
end
if is_win32?
@@ -615,7 +623,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 = "-L#{tcldir.quote} -Wl,-R#{tcldir.quote} " + tcllibs
+ tcllibs = "#{libpathflag([tcldir])} #{tcllibs}"
# FIX ME: avoid pathname trouble (fail to find) on MinGW.
$INCFLAGS << " -I" << File.join(File.dirname(tcldir),"include") if is_win32?
@@ -657,7 +665,7 @@ def libcheck_for_tclConfig(tcldir, tkdir, tclconf, tkconf)
else
tklibs = append_library("", libname)
#tklibs = append_library("", $1)
- tklibs = "-L#{tkdir.quote} -Wl,-R#{tkdir.quote} " + tklibs
+ tklibs = "#{libpathflag([tkdir])} #{tklibs}"
# FIX ME: avoid pathname trouble (fail to find) on MinGW.
$INCFLAGS << " -I" << File.join(File.dirname(tcldir),"include") if is_win32?
@@ -737,6 +745,7 @@ 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|
@@ -747,7 +756,7 @@ def search_tclConfig(*paths) # libdir list or [tcl-libdir|file, tk-libdir|file]
dir.strip.chomp('/')
end
}.each{|dir|
- print(".") # progress
+ print("."); progress_flag = true # progress
# print("check #{dir} ==>");
if dir.kind_of? Array
tcldir, tkdir = dir
@@ -786,10 +795,36 @@ def search_tclConfig(*paths) # libdir list or [tcl-libdir|file, tk-libdir|file]
# parse tclConfig.sh/tkConfig.sh
tclconf = (tclpath)? parse_tclConfig(tclpath): nil
- next if tclconf && tclver && ((tclver_major && tclver_major != tclconf['TCL_MAJOR_VERSION']) || (tclver_minor && tclver_minor != tclconf['TCL_MINOR_VERSION']))
+ 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
tkconf = (tkpath)? parse_tclConfig(tkpath): nil
- next if tkconf && tkver && ((tkver_major && tkver_major != tkconf['TK_MAJOR_VERSION']) || (tkver_minor && tkver_minor != tkconf['TK_MINOR_VERSION']))
+ 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
# nativethread check
if !TkLib_Config["ruby_with_thread"]
@@ -1102,7 +1137,7 @@ def find_tcl(tcllib, stubs, version, *opt_paths)
if tcllib
print(".")
if have_library(tcllib, func, ["tcl.h"])
- return [true, path, lib_w_sufx, nil, *inc]
+ return [true, path, tcllib, nil, *inc]
end
else
sufx_list = ['', 't', 'g', 's', 'x']
@@ -1126,7 +1161,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 = "-L#{path.quote} -Wl,-R#{path.quote} " + tcllibs
+ tcllibs = "#{libpathflag([path])} #{tcllibs}"
end
if try_func(func, tcllibs, ["tcl.h"])
return [true, path, nil, tcllibs, *inc]
@@ -1242,7 +1277,7 @@ def find_tk(tklib, stubs, version, *opt_paths)
if tklib
print(".")
if have_library(tklib, func, ["tcl.h", "tk.h"])
- return [true, path, lib_w_sufx, nil, *inc]
+ return [true, path, tklib, nil, *inc]
end
else
sufx_list = ['', 't', 'g', 's', 'x']
@@ -1265,7 +1300,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 = "-L#{path.quote} -Wl,-R#{path.quote} " + tklibs
+ tklibs = "#{libpathflag([path])} #{tklibs}"
end
if try_func(func, tklibs, ["tcl.h", "tk.h"])
return [true, path, nil, tklibs, *inc]
@@ -1292,6 +1327,10 @@ 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
@@ -1304,6 +1343,10 @@ 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
@@ -1487,8 +1530,8 @@ end
def setup_for_macosx_framework(tclver, tkver)
# use framework, but no tclConfig.sh
- unless $LDFLAGS && $LDFLAGS.include?('-framework')
- ($LDFLAGS ||= "") << ' -framework Tk -framework Tcl'
+ unless $LIBS && $LIBS.include?('-framework')
+ ($LIBS ||= "") << ' -framework Tk -framework Tcl'
end
if TkLib_Config["tcl-framework-header"]
@@ -1749,23 +1792,13 @@ end
##############################################################
# check header file
print("check functions.")
-have_func("ruby_native_thread_p", "ruby.h")
-print(".") # progress
-have_func("rb_errinfo", "ruby.h")
-print(".") # progress
-have_func("rb_safe_level", "ruby.h")
-print(".") # progress
-have_func("rb_hash_lookup", "ruby.h")
-print(".") # progress
-have_func("rb_proc_new", "ruby.h")
-print(".") # progress
-have_func("rb_obj_untrust", "ruby.h")
-print(".") # progress
-have_func("rb_obj_taint", "ruby.h")
-print(".") # progress
-have_func("rb_set_safe_level_force", "ruby.h")
-print(".") # progress
-have_func("rb_sourcefile", "ruby.h")
+
+%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".each do |func|
+ have_func(func, "ruby.h")
+ print(".") # progress
+end
print("\n") # progress
print("check struct members.")
@@ -1970,7 +2003,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 ||= "") << " -L#{TkLib_Config["tcl-build-dir"].quote} -Wl,-R#{TkLib_Config["tcl-build-dir"].quote}" if TkLib_Config["tcl-build-dir"]
+ ($LDFLAGS ||= "") << " " << libpathflag([TkLib_Config["tcl-build-dir"]]) if TkLib_Config["tcl-build-dir"]
libs = ''
if tcl_cfg_dir
@@ -1996,7 +2029,7 @@ if TkLib_Config["tcltk-framework"]
end
end
- libs << " -L#{TkLib_Config["tk-build-dir"].quote} -Wl,-R#{TkLib_Config["tk-build-dir"].quote}" if TkLib_Config["tk-build-dir"]
+ libs << " " << libpathflag([TkLib_Config["tk-build-dir"]]) if TkLib_Config["tk-build-dir"]
if tk_cfg_dir
TkConfig_Info['TK_LIBS'] ||= ""
diff --git a/ext/tk/lib/multi-tk.rb b/ext/tk/lib/multi-tk.rb
index 68bd849670..bb6e69aab6 100644
--- a/ext/tk/lib/multi-tk.rb
+++ b/ext/tk/lib/multi-tk.rb
@@ -148,7 +148,7 @@ class MultiTkIp
end
def delete(idx, &blk)
- # if gets an entry, is permited to delete
+ # if gets an entry, is permitted to delete
if self[idx]
@tbl.delete(idx)
elsif blk
diff --git a/ext/tk/lib/tcltk.rb b/ext/tk/lib/tcltk.rb
index 48ec1df09a..f8fbdfbe6d 100644
--- a/ext/tk/lib/tcltk.rb
+++ b/ext/tk/lib/tcltk.rb
@@ -325,7 +325,7 @@ class TclTkCallback < TclTkObject
TclTk._addcallback(self)
end
- # to_eval(): retuens string representation for @ip._eval_args
+ # to_eval(): returns string representation for @ip._eval_args
def to_eval()
if @arg
# bind replaces %s before calling ruby_fmt, so %%s is used
@@ -349,7 +349,7 @@ class TclTkImage < TclTkCommand
# initialize(interp, t, *args):
# generating image is done by TclTkImage.new()
- # destrying is done by image delete (inconsistent, sigh)
+ # destroying 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/canvas.rb b/ext/tk/lib/tk/canvas.rb
index af404213e7..f3e9a7c229 100644
--- a/ext/tk/lib/tk/canvas.rb
+++ b/ext/tk/lib/tk/canvas.rb
@@ -77,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 paramters
+ tag # maybe an Array of configure parameters
end
end
private :tagid
diff --git a/ext/tk/lib/tk/image.rb b/ext/tk/lib/tk/image.rb
index d2b0305dcd..972383982f 100644
--- a/ext/tk/lib/tk/image.rb
+++ b/ext/tk/lib/tk/image.rb
@@ -132,7 +132,7 @@ end
# exists to allow additional image file formats to be added easily.
#
# This class documentation is a copy from the original Tcl/Tk at
-# http://www.tcl.tk/man/tcl8.5/TkCmd/photo.htm with some rewrited parts.
+# http://www.tcl.tk/man/tcl8.5/TkCmd/photo.htm with some rewritten parts.
class TkPhotoImage<TkImage
NullArgOptionKeys = [ "shrink", "grayscale" ]
diff --git a/ext/tk/lib/tk/msgcat.rb b/ext/tk/lib/tk/msgcat.rb
index 4abbcad85e..f2d0653c69 100644
--- a/ext/tk/lib/tk/msgcat.rb
+++ b/ext/tk/lib/tk/msgcat.rb
@@ -125,6 +125,8 @@ 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)
@@ -199,7 +201,11 @@ class TkMsgCatalog < TkObject
file = File.join(dir, loc + self::MSGCAT_EXT)
if File.readable?(file)
count += 1
- eval(open(file){|f| f.read})
+ if TkCore::WITH_ENCODING
+ eval(IO.read(file, :encoding=>"ASCII-8BIT"))
+ else
+ eval(IO.read(file))
+ end
end
}
count
@@ -215,7 +221,11 @@ class TkMsgCatalog < TkObject
file = File.join(dir, loc + @msgcat_ext)
if File.readable?(file)
count += 1
- @namespace.eval(open(file){|f| f.read})
+ if TkCore::WITH_ENCODING
+ @namespace.eval(IO.read(file, :encoding=>"ASCII-8BIT"))
+ else
+ @namespace.eval(IO.read(file))
+ end
end
}
count
@@ -229,30 +239,21 @@ 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(tk_call_without_enc('::msgcat::mcset',
- locale,
- _get_eval_string(src_str, true),
- trans_str))
+ Tk.UTF8_String(ip_eval_without_enc("::msgcat::mcset {#{locale}} {#{_get_eval_string(src_str, true)}} {#{trans_str}}"))
else
- Tk.UTF8_String(tk_call_without_enc('::msgcat::mcset',
- locale,
- _get_eval_string(src_str, true)))
+ Tk.UTF8_String(ip_eval_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{
- tk_call_without_enc('::msgcat::mcset',
- locale,
- _get_eval_string(src_str, true),
- trans_str)
+ ip_eval_without_enc("::msgcat::mcset {#{locale}} {#{_get_eval_string(src_str, true)}} {#{trans_str}}")
})
else
Tk.UTF8_String(@namespace.eval{
- tk_call_without_enc('::msgcat::mcset',
- locale,
- _get_eval_string(src_str, true))})
+ ip_eval_without_enc("::msgcat::mcset {#{locale}} {#{_get_eval_string(src_str, true)}}")
+ })
end
end
@@ -262,12 +263,13 @@ class TkMsgCatalog < TkObject
trans_list.each{|src, trans|
if trans && trans != None
list << _get_eval_string(src, true)
- list << Tk.UTF8_Stirng(_toUTF8(trans, enc))
+ list << Tk.UTF8_String(_toUTF8(trans, enc))
else
list << _get_eval_string(src, true) << ''
end
}
- number(tk_call_without_enc('::msgcat::mcmset', locale, list))
+ #number(tk_call_without_enc('::msgcat::mcmset', locale, list))
+ number(ip_eval_without_enc("::msgcat::mcmset {#{locale}} {#{_get_eval_string(list)}}"))
end
def set_translation_list(locale, trans_list, enc='utf-8')
# trans_list ::= [ [src, trans], [src, trans], ... ]
@@ -281,7 +283,8 @@ class TkMsgCatalog < TkObject
end
}
number(@namespace.eval{
- tk_call_without_enc('::msgcat::mcmset', locale, list)
+ #tk_call_without_enc('::msgcat::mcmset', locale, list)
+ ip_eval_without_enc("::msgcat::mcmset {#{locale}} {#{_get_eval_string(list)}}")
})
end
diff --git a/ext/tk/lib/tk/namespace.rb b/ext/tk/lib/tk/namespace.rb
index 4af891995e..0119ba5ef7 100644
--- a/ext/tk/lib/tk/namespace.rb
+++ b/ext/tk/lib/tk/namespace.rb
@@ -325,12 +325,7 @@ class TkNamespace < TkObject
def code(script = Proc.new)
if script.kind_of?(String)
cmd = proc{|*args|
- 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
+ ret = ScopeArgs.new(@fullname,*args).instance_eval(script)
id = ret.object_id
TkNamespace::Tk_NsCode_RetObjID_TBL[id] = ret
id
diff --git a/ext/tk/lib/tk/text.rb b/ext/tk/lib/tk/text.rb
index bc2aa0a293..c18b3843b4 100644
--- a/ext/tk/lib/tk/text.rb
+++ b/ext/tk/lib/tk/text.rb
@@ -352,7 +352,7 @@ class Tk::Text<TkTextWin
|| tag.kind_of?(TkTextWindow)
tag.id
else
- tag # maybe an Array of configure paramters
+ tag # maybe an Array of configure parameters
end
end
private :tagid
diff --git a/ext/tk/lib/tkextlib/SUPPORT_STATUS b/ext/tk/lib/tkextlib/SUPPORT_STATUS
index 522039b11a..de51c519fa 100644
--- a/ext/tk/lib/tkextlib/SUPPORT_STATUS
+++ b/ext/tk/lib/tkextlib/SUPPORT_STATUS
@@ -3,7 +3,7 @@
*** RELEASE_DATE of the libraries => see 'tkextlib/version.rb' ***
-The following list shows *CURRENT* status when this file was modifyed
+The following list shows *CURRENT* status when this file was modified
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
@@ -34,7 +34,7 @@ script may give you some hints about that.
If you cannot use installed Tcl/Tk extension, please check the
followings.
- (1) On your Tcl/Tk, does the extention work?
+ (1) On your Tcl/Tk, does the extension work?
(2) Do DLL libraries of the extension exist on DLL load-path?
(See also "<ruby archive>/ext/tcltklib/README.ActiveTcl")
@@ -44,8 +44,8 @@ script may give you some hints about that.
The check results may request you to do some setup operations
before using the extension. If so, then please write the step
- of setup oprations into the "setup.rb" file in the directory
- of the wrapper libraries for the extention (It is the wrapper
+ of setup operations into the "setup.rb" file in the directory
+ of the wrapper libraries for the extension (It is the wrapper
libraries have the standard structure of the libraries in this
directory). The "setup" file is required before requiring the
Tcl library package (TkPackage.require(<libname>)).
@@ -77,10 +77,7 @@ 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
- * see also tcltk-ext library on RAA
- (http://raa.ruby-lang.org/)
- ==> blt
+BLT 2.4z http://sourceforge.net/projects/blt ==> blt
TkTreeCtrl 2.2.9
http://tktreectrl.sourceforge.net/ ==> treectrl
@@ -129,8 +126,6 @@ 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/component.rb b/ext/tk/lib/tkextlib/blt/component.rb
index a228a82246..c7ea213cee 100644
--- a/ext/tk/lib/tkextlib/blt/component.rb
+++ b/ext/tk/lib/tkextlib/blt/component.rb
@@ -1420,7 +1420,7 @@ module Tk::BLT
tag.kind_of?(Marker)
tag.id
else
- tag # maybe an Array of configure paramters
+ tag # maybe an Array of configure parameters
end
end
diff --git a/ext/tk/lib/tkextlib/blt/tree.rb b/ext/tk/lib/tkextlib/blt/tree.rb
index da53a6ed04..1a3563e60d 100644
--- a/ext/tk/lib/tkextlib/blt/tree.rb
+++ b/ext/tk/lib/tkextlib/blt/tree.rb
@@ -670,7 +670,7 @@ module Tk::BLT
tag.kind_of?(Tk::BLT::Tree::Trace)
tag.id
else
- tag # maybe an Array of configure paramters
+ tag # maybe an Array of configure parameters
end
end
diff --git a/ext/tk/lib/tkextlib/blt/treeview.rb b/ext/tk/lib/tkextlib/blt/treeview.rb
index 046cf7f837..38d90412e0 100644
--- a/ext/tk/lib/tkextlib/blt/treeview.rb
+++ b/ext/tk/lib/tkextlib/blt/treeview.rb
@@ -339,7 +339,7 @@ class Tk::BLT::Treeview
|| tag.kind_of?(Tk::BLT::Treeview::Tag)
tag.id
else
- tag # maybe an Array of configure paramters
+ tag # maybe an Array of configure parameters
end
end
private :tagid
diff --git a/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb b/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb
index 935e04bbcc..4dea2f2d5c 100644
--- a/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb
+++ b/ext/tk/lib/tkextlib/iwidgets/scrolledcanvas.rb
@@ -64,7 +64,7 @@ class Tk::Iwidgets::Scrolledcanvas
elsif tag.kind_of?(Tk::Itk::Component)
tag.name
else
- tag # maybe an Array of configure paramters
+ tag # maybe an Array of configure parameters
end
end
private :tagid
diff --git a/ext/tk/lib/tkextlib/pkg_checker.rb b/ext/tk/lib/tkextlib/pkg_checker.rb
index ecc6bfa131..e2fd97bb6a 100755
--- a/ext/tk/lib/tkextlib/pkg_checker.rb
+++ b/ext/tk/lib/tkextlib/pkg_checker.rb
@@ -15,7 +15,7 @@ verbose = false
def help_msg
print "Usage: #{$0} [-l] [-v] [-h] [--] [dir]\n"
- print "\tIf dir is omitted, check the directry that this command exists.\n"
+ print "\tIf dir is omitted, check the directory that this command exists.\n"
print "\tAvailable options are \n"
print "\t -l : Add dir to $LOAD_PATH\n"
print "\t (If dir == '<parent>/tkextlib', add <parent> also.)\n"
diff --git a/ext/tk/lib/tkextlib/tcllib/plotchart.rb b/ext/tk/lib/tkextlib/tcllib/plotchart.rb
index 2f3d79d427..d2f3a0da3a 100644
--- a/ext/tk/lib/tkextlib/tcllib/plotchart.rb
+++ b/ext/tk/lib/tkextlib/tcllib/plotchart.rb
@@ -519,7 +519,7 @@ module Tk::Tcllib::Plotchart
class Histogram < XYPlot
TkCommandNames = [
'canvas'.freeze,
- '::Plotchart::createHistgram'.freeze
+ '::Plotchart::createHistogram'.freeze
].freeze
end
diff --git a/ext/tk/lib/tkextlib/tile/style.rb b/ext/tk/lib/tkextlib/tile/style.rb
index 108d81f88b..83a0c9a2e8 100644
--- a/ext/tk/lib/tkextlib/tile/style.rb
+++ b/ext/tk/lib/tkextlib/tile/style.rb
@@ -21,8 +21,8 @@ class << Tk::Tile::Style
TkCommandNames = ['style'.freeze].freeze
# --- Tk::Tile::Style.__define_wrapper_proc_for_compatibility__! ---
- # On Ttk (Tile) extension, 'style' command has imcompatible changes
- # depend on the version of the extention. It requires modifying the
+ # On Ttk (Tile) extension, 'style' command has incompatible changes
+ # depend on the version of the extension. It requires modifying the
# Tcl/Tk scripts to define local styles. The rule for modification
# is a simple one. But, if users want to keep compatibility between
# versions of the extension, they will have to contrive to do that.
diff --git a/ext/tk/lib/tkextlib/tkDND/tkdnd.rb b/ext/tk/lib/tkextlib/tkDND/tkdnd.rb
index 97cdfc7f1c..38e05ce775 100644
--- a/ext/tk/lib/tkextlib/tkDND/tkdnd.rb
+++ b/ext/tk/lib/tkextlib/tkDND/tkdnd.rb
@@ -158,7 +158,7 @@ module Tk
cmd = Proc.new
end
- args = [None] if args.empty
+ args = [TkComm::None] if args.empty?
tk_call('dnd', 'bindsource', @path, type, cmd, *args)
self
diff --git a/ext/tk/lib/tkextlib/tktable/tktable.rb b/ext/tk/lib/tkextlib/tktable/tktable.rb
index bc7a6c9a2e..f7074655ed 100644
--- a/ext/tk/lib/tkextlib/tktable/tktable.rb
+++ b/ext/tk/lib/tkextlib/tktable/tktable.rb
@@ -70,7 +70,7 @@ module Tk::TkTable::ConfigMethod
private :__item_strval_optkeys
def __item_val2ruby_optkeys(id) # { key=>method, ... }
- super(id).update('window'=>proc{|v| window(v)})
+ super(id).update('window'=>proc{|k,v| window(v)})
end
private :__item_val2ruby_optkeys
diff --git a/ext/tk/old-README.tcltklib.eucj b/ext/tk/old-README.tcltklib.ja
index e29b389402..e29b389402 100644
--- a/ext/tk/old-README.tcltklib.eucj
+++ b/ext/tk/old-README.tcltklib.ja
diff --git a/ext/tk/sample/figmemo_sample.rb b/ext/tk/sample/figmemo_sample.rb
index 25ec618fe8..da6c41797e 100644
--- a/ext/tk/sample/figmemo_sample.rb
+++ b/ext/tk/sample/figmemo_sample.rb
@@ -5,7 +5,7 @@ begin
# try to use Img extension
require 'tkextlib/tkimg'
rescue Exception
- # cannot use Img extention --> ignore
+ # cannot use Img extension --> ignore
end
diff --git a/ext/tk/sample/msgs_tk/README b/ext/tk/sample/msgs_tk/README
index 062ec20cf8..949ee7a896 100644
--- a/ext/tk/sample/msgs_tk/README
+++ b/ext/tk/sample/msgs_tk/README
@@ -1,4 +1,4 @@
Almost all of Message-Catalog files in this directory are quoted
from Tcl/Tk8.5a1 source archive (only a little are modified for
'tkmsgcat-load_tk.rb'). Please read the file 'license.terms' in
-this directry (That was included in demo directory of Tcl/Tk8.5a1).
+this directory (That was included in demo directory of Tcl/Tk8.5a1).
diff --git a/ext/tk/sample/scrollframe.rb b/ext/tk/sample/scrollframe.rb
index e340e1da3c..e9d8af7ebf 100644
--- a/ext/tk/sample/scrollframe.rb
+++ b/ext/tk/sample/scrollframe.rb
@@ -13,6 +13,8 @@
#
require 'tk'
+module Tk::RbWidget; end
+
class Tk::RbWidget::ScrollFrame < TkFrame
include TkComposite
diff --git a/ext/tk/sample/tkextlib/blt/readme.txt b/ext/tk/sample/tkextlib/blt/readme.txt
index 4183c01ecb..8ac1044b0b 100644
--- a/ext/tk/sample/tkextlib/blt/readme.txt
+++ b/ext/tk/sample/tkextlib/blt/readme.txt
@@ -1,2 +1,2 @@
The scripts and image files in this directory are based on demo files
-of Tcl/Tk's BLT extention.
+of Tcl/Tk's BLT extension.
diff --git a/ext/tk/sample/tkextlib/bwidget/Orig_LICENSE.txt b/ext/tk/sample/tkextlib/bwidget/Orig_LICENSE.txt
index 0c4c16fe47..16ddca4e3c 100644
--- a/ext/tk/sample/tkextlib/bwidget/Orig_LICENSE.txt
+++ b/ext/tk/sample/tkextlib/bwidget/Orig_LICENSE.txt
@@ -2,8 +2,8 @@
######################################################################
### The following text is the original 'LICENSE.txt' of BWidget ###
### extension. ###
- ### Original Tcl source files are not include in this directry, ###
- ### because of all of them are rewrited to Ruby files. ###
+ ### Original Tcl source files are not include in this directory, ###
+ ### because of all of them are rewritten to Ruby files. ###
### However, the bitmap data files ('bwidgtet.xbm' and 'x1.xbm') ###
### included in this directory are quoted from BWidget source ###
### archive. So, those bitmaps are under the following license. ###
@@ -11,8 +11,8 @@
BWidget ToolKit
-Copyright (c) 1998-1999 UNIFIX.
-Copyright (c) 2001-2002 ActiveState Corp.
+Copyright (c) 1998-1999 UNIFIX.
+Copyright (c) 2001-2002 ActiveState Corp.
The following terms apply to all files associated with the software
unless explicitly disclaimed in individual files.
@@ -42,7 +42,7 @@ MODIFICATIONS.
GOVERNMENT USE: If you are acquiring this software on behalf of the
U.S. government, the Government shall have only "Restricted Rights"
-in the software and related documentation as defined in the Federal
+in the software and related documentation as defined in the Federal
Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
are acquiring the software on behalf of the Department of Defense, the
software shall be classified as "Commercial Computer Software" and the
@@ -50,4 +50,4 @@ Government shall have only "Restricted Rights" as defined in Clause
252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
authors grant the U.S. Government and others acting in its behalf
permission to use and distribute the software in accordance with the
-terms specified in this license.
+terms specified in this license.
diff --git a/ext/tk/sample/tkextlib/iwidgets/catalog_demo/Orig_LICENSE.txt b/ext/tk/sample/tkextlib/iwidgets/catalog_demo/Orig_LICENSE.txt
index 22f787609d..8392da7cec 100644
--- a/ext/tk/sample/tkextlib/iwidgets/catalog_demo/Orig_LICENSE.txt
+++ b/ext/tk/sample/tkextlib/iwidgets/catalog_demo/Orig_LICENSE.txt
@@ -1,34 +1,34 @@
#######################################################################
- ### The following text is the original 'license.terms' of iwidges ###
+ ### The following text is the original 'license.terms' of iwidgets ###
### extension. ###
- ### Original Tcl source files are not include in this directry, ###
- ### because of all of them are rewrited to Ruby files. ###
+ ### Original Tcl source files are not include in this directory, ###
+ ### because of all of them are rewritten to Ruby files. ###
### However, the image data files in the 'images' directory are ###
### quoted from iwidgets source archive. ###
#######################################################################
-This software is copyrighted by DSC Technologies and private individual
-contributors. The copyright holder is specifically listed in the header
+This software is copyrighted by DSC Technologies and private individual
+contributors. The copyright holder is specifically listed in the header
of each file. The following terms apply to all files associated with the
software unless explicitly disclaimed in individual files by private
contributors.
Copyright 1997 DSC Technologies Corporation
-Permission to use, copy, modify, distribute and license this software and
-its documentation for any purpose, and without fee or written agreement
-with DSC, is hereby granted, provided that the above copyright notice
-appears in all copies and that both the copyright notice and warranty
+Permission to use, copy, modify, distribute and license this software and
+its documentation for any purpose, and without fee or written agreement
+with DSC, is hereby granted, provided that the above copyright notice
+appears in all copies and that both the copyright notice and warranty
disclaimer below appear in supporting documentation, and that the names of
-DSC Technologies Corporation or DSC Communications Corporation not be used
-in advertising or publicity pertaining to the software without specific,
+DSC Technologies Corporation or DSC Communications Corporation not be used
+in advertising or publicity pertaining to the software without specific,
written prior permission.
DSC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, AND NON-INFRINGEMENT.
-THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND
+THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND
DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
ENHANCEMENTS, OR MODIFICATIONS. IN NO EVENT SHALL DSC BE LIABLE FOR ANY
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/notebook.rb b/ext/tk/sample/tkextlib/iwidgets/sample/notebook.rb
index 055312ec96..4d460e8802 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/notebook.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/notebook.rb
@@ -23,7 +23,7 @@ TkButton.new(page2CS, :text=>'Button Two').pack
# Select the first page of the tabnotebook.
nb.select(0)
-# Create the scrollbar and associate teh scrollbar
+# Create the scrollbar and associate the scrollbar
# and the notebook together, then pack the scrollbar
nb.scrollbar(TkScrollbar.new).pack(:fill=>:y, :expand=>true, :pady=>10)
diff --git a/ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb b/ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb
index 41e9ce1bfc..576a9c18d0 100644
--- a/ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb
+++ b/ext/tk/sample/tkextlib/iwidgets/sample/notebook2.rb
@@ -23,7 +23,7 @@ TkButton.new(page2CS, :text=>'Button Two').pack
# Select the first page of the tabnotebook.
nb.select(0)
-# Create the scrollbar and associate teh scrollbar
+# Create the scrollbar and associate the scrollbar
# and the notebook together, then pack the scrollbar
nb.xscrollbar(TkScrollbar.new).pack(:fill=>:x, :expand=>true, :padx=>10)
diff --git a/ext/tk/sample/tkextlib/tcllib/Orig_LICENSE.txt b/ext/tk/sample/tkextlib/tcllib/Orig_LICENSE.txt
index 272853870c..975f23e3f1 100644
--- a/ext/tk/sample/tkextlib/tcllib/Orig_LICENSE.txt
+++ b/ext/tk/sample/tkextlib/tcllib/Orig_LICENSE.txt
@@ -2,8 +2,8 @@
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>>> The following text is the original 'license.term' of tklib <<<
>>> extension. <<<
- >>> Original Tcl files are not include in this directry, because <<<
- >>> of all of them are rewrited to Ruby files. <<<
+ >>> Original Tcl files are not include in this directory, because <<<
+ >>> of all of them are rewritten to Ruby files. <<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
This software is copyrighted by Ajuba Solutions and other parties.
@@ -35,7 +35,7 @@ MODIFICATIONS.
GOVERNMENT USE: If you are acquiring this software on behalf of the
U.S. government, the Government shall have only "Restricted Rights"
-in the software and related documentation as defined in the Federal
+in the software and related documentation as defined in the Federal
Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
are acquiring the software on behalf of the Department of Defense, the
software shall be classified as "Commercial Computer Software" and the
@@ -43,4 +43,4 @@ Government shall have only "Restricted Rights" as defined in Clause
252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
authors grant the U.S. Government and others acting in its behalf
permission to use and distribute the software in accordance with the
-terms specified in this license.
+terms specified in this license.
diff --git a/ext/tk/sample/tkextlib/tkimg/demo.rb b/ext/tk/sample/tkextlib/tkimg/demo.rb
index d453e8ee9d..8016c263a6 100644
--- a/ext/tk/sample/tkextlib/tkimg/demo.rb
+++ b/ext/tk/sample/tkextlib/tkimg/demo.rb
@@ -2,7 +2,7 @@
#
# Tk::Img demo
#
-# -- This script is based on demo.tcl of Tcl/Tk's 'Img' extention.
+# -- This script is based on demo.tcl of Tcl/Tk's 'Img' extension.
# Image data in this script is those of demo.tcl.
# Please read 'license_terms_of_Img_extension' file.
#
diff --git a/ext/tk/sample/tkextlib/tkimg/readme.txt b/ext/tk/sample/tkextlib/tkimg/readme.txt
index 8e4b0163b1..8fd1a3e67d 100644
--- a/ext/tk/sample/tkextlib/tkimg/readme.txt
+++ b/ext/tk/sample/tkextlib/tkimg/readme.txt
@@ -1,3 +1,3 @@
-The script 'demo.rb' is based on 'demo.tcl' of Tcl/Tk's 'Img' extention.
+The script 'demo.rb' is based on 'demo.tcl' of Tcl/Tk's 'Img' extension.
Image data in 'demo.rb' is those of 'demo.tcl'.
Please read 'license_terms_of_Img_extension' file.
diff --git a/ext/tk/sample/tkextlib/tktable/Orig_LICENSE.txt b/ext/tk/sample/tkextlib/tktable/Orig_LICENSE.txt
index dd176a7ccf..b06b0b463b 100644
--- a/ext/tk/sample/tkextlib/tktable/Orig_LICENSE.txt
+++ b/ext/tk/sample/tkextlib/tktable/Orig_LICENSE.txt
@@ -2,8 +2,8 @@
#######################################################################
### The following text is the original 'license.txt' of tktable ###
### extension. ###
- ### Original Tcl source files are not include in this directry, ###
- ### because of all of them are rewrited to Ruby files. ###
+ ### Original Tcl source files are not include in this directory, ###
+ ### because of all of them are rewritten to Ruby files. ###
### However, the image data file is quoted from iwidgets source ###
### archive. ###
#######################################################################
diff --git a/ext/tk/sample/tkextlib/treectrl/readme.txt b/ext/tk/sample/tkextlib/treectrl/readme.txt
index bda4f63d88..81e13b24aa 100644
--- a/ext/tk/sample/tkextlib/treectrl/readme.txt
+++ b/ext/tk/sample/tkextlib/treectrl/readme.txt
@@ -1,2 +1,2 @@
The scripts and image files in this directory are based on demo files
-of Tcl/Tk's TreeCtrl extention.
+of Tcl/Tk's TreeCtrl extension.
diff --git a/ext/tk/sample/tkextlib/vu/Orig_LICENSE.txt b/ext/tk/sample/tkextlib/vu/Orig_LICENSE.txt
index f5f2f770cf..f2e0edcf42 100644
--- a/ext/tk/sample/tkextlib/vu/Orig_LICENSE.txt
+++ b/ext/tk/sample/tkextlib/vu/Orig_LICENSE.txt
@@ -1,8 +1,8 @@
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>>> The following text is the original 'license.txt' of vu extension. <<<
- >>> Original Tcl source files are not include in this directry, <<<
- >>> because of all of them are rewrited to Ruby files. <<<
+ >>> Original Tcl source files are not include in this directory, <<<
+ >>> because of all of them are rewritten to Ruby files. <<<
>>> However, the bitmap data file included in this directory is the <<<
>>> same file of vu extension. So, the bitmap data file is under the <<<
>>> following license. <<<
diff --git a/ext/tk/sample/tktextframe.rb b/ext/tk/sample/tktextframe.rb
index b2b40c9138..d6584beeb8 100644
--- a/ext/tk/sample/tktextframe.rb
+++ b/ext/tk/sample/tktextframe.rb
@@ -21,7 +21,7 @@ module Tk::ScrollbarComposite
private :create_component
def component_delegates
- # if want to override defalut option-methods or delegates,
+ # if want to override default option-methods or delegates,
# please define here.
end
private :component_delegates
diff --git a/ext/tk/stubs.c b/ext/tk/stubs.c
index 7398a79ae3..6c82c7a7bb 100644
--- a/ext/tk/stubs.c
+++ b/ext/tk/stubs.c
@@ -83,8 +83,8 @@ _nativethread_consistency_check(ip)
# define DL_SYM GetProcAddress
# define TCL_INDEX 4
# define TK_INDEX 3
-# define TCL_NAME "tcl89%s"
-# define TK_NAME "tk89%s"
+# define TCL_NAME "tcl89"
+# define TK_NAME "tk89"
# 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%s"
-# define TK_NAME "libtk8.9%s"
+# define TCL_NAME "libtcl8.9"
+# define TK_NAME "libtk8.9"
# ifdef __APPLE__
# undef DLEXT
# define DLEXT ".dylib"
@@ -116,7 +116,6 @@ 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;
@@ -127,7 +126,7 @@ ruby_open_tcl_dll(appname)
if (ruby_tcl_dll) {
tcl_dll = (DL_HANDLE)DL_OPEN(ruby_tcl_dll);
} else {
- snprintf(tcl_name, sizeof tcl_name, TCL_NAME, DLEXT);
+ char tcl_name[] = TCL_NAME DLEXT;
/* examine from 8.9 to 8.1 */
for (n = '9'; n > '0'; n--) {
tcl_name[TCL_INDEX] = n;
@@ -162,7 +161,6 @@ 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)); */
@@ -176,7 +174,7 @@ ruby_open_tk_dll()
if (ruby_tk_dll) {
tk_dll = (DL_HANDLE)DL_OPEN(ruby_tk_dll);
} else {
- snprintf(tk_name, sizeof tk_name, TK_NAME, DLEXT);
+ char tk_name[] = TK_NAME DLEXT;
/* examine from 8.9 to 8.1 */
for (n = '9'; n > '0'; n--) {
tk_name[TK_INDEX] = n;
diff --git a/ext/tk/tcltklib.c b/ext/tk/tcltklib.c
index 02571d62fb..c67b0207c5 100644
--- a/ext/tk/tcltklib.c
+++ b/ext/tk/tcltklib.c
@@ -19,12 +19,13 @@
#define RUBY_RELEASE_DATE "unknown release-date"
#endif
-#ifdef RUBY_VM
+#ifdef HAVE_RB_THREAD_CHECK_TRAP_PENDING
static int rb_thread_critical; /* dummy */
int rb_thread_check_trap_pending();
#else
/* use rb_thread_critical on Ruby 1.8.x */
#include "rubysig.h"
+#define rb_thread_check_trap_pending() (0+rb_trap_pending)
#endif
#if !defined(RSTRING_PTR)
@@ -268,6 +269,10 @@ static CONST86 Tcl_ObjType *Tcl_ObjType_String;
#define rb_hash_lookup rb_hash_aref
#endif
+#ifndef HAVE_RB_THREAD_ALIVE_P
+#define rb_thread_alive_p(thread) rb_funcall2((thread), ID_alive_p, 0, NULL)
+#endif
+
/* safe Tcl_Eval and Tcl_GlobalEval */
static int
#ifdef HAVE_PROTOTYPES
@@ -843,15 +848,14 @@ create_ip_exc(interp, exc, fmt, va_alist)
#endif
{
va_list args;
- char buf[BUFSIZ];
+ VALUE msg;
VALUE einfo;
struct tcltkip *ptr = get_ip(interp);
va_init_list(args,fmt);
- vsnprintf(buf, BUFSIZ, fmt, args);
- buf[BUFSIZ - 1] = '\0';
+ msg = rb_vsprintf(fmt, args);
va_end(args);
- einfo = rb_exc_new2(exc, buf);
+ einfo = rb_exc_new_str(exc, msg);
rb_ivar_set(einfo, ID_at_interp, interp);
if (ptr) {
Tcl_ResetResult(ptr->ip);
@@ -1371,7 +1375,7 @@ tcltkip_init_tk(interp)
}
-/* treat excetiopn on Tcl side */
+/* treat exception on Tcl side */
static VALUE rbtk_pending_exception;
static int rbtk_eventloop_depth = 0;
static int rbtk_internal_eventloop_handler = 0;
@@ -1663,7 +1667,6 @@ set_eventloop_window_mode(self, mode)
VALUE self;
VALUE mode;
{
- rb_secure(4);
if (RTEST(mode)) {
window_event_mode = ~0;
@@ -1693,7 +1696,6 @@ set_eventloop_tick(self, tick)
int ttick = NUM2INT(tick);
int thr_crit_bup;
- rb_secure(4);
if (ttick < 0) {
rb_raise(rb_eArgError,
@@ -1760,7 +1762,6 @@ set_no_event_wait(self, wait)
{
int t_wait = NUM2INT(wait);
- rb_secure(4);
if (t_wait <= 0) {
rb_raise(rb_eArgError,
@@ -1814,7 +1815,6 @@ set_eventloop_weight(self, loop_max, no_event)
int lpmax = NUM2INT(loop_max);
int no_ev = NUM2INT(no_event);
- rb_secure(4);
if (lpmax <= 0 || no_ev <= 0) {
rb_raise(rb_eArgError, "weight parameters must be positive numbers");
@@ -1933,7 +1933,6 @@ static VALUE
lib_evloop_abort_on_exc_set(self, val)
VALUE self, val;
{
- rb_secure(4);
if (RTEST(val)) {
event_loop_abort_on_exc = 1;
} else if (NIL_P(val)) {
@@ -1950,7 +1949,6 @@ ip_evloop_abort_on_exc_set(self, val)
{
struct tcltkip *ptr = get_ip(self);
- rb_secure(4);
/* ip is deleted? */
if (deleted_ip(ptr)) {
@@ -2081,9 +2079,9 @@ eventloop_sleep(dummy)
#endif
#endif
- DUMP2("eventloop_sleep: rb_thread_wait_for() at thread : %lx", rb_thread_current());
+ DUMP2("eventloop_sleep: rb_thread_wait_for() at thread : %"PRIxVALUE, rb_thread_current());
rb_thread_wait_for(t);
- DUMP2("eventloop_sleep: finish at thread : %lx", rb_thread_current());
+ DUMP2("eventloop_sleep: finish at thread : %"PRIxVALUE, rb_thread_current());
#ifdef HAVE_NATIVETHREAD
#ifndef RUBY_USE_NATIVE_THREAD
@@ -2192,18 +2190,24 @@ lib_eventloop_core(check_root, update_flag, check_var, interp)
volatile VALUE current = eventloop_thread;
int found_event = 1;
int event_flag;
+#if 0
struct timeval t;
+#endif
int thr_crit_bup;
int status;
int depth = rbtk_eventloop_depth;
#if USE_EVLOOP_THREAD_ALONE_CHECK_FLAG
int thread_alone_check_flag = 1;
+#else
+ enum {thread_alone_check_flag = 1};
#endif
if (update_flag) DUMP1("update loop start!!");
+#if 0
t.tv_sec = 0;
t.tv_usec = 1000 * no_event_wait;
+#endif
Tcl_DeleteTimerHandler(timer_token);
run_timer_flag = 0;
@@ -2225,11 +2229,7 @@ lib_eventloop_core(check_root, update_flag, check_var, interp)
for(;;) {
if (check_eventloop_interp()) return 0;
-#if USE_EVLOOP_THREAD_ALONE_CHECK_FLAG
if (thread_alone_check_flag && rb_thread_alone()) {
-#else
- if (rb_thread_alone()) {
-#endif
DUMP1("no other thread");
event_loop_wait_event = 0;
@@ -2498,8 +2498,8 @@ lib_eventloop_core(check_root, update_flag, check_var, interp)
}
} else {
- DUMP2("sleep eventloop %lx", current);
- DUMP2("eventloop thread is %lx", eventloop_thread);
+ DUMP2("sleep eventloop %"PRIxVALUE, current);
+ DUMP2("eventloop thread is %"PRIxVALUE, eventloop_thread);
/* rb_thread_stop(); */
rb_thread_sleep_forever();
}
@@ -2620,10 +2620,10 @@ lib_eventloop_ensure(args)
Tcl_DeleteEventSource(rbtk_EventSetupProc, rbtk_EventCheckProc, (ClientData)args);
- DUMP2("eventloop_ensure: current-thread : %lx", current_evloop);
- DUMP2("eventloop_ensure: eventloop-thread : %lx", eventloop_thread);
+ DUMP2("eventloop_ensure: current-thread : %"PRIxVALUE, current_evloop);
+ DUMP2("eventloop_ensure: eventloop-thread : %"PRIxVALUE, eventloop_thread);
if (eventloop_thread != current_evloop) {
- DUMP2("finish eventloop %lx (NOT current eventloop)", current_evloop);
+ DUMP2("finish eventloop %"PRIxVALUE" (NOT current eventloop)", current_evloop);
rb_thread_critical = ptr->thr_crit_bup;
@@ -2634,12 +2634,12 @@ lib_eventloop_ensure(args)
}
while((eventloop_thread = rb_ary_pop(eventloop_stack))) {
- DUMP2("eventloop-ensure: new eventloop-thread -> %lx",
+ DUMP2("eventloop-ensure: new eventloop-thread -> %"PRIxVALUE,
eventloop_thread);
if (eventloop_thread == current_evloop) {
rbtk_eventloop_depth--;
- DUMP2("eventloop %lx : back from recursive call", current_evloop);
+ DUMP2("eventloop %"PRIxVALUE" : back from recursive call", current_evloop);
break;
}
@@ -2650,12 +2650,8 @@ lib_eventloop_ensure(args)
break;
}
-#ifdef RUBY_VM
- if (RTEST(rb_funcall(eventloop_thread, ID_alive_p, 0, 0))) {
-#else
if (RTEST(rb_thread_alive_p(eventloop_thread))) {
-#endif
- DUMP2("eventloop-enshure: wake up parent %lx", eventloop_thread);
+ DUMP2("eventloop-enshure: wake up parent %"PRIxVALUE, eventloop_thread);
rb_thread_wakeup(eventloop_thread);
break;
@@ -2673,7 +2669,7 @@ lib_eventloop_ensure(args)
xfree(ptr);
/* ckfree((char*)ptr);*/
- DUMP2("finish current eventloop %lx", current_evloop);
+ DUMP2("finish current eventloop %"PRIxVALUE, current_evloop);
return Qnil;
}
@@ -2696,14 +2692,14 @@ lib_eventloop_launcher(check_root, update_flag, check_var, interp)
#endif
if (parent_evloop == eventloop_thread) {
- DUMP2("eventloop: recursive call on %lx", parent_evloop);
+ DUMP2("eventloop: recursive call on %"PRIxVALUE, parent_evloop);
rbtk_eventloop_depth++;
}
if (!NIL_P(parent_evloop) && parent_evloop != eventloop_thread) {
- DUMP2("wait for stop of parent_evloop %lx", parent_evloop);
+ DUMP2("wait for stop of parent_evloop %"PRIxVALUE, parent_evloop);
while(!RTEST(rb_funcall(parent_evloop, ID_stop_p, 0))) {
- DUMP2("parent_evloop %lx doesn't stop", parent_evloop);
+ DUMP2("parent_evloop %"PRIxVALUE" doesn't stop", parent_evloop);
rb_thread_run(parent_evloop);
}
DUMP1("succeed to stop parent");
@@ -2711,7 +2707,7 @@ lib_eventloop_launcher(check_root, update_flag, check_var, interp)
rb_ary_push(eventloop_stack, parent_evloop);
- DUMP3("tcltklib: eventloop-thread : %lx -> %lx\n",
+ DUMP3("tcltklib: eventloop-thread : %"PRIxVALUE" -> %"PRIxVALUE"\n",
parent_evloop, eventloop_thread);
args->check_root = check_root;
@@ -2817,11 +2813,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 %lx is sleeping or dead",
+ DUMP2("eventloop thread %"PRIxVALUE" is sleeping or dead",
eventloop_thread);
evloop = rb_thread_create(watchdog_evloop_launcher,
(void*)&check_rootwidget);
- DUMP2("create new eventloop thread %lx", evloop);
+ DUMP2("create new eventloop thread %"PRIxVALUE, evloop);
loop_counter = -1;
chance = 0;
rb_thread_run(evloop);
@@ -2959,7 +2955,7 @@ lib_thread_callback(argc, argv, self)
{
struct thread_call_proc_arg *q;
VALUE proc, th, ret;
- int status, foundEvent;
+ int status;
if (rb_scan_args(argc, argv, "01", &proc) == 0) {
proc = rb_block_proc();
@@ -2978,14 +2974,10 @@ lib_thread_callback(argc, argv, self)
rb_thread_schedule();
/* start sub-eventloop */
- foundEvent = RTEST(lib_eventloop_launcher(/* not check root-widget */0, 0,
- q->done, (Tcl_Interp*)NULL));
+ lib_eventloop_launcher(/* not check root-widget */0, 0,
+ q->done, (Tcl_Interp*)NULL);
-#ifdef RUBY_VM
- if (RTEST(rb_funcall(th, ID_alive_p, 0))) {
-#else
if (RTEST(rb_thread_alive_p(th))) {
-#endif
rb_funcall(th, ID_kill, 0);
ret = Qnil;
} else {
@@ -3118,7 +3110,7 @@ ip_set_exc_message(interp, exc)
}
if (NIL_P(enc)) {
encoding = (Tcl_Encoding)NULL;
- } else if (TYPE(enc) == T_STRING) {
+ } else if (RB_TYPE_P(enc, T_STRING)) {
/* encoding = Tcl_GetEncoding(interp, RSTRING_PTR(enc)); */
encoding = Tcl_GetEncoding((Tcl_Interp*)NULL, RSTRING_PTR(enc));
} else {
@@ -3328,7 +3320,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 (TYPE(reason) == T_SYMBOL) {
+ if (RB_TYPE_P(reason, T_SYMBOL)) {
if (SYM2ID(reason) == ID_return)
return TCL_RETURN;
@@ -3481,7 +3473,7 @@ 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:%lx", ret);
+ DUMP2("rb_apply return:%"PRIxVALUE, ret);
rb_thread_critical = thr_crit_bup;
DUMP1("finish ip_ruby_cmd_core");
@@ -3791,7 +3783,7 @@ ip_RubyExitCommand(clientData, interp, argc, argv)
#endif
if (argc < 1 || argc > 2) {
- /* arguemnt error */
+ /* argument error */
Tcl_AppendResult(interp,
"wrong number of arguments: should be \"",
cmd, " ?returnCode?\"", (char *)NULL);
@@ -3888,8 +3880,6 @@ ip_rbUpdateCommand(clientData, interp, objc, objv)
char *objv[];
#endif
{
- int optionIndex;
- int ret;
int flags = 0;
static CONST char *updateOptions[] = {"idletasks", (char *) NULL};
enum updateOptions {REGEXP_IDLETASKS};
@@ -3915,6 +3905,7 @@ ip_rbUpdateCommand(clientData, interp, objc, objv)
} else if (objc == 2) {
#if TCL_MAJOR_VERSION >= 8
+ int optionIndex;
if (Tcl_GetIndexFromObj(interp, objv[1], (CONST84 char **)updateOptions,
"option", 0, &optionIndex) != TCL_OK) {
return TCL_ERROR;
@@ -3958,7 +3949,7 @@ ip_rbUpdateCommand(clientData, interp, objc, objv)
/* call eventloop */
/* ret = lib_eventloop_core(0, flags, (int *)NULL);*/ /* ignore result */
- ret = RTEST(lib_eventloop_launcher(0, flags, (int *)NULL, interp)); /* ignore result */
+ lib_eventloop_launcher(0, flags, (int *)NULL, interp); /* ignore result */
/* exception check */
if (!NIL_P(rbtk_pending_exception)) {
@@ -3976,11 +3967,7 @@ ip_rbUpdateCommand(clientData, interp, objc, objv)
}
/* trap check */
-#ifdef RUBY_VM
if (rb_thread_check_trap_pending()) {
-#else
- if (rb_trap_pending) {
-#endif
Tcl_Release(interp);
return TCL_RETURN;
@@ -4042,8 +4029,9 @@ ip_rb_threadUpdateCommand(clientData, interp, objc, objv)
char *objv[];
#endif
{
- int optionIndex;
+# if 0
int flags = 0;
+# endif
struct th_update_param *param;
static CONST char *updateOptions[] = {"idletasks", (char *) NULL};
enum updateOptions {REGEXP_IDLETASKS};
@@ -4080,17 +4068,21 @@ ip_rb_threadUpdateCommand(clientData, interp, objc, objv)
Tcl_ResetResult(interp);
if (objc == 1) {
+# if 0
flags = TCL_DONT_WAIT;
-
+# endif
} else if (objc == 2) {
#if TCL_MAJOR_VERSION >= 8
+ int optionIndex;
if (Tcl_GetIndexFromObj(interp, objv[1], (CONST84 char **)updateOptions,
"option", 0, &optionIndex) != TCL_OK) {
return TCL_ERROR;
}
switch ((enum updateOptions) optionIndex) {
case REGEXP_IDLETASKS: {
+# if 0
flags = TCL_IDLE_EVENTS;
+# endif
break;
}
default: {
@@ -4103,7 +4095,9 @@ ip_rb_threadUpdateCommand(clientData, interp, objc, objv)
"\": must be idletasks", (char *) NULL);
return TCL_ERROR;
}
+# if 0
flags = TCL_IDLE_EVENTS;
+# endif
#endif
} else {
#ifdef Tcl_WrongNumArgs
@@ -4354,11 +4348,7 @@ ip_rbVwaitCommand(clientData, interp, objc, objv)
}
/* trap check */
-#ifdef RUBY_VM
if (rb_thread_check_trap_pending()) {
-#else
- if (rb_trap_pending) {
-#endif
#if TCL_MAJOR_VERSION >= 8
Tcl_DecrRefCount(objv[1]);
#endif
@@ -4647,11 +4637,7 @@ ip_rbTkWaitCommand(clientData, interp, objc, objv)
}
/* trap check */
-#ifdef RUBY_VM
if (rb_thread_check_trap_pending()) {
-#else
- if (rb_trap_pending) {
-#endif
Tcl_Release(interp);
return TCL_RETURN;
@@ -4711,11 +4697,7 @@ ip_rbTkWaitCommand(clientData, interp, objc, objv)
}
/* trap check */
-#ifdef RUBY_VM
if (rb_thread_check_trap_pending()) {
-#else
- if (rb_trap_pending) {
-#endif
#if TCL_MAJOR_VERSION >= 8
Tcl_DecrRefCount(objv[2]);
#endif
@@ -4810,11 +4792,7 @@ ip_rbTkWaitCommand(clientData, interp, objc, objv)
}
/* trap check */
-#ifdef RUBY_VM
if (rb_thread_check_trap_pending()) {
-#else
- if (rb_trap_pending) {
-#endif
Tcl_Release(interp);
return TCL_RETURN;
@@ -5109,8 +5087,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 %lx", eventloop_thread);
- DUMP2("current_thread %lx", current_thread);
+ DUMP2("eventloop_thread %"PRIxVALUE, eventloop_thread);
+ DUMP2("current_thread %"PRIxVALUE, current_thread);
return ip_rbTkWaitObjCmd(clientData, interp, objc, objv);
#else /* TCL_MAJOR_VERSION < 8 */
DUMP1("call rb_VwaitCommand");
@@ -5827,7 +5805,7 @@ ip_free(ptr)
{
int thr_crit_bup;
- DUMP2("free Tcl Interp %lx", (unsigned long)ptr->ip);
+ DUMP2("free Tcl Interp %p", ptr->ip);
if (ptr) {
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
@@ -5836,10 +5814,10 @@ ip_free(ptr)
&& !Tcl_InterpDeleted(ptr->ip)
&& Tcl_GetMaster(ptr->ip) != (Tcl_Interp*)NULL
&& !Tcl_InterpDeleted(Tcl_GetMaster(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);
+ DUMP2("parent IP(%p) is not deleted",
+ Tcl_GetMaster(ptr->ip));
+ DUMP2("slave IP(%p) should not be deleted",
+ ptr->ip);
xfree(ptr);
/* ckfree((char*)ptr); */
rb_thread_critical = thr_crit_bup;
@@ -6267,7 +6245,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 temporaly hiding ::chan. */
+ /* So, force to use ::rechan by temporarily hiding ::chan. */
/*************************************************************************/
Tcl_Eval(ptr->ip, "catch {rename ::chan ::_tmp_chan}");
if (Tcl_Init(ptr->ip) == TCL_ERROR) {
@@ -6418,7 +6396,6 @@ ip_create_slave_core(interp, argc, argv)
safe = 1;
} else if (safemode == Qfalse || NIL_P(safemode)) {
safe = 0;
- /* rb_secure(4); */ /* already checked */
} else {
safe = 1;
}
@@ -6525,7 +6502,6 @@ ip_create_slave(argc, argv, self)
}
if (Tcl_IsSafe(master->ip) != 1
&& (safemode == Qfalse || NIL_P(safemode))) {
- rb_secure(4);
}
StringValue(name);
@@ -6651,7 +6627,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,
+ return create_ip_exc(interp, rb_eRuntimeError, "%s",
Tcl_GetStringResult(ptr->ip));
}
@@ -6732,7 +6708,6 @@ ip_allow_ruby_exit_set(self, val)
struct tcltkip *ptr = get_ip(self);
Tk_Window mainWin;
- rb_secure(4);
/* ip is deleted? */
if (deleted_ip(ptr)) {
@@ -7006,8 +6981,8 @@ call_queue_handler(evPtr, flags)
struct tcltkip *ptr;
DUMP2("do_call_queue_handler : evPtr = %p", evPtr);
- DUMP2("call_queue_handler thread : %lx", rb_thread_current());
- DUMP2("added by thread : %lx", thread);
+ DUMP2("call_queue_handler thread : %"PRIxVALUE, rb_thread_current());
+ DUMP2("added by thread : %"PRIxVALUE, thread);
if (*(q->done)) {
DUMP1("processed by another event-loop");
@@ -7016,13 +6991,8 @@ call_queue_handler(evPtr, flags)
DUMP1("process it on current event-loop");
}
-#ifdef RUBY_VM
- if (RTEST(rb_funcall(thread, ID_alive_p, 0))
- && ! RTEST(rb_funcall(thread, ID_stop_p, 0))) {
-#else
if (RTEST(rb_thread_alive_p(thread))
&& ! RTEST(rb_funcall(thread, ID_stop_p, 0))) {
-#endif
DUMP1("caller is not yet ready to receive the result -> pending");
return 0;
}
@@ -7049,8 +7019,8 @@ call_queue_handler(evPtr, flags)
rb_gc_force_recycle(q_dat);
q_dat = (VALUE)NULL;
} else {
- DUMP2("call function (for caller thread:%lx)", thread);
- DUMP2("call function (current thread:%lx)", rb_thread_current());
+ DUMP2("call function (for caller thread:%"PRIxVALUE")", thread);
+ DUMP2("call function (current thread:%"PRIxVALUE")", rb_thread_current());
ret = (q->func)(q->interp, q->argc, q->argv);
}
@@ -7071,13 +7041,9 @@ call_queue_handler(evPtr, flags)
q->thread = (VALUE)NULL;
/* back to caller */
-#ifdef RUBY_VM
- if (RTEST(rb_funcall(thread, ID_alive_p, 0, 0))) {
-#else
if (RTEST(rb_thread_alive_p(thread))) {
-#endif
- DUMP2("back to caller (caller thread:%lx)", thread);
- DUMP2(" (current thread:%lx)", rb_thread_current());
+ DUMP2("back to caller (caller thread:%"PRIxVALUE")", thread);
+ DUMP2(" (current thread:%"PRIxVALUE")", rb_thread_current());
#if CONTROL_BY_STATUS_OF_RB_THREAD_WAITING_FOR_VALUE
have_rb_thread_waiting_for_value = 1;
rb_thread_wakeup(thread);
@@ -7089,8 +7055,8 @@ call_queue_handler(evPtr, flags)
rb_thread_schedule();
#endif
} else {
- DUMP2("caller is dead (caller thread:%lx)", thread);
- DUMP2(" (current thread:%lx)", rb_thread_current());
+ DUMP2("caller is dead (caller thread:%"PRIxVALUE")", thread);
+ DUMP2(" (current thread:%"PRIxVALUE")", rb_thread_current());
}
/* end of handler : remove it */
@@ -7140,9 +7106,9 @@ tk_funcall(func, argc, argv, obj)
&& (NIL_P(eventloop_thread) || current == eventloop_thread)
) {
if (NIL_P(eventloop_thread)) {
- DUMP2("tk_funcall from thread:%lx but no eventloop", current);
+ DUMP2("tk_funcall from thread:%"PRIxVALUE" but no eventloop", current);
} else {
- DUMP2("tk_funcall from current eventloop %lx", current);
+ DUMP2("tk_funcall from current eventloop %"PRIxVALUE, current);
}
result = (func)(ip_obj, argc, argv);
if (rb_obj_is_kind_of(result, rb_eException)) {
@@ -7151,7 +7117,7 @@ tk_funcall(func, argc, argv, obj)
return result;
}
- DUMP2("tk_funcall from thread %lx (NOT current eventloop)", current);
+ DUMP2("tk_funcall from thread %"PRIxVALUE" (NOT current eventloop)", current);
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
@@ -7226,20 +7192,20 @@ 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:%lx)", current);
+ DUMP2("callq wait for handler (current thread:%"PRIxVALUE")", current);
while(*alloc_done >= 0) {
- DUMP2("*** callq wait for handler (current thread:%lx)", current);
+ DUMP2("*** callq wait for handler (current thread:%"PRIxVALUE")", current);
/* rb_thread_stop(); */
/* rb_thread_sleep_forever(); */
rb_thread_wait_for(t);
- DUMP2("*** callq wakeup (current thread:%lx)", current);
- DUMP2("*** (eventloop thread:%lx)", eventloop_thread);
+ DUMP2("*** callq wakeup (current thread:%"PRIxVALUE")", current);
+ DUMP2("*** (eventloop thread:%"PRIxVALUE")", eventloop_thread);
if (NIL_P(eventloop_thread)) {
DUMP1("*** callq lost eventloop thread");
break;
}
}
- DUMP2("back from handler (current thread:%lx)", current);
+ DUMP2("back from handler (current thread:%"PRIxVALUE")", current);
/* get result & free allocated memory */
ret = RARRAY_PTR(result)[0];
@@ -7502,8 +7468,8 @@ eval_queue_handler(evPtr, flags)
struct tcltkip *ptr;
DUMP2("do_eval_queue_handler : evPtr = %p", evPtr);
- DUMP2("eval_queue_thread : %lx", rb_thread_current());
- DUMP2("added by thread : %lx", thread);
+ DUMP2("eval_queue_thread : %"PRIxVALUE, rb_thread_current());
+ DUMP2("added by thread : %"PRIxVALUE, thread);
if (*(q->done)) {
DUMP1("processed by another event-loop");
@@ -7512,13 +7478,8 @@ eval_queue_handler(evPtr, flags)
DUMP1("process it on current event-loop");
}
-#ifdef RUBY_VM
- if (RTEST(rb_funcall(thread, ID_alive_p, 0))
- && ! RTEST(rb_funcall(thread, ID_stop_p, 0))) {
-#else
if (RTEST(rb_thread_alive_p(thread))
&& ! RTEST(rb_funcall(thread, ID_stop_p, 0))) {
-#endif
DUMP1("caller is not yet ready to receive the result -> pending");
return 0;
}
@@ -7571,13 +7532,9 @@ eval_queue_handler(evPtr, flags)
q->thread = (VALUE)NULL;
/* back to caller */
-#ifdef RUBY_VM
- if (RTEST(rb_funcall(thread, ID_alive_p, 0, 0))) {
-#else
if (RTEST(rb_thread_alive_p(thread))) {
-#endif
- DUMP2("back to caller (caller thread:%lx)", thread);
- DUMP2(" (current thread:%lx)", rb_thread_current());
+ DUMP2("back to caller (caller thread:%"PRIxVALUE")", thread);
+ DUMP2(" (current thread:%"PRIxVALUE")", rb_thread_current());
#if CONTROL_BY_STATUS_OF_RB_THREAD_WAITING_FOR_VALUE
have_rb_thread_waiting_for_value = 1;
rb_thread_wakeup(thread);
@@ -7589,8 +7546,8 @@ eval_queue_handler(evPtr, flags)
rb_thread_schedule();
#endif
} else {
- DUMP2("caller is dead (caller thread:%lx)", thread);
- DUMP2(" (current thread:%lx)", rb_thread_current());
+ DUMP2("caller is dead (caller thread:%"PRIxVALUE")", thread);
+ DUMP2(" (current thread:%"PRIxVALUE")", rb_thread_current());
}
/* end of handler : remove it */
@@ -7628,7 +7585,7 @@ ip_eval(self, str)
#else
DUMP2("status: Tcl_GetCurrentThread %p", Tcl_GetCurrentThread());
#endif
- DUMP2("status: eventloopt_thread %lx", eventloop_thread);
+ DUMP2("status: eventloopt_thread %"PRIxVALUE, eventloop_thread);
if (
#ifdef RUBY_USE_NATIVE_THREAD
@@ -7638,9 +7595,9 @@ ip_eval(self, str)
(NIL_P(eventloop_thread) || current == eventloop_thread)
) {
if (NIL_P(eventloop_thread)) {
- DUMP2("eval from thread:%lx but no eventloop", current);
+ DUMP2("eval from thread:%"PRIxVALUE" but no eventloop", current);
} else {
- DUMP2("eval from current eventloop %lx", current);
+ DUMP2("eval from current eventloop %"PRIxVALUE, current);
}
result = ip_eval_real(self, RSTRING_PTR(str), RSTRING_LENINT(str));
if (rb_obj_is_kind_of(result, rb_eException)) {
@@ -7649,7 +7606,7 @@ ip_eval(self, str)
return result;
}
- DUMP2("eval from thread %lx (NOT current eventloop)", current);
+ DUMP2("eval from thread %"PRIxVALUE" (NOT current eventloop)", current);
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
@@ -7719,20 +7676,20 @@ ip_eval(self, str)
t.tv_sec = 0;
t.tv_usec = (long)((EVENT_HANDLER_TIMEOUT)*1000.0);
- DUMP2("evq wait for handler (current thread:%lx)", current);
+ DUMP2("evq wait for handler (current thread:%"PRIxVALUE")", current);
while(*alloc_done >= 0) {
- DUMP2("*** evq wait for handler (current thread:%lx)", current);
+ DUMP2("*** evq wait for handler (current thread:%"PRIxVALUE")", current);
/* rb_thread_stop(); */
/* rb_thread_sleep_forever(); */
rb_thread_wait_for(t);
- DUMP2("*** evq wakeup (current thread:%lx)", current);
- DUMP2("*** (eventloop thread:%lx)", eventloop_thread);
+ DUMP2("*** evq wakeup (current thread:%"PRIxVALUE")", current);
+ DUMP2("*** (eventloop thread:%"PRIxVALUE")", eventloop_thread);
if (NIL_P(eventloop_thread)) {
DUMP1("*** evq lost eventloop thread");
break;
}
}
- DUMP2("back from handler (current thread:%lx)", current);
+ DUMP2("back from handler (current thread:%"PRIxVALUE")", current);
/* get result & free allocated memory */
ret = RARRAY_PTR(result)[0];
@@ -7854,7 +7811,6 @@ lib_restart_core(interp, argc, argv)
struct tcltkip *ptr = get_ip(interp);
int thr_crit_bup;
- /* rb_secure(4); */ /* already checked */
/* tcl_stubs_check(); */ /* already checked */
@@ -7912,7 +7868,6 @@ lib_restart(self)
{
struct tcltkip *ptr = get_ip(self);
- rb_secure(4);
tcl_stubs_check();
@@ -7931,7 +7886,6 @@ ip_restart(self)
{
struct tcltkip *ptr = get_ip(self);
- rb_secure(4);
tcl_stubs_check();
@@ -7956,7 +7910,9 @@ lib_toUTF8_core(ip_obj, src, encodename)
volatile VALUE str = src;
#ifdef TCL_UTF_MAX
+# if 0
Tcl_Interp *interp;
+# endif
Tcl_Encoding encoding;
Tcl_DString dstr;
int taint_flag = OBJ_TAINTED(str);
@@ -7973,15 +7929,19 @@ lib_toUTF8_core(ip_obj, src, encodename)
#ifdef TCL_UTF_MAX
if (NIL_P(ip_obj)) {
+# if 0
interp = (Tcl_Interp *)NULL;
+# endif
} else {
ptr = get_ip(ip_obj);
/* ip is deleted? */
if (deleted_ip(ptr)) {
+# if 0
interp = (Tcl_Interp *)NULL;
} else {
interp = ptr->ip;
+# endif
}
}
@@ -7989,7 +7949,7 @@ lib_toUTF8_core(ip_obj, src, encodename)
rb_thread_critical = Qtrue;
if (NIL_P(encodename)) {
- if (TYPE(str) == T_STRING) {
+ if (RB_TYPE_P(str, T_STRING)) {
volatile VALUE enc;
#ifdef HAVE_RUBY_ENCODING_H
@@ -8167,7 +8127,7 @@ lib_fromUTF8_core(ip_obj, src, encodename)
if (NIL_P(encodename)) {
volatile VALUE enc;
- if (TYPE(str) == T_STRING) {
+ if (RB_TYPE_P(str, T_STRING)) {
enc = rb_attr_get(str, ID_at_enc);
if (!NIL_P(enc)) {
StringValue(enc);
@@ -8573,7 +8533,6 @@ ip_invoke_core(interp, argc, argv)
#if 1 /* wrap tcl-proc call */
struct invoke_info inf;
int status;
- VALUE ret;
#else
#if TCL_MAJOR_VERSION >= 8
int argc = objc;
@@ -8685,7 +8644,7 @@ ip_invoke_core(interp, argc, argv)
#endif
/* invoke tcl-proc */
- ret = rb_protect(invoke_tcl_proc, (VALUE)&inf, &status);
+ rb_protect(invoke_tcl_proc, (VALUE)&inf, &status);
switch(status) {
case TAG_RAISE:
if (NIL_P(rb_errinfo())) {
@@ -8945,7 +8904,7 @@ ip_invoke_real(argc, argv, interp)
char **av = (char **)NULL;
#endif
- DUMP2("invoke_real called by thread:%lx", rb_thread_current());
+ DUMP2("invoke_real called by thread:%"PRIxVALUE, rb_thread_current());
/* get the data struct */
ptr = get_ip(interp);
@@ -8994,8 +8953,8 @@ invoke_queue_handler(evPtr, flags)
struct tcltkip *ptr;
DUMP2("do_invoke_queue_handler : evPtr = %p", evPtr);
- DUMP2("invoke queue_thread : %lx", rb_thread_current());
- DUMP2("added by thread : %lx", thread);
+ DUMP2("invoke queue_thread : %"PRIxVALUE, rb_thread_current());
+ DUMP2("added by thread : %"PRIxVALUE, thread);
if (*(q->done)) {
DUMP1("processed by another event-loop");
@@ -9004,13 +8963,8 @@ invoke_queue_handler(evPtr, flags)
DUMP1("process it on current event-loop");
}
-#ifdef RUBY_VM
- if (RTEST(rb_funcall(thread, ID_alive_p, 0))
- && ! RTEST(rb_funcall(thread, ID_stop_p, 0))) {
-#else
if (RTEST(rb_thread_alive_p(thread))
&& ! RTEST(rb_funcall(thread, ID_stop_p, 0))) {
-#endif
DUMP1("caller is not yet ready to receive the result -> pending");
return 0;
}
@@ -9037,8 +8991,8 @@ invoke_queue_handler(evPtr, flags)
rb_gc_force_recycle(q_dat);
q_dat = (VALUE)NULL;
} else {
- DUMP2("call invoke_real (for caller thread:%lx)", thread);
- DUMP2("call invoke_real (current thread:%lx)", rb_thread_current());
+ DUMP2("call invoke_real (for caller thread:%"PRIxVALUE")", thread);
+ DUMP2("call invoke_real (current thread:%"PRIxVALUE")", rb_thread_current());
ret = ip_invoke_core(q->interp, q->argc, q->argv);
}
@@ -9058,13 +9012,9 @@ invoke_queue_handler(evPtr, flags)
q->thread = (VALUE)NULL;
/* back to caller */
-#ifdef RUBY_VM
- if (RTEST(rb_funcall(thread, ID_alive_p, 0, 0))) {
-#else
if (RTEST(rb_thread_alive_p(thread))) {
-#endif
- DUMP2("back to caller (caller thread:%lx)", thread);
- DUMP2(" (current thread:%lx)", rb_thread_current());
+ DUMP2("back to caller (caller thread:%"PRIxVALUE")", thread);
+ DUMP2(" (current thread:%"PRIxVALUE")", rb_thread_current());
#if CONTROL_BY_STATUS_OF_RB_THREAD_WAITING_FOR_VALUE
have_rb_thread_waiting_for_value = 1;
rb_thread_wakeup(thread);
@@ -9076,8 +9026,8 @@ invoke_queue_handler(evPtr, flags)
rb_thread_schedule();
#endif
} else {
- DUMP2("caller is dead (caller thread:%lx)", thread);
- DUMP2(" (current thread:%lx)", rb_thread_current());
+ DUMP2("caller is dead (caller thread:%"PRIxVALUE")", thread);
+ DUMP2(" (current thread:%"PRIxVALUE")", rb_thread_current());
}
/* end of handler : remove it */
@@ -9120,7 +9070,7 @@ ip_invoke_with_position(argc, argv, obj, position)
#else
DUMP2("status: Tcl_GetCurrentThread %p", Tcl_GetCurrentThread());
#endif
- DUMP2("status: eventloopt_thread %lx", eventloop_thread);
+ DUMP2("status: eventloopt_thread %"PRIxVALUE, eventloop_thread);
if (
#ifdef RUBY_USE_NATIVE_THREAD
@@ -9130,9 +9080,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:%lx but no eventloop", current);
+ DUMP2("invoke from thread:%"PRIxVALUE" but no eventloop", current);
} else {
- DUMP2("invoke from current eventloop %lx", current);
+ DUMP2("invoke from current eventloop %"PRIxVALUE, current);
}
result = ip_invoke_real(argc, argv, ip_obj);
if (rb_obj_is_kind_of(result, rb_eException)) {
@@ -9141,7 +9091,7 @@ ip_invoke_with_position(argc, argv, obj, position)
return result;
}
- DUMP2("invoke from thread %lx (NOT current eventloop)", current);
+ DUMP2("invoke from thread %"PRIxVALUE" (NOT current eventloop)", current);
thr_crit_bup = rb_thread_critical;
rb_thread_critical = Qtrue;
@@ -9205,19 +9155,19 @@ 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:%lx)", current);
+ DUMP2("ivq wait for handler (current thread:%"PRIxVALUE")", current);
while(*alloc_done >= 0) {
/* rb_thread_stop(); */
/* rb_thread_sleep_forever(); */
rb_thread_wait_for(t);
- DUMP2("*** ivq wakeup (current thread:%lx)", current);
- DUMP2("*** (eventloop thread:%lx)", eventloop_thread);
+ DUMP2("*** ivq wakeup (current thread:%"PRIxVALUE")", current);
+ DUMP2("*** (eventloop thread:%"PRIxVALUE")", eventloop_thread);
if (NIL_P(eventloop_thread)) {
DUMP1("*** ivq lost eventloop thread");
break;
}
}
- DUMP2("back from handler (current thread:%lx)", current);
+ DUMP2("back from handler (current thread:%"PRIxVALUE")", current);
/* get result & free allocated memory */
ret = RARRAY_PTR(result)[0];
@@ -9294,7 +9244,6 @@ ip_invoke_immediate(argc, argv, obj)
VALUE obj;
{
/* POTENTIALY INSECURE : can create infinite loop */
- rb_secure(4);
return ip_invoke_with_position(argc, argv, obj, TCL_QUEUE_HEAD);
}
@@ -9343,7 +9292,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,
+ exc = create_ip_exc(interp, rb_eRuntimeError, "%s",
Tcl_GetStringResult(ptr->ip));
/* Tcl_Release(ptr->ip); */
rbtk_release_ip(ptr);
@@ -9482,7 +9431,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,
+ exc = create_ip_exc(interp, rb_eRuntimeError, "%s",
Tcl_GetStringResult(ptr->ip));
/* Tcl_Release(ptr->ip); */
rbtk_release_ip(ptr);
@@ -9602,7 +9551,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,
+ return create_ip_exc(interp, rb_eRuntimeError, "%s",
Tcl_GetStringResult(ptr->ip));
}
return Qfalse;
@@ -10098,7 +10047,6 @@ create_dummy_encoding_for_tk_core(interp, name, error_mode)
{
get_ip(interp);
- rb_secure(4);
StringValue(name);
@@ -10556,7 +10504,6 @@ create_encoding_table_core(arg, interp)
Tcl_Obj **objv;
Tcl_Obj *enc_list;
- rb_secure(4);
/* set 'binary' encoding */
rb_hash_aset(table, ENCODING_NAME_BINARY, ENCODING_NAME_BINARY);
@@ -10592,7 +10539,6 @@ create_encoding_table_core(arg, interp)
VALUE interp;
{
volatile VALUE table = rb_hash_new();
- rb_secure(4);
rb_ivar_set(interp, ID_encoding_table, table);
return table;
}
@@ -10902,7 +10848,9 @@ Init_tcltklib()
ID_encoding_table = rb_intern("encoding_table");
ID_stop_p = rb_intern("stop?");
+#ifndef HAVE_RB_THREAD_ALIVE_P
ID_alive_p = rb_intern("alive?");
+#endif
ID_kill = rb_intern("kill");
ID_join = rb_intern("join");
ID_value = rb_intern("value");
@@ -11065,7 +11013,7 @@ Init_tcltklib()
/* --------------------------------------------------------------- */
#ifdef HAVE_NATIVETHREAD
- /* if ruby->nativethread-supprt and tcltklib->doen't,
+ /* if ruby->nativethread-support and tcltklib->doesn'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 57de973c0a..9ffde75657 100644
--- a/ext/tk/tkutil/extconf.rb
+++ b/ext/tk/tkutil/extconf.rb
@@ -1,11 +1,4 @@
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")
diff --git a/ext/tk/tkutil/tkutil.c b/ext/tk/tkutil/tkutil.c
index 88f1291006..cb387c5bd4 100644
--- a/ext/tk/tkutil/tkutil.c
+++ b/ext/tk/tkutil/tkutil.c
@@ -312,7 +312,7 @@ ary2list(ary, enc_flag, self)
if (NIL_P(enc_flag)) {
dst_enc = sys_enc;
req_chk_flag = 1;
- } else if (TYPE(enc_flag) == T_TRUE || TYPE(enc_flag) == T_FALSE) {
+ } else if (enc_flag == Qtrue || enc_flag == Qfalse) {
dst_enc = enc_flag;
req_chk_flag = 0;
} else {
@@ -323,7 +323,7 @@ ary2list(ary, enc_flag, self)
/* size = RARRAY_LEN(ary); */
size = 0;
for(idx = 0; idx < RARRAY_LEN(ary); idx++) {
- if (TYPE(RARRAY_PTR(ary)[idx]) == T_HASH) {
+ if (RB_TYPE_P(RARRAY_PTR(ary)[idx], T_HASH)) {
size += 2 * RHASH_SIZE(RARRAY_PTR(ary)[idx]);
} else {
size++;
@@ -433,7 +433,7 @@ ary2list(ary, enc_flag, self)
RARRAY_PTR(dst)[idx] = str_val;
}
val = rb_apply(cTclTkLib, ID_merge_tklist, dst);
- if (TYPE(dst_enc) == T_STRING) {
+ if (RB_TYPE_P(dst_enc, T_STRING)) {
val = rb_funcall(cTclTkLib, ID_fromUTF8, 2, val, dst_enc);
rb_ivar_set(val, ID_at_enc, dst_enc);
} else {
@@ -466,7 +466,7 @@ ary2list2(ary, enc_flag, self)
if (NIL_P(enc_flag)) {
dst_enc = sys_enc;
req_chk_flag = 1;
- } else if (TYPE(enc_flag) == T_TRUE || TYPE(enc_flag) == T_FALSE) {
+ } else if (enc_flag == Qtrue || enc_flag == Qfalse) {
dst_enc = enc_flag;
req_chk_flag = 0;
} else {
@@ -527,7 +527,7 @@ ary2list2(ary, enc_flag, self)
RARRAY_PTR(dst)[idx] = str_val;
}
val = rb_apply(cTclTkLib, ID_merge_tklist, dst);
- if (TYPE(dst_enc) == T_STRING) {
+ if (RB_TYPE_P(dst_enc, T_STRING)) {
val = rb_funcall(cTclTkLib, ID_fromUTF8, 2, val, dst_enc);
rb_ivar_set(val, ID_at_enc, dst_enc);
} else {
@@ -561,7 +561,7 @@ assoc2kv(assoc, ary, self)
for(i = 0; i < len; i++) {
pair = RARRAY_PTR(assoc)[i];
- if (TYPE(pair) != T_ARRAY) {
+ if (!RB_TYPE_P(pair, T_ARRAY)) {
rb_ary_push(dst, key2keyname(pair));
continue;
}
@@ -609,7 +609,7 @@ assoc2kv_enc(assoc, ary, self)
for(i = 0; i < len; i++) {
pair = RARRAY_PTR(assoc)[i];
- if (TYPE(pair) != T_ARRAY) {
+ if (!RB_TYPE_P(pair, T_ARRAY)) {
rb_ary_push(dst, key2keyname(pair));
continue;
}
@@ -831,15 +831,15 @@ 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_new2(rb_id2name(SYM2ID(obj))));
+ rb_str_dup(rb_sym2str(obj)));
} else {
- return fromDefaultEnc_toUTF8(rb_str_new2(rb_id2name(SYM2ID(obj))), self);
+ return fromDefaultEnc_toUTF8(rb_sym2str(obj), self);
}
} else {
#ifdef HAVE_RB_SYM_TO_S
return rb_sym_to_s(obj);
#else
- return rb_str_new2(rb_id2name(SYM2ID(obj)));
+ return rb_sym2str(obj);
#endif
}
@@ -897,8 +897,7 @@ get_eval_string_core(obj, enc_flag, self)
}
}
- rb_warning("fail to convert '%s' to string for Tk",
- RSTRING_PTR(rb_funcall(obj, rb_intern("inspect"), 0, 0)));
+ rb_warning("fail to convert '%+"PRIsVALUE"' to string for Tk", obj);
return obj;
}
@@ -936,7 +935,8 @@ tk_conv_args(argc, argv, self)
VALUE *argv; /* [0]:base_array, [1]:enc_mode, [2]..[n]:args */
VALUE self;
{
- int idx, size;
+ int idx;
+ long size;
volatile VALUE dst;
int thr_crit_bup;
VALUE old_gc;
@@ -950,7 +950,7 @@ tk_conv_args(argc, argv, self)
old_gc = rb_gc_disable();
for(size = 0, idx = 2; idx < argc; idx++) {
- if (TYPE(argv[idx]) == T_HASH) {
+ if (RB_TYPE_P(argv[idx], T_HASH)) {
size += 2 * RHASH_SIZE(argv[idx]);
} else {
size++;
@@ -959,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 (TYPE(argv[idx]) == T_HASH) {
+ if (RB_TYPE_P(argv[idx], T_HASH)) {
if (RTEST(argv[1])) {
hash2kv_enc(argv[idx], dst, self);
} else {
@@ -984,7 +984,7 @@ tcl2rb_bool(self, value)
VALUE self;
VALUE value;
{
- if (TYPE(value) == T_FIXNUM) {
+ if (RB_TYPE_P(value, T_FIXNUM)) {
if (NUM2INT(value) == 0) {
return Qfalse;
} else {
@@ -992,7 +992,7 @@ tcl2rb_bool(self, value)
}
}
- if (TYPE(value) == T_TRUE || TYPE(value) == T_FALSE) {
+ if (value == Qtrue || value == Qfalse) {
return value;
}
@@ -1247,7 +1247,7 @@ each_attr_def(key, value, klass)
switch(TYPE(key)) {
case T_STRING:
- key_id = rb_intern(RSTRING_PTR(key));
+ key_id = rb_intern_str(key);
break;
case T_SYMBOL:
key_id = SYM2ID(key);
@@ -1259,7 +1259,7 @@ each_attr_def(key, value, klass)
switch(TYPE(value)) {
case T_STRING:
- value_id = rb_intern(RSTRING_PTR(value));
+ value_id = rb_intern_str(value);
break;
case T_SYMBOL:
value_id = SYM2ID(value);
@@ -1281,7 +1281,7 @@ cbsubst_def_attr_aliases(self, tbl)
{
struct cbsubst_info *inf;
- if (TYPE(tbl) != T_HASH) {
+ if (!RB_TYPE_P(tbl, T_HASH)) {
rb_raise(rb_eArgError, "expected a Hash");
}
@@ -1299,25 +1299,25 @@ cbsubst_sym_to_subst(self, sym)
VALUE sym;
{
struct cbsubst_info *inf;
- const char *str;
+ VALUE str;
char *buf, *ptr;
int idx;
long len;
ID id;
volatile VALUE ret;
- if (TYPE(sym) != T_SYMBOL) return sym;
+ if (!RB_TYPE_P(sym, T_SYMBOL)) return sym;
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_id2name(SYM2ID(ret));
+ str = rb_sym2str(ret);
} else {
- str = rb_id2name(SYM2ID(sym));
+ str = rb_sym2str(sym);
}
- id = rb_intern(RSTRING_PTR(rb_str_cat2(rb_str_new2("@"), str)));
+ id = rb_intern_str(rb_sprintf("@%"PRIsVALUE, str));
for(idx = 0; idx < CBSUBST_TBL_MAX; idx++) {
if (inf->ivar[idx] == id) break;
@@ -1354,7 +1354,7 @@ cbsubst_get_subst_arg(argc, argv, self)
VALUE self;
{
struct cbsubst_info *inf;
- const char *str;
+ VALUE str;
char *buf, *ptr;
int i, idx;
long len;
@@ -1369,28 +1369,32 @@ cbsubst_get_subst_arg(argc, argv, self)
for(i = 0; i < argc; i++) {
switch(TYPE(argv[i])) {
case T_STRING:
- str = RSTRING_PTR(argv[i]);
- arg_sym = ID2SYM(rb_intern(str));
+ str = argv[i];
+ arg_sym = rb_check_symbol(&str);
+ if (NIL_P(arg_sym)) goto not_found;
break;
case T_SYMBOL:
arg_sym = argv[i];
- str = rb_id2name(SYM2ID(arg_sym));
+ str = rb_sym2str(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_id2name(SYM2ID(ret));
+ str = rb_sym2str(ret);
}
- id = rb_intern(RSTRING_PTR(rb_str_cat2(rb_str_new2("@"), str)));
+ ret = rb_sprintf("@%"PRIsVALUE, str);
+ id = rb_check_id(&ret);
+ if (!id) goto not_found;
for(idx = 0; idx < CBSUBST_TBL_MAX; idx++) {
if (inf->ivar[idx] == id) break;
}
if (idx >= CBSUBST_TBL_MAX) {
- rb_raise(rb_eArgError, "cannot find attribute :%s", str);
+ not_found:
+ rb_raise(rb_eArgError, "cannot find attribute :%"PRIsVALUE, str);
}
*(ptr++) = '%';
@@ -1556,14 +1560,14 @@ cbsubst_table_setup(argc, argv, self)
len = RARRAY_LEN(key_inf);
for(idx = 0; idx < len; idx++) {
inf = RARRAY_PTR(key_inf)[idx];
- if (TYPE(inf) != T_ARRAY) continue;
+ if (!RB_TYPE_P(inf, T_ARRAY)) continue;
- if (TYPE(RARRAY_PTR(inf)[0]) == T_STRING) {
+ if (RB_TYPE_P(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) {
+ if (RB_TYPE_P(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]);
@@ -1572,7 +1576,7 @@ cbsubst_table_setup(argc, argv, self)
subst_inf->full_subst_length += 3;
id = SYM2ID(RARRAY_PTR(inf)[2]);
- subst_inf->ivar[chr] = rb_intern(RSTRING_PTR(rb_str_cat2(rb_str_new2("@"), rb_id2name(id))));
+ subst_inf->ivar[chr] = rb_intern_str(rb_sprintf("@%"PRIsVALUE, rb_id2str(id)));
rb_attr(self, id, 1, 0, Qtrue);
}
@@ -1587,7 +1591,7 @@ cbsubst_table_setup(argc, argv, self)
len = RARRAY_LEN(longkey_inf);
for(idx = 0; idx < len; idx++) {
inf = RARRAY_PTR(longkey_inf)[idx];
- if (TYPE(inf) != T_ARRAY) continue;
+ if (!RB_TYPE_P(inf, T_ARRAY)) continue;
chr = (unsigned char)(0x80 + idx);
subst_inf->keylen[chr] = RSTRING_LEN(RARRAY_PTR(inf)[0]);
@@ -1602,7 +1606,7 @@ cbsubst_table_setup(argc, argv, self)
subst_inf->key[chr][RSTRING_LEN(RARRAY_PTR(inf)[0])] = '\0';
}
#endif
- if (TYPE(RARRAY_PTR(inf)[1]) == T_STRING) {
+ if (RB_TYPE_P(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]);
@@ -1611,7 +1615,7 @@ cbsubst_table_setup(argc, argv, self)
subst_inf->full_subst_length += (subst_inf->keylen[chr] + 2);
id = SYM2ID(RARRAY_PTR(inf)[2]);
- subst_inf->ivar[chr] = rb_intern(RSTRING_PTR(rb_str_cat2(rb_str_new2("@"), rb_id2name(id))));
+ subst_inf->ivar[chr] = rb_intern_str(rb_sprintf("@%"PRIsVALUE, rb_id2str(id)));
rb_attr(self, id, 1, 0, Qtrue);
}
@@ -1624,9 +1628,9 @@ cbsubst_table_setup(argc, argv, self)
len = RARRAY_LEN(proc_inf);
for(idx = 0; idx < len; idx++) {
inf = RARRAY_PTR(proc_inf)[idx];
- if (TYPE(inf) != T_ARRAY) continue;
+ if (!RB_TYPE_P(inf, T_ARRAY)) continue;
rb_hash_aset(subst_inf->proc,
- ((TYPE(RARRAY_PTR(inf)[0]) == T_STRING)?
+ (RB_TYPE_P(RARRAY_PTR(inf)[0], T_STRING)?
INT2FIX(*(RSTRING_PTR(RARRAY_PTR(inf)[0]))) :
RARRAY_PTR(inf)[0]),
RARRAY_PTR(inf)[1]);
diff --git a/ext/win32/extconf.rb b/ext/win32/extconf.rb
new file mode 100644
index 0000000000..7aa2c93684
--- /dev/null
+++ b/ext/win32/extconf.rb
@@ -0,0 +1,3 @@
+if (compiled?('dl') or compiled?('fiddle')) and $mswin||$mingw||$cygwin
+ create_makefile('win32')
+end
diff --git a/ext/dl/win32/lib/Win32API.rb b/ext/win32/lib/Win32API.rb
index 4d7d4887a5..4d7d4887a5 100644
--- a/ext/dl/win32/lib/Win32API.rb
+++ b/ext/win32/lib/Win32API.rb
diff --git a/ext/win32/lib/win32/importer.rb b/ext/win32/lib/win32/importer.rb
new file mode 100644
index 0000000000..5936bb6900
--- /dev/null
+++ b/ext/win32/lib/win32/importer.rb
@@ -0,0 +1,14 @@
+begin
+ require 'fiddle/import'
+ importer = Fiddle::Importer
+rescue LoadError
+ require 'dl/import'
+ importer = DL::Importer
+end
+
+module Win32
+end
+
+Win32.module_eval do
+ Importer = importer
+end
diff --git a/ext/dl/win32/lib/win32/registry.rb b/ext/win32/lib/win32/registry.rb
index 6edd85b8fb..74cc77dc9f 100644
--- a/ext/dl/win32/lib/win32/registry.rb
+++ b/ext/win32/lib/win32/registry.rb
@@ -1,11 +1,12 @@
-require 'dl/import'
+require 'win32/importer'
+
module Win32
=begin rdoc
= Win32 Registry
win32/registry is registry accessor library for Win32 platform.
-It uses dl/import to call Win32 Registry APIs.
+It uses importer to call Win32 Registry APIs.
== example
Win32::Registry::HKEY_CURRENT_USER.open('SOFTWARE\foo') do |reg|
@@ -63,6 +64,11 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
=end rdoc
+ WCHAR = Encoding::UTF_16LE
+ WCHAR_NUL = "\0".encode(WCHAR).freeze
+ WCHAR_SIZE = WCHAR_NUL.bytesize
+ LOCALE = Encoding.find(Encoding.locale_charmap)
+
class Registry
#
@@ -161,16 +167,16 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
#
class Error < ::StandardError
module Kernel32
- extend DL::Importer
+ extend Importer
dlload "kernel32.dll"
end
- FormatMessageA = Kernel32.extern "int FormatMessageA(int, void *, int, int, void *, int, void *)", :stdcall
+ FormatMessageW = Kernel32.extern "int FormatMessageW(int, void *, int, int, void *, int, void *)", :stdcall
def initialize(code)
@code = code
- msg = "\0".force_encoding(Encoding::ASCII_8BIT) * 1024
- len = FormatMessageA.call(0x1200, 0, code, 0, msg, 1024, 0)
- msg = msg[0, len].force_encoding(Encoding.find(Encoding.locale_charmap))
- super msg.tr("\r", '').chomp
+ 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
@@ -206,15 +212,16 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
# Win32 APIs
#
module API
- extend DL::Importer
+ include Constants
+ extend Importer
dlload "advapi32.dll"
[
- "long RegOpenKeyExA(void *, void *, long, long, void *)",
- "long RegCreateKeyExA(void *, void *, long, long, long, long, void *, void *, void *)",
- "long RegEnumValueA(void *, long, void *, void *, void *, void *, void *, void *)",
- "long RegEnumKeyExA(void *, long, void *, void *, void *, void *, void *, void *)",
- "long RegQueryValueExA(void *, void *, void *, void *, void *, void *)",
- "long RegSetValueExA(void *, void *, long, long, void *, long)",
+ "long RegOpenKeyExW(void *, void *, long, long, void *)",
+ "long RegCreateKeyExW(void *, void *, long, long, long, long, void *, void *, void *)",
+ "long RegEnumValueW(void *, long, void *, void *, void *, void *, void *, void *)",
+ "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 RegDeleteValue(void *, void *)",
"long RegDeleteKey(void *, void *)",
"long RegFlushKey(void *)",
@@ -228,7 +235,19 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
module_function
def check(result)
- raise Error, result, caller(2) if result != 0
+ raise Error, result, caller(1) if result != 0
+ end
+
+ def win64?
+ /^(?:x64|x86_64)/ =~ RUBY_PLATFORM
+ end
+
+ def packhandle(h)
+ win64? ? packqw(h) : packdw(h)
+ end
+
+ def unpackhandle(h)
+ win64? ? unpackqw(h) : unpackdw(h)
end
def packdw(dw)
@@ -249,54 +268,64 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
(qw[1] << 32) | qw[0]
end
+ def make_wstr(str)
+ str.encode(WCHAR)
+ end
+
def OpenKey(hkey, name, opt, desired)
- result = packdw(0)
- check RegOpenKeyExA.call(hkey, name, opt, desired, result)
- unpackdw(result)
+ result = packhandle(0)
+ check RegOpenKeyExW.call(hkey, make_wstr(name), opt, desired, result)
+ unpackhandle(result)
end
def CreateKey(hkey, name, opt, desired)
- result = packdw(0)
+ result = packhandle(0)
disp = packdw(0)
- check RegCreateKeyExA.call(hkey, name, 0, 0, opt, desired,
+ check RegCreateKeyExW.call(hkey, make_wstr(name), 0, 0, opt, desired,
0, result, disp)
- [ unpackdw(result), unpackdw(disp) ]
+ [ unpackhandle(result), unpackdw(disp) ]
end
def EnumValue(hkey, index)
- name = ' ' * Constants::MAX_KEY_LENGTH
+ name = WCHAR_NUL * Constants::MAX_KEY_LENGTH
size = packdw(Constants::MAX_KEY_LENGTH)
- check RegEnumValueA.call(hkey, index, name, size, 0, 0, 0, 0)
+ check RegEnumValueW.call(hkey, index, name, size, 0, 0, 0, 0)
name[0, unpackdw(size)]
end
def EnumKey(hkey, index)
- name = ' ' * Constants::MAX_KEY_LENGTH
+ name = WCHAR_NUL * Constants::MAX_KEY_LENGTH
size = packdw(Constants::MAX_KEY_LENGTH)
wtime = ' ' * 8
- check RegEnumKeyExA.call(hkey, index, name, size, 0, 0, 0, wtime)
+ check RegEnumKeyExW.call(hkey, index, name, size, 0, 0, 0, wtime)
[ name[0, unpackdw(size)], unpackqw(wtime) ]
end
def QueryValue(hkey, name)
type = packdw(0)
size = packdw(0)
- check RegQueryValueExA.call(hkey, name, 0, type, 0, size)
- data = ' ' * unpackdw(size)
- check RegQueryValueExA.call(hkey, name, 0, type, data, size)
+ name = make_wstr(name)
+ check RegQueryValueExW.call(hkey, name, 0, type, 0, size)
+ data = "\0".force_encoding('ASCII-8BIT') * unpackdw(size)
+ check RegQueryValueExW.call(hkey, name, 0, type, data, size)
[ unpackdw(type), data[0, unpackdw(size)] ]
end
def SetValue(hkey, name, type, data, size)
- check RegSetValueExA.call(hkey, name, 0, type, data, size)
+ case type
+ when REG_SZ, REG_EXPAND_SZ, REG_MULTI_SZ
+ data = data.encode(WCHAR)
+ size ||= data.size + 1
+ end
+ check RegSetValueExW.call(hkey, make_wstr(name), 0, type, data, size)
end
def DeleteValue(hkey, name)
- check RegDeleteValue.call(hkey, name)
+ check RegDeleteValue.call(hkey, make_wstr(name))
end
def DeleteKey(hkey, name)
- check RegDeleteKey.call(hkey, name)
+ check RegDeleteKey.call(hkey, make_wstr(name))
end
def FlushKey(hkey)
@@ -330,7 +359,11 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
# For detail, see expandEnvironmentStrings[http://msdn.microsoft.com/library/en-us/sysinfo/base/expandenvironmentstrings.asp] \Win32 \API.
#
def self.expand_environ(str)
- str.gsub(/%([^%]+)%/) { ENV[$1] || ENV[$1.upcase] || $& }
+ str.gsub(Regexp.compile("%([^%]+)%".encode(str.encoding))) {
+ v = $1.encode(LOCALE)
+ (e = ENV[v] || ENV[v.upcase]; e.encode(str.encoding) if e) ||
+ $&
+ }
end
@@type2name = { }
@@ -525,6 +558,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
rescue Error
break
end
+ subkey = export_string(subkey)
begin
type, data = read(subkey)
rescue Error
@@ -538,6 +572,15 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
alias each each_value
#
+ # return values as an array
+ #
+ def values
+ vals_ary = []
+ each_value { |*, val| vals_ary << val }
+ vals_ary
+ end
+
+ #
# Enumerate subkeys.
#
# subkey is String which contains name of subkey.
@@ -552,6 +595,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
rescue Error
break
end
+ subkey = export_string(subkey)
yield subkey, wtime
index += 1
end
@@ -590,9 +634,9 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
end
case type
when REG_SZ, REG_EXPAND_SZ
- [ type, data.chop ]
+ [ type, data.encode(name.encoding, WCHAR).chop ]
when REG_MULTI_SZ
- [ type, data.split(/\0/) ]
+ [ type, data.encode(name.encoding, WCHAR).split(/\0/) ]
when REG_BINARY
[ type, data ]
when REG_DWORD
@@ -681,11 +725,14 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
# method returns.
#
def write(name, type, data)
+ termsize = 0
case type
when REG_SZ, REG_EXPAND_SZ
- data = data.to_s + "\0"
+ data = data.encode(WCHAR)
+ termsize = WCHAR_SIZE
when REG_MULTI_SZ
- data = data.to_a.join("\0") + "\0\0"
+ data = data.to_a.map {|s| s.encode(WCHAR)}.join(WCHAR_NUL) << WCHAR_NUL
+ termsize = WCHAR_SIZE
when REG_BINARY
data = data.to_s
when REG_DWORD
@@ -697,7 +744,7 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
else
raise TypeError, "Unsupported type #{type}"
end
- API.SetValue(@hkey, name, type, data, data.length)
+ API.SetValue(@hkey, name, type, data, data.bytesize + termsize)
end
#
@@ -841,5 +888,11 @@ For detail, see the MSDN[http://msdn.microsoft.com/library/en-us/sysinfo/base/pr
end
__END__
end
+
+ private
+
+ def export_string(str, enc = Encoding.default_internal || LOCALE) # :nodoc:
+ str.encode(enc)
+ end
end
end
diff --git a/ext/dl/win32/lib/win32/resolv.rb b/ext/win32/lib/win32/resolv.rb
index 8a65472877..b5c11bf878 100644
--- a/ext/dl/win32/lib/win32/resolv.rb
+++ b/ext/win32/lib/win32/resolv.rb
@@ -3,7 +3,6 @@
=end
-require "dl/import"
require 'win32/registry'
module Win32
@@ -35,7 +34,7 @@ module Win32
end
module Kernel32
- extend DL::Importer
+ extend Importer
dlload "kernel32"
end
getv = Kernel32.extern "int GetVersionExA(void *)", :stdcall
@@ -261,7 +260,7 @@ else
module WsControl
module WSock32
- extend DL::Importer
+ extend Importer
dlload "wsock32.dll"
end
WsControl = WSock32.extern "int WsControl(int, int, void *, void *, void *, void *", :stdcall
diff --git a/ext/dl/win32/lib/win32/sspi.rb b/ext/win32/lib/win32/sspi.rb
index 6022df96c3..4645e1b306 100644
--- a/ext/dl/win32/lib/win32/sspi.rb
+++ b/ext/win32/lib/win32/sspi.rb
@@ -327,4 +327,4 @@ module Win32
end
end
end
-end \ No newline at end of file
+end
diff --git a/ext/win32ole/depend b/ext/win32ole/depend
index 3b1d7e9a97..c8445ad5fa 100644
--- a/ext/win32ole/depend
+++ b/ext/win32ole/depend
@@ -1 +1,12 @@
-win32ole.o : win32ole.c $(hdrdir)/ruby.h $(hdrdir)/config.h $(hdrdir)/defines.h
+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)
diff --git a/ext/win32ole/sample/excel2.rb b/ext/win32ole/sample/excel2.rb
index dbe4178051..95af61ceb6 100644
--- a/ext/win32ole/sample/excel2.rb
+++ b/ext/win32ole/sample/excel2.rb
@@ -4,11 +4,9 @@ require 'win32ole'
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;
@@ -18,13 +16,12 @@ excel.Range("a1:a3").Select();
excelchart = excel.Charts.Add();
excelchart.type = ChartTypeVal;
-i = 30
+i = 0
i.step(180, 10) do |rot|
-# excelchart['Rotation'] = rot;
excelchart.rotation=rot;
+ sleep 0.1
end
# Done, bye
excel.ActiveWorkbook.Close(0);
excel.Quit();
-
diff --git a/ext/win32ole/sample/olegen.rb b/ext/win32ole/sample/olegen.rb
index 4ec576ca50..aa0288ddbb 100644
--- a/ext/win32ole/sample/olegen.rb
+++ b/ext/win32ole/sample/olegen.rb
@@ -8,7 +8,7 @@ require 'win32ole'
class WIN32COMGen
def initialize(typelib)
@typelib = typelib
- @reciever = ""
+ @receiver = ""
end
attr_reader :typelib
@@ -87,7 +87,7 @@ class WIN32COMGen
end
def generate_method_body(method, disptype, types=nil)
- " ret = #{@reciever}#{disptype}(#{method.dispid}, [" +
+ " ret = #{@receiver}#{disptype}(#{method.dispid}, [" +
generate_args(method).gsub("=nil", "") +
"], [" +
generate_argtypes(method, types) +
@@ -303,10 +303,10 @@ STR
if klass.ole_type == "Class" &&
klass.guid &&
klass.progid
- @reciever = "@dispatch."
+ @receiver = "@dispatch."
define_class(klass, io)
else
- @reciever = ""
+ @receiver = ""
define_module(klass, io)
end
generate_constants(klass, io)
diff --git a/ext/win32ole/win32ole.c b/ext/win32ole/win32ole.c
index 5310cbfae1..a99bff2257 100644
--- a/ext/win32ole/win32ole.c
+++ b/ext/win32ole/win32ole.c
@@ -15,87 +15,7 @@
modified for win32ole (ruby) by Masaki.Suketa <masaki.suketa@nifty.ne.jp>
*/
-#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
+#include "win32ole.h"
/*
* unfortunately IID_IMultiLanguage2 is not included in any libXXX.a
@@ -106,44 +26,7 @@
const IID IID_IMultiLanguage2 = {0xDCCFC164, 0x2B38, 0x11d2, {0xB7, 0xEC, 0x00, 0xC0, 0x4F, 0x8F, 0x5D, 0x9A}};
#endif
-#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.4"
+#define WIN32OLE_VERSION "1.8.2"
typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
(REFCLSID, IUnknown*, DWORD, COSERVERINFO*, DWORD, MULTI_QI*);
@@ -151,69 +34,8 @@ typedef HRESULT (STDAPICALLTYPE FNCOCREATEINSTANCEEX)
typedef HWND (WINAPI FNHTMLHELP)(HWND hwndCaller, LPCSTR pszFile,
UINT uCommand, DWORD dwData);
typedef BOOL (FNENUMSYSEMCODEPAGES) (CODEPAGE_ENUMPROC, DWORD);
-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)
@@ -224,6 +46,7 @@ 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;
@@ -233,7 +56,6 @@ static FNCOCREATEINSTANCEEX *gCoCreateInstanceEx = NULL;
static VALUE com_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];
@@ -251,52 +73,11 @@ 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);
@@ -314,58 +95,27 @@ 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_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 VALUE ole_ary_m_entry(VALUE val, LONG *pid);
+static VALUE is_all_index_under(LONG *pid, long *pub, long dim);
static void * get_ptr_of_variant(VARIANT *pvar);
-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 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 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 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 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(int argc, VALUE *argv, VALUE self);
+static VALUE ole_create_dcom(VALUE self, VALUE ole, VALUE host, VALUE others);
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);
@@ -383,7 +133,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 VALUE hash2named_arg(VALUE pair, struct oleparam* pOp);
+static int hash2named_arg(VALUE key, VALUE val, VALUE 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);
@@ -400,200 +150,21 @@ 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 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 VALUE 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 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);
@@ -764,8 +335,10 @@ static HRESULT ( STDMETHODCALLTYPE GetIDsOfNames )(
Win32OLEIDispatch* p = (Win32OLEIDispatch*)This;
*/
char* psz = ole_wc2mb(*rgszNames); // support only one method
- *rgDispId = rb_intern(psz);
+ ID nameid = rb_intern(psz);
free(psz);
+ if ((ID)(DISPID)nameid != nameid) return E_NOINTERFACE;
+ *rgDispId = (DISPID)nameid;
return S_OK;
}
@@ -785,21 +358,28 @@ static /* [local] */ HRESULT ( STDMETHODCALLTYPE Invoke )(
int args = pDispParams->cArgs;
Win32OLEIDispatch* p = (Win32OLEIDispatch*)This;
VALUE* parg = ALLOCA_N(VALUE, args);
+ ID mid = (ID)dispIdMember;
for (i = 0; i < args; i++) {
*(parg + i) = ole_variant2val(&pDispParams->rgvarg[args - i - 1]);
}
if (dispIdMember == DISPID_VALUE) {
if (wFlags == DISPATCH_METHOD) {
- dispIdMember = rb_intern("call");
+ mid = rb_intern("call");
} else if (wFlags & DISPATCH_PROPERTYGET) {
- dispIdMember = rb_intern("value");
+ mid = rb_intern("value");
}
}
- v = rb_funcall2(p->obj, dispIdMember, args, parg);
+ v = rb_funcall2(p->obj, mid, args, parg);
ole_val2variant(v, pVarResult);
return S_OK;
}
+BOOL
+ole_initialized()
+{
+ return g_ole_initialized;
+}
+
static IDispatch*
val2dispatch(VALUE val)
{
@@ -825,7 +405,9 @@ static double
rbtime2vtdate(VALUE tmobj)
{
SYSTEMTIME st;
- double t = 0;
+ double t;
+ double nsec;
+
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));
@@ -835,7 +417,17 @@ rbtime2vtdate(VALUE tmobj)
st.wSecond = FIX2INT(rb_funcall(tmobj, rb_intern("sec"), 0));
st.wMilliseconds = FIX2INT(rb_funcall(tmobj, rb_intern("nsec"), 0)) / 1000000;
SystemTimeToVariantTime(&st, &t);
- return 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;
}
static VALUE
@@ -843,8 +435,8 @@ vtdate2rbtime(double date)
{
SYSTEMTIME st;
VALUE v;
+ double msec;
VariantTimeToSystemTime(date, &st);
-
v = rb_funcall(rb_cTime, rb_intern("new"), 6,
INT2FIX(st.wYear),
INT2FIX(st.wMonth),
@@ -852,8 +444,21 @@ vtdate2rbtime(double date)
INT2FIX(st.wHour),
INT2FIX(st.wMinute),
INT2FIX(st.wSecond));
- if (st.wMilliseconds > 0) {
- return rb_funcall(v, rb_intern("+"), 1, rb_float_new((double)(st.wMilliseconds / 1000.0)));
+ /*
+ * Unfortunately VariantTimeToSystemTime always ignores the
+ * wMilliseconds of SYSTEMTIME struct(The wMilliseconds is 0).
+ * So, we need to calculate milliseconds by ourselves.
+ */
+ msec = fabs(date);
+ msec -= floor(date);
+ msec *= 24 * 60;
+ msec -= floor(msec);
+ msec *= 60;
+ msec -= st.wSecond;
+ msec = round(msec * 1000);
+ msec /= 1000;
+ if (msec != 0) {
+ return rb_funcall(v, rb_intern("+"), 1, rb_float_new(msec));
}
return v;
}
@@ -1064,7 +669,7 @@ ole_cp2encoding(UINT cp)
}
static char *
-ole_wc2mb(LPWSTR pw)
+ole_wc2mb_alloc(LPWSTR pw, char *(alloc)(UINT size, void *arg), void *arg)
{
LPSTR pm;
UINT size = 0;
@@ -1076,7 +681,7 @@ ole_wc2mb(LPWSTR pw)
if (FAILED(hr)) {
ole_raise(hr, eWIN32OLERuntimeError, "fail to convert Unicode to CP%d", cWIN32OLE_cp);
}
- pm = ALLOC_N(char, size + 1);
+ pm = alloc(size, arg);
hr = pIMultiLanguage->lpVtbl->ConvertStringFromUnicode(pIMultiLanguage,
&dw, cWIN32OLE_cp, pw, NULL, pm, &size);
if (FAILED(hr)) {
@@ -1088,55 +693,27 @@ ole_wc2mb(LPWSTR pw)
}
size = WideCharToMultiByte(cWIN32OLE_cp, 0, pw, -1, NULL, 0, NULL, NULL);
if (size) {
- pm = ALLOC_N(char, size + 1);
+ pm = alloc(size, arg);
WideCharToMultiByte(cWIN32OLE_cp, 0, pw, -1, pm, size, NULL, NULL);
pm[size] = '\0';
}
else {
- pm = ALLOC_N(char, 1);
+ pm = alloc(0, arg);
*pm = '\0';
}
return pm;
}
-static VALUE
-ole_hresult2msg(HRESULT hr)
+static char *
+ole_alloc_str(UINT size, void *arg)
{
- 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;
+ return ALLOC_N(char, size + 1);
+}
+
+char *
+ole_wc2mb(LPWSTR pw)
+{
+ return ole_wc2mb_alloc(pw, ole_alloc_str, NULL);
}
static void
@@ -1164,14 +741,14 @@ ole_excepinfo2msg(EXCEPINFO *pExInfo)
pDescription = ole_wc2mb(pExInfo->bstrDescription);
}
if(pExInfo->wCode == 0) {
- sprintf(error_code, "\n OLE error code:%lX in ", pExInfo->scode);
+ sprintf(error_code, "\n OLE error code:%lX in ", (unsigned long)pExInfo->scode);
}
else{
sprintf(error_code, "\n OLE error code:%u in ", pExInfo->wCode);
}
error_msg = rb_str_new2(error_code);
if(pSource != NULL) {
- rb_str_cat(error_msg, pSource, strlen(pSource));
+ rb_str_cat2(error_msg, pSource);
}
else {
rb_str_cat(error_msg, "<Unknown>", 9);
@@ -1189,25 +766,6 @@ 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)
{
@@ -1222,7 +780,7 @@ ole_uninitialize_hook(rb_event_flag_t evflag, VALUE data, VALUE self, ID mid, VA
ole_uninitialize();
}
-static void
+void
ole_initialize(void)
{
HRESULT hr;
@@ -1248,59 +806,13 @@ ole_initialize(void)
}
static void
-ole_msg_loop() {
- MSG msg;
- while(PeekMessage(&msg,NULL,0,0,PM_REMOVE)) {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
-}
-
-static void
ole_free(struct oledata *pole)
{
OLE_FREE(pole->pDispatch);
free(pole);
}
-static void
-oletypelib_free(struct oletypelibdata *poletypelib)
-{
- OLE_FREE(poletypelib->pTypeLib);
- free(poletypelib);
-}
-
-static void
-oletype_free(struct oletypedata *poletype)
-{
- 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);
-}
-
-
-static LPWSTR
+LPWSTR
ole_vstr2wc(VALUE vstr)
{
rb_encoding *enc;
@@ -1311,7 +823,7 @@ ole_vstr2wc(VALUE vstr)
enc = rb_enc_get(vstr);
if (st_lookup(enc2cp_table, (st_data_t)enc, &data)) {
- cp = data;
+ cp = (int)data;
} else {
cp = ole_encoding2cp(enc);
if (code_page_installed(cp) ||
@@ -1383,30 +895,109 @@ ole_mb2wc(char *pm, int len)
return pw;
}
-static VALUE
+static char *
+ole_alloc_vstr(UINT size, void *arg)
+{
+ VALUE str = rb_enc_str_new(NULL, size, cWIN32OLE_enc);
+ *(VALUE *)arg = str;
+ return RSTRING_PTR(str);
+}
+
+VALUE
ole_wc2vstr(LPWSTR pw, BOOL isfree)
{
- char *p = ole_wc2mb(pw);
- VALUE vstr = rb_enc_str_new(p, strlen(p), cWIN32OLE_enc);
+ VALUE vstr;
+ ole_wc2mb_alloc(pw, ole_alloc_vstr, &vstr);
+ rb_str_set_len(vstr, (long)strlen(RSTRING_PTR(vstr)));
if(isfree)
SysFreeString(pw);
- free(p);
return vstr;
}
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(TYPE(obj) == T_ARRAY) {
+ while(RB_TYPE_P(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)
{
@@ -1476,20 +1067,8 @@ 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;
@@ -1526,7 +1105,7 @@ dimension(VALUE val) {
long dim1 = 0;
long len = 0;
long i = 0;
- if (TYPE(val) == T_ARRAY) {
+ if (RB_TYPE_P(val, T_ARRAY)) {
len = RARRAY_LEN(val);
for (i = 0; i < len; i++) {
dim1 = dimension(rb_ary_entry(val, i));
@@ -1547,11 +1126,11 @@ ary_len_of_dim(VALUE ary, long dim) {
long i = 0;
VALUE val;
if (dim == 0) {
- if (TYPE(ary) == T_ARRAY) {
+ if (RB_TYPE_P(ary, T_ARRAY)) {
ary_len = RARRAY_LEN(ary);
}
} else {
- if (TYPE(ary) == T_ARRAY) {
+ if (RB_TYPE_P(ary, T_ARRAY)) {
len = RARRAY_LEN(ary);
for (i = 0; i < len; i++) {
val = rb_ary_entry(ary, i);
@@ -1565,7 +1144,7 @@ ary_len_of_dim(VALUE ary, long dim) {
return ary_len;
}
-static HRESULT
+HRESULT
ole_val_ary2variant_ary(VALUE val, VARIANT *var, VARTYPE vt)
{
long dim = 0;
@@ -1574,7 +1153,8 @@ ole_val_ary2variant_ary(VALUE val, VARIANT *var, VARTYPE vt)
SAFEARRAYBOUND *psab = NULL;
SAFEARRAY *psa = NULL;
- long *pub, *pid;
+ long *pub;
+ LONG *pid;
Check_Type(val, T_ARRAY);
@@ -1582,7 +1162,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);
@@ -1626,7 +1206,7 @@ ole_val_ary2variant_ary(VALUE val, VARIANT *var, VARTYPE vt)
return hr;
}
-static void
+void
ole_val2variant(VALUE val, VARIANT *var)
{
struct oledata *pole;
@@ -1643,7 +1223,10 @@ ole_val2variant(VALUE val, VARIANT *var)
VariantCopy(var, &(pvar->var));
return;
}
-
+ if (rb_obj_is_kind_of(val, cWIN32OLE_RECORD)) {
+ ole_rec2variant(val, var);
+ return;
+ }
if (rb_obj_is_kind_of(val, rb_cTime)) {
V_VT(var) = VT_DATE;
V_DATE(var) = rbtime2vtdate(val);
@@ -1692,294 +1275,7 @@ ole_val2variant(VALUE val, VARIANT *var)
}
}
-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
+void
ole_val2variant2(VALUE val, VARIANT *var)
{
g_nil_to = VT_EMPTY;
@@ -1987,7 +1283,7 @@ ole_val2variant2(VALUE val, VARIANT *var)
g_nil_to = VT_ERROR;
}
-static VALUE
+VALUE
make_inspect(const char *class_name, VALUE detail)
{
VALUE str;
@@ -1999,7 +1295,7 @@ make_inspect(const char *class_name, VALUE detail)
return str;
}
-static VALUE
+VALUE
default_inspect(VALUE self, const char *class_name)
{
VALUE detail = rb_funcall(self, rb_intern("to_s"), 0);
@@ -2040,7 +1336,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;
@@ -2066,24 +1362,28 @@ 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);
}
-static VALUE
+VALUE
ole_variant2val(VARIANT *pvar)
{
VALUE obj = Qnil;
+ VARTYPE vt = V_VT(pvar);
HRESULT hr;
- while ( V_VT(pvar) == (VT_BYREF | VT_VARIANT) )
+ while ( vt == (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;
@@ -2091,12 +1391,9 @@ ole_variant2val(VARIANT *pvar)
return obj;
}
dim = SafeArrayGetDim(psa);
- 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);
+ pid = ALLOC_N(LONG, dim);
+ plb = ALLOC_N(LONG, dim);
+ pub = ALLOC_N(LONG, dim);
if(!pid || !plb || !pub) {
if(pid) free(pid);
@@ -2114,9 +1411,20 @@ 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);
- hr = SafeArrayPtrOfIndex(psa, pid, &V_BYREF(&variant));
+ if (vt_base == VT_RECORD)
+ hr = SafeArrayPtrOfIndex(psa, pid, &V_RECORD(&variant));
+ else
+ hr = SafeArrayPtrOfIndex(psa, pid, &V_BYREF(&variant));
if (SUCCEEDED(hr)) {
val = ole_variant2val(&variant);
ary_store_dim(obj, pid, plb, dim, val);
@@ -2309,6 +1617,15 @@ 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:
{
@@ -2327,19 +1644,19 @@ ole_variant2val(VARIANT *pvar)
return obj;
}
-static LONG
+LONG
reg_open_key(HKEY hkey, const char *name, HKEY *phkey)
{
return RegOpenKeyEx(hkey, name, 0, KEY_READ, phkey);
}
-static LONG
+LONG
reg_open_vkey(HKEY hkey, VALUE key, HKEY *phkey)
{
return reg_open_key(hkey, StringValuePtr(key), phkey);
}
-static VALUE
+VALUE
reg_enum_key(HKEY hkey, DWORD i)
{
char buf[BUFSIZ + 1];
@@ -2354,7 +1671,7 @@ reg_enum_key(HKEY hkey, DWORD i)
return Qnil;
}
-static VALUE
+VALUE
reg_get_val(HKEY hkey, const char *subkey)
{
char *pbuf;
@@ -2382,7 +1699,7 @@ reg_get_val(HKEY hkey, const char *subkey)
return val;
}
-static VALUE
+VALUE
reg_get_val2(HKEY hkey, const char *subkey)
{
HKEY hsubkey;
@@ -2399,118 +1716,6 @@ 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)
{
@@ -2613,9 +1818,8 @@ clsid_from_remote(VALUE host, VALUE com, CLSID *pclsid)
}
static VALUE
-ole_create_dcom(int argc, VALUE *argv, VALUE self)
+ole_create_dcom(VALUE self, VALUE ole, VALUE host, VALUE others)
{
- VALUE ole, host, others;
HRESULT hr;
CLSID clsid;
OLECHAR *pbuf;
@@ -2633,7 +1837,6 @@ ole_create_dcom(int argc, VALUE *argv, VALUE self)
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);
@@ -2725,15 +1928,14 @@ fole_s_connect(int argc, VALUE *argv, VALUE self)
void *p;
IUnknown *pUnknown;
- rb_secure(4);
/* initialize to use OLE */
ole_initialize();
rb_scan_args(argc, argv, "1*", &svr_name, &others);
- SafeStringValue(svr_name);
+ StringValue(svr_name);
if (rb_safe_level() > 0 && OBJ_TAINTED(svr_name)) {
- rb_raise(rb_eSecurityError, "Insecure Object Connection - %s",
- StringValuePtr(svr_name));
+ rb_raise(rb_eSecurityError, "insecure connection - `%s'",
+ StringValuePtr(svr_name));
}
/* get CLSID from OLE server name */
@@ -2777,7 +1979,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 variabl is not [A-Z], then
+ * If the first letter of constant variable is not [A-Z], then
* the constant is defined as CONSTANTS hash element.
*
* module EXCEL_CONST
@@ -2809,11 +2011,10 @@ fole_s_const_load(int argc, VALUE *argv, VALUE self)
VALUE file;
LCID lcid = cWIN32OLE_lcid;
- rb_secure(4);
rb_scan_args(argc, argv, "11", &ole, &klass);
- if (TYPE(klass) != T_CLASS &&
- TYPE(klass) != T_MODULE &&
- TYPE(klass) != T_NIL) {
+ if (!RB_TYPE_P(klass, T_CLASS) &&
+ !RB_TYPE_P(klass, T_MODULE) &&
+ !RB_TYPE_P(klass, T_NIL)) {
rb_raise(rb_eTypeError, "2nd parameter must be Class or Module");
}
if (rb_obj_is_kind_of(ole, cWIN32OLE)) {
@@ -2829,7 +2030,7 @@ fole_s_const_load(int argc, VALUE *argv, VALUE self)
ole_raise(hr, rb_eRuntimeError, "failed to GetContainingTypeLib");
}
OLE_RELEASE(pTypeInfo);
- if(TYPE(klass) != T_NIL) {
+ if(!RB_TYPE_P(klass, T_NIL)) {
ole_const_load(pTypeLib, klass, self);
}
else {
@@ -2837,7 +2038,7 @@ fole_s_const_load(int argc, VALUE *argv, VALUE self)
}
OLE_RELEASE(pTypeLib);
}
- else if(TYPE(ole) == T_STRING) {
+ else if(RB_TYPE_P(ole, T_STRING)) {
file = typelib_file(ole);
if (file == Qnil) {
file = ole;
@@ -2847,7 +2048,7 @@ fole_s_const_load(int argc, VALUE *argv, VALUE self)
SysFreeString(pBuf);
if (FAILED(hr))
ole_raise(hr, eWIN32OLERuntimeError, "failed to LoadTypeLibEx");
- if(TYPE(klass) != T_NIL) {
+ if(!RB_TYPE_P(klass, T_NIL)) {
ole_const_load(pTypeLib, klass, self);
}
else {
@@ -2861,38 +2062,6 @@ 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;
-
- rb_secure(4);
- 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)
{
@@ -2996,7 +2165,7 @@ fole_s_show_help(int argc, VALUE *argv, VALUE self)
} else {
helpfile = target;
}
- if (TYPE(helpfile) != T_STRING) {
+ if (!RB_TYPE_P(helpfile, T_STRING)) {
rb_raise(rb_eTypeError, "1st parameter must be (String|WIN32OLE_TYPE|WIN32OLE_METHOD)");
}
hwnd = ole_show_help(helpfile, helpcontext);
@@ -3067,7 +2236,7 @@ fole_s_set_code_page(VALUE self, VALUE vcp)
* WIN32OLE.locale -> locale id.
*
* Returns current locale id (lcid). The default locale is
- * LOCALE_SYSTEM_DEFAULT.
+ * WIN32OLE::LOCALE_SYSTEM_DEFAULT.
*
* lcid = WIN32OLE.locale
*/
@@ -3091,7 +2260,7 @@ static BOOL
lcid_installed(LCID lcid)
{
g_lcid_installed = FALSE;
- snprintf(g_lcid_to_check, sizeof(g_lcid_to_check), "%08lx", lcid);
+ snprintf(g_lcid_to_check, sizeof(g_lcid_to_check), "%08lx", (unsigned long)lcid);
EnumSystemLocales(installed_lcid_proc, LCID_INSTALLED);
return g_lcid_installed;
}
@@ -3153,7 +2322,7 @@ 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 thease method.
+ * You must not use these method.
*/
/* :nodoc */
@@ -3201,15 +2370,22 @@ 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.
- * If you want to get the result value of argument passed by reference,
- * you can use WIN32OLE::ARGV.
+ * 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.
*
* 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.
+ *
*/
/*
@@ -3236,22 +2412,21 @@ fole_initialize(int argc, VALUE *argv, VALUE self)
OLECHAR *pBuf;
IDispatch *pDispatch;
void *p;
- rb_secure(4);
rb_call_super(0, 0);
rb_scan_args(argc, argv, "11*", &svr_name, &host, &others);
- SafeStringValue(svr_name);
+ StringValue(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)) {
- SafeStringValue(host);
+ StringValue(host);
if (rb_safe_level() > 0 && OBJ_TAINTED(host)) {
- rb_raise(rb_eSecurityError, "Insecure Object Creation - %s",
- StringValuePtr(svr_name));
+ rb_raise(rb_eSecurityError, "insecure object creation - `%s'",
+ StringValuePtr(host));
}
- return ole_create_dcom(argc, argv, self);
+ return ole_create_dcom(self, svr_name, host, others);
}
/* get CLSID from OLE server name */
@@ -3281,18 +2456,16 @@ fole_initialize(int argc, VALUE *argv, VALUE self)
return self;
}
-static VALUE
-hash2named_arg(VALUE pair, struct oleparam* pOp)
+static int
+hash2named_arg(VALUE key, VALUE val, VALUE 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
-----------------------------------------------*/
- key = rb_ary_entry(pair, 0);
- if(TYPE(key) != T_STRING && TYPE(key) != T_SYMBOL) {
+ if(!RB_TYPE_P(key, T_STRING) && !RB_TYPE_P(key, T_SYMBOL)) {
/* clear name of dispatch parameters */
for(i = 1; i < index + 1; i++) {
SysFreeString(pOp->pNamedArgs[i]);
@@ -3304,19 +2477,18 @@ hash2named_arg(VALUE pair, struct oleparam* pOp)
/* raise an exception */
rb_raise(rb_eTypeError, "wrong argument type (expected String or Symbol)");
}
- if (TYPE(key) == T_SYMBOL) {
+ if (RB_TYPE_P(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(value, &(pOp->dp.rgvarg[index]));
+ ole_val2variant(val, &(pOp->dp.rgvarg[index]));
pOp->dp.cNamedArgs += 1;
- return Qnil;
+ return ST_CONTINUE;
}
static VALUE
@@ -3328,7 +2500,9 @@ 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]));
- VariantClear(&realargs[end]);
+ if (V_VT(&realargs[end]) != VT_RECORD) {
+ VariantClear(&realargs[end]);
+ }
}
return argv;
}
@@ -3368,10 +2542,10 @@ 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(TYPE(cmd) != T_STRING && TYPE(cmd) != T_SYMBOL && !is_bracket) {
+ if(!RB_TYPE_P(cmd, T_STRING) && !RB_TYPE_P(cmd, T_SYMBOL) && !is_bracket) {
rb_raise(rb_eTypeError, "method is wrong type (expected String or Symbol)");
}
- if (TYPE(cmd) == T_SYMBOL) {
+ if (RB_TYPE_P(cmd, T_SYMBOL)) {
cmd = rb_sym_to_s(cmd);
}
OLEData_Get_Struct(self, pole);
@@ -3400,15 +2574,16 @@ ole_invoke(int argc, VALUE *argv, VALUE self, USHORT wFlags, BOOL is_bracket)
op.dp.cNamedArgs = 0;
/* if last arg is hash object */
- if(TYPE(param) == T_HASH) {
+ if(RB_TYPE_P(param, T_HASH)) {
/*------------------------------------------
hash object ==> named dispatch parameters
--------------------------------------------*/
- cNamedArgs = NUM2INT(rb_funcall(param, rb_intern("length"), 0));
+ cNamedArgs = rb_long2int(RHASH_SIZE(param));
op.dp.cArgs = cNamedArgs + argc - 2;
op.pNamedArgs = ALLOCA_N(OLECHAR*, cNamedArgs + 1);
op.dp.rgvarg = ALLOCA_N(VARIANTARG, op.dp.cArgs);
- rb_block_call(param, rb_intern("each"), 0, 0, hash2named_arg, (VALUE)&op);
+
+ rb_hash_foreach(param, hash2named_arg, (VALUE)&op);
pDispID = ALLOCA_N(DISPID, cNamedArgs + 1);
op.pNamedArgs[0] = ole_vstr2wc(cmd);
@@ -3469,7 +2644,6 @@ 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);
@@ -3509,7 +2683,9 @@ 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;
- VariantClear(&op.dp.rgvarg[n]);
+ if (V_VT(&op.dp.rgvarg[n]) != VT_RECORD) {
+ VariantClear(&op.dp.rgvarg[n]);
+ }
}
}
@@ -3532,7 +2708,9 @@ 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;
- VariantClear(&op.dp.rgvarg[n]);
+ if (V_VT(&op.dp.rgvarg[n]) != VT_RECORD) {
+ VariantClear(&op.dp.rgvarg[n]);
+ }
}
}
}
@@ -3545,6 +2723,9 @@ 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);
@@ -3964,7 +3145,6 @@ static VALUE
fole_free(VALUE self)
{
struct oledata *pole;
- rb_secure(4);
OLEData_Get_Struct(self, pole);
OLE_FREE(pole->pDispatch);
pole->pDispatch = NULL;
@@ -4077,159 +3257,31 @@ fole_missing(int argc, VALUE *argv, VALUE self)
{
ID id;
const char* mname;
- int n;
+ size_t n;
+ rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS);
id = rb_to_id(argv[0]);
mname = rb_id2name(id);
if(!mname) {
rb_raise(rb_eRuntimeError, "fail: unknown method or property");
}
n = strlen(mname);
+#if SIZEOF_SIZE_T > SIZEOF_LONG
+ if (n >= LONG_MAX) {
+ rb_raise(rb_eRuntimeError, "too long method or property name");
+ }
+#endif
if(mname[n-1] == '=') {
- argv[0] = rb_enc_str_new(mname, n-1, cWIN32OLE_enc);
+ rb_check_arity(argc, 2, 2);
+ 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)
{
@@ -4356,30 +3408,6 @@ 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
@@ -4412,23 +3440,6 @@ 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
@@ -4525,12 +3536,11 @@ fole_respond_to(VALUE self, VALUE method)
BSTR wcmdname;
DISPID DispID;
HRESULT hr;
- rb_secure(4);
- 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_STRING) && !RB_TYPE_P(method, T_SYMBOL)) {
+ rb_raise(rb_eTypeError, "wrong argument type (expected String or Symbol)");
}
- if (TYPE(method) == T_SYMBOL) {
- method = rb_sym_to_s(method);
+ if (RB_TYPE_P(method, T_SYMBOL)) {
+ method = rb_sym_to_s(method);
}
OLEData_Get_Struct(self, pole);
wcmdname = ole_vstr2wc(method);
@@ -4540,7 +3550,7 @@ fole_respond_to(VALUE self, VALUE method)
return SUCCEEDED(hr) ? Qtrue : Qfalse;
}
-static HRESULT
+HRESULT
ole_docinfo_from_type(ITypeInfo *pTypeInfo, BSTR *name, BSTR *helpstr, DWORD *helpcontext, BSTR *helpfile)
{
HRESULT hr;
@@ -4601,7 +3611,7 @@ ole_ptrtype2val(ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE typedetails)
return type;
}
-static VALUE
+VALUE
ole_typedesc2val(ITypeInfo *pTypeInfo, TYPEDESC *pTypeDesc, VALUE typedetails)
{
VALUE str;
@@ -4706,6 +3716,9 @@ 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));
@@ -4733,15 +3746,16 @@ fole_method_help(VALUE self, VALUE cmdname)
ITypeInfo *pTypeInfo;
HRESULT hr;
struct oledata *pole;
- VALUE method, obj;
+ VALUE obj;
SafeStringValue(cmdname);
OLEData_Get_Struct(self, pole);
hr = typeinfo_from_ole(pole, &pTypeInfo);
if(FAILED(hr))
ole_raise(hr, rb_eRuntimeError, "failed to get ITypeInfo");
- method = folemethod_s_allocate(cWIN32OLE_METHOD);
- obj = olemethod_from_typeinfo(method, pTypeInfo, cmdname);
+
+ obj = create_win32ole_method(pTypeInfo, cmdname);
+
OLE_RELEASE(pTypeInfo);
if (obj == Qnil)
rb_raise(eWIN32OLERuntimeError, "not found %s",
@@ -4797,4271 +3811,23 @@ fole_activex_initialize(VALUE self)
return Qnil;
}
-/*
- * 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)
+HRESULT
+typelib_from_val(VALUE obj, ITypeLib **pTypeLib)
{
-
- 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 rb_enc_str_new(StringValuePtr(name), strlen(StringValuePtr(name)), cWIN32OLE_enc);
-}
-
-/*
- * 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 rb_enc_str_new(StringValuePtr(path), strlen(StringValuePtr(path)), cWIN32OLE_enc);
-}
-
-/*
- * 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;
- 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 VALUE
-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;
- 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);
+ OLEData_Get_Struct(obj, pole);
+ hr = pole->pDispatch->lpVtbl->GetTypeInfo(pole->pDispatch,
+ 0, lcid, &pTypeInfo);
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);
+ hr = pTypeInfo->lpVtbl->GetContainingTypeLib(pTypeInfo, pTypeLib, &index);
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_secure(4);
- 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_secure(4);
- 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;
-}
-
-/*
- * 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);
-
- 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:
- 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));
- }
- }
-
- 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
-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)
-{
- 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
@@ -9079,10 +3845,8 @@ free_enc2cp(void)
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;
@@ -9153,168 +3917,97 @@ 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 refering 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));
- 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_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();
init_enc2cp();
atexit((void (*)(void))free_enc2cp);
diff --git a/ext/win32ole/win32ole.h b/ext/win32ole/win32ole.h
new file mode 100644
index 0000000000..880fe86466
--- /dev/null
+++ b/ext/win32ole/win32ole.h
@@ -0,0 +1,161 @@
+#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;
+};
+
+#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");\
+ }\
+}
+
+VALUE cWIN32OLE;
+LCID cWIN32OLE_lcid;
+
+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();
+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
new file mode 100644
index 0000000000..f122b2aa1b
--- /dev/null
+++ b/ext/win32ole/win32ole_error.c
@@ -0,0 +1,82 @@
+#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() {
+ /*
+ * 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
new file mode 100644
index 0000000000..aa0a42c8c0
--- /dev/null
+++ b/ext/win32ole/win32ole_error.h
@@ -0,0 +1,8 @@
+#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();
+
+#endif
diff --git a/ext/win32ole/win32ole_event.c b/ext/win32ole/win32ole_event.c
new file mode 100644
index 0000000000..55b884ff1b
--- /dev/null
+++ b/ext/win32ole/win32ole_event.c
@@ -0,0 +1,1258 @@
+#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 {
+ 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;
+
+static BOOL g_IsEventSinkVtblInitialized = FALSE;
+
+static IEventSinkVtbl vtEventSink;
+
+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 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 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);
+
+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() {
+ 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 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;
+ 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;
+ 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;
+ }
+
+ *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
+ole_event_free(struct oleeventdata *poleev)
+{
+ 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 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;
+ poleev->pDispatch = NULL;
+ 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(!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");
+ }
+
+ 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 = 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() {
+ 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;
+ 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(!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_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(!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_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;
+ }
+ 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()
+{
+ 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
new file mode 100644
index 0000000000..509be05ea9
--- /dev/null
+++ b/ext/win32ole/win32ole_event.h
@@ -0,0 +1,6 @@
+#ifndef WIN32OLE_EVENT_H
+#define WIN32OLE_EVENT_H 1
+
+void Init_win32ole_event();
+
+#endif
diff --git a/ext/win32ole/win32ole_method.c b/ext/win32ole/win32ole_method.c
new file mode 100644
index 0000000000..672ec5c0e0
--- /dev/null
+++ b/ext/win32ole/win32ole_method.c
@@ -0,0 +1,928 @@
+#include "win32ole.h"
+
+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 void olemethod_free(struct olemethoddata *polemethod);
+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 void
+olemethod_free(struct olemethoddata *polemethod)
+{
+ OLE_FREE(polemethod->pTypeInfo);
+ OLE_FREE(polemethod->pOwnerTypeInfo);
+ free(polemethod);
+}
+
+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;
+ 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;
+}
+
+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)
+{
+ 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;
+ 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;
+ 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;
+ 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");
+}
+
+void Init_win32ole_method()
+{
+ 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
new file mode 100644
index 0000000000..58005dd73f
--- /dev/null
+++ b/ext/win32ole/win32ole_method.h
@@ -0,0 +1,15 @@
+#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);
+void Init_win32ole_method();
+#endif
diff --git a/ext/win32ole/win32ole_param.c b/ext/win32ole/win32ole_param.c
new file mode 100644
index 0000000000..661bd23578
--- /dev/null
+++ b/ext/win32ole/win32ole_param.c
@@ -0,0 +1,418 @@
+#include "win32ole.h"
+
+VALUE cWIN32OLE_PARAM;
+
+struct oleparamdata {
+ ITypeInfo *pTypeInfo;
+ UINT method_index;
+ UINT index;
+};
+
+static void oleparam_free(struct oleparamdata *pole);
+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 void
+oleparam_free(struct oleparamdata *pole)
+{
+ OLE_FREE(pole->pTypeInfo);
+ free(pole);
+}
+
+VALUE
+create_win32ole_param(ITypeInfo *pTypeInfo, UINT method_index, UINT index, VALUE name)
+{
+ struct oleparamdata *pparam;
+ VALUE obj = foleparam_s_allocate(cWIN32OLE_PARAM);
+ Data_Get_Struct(obj, struct oleparamdata, 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 = 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);
+}
+
+/*
+ * 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;
+ 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_inspect(defval));
+ }
+ return make_inspect("WIN32OLE_PARAM", detail);
+}
+
+void
+Init_win32ole_param()
+{
+ 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
new file mode 100644
index 0000000000..24fcdc0fb2
--- /dev/null
+++ b/ext/win32ole/win32ole_param.h
@@ -0,0 +1,8 @@
+#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();
+
+#endif
+
diff --git a/ext/win32ole/win32ole_record.c b/ext/win32ole/win32ole_record.c
new file mode 100644
index 0000000000..b7ce75bbee
--- /dev/null
+++ b/ext/win32ole/win32ole_record.c
@@ -0,0 +1,577 @@
+#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(struct olerecorddata *pvar);
+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 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) {
+ Data_Get_Struct(rec, struct olerecorddata, 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;
+ Data_Get_Struct(rec, struct olerecorddata, 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;
+
+ Data_Get_Struct(obj, struct olerecorddata, 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(struct olerecorddata *pvar) {
+ OLE_FREE(pvar->pri);
+ if (pvar->pdata) {
+ free(pvar->pdata);
+ }
+ free(pvar);
+}
+
+static VALUE
+folerecord_s_allocate(VALUE klass) {
+ VALUE obj = Qnil;
+ struct olerecorddata *pvar;
+ obj = Data_Make_Struct(klass, struct olerecorddata, 0, olerecord_free, 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_sym_to_s(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_sym_to_s(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_sym_to_s(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_sym_to_s(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()
+{
+ 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
new file mode 100644
index 0000000000..2f84d104cc
--- /dev/null
+++ b/ext/win32ole/win32ole_record.h
@@ -0,0 +1,10 @@
+#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();
+
+#endif
diff --git a/ext/win32ole/win32ole_type.c b/ext/win32ole/win32ole_type.c
new file mode 100644
index 0000000000..00db09e191
--- /dev/null
+++ b/ext/win32ole/win32ole_type.c
@@ -0,0 +1,901 @@
+#include "win32ole.h"
+
+struct oletypedata {
+ ITypeInfo *pTypeInfo;
+};
+
+static void oletype_free(struct oletypedata *poletype);
+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);
+
+/*
+ * Document-class: WIN32OLE_TYPE
+ *
+ * <code>WIN32OLE_TYPE</code> objects represent OLE type libarary information.
+ */
+
+static void
+oletype_free(struct oletypedata *poletype)
+{
+ OLE_FREE(poletype->pTypeInfo);
+ free(poletype);
+}
+
+ITypeInfo *itypeinfo(VALUE self)
+{
+ struct oletypedata *ptype;
+ Data_Get_Struct(self, struct oletypedata, 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;
+ 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
+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;
+}
+
+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()
+{
+ 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
new file mode 100644
index 0000000000..086d36a241
--- /dev/null
+++ b/ext/win32ole/win32ole_type.h
@@ -0,0 +1,8 @@
+#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();
+#endif
diff --git a/ext/win32ole/win32ole_typelib.c b/ext/win32ole/win32ole_typelib.c
new file mode 100644
index 0000000000..f5ecd4c05c
--- /dev/null
+++ b/ext/win32ole/win32ole_typelib.c
@@ -0,0 +1,832 @@
+#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(struct oletypelibdata *poletypelib);
+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 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;
+ Data_Get_Struct(self, struct oletypelibdata, 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;
+ Data_Get_Struct(self, struct oletypelibdata, ptlib);
+ ptlib->pTypeLib = pTypeLib;
+ return self;
+}
+
+static void
+oletypelib_free(struct oletypelibdata *poletypelib)
+{
+ OLE_FREE(poletypelib->pTypeLib);
+ free(poletypelib);
+}
+
+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;
+}
+
+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);
+ 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 = 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()
+{
+ 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
new file mode 100644
index 0000000000..160ed61743
--- /dev/null
+++ b/ext/win32ole/win32ole_typelib.h
@@ -0,0 +1,11 @@
+#ifndef WIN32OLE_TYPELIB_H
+#define WIN32OLE_TYPELIB_H 1
+
+VALUE cWIN32OLE_TYPELIB;
+
+void Init_win32ole_typelib();
+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
new file mode 100644
index 0000000000..85f3341f98
--- /dev/null
+++ b/ext/win32ole/win32ole_variable.c
@@ -0,0 +1,366 @@
+#include "win32ole.h"
+
+struct olevariabledata {
+ ITypeInfo *pTypeInfo;
+ UINT index;
+};
+
+static void olevariable_free(struct olevariabledata *polevar);
+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 void
+olevariable_free(struct olevariabledata *polevar)
+{
+ OLE_FREE(polevar->pTypeInfo);
+ free(polevar);
+}
+
+/*
+ * 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 = Data_Make_Struct(cWIN32OLE_VARIABLE, struct olevariabledata,
+ 0,olevariable_free,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;
+ 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 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()
+{
+ 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
new file mode 100644
index 0000000000..dbb27acf9b
--- /dev/null
+++ b/ext/win32ole/win32ole_variable.h
@@ -0,0 +1,8 @@
+#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();
+
+#endif
diff --git a/ext/win32ole/win32ole_variant.c b/ext/win32ole/win32ole_variant.c
new file mode 100644
index 0000000000..b0cc5ee5df
--- /dev/null
+++ b/ext/win32ole/win32ole_variant.c
@@ -0,0 +1,707 @@
+#include "win32ole.h"
+
+static void olevariant_free(struct olevariantdata *pvar);
+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 void
+olevariant_free(struct olevariantdata *pvar)
+{
+ VariantClear(&(pvar->realvar));
+ VariantClear(&(pvar->var));
+ free(pvar);
+}
+
+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 = 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));
+ }
+ }
+}
+
+/*
+ * 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);
+ 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);
+ 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;
+ 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
+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;
+}
+
+/*
+ * 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)
+{
+ 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) || !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
+Init_win32ole_variant()
+{
+ 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
new file mode 100644
index 0000000000..500a273a4f
--- /dev/null
+++ b/ext/win32ole/win32ole_variant.h
@@ -0,0 +1,13 @@
+#ifndef WIN32OLE_VARIANT_H
+#define WIN32OLE_VARIANT_H 1
+
+struct olevariantdata {
+ VARIANT realvar;
+ VARIANT var;
+};
+
+VALUE cWIN32OLE_VARIANT;
+void Init_win32ole_variant();
+
+#endif
+
diff --git a/ext/win32ole/win32ole_variant_m.c b/ext/win32ole/win32ole_variant_m.c
new file mode 100644
index 0000000000..ff05c1d11b
--- /dev/null
+++ b/ext/win32ole/win32ole_variant_m.c
@@ -0,0 +1,148 @@
+#include "win32ole.h"
+
+void Init_win32ole_variant_m() {
+ /*
+ * 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
new file mode 100644
index 0000000000..56dabc1276
--- /dev/null
+++ b/ext/win32ole/win32ole_variant_m.h
@@ -0,0 +1,7 @@
+#ifndef WIN32OLE_VARIANT_M_H
+#define WIN32OLE_VARIANT_M_H 1
+
+VALUE mWIN32OLE_VARIANT;
+void Init_win32ole_variant_m();
+
+#endif
diff --git a/ext/zlib/depend b/ext/zlib/depend
new file mode 100644
index 0000000000..9d47df2a8d
--- /dev/null
+++ b/ext/zlib/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/zlib/zlib.c b/ext/zlib/zlib.c
index 8430481108..af45b6f884 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -27,9 +27,6 @@
#define RUBY_ZLIB_VERSION "0.6.0"
-
-#define OBJ_IS_FREED(val) (RBASIC(val)->flags == 0)
-
#ifndef GZIP_SUPPORT
#define GZIP_SUPPORT 1
#endif
@@ -337,11 +334,8 @@ raise_zlib_error(int err, const char *msg)
rb_sys_fail(msg);
/* no return */
default:
- {
- char buf[BUFSIZ];
- snprintf(buf, BUFSIZ, "unknown zlib error %d: %s", err, msg);
- exc = rb_exc_new2(cZError, buf);
- }
+ exc = rb_exc_new_str(cZError,
+ rb_sprintf("unknown zlib error %d: %s", err, msg));
}
rb_exc_raise(exc);
@@ -432,7 +426,14 @@ do_checksum(argc, argv, func)
* +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+.
*
- * FIXME: expression.
+ * Example usage:
+ *
+ * require "zlib"
+ *
+ * data = "foo"
+ * puts "Adler32 checksum: #{Zlib.adler32(data).to_s(16)}"
+ * #=> Adler32 checksum: 2820145
+ *
*/
static VALUE
rb_zlib_adler32(int argc, VALUE *argv, VALUE klass)
@@ -583,7 +584,7 @@ struct zstream_run_args {
static voidpf
zlib_mem_alloc(voidpf opaque, uInt items, uInt size)
{
- voidpf p = xmalloc(items * size);
+ voidpf p = xmalloc2(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?
@@ -633,7 +634,7 @@ zstream_expand_buffer(struct zstream *z)
VALUE self = (VALUE)z->stream.opaque;
rb_str_resize(z->buf, z->buf_filled);
- RBASIC(z->buf)->klass = rb_cString;
+ rb_obj_reveal(z->buf, rb_cString);
OBJ_INFECT(z->buf, self);
rb_protect(rb_yield, z->buf, &state);
@@ -678,7 +679,7 @@ zstream_expand_buffer_into(struct zstream *z, unsigned long size)
z->buf_filled = 0;
z->stream.next_out = (Bytef*)RSTRING_PTR(z->buf);
z->stream.avail_out = MAX_UINT(size);
- RBASIC(z->buf)->klass = 0;
+ rb_obj_hide(z->buf);
}
else if (z->stream.avail_out != size) {
rb_str_resize(z->buf, z->buf_filled + size);
@@ -740,7 +741,7 @@ zstream_append_buffer(struct zstream *z, const Bytef *src, long len)
z->buf_filled = len;
z->stream.next_out = (Bytef*)RSTRING_PTR(z->buf);
z->stream.avail_out = 0;
- RBASIC(z->buf)->klass = 0;
+ rb_obj_hide(z->buf);
return;
}
@@ -782,7 +783,7 @@ zstream_detach_buffer(struct zstream *z)
else {
dst = z->buf;
rb_str_resize(dst, z->buf_filled);
- RBASIC(dst)->klass = rb_cString;
+ rb_obj_reveal(dst, rb_cString);
}
OBJ_INFECT(dst, self);
@@ -810,8 +811,7 @@ zstream_shift_buffer(struct zstream *z, long len)
return zstream_detach_buffer(z);
}
- dst = rb_str_subseq(z->buf, 0, len);
- RBASIC(dst)->klass = rb_cString;
+ dst = rb_str_new(RSTRING_PTR(z->buf), len);
z->buf_filled -= len;
memmove(RSTRING_PTR(z->buf), RSTRING_PTR(z->buf) + len,
z->buf_filled);
@@ -866,7 +866,7 @@ zstream_append_input(struct zstream *z, const Bytef *src, long len)
if (NIL_P(z->input)) {
z->input = rb_str_buf_new(len);
rb_str_buf_cat(z->input, (const char*)src, len);
- RBASIC(z->input)->klass = 0;
+ rb_obj_hide(z->input);
}
else {
rb_str_buf_cat(z->input, (const char*)src, len);
@@ -915,10 +915,10 @@ zstream_detach_input(struct zstream *z)
}
else {
dst = z->input;
- RBASIC(dst)->klass = rb_cString;
+ rb_obj_reveal(dst, rb_cString);
}
z->input = Qnil;
- RBASIC(dst)->klass = rb_cString;
+ rb_obj_reveal(dst, rb_cString);
return dst;
}
@@ -1295,12 +1295,8 @@ rb_zstream_finish(VALUE obj)
/*
* call-seq:
- * flush_next_out -> String
- * flush_next_out { |chunk| ... } -> nil
+ * flush_next_in -> input
*
- * Flushes output buffer and returns all data in that buffer. If a block is
- * given each chunk is yielded to the block until the current output buffer
- * has been flushed.
*/
static VALUE
rb_zstream_flush_next_in(VALUE obj)
@@ -1315,7 +1311,13 @@ rb_zstream_flush_next_in(VALUE obj)
}
/*
- * Flushes output buffer and returns all data in that buffer.
+ * call-seq:
+ * flush_next_out -> String
+ * flush_next_out { |chunk| ... } -> nil
+ *
+ * Flushes output buffer and returns all data in that buffer. If a block is
+ * given each chunk is yielded to the block until the current output buffer
+ * has been flushed.
*/
static VALUE
rb_zstream_flush_next_out(VALUE obj)
@@ -1461,13 +1463,15 @@ 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::NO_COMPRESSION = 0
- * * Zlib::BEST_SPEED = 1
- * * Zlib::DEFAULT_COMPRESSION = 6
- * * Zlib::BEST_COMPRESSION = 9
+ * * Zlib::DEFAULT_COMPRESSION
+ * * Zlib::NO_COMPRESSION
+ * * Zlib::BEST_SPEED
+ * * Zlib::BEST_COMPRESSION
+ *
+ * See http://www.zlib.net/manual.html#Constants for further information.
*
* 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
@@ -1557,6 +1561,7 @@ rb_deflate_init_copy(VALUE self, VALUE orig)
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);
@@ -1588,7 +1593,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 (the default is 6).
+ * Zlib::DEFAULT_COMPRESSION, or an integer from 0 to 9.
*
* This method is almost equivalent to the following code:
*
@@ -1852,12 +1857,12 @@ rb_inflate_s_allocate(VALUE klass)
* == Example
*
* open "compressed.file" do |compressed_io|
- * inflate = Zlib::Inflate.new(Zlib::MAX_WBITS + 32)
+ * zi = Zlib::Inflate.new(Zlib::MAX_WBITS + 32)
*
* begin
* open "uncompressed.file", "w+" do |uncompressed_io|
* uncompressed_io << zi.inflate(compressed_io.read)
- * }
+ * end
* ensure
* zi.close
* end
@@ -2288,6 +2293,7 @@ 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;
@@ -3192,13 +3198,9 @@ rb_gzfile_set_mtime(VALUE obj, VALUE mtime)
rb_raise(cGzError, "header is already written");
}
- if (FIXNUM_P(mtime)) {
- gz->mtime = FIX2INT(mtime);
- }
- else {
- val = rb_Integer(mtime);
- gz->mtime = FIXNUM_P(val) ? FIX2UINT(val) : rb_big2ulong(val);
- }
+ val = rb_Integer(mtime);
+ gz->mtime = NUM2UINT(val);
+
return mtime;
}
diff --git a/file.c b/file.c
index 53ed9509a0..34b2693430 100644
--- a/file.c
+++ b/file.c
@@ -19,6 +19,9 @@
#include <sys/cygwin.h>
#include <wchar.h>
#endif
+#ifdef __APPLE__
+#include <CoreFoundation/CFString.h>
+#endif
#include "ruby/ruby.h"
#include "ruby/io.h"
@@ -106,8 +109,6 @@ int flock(int, int);
#define STAT(p, s) stat((p), (s))
#endif
-#define rb_sys_fail_path(path) rb_sys_fail_str(path)
-
#if defined(__BEOS__) || defined(__HAIKU__) /* should not change ID if -1 */
static int
be_chown(const char *path, uid_t owner, gid_t group)
@@ -231,30 +232,95 @@ rb_str_encode_ospath(VALUE path)
{
#ifdef _WIN32
rb_encoding *enc = rb_enc_get(path);
- if (enc != rb_ascii8bit_encoding()) {
- rb_encoding *utf8 = rb_utf8_encoding();
- if (enc != utf8)
- path = rb_str_encode(path, rb_enc_from_encoding(utf8), 0, Qnil);
+ rb_encoding *utf8 = rb_utf8_encoding();
+ if (enc == rb_ascii8bit_encoding()) {
+ enc = rb_filesystem_encoding();
}
- else if (RSTRING_LEN(path) > 0) {
- path = rb_str_dup(path);
- rb_enc_associate(path, rb_filesystem_encoding());
- path = rb_str_encode(path, rb_enc_from_encoding(rb_utf8_encoding()), 0, Qnil);
+ 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__
+static VALUE
+rb_str_normalize_ospath0(const char *ptr, long len)
+{
+ VALUE str;
+ CFIndex buflen = 0;
+ CFRange all;
+ CFStringRef s = CFStringCreateWithBytesNoCopy(kCFAllocatorDefault,
+ (const UInt8 *)ptr, len,
+ kCFStringEncodingUTF8, FALSE,
+ kCFAllocatorNull);
+ CFMutableStringRef m = CFStringCreateMutableCopy(kCFAllocatorDefault, len, s);
+
+ CFStringNormalize(m, kCFStringNormalizationFormC);
+ all = CFRangeMake(0, CFStringGetLength(m));
+ CFStringGetBytes(m, all, kCFStringEncodingUTF8, '?', FALSE, NULL, 0, &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;
+}
+
+VALUE
+rb_str_normalize_ospath(const char *ptr, long len)
+{
+ const char *p = ptr;
+ const char *e = ptr + len;
+ const char *p1 = p;
+ VALUE str = rb_str_buf_new(len);
+ rb_encoding *enc = rb_utf8_encoding();
+ rb_enc_associate(str, enc);
+
+ while (p < e) {
+ int l, c;
+ int r = rb_enc_precise_mbclen(p, e, enc);
+ if (!MBCLEN_CHARFOUND_P(r)) {
+ /* invalid byte shall not happen but */
+ rb_str_append(str, rb_str_normalize_ospath0(p1, p-p1));
+ rb_str_cat2(str, "\xEF\xBF\xBD");
+ p += 1;
+ }
+ 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(str, rb_str_normalize_ospath0(p1, p-p1));
+ }
+ rb_str_cat(str, p, l);
+ p += l;
+ p1 = p;
+ }
+ else {
+ p += l;
+ }
+ }
+ if (p - p1 > 0) {
+ rb_str_append(str, rb_str_normalize_ospath0(p1, p-p1));
+ }
+
+ return str;
+}
+#endif
+
static long
apply2files(void (*func)(const char *, VALUE, void *), VALUE vargs, void *arg)
{
long i;
volatile VALUE path;
- rb_secure(4);
for (i=0; i<RARRAY_LEN(vargs); i++) {
const char *s;
- path = rb_get_path(RARRAY_PTR(vargs)[i]);
+ path = rb_get_path(RARRAY_AREF(vargs, i));
path = rb_str_encode_ospath(path);
s = RSTRING_PTR(path);
(*func)(s, path, arg);
@@ -266,6 +332,7 @@ apply2files(void (*func)(const char *, VALUE, void *), VALUE vargs, void *arg)
/*
* call-seq:
* file.path -> filename
+ * file.to_path -> filename
*
* Returns the pathname used to create <i>file</i> as a string. Does
* not normalize the name.
@@ -295,10 +362,11 @@ stat_memsize(const void *p)
static const rb_data_type_t stat_data_type = {
"stat",
{NULL, RUBY_TYPED_DEFAULT_FREE, stat_memsize,},
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
static VALUE
-stat_new_0(VALUE klass, struct stat *st)
+stat_new_0(VALUE klass, const struct stat *st)
{
struct stat *nst = 0;
@@ -309,8 +377,8 @@ stat_new_0(VALUE klass, struct stat *st)
return TypedData_Wrap_Struct(klass, &stat_data_type, nst);
}
-static VALUE
-stat_new(struct stat *st)
+VALUE
+rb_stat_new(const struct stat *st)
{
return stat_new_0(rb_cStat, st);
}
@@ -333,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 the two values are incomparable.
+ * +nil+ is returned if +other_stat+ is not a File::Stat object
*
* f1 = File.new("f1", "w")
* sleep 1
@@ -532,7 +600,7 @@ rb_stat_gid(VALUE self)
static VALUE
rb_stat_rdev(VALUE self)
{
-#ifdef HAVE_ST_RDEV
+#ifdef HAVE_STRUCT_STAT_ST_RDEV
return DEVT2NUM(get_stat(self)->st_rdev);
#else
return Qnil;
@@ -553,7 +621,7 @@ rb_stat_rdev(VALUE self)
static VALUE
rb_stat_rdev_major(VALUE self)
{
-#if defined(HAVE_ST_RDEV) && defined(major)
+#if defined(HAVE_STRUCT_STAT_ST_RDEV) && defined(major)
return DEVT2NUM(major(get_stat(self)->st_rdev));
#else
return Qnil;
@@ -574,7 +642,7 @@ rb_stat_rdev_major(VALUE self)
static VALUE
rb_stat_rdev_minor(VALUE self)
{
-#if defined(HAVE_ST_RDEV) && defined(minor)
+#if defined(HAVE_STRUCT_STAT_ST_RDEV) && defined(minor)
return DEVT2NUM(minor(get_stat(self)->st_rdev));
#else
return Qnil;
@@ -610,7 +678,7 @@ rb_stat_size(VALUE self)
static VALUE
rb_stat_blksize(VALUE self)
{
-#ifdef HAVE_ST_BLKSIZE
+#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
return ULONG2NUM(get_stat(self)->st_blksize);
#else
return Qnil;
@@ -714,6 +782,20 @@ 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
@@ -767,6 +849,37 @@ 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, returns <i>ctime</i>.
+ *
+ * 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
@@ -778,7 +891,8 @@ rb_stat_ctime(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>"
+ * # ctime=Mon Oct 27 11:20:27 CST 2003,
+ * # birthtime=Mon Aug 04 08:13:49 CDT 2003>"
*/
static VALUE
@@ -803,6 +917,9 @@ 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;
@@ -916,12 +1033,11 @@ rb_file_s_stat(VALUE klass, VALUE fname)
{
struct stat st;
- rb_secure(4);
FilePathValue(fname);
if (rb_stat(fname, &st) < 0) {
rb_sys_fail_path(fname);
}
- return stat_new(&st);
+ return rb_stat_new(&st);
}
/*
@@ -949,7 +1065,7 @@ rb_io_stat(VALUE obj)
if (fstat(fptr->fd, &st) == -1) {
rb_sys_fail_path(fptr->pathv);
}
- return stat_new(&st);
+ return rb_stat_new(&st);
}
/*
@@ -978,7 +1094,7 @@ rb_file_s_lstat(VALUE klass, VALUE fname)
if (lstat(StringValueCStr(fname), &st) == -1) {
rb_sys_fail_path(fname);
}
- return stat_new(&st);
+ return rb_stat_new(&st);
#else
return rb_file_s_stat(klass, fname);
#endif
@@ -1013,7 +1129,7 @@ rb_file_lstat(VALUE obj)
if (lstat(RSTRING_PTR(path), &st) == -1) {
rb_sys_fail_path(fptr->pathv);
}
- return stat_new(&st);
+ return rb_stat_new(&st);
#else
return rb_io_stat(obj);
#endif
@@ -1029,7 +1145,7 @@ rb_group_member(GETGROUPS_T gid)
int groups = 16;
VALUE v = 0;
GETGROUPS_T *gary;
- int anum;
+ int anum = -1;
if (getgid() == gid || getegid() == gid)
return TRUE;
@@ -1082,11 +1198,15 @@ eaccess(const char *path, int mode)
struct stat st;
rb_uid_t euid;
+ euid = geteuid();
+
+ /* no setuid nor setgid. run shortcut. */
+ if (getuid() == euid && getgid() == getegid())
+ return access(path, mode);
+
if (STAT(path, &st) < 0)
return -1;
- euid = geteuid();
-
if (euid == 0) {
/* Root can read or write any file. */
if (!(mode & X_OK))
@@ -1309,7 +1429,6 @@ 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.
*
@@ -1329,6 +1448,28 @@ rb_file_exist_p(VALUE obj, VALUE fname)
/*
* call-seq:
+ * File.exists?(file_name) -> true or false
+ *
+ * Deprecated method. Don't use.
+ */
+static VALUE
+rb_file_exists_p(VALUE obj, VALUE fname)
+{
+ const char *s = "FileTest#";
+ if (obj == rb_mFileTest) {
+ s = "FileTest.";
+ }
+ else if (obj == rb_cFile ||
+ (RB_TYPE_P(obj, T_CLASS) &&
+ RTEST(rb_class_inherited_p(obj, rb_cFile)))) {
+ s = "File.";
+ }
+ rb_warning("%sexists? is a deprecated name, use %sexist? instead", s, s);
+ return rb_file_exist_p(obj, fname);
+}
+
+/*
+ * call-seq:
* File.readable?(file_name) -> true or false
*
* Returns <code>true</code> if the named file is readable by the effective
@@ -1509,12 +1650,14 @@ rb_file_executable_real_p(VALUE obj, VALUE fname)
/*
* call-seq:
- * File.file?(file_name) -> true or false
+ * File.file?(file) -> true or false
*
- * Returns <code>true</code> if the named file exists and is a
- * regular file.
+ * Returns +true+ if the named +file+ exists and is a regular file.
*
- * _file_name_ can be an IO object.
+ * +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.
*/
static VALUE
@@ -1995,6 +2138,65 @@ 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.
+ *
+ * Note that on Windows (NTFS), returns creation time (birth time).
+ *
+ * File.birthtime("testfile") #=> Wed Apr 09 08:53:13 CDT 2003
+ *
+ */
+
+static VALUE
+rb_file_s_birthtime(VALUE klass, VALUE fname)
+{
+ struct stat st;
+
+ if (rb_stat(fname, &st) < 0) {
+ FilePathValue(fname);
+ rb_sys_fail_path(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>.
+ *
+ * Note that on Windows (NTFS), returns creation time (birth time).
+ *
+ * File.new("testfile").birthtime #=> Wed Apr 09 08:53:14 CDT 2003
+ *
+ */
+
+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
@@ -2013,7 +2215,7 @@ rb_file_size(VALUE obj)
GetOpenFile(obj, fptr);
if (fptr->mode & FMODE_WRITABLE) {
- rb_io_flush(obj);
+ rb_io_flush_raw(obj, 0);
}
if (fstat(fptr->fd, &st) == -1) {
rb_sys_fail_path(fptr->pathv);
@@ -2132,6 +2334,24 @@ 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;
@@ -2169,18 +2389,8 @@ rb_file_s_chown(int argc, VALUE *argv)
rb_secure(2);
rb_scan_args(argc, argv, "2*", &o, &g, &rest);
- if (NIL_P(o)) {
- arg.owner = -1;
- }
- else {
- arg.owner = NUM2UIDT(o);
- }
- if (NIL_P(g)) {
- arg.group = -1;
- }
- else {
- arg.group = NUM2GIDT(g);
- }
+ arg.owner = to_uid(o);
+ arg.group = to_gid(g);
n = apply2files(chown_internal, rest, &arg);
return LONG2FIX(n);
@@ -2205,14 +2415,15 @@ static VALUE
rb_file_chown(VALUE obj, VALUE owner, VALUE group)
{
rb_io_t *fptr;
- int o, g;
+ rb_uid_t o;
+ rb_gid_t g;
#ifndef HAVE_FCHOWN
VALUE path;
#endif
rb_secure(2);
- o = NIL_P(owner) ? -1 : NUM2INT(owner);
- g = NIL_P(group) ? -1 : NUM2INT(group);
+ o = to_uid(owner);
+ g = to_gid(group);
GetOpenFile(obj, fptr);
#ifndef HAVE_FCHOWN
if (NIL_P(fptr->pathv)) return Qnil;
@@ -2256,18 +2467,8 @@ rb_file_s_lchown(int argc, VALUE *argv)
rb_secure(2);
rb_scan_args(argc, argv, "2*", &o, &g, &rest);
- if (NIL_P(o)) {
- arg.owner = -1;
- }
- else {
- arg.owner = NUM2UIDT(o);
- }
- if (NIL_P(g)) {
- arg.group = -1;
- }
- else {
- arg.group = NUM2GIDT(g);
- }
+ arg.owner = to_uid(o);
+ arg.group = to_gid(g);
n = apply2files(lchown_internal, rest, &arg);
return LONG2FIX(n);
@@ -2423,6 +2624,9 @@ sys_fail2(VALUE s1, VALUE s2)
const int max_pathlen = MAXPATHLEN;
#endif
+ if (errno == EEXIST) {
+ rb_sys_fail_path(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, ", ");
@@ -2531,6 +2735,7 @@ rb_readlink(VALUE path)
) {
rb_str_modify_expand(v, size);
size *= 2;
+ rb_str_set_len(v, size);
}
if (rv < 0) {
rb_str_resize(v, 0);
@@ -2884,10 +3089,9 @@ ntfs_tail(const char *path, const char *end, rb_encoding *enc)
buflen = RSTRING_LEN(result),\
pend = p + buflen)
-VALUE
-rb_home_dir(const char *user, VALUE result)
+static VALUE
+copy_home_path(VALUE result, const char *dir)
{
- const char *dir;
char *buf;
#if defined DOSISH || defined __CYGWIN__
char *p, *bend;
@@ -2895,29 +3099,9 @@ rb_home_dir(const char *user, VALUE result)
long dirlen;
rb_encoding *enc;
- if (!user || !*user) {
- if (!(dir = getenv("HOME"))) {
- rb_raise(rb_eArgError, "couldn't find HOME environment -- expanding `~'");
- }
- dirlen = strlen(dir);
- rb_str_resize(result, dirlen);
- memcpy(buf = RSTRING_PTR(result), dir, dirlen);
- }
- else {
-#ifdef HAVE_PWD_H
- struct passwd *pwPtr = getpwnam(user);
- if (!pwPtr) {
- endpwent();
- rb_raise(rb_eArgError, "user %s doesn't exist", user);
- }
- dirlen = strlen(pwPtr->pw_dir);
- rb_str_resize(result, dirlen);
- memcpy(buf = RSTRING_PTR(result), pwPtr->pw_dir, dirlen + 1);
- endpwent();
-#else
- return Qnil;
-#endif
- }
+ dirlen = strlen(dir);
+ rb_str_resize(result, dirlen);
+ memcpy(buf = RSTRING_PTR(result), dir, dirlen);
enc = rb_filesystem_encoding();
rb_enc_associate(result, enc);
#if defined DOSISH || defined __CYGWIN__
@@ -2930,6 +3114,33 @@ rb_home_dir(const char *user, VALUE result)
return result;
}
+VALUE
+rb_home_dir_of(VALUE user, VALUE result)
+{
+#ifdef HAVE_PWD_H
+ struct passwd *pwPtr = getpwnam(RSTRING_PTR(user));
+ if (!pwPtr) {
+ endpwent();
+#endif
+ rb_raise(rb_eArgError, "user %"PRIsVALUE" doesn't exist", user);
+#ifdef HAVE_PWD_H
+ }
+ copy_home_path(result, pwPtr->pw_dir);
+ endpwent();
+#endif
+ return result;
+}
+
+VALUE
+rb_default_home_dir(VALUE result)
+{
+ const char *dir = getenv("HOME");
+ if (!dir) {
+ rb_raise(rb_eArgError, "couldn't find HOME environment -- expanding `~'");
+ }
+ return copy_home_path(result, dir);
+}
+
#ifndef _WIN32
static char *
append_fspath(VALUE result, VALUE fname, char *dir, rb_encoding **enc, rb_encoding *fsenc)
@@ -2979,22 +3190,25 @@ rb_file_expand_path_internal(VALUE fname, VALUE dname, int abs_mode, int long_na
b = 0;
rb_str_set_len(result, 0);
if (*++s) ++s;
+ rb_default_home_dir(result);
}
else {
s = nextdirsep(b = s, fend, enc);
+ b++; /* b[0] is '~' */
userlen = s - b;
BUFCHECK(bdiff + userlen >= buflen);
memcpy(p, b, userlen);
+ ENC_CODERANGE_CLEAR(result);
rb_str_set_len(result, userlen);
+ rb_enc_associate(result, enc);
+ rb_home_dir_of(result, result);
buf = p + 1;
p += userlen;
}
- if (NIL_P(rb_home_dir(buf, result))) {
- rb_raise(rb_eArgError, "can't find user %s", buf);
- }
if (!rb_is_absolute_path(RSTRING_PTR(result))) {
if (userlen) {
- rb_raise(rb_eArgError, "non-absolute home of %.*s", (int)userlen, b);
+ rb_enc_raise(enc, rb_eArgError, "non-absolute home of %.*s%.0"PRIsVALUE,
+ (int)userlen, b, fname);
}
else {
rb_raise(rb_eArgError, "non-absolute home");
@@ -3300,6 +3514,16 @@ 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))))
@@ -3314,13 +3538,13 @@ VALUE
rb_file_expand_path(VALUE fname, VALUE dname)
{
check_expand_path_args(fname, dname);
- return rb_file_expand_path_internal(fname, dname, 0, 1, EXPAND_PATH_BUFFER());
+ return expand_path(fname, dname, 0, 1, EXPAND_PATH_BUFFER());
}
VALUE
rb_file_expand_path_fast(VALUE fname, VALUE dname)
{
- return rb_file_expand_path_internal(fname, dname, 0, 0, EXPAND_PATH_BUFFER());
+ return expand_path(fname, dname, 0, 0, EXPAND_PATH_BUFFER());
}
/*
@@ -3329,19 +3553,30 @@ rb_file_expand_path_fast(VALUE fname, VALUE dname)
*
* Converts a pathname to an absolute pathname. Relative paths are
* referenced from the current working directory of the process unless
- * <i>dir_string</i> is given, in which case it will be used as the
+ * +dir_string+ is given, in which case it will be used as the
* starting point. The given pathname may start with a
* ``<code>~</code>'', which expands to the process owner's home
- * directory (the environment variable <code>HOME</code> must be set
+ * directory (the environment variable +HOME+ must be set
* correctly). ``<code>~</code><i>user</i>'' expands to the named
* user's home directory.
*
* File.expand_path("~oracle/bin") #=> "/home/oracle/bin"
- * File.expand_path("../../bin", "/tmp/x") #=> "/bin"
+ *
+ * A simple example of using +dir_string+ is as follows.
+ * File.expand_path("ruby", "/usr/bin") #=> "/usr/bin/ruby"
+ *
+ * A more complex example which also resolves parent directory is as follows.
+ * Suppose we are in bin/mygem and want the absolute path of lib/mygem.rb.
+ *
+ * File.expand_path("../../lib/mygem.rb", __FILE__)
+ * #=> ".../path/to/project/lib/mygem.rb"
+ *
+ * So first it resolves the parent of __FILE__, that is bin/, then go to the
+ * parent, the root of the project and appends +lib/mygem.rb+.
*/
VALUE
-rb_file_s_expand_path(int argc, VALUE *argv)
+rb_file_s_expand_path(int argc, const VALUE *argv)
{
VALUE fname, dname;
@@ -3357,7 +3592,7 @@ VALUE
rb_file_absolute_path(VALUE fname, VALUE dname)
{
check_expand_path_args(fname, dname);
- return rb_file_expand_path_internal(fname, dname, 1, 1, EXPAND_PATH_BUFFER());
+ return expand_path(fname, dname, 1, 1, EXPAND_PATH_BUFFER());
}
/*
@@ -3374,7 +3609,7 @@ rb_file_absolute_path(VALUE fname, VALUE dname)
*/
VALUE
-rb_file_s_absolute_path(int argc, VALUE *argv)
+rb_file_s_absolute_path(int argc, const VALUE *argv)
{
VALUE fname, dname;
@@ -3719,13 +3954,15 @@ ruby_enc_find_basename(const char *name, long *baselen, long *alllen, rb_encodin
*
* Returns the last component of the filename given in <i>file_name</i>,
* which can be formed using both <code>File::SEPARATOR</code> and
- * <code>File::ALT_SEPARETOR</code> as the separator when
+ * <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.
+ * it is removed. If <i>suffix</i> is ".*", any extension will be
+ * 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
@@ -3776,7 +4013,7 @@ rb_file_s_basename(int argc, VALUE *argv)
*
* Returns all components of the filename given in <i>file_name</i>
* except the last one. The filename can be formed using both
- * <code>File::SEPARATOR</code> and <code>File::ALT_SEPARETOR</code> as the
+ * <code>File::SEPARATOR</code> and <code>File::ALT_SEPARATOR</code> as the
* separator when <code>File::ALT_SEPARATOR</code> is not <code>nil</code>.
*
* File.dirname("/home/gumby/work/ruby.rb") #=> "/home/gumby/work"
@@ -3996,7 +4233,7 @@ rb_file_join(VALUE ary, VALUE sep)
len = 1;
for (i=0; i<RARRAY_LEN(ary); i++) {
- tmp = RARRAY_PTR(ary)[i];
+ tmp = RARRAY_AREF(ary, i);
if (RB_TYPE_P(tmp, T_STRING)) {
check_path_encoding(tmp);
len += RSTRING_LEN(tmp);
@@ -4010,10 +4247,10 @@ rb_file_join(VALUE ary, VALUE sep)
len += RSTRING_LEN(sep) * (RARRAY_LEN(ary) - 1);
}
result = rb_str_buf_new(len);
- RBASIC(result)->klass = 0;
+ RBASIC_CLEAR_CLASS(result);
OBJ_INFECT(result, ary);
for (i=0; i<RARRAY_LEN(ary); i++) {
- tmp = RARRAY_PTR(ary)[i];
+ tmp = RARRAY_AREF(ary, i);
switch (TYPE(tmp)) {
case T_STRING:
if (!checked) check_path_encoding(tmp);
@@ -4054,14 +4291,14 @@ rb_file_join(VALUE ary, VALUE sep)
rb_str_buf_append(result, tmp);
rb_enc_associate(result, enc);
}
- RBASIC(result)->klass = rb_cString;
+ RBASIC_SET_CLASS_RAW(result, rb_cString);
return result;
}
/*
* call-seq:
- * File.join(string, ...) -> path
+ * File.join(string, ...) -> string
*
* Returns a new string formed by joining the strings using
* <code>File::SEPARATOR</code>.
@@ -4095,10 +4332,16 @@ rb_file_s_join(VALUE klass, VALUE args)
static VALUE
rb_file_s_truncate(VALUE klass, VALUE path, VALUE len)
{
+#ifdef HAVE_TRUNCATE
+#define NUM2POS(n) NUM2OFFT(n)
off_t pos;
+#else
+#define NUM2POS(n) NUM2LONG(n)
+ long pos;
+#endif
rb_secure(2);
- pos = NUM2OFFT(len);
+ pos = NUM2POS(len);
FilePathValue(path);
path = rb_str_encode_ospath(path);
#ifdef HAVE_TRUNCATE
@@ -4120,6 +4363,7 @@ rb_file_s_truncate(VALUE klass, VALUE path, VALUE len)
}
#endif
return INT2FIX(0);
+#undef NUM2POS
}
#else
#define rb_file_s_truncate rb_f_notimplement
@@ -4144,15 +4388,21 @@ static VALUE
rb_file_truncate(VALUE obj, VALUE len)
{
rb_io_t *fptr;
+#if defined(HAVE_FTRUNCATE)
+#define NUM2POS(n) NUM2OFFT(n)
off_t pos;
+#else
+#define NUM2POS(n) NUM2LONG(n)
+ long pos;
+#endif
rb_secure(2);
- pos = NUM2OFFT(len);
+ pos = NUM2POS(len);
GetOpenFile(obj, fptr);
if (!(fptr->mode & FMODE_WRITABLE)) {
rb_raise(rb_eIOError, "not opened for writing");
}
- rb_io_flush(obj);
+ rb_io_flush_raw(obj, 0);
#ifdef HAVE_FTRUNCATE
if (ftruncate(fptr->fd, pos) < 0)
rb_sys_fail_path(fptr->pathv);
@@ -4161,6 +4411,7 @@ rb_file_truncate(VALUE obj, VALUE len)
rb_sys_fail_path(fptr->pathv);
#endif
return INT2FIX(0);
+#undef NUM2POS
}
#else
#define rb_file_truncate rb_f_notimplement
@@ -4181,7 +4432,6 @@ rb_file_truncate(VALUE obj, VALUE len)
#ifdef __CYGWIN__
#include <winerror.h>
-extern unsigned long __attribute__((stdcall)) GetLastError(void);
#endif
static VALUE
@@ -4258,7 +4508,7 @@ rb_file_flock(VALUE obj, VALUE operation)
op[0] = fptr->fd;
if (fptr->mode & FMODE_WRITABLE) {
- rb_io_flush(obj);
+ rb_io_flush_raw(obj, 0);
}
while ((int)rb_thread_io_blocking_region(rb_thread_flock, op, fptr->fd) < 0) {
switch (errno) {
@@ -4310,7 +4560,7 @@ test_check(int n, int argc, VALUE *argv)
* call-seq:
* test(cmd, file1 [, file2] ) -> obj
*
- * Uses the integer +cmd+ to perform various tests on +file1+ (first
+ * Uses the character +cmd+ to perform various tests on +file1+ (first
* table below) or on +file1+ and +file2+ (second table).
*
* File tests on a single file:
@@ -4393,7 +4643,6 @@ 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]);
@@ -5287,7 +5536,8 @@ is_explicit_relative(const char *path)
static VALUE
copy_path_class(VALUE path, VALUE orig)
{
- RBASIC(path)->klass = rb_obj_class(orig);
+ str_shrink(path);
+ RBASIC_SET_CLASS(path, rb_obj_class(orig));
OBJ_FREEZE(path);
return path;
}
@@ -5335,22 +5585,18 @@ rb_find_file_ext_safe(VALUE *filep, const char *const *ext, int safe_level)
return 0;
}
- if (safe_level >= 4) {
- rb_raise(rb_eSecurityError, "loading from non-absolute path %s", f);
- }
-
RB_GC_GUARD(load_path) = rb_get_expanded_load_path();
if (!load_path) return 0;
fname = rb_str_dup(*filep);
- RBASIC(fname)->klass = 0;
+ RBASIC_CLEAR_CLASS(fname);
fnlen = RSTRING_LEN(fname);
tmp = rb_str_tmp_new(MAXPATHLEN + 2);
rb_enc_associate_index(tmp, rb_usascii_encindex());
for (j=0; ext[j]; j++) {
rb_str_cat2(fname, ext[j]);
for (i = 0; i < RARRAY_LEN(load_path); i++) {
- VALUE str = RARRAY_PTR(load_path)[i];
+ VALUE str = RARRAY_AREF(load_path, i);
RB_GC_GUARD(str) = rb_get_path_check(str, safe_level);
if (RSTRING_LEN(str) == 0) continue;
@@ -5359,7 +5605,7 @@ rb_find_file_ext_safe(VALUE *filep, const char *const *ext, int safe_level)
*filep = copy_path_class(tmp, *filep);
return (int)(j+1);
}
- FL_UNSET(tmp, FL_TAINT | FL_UNTRUSTED);
+ FL_UNSET(tmp, FL_TAINT);
}
rb_str_set_len(fname, fnlen);
}
@@ -5400,10 +5646,6 @@ rb_find_file_safe(VALUE path, int safe_level)
return path;
}
- if (safe_level >= 4) {
- rb_raise(rb_eSecurityError, "loading from non-absolute path %s", f);
- }
-
RB_GC_GUARD(load_path) = rb_get_expanded_load_path();
if (load_path) {
long i;
@@ -5411,7 +5653,7 @@ rb_find_file_safe(VALUE path, int safe_level)
tmp = rb_str_tmp_new(MAXPATHLEN + 2);
rb_enc_associate_index(tmp, rb_usascii_encindex());
for (i = 0; i < RARRAY_LEN(load_path); i++) {
- VALUE str = RARRAY_PTR(load_path)[i];
+ VALUE str = RARRAY_AREF(load_path, i);
RB_GC_GUARD(str) = rb_get_path_check(str, safe_level);
if (RSTRING_LEN(str) > 0) {
rb_file_expand_path_internal(path, str, 0, 0, tmp);
@@ -5482,6 +5724,8 @@ static const char null_device[] =
* <code>0644</code>, which means read/write for owner, read-only for
* all others. The only change that can be made is to make the file
* read-only, which is reported as <code>0444</code>.
+ *
+ * Various constants for the methods in File can be found in File::Constants.
*/
void
@@ -5492,7 +5736,7 @@ Init_File(void)
define_filetest_function("directory?", rb_file_directory_p, 1);
define_filetest_function("exist?", rb_file_exist_p, 1);
- define_filetest_function("exists?", rb_file_exist_p, 1);
+ define_filetest_function("exists?", rb_file_exists_p, 1);
define_filetest_function("readable?", rb_file_readable_p, 1);
define_filetest_function("readable_real?", rb_file_readable_real_p, 1);
define_filetest_function("world_readable?", rb_file_world_readable_p, 1);
@@ -5528,6 +5772,7 @@ 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);
@@ -5554,16 +5799,19 @@ Init_File(void)
rb_define_singleton_method(rb_cFile, "path", rb_file_s_path, 1);
separator = rb_obj_freeze(rb_usascii_str_new2("/"));
+ /* separates directory parts in path */
rb_define_const(rb_cFile, "Separator", separator);
rb_define_const(rb_cFile, "SEPARATOR", separator);
rb_define_singleton_method(rb_cFile, "split", rb_file_s_split, 1);
rb_define_singleton_method(rb_cFile, "join", rb_file_s_join, -2);
#ifdef DOSISH
+ /* platform specific alternative separator */
rb_define_const(rb_cFile, "ALT_SEPARATOR", rb_obj_freeze(rb_usascii_str_new2(file_alt_separator)));
#else
rb_define_const(rb_cFile, "ALT_SEPARATOR", Qnil);
#endif
+ /* path list separator */
rb_define_const(rb_cFile, "PATH_SEPARATOR", rb_obj_freeze(rb_str_new2(PATH_SEP)));
rb_define_method(rb_cIO, "stat", rb_io_stat, 0); /* this is IO's method */
@@ -5572,6 +5820,7 @@ 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);
@@ -5693,6 +5942,7 @@ 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);
@@ -5723,8 +5973,4 @@ Init_File(void)
rb_define_method(rb_cStat, "setuid?", rb_stat_suid, 0);
rb_define_method(rb_cStat, "setgid?", rb_stat_sgid, 0);
rb_define_method(rb_cStat, "sticky?", rb_stat_sticky, 0);
-
-#ifdef _WIN32
- rb_w32_init_file();
-#endif
}
diff --git a/gc.c b/gc.c
index 84af4d6f58..5ee5beea26 100644
--- a/gc.c
+++ b/gc.c
@@ -17,6 +17,7 @@
#include "ruby/io.h"
#include "ruby/thread.h"
#include "ruby/util.h"
+#include "ruby/debug.h"
#include "eval_intern.h"
#include "vm_core.h"
#include "internal.h"
@@ -25,10 +26,44 @@
#include "ruby_atomic.h"
#include "probes.h"
#include <stdio.h>
+#include <stdarg.h>
#include <setjmp.h>
#include <sys/types.h>
#include <assert.h>
+#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
+# 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
+
+#if /* is ASAN enabled? */ \
+ __has_feature(address_sanitizer) /* Clang */ || \
+ defined(__SANITIZE_ADDRESS__) /* GCC 4.8.x */
+ #define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS \
+ __attribute__((no_address_safety_analysis)) \
+ __attribute__((noinline))
+#else
+ #define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS
+#endif
+
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
@@ -50,53 +85,235 @@
#include <malloc.h>
#endif
-#ifdef HAVE_VALGRIND_MEMCHECK_H
-# include <valgrind/memcheck.h>
-# ifndef VALGRIND_MAKE_MEM_DEFINED
-# define VALGRIND_MAKE_MEM_DEFINED(p, n) VALGRIND_MAKE_READABLE((p), (n))
-# endif
-# ifndef VALGRIND_MAKE_MEM_UNDEFINED
-# define VALGRIND_MAKE_MEM_UNDEFINED(p, n) VALGRIND_MAKE_WRITABLE((p), (n))
-# endif
-#else
-# define VALGRIND_MAKE_MEM_DEFINED(p, n) 0
-# define VALGRIND_MAKE_MEM_UNDEFINED(p, n) 0
-#endif
-
#define rb_setjmp(env) RUBY_SETJMP(env)
#define rb_jmp_buf rb_jmpbuf_t
-#ifndef GC_MALLOC_LIMIT
-#define GC_MALLOC_LIMIT 8000000
+#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;
+volatile VALUE *
+rb_gc_guarded_ptr_val(volatile VALUE *ptr, VALUE val)
+{
+ rb_gc_guarded_val = val;
+
+ return ptr;
+}
#endif
-#define HEAP_MIN_SLOTS 10000
-#define FREE_MIN 4096
-typedef struct {
- unsigned int initial_malloc_limit;
- unsigned int initial_heap_min_slots;
- unsigned int initial_free_min;
-#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
- int gc_stress;
+#ifndef GC_HEAP_FREE_SLOTS
+#define GC_HEAP_FREE_SLOTS 4096
+#endif
+#ifndef GC_HEAP_INIT_SLOTS
+#define GC_HEAP_INIT_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
+#endif
+
+#ifndef GC_MALLOC_LIMIT_MIN
+#define GC_MALLOC_LIMIT_MIN (16 * 1024 * 1024 /* 16MB */)
+#endif
+#ifndef GC_MALLOC_LIMIT_MAX
+#define GC_MALLOC_LIMIT_MAX (32 * 1024 * 1024 /* 32MB */)
+#endif
+#ifndef GC_MALLOC_LIMIT_GROWTH_FACTOR
+#define GC_MALLOC_LIMIT_GROWTH_FACTOR 1.4
+#endif
+
+#ifndef GC_OLDMALLOC_LIMIT_MIN
+#define GC_OLDMALLOC_LIMIT_MIN (16 * 1024 * 1024 /* 16MB */)
+#endif
+#ifndef GC_OLDMALLOC_LIMIT_GROWTH_FACTOR
+#define GC_OLDMALLOC_LIMIT_GROWTH_FACTOR 1.2
+#endif
+#ifndef GC_OLDMALLOC_LIMIT_MAX
+#define GC_OLDMALLOC_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)
+#define TICK_TYPE 1
+
+typedef struct {
+ size_t heap_init_slots;
+ size_t heap_free_slots;
+ double growth_factor;
+ size_t growth_max_slots;
+ double oldobject_limit_factor;
+ size_t malloc_limit_min;
+ size_t malloc_limit_max;
+ double malloc_limit_growth_factor;
+ size_t oldmalloc_limit_min;
+ size_t oldmalloc_limit_max;
+ double oldmalloc_limit_growth_factor;
+ VALUE gc_stress;
} ruby_gc_params_t;
-static ruby_gc_params_t initial_params = {
- GC_MALLOC_LIMIT,
- HEAP_MIN_SLOTS,
- FREE_MIN,
+static ruby_gc_params_t gc_params = {
+ GC_HEAP_INIT_SLOTS,
+ GC_HEAP_FREE_SLOTS,
+ GC_HEAP_GROWTH_FACTOR,
+ GC_HEAP_GROWTH_MAX_SLOTS,
+ GC_HEAP_OLDOBJECT_LIMIT_FACTOR,
+ 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,
#if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
FALSE,
#endif
};
-#define nomem_error GET_VM()->special_exceptions[ruby_error_nomemory]
+/* GC_DEBUG:
+ * enable to embed GC debugging information.
+ */
+#ifndef GC_DEBUG
+#define GC_DEBUG 0
+#endif
+
+#if USE_RGENGC
+/* RGENGC_DEBUG:
+ * 1: basic information
+ * 2: remember set operation
+ * 3: mark
+ * 4:
+ * 5: sweep
+ */
+#ifndef RGENGC_DEBUG
+#define RGENGC_DEBUG 0
+#endif
+
+/* 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 livness check
+ * 5: show all references
+ */
+#ifndef RGENGC_CHECK_MODE
+#define RGENGC_CHECK_MODE 0
+#endif
+
+/* RGENGC_PROFILE
+ * 0: disable RGenGC profiling
+ * 1: enable profiling for basic information
+ * 2: enable profiling for each types
+ */
+#ifndef RGENGC_PROFILE
+#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.
+ */
+#ifndef RGENGC_ESTIMATE_OLDMALLOC
+#define RGENGC_ESTIMATE_OLDMALLOC 1
+#endif
+
+/* RGENGC_FORCE_MAJOR_GC
+ * Force major/full GC if this macro is not 0.
+ */
+#ifndef RGENGC_FORCE_MAJOR_GC
+#define RGENGC_FORCE_MAJOR_GC 0
+#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
+
+#endif /* USE_RGENGC */
#ifndef GC_PROFILE_MORE_DETAIL
#define GC_PROFILE_MORE_DETAIL 0
#endif
+#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
+
+typedef enum {
+ 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,
+
+ /* gc reason */
+ GPR_FLAG_NEWOBJ = 0x100,
+ GPR_FLAG_MALLOC = 0x200,
+ GPR_FLAG_METHOD = 0x400,
+ GPR_FLAG_CAPI = 0x800,
+ GPR_FLAG_STRESS = 0x1000,
+
+ /* others */
+ GPR_FLAG_IMMEDIATE_SWEEP = 0x2000,
+ GPR_FLAG_HAVE_FINALIZE = 0x4000
+} gc_profile_record_flag;
typedef struct gc_profile_record {
+ int flags;
+
double gc_time;
double gc_invoke_time;
@@ -104,20 +321,34 @@ typedef struct gc_profile_record {
size_t heap_use_size;
size_t heap_total_size;
- int is_marked;
-
#if GC_PROFILE_MORE_DETAIL
double gc_mark_time;
double gc_sweep_time;
- size_t heap_use_slots;
+ size_t heap_use_pages;
size_t heap_live_objects;
size_t heap_free_objects;
- int have_finalize;
-
size_t allocate_increase;
size_t allocate_limit;
+
+ double prepare_time;
+ size_t removing_objects;
+ size_t empty_objects;
+#if GC_PROFILE_DETAIL_MEMORY
+ long maxrss;
+ long minflt;
+ long majflt;
+#endif
+#endif
+#if MALLOC_ALLOCATED_SIZE
+ size_t allocated_size;
+#endif
+
+#if RGENGC_PROFILE > 0
+ size_t old_objects;
+ size_t remembered_normal_objects;
+ size_t remembered_shady_objects;
#endif
} gc_profile_record;
@@ -148,10 +379,17 @@ typedef struct RVALUE {
struct RMatch match;
struct RRational rational;
struct RComplex complex;
+ struct RSymbol symbol;
+ struct {
+ struct RBasic basic;
+ VALUE v1;
+ VALUE v2;
+ VALUE v3;
+ } values;
} as;
-#ifdef GC_DEBUG
+#if GC_DEBUG
const char *file;
- int line;
+ int line;
#endif
} RVALUE;
@@ -159,25 +397,20 @@ typedef struct RVALUE {
#pragma pack(pop)
#endif
-struct heaps_slot {
- struct heaps_header *header;
- uintptr_t *bits;
- RVALUE *freelist;
- struct heaps_slot *next;
- struct heaps_slot *prev;
- struct heaps_slot *free_next;
+typedef uintptr_t bits_t;
+enum {
+ BITS_SIZE = sizeof(bits_t),
+ BITS_BITLENGTH = ( BITS_SIZE * CHAR_BIT )
};
-struct heaps_header {
- struct heaps_slot *base;
- uintptr_t *bits;
- RVALUE *start;
- RVALUE *end;
- size_t limit;
+struct heap_page_header {
+ struct heap_page *page;
};
-struct heaps_free_bitmap {
- struct heaps_free_bitmap *next;
+struct heap_page_body {
+ struct heap_page_header header;
+ /* char gap[]; */
+ /* RVALUE values[]; */
};
struct gc_list {
@@ -195,101 +428,283 @@ typedef struct stack_chunk {
typedef struct mark_stack {
stack_chunk_t *chunk;
stack_chunk_t *cache;
- size_t index;
- size_t limit;
+ int index;
+ int limit;
size_t cache_size;
size_t unused_cache_size;
} mark_stack_t;
-#ifndef CALC_EXACT_MALLOC_SIZE
-#define CALC_EXACT_MALLOC_SIZE 0
-#endif
+typedef struct rb_heap_struct {
+ RVALUE *freelist;
+
+ struct heap_page *free_pages;
+ struct heap_page *using_page;
+ struct heap_page *pages;
+ struct heap_page *sweep_pages;
+ struct heap_page *pooled_pages;
+
+ size_t page_length; /* total page count in a heap */
+ size_t total_slots; /* total slot count (page_length * HEAP_OBJ_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 CALC_EXACT_MALLOC_SIZE
+#if MALLOC_ALLOCATED_SIZE
size_t allocated_size;
size_t allocations;
#endif
} malloc_params;
+
struct {
- size_t increment;
- struct heaps_slot *ptr;
- struct heaps_slot *sweep_slots;
- struct heaps_slot *free_slots;
- struct heaps_header **sorted;
- size_t length;
- size_t used;
- struct heaps_free_bitmap *free_bitmap;
- RVALUE *range[2];
- struct heaps_header *freed;
- size_t marked_num;
- size_t free_num;
- size_t free_min;
- size_t final_num;
- size_t do_heap_free;
- } heap;
- struct {
- int dont_gc;
- int dont_lazy_sweep;
- int during_gc;
- rb_atomic_t finalizing;
+ 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;
+#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 {
- st_table *table;
- RVALUE *deferred;
- } final;
+ 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;
+ RVALUE *range[2];
+
+ size_t swept_slots;
+ size_t min_free_slots;
+ size_t max_free_slots;
+
+ /* final */
+ size_t final_slots;
+ VALUE deferred_final;
+ } heap_pages;
+
+ st_table *finalizer_table;
+
struct {
int run;
- gc_profile_record *record;
- size_t count;
+ int latest_gc_info;
+ gc_profile_record *records;
+ gc_profile_record *current_record;
+ size_t next_index;
size_t size;
+
+#if GC_PROFILE_MORE_DETAIL
+ double prepare_time;
+#endif
double invoke_time;
+
+#if USE_RGENGC
+ 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;
+
+#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 remembered_normal_object_count_types[RUBY_T_MASK];
+ size_t remembered_shady_object_count_types[RUBY_T_MASK];
+#endif
+#endif /* RGENGC_PROFILE */
+#endif /* USE_RGENGC */
+
+ /* temporary profiling space */
+ double gc_sweep_start_time;
+ size_t total_allocated_objects_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;
} profile;
struct gc_list *global_list;
- size_t count;
- size_t total_allocated_object_num;
- size_t total_freed_object_num;
- int gc_stress;
- struct mark_func_data_struct {
- void *data;
- void (*mark_func)(VALUE v, void *data);
- } *mark_func_data;
+ VALUE gc_stress_mode;
+
+#if USE_RGENGC
+ struct {
+ VALUE parent_object;
+ int need_major_gc;
+ size_t last_major_gc;
+ size_t remembered_wb_unprotected_objects;
+ size_t remembered_wb_unprotected_objects_limit;
+ size_t old_objects;
+ size_t old_objects_limit;
+ size_t old_objects_at_gc_start;
+
+#if RGENGC_ESTIMATE_OLDMALLOC
+ size_t oldmalloc_increase;
+ size_t oldmalloc_increase_limit;
+#endif
+
+#if RGENGC_CHECK_MODE >= 2
+ struct st_table *allrefs_table;
+ size_t error_count;
+#endif
+ } rgengc;
+#endif /* USE_RGENGC */
} rb_objspace_t;
+
+#ifndef HEAP_ALIGN_LOG
+/* default tiny heap size: 16KB */
+#define HEAP_ALIGN_LOG 14
+#endif
+#define CEILDIV(i, mod) (((i) + (mod) - 1)/(mod))
+enum {
+ HEAP_ALIGN = (1UL << HEAP_ALIGN_LOG),
+ HEAP_ALIGN_MASK = (~(~0UL << HEAP_ALIGN_LOG)),
+ REQUIRED_SIZE_BY_MALLOC = (sizeof(size_t) * 5),
+ HEAP_SIZE = (HEAP_ALIGN - REQUIRED_SIZE_BY_MALLOC),
+ HEAP_OBJ_LIMIT = (unsigned int)((HEAP_SIZE - sizeof(struct heap_page_header))/sizeof(struct RVALUE)),
+ HEAP_BITMAP_LIMIT = CEILDIV(CEILDIV(HEAP_SIZE, sizeof(struct RVALUE)), BITS_BITLENGTH),
+ HEAP_BITMAP_SIZE = ( BITS_SIZE * HEAP_BITMAP_LIMIT),
+ HEAP_BITMAP_PLANES = USE_RGENGC ? 3 : 1 /* RGENGC: mark bits, rememberset bits and oldgen bits */
+};
+
+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 heap_page *free_next;
+ RVALUE *start;
+ RVALUE *freelist;
+ struct heap_page *next;
+
+ struct {
+ unsigned int before_sweep : 1;
+ unsigned int has_remembered_objects : 1;
+ unsigned int has_long_lived_shady_objects : 1;
+ } flags;
+
+#if USE_RGENGC
+ bits_t wb_unprotected_bits[HEAP_BITMAP_LIMIT];
+#endif
+ /* the following three bitmaps are cleared at the beggining of full GC */
+ bits_t mark_bits[HEAP_BITMAP_LIMIT];
+#if USE_RGENGC
+ bits_t long_lived_bits[HEAP_BITMAP_LIMIT];
+ bits_t marking_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))
+
+/* 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_LONG_LIVED_BITS(x) (&GET_HEAP_PAGE(x)->long_lived_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 initial_params.gc_stress
-int *ruby_initial_gc_stress_ptr = &ruby_initial_gc_stress;
#else
-static rb_objspace_t rb_objspace = {{GC_MALLOC_LIMIT}};
-int *ruby_initial_gc_stress_ptr = &rb_objspace.gc_stress;
+static rb_objspace_t rb_objspace = {{GC_MALLOC_LIMIT_MIN}};
#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 heaps objspace->heap.ptr
-#define heaps_length objspace->heap.length
-#define heaps_used objspace->heap.used
-#define lomem objspace->heap.range[0]
-#define himem objspace->heap.range[1]
-#define heaps_inc objspace->heap.increment
-#define heaps_freed objspace->heap.freed
+#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_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_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_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->flags.finalizing
-#define finalizer_table objspace->final.table
-#define deferred_final_list objspace->final.deferred
-#define global_List objspace->global_list
-#define ruby_gc_stress objspace->gc_stress
-#define initial_malloc_limit initial_params.initial_malloc_limit
-#define initial_heap_min_slots initial_params.initial_heap_min_slots
-#define initial_free_min initial_params.initial_free_min
-
-#define is_lazy_sweeping(objspace) ((objspace)->heap.sweep_slots != 0)
+#define finalizing objspace->atomic_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
+
+#define is_marking(objspace) ((objspace)->flags.stat == gc_stat_marking)
+#define is_sweeping(objspace) ((objspace)->flags.stat == gc_stat_sweeping)
+#define is_full_marking(objspace) ((objspace)->flags.during_minor_gc == FALSE)
+#if GC_ENABLE_INCREMENTAL_MARK
+#define is_incremental_marking(objspace) ((objspace)->flags.during_incremental_marking != FALSE)
+#else
+#define is_incremental_marking(objspace) 0
+#endif
+#define is_lazy_sweeping(heap) (GC_ENABLE_LAZY_SWEEP && (heap)->sweep_pages != 0)
+#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) 0
+#endif
#if SIZEOF_LONG == SIZEOF_VOIDP
# define nonspecial_obj_id(obj) (VALUE)((SIGNED_VALUE)(obj)|FIXNUM_FLAG)
@@ -303,44 +718,26 @@ int *ruby_initial_gc_stress_ptr = &rb_objspace.gc_stress;
#endif
#define RANY(o) ((RVALUE*)(o))
-#define has_free_object (objspace->heap.free_slots && objspace->heap.free_slots->freelist)
-
-#define HEAP_HEADER(p) ((struct heaps_header *)(p))
-#define GET_HEAP_HEADER(x) (HEAP_HEADER((uintptr_t)(x) & ~(HEAP_ALIGN_MASK)))
-#define GET_HEAP_SLOT(x) (GET_HEAP_HEADER(x)->base)
-#define GET_HEAP_BITMAP(x) (GET_HEAP_HEADER(x)->bits)
-#define NUM_IN_SLOT(p) (((uintptr_t)(p) & HEAP_ALIGN_MASK)/sizeof(RVALUE))
-#define BITMAP_INDEX(p) (NUM_IN_SLOT(p) / (sizeof(uintptr_t) * CHAR_BIT))
-#define BITMAP_OFFSET(p) (NUM_IN_SLOT(p) & ((sizeof(uintptr_t) * CHAR_BIT)-1))
-#define MARKED_IN_BITMAP(bits, p) (bits[BITMAP_INDEX(p)] & ((uintptr_t)1 << BITMAP_OFFSET(p)))
-#ifndef HEAP_ALIGN_LOG
-/* default tiny heap size: 16KB */
-#define HEAP_ALIGN_LOG 14
-#endif
+struct RZombie {
+ struct RBasic basic;
+ VALUE next;
+ void (*dfree)(void *);
+ void *data;
+};
-#define CEILDIV(i, mod) (((i) + (mod) - 1)/(mod))
+#define RZOMBIE(o) ((struct RZombie *)(o))
-enum {
- HEAP_ALIGN = (1UL << HEAP_ALIGN_LOG),
- HEAP_ALIGN_MASK = (~(~0UL << HEAP_ALIGN_LOG)),
- REQUIRED_SIZE_BY_MALLOC = (sizeof(size_t) * 5),
- HEAP_SIZE = (HEAP_ALIGN - REQUIRED_SIZE_BY_MALLOC),
- HEAP_OBJ_LIMIT = (unsigned int)((HEAP_SIZE - sizeof(struct heaps_header))/sizeof(struct RVALUE)),
- HEAP_BITMAP_LIMIT = CEILDIV(CEILDIV(HEAP_SIZE, sizeof(struct RVALUE)), sizeof(uintptr_t) * CHAR_BIT)
-};
+#define nomem_error GET_VM()->special_exceptions[ruby_error_nomemory]
int ruby_gc_debug_indent = 0;
VALUE rb_mGC;
-extern st_table *rb_class_tbl;
-int ruby_disable_gc_stress = 0;
+int ruby_disable_gc = 0;
+
+void rb_gcdebug_print_obj_condition(VALUE obj);
static void rb_objspace_call_finalizer(rb_objspace_t *objspace);
static VALUE define_final0(VALUE obj, VALUE block);
-VALUE rb_define_final(VALUE obj, VALUE block);
-VALUE rb_undefine_final(VALUE obj);
-static void run_final(rb_objspace_t *objspace, VALUE obj);
-static void initial_expand_heap(rb_objspace_t *objspace);
static void negative_size_allocation_error(const char *);
static void *aligned_malloc(size_t, size_t);
@@ -348,22 +745,429 @@ static void aligned_free(void *);
static void init_mark_stack(mark_stack_t *stack);
-static VALUE lazy_sweep_enable(void);
-static int garbage_collect(rb_objspace_t *);
-static int gc_prepare_free_objects(rb_objspace_t *);
-static void mark_tbl(rb_objspace_t *, st_table *);
-static void rest_sweep(rb_objspace_t *);
-static void gc_mark_stacked_objects(rb_objspace_t *);
+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_step(rb_objspace_t *objspace, int slots);
+static void gc_marks_rest(rb_objspace_t *objspace);
+static void gc_marks_continue(rb_objspace_t *objspace, rb_heap_t *heap);
+
+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);
+static void gc_sweep_continue(rb_objspace_t *objspace, rb_heap_t *heap);
+
+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 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 double getrusage_time(void);
+static inline void gc_prof_setup_new_record(rb_objspace_t *objspace, int reason);
static inline void gc_prof_timer_start(rb_objspace_t *);
-static inline void gc_prof_timer_stop(rb_objspace_t *, int);
+static inline void gc_prof_timer_stop(rb_objspace_t *);
static inline void gc_prof_mark_timer_start(rb_objspace_t *);
static inline void gc_prof_mark_timer_stop(rb_objspace_t *);
static inline void gc_prof_sweep_timer_start(rb_objspace_t *);
static inline void gc_prof_sweep_timer_stop(rb_objspace_t *);
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))
+
+#if USE_RGENGC
+#define RVALUE_WB_UNPROTECTED_BITMAP(obj) MARKED_IN_BITMAP(GET_HEAP_WB_UNPROTECTED_BITS(obj), (obj))
+#define RVALUE_LONG_LIVED_BITMAP(obj) MARKED_IN_BITMAP(GET_HEAP_LONG_LIVED_BITS(obj), (obj))
+#define RVALUE_MARKING_BITMAP(obj) MARKED_IN_BITMAP(GET_HEAP_MARKING_BITS(obj), (obj))
+
+#define RVALUE_PAGE_WB_UNPROTECTED(apge, obj) MARKED_IN_BITMAP((page)->wb_unprotected_bits, (obj))
+#define RVALUE_PAGE_LONG_LIVED(page, obj) MARKED_IN_BITMAP((page)->long_lived_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);
+}
+
+#endif /* USE_RGENGC */
+
+static inline VALUE
+check_rvalue_consistency(const VALUE obj)
+{
+#if RGENGC_CHECK_MODE > 0
+ rb_objspace_t *objspace = &rb_objspace;
+
+ if (!is_pointer_to_heap(objspace, (void *)obj)) {
+ rb_bug("check_rvalue_consistency: %p is not a Ruby object.", (void *)obj);
+ }
+ else if (SPECIAL_CONST_P(obj)) {
+ rb_bug("check_rvalue_consistency: %p is a special const.", (void *)obj);
+ }
+ else {
+ int wb_unprotected_bit = RVALUE_WB_UNPROTECTED_BITMAP(obj) != 0;
+ int long_lived_bit = RVALUE_LONG_LIVED_BITMAP(obj) != 0;
+ int age = RVALUE_FLAGS_AGE(RBASIC(obj)->flags);
+
+ if (BUILTIN_TYPE(obj) == T_NONE) rb_bug("check_rvalue_consistency: %p is T_NONE", obj_info(obj));
+ if (BUILTIN_TYPE(obj) == T_ZOMBIE) rb_bug("check_rvalue_consistency: %p 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_full_marking(objspace) && long_lived_bit && age != RVALUE_OLD_AGE && !wb_unprotected_bit) {
+ rb_bug("check_rvalue_consistency: %s is long lived, but not old (age: %d) and not WB unprotected.\n", obj_info(obj), age);
+ }
+ if (!is_marking(objspace) && !is_sweeping(objspace) && long_lived_bit && RVALUE_MARK_BITMAP(obj) == 0) {
+ rb_bug("check_rvalue_consistency: %s is long lived, but is not marked while !gc.", obj_info(obj));
+ }
+
+ /*
+ * check coloring
+ *
+ * marking:false marking:true
+ * marked:false white *invalid*
+ * marked:true black grey
+ */
+ if (RVALUE_MARKING_BITMAP(obj)) {
+ if (!is_marking(objspace) && !RVALUE_MARK_BITMAP(obj)) rb_bug("check_rvalue_consistency: %s is marking, but not marked.", obj_info(obj));
+ }
+ }
+#endif
+ return obj;
+}
+
+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_LONG_LIVED(VALUE obj)
+{
+ check_rvalue_consistency(obj);
+ return RVALUE_LONG_LIVED_BITMAP(obj) != 0;
+}
+
+static inline int
+RVALUE_OLD_P_RAW(VALUE obj)
+{
+ const VALUE promoted = FL_PROMOTED0 | FL_PROMOTED1;
+ return (RBASIC(obj)->flags & promoted) == promoted;
+}
+
+static inline int
+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_PROMOTE_RAW(rb_objspace_t *objspace, VALUE obj)
+{
+ MARK_IN_BITMAP(GET_HEAP_LONG_LIVED_BITS(obj), obj);
+ objspace->rgengc.old_objects++;
+
+#if RGENGC_PROFILE >= 2
+ objspace->profile.total_promoted_count++;
+ objspace->profile.promoted_types[BUILTIN_TYPE(obj)]++;
+#endif
+}
+
+static inline VALUE
+RVALUE_FLAGS_AGE_SET(VALUE flags, int age)
+{
+ flags &= ~(FL_PROMOTED0 | FL_PROMOTED1);
+ flags |= (age << RVALUE_AGE_SHIFT);
+ return flags;
+}
+
+/* set age to age+1 */
+static inline void
+RVALUE_AGE_INC(rb_objspace_t *objspace, 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));
+ }
+
+ age++;
+ RBASIC(obj)->flags = RVALUE_FLAGS_AGE_SET(flags, age);
+
+ if (age == RVALUE_OLD_AGE) {
+ RVALUE_PROMOTE_RAW(objspace, obj);
+ }
+ 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_PROMOTE_RAW(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);
+}
+
+static inline void
+RVALUE_DEMOTE_RAW(rb_objspace_t *objspace, VALUE obj)
+{
+ RBASIC(obj)->flags = RVALUE_FLAGS_AGE_SET(RBASIC(obj)->flags, 0);
+ CLEAR_IN_BITMAP(GET_HEAP_LONG_LIVED_BITS(obj), obj);
+}
+
+static inline void
+RVALUE_DEMOTE(rb_objspace_t *objspace, VALUE obj)
+{
+ check_rvalue_consistency(obj);
+ if (RGENGC_CHECK_MODE) assert(RVALUE_OLD_P(obj));
+
+ RVALUE_DEMOTE_RAW(objspace, obj);
+
+ if (RVALUE_MARKED(obj)) {
+ objspace->rgengc.old_objects--;
+ }
+
+ check_rvalue_consistency(obj);
+}
+
+static inline void
+RVALUE_AGE_RESET(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, 0);
+
+ 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);
+}
+#endif
+
+static inline int
+RVALUE_WHITE_P(VALUE obj)
+{
+ return RVALUE_MARKED(obj) == FALSE;
+}
+
+#endif /* USE_RGENGC */
/*
--------------------------- ObjectSpace -----------------------------
@@ -373,10 +1177,8 @@ static inline void gc_prof_set_malloc_info(rb_objspace_t *);
rb_objspace_t *
rb_objspace_alloc(void)
{
- rb_objspace_t *objspace = malloc(sizeof(rb_objspace_t));
- memset(objspace, 0, sizeof(*objspace));
- malloc_limit = initial_malloc_limit;
- ruby_gc_stress = ruby_initial_gc_stress;
+ rb_objspace_t *objspace = calloc(1, sizeof(rb_objspace_t));
+ malloc_limit = gc_params.malloc_limit_min;
return objspace;
}
@@ -384,354 +1186,517 @@ rb_objspace_alloc(void)
#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)
{
- rest_sweep(objspace);
- if (objspace->profile.record) {
- free(objspace->profile.record);
- objspace->profile.record = 0;
+ 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 (objspace->heap.free_bitmap) {
- struct heaps_free_bitmap *list, *next;
- for (list = objspace->heap.free_bitmap; list; list = next) {
- next = list->next;
- free(list);
- }
- }
- if (objspace->heap.sorted) {
+ if (heap_pages_sorted) {
size_t i;
- for (i = 0; i < heaps_used; ++i) {
- free(objspace->heap.sorted[i]->bits);
- aligned_free(objspace->heap.sorted[i]);
+ for (i = 0; i < heap_allocated_pages; ++i) {
+ heap_page_free(objspace, heap_pages_sorted[i]);
}
- free(objspace->heap.sorted);
- heaps_used = 0;
- heaps = 0;
+ free(heap_pages_sorted);
+ heap_allocated_pages = 0;
+ heap_pages_sorted_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.pages = NULL;
}
free_stack_chunks(&objspace->mark_stack);
free(objspace);
}
#endif
-void
-rb_global_variable(VALUE *var)
-{
- rb_gc_register_address(var);
-}
-
static void
-allocate_sorted_heaps(rb_objspace_t *objspace, size_t next_heaps_length)
+heap_pages_expand_sorted(rb_objspace_t *objspace)
{
- struct heaps_header **p;
- struct heaps_free_bitmap *bits;
- size_t size, add, i;
+ size_t next_length = heap_allocatable_pages;
+ next_length += heap_eden->page_length;
+ next_length += heap_tomb->page_length;
- size = next_heaps_length*sizeof(struct heaps_header *);
- add = next_heaps_length - heaps_used;
+ if (next_length > heap_pages_sorted_length) {
+ struct heap_page **sorted;
+ size_t size = next_length * sizeof(struct heap_page *);
- if (heaps_used > 0) {
- p = (struct heaps_header **)realloc(objspace->heap.sorted, size);
- if (p) objspace->heap.sorted = p;
+ gc_report(3, objspace, "heap_pages_expand_sorted: next_length: %d, size: %d\n", (int)next_length, (int)size);
+
+ 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 (sorted == 0) {
+ rb_memerror();
+ }
+
+ heap_pages_sorted_length = next_length;
}
- else {
- p = objspace->heap.sorted = (struct heaps_header **)malloc(size);
+}
+
+static inline void
+heap_page_add_freeobj(rb_objspace_t *objspace, struct heap_page *page, VALUE obj)
+{
+ RVALUE *p = (RVALUE *)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);
}
- if (p == 0) {
- during_gc = 0;
- rb_memerror();
+ gc_report(3, objspace, "heap_page_add_freeobj: add %p to freelist\n", (void *)obj);
+}
+
+static inline void
+heap_add_freepage(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *page)
+{
+ if (page->freelist) {
+ page->free_next = heap->free_pages;
+ heap->free_pages = page;
}
+}
- for (i = 0; i < add; i++) {
- bits = (struct heaps_free_bitmap *)malloc(HEAP_BITMAP_LIMIT * sizeof(uintptr_t));
- if (bits == 0) {
- during_gc = 0;
- rb_memerror();
- return;
- }
- bits->next = objspace->heap.free_bitmap;
- objspace->heap.free_bitmap = bits;
+static inline void
+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;
}
}
static void
-link_free_heap_slot(rb_objspace_t *objspace, struct heaps_slot *slot)
+heap_unlink_page(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *page)
{
- slot->free_next = objspace->heap.free_slots;
- objspace->heap.free_slots = slot;
+ if (page->prev) page->prev->next = page->next;
+ if (page->next) page->next->prev = page->prev;
+ if (heap->pages == page) heap->pages = page->next;
+ page->prev = NULL;
+ page->next = NULL;
+ page->heap = NULL;
+ heap->page_length--;
+ heap->total_slots -= page->total_slots;
}
static void
-unlink_free_heap_slot(rb_objspace_t *objspace, struct heaps_slot *slot)
+heap_page_free(rb_objspace_t *objspace, struct heap_page *page)
{
- objspace->heap.free_slots = slot->free_next;
- slot->free_next = NULL;
+ heap_allocated_pages--;
+ objspace->profile.total_freed_pages++;
+ aligned_free(page->body);
+ free(page);
}
static void
-assign_heap_slot(rb_objspace_t *objspace)
+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 */
+ }
+ }
+ if (i != j) {
+ heap_pages_sorted[j] = page;
+ }
+ j++;
+ }
+ if (RGENGC_CHECK_MODE) assert(j == heap_allocated_pages);
+ }
+}
+
+static struct heap_page *
+heap_page_allocate(rb_objspace_t *objspace)
{
- RVALUE *p, *pend, *membase;
- struct heaps_slot *slot;
+ RVALUE *start, *end, *p;
+ struct heap_page *page;
+ struct heap_page_body *page_body = 0;
size_t hi, lo, mid;
- size_t objs;
+ int limit = HEAP_OBJ_LIMIT;
- objs = HEAP_OBJ_LIMIT;
- p = (RVALUE*)aligned_malloc(HEAP_ALIGN, HEAP_SIZE);
- if (p == 0) {
- during_gc = 0;
+ /* 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) {
rb_memerror();
}
- slot = (struct heaps_slot *)malloc(sizeof(struct heaps_slot));
- if (slot == 0) {
- aligned_free(p);
- during_gc = 0;
- rb_memerror();
- }
- MEMZERO((void*)slot, struct heaps_slot, 1);
- slot->next = heaps;
- if (heaps) heaps->prev = slot;
- heaps = slot;
-
- membase = p;
- p = (RVALUE*)((VALUE)p + sizeof(struct heaps_header));
- if ((VALUE)p % sizeof(RVALUE) != 0) {
- p = (RVALUE*)((VALUE)p + sizeof(RVALUE) - ((VALUE)p % sizeof(RVALUE)));
- objs = (HEAP_SIZE - (size_t)((VALUE)p - (VALUE)membase))/sizeof(RVALUE);
+ /* assign heap_page entry */
+ page = (struct heap_page *)calloc(1, sizeof(struct heap_page));
+ if (page == 0) {
+ aligned_free(page_body);
+ rb_memerror();
}
+ page->body = page_body;
+
+ /* setup heap_pages_sorted */
lo = 0;
- hi = heaps_used;
+ hi = heap_allocated_pages;
while (lo < hi) {
- register RVALUE *mid_membase;
+ struct heap_page *mid_page;
+
mid = (lo + hi) / 2;
- mid_membase = (RVALUE *)objspace->heap.sorted[mid];
- if (mid_membase < membase) {
+ mid_page = heap_pages_sorted[mid];
+ if (mid_page->body < page_body) {
lo = mid + 1;
}
- else if (mid_membase > membase) {
+ else if (mid_page->body > page_body) {
hi = mid;
}
else {
- rb_bug("same heap slot is allocated: %p at %"PRIuVALUE, (void *)membase, (VALUE)mid);
+ rb_bug("same heap page is allocated: %p at %"PRIuVALUE, (void *)page_body, (VALUE)mid);
}
}
- if (hi < heaps_used) {
- MEMMOVE(&objspace->heap.sorted[hi+1], &objspace->heap.sorted[hi], struct heaps_header*, heaps_used - hi);
+ if (hi < heap_allocated_pages) {
+ MEMMOVE(&heap_pages_sorted[hi+1], &heap_pages_sorted[hi], struct heap_page_header*, heap_allocated_pages - hi);
}
- heaps->header = (struct heaps_header *)membase;
- objspace->heap.sorted[hi] = heaps->header;
- objspace->heap.sorted[hi]->start = p;
- objspace->heap.sorted[hi]->end = (p + objs);
- objspace->heap.sorted[hi]->base = heaps;
- objspace->heap.sorted[hi]->limit = objs;
- assert(objspace->heap.free_bitmap != NULL);
- heaps->bits = (uintptr_t *)objspace->heap.free_bitmap;
- objspace->heap.sorted[hi]->bits = (uintptr_t *)objspace->heap.free_bitmap;
- objspace->heap.free_bitmap = objspace->heap.free_bitmap->next;
- memset(heaps->bits, 0, HEAP_BITMAP_LIMIT * sizeof(uintptr_t));
- pend = p + objs;
- if (lomem == 0 || lomem > p) lomem = p;
- if (himem < pend) himem = pend;
- heaps_used++;
- while (p < pend) {
- p->as.free.flags = 0;
- p->as.free.next = heaps->freelist;
- heaps->freelist = p;
- p++;
+ heap_pages_sorted[hi] = page;
+
+ heap_allocated_pages++;
+ objspace->profile.total_allocated_pages++;
+
+ if (RGENGC_CHECK_MODE) assert(heap_allocated_pages <= heap_pages_sorted_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);
+ }
+ end = start + limit;
+
+ if (heap_pages_lomem == 0 || heap_pages_lomem > start) heap_pages_lomem = start;
+ if (heap_pages_himem < end) heap_pages_himem = end;
+
+ page->start = start;
+ page->total_slots = 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);
+ heap_page_add_freeobj(objspace, page, (VALUE)p);
}
- link_free_heap_slot(objspace, heaps);
+ page->free_slots = limit;
+
+ return page;
}
-static void
-add_heap_slots(rb_objspace_t *objspace, size_t add)
+static struct heap_page *
+heap_page_resurrect(rb_objspace_t *objspace)
{
- size_t i;
- size_t next_heaps_length;
+ struct heap_page *page;
- next_heaps_length = heaps_used + add;
+ if ((page = heap_tomb->pages) != NULL) {
+ heap_unlink_page(objspace, heap_tomb, page);
+ return page;
+ }
+ return NULL;
+}
- if (next_heaps_length > heaps_length) {
- allocate_sorted_heaps(objspace, next_heaps_length);
- heaps_length = next_heaps_length;
+static struct heap_page *
+heap_page_create(rb_objspace_t *objspace)
+{
+ struct heap_page *page = heap_page_resurrect(objspace);
+ const char *method = "recycle";
+ if (page == NULL) {
+ 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);
+ return page;
+}
+static void
+heap_add_page(rb_objspace_t *objspace, rb_heap_t *heap, struct heap_page *page)
+{
+ page->heap = heap;
+ page->next = heap->pages;
+ if (heap->pages) heap->pages->prev = page;
+ heap->pages = page;
+ heap->page_length++;
+ heap->total_slots += page->total_slots;
+}
+
+static void
+heap_assign_page(rb_objspace_t *objspace, rb_heap_t *heap)
+{
+ struct heap_page *page = heap_page_create(objspace);
+ heap_add_page(objspace, heap, page);
+ heap_add_freepage(objspace, heap, page);
+}
+
+static void
+heap_add_pages(rb_objspace_t *objspace, rb_heap_t *heap, size_t add)
+{
+ size_t i;
+
+ heap_allocatable_pages = add;
+ heap_pages_expand_sorted(objspace);
for (i = 0; i < add; i++) {
- assign_heap_slot(objspace);
+ heap_assign_page(objspace, heap);
}
- heaps_inc = 0;
+ heap_allocatable_pages = 0;
}
-static void
-init_heap(rb_objspace_t *objspace)
+static size_t
+heap_extend_pages(rb_objspace_t *objspace)
{
- add_heap_slots(objspace, HEAP_MIN_SLOTS / HEAP_OBJ_LIMIT);
- init_mark_stack(&objspace->mark_stack);
+ size_t used = heap_allocated_pages - heap_tomb->page_length;
+ size_t next_used_limit = (size_t)(used * gc_params.growth_factor);
-#ifdef USE_SIGALTSTACK
- {
- /* altstack of another threads are allocated in another place */
- rb_thread_t *th = GET_THREAD();
- void *tmp = th->altstack;
- th->altstack = malloc(rb_sigaltstack_size());
- free(tmp); /* free previously allocated area */
+ if (gc_params.growth_max_slots > 0) {
+ size_t max_used_limit = (size_t)(used + gc_params.growth_max_slots/HEAP_OBJ_LIMIT);
+ if (next_used_limit > max_used_limit) next_used_limit = max_used_limit;
}
-#endif
- objspace->profile.invoke_time = getrusage_time();
- finalizer_table = st_init_numtable();
+ return next_used_limit - used;
}
static void
-initial_expand_heap(rb_objspace_t *objspace)
+heap_set_increment(rb_objspace_t *objspace, size_t additional_pages)
{
- size_t min_size = initial_heap_min_slots / HEAP_OBJ_LIMIT;
+ size_t used = heap_eden->page_length;
+ size_t next_used_limit = used + additional_pages;
- if (min_size > heaps_used) {
- add_heap_slots(objspace, min_size - heaps_used);
+ if (next_used_limit == heap_allocated_pages) next_used_limit++;
+
+ heap_allocatable_pages = 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);
+}
+
+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--;
+ heap_assign_page(objspace, heap);
+ return TRUE;
}
+ return FALSE;
}
static void
-set_heaps_increment(rb_objspace_t *objspace)
+heap_prepare(rb_objspace_t *objspace, rb_heap_t *heap)
{
- size_t next_heaps_length = (size_t)(heaps_used * 1.8);
+ if (RGENGC_CHECK_MODE) assert(heap->free_pages == NULL);
- if (next_heaps_length == heaps_used) {
- next_heaps_length++;
+ if (is_lazy_sweeping(heap)) {
+ gc_sweep_continue(objspace, heap);
+ }
+ else if (is_incremental_marking(objspace)) {
+ gc_marks_continue(objspace, heap);
}
- heaps_inc = next_heaps_length - heaps_used;
+ 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) {
+ rb_memerror();
+ }
+}
- if (next_heaps_length > heaps_length) {
- allocate_sorted_heaps(objspace, next_heaps_length);
- heaps_length = next_heaps_length;
+static RVALUE *
+heap_get_freeobj_from_next_freepage(rb_objspace_t *objspace, rb_heap_t *heap)
+{
+ struct heap_page *page;
+ RVALUE *p;
+
+ while (UNLIKELY(heap->free_pages == NULL)) {
+ heap_prepare(objspace, heap);
}
+ page = heap->free_pages;
+ 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 int
-heaps_increment(rb_objspace_t *objspace)
+static inline VALUE
+heap_get_freeobj(rb_objspace_t *objspace, rb_heap_t *heap)
{
- if (heaps_inc > 0) {
- assign_heap_slot(objspace);
- heaps_inc--;
- return TRUE;
+ 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);
+ }
}
- return FALSE;
}
+void
+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;
+}
+
+static void
+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(objspace, event, data) do { \
+ if (UNLIKELY((objspace)->hook_events & (event))) { \
+ gc_event_hook_body((objspace), (event), (data)); \
+ } \
+} while (0)
+
static VALUE
-newobj(VALUE klass, VALUE flags)
+newobj_of(VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3)
{
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)) {
+ if (UNLIKELY(during_gc || ruby_gc_stressful)) {
+ if (during_gc) {
+ dont_gc = 1;
during_gc = 0;
- rb_memerror();
+ rb_bug("object allocation during garbage collection phase");
}
- }
- if (UNLIKELY(!has_free_object)) {
- if (!gc_prepare_free_objects(objspace)) {
- during_gc = 0;
- rb_memerror();
+ if (ruby_gc_stressful) {
+ if (!garbage_collect(objspace, FALSE, FALSE, FALSE, GPR_FLAG_NEWOBJ)) {
+ rb_memerror();
+ }
}
}
- obj = (VALUE)objspace->heap.free_slots->freelist;
- objspace->heap.free_slots->freelist = RANY(obj)->as.free.next;
- if (objspace->heap.free_slots->freelist == NULL) {
- unlink_free_heap_slot(objspace, objspace->heap.free_slots);
+ obj = heap_get_freeobj(objspace, heap_eden);
+
+ if (RGENGC_CHECK_MODE > 0) assert(BUILTIN_TYPE(obj) == T_NONE);
+
+ /* OBJSETUP */
+ RBASIC(obj)->flags = flags & ~FL_WB_PROTECTED;
+ RBASIC_SET_CLASS_RAW(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 (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 ((flags & FL_WB_PROTECTED) == 0) {
+ MARK_IN_BITMAP(GET_HEAP_WB_UNPROTECTED_BITS(obj), obj);
}
+#endif
- MEMZERO((void*)obj, RVALUE, 1);
-#ifdef GC_DEBUG
+#if RGENGC_PROFILE
+ if (flags & FL_WB_PROTECTED) {
+ objspace->profile.total_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++;
+#if RGENGC_PROFILE >= 2
+ objspace->profile.generated_shady_object_count_types[BUILTIN_TYPE(obj)]++;
+#endif
+ }
+#endif
+
+#if GC_DEBUG
RANY(obj)->file = rb_sourcefile();
RANY(obj)->line = rb_sourceline();
+ assert(!SPECIAL_CONST_P(obj)); /* check alignment */
#endif
- objspace->total_allocated_object_num++;
+ objspace->total_allocated_objects++;
+ gc_event_hook(objspace, RUBY_INTERNAL_EVENT_NEWOBJ, obj);
+ gc_report(5, objspace, "newobj: %s\n", obj_info(obj));
return obj;
}
VALUE
rb_newobj(void)
{
- return newobj(0, T_NONE);
+ return newobj_of(0, T_NONE, 0, 0, 0);
}
VALUE
rb_newobj_of(VALUE klass, VALUE flags)
{
- VALUE obj;
-
- obj = newobj(klass, flags);
- OBJSETUP(obj, klass, flags);
-
- return obj;
+ 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*)rb_newobj();
-
- n->flags |= T_NODE;
+ VALUE flags = (RGENGC_WB_PROTECTED_NODE_CREF && type == NODE_CREF ? FL_WB_PROTECTED : 0);
+ NODE *n = (NODE *)newobj_of(0, T_NODE | flags, a0, a1, a2);
nd_set_type(n, type);
-
- n->u1.value = a0;
- n->u2.value = a1;
- n->u3.value = a2;
-
return n;
}
VALUE
rb_data_object_alloc(VALUE klass, void *datap, RUBY_DATA_FUNC dmark, RUBY_DATA_FUNC dfree)
{
- NEWOBJ(data, struct RData);
if (klass) Check_Type(klass, T_CLASS);
- OBJSETUP(data, klass, T_DATA);
- data->data = datap;
- data->dfree = dfree;
- data->dmark = dmark;
-
- return (VALUE)data;
+ return newobj_of(klass, T_DATA, (VALUE)dmark, (VALUE)dfree, (VALUE)datap);
}
VALUE
rb_data_typed_object_alloc(VALUE klass, void *datap, const rb_data_type_t *type)
{
- NEWOBJ(data, struct RTypedData);
-
if (klass) Check_Type(klass, T_CLASS);
-
- OBJSETUP(data, klass, T_DATA);
-
- data->data = datap;
- data->typed_flag = 1;
- data->type = type;
-
- return (VALUE)data;
+ return newobj_of(klass, T_DATA | (type->flags & ~T_MASK), (VALUE)type, (VALUE)1, (VALUE)datap);
}
size_t
@@ -756,28 +1721,26 @@ rb_objspace_data_type_name(VALUE obj)
}
}
-static void gc_mark(rb_objspace_t *objspace, VALUE ptr);
-static void gc_mark_children(rb_objspace_t *objspace, VALUE ptr);
-
static inline int
is_pointer_to_heap(rb_objspace_t *objspace, void *ptr)
{
register RVALUE *p = RANY(ptr);
- register struct heaps_header *heap;
+ register struct heap_page *page;
register size_t hi, lo, mid;
- if (p < lomem || p > himem) return FALSE;
+ if (p < heap_pages_lomem || p > heap_pages_himem) return FALSE;
if ((VALUE)p % sizeof(RVALUE) != 0) return FALSE;
/* check if p looks like a pointer using bsearch*/
lo = 0;
- hi = heaps_used;
+ hi = heap_allocated_pages;
while (lo < hi) {
mid = (lo + hi) / 2;
- heap = objspace->heap.sorted[mid];
- if (heap->start <= p) {
- if (p < heap->end)
+ page = heap_pages_sorted[mid];
+ if (page->start <= p) {
+ if (p < page->start + page->total_slots) {
return TRUE;
+ }
lo = mid + 1;
}
else {
@@ -788,24 +1751,35 @@ is_pointer_to_heap(rb_objspace_t *objspace, void *ptr)
}
static int
-free_method_entry_i(ID key, rb_method_entry_t *me, st_data_t data)
+free_method_entry_i(st_data_t key, st_data_t value, st_data_t data)
{
+ rb_method_entry_t *me = (rb_method_entry_t *)value;
if (!me->mark) {
rb_free_method_entry(me);
}
return ST_CONTINUE;
}
-void
-rb_free_m_table(st_table *tbl)
+static void
+rb_free_m_tbl(st_table *tbl)
{
st_foreach(tbl, free_method_entry_i, 0);
st_free_table(tbl);
}
+void
+rb_free_m_tbl_wrapper(struct method_table_wrapper *wrapper)
+{
+ if (wrapper->tbl) {
+ rb_free_m_tbl(wrapper->tbl);
+ }
+ xfree(wrapper);
+}
+
static int
-free_const_entry_i(ID key, rb_const_entry_t *ce, st_data_t data)
+free_const_entry_i(st_data_t key, st_data_t value, st_data_t data)
{
+ rb_const_entry_t *ce = (rb_const_entry_t *)value;
xfree(ce);
return ST_CONTINUE;
}
@@ -817,92 +1791,29 @@ rb_free_const_table(st_table *tbl)
st_free_table(tbl);
}
-static int obj_free(rb_objspace_t *, VALUE);
-
-static inline struct heaps_slot *
-add_slot_local_freelist(rb_objspace_t *objspace, RVALUE *p)
-{
- struct heaps_slot *slot;
-
- (void)VALGRIND_MAKE_MEM_UNDEFINED((void*)p, sizeof(RVALUE));
- p->as.free.flags = 0;
- slot = GET_HEAP_SLOT(p);
- p->as.free.next = slot->freelist;
- slot->freelist = p;
-
- return slot;
-}
-
-static void
-unlink_heap_slot(rb_objspace_t *objspace, struct heaps_slot *slot)
-{
- if (slot->prev)
- slot->prev->next = slot->next;
- if (slot->next)
- slot->next->prev = slot->prev;
- if (heaps == slot)
- heaps = slot->next;
- if (objspace->heap.sweep_slots == slot)
- objspace->heap.sweep_slots = slot->next;
- slot->prev = NULL;
- slot->next = NULL;
-}
-
-static void
-free_unused_heaps(rb_objspace_t *objspace)
-{
- size_t i, j;
- struct heaps_header *last = 0;
-
- for (i = j = 1; j < heaps_used; i++) {
- if (objspace->heap.sorted[i]->limit == 0) {
- struct heaps_header* h = objspace->heap.sorted[i];
- ((struct heaps_free_bitmap *)(h->bits))->next =
- objspace->heap.free_bitmap;
- objspace->heap.free_bitmap = (struct heaps_free_bitmap *)h->bits;
- if (!last) {
- last = objspace->heap.sorted[i];
- }
- else {
- aligned_free(objspace->heap.sorted[i]);
- }
- heaps_used--;
- }
- else {
- if (i != j) {
- objspace->heap.sorted[j] = objspace->heap.sorted[i];
- }
- j++;
- }
- }
- if (last) {
- if (last < heaps_freed) {
- aligned_free(heaps_freed);
- heaps_freed = last;
- }
- else {
- aligned_free(last);
- }
- }
-}
static inline void
-make_deferred(RVALUE *p)
+make_zombie(rb_objspace_t *objspace, VALUE obj, void (*dfree)(void *), void *data)
{
- p->as.basic.flags = (p->as.basic.flags & ~T_MASK) | T_ZOMBIE;
+ 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;
}
static inline void
-make_io_deferred(RVALUE *p)
+make_io_zombie(rb_objspace_t *objspace, VALUE obj)
{
- rb_io_t *fptr = p->as.file.fptr;
- make_deferred(p);
- p->as.data.dfree = (void (*)(void*))rb_io_fptr_finalize;
- p->as.data.data = fptr;
+ rb_io_t *fptr = RANY(obj)->as.file.fptr;
+ make_zombie(objspace, obj, (void (*)(void*))rb_io_fptr_finalize, fptr);
}
static int
obj_free(rb_objspace_t *objspace, VALUE obj)
{
+ gc_event_hook(objspace, RUBY_INTERNAL_EVENT_FREEOBJ, obj);
+
switch (BUILTIN_TYPE(obj)) {
case T_NIL:
case T_FIXNUM:
@@ -917,6 +1828,19 @@ obj_free(rb_objspace_t *objspace, VALUE obj)
FL_UNSET(obj, FL_EXIVAR);
}
+#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_LONG_LIVED);
+#undef CHECK
+#endif
+#endif
+
switch (BUILTIN_TYPE(obj)) {
case T_OBJECT:
if (!(RANY(obj)->as.basic.flags & ROBJECT_EMBED) &&
@@ -926,9 +1850,8 @@ obj_free(rb_objspace_t *objspace, VALUE obj)
break;
case T_MODULE:
case T_CLASS:
- rb_clear_cache_by_class((VALUE)obj);
- if (RCLASS_M_TBL(obj)) {
- rb_free_m_table(RCLASS_M_TBL(obj));
+ if (RCLASS_M_TBL_WRAPPER(obj)) {
+ rb_free_m_tbl_wrapper(RCLASS_M_TBL_WRAPPER(obj));
}
if (RCLASS_IV_TBL(obj)) {
st_free_table(RCLASS_IV_TBL(obj));
@@ -939,7 +1862,20 @@ obj_free(rb_objspace_t *objspace, VALUE obj)
if (RCLASS_IV_INDEX_TBL(obj)) {
st_free_table(RCLASS_IV_INDEX_TBL(obj));
}
- xfree(RANY(obj)->as.klass.ptr);
+ if (RCLASS_EXT(obj)->subclasses) {
+ if (BUILTIN_TYPE(obj) == T_MODULE) {
+ rb_class_detach_module_subclasses(obj);
+ }
+ else {
+ rb_class_detach_subclasses(obj);
+ }
+ RCLASS_EXT(obj)->subclasses = NULL;
+ }
+ rb_class_remove_from_module_subclasses(obj);
+ rb_class_remove_from_super_subclasses(obj);
+ if (RANY(obj)->as.klass.ptr)
+ xfree(RANY(obj)->as.klass.ptr);
+ RANY(obj)->as.klass.ptr = NULL;
break;
case T_STRING:
rb_str_free(obj);
@@ -959,15 +1895,33 @@ obj_free(rb_objspace_t *objspace, VALUE obj)
break;
case T_DATA:
if (DATA_PTR(obj)) {
+ int free_immediately = FALSE;
+ void (*dfree)(void *);
+ void *data = DATA_PTR(obj);
+
if (RTYPEDDATA_P(obj)) {
- RDATA(obj)->dfree = RANY(obj)->as.typeddata.type->function.dfree;
+ 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 */
+ fprintf(stderr, "not immediate -> %s\n", RANY(obj)->as.typeddata.type->wrap_struct_name);
+ }
}
- if (RANY(obj)->as.data.dfree == (RUBY_DATA_FUNC)-1) {
- xfree(DATA_PTR(obj));
+ else {
+ dfree = RANY(obj)->as.data.dfree;
}
- else if (RANY(obj)->as.data.dfree) {
- make_deferred(RANY(obj));
- return 1;
+
+ if (dfree) {
+ if (dfree == RUBY_DEFAULT_FREE) {
+ xfree(data);
+ }
+ else if (free_immediately) {
+ (*dfree)(data);
+ }
+ else {
+ make_zombie(objspace, obj, dfree, data);
+ return 1;
+ }
}
}
break;
@@ -982,7 +1936,7 @@ obj_free(rb_objspace_t *objspace, VALUE obj)
break;
case T_FILE:
if (RANY(obj)->as.file.fptr) {
- make_io_deferred(RANY(obj));
+ make_io_zombie(objspace, obj);
return 1;
}
break;
@@ -991,39 +1945,39 @@ obj_free(rb_objspace_t *objspace, VALUE obj)
break;
case T_ICLASS:
/* iClass shares table with the module */
+ if (RCLASS_EXT(obj)->subclasses) {
+ rb_class_detach_subclasses(obj);
+ RCLASS_EXT(obj)->subclasses = NULL;
+ }
+ rb_class_remove_from_module_subclasses(obj);
+ rb_class_remove_from_super_subclasses(obj);
xfree(RANY(obj)->as.klass.ptr);
+ RANY(obj)->as.klass.ptr = NULL;
break;
case T_FLOAT:
break;
case T_BIGNUM:
- if (!(RBASIC(obj)->flags & RBIGNUM_EMBED_FLAG) && RBIGNUM_DIGITS(obj)) {
- xfree(RBIGNUM_DIGITS(obj));
+ if (!(RBASIC(obj)->flags & BIGNUM_EMBED_FLAG) && BIGNUM_DIGITS(obj)) {
+ xfree(BIGNUM_DIGITS(obj));
}
break;
+
case T_NODE:
- 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;
- }
+ rb_gc_free_node(obj);
break; /* no need to free iv_tbl */
case T_STRUCT:
if ((RBASIC(obj)->flags & RSTRUCT_EMBED_LEN_MASK) == 0 &&
RANY(obj)->as.rstruct.as.heap.ptr) {
- xfree(RANY(obj)->as.rstruct.as.heap.ptr);
+ xfree((void *)RANY(obj)->as.rstruct.as.heap.ptr);
+ }
+ break;
+
+ case T_SYMBOL:
+ {
+ rb_gc_free_dsymbol(obj);
}
break;
@@ -1032,13 +1986,41 @@ obj_free(rb_objspace_t *objspace, VALUE obj)
BUILTIN_TYPE(obj), (void*)obj, RBASIC(obj)->flags);
}
- return 0;
+ if (FL_TEST(obj, FL_FINALIZE)) {
+ make_zombie(objspace, obj, 0, 0);
+ return 1;
+ }
+ else {
+ return 0;
+ }
}
void
Init_heap(void)
{
- init_heap(&rb_objspace);
+ 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_init_slots / HEAP_OBJ_LIMIT);
+ init_mark_stack(&objspace->mark_stack);
+
+#ifdef USE_SIGALTSTACK
+ {
+ /* altstack of another threads are allocated in another place */
+ rb_thread_t *th = GET_THREAD();
+ void *tmp = th->altstack;
+ th->altstack = malloc(rb_sigaltstack_size());
+ free(tmp); /* free previously allocated area */
+ }
+#endif
+
+ objspace->profile.invoke_time = getrusage_time();
+ finalizer_table = st_init_numtable();
}
typedef int each_obj_callback(void *, void *, size_t, void *);
@@ -1052,52 +2034,51 @@ static VALUE
objspace_each_objects(VALUE arg)
{
size_t i;
- RVALUE *membase = 0;
+ struct heap_page_body *last_body = 0;
+ struct heap_page *page;
RVALUE *pstart, *pend;
rb_objspace_t *objspace = &rb_objspace;
struct each_obj_args *args = (struct each_obj_args *)arg;
- volatile VALUE v;
i = 0;
- while (i < heaps_used) {
- while (0 < i && (uintptr_t)membase < (uintptr_t)objspace->heap.sorted[i-1])
- i--;
- while (i < heaps_used && (uintptr_t)objspace->heap.sorted[i] <= (uintptr_t)membase)
- i++;
- if (heaps_used <= i)
- break;
- membase = (RVALUE *)objspace->heap.sorted[i];
+ while (i < heap_allocated_pages) {
+ 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;
- pstart = objspace->heap.sorted[i]->start;
- pend = pstart + objspace->heap.sorted[i]->limit;
+ page = heap_pages_sorted[i];
+ last_body = page->body;
- for (; pstart != pend; pstart++) {
- if (pstart->as.basic.flags) {
- v = (VALUE)pstart; /* acquire to save this object */
- break;
- }
- }
- if (pstart != pend) {
- if ((*args->callback)(pstart, pend, sizeof(RVALUE), args->data)) {
- break;
- }
+ pstart = page->start;
+ pend = pstart + page->total_slots;
+
+ if ((*args->callback)(pstart, pend, sizeof(RVALUE), args->data)) {
+ break;
}
}
- RB_GC_GUARD(v);
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.
* To be frank, you should not use it. Or you need to read the
* source code of this function and understand what this function does.
*
- * 'callback' will be called several times (the number of heap slot,
+ * 'callback' will be called several times (the number of heap page,
* at current implementation) with:
- * vstart: a pointer to the first living object of the heap_slot.
- * vend: a pointer to next to the valid heap_slot area.
+ * vstart: a pointer to the first living object of the heap_page.
+ * vend: a pointer to next to the valid heap_page area.
* stride: a distance to next VALUE.
*
* If callback() returns non-zero, the iteration will be stopped.
@@ -1114,10 +2095,10 @@ objspace_each_objects(VALUE arg)
* return 0; // continue to iteration
* }
*
- * Note: 'vstart' is not a top of heap_slot. This point the first
+ * Note: 'vstart' is not a top of heap_page. This point the first
* living object to grasp at least one object to avoid GC issue.
- * This means that you can not walk through all Ruby object slot
- * including freed object slot.
+ * This means that you can not walk through all Ruby object page
+ * including freed object page.
*
* Note: On this implementation, 'stride' is same as sizeof(RVALUE).
* However, there are possibilities to pass variable values with
@@ -1129,13 +2110,30 @@ 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;
- rest_sweep(objspace);
- objspace->flags.dont_lazy_sweep = TRUE;
+ gc_rest(objspace);
+ objspace->flags.dont_incremental = TRUE;
args.callback = callback;
args.data = data;
- rb_ensure(objspace_each_objects, (VALUE)&args, lazy_sweep_enable, Qnil);
+
+ 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);
}
struct os_each_struct {
@@ -1243,7 +2241,6 @@ os_each_obj(int argc, VALUE *argv, VALUE os)
{
VALUE of;
- rb_secure(4);
if (argc == 0) {
of = 0;
}
@@ -1265,11 +2262,11 @@ os_each_obj(int argc, VALUE *argv, VALUE os)
static VALUE
undefine_final(VALUE os, VALUE obj)
{
- return rb_undefine_final(obj);
+ return rb_undefine_finalizer(obj);
}
VALUE
-rb_undefine_final(VALUE obj)
+rb_undefine_finalizer(VALUE obj)
{
rb_objspace_t *objspace = &rb_objspace;
st_data_t data = obj;
@@ -1279,6 +2276,24 @@ rb_undefine_final(VALUE obj)
return obj;
}
+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));
+ }
+}
+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())
@@ -1294,13 +2309,12 @@ define_final(int argc, VALUE *argv, VALUE os)
VALUE obj, block;
rb_scan_args(argc, argv, "11", &obj, &block);
- rb_check_frozen(obj);
+ should_be_finalizable(obj);
if (argc == 1) {
block = rb_block_proc();
}
- else if (!rb_respond_to(block, rb_intern("call"))) {
- rb_raise(rb_eArgError, "wrong type argument %s (should be callable)",
- rb_obj_classname(block));
+ else {
+ should_be_callable(block);
}
return define_final0(obj, block);
@@ -1313,10 +2327,6 @@ 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);
@@ -1328,20 +2338,17 @@ define_final0(VALUE obj, VALUE block)
}
else {
table = rb_ary_new3(1, block);
- RBASIC(table)->klass = 0;
+ RBASIC_CLEAR_CLASS(table);
st_add_direct(finalizer_table, obj, table);
}
return block;
}
VALUE
-rb_define_final(VALUE obj, VALUE block)
+rb_define_finalizer(VALUE obj, VALUE block)
{
- rb_check_frozen(obj);
- if (!rb_respond_to(block, rb_intern("call"))) {
- rb_raise(rb_eArgError, "wrong type argument %s (should be callable)",
- rb_obj_classname(block));
- }
+ should_be_finalizable(obj);
+ should_be_callable(block);
return define_final0(obj, block);
}
@@ -1385,9 +2392,9 @@ run_finalizer(rb_objspace_t *objspace, VALUE obj, VALUE table)
args[2] = (VALUE)rb_safe_level();
for (i=0; i<RARRAY_LEN(table); i++) {
- VALUE final = RARRAY_PTR(table)[i];
- args[0] = RARRAY_PTR(final)[1];
- args[2] = FIX2INT(RARRAY_PTR(final)[0]);
+ 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);
if (status)
@@ -1396,63 +2403,54 @@ run_finalizer(rb_objspace_t *objspace, VALUE obj, VALUE table)
}
static void
-run_final(rb_objspace_t *objspace, VALUE obj)
+run_final(rb_objspace_t *objspace, VALUE zombie)
{
- RUBY_DATA_FUNC free_func = 0;
st_data_t key, table;
- objspace->heap.final_num--;
-
- RBASIC(obj)->klass = 0;
-
- 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));
+ if (RZOMBIE(zombie)->dfree) {
+ RZOMBIE(zombie)->dfree(RZOMBIE(zombie)->data);
}
- key = (st_data_t)obj;
+ key = (st_data_t)zombie;
if (st_delete(finalizer_table, &key, &table)) {
- run_finalizer(objspace, obj, (VALUE)table);
+ run_finalizer(objspace, zombie, (VALUE)table);
}
}
static void
-finalize_list(rb_objspace_t *objspace, RVALUE *p)
+finalize_list(rb_objspace_t *objspace, VALUE zombie)
{
- while (p) {
- RVALUE *tmp = p->as.free.next;
- run_final(objspace, (VALUE)p);
- objspace->total_freed_object_num++;
- if (!FL_TEST(p, FL_SINGLETON)) { /* not freeing page */
- add_slot_local_freelist(objspace, p);
- objspace->heap.free_num++;
- }
- else {
- struct heaps_slot *slot = (struct heaps_slot *)(VALUE)RDATA(p)->dmark;
- slot->header->limit--;
- }
- p = tmp;
+ while (zombie) {
+ VALUE next_zombie = RZOMBIE(zombie)->next;
+ struct heap_page *page = GET_HEAP_PAGE(zombie);
+
+ run_final(objspace, zombie);
+
+ 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);
+
+ heap_pages_swept_slots++;
+ objspace->profile.total_freed_objects++;
+
+ zombie = next_zombie;
}
}
static void
finalize_deferred(rb_objspace_t *objspace)
{
- RVALUE *p = deferred_final_list;
- deferred_final_list = 0;
+ VALUE zombie;
- if (p) {
- finalize_list(objspace, p);
+ while ((zombie = (VALUE)ATOMIC_PTR_EXCHANGE(heap_pages_deferred_final, 0)) != 0) {
+ finalize_list(objspace, zombie);
}
}
-void
-rb_gc_finalize_deferred(void)
+static void
+gc_finalize_deferred(void *dmy)
{
rb_objspace_t *objspace = &rb_objspace;
if (ATOMIC_EXCHANGE(finalizing, 1)) return;
@@ -1460,6 +2458,21 @@ rb_gc_finalize_deferred(void)
ATOMIC_SET(finalizing, 0);
}
+/* TODO: to keep compatibility, maybe unused. */
+void
+rb_gc_finalize_deferred(void)
+{
+ gc_finalize_deferred(0);
+}
+
+static void
+gc_finalize_deferred_register(void)
+{
+ if (rb_postponed_job_register_one(0, gc_finalize_deferred, 0) == 0) {
+ rb_bug("gc_finalize_deferred_register: can't register finalizer.");
+ }
+}
+
struct force_finalize_list {
VALUE obj;
VALUE table;
@@ -1481,6 +2494,9 @@ 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);
}
@@ -1488,16 +2504,15 @@ static void
rb_objspace_call_finalizer(rb_objspace_t *objspace)
{
RVALUE *p, *pend;
- RVALUE *final_list = 0;
size_t i;
- rest_sweep(objspace);
+ gc_rest(objspace);
if (ATOMIC_EXCHANGE(finalizing, 1)) return;
/* run finalizers */
finalize_deferred(objspace);
- assert(deferred_final_list == 0);
+ assert(heap_pages_deferred_final == 0);
/* force to run finalizer */
while (finalizer_table->num_entries) {
@@ -1514,16 +2529,18 @@ rb_objspace_call_finalizer(rb_objspace_t *objspace)
}
/* finalizers are part of garbage collection */
- during_gc++;
+ gc_enter(objspace, "rb_objspace_call_finalizer");
/* run data object's finalizers */
- for (i = 0; i < heaps_used; i++) {
- p = objspace->heap.sorted[i]->start; pend = p + objspace->heap.sorted[i]->limit;
+ for (i = 0; i < heap_allocated_pages; i++) {
+ p = heap_pages_sorted[i]->start; pend = p + heap_pages_sorted[i]->total_slots;
while (p < pend) {
- if (BUILTIN_TYPE(p) == T_DATA &&
- DATA_PTR(p) && RANY(p)->as.data.dfree &&
- !rb_obj_is_thread((VALUE)p) && !rb_obj_is_mutex((VALUE)p) &&
- !rb_obj_is_fiber((VALUE)p)) {
+ switch (BUILTIN_TYPE(p)) {
+ case T_DATA:
+ if (!DATA_PTR(p) || !RANY(p)->as.data.dfree) break;
+ if (rb_obj_is_thread((VALUE)p)) break;
+ if (rb_obj_is_mutex((VALUE)p)) break;
+ if (rb_obj_is_fiber((VALUE)p)) break;
p->as.free.flags = 0;
if (RTYPEDDATA_P(p)) {
RDATA(p)->dfree = RANY(p)->as.typeddata.type->function.dfree;
@@ -1532,24 +2549,23 @@ rb_objspace_call_finalizer(rb_objspace_t *objspace)
xfree(DATA_PTR(p));
}
else if (RANY(p)->as.data.dfree) {
- make_deferred(RANY(p));
- RANY(p)->as.free.next = final_list;
- final_list = p;
+ make_zombie(objspace, (VALUE)p, RANY(p)->as.data.dfree, RANY(p)->as.data.data);
}
- }
- else if (BUILTIN_TYPE(p) == T_FILE) {
+ break;
+ case T_FILE:
if (RANY(p)->as.file.fptr) {
- make_io_deferred(RANY(p));
- RANY(p)->as.free.next = final_list;
- final_list = p;
+ make_io_zombie(objspace, (VALUE)p);
}
+ break;
}
p++;
}
}
- during_gc = 0;
- if (final_list) {
- finalize_list(objspace, final_list);
+
+ gc_exit(objspace, "rb_objspace_call_finalizer");
+
+ if (heap_pages_deferred_final) {
+ finalize_list(objspace, heap_pages_deferred_final);
}
st_free_table(finalizer_table);
@@ -1567,37 +2583,77 @@ is_id_value(rb_objspace_t *objspace, VALUE ptr)
}
static inline int
-is_swept_object(rb_objspace_t *objspace, VALUE ptr)
+heap_is_swept_object(rb_objspace_t *objspace, rb_heap_t *heap, VALUE ptr)
{
- struct heaps_slot *slot = objspace->heap.sweep_slots;
+ struct heap_page *page = GET_HEAP_PAGE(ptr);
+ return page->flags.before_sweep ? FALSE : TRUE;
+}
- while (slot) {
- if ((VALUE)slot->header->start <= ptr && ptr < (VALUE)(slot->header->end))
- return FALSE;
- slot = slot->next;
+static inline int
+is_swept_object(rb_objspace_t *objspace, VALUE ptr)
+{
+ if (heap_is_swept_object(objspace, heap_eden, ptr)) {
+ return TRUE;
+ }
+ else {
+ return FALSE;
}
- return TRUE;
}
+/* garbage objects will be collected soon. */
static inline int
-is_dead_object(rb_objspace_t *objspace, VALUE ptr)
+is_garbage_object(rb_objspace_t *objspace, VALUE ptr)
{
- if (!is_lazy_sweeping(objspace) || MARKED_IN_BITMAP(GET_HEAP_BITMAP(ptr), ptr))
+ if (!is_lazy_sweeping(heap_eden) ||
+ is_swept_object(objspace, ptr) ||
+ MARKED_IN_BITMAP(GET_HEAP_MARK_BITS(ptr), ptr)) {
+
return FALSE;
- if (!is_swept_object(objspace, ptr))
+ }
+ else {
return TRUE;
- return FALSE;
+ }
}
static inline int
is_live_object(rb_objspace_t *objspace, VALUE ptr)
{
- if (BUILTIN_TYPE(ptr) == 0) return FALSE;
- if (RBASIC(ptr)->klass == 0) return FALSE;
- if (is_dead_object(objspace, ptr)) return FALSE;
+ switch (BUILTIN_TYPE(ptr)) {
+ case T_NONE:
+ case T_ZOMBIE:
+ return FALSE;
+ }
+
+ if (!is_garbage_object(objspace, ptr)) {
+ return TRUE;
+ }
+ else {
+ return FALSE;
+ }
+}
+
+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;
}
+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);
+}
+
+int
+rb_objspace_garbage_object_p(VALUE obj)
+{
+ rb_objspace_t *objspace = &rb_objspace;
+ return is_garbage_object(objspace, obj);
+}
+
/*
* call-seq:
* ObjectSpace._id2ref(object_id) -> an_object
@@ -1623,7 +2679,6 @@ id2ref(VALUE obj, VALUE objid)
VALUE ptr;
void *p0;
- rb_secure(4);
ptr = NUM2PTR(objid);
p0 = (void *)ptr;
@@ -1660,28 +2715,18 @@ id2ref(VALUE obj, VALUE objid)
*
* Returns an integer identifier for +obj+.
*
- * The same number will be returned on all calls to +id+ for a given object,
+ * 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.
*
- * 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 litterals.
+ * Immediate values are not passed by reference but are passed by value:
+ * +nil+, +true+, +false+, Fixnums, Symbols. Some Floats may be immediates too.
*
- * Replaces the deprecated Object#id.
- */
-
-/*
- * 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>.
- *
- * The hash value is used by Hash class.
- *
- * Any hash value that exceeds the capacity of a Fixnum will be truncated
- * before being used.
+ * 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
*/
VALUE
@@ -1715,7 +2760,7 @@ rb_obj_id(VALUE obj)
* 24 if 32-bit, double is 8-byte aligned
* 40 if 64-bit
*/
- if (SYMBOL_P(obj)) {
+ if (STATIC_SYM_P(obj)) {
return (SYM2ID(obj) * sizeof(RVALUE) + (4 << 2)) | FIXNUM_FLAG;
}
else if (FLONUM_P(obj)) {
@@ -1731,6 +2776,133 @@ 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)
+{
+ size_t size = 0;
+
+ if (SPECIAL_CONST_P(obj)) {
+ return 0;
+ }
+
+ if (FL_TEST(obj, FL_EXIVAR)) {
+ size += rb_generic_ivar_memsize(obj);
+ }
+
+ switch (BUILTIN_TYPE(obj)) {
+ case T_OBJECT:
+ if (!(RBASIC(obj)->flags & ROBJECT_EMBED) &&
+ ROBJECT(obj)->as.heap.ivptr) {
+ size += ROBJECT(obj)->as.heap.numiv * sizeof(VALUE);
+ }
+ break;
+ case T_MODULE:
+ case T_CLASS:
+ if (RCLASS_M_TBL_WRAPPER(obj)) {
+ size += sizeof(struct method_table_wrapper);
+ }
+ if (RCLASS_M_TBL(obj)) {
+ size += st_memsize(RCLASS_M_TBL(obj));
+ }
+ if (RCLASS_EXT(obj)) {
+ if (RCLASS_IV_TBL(obj)) {
+ size += st_memsize(RCLASS_IV_TBL(obj));
+ }
+ if (RCLASS_IV_INDEX_TBL(obj)) {
+ size += st_memsize(RCLASS_IV_INDEX_TBL(obj));
+ }
+ if (RCLASS(obj)->ptr->iv_tbl) {
+ size += st_memsize(RCLASS(obj)->ptr->iv_tbl);
+ }
+ if (RCLASS(obj)->ptr->const_tbl) {
+ size += st_memsize(RCLASS(obj)->ptr->const_tbl);
+ }
+ size += sizeof(rb_classext_t);
+ }
+ break;
+ case T_STRING:
+ size += rb_str_memsize(obj);
+ break;
+ case T_ARRAY:
+ size += rb_ary_memsize(obj);
+ break;
+ case T_HASH:
+ if (RHASH(obj)->ntbl) {
+ size += st_memsize(RHASH(obj)->ntbl);
+ }
+ break;
+ case T_REGEXP:
+ if (RREGEXP(obj)->ptr) {
+ size += onig_memsize(RREGEXP(obj)->ptr);
+ }
+ break;
+ case T_DATA:
+ if (use_all_types) size += rb_objspace_data_type_memsize(obj);
+ break;
+ case T_MATCH:
+ if (RMATCH(obj)->rmatch) {
+ struct rmatch *rm = RMATCH(obj)->rmatch;
+ size += onig_region_memsize(&rm->regs);
+ size += sizeof(struct rmatch_offset) * rm->char_offset_num_allocated;
+ size += sizeof(struct rmatch);
+ }
+ break;
+ case T_FILE:
+ if (RFILE(obj)->fptr) {
+ size += rb_io_memsize(RFILE(obj)->fptr);
+ }
+ break;
+ case T_RATIONAL:
+ case T_COMPLEX:
+ 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);
+ }
+ break;
+
+ case T_NODE:
+ if (use_all_types) size += rb_node_memsize(obj);
+ break;
+
+ case T_STRUCT:
+ if ((RBASIC(obj)->flags & RSTRUCT_EMBED_LEN_MASK) == 0 &&
+ RSTRUCT(obj)->as.heap.ptr) {
+ size += sizeof(VALUE) * RSTRUCT_LEN(obj);
+ }
+ break;
+
+ case T_ZOMBIE:
+ break;
+
+ default:
+ rb_bug("objspace/memsize_of(): unknown data type 0x%x(%p)",
+ BUILTIN_TYPE(obj), (void*)obj);
+ }
+
+ return size;
+}
+
+size_t
+rb_obj_memsize_of(VALUE obj)
+{
+ return obj_memsize_of(obj, TRUE);
+}
+
static int
set_zero(st_data_t key, st_data_t val, st_data_t arg)
{
@@ -1784,26 +2956,27 @@ count_objects(int argc, VALUE *argv, VALUE os)
counts[i] = 0;
}
- for (i = 0; i < heaps_used; i++) {
- RVALUE *p, *pend;
+ for (i = 0; i < heap_allocated_pages; i++) {
+ struct heap_page *page = heap_pages_sorted[i];
+ RVALUE *p, *pend;
- p = objspace->heap.sorted[i]->start; pend = p + objspace->heap.sorted[i]->limit;
- for (;p < pend; p++) {
- if (p->as.basic.flags) {
- counts[BUILTIN_TYPE(p)]++;
- }
- else {
- freed++;
- }
- }
- total += objspace->heap.sorted[i]->limit;
+ p = page->start; pend = p + page->total_slots;
+ for (;p < pend; p++) {
+ if (p->as.basic.flags) {
+ counts[BUILTIN_TYPE(p)]++;
+ }
+ else {
+ freed++;
+ }
+ }
+ total += page->total_slots;
}
if (hash == Qnil) {
hash = rb_hash_new();
}
else if (!RHASH_EMPTY_P(hash)) {
- st_foreach(RHASH_TBL(hash), set_zero, hash);
+ st_foreach(RHASH_TBL_RAW(hash), set_zero, hash);
}
rb_hash_aset(hash, ID2SYM(rb_intern("TOTAL")), SIZET2NUM(total));
rb_hash_aset(hash, ID2SYM(rb_intern("FREE")), SIZET2NUM(freed));
@@ -1847,269 +3020,353 @@ count_objects(int argc, VALUE *argv, VALUE os)
return hash;
}
-
-
/*
------------------------ Garbage Collection ------------------------
*/
/* Sweeping */
-static VALUE
-lazy_sweep_enable(void)
+static size_t
+objspace_available_slots(rb_objspace_t *objspace)
{
- rb_objspace_t *objspace = &rb_objspace;
-
- objspace->flags.dont_lazy_sweep = FALSE;
- return Qnil;
+ return heap_eden->total_slots + heap_tomb->total_slots;
}
-static void
-gc_clear_slot_bits(struct heaps_slot *slot)
+static size_t
+objspace_live_slots(rb_objspace_t *objspace)
{
- memset(slot->bits, 0, HEAP_BITMAP_LIMIT * sizeof(uintptr_t));
+ return (objspace->total_allocated_objects - objspace->profile.total_freed_objects) - heap_pages_final_slots;
}
static size_t
-objspace_live_num(rb_objspace_t *objspace)
+objspace_free_slots(rb_objspace_t *objspace)
{
- return objspace->total_allocated_object_num - objspace->total_freed_object_num;
+ return objspace_available_slots(objspace) - objspace_live_slots(objspace) - heap_pages_final_slots;
}
static void
-slot_sweep(rb_objspace_t *objspace, struct heaps_slot *sweep_slot)
+gc_setup_mark_bits(struct heap_page *page)
{
- size_t empty_num = 0, freed_num = 0, final_num = 0;
- RVALUE *p, *pend;
- RVALUE *final = deferred_final_list;
- int deferred;
- uintptr_t *bits;
-
- p = sweep_slot->header->start; pend = p + sweep_slot->header->limit;
- bits = GET_HEAP_BITMAP(p);
- while (p < pend) {
- if ((!(MARKED_IN_BITMAP(bits, p))) && BUILTIN_TYPE(p) != T_ZOMBIE) {
- if (p->as.basic.flags) {
- if ((deferred = obj_free(objspace, (VALUE)p)) ||
- (FL_TEST(p, FL_FINALIZE))) {
- if (!deferred) {
- p->as.free.flags = T_ZOMBIE;
- RDATA(p)->dfree = 0;
- }
- p->as.free.next = deferred_final_list;
- deferred_final_list = p;
- assert(BUILTIN_TYPE(p) == T_ZOMBIE);
- final_num++;
- }
- else {
- (void)VALGRIND_MAKE_MEM_UNDEFINED((void*)p, sizeof(RVALUE));
- p->as.free.flags = 0;
- p->as.free.next = sweep_slot->freelist;
- sweep_slot->freelist = p;
- freed_num++;
- }
- }
- else {
- empty_num++;
- }
- }
- p++;
- }
- gc_clear_slot_bits(sweep_slot);
- if (final_num + freed_num + empty_num == sweep_slot->header->limit &&
- objspace->heap.free_num > objspace->heap.do_heap_free) {
- RVALUE *pp;
+#if USE_RGENGC
+ /* copy oldgen bitmap to mark bitmap */
+ memcpy(&page->mark_bits[0], &page->long_lived_bits[0], HEAP_BITMAP_SIZE);
+#else
+ /* clear mark bitmap */
+ memset(&page->mark_bits[0], 0, HEAP_BITMAP_SIZE);
+#endif
+}
- for (pp = deferred_final_list; pp != final; pp = pp->as.free.next) {
- RDATA(pp)->dmark = (void (*)(void *))(VALUE)sweep_slot;
- pp->as.free.flags |= FL_SINGLETON; /* freeing page mark */
- }
- sweep_slot->header->limit = final_num;
- unlink_heap_slot(objspace, sweep_slot);
+/* 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;
+ RVALUE *p, *pend,*offset;
+ bits_t *bits, bitset;
+
+ gc_report(2, objspace, "page_sweep: start.\n");
+
+ sweep_page->flags.before_sweep = FALSE;
+
+ p = sweep_page->start; pend = p + sweep_page->total_slots;
+ offset = p - NUM_IN_PAGE(p);
+ bits = sweep_page->mark_bits;
+
+ /* create guard : fill 1 out-of-range */
+ bits[BITMAP_INDEX(p)] |= BITMAP_BIT(p)-1;
+ bits[BITMAP_INDEX(pend)] |= ~(BITMAP_BIT(pend) - 1);
+
+ for (i=0; i < HEAP_BITMAP_LIMIT; i++) {
+ bitset = ~bits[i];
+ 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 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;
+ }
+ }
+ p++;
+ bitset >>= 1;
+ } while (bitset);
+ }
}
- else {
- if (freed_num + empty_num > 0) {
- link_free_heap_slot(objspace, sweep_slot);
- }
- else {
- sweep_slot->free_next = NULL;
- }
- objspace->heap.free_num += freed_num + empty_num;
+
+ gc_setup_mark_bits(sweep_page);
+
+#if GC_PROFILE_MORE_DETAIL
+ if (gc_prof_enabled(objspace)) {
+ gc_profile_record *record = gc_prof_record(objspace);
+ record->removing_objects += final_slots + freed_slots;
+ record->empty_objects += empty_slots;
}
- objspace->total_freed_object_num += freed_num;
- objspace->heap.final_num += final_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 (deferred_final_list && !finalizing) {
+ if (heap_pages_deferred_final && !finalizing) {
rb_thread_t *th = GET_THREAD();
if (th) {
- RUBY_VM_SET_FINALIZER_INTERRUPT(th);
+ gc_finalize_deferred_register();
}
}
+
+ gc_report(2, objspace, "page_sweep: end.\n");
}
-static int
-ready_to_gc(rb_objspace_t *objspace)
+/* allocate additional minimum page to work */
+static void
+gc_heap_prepare_minimum_pages(rb_objspace_t *objspace, rb_heap_t *heap)
{
- if (dont_gc || during_gc) {
- if (!has_free_object) {
- if (!heaps_increment(objspace)) {
- set_heaps_increment(objspace);
- heaps_increment(objspace);
- }
+ if (!heap->free_pages && heap_increment(objspace, heap) == FALSE) {
+ /* there is no free after page_sweep() */
+ heap_set_increment(objspace, 1);
+ if (!heap_increment(objspace, heap)) { /* can't allocate additional free objects */
+ rb_memerror();
}
- return FALSE;
}
- return TRUE;
}
static void
-before_gc_sweep(rb_objspace_t *objspace)
+gc_stat_transition(rb_objspace_t *objspace, enum gc_stat stat)
{
- objspace->heap.do_heap_free = (size_t)((heaps_used * HEAP_OBJ_LIMIT) * 0.65);
- objspace->heap.free_min = (size_t)((heaps_used * HEAP_OBJ_LIMIT) * 0.2);
- if (objspace->heap.free_min < initial_free_min) {
- objspace->heap.free_min = initial_free_min;
- if (objspace->heap.do_heap_free < initial_free_min)
- objspace->heap.do_heap_free = initial_free_min;
+#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;
}
- objspace->heap.sweep_slots = heaps;
- objspace->heap.free_num = 0;
- objspace->heap.free_slots = NULL;
+#endif
+ objspace->flags.stat = stat;
+}
- /* sweep unlinked method entries */
- if (GET_VM()->unlinked_method_entry_list) {
- rb_sweep_method_entry(GET_VM());
+static void
+gc_sweep_start_heap(rb_objspace_t *objspace, rb_heap_t *heap)
+{
+ heap->sweep_pages = heap->pages;
+ heap->free_pages = NULL;
+ heap->pooled_pages = NULL;
+
+ if (heap->using_page) {
+ RVALUE **p = &heap->using_page->freelist;
+ while (*p) {
+ p = &(*p)->as.free.next;
+ }
+ *p = heap->freelist;
+ heap->using_page = NULL;
}
+ heap->freelist = NULL;
}
+#if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 4
+__attribute__((noinline))
+#endif
static void
-after_gc_sweep(rb_objspace_t *objspace)
+gc_sweep_start(rb_objspace_t *objspace)
{
- size_t inc;
+ rb_heap_t *heap;
+ size_t total_limit_slot;
- gc_prof_set_malloc_info(objspace);
- if (objspace->heap.free_num < objspace->heap.free_min) {
- set_heaps_increment(objspace);
- heaps_increment(objspace);
- }
+ gc_stat_transition(objspace, gc_stat_sweeping);
- inc = ATOMIC_SIZE_EXCHANGE(malloc_increase, 0);
- if (inc > malloc_limit) {
- malloc_limit +=
- (size_t)((inc - malloc_limit) * (double)objspace->heap.marked_num / (heaps_used * HEAP_OBJ_LIMIT));
- if (malloc_limit < initial_malloc_limit) malloc_limit = initial_malloc_limit;
+ /* sweep unlinked method entries */
+ if (GET_VM()->unlinked_method_entry_list) {
+ rb_sweep_method_entry(GET_VM());
}
- free_unused_heaps(objspace);
-}
+ /* sometimes heap_allocatable_pages is not 0 */
+ heap_pages_swept_slots = heap_allocatable_pages * HEAP_OBJ_LIMIT;
+ total_limit_slot = objspace_available_slots(objspace);
-static int
-lazy_sweep(rb_objspace_t *objspace)
-{
- struct heaps_slot *next;
-
- heaps_increment(objspace);
- while (objspace->heap.sweep_slots) {
- next = objspace->heap.sweep_slots->next;
- slot_sweep(objspace, objspace->heap.sweep_slots);
- objspace->heap.sweep_slots = next;
- if (has_free_object) {
- during_gc = 0;
- return TRUE;
- }
+ 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;
}
- return FALSE;
+ 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;
+ }
+ 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);
}
static void
-rest_sweep(rb_objspace_t *objspace)
+gc_sweep_finish(rb_objspace_t *objspace)
{
- if (objspace->heap.sweep_slots) {
- while (objspace->heap.sweep_slots) {
- lazy_sweep(objspace);
- }
- after_gc_sweep(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);
+
+ 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;
}
-}
-static void gc_marks(rb_objspace_t *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);
+#endif
+}
static int
-gc_prepare_free_objects(rb_objspace_t *objspace)
+gc_sweep_step(rb_objspace_t *objspace, rb_heap_t *heap)
{
- int res;
+ struct heap_page *sweep_page = heap->sweep_pages, *next;
+ int need_pool = will_be_incremental_marking(objspace) ? TRUE : FALSE;
+ int unlink_limit = 3;
- if (objspace->flags.dont_lazy_sweep)
- return garbage_collect(objspace);
+ gc_report(2, objspace, "gc_sweep_step (need_pool: %d)\n", need_pool);
+ if (sweep_page == NULL) return FALSE;
- if (!ready_to_gc(objspace)) return TRUE;
-
- during_gc++;
- gc_prof_timer_start(objspace);
+#if GC_ENABLE_LAZY_SWEEP
gc_prof_sweep_timer_start(objspace);
+#endif
- if (objspace->heap.sweep_slots) {
- res = lazy_sweep(objspace);
- if (res) {
- gc_prof_sweep_timer_stop(objspace);
- gc_prof_set_malloc_info(objspace);
- gc_prof_timer_stop(objspace, Qfalse);
- return res;
- }
- after_gc_sweep(objspace);
- }
- else {
- if (heaps_increment(objspace)) {
- during_gc = 0;
- return TRUE;
- }
- }
+ while (sweep_page) {
+ heap->sweep_pages = next = sweep_page->next;
+ gc_page_sweep(objspace, heap, sweep_page);
- gc_marks(objspace);
+ 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 (need_pool) {
+ need_pool = FALSE;
+ heap_add_poolpage(objspace, heap, sweep_page);
+ }
+ else {
+ heap_add_freepage(objspace, heap, sweep_page);
+ break;
+ }
+ }
+ else {
+ sweep_page->free_next = NULL;
+ }
- before_gc_sweep(objspace);
- if (objspace->heap.free_min > (heaps_used * HEAP_OBJ_LIMIT - objspace->heap.marked_num)) {
- set_heaps_increment(objspace);
+ sweep_page = next;
}
- gc_prof_sweep_timer_start(objspace);
- if (!(res = lazy_sweep(objspace))) {
- after_gc_sweep(objspace);
- if (has_free_object) {
- res = TRUE;
- during_gc = 0;
- }
+ if (heap->sweep_pages == NULL) {
+ gc_sweep_finish(objspace);
}
+
+#if GC_ENABLE_LAZY_SWEEP
gc_prof_sweep_timer_stop(objspace);
+#endif
- gc_prof_timer_stop(objspace, Qtrue);
- return res;
+ return heap->free_pages != NULL;
}
static void
-gc_sweep(rb_objspace_t *objspace)
+gc_sweep_rest(rb_objspace_t *objspace)
{
- struct heaps_slot *next;
-
- before_gc_sweep(objspace);
+ rb_heap_t *heap = heap_eden; /* lazy sweep only for eden */
- while (objspace->heap.sweep_slots) {
- next = objspace->heap.sweep_slots->next;
- slot_sweep(objspace, objspace->heap.sweep_slots);
- objspace->heap.sweep_slots = next;
+ if (is_lazy_sweeping(heap)) {
+ while (is_lazy_sweeping(heap)) {
+ gc_sweep_step(objspace, heap);
+ }
}
+}
- after_gc_sweep(objspace);
+static void
+gc_sweep_continue(rb_objspace_t *objspace, rb_heap_t *heap)
+{
+ if (RGENGC_CHECK_MODE) assert(dont_gc == FALSE);
- during_gc = 0;
+ 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");
}
-/* Marking stack */
+static void
+gc_sweep(rb_objspace_t *objspace)
+{
+ 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);
+#if !GC_ENABLE_LAZY_SWEEP
+ gc_prof_sweep_timer_stop(objspace);
+#endif
+ }
+ else {
+ struct heap_page *page;
+ gc_sweep_start(objspace);
+ page = heap_eden->sweep_pages;
+ while (page) {
+ page->flags.before_sweep = TRUE;
+ page = page->next;
+ }
+ gc_sweep_step(objspace, heap_eden);
+ }
+
+ gc_heap_prepare_minimum_pages(objspace, heap_eden);
+}
-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);
+/* Marking - Marking stack */
static stack_chunk_t *
stack_chunk_alloc(void)
@@ -2124,11 +3381,24 @@ stack_chunk_alloc(void)
}
static inline int
-is_mark_stask_empty(mark_stack_t *stack)
+is_mark_stack_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)
{
@@ -2156,7 +3426,8 @@ push_mark_stack_chunk(mark_stack_t *stack)
{
stack_chunk_t *next;
- assert(stack->index == stack->limit);
+ if (RGENGC_CHECK_MODE) assert(stack->index == stack->limit);
+
if (stack->cache_size > 0) {
next = stack->cache;
stack->cache = stack->cache->next;
@@ -2178,13 +3449,13 @@ pop_mark_stack_chunk(mark_stack_t *stack)
stack_chunk_t *prev;
prev = stack->chunk->next;
- assert(stack->index == 0);
+ if (RGENGC_CHECK_MODE) 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
+#if (defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE) || (RGENGC_CHECK_MODE >= 4)
static void
free_stack_chunks(mark_stack_t *stack)
{
@@ -2211,25 +3482,56 @@ push_mark_stack(mark_stack_t *stack, VALUE data)
static int
pop_mark_stack(mark_stack_t *stack, VALUE *data)
{
- if (is_mark_stask_empty(stack)) {
+ if (is_mark_stack_empty(stack)) {
return FALSE;
}
if (stack->index == 1) {
*data = stack->chunk->data[--stack->index];
pop_mark_stack_chunk(stack);
- return TRUE;
}
- *data = stack->chunk->data[--stack->index];
+ else {
+ *data = stack->chunk->data[--stack->index];
+ }
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;
- push_mark_stack_chunk(stack);
- stack->limit = STACK_CHUNK_SIZE;
+ MEMZERO(stack, mark_stack_t, 1);
+ 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());
@@ -2237,21 +3539,17 @@ init_mark_stack(mark_stack_t *stack)
stack->unused_cache_size = stack->cache_size;
}
-
/* Marking */
-#define MARK_IN_BITMAP(bits, p) (bits[BITMAP_INDEX(p)] = bits[BITMAP_INDEX(p)] | ((uintptr_t)1 << BITMAP_OFFSET(p)))
-
-
#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)
@@ -2293,8 +3591,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;
@@ -2313,22 +3611,20 @@ ruby_stack_check(void)
#endif
}
+ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS
static void
-mark_locations_array(rb_objspace_t *objspace, register VALUE *x, register long n)
+mark_locations_array(rb_objspace_t *objspace, register const VALUE *x, register long n)
{
VALUE v;
while (n--) {
v = *x;
- (void)VALGRIND_MAKE_MEM_DEFINED(&v, sizeof(v));
- if (is_pointer_to_heap(objspace, (void *)v)) {
- gc_mark(objspace, v);
- }
+ gc_mark_maybe(objspace, v);
x++;
}
}
static void
-gc_mark_locations(rb_objspace_t *objspace, VALUE *start, VALUE *end)
+gc_mark_locations(rb_objspace_t *objspace, const VALUE *start, const VALUE *end)
{
long n;
@@ -2338,11 +3634,22 @@ gc_mark_locations(rb_objspace_t *objspace, VALUE *start, VALUE *end)
}
void
-rb_gc_mark_locations(VALUE *start, VALUE *end)
+rb_gc_mark_locations(const VALUE *start, const 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 {
@@ -2450,25 +3757,34 @@ rb_mark_method_entry(const rb_method_entry_t *me)
}
static int
-mark_method_entry_i(ID key, const rb_method_entry_t *me, st_data_t data)
+mark_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 mark_tbl_arg *arg = (void*)data;
mark_method_entry(arg->objspace, me);
return ST_CONTINUE;
}
static void
-mark_m_tbl(rb_objspace_t *objspace, st_table *tbl)
+mark_m_tbl_wrapper(rb_objspace_t *objspace, struct method_table_wrapper *wrapper)
{
struct mark_tbl_arg arg;
- if (!tbl) return;
+ if (!wrapper || !wrapper->tbl) return;
+ if (LIKELY(objspace->mark_func_data == 0) && !is_incremental_marking(objspace)) {
+ /* prevent multiple marking during same GC cycle,
+ * since m_tbl is shared between several T_ICLASS */
+ size_t serial = rb_gc_count();
+ if (wrapper->serial == serial) return;
+ wrapper->serial = serial;
+ }
arg.objspace = objspace;
- st_foreach(tbl, mark_method_entry_i, (st_data_t)&arg);
+ st_foreach(wrapper->tbl, mark_method_entry_i, (st_data_t)&arg);
}
static int
-mark_const_entry_i(ID key, const rb_const_entry_t *ce, st_data_t data)
+mark_const_entry_i(st_data_t key, st_data_t value, st_data_t data)
{
+ const rb_const_entry_t *ce = (const rb_const_entry_t *)value;
struct mark_tbl_arg *arg = (void*)data;
gc_mark(arg->objspace, ce->value);
gc_mark(arg->objspace, ce->file);
@@ -2494,8 +3810,6 @@ mark_const_tbl(rb_objspace_t *objspace, st_table *tbl)
((start) = STACK_END, (end) = STACK_START) : ((start) = STACK_START, (end) = STACK_END+(appendix)))
#endif
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
-
static void
mark_current_machine_context(rb_objspace_t *objspace, rb_thread_t *th)
{
@@ -2509,6 +3823,9 @@ 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);
@@ -2516,7 +3833,7 @@ mark_current_machine_context(rb_objspace_t *objspace, rb_thread_t *th)
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__)
mark_locations_array(objspace, (VALUE*)((char*)STACK_END + 2),
@@ -2533,7 +3850,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);
+ rb_gc_mark_locations(th->machine.register_stack_start, th->machine.register_stack_end);
#endif
}
@@ -2543,84 +3860,201 @@ rb_mark_tbl(st_table *tbl)
mark_tbl(&rb_objspace, tbl);
}
+static void
+gc_mark_maybe(rb_objspace_t *objspace, VALUE obj)
+{
+ (void)VALGRIND_MAKE_MEM_DEFINED(&obj, sizeof(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);
+ }
+ }
+}
+
void
rb_gc_mark_maybe(VALUE obj)
{
- if (is_pointer_to_heap(&rb_objspace, (void *)obj)) {
- gc_mark(&rb_objspace, obj);
- }
+ gc_mark_maybe(&rb_objspace, obj);
}
-static int
-gc_mark_ptr(rb_objspace_t *objspace, VALUE ptr)
+static inline int
+gc_mark_set(rb_objspace_t *objspace, VALUE obj)
{
- register uintptr_t *bits = GET_HEAP_BITMAP(ptr);
- if (MARKED_IN_BITMAP(bits, ptr)) return 0;
- MARK_IN_BITMAP(bits, ptr);
- objspace->heap.marked_num++;
+ if (RVALUE_MARKED(obj)) return 0;
+ MARK_IN_BITMAP(GET_HEAP_MARK_BITS(obj), obj);
return 1;
}
+#if USE_RGENGC
static int
-markable_object_p(rb_objspace_t *objspace, VALUE ptr)
+gc_remember_unprotected(rb_objspace_t *objspace, VALUE obj)
{
- register RVALUE *obj = RANY(ptr);
+ struct heap_page *page = GET_HEAP_PAGE(obj);
+ bits_t *bits = &page->long_lived_bits[0];
- if (rb_special_const_p(ptr)) return 0; /* special const not marked */
- if (obj->as.basic.flags == 0) return 0 ; /* free cell */
+ if (!MARKED_IN_BITMAP(bits, obj)) {
+ page->flags.has_long_lived_shady_objects = TRUE;
+ MARK_IN_BITMAP(bits, obj);
+ objspace->rgengc.remembered_wb_unprotected_objects++;
- return 1;
+#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;
+ }
}
+#endif
-int
-rb_objspace_markable_object_p(VALUE obj)
+static void
+rgengc_check_relation(rb_objspace_t *objspace, VALUE obj)
{
- return markable_object_p(/* now it doesn't use &rb_objspace */ 0, 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));
+ }
+ }
+ else {
+ if (!RVALUE_OLD_P(obj)) {
+ if (RVALUE_MARKED(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);
+ }
+ }
+ else {
+ gc_report(2, objspace, "relation: (O->Y) %s -> %s\n", obj_info(old_parent), obj_info(obj));
+ RVALUE_AGE_SET_CANDIDATE(objspace, obj);
+ }
+ }
+ }
+ }
+
+ if (RGENGC_CHECK_MODE) assert(old_parent == objspace->rgengc.parent_object);
+#endif
}
static void
-gc_mark(rb_objspace_t *objspace, VALUE ptr)
+gc_grey(rb_objspace_t *objspace, VALUE obj)
{
- if (!markable_object_p(objspace, ptr)) {
- return;
+#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);
+}
- if (LIKELY(objspace->mark_func_data == 0)) {
- if (!gc_mark_ptr(objspace, ptr)) return; /* already marked */
- push_mark_stack(&objspace->mark_stack, ptr);
+static void
+gc_aging(rb_objspace_t *objspace, VALUE obj)
+{
+#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 (RVALUE_PAGE_WB_UNPROTECTED(page, obj) == 0) {
+ 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_LONG_LIVED(page, obj) == FALSE);
+ MARK_IN_BITMAP(page->long_lived_bits, obj);
+ objspace->rgengc.old_objects++;
+ }
+ }
+ check_rvalue_consistency(obj);
+#endif /* USE_RGENGC */
+
+ objspace->marked_slots++;
+}
+
+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);
}
else {
- objspace->mark_func_data->mark_func(ptr, objspace->mark_func_data->data);
+ objspace->mark_func_data->mark_func(obj, 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);
}
-static void
-gc_mark_children(rb_objspace_t *objspace, VALUE ptr)
-{
- register RVALUE *obj = RANY(ptr);
+/* CAUTION: THIS FUNCTION ENABLE *ONLY BEFORE* SWEEPING.
+ * This function is only for GC_END_MARK timing.
+ */
- goto marking; /* skip */
+int
+rb_objspace_marked_object_p(VALUE obj)
+{
+ return RVALUE_MARKED(obj) ? TRUE : FALSE;
+}
- again:
- if (LIKELY(objspace->mark_func_data == 0)) {
- obj = RANY(ptr);
- if (!markable_object_p(objspace, ptr)) return;
- if (!gc_mark_ptr(objspace, ptr)) return; /* already marked */
+static inline void
+gc_mark_set_parent(rb_objspace_t *objspace, VALUE obj)
+{
+#if USE_RGENGC
+ if (RVALUE_OLD_P(obj)) {
+ objspace->rgengc.parent_object = obj;
}
else {
- gc_mark(objspace, ptr);
- return;
+ objspace->rgengc.parent_object = Qfalse;
}
+#endif
+}
+
+static void
+gc_mark_children(rb_objspace_t *objspace, VALUE obj)
+{
+ register RVALUE *any = RANY(obj);
+ gc_mark_set_parent(objspace, obj);
- marking:
if (FL_TEST(obj, FL_EXIVAR)) {
- rb_mark_generic_ivar(ptr);
+ rb_mark_generic_ivar(obj);
}
switch (BUILTIN_TYPE(obj)) {
@@ -2630,175 +4064,31 @@ gc_mark_children(rb_objspace_t *objspace, VALUE ptr)
break;
case T_NODE:
- 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 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 */
- if (is_pointer_to_heap(objspace, obj->as.node.u1.node)) {
- gc_mark(objspace, (VALUE)obj->as.node.u1.node);
- }
- if (is_pointer_to_heap(objspace, obj->as.node.u2.node)) {
- gc_mark(objspace, (VALUE)obj->as.node.u2.node);
- }
- if (is_pointer_to_heap(objspace, obj->as.node.u3.node)) {
- gc_mark(objspace, (VALUE)obj->as.node.u3.node);
- }
- }
+ obj = rb_gc_mark_node(&any->as.node);
+ if (obj) gc_mark(objspace, obj);
return; /* no need to mark class. */
}
- gc_mark(objspace, obj->as.basic.klass);
+ gc_mark(objspace, any->as.basic.klass);
+
switch (BUILTIN_TYPE(obj)) {
case T_ICLASS:
case T_CLASS:
case T_MODULE:
- mark_m_tbl(objspace, RCLASS_M_TBL(obj));
+ mark_m_tbl_wrapper(objspace, RCLASS_M_TBL_WRAPPER(obj));
if (!RCLASS_EXT(obj)) break;
mark_tbl(objspace, RCLASS_IV_TBL(obj));
mark_const_tbl(objspace, RCLASS_CONST_TBL(obj));
- ptr = RCLASS_SUPER(obj);
- goto again;
+ gc_mark(objspace, RCLASS_SUPER((VALUE)obj));
+ break;
case T_ARRAY:
if (FL_TEST(obj, ELTS_SHARED)) {
- ptr = obj->as.array.as.heap.aux.shared;
- goto again;
+ gc_mark(objspace, any->as.array.as.heap.aux.shared);
}
else {
long i, len = RARRAY_LEN(obj);
- VALUE *ptr = RARRAY_PTR(obj);
+ const VALUE *ptr = RARRAY_CONST_PTR(obj);
for (i=0; i < len; i++) {
gc_mark(objspace, *ptr++);
}
@@ -2806,25 +4096,23 @@ gc_mark_children(rb_objspace_t *objspace, VALUE ptr)
break;
case T_HASH:
- mark_hash(objspace, obj->as.hash.ntbl);
- ptr = obj->as.hash.ifnone;
- goto again;
+ mark_hash(objspace, any->as.hash.ntbl);
+ gc_mark(objspace, any->as.hash.ifnone);
+ break;
case T_STRING:
-#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;
+ if (STR_SHARED_P(obj)) {
+ gc_mark(objspace, any->as.string.as.heap.aux.shared);
}
break;
case T_DATA:
if (RTYPEDDATA_P(obj)) {
- RUBY_DATA_FUNC mark_func = obj->as.typeddata.type->function.dmark;
+ RUBY_DATA_FUNC mark_func = any->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));
+ if (any->as.data.dmark) (*any->as.data.dmark)(DATA_PTR(obj));
}
break;
@@ -2839,47 +4127,46 @@ gc_mark_children(rb_objspace_t *objspace, VALUE ptr)
break;
case T_FILE:
- 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);
+ 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);
}
break;
case T_REGEXP:
- ptr = obj->as.regexp.src;
- goto again;
+ gc_mark(objspace, any->as.regexp.src);
+ break;
case T_FLOAT:
case T_BIGNUM:
- case T_ZOMBIE:
+ case T_SYMBOL:
break;
case T_MATCH:
- gc_mark(objspace, obj->as.match.regexp);
- if (obj->as.match.str) {
- ptr = obj->as.match.str;
- goto again;
+ gc_mark(objspace, any->as.match.regexp);
+ if (any->as.match.str) {
+ gc_mark(objspace, any->as.match.str);
}
break;
case T_RATIONAL:
- gc_mark(objspace, obj->as.rational.num);
- ptr = obj->as.rational.den;
- goto again;
+ gc_mark(objspace, any->as.rational.num);
+ gc_mark(objspace, any->as.rational.den);
+ break;
case T_COMPLEX:
- gc_mark(objspace, obj->as.complex.real);
- ptr = obj->as.complex.imag;
- goto again;
+ gc_mark(objspace, any->as.complex.real);
+ gc_mark(objspace, any->as.complex.imag);
+ break;
case T_STRUCT:
{
long len = RSTRUCT_LEN(obj);
- VALUE *ptr = RSTRUCT_PTR(obj);
+ const VALUE *ptr = RSTRUCT_CONST_PTR(obj);
while (len--) {
gc_mark(objspace, *ptr++);
@@ -2888,98 +4175,1450 @@ gc_mark_children(rb_objspace_t *objspace, VALUE ptr)
break;
default:
+#if GC_DEBUG
+ rb_gcdebug_print_obj_condition((VALUE)obj);
+#endif
+ 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), (void *)obj,
- is_pointer_to_heap(objspace, obj) ? "corrupted object" : "non object");
+ BUILTIN_TYPE(obj), any,
+ is_pointer_to_heap(objspace, any) ? "corrupted object" : "non object");
}
}
-static void
-gc_mark_stacked_objects(rb_objspace_t *objspace)
+/**
+ * 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)
{
mark_stack_t *mstack = &objspace->mark_stack;
- VALUE obj = 0;
+ VALUE obj;
+#if GC_ENABLE_INCREMENTAL_MARK
+ size_t marked_slots_at_the_beggining = objspace->marked_slots;
+#endif
- 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));
+ }
gc_mark_children(objspace, obj);
+
+#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);
+
+ if (objspace->marked_slots - marked_slots_at_the_beggining > count) {
+ break;
+ }
+ }
+ else {
+ /* just ignore marking bits */
+ }
+#endif
+ }
+
+ if (RGENGC_CHECK_MODE >= 3) {
+ gc_verify_internal_consistency(Qnil);
+ }
+
+ if (is_mark_stack_empty(mstack)) {
+ shrink_stack_chunk_cache(mstack);
+ return TRUE;
+ }
+ else {
+ return FALSE;
+ }
+}
+
+static int
+gc_mark_stacked_objects_incremental(rb_objspace_t *objspace, size_t count)
+{
+ return gc_mark_stacked_objects(objspace, TRUE, count);
+}
+
+static int
+gc_mark_stacked_objects_all(rb_objspace_t *objspace)
+{
+ return gc_mark_stacked_objects(objspace, FALSE, 0);
+}
+
+#if PRINT_ROOT_TICKS
+#define MAX_TICKS 0x100
+static tick_t mark_ticks[MAX_TICKS];
+static const char *mark_ticks_categories[MAX_TICKS];
+
+static void
+show_mark_ticks(void)
+{
+ int i;
+ fprintf(stderr, "mark ticks result:\n");
+ for (i=0; i<MAX_TICKS; i++) {
+ const char *category = mark_ticks_categories[i];
+ if (category) {
+ fprintf(stderr, "%s\t%8lu\n", category, (unsigned long)mark_ticks[i]);
+ }
+ else {
+ break;
+ }
}
- shrink_stack_chunk_cache(mstack);
}
+#endif /* PRITNT_ROOT_TICKS */
+
static void
-gc_marks(rb_objspace_t *objspace)
+gc_mark_roots(rb_objspace_t *objspace, const char **categoryp)
{
struct gc_list *list;
rb_thread_t *th = GET_THREAD();
- struct mark_func_data_struct *prev_mark_func_data;
+ if (categoryp) *categoryp = "xxx";
- prev_mark_func_data = objspace->mark_func_data;
- objspace->mark_func_data = 0;
+#if USE_RGENGC
+ objspace->rgengc.parent_object = Qfalse;
+#endif
- gc_prof_mark_timer_start(objspace);
- objspace->heap.marked_num = 0;
- objspace->count++;
+#if PRINT_ROOT_TICKS
+ tick_t start_tick = tick();
+ int tick_count = 0;
+ const char *prev_category = 0;
- SET_STACK_END;
+ if (mark_ticks_categories[0] == 0) {
+ atexit(show_mark_ticks);
+ }
+#endif
+
+#if PRINT_ROOT_TICKS
+#define MARK_CHECKPOINT_PRINT_TICK(category) do { \
+ if (prev_category) { \
+ tick_t t = tick(); \
+ mark_ticks[tick_count] = t - start_tick; \
+ mark_ticks_categories[tick_count] = prev_category; \
+ tick_count++; \
+ } \
+ prev_category = category; \
+ start_tick = tick(); \
+} while (0)
+#else /* PRITNT_ROOT_TICKS */
+#define MARK_CHECKPOINT_PRINT_TICK(category)
+#endif
- th->vm->self ? rb_gc_mark(th->vm->self) : rb_vm_mark(th->vm);
+#define MARK_CHECKPOINT(category) do { \
+ if (categoryp) *categoryp = category; \
+ MARK_CHECKPOINT_PRINT_TICK(category); \
+} while (0)
+ MARK_CHECKPOINT("vm");
+ SET_STACK_END;
+ rb_vm_mark(th->vm);
+ if (th->vm->self) gc_mark_set(objspace, th->vm->self);
+
+ MARK_CHECKPOINT("finalizers");
mark_tbl(objspace, finalizer_table);
+
+ MARK_CHECKPOINT("machine_context");
mark_current_machine_context(objspace, th);
- rb_gc_mark_symbols();
+ MARK_CHECKPOINT("encodings");
rb_gc_mark_encodings();
/* mark protected global variables */
- for (list = global_List; list; list = list->next) {
+ MARK_CHECKPOINT("global_list");
+ for (list = global_list; list; list = list->next) {
rb_gc_mark_maybe(*list->varptr);
}
+
+ MARK_CHECKPOINT("end_proc");
rb_mark_end_proc();
- rb_gc_mark_global_tbl();
- mark_tbl(objspace, rb_class_tbl);
+ MARK_CHECKPOINT("global_tbl");
+ rb_gc_mark_global_tbl();
/* mark generic instance variables for special constants */
+ MARK_CHECKPOINT("generic_ivars");
rb_mark_generic_ivar_tbl();
- rb_gc_mark_parser();
-
+ MARK_CHECKPOINT("live_method_entries");
rb_gc_mark_unlinked_live_method_entries(th->vm);
- /* marking-loop */
- gc_mark_stacked_objects(objspace);
+ MARK_CHECKPOINT("finish");
+#undef MARK_CHECKPOINT
+}
+
+#if RGENGC_CHECK_MODE >= 4
+
+#define MAKE_ROOTSIG(obj) (((VALUE)(obj) << 1) | 0x01)
+#define IS_ROOTSIG(obj) ((VALUE)(obj) & 0x01)
+#define GET_ROOTSIG(obj) ((const char *)((VALUE)(obj) >> 1))
+
+struct reflist {
+ VALUE *list;
+ int pos;
+ int size;
+};
+
+static struct reflist *
+reflist_create(VALUE obj)
+{
+ struct reflist *refs = xmalloc(sizeof(struct reflist));
+ refs->size = 1;
+ refs->list = ALLOC_N(VALUE, refs->size);
+ refs->list[0] = obj;
+ refs->pos = 1;
+ return refs;
+}
+
+static void
+reflist_destruct(struct reflist *refs)
+{
+ xfree(refs->list);
+ xfree(refs);
+}
+
+static void
+reflist_add(struct reflist *refs, VALUE obj)
+{
+ if (refs->pos == refs->size) {
+ refs->size *= 2;
+ SIZED_REALLOC_N(refs->list, VALUE, refs->size, refs->size/2);
+ }
+
+ refs->list[refs->pos++] = obj;
+}
+
+static void
+reflist_dump(struct reflist *refs)
+{
+ int i;
+ for (i=0; i<refs->pos; i++) {
+ VALUE obj = refs->list[i];
+ if (IS_ROOTSIG(obj)) { /* root */
+ fprintf(stderr, "<root@%s>", GET_ROOTSIG(obj));
+ }
+ else {
+ fprintf(stderr, "<%s>", obj_info(obj));
+ }
+ if (i+1 < refs->pos) fprintf(stderr, ", ");
+ }
+}
+
+static int
+reflist_refered_from_machine_context(struct reflist *refs)
+{
+ int i;
+ for (i=0; i<refs->pos; i++) {
+ VALUE obj = refs->list[i];
+ if (IS_ROOTSIG(obj) && strcmp(GET_ROOTSIG(obj), "machine_context") == 0) return 1;
+ }
+ return 0;
+}
+
+struct allrefs {
+ rb_objspace_t *objspace;
+ /* a -> obj1
+ * b -> obj1
+ * c -> obj1
+ * c -> obj2
+ * d -> obj3
+ * #=> {obj1 => [a, b, c], obj2 => [c, d]}
+ */
+ struct st_table *references;
+ const char *category;
+ VALUE root_obj;
+ mark_stack_t mark_stack;
+};
+
+static int
+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;
+ }
+}
+
+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);
+ }
+}
+
+static void
+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);
+ }
+}
+
+static st_table *
+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;
+
+ 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();
+
+ /* traverse rest objects reachable from root objects */
+ while (pop_mark_stack(&data.mark_stack, &obj)) {
+ rb_objspace_reachable_objects_from(data.root_obj = obj, allrefs_i, &data);
+ }
+ free_stack_chunks(&data.mark_stack);
+ dont_gc = prev_dont_gc;
+ return data.references;
+}
+
+static int
+objspaec_allrefs_destruct_i(st_data_t key, st_data_t value, void *ptr)
+{
+ struct reflist *refs = (struct reflist *)value;
+ reflist_destruct(refs);
+ return ST_CONTINUE;
+}
+
+static void
+objspace_allrefs_destruct(struct st_table *refs)
+{
+ st_foreach(refs, objspaec_allrefs_destruct_i, 0);
+ st_free_table(refs);
+}
+
+#if RGENGC_CHECK_MODE >= 5
+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));
+ reflist_dump(refs);
+ fprintf(stderr, "\n");
+ return ST_CONTINUE;
+}
+
+static void
+allrefs_dump(rb_objspace_t *objspace)
+{
+ fprintf(stderr, "[all refs] (size: %d)\n", (int)objspace->rgengc.allrefs_table->num_entries);
+ st_foreach(objspace->rgengc.allrefs_table, allrefs_dump_i, 0);
+}
+#endif
+
+static int
+gc_check_after_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;
+
+ /* 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 is referred from ", (void *)obj);
+ reflist_dump(refs);
+
+ if (reflist_refered_from_machine_context(refs)) {
+ fprintf(stderr, " (marked from machine stack).\n");
+ /* marked from machine context can be false positive */
+ }
+ else {
+ objspace->rgengc.error_count++;
+ fprintf(stderr, "\n");
+ }
+ }
+ return ST_CONTINUE;
+}
+
+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);
+ }
+
+ if (objspace->rgengc.error_count > 0) {
+#if RGENGC_CHECK_MODE >= 5
+ allrefs_dump(objspace);
+#endif
+ if (checker_name) rb_bug("%s: GC has problem.", checker_name);
+ }
+
+ objspace_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_LONG_LIVED(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
+
+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_LONG_LIVED(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_LONG_LIVED(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_long_lived_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 self)
+{
+ 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.remembered_wb_unprotected_objects != data.remembered_shady_count) {
+ rb_bug("inconsistent old slot nubmer: expect %"PRIuSIZE", but %"PRIuSIZE".", objspace->rgengc.remembered_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;
+}
+
+/* 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);
+
+ objspace->marked_slots = 0;
+
+#if USE_RGENGC
+ objspace->rgengc.old_objects_at_gc_start = objspace->rgengc.old_objects;
+
+ if (full_mark) {
+ objspace->flags.during_minor_gc = FALSE;
+ objspace->profile.major_gc_count++;
+ objspace->rgengc.remembered_wb_unprotected_objects = 0;
+ objspace->rgengc.old_objects = 0;
+ objspace->rgengc.last_major_gc = objspace->profile.count;
+ rgengc_mark_and_rememberset_clear(objspace, heap_eden);
+ }
+ else {
+ objspace->flags.during_minor_gc = TRUE;
+ objspace->marked_slots =
+ objspace->rgengc.old_objects +
+ objspace->rgengc.remembered_wb_unprotected_objects; /* long lived 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);
+}
+#endif
+
+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;
+}
+
+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);
+#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.remembered_wb_unprotected_objects_limit = (size_t)(objspace->rgengc.remembered_wb_unprotected_objects * r);
+ objspace->rgengc.old_objects_limit = (size_t)(objspace->rgengc.old_objects * r);
+ }
+#endif
+
+#if RGENGC_CHECK_MODE >= 4
+ gc_marks_check(objspace, gc_check_after_marks_i, "after_marks");
+#endif
+
+ { /* 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.remembered_wb_unprotected_objects > objspace->rgengc.remembered_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;
+ }
+
+ 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;
+}
+
+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);
+ }
+ }
+}
+
+static void
+gc_marks_rest(rb_objspace_t *objspace)
+{
+ gc_report(1, objspace, "gc_marks_rest\n");
+
+ heap_eden->pooled_pages = NULL;
+
+ 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);
+}
+
+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, 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");
+}
+
+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);
+ }
+
+#if RGENGC_PROFILE > 0
+ if (gc_prof_record(objspace)) {
+ gc_profile_record *record = gc_prof_record(objspace);
+ record->old_objects = objspace->rgengc.old_objects;
+ }
+#endif
+
+#else /* USE_RGENGC */
+ gc_marks_start(objspace, TRUE);
+ gc_marks_rest(objspace);
+#endif
+ }
+ 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, ...)
+{
+ if (level <= RGENGC_DEBUG) {
+ char buf[1024];
+ FILE *out = stderr;
+ va_list args;
+ const char *status = " ";
+
+#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";
+ }
+ }
+#endif
+
+ va_start(args, fmt);
+ vsnprintf(buf, 1024, fmt, args);
+ va_end(args);
+
+ fprintf(out, "%s|", status);
+ fputs(buf, out);
+ }
+}
+
+#if USE_RGENGC
+
+/* bit operations */
+
+static int
+rgengc_remembersetbits_get(rb_objspace_t *objspace, VALUE obj)
+{
+ return RVALUE_REMEMBERED(obj);
+}
+
+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));
+
+ if (MARKED_IN_BITMAP(bits, obj)) {
+ return FALSE;
+ }
+ else {
+ page->flags.has_remembered_objects = TRUE;
+ MARK_IN_BITMAP(bits, obj);
+ return TRUE;
+ }
+}
+
+/* wb, etc */
+
+/* return FALSE if already remembered */
+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");
+
+ 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_PROFILE > 0
+ if (!rgengc_remembered(objspace, obj)) {
+ if (RVALUE_WB_UNPROTECTED(obj) == 0) {
+ objspace->profile.total_remembered_normal_object_count++;
+#if RGENGC_PROFILE >= 2
+ objspace->profile.remembered_normal_object_count_types[BUILTIN_TYPE(obj)]++;
+#endif
+ }
+ }
+#endif /* RGENGC_PROFILE > 0 */
+
+ return rgengc_remembersetbits_set(objspace, obj);
+}
+
+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));
+ 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;
+ struct heap_page *page = heap->pages;
+#if PROFILE_REMEMBERSET_MARK
+ int has_old = 0, has_shady = 0, has_both = 0, skip = 0;
+#endif
+ gc_report(1, objspace, "rgengc_rememberset_mark: start\n");
+
+ while (page) {
+ if (page->flags.has_remembered_objects | page->flags.has_long_lived_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 *long_lived_bits = page->long_lived_bits;
+ bits_t *wb_unprotected_bits = page->wb_unprotected_bits;
+#if PROFILE_REMEMBERSET_MARK
+ if (page->flags.has_remembered_objects && page->flags.has_long_lived_shady_objects) has_both++;
+ else if (page->flags.has_remembered_objects) has_old++;
+ else if (page->flags.has_long_lived_shady_objects) has_shady++;
+#endif
+ for (j=0; j<HEAP_BITMAP_LIMIT; j++) {
+ bits[j] = marking_bits[j] | (long_lived_bits[j] & wb_unprotected_bits[j]);
+ marking_bits[j] = 0;
+ }
+ page->flags.has_remembered_objects = FALSE;
+
+ for (j=0; j < HEAP_BITMAP_LIMIT; j++) {
+ bitset = bits[j];
+
+ 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_LONG_LIVED(obj));
+ assert(RVALUE_OLD_P(obj) || RVALUE_WB_UNPROTECTED(obj));
+ }
+
+ gc_mark_children(objspace, obj);
+ }
+ p++;
+ bitset >>= 1;
+ } while (bitset);
+ }
+ }
+ }
+#if PROFILE_REMEMBERSET_MARK
+ else {
+ skip++;
+ }
+#endif
+
+ page = page->next;
+ }
+
+#if PROFILE_REMEMBERSET_MARK
+ fprintf(stderr, "%d\t%d\t%d\t%d\n", has_both, has_old, has_shady, skip);
+#endif
+ gc_report(1, objspace, "rgengc_rememberset_mark: finished\n");
+}
+
+static void
+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->long_lived_bits[0], 0, HEAP_BITMAP_SIZE);
+ page->flags.has_long_lived_shady_objects = FALSE;
+ page->flags.has_remembered_objects = FALSE;
+ page = page->next;
+ }
+}
+
+/* RGENGC: APIs */
+
+void
+rb_gc_writebarrier_generational(VALUE a, VALUE b)
+{
+ rb_objspace_t *objspace = &rb_objspace;
+
+ if (RGENGC_CHECK_MODE) {
+ if (!RVALUE_OLD_P(a)) rb_bug("rb_gc_writebarrier_generational: %s is not an old object.", obj_info(a));
+ if ( RVALUE_OLD_P(b)) rb_bug("rb_gc_writebarrier_generational: %s is an old object.", obj_info(b));
+ if (is_incremental_marking(objspace)) rb_bug("rb_gc_writebarrier_generational: called while incremental marking: %s -> %s", obj_info(a), obj_info(b));
+ }
+
+ if (!rgengc_remembered(objspace, a)) {
+ gc_report(1, objspace, "rb_gc_writebarrier_generational: %s -> %s\n", obj_info(a), obj_info(b));
+ rgengc_remember(objspace, a);
+ }
+}
+
+#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);
+}
+
+int
+rb_gc_writebarrier_incremental(VALUE a, VALUE b)
+{
+ rb_objspace_t *objspace = &rb_objspace;
+
+ if (RGENGC_CHECK_MODE) {
+ if (SPECIAL_CONST_P(a)) rb_bug("rb_gc_writebarrier: a is special const");
+ if (SPECIAL_CONST_P(b)) rb_bug("rb_gc_writebarrier: a is special const");
+ }
+
+ if (LIKELY(!is_incremental_marking(objspace))) {
+ return FALSE;
+ }
+ else {
+ gc_report(2, objspace, "rb_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, "rb_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, "rb_gc_writebarrier_incremental: [GN] %s -> %s\n", obj_info(a), obj_info(b));
+ RVALUE_AGE_SET_OLD(objspace, b);
+
+ if (RVALUE_BLACK_P(b)) {
+ gc_grey(objspace, b);
+ }
+ }
+ else {
+ gc_report(1, objspace, "rb_gc_writebarrier_incremental: [LL] %s -> %s\n", obj_info(a), obj_info(b));
+ gc_remember_unprotected(objspace, b);
+ }
+ }
+ }
+
+ return TRUE;
+ }
+}
+#endif
+
+void
+rb_gc_writebarrier_unprotect(VALUE obj)
+{
+ if (RVALUE_WB_UNPROTECTED(obj)) {
+ return;
+ }
+ else {
+ rb_objspace_t *objspace = &rb_objspace;
+
+ gc_report(2, objspace, "rb_gc_writebarrier_unprotect: %s %s\n", obj_info(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 RGENGC_PROFILE
+ objspace->profile.total_shade_operation_count++;
+#if RGENGC_PROFILE >= 2
+ 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);
+ }
+}
+
+/*
+ * remember `obj' if needed.
+ */
+void
+rb_gc_writebarrier_remember(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);
+ }
+ }
+}
+
+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)
+{
+ fprintf(stderr, "%s\t%d\n", (char *)key, (int)val);
+ return ST_CONTINUE;
+}
+
+static void
+rgengc_unprotect_logging_exit_func(void)
+{
+ st_foreach(rgengc_unprotect_logging_table, rgengc_unprotect_logging_exit_func_i, 0);
+}
+
+void
+rb_gc_unprotect_logging(void *objptr, const char *filename, int line)
+{
+ VALUE obj = (VALUE)objptr;
+
+ if (rgengc_unprotect_logging_table == 0) {
+ rgengc_unprotect_logging_table = st_init_strtable();
+ atexit(rgengc_unprotect_logging_exit_func);
+ }
+
+ if (RVALUE_WB_UNPROTECTED(obj) == 0) {
+ char buff[0x100];
+ st_data_t cnt = 1;
+ char *ptr = buff;
+
+ snprintf(ptr, 0x100 - 1, "%s|%s:%d", obj_info(obj), filename, line);
+
+ if (st_lookup(rgengc_unprotect_logging_table, (st_data_t)ptr, &cnt)) {
+ cnt++;
+ }
+ else {
+ ptr = (char *)malloc(strlen(buff) + 1);
+ strcpy(ptr, buff);
+ }
+ 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
+ if (RVALUE_WB_UNPROTECTED(obj)) {
+ MARK_IN_BITMAP(GET_HEAP_WB_UNPROTECTED_BITS(dest), dest);
+ }
+#endif
+}
+
+/* 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
+}
+
+VALUE
+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_long_lived;
+#endif
- objspace->mark_func_data = prev_mark_func_data;
+ if (!ID_marked) {
+#define I(s) ID_##s = rb_intern(#s);
+ I(marked);
+#if USE_RGENGC
+ I(wb_protected);
+ I(old);
+ I(marking);
+ I(long_lived);
+#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_LONG_LIVED(obj) && n<max) flags[n++] = ID_long_lived;
+ 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 p)
+rb_gc_force_recycle(VALUE obj)
{
rb_objspace_t *objspace = &rb_objspace;
- struct heaps_slot *slot;
- objspace->total_freed_object_num++;
- if (MARKED_IN_BITMAP(GET_HEAP_BITMAP(p), p)) {
- add_slot_local_freelist(objspace, (RVALUE *)p);
+#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_LONG_LIVED_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 {
- objspace->heap.free_num++;
- slot = add_slot_local_freelist(objspace, (RVALUE *)p);
- if (slot->free_next == NULL) {
- link_free_heap_slot(objspace, slot);
- }
+#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
}
+#endif
+#endif
+
+ objspace->profile.total_freed_objects++;
+
+ heap_page_add_freeobj(objspace, GET_HEAP_PAGE(obj), obj);
+
+ /* Disable counting swept_slots because there are no meaning.
+ * if (!MARKED_IN_BITMAP(GET_HEAP_MARK_BITS(p), p)) {
+ * objspace->heap.swept_slots++;
+ * }
+ */
}
+#ifndef MARK_OBJECT_ARY_BUCKET_SIZE
+#define MARK_OBJECT_ARY_BUCKET_SIZE 1024
+#endif
+
void
rb_gc_register_mark_object(VALUE obj)
{
- VALUE ary = GET_THREAD()->vm->mark_object_ary;
+ 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);
+ }
+
rb_ary_push(ary, obj);
}
@@ -2990,19 +5629,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;
}
@@ -3018,52 +5657,369 @@ rb_gc_unregister_address(VALUE *addr)
}
}
+void
+rb_global_variable(VALUE *var)
+{
+ rb_gc_register_address(var);
+}
+
#define GC_NOTIFY 0
-static int
-garbage_collect(rb_objspace_t *objspace)
+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 (GC_NOTIFY) printf("start garbage_collect()\n");
+ if (!heap->freelist && !heap->free_pages) {
+ if (!heap_increment(objspace, heap)) {
+ heap_set_increment(objspace, 1);
+ heap_increment(objspace, heap);
+ }
+ }
+}
- if (!heaps) {
+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;
}
- if (!ready_to_gc(objspace)) {
- return TRUE;
+ else {
+ return TRUE;
}
+}
- gc_prof_timer_start(objspace);
+static void
+gc_reset_malloc_info(rb_objspace_t *objspace)
+{
+ gc_prof_set_malloc_info(objspace);
+ {
+ 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 = 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;
+ }
+ }
- rest_sweep(objspace);
+ 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);
+ }
+ }
+ }
- during_gc++;
- gc_marks(objspace);
+ /* 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);
- gc_prof_sweep_timer_start(objspace);
- gc_sweep(objspace);
- gc_prof_sweep_timer_stop(objspace);
+ if (objspace->rgengc.oldmalloc_increase_limit > gc_params.oldmalloc_limit_max) {
+ objspace->rgengc.oldmalloc_increase_limit = gc_params.oldmalloc_limit_max;
+ }
+ }
- gc_prof_timer_stop(objspace, Qtrue);
- if (GC_NOTIFY) printf("end garbage_collect()\n");
+ 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);
+ }
+ 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 (!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;
+ }
+
+ 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 = GPR_FLAG_NONE;
+ if (RGENGC_FORCE_MAJOR_GC) objspace->rgengc.need_major_gc = GPR_FLAG_MAJOR_BY_NOFREE;
+#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;
+ }
+#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;
+
+ 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);
+
+ 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);
+
+ gc_prof_timer_start(objspace);
+ {
+ gc_marks(objspace, do_full_mark);
+ }
+ gc_prof_timer_stop(objspace);
+
+ gc_exit(objspace, "gc_start");
return TRUE;
}
+static void
+gc_rest(rb_objspace_t *objspace)
+{
+ 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);
+ }
+ gc_exit(objspace, "gc_rest");
+ }
+}
+
+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)
+{
+ 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';
+}
+
+static const char *
+gc_current_status(rb_objspace_t *objspace)
+{
+ 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];
+
+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]\n",
+ enter_tick - last_exit_tick,
+ exit_tick - enter_tick,
+ event,
+ last_gc_status, current_gc_status);
+ last_exit_tick = exit_tick;
+#else
+ /* [enter_tick] [gc time] [event] */
+ fprintf(stderr, "%"PRItick"\t%"PRItick"\t%s\t[%s->%s]\n",
+ enter_tick,
+ exit_tick - enter_tick,
+ event,
+ last_gc_status, current_gc_status);
+#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 = 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? */
+}
+
+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;
+}
+
static void *
gc_with_gvl(void *ptr)
{
- return (void *)(VALUE)garbage_collect((rb_objspace_t *)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);
}
static int
-garbage_collect_with_gvl(rb_objspace_t *objspace)
+garbage_collect_with_gvl(rb_objspace_t *objspace, int full_mark, int immediate_mark, int immediate_sweep, int reason)
{
if (dont_gc) return TRUE;
if (ruby_thread_has_gvl_p()) {
- return garbage_collect(objspace);
+ return garbage_collect(objspace, full_mark, immediate_mark, immediate_sweep, reason);
}
else {
if (ruby_native_thread_p()) {
- return (int)(VALUE)rb_thread_call_with_gvl(gc_with_gvl, (void *)objspace);
+ struct objspace_and_reason oar;
+ 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);
}
else {
/* no ruby thread */
@@ -3076,7 +6032,7 @@ garbage_collect_with_gvl(rb_objspace_t *objspace)
int
rb_garbage_collect(void)
{
- return garbage_collect(&rb_objspace);
+ return garbage_collect(&rb_objspace, TRUE, TRUE, TRUE, GPR_FLAG_CAPI);
}
#undef Init_stack
@@ -3090,13 +6046,56 @@ Init_stack(volatile VALUE *addr)
/*
* call-seq:
* GC.start -> nil
- * gc.garbage_collect -> nil
- * ObjectSpace.garbage_collect -> nil
+ * GC.garbage_collect -> nil
+ * GC.start(full_mark: true, immediate_sweep: true) -> nil
+ * GC.garbage_collect(full_mark: true, immediate_sweep: true) -> 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)
{
@@ -3108,9 +6107,8 @@ void
rb_gc(void)
{
rb_objspace_t *objspace = &rb_objspace;
- garbage_collect(objspace);
+ garbage_collect(objspace, TRUE, TRUE, TRUE, GPR_FLAG_CAPI);
if (!finalizing) finalize_deferred(objspace);
- free_unused_heaps(objspace);
}
int
@@ -3120,6 +6118,29 @@ rb_during_gc(void)
return during_gc;
}
+#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)
+{
+ VALUE result = rb_hash_new();
+ int i;
+ for (i=0; i<T_MASK; i++) {
+ const char *type = type_name(i, 0);
+ rb_hash_aset(result, ID2SYM(rb_intern(type)), SIZET2NUM(types[i]));
+ }
+ rb_hash_aset(hash, ID2SYM(rb_intern(name)), result);
+}
+#endif
+
+size_t
+rb_gc_count(void)
+{
+ return rb_objspace.profile.count;
+}
+
/*
* call-seq:
* GC.count -> Integer
@@ -3133,28 +6154,307 @@ rb_during_gc(void)
static VALUE
gc_count(VALUE self)
{
- return UINT2NUM(rb_objspace.count);
+ return SIZET2NUM(rb_gc_count());
+}
+
+static VALUE
+gc_info_decode(int flags, VALUE hash_or_key)
+{
+ static VALUE sym_major_by = Qnil, sym_gc_by, sym_immediate_sweep, sym_have_finalizer;
+ 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;
+ VALUE hash = Qnil, key = Qnil;
+ VALUE major_by;
+
+ 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(stress);
+ S(nofree);
+ S(oldgen);
+ S(shady);
+ S(force);
+#if RGENGC_ESTIMATE_OLDMALLOC
+ S(oldmalloc);
+#endif
+ S(newobj);
+ S(malloc);
+ S(method);
+ S(capi);
+#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);
+#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->profile.latest_gc_info, key);
+}
+
+/*
+ * call-seq:
+ * GC.latest_gc_info -> {:gc_by=>:newobj}
+ * GC.latest_gc_info(hash) -> hash
+ * GC.latest_gc_info(:major_by) -> :malloc
+ *
+ * Returns information about the most recent garbage collection.
+ */
+
+static VALUE
+gc_latest_gc_info(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->profile.latest_gc_info, arg);
+}
+
+size_t
+gc_stat_internal(VALUE hash_or_sym)
+{
+ static VALUE sym_count;
+ static VALUE sym_heap_allocated_pages, sym_heap_sorted_length, sym_heap_allocatable_pages;
+ static VALUE sym_heap_available_slots, sym_heap_live_slots, sym_heap_free_slots, sym_heap_final_slots;
+ static VALUE sym_heap_marked_slots, sym_heap_swept_slots;
+ static VALUE sym_heap_eden_pages, sym_heap_tomb_pages;
+ static VALUE sym_total_allocated_pages, sym_total_freed_pages;
+ static VALUE sym_total_allocated_objects, sym_total_freed_objects;
+ static VALUE sym_malloc_increase_bytes, sym_malloc_increase_bytes_limit;
+#if USE_RGENGC
+ static VALUE sym_minor_gc_count, sym_major_gc_count;
+ static VALUE sym_remembered_wb_unprotected_objects, sym_remembered_wb_unprotected_objects_limit;
+ static VALUE sym_old_objects, sym_old_objects_limit;
+#if RGENGC_ESTIMATE_OLDMALLOC
+ static VALUE sym_oldmalloc_increase_bytes, sym_oldmalloc_increase_bytes_limit;
+#endif
+#if RGENGC_PROFILE
+ static VALUE sym_total_generated_normal_object_count, sym_total_generated_shady_object_count;
+ static VALUE sym_total_shade_operation_count, sym_total_promoted_count;
+ static VALUE sym_total_remembered_normal_object_count, sym_total_remembered_shady_object_count;
+#endif /* RGENGC_PROFILE */
+#endif /* USE_RGENGC */
+
+ rb_objspace_t *objspace = &rb_objspace;
+ VALUE hash = Qnil, key = Qnil;
+
+ if (RB_TYPE_P(hash_or_sym, T_HASH)) {
+ hash = hash_or_sym;
+ }
+ else if (SYMBOL_P(hash_or_sym)) {
+ key = hash_or_sym;
+ }
+ else {
+ rb_raise(rb_eTypeError, "non-hash or symbol argument");
+ }
+
+ 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);
+#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 */
+#endif /* USE_RGENGC */
+#undef S
+ }
+
+#define SET(name, attr) \
+ if (key == sym_##name) \
+ return attr; \
+ else if (hash != Qnil) \
+ rb_hash_aset(hash, sym_##name, SIZET2NUM(attr));
+
+ SET(count, objspace->profile.count);
+
+ /* 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);
+#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.remembered_wb_unprotected_objects);
+ SET(remembered_wb_unprotected_objects_limit, objspace->rgengc.remembered_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
+
+#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 */
+ rb_raise(rb_eArgError, "unknown key: %"PRIsVALUE, rb_sym2str(key));
+ }
+
+#if defined(RGENGC_PROFILE) && RGENGC_PROFILE >= 2
+ if (hash != Qnil) {
+ 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, "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
+
+ 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_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
- * }
+ * {
+ * :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.
@@ -3166,52 +6466,41 @@ gc_count(VALUE self)
static VALUE
gc_stat(int argc, VALUE *argv, VALUE self)
{
- rb_objspace_t *objspace = &rb_objspace;
- 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 (sym_count == 0) {
- sym_count = ID2SYM(rb_intern_const("count"));
- sym_heap_used = ID2SYM(rb_intern_const("heap_used"));
- sym_heap_length = ID2SYM(rb_intern_const("heap_length"));
- sym_heap_increment = ID2SYM(rb_intern_const("heap_increment"));
- sym_heap_live_num = ID2SYM(rb_intern_const("heap_live_num"));
- sym_heap_free_num = ID2SYM(rb_intern_const("heap_free_num"));
- sym_heap_final_num = ID2SYM(rb_intern_const("heap_final_num"));
- sym_total_allocated_object = ID2SYM(rb_intern_const("total_allocated_object"));
- sym_total_freed_object = ID2SYM(rb_intern_const("total_freed_object"));
- }
+ VALUE arg = Qnil;
- if (rb_scan_args(argc, argv, "01", &hash) == 1) {
- if (!RB_TYPE_P(hash, T_HASH))
- rb_raise(rb_eTypeError, "non-hash given");
+ 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 (hash == Qnil) {
- hash = rb_hash_new();
+ if (arg == Qnil) {
+ arg = rb_hash_new();
}
+ gc_stat_internal(arg);
+ return arg;
+}
- rest_sweep(objspace);
-
- rb_hash_aset(hash, sym_count, SIZET2NUM(objspace->count));
- /* implementation dependent counters */
- rb_hash_aset(hash, sym_heap_used, SIZET2NUM(objspace->heap.used));
- rb_hash_aset(hash, sym_heap_length, SIZET2NUM(objspace->heap.length));
- rb_hash_aset(hash, sym_heap_increment, SIZET2NUM(objspace->heap.increment));
- rb_hash_aset(hash, sym_heap_live_num, SIZET2NUM(objspace_live_num(objspace)));
- rb_hash_aset(hash, sym_heap_free_num, SIZET2NUM(objspace->heap.free_num));
- rb_hash_aset(hash, sym_heap_final_num, SIZET2NUM(objspace->heap.final_num));
- rb_hash_aset(hash, sym_total_allocated_object, SIZET2NUM(objspace->total_allocated_object_num));
- rb_hash_aset(hash, sym_total_freed_object, SIZET2NUM(objspace->total_freed_object_num));
-
- return hash;
+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;
+ }
}
/*
* call-seq:
- * GC.stress -> true or false
+ * GC.stress -> fixnum, true or false
*
* Returns current status of GC stress mode.
*/
@@ -3220,12 +6509,19 @@ static VALUE
gc_stress_get(VALUE self)
{
rb_objspace_t *objspace = &rb_objspace;
- return ruby_gc_stress ? Qtrue : Qfalse;
+ 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;
}
/*
* call-seq:
- * GC.stress = bool -> bool
+ * GC.stress = flag -> flag
*
* Updates the GC stress mode.
*
@@ -3233,14 +6529,19 @@ gc_stress_get(VALUE self)
* 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(VALUE self, VALUE flag)
+gc_stress_set_m(VALUE self, VALUE flag)
{
rb_objspace_t *objspace = &rb_objspace;
rb_secure(2);
- ruby_gc_stress = RTEST(flag);
+ gc_stress_set(objspace, flag);
return flag;
}
@@ -3285,51 +6586,176 @@ rb_gc_disable(void)
rb_objspace_t *objspace = &rb_objspace;
int old = dont_gc;
- rest_sweep(objspace);
+ gc_rest(objspace);
dont_gc = TRUE;
return old ? Qtrue : Qfalse;
}
-void
-rb_gc_set_params(void)
+static int
+get_envparam_size(const char *name, size_t *default_value, size_t lower_bound)
{
- char *malloc_limit_ptr, *heap_min_slots_ptr, *free_min_ptr;
-
- if (rb_safe_level() > 0) return;
+ char *ptr = getenv(name);
+ ssize_t val;
- malloc_limit_ptr = getenv("RUBY_GC_MALLOC_LIMIT");
- if (malloc_limit_ptr != NULL) {
- int malloc_limit_i = atoi(malloc_limit_ptr);
- if (RTEST(ruby_verbose))
- fprintf(stderr, "malloc_limit=%d (%d)\n",
- malloc_limit_i, initial_malloc_limit);
- if (malloc_limit_i > 0) {
- initial_malloc_limit = malloc_limit_i;
+ 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;
+ 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;
}
}
+ return 0;
+}
- heap_min_slots_ptr = getenv("RUBY_HEAP_MIN_SLOTS");
- if (heap_min_slots_ptr != NULL) {
- int heap_min_slots_i = atoi(heap_min_slots_ptr);
- if (RTEST(ruby_verbose))
- fprintf(stderr, "heap_min_slots=%d (%d)\n",
- heap_min_slots_i, initial_heap_min_slots);
- if (heap_min_slots_i > 0) {
- initial_heap_min_slots = heap_min_slots_i;
- initial_expand_heap(&rb_objspace);
+static int
+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 (val > lower_bound) {
+ if (RTEST(ruby_verbose)) fprintf(stderr, "%s=%f (default value: %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);
}
}
+ return 0;
+}
- free_min_ptr = getenv("RUBY_FREE_MIN");
- if (free_min_ptr != NULL) {
- int free_min_i = atoi(free_min_ptr);
- if (RTEST(ruby_verbose))
- fprintf(stderr, "free_min=%d (%d)\n", free_min_i, initial_free_min);
- if (free_min_i > 0) {
- initial_free_min = free_min_i;
- }
+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 factor.
+ * * 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)
+{
+ if (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.");
+ }
+
+ /* 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_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);
+
+ 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_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
}
void
@@ -3337,21 +6763,52 @@ rb_objspace_reachable_objects_from(VALUE obj, void (func)(VALUE, void *), void *
{
rb_objspace_t *objspace = &rb_objspace;
- if (markable_object_p(objspace, obj)) {
+ if (is_markable_object(objspace, obj)) {
struct mark_func_data_struct mfd;
mfd.mark_func = func;
mfd.data = data;
- objspace->mark_func_data = &mfd;
+ PUSH_MARK_FUNC_DATA(&mfd);
gc_mark_children(objspace, obj);
- objspace->mark_func_data = 0;
+ POP_MARK_FUNC_DATA();
}
}
+struct root_objects_data {
+ const char *category;
+ void (*func)(const char *category, VALUE, void *);
+ void *data;
+};
+
+static void
+root_objects_from(VALUE obj, void *ptr)
+{
+ const struct root_objects_data *data = (struct root_objects_data *)ptr;
+ (*data->func)(data->category, obj, data->data);
+}
+
+void
+rb_objspace_reachable_objects_from_root(void (func)(const char *category, VALUE, void *), void *passing_data)
+{
+ rb_objspace_t *objspace = &rb_objspace;
+ struct root_objects_data data;
+ struct mark_func_data_struct mfd;
+
+ data.func = func;
+ data.data = passing_data;
+
+ mfd.mark_func = root_objects_from;
+ mfd.data = &data;
+
+ PUSH_MARK_FUNC_DATA(&mfd);
+ gc_mark_roots(objspace, &data.category);
+ POP_MARK_FUNC_DATA();
+}
+
/*
------------------------ Extended allocator ------------------------
*/
-static void vm_xfree(rb_objspace_t *objspace, void *ptr);
+static void objspace_xfree(rb_objspace_t *objspace, void *ptr, size_t size);
static void *
negative_size_allocation_error_with_gvl(void *ptr)
@@ -3406,8 +6863,12 @@ 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) && rb_safe_level() < 4)) {
+ rb_thread_raised_p(th, RAISED_NOMEMORY)) {
fprintf(stderr, "[FATAL] failed to allocate memory\n");
exit(EXIT_FAILURE);
}
@@ -3428,6 +6889,7 @@ aligned_malloc(size_t alignment, size_t size)
#if defined __MINGW32__
res = __mingw_aligned_malloc(size, alignment);
#elif defined _WIN32 && !defined __CYGWIN__
+ void *_aligned_malloc(size_t, size_t);
res = _aligned_malloc(size, alignment);
#elif defined(HAVE_POSIX_MEMALIGN)
if (posix_memalign(&res, alignment, size) == 0) {
@@ -3447,9 +6909,9 @@ aligned_malloc(size_t alignment, size_t size)
res = (void*)aligned;
#endif
-#if defined(_DEBUG) || defined(GC_DEBUG)
+#if defined(_DEBUG) || GC_DEBUG
/* alignment must be a power of 2 */
- assert((alignment - 1) & alignment == 0);
+ assert(((alignment - 1) & alignment) == 0);
assert(alignment % sizeof(void*) == 0);
#endif
return res;
@@ -3470,7 +6932,115 @@ aligned_free(void *ptr)
}
static inline size_t
-vm_malloc_prepare(rb_objspace_t *objspace, size_t size)
+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)
+{
+ 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;
+ }
+ garbage_collect_with_gvl(objspace, FALSE, TRUE, TRUE, 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.");
+ }
+#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);
+ }
+#endif
+ }
+ break;
+ case MEMOP_TYPE_REALLOC: /* ignore */ break;
+ }
+#endif
+}
+
+static inline size_t
+objspace_malloc_prepare(rb_objspace_t *objspace, size_t size)
{
if ((ssize_t)size < 0) {
negative_size_allocation_error("negative allocation size (or too big)");
@@ -3481,22 +7051,13 @@ vm_malloc_prepare(rb_objspace_t *objspace, size_t size)
size += sizeof(size_t);
#endif
- if ((ruby_gc_stress && !ruby_disable_gc_stress) ||
- (malloc_increase+size) > malloc_limit) {
- garbage_collect_with_gvl(objspace);
- }
-
return size;
}
static inline void *
-vm_malloc_fixup(rb_objspace_t *objspace, void *mem, size_t size)
+objspace_malloc_fixup(rb_objspace_t *objspace, void *mem, size_t size)
{
- ATOMIC_SIZE_ADD(malloc_increase, 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
@@ -3505,95 +7066,85 @@ vm_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) || \
+ (!garbage_collect_with_gvl(objspace, TRUE, TRUE, TRUE, GPR_FLAG_MALLOC) || /* full/immediate mark && immediate sweep */ \
!(alloc))) { \
ruby_memerror(); \
} \
} while (0)
static void *
-vm_xmalloc(rb_objspace_t *objspace, size_t size)
+objspace_xmalloc(rb_objspace_t *objspace, size_t size)
{
void *mem;
- size = vm_malloc_prepare(objspace, size);
+ size = objspace_malloc_prepare(objspace, size);
TRY_WITH_GC(mem = malloc(size));
- return vm_malloc_fixup(objspace, mem, 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);
}
static void *
-vm_xrealloc(rb_objspace_t *objspace, void *ptr, size_t size)
+objspace_xrealloc(rb_objspace_t *objspace, void *ptr, size_t new_size, size_t old_size)
{
void *mem;
-#if CALC_EXACT_MALLOC_SIZE
- size_t oldsize;
-#endif
- if ((ssize_t)size < 0) {
+ if ((ssize_t)new_size < 0) {
negative_size_allocation_error("negative re-allocation size");
}
- if (!ptr) return vm_xmalloc(objspace, size);
+ if (!ptr) return objspace_xmalloc(objspace, new_size);
/*
* The behavior of realloc(ptr, 0) is implementation defined.
* Therefore we don't use realloc(ptr, 0) for portability reason.
* see http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_400.htm
*/
- if (size == 0) {
- vm_xfree(objspace, ptr);
+ if (new_size == 0) {
+ objspace_xfree(objspace, ptr, old_size);
return 0;
}
- if (ruby_gc_stress && !ruby_disable_gc_stress)
- garbage_collect_with_gvl(objspace);
#if CALC_EXACT_MALLOC_SIZE
- size += sizeof(size_t);
+ new_size += sizeof(size_t);
ptr = (size_t *)ptr - 1;
- oldsize = ((size_t *)ptr)[0];
+ old_size = ((size_t *)ptr)[0];
#endif
- mem = realloc(ptr, size);
- if (!mem) {
- if (garbage_collect_with_gvl(objspace)) {
- mem = realloc(ptr, size);
- }
- if (!mem) {
- ruby_memerror();
- }
- }
- ATOMIC_SIZE_ADD(malloc_increase, size);
+ 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, size - oldsize);
- ((size_t *)mem)[0] = size;
+ ((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
-vm_xfree(rb_objspace_t *objspace, void *ptr)
+objspace_xfree(rb_objspace_t *objspace, void *ptr, size_t old_size)
{
#if CALC_EXACT_MALLOC_SIZE
- size_t size;
ptr = ((size_t *)ptr) - 1;
- size = ((size_t*)ptr)[0];
- if (size) {
- ATOMIC_SIZE_SUB(objspace->malloc_params.allocated_size, size);
- ATOMIC_SIZE_DEC(objspace->malloc_params.allocations);
- }
+ old_size = ((size_t*)ptr)[0];
#endif
+ old_size = objspace_malloc_size(objspace, ptr, old_size);
free(ptr);
+
+ objspace_malloc_increase(objspace, ptr, 0, old_size, MEMOP_TYPE_FREE);
}
void *
ruby_xmalloc(size_t size)
{
- return vm_xmalloc(&rb_objspace, size);
+ return objspace_xmalloc(&rb_objspace, size);
}
static inline size_t
@@ -3609,52 +7160,81 @@ xmalloc2_size(size_t n, size_t size)
void *
ruby_xmalloc2(size_t n, size_t size)
{
- return vm_xmalloc(&rb_objspace, xmalloc2_size(n, size));
+ return objspace_xmalloc(&rb_objspace, xmalloc2_size(n, size));
}
static void *
-vm_xcalloc(rb_objspace_t *objspace, size_t count, size_t elsize)
+objspace_xcalloc(rb_objspace_t *objspace, size_t count, size_t elsize)
{
void *mem;
size_t size;
size = xmalloc2_size(count, elsize);
- size = vm_malloc_prepare(objspace, size);
+ size = objspace_malloc_prepare(objspace, size);
TRY_WITH_GC(mem = calloc(1, size));
- return vm_malloc_fixup(objspace, mem, 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);
}
void *
ruby_xcalloc(size_t n, size_t size)
{
- return vm_xcalloc(&rb_objspace, n, size);
+ return objspace_xcalloc(&rb_objspace, n, size);
}
+#ifdef ruby_sized_xrealloc
+#undef ruby_sized_xrealloc
+#endif
void *
-ruby_xrealloc(void *ptr, size_t size)
+ruby_sized_xrealloc(void *ptr, size_t new_size, size_t old_size)
{
- return vm_xrealloc(&rb_objspace, ptr, size);
+ return objspace_xrealloc(&rb_objspace, ptr, new_size, old_size);
}
void *
-ruby_xrealloc2(void *ptr, size_t n, size_t size)
+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)
{
size_t len = size * n;
if (n != 0 && size != len / n) {
rb_raise(rb_eArgError, "realloc: possible integer overflow");
}
- return ruby_xrealloc(ptr, len);
+ return objspace_xrealloc(&rb_objspace, ptr, len, old_n * size);
+}
+
+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);
+ }
}
void
ruby_xfree(void *x)
{
- if (x)
- vm_xfree(&rb_objspace, x);
+ ruby_sized_xfree(x, 0);
}
-
/* Mimic ruby_xmalloc, but need not rb_objspace.
* should return pointer suitable for ruby_xfree
*/
@@ -3674,7 +7254,17 @@ ruby_mimmalloc(size_t size)
return mem;
}
+void
+ruby_mimfree(void *ptr)
+{
+ size_t *mem = (size_t *)ptr;
#if CALC_EXACT_MALLOC_SIZE
+ mem = mem - 1;
+#endif
+ free(mem);
+}
+
+#if MALLOC_ALLOCATED_SIZE
/*
* call-seq:
* GC.malloc_allocated_size -> Integer
@@ -3716,25 +7306,34 @@ 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)
{
- gc_mark_ptr((rb_objspace_t *)arg, (VALUE)val);
+ rb_objspace_t *objspace = (rb_objspace_t *)arg;
+ VALUE obj = (VALUE)val;
+ if (!is_live_object(objspace, obj)) return ST_DELETE;
return ST_CONTINUE;
}
+#endif
static void
wmap_mark(void *ptr)
{
struct weakmap *w = ptr;
- st_foreach(w->obj2wmap, wmap_mark_map, (st_data_t)&rb_objspace);
+#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)
{
- rb_ary_resize((VALUE)val, 0);
+ VALUE *ptr = (VALUE *)val;
+ ruby_sized_xfree(ptr, (ptr[0] + 1) * sizeof(VALUE));
return ST_CONTINUE;
}
@@ -3747,11 +7346,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)
{
- *(size_t *)arg += rb_ary_memsize((VALUE)val);
+ VALUE *ptr = (VALUE *)val;
+ *(size_t *)arg += (ptr[0] + 1) * sizeof(VALUE);
return ST_CONTINUE;
}
@@ -3774,7 +7373,8 @@ static const rb_data_type_t weakmap_type = {
wmap_mark,
wmap_free,
wmap_memsize,
- }
+ },
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
static VALUE
@@ -3791,11 +7391,23 @@ 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, ary;
+ VALUE wmap, *ptr, size, i, j;
if (!existing) return ST_STOP;
- wmap = (VALUE)arg, ary = (VALUE)*value;
- rb_ary_delete_same(ary, wmap);
- if (!RARRAY_LEN(ary)) return ST_DELETE;
+ 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, sizeof(VALUE), i);
+ ptr[0] = j;
+ *value = (st_data_t)ptr;
+ }
return ST_CONTINUE;
}
@@ -3803,8 +7415,7 @@ static VALUE
wmap_finalize(VALUE self, VALUE objid)
{
st_data_t orig, wmap, data;
- VALUE obj, rids;
- long i;
+ VALUE obj, *rids, i, size;
struct weakmap *w;
TypedData_Get_Struct(self, struct weakmap, &weakmap_type, w);
@@ -3814,11 +7425,13 @@ 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;
- for (i = 0; i < RARRAY_LEN(rids); ++i) {
- wmap = (st_data_t)RARRAY_PTR(rids)[i];
+ rids = (VALUE *)data;
+ size = *rids++;
+ for (i = 0; i < size; ++i) {
+ wmap = (st_data_t)rids[i];
st_delete(w->wmap2obj, &wmap, NULL);
}
+ ruby_sized_xfree((VALUE *)data, (size + 1) * sizeof(VALUE));
}
wmap = (st_data_t)obj;
@@ -3829,25 +7442,208 @@ wmap_finalize(VALUE self, VALUE objid)
return self;
}
-/* Creates a weak reference from the given key to the given value */
+struct wmap_iter_arg {
+ rb_objspace_t *objspace;
+ VALUE value;
+};
+
+static int
+wmap_inspect_i(st_data_t key, st_data_t val, st_data_t arg)
+{
+ VALUE str = (VALUE)arg;
+ VALUE k = (VALUE)key, v = (VALUE)val;
+
+ if (RSTRING_PTR(str)[0] == '#') {
+ rb_str_cat2(str, ", ");
+ }
+ else {
+ rb_str_cat2(str, ": ");
+ RSTRING_PTR(str)[0] = '#';
+ }
+ k = SPECIAL_CONST_P(k) ? rb_inspect(k) : rb_any_to_s(k);
+ rb_str_append(str, k);
+ rb_str_cat2(str, " => ");
+ v = SPECIAL_CONST_P(v) ? rb_inspect(v) : rb_any_to_s(v);
+ rb_str_append(str, v);
+ OBJ_INFECT(str, k);
+ OBJ_INFECT(str, v);
+
+ return ST_CONTINUE;
+}
+
static VALUE
-wmap_aset(VALUE self, VALUE wmap, VALUE orig)
+wmap_inspect(VALUE self)
{
- st_data_t data;
- VALUE rids;
+ VALUE str;
+ VALUE c = rb_class_name(CLASS_OF(self));
struct weakmap *w;
TypedData_Get_Struct(self, struct weakmap, &weakmap_type, w);
- rb_define_final(orig, w->final);
- rb_define_final(wmap, w->final);
- if (st_lookup(w->obj2wmap, (st_data_t)orig, &data)) {
- rids = (VALUE)data;
+ str = rb_sprintf("-<%"PRIsVALUE":%p", c, (void *)self);
+ if (w->wmap2obj) {
+ st_foreach(w->wmap2obj, wmap_inspect_i, str);
}
- else {
- rids = rb_ary_tmp_new(1);
- st_insert(w->obj2wmap, (st_data_t)orig, (st_data_t)rids);
+ RSTRING_PTR(str)[0] = '#';
+ rb_str_cat2(str, ">");
+ return str;
+}
+
+static int
+wmap_each_i(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_id_value(objspace, obj) && is_live_object(objspace, obj)) {
+ rb_yield_values(2, (VALUE)key, obj);
+ }
+ return ST_CONTINUE;
+}
+
+/* Iterates over keys and objects in a weakly referenced object */
+static VALUE
+wmap_each(VALUE self)
+{
+ struct weakmap *w;
+ rb_objspace_t *objspace = &rb_objspace;
+
+ TypedData_Get_Struct(self, struct weakmap, &weakmap_type, w);
+ st_foreach(w->wmap2obj, wmap_each_i, (st_data_t)objspace);
+ return self;
+}
+
+static int
+wmap_each_key_i(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_id_value(objspace, obj) && is_live_object(objspace, obj)) {
+ rb_yield((VALUE)key);
+ }
+ return ST_CONTINUE;
+}
+
+/* Iterates over keys and objects in a weakly referenced object */
+static VALUE
+wmap_each_key(VALUE self)
+{
+ struct weakmap *w;
+ rb_objspace_t *objspace = &rb_objspace;
+
+ TypedData_Get_Struct(self, struct weakmap, &weakmap_type, w);
+ st_foreach(w->wmap2obj, wmap_each_key_i, (st_data_t)objspace);
+ return self;
+}
+
+static int
+wmap_each_value_i(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_id_value(objspace, obj) && is_live_object(objspace, obj)) {
+ rb_yield(obj);
}
- rb_ary_push(rids, wmap);
+ return ST_CONTINUE;
+}
+
+/* Iterates over keys and objects in a weakly referenced object */
+static VALUE
+wmap_each_value(VALUE self)
+{
+ struct weakmap *w;
+ rb_objspace_t *objspace = &rb_objspace;
+
+ TypedData_Get_Struct(self, struct weakmap, &weakmap_type, w);
+ st_foreach(w->wmap2obj, wmap_each_value_i, (st_data_t)objspace);
+ return 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);
+ }
+ return ST_CONTINUE;
+}
+
+/* Iterates over keys and objects in a weakly referenced object */
+static VALUE
+wmap_keys(VALUE self)
+{
+ struct weakmap *w;
+ struct wmap_iter_arg args;
+
+ 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;
+}
+
+static int
+wmap_values_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, obj);
+ }
+ return ST_CONTINUE;
+}
+
+/* Iterates over values and objects in a weakly referenced object */
+static VALUE
+wmap_values(VALUE self)
+{
+ struct weakmap *w;
+ struct wmap_iter_arg args;
+
+ TypedData_Get_Struct(self, struct weakmap, &weakmap_type, w);
+ args.objspace = &rb_objspace;
+ args.value = rb_ary_new();
+ st_foreach(w->wmap2obj, wmap_values_i, (st_data_t)&args);
+ 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)
+{
+ 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);
st_insert(w->wmap2obj, (st_data_t)wmap, (st_data_t)orig);
return nonspecial_obj_id(orig);
}
@@ -3869,14 +7665,35 @@ wmap_aref(VALUE self, VALUE wmap)
return obj;
}
+/* Returns +true+ if +key+ is registered */
+static VALUE
+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 ------------------------------
*/
-static inline void gc_prof_set_heap_info(rb_objspace_t *, gc_profile_record *);
#define GC_PROFILE_RECORD_DEFAULT_SIZE 100
+/* return sec in user time */
static double
getrusage_time(void)
{
@@ -3906,25 +7723,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
@@ -3932,109 +7749,95 @@ getrusage_time(void)
}
static inline void
-gc_prof_timer_start(rb_objspace_t *objspace)
+gc_prof_setup_new_record(rb_objspace_t *objspace, int reason)
{
if (objspace->profile.run) {
- size_t count = objspace->profile.count;
+ size_t index = objspace->profile.next_index;
+ gc_profile_record *record;
- if (!objspace->profile.record) {
- objspace->profile.size = GC_PROFILE_RECORD_DEFAULT_SIZE;
- objspace->profile.record = malloc(sizeof(gc_profile_record) * objspace->profile.size);
- }
- if (count >= objspace->profile.size) {
- objspace->profile.size += 1000;
- objspace->profile.record = realloc(objspace->profile.record, sizeof(gc_profile_record) * objspace->profile.size);
- }
- if (!objspace->profile.record) {
- rb_bug("gc_profile malloc or realloc miss");
- }
- MEMZERO(&objspace->profile.record[count], gc_profile_record, 1);
- objspace->profile.record[count].gc_time = getrusage_time();
- objspace->profile.record[objspace->profile.count].gc_invoke_time =
- objspace->profile.record[count].gc_time - objspace->profile.invoke_time;
- }
-}
+ /* create new record */
+ objspace->profile.next_index++;
-static inline void
-gc_prof_timer_stop(rb_objspace_t *objspace, int marked)
-{
- if (objspace->profile.run) {
- double gc_time = 0;
- size_t count = objspace->profile.count;
- gc_profile_record *record = &objspace->profile.record[count];
+ if (!objspace->profile.records) {
+ objspace->profile.size = GC_PROFILE_RECORD_DEFAULT_SIZE;
+ objspace->profile.records = malloc(sizeof(gc_profile_record) * objspace->profile.size);
+ }
+ if (index >= objspace->profile.size) {
+ objspace->profile.size += 1000;
+ objspace->profile.records = realloc(objspace->profile.records, sizeof(gc_profile_record) * objspace->profile.size);
+ }
+ if (!objspace->profile.records) {
+ rb_bug("gc_profile malloc or realloc miss");
+ }
+ record = objspace->profile.current_record = &objspace->profile.records[objspace->profile.next_index - 1];
+ MEMZERO(record, gc_profile_record, 1);
- gc_time = getrusage_time() - record->gc_time;
- if (gc_time < 0) gc_time = 0;
- record->gc_time = gc_time;
- record->is_marked = !!(marked);
- gc_prof_set_heap_info(objspace, record);
- objspace->profile.count++;
+ /* setup before-GC parameter */
+ record->flags = reason | (ruby_gc_stressful ? GPR_FLAG_STRESS : 0);
+#if MALLOC_ALLOCATED_SIZE
+ record->allocated_size = malloc_allocated_size;
+#endif
+#if GC_PROFILE_DETAIL_MEMORY
+#ifdef RUSAGE_SELF
+ {
+ struct rusage usage;
+ if (getrusage(RUSAGE_SELF, &usage) == 0) {
+ record->maxrss = usage.ru_maxrss;
+ record->minflt = usage.ru_minflt;
+ record->majflt = usage.ru_majflt;
+ }
+ }
+#endif
+#endif
}
}
-#if !GC_PROFILE_MORE_DETAIL
-
static inline void
-gc_prof_mark_timer_start(rb_objspace_t *objspace)
+gc_prof_timer_start(rb_objspace_t *objspace)
{
- if (RUBY_DTRACE_GC_MARK_BEGIN_ENABLED()) {
- RUBY_DTRACE_GC_MARK_BEGIN();
+ if (gc_prof_enabled(objspace)) {
+ gc_profile_record *record = gc_prof_record(objspace);
+#if GC_PROFILE_MORE_DETAIL
+ record->prepare_time = objspace->profile.prepare_time;
+#endif
+ record->gc_time = 0;
+ record->gc_invoke_time = getrusage_time();
}
}
-static inline void
-gc_prof_mark_timer_stop(rb_objspace_t *objspace)
+static double
+elapsed_time_from(double time)
{
- if (RUBY_DTRACE_GC_MARK_END_ENABLED()) {
- RUBY_DTRACE_GC_MARK_END();
+ double now = getrusage_time();
+ if (now > time) {
+ return now - time;
}
-}
-
-static inline void
-gc_prof_sweep_timer_start(rb_objspace_t *objspace)
-{
- if (RUBY_DTRACE_GC_SWEEP_BEGIN_ENABLED()) {
- RUBY_DTRACE_GC_SWEEP_BEGIN();
+ else {
+ return 0;
}
}
static inline void
-gc_prof_sweep_timer_stop(rb_objspace_t *objspace)
+gc_prof_timer_stop(rb_objspace_t *objspace)
{
- if (RUBY_DTRACE_GC_SWEEP_END_ENABLED()) {
- RUBY_DTRACE_GC_SWEEP_END();
+ if (gc_prof_enabled(objspace)) {
+ 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;
}
}
static inline void
-gc_prof_set_malloc_info(rb_objspace_t *objspace)
-{
-}
-
-static inline void
-gc_prof_set_heap_info(rb_objspace_t *objspace, gc_profile_record *record)
-{
- size_t live = objspace_live_num(objspace);
- size_t total = heaps_used * HEAP_OBJ_LIMIT;
-
- record->heap_total_objects = total;
- record->heap_use_size = live * sizeof(RVALUE);
- record->heap_total_size = total * sizeof(RVALUE);
-}
-
-#else
-
-static inline void
gc_prof_mark_timer_start(rb_objspace_t *objspace)
{
if (RUBY_DTRACE_GC_MARK_BEGIN_ENABLED()) {
RUBY_DTRACE_GC_MARK_BEGIN();
}
- if (objspace->profile.run) {
- size_t count = objspace->profile.count;
-
- objspace->profile.record[count].gc_mark_time = getrusage_time();
+#if GC_PROFILE_MORE_DETAIL
+ if (gc_prof_enabled(objspace)) {
+ gc_prof_record(objspace)->gc_mark_time = getrusage_time();
}
+#endif
}
static inline void
@@ -4043,15 +7846,12 @@ gc_prof_mark_timer_stop(rb_objspace_t *objspace)
if (RUBY_DTRACE_GC_MARK_END_ENABLED()) {
RUBY_DTRACE_GC_MARK_END();
}
- if (objspace->profile.run) {
- double mark_time = 0;
- size_t count = objspace->profile.count;
- gc_profile_record *record = &objspace->profile.record[count];
-
- mark_time = getrusage_time() - record->gc_mark_time;
- if (mark_time < 0) mark_time = 0;
- record->gc_mark_time = mark_time;
+#if GC_PROFILE_MORE_DETAIL
+ if (gc_prof_enabled(objspace)) {
+ gc_profile_record *record = gc_prof_record(objspace);
+ record->gc_mark_time = elapsed_time_from(record->gc_mark_time);
}
+#endif
}
static inline void
@@ -4060,10 +7860,12 @@ gc_prof_sweep_timer_start(rb_objspace_t *objspace)
if (RUBY_DTRACE_GC_SWEEP_BEGIN_ENABLED()) {
RUBY_DTRACE_GC_SWEEP_BEGIN();
}
- if (objspace->profile.run) {
- size_t count = objspace->profile.count;
+ if (gc_prof_enabled(objspace)) {
+ gc_profile_record *record = gc_prof_record(objspace);
- objspace->profile.record[count].gc_sweep_time = getrusage_time();
+ if (record->gc_time > 0 || GC_PROFILE_MORE_DETAIL) {
+ objspace->profile.gc_sweep_start_time = getrusage_time();
+ }
}
}
@@ -4073,46 +7875,59 @@ gc_prof_sweep_timer_stop(rb_objspace_t *objspace)
if (RUBY_DTRACE_GC_SWEEP_END_ENABLED()) {
RUBY_DTRACE_GC_SWEEP_END();
}
- if (objspace->profile.run) {
- double sweep_time = 0;
- size_t count = objspace->profile.count;
- gc_profile_record *record = &objspace->profile.record[count];
- sweep_time = getrusage_time() - record->gc_sweep_time;\
- if (sweep_time < 0) sweep_time = 0;\
- record->gc_sweep_time = sweep_time;
+ if (gc_prof_enabled(objspace)) {
+ double sweep_time;
+ gc_profile_record *record = gc_prof_record(objspace);
+
+ if (record->gc_time > 0) {
+ sweep_time = elapsed_time_from(objspace->profile.gc_sweep_start_time);
+ /* need to accumulate GC time for lazy sweep after gc() */
+ record->gc_time += sweep_time;
+ }
+ else if (GC_PROFILE_MORE_DETAIL) {
+ sweep_time = elapsed_time_from(objspace->profile.gc_sweep_start_time);
+ }
+
+#if GC_PROFILE_MORE_DETAIL
+ 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;
}
}
static inline void
gc_prof_set_malloc_info(rb_objspace_t *objspace)
{
- if (objspace->profile.run) {
- gc_profile_record *record = &objspace->profile.record[objspace->profile.count];
- if (record) {
- record->allocate_increase = malloc_increase;
- record->allocate_limit = malloc_limit;
- }
+#if GC_PROFILE_MORE_DETAIL
+ if (gc_prof_enabled(objspace)) {
+ gc_profile_record *record = gc_prof_record(objspace);
+ record->allocate_increase = malloc_increase;
+ record->allocate_limit = malloc_limit;
}
+#endif
}
static inline void
-gc_prof_set_heap_info(rb_objspace_t *objspace, gc_profile_record *record)
+gc_prof_set_heap_info(rb_objspace_t *objspace)
{
- size_t live = objspace_live_num(objspace);
- size_t total = heaps_used * HEAP_OBJ_LIMIT;
+ if (gc_prof_enabled(objspace)) {
+ 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 total = objspace->profile.heap_used_at_gc_start * HEAP_OBJ_LIMIT;
- record->heap_use_slots = heaps_used;
- record->heap_live_objects = live;
- record->heap_free_objects = total - live;
- record->heap_total_objects = total;
- record->have_finalize = deferred_final_list ? Qtrue : Qfalse;
- record->heap_use_size = live * sizeof(RVALUE);
- record->heap_total_size = total * sizeof(RVALUE);
-}
-
-#endif /* !GC_PROFILE_MORE_DETAIL */
+#if GC_PROFILE_MORE_DETAIL
+ record->heap_use_pages = objspace->profile.heap_used_at_gc_start;
+ record->heap_live_objects = live;
+ record->heap_free_objects = total - live;
+#endif
+ record->heap_total_objects = total;
+ record->heap_use_size = live * sizeof(RVALUE);
+ record->heap_total_size = total * sizeof(RVALUE);
+ }
+}
/*
* call-seq:
@@ -4126,16 +7941,16 @@ static VALUE
gc_profile_clear(void)
{
rb_objspace_t *objspace = &rb_objspace;
-
if (GC_PROFILE_RECORD_DEFAULT_SIZE * 2 < objspace->profile.size) {
objspace->profile.size = GC_PROFILE_RECORD_DEFAULT_SIZE * 2;
- objspace->profile.record = realloc(objspace->profile.record, sizeof(gc_profile_record) * objspace->profile.size);
- if (!objspace->profile.record) {
+ objspace->profile.records = realloc(objspace->profile.records, sizeof(gc_profile_record) * objspace->profile.size);
+ if (!objspace->profile.records) {
rb_memerror();
}
}
- MEMZERO(objspace->profile.record, gc_profile_record, objspace->profile.size);
- objspace->profile.count = 0;
+ MEMZERO(objspace->profile.records, gc_profile_record, objspace->profile.size);
+ objspace->profile.next_index = 0;
+ objspace->profile.current_record = 0;
return Qnil;
}
@@ -4182,7 +7997,7 @@ gc_profile_clear(void)
* +:GC_SWEEP_TIME+::
* +:ALLOCATE_INCREASE+::
* +:ALLOCATE_LIMIT+::
- * +:HEAP_USE_SLOTS+::
+ * +:HEAP_USE_PAGES+::
* +:HEAP_LIVE_OBJECTS+::
* +:HEAP_FREE_OBJECTS+::
* +:HAVE_FINALIZE+::
@@ -4201,23 +8016,36 @@ gc_profile_record_get(void)
return Qnil;
}
- for (i =0; i < objspace->profile.count; i++) {
+ for (i =0; i < objspace->profile.next_index; i++) {
+ gc_profile_record *record = &objspace->profile.records[i];
+
prof = rb_hash_new();
- rb_hash_aset(prof, ID2SYM(rb_intern("GC_TIME")), DBL2NUM(objspace->profile.record[i].gc_time));
- rb_hash_aset(prof, ID2SYM(rb_intern("GC_INVOKE_TIME")), DBL2NUM(objspace->profile.record[i].gc_invoke_time));
- rb_hash_aset(prof, ID2SYM(rb_intern("HEAP_USE_SIZE")), SIZET2NUM(objspace->profile.record[i].heap_use_size));
- rb_hash_aset(prof, ID2SYM(rb_intern("HEAP_TOTAL_SIZE")), SIZET2NUM(objspace->profile.record[i].heap_total_size));
- rb_hash_aset(prof, ID2SYM(rb_intern("HEAP_TOTAL_OBJECTS")), SIZET2NUM(objspace->profile.record[i].heap_total_objects));
- rb_hash_aset(prof, ID2SYM(rb_intern("GC_IS_MARKED")), objspace->profile.record[i].is_marked);
+ rb_hash_aset(prof, ID2SYM(rb_intern("GC_FLAGS")), gc_info_decode(record->flags, rb_hash_new()));
+ 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));
+ rb_hash_aset(prof, ID2SYM(rb_intern("HEAP_TOTAL_SIZE")), SIZET2NUM(record->heap_total_size));
+ rb_hash_aset(prof, ID2SYM(rb_intern("HEAP_TOTAL_OBJECTS")), SIZET2NUM(record->heap_total_objects));
+ rb_hash_aset(prof, ID2SYM(rb_intern("GC_IS_MARKED")), Qtrue);
#if GC_PROFILE_MORE_DETAIL
- rb_hash_aset(prof, ID2SYM(rb_intern("GC_MARK_TIME")), DBL2NUM(objspace->profile.record[i].gc_mark_time));
- rb_hash_aset(prof, ID2SYM(rb_intern("GC_SWEEP_TIME")), DBL2NUM(objspace->profile.record[i].gc_sweep_time));
- rb_hash_aset(prof, ID2SYM(rb_intern("ALLOCATE_INCREASE")), SIZET2NUM(objspace->profile.record[i].allocate_increase));
- rb_hash_aset(prof, ID2SYM(rb_intern("ALLOCATE_LIMIT")), SIZET2NUM(objspace->profile.record[i].allocate_limit));
- rb_hash_aset(prof, ID2SYM(rb_intern("HEAP_USE_SLOTS")), SIZET2NUM(objspace->profile.record[i].heap_use_slots));
- rb_hash_aset(prof, ID2SYM(rb_intern("HEAP_LIVE_OBJECTS")), SIZET2NUM(objspace->profile.record[i].heap_live_objects));
- rb_hash_aset(prof, ID2SYM(rb_intern("HEAP_FREE_OBJECTS")), SIZET2NUM(objspace->profile.record[i].heap_free_objects));
- rb_hash_aset(prof, ID2SYM(rb_intern("HAVE_FINALIZE")), objspace->profile.record[i].have_finalize);
+ rb_hash_aset(prof, ID2SYM(rb_intern("GC_MARK_TIME")), DBL2NUM(record->gc_mark_time));
+ rb_hash_aset(prof, ID2SYM(rb_intern("GC_SWEEP_TIME")), DBL2NUM(record->gc_sweep_time));
+ rb_hash_aset(prof, ID2SYM(rb_intern("ALLOCATE_INCREASE")), SIZET2NUM(record->allocate_increase));
+ rb_hash_aset(prof, ID2SYM(rb_intern("ALLOCATE_LIMIT")), SIZET2NUM(record->allocate_limit));
+ rb_hash_aset(prof, ID2SYM(rb_intern("HEAP_USE_PAGES")), SIZET2NUM(record->heap_use_pages));
+ rb_hash_aset(prof, ID2SYM(rb_intern("HEAP_LIVE_OBJECTS")), SIZET2NUM(record->heap_live_objects));
+ rb_hash_aset(prof, ID2SYM(rb_intern("HEAP_FREE_OBJECTS")), SIZET2NUM(record->heap_free_objects));
+
+ rb_hash_aset(prof, ID2SYM(rb_intern("REMOVING_OBJECTS")), SIZET2NUM(record->removing_objects));
+ rb_hash_aset(prof, ID2SYM(rb_intern("EMPTY_OBJECTS")), SIZET2NUM(record->empty_objects));
+
+ rb_hash_aset(prof, ID2SYM(rb_intern("HAVE_FINALIZE")), (record->flags & GPR_FLAG_HAVE_FINALIZE) ? Qtrue : Qfalse);
+#endif
+
+#if RGENGC_PROFILE > 0
+ rb_hash_aset(prof, ID2SYM(rb_intern("OLD_OBJECTS")), SIZET2NUM(record->old_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);
}
@@ -4225,41 +8053,130 @@ 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.count;
+ size_t count = objspace->profile.next_index;
+#ifdef MAJOR_REASON_MAX
+ char reason_str[MAJOR_REASON_MAX];
+#endif
- if (objspace->profile.run && count) {
- int index = 1;
+ if (objspace->profile.run && count /* > 1 */) {
size_t i;
- gc_profile_record r;
- append(out, rb_sprintf("GC %"PRIuSIZE" invokes.\n", objspace->count));
+ const gc_profile_record *record;
+
+ append(out, rb_sprintf("GC %"PRIuSIZE" invokes.\n", objspace->profile.count));
append(out, rb_str_new_cstr("Index Invoke Time(sec) Use Size(byte) Total Size(byte) Total Object GC Time(ms)\n"));
+
for (i = 0; i < count; i++) {
- r = objspace->profile.record[i];
-#if !GC_PROFILE_MORE_DETAIL
- if (r.is_marked) {
-#endif
- append(out, rb_sprintf("%5d %19.3f %20"PRIuSIZE" %20"PRIuSIZE" %20"PRIuSIZE" %30.20f\n",
- index++, r.gc_invoke_time, r.heap_use_size,
- r.heap_total_size, r.heap_total_objects, r.gc_time*1000));
-#if !GC_PROFILE_MORE_DETAIL
- }
-#endif
+ record = &objspace->profile.records[i];
+ append(out, rb_sprintf("%5"PRIdSIZE" %19.3f %20"PRIuSIZE" %20"PRIuSIZE" %20"PRIuSIZE" %30.20f\n",
+ i+1, record->gc_invoke_time, record->heap_use_size,
+ record->heap_total_size, record->heap_total_objects, record->gc_time*1000));
}
+
#if GC_PROFILE_MORE_DETAIL
append(out, rb_str_new_cstr("\n\n" \
- "More detail.\n" \
- "Index Allocate Increase Allocate Limit Use Slot Have Finalize Mark Time(ms) Sweep Time(ms)\n"));
- index = 1;
+ "More detail.\n" \
+ "Prepare Time = Previously GC's rest sweep time\n"
+ "Index Flags Allocate Inc. Allocate Limit"
+#if CALC_EXACT_MALLOC_SIZE
+ " Allocated Size"
+#endif
+ " Use Page Mark Time(ms) Sweep Time(ms) Prepare Time(ms) LivingObj FreeObj RemovedObj EmptyObj"
+#if RGENGC_PROFILE
+ " OldgenObj RemNormObj RemShadObj"
+#endif
+#if GC_PROFILE_DETAIL_MEMORY
+ " MaxRSS(KB) MinorFLT MajorFLT"
+#endif
+ "\n"));
+
for (i = 0; i < count; i++) {
- r = objspace->profile.record[i];
- append(out, rb_sprintf("%5d %17"PRIuSIZE" %17"PRIuSIZE" %9"PRIuSIZE" %14s %25.20f %25.20f\n",
- index++, r.allocate_increase, r.allocate_limit,
- r.heap_use_slots, (r.have_finalize ? "true" : "false"),
- r.gc_mark_time*1000, r.gc_sweep_time*1000));
+ record = &objspace->profile.records[i];
+ append(out, rb_sprintf("%5"PRIdSIZE" %4s/%c/%6s%c %13"PRIuSIZE" %15"PRIuSIZE
+#if CALC_EXACT_MALLOC_SIZE
+ " %15"PRIuSIZE
+#endif
+ " %9"PRIuSIZE" %17.12f %17.12f %17.12f %10"PRIuSIZE" %10"PRIuSIZE" %10"PRIuSIZE" %10"PRIuSIZE
+#if RGENGC_PROFILE
+ "%10"PRIuSIZE" %10"PRIuSIZE" %10"PRIuSIZE
+#endif
+#if GC_PROFILE_DETAIL_MEMORY
+ "%11ld %8ld %8ld"
+#endif
+
+ "\n",
+ i+1,
+ gc_profile_dump_major_reason(record->flags, reason_str),
+ (record->flags & GPR_FLAG_HAVE_FINALIZE) ? 'F' : '.',
+ (record->flags & GPR_FLAG_NEWOBJ) ? "NEWOBJ" :
+ (record->flags & GPR_FLAG_MALLOC) ? "MALLOC" :
+ (record->flags & GPR_FLAG_METHOD) ? "METHOD" :
+ (record->flags & GPR_FLAG_CAPI) ? "CAPI__" : "??????",
+ (record->flags & GPR_FLAG_STRESS) ? '!' : ' ',
+ record->allocate_increase, record->allocate_limit,
+#if CALC_EXACT_MALLOC_SIZE
+ record->allocated_size,
+#endif
+ record->heap_use_pages,
+ record->gc_mark_time*1000,
+ record->gc_sweep_time*1000,
+ record->prepare_time*1000,
+
+ record->heap_live_objects,
+ record->heap_free_objects,
+ record->removing_objects,
+ record->empty_objects
+#if RGENGC_PROFILE
+ ,
+ record->old_objects,
+ record->remembered_normal_objects,
+ record->remembered_shady_objects
+#endif
+#if GC_PROFILE_DETAIL_MEMORY
+ ,
+ record->maxrss / 1024,
+ record->minflt,
+ record->majflt
+#endif
+
+ ));
}
#endif
}
@@ -4321,11 +8238,13 @@ gc_profile_total_time(VALUE self)
{
double time = 0;
rb_objspace_t *objspace = &rb_objspace;
- size_t i;
- if (objspace->profile.run && objspace->profile.count) {
- for (i = 0; i < objspace->profile.count; i++) {
- time += objspace->profile.record[i].gc_time;
+ if (objspace->profile.run && objspace->profile.next_index > 0) {
+ size_t i;
+ size_t count = objspace->profile.next_index;
+
+ for (i = 0; i < count; i++) {
+ time += objspace->profile.records[i].gc_time;
}
}
return DBL2NUM(time);
@@ -4357,8 +8276,8 @@ static VALUE
gc_profile_enable(void)
{
rb_objspace_t *objspace = &rb_objspace;
-
objspace->profile.run = TRUE;
+ objspace->profile.current_record = 0;
return Qnil;
}
@@ -4376,20 +8295,148 @@ gc_profile_disable(void)
rb_objspace_t *objspace = &rb_objspace;
objspace->profile.run = FALSE;
+ objspace->profile.current_record = 0;
return Qnil;
}
-#ifdef GC_DEBUG
-
/*
------------------------------ DEBUG ------------------------------
*/
+static const char *
+type_name(int type, VALUE obj)
+{
+ switch (type) {
+#define TYPE_NAME(t) case (t): return #t;
+ TYPE_NAME(T_NONE);
+ TYPE_NAME(T_OBJECT);
+ TYPE_NAME(T_CLASS);
+ TYPE_NAME(T_MODULE);
+ TYPE_NAME(T_FLOAT);
+ TYPE_NAME(T_STRING);
+ TYPE_NAME(T_REGEXP);
+ TYPE_NAME(T_ARRAY);
+ TYPE_NAME(T_HASH);
+ TYPE_NAME(T_STRUCT);
+ TYPE_NAME(T_BIGNUM);
+ TYPE_NAME(T_FILE);
+ TYPE_NAME(T_MATCH);
+ TYPE_NAME(T_COMPLEX);
+ TYPE_NAME(T_RATIONAL);
+ TYPE_NAME(T_NIL);
+ TYPE_NAME(T_TRUE);
+ TYPE_NAME(T_FALSE);
+ TYPE_NAME(T_SYMBOL);
+ TYPE_NAME(T_FIXNUM);
+ TYPE_NAME(T_UNDEF);
+ TYPE_NAME(T_NODE);
+ TYPE_NAME(T_ICLASS);
+ TYPE_NAME(T_ZOMBIE);
+ case T_DATA:
+ if (obj && rb_objspace_data_type_name(obj)) {
+ return rb_objspace_data_type_name(obj);
+ }
+ return "T_DATA";
+#undef TYPE_NAME
+ }
+ return "unknown";
+}
+
+static const char *
+obj_type_name(VALUE obj)
+{
+ return type_name(TYPE(obj), obj);
+}
+
+#if RGENGC_DEBUG || RGENGC_CHECK_MODE
+#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];
+
+/* 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)
+
+static const char *
+obj_info(VALUE obj)
+{
+ int index = obj_info_buffers_index++;
+ char *buff = &obj_info_buffers[index][0];
+ int age = RVALUE_FLAGS_AGE(RBASIC(obj)->flags);
+
+ if (obj_info_buffers_index >= OBJ_INFO_BUFFERS_NUM) {
+ obj_info_buffers_index = 0;
+ }
+
+#define TF(c) ((c) != 0 ? "true" : "false")
+#define C(c, s) ((c) != 0 ? (s) : " ")
+ snprintf(buff, OBJ_INFO_BUFFERS_SIZE, "%p [%d%s%s%s%s] %s",
+ (void *)obj, age,
+ C(RVALUE_LONG_LIVED_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));
+
+#ifdef HAVE_VA_ARGS_MACRO
+ switch (BUILTIN_TYPE(obj)) {
+ case T_ARRAY:
+ snprintf(buff, OBJ_INFO_BUFFERS_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_CLASS: {
+ VALUE class_path = rb_class_path_cached(obj);
+ if (!NIL_P(class_path)) {
+ snprintf(buff, OBJ_INFO_BUFFERS_SIZE, "%s %s", buff, RSTRING_PTR(class_path));
+ }
+ break;
+ }
+ case T_DATA: {
+ const char *type_name = rb_objspace_data_type_name(obj);
+ if (type_name && strcmp(type_name, "iseq") == 0) {
+ rb_iseq_t *iseq;
+ GetISeqPtr(obj, iseq);
+ if (iseq->location.label) {
+ snprintf(buff, OBJ_INFO_BUFFERS_SIZE, "%s %s@%s:%d", buff,
+ RSTRING_PTR(iseq->location.label), RSTRING_PTR(iseq->location.path), (int)iseq->location.first_lineno);
+ }
+ }
+ break;
+ }
+ default:
+ break;
+ }
+#endif
+#undef TF
+#undef C
+
+ return buff;
+}
+
+#else
+static const char *
+obj_info(VALUE obj)
+{
+ return obj_type_name(obj);
+}
+#endif
+
+#if GC_DEBUG
+
void
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);
+
if (is_pointer_to_heap(objspace, (void *)obj)) {
fprintf(stderr, "pointer to heap?: true\n");
}
@@ -4397,12 +8444,18 @@ rb_gcdebug_print_obj_condition(VALUE obj)
fprintf(stderr, "pointer to heap?: false\n");
return;
}
- fprintf(stderr, "marked?: %s\n",
- MARKED_IN_BITMAP(GET_HEAP_BITMAP(obj), obj) ? "true" : "false");
- if (is_lazy_sweeping(objspace)) {
+
+ 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", MARKED_IN_BITMAP(GET_HEAP_REMEMBERSET_BITS(obj), obj) ? "true" : "false");
+#endif
+
+ if (is_lazy_sweeping(heap_eden)) {
fprintf(stderr, "lazy sweeping?: true\n");
- fprintf(stderr, "swept?: %s\n",
- is_swept_object(objspace, obj) ? "done" : "not yet");
+ fprintf(stderr, "swept?: %s\n", is_swept_object(objspace, obj) ? "done" : "not yet");
}
else {
fprintf(stderr, "lazy sweeping?: false\n");
@@ -4410,7 +8463,7 @@ rb_gcdebug_print_obj_condition(VALUE obj)
}
static VALUE
-gcdebug_sential(VALUE obj, VALUE name)
+gcdebug_sentinel(VALUE obj, VALUE name)
{
fprintf(stderr, "WARNING: object %s(%p) is inadvertently collected\n", (char *)name, (void *)obj);
return Qnil;
@@ -4419,13 +8472,13 @@ gcdebug_sential(VALUE obj, VALUE name)
void
rb_gcdebug_sentinel(VALUE obj, const char *name)
{
- rb_define_final(obj, rb_proc_new(gcdebug_sential, (VALUE)name));
+ rb_define_finalizer(obj, rb_proc_new(gcdebug_sentinel, (VALUE)name));
}
-#endif /* GC_DEBUG */
+#endif /* GC_DEBUG */
/*
- * Document-class: ObjectSpace
+ * Document-module: ObjectSpace
*
* The ObjectSpace module contains a number of routines
* that interact with the garbage collection facility and allow you to
@@ -4435,22 +8488,16 @@ rb_gcdebug_sentinel(VALUE obj, const char *name)
* called when a specific object is about to be destroyed by garbage
* collection.
*
- * include ObjectSpace
- *
* a = "A"
* b = "B"
- * c = "C"
*
- * define_finalizer(a, proc {|id| puts "Finalizer one on #{id}" })
- * define_finalizer(a, proc {|id| puts "Finalizer two on #{id}" })
- * define_finalizer(b, proc {|id| puts "Finalizer three on #{id}" })
+ * ObjectSpace.define_finalizer(a, proc {|id| puts "Finalizer one on #{id}" })
+ * ObjectSpace.define_finalizer(b, proc {|id| puts "Finalizer two on #{id}" })
*
* _produces:_
*
- * Finalizer three on 537763470
+ * Finalizer two on 537763470
* Finalizer one on 537763480
- * Finalizer two on 537763480
- *
*/
/*
@@ -4495,18 +8542,29 @@ rb_gcdebug_sentinel(VALUE obj, const char *name)
void
Init_GC(void)
{
- VALUE rb_mObSpace;
+#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", rb_gc_start, 0);
+ rb_define_singleton_method(rb_mGC, "start", gc_start_internal, -1);
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, 1);
+ rb_define_singleton_method(rb_mGC, "stress=", gc_stress_set_m, 1);
rb_define_singleton_method(rb_mGC, "count", gc_count, 0);
rb_define_singleton_method(rb_mGC, "stat", gc_stat, -1);
- rb_define_method(rb_mGC, "garbage_collect", rb_gc_start, 0);
+ 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_mProfiler = rb_define_module_under(rb_mGC, "Profiler");
rb_define_singleton_method(rb_mProfiler, "enabled?", gc_profile_enable_get, 0);
@@ -4518,35 +8576,68 @@ Init_GC(void)
rb_define_singleton_method(rb_mProfiler, "report", gc_profile_report, -1);
rb_define_singleton_method(rb_mProfiler, "total_time", gc_profile_total_time, 0);
- rb_mObSpace = rb_define_module("ObjectSpace");
- rb_define_module_function(rb_mObSpace, "each_object", os_each_obj, -1);
- rb_define_module_function(rb_mObSpace, "garbage_collect", rb_gc_start, 0);
+ 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_mObSpace, "define_finalizer", define_final, -1);
- rb_define_module_function(rb_mObSpace, "undefine_finalizer", undefine_final, 1);
+ 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_mObSpace, "_id2ref", id2ref, 1);
+ rb_define_module_function(rb_mObjSpace, "_id2ref", id2ref, 1);
- 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_vm_register_special_exception(ruby_error_nomemory, rb_eNoMemError, "failed to allocate memory");
rb_define_method(rb_cBasicObject, "__id__", rb_obj_id, 0);
rb_define_method(rb_mKernel, "object_id", rb_obj_id, 0);
- rb_define_module_function(rb_mObSpace, "count_objects", count_objects, -1);
+ rb_define_module_function(rb_mObjSpace, "count_objects", count_objects, -1);
{
- VALUE rb_cWeakMap = rb_define_class_under(rb_mObSpace, "WeakMap", rb_cObject);
+ VALUE rb_cWeakMap = rb_define_class_under(rb_mObjSpace, "WeakMap", rb_cObject);
rb_define_alloc_func(rb_cWeakMap, wmap_allocate);
rb_define_method(rb_cWeakMap, "[]=", wmap_aset, 2);
rb_define_method(rb_cWeakMap, "[]", wmap_aref, 1);
+ rb_define_method(rb_cWeakMap, "include?", wmap_has_key, 1);
+ rb_define_method(rb_cWeakMap, "member?", wmap_has_key, 1);
+ rb_define_method(rb_cWeakMap, "key?", wmap_has_key, 1);
+ rb_define_method(rb_cWeakMap, "inspect", wmap_inspect, 0);
+ rb_define_method(rb_cWeakMap, "each", wmap_each, 0);
+ rb_define_method(rb_cWeakMap, "each_pair", wmap_each, 0);
+ rb_define_method(rb_cWeakMap, "each_key", wmap_each_key, 0);
+ 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);
}
-#if CALC_EXACT_MALLOC_SIZE
+ /* internal methods */
+ rb_define_singleton_method(rb_mGC, "verify_internal_consistency", gc_verify_internal_consistency, 0);
+#if MALLOC_ALLOCATED_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
+
+ /* ::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_new(#o, strlen(#o)))
+ OPT(GC_DEBUG);
+ OPT(USE_RGENGC);
+ OPT(RGENGC_DEBUG);
+ OPT(RGENGC_CHECK_MODE);
+ OPT(RGENGC_PROFILE);
+ OPT(RGENGC_ESTIMATE_OLDMALLOC);
+ 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(GC_PROFILE_DETAIL_MEMORY);
+#undef OPT
+ OBJ_FREEZE(opts);
+ }
}
diff --git a/gc.h b/gc.h
index 10f634e346..2ba46c9250 100644
--- a/gc.h
+++ b/gc.h
@@ -2,10 +2,10 @@
#ifndef RUBY_GC_H
#define RUBY_GC_H 1
-#if defined(__x86_64__) && defined(__GNUC__) && !defined(__native_client__)
-#define SET_MACHINE_STACK_END(p) __asm__ volatile ("movq\t%%rsp, %0" : "=r" (*(p)))
+#if defined(__x86_64__) && !defined(_ILP32) && defined(__GNUC__) && !defined(__native_client__)
+#define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("movq\t%%rsp, %0" : "=r" (*(p)))
#elif defined(__i386) && defined(__GNUC__) && !defined(__native_client__)
-#define SET_MACHINE_STACK_END(p) __asm__ volatile ("movl\t%%esp, %0" : "=r" (*(p)))
+#define SET_MACHINE_STACK_END(p) __asm__ __volatile__ ("movl\t%%esp, %0" : "=r" (*(p)))
#else
NOINLINE(void rb_gc_set_stack_end(VALUE **stack_end_p));
#define SET_MACHINE_STACK_END(p) rb_gc_set_stack_end(p)
@@ -83,22 +83,25 @@ int ruby_get_stack_grow_direction(volatile VALUE *addr);
#endif
#define IS_STACK_DIR_UPPER() STACK_DIR_UPPER(1,0)
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
+RUBY_SYMBOL_EXPORT_BEGIN
/* exports for objspace module */
size_t rb_objspace_data_type_memsize(VALUE obj);
void rb_objspace_reachable_objects_from(VALUE obj, void (func)(VALUE, void *), void *data);
+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);
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
-#endif
+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/gems/bundled_gems b/gems/bundled_gems
new file mode 100644
index 0000000000..54d84c87ba
--- /dev/null
+++ b/gems/bundled_gems
@@ -0,0 +1,3 @@
+power_assert 0.1.3
+test-unit 3.0.1
+minitest 5.4.1
diff --git a/golf_prelude.rb b/golf_prelude.rb
index b090503213..8034601287 100644
--- a/golf_prelude.rb
+++ b/golf_prelude.rb
@@ -1,7 +1,8 @@
class Object
@@golf_hash = {}
+
def method_missing m, *a, &b
- t = @@golf_hash[ [m,self.class] ] ||= matching_methods(m)[0]
+ t = @@golf_hash[ [m, self.class] ] ||= matching_methods(m)[0]
if t && b
__send__(t, *a) {|*args|
b.binding.eval("proc{|golf_matchdata| $~ = golf_matchdata }").call($~) if $~
@@ -12,27 +13,27 @@ class Object
end
end
- def matching_methods(s='', m=callable_methods)
- r=/^#{s.to_s.gsub(/./){"(.*?)"+Regexp.escape($&)}}/
+ def matching_methods(s = '', m = callable_methods)
+ r = /^#{s.to_s.gsub(/./){"(.*?)" + Regexp.escape($&)}}/
m.grep(r).sort_by do |i|
i.to_s.match(r).captures.map(&:size) << i
end
end
def self.const_missing c
- t = @@golf_hash[ [c,self.class] ] ||= matching_methods(c,constants)[0]
+ t = @@golf_hash[ [c,self.class] ] ||= matching_methods(c, constants)[0]
t and return const_get(t)
raise NameError, "uninitialized constant #{c}", caller(1)
end
- def shortest_abbreviation(s='', m=callable_methods)
- s=s.to_s
- our_case = (?A..?Z)===s[0]
+ def shortest_abbreviation(s = '', m = callable_methods)
+ s = s.to_s
+ our_case = (?A..?Z) === s[0]
if m.index(s.to_sym)
- 1.upto(s.size){|z|s.scan(/./).combination(z).map{|trial|
- next unless ((?A..?Z)===trial[0]) == our_case
- trial*=''
- return trial if matching_methods(trial,m)[0].to_s==s
+ 1.upto(s.size){|z| s.scan(/./).combination(z).map{|trial|
+ next unless ((?A..?Z) === trial[0]) == our_case
+ trial *= ''
+ return trial if matching_methods(trial, m)[0].to_s == s
}}
else
nil
@@ -45,7 +46,7 @@ class Object
private
- def h(a='H', b='w', c='!')
+ def h(a = 'H', b = 'w', c = '!')
puts "#{a}ello, #{b}orld#{c}"
end
@@ -84,14 +85,14 @@ class String
split('')
end
- (Array.instance_methods-instance_methods-[:to_ary,:transpose,:flatten,:flatten!,:compact,:compact!,:assoc,:rassoc]).each{|meth|
- eval"
+ (Array.instance_methods - instance_methods - [:to_ary, :transpose, :flatten, :flatten!, :compact, :compact!, :assoc, :rassoc]).each{|meth|
+ eval "
def #{meth}(*args, &block)
- a=to_a
+ a = to_a
result = a.#{meth}(*args, &block)
replace(a.join)
if result.class == Array
- Integer===result[0] ? result.pack('c*') : result.join
+ Integer === result[0] ? result.pack('c*') : result.join
elsif result.class == Enumerator
result.map(&:join).to_enum
else
@@ -103,8 +104,8 @@ end
class Enumerator
alias old_to_s to_s
- (Array.instance_methods-instance_methods-[:replace]+[:to_s]).each{|meth|
- eval"
+ (Array.instance_methods - instance_methods - [:replace] + [:to_s]).each{|meth|
+ eval "
def #{meth}(*args, &block)
to_a.#{meth}(*args, &block)
end"
diff --git a/goruby.c b/goruby.c
index 6095fc0894..99042f8440 100644
--- a/goruby.c
+++ b/goruby.c
@@ -20,7 +20,7 @@ RUBY_EXTERN void ruby_init_ext(const char *name, void (*init)(void));
static VALUE
init_golf(VALUE arg)
{
- ruby_init_ext("golf", Init_golf);
+ ruby_init_ext("golf.so", Init_golf);
return arg;
}
@@ -32,12 +32,14 @@ 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]);
- write(rw[1], cmd, sizeof(cmd) - 1);
+ n = write(rw[1], cmd, sizeof(cmd) - 1);
close(rw[1]);
- ret = ruby_options(argc, argv);
+ ret = n > 0 ? ruby_options(argc, argv) : NULL;
dup2(infd, 0);
close(infd);
return ret;
diff --git a/hash.c b/hash.c
index 7e0059a309..9bfc39611e 100644
--- a/hash.c
+++ b/hash.c
@@ -18,6 +18,7 @@
#include "internal.h"
#include <errno.h>
#include "probes.h"
+#include "id.h"
#ifdef __APPLE__
# ifdef HAVE_CRT_EXTERNS_H
@@ -27,10 +28,35 @@
# 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) {
+ st_table *mtbl = RCLASS_M_TBL(c);
+ if (mtbl && mtbl->num_entries) return klass;
+ c = RCLASS_SUPER(c);
+ }
+ return 0;
+}
+
static VALUE rb_hash_s_try_convert(VALUE, VALUE);
-#define HASH_DELETED FL_USER1
-#define HASH_PROC_DEFAULT FL_USER2
+/*
+ * Hash WB strategy:
+ * 1. Check mutate st_* functions
+ * * st_insert()
+ * * st_insert2()
+ * * st_update()
+ * * st_add_direct()
+ * 2. Insert WBs
+ */
VALUE
rb_hash_freeze(VALUE hash)
@@ -41,7 +67,20 @@ rb_hash_freeze(VALUE hash)
VALUE rb_cHash;
static VALUE envtbl;
-static ID id_hash, id_yield, id_default;
+static ID id_hash, id_yield, id_default, id_flatten_bang;
+
+VALUE
+rb_hash_ifnone(VALUE h)
+{
+ return RHASH_IFNONE(h);
+}
+
+VALUE
+rb_hash_set_ifnone(VALUE hash, VALUE ifnone)
+{
+ RB_OBJ_WRITE(hash, (&RHASH(hash)->ifnone), ifnone);
+ return hash;
+}
static int
rb_any_cmp(VALUE a, VALUE b)
@@ -62,24 +101,36 @@ 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_funcall(obj, id_hash, 0);
- retry:
- switch (TYPE(hval)) {
- case T_FIXNUM:
- return hval;
-
- case T_BIGNUM:
- return LONG2FIX(((long*)(RBIGNUM_DIGITS(hval)))[0]);
-
- default:
+ VALUE hval = rb_exec_recursive_outer(hash_recursive, obj, 0);
+
+ while (!FIXNUM_P(hval)) {
+ if (RB_TYPE_P(hval, T_BIGNUM)) {
+ int sign;
+ unsigned long ul;
+ sign = rb_integer_pack(hval, &ul, 1, sizeof(ul), 0,
+ INTEGER_PACK_NATIVE_BYTE_ORDER);
+ ul &= (1UL << (sizeof(long)*CHAR_BIT-1)) - 1;
+ if (sign < 0)
+ return LONG2FIX(-(long)ul);
+ return LONG2FIX((long)ul);
+ }
hval = rb_to_int(hval);
- goto retry;
}
+ return hval;
}
+long rb_objid_hash(st_index_t index);
+
static st_index_t
rb_any_hash(VALUE a)
{
@@ -88,7 +139,8 @@ rb_any_hash(VALUE a)
if (SPECIAL_CONST_P(a)) {
if (a == Qundef) return 0;
- hnum = rb_hash_end(rb_hash_start((st_index_t)a));
+ if (SYMBOL_P(a)) a >>= (RUBY_SPECIAL_SHIFT + ID_SCOPE_SHIFT);
+ hnum = rb_objid_hash((st_index_t)a);
}
else if (BUILTIN_TYPE(a) == T_STRING) {
hnum = rb_str_hash(a);
@@ -101,6 +153,21 @@ rb_any_hash(VALUE a)
return (st_index_t)RSHIFT(hnum, 1);
}
+long
+rb_objid_hash(st_index_t index)
+{
+ st_index_t hnum = rb_hash_start(index);
+ hnum = rb_hash_uint(hnum, (st_index_t)rb_any_hash);
+ hnum = rb_hash_end(hnum);
+ return hnum;
+}
+
+int
+rb_hash_iter_lev(VALUE h)
+{
+ return RHASH_ITER_LEV(h);
+}
+
static const struct st_hash_type objhash = {
rb_any_cmp,
rb_any_hash,
@@ -118,10 +185,12 @@ struct foreach_safe_arg {
};
static int
-foreach_safe_i(st_data_t key, st_data_t value, struct foreach_safe_arg *arg)
+foreach_safe_i(st_data_t key, st_data_t value, st_data_t args, int error)
{
int status;
+ struct foreach_safe_arg *arg = (void *)args;
+ if (error) return ST_STOP;
status = (*arg->func)(key, value, arg->arg);
if (status == ST_CONTINUE) {
return ST_CHECK;
@@ -151,12 +220,13 @@ struct hash_foreach_arg {
};
static int
-hash_foreach_iter(st_data_t key, st_data_t value, st_data_t argp)
+hash_foreach_iter(st_data_t key, st_data_t value, st_data_t argp, int error)
{
struct hash_foreach_arg *arg = (struct hash_foreach_arg *)argp;
int status;
st_table *tbl;
+ if (error) return ST_STOP;
tbl = RHASH(arg->hash)->ntbl;
status = (*arg->func)((VALUE)key, (VALUE)value, arg->arg);
if (RHASH(arg->hash)->ntbl != tbl) {
@@ -175,6 +245,13 @@ hash_foreach_iter(st_data_t key, st_data_t value, st_data_t argp)
}
static VALUE
+hash_foreach_ensure_rollback(VALUE hash)
+{
+ RHASH_ITER_LEV(hash)++;
+ return 0;
+}
+
+static VALUE
hash_foreach_ensure(VALUE hash)
{
if (--RHASH_ITER_LEV(hash) == 0) {
@@ -213,9 +290,9 @@ rb_hash_foreach(VALUE hash, int (*func)(ANYARGS), VALUE farg)
static VALUE
hash_alloc(VALUE klass)
{
- NEWOBJ_OF(hash, struct RHash, klass, T_HASH);
+ NEWOBJ_OF(hash, struct RHash, klass, T_HASH | (RGENGC_WB_PROTECTED_HASH ? FL_WB_PROTECTED : 0));
- RHASH_IFNONE(hash) = Qnil;
+ RHASH_SET_IFNONE((VALUE)hash, Qnil);
return (VALUE)hash;
}
@@ -236,34 +313,39 @@ rb_hash_new(void)
return hash_alloc(rb_cHash);
}
-VALUE
-rb_hash_dup(VALUE hash)
+static inline VALUE
+rb_hash_dup_empty(VALUE hash)
{
NEWOBJ_OF(ret, struct RHash,
rb_obj_class(hash),
- (RBASIC(hash)->flags)&(T_MASK|FL_EXIVAR|FL_TAINT|FL_UNTRUSTED));
+ (RBASIC(hash)->flags)&(T_MASK|FL_EXIVAR|FL_TAINT));
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);
}
- RHASH_IFNONE(ret) = RHASH_IFNONE(hash);
+ RHASH_SET_IFNONE(ret, RHASH_IFNONE(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)
{
rb_check_frozen(hash);
- if (!OBJ_UNTRUSTED(hash) && rb_safe_level() >= 4)
- rb_raise(rb_eSecurityError, "Insecure: can't modify hash");
}
-struct st_table *
-rb_hash_tbl(VALUE hash)
+static struct st_table *
+hash_tbl(VALUE hash)
{
if (!RHASH(hash)->ntbl) {
RHASH(hash)->ntbl = st_init_table(&objhash);
@@ -271,11 +353,24 @@ rb_hash_tbl(VALUE hash)
return RHASH(hash)->ntbl;
}
+struct st_table *
+rb_hash_tbl(VALUE hash)
+{
+ OBJ_WB_UNPROTECT(hash);
+ return hash_tbl(hash);
+}
+
+struct st_table *
+rb_hash_tbl_raw(VALUE hash)
+{
+ return hash_tbl(hash);
+}
+
static void
rb_hash_modify(VALUE hash)
{
rb_hash_modify_check(hash);
- rb_hash_tbl(hash);
+ hash_tbl(hash);
}
NORETURN(static void no_new_key(void));
@@ -285,20 +380,62 @@ no_new_key(void)
rb_raise(rb_eRuntimeError, "can't add a new key into hash during iteration");
}
-#define NOINSERT_UPDATE_CALLBACK(func) \
-int \
+struct update_callback_arg {
+ VALUE hash;
+ st_data_t arg;
+};
+
+#define NOINSERT_UPDATE_CALLBACK(func) \
+static int \
func##_noinsert(st_data_t *key, st_data_t *val, st_data_t arg, int existing) \
-{ \
- if (!existing) no_new_key(); \
- return func(key, val, arg, existing); \
+{ \
+ if (!existing) no_new_key(); \
+ return func(key, val, (struct update_arg *)arg, existing); \
+} \
+ \
+static int \
+func##_insert(st_data_t *key, st_data_t *val, st_data_t arg, int existing) \
+{ \
+ return func(key, val, (struct update_arg *)arg, existing); \
}
-#define UPDATE_CALLBACK(iter_lev, func) ((iter_lev) > 0 ? func##_noinsert : func)
+struct update_arg {
+ st_data_t arg;
+ VALUE hash;
+ VALUE new_key;
+ VALUE old_key;
+ VALUE new_value;
+ VALUE old_value;
+};
+
+static int
+tbl_update(VALUE hash, VALUE key, int (*func)(st_data_t *key, st_data_t *val, st_data_t arg, int existing), st_data_t optional_arg)
+{
+ struct update_arg arg;
+ int result;
+
+ arg.arg = optional_arg;
+ arg.hash = hash;
+ arg.new_key = 0;
+ arg.old_key = Qundef;
+ arg.new_value = 0;
+ arg.old_value = Qundef;
+
+ 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);
+
+ return result;
+}
+
+#define UPDATE_CALLBACK(iter_lev, func) ((iter_lev) > 0 ? func##_noinsert : func##_insert)
+
+#define RHASH_UPDATE_ITER(h, iter_lev, key, func, a) do { \
+ tbl_update((h), (key), UPDATE_CALLBACK((iter_lev), func), (st_data_t)(a)); \
+} while (0)
-#define RHASH_UPDATE_ITER(hash, iter_lev, key, func, arg) \
- st_update(RHASH(hash)->ntbl, (st_data_t)(key), \
- UPDATE_CALLBACK((iter_lev), func), \
- (st_data_t)(arg))
#define RHASH_UPDATE(hash, key, func, arg) \
RHASH_UPDATE_ITER(hash, RHASH_ITER_LEV(hash), key, func, arg)
@@ -358,12 +495,13 @@ rb_hash_initialize(int argc, VALUE *argv, VALUE hash)
rb_check_arity(argc, 0, 0);
ifnone = rb_block_proc();
default_proc_arity_check(ifnone);
- RHASH_IFNONE(hash) = ifnone;
+ RHASH_SET_IFNONE(hash, ifnone);
FL_SET(hash, HASH_PROC_DEFAULT);
}
else {
- rb_scan_args(argc, argv, "01", &ifnone);
- RHASH_IFNONE(hash) = ifnone;
+ rb_check_arity(argc, 0, 1);
+ ifnone = argc == 0 ? Qnil : argv[0];
+ RHASH_SET_IFNONE(hash, ifnone);
}
return hash;
@@ -375,11 +513,14 @@ rb_hash_initialize(int argc, VALUE *argv, VALUE hash)
* Hash[ [ [key, value], ... ] ] -> new_hash
* Hash[ object ] -> new_hash
*
- * Creates a new hash populated with the given objects. Equivalent to
- * the literal <code>{ <i>key</i> => <i>value</i>, ... }</code>. In the first
- * form, keys and values occur in pairs, so there must be an even number of arguments.
- * The second and third form take a single argument which is either
- * an array of key-value pairs or an object convertible to a hash.
+ * Creates a new hash populated with the given objects.
+ *
+ * Similar to the literal <code>{ _key_ => _value_, ... }</code>. In the first
+ * form, keys and values occur in pairs, so there must be an even number of
+ * arguments.
+ *
+ * The second and third form take a single argument which is either an array
+ * of key-value pairs or an object convertible to a hash.
*
* Hash["a", 100, "b", 200] #=> {"a"=>100, "b"=>200}
* Hash[ [ ["a", 100], ["b", 200] ] ] #=> {"a"=>100, "b"=>200}
@@ -408,7 +549,7 @@ rb_hash_s_create(int argc, VALUE *argv, VALUE klass)
hash = hash_alloc(klass);
for (i = 0; i < RARRAY_LEN(tmp); ++i) {
- VALUE e = RARRAY_PTR(tmp)[i];
+ VALUE e = RARRAY_AREF(tmp, i);
VALUE v = rb_check_array_type(e);
VALUE key, val = Qnil;
@@ -430,9 +571,9 @@ rb_hash_s_create(int argc, VALUE *argv, VALUE klass)
rb_raise(rb_eArgError, "invalid number of elements (%ld for 1..2)",
RARRAY_LEN(v));
case 2:
- val = RARRAY_PTR(v)[1];
+ val = RARRAY_AREF(v, 1);
case 1:
- key = RARRAY_PTR(v)[0];
+ key = RARRAY_AREF(v, 0);
rb_hash_aset(hash, key, val);
}
}
@@ -480,6 +621,11 @@ 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)
{
@@ -512,6 +658,7 @@ rb_hash_rehash_i(VALUE key, VALUE value, VALUE arg)
static VALUE
rb_hash_rehash(VALUE hash)
{
+ VALUE tmp;
st_table *tbl;
if (RHASH_ITER_LEV(hash) > 0) {
@@ -520,10 +667,14 @@ 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;
}
@@ -616,11 +767,12 @@ rb_hash_lookup(VALUE hash, VALUE key)
static VALUE
rb_hash_fetch_m(int argc, VALUE *argv, VALUE hash)
{
- VALUE key, if_none;
+ VALUE key;
st_data_t val;
long block_given;
- rb_scan_args(argc, argv, "11", &key, &if_none);
+ rb_check_arity(argc, 1, 2);
+ key = argv[0];
block_given = rb_block_given_p();
if (block_given && argc == 2) {
@@ -634,9 +786,9 @@ rb_hash_fetch_m(int argc, VALUE *argv, VALUE hash)
desc = rb_any_to_s(key);
}
desc = rb_str_ellipsize(desc, 65);
- rb_raise(rb_eKeyError, "key not found: %s", RSTRING_PTR(desc));
+ rb_raise(rb_eKeyError, "key not found: %"PRIsVALUE, desc);
}
- return if_none;
+ return argv[1];
}
return (VALUE)val;
}
@@ -673,7 +825,8 @@ rb_hash_default(int argc, VALUE *argv, VALUE hash)
{
VALUE key, ifnone;
- rb_scan_args(argc, argv, "01", &key);
+ rb_check_arity(argc, 0, 1);
+ key = argv[0];
ifnone = RHASH_IFNONE(hash);
if (FL_TEST(hash, HASH_PROC_DEFAULT)) {
if (argc == 0) return Qnil;
@@ -706,7 +859,7 @@ static VALUE
rb_hash_set_default(VALUE hash, VALUE ifnone)
{
rb_hash_modify_check(hash);
- RHASH_IFNONE(hash) = ifnone;
+ RHASH_SET_IFNONE(hash, ifnone);
FL_UNSET(hash, HASH_PROC_DEFAULT);
return ifnone;
}
@@ -756,7 +909,7 @@ rb_hash_set_default_proc(VALUE hash, VALUE proc)
rb_hash_modify_check(hash);
if (NIL_P(proc)) {
FL_UNSET(hash, HASH_PROC_DEFAULT);
- RHASH_IFNONE(hash) = proc;
+ RHASH_SET_IFNONE(hash, proc);
return proc;
}
b = rb_check_convert_type(proc, T_DATA, "Proc", "to_proc");
@@ -767,7 +920,7 @@ rb_hash_set_default_proc(VALUE hash, VALUE proc)
}
proc = b;
default_proc_arity_check(proc);
- RHASH_IFNONE(hash) = proc;
+ RHASH_SET_IFNONE(hash, proc);
FL_SET(hash, HASH_PROC_DEFAULT);
return proc;
}
@@ -875,17 +1028,6 @@ struct shift_var {
};
static int
-shift_i(VALUE key, VALUE value, VALUE arg)
-{
- struct shift_var *var = (struct shift_var *)arg;
-
- if (var->key != Qundef) return ST_STOP;
- var->key = key;
- var->val = value;
- return ST_DELETE;
-}
-
-static int
shift_i_safe(VALUE key, VALUE value, VALUE arg)
{
struct shift_var *var = (struct shift_var *)arg;
@@ -916,14 +1058,17 @@ rb_hash_shift(VALUE hash)
rb_hash_modify_check(hash);
if (RHASH(hash)->ntbl) {
var.key = Qundef;
- rb_hash_foreach(hash, RHASH_ITER_LEV(hash) > 0 ? shift_i_safe : shift_i,
- (VALUE)&var);
-
- if (var.key != Qundef) {
- if (RHASH_ITER_LEV(hash) > 0) {
+ if (RHASH_ITER_LEV(hash) == 0) {
+ if (st_shift(RHASH(hash)->ntbl, &var.key, &var.val)) {
+ return rb_assoc_new(var.key, var.val);
+ }
+ }
+ else {
+ rb_hash_foreach(hash, shift_i_safe, (VALUE)&var);
+ if (var.key != Qundef) {
rb_hash_delete_key(hash, var.key);
+ return rb_assoc_new(var.key, var.val);
}
- return rb_assoc_new(var.key, var.val);
}
}
return hash_default_value(hash, Qnil);
@@ -933,12 +1078,16 @@ static int
delete_if_i(VALUE key, VALUE value, VALUE hash)
{
if (RTEST(rb_yield_values(2, key, value))) {
- rb_hash_delete_key(hash, key);
+ return ST_DELETE;
}
return ST_CONTINUE;
}
-static VALUE rb_hash_size(VALUE hash);
+static VALUE
+hash_enum_size(VALUE hash, VALUE args, VALUE eobj)
+{
+ return rb_hash_size(hash);
+}
/*
* call-seq:
@@ -958,7 +1107,7 @@ static VALUE rb_hash_size(VALUE hash);
VALUE
rb_hash_delete_if(VALUE hash)
{
- RETURN_SIZED_ENUMERATOR(hash, 0, 0, rb_hash_size);
+ RETURN_SIZED_ENUMERATOR(hash, 0, 0, hash_enum_size);
rb_hash_modify_check(hash);
if (RHASH(hash)->ntbl)
rb_hash_foreach(hash, delete_if_i, hash);
@@ -979,31 +1128,55 @@ rb_hash_reject_bang(VALUE hash)
{
st_index_t n;
- RETURN_SIZED_ENUMERATOR(hash, 0, 0, rb_hash_size);
+ RETURN_SIZED_ENUMERATOR(hash, 0, 0, hash_enum_size);
rb_hash_modify(hash);
- if (!RHASH(hash)->ntbl)
- return Qnil;
- n = RHASH(hash)->ntbl->num_entries;
+ n = RHASH_SIZE(hash);
+ if (!n) return Qnil;
rb_hash_foreach(hash, delete_if_i, hash);
if (n == RHASH(hash)->ntbl->num_entries) return Qnil;
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
*
- * 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>.
+ * Returns a new hash consisting of entries for which the block returns false.
*
+ * 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}
*/
-static VALUE
+VALUE
rb_hash_reject(VALUE hash)
{
- return rb_hash_delete_if(rb_obj_dup(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;
}
/*
@@ -1032,8 +1205,9 @@ rb_hash_values_at(int argc, VALUE *argv, VALUE hash)
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;
}
@@ -1056,9 +1230,11 @@ rb_hash_select(VALUE hash)
{
VALUE result;
- RETURN_SIZED_ENUMERATOR(hash, 0, 0, rb_hash_size);
+ RETURN_SIZED_ENUMERATOR(hash, 0, 0, hash_enum_size);
result = rb_hash_new();
- rb_hash_foreach(hash, select_i, result);
+ if (!RHASH_EMPTY_P(hash)) {
+ rb_hash_foreach(hash, select_i, result);
+ }
return result;
}
@@ -1085,7 +1261,7 @@ rb_hash_select_bang(VALUE hash)
{
st_index_t n;
- RETURN_SIZED_ENUMERATOR(hash, 0, 0, rb_hash_size);
+ RETURN_SIZED_ENUMERATOR(hash, 0, 0, hash_enum_size);
rb_hash_modify_check(hash);
if (!RHASH(hash)->ntbl)
return Qnil;
@@ -1110,7 +1286,7 @@ rb_hash_select_bang(VALUE hash)
VALUE
rb_hash_keep_if(VALUE hash)
{
- RETURN_SIZED_ENUMERATOR(hash, 0, 0, rb_hash_size);
+ RETURN_SIZED_ENUMERATOR(hash, 0, 0, hash_enum_size);
rb_hash_modify_check(hash);
if (RHASH(hash)->ntbl)
rb_hash_foreach(hash, keep_if_i, hash);
@@ -1151,21 +1327,31 @@ rb_hash_clear(VALUE hash)
}
static int
-hash_aset(st_data_t *key, st_data_t *val, st_data_t arg, int existing)
+hash_aset(st_data_t *key, st_data_t *val, struct update_arg *arg, int existing)
{
- *val = arg;
+ if (existing) {
+ arg->new_value = arg->arg;
+ arg->old_value = *val;
+ }
+ else {
+ arg->new_key = *key;
+ arg->new_value = arg->arg;
+ }
+ *val = arg->arg;
return ST_CONTINUE;
}
static int
-hash_aset_str(st_data_t *key, st_data_t *val, st_data_t arg, int existing)
+hash_aset_str(st_data_t *key, st_data_t *val, struct update_arg *arg, int existing)
{
- *key = (st_data_t)rb_str_new_frozen((VALUE)*key);
+ if (!existing) {
+ *key = rb_str_new_frozen(*key);
+ }
return hash_aset(key, val, arg, existing);
}
-static NOINSERT_UPDATE_CALLBACK(hash_aset)
-static NOINSERT_UPDATE_CALLBACK(hash_aset_str)
+NOINSERT_UPDATE_CALLBACK(hash_aset);
+NOINSERT_UPDATE_CALLBACK(hash_aset_str);
/*
* call-seq:
@@ -1180,6 +1366,8 @@ static 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}
*
* +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).
@@ -1201,7 +1389,7 @@ rb_hash_aset(VALUE hash, VALUE key, VALUE val)
rb_hash_modify(hash);
if (!tbl) {
if (iter_lev > 0) no_new_key();
- tbl = RHASH_TBL(hash);
+ tbl = hash_tbl(hash);
}
if (tbl->type == &identhash || rb_obj_class(key) != rb_cString) {
RHASH_UPDATE_ITER(hash, iter_lev, key, hash_aset, val);
@@ -1220,17 +1408,28 @@ replace_i(VALUE key, VALUE val, VALUE hash)
return ST_CONTINUE;
}
+/* :nodoc: */
static VALUE
rb_hash_initialize_copy(VALUE hash, VALUE hash2)
{
+ st_table *ntbl;
+
rb_hash_modify_check(hash);
hash2 = to_hash(hash2);
Check_Type(hash2, T_HASH);
- if (!RHASH_EMPTY_P(hash2)) {
+ if (hash == hash2) return hash;
+
+ ntbl = RHASH(hash)->ntbl;
+ if (RHASH(hash2)->ntbl) {
+ if (ntbl) st_free_table(ntbl);
RHASH(hash)->ntbl = st_copy(RHASH(hash2)->ntbl);
- rb_hash_rehash(hash);
+ if (RHASH(hash)->ntbl->num_entries)
+ rb_hash_rehash(hash);
+ }
+ else if (ntbl) {
+ st_clear(ntbl);
}
if (FL_TEST(hash2, HASH_PROC_DEFAULT)) {
@@ -1239,7 +1438,7 @@ rb_hash_initialize_copy(VALUE hash, VALUE hash2)
else {
FL_UNSET(hash, HASH_PROC_DEFAULT);
}
- RHASH_IFNONE(hash) = RHASH_IFNONE(hash2);
+ RHASH_SET_IFNONE(hash, RHASH_IFNONE(hash2));
return hash;
}
@@ -1259,22 +1458,23 @@ rb_hash_initialize_copy(VALUE hash, VALUE hash2)
static VALUE
rb_hash_replace(VALUE hash, VALUE hash2)
{
+ st_table *table2;
+
rb_hash_modify_check(hash);
- hash2 = to_hash(hash2);
if (hash == hash2) return hash;
- rb_hash_clear(hash);
- if (RHASH(hash2)->ntbl) {
- rb_hash_tbl(hash);
- RHASH(hash)->ntbl->type = RHASH(hash2)->ntbl->type;
- }
- rb_hash_foreach(hash2, replace_i, hash);
- RHASH_IFNONE(hash) = RHASH_IFNONE(hash2);
- if (FL_TEST(hash2, HASH_PROC_DEFAULT)) {
+ hash2 = to_hash(hash2);
+
+ RHASH_SET_IFNONE(hash, RHASH_IFNONE(hash2));
+ if (FL_TEST(hash2, HASH_PROC_DEFAULT))
FL_SET(hash, HASH_PROC_DEFAULT);
- }
- else {
+ else
FL_UNSET(hash, HASH_PROC_DEFAULT);
- }
+
+ table2 = RHASH(hash2)->ntbl;
+
+ rb_hash_clear(hash);
+ if (table2) hash_tbl(hash)->type = table2->type;
+ rb_hash_foreach(hash2, replace_i, hash);
return hash;
}
@@ -1292,12 +1492,10 @@ rb_hash_replace(VALUE hash, VALUE hash2)
* h.length #=> 3
*/
-static VALUE
+VALUE
rb_hash_size(VALUE hash)
{
- if (!RHASH(hash)->ntbl)
- return INT2FIX(0);
- return INT2FIX(RHASH(hash)->ntbl->num_entries);
+ return INT2FIX(RHASH_SIZE(hash));
}
@@ -1346,7 +1544,7 @@ each_value_i(VALUE key, VALUE value)
static VALUE
rb_hash_each_value(VALUE hash)
{
- RETURN_SIZED_ENUMERATOR(hash, 0, 0, rb_hash_size);
+ RETURN_SIZED_ENUMERATOR(hash, 0, 0, hash_enum_size);
rb_hash_foreach(hash, each_value_i, 0);
return hash;
}
@@ -1379,7 +1577,7 @@ each_key_i(VALUE key, VALUE value)
static VALUE
rb_hash_each_key(VALUE hash)
{
- RETURN_SIZED_ENUMERATOR(hash, 0, 0, rb_hash_size);
+ RETURN_SIZED_ENUMERATOR(hash, 0, 0, hash_enum_size);
rb_hash_foreach(hash, each_key_i, 0);
return hash;
}
@@ -1391,6 +1589,13 @@ each_pair_i(VALUE key, VALUE value)
return ST_CONTINUE;
}
+static int
+each_pair_i_fast(VALUE key, VALUE value)
+{
+ rb_yield_values(2, key, value);
+ return ST_CONTINUE;
+}
+
/*
* call-seq:
* hsh.each {| key, value | block } -> hsh
@@ -1416,8 +1621,11 @@ each_pair_i(VALUE key, VALUE value)
static VALUE
rb_hash_each_pair(VALUE hash)
{
- RETURN_SIZED_ENUMERATOR(hash, 0, 0, rb_hash_size);
- rb_hash_foreach(hash, each_pair_i, 0);
+ RETURN_SIZED_ENUMERATOR(hash, 0, 0, hash_enum_size);
+ if (rb_block_arity() > 1)
+ rb_hash_foreach(hash, each_pair_i_fast, 0);
+ else
+ rb_hash_foreach(hash, each_pair_i, 0);
return hash;
}
@@ -1444,7 +1652,7 @@ rb_hash_to_a(VALUE hash)
{
VALUE ary;
- ary = rb_ary_new();
+ ary = rb_ary_new_capa(RHASH_SIZE(hash));
rb_hash_foreach(hash, to_a_i, ary);
OBJ_INFECT(ary, hash);
@@ -1537,7 +1745,7 @@ rb_hash_to_h(VALUE hash)
if (FL_TEST(hash, HASH_PROC_DEFAULT)) {
FL_SET(ret, HASH_PROC_DEFAULT);
}
- RHASH_IFNONE(ret) = RHASH_IFNONE(hash);
+ RHASH_SET_IFNONE(ret, RHASH_IFNONE(hash));
return ret;
}
return hash;
@@ -1562,15 +1770,29 @@ keys_i(VALUE key, VALUE value, VALUE ary)
*
*/
-static VALUE
+VALUE
rb_hash_keys(VALUE hash)
{
- VALUE ary;
+ VALUE keys;
+ st_index_t size = RHASH_SIZE(hash);
- ary = rb_ary_new();
- rb_hash_foreach(hash, keys_i, ary);
+ keys = rb_ary_new_capa(size);
+ if (size == 0) return keys;
- return ary;
+ if (ST_DATA_COMPATIBLE_P(VALUE)) {
+ st_table *table = RHASH(hash)->ntbl;
+
+ 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);
+ }
+
+ return keys;
}
static int
@@ -1592,15 +1814,29 @@ values_i(VALUE key, VALUE value, VALUE ary)
*
*/
-static VALUE
+VALUE
rb_hash_values(VALUE hash)
{
- VALUE ary;
+ VALUE values;
+ st_index_t size = RHASH_SIZE(hash);
- ary = rb_ary_new();
- rb_hash_foreach(hash, values_i, ary);
+ values = rb_ary_new_capa(size);
+ if (size == 0) return values;
- return ary;
+ if (ST_DATA_COMPATIBLE_P(VALUE)) {
+ st_table *table = RHASH(hash)->ntbl;
+
+ 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);
+ }
+
+ return values;
}
/*
@@ -1708,7 +1944,7 @@ 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, rb_intern("to_hash"))) {
+ if (!rb_respond_to(hash2, idTo_hash)) {
return Qfalse;
}
if (eql)
@@ -1784,35 +2020,27 @@ 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;
-
- if (!RHASH(hash)->ntbl)
- return LONG2FIX(0);
- hval = RHASH(hash)->ntbl->num_entries;
- if (!hval) return LONG2FIX(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)
{
- return rb_exec_recursive_outer(recursive_hash, hash, 0);
+ 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);
}
static int
@@ -1844,13 +2072,21 @@ rb_hash_invert(VALUE hash)
}
static int
-rb_hash_update_callback(st_data_t *key, st_data_t *value, st_data_t arg, int existing)
+rb_hash_update_callback(st_data_t *key, st_data_t *value, struct update_arg *arg, int existing)
{
- *value = arg;
+ if (existing) {
+ arg->old_value = *value;
+ arg->new_value = arg->arg;
+ }
+ else {
+ arg->new_key = *key;
+ arg->new_value = arg->arg;
+ }
+ *value = arg->arg;
return ST_CONTINUE;
}
-static 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)
@@ -1860,17 +2096,24 @@ rb_hash_update_i(VALUE key, VALUE value, VALUE hash)
}
static int
-rb_hash_update_block_callback(st_data_t *key, st_data_t *value, st_data_t arg, int existing)
+rb_hash_update_block_callback(st_data_t *key, st_data_t *value, struct update_arg *arg, int existing)
{
- VALUE newvalue = (VALUE)arg;
+ VALUE newvalue = (VALUE)arg->arg;
+
if (existing) {
newvalue = rb_yield_values(3, (VALUE)*key, (VALUE)*value, newvalue);
+ arg->old_value = *value;
+ arg->new_value = newvalue;
+ }
+ else {
+ arg->new_key = *key;
+ arg->new_value = newvalue;
}
- *value = (st_data_t)newvalue;
+ *value = newvalue;
return ST_CONTINUE;
}
-static 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)
@@ -1916,34 +2159,41 @@ rb_hash_update(VALUE hash1, VALUE hash2)
return hash1;
}
-struct update_arg {
+struct update_func_arg {
VALUE hash;
VALUE value;
rb_hash_update_func *func;
};
static int
-rb_hash_update_func_callback(st_data_t *key, st_data_t *value, st_data_t arg0, int existing)
+rb_hash_update_func_callback(st_data_t *key, st_data_t *value, struct update_arg *arg, int existing)
{
- struct update_arg *arg = (struct update_arg *)arg0;
- VALUE newvalue = arg->value;
+ struct update_func_arg *uf_arg = (struct update_func_arg *)arg->arg;
+ VALUE newvalue = uf_arg->value;
+
if (existing) {
- newvalue = (*arg->func)((VALUE)*key, (VALUE)*value, newvalue);
+ newvalue = (*uf_arg->func)((VALUE)*key, (VALUE)*value, newvalue);
+ arg->old_value = *value;
+ arg->new_value = newvalue;
+ }
+ else {
+ arg->new_key = *key;
+ arg->new_value = newvalue;
}
- *value = (st_data_t)newvalue;
+ *value = newvalue;
return ST_CONTINUE;
}
-static 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)
{
- struct update_arg *arg = (struct update_arg *)arg0;
+ struct update_func_arg *arg = (struct update_func_arg *)arg0;
VALUE hash = arg->hash;
arg->value = value;
- RHASH_UPDATE(hash, key, rb_hash_update_func_callback, arg);
+ RHASH_UPDATE(hash, key, rb_hash_update_func_callback, (VALUE)arg);
return ST_CONTINUE;
}
@@ -1953,7 +2203,7 @@ rb_hash_update_by(VALUE hash1, VALUE hash2, rb_hash_update_func *func)
rb_hash_modify(hash1);
hash2 = to_hash(hash2);
if (func) {
- struct update_arg arg;
+ struct update_func_arg arg;
arg.hash = hash1;
arg.func = func;
rb_hash_foreach(hash2, rb_hash_update_func_i, (VALUE)&arg);
@@ -1991,6 +2241,32 @@ rb_hash_merge(VALUE hash1, VALUE hash2)
}
static int
+assoc_cmp(VALUE a, VALUE b)
+{
+ return !RTEST(rb_equal(a, b));
+}
+
+static VALUE
+lookup2_call(VALUE arg)
+{
+ VALUE *args = (VALUE *)arg;
+ return rb_hash_lookup2(args[0], args[1], Qundef);
+}
+
+struct reset_hash_type_arg {
+ VALUE hash;
+ const struct st_hash_type *orighash;
+};
+
+static VALUE
+reset_hash_type(VALUE arg)
+{
+ struct reset_hash_type_arg *p = (struct reset_hash_type_arg *)arg;
+ RHASH(p->hash)->ntbl->type = p->orighash;
+ return Qundef;
+}
+
+static int
assoc_i(VALUE key, VALUE val, VALUE arg)
{
VALUE *args = (VALUE *)arg;
@@ -2017,11 +2293,33 @@ assoc_i(VALUE key, VALUE val, VALUE arg)
*/
VALUE
-rb_hash_assoc(VALUE hash, VALUE obj)
+rb_hash_assoc(VALUE hash, VALUE key)
{
+ st_table *table;
+ const struct st_hash_type *orighash;
VALUE args[2];
- args[0] = obj;
+ if (RHASH_EMPTY_P(hash)) return Qnil;
+ table = RHASH(hash)->ntbl;
+ orighash = table->type;
+
+ if (orighash != &identhash) {
+ VALUE value;
+ struct reset_hash_type_arg ensure_arg;
+ struct st_hash_type assochash;
+
+ assochash.compare = assoc_cmp;
+ assochash.hash = orighash->hash;
+ table->type = &assochash;
+ args[0] = hash;
+ args[1] = key;
+ ensure_arg.hash = hash;
+ ensure_arg.orighash = orighash;
+ value = rb_ensure(lookup2_call, (VALUE)&args, reset_hash_type, (VALUE)&ensure_arg);
+ if (value != Qundef) return rb_assoc_new(key, value);
+ }
+
+ args[0] = key;
args[1] = Qnil;
rb_hash_foreach(hash, assoc_i, (VALUE)args);
return args[1];
@@ -2063,6 +2361,18 @@ rb_hash_rassoc(VALUE hash, VALUE obj)
return args[1];
}
+static int
+flatten_i(VALUE key, VALUE val, VALUE ary)
+{
+ VALUE pair[2];
+
+ pair[0] = key;
+ pair[1] = val;
+ rb_ary_cat(ary, pair, 2);
+
+ return ST_CONTINUE;
+}
+
/*
* call-seq:
* hash.flatten -> an_array
@@ -2082,18 +2392,32 @@ rb_hash_rassoc(VALUE hash, VALUE obj)
static VALUE
rb_hash_flatten(int argc, VALUE *argv, VALUE hash)
{
- VALUE ary, tmp;
+ VALUE ary;
- ary = rb_hash_to_a(hash);
- if (argc == 0) {
- argc = 1;
- tmp = INT2FIX(1);
- argv = &tmp;
+ 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);
+ }
+ 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);
}
- rb_funcall2(ary, rb_intern("flatten!"), argc, argv);
+
return ary;
}
+static VALUE rb_hash_compare_by_id_p(VALUE hash);
+
/*
* call-seq:
* hsh.compare_by_identity -> hsh
@@ -2105,7 +2429,7 @@ rb_hash_flatten(int argc, VALUE *argv, VALUE hash)
* h1["a"] #=> 100
* h1.compare_by_identity
* h1.compare_by_identity? #=> true
- * h1["a"] #=> nil # different objects.
+ * h1["a".dup] #=> nil # different objects.
* h1[:c] #=> "c" # same symbols are all same.
*
*/
@@ -2113,6 +2437,7 @@ rb_hash_flatten(int argc, VALUE *argv, VALUE hash)
static VALUE
rb_hash_compare_by_id(VALUE hash)
{
+ if (rb_hash_compare_by_id_p(hash)) return hash;
rb_hash_modify(hash);
RHASH(hash)->ntbl->type = &identhash;
rb_hash_rehash(hash);
@@ -2139,6 +2464,52 @@ rb_hash_compare_by_id_p(VALUE hash)
return Qfalse;
}
+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;
+}
+
static int path_tainted = -1;
static char **origenviron;
@@ -2149,7 +2520,18 @@ static char **my_environ;
#undef environ
#define environ my_environ
#undef getenv
-#define getenv(n) rb_w32_ugetenv(n)
+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)
#elif defined(__APPLE__)
#undef environ
#define environ (*_NSGetEnviron())
@@ -2168,11 +2550,20 @@ 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, rb_utf8_encoding(), enc,
+ ECONV_INVALID_REPLACE | ECONV_UNDEF_REPLACE, Qnil);
+}
+#endif
+
static VALUE
env_str_new(const char *ptr, long len)
{
#ifdef _WIN32
- VALUE str = rb_str_conv_enc(rb_str_new(ptr, len), rb_utf8_encoding(), rb_locale_encoding());
+ VALUE str = env_str_transcode(rb_str_new(ptr, len), rb_locale_encoding());
#else
VALUE str = rb_locale_str_new(ptr, len);
#endif
@@ -2182,23 +2573,46 @@ 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_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));
}
+#define get_env_ptr(var, val) \
+ (memchr((var = RSTRING_PTR(val)), '\0', RSTRING_LEN(val)) ? \
+ rb_raise(rb_eArgError, "bad environment variable " #var) : (void)0)
+
+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)
{
- char *nam, *val;
+ const char *nam, *val;
- rb_secure(4);
- SafeStringValue(name);
- nam = RSTRING_PTR(name);
- if (memchr(nam, '\0', RSTRING_LEN(name))) {
- rb_raise(rb_eArgError, "bad environment variable name");
- }
+ nam = env_name(name);
val = getenv(nam);
if (val) {
VALUE value = env_str_new2(val);
@@ -2243,25 +2657,13 @@ static int env_path_tainted(const char *);
static VALUE
rb_f_getenv(VALUE obj, VALUE name)
{
- char *nam, *env;
+ const char *nam, *env;
- rb_secure(4);
- SafeStringValue(name);
- nam = RSTRING_PTR(name);
- if (memchr(nam, '\0', RSTRING_LEN(name))) {
- rb_raise(rb_eArgError, "bad environment variable name");
- }
+ nam = env_name(name);
env = getenv(nam);
if (env) {
if (ENVMATCH(nam, PATH_ENV) && !env_path_tainted(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_path_str_new(env);
}
return env_str_new2(env);
}
@@ -2285,35 +2687,27 @@ rb_f_getenv(VALUE obj, VALUE name)
static VALUE
env_fetch(int argc, VALUE *argv)
{
- VALUE key, if_none;
+ VALUE key;
long block_given;
- char *nam, *env;
+ const char *nam, *env;
- rb_secure(4);
- rb_scan_args(argc, argv, "11", &key, &if_none);
+ rb_check_arity(argc, 1, 2);
+ key = argv[0];
block_given = rb_block_given_p();
if (block_given && argc == 2) {
rb_warn("block supersedes default value argument");
}
- SafeStringValue(key);
- nam = RSTRING_PTR(key);
- if (memchr(nam, '\0', RSTRING_LEN(key))) {
- rb_raise(rb_eArgError, "bad environment variable name");
- }
+ nam = env_name(key);
env = getenv(nam);
if (!env) {
if (block_given) return rb_yield(key);
if (argc == 1) {
- rb_raise(rb_eKeyError, "key not found");
+ rb_raise(rb_eKeyError, "key not found: \"%"PRIsVALUE"\"", key);
}
- return if_none;
+ return argv[1];
}
if (ENVMATCH(nam, PATH_ENV) && !env_path_tainted(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_path_str_new(env);
return env_str_new2(env);
}
@@ -2384,21 +2778,41 @@ getenvblocksize()
}
#endif
+#if defined(_WIN32) || \
+ (defined(__sun) && !(defined(HAVE_SETENV) && defined(HAVE_UNSETENV)))
+
+NORETURN(static void invalid_envname(const char *name));
+
+static void
+invalid_envname(const char *name)
+{
+ rb_syserr_fail_str(EINVAL, rb_sprintf("ruby_setenv(%s)", name));
+}
+
+static const char *
+check_envname(const char *name)
+{
+ if (strchr(name, '=')) {
+ invalid_envname(name);
+ }
+ return name;
+}
+#endif
+
void
ruby_setenv(const char *name, const char *value)
{
#if defined(_WIN32)
VALUE buf;
int failed = 0;
- if (strchr(name, '=')) {
- fail:
- errno = EINVAL;
- rb_sys_fail("ruby_setenv");
- }
+ check_envname(name);
if (value) {
- const char* p = GetEnvironmentStringsA();
+ char* p = GetEnvironmentStringsA();
+ size_t n;
if (!p) goto fail; /* never happen */
- if (strlen(name) + 2 + strlen(value) + getenvsize(p) >= getenvblocksize()) {
+ n = strlen(name) + 2 + strlen(value) + getenvsize(p);
+ FreeEnvironmentStringsA(p);
+ if (n >= getenvblocksize()) {
goto fail; /* 2 for '=' & '\0' */
}
buf = rb_sprintf("%s=%s", name, value);
@@ -2415,29 +2829,42 @@ ruby_setenv(const char *name, const char *value)
if (!SetEnvironmentVariable(name, value) &&
GetLastError() != ERROR_ENVVAR_NOT_FOUND) goto fail;
}
- if (failed) goto fail;
+ if (failed) {
+ fail:
+ invalid_envname(name);
+ }
#elif defined(HAVE_SETENV) && defined(HAVE_UNSETENV)
#undef setenv
#undef unsetenv
if (value) {
if (setenv(name, value, 1))
- rb_sys_fail("setenv");
- } else {
+ rb_sys_fail_str(rb_sprintf("setenv(%s)", name));
+ }
+ else {
#ifdef VOID_UNSETENV
unsetenv(name);
#else
if (unsetenv(name))
- rb_sys_fail("unsetenv");
+ rb_sys_fail_str(rb_sprintf("unsetenv(%s)", name));
#endif
}
#elif defined __sun
- size_t len;
- char **env_ptr, *str;
- if (strchr(name, '=')) {
- errno = EINVAL;
- rb_sys_fail("ruby_setenv");
- }
+ /* 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;
+
+ 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);
@@ -2446,18 +2873,15 @@ ruby_setenv(const char *name, const char *value)
}
}
if (value) {
- str = malloc(len += strlen(value) + 2);
- snprintf(str, len, "%s=%s", name, value);
- if (putenv(str))
- rb_sys_fail("putenv");
+ if (putenv(mem_ptr)) {
+ free(mem_ptr);
+ rb_sys_fail_str(rb_sprintf("putenv(%s)", name));
+ }
}
#else /* WIN32 */
size_t len;
int i;
- if (strchr(name, '=')) {
- errno = EINVAL;
- rb_sys_fail("ruby_setenv");
- }
+
i=envix(name); /* where does it go? */
if (environ == origenviron) { /* need we copy environment? */
@@ -2516,22 +2940,16 @@ env_aset(VALUE obj, VALUE nm, VALUE val)
{
char *name, *value;
- if (rb_safe_level() >= 4) {
- rb_raise(rb_eSecurityError, "can't change environment variable");
- }
-
if (NIL_P(val)) {
env_delete(obj, nm);
return Qnil;
}
- 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");
+ 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);
ruby_setenv(name, value);
if (ENVMATCH(name, PATH_ENV)) {
@@ -2559,7 +2977,6 @@ env_keys(void)
char **env;
VALUE ary;
- rb_secure(4);
ary = rb_ary_new();
env = GET_ENVIRON(environ);
while (*env) {
@@ -2574,13 +2991,11 @@ env_keys(void)
}
static VALUE
-rb_env_size(VALUE ehash)
+rb_env_size(VALUE ehash, VALUE args, VALUE eobj)
{
char **env;
long cnt = 0;
- rb_secure(4);
-
env = GET_ENVIRON(environ);
for (; *env ; ++env) {
if (strchr(*env, '=')) {
@@ -2607,9 +3022,9 @@ env_each_key(VALUE ehash)
long i;
RETURN_SIZED_ENUMERATOR(ehash, 0, 0, rb_env_size);
- keys = env_keys(); /* rb_secure(4); */
+ keys = env_keys();
for (i=0; i<RARRAY_LEN(keys); i++) {
- rb_yield(RARRAY_PTR(keys)[i]);
+ rb_yield(RARRAY_AREF(keys, i));
}
return ehash;
}
@@ -2626,7 +3041,6 @@ env_values(void)
VALUE ary;
char **env;
- rb_secure(4);
ary = rb_ary_new();
env = GET_ENVIRON(environ);
while (*env) {
@@ -2656,9 +3070,9 @@ env_each_value(VALUE ehash)
long i;
RETURN_SIZED_ENUMERATOR(ehash, 0, 0, rb_env_size);
- values = env_values(); /* rb_secure(4); */
+ values = env_values();
for (i=0; i<RARRAY_LEN(values); i++) {
- rb_yield(RARRAY_PTR(values)[i]);
+ rb_yield(RARRAY_AREF(values, i));
}
return ehash;
}
@@ -2683,7 +3097,6 @@ env_each_pair(VALUE ehash)
RETURN_SIZED_ENUMERATOR(ehash, 0, 0, rb_env_size);
- rb_secure(4);
ary = rb_ary_new();
env = GET_ENVIRON(environ);
while (*env) {
@@ -2696,8 +3109,15 @@ env_each_pair(VALUE ehash)
}
FREE_ENVIRON(environ);
- for (i=0; i<RARRAY_LEN(ary); i+=2) {
- rb_yield(rb_assoc_new(RARRAY_PTR(ary)[i], RARRAY_PTR(ary)[i+1]));
+ if (rb_block_arity() > 1) {
+ for (i=0; i<RARRAY_LEN(ary); i+=2) {
+ rb_yield_values(2, RARRAY_AREF(ary, i), RARRAY_AREF(ary, i+1));
+ }
+ }
+ else {
+ for (i=0; i<RARRAY_LEN(ary); i+=2) {
+ rb_yield(rb_assoc_new(RARRAY_AREF(ary, i), RARRAY_AREF(ary, i+1)));
+ }
}
return ehash;
}
@@ -2719,14 +3139,14 @@ env_reject_bang(VALUE ehash)
int del = 0;
RETURN_SIZED_ENUMERATOR(ehash, 0, 0, rb_env_size);
- keys = env_keys(); /* rb_secure(4); */
- RBASIC(keys)->klass = 0;
+ keys = env_keys();
+ RBASIC_CLEAR_CLASS(keys);
for (i=0; i<RARRAY_LEN(keys); i++) {
- VALUE val = rb_f_getenv(Qnil, RARRAY_PTR(keys)[i]);
+ VALUE val = rb_f_getenv(Qnil, RARRAY_AREF(keys, i));
if (!NIL_P(val)) {
- if (RTEST(rb_yield_values(2, RARRAY_PTR(keys)[i], val))) {
- FL_UNSET(RARRAY_PTR(keys)[i], FL_TAINT);
- env_delete(Qnil, RARRAY_PTR(keys)[i]);
+ if (RTEST(rb_yield_values(2, RARRAY_AREF(keys, i), val))) {
+ FL_UNSET(RARRAY_AREF(keys, i), FL_TAINT);
+ env_delete(Qnil, RARRAY_AREF(keys, i));
del++;
}
}
@@ -2765,7 +3185,6 @@ env_values_at(int argc, VALUE *argv)
VALUE result;
long i;
- rb_secure(4);
result = rb_ary_new();
for (i=0; i<argc; i++) {
rb_ary_push(result, rb_f_getenv(Qnil, argv[i]));
@@ -2786,24 +3205,21 @@ static VALUE
env_select(VALUE ehash)
{
VALUE result;
- char **env;
+ VALUE keys;
+ long i;
RETURN_SIZED_ENUMERATOR(ehash, 0, 0, rb_env_size);
- rb_secure(4);
result = rb_hash_new();
- 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);
+ 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++;
}
- FREE_ENVIRON(environ);
return result;
}
@@ -2823,14 +3239,14 @@ env_select_bang(VALUE ehash)
int del = 0;
RETURN_SIZED_ENUMERATOR(ehash, 0, 0, rb_env_size);
- keys = env_keys(); /* rb_secure(4); */
- RBASIC(keys)->klass = 0;
+ keys = env_keys();
+ RBASIC_CLEAR_CLASS(keys);
for (i=0; i<RARRAY_LEN(keys); i++) {
- VALUE val = rb_f_getenv(Qnil, RARRAY_PTR(keys)[i]);
+ VALUE val = rb_f_getenv(Qnil, RARRAY_AREF(keys, i));
if (!NIL_P(val)) {
- if (!RTEST(rb_yield_values(2, RARRAY_PTR(keys)[i], val))) {
- FL_UNSET(RARRAY_PTR(keys)[i], FL_TAINT);
- env_delete(Qnil, RARRAY_PTR(keys)[i]);
+ if (!RTEST(rb_yield_values(2, RARRAY_AREF(keys, i), val))) {
+ FL_UNSET(RARRAY_AREF(keys, i), FL_TAINT);
+ env_delete(Qnil, RARRAY_AREF(keys, i));
del++;
}
}
@@ -2868,11 +3284,11 @@ rb_env_clear(void)
volatile VALUE keys;
long i;
- keys = env_keys(); /* rb_secure(4); */
+ keys = env_keys();
for (i=0; i<RARRAY_LEN(keys); i++) {
- VALUE val = rb_f_getenv(Qnil, RARRAY_PTR(keys)[i]);
+ VALUE val = rb_f_getenv(Qnil, RARRAY_AREF(keys, i));
if (!NIL_P(val)) {
- env_delete(Qnil, RARRAY_PTR(keys)[i]);
+ env_delete(Qnil, RARRAY_AREF(keys, i));
}
}
return envtbl;
@@ -2902,7 +3318,6 @@ env_inspect(void)
char **env;
VALUE str, i;
- rb_secure(4);
str = rb_str_buf_new2("{");
env = GET_ENVIRON(environ);
while (*env) {
@@ -2942,7 +3357,6 @@ env_to_a(void)
char **env;
VALUE ary;
- rb_secure(4);
ary = rb_ary_new();
env = GET_ENVIRON(environ);
while (*env) {
@@ -2983,7 +3397,6 @@ env_size(void)
int i;
char **env;
- rb_secure(4);
env = GET_ENVIRON(environ);
for (i=0; env[i]; i++)
;
@@ -3002,7 +3415,6 @@ env_empty_p(void)
{
char **env;
- rb_secure(4);
env = GET_ENVIRON(environ);
if (env[0] == 0) {
FREE_ENVIRON(environ);
@@ -3024,12 +3436,9 @@ env_empty_p(void)
static VALUE
env_has_key(VALUE env, VALUE key)
{
- char *s;
+ const char *s;
- rb_secure(4);
- s = StringValuePtr(key);
- if (memchr(s, '\0', RSTRING_LEN(key)))
- rb_raise(rb_eArgError, "bad environment variable name");
+ s = env_name(key);
if (getenv(s)) return Qtrue;
return Qfalse;
}
@@ -3044,12 +3453,9 @@ env_has_key(VALUE env, VALUE key)
static VALUE
env_assoc(VALUE env, VALUE key)
{
- char *s, *e;
+ const char *s, *e;
- rb_secure(4);
- s = StringValuePtr(key);
- if (memchr(s, '\0', RSTRING_LEN(key)))
- rb_raise(rb_eArgError, "bad environment variable name");
+ s = env_name(key);
e = getenv(s);
if (e) return rb_assoc_new(key, rb_tainted_str_new2(e));
return Qnil;
@@ -3067,9 +3473,9 @@ env_has_value(VALUE dmy, VALUE obj)
{
char **env;
- rb_secure(4);
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, '=');
@@ -3098,9 +3504,9 @@ env_rassoc(VALUE dmy, VALUE obj)
{
char **env;
- rb_secure(4);
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, '=');
@@ -3131,8 +3537,7 @@ env_key(VALUE dmy, VALUE value)
char **env;
VALUE str;
- rb_secure(4);
- StringValue(value);
+ SafeStringValue(value);
env = GET_ENVIRON(environ);
while (*env) {
char *s = strchr(*env, '=');
@@ -3177,7 +3582,6 @@ env_to_hash(void)
char **env;
VALUE hash;
- rb_secure(4);
hash = rb_hash_new();
env = GET_ENVIRON(environ);
while (*env) {
@@ -3217,8 +3621,8 @@ static VALUE
env_shift(void)
{
char **env;
+ VALUE result = Qnil;
- rb_secure(4);
env = GET_ENVIRON(environ);
if (*env) {
char *s = strchr(*env, '=');
@@ -3226,11 +3630,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);
- return rb_assoc_new(key, val);
+ result = rb_assoc_new(key, val);
}
}
FREE_ENVIRON(environ);
- return Qnil;
+ return result;
}
/*
@@ -3269,13 +3673,13 @@ env_replace(VALUE env, VALUE hash)
volatile VALUE keys;
long i;
- keys = env_keys(); /* rb_secure(4); */
+ keys = env_keys();
if (env == hash) return env;
hash = to_hash(hash);
rb_hash_foreach(hash, env_replace_i, keys);
for (i=0; i<RARRAY_LEN(keys); i++) {
- env_delete(env, RARRAY_PTR(keys)[i]);
+ env_delete(env, RARRAY_AREF(keys, i));
}
return env;
}
@@ -3303,7 +3707,6 @@ env_update_i(VALUE key, VALUE val)
static VALUE
env_update(VALUE env, VALUE hash)
{
- rb_secure(4);
if (env == hash) return env;
hash = to_hash(hash);
rb_hash_foreach(hash, env_update_i, 0);
@@ -3354,7 +3757,7 @@ env_update(VALUE env, VALUE hash)
*
* Accessing a value in a Hash requires using its key:
*
- * puts grades["Jane Doe"] # => 10
+ * puts grades["Jane Doe"] # => 0
*
* === Common Uses
*
@@ -3432,6 +3835,7 @@ 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);
@@ -3504,6 +3908,8 @@ 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);
+
/* Document-class: ENV
*
* ENV is a hash-like accessor for environment variables.
@@ -3566,4 +3972,7 @@ Init_Hash(void)
* See ENV (the class) for more details.
*/
rb_define_global_const("ENV", envtbl);
+
+ /* for callcc */
+ ruby_register_rollback_func_for_ensure(hash_foreach_ensure, hash_foreach_ensure_rollback);
}
diff --git a/include/ruby/backward/classext.h b/include/ruby/backward/classext.h
index 615e6f6858..33f3b014b8 100644
--- a/include/ruby/backward/classext.h
+++ b/include/ruby/backward/classext.h
@@ -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_EXT(c)->super)
+#define RCLASS_SUPER(c) (RCLASS(c)->super)
#endif /* RUBY_BACKWARD_CLASSEXT_H */
diff --git a/include/ruby/backward/rubysig.h b/include/ruby/backward/rubysig.h
index f46679ae67..ade4fe27bd 100644
--- a/include/ruby/backward/rubysig.h
+++ b/include/ruby/backward/rubysig.h
@@ -27,24 +27,15 @@ extern "C" {
#endif
#endif
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
+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)
#define ALLOW_INTS do {CHECK_INTS;} while (0)
#define CHECK_INTS rb_thread_check_ints()
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
-#endif
+RUBY_SYMBOL_EXPORT_END
#if defined(__cplusplus)
#if 0
diff --git a/include/ruby/debug.h b/include/ruby/debug.h
index 4ef45a8327..9bfc9b9a83 100644
--- a/include/ruby/debug.h
+++ b/include/ruby/debug.h
@@ -19,13 +19,25 @@ extern "C" {
#endif
#endif
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
+RUBY_SYMBOL_EXPORT_BEGIN
/* Note: This file contains experimental APIs. */
/* APIs can be replaced at Ruby 2.0.1 or later */
+
+/* profile frames APIs */
+int rb_profile_frames(int start, int limit, VALUE *buff, int *lines);
+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_full_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);
+VALUE rb_profile_frame_method_name(VALUE frame);
+VALUE rb_profile_frame_qualified_method_name(VALUE frame);
+
/* debug inspector APIs */
typedef struct rb_debug_inspector_struct rb_debug_inspector_t;
typedef VALUE (*rb_debug_inspector_func_t)(const rb_debug_inspector_t *, void *);
@@ -58,6 +70,7 @@ VALUE rb_tracepoint_enabled_p(VALUE tpval);
typedef struct rb_trace_arg_struct rb_trace_arg_t;
rb_trace_arg_t *rb_tracearg_from_tracepoint(VALUE tpval);
+rb_event_flag_t rb_tracearg_event_flag(rb_trace_arg_t *trace_arg);
VALUE rb_tracearg_event(rb_trace_arg_t *trace_arg);
VALUE rb_tracearg_lineno(rb_trace_arg_t *trace_arg);
VALUE rb_tracearg_path(rb_trace_arg_t *trace_arg);
@@ -67,6 +80,12 @@ VALUE rb_tracearg_binding(rb_trace_arg_t *trace_arg);
VALUE rb_tracearg_self(rb_trace_arg_t *trace_arg);
VALUE rb_tracearg_return_value(rb_trace_arg_t *trace_arg);
VALUE rb_tracearg_raised_exception(rb_trace_arg_t *trace_arg);
+VALUE rb_tracearg_object(rb_trace_arg_t *trace_arg);
+
+/* Postponed Job API */
+typedef void (*rb_postponed_job_func_t)(void *arg);
+int rb_postponed_job_register(unsigned int flags, rb_postponed_job_func_t func, void *data);
+int rb_postponed_job_register_one(unsigned int flags, rb_postponed_job_func_t func, void *data);
/* undocumented advanced tracing APIs */
@@ -79,9 +98,7 @@ typedef enum {
void rb_add_event_hook2(rb_event_hook_func_t func, rb_event_flag_t events, VALUE data, rb_event_hook_flag_t hook_flag);
void rb_thread_add_event_hook2(VALUE thval, rb_event_hook_func_t func, rb_event_flag_t events, VALUE data, rb_event_hook_flag_t hook_flag);
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
-#endif
+RUBY_SYMBOL_EXPORT_END
#if defined(__cplusplus)
#if 0
diff --git a/include/ruby/defines.h b/include/ruby/defines.h
index de0883d2c9..f83ced006c 100644
--- a/include/ruby/defines.h
+++ b/include/ruby/defines.h
@@ -22,12 +22,53 @@ extern "C" {
#include RUBY_EXTCONF_H
#endif
-#define RUBY
-
-# include <stddef.h>
-#ifdef HAVE_STDLIB_H
+/* AC_INCLUDES_DEFAULT */
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#ifdef HAVE_SYS_SELECT_H
+# include <sys/select.h>
+#endif
+
+#if defined HAVE_SETJMPEX_H && defined HAVE__SETJMPEX
+#include <setjmpex.h>
+#endif
+
+#include "ruby/missing.h"
+
+#define RUBY
+
#ifdef __cplusplus
# ifndef HAVE_PROTOTYPES
# define HAVE_PROTOTYPES 1
@@ -57,10 +98,13 @@ extern "C" {
#define ANYARGS
#endif
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
+#ifndef RUBY_SYMBOL_EXPORT_BEGIN
+# define RUBY_SYMBOL_EXPORT_BEGIN /* begin */
+# define RUBY_SYMBOL_EXPORT_END /* end */
#endif
+RUBY_SYMBOL_EXPORT_BEGIN
+
#define xmalloc ruby_xmalloc
#define xmalloc2 ruby_xmalloc2
#define xcalloc ruby_xcalloc
@@ -68,11 +112,17 @@ extern "C" {
#define xrealloc2 ruby_xrealloc2
#define xfree ruby_xfree
-void *xmalloc(size_t);
-void *xmalloc2(size_t,size_t);
-void *xcalloc(size_t,size_t);
-void *xrealloc(void*,size_t);
-void *xrealloc2(void*,size_t,size_t);
+#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)
+#endif
+
+void *xmalloc(size_t) RUBY_ATTR_ALLOC_SIZE((1));
+void *xmalloc2(size_t,size_t) RUBY_ATTR_ALLOC_SIZE((1,2));
+void *xcalloc(size_t,size_t) RUBY_ATTR_ALLOC_SIZE((1,2));
+void *xrealloc(void*,size_t) RUBY_ATTR_ALLOC_SIZE((2));
+void *xrealloc2(void*,size_t,size_t) RUBY_ATTR_ALLOC_SIZE((2,3));
void xfree(void*);
#define STRINGIZE(expr) STRINGIZE0(expr)
@@ -80,6 +130,10 @@ void xfree(void*);
#define STRINGIZE0(expr) #expr
#endif
+#ifdef HAVE_LONG_LONG
+# define HAVE_TRUE_LONG_LONG 1
+#endif
+
#if SIZEOF_LONG_LONG > 0
# define LONG_LONG long long
#elif SIZEOF___INT64 > 0
@@ -89,50 +143,6 @@ void xfree(void*);
# define SIZEOF_LONG_LONG SIZEOF___INT64
#endif
-#if 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
-
-#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"
-
#ifdef __CYGWIN__
#undef _WIN32
#endif
@@ -155,13 +165,6 @@ void xfree(void*);
#if defined(__BEOS__) && !defined(__HAIKU__) && !defined(BONE)
#include <net/socket.h> /* intern.h needs fd_set definition */
-#elif defined (__SYMBIAN32__) && defined (HAVE_SYS_SELECT_H)
-# include <sys/select.h>
-#endif
-
-#ifdef __SYMBIAN32__
-# define FALSE 0
-# define TRUE 1
#endif
#ifdef RUBY_EXPORT
@@ -237,9 +240,12 @@ void rb_ia64_flushrs(void);
#define RUBY_PLATFORM "unknown-unknown"
#endif
+#ifndef FUNC_MINIMIZED
+#define FUNC_MINIMIZED(x) x
+#endif
#ifndef RUBY_ALIAS_FUNCTION_TYPE
#define RUBY_ALIAS_FUNCTION_TYPE(type, prot, name, args) \
- type prot {return name args;}
+ FUNC_MINIMIZED(type prot) {return name args;}
#endif
#ifndef RUBY_ALIAS_FUNCTION_VOID
#define RUBY_ALIAS_FUNCTION_VOID(prot, name, args) \
@@ -250,9 +256,28 @@ void rb_ia64_flushrs(void);
RUBY_ALIAS_FUNCTION_TYPE(VALUE, prot, name, args)
#endif
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
+#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)
#if 0
diff --git a/include/ruby/encoding.h b/include/ruby/encoding.h
index 41640ec7e0..4a5324d62e 100644
--- a/include/ruby/encoding.h
+++ b/include/ruby/encoding.h
@@ -22,26 +22,17 @@ extern "C" {
#include <stdarg.h>
#include "ruby/oniguruma.h"
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
+RUBY_SYMBOL_EXPORT_BEGIN
-#define ENCODING_INLINE_MAX 1023
+#define ENCODING_INLINE_MAX 127
#define ENCODING_SHIFT (FL_USHIFT+10)
-#define ENCODING_MASK (((VALUE)ENCODING_INLINE_MAX)<<ENCODING_SHIFT)
+#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 ENCODING_SET(obj,i) do {\
- VALUE rb_encoding_set_obj = (obj); \
- int encoding_set_enc_index = (i); \
- if (encoding_set_enc_index < ENCODING_INLINE_MAX) \
- ENCODING_SET_INLINED(rb_encoding_set_obj, encoding_set_enc_index); \
- else \
- rb_enc_set_index(rb_encoding_set_obj, encoding_set_enc_index); \
-} while (0)
+#define ENCODING_SET(obj,i) rb_enc_set_index((obj), (i))
#define ENCODING_GET_INLINED(obj) (int)((RBASIC(obj)->flags & ENCODING_MASK)>>ENCODING_SHIFT)
#define ENCODING_GET(obj) \
@@ -77,27 +68,29 @@ extern "C" {
ENC_CODERANGE_SET(rb_encoding_coderange_obj, (cr)); \
} while (0)
-typedef OnigEncodingType rb_encoding;
+typedef const 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 *);
-#define rb_enc_to_index(enc) ((enc) ? ENC_TO_ENCINDEX(enc) : 0)
+int rb_enc_dummy_p(rb_encoding *enc);
+int rb_enc_to_index(rb_encoding *enc);
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_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);
@@ -112,13 +105,22 @@ VALUE rb_str_export_to_enc(VALUE, rb_encoding *);
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_cstr(str, enc) __extension__ ( \
+{ \
+ (__builtin_constant_p(str)) ? \
+ rb_enc_str_new((str), (long)strlen(str), (enc)) : \
+ rb_enc_str_new_cstr((str), (enc)); \
+})
+#endif
+
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
@@ -156,6 +158,9 @@ unsigned int rb_enc_codepoint(const char *p, const char *e, rb_encoding *enc);
/* -> codelen>0 or raise exception */
int rb_enc_codelen(int code, rb_encoding *enc);
+/* -> 0 for invalid codepoint */
+int rb_enc_code_to_mbclen(int code, rb_encoding *enc);
+#define rb_enc_code_to_mbclen(c, enc) ONIGENC_CODE_TO_MBCLEN((enc), (c));
/* code,ptr,encoding -> write buf */
#define rb_enc_mbcput(c,buf,enc) ONIGENC_CODE_TO_MBC((enc),(c),(UChar*)(buf))
@@ -203,9 +208,15 @@ rb_encoding *rb_locale_encoding(void);
rb_encoding *rb_filesystem_encoding(void);
rb_encoding *rb_default_external_encoding(void);
rb_encoding *rb_default_internal_encoding(void);
+#ifndef rb_ascii8bit_encindex
int rb_ascii8bit_encindex(void);
+#endif
+#ifndef rb_utf8_encindex
int rb_utf8_encindex(void);
+#endif
+#ifndef rb_usascii_encindex
int rb_usascii_encindex(void);
+#endif
int rb_locale_encindex(void);
int rb_filesystem_encindex(void);
VALUE rb_enc_default_external(void);
@@ -221,21 +232,9 @@ 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 */
@@ -299,6 +298,7 @@ VALUE rb_econv_str_convert(rb_econv_t *ec, VALUE src, int flags);
VALUE rb_econv_substr_convert(rb_econv_t *ec, VALUE src, long byteoff, long bytesize, int flags);
VALUE rb_econv_str_append(rb_econv_t *ec, VALUE src, VALUE dst, int flags);
VALUE rb_econv_substr_append(rb_econv_t *ec, VALUE src, long byteoff, long bytesize, VALUE dst, int flags);
+VALUE rb_econv_append(rb_econv_t *ec, const char *bytesrc, long bytesize, VALUE dst, int flags);
void rb_econv_binmode(rb_econv_t *ec);
@@ -340,9 +340,7 @@ void rb_econv_binmode(rb_econv_t *ec);
#define ECONV_AFTER_OUTPUT 0x00020000
/* end of flags for rb_econv_convert */
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
-#endif
+RUBY_SYMBOL_EXPORT_END
#if defined(__cplusplus)
#if 0
diff --git a/include/ruby/intern.h b/include/ruby/intern.h
index b1dff0b7b9..f9858537e1 100644
--- a/include/ruby/intern.h
+++ b/include/ruby/intern.h
@@ -32,19 +32,9 @@ extern "C" {
# include <varargs.h>
#endif
-#if defined(HAVE_SYS_TYPES_H)
-#include <sys/types.h>
-#endif
-
-#if defined(HAVE_SYS_TIME_H)
-#include <sys/time.h>
-#endif
-
#include "ruby/st.h"
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
+RUBY_SYMBOL_EXPORT_BEGIN
/*
* Functions and variables that are used by more than one source file of
@@ -58,21 +48,22 @@ void rb_mem_clear(register VALUE*, register long);
VALUE rb_assoc_new(VALUE, VALUE);
VALUE rb_check_array_type(VALUE);
VALUE rb_ary_new(void);
-VALUE rb_ary_new2(long);
-VALUE rb_ary_new3(long,...);
-VALUE rb_ary_new4(long, const VALUE *);
+VALUE rb_ary_new_capa(long capa);
+VALUE rb_ary_new_from_args(long n, ...);
+VALUE rb_ary_new_from_values(long n, const VALUE *elts);
VALUE rb_ary_tmp_new(long);
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, VALUE*, VALUE);
+VALUE rb_ary_aref(int, const VALUE*, VALUE);
VALUE rb_ary_subseq(VALUE, long, long);
void rb_ary_store(VALUE, long, VALUE);
VALUE rb_ary_dup(VALUE);
VALUE rb_ary_resurrect(VALUE ary);
VALUE rb_ary_to_ary(VALUE);
VALUE rb_ary_to_s(VALUE);
+VALUE rb_ary_cat(VALUE, const VALUE *, long);
VALUE rb_ary_push(VALUE, VALUE);
VALUE rb_ary_pop(VALUE);
VALUE rb_ary_shift(VALUE);
@@ -94,38 +85,31 @@ 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, VALUE*, VALUE(*)(VALUE,long));
+VALUE rb_get_values_at(VALUE, long, int, const 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(long, int);
+VALUE rb_big_new(size_t, 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, long len);
-VALUE rb_uint2big(VALUE);
-VALUE rb_int2big(SIGNED_VALUE);
-VALUE rb_uint2inum(VALUE);
-VALUE rb_int2inum(SIGNED_VALUE);
+void rb_big_resize(VALUE big, size_t 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);
-VALUE rb_big2str0(VALUE, int, int);
-SIGNED_VALUE rb_big2long(VALUE);
+long rb_big2long(VALUE);
#define rb_big2int(x) rb_big2long(x)
-VALUE rb_big2ulong(VALUE);
+unsigned long rb_big2ulong(VALUE);
#define rb_big2uint(x) rb_big2ulong(x)
-VALUE rb_big2ulong_pack(VALUE x);
#if HAVE_LONG_LONG
-VALUE rb_ll2inum(LONG_LONG);
-VALUE rb_ull2inum(unsigned 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);
@@ -147,6 +131,33 @@ VALUE rb_big_or(VALUE, VALUE);
VALUE rb_big_xor(VALUE, VALUE);
VALUE rb_big_lshift(VALUE, VALUE);
VALUE rb_big_rshift(VALUE, VALUE);
+
+/* For rb_integer_pack and rb_integer_unpack: */
+/* "MS" in MSWORD and MSBYTE means "most significant" */
+/* "LS" in LSWORD and LSBYTE means "least significant" */
+#define INTEGER_PACK_MSWORD_FIRST 0x01
+#define INTEGER_PACK_LSWORD_FIRST 0x02
+#define INTEGER_PACK_MSBYTE_FIRST 0x10
+#define INTEGER_PACK_LSBYTE_FIRST 0x20
+#define INTEGER_PACK_NATIVE_BYTE_ORDER 0x40
+#define INTEGER_PACK_2COMP 0x80
+#define INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION 0x400
+/* For rb_integer_unpack: */
+#define INTEGER_PACK_FORCE_BIGNUM 0x100
+#define INTEGER_PACK_NEGATIVE 0x200
+/* Combinations: */
+#define INTEGER_PACK_LITTLE_ENDIAN \
+ (INTEGER_PACK_LSWORD_FIRST | \
+ INTEGER_PACK_LSBYTE_FIRST)
+#define INTEGER_PACK_BIG_ENDIAN \
+ (INTEGER_PACK_MSWORD_FIRST | \
+ INTEGER_PACK_MSBYTE_FIRST)
+int rb_integer_pack(VALUE val, void *words, size_t numwords, size_t wordsize, size_t nails, int flags);
+VALUE rb_integer_unpack(const void *words, size_t numwords, size_t wordsize, size_t nails, int flags);
+size_t rb_absint_size(VALUE val, int *nlz_bits_ret);
+size_t rb_absint_numwords(VALUE val, size_t word_numbits, size_t *nlz_bits_ret);
+int rb_absint_singlebit_p(VALUE val);
+
/* rational.c */
VALUE rb_rational_raw(VALUE, VALUE);
#define rb_rational_raw1(x) rb_rational_raw((x), INT2FIX(1))
@@ -157,6 +168,10 @@ 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 */
VALUE rb_complex_raw(VALUE, VALUE);
#define rb_complex_raw1(x) rb_complex_raw((x), INT2FIX(0))
@@ -168,6 +183,8 @@ 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);
@@ -186,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, 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);
+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);
void rb_define_method_id(VALUE, ID, VALUE (*)(ANYARGS), int);
void rb_frozen_class_p(VALUE);
void rb_undef(VALUE, ID);
@@ -203,15 +220,20 @@ 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, VALUE *args);
-VALUE rb_fiber_yield(int argc, VALUE *args);
+VALUE rb_fiber_resume(VALUE fib, int argc, const VALUE *argv);
+VALUE rb_fiber_yield(int argc, const VALUE *argv);
VALUE rb_fiber_current(void);
VALUE rb_fiber_alive_p(VALUE);
/* enum.c */
-VALUE rb_enum_values_pack(int, VALUE*);
+VALUE rb_enum_values_pack(int, const VALUE*);
/* enumerator.c */
-VALUE rb_enumeratorize(VALUE, VALUE, int, VALUE *);
-VALUE rb_enumeratorize_with_size(VALUE, VALUE, int, VALUE *, VALUE (*)(ANYARGS));
+VALUE rb_enumeratorize(VALUE, VALUE, int, const VALUE *);
+typedef VALUE rb_enumerator_size_func(VALUE, VALUE, VALUE);
+VALUE rb_enumeratorize_with_size(VALUE, VALUE, int, const 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 RETURN_SIZED_ENUMERATOR(obj, argc, argv, size_fn) do { \
if (!rb_block_given_p()) \
return rb_enumeratorize_with_size((obj), ID2SYM(rb_frame_this_func()),\
@@ -220,8 +242,10 @@ VALUE rb_enumeratorize_with_size(VALUE, VALUE, int, VALUE *, VALUE (*)(ANYARGS))
#define RETURN_ENUMERATOR(obj, argc, argv) RETURN_SIZED_ENUMERATOR(obj, argc, argv, 0)
/* error.c */
VALUE rb_exc_new(VALUE, const char*, long);
-VALUE rb_exc_new2(VALUE, const char*);
-VALUE rb_exc_new3(VALUE, VALUE);
+VALUE rb_exc_new_cstr(VALUE, const char*);
+VALUE rb_exc_new_str(VALUE, VALUE);
+#define rb_exc_new2 rb_exc_new_cstr
+#define rb_exc_new3 rb_exc_new_str
PRINTF_ARGS(NORETURN(void rb_loaderror(const char*, ...)), 1, 2);
PRINTF_ARGS(NORETURN(void rb_loaderror_with_path(VALUE path, const char*, ...)), 2, 3);
PRINTF_ARGS(NORETURN(void rb_name_error(ID, const char*, ...)), 2, 3);
@@ -240,12 +264,7 @@ void rb_check_trusted(VALUE);
rb_error_frozen(rb_obj_classname(frozen_obj)); \
} \
} while (0)
-#define rb_check_trusted_internal(obj) do { \
- VALUE untrusted_obj = (obj); \
- if (!OBJ_UNTRUSTED(untrusted_obj)) { \
- rb_error_untrusted(untrusted_obj); \
- } \
- } while (0)
+#define rb_check_trusted_internal(obj) ((void) 0)
#ifdef __GNUC__
#define rb_check_frozen(obj) __extension__({rb_check_frozen_internal(obj);})
#define rb_check_trusted(obj) __extension__({rb_check_trusted_internal(obj);})
@@ -271,13 +290,16 @@ void rb_check_copyable(VALUE obj, VALUE orig);
/* eval.c */
int rb_sourceline(void);
const char *rb_sourcefile(void);
-VALUE rb_check_funcall(VALUE, ID, int, VALUE*);
+VALUE rb_check_funcall(VALUE, ID, int, const VALUE*);
NORETURN(void rb_error_arity(int, int, int));
-#define rb_check_arity(argc, min, max) do { \
- if (((argc) < (min)) || ((argc) > (max) && (max) != UNLIMITED_ARGUMENTS)) \
- rb_error_arity(argc, min, max); \
- } while(0)
+#define rb_check_arity rb_check_arity /* for ifdef */
+static inline void
+rb_check_arity(int argc, int min, int max)
+{
+ if ((argc < min) || (max != UNLIMITED_ARGUMENTS && argc > max))
+ rb_error_arity(argc, min, max);
+}
#if defined(NFDBITS) && defined(HAVE_RB_FD_INIT)
typedef struct {
@@ -342,8 +364,8 @@ typedef fd_set rb_fdset_t;
NORETURN(void rb_exc_raise(VALUE));
NORETURN(void rb_exc_fatal(VALUE));
-VALUE rb_f_exit(int,VALUE*);
-VALUE rb_f_abort(int,VALUE*);
+VALUE rb_f_exit(int, const VALUE*);
+VALUE rb_f_abort(int, const VALUE*);
void rb_remove_method(VALUE, const char*);
void rb_remove_method_id(VALUE, ID);
#define rb_disable_super(klass, name) ((void)0)
@@ -354,7 +376,8 @@ 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);
void rb_clear_cache(void);
-void rb_clear_cache_by_class(VALUE);
+void rb_clear_constant_cache(void);
+void rb_clear_method_cache_by_class(VALUE);
void rb_alias(VALUE, ID, ID);
void rb_attr(VALUE,ID,int,int,int);
int rb_method_boundp(VALUE, ID, int);
@@ -362,15 +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, VALUE *argv, VALUE obj);
+VALUE rb_f_notimplement(int argc, const 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, 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);
+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);
void rb_load(VALUE, int);
void rb_load_protect(VALUE, int, int*);
NORETURN(void rb_jump_tag(int));
@@ -379,22 +402,21 @@ 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, VALUE*);
-VALUE rb_class_new_instance(int, VALUE*, VALUE);
+void rb_obj_call_init(VALUE, int, const VALUE*);
+VALUE rb_class_new_instance(int, const VALUE*, VALUE);
VALUE rb_block_proc(void);
-DEPRECATED(VALUE rb_f_lambda(void));
VALUE rb_block_lambda(void);
VALUE rb_proc_new(VALUE (*)(ANYARGS/* VALUE yieldarg[, VALUE procarg] */), VALUE);
VALUE rb_obj_is_proc(VALUE);
VALUE rb_proc_call(VALUE, VALUE);
-VALUE rb_proc_call_with_block(VALUE, int argc, VALUE *argv, VALUE);
+VALUE rb_proc_call_with_block(VALUE, int argc, const VALUE *argv, VALUE);
int rb_proc_arity(VALUE);
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, VALUE*, VALUE);
-VALUE rb_method_call_with_block(int, VALUE *, VALUE, VALUE);
+VALUE rb_method_call(int, const VALUE*, VALUE);
+VALUE rb_method_call_with_block(int, const VALUE *, VALUE, VALUE);
int rb_mod_method_arity(VALUE, ID);
int rb_obj_method_arity(VALUE, ID);
VALUE rb_protect(VALUE (*)(VALUE), VALUE, int*);
@@ -405,16 +427,15 @@ 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);
VALUE rb_thread_stop(void);
VALUE rb_thread_wakeup(VALUE);
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);
@@ -430,9 +451,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, VALUE *);
+VALUE rb_file_s_expand_path(int, const VALUE *);
VALUE rb_file_expand_path(VALUE, VALUE);
-VALUE rb_file_s_absolute_path(int, VALUE *);
+VALUE rb_file_s_absolute_path(int, const 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);
@@ -445,7 +466,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(VALUE*, VALUE*);
+void rb_gc_mark_locations(const VALUE*, const VALUE*);
void rb_mark_tbl(struct st_table*);
void rb_mark_set(struct st_table*);
void rb_mark_hash(struct st_table*);
@@ -459,7 +480,11 @@ void rb_gc_call_finalizer_at_exit(void);
VALUE rb_gc_enable(void);
VALUE rb_gc_disable(void);
VALUE rb_gc_start(void);
-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);
@@ -476,12 +501,16 @@ VALUE rb_hash_aset(VALUE, VALUE, VALUE);
VALUE rb_hash_clear(VALUE);
VALUE rb_hash_delete_if(VALUE);
VALUE rb_hash_delete(VALUE,VALUE);
+VALUE rb_hash_set_ifnone(VALUE hash, VALUE ifnone);
typedef VALUE rb_hash_update_func(VALUE newkey, VALUE oldkey, VALUE value);
VALUE rb_hash_update_by(VALUE hash1, VALUE hash2, rb_hash_update_func *func);
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;
@@ -500,9 +529,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, VALUE*, VALUE);
-VALUE rb_io_print(int, VALUE*, VALUE);
-VALUE rb_io_puts(int, 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_fdopen(int, int, const char*);
VALUE rb_io_get_io(VALUE);
VALUE rb_file_open(const char*, const char*);
@@ -594,25 +623,12 @@ 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*);
-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*);
+VALUE rb_f_exec(int, const 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, VALUE*);
-rb_pid_t rb_spawn_err(int, VALUE*, char*, size_t);
+rb_pid_t rb_spawn(int, const VALUE*);
+rb_pid_t rb_spawn_err(int, const VALUE*, char*, size_t);
VALUE rb_proc_times(VALUE);
VALUE rb_detach_process(rb_pid_t pid);
/* range.c */
@@ -653,8 +669,9 @@ int rb_reg_options(VALUE);
RUBY_EXTERN VALUE rb_argv0;
VALUE rb_get_argv(void);
void *rb_load_file(const char*);
+void *rb_load_file_str(VALUE);
/* signal.c */
-VALUE rb_f_kill(int, VALUE*);
+VALUE rb_f_kill(int, const VALUE*);
#ifdef POSIX_SIGNAL
#define posix_signal ruby_posix_signal
RETSIGTYPE (*posix_signal(int, RETSIGTYPE (*)(int)))(int);
@@ -673,16 +690,11 @@ VALUE rb_str_format(int, const VALUE *, VALUE);
/* string.c */
VALUE rb_str_new(const char*, long);
VALUE rb_str_new_cstr(const char*);
-VALUE rb_str_new2(const char*);
VALUE rb_str_new_shared(VALUE);
-VALUE rb_str_new3(VALUE);
VALUE rb_str_new_frozen(VALUE);
-VALUE rb_str_new4(VALUE);
VALUE rb_str_new_with_class(VALUE, const char*, long);
-VALUE rb_str_new5(VALUE, const char*, long);
VALUE rb_tainted_str_new_cstr(const char*);
VALUE rb_tainted_str_new(const char*, long);
-VALUE rb_tainted_str_new2(const char*);
VALUE rb_external_str_new(const char*, long);
VALUE rb_external_str_new_cstr(const char*);
VALUE rb_locale_str_new(const char*, long);
@@ -695,7 +707,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_usascii_str_new2(const char*);
void rb_str_free(VALUE);
void rb_str_shared_replace(VALUE, VALUE);
VALUE rb_str_buf_append(VALUE, VALUE);
@@ -716,12 +727,14 @@ VALUE rb_str_times(VALUE, VALUE);
long rb_str_sublen(VALUE, long);
VALUE rb_str_substr(VALUE, long, long);
VALUE rb_str_subseq(VALUE, long, long);
+char *rb_str_subpos(VALUE, long, long*);
void rb_str_modify(VALUE);
void rb_str_modify_expand(VALUE, long);
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);
@@ -744,8 +757,8 @@ VALUE rb_str_replace(VALUE, VALUE);
VALUE rb_str_inspect(VALUE);
VALUE rb_str_dump(VALUE);
VALUE rb_str_split(VALUE, const char*);
-void rb_str_associate(VALUE, VALUE);
-VALUE rb_str_associated(VALUE);
+DEPRECATED(void rb_str_associate(VALUE, VALUE));
+DEPRECATED(VALUE rb_str_associated(VALUE));
void rb_str_setter(VALUE, ID, VALUE*);
VALUE rb_str_intern(VALUE);
VALUE rb_sym_to_s(VALUE);
@@ -754,6 +767,7 @@ VALUE rb_str_length(VALUE);
long rb_str_offset(VALUE, long);
size_t rb_str_capacity(VALUE);
VALUE rb_str_ellipsize(VALUE, long);
+VALUE rb_str_scrub(VALUE, VALUE);
#if defined(__GNUC__) && !defined(__PCC__)
#define rb_str_new_cstr(str) __extension__ ( \
{ \
@@ -792,23 +806,17 @@ VALUE rb_str_ellipsize(VALUE, long);
(str), (long)strlen(str)) : \
rb_str_buf_new_cstr(str); \
})
-#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__ ( \
+#define rb_str_cat_cstr(str, ptr) __extension__ ( \
{ \
(__builtin_constant_p(ptr)) ? \
rb_str_cat((str), (ptr), (long)strlen(ptr)) : \
- rb_str_cat2((str), (ptr)); \
+ rb_str_cat_cstr((str), (ptr)); \
})
-#define rb_exc_new2(klass, ptr) __extension__ ( \
+#define rb_exc_new_cstr(klass, ptr) __extension__ ( \
{ \
(__builtin_constant_p(ptr)) ? \
rb_exc_new((klass), (ptr), (long)strlen(ptr)) : \
- rb_exc_new2((klass), (ptr)); \
+ rb_exc_new_cstr((klass), (ptr)); \
})
#endif
#define rb_str_new2 rb_str_new_cstr
@@ -818,28 +826,30 @@ VALUE rb_str_ellipsize(VALUE, long);
#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
/* struct.c */
VALUE rb_struct_new(VALUE, ...);
VALUE rb_struct_define(const char*, ...);
+VALUE rb_struct_define_under(VALUE, const char*, ...);
VALUE rb_struct_alloc(VALUE, VALUE);
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);
VALUE rb_struct_define_without_accessor(const char *, VALUE, rb_alloc_func_t, ...);
+VALUE rb_struct_define_without_accessor_under(VALUE outer, const char *class_name, VALUE super, rb_alloc_func_t alloc, ...);
+
/* thread.c */
typedef void rb_unblock_function_t(void *);
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);
@@ -859,6 +869,7 @@ 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);
@@ -868,8 +879,8 @@ VALUE rb_class_name(VALUE);
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, VALUE*);
-VALUE rb_f_untrace_var(int, VALUE*);
+VALUE rb_f_trace_var(int, const VALUE*);
+VALUE rb_f_untrace_var(int, const VALUE*);
VALUE rb_f_global_variables(void);
void rb_alias_variable(ID, ID);
struct st_table* rb_generic_ivar_table(VALUE);
@@ -880,15 +891,13 @@ VALUE rb_ivar_set(VALUE, ID, VALUE);
VALUE rb_ivar_defined(VALUE, ID);
void rb_ivar_foreach(VALUE, int (*)(ANYARGS), st_data_t);
st_index_t rb_ivar_count(VALUE);
-VALUE rb_iv_set(VALUE, const char*, VALUE);
-VALUE rb_iv_get(VALUE, const char*);
VALUE rb_attr_get(VALUE, ID);
VALUE rb_obj_instance_variables(VALUE);
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, VALUE *, VALUE);
+VALUE rb_mod_constants(int, const VALUE *, VALUE);
VALUE rb_mod_remove_const(VALUE, VALUE);
int rb_const_defined(VALUE, ID);
int rb_const_defined_at(VALUE, ID);
@@ -905,20 +914,21 @@ 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, VALUE*, VALUE);
+VALUE rb_mod_class_variables(int, const 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, VALUE*);
+VALUE rb_make_exception(int, const VALUE*);
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
-#endif
+/* deprecated */
+DEPRECATED(void rb_frame_pop(void));
+
+
+RUBY_SYMBOL_EXPORT_END
#if defined(__cplusplus)
#if 0
diff --git a/include/ruby/io.h b/include/ruby/io.h
index b5ea2e9c95..cc3f5e60b1 100644
--- a/include/ruby/io.h
+++ b/include/ruby/io.h
@@ -49,20 +49,19 @@ extern "C" {
# define RB_WAITFD_OUT 0x004
#endif
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
+RUBY_SYMBOL_EXPORT_BEGIN
-typedef struct {
+PACKED_STRUCT_UNALIGNED(struct rb_io_buffer_t {
char *ptr; /* off + len <= capa */
int off;
int len;
int capa;
-} rb_io_buffer_t;
+});
+typedef struct rb_io_buffer_t rb_io_buffer_t;
typedef struct rb_io_t {
- int fd; /* file descriptor */
FILE *stdio_file; /* stdio ptr for read/write if available */
+ int fd; /* file descriptor */
int mode; /* mode flags: FMODE_XXXs */
rb_pid_t pid; /* child's pid (for pipes) */
int lineno; /* number of lines read */
@@ -91,9 +90,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;
@@ -197,11 +196,13 @@ 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*));
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
-#endif
+struct stat;
+VALUE rb_stat_new(const struct stat *);
+
+/* gc.c */
+
+RUBY_SYMBOL_EXPORT_END
#if defined(__cplusplus)
#if 0
diff --git a/include/ruby/missing.h b/include/ruby/missing.h
index 9b502cd3d8..161d95430a 100644
--- a/include/ruby/missing.h
+++ b/include/ruby/missing.h
@@ -21,6 +21,9 @@ 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
@@ -34,6 +37,11 @@ extern "C" {
#endif
#endif
+#ifndef RUBY_SYMBOL_EXPORT_BEGIN
+# define RUBY_SYMBOL_EXPORT_BEGIN /* begin */
+# define RUBY_SYMBOL_EXPORT_END /* end */
+#endif
+
#if !defined(HAVE_STRUCT_TIMEVAL)
struct timeval {
time_t tv_sec; /* seconds */
@@ -62,9 +70,7 @@ struct timezone {
#define RUBY_EXTERN extern
#endif
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
+RUBY_SYMBOL_EXPORT_BEGIN
#ifndef HAVE_ACOSH
RUBY_EXTERN double acosh(double);
@@ -165,6 +171,10 @@ RUBY_EXTERN int isnan(double);
# 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);
@@ -229,9 +239,7 @@ RUBY_EXTERN int ruby_close(int);
RUBY_EXTERN void setproctitle(const char *fmt, ...);
#endif
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
-#endif
+RUBY_SYMBOL_EXPORT_END
#if defined(__cplusplus)
#if 0
diff --git a/include/ruby/oniguruma.h b/include/ruby/oniguruma.h
index 0b645bd935..2530f61427 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-2013 K.Takata <kentkt AT csc DOT jp>
+ * Copyright (c) 2011-2014 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 13
-#define ONIGURUMA_VERSION_TEENY 5
+#define ONIGURUMA_VERSION_MINOR 15
+#define ONIGURUMA_VERSION_TEENY 0
#ifdef __cplusplus
# ifndef HAVE_PROTOTYPES
@@ -98,9 +98,7 @@ extern "C" {
#define ONIG_EXTERN extern
#endif
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
+RUBY_SYMBOL_EXPORT_BEGIN
#include <stddef.h> /* for size_t */
@@ -158,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, struct OnigEncodingTypeST* enc);
+ int (*precise_mbc_enc_len)(const OnigUChar* p,const OnigUChar* e, const struct OnigEncodingTypeST* enc);
const char* name;
int max_enc_len;
int min_enc_len;
- 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 (*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, OnigUChar* p, 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 ruby_encoding_index;
unsigned int flags;
} OnigEncodingType;
-typedef OnigEncodingType* OnigEncoding;
+typedef const OnigEncodingType* OnigEncoding;
-ONIG_EXTERN OnigEncodingType OnigEncodingASCII;
+ONIG_EXTERN const OnigEncodingType OnigEncodingASCII;
#define ONIG_ENCODING_ASCII (&OnigEncodingASCII)
@@ -258,7 +256,7 @@ ONIG_EXTERN 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, struct OnigEncodingTypeST* enc));
+int onigenc_mbclen_approximate P_((const OnigUChar* p,const OnigUChar* e, const 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)
@@ -340,6 +338,7 @@ 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 */
@@ -371,7 +370,9 @@ 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_MAXBIT ONIG_OPTION_NEWLINE_CRLF /* limit */
+#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_ON(options,regopt) ((options) |= (regopt))
#define ONIG_OPTION_OFF(options,regopt) ((options) &= ~(regopt))
@@ -584,6 +585,7 @@ 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
@@ -672,13 +674,15 @@ 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;
- OnigCaseFoldType case_fold_flag;
void* name_table;
+ OnigCaseFoldType case_fold_flag;
/* optimization info (string search, char-map and anchors) */
int optimize; /* optimize flag */
@@ -710,7 +714,7 @@ typedef struct {
int num_of_elements;
OnigEncoding pattern_enc;
OnigEncoding target_enc;
- OnigSyntaxType* syntax;
+ const OnigSyntaxType* syntax;
OnigOptionType option;
OnigCaseFoldType case_fold_flag;
} OnigCompileInfo;
@@ -809,7 +813,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_((OnigEncoding to, OnigEncoding from));
+void onig_copy_encoding P_((OnigEncodingType *to, OnigEncoding from));
ONIG_EXTERN
OnigCaseFoldType onig_get_default_case_fold_flag P_((void));
ONIG_EXTERN
@@ -825,9 +829,7 @@ const char* onig_version P_((void));
ONIG_EXTERN
const char* onig_copyright P_((void));
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
-#endif
+RUBY_SYMBOL_EXPORT_END
#ifdef __cplusplus
#if 0
diff --git a/include/ruby/re.h b/include/ruby/re.h
index 4039ba1800..41b3e492f8 100644
--- a/include/ruby/re.h
+++ b/include/ruby/re.h
@@ -24,9 +24,7 @@ extern "C" {
#include "ruby/regex.h"
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
+RUBY_SYMBOL_EXPORT_BEGIN
typedef struct re_pattern_buffer Regexp;
@@ -61,9 +59,7 @@ void rb_match_busy(VALUE);
VALUE rb_reg_quote(VALUE);
regex_t *rb_reg_prepare_re(VALUE re, VALUE str);
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
-#endif
+RUBY_SYMBOL_EXPORT_END
#if defined(__cplusplus)
#if 0
diff --git a/include/ruby/regex.h b/include/ruby/regex.h
index aeb6418d0a..024bed4a4e 100644
--- a/include/ruby/regex.h
+++ b/include/ruby/regex.h
@@ -24,9 +24,7 @@ extern "C" {
#include "oniguruma.h"
#endif
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
+RUBY_SYMBOL_EXPORT_BEGIN
#ifndef ONIG_RUBY_M17N
@@ -36,9 +34,7 @@ ONIG_EXTERN OnigEncoding OnigEncDefaultCharEncoding;
#endif /* ifndef ONIG_RUBY_M17N */
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
-#endif
+RUBY_SYMBOL_EXPORT_END
#if defined(__cplusplus)
#if 0
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index 833bd2d8de..4b57e7848b 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -26,6 +26,8 @@ extern "C" {
#include RUBY_EXTCONF_H
#endif
+#include "defines.h"
+
#define NORETURN_STYLE_NEW 1
#ifndef NORETURN
# define NORETURN(x) x
@@ -47,31 +49,13 @@ extern "C" {
#define PRINTF_ARGS(decl, string_index, first_to_check) decl
#endif
-#ifdef HAVE_STRING_H
-# include <string.h>
-#else
-# include <strings.h>
-#endif
-
#ifdef HAVE_INTRINSICS_H
# include <intrinsics.h>
#endif
-#ifdef HAVE_STDINT_H
-# include <stdint.h>
-#endif
-#ifdef HAVE_INTTYPES_H
-# include <inttypes.h>
-#endif
-
#include <stdarg.h>
-#include <stdio.h>
-#include "defines.h"
-
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
+RUBY_SYMBOL_EXPORT_BEGIN
/* Make alloca work the best possible way. */
#ifdef __GNUC__
@@ -119,7 +103,7 @@ typedef unsigned LONG_LONG ID;
typedef char ruby_check_sizeof_int[SIZEOF_INT == sizeof(int) ? 1 : -1];
typedef char ruby_check_sizeof_long[SIZEOF_LONG == sizeof(long) ? 1 : -1];
-#ifdef SIZEOF_LONG_LONG
+#ifdef HAVE_LONG_LONG
typedef char ruby_check_sizeof_long_long[SIZEOF_LONG_LONG == sizeof(LONG_LONG) ? 1 : -1];
#endif
typedef char ruby_check_sizeof_voidp[SIZEOF_VOIDP == sizeof(void*) ? 1 : -1];
@@ -131,6 +115,12 @@ typedef char ruby_check_sizeof_voidp[SIZEOF_VOIDP == sizeof(void*) ? 1 : -1];
#define PRI_LONG_PREFIX "l"
#endif
+#if SIZEOF_LONG == 8
+#define PRI_64_PREFIX PRI_LONG_PREFIX
+#elif SIZEOF_LONG_LONG == 8
+#define PRI_64_PREFIX PRI_LL_PREFIX
+#endif
+
#if defined PRIdPTR && !defined PRI_VALUE_PREFIX
#define PRIdVALUE PRIdPTR
#define PRIoVALUE PRIoPTR
@@ -197,7 +187,7 @@ typedef char ruby_check_sizeof_voidp[SIZEOF_VOIDP == sizeof(void*) ? 1 : -1];
# ifdef HAVE_LIMITS_H
# include <limits.h>
# else
- /* assuming 32bit(2's compliment) long */
+ /* assuming 32bit(2's complement) long */
# define LONG_MAX 2147483647
# endif
# endif
@@ -255,6 +245,7 @@ VALUE rb_ull2inum(unsigned LONG_LONG);
#define ULL2NUM(v) rb_ull2inum(v)
#endif
+#ifndef OFFT2NUM
#if SIZEOF_OFF_T > SIZEOF_LONG && defined(HAVE_LONG_LONG)
# define OFFT2NUM(v) LL2NUM(v)
#elif SIZEOF_OFF_T == SIZEOF_LONG
@@ -262,6 +253,7 @@ VALUE rb_ull2inum(unsigned LONG_LONG);
#else
# define OFFT2NUM(v) INT2NUM(v)
#endif
+#endif
#if SIZEOF_SIZE_T > SIZEOF_LONG && defined(HAVE_LONG_LONG)
# define SIZET2NUM(v) ULL2NUM(v)
@@ -350,8 +342,8 @@ rb_long2int_inline(long n)
#define MODET2NUM(v) INT2NUM(v)
#endif
-#define FIX2LONG(x) (long)RSHIFT((SIGNED_VALUE)(x),1)
-#define FIX2ULONG(x) ((((VALUE)(x))>>1)&LONG_MAX)
+#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)
@@ -359,9 +351,13 @@ rb_long2int_inline(long n)
#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)
+ID rb_sym2id(VALUE);
+VALUE rb_id2sym(ID);
+#define STATIC_SYM_P(x) (((VALUE)(x)&~((~(VALUE)0)<<RUBY_SPECIAL_SHIFT))==SYMBOL_FLAG)
+#define DYNAMIC_SYM_P(x) (!SPECIAL_CONST_P(x) && BUILTIN_TYPE(x) == (T_SYMBOL))
+#define SYMBOL_P(x) (STATIC_SYM_P(x)||DYNAMIC_SYM_P(x))
+#define ID2SYM(x) (rb_id2sym(x))
+#define SYM2ID(x) (rb_sym2id(x))
#ifndef USE_FLONUM
#if SIZEOF_VALUE >= SIZEOF_DOUBLE
@@ -380,54 +376,32 @@ rb_long2int_inline(long n)
/* 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,
- RUBY_Qtrue = 0x14,
- RUBY_Qnil = 0x08,
- RUBY_Qundef = 0x34,
+ RUBY_Qfalse = 0x00, /* ...0000 0000 */
+ RUBY_Qtrue = 0x14, /* ...0001 0100 */
+ RUBY_Qnil = 0x08, /* ...0000 1000 */
+ RUBY_Qundef = 0x34, /* ...0011 0100 */
RUBY_IMMEDIATE_MASK = 0x07,
- RUBY_FIXNUM_FLAG = 0x01,
+ RUBY_FIXNUM_FLAG = 0x01, /* ...xxxx xxx1 */
RUBY_FLONUM_MASK = 0x03,
- RUBY_FLONUM_FLAG = 0x02,
- RUBY_SYMBOL_FLAG = 0x0c,
- RUBY_SPECIAL_SHIFT = 8
+ RUBY_FLONUM_FLAG = 0x02, /* ...xxxx xx10 */
+ RUBY_SYMBOL_FLAG = 0x0c, /* ...0000 1100 */
#else
- RUBY_Qfalse = 0,
- RUBY_Qtrue = 2,
- RUBY_Qnil = 4,
- RUBY_Qundef = 6,
+ RUBY_Qfalse = 0, /* ...0000 0000 */
+ RUBY_Qtrue = 2, /* ...0000 0010 */
+ RUBY_Qnil = 4, /* ...0000 0100 */
+ RUBY_Qundef = 6, /* ...0000 0110 */
RUBY_IMMEDIATE_MASK = 0x03,
- RUBY_FIXNUM_FLAG = 0x01,
+ RUBY_FIXNUM_FLAG = 0x01, /* ...xxxx xxx1 */
RUBY_FLONUM_MASK = 0x00, /* any values ANDed with FLONUM_MASK cannot be FLONUM_FLAG */
RUBY_FLONUM_FLAG = 0x02,
- RUBY_SYMBOL_FLAG = 0x0e,
- RUBY_SPECIAL_SHIFT = 8
+ RUBY_SYMBOL_FLAG = 0x0e, /* ...0000 1110 */
#endif
+ RUBY_SPECIAL_SHIFT = 8
};
#define Qfalse ((VALUE)RUBY_Qfalse)
@@ -520,17 +494,22 @@ static inline int rb_type(VALUE obj);
#else
#ifdef _MSC_VER
#pragma optimize("", off)
-#endif
static inline volatile VALUE *rb_gc_guarded_ptr(volatile VALUE *ptr) {return ptr;}
-#ifdef _MSC_VER
#pragma optimize("", on)
+#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)))
#endif
#define RB_GC_GUARD_PTR(ptr) rb_gc_guarded_ptr(ptr)
#endif
+
+#ifndef RB_GC_GUARD
#define RB_GC_GUARD(v) (*RB_GC_GUARD_PTR(&(v)))
+#endif
#ifdef __GNUC__
-#define RB_UNUSED_VAR(x) x __attribute__ ((unused))
+#define RB_UNUSED_VAR(x) x __attribute__ ((unused))
#else
#define RB_UNUSED_VAR(x) x
#endif
@@ -548,13 +527,10 @@ 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)
-/* obsolete macro - use SafeStringValue(v) */
-#define Check_SafeStr(v) rb_check_safe_str((VALUE)(v))
VALUE rb_str_export(VALUE);
#define ExportStringValue(v) do {\
@@ -569,9 +545,24 @@ 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 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_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_4_warning() ruby_safe_level_4_error()
+# endif
+#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_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
void rb_set_safe_level_force(int);
void rb_secure_update(VALUE);
NORETURN(void rb_insecure_operation(void));
@@ -579,15 +570,15 @@ NORETURN(void rb_insecure_operation(void));
VALUE rb_errinfo(void);
void rb_set_errinfo(VALUE);
-SIGNED_VALUE rb_num2long(VALUE);
-VALUE rb_num2ulong(VALUE);
+long rb_num2long(VALUE);
+unsigned long rb_num2ulong(VALUE);
static inline long
rb_num2long_inline(VALUE x)
{
if (FIXNUM_P(x))
return FIX2LONG(x);
else
- return (long)rb_num2long(x);
+ return rb_num2long(x);
}
#define NUM2LONG(x) rb_num2long_inline(x)
static inline unsigned long
@@ -596,7 +587,7 @@ rb_num2ulong_inline(VALUE x)
if (FIXNUM_P(x))
return (unsigned long)FIX2LONG(x);
else
- return (unsigned long)rb_num2ulong(x);
+ return rb_num2ulong(x);
}
#define NUM2ULONG(x) rb_num2ulong_inline(x)
#if SIZEOF_INT < SIZEOF_LONG
@@ -657,10 +648,12 @@ rb_num2ll_inline(VALUE x)
# define NUM2ULL(x) rb_num2ull(x)
#endif
-#if defined(HAVE_LONG_LONG) && SIZEOF_OFF_T > SIZEOF_LONG
-# define NUM2OFFT(x) ((off_t)NUM2LL(x))
-#else
-# define NUM2OFFT(x) NUM2LONG(x)
+#if !defined(NUM2OFFT)
+# if defined(HAVE_LONG_LONG) && SIZEOF_OFF_T > SIZEOF_LONG
+# define NUM2OFFT(x) ((off_t)NUM2LL(x))
+# else
+# define NUM2OFFT(x) NUM2LONG(x)
+# endif
#endif
#if defined(HAVE_LONG_LONG) && SIZEOF_SIZE_T > SIZEOF_LONG
@@ -679,38 +672,88 @@ 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 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) do {\
- RBASIC(obj)->flags = (t);\
- RBASIC(obj)->klass = (c);\
- if (rb_safe_level() >= 3) FL_SET((obj), FL_TAINT | FL_UNTRUSTED);\
-} while (0)
+#define OBJSETUP(obj,c,t) rb_obj_setup(obj, c, t) /* use NEWOBJ_OF instead of NEWOBJ()+OBJSETUP() */
#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|FL_UNTRUSTED)); \
+ 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
+#define RGENGC_WB_PROTECTED_ARRAY 1
+#endif
+#ifndef RGENGC_WB_PROTECTED_HASH
+#define RGENGC_WB_PROTECTED_HASH 1
+#endif
+#ifndef RGENGC_WB_PROTECTED_STRUCT
+#define RGENGC_WB_PROTECTED_STRUCT 1
+#endif
+#ifndef RGENGC_WB_PROTECTED_STRING
+#define RGENGC_WB_PROTECTED_STRING 1
+#endif
+#ifndef RGENGC_WB_PROTECTED_OBJECT
+#define RGENGC_WB_PROTECTED_OBJECT 1
+#endif
+#ifndef RGENGC_WB_PROTECTED_REGEXP
+#define RGENGC_WB_PROTECTED_REGEXP 1
+#endif
+#ifndef RGENGC_WB_PROTECTED_CLASS
+#define RGENGC_WB_PROTECTED_CLASS 1
+#endif
+#ifndef RGENGC_WB_PROTECTED_FLOAT
+#define RGENGC_WB_PROTECTED_FLOAT 1
+#endif
+#ifndef RGENGC_WB_PROTECTED_COMPLEX
+#define RGENGC_WB_PROTECTED_COMPLEX 1
+#endif
+#ifndef RGENGC_WB_PROTECTED_RATIONAL
+#define RGENGC_WB_PROTECTED_RATIONAL 1
+#endif
+#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
+
struct RBasic {
VALUE flags;
- VALUE klass;
+ const VALUE klass;
}
#ifdef __GNUC__
__attribute__((aligned(sizeof(VALUE))))
#endif
;
+VALUE rb_obj_hide(VALUE obj);
+VALUE rb_obj_reveal(VALUE obj, VALUE klass); /* do not use this API to change klass information */
+
+#define RBASIC_CLASS(obj) (RBASIC(obj)->klass)
+
#define ROBJECT_EMBED_LEN_MAX 3
struct RObject {
struct RBasic basic;
union {
struct {
- long numiv;
+ long numiv; /* only uses 32-bits */
VALUE *ivptr;
struct st_table *iv_index_tbl; /* shortcut for RCLASS_IV_INDEX_TBL(rb_obj_class(obj)) */
} heap;
@@ -736,9 +779,9 @@ typedef struct rb_classext_struct rb_classext_t;
struct RClass {
struct RBasic basic;
+ VALUE super;
rb_classext_t *ptr;
- struct st_table *m_tbl;
- struct st_table *iv_index_tbl;
+ struct method_table_wrapper *m_tbl_wrapper;
};
#define RCLASS_SUPER(c) rb_class_get_superclass(c)
#define RMODULE_IV_TBL(m) RCLASS_IV_TBL(m)
@@ -749,90 +792,10 @@ struct RClass {
#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);
+VALUE rb_float_new(double);
VALUE rb_float_new_in_heap(double);
-#if USE_FLONUM
-#define RUBY_BIT_ROTL(v, n) (((v) << (n)) | ((v) >> ((sizeof(v) * 8) - n)))
-#define RUBY_BIT_ROTR(v, n) (((v) >> (n)) | ((v) << ((sizeof(v) * 8) - n)))
-
-static inline double
-rb_float_value(VALUE v)
-{
- 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;
- }
- }
- else {
- return ((struct RFloat *)v)->float_value;
- }
-}
-
-static inline VALUE
-rb_float_new(double d)
-{
- union {
- double d;
- VALUE v;
- } t;
- int bits;
-
- t.d = d;
- bits = (int)((VALUE)(t.v >> 60) & 0x7);
- /* bits contains 3 bits of b62..b60. */
- /* bits - 3 = */
- /* b011 -> b000 */
- /* b100 -> b001 */
-
- if (t.v != 0x3000000000000000 /* 1.72723e-77 */ &&
- !((bits-3) & ~0x01)) {
- return (RUBY_BIT_ROTL(t.v, 3) & ~(VALUE)0x01) | 0x02;
- }
- else {
- if (t.v == (VALUE)0) {
- /* +0.0 */
- return 0x8000000000000002;
- }
- else {
- /* out of range */
- return rb_float_new_in_heap(d);
- }
- }
-}
-
-#else /* USE_FLONUM */
-
-static inline double
-rb_float_value(VALUE v)
-{
- return ((struct RFloat *)v)->float_value;
-}
-
-static inline VALUE
-rb_float_new(double d)
-{
- return rb_float_new_in_heap(d);
-}
-#endif
-
#define RFLOAT_VALUE(v) rb_float_value(v)
#define DBL2NUM(dbl) rb_float_new(dbl)
@@ -854,6 +817,7 @@ struct RString {
} 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) \
@@ -887,9 +851,9 @@ struct RArray {
long capa;
VALUE shared;
} aux;
- VALUE *ptr;
+ const VALUE *ptr;
} heap;
- VALUE ary[RARRAY_EMBED_LEN_MAX];
+ const VALUE ary[RARRAY_EMBED_LEN_MAX];
} as;
};
#define RARRAY_EMBED_FLAG FL_USER1
@@ -901,16 +865,38 @@ struct RArray {
(long)((RBASIC(a)->flags >> RARRAY_EMBED_LEN_SHIFT) & \
(RARRAY_EMBED_LEN_MASK >> RARRAY_EMBED_LEN_SHIFT)) : \
RARRAY(a)->as.heap.len)
-#define RARRAY_PTR(a) \
- ((RBASIC(a)->flags & RARRAY_EMBED_FLAG) ? \
- RARRAY(a)->as.ary : \
- RARRAY(a)->as.heap.ptr)
+
#define RARRAY_LENINT(ary) rb_long2int(RARRAY_LEN(ary))
+#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) /* */
+
+#define RARRAY_PTR_USE(ary, ptr_name, expr) do { \
+ const VALUE _ary = (ary); \
+ VALUE *ptr_name = (VALUE *)RARRAY_PTR_USE_START(_ary); \
+ expr; \
+ RARRAY_PTR_USE_END(_ary); \
+} while (0)
+
+#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); \
+} while (0)
+
+#define RARRAY_PTR(a) ((VALUE *)RARRAY_CONST_PTR(RGENGC_WB_PROTECTED_ARRAY ? OBJ_WB_UNPROTECT((VALUE)a) : ((VALUE)a)))
+
struct RRegexp {
struct RBasic basic;
struct re_pattern_buffer *ptr;
- VALUE src;
+ const VALUE src;
unsigned long usecnt;
};
#define RREGEXP_SRC(r) RREGEXP(r)->src
@@ -918,35 +904,21 @@ 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;
- VALUE ifnone;
-};
/* RHASH_TBL allocates st_table if not available. */
#define RHASH_TBL(h) rb_hash_tbl(h)
-#define RHASH_ITER_LEV(h) (RHASH(h)->iter_lev)
-#define RHASH_IFNONE(h) (RHASH(h)->ifnone)
-#define RHASH_SIZE(h) (RHASH(h)->ntbl ? RHASH(h)->ntbl->num_entries : 0)
+#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_EMPTY_P(h) (RHASH_SIZE(h) == 0)
+#define RHASH_SET_IFNONE(h, ifnone) rb_hash_set_ifnone((VALUE)h, ifnone)
struct RFile {
struct RBasic basic;
struct rb_io_t *fptr;
};
-struct RRational {
- struct RBasic basic;
- VALUE num;
- VALUE den;
-};
-
-struct RComplex {
- struct RBasic basic;
- VALUE real;
- VALUE 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))
struct RData {
struct RBasic basic;
@@ -969,6 +941,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; /* FL_WB_PROTECTED */
};
#define HAVE_TYPE_RB_DATA_TYPE_T 1
@@ -1004,12 +977,15 @@ void *rb_check_typeddata(VALUE, const rb_data_type_t *);
#define RUBY_TYPED_DEFAULT_FREE RUBY_DEFAULT_FREE
#define RUBY_TYPED_NEVER_FREE RUBY_NEVER_FREE
+/* bits for rb_data_type_struct::flags */
+#define RUBY_TYPED_FREE_IMMEDIATELY 1 /* TYPE field */
+#define RUBY_TYPED_WB_PROTECTED FL_WB_PROTECTED
+
#define Data_Wrap_Struct(klass,mark,free,sval)\
rb_data_object_alloc((klass),(sval),(RUBY_DATA_FUNC)(mark),(RUBY_DATA_FUNC)(free))
#define Data_Make_Struct(klass,type,mark,free,sval) (\
- (sval) = ALLOC(type),\
- memset((sval), 0, sizeof(type)),\
+ (sval) = ZALLOC(type),\
Data_Wrap_Struct((klass),(mark),(free),(sval))\
)
@@ -1017,8 +993,7 @@ void *rb_check_typeddata(VALUE, const rb_data_type_t *);
rb_data_typed_object_alloc((klass),(sval),(data_type))
#define TypedData_Make_Struct(klass, type, data_type, sval) (\
- (sval) = ALLOC(type),\
- memset((sval), 0, sizeof(type)),\
+ (sval) = ZALLOC(type),\
TypedData_Wrap_Struct((klass),(data_type),(sval))\
)
@@ -1037,9 +1012,9 @@ struct RStruct {
union {
struct {
long len;
- VALUE *ptr;
+ const VALUE *ptr;
} heap;
- VALUE ary[RSTRUCT_EMBED_LEN_MAX];
+ const VALUE ary[RSTRUCT_EMBED_LEN_MAX];
} as;
};
#define RSTRUCT_EMBED_LEN_MASK (FL_USER2|FL_USER1)
@@ -1049,71 +1024,40 @@ struct RStruct {
(long)((RBASIC(st)->flags >> RSTRUCT_EMBED_LEN_SHIFT) & \
(RSTRUCT_EMBED_LEN_MASK >> RSTRUCT_EMBED_LEN_SHIFT)) : \
RSTRUCT(st)->as.heap.len)
-#define RSTRUCT_PTR(st) \
- ((RBASIC(st)->flags & RSTRUCT_EMBED_LEN_MASK) ? \
- RSTRUCT(st)->as.ary : \
- RSTRUCT(st)->as.heap.ptr)
#define RSTRUCT_LENINT(st) rb_long2int(RSTRUCT_LEN(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 RBIGNUM_EMBED_LEN_MAX ((int)((sizeof(VALUE)*3)/sizeof(BDIGIT)))
-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 RSTRUCT_SET(st, idx, v) RB_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)
#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_RESERVED1 (((VALUE)1)<<5)
-#define FL_RESERVED2 (((VALUE)1)<<6) /* will be used in the future GC */
+#define FL_WB_PROTECTED (((VALUE)1)<<5)
+#define FL_PROMOTED0 (((VALUE)1)<<5)
+#define FL_PROMOTED1 (((VALUE)1)<<6)
#define FL_FINALIZE (((VALUE)1)<<7)
#define FL_TAINT (((VALUE)1)<<8)
-#define FL_UNTRUSTED (((VALUE)1)<<9)
+#define FL_UNTRUSTED FL_TAINT
#define FL_EXIVAR (((VALUE)1)<<10)
#define FL_FREEZE (((VALUE)1)<<11)
@@ -1143,25 +1087,126 @@ struct RBignum {
#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(x,f) (FL_ABLE(x)?(RBASIC(x)->flags&(f)):0)
+#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_TAINTABLE(x) (FL_ABLE(x) && BUILTIN_TYPE(x) != T_BIGNUM && BUILTIN_TYPE(x) != T_FLOAT)
#define OBJ_TAINTED(x) (!!FL_TEST((x), FL_TAINT))
-#define OBJ_TAINT(x) FL_SET((x), FL_TAINT)
-#define OBJ_UNTRUSTED(x) (!!FL_TEST((x), FL_UNTRUSTED))
-#define OBJ_UNTRUST(x) FL_SET((x), FL_UNTRUSTED)
-#define OBJ_INFECT(x,s) do { \
- if (FL_ABLE(x) && FL_ABLE(s)) \
- RBASIC(x)->flags |= RBASIC(s)->flags & \
- (FL_TAINT | FL_UNTRUSTED); \
-} while (0)
+#define OBJ_TAINT(x) (OBJ_TAINTABLE(x) ? (RBASIC(x)->flags |= FL_TAINT) : 0)
+#define OBJ_UNTRUSTED(x) OBJ_TAINTED(x)
+#define OBJ_UNTRUST(x) OBJ_TAINT(x)
+#define OBJ_INFECT(x,s) ( \
+ (OBJ_TAINTABLE(x) && FL_ABLE(s)) ? \
+ RBASIC(x)->flags |= RBASIC(s)->flags & FL_TAINT : 0)
+
+#define OBJ_FROZEN(x) (FL_ABLE(x) ? !!(RBASIC(x)->flags&FL_FREEZE) : 1)
+#define OBJ_FREEZE_RAW(x) (RBASIC(x)->flags |= FL_FREEZE)
+#define OBJ_FREEZE(x) rb_obj_freeze_inline((VALUE)x)
+
+static inline void
+rb_obj_freeze_inline(VALUE x)
+{
+ if (FL_ABLE(x)) {
+ VALUE klass = RBASIC_CLASS(x);
+ OBJ_FREEZE_RAW(x);
+ if (FL_TEST(klass, (FL_SINGLETON|FL_FREEZE)) == FL_SINGLETON) {
+ OBJ_FREEZE_RAW(klass);
+ }
+ }
+}
+
+#if USE_RGENGC
+#define OBJ_PROMOTED_RAW(x) ((RBASIC(x)->flags & (FL_PROMOTED0|FL_PROMOTED1)) == (FL_PROMOTED0|FL_PROMOTED1))
+#define OBJ_PROMOTED(x) (SPECIAL_CONST_P(x) ? 0 : OBJ_PROMOTED_RAW(x))
+#define OBJ_WB_UNPROTECT(x) rb_obj_wb_unprotect(x, __FILE__, __LINE__)
+
+#if USE_RINCGC
+int rb_gc_writebarrier_incremental(VALUE a, VALUE b);
+#else
+#define rb_gc_writebarrier_incremental(a, b) 0
+#endif
+void rb_gc_writebarrier_generational(VALUE a, VALUE b);
+void rb_gc_writebarrier_unprotect(VALUE obj);
+
+#else /* USE_RGENGC */
+#define OBJ_PROMOTED(x) 0
+#define OBJ_WB_UNPROTECT(x) rb_obj_wb_unprotect(x, __FILE__, __LINE__)
+#endif
+
+/* 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_FROZEN(x) (!!(FL_ABLE(x)?(RBASIC(x)->flags&(FL_FREEZE)):(FIXNUM_P(x)||FLONUM_P(x))))
-#define OBJ_FREEZE(x) FL_SET((x), FL_FREEZE)
+#ifndef USE_RGENGC_LOGGING_WB_UNPROTECT
+#define USE_RGENGC_LOGGING_WB_UNPROTECT 0
+#endif
+
+#if USE_RGENGC_LOGGING_WB_UNPROTECT
+void rb_gc_unprotect_logging(void *objptr, const char *filename, int line);
+#define RGENGC_LOGGING_WB_UNPROTECT rb_gc_unprotect_logging
+#endif
+
+static inline VALUE
+rb_obj_wb_unprotect(VALUE x, RB_UNUSED_VAR(const char *filename), RB_UNUSED_VAR(int line))
+{
+#ifdef RGENGC_LOGGING_WB_UNPROTECT
+ RGENGC_LOGGING_WB_UNPROTECT((void *)x, filename, line);
+#endif
+#if USE_RGENGC
+ rb_gc_writebarrier_unprotect(x);
+#endif
+ return x;
+}
+
+static inline VALUE
+rb_obj_written(VALUE a, RB_UNUSED_VAR(VALUE oldv), VALUE b, RB_UNUSED_VAR(const char *filename), RB_UNUSED_VAR(int line))
+{
+#ifdef RGENGC_LOGGING_OBJ_WRITTEN
+ RGENGC_LOGGING_OBJ_WRITTEN(a, oldv, b, filename, line);
+#endif
+
+#if USE_RGENGC
+ if (!SPECIAL_CONST_P(b)) {
+ if (rb_gc_writebarrier_incremental(a, b) == 0) {
+ if (OBJ_PROMOTED_RAW(a) && !OBJ_PROMOTED_RAW(b)) {
+ rb_gc_writebarrier_generational(a, b);
+ }
+ }
+ }
+#endif
+
+ return a;
+}
+
+static inline VALUE
+rb_obj_write(VALUE a, VALUE *slot, VALUE b, RB_UNUSED_VAR(const char *filename), RB_UNUSED_VAR(int line))
+{
+#ifdef RGENGC_LOGGING_WRITE
+ RGENGC_LOGGING_WRITE(a, slot, b, filename, line);
+#endif
+
+ *slot = b;
+
+#if USE_RGENGC
+ rb_obj_written(a, Qundef /* ignore `oldv' now */, b, filename, line);
+#endif
+ return a;
+}
#if SIZEOF_INT < SIZEOF_LONG
# define INT2NUM(v) INT2FIX((int)(v))
@@ -1222,11 +1267,13 @@ rb_num2char_inline(VALUE x)
#define ALLOC_N(type,n) ((type*)xmalloc2((n),sizeof(type)))
#define ALLOC(type) ((type*)xmalloc(sizeof(type)))
+#define ZALLOC_N(type,n) ((type*)xcalloc((n),sizeof(type)))
+#define ZALLOC(type) (ZALLOC_N(type,1))
#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);
+void *rb_alloc_tmp_buffer(volatile VALUE *store, long len) RUBY_ATTR_ALLOC_SIZE((2));
void rb_free_tmp_buffer(volatile VALUE *store);
/* allocates _n_ bytes temporary buffer and stores VALUE including it
* in _v_. _n_ may be evaluated twice. */
@@ -1282,7 +1329,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*,VALUE*);
+void rb_define_readonly_variable(const char*,const VALUE*);
void rb_define_const(VALUE,const char*,VALUE);
void rb_define_global_const(const char*,VALUE);
@@ -1307,6 +1354,9 @@ 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 CONST_ID_CACHE(result, str) \
{ \
@@ -1341,8 +1391,10 @@ VALUE rb_eval_string(const char*);
VALUE rb_eval_string_protect(const char*, int*);
VALUE rb_eval_string_wrap(const char*, int*);
VALUE rb_funcall(VALUE, ID, int, ...);
-VALUE rb_funcall2(VALUE, ID, int, const VALUE*);
-VALUE rb_funcall3(VALUE, ID, int, const VALUE*);
+VALUE rb_funcallv(VALUE, ID, int, const VALUE*);
+VALUE rb_funcallv_public(VALUE, ID, int, const VALUE*);
+#define rb_funcall2 rb_funcallv
+#define rb_funcall3 rb_funcallv_public
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*, ...);
@@ -1371,6 +1423,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(int, const char*));
NORETURN(void rb_iter_break(void));
NORETURN(void rb_iter_break_value(VALUE));
NORETURN(void rb_exit(int));
@@ -1390,17 +1443,31 @@ 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);
-typedef VALUE rb_block_call_func(VALUE, VALUE, int, VALUE*);
+/* for rb_readwrite_sys_fail first argument */
+#define RB_IO_WAIT_READABLE 0
+#define RB_IO_WAIT_WRITABLE 1
+
+#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));
+
+#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
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,VALUE*,VALUE(*)(ANYARGS),VALUE);
+VALUE rb_block_call(VALUE,ID,int,const VALUE*,rb_block_call_func_t,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);
@@ -1506,7 +1573,7 @@ rb_class_of(VALUE 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;
+ if (STATIC_SYM_P(obj)) return rb_cSymbol;
}
else if (!RTEST(obj)) {
if (obj == Qnil) return rb_cNilClass;
@@ -1522,7 +1589,7 @@ rb_type(VALUE 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 (STATIC_SYM_P(obj)) return T_SYMBOL;
if (obj == Qundef) return T_UNDEF;
}
else if (!RTEST(obj)) {
@@ -1564,7 +1631,6 @@ rb_special_const_p(VALUE obj)
}
#endif
-#include "ruby/missing.h"
#include "ruby/intern.h"
#if defined(EXTLIB) && defined(USE_DLN_A_OUT)
@@ -1589,16 +1655,29 @@ int ruby_native_thread_p(void);
#define RUBY_EVENT_ALL 0x00ff
/* for TracePoint extended events */
-#define RUBY_EVENT_B_CALL 0x0100
-#define RUBY_EVENT_B_RETURN 0x0200
-#define RUBY_EVENT_THREAD_BEGIN 0x0400
-#define RUBY_EVENT_THREAD_END 0x0800
-#define RUBY_EVENT_TRACEPOINT_ALL 0xFFFF
+#define RUBY_EVENT_B_CALL 0x0100
+#define RUBY_EVENT_B_RETURN 0x0200
+#define RUBY_EVENT_THREAD_BEGIN 0x0400
+#define RUBY_EVENT_THREAD_END 0x0800
+#define RUBY_EVENT_TRACEPOINT_ALL 0xffff
/* special events */
-#define RUBY_EVENT_SPECIFIED_LINE 0x10000
-#define RUBY_EVENT_SWITCH 0x20000
-#define RUBY_EVENT_COVERAGE 0x40000
+#define RUBY_EVENT_SPECIFIED_LINE 0x010000
+#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 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);
@@ -1629,6 +1708,7 @@ int rb_toupper(int c);
#define ISASCII(c) rb_isascii((unsigned char)(c))
#undef ISPRINT
#define ISPRINT(c) rb_isprint((unsigned char)(c))
+#define ISGRAPH(c) rb_isgraph((unsigned char)(c))
#define ISSPACE(c) rb_isspace((unsigned char)(c))
#define ISUPPER(c) rb_isupper((unsigned char)(c))
#define ISLOWER(c) rb_islower((unsigned char)(c))
@@ -1640,10 +1720,10 @@ int rb_toupper(int c);
#define TOUPPER(c) rb_toupper((unsigned char)(c))
#define TOLOWER(c) rb_tolower((unsigned char)(c))
-int st_strcasecmp(const char *s1, const char *s2);
-int st_strncasecmp(const char *s1, const char *s2, size_t n);
-#define STRCASECMP(s1, s2) (st_strcasecmp((s1), (s2)))
-#define STRNCASECMP(s1, s2, n) (st_strncasecmp((s1), (s2), (n)))
+int st_locale_insensitive_strcasecmp(const char *s1, const char *s2);
+int st_locale_insensitive_strncasecmp(const char *s1, const char *s2, size_t n);
+#define STRCASECMP(s1, s2) (st_locale_insensitive_strcasecmp((s1), (s2)))
+#define STRNCASECMP(s1, s2, n) (st_locale_insensitive_strncasecmp((s1), (s2), (n)))
unsigned long ruby_strtoul(const char *str, char **endptr, int base);
#define STRTOUL(str, endptr, base) (ruby_strtoul((str), (endptr), (base)))
@@ -1661,7 +1741,7 @@ int ruby_vsnprintf(char *str, size_t n, char const *fmt, va_list ap);
* @defgroup embed CRuby Embedding APIs
* CRuby interpreter APIs. These are APIs to embed MRI interpreter into your
* program.
- * These functions are not a part of Ruby extention library API.
+ * These functions are not a part of Ruby extension library API.
* Extension libraries of Ruby should not depend on these functions.
* @{
*/
@@ -1723,9 +1803,7 @@ void ruby_sig_finalize(void);
/*! @} */
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
-#endif
+RUBY_SYMBOL_EXPORT_END
#if defined(__cplusplus)
#if 0
diff --git a/include/ruby/st.h b/include/ruby/st.h
index c2294a92c1..0ef499944a 100644
--- a/include/ruby/st.h
+++ b/include/ruby/st.h
@@ -14,22 +14,7 @@ extern "C" {
#include "ruby/defines.h"
-#if defined STDC_HEADERS
-#include <stddef.h>
-#elif defined HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#ifdef HAVE_STDINT_H
-# include <stdint.h>
-#endif
-#ifdef HAVE_INTTYPES_H
-# include <inttypes.h>
-#endif
-
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
+RUBY_SYMBOL_EXPORT_BEGIN
#if SIZEOF_LONG == SIZEOF_VOIDP
typedef unsigned long st_data_t;
@@ -74,6 +59,13 @@ 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;
@@ -117,15 +109,23 @@ st_table *st_init_strcasetable(void);
st_table *st_init_strcasetable_with_size(st_index_t);
int st_delete(st_table *, st_data_t *, st_data_t *); /* returns 0:notfound 1:deleted */
int st_delete_safe(st_table *, st_data_t *, st_data_t *, st_data_t);
+int st_shift(st_table *, st_data_t *, st_data_t *); /* returns 0:notfound 1:deleted */
int st_insert(st_table *, st_data_t, st_data_t);
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);
@@ -133,8 +133,10 @@ void st_clear(st_table *);
st_table *st_copy(st_table *);
int st_numcmp(st_data_t, st_data_t);
st_index_t st_numhash(st_data_t);
-int st_strcasecmp(const char *s1, const char *s2);
-int st_strncasecmp(const char *s1, const char *s2, size_t n);
+int st_locale_insensitive_strcasecmp(const char *s1, const char *s2);
+int st_locale_insensitive_strncasecmp(const char *s1, const char *s2, size_t n);
+#define st_strcasecmp st_locale_insensitive_strcasecmp
+#define st_strncasecmp st_locale_insensitive_strncasecmp
size_t st_memsize(const st_table *);
st_index_t st_hash(const void *ptr, size_t len, st_index_t h);
st_index_t st_hash_uint32(st_index_t h, uint32_t i);
@@ -143,9 +145,7 @@ st_index_t st_hash_end(st_index_t h);
st_index_t st_hash_start(st_index_t h);
#define st_hash_start(h) ((st_index_t)(h))
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
-#endif
+RUBY_SYMBOL_EXPORT_END
#if defined(__cplusplus)
#if 0
diff --git a/include/ruby/thread.h b/include/ruby/thread.h
index fb9057c70f..550f678e54 100644
--- a/include/ruby/thread.h
+++ b/include/ruby/thread.h
@@ -21,9 +21,7 @@ extern "C" {
#include "ruby/intern.h"
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
+RUBY_SYMBOL_EXPORT_BEGIN
void *rb_thread_call_with_gvl(void *(*func)(void *), void *data1);
@@ -35,9 +33,7 @@ void *rb_thread_call_without_gvl2(void *(*func)(void *), void *data1,
#define RUBY_CALL_WO_GVL_FLAG_SKIP_CHECK_INTS_AFTER 0x01
#define RUBY_CALL_WO_GVL_FLAG_SKIP_CHECK_INTS_
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
-#endif
+RUBY_SYMBOL_EXPORT_END
#if defined(__cplusplus)
#if 0
diff --git a/include/ruby/thread_native.h b/include/ruby/thread_native.h
new file mode 100644
index 0000000000..8e500c5a13
--- /dev/null
+++ b/include/ruby/thread_native.h
@@ -0,0 +1,56 @@
+/**********************************************************************
+
+ 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 02aa643916..74cdd0ffd1 100644
--- a/include/ruby/util.h
+++ b/include/ruby/util.h
@@ -45,17 +45,22 @@ extern "C" {
#endif
#endif
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
+RUBY_SYMBOL_EXPORT_BEGIN
+
+#define DECIMAL_SIZE_OF_BITS(n) (((n) * 3010 + 9998) / 9999)
+/* an approximation of ceil(n * log10(2)), upto 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 *);
@@ -85,9 +90,7 @@ double ruby_strtod(const char *, char **);
void ruby_each_words(const char *, void (*)(const char*, int, void*), void *);
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
-#endif
+RUBY_SYMBOL_EXPORT_END
#if defined(__cplusplus)
#if 0
diff --git a/include/ruby/version.h b/include/ruby/version.h
index b41b64fe66..1e3ff2e6a3 100644
--- a/include/ruby/version.h
+++ b/include/ruby/version.h
@@ -31,7 +31,7 @@
/* API version */
#define RUBY_API_VERSION_MAJOR 2
-#define RUBY_API_VERSION_MINOR 0
+#define RUBY_API_VERSION_MINOR 2
#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)
@@ -43,9 +43,7 @@ extern "C" {
#endif
#endif
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
+RUBY_SYMBOL_EXPORT_BEGIN
/*
* Interfaces from extension libraries.
@@ -63,9 +61,7 @@ RUBY_EXTERN const char ruby_description[];
RUBY_EXTERN const char ruby_copyright[];
RUBY_EXTERN const char ruby_engine[];
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
-#endif
+RUBY_SYMBOL_EXPORT_END
#if defined(__cplusplus)
#if 0
diff --git a/include/ruby/vm.h b/include/ruby/vm.h
index 1146bf5426..73345264bd 100644
--- a/include/ruby/vm.h
+++ b/include/ruby/vm.h
@@ -19,9 +19,7 @@ extern "C" {
#endif
#endif
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
+RUBY_SYMBOL_EXPORT_BEGIN
/* Place holder.
*
@@ -54,9 +52,7 @@ int ruby_vm_destruct(ruby_vm_t *vm);
*/
void ruby_vm_at_exit(void(*func)(ruby_vm_t *));
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
-#endif
+RUBY_SYMBOL_EXPORT_END
#if defined(__cplusplus)
#if 0
diff --git a/include/ruby/win32.h b/include/ruby/win32.h
index a190355a9c..a6996bc95a 100644
--- a/include/ruby/win32.h
+++ b/include/ruby/win32.h
@@ -8,9 +8,7 @@ extern "C" {
#endif
#endif
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
+RUBY_SYMBOL_EXPORT_BEGIN
/*
* Copyright (c) 1993, Intergraph Corporation
@@ -39,6 +37,9 @@ extern "C++" { /* template without extern "C++" */
#endif
#include <winsock2.h>
#include <ws2tcpip.h>
+#if !defined(_MSC_VER) || _MSC_VER >= 1400
+#include <iphlpapi.h>
+#endif
#if defined(__cplusplus) && defined(_MSC_VER)
}
#endif
@@ -87,6 +88,14 @@ typedef int intptr_t;
# endif
# define _INTPTR_T_DEFINED
# endif
+# if !defined(INTPTR_MAX)
+# ifdef _WIN64
+# define INTPTR_MAX 9223372036854775807I64
+# else
+# define INTPTR_MAX 2147483647
+# endif
+# define INTPTR_MIN (-INTPTR_MAX-1)
+# endif
# if !defined(_UINTPTR_T_DEFINED)
# ifdef _WIN64
typedef unsigned __int64 uintptr_t;
@@ -95,6 +104,13 @@ typedef unsigned int uintptr_t;
# endif
# define _UINTPTR_T_DEFINED
# endif
+# if !defined(UINTPTR_MAX)
+# ifdef _WIN64
+# define UINTPTR_MAX 18446744073709551615UI64
+# else
+# define UINTPTR_MAX 4294967295U
+# endif
+# endif
#endif
#ifndef __MINGW32__
# define mode_t int
@@ -108,6 +124,10 @@ typedef unsigned int uintptr_t;
#define WNOHANG -1
+typedef int clockid_t;
+#define CLOCK_REALTIME 0
+#define CLOCK_MONOTONIC 1
+
#undef getc
#undef putc
#undef fgetc
@@ -222,8 +242,27 @@ struct msghdr {
int msg_flags;
};
+/* for getifaddrs() and others */
+struct ifaddrs {
+ struct ifaddrs *ifa_next;
+ char *ifa_name;
+ u_int ifa_flags;
+ struct sockaddr *ifa_addr;
+ struct sockaddr *ifa_netmask;
+ struct sockaddr *ifa_broadaddr;
+ struct sockaddr *ifa_dstaddr;
+ void *ifa_data;
+};
+#ifdef IF_NAMESIZE
+#define IFNAMSIZ IF_NAMESIZE
+#else
+#define IFNAMSIZ 256
+#endif
+#ifdef IFF_POINTTOPOINT
+#define IFF_POINTOPOINT IFF_POINTTOPOINT
+#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);
@@ -257,7 +296,9 @@ extern struct protoent *WSAAPI rb_w32_getprotobyname(const char *);
extern struct protoent *WSAAPI rb_w32_getprotobynumber(int);
extern struct servent *WSAAPI rb_w32_getservbyname(const char *, const char *);
extern struct servent *WSAAPI rb_w32_getservbyport(int, const char *);
-extern int rb_w32_socketpair(int, int, int, int *);
+extern int socketpair(int, int, int, int *);
+extern int getifaddrs(struct ifaddrs **);
+extern void freeifaddrs(struct ifaddrs *);
extern char * rb_w32_getcwd(char *, int);
extern char * rb_w32_ugetenv(const char *);
extern char * rb_w32_getenv(const char *);
@@ -267,6 +308,7 @@ 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);
@@ -274,10 +316,15 @@ 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 int gettimeofday(struct timeval *, struct timezone *);
+extern int clock_gettime(clockid_t, struct timespec *);
+extern int clock_getres(clockid_t, struct timespec *);
extern rb_pid_t waitpid (rb_pid_t, int *, int);
extern rb_pid_t rb_w32_spawn(int, const char *, const char*);
extern rb_pid_t rb_w32_aspawn(int, const char *, char *const *);
extern rb_pid_t rb_w32_aspawn_flags(int, const char *, char *const *, DWORD);
+extern rb_pid_t rb_w32_uspawn(int, const char *, const char*);
+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 rb_pid_t rb_w32_getpid(void);
@@ -299,6 +346,7 @@ 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);
@@ -339,6 +387,8 @@ scalb(double a, long b)
{
return _scalb(a, b);
}
+#else
+__declspec(dllimport) extern int finite(double);
#endif
#if !defined S_IFIFO && defined _S_IFIFO
@@ -396,8 +446,6 @@ scalb(double a, long b)
extern int rb_w32_ftruncate(int fd, off_t length);
extern int rb_w32_truncate(const char *path, off_t length);
-extern off_t rb_w32_ftello(FILE *stream);
-extern int rb_w32_fseeko(FILE *stream, off_t offset, int whence);
#undef HAVE_FTRUNCATE
#define HAVE_FTRUNCATE 1
@@ -415,20 +463,9 @@ extern int rb_w32_fseeko(FILE *stream, off_t offset, int whence);
#define truncate rb_w32_truncate
#endif
-#undef HAVE_FSEEKO
-#define HAVE_FSEEKO 1
-#if defined HAVE_FSEEKO64
-#define fseeko fseeko64
-#else
-#define fseeko rb_w32_fseeko
-#endif
-
-#undef HAVE_FTELLO
-#define HAVE_FTELLO 1
-#if defined HAVE_FTELLO64
-#define ftello ftello64
-#else
-#define ftello rb_w32_ftello
+#if defined(_MSC_VER) && _MSC_VER >= 1400 && _MSC_VER < 1800
+#define strtoll _strtoi64
+#define strtoull _strtoui64
#endif
/*
@@ -442,6 +479,8 @@ extern rb_gid_t getegid (void);
extern int setuid (rb_uid_t);
extern int setgid (rb_gid_t);
+extern int fstati64(int, struct stati64 *);
+
extern char *rb_w32_strerror(int);
#ifdef RUBY_EXPORT
@@ -618,6 +657,9 @@ 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)
@@ -687,9 +729,6 @@ extern char *rb_w32_strerror(int);
#undef getservbyport
#define getservbyport(p, pr) rb_w32_getservbyport(p, pr)
-#undef socketpair
-#define socketpair(a, t, p, s) rb_w32_socketpair(a, t, p, s)
-
#undef get_osfhandle
#define get_osfhandle(h) rb_w32_get_osfhandle(h)
@@ -704,6 +743,9 @@ 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 {
@@ -738,20 +780,20 @@ 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 TRAP_BEG...TRAP_END block structure,
+* use anything like rb_thread_call_without_gvl,
in asynchronous_func_t.
*/
typedef uintptr_t (*asynchronous_func_t)(uintptr_t self, int argc, uintptr_t* argv);
uintptr_t rb_w32_asynchronize(asynchronous_func_t func, uintptr_t self, int argc, uintptr_t* argv, uintptr_t intrval);
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
-#endif
+RUBY_SYMBOL_EXPORT_END
#ifdef __MINGW_ATTRIB_PURE
/* License: Ruby's */
@@ -790,21 +832,7 @@ rb_w32_pow(double x, double y)
return powl(x, y);
}
#elif defined(__MINGW64_VERSION_MAJOR)
-/*
- * Set floating point precision for pow() of mingw-w64 x86.
- * With default precision the result is not proper on WinXP.
- */
-static inline double
-rb_w32_pow(double x, double y)
-{
- double r;
- unsigned int default_control = _controlfp(0, 0);
- _controlfp(_PC_64, _MCW_PC);
- r = pow(x, y);
- /* Restore setting */
- _controlfp(default_control, _MCW_PC);
- return r;
-}
+double rb_w32_pow(double x, double y);
#endif
#if defined(__MINGW64_VERSION_MAJOR) || defined(__MINGW64__)
#define pow rb_w32_pow
diff --git a/inits.c b/inits.c
index fe0aade090..da8cfb1ed9 100644
--- a/inits.c
+++ b/inits.c
@@ -46,7 +46,6 @@ rb_call_inits(void)
CALL(Time);
CALL(Random);
CALL(signal);
- CALL(process);
CALL(load);
CALL(Proc);
CALL(Binding);
@@ -56,6 +55,7 @@ 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 ea138cc69d..bfa11a9b8d 100644
--- a/insns.def
+++ b/insns.def
@@ -218,7 +218,6 @@ setconstant
{
vm_check_if_namespace(cbase);
rb_const_set(cbase, id, val);
- INC_VM_STATE_VERSION();
}
/**
@@ -818,7 +817,7 @@ checkmatch
if (flag & VM_CHECKMATCH_ARRAY) {
int i;
for (i = 0; i < RARRAY_LEN(pattern); i++) {
- if (RTEST(check_match(RARRAY_PTR(pattern)[i], target, checkmatch_type))) {
+ if (RTEST(check_match(RARRAY_AREF(pattern, i), target, checkmatch_type))) {
result = Qtrue;
break;
}
@@ -876,7 +875,7 @@ trace
/**
@c class/module
@e
- enter class definition scope. if super is Qfalse, and clsas
+ enter class definition scope. if super is Qfalse, and class
"klass" is defined, it's redefine. otherwise, define "klass" class.
@j クラス定義スコープへ移行する。
もし super が Qfalse で klassクラスが定義されていれば再定義である。
@@ -972,10 +971,8 @@ defineclass
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->local_size, 0, class_iseq->stack_max);
RESTORE_REGS();
-
- INC_VM_STATE_VERSION();
NEXT_INSN();
}
@@ -1002,6 +999,20 @@ send
CALL_METHOD(ci);
}
+DEFINE_INSN
+opt_str_freeze
+(VALUE str)
+()
+(VALUE val)
+{
+ if (BASIC_OP_UNREDEFINED_P(BOP_FREEZE, STRING_REDEFINED_OP_FLAG)) {
+ val = str;
+ }
+ else {
+ val = rb_funcall(rb_str_resurrect(str), idFreeze, 0);
+ }
+}
+
/**
@c optimize
@e Invoke method without block, splat
@@ -1177,7 +1188,7 @@ branchunless
/**
@c optimize
- @e inline cache
+ @e push inline-cached value and go to dst if it is valid
@j インラインキャッシュが有効なら、値をスタックにプッシュして dst へジャンプする。
*/
DEFINE_INSN
@@ -1186,7 +1197,7 @@ getinlinecache
()
(VALUE val)
{
- if (ic->ic_vmstat == GET_VM_STATE_VERSION()) {
+ if (ic->ic_serial == GET_GLOBAL_CONSTANT_STATE()) {
val = ic->ic_value.value;
JUMP(dst);
}
@@ -1198,55 +1209,63 @@ getinlinecache
/**
@c optimize
- @e inline cache (once)
- @j once を実現する。
+ @e set inline cache
+ @j インラインキャッシュの値を設定する。
*/
DEFINE_INSN
-onceinlinecache
-(OFFSET dst, IC ic)
-()
+setinlinecache
+(IC ic)
+(VALUE val)
(VALUE val)
{
- retry:
- if (ic->ic_vmstat) {
- val = ic->ic_value.value;
- JUMP(dst);
- }
- else if (ic->ic_value.value == Qundef)
- {
- RUBY_VM_CHECK_INTS(th);
- rb_thread_schedule();
- goto retry;
- }
- else {
- /* none */
- ic->ic_value.value = Qundef;
- val = Qnil;
+ 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;
+ ruby_vm_const_missing_count = 0;
}
/**
@c optimize
- @e set inline cache
- @j インラインキャッシュの値を設定する。
+ @e run iseq only once
+ @j once を実現する。
*/
DEFINE_INSN
-setinlinecache
-(IC ic)
-(VALUE val)
+once
+(ISEQ iseq, IC ic)
+()
(VALUE val)
{
- if (ic->ic_value.value == Qundef) {
+ 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);
}
- ic->ic_value.value = val;
- ic->ic_vmstat = GET_VM_STATE_VERSION() - ruby_vm_const_missing_count;
- ruby_vm_const_missing_count = 0;
+ else if (is->once.running_thread == th) {
+ /* recursive once */
+ val = vm_once_exec((VALUE)iseq);
+ }
+ else {
+ /* waiting for finish */
+ RUBY_VM_CHECK_INTS(th);
+ rb_thread_schedule();
+ goto retry;
+ }
}
/**
@c optimize
- @e case dispatcher
+ @e case dispatcher, jump by table if possible
@j case 文で、可能なら表引きでジャンプする。
*/
DEFINE_INSN
@@ -1272,7 +1291,7 @@ opt_case_dispatch
BIGNUM_REDEFINED_OP_FLAG |
STRING_REDEFINED_OP_FLAG)) {
st_data_t val;
- if (st_lookup(RHASH_TBL(hash), key, &val)) {
+ if (st_lookup(RHASH_TBL_RAW(hash), key, &val)) {
JUMP(FIX2INT((VALUE)val));
}
else {
@@ -1326,15 +1345,15 @@ opt_plus
val = DBL2NUM(RFLOAT_VALUE(recv) + RFLOAT_VALUE(obj));
}
else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) {
- if (HEAP_CLASS_OF(recv) == rb_cFloat && HEAP_CLASS_OF(obj) == rb_cFloat &&
+ if (RBASIC_CLASS(recv) == rb_cFloat && RBASIC_CLASS(obj) == rb_cFloat &&
BASIC_OP_UNREDEFINED_P(BOP_PLUS, FLOAT_REDEFINED_OP_FLAG)) {
val = DBL2NUM(RFLOAT_VALUE(recv) + RFLOAT_VALUE(obj));
}
- else if (HEAP_CLASS_OF(recv) == rb_cString && HEAP_CLASS_OF(obj) == rb_cString &&
+ else if (RBASIC_CLASS(recv) == rb_cString && RBASIC_CLASS(obj) == rb_cString &&
BASIC_OP_UNREDEFINED_P(BOP_PLUS, STRING_REDEFINED_OP_FLAG)) {
val = rb_str_plus(recv, obj);
}
- else if (HEAP_CLASS_OF(recv) == rb_cArray &&
+ else if (RBASIC_CLASS(recv) == rb_cArray &&
BASIC_OP_UNREDEFINED_P(BOP_PLUS, ARRAY_REDEFINED_OP_FLAG)) {
val = rb_ary_plus(recv, obj);
}
@@ -1381,7 +1400,7 @@ opt_minus
val = DBL2NUM(RFLOAT_VALUE(recv) - RFLOAT_VALUE(obj));
}
else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) {
- if (HEAP_CLASS_OF(recv) == rb_cFloat && HEAP_CLASS_OF(obj) == rb_cFloat &&
+ if (RBASIC_CLASS(recv) == rb_cFloat && RBASIC_CLASS(obj) == rb_cFloat &&
BASIC_OP_UNREDEFINED_P(BOP_MINUS, FLOAT_REDEFINED_OP_FLAG)) {
val = DBL2NUM(RFLOAT_VALUE(recv) - RFLOAT_VALUE(obj));
}
@@ -1432,7 +1451,7 @@ opt_mult
val = DBL2NUM(RFLOAT_VALUE(recv) * RFLOAT_VALUE(obj));
}
else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) {
- if (HEAP_CLASS_OF(recv) == rb_cFloat && HEAP_CLASS_OF(obj) == rb_cFloat &&
+ if (RBASIC_CLASS(recv) == rb_cFloat && RBASIC_CLASS(obj) == rb_cFloat &&
BASIC_OP_UNREDEFINED_P(BOP_MULT, FLOAT_REDEFINED_OP_FLAG)) {
val = DBL2NUM(RFLOAT_VALUE(recv) * RFLOAT_VALUE(obj));
}
@@ -1491,11 +1510,11 @@ opt_div
val = LONG2NUM(div);
}
else if (FLONUM_2_P(recv, obj) &&
- BASIC_OP_UNREDEFINED_P(BOP_MULT, FLOAT_REDEFINED_OP_FLAG)) {
+ BASIC_OP_UNREDEFINED_P(BOP_DIV, FLOAT_REDEFINED_OP_FLAG)) {
val = DBL2NUM(RFLOAT_VALUE(recv) / RFLOAT_VALUE(obj));
}
else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) {
- if (HEAP_CLASS_OF(recv) == rb_cFloat && HEAP_CLASS_OF(obj) == rb_cFloat &&
+ if (RBASIC_CLASS(recv) == rb_cFloat && RBASIC_CLASS(obj) == rb_cFloat &&
BASIC_OP_UNREDEFINED_P(BOP_DIV, FLOAT_REDEFINED_OP_FLAG)) {
val = DBL2NUM(RFLOAT_VALUE(recv) / RFLOAT_VALUE(obj));
}
@@ -1524,13 +1543,16 @@ opt_mod
{
if (FIXNUM_2_P(recv, obj) &&
BASIC_OP_UNREDEFINED_P(BOP_MOD, FIXNUM_REDEFINED_OP_FLAG )) {
- long x, y, mod;
+ long x, y;
x = FIX2LONG(recv);
y = FIX2LONG(obj);
- {
+ if (x > 0 && y > 0) {
+ val = LONG2FIX(x % y);
+ }
+ else {
/* copied from numeric.c#fixdivmod */
- long div;
+ long div, mod;
if (y == 0)
rb_num_zerodiv();
@@ -1551,15 +1573,15 @@ opt_mod
mod += y;
div -= 1;
}
+ val = LONG2FIX(mod);
}
- val = LONG2FIX(mod);
}
else if (FLONUM_2_P(recv, obj) &&
BASIC_OP_UNREDEFINED_P(BOP_MOD, FLOAT_REDEFINED_OP_FLAG)) {
val = DBL2NUM(ruby_float_mod(RFLOAT_VALUE(recv), RFLOAT_VALUE(obj)));
}
else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) {
- if (HEAP_CLASS_OF(recv) == rb_cFloat && HEAP_CLASS_OF(obj) == rb_cFloat &&
+ if (RBASIC_CLASS(recv) == rb_cFloat && RBASIC_CLASS(obj) == rb_cFloat &&
BASIC_OP_UNREDEFINED_P(BOP_MOD, FLOAT_REDEFINED_OP_FLAG)) {
val = DBL2NUM(ruby_float_mod(RFLOAT_VALUE(recv), RFLOAT_VALUE(obj)));
}
@@ -1655,7 +1677,7 @@ opt_lt
val = RFLOAT_VALUE(recv) < RFLOAT_VALUE(obj) ? Qtrue : Qfalse;
}
else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) {
- if (HEAP_CLASS_OF(recv) == rb_cFloat && HEAP_CLASS_OF(obj) == rb_cFloat &&
+ if (RBASIC_CLASS(recv) == rb_cFloat && RBASIC_CLASS(obj) == rb_cFloat &&
BASIC_OP_UNREDEFINED_P(BOP_LT, FLOAT_REDEFINED_OP_FLAG)) {
val = double_cmp_lt(RFLOAT_VALUE(recv), RFLOAT_VALUE(obj));
}
@@ -1734,7 +1756,7 @@ opt_gt
val = RFLOAT_VALUE(recv) > RFLOAT_VALUE(obj) ? Qtrue : Qfalse;
}
else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) {
- if (HEAP_CLASS_OF(recv) == rb_cFloat && HEAP_CLASS_OF(obj) == rb_cFloat &&
+ if (RBASIC_CLASS(recv) == rb_cFloat && RBASIC_CLASS(obj) == rb_cFloat &&
BASIC_OP_UNREDEFINED_P(BOP_GT, FLOAT_REDEFINED_OP_FLAG)) {
val = double_cmp_gt(RFLOAT_VALUE(recv), RFLOAT_VALUE(obj));
}
@@ -1796,11 +1818,11 @@ opt_ltlt
(VALUE val)
{
if (!SPECIAL_CONST_P(recv)) {
- if (HEAP_CLASS_OF(recv) == rb_cString &&
+ if (RBASIC_CLASS(recv) == rb_cString &&
BASIC_OP_UNREDEFINED_P(BOP_LTLT, STRING_REDEFINED_OP_FLAG)) {
val = rb_str_concat(recv, obj);
}
- else if (HEAP_CLASS_OF(recv) == rb_cArray &&
+ else if (RBASIC_CLASS(recv) == rb_cArray &&
BASIC_OP_UNREDEFINED_P(BOP_LTLT, ARRAY_REDEFINED_OP_FLAG)) {
val = rb_ary_push(recv, obj);
}
@@ -1828,10 +1850,10 @@ opt_aref
(VALUE val)
{
if (!SPECIAL_CONST_P(recv)) {
- if (HEAP_CLASS_OF(recv) == rb_cArray && BASIC_OP_UNREDEFINED_P(BOP_AREF, ARRAY_REDEFINED_OP_FLAG) && FIXNUM_P(obj)) {
+ if (RBASIC_CLASS(recv) == rb_cArray && BASIC_OP_UNREDEFINED_P(BOP_AREF, ARRAY_REDEFINED_OP_FLAG) && FIXNUM_P(obj)) {
val = rb_ary_entry(recv, FIX2LONG(obj));
}
- else if (HEAP_CLASS_OF(recv) == rb_cHash && BASIC_OP_UNREDEFINED_P(BOP_AREF, HASH_REDEFINED_OP_FLAG)) {
+ else if (RBASIC_CLASS(recv) == rb_cHash && BASIC_OP_UNREDEFINED_P(BOP_AREF, HASH_REDEFINED_OP_FLAG)) {
val = rb_hash_aref(recv, obj);
}
else {
@@ -1858,11 +1880,11 @@ opt_aset
(VALUE val)
{
if (!SPECIAL_CONST_P(recv)) {
- if (HEAP_CLASS_OF(recv) == rb_cArray && BASIC_OP_UNREDEFINED_P(BOP_ASET, ARRAY_REDEFINED_OP_FLAG) && FIXNUM_P(obj)) {
+ if (RBASIC_CLASS(recv) == rb_cArray && BASIC_OP_UNREDEFINED_P(BOP_ASET, ARRAY_REDEFINED_OP_FLAG) && FIXNUM_P(obj)) {
rb_ary_store(recv, FIX2LONG(obj), set);
val = set;
}
- else if (HEAP_CLASS_OF(recv) == rb_cHash && BASIC_OP_UNREDEFINED_P(BOP_ASET, HASH_REDEFINED_OP_FLAG)) {
+ else if (RBASIC_CLASS(recv) == rb_cHash && BASIC_OP_UNREDEFINED_P(BOP_ASET, HASH_REDEFINED_OP_FLAG)) {
rb_hash_aset(recv, obj, set);
val = set;
}
@@ -1881,6 +1903,49 @@ opt_aset
/**
@c optimize
+ @e recv[str] = set
+ @j 最適化された recv[str] = set。
+ */
+DEFINE_INSN
+opt_aset_with
+(CALL_INFO ci, 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_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, 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)) {
+ 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()。
*/
@@ -1891,15 +1956,15 @@ opt_length
(VALUE val)
{
if (!SPECIAL_CONST_P(recv)) {
- if (HEAP_CLASS_OF(recv) == rb_cString &&
+ if (RBASIC_CLASS(recv) == rb_cString &&
BASIC_OP_UNREDEFINED_P(BOP_LENGTH, STRING_REDEFINED_OP_FLAG)) {
val = rb_str_length(recv);
}
- else if (HEAP_CLASS_OF(recv) == rb_cArray &&
+ else if (RBASIC_CLASS(recv) == rb_cArray &&
BASIC_OP_UNREDEFINED_P(BOP_LENGTH, ARRAY_REDEFINED_OP_FLAG)) {
val = LONG2NUM(RARRAY_LEN(recv));
}
- else if (HEAP_CLASS_OF(recv) == rb_cHash &&
+ else if (RBASIC_CLASS(recv) == rb_cHash &&
BASIC_OP_UNREDEFINED_P(BOP_LENGTH, HASH_REDEFINED_OP_FLAG)) {
val = INT2FIX(RHASH_SIZE(recv));
}
@@ -1926,15 +1991,15 @@ opt_size
(VALUE val)
{
if (!SPECIAL_CONST_P(recv)) {
- if (HEAP_CLASS_OF(recv) == rb_cString &&
+ if (RBASIC_CLASS(recv) == rb_cString &&
BASIC_OP_UNREDEFINED_P(BOP_SIZE, STRING_REDEFINED_OP_FLAG)) {
val = rb_str_length(recv);
}
- else if (HEAP_CLASS_OF(recv) == rb_cArray &&
+ else if (RBASIC_CLASS(recv) == rb_cArray &&
BASIC_OP_UNREDEFINED_P(BOP_SIZE, ARRAY_REDEFINED_OP_FLAG)) {
val = LONG2NUM(RARRAY_LEN(recv));
}
- else if (HEAP_CLASS_OF(recv) == rb_cHash &&
+ else if (RBASIC_CLASS(recv) == rb_cHash &&
BASIC_OP_UNREDEFINED_P(BOP_SIZE, HASH_REDEFINED_OP_FLAG)) {
val = INT2FIX(RHASH_SIZE(recv));
}
@@ -1961,17 +2026,17 @@ opt_empty_p
(VALUE val)
{
if (!SPECIAL_CONST_P(recv)) {
- if (HEAP_CLASS_OF(recv) == rb_cString &&
+ if (RBASIC_CLASS(recv) == rb_cString &&
BASIC_OP_UNREDEFINED_P(BOP_EMPTY_P, STRING_REDEFINED_OP_FLAG)) {
if (RSTRING_LEN(recv) == 0) val = Qtrue;
else val = Qfalse;
}
- else if (HEAP_CLASS_OF(recv) == rb_cArray &&
+ else if (RBASIC_CLASS(recv) == rb_cArray &&
BASIC_OP_UNREDEFINED_P(BOP_EMPTY_P, ARRAY_REDEFINED_OP_FLAG)) {
if (RARRAY_LEN(recv) == 0) val = Qtrue;
else val = Qfalse;
}
- else if (HEAP_CLASS_OF(recv) == rb_cHash &&
+ else if (RBASIC_CLASS(recv) == rb_cHash &&
BASIC_OP_UNREDEFINED_P(BOP_EMPTY_P, HASH_REDEFINED_OP_FLAG)) {
if (RHASH_EMPTY_P(recv)) val = Qtrue;
else val = Qfalse;
@@ -2014,11 +2079,11 @@ opt_succ
}
}
else {
- if (HEAP_CLASS_OF(recv) == rb_cString &&
+ if (RBASIC_CLASS(recv) == rb_cString &&
BASIC_OP_UNREDEFINED_P(BOP_SUCC, STRING_REDEFINED_OP_FLAG)) {
val = rb_str_succ(recv);
}
- else if (HEAP_CLASS_OF(recv) == rb_cTime &&
+ else if (RBASIC_CLASS(recv) == rb_cTime &&
BASIC_OP_UNREDEFINED_P(BOP_SUCC, TIME_REDEFINED_OP_FLAG)) {
val = rb_time_succ(recv);
}
@@ -2069,7 +2134,12 @@ opt_regexpmatch1
(VALUE obj)
(VALUE val)
{
- val = rb_reg_match(r, obj);
+ if (BASIC_OP_UNREDEFINED_P(BOP_MATCH, REGEXP_REDEFINED_OP_FLAG)) {
+ val = rb_reg_match(r, obj);
+ }
+ else {
+ val = rb_funcall(r, idEqTilde, 1, obj);
+ }
}
/**
@@ -2079,15 +2149,18 @@ opt_regexpmatch1
*/
DEFINE_INSN
opt_regexpmatch2
-()
+(CALL_INFO ci)
(VALUE obj2, VALUE obj1)
(VALUE val)
{
- if (RB_TYPE_P(obj2, T_STRING)) {
+ if (CLASS_OF(obj2) == rb_cString &&
+ BASIC_OP_UNREDEFINED_P(BOP_MATCH, STRING_REDEFINED_OP_FLAG)) {
val = rb_reg_match(obj1, obj2);
}
else {
- val = rb_funcall(obj2, idEqTilde, 1, obj1);
+ PUSH(obj2);
+ PUSH(obj1);
+ CALL_SIMPLE_METHOD(obj2);
}
}
diff --git a/internal.h b/internal.h
index 6926debf7c..1a9be71c31 100644
--- a/internal.h
+++ b/internal.h
@@ -19,6 +19,75 @@ 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
+# define VALGRIND_MAKE_MEM_DEFINED(p, n) VALGRIND_MAKE_READABLE((p), (n))
+# endif
+# ifndef VALGRIND_MAKE_MEM_UNDEFINED
+# define VALGRIND_MAKE_MEM_UNDEFINED(p, n) VALGRIND_MAKE_WRITABLE((p), (n))
+# endif
+#else
+# define VALGRIND_MAKE_MEM_DEFINED(p, n) 0
+# define VALGRIND_MAKE_MEM_UNDEFINED(p, n) 0
+#endif
+
+#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))))
+
+#define SIGNED_INTEGER_TYPE_P(int_type) (0 > ((int_type)0)-1)
+#define SIGNED_INTEGER_MAX(sint_type) \
+ (sint_type) \
+ ((((sint_type)1) << (sizeof(sint_type) * CHAR_BIT - 2)) | \
+ ((((sint_type)1) << (sizeof(sint_type) * CHAR_BIT - 2)) - 1))
+#define SIGNED_INTEGER_MIN(sint_type) (-SIGNED_INTEGER_MAX(sint_type)-1)
+#define UNSIGNED_INTEGER_MAX(uint_type) (~(uint_type)0)
+
+#if SIGNEDNESS_OF_TIME_T < 0 /* signed */
+# define TIMET_MAX SIGNED_INTEGER_MAX(time_t)
+# define TIMET_MIN SIGNED_INTEGER_MIN(time_t)
+#elif SIGNEDNESS_OF_TIME_T > 0 /* unsigned */
+# define TIMET_MAX UNSIGNED_INTEGER_MAX(time_t)
+# define TIMET_MIN ((time_t)0)
+#endif
+#define TIMET_MAX_PLUS_ONE (2*(double)(TIMET_MAX/2+1))
+
#define MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, min, max) ( \
(a) == 0 ? 0 : \
(a) == -1 ? (b) < -(max) : \
@@ -27,37 +96,425 @@ extern "C" {
((b) > 0 ? (min) / (a) < (b) : (max) / (a) > (b)))
#define MUL_OVERFLOW_FIXNUM_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, FIXNUM_MIN, FIXNUM_MAX)
#define MUL_OVERFLOW_LONG_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, LONG_MIN, LONG_MAX)
+#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
+
+#ifndef swap32
+# ifdef HAVE_BUILTIN___BUILTIN_BSWAP32
+# define swap32(x) __builtin_bswap32(x)
+# endif
+#endif
+
+#ifndef swap32
+# define swap32(x) ((uint32_t)((((x)&0xFF)<<24) \
+ |(((x)>>24)&0xFF) \
+ |(((x)&0x0000FF00)<<8) \
+ |(((x)&0x00FF0000)>>8) ))
+#endif
+
+#ifndef swap64
+# ifdef HAVE_BUILTIN___BUILTIN_BSWAP64
+# define swap64(x) __builtin_bswap64(x)
+# endif
+#endif
+
+#ifndef swap64
+# ifdef HAVE_INT64_T
+# define byte_in_64bit(n) ((uint64_t)0xff << (n))
+# define swap64(x) ((uint64_t)((((x)&byte_in_64bit(0))<<56) \
+ |(((x)>>56)&0xFF) \
+ |(((x)&byte_in_64bit(8))<<40) \
+ |(((x)&byte_in_64bit(48))>>40) \
+ |(((x)&byte_in_64bit(16))<<24) \
+ |(((x)&byte_in_64bit(40))>>24) \
+ |(((x)&byte_in_64bit(24))<<8) \
+ |(((x)&byte_in_64bit(32))>>8)))
+# endif
+#endif
+
+static inline int
+nlz_int(unsigned int x)
+{
+#if defined(HAVE_BUILTIN___BUILTIN_CLZ)
+ if (x == 0) return SIZEOF_INT * CHAR_BIT;
+ return __builtin_clz(x);
+#else
+ unsigned int y;
+# if 64 < SIZEOF_INT * CHAR_BIT
+ int n = 128;
+# elif 32 < SIZEOF_INT * CHAR_BIT
+ int n = 64;
+# else
+ int n = 32;
+# endif
+# if 64 < SIZEOF_INT * CHAR_BIT
+ y = x >> 64; if (y) {n -= 64; x = y;}
+# endif
+# if 32 < SIZEOF_INT * CHAR_BIT
+ y = x >> 32; if (y) {n -= 32; x = y;}
+# endif
+ y = x >> 16; if (y) {n -= 16; x = y;}
+ y = x >> 8; if (y) {n -= 8; x = y;}
+ y = x >> 4; if (y) {n -= 4; x = y;}
+ y = x >> 2; if (y) {n -= 2; x = y;}
+ y = x >> 1; if (y) {return n - 2;}
+ return (int)(n - x);
+#endif
+}
+
+static inline int
+nlz_long(unsigned long x)
+{
+#if defined(HAVE_BUILTIN___BUILTIN_CLZL)
+ if (x == 0) return SIZEOF_LONG * CHAR_BIT;
+ return __builtin_clzl(x);
+#else
+ unsigned long y;
+# if 64 < SIZEOF_LONG * CHAR_BIT
+ int n = 128;
+# elif 32 < SIZEOF_LONG * CHAR_BIT
+ int n = 64;
+# else
+ int n = 32;
+# endif
+# if 64 < SIZEOF_LONG * CHAR_BIT
+ y = x >> 64; if (y) {n -= 64; x = y;}
+# endif
+# if 32 < SIZEOF_LONG * CHAR_BIT
+ y = x >> 32; if (y) {n -= 32; x = y;}
+# endif
+ y = x >> 16; if (y) {n -= 16; x = y;}
+ y = x >> 8; if (y) {n -= 8; x = y;}
+ y = x >> 4; if (y) {n -= 4; x = y;}
+ y = x >> 2; if (y) {n -= 2; x = y;}
+ y = x >> 1; if (y) {return n - 2;}
+ return (int)(n - x);
+#endif
+}
+
+#ifdef HAVE_LONG_LONG
+static inline int
+nlz_long_long(unsigned LONG_LONG x)
+{
+#if defined(HAVE_BUILTIN___BUILTIN_CLZLL)
+ if (x == 0) return SIZEOF_LONG_LONG * CHAR_BIT;
+ return __builtin_clzll(x);
+#else
+ unsigned LONG_LONG y;
+# if 64 < SIZEOF_LONG_LONG * CHAR_BIT
+ int n = 128;
+# elif 32 < SIZEOF_LONG_LONG * CHAR_BIT
+ int n = 64;
+# else
+ int n = 32;
+# endif
+# if 64 < SIZEOF_LONG_LONG * CHAR_BIT
+ y = x >> 64; if (y) {n -= 64; x = y;}
+# endif
+# if 32 < SIZEOF_LONG_LONG * CHAR_BIT
+ y = x >> 32; if (y) {n -= 32; x = y;}
+# endif
+ y = x >> 16; if (y) {n -= 16; x = y;}
+ y = x >> 8; if (y) {n -= 8; x = y;}
+ y = x >> 4; if (y) {n -= 4; x = y;}
+ y = x >> 2; if (y) {n -= 2; x = y;}
+ y = x >> 1; if (y) {return n - 2;}
+ return (int)(n - x);
+#endif
+}
+#endif
+
+#ifdef HAVE_UINT128_T
+static inline int
+nlz_int128(uint128_t x)
+{
+ uint128_t y;
+ int n = 128;
+ y = x >> 64; if (y) {n -= 64; x = y;}
+ y = x >> 32; if (y) {n -= 32; x = y;}
+ y = x >> 16; if (y) {n -= 16; x = y;}
+ y = x >> 8; if (y) {n -= 8; x = y;}
+ y = x >> 4; if (y) {n -= 4; x = y;}
+ y = x >> 2; if (y) {n -= 2; x = y;}
+ y = x >> 1; if (y) {return n - 2;}
+ return (int)(n - x);
+}
+#endif
+
+#if defined(HAVE_UINT128_T)
+# define bit_length(x) \
+ (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)(x)) : \
+ sizeof(x) <= SIZEOF_LONG ? SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x)) : \
+ sizeof(x) <= SIZEOF_LONG_LONG ? SIZEOF_LONG_LONG * CHAR_BIT - nlz_long_long((unsigned LONG_LONG)(x)) : \
+ SIZEOF_INT128_T * CHAR_BIT - nlz_int128((uint128_t)(x)))
+#elif defined(HAVE_LONG_LONG)
+# define bit_length(x) \
+ (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)(x)) : \
+ sizeof(x) <= SIZEOF_LONG ? SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x)) : \
+ SIZEOF_LONG_LONG * CHAR_BIT - nlz_long_long((unsigned LONG_LONG)(x)))
+#else
+# define bit_length(x) \
+ (sizeof(x) <= SIZEOF_INT ? SIZEOF_INT * CHAR_BIT - nlz_int((unsigned int)(x)) : \
+ SIZEOF_LONG * CHAR_BIT - nlz_long((unsigned long)(x)))
+#endif
struct rb_deprecated_classext_struct {
char conflict[sizeof(VALUE) * 3];
};
+struct rb_subclass_entry;
+typedef struct rb_subclass_entry rb_subclass_entry_t;
+
+struct rb_subclass_entry {
+ VALUE klass;
+ rb_subclass_entry_t *next;
+};
+
+#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 {
- VALUE super;
+ struct st_table *iv_index_tbl;
struct st_table *iv_tbl;
struct st_table *const_tbl;
+ rb_subclass_entry_t *subclasses;
+ rb_subclass_entry_t **parent_subclasses;
+ /**
+ * In the case that this is an `ICLASS`, `module_subclasses` points to the link
+ * in the module's `subclasses` list that indicates that the klass has been
+ * included. Hopefully that makes sense.
+ */
+ rb_subclass_entry_t **module_subclasses;
+ rb_serial_t class_serial;
VALUE origin;
VALUE refined_class;
rb_alloc_func_t allocator;
};
-#undef RCLASS_SUPER
+struct method_table_wrapper {
+ st_table *tbl;
+ size_t serial;
+};
+
+#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 RSymbol {
+ struct RBasic basic;
+ VALUE fstr;
+ ID type;
+};
+
+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_REAL
+#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
+
+/* class.c */
+void rb_class_subclass_add(VALUE super, VALUE klass);
+void rb_class_remove_from_super_subclasses(VALUE);
+
#define RCLASS_EXT(c) (RCLASS(c)->ptr)
-#define RCLASS_SUPER(c) (RCLASS_EXT(c)->super)
#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_IV_INDEX_TBL(c) (RCLASS(c)->iv_index_tbl)
+#define RCLASS_M_TBL_WRAPPER(c) (RCLASS(c)->m_tbl_wrapper)
+#define RCLASS_M_TBL(c) (RCLASS_M_TBL_WRAPPER(c) ? RCLASS_M_TBL_WRAPPER(c)->tbl : 0)
+#define RCLASS_IV_INDEX_TBL(c) (RCLASS_EXT(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)
+
+static inline void
+RCLASS_M_TBL_INIT(VALUE c)
+{
+ struct method_table_wrapper *wrapper;
+ wrapper = ALLOC(struct method_table_wrapper);
+ wrapper->tbl = st_init_numtable();
+ wrapper->serial = 0;
+ RCLASS_M_TBL_WRAPPER(c) = wrapper;
+}
+
+#undef RCLASS_SUPER
+static inline VALUE
+RCLASS_SUPER(VALUE klass)
+{
+ return RCLASS(klass)->super;
+}
+
+static inline VALUE
+RCLASS_SET_SUPER(VALUE klass, VALUE super)
+{
+ if (super) {
+ rb_class_remove_from_super_subclasses(klass);
+ rb_class_subclass_add(super, klass);
+ }
+ RB_OBJ_WRITE(klass, &RCLASS(klass)->super, super);
+ return super;
+}
struct vtm; /* defined by timev.h */
/* array.c */
-VALUE rb_ary_last(int, VALUE *, VALUE);
+VALUE rb_ary_last(int, const VALUE *, VALUE);
void rb_ary_set_len(VALUE, long);
-VALUE rb_ary_cat(VALUE, const VALUE *, long);
void rb_ary_delete_same(VALUE, VALUE);
+VALUE rb_ary_tmp_new_fill(long capa);
/* bignum.c */
VALUE rb_big_fdiv(VALUE x, VALUE y);
@@ -66,13 +523,18 @@ VALUE rb_integer_float_cmp(VALUE x, VALUE y);
VALUE rb_integer_float_eq(VALUE x, VALUE y);
/* class.c */
-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);
+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);
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);
/* compar.c */
@@ -89,6 +551,7 @@ VALUE rb_insns_name_array(void);
/* cont.c */
VALUE rb_obj_is_fiber(VALUE);
void rb_fiber_reset_root_local_storage(VALUE);
+void ruby_register_rollback_func_for_ensure(VALUE (*ensure_func)(ANYARGS), VALUE (*rollback_func)(ANYARGS));
/* debug.c */
PRINTF_ARGS(void ruby_debug_printf(const char*, ...), 1, 2);
@@ -97,9 +560,32 @@ PRINTF_ARGS(void ruby_debug_printf(const char*, ...), 1, 2);
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);
-
-/* encoding.c */
void rb_gc_mark_encodings(void);
/* error.c */
@@ -121,7 +607,8 @@ void rb_call_end_proc(VALUE data);
void rb_mark_end_proc(void);
/* file.c */
-VALUE rb_home_dir(const char *user, VALUE result);
+VALUE rb_home_dir_of(VALUE user, VALUE result);
+VALUE rb_default_home_dir(VALUE result);
VALUE rb_realpath_internal(VALUE basedir, VALUE path, int strict);
void rb_file_const(const char*, VALUE);
int rb_file_load_ok(const char *);
@@ -131,14 +618,55 @@ VALUE rb_get_path_check_to_string(VALUE, int);
VALUE rb_get_path_check_convert(VALUE, VALUE, int);
void Init_File(void);
-#ifdef _WIN32
-/* file.c, win32/file.c */
-void rb_w32_init_file(void);
+#ifdef RUBY_FUNCTION_NAME_STRING
+# if defined __GNUC__ && __GNUC__ >= 4
+# pragma GCC visibility push(default)
+# endif
+NORETURN(void rb_sys_fail_path_in(const char *func_name, VALUE path));
+NORETURN(void rb_syserr_fail_path_in(const char *func_name, int err, VALUE path));
+# if defined __GNUC__ && __GNUC__ >= 4
+# pragma GCC visibility pop
+# endif
+# define rb_sys_fail_path(path) rb_sys_fail_path_in(RUBY_FUNCTION_NAME_STRING, path)
+# define rb_syserr_fail_path(err, path) rb_syserr_fail_path_in(RUBY_FUNCTION_NAME_STRING, (err), (path))
+#else
+# define rb_sys_fail_path(path) rb_sys_fail_str(path)
+# define rb_syserr_fail_path(err, path) rb_syserr_fail_str((err), (path))
#endif
/* gc.c */
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);
+
+#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 *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);
+
+/* hash.c */
+struct st_table *rb_hash_tbl_raw(VALUE hash);
+#define RHASH_TBL_RAW(h) rb_hash_tbl_raw(h)
+VALUE rb_hash_keys(VALUE hash);
+VALUE rb_hash_values(VALUE hash);
+#define HASH_DELETED FL_USER1
+#define HASH_PROC_DEFAULT FL_USER2
/* inits.c */
void rb_call_inits(void);
@@ -149,9 +677,17 @@ void ruby_set_inplace_mode(const char *);
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);
/* 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);
@@ -164,25 +700,110 @@ 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, VALUE *argv);
+VALUE rb_math_log(int argc, const 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);
/* numeric.c */
int rb_num_to_uint(VALUE val, unsigned int *ret);
-VALUE num_interval_step_size(VALUE from, VALUE to, VALUE step, int excl);
+VALUE ruby_num_interval_step_size(VALUE from, VALUE to, VALUE step, int excl);
int ruby_float_step(VALUE from, VALUE to, VALUE step, int excl);
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);
+
+#if USE_FLONUM
+#define RUBY_BIT_ROTL(v, n) (((v) << (n)) | ((v) >> ((sizeof(v) * 8) - n)))
+#define RUBY_BIT_ROTR(v, n) (((v) >> (n)) | ((v) << ((sizeof(v) * 8) - n)))
+#endif
+
+static inline double
+rb_float_value_inline(VALUE v)
+{
+#if USE_FLONUM
+ 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 ((struct RFloat *)v)->float_value;
+}
+
+static inline VALUE
+rb_float_new_inline(double d)
+{
+#if USE_FLONUM
+ union {
+ double d;
+ VALUE v;
+ } t;
+ int bits;
+
+ t.d = d;
+ bits = (int)((VALUE)(t.v >> 60) & 0x7);
+ /* bits contains 3 bits of b62..b60. */
+ /* bits - 3 = */
+ /* b011 -> b000 */
+ /* b100 -> b001 */
+
+ if (t.v != 0x3000000000000000 /* 1.72723e-77 */ &&
+ !((bits-3) & ~0x01)) {
+ return (RUBY_BIT_ROTL(t.v, 3) & ~(VALUE)0x01) | 0x02;
+ }
+ else if (t.v == (VALUE)0) {
+ /* +0.0 */
+ return 0x8000000000000002;
+ }
+ /* out of range */
+#endif
+ return rb_float_new_in_heap(d);
+}
+
+#define rb_float_value(v) rb_float_value_inline(v)
+#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);
+
+struct RBasicRaw {
+ VALUE flags;
+ VALUE klass;
+};
+
+#define RBASIC_CLEAR_CLASS(obj) (((struct RBasicRaw *)((VALUE)(obj)))->klass = 0)
+#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); \
+} 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);
@@ -193,12 +814,16 @@ 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);
-void rb_gc_mark_parser(void);
-void rb_gc_mark_symbols(void);
+ID rb_make_internal_id(void);
+void rb_gc_free_dsymbol(VALUE);
+VALUE rb_str_dynamic_intern(VALUE);
+ID rb_id_attrget(ID id);
/* 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_block_clear_env_self(VALUE proc);
/* process.c */
#define RB_MAX_GROUPS (65536)
@@ -262,6 +887,8 @@ VALUE rb_rational_reciprocal(VALUE x);
/* 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 */
int rb_get_next_signal(void);
@@ -276,13 +903,26 @@ size_t rb_strftime(char *s, size_t maxsize, const char *format, rb_encoding *enc
#endif
/* string.c */
+void Init_frozen_strings(void);
+VALUE rb_fstring(VALUE);
+VALUE rb_fstring_new(const char *ptr, long len);
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);
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);
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);
+#endif
+#define STR_NOEMBED FL_USER1
+#define STR_SHARED FL_USER2 /* = ELTS_SHARED */
+#define STR_EMBED_P(str) (!FL_TEST((str), STR_NOEMBED))
+#define STR_SHARED_P(s) FL_ALL((s), STR_NOEMBED|ELTS_SHARED)
+#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)
/* struct.c */
VALUE rb_struct_init_copy(VALUE copy, VALUE s);
@@ -303,14 +943,19 @@ VALUE rb_thread_shield_destroy(VALUE self);
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);
+void ruby_kill(rb_pid_t pid, int sig);
/* thread_pthread.c, thread_win32.c */
void Init_native_thread(void);
+/* vm_insnhelper.h */
+rb_serial_t rb_next_class_serial(void);
+
/* vm.c */
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);
@@ -318,17 +963,24 @@ 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);
+void rb_vm_pop_cfunc_frame(void);
/* 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, VALUE *, VALUE (*)(ANYARGS), VALUE);
-typedef void rb_check_funcall_hook(int, VALUE, ID, int, VALUE *, VALUE);
-VALUE rb_check_funcall_with_hook(VALUE recv, ID mid, int argc, VALUE *argv,
+VALUE rb_check_block_call(VALUE, ID, int, const VALUE *, rb_block_call_func_t, 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_catch_protect(VALUE t, rb_block_call_func *func, VALUE data, int *stateptr);
+
+/* vm_insnhelper.c */
+VALUE rb_equal_opt(VALUE obj1, VALUE obj2);
+int rb_get_kwargs(VALUE keyword_hash, const ID *table, int required, int optional, VALUE *);
+VALUE rb_extract_keywords(VALUE *orighash);
/* vm_method.c */
void Init_eval_method(void);
@@ -339,46 +991,98 @@ void Init_prelude(void);
/* vm_backtrace.c */
void Init_vm_backtrace(void);
-VALUE vm_thread_backtrace(int argc, VALUE *argv, VALUE thval);
-VALUE vm_thread_backtrace_locations(int argc, VALUE *argv, VALUE thval);
+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_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_vm_backtrace_object();
+VALUE rb_backtrace_to_location_ary(VALUE obj);
+void rb_backtrace_print_to(VALUE output);
+VALUE rb_vm_backtrace_object(void);
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
+RUBY_SYMBOL_EXPORT_BEGIN
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 */
+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);
+VALUE rb_big_mul_toom3(VALUE x, VALUE y);
+VALUE rb_big_sq_fast(VALUE x);
+VALUE rb_big_divrem_normal(VALUE x, VALUE y);
+VALUE rb_big2str_poweroftwo(VALUE x, int base);
+VALUE rb_big2str_generic(VALUE x, int base);
+VALUE rb_str2big_poweroftwo(VALUE arg, int base, int badcheck);
+VALUE rb_str2big_normal(VALUE arg, int base, int badcheck);
+VALUE rb_str2big_karatsuba(VALUE arg, int base, int badcheck);
+#if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H)
+VALUE rb_big_mul_gmp(VALUE x, VALUE y);
+VALUE rb_big_divrem_gmp(VALUE x, VALUE y);
+VALUE rb_big2str_gmp(VALUE x, int base);
+VALUE rb_str2big_gmp(VALUE arg, int base, int badcheck);
+#endif
+
+/* error.c */
+int rb_bug_reporter_add(void (*func)(FILE *, void *), void *data);
+
+/* file.c */
+#ifdef __APPLE__
+VALUE rb_str_normalize_ospath(const char *ptr, long len);
+#endif
+
/* io.c */
void rb_maygvl_fd_fix_cloexec(int fd);
+/* numeric.c */
+VALUE rb_int_positive_pow(long x, unsigned long y);
+
/* 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, VALUE *argv, int accept_shell);
+VALUE rb_execarg_new(int argc, const VALUE *argv, int accept_shell);
struct rb_execarg *rb_execarg_get(VALUE execarg_obj); /* dangerous. needs GC guard. */
-VALUE rb_execarg_init(int argc, VALUE *argv, int accept_shell, VALUE execarg_obj);
+VALUE rb_execarg_init(int argc, const VALUE *argv, int accept_shell, VALUE execarg_obj);
int rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val);
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 */
+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 */
+#ifdef RUBY_ENCODING_H
+/* internal use */
+VALUE rb_setup_fake_str(struct RString *fake_str, const char *name, long len, rb_encoding *enc);
+#endif
+
+/* util.c */
+extern const signed char ruby_digit36_to_number_table[];
+
/* variable.c */
void rb_gc_mark_global_tbl(void);
void rb_mark_generic_ivar(VALUE);
void rb_mark_generic_ivar_tbl(void);
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
-#endif
+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);
+#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);
+
+RUBY_SYMBOL_EXPORT_END
#if defined(__cplusplus)
#if 0
diff --git a/io.c b/io.c
index 23ab37144a..5909a0be50 100644
--- a/io.c
+++ b/io.c
@@ -21,6 +21,7 @@
#include <errno.h>
#include "ruby_atomic.h"
+#undef free
#define free(x) xfree(x)
#if defined(DOSISH) || defined(__CYGWIN__)
@@ -64,6 +65,13 @@
#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
#include <sys/stat.h>
@@ -86,6 +94,10 @@
#include <sys/syscall.h>
#endif
+#ifdef HAVE_SYS_UIO_H
+#include <sys/uio.h>
+#endif
+
#if defined(__BEOS__) || defined(__HAIKU__)
# ifndef NOFILE
# define NOFILE (OPEN_MAX)
@@ -110,13 +122,15 @@
# endif
#endif
+#ifndef EWOULDBLOCK
+# define EWOULDBLOCK EAGAIN
+#endif
+
#if defined(HAVE___SYSCALL) && (defined(__APPLE__) || defined(__OpenBSD__))
/* Mac OS X and OpenBSD have __syscall but don't define it in headers */
off_t __syscall(quad_t number, ...);
#endif
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
-
#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)
@@ -133,6 +147,16 @@ 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;
+static VALUE rb_eEWOULDBLOCKWaitReadable;
+static VALUE rb_eEWOULDBLOCKWaitWritable;
+static VALUE rb_eEINPROGRESSWaitWritable;
+static VALUE rb_eEINPROGRESSWaitReadable;
VALUE rb_stdin, rb_stdout, rb_stderr;
VALUE rb_deferr; /* rescue VIM plugin */
@@ -147,7 +171,14 @@ static VALUE argf;
static ID id_write, id_read, id_getc, id_flush, id_readpartial, id_set_encoding;
static VALUE sym_mode, sym_perm, sym_extenc, sym_intenc, sym_encoding, sym_open_args;
-static VALUE sym_textmode, sym_binmode, sym_autoclose;
+static VALUE sym_textmode, sym_binmode, sym_autoclose, sym_exception;
+static VALUE sym_SET, sym_CUR, sym_END;
+#ifdef SEEK_DATA
+static VALUE sym_DATA;
+#endif
+#ifdef SEEK_HOLE
+static VALUE sym_HOLE;
+#endif
struct argf {
VALUE filename, current_file;
@@ -166,6 +197,9 @@ 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);
}
@@ -205,10 +239,29 @@ 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)
+{
+#ifdef O_CLOEXEC
+ 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;
@@ -217,7 +270,15 @@ rb_cloexec_open(const char *pathname, int flags, mode_t mode)
#endif
ret = open(pathname, flags, mode);
if (ret == -1) return -1;
- rb_maygvl_fd_fix_cloexec(ret);
+ 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);
+ }
return ret;
}
@@ -256,10 +317,6 @@ 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;
}
@@ -350,22 +407,6 @@ 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)
@@ -405,8 +446,6 @@ rb_cloexec_fcntl_dupfd(int fd, int minfd)
# endif
#endif
-#define rb_sys_fail_path(path) rb_sys_fail_str(path)
-
static int io_fflush(rb_io_t *);
static rb_io_t *flush_before_seek(rb_io_t *fptr);
@@ -577,6 +616,8 @@ is_socket(int fd, VALUE path)
}
#endif
+static const char closed_stream[] = "closed stream";
+
void
rb_eof_error(void)
{
@@ -586,8 +627,6 @@ rb_eof_error(void)
VALUE
rb_io_taint_check(VALUE io)
{
- if (!OBJ_UNTRUSTED(io) && rb_safe_level() >= 4)
- rb_raise(rb_eSecurityError, "Insecure: operation on trusted IO");
rb_check_frozen(io);
return io;
}
@@ -605,7 +644,7 @@ 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);
}
}
@@ -823,14 +862,6 @@ rb_io_read_pending(rb_io_t *fptr)
}
void
-rb_read_check(FILE *fp)
-{
- if (!STDIO_READ_DATA_PENDING(fp)) {
- rb_thread_wait_fd(fileno(fp));
- }
-}
-
-void
rb_io_read_check(rb_io_t *fptr)
{
if (!READ_DATA_PENDING(fptr)) {
@@ -907,6 +938,14 @@ 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)
{
@@ -928,6 +967,15 @@ 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)
{
@@ -962,6 +1010,19 @@ 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)
+{
+ 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);
+}
+#endif
+
static long
io_writable_length(rb_io_t *fptr, long l)
{
@@ -1025,10 +1086,11 @@ 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;
- } else
- return ret;
+ }
+ return ret;
}
static inline int
@@ -1064,7 +1126,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:
@@ -1090,7 +1152,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:
@@ -1190,13 +1252,75 @@ 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 (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 {
+ long l = io_writable_length(fptr, p->length);
+ r = rb_write_internal(fptr->fd, p->ptr, l);
+ }
+
+ return r;
+}
+#else
static VALUE
io_binwrite_string(VALUE arg)
{
struct binwrite_arg *p = (struct binwrite_arg *)arg;
- long l = io_writable_length(p->fptr, p->length);
- return rb_write_internal2(p->fptr->fd, p->ptr, l);
+ 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);
+
+ l = io_writable_length(p->fptr, p->length);
+ return rb_write_internal(p->fptr->fd, p->ptr, l);
}
+#endif
static long
io_binwrite(VALUE str, const char *ptr, long len, rb_io_t *fptr, int nosync)
@@ -1219,27 +1343,6 @@ 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:
@@ -1249,8 +1352,7 @@ 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 {
- long l = io_writable_length(fptr, n);
- r = rb_write_internal(fptr->fd, ptr+offset, l);
+ r = io_binwrite_string((VALUE)&arg);
}
/* xxx: other threads may modify given string. */
if (r == n) return len;
@@ -1258,7 +1360,9 @@ 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)
@@ -1280,7 +1384,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)
+do_writeconv(VALUE str, rb_io_t *fptr, int *converted)
{
if (NEED_WRITECONV(fptr)) {
VALUE common_encoding = Qnil;
@@ -1308,10 +1412,12 @@ do_writeconv(VALUE str, rb_io_t *fptr)
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)
@@ -1337,13 +1443,19 @@ do_writeconv(VALUE str, rb_io_t *fptr)
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);
+ str = do_writeconv(str, fptr, &converted);
+ if (converted)
+ OBJ_FREEZE(str);
+ else
+ str = rb_str_new_frozen(str);
+
return io_binwrite(str, RSTRING_PTR(str), RSTRING_LEN(str),
fptr, nosync);
}
@@ -1365,7 +1477,6 @@ io_write(VALUE io, VALUE str, int nosync)
long n;
VALUE tmp;
- rb_secure(4);
io = GetWriteIO(io);
str = rb_obj_as_string(str);
tmp = rb_io_check_io(io);
@@ -1376,8 +1487,6 @@ 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);
@@ -1414,7 +1523,7 @@ io_write_m(VALUE io, VALUE str)
VALUE
rb_io_write(VALUE io, VALUE str)
{
- return rb_funcall(io, id_write, 1, str);
+ return rb_funcallv(io, id_write, 1, &str);
}
/*
@@ -1450,24 +1559,8 @@ nogvl_fsync(void *ptr)
}
#endif
-/*
- * call-seq:
- * ios.flush -> ios
- *
- * Flushes any buffered data within <em>ios</em> to the underlying
- * operating system (note that this is Ruby internal buffering only;
- * the OS may buffer the data as well).
- *
- * $stdout.print "no newline"
- * $stdout.flush
- *
- * <em>produces:</em>
- *
- * no newline
- */
-
VALUE
-rb_io_flush(VALUE io)
+rb_io_flush_raw(VALUE io, int sync)
{
rb_io_t *fptr;
@@ -1481,11 +1574,6 @@ rb_io_flush(VALUE io)
if (fptr->mode & FMODE_WRITABLE) {
if (io_fflush(fptr) < 0)
rb_sys_fail(0);
-#ifdef _WIN32
- if (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);
@@ -1496,6 +1584,28 @@ rb_io_flush(VALUE io)
/*
* call-seq:
+ * ios.flush -> ios
+ *
+ * Flushes any buffered data within <em>ios</em> to the underlying
+ * operating system (note that this is Ruby internal buffering only;
+ * the OS may buffer the data as well).
+ *
+ * $stdout.print "no newline"
+ * $stdout.flush
+ *
+ * <em>produces:</em>
+ *
+ * no newline
+ */
+
+VALUE
+rb_io_flush(VALUE io)
+{
+ return rb_io_flush_raw(io, 1);
+}
+
+/*
+ * call-seq:
* ios.pos -> integer
* ios.tell -> integer
*
@@ -1534,6 +1644,26 @@ rb_io_seek(VALUE io, VALUE offset, int whence)
return INT2FIX(0);
}
+static int
+interpret_seek_whence(VALUE vwhence)
+{
+ if (vwhence == sym_SET)
+ return SEEK_SET;
+ if (vwhence == sym_CUR)
+ return SEEK_CUR;
+ if (vwhence == sym_END)
+ return SEEK_END;
+#ifdef SEEK_DATA
+ if (vwhence == sym_DATA)
+ return SEEK_DATA;
+#endif
+#ifdef SEEK_HOLE
+ if (vwhence == sym_HOLE)
+ return SEEK_HOLE;
+#endif
+ return NUM2INT(vwhence);
+}
+
/*
* call-seq:
* ios.seek(amount, whence=IO::SEEK_SET) -> 0
@@ -1541,12 +1671,12 @@ rb_io_seek(VALUE io, VALUE offset, int whence)
* Seeks to a given offset <i>anInteger</i> in the stream according to
* the value of <i>whence</i>:
*
- * IO::SEEK_CUR | Seeks to _amount_ plus current position
- * --------------+----------------------------------------------------
- * IO::SEEK_END | Seeks to _amount_ plus end of stream (you probably
- * | want a negative value for _amount_)
- * --------------+----------------------------------------------------
- * IO::SEEK_SET | Seeks to the absolute location given by _amount_
+ * :CUR or IO::SEEK_CUR | Seeks to _amount_ plus current position
+ * ----------------------+--------------------------------------------------
+ * :END or IO::SEEK_END | Seeks to _amount_ plus end of stream (you
+ * | probably want a negative value for _amount_)
+ * ----------------------+--------------------------------------------------
+ * :SET or IO::SEEK_SET | Seeks to the absolute location given by _amount_
*
* Example:
*
@@ -1562,7 +1692,7 @@ rb_io_seek_m(int argc, VALUE *argv, VALUE io)
int whence = SEEK_SET;
if (rb_scan_args(argc, argv, "11", &offset, &ptrname) == 2) {
- whence = NUM2INT(ptrname);
+ whence = interpret_seek_whence(ptrname);
}
return rb_io_seek(io, offset, whence);
@@ -1573,7 +1703,7 @@ rb_io_seek_m(int argc, VALUE *argv, VALUE io)
* ios.pos = integer -> integer
*
* Seeks to the given position (in bytes) in <em>ios</em>.
- * It is not guranteed that seeking to the right position when <em>ios</em>
+ * It is not guaranteed that seeking to the right position when <em>ios</em>
* is textmode.
*
* f = File.new("testfile")
@@ -1620,11 +1750,6 @@ rb_io_rewind(VALUE io)
GetOpenFile(io, fptr);
if (io_seek(fptr, 0L, 0) < 0 && errno) rb_sys_fail_path(fptr->pathv);
-#ifdef _WIN32
- if (GetFileType((HANDLE)rb_w32_get_osfhandle(fptr->fd)) == FILE_TYPE_DISK) {
- fsync(fptr->fd);
- }
-#endif
if (io == ARGF.current_file) {
ARGF.lineno -= fptr->lineno;
}
@@ -1658,7 +1783,13 @@ io_fillbuf(rb_io_t *fptr)
if (r < 0) {
if (rb_io_wait_readable(fptr->fd))
goto retry;
- rb_sys_fail_path(fptr->pathv);
+ {
+ VALUE path = rb_sprintf("fd:%d ", fptr->fd);
+ if (!NIL_P(fptr->pathv)) {
+ rb_str_append(path, fptr->pathv);
+ }
+ rb_sys_fail_path(path);
+ }
}
fptr->rbuf.off = 0;
fptr->rbuf.len = (int)r; /* r should be <= rbuf_capa */
@@ -1804,10 +1935,8 @@ 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
@@ -1877,10 +2006,10 @@ rb_io_fdatasync(VALUE io)
static VALUE
rb_io_fileno(VALUE io)
{
- rb_io_t *fptr;
+ rb_io_t *fptr = RFILE(io)->fptr;
int fd;
- GetOpenFile(io, fptr);
+ rb_io_check_closed(fptr);
fd = fptr->fd;
return INT2FIX(fd);
}
@@ -1932,7 +2061,7 @@ rb_io_inspect(VALUE obj)
VALUE result;
static const char closed[] = " (closed)";
- fptr = RFILE(rb_io_taint_check(obj))->fptr;
+ fptr = RFILE(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)));
@@ -2061,8 +2190,6 @@ 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)
{
@@ -2253,10 +2380,7 @@ io_setstrbuf(VALUE *str, long len)
VALUE s = StringValue(*str);
long clen = RSTRING_LEN(s);
if (clen >= len) {
- if (clen != len) {
- rb_str_modify(s);
- rb_str_set_len(s, len);
- }
+ rb_str_modify(s);
return;
}
len -= clen;
@@ -2283,23 +2407,27 @@ 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);
}
}
@@ -2354,6 +2482,9 @@ rb_io_set_nonblock(rb_io_t *fptr)
}
}
+void
+rb_readwrite_sys_fail(int writable, const char *mesg);
+
struct read_internal_arg {
int fd;
char *str_ptr;
@@ -2369,14 +2500,14 @@ read_internal_call(VALUE arg)
}
static VALUE
-io_getpartial(int argc, VALUE *argv, VALUE io, 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);
@@ -2408,8 +2539,12 @@ io_getpartial(int argc, VALUE *argv, VALUE io, int nonblock)
if (n < 0) {
if (!nonblock && rb_io_wait_readable(fptr->fd))
goto again;
- if (nonblock && (errno == EWOULDBLOCK || errno == EAGAIN))
- rb_mod_sys_fail(rb_mWaitReadable, "read would block");
+ if (nonblock && (errno == EWOULDBLOCK || errno == EAGAIN)) {
+ if (no_exception)
+ return ID2SYM(rb_intern("wait_readable"));
+ else
+ rb_readwrite_sys_fail(RB_IO_WAIT_READABLE, "read would block");
+ }
rb_sys_fail_path(fptr->pathv);
}
}
@@ -2485,12 +2620,25 @@ io_readpartial(int argc, VALUE *argv, VALUE io)
{
VALUE ret;
- ret = io_getpartial(argc, argv, io, 0);
+ ret = io_getpartial(argc, argv, io, 0, 0);
if (NIL_P(ret))
rb_eof_error();
return ret;
}
+static VALUE
+get_kwargs_exception(VALUE opts)
+{
+ static ID ids[1];
+ VALUE except;
+
+ if (!ids[0])
+ ids[0] = sym_exception;
+
+ rb_get_kwargs(opts, ids, 0, 1, &except);
+ return except;
+}
+
/*
* call-seq:
* ios.read_nonblock(maxlen) -> string
@@ -2546,16 +2694,63 @@ static VALUE
io_read_nonblock(int argc, VALUE *argv, VALUE io)
{
VALUE ret;
+ VALUE opts = Qnil;
+ int no_exception = 0;
- ret = io_getpartial(argc, argv, io, 1);
- if (NIL_P(ret))
- rb_eof_error();
+ rb_scan_args(argc, argv, "11:", NULL, NULL, &opts);
+
+ if (!NIL_P(opts) && Qfalse == get_kwargs_exception(opts))
+ no_exception = 1;
+
+ ret = io_getpartial(argc, argv, io, 1, no_exception);
+
+ if (NIL_P(ret)) {
+ if (no_exception)
+ return Qnil;
+ else
+ rb_eof_error();
+ }
return ret;
}
+static VALUE
+io_write_nonblock(VALUE io, VALUE str, int no_exception)
+{
+ rb_io_t *fptr;
+ long n;
+
+ if (!RB_TYPE_P(str, T_STRING))
+ str = rb_obj_as_string(str);
+
+ io = GetWriteIO(io);
+ GetOpenFile(io, fptr);
+ rb_io_check_writable(fptr);
+
+ if (io_fflush(fptr) < 0)
+ rb_sys_fail(0);
+
+ rb_io_set_nonblock(fptr);
+ n = write(fptr->fd, RSTRING_PTR(str), RSTRING_LEN(str));
+
+ if (n == -1) {
+ 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_sys_fail_path(fptr->pathv);
+ }
+
+ return LONG2FIX(n);
+}
+
/*
* 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
@@ -2604,35 +2799,25 @@ io_read_nonblock(int argc, VALUE *argv, VALUE io)
* 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(VALUE io, VALUE str)
+rb_io_write_nonblock(int argc, VALUE *argv, VALUE io)
{
- rb_io_t *fptr;
- long n;
-
- rb_secure(4);
- if (!RB_TYPE_P(str, T_STRING))
- str = rb_obj_as_string(str);
-
- io = GetWriteIO(io);
- GetOpenFile(io, fptr);
- rb_io_check_writable(fptr);
-
- if (io_fflush(fptr) < 0)
- rb_sys_fail(0);
+ VALUE str;
+ VALUE opts = Qnil;
+ int no_exceptions = 0;
- rb_io_set_nonblock(fptr);
- n = write(fptr->fd, RSTRING_PTR(str), RSTRING_LEN(str));
+ rb_scan_args(argc, argv, "10:", &str, &opts);
- if (n == -1) {
- if (errno == EWOULDBLOCK || errno == EAGAIN)
- rb_mod_sys_fail(rb_mWaitWritable, "write would block");
- rb_sys_fail_path(fptr->pathv);
- }
+ if (!NIL_P(opts) && Qfalse == get_kwargs_exception(opts))
+ no_exceptions = 1;
- return LONG2FIX(n);
+ return io_write_nonblock(io, str, no_exceptions);
}
/*
@@ -2727,7 +2912,10 @@ io_read(int argc, VALUE *argv, VALUE io)
GetOpenFile(io, fptr);
rb_io_check_byte_readable(fptr);
- if (len == 0) return str;
+ if (len == 0) {
+ io_set_read_length(str, 0);
+ return str;
+ }
READ_CHECK(fptr);
#if defined(RUBY_TEST_CRLF_ENVIRONMENT) || defined(_WIN32)
@@ -2765,10 +2953,9 @@ appendline(rb_io_t *fptr, int delim, VALUE *strp, long *lp)
make_readconv(fptr, 0);
do {
const char *p, *e;
- int searchlen;
- if (fptr->cbuf.len) {
- p = fptr->cbuf.ptr+fptr->cbuf.off;
- searchlen = fptr->cbuf.len;
+ int searchlen = READ_CHAR_PENDING_COUNT(fptr);
+ if (searchlen) {
+ p = READ_CHAR_PENDING_PTR(fptr);
if (0 < limit && limit < searchlen)
searchlen = (int)limit;
e = memchr(p, delim, searchlen);
@@ -2894,7 +3081,7 @@ rb_io_getline_fast(rb_io_t *fptr, rb_encoding *enc, VALUE io)
long pos = 0;
int cr = 0;
- for (;;) {
+ do {
int pending = READ_DATA_PENDING_COUNT(fptr);
if (pending > 0) {
@@ -2920,11 +3107,8 @@ rb_io_getline_fast(rb_io_t *fptr, rb_encoding *enc, VALUE io)
if (e) break;
}
READ_CHECK(fptr);
- if (io_fillbuf(fptr) < 0) {
- if (NIL_P(str)) return Qnil;
- break;
- }
- }
+ } while (io_fillbuf(fptr) >= 0);
+ if (NIL_P(str)) return Qnil;
str = io_enc_str(str, fptr);
ENC_CODERANGE_SET(str, cr);
@@ -3046,7 +3230,7 @@ rb_io_getline_1(VALUE rs, long limit, VALUE io)
if (c == newline) {
if (RSTRING_LEN(str) < rslen) continue;
s = RSTRING_PTR(str);
- e = s + RSTRING_LEN(str);
+ e = RSTRING_END(str);
p = e - rslen;
pp = rb_enc_left_char_head(s, p, e, enc);
if (pp != p) continue;
@@ -3055,7 +3239,7 @@ rb_io_getline_1(VALUE rs, long limit, VALUE io)
}
if (limit == 0) {
s = RSTRING_PTR(str);
- p = s + RSTRING_LEN(str);
+ p = RSTRING_END(str);
pp = rb_enc_left_char_head(s, p-1, p, enc);
if (extra_limit &&
MBCLEN_NEEDMORE_P(rb_enc_precise_mbclen(pp, p, enc))) {
@@ -3071,25 +3255,20 @@ rb_io_getline_1(VALUE rs, long limit, VALUE io)
}
}
- if (rspara) {
- if (c != EOF) {
- swallow(fptr, '\n');
- }
- }
+ if (rspara && c != EOF)
+ swallow(fptr, '\n');
if (!NIL_P(str))
str = io_enc_str(str, fptr);
}
- if (!NIL_P(str)) {
- if (!nolimit) {
- fptr->lineno++;
- if (io == ARGF.current_file) {
- ARGF.lineno++;
- ARGF.last_lineno = ARGF.lineno;
- }
- else {
- ARGF.last_lineno = fptr->lineno;
- }
+ if (!NIL_P(str) && !nolimit) {
+ fptr->lineno++;
+ if (io == ARGF.current_file) {
+ ARGF.lineno++;
+ ARGF.last_lineno = ARGF.lineno;
+ }
+ else {
+ ARGF.last_lineno = fptr->lineno;
}
}
@@ -3342,7 +3521,7 @@ rb_io_each_byte(VALUE io)
RETURN_ENUMERATOR(io, 0, 0);
GetOpenFile(io, fptr);
- for (;;) {
+ do {
while (fptr->rbuf.len > 0) {
char *p = fptr->rbuf.ptr + fptr->rbuf.off++;
fptr->rbuf.len--;
@@ -3351,10 +3530,7 @@ rb_io_each_byte(VALUE io)
}
rb_io_check_byte_readable(fptr);
READ_CHECK(fptr);
- if (io_fillbuf(fptr) < 0) {
- break;
- }
- }
+ } while (io_fillbuf(fptr) >= 0);
return io;
}
@@ -3598,10 +3774,7 @@ rb_io_each_codepoint(VALUE io)
}
NEED_NEWLINE_DECORATOR_ON_READ_CHECK(fptr);
enc = io_input_encoding(fptr);
- for (;;) {
- if (io_fillbuf(fptr) < 0) {
- return io;
- }
+ while (io_fillbuf(fptr) >= 0) {
r = rb_enc_precise_mbclen(fptr->rbuf.ptr+fptr->rbuf.off,
fptr->rbuf.ptr+fptr->rbuf.off+fptr->rbuf.len, enc);
if (MBCLEN_CHARFOUND_P(r) &&
@@ -3993,7 +4166,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);
@@ -4267,9 +4440,6 @@ rb_io_close(VALUE io)
static VALUE
rb_io_close_m(VALUE io)
{
- if (rb_safe_level() >= 4 && !OBJ_UNTRUSTED(io)) {
- rb_raise(rb_eSecurityError, "Insecure: can't close");
- }
rb_io_check_closed(RFILE(io)->fptr);
rb_io_close(io);
return Qnil;
@@ -4278,13 +4448,31 @@ rb_io_close_m(VALUE io)
static VALUE
io_call_close(VALUE io)
{
- return rb_funcall(io, rb_intern("close"), 0, 0);
+ 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;
}
static VALUE
io_close(VALUE io)
{
- return rb_rescue(io_call_close, io, 0, 0);
+ 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;
}
/*
@@ -4350,9 +4538,6 @@ rb_io_close_read(VALUE io)
rb_io_t *fptr;
VALUE write_io;
- if (rb_safe_level() >= 4 && !OBJ_UNTRUSTED(io)) {
- rb_raise(rb_eSecurityError, "Insecure: can't close");
- }
GetOpenFile(io, fptr);
if (is_socket(fptr->fd, fptr->pathv)) {
#ifndef SHUT_RD
@@ -4413,9 +4598,6 @@ rb_io_close_write(VALUE io)
rb_io_t *fptr;
VALUE write_io;
- if (rb_safe_level() >= 4 && !OBJ_UNTRUSTED(io)) {
- rb_raise(rb_eSecurityError, "Insecure: can't close");
- }
write_io = GetWriteIO(io);
GetOpenFile(write_io, fptr);
if (is_socket(fptr->fd, fptr->pathv)) {
@@ -4465,7 +4647,7 @@ rb_io_sysseek(int argc, VALUE *argv, VALUE io)
off_t pos;
if (rb_scan_args(argc, argv, "11", &offset, &ptrname) == 2) {
- whence = NUM2INT(ptrname);
+ whence = interpret_seek_whence(ptrname);
}
pos = NUM2OFFT(offset);
GetOpenFile(io, fptr);
@@ -4502,7 +4684,6 @@ rb_io_syswrite(VALUE io, VALUE str)
rb_io_t *fptr;
long n;
- rb_secure(4);
if (!RB_TYPE_P(str, T_STRING))
str = rb_obj_as_string(str);
@@ -4517,6 +4698,7 @@ 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);
@@ -4619,12 +4801,9 @@ rb_io_binmode(VALUE io)
return io;
}
-VALUE
-rb_io_ascii8bit_binmode(VALUE io)
+static void
+io_ascii8bit_binmode(rb_io_t *fptr)
{
- rb_io_t *fptr;
-
- GetOpenFile(io, fptr);
if (fptr->readconv) {
rb_econv_close(fptr->readconv);
fptr->readconv = NULL;
@@ -4642,6 +4821,15 @@ rb_io_ascii8bit_binmode(VALUE io)
fptr->encs.ecflags = 0;
fptr->encs.ecopts = Qnil;
clear_codeconv(fptr);
+}
+
+VALUE
+rb_io_ascii8bit_binmode(VALUE io)
+{
+ rb_io_t *fptr;
+
+ GetOpenFile(io, fptr);
+ io_ascii8bit_binmode(fptr);
return io;
}
@@ -4890,9 +5078,13 @@ rb_io_ext_int_to_encs(rb_encoding *ext, rb_encoding *intern, rb_encoding **enc,
ext = rb_default_external_encoding();
default_ext = 1;
}
- if (intern == NULL && ext != rb_ascii8bit_encoding())
- /* If external is ASCII-8BIT, no default transcoding */
+ if (ext == rb_ascii8bit_encoding()) {
+ /* If external is ASCII-8BIT, no transcoding */
+ intern = NULL;
+ }
+ else if (intern == NULL) {
intern = rb_default_internal_encoding();
+ }
if (intern == NULL || intern == (rb_encoding *)Qnil ||
(!(fmode & FMODE_SETENC_BY_BOM) && (intern == ext))) {
/* No internal encoding => use external + no transcoding */
@@ -5002,9 +5194,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);
- 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");
+ 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");
}
encoding = Qnil;
}
@@ -5085,6 +5277,8 @@ extract_binmode(VALUE opthash, int *fmode)
if (!NIL_P(v)) {
if (*fmode & FMODE_TEXTMODE)
rb_raise(rb_eArgError, "textmode specified twice");
+ if (*fmode & FMODE_BINMODE)
+ rb_raise(rb_eArgError, "both textmode and binmode specified");
if (RTEST(v))
*fmode |= FMODE_TEXTMODE;
}
@@ -5092,6 +5286,8 @@ extract_binmode(VALUE opthash, int *fmode)
if (!NIL_P(v)) {
if (*fmode & FMODE_BINMODE)
rb_raise(rb_eArgError, "binmode specified twice");
+ if (*fmode & FMODE_TEXTMODE)
+ rb_raise(rb_eArgError, "both textmode and binmode specified");
if (RTEST(v))
*fmode |= FMODE_BINMODE;
}
@@ -5345,7 +5541,7 @@ io_strip_bom(VALUE io)
case INT2FIX(0xFE):
if (NIL_P(b2 = rb_io_getbyte(io))) break;
if (b2 == INT2FIX(0xFF)) {
- return rb_enc_find_index("UTF-16BE");
+ return ENCINDEX_UTF_16BE;
}
rb_io_ungetbyte(io, b2);
break;
@@ -5356,14 +5552,14 @@ io_strip_bom(VALUE io)
b3 = rb_io_getbyte(io);
if (b3 == INT2FIX(0) && !NIL_P(b4 = rb_io_getbyte(io))) {
if (b4 == INT2FIX(0)) {
- return rb_enc_find_index("UTF-32LE");
+ return ENCINDEX_UTF_32LE;
}
rb_io_ungetbyte(io, b4);
rb_io_ungetbyte(io, b3);
}
else {
rb_io_ungetbyte(io, b3);
- return rb_enc_find_index("UTF-16LE");
+ return ENCINDEX_UTF_16LE;
}
}
rb_io_ungetbyte(io, b2);
@@ -5374,7 +5570,7 @@ io_strip_bom(VALUE io)
if (b2 == INT2FIX(0) && !NIL_P(b3 = rb_io_getbyte(io))) {
if (b3 == INT2FIX(0xFE) && !NIL_P(b4 = rb_io_getbyte(io))) {
if (b4 == INT2FIX(0xFF)) {
- return rb_enc_find_index("UTF-32BE");
+ return ENCINDEX_UTF_32BE;
}
rb_io_ungetbyte(io, b4);
}
@@ -5469,7 +5665,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_FORK)
+#if defined(__CYGWIN__) || !defined(HAVE_WORKING_FORK)
static struct pipe_list {
rb_io_t *fptr;
struct pipe_list *next;
@@ -5525,7 +5721,7 @@ pipe_atexit(void)
static void
pipe_finalize(rb_io_t *fptr, int noraise)
{
-#if !defined(HAVE_FORK) && !defined(_WIN32)
+#if !defined(HAVE_WORKING_FORK) && !defined(_WIN32)
int status = 0;
if (fptr->stdio_file) {
status = pclose(fptr->stdio_file);
@@ -5573,11 +5769,11 @@ rb_pipe(int *pipes)
#ifdef _WIN32
#define HAVE_SPAWNV 1
-#define spawnv(mode, cmd, args) rb_w32_aspawn((mode), (cmd), (args))
-#define spawn(mode, cmd) rb_w32_spawn((mode), (cmd), 0)
+#define spawnv(mode, cmd, args) rb_w32_uaspawn((mode), (cmd), (args))
+#define spawn(mode, cmd) rb_w32_uspawn((mode), (cmd), 0)
#endif
-#if defined(HAVE_FORK) || defined(HAVE_SPAWNV)
+#if defined(HAVE_WORKING_FORK) || defined(HAVE_SPAWNV)
struct popen_arg {
VALUE execarg_obj;
struct rb_execarg *eargp;
@@ -5587,7 +5783,7 @@ struct popen_arg {
};
#endif
-#ifdef HAVE_FORK
+#ifdef HAVE_WORKING_FORK
static void
popen_redirect(struct popen_arg *p)
{
@@ -5706,6 +5902,13 @@ popen_exec(void *pp, char *errmsg, size_t errmsg_len)
#endif
static VALUE
+rb_execarg_fixup_v(VALUE execarg_obj)
+{
+ rb_execarg_fixup(execarg_obj);
+ return Qnil;
+}
+
+static VALUE
pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convconfig)
{
struct rb_execarg *eargp = NIL_P(execarg_obj) ? NULL : rb_execarg_get(execarg_obj);
@@ -5715,11 +5918,12 @@ 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_FORK)
+#if defined(HAVE_WORKING_FORK)
int status;
char errmsg[80] = { '\0' };
#endif
-#if defined(HAVE_FORK) || defined(HAVE_SPAWNV)
+#if defined(HAVE_WORKING_FORK) || defined(HAVE_SPAWNV)
+ int state;
struct popen_arg arg;
int e = 0;
#endif
@@ -5733,20 +5937,20 @@ 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_FORK)
+# if !defined(HAVE_WORKING_FORK)
char **args = NULL;
# if defined(HAVE_SPAWNVE)
char **envp = NULL;
# endif
# endif
#endif
-#if !defined(HAVE_FORK)
+#if !defined(HAVE_WORKING_FORK)
struct rb_execarg sarg, *sargp = &sarg;
#endif
FILE *fp = 0;
int fd = -1;
int write_fd = -1;
-#if !defined(HAVE_FORK)
+#if !defined(HAVE_WORKING_FORK)
const char *cmd = 0;
#if !defined(HAVE_SPAWNV)
int argc;
@@ -5757,13 +5961,13 @@ pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convc
cmd = StringValueCStr(prog);
#endif
-#if defined(HAVE_FORK) || defined(HAVE_SPAWNV)
+#if defined(HAVE_WORKING_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_FORK)
+# if !defined(HAVE_WORKING_FORK)
if (eargp && !eargp->use_shell) {
args = ARGVSTR2ARGV(eargp->invoke.cmd.argv_str);
}
@@ -5800,8 +6004,16 @@ pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convc
rb_sys_fail_str(prog);
}
if (!NIL_P(execarg_obj)) {
- rb_execarg_fixup(execarg_obj);
-# if defined(HAVE_FORK)
+ 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_jump_tag(state);
+ }
+
+# if defined(HAVE_WORKING_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);
@@ -5825,7 +6037,7 @@ pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convc
# endif
}
else {
-# if defined(HAVE_FORK)
+# if defined(HAVE_WORKING_FORK)
pid = rb_fork_ruby(&status);
if (pid == 0) { /* child */
rb_thread_atfork();
@@ -5841,7 +6053,7 @@ pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convc
/* parent */
if (pid == -1) {
-# if defined(HAVE_FORK)
+# if defined(HAVE_WORKING_FORK)
e = errno;
# endif
close(arg.pair[0]);
@@ -5851,7 +6063,7 @@ pipe_open(VALUE execarg_obj, const char *modestr, int fmode, convconfig_t *convc
close(arg.write_pair[1]);
}
errno = e;
-# if defined(HAVE_FORK)
+# if defined(HAVE_WORKING_FORK)
if (errmsg[0])
rb_sys_fail(errmsg);
# endif
@@ -5922,7 +6134,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_FORK)
+#if defined (__CYGWIN__) || !defined(HAVE_WORKING_FORK)
fptr->finalize = pipe_finalize;
pipe_add_fptr(fptr);
#endif
@@ -5933,7 +6145,7 @@ static int
is_popen_fork(VALUE prog)
{
if (RSTRING_LEN(prog) == 1 && RSTRING_PTR(prog)[0] == '-') {
-#if !defined(HAVE_FORK)
+#if !defined(HAVE_WORKING_FORK)
rb_raise(rb_eNotImpError,
"fork() function is unimplemented on this machine");
#else
@@ -6074,10 +6286,8 @@ rb_io_s_popen(int argc, VALUE *argv, VALUE klass)
rb_raise(rb_eArgError, "too many arguments");
}
#endif
- tmp = rb_ary_dup(tmp);
- RBASIC(tmp)->klass = 0;
- execarg_obj = rb_execarg_new((int)len, RARRAY_PTR(tmp), FALSE);
- rb_ary_clear(tmp);
+ execarg_obj = rb_execarg_new((int)len, RARRAY_CONST_PTR(tmp), FALSE);
+ RB_GC_GUARD(tmp);
}
else {
SafeStringValue(pname);
@@ -6105,7 +6315,7 @@ rb_io_s_popen(int argc, VALUE *argv, VALUE klass)
}
return Qnil;
}
- RBASIC(port)->klass = klass;
+ RBASIC_SET_CLASS(port, klass);
if (rb_block_given_p()) {
return rb_ensure(rb_yield, port, io_close, port);
}
@@ -6113,7 +6323,7 @@ rb_io_s_popen(int argc, VALUE *argv, VALUE klass)
}
static void
-rb_scan_open_args(int argc, VALUE *argv,
+rb_scan_open_args(int argc, const VALUE *argv,
VALUE *fname_p, int *oflags_p, int *fmode_p,
convconfig_t *convconfig_p, mode_t *perm_p)
{
@@ -6135,7 +6345,7 @@ rb_scan_open_args(int argc, VALUE *argv,
}
static VALUE
-rb_open_file(int argc, VALUE *argv, VALUE io)
+rb_open_file(int argc, const VALUE *argv, VALUE io)
{
VALUE fname;
int oflags, fmode;
@@ -6406,7 +6616,7 @@ rb_io_open(VALUE filename, VALUE vmode, VALUE vperm, VALUE opt)
}
static VALUE
-rb_io_open_with_args(int argc, VALUE *argv)
+rb_io_open_with_args(int argc, const VALUE *argv)
{
VALUE io;
@@ -6423,10 +6633,6 @@ io_reopen(VALUE io, VALUE nfile)
off_t pos = 0;
nfile = rb_io_get_io(nfile);
- if (rb_safe_level() >= 4 &&
- (!OBJ_UNTRUSTED(io) || !OBJ_UNTRUSTED(nfile))) {
- rb_raise(rb_eSecurityError, "Insecure: can't reopen");
- }
GetOpenFile(io, fptr);
GetOpenFile(nfile, orig);
@@ -6463,7 +6669,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_FORK)
+#if defined (__CYGWIN__) || !defined(HAVE_WORKING_FORK)
if (fptr->finalize == pipe_finalize)
pipe_add_fptr(fptr);
#endif
@@ -6501,7 +6707,7 @@ io_reopen(VALUE io, VALUE nfile)
rb_io_binmode(io);
}
- RBASIC(io)->klass = rb_obj_class(nfile);
+ RBASIC_SET_CLASS(io, rb_obj_class(nfile));
return io;
}
@@ -6528,7 +6734,6 @@ rb_io_reopen(int argc, VALUE *argv, VALUE file)
int oflags;
rb_io_t *fptr;
- rb_secure(4);
if (rb_scan_args(argc, argv, "11:", &fname, &nmode, &opt) == 1) {
VALUE tmp = rb_io_check_io(fname);
if (!NIL_P(tmp)) {
@@ -6540,8 +6745,7 @@ rb_io_reopen(int argc, VALUE *argv, VALUE file)
rb_io_taint_check(file);
fptr = RFILE(file)->fptr;
if (!fptr) {
- fptr = RFILE(file)->fptr = ALLOC(rb_io_t);
- MEMZERO(fptr, rb_io_t, 1);
+ fptr = RFILE(file)->fptr = ZALLOC(rb_io_t);
}
if (!NIL_P(nmode) || !NIL_P(opt)) {
@@ -6585,22 +6789,26 @@ rb_io_reopen(int argc, VALUE *argv, VALUE file)
rb_fd_fix_cloexec(fptr->fd);
#ifdef USE_SETVBUF
if (setvbuf(fptr->stdio_file, NULL, _IOFBF, 0) != 0)
- rb_warn("setvbuf() can't be honoured for %s", RSTRING_PTR(fptr->pathv));
+ rb_warn("setvbuf() can't be honoured for %"PRIsVALUE, fptr->pathv);
#endif
if (fptr->stdio_file == stderr) {
if (setvbuf(fptr->stdio_file, NULL, _IONBF, BUFSIZ) != 0)
- rb_warn("setvbuf() can't be honoured for %s", RSTRING_PTR(fptr->pathv));
+ rb_warn("setvbuf() can't be honoured for %"PRIsVALUE, fptr->pathv);
}
else if (fptr->stdio_file == stdout && isatty(fptr->fd)) {
if (setvbuf(fptr->stdio_file, NULL, _IOLBF, BUFSIZ) != 0)
- rb_warn("setvbuf() can't be honoured for %s", RSTRING_PTR(fptr->pathv));
+ rb_warn("setvbuf() can't be honoured for %"PRIsVALUE, fptr->pathv);
}
}
else {
- if (close(fptr->fd) < 0)
- rb_sys_fail_path(fptr->pathv);
- fptr->fd = -1;
- fptr->fd = rb_sysopen(fptr->pathv, oflags, 0666);
+ int tmpfd = rb_sysopen(fptr->pathv, oflags, 0666);
+ int err = 0;
+ if (rb_cloexec_dup2(tmpfd, fptr->fd) < 0)
+ err = errno;
+ (void)close(tmpfd);
+ if (err) {
+ rb_syserr_fail_path(err, fptr->pathv);
+ }
}
return file;
@@ -6629,7 +6837,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_FORK)
+#if defined (__CYGWIN__) || !defined(HAVE_WORKING_FORK)
if (fptr->finalize == pipe_finalize)
pipe_add_fptr(fptr);
#endif
@@ -6663,7 +6871,7 @@ rb_io_init_copy(VALUE dest, VALUE io)
*/
VALUE
-rb_io_printf(int argc, VALUE *argv, VALUE out)
+rb_io_printf(int argc, const VALUE *argv, VALUE out)
{
rb_io_write(out, rb_f_sprintf(argc, argv));
return Qnil;
@@ -6675,9 +6883,9 @@ rb_io_printf(int argc, VALUE *argv, VALUE out)
* printf(string [, obj ... ]) -> nil
*
* Equivalent to:
- * io.write(sprintf(string, obj, ...)
+ * io.write(sprintf(string, obj, ...))
* or
- * $stdout.write(sprintf(string, obj, ...)
+ * $stdout.write(sprintf(string, obj, ...))
*/
static VALUE
@@ -6722,7 +6930,7 @@ rb_f_printf(int argc, VALUE *argv)
*/
VALUE
-rb_io_print(int argc, VALUE *argv, VALUE out)
+rb_io_print(int argc, const VALUE *argv, VALUE out)
{
int i;
VALUE line;
@@ -6770,7 +6978,7 @@ rb_io_print(int argc, VALUE *argv, VALUE out)
*/
static VALUE
-rb_f_print(int argc, VALUE *argv)
+rb_f_print(int argc, const VALUE *argv)
{
rb_io_print(argc, argv, rb_stdout);
return Qnil;
@@ -6860,7 +7068,7 @@ io_puts_ary(VALUE ary, VALUE out, int recur)
ary = rb_check_array_type(ary);
if (NIL_P(ary)) return Qfalse;
for (i=0; i<RARRAY_LEN(ary); i++) {
- tmp = RARRAY_PTR(ary)[i];
+ tmp = RARRAY_AREF(ary, i);
rb_io_puts(1, &tmp, out);
}
return Qtrue;
@@ -6887,7 +7095,7 @@ io_puts_ary(VALUE ary, VALUE out, int recur)
*/
VALUE
-rb_io_puts(int argc, VALUE *argv, VALUE out)
+rb_io_puts(int argc, const VALUE *argv, VALUE out)
{
int i;
VALUE line;
@@ -7201,12 +7409,12 @@ rb_io_stdio_file(rb_io_t *fptr)
* "w+" Read-write, truncates existing file to zero length
* or creates a new file for reading and writing.
*
- * "a" Write-only, starts at end of file if file exists,
- * otherwise creates a new file for 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+" Read-write, starts at end of file if file exists,
- * otherwise creates a new file for reading and
- * 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.
*
* The following modes must be used separately, and along with one or more of
* the modes seen above.
@@ -7320,7 +7528,6 @@ rb_io_initialize(int argc, VALUE *argv, VALUE io)
struct stat st;
#endif
- rb_secure(4);
argc = rb_scan_args(argc, argv, "11:", &fnum, &vmode, &opt);
rb_io_extract_modeenc(&vmode, 0, opt, &oflags, &fmode, &convconfig);
@@ -7411,9 +7618,9 @@ static VALUE
rb_io_s_new(int argc, VALUE *argv, VALUE klass)
{
if (rb_block_given_p()) {
- const char *cname = rb_class2name(klass);
+ VALUE cname = rb_obj_as_string(klass);
- rb_warn("%s::new() does not take block; use %s::open() instead",
+ rb_warn("%"PRIsVALUE"::new() does not take block; use %"PRIsVALUE"::open() instead",
cname, cname);
}
return rb_class_new_instance(argc, argv, klass);
@@ -7447,9 +7654,8 @@ rb_io_s_for_fd(int argc, VALUE *argv, VALUE klass)
static VALUE
rb_io_autoclose_p(VALUE io)
{
- rb_io_t *fptr;
- rb_secure(4);
- GetOpenFile(io, fptr);
+ rb_io_t *fptr = RFILE(io)->fptr;
+ rb_io_check_closed(fptr);
return (fptr->mode & FMODE_PREP) ? Qfalse : Qtrue;
}
@@ -7474,7 +7680,6 @@ static VALUE
rb_io_set_autoclose(VALUE io, VALUE autoclose)
{
rb_io_t *fptr;
- rb_secure(4);
GetOpenFile(io, fptr);
if (!RTEST(autoclose))
fptr->mode |= FMODE_PREP;
@@ -7514,6 +7719,7 @@ argf_memsize(const void *ptr)
static const rb_data_type_t argf_type = {
"ARGF",
{argf_mark, argf_free, argf_memsize},
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
static inline void
@@ -7626,13 +7832,15 @@ argf_forward(int argc, VALUE *argv, VALUE argf)
} while (0)
static void
-argf_close(VALUE file)
+argf_close(VALUE argf)
{
+ VALUE file = ARGF.current_file;
if (file == rb_stdin) return;
if (RB_TYPE_P(file, T_FILE)) {
rb_io_set_write_io(file, Qnil);
}
rb_funcall3(file, rb_intern("close"), 0, 0);
+ ARGF.init_p = -1;
}
static int
@@ -7670,7 +7878,7 @@ argf_next_argv(VALUE argf)
if (ARGF.next_p == 1) {
retry:
if (RARRAY_LEN(ARGF.argv) > 0) {
- ARGF.filename = rb_ary_shift(ARGF.argv);
+ ARGF.filename = rb_str_encode_ospath(rb_ary_shift(ARGF.argv));
fn = StringValueCStr(ARGF.filename);
if (strlen(fn) == 1 && fn[0] == '-') {
ARGF.current_file = rb_stdin;
@@ -7695,22 +7903,24 @@ argf_next_argv(VALUE argf)
rb_io_close(rb_stdout);
}
fstat(fr, &st);
+ str = ARGF.filename;
if (*ARGF.inplace) {
- str = rb_str_new2(fn);
+ str = rb_str_dup(str);
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 %s to %s: %s, skipping file",
- fn, RSTRING_PTR(str), strerror(errno));
+ rb_warn("Can't rename %"PRIsVALUE" to %"PRIsVALUE": %s, skipping file",
+ ARGF.filename, 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 %s to %s: %s, skipping file",
- fn, RSTRING_PTR(str), strerror(errno));
+ rb_warn("Can't rename %"PRIsVALUE" to %"PRIsVALUE": %s, skipping file",
+ ARGF.filename, str, strerror(errno));
close(fr);
goto retry;
}
@@ -7721,8 +7931,8 @@ argf_next_argv(VALUE argf)
rb_fatal("Can't do inplace edit without backup");
#else
if (unlink(fn) < 0) {
- rb_warn("Can't remove %s: %s, skipping file",
- fn, strerror(errno));
+ rb_warn("Can't remove %"PRIsVALUE": %s, skipping file",
+ ARGF.filename, strerror(errno));
close(fr);
goto retry;
}
@@ -7745,8 +7955,8 @@ argf_next_argv(VALUE argf)
#endif
if (err && getuid() == 0 && st2.st_uid == 0) {
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));
+ rb_warn("Can't set owner/group of %"PRIsVALUE" to same as %"PRIsVALUE": %s, skipping file",
+ ARGF.filename, str, strerror(errno));
(void)close(fr);
(void)close(fw);
(void)unlink(wkfn);
@@ -7797,6 +8007,7 @@ argf_next_argv(VALUE argf)
rb_stdout = orig_stdout;
}
}
+ if (ARGF.init_p == -1) ARGF.init_p = 1;
return TRUE;
}
@@ -7819,7 +8030,7 @@ argf_getline(int argc, VALUE *argv, VALUE argf)
line = rb_io_getline(argc, argv, ARGF.current_file);
}
if (NIL_P(line) && ARGF.next_p != -1) {
- argf_close(ARGF.current_file);
+ argf_close(argf);
ARGF.next_p = 1;
goto retry;
}
@@ -7892,16 +8103,16 @@ rb_f_gets(int argc, VALUE *argv, VALUE recv)
/*
* call-seq:
- * ARGF.gets(sep=$/) -> string
- * ARGF.gets(limit) -> string
- * ARGF.gets(sep, limit) -> string
+ * ARGF.gets(sep=$/) -> string or nil
+ * ARGF.gets(limit) -> string or nil
+ * ARGF.gets(sep, limit) -> string or nil
*
* Returns the next line from the current file in +ARGF+.
*
* 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.
*
*/
@@ -8045,7 +8256,7 @@ argf_readlines(int argc, VALUE *argv, VALUE argf)
}
else {
lines = rb_io_readlines(argc, argv, ARGF.current_file);
- argf_close(ARGF.current_file);
+ argf_close(argf);
}
ARGF.next_p = 1;
rb_ary_concat(ary, lines);
@@ -8073,7 +8284,7 @@ argf_readlines(int argc, VALUE *argv, VALUE argf)
static VALUE
rb_f_backquote(VALUE obj, VALUE str)
{
- volatile VALUE port;
+ VALUE port;
VALUE result;
rb_io_t *fptr;
@@ -8085,6 +8296,8 @@ 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;
}
@@ -8107,7 +8320,7 @@ select_internal(VALUE read, VALUE write, VALUE except, struct timeval *tp, rb_fd
if (!NIL_P(read)) {
Check_Type(read, T_ARRAY);
for (i=0; i<RARRAY_LEN(read); i++) {
- GetOpenFile(rb_io_get_io(RARRAY_PTR(read)[i]), fptr);
+ GetOpenFile(rb_io_get_io(RARRAY_AREF(read, i)), fptr);
rb_fd_set(fptr->fd, &fds[0]);
if (READ_DATA_PENDING(fptr) || READ_CHAR_PENDING(fptr)) { /* check for buffered data */
pending++;
@@ -8127,7 +8340,7 @@ select_internal(VALUE read, VALUE write, VALUE except, struct timeval *tp, rb_fd
if (!NIL_P(write)) {
Check_Type(write, T_ARRAY);
for (i=0; i<RARRAY_LEN(write); i++) {
- VALUE write_io = GetWriteIO(rb_io_get_io(RARRAY_PTR(write)[i]));
+ VALUE write_io = GetWriteIO(rb_io_get_io(RARRAY_AREF(write, i)));
GetOpenFile(write_io, fptr);
rb_fd_set(fptr->fd, &fds[1]);
if (max < fptr->fd) max = fptr->fd;
@@ -8140,7 +8353,7 @@ select_internal(VALUE read, VALUE write, VALUE except, struct timeval *tp, rb_fd
if (!NIL_P(except)) {
Check_Type(except, T_ARRAY);
for (i=0; i<RARRAY_LEN(except); i++) {
- VALUE io = rb_io_get_io(RARRAY_PTR(except)[i]);
+ VALUE io = rb_io_get_io(RARRAY_AREF(except, i));
VALUE write_io = GetWriteIO(io);
GetOpenFile(io, fptr);
rb_fd_set(fptr->fd, &fds[2]);
@@ -8171,7 +8384,7 @@ select_internal(VALUE read, VALUE write, VALUE except, struct timeval *tp, rb_fd
rb_ary_push(res, ep?rb_ary_new():rb_ary_new2(0));
if (rp) {
- list = RARRAY_PTR(res)[0];
+ list = RARRAY_AREF(res, 0);
for (i=0; i< RARRAY_LEN(read); i++) {
VALUE obj = rb_ary_entry(read, i);
VALUE io = rb_io_get_io(obj);
@@ -8184,7 +8397,7 @@ select_internal(VALUE read, VALUE write, VALUE except, struct timeval *tp, rb_fd
}
if (wp) {
- list = RARRAY_PTR(res)[1];
+ list = RARRAY_AREF(res, 1);
for (i=0; i< RARRAY_LEN(write); i++) {
VALUE obj = rb_ary_entry(write, i);
VALUE io = rb_io_get_io(obj);
@@ -8197,7 +8410,7 @@ select_internal(VALUE read, VALUE write, VALUE except, struct timeval *tp, rb_fd
}
if (ep) {
- list = RARRAY_PTR(res)[2];
+ list = RARRAY_AREF(res, 2);
for (i=0; i< RARRAY_LEN(except); i++) {
VALUE obj = rb_ary_entry(except, i);
VALUE io = rb_io_get_io(obj);
@@ -8249,9 +8462,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
@@ -8322,7 +8535,12 @@ do_io_advise(rb_io_t *fptr, VALUE advice, off_t offset, off_t len)
if (rv) {
/* posix_fadvise(2) doesn't set errno. On success it returns 0; otherwise
it returns the error code. */
- rb_syserr_fail_str(rv, fptr->pathv);
+ 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);
}
return Qnil;
@@ -8342,9 +8560,7 @@ advice_arg_check(VALUE advice)
advice != sym_willneed &&
advice != sym_dontneed &&
advice != sym_noreuse) {
- VALUE symname = rb_inspect(advice);
- rb_raise(rb_eNotImpError, "Unsupported advice: %s",
- StringValuePtr(symname));
+ rb_raise(rb_eNotImpError, "Unsupported advice: %+"PRIsVALUE, advice);
}
}
@@ -8356,18 +8572,18 @@ advice_arg_check(VALUE advice)
* specific pattern. On platforms that do not support the
* <em>posix_fadvise(2)</em> system call, this method is a no-op.
*
- * _advice_ is one of the following symbols:
+ * _advice_ is one of the following symbols:
*
- * * :normal - No advice to give; the default assumption for an open file.
- * * :sequential - The data will be accessed sequentially:
- * with lower offsets read before higher ones.
- * * :random - The data will be accessed in random order.
- * * :willneed - The data will be accessed in the near future.
- * * :dontneed - The data will not be accessed in the near future.
- * * :noreuse - The data will only be accessed once.
+ * :normal:: No advice to give; the default assumption for an open file.
+ * :sequential:: The data will be accessed sequentially
+ * with lower offsets read before higher ones.
+ * :random:: The data will be accessed in random order.
+ * :willneed:: The data will be accessed in the near future.
+ * :dontneed:: The data will not be accessed in the near future.
+ * :noreuse:: The data will only be accessed once.
*
- * The semantics of a piece of advice are platform-dependent. See
- * <em>man 2 posix_fadvise</em> for details.
+ * The semantics of a piece of advice are platform-dependent. See
+ * <em>man 2 posix_fadvise</em> for details.
*
* "data" means the region of the current file that begins at
* _offset_ and extends for _len_ bytes. If _len_ is 0, the region
@@ -8376,18 +8592,19 @@ advice_arg_check(VALUE advice)
*
* If an error occurs, one of the following exceptions will be raised:
*
- * * <code>IOError</code> - The <code>IO</code> stream is closed.
- * * <code>Errno::EBADF</code> - The file descriptor of the current file is
- invalid.
- * * <code>Errno::EINVAL</code> - An invalid value for _advice_ was given.
- * * <code>Errno::ESPIPE</code> - The file descriptor of the current
- * * file refers to a FIFO or pipe. (Linux raises <code>Errno::EINVAL</code>
- * * in this case).
- * * <code>TypeError</code> - Either _advice_ was not a Symbol, or one of the
- other arguments was not an <code>Integer</code>.
- * * <code>RangeError</code> - One of the arguments given was too big/small.
+ * <code>IOError</code>:: The <code>IO</code> stream is closed.
+ * <code>Errno::EBADF</code>::
+ * The file descriptor of the current file is invalid.
+ * <code>Errno::EINVAL</code>:: An invalid value for _advice_ was given.
+ * <code>Errno::ESPIPE</code>::
+ * The file descriptor of the current file refers to a FIFO or
+ * pipe. (Linux raises <code>Errno::EINVAL</code> in this case).
+ * <code>TypeError</code>::
+ * Either _advice_ was not a Symbol, or one of the
+ * other arguments was not an <code>Integer</code>.
+ * <code>RangeError</code>:: One of the arguments given was too big/small.
*
- * This list is not exhaustive; other Errno:: exceptions are also possible.
+ * This list is not exhaustive; other Errno:: exceptions are also possible.
*/
static VALUE
rb_io_advise(int argc, VALUE *argv, VALUE io)
@@ -8423,11 +8640,103 @@ rb_io_advise(int argc, VALUE *argv, VALUE io)
* Calls select(2) system call.
* 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 respectably, and returns an array that
+ * and have pending exceptions respectively, and returns an array that
* 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 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 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.
+ * If <code>IO::WaitWritable</code> is raised, the caller should wait for writing.
+ *
+ * So, blocking read (<code>readpartial</code>) can be emulated using
+ * <code>read_nonblock</code> and <code>IO.select</code> as follows:
+ *
+ * begin
+ * result = io_like.read_nonblock(maxlen)
+ * rescue IO::WaitReadable
+ * IO.select([io_like])
+ * retry
+ * rescue IO::WaitWritable
+ * IO.select(nil, [io_like])
+ * retry
+ * end
+ *
+ * Especially, the combination of nonblocking methods and
+ * <code>IO.select</code> is preferred for <code>IO</code> like
+ * objects such as <code>OpenSSL::SSL::SSLSocket</code>.
+ * It has <code>to_io</code> method to return underlying <code>IO</code> object.
+ * <code>IO.select</code> calls <code>to_io</code> to obtain the file descriptor to wait.
+ *
+ * This means that readability notified by <code>IO.select</code> doesn't mean
+ * readability from <code>OpenSSL::SSL::SSLSocket</code> object.
+ *
+ * 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 situation exists.
+ *
+ * SSL is a protocol which is sequence of records.
+ * 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 writes some data.
+ * This means <code>OpenSSL::SSL::SSLSocket#readpartial</code> may
+ * invoke <code>write</code> system call and it can block.
+ * 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 process read form a stream.
+ *
+ * Finally, Linux kernel developers doesn't guarantee that
+ * readability of select(2) means readability of following read(2) even
+ * for single process.
+ * See select(2) manual on GNU/Linux system.
+ *
+ * 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
+ * how many bytes writable.
+ * <code>IO#write</code> method blocks until given whole string is written.
+ * So, <code>IO#write(two or more bytes)</code> can block after writability is notified by <code>IO.select</code>.
+ * <code>IO#write_nonblock</code> is required to avoid the blocking.
+ *
+ * Blocking write (<code>write</code>) can be emulated using
+ * <code>write_nonblock</code> and <code>IO.select</code> as follows:
+ * IO::WaitReadable should also be rescued for SSL renegotiation in <code>OpenSSL::SSL::SSLSocket</code>.
+ *
+ * while 0 < string.bytesize
+ * begin
+ * written = io_like.write_nonblock(string)
+ * rescue IO::WaitReadable
+ * IO.select([io_like])
+ * retry
+ * rescue IO::WaitWritable
+ * IO.select(nil, [io_like])
+ * retry
+ * end
+ * string = string.byteslice(written..-1)
+ * end
+ *
* === Parameters
* read_array:: an array of <code>IO</code> objects that wait until ready for read
* write_array:: an array of <code>IO</code> objects that wait until ready for write
@@ -8439,6 +8748,7 @@ rb_io_advise(int argc, VALUE *argv, VALUE io)
* rp, wp = IO.pipe
* mesg = "ping "
* 100.times {
+ * # IO.select follows IO#read. Not the best way to use IO.select.
* rs, ws, = IO.select([rp], [wp])
* if r = rs[0]
* ret = r.read(5)
@@ -8526,7 +8836,7 @@ do_ioctl(int fd, ioctl_req_t cmd, long narg)
#define DEFULT_IOCTL_NARG_LEN (256)
-#ifdef __linux__
+#if defined(__linux__) && defined(_IOC_SIZE)
static long
linux_iocparm_len(ioctl_req_t cmd)
{
@@ -8559,7 +8869,7 @@ ioctl_narg_len(ioctl_req_t cmd)
#endif
#ifdef IOCPARM_LEN
len = IOCPARM_LEN(cmd); /* on BSDish systems we're safe */
-#elif defined(__linux__)
+#elif defined(__linux__) && defined(_IOC_SIZE)
len = linux_iocparm_len(cmd);
#else
/* otherwise guess at what's safe */
@@ -9126,6 +9436,21 @@ 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)
{
@@ -9200,6 +9525,7 @@ 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;
@@ -9217,7 +9543,18 @@ rb_io_s_pipe(int argc, VALUE *argv, VALUE klass)
rb_jump_tag(state);
}
GetOpenFile(r, fptr);
- io_encoding_set(fptr, v1, v2, opt);
+
+ 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);
+ }
+
args[1] = INT2NUM(pipes[1]);
args[2] = INT2FIX(O_WRONLY);
w = rb_protect(io_new_instance, (VALUE)args, &state);
@@ -9296,7 +9633,7 @@ open_key_args(int argc, VALUE *argv, VALUE opt, struct foreach_arg *arg)
args = rb_ary_tmp_new(n);
rb_ary_push(args, path);
rb_ary_concat(args, v);
- arg->io = rb_io_open_with_args((int)n, RARRAY_PTR(args));
+ arg->io = rb_io_open_with_args((int)n, RARRAY_CONST_PTR(args));
rb_ary_clear(args); /* prevent from GC */
return;
}
@@ -9412,38 +9749,41 @@ seek_before_access(VALUE argp)
/*
* call-seq:
- * IO.read(name, [length [, offset]] ) -> string
- * IO.read(name, [length [, offset]], open_args) -> string
+ * IO.read(name, [length [, offset]] [, opt] ) -> 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.
*
- * 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.
+ * === Options
+ *
+ * The options hash accepts the following keys:
*
* encoding::
* string or encoding
*
- * specifies encoding of the read string. +encoding+ will be ignored
- * if length is specified.
+ * Specifies the encoding of the read string. +encoding:+ will be ignored
+ * if +length+ is specified. See Encoding.aliases for possible encodings.
*
* mode::
* string
*
- * specifies mode argument for open(). It should start with "r"
- * otherwise it will cause an error.
+ * 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.
*
- * open_args:: array of strings
+ * open_args::
+ * array of strings
*
- * specifies arguments for open() as an array.
+ * Specifies arguments for open() as an array. This key can not be used
+ * in combination with either +encoding:+ or +mode:+.
*
* 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("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"
*/
static VALUE
@@ -9736,10 +10076,6 @@ 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)
{
@@ -9793,8 +10129,10 @@ 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;
+ return 0;
+#endif
src_offset = stp->src_offset;
use_pread = src_offset != (off_t)-1;
@@ -10103,31 +10441,31 @@ static VALUE
copy_stream_body(VALUE arg)
{
struct copy_stream_struct *stp = (struct copy_stream_struct *)arg;
- VALUE src_io, dst_io;
+ VALUE src_io = stp->src, dst_io = stp->dst;
rb_io_t *src_fptr = 0, *dst_fptr = 0;
int src_fd, dst_fd;
+ const int common_oflags = 0
+#ifdef O_NOCTTY
+ | O_NOCTTY
+#endif
+ ;
stp->th = rb_thread_current();
stp->total = 0;
- if (stp->src == argf ||
- !(RB_TYPE_P(stp->src, T_FILE) ||
- RB_TYPE_P(stp->src, T_STRING) ||
- rb_respond_to(stp->src, rb_intern("to_path")))) {
+ 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;
}
else {
- src_io = RB_TYPE_P(stp->src, T_FILE) ? stp->src : Qnil;
- if (NIL_P(src_io)) {
+ if (!RB_TYPE_P(src_io, T_FILE)) {
VALUE args[2];
- int oflags = O_RDONLY;
-#ifdef O_NOCTTY
- oflags |= O_NOCTTY;
-#endif
- FilePathValue(stp->src);
- args[0] = stp->src;
- args[1] = INT2NUM(oflags);
+ 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;
@@ -10138,23 +10476,18 @@ copy_stream_body(VALUE arg)
}
stp->src_fd = src_fd;
- if (stp->dst == argf ||
- !(RB_TYPE_P(stp->dst, T_FILE) ||
- RB_TYPE_P(stp->dst, T_STRING) ||
- rb_respond_to(stp->dst, rb_intern("to_path")))) {
+ 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;
}
else {
- dst_io = RB_TYPE_P(stp->dst, T_FILE) ? stp->dst : Qnil;
- if (NIL_P(dst_io)) {
+ if (!RB_TYPE_P(dst_io, T_FILE)) {
VALUE args[3];
- int oflags = O_WRONLY|O_CREAT|O_TRUNC;
-#ifdef O_NOCTTY
- oflags |= O_NOCTTY;
-#endif
- FilePathValue(stp->dst);
- args[0] = stp->dst;
- args[1] = INT2NUM(oflags);
+ 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;
@@ -10173,9 +10506,9 @@ copy_stream_body(VALUE arg)
#ifdef O_BINARY
if (src_fptr)
SET_BINARY_MODE_WITH_SEEK_CUR(src_fptr);
- if (dst_fptr)
- setmode(dst_fd, O_BINARY);
#endif
+ if (dst_fptr)
+ io_ascii8bit_binmode(dst_fptr);
if (stp->src_offset == (off_t)-1 && src_fptr && src_fptr->rbuf.len) {
size_t len = src_fptr->rbuf.len;
@@ -10191,7 +10524,7 @@ copy_stream_body(VALUE arg)
rb_sys_fail(0);
}
else /* others such as StringIO */
- rb_io_write(stp->dst, str);
+ rb_io_write(dst_io, str);
stp->total += len;
if (stp->copy_length != (off_t)-1)
stp->copy_length -= len;
@@ -10698,7 +11031,7 @@ argf_read(int argc, VALUE *argv, VALUE argf)
else if (!NIL_P(tmp)) rb_str_append(str, tmp);
if (NIL_P(tmp) || NIL_P(length)) {
if (ARGF.next_p != -1) {
- argf_close(ARGF.current_file);
+ argf_close(argf);
ARGF.next_p = 1;
goto retry;
}
@@ -10734,30 +11067,19 @@ static VALUE argf_getpartial(int argc, VALUE *argv, VALUE argf, int nonblock);
* ARGF.readpartial(maxlen) -> string
* ARGF.readpartial(maxlen, outbuf) -> outbuf
*
- * Reads at most _maxlen_ bytes from the ARGF stream. It blocks only if
- * +ARGF+ has no data immediately available. If the optional _outbuf_
- * argument is present, it must reference a String, which will receive the
- * data.
+ * Reads at most _maxlen_ bytes from the ARGF stream.
+ *
+ * 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.
- * It raises <code>EOFError</code> on end of file.
- *
- * +readpartial+ is designed for streams such as pipes, sockets, and ttys. It
- * blocks only when no data is immediately available. This means that it
- * blocks only when following all conditions hold:
*
- * * The byte buffer in the +IO+ object is empty.
- * * The content of the stream is empty.
- * * The stream has not reached EOF.
+ * It raises <code>EOFError</code> on end of ARGF stream.
+ * Since ARGF stream is a concatenation of multiple files,
+ * internally EOF is occur for each file.
+ * ARGF.readpartial returns empty strings for EOFs except the last one and
+ * raises <code>EOFError</code> for the last one.
*
- * When +readpartial+ blocks, it waits for data or EOF. If some data is read,
- * +readpartial+ returns with the data. If EOF is reached, readpartial raises
- * an +EOFError+.
- *
- * When +readpartial+ doesn't block, it returns or raises immediately. If
- * the byte buffer is not empty, it returns the data in the buffer. Otherwise, if
- * the stream has some content, it returns the data in the stream. If the
- * stream reaches EOF an +EOFError+ is raised.
*/
static VALUE
@@ -10804,13 +11126,13 @@ argf_getpartial(int argc, VALUE *argv, VALUE argf, int nonblock)
RUBY_METHOD_FUNC(0), Qnil, rb_eEOFError, (VALUE)0);
}
else {
- tmp = io_getpartial(argc, argv, ARGF.current_file, nonblock);
+ tmp = io_getpartial(argc, argv, ARGF.current_file, nonblock, 0);
}
if (NIL_P(tmp)) {
if (ARGF.next_p == -1) {
rb_eof_error();
}
- argf_close(ARGF.current_file);
+ argf_close(argf);
ARGF.next_p = 1;
if (RARRAY_LEN(ARGF.argv) == 0)
rb_eof_error();
@@ -10858,7 +11180,7 @@ argf_getc(VALUE argf)
ch = rb_io_getc(ARGF.current_file);
}
if (NIL_P(ch) && ARGF.next_p != -1) {
- argf_close(ARGF.current_file);
+ argf_close(argf);
ARGF.next_p = 1;
goto retry;
}
@@ -10898,7 +11220,7 @@ argf_getbyte(VALUE argf)
ch = rb_io_getbyte(ARGF.current_file);
}
if (NIL_P(ch) && ARGF.next_p != -1) {
- argf_close(ARGF.current_file);
+ argf_close(argf);
ARGF.next_p = 1;
goto retry;
}
@@ -10938,7 +11260,7 @@ argf_readchar(VALUE argf)
ch = rb_io_getc(ARGF.current_file);
}
if (NIL_P(ch) && ARGF.next_p != -1) {
- argf_close(ARGF.current_file);
+ argf_close(argf);
ARGF.next_p = 1;
goto retry;
}
@@ -10977,6 +11299,26 @@ argf_readbyte(VALUE argf)
return c;
}
+#define FOREACH_ARGF() while (next_argv())
+
+static VALUE
+argf_block_call_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, argf))
+{
+ const VALUE current = ARGF.current_file;
+ rb_yield_values2(argc, argv);
+ if (ARGF.init_p == -1 || current != ARGF.current_file) {
+ rb_iter_break_value(Qundef);
+ }
+ return Qnil;
+}
+
+static void
+argf_block_call(ID mid, int argc, VALUE *argv, VALUE argf)
+{
+ VALUE ret = rb_block_call(ARGF.current_file, mid, argc, argv, argf_block_call_i, argf);
+ if (ret != Qundef) ARGF.next_p = 1;
+}
+
/*
* call-seq:
* ARGF.each(sep=$/) {|line| block } -> ARGF
@@ -11004,7 +11346,7 @@ argf_readbyte(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.lines do |line|
+ * ARGF.each_line do |line|
* puts ARGF.filename if ARGF.lineno == 1
* puts "#{ARGF.lineno}: #{line}"
* end
@@ -11013,11 +11355,10 @@ static VALUE
argf_each_line(int argc, VALUE *argv, VALUE argf)
{
RETURN_ENUMERATOR(argf, argc, argv);
- for (;;) {
- if (!next_argv()) return argf;
- rb_block_call(ARGF.current_file, rb_intern("each_line"), argc, argv, 0, 0);
- ARGF.next_p = 1;
+ FOREACH_ARGF() {
+ argf_block_call(rb_intern("each_line"), argc, argv, argf);
}
+ return argf;
}
/*
@@ -11061,11 +11402,10 @@ static VALUE
argf_each_byte(VALUE argf)
{
RETURN_ENUMERATOR(argf, 0, 0);
- for (;;) {
- if (!next_argv()) return argf;
- rb_block_call(ARGF.current_file, rb_intern("each_byte"), 0, 0, 0, 0);
- ARGF.next_p = 1;
+ FOREACH_ARGF() {
+ argf_block_call(rb_intern("each_byte"), 0, 0, argf);
}
+ return argf;
}
/*
@@ -11101,11 +11441,10 @@ static VALUE
argf_each_char(VALUE argf)
{
RETURN_ENUMERATOR(argf, 0, 0);
- for (;;) {
- if (!next_argv()) return argf;
- rb_block_call(ARGF.current_file, rb_intern("each_char"), 0, 0, 0, 0);
- ARGF.next_p = 1;
+ FOREACH_ARGF() {
+ argf_block_call(rb_intern("each_char"), 0, 0, argf);
}
+ return argf;
}
/*
@@ -11141,11 +11480,10 @@ static VALUE
argf_each_codepoint(VALUE argf)
{
RETURN_ENUMERATOR(argf, 0, 0);
- for (;;) {
- if (!next_argv()) return argf;
- rb_block_call(ARGF.current_file, rb_intern("each_codepoint"), 0, 0, 0, 0);
- ARGF.next_p = 1;
+ FOREACH_ARGF() {
+ argf_block_call(rb_intern("each_codepoint"), 0, 0, argf);
}
+ return argf;
}
/*
@@ -11279,7 +11617,7 @@ static VALUE
argf_skip(VALUE argf)
{
if (ARGF.init_p && ARGF.next_p == 0) {
- argf_close(ARGF.current_file);
+ argf_close(argf);
ARGF.next_p = 1;
}
return argf;
@@ -11307,7 +11645,7 @@ static VALUE
argf_close_m(VALUE argf)
{
next_argv();
- argf_close(ARGF.current_file);
+ argf_close(argf);
if (ARGF.next_p != -1) {
ARGF.next_p = 1;
}
@@ -11376,7 +11714,7 @@ opt_i_get(ID id, VALUE *var)
* $ ruby argf.rb file.txt
*
* ARGF.inplace_mode = '.bak'
- * ARGF.lines do |line|
+ * ARGF.each_line do |line|
* print line.sub("foo","bar")
* end
*
@@ -11482,6 +11820,51 @@ argf_write(VALUE argf, VALUE str)
return rb_io_write(argf_write_io(argf), str);
}
+void
+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) {
+ case EAGAIN:
+ rb_exc_raise(rb_class_new_instance(1, &arg, rb_eEAGAINWaitWritable));
+ break;
+#if EAGAIN != EWOULDBLOCK
+ case EWOULDBLOCK:
+ rb_exc_raise(rb_class_new_instance(1, &arg, rb_eEWOULDBLOCKWaitWritable));
+ break;
+#endif
+ case EINPROGRESS:
+ rb_exc_raise(rb_class_new_instance(1, &arg, rb_eEINPROGRESSWaitWritable));
+ break;
+ default:
+ rb_mod_sys_fail_str(rb_mWaitWritable, arg);
+ }
+ }
+ else if (writable == RB_IO_WAIT_READABLE) {
+ switch (n) {
+ case EAGAIN:
+ rb_exc_raise(rb_class_new_instance(1, &arg, rb_eEAGAINWaitReadable));
+ break;
+#if EAGAIN != EWOULDBLOCK
+ case EWOULDBLOCK:
+ rb_exc_raise(rb_class_new_instance(1, &arg, rb_eEWOULDBLOCKWaitReadable));
+ break;
+#endif
+ case EINPROGRESS:
+ rb_exc_raise(rb_class_new_instance(1, &arg, rb_eEINPROGRESSWaitReadable));
+ break;
+ default:
+ rb_mod_sys_fail_str(rb_mWaitReadable, arg);
+ }
+ }
+ else {
+ rb_bug("invalid read/write type passed to rb_readwrite_sys_fail: %d", writable);
+ }
+}
+
/*
* Document-class: IOError
*
@@ -11690,6 +12073,27 @@ Init_IO(void)
rb_mWaitReadable = rb_define_module_under(rb_cIO, "WaitReadable");
rb_mWaitWritable = rb_define_module_under(rb_cIO, "WaitWritable");
+ rb_eEAGAINWaitReadable = rb_define_class_under(rb_cIO, "EAGAINWaitReadable", rb_eEAGAIN);
+ rb_include_module(rb_eEAGAINWaitReadable, rb_mWaitReadable);
+ rb_eEAGAINWaitWritable = rb_define_class_under(rb_cIO, "EAGAINWaitWritable", rb_eEAGAIN);
+ rb_include_module(rb_eEAGAINWaitWritable, rb_mWaitWritable);
+#if EAGAIN == EWOULDBLOCK
+ rb_eEWOULDBLOCKWaitReadable = rb_eEAGAINWaitReadable;
+ /* same as IO::EAGAINWaitReadable */
+ rb_define_const(rb_cIO, "EWOULDBLOCKWaitReadable", rb_eEAGAINWaitReadable);
+ rb_eEWOULDBLOCKWaitWritable = rb_eEAGAINWaitWritable;
+ /* same as IO::EAGAINWaitWritable */
+ rb_define_const(rb_cIO, "EWOULDBLOCKWaitWritable", rb_eEAGAINWaitWritable);
+#else
+ rb_eEWOULDBLOCKWaitReadable = rb_define_class_under(rb_cIO, "EWOULDBLOCKWaitReadable", rb_eEWOULDBLOCK);
+ rb_include_module(rb_eEWOULDBLOCKWaitReadable, rb_mWaitReadable);
+ rb_eEWOULDBLOCKWaitWritable = rb_define_class_under(rb_cIO, "EWOULDBLOCKWaitWritable", rb_eEWOULDBLOCK);
+ rb_include_module(rb_eEWOULDBLOCKWaitWritable, rb_mWaitWritable);
+#endif
+ rb_eEINPROGRESSWaitReadable = rb_define_class_under(rb_cIO, "EINPROGRESSWaitReadable", rb_eEINPROGRESS);
+ rb_include_module(rb_eEINPROGRESSWaitReadable, rb_mWaitReadable);
+ rb_eEINPROGRESSWaitWritable = rb_define_class_under(rb_cIO, "EINPROGRESSWaitWritable", rb_eEINPROGRESS);
+ rb_include_module(rb_eEINPROGRESSWaitWritable, rb_mWaitWritable);
#if 0
/* This is necessary only for forcing rdoc handle File::open */
@@ -11764,7 +12168,7 @@ Init_IO(void)
rb_define_method(rb_cIO, "readlines", rb_io_readlines, -1);
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, "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);
@@ -11780,9 +12184,20 @@ Init_IO(void)
rb_define_method(rb_cIO, "flush", rb_io_flush, 0);
rb_define_method(rb_cIO, "tell", rb_io_tell, 0);
rb_define_method(rb_cIO, "seek", rb_io_seek_m, -1);
+ /* Set I/O position from the beginning */
rb_define_const(rb_cIO, "SEEK_SET", INT2FIX(SEEK_SET));
+ /* Set I/O position from the current position */
rb_define_const(rb_cIO, "SEEK_CUR", INT2FIX(SEEK_CUR));
+ /* Set I/O position from the end */
rb_define_const(rb_cIO, "SEEK_END", INT2FIX(SEEK_END));
+#ifdef SEEK_DATA
+ /* Set I/O position to the next location containing data */
+ rb_define_const(rb_cIO, "SEEK_DATA", INT2FIX(SEEK_DATA));
+#endif
+#ifdef SEEK_HOLE
+ /* Set I/O position to the next hole */
+ rb_define_const(rb_cIO, "SEEK_HOLE", INT2FIX(SEEK_HOLE));
+#endif
rb_define_method(rb_cIO, "rewind", rb_io_rewind, 0);
rb_define_method(rb_cIO, "pos", rb_io_tell, 0);
rb_define_method(rb_cIO, "pos=", rb_io_set_pos, 1);
@@ -11949,4 +12364,14 @@ Init_IO(void)
sym_willneed = ID2SYM(rb_intern("willneed"));
sym_dontneed = ID2SYM(rb_intern("dontneed"));
sym_noreuse = ID2SYM(rb_intern("noreuse"));
+ sym_SET = ID2SYM(rb_intern("SET"));
+ sym_CUR = ID2SYM(rb_intern("CUR"));
+ sym_END = ID2SYM(rb_intern("END"));
+#ifdef SEEK_DATA
+ sym_DATA = ID2SYM(rb_intern("DATA"));
+#endif
+#ifdef SEEK_HOLE
+ sym_HOLE = ID2SYM(rb_intern("HOLE"));
+#endif
+ sym_exception = ID2SYM(rb_intern("exception"));
}
diff --git a/iseq.c b/iseq.c
index 0af29391b0..b6bdc261b4 100644
--- a/iseq.c
+++ b/iseq.c
@@ -10,6 +10,7 @@
**********************************************************************/
#include "ruby/ruby.h"
+#include "ruby/util.h"
#include "internal.h"
#include "eval_intern.h"
@@ -18,13 +19,11 @@
#include "vm_core.h"
#include "iseq.h"
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
-
#include "insns.inc"
#include "insns_info.inc"
#define ISEQ_MAJOR_VERSION 2
-#define ISEQ_MINOR_VERSION 0
+#define ISEQ_MINOR_VERSION 1
VALUE rb_cISeq;
@@ -76,19 +75,16 @@ iseq_free(void *ptr)
RSTRING_PTR(iseq->location.path));
}
- if (iseq->iseq != iseq->iseq_encoded) {
- RUBY_FREE_UNLESS_NULL(iseq->iseq_encoded);
- }
-
- RUBY_FREE_UNLESS_NULL(iseq->iseq);
+ RUBY_FREE_UNLESS_NULL(iseq->iseq_encoded);
RUBY_FREE_UNLESS_NULL(iseq->line_info_table);
RUBY_FREE_UNLESS_NULL(iseq->local_table);
- RUBY_FREE_UNLESS_NULL(iseq->ic_entries);
+ 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_FREE_UNLESS_NULL(iseq->iseq);
}
ruby_xfree(ptr);
}
@@ -114,10 +110,6 @@ iseq_mark(void *ptr)
RUBY_MARK_UNLESS_NULL((VALUE)iseq->cref_stack);
RUBY_MARK_UNLESS_NULL(iseq->klass);
RUBY_MARK_UNLESS_NULL(iseq->coverage);
-#if 0
- RUBY_MARK_UNLESS_NULL((VALUE)iseq->node);
- RUBY_MARK_UNLESS_NULL(iseq->cached_special_block);
-#endif
RUBY_MARK_UNLESS_NULL(iseq->orig);
if (iseq->compile_data != 0) {
@@ -139,16 +131,14 @@ iseq_memsize(const void *ptr)
if (ptr) {
iseq = ptr;
if (!iseq->orig) {
- if (iseq->iseq != iseq->iseq_encoded) {
- size += iseq->iseq_size * sizeof(VALUE);
- }
-
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);
+ if (iseq->catch_table) {
+ size += iseq_catch_table_bytes(iseq->catch_table->size);
+ }
size += iseq->arg_opts * sizeof(VALUE);
- size += iseq->ic_size * sizeof(struct iseq_inline_cache_entry);
+ size += iseq->is_size * sizeof(union iseq_inline_storage_entry);
size += iseq->callinfo_size * sizeof(rb_call_info_t);
if (iseq->compile_data) {
@@ -156,11 +146,14 @@ iseq_memsize(const void *ptr)
cur = iseq->compile_data->storage_head;
while (cur) {
- size += cur->size + sizeof(struct iseq_compile_data_storage);
+ size += cur->size + SIZEOF_ISEQ_COMPILE_DATA_STORAGE;
cur = cur->next;
}
size += sizeof(struct iseq_compile_data);
}
+ if (iseq->iseq) {
+ size += iseq->iseq_size * sizeof(VALUE);
+ }
}
}
@@ -173,7 +166,9 @@ static const rb_data_type_t iseq_data_type = {
iseq_mark,
iseq_free,
iseq_memsize,
- },
+ }, /* functions */
+ NULL, NULL,
+ RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED
};
static VALUE
@@ -184,19 +179,24 @@ iseq_alloc(VALUE klass)
}
static rb_iseq_location_t *
-iseq_location_setup(rb_iseq_t *iseq, VALUE path, VALUE absolute_path, VALUE name, size_t first_lineno)
+iseq_location_setup(rb_iseq_t *iseq, VALUE path, VALUE absolute_path, VALUE name, VALUE first_lineno)
{
rb_iseq_location_t *loc = &iseq->location;
- loc->path = path;
- if (RTEST(absolute_path) && rb_str_cmp(path, absolute_path) == 0)
- loc->absolute_path = path;
- else
- loc->absolute_path = absolute_path;
- loc->label = loc->base_label = name;
+ RB_OBJ_WRITE(iseq->self, &loc->path, path);
+ if (RTEST(absolute_path) && rb_str_cmp(path, absolute_path) == 0) {
+ RB_OBJ_WRITE(iseq->self, &loc->absolute_path, path);
+ }
+ else {
+ RB_OBJ_WRITE(iseq->self, &loc->absolute_path, absolute_path);
+ }
+ RB_OBJ_WRITE(iseq->self, &loc->label, name);
+ RB_OBJ_WRITE(iseq->self, &loc->base_label, name);
loc->first_lineno = first_lineno;
return loc;
}
+#define ISEQ_SET_CREF(iseq, cref) RB_OBJ_WRITE((iseq)->self, &(iseq)->cref_stack, (cref))
+
static void
set_relation(rb_iseq_t *iseq, const VALUE parent)
{
@@ -207,26 +207,26 @@ set_relation(rb_iseq_t *iseq, const VALUE parent)
/* set class nest stack */
if (type == ISEQ_TYPE_TOP) {
/* toplevel is private */
- iseq->cref_stack = NEW_CREF(rb_cObject);
+ RB_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->cref_stack = cref;
+ RB_OBJ_WRITE(cref, &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->cref_stack = NEW_CREF(0); /* place holder */
+ ISEQ_SET_CREF(iseq, NEW_CREF(0)); /* place holder */
iseq->cref_stack->nd_refinements = Qnil;
iseq->local_iseq = iseq;
}
else if (RTEST(parent)) {
GetISeqPtr(parent, piseq);
- iseq->cref_stack = piseq->cref_stack;
+ ISEQ_SET_CREF(iseq, piseq->cref_stack);
iseq->local_iseq = piseq->local_iseq;
}
@@ -244,9 +244,8 @@ void
rb_iseq_add_mark_object(rb_iseq_t *iseq, VALUE obj)
{
if (!RTEST(iseq->mark_ary)) {
- iseq->mark_ary = rb_ary_tmp_new(3);
- OBJ_UNTRUST(iseq->mark_ary);
- RBASIC(iseq->mark_ary)->klass = 0;
+ RB_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);
}
@@ -261,20 +260,21 @@ prepare_iseq_build(rb_iseq_t *iseq,
iseq->arg_rest = -1;
iseq->arg_block = -1;
iseq->arg_keyword = -1;
- iseq->klass = 0;
+ RB_OBJ_WRITE(iseq->self, &iseq->klass, 0);
set_relation(iseq, parent);
- OBJ_FREEZE(name);
- OBJ_FREEZE(path);
+ name = rb_fstring(name);
+ path = rb_fstring(path);
+ if (RTEST(absolute_path))
+ absolute_path = rb_fstring(absolute_path);
iseq_location_setup(iseq, path, absolute_path, name, first_lineno);
if (iseq != iseq->local_iseq) {
- iseq->location.base_label = iseq->local_iseq->location.label;
+ RB_OBJ_WRITE(iseq->self, &iseq->location.base_label, iseq->local_iseq->location.label);
}
iseq->defined_method_id = 0;
- iseq->mark_ary = 0;
-
+ RB_OBJ_WRITE(iseq->self, &iseq->mark_ary, 0);
/*
* iseq->special_block_builder = GC_GUARDED_PTR_REF(block_opt);
@@ -282,32 +282,29 @@ prepare_iseq_build(rb_iseq_t *iseq,
* iseq->cached_special_block = 0;
*/
- iseq->compile_data = ALLOC(struct iseq_compile_data);
- MEMZERO(iseq->compile_data, struct iseq_compile_data, 1);
- iseq->compile_data->err_info = Qnil;
- iseq->compile_data->mark_ary = rb_ary_tmp_new(3);
+ iseq->compile_data = ZALLOC(struct iseq_compile_data);
+ RB_OBJ_WRITE(iseq->self, &iseq->compile_data->err_info, Qnil);
+ RB_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(struct iseq_compile_data_storage));
+ SIZEOF_ISEQ_COMPILE_DATA_STORAGE);
- iseq->compile_data->catch_table_ary = rb_ary_new();
+ RB_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->storage_head->buff =
- (char *)(&iseq->compile_data->storage_head->buff + 1);
iseq->compile_data->option = option;
iseq->compile_data->last_coverable_line = -1;
- iseq->coverage = Qfalse;
+ RB_OBJ_WRITE(iseq->self, &iseq->coverage, Qfalse);
if (!GET_THREAD()->parse_in_eval) {
VALUE coverages = rb_get_coverages();
if (RTEST(coverages)) {
- iseq->coverage = rb_hash_lookup(coverages, path);
- if (NIL_P(iseq->coverage)) iseq->coverage = Qfalse;
+ RB_OBJ_WRITE(iseq->self, &iseq->coverage, rb_hash_lookup(coverages, path));
+ if (NIL_P(iseq->coverage)) RB_OBJ_WRITE(iseq->self, &iseq->coverage, Qfalse);
}
}
@@ -351,7 +348,9 @@ make_compile_option(rb_compile_option_t *option, VALUE opt)
*option = COMPILE_OPTION_FALSE;
}
else if (opt == Qtrue) {
- memset(option, 1, sizeof(rb_compile_option_t));
+ int i;
+ for (i = 0; i < (int)(sizeof(rb_compile_option_t) / sizeof(int)); ++i)
+ ((int *)option)[i] = 1;
}
else if (CLASS_OF(opt) == rb_cHash) {
*option = COMPILE_OPTION_DEFAULT;
@@ -470,6 +469,34 @@ rb_iseq_new_with_bopt(NODE *node, VALUE name, VALUE path, VALUE absolute_path, V
#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 self, VALUE data, VALUE parent, VALUE opt)
{
@@ -480,7 +507,6 @@ iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt)
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;
@@ -518,27 +544,11 @@ iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt)
GetISeqPtr(iseqval, iseq);
iseq->self = iseqval;
+ iseq->local_iseq = iseq;
- 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);
+ 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 (parent == Qnil) {
@@ -573,18 +583,6 @@ rb_iseq_load(VALUE data, VALUE parent, VALUE opt)
return iseq_load(rb_cISeq, data, parent, opt);
}
-static NODE *
-parse_string(VALUE str, const char *file, int line)
-{
- VALUE parser = rb_parser_new();
- NODE *node = rb_parser_compile_string(parser, file, str, line);
-
- if (!node) {
- rb_exc_raise(GET_THREAD()->errinfo); /* TODO: check err */
- }
- return node;
-}
-
VALUE
rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE absolute_path, VALUE line, rb_block_t *base_block, VALUE opt)
{
@@ -597,17 +595,25 @@ rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE absolute_path, VALUE li
TH_PUSH_TAG(th);
if ((state = EXEC_TAG()) == 0) {
+ VALUE parser;
int ln = NUM2INT(line);
- const char *fn = StringValueCStr(file);
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_compile_file(fn, src, ln);
- else
- node = parse_string(StringValue(src), fn, ln);
+ 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,
@@ -845,8 +851,8 @@ iseq_inspect(VALUE self)
* > iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
* > iseq.path #=> /tmp/method.rb
*/
-static VALUE
-iseq_path(VALUE self)
+VALUE
+rb_iseq_path(VALUE self)
{
rb_iseq_t *iseq;
GetISeqPtr(self, iseq);
@@ -869,8 +875,8 @@ iseq_path(VALUE self)
* > iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
* > iseq.absolute_path #=> /tmp/method.rb
*/
-static VALUE
-iseq_absolute_path(VALUE self)
+VALUE
+rb_iseq_absolute_path(VALUE self)
{
rb_iseq_t *iseq;
GetISeqPtr(self, iseq);
@@ -900,8 +906,8 @@ iseq_absolute_path(VALUE self)
* > iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
* > iseq.label #=> <main>
*/
-static VALUE
-iseq_label(VALUE self)
+VALUE
+rb_iseq_label(VALUE self)
{
rb_iseq_t *iseq;
GetISeqPtr(self, iseq);
@@ -928,8 +934,8 @@ iseq_label(VALUE self)
* > iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
* > iseq.base_label #=> <main>
*/
-static VALUE
-iseq_base_label(VALUE self)
+VALUE
+rb_iseq_base_label(VALUE self)
{
rb_iseq_t *iseq;
GetISeqPtr(self, iseq);
@@ -946,14 +952,36 @@ iseq_base_label(VALUE self)
* iseq.first_lineno
* #=> 1
*/
-static VALUE
-iseq_first_lineno(VALUE self)
+VALUE
+rb_iseq_first_lineno(VALUE self)
{
rb_iseq_t *iseq;
GetISeqPtr(self, iseq);
return iseq->location.first_lineno;
}
+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);
@@ -1050,12 +1078,6 @@ iseq_to_a(VALUE self)
return iseq_data_to_ary(iseq);
}
-int
-rb_iseq_first_lineno(const rb_iseq_t *iseq)
-{
- return FIX2INT(iseq->location.first_lineno);
-}
-
/* TODO: search algorithm is brute force.
this should be binary search or so. */
@@ -1131,9 +1153,9 @@ id_to_name(ID id, VALUE default_value)
}
VALUE
-insn_operand_intern(rb_iseq_t *iseq,
- VALUE insn, int op_no, VALUE op,
- int len, size_t pos, VALUE *pnop, VALUE child)
+rb_insn_operand_intern(const rb_iseq_t *iseq,
+ VALUE insn, int op_no, VALUE op,
+ int len, size_t pos, const VALUE *pnop, VALUE child)
{
const char *types = insn_op_types(insn);
char type = types[op_no];
@@ -1151,7 +1173,7 @@ insn_operand_intern(rb_iseq_t *iseq,
case TS_LINDEX:{
if (insn == BIN(getlocal) || insn == BIN(setlocal)) {
if (pnop) {
- rb_iseq_t *diseq = iseq;
+ const rb_iseq_t *diseq = iseq;
VALUE level = *pnop, i;
for (i = 0; i < level; i++) {
@@ -1203,7 +1225,7 @@ insn_operand_intern(rb_iseq_t *iseq,
break;
case TS_IC:
- ret = rb_sprintf("<ic:%"PRIdPTRDIFF">", (struct iseq_inline_cache_entry *)op - iseq->ic_entries);
+ ret = rb_sprintf("<is:%"PRIdPTRDIFF">", (union iseq_inline_storage_entry *)op - iseq->is_entries);
break;
case TS_CALLINFO:
@@ -1259,8 +1281,8 @@ insn_operand_intern(rb_iseq_t *iseq,
* Iseq -> Iseq inspect object
*/
int
-rb_iseq_disasm_insn(VALUE ret, VALUE *iseq, size_t pos,
- rb_iseq_t *iseqdat, VALUE child)
+rb_iseq_disasm_insn(VALUE ret, const VALUE *iseq, size_t pos,
+ const rb_iseq_t *iseqdat, VALUE child)
{
VALUE insn = iseq[pos];
int len = insn_len(insn);
@@ -1280,9 +1302,9 @@ rb_iseq_disasm_insn(VALUE ret, VALUE *iseq, size_t pos,
for (j = 0; types[j]; j++) {
const char *types = insn_op_types(insn);
- VALUE opstr = insn_operand_intern(iseqdat, insn, j, iseq[pos + j + 1],
- len, pos, &iseq[pos + j + 2],
- child);
+ 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);
if (types[j + 1]) {
@@ -1357,7 +1379,7 @@ rb_iseq_disasm(VALUE self)
VALUE *iseq;
VALUE str = rb_str_new(0, 0);
VALUE child = rb_ary_new();
- unsigned long size;
+ unsigned int size;
int i;
long l;
ID *tbl;
@@ -1366,7 +1388,6 @@ rb_iseq_disasm(VALUE self)
rb_secure(1);
- iseq = iseqdat->iseq;
size = iseqdat->iseq_size;
rb_str_cat2(str, "== disasm: ");
@@ -1379,11 +1400,11 @@ rb_iseq_disasm(VALUE self)
rb_str_cat2(str, "\n");
/* show catch table information */
- if (iseqdat->catch_table_size != 0) {
+ if (iseqdat->catch_table) {
rb_str_cat2(str, "== catch table\n");
}
- for (i = 0; i < iseqdat->catch_table_size; i++) {
- struct iseq_catch_table_entry *entry = &iseqdat->catch_table[i];
+ if (iseqdat->catch_table) for (i = 0; i < iseqdat->catch_table->size; i++) {
+ struct iseq_catch_table_entry *entry = &iseqdat->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,
@@ -1392,7 +1413,7 @@ rb_iseq_disasm(VALUE self)
rb_str_concat(str, rb_iseq_disasm(entry->iseq));
}
}
- if (iseqdat->catch_table_size != 0) {
+ if (iseqdat->catch_table) {
rb_str_cat2(str, "|-------------------------------------"
"-----------------------------------\n");
}
@@ -1403,10 +1424,11 @@ rb_iseq_disasm(VALUE self)
if (tbl) {
rb_str_catf(str,
"local table (size: %d, argc: %d "
- "[opts: %d, rest: %d, post: %d, block: %d] s%d)\n",
+ "[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++) {
@@ -1445,6 +1467,7 @@ rb_iseq_disasm(VALUE self)
}
/* show each line */
+ iseq = rb_iseq_original_iseq(iseqdat);
for (n = 0; n < size;) {
n += rb_iseq_disasm_insn(str, iseq, n, iseqdat, child);
}
@@ -1594,11 +1617,7 @@ ruby_node_name(int node)
static VALUE
register_label(struct st_table *table, unsigned long idx)
{
- VALUE sym;
- char buff[8 + (sizeof(idx) * CHAR_BIT * 32 / 100)];
-
- snprintf(buff, sizeof(buff), "label_%lu", idx);
- sym = ID2SYM(rb_intern(buff));
+ VALUE sym = rb_str_dynamic_intern(rb_sprintf("label_%lu", idx));
st_insert(table, idx, sym);
return sym;
}
@@ -1635,7 +1654,7 @@ iseq_data_to_ary(rb_iseq_t *iseq)
size_t ti;
unsigned int pos;
unsigned int line = 0;
- VALUE *seq;
+ VALUE *seq, *iseq_original;
VALUE val = rb_ary_new();
VALUE type; /* Symbol */
@@ -1736,7 +1755,9 @@ iseq_data_to_ary(rb_iseq_t *iseq)
}
/* body */
- for (seq = iseq->iseq; seq < iseq->iseq + iseq->iseq_size; ) {
+ iseq_original = rb_iseq_original_iseq(iseq);
+
+ for (seq = iseq_original; seq < iseq_original + iseq->iseq_size; ) {
VALUE insn = *seq++;
int j, len = insn_len(insn);
VALUE *nseq = seq + len - 1;
@@ -1746,7 +1767,7 @@ iseq_data_to_ary(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->iseq + *seq;
+ unsigned long idx = nseq - iseq_original + *seq;
rb_ary_push(ary, register_label(labels_table, idx));
break;
}
@@ -1775,10 +1796,11 @@ iseq_data_to_ary(rb_iseq_t *iseq)
rb_ary_push(ary, ID2SYM(entry->id));
}
break;
- case TS_IC: {
- struct iseq_inline_cache_entry *ic = (struct iseq_inline_cache_entry *)*seq;
- rb_ary_push(ary, INT2FIX(ic - iseq->ic_entries));
- }
+ case TS_IC:
+ {
+ union iseq_inline_storage_entry *is = (union iseq_inline_storage_entry *)*seq;
+ rb_ary_push(ary, INT2FIX(is - iseq->is_entries));
+ }
break;
case TS_CALLINFO:
{
@@ -1804,7 +1826,7 @@ iseq_data_to_ary(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->iseq + pos;
+ unsigned long idx = nseq - iseq_original + pos;
rb_ary_store(val, i+1,
register_label(labels_table, idx));
@@ -1822,9 +1844,9 @@ iseq_data_to_ary(rb_iseq_t *iseq)
nbody = body;
/* exception */
- for (i=0; i<iseq->catch_table_size; i++) {
+ if (iseq->catch_table) for (i=0; i<iseq->catch_table->size; i++) {
VALUE ary = rb_ary_new();
- struct iseq_catch_table_entry *entry = &iseq->catch_table[i];
+ struct iseq_catch_table_entry *entry = &iseq->catch_table->entries[i];
rb_ary_push(ary, exception_type2symbol(entry->type));
if (entry->iseq) {
rb_iseq_t *eiseq;
@@ -1846,7 +1868,7 @@ iseq_data_to_ary(rb_iseq_t *iseq)
ti = 0;
for (i=0, pos=0; i<RARRAY_LEN(nbody); i++) {
- VALUE ary = RARRAY_PTR(nbody)[i];
+ VALUE ary = RARRAY_AREF(nbody, i);
st_data_t label;
if (st_lookup(labels_table, pos, &label)) {
@@ -1901,22 +1923,23 @@ rb_iseq_clone(VALUE iseqval, VALUE newcbase)
GetISeqPtr(iseqval, iseq0);
GetISeqPtr(newiseq, iseq1);
- *iseq1 = *iseq0;
+ MEMCPY(iseq1, iseq0, rb_iseq_t, 1); /* TODO: write barrier? */
+
iseq1->self = newiseq;
if (!iseq1->orig) {
- iseq1->orig = iseqval;
+ RB_OBJ_WRITE(iseq1->self, &iseq1->orig, iseqval);
}
if (iseq0->local_iseq == iseq0) {
iseq1->local_iseq = iseq1;
}
if (newcbase) {
- iseq1->cref_stack = NEW_CREF(newcbase);
- iseq1->cref_stack->nd_refinements = iseq0->cref_stack->nd_refinements;
+ ISEQ_SET_CREF(iseq1, NEW_CREF(newcbase));
+ RB_OBJ_WRITE(iseq1->cref_stack, &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;
+ RB_OBJ_WRITE(iseq1->cref_stack, &iseq1->cref_stack->nd_next, iseq0->cref_stack->nd_next);
}
- iseq1->klass = newcbase;
+ RB_OBJ_WRITE(iseq1->self, &iseq1->klass, newcbase);
}
return newiseq;
@@ -1976,15 +1999,27 @@ rb_iseq_parameters(const rb_iseq_t *iseq, int is_proc)
}
}
if (iseq->arg_keyword != -1) {
+ i = 0;
+ if (iseq->arg_keyword_required) {
+ ID keyreq;
+ CONST_ID(keyreq, "keyreq");
+ for (; i < iseq->arg_keyword_required; i++) {
+ PARAM_TYPE(keyreq);
+ 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 = 0; i < iseq->arg_keywords; i++) {
+ for (; i < iseq->arg_keywords; i++) {
PARAM_TYPE(key);
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])) {
+ if (!iseq->arg_keyword_check) {
CONST_ID(keyrest, "keyrest");
rb_ary_push(args, PARAM(iseq->arg_keyword, keyrest));
}
@@ -2031,6 +2066,7 @@ rb_iseq_defined_string(enum defined_type type)
str = rb_str_new_cstr(estr);;
OBJ_FREEZE(str);
defs[type-1] = str;
+ rb_gc_register_mark_object(str);
}
return str;
}
@@ -2055,18 +2091,18 @@ rb_iseq_build_for_ruby2cext(
GetISeqPtr(iseqval, iseq);
/* copy iseq */
- *iseq = *iseq_template;
- iseq->location.label = rb_str_new2(name);
- iseq->location.path = rb_str_new2(path);
- iseq->location.first_lineno = first_lineno;
- iseq->mark_ary = 0;
+ MEMCPY(iseq, iseq_template, rb_iseq_t, 1); /* TODO: write barrier, *iseq = *iseq_template; */
+ RB_OBJ_WRITE(iseq->self, &iseq->location.label, rb_str_new2(name));
+ RB_OBJ_WRITE(iseq->self, &iseq->location.path, rb_str_new2(path));
+ iseq->location.first_lineno = UINT2NUM(first_lineno);
+ RB_OBJ_WRITE(iseq->self, &iseq->mark_ary, 0);
iseq->self = iseqval;
- iseq->iseq = ALLOC_N(VALUE, iseq->iseq_size);
+ iseq->iseq_encoded = 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;
+ iseq->iseq_encoded[i] = BIN(opt_call_c_function);
+ iseq->iseq_encoded[i+1] = (VALUE)func;
}
rb_iseq_translate_threaded_code(iseq);
@@ -2081,8 +2117,14 @@ rb_iseq_build_for_ruby2cext(
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);
+ /*
+ * FIXME: probably broken, but this function is probably unused
+ * and should be removed
+ */
+ if (iseq->catch_table) {
+ MEMCPY(&iseq->catch_table->entries, 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);
@@ -2100,16 +2142,19 @@ int
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;
- size_t pos, insn;
+ unsigned int pos;
+ size_t 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->iseq_size; pos += insn_len(insn)) {
- insn = iseq->iseq[pos];
+ insn = iseq_original[pos];
if (insn == BIN(trace)) {
- rb_event_flag_t current_events = (VALUE)iseq->iseq[pos+1];
+ rb_event_flag_t current_events = (VALUE)iseq_original[pos+1];
if (current_events & RUBY_EVENT_LINE) {
rb_event_flag_t events = current_events & RUBY_EVENT_SPECIFIED_LINE;
@@ -2120,7 +2165,7 @@ rb_iseq_line_trace_each(VALUE iseqval, int (*func)(int line, rb_event_flag_t *ev
/* printf("line: %d\n", line); */
cont = (*func)(line, &events, data);
if (current_events != events) {
- iseq->iseq[pos+1] = iseq->iseq_encoded[pos+1] =
+ iseq_original[pos+1] = iseq->iseq_encoded[pos+1] =
(VALUE)(current_events | (events & RUBY_EVENT_SPECIFIED_LINE));
}
}
@@ -2247,11 +2292,11 @@ Init_ISeq(void)
rb_define_method(rb_cISeq, "eval", iseq_eval, 0);
/* location APIs */
- rb_define_method(rb_cISeq, "path", iseq_path, 0);
- rb_define_method(rb_cISeq, "absolute_path", iseq_absolute_path, 0);
- rb_define_method(rb_cISeq, "label", iseq_label, 0);
- rb_define_method(rb_cISeq, "base_label", iseq_base_label, 0);
- rb_define_method(rb_cISeq, "first_lineno", iseq_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. */
diff --git a/iseq.h b/iseq.h
index 4de08169d8..bf3a714e9d 100644
--- a/iseq.h
+++ b/iseq.h
@@ -12,13 +12,12 @@
#ifndef RUBY_COMPILE_H
#define RUBY_COMPILE_H
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
+RUBY_SYMBOL_EXPORT_BEGIN
/* compile.c */
VALUE rb_iseq_compile_node(VALUE self, NODE *node);
int rb_iseq_translate_threaded_code(rb_iseq_t *iseq);
+VALUE *rb_iseq_original_iseq(rb_iseq_t *iseq);
VALUE rb_iseq_build_from_ary(rb_iseq_t *iseq, VALUE locals, VALUE args,
VALUE exception, VALUE body);
@@ -64,26 +63,46 @@ struct iseq_catch_table_entry {
CATCH_TYPE_NEXT = INT2FIX(6)
} type;
VALUE iseq;
- unsigned long start;
- unsigned long end;
- unsigned long cont;
- unsigned long sp;
+ unsigned int start;
+ unsigned int end;
+ unsigned int cont;
+ unsigned int sp;
};
+PACKED_STRUCT_UNALIGNED(struct iseq_catch_table {
+ 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 long pos;
- unsigned long size;
- char *buff;
+ unsigned int pos;
+ unsigned int size;
+ char buff[1]; /* flexible array */
};
+/* account for flexible array */
+#define SIZEOF_ISEQ_COMPILE_DATA_STORAGE \
+ (sizeof(struct iseq_compile_data_storage) - 1)
+
struct iseq_compile_data {
/* GC is needed */
- VALUE err_info;
+ const VALUE err_info;
VALUE mark_ary;
- VALUE catch_table_ary; /* Array */
+ const VALUE catch_table_ary; /* Array */
/* GC is not needed */
struct iseq_label_data *start_label;
@@ -133,8 +152,6 @@ VALUE rb_iseq_defined_string(enum defined_type type);
#define DEFAULT_SPECIAL_VAR_COUNT 2
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
-#endif
+RUBY_SYMBOL_EXPORT_END
#endif /* RUBY_COMPILE_H */
diff --git a/lib/English.rb b/lib/English.rb
index 32769fb18b..838e5afc74 100644
--- a/lib/English.rb
+++ b/lib/English.rb
@@ -6,7 +6,7 @@
#
# $\ = ' -- '
# "waterbuffalo" =~ /buff/
-# print $", $', $$, "\n"
+# print $', $$, "\n"
#
# With English:
#
@@ -14,7 +14,7 @@
#
# $OUTPUT_FIELD_SEPARATOR = ' -- '
# "waterbuffalo" =~ /buff/
-# print $LOADED_FEATURES, $POSTMATCH, $PID, "\n"
+# print $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 841f6d980e..2c07fb5cf9 100755..100644
--- a/lib/abbrev.rb
+++ b/lib/abbrev.rb
@@ -1,4 +1,3 @@
-#!/usr/bin/env ruby
#--
# Copyright (c) 2001,2003 Akinori MUSHA <knu@iDaemons.org>
#
@@ -11,43 +10,46 @@
#++
##
-# Calculates the set of unique abbreviations for a given set of strings.
+# Calculates the set of unambiguous abbreviations for a given set of strings.
#
# require 'abbrev'
# require 'pp'
#
-# pp Abbrev.abbrev(['ruby', 'rules'])
+# pp Abbrev.abbrev(['ruby'])
+# #=> {"ruby"=>"ruby", "rub"=>"ruby", "ru"=>"ruby", "r"=>"ruby"}
#
-# Generates:
+# pp Abbrev.abbrev(%w{ ruby rules })
#
-# { "rub" => "ruby",
-# "ruby" => "ruby",
-# "rul" => "rules",
+# _Generates:_
+# { "ruby" => "ruby",
+# "rub" => "ruby",
+# "rules" => "rules",
# "rule" => "rules",
-# "rules" => "rules" }
+# "rul" => "rules" }
#
# It also provides an array core extension, Array#abbrev.
#
-# 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"}
+# 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" }
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
@@ -55,15 +57,18 @@ module Abbrev
#
# require 'abbrev'
#
- # Abbrev.abbrev(['car', 'cone'])
+ # Abbrev.abbrev(%w{ 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.
+ # 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"}
#
- # Abbrev.abbrev(%w{car box cone}, /b/)
- # #=> {"bo"=>"box", "b"=>"box", "box"=>"box"}
+ # Abbrev.abbrev(%w{car box cone}, 'ca')
+ # #=> {"car"=>"car", "ca"=>"car"}
def abbrev(words, pattern = nil)
table = {}
seen = Hash.new(0)
@@ -103,34 +108,24 @@ 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
- # #=> {"ca" => "car", "con"=>"cone", "co" => "cone",
- # "car"=>"car", "cone" => "cone"}
+ # #=> {"car"=>"car", "ca"=>"car", "cone"=>"cone", "con"=>"cone", "co"=>"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/)
- # #=> {"fas"=>"fast", "fa"=>"fast", "da"=>"day",
- # "fast"=>"fast", "day"=>"day"}
+ # #=> {"fast"=>"fast", "fas"=>"fast", "fa"=>"fast", "day"=>"day", "da"=>"day"}
+ #
+ # Abbrev.abbrev(%w{car box cone}, "ca")
+ # #=> {"car"=>"car", "ca"=>"car"}
#
# 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 a240b730b4..98829f0d96 100644
--- a/lib/base64.rb
+++ b/lib/base64.rb
@@ -25,7 +25,7 @@ module Base64
# Returns the Base64-encoded version of +bin+.
# This method complies with RFC 2045.
- # Line feeds are added to every 60 encoded charactors.
+ # Line feeds are added to every 60 encoded characters.
#
# require 'base64'
# Base64.encode64("Now is the time for all good coders\nto learn Ruby")
diff --git a/lib/benchmark.rb b/lib/benchmark.rb
index f52ba7df34..690dff1c28 100644
--- a/lib/benchmark.rb
+++ b/lib/benchmark.rb
@@ -19,15 +19,15 @@
# used to execute Ruby code.
#
# * Measure the time to construct the string given by the expression
-# <code>"a"*1_000_000</code>:
+# <code>"a"*1_000_000_000</code>:
#
# require 'benchmark'
#
-# puts Benchmark.measure { "a"*1_000_000 }
+# puts Benchmark.measure { "a"*1_000_000_000 }
#
-# On my machine (FreeBSD 3.2 on P5, 100MHz) this generates:
+# On my machine (OSX 10.8.3 on i5 1.7 Ghz) this generates:
#
-# 1.166667 0.050000 1.216667 ( 0.571355)
+# 0.350000 0.400000 0.750000 ( 0.835234)
#
# This report shows the user CPU time, system CPU time, the sum of
# the user and system CPU times, and the elapsed real time. The unit
@@ -37,7 +37,7 @@
#
# require 'benchmark'
#
-# n = 50000
+# n = 5000000
# Benchmark.bm do |x|
# x.report { for i in 1..n; a = "1"; end }
# x.report { n.times do ; a = "1"; end }
@@ -47,15 +47,15 @@
# The result:
#
# user system total real
-# 1.033333 0.016667 1.016667 ( 0.492106)
-# 1.483333 0.000000 1.483333 ( 0.694605)
-# 1.516667 0.000000 1.516667 ( 0.711077)
+# 1.010000 0.000000 1.010000 ( 1.014479)
+# 1.000000 0.000000 1.000000 ( 0.998261)
+# 0.980000 0.000000 0.980000 ( 0.981335)
#
# * Continuing the previous example, put a label in each report:
#
# require 'benchmark'
#
-# n = 50000
+# n = 5000000
# Benchmark.bm(7) do |x|
# x.report("for:") { for i in 1..n; a = "1"; end }
# x.report("times:") { n.times do ; a = "1"; end }
@@ -65,10 +65,9 @@
# The result:
#
# user system total real
-# for: 1.050000 0.000000 1.050000 ( 0.503462)
-# times: 1.533333 0.016667 1.550000 ( 0.735473)
-# upto: 1.500000 0.016667 1.516667 ( 0.711239)
-#
+# for: 1.010000 0.000000 1.010000 ( 1.015688)
+# times: 1.000000 0.000000 1.000000 ( 1.003611)
+# upto: 1.030000 0.000000 1.030000 ( 1.028098)
#
# * The times for some benchmarks depend on the order in which items
# are run. These differences are due to the cost of memory
@@ -88,14 +87,13 @@
# The result:
#
# Rehearsal -----------------------------------------
-# sort! 11.928000 0.010000 11.938000 ( 12.756000)
-# sort 13.048000 0.020000 13.068000 ( 13.857000)
-# ------------------------------- total: 25.006000sec
+# sort! 1.490000 0.010000 1.500000 ( 1.490520)
+# sort 1.460000 0.000000 1.460000 ( 1.463025)
+# -------------------------------- total: 2.960000sec
#
# user system total real
-# sort! 12.959000 0.010000 12.969000 ( 13.793000)
-# sort 12.007000 0.000000 12.007000 ( 12.791000)
-#
+# sort! 1.460000 0.000000 1.460000 ( 1.460465)
+# sort 1.450000 0.010000 1.460000 ( 1.448327)
#
# * Report statistics of sequential experiments with unique labels,
# using the #benchmark method:
@@ -103,7 +101,7 @@
# require 'benchmark'
# include Benchmark # we need the CAPTION and FORMAT constants
#
-# n = 50000
+# n = 5000000
# Benchmark.benchmark(CAPTION, 7, FORMAT, ">total:", ">avg:") do |x|
# tf = x.report("for:") { for i in 1..n; a = "1"; end }
# tt = x.report("times:") { n.times do ; a = "1"; end }
@@ -114,11 +112,11 @@
# The result:
#
# user system total real
-# for: 1.016667 0.016667 1.033333 ( 0.485749)
-# times: 1.450000 0.016667 1.466667 ( 0.681367)
-# upto: 1.533333 0.000000 1.533333 ( 0.722166)
-# >total: 4.000000 0.033333 4.033333 ( 1.889282)
-# >avg: 1.333333 0.011111 1.344444 ( 0.629761)
+# for: 0.950000 0.000000 0.950000 ( 0.952039)
+# times: 0.980000 0.000000 0.980000 ( 0.984938)
+# upto: 0.950000 0.000000 0.950000 ( 0.946787)
+# >total: 2.880000 0.000000 2.880000 ( 2.883764)
+# >avg: 0.960000 0.000000 0.960000 ( 0.961255)
module Benchmark
@@ -145,7 +143,7 @@ module Benchmark
# require 'benchmark'
# include Benchmark # we need the CAPTION and FORMAT constants
#
- # n = 50000
+ # n = 5000000
# Benchmark.benchmark(CAPTION, 7, FORMAT, ">total:", ">avg:") do |x|
# tf = x.report("for:") { for i in 1..n; a = "1"; end }
# tt = x.report("times:") { n.times do ; a = "1"; end }
@@ -156,11 +154,11 @@ module Benchmark
# Generates:
#
# user system total real
- # for: 1.016667 0.016667 1.033333 ( 0.485749)
- # times: 1.450000 0.016667 1.466667 ( 0.681367)
- # upto: 1.533333 0.000000 1.533333 ( 0.722166)
- # >total: 4.000000 0.033333 4.033333 ( 1.889282)
- # >avg: 1.333333 0.011111 1.344444 ( 0.629761)
+ # for: 0.970000 0.000000 0.970000 ( 0.970493)
+ # times: 0.990000 0.000000 0.990000 ( 0.989542)
+ # upto: 0.970000 0.000000 0.970000 ( 0.972854)
+ # >total: 2.930000 0.000000 2.930000 ( 2.932889)
+ # >avg: 0.976667 0.000000 0.976667 ( 0.977630)
#
def benchmark(caption = "", label_width = nil, format = nil, *labels) # :yield: report
@@ -181,13 +179,13 @@ module Benchmark
end
- # A simple interface to the #benchmark method, #bm is generates sequential
+ # A simple interface to the #benchmark method, #bm generates sequential
# reports with labels. The parameters have the same meaning as for
# #benchmark.
#
# require 'benchmark'
#
- # n = 50000
+ # n = 5000000
# Benchmark.bm(7) do |x|
# x.report("for:") { for i in 1..n; a = "1"; end }
# x.report("times:") { n.times do ; a = "1"; end }
@@ -197,9 +195,9 @@ module Benchmark
# Generates:
#
# user system total real
- # for: 1.050000 0.000000 1.050000 ( 0.503462)
- # times: 1.533333 0.016667 1.550000 ( 0.735473)
- # upto: 1.500000 0.016667 1.516667 ( 0.711239)
+ # for: 0.960000 0.000000 0.960000 ( 0.957966)
+ # times: 0.960000 0.000000 0.960000 ( 0.960423)
+ # upto: 0.950000 0.000000 0.950000 ( 0.954864)
#
def bm(label_width = 0, *labels, &blk) # :yield: report
@@ -233,13 +231,13 @@ module Benchmark
# Generates:
#
# Rehearsal -----------------------------------------
- # sort! 11.928000 0.010000 11.938000 ( 12.756000)
- # sort 13.048000 0.020000 13.068000 ( 13.857000)
- # ------------------------------- total: 25.006000sec
+ # sort! 1.440000 0.010000 1.450000 ( 1.446833)
+ # sort 1.440000 0.000000 1.440000 ( 1.448257)
+ # -------------------------------- total: 2.890000sec
#
# user system total real
- # sort! 12.959000 0.010000 12.969000 ( 13.793000)
- # sort 12.007000 0.000000 12.007000 ( 12.791000)
+ # sort! 1.460000 0.000000 1.460000 ( 1.458065)
+ # sort 1.450000 0.000000 1.450000 ( 1.455963)
#
# #bmbm yields a Benchmark::Job object and returns an array of
# Benchmark::Tms objects.
@@ -272,14 +270,23 @@ module Benchmark
STDOUT.sync = sync unless sync.nil?
end
+ # :stopdoc:
+ case
+ when defined?(Process::CLOCK_MONOTONIC)
+ BENCHMARK_CLOCK = Process::CLOCK_MONOTONIC
+ else
+ BENCHMARK_CLOCK = Process::CLOCK_REALTIME
+ end
+ # :startdoc:
+
#
# Returns the time used to execute the given block as a
# Benchmark::Tms object.
#
def measure(label = "") # :yield:
- t0, r0 = Process.times, Time.now
+ t0, r0 = Process.times, Process.clock_gettime(BENCHMARK_CLOCK)
yield
- t1, r1 = Process.times, Time.now
+ t1, r1 = Process.times, Process.clock_gettime(BENCHMARK_CLOCK)
Benchmark::Tms.new(t1.utime - t0.utime,
t1.stime - t0.stime,
t1.cutime - t0.cutime,
@@ -292,9 +299,9 @@ module Benchmark
# Returns the elapsed real time used to execute the given block.
#
def realtime # :yield:
- r0 = Time.now
+ r0 = Process.clock_gettime(BENCHMARK_CLOCK)
yield
- Time.now - r0
+ Process.clock_gettime(BENCHMARK_CLOCK) - r0
end
module_function :benchmark, :measure, :realtime, :bm, :bmbm
@@ -548,23 +555,3 @@ 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 1c5ccd369f..ae73fe37f6 100644
--- a/lib/cgi.rb
+++ b/lib/cgi.rb
@@ -10,8 +10,6 @@
# 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
@@ -143,6 +141,11 @@ raise "Please, use ruby 1.9.0 or later." if RUBY_VERSION < "1.9.0"
# take particular attributes where the attributes can be directly specified
# as arguments, rather than via a hash.
#
+# === Utility HTML escape and other methods like a function.
+#
+# There are some utility tool defined in cgi/util.rb .
+# And when include, you can use utility methods like a function.
+#
# == Examples of use
#
# === Get form values
@@ -159,7 +162,7 @@ raise "Please, use ruby 1.9.0 or later." if RUBY_VERSION < "1.9.0"
# cgi.include?('field_name')
#
# CAUTION! cgi['field_name'] returned an Array with the old
-# cgi.rb(included in ruby 1.6)
+# cgi.rb(included in Ruby 1.6)
#
# === Get form values as hash
#
@@ -268,6 +271,20 @@ raise "Please, use ruby 1.9.0 or later." if RUBY_VERSION < "1.9.0"
# CGI.new("html4Fr") # html4.01 Frameset
# CGI.new("html5") # html5
#
+# === Some utility methods
+#
+# require 'cgi/util'
+# CGI.escapeHTML('Usage: foo "bar" <baz>')
+#
+#
+# === Some utility methods like a function
+#
+# require 'cgi/util'
+# include CGI::Util
+# escapeHTML('Usage: foo "bar" <baz>')
+# h('Usage: foo "bar" <baz>') # alias
+#
+#
class CGI
end
diff --git a/lib/cgi/cookie.rb b/lib/cgi/cookie.rb
index a26bd16c32..3ec884dffb 100644
--- a/lib/cgi/cookie.rb
+++ b/lib/cgi/cookie.rb
@@ -1,6 +1,5 @@
require 'cgi/util'
class CGI
- @@accept_charset="UTF-8" unless defined?(@@accept_charset)
# Class representing an HTTP cookie.
#
# In addition to its specific fields and methods, a Cookie instance
@@ -9,9 +8,9 @@ class CGI
# See RFC 2965.
#
# == Examples of use
- # cookie1 = CGI::Cookie::new("name", "value1", "value2", ...)
- # cookie1 = CGI::Cookie::new("name" => "name", "value" => "value")
- # cookie1 = CGI::Cookie::new('name' => 'name',
+ # 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
@@ -35,6 +34,7 @@ class CGI
# cookie1.expires = Time.now + 30
# cookie1.secure = true
class Cookie < Array
+ @@accept_charset="UTF-8" unless defined?(@@accept_charset)
# Create a new CGI::Cookie object.
#
@@ -125,7 +125,7 @@ class CGI
# Convert the Cookie to its string representation.
def to_s
- val = collect{|v| CGI::escape(v) }.join("&")
+ val = collect{|v| CGI.escape(v) }.join("&")
buf = "#{@name}=#{val}"
buf << "; domain=#{@domain}" if @domain
buf << "; path=#{@path}" if @path
@@ -134,32 +134,37 @@ class CGI
buf
end
- end # class Cookie
+ # Parse a raw cookie string into a hash of cookie-name=>Cookie
+ # pairs.
+ #
+ # cookies = CGI::Cookie.parse("raw_cookie_string")
+ # # { "name1" => cookie1, "name2" => cookie2, ... }
+ #
+ def self.parse(raw_cookie)
+ cookies = Hash.new([])
+ return cookies unless raw_cookie
- # Parse a raw cookie string into a hash of cookie-name=>Cookie
- # pairs.
- #
- # cookies = CGI::Cookie::parse("raw_cookie_string")
- # # { "name1" => cookie1, "name2" => cookie2, ... }
- #
- def Cookie::parse(raw_cookie)
- cookies = Hash.new([])
- return cookies unless raw_cookie
-
- raw_cookie.split(/[;,]\s?/).each do |pairs|
- name, values = pairs.split('=',2)
- next unless name and values
- name = CGI::unescape(name)
- values ||= ""
- values = values.split('&').collect{|v| CGI::unescape(v,@@accept_charset) }
- if cookies.has_key?(name)
- values = cookies[name].value + values
+ raw_cookie.split(/[;,]\s?/).each do |pairs|
+ name, values = pairs.split('=',2)
+ next unless name and values
+ name = CGI.unescape(name)
+ values ||= ""
+ values = values.split('&').collect{|v| CGI.unescape(v,@@accept_charset) }
+ if cookies.has_key?(name)
+ values = cookies[name].value + values
+ end
+ cookies[name] = Cookie.new(name, *values)
end
- cookies[name] = Cookie::new(name, *values)
+
+ cookies
+ end
+
+ # A summary of cookie string.
+ def inspect
+ "#<CGI::Cookie: #{self.to_s.inspect}>"
end
- cookies
- end
+ end # class Cookie
end
diff --git a/lib/cgi/core.rb b/lib/cgi/core.rb
index 27137a2032..b81f915379 100644
--- a/lib/cgi/core.rb
+++ b/lib/cgi/core.rb
@@ -238,7 +238,7 @@ class CGI
arr.each {|c| buf << "Set-Cookie: #{c}#{EOL}" }
when Hash
hash = cookie
- hash.each {|name, c| buf << "Set-Cookie: #{c}#{EOL}" }
+ hash.each_value {|c| buf << "Set-Cookie: #{c}#{EOL}" }
end
end
if @output_cookies
@@ -389,9 +389,6 @@ 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
@@ -482,7 +479,6 @@ 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
@@ -550,7 +546,7 @@ class CGI
name = $1 || $2 || ''
if body.original_filename.empty?
value=body.read.dup.force_encoding(@accept_charset)
- body.unlink if defined?(Tempfile) && body.kind_of?(Tempfile)
+ body.close! if defined?(Tempfile) && body.kind_of?(Tempfile)
(params[name] ||= []) << value
unless value.valid_encoding?
if @accept_charset_error_block
@@ -574,27 +570,28 @@ class CGI
raise EOFError, "bad boundary end of body part" unless boundary_end =~ /--/
params.default = []
params
- ensure
- if $! && tempfiles
+ rescue Exception
+ if tempfiles
tempfiles.each {|t|
if t.path
- t.unlink
+ t.close!
end
}
end
+ raise
end # read_multipart
private :read_multipart
def create_body(is_large) #:nodoc:
if is_large
require 'tempfile'
- body = Tempfile.new('CGI', encoding: "ascii-8bit")
+ body = Tempfile.new('CGI', encoding: Encoding::ASCII_8BIT)
else
begin
require 'stringio'
- body = StringIO.new("".force_encoding("ascii-8bit"))
+ body = StringIO.new("".force_encoding(Encoding::ASCII_8BIT))
rescue LoadError
require 'tempfile'
- body = Tempfile.new('CGI', encoding: "ascii-8bit")
+ body = Tempfile.new('CGI', encoding: Encoding::ASCII_8BIT)
end
end
body.binmode if defined? body.binmode
@@ -643,8 +640,9 @@ 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'])
- raise StandardError.new("too large multipart data.") if env_table['CONTENT_LENGTH'].to_i > MAX_MULTIPART_LENGTH
+ %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
boundary = $1.dup
@multipart = true
@params = read_multipart(boundary, Integer(env_table['CONTENT_LENGTH']))
@@ -701,9 +699,9 @@ class CGI
if value
return value
elsif defined? StringIO
- StringIO.new("".force_encoding("ascii-8bit"))
+ StringIO.new("".force_encoding(Encoding::ASCII_8BIT))
else
- Tempfile.new("CGI",encoding:"ascii-8bit")
+ Tempfile.new("CGI",encoding: Encoding::ASCII_8BIT)
end
else
str = if value then value.dup else "" end
@@ -750,6 +748,16 @@ 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:
@@ -763,7 +771,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 two options:
+ # A Hash that recognizes three options:
#
# <tt>:accept_charset</tt>::
# specifies encoding of received query string. If omitted,
@@ -792,6 +800,18 @@ 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:
@@ -809,7 +829,10 @@ 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}
+ @options={
+ :accept_charset=>@@accept_charset,
+ :max_multipart_length=>@@max_multipart_length
+ }
case options
when Hash
@options.merge!(options)
@@ -817,6 +840,7 @@ 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
@@ -832,33 +856,25 @@ class CGI
when "html3"
require 'cgi/html'
extend Html3
- element_init()
extend HtmlExtension
when "html4"
require 'cgi/html'
extend Html4
- element_init()
extend HtmlExtension
when "html4Tr"
require 'cgi/html'
extend Html4Tr
- element_init()
extend HtmlExtension
when "html4Fr"
require 'cgi/html'
extend Html4Tr
- element_init()
extend Html4Fr
- element_init()
extend HtmlExtension
when "html5"
require 'cgi/html'
extend Html5
- element_init()
extend HtmlExtension
end
end
end # class CGI
-
-
diff --git a/lib/cgi/html.rb b/lib/cgi/html.rb
index ba19e3d603..db47bb8266 100644
--- a/lib/cgi/html.rb
+++ b/lib/cgi/html.rb
@@ -8,55 +8,62 @@ class CGI
# Generate code for an element with required start and end tags.
#
# - -
- def nn_element_def(element)
- nOE_element_def(element, <<-END)
- if block_given?
- yield.to_s
- else
- ""
- end +
- "</#{element.upcase}>"
- END
+ def nn_element(element, attributes = {})
+ s = nOE_element(element, attributes)
+ if block_given?
+ s << yield.to_s
+ end
+ s << "</#{element.upcase}>"
+ end
+
+ def nn_element_def(attributes = {}, &block)
+ nn_element(__callee__, attributes, &block)
end
# Generate code for an empty element.
#
# - O EMPTY
- def nOE_element_def(element, append = nil)
- s = <<-END
- attributes={attributes=>nil} if attributes.kind_of?(String)
- "<#{element.upcase}" + attributes.collect{|name, value|
- next unless value
- " " + CGI::escapeHTML(name.to_s) +
- if true == value
- ""
- else
- '="' + CGI::escapeHTML(value.to_s) + '"'
- end
- }.join + ">"
- END
- s.sub!(/\Z/, " +") << append if append
- s
+ def nOE_element(element, attributes = {})
+ attributes={attributes=>nil} if attributes.kind_of?(String)
+ s = "<#{element.upcase}"
+ attributes.each do|name, value|
+ next unless value
+ s << " "
+ s << CGI::escapeHTML(name.to_s)
+ if value != true
+ s << '="'
+ s << CGI::escapeHTML(value.to_s)
+ s << '"'
+ end
+ end
+ s << ">"
+ end
+
+ def nOE_element_def(attributes = {}, &block)
+ nOE_element(__callee__, attributes, &block)
end
+
# Generate code for an element for which the end (and possibly the
# start) tag is optional.
#
# O O or - O
- def nO_element_def(element)
- nOE_element_def(element, <<-END)
- if block_given?
- yield.to_s + "</#{element.upcase}>"
- else
- ""
- end
- END
+ def nO_element(element, attributes = {})
+ s = nOE_element(element, attributes)
+ if block_given?
+ s << yield.to_s
+ s << "</#{element.upcase}>"
+ end
+ s
+ end
+
+ def nO_element_def(attributes = {}, &block)
+ nO_element(__callee__, attributes, &block)
end
end # TagMaker
- #
# Mixin module providing HTML generation methods.
#
# For example,
@@ -92,11 +99,7 @@ class CGI
else
href
end
- if block_given?
- super(attributes){ yield }
- else
- super(attributes)
- end
+ super(attributes)
end
# Generate a Document Base URI element as a String.
@@ -114,11 +117,7 @@ class CGI
else
href
end
- if block_given?
- super(attributes){ yield }
- else
- super(attributes)
- end
+ super(attributes)
end
# Generate a BlockQuote element as a string.
@@ -137,11 +136,7 @@ class CGI
else
cite
end
- if block_given?
- super(attributes){ yield }
- else
- super(attributes)
- end
+ super(attributes)
end
@@ -161,11 +156,7 @@ class CGI
else
align
end
- if block_given?
- super(attributes){ yield }
- else
- super(attributes)
- end
+ super(attributes)
end
@@ -428,11 +419,7 @@ class CGI
buf << doctype
end
- if block_given?
- buf << super(attributes){ yield }
- else
- buf << super(attributes)
- end
+ buf << super(attributes)
if pretty
CGI::pretty(buf, pretty)
@@ -824,11 +811,7 @@ class CGI
else
name
end
- if block_given?
- super(attributes){ yield }
- else
- super(attributes)
- end
+ super(attributes)
end
end # HtmlExtension
@@ -836,50 +819,38 @@ class CGI
# Mixin module for HTML version 3 generation methods.
module Html3 # :nodoc:
+ include TagMaker
# The DOCTYPE declaration for this version of HTML
def doctype
%|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">|
end
- # Initialise the HTML generation methods for this version.
- def element_init
- extend TagMaker
- return if defined?(html)
- methods = ""
+ instance_method(:nn_element_def).tap do |m|
# - -
for element in %w[ A TT I B U STRIKE BIG SMALL SUB SUP EM STRONG
DFN CODE SAMP KBD VAR CITE FONT ADDRESS DIV CENTER MAP
APPLET PRE XMP LISTING DL OL UL DIR MENU SELECT TABLE TITLE
STYLE SCRIPT H1 H2 H3 H4 H5 H6 TEXTAREA FORM BLOCKQUOTE
CAPTION ]
- methods << <<-BEGIN + nn_element_def(element) + <<-END
- def #{element.downcase}(attributes = {})
- BEGIN
- end
- END
+ define_method(element.downcase, m)
end
+ end
+ instance_method(:nOE_element_def).tap do |m|
# - O EMPTY
for element in %w[ IMG BASE BASEFONT BR AREA LINK PARAM HR INPUT
ISINDEX META ]
- methods << <<-BEGIN + nOE_element_def(element) + <<-END
- def #{element.downcase}(attributes = {})
- BEGIN
- end
- END
+ define_method(element.downcase, m)
end
+ end
+ instance_method(:nO_element_def).tap do |m|
# O O or - O
for element in %w[ HTML HEAD BODY P PLAINTEXT DT DD LI OPTION TR
TH TD ]
- methods << <<-BEGIN + nO_element_def(element) + <<-END
- def #{element.downcase}(attributes = {})
- BEGIN
- end
- END
+ define_method(element.downcase, m)
end
- eval(methods)
end
end # Html3
@@ -887,49 +858,38 @@ class CGI
# Mixin module for HTML version 4 generation methods.
module Html4 # :nodoc:
+ include TagMaker
# The DOCTYPE declaration for this version of HTML
def doctype
%|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">|
end
- # Initialise the HTML generation methods for this version.
- def element_init
- extend TagMaker
- return if defined?(html)
- methods = ""
- # - -
+ # Initialize 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
VAR CITE ABBR ACRONYM SUB SUP SPAN BDO ADDRESS DIV MAP OBJECT
H1 H2 H3 H4 H5 H6 PRE Q INS DEL DL OL UL LABEL SELECT OPTGROUP
FIELDSET LEGEND BUTTON TABLE TITLE STYLE SCRIPT NOSCRIPT
TEXTAREA FORM A BLOCKQUOTE CAPTION ]
- methods << <<-BEGIN + nn_element_def(element) + <<-END
- def #{element.downcase}(attributes = {})
- BEGIN
- end
- END
+ define_method(element.downcase, m)
end
+ end
- # - O EMPTY
+ # - O EMPTY
+ instance_method(:nOE_element_def).tap do |m|
for element in %w[ IMG BASE BR AREA LINK PARAM HR INPUT COL META ]
- methods << <<-BEGIN + nOE_element_def(element) + <<-END
- def #{element.downcase}(attributes = {})
- BEGIN
- end
- END
+ define_method(element.downcase, m)
end
+ end
- # O O or - O
+ # O O or - O
+ instance_method(:nO_element_def).tap do |m|
for element in %w[ HTML BODY P DT DD LI OPTION THEAD TFOOT TBODY
COLGROUP TR TH TD HEAD ]
- methods << <<-BEGIN + nO_element_def(element) + <<-END
- def #{element.downcase}(attributes = {})
- BEGIN
- end
- END
+ define_method(element.downcase, m)
end
- eval(methods)
end
end # Html4
@@ -937,6 +897,7 @@ class CGI
# Mixin module for HTML version 4 transitional generation methods.
module Html4Tr # :nodoc:
+ include TagMaker
# The DOCTYPE declaration for this version of HTML
def doctype
@@ -944,44 +905,32 @@ class CGI
end
# Initialise the HTML generation methods for this version.
- def element_init
- extend TagMaker
- return if defined?(html)
- methods = ""
- # - -
+ # - -
+ instance_method(:nn_element_def).tap do |m|
for element in %w[ TT I B U S STRIKE BIG SMALL EM STRONG DFN
CODE SAMP KBD VAR CITE ABBR ACRONYM FONT SUB SUP SPAN BDO
ADDRESS DIV CENTER MAP OBJECT APPLET H1 H2 H3 H4 H5 H6 PRE Q
INS DEL DL OL UL DIR MENU LABEL SELECT OPTGROUP FIELDSET
LEGEND BUTTON TABLE IFRAME NOFRAMES TITLE STYLE SCRIPT
NOSCRIPT TEXTAREA FORM A BLOCKQUOTE CAPTION ]
- methods << <<-BEGIN + nn_element_def(element) + <<-END
- def #{element.downcase}(attributes = {})
- BEGIN
- end
- END
+ define_method(element.downcase, m)
end
+ end
- # - O EMPTY
+ # - O EMPTY
+ instance_method(:nOE_element_def).tap do |m|
for element in %w[ IMG BASE BASEFONT BR AREA LINK PARAM HR INPUT
COL ISINDEX META ]
- methods << <<-BEGIN + nOE_element_def(element) + <<-END
- def #{element.downcase}(attributes = {})
- BEGIN
- end
- END
+ define_method(element.downcase, m)
end
+ end
- # O O or - O
+ # O O or - O
+ instance_method(:nO_element_def).tap do |m|
for element in %w[ HTML BODY P DT DD LI OPTION THEAD TFOOT TBODY
COLGROUP TR TH TD HEAD ]
- methods << <<-BEGIN + nO_element_def(element) + <<-END
- def #{element.downcase}(attributes = {})
- BEGIN
- end
- END
+ define_method(element.downcase, m)
end
- eval(methods)
end
end # Html4Tr
@@ -989,6 +938,7 @@ class CGI
# Mixin module for generating HTML version 4 with framesets.
module Html4Fr # :nodoc:
+ include TagMaker
# The DOCTYPE declaration for this version of HTML
def doctype
@@ -996,27 +946,18 @@ class CGI
end
# Initialise the HTML generation methods for this version.
- def element_init
- return if defined?(frameset)
- methods = ""
- # - -
+ # - -
+ instance_method(:nn_element_def).tap do |m|
for element in %w[ FRAMESET ]
- methods << <<-BEGIN + nn_element_def(element) + <<-END
- def #{element.downcase}(attributes = {})
- BEGIN
- end
- END
+ define_method(element.downcase, m)
end
+ end
- # - O EMPTY
+ # - O EMPTY
+ instance_method(:nOE_element_def).tap do |m|
for element in %w[ FRAME ]
- methods << <<-BEGIN + nOE_element_def(element) + <<-END
- def #{element.downcase}(attributes = {})
- BEGIN
- end
- END
+ define_method(element.downcase, m)
end
- eval(methods)
end
end # Html4Fr
@@ -1024,6 +965,7 @@ class CGI
# Mixin module for HTML version 5 generation methods.
module Html5 # :nodoc:
+ include TagMaker
# The DOCTYPE declaration for this version of HTML
def doctype
@@ -1031,11 +973,8 @@ class CGI
end
# Initialise the HTML generation methods for this version.
- def element_init
- extend TagMaker
- return if defined?(html)
- methods = ""
- # - -
+ # - -
+ instance_method(:nn_element_def).tap do |m|
for element in %w[ SECTION NAV ARTICLE ASIDE HGROUP HEADER
FOOTER FIGURE FIGCAPTION S TIME U MARK RUBY BDI IFRAME
VIDEO AUDIO CANVAS DATALIST OUTPUT PROGRESS METER DETAILS
@@ -1044,34 +983,52 @@ class CGI
H1 H2 H3 H4 H5 H6 PRE Q INS DEL DL OL UL LABEL SELECT
FIELDSET LEGEND BUTTON TABLE TITLE STYLE SCRIPT NOSCRIPT
TEXTAREA FORM A BLOCKQUOTE CAPTION ]
- methods += <<-BEGIN + nn_element_def(element) + <<-END
- def #{element.downcase}(attributes = {})
- BEGIN
- end
- END
+ define_method(element.downcase, m)
end
+ end
- # - O EMPTY
+ # - O EMPTY
+ instance_method(:nOE_element_def).tap do |m|
for element in %w[ IMG BASE BR AREA LINK PARAM HR INPUT COL META
COMMAND EMBED KEYGEN SOURCE TRACK WBR ]
- methods += <<-BEGIN + nOE_element_def(element) + <<-END
- def #{element.downcase}(attributes = {})
- BEGIN
- end
- END
+ define_method(element.downcase, m)
end
+ end
- # O O or - O
+ # O O or - O
+ instance_method(:nO_element_def).tap do |m|
for element in %w[ HTML HEAD BODY P DT DD LI OPTION THEAD TFOOT TBODY
OPTGROUP COLGROUP RT RP TR TH TD ]
- methods += <<-BEGIN + nO_element_def(element) + <<-END
- def #{element.downcase}(attributes = {})
- BEGIN
- end
- END
+ define_method(element.downcase, m)
end
- eval(methods)
end
end # Html5
+
+ class HTML3
+ include Html3
+ include HtmlExtension
+ end
+
+ class HTML4
+ include Html4
+ include HtmlExtension
+ end
+
+ class HTML4Tr
+ include Html4Tr
+ include HtmlExtension
+ end
+
+ class HTML4Fr
+ include Html4Tr
+ include Html4Fr
+ include HtmlExtension
+ end
+
+ class HTML5
+ include Html5
+ include HtmlExtension
+ end
+
end
diff --git a/lib/cgi/session.rb b/lib/cgi/session.rb
index 2bdc94606d..63c5003526 100644
--- a/lib/cgi/session.rb
+++ b/lib/cgi/session.rb
@@ -62,7 +62,7 @@ class CGI
# works with String data. This is the default
# storage type.
# CGI::Session::MemoryStore:: stores data in an in-memory hash. The data
- # only persists for as long as the current ruby
+ # only persists for as long as the current Ruby
# interpreter instance does.
# CGI::Session::PStore:: stores data in Marshalled format. Provided by
# cgi/session/pstore.rb. Supports data of any type,
@@ -437,14 +437,14 @@ class CGI
def delete
File::unlink @path+".lock" rescue nil
File::unlink @path+".new" rescue nil
- File::unlink @path rescue Errno::ENOENT
+ File::unlink @path rescue nil
end
end
# In-memory session storage class.
#
# Implements session storage as a global in-memory hash. Session
- # data will only persist for as long as the ruby interpreter
+ # data will only persist for as long as the Ruby interpreter
# instance does.
class MemoryStore
GLOBAL_HASH_TABLE = {} #:nodoc:
@@ -453,7 +453,7 @@ class CGI
#
# +session+ is the session this instance is associated with.
# +option+ is a list of initialisation options. None are
- # currently recognised.
+ # currently recognized.
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 a63d7d3984..75343149e1 100644
--- a/lib/cgi/session/pstore.rb
+++ b/lib/cgi/session/pstore.rb
@@ -97,15 +97,4 @@ class CGI
end
end
end
-
-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
+# :enddoc:
diff --git a/lib/cgi/util.rb b/lib/cgi/util.rb
index 0959f0f094..3d7db8f2c8 100644
--- a/lib/cgi/util.rb
+++ b/lib/cgi/util.rb
@@ -1,21 +1,22 @@
-class CGI
+class CGI; module Util; end; extend Util; end
+module CGI::Util
@@accept_charset="UTF-8" unless defined?(@@accept_charset)
# URL-encode a string.
# url_encoded_string = CGI::escape("'Stop!' said Fred")
# # => "%27Stop%21%27+said+Fred"
- def CGI::escape(string)
+ def escape(string)
encoding = string.encoding
- string.dup.force_encoding('ASCII-8BIT').gsub(/([^ a-zA-Z0-9_.-]+)/) do
- '%' + $1.unpack('H2' * $1.bytesize).join('%').upcase
+ string.b.gsub(/([^ a-zA-Z0-9_.-]+)/) do |m|
+ '%' + m.unpack('H2' * m.bytesize).join('%').upcase
end.tr(' ', '+').force_encoding(encoding)
end
# URL-decode a string with encoding(optional).
# string = CGI::unescape("%27Stop%21%27+said+Fred")
# # => "'Stop!' said Fred"
- def CGI::unescape(string,encoding=@@accept_charset)
- str=string.tr('+', ' ').force_encoding(Encoding::ASCII_8BIT).gsub(/((?:%[0-9a-fA-F]{2})+)/) do
- [$1.delete('%')].pack('H*')
+ def unescape(string,encoding=@@accept_charset)
+ str=string.tr('+', ' ').b.gsub(/((?:%[0-9a-fA-F]{2})+)/) do |m|
+ [m.delete('%')].pack('H*')
end.force_encoding(encoding)
str.valid_encoding? ? str : str.force_encoding(string.encoding)
end
@@ -32,18 +33,19 @@ class CGI
# Escape special characters in HTML, namely &\"<>
# CGI::escapeHTML('Usage: foo "bar" <baz>')
# # => "Usage: foo &quot;bar&quot; &lt;baz&gt;"
- def CGI::escapeHTML(string)
+ def escapeHTML(string)
string.gsub(/['&\"<>]/, TABLE_FOR_ESCAPE_HTML__)
end
# Unescape a string that has been HTML-escaped
# CGI::unescapeHTML("Usage: foo &quot;bar&quot; &lt;baz&gt;")
# # => "Usage: foo \"bar\" <baz>"
- def CGI::unescapeHTML(string)
+ def unescapeHTML(string)
+ return string unless string.include? '&'
enc = string.encoding
- if [Encoding::UTF_16BE, Encoding::UTF_16LE, Encoding::UTF_32BE, Encoding::UTF_32LE].include?(enc)
+ if enc != Encoding::UTF_8 && [Encoding::UTF_16BE, Encoding::UTF_16LE, Encoding::UTF_32BE, Encoding::UTF_32LE].include?(enc)
return string.gsub(Regexp.new('&(apos|amp|quot|gt|lt|#[0-9]+|#x[0-9A-Fa-f]+);'.encode(enc))) do
- case $1.encode("US-ASCII")
+ case $1.encode(Encoding::US_ASCII)
when 'apos' then "'".encode(enc)
when 'amp' then '&'.encode(enc)
when 'quot' then '"'.encode(enc)
@@ -88,14 +90,10 @@ class CGI
end
# Synonym for CGI::escapeHTML(str)
- def CGI::escape_html(str)
- escapeHTML(str)
- end
+ alias escape_html escapeHTML
# Synonym for CGI::unescapeHTML(str)
- def CGI::unescape_html(str)
- unescapeHTML(str)
- end
+ alias unescape_html unescapeHTML
# Escape only the tags of certain HTML elements in +string+.
#
@@ -110,7 +108,7 @@ class CGI
#
# print CGI::escapeElement('<BR><A HREF="url"></A>', ["A", "IMG"])
# # "<BR>&lt;A HREF=&quot;url&quot;&gt;&lt;/A&gt"
- def CGI::escapeElement(string, *elements)
+ def escapeElement(string, *elements)
elements = elements[0] if elements[0].kind_of?(Array)
unless elements.empty?
string.gsub(/<\/?(?:#{elements.join("|")})(?!\w)(?:.|\n)*?>/i) do
@@ -130,11 +128,11 @@ class CGI
# print CGI::unescapeElement(
# CGI::escapeHTML('<BR><A HREF="url"></A>'), ["A", "IMG"])
# # "&lt;BR&gt;<A HREF="url"></A>"
- def CGI::unescapeElement(string, *elements)
+ def unescapeElement(string, *elements)
elements = elements[0] if elements[0].kind_of?(Array)
unless elements.empty?
string.gsub(/&lt;\/?(?:#{elements.join("|")})(?!\w)(?:.|\n)*?&gt;/i) do
- CGI::unescapeHTML($&)
+ unescapeHTML($&)
end
else
string
@@ -142,14 +140,10 @@ class CGI
end
# Synonym for CGI::escapeElement(str)
- def CGI::escape_element(str)
- escapeElement(str)
- end
+ alias escape_element escapeElement
# Synonym for CGI::unescapeElement(str)
- def CGI::unescape_element(str)
- unescapeElement(str)
- end
+ alias unescape_element unescapeElement
# Abbreviated day-of-week names specified by RFC 822
RFC822_DAYS = %w[ Sun Mon Tue Wed Thu Fri Sat ]
@@ -161,11 +155,11 @@ class CGI
#
# CGI::rfc1123_date(Time.now)
# # Sat, 01 Jan 2000 00:00:00 GMT
- def CGI::rfc1123_date(time)
+ def rfc1123_date(time)
t = time.clone.gmtime
return format("%s, %.2d %s %.4d %.2d:%.2d:%.2d GMT",
- RFC822_DAYS[t.wday], t.day, RFC822_MONTHS[t.month-1], t.year,
- t.hour, t.min, t.sec)
+ RFC822_DAYS[t.wday], t.day, RFC822_MONTHS[t.month-1], t.year,
+ t.hour, t.min, t.sec)
end
# Prettify (indent) an HTML string.
@@ -185,7 +179,7 @@ class CGI
# # </BODY>
# # </HTML>
#
- def CGI::pretty(string, shift = " ")
+ def pretty(string, shift = " ")
lines = string.gsub(/(?!\A)<.*?>/m, "\n\\0").gsub(/<.*?>(?!\n)/m, "\\0\n")
end_pos = 0
while end_pos = lines.index(/^<\/(\w+)/, end_pos)
@@ -195,4 +189,6 @@ class CGI
end
lines.gsub(/^((?:#{Regexp::quote(shift)})*)__(?=<\/?\w)/, '\1')
end
+
+ alias h escapeHTML
end
diff --git a/lib/cmath.rb b/lib/cmath.rb
index d613a3f6f9..aee577c97c 100644
--- a/lib/cmath.rb
+++ b/lib/cmath.rb
@@ -1,6 +1,4 @@
##
-# = CMath
-#
# CMath is a library that provides trigonometric and transcendental
# functions for complex numbers.
#
@@ -52,11 +50,11 @@ module CMath
def exp(z)
begin
if z.real?
- exp!(z)
+ exp!(z)
else
- ere = exp!(z.real)
- Complex(ere * cos!(z.imag),
- ere * sin!(z.imag))
+ ere = exp!(z.real)
+ Complex(ere * cos!(z.imag),
+ ere * sin!(z.imag))
end
rescue NoMethodError
handle_no_method_error
@@ -72,14 +70,14 @@ module CMath
begin
z, b = args
unless b.nil? || b.kind_of?(Numeric)
- raise TypeError, "Numeric Number required"
+ raise TypeError, "Numeric Number required"
end
if z.real? and z >= 0 and (b.nil? or b >= 0)
- log!(*args)
+ log!(*args)
else
- a = Complex(log!(z.abs), z.arg)
- if b
- a /= log(b)
+ a = Complex(log!(z.abs), z.arg)
+ if b
+ a /= log(b)
end
a
end
@@ -93,9 +91,9 @@ module CMath
def log2(z)
begin
if z.real? and z >= 0
- log2!(z)
+ log2!(z)
else
- log(z) / log!(2)
+ log(z) / log!(2)
end
rescue NoMethodError
handle_no_method_error
@@ -107,9 +105,9 @@ module CMath
def log10(z)
begin
if z.real? and z >= 0
- log10!(z)
+ log10!(z)
else
- log(z) / log!(10)
+ log(z) / log!(10)
end
rescue NoMethodError
handle_no_method_error
@@ -124,20 +122,20 @@ module CMath
def sqrt(z)
begin
if z.real?
- if z < 0
- Complex(0, sqrt!(-z))
- else
- 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(sqrt!((r + x) / 2.0), 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
@@ -155,10 +153,10 @@ module CMath
def sin(z)
begin
if z.real?
- sin!(z)
+ sin!(z)
else
- Complex(sin!(z.real) * cosh!(z.imag),
- cos!(z.real) * sinh!(z.imag))
+ Complex(sin!(z.real) * cosh!(z.imag),
+ cos!(z.real) * sinh!(z.imag))
end
rescue NoMethodError
handle_no_method_error
@@ -170,10 +168,10 @@ module CMath
def cos(z)
begin
if z.real?
- cos!(z)
+ cos!(z)
else
- Complex(cos!(z.real) * cosh!(z.imag),
- -sin!(z.real) * sinh!(z.imag))
+ Complex(cos!(z.real) * cosh!(z.imag),
+ -sin!(z.real) * sinh!(z.imag))
end
rescue NoMethodError
handle_no_method_error
@@ -185,9 +183,9 @@ module CMath
def tan(z)
begin
if z.real?
- tan!(z)
+ tan!(z)
else
- sin(z) / cos(z)
+ sin(z) / cos(z)
end
rescue NoMethodError
handle_no_method_error
@@ -199,10 +197,10 @@ module CMath
def sinh(z)
begin
if z.real?
- sinh!(z)
+ sinh!(z)
else
- Complex(sinh!(z.real) * cos!(z.imag),
- cosh!(z.real) * sin!(z.imag))
+ Complex(sinh!(z.real) * cos!(z.imag),
+ cosh!(z.real) * sin!(z.imag))
end
rescue NoMethodError
handle_no_method_error
@@ -214,10 +212,10 @@ module CMath
def cosh(z)
begin
if z.real?
- cosh!(z)
+ cosh!(z)
else
- Complex(cosh!(z.real) * cos!(z.imag),
- sinh!(z.real) * sin!(z.imag))
+ Complex(cosh!(z.real) * cos!(z.imag),
+ sinh!(z.real) * sin!(z.imag))
end
rescue NoMethodError
handle_no_method_error
@@ -229,9 +227,9 @@ module CMath
def tanh(z)
begin
if z.real?
- tanh!(z)
+ tanh!(z)
else
- sinh(z) / cosh(z)
+ sinh(z) / cosh(z)
end
rescue NoMethodError
handle_no_method_error
@@ -243,9 +241,9 @@ module CMath
def asin(z)
begin
if z.real? and z >= -1 and z <= 1
- 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
@@ -257,9 +255,9 @@ module CMath
def acos(z)
begin
if z.real? and z >= -1 and z <= 1
- 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
@@ -271,9 +269,9 @@ module CMath
def atan(z)
begin
if z.real?
- 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
@@ -286,9 +284,9 @@ module CMath
def atan2(y,x)
begin
if y.real? and x.real?
- 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
@@ -300,9 +298,9 @@ module CMath
def asinh(z)
begin
if z.real?
- 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
@@ -314,9 +312,9 @@ module CMath
def acosh(z)
begin
if z.real? and z >= 1
- 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
@@ -328,9 +326,9 @@ module CMath
def atanh(z)
begin
if z.real? and z >= -1 and z <= 1
- 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
diff --git a/lib/complex.rb b/lib/complex.rb
deleted file mode 100644
index 9c57ecdf7a..0000000000
--- a/lib/complex.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-# :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 fe153153be..60b22e76ba 100644
--- a/lib/csv.rb
+++ b/lib/csv.rb
@@ -235,6 +235,7 @@ 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
@@ -277,7 +278,7 @@ 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 occurrs on or later
+ # When provided, +offset+ ensures that a header match occurs on or later
# than the +offset+ index. You can use this to find duplicate headers,
# without resorting to hard-coding exact indices.
#
@@ -811,7 +812,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, interation will +yield+ two element
+ # walking of rows. In column mode, iteration will +yield+ two element
# tuples containing the column name and an Array of values for that column.
#
# This method returns the table for chaining.
@@ -834,7 +835,7 @@ class CSV
#
# In the default mixed mode or row mode, iteration is the standard row major
- # walking of rows. In column mode, interation will +yield+ two element
+ # walking of rows. In column mode, iteration will +yield+ two element
# tuples containing the column name and an Array of values for that column.
#
# This method returns the table for chaining.
@@ -982,7 +983,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 intetionally left unfrozen and users should feel free to add
+ # This Hash is intentionally 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
@@ -991,8 +992,8 @@ class CSV
HeaderConverters = {
downcase: lambda { |h| h.encode(ConverterEncoding).downcase },
symbol: lambda { |h|
- h.encode(ConverterEncoding).downcase.gsub(/\s+/, "_").
- gsub(/\W+/, "").to_sym
+ h.encode(ConverterEncoding).downcase.strip.gsub(/\s+/, "_").
+ gsub(/\W+/, "").to_sym
}
}
@@ -1116,6 +1117,7 @@ class CSV
# but transcode it to UTF-8 before CSV parses it.
#
def self.foreach(path, options = Hash.new, &block)
+ return to_enum(__method__, path, options) unless block
open(path, options) do |csv|
csv.each(&block)
end
@@ -1131,7 +1133,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* modfied by this method. Call dup() before
+ # Note that a passed String *is* modified by this method. Call dup() before
# passing if you need a new String.
#
# The +options+ parameter can be anything CSV::new() understands. This method
@@ -1146,9 +1148,9 @@ class CSV
io.seek(0, IO::SEEK_END)
args.unshift(io)
else
- encoding = (args[-1] = args[-1].dup).delete(:encoding) if args.last.is_a?(Hash)
+ encoding = args[-1][:encoding] if args.last.is_a?(Hash)
str = ""
- str.encode!(encoding) if encoding
+ str.force_encoding(encoding) if encoding
args.unshift(str)
end
csv = new(*args) # wrap
@@ -1258,7 +1260,12 @@ class CSV
file_opts = {encoding: Encoding.default_external}.merge(file_opts)
retry
end
- csv = new(f, options)
+ begin
+ csv = new(f, options)
+ rescue Exception
+ f.close
+ raise
+ end
# handle blocks like Ruby's open(), not like the CSV library
if block_given?
@@ -1299,8 +1306,8 @@ class CSV
#
# This method is a shortcut for converting a single line of a CSV String into
- # a into an Array. Note that if +line+ contains multiple rows, anything
- # beyond the first row is ignored.
+ # an Array. Note that if +line+ contains multiple rows, anything beyond the
+ # first row is ignored.
#
# The +options+ parameter can be anything CSV::new() understands.
#
@@ -1394,7 +1401,7 @@ class CSV
# <tt>'</tt> as the quote character
# instead of the correct <tt>"</tt>.
# CSV will always consider a double
- # sequence this character to be an
+ # sequence of this character to be an
# escaped quote. This String will be
# transcoded into the data's Encoding
# before parsing.
@@ -1469,11 +1476,12 @@ class CSV
# <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 +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 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.
#
# See CSV::DEFAULT_OPTIONS for the default settings.
#
@@ -1481,6 +1489,10 @@ 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)
@@ -1504,8 +1516,7 @@ class CSV
# if we can transcode the needed characters
#
@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{""})}/
+ @re_chars = /#{%"[-\\]\\[\\.^$?*+{}()|# \r\n\t\f\v]".encode(@encoding)}/
init_separators(options)
init_parsers(options)
@@ -1513,7 +1524,7 @@ class CSV
init_headers(options)
init_comments(options)
- options.delete(:encoding)
+ @force_encoding = !!(encoding || options.delete(:encoding))
options.delete(:internal_encoding)
options.delete(:external_encoding)
unless options.empty?
@@ -1653,10 +1664,13 @@ class CSV
output = row.map(&@quote).join(@col_sep) + @row_sep # quote and separate
if @io.is_a?(StringIO) and
- output.encoding != raw_encoding and
- (compatible_encoding = Encoding.compatible?(@io.string, output))
- @io = StringIO.new(@io.string.force_encoding(compatible_encoding))
- @io.seek(0, IO::SEEK_END)
+ 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
end
@io << output
@@ -1966,7 +1980,7 @@ class CSV
else
begin
#
- # remember where we were (pos() will raise an axception if @io is pipe
+ # remember where we were (pos() will raise an exception if @io is pipe
# or not opened for reading)
#
saved_pos = @io.pos
@@ -2119,10 +2133,12 @@ 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
@@ -2164,13 +2180,14 @@ 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-curcuit pipeline for speed
+ break unless field.is_a? String # short-circuit pipeline for speed
end
field # final state of each field, converted or original
end
@@ -2204,6 +2221,7 @@ 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 40886b14a6..fcbf849f0d 100644
--- a/lib/debug.rb
+++ b/lib/debug.rb
@@ -752,9 +752,18 @@ EOHELP
(id ? ":in `#{id.id2name}'" : "")
end
+ def script_lines(file, line)
+ unless (lines = SCRIPT_LINES__[file]) and lines != true
+ Tracer::Single.get_line(file, line) if File.exist?(file)
+ lines = SCRIPT_LINES__[file]
+ lines = nil if lines == true
+ end
+ lines
+ end
+
def display_list(b, e, file, line)
- stdout.printf "[%d, %d] in %s\n", b, e, file
- if lines = SCRIPT_LINES__[file] and lines != true
+ if lines = script_lines(file, line)
+ stdout.printf "[%d, %d] in %s\n", b, e, file
b.upto(e) do |n|
if n > 0 && lines[n-1]
if n == line
@@ -770,11 +779,8 @@ EOHELP
end
def line_at(file, line)
- lines = SCRIPT_LINES__[file]
- if lines
- return "\n" if lines == true
- line = lines[line-1]
- return "\n" unless line
+ lines = script_lines(file, line)
+ if lines and line = lines[line-1]
return line
end
return "\n"
@@ -910,7 +916,7 @@ EOHELP
# Returns the list of break points where execution will be stopped.
#
- # See DEBUGGER__ for more useage
+ # See DEBUGGER__ for more usage
def break_points
@break_points
end
diff --git a/lib/delegate.rb b/lib/delegate.rb
index e46e4f8c23..f2b1388107 100644
--- a/lib/delegate.rb
+++ b/lib/delegate.rb
@@ -43,9 +43,16 @@
class Delegator < BasicObject
kernel = ::Kernel.dup
kernel.class_eval do
+ alias __raise__ raise
[:to_s,:inspect,:=~,:!~,:===,:<=>,:eql?,:hash].each do |m|
undef_method m
end
+ private_instance_methods.each do |m|
+ if /\Ablock_given\?\z|iterator\?\z|\A__.*__\z/ =~ m
+ next
+ end
+ undef_method m
+ end
end
include kernel
@@ -55,6 +62,12 @@ 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.
@@ -67,11 +80,18 @@ class Delegator < BasicObject
# Handles the magic of delegation through \_\_getobj\_\_.
#
def method_missing(m, *args, &block)
- target = self.__getobj__
+ r = true
+ target = self.__getobj__ {r = false}
begin
- target.respond_to?(m) ? target.__send__(m, *args, &block) : super(m, *args, &block)
+ 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)
+ end
ensure
- $@.delete_if {|t| %r"\A#{Regexp.quote(__FILE__)}:#{__LINE__-2}:"o =~ t} if $@
+ $@.delete_if {|t| %r"\A#{Regexp.quote(__FILE__)}:(?:#{[__LINE__-7, __LINE__-5, __LINE__-3].join('|')}):"o =~ t} if $@
end
end
@@ -80,8 +100,10 @@ class Delegator < BasicObject
# call through \_\_getobj\_\_.
#
def respond_to_missing?(m, include_private)
- r = self.__getobj__.respond_to?(m, include_private)
- if r && include_private && !self.__getobj__.respond_to?(m, false)
+ r = true
+ target = self.__getobj__ {r = false}
+ r &&= target.respond_to?(m, include_private)
+ if r && include_private && !target.respond_to?(m, false)
warn "#{caller(3)[0]}: delegator does not forward private method \##{m}"
return false
end
@@ -142,7 +164,7 @@ class Delegator < BasicObject
# method calls are being delegated to.
#
def __getobj__
- raise NotImplementedError, "need to define `__getobj__'"
+ __raise__ ::NotImplementedError, "need to define `__getobj__'"
end
#
@@ -150,7 +172,7 @@ class Delegator < BasicObject
# to _obj_.
#
def __setobj__(obj)
- raise NotImplementedError, "need to define `__setobj__'"
+ __raise__ ::NotImplementedError, "need to define `__setobj__'"
end
#
@@ -230,6 +252,34 @@ end
# and even to change the object being delegated to at a later time with
# #__setobj__.
#
+# class User
+# def born_on
+# Date.new(1989, 9, 10)
+# end
+# end
+#
+# class UserDecorator < SimpleDelegator
+# def birth_year
+# born_on.year
+# end
+# end
+#
+# decorated_user = UserDecorator.new(User.new)
+# decorated_user.birth_year #=> 1989
+# decorated_user.__getobj__ #=> #<User: ...>
+#
+# A SimpleDelegator instance can take advantage of the fact that SimpleDelegator
+# is a subclass of +Delegator+ to call <tt>super</tt> to have methods called on
+# the object being delegated to.
+#
+# class SuperArray < SimpleDelegator
+# def [](*args)
+# super + 1
+# end
+# end
+#
+# SuperArray.new([1])[0] #=> 2
+#
# Here's a simple example that takes advantage of the fact that
# SimpleDelegator's delegation object can be changed at any time.
#
@@ -265,6 +315,10 @@ 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
@delegate_sd_obj
end
@@ -283,7 +337,7 @@ class SimpleDelegator<Delegator
# puts names[1] # => Sinclair
#
def __setobj__(obj)
- raise ArgumentError, "cannot delegate to self" if self.equal?(obj)
+ __raise__ ::ArgumentError, "cannot delegate to self" if self.equal?(obj)
@delegate_sd_obj = obj
end
end
@@ -339,10 +393,14 @@ 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
@delegate_dc_obj
end
def __setobj__(obj) # :nodoc:
- raise ArgumentError, "cannot delegate to self" if self.equal?(obj)
+ __raise__ ::ArgumentError, "cannot delegate to self" if self.equal?(obj)
@delegate_dc_obj = obj
end
methods.each do |method|
@@ -357,37 +415,3 @@ 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/acl.rb b/lib/drb/acl.rb
index 29a378199f..72e034e960 100644
--- a/lib/drb/acl.rb
+++ b/lib/drb/acl.rb
@@ -223,28 +223,10 @@ class ACL
when 'deny'
@deny.add(domain)
else
- raise "Invalid ACL entry #{list.to_s}"
+ raise "Invalid ACL entry #{list}"
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 8e03cdcde1..26f39b789f 100644
--- a/lib/drb/drb.rb
+++ b/lib/drb/drb.rb
@@ -177,6 +177,9 @@ 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)
@@ -231,7 +234,7 @@ require 'drb/eq'
# def get_logger(name)
# if !@loggers.has_key? name
# # make the filename safe, then declare it to be so
-# fname = name.gsub(/[.\/]/, "_").untaint
+# fname = name.gsub(/[.\/\\\:]/, "_").untaint
# @loggers[name] = Logger.new(name, @basedir + "/" + fname)
# end
# return @loggers[name]
@@ -992,7 +995,7 @@ module DRb
def initialize(option)
@option = option.to_s
end
- attr :option
+ attr_reader :option
def to_s; @option; end
def ==(other)
@@ -1591,16 +1594,9 @@ module DRb
end
- if RUBY_VERSION >= '1.8'
- require 'drb/invokemethod'
- class InvokeMethod
- include InvokeMethod18Mixin
- end
- else
- require 'drb/invokemethod16'
- class InvokeMethod
- include InvokeMethod16Mixin
- end
+ require 'drb/invokemethod'
+ class InvokeMethod
+ include InvokeMethod18Mixin
end
# The main loop performed by a DRbServer's internal thread.
diff --git a/lib/drb/extserv.rb b/lib/drb/extserv.rb
index c70ced877c..327b553a25 100644
--- a/lib/drb/extserv.rb
+++ b/lib/drb/extserv.rb
@@ -41,33 +41,3 @@ 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/invokemethod.rb b/lib/drb/invokemethod.rb
index d11feabcb8..71ebec11f6 100644
--- a/lib/drb/invokemethod.rb
+++ b/lib/drb/invokemethod.rb
@@ -1,8 +1,8 @@
# for ruby-1.8.0
-module DRb
+module DRb # :nodoc: all
class DRbServer
- module InvokeMethod18Mixin # :nodoc: all
+ module InvokeMethod18Mixin
def block_yield(x)
if x.size == 1 && x[0].class == Array
x[0] = DRbArray.new(x[0])
diff --git a/lib/drb/ssl.rb b/lib/drb/ssl.rb
index 8651702797..dd4df4e129 100644
--- a/lib/drb/ssl.rb
+++ b/lib/drb/ssl.rb
@@ -42,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 SSLConfg, and will setup the certificate for its session for the
+ # of SSLConfig, 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
#
@@ -299,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 currenly established
+ # +is_established+ is a boolean of whether +soc+ is currently established
#
# This is called automatically based on the DRb protocol.
def initialize(uri, soc, config, is_established)
@@ -327,9 +327,10 @@ module DRb
soc.close
end
begin
- ssl = @config.accept(soc)
- ensure
- soc.close if $!
+ ssl = @config.accept(soc)
+ rescue Exception
+ soc.close
+ raise
end
self.class.new(uri, ssl, @config, true)
rescue OpenSSL::SSL::SSLError
diff --git a/lib/e2mmap.rb b/lib/e2mmap.rb
index 18a7ca003d..1eb5b51678 100644
--- a/lib/e2mmap.rb
+++ b/lib/e2mmap.rb
@@ -1,13 +1,17 @@
#
-# e2mmap.rb - for ruby 1.1
+#--
+# e2mmap.rb - for Ruby 1.1
# $Release Version: 2.0$
# $Revision: 1.10 $
# by Keiju ISHITSUKA
#
-# --
-# Usage:
+#++
#
-# U1)
+# Helper module for easily defining exceptions with predefined messages.
+#
+# == Usage
+#
+# 1.
# class Foo
# extend Exception2MessageMapper
# def_e2message ExistingExceptionClass, "message..."
@@ -15,10 +19,10 @@
# ...
# end
#
-# U2)
+# 2.
# module Error
# extend Exception2MessageMapper
-# def_e2meggage ExistingExceptionClass, "message..."
+# def_e2message ExistingExceptionClass, "message..."
# def_exception :NewExceptionClass, "message..."[, superclass]
# ...
# end
@@ -30,7 +34,7 @@
# foo = Foo.new
# foo.Fail ....
#
-# U3)
+# 3.
# module Error
# extend Exception2MessageMapper
# def_e2message ExistingExceptionClass, "message..."
@@ -48,9 +52,8 @@
#
#
module Exception2MessageMapper
- @RCS_ID='-$Id: e2mmap.rb,v 1.10 1999/02/17 12:33:17 keiju Exp keiju $-'
- E2MM = Exception2MessageMapper
+ E2MM = Exception2MessageMapper # :nodoc:
def E2MM.extend_object(cl)
super
@@ -138,8 +141,6 @@ 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
@@ -153,7 +154,6 @@ 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
@@ -166,7 +166,7 @@ module Exception2MessageMapper
E2MM.def_exception(E2MM,
:ErrNotRegisteredException,
- "not registerd exception(%s)")
+ "not registered exception(%s)")
end
diff --git a/lib/erb.rb b/lib/erb.rb
index 51b128e3c5..c372f56da8 100644
--- a/lib/erb.rb
+++ b/lib/erb.rb
@@ -63,12 +63,12 @@ require "cgi/util"
#
# == Character encodings
#
-# ERB (or ruby code generated by ERB) returns a string in the same
+# ERB (or Ruby code generated by ERB) returns a string in the same
# character encoding as the input string. When the input string has
# 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
@@ -252,7 +252,8 @@ 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 the RAA.
+# * and others; search {RubyGems.org}[https://rubygems.org/] or
+# {The Ruby Toolbox}[https://www.ruby-toolbox.com/].
#
# Rails, the web application framework, uses ERB to create views.
#
@@ -547,7 +548,7 @@ class ERB
def initialize(compiler, enc=nil)
@compiler = compiler
@line = []
- @script = enc ? "#coding:#{enc.to_s}\n" : ""
+ @script = enc ? "#coding:#{enc}\n" : ""
@compiler.pre_cmd.each do |x|
push(x)
end
@@ -596,7 +597,7 @@ class ERB
def compile(s)
enc = s.encoding
raise ArgumentError, "#{enc} is not ASCII compatible" if enc.dummy?
- s = s.dup.force_encoding("ASCII-8BIT") # don't use constant Enoding::ASCII_8BIT for miniruby
+ s = s.b # see String#b
enc = detect_magic_comment(s) || enc
out = Buffer.new(self, enc)
@@ -716,7 +717,7 @@ class ERB
comment = $1 if comment[/-\*-\s*(.*?)\s*-*-$/]
if %r"coding\s*[=:]\s*([[:alnum:]\-_]+)" =~ comment
enc = $1.sub(/-(?:mac|dos|unix)/i, '')
- enc = Encoding.find(enc)
+ Encoding.find(enc)
end
end
end
@@ -836,7 +837,7 @@ 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 or Proc object which is used to set the context of
+ # _b_ accepts a Binding object which is used to set the context of
# code evaluation.
#
def result(b=new_toplevel)
@@ -859,7 +860,7 @@ class ERB
end
private :new_toplevel
- # Define _methodname_ as instance method of _mod_ from compiled ruby source.
+ # Define _methodname_ as instance method of _mod_ from compiled Ruby source.
#
# example:
# filename = 'example.rhtml' # 'arg1' and 'arg2' are used in example.rhtml
@@ -948,8 +949,8 @@ class ERB
# Programming%20Ruby%3A%20%20The%20Pragmatic%20Programmer%27s%20Guide
#
def url_encode(s)
- s.to_s.dup.force_encoding("ASCII-8BIT").gsub(/[^a-zA-Z0-9_\-.]/n) {
- sprintf("%%%02X", $&.unpack("C")[0])
+ s.to_s.b.gsub(/[^a-zA-Z0-9_\-.]/n) { |m|
+ sprintf("%%%02X", m.unpack("C")[0])
}
end
alias u url_encode
diff --git a/lib/fileutils.rb b/lib/fileutils.rb
index 10d8b25d1c..23fd19310a 100644
--- a/lib/fileutils.rb
+++ b/lib/fileutils.rb
@@ -12,35 +12,37 @@
#
# === Module Functions
#
-# 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)
+# 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)
#
# 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>.
@@ -53,15 +55,15 @@
#
# There are some `low level' methods, which do not accept any option:
#
-# 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)
+# 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)
#
# == module FileUtils::Verbose
#
@@ -136,7 +138,7 @@ module FileUtils
#
# Options: (none)
#
- # Returns true if +newer+ is newer than all +old_list+.
+ # Returns true if +new+ is newer than all +old_list+.
# Non-existent files are older than any file.
#
# FileUtils.uptodate?('hello.o', %w(hello.c hello.h)) or \
@@ -154,6 +156,11 @@ module FileUtils
end
module_function :uptodate?
+ def remove_tailing_slash(dir)
+ dir == '/' ? dir : dir.chomp(?/)
+ end
+ private_module_function :remove_tailing_slash
+
#
# Options: mode noop verbose
#
@@ -200,7 +207,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| path.chomp(?/) }.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]
@@ -237,7 +244,7 @@ module FileUtils
OPT_TABLE['makedirs'] = [:mode, :noop, :verbose]
def fu_mkdir(path, mode) #:nodoc:
- path = path.chomp(?/)
+ path = remove_tailing_slash(path)
if mode
Dir.mkdir path, mode
File.chmod mode, path
@@ -248,7 +255,7 @@ module FileUtils
private_module_function :fu_mkdir
#
- # Options: noop, verbose
+ # Options: parents, noop, verbose
#
# Removes one or more directories.
#
@@ -265,13 +272,14 @@ module FileUtils
return if options[:noop]
list.each do |dir|
begin
- Dir.rmdir(dir = dir.chomp(?/))
+ 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::ENOENT
+ rescue Errno::ENOTEMPTY, Errno::EEXIST, Errno::ENOENT
end
end
end
@@ -411,7 +419,7 @@ module FileUtils
#
# +src+ can be a list of files.
#
- # # Installing ruby library "mylib" under the site_ruby
+ # # Installing Ruby library "mylib" under the site_ruby
# FileUtils.rm_r site_ruby + '/mylib', :force
# FileUtils.cp_r 'lib/', site_ruby + '/mylib'
#
@@ -449,8 +457,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, permissions
- # and modified time.
+ # If +preserve+ is true, this method preserves owner, group, and
+ # modified time. Permissions are copied regardless +preserve+.
#
# If +dereference_root+ is true, this method dereference tree root.
#
@@ -848,7 +856,8 @@ 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|
+ fu_each_src_dest(src, dest) do |s, d|
+ st = File.stat(s)
unless File.exist?(d) and compare_file(s, d)
remove_file d, true
copy_file s, d
@@ -862,62 +871,78 @@ module FileUtils
OPT_TABLE['install'] = [:mode, :preserve, :noop, :verbose]
def user_mask(target) #:nodoc:
- mask = 0
- target.each_byte do |byte_chr|
- case byte_chr.chr
- when "u"
- mask |= 04700
- when "g"
- mask |= 02070
- when "o"
- mask |= 01007
- when "a"
- mask |= 07777
+ 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
- mask
end
private_module_function :user_mask
- def mode_mask(mode, path) #:nodoc:
- mask = 0
- mode.each_byte do |byte_chr|
- case byte_chr.chr
- when "r"
- mask |= 0444
- when "w"
- mask |= 0222
- when "x"
- mask |= 0111
- when "X"
- mask |= 0111 if FileTest::directory? path
- when "s"
- mask |= 06000
- when "t"
- mask |= 01000
- end
+ def apply_mask(mode, user_mask, op, mode_mask)
+ case op
+ when '='
+ (mode & ~user_mask) | (user_mask & mode_mask)
+ when '+'
+ mode | (user_mask & mode_mask)
+ when '-'
+ mode & ~(user_mask & mode_mask)
end
- mask
end
- private_module_function :mode_mask
+ private_module_function :apply_mask
- def symbolic_modes_to_i(modes, path) #:nodoc:
- current_mode = (File.stat(path).mode & 07777)
- modes.split(/,/).inject(0) do |mode, mode_sym|
- mode_sym = "a#{mode_sym}" if mode_sym =~ %r!^[=+-]!
- target, mode = mode_sym.split %r![=+-]!
+ def symbolic_modes_to_i(mode_sym, path) #:nodoc:
+ mode_sym.split(/,/).inject(File.stat(path).mode & 07777) do |current_mode, clause|
+ target, *actions = clause.split(/([=+-])/)
+ raise ArgumentError, "invalid file mode: #{mode_sym}" if actions.empty?
+ target = 'a' if target.empty?
user_mask = user_mask(target)
- mode_mask = mode_mask(mode ? mode : "", path)
-
- case mode_sym
- when /=/
- current_mode &= ~(user_mask)
- current_mode |= user_mask & mode_mask
- when /\+/
- current_mode |= user_mask & mode_mask
- when /-/
- current_mode &= ~(user_mask & mode_mask)
+ actions.each_slice(2) do |op, perm|
+ need_apply = op == '='
+ mode_mask = (perm || '').each_char.inject(0) do |mask, chr|
+ case chr
+ when "r"
+ mask | 0444
+ when "w"
+ mask | 0222
+ when "x"
+ mask | 0111
+ when "X"
+ if FileTest.directory? path
+ mask | 0111
+ else
+ mask
+ end
+ when "s"
+ mask | 06000
+ when "t"
+ mask | 01000
+ when "u", "g", "o"
+ if mask.nonzero?
+ current_mode = apply_mask(current_mode, user_mask, op, mask)
+ end
+ need_apply = false
+ copy_mask = user_mask(chr)
+ (current_mode & copy_mask) / (copy_mask & 0111) * (user_mask & 0111)
+ else
+ raise ArgumentError, "invalid `perm' symbol in file mode: #{chr}"
+ end
+ end
+
+ if mode_mask.nonzero? || need_apply
+ current_mode = apply_mask(current_mode, user_mask, op, mode_mask)
+ end
end
+ current_mode
end
end
private_module_function :symbolic_modes_to_i
@@ -1059,7 +1084,6 @@ module FileUtils
return if options[:noop]
uid = fu_get_uid(user)
gid = fu_get_gid(group)
- return unless uid or gid
list.each do |root|
Entry_.new(root).traverse do |ent|
begin
@@ -1076,49 +1100,37 @@ 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).uid
- 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).gid
- end
- end
- private_module_function :fu_get_gid
-
- rescue LoadError
- # need Win32 support???
-
- def fu_get_uid(user) #:nodoc:
- user # FIXME
+ 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
end
- private_module_function :fu_get_uid
-
- def fu_get_gid(group) #:nodoc:
- group # FIXME
+ 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
end
- private_module_function :fu_get_gid
end
+ private_module_function :fu_get_gid
#
- # Options: noop verbose
+ # Options: noop verbose mtime nocreate
#
# Updates modification time (mtime) and access time (atime) of file(s) in
# +list+. Files are created if they don't exist.
@@ -1129,7 +1141,7 @@ module FileUtils
def touch(list, options = {})
fu_check_options options, OPT_TABLE['touch']
list = fu_list(list)
- created = nocreate = options[:nocreate]
+ 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 ' '}"
@@ -1231,7 +1243,12 @@ module FileUtils
end
def exist?
- lstat! ? true : false
+ begin
+ lstat
+ true
+ rescue Errno::ENOENT
+ false
+ end
end
def file?
@@ -1341,7 +1358,7 @@ module FileUtils
when file?
copy_file dest
when directory?
- if !File.exist?(dest) and descendant_diretory?(dest, path)
+ if !File.exist?(dest) and descendant_directory?(dest, path)
raise ArgumentError, "cannot copy directory %s to itself %s" % [path, dest]
end
begin
@@ -1472,6 +1489,7 @@ module FileUtils
end
end
end
+ ensure
yield self
end
@@ -1536,7 +1554,7 @@ module FileUtils
end
SYSCASE = File::FNM_SYSCASE.nonzero? ? "-i" : ""
- def descendant_diretory?(descendant, ascendant)
+ def descendant_directory?(descendant, ascendant)
/\A(?#{SYSCASE}:#{Regexp.quote(ascendant)})#{DIRECTORY_TERM}/ =~ File.dirname(descendant)
end
end # class Entry_
@@ -1549,7 +1567,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, File.stat(s)
+ yield s, d
end
end
private_module_function :fu_each_src_dest
@@ -1628,7 +1646,7 @@ module FileUtils
#
# p FileUtils.have_option?(:cp, :noop) #=> true
# p FileUtils.have_option?(:rm, :force) #=> true
- # p FileUtils.have_option?(:rm, :perserve) #=> false
+ # p FileUtils.have_option?(:rm, :preserve) #=> false
#
def FileUtils.have_option?(mid, opt)
li = OPT_TABLE[mid.to_s] or raise ArgumentError, "no such method: #{mid}"
@@ -1638,7 +1656,7 @@ module FileUtils
#
# Returns an Array of option names of the method +mid+.
#
- # p FileUtils.options(:rm) #=> ["noop", "verbose", "force"]
+ # p FileUtils.options_of(: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 571609cdef..46e2512b9e 100644
--- a/lib/find.rb
+++ b/lib/find.rb
@@ -34,33 +34,41 @@ module Find
#
# See the +Find+ module documentation for an example.
#
- def find(*paths) # :yield: path
- block_given? or return enum_for(__method__, *paths)
+ def find(*paths, ignore_error: true) # :yield: path
+ block_given? or return enum_for(__method__, *paths, ignore_error: ignore_error)
- paths.collect!{|d| raise Errno::ENOENT unless File.exist?(d); d.dup}
- while file = paths.shift
- catch(:prune) do
- yield file.dup.taint
- begin
- s = File.lstat(file)
- rescue Errno::ENOENT, Errno::EACCES, Errno::ENOTDIR, Errno::ELOOP, Errno::ENAMETOOLONG
- next
- end
- if s.directory? then
+ fs_encoding = Encoding.find("filesystem")
+
+ paths.collect!{|d| raise Errno::ENOENT unless File.exist?(d); d.dup}.each do |path|
+ enc = path.encoding == Encoding::US_ASCII ? fs_encoding : path.encoding
+ ps = [path]
+ while file = ps.shift
+ catch(:prune) do
+ yield file.dup.taint
begin
- fs = Dir.entries(file)
+ s = File.lstat(file)
rescue Errno::ENOENT, Errno::EACCES, Errno::ENOTDIR, Errno::ELOOP, Errno::ENAMETOOLONG
+ raise unless ignore_error
next
end
- fs.sort!
- fs.reverse_each {|f|
- next if f == "." or f == ".."
- f = File.join(file, f)
- paths.unshift f.untaint
- }
+ 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!
+ fs.reverse_each {|f|
+ next if f == "." or f == ".."
+ f = File.join(file, f)
+ ps.unshift f.untaint
+ }
+ end
end
end
end
+ nil
end
#
diff --git a/lib/forwardable.rb b/lib/forwardable.rb
index d7116ed1bc..ecc5f03843 100644
--- a/lib/forwardable.rb
+++ b/lib/forwardable.rb
@@ -19,30 +19,40 @@
# #record_number(), which simply calls #[] on the <tt>@records</tt>
# array, like this:
#
+# require 'forwardable'
+#
# class RecordCollection
+# attr_accessor :records
# extend Forwardable
# def_delegator :@records, :[], :record_number
# end
#
+# We can use the lookup method like so:
+#
+# r = RecordCollection.new
+# r.records = [4,5,6]
+# r.record_number(0) # => 4
+#
# Further, if you wish to provide the methods #size, #<<, and #map,
# all of which delegate to @records, this is how you can do it:
#
-# class RecordCollection
-# # extend Forwardable, but we did that above
+# class RecordCollection # re-open RecordCollection class
# def_delegators :@records, :size, :<<, :map
# end
-# f = Foo.new
-# f.printf ...
-# f.gets
-# f.content_at(1)
#
-# If the object isn't a Module and Class, You can too extend Forwardable
-# module.
+# r = RecordCollection.new
+# r.records = [1,2,3]
+# r.record_number(0) # => 1
+# r.size # => 3
+# r << 4 # => [1, 2, 3, 4]
+# r.map { |x| x * 2 } # => [2, 4, 6, 8]
#
-# printer = String.new
-# printer.extend Forwardable # prepare object for delegation
-# printer.def_delegator "STDOUT", "puts" # add delegation for STDOUT.puts()
-# printer.puts "Howdy!"
+# You can even extend regular objects with Forwardable.
+#
+# my_hash = Hash.new
+# my_hash.extend Forwardable # prepare object for delegation
+# my_hash.def_delegator "STDOUT", "puts" # add delegation for STDOUT.puts()
+# my_hash.puts "Howdy!"
#
# == Another example
#
@@ -102,6 +112,8 @@ module Forwardable
# Version of +forwardable.rb+
FORWARDABLE_VERSION = "1.1.0"
+ FILE_REGEXP = %r"#{Regexp.quote(__FILE__)}"
+
@debug = nil
class << self
# If true, <tt>__FILE__</tt> will remain in the backtrace in the event an
@@ -170,7 +182,7 @@ module Forwardable
begin
#{accessor}.__send__(:#{method}, *args, &block)
rescue Exception
- $@.delete_if{|s| %r"#{Regexp.quote(__FILE__)}"o =~ s} unless Forwardable::debug
+ $@.delete_if{|s| Forwardable::FILE_REGEXP =~ s} unless Forwardable::debug
::Kernel::raise
end
end
@@ -203,14 +215,14 @@ end
# puts "serviced!"
# end
# end
-#
+#
# module Facade
# extend SingleForwardable
# def_delegator :Implementation, :service
# end
#
# Facade.service #=> serviced!
-#
+#
# If you want to use both Forwardable and SingleForwardable, you can
# use methods def_instance_delegator and def_single_delegator, etc.
module SingleForwardable
@@ -262,7 +274,7 @@ module SingleForwardable
begin
#{accessor}.__send__(:#{method}, *args, &block)
rescue Exception
- $@.delete_if{|s| %r"#{Regexp.quote(__FILE__)}"o =~ s} unless Forwardable::debug
+ $@.delete_if{|s| Forwardable::FILE_REGEXP =~ s} unless Forwardable::debug
::Kernel::raise
end
end
diff --git a/lib/getoptlong.rb b/lib/getoptlong.rb
index 259382e8ec..cf635f0438 100644
--- a/lib/getoptlong.rb
+++ b/lib/getoptlong.rb
@@ -356,7 +356,7 @@ class GetoptLong
#
def terminate
return nil if @status == STATUS_TERMINATED
- raise RuntimeError, "an error has occured" if @error != nil
+ raise RuntimeError, "an error has occurred" if @error != nil
@status = STATUS_TERMINATED
@non_option_arguments.reverse_each do |argument|
diff --git a/lib/gserver.rb b/lib/gserver.rb
deleted file mode 100644
index 48770289f8..0000000000
--- a/lib/gserver.rb
+++ /dev/null
@@ -1,310 +0,0 @@
-#
-# 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 13016fcbba..4b5f784ae0 100644
--- a/lib/ipaddr.rb
+++ b/lib/ipaddr.rb
@@ -656,280 +656,3 @@ 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 72ebe1bd35..09556c8bc5 100644
--- a/lib/irb.rb
+++ b/lib/irb.rb
@@ -13,7 +13,6 @@ require "e2mmap"
require "irb/init"
require "irb/context"
require "irb/extend-command"
-#require "irb/workspace"
require "irb/ruby-lex"
require "irb/input-method"
@@ -21,16 +20,16 @@ require "irb/locale"
STDOUT.sync = true
-# IRB stands for "interactive ruby" and is a tool to interactively execute ruby
+# IRB stands for "interactive Ruby" and is a tool to interactively execute Ruby
# expressions read from the standard input.
#
# The +irb+ command from your shell will start the interpreter.
#
# == Usage
#
-# Use of irb is easy if you know ruby.
+# Use of irb is easy if you know Ruby.
#
-# When executing irb, prompts are displayed as follows. Then, enter the ruby
+# When executing irb, prompts are displayed as follows. Then, enter the Ruby
# expression. An input is executed when it is syntactically complete.
#
# $ irb
@@ -101,7 +100,7 @@ STDOUT.sync = true
# IRB.conf[:USE_TRACER] = false
# IRB.conf[:IGNORE_SIGINT] = true
# IRB.conf[:IGNORE_EOF] = false
-# IRB.conf[:PROMPT_MODE] = :DEFALUT
+# IRB.conf[:PROMPT_MODE] = :DEFAULT
# IRB.conf[:PROMPT] = {...}
# IRB.conf[:DEBUG_LEVEL]=0
#
@@ -138,8 +137,8 @@ STDOUT.sync = true
# 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 => nil, # normal prompt
+# :AUTO_INDENT => true, # enables auto-indent mode
+# :PROMPT_I => ">> ", # simple prompt
# :PROMPT_S => nil, # prompt for continuated strings
# :PROMPT_C => nil, # prompt for continuated statement
# :RETURN => " ==>%s\n" # format to return value
@@ -158,7 +157,7 @@ STDOUT.sync = true
# %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 degits and means as same as printf("%NNd").
+# %NNi # indent level. NN is digits and means as same as printf("%NNd").
# # It can be ommited
# %NNn # line number.
# %% # %
@@ -221,7 +220,7 @@ STDOUT.sync = true
# == Restrictions
#
# Because irb evaluates input immediately after it is syntactically complete,
-# the results may be slightly different than directly using ruby.
+# the results may be slightly different than directly using Ruby.
#
# == IRB Sessions
#
@@ -337,7 +336,6 @@ STDOUT.sync = true
# # quit irb
# irb(main):010:0> exit
module IRB
- @RCS_ID='-$Id$-'
# An exception raised by IRB.irb_abort
class Abort < Exception;end
@@ -399,7 +397,6 @@ module IRB
ensure
irb_at_exit
end
-# print "\n"
end
# Calls each event hook of IRB.conf[:AT_EXIT] when the current session quits.
@@ -499,7 +496,7 @@ module IRB
end
if exc
print exc.class, ": ", exc, "\n"
- if exc.backtrace[0] =~ /irb(2)?(\/.*|-.*|\.rb)?:/ && exc.class.to_s !~ /^IRB/ &&
+ if exc.backtrace && exc.backtrace[0] =~ /irb(2)?(\/.*|-.*|\.rb)?:/ && exc.class.to_s !~ /^IRB/ &&
!(SyntaxError === exc)
irb_bug = true
else
@@ -509,16 +506,18 @@ module IRB
messages = []
lasts = []
levels = 0
- 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
+ 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
end
end
end
diff --git a/lib/irb/cmd/chws.rb b/lib/irb/cmd/chws.rb
index 1889e75d5e..8c0260627e 100644
--- a/lib/irb/cmd/chws.rb
+++ b/lib/irb/cmd/chws.rb
@@ -18,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 fbe5126c85..1e02edac63 100644
--- a/lib/irb/cmd/fork.rb
+++ b/lib/irb/cmd/fork.rb
@@ -9,27 +9,26 @@
#
#
-@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/load.rb b/lib/irb/cmd/load.rb
index 6c9e9f67ce..acda9d0c8c 100644
--- a/lib/irb/cmd/load.rb
+++ b/lib/irb/cmd/load.rb
@@ -19,8 +19,7 @@ module IRB
include IrbLoader
def execute(file_name, priv = nil)
-# return ruby_load(file_name) unless IRB.conf[:USE_LOADER]
- return irb_load(file_name, priv)
+ return irb_load(file_name, priv)
end
end
@@ -28,38 +27,37 @@ 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 7bd443121e..60379f016a 100644
--- a/lib/irb/cmd/nop.rb
+++ b/lib/irb/cmd/nop.rb
@@ -13,25 +13,24 @@ 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 cee8538e3e..0726a4377e 100644
--- a/lib/irb/cmd/pushws.rb
+++ b/lib/irb/cmd/pushws.rb
@@ -17,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 7363d64769..ccf4fc4bcd 100644
--- a/lib/irb/cmd/subirb.rb
+++ b/lib/irb/cmd/subirb.rb
@@ -16,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 3be0610c6e..2d47f33d66 100644
--- a/lib/irb/completion.rb
+++ b/lib/irb/completion.rb
@@ -11,226 +11,216 @@ 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
- ReservedWords = [
- "BEGIN", "END",
- "alias", "and",
- "begin", "break",
- "case", "class",
- "def", "defined", "do",
- "else", "elsif", "end", "ensure",
- "false", "for",
- "if", "in",
- "module",
- "next", "nil", "not",
- "or",
- "redo", "rescue", "retry", "return",
- "self", "super",
- "then", "true",
- "undef", "unless", "until",
- "when", "while",
- "yield",
+ ReservedWords = %w[
+ BEGIN END
+ alias and
+ begin break
+ case class
+ def defined do
+ else elsif end ensure
+ false for
+ if in
+ module
+ next nil not
+ or
+ redo rescue retry return
+ self super
+ then true
+ undef unless until
+ when while
+ yield
]
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
}
# Set of available operators in Ruby
- Operators = ["%", "&", "*", "**", "+", "-", "/",
- "<", "<<", "<=", "<=>", "==", "===", "=~", ">", ">=", ">>",
- "[]", "[]=", "^", "!", "!=", "!~"]
+ Operators = %w[% & * ** + - / < << <= <=> == === =~ > >= >> [] []= ^ ! != !~]
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 72b36307d5..9cf9600f02 100644
--- a/lib/irb/context.rb
+++ b/lib/irb/context.rb
@@ -25,12 +25,11 @@ 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 +54,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 +234,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 +250,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 +275,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 +308,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,8 +377,6 @@ 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:
@@ -400,19 +397,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 ce921eb5e3..0ae9097285 100644
--- a/lib/irb/ext/change-ws.rb
+++ b/lib/irb/ext/change-ws.rb
@@ -15,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
@@ -30,40 +30,16 @@ 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 3239c57a6c..d8378753f2 100644
--- a/lib/irb/ext/history.rb
+++ b/lib/irb/ext/history.rb
@@ -21,10 +21,9 @@ module IRB # :nodoc:
def set_last_value(value)
_set_last_value(value)
-# @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}"
+ if @eval_history
+ @eval_history_values.push @line_no, @last_value
+ @workspace.evaluate self, "__ = IRB.CurrentContext.instance_eval{@eval_history_values}"
end
@last_value
@@ -43,23 +42,22 @@ 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
@@ -68,20 +66,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
@@ -94,22 +92,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 6cdc8ec898..821538cd44 100644
--- a/lib/irb/ext/loader.rb
+++ b/lib/irb/ext/loader.rb
@@ -18,7 +18,6 @@ module IRB # :nodoc:
#
# See ExtendCommandBundle for more information.
module IrbLoader
- @RCS_ID='-$Id$-'
alias ruby_load load
alias ruby_require require
@@ -33,14 +32,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 +49,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,28 +72,27 @@ 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
-# 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
+ 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
end
end
@@ -104,25 +102,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 067eb1e7fa..01bd24a157 100644
--- a/lib/irb/ext/math-mode.rb
+++ b/lib/irb/ext/math-mode.rb
@@ -28,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 e49a158fa3..52f6fda733 100644
--- a/lib/irb/ext/multi-irb.rb
+++ b/lib/irb/ext/multi-irb.rb
@@ -13,11 +13,9 @@ require "thread"
module IRB
class JobManager
- @RCS_ID='-$Id$-'
# Creates a new JobManager object
def initialize
- # @jobs = [[thread, irb],...]
@jobs = []
@current_job = nil
end
@@ -85,9 +83,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
@@ -107,15 +105,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
@@ -124,21 +122,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
@@ -148,25 +146,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
@@ -193,64 +191,45 @@ 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
@@ -258,22 +237,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 7b3fcbbeec..4477d18e1a 100644
--- a/lib/irb/ext/save-history.rb
+++ b/lib/irb/ext/save-history.rb
@@ -12,13 +12,12 @@ 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
@@ -39,9 +38,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
@@ -59,23 +58,7 @@ 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
@@ -83,37 +66,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 8c9083dbad..c145cf5b4f 100644
--- a/lib/irb/ext/tracer.rb
+++ b/lib/irb/ext/tracer.rb
@@ -18,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
@@ -35,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
@@ -54,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 4e98f5b7a2..99e76b722f 100644
--- a/lib/irb/ext/use-loader.rb
+++ b/lib/irb/ext/use-loader.rb
@@ -49,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 641befbdf3..4237037271 100644
--- a/lib/irb/ext/workspaces.rb
+++ b/lib/irb/ext/workspaces.rb
@@ -20,9 +20,9 @@ module IRB # :nodoc:
# WorkSpaces in the current stack
def workspaces
if defined? @workspaces
- @workspaces
+ @workspaces
else
- @workspaces = []
+ @workspaces = []
end
end
@@ -33,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
@@ -56,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 487c0bbeff..a9326272ff 100644
--- a/lib/irb/extend-command.rb
+++ b/lib/irb/extend-command.rb
@@ -46,71 +46,57 @@ 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],
-# [: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_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_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_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_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]],
]
@@ -131,7 +117,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
@@ -144,39 +130,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
@@ -187,18 +173,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
@@ -210,10 +196,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
@@ -241,7 +227,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
@@ -252,13 +238,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
@@ -277,9 +263,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
@@ -293,9 +279,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
@@ -313,7 +299,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 bcfa3a3140..64dd63dddf 100644
--- a/lib/irb/frame.rb
+++ b/lib/irb/frame.rb
@@ -31,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 9fd734038f..b9ebfb1ae5 100644
--- a/lib/irb/help.rb
+++ b/lib/irb/help.rb
@@ -19,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 826bcaf3ac..af9c363a97 100644
--- a/lib/irb/init.rb
+++ b/lib/irb/init.rb
@@ -59,48 +59,47 @@ 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 => "%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 => 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,7 +109,6 @@ 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] = []
@@ -122,108 +120,104 @@ 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
- if RUBY_VERSION >= FEATURE_IOPT_CHANGE_VERSION
- load_path.collect! do |path|
- /\A\.\// =~ path ? path : File.expand_path(path)
- end
+ load_path.collect! do |path|
+ /\A\.\// =~ path ? path : File.expand_path(path)
end
$LOAD_PATH.unshift(*load_path)
@@ -233,14 +227,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
@@ -249,11 +243,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)
@@ -283,9 +277,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
@@ -300,7 +294,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 55363fe0c4..4ea3f585f8 100644
--- a/lib/irb/input-method.rb
+++ b/lib/irb/input-method.rb
@@ -14,7 +14,6 @@ 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,7 +116,6 @@ module IRB
def gets
print @prompt
l = @io.gets
-# print @prompt, l
l
end
@@ -133,14 +131,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.
@@ -149,13 +147,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+
@@ -163,7 +161,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
@@ -171,7 +169,7 @@ module IRB
#
# See IO#eof for more information.
def readable_after_eof?
- true
+ true
end
# Returns the current line number for #io.
@@ -180,12 +178,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 eaff44fc0b..f09b12927a 100644
--- a/lib/irb/inspector.rb
+++ b/lib/irb/inspector.rb
@@ -61,20 +61,6 @@ 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
@@ -105,7 +91,7 @@ module IRB # :nodoc:
end
# Proc to call when the inspector is activated, good for requiring
- # dependant libraries.
+ # dependent libraries.
def init
@init.call if @init
end
diff --git a/lib/irb/lc/help-message b/lib/irb/lc/help-message
index c01cdaab93..5853693eb0 100644
--- a/lib/irb/lc/help-message
+++ b/lib/irb/lc/help-message
@@ -1,4 +1,4 @@
-# -*- coding: US-ASCII -*-
+# -*- coding: utf-8 -*-
#
# irb/lc/help-message.rb -
# $Release Version: 0.9.6$
@@ -19,22 +19,32 @@ Usage: irb.rb [options] [programfile] [arguments]
-E enc Same as `ruby -E`
-w Same as `ruby -w`
-W[level=2] Same as `ruby -W`
+ --context-mode n Set n[0-3] to method to create Binding Object,
+ when new workspace was created
+ --echo Show result(default)
+ --noecho Don't show result
--inspect Use `inspect' for output (default except for bc mode)
--noinspect Don't use inspect for output
- --readline Use Readline extension module
+ --readline Use Readline extension module
--noreadline Don't use Readline extension module
- --prompt prompt-mode
- --prompt-mode prompt-mode
+ --prompt prompt-mode/--prompt-mode prompt-mode
Switch prompt mode. Pre-defined prompt modes are
`default', `simple', `xmp' and `inf-ruby'
--inf-ruby-mode Use prompt appropriate for inf-ruby-mode on emacs.
Suppresses --readline.
- --simple-prompt Simple prompt mode
- --noprompt No prompt mode
- --tracer Display trace for each execution of commands.
+ --sample-book-mode/--simple-prompt
+ Simple prompt mode
+ --noprompt No prompt mode
+ --single-irb Share self with sub-irb.
+ --tracer Display trace for each execution of commands.
--back-trace-limit n
Display backtrace top n and tail n. The default
value is 16.
--irb_debug n Set internal debug level to n (not for popular use)
+ --verbose Show details
+ --noverbose Don't show details
-v, --version Print the version of irb
-# vim:fileencoding=us-ascii
+ -h, --help Print help
+ -- Separate options of irb from the list of command-line args
+
+# vim:fileencoding=utf-8
diff --git a/lib/irb/lc/ja/help-message b/lib/irb/lc/ja/help-message
index 57e8f23edf..288eb5245c 100644
--- a/lib/irb/lc/ja/help-message
+++ b/lib/irb/lc/ja/help-message
@@ -18,6 +18,10 @@ Usage: irb.rb [options] [programfile] [arguments]
-E enc ruby -E と同じ.
-w ruby -w と同じ.
-W[level=2] ruby -W と同じ.
+ --context-mode n 新しいワークスペースを作成した時に関連する Binding
+ オブジェクトの作成方法を 0 から 3 のいずれかに設定する.
+ --echo 実行結果を表示する(デフォルト).
+ --noecho 実行結果を表示しない.
--inspect 結果出力にinspectを用いる(bcモード以外はデフォルト).
--noinspect 結果出力にinspectを用いない.
--readline readlineライブラリを利用する.
@@ -28,14 +32,22 @@ Usage: irb.rb [options] [programfile] [arguments]
用意されています.
--inf-ruby-mode emacsのinf-ruby-mode用のプロンプト表示を行なう. 特
に指定がない限り, readlineライブラリは使わなくなる.
- --simple-prompt 非常にシンプルなプロンプトを用いるモードです.
+ --sample-book-mode/--simple-prompt
+ 非常にシンプルなプロンプトを用いるモードです.
--noprompt プロンプト表示を行なわない.
+ --single-irb irb 中で self を実行して得られるオブジェクトをサ
+ ブ irb と共有する.
--tracer コマンド実行時にトレースを行なう.
--back-trace-limit n
バックトレース表示をバックトレースの頭から n, 後ろ
からnだけ行なう. デフォルトは16
- --irb_debug n irbのデバッグデバッグレベルをnに設定する(利用しな
- い方が無難でしょう).
- -v, --version irbのバージョンを表示する
+
+ --irb_debug n irbのデバッグレベルをnに設定する(非推奨).
+
+ --verbose 詳細なメッセージを出力する.
+ --noverbose 詳細なメッセージを出力しない(デフォルト).
+ -v, --version irbのバージョンを表示する.
+ -h, --help irb のヘルプを表示する.
+ -- 以降のコマンドライン引数をオプションとして扱わない.
# vim:fileencoding=utf-8
diff --git a/lib/irb/locale.rb b/lib/irb/locale.rb
index accce9e13f..9f40188171 100644
--- a/lib/irb/locale.rb
+++ b/lib/irb/locale.rb
@@ -10,7 +10,6 @@
#
module IRB # :nodoc:
class Locale
- @RCS_ID='-$Id$-'
LOCALE_NAME_RE = %r[
(?<language>[[:alpha:]]{2,3})
@@ -26,27 +25,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, :modifieer
+ attr_reader :lang, :territory, :encoding, :modifier
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 +82,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 +128,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 +160,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/notifier.rb b/lib/irb/notifier.rb
index effb12c30d..d5981df2bf 100644
--- a/lib/irb/notifier.rb
+++ b/lib/irb/notifier.rb
@@ -26,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, StdioOuputMethod will be used, and all
+ # no +output_method+ is given, StdioOutputMethod will be used, and all
# expressions will be sent directly to STDOUT without any additional
# formatting.
def def_notifier(prefix = "", output_method = StdioOutputMethod.new)
@@ -40,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
@@ -52,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
@@ -91,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
@@ -116,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
@@ -132,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
@@ -156,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 ErrUndefinedNotifer, 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 ErrUndefinedNotifier, value unless l
+ @level_notifier = l
+ else
+ Notifier.Raise ErrUnrecognizedLevel, value unless l
+ end
end
alias level= level_notifier=
@@ -183,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
@@ -196,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
@@ -214,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 aae9e2294d..e0ba25f3e4 100644
--- a/lib/irb/output-method.rb
+++ b/lib/irb/output-method.rb
@@ -35,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
@@ -58,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 4a700b3324..7189307e0a 100644
--- a/lib/irb/ruby-lex.rb
+++ b/lib/irb/ruby-lex.rb
@@ -15,14 +15,13 @@ 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,7 +100,6 @@ class RubyLex
def getc
while @rests.empty?
-# return nil unless buf_input
@rests.push nil unless buf_input
end
c = @rests.shift
@@ -154,9 +152,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
@@ -231,47 +229,43 @@ 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?)
- #p tk
- #p @lex_state
- #p self
+ !@continue or
+ tk.nil?)
end
line = get_readed
- # print self.inspect
if line == "" and tk.kind_of?(TkEND_OF_SCRIPT) || tk.nil?
nil
else
@@ -280,34 +274,31 @@ 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" #, "when"
+ "module", "unless", "until", "while", "begin"
]
- DEINDENT_CLAUSE = ["end" #, "when"
+ DEINDENT_CLAUSE = ["end"
]
PERCENT_LTYPE = {
@@ -361,12 +352,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
@@ -377,15 +368,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 = []
@@ -393,17 +384,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
@@ -412,20 +403,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 == "-")
- 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
@@ -438,31 +429,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
@@ -473,7 +464,7 @@ class RubyLex
end
@OP.def_rules("+=", "-=", "*=", "**=",
- "&=", "|=", "^=", "<<=", ">>=", "||=", "&&=") do
+ "&=", "|=", "^=", "<<=", ">>=", "||=", "&&=") do
|op, io|
@lex_state = EXPR_BEG
op =~ /^(.*)=$/
@@ -495,18 +486,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
@@ -514,12 +505,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
@@ -544,39 +535,38 @@ 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
@@ -586,11 +576,6 @@ 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
@@ -601,9 +586,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
@@ -624,11 +609,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)
@@ -650,16 +635,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)
@@ -669,9 +654,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
@@ -681,27 +666,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
@@ -713,30 +698,20 @@ 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
@@ -774,7 +749,7 @@ class RubyLex
if peek(0) =~ /[$@]/
token.concat(c = getc)
if c == "@" and peek(0) == "@"
- token.concat getc
+ token.concat getc
end
end
@@ -807,61 +782,60 @@ 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
- 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)
+ # 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
+ 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
@@ -880,7 +854,6 @@ class RubyLex
def identify_here_document
ch = getc
-# if lt = PERCENT_LTYPE[ch]
if ch == "-"
ch = getc
indent = true
@@ -889,13 +862,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
@@ -905,32 +878,26 @@ 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
@@ -954,11 +921,6 @@ 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
@@ -970,49 +932,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
@@ -1024,37 +986,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)
@@ -1067,38 +1029,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
@@ -1125,13 +1087,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
@@ -1147,13 +1109,10 @@ 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)
@@ -1166,42 +1125,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 2c7565dbfc..a80d81c9a5 100644
--- a/lib/irb/ruby-token.rb
+++ b/lib/irb/ruby-token.rb
@@ -24,14 +24,14 @@ module RubyToken
@line_no = line_no
@char_no = char_no
end
- attr :seek, :line_no, :char_no
+ attr_reader :seek, :line_no, :char_no
end
class TkNode < Token
def initialize(seek, line_no, char_no)
super
end
- attr :node
+ attr_reader :node
end
class TkId < Token
@@ -39,7 +39,7 @@ module RubyToken
super(seek, line_no, char_no)
@name = name
end
- attr :name
+ attr_reader :name
end
class TkVal < Token
@@ -47,7 +47,7 @@ module RubyToken
super(seek, line_no, char_no)
@value = value
end
- attr :value
+ attr_reader :value
end
class TkOp < Token
@@ -60,7 +60,7 @@ module RubyToken
op = TkReading2Token[op][0] unless op.kind_of?(Symbol)
@op = op
end
- attr :op
+ attr_reader :op
end
class TkUnknownChar < Token
@@ -68,7 +68,7 @@ module RubyToken
super(seek, line_no, char_no)
@name = name
end
- attr :name
+ attr_reader :name
end
class TkError < Token
@@ -78,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
@@ -186,7 +186,6 @@ module RubyToken
[:TkRSHFT, TkOp, ">>"],
[:TkCOLON2, TkOp],
[:TkCOLON3, TkOp],
-# [:OPASGN, TkOp], # +=, -= etc. #
[:TkASSOC, TkOp, "=>"],
[:TkQUESTION, TkOp, "?"], #?
[:TkCOLON, TkOp, ":"], #:
@@ -249,12 +248,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 09c1c02ebc..f6c2bd92f5 100644
--- a/lib/irb/slex.rb
+++ b/lib/irb/slex.rb
@@ -15,7 +15,6 @@ require "irb/notifier"
# :stopdoc:
module IRB
class SLex
- @RCS_ID='-$Id$-'
extend Exception2MessageMapper
def_exception :ErrNodeNothing, "node nothing"
@@ -41,10 +40,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 +70,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 +92,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 +164,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,7 +246,6 @@ end
# :startdoc:
if $0 == __FILE__
- # Tracer.on
case $1
when "1"
tr = SLex.new
@@ -281,4 +279,3 @@ if $0 == __FILE__
end
exit
end
-
diff --git a/lib/irb/workspace.rb b/lib/irb/workspace.rb
index 65214a2217..e05c3bbc96 100644
--- a/lib/irb/workspace.rb
+++ b/lib/irb/workspace.rb
@@ -16,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 # binging in function on TOPLEVEL_BINDING(default)
- @binding = eval("def irb_binding; private; binding; end; irb_binding",
- TOPLEVEL_BINDING,
- __FILE__,
- __LINE__ - 3)
- end
+ 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
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
@@ -90,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/xmp.rb b/lib/irb/xmp.rb
index 947d2cf5a2..449f04328b 100644
--- a/lib/irb/xmp.rb
+++ b/lib/irb/xmp.rb
@@ -43,7 +43,6 @@ require "irb/frame"
# ctx.eval 'today # is what?'
# #=> "a good day"
class XMP
- @RCS_ID='-$Id$-'
# Creates a new XMP object.
#
@@ -54,8 +53,6 @@ class XMP
# full detail.
def initialize(bind = nil)
IRB.init_config(nil)
- #IRB.parse_opts
- #IRB.load_modules
IRB.conf[:PROMPT_MODE] = :XMP
@@ -65,7 +62,6 @@ 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
@@ -85,16 +81,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
@@ -117,10 +113,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
@@ -131,14 +127,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 c0a64c0dda..530b718cde 100644
--- a/lib/logger.rb
+++ b/lib/logger.rb
@@ -290,8 +290,8 @@ class Logger
#
# :call-seq:
- # Logger.new(name, shift_age = 7, shift_size = 1048576)
- # Logger.new(name, shift_age = 'weekly')
+ # Logger.new(logdev, shift_age = 7, shift_size = 1048576)
+ # Logger.new(logdev, shift_age = 'weekly')
#
# === Args
#
@@ -339,8 +339,6 @@ class Logger
#
# === Return
#
- # +true+ if successful, +false+ otherwise.
- #
# When the given severity is not high enough (for this particular logger),
# log no message, and return +true+.
#
@@ -512,11 +510,7 @@ private
private
def format_datetime(time)
- if @datetime_format.nil?
- time.strftime("%Y-%m-%dT%H:%M:%S.") << "%06d " % time.usec
- else
- time.strftime(@datetime_format)
- end
+ time.strftime(@datetime_format || "%Y-%m-%dT%H:%M:%S.%6N ".freeze)
end
def msg2str(msg)
@@ -532,9 +526,48 @@ 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 * 31
+ mday = (1 if t.mday > 1)
+ else
+ return now
+ end
+ if mday or t.hour.nonzero? or t.min.nonzero? or t.sec.nonzero?
+ t = Time.mktime(t.year, t.month, mday || (t.mday + (t.hour > 12 ? 1 : 0)))
+ 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 + 1) + 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
@@ -553,6 +586,7 @@ private
@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
@@ -590,43 +624,85 @@ private
private
def open_logfile(filename)
- if (FileTest.exist?(filename))
+ begin
open(filename, (File::WRONLY | File::APPEND))
- else
+ rescue Errno::ENOENT
create_logfile(filename)
end
end
def create_logfile(filename)
- logdev = open(filename, (File::WRONLY | File::APPEND | File::CREAT))
- logdev.sync = true
- add_log_header(logdev)
+ begin
+ logdev = open(filename, (File::WRONLY | File::APPEND | File::CREAT | File::EXCL))
+ logdev.flock(File::LOCK_EX)
+ logdev.sync = true
+ add_log_header(logdev)
+ logdev.flock(File::LOCK_UN)
+ rescue Errno::EEXIST
+ # file is created by another process
+ logdev = open_logfile(filename)
+ logdev.sync = true
+ end
logdev
end
def add_log_header(file)
file.write(
"# Logfile created on %s by %s\n" % [Time.now.to_s, Logger::ProgName]
- )
+ ) 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'.
if @filename && (@shift_age > 0) && (@dev.stat.size > @shift_size)
- shift_log_age
+ lock_shift_log { shift_log_age }
end
else
now = Time.now
- period_end = previous_period_end(now)
- if @dev.stat.mtime <= period_end
- shift_log_period(period_end)
+ 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)) }
end
end
end
+ if /mswin|mingw/ =~ RUBY_PLATFORM
+ def lock_shift_log
+ yield
+ end
+ else
+ def lock_shift_log
+ retry_limit = 8
+ retry_sleep = 0.1
+ 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)
+ yield # log shifting
+ else
+ # log shifted by another process (i-node before locking and i-node after locking are different)
+ @dev.close rescue nil
+ @dev = open_logfile(@filename)
+ @dev.sync = true
+ end
+ end
+ rescue Errno::ENOENT
+ # @filename file would not exist right after #rename and before #create_logfile
+ if retry_limit <= 0
+ warn("log rotation inter-process lock failed. #{$!}")
+ else
+ sleep retry_sleep
+ retry_limit -= 1
+ retry_sleep *= 2
+ retry
+ end
+ end
+ rescue
+ warn("log rotation inter-process lock failed. #{$!}")
+ end
+ end
+
def shift_log_age
(@shift_age-3).downto(0) do |i|
if FileTest.exist?("#{@filename}.#{i}")
@@ -657,146 +733,5 @@ 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
- #
- # 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 < 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:
- # 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 aae4620c3f..315e5438d7 100644
--- a/lib/mathn.rb
+++ b/lib/mathn.rb
@@ -5,9 +5,8 @@
##
# = mathn
#
-# 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.
+# mathn serves to make mathematical operations more precise in Ruby
+# and to integrate other mathematical standard libraries.
#
# Without mathn:
#
@@ -17,7 +16,7 @@
#
# 3 / 2 => 3/2 # Rational
#
-# mathn features late rounding and lacks truncation of intermediate results:
+# mathn keeps value in exact terms.
#
# Without mathn:
#
@@ -38,6 +37,8 @@
# 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"
@@ -53,7 +54,7 @@ unless defined?(Math.exp!)
end
##
-# When mathn is required, Fixnum's division and exponentiation are enhanced to
+# When mathn is required, Fixnum's division is enhanced to
# return more precise values from mathematical expressions.
#
# 2/3*3 # => 0
@@ -69,25 +70,13 @@ 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 and exponentiation are enhanced to
+# When mathn is required Bignum's division is enhanced to
# return more precise values from mathematical expressions.
+#
+# (2**72) / ((2**70) * 3) # => 4/3
class Bignum
remove_method :/
@@ -98,103 +87,6 @@ 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
##
@@ -226,14 +118,8 @@ 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
@@ -303,22 +189,3 @@ 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 b1d1a5c2bd..76bec9228b 100644
--- a/lib/matrix.rb
+++ b/lib/matrix.rb
@@ -58,6 +58,8 @@ end
# * #each_with_index
# * #find_index
# * #minor(*param)
+# * #first_minor(row, column)
+# * #cofactor(row, column)
#
# Properties of a matrix:
# * #diagonal?
@@ -204,6 +206,7 @@ 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]
@@ -543,6 +546,7 @@ 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
@@ -589,6 +593,49 @@ 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
+
#--
# TESTING -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#++
@@ -847,7 +894,7 @@ class Matrix
return apply_through_coercion(m, __method__)
end
- Matrix.Raise ErrDimensionMismatch unless row_count == m.row_count and column_count == m.column_count
+ Matrix.Raise ErrDimensionMismatch unless row_count == m.row_count && column_count == m.column_count
rows = Array.new(row_count) {|i|
Array.new(column_count) {|j|
@@ -874,7 +921,7 @@ class Matrix
return apply_through_coercion(m, __method__)
end
- Matrix.Raise ErrDimensionMismatch unless row_count == m.row_count and column_count == m.column_count
+ Matrix.Raise ErrDimensionMismatch unless row_count == m.row_count && column_count == m.column_count
rows = Array.new(row_count) {|i|
Array.new(column_count) {|j|
@@ -1519,6 +1566,7 @@ end
#
# Vector functions:
# * #inner_product(v)
+# * #cross_product(v)
# * #collect
# * #magnitude
# * #map
@@ -1758,6 +1806,17 @@ class Vector
end
#
+ # Returns the cross product of this vector with the other.
+ # Vector[1, 0, 0].cross_product Vector[0, 1, 0] => Vector[0, 0, 1]
+ #
+ def cross_product(v)
+ Vector.Raise ErrDimensionMismatch unless size == v.size && v.size == 3
+ 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] ]
+ end
+
+ #
# Like Array#collect.
#
def collect(&block) # :yield: e
diff --git a/lib/matrix/eigenvalue_decomposition.rb b/lib/matrix/eigenvalue_decomposition.rb
index 0dd9d42f29..ab353ecf61 100644
--- a/lib/matrix/eigenvalue_decomposition.rb
+++ b/lib/matrix/eigenvalue_decomposition.rb
@@ -40,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
@@ -64,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+
diff --git a/lib/minitest/.document b/lib/minitest/.document
deleted file mode 100644
index 6850e5befb..0000000000
--- a/lib/minitest/.document
+++ /dev/null
@@ -1,2 +0,0 @@
-# Ignore README.txt, it is included in the minitest documentation.
-*.rb
diff --git a/lib/minitest/autorun.rb b/lib/minitest/autorun.rb
deleted file mode 100644
index cb4a3a0e5d..0000000000
--- a/lib/minitest/autorun.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# 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/lib/minitest/hell.rb b/lib/minitest/hell.rb
deleted file mode 100644
index 0e4101f3f8..0000000000
--- a/lib/minitest/hell.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-# 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.
-######################################################################
-
-class Minitest::Unit::TestCase # :nodoc:
- class << self
- alias :old_test_order :test_order
-
- def test_order # :nodoc:
- :parallel
- end
- end
-end
diff --git a/lib/minitest/parallel_each.rb b/lib/minitest/parallel_each.rb
deleted file mode 100644
index d501aa34ef..0000000000
--- a/lib/minitest/parallel_each.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-# 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.
-######################################################################
-
-class ParallelEach
- require 'thread'
- include Enumerable
-
- N = (ENV['N'] || 2).to_i
-
- 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
- self.class.new super
- 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
-end
diff --git a/lib/minitest/pride.rb b/lib/minitest/pride.rb
deleted file mode 100644
index 40c35394fa..0000000000
--- a/lib/minitest/pride.rb
+++ /dev/null
@@ -1,119 +0,0 @@
-# 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
deleted file mode 100644
index 7588982038..0000000000
--- a/lib/minitest/spec.rb
+++ /dev/null
@@ -1,541 +0,0 @@
-# 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 && self < MiniTest::Spec 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
- ##
- # 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 self.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 self.spec_type desc
- TYPES.find { |matcher, klass|
- if matcher.respond_to? :call then
- matcher.call desc
- else
- matcher === desc.to_s
- end
- }.last
- end
-
- @@describe_stack = []
- def self.describe_stack # :nodoc:
- @@describe_stack
- end
-
- ##
- # Returns the children of this spec.
-
- def self.children
- @children ||= []
- end
-
- def self.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 self.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 self.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 inheritence, 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 self.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 self.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 self.subject &block
- let :subject, &block
- end
-
- def self.create name, desc # :nodoc:
- cls = Class.new(self) do
- @name = name
- @desc = desc
-
- nuke_test_methods!
- end
-
- children << cls
-
- cls
- end
-
- def self.to_s # :nodoc:
- defined?(@name) ? @name : super
- end
-
- # :stopdoc:
- class << self
- attr_reader :desc
- alias :specify :it
- alias :name :to_s
- end
- # :startdoc:
-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/lib/mkmf.rb b/lib/mkmf.rb
index 7653cc6a43..2a83189e30 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -41,13 +41,23 @@ end
# :startdoc:
##
-# mkmf.rb is used by ruby C extensions to generate a Makefile which will
-# correctly compile and link the C extension to ruby and a third-party
+# mkmf.rb is used by Ruby C extensions to generate a Makefile which will
+# correctly compile and link the C extension to Ruby and a third-party
# library.
module MakeMakefile
+ #### defer until this module become global-state free.
+ # def self.extended(obj)
+ # obj.init_mkmf
+ # super
+ # end
+ #
+ # def initialize(*args, rbconfig: RbConfig, **rest)
+ # init_mkmf(rbconfig::MAKEFILE_CONFIG, rbconfig::CONFIG)
+ # super(*args, **rest)
+ # end
##
- # The makefile configuration using the defaults from when ruby was built.
+ # The makefile configuration using the defaults from when Ruby was built.
CONFIG = RbConfig::MAKEFILE_CONFIG
ORIG_LIBPATH = ENV['LIB']
@@ -61,7 +71,7 @@ module MakeMakefile
# Extensions for files complied with a C++ compiler
CXX_EXT = %w[cc mm cxx cpp]
- if File::FNM_SYSCASE.zero?
+ unless File.exist?(File.join(*File.split(__FILE__).tap {|d, b| b.swapcase}))
CXX_EXT.concat(%w[C])
end
@@ -189,21 +199,21 @@ module MakeMakefile
]
elsif $configure_args.has_key?('--vendor')
dirs = [
- ['BINDIR', '$(DESTDIR)$(bindir)'],
- ['RUBYCOMMONDIR', '$(DESTDIR)$(vendordir)$(target_prefix)'],
- ['RUBYLIBDIR', '$(DESTDIR)$(vendorlibdir)$(target_prefix)'],
- ['RUBYARCHDIR', '$(DESTDIR)$(vendorarchdir)$(target_prefix)'],
- ['HDRDIR', '$(DESTDIR)$(rubyhdrdir)/ruby$(target_prefix)'],
- ['ARCHHDRDIR', '$(DESTDIR)$(rubyhdrdir)/$(arch)/ruby$(target_prefix)'],
+ ['BINDIR', '$(bindir)'],
+ ['RUBYCOMMONDIR', '$(vendordir)$(target_prefix)'],
+ ['RUBYLIBDIR', '$(vendorlibdir)$(target_prefix)'],
+ ['RUBYARCHDIR', '$(vendorarchdir)$(target_prefix)'],
+ ['HDRDIR', '$(rubyhdrdir)/ruby$(target_prefix)'],
+ ['ARCHHDRDIR', '$(rubyhdrdir)/$(arch)/ruby$(target_prefix)'],
]
else
dirs = [
- ['BINDIR', '$(DESTDIR)$(bindir)'],
- ['RUBYCOMMONDIR', '$(DESTDIR)$(sitedir)$(target_prefix)'],
- ['RUBYLIBDIR', '$(DESTDIR)$(sitelibdir)$(target_prefix)'],
- ['RUBYARCHDIR', '$(DESTDIR)$(sitearchdir)$(target_prefix)'],
- ['HDRDIR', '$(DESTDIR)$(rubyhdrdir)/ruby$(target_prefix)'],
- ['ARCHHDRDIR', '$(DESTDIR)$(rubyhdrdir)/$(arch)/ruby$(target_prefix)'],
+ ['BINDIR', '$(bindir)'],
+ ['RUBYCOMMONDIR', '$(sitedir)$(target_prefix)'],
+ ['RUBYLIBDIR', '$(sitelibdir)$(target_prefix)'],
+ ['RUBYARCHDIR', '$(sitearchdir)$(target_prefix)'],
+ ['HDRDIR', '$(rubyhdrdir)/ruby$(target_prefix)'],
+ ['ARCHHDRDIR', '$(rubyhdrdir)/$(arch)/ruby$(target_prefix)'],
]
end
dirs << ['target_prefix', (target_prefix ? "/#{target_prefix}" : "")]
@@ -236,11 +246,12 @@ module MakeMakefile
abort "mkmf.rb can't find header files for ruby at #{$hdrdir}/ruby.h"
end
+ CONFTEST = "conftest".freeze
+ CONFTEST_C = "#{CONFTEST}.c"
+
OUTFLAG = CONFIG['OUTFLAG']
COUTFLAG = CONFIG['COUTFLAG']
- CPPOUTFILE = CONFIG['CPPOUTFILE']
-
- CONFTEST_C = "conftest.c".freeze
+ CPPOUTFILE = config_string('CPPOUTFILE') {|str| str.sub(/\bconftest\b/, CONFTEST)}
def rm_f(*files)
opt = (Hash === files.last ? [files.pop] : [])
@@ -353,6 +364,17 @@ module MakeMakefile
end
end
+ def libpath_env
+ # used only if native compiling
+ if libpathenv = config_string("LIBPATHENV")
+ pathenv = ENV[libpathenv]
+ libpath = RbConfig.expand($DEFLIBPATH.join(File::PATH_SEPARATOR))
+ {libpathenv => [libpath, pathenv].compact.join(File::PATH_SEPARATOR)}
+ else
+ {}
+ end
+ end
+
def xsystem command, opts = nil
varpat = /\$\((\w+)\)|\$\{(\w+)\}/
if varpat =~ command
@@ -365,12 +387,12 @@ module MakeMakefile
if opts and opts[:werror]
result = nil
Logging.postpone do |log|
- result = (system(command) and File.zero?(log.path))
+ result = (system(libpath_env, command) and File.zero?(log.path))
""
end
result
else
- system(command)
+ system(libpath_env, command)
end
end
end
@@ -383,7 +405,7 @@ module MakeMakefile
else
puts "| #{command}"
end
- IO.popen(command, *mode, &block)
+ IO.popen(libpath_env, command, *mode, &block)
end
end
@@ -441,11 +463,11 @@ MSG
xsystem(command, *opts)
ensure
log_src(src)
- MakeMakefile.rm_rf 'conftest.dSYM'
+ MakeMakefile.rm_rf "#{CONFTEST}.dSYM"
end
end
- def link_command(ldflags, opt="", libpath=$DEFLIBPATH|$LIBPATH)
+ def link_command(ldflags, opt="", libpath=$LIBPATH|$DEFLIBPATH)
librubyarg = $extmk ? $LIBRUBYARG_STATIC : "$(LIBRUBYARG)"
conf = RbConfig::CONFIG.merge('hdrdir' => $hdrdir.quote,
'src' => "#{CONFTEST_C}",
@@ -481,7 +503,7 @@ MSG
conf)
end
- def libpathflag(libpath=$DEFLIBPATH|$LIBPATH)
+ def libpathflag(libpath=$LIBPATH|$DEFLIBPATH)
libpath.map{|x|
case x
when "$(topdir)", /\A\./
@@ -517,7 +539,7 @@ MSG
end
else
try_do(src, cmd, *opts, &b)
- end and File.executable?("conftest#{$EXEEXT}")
+ end and File.executable?(CONFTEST+$EXEEXT)
end
# Returns whether or not the +src+ can be compiled as a C source and linked
@@ -533,7 +555,7 @@ MSG
def try_link(src, opt="", *opts, &b)
try_link0(src, opt, *opts, &b)
ensure
- MakeMakefile.rm_f "conftest*", "c0x32*"
+ MakeMakefile.rm_f "#{CONFTEST}*", "c0x32*"
end
# Returns whether or not the +src+ can be compiled as a C source. +opt+ is
@@ -547,9 +569,9 @@ MSG
# [+opt+] a String which contains compiler options
def try_compile(src, opt="", *opts, &b)
with_werror(opt, *opts) {|_opt, *_opts| try_do(src, cc_command(_opt), *_opts, &b)} and
- File.file?("conftest.#{$OBJEXT}")
+ File.file?("#{CONFTEST}.#{$OBJEXT}")
ensure
- MakeMakefile.rm_f "conftest*"
+ MakeMakefile.rm_f "#{CONFTEST}*"
end
# Returns whether or not the +src+ can be preprocessed with the C
@@ -563,9 +585,9 @@ MSG
# [+opt+] a String which contains preprocessor options
def try_cpp(src, opt="", *opts, &b)
try_do(src, cpp_command(CPPOUTFILE, opt), *opts, &b) and
- File.file?("conftest.i")
+ File.file?("#{CONFTEST}.i")
ensure
- MakeMakefile.rm_f "conftest*"
+ MakeMakefile.rm_f "#{CONFTEST}*"
end
alias_method :try_header, (config_string('try_header') || :try_cpp)
@@ -645,7 +667,6 @@ SRC
return nil
end
upper = 1
- lower = 0
until try_static_assert("#{const} <= #{upper}", headers, opt)
lower = upper
upper <<= 1
@@ -679,12 +700,12 @@ int main() {printf("%"PRI_CONFTEST_PREFIX"#{neg ? 'd' : 'u'}\\n", conftest_const
}
begin
if try_link0(src, opt, &b)
- xpopen("./conftest") do |f|
+ xpopen("./#{CONFTEST}") do |f|
return Integer(f.gets)
end
end
ensure
- MakeMakefile.rm_f "conftest*"
+ MakeMakefile.rm_f "#{CONFTEST}*"
end
end
nil
@@ -721,15 +742,15 @@ int main() {printf("%"PRI_CONFTEST_PREFIX"#{neg ? 'd' : 'u'}\\n", conftest_const
#{headers}
/*top*/
extern int t(void);
+#{MAIN_DOES_NOTHING 't'}
int t(void) { #{decltype["volatile p"]}; p = (#{decltype[]})#{func}; return 0; }
-#{MAIN_DOES_NOTHING "t"}
SRC
call && try_link(<<"SRC", opt, &b)
#{headers}
/*top*/
extern int t(void);
+#{MAIN_DOES_NOTHING 't'}
int t(void) { #{call}; return 0; }
-#{MAIN_DOES_NOTHING "t"}
SRC
end
@@ -740,8 +761,8 @@ SRC
#{headers}
/*top*/
extern int t(void);
+#{MAIN_DOES_NOTHING 't'}
int t(void) { const volatile void *volatile p; p = &(&#{var})[0]; return 0; }
-#{MAIN_DOES_NOTHING "t"}
SRC
end
@@ -779,7 +800,7 @@ SRC
end
end
ensure
- MakeMakefile.rm_f "conftest*"
+ MakeMakefile.rm_f "#{CONFTEST}*"
log_src(src)
end
@@ -814,13 +835,14 @@ SRC
# Returns true when the executable exits successfully, false when it fails,
# or nil when preprocessing, compilation or link fails.
def try_run(src, opt = "", &b)
+ raise "cannot run test program while cross compiling" if CROSS_COMPILING
if try_link0(src, opt, &b)
- xsystem("./conftest")
+ xsystem("./#{CONFTEST}")
else
nil
end
ensure
- MakeMakefile.rm_f "conftest*"
+ MakeMakefile.rm_f "#{CONFTEST}*"
end
def install_files(mfile, ifiles, map = nil, srcprefix = nil)
@@ -1070,12 +1092,12 @@ SRC
checking_for fw do
src = cpp_include("#{fw}/#{header}") << "\n" "int main(void){return 0;}"
opt = " -framework #{fw}"
- if try_link(src, "-ObjC#{opt}", &b)
+ if try_link(src, opt, &b) or (objc = 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" unless /(\A|\s)-ObjC(\s|\z)/ =~ $LDFLAGS
- $LDFLAGS << opt
+ $LDFLAGS << " -ObjC" if objc and /(\A|\s)-ObjC(\s|\z)/ !~ $LDFLAGS
+ $LIBS << opt
true
else
false
@@ -1132,7 +1154,7 @@ SRC
#{cpp_include(headers)}
/*top*/
int s = (char *)&((#{type}*)0)->#{member} - (char *)0;
-#{MAIN_DOES_NOTHING "s"}
+#{MAIN_DOES_NOTHING}
SRC
$defs.push(format("-DHAVE_%s_%s", type.tr_cpp, member.tr_cpp))
$defs.push(format("-DHAVE_ST_%s", member.tr_cpp)) # backward compatibility
@@ -1386,8 +1408,8 @@ SRC
/*top*/
volatile #{type} conftestval;
extern int t(void);
+#{MAIN_DOES_NOTHING 't'}
int t(void) {return (int)(1-*(conftestval#{member ? ".#{member}" : ""}));}
-#{MAIN_DOES_NOTHING "t"}
SRC
end
@@ -1399,8 +1421,8 @@ SRC
/*top*/
volatile #{type} conftestval;
extern int t(void);
+#{MAIN_DOES_NOTHING 't'}
int t(void) {return (int)(1-(conftestval#{member ? ".#{member}" : ""}));}
-#{MAIN_DOES_NOTHING "t"}
SRC
end
@@ -1654,13 +1676,28 @@ SRC
$extconf_h = header
end
- # 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.
+ # 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=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 "include" or "lib" defaults via the
- # +idefault+ and +ldefault+ parameters, respectively.
+ # 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.
#
# 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
@@ -1675,7 +1712,7 @@ SRC
idir = with_config(target + "-include", idefault)
$arg_config.last[1] ||= "${#{target}-dir}/include"
ldir = with_config(target + "-lib", ldefault)
- $arg_config.last[1] ||= "${#{target}-dir}/#{@libdir_basename}"
+ $arg_config.last[1] ||= "${#{target}-dir}/#{_libdir_basename}"
idirs = idir ? Array === idir ? idir.dup : idir.split(File::PATH_SEPARATOR) : []
if defaults
@@ -1692,7 +1729,7 @@ SRC
ldirs = ldir ? Array === ldir ? ldir.dup : ldir.split(File::PATH_SEPARATOR) : []
if defaults
- ldirs.concat(defaults.collect {|d| "#{d}/#{@libdir_basename}"})
+ ldirs.concat(defaults.collect {|d| "#{d}/#{_libdir_basename}"})
ldir = ([ldir] + ldirs).compact.join(File::PATH_SEPARATOR)
end
$LIBPATH = ldirs | $LIBPATH
@@ -1700,33 +1737,63 @@ SRC
[idir, ldir]
end
- # :stopdoc:
-
- # Handles meta information about installed libraries. Uses your platform's
- # pkg-config program if it has one.
+ # Returns compile/link information about an installed library in a
+ # tuple of <code>[cflags, ldflags, libs]</code>, by using the
+ # command found first in the following commands:
+ #
+ # 1. If <code>--with-{pkg}-config={command}</code> is given via
+ # command line option: <code>{command} {option}</code>
+ #
+ # 2. <code>{pkg}-config {option}</code>
+ #
+ # 3. <code>pkg-config {option} {pkg}</code>
+ #
+ # Where {option} is, for instance, <code>--cflags</code>.
#
- # The actual command name can be overridden by
- # <code>--with-pkg-config</code> command line option.
- def pkg_config(pkg)
+ # The values obtained are appended to +$CFLAGS+, +$LDFLAGS+ and
+ # +$libs+.
+ #
+ # If an <code>option</code> argument is given, the config command is
+ # invoked with the option and a stripped output string is returned
+ # without modifying any of the global values mentioned above.
+ 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
system("#{$PKGCONFIG} --exists #{pkg}")
# default to pkg-config command
- get = proc {|opt| `#{$PKGCONFIG} --#{opt} #{pkg}`.strip}
+ pkgconfig = $PKGCONFIG
+ get = proc {|opt|
+ opt = IO.popen("#{$PKGCONFIG} --#{opt} #{pkg}", err:[:child, :out], &:read)
+ opt.strip if $?.success?
+ }
elsif find_executable0(pkgconfig = "#{pkg}-config")
# default to package specific config command, as a last resort.
- get = proc {|opt| `#{pkgconfig} --#{opt}`.strip}
+ else
+ pkgconfig = nil
+ end
+ if pkgconfig
+ get ||= proc {|opt|
+ opt = IO.popen("#{pkgconfig} --#{opt}", err:[:child, :out], &:read)
+ opt.strip if $?.success?
+ }
end
orig_ldflags = $LDFLAGS
- if get and try_ldflags(ldflags = get['libs'])
- cflags = get['cflags']
+ 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
libs = get['libs-only-l']
ldflags = (Shellwords.shellwords(ldflags) - Shellwords.shellwords(libs)).quote.join(" ")
$CFLAGS += " " << cflags
+ $CXXFLAGS += " " << cflags
$LDFLAGS = [orig_ldflags, ldflags].join(' ')
$libs += " " << libs
Logging::message "package configuration for %s\n", pkg
@@ -1739,8 +1806,9 @@ SRC
end
end
+ # :stopdoc:
+
def with_destdir(dir)
- return dir unless $extmk
dir = dir.sub($dest_prefix_pattern, '')
/\A\$[\(\{]/ =~ dir ? dir : "$(DESTDIR)"+dir
end
@@ -1795,6 +1863,7 @@ 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}
@@ -1811,6 +1880,7 @@ 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|
@@ -1830,7 +1900,15 @@ VPATH = #{vpath.join(CONFIG['PATH_SEPARATOR'])}
end
possible_command = (proc {|s| s if /top_srcdir/ !~ s} unless $extmk)
extconf_h = $extconf_h ? "-DRUBY_EXTCONF_H=\\\"$(RUBY_EXTCONF_H)\\\" " : $defs.join(" ") << " "
- headers = %w[$(hdrdir)/ruby.h $(hdrdir)/ruby/defines.h]
+ headers = %w[
+ $(hdrdir)/ruby.h
+ $(hdrdir)/ruby/ruby.h
+ $(hdrdir)/ruby/defines.h
+ $(hdrdir)/ruby/missing.h
+ $(hdrdir)/ruby/intern.h
+ $(hdrdir)/ruby/st.h
+ $(hdrdir)/ruby/subst.h
+ ]
if RULE_SUBST
headers.each {|h| h.sub!(/.*/, &RULE_SUBST.method(:%))}
end
@@ -1858,7 +1936,7 @@ CFLAGS = $(CCDLFLAGS) #$CFLAGS $(ARCH_FLAG)
INCFLAGS = -I. #$INCFLAGS
DEFS = #{CONFIG['DEFS']}
CPPFLAGS = #{extconf_h}#{$CPPFLAGS}
-CXXFLAGS = $(CCDLFLAGS) #{CONFIG['CXXFLAGS']} $(ARCH_FLAG)
+CXXFLAGS = $(CCDLFLAGS) #$CXXFLAGS $(ARCH_FLAG)
ldflags = #{$LDFLAGS}
dldflags = #{$DLDFLAGS} #{CONFIG['EXTDLDFLAGS']}
ARCH_FLAG = #{$ARCH_FLAG}
@@ -1906,9 +1984,16 @@ preload = #{defined?($preload) && $preload ? $preload.join(' ') : ''}
mk
end
- def timestamp_file(name)
+ def timestamp_file(name, target_prefix = nil)
+ if target_prefix
+ pat = []
+ install_dirs.each do |n, d|
+ pat << n if /\$\(target_prefix\)\z/ =~ d
+ end
+ name = name.gsub(/\$\((#{pat.join("|")})\)/) {$&+target_prefix}
+ end
name = name.gsub(/(\$[({]|[})])|(\/+)|[^-.\w]+/) {$1 ? "" : $2 ? ".-." : "_"}
- "./.#{name}.time"
+ "$(TIMESTAMP_DIR)/.#{name}.time"
end
# :startdoc:
@@ -1972,6 +2057,7 @@ RULES
end
depend.each_line do |line|
line.gsub!(/\.o\b/, ".#{$OBJEXT}")
+ line.gsub!(/\{\$\(VPATH\)\}/, "") unless $nmake
line.gsub!(/\$\((?:hdr|top)dir\)\/config.h/, $config_h)
line.gsub!(%r"\$\(hdrdir\)/(?!ruby(?![^:;/\s]))(?=[-\w]+\.h)", '\&ruby/')
if $nmake && /\A\s*\$\(RM|COPY\)/ =~ line
@@ -2055,9 +2141,9 @@ RULES
#
def create_makefile(target, srcprefix = nil)
$target = target
- libpath = $DEFLIBPATH|$LIBPATH
+ libpath = $LIBPATH|$DEFLIBPATH
message "creating Makefile\n"
- MakeMakefile.rm_f "conftest*"
+ MakeMakefile.rm_f "#{CONFTEST}*"
if CONFIG["DLEXT"] == $OBJEXT
for lib in libs = $libs.split
lib.sub!(/-l(.*)/, %%"lib\\1.#{$LIBEXT}"%)
@@ -2119,6 +2205,10 @@ RULES
$distcleandirs.concat($INSTALLFILES.collect {|files, dir| dir})
end
+ if $extmk and $static
+ $defs << "-DRUBY_EXPORT=1"
+ end
+
if $extmk and not $extconf_h
create_header
end
@@ -2132,7 +2222,7 @@ RULES
conf = yield(conf) if block_given?
mfile.puts(conf)
mfile.print "
-libpath = #{($DEFLIBPATH|$LIBPATH).join(" ")}
+libpath = #{($LIBPATH|$DEFLIBPATH).join(" ")}
LIBPATH = #{libpath}
DEFFILE = #{deffile}
@@ -2156,6 +2246,7 @@ DLLIB = #{dllib}
EXTSTATIC = #{$static || ""}
STATIC_LIB = #{staticlib unless $static.nil?}
#{!$extout && defined?($installed_list) ? "INSTALLED_LIST = #{$installed_list}\n" : ""}
+TIMESTAMP_DIR = #{$extout ? '$(extout)/.timestamp' : '.'}
" #"
# TODO: fixme
install_dirs.each {|d| mfile.print("%-14s= %s\n" % d) if /^[[:upper:]]/ =~ d[0]}
@@ -2177,7 +2268,7 @@ static: $(STATIC_LIB)#{$extout ? " install-rb" : ""}
fseprepl = proc {|s|
s = s.gsub("/", fsep)
s = s.gsub(/(\$\(\w+)(\))/) {$1+sep+$2}
- s = s.gsub(/(\$\{\w+)(\})/) {$1+sep+$2}
+ s.gsub(/(\$\{\w+)(\})/) {$1+sep+$2}
}
rsep = ":#{fsep}=/"
else
@@ -2198,7 +2289,7 @@ static: $(STATIC_LIB)#{$extout ? " install-rb" : ""}
mfile.print "\t-$(Q)$(RM) #{fseprepl[dest]}\n"
mfile.print "\t-$(Q)$(RMDIRS) #{fseprepl[dir]}#{$ignore_error}\n"
else
- mfile.print "#{f} #{timestamp_file(dir)}\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"
@@ -2218,12 +2309,12 @@ static: $(STATIC_LIB)#{$extout ? " install-rb" : ""}
for dir, *files in files
unless dirs.include?(dir)
dirs << dir
- mfile.print "pre-install-rb#{sfx}: #{timestamp_file(dir)}\n"
+ mfile.print "pre-install-rb#{sfx}: #{timestamp_file(dir, target_prefix)}\n"
end
for f in files
dest = "#{dir}/#{File.basename(f)}"
mfile.print("install-rb#{sfx}: #{dest}\n")
- mfile.print("#{dest}: #{f} #{timestamp_file(dir)}\n")
+ mfile.print("#{dest}: #{f} #{timestamp_file(dir, target_prefix)}\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")
@@ -2235,7 +2326,11 @@ static: $(STATIC_LIB)#{$extout ? " install-rb" : ""}
end
end
mfile.print "pre-install-rb#{sfx}:\n"
- mfile.print("\t$(ECHO) installing#{sfx.sub(/^-/, " ")} #{target} libraries\n")
+ if files.empty?
+ mfile.print("\t@$(NULLCMD)\n")
+ else
+ mfile.print("\t$(ECHO) installing#{sfx.sub(/^-/, " ")} #{target} libraries\n")
+ end
if $extout
dirs.uniq!
unless dirs.empty?
@@ -2248,8 +2343,8 @@ static: $(STATIC_LIB)#{$extout ? " install-rb" : ""}
end
dirs.unshift(sodir) if target and !dirs.include?(sodir)
dirs.each do |d|
- t = timestamp_file(d)
- mfile.print "#{t}:\n\t$(Q) $(MAKEDIRS) #{d}\n\t$(Q) $(TOUCH) $@\n"
+ t = timestamp_file(d, target_prefix)
+ mfile.print "#{t}:\n\t$(Q) $(MAKEDIRS) $(@D) #{d}\n\t$(Q) $(TOUCH) $@\n"
end
mfile.print <<-SITEINSTALL
@@ -2284,7 +2379,7 @@ site-install-rb: install-rb
mfile.print "$(DLLIB): "
mfile.print "$(DEFFILE) " if makedef
mfile.print "$(OBJS) Makefile"
- mfile.print " #{timestamp_file('$(RUBYARCHDIR)')}" if $extout
+ mfile.print " #{timestamp_file('$(RUBYARCHDIR)', target_prefix)}" if $extout
mfile.print "\n"
mfile.print "\t$(ECHO) linking shared-object #{target_prefix.sub(/\A\/(.*)/, '\1/')}$(DLLIB)\n"
mfile.print "\t-$(Q)$(RM) $(@#{sep})\n"
@@ -2298,7 +2393,7 @@ site-install-rb: install-rb
mfile.print "$(ECHO) linking static-library $(@#{rsep})\n\t$(Q) "
mfile.print "$(AR) #{config_string('ARFLAGS') || 'cru '}$@ $(OBJS)"
config_string('RANLIB') do |ranlib|
- mfile.print "\n\t-$(Q)#{ranlib} $(DLLIB) 2> /dev/null || true"
+ mfile.print "\n\t-$(Q)#{ranlib} $(@) 2> /dev/null || true"
end
end
mfile.print "\n\n"
@@ -2338,6 +2433,7 @@ 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
@@ -2352,7 +2448,7 @@ site-install-rb: install-rb
$LIBRUBYARG = ""
$LIBRUBYARG_STATIC = config['LIBRUBYARG_STATIC']
$LIBRUBYARG_SHARED = config['LIBRUBYARG_SHARED']
- $DEFLIBPATH = [$extmk ? "$(topdir)" : "$(libdir)"]
+ $DEFLIBPATH = [$extmk ? "$(topdir)" : "$(#{config["libdirname"] || "libdir"})"]
$DEFLIBPATH.unshift(".")
$LIBPATH = []
$INSTALLFILES = []
@@ -2376,8 +2472,6 @@ site-install-rb: install-rb
$extout ||= nil
$extout_prefix ||= nil
- @libdir_basename = config["libdir"] && config["libdir"][/\A\$\(exec_prefix\)\/(.*)/, 1] or "lib"
-
$arg_config.clear
dir_config("opt")
end
@@ -2402,6 +2496,12 @@ MESSAGE
end
end
+ private
+
+ def _libdir_basename
+ @libdir_basename ||= config_string("libdir") {|name| name[/\A\$\(exec_prefix\)\/(.*)/, 1]} || "lib"
+ end
+
def MAIN_DOES_NOTHING(*refs)
src = MAIN_DOES_NOTHING
unless refs.empty?
@@ -2444,6 +2544,8 @@ 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
@@ -2464,12 +2566,12 @@ MESSAGE
end
##
- # Common headers for ruby C extensions
+ # Common headers for Ruby C extensions
COMMON_HEADERS = hdr.join("\n")
##
- # Common libraries for ruby C extensions
+ # Common libraries for Ruby C extensions
COMMON_LIBS = config_string('COMMON_LIBS', &split) || []
@@ -2493,7 +2595,7 @@ MESSAGE
# Command which will compile a program in order to test linking a library
TRY_LINK = config_string('TRY_LINK') ||
- "$(CC) #{OUTFLAG}conftest#{$EXEEXT} $(INCFLAGS) $(CPPFLAGS) " \
+ "$(CC) #{OUTFLAG}#{CONFTEST}#{$EXEEXT} $(INCFLAGS) $(CPPFLAGS) " \
"$(CFLAGS) $(src) $(LIBPATH) $(LDFLAGS) $(ARCH_FLAG) $(LOCAL_LIBS) $(LIBS)"
##
@@ -2544,7 +2646,7 @@ distclean-rb::
distclean-so::
distclean-static::
distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
-\t\t-$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
+\t\t-$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) #{CONFTEST}.* mkmf.log
\t\t-$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES#{sep})
\t\t-$(Q)$(RMDIRS) $(DISTCLEANDIRS#{sep})#{$ignore_error}
diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb
index 805321c9d1..6b452b8a75 100644
--- a/lib/net/ftp.rb
+++ b/lib/net/ftp.rb
@@ -214,7 +214,7 @@ module Net
$stderr.puts("warning: Net::FTP#return_code= is obsolete and do nothing")
end
- # Contructs a socket with +host+ and +port+.
+ # Constructs a socket with +host+ and +port+.
#
# If SOCKSSocket is defined and the environment (ENV) defines
# SOCKS_SERVER, then a SOCKSSocket is returned, else a TCPSocket is
@@ -251,8 +251,9 @@ module Net
end
#
- # WRITEME or make private
+ # Set the socket used to connect to the FTP server.
#
+ # May raise FTPReplyError if +get_greeting+ is false.
def set_socket(sock, get_greeting = true)
synchronize do
@sock = sock
@@ -310,7 +311,7 @@ module Net
end
private :getmultiline
- # Recieves a response from the destination host.
+ # Receives a response from the destination host.
#
# Returns the response code or raises FTPTempError, FTPPermError, or
# FTPProtoError
@@ -330,7 +331,7 @@ module Net
end
private :getresp
- # Recieves a response.
+ # Receives a response.
#
# Raises FTPReplyError if the first position of the response code is not
# equal 2.
@@ -419,35 +420,38 @@ module Net
end
else
sock = makeport
- if @resume and rest_offset
- resp = sendcmd("REST " + rest_offset.to_s)
- if resp[0] != ?3
+ begin
+ if @resume and rest_offset
+ resp = sendcmd("REST " + rest_offset.to_s)
+ if resp[0] != ?3
+ raise FTPReplyError, resp
+ end
+ 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
+ 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+, 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>).
+ # 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>).
#
def login(user = "anonymous", passwd = nil, acct = nil)
if user == "anonymous" and passwd == nil
@@ -897,7 +901,10 @@ module Net
end
#
- # Issues the MDTM command. TODO: more info.
+ # Returns the raw last modification time of the (remote) file in the format
+ # "YYYYMMDDhhmmss" (MDTM command).
+ #
+ # Use +mtime+ if you want a parsed Time instance.
#
def mdtm(filename)
resp = sendcmd("MDTM " + filename)
@@ -996,7 +1003,6 @@ module Net
else
raise FTPProtoError, resp
end
- return host, port
end
private :parse228
@@ -1099,13 +1105,16 @@ module Net
end
def gets
- return readuntil("\n")
- rescue EOFError
- return nil
+ line = readuntil("\n", true)
+ return line.empty? ? nil : line
end
def readline
- return readuntil("\n")
+ line = gets
+ if line.nil?
+ raise EOFError, "end of file reached"
+ end
+ return line
end
end
# :startdoc:
@@ -1115,5 +1124,3 @@ end
# Documentation comments:
# - sourced from pickaxe and nutshell, with improvements (hopefully)
-# - three methods should be private (search WRITEME)
-# - two methods need more information (search TODO)
diff --git a/lib/net/http.rb b/lib/net/http.rb
index 973998fdc3..aceb530442 100644
--- a/lib/net/http.rb
+++ b/lib/net/http.rb
@@ -266,7 +266,7 @@ module Net #:nodoc:
# response = http.request request # Net::HTTPResponse object
# end
#
- # In previous versions of ruby you would need to require 'net/https' to use
+ # In previous versions of Ruby you would need to require 'net/https' to use
# HTTPS. This is no longer true.
#
# === Proxies
@@ -334,6 +334,7 @@ module Net #:nodoc:
# HTTPResetContent:: 205
# HTTPPartialContent:: 206
# HTTPMultiStatus:: 207
+ # HTTPIMUsed:: 226
# HTTPRedirection:: 3xx
# HTTPMultipleChoices:: 300
# HTTPMovedPermanently:: 301
@@ -395,8 +396,8 @@ module Net #:nodoc:
end
# :startdoc:
- # Turns on net/http 1.2 (ruby 1.8) features.
- # Defaults to ON in ruby 1.8 or later.
+ # Turns on net/http 1.2 (Ruby 1.8) features.
+ # Defaults to ON in Ruby 1.8 or later.
def HTTP.version_1_2
true
end
@@ -671,7 +672,7 @@ module Net #:nodoc:
#
# Sets an output stream for debugging.
#
- # http = Net::HTTP.new
+ # http = Net::HTTP.new(hostname)
# http.set_debug_output $stderr
# http.start { .... }
#
@@ -686,10 +687,10 @@ module Net #:nodoc:
# The port number to connect to.
attr_reader :port
- # The local host used to estabilish the connection.
+ # The local host used to establish the connection.
attr_accessor :local_host
- # The local port used to estabilish the connection.
+ # The local port used to establish the connection.
attr_accessor :local_port
attr_writer :proxy_from_env
@@ -877,6 +878,7 @@ module Net #:nodoc:
s = Timeout.timeout(@open_timeout, Net::OpenTimeout) {
TCPSocket.open(conn_address, conn_port, @local_host, @local_port)
}
+ s.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
D "opened"
if use_ssl?
ssl_parameters = Hash.new
@@ -1024,7 +1026,9 @@ module Net #:nodoc:
# The proxy URI determined from the environment for this connection.
def proxy_uri # :nodoc:
- @proxy_uri ||= URI("http://#{address}:#{port}").find_proxy
+ @proxy_uri ||= URI::HTTP.new(
+ "http".freeze, nil, address, port, nil, nil, nil, nil, nil
+ ).find_proxy
end
# The address of the proxy server, if one is configured.
@@ -1121,7 +1125,7 @@ module Net #:nodoc:
# end
# }
#
- def get(path, initheader = {}, dest = nil, &block) # :yield: +body_segment+
+ def get(path, initheader = nil, dest = nil, &block) # :yield: +body_segment+
res = nil
request(Get.new(path, initheader)) {|r|
r.read_body dest, &block
@@ -1453,10 +1457,7 @@ module Net #:nodoc:
req['connection'] ||= 'close'
end
- host = req['host'] || address
- host = $1 if host =~ /(.*):\d+$/
- req.update_uri host, port, use_ssl?
-
+ req.update_uri address, port, use_ssl?
req['host'] ||= addr_port()
end
diff --git a/lib/net/http/generic_request.rb b/lib/net/http/generic_request.rb
index 6e79bb9c2e..00ff434ccf 100644
--- a/lib/net/http/generic_request.rb
+++ b/lib/net/http/generic_request.rb
@@ -14,19 +14,18 @@ class Net::HTTPGenericRequest
if URI === uri_or_path then
@uri = uri_or_path.dup
- host = @uri.hostname
- host += ":#{@uri.port}" if @uri.port != @uri.class::DEFAULT_PORT
- path = uri_or_path.request_uri
+ 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
else
@uri = nil
host = nil
- path = uri_or_path
+ 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
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 +43,7 @@ class Net::HTTPGenericRequest
initialize_http_header initheader
self['Accept'] ||= '*/*'
self['User-Agent'] ||= 'Ruby'
- self['Host'] ||= host
+ self['Host'] ||= host if host
@body = nil
@body_stream = nil
@body_data = nil
@@ -117,15 +116,6 @@ 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
@@ -137,21 +127,34 @@ class Net::HTTPGenericRequest
end
end
- def update_uri(host, port, ssl) # :nodoc: internal use only
+ def update_uri(addr, port, ssl) # :nodoc: internal use only
+ # reflect the connection and @path to @uri
return unless @uri
- @uri.host ||= host
- @uri.port = port
-
- scheme = ssl ? 'https' : 'http'
+ if ssl
+ scheme = 'https'.freeze
+ klass = URI::HTTPS
+ else
+ scheme = 'http'.freeze
+ klass = URI::HTTP
+ end
+ if host = self['host']
+ host.sub!(/:.*/s, ''.freeze)
+ elsif host = @uri.host
+ else
+ host = addr
+ end
# convert the class of the URI
- unless scheme == @uri.scheme then
- new_uri = @uri.to_s.sub(/^https?/, scheme)
- @uri = URI new_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)
end
-
- @uri
end
private
@@ -282,7 +285,7 @@ class Net::HTTPGenericRequest
def quote_string(str, charset)
str = str.encode(charset, fallback:->(c){'&#%d;'%c.encode("UTF-8").ord}) if charset
- str = str.gsub(/[\\"]/, '\\\\\&')
+ str.gsub(/[\\"]/, '\\\\\&')
end
def flush_buffer(out, buf, chunked_p)
diff --git a/lib/net/http/header.rb b/lib/net/http/header.rb
index 7e46e04395..912419df55 100644
--- a/lib/net/http/header.rb
+++ b/lib/net/http/header.rb
@@ -145,11 +145,11 @@ module Net::HTTPHeader
@header.key?(key.downcase)
end
- # Returns a Hash consisting of header names and values.
+ # Returns a Hash consisting of header names and array of 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
@@ -237,7 +237,7 @@ module Net::HTTPHeader
rangestr = (n > 0 ? "0-#{n-1}" : "-#{-n}")
when Range
first = r.first
- last = r.last
+ last = r.end
last -= 1 if r.exclude_end?
if last == -1
rangestr = (first > 0 ? "#{first}-" : "-#{-first}")
diff --git a/lib/net/http/requests.rb b/lib/net/http/requests.rb
index ef719ea6e7..c1f8360479 100644
--- a/lib/net/http/requests.rb
+++ b/lib/net/http/requests.rb
@@ -46,7 +46,7 @@ end
class Net::HTTP::Options < Net::HTTPRequest
METHOD = 'OPTIONS'
REQUEST_HAS_BODY = false
- RESPONSE_HAS_BODY = false
+ RESPONSE_HAS_BODY = true
end
# See Net::HTTPGenericRequest for attributes and methods.
diff --git a/lib/net/http/response.rb b/lib/net/http/response.rb
index da3e4b4c8c..777aca9e45 100644
--- a/lib/net/http/response.rb
+++ b/lib/net/http/response.rb
@@ -259,7 +259,12 @@ class Net::HTTPResponse
begin
yield inflate_body_io
ensure
- inflate_body_io.finish
+ e = $!
+ begin
+ inflate_body_io.finish
+ rescue
+ raise e
+ end
end
when 'none', 'identity' then
self.delete 'content-encoding'
@@ -301,7 +306,6 @@ 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
@@ -364,6 +368,11 @@ 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 38a5da2443..1454a27a3e 100644
--- a/lib/net/http/responses.rb
+++ b/lib/net/http/responses.rb
@@ -57,7 +57,9 @@ class Net::HTTPMultiStatus < Net::HTTPSuccess # 207 - RFC 4918
HAS_BODY = true
end
# 208 Already Reported - RFC 5842; experimental
-# 226 IM Used - RFC 3229; no famous implementation known
+class Net::HTTPIMUsed < Net::HTTPSuccess # 226 - RFC 3229
+ HAS_BODY = true
+end
class Net::HTTPMultipleChoices < Net::HTTPRedirection # 300
HAS_BODY = true
@@ -83,7 +85,9 @@ end
class Net::HTTPTemporaryRedirect < Net::HTTPRedirection # 307
HAS_BODY = true
end
-# 308 Permanent Redirect - in draft
+class Net::HTTPPermanentRedirect < Net::HTTPRedirection # 308
+ HAS_BODY = true
+end
class Net::HTTPBadRequest < Net::HTTPClientError # 400
HAS_BODY = true
@@ -218,6 +222,7 @@ class Net::HTTPResponse
'205' => Net::HTTPResetContent,
'206' => Net::HTTPPartialContent,
'207' => Net::HTTPMultiStatus,
+ '226' => Net::HTTPIMUsed,
'300' => Net::HTTPMultipleChoices,
'301' => Net::HTTPMovedPermanently,
diff --git a/lib/net/imap.rb b/lib/net/imap.rb
index 0ae47c5316..85644f388c 100644
--- a/lib/net/imap.rb
+++ b/lib/net/imap.rb
@@ -37,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 a files in mailbox format
+ # will frequently be implemented as files in mailbox format
# within a hierarchy of directories.
#
# To work on the messages within a mailbox, the client must
@@ -48,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 mail box
- # from 1 up to the number of items in the mail box. If new
+ # Message sequence numbers number messages within a mailbox
+ # from 1 up to the number of items in the mailbox. If a new
# message arrives during a session, it receives a sequence
- # number equal to the new size of the mail box. If messages
+ # number equal to the new size of the mailbox. If messages
# are expunged from the mailbox, remaining messages have their
# sequence numbers "shuffled down" to fill the gaps.
#
@@ -63,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 cannot thus
+ # UIDs have to be reassigned. An IMAP client thus cannot
# rearrange message orders.
#
# == Examples of Usage
@@ -113,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 exists; etc.
+ # the selected mailbox does not exist; etc.
#
# BAD:: the request from the client does not follow the server's
# understanding of the IMAP protocol. This includes attempting
@@ -125,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 our connection. As a response to any other command,
+ # to accept your 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.
#
@@ -223,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
@@ -240,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
@@ -386,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 authentication mechanisms:
+ # supports the authentication mechanisms:
#
# LOGIN:: login using cleartext user and password.
# CRAM-MD5:: login with cleartext user and encrypted password
@@ -394,8 +394,8 @@ module Net
# mechanism requires that the server have the user's
# password stored in clear-text password.
#
- # For both these mechanisms, there should be two +args+: username
- # and (cleartext) password. A server may not support one or other
+ # For both of these mechanisms, there should be two +args+: username
+ # and (cleartext) password. A server may not support one or the other
# of these mechanisms; check #capability() for a capability of
# the form "AUTH=LOGIN" or "AUTH=CRAM-MD5".
#
@@ -500,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
@@ -509,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)
@@ -576,9 +576,9 @@ module Net
end
end
- # Sends the GETQUOTAROOT command along with specified +mailbox+.
+ # Sends the GETQUOTAROOT command along with the specified +mailbox+.
# This command is generally available to both admin and user.
- # If mailbox exists, returns an array containing objects of
+ # If this mailbox exists, it returns an array containing objects of type
# Net::IMAP::MailboxQuotaRoot and Net::IMAP::MailboxQuota.
def getquotaroot(mailbox)
synchronize do
@@ -593,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 generally is only available to server admin.
+ # command is generally only available to server admin.
def getquota(mailbox)
synchronize do
send_command("GETQUOTA", mailbox)
@@ -602,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 server admin
+ # +quota+. If +quota+ is nil, then +quota+ will be unset for that
+ # mailbox. Typically one needs to be logged in as a server admin
# for this to work. The IMAP quota commands are described in
# [RFC-2087].
def setquota(mailbox, quota)
@@ -627,7 +627,7 @@ module Net
end
end
- # Send the GETACL command along with specified +mailbox+.
+ # Send the GETACL command along with a specified +mailbox+.
# If this mailbox exists, an array containing objects of
# Net::IMAP::MailboxACLItem will be returned.
def getacl(mailbox)
@@ -639,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)
@@ -650,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 that
- # we are request the status of. Supported attributes include:
+ # +mailbox+. +attr+ is a list of one or more attributes whose
+ # statuses are to be requested. Supported attributes include:
#
# MESSAGES:: the number of messages in the mailbox.
# RECENT:: the number of recent messages in the mailbox.
@@ -663,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
@@ -674,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 to initially passing to the new message. The optional
+ # flags initially passed 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:
@@ -702,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")
@@ -768,18 +768,28 @@ module Net
return search_internal("SEARCH", keys, charset)
end
- # As for #search(), but returns unique identifiers.
+ # Similar to #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 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:
+ # 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 repesents 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. For
+ # example:
#
# p imap.fetch(6..8, "UID")
# #=> [#<Net::IMAP::FetchData seqno=6, attr={"UID"=>98}>, \\
@@ -800,18 +810,18 @@ module Net
return fetch_internal("FETCH", set, attr)
end
- # As for #fetch(), but +set+ contains unique identifiers.
+ # Similar to #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 or an array of numbers or a Range object. Each number
+ # is a number, 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' 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.
+ # 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.
#
# The return value is an array of Net::IMAP::FetchData. For example:
#
@@ -823,20 +833,20 @@ module Net
return store_internal("STORE", set, attr, flags)
end
- # As for #store(), but +set+ contains unique identifiers.
+ # Similar to #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 or an array of numbers or a Range object. The number is
+ # a number, 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
- # As for #copy(), but +set+ contains unique identifiers.
+ # Similar to #copy(), but +set+ contains unique identifiers.
def uid_copy(set, mailbox)
copy_internal("UID COPY", set, mailbox)
end
@@ -854,16 +864,16 @@ module Net
return sort_internal("SORT", sort_keys, search_keys, charset)
end
- # As for #sort(), but returns an array of unique identifiers.
+ # Similar to #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 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.
+ # 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:
#
# imap.add_response_handler { |resp|
# if resp.kind_of?(Net::IMAP::UntaggedResponse) and resp.name == "EXISTS"
@@ -880,7 +890,7 @@ module Net
@response_handlers.delete(handler)
end
- # As for #search(), but returns message sequence numbers in threaded
+ # Similar to #search(), but returns message sequence numbers in threaded
# format, as a Net::IMAP::ThreadMember tree. The supported algorithms
# are:
#
@@ -897,7 +907,7 @@ module Net
return thread_internal("THREAD", algorithm, search_keys, charset)
end
- # As for #thread(), but returns unique identifiers instead of
+ # Similar to #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)
@@ -953,7 +963,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 utf7.
+ # mailbox names to and from UTF-7.
def self.decode_utf7(s)
return s.gsub(/&([^-]+)?-/n) {
if $1
@@ -1006,24 +1016,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:: we connected to the host, but they
- # immediately said goodbye to us.
+ # 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.
def initialize(host, port_or_options = {},
usessl = false, certs = nil, verify = true)
super()
@@ -1043,40 +1053,43 @@ module Net
@tagno = 0
@parser = ResponseParser.new
@sock = TCPSocket.open(@host, @port)
- 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 ByeResponseError, @greeting
- end
+ 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
- @client_thread = Thread.current
- @receiver_thread = Thread.start {
- begin
- receive_responses
- rescue Exception
+ @greeting = get_response
+ if @greeting.nil?
+ raise Error, "connection closed"
end
- }
- @receiver_thread_terminating = false
+ 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
+ @sock.close
+ raise
+ end
end
def receive_responses
@@ -1608,10 +1621,10 @@ module Net
#
# ==== Fields:
#
- # name:: Returns the name such as "FLAGS", "LIST", "FETCH"....
+ # name:: Returns the name, such as "FLAGS", "LIST", or "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)
@@ -1632,7 +1645,7 @@ module Net
#
# tag:: Returns the tag.
#
- # name:: Returns the name. the name is one of "OK", "NO", "BAD".
+ # name:: Returns the name, one of "OK", "NO", or "BAD".
#
# data:: Returns the data. See ((<Net::IMAP::ResponseText>)).
#
@@ -1654,7 +1667,6 @@ module Net
#
ResponseText = Struct.new(:code, :text)
- #
# Net::IMAP::ResponseCode represents response codes.
#
# resp_text_code ::= "ALERT" / "PARSE" /
@@ -1666,9 +1678,9 @@ module Net
#
# ==== Fields:
#
- # name:: Returns the name such as "ALERT", "PERMANENTFLAGS", "UIDVALIDITY"....
+ # name:: Returns the name, such as "ALERT", "PERMANENTFLAGS", or "UIDVALIDITY".
#
- # data:: Returns the data if it exists.
+ # data:: Returns the data, if it exists.
#
ResponseCode = Struct.new(:name, :data)
@@ -1683,7 +1695,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.
#
@@ -1704,9 +1716,9 @@ module Net
#
# mailbox:: The mailbox with the associated quota.
#
- # usage:: Current storage usage of mailbox.
+ # usage:: Current storage usage of the mailbox.
#
- # quota:: Quota limit imposed on mailbox.
+ # quota:: Quota limit imposed on the mailbox.
#
MailboxQuota = Struct.new(:mailbox, :usage, :quota)
@@ -1719,12 +1731,12 @@ module Net
#
# mailbox:: The mailbox with the associated quota.
#
- # quotaroots:: Zero or more quotaroots that effect the quota on the
+ # quotaroots:: Zero or more quotaroots that affect the quota on the
# specified mailbox.
#
MailboxQuotaRoot = Struct.new(:mailbox, :quotaroots)
- # Net::IMAP::MailboxACLItem represents response from GETACL.
+ # Net::IMAP::MailboxACLItem represents the response from GETACL.
#
# acl_data ::= "ACL" SPACE mailbox *(SPACE identifier SPACE rights)
#
@@ -1742,7 +1754,7 @@ module Net
#
MailboxACLItem = Struct.new(:user, :rights, :mailbox)
- # Net::IMAP::StatusData represents contents of the STATUS response.
+ # Net::IMAP::StatusData represents the contents of the STATUS response.
#
# ==== Fields:
#
@@ -1753,7 +1765,7 @@ module Net
#
StatusData = Struct.new(:mailbox, :attr)
- # Net::IMAP::FetchData represents contents of the FETCH response.
+ # Net::IMAP::FetchData represents the contents of the FETCH response.
#
# ==== Fields:
#
@@ -1777,7 +1789,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.
@@ -1832,7 +1844,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.
@@ -1852,14 +1864,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)
@@ -2372,6 +2384,8 @@ 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
@@ -2411,27 +2425,26 @@ module Net
match(T_SPACE)
param, content_id, desc, enc, size = body_fields
- # If this is not message/rfc822, we shouldn't apply the RFC822 spec
- # to it.
- # We should handle anything other than message/rfc822 using
- # multipart extension data [rfc3501] (i.e. the data itself won't be
- # returned, we would have to retrieve it with BODYSTRUCTURE instead
- # of with BODY
- if "#{mtype}/#{msubtype}" != 'MESSAGE/RFC822' then
- return BodyTypeExtension.new(mtype, msubtype,
- param, content_id,
- desc, enc, size)
- end
-
- # Also, sometimes a message/rfc822 is included as a large
- # attachment instead of having all of the other details
- # (e.g. attaching a .eml file to an email)
-
token = lookahead
- if token.symbol == T_RPAR then
- return BodyTypeMessage.new(mtype, msubtype, param, content_id,
- desc, enc, size, nil, nil, nil, nil,
- nil, nil, nil)
+ if token.symbol == T_RPAR
+ # If this is not message/rfc822, we shouldn't apply the RFC822
+ # spec to it. We should handle anything other than
+ # message/rfc822 using multipart extension data [rfc3501] (i.e.
+ # the data itself won't be returned, we would have to retrieve it
+ # with BODYSTRUCTURE instead of with BODY
+
+ # Also, sometimes a message/rfc822 is included as a large
+ # attachment instead of having all of the other details
+ # (e.g. attaching a .eml file to an email)
+ if msubtype == "RFC822"
+ return BodyTypeMessage.new(mtype, msubtype, param, content_id,
+ desc, enc, size, nil, nil, nil, nil,
+ nil, nil, nil)
+ else
+ return BodyTypeExtension.new(mtype, msubtype,
+ param, content_id,
+ desc, enc, size)
+ end
end
match(T_SPACE)
@@ -2455,6 +2468,13 @@ 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
@@ -3062,39 +3082,6 @@ 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
@@ -3589,174 +3576,3 @@ 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 74a53951c7..db7192c95a 100644
--- a/lib/net/pop.rb
+++ b/lib/net/pop.rb
@@ -707,7 +707,7 @@ module Net
@mails.each {|m| m.uid = uidl[m.number] }
end
- # deguging output for +msg+
+ # debugging output for +msg+
def logging(msg)
@debug_output << msg + "\n" if @debug_output
end
@@ -889,7 +889,7 @@ module Net
def initialize(sock)
@socket = sock
- @error_occured = false
+ @error_occurred = false
res = check_response(critical { recv_response() })
@apop_stamp = res.slice(/<[!-~]+@[!-~]+>/)
end
@@ -1007,11 +1007,11 @@ module Net
end
def critical
- return '+OK dummy ok response' if @error_occured
+ return '+OK dummy ok response' if @error_occurred
begin
return yield()
rescue Exception
- @error_occured = true
+ @error_occurred = true
raise
end
end
diff --git a/lib/net/protocol.rb b/lib/net/protocol.rb
index 14a68e1115..25477014fb 100644
--- a/lib/net/protocol.rb
+++ b/lib/net/protocol.rb
@@ -267,7 +267,7 @@ module Net # :nodoc:
def write_message_0(src)
prev = @written_bytes
each_crlf_line(src) do |line|
- write0 line.sub(/\A\./, '..')
+ write0 dot_stuff(line)
end
@written_bytes - prev
end
@@ -308,11 +308,15 @@ 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 @wbuf.chomp + "\r\n"
+ write0 dot_stuff(@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 6915d81711..64e536a12a 100644
--- a/lib/net/smtp.rb
+++ b/lib/net/smtp.rb
@@ -76,8 +76,9 @@ 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. You can get both libraries from RAA.
- # (http://www.ruby-lang.org/en/raa.html)
+ # try RubyMail or TMail or search for alternatives in
+ # {RubyGems.org}[https://rubygems.org/] or {The Ruby
+ # Toolbox}[https://www.ruby-toolbox.com/].
#
# FYI: the official documentation on internet mail is: [RFC2822] (http://www.ietf.org/rfc/rfc2822.txt).
#
@@ -215,7 +216,7 @@ module Net
@started = false
@open_timeout = 30
@read_timeout = 60
- @error_occured = false
+ @error_occurred = false
@debug_output = nil
@tls = false
@starttls = false
@@ -605,17 +606,17 @@ module Net
rescue SMTPError
if @esmtp
@esmtp = false
- @error_occured = false
+ @error_occurred = false
retry
end
raise
end
def do_finish
- quit if @socket and not @socket.closed? and not @error_occured
+ quit if @socket and not @socket.closed? and not @error_occurred
ensure
@started = false
- @error_occured = false
+ @error_occurred = false
@socket.close if @socket and not @socket.closed?
@socket = nil
end
@@ -815,6 +816,12 @@ module Net
public
+ # Aborts the current mail transaction
+
+ def rset
+ getok('RSET')
+ end
+
def starttls
getok('STARTTLS')
end
@@ -894,10 +901,17 @@ module Net
end
res = critical {
check_continue get_response('DATA')
- if msgstr
- @socket.write_message msgstr
- else
- @socket.write_message_by_block(&block)
+ 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
end
recv_response()
}
@@ -936,11 +950,11 @@ module Net
end
def critical
- return '200 dummy reply code' if @error_occured
+ return Response.parse('200 dummy reply code') if @error_occurred
begin
return yield()
rescue Exception
- @error_occured = true
+ @error_occurred = true
raise
end
end
@@ -1035,7 +1049,7 @@ module Net
h
end
- # Determines whether there was an error and raies the appropriate error
+ # Determines whether there was an error and raises 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
index 3c5d6e8e73..2260e7fb10 100644
--- a/lib/net/telnet.rb
+++ b/lib/net/telnet.rb
@@ -371,7 +371,7 @@ module Net
# 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
+ attr_reader :sock
# Set telnet command interpretation on (+mode+ == true) or off
# (+mode+ == false), or return the current value (+mode+ not
diff --git a/lib/observer.rb b/lib/observer.rb
index 208d8ed6ed..10f2eb0db5 100644
--- a/lib/observer.rb
+++ b/lib/observer.rb
@@ -15,13 +15,14 @@
# module, which provides the methods for managing the associated observer
# objects.
#
-# The observers must implement a method called +update+ to receive
-# notifications.
-#
# The observable object must:
# * assert that it has +#changed+
# * call +#notify_observers+
#
+# An observer subscribes to updates using Observable#add_observer, which also
+# specifies the method called via #notify_observers. The default method for
+# #notify_observers is #update.
+#
# === Example
#
# The following example demonstrates this nicely. A +Ticker+, when run,
@@ -49,13 +50,13 @@
# end
#
# def run
-# lastPrice = nil
+# last_price = nil
# loop do
# price = Price.fetch(@symbol)
# print "Current price: #{price}\n"
-# if price != lastPrice
+# if price != last_price
# changed # notify observers
-# lastPrice = price
+# last_price = price
# notify_observers(Time.now, price)
# end
# sleep 1
@@ -64,7 +65,7 @@
# end
#
# class Price ### A mock class to fetch a stock price (60 - 140).
-# def Price.fetch(symbol)
+# def self.fetch(symbol)
# 60 + rand(80)
# end
# end
@@ -126,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.to_s}'"
+ raise NoMethodError, "observer does not respond to `#{func}'"
end
@observer_peers[observer] = func
end
diff --git a/lib/open-uri.rb b/lib/open-uri.rb
index 47a9b90fd0..b793828063 100644
--- a/lib/open-uri.rb
+++ b/lib/open-uri.rb
@@ -73,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/raa.html", :proxy => nil) {|f|
+# open("http://www.ruby-lang.org/en/", :proxy => nil) {|f|
# # ...
# }
#
@@ -155,7 +155,7 @@ module OpenURI
if io.respond_to? :close!
io.close! # Tempfile
else
- io.close
+ io.close if !io.closed?
end
end
else
@@ -256,8 +256,7 @@ module OpenURI
raise "Non-HTTP proxy URI: #{proxy_uri}" if proxy_uri.class != URI::HTTP
end
- if target.userinfo && "1.9.0" <= RUBY_VERSION
- # don't raise for 1.8 because compatibility.
+ if target.userinfo
raise ArgumentError, "userinfo not supported. [RFC3986]"
end
@@ -288,7 +287,7 @@ module OpenURI
end
end
- http = klass.new(target_host, target_port)
+ http = proxy ? klass.new(target_host, target_port) : klass.new(target_host, target_port, nil)
if target.class == URI::HTTPS
require 'net/https'
http.use_ssl = true
@@ -336,7 +335,7 @@ module OpenURI
io = buf.io
io.rewind
io.status = [resp.code, resp.message]
- resp.each {|name,value| buf.io.meta_add_field name, value }
+ resp.each_name {|name| buf.io.meta_add_field2 name, resp.get_fields(name) }
case resp
when Net::HTTPSuccess
when Net::HTTPMovedPermanently, # 301
@@ -405,13 +404,14 @@ module OpenURI
obj.extend Meta
obj.instance_eval {
@base_uri = nil
- @meta = {}
+ @meta = {} # name to string. legacy.
+ @metas = {} # name to array of strings.
}
if src
obj.status = src.status
obj.base_uri = src.base_uri
- src.meta.each {|name, value|
- obj.meta_add_field(name, value)
+ src.metas.each {|name, values|
+ obj.meta_add_field2(name, values)
}
end
end
@@ -425,8 +425,16 @@ module OpenURI
# returns a Hash that represents header fields.
# The Hash keys are downcased for canonicalization.
+ # The Hash values are a field body.
+ # If there are multiple field with same field name,
+ # the field values are concatenated with a comma.
attr_reader :meta
+ # returns a Hash that represents header fields.
+ # The Hash keys are downcased for canonicalization.
+ # The Hash value are an array of field values.
+ attr_reader :metas
+
def meta_setup_encoding # :nodoc:
charset = self.charset
enc = nil
@@ -446,15 +454,21 @@ module OpenURI
end
end
- def meta_add_field(name, value) # :nodoc:
+ def meta_add_field2(name, values) # :nodoc:
name = name.downcase
- @meta[name] = value
+ @metas[name] = values
+ @meta[name] = values.join(', ')
meta_setup_encoding if name == 'content-type'
end
+ def meta_add_field(name, value) # :nodoc:
+ meta_add_field2(name, [value])
+ end
+
# returns a Time that represents the Last-Modified field.
def last_modified
- if v = @meta['last-modified']
+ if vs = @metas['last-modified']
+ v = vs.join(', ')
Time.httpdate(v)
else
nil
@@ -469,9 +483,9 @@ module OpenURI
# :startdoc:
def content_type_parse # :nodoc:
- v = @meta['content-type']
+ vs = @metas['content-type']
# The last (?:;#{RE_LWS}?)? matches extra ";" which violates RFC2045.
- if v && %r{\A#{RE_LWS}?(#{RE_TOKEN})#{RE_LWS}?/(#{RE_TOKEN})#{RE_LWS}?(#{RE_PARAMETERS})(?:;#{RE_LWS}?)?\z}no =~ v
+ if vs && %r{\A#{RE_LWS}?(#{RE_TOKEN})#{RE_LWS}?/(#{RE_TOKEN})#{RE_LWS}?(#{RE_PARAMETERS})(?:;#{RE_LWS}?)?\z}no =~ vs.join(', ')
type = $1.downcase
subtype = $2.downcase
parameters = []
@@ -519,12 +533,13 @@ module OpenURI
end
end
- # returns a list of encodings in Content-Encoding field
- # as an Array of String.
+ # Returns a list of encodings in Content-Encoding field as an array of
+ # strings.
+ #
# The encodings are downcased for canonicalization.
def content_encoding
- v = @meta['content-encoding']
- if v && %r{\A#{RE_LWS}?#{RE_TOKEN}#{RE_LWS}?(?:,#{RE_LWS}?#{RE_TOKEN}#{RE_LWS}?)*}o =~ v
+ vs = @metas['content-encoding']
+ if vs && %r{\A#{RE_LWS}?#{RE_TOKEN}#{RE_LWS}?(?:,#{RE_LWS}?#{RE_TOKEN}#{RE_LWS}?)*}o =~ (v = vs.join(', '))
v.scan(RE_TOKEN).map {|content_coding| content_coding.downcase}
else
[]
diff --git a/lib/open3.rb b/lib/open3.rb
index 1ee014d8a9..e80b1cd385 100644
--- a/lib/open3.rb
+++ b/lib/open3.rb
@@ -9,29 +9,29 @@
#
#
-# Open3 grants you access to stdin, stdout, stderr and a thread to wait the
+# Open3 grants you access to stdin, stdout, stderr and a thread to wait for the
# child process when running another program.
# You can specify various attributes, redirections, current directory, etc., of
-# the program as Process.spawn.
+# the program in the same way as for Process.spawn.
#
# - Open3.popen3 : pipes for stdin, stdout, stderr
# - Open3.popen2 : pipes for stdin, stdout
# - Open3.popen2e : pipes for stdin, merged stdout and stderr
-# - Open3.capture3 : give a string for stdin. get strings for stdout, stderr
-# - Open3.capture2 : give a string for stdin. get a string for stdout
-# - Open3.capture2e : give a string for stdin. get a string for merged stdout and stderr
+# - Open3.capture3 : give a string for stdin; get strings for stdout, stderr
+# - Open3.capture2 : give a string for stdin; get a string for stdout
+# - Open3.capture2e : give a string for stdin; get a string for merged stdout and stderr
# - Open3.pipeline_rw : pipes for first stdin and last stdout of a pipeline
# - Open3.pipeline_r : pipe for last stdout of a pipeline
# - Open3.pipeline_w : pipe for first stdin of a pipeline
-# - Open3.pipeline_start : run a pipeline and don't wait
-# - Open3.pipeline : run a pipeline and wait
+# - Open3.pipeline_start : run a pipeline without waiting
+# - Open3.pipeline : run a pipeline and wait for its completion
#
module Open3
# Open stdin, stdout, and stderr streams and start external executable.
- # In addition, a thread for waiting the started process is noticed.
- # The thread has a pid method and thread variable :pid which is the pid of
+ # In addition, a thread to wait for the started process is created.
+ # The thread has a pid method and a thread variable :pid which is the pid of
# the started process.
#
# Block form:
@@ -45,15 +45,15 @@ module Open3
# Non-block form:
#
# stdin, stdout, stderr, wait_thr = Open3.popen3([env,] cmd... [, opts])
- # pid = wait_thr[:pid] # pid of the started process.
+ # pid = wait_thr[:pid] # pid of the started process
# ...
# stdin.close # stdin, stdout and stderr should be closed explicitly in this form.
# stdout.close
# stderr.close
# exit_status = wait_thr.value # Process::Status object returned.
#
- # The parameters +cmd...+ is passed to Process.spawn.
- # So a commandline string and list of argument strings can be accepted as follows.
+ # The parameters env, cmd, and opts are passed to Process.spawn.
+ # A commandline string and a list of argument strings can be accepted as follows:
#
# Open3.popen3("echo abc") {|i, o, e, t| ... }
# Open3.popen3("echo", "abc") {|i, o, e, t| ... }
@@ -65,27 +65,21 @@ module Open3
# p o.read.chomp #=> "/"
# }
#
- # wait_thr.value waits the termination of the process.
- # The block form also waits the process when it returns.
+ # wait_thr.value waits for the termination of the process.
+ # The block form also waits for the process when it returns.
#
- # Closing stdin, stdout and stderr does not wait the process.
+ # Closing stdin, stdout and stderr does not wait for the process to complete.
#
# You should be careful to avoid deadlocks.
- # Since pipes are fixed length buffer,
+ # Since pipes are fixed length buffers,
# Open3.popen3("prog") {|i, o, e, t| o.read } deadlocks if
- # the program generates many output on stderr.
- # You should be read stdout and stderr simultaneously (using thread or IO.select).
- # However if you don't need stderr output, Open3.popen2 can be used.
+ # the program generates too much output on stderr.
+ # You should read stdout and stderr simultaneously (using threads or IO.select).
+ # However, if you don't need stderr output, you can use Open3.popen2.
# If merged stdout and stderr output is not a problem, you can use Open3.popen2e.
- # If you really needs stdout and stderr output as separate strings, you can consider Open3.capture3.
+ # If you really need stdout and stderr output as separate strings, you can consider Open3.capture3.
#
- def popen3(*cmd, &block)
- if Hash === cmd.last
- opts = cmd.pop.dup
- else
- opts = {}
- end
-
+ def popen3(*cmd, **opts, &block)
in_r, in_w = IO.pipe
opts[:in] = in_r
in_w.sync = true
@@ -100,7 +94,7 @@ module Open3
end
module_function :popen3
- # Open3.popen2 is similer to Open3.popen3 except it doesn't make a pipe for
+ # Open3.popen2 is similar to Open3.popen3 except that it doesn't create a pipe for
# the standard error stream.
#
# Block form:
@@ -140,13 +134,7 @@ module Open3
# p o.read #=> "*"
# }
#
- def popen2(*cmd, &block)
- if Hash === cmd.last
- opts = cmd.pop.dup
- else
- opts = {}
- end
-
+ def popen2(*cmd, **opts, &block)
in_r, in_w = IO.pipe
opts[:in] = in_r
in_w.sync = true
@@ -158,7 +146,7 @@ module Open3
end
module_function :popen2
- # Open3.popen2e is similer to Open3.popen3 except it merges
+ # Open3.popen2e is similar to Open3.popen3 except that it merges
# the standard output stream and the standard error stream.
#
# Block form:
@@ -189,13 +177,7 @@ module Open3
# }
# }
#
- def popen2e(*cmd, &block)
- if Hash === cmd.last
- opts = cmd.pop.dup
- else
- opts = {}
- end
-
+ def popen2e(*cmd, **opts, &block)
in_r, in_w = IO.pipe
opts[:in] = in_r
in_w.sync = true
@@ -238,7 +220,7 @@ module Open3
#
# If opts[:binmode] is true, internal pipes are set to binary mode.
#
- # Example:
+ # Examples:
#
# # dot is a command of graphviz.
# graph = <<'End'
@@ -246,36 +228,27 @@ module Open3
# a -> b
# }
# End
- # layouted_graph, dot_log = Open3.capture3("dot -v", :stdin_data=>graph)
+ # drawn_graph, dot_log = Open3.capture3("dot -v", :stdin_data=>graph)
#
# o, e, s = Open3.capture3("echo abc; sort >&2", :stdin_data=>"foo\nbar\nbaz\n")
# p o #=> "abc\n"
# p e #=> "bar\nbaz\nfoo\n"
# p s #=> #<Process::Status: pid 32682 exit 0>
#
- # # generate a thumnail image using the convert command of ImageMagick.
- # # However, if the image stored really in a file,
+ # # generate a thumbnail 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 memory consumption.
- # # But if the image is stored in a DB or generated by gnuplot Open3.capture2 example,
- # # Open3.capture3 is considerable.
+ # # because of reduced memory consumption.
+ # # But if the image is stored in a DB or generated by the gnuplot Open3.capture2 example,
+ # # Open3.capture3 should be considered.
# #
# image = File.read("/usr/share/openclipart/png/animals/mammals/sheep-md-v0.1.png", :binmode=>true)
- # thumnail, err, s = Open3.capture3("convert -thumbnail 80 png:- png:-", :stdin_data=>image, :binmode=>true)
+ # thumbnail, err, s = Open3.capture3("convert -thumbnail 80 png:- png:-", :stdin_data=>image, :binmode=>true)
# if s.success?
- # STDOUT.binmode; print thumnail
+ # STDOUT.binmode; print thumbnail
# end
#
- def capture3(*cmd)
- if Hash === cmd.last
- opts = cmd.pop.dup
- else
- opts = {}
- end
-
- stdin_data = opts.delete(:stdin_data) || ''
- binmode = opts.delete(:binmode)
-
+ def capture3(*cmd, stdin_data: '', binmode: false, **opts)
popen3(*cmd, opts) {|i, o, e, t|
if binmode
i.binmode
@@ -284,7 +257,10 @@ module Open3
end
out_reader = Thread.new { o.read }
err_reader = Thread.new { e.read }
- i.write stdin_data
+ begin
+ i.write stdin_data
+ rescue Errno::EPIPE
+ end
i.close
[out_reader.value, err_reader.value, t.value]
}
@@ -320,23 +296,19 @@ module Open3
# End
# image, s = Open3.capture2("gnuplot", :stdin_data=>gnuplot_commands, :binmode=>true)
#
- def capture2(*cmd)
- if Hash === cmd.last
- opts = cmd.pop.dup
- else
- opts = {}
- end
-
- stdin_data = opts.delete(:stdin_data) || ''
- binmode = opts.delete(:binmode)
-
+ def capture2(*cmd, stdin_data: nil, binmode: false, **opts)
popen2(*cmd, opts) {|i, o, t|
if binmode
i.binmode
o.binmode
end
out_reader = Thread.new { o.read }
- i.write stdin_data
+ if stdin_data
+ begin
+ i.write stdin_data
+ rescue Errno::EPIPE
+ end
+ end
i.close
[out_reader.value, t.value]
}
@@ -359,23 +331,19 @@ module Open3
# # capture make log
# make_log, s = Open3.capture2e("make")
#
- def capture2e(*cmd)
- if Hash === cmd.last
- opts = cmd.pop.dup
- else
- opts = {}
- end
-
- stdin_data = opts.delete(:stdin_data) || ''
- binmode = opts.delete(:binmode)
-
+ def capture2e(*cmd, stdin_data: nil, binmode: false, **opts)
popen2e(*cmd, opts) {|i, oe, t|
if binmode
i.binmode
oe.binmode
end
outerr_reader = Thread.new { oe.read }
- i.write stdin_data
+ if stdin_data
+ begin
+ i.write stdin_data
+ rescue Errno::EPIPE
+ end
+ end
i.close
[outerr_reader.value, t.value]
}
@@ -383,7 +351,7 @@ module Open3
module_function :capture2e
# Open3.pipeline_rw starts a list of commands as a pipeline with pipes
- # which connects stdin of the first command and stdout of the last command.
+ # which connect to stdin of the first command and stdout of the last command.
#
# Open3.pipeline_rw(cmd1, cmd2, ... [, opts]) {|first_stdin, last_stdout, wait_threads|
# ...
@@ -403,15 +371,15 @@ module Open3
# [env, cmdname, arg1, ..., opts] command name and one or more arguments (no shell)
# [env, [cmdname, argv0], arg1, ..., opts] command name and arguments including argv[0] (no shell)
#
- # Note that env and opts are optional, as Process.spawn.
+ # Note that env and opts are optional, as for Process.spawn.
#
- # The option to pass Process.spawn is constructed by merging
- # +opts+, the last hash element of the array and
- # specification for the pipe between each commands.
+ # The options to pass to Process.spawn are constructed by merging
+ # +opts+, the last hash element of the array, and
+ # specifications for the pipes between each of the commands.
#
# Example:
#
- # Open3.pipeline_rw("tr -dc A-Za-z", "wc -c") {|i,o,ts|
+ # Open3.pipeline_rw("tr -dc A-Za-z", "wc -c") {|i, o, ts|
# i.puts "All persons more than a mile high to leave the court."
# i.close
# p o.gets #=> "42\n"
@@ -424,13 +392,7 @@ module Open3
# stdin.close # send EOF to sort.
# p stdout.read #=> " 1\tbar\n 2\tbaz\n 3\tfoo\n"
# }
- def pipeline_rw(*cmds, &block)
- if Hash === cmds.last
- opts = cmds.pop.dup
- else
- opts = {}
- end
-
+ def pipeline_rw(*cmds, **opts, &block)
in_r, in_w = IO.pipe
opts[:in] = in_r
in_w.sync = true
@@ -443,7 +405,7 @@ module Open3
module_function :pipeline_rw
# Open3.pipeline_r starts a list of commands as a pipeline with a pipe
- # which connects stdout of the last command.
+ # which connects to stdout of the last command.
#
# Open3.pipeline_r(cmd1, cmd2, ... [, opts]) {|last_stdout, wait_threads|
# ...
@@ -462,7 +424,7 @@ module Open3
# [env, cmdname, arg1, ..., opts] command name and one or more arguments (no shell)
# [env, [cmdname, argv0], arg1, ..., opts] command name and arguments including argv[0] (no shell)
#
- # Note that env and opts are optional, as Process.spawn.
+ # Note that env and opts are optional, as for Process.spawn.
#
# Example:
#
@@ -480,13 +442,7 @@ module Open3
# p ts[1].value #=> #<Process::Status: pid 24913 exit 0>
# }
#
- def pipeline_r(*cmds, &block)
- if Hash === cmds.last
- opts = cmds.pop.dup
- else
- opts = {}
- end
-
+ def pipeline_r(*cmds, **opts, &block)
out_r, out_w = IO.pipe
opts[:out] = out_w
@@ -495,7 +451,7 @@ module Open3
module_function :pipeline_r
# Open3.pipeline_w starts a list of commands as a pipeline with a pipe
- # which connects stdin of the first command.
+ # which connects to stdin of the first command.
#
# Open3.pipeline_w(cmd1, cmd2, ... [, opts]) {|first_stdin, wait_threads|
# ...
@@ -514,7 +470,7 @@ module Open3
# [env, cmdname, arg1, ..., opts] command name and one or more arguments (no shell)
# [env, [cmdname, argv0], arg1, ..., opts] command name and arguments including argv[0] (no shell)
#
- # Note that env and opts are optional, as Process.spawn.
+ # Note that env and opts are optional, as for Process.spawn.
#
# Example:
#
@@ -522,13 +478,7 @@ module Open3
# i.puts "hello"
# }
#
- def pipeline_w(*cmds, &block)
- if Hash === cmds.last
- opts = cmds.pop.dup
- else
- opts = {}
- end
-
+ def pipeline_w(*cmds, **opts, &block)
in_r, in_w = IO.pipe
opts[:in] = in_r
in_w.sync = true
@@ -538,7 +488,7 @@ module Open3
module_function :pipeline_w
# Open3.pipeline_start starts a list of commands as a pipeline.
- # No pipe made for stdin of the first command and
+ # No pipes are created for stdin of the first command and
# stdout of the last command.
#
# Open3.pipeline_start(cmd1, cmd2, ... [, opts]) {|wait_threads|
@@ -557,11 +507,11 @@ module Open3
# [env, cmdname, arg1, ..., opts] command name and one or more arguments (no shell)
# [env, [cmdname, argv0], arg1, ..., opts] command name and arguments including argv[0] (no shell)
#
- # Note that env and opts are optional, as Process.spawn.
+ # Note that env and opts are optional, as for Process.spawn.
#
# Example:
#
- # # run xeyes in 10 seconds.
+ # # Run xeyes in 10 seconds.
# Open3.pipeline_start("xeyes") {|ts|
# sleep 10
# t = ts[0]
@@ -569,8 +519,8 @@ module Open3
# p t.value #=> #<Process::Status: pid 911 SIGTERM (signal 15)>
# }
#
- # # convert pdf to ps and send it to a printer.
- # # collect error message of pdftops and lpr.
+ # # Convert pdf to ps and send it to a printer.
+ # # Collect error message of pdftops and lpr.
# pdf_file = "paper.pdf"
# printer = "printer-name"
# err_r, err_w = IO.pipe
@@ -581,13 +531,7 @@ module Open3
# p err_r.read # error messages of pdftops and lpr.
# }
#
- def pipeline_start(*cmds, &block)
- if Hash === cmds.last
- opts = cmds.pop.dup
- else
- opts = {}
- end
-
+ def pipeline_start(*cmds, **opts, &block)
if block
pipeline_run(cmds, opts, [], [], &block)
else
@@ -598,8 +542,8 @@ module Open3
module_function :pipeline_start
# Open3.pipeline starts a list of commands as a pipeline.
- # It waits the finish of the commands.
- # No pipe made for stdin of the first command and
+ # It waits for the completion of the commands.
+ # No pipes are created for stdin of the first command and
# stdout of the last command.
#
# status_list = Open3.pipeline(cmd1, cmd2, ... [, opts])
@@ -649,13 +593,7 @@ module Open3
# # 106
# # 202
#
- def pipeline(*cmds)
- if Hash === cmds.last
- opts = cmds.pop.dup
- else
- opts = {}
- end
-
+ def pipeline(*cmds, **opts)
pipeline_run(cmds, opts, [], []) {|ts|
ts.map {|t| t.value }
}
@@ -723,16 +661,3 @@ 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
new file mode 100644
index 0000000000..d89a4d22fb
--- /dev/null
+++ b/lib/optionparser.rb
@@ -0,0 +1 @@
+require_relative 'optparse'
diff --git a/lib/optparse.rb b/lib/optparse.rb
index 469fde29ae..4ec891e3ae 100644
--- a/lib/optparse.rb
+++ b/lib/optparse.rb
@@ -82,6 +82,43 @@
# 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#
+#
# === Complete example
#
# The following example is a complete Ruby program. You can run it and see the
@@ -185,7 +222,7 @@
#
# # Another typical switch to print the version.
# opts.on_tail("--version", "Show version") do
-# puts OptionParser::Version.join('.')
+# puts ::Version.join('.')
# exit
# end
# end
@@ -212,11 +249,6 @@
#
class OptionParser
# :stopdoc:
- RCSID = %w$Id$[1..-1].each {|s| s.freeze}.freeze
- Version = (RCSID[1].split('.').collect {|s| s.to_i}.extend(Comparable).freeze if RCSID[1])
- LastModified = (Time.gm(*RCSID[2, 2].join('-').scan(/\d+/).collect {|s| s.to_i}) if RCSID[2])
- Release = RCSID[2]
-
NoArgument = [NO_ARGUMENT = :NONE, nil].freeze
RequiredArgument = [REQUIRED_ARGUMENT = :REQUIRED, true].freeze
OptionalArgument = [OPTIONAL_ARGUMENT = :OPTIONAL, false].freeze
@@ -452,7 +484,7 @@ class OptionParser
(sopts+lopts).each do |opt|
# "(-x -c -r)-l[left justify]" \
- if opt =~ /^--\[no-\](.+)$/
+ if /^--\[no-\](.+)$/ =~ opt
o = $1
yield("--#{o}", desc.join(""))
yield("--no-#{o}", desc.join(""))
@@ -737,7 +769,7 @@ class OptionParser
# OPTIONAL_ARGUMENT:: The switch requires an optional argument. (:OPTIONAL)
#
# Use like --switch=argument (long style) or -Xargument (short style). For
- # short style, only portion matched to argument pattern is dealed as
+ # short style, only portion matched to argument pattern is treated as
# argument.
#
ArgumentStyle = {}
@@ -1093,7 +1125,7 @@ XXX
end
private :notwice
- SPLAT_PROC = proc {|*a| a.length <= 1 ? a.first : a}
+ SPLAT_PROC = proc {|*a| a.length <= 1 ? a.first : a} # :nodoc:
#
# Creates an OptionParser::Switch from the parameters. The parsed argument
# value is passed to the given block, where it can be processed.
@@ -1463,11 +1495,12 @@ XXX
#
# Wrapper method for getopts.rb.
#
- # params = ARGV.getopts("ab:", "foo", "bar:")
+ # params = ARGV.getopts("ab:", "foo", "bar:", "zot:Z;zot option)
# # 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
@@ -1486,13 +1519,14 @@ 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} VAL")
+ define("--#{opt}=#{result[opt] || "VAL"}", *[desc].compact)
else
result[opt] = false
- define("--#{opt}")
+ define("--#{opt}", *[desc].compact)
end
end
@@ -1637,15 +1671,22 @@ XXX
decimal = '\d+(?:_\d+)*'
binary = 'b[01]+(?:_[01]+)*'
hex = 'x[\da-f]+(?:_[\da-f]+)*'
- octal = "0(?:[0-7]*(?:_[0-7]+)*|#{binary}|#{hex})"
+ octal = "0(?:[0-7]+(?:_[0-7]+)*|#{binary}|#{hex})?"
integer = "#{octal}|#{decimal}"
- accept(Integer, %r"\A[-+]?(?:#{integer})"io) {|s,| Integer(s) if s}
+
+ accept(Integer, %r"\A[-+]?(?:#{integer})\z"io) {|s,|
+ begin
+ Integer(s)
+ rescue ArgumentError
+ raise OptionParser::InvalidArgument, s
+ end if s
+ }
#
# Float number format, and converts to Float.
#
float = "(?:#{decimal}(?:\\.(?:#{decimal})?)?|\\.#{decimal})(?:E[-+]?#{decimal})?"
- floatpat = %r"\A[-+]?#{float}"io
+ floatpat = %r"\A[-+]?#{float}\z"io
accept(Float, floatpat) {|s,| s.to_f if s}
#
@@ -1653,7 +1694,7 @@ XXX
# for float format, and Rational for rational format.
#
real = "[-+]?(?:#{octal}|#{float})"
- accept(Numeric, /\A(#{real})(?:\/(#{real}))?/io) {|s, d, n|
+ accept(Numeric, /\A(#{real})(?:\/(#{real}))?\z/io) {|s, d, n|
if n
Rational(d, n)
elsif s
@@ -1664,22 +1705,40 @@ XXX
#
# Decimal integer format, to be converted to Integer.
#
- DecimalInteger = /\A[-+]?#{decimal}/io
- accept(DecimalInteger) {|s,| s.to_i if s}
+ DecimalInteger = /\A[-+]?#{decimal}\z/io
+ accept(DecimalInteger, DecimalInteger) {|s,|
+ begin
+ Integer(s)
+ rescue ArgumentError
+ raise OptionParser::InvalidArgument, s
+ end if s
+ }
#
# Ruby/C like octal/hexadecimal/binary integer format, to be converted to
# Integer.
#
- OctalInteger = /\A[-+]?(?:[0-7]+(?:_[0-7]+)*|0(?:#{binary}|#{hex}))/io
- accept(OctalInteger) {|s,| s.oct if s}
+ OctalInteger = /\A[-+]?(?:[0-7]+(?:_[0-7]+)*|0(?:#{binary}|#{hex}))\z/io
+ accept(OctalInteger, OctalInteger) {|s,|
+ begin
+ Integer(s, 8)
+ rescue ArgumentError
+ raise OptionParser::InvalidArgument, s
+ end if s
+ }
#
# Decimal integer/float number format, to be converted to Integer for
# integer format, Float for float format.
#
DecimalNumeric = floatpat # decimal integer is allowed as float also.
- accept(DecimalNumeric) {|s,| eval(s) if s}
+ accept(DecimalNumeric, floatpat) {|s,|
+ begin
+ eval(s)
+ rescue SyntaxError
+ raise OptionParser::InvalidArgument, s
+ end if s
+ }
#
# Boolean switch, which means whether it is present or not, whether it is
@@ -1776,7 +1835,7 @@ XXX
end
def inspect
- "#<#{self.class.to_s}: #{args.join(' ')}>"
+ "#<#{self.class}: #{args.join(' ')}>"
end
#
@@ -1935,9 +1994,4 @@ end
# ARGV is arguable by OptionParser
ARGV.extend(OptionParser::Arguable)
-if $0 == __FILE__
- Version = OptionParser::Version
- ARGV.options {|q|
- q.parse!.empty? or print "what's #{ARGV.join(' ')}?\n"
- } or abort(ARGV.options.to_s)
-end
+OptParse = OptionParser
diff --git a/lib/optparse/version.rb b/lib/optparse/version.rb
index 76ed564287..8525677418 100644
--- a/lib/optparse/version.rb
+++ b/lib/optparse/version.rb
@@ -51,7 +51,7 @@ class << OptionParser
raise NameError, path unless Module === klass
klass.constants.grep(/#{name}/i) do |c|
klass.const_defined?(c) or next
- c = klass.const_get(c)
+ klass.const_get(c)
end
end
end
diff --git a/lib/ostruct.rb b/lib/ostruct.rb
index b291f08308..f51eb7b5db 100644
--- a/lib/ostruct.rb
+++ b/lib/ostruct.rb
@@ -61,8 +61,8 @@
#
# == Implementation:
#
-# An OpenStruct utilizes Ruby's method lookup structure to and find and define
-# the necessary methods for properties. This is accomplished through the method
+# An OpenStruct utilizes Ruby's method lookup structure to find and define the
+# necessary methods for properties. This is accomplished through the method
# method_missing and define_method.
#
# This should be a consideration if there is a concern about the performance of
@@ -125,7 +125,7 @@ class OpenStruct
# data.each_pair.to_a # => [[:country, "Australia"], [:population, 20000000]]
#
def each_pair
- return to_enum __method__ unless block_given?
+ return to_enum(__method__) { @table.size } unless block_given?
@table.each_pair{|p| yield p}
end
@@ -152,7 +152,7 @@ class OpenStruct
begin
@modifiable = true
rescue
- raise TypeError, "can't modify frozen #{self.class}", caller(3)
+ raise RuntimeError, "can't modify frozen #{self.class}", caller(3)
end
@table
end
@@ -184,7 +184,9 @@ class OpenStruct
elsif len == 0
@table[mid]
else
- raise NoMethodError, "undefined method `#{mid}' for #{self}", caller(1)
+ err = NoMethodError.new "undefined method `#{mid}' for #{self}", mid, args
+ err.set_backtrace caller(1)
+ raise err
end
end
@@ -220,7 +222,7 @@ class OpenStruct
#
def delete_field(name)
sym = name.to_sym
- singleton_class.__send__(:remove_method, sym, "#{name}=")
+ singleton_class.__send__(:remove_method, sym, "#{sym}=")
@table.delete sym
end
diff --git a/lib/pp.rb b/lib/pp.rb
index 6e0c797d2e..0091ddf74c 100644
--- a/lib/pp.rb
+++ b/lib/pp.rb
@@ -1,7 +1,13 @@
require 'prettyprint'
module Kernel
- # returns a pretty printed object as a string.
+ # Returns a pretty printed object as a string.
+ #
+ # In order to use this method you must first require the PP module:
+ #
+ # require 'pp'
+ #
+ # See the PP module for more information.
def pretty_inspect
PP.pp(self, '')
end
@@ -10,23 +16,28 @@ module Kernel
# prints arguments in pretty form.
#
# pp returns argument(s).
- def pp(*objs) # :doc:
+ def pp(*objs) # :nodoc:
objs.each {|obj|
PP.pp(obj)
}
objs.size <= 1 ? objs.first : objs
end
- module_function :pp
+ module_function :pp # :nodoc:
end
-# == Pretty-printer for Ruby objects.
+##
+# A pretty-printer for Ruby objects.
#
-# = Which seems better?
+# All examples assume you have loaded the PP class with:
+# require 'pp'
#
-# non-pretty-printed output by #p is:
+##
+# == What PP Does
+#
+# Standard output by #p returns this:
# #<PP:0x81fedf0 @genspace=#<Proc:0x81feda0>, @group_queue=#<PrettyPrint::GroupQueue:0x81fed3c @queue=[[#<PrettyPrint::Group:0x81fed78 @breakables=[], @depth=0, @break=false>], []]>, @buffer=[], @newline="\n", @group_stack=[#<PrettyPrint::Group:0x81fed78 @breakables=[], @depth=0, @break=false>], @buffer_width=0, @indent=0, @maxwidth=79, @output_width=2, @output=#<IO:0x8114ee4>>
#
-# pretty-printed output by #pp is:
+# Pretty-printed output returns this:
# #<PP:0x81fedf0
# @buffer=[],
# @buffer_width=0,
@@ -44,32 +55,42 @@ end
# @output=#<IO:0x8114ee4>,
# @output_width=2>
#
-# I like the latter. If you do too, this library is for you.
-#
-# = Usage
+##
+# == Usage
#
# pp(obj) #=> obj
+# pp obj #=> obj
# pp(obj1, obj2, ...) #=> [obj1, obj2, ...]
# pp() #=> nil
#
-# output +obj(s)+ to +$>+ in pretty printed format.
+# Output <tt>obj(s)</tt> to <tt>$></tt> in pretty printed format.
+#
+# It returns <tt>obj(s)</tt>.
+#
+##
+# == Output Customization
+#
+# To define a customized pretty printing function for your classes,
+# redefine method <code>#pretty_print(pp)</code> in the class.
+#
+# <code>#pretty_print</code> takes the +pp+ argument, which is an instance of the PP class.
+# The method uses #text, #breakable, #nest, #group and #pp to print the
+# object.
#
-# It returns +obj(s)+.
+##
+# == Pretty-Print JSON
#
-# = Output Customization
-# To define your customized pretty printing function for your classes,
-# redefine a method #pretty_print(+pp+) in the class.
-# It takes an argument +pp+ which is an instance of the class PP.
-# The method should use PP#text, PP#breakable, PP#nest, PP#group and
-# PP#pp to print the object.
+# To pretty-print JSON refer to JSON#pretty_generate.
#
-# = Author
-# Tanaka Akira <akr@m17n.org>
+##
+# == Author
+# Tanaka Akira <akr@fsij.org>
+
class PP < PrettyPrint
# Outputs +obj+ to +out+ in pretty printed format of
# +width+ columns in width.
#
- # If +out+ is omitted, +$>+ is assumed.
+ # If +out+ is omitted, <code>$></code> is assumed.
# If +width+ is omitted, 79 is assumed.
#
# PP.pp returns +out+.
@@ -106,33 +127,44 @@ class PP < PrettyPrint
end
module PPMethods
+
+ # Yields to a block
+ # and preserves the previous set of objects being printed.
def guard_inspect_key
if Thread.current[:__recursive_key__] == nil
- Thread.current[:__recursive_key__] = {}.untrust
+ Thread.current[:__recursive_key__] = {}.taint
end
if Thread.current[:__recursive_key__][:inspect] == nil
- Thread.current[:__recursive_key__][:inspect] = {}.untrust
+ Thread.current[:__recursive_key__][:inspect] = {}.taint
end
save = Thread.current[:__recursive_key__][:inspect]
begin
- Thread.current[:__recursive_key__][:inspect] = {}.untrust
+ Thread.current[:__recursive_key__][:inspect] = {}.taint
yield
ensure
Thread.current[:__recursive_key__][:inspect] = save
end
end
+ # Check whether the object_id +id+ is in the current buffer of objects
+ # to be pretty printed. Used to break cycles in chains of objects to be
+ # pretty printed.
def check_inspect_key(id)
Thread.current[:__recursive_key__] &&
Thread.current[:__recursive_key__][:inspect] &&
Thread.current[:__recursive_key__][:inspect].include?(id)
end
+
+ # Adds the object_id +id+ to the set of objects being pretty printed, so
+ # as to not repeat objects.
def push_inspect_key(id)
Thread.current[:__recursive_key__][:inspect][id] = true
end
+
+ # Removes an object from the set of objects being pretty printed.
def pop_inspect_key(id)
Thread.current[:__recursive_key__][:inspect].delete id
end
@@ -165,18 +197,12 @@ class PP < PrettyPrint
group(1, '#<' + obj.class.name, '>', &block)
end
- PointerMask = (1 << ([""].pack("p").size * 8)) - 1
-
- case Object.new.inspect
- when /\A\#<Object:0x([0-9a-f]+)>\z/
- PointerFormat = "%0#{$1.length}x"
- else
- PointerFormat = "%x"
- end
-
+ # A convenience method, like object_group, but also reformats the Object's
+ # object_id.
def object_address_group(obj, &block)
- id = PointerFormat % (obj.object_id * 2 & PointerMask)
- group(1, "\#<#{obj.class}:0x#{id}", '>', &block)
+ str = Kernel.instance_method(:to_s).bind(obj).call
+ str.chomp!('>')
+ group(1, str, '>', &block)
end
# A convenience method which is same as follows:
@@ -225,6 +251,7 @@ class PP < PrettyPrint
}
end
+ # A present standard failsafe for pretty printing any given Object
def pp_object(obj)
object_address_group(obj) {
seplist(obj.pretty_print_instance_variables, lambda { text ',' }) {|v|
@@ -240,6 +267,7 @@ class PP < PrettyPrint
}
end
+ # A pretty print for a Hash
def pp_hash(obj)
group(1, '{', '}') {
seplist(obj, nil, :each_pair) {|k, v|
@@ -258,11 +286,11 @@ class PP < PrettyPrint
include PPMethods
- class SingleLine < PrettyPrint::SingleLine
+ class SingleLine < PrettyPrint::SingleLine # :nodoc:
include PPMethods
end
- module ObjectMixin
+ module ObjectMixin # :nodoc:
# 1. specific pretty_print
# 2. specific inspect
# 3. generic pretty_print
@@ -324,8 +352,8 @@ class PP < PrettyPrint
end
end
-class Array
- def pretty_print(q)
+class Array # :nodoc:
+ def pretty_print(q) # :nodoc:
q.group(1, '[', ']') {
q.seplist(self) {|v|
q.pp v
@@ -333,23 +361,23 @@ class Array
}
end
- def pretty_print_cycle(q)
+ def pretty_print_cycle(q) # :nodoc:
q.text(empty? ? '[]' : '[...]')
end
end
-class Hash
- def pretty_print(q)
+class Hash # :nodoc:
+ def pretty_print(q) # :nodoc:
q.pp_hash self
end
- def pretty_print_cycle(q)
+ def pretty_print_cycle(q) # :nodoc:
q.text(empty? ? '{}' : '{...}')
end
end
-class << ENV
- def pretty_print(q)
+class << ENV # :nodoc:
+ def pretty_print(q) # :nodoc:
h = {}
ENV.keys.sort.each {|k|
h[k] = ENV[k]
@@ -358,8 +386,8 @@ class << ENV
end
end
-class Struct
- def pretty_print(q)
+class Struct # :nodoc:
+ def pretty_print(q) # :nodoc:
q.group(1, sprintf("#<struct %s", PP.mcall(self, Kernel, :class).name), '>') {
q.seplist(PP.mcall(self, Struct, :members), lambda { q.text "," }) {|member|
q.breakable
@@ -373,13 +401,13 @@ class Struct
}
end
- def pretty_print_cycle(q)
+ def pretty_print_cycle(q) # :nodoc:
q.text sprintf("#<struct %s:...>", PP.mcall(self, Kernel, :class).name)
end
end
-class Range
- def pretty_print(q)
+class Range # :nodoc:
+ def pretty_print(q) # :nodoc:
q.pp self.begin
q.breakable ''
q.text(self.exclude_end? ? '...' : '..')
@@ -388,9 +416,9 @@ class Range
end
end
-class File < IO
- class Stat
- def pretty_print(q)
+class File < IO # :nodoc:
+ class Stat # :nodoc:
+ def pretty_print(q) # :nodoc:
require 'etc.so'
q.object_group(self) {
q.breakable
@@ -470,8 +498,8 @@ class File < IO
end
end
-class MatchData
- def pretty_print(q)
+class MatchData # :nodoc:
+ def pretty_print(q) # :nodoc:
nc = []
self.regexp.named_captures.each {|name, indexes|
indexes.each {|i| nc[i] = name }
@@ -495,7 +523,7 @@ class MatchData
end
end
-class Object < BasicObject
+class Object < BasicObject # :nodoc:
include PP::ObjectMixin
end
diff --git a/lib/prettyprint.rb b/lib/prettyprint.rb
index 9a90713a4d..7e989374b7 100644
--- a/lib/prettyprint.rb
+++ b/lib/prettyprint.rb
@@ -17,6 +17,8 @@
# * Box based formatting?
# * Other (better) model/algorithm?
#
+# Report any bugs at http://bugs.ruby-lang.org
+#
# == References
# Christian Lindig, Strictly Pretty, March 2000,
# http://www.st.cs.uni-sb.de/~lindig/papers/#pretty
@@ -25,7 +27,7 @@
# http://homepages.inf.ed.ac.uk/wadler/topics/language-design.html#prettier
#
# == Author
-# Tanaka Akira <akr@m17n.org>
+# Tanaka Akira <akr@fsij.org>
#
class PrettyPrint
@@ -90,34 +92,66 @@ class PrettyPrint
@group_queue = GroupQueue.new(root_group)
@indent = 0
end
- attr_reader :output, :maxwidth, :newline, :genspace
- attr_reader :indent, :group_queue
- # Returns the group most recently added to the stack.
- def current_group
- @group_stack.last
- end
+ # The output object.
+ #
+ # This defaults to '', and should accept the << method
+ attr_reader :output
- # first? is a predicate to test the call is a first call to first? with
- # current group.
+ # The maximum width of a line, before it is separated in to a newline
#
- # It is useful to format comma separated values as:
+ # This defaults to 79, and should be a Fixnum
+ attr_reader :maxwidth
+
+ # The value that is appended to +output+ to add a new line.
#
- # q.group(1, '[', ']') {
- # xxx.each {|yyy|
- # unless q.first?
- # q.text ','
- # q.breakable
- # end
- # ... pretty printing yyy ...
- # }
- # }
+ # This defaults to "\n", and should be String
+ attr_reader :newline
+
+ # A lambda or Proc, that takes one argument, of a Fixnum, and returns
+ # the corresponding number of spaces.
#
- # first? is obsoleted in 1.8.2.
+ # By default this is:
+ # lambda {|n| ' ' * n}
+ attr_reader :genspace
+
+ # The number of spaces to be indented
+ attr_reader :indent
+
+ # The PrettyPrint::GroupQueue of groups in stack to be pretty printed
+ attr_reader :group_queue
+
+ # Returns the group most recently added to the stack.
#
- def first?
- warn "PrettyPrint#first? is obsoleted at 1.8.2."
- current_group.first?
+ # Contrived example:
+ # out = ""
+ # => ""
+ # q = PrettyPrint.new(out)
+ # => #<PrettyPrint:0x82f85c0 @output="", @maxwidth=79, @newline="\n", @genspace=#<Proc:0x82f8368@/home/vbatts/.rvm/rubies/ruby-head/lib/ruby/2.0.0/prettyprint.rb:82 (lambda)>, @output_width=0, @buffer_width=0, @buffer=[], @group_stack=[#<PrettyPrint::Group:0x82f8138 @depth=0, @breakables=[], @break=false>], @group_queue=#<PrettyPrint::GroupQueue:0x82fb7c0 @queue=[[#<PrettyPrint::Group:0x82f8138 @depth=0, @breakables=[], @break=false>]]>, @indent=0>
+ # q.group {
+ # q.text q.current_group.inspect
+ # q.text q.newline
+ # q.group(q.current_group.depth + 1) {
+ # q.text q.current_group.inspect
+ # q.text q.newline
+ # q.group(q.current_group.depth + 1) {
+ # q.text q.current_group.inspect
+ # q.text q.newline
+ # q.group(q.current_group.depth + 1) {
+ # q.text q.current_group.inspect
+ # q.text q.newline
+ # }
+ # }
+ # }
+ # }
+ # => 284
+ # puts out
+ # #<PrettyPrint::Group:0x8354758 @depth=1, @breakables=[], @break=false>
+ # #<PrettyPrint::Group:0x8354550 @depth=2, @breakables=[], @break=false>
+ # #<PrettyPrint::Group:0x83541cc @depth=3, @breakables=[], @break=false>
+ # #<PrettyPrint::Group:0x8347e54 @depth=4, @breakables=[], @break=false>
+ def current_group
+ @group_stack.last
end
# Breaks the buffer into lines that are shorter than #maxwidth
@@ -166,7 +200,7 @@ class PrettyPrint
# may cause 2 results:
# (break,break), (non-break,non-break).
#
- # The text sep+ is inserted if a line is not broken at this point.
+ # The text +sep+ is inserted if a line is not broken at this point.
#
# If +sep+ is not specified, " " is used.
#
@@ -220,6 +254,7 @@ class PrettyPrint
text close_obj, close_width
end
+ # Takes a block and queues a new group that is indented 1 level further.
def group_sub
group = Group.new(@group_stack.last.depth + 1)
@group_stack.push group
@@ -256,25 +291,55 @@ class PrettyPrint
@buffer_width = 0
end
- class Text
+ # The Text class is the means by which to collect strings from objects.
+ #
+ # This class is intended for internal use of the PrettyPrint buffers.
+ class Text # :nodoc:
+
+ # Creates a new text object.
+ #
+ # This constructor takes no arguments.
+ #
+ # The workflow is to append a PrettyPrint::Text object to the buffer, and
+ # being able to call the buffer.last() to reference it.
+ #
+ # As there are objects, use PrettyPrint::Text#add to include the objects
+ # and the width to utilized by the String version of this object.
def initialize
@objs = []
@width = 0
end
+
+ # The total width of the objects included in this Text object.
attr_reader :width
+ # Render the String text of the objects that have been added to this Text object.
+ #
+ # Output the text to +out+, and increment the width to +output_width+
def output(out, output_width)
@objs.each {|obj| out << obj}
output_width + @width
end
+ # Include +obj+ in the objects to be pretty printed, and increment
+ # this Text object's total width by +width+
def add(obj, width)
@objs << obj
@width += width
end
end
- class Breakable
+ # The Breakable class is used for breaking up object information
+ #
+ # This class is intended for internal use of the PrettyPrint buffers.
+ class Breakable # :nodoc:
+
+ # Create a new Breakable object.
+ #
+ # Arguments:
+ # * +sep+ String of the separator
+ # * +width+ Fixnum width of the +sep+
+ # * +q+ parent PrettyPrint object, to base from
def initialize(sep, width, q)
@obj = sep
@width = width
@@ -283,8 +348,24 @@ class PrettyPrint
@group = q.current_group
@group.breakables.push self
end
- attr_reader :obj, :width, :indent
+ # Holds the separator String
+ #
+ # The +sep+ argument from ::new
+ attr_reader :obj
+
+ # The width of +obj+ / +sep+
+ attr_reader :width
+
+ # The number of spaces to indent.
+ #
+ # This is inferred from +q+ within PrettyPrint, passed in ::new
+ attr_reader :indent
+
+ # Render the String text of the objects that have been added to this
+ # Breakable object.
+ #
+ # Output the text to +out+, and increment the width to +output_width+
def output(out, output_width)
@group.breakables.shift
if @group.break?
@@ -299,22 +380,45 @@ class PrettyPrint
end
end
- class Group
+ # The Group class is used for making indentation easier.
+ #
+ # While this class does neither the breaking into newlines nor indentation,
+ # it is used in a stack (as well as a queue) within PrettyPrint, to group
+ # objects.
+ #
+ # For information on using groups, see PrettyPrint#group
+ #
+ # This class is intended for internal use of the PrettyPrint buffers.
+ class Group # :nodoc:
+ # Create a Group object
+ #
+ # Arguments:
+ # * +depth+ - this group's relation to previous groups
def initialize(depth)
@depth = depth
@breakables = []
@break = false
end
- attr_reader :depth, :breakables
+ # This group's relation to previous groups
+ attr_reader :depth
+
+ # Array to hold the Breakable objects for this Group
+ attr_reader :breakables
+
+ # Makes a break for this Group, and returns true
def break
@break = true
end
+ # Boolean of whether this Group has made a break
def break?
@break
end
+ # Boolean of whether this Group has been queried for being first
+ #
+ # This is used as a predicate, and ought to be called first.
def first?
if defined? @first
false
@@ -325,18 +429,33 @@ class PrettyPrint
end
end
- class GroupQueue
+ # The GroupQueue class is used for managing the queue of Group to be pretty
+ # printed.
+ #
+ # This queue groups the Group objects, based on their depth.
+ #
+ # This class is intended for internal use of the PrettyPrint buffers.
+ class GroupQueue # :nodoc:
+ # Create a GroupQueue object
+ #
+ # Arguments:
+ # * +groups+ - one or more PrettyPrint::Group objects
def initialize(*groups)
@queue = []
groups.each {|g| enq g}
end
+ # Enqueue +group+
+ #
+ # This does not strictly append the group to the end of the queue,
+ # but instead adds it in line, base on the +group.depth+
def enq(group)
depth = group.depth
@queue << [] until depth < @queue.length
@queue[depth] << group
end
+ # Returns the outer group of the queue
def deq
@queue.each {|gs|
(gs.length-1).downto(0) {|i|
@@ -352,29 +471,67 @@ class PrettyPrint
return nil
end
+ # Remote +group+ from this queue
def delete(group)
@queue[group.depth].delete(group)
end
end
+ # PrettyPrint::SingleLine is used by PrettyPrint.singleline_format
+ #
+ # It is passed to be similar to a PrettyPrint object itself, by responding to:
+ # * #text
+ # * #breakable
+ # * #nest
+ # * #group
+ # * #flush
+ # * #first?
+ #
+ # but instead, the output has no line breaks
+ #
class SingleLine
+ # Create a PrettyPrint::SingleLine object
+ #
+ # Arguments:
+ # * +output+ - String (or similar) to store rendered text. Needs to respond to '<<'
+ # * +maxwidth+ - Argument position expected to be here for compatibility.
+ # This argument is a noop.
+ # * +newline+ - Argument position expected to be here for compatibility.
+ # This argument is a noop.
def initialize(output, maxwidth=nil, newline=nil)
@output = output
@first = [true]
end
+ # Add +obj+ to the text to be output.
+ #
+ # +width+ argument is here for compatibility. It is a noop argument.
def text(obj, width=nil)
@output << obj
end
+ # Appends +sep+ to the text to be output. By default +sep+ is ' '
+ #
+ # +width+ argument is here for compatibility. It is a noop argument.
def breakable(sep=' ', width=nil)
@output << sep
end
- def nest(indent)
+ # Takes +indent+ arg, but does nothing with it.
+ #
+ # Yields to a block.
+ def nest(indent) # :nodoc:
yield
end
+ # Opens a block for grouping objects to be pretty printed.
+ #
+ # Arguments:
+ # * +indent+ - noop argument. Present for compatibility.
+ # * +open_obj+ - text appended before the &blok. Default is ''
+ # * +close_obj+ - text appended after the &blok. Default is ''
+ # * +open_width+ - noop argument. Present for compatibility.
+ # * +close_width+ - noop argument. Present for compatibility.
def group(indent=nil, open_obj='', close_obj='', open_width=nil, close_width=nil)
@first.push true
@output << open_obj
@@ -383,9 +540,11 @@ class PrettyPrint
@first.pop
end
- def flush
+ # Method present for compatibility, but is a noop
+ def flush # :nodoc:
end
+ # This is used as a predicate, and ought to be called first.
def first?
result = @first[-1]
@first[-1] = false
diff --git a/lib/prime.rb b/lib/prime.rb
index 7abcbebb0f..ebe012b613 100644
--- a/lib/prime.rb
+++ b/lib/prime.rb
@@ -29,7 +29,7 @@ class Integer
Prime.prime_division(self, generator)
end
- # Returns true if +self+ is a prime number, false for a composite.
+ # Returns true if +self+ is a prime number, else returns false.
def prime?
Prime.prime?(self)
end
@@ -71,20 +71,20 @@ end
#
# A "generator" provides an implementation of enumerating pseudo-prime
# numbers and it remembers the position of enumeration and upper bound.
-# Furthermore, it is a external iterator of prime enumeration which is
-# compatible to an Enumerator.
+# Furthermore, it is an external iterator of prime enumeration which is
+# compatible with an Enumerator.
#
# +Prime+::+PseudoPrimeGenerator+ is the base class for generators.
# There are few implementations of generator.
#
# [+Prime+::+EratosthenesGenerator+]
-# Uses eratosthenes's sieve.
+# Uses eratosthenes' sieve.
# [+Prime+::+TrialDivisionGenerator+]
# Uses the trial division method.
# [+Prime+::+Generator23+]
-# Generates all positive integers which is not divided by 2 nor 3.
+# Generates all positive integers which are not divisible by either 2 or 3.
# This sequence is very bad as a pseudo-prime sequence. But this
-# is faster and uses much less memory than other generators. So,
+# is faster and uses much less memory than the other generators. So,
# it is suitable for factorizing an integer which is not large but
# has many prime factors. e.g. for Prime#prime? .
@@ -133,13 +133,13 @@ class Prime
# a parameter.
#
# +ubound+::
- # Upper bound of prime numbers. The iterator stops after
+ # Upper bound of prime numbers. The iterator stops after it
# yields all prime numbers p <= +ubound+.
#
# == Note
#
- # +Prime+.+new+ returns a object extended by +Prime+::+OldCompatibility+
- # in order to compatibility to Ruby 1.8, and +Prime+#each is overwritten
+ # +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
@@ -150,14 +150,13 @@ class Prime
end
- # Returns true if +value+ is prime, false for a composite.
+ # Returns true if +value+ is a prime number, else returns false.
#
# == Parameters
#
# +value+:: an arbitrary integer to be checked.
# +generator+:: optional. A pseudo-prime generator.
def prime?(value, generator = Prime::Generator23.new)
- value = -value if value < 0
return false if value < 2
for num in generator
q,r = value.divmod num
@@ -181,7 +180,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
@@ -191,9 +190,9 @@ class Prime
# +value+:: An arbitrary integer.
# +generator+:: Optional. A pseudo-prime generator.
# +generator+.succ must return the next
- # pseudo-prime number in the ascendent
+ # pseudo-prime number in the ascending
# order. It must generate all prime numbers,
- # but may generate non prime numbers.
+ # but may also generate non prime numbers too.
#
# === Exceptions
# +ZeroDivisionError+:: when +value+ is zero.
@@ -209,7 +208,7 @@ class Prime
#
# Prime.prime_division(12) #=> [[2,2], [3,1]]
#
- def prime_division(value, generator= Prime::Generator23.new)
+ def prime_division(value, generator = Prime::Generator23.new)
raise ZeroDivisionError if value == 0
if value < 0
value = -value
@@ -272,7 +271,7 @@ class Prime
raise NotImplementedError, "need to define `rewind'"
end
- # Iterates the given block for each prime numbers.
+ # Iterates the given block for each prime number.
def each(&block)
return self.dup unless block
if @ubound
@@ -306,12 +305,13 @@ class Prime
# Uses +EratosthenesSieve+.
class EratosthenesGenerator < PseudoPrimeGenerator
def initialize
- @last_prime = nil
+ @last_prime_index = -1
super
end
def succ
- @last_prime = @last_prime ? EratosthenesSieve.instance.next_to(@last_prime) : 2
+ @last_prime_index += 1
+ EratosthenesSieve.instance.get_nth_prime(@last_prime_index)
end
def rewind
initialize
@@ -336,11 +336,11 @@ class Prime
alias next succ
end
- # Generates all integer which are greater than 2 and
- # are not divided by 2 nor 3.
+ # Generates all integers which are greater than 2 and
+ # are not divisible by either 2 or 3.
#
# This is a pseudo-prime generator, suitable on
- # checking primality of a integer by brute force
+ # checking primality of an integer by brute force
# method.
class Generator23<PseudoPrimeGenerator
def initialize
@@ -418,72 +418,52 @@ class Prime
end
end
- # Internal use. An implementation of eratosthenes's sieve
+ # Internal use. An implementation of eratosthenes' sieve
class EratosthenesSieve
include Singleton
- BITS_PER_ENTRY = 16 # each entry is a set of 16-bits in a Fixnum
- NUMS_PER_ENTRY = BITS_PER_ENTRY * 2 # twiced because even numbers are omitted
- ENTRIES_PER_TABLE = 8
- NUMS_PER_TABLE = NUMS_PER_ENTRY * ENTRIES_PER_TABLE
- FILLED_ENTRY = (1 << NUMS_PER_ENTRY) - 1
-
- def initialize # :nodoc:
- # bitmap for odd prime numbers less than 256.
- # For an arbitrary odd number n, @tables[i][j][k] is
- # * 1 if n is prime,
- # * 0 if n is composite,
- # where i,j,k = indices(n)
- @tables = [[0xcb6e, 0x64b4, 0x129a, 0x816d, 0x4c32, 0x864a, 0x820d, 0x2196].freeze]
+ def initialize
+ @primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101]
+ # @max_checked must be an even number
+ @max_checked = @primes.last + 1
end
- # returns the least odd prime number which is greater than +n+.
- def next_to(n)
- n = (n-1).div(2)*2+3 # the next odd number to given n
- table_index, integer_index, bit_index = indices(n)
- loop do
- extend_table until @tables.length > table_index
- for j in integer_index...ENTRIES_PER_TABLE
- if !@tables[table_index][j].zero?
- for k in bit_index...BITS_PER_ENTRY
- return NUMS_PER_TABLE*table_index + NUMS_PER_ENTRY*j + 2*k+1 if !@tables[table_index][j][k].zero?
- end
- end
- bit_index = 0
- end
- table_index += 1; integer_index = 0
- end
+ def get_nth_prime(n)
+ compute_primes while @primes.size <= n
+ @primes[n]
end
private
- # for an odd number +n+, returns (i, j, k) such that @tables[i][j][k] represents primarity of the number
- def indices(n)
- # binary digits of n: |0|1|2|3|4|5|6|7|8|9|10|11|....
- # indices: |-| k | j | i
- # because of NUMS_PER_ENTRY, NUMS_PER_TABLE
-
- k = (n & 0b00011111) >> 1
- j = (n & 0b11100000) >> 5
- i = n >> 8
- return i, j, k
- end
+ def compute_primes
+ # max_segment_size must be an even number
+ max_segment_size = 1e6.to_i
+ max_cached_prime = @primes.last
+ # do not double count primes if #compute_primes is interrupted
+ # by Timeout.timeout
+ @max_checked = max_cached_prime + 1 if max_cached_prime > @max_checked
+
+ segment_min = @max_checked
+ segment_max = [segment_min + max_segment_size, max_cached_prime * 2].min
+ root = Integer(Math.sqrt(segment_max).floor)
+
+ 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
- def extend_table
- lbound = NUMS_PER_TABLE * @tables.length
- ubound = lbound + NUMS_PER_TABLE
- new_table = [FILLED_ENTRY] * ENTRIES_PER_TABLE # which represents primarity in lbound...ubound
- (3..Integer(Math.sqrt(ubound))).step(2) do |p|
- i, j, k = indices(p)
- next if @tables[i][j][k].zero?
-
- start = (lbound.div(p)+1)*p # least multiple of p which is >= lbound
- start += p if start.even?
- (start...ubound).step(2*p) do |n|
- _, j, k = indices(n)
- new_table[j] &= FILLED_ENTRY^(1<<k)
+ 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
- @tables << new_table.freeze
+
+ segment.each do |prime|
+ @primes.push prime unless prime.nil?
+ end
+ @max_checked = segment_max
end
end
diff --git a/lib/profiler.rb b/lib/profiler.rb
index be33daf662..e53951cbe6 100644
--- a/lib/profiler.rb
+++ b/lib/profiler.rb
@@ -96,6 +96,9 @@ module Profiler__
end
}
module_function
+ # Starts the profiler.
+ #
+ # See Profiler__ for more information.
def start_profile
@@start = Process.times[0]
@@stacks = {}
@@ -103,10 +106,16 @@ module_function
PROFILE_CALL_PROC.enable
PROFILE_RETURN_PROC.enable
end
+ # Stops the profiler.
+ #
+ # See Profiler__ for more information.
def stop_profile
PROFILE_CALL_PROC.disable
PROFILE_RETURN_PROC.disable
end
+ # Outputs the results from the profiler.
+ #
+ # See Profiler__ for more information.
def print_profile(f)
stop_profile
total = Process.times[0] - @@start
diff --git a/lib/pstore.rb b/lib/pstore.rb
index a2813a8e20..02c20c91c7 100644
--- a/lib/pstore.rb
+++ b/lib/pstore.rb
@@ -482,25 +482,3 @@ 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 1866d73efb..f811ab6e78 100644
--- a/lib/racc/parser.rb
+++ b/lib/racc/parser.rb
@@ -37,23 +37,23 @@ end
# [--version] [--copyright] [--help] <var>grammarfile</var>
#
# [+filename+]
-# Racc grammar file. Any extention is permitted.
+# Racc grammar file. Any extension is permitted.
# [-o+outfile+, --output-file=+outfile+]
# A filename for output. default is <+filename+>.tab.rb
# [-O+filename+, --log-file=+filename+]
# Place logging output in file +filename+.
# Default log file name is <+filename+>.output.
# [-e+rubypath+, --executable=+rubypath+]
-# output executable file(mode 755). where +path+ is the ruby interpreter.
+# output executable file(mode 755). where +path+ is the Ruby interpreter.
# [-v, --verbose]
# verbose mode. create +filename+.output file, like yacc's y.output file.
# [-g, --debug]
-# add debug code to parser class. To display debuggin information,
+# add debug code to parser class. To display debugging information,
# use this '-g' option and set @yydebug true in parser class.
# [-E, --embedded]
# Output parser which doesn't need runtime files (racc/parser.rb).
# [-C, --check-only]
-# Check syntax of racc grammer file and quit.
+# Check syntax of racc grammar file and quit.
# [-S, --output-status]
# Print messages time to time while compiling.
# [-l, --no-line-convert]
@@ -75,7 +75,7 @@ end
#
# $ racc parse.y
#
-# This creates ruby script file "parse.tab.y". The -o option can change the output filename.
+# This creates Ruby script file "parse.tab.y". The -o option can change the output filename.
#
# == Writing A Racc Grammar File
#
@@ -174,8 +174,8 @@ end
# Your own parser is completely yours.
module Racc
- unless defined?(Racc_No_Extentions)
- Racc_No_Extentions = false # :nodoc:
+ unless defined?(Racc_No_Extensions)
+ Racc_No_Extensions = false # :nodoc:
end
class Parser
@@ -187,12 +187,12 @@ module Racc
Racc_Runtime_Core_Revision_R = %w$originalRevision: 1.8 $[1]
begin
require 'racc/cparse'
- # Racc_Runtime_Core_Version_C = (defined in extention)
+ # Racc_Runtime_Core_Version_C = (defined in extension)
Racc_Runtime_Core_Revision_C = Racc_Runtime_Core_Id_C.split[2]
unless new.respond_to?(:_racc_do_parse_c, true)
raise LoadError, 'old cparse.so'
end
- if Racc_No_Extentions
+ if Racc_No_Extensions
raise LoadError, 'selecting ruby version of racc runtime core'
end
@@ -380,7 +380,6 @@ module Racc
_, _, _, _,
_, _, _, shift_n, reduce_n,
_, _, * = arg
- nerr = 0 # tmp
if act > 0 and act < shift_n
#
@@ -431,7 +430,6 @@ 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 d7b9df0114..a154246ee5 100644
--- a/lib/racc/rdoc/grammar.en.rdoc
+++ b/lib/racc/rdoc/grammar.en.rdoc
@@ -4,14 +4,12 @@
== Class Block and User Code Block
-There's two block on toplevel.
-one is 'class' block, another is 'user code' block. 'user code' block MUST
-places after 'class' 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.
-== Comment
+== Comments
-You can insert comment about all places. Two style comment can be used,
-Ruby style (#.....) and C style (/*......*/) .
+You can insert comments about all places. Two style comments can be used, Ruby style '#.....' and C style '/\*......*\/'.
== Class Block
@@ -19,19 +17,19 @@ The class block is formed like this:
class CLASS_NAME
[precedance table]
- [token declearations]
- [expected number of S/R conflict]
+ [token declarations]
+ [expected number of S/R conflicts]
[options]
[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 bellow:
+If CLASS_NAME includes '::', Racc outputs module clause. For example, writing
+"class M::C" causes creating the code bellow:
module M
class C
@@ -42,8 +40,8 @@ For example, writing "class M::C" causes creating the code bellow:
== Grammar Block
-The grammar block discripts grammar which is able
-to be understood by parser. Syntax is:
+The grammar block describes grammar which is able to be understood by parser.
+Syntax is:
(token): (token) (token) (token).... (action)
@@ -59,28 +57,27 @@ to be understood by parser. 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 ruls source { result = val }
+ goal: definition rules source { result = val }
definition: /* none */ { result = [] }
| definition startdesig { result[0] = val[1] }
| definition
- precrule # this line continue from upper line
+ precrule # this line continues from upper line
{
result[1] = val[1]
}
startdesig: START TOKEN
-You can use following special local variables in action.
+You can use the following special local variables in action:
* result ($$)
@@ -92,10 +89,9 @@ 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 Precedance
+== Operator Precedence
This function is equal to '%prec' in yacc.
To designate this block:
@@ -107,9 +103,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
@@ -136,22 +132,22 @@ Racc has bison's "expect" directive.
:
:
-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.
+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.
== Declaring Tokens
-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:
+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:
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 ...
@@ -159,19 +155,19 @@ Options are:
* omit_action_call
-omit empty action call or not.
+omits empty action call or not.
* result_var
-use/does not use local variable "result"
+uses local variable "result" or not.
-You can use 'no_' prefix to invert its meanings.
+You can use 'no_' prefix to invert their 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 (':', '.', '(', ...)
@@ -185,7 +181,7 @@ Here is an example:
end
We can use almost all ruby value can be used by token symbol,
-except 'false' and 'nil'. These are causes unexpected parse error.
+except 'false' and 'nil'. These cause unexpected parse error.
If you want to use String as token symbol, special care is required.
For example:
@@ -202,12 +198,10 @@ 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 block, "header" "inner" and "footer".
+"User Code Block" is a Ruby source code which is copied to output. There are
+three user code blocks, "header" "inner" and "footer".
Format of user code is like this:
@@ -221,6 +215,5 @@ Format of user code is like this:
:
:
-If four '-' exist on line head,
-racc treat it as beginning of user code block.
-A name of user code must be one word.
+If four '-' exist on line head, Racc treat it as beginning of user code block.
+The name of user code block must be one word.
diff --git a/lib/rake.rb b/lib/rake.rb
index fff13fe460..47cce17064 100644
--- a/lib/rake.rb
+++ b/lib/rake.rb
@@ -1,5 +1,4 @@
#--
-
# Copyright 2003-2010 by Jim Weirich (jim.weirich@gmail.com)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -21,9 +20,14 @@
# IN THE SOFTWARE.
#++
+module Rake
+ VERSION = '10.3.2'
+end
+
require 'rake/version'
# :stopdoc:
+# TODO: Remove in Rake 11
RAKEVERSION = Rake::VERSION
# :startdoc:
@@ -40,6 +44,9 @@ require 'rake/ext/time'
require 'rake/win32'
+require 'rake/linked_list'
+require 'rake/cpu_counter'
+require 'rake/scope'
require 'rake/task_argument_error'
require 'rake/rule_recursion_overflow_error'
require 'rake/rake_module'
diff --git a/lib/rake/alt_system.rb b/lib/rake/alt_system.rb
index 05af19863a..aa7b7791b6 100644
--- a/lib/rake/alt_system.rb
+++ b/lib/rake/alt_system.rb
@@ -24,11 +24,13 @@
require 'rbconfig'
-#
+##
# Alternate implementations of system() and backticks `` on Windows
# for ruby-1.8 and earlier.
-#
-module Rake::AltSystem
+#--
+# TODO: Remove in Rake 11
+
+module Rake::AltSystem # :nodoc: all
WINDOWS = RbConfig::CONFIG["host_os"] =~
%r!(msdos|mswin|djgpp|mingw|[Ww]indows)!
@@ -39,7 +41,7 @@ module Rake::AltSystem
end
end
- if WINDOWS and RUBY_VERSION < "1.9.0"
+ if WINDOWS && RUBY_VERSION < "1.9.0"
RUNNABLE_EXTS = %w[com exe bat cmd]
RUNNABLE_PATTERN = %r!\.(#{RUNNABLE_EXTS.join('|')})\Z!i
@@ -73,9 +75,8 @@ module Rake::AltSystem
file
else
RUNNABLE_EXTS.each { |ext|
- if File.exist?(test = "#{file}.#{ext}")
- return test
- end
+ test = "#{file}.#{ext}"
+ return test if File.exist?(test)
}
nil
end
diff --git a/lib/rake/application.rb b/lib/rake/application.rb
index 734e20ac31..795b4685d4 100644
--- a/lib/rake/application.rb
+++ b/lib/rake/application.rb
@@ -12,10 +12,10 @@ 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
@@ -35,7 +35,12 @@ module Rake
# 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
+ DEFAULT_RAKEFILES = [
+ 'rakefile',
+ 'Rakefile',
+ 'rakefile.rb',
+ 'Rakefile.rb'
+ ].freeze
# Initialize a Rake::Application object.
def initialize
@@ -79,7 +84,7 @@ module Rake
standard_exception_handling do
@name = app_name
handle_options
- collect_tasks
+ collect_command_line_tasks
end
end
@@ -112,10 +117,11 @@ module Rake
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]}"
+ puts "Maximum active threads: #{stats[:max_active_threads]} + main"
+ puts "Total threads in play: #{stats[:total_threads_in_play]} + main"
end
- ThreadHistoryDisplay.new(thread_pool.history).show if options.job_stats == :history
+ ThreadHistoryDisplay.new(thread_pool.history).show if
+ options.job_stats == :history
end
# Add a loader to handle imported files ending in the extension
@@ -132,56 +138,97 @@ module Rake
# Return the thread pool used for multithreaded processing.
def thread_pool # :nodoc:
- @thread_pool ||= ThreadPool.new(options.thread_pool_size||FIXNUM_MAX)
+ @thread_pool ||= ThreadPool.new(options.thread_pool_size || Rake.suggested_thread_count-1)
end
- # private ----------------------------------------------------------------
+ # internal ----------------------------------------------------------------
- def invoke_task(task_string)
+ # Invokes a task with arguments that are extracted from +task_string+
+ def invoke_task(task_string) # :nodoc:
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]
+ def parse_task_string(string) # :nodoc:
+ /^([^\[]+)(?:\[(.*)\])$/ =~ string.to_s
+
+ name = $1
+ remaining_args = $2
+
+ return string, [] unless name
+ return name, [] if remaining_args.empty?
+
+ args = []
+
+ begin
+ /((?:[^\\,]|\\.)*?)\s*(?:,\s*(.*))?$/ =~ remaining_args
+
+ remaining_args = $2
+ args << $1.gsub(/\\(.)/, '\1')
+ end while remaining_args
+
+ return name, args
end
# Provide standard exception handling for the given block.
- def standard_exception_handling
- begin
- yield
- rescue SystemExit => ex
- # 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(false)
- end
+ def standard_exception_handling # :nodoc:
+ 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) # :nodoc:
+ exit(false)
end
# Display the error message that caused the exception.
- def display_error_message(ex)
+ def display_error_message(ex) # :nodoc:
trace "#{name} aborted!"
- trace ex.message
+ display_exception_details(ex)
+ trace "Tasks: #{ex.chain}" if has_chain?(ex)
+ trace "(See full trace by running task with --trace)" unless
+ options.backtrace
+ end
+
+ def display_exception_details(ex) # :nodoc:
+ seen = Thread.current[:rake_display_exception_details_seen] ||= []
+ return if seen.include? ex
+ seen << ex
+
+ display_exception_message_details(ex)
+ display_exception_backtrace(ex)
+ display_exception_details(ex.cause) if has_cause?(ex)
+ end
+
+ def has_cause?(ex) # :nodoc:
+ ex.respond_to?(:cause) && ex.cause
+ end
+
+ def display_exception_message_details(ex) # :nodoc:
+ if ex.instance_of?(RuntimeError)
+ trace ex.message
+ else
+ trace "#{ex.class.name}: #{ex.message}"
+ end
+ end
+
+ def display_exception_backtrace(ex) # :nodoc:
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.
@@ -189,22 +236,23 @@ module Rake
# Example:
# Rake.application.deprecate("import", "Rake.import", caller.first)
#
- def deprecate(old_usage, new_usage, call_site)
- return if options.ignore_deprecate
- $stderr.puts "WARNING: '#{old_usage}' is deprecated. " +
- "Please use '#{new_usage}' instead.\n" +
- " at #{call_site}"
+ def deprecate(old_usage, new_usage, call_site) # :nodoc:
+ 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)
+ def has_chain?(exception) # :nodoc:
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
+ def have_rakefile # :nodoc:
@rakefiles.each do |fn|
if File.exist?(fn)
others = FileList.glob(fn, File::FNM_CASEFOLD)
@@ -217,34 +265,40 @@ module Rake
end
# True if we are outputting to TTY, false otherwise
- def tty_output?
+ def tty_output? # :nodoc:
@tty_output
end
# Override the detected TTY output state (mostly for testing)
- def tty_output=( tty_output_state )
+ def tty_output=(tty_output_state) # :nodoc:
@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?
+ def truncate_output? # :nodoc:
tty_output? || @terminal_columns.nonzero?
end
# Display the tasks and comments.
- def display_tasks_and_comments
+ def display_tasks_and_comments # :nodoc:
displayable_tasks = tasks.select { |t|
- (options.show_all_tasks || t.comment) && t.name =~ options.show_task_pattern
+ (options.show_all_tasks || t.comment) &&
+ t.name =~ options.show_task_pattern
}
case options.show_tasks
when :tasks
- width = displayable_tasks.collect { |t| t.name_with_args.length }.max || 10
- max_column = truncate_output? ? terminal_width - name.size - width - 7 : nil
+ 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
+ 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|
@@ -258,7 +312,7 @@ module Rake
when :lines
displayable_tasks.each do |t|
t.locations.each do |loc|
- printf "#{name} %-30s %s\n",t.name_with_args, loc
+ printf "#{name} %-30s %s\n", t.name_with_args, loc
end
end
else
@@ -266,7 +320,7 @@ module Rake
end
end
- def terminal_width
+ def terminal_width # :nodoc:
if @terminal_columns.nonzero?
result = @terminal_columns
else
@@ -278,50 +332,51 @@ module Rake
end
# Calculate the dynamic width of the
- def dynamic_width
+ def dynamic_width # :nodoc:
@dynamic_width ||= (dynamic_width_stty.nonzero? || dynamic_width_tput)
end
- def dynamic_width_stty
+ def dynamic_width_stty # :nodoc:
%x{stty size 2>/dev/null}.split[1].to_i
end
- def dynamic_width_tput
+ def dynamic_width_tput # :nodoc:
%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
+ def unix? # :nodoc:
+ RbConfig::CONFIG['host_os'] =~
+ /(aix|darwin|linux|(net|free|open)bsd|cygwin|solaris|irix|hpux)/i
end
- def windows?
+ def windows? # :nodoc:
Win32.windows?
end
- def truncate(string, width)
+ def truncate(string, width) # :nodoc:
if string.nil?
""
elsif string.length <= width
string
else
- ( string[0, width-3] || "" ) + "..."
+ (string[0, width - 3] || "") + "..."
end
end
# Display the tasks and prerequisites
- def display_prerequisites
+ def display_prerequisites # :nodoc:
tasks.each do |t|
puts "#{name} #{t.name}"
t.prerequisites.each { |pre| puts " #{pre}" }
end
end
- def trace(*strings)
+ def trace(*strings) # :nodoc:
options.trace_output ||= $stderr
trace_on(options.trace_output, *strings)
end
- def sort_options(options)
+ def sort_options(options) # :nodoc:
options.sort_by { |opt|
opt.select { |o| o =~ /^-/ }.map { |o| o.downcase }.sort.reverse
}
@@ -330,37 +385,42 @@ module Rake
# A list of all the standard options used in rake, suitable for
# passing to OptionParser.
- def standard_rake_options
+ def standard_rake_options # :nodoc:
sort_options(
[
- ['--all', '-A', "Show all tasks, even uncommented ones",
+ ['--all', '-A',
+ "Show all tasks, even uncommented ones (in combination with -T or -D)",
lambda { |value|
options.show_all_tasks = value
}
],
- ['--backtrace=[OUT]', "Enable full backtrace. OUT can be stderr (default) or stdout.",
+ ['--backtrace=[OUT]',
+ "Enable full backtrace. OUT can be stderr (default) or stdout.",
lambda { |value|
options.backtrace = true
select_trace_output(options, 'backtrace', value)
}
],
- ['--classic-namespace', '-C', "Put Task and FileTask in the top level namespace",
- lambda { |value|
- require 'rake/classic_namespace'
- options.classic_namespace = true
- }
+ ['--build-all', '-B',
+ "Build all prerequisites, including those which are up-to-date.",
+ lambda { |value|
+ options.build_all = true
+ }
],
- ['--comments', "Show commented tasks only",
+ ['--comments',
+ "Show commented tasks only",
lambda { |value|
options.show_all_tasks = !value
}
],
- ['--describe', '-D [PATTERN]', "Describe the tasks (matching optional PATTERN), then exit.",
+ ['--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.",
+ ['--dry-run', '-n',
+ "Do a dry run without executing actions.",
lambda { |value|
Rake.verbose(true)
Rake.nowrite(true)
@@ -368,28 +428,43 @@ module Rake
options.trace = true
}
],
- ['--execute', '-e CODE', "Execute some Ruby code and exit.",
+ ['--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.",
+ ['--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.",
+ "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:2)",
- lambda { |value| options.thread_pool_size = [(value || 2).to_i,2].max }
+ "Specifies the maximum number of tasks to execute in parallel. " +
+ "(default is number of CPU cores + 4)",
+ lambda { |value|
+ if value.nil? || value == ''
+ value = FIXNUM_MAX
+ elsif value =~ /^\d+$/
+ value = value.to_i
+ else
+ value = Rake.suggested_thread_count
+ end
+ value = 1 if value < 1
+ options.thread_pool_size = value - 1
+ }
],
['--job-stats [LEVEL]',
- "Display job statistics. LEVEL=history displays a complete job list",
+ "Display job statistics. " +
+ "LEVEL=history displays a complete job list",
lambda { |value|
if value =~ /^history/i
options.job_stats = :history
@@ -398,22 +473,28 @@ module Rake
end
}
],
- ['--libdir', '-I LIBDIR', "Include LIBDIR in the search path for required modules.",
+ ['--libdir', '-I LIBDIR',
+ "Include LIBDIR in the search path for required modules.",
lambda { |value| $:.push(value) }
],
- ['--multitask', '-m', "Treat all tasks as multitasks.",
+ ['--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.",
+ ['--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.",
+ ['--prereqs', '-P',
+ "Display the tasks and dependencies, then exit.",
lambda { |value| options.show_prereqs = true }
],
- ['--quiet', '-q', "Do not log messages to standard output.",
+ ['--quiet', '-q',
+ "Do not log messages to standard output.",
lambda { |value| Rake.verbose(false) }
],
- ['--rakefile', '-f [FILE]', "Use FILE as the rakefile.",
+ ['--rakefile', '-f [FILENAME]',
+ "Use FILENAME as the rakefile to search for.",
lambda { |value|
value ||= ''
@rakefiles.clear
@@ -421,15 +502,14 @@ module Rake
}
],
['--rakelibdir', '--rakelib', '-R RAKELIBDIR',
- "Auto-import any .rake files in RAKELIBDIR. (default is 'rakelib')",
- lambda { |value| options.rakelib = value.split(File::PATH_SEPARATOR) }
- ],
- ['--reduce-compat', "Remove DSL in Object; remove Module#const_missing which defines ::Task etc.",
- # Load-time option.
- # Handled in bin/rake where Rake::REDUCE_COMPAT is defined (or not).
- lambda { |_| }
+ "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.",
+ ['--require', '-r MODULE',
+ "Require MODULE before executing rakefile.",
lambda { |value|
begin
require value
@@ -442,34 +522,45 @@ module Rake
end
}
],
- ['--rules', "Trace the rules resolution.",
+ ['--rules',
+ "Trace the rules resolution.",
lambda { |value| options.trace_rules = true }
],
- ['--silent', '-s', "Like --quiet, but also suppresses the 'in directory' announcement.",
+ ['--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.",
+ ['--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').",
+ "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.",
+ "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.",
+ ['--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.",
+ ['--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
@@ -477,22 +568,26 @@ module Rake
Rake.verbose(true)
}
],
- ['--verbose', '-v', "Log message to standard output.",
+ ['--verbose', '-v',
+ "Log message to standard output.",
lambda { |value| Rake.verbose(true) }
],
- ['--version', '-V', "Display the program version.",
+ ['--version', '-V',
+ "Display the program version.",
lambda { |value|
puts "rake, version #{RAKEVERSION}"
exit
}
],
- ['--where', '-W [PATTERN]', "Describe the tasks (matching optional PATTERN), then 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.",
+ ['--no-deprecation-warnings', '-X',
+ "Disable the deprecation warnings.",
lambda { |value|
options.ignore_deprecate = true
}
@@ -500,14 +595,14 @@ module Rake
])
end
- def select_tasks_to_show(options, show_tasks, value)
+ def select_tasks_to_show(options, show_tasks, value) # :nodoc:
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)
+ def select_trace_output(options, trace_option, value) # :nodoc:
value = value.strip unless value.nil?
case value
when 'stdout'
@@ -515,18 +610,19 @@ module Rake
when 'stderr', nil
options.trace_output = $stderr
else
- fail CommandLineOptionError, "Unrecognized --#{trace_option} option '#{value}'"
+ fail CommandLineOptionError,
+ "Unrecognized --#{trace_option} option '#{value}'"
end
end
private :select_trace_output
# Read and handle the command line options.
- def handle_options
+ def handle_options # :nodoc:
options.rakelib = ['rakelib']
options.trace_output = $stderr
OptionParser.new do |opts|
- opts.banner = "rake [-f rakefile] {options} targets..."
+ opts.banner = "#{Rake.application.name} [-f rakefile] {options} targets..."
opts.separator ""
opts.separator "Options are ..."
@@ -538,21 +634,11 @@ module Rake
standard_rake_options.each { |args| opts.on(*args) }
opts.environment('RAKEOPT')
end.parse!
-
- # If class namespaces are requested, set the global options
- # according to the values in the options structure.
- if options.classic_namespace
- $show_tasks = options.show_tasks
- $show_prereqs = options.show_prereqs
- $trace = options.trace
- $dryrun = options.dryrun
- $silent = options.silent
- end
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=$")
+ def rake_require(file_name, paths=$LOAD_PATH, loaded=$") # :nodoc:
fn = file_name + ".rake"
return false if loaded.include?(fn)
paths.each do |path|
@@ -566,13 +652,11 @@ module Rake
fail LoadError, "Can't find #{file_name}"
end
- def find_rakefile_location
+ def find_rakefile_location # :nodoc:
here = Dir.pwd
- while ! (fn = have_rakefile)
+ until (fn = have_rakefile)
Dir.chdir("..")
- if Dir.pwd == here || options.nosearch
- return nil
- end
+ return nil if Dir.pwd == here || options.nosearch
here = Dir.pwd
end
[fn, here]
@@ -580,7 +664,7 @@ module Rake
Dir.chdir(Rake.original_dir)
end
- def print_rakefile_directory(location)
+ def print_rakefile_directory(location) # :nodoc:
$stderr.puts "(in #{Dir.pwd})" unless
options.silent or original_dir == location
end
@@ -600,8 +684,8 @@ module Rake
@rakefile = rakefile
Dir.chdir(location)
print_rakefile_directory(location)
- $rakefile = @rakefile if options.classic_namespace
- Rake.load_rakefile(File.expand_path(@rakefile)) if @rakefile && @rakefile != ''
+ Rake.load_rakefile(File.expand_path(@rakefile)) if
+ @rakefile && @rakefile != ''
options.rakelib.each do |rlib|
glob("#{rlib}/*.rake") do |name|
add_import name
@@ -611,13 +695,13 @@ module Rake
load_imports
end
- def glob(path, &block)
+ def glob(path, &block) # :nodoc:
FileList.glob(path.gsub("\\", '/')).each(&block)
end
private :glob
# The directory path containing the system wide rakefiles.
- def system_dir
+ def system_dir # :nodoc:
@system_dir ||=
begin
if ENV['RAKE_SYSTEM']
@@ -643,51 +727,48 @@ module Rake
# 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
+ def collect_command_line_tasks # :nodoc:
@top_level_tasks = []
ARGV.each do |arg|
- if arg =~ /^(\w+)=(.*)$/
+ if arg =~ /^(\w+)=(.*)$/m
ENV[$1] = $2
else
@top_level_tasks << arg unless arg =~ /^-/
end
end
- @top_level_tasks.push("default") if @top_level_tasks.size == 0
+ @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 # :nodoc:
+ "default"
end
# Add a file to the list of files to be imported.
- def add_import(fn)
+ def add_import(fn) # :nodoc:
@pending_imports << fn
end
# Load the pending list of imported files.
- def load_imports
+ def load_imports # :nodoc:
while fn = @pending_imports.shift
next if @imported.member?(fn)
- if fn_task = lookup(fn)
- fn_task.invoke
- end
+ fn_task = lookup(fn) and fn_task.invoke
ext = File.extname(fn)
loader = @loaders[ext] || @default_loader
loader.load(fn)
+ if fn_task = lookup(fn) and fn_task.needed?
+ fn_task.reenable
+ fn_task.invoke
+ loader.load(fn)
+ end
@imported << fn
end
end
- # Warn about deprecated use of top level constant names.
- def const_warning(const_name)
- @const_warning ||= false
- if ! @const_warning
- $stderr.puts %{WARNING: Deprecated reference to top-level constant '#{const_name}' } +
- %{found at: #{rakefile_location}} # '
- $stderr.puts %{ Use --classic-namespace on rake command}
- $stderr.puts %{ or 'require "rake/classic_namespace"' in Rakefile}
- end
- @const_warning = true
- end
-
- def rakefile_location(backtrace=caller)
- backtrace.map { |t| t[/([^:]+):/,1] }
+ def rakefile_location(backtrace=caller) # :nodoc:
+ backtrace.map { |t| t[/([^:]+):/, 1] }
re = /^#{@rakefile}$/
re = /#{re.source}/i if windows?
diff --git a/lib/rake/backtrace.rb b/lib/rake/backtrace.rb
index e67132f67a..dc18773436 100644
--- a/lib/rake/backtrace.rb
+++ b/lib/rake/backtrace.rb
@@ -1,13 +1,18 @@
module Rake
- module Backtrace
- SUPPRESSED_PATHS =
- RbConfig::CONFIG.values_at(*RbConfig::CONFIG.
- keys.grep(/(prefix|libdir)/)).uniq + [
- File.join(File.dirname(__FILE__), ".."),
- ].map { |f| Regexp.quote(File.expand_path(f)) }
- SUPPRESSED_PATHS.reject! { |s| s.nil? || s =~ /^ *$/ }
+ module Backtrace # :nodoc: all
+ SYS_KEYS = RbConfig::CONFIG.keys.grep(/(?:[a-z]prefix|libdir)\z/)
+ SYS_PATHS = RbConfig::CONFIG.values_at(*SYS_KEYS).uniq +
+ [ File.join(File.dirname(__FILE__), "..") ]
- SUPPRESS_PATTERN = %r!(\A#{SUPPRESSED_PATHS.join('|')}|bin/rake:\d+)!i
+ 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("|")
+ SUPPRESSED_PATHS_RE << "|^org\\/jruby\\/\\w+\\.java" if
+ Object.const_defined?(:RUBY_ENGINE) and RUBY_ENGINE == 'jruby'
+
+ SUPPRESS_PATTERN = %r!(\A(#{SUPPRESSED_PATHS_RE})|bin/rake:\d+)!i
def self.collapse(backtrace)
pattern = Rake.application.options.suppress_backtrace_pattern ||
diff --git a/lib/rake/classic_namespace.rb b/lib/rake/classic_namespace.rb
deleted file mode 100644
index 6e71012da4..0000000000
--- a/lib/rake/classic_namespace.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# The following classes used to be in the top level namespace.
-# Loading this file enables compatibility with older Rakefile that
-# referenced Task from the top level.
-
-warn "WARNING: Classic namespaces are deprecated and will be removed from future versions of Rake."
-# :stopdoc:
-Task = Rake::Task
-FileTask = Rake::FileTask
-FileCreationTask = Rake::FileCreationTask
-RakeApp = Rake::Application
-# :startdoc:
diff --git a/lib/rake/clean.rb b/lib/rake/clean.rb
index 32846d4a6d..a49cd44167 100644
--- a/lib/rake/clean.rb
+++ b/lib/rake/clean.rb
@@ -14,19 +14,63 @@
require 'rake'
# :stopdoc:
-CLEAN = Rake::FileList["**/*~", "**/*.bak", "**/core"]
+
+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}" unless file_already_gone?(file_name)
+ end
+ end
+
+ def file_already_gone?(file_name)
+ return false if File.exist?(file_name)
+
+ path = file_name
+ prev = nil
+
+ while path = File.dirname(path)
+ return false if cant_be_deleted?(path)
+ break if [prev, "."].include?(path)
+ prev = path
+ end
+ true
+ end
+ private_class_method :file_already_gone?
+
+ def cant_be_deleted?(path_name)
+ File.exist?(path_name) &&
+ (!File.readable?(path_name) || !File.executable?(path_name))
+ end
+ private_class_method :cant_be_deleted?
+ 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
- CLEAN.each { |fn| rm_r fn rescue nil }
+ Rake::Cleaner.cleanup_files(CLEAN)
end
-CLOBBER = Rake::FileList.new
+CLOBBER = ::Rake::FileList.new
desc "Remove any generated file."
task :clobber => [:clean] do
- CLOBBER.each { |fn| rm_r fn rescue nil }
+ Rake::Cleaner.cleanup_files(CLOBBER)
end
diff --git a/lib/rake/cloneable.rb b/lib/rake/cloneable.rb
index ac67471232..d53645f2f3 100644
--- a/lib/rake/cloneable.rb
+++ b/lib/rake/cloneable.rb
@@ -1,9 +1,9 @@
module Rake
- # ##########################################################################
+ ##
# Mixin for creating easily cloned objects.
- #
- module Cloneable
- # The hook that invoked by 'clone' and 'dup' methods.
+
+ module Cloneable # :nodoc:
+ # The hook that is invoked by 'clone' and 'dup' methods.
def initialize_copy(source)
super
source.instance_variables.each do |var|
diff --git a/lib/rake/contrib/.document b/lib/rake/contrib/.document
new file mode 100644
index 0000000000..8b13789179
--- /dev/null
+++ b/lib/rake/contrib/.document
@@ -0,0 +1 @@
+
diff --git a/lib/rake/contrib/ftptools.rb b/lib/rake/contrib/ftptools.rb
index d39cde8ed9..b178523bc6 100644
--- a/lib/rake/contrib/ftptools.rb
+++ b/lib/rake/contrib/ftptools.rb
@@ -9,9 +9,7 @@ require 'rake/file_list'
module Rake # :nodoc:
- ####################################################################
- # <b>Note:</b> <em> Not released for general use.</em>
- class FtpFile
+ class FtpFile # :nodoc: all
attr_reader :name, :size, :owner, :group, :time
def self.date
@@ -50,39 +48,27 @@ module Rake # :nodoc:
def parse_mode(m)
result = 0
(1..9).each do |i|
- result = 2*result + ((m[i]==?-) ? 0 : 1)
+ 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} #{now.year} #{d3}")
- if result > now
- result = Time.parse("#{d1} #{d2} #{now.year-1} #{d3}")
- end
- else
+ 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
-# elements = ParseDate.parsedate("#{d1} #{d2} #{d3}")
-# if elements[0].nil?
-# today = self.class.date.today
-# if elements[1] > today.month
-# elements[0] = today.year - 1
-# else
-# elements[0] = today.year
-# end
-# end
-# elements = elements.collect { |el| el.nil? ? 0 : el }
-# Time.mktime(*elements[0,7])
end
end
- ####################################################################
+ ##
# Manage the uploading of files to an FTP account.
- class FtpUploader
+ class FtpUploader # :nodoc:
# Log uploads to standard output when true.
attr_accessor :verbose
diff --git a/lib/rake/contrib/publisher.rb b/lib/rake/contrib/publisher.rb
index 8b11edb59c..f4ee1abf86 100644
--- a/lib/rake/contrib/publisher.rb
+++ b/lib/rake/contrib/publisher.rb
@@ -14,8 +14,10 @@ HostInfo = Struct.new(:name, :webdir, :pkgdir)
# :startdoc:
+# TODO: Move to contrib/sshpublisher
+#--
# Manage several publishers as a single entity.
-class CompositePublisher
+class CompositePublisher # :nodoc:
def initialize
@publishers = []
end
@@ -31,9 +33,11 @@ class CompositePublisher
end
end
+# TODO: Remove in Rake 11, duplicated
+#--
# Publish an entire directory to an existing remote directory using
# SSH.
-class SshDirPublisher
+class SshDirPublisher # :nodoc: all
def initialize(host, remote_dir, local_dir)
@host = host
@remote_dir = remote_dir
@@ -45,8 +49,10 @@ class SshDirPublisher
end
end
+# TODO: Remove in Rake 11, duplicated
+#--
# Publish an entire directory to a fresh remote directory using SSH.
-class SshFreshDirPublisher < SshDirPublisher
+class SshFreshDirPublisher < SshDirPublisher # :nodoc: all
def upload
run %{ssh #{@host} rm -rf #{@remote_dir}} rescue nil
run %{ssh #{@host} mkdir #{@remote_dir}}
@@ -54,8 +60,10 @@ class SshFreshDirPublisher < SshDirPublisher
end
end
+# TODO: Remove in Rake 11, duplicated
+#--
# Publish a list of files to an existing remote directory.
-class SshFilePublisher
+class SshFilePublisher # :nodoc: all
# Create a publisher using the give host information.
def initialize(host, remote_dir, local_dir, *files)
@host = host
diff --git a/lib/rake/contrib/rubyforgepublisher.rb b/lib/rake/contrib/rubyforgepublisher.rb
index a4b96936c8..00889ad7b9 100644
--- a/lib/rake/contrib/rubyforgepublisher.rb
+++ b/lib/rake/contrib/rubyforgepublisher.rb
@@ -1,8 +1,10 @@
+# TODO: Remove in Rake 11
+
require 'rake/contrib/sshpublisher'
module Rake
- class RubyForgePublisher < SshDirPublisher
+ class RubyForgePublisher < SshDirPublisher # :nodoc: all
attr_reader :project, :proj_id, :user
def initialize(projname, user)
diff --git a/lib/rake/contrib/sshpublisher.rb b/lib/rake/contrib/sshpublisher.rb
index bd6adc127e..64f577017c 100644
--- a/lib/rake/contrib/sshpublisher.rb
+++ b/lib/rake/contrib/sshpublisher.rb
@@ -8,22 +8,30 @@ module Rake
class SshDirPublisher
include Rake::DSL
+ # Creates an SSH publisher which will scp all files in +local_dir+ to
+ # +remote_dir+ on +host+
+
def initialize(host, remote_dir, local_dir)
@host = host
@remote_dir = remote_dir
@local_dir = local_dir
end
+ # Uploads the files
+
def upload
- sh %{scp -rq #{@local_dir}/* #{@host}:#{@remote_dir}}
+ sh "scp", "-rq", "#{@local_dir}/*", "#{@host}:#{@remote_dir}"
end
end
# Publish an entire directory to a fresh remote directory using SSH.
class SshFreshDirPublisher < SshDirPublisher
+
+ # Uploads the files after removing the existing remote directory.
+
def upload
- sh %{ssh #{@host} rm -rf #{@remote_dir}} rescue nil
- sh %{ssh #{@host} mkdir #{@remote_dir}}
+ sh "ssh", @host, "rm", "-rf", @remote_dir rescue nil
+ sh "ssh", @host, "mkdir", @remote_dir
super
end
end
@@ -32,7 +40,9 @@ module Rake
class SshFilePublisher
include Rake::DSL
- # Create a publisher using the give host information.
+ # Creates an SSH publisher which will scp all +files+ in +local_dir+ to
+ # +remote_dir+ on +host+.
+
def initialize(host, remote_dir, local_dir, *files)
@host = host
@remote_dir = remote_dir
@@ -40,10 +50,11 @@ module Rake
@files = files
end
- # Upload the local directory to the remote directory.
+ # Uploads the files
+
def upload
@files.each do |fn|
- sh %{scp -q #{@local_dir}/#{fn} #{@host}:#{@remote_dir}}
+ sh "scp", "-q", "#{@local_dir}/#{fn}", "#{@host}:#{@remote_dir}"
end
end
end
diff --git a/lib/rake/contrib/sys.rb b/lib/rake/contrib/sys.rb
index 5e31ea81b4..8d4c735434 100644
--- a/lib/rake/contrib/sys.rb
+++ b/lib/rake/contrib/sys.rb
@@ -1,192 +1,4 @@
-warn 'Sys has been deprecated in favor of FileUtils'
+# TODO: Remove in Rake 11
-#--
-# Copyright 2003-2010 by Jim Weirich (jim.weirich@gmail.com)
-# All rights reserved.
-#++
-#
-begin
- require 'ftools'
-rescue LoadError
-end
-require 'rbconfig'
-require 'rake/file_list'
-
-######################################################################
-# Sys provides a number of file manipulation tools for the convenience
-# of writing Rakefiles. All commands in this module will announce
-# their activity on standard output if the $verbose flag is set
-# ($verbose = true is the default). You can control this by globally
-# setting $verbose or by using the +verbose+ and +quiet+ methods.
-#
-# Sys has been deprecated in favor of the FileUtils module available
-# in Ruby 1.8.
-#
-module Sys
- RUBY = RbConfig::CONFIG['ruby_install_name']
-
- # Install all the files matching +wildcard+ into the +dest_dir+
- # directory. The permission mode is set to +mode+.
- def install(wildcard, dest_dir, mode)
- FileList.glob(wildcard).each do |fn|
- File.install(fn, dest_dir, mode, $verbose)
- end
- end
-
- # Run the system command +cmd+.
- def run(cmd)
- log cmd
- system(cmd) or fail "Command Failed: [#{cmd}]"
- end
-
- # Run a Ruby interpreter with the given arguments.
- def ruby(*args)
- run "#{RUBY} #{args.join(' ')}"
- end
-
- # Copy a single file from +file_name+ to +dest_file+.
- def copy(file_name, dest_file)
- log "Copying file #{file_name} to #{dest_file}"
- File.copy(file_name, dest_file)
- end
-
- # Copy all files matching +wildcard+ into the directory +dest_dir+.
- def copy_files(wildcard, dest_dir)
- for_matching_files(wildcard, dest_dir) { |from, to| copy(from, to) }
- end
-
- # Link +file_name+ to +dest_file+.
- def link(file_name, dest_file)
- log "Linking file #{file_name} to #{dest_file}"
- File.link(file_name, dest_file)
- end
-
- # Link all files matching +wildcard+ into the directory +dest_dir+.
- def link_files(wildcard, dest_dir)
- for_matching_files(wildcard, dest_dir) { |from, to| link(from, to) }
- end
-
- # Symlink +file_name+ to +dest_file+.
- def symlink(file_name, dest_file)
- log "Symlinking file #{file_name} to #{dest_file}"
- File.symlink(file_name, dest_file)
- end
-
- # Symlink all files matching +wildcard+ into the directory +dest_dir+.
- def symlink_files(wildcard, dest_dir)
- for_matching_files(wildcard, dest_dir) { |from, to| link(from, to) }
- end
-
- # Remove all files matching +wildcard+. If a matching file is a
- # directory, it must be empty to be removed. used +delete_all+ to
- # recursively delete directories.
- def delete(*wildcards)
- wildcards.each do |wildcard|
- FileList.glob(wildcard).each do |fn|
- if File.directory?(fn)
- log "Deleting directory #{fn}"
- Dir.delete(fn)
- else
- log "Deleting file #{fn}"
- File.delete(fn)
- end
- end
- end
- end
-
- # Recursively delete all files and directories matching +wildcard+.
- def delete_all(*wildcards)
- wildcards.each do |wildcard|
- FileList.glob(wildcard).each do |fn|
- next if ! File.exist?(fn)
- if File.directory?(fn)
- FileList.glob("#{fn}/*").each do |subfn|
- next if subfn=='.' || subfn=='..'
- delete_all(subfn)
- end
- log "Deleting directory #{fn}"
- Dir.delete(fn)
- else
- log "Deleting file #{fn}"
- File.delete(fn)
- end
- end
- end
- end
-
- # Make the directories given in +dirs+.
- def makedirs(*dirs)
- dirs.each do |fn|
- log "Making directory #{fn}"
- File.makedirs(fn)
- end
- end
-
- # Make +dir+ the current working directory for the duration of
- # executing the given block.
- def indir(dir)
- olddir = Dir.pwd
- Dir.chdir(dir)
- yield
- ensure
- Dir.chdir(olddir)
- end
-
- # Split a file path into individual directory names.
- #
- # For 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
-
- # Write a message to standard error if $verbose is enabled.
- def log(msg)
- print " " if $trace && $verbose
- $stderr.puts msg if $verbose
- end
-
- # Perform a block with $verbose disabled.
- def quiet(&block)
- with_verbose(false, &block)
- end
-
- # Perform a block with $verbose enabled.
- def verbose(&block)
- with_verbose(true, &block)
- end
-
- # Perform a block with each file matching a set of wildcards.
- def for_files(*wildcards)
- wildcards.each do |wildcard|
- FileList.glob(wildcard).each do |fn|
- yield(fn)
- end
- end
- end
-
- extend(self)
-
- private # ----------------------------------------------------------
-
- def for_matching_files(wildcard, dest_dir)
- FileList.glob(wildcard).each do |fn|
- dest_file = File.join(dest_dir, fn)
- parent = File.dirname(dest_file)
- makedirs(parent) if ! File.directory?(parent)
- yield(fn, dest_file)
- end
- end
-
- def with_verbose(v)
- oldverbose = $verbose
- $verbose = v
- yield
- ensure
- $verbose = oldverbose
- end
-
-end
+fail "ERROR: 'rake/contrib/sys' is obsolete and no longer supported. " +
+ "Use 'FileUtils' instead."
diff --git a/lib/rake/cpu_counter.rb b/lib/rake/cpu_counter.rb
new file mode 100644
index 0000000000..d7c92a6cbe
--- /dev/null
+++ b/lib/rake/cpu_counter.rb
@@ -0,0 +1,110 @@
+require 'rbconfig'
+
+# TODO: replace with IO.popen using array-style arguments in Rake 11
+require 'open3'
+
+module Rake
+
+ # Based on a script at:
+ # http://stackoverflow.com/questions/891537/ruby-detect-number-of-cpus-installed
+ class CpuCounter # :nodoc: all
+ def self.count
+ new.count_with_default
+ end
+
+ def count_with_default(default=4)
+ count || default
+ rescue StandardError
+ default
+ end
+
+ def count
+ if defined?(Java::Java)
+ count_via_java_runtime
+ else
+ case RbConfig::CONFIG['host_os']
+ when /darwin9/
+ count_via_hwprefs_cpu_count
+ when /darwin/
+ count_via_hwprefs_thread_count || count_via_sysctl
+ when /linux/
+ count_via_cpuinfo
+ when /bsd/
+ count_via_sysctl
+ when /mswin|mingw/
+ count_via_win32
+ else
+ # Try everything
+ count_via_win32 ||
+ count_via_sysctl ||
+ count_via_hwprefs_thread_count ||
+ count_via_hwprefs_cpu_count ||
+ count_via_cpuinfo
+ end
+ end
+ end
+
+ def count_via_java_runtime
+ Java::Java.lang.Runtime.getRuntime.availableProcessors
+ rescue StandardError
+ nil
+ end
+
+ def count_via_win32
+ require 'win32ole'
+ wmi = WIN32OLE.connect("winmgmts://")
+ cpu = wmi.ExecQuery("select NumberOfCores from Win32_Processor") # TODO count hyper-threaded in this
+ cpu.to_enum.first.NumberOfCores
+ rescue StandardError, LoadError
+ nil
+ end
+
+ def count_via_cpuinfo
+ open('/proc/cpuinfo') { |f| f.readlines }.grep(/processor/).size
+ rescue StandardError
+ nil
+ end
+
+ def count_via_hwprefs_thread_count
+ run 'hwprefs', 'thread_count'
+ end
+
+ def count_via_hwprefs_cpu_count
+ run 'hwprefs', 'cpu_count'
+ end
+
+ def count_via_sysctl
+ run 'sysctl', '-n', 'hw.ncpu'
+ end
+
+ def run(command, *args)
+ cmd = resolve_command(command)
+ if cmd
+ Open3.popen3 cmd, *args do |inn, out, err,|
+ inn.close
+ err.read
+ out.read.to_i
+ end
+ else
+ nil
+ end
+ end
+
+ def resolve_command(command)
+ look_for_command("/usr/sbin", command) ||
+ look_for_command("/sbin", command) ||
+ in_path_command(command)
+ end
+
+ def look_for_command(dir, command)
+ path = File.join(dir, command)
+ File.exist?(path) ? path : nil
+ end
+
+ def in_path_command(command)
+ Open3.popen3 'which', command do |_, out,|
+ out.eof? ? nil : command
+ end
+ end
+ end
+end
diff --git a/lib/rake/default_loader.rb b/lib/rake/default_loader.rb
index 5dd3c05617..6154408f44 100644
--- a/lib/rake/default_loader.rb
+++ b/lib/rake/default_loader.rb
@@ -2,6 +2,10 @@ module Rake
# Default Rakefile loader used by +import+.
class DefaultLoader
+
+ ##
+ # Loads a rakefile into the current application from +fn+
+
def load(fn)
Rake.load_rakefile(File.expand_path(fn))
end
diff --git a/lib/rake/dsl_definition.rb b/lib/rake/dsl_definition.rb
index 143b0bcf7a..b521b7dc5c 100644
--- a/lib/rake/dsl_definition.rb
+++ b/lib/rake/dsl_definition.rb
@@ -6,6 +6,9 @@ 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.
+ #
+ # For a Rakefile you run from the comamnd line this module is automatically
+ # included.
module DSL
@@ -21,18 +24,48 @@ module Rake
private
- # Declare a basic task.
+ # :call-seq:
+ # task task_name
+ # task task_name: dependencies
+ # task task_name, arguments => dependencies
+ # task task_name, argument[, argument ...], :needs: dependencies
#
- # Example:
- # task :clobber => [:clean] do
+ # Declare a basic task. The +task_name+ is always the first argument. If
+ # the task name contains a ":" it is defined in that namespace.
+ #
+ # The +dependencies+ may be a single task name or an Array of task names.
+ # The +argument+ (a single name) or +arguments+ (an Array of names) define
+ # the arguments provided to the task.
+ #
+ # The task, argument and dependency names may be either symbols or
+ # strings.
+ #
+ # A task with a single dependency:
+ #
+ # task clobber: %w[clean] do
# rm_rf "html"
# end
#
- def task(*args, &block)
+ # A task with an argument and a dependency:
+ #
+ # task :package, [:version] => :test do |t, args|
+ # # ...
+ # end
+ #
+ # To invoke this task from the command line:
+ #
+ # $ rake package[1.2.3]
+ #
+ # Alternate definition:
+ #
+ # task :package, :version, needs: :test do |t, args|
+ # # ...
+ # end
+ #
+ def task(*args, &block) # :doc:
Rake::Task.define_task(*args, &block)
end
-
# Declare a file task.
#
# Example:
@@ -46,7 +79,7 @@ module Rake
# end
# end
#
- def file(*args, &block)
+ def file(*args, &block) # :doc:
Rake::FileTask.define_task(*args, &block)
end
@@ -62,12 +95,13 @@ module Rake
# Example:
# directory "testdata/doc"
#
- def directory(*args, &block)
+ def directory(*args, &block) # :doc:
result = file_create(*args, &block)
dir, _ = *Rake.application.resolve_args(args)
+ dir = Rake.from_pathname(dir)
Rake.each_dir_parent(dir) do |d|
file_create d do |t|
- mkdir_p t.name if ! File.exist?(t.name)
+ mkdir_p t.name unless File.exist?(t.name)
end
end
result
@@ -79,9 +113,9 @@ module Rake
# about it)
#
# Example:
- # multitask :deploy => [:deploy_gem, :deploy_rdoc]
+ # multitask deploy: %w[deploy_gem deploy_rdoc]
#
- def multitask(*args, &block)
+ def multitask(*args, &block) # :doc:
Rake::MultiTask.define_task(*args, &block)
end
@@ -89,14 +123,22 @@ module Rake
# block. Returns a NameSpace object that can be used to lookup
# tasks defined in the namespace.
#
- # E.g.
+ # Example:
#
# ns = namespace "nested" do
+ # # the "nested:run" task
# task :run
# end
# task_run = ns[:run] # find :run in the given namespace.
#
- def namespace(name=nil, &block)
+ # Tasks can also be defined in a namespace by using a ":" in the task
+ # name:
+ #
+ # task "nested:test" do
+ # # ...
+ # end
+ #
+ def namespace(name=nil, &block) # :doc:
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?
@@ -109,22 +151,22 @@ module Rake
#
# Example:
# rule '.o' => '.c' do |t|
- # sh %{cc -o #{t.name} #{t.source}}
+ # sh 'cc', '-o', t.name, t.source
# end
#
- def rule(*args, &block)
+ def rule(*args, &block) # :doc:
Rake::Task.create_rule(*args, &block)
end
- # Describe the next rake task.
+ # Describes the next rake task. Duplicate descriptions are discarded.
#
# Example:
# desc "Run the Unit Tests"
- # task :test => [:build]
- # runtests
+ # task test: [:build]
+ # # ... run tests
# end
#
- def desc(description)
+ def desc(description) # :doc:
Rake.application.last_description = description
end
@@ -142,36 +184,12 @@ module Rake
# Example:
# import ".depend", "my_rules"
#
- def import(*fns)
+ def import(*fns) # :doc:
fns.each do |fn|
Rake.application.add_import(fn)
end
end
-
end
-
- DeprecatedCommands = Object.new.extend(DSL)
-
- module DeprecatedObjectDSL # :nodoc:
- DSL.private_instance_methods(false).each do |name|
- line = __LINE__+1
- class_eval %{
- def #{name}(*args, &block)
- unless Rake.application.options.ignore_deprecate
- unless @rake_dsl_warning
- $stderr.puts "WARNING: Global access to Rake DSL methods is deprecated. Please include"
- $stderr.puts " ... Rake::DSL into classes and modules which use the Rake DSL methods."
- @rake_dsl_warning = true
- end
- $stderr.puts "WARNING: DSL method \#{self.class}##{name} called at \#{caller.first}"
- end
- Rake::DeprecatedCommands.send(:#{name}, *args, &block)
- end
- private :#{name}
- }, __FILE__, line
- end
- end unless defined? Rake::REDUCE_COMPAT
-
extend FileUtilsExt
end
@@ -179,4 +197,3 @@ end
# calls to task, etc. to work from a Rakefile without polluting the
# object inheritance tree.
self.extend Rake::DSL
-include Rake::DeprecatedObjectDSL unless defined? Rake::REDUCE_COMPAT
diff --git a/lib/rake/early_time.rb b/lib/rake/early_time.rb
index 8c0e7d3339..abcb1872b5 100644
--- a/lib/rake/early_time.rb
+++ b/lib/rake/early_time.rb
@@ -5,11 +5,14 @@ module Rake
include Comparable
include Singleton
+ ##
+ # The EarlyTime always comes before +other+!
+
def <=>(other)
-1
end
- def to_s
+ def to_s # :nodoc:
"<EARLY TIME>"
end
end
diff --git a/lib/rake/ext/core.rb b/lib/rake/ext/core.rb
index 1f3a738906..7575df15a9 100644
--- a/lib/rake/ext/core.rb
+++ b/lib/rake/ext/core.rb
@@ -1,8 +1,5 @@
-######################################################################
-# Core extension library
-#
class Module
- # Check for an existing method in the current class before extending. IF
+ # 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.
@@ -17,9 +14,10 @@ class Module
# end
# end
#
- def rake_extension(method)
+ def rake_extension(method) # :nodoc:
if method_defined?(method)
- $stderr.puts "WARNING: Possible conflict with Rake extension: #{self}##{method} already exists"
+ $stderr.puts "WARNING: Possible conflict with Rake extension: " +
+ "#{self}##{method} already exists"
else
yield
end
diff --git a/lib/rake/ext/module.rb b/lib/rake/ext/module.rb
index fc61bea555..3ee155ff6c 100644
--- a/lib/rake/ext/module.rb
+++ b/lib/rake/ext/module.rb
@@ -1,39 +1,2 @@
-require 'rake/ext/core'
-require 'rake/task'
-require 'rake/file_task'
-require 'rake/file_creation_task'
-require 'rake/application'
-require 'rake/task_manager'
-######################################################################
-# Rake extensions to Module.
-#
-class Module
-
- # Rename the original handler to make it available.
- alias :rake_original_const_missing :const_missing
-
- # Check for deprecated uses of top level (i.e. in Object) uses of
- # Rake class names. If someone tries to reference the constant
- # name, display a warning and return the proper object. Using the
- # --classic-namespace command line option will define these
- # constants in Object and avoid this handler.
- def const_missing(const_name)
- case const_name
- when :Task
- Rake.application.const_warning(const_name)
- Rake::Task
- when :FileTask
- Rake.application.const_warning(const_name)
- Rake::FileTask
- when :FileCreationTask
- Rake.application.const_warning(const_name)
- Rake::FileCreationTask
- when :RakeApp
- Rake.application.const_warning(const_name)
- Rake::Application
- else
- rake_original_const_missing(const_name)
- end
- end
-end unless defined? Rake::REDUCE_COMPAT
+# TODO: remove in Rake 11
diff --git a/lib/rake/ext/pathname.rb b/lib/rake/ext/pathname.rb
new file mode 100644
index 0000000000..49e2cd47ac
--- /dev/null
+++ b/lib/rake/ext/pathname.rb
@@ -0,0 +1,25 @@
+require 'rake/ext/core'
+require 'pathname'
+
+class Pathname
+
+ rake_extension("ext") do
+ # Return a new Pathname with <tt>String#ext</tt> applied to it.
+ #
+ # This Pathname extension comes from Rake
+ def ext(newext='')
+ Pathname.new(Rake.from_pathname(self).ext(newext))
+ end
+ end
+
+ rake_extension("pathmap") do
+ # Apply the pathmap spec to the Pathname, returning a
+ # new Pathname with the modified paths. (See String#pathmap for
+ # details.)
+ #
+ # This Pathname extension comes from Rake
+ def pathmap(spec=nil, &block)
+ Pathname.new(Rake.from_pathname(self).pathmap(spec, &block))
+ end
+ end
+end
diff --git a/lib/rake/ext/string.rb b/lib/rake/ext/string.rb
index be8b463e1a..b47b055a74 100644
--- a/lib/rake/ext/string.rb
+++ b/lib/rake/ext/string.rb
@@ -1,8 +1,5 @@
require 'rake/ext/core'
-######################################################################
-# Rake extension methods for String.
-#
class String
rake_extension("ext") do
@@ -11,17 +8,19 @@ class String
# is not given, or is the empty string, remove any existing extension.
#
# +ext+ is a user added method for the String class.
+ #
+ # This String extension comes from Rake
def ext(newext='')
return self.dup if ['.', '..'].include? self
- if newext != ''
- newext = (newext =~ /^\./) ? newext : ("." + newext)
- end
+ 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+.
+ #
+ # This String extension comes from Rake
def pathmap_explode
head, tail = File.split(self)
return [self] if head == self
@@ -34,6 +33,8 @@ class String
# 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.
+ #
+ # This String extension comes from Rake
def pathmap_partial(n)
dirs = File.dirname(self).pathmap_explode
partial_dirs =
@@ -48,8 +49,10 @@ class String
end
protected :pathmap_partial
- # Preform the pathmap replacement operations on the given path. The
+ # Perform the pathmap replacement operations on the given path. The
# patterns take the form 'pat1,rep1;pat2,rep2...'.
+ #
+ # This String extension comes from Rake
def pathmap_replace(patterns, &block)
result = self
patterns.split(';').each do |pair|
@@ -71,35 +74,36 @@ class String
# 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.
+ # <tt>%p</tt> :: The complete path.
+ # <tt>%f</tt> :: The base file name of the path, with its file extension,
+ # but without any directories.
+ # <tt>%n</tt> :: The file name of the path without its file extension.
+ # <tt>%d</tt> :: The directory list of the path.
+ # <tt>%x</tt> :: The file extension of the path. An empty string if there
+ # is no extension.
+ # <tt>%X</tt> :: Everything *but* the file extension.
+ # <tt>%s</tt> :: The alternate file separator if defined, otherwise use #
+ # the standard file separator.
+ # <tt>%%</tt> :: A percent sign.
+ #
+ # The <tt>%d</tt> 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").
+ # Also the <tt>%d</tt>, <tt>%p</tt>, <tt>%f</tt>, <tt>%n</tt>,
+ # <tt>%x</tt>, and <tt>%X</tt> 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
@@ -108,11 +112,11 @@ class String
#
# For example:
#
- # "src/org/onestepback/proj/A.java".pathmap("%{^src,bin}X.class")
+ # "src/org/onestepback/proj/A.java".pathmap("%{^src,class}X.class")
#
# returns:
#
- # "bin/org/onestepback/proj/A.class"
+ # "class/org/onestepback/proj/A.class"
#
# If the replacement text is '*', then a block may be provided to perform
# some arbitrary calculation for the replacement.
@@ -127,6 +131,7 @@ class String
#
# "/path/to/file.txt"
#
+ # This String extension comes from Rake
def pathmap(spec=nil, &block)
return self if spec.nil?
result = ''
diff --git a/lib/rake/ext/time.rb b/lib/rake/ext/time.rb
index ea8b037e39..c058649b7e 100644
--- a/lib/rake/ext/time.rb
+++ b/lib/rake/ext/time.rb
@@ -3,7 +3,7 @@
require 'rake/early_time'
-class Time
+class Time # :nodoc: all
alias rake_original_time_compare :<=>
def <=>(other)
if Rake::EarlyTime === other
diff --git a/lib/rake/file_list.rb b/lib/rake/file_list.rb
index 3eae5fb0d7..006ec7703e 100644
--- a/lib/rake/file_list.rb
+++ b/lib/rake/file_list.rb
@@ -2,10 +2,10 @@ 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.
#
@@ -41,14 +41,15 @@ module Rake
# 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 }
+ ARRAY_METHODS = (Array.instance_methods - Object.instance_methods).
+ map { |n| n.to_s }
# List of additional methods that must be delegated.
- MUST_DEFINE = %w[to_a inspect <=>]
+ 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 *]
+ MUST_NOT_DEFINE = %w[to_a to_ary partition * <<]
# List of delegated methods that return new array values which need
# wrapping.
@@ -58,12 +59,13 @@ module Rake
+ - & |
]
- DELEGATING_METHODS = (ARRAY_METHODS + MUST_DEFINE - MUST_NOT_DEFINE).collect{ |s| s.to_s }.sort.uniq
+ DELEGATING_METHODS = (ARRAY_METHODS + MUST_DEFINE - MUST_NOT_DEFINE).
+ map { |s| s.to_s }.sort.uniq
# Now do the delegation.
- DELEGATING_METHODS.each_with_index do |sym, i|
+ DELEGATING_METHODS.each do |sym|
if SPECIAL_RETURN.include?(sym)
- ln = __LINE__+1
+ ln = __LINE__ + 1
class_eval %{
def #{sym}(*args, &block)
resolve
@@ -72,7 +74,7 @@ module Rake
end
}, __FILE__, ln
else
- ln = __LINE__+1
+ ln = __LINE__ + 1
class_eval %{
def #{sym}(*args, &block)
resolve
@@ -117,7 +119,7 @@ module Rake
if fn.respond_to? :to_ary
include(*fn.to_ary)
else
- @pending_add << fn
+ @pending_add << Rake.from_pathname(fn)
end
end
@pending = true
@@ -147,16 +149,13 @@ module Rake
#
def exclude(*patterns, &block)
patterns.each do |pat|
- @exclude_patterns << pat
- end
- if block_given?
- @exclude_procs << block
+ @exclude_patterns << Rake.from_pathname(pat)
end
- resolve_exclude if ! @pending
+ @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 = []
@@ -164,7 +163,7 @@ module Rake
self
end
- # Define equality.
+ # A FileList is equal through array equality.
def ==(array)
to_ary == array
end
@@ -197,6 +196,12 @@ module Rake
end
end
+ def <<(obj)
+ resolve
+ @items << Rake.from_pathname(obj)
+ self
+ end
+
# Resolve all the pending adds now.
def resolve
if @pending
@@ -208,7 +213,7 @@ module Rake
self
end
- def resolve_add(fn)
+ def resolve_add(fn) # :nodoc:
case fn
when %r{[*?\[\{]}
add_matching(fn)
@@ -218,8 +223,8 @@ module Rake
end
private :resolve_add
- def resolve_exclude
- reject! { |fn| exclude?(fn) }
+ def resolve_exclude # :nodoc:
+ reject! { |fn| excluded_from_list?(fn) }
self
end
private :resolve_exclude
@@ -231,7 +236,7 @@ module Rake
# 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) }
+ inject(FileList.new) { |res, fn| res << fn.sub(pat, rep) }
end
# Return a new FileList with the results of running +gsub+ against each
@@ -242,18 +247,18 @@ module Rake
# => ['lib\\test\\file', 'x\\y']
#
def gsub(pat, rep)
- inject(FileList.new) { |res, fn| res << fn.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) }
+ 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) }
+ each_with_index { |fn, i| self[i] = fn.gsub(pat, rep) }
self
end
@@ -276,7 +281,6 @@ module Rake
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,
@@ -341,13 +345,19 @@ module Rake
# Add matching glob patterns.
def add_matching(pattern)
FileList.glob(pattern).each do |fn|
- self << fn unless exclude?(fn)
+ self << fn unless excluded_from_list?(fn)
end
end
private :add_matching
- # Should the given file name be excluded?
- def exclude?(fn)
+ # Should the given file name be excluded from the list?
+ #
+ # NOTE: This method was formerly 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
@@ -371,7 +381,7 @@ module Rake
proc { |fn| fn =~ /(^|[\/\\])core$/ && ! File.directory?(fn) }
]
- def import(array)
+ def import(array) # :nodoc:
@items = array
self
end
@@ -385,7 +395,7 @@ module Rake
end
# Get a sorted list of files matching the pattern. This method
- # should be prefered to Dir[pattern] and Dir.glob(pattern) because
+ # should be preferred 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
@@ -406,5 +416,13 @@ module Rake
dir = File.dirname(dir)
end
end
+
+ # Convert Pathname and Pathname-like objects to strings;
+ # leave everything else alone
+ def from_pathname(path) # :nodoc:
+ path = path.to_path if path.respond_to?(:to_path)
+ path = path.to_str if path.respond_to?(:to_str)
+ path
+ end
end
end # module Rake
diff --git a/lib/rake/file_task.rb b/lib/rake/file_task.rb
index 78902a86fd..11823bbe46 100644
--- a/lib/rake/file_task.rb
+++ b/lib/rake/file_task.rb
@@ -2,7 +2,7 @@ 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
@@ -13,7 +13,7 @@ module Rake
# 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)
+ ! File.exist?(name) || out_of_date?(timestamp) || @application.options.build_all
end
# Time stamp for file task.
@@ -29,7 +29,7 @@ module Rake
# 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}
+ @prerequisites.any? { |n| application[n, @scope].timestamp > stamp }
end
# ----------------------------------------------------------------
@@ -39,9 +39,8 @@ module Rake
# 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
+ Rake.from_pathname(task_name)
end
end
end
end
-
diff --git a/lib/rake/file_utils.rb b/lib/rake/file_utils.rb
index 606bfb65b5..27f4e2e1d1 100644
--- a/lib/rake/file_utils.rb
+++ b/lib/rake/file_utils.rb
@@ -14,12 +14,24 @@ module FileUtils
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
+ # Run the system command +cmd+. If multiple arguments are given the command
+ # is run directly (without the shell, same semantics as Kernel::exec and
# Kernel::system).
#
- # Example:
- # sh %{ls -ltr}
+ # It is recommended you use the multiple argument form over interpolating
+ # user input for both usability and security reasons. With the multiple
+ # argument form you can easily process files with spaces or other shell
+ # reserved characters in them. With the multiple argument form your rake
+ # tasks are not vulnerable to users providing an argument like
+ # <code>; rm # -rf /</code>.
+ #
+ # If a block is given, upon command completion the block is called with an
+ # OK flag (true on a zero exit status) and a Process::Status object.
+ # Without a block a RuntimeError is raised when the command exits non-zero.
+ #
+ # Examples:
+ #
+ # sh 'ls -ltr'
#
# sh 'ls', 'file with spaces'
#
@@ -41,24 +53,26 @@ module FileUtils
unless options[:noop]
res = rake_system(*cmd)
status = $?
- status = PseudoStatus.new(1) if !res && status.nil?
+ 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 { |ok, status|
- ok or fail "Command failed with status (#{status.exitstatus}): [#{show_command}]"
- }
+ 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 == Rake::FileUtilsExt::DEFAULT) ||
Rake::FileUtilsExt.verbose_flag
end
end
@@ -74,9 +88,9 @@ module FileUtils
# Example:
# ruby %{-pe '$_.upcase!' <README}
#
- def ruby(*args,&block)
+ def ruby(*args, &block)
options = (Hash === args.last) ? args.pop : {}
- if args.length > 1 then
+ if args.length > 1
sh(*([RUBY] + args + [options]), &block)
else
sh("#{RUBY} #{args.first}", options, &block)
@@ -88,7 +102,7 @@ module FileUtils
# Attempt to do a normal file link, but fall back to a copy if the link
# fails.
def safe_ln(*args)
- unless LN_SUPPORTED[0]
+ if ! LN_SUPPORTED[0]
cp(*args)
else
begin
diff --git a/lib/rake/file_utils_ext.rb b/lib/rake/file_utils_ext.rb
index 386af441d8..309159aec1 100644
--- a/lib/rake/file_utils_ext.rb
+++ b/lib/rake/file_utils_ext.rb
@@ -18,9 +18,6 @@ module Rake
FileUtilsExt.verbose_flag = DEFAULT
FileUtilsExt.nowrite_flag = false
- $fileutils_verbose = true
- $fileutils_nowrite = false
-
FileUtils.commands.each do |name|
opts = FileUtils.options_of name
default_options = []
@@ -138,7 +135,8 @@ module Rake
optdecl.each do |name|
h.delete name
end
- raise ArgumentError, "no such option: #{h.keys.join(' ')}" unless h.empty?
+ raise ArgumentError, "no such option: #{h.keys.join(' ')}" unless
+ h.empty?
end
extend self
diff --git a/lib/rake/gempackagetask.rb b/lib/rake/gempackagetask.rb
index 5f1fc4def8..16e7ce042b 100644
--- a/lib/rake/gempackagetask.rb
+++ b/lib/rake/gempackagetask.rb
@@ -1,15 +1,4 @@
-# rake/gempackagetask is deprecated in favor of rubygems/package_task
-
-warn 'rake/gempackagetask is deprecated. Use rubygems/package_task instead'
-
-require 'rubygems'
-require 'rubygems/package_task'
-
-require 'rake'
-
-# :stopdoc:
-
-module Rake
- GemPackageTask = Gem::PackageTask
-end
+# TODO: Remove in Rake 11
+fail "ERROR: 'rake/gempackagetask' is obsolete and no longer supported. " +
+ "Use 'rubygems/package_task' instead."
diff --git a/lib/rake/invocation_chain.rb b/lib/rake/invocation_chain.rb
index 8a01ab4c29..540628957c 100644
--- a/lib/rake/invocation_chain.rb
+++ b/lib/rake/invocation_chain.rb
@@ -1,46 +1,51 @@
module Rake
- ####################################################################
# InvocationChain tracks the chain of task invocations to detect
# circular dependencies.
- class InvocationChain
- def initialize(value, tail)
- @value = value
- @tail = tail
- end
+ class InvocationChain < LinkedList
- def member?(obj)
- @value == obj || @tail.member?(obj)
+ # Is the invocation already in the chain?
+ def member?(invocation)
+ head == invocation || tail.member?(invocation)
end
- def append(value)
- if member?(value)
- fail RuntimeError, "Circular dependency detected: #{to_s} => #{value}"
+ # 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
- self.class.new(value, self)
+ conj(invocation)
end
+ # Convert to string, ie: TOP => invocation => invocation
def to_s
- "#{prefix}#{@value}"
+ "#{prefix}#{head}"
end
- def self.append(value, chain)
- chain.append(value)
+ # Class level append.
+ def self.append(invocation, chain)
+ chain.append(invocation)
end
private
def prefix
- "#{@tail.to_s} => "
+ "#{tail} => "
end
- class EmptyInvocationChain
+ # Null object for an empty chain.
+ class EmptyInvocationChain < LinkedList::EmptyLinkedList
+ @parent = InvocationChain
+
def member?(obj)
false
end
- def append(value)
- InvocationChain.new(value, self)
+
+ def append(invocation)
+ conj(invocation)
end
+
def to_s
"TOP"
end
diff --git a/lib/rake/lib/.document b/lib/rake/lib/.document
deleted file mode 100644
index 098e64716e..0000000000
--- a/lib/rake/lib/.document
+++ /dev/null
@@ -1 +0,0 @@
-# Ignore project.rake
diff --git a/lib/rake/lib/project.rake b/lib/rake/lib/project.rake
deleted file mode 100644
index a5497328a7..0000000000
--- a/lib/rake/lib/project.rake
+++ /dev/null
@@ -1,21 +0,0 @@
-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..b5ab797808
--- /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 as 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 associated 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/name_space.rb b/lib/rake/name_space.rb
index e1cc0940b8..58f911e434 100644
--- a/lib/rake/name_space.rb
+++ b/lib/rake/name_space.rb
@@ -1,25 +1,38 @@
-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
+##
+# The NameSpace class will lookup task names in the scope defined by a
+# +namespace+ command.
+
+class Rake::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
+
+ ##
+ # The scope of the namespace (a LinkedList)
+
+ def scope
+ @scope.dup
end
+
+ ##
+ # Return the list of tasks defined in this and nested namespaces.
+
+ def tasks
+ @task_manager.tasks_in_scope(@scope)
+ end
+
end
+
diff --git a/lib/rake/packagetask.rb b/lib/rake/packagetask.rb
index 08c1a8c025..e862952c05 100644
--- a/lib/rake/packagetask.rb
+++ b/lib/rake/packagetask.rb
@@ -11,27 +11,27 @@ module Rake
#
# The PackageTask will create the following targets:
#
- # [<b>:package</b>]
+ # +:package+ ::
# Create all the requested package files.
#
- # [<b>:clobber_package</b>]
+ # +:clobber_package+ ::
# Delete all the package files. This target is automatically
# added to the main clobber target.
#
- # [<b>:repackage</b>]
+ # +:repackage+ ::
# 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>]
+ # <tt>"<em>package_dir</em>/<em>name</em>-<em>version</em>.tgz"</tt> ::
# 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>]
+ # <tt>"<em>package_dir</em>/<em>name</em>-<em>version</em>.tar.gz"</tt> ::
# 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>]
+ # <tt>"<em>package_dir</em>/<em>name</em>-<em>version</em>.tar.bz2"</tt> ::
# 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>]
+ # <tt>"<em>package_dir</em>/<em>name</em>-<em>version</em>.zip"</tt> ::
# Create a zip package archive (if <em>need_zip</em> is true).
#
# Example:
@@ -51,13 +51,16 @@ module Rake
# 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).
+ # 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).
+ # 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).
+ # 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)
@@ -121,9 +124,10 @@ module Rake
].each do |(need, file, flag)|
if need
task :package => ["#{package_dir}/#{file}"]
- file "#{package_dir}/#{file}" => [package_dir_path] + package_files do
+ file "#{package_dir}/#{file}" =>
+ [package_dir_path] + package_files do
chdir(package_dir) do
- sh %{#{@tar_command} #{flag}cvf #{file} #{package_name}}
+ sh @tar_command, "#{flag}cvf", file, package_name
end
end
end
@@ -131,9 +135,10 @@ module Rake
if need_zip
task :package => ["#{package_dir}/#{zip_file}"]
- file "#{package_dir}/#{zip_file}" => [package_dir_path] + package_files do
+ file "#{package_dir}/#{zip_file}" =>
+ [package_dir_path] + package_files do
chdir(package_dir) do
- sh %{#{@zip_command} -r #{zip_file} #{package_name}}
+ sh @zip_command, "-r", zip_file, package_name
end
end
end
@@ -145,7 +150,7 @@ module Rake
@package_files.each do |fn|
f = File.join(package_dir_path, fn)
fdir = File.dirname(f)
- mkdir_p(fdir) if !File.exist?(fdir)
+ mkdir_p(fdir) unless File.exist?(fdir)
if File.directory?(fn)
mkdir_p(f)
else
@@ -157,26 +162,38 @@ module Rake
self
end
+ # The name of this package
+
def package_name
@version ? "#{@name}-#{@version}" : @name
end
+ # The directory this package will be built in
+
def package_dir_path
"#{package_dir}/#{package_name}"
end
+ # The package name with .tgz added
+
def tgz_file
"#{package_name}.tgz"
end
+ # The package name with .tar.gz added
+
def tar_gz_file
"#{package_name}.tar.gz"
end
+ # The package name with .tar.bz2 added
+
def tar_bz2_file
"#{package_name}.tar.bz2"
end
+ # The package name with .zip added
+
def zip_file
"#{package_name}.zip"
end
diff --git a/lib/rake/pathmap.rb b/lib/rake/pathmap.rb
index 2275724341..9a840cda29 100644
--- a/lib/rake/pathmap.rb
+++ b/lib/rake/pathmap.rb
@@ -1 +1,3 @@
+# TODO: Remove in Rake 11
+
require 'rake/ext/string'
diff --git a/lib/rake/promise.rb b/lib/rake/promise.rb
index 3258b91139..31c4563476 100644
--- a/lib/rake/promise.rb
+++ b/lib/rake/promise.rb
@@ -17,7 +17,7 @@ module Rake
@mutex = Mutex.new
@result = NOT_SET
@error = NOT_SET
- @args = args.collect { |a| begin; a.dup; rescue; a; end }
+ @args = args
@block = block
end
diff --git a/lib/rake/pseudo_status.rb b/lib/rake/pseudo_status.rb
index b58df3da18..16e1903bd6 100644
--- a/lib/rake/pseudo_status.rb
+++ b/lib/rake/pseudo_status.rb
@@ -1,21 +1,26 @@
module Rake
- ####################################################################
+ ##
# Exit status class for times the system just gives us a nil.
- class PseudoStatus
+ class PseudoStatus # :nodoc: all
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
diff --git a/lib/rake/rake_module.rb b/lib/rake/rake_module.rb
index fcf5800064..3692753434 100644
--- a/lib/rake/rake_module.rb
+++ b/lib/rake/rake_module.rb
@@ -2,8 +2,6 @@ require 'rake/application'
module Rake
- # Rake module singleton methods.
- #
class << self
# Current Rake Application
def application
@@ -15,6 +13,11 @@ module Rake
@application = app
end
+ def suggested_thread_count # :nodoc:
+ @cpu_count ||= Rake::CpuCounter.count
+ @cpu_count + 4
+ end
+
# Return the original directory where the Rake application was started.
def original_dir
application.original_dir
@@ -28,9 +31,7 @@ module Rake
# Add files to the rakelib list
def add_rakelib(*files)
application.options.rakelib ||= []
- files.each do |file|
- application.options.rakelib << file
- end
+ application.options.rakelib.concat(files)
end
end
diff --git a/lib/rake/rdoctask.rb b/lib/rake/rdoctask.rb
index 261fa69b4d..8d7df4f12b 100644
--- a/lib/rake/rdoctask.rb
+++ b/lib/rake/rdoctask.rb
@@ -1,234 +1,4 @@
-# rake/rdoctask is deprecated in favor of rdoc/task
-
-if Rake.application
- Rake.application.deprecate('require \'rake/rdoctask\'', 'require \'rdoc/task\' (in RDoc 2.4.2+)', caller.first)
-end
-
-require 'rubygems'
-
-begin
- gem 'rdoc'
- require 'rdoc'
- require 'rdoc/task'
-rescue LoadError, Gem::LoadError
-end
-
-# :stopdoc:
-
-if defined?(RDoc::Task) then
- module Rake
- RDocTask = RDoc::Task unless const_defined? :RDocTask
- end
-else
- require 'rake'
- require 'rake/tasklib'
-
- module Rake
-
- # NOTE: Rake::RDocTask is deprecated in favor of RDoc:Task which is included
- # in RDoc 2.4.2+. Use require 'rdoc/task' to require it.
- #
- # Create a documentation task that will generate the RDoc files for
- # a project.
- #
- # The RDocTask will create the following targets:
- #
- # [<b><em>rdoc</em></b>]
- # Main task for this RDOC task.
- #
- # [<b>:clobber_<em>rdoc</em></b>]
- # Delete all the rdoc files. This target is automatically
- # added to the main clobber target.
- #
- # [<b>:re<em>rdoc</em></b>]
- # Rebuild the rdoc files from scratch, even if they are not out
- # of date.
- #
- # Simple Example:
- #
- # Rake::RDocTask.new do |rd|
- # rd.main = "README.rdoc"
- # rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
- # end
- #
- # The +rd+ object passed to the block is an RDocTask object. See the
- # attributes list for the RDocTask class for available customization options.
- #
- # == Specifying different task names
- #
- # You may wish to give the task a different name, such as if you are
- # generating two sets of documentation. For instance, if you want to have a
- # development set of documentation including private methods:
- #
- # Rake::RDocTask.new(:rdoc_dev) do |rd|
- # rd.main = "README.doc"
- # rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
- # rd.options << "--all"
- # end
- #
- # The tasks would then be named :<em>rdoc_dev</em>, :clobber_<em>rdoc_dev</em>, and
- # :re<em>rdoc_dev</em>.
- #
- # If you wish to have completely different task names, then pass a Hash as
- # first argument. With the <tt>:rdoc</tt>, <tt>:clobber_rdoc</tt> and
- # <tt>:rerdoc</tt> options, you can customize the task names to your liking.
- # For example:
- #
- # Rake::RDocTask.new(:rdoc => "rdoc", :clobber_rdoc => "rdoc:clean", :rerdoc => "rdoc:force")
- #
- # This will create the tasks <tt>:rdoc</tt>, <tt>:rdoc_clean</tt> and
- # <tt>:rdoc:force</tt>.
- #
- class RDocTask < TaskLib
- # Name of the main, top level task. (default is :rdoc)
- attr_accessor :name
-
- # Name of directory to receive the html output files. (default is "html")
- attr_accessor :rdoc_dir
-
- # Title of RDoc documentation. (defaults to rdoc's default)
- attr_accessor :title
-
- # Name of file to be used as the main, top level file of the
- # RDoc. (default is none)
- attr_accessor :main
-
- # Name of template to be used by rdoc. (defaults to rdoc's default)
- attr_accessor :template
-
- # List of files to be included in the rdoc generation. (default is [])
- attr_accessor :rdoc_files
-
- # Additional list of options to be passed rdoc. (default is [])
- attr_accessor :options
-
- # Whether to run the rdoc process as an external shell (default is false)
- attr_accessor :external
-
- attr_accessor :inline_source
-
- # Create an RDoc task with the given name. See the RDocTask class overview
- # for documentation.
- def initialize(name = :rdoc) # :yield: self
- if name.is_a?(Hash)
- invalid_options = name.keys.map { |k| k.to_sym } - [:rdoc, :clobber_rdoc, :rerdoc]
- if !invalid_options.empty?
- raise ArgumentError, "Invalid option(s) passed to RDocTask.new: #{invalid_options.join(", ")}"
- end
- end
-
- @name = name
- @rdoc_files = Rake::FileList.new
- @rdoc_dir = 'html'
- @main = nil
- @title = nil
- @template = nil
- @external = false
- @inline_source = true
- @options = []
- yield self if block_given?
- define
- end
-
- # Create the tasks defined by this task lib.
- def define
- if rdoc_task_name != "rdoc"
- desc "Build the RDOC HTML Files"
- else
- desc "Build the #{rdoc_task_name} HTML Files"
- end
- task rdoc_task_name
-
- desc "Force a rebuild of the RDOC files"
- task rerdoc_task_name => [clobber_task_name, rdoc_task_name]
-
- desc "Remove rdoc products"
- task clobber_task_name do
- rm_r rdoc_dir rescue nil
- end
-
- task :clobber => [clobber_task_name]
-
- directory @rdoc_dir
- task rdoc_task_name => [rdoc_target]
- file rdoc_target => @rdoc_files + [Rake.application.rakefile] do
- rm_r @rdoc_dir rescue nil
- @before_running_rdoc.call if @before_running_rdoc
- args = option_list + @rdoc_files
- if @external
- argstring = args.join(' ')
- sh %{ruby -Ivendor vendor/rd #{argstring}}
- else
- require 'rdoc/rdoc'
- RDoc::RDoc.new.document(args)
- end
- end
- self
- end
-
- def option_list
- result = @options.dup
- result << "-o" << @rdoc_dir
- result << "--main" << quote(main) if main
- result << "--title" << quote(title) if title
- result << "-T" << quote(template) if template
- result << "--inline-source" if inline_source && !@options.include?("--inline-source") && !@options.include?("-S")
- result
- end
-
- def quote(str)
- if @external
- "'#{str}'"
- else
- str
- end
- end
-
- def option_string
- option_list.join(' ')
- end
-
- # The block passed to this method will be called just before running the
- # RDoc generator. It is allowed to modify RDocTask attributes inside the
- # block.
- def before_running_rdoc(&block)
- @before_running_rdoc = block
- end
-
- private
-
- def rdoc_target
- "#{rdoc_dir}/index.html"
- end
-
- def rdoc_task_name
- case name
- when Hash
- (name[:rdoc] || "rdoc").to_s
- else
- name.to_s
- end
- end
-
- def clobber_task_name
- case name
- when Hash
- (name[:clobber_rdoc] || "clobber_rdoc").to_s
- else
- "clobber_#{name}"
- end
- end
-
- def rerdoc_task_name
- case name
- when Hash
- (name[:rerdoc] || "rerdoc").to_s
- else
- "re#{name}"
- end
- end
-
- end
- end
-end
+# TODO: Remove in Rake 11
+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
index 9e411ed51a..40b30a6fde 100644
--- a/lib/rake/ruby182_test_unit_fix.rb
+++ b/lib/rake/ruby182_test_unit_fix.rb
@@ -1,3 +1,5 @@
+# TODO: Remove in rake 11
+
# 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
@@ -10,12 +12,14 @@ module Test # :nodoc:
def collect_file(name, suites, already_gathered) # :nodoc:
dir = File.dirname(File.expand_path(name))
$:.unshift(dir) unless $:.first == dir
- if(@req)
+ if @req
@req.require(name)
else
require(name)
end
- find_test_cases(already_gathered).each{|t| add_suite(suites, t.suite)}
+ find_test_cases(already_gathered).each do |t|
+ add_suite(suites, t.suite)
+ end
ensure
$:.delete_at $:.rindex(dir)
end
diff --git a/lib/rake/runtest.rb b/lib/rake/runtest.rb
index bd816ccfde..4774b0e262 100644
--- a/lib/rake/runtest.rb
+++ b/lib/rake/runtest.rb
@@ -5,8 +5,13 @@ require 'rake/file_list'
module Rake
include Test::Unit::Assertions
- def run_tests(pattern='test/test*.rb', log_enabled=false)
- FileList.glob(pattern).each { |fn|
+ ##
+ # Deprecated way of running tests in process, but only for Test::Unit.
+ #--
+ # TODO: Remove in rake 11
+
+ def run_tests(pattern='test/test*.rb', log_enabled=false) # :nodoc:
+ FileList.glob(pattern).each do |fn|
$stderr.puts fn if log_enabled
begin
require fn
@@ -15,7 +20,7 @@ module Rake
$stderr.puts ex.backtrace
assert false
end
- }
+ end
end
extend self
diff --git a/lib/rake/scope.rb b/lib/rake/scope.rb
new file mode 100644
index 0000000000..dbefcea465
--- /dev/null
+++ b/lib/rake/scope.rb
@@ -0,0 +1,42 @@
+module Rake
+ class Scope < LinkedList # :nodoc: all
+
+ # 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
index ac0ce68c60..9bcf725523 100644
--- a/lib/rake/task.rb
+++ b/lib/rake/task.rb
@@ -2,7 +2,7 @@ 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
@@ -21,13 +21,6 @@ module Rake
# Application owning this task.
attr_accessor :application
- # Comment for this task. Restricted to a single line of no more than 50
- # characters.
- attr_reader :comment
-
- # Full text of the (possibly multi-line) comment.
- attr_reader :full_comment
-
# Array of nested namespaces names used for task lookup by this task.
attr_reader :scope
@@ -41,45 +34,66 @@ module Rake
name
end
- def inspect
+ def inspect # :nodoc:
"<#{self.class} #{name} => [#{prerequisites.join(', ')}]>"
end
# List of sources for task.
attr_writer :sources
def sources
- @sources ||= []
+ if defined?(@sources)
+ @sources
+ else
+ prerequisites
+ end
end
# List of prerequisite tasks
def prerequisite_tasks
- prerequisites.collect { |pre| lookup_prerequisite(pre) }
+ prerequisites.map { |pre| lookup_prerequisite(pre) }
end
- def lookup_prerequisite(prerequisite_name)
+ def lookup_prerequisite(prerequisite_name) # :nodoc:
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) # :nodoc:
+ 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)
+ sources.first
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 = []
+ @name = task_name.to_s
+ @prerequisites = []
+ @actions = []
@already_invoked = false
- @full_comment = nil
- @comment = nil
- @lock = Monitor.new
- @application = app
- @scope = app.current_scope
- @arg_names = nil
- @locations = []
+ @comments = []
+ @lock = Monitor.new
+ @application = app
+ @scope = app.current_scope
+ @arg_names = nil
+ @locations = []
end
# Enhance a task with prerequisites or actions. Returns self.
@@ -141,8 +155,7 @@ module Rake
# Clear the existing comments on a rake task.
def clear_comments
- @full_comment = nil
- @comment = nil
+ @comments = []
self
end
@@ -171,8 +184,9 @@ module Rake
end
protected :invoke_with_call_chain
- def add_chain_to(exception, new_chain)
- exception.extend(InvocationExceptionMixin) unless exception.respond_to?(:chain)
+ def add_chain_to(exception, new_chain) # :nodoc:
+ exception.extend(InvocationExceptionMixin) unless
+ exception.respond_to?(:chain)
exception.chain = new_chain if exception.chain.nil?
end
private :add_chain_to
@@ -190,8 +204,8 @@ module Rake
end
# Invoke all the prerequisites of a task in parallel.
- def invoke_prerequisites_concurrently(task_args, invocation_chain) # :nodoc:
- futures = prerequisite_tasks.collect do |p|
+ 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)
@@ -216,9 +230,7 @@ module Rake
application.trace "** Execute (dry run) #{name}"
return
end
- if application.options.trace
- application.trace "** Execute #{name}"
- 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
@@ -238,38 +250,58 @@ module Rake
# Timestamp for this task. Basic tasks return the current time for their
# time stamp. Other tasks can be more sophisticated.
def timestamp
- prerequisite_tasks.collect { |pre| pre.timestamp }.max || Time.now
+ 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 if ! description
+ return unless description
comment = description.strip
add_comment(comment) if comment && ! comment.empty?
end
- # Writing to the comment attribute is the same as adding a description.
- def comment=(description)
- add_description(description)
+ def comment=(comment) # :nodoc:
+ add_comment(comment)
end
- # Add a comment to the task. If a comment already exists, separate
- # the new comment with " / ".
- def add_comment(comment)
- if @full_comment
- @full_comment << " / "
- else
- @full_comment = ''
- end
- @full_comment << comment
- if @full_comment =~ /\A([^.]+?\.)( |$)/
- @comment = $1
+ def add_comment(comment) # :nodoc:
+ return if comment.nil?
+ @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
- @comment = @full_comment
+ block ||= lambda { |c| c }
+ @comments.map(&block).join(separator)
end
end
- private :add_comment
+ 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.
@@ -287,11 +319,11 @@ module Rake
result << "timestamp: #{timestamp}\n"
result << "pre-requisites: \n"
prereqs = prerequisite_tasks
- prereqs.sort! {|a,b| a.timestamp <=> b.timestamp}
+ prereqs.sort! { |a, b| a.timestamp <=> b.timestamp }
prereqs.each do |p|
result << "--#{p.name} (#{p.timestamp})\n"
end
- latest_prereq = prerequisite_tasks.collect { |pre| pre.timestamp }.max
+ latest_prereq = prerequisite_tasks.map { |pre| pre.timestamp }.max
result << "latest-prerequisite time: #{latest_prereq}\n"
result << "................................\n\n"
return result
@@ -342,7 +374,8 @@ module Rake
# 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 + [task_name]).join(':')
+ scope.path_with_task_name(task_name)
end
end # class << Rake::Task
diff --git a/lib/rake/task_arguments.rb b/lib/rake/task_arguments.rb
index 4417af2f8e..fc0d657274 100644
--- a/lib/rake/task_arguments.rb
+++ b/lib/rake/task_arguments.rb
@@ -1,30 +1,41 @@
module Rake
- ####################################################################
+ ##
# TaskArguments manage the arguments passed to a task.
#
class TaskArguments
include Enumerable
+ # Argument names
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.
+ # Create a TaskArgument object with a list of argument +names+ and a set
+ # of associated +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
+ # Retrieve the complete array of sequential values
+ def to_a
+ @values.dup
+ end
+
+ # Retrieve 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.collect { |n| self[n] }
- self.class.new(names, values, self)
+ values = names.map { |n| self[n] }
+ self.class.new(names, values + extras, self)
end
# Find an argument value by name or index.
@@ -39,33 +50,42 @@ module Rake
@hash = defaults.merge(@hash)
end
+ # Enumerates the arguments and their values
def each(&block)
@hash.each(&block)
end
+ # Extracts the argument values at +keys+
def values_at(*keys)
keys.map { |k| lookup(k) }
end
+ # Returns the value of the given argument via method_missing
def method_missing(sym, *args)
lookup(sym.to_sym)
end
+ # Returns a Hash of arguments and their values
def to_hash
@hash
end
- def to_s
+ def to_s # :nodoc:
@hash.inspect
end
- def inspect
+ def inspect # :nodoc:
to_s
end
+ # Returns true if +key+ is one of the arguments
+ def has_key?(key)
+ @hash.has_key?(key)
+ end
+
protected
- def lookup(name)
+ def lookup(name) # :nodoc:
if @hash.has_key?(name)
@hash[name]
elsif @parent
@@ -74,5 +94,5 @@ module Rake
end
end
- EMPTY_TASK_ARGS = TaskArguments.new([], [])
+ EMPTY_TASK_ARGS = TaskArguments.new([], []) # :nodoc:
end
diff --git a/lib/rake/task_manager.rb b/lib/rake/task_manager.rb
index 5a9419d536..221c68cec4 100644
--- a/lib/rake/task_manager.rb
+++ b/lib/rake/task_manager.rb
@@ -4,27 +4,38 @@ module Rake
module TaskManager
# Track the last comment made in the Rakefile.
attr_accessor :last_description
- alias :last_comment :last_description # Backwards compatibility
- def initialize
+ # TODO: Remove in Rake 11
+
+ alias :last_comment :last_description # :nodoc: Backwards compatibility
+
+ def initialize # :nodoc:
super
@tasks = Hash.new
@rules = Array.new
- @scope = Array.new
+ @scope = Scope.make
@last_description = nil
end
- def create_rule(*args, &block)
- pattern, _, deps = resolve_args(args)
+ def create_rule(*args, &block) # :nodoc:
+ pattern, args, deps = resolve_args(args)
pattern = Regexp.new(Regexp.quote(pattern) + '$') if String === pattern
- @rules << [pattern, deps, block]
+ @rules << [pattern, args, deps, block]
end
- def define_task(task_class, *args, &block)
+ def define_task(task_class, *args, &block) # :nodoc:
task_name, arg_names, deps = resolve_args(args)
+
+ original_scope = @scope
+ if String === task_name and
+ not task_class.ancestors.include? Rake::FileTask then
+ task_name, *definition_scope = *(task_name.split(":").reverse)
+ @scope = Scope.make(*(definition_scope + @scope.to_a))
+ end
+
task_name = task_class.scope_name(@scope, task_name)
deps = [deps] unless deps.respond_to?(:to_ary)
- deps = deps.collect {|d| d.to_s }
+ deps = deps.map { |d| Rake.from_pathname(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
@@ -32,6 +43,8 @@ module Rake
task.add_description(get_description(task))
end
task.enhance(deps, &block)
+ ensure
+ @scope = original_scope
end
# Lookup a task. Return an existing task if found, otherwise
@@ -49,7 +62,7 @@ module Rake
fail "Don't know how to build task '#{task_name}'"
end
- def synthesize_file_task(task_name)
+ def synthesize_file_task(task_name) # :nodoc:
return nil unless File.exist?(task_name)
define_task(Rake::FileTask, task_name)
end
@@ -72,7 +85,6 @@ module Rake
#
# task :t
# task :t, [:a]
- # task :t, :a (deprecated)
#
def resolve_args_without_dependencies(args)
task_name = args.shift
@@ -92,24 +104,14 @@ module Rake
#
# task :t => [:d]
# task :t, [a] => [:d]
- # task :t, :needs => [:d] (deprecated)
- # task :t, :a, :needs => [:d] (deprecated)
#
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
+ key, value = hash.map { |k, v| [k, v] }.first
if args.empty?
task_name = key
arg_names = []
deps = value
- elsif key == :needs
- Rake.application.deprecate(
- "task :t, arg, :needs => [deps]",
- "task :t, [args] => [deps]",
- caller.detect { |c| c !~ /\blib\/rake\b/ })
- task_name = args.shift
- arg_names = args
- deps = value
else
task_name = args.shift
arg_names = key
@@ -127,9 +129,9 @@ module Rake
def enhance_with_matching_rule(task_name, level=0)
fail Rake::RuleRecursionOverflowError,
"Rule Recursion Too Deep" if level >= 16
- @rules.each do |pattern, extensions, block|
+ @rules.each do |pattern, args, extensions, block|
if pattern.match(task_name)
- task = attempt_rule(task_name, extensions, block, level)
+ task = attempt_rule(task_name, args, extensions, block, level)
return task if task
end
end
@@ -147,7 +149,7 @@ module Rake
# List of all the tasks defined in the given scope (and its
# sub-scopes).
def tasks_in_scope(scope)
- prefix = scope.join(":")
+ prefix = scope.path
tasks.select { |t|
/^#{prefix}:/ =~ t.name
}
@@ -168,10 +170,10 @@ module Rake
initial_scope ||= @scope
task_name = task_name.to_s
if task_name =~ /^rake:/
- scopes = []
+ scopes = Scope.make
task_name = task_name.sub(/^rake:/, '')
elsif task_name =~ /^(\^+)/
- scopes = initial_scope[0, initial_scope.size - $1.size]
+ scopes = initial_scope.trim($1.size)
task_name = task_name.sub(/^(\^+)/, '')
else
scopes = initial_scope
@@ -181,12 +183,12 @@ module Rake
# Lookup the task name
def lookup_in_scope(name, scope)
- n = scope.size
- while n >= 0
- tn = (scope[0,n] + [name]).join(':')
+ loop do
+ tn = scope.path_with_task_name(name)
task = @tasks[tn]
return task if task
- n -= 1
+ break if scope.empty?
+ scope = scope.tail
end
nil
end
@@ -195,19 +197,19 @@ module Rake
# Return the list of scope names currently active in the task
# manager.
def current_scope
- @scope.dup
+ @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.push(name)
+ @scope = Scope.new(name, @scope)
ns = NameSpace.new(self, @scope)
yield(ns)
ns
ensure
- @scope.pop
+ @scope = @scope.tail
end
private
@@ -224,7 +226,7 @@ module Rake
locations = caller
i = 0
while locations[i]
- return locations[i+1] if locations[i] =~ /rake\/dsl_definition.rb/
+ return locations[i + 1] if locations[i] =~ /rake\/dsl_definition.rb/
i += 1
end
nil
@@ -237,19 +239,20 @@ module Rake
"_anon_#{@seed}"
end
- def trace_rule(level, message)
- options.trace_output.puts "#{" "*level}#{message}" if Rake.application.options.trace_rules
+ def trace_rule(level, message) # :nodoc:
+ 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, extensions, block, level)
+ def attempt_rule(task_name, args, extensions, block, level)
sources = make_sources(task_name, extensions)
- prereqs = sources.collect { |source|
+ 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)
+ elsif parent = enhance_with_matching_rule(source, level + 1)
trace_rule level, "(#{task_name} => #{source} ... ENHANCE)"
parent.name
else
@@ -257,7 +260,7 @@ module Rake
return nil
end
}
- task = FileTask.define_task({task_name => prereqs}, &block)
+ task = FileTask.define_task(task_name, {args => prereqs}, &block)
task.sources = prereqs
task
end
@@ -265,7 +268,7 @@ module Rake
# Make a list of sources from the list of file name extensions /
# translation procs.
def make_sources(task_name, extensions)
- result = extensions.collect { |ext|
+ result = extensions.map { |ext|
case ext
when /%/
task_name.pathmap(ext)
@@ -275,7 +278,7 @@ module Rake
task_name.ext(ext)
when String
ext
- when Proc
+ when Proc, Method
if ext.arity == 1
ext.call(task_name)
else
@@ -299,7 +302,7 @@ module Rake
end
class << self
- attr_accessor :record_task_metadata
+ attr_accessor :record_task_metadata # :nodoc:
TaskManager.record_task_metadata = false
end
end
diff --git a/lib/rake/tasklib.rb b/lib/rake/tasklib.rb
index f1e17dad31..6203d9402b 100644
--- a/lib/rake/tasklib.rb
+++ b/lib/rake/tasklib.rb
@@ -14,7 +14,9 @@ module Rake
# 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:
+ #--
+ # TODO: Remove in Rake 11
+ def paste(a, b) # :nodoc:
(a.to_s + b.to_s).intern
end
end
diff --git a/lib/rake/testtask.rb b/lib/rake/testtask.rb
index 19592d80c8..2daa589634 100644
--- a/lib/rake/testtask.rb
+++ b/lib/rake/testtask.rb
@@ -1,5 +1,3 @@
-# Define a task library for running unit tests.
-
require 'rake'
require 'rake/tasklib'
@@ -67,6 +65,9 @@ module Rake
# Array of commandline options to pass to ruby when running test loader.
attr_accessor :ruby_opts
+ # Description of the test task. (default is 'Run tests')
+ attr_accessor :description
+
# 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
@@ -86,6 +87,7 @@ module Rake
@warning = false
@loader = :rake
@ruby_opts = []
+ @description = "Run tests" + (@name == :test ? "" : " for #{@name}")
yield self if block_given?
@pattern = 'test/test*.rb' if @pattern.nil? && @test_files.nil?
define
@@ -93,15 +95,18 @@ module Rake
# Create the tasks defined by this task lib.
def define
- desc "Run tests" + (@name==:test ? "" : " for #{@name}")
+ desc @description
task @name do
FileUtilsExt.verbose(@verbose) do
- args = "#{ruby_opts_string} #{run_code} #{file_list_string} #{option_list}"
+ 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}]"
+ fail "Command failed with status (#{status.exitstatus}): " +
+ "[ruby #{args}]"
end
end
end
@@ -118,24 +123,24 @@ module Rake
"")
end
- def ruby_opts_string
+ def ruby_opts_string # :nodoc:
opts = @ruby_opts.dup
- opts.unshift( "-I\"#{lib_path}\"" ) unless @libs.empty?
- opts.unshift( "-w" ) if @warning
+ opts.unshift("-I\"#{lib_path}\"") unless @libs.empty?
+ opts.unshift("-w") if @warning
opts.join(" ")
end
- def lib_path
+ def lib_path # :nodoc:
@libs.join(File::PATH_SEPARATOR)
end
- def file_list_string
- file_list.collect { |fn| "\"#{fn}\"" }.join(' ')
+ def file_list_string # :nodoc:
+ file_list.map { |fn| "\"#{fn}\"" }.join(' ')
end
def file_list # :nodoc:
if ENV['TEST']
- FileList[ ENV['TEST'] ]
+ FileList[ENV['TEST']]
else
result = []
result += @test_files.to_a if @test_files
@@ -153,18 +158,18 @@ module Rake
end || ''
end
- def ruby_version
+ def ruby_version # :nodoc:
RUBY_VERSION
end
- def run_code
+ def run_code # :nodoc:
case @loader
when :direct
"-e \"ARGV.each{|f| require f}\""
when :testrb
"-S testrb #{fix}"
when :rake
- "-I\"#{rake_lib_dir}\" \"#{rake_loader}\""
+ "#{rake_include_arg} \"#{rake_loader}\""
end
end
@@ -181,6 +186,15 @@ module Rake
nil
end
+ def rake_include_arg # :nodoc:
+ spec = Gem.loaded_specs['rake']
+ if spec.respond_to?(:default_gem?) && spec.default_gem?
+ ""
+ else
+ "-I\"#{rake_lib_dir}\""
+ end
+ end
+
def rake_lib_dir # :nodoc:
find_dir('rake') or
fail "unable to find rake lib"
diff --git a/lib/rake/thread_history_display.rb b/lib/rake/thread_history_display.rb
index 917e951064..c2af9ecef5 100644
--- a/lib/rake/thread_history_display.rb
+++ b/lib/rake/thread_history_display.rb
@@ -25,7 +25,7 @@ module Rake
(stat[:time] * 1_000_000).round,
stat[:thread],
stat[:event],
- stat[:data].map { |k,v| "#{k}:#{v}" }.join(" "))
+ stat[:data].map do |k, v| "#{k}:#{v}" end.join(" "))
end
end
diff --git a/lib/rake/thread_pool.rb b/lib/rake/thread_pool.rb
index 983a67a514..d2ac6e7ac2 100644
--- a/lib/rake/thread_pool.rb
+++ b/lib/rake/thread_pool.rb
@@ -5,10 +5,10 @@ require 'rake/promise'
module Rake
- class ThreadPool # :nodoc: all
+ class ThreadPool # :nodoc: all
- # Creates a ThreadPool object.
- # The parameter is the size of the pool.
+ # Creates a ThreadPool object. The +thread_count+ parameter is the size
+ # of the pool.
def initialize(thread_count)
@max_active_threads = [thread_count, 0].max
@threads = Set.new
@@ -25,9 +25,9 @@ module Rake
# 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
+ # Thread#new) 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
+ # pool. Sending #value 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)
@@ -50,8 +50,10 @@ module Rake
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.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"
@@ -107,13 +109,19 @@ module Rake
false
end
+ def safe_thread_count
+ @threads_mon.synchronize do
+ @threads.count
+ end
+ 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
+ while safe_thread_count <= @max_active_threads
break unless process_queue_item
end
ensure
@@ -124,9 +132,14 @@ module Rake
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
+ 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
@@ -146,10 +159,6 @@ module Rake
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
index e4d61cfb93..396096d4df 100644
--- a/lib/rake/trace_output.rb
+++ b/lib/rake/trace_output.rb
@@ -1,5 +1,5 @@
module Rake
- module TraceOutput
+ module TraceOutput # :nodoc: all
# Write trace output to output stream +out+.
#
@@ -11,7 +11,10 @@ module Rake
if strings.empty?
output = sep
else
- output = strings.map { |s| s.end_with?(sep) ? s : s + sep }.join
+ output = strings.map { |s|
+ next if s.nil?
+ s =~ /#{sep}$/ ? s : s + sep
+ }.join
end
out.print(output)
end
diff --git a/lib/rake/version.rb b/lib/rake/version.rb
index 11f2f15493..b9b1b2d485 100644
--- a/lib/rake/version.rb
+++ b/lib/rake/version.rb
@@ -1,13 +1,7 @@
module Rake
- VERSION = '0.9.6'
-
module Version # :nodoc: all
- MAJOR, MINOR, BUILD, = Rake::VERSION.split '.'
+ MAJOR, MINOR, BUILD, *OTHER = Rake::VERSION.split '.'
- NUMBERS = [
- MAJOR,
- MINOR,
- BUILD,
- ]
+ NUMBERS = [MAJOR, MINOR, BUILD, *OTHER]
end
end
diff --git a/lib/rake/win32.rb b/lib/rake/win32.rb
index 98289a10b4..6b4873da2c 100644
--- a/lib/rake/win32.rb
+++ b/lib/rake/win32.rb
@@ -4,7 +4,7 @@ module Rake
# Win 32 interface methods for Rake. Windows specific functionality
# will be placed here to collect that knowledge in one spot.
- module Win32
+ module Win32 # :nodoc: all
# Error indicating a problem in locating the home directory on a
# Win32 system.
@@ -40,8 +40,9 @@ module Rake
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?
+ 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
diff --git a/lib/rational.rb b/lib/rational.rb
deleted file mode 100644
index a1aeca1e40..0000000000
--- a/lib/rational.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-# :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/obsolete.rb b/lib/rbconfig/obsolete.rb
deleted file mode 100644
index 7025fb43fb..0000000000
--- a/lib/rbconfig/obsolete.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-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 32a3658e41..87ed2df9b6 100644
--- a/lib/rdoc.rb
+++ b/lib/rdoc.rb
@@ -14,7 +14,7 @@ $DEBUG_RDOC = nil
#
# == Roadmap
#
-# If you think you found a bug in RDoc see DEVELOPERS@Bugs
+# If you think you found a bug in RDoc see CONTRIBUTING@Bugs
#
# If you want to use RDoc to create documentation for your Ruby source files,
# see RDoc::Markup and refer to <tt>rdoc --help</tt> for command line usage.
@@ -42,7 +42,7 @@ $DEBUG_RDOC = nil
#
# If you want to write your own output generator see RDoc::Generator.
#
-# If you want an overview of how RDoc works see DEVELOPERS
+# If you want an overview of how RDoc works see CONTRIBUTING
#
# == Credits
#
@@ -64,7 +64,7 @@ module RDoc
##
# RDoc version you are using
- VERSION = '4.0.0'
+ VERSION = '4.2.0.alpha'
##
# Method visibilities
@@ -151,6 +151,8 @@ module RDoc
autoload :Comment, 'rdoc/comment'
+ autoload :I18n, 'rdoc/i18n'
+
# code objects
#
# We represent the various high-level code constructs that appear in Ruby
@@ -174,6 +176,7 @@ module RDoc
autoload :Attr, 'rdoc/attr'
autoload :Constant, 'rdoc/constant'
+ autoload :Mixin, 'rdoc/mixin'
autoload :Include, 'rdoc/include'
autoload :Extend, 'rdoc/extend'
autoload :Require, 'rdoc/require'
diff --git a/lib/rdoc/any_method.rb b/lib/rdoc/any_method.rb
index 23110dcb2a..ae022d72f8 100644
--- a/lib/rdoc/any_method.rb
+++ b/lib/rdoc/any_method.rb
@@ -9,8 +9,11 @@ class RDoc::AnyMethod < RDoc::MethodAttr
# Added calls_super
# Added parent name and class
# Added section title
+ # 3::
+ # RDoc 4.1
+ # Added is_alias_for
- MARSHAL_VERSION = 2 # :nodoc:
+ MARSHAL_VERSION = 3 # :nodoc:
##
# Don't rename \#initialize to \::new
@@ -25,7 +28,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
##
# Different ways to call this method
- attr_accessor :call_seq
+ attr_reader :call_seq
##
# Parameters for this method
@@ -90,6 +93,37 @@ class RDoc::AnyMethod < RDoc::MethodAttr
end
##
+ # Sets the different ways you can call this method. If an empty +call_seq+
+ # is given nil is assumed.
+ #
+ # See also #param_seq
+
+ def call_seq= call_seq
+ return if call_seq.empty?
+
+ @call_seq = call_seq
+ end
+
+ ##
+ # Loads is_alias_for from the internal name. Returns nil if the alias
+ # cannot be found.
+
+ def is_alias_for # :nodoc:
+ case @is_alias_for
+ when RDoc::MethodAttr then
+ @is_alias_for
+ when Array then
+ return nil unless @store
+
+ klass_name, singleton, method_name = @is_alias_for
+
+ return nil unless klass = @store.find_class_or_module(klass_name)
+
+ @is_alias_for = klass.find_method method_name, singleton
+ end
+ end
+
+ ##
# Dumps this AnyMethod for use by ri. See also #marshal_load
def marshal_dump
@@ -97,6 +131,12 @@ class RDoc::AnyMethod < RDoc::MethodAttr
[a.name, parse(a.comment)]
end
+ is_alias_for = [
+ @is_alias_for.parent.full_name,
+ @is_alias_for.singleton,
+ @is_alias_for.name
+ ] if @is_alias_for
+
[ MARSHAL_VERSION,
@name,
full_name,
@@ -112,6 +152,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
@parent.name,
@parent.class,
@section.title,
+ is_alias_for,
]
end
@@ -126,7 +167,6 @@ class RDoc::AnyMethod < RDoc::MethodAttr
initialize_visibility
@dont_rename_initialize = nil
- @is_alias_for = nil
@token_stream = nil
@aliases = []
@parent = nil
@@ -150,6 +190,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
@parent_name = array[12]
@parent_title = array[13]
@section_title = array[14]
+ @is_alias_for = array[15]
array[8].each do |new_name, comment|
add_alias RDoc::Alias.new(nil, @name, new_name, comment, @singleton)
@@ -174,7 +215,10 @@ class RDoc::AnyMethod < RDoc::MethodAttr
def name
return @name if @name
- @name = @call_seq[/^.*?\.(\w+)/, 1] || @call_seq if @call_seq
+ @name =
+ @call_seq[/^.*?\.(\w+)/, 1] ||
+ @call_seq[/^.*?(\w+)/, 1] ||
+ @call_seq if @call_seq
end
##
@@ -196,7 +240,15 @@ class RDoc::AnyMethod < RDoc::MethodAttr
return []
end
- params = params.gsub(/\s+/, '').split ','
+ 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.map { |param| param.sub(/=.*/, '') }
end
diff --git a/lib/rdoc/class_module.rb b/lib/rdoc/class_module.rb
index 5a279b516d..71566f050a 100644
--- a/lib/rdoc/class_module.rb
+++ b/lib/rdoc/class_module.rb
@@ -169,13 +169,25 @@ class RDoc::ClassModule < RDoc::Context
includes.map { |i| i.module }.reverse
end
+ def aref_prefix # :nodoc:
+ raise NotImplementedError, "missing aref_prefix for #{self.class}"
+ end
+
+ ##
+ # HTML fragment reference for this module or class. See
+ # RDoc::NormalClass#aref and RDoc::NormalModule#aref
+
+ def aref
+ "#{aref_prefix}-#{full_name}"
+ end
+
##
# Ancestors of this class or module only
alias direct_ancestors ancestors
##
- # Clears the comment. Used by the ruby parser.
+ # Clears the comment. Used by the Ruby parser.
def clear_comment
@comment = ''
@@ -224,7 +236,9 @@ class RDoc::ClassModule < RDoc::Context
# #received_nodoc true?
def documented?
- super or !@comment_location.empty?
+ return true if @received_nodoc
+ return false if @comment_location.empty?
+ @comment_location.any? { |comment, _| not comment.empty? }
end
##
@@ -282,16 +296,18 @@ class RDoc::ClassModule < RDoc::Context
def marshal_dump # :nodoc:
attrs = attributes.sort.map do |attr|
+ next unless attr.display?
[ attr.name, attr.rw,
attr.visibility, attr.singleton, attr.file_name,
]
- end
+ end.compact
method_types = methods_by_type.map do |type, visibilities|
visibilities = visibilities.map do |visibility, methods|
method_names = methods.map do |method|
+ next unless method.display?
[method.name, method.file_name]
- end
+ end.compact
[visibility, method_names.uniq]
end
@@ -305,14 +321,16 @@ class RDoc::ClassModule < RDoc::Context
@superclass,
parse(@comment_location),
attrs,
- constants,
+ constants.select { |constant| constant.display? },
includes.map do |incl|
+ next unless incl.display?
[incl.name, parse(incl.comment), incl.file_name]
- end,
+ end.compact,
method_types,
extends.map do |ext|
+ next unless ext.display?
[ext.name, parse(ext.comment), ext.file_name]
- end,
+ end.compact,
@sections.values,
@in_files.map do |tl|
tl.relative_name
diff --git a/lib/rdoc/code_object.rb b/lib/rdoc/code_object.rb
index 83732e3d3b..4620fa586d 100644
--- a/lib/rdoc/code_object.rb
+++ b/lib/rdoc/code_object.rb
@@ -20,8 +20,9 @@
# * RDoc::MetaMethod
# * RDoc::Alias
# * RDoc::Constant
-# * RDoc::Require
-# * RDoc::Include
+# * RDoc::Mixin
+# * RDoc::Require
+# * RDoc::Include
class RDoc::CodeObject
@@ -92,7 +93,7 @@ class RDoc::CodeObject
##
# The RDoc::Store for this object.
- attr_accessor :store
+ attr_reader :store
##
# We are the model of the code, but we know that at some point we will be
@@ -105,16 +106,17 @@ class RDoc::CodeObject
# Creates a new CodeObject that will document itself and its children
def initialize
- @metadata = {}
- @comment = ''
- @parent = nil
- @parent_name = nil # for loading
- @parent_class = nil # for loading
- @section = nil
- @section_title = nil # for loading
- @file = nil
- @full_name = nil
- @store = nil
+ @metadata = {}
+ @comment = ''
+ @parent = nil
+ @parent_name = nil # for loading
+ @parent_class = nil # for loading
+ @section = nil
+ @section_title = nil # for loading
+ @file = nil
+ @full_name = nil
+ @store = nil
+ @track_visibility = true
initialize_visibility
end
@@ -129,6 +131,8 @@ class RDoc::CodeObject
@force_documentation = false
@received_nodoc = false
@ignored = false
+ @suppressed = false
+ @track_visibility = true
end
##
@@ -155,10 +159,17 @@ class RDoc::CodeObject
end
##
- # Should this CodeObject be shown in documentation?
+ # Should this CodeObject be displayed in output?
+ #
+ # A code object should be displayed if:
+ #
+ # * The item didn't have a nodoc or wasn't in a container that had nodoc
+ # * The item wasn't ignored
+ # * The item has documentation and was not suppressed
def display?
- @document_self and not @ignored
+ @document_self and not @ignored and
+ (documented? or not @suppressed)
end
##
@@ -166,6 +177,8 @@ class RDoc::CodeObject
# has been turned off by :enddoc:
def document_children=(document_children)
+ return unless @track_visibility
+
@document_children = document_children unless @done_documenting
end
@@ -175,6 +188,7 @@ class RDoc::CodeObject
# documentation is turned off by +:nodoc:+.
def document_self=(document_self)
+ return unless @track_visibility
return if @done_documenting
@document_self = document_self
@@ -198,8 +212,9 @@ class RDoc::CodeObject
# will have no effect in the current file.
def done_documenting=(value)
- @done_documenting = value
- @document_self = !value
+ return unless @track_visibility
+ @done_documenting = value
+ @document_self = !value
@document_children = @document_self
end
@@ -249,7 +264,7 @@ class RDoc::CodeObject
##
# Use this to ignore a CodeObject and all its children until found again
- # (#record_location is called). An ignored item will not be shown in
+ # (#record_location is called). An ignored item will not be displayed in
# documentation.
#
# See github issue #55
@@ -259,10 +274,13 @@ class RDoc::CodeObject
# and modules to add new documentation to previously created classes.
#
# If a class was ignored (via stopdoc) then reopened later with additional
- # documentation it should be shown. If a class was ignored and never
- # reopened it should not be shown. The ignore flag allows this to occur.
+ # documentation it should be displayed. If a class was ignored and never
+ # reopened it should not be displayed. The ignore flag allows this to
+ # occur.
def ignore
+ return unless @track_visibility
+
@ignored = true
stop_doc
@@ -270,12 +288,28 @@ class RDoc::CodeObject
##
# Has this class been ignored?
+ #
+ # See also #ignore
def ignored?
@ignored
end
##
+ # The options instance from the store this CodeObject is attached to, or a
+ # default options instance if the CodeObject is not attached.
+ #
+ # This is used by Text#snippet
+
+ def options
+ if @store and @store.rdoc then
+ @store.rdoc.options
+ else
+ RDoc::Options.new
+ end
+ end
+
+ ##
# Our parent CodeObject. The parent may be missing for classes loaded from
# legacy RI data stores.
@@ -316,8 +350,9 @@ class RDoc::CodeObject
# Records the RDoc::TopLevel (file) where this code object was defined
def record_location top_level
- @ignored = false
- @file = top_level
+ @ignored = false
+ @suppressed = false
+ @file = top_level
end
##
@@ -339,16 +374,56 @@ class RDoc::CodeObject
@document_self = true
@document_children = true
- @ignored = false
+ @ignored = false
+ @suppressed = false
end
##
# Disable capture of documentation
def stop_doc
+ return unless @track_visibility
+
@document_self = false
@document_children = false
end
+ ##
+ # Sets the +store+ that contains this CodeObject
+
+ def store= store
+ @store = store
+
+ return unless @track_visibility
+
+ if :nodoc == options.visibility then
+ initialize_visibility
+ @track_visibility = false
+ end
+ end
+
+ ##
+ # Use this to suppress a CodeObject and all its children until the next file
+ # it is seen in or documentation is discovered. A suppressed item with
+ # documentation will be displayed while an ignored item with documentation
+ # may not be displayed.
+
+ def suppress
+ return unless @track_visibility
+
+ @suppressed = true
+
+ stop_doc
+ end
+
+ ##
+ # Has this class been suppressed?
+ #
+ # See also #suppress
+
+ def suppressed?
+ @suppressed
+ end
+
end
diff --git a/lib/rdoc/comment.rb b/lib/rdoc/comment.rb
index 2b5be44ee5..33ced18b5a 100644
--- a/lib/rdoc/comment.rb
+++ b/lib/rdoc/comment.rb
@@ -118,9 +118,6 @@ class RDoc::Comment
seq.gsub!(/^\s*/, '')
method.call_seq = seq
end
- #elsif @text.sub!(/\A\/\*\s*call-seq:(.*?)\*\/\Z/, '') then
- # method.call_seq = $1.strip
- #end
method
end
diff --git a/lib/rdoc/constant.rb b/lib/rdoc/constant.rb
index 48b32aaf98..97985cbf99 100644
--- a/lib/rdoc/constant.rb
+++ b/lib/rdoc/constant.rb
@@ -63,7 +63,15 @@ class RDoc::Constant < RDoc::CodeObject
# for a documented class or module.
def documented?
- super or is_alias_for && is_alias_for.documented?
+ return true if super
+ return false unless @is_alias_for
+ case @is_alias_for
+ when String then
+ found = @store.find_class_or_module @is_alias_for
+ return false unless found
+ @is_alias_for = found
+ end
+ @is_alias_for.documented?
end
##
diff --git a/lib/rdoc/context.rb b/lib/rdoc/context.rb
index 22339bf1c7..5eb86ddc92 100644
--- a/lib/rdoc/context.rb
+++ b/lib/rdoc/context.rb
@@ -164,10 +164,30 @@ 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
##
+ # Adds an item of type +klass+ with the given +name+ and +comment+ to the
+ # context.
+ #
+ # Currently only RDoc::Extend and RDoc::Include are supported.
+
+ def add klass, name, comment
+ if RDoc::Extend == klass then
+ ext = RDoc::Extend.new name, comment
+ add_extend ext
+ elsif RDoc::Include == klass then
+ incl = RDoc::Include.new name, comment
+ add_include incl
+ else
+ raise NotImplementedError, "adding a #{klass} is not implemented"
+ end
+ end
+
+ ##
# Adds +an_alias+ that is automatically resolved
def add_alias an_alias
@@ -303,10 +323,11 @@ class RDoc::Context < RDoc::CodeObject
end
# fix up superclass
- superclass = nil if full_name == 'BasicObject'
- superclass = nil if full_name == 'Object' and defined?(::BasicObject)
- superclass = '::BasicObject' if
- defined?(::BasicObject) and full_name == 'Object'
+ if full_name == 'BasicObject' then
+ superclass = nil
+ elsif full_name == 'Object' then
+ superclass = defined?(::BasicObject) ? '::BasicObject' : nil
+ end
# find the superclass full name
if superclass then
@@ -1041,8 +1062,8 @@ class RDoc::Context < RDoc::CodeObject
#--
# TODO mark the visibility of attributes in the template (if not public?)
- def remove_invisible(min_visibility)
- return if min_visibility == :private
+ def remove_invisible min_visibility
+ return if [:private, :nodoc].include? min_visibility
remove_invisible_in @method_list, min_visibility
remove_invisible_in @attributes, min_visibility
end
diff --git a/lib/rdoc/cross_reference.rb b/lib/rdoc/cross_reference.rb
index 2cb0571732..5b08d5202d 100644
--- a/lib/rdoc/cross_reference.rb
+++ b/lib/rdoc/cross_reference.rb
@@ -18,7 +18,7 @@ class RDoc::CrossReference
#
# See CLASS_REGEXP_STR
- METHOD_REGEXP_STR = '([a-z]\w*[!?=]?|%|===)(?:\([\w.+*/=<>-]*\))?'
+ METHOD_REGEXP_STR = '([a-z]\w*[!?=]?|%|===|\[\]=?|<<|>>)(?:\([\w.+*/=<>-]*\))?'
##
# Regular expressions matching text that should potentially have
diff --git a/lib/rdoc/encoding.rb b/lib/rdoc/encoding.rb
index 9fe3539412..b3515a435f 100644
--- a/lib/rdoc/encoding.rb
+++ b/lib/rdoc/encoding.rb
@@ -29,7 +29,9 @@ module RDoc::Encoding
encoding ||= Encoding.default_external
orig_encoding = content.encoding
- if utf8 then
+ if not orig_encoding.ascii_compatible? then
+ content.encode! encoding
+ elsif utf8 then
content.force_encoding Encoding::UTF_8
content.encode! encoding
else
diff --git a/lib/rdoc/extend.rb b/lib/rdoc/extend.rb
index 2bccfba084..efa2c69bee 100644
--- a/lib/rdoc/extend.rb
+++ b/lib/rdoc/extend.rb
@@ -1,117 +1,9 @@
##
-# A Module extension in a class with \#extend
+# A Module extension to a class with \#extend
+#
+# RDoc::Extend.new 'Enumerable', 'comment ...'
-class RDoc::Extend < RDoc::CodeObject
-
- ##
- # Name of extension module
-
- attr_accessor :name
-
- ##
- # Creates a new Extend for +name+ with +comment+
-
- def initialize(name, comment)
- super()
- @name = name
- self.comment = comment
- @module = nil # cache for module if found
- end
-
- ##
- # Extends are sorted by name
-
- def <=> other
- return unless self.class === other
-
- name <=> other.name
- end
-
- def == other # :nodoc:
- self.class === other and @name == other.name
- end
-
- alias eql? ==
-
- ##
- # Full name based on #module
-
- def full_name
- m = self.module
- RDoc::ClassModule === m ? m.full_name : @name
- end
-
- def hash # :nodoc:
- [@name, self.module].hash
- end
-
- def inspect # :nodoc:
- "#<%s:0x%x %s.extend %s>" % [
- self.class,
- object_id,
- parent_name, @name,
- ]
- end
-
- ##
- # Attempts to locate the extend module object. Returns the name if not
- # known.
- #
- # The scoping rules of Ruby to resolve the name of an extension module are:
- # - first look into the children of the current context;
- # - if not found, look into the children of extension modules,
- # in reverse extend order;
- # - if still not found, go up the hierarchy of names.
- #
- # This method has <code>O(n!)</code> behavior when the module calling
- # extend is referencing nonexistent modules. Avoid calling #module until
- # after all the files are parsed. This behavior is due to ruby's constant
- # lookup behavior.
-
- def module
- return @module if @module
-
- # search the current context
- return @name unless parent
- full_name = parent.child_name(@name)
- @module = @store.modules_hash[full_name]
- return @module if @module
- return @name if @name =~ /^::/
-
- # search the includes before this one, in reverse order
- searched = parent.extends.take_while { |i| i != self }.reverse
- searched.each do |i|
- ext = i.module
- next if String === ext
- full_name = ext.child_name(@name)
- @module = @store.modules_hash[full_name]
- return @module if @module
- end
-
- # go up the hierarchy of names
- up = parent.parent
- while up
- full_name = up.child_name(@name)
- @module = @store.modules_hash[full_name]
- return @module if @module
- up = up.parent
- end
-
- @name
- end
-
- ##
- # Sets the store for this class or module and its contained code objects.
-
- def store= store
- super
-
- @file = @store.add_file @file.full_name if @file
- end
-
- def to_s # :nodoc:
- "extend #@name in: #{parent}"
- end
+class RDoc::Extend < RDoc::Mixin
end
diff --git a/lib/rdoc/generator.rb b/lib/rdoc/generator.rb
index 9051f8a658..7d3989d42f 100644
--- a/lib/rdoc/generator.rb
+++ b/lib/rdoc/generator.rb
@@ -45,6 +45,7 @@ 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 26f545b14b..bd37b60668 100644
--- a/lib/rdoc/generator/darkfish.rb
+++ b/lib/rdoc/generator/darkfish.rb
@@ -58,6 +58,21 @@ class RDoc::Generator::Darkfish
include ERB::Util
##
+ # Stylesheets, fonts, etc. that are included in RDoc.
+
+ BUILTIN_STYLE_ITEMS = # :nodoc:
+ %w[
+ 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
+ rdoc.css
+ ]
+
+ ##
# Path to this file's parent directory. Used to find templates and other
# resources.
@@ -128,6 +143,11 @@ class RDoc::Generator::Darkfish
attr_reader :store
##
+ # The directory where the template files live
+
+ attr_reader :template_dir # :nodoc:
+
+ ##
# The output directory
attr_reader :outputdir
@@ -195,7 +215,13 @@ class RDoc::Generator::Darkfish
debug_msg "Copying static files"
options = { :verbose => $DEBUG_RDOC, :noop => @dry_run }
- FileUtils.cp @template_dir + 'rdoc.css', '.', options
+ BUILTIN_STYLE_ITEMS.each do |item|
+ install_rdoc_static_file @template_dir + item, "./#{item}", options
+ end
+
+ @options.template_stylesheets.each do |stylesheet|
+ FileUtils.cp stylesheet, '.', options
+ end
Dir[(@template_dir + "{js,images}/**/*").to_s].each do |path|
next if File.directory? path
@@ -203,11 +229,7 @@ class RDoc::Generator::Darkfish
dst = Pathname.new(path).relative_path_from @template_dir
- # I suck at glob
- dst_dir = dst.dirname
- FileUtils.mkdir_p dst_dir, options unless File.exist? dst_dir
-
- FileUtils.cp @template_dir + path, dst, options
+ install_rdoc_static_file @template_dir + path, dst, options
end
end
@@ -447,7 +469,7 @@ class RDoc::Generator::Darkfish
##
# Generates the 404 page for the RDoc servlet
- def generate_servlet_not_found path
+ def generate_servlet_not_found message
setup
template_file = @template_dir + 'servlet_not_found.rhtml'
@@ -530,6 +552,23 @@ class RDoc::Generator::Darkfish
raise error
end
+ def install_rdoc_static_file source, destination, options # :nodoc:
+ return unless source.exist?
+
+ begin
+ FileUtils.mkdir_p File.dirname(destination), options
+
+ begin
+ FileUtils.ln source, destination, options
+ rescue Errno::EEXIST
+ FileUtils.rm destination
+ retry
+ end
+ rescue
+ FileUtils.cp source, destination, options
+ end
+ end
+
##
# Prepares for generation of output from the current directory
diff --git a/lib/rdoc/generator/pot.rb b/lib/rdoc/generator/pot.rb
new file mode 100644
index 0000000000..db6f3a0354
--- /dev/null
+++ b/lib/rdoc/generator/pot.rb
@@ -0,0 +1,97 @@
+##
+# 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
new file mode 100644
index 0000000000..ceabc5262a
--- /dev/null
+++ b/lib/rdoc/generator/pot/message_extractor.rb
@@ -0,0 +1,67 @@
+##
+# 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
new file mode 100644
index 0000000000..6a6b5821f3
--- /dev/null
+++ b/lib/rdoc/generator/pot/po.rb
@@ -0,0 +1,83 @@
+##
+# 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
new file mode 100644
index 0000000000..d4cef59ee9
--- /dev/null
+++ b/lib/rdoc/generator/pot/po_entry.rb
@@ -0,0 +1,140 @@
+##
+# 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/template/darkfish/_footer.rhtml b/lib/rdoc/generator/template/darkfish/_footer.rhtml
index 0736c335ba..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">
- <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
- <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> <%= RDoc::VERSION %>.
- <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> <%= RDoc::Generator::Darkfish::VERSION %>.
+<footer id="validator-badges" role="contentinfo">
+ <p><a href="http://validator.w3.org/check/referer">Validate</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 f3d82a37f6..c87ba95096 100644
--- a/lib/rdoc/generator/template/darkfish/_head.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_head.rhtml
@@ -1,16 +1,19 @@
-<meta content="text/html; charset=<%= @options.charset %>" http-equiv="Content-Type">
+<meta charset="<%= @options.charset %>">
<title><%= h @title %></title>
-<link type="text/css" media="screen" href="<%= asset_rel_prefix %>/rdoc.css" rel="stylesheet">
-
<script type="text/javascript">
var rdoc_rel_prefix = "<%= rel_prefix %>/";
</script>
-<script type="text/javascript" charset="utf-8" src="<%= asset_rel_prefix %>/js/jquery.js"></script>
-<script type="text/javascript" charset="utf-8" src="<%= asset_rel_prefix %>/js/navigation.js"></script>
-<script type="text/javascript" charset="utf-8" src="<%= search_index_rel_prefix %>/js/search_index.js"></script>
-<script type="text/javascript" charset="utf-8" src="<%= asset_rel_prefix %>/js/search.js"></script>
-<script type="text/javascript" charset="utf-8" src="<%= asset_rel_prefix %>/js/searcher.js"></script>
-<script type="text/javascript" charset="utf-8" src="<%= asset_rel_prefix %>/js/darkfish.js"></script>
+<script src="<%= asset_rel_prefix %>/js/jquery.js"></script>
+<script src="<%= asset_rel_prefix %>/js/darkfish.js"></script>
+
+<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 %>
+
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml
index 93d57f39f6..e889f8063d 100644
--- a/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml
@@ -1,6 +1,7 @@
<% if !svninfo.empty? then %>
-<nav id="file-svninfo-section" class="section">
- <h3 class="section-header">VCS Info</h3>
+<div id="file-svninfo-section" class="nav-section">
+ <h3>VCS Info</h3>
+
<div class="section-body">
<dl class="svninfo">
<dt>Rev
@@ -14,5 +15,5 @@
<dd><%= svninfo[:committer] %>
</dl>
</div>
-</nav>
+</div>
<% end %>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml
index efa202fa18..fe54d8339f 100644
--- a/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml
@@ -1,9 +1,9 @@
-<nav id="classindex-section" class="section project-section">
- <h3 class="section-header">Class and Module Index</h3>
+<div id="classindex-section" class="nav-section">
+ <h3>Class and Module Index</h3>
<ul class="link-list">
<% @modsort.each do |index_klass| %>
<li><a href="<%= rel_prefix %>/<%= index_klass.path %>"><%= index_klass.full_name %></a>
<% end %>
</ul>
-</nav>
+</div>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml
index 19273829a0..2bd8efee99 100644
--- a/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml
@@ -1,7 +1,6 @@
<% unless klass.extends.empty? then %>
-<!-- Extension Modules -->
-<nav id="extends-section" class="section">
- <h3 class="section-header">Extended With Modules</h3>
+<div id="extends-section" class="nav-section">
+ <h3>Extended With Modules</h3>
<ul class="link-list">
<% klass.each_extend do |ext| %>
@@ -12,5 +11,5 @@
<% end %>
<% end %>
</ul>
-</nav>
+</div>
<% end %>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml
index 22be0c9b65..0ba1d2be80 100644
--- a/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml
@@ -1,8 +1,9 @@
-<nav id="file-list-section" class="section">
- <h3 class="section-header">Defined In</h3>
+<div id="file-list-section" class="nav-section">
+ <h3>Defined In</h3>
+
<ul>
<% klass.in_files.each do |tl| %>
<li><%= h tl.relative_name %>
<% end %>
</ul>
-</nav>
+</div>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml
index 5494f1f5f8..d141098ecd 100644
--- a/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml
@@ -1,7 +1,6 @@
<% unless klass.includes.empty? then %>
-<!-- Included Modules -->
-<nav id="includes-section" class="section">
- <h3 class="section-header">Included Modules</h3>
+<div id="includes-section" class="nav-section">
+ <h3>Included Modules</h3>
<ul class="link-list">
<% klass.each_include do |inc| %>
@@ -12,5 +11,5 @@
<% end %>
<% end %>
</ul>
-</nav>
+</div>
<% end %>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml
index 45a3048e84..1285bfd732 100644
--- a/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml
@@ -1,8 +1,9 @@
-<nav id="home-section" class="section">
- <h3 class="section-header">Documentation</h3>
+<div id="home-section" class="nav-section">
+ <h3>Documentation</h3>
<ul>
- <% installed.each do |name, href, exists| %>
+ <% installed.each do |name, href, exists, type, _| %>
+ <% next if type == :extra %>
<li class="folder">
<% if exists then %>
<a href="<%= href %>"><%= h name %></a>
@@ -11,4 +12,4 @@
<% end %>
<% end %>
</ul>
-</nav>
+</div>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml
index 88e2734819..45df08d8fe 100644
--- a/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml
@@ -1,12 +1,12 @@
<% unless klass.method_list.empty? then %>
<!-- Method Quickref -->
-<nav id="method-list-section" class="section">
- <h3 class="section-header">Methods</h3>
+<div id="method-list-section" class="nav-section">
+ <h3>Methods</h3>
- <ul class="link-list">
+ <ul class="link-list" role="directory">
<% klass.each_method do |meth| %>
<li <% if meth.calls_super %>class="calls-super" <% end %>><a href="#<%= meth.aref %>"><%= meth.singleton ? '::' : '#' %><%= h meth.name %></a>
<% end %>
</ul>
-</nav>
+</div>
<% end %>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml
index fdeb6aed9f..d7f330840a 100644
--- a/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml
@@ -1,7 +1,11 @@
-<nav id="home-section" class="section">
- <h3 class="section-header">
- <a href="<%= rel_prefix %>/index.html">Home</a>
+<div id="home-section" role="region" title="Quick navigation" class="nav-section">
+ <h2>
+ <a href="<%= rel_prefix %>/index.html" rel="home">Home</a>
+ </h2>
+
+ <div id="table-of-contents-navigation">
+ <a href="<%= rel_prefix %>/table_of_contents.html#pages">Pages</a>
<a href="<%= rel_prefix %>/table_of_contents.html#classes">Classes</a>
<a href="<%= rel_prefix %>/table_of_contents.html#methods">Methods</a>
- </h3>
-</nav>
+ </div>
+</div>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml
index 2089387c51..5f39825f08 100644
--- a/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml
@@ -1,12 +1,12 @@
<% simple_files = @files.select { |f| f.text? } %>
<% unless simple_files.empty? then %>
-<nav id="fileindex-section" class="section project-section">
- <h3 class="section-header">Pages</h3>
+<div id="fileindex-section" class="nav-section">
+ <h3>Pages</h3>
- <ul>
+ <ul class="link-list">
<% simple_files.each do |f| %>
- <li class="file"><a href="<%= rel_prefix %>/<%= f.path %>"><%= h f.page_name %></a>
+ <li><a href="<%= rel_prefix %>/<%= f.path %>"><%= h f.page_name %></a>
<% end %>
</ul>
-</nav>
+</div>
<% end %>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml
index 463f05a8d9..cc04852652 100644
--- a/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml
@@ -1,10 +1,11 @@
<% if klass.type == 'class' then %>
-<nav id="parent-class-section" class="section">
- <h3 class="section-header">Parent</h3>
+<div id="parent-class-section" class="nav-section">
+ <h3>Parent</h3>
+
<% if klass.superclass and not String === klass.superclass then %>
<p class="link"><a href="<%= klass.aref_to klass.superclass.path %>"><%= klass.superclass.full_name %></a>
<% else %>
<p class="link"><%= klass.superclass %>
<% end %>
-</nav>
+</div>
<% end %>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml
index f3275783d0..9c49b31376 100644
--- a/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml
@@ -1,10 +1,14 @@
-<nav id="search-section" class="section project-section" class="initially-hidden">
+<div id="search-section" role="search" class="project-section initially-hidden">
<form action="#" method="get" accept-charset="utf-8">
- <h3 class="section-header">
- <input type="text" name="search" placeholder="Search" id="search-field"
+ <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"
title="Type to search, Up and Down to navigate, Enter to load">
- </h3>
- </form>
+ </div>
- <ul id="search-results" class="initially-hidden"></ul>
-</nav>
+ <ul id="search-results" aria-label="Search Results"
+ aria-busy="false" aria-expanded="false"
+ aria-atomic="false" class="initially-hidden"></ul>
+ </form>
+</div>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml
index 726423a341..15ff78ba91 100644
--- a/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml
@@ -1,10 +1,11 @@
<% unless klass.sections.length == 1 then %>
-<nav id="sections-section" class="section">
- <h3 class="section-header">Sections</h3>
- <ul class="link-list">
+<div id="sections-section" class="nav-section">
+ <h3>Sections</h3>
+
+ <ul class="link-list" role="directory">
<% klass.sort_sections.each do |section| %>
<li><a href="#<%= section.aref %>"><%= h section.title %></a></li>
<% end %>
</ul>
-</nav>
+</div>
<% end %>
diff --git a/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml b/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml
index 7842625840..b58e6b3c61 100644
--- a/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml
+++ b/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml
@@ -6,14 +6,13 @@
table = current.parse(comment).table_of_contents
if table.length > 1 then %>
-<div id="table-of-contents">
- <nav class="section">
- <h3 class="section-header">Table of Contents</h3>
- <ul>
+<div class="nav-section">
+ <h3>Table of Contents</h3>
+
+ <ul class="link-list" role="directory">
<% table.each do |heading| %>
- <li><a href="#<%= heading.aref %>"><%= heading.plain_html %></a>
+ <li><a href="#<%= heading.label current %>"><%= heading.plain_html %></a>
<% end %>
- </ul>
- </nav>
+ </ul>
</div>
<% end %>
diff --git a/lib/rdoc/generator/template/darkfish/class.rhtml b/lib/rdoc/generator/template/darkfish/class.rhtml
index c7e52e6808..b497000112 100644
--- a/lib/rdoc/generator/template/darkfish/class.rhtml
+++ b/lib/rdoc/generator/template/darkfish/class.rhtml
@@ -1,16 +1,12 @@
-<body id="top" class="<%= klass.type %>">
-<nav id="metadata">
- <%= render '_sidebar_navigation.rhtml' %>
-
- <%= render '_sidebar_search.rhtml' %>
+<body id="top" role="document" class="<%= klass.type %>">
+<nav role="navigation">
+ <div id="project-navigation">
+ <%= render '_sidebar_navigation.rhtml' %>
+ <%= render '_sidebar_search.rhtml' %>
+ </div>
<%= render '_sidebar_table_of_contents.rhtml' %>
- <div id="file-metadata">
- <%= render '_sidebar_in_files.rhtml' %>
- <%= render '_sidebar_VCS_info.rhtml' %>
- </div>
-
<div id="class-metadata">
<%= render '_sidebar_sections.rhtml' %>
<%= render '_sidebar_parent.rhtml' %>
@@ -18,52 +14,50 @@
<%= render '_sidebar_extends.rhtml' %>
<%= render '_sidebar_methods.rhtml' %>
</div>
-
- <div id="project-metadata">
- <%= render '_sidebar_pages.rhtml' %>
- <%= render '_sidebar_classes.rhtml' %>
- </div>
</nav>
-<div id="documentation">
- <h1 class="<%= klass.type %>"><%= klass.type %> <%= klass.full_name %></h1>
+<main role="main" aria-labelledby="<%=h klass.aref %>">
+ <h1 id="<%=h klass.aref %>" class="<%= klass.type %>">
+ <%= klass.type %> <%= klass.full_name %>
+ </h1>
- <div id="description" class="description">
+ <section class="description">
<%= klass.description %>
- </div><!-- description -->
+ </section>
<% klass.each_section do |section, constants, attributes| %>
<% constants = constants.select { |const| const.display? } %>
<% attributes = attributes.select { |attr| attr.display? } %>
<section id="<%= section.aref %>" class="documentation-section">
<% if section.title then %>
- <div class="documentation-section-title">
- <h2 class="section-header">
+ <header class="documentation-section-title">
+ <h2>
<%= section.title %>
</h2>
<span class="section-click-top">
<a href="#top">&uarr; top</a>
</span>
- </div>
+ </header>
<% end %>
<% if section.comment then %>
- <div class="description">
+ <div>
<%= section.description %>
</div>
<% end %>
<% unless constants.empty? then %>
- <!-- Constants -->
- <section id="constants-list" class="section">
- <h3 class="section-header">Constants</h3>
+ <section class="constants-list">
+ <header>
+ <h3>Constants</h3>
+ </header>
<dl>
<% constants.each do |const| %>
<dt id="<%= const.name %>"><%= const.name %>
<% if const.comment then %>
- <dd class="description"><%= const.description.strip %>
+ <dd><%= const.description.strip %>
<% else %>
- <dd class="description missing-docs">(Not documented)
+ <dd class="missing-docs">(Not documented)
<% end %>
<% end %>
</dl>
@@ -71,9 +65,10 @@
<% end %>
<% unless attributes.empty? then %>
- <!-- Attributes -->
- <section id="attribute-method-details" class="method-section section">
- <h3 class="section-header">Attributes</h3>
+ <section class="attribute-method-details" class="method-section">
+ <header>
+ <h3>Attributes</h3>
+ </header>
<% attributes.each do |attrib| %>
<div id="<%= attrib.aref %>" class="method-detail">
@@ -91,16 +86,17 @@
</div>
</div>
<% end %>
- </section><!-- attribute-method-details -->
+ </section>
<% end %>
- <!-- Methods -->
<% klass.methods_by_type(section).each do |type, visibilities|
next if visibilities.empty?
visibilities.each do |visibility, methods|
next if methods.empty? %>
- <section id="<%= visibility %>-<%= type %>-<%= section.aref %>-method-details" class="method-section section">
- <h3 class="section-header"><%= visibility.to_s.capitalize %> <%= type.capitalize %> Methods</h3>
+ <section id="<%= visibility %>-<%= type %>-<%= section.aref %>-method-details" class="method-section">
+ <header>
+ <h3><%= visibility.to_s.capitalize %> <%= type.capitalize %> Methods</h3>
+ </header>
<% methods.each do |method| %>
<div id="<%= method.aref %>" class="method-detail <%= method.is_alias_for ? "method-alias" : '' %>">
@@ -146,7 +142,7 @@
<% if method.token_stream then %>
<div class="method-source-code" id="<%= method.html_name %>-source">
<pre><%= method.markup_code %></pre>
- </div><!-- <%= method.html_name %>-source -->
+ </div>
<% end %>
</div>
@@ -167,13 +163,12 @@
Alias for: <a href="<%= klass.aref_to method.is_alias_for.path %>"><%= h method.is_alias_for.name %></a>
</div>
<% end %>
- </div><!-- <%= method.html_name %>-method -->
+ </div>
<% end %>
- </section><!-- <%= visibility %>-<%= type %>-method-details -->
+ </section>
<% end
end %>
- </section><!-- <%= section.aref %> -->
+ </section>
<% end %>
-
-</div><!-- documentation -->
+</main>
diff --git a/lib/rdoc/generator/template/darkfish/fonts.css b/lib/rdoc/generator/template/darkfish/fonts.css
new file mode 100644
index 0000000000..e9e721183b
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/fonts.css
@@ -0,0 +1,167 @@
+/*
+ * Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/),
+ * with Reserved Font Name "Source". All Rights Reserved. Source is a
+ * trademark of Adobe Systems Incorporated in the United States and/or other
+ * countries.
+ *
+ * This Font Software is licensed under the SIL Open Font License, Version
+ * 1.1.
+ *
+ * This license is copied below, and is also available with a FAQ at:
+ * http://scripts.sil.org/OFL
+ */
+
+@font-face {
+ font-family: "Source Code Pro";
+ font-style: normal;
+ font-weight: 400;
+ src: local("Source Code Pro"),
+ local("SourceCodePro-Regular"),
+ url("fonts/SourceCodePro-Regular.ttf") format("truetype");
+}
+
+@font-face {
+ font-family: "Source Code Pro";
+ font-style: normal;
+ font-weight: 700;
+ src: local("Source Code Pro Bold"),
+ local("SourceCodePro-Bold"),
+ url("fonts/SourceCodePro-Bold.ttf") format("truetype");
+}
+
+/*
+ * Copyright (c) 2010, Łukasz Dziedzic (dziedzic@typoland.com),
+ * with Reserved Font Name Lato.
+ *
+ * This Font Software is licensed under the SIL Open Font License, Version
+ * 1.1.
+ *
+ * This license is copied below, and is also available with a FAQ at:
+ * http://scripts.sil.org/OFL
+ */
+
+@font-face {
+ font-family: "Lato";
+ font-style: normal;
+ font-weight: 300;
+ src: local("Lato Light"),
+ local("Lato-Light"),
+ url("fonts/Lato-Light.ttf") format("truetype");
+}
+
+@font-face {
+ font-family: "Lato";
+ font-style: italic;
+ font-weight: 300;
+ src: local("Lato Light Italic"),
+ local("Lato-LightItalic"),
+ url("fonts/Lato-LightItalic.ttf") format("truetype");
+}
+
+@font-face {
+ font-family: "Lato";
+ font-style: normal;
+ font-weight: 700;
+ src: local("Lato Regular"),
+ local("Lato-Regular"),
+ url("fonts/Lato-Regular.ttf") format("truetype");
+}
+
+@font-face {
+ font-family: "Lato";
+ font-style: italic;
+ font-weight: 700;
+ src: local("Lato Italic"),
+ local("Lato-Italic"),
+ url("fonts/Lato-RegularItalic.ttf") format("truetype");
+}
+
+/*
+ * -----------------------------------------------------------
+ * SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
+ * -----------------------------------------------------------
+ *
+ * PREAMBLE
+ * The goals of the Open Font License (OFL) are to stimulate worldwide
+ * development of collaborative font projects, to support the font creation
+ * efforts of academic and linguistic communities, and to provide a free and
+ * open framework in which fonts may be shared and improved in partnership
+ * with others.
+ *
+ * The OFL allows the licensed fonts to be used, studied, modified and
+ * redistributed freely as long as they are not sold by themselves. The
+ * fonts, including any derivative works, can be bundled, embedded,
+ * redistributed and/or sold with any software provided that any reserved
+ * names are not used by derivative works. The fonts and derivatives,
+ * however, cannot be released under any other type of license. The
+ * requirement for fonts to remain under this license does not apply
+ * to any document created using the fonts or their derivatives.
+ *
+ * DEFINITIONS
+ * "Font Software" refers to the set of files released by the Copyright
+ * Holder(s) under this license and clearly marked as such. This may
+ * include source files, build scripts and documentation.
+ *
+ * "Reserved Font Name" refers to any names specified as such after the
+ * copyright statement(s).
+ *
+ * "Original Version" refers to the collection of Font Software components as
+ * distributed by the Copyright Holder(s).
+ *
+ * "Modified Version" refers to any derivative made by adding to, deleting,
+ * or substituting -- in part or in whole -- any of the components of the
+ * Original Version, by changing formats or by porting the Font Software to a
+ * new environment.
+ *
+ * "Author" refers to any designer, engineer, programmer, technical
+ * writer or other person who contributed to the Font Software.
+ *
+ * PERMISSION & CONDITIONS
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of the Font Software, to use, study, copy, merge, embed, modify,
+ * redistribute, and sell modified and unmodified copies of the Font
+ * Software, subject to the following conditions:
+ *
+ * 1) Neither the Font Software nor any of its individual components,
+ * in Original or Modified Versions, may be sold by itself.
+ *
+ * 2) Original or Modified Versions of the Font Software may be bundled,
+ * redistributed and/or sold with any software, provided that each copy
+ * contains the above copyright notice and this license. These can be
+ * included either as stand-alone text files, human-readable headers or
+ * in the appropriate machine-readable metadata fields within text or
+ * binary files as long as those fields can be easily viewed by the user.
+ *
+ * 3) No Modified Version of the Font Software may use the Reserved Font
+ * Name(s) unless explicit written permission is granted by the corresponding
+ * Copyright Holder. This restriction only applies to the primary font name as
+ * presented to the users.
+ *
+ * 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
+ * Software shall not be used to promote, endorse or advertise any
+ * Modified Version, except to acknowledge the contribution(s) of the
+ * Copyright Holder(s) and the Author(s) or with their explicit written
+ * permission.
+ *
+ * 5) The Font Software, modified or unmodified, in part or in whole,
+ * must be distributed entirely under this license, and must not be
+ * distributed under any other license. The requirement for fonts to
+ * remain under this license does not apply to any document created
+ * using the Font Software.
+ *
+ * TERMINATION
+ * This license becomes null and void if any of the above conditions are
+ * not met.
+ *
+ * DISCLAIMER
+ * THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+ * OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+ * DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+ * OTHER DEALINGS IN THE FONT SOFTWARE.
+ */
+
diff --git a/lib/rdoc/generator/template/darkfish/fonts/Lato-Light.ttf b/lib/rdoc/generator/template/darkfish/fonts/Lato-Light.ttf
new file mode 100644
index 0000000000..b49dd43729
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/fonts/Lato-Light.ttf
Binary files differ
diff --git a/lib/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttf b/lib/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttf
new file mode 100644
index 0000000000..7959fef075
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttf
Binary files differ
diff --git a/lib/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf b/lib/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf
new file mode 100644
index 0000000000..839cd589dc
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf
Binary files differ
diff --git a/lib/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttf b/lib/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttf
new file mode 100644
index 0000000000..bababa09e3
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttf
Binary files differ
diff --git a/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf b/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf
new file mode 100644
index 0000000000..61e3090c1c
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf
Binary files differ
diff --git a/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf b/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf
new file mode 100644
index 0000000000..85686d967d
--- /dev/null
+++ b/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf
Binary files differ
diff --git a/lib/rdoc/generator/template/darkfish/images/add.png b/lib/rdoc/generator/template/darkfish/images/add.png
index 6332fefea4..6332fefea4 100755..100644
--- 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 100755..100644
--- 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 100755..100644
--- 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 100755..100644
--- 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/index.rhtml b/lib/rdoc/generator/template/darkfish/index.rhtml
index d076c2a252..7d1c74807b 100644
--- a/lib/rdoc/generator/template/darkfish/index.rhtml
+++ b/lib/rdoc/generator/template/darkfish/index.rhtml
@@ -1,8 +1,10 @@
-<body>
-<nav id="metadata">
- <%= render '_sidebar_navigation.rhtml' %>
+<body id="top" role="document" class="file">
+<nav role="navigation">
+ <div id="project-navigation">
+ <%= render '_sidebar_navigation.rhtml' %>
- <%= render '_sidebar_search.rhtml' %>
+ <%= render '_sidebar_search.rhtml' %>
+ </div>
<div id="project-metadata">
<%= render '_sidebar_pages.rhtml' %>
@@ -10,10 +12,12 @@
</div>
</nav>
-<div id="documentation" class="description">
-<% if @options.main_page && main_page = @files.find { |f| f.full_name == @options.main_page } then %>
+<main role="main">
+<% if @options.main_page and
+ main_page = @files.find { |f| f.full_name == @options.main_page } then %>
<%= main_page.description %>
<% else %>
<p>This is the API documentation for <%= @title %>.
<% end %>
-</div>
+</main>
+
diff --git a/lib/rdoc/generator/template/darkfish/js/darkfish.js b/lib/rdoc/generator/template/darkfish/js/darkfish.js
index f26fd45d3a..b789a65631 100644
--- a/lib/rdoc/generator/template/darkfish/js/darkfish.js
+++ b/lib/rdoc/generator/template/darkfish/js/darkfish.js
@@ -44,28 +44,6 @@ function hookSourceViews() {
$('.method-heading').click( showSource );
};
-function toggleDebuggingSection() {
- $('.debugging-section').slideToggle();
-};
-
-function hookDebuggingToggle() {
- $('#debugging-toggle img').click( toggleDebuggingSection );
-};
-
-function hookTableOfContentsToggle() {
- $('.indexpage li .toc-toggle').each( function() {
- $(this).click( function() {
- $(this).toggleClass('open');
- });
-
- var section = $(this).next();
-
- $(this).click( function() {
- section.slideToggle();
- });
- });
-}
-
function hookSearch() {
var input = $('#search-field').eq(0);
var result = $('#search-results').eq(0);
@@ -143,13 +121,41 @@ 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();
- hookTableOfContentsToggle();
-
$('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'));
});
diff --git a/lib/rdoc/generator/template/darkfish/js/jquery.js b/lib/rdoc/generator/template/darkfish/js/jquery.js
index 48590ecb96..628ed9b316 100644
--- a/lib/rdoc/generator/template/darkfish/js/jquery.js
+++ b/lib/rdoc/generator/template/darkfish/js/jquery.js
@@ -1,18 +1,4 @@
-/*!
- * 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
+/*! 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
diff --git a/lib/rdoc/generator/template/darkfish/js/search.js b/lib/rdoc/generator/template/darkfish/js/search.js
index dbdfdcbc4c..60ac295e6c 100644
--- a/lib/rdoc/generator/template/darkfish/js/search.js
+++ b/lib/rdoc/generator/template/darkfish/js/search.js
@@ -14,7 +14,12 @@ Search.prototype = $.extend({}, Navigation, new function() {
this.init = function() {
var _this = this;
- var observer = function() {
+ var observer = function(e) {
+ switch(e.originalEvent.keyCode) {
+ case 38: // Event.KEY_UP
+ case 40: // Event.KEY_DOWN
+ return;
+ }
_this.search(_this.$input[0].value);
};
this.$input.keyup(observer);
@@ -39,9 +44,12 @@ Search.prototype = $.extend({}, Navigation, new function() {
if (value == '') {
this.lastQuery = value;
this.$result.empty();
+ this.$result.attr('aria-expanded', 'false');
this.setNavigationActive(false);
} else if (value != this.lastQuery) {
this.lastQuery = value;
+ this.$result.attr('aria-busy', 'true');
+ this.$result.attr('aria-expanded', 'true');
this.firstRun = true;
this.searcher.find(value);
}
@@ -55,25 +63,32 @@ Search.prototype = $.extend({}, Navigation, new function() {
}
for (var i=0, l = results.length; i < l; i++) {
- target.appendChild(this.renderItem.call(this, results[i]));
+ var item = this.renderItem.call(this, results[i]);
+ item.setAttribute('id', 'search-result-' + target.childElementCount);
+ target.appendChild(item);
};
if (this.firstRun && results.length > 0) {
this.firstRun = false;
this.$current = $(target.firstChild);
- this.$current.addClass('current');
+ this.$current.addClass('search-selected');
}
if (jQuery.browser.msie) this.$element[0].className += '';
+
+ if (isLast) this.$result.attr('aria-busy', 'false');
}
this.move = function(isDown) {
if (!this.$current) return;
var $next = this.$current[isDown ? 'next' : 'prev']();
if ($next.length) {
- this.$current.removeClass('current');
- $next.addClass('current');
+ this.$current.removeClass('search-selected');
+ $next.addClass('search-selected');
+ 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/page.rhtml b/lib/rdoc/generator/template/darkfish/page.rhtml
index 942172919b..4a6b006bb3 100644
--- a/lib/rdoc/generator/template/darkfish/page.rhtml
+++ b/lib/rdoc/generator/template/darkfish/page.rhtml
@@ -1,18 +1,18 @@
-<body class="file">
-<nav id="metadata">
- <%= render '_sidebar_navigation.rhtml' %>
-
- <%= render '_sidebar_search.rhtml' %>
+<body id="top" role="document" class="file">
+<nav role="navigation">
+ <div id="project-navigation">
+ <%= render '_sidebar_navigation.rhtml' %>
+ <%= render '_sidebar_search.rhtml' %>
+ </div>
<%= render '_sidebar_table_of_contents.rhtml' %>
<div id="project-metadata">
<%= render '_sidebar_pages.rhtml' %>
- <%= render '_sidebar_classes.rhtml' %>
</div>
</nav>
-<div id="documentation" class="description">
- <%= file.description %>
-</div>
+<main role="main" aria-label="Page <%=h file.full_name%>">
+<%= file.description %>
+</main>
diff --git a/lib/rdoc/generator/template/darkfish/rdoc.css b/lib/rdoc/generator/template/darkfish/rdoc.css
index 35207033de..2f4dca7e08 100644
--- a/lib/rdoc/generator/template/darkfish/rdoc.css
+++ b/lib/rdoc/generator/template/darkfish/rdoc.css
@@ -12,21 +12,10 @@
* { padding: 0; margin: 0; }
body {
- background: #efefef;
- font: 14px "Helvetica Neue", Helvetica, Tahoma, sans-serif;
- margin-left: 40px;
+ background: #fafafa;
+ font-family: Lato, sans-serif;
+ font-weight: 300;
}
-body.file-popup {
- font-size: 90%;
- margin-left: 0;
-}
-
-h1 {
- font-size: 300%;
- text-shadow: rgba(135,145,135,0.65) 2px 2px 3px;
- color: #6C8C22;
-}
-h2,h3,h4 { margin-top: 1.5em; }
h1 span,
h2 span,
@@ -34,12 +23,22 @@ h3 span,
h4 span,
h5 span,
h6 span {
+ position: relative;
+
display: none;
padding-left: 1em;
- font-size: 50%;
- vertical-align: super;
+ line-height: 0;
+ vertical-align: baseline;
+ font-size: 10px;
}
+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,
@@ -54,24 +53,15 @@ h6:hover span {
color: #6C8C22;
text-decoration: none;
}
+
:link:hover,
:visited:hover {
border-bottom: 1px dotted #6C8C22;
}
+code,
pre {
- background: #ddd;
- padding: 0.5em 0;
-}
-
-blockquote {
- background: #ddd;
- margin: 1em;
- padding: 0.25em;
-}
-
-blockquote > :first-child {
- margin-top: 0 !important;
+ font-family: "Source Code Pro", Monaco, monospace;
}
/* @group Generic Classes */
@@ -82,10 +72,13 @@ blockquote > :first-child {
#search-field {
width: 98%;
- background: #eee;
+ background: white;
border: none;
height: 1.5em;
-webkit-border-radius: 4px;
+ -moz-border-radius: 4px;
+ border-radius: 4px;
+ text-align: left;
}
#search-field:focus {
background: #f1edba;
@@ -121,44 +114,31 @@ blockquote > :first-child {
/* @end */
/* @group Index Page, Standalone file pages */
-.indexpage ul {
- line-height: 160%;
+.table-of-contents ul {
+ margin: 1em;
list-style: none;
}
-.indexpage ul :link,
-.indexpage ul :visited {
- font-size: 16px;
-}
-.indexpage li {
- padding-left: 20px;
+.table-of-contents ul ul {
+ margin-top: 0.25em;
}
-.indexpage ul > li {
- background: url(images/bullet_black.png) no-repeat left 4px;
-}
-.indexpage li.method {
- background: url(images/plugin.png) no-repeat left 4px;
-}
-.indexpage li.module {
- background: url(images/package.png) no-repeat left 4px;
-}
-.indexpage li.class {
- background: url(images/ruby.png) no-repeat left 4px;
-}
-.indexpage li.file {
- background: url(images/page_white_text.png) no-repeat left 4px;
+.table-of-contents ul :link,
+.table-of-contents ul :visited {
+ font-size: 16px;
}
-.indexpage li li {
- background: url(images/tag_blue.png) no-repeat left 4px;
+
+.table-of-contents li {
+ margin-bottom: 0.25em;
}
-.indexpage li .toc-toggle {
+
+.table-of-contents li .toc-toggle {
width: 16px;
height: 16px;
background: url(images/add.png) no-repeat;
}
-.indexpage li .toc-toggle.open {
+.table-of-contents li .toc-toggle.open {
background: url(images/delete.png) no-repeat;
}
@@ -166,14 +146,32 @@ blockquote > :first-child {
/* @group Top-Level Structure */
-#metadata {
+nav {
float: left;
width: 260px;
+ font-family: Helvetica, sans-serif;
+ font-size: 14px;
}
-#documentation {
- margin: 2em 1em 5em 300px;
+main {
+ display: block;
+ margin: 0 2em 5em 260px;
+ padding-left: 20px;
min-width: 340px;
+ font-size: 16px;
+}
+
+main h1,
+main h2,
+main h3,
+main h4,
+main h5,
+main h6 {
+ font-family: Helvetica, sans-serif;
+}
+
+.table-of-contents main {
+ margin-left: 2em;
}
#validator-badges {
@@ -184,67 +182,74 @@ blockquote > :first-child {
/* @end */
-/* @group Metadata Section */
-#metadata .section {
- background-color: #dedede;
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
- border: 1px solid #aaa;
- margin: 0 8px 8px;
+/* @group navigation */
+nav {
+ margin-bottom: 1em;
+}
+
+nav .nav-section {
+ margin-top: 2em;
+ border-top: 2px solid #aaa;
font-size: 90%;
overflow: hidden;
}
-#metadata h3.section-header {
+
+nav h2 {
margin: 0;
- padding: 2px 8px;
- background: #ccc;
- color: #666;
- -moz-border-radius-topleft: 4px;
- -moz-border-radius-topright: 4px;
- -webkit-border-top-left-radius: 4px;
- -webkit-border-top-right-radius: 4px;
- border-bottom: 1px solid #aaa;
+ padding: 2px 8px 2px 8px;
+ background-color: #e8e8e8;
+ color: #555;
+ font-size: 125%;
+ text-align: center;
}
-#metadata #home-section h3.section-header {
- border-bottom: 0;
+
+nav h3,
+#table-of-contents-navigation {
+ margin: 0;
+ padding: 2px 8px 2px 8px;
+ text-align: right;
+ background-color: #e8e8e8;
+ color: #555;
}
-#metadata ul,
-#metadata dl,
-#metadata p {
- padding: 8px;
+nav ul,
+nav dl,
+nav p {
+ padding: 4px 8px 0;
list-style: none;
}
-#file-metadata {
- margin-top: 2em;
+#project-navigation .nav-section {
+ margin: 0;
+ border-top: 0;
}
-#file-metadata ul {
- padding-left: 28px;
- list-style-image: url(images/page_green.png);
+#home-section h2 {
+ text-align: center;
}
-#table-of-contents {
- margin-top: 2em;
+#table-of-contents-navigation {
+ font-size: 1.2em;
+ font-weight: bold;
+ text-align: center;
}
-#table-of-contents ul {
- padding-left: 28px;
- list-style-image: url(images/tag_blue.png);
+#search-section {
+ margin-top: 0;
+ border-top: 0;
}
-dl.svninfo {
- color: #666;
- margin: 0;
-}
-dl.svninfo dt {
- font-weight: bold;
+#search-field-wrapper {
+ border-top: 1px solid #aaa;
+ border-bottom: 1px solid #aaa;
+ padding: 3px 8px;
+ background-color: #e8e8e8;
+ color: #555;
}
ul.link-list li {
white-space: nowrap;
- line-height: 20px;
+ line-height: 1.4em;
}
ul.link-list .type {
@@ -262,100 +267,119 @@ ul.link-list .type {
/* @end */
-/* @group Class Metadata Section */
-#class-metadata {
- margin-top: 2em;
+/* @group Documentation Section */
+main {
+ color: #333;
}
-/* @end */
-/* @group Project Metadata Section */
-#project-metadata {
- margin-top: 2em;
+main > h1:first-child,
+main > h2:first-child,
+main > h3:first-child,
+main > h4:first-child,
+main > h5:first-child,
+main > h6:first-child {
+ margin-top: 0px;
}
-#project-metadata .section {
- border: 1px solid #aaa;
+main sup {
+ vertical-align: super;
+ font-size: 0.8em;
}
-#project-metadata h3.section-header {
- border-bottom: 1px solid #aaa;
- position: relative;
+
+/* The heading with the class name */
+main h1[class] {
+ margin-top: 0;
+ margin-bottom: 1em;
+ font-size: 2em;
+ color: #6C8C22;
}
-#project-metadata form {
- color: #777;
- background: #ccc;
+main h1 {
+ margin: 2em 0 0.5em;
+ font-size: 1.7em;
}
-/* @end */
+main h2 {
+ margin: 2em 0 0.5em;
+ font-size: 1.5em;
+}
-/* @group Documentation Section */
-.description {
- font-size: 100%;
- color: #333;
+main h3 {
+ margin: 2em 0 0.5em;
+ font-size: 1.2em;
}
-.description p {
- margin: 1em 0.4em;
+main h4 {
+ margin: 2em 0 0.5em;
+ font-size: 1.1em;
}
-.description li p {
- margin: 0;
+main h5 {
+ margin: 2em 0 0.5em;
+ font-size: 1em;
}
-.description ol,
-.description ul {
- margin-left: 1.5em;
+main h6 {
+ margin: 2em 0 0.5em;
+ font-size: 1em;
}
-.description ol li,
-.description ul li {
+
+main p {
+ margin: 0 0 0.5em;
line-height: 1.4em;
}
-.note-list {
- margin: 8px 0;
+main pre {
+ margin: 1.2em 0.5em;
+ padding: 1em;
+ font-size: 0.8em;
}
-.label-list {
- margin: 8px 1.5em;
- border: 1px solid #ccc;
+main hr {
+ margin: 1.5em 1em;
+ border: 2px solid #ddd;
}
-.description .label-list {
- font-size: 14px;
+
+main blockquote {
+ margin: 0 2em 1.2em 1.2em;
+ padding-left: 0.5em;
+ border-left: 2px solid #ddd;
}
-.note-list dt {
- font-weight: bold;
+main ol,
+main ul {
+ margin: 1em 2em;
}
-.note-list dd {
- padding: 0 12px;
+
+main li > p {
+ margin-bottom: 0.5em;
}
-.label-list dt {
- padding: 2px 4px;
- font-weight: bold;
- background: #ddd;
+main dl {
+ margin: 1em 0.5em;
}
-.label-list dd {
- padding: 2px 12px;
+
+main dt {
+ margin-bottom: 0.5em;
+ font-weight: bold;
}
-.label-list dd + dt,
-.note-list dd + dt {
- margin-top: 0.7em;
+
+main dd {
+ margin: 0 1em 1em 0.5em;
}
-#documentation .section {
- font-size: 90%;
+main header h2 {
+ margin-top: 2em;
+ border-width: 0;
+ border-top: 4px solid #bbb;
+ font-size: 130%;
}
-#documentation h2.section-header {
- margin-top: 1em;
- padding: 0.25em 0.5em;
- background: #ccc;
- color: #333;
- font-size: 175%;
- border: 1px solid #bbb;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
+main header h3 {
+ margin: 2em 0 1.5em;
+ border-width: 0;
+ border-top: 3px solid #bbb;
+ font-size: 120%;
}
.documentation-section-title {
@@ -364,47 +388,35 @@ ul.link-list .type {
.documentation-section-title .section-click-top {
position: absolute;
top: 6px;
- right: 12px;
+ left: 12px;
font-size: 10px;
color: #9b9877;
visibility: hidden;
- padding-right: 0.5px;
+ padding-left: 0.5px;
}
.documentation-section-title:hover .section-click-top {
visibility: visible;
}
-#documentation h3.section-header {
- margin-top: 1em;
- padding: 0.25em 0.5em;
- background-color: #dedede;
- color: #333;
- font-size: 150%;
- border: 1px solid #bbb;
- -moz-border-radius: 3px;
- -webkit-border-radius: 3px;
-}
-
-#constants-list > dl,
-#attributes-list > dl {
+.constants-list > dl {
margin: 1em 0 2em;
border: 0;
}
-#constants-list > dl dt,
-#attributes-list > dl dt {
+
+.constants-list > dl dt {
+ margin-bottom: 0.75em;
padding-left: 0;
- font-weight: bold;
- font-family: Monaco, "Andale Mono";
- background: inherit;
+ font-family: "Source Code Pro", Monaco, monospace;
+ font-size: 110%;
}
-#constants-list > dl dt a,
-#attributes-list > dl dt a {
+
+.constants-list > dl dt a {
color: inherit;
}
-#constants-list > dl dd,
-#attributes-list > dl dd {
- margin: 0 0 1em 0;
+
+.constants-list > dl dd {
+ margin: 0 0 2em 0;
padding: 0;
color: #666;
}
@@ -428,93 +440,77 @@ ul.link-list .type {
/* @group Method Details */
-#documentation .method-source-code {
+main .method-source-code {
display: none;
}
-#documentation .method-description .method-calls-super {
+main .method-description .method-calls-super {
color: #333;
- font-weight: bolder;
+ font-weight: bold;
}
-#documentation .method-detail {
- margin: 0.5em 0;
- padding: 0.5em 0;
+main .method-detail {
+ margin-bottom: 2.5em;
cursor: pointer;
}
-#documentation .method-detail:hover {
- background-color: #f1edba;
+
+main .method-detail:target {
+ margin-left: -10px;
+ border-left: 10px solid #f1edba;
}
-#documentation .method-heading {
+
+main .method-heading {
position: relative;
- padding: 2px 4px 0 20px;
- font-size: 125%;
+ font-family: "Source Code Pro", Monaco, monospace;
+ font-size: 110%;
font-weight: bold;
color: #333;
- background: url(images/brick.png) no-repeat left bottom;
}
-#documentation .method-heading :link,
-#documentation .method-heading :visited {
+main .method-heading :link,
+main .method-heading :visited {
color: inherit;
}
-#documentation .method-click-advice {
+main .method-click-advice {
position: absolute;
top: 2px;
right: 5px;
- font-size: 10px;
+ font-size: 12px;
color: #9b9877;
visibility: hidden;
padding-right: 20px;
line-height: 20px;
background: url(images/zoom.png) no-repeat right top;
}
-#documentation .method-heading:hover .method-click-advice {
+main .method-heading:hover .method-click-advice {
visibility: visible;
}
-#documentation .method-alias .method-heading {
- color: #666;
- background: url(images/brick_link.png) no-repeat left bottom;
-}
-
-#documentation .method-description,
-#documentation .aliases {
- margin: 0 20px;
+main .method-alias .method-heading {
color: #666;
}
-#documentation .method-description p,
-#documentation .aliases p {
- line-height: 1.2em;
+main .method-description,
+main .aliases {
+ margin-top: 0.75em;
+ color: #333;
}
-#documentation .aliases {
+main .aliases {
padding-top: 4px;
font-style: italic;
cursor: default;
}
-#documentation .method-description p {
- margin-bottom: 0.5em;
-}
-#documentation .method-description ul {
+main .method-description ul {
margin-left: 1.5em;
}
-pre {
- margin: 0.5em 0;
-}
-#documentation .attribute-method-heading {
- background: url(images/tag_green.png) no-repeat left bottom;
-}
-#documentation #attribute-method-details .method-detail:hover {
+main #attribute-method-details .method-detail:hover {
background-color: transparent;
cursor: default;
}
-#documentation .attribute-access-type {
- font-size: 60%;
+main .attribute-access-type {
text-transform: uppercase;
- vertical-align: super;
- padding: 0 2px;
+ padding: 0 1em;
}
/* @end */
@@ -523,15 +519,12 @@ pre {
/* @group Source Code */
pre {
- overflow: auto;
- background: #262626;
- color: white;
+ margin: 0.5em 0;
border: 1px dashed #999;
padding: 0.5em;
-}
-
-.description pre {
- margin: 0 0.4em;
+ background: #262626;
+ color: white;
+ overflow: auto;
}
.ruby-constant { color: #7fffd4; background: transparent; }
@@ -540,7 +533,7 @@ pre {
.ruby-operator { color: #00ffee; background: transparent; }
.ruby-identifier { color: #ffdead; background: transparent; }
.ruby-node { color: #ffa07a; background: transparent; }
-.ruby-comment { color: #dc0000; font-weight: bold; background: transparent; }
+.ruby-comment { color: #dc0000; background: transparent; }
.ruby-regexp { color: #ffa07a; background: transparent; }
.ruby-value { color: #7fffd4; background: transparent; }
@@ -548,23 +541,24 @@ pre {
/* @group search results */
-#search-results h1 {
- font-size: 1em;
+#search-results {
+ font-family: Lato, sans-serif;
+ font-weight: 300;
+}
+
+#search-results .search-match {
+ font-family: Helvetica, sans-serif;
font-weight: normal;
- text-shadow: none;
}
-#search-results .current {
- background: #ccc;
+#search-results .search-selected {
+ background: #e8e8e8;
border-bottom: 1px solid transparent;
}
#search-results li {
list-style: none;
border-bottom: 1px solid #aaa;
- -moz-border-radius: 4px;
- -webkit-border-radius: 4px;
- border-radius: 4px;
margin-bottom: 0.5em;
}
@@ -589,6 +583,7 @@ pre {
#search-results pre {
margin: 0.5em;
+ font-family: "Source Code Pro", Monaco, monospace;
}
/* @end */
diff --git a/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml b/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml
index 24c9ba8eaa..f0841572c3 100644
--- a/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml
+++ b/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml
@@ -1,5 +1,5 @@
-<body>
-<nav id="metadata">
+<body role="document">
+<nav role="navigation">
<%= render '_sidebar_navigation.rhtml' %>
<%= render '_sidebar_search.rhtml' %>
@@ -10,9 +10,9 @@
</div>
</nav>
-<div id="documentation" class="description">
+<main role="main">
<h1>Not Found</h1>
- <p>The page <kbd><%=h path %></kbd> was not found
-</div>
+ <p><%= message %>
+</main>
diff --git a/lib/rdoc/generator/template/darkfish/servlet_root.rhtml b/lib/rdoc/generator/template/darkfish/servlet_root.rhtml
index 63b4ee8ff7..3a33659aea 100644
--- a/lib/rdoc/generator/template/darkfish/servlet_root.rhtml
+++ b/lib/rdoc/generator/template/darkfish/servlet_root.rhtml
@@ -1,16 +1,43 @@
-<body>
-<nav id="metadata">
-<%= render '_sidebar_search.rhtml' %>
+<body role="document">
+<nav role="navigation">
+ <div id="project-navigation">
+ <div id="home-section" class="nav-section">
+ <h2>
+ <a href="<%= rel_prefix %>/" rel="home">Home</a>
+ </h2>
+ </div>
+
+ <%= render '_sidebar_search.rhtml' %>
+ </div>
<%= render '_sidebar_installed.rhtml' %>
</nav>
-<div id="documentation" class="description">
+<main role="main">
<h1>Local RDoc Documentation</h1>
<p>Here you can browse local documentation from the ruby standard library and
your installed gems.
+<% extra_dirs = installed.select { |_, _, _, type,| type == :extra } %>
+<% unless extra_dirs.empty? %>
+ <h2>Extra Documentation Directories</h2>
+
+ <p>The following additional documentation directories are available:</p>
+
+ <ol>
+ <% extra_dirs.each do |name, href, exists, _, path| %>
+ <li>
+ <% if exists %>
+ <a href="<%= href %>"><%= h name %></a> (<%= h path %>)
+ <% else %>
+ <%= h name %> (<%= h path %>; <i>not available</i>)
+ <% end %>
+ </li>
+ <% end %>
+ </ol>
+<% end %>
+
<% gems = installed.select { |_, _, _, type,| type == :gem } %>
<% missing = gems.reject { |_, _, exists,| exists } %>
<% unless missing.empty? then %>
@@ -32,6 +59,5 @@
<% end %>
</ul>
<% end %>
-
-</div>
+</main>
diff --git a/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml b/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml
index bebff40f6a..7ff1a9e93e 100644
--- a/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml
+++ b/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml
@@ -1,9 +1,10 @@
-<body class="indexpage">
-<h1><%= h @title %></h1>
+<body id="top" class="table-of-contents">
+<main role="main">
+<h1 class="class"><%= h @title %></h1>
<% simple_files = @files.select { |f| f.text? } %>
<% unless simple_files.empty? then %>
-<h2>Pages</h2>
+<h2 id="pages">Pages</h2>
<ul>
<% simple_files.sort.each do |file| %>
<li class="file">
@@ -12,8 +13,7 @@
# HACK table_of_contents should not exist on Document
table = file.parse(file.comment).table_of_contents
unless table.empty? then %>
- <img class="toc-toggle" src="images/transparent.png" alt="" title="toggle headings">
- <ul class="initially-hidden">
+ <ul>
<% table.each do |heading| %>
<li><a href="<%= file.path %>#<%= heading.aref %>"><%= heading.plain_html %></a>
<% end %>
@@ -24,7 +24,7 @@
</ul>
<% end %>
-<h2 id="classes">Classes/Modules</h2>
+<h2 id="classes">Classes and Modules</h2>
<ul>
<% @modsort.each do |klass| %>
<li class="<%= klass.type %>">
@@ -34,22 +34,25 @@
table.concat klass.section_contents
unless table.empty? then %>
- <img class="toc-toggle" src="images/transparent.png" alt="" title="toggle headings">
- <ul class="initially-hidden">
+ <ul>
<% table.each do |item| %>
<li><a href="<%= klass.path %>#<%= item.aref %>"><%= item.plain_html %></a>
<% end %>
</ul>
<% end %>
</li>
- <% end %>
+<% end %>
</ul>
<h2 id="methods">Methods</h2>
<ul>
- <% @store.all_classes_and_modules.map do |mod|
- mod.method_list
- end.flatten.sort.each do |method| %>
- <li class="method"><a href="<%= method.path %>"><%= method.pretty_name %> &mdash; <%= method.parent.full_name %></a>
- <% end %>
+<% @store.all_classes_and_modules.map do |mod|
+ mod.method_list
+ end.flatten.sort.each do |method| %>
+ <li class="method">
+ <a href="<%= method.path %>"><%= h method.pretty_name %></a>
+ &mdash;
+ <span class="container"><%= method.parent.full_name %></span>
+<% end %>
</ul>
+</main>
diff --git a/lib/rdoc/i18n.rb b/lib/rdoc/i18n.rb
new file mode 100644
index 0000000000..4cccbc66d3
--- /dev/null
+++ b/lib/rdoc/i18n.rb
@@ -0,0 +1,9 @@
+##
+# 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
new file mode 100644
index 0000000000..e98732e086
--- /dev/null
+++ b/lib/rdoc/i18n/locale.rb
@@ -0,0 +1,101 @@
+##
+# 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
new file mode 100644
index 0000000000..ee5c66a1ff
--- /dev/null
+++ b/lib/rdoc/i18n/text.rb
@@ -0,0 +1,125 @@
+##
+# 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 1e9ff5a464..75ed9c7bff 100644
--- a/lib/rdoc/include.rb
+++ b/lib/rdoc/include.rb
@@ -1,119 +1,9 @@
##
-# A Module include in a class with \#include
+# A Module included in a class with \#include
+#
+# RDoc::Include.new 'Enumerable', 'comment ...'
-class RDoc::Include < RDoc::CodeObject
-
- ##
- # Name of included module
-
- attr_accessor :name
-
- ##
- # Creates a new Include for +name+ with +comment+
-
- def initialize(name, comment)
- super()
- @name = name
- self.comment = comment
- @module = nil # cache for module if found
- end
-
- ##
- # Includes are sorted by name
-
- def <=> other
- return unless self.class === other
-
- name <=> other.name
- end
-
- def == other # :nodoc:
- self.class === other and @name == other.name
- end
-
- alias eql? ==
-
- ##
- # Full name based on #module
-
- def full_name
- m = self.module
- RDoc::ClassModule === m ? m.full_name : @name
- end
-
- def hash # :nodoc:
- [@name, self.module].hash
- end
-
- def inspect # :nodoc:
- "#<%s:0x%x %s.include %s>" % [
- self.class,
- object_id,
- parent_name, @name,
- ]
- end
-
- ##
- # Attempts to locate the included module object. Returns the name if not
- # known.
- #
- # The scoping rules of Ruby to resolve the name of an included module are:
- # - first look into the children of the current context;
- # - if not found, look into the children of included modules,
- # in reverse inclusion order;
- # - if still not found, go up the hierarchy of names.
- #
- # This method has <code>O(n!)</code> behavior when the module calling
- # include is referencing nonexistent modules. Avoid calling #module until
- # after all the files are parsed. This behavior is due to ruby's constant
- # lookup behavior.
- #
- # As of the beginning of October, 2011, no gem includes nonexistent modules.
-
- def module
- return @module if @module
-
- # search the current context
- return @name unless parent
- full_name = parent.child_name(@name)
- @module = @store.modules_hash[full_name]
- return @module if @module
- return @name if @name =~ /^::/
-
- # search the includes before this one, in reverse order
- searched = parent.includes.take_while { |i| i != self }.reverse
- searched.each do |i|
- inc = i.module
- next if String === inc
- full_name = inc.child_name(@name)
- @module = @store.modules_hash[full_name]
- return @module if @module
- end
-
- # go up the hierarchy of names
- up = parent.parent
- while up
- full_name = up.child_name(@name)
- @module = @store.modules_hash[full_name]
- return @module if @module
- up = up.parent
- end
-
- @name
- end
-
- ##
- # Sets the store for this class or module and its contained code objects.
-
- def store= store
- super
-
- @file = @store.add_file @file.full_name if @file
- end
-
- def to_s # :nodoc:
- "include #@name in: #{parent}"
- end
+class RDoc::Include < RDoc::Mixin
end
diff --git a/lib/rdoc/known_classes.rb b/lib/rdoc/known_classes.rb
index 863be4bd5c..ddc932c7c0 100644
--- a/lib/rdoc/known_classes.rb
+++ b/lib/rdoc/known_classes.rb
@@ -62,6 +62,7 @@ module RDoc
"rb_mDL" => "DL",
"rb_mEnumerable" => "Enumerable",
"rb_mErrno" => "Errno",
+ "rb_mFConst" => "File::Constants",
"rb_mFileTest" => "FileTest",
"rb_mGC" => "GC",
"rb_mKernel" => "Kernel",
diff --git a/lib/rdoc/markdown.rb b/lib/rdoc/markdown.rb
index 5133c7b0c8..63c9a9076f 100644
--- a/lib/rdoc/markdown.rb
+++ b/lib/rdoc/markdown.rb
@@ -8,6 +8,16 @@
# RDoc::Options@Saved+Options for instructions on setting up a `.doc_options`
# file to store your project default.
#
+# ## Usage
+#
+# Here is a brief example of using this parse to read a markdown file by hand.
+#
+# data = File.read("README.md")
+# formatter = RDoc::Markup::ToHtml.new(RDoc::Options.new, nil)
+# html = RDoc::Markdown.parse(data).accept(@formatter)
+#
+# # do something with html
+#
# ## Extensions
#
# The following markdown extensions are supported by the parser, but not all
@@ -120,7 +130,6 @@
# ## Limitations
#
# * Link titles are not used
-# * Image links are not generated correctly
# * Footnotes are collapsed into a single paragraph
#
# ## Author
@@ -172,8 +181,7 @@ class RDoc::Markdown
# Prepares for parsing +str+. If you define a custom initialize you must
# call this method before #parse
def setup_parser(str, debug=false)
- @string = str
- @pos = 0
+ set_string str, 0
@memoizations = Hash.new { |h,k| h[k] = {} }
@result = nil
@failed_rule = nil
@@ -186,7 +194,6 @@ class RDoc::Markdown
attr_reader :failing_rule_offset
attr_accessor :result, :pos
-
def current_column(target=pos)
if c = string.rindex("\n", target-1)
return target - c - 1
@@ -220,6 +227,13 @@ class RDoc::Markdown
@string[start..@pos-1]
end
+ # Sets the string and current parsing position for the parser.
+ def set_string string, pos
+ @string = string
+ @string_size = string ? string.size : 0
+ @pos = pos
+ end
+
def show_pos
width = 10
if @pos < width
@@ -326,19 +340,19 @@ class RDoc::Markdown
return nil
end
- if "".respond_to? :getbyte
+ if "".respond_to? :ord
def get_byte
- if @pos >= @string.size
+ if @pos >= @string_size
return nil
end
- s = @string.getbyte @pos
+ s = @string[@pos].ord
@pos += 1
s
end
else
def get_byte
- if @pos >= @string.size
+ if @pos >= @string_size
return nil
end
@@ -387,8 +401,7 @@ class RDoc::Markdown
old_pos = @pos
old_string = @string
- @pos = other.pos
- @string = other.string
+ set_string other.string, other.pos
begin
if val = __send__(rule, *args)
@@ -399,8 +412,7 @@ class RDoc::Markdown
end
val
ensure
- @pos = old_pos
- @string = old_string
+ set_string old_string, old_pos
end
end
@@ -548,15 +560,13 @@ class RDoc::Markdown
def self.extension name
EXTENSIONS << name
- eval <<-RUBY
- def #{name}?
- extension? __method__
- end
+ define_method "#{name}?" do
+ extension? name
+ end
- def #{name}= enable
- extension __method__, enable
- end
- RUBY
+ define_method "#{name}=" do |enable|
+ extension name, enable
+ end
end
##
@@ -636,8 +646,6 @@ class RDoc::Markdown
# Is the extension `name` enabled?
def extension? name
- name = name.to_s.delete('?').intern
-
@extensions.include? name
end
@@ -647,8 +655,6 @@ class RDoc::Markdown
# Enables or disables the extension with `name`
def extension name, enable
- name = name.to_s.delete('=').intern
-
if enable then
@extensions |= [name]
else
@@ -870,13 +876,13 @@ class RDoc::Markdown
return _tmp
end
- # Block = BlankLine* (BlockQuote | Verbatim | CodeFence | Note | Reference | HorizontalRule | Heading | OrderedList | BulletList | DefinitionList | HtmlBlock | StyleBlock | Para | Plain)
+ # Block = @BlankLine* (BlockQuote | Verbatim | CodeFence | Note | Reference | HorizontalRule | Heading | OrderedList | BulletList | DefinitionList | HtmlBlock | StyleBlock | Para | Plain)
def _Block
_save = self.pos
while true # sequence
while true
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
break unless _tmp
end
_tmp = true
@@ -942,12 +948,12 @@ class RDoc::Markdown
return _tmp
end
- # Para = NonindentSpace Inlines:a BlankLine+ { paragraph a }
+ # Para = @NonindentSpace Inlines:a @BlankLine+ { paragraph a }
def _Para
_save = self.pos
while true # sequence
- _tmp = apply(:_NonindentSpace)
+ _tmp = _NonindentSpace()
unless _tmp
self.pos = _save
break
@@ -959,10 +965,10 @@ class RDoc::Markdown
break
end
_save1 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
if _tmp
while true
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
break unless _tmp
end
_tmp = true
@@ -1008,13 +1014,13 @@ class RDoc::Markdown
return _tmp
end
- # AtxInline = !Newline !(Sp? "#"* Sp Newline) Inline
+ # AtxInline = !@Newline !(@Sp? /#*/ @Sp @Newline) Inline
def _AtxInline
_save = self.pos
while true # sequence
_save1 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save1
unless _tmp
@@ -1026,7 +1032,7 @@ class RDoc::Markdown
_save3 = self.pos
while true # sequence
_save4 = self.pos
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
_tmp = true
self.pos = _save4
@@ -1035,21 +1041,17 @@ class RDoc::Markdown
self.pos = _save3
break
end
- while true
- _tmp = match_string("#")
- break unless _tmp
- end
- _tmp = true
+ _tmp = scan(/\A(?-mix:#*)/)
unless _tmp
self.pos = _save3
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save3
break
end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save3
end
@@ -1073,36 +1075,13 @@ class RDoc::Markdown
return _tmp
end
- # AtxStart = < ("######" | "#####" | "####" | "###" | "##" | "#") > { text.length }
+ # AtxStart = < /\#{1,6}/ > { text.length }
def _AtxStart
_save = self.pos
while true # sequence
_text_start = self.pos
-
- _save1 = self.pos
- while true # choice
- _tmp = match_string("######")
- break if _tmp
- self.pos = _save1
- _tmp = match_string("#####")
- break if _tmp
- self.pos = _save1
- _tmp = match_string("####")
- break if _tmp
- self.pos = _save1
- _tmp = match_string("###")
- break if _tmp
- self.pos = _save1
- _tmp = match_string("##")
- break if _tmp
- self.pos = _save1
- _tmp = match_string("#")
- break if _tmp
- self.pos = _save1
- break
- end # end choice
-
+ _tmp = scan(/\A(?-mix:\#{1,6})/)
if _tmp
text = get_text(_text_start)
end
@@ -1122,7 +1101,7 @@ class RDoc::Markdown
return _tmp
end
- # AtxHeading = AtxStart:s Sp? AtxInline+:a (Sp? "#"* Sp)? Newline { RDoc::Markup::Heading.new(s, a.join) }
+ # AtxHeading = AtxStart:s @Sp? AtxInline+:a (@Sp? /#*/ @Sp)? @Newline { RDoc::Markup::Heading.new(s, a.join) }
def _AtxHeading
_save = self.pos
@@ -1134,7 +1113,7 @@ class RDoc::Markdown
break
end
_save1 = self.pos
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
_tmp = true
self.pos = _save1
@@ -1168,7 +1147,7 @@ class RDoc::Markdown
_save4 = self.pos
while true # sequence
_save5 = self.pos
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
_tmp = true
self.pos = _save5
@@ -1177,16 +1156,12 @@ class RDoc::Markdown
self.pos = _save4
break
end
- while true
- _tmp = match_string("#")
- break unless _tmp
- end
- _tmp = true
+ _tmp = scan(/\A(?-mix:#*)/)
unless _tmp
self.pos = _save4
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save4
end
@@ -1201,7 +1176,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save
break
@@ -1236,26 +1211,17 @@ class RDoc::Markdown
return _tmp
end
- # SetextBottom1 = "===" "="* Newline
+ # SetextBottom1 = /={3,}/ @Newline
def _SetextBottom1
_save = self.pos
while true # sequence
- _tmp = match_string("===")
- unless _tmp
- self.pos = _save
- break
- end
- while true
- _tmp = match_string("=")
- break unless _tmp
- end
- _tmp = true
+ _tmp = scan(/\A(?-mix:={3,})/)
unless _tmp
self.pos = _save
break
end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save
end
@@ -1266,26 +1232,17 @@ class RDoc::Markdown
return _tmp
end
- # SetextBottom2 = "---" "-"* Newline
+ # SetextBottom2 = /-{3,}/ @Newline
def _SetextBottom2
_save = self.pos
while true # sequence
- _tmp = match_string("---")
+ _tmp = scan(/\A(?-mix:-{3,})/)
unless _tmp
self.pos = _save
break
end
- while true
- _tmp = match_string("-")
- break unless _tmp
- end
- _tmp = true
- unless _tmp
- self.pos = _save
- break
- end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save
end
@@ -1296,7 +1253,7 @@ class RDoc::Markdown
return _tmp
end
- # SetextHeading1 = &(RawLine SetextBottom1) StartList:a (!Endline Inline:b { a << b })+ Sp? Newline SetextBottom1 { RDoc::Markup::Heading.new(1, a.join) }
+ # SetextHeading1 = &(@RawLine SetextBottom1) @StartList:a (!@Endline Inline:b { a << b })+ @Sp? @Newline SetextBottom1 { RDoc::Markup::Heading.new(1, a.join) }
def _SetextHeading1
_save = self.pos
@@ -1305,7 +1262,7 @@ class RDoc::Markdown
_save2 = self.pos
while true # sequence
- _tmp = apply(:_RawLine)
+ _tmp = _RawLine()
unless _tmp
self.pos = _save2
break
@@ -1322,7 +1279,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_StartList)
+ _tmp = _StartList()
a = @result
unless _tmp
self.pos = _save
@@ -1333,7 +1290,7 @@ class RDoc::Markdown
_save4 = self.pos
while true # sequence
_save5 = self.pos
- _tmp = apply(:_Endline)
+ _tmp = _Endline()
_tmp = _tmp ? nil : true
self.pos = _save5
unless _tmp
@@ -1360,7 +1317,7 @@ class RDoc::Markdown
_save6 = self.pos
while true # sequence
_save7 = self.pos
- _tmp = apply(:_Endline)
+ _tmp = _Endline()
_tmp = _tmp ? nil : true
self.pos = _save7
unless _tmp
@@ -1392,7 +1349,7 @@ class RDoc::Markdown
break
end
_save8 = self.pos
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
_tmp = true
self.pos = _save8
@@ -1401,7 +1358,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save
break
@@ -1423,7 +1380,7 @@ class RDoc::Markdown
return _tmp
end
- # SetextHeading2 = &(RawLine SetextBottom2) StartList:a (!Endline Inline:b { a << b })+ Sp? Newline SetextBottom2 { RDoc::Markup::Heading.new(2, a.join) }
+ # SetextHeading2 = &(@RawLine SetextBottom2) @StartList:a (!@Endline Inline:b { a << b })+ @Sp? @Newline SetextBottom2 { RDoc::Markup::Heading.new(2, a.join) }
def _SetextHeading2
_save = self.pos
@@ -1432,7 +1389,7 @@ class RDoc::Markdown
_save2 = self.pos
while true # sequence
- _tmp = apply(:_RawLine)
+ _tmp = _RawLine()
unless _tmp
self.pos = _save2
break
@@ -1449,7 +1406,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_StartList)
+ _tmp = _StartList()
a = @result
unless _tmp
self.pos = _save
@@ -1460,7 +1417,7 @@ class RDoc::Markdown
_save4 = self.pos
while true # sequence
_save5 = self.pos
- _tmp = apply(:_Endline)
+ _tmp = _Endline()
_tmp = _tmp ? nil : true
self.pos = _save5
unless _tmp
@@ -1487,7 +1444,7 @@ class RDoc::Markdown
_save6 = self.pos
while true # sequence
_save7 = self.pos
- _tmp = apply(:_Endline)
+ _tmp = _Endline()
_tmp = _tmp ? nil : true
self.pos = _save7
unless _tmp
@@ -1519,7 +1476,7 @@ class RDoc::Markdown
break
end
_save8 = self.pos
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
_tmp = true
self.pos = _save8
@@ -1528,7 +1485,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save
break
@@ -1591,12 +1548,12 @@ class RDoc::Markdown
return _tmp
end
- # BlockQuoteRaw = StartList:a (">" " "? Line:l { a << l } (!">" !BlankLine Line:c { a << c })* (BlankLine:n { a << n })*)+ { inner_parse a.join }
+ # BlockQuoteRaw = @StartList:a (">" " "? Line:l { a << l } (!">" !@BlankLine Line:c { a << c })* (@BlankLine:n { a << n })*)+ { inner_parse a.join }
def _BlockQuoteRaw
_save = self.pos
while true # sequence
- _tmp = apply(:_StartList)
+ _tmp = _StartList()
a = @result
unless _tmp
self.pos = _save
@@ -1646,7 +1603,7 @@ class RDoc::Markdown
break
end
_save7 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
self.pos = _save7
unless _tmp
@@ -1678,7 +1635,7 @@ class RDoc::Markdown
_save9 = self.pos
while true # sequence
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
n = @result
unless _tmp
self.pos = _save9
@@ -1746,7 +1703,7 @@ class RDoc::Markdown
break
end
_save15 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
self.pos = _save15
unless _tmp
@@ -1778,7 +1735,7 @@ class RDoc::Markdown
_save17 = self.pos
while true # sequence
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
n = @result
unless _tmp
self.pos = _save17
@@ -1823,13 +1780,13 @@ class RDoc::Markdown
return _tmp
end
- # NonblankIndentedLine = !BlankLine IndentedLine
+ # NonblankIndentedLine = !@BlankLine IndentedLine
def _NonblankIndentedLine
_save = self.pos
while true # sequence
_save1 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
self.pos = _save1
unless _tmp
@@ -1847,14 +1804,14 @@ class RDoc::Markdown
return _tmp
end
- # VerbatimChunk = BlankLine*:a NonblankIndentedLine+:b { a.concat b }
+ # VerbatimChunk = @BlankLine*:a NonblankIndentedLine+:b { a.concat b }
def _VerbatimChunk
_save = self.pos
while true # sequence
_ary = []
while true
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
_ary << @result if _tmp
break unless _tmp
end
@@ -1934,12 +1891,12 @@ class RDoc::Markdown
return _tmp
end
- # HorizontalRule = NonindentSpace ("*" Sp "*" Sp "*" (Sp "*")* | "-" Sp "-" Sp "-" (Sp "-")* | "_" Sp "_" Sp "_" (Sp "_")*) Sp Newline BlankLine+ { RDoc::Markup::Rule.new 1 }
+ # HorizontalRule = @NonindentSpace ("*" @Sp "*" @Sp "*" (@Sp "*")* | "-" @Sp "-" @Sp "-" (@Sp "-")* | "_" @Sp "_" @Sp "_" (@Sp "_")*) @Sp @Newline @BlankLine+ { RDoc::Markup::Rule.new 1 }
def _HorizontalRule
_save = self.pos
while true # sequence
- _tmp = apply(:_NonindentSpace)
+ _tmp = _NonindentSpace()
unless _tmp
self.pos = _save
break
@@ -1955,7 +1912,7 @@ class RDoc::Markdown
self.pos = _save2
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save2
break
@@ -1965,7 +1922,7 @@ class RDoc::Markdown
self.pos = _save2
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save2
break
@@ -1979,7 +1936,7 @@ class RDoc::Markdown
_save4 = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save4
break
@@ -2010,7 +1967,7 @@ class RDoc::Markdown
self.pos = _save5
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save5
break
@@ -2020,7 +1977,7 @@ class RDoc::Markdown
self.pos = _save5
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save5
break
@@ -2034,7 +1991,7 @@ class RDoc::Markdown
_save7 = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save7
break
@@ -2065,7 +2022,7 @@ class RDoc::Markdown
self.pos = _save8
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save8
break
@@ -2075,7 +2032,7 @@ class RDoc::Markdown
self.pos = _save8
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save8
break
@@ -2089,7 +2046,7 @@ class RDoc::Markdown
_save10 = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save10
break
@@ -2119,21 +2076,21 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save
break
end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save
break
end
_save11 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
if _tmp
while true
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
break unless _tmp
end
_tmp = true
@@ -2156,7 +2113,7 @@ class RDoc::Markdown
return _tmp
end
- # Bullet = !HorizontalRule NonindentSpace ("+" | "*" | "-") Spacechar+
+ # Bullet = !HorizontalRule @NonindentSpace /[+*-]/ @Spacechar+
def _Bullet
_save = self.pos
@@ -2169,40 +2126,26 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_NonindentSpace)
+ _tmp = _NonindentSpace()
unless _tmp
self.pos = _save
break
end
-
- _save2 = self.pos
- while true # choice
- _tmp = match_string("+")
- break if _tmp
- self.pos = _save2
- _tmp = match_string("*")
- break if _tmp
- self.pos = _save2
- _tmp = match_string("-")
- break if _tmp
- self.pos = _save2
- break
- end # end choice
-
+ _tmp = scan(/\A(?-mix:[+*-])/)
unless _tmp
self.pos = _save
break
end
- _save3 = self.pos
- _tmp = apply(:_Spacechar)
+ _save2 = self.pos
+ _tmp = _Spacechar()
if _tmp
while true
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
break unless _tmp
end
_tmp = true
else
- self.pos = _save3
+ self.pos = _save2
end
unless _tmp
self.pos = _save
@@ -2255,7 +2198,7 @@ class RDoc::Markdown
return _tmp
end
- # ListTight = ListItemTight+:a BlankLine* !(Bullet | Enumerator) { a }
+ # ListTight = ListItemTight+:a @BlankLine* !(Bullet | Enumerator) { a }
def _ListTight
_save = self.pos
@@ -2281,7 +2224,7 @@ class RDoc::Markdown
break
end
while true
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
break unless _tmp
end
_tmp = true
@@ -2320,12 +2263,12 @@ class RDoc::Markdown
return _tmp
end
- # ListLoose = StartList:a (ListItem:b BlankLine* { a << b })+ { a }
+ # ListLoose = @StartList:a (ListItem:b @BlankLine* { a << b })+ { a }
def _ListLoose
_save = self.pos
while true # sequence
- _tmp = apply(:_StartList)
+ _tmp = _StartList()
a = @result
unless _tmp
self.pos = _save
@@ -2342,7 +2285,7 @@ class RDoc::Markdown
break
end
while true
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
break unless _tmp
end
_tmp = true
@@ -2370,7 +2313,7 @@ class RDoc::Markdown
break
end
while true
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
break unless _tmp
end
_tmp = true
@@ -2408,7 +2351,7 @@ class RDoc::Markdown
return _tmp
end
- # ListItem = (Bullet | Enumerator) StartList:a ListBlock:b { a << b } (ListContinuationBlock:c { a.push(*c) })* { list_item_from a }
+ # ListItem = (Bullet | Enumerator) @StartList:a ListBlock:b { a << b } (ListContinuationBlock:c { a.push(*c) })* { list_item_from a }
def _ListItem
_save = self.pos
@@ -2429,7 +2372,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_StartList)
+ _tmp = _StartList()
a = @result
unless _tmp
self.pos = _save
@@ -2484,7 +2427,7 @@ class RDoc::Markdown
return _tmp
end
- # ListItemTight = (Bullet | Enumerator) ListBlock:a (!BlankLine ListContinuationBlock:b { a.push(*b) })* !ListContinuationBlock { list_item_from a }
+ # ListItemTight = (Bullet | Enumerator) ListBlock:a (!@BlankLine ListContinuationBlock:b { a.push(*b) })* !ListContinuationBlock { list_item_from a }
def _ListItemTight
_save = self.pos
@@ -2516,7 +2459,7 @@ class RDoc::Markdown
_save3 = self.pos
while true # sequence
_save4 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
self.pos = _save4
unless _tmp
@@ -2564,13 +2507,13 @@ class RDoc::Markdown
return _tmp
end
- # ListBlock = !BlankLine Line:a ListBlockLine*:c { [a, *c] }
+ # ListBlock = !@BlankLine Line:a ListBlockLine*:c { [a, *c] }
def _ListBlock
_save = self.pos
while true # sequence
_save1 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
self.pos = _save1
unless _tmp
@@ -2608,19 +2551,19 @@ class RDoc::Markdown
return _tmp
end
- # ListContinuationBlock = StartList:a BlankLine* { a << "\n" } (Indent ListBlock:b { a.concat b })+ { a }
+ # ListContinuationBlock = @StartList:a @BlankLine* { a << "\n" } (Indent ListBlock:b { a.concat b })+ { a }
def _ListContinuationBlock
_save = self.pos
while true # sequence
- _tmp = apply(:_StartList)
+ _tmp = _StartList()
a = @result
unless _tmp
self.pos = _save
break
end
while true
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
break unless _tmp
end
_tmp = true
@@ -2703,12 +2646,12 @@ class RDoc::Markdown
return _tmp
end
- # Enumerator = NonindentSpace [0-9]+ "." Spacechar+
+ # Enumerator = @NonindentSpace [0-9]+ "." @Spacechar+
def _Enumerator
_save = self.pos
while true # sequence
- _tmp = apply(:_NonindentSpace)
+ _tmp = _NonindentSpace()
unless _tmp
self.pos = _save
break
@@ -2748,10 +2691,10 @@ class RDoc::Markdown
break
end
_save4 = self.pos
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
if _tmp
while true
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
break unless _tmp
end
_tmp = true
@@ -2809,13 +2752,13 @@ class RDoc::Markdown
return _tmp
end
- # ListBlockLine = !BlankLine !(Indent? (Bullet | Enumerator)) !HorizontalRule OptionallyIndentedLine
+ # ListBlockLine = !@BlankLine !(Indent? (Bullet | Enumerator)) !HorizontalRule OptionallyIndentedLine
def _ListBlockLine
_save = self.pos
while true # sequence
_save1 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
self.pos = _save1
unless _tmp
@@ -8457,7 +8400,7 @@ class RDoc::Markdown
return _tmp
end
- # HtmlBlock = < (HtmlBlockInTags | HtmlComment | HtmlBlockSelfClosing | HtmlUnclosed) > BlankLine+ { if html? then RDoc::Markup::Raw.new text end }
+ # HtmlBlock = < (HtmlBlockInTags | HtmlComment | HtmlBlockSelfClosing | HtmlUnclosed) > @BlankLine+ { if html? then RDoc::Markup::Raw.new text end }
def _HtmlBlock
_save = self.pos
@@ -8489,10 +8432,10 @@ class RDoc::Markdown
break
end
_save2 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
if _tmp
while true
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
break unless _tmp
end
_tmp = true
@@ -9017,7 +8960,7 @@ class RDoc::Markdown
return _tmp
end
- # StyleBlock = < InStyleTags > BlankLine* { if css? then RDoc::Markup::Raw.new text end }
+ # StyleBlock = < InStyleTags > @BlankLine* { if css? then RDoc::Markup::Raw.new text end }
def _StyleBlock
_save = self.pos
@@ -9032,7 +8975,7 @@ class RDoc::Markdown
break
end
while true
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
break unless _tmp
end
_tmp = true
@@ -9054,7 +8997,7 @@ class RDoc::Markdown
return _tmp
end
- # Inlines = (!Endline Inline:i { i } | Endline:c &Inline { c })+:chunks Endline? { chunks }
+ # Inlines = (!@Endline Inline:i { i } | @Endline:c &Inline { c })+:chunks @Endline? { chunks }
def _Inlines
_save = self.pos
@@ -9068,7 +9011,7 @@ class RDoc::Markdown
_save3 = self.pos
while true # sequence
_save4 = self.pos
- _tmp = apply(:_Endline)
+ _tmp = _Endline()
_tmp = _tmp ? nil : true
self.pos = _save4
unless _tmp
@@ -9094,7 +9037,7 @@ class RDoc::Markdown
_save5 = self.pos
while true # sequence
- _tmp = apply(:_Endline)
+ _tmp = _Endline()
c = @result
unless _tmp
self.pos = _save5
@@ -9130,7 +9073,7 @@ class RDoc::Markdown
_save8 = self.pos
while true # sequence
_save9 = self.pos
- _tmp = apply(:_Endline)
+ _tmp = _Endline()
_tmp = _tmp ? nil : true
self.pos = _save9
unless _tmp
@@ -9156,7 +9099,7 @@ class RDoc::Markdown
_save10 = self.pos
while true # sequence
- _tmp = apply(:_Endline)
+ _tmp = _Endline()
c = @result
unless _tmp
self.pos = _save10
@@ -9196,7 +9139,7 @@ class RDoc::Markdown
break
end
_save12 = self.pos
- _tmp = apply(:_Endline)
+ _tmp = _Endline()
unless _tmp
_tmp = true
self.pos = _save12
@@ -9217,7 +9160,7 @@ class RDoc::Markdown
return _tmp
end
- # Inline = (Str | Endline | UlOrStarLine | Space | Strong | Emph | Image | Link | NoteReference | InlineNote | Code | RawHtml | Entity | EscapedChar | Symbol)
+ # Inline = (Str | @Endline | UlOrStarLine | @Space | Strong | Emph | Image | Link | NoteReference | InlineNote | Code | RawHtml | Entity | EscapedChar | Symbol)
def _Inline
_save = self.pos
@@ -9225,13 +9168,13 @@ class RDoc::Markdown
_tmp = apply(:_Str)
break if _tmp
self.pos = _save
- _tmp = apply(:_Endline)
+ _tmp = _Endline()
break if _tmp
self.pos = _save
_tmp = apply(:_UlOrStarLine)
break if _tmp
self.pos = _save
- _tmp = apply(:_Space)
+ _tmp = _Space()
break if _tmp
self.pos = _save
_tmp = apply(:_Strong)
@@ -9274,16 +9217,16 @@ class RDoc::Markdown
return _tmp
end
- # Space = Spacechar+ { " " }
+ # Space = @Spacechar+ { " " }
def _Space
_save = self.pos
while true # sequence
_save1 = self.pos
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
if _tmp
while true
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
break unless _tmp
end
_tmp = true
@@ -9306,12 +9249,12 @@ class RDoc::Markdown
return _tmp
end
- # Str = StartList:a < NormalChar+ > { a = text } (StrChunk:c { a << c })* { a }
+ # Str = @StartList:a < @NormalChar+ > { a = text } (StrChunk:c { a << c })* { a }
def _Str
_save = self.pos
while true # sequence
- _tmp = apply(:_StartList)
+ _tmp = _StartList()
a = @result
unless _tmp
self.pos = _save
@@ -9319,10 +9262,10 @@ class RDoc::Markdown
end
_text_start = self.pos
_save1 = self.pos
- _tmp = apply(:_NormalChar)
+ _tmp = _NormalChar()
if _tmp
while true
- _tmp = apply(:_NormalChar)
+ _tmp = _NormalChar()
break unless _tmp
end
_tmp = true
@@ -9379,7 +9322,7 @@ class RDoc::Markdown
return _tmp
end
- # StrChunk = < (NormalChar | "_"+ &Alphanumeric)+ > { text }
+ # StrChunk = < (@NormalChar | /_+/ &Alphanumeric)+ > { text }
def _StrChunk
_save = self.pos
@@ -9389,30 +9332,20 @@ class RDoc::Markdown
_save2 = self.pos
while true # choice
- _tmp = apply(:_NormalChar)
+ _tmp = _NormalChar()
break if _tmp
self.pos = _save2
_save3 = self.pos
while true # sequence
- _save4 = self.pos
- _tmp = match_string("_")
- if _tmp
- while true
- _tmp = match_string("_")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save4
- end
+ _tmp = scan(/\A(?-mix:_+)/)
unless _tmp
self.pos = _save3
break
end
- _save5 = self.pos
+ _save4 = self.pos
_tmp = apply(:_Alphanumeric)
- self.pos = _save5
+ self.pos = _save4
unless _tmp
self.pos = _save3
end
@@ -9427,40 +9360,30 @@ class RDoc::Markdown
if _tmp
while true
- _save6 = self.pos
+ _save5 = self.pos
while true # choice
- _tmp = apply(:_NormalChar)
+ _tmp = _NormalChar()
break if _tmp
- self.pos = _save6
+ self.pos = _save5
- _save7 = self.pos
+ _save6 = self.pos
while true # sequence
- _save8 = self.pos
- _tmp = match_string("_")
- if _tmp
- while true
- _tmp = match_string("_")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save8
- end
+ _tmp = scan(/\A(?-mix:_+)/)
unless _tmp
- self.pos = _save7
+ self.pos = _save6
break
end
- _save9 = self.pos
+ _save7 = self.pos
_tmp = apply(:_Alphanumeric)
- self.pos = _save9
+ self.pos = _save7
unless _tmp
- self.pos = _save7
+ self.pos = _save6
end
break
end # end sequence
break if _tmp
- self.pos = _save6
+ self.pos = _save5
break
end # end choice
@@ -9489,7 +9412,7 @@ class RDoc::Markdown
return _tmp
end
- # EscapedChar = "\\" !Newline < /[:\\`|*_{}\[\]()#+.!><-]/ > { text }
+ # EscapedChar = "\\" !@Newline < /[:\\`|*_{}\[\]()#+.!><-]/ > { text }
def _EscapedChar
_save = self.pos
@@ -9500,7 +9423,7 @@ class RDoc::Markdown
break
end
_save1 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save1
unless _tmp
@@ -9565,18 +9488,18 @@ class RDoc::Markdown
return _tmp
end
- # Endline = (LineBreak | TerminalEndline | NormalEndline)
+ # Endline = (@LineBreak | @TerminalEndline | @NormalEndline)
def _Endline
_save = self.pos
while true # choice
- _tmp = apply(:_LineBreak)
+ _tmp = _LineBreak()
break if _tmp
self.pos = _save
- _tmp = apply(:_TerminalEndline)
+ _tmp = _TerminalEndline()
break if _tmp
self.pos = _save
- _tmp = apply(:_NormalEndline)
+ _tmp = _NormalEndline()
break if _tmp
self.pos = _save
break
@@ -9586,23 +9509,23 @@ class RDoc::Markdown
return _tmp
end
- # NormalEndline = Sp Newline !BlankLine !">" !AtxStart !(Line ("===" "="* | "---" "-"*) Newline) { "\n" }
+ # NormalEndline = @Sp @Newline !@BlankLine !">" !AtxStart !(Line /={3,}|-{3,}=/ @Newline) { "\n" }
def _NormalEndline
_save = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save
break
end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save
break
end
_save1 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
self.pos = _save1
unless _tmp
@@ -9634,59 +9557,12 @@ class RDoc::Markdown
self.pos = _save5
break
end
-
- _save6 = self.pos
- while true # choice
-
- _save7 = self.pos
- while true # sequence
- _tmp = match_string("===")
- unless _tmp
- self.pos = _save7
- break
- end
- while true
- _tmp = match_string("=")
- break unless _tmp
- end
- _tmp = true
- unless _tmp
- self.pos = _save7
- end
- break
- end # end sequence
-
- break if _tmp
- self.pos = _save6
-
- _save9 = self.pos
- while true # sequence
- _tmp = match_string("---")
- unless _tmp
- self.pos = _save9
- break
- end
- while true
- _tmp = match_string("-")
- break unless _tmp
- end
- _tmp = true
- unless _tmp
- self.pos = _save9
- end
- break
- end # end sequence
-
- break if _tmp
- self.pos = _save6
- break
- end # end choice
-
+ _tmp = scan(/\A(?-mix:={3,}|-{3,}=)/)
unless _tmp
self.pos = _save5
break
end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save5
end
@@ -9711,22 +9587,22 @@ class RDoc::Markdown
return _tmp
end
- # TerminalEndline = Sp Newline Eof
+ # TerminalEndline = @Sp @Newline @Eof
def _TerminalEndline
_save = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save
break
end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save
break
end
- _tmp = apply(:_Eof)
+ _tmp = _Eof()
unless _tmp
self.pos = _save
end
@@ -9737,7 +9613,7 @@ class RDoc::Markdown
return _tmp
end
- # LineBreak = " " NormalEndline { RDoc::Markup::HardBreak.new }
+ # LineBreak = " " @NormalEndline { RDoc::Markup::HardBreak.new }
def _LineBreak
_save = self.pos
@@ -9747,7 +9623,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_NormalEndline)
+ _tmp = _NormalEndline()
unless _tmp
self.pos = _save
break
@@ -9764,13 +9640,13 @@ class RDoc::Markdown
return _tmp
end
- # Symbol = < SpecialChar > { text }
+ # Symbol = < @SpecialChar > { text }
def _Symbol
_save = self.pos
while true # sequence
_text_start = self.pos
- _tmp = apply(:_SpecialChar)
+ _tmp = _SpecialChar()
if _tmp
text = get_text(_text_start)
end
@@ -9824,7 +9700,7 @@ class RDoc::Markdown
return _tmp
end
- # StarLine = (< "****" "*"* > { text } | < Spacechar "*"+ &Spacechar > { text })
+ # StarLine = (< /\*{4,}/ > { text } | < @Spacechar /\*+/ &@Spacechar > { text })
def _StarLine
_save = self.pos
@@ -9833,25 +9709,7 @@ class RDoc::Markdown
_save1 = self.pos
while true # sequence
_text_start = self.pos
-
- _save2 = self.pos
- while true # sequence
- _tmp = match_string("****")
- unless _tmp
- self.pos = _save2
- break
- end
- while true
- _tmp = match_string("*")
- break unless _tmp
- end
- _tmp = true
- unless _tmp
- self.pos = _save2
- end
- break
- end # end sequence
-
+ _tmp = scan(/\A(?-mix:\*{4,})/)
if _tmp
text = get_text(_text_start)
end
@@ -9870,37 +9728,27 @@ class RDoc::Markdown
break if _tmp
self.pos = _save
- _save4 = self.pos
+ _save2 = self.pos
while true # sequence
_text_start = self.pos
- _save5 = self.pos
+ _save3 = self.pos
while true # sequence
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
unless _tmp
- self.pos = _save5
+ self.pos = _save3
break
end
- _save6 = self.pos
- _tmp = match_string("*")
- if _tmp
- while true
- _tmp = match_string("*")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save6
- end
+ _tmp = scan(/\A(?-mix:\*+)/)
unless _tmp
- self.pos = _save5
+ self.pos = _save3
break
end
- _save7 = self.pos
- _tmp = apply(:_Spacechar)
- self.pos = _save7
+ _save4 = self.pos
+ _tmp = _Spacechar()
+ self.pos = _save4
unless _tmp
- self.pos = _save5
+ self.pos = _save3
end
break
end # end sequence
@@ -9909,13 +9757,13 @@ class RDoc::Markdown
text = get_text(_text_start)
end
unless _tmp
- self.pos = _save4
+ self.pos = _save2
break
end
@result = begin; text ; end
_tmp = true
unless _tmp
- self.pos = _save4
+ self.pos = _save2
end
break
end # end sequence
@@ -9929,7 +9777,7 @@ class RDoc::Markdown
return _tmp
end
- # UlLine = (< "____" "_"* > { text } | < Spacechar "_"+ &Spacechar > { text })
+ # UlLine = (< /_{4,}/ > { text } | < @Spacechar /_+/ &@Spacechar > { text })
def _UlLine
_save = self.pos
@@ -9938,25 +9786,7 @@ class RDoc::Markdown
_save1 = self.pos
while true # sequence
_text_start = self.pos
-
- _save2 = self.pos
- while true # sequence
- _tmp = match_string("____")
- unless _tmp
- self.pos = _save2
- break
- end
- while true
- _tmp = match_string("_")
- break unless _tmp
- end
- _tmp = true
- unless _tmp
- self.pos = _save2
- end
- break
- end # end sequence
-
+ _tmp = scan(/\A(?-mix:_{4,})/)
if _tmp
text = get_text(_text_start)
end
@@ -9975,37 +9805,27 @@ class RDoc::Markdown
break if _tmp
self.pos = _save
- _save4 = self.pos
+ _save2 = self.pos
while true # sequence
_text_start = self.pos
- _save5 = self.pos
+ _save3 = self.pos
while true # sequence
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
unless _tmp
- self.pos = _save5
+ self.pos = _save3
break
end
- _save6 = self.pos
- _tmp = match_string("_")
- if _tmp
- while true
- _tmp = match_string("_")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save6
- end
+ _tmp = scan(/\A(?-mix:_+)/)
unless _tmp
- self.pos = _save5
+ self.pos = _save3
break
end
- _save7 = self.pos
- _tmp = apply(:_Spacechar)
- self.pos = _save7
+ _save4 = self.pos
+ _tmp = _Spacechar()
+ self.pos = _save4
unless _tmp
- self.pos = _save5
+ self.pos = _save3
end
break
end # end sequence
@@ -10014,13 +9834,13 @@ class RDoc::Markdown
text = get_text(_text_start)
end
unless _tmp
- self.pos = _save4
+ self.pos = _save2
break
end
@result = begin; text ; end
_tmp = true
unless _tmp
- self.pos = _save4
+ self.pos = _save2
end
break
end # end sequence
@@ -10052,7 +9872,7 @@ class RDoc::Markdown
return _tmp
end
- # OneStarOpen = !StarLine "*" !Spacechar !Newline
+ # OneStarOpen = !StarLine "*" !@Spacechar !@Newline
def _OneStarOpen
_save = self.pos
@@ -10071,7 +9891,7 @@ class RDoc::Markdown
break
end
_save2 = self.pos
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
_tmp = _tmp ? nil : true
self.pos = _save2
unless _tmp
@@ -10079,7 +9899,7 @@ class RDoc::Markdown
break
end
_save3 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save3
unless _tmp
@@ -10092,13 +9912,13 @@ class RDoc::Markdown
return _tmp
end
- # OneStarClose = !Spacechar !Newline Inline:a "*" { a }
+ # OneStarClose = !@Spacechar !@Newline Inline:a "*" { a }
def _OneStarClose
_save = self.pos
while true # sequence
_save1 = self.pos
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
_tmp = _tmp ? nil : true
self.pos = _save1
unless _tmp
@@ -10106,7 +9926,7 @@ class RDoc::Markdown
break
end
_save2 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save2
unless _tmp
@@ -10136,7 +9956,7 @@ class RDoc::Markdown
return _tmp
end
- # EmphStar = OneStarOpen StartList:a (!OneStarClose Inline:l { a << l })* OneStarClose:l { a << l } { emphasis a.join }
+ # EmphStar = OneStarOpen @StartList:a (!OneStarClose Inline:l { a << l })* OneStarClose:l { a << l } { emphasis a.join }
def _EmphStar
_save = self.pos
@@ -10146,7 +9966,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_StartList)
+ _tmp = _StartList()
a = @result
unless _tmp
self.pos = _save
@@ -10209,7 +10029,7 @@ class RDoc::Markdown
return _tmp
end
- # OneUlOpen = !UlLine "_" !Spacechar !Newline
+ # OneUlOpen = !UlLine "_" !@Spacechar !@Newline
def _OneUlOpen
_save = self.pos
@@ -10228,7 +10048,7 @@ class RDoc::Markdown
break
end
_save2 = self.pos
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
_tmp = _tmp ? nil : true
self.pos = _save2
unless _tmp
@@ -10236,7 +10056,7 @@ class RDoc::Markdown
break
end
_save3 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save3
unless _tmp
@@ -10249,13 +10069,13 @@ class RDoc::Markdown
return _tmp
end
- # OneUlClose = !Spacechar !Newline Inline:a "_" { a }
+ # OneUlClose = !@Spacechar !@Newline Inline:a "_" { a }
def _OneUlClose
_save = self.pos
while true # sequence
_save1 = self.pos
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
_tmp = _tmp ? nil : true
self.pos = _save1
unless _tmp
@@ -10263,7 +10083,7 @@ class RDoc::Markdown
break
end
_save2 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save2
unless _tmp
@@ -10293,7 +10113,7 @@ class RDoc::Markdown
return _tmp
end
- # EmphUl = OneUlOpen StartList:a (!OneUlClose Inline:l { a << l })* OneUlClose:l { a << l } { emphasis a.join }
+ # EmphUl = OneUlOpen @StartList:a (!OneUlClose Inline:l { a << l })* OneUlClose:l { a << l } { emphasis a.join }
def _EmphUl
_save = self.pos
@@ -10303,7 +10123,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_StartList)
+ _tmp = _StartList()
a = @result
unless _tmp
self.pos = _save
@@ -10384,7 +10204,7 @@ class RDoc::Markdown
return _tmp
end
- # TwoStarOpen = !StarLine "**" !Spacechar !Newline
+ # TwoStarOpen = !StarLine "**" !@Spacechar !@Newline
def _TwoStarOpen
_save = self.pos
@@ -10403,7 +10223,7 @@ class RDoc::Markdown
break
end
_save2 = self.pos
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
_tmp = _tmp ? nil : true
self.pos = _save2
unless _tmp
@@ -10411,7 +10231,7 @@ class RDoc::Markdown
break
end
_save3 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save3
unless _tmp
@@ -10424,13 +10244,13 @@ class RDoc::Markdown
return _tmp
end
- # TwoStarClose = !Spacechar !Newline Inline:a "**" { a }
+ # TwoStarClose = !@Spacechar !@Newline Inline:a "**" { a }
def _TwoStarClose
_save = self.pos
while true # sequence
_save1 = self.pos
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
_tmp = _tmp ? nil : true
self.pos = _save1
unless _tmp
@@ -10438,7 +10258,7 @@ class RDoc::Markdown
break
end
_save2 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save2
unless _tmp
@@ -10468,7 +10288,7 @@ class RDoc::Markdown
return _tmp
end
- # StrongStar = TwoStarOpen StartList:a (!TwoStarClose Inline:l { a << l })* TwoStarClose:l { a << l } { strong a.join }
+ # StrongStar = TwoStarOpen @StartList:a (!TwoStarClose Inline:l { a << l })* TwoStarClose:l { a << l } { strong a.join }
def _StrongStar
_save = self.pos
@@ -10478,7 +10298,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_StartList)
+ _tmp = _StartList()
a = @result
unless _tmp
self.pos = _save
@@ -10541,7 +10361,7 @@ class RDoc::Markdown
return _tmp
end
- # TwoUlOpen = !UlLine "__" !Spacechar !Newline
+ # TwoUlOpen = !UlLine "__" !@Spacechar !@Newline
def _TwoUlOpen
_save = self.pos
@@ -10560,7 +10380,7 @@ class RDoc::Markdown
break
end
_save2 = self.pos
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
_tmp = _tmp ? nil : true
self.pos = _save2
unless _tmp
@@ -10568,7 +10388,7 @@ class RDoc::Markdown
break
end
_save3 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save3
unless _tmp
@@ -10581,13 +10401,13 @@ class RDoc::Markdown
return _tmp
end
- # TwoUlClose = !Spacechar !Newline Inline:a "__" { a }
+ # TwoUlClose = !@Spacechar !@Newline Inline:a "__" { a }
def _TwoUlClose
_save = self.pos
while true # sequence
_save1 = self.pos
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
_tmp = _tmp ? nil : true
self.pos = _save1
unless _tmp
@@ -10595,7 +10415,7 @@ class RDoc::Markdown
break
end
_save2 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save2
unless _tmp
@@ -10625,7 +10445,7 @@ class RDoc::Markdown
return _tmp
end
- # StrongUl = TwoUlOpen StartList:a (!TwoUlClose Inline:i { a << i })* TwoUlClose:l { a << l } { strong a.join }
+ # StrongUl = TwoUlOpen @StartList:a (!TwoUlClose Inline:i { a << i })* TwoUlClose:l { a << l } { strong a.join }
def _StrongUl
_save = self.pos
@@ -10635,7 +10455,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_StartList)
+ _tmp = _StartList()
a = @result
unless _tmp
self.pos = _save
@@ -10698,7 +10518,7 @@ class RDoc::Markdown
return _tmp
end
- # Image = "!" (ExplicitLink | ReferenceLink):a { a }
+ # Image = "!" (ExplicitLink | ReferenceLink):a { "rdoc-image:#{a[/\[(.*)\]/, 1]}" }
def _Image
_save = self.pos
@@ -10725,7 +10545,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- @result = begin; a ; end
+ @result = begin; "rdoc-image:#{a[/\[(.*)\]/, 1]}" ; end
_tmp = true
unless _tmp
self.pos = _save
@@ -10873,7 +10693,7 @@ class RDoc::Markdown
return _tmp
end
- # ExplicitLink = Label:l Spnl "(" Sp Source:s Spnl Title Sp ")" { "{#{l}}[#{s}]" }
+ # ExplicitLink = Label:l Spnl "(" @Sp Source:s Spnl Title @Sp ")" { "{#{l}}[#{s}]" }
def _ExplicitLink
_save = self.pos
@@ -10894,7 +10714,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save
break
@@ -10915,7 +10735,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save
break
@@ -11162,7 +10982,7 @@ class RDoc::Markdown
return _tmp
end
- # TitleSingle = "'" (!("'" Sp (")" | Newline)) .)* "'"
+ # TitleSingle = "'" (!("'" @Sp (")" | @Newline)) .)* "'"
def _TitleSingle
_save = self.pos
@@ -11185,7 +11005,7 @@ class RDoc::Markdown
self.pos = _save4
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save4
break
@@ -11196,7 +11016,7 @@ class RDoc::Markdown
_tmp = match_string(")")
break if _tmp
self.pos = _save5
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
break if _tmp
self.pos = _save5
break
@@ -11239,7 +11059,7 @@ class RDoc::Markdown
return _tmp
end
- # TitleDouble = "\"" (!("\"" Sp (")" | Newline)) .)* "\""
+ # TitleDouble = "\"" (!("\"" @Sp (")" | @Newline)) .)* "\""
def _TitleDouble
_save = self.pos
@@ -11262,7 +11082,7 @@ class RDoc::Markdown
self.pos = _save4
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save4
break
@@ -11273,7 +11093,7 @@ class RDoc::Markdown
_tmp = match_string(")")
break if _tmp
self.pos = _save5
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
break if _tmp
self.pos = _save5
break
@@ -11334,7 +11154,7 @@ class RDoc::Markdown
return _tmp
end
- # AutoLinkUrl = "<" < /[A-Za-z]+/ "://" (!Newline !">" .)+ > ">" { text }
+ # AutoLinkUrl = "<" < /[A-Za-z]+/ "://" (!@Newline !">" .)+ > ">" { text }
def _AutoLinkUrl
_save = self.pos
@@ -11363,7 +11183,7 @@ class RDoc::Markdown
_save3 = self.pos
while true # sequence
_save4 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save4
unless _tmp
@@ -11391,7 +11211,7 @@ class RDoc::Markdown
_save6 = self.pos
while true # sequence
_save7 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save7
unless _tmp
@@ -11449,7 +11269,7 @@ class RDoc::Markdown
return _tmp
end
- # AutoLinkEmail = "<" "mailto:"? < /[\w+.\/!%~$-]+/i "@" (!Newline !">" .)+ > ">" { "mailto:#{text}" }
+ # AutoLinkEmail = "<" "mailto:"? < /[\w+.\/!%~$-]+/i "@" (!@Newline !">" .)+ > ">" { "mailto:#{text}" }
def _AutoLinkEmail
_save = self.pos
@@ -11488,7 +11308,7 @@ class RDoc::Markdown
_save4 = self.pos
while true # sequence
_save5 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save5
unless _tmp
@@ -11516,7 +11336,7 @@ class RDoc::Markdown
_save7 = self.pos
while true # sequence
_save8 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save8
unless _tmp
@@ -11574,12 +11394,12 @@ class RDoc::Markdown
return _tmp
end
- # Reference = NonindentSpace !"[]" Label:label ":" Spnl RefSrc:link RefTitle BlankLine+ { # TODO use title reference label, link nil }
+ # Reference = @NonindentSpace !"[]" Label:label ":" Spnl RefSrc:link RefTitle @BlankLine+ { # TODO use title reference label, link nil }
def _Reference
_save = self.pos
while true # sequence
- _tmp = apply(:_NonindentSpace)
+ _tmp = _NonindentSpace()
unless _tmp
self.pos = _save
break
@@ -11620,10 +11440,10 @@ class RDoc::Markdown
break
end
_save2 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
if _tmp
while true
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
break unless _tmp
end
_tmp = true
@@ -11649,7 +11469,7 @@ class RDoc::Markdown
return _tmp
end
- # Label = "[" (!"^" &{ notes? } | &. &{ !notes? }) StartList:a (!"]" Inline:l { a << l })* "]" { a.join.gsub(/\s+/, ' ') }
+ # Label = "[" (!"^" &{ notes? } | &. &{ !notes? }) @StartList:a (!"]" Inline:l { a << l })* "]" { a.join.gsub(/\s+/, ' ') }
def _Label
_save = self.pos
@@ -11712,7 +11532,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_StartList)
+ _tmp = _StartList()
a = @result
unless _tmp
self.pos = _save
@@ -11835,7 +11655,7 @@ class RDoc::Markdown
return _tmp
end
- # RefTitleSingle = Spnl "'" < (!("'" Sp Newline | Newline) .)* > "'" { text }
+ # RefTitleSingle = Spnl "'" < (!("'" @Sp @Newline | @Newline) .)* > "'" { text }
def _RefTitleSingle
_save = self.pos
@@ -11867,12 +11687,12 @@ class RDoc::Markdown
self.pos = _save5
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save5
break
end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save5
end
@@ -11881,7 +11701,7 @@ class RDoc::Markdown
break if _tmp
self.pos = _save4
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
break if _tmp
self.pos = _save4
break
@@ -11927,7 +11747,7 @@ class RDoc::Markdown
return _tmp
end
- # RefTitleDouble = Spnl "\"" < (!("\"" Sp Newline | Newline) .)* > "\"" { text }
+ # RefTitleDouble = Spnl "\"" < (!("\"" @Sp @Newline | @Newline) .)* > "\"" { text }
def _RefTitleDouble
_save = self.pos
@@ -11959,12 +11779,12 @@ class RDoc::Markdown
self.pos = _save5
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save5
break
end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save5
end
@@ -11973,7 +11793,7 @@ class RDoc::Markdown
break if _tmp
self.pos = _save4
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
break if _tmp
self.pos = _save4
break
@@ -12019,7 +11839,7 @@ class RDoc::Markdown
return _tmp
end
- # RefTitleParens = Spnl "(" < (!(")" Sp Newline | Newline) .)* > ")" { text }
+ # RefTitleParens = Spnl "(" < (!(")" @Sp @Newline | @Newline) .)* > ")" { text }
def _RefTitleParens
_save = self.pos
@@ -12051,12 +11871,12 @@ class RDoc::Markdown
self.pos = _save5
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save5
break
end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save5
end
@@ -12065,7 +11885,7 @@ class RDoc::Markdown
break if _tmp
self.pos = _save4
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
break if _tmp
self.pos = _save4
break
@@ -12253,7 +12073,7 @@ class RDoc::Markdown
return _tmp
end
- # Code = (Ticks1 Sp < ((!"`" Nonspacechar)+ | !Ticks1 "`"+ | !(Sp Ticks1) (Spacechar | Newline !BlankLine))+ > Sp Ticks1 | Ticks2 Sp < ((!"`" Nonspacechar)+ | !Ticks2 "`"+ | !(Sp Ticks2) (Spacechar | Newline !BlankLine))+ > Sp Ticks2 | Ticks3 Sp < ((!"`" Nonspacechar)+ | !Ticks3 "`"+ | !(Sp Ticks3) (Spacechar | Newline !BlankLine))+ > Sp Ticks3 | Ticks4 Sp < ((!"`" Nonspacechar)+ | !Ticks4 "`"+ | !(Sp Ticks4) (Spacechar | Newline !BlankLine))+ > Sp Ticks4 | Ticks5 Sp < ((!"`" Nonspacechar)+ | !Ticks5 "`"+ | !(Sp Ticks5) (Spacechar | Newline !BlankLine))+ > Sp Ticks5) { "<code>#{text}</code>" }
+ # Code = (Ticks1 @Sp < ((!"`" Nonspacechar)+ | !Ticks1 /`+/ | !(@Sp Ticks1) (@Spacechar | @Newline !@BlankLine))+ > @Sp Ticks1 | Ticks2 @Sp < ((!"`" Nonspacechar)+ | !Ticks2 /`+/ | !(@Sp Ticks2) (@Spacechar | @Newline !@BlankLine))+ > @Sp Ticks2 | Ticks3 @Sp < ((!"`" Nonspacechar)+ | !Ticks3 /`+/ | !(@Sp Ticks3) (@Spacechar | @Newline !@BlankLine))+ > @Sp Ticks3 | Ticks4 @Sp < ((!"`" Nonspacechar)+ | !Ticks4 /`+/ | !(@Sp Ticks4) (@Spacechar | @Newline !@BlankLine))+ > @Sp Ticks4 | Ticks5 @Sp < ((!"`" Nonspacechar)+ | !Ticks5 /`+/ | !(@Sp Ticks5) (@Spacechar | @Newline !@BlankLine))+ > @Sp Ticks5) { "<code>#{text}</code>" }
def _Code
_save = self.pos
@@ -12269,7 +12089,7 @@ class RDoc::Markdown
self.pos = _save2
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save2
break
@@ -12337,17 +12157,7 @@ class RDoc::Markdown
self.pos = _save10
break
end
- _save12 = self.pos
- _tmp = match_string("`")
- if _tmp
- while true
- _tmp = match_string("`")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save12
- end
+ _tmp = scan(/\A(?-mix:`+)/)
unless _tmp
self.pos = _save10
end
@@ -12357,61 +12167,61 @@ class RDoc::Markdown
break if _tmp
self.pos = _save4
- _save13 = self.pos
+ _save12 = self.pos
while true # sequence
- _save14 = self.pos
+ _save13 = self.pos
- _save15 = self.pos
+ _save14 = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save15
+ self.pos = _save14
break
end
_tmp = apply(:_Ticks1)
unless _tmp
- self.pos = _save15
+ self.pos = _save14
end
break
end # end sequence
_tmp = _tmp ? nil : true
- self.pos = _save14
+ self.pos = _save13
unless _tmp
- self.pos = _save13
+ self.pos = _save12
break
end
- _save16 = self.pos
+ _save15 = self.pos
while true # choice
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
break if _tmp
- self.pos = _save16
+ self.pos = _save15
- _save17 = self.pos
+ _save16 = self.pos
while true # sequence
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
- self.pos = _save17
+ self.pos = _save16
break
end
- _save18 = self.pos
- _tmp = apply(:_BlankLine)
+ _save17 = self.pos
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
- self.pos = _save18
+ self.pos = _save17
unless _tmp
- self.pos = _save17
+ self.pos = _save16
end
break
end # end sequence
break if _tmp
- self.pos = _save16
+ self.pos = _save15
break
end # end choice
unless _tmp
- self.pos = _save13
+ self.pos = _save12
end
break
end # end sequence
@@ -12424,23 +12234,23 @@ class RDoc::Markdown
if _tmp
while true
- _save19 = self.pos
+ _save18 = self.pos
while true # choice
- _save20 = self.pos
+ _save19 = self.pos
- _save21 = self.pos
+ _save20 = self.pos
while true # sequence
- _save22 = self.pos
+ _save21 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save22
+ self.pos = _save21
unless _tmp
- self.pos = _save21
+ self.pos = _save20
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save21
+ self.pos = _save20
end
break
end # end sequence
@@ -12448,19 +12258,19 @@ class RDoc::Markdown
if _tmp
while true
- _save23 = self.pos
+ _save22 = self.pos
while true # sequence
- _save24 = self.pos
+ _save23 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save24
+ self.pos = _save23
unless _tmp
- self.pos = _save23
+ self.pos = _save22
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save23
+ self.pos = _save22
end
break
end # end sequence
@@ -12469,102 +12279,92 @@ class RDoc::Markdown
end
_tmp = true
else
- self.pos = _save20
+ self.pos = _save19
end
break if _tmp
- self.pos = _save19
+ self.pos = _save18
- _save25 = self.pos
+ _save24 = self.pos
while true # sequence
- _save26 = self.pos
+ _save25 = self.pos
_tmp = apply(:_Ticks1)
_tmp = _tmp ? nil : true
- self.pos = _save26
+ self.pos = _save25
unless _tmp
- self.pos = _save25
+ self.pos = _save24
break
end
- _save27 = self.pos
- _tmp = match_string("`")
- if _tmp
- while true
- _tmp = match_string("`")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save27
- end
+ _tmp = scan(/\A(?-mix:`+)/)
unless _tmp
- self.pos = _save25
+ self.pos = _save24
end
break
end # end sequence
break if _tmp
- self.pos = _save19
+ self.pos = _save18
- _save28 = self.pos
+ _save26 = self.pos
while true # sequence
- _save29 = self.pos
+ _save27 = self.pos
- _save30 = self.pos
+ _save28 = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save30
+ self.pos = _save28
break
end
_tmp = apply(:_Ticks1)
unless _tmp
- self.pos = _save30
+ self.pos = _save28
end
break
end # end sequence
_tmp = _tmp ? nil : true
- self.pos = _save29
+ self.pos = _save27
unless _tmp
- self.pos = _save28
+ self.pos = _save26
break
end
- _save31 = self.pos
+ _save29 = self.pos
while true # choice
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
break if _tmp
- self.pos = _save31
+ self.pos = _save29
- _save32 = self.pos
+ _save30 = self.pos
while true # sequence
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
- self.pos = _save32
+ self.pos = _save30
break
end
- _save33 = self.pos
- _tmp = apply(:_BlankLine)
+ _save31 = self.pos
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
- self.pos = _save33
+ self.pos = _save31
unless _tmp
- self.pos = _save32
+ self.pos = _save30
end
break
end # end sequence
break if _tmp
- self.pos = _save31
+ self.pos = _save29
break
end # end choice
unless _tmp
- self.pos = _save28
+ self.pos = _save26
end
break
end # end sequence
break if _tmp
- self.pos = _save19
+ self.pos = _save18
break
end # end choice
@@ -12581,7 +12381,7 @@ class RDoc::Markdown
self.pos = _save2
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save2
break
@@ -12596,38 +12396,38 @@ class RDoc::Markdown
break if _tmp
self.pos = _save1
- _save34 = self.pos
+ _save32 = self.pos
while true # sequence
_tmp = apply(:_Ticks2)
unless _tmp
- self.pos = _save34
+ self.pos = _save32
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save34
+ self.pos = _save32
break
end
_text_start = self.pos
- _save35 = self.pos
+ _save33 = self.pos
- _save36 = self.pos
+ _save34 = self.pos
while true # choice
- _save37 = self.pos
+ _save35 = self.pos
- _save38 = self.pos
+ _save36 = self.pos
while true # sequence
- _save39 = self.pos
+ _save37 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save39
+ self.pos = _save37
unless _tmp
- self.pos = _save38
+ self.pos = _save36
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save38
+ self.pos = _save36
end
break
end # end sequence
@@ -12635,19 +12435,19 @@ class RDoc::Markdown
if _tmp
while true
- _save40 = self.pos
+ _save38 = self.pos
while true # sequence
- _save41 = self.pos
+ _save39 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save41
+ self.pos = _save39
unless _tmp
- self.pos = _save40
+ self.pos = _save38
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save40
+ self.pos = _save38
end
break
end # end sequence
@@ -12656,125 +12456,115 @@ class RDoc::Markdown
end
_tmp = true
else
- self.pos = _save37
+ self.pos = _save35
end
break if _tmp
- self.pos = _save36
+ self.pos = _save34
- _save42 = self.pos
+ _save40 = self.pos
while true # sequence
- _save43 = self.pos
+ _save41 = self.pos
_tmp = apply(:_Ticks2)
_tmp = _tmp ? nil : true
- self.pos = _save43
+ self.pos = _save41
unless _tmp
- self.pos = _save42
+ self.pos = _save40
break
end
- _save44 = self.pos
- _tmp = match_string("`")
- if _tmp
- while true
- _tmp = match_string("`")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save44
- end
+ _tmp = scan(/\A(?-mix:`+)/)
unless _tmp
- self.pos = _save42
+ self.pos = _save40
end
break
end # end sequence
break if _tmp
- self.pos = _save36
+ self.pos = _save34
- _save45 = self.pos
+ _save42 = self.pos
while true # sequence
- _save46 = self.pos
+ _save43 = self.pos
- _save47 = self.pos
+ _save44 = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save47
+ self.pos = _save44
break
end
_tmp = apply(:_Ticks2)
unless _tmp
- self.pos = _save47
+ self.pos = _save44
end
break
end # end sequence
_tmp = _tmp ? nil : true
- self.pos = _save46
+ self.pos = _save43
unless _tmp
- self.pos = _save45
+ self.pos = _save42
break
end
- _save48 = self.pos
+ _save45 = self.pos
while true # choice
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
break if _tmp
- self.pos = _save48
+ self.pos = _save45
- _save49 = self.pos
+ _save46 = self.pos
while true # sequence
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
- self.pos = _save49
+ self.pos = _save46
break
end
- _save50 = self.pos
- _tmp = apply(:_BlankLine)
+ _save47 = self.pos
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
- self.pos = _save50
+ self.pos = _save47
unless _tmp
- self.pos = _save49
+ self.pos = _save46
end
break
end # end sequence
break if _tmp
- self.pos = _save48
+ self.pos = _save45
break
end # end choice
unless _tmp
- self.pos = _save45
+ self.pos = _save42
end
break
end # end sequence
break if _tmp
- self.pos = _save36
+ self.pos = _save34
break
end # end choice
if _tmp
while true
- _save51 = self.pos
+ _save48 = self.pos
while true # choice
- _save52 = self.pos
+ _save49 = self.pos
- _save53 = self.pos
+ _save50 = self.pos
while true # sequence
- _save54 = self.pos
+ _save51 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save54
+ self.pos = _save51
unless _tmp
- self.pos = _save53
+ self.pos = _save50
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save53
+ self.pos = _save50
end
break
end # end sequence
@@ -12782,19 +12572,19 @@ class RDoc::Markdown
if _tmp
while true
- _save55 = self.pos
+ _save52 = self.pos
while true # sequence
- _save56 = self.pos
+ _save53 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save56
+ self.pos = _save53
unless _tmp
- self.pos = _save55
+ self.pos = _save52
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save55
+ self.pos = _save52
end
break
end # end sequence
@@ -12803,102 +12593,92 @@ class RDoc::Markdown
end
_tmp = true
else
- self.pos = _save52
+ self.pos = _save49
end
break if _tmp
- self.pos = _save51
+ self.pos = _save48
- _save57 = self.pos
+ _save54 = self.pos
while true # sequence
- _save58 = self.pos
+ _save55 = self.pos
_tmp = apply(:_Ticks2)
_tmp = _tmp ? nil : true
- self.pos = _save58
+ self.pos = _save55
unless _tmp
- self.pos = _save57
+ self.pos = _save54
break
end
- _save59 = self.pos
- _tmp = match_string("`")
- if _tmp
- while true
- _tmp = match_string("`")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save59
- end
+ _tmp = scan(/\A(?-mix:`+)/)
unless _tmp
- self.pos = _save57
+ self.pos = _save54
end
break
end # end sequence
break if _tmp
- self.pos = _save51
+ self.pos = _save48
- _save60 = self.pos
+ _save56 = self.pos
while true # sequence
- _save61 = self.pos
+ _save57 = self.pos
- _save62 = self.pos
+ _save58 = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save62
+ self.pos = _save58
break
end
_tmp = apply(:_Ticks2)
unless _tmp
- self.pos = _save62
+ self.pos = _save58
end
break
end # end sequence
_tmp = _tmp ? nil : true
- self.pos = _save61
+ self.pos = _save57
unless _tmp
- self.pos = _save60
+ self.pos = _save56
break
end
- _save63 = self.pos
+ _save59 = self.pos
while true # choice
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
break if _tmp
- self.pos = _save63
+ self.pos = _save59
- _save64 = self.pos
+ _save60 = self.pos
while true # sequence
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
- self.pos = _save64
+ self.pos = _save60
break
end
- _save65 = self.pos
- _tmp = apply(:_BlankLine)
+ _save61 = self.pos
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
- self.pos = _save65
+ self.pos = _save61
unless _tmp
- self.pos = _save64
+ self.pos = _save60
end
break
end # end sequence
break if _tmp
- self.pos = _save63
+ self.pos = _save59
break
end # end choice
unless _tmp
- self.pos = _save60
+ self.pos = _save56
end
break
end # end sequence
break if _tmp
- self.pos = _save51
+ self.pos = _save48
break
end # end choice
@@ -12906,23 +12686,23 @@ class RDoc::Markdown
end
_tmp = true
else
- self.pos = _save35
+ self.pos = _save33
end
if _tmp
text = get_text(_text_start)
end
unless _tmp
- self.pos = _save34
+ self.pos = _save32
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save34
+ self.pos = _save32
break
end
_tmp = apply(:_Ticks2)
unless _tmp
- self.pos = _save34
+ self.pos = _save32
end
break
end # end sequence
@@ -12930,38 +12710,38 @@ class RDoc::Markdown
break if _tmp
self.pos = _save1
- _save66 = self.pos
+ _save62 = self.pos
while true # sequence
_tmp = apply(:_Ticks3)
unless _tmp
- self.pos = _save66
+ self.pos = _save62
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save66
+ self.pos = _save62
break
end
_text_start = self.pos
- _save67 = self.pos
+ _save63 = self.pos
- _save68 = self.pos
+ _save64 = self.pos
while true # choice
- _save69 = self.pos
+ _save65 = self.pos
- _save70 = self.pos
+ _save66 = self.pos
while true # sequence
- _save71 = self.pos
+ _save67 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save71
+ self.pos = _save67
unless _tmp
- self.pos = _save70
+ self.pos = _save66
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save70
+ self.pos = _save66
end
break
end # end sequence
@@ -12969,19 +12749,19 @@ class RDoc::Markdown
if _tmp
while true
- _save72 = self.pos
+ _save68 = self.pos
while true # sequence
- _save73 = self.pos
+ _save69 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save73
+ self.pos = _save69
unless _tmp
- self.pos = _save72
+ self.pos = _save68
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save72
+ self.pos = _save68
end
break
end # end sequence
@@ -12990,125 +12770,115 @@ class RDoc::Markdown
end
_tmp = true
else
- self.pos = _save69
+ self.pos = _save65
end
break if _tmp
- self.pos = _save68
+ self.pos = _save64
- _save74 = self.pos
+ _save70 = self.pos
while true # sequence
- _save75 = self.pos
+ _save71 = self.pos
_tmp = apply(:_Ticks3)
_tmp = _tmp ? nil : true
- self.pos = _save75
+ self.pos = _save71
unless _tmp
- self.pos = _save74
+ self.pos = _save70
break
end
- _save76 = self.pos
- _tmp = match_string("`")
- if _tmp
- while true
- _tmp = match_string("`")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save76
- end
+ _tmp = scan(/\A(?-mix:`+)/)
unless _tmp
- self.pos = _save74
+ self.pos = _save70
end
break
end # end sequence
break if _tmp
- self.pos = _save68
+ self.pos = _save64
- _save77 = self.pos
+ _save72 = self.pos
while true # sequence
- _save78 = self.pos
+ _save73 = self.pos
- _save79 = self.pos
+ _save74 = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save79
+ self.pos = _save74
break
end
_tmp = apply(:_Ticks3)
unless _tmp
- self.pos = _save79
+ self.pos = _save74
end
break
end # end sequence
_tmp = _tmp ? nil : true
- self.pos = _save78
+ self.pos = _save73
unless _tmp
- self.pos = _save77
+ self.pos = _save72
break
end
- _save80 = self.pos
+ _save75 = self.pos
while true # choice
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
break if _tmp
- self.pos = _save80
+ self.pos = _save75
- _save81 = self.pos
+ _save76 = self.pos
while true # sequence
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
- self.pos = _save81
+ self.pos = _save76
break
end
- _save82 = self.pos
- _tmp = apply(:_BlankLine)
+ _save77 = self.pos
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
- self.pos = _save82
+ self.pos = _save77
unless _tmp
- self.pos = _save81
+ self.pos = _save76
end
break
end # end sequence
break if _tmp
- self.pos = _save80
+ self.pos = _save75
break
end # end choice
unless _tmp
- self.pos = _save77
+ self.pos = _save72
end
break
end # end sequence
break if _tmp
- self.pos = _save68
+ self.pos = _save64
break
end # end choice
if _tmp
while true
- _save83 = self.pos
+ _save78 = self.pos
while true # choice
- _save84 = self.pos
+ _save79 = self.pos
- _save85 = self.pos
+ _save80 = self.pos
while true # sequence
- _save86 = self.pos
+ _save81 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save86
+ self.pos = _save81
unless _tmp
- self.pos = _save85
+ self.pos = _save80
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save85
+ self.pos = _save80
end
break
end # end sequence
@@ -13116,19 +12886,19 @@ class RDoc::Markdown
if _tmp
while true
- _save87 = self.pos
+ _save82 = self.pos
while true # sequence
- _save88 = self.pos
+ _save83 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save88
+ self.pos = _save83
unless _tmp
- self.pos = _save87
+ self.pos = _save82
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save87
+ self.pos = _save82
end
break
end # end sequence
@@ -13137,102 +12907,92 @@ class RDoc::Markdown
end
_tmp = true
else
- self.pos = _save84
+ self.pos = _save79
end
break if _tmp
- self.pos = _save83
+ self.pos = _save78
- _save89 = self.pos
+ _save84 = self.pos
while true # sequence
- _save90 = self.pos
+ _save85 = self.pos
_tmp = apply(:_Ticks3)
_tmp = _tmp ? nil : true
- self.pos = _save90
+ self.pos = _save85
unless _tmp
- self.pos = _save89
+ self.pos = _save84
break
end
- _save91 = self.pos
- _tmp = match_string("`")
- if _tmp
- while true
- _tmp = match_string("`")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save91
- end
+ _tmp = scan(/\A(?-mix:`+)/)
unless _tmp
- self.pos = _save89
+ self.pos = _save84
end
break
end # end sequence
break if _tmp
- self.pos = _save83
+ self.pos = _save78
- _save92 = self.pos
+ _save86 = self.pos
while true # sequence
- _save93 = self.pos
+ _save87 = self.pos
- _save94 = self.pos
+ _save88 = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save94
+ self.pos = _save88
break
end
_tmp = apply(:_Ticks3)
unless _tmp
- self.pos = _save94
+ self.pos = _save88
end
break
end # end sequence
_tmp = _tmp ? nil : true
- self.pos = _save93
+ self.pos = _save87
unless _tmp
- self.pos = _save92
+ self.pos = _save86
break
end
- _save95 = self.pos
+ _save89 = self.pos
while true # choice
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
break if _tmp
- self.pos = _save95
+ self.pos = _save89
- _save96 = self.pos
+ _save90 = self.pos
while true # sequence
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
- self.pos = _save96
+ self.pos = _save90
break
end
- _save97 = self.pos
- _tmp = apply(:_BlankLine)
+ _save91 = self.pos
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
- self.pos = _save97
+ self.pos = _save91
unless _tmp
- self.pos = _save96
+ self.pos = _save90
end
break
end # end sequence
break if _tmp
- self.pos = _save95
+ self.pos = _save89
break
end # end choice
unless _tmp
- self.pos = _save92
+ self.pos = _save86
end
break
end # end sequence
break if _tmp
- self.pos = _save83
+ self.pos = _save78
break
end # end choice
@@ -13240,23 +13000,23 @@ class RDoc::Markdown
end
_tmp = true
else
- self.pos = _save67
+ self.pos = _save63
end
if _tmp
text = get_text(_text_start)
end
unless _tmp
- self.pos = _save66
+ self.pos = _save62
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save66
+ self.pos = _save62
break
end
_tmp = apply(:_Ticks3)
unless _tmp
- self.pos = _save66
+ self.pos = _save62
end
break
end # end sequence
@@ -13264,38 +13024,38 @@ class RDoc::Markdown
break if _tmp
self.pos = _save1
- _save98 = self.pos
+ _save92 = self.pos
while true # sequence
_tmp = apply(:_Ticks4)
unless _tmp
- self.pos = _save98
+ self.pos = _save92
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save98
+ self.pos = _save92
break
end
_text_start = self.pos
- _save99 = self.pos
+ _save93 = self.pos
- _save100 = self.pos
+ _save94 = self.pos
while true # choice
- _save101 = self.pos
+ _save95 = self.pos
- _save102 = self.pos
+ _save96 = self.pos
while true # sequence
- _save103 = self.pos
+ _save97 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save103
+ self.pos = _save97
unless _tmp
- self.pos = _save102
+ self.pos = _save96
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save102
+ self.pos = _save96
end
break
end # end sequence
@@ -13303,19 +13063,19 @@ class RDoc::Markdown
if _tmp
while true
- _save104 = self.pos
+ _save98 = self.pos
while true # sequence
- _save105 = self.pos
+ _save99 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save105
+ self.pos = _save99
unless _tmp
- self.pos = _save104
+ self.pos = _save98
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save104
+ self.pos = _save98
end
break
end # end sequence
@@ -13324,125 +13084,115 @@ class RDoc::Markdown
end
_tmp = true
else
- self.pos = _save101
+ self.pos = _save95
end
break if _tmp
- self.pos = _save100
+ self.pos = _save94
- _save106 = self.pos
+ _save100 = self.pos
while true # sequence
- _save107 = self.pos
+ _save101 = self.pos
_tmp = apply(:_Ticks4)
_tmp = _tmp ? nil : true
- self.pos = _save107
+ self.pos = _save101
unless _tmp
- self.pos = _save106
+ self.pos = _save100
break
end
- _save108 = self.pos
- _tmp = match_string("`")
- if _tmp
- while true
- _tmp = match_string("`")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save108
- end
+ _tmp = scan(/\A(?-mix:`+)/)
unless _tmp
- self.pos = _save106
+ self.pos = _save100
end
break
end # end sequence
break if _tmp
- self.pos = _save100
+ self.pos = _save94
- _save109 = self.pos
+ _save102 = self.pos
while true # sequence
- _save110 = self.pos
+ _save103 = self.pos
- _save111 = self.pos
+ _save104 = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save111
+ self.pos = _save104
break
end
_tmp = apply(:_Ticks4)
unless _tmp
- self.pos = _save111
+ self.pos = _save104
end
break
end # end sequence
_tmp = _tmp ? nil : true
- self.pos = _save110
+ self.pos = _save103
unless _tmp
- self.pos = _save109
+ self.pos = _save102
break
end
- _save112 = self.pos
+ _save105 = self.pos
while true # choice
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
break if _tmp
- self.pos = _save112
+ self.pos = _save105
- _save113 = self.pos
+ _save106 = self.pos
while true # sequence
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
- self.pos = _save113
+ self.pos = _save106
break
end
- _save114 = self.pos
- _tmp = apply(:_BlankLine)
+ _save107 = self.pos
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
- self.pos = _save114
+ self.pos = _save107
unless _tmp
- self.pos = _save113
+ self.pos = _save106
end
break
end # end sequence
break if _tmp
- self.pos = _save112
+ self.pos = _save105
break
end # end choice
unless _tmp
- self.pos = _save109
+ self.pos = _save102
end
break
end # end sequence
break if _tmp
- self.pos = _save100
+ self.pos = _save94
break
end # end choice
if _tmp
while true
- _save115 = self.pos
+ _save108 = self.pos
while true # choice
- _save116 = self.pos
+ _save109 = self.pos
- _save117 = self.pos
+ _save110 = self.pos
while true # sequence
- _save118 = self.pos
+ _save111 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save118
+ self.pos = _save111
unless _tmp
- self.pos = _save117
+ self.pos = _save110
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save117
+ self.pos = _save110
end
break
end # end sequence
@@ -13450,19 +13200,19 @@ class RDoc::Markdown
if _tmp
while true
- _save119 = self.pos
+ _save112 = self.pos
while true # sequence
- _save120 = self.pos
+ _save113 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save120
+ self.pos = _save113
unless _tmp
- self.pos = _save119
+ self.pos = _save112
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save119
+ self.pos = _save112
end
break
end # end sequence
@@ -13471,102 +13221,92 @@ class RDoc::Markdown
end
_tmp = true
else
- self.pos = _save116
+ self.pos = _save109
end
break if _tmp
- self.pos = _save115
+ self.pos = _save108
- _save121 = self.pos
+ _save114 = self.pos
while true # sequence
- _save122 = self.pos
+ _save115 = self.pos
_tmp = apply(:_Ticks4)
_tmp = _tmp ? nil : true
- self.pos = _save122
+ self.pos = _save115
unless _tmp
- self.pos = _save121
+ self.pos = _save114
break
end
- _save123 = self.pos
- _tmp = match_string("`")
- if _tmp
- while true
- _tmp = match_string("`")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save123
- end
+ _tmp = scan(/\A(?-mix:`+)/)
unless _tmp
- self.pos = _save121
+ self.pos = _save114
end
break
end # end sequence
break if _tmp
- self.pos = _save115
+ self.pos = _save108
- _save124 = self.pos
+ _save116 = self.pos
while true # sequence
- _save125 = self.pos
+ _save117 = self.pos
- _save126 = self.pos
+ _save118 = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save126
+ self.pos = _save118
break
end
_tmp = apply(:_Ticks4)
unless _tmp
- self.pos = _save126
+ self.pos = _save118
end
break
end # end sequence
_tmp = _tmp ? nil : true
- self.pos = _save125
+ self.pos = _save117
unless _tmp
- self.pos = _save124
+ self.pos = _save116
break
end
- _save127 = self.pos
+ _save119 = self.pos
while true # choice
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
break if _tmp
- self.pos = _save127
+ self.pos = _save119
- _save128 = self.pos
+ _save120 = self.pos
while true # sequence
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
- self.pos = _save128
+ self.pos = _save120
break
end
- _save129 = self.pos
- _tmp = apply(:_BlankLine)
+ _save121 = self.pos
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
- self.pos = _save129
+ self.pos = _save121
unless _tmp
- self.pos = _save128
+ self.pos = _save120
end
break
end # end sequence
break if _tmp
- self.pos = _save127
+ self.pos = _save119
break
end # end choice
unless _tmp
- self.pos = _save124
+ self.pos = _save116
end
break
end # end sequence
break if _tmp
- self.pos = _save115
+ self.pos = _save108
break
end # end choice
@@ -13574,23 +13314,23 @@ class RDoc::Markdown
end
_tmp = true
else
- self.pos = _save99
+ self.pos = _save93
end
if _tmp
text = get_text(_text_start)
end
unless _tmp
- self.pos = _save98
+ self.pos = _save92
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save98
+ self.pos = _save92
break
end
_tmp = apply(:_Ticks4)
unless _tmp
- self.pos = _save98
+ self.pos = _save92
end
break
end # end sequence
@@ -13598,38 +13338,38 @@ class RDoc::Markdown
break if _tmp
self.pos = _save1
- _save130 = self.pos
+ _save122 = self.pos
while true # sequence
_tmp = apply(:_Ticks5)
unless _tmp
- self.pos = _save130
+ self.pos = _save122
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save130
+ self.pos = _save122
break
end
_text_start = self.pos
- _save131 = self.pos
+ _save123 = self.pos
- _save132 = self.pos
+ _save124 = self.pos
while true # choice
- _save133 = self.pos
+ _save125 = self.pos
- _save134 = self.pos
+ _save126 = self.pos
while true # sequence
- _save135 = self.pos
+ _save127 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save135
+ self.pos = _save127
unless _tmp
- self.pos = _save134
+ self.pos = _save126
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save134
+ self.pos = _save126
end
break
end # end sequence
@@ -13637,19 +13377,19 @@ class RDoc::Markdown
if _tmp
while true
- _save136 = self.pos
+ _save128 = self.pos
while true # sequence
- _save137 = self.pos
+ _save129 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save137
+ self.pos = _save129
unless _tmp
- self.pos = _save136
+ self.pos = _save128
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save136
+ self.pos = _save128
end
break
end # end sequence
@@ -13658,125 +13398,115 @@ class RDoc::Markdown
end
_tmp = true
else
- self.pos = _save133
+ self.pos = _save125
end
break if _tmp
- self.pos = _save132
+ self.pos = _save124
- _save138 = self.pos
+ _save130 = self.pos
while true # sequence
- _save139 = self.pos
+ _save131 = self.pos
_tmp = apply(:_Ticks5)
_tmp = _tmp ? nil : true
- self.pos = _save139
+ self.pos = _save131
unless _tmp
- self.pos = _save138
+ self.pos = _save130
break
end
- _save140 = self.pos
- _tmp = match_string("`")
- if _tmp
- while true
- _tmp = match_string("`")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save140
- end
+ _tmp = scan(/\A(?-mix:`+)/)
unless _tmp
- self.pos = _save138
+ self.pos = _save130
end
break
end # end sequence
break if _tmp
- self.pos = _save132
+ self.pos = _save124
- _save141 = self.pos
+ _save132 = self.pos
while true # sequence
- _save142 = self.pos
+ _save133 = self.pos
- _save143 = self.pos
+ _save134 = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save143
+ self.pos = _save134
break
end
_tmp = apply(:_Ticks5)
unless _tmp
- self.pos = _save143
+ self.pos = _save134
end
break
end # end sequence
_tmp = _tmp ? nil : true
- self.pos = _save142
+ self.pos = _save133
unless _tmp
- self.pos = _save141
+ self.pos = _save132
break
end
- _save144 = self.pos
+ _save135 = self.pos
while true # choice
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
break if _tmp
- self.pos = _save144
+ self.pos = _save135
- _save145 = self.pos
+ _save136 = self.pos
while true # sequence
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
- self.pos = _save145
+ self.pos = _save136
break
end
- _save146 = self.pos
- _tmp = apply(:_BlankLine)
+ _save137 = self.pos
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
- self.pos = _save146
+ self.pos = _save137
unless _tmp
- self.pos = _save145
+ self.pos = _save136
end
break
end # end sequence
break if _tmp
- self.pos = _save144
+ self.pos = _save135
break
end # end choice
unless _tmp
- self.pos = _save141
+ self.pos = _save132
end
break
end # end sequence
break if _tmp
- self.pos = _save132
+ self.pos = _save124
break
end # end choice
if _tmp
while true
- _save147 = self.pos
+ _save138 = self.pos
while true # choice
- _save148 = self.pos
+ _save139 = self.pos
- _save149 = self.pos
+ _save140 = self.pos
while true # sequence
- _save150 = self.pos
+ _save141 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save150
+ self.pos = _save141
unless _tmp
- self.pos = _save149
+ self.pos = _save140
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save149
+ self.pos = _save140
end
break
end # end sequence
@@ -13784,19 +13514,19 @@ class RDoc::Markdown
if _tmp
while true
- _save151 = self.pos
+ _save142 = self.pos
while true # sequence
- _save152 = self.pos
+ _save143 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save152
+ self.pos = _save143
unless _tmp
- self.pos = _save151
+ self.pos = _save142
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save151
+ self.pos = _save142
end
break
end # end sequence
@@ -13805,102 +13535,92 @@ class RDoc::Markdown
end
_tmp = true
else
- self.pos = _save148
+ self.pos = _save139
end
break if _tmp
- self.pos = _save147
+ self.pos = _save138
- _save153 = self.pos
+ _save144 = self.pos
while true # sequence
- _save154 = self.pos
+ _save145 = self.pos
_tmp = apply(:_Ticks5)
_tmp = _tmp ? nil : true
- self.pos = _save154
+ self.pos = _save145
unless _tmp
- self.pos = _save153
+ self.pos = _save144
break
end
- _save155 = self.pos
- _tmp = match_string("`")
- if _tmp
- while true
- _tmp = match_string("`")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save155
- end
+ _tmp = scan(/\A(?-mix:`+)/)
unless _tmp
- self.pos = _save153
+ self.pos = _save144
end
break
end # end sequence
break if _tmp
- self.pos = _save147
+ self.pos = _save138
- _save156 = self.pos
+ _save146 = self.pos
while true # sequence
- _save157 = self.pos
+ _save147 = self.pos
- _save158 = self.pos
+ _save148 = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save158
+ self.pos = _save148
break
end
_tmp = apply(:_Ticks5)
unless _tmp
- self.pos = _save158
+ self.pos = _save148
end
break
end # end sequence
_tmp = _tmp ? nil : true
- self.pos = _save157
+ self.pos = _save147
unless _tmp
- self.pos = _save156
+ self.pos = _save146
break
end
- _save159 = self.pos
+ _save149 = self.pos
while true # choice
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
break if _tmp
- self.pos = _save159
+ self.pos = _save149
- _save160 = self.pos
+ _save150 = self.pos
while true # sequence
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
- self.pos = _save160
+ self.pos = _save150
break
end
- _save161 = self.pos
- _tmp = apply(:_BlankLine)
+ _save151 = self.pos
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
- self.pos = _save161
+ self.pos = _save151
unless _tmp
- self.pos = _save160
+ self.pos = _save150
end
break
end # end sequence
break if _tmp
- self.pos = _save159
+ self.pos = _save149
break
end # end choice
unless _tmp
- self.pos = _save156
+ self.pos = _save146
end
break
end # end sequence
break if _tmp
- self.pos = _save147
+ self.pos = _save138
break
end # end choice
@@ -13908,23 +13628,23 @@ class RDoc::Markdown
end
_tmp = true
else
- self.pos = _save131
+ self.pos = _save123
end
if _tmp
text = get_text(_text_start)
end
unless _tmp
- self.pos = _save130
+ self.pos = _save122
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
- self.pos = _save130
+ self.pos = _save122
break
end
_tmp = apply(:_Ticks5)
unless _tmp
- self.pos = _save130
+ self.pos = _save122
end
break
end # end sequence
@@ -13990,17 +13710,17 @@ class RDoc::Markdown
return _tmp
end
- # BlankLine = Sp Newline { "\n" }
+ # BlankLine = @Sp @Newline { "\n" }
def _BlankLine
_save = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save
break
end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save
break
@@ -14394,13 +14114,13 @@ class RDoc::Markdown
return _tmp
end
- # Nonspacechar = !Spacechar !Newline .
+ # Nonspacechar = !@Spacechar !@Newline .
def _Nonspacechar
_save = self.pos
while true # sequence
_save1 = self.pos
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
_tmp = _tmp ? nil : true
self.pos = _save1
unless _tmp
@@ -14408,7 +14128,7 @@ class RDoc::Markdown
break
end
_save2 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save2
unless _tmp
@@ -14426,10 +14146,10 @@ class RDoc::Markdown
return _tmp
end
- # Sp = Spacechar*
+ # Sp = @Spacechar*
def _Sp
while true
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
break unless _tmp
end
_tmp = true
@@ -14437,12 +14157,12 @@ class RDoc::Markdown
return _tmp
end
- # Spnl = Sp (Newline Sp)?
+ # Spnl = @Sp (@Newline @Sp)?
def _Spnl
_save = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save
break
@@ -14451,12 +14171,12 @@ class RDoc::Markdown
_save2 = self.pos
while true # sequence
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save2
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save2
end
@@ -14477,54 +14197,15 @@ class RDoc::Markdown
return _tmp
end
- # SpecialChar = ("*" | "_" | "`" | "&" | "[" | "]" | "(" | ")" | "<" | "!" | "#" | "\\" | "'" | "\"" | ExtendedSpecialChar)
+ # SpecialChar = (/[*_`&\[\]()<!#\\'"]/ | @ExtendedSpecialChar)
def _SpecialChar
_save = self.pos
while true # choice
- _tmp = match_string("*")
- break if _tmp
- self.pos = _save
- _tmp = match_string("_")
- break if _tmp
- self.pos = _save
- _tmp = match_string("`")
+ _tmp = scan(/\A(?-mix:[*_`&\[\]()<!#\\'"])/)
break if _tmp
self.pos = _save
- _tmp = match_string("&")
- break if _tmp
- self.pos = _save
- _tmp = match_string("[")
- break if _tmp
- self.pos = _save
- _tmp = match_string("]")
- break if _tmp
- self.pos = _save
- _tmp = match_string("(")
- break if _tmp
- self.pos = _save
- _tmp = match_string(")")
- break if _tmp
- self.pos = _save
- _tmp = match_string("<")
- break if _tmp
- self.pos = _save
- _tmp = match_string("!")
- break if _tmp
- self.pos = _save
- _tmp = match_string("#")
- break if _tmp
- self.pos = _save
- _tmp = match_string("\\")
- break if _tmp
- self.pos = _save
- _tmp = match_string("'")
- break if _tmp
- self.pos = _save
- _tmp = match_string("\"")
- break if _tmp
- self.pos = _save
- _tmp = apply(:_ExtendedSpecialChar)
+ _tmp = _ExtendedSpecialChar()
break if _tmp
self.pos = _save
break
@@ -14534,7 +14215,7 @@ class RDoc::Markdown
return _tmp
end
- # NormalChar = !(SpecialChar | Spacechar | Newline) .
+ # NormalChar = !(@SpecialChar | @Spacechar | @Newline) .
def _NormalChar
_save = self.pos
@@ -14543,13 +14224,13 @@ class RDoc::Markdown
_save2 = self.pos
while true # choice
- _tmp = apply(:_SpecialChar)
+ _tmp = _SpecialChar()
break if _tmp
self.pos = _save2
- _tmp = apply(:_Spacechar)
+ _tmp = _Spacechar()
break if _tmp
self.pos = _save2
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
break if _tmp
self.pos = _save2
break
@@ -14628,22 +14309,12 @@ class RDoc::Markdown
return _tmp
end
- # HexEntity = "&" "#" /[Xx]/ < /[0-9a-fA-F]+/ > ";" { [text.to_i(16)].pack 'U' }
+ # HexEntity = /&#x/i < /[0-9a-fA-F]+/ > ";" { [text.to_i(16)].pack 'U' }
def _HexEntity
_save = self.pos
while true # sequence
- _tmp = match_string("&")
- unless _tmp
- self.pos = _save
- break
- end
- _tmp = match_string("#")
- unless _tmp
- self.pos = _save
- break
- end
- _tmp = scan(/\A(?-mix:[Xx])/)
+ _tmp = scan(/\A(?i-mx:&#x)/)
unless _tmp
self.pos = _save
break
@@ -14674,17 +14345,12 @@ class RDoc::Markdown
return _tmp
end
- # DecEntity = "&" "#" < /[0-9]+/ > ";" { [text.to_i].pack 'U' }
+ # DecEntity = "&#" < /[0-9]+/ > ";" { [text.to_i].pack 'U' }
def _DecEntity
_save = self.pos
while true # sequence
- _tmp = match_string("&")
- unless _tmp
- self.pos = _save
- break
- end
- _tmp = match_string("#")
+ _tmp = match_string("&#")
unless _tmp
self.pos = _save
break
@@ -14756,44 +14422,16 @@ class RDoc::Markdown
return _tmp
end
- # NonindentSpace = (" " | " " | " " | "")
+ # NonindentSpace = / {0,3}/
def _NonindentSpace
-
- _save = self.pos
- while true # choice
- _tmp = match_string(" ")
- break if _tmp
- self.pos = _save
- _tmp = match_string(" ")
- break if _tmp
- self.pos = _save
- _tmp = match_string(" ")
- break if _tmp
- self.pos = _save
- _tmp = match_string("")
- break if _tmp
- self.pos = _save
- break
- end # end choice
-
+ _tmp = scan(/\A(?-mix: {0,3})/)
set_failed_rule :_NonindentSpace unless _tmp
return _tmp
end
- # Indent = ("\t" | " ")
+ # Indent = /\t| /
def _Indent
-
- _save = self.pos
- while true # choice
- _tmp = match_string("\t")
- break if _tmp
- self.pos = _save
- _tmp = match_string(" ")
- break if _tmp
- self.pos = _save
- break
- end # end choice
-
+ _tmp = scan(/\A(?-mix:\t| )/)
set_failed_rule :_Indent unless _tmp
return _tmp
end
@@ -14869,12 +14507,12 @@ class RDoc::Markdown
return _tmp
end
- # Line = RawLine:a { a }
+ # Line = @RawLine:a { a }
def _Line
_save = self.pos
while true # sequence
- _tmp = apply(:_RawLine)
+ _tmp = _RawLine()
a = @result
unless _tmp
self.pos = _save
@@ -14892,7 +14530,7 @@ class RDoc::Markdown
return _tmp
end
- # RawLine = (< (!"\r" !"\n" .)* Newline > | < .+ > Eof) { text }
+ # RawLine = (< (!"\r" !"\n" .)* @Newline > | < .+ > @Eof) { text }
def _RawLine
_save = self.pos
@@ -14938,7 +14576,7 @@ class RDoc::Markdown
self.pos = _save2
break
end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save2
end
@@ -14972,7 +14610,7 @@ class RDoc::Markdown
self.pos = _save7
break
end
- _tmp = apply(:_Eof)
+ _tmp = _Eof()
unless _tmp
self.pos = _save7
end
@@ -15000,7 +14638,7 @@ class RDoc::Markdown
return _tmp
end
- # SkipBlock = (HtmlBlock | (!"#" !SetextBottom1 !SetextBottom2 !BlankLine RawLine)+ BlankLine* | BlankLine+ | RawLine)
+ # SkipBlock = (HtmlBlock | (!"#" !SetextBottom1 !SetextBottom2 !@BlankLine @RawLine)+ @BlankLine* | @BlankLine+ | @RawLine)
def _SkipBlock
_save = self.pos
@@ -15040,14 +14678,14 @@ class RDoc::Markdown
break
end
_save7 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
self.pos = _save7
unless _tmp
self.pos = _save3
break
end
- _tmp = apply(:_RawLine)
+ _tmp = _RawLine()
unless _tmp
self.pos = _save3
end
@@ -15084,14 +14722,14 @@ class RDoc::Markdown
break
end
_save12 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
self.pos = _save12
unless _tmp
self.pos = _save8
break
end
- _tmp = apply(:_RawLine)
+ _tmp = _RawLine()
unless _tmp
self.pos = _save8
end
@@ -15109,7 +14747,7 @@ class RDoc::Markdown
break
end
while true
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
break unless _tmp
end
_tmp = true
@@ -15122,10 +14760,10 @@ class RDoc::Markdown
break if _tmp
self.pos = _save
_save14 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
if _tmp
while true
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
break unless _tmp
end
_tmp = true
@@ -15134,7 +14772,7 @@ class RDoc::Markdown
end
break if _tmp
self.pos = _save
- _tmp = apply(:_RawLine)
+ _tmp = _RawLine()
break if _tmp
self.pos = _save
break
@@ -15197,7 +14835,7 @@ class RDoc::Markdown
return _tmp
end
- # RawNoteReference = "[^" < (!Newline !"]" .)+ > "]" { text }
+ # RawNoteReference = "[^" < (!@Newline !"]" .)+ > "]" { text }
def _RawNoteReference
_save = self.pos
@@ -15213,7 +14851,7 @@ class RDoc::Markdown
_save2 = self.pos
while true # sequence
_save3 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save3
unless _tmp
@@ -15241,7 +14879,7 @@ class RDoc::Markdown
_save5 = self.pos
while true # sequence
_save6 = self.pos
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
_tmp = _tmp ? nil : true
self.pos = _save6
unless _tmp
@@ -15293,7 +14931,7 @@ class RDoc::Markdown
return _tmp
end
- # Note = &{ notes? } NonindentSpace RawNoteReference:ref ":" Sp StartList:a RawNoteBlock (&Indent RawNoteBlock:i { a.concat i })* { @footnotes[ref] = paragraph a nil }
+ # Note = &{ notes? } @NonindentSpace RawNoteReference:ref ":" @Sp @StartList:a RawNoteBlock:i { a.concat i } (&Indent RawNoteBlock:i { a.concat i })* { @footnotes[ref] = paragraph a nil }
def _Note
_save = self.pos
@@ -15305,7 +14943,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_NonindentSpace)
+ _tmp = _NonindentSpace()
unless _tmp
self.pos = _save
break
@@ -15321,18 +14959,25 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save
break
end
- _tmp = apply(:_StartList)
+ _tmp = _StartList()
a = @result
unless _tmp
self.pos = _save
break
end
_tmp = apply(:_RawNoteBlock)
+ i = @result
+ unless _tmp
+ self.pos = _save
+ break
+ end
+ @result = begin; a.concat i ; end
+ _tmp = true
unless _tmp
self.pos = _save
break
@@ -15384,7 +15029,7 @@ class RDoc::Markdown
return _tmp
end
- # InlineNote = &{ notes? } "^[" StartList:a (!"]" Inline:l { a << l })+ "]" { ref = [:inline, @note_order.length] @footnotes[ref] = paragraph a note_for ref }
+ # InlineNote = &{ notes? } "^[" @StartList:a (!"]" Inline:l { a << l })+ "]" { ref = [:inline, @note_order.length] @footnotes[ref] = paragraph a note_for ref }
def _InlineNote
_save = self.pos
@@ -15401,7 +15046,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_StartList)
+ _tmp = _StartList()
a = @result
unless _tmp
self.pos = _save
@@ -15514,12 +15159,12 @@ class RDoc::Markdown
return _tmp
end
- # RawNoteBlock = StartList:a (!BlankLine OptionallyIndentedLine:l { a << l })+ < BlankLine* > { a << text } { a }
+ # RawNoteBlock = @StartList:a (!@BlankLine OptionallyIndentedLine:l { a << l })+ < @BlankLine* > { a << text } { a }
def _RawNoteBlock
_save = self.pos
while true # sequence
- _tmp = apply(:_StartList)
+ _tmp = _StartList()
a = @result
unless _tmp
self.pos = _save
@@ -15530,7 +15175,7 @@ class RDoc::Markdown
_save2 = self.pos
while true # sequence
_save3 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
self.pos = _save3
unless _tmp
@@ -15557,7 +15202,7 @@ class RDoc::Markdown
_save4 = self.pos
while true # sequence
_save5 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
_tmp = _tmp ? nil : true
self.pos = _save5
unless _tmp
@@ -15590,7 +15235,7 @@ class RDoc::Markdown
end
_text_start = self.pos
while true
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
break unless _tmp
end
_tmp = true
@@ -15619,7 +15264,7 @@ class RDoc::Markdown
return _tmp
end
- # CodeFence = &{ github? } Ticks3 (Sp StrChunk:format)? Spnl < ((!"`" Nonspacechar)+ | !Ticks3 "`"+ | Spacechar | Newline)+ > Ticks3 Sp Newline* { verbatim = RDoc::Markup::Verbatim.new text verbatim.format = format.intern if format verbatim }
+ # CodeFence = &{ github? } Ticks3 (@Sp StrChunk:format)? Spnl < ((!"`" Nonspacechar)+ | !Ticks3 /`+/ | Spacechar | @Newline)+ > Ticks3 @Sp @Newline* { verbatim = RDoc::Markup::Verbatim.new text verbatim.format = format.intern if format verbatim }
def _CodeFence
_save = self.pos
@@ -15640,7 +15285,7 @@ class RDoc::Markdown
_save3 = self.pos
while true # sequence
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save3
break
@@ -15729,17 +15374,7 @@ class RDoc::Markdown
self.pos = _save11
break
end
- _save13 = self.pos
- _tmp = match_string("`")
- if _tmp
- while true
- _tmp = match_string("`")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save13
- end
+ _tmp = scan(/\A(?-mix:`+)/)
unless _tmp
self.pos = _save11
end
@@ -15751,7 +15386,7 @@ class RDoc::Markdown
_tmp = apply(:_Spacechar)
break if _tmp
self.pos = _save5
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
break if _tmp
self.pos = _save5
break
@@ -15760,23 +15395,23 @@ class RDoc::Markdown
if _tmp
while true
- _save14 = self.pos
+ _save13 = self.pos
while true # choice
- _save15 = self.pos
+ _save14 = self.pos
- _save16 = self.pos
+ _save15 = self.pos
while true # sequence
- _save17 = self.pos
+ _save16 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save17
+ self.pos = _save16
unless _tmp
- self.pos = _save16
+ self.pos = _save15
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save16
+ self.pos = _save15
end
break
end # end sequence
@@ -15784,19 +15419,19 @@ class RDoc::Markdown
if _tmp
while true
- _save18 = self.pos
+ _save17 = self.pos
while true # sequence
- _save19 = self.pos
+ _save18 = self.pos
_tmp = match_string("`")
_tmp = _tmp ? nil : true
- self.pos = _save19
+ self.pos = _save18
unless _tmp
- self.pos = _save18
+ self.pos = _save17
break
end
_tmp = apply(:_Nonspacechar)
unless _tmp
- self.pos = _save18
+ self.pos = _save17
end
break
end # end sequence
@@ -15805,46 +15440,36 @@ class RDoc::Markdown
end
_tmp = true
else
- self.pos = _save15
+ self.pos = _save14
end
break if _tmp
- self.pos = _save14
+ self.pos = _save13
- _save20 = self.pos
+ _save19 = self.pos
while true # sequence
- _save21 = self.pos
+ _save20 = self.pos
_tmp = apply(:_Ticks3)
_tmp = _tmp ? nil : true
- self.pos = _save21
+ self.pos = _save20
unless _tmp
- self.pos = _save20
+ self.pos = _save19
break
end
- _save22 = self.pos
- _tmp = match_string("`")
- if _tmp
- while true
- _tmp = match_string("`")
- break unless _tmp
- end
- _tmp = true
- else
- self.pos = _save22
- end
+ _tmp = scan(/\A(?-mix:`+)/)
unless _tmp
- self.pos = _save20
+ self.pos = _save19
end
break
end # end sequence
break if _tmp
- self.pos = _save14
+ self.pos = _save13
_tmp = apply(:_Spacechar)
break if _tmp
- self.pos = _save14
- _tmp = apply(:_Newline)
+ self.pos = _save13
+ _tmp = _Newline()
break if _tmp
- self.pos = _save14
+ self.pos = _save13
break
end # end choice
@@ -15866,13 +15491,13 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save
break
end
while true
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
break unless _tmp
end
_tmp = true
@@ -16005,7 +15630,7 @@ class RDoc::Markdown
return _tmp
end
- # DefinitionListLabel = StrChunk:label Sp Newline { label }
+ # DefinitionListLabel = StrChunk:label @Sp @Newline { label }
def _DefinitionListLabel
_save = self.pos
@@ -16016,12 +15641,12 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_Sp)
+ _tmp = _Sp()
unless _tmp
self.pos = _save
break
end
- _tmp = apply(:_Newline)
+ _tmp = _Newline()
unless _tmp
self.pos = _save
break
@@ -16038,12 +15663,12 @@ class RDoc::Markdown
return _tmp
end
- # DefinitionListDefinition = NonindentSpace ":" Space Inlines:a BlankLine+ { paragraph a }
+ # DefinitionListDefinition = @NonindentSpace ":" @Space Inlines:a @BlankLine+ { paragraph a }
def _DefinitionListDefinition
_save = self.pos
while true # sequence
- _tmp = apply(:_NonindentSpace)
+ _tmp = _NonindentSpace()
unless _tmp
self.pos = _save
break
@@ -16053,7 +15678,7 @@ class RDoc::Markdown
self.pos = _save
break
end
- _tmp = apply(:_Space)
+ _tmp = _Space()
unless _tmp
self.pos = _save
break
@@ -16065,10 +15690,10 @@ class RDoc::Markdown
break
end
_save1 = self.pos
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
if _tmp
while true
- _tmp = apply(:_BlankLine)
+ _tmp = _BlankLine()
break unless _tmp
end
_tmp = true
@@ -16094,35 +15719,35 @@ class RDoc::Markdown
Rules = {}
Rules[:_root] = rule_info("root", "Doc")
Rules[:_Doc] = rule_info("Doc", "BOM? Block*:a { RDoc::Markup::Document.new(*a.compact) }")
- Rules[:_Block] = rule_info("Block", "BlankLine* (BlockQuote | Verbatim | CodeFence | Note | Reference | HorizontalRule | Heading | OrderedList | BulletList | DefinitionList | HtmlBlock | StyleBlock | Para | Plain)")
- Rules[:_Para] = rule_info("Para", "NonindentSpace Inlines:a BlankLine+ { paragraph a }")
+ Rules[:_Block] = rule_info("Block", "@BlankLine* (BlockQuote | Verbatim | CodeFence | Note | Reference | HorizontalRule | Heading | OrderedList | BulletList | DefinitionList | HtmlBlock | StyleBlock | Para | Plain)")
+ Rules[:_Para] = rule_info("Para", "@NonindentSpace Inlines:a @BlankLine+ { paragraph a }")
Rules[:_Plain] = rule_info("Plain", "Inlines:a { paragraph a }")
- Rules[:_AtxInline] = rule_info("AtxInline", "!Newline !(Sp? \"\#\"* Sp Newline) Inline")
- Rules[:_AtxStart] = rule_info("AtxStart", "< (\"\#\#\#\#\#\#\" | \"\#\#\#\#\#\" | \"\#\#\#\#\" | \"\#\#\#\" | \"\#\#\" | \"\#\") > { text.length }")
- Rules[:_AtxHeading] = rule_info("AtxHeading", "AtxStart:s Sp? AtxInline+:a (Sp? \"\#\"* Sp)? Newline { RDoc::Markup::Heading.new(s, a.join) }")
+ Rules[:_AtxInline] = rule_info("AtxInline", "!@Newline !(@Sp? /\#*/ @Sp @Newline) Inline")
+ Rules[:_AtxStart] = rule_info("AtxStart", "< /\\\#{1,6}/ > { text.length }")
+ Rules[:_AtxHeading] = rule_info("AtxHeading", "AtxStart:s @Sp? AtxInline+:a (@Sp? /\#*/ @Sp)? @Newline { RDoc::Markup::Heading.new(s, a.join) }")
Rules[:_SetextHeading] = rule_info("SetextHeading", "(SetextHeading1 | SetextHeading2)")
- Rules[:_SetextBottom1] = rule_info("SetextBottom1", "\"===\" \"=\"* Newline")
- Rules[:_SetextBottom2] = rule_info("SetextBottom2", "\"---\" \"-\"* Newline")
- Rules[:_SetextHeading1] = rule_info("SetextHeading1", "&(RawLine SetextBottom1) StartList:a (!Endline Inline:b { a << b })+ Sp? Newline SetextBottom1 { RDoc::Markup::Heading.new(1, a.join) }")
- Rules[:_SetextHeading2] = rule_info("SetextHeading2", "&(RawLine SetextBottom2) StartList:a (!Endline Inline:b { a << b })+ Sp? Newline SetextBottom2 { RDoc::Markup::Heading.new(2, a.join) }")
+ Rules[:_SetextBottom1] = rule_info("SetextBottom1", "/={3,}/ @Newline")
+ Rules[:_SetextBottom2] = rule_info("SetextBottom2", "/-{3,}/ @Newline")
+ Rules[:_SetextHeading1] = rule_info("SetextHeading1", "&(@RawLine SetextBottom1) @StartList:a (!@Endline Inline:b { a << b })+ @Sp? @Newline SetextBottom1 { RDoc::Markup::Heading.new(1, a.join) }")
+ Rules[:_SetextHeading2] = rule_info("SetextHeading2", "&(@RawLine SetextBottom2) @StartList:a (!@Endline Inline:b { a << b })+ @Sp? @Newline SetextBottom2 { RDoc::Markup::Heading.new(2, a.join) }")
Rules[:_Heading] = rule_info("Heading", "(SetextHeading | AtxHeading)")
Rules[:_BlockQuote] = rule_info("BlockQuote", "BlockQuoteRaw:a { RDoc::Markup::BlockQuote.new(*a) }")
- Rules[:_BlockQuoteRaw] = rule_info("BlockQuoteRaw", "StartList:a (\">\" \" \"? Line:l { a << l } (!\">\" !BlankLine Line:c { a << c })* (BlankLine:n { a << n })*)+ { inner_parse a.join }")
- Rules[:_NonblankIndentedLine] = rule_info("NonblankIndentedLine", "!BlankLine IndentedLine")
- Rules[:_VerbatimChunk] = rule_info("VerbatimChunk", "BlankLine*:a NonblankIndentedLine+:b { a.concat b }")
+ Rules[:_BlockQuoteRaw] = rule_info("BlockQuoteRaw", "@StartList:a (\">\" \" \"? Line:l { a << l } (!\">\" !@BlankLine Line:c { a << c })* (@BlankLine:n { a << n })*)+ { inner_parse a.join }")
+ Rules[:_NonblankIndentedLine] = rule_info("NonblankIndentedLine", "!@BlankLine IndentedLine")
+ Rules[:_VerbatimChunk] = rule_info("VerbatimChunk", "@BlankLine*:a NonblankIndentedLine+:b { a.concat b }")
Rules[:_Verbatim] = rule_info("Verbatim", "VerbatimChunk+:a { RDoc::Markup::Verbatim.new(*a.flatten) }")
- Rules[:_HorizontalRule] = rule_info("HorizontalRule", "NonindentSpace (\"*\" Sp \"*\" Sp \"*\" (Sp \"*\")* | \"-\" Sp \"-\" Sp \"-\" (Sp \"-\")* | \"_\" Sp \"_\" Sp \"_\" (Sp \"_\")*) Sp Newline BlankLine+ { RDoc::Markup::Rule.new 1 }")
- Rules[:_Bullet] = rule_info("Bullet", "!HorizontalRule NonindentSpace (\"+\" | \"*\" | \"-\") Spacechar+")
+ Rules[:_HorizontalRule] = rule_info("HorizontalRule", "@NonindentSpace (\"*\" @Sp \"*\" @Sp \"*\" (@Sp \"*\")* | \"-\" @Sp \"-\" @Sp \"-\" (@Sp \"-\")* | \"_\" @Sp \"_\" @Sp \"_\" (@Sp \"_\")*) @Sp @Newline @BlankLine+ { RDoc::Markup::Rule.new 1 }")
+ Rules[:_Bullet] = rule_info("Bullet", "!HorizontalRule @NonindentSpace /[+*-]/ @Spacechar+")
Rules[:_BulletList] = rule_info("BulletList", "&Bullet (ListTight | ListLoose):a { RDoc::Markup::List.new(:BULLET, *a) }")
- Rules[:_ListTight] = rule_info("ListTight", "ListItemTight+:a BlankLine* !(Bullet | Enumerator) { a }")
- Rules[:_ListLoose] = rule_info("ListLoose", "StartList:a (ListItem:b BlankLine* { a << b })+ { a }")
- Rules[:_ListItem] = rule_info("ListItem", "(Bullet | Enumerator) StartList:a ListBlock:b { a << b } (ListContinuationBlock:c { a.push(*c) })* { list_item_from a }")
- Rules[:_ListItemTight] = rule_info("ListItemTight", "(Bullet | Enumerator) ListBlock:a (!BlankLine ListContinuationBlock:b { a.push(*b) })* !ListContinuationBlock { list_item_from a }")
- Rules[:_ListBlock] = rule_info("ListBlock", "!BlankLine Line:a ListBlockLine*:c { [a, *c] }")
- Rules[:_ListContinuationBlock] = rule_info("ListContinuationBlock", "StartList:a BlankLine* { a << \"\\n\" } (Indent ListBlock:b { a.concat b })+ { a }")
- Rules[:_Enumerator] = rule_info("Enumerator", "NonindentSpace [0-9]+ \".\" Spacechar+")
+ Rules[:_ListTight] = rule_info("ListTight", "ListItemTight+:a @BlankLine* !(Bullet | Enumerator) { a }")
+ Rules[:_ListLoose] = rule_info("ListLoose", "@StartList:a (ListItem:b @BlankLine* { a << b })+ { a }")
+ Rules[:_ListItem] = rule_info("ListItem", "(Bullet | Enumerator) @StartList:a ListBlock:b { a << b } (ListContinuationBlock:c { a.push(*c) })* { list_item_from a }")
+ Rules[:_ListItemTight] = rule_info("ListItemTight", "(Bullet | Enumerator) ListBlock:a (!@BlankLine ListContinuationBlock:b { a.push(*b) })* !ListContinuationBlock { list_item_from a }")
+ Rules[:_ListBlock] = rule_info("ListBlock", "!@BlankLine Line:a ListBlockLine*:c { [a, *c] }")
+ Rules[:_ListContinuationBlock] = rule_info("ListContinuationBlock", "@StartList:a @BlankLine* { a << \"\\n\" } (Indent ListBlock:b { a.concat b })+ { a }")
+ 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[:_ListBlockLine] = rule_info("ListBlockLine", "!@BlankLine !(Indent? (Bullet | Enumerator)) !HorizontalRule OptionallyIndentedLine")
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")
@@ -16223,7 +15848,7 @@ class RDoc::Markdown
Rules[:_HtmlBlockCloseScript] = rule_info("HtmlBlockCloseScript", "\"<\" Spnl \"/\" (\"script\" | \"SCRIPT\") Spnl \">\"")
Rules[:_HtmlBlockScript] = rule_info("HtmlBlockScript", "HtmlBlockOpenScript (!HtmlBlockCloseScript .)* HtmlBlockCloseScript")
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[:_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\")")
Rules[:_HtmlBlockSelfClosing] = rule_info("HtmlBlockSelfClosing", "\"<\" Spnl HtmlBlockType Spnl HtmlAttribute* \"/\" Spnl \">\"")
@@ -16231,77 +15856,77 @@ class RDoc::Markdown
Rules[:_StyleOpen] = rule_info("StyleOpen", "\"<\" Spnl (\"style\" | \"STYLE\") Spnl HtmlAttribute* \">\"")
Rules[:_StyleClose] = rule_info("StyleClose", "\"<\" Spnl \"/\" (\"style\" | \"STYLE\") Spnl \">\"")
Rules[:_InStyleTags] = rule_info("InStyleTags", "StyleOpen (!StyleClose .)* StyleClose")
- Rules[:_StyleBlock] = rule_info("StyleBlock", "< InStyleTags > BlankLine* { if css? then RDoc::Markup::Raw.new text end }")
- Rules[:_Inlines] = rule_info("Inlines", "(!Endline Inline:i { i } | Endline:c &Inline { c })+:chunks Endline? { chunks }")
- Rules[:_Inline] = rule_info("Inline", "(Str | Endline | UlOrStarLine | Space | Strong | Emph | Image | Link | NoteReference | InlineNote | Code | RawHtml | Entity | EscapedChar | Symbol)")
- Rules[:_Space] = rule_info("Space", "Spacechar+ { \" \" }")
- Rules[:_Str] = rule_info("Str", "StartList:a < NormalChar+ > { a = text } (StrChunk:c { a << c })* { a }")
- Rules[:_StrChunk] = rule_info("StrChunk", "< (NormalChar | \"_\"+ &Alphanumeric)+ > { text }")
- Rules[:_EscapedChar] = rule_info("EscapedChar", "\"\\\\\" !Newline < /[:\\\\`|*_{}\\[\\]()\#+.!><-]/ > { text }")
+ Rules[:_StyleBlock] = rule_info("StyleBlock", "< InStyleTags > @BlankLine* { if css? then RDoc::Markup::Raw.new text end }")
+ Rules[:_Inlines] = rule_info("Inlines", "(!@Endline Inline:i { i } | @Endline:c &Inline { c })+:chunks @Endline? { chunks }")
+ Rules[:_Inline] = rule_info("Inline", "(Str | @Endline | UlOrStarLine | @Space | Strong | Emph | Image | Link | NoteReference | InlineNote | Code | RawHtml | Entity | EscapedChar | Symbol)")
+ Rules[:_Space] = rule_info("Space", "@Spacechar+ { \" \" }")
+ Rules[:_Str] = rule_info("Str", "@StartList:a < @NormalChar+ > { a = text } (StrChunk:c { a << c })* { a }")
+ Rules[:_StrChunk] = rule_info("StrChunk", "< (@NormalChar | /_+/ &Alphanumeric)+ > { text }")
+ Rules[:_EscapedChar] = rule_info("EscapedChar", "\"\\\\\" !@Newline < /[:\\\\`|*_{}\\[\\]()\#+.!><-]/ > { text }")
Rules[:_Entity] = rule_info("Entity", "(HexEntity | DecEntity | CharEntity):a { a }")
- Rules[:_Endline] = rule_info("Endline", "(LineBreak | TerminalEndline | NormalEndline)")
- Rules[:_NormalEndline] = rule_info("NormalEndline", "Sp Newline !BlankLine !\">\" !AtxStart !(Line (\"===\" \"=\"* | \"---\" \"-\"*) Newline) { \"\\n\" }")
- Rules[:_TerminalEndline] = rule_info("TerminalEndline", "Sp Newline Eof")
- Rules[:_LineBreak] = rule_info("LineBreak", "\" \" NormalEndline { RDoc::Markup::HardBreak.new }")
- Rules[:_Symbol] = rule_info("Symbol", "< SpecialChar > { text }")
+ Rules[:_Endline] = rule_info("Endline", "(@LineBreak | @TerminalEndline | @NormalEndline)")
+ Rules[:_NormalEndline] = rule_info("NormalEndline", "@Sp @Newline !@BlankLine !\">\" !AtxStart !(Line /={3,}|-{3,}=/ @Newline) { \"\\n\" }")
+ Rules[:_TerminalEndline] = rule_info("TerminalEndline", "@Sp @Newline @Eof")
+ Rules[:_LineBreak] = rule_info("LineBreak", "\" \" @NormalEndline { RDoc::Markup::HardBreak.new }")
+ Rules[:_Symbol] = rule_info("Symbol", "< @SpecialChar > { text }")
Rules[:_UlOrStarLine] = rule_info("UlOrStarLine", "(UlLine | StarLine):a { a }")
- Rules[:_StarLine] = rule_info("StarLine", "(< \"****\" \"*\"* > { text } | < Spacechar \"*\"+ &Spacechar > { text })")
- Rules[:_UlLine] = rule_info("UlLine", "(< \"____\" \"_\"* > { text } | < Spacechar \"_\"+ &Spacechar > { text })")
+ Rules[:_StarLine] = rule_info("StarLine", "(< /\\*{4,}/ > { text } | < @Spacechar /\\*+/ &@Spacechar > { text })")
+ Rules[:_UlLine] = rule_info("UlLine", "(< /_{4,}/ > { text } | < @Spacechar /_+/ &@Spacechar > { text })")
Rules[:_Emph] = rule_info("Emph", "(EmphStar | EmphUl)")
- Rules[:_OneStarOpen] = rule_info("OneStarOpen", "!StarLine \"*\" !Spacechar !Newline")
- Rules[:_OneStarClose] = rule_info("OneStarClose", "!Spacechar !Newline Inline:a \"*\" { a }")
- Rules[:_EmphStar] = rule_info("EmphStar", "OneStarOpen StartList:a (!OneStarClose Inline:l { a << l })* OneStarClose:l { a << l } { emphasis a.join }")
- Rules[:_OneUlOpen] = rule_info("OneUlOpen", "!UlLine \"_\" !Spacechar !Newline")
- Rules[:_OneUlClose] = rule_info("OneUlClose", "!Spacechar !Newline Inline:a \"_\" { a }")
- Rules[:_EmphUl] = rule_info("EmphUl", "OneUlOpen StartList:a (!OneUlClose Inline:l { a << l })* OneUlClose:l { a << l } { emphasis a.join }")
+ Rules[:_OneStarOpen] = rule_info("OneStarOpen", "!StarLine \"*\" !@Spacechar !@Newline")
+ Rules[:_OneStarClose] = rule_info("OneStarClose", "!@Spacechar !@Newline Inline:a \"*\" { a }")
+ Rules[:_EmphStar] = rule_info("EmphStar", "OneStarOpen @StartList:a (!OneStarClose Inline:l { a << l })* OneStarClose:l { a << l } { emphasis a.join }")
+ Rules[:_OneUlOpen] = rule_info("OneUlOpen", "!UlLine \"_\" !@Spacechar !@Newline")
+ Rules[:_OneUlClose] = rule_info("OneUlClose", "!@Spacechar !@Newline Inline:a \"_\" { a }")
+ Rules[:_EmphUl] = rule_info("EmphUl", "OneUlOpen @StartList:a (!OneUlClose Inline:l { a << l })* OneUlClose:l { a << l } { emphasis a.join }")
Rules[:_Strong] = rule_info("Strong", "(StrongStar | StrongUl)")
- Rules[:_TwoStarOpen] = rule_info("TwoStarOpen", "!StarLine \"**\" !Spacechar !Newline")
- Rules[:_TwoStarClose] = rule_info("TwoStarClose", "!Spacechar !Newline Inline:a \"**\" { a }")
- Rules[:_StrongStar] = rule_info("StrongStar", "TwoStarOpen StartList:a (!TwoStarClose Inline:l { a << l })* TwoStarClose:l { a << l } { strong a.join }")
- Rules[:_TwoUlOpen] = rule_info("TwoUlOpen", "!UlLine \"__\" !Spacechar !Newline")
- Rules[:_TwoUlClose] = rule_info("TwoUlClose", "!Spacechar !Newline Inline:a \"__\" { a }")
- Rules[:_StrongUl] = rule_info("StrongUl", "TwoUlOpen StartList:a (!TwoUlClose Inline:i { a << i })* TwoUlClose:l { a << l } { strong a.join }")
- Rules[:_Image] = rule_info("Image", "\"!\" (ExplicitLink | ReferenceLink):a { a }")
+ Rules[:_TwoStarOpen] = rule_info("TwoStarOpen", "!StarLine \"**\" !@Spacechar !@Newline")
+ Rules[:_TwoStarClose] = rule_info("TwoStarClose", "!@Spacechar !@Newline Inline:a \"**\" { a }")
+ Rules[:_StrongStar] = rule_info("StrongStar", "TwoStarOpen @StartList:a (!TwoStarClose Inline:l { a << l })* TwoStarClose:l { a << l } { strong a.join }")
+ Rules[:_TwoUlOpen] = rule_info("TwoUlOpen", "!UlLine \"__\" !@Spacechar !@Newline")
+ Rules[:_TwoUlClose] = rule_info("TwoUlClose", "!@Spacechar !@Newline Inline:a \"__\" { a }")
+ Rules[:_StrongUl] = rule_info("StrongUl", "TwoUlOpen @StartList:a (!TwoUlClose Inline:i { a << i })* TwoUlClose:l { a << l } { strong a.join }")
+ Rules[:_Image] = rule_info("Image", "\"!\" (ExplicitLink | ReferenceLink):a { \"rdoc-image:\#{a[/\\[(.*)\\]/, 1]}\" }")
Rules[:_Link] = rule_info("Link", "(ExplicitLink | ReferenceLink | AutoLink)")
Rules[:_ReferenceLink] = rule_info("ReferenceLink", "(ReferenceLinkDouble | ReferenceLinkSingle)")
Rules[:_ReferenceLinkDouble] = rule_info("ReferenceLinkDouble", "Label:content < Spnl > !\"[]\" Label:label { link_to content, label, text }")
Rules[:_ReferenceLinkSingle] = rule_info("ReferenceLinkSingle", "Label:content < (Spnl \"[]\")? > { link_to content, content, text }")
- Rules[:_ExplicitLink] = rule_info("ExplicitLink", "Label:l Spnl \"(\" Sp Source:s Spnl Title Sp \")\" { \"{\#{l}}[\#{s}]\" }")
+ Rules[:_ExplicitLink] = rule_info("ExplicitLink", "Label:l Spnl \"(\" @Sp Source:s Spnl Title @Sp \")\" { \"{\#{l}}[\#{s}]\" }")
Rules[:_Source] = rule_info("Source", "(\"<\" < SourceContents > \">\" | < SourceContents >) { text }")
Rules[:_SourceContents] = rule_info("SourceContents", "(((!\"(\" !\")\" !\">\" Nonspacechar)+ | \"(\" SourceContents \")\")* | \"\")")
Rules[:_Title] = rule_info("Title", "(TitleSingle | TitleDouble | \"\"):a { a }")
- Rules[:_TitleSingle] = rule_info("TitleSingle", "\"'\" (!(\"'\" Sp (\")\" | Newline)) .)* \"'\"")
- Rules[:_TitleDouble] = rule_info("TitleDouble", "\"\\\"\" (!(\"\\\"\" Sp (\")\" | Newline)) .)* \"\\\"\"")
+ Rules[:_TitleSingle] = rule_info("TitleSingle", "\"'\" (!(\"'\" @Sp (\")\" | @Newline)) .)* \"'\"")
+ Rules[:_TitleDouble] = rule_info("TitleDouble", "\"\\\"\" (!(\"\\\"\" @Sp (\")\" | @Newline)) .)* \"\\\"\"")
Rules[:_AutoLink] = rule_info("AutoLink", "(AutoLinkUrl | AutoLinkEmail)")
- Rules[:_AutoLinkUrl] = rule_info("AutoLinkUrl", "\"<\" < /[A-Za-z]+/ \"://\" (!Newline !\">\" .)+ > \">\" { text }")
- Rules[:_AutoLinkEmail] = rule_info("AutoLinkEmail", "\"<\" \"mailto:\"? < /[\\w+.\\/!%~$-]+/i \"@\" (!Newline !\">\" .)+ > \">\" { \"mailto:\#{text}\" }")
- Rules[:_Reference] = rule_info("Reference", "NonindentSpace !\"[]\" Label:label \":\" Spnl RefSrc:link RefTitle BlankLine+ { \# TODO use title reference label, link nil }")
- Rules[:_Label] = rule_info("Label", "\"[\" (!\"^\" &{ notes? } | &. &{ !notes? }) StartList:a (!\"]\" Inline:l { a << l })* \"]\" { a.join.gsub(/\\s+/, ' ') }")
+ Rules[:_AutoLinkUrl] = rule_info("AutoLinkUrl", "\"<\" < /[A-Za-z]+/ \"://\" (!@Newline !\">\" .)+ > \">\" { text }")
+ Rules[:_AutoLinkEmail] = rule_info("AutoLinkEmail", "\"<\" \"mailto:\"? < /[\\w+.\\/!%~$-]+/i \"@\" (!@Newline !\">\" .)+ > \">\" { \"mailto:\#{text}\" }")
+ Rules[:_Reference] = rule_info("Reference", "@NonindentSpace !\"[]\" Label:label \":\" Spnl RefSrc:link RefTitle @BlankLine+ { \# TODO use title reference label, link nil }")
+ Rules[:_Label] = rule_info("Label", "\"[\" (!\"^\" &{ notes? } | &. &{ !notes? }) @StartList:a (!\"]\" Inline:l { a << l })* \"]\" { a.join.gsub(/\\s+/, ' ') }")
Rules[:_RefSrc] = rule_info("RefSrc", "< Nonspacechar+ > { text }")
Rules[:_RefTitle] = rule_info("RefTitle", "(RefTitleSingle | RefTitleDouble | RefTitleParens | EmptyTitle)")
Rules[:_EmptyTitle] = rule_info("EmptyTitle", "\"\"")
- Rules[:_RefTitleSingle] = rule_info("RefTitleSingle", "Spnl \"'\" < (!(\"'\" Sp Newline | Newline) .)* > \"'\" { text }")
- Rules[:_RefTitleDouble] = rule_info("RefTitleDouble", "Spnl \"\\\"\" < (!(\"\\\"\" Sp Newline | Newline) .)* > \"\\\"\" { text }")
- Rules[:_RefTitleParens] = rule_info("RefTitleParens", "Spnl \"(\" < (!(\")\" Sp Newline | Newline) .)* > \")\" { text }")
+ Rules[:_RefTitleSingle] = rule_info("RefTitleSingle", "Spnl \"'\" < (!(\"'\" @Sp @Newline | @Newline) .)* > \"'\" { text }")
+ Rules[:_RefTitleDouble] = rule_info("RefTitleDouble", "Spnl \"\\\"\" < (!(\"\\\"\" @Sp @Newline | @Newline) .)* > \"\\\"\" { text }")
+ Rules[:_RefTitleParens] = rule_info("RefTitleParens", "Spnl \"(\" < (!(\")\" @Sp @Newline | @Newline) .)* > \")\" { text }")
Rules[:_References] = rule_info("References", "(Reference | SkipBlock)*")
Rules[:_Ticks1] = rule_info("Ticks1", "\"`\" !\"`\"")
Rules[:_Ticks2] = rule_info("Ticks2", "\"``\" !\"`\"")
Rules[:_Ticks3] = rule_info("Ticks3", "\"```\" !\"`\"")
Rules[:_Ticks4] = rule_info("Ticks4", "\"````\" !\"`\"")
Rules[:_Ticks5] = rule_info("Ticks5", "\"`````\" !\"`\"")
- Rules[:_Code] = rule_info("Code", "(Ticks1 Sp < ((!\"`\" Nonspacechar)+ | !Ticks1 \"`\"+ | !(Sp Ticks1) (Spacechar | Newline !BlankLine))+ > Sp Ticks1 | Ticks2 Sp < ((!\"`\" Nonspacechar)+ | !Ticks2 \"`\"+ | !(Sp Ticks2) (Spacechar | Newline !BlankLine))+ > Sp Ticks2 | Ticks3 Sp < ((!\"`\" Nonspacechar)+ | !Ticks3 \"`\"+ | !(Sp Ticks3) (Spacechar | Newline !BlankLine))+ > Sp Ticks3 | Ticks4 Sp < ((!\"`\" Nonspacechar)+ | !Ticks4 \"`\"+ | !(Sp Ticks4) (Spacechar | Newline !BlankLine))+ > Sp Ticks4 | Ticks5 Sp < ((!\"`\" Nonspacechar)+ | !Ticks5 \"`\"+ | !(Sp Ticks5) (Spacechar | Newline !BlankLine))+ > Sp Ticks5) { \"<code>\#{text}</code>\" }")
+ Rules[:_Code] = rule_info("Code", "(Ticks1 @Sp < ((!\"`\" Nonspacechar)+ | !Ticks1 /`+/ | !(@Sp Ticks1) (@Spacechar | @Newline !@BlankLine))+ > @Sp Ticks1 | Ticks2 @Sp < ((!\"`\" Nonspacechar)+ | !Ticks2 /`+/ | !(@Sp Ticks2) (@Spacechar | @Newline !@BlankLine))+ > @Sp Ticks2 | Ticks3 @Sp < ((!\"`\" Nonspacechar)+ | !Ticks3 /`+/ | !(@Sp Ticks3) (@Spacechar | @Newline !@BlankLine))+ > @Sp Ticks3 | Ticks4 @Sp < ((!\"`\" Nonspacechar)+ | !Ticks4 /`+/ | !(@Sp Ticks4) (@Spacechar | @Newline !@BlankLine))+ > @Sp Ticks4 | Ticks5 @Sp < ((!\"`\" Nonspacechar)+ | !Ticks5 /`+/ | !(@Sp Ticks5) (@Spacechar | @Newline !@BlankLine))+ > @Sp Ticks5) { \"<code>\#{text}</code>\" }")
Rules[:_RawHtml] = rule_info("RawHtml", "< (HtmlComment | HtmlBlockScript | HtmlTag) > { if html? then text else '' end }")
- Rules[:_BlankLine] = rule_info("BlankLine", "Sp Newline { \"\\n\" }")
+ Rules[:_BlankLine] = rule_info("BlankLine", "@Sp @Newline { \"\\n\" }")
Rules[:_Quoted] = rule_info("Quoted", "(\"\\\"\" (!\"\\\"\" .)* \"\\\"\" | \"'\" (!\"'\" .)* \"'\")")
Rules[:_HtmlAttribute] = rule_info("HtmlAttribute", "(AlphanumericAscii | \"-\")+ Spnl (\"=\" Spnl (Quoted | (!\">\" Nonspacechar)+))? Spnl")
Rules[:_HtmlComment] = rule_info("HtmlComment", "\"<!--\" (!\"-->\" .)* \"-->\"")
Rules[:_HtmlTag] = rule_info("HtmlTag", "\"<\" Spnl \"/\"? AlphanumericAscii+ Spnl HtmlAttribute* \"/\"? Spnl \">\"")
Rules[:_Eof] = rule_info("Eof", "!.")
- Rules[:_Nonspacechar] = rule_info("Nonspacechar", "!Spacechar !Newline .")
- Rules[:_Sp] = rule_info("Sp", "Spacechar*")
- Rules[:_Spnl] = rule_info("Spnl", "Sp (Newline Sp)?")
- Rules[:_SpecialChar] = rule_info("SpecialChar", "(\"*\" | \"_\" | \"`\" | \"&\" | \"[\" | \"]\" | \"(\" | \")\" | \"<\" | \"!\" | \"\#\" | \"\\\\\" | \"'\" | \"\\\"\" | ExtendedSpecialChar)")
- Rules[:_NormalChar] = rule_info("NormalChar", "!(SpecialChar | Spacechar | Newline) .")
+ Rules[:_Nonspacechar] = rule_info("Nonspacechar", "!@Spacechar !@Newline .")
+ Rules[:_Sp] = rule_info("Sp", "@Spacechar*")
+ Rules[:_Spnl] = rule_info("Spnl", "@Sp (@Newline @Sp)?")
+ Rules[:_SpecialChar] = rule_info("SpecialChar", "(/[*_`&\\[\\]()<!\#\\\\'\"]/ | @ExtendedSpecialChar)")
+ Rules[:_NormalChar] = rule_info("NormalChar", "!(@SpecialChar | @Spacechar | @Newline) .")
Rules[:_Digit] = rule_info("Digit", "[0-9]")
Rules[:_Alphanumeric] = rule_info("Alphanumeric", "%literals.Alphanumeric")
Rules[:_AlphanumericAscii] = rule_info("AlphanumericAscii", "%literals.AlphanumericAscii")
@@ -16309,28 +15934,28 @@ class RDoc::Markdown
Rules[:_Newline] = rule_info("Newline", "%literals.Newline")
Rules[:_NonAlphanumeric] = rule_info("NonAlphanumeric", "%literals.NonAlphanumeric")
Rules[:_Spacechar] = rule_info("Spacechar", "%literals.Spacechar")
- Rules[:_HexEntity] = rule_info("HexEntity", "\"&\" \"\#\" /[Xx]/ < /[0-9a-fA-F]+/ > \";\" { [text.to_i(16)].pack 'U' }")
- Rules[:_DecEntity] = rule_info("DecEntity", "\"&\" \"\#\" < /[0-9]+/ > \";\" { [text.to_i].pack 'U' }")
+ Rules[:_HexEntity] = rule_info("HexEntity", "/&\#x/i < /[0-9a-fA-F]+/ > \";\" { [text.to_i(16)].pack 'U' }")
+ Rules[:_DecEntity] = rule_info("DecEntity", "\"&\#\" < /[0-9]+/ > \";\" { [text.to_i].pack 'U' }")
Rules[:_CharEntity] = rule_info("CharEntity", "\"&\" < /[A-Za-z0-9]+/ > \";\" { if entity = HTML_ENTITIES[text] then entity.pack 'U*' else \"&\#{text};\" end }")
- Rules[:_NonindentSpace] = rule_info("NonindentSpace", "(\" \" | \" \" | \" \" | \"\")")
- Rules[:_Indent] = rule_info("Indent", "(\"\\t\" | \" \")")
+ Rules[:_NonindentSpace] = rule_info("NonindentSpace", "/ {0,3}/")
+ Rules[:_Indent] = rule_info("Indent", "/\\t| /")
Rules[:_IndentedLine] = rule_info("IndentedLine", "Indent Line")
Rules[:_OptionallyIndentedLine] = rule_info("OptionallyIndentedLine", "Indent? Line")
Rules[:_StartList] = rule_info("StartList", "&. { [] }")
- Rules[:_Line] = rule_info("Line", "RawLine:a { a }")
- Rules[:_RawLine] = rule_info("RawLine", "(< (!\"\r\" !\"\\n\" .)* Newline > | < .+ > Eof) { text }")
- Rules[:_SkipBlock] = rule_info("SkipBlock", "(HtmlBlock | (!\"\#\" !SetextBottom1 !SetextBottom2 !BlankLine RawLine)+ BlankLine* | BlankLine+ | RawLine)")
+ Rules[:_Line] = rule_info("Line", "@RawLine:a { a }")
+ Rules[:_RawLine] = rule_info("RawLine", "(< (!\"\\r\" !\"\\n\" .)* @Newline > | < .+ > @Eof) { text }")
+ Rules[:_SkipBlock] = rule_info("SkipBlock", "(HtmlBlock | (!\"\#\" !SetextBottom1 !SetextBottom2 !@BlankLine @RawLine)+ @BlankLine* | @BlankLine+ | @RawLine)")
Rules[:_ExtendedSpecialChar] = rule_info("ExtendedSpecialChar", "&{ notes? } \"^\"")
Rules[:_NoteReference] = rule_info("NoteReference", "&{ notes? } RawNoteReference:ref { note_for ref }")
- Rules[:_RawNoteReference] = rule_info("RawNoteReference", "\"[^\" < (!Newline !\"]\" .)+ > \"]\" { text }")
- Rules[:_Note] = rule_info("Note", "&{ notes? } NonindentSpace RawNoteReference:ref \":\" Sp StartList:a RawNoteBlock (&Indent RawNoteBlock:i { a.concat i })* { @footnotes[ref] = paragraph a nil }")
- Rules[:_InlineNote] = rule_info("InlineNote", "&{ notes? } \"^[\" StartList:a (!\"]\" Inline:l { a << l })+ \"]\" { ref = [:inline, @note_order.length] @footnotes[ref] = paragraph a note_for ref }")
+ Rules[:_RawNoteReference] = rule_info("RawNoteReference", "\"[^\" < (!@Newline !\"]\" .)+ > \"]\" { text }")
+ Rules[:_Note] = rule_info("Note", "&{ notes? } @NonindentSpace RawNoteReference:ref \":\" @Sp @StartList:a RawNoteBlock:i { a.concat i } (&Indent RawNoteBlock:i { a.concat i })* { @footnotes[ref] = paragraph a nil }")
+ Rules[:_InlineNote] = rule_info("InlineNote", "&{ notes? } \"^[\" @StartList:a (!\"]\" Inline:l { a << l })+ \"]\" { ref = [:inline, @note_order.length] @footnotes[ref] = paragraph a note_for ref }")
Rules[:_Notes] = rule_info("Notes", "(Note | SkipBlock)*")
- Rules[:_RawNoteBlock] = rule_info("RawNoteBlock", "StartList:a (!BlankLine OptionallyIndentedLine:l { a << l })+ < BlankLine* > { a << text } { a }")
- Rules[:_CodeFence] = rule_info("CodeFence", "&{ github? } Ticks3 (Sp StrChunk:format)? Spnl < ((!\"`\" Nonspacechar)+ | !Ticks3 \"`\"+ | Spacechar | Newline)+ > Ticks3 Sp Newline* { verbatim = RDoc::Markup::Verbatim.new text verbatim.format = format.intern if format verbatim }")
+ Rules[:_RawNoteBlock] = rule_info("RawNoteBlock", "@StartList:a (!@BlankLine OptionallyIndentedLine:l { a << l })+ < @BlankLine* > { a << text } { a }")
+ Rules[:_CodeFence] = rule_info("CodeFence", "&{ github? } Ticks3 (@Sp StrChunk:format)? Spnl < ((!\"`\" Nonspacechar)+ | !Ticks3 /`+/ | Spacechar | @Newline)+ > Ticks3 @Sp @Newline* { verbatim = RDoc::Markup::Verbatim.new text verbatim.format = format.intern if format verbatim }")
Rules[:_DefinitionList] = rule_info("DefinitionList", "&{ definition_lists? } DefinitionListItem+:list { RDoc::Markup::List.new :NOTE, *list.flatten }")
Rules[:_DefinitionListItem] = rule_info("DefinitionListItem", "DefinitionListLabel+:label DefinitionListDefinition+:defns { list_items = [] list_items << RDoc::Markup::ListItem.new(label, defns.shift) list_items.concat defns.map { |defn| RDoc::Markup::ListItem.new nil, defn } unless list_items.empty? list_items }")
- Rules[:_DefinitionListLabel] = rule_info("DefinitionListLabel", "StrChunk:label Sp Newline { label }")
- Rules[:_DefinitionListDefinition] = rule_info("DefinitionListDefinition", "NonindentSpace \":\" Space Inlines:a BlankLine+ { paragraph a }")
+ Rules[:_DefinitionListLabel] = rule_info("DefinitionListLabel", "StrChunk:label @Sp @Newline { label }")
+ Rules[:_DefinitionListDefinition] = rule_info("DefinitionListDefinition", "@NonindentSpace \":\" @Space Inlines:a @BlankLine+ { paragraph a }")
# :startdoc:
end
diff --git a/lib/rdoc/markdown/literals_1_9.rb b/lib/rdoc/markdown/literals_1_9.rb
index 5aa90c65a2..f7bfbe27a1 100644
--- a/lib/rdoc/markdown/literals_1_9.rb
+++ b/lib/rdoc/markdown/literals_1_9.rb
@@ -3,7 +3,7 @@
##
#--
-# This set of literals is for ruby 1.9 regular expressions and gives full
+# This set of literals is for Ruby 1.9 regular expressions and gives full
# unicode support.
#
# Unlike peg-markdown, this set of literals recognizes Unicode alphanumeric
@@ -23,8 +23,7 @@ class RDoc::Markdown::Literals
# Prepares for parsing +str+. If you define a custom initialize you must
# call this method before #parse
def setup_parser(str, debug=false)
- @string = str
- @pos = 0
+ set_string str, 0
@memoizations = Hash.new { |h,k| h[k] = {} }
@result = nil
@failed_rule = nil
@@ -37,7 +36,6 @@ class RDoc::Markdown::Literals
attr_reader :failing_rule_offset
attr_accessor :result, :pos
-
def current_column(target=pos)
if c = string.rindex("\n", target-1)
return target - c - 1
@@ -71,6 +69,13 @@ class RDoc::Markdown::Literals
@string[start..@pos-1]
end
+ # Sets the string and current parsing position for the parser.
+ def set_string string, pos
+ @string = string
+ @string_size = string ? string.size : 0
+ @pos = pos
+ end
+
def show_pos
width = 10
if @pos < width
@@ -177,19 +182,19 @@ class RDoc::Markdown::Literals
return nil
end
- if "".respond_to? :getbyte
+ if "".respond_to? :ord
def get_byte
- if @pos >= @string.size
+ if @pos >= @string_size
return nil
end
- s = @string.getbyte @pos
+ s = @string[@pos].ord
@pos += 1
s
end
else
def get_byte
- if @pos >= @string.size
+ if @pos >= @string_size
return nil
end
@@ -238,8 +243,7 @@ class RDoc::Markdown::Literals
old_pos = @pos
old_string = @string
- @pos = other.pos
- @string = other.string
+ set_string other.string, other.pos
begin
if val = __send__(rule, *args)
@@ -250,8 +254,7 @@ class RDoc::Markdown::Literals
end
val
ensure
- @pos = old_pos
- @string = old_string
+ set_string old_string, old_pos
end
end
diff --git a/lib/rdoc/markup.rb b/lib/rdoc/markup.rb
index bdd2064d6f..0e754ff33d 100644
--- a/lib/rdoc/markup.rb
+++ b/lib/rdoc/markup.rb
@@ -59,7 +59,7 @@
#
# require 'rdoc'
#
-# h = RDoc::Markup::ToHtml.new
+# h = RDoc::Markup::ToHtml.new(RDoc::Options.new)
#
# puts h.convert(input_string)
#
@@ -84,7 +84,7 @@
#
# markup.add_special(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)
#
-# wh = WikiHtml.new markup
+# wh = WikiHtml.new RDoc::Options.new, markup
# wh.add_tag(:STRIKE, "<strike>", "</strike>")
#
# puts "<body>#{wh.convert ARGF.read}</body>"
@@ -127,7 +127,7 @@
# left, so the amount of indentation of verbatim text is unimportant.
#
# For HTML output RDoc makes a small effort to determine if a verbatim section
-# contains ruby source code. If so, the verbatim block will be marked up as
+# contains Ruby source code. If so, the verbatim block will be marked up as
# HTML. Triggers include "def", "class", "module", "require", the "hash
# rocket"# (=>) or a block call with a parameter.
#
@@ -163,7 +163,7 @@
#
# The header's id would be:
#
-# <h1 id="method-i-do_fun_things-label-Example">Example</h3>
+# <h1 id="method-i-do_fun_things-label-Example">Example</h1>
#
# The label can be linked-to using <tt>SomeClass@Headers</tt>. See
# {Links}[RDoc::Markup@Links] for further details.
@@ -171,22 +171,13 @@
# === Rules
#
# A line starting with three or more hyphens (at the current indent)
-# generates a horizontal rule. The more hyphens, the thicker the rule
-# (within reason, and if supported by the output device).
-#
-# In the case of HTML output, three dashes generate a 1-pixel high rule,
-# four dashes result in 2 pixels, and so on. The actual height is limited
-# to 10 pixels:
+# generates a horizontal rule.
#
# ---
-# -----
-# -----------------------------------------------------
#
# produces:
#
# ---
-# -----
-# -----------------------------------------------------
#
# === Simple Lists
#
@@ -356,12 +347,18 @@
# with <tt>+</tt> like <tt>RDoc::Markup@Escaping+Text+Markup</tt>.
# Punctuation and other special characters must be escaped like CGI.escape.
#
+# The <tt>@</tt> can also be used to link to sections. If a section and a
+# heading share the same name the section is preferred for the link.
+#
# Links can also be of the form <tt>label[url]</tt>, in which case +label+ is
# used in the displayed text, and +url+ is used as the target. If +label+
# contains multiple words, put it in braces: <tt>{multi word label}[url]</tt>.
# The +url+ may be an +http:+-type link or a cross-reference to a class,
# module or method with a label.
#
+# Links with the <code>rdoc-image:</code> scheme will create an image tag for
+# HTML output. Only fully-qualified URLs are supported.
+#
# Links with the <tt>rdoc-ref:</tt> scheme will link to the referenced class,
# module, method, file, etc. If the referenced item is does not exist
# no link will be generated and <tt>rdoc-ref:</tt> will be removed from the
@@ -683,7 +680,7 @@
#
# [+:markup:+ _type_]
# Overrides the default markup type for this comment with the specified
-# markup type. For ruby files, if the first comment contains this directive
+# markup type. For Ruby files, if the first comment contains this directive
# it is applied automatically to all comments in the file.
#
# Unless you are converting between markup formats you should use a
@@ -713,7 +710,7 @@
# def some_method
# # ...
#
-# See Markup@DEVELOPERS for instructions on adding a new markup format.
+# See Markup@CONTRIBUTING for instructions on adding a new markup format.
#
# [+:include:+ _filename_]
# Include the contents of the named file at this point. This directive
diff --git a/lib/rdoc/markup/attribute_manager.rb b/lib/rdoc/markup/attribute_manager.rb
index 7ee6f423d6..ce4ac76d5b 100644
--- a/lib/rdoc/markup/attribute_manager.rb
+++ b/lib/rdoc/markup/attribute_manager.rb
@@ -130,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]
@@ -186,8 +186,9 @@ class RDoc::Markup::AttributeManager
# protect __send__, __FILE__, etc.
@str.gsub!(/__([a-z]+)__/i,
"_#{PROTECT_ATTR}_#{PROTECT_ATTR}\\1_#{PROTECT_ATTR}_#{PROTECT_ATTR}")
- @str.gsub!(/\\([#{Regexp.escape @protectable.join('')}])/,
- "\\1#{PROTECT_ATTR}")
+ @str.gsub!(/(\A|[^\\])\\([#{Regexp.escape @protectable.join}])/m,
+ "\\1\\2#{PROTECT_ATTR}")
+ @str.gsub!(/\\(\\[#{Regexp.escape @protectable.join}])/m, "\\1")
end
##
diff --git a/lib/rdoc/markup/formatter.rb b/lib/rdoc/markup/formatter.rb
index b668746c7a..7661c95239 100644
--- a/lib/rdoc/markup/formatter.rb
+++ b/lib/rdoc/markup/formatter.rb
@@ -80,7 +80,7 @@ class RDoc::Markup::Formatter
# Adds a special for links of the form rdoc-...:
def add_special_RDOCLINK
- @markup.add_special(/rdoc-[a-z]+:\S+/, :RDOCLINK)
+ @markup.add_special(/rdoc-[a-z]+:[^\s\]]+/, :RDOCLINK)
end
##
@@ -88,7 +88,7 @@ class RDoc::Markup::Formatter
def add_special_TIDYLINK
@markup.add_special(/(?:
- \{.*?\} | # multi-word label
+ \{.*?\} | # multi-word label
\b[^\s{}]+? # single-word label
)
@@ -239,7 +239,7 @@ class RDoc::Markup::Formatter
else
scheme = 'http'
path = url
- url = "http://#{url}"
+ url = url
end
if scheme == 'link' then
diff --git a/lib/rdoc/markup/heading.rb b/lib/rdoc/markup/heading.rb
index b1f372222f..535e310e54 100644
--- a/lib/rdoc/markup/heading.rb
+++ b/lib/rdoc/markup/heading.rb
@@ -48,6 +48,19 @@ RDoc::Markup::Heading =
end
##
+ # Creates a fully-qualified label which will include the label from
+ # +context+. This helps keep ids unique in HTML.
+
+ def label context = nil
+ label = aref
+
+ label = [context.aref, label].compact.join '-' if
+ context and context.respond_to? :aref
+
+ label
+ end
+
+ ##
# HTML markup of the text of this label without the surrounding header
# element.
diff --git a/lib/rdoc/markup/parser.rb b/lib/rdoc/markup/parser.rb
index 3fce2b4c3b..cc828a4513 100644
--- a/lib/rdoc/markup/parser.rb
+++ b/lib/rdoc/markup/parser.rb
@@ -389,7 +389,7 @@ class RDoc::Markup::Parser
skip :NEWLINE
when :TEXT then
unget
- parent << build_paragraph(indent)
+ parse_text parent, indent
when *LIST_TOKENS then
unget
parent << build_list(indent)
@@ -406,6 +406,13 @@ class RDoc::Markup::Parser
end
##
+ # Small hook that is overridden by RDoc::TomDoc
+
+ def parse_text parent, indent # :nodoc:
+ parent << build_paragraph(indent)
+ end
+
+ ##
# Returns the next token on the stream without modifying the stream
def peek_token
@@ -528,8 +535,8 @@ class RDoc::Markup::Parser
end
##
- # Calculates the column (by character) and line of the current token from
- # +scanner+ based on +byte_offset+.
+ # Calculates the column (by character) and line of the current token based
+ # on +byte_offset+.
def token_pos byte_offset
offset = char_pos byte_offset
diff --git a/lib/rdoc/markup/pre_process.rb b/lib/rdoc/markup/pre_process.rb
index 6024edcd27..01fb293462 100644
--- a/lib/rdoc/markup/pre_process.rb
+++ b/lib/rdoc/markup/pre_process.rb
@@ -151,7 +151,7 @@ class RDoc::Markup::PreProcess
case directive
when 'arg', 'args' then
- return blankline unless code_object
+ return "#{prefix}:#{directive}: #{param}\n" unless code_object
code_object.params = param
diff --git a/lib/rdoc/markup/to_html.rb b/lib/rdoc/markup/to_html.rb
index 37b9492e23..823b023e72 100644
--- a/lib/rdoc/markup/to_html.rb
+++ b/lib/rdoc/markup/to_html.rb
@@ -65,6 +65,30 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
#
# These methods handle special markup added by RDoc::Markup#add_special.
+ def handle_RDOCLINK url # :nodoc:
+ case url
+ when /^rdoc-ref:/
+ $'
+ when /^rdoc-label:/
+ text = $'
+
+ text = case text
+ when /\Alabel-/ then $'
+ when /\Afootmark-/ then $'
+ when /\Afoottext-/ then $'
+ else text
+ end
+
+ gen_url url, text
+ when /^rdoc-image:/
+ "<img src=\"#{$'}\">"
+ else
+ url =~ /\Ardoc-[a-z]+:/
+
+ $'
+ end
+ end
+
##
# +special+ is a <code><br></code>
@@ -100,27 +124,7 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
# when creating a link. All other contents will be linked verbatim.
def handle_special_RDOCLINK special
- url = special.text
-
- case url
- when /\Ardoc-ref:/
- $'
- when /\Ardoc-label:/
- text = $'
-
- text = case text
- when /\Alabel-/ then $'
- when /\Afootmark-/ then "^#{$'}"
- when /\Afoottext-/ then "*#{$'}"
- else text
- end
-
- gen_url url, text
- else
- url =~ /\Ardoc-[a-z]+:/
-
- $'
- end
+ handle_RDOCLINK special.text
end
##
@@ -130,10 +134,14 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
def handle_special_TIDYLINK(special)
text = special.text
- return text unless text =~ /\{(.*?)\}\[(.*?)\]/ or text =~ /(\S+)\[(.*?)\]/
+ return text unless
+ text =~ /^\{(.*)\}\[(.*?)\]$/ or text =~ /^(\S+)\[(.*?)\]$/
label = $1
url = $2
+
+ label = handle_RDOCLINK label if /^rdoc-image:/ =~ label
+
gen_url url, label
end
@@ -176,6 +184,7 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
def accept_paragraph paragraph
@res << "\n<p>"
text = paragraph.text @hard_break
+ text = text.gsub(/\r?\n/, ' ')
@res << wrap(to_html(text))
@res << "</p>\n"
end
@@ -186,28 +195,33 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
def accept_verbatim verbatim
text = verbatim.text.rstrip
- @res << if verbatim.ruby? or parseable? text then
- begin
- tokens = RDoc::RubyLex.tokenize text, @options
+ klass = nil
- html = RDoc::TokenStream.to_html tokens
+ content = if verbatim.ruby? or parseable? text then
+ begin
+ tokens = RDoc::RubyLex.tokenize text, @options
+ klass = ' class="ruby"'
- "\n<pre class=\"ruby\">#{html}</pre>\n"
- rescue RDoc::RubyLex::Error
- "\n<pre>#{CGI.escapeHTML text}</pre>\n"
+ RDoc::TokenStream.to_html tokens
+ rescue RDoc::RubyLex::Error
+ CGI.escapeHTML text
+ end
+ else
+ CGI.escapeHTML text
end
- else
- "\n<pre>#{CGI.escapeHTML text}</pre>\n"
- end
+
+ if @options.pipe then
+ @res << "\n<pre><code>#{CGI.escapeHTML text}</code></pre>\n"
+ else
+ @res << "\n<pre#{klass}>#{content}</pre>\n"
+ end
end
##
# Adds +rule+ to the output
- def accept_rule(rule)
- size = rule.weight
- size = 10 if size > 10
- @res << "<hr style=\"height: #{size}px\">\n"
+ def accept_rule rule
+ @res << "<hr>\n"
end
##
@@ -262,11 +276,13 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
def accept_heading heading
level = [6, heading.level].min
- label = heading.aref
- label = [@code_object.aref, label].compact.join '-' if
- @code_object and @code_object.respond_to? :aref
+ label = heading.label @code_object
- @res << "\n<h#{level} id=\"#{label}\">"
+ @res << if @options.output_decoration
+ "\n<h#{level} id=\"#{label}\">"
+ else
+ "\n<h#{level}>"
+ end
@res << to_html(heading.text)
unless @options.pipe then
@res << "<span><a href=\"##{label}\">&para;</a>"
@@ -302,7 +318,14 @@ class RDoc::Markup::ToHtml < RDoc::Markup::Formatter
url =~ /\.(gif|png|jpg|jpeg|bmp)$/ then
"<img src=\"#{url}\" />"
else
- "<a#{id} href=\"#{url}\">#{text.sub(%r{^#{scheme}:/*}i, '')}</a>"
+ text = text.sub %r%^#{scheme}:/*%i, ''
+ text = text.sub %r%^[*\^](\d+)$%, '\1'
+
+ link = "<a#{id} href=\"#{url}\">#{text}</a>"
+
+ link = "<sup>#{link}</sup>" if /"foot/ =~ id
+
+ link
end
end
diff --git a/lib/rdoc/markup/to_html_crossref.rb b/lib/rdoc/markup/to_html_crossref.rb
index 405f68c14f..d27e0ab627 100644
--- a/lib/rdoc/markup/to_html_crossref.rb
+++ b/lib/rdoc/markup/to_html_crossref.rb
@@ -145,6 +145,9 @@ class RDoc::Markup::ToHtmlCrossref < RDoc::Markup::ToHtml
if path =~ /#/ then
path << "-label-#{label}"
+ elsif ref.sections and
+ ref.sections.any? { |section| label == section.title } then
+ path << "##{label}"
else
path << "#label-#{label}"
end if label
diff --git a/lib/rdoc/markup/to_joined_paragraph.rb b/lib/rdoc/markup/to_joined_paragraph.rb
index 6982d86697..835841071d 100644
--- a/lib/rdoc/markup/to_joined_paragraph.rb
+++ b/lib/rdoc/markup/to_joined_paragraph.rb
@@ -47,7 +47,7 @@ class RDoc::Markup::ToJoinedParagraph < RDoc::Markup::Formatter
end
end
- # TODO use Enumerable#chunk when ruby 1.8 support is dropped
+ # TODO use Enumerable#chunk when Ruby 1.8 support is dropped
#parts = paragraph.parts.chunk do |part|
# String === part
#end.map do |string, chunk|
diff --git a/lib/rdoc/markup/to_markdown.rb b/lib/rdoc/markup/to_markdown.rb
index 62ad3ad13e..d4b15bf41b 100644
--- a/lib/rdoc/markup/to_markdown.rb
+++ b/lib/rdoc/markup/to_markdown.rb
@@ -147,15 +147,17 @@ class RDoc::Markup::ToMarkdown < RDoc::Markup::ToRdoc
def handle_rdoc_link url
case url
- when /\Ardoc-ref:/ then
+ when /^rdoc-ref:/ then
$'
- when /\Ardoc-label:footmark-(\d+)/ then
+ when /^rdoc-label:footmark-(\d+)/ then
"[^#{$1}]:"
- when /\Ardoc-label:foottext-(\d+)/ then
+ when /^rdoc-label:foottext-(\d+)/ then
"[^#{$1}]"
- when /\Ardoc-label:label-/ then
+ when /^rdoc-label:label-/ then
gen_url url, $'
- when /\Ardoc-[a-z]+:/ then
+ when /^rdoc-image:/ then
+ "![](#{$'})"
+ when /^rdoc-[a-z]+:/ then
$'
end
end
diff --git a/lib/rdoc/markup/verbatim.rb b/lib/rdoc/markup/verbatim.rb
index 3886bbe8a5..0ddde675e3 100644
--- a/lib/rdoc/markup/verbatim.rb
+++ b/lib/rdoc/markup/verbatim.rb
@@ -65,7 +65,7 @@ class RDoc::Markup::Verbatim < RDoc::Markup::Raw
end
##
- # Is this verbatim section ruby code?
+ # Is this verbatim section Ruby code?
def ruby?
@format ||= nil # TODO for older ri data, switch the tree to marshal_dump
diff --git a/lib/rdoc/method_attr.rb b/lib/rdoc/method_attr.rb
index 5021929ea0..a0ea851dc5 100644
--- a/lib/rdoc/method_attr.rb
+++ b/lib/rdoc/method_attr.rb
@@ -95,15 +95,30 @@ class RDoc::MethodAttr < RDoc::CodeObject
end
##
+ # Resets cached data for the object so it can be rebuilt by accessor methods
+
+ def initialize_copy other # :nodoc:
+ @full_name = nil
+ end
+
+ def initialize_visibility # :nodoc:
+ super
+ @see = nil
+ end
+
+ ##
# 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:
- super or self.class == other.class and full_name == other.full_name
+ equal?(other) or self.class == other.class and full_name == other.full_name
end
##
@@ -169,8 +184,8 @@ class RDoc::MethodAttr < RDoc::CodeObject
parent != kernel && !searched.include?(kernel)
searched.each do |ancestor|
- next if parent == ancestor
next if String === ancestor
+ next if parent == ancestor
other = ancestor.find_method_named('#' << name) ||
ancestor.find_attribute_named(name)
@@ -211,7 +226,7 @@ class RDoc::MethodAttr < RDoc::CodeObject
end
##
- # Attempts to sanitize the content passed by the ruby parser:
+ # Attempts to sanitize the content passed by the Ruby parser:
# remove outer parentheses, etc.
def block_params=(value)
@@ -346,7 +361,12 @@ class RDoc::MethodAttr < RDoc::CodeObject
end
def pretty_print q # :nodoc:
- alias_for = @is_alias_for ? "alias for #{@is_alias_for.name}" : nil
+ 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
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
new file mode 100644
index 0000000000..547744f870
--- /dev/null
+++ b/lib/rdoc/mixin.rb
@@ -0,0 +1,120 @@
+##
+# A Mixin adds features from a module into another context. RDoc::Include and
+# RDoc::Extend are both mixins.
+
+class RDoc::Mixin < RDoc::CodeObject
+
+ ##
+ # Name of included module
+
+ attr_accessor :name
+
+ ##
+ # Creates a new Mixin for +name+ with +comment+
+
+ def initialize(name, comment)
+ super()
+ @name = name
+ self.comment = comment
+ @module = nil # cache for module if found
+ end
+
+ ##
+ # Mixins are sorted by name
+
+ def <=> other
+ return unless self.class === other
+
+ name <=> other.name
+ end
+
+ def == other # :nodoc:
+ self.class === other and @name == other.name
+ end
+
+ alias eql? == # :nodoc:
+
+ ##
+ # Full name based on #module
+
+ def full_name
+ m = self.module
+ RDoc::ClassModule === m ? m.full_name : @name
+ end
+
+ def hash # :nodoc:
+ [@name, self.module].hash
+ end
+
+ def inspect # :nodoc:
+ "#<%s:0x%x %s.%s %s>" % [
+ self.class,
+ object_id,
+ parent_name, self.class.name.downcase, @name,
+ ]
+ end
+
+ ##
+ # Attempts to locate the included module object. Returns the name if not
+ # known.
+ #
+ # The scoping rules of Ruby to resolve the name of an included module are:
+ # - first look into the children of the current context;
+ # - if not found, look into the children of included modules,
+ # in reverse inclusion order;
+ # - if still not found, go up the hierarchy of names.
+ #
+ # This method has <code>O(n!)</code> behavior when the module calling
+ # include is referencing nonexistent modules. Avoid calling #module until
+ # after all the files are parsed. This behavior is due to ruby's constant
+ # lookup behavior.
+ #
+ # As of the beginning of October, 2011, no gem includes nonexistent modules.
+
+ def module
+ return @module if @module
+
+ # search the current context
+ return @name unless parent
+ full_name = parent.child_name(@name)
+ @module = @store.modules_hash[full_name]
+ return @module if @module
+ return @name if @name =~ /^::/
+
+ # search the includes before this one, in reverse order
+ searched = parent.includes.take_while { |i| i != self }.reverse
+ searched.each do |i|
+ inc = i.module
+ next if String === inc
+ full_name = inc.child_name(@name)
+ @module = @store.modules_hash[full_name]
+ return @module if @module
+ end
+
+ # go up the hierarchy of names
+ up = parent.parent
+ while up
+ full_name = up.child_name(@name)
+ @module = @store.modules_hash[full_name]
+ return @module if @module
+ up = up.parent
+ end
+
+ @name
+ end
+
+ ##
+ # Sets the store for this class or module and its contained code objects.
+
+ def store= store
+ super
+
+ @file = @store.add_file @file.full_name if @file
+ end
+
+ def to_s # :nodoc:
+ "#{self.class.name.downcase} #@name in: #{parent}"
+ end
+
+end
+
diff --git a/lib/rdoc/normal_class.rb b/lib/rdoc/normal_class.rb
index dd7482c37c..7589e2686c 100644
--- a/lib/rdoc/normal_class.rb
+++ b/lib/rdoc/normal_class.rb
@@ -20,6 +20,10 @@ class RDoc::NormalClass < RDoc::ClassModule
end
end
+ def aref_prefix # :nodoc:
+ 'class'
+ end
+
##
# The definition of this class, <tt>class MyClassName</tt>
diff --git a/lib/rdoc/normal_module.rb b/lib/rdoc/normal_module.rb
index cd77b1e39e..961c431ed6 100644
--- a/lib/rdoc/normal_module.rb
+++ b/lib/rdoc/normal_module.rb
@@ -3,6 +3,10 @@
class RDoc::NormalModule < RDoc::ClassModule
+ def aref_prefix # :nodoc:
+ 'module'
+ end
+
def inspect # :nodoc:
"#<%s:0x%x module %s includes: %p extends: %p attributes: %p methods: %p aliases: %p>" % [
self.class, object_id,
diff --git a/lib/rdoc/options.rb b/lib/rdoc/options.rb
index 7be43ca776..5779d35c44 100644
--- a/lib/rdoc/options.rb
+++ b/lib/rdoc/options.rb
@@ -52,6 +52,18 @@ require 'pathname'
# end
# end
#
+# Of course, RDoc::Options does not respond to +spell_dictionary+ by default
+# so you will need to add it:
+#
+# class RDoc::Options
+#
+# ##
+# # The spell dictionary used by the spell-checking plugin.
+#
+# attr_accessor :spell_dictionary
+#
+# end
+#
# == Option Validators
#
# OptionParser validators will validate and cast user input values. In
@@ -202,6 +214,16 @@ 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)
@@ -229,6 +251,10 @@ class RDoc::Options
attr_accessor :option_parser
##
+ # Output heading decorations?
+ attr_accessor :output_decoration
+
+ ##
# Directory where guides, FAQ, and other pages not associated with a class
# live. You may leave this unset if these are at the root of your project.
@@ -277,6 +303,11 @@ class RDoc::Options
attr_accessor :template_dir
##
+ # Additional template stylesheets
+
+ attr_accessor :template_stylesheets
+
+ ##
# Documentation title
attr_accessor :title
@@ -297,11 +328,14 @@ class RDoc::Options
attr_accessor :webcvs
##
- # Minimum visibility of a documented method. One of +:public+,
- # +:protected+, +:private+. May be overridden on a per-method
- # basis with the :doc: directive.
+ # Minimum visibility of a documented method. One of +:public+, +:protected+,
+ # +:private+ or +:nodoc+.
+ #
+ # The +:nodoc+ visibility ignores all directives related to visibility. The
+ # other visibilities may be overridden on a per-method basis with the :doc:
+ # directive.
- attr_accessor :visibility
+ attr_reader :visibility
def initialize # :nodoc:
init_ivars
@@ -319,12 +353,16 @@ 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
@op_dir = nil
@page_dir = nil
@pipe = false
+ @output_decoration = true
@rdoc_include = []
@root = Pathname(Dir.pwd)
@show_hash = false
@@ -333,6 +371,7 @@ class RDoc::Options
@tab_width = 8
@template = nil
@template_dir = nil
+ @template_stylesheets = []
@title = nil
@update_output_dir = true
@verbosity = 1
@@ -362,6 +401,8 @@ 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']
@@ -386,6 +427,8 @@ 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
@@ -466,6 +509,8 @@ class RDoc::Options
@op_dir ||= 'doc'
@rdoc_include << "." if @rdoc_include.empty?
+ root = @root.to_s
+ @rdoc_include << root unless @rdoc_include.include?(root)
if @exclude.nil? or Regexp === @exclude then
# done, #finish is being re-run
@@ -487,6 +532,13 @@ 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
@@ -581,6 +633,7 @@ Usage: #{opt.program_name} [options] [names...]
parsers.sort.each do |parser, regexp|
opt.banner << " - #{parser}: #{regexp.join ', '}\n"
end
+ opt.banner << " - TomDoc: Only in ruby files\n"
opt.banner << "\n The following options are deprecated:\n\n"
@@ -648,6 +701,19 @@ 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
@@ -695,17 +761,19 @@ Usage: #{opt.program_name} [options] [names...]
opt.separator nil
- opt.on("--tab-width=WIDTH", "-w", OptionParser::DecimalInteger,
+ opt.on("--tab-width=WIDTH", "-w", Integer,
"Set the width of tab characters.") do |value|
+ raise OptionParser::InvalidArgument,
+ "#{value} is an invalid tab width" if value <= 0
@tab_width = value
end
opt.separator nil
- opt.on("--visibility=VISIBILITY", "-V", RDoc::VISIBILITIES,
+ opt.on("--visibility=VISIBILITY", "-V", RDoc::VISIBILITIES + [:nodoc],
"Minimum visibility to document a method.",
- "One of 'public', 'protected' (the default)",
- "or 'private'. Can be abbreviated.") do |value|
+ "One of 'public', 'protected' (the default),",
+ "'private' or 'nodoc' (show everything)") do |value|
@visibility = value
end
@@ -861,6 +929,14 @@ Usage: #{opt.program_name} [options] [names...]
opt.separator nil
+ opt.on("--template-stylesheets=FILES", PathArray,
+ "Set (or add to) the list of files to",
+ "include with the html template.") do |value|
+ @template_stylesheets << value
+ end
+
+ opt.separator nil
+
opt.on("--title=TITLE", "-t",
"Set TITLE as the title for HTML output.") do |value|
@title = value
@@ -916,7 +992,7 @@ Usage: #{opt.program_name} [options] [names...]
check_generator
@generator_name = "ri"
- @op_dir = RDoc::RI::Paths::SITEDIR
+ @op_dir = RDoc::RI::Paths.site_dir
setup_generator
end
@@ -963,15 +1039,21 @@ Usage: #{opt.program_name} [options] [names...]
opt.separator nil
- opt.on("--verbose", "-v",
+ opt.on("--verbose", "-V",
"Display extra progress as RDoc parses") do |value|
@verbosity = 2
end
opt.separator nil
- opt.on("--help",
- "Display this help") do
+ opt.on("--version", "-v", "print the version") do
+ puts opt.version
+ exit
+ end
+
+ opt.separator nil
+
+ opt.on("--help", "-h", "Display this help") do
RDoc::RDoc::GENERATORS.each_key do |generator|
setup_generator generator
end
@@ -991,7 +1073,7 @@ Usage: #{opt.program_name} [options] [names...]
begin
opts.parse! argv
- rescue OptionParser::InvalidArgument, OptionParser::InvalidOption => e
+ rescue OptionParser::ParseError => e
if DEPRECATED[e.args.first] then
deprecated << e.args.first
elsif %w[--format --ri -r --ri-site -R].include? e.args.first then
@@ -1017,18 +1099,22 @@ Usage: #{opt.program_name} [options] [names...]
deprecated.each do |opt|
$stderr.puts 'option ' << opt << ' is deprecated: ' << DEPRECATED[opt]
end
+ end
- unless invalid.empty? then
- invalid = "invalid options: #{invalid.join ', '}"
+ unless invalid.empty? then
+ invalid = "invalid options: #{invalid.join ', '}"
- if ignore_invalid then
+ if ignore_invalid then
+ unless quiet then
$stderr.puts invalid
$stderr.puts '(invalid options are ignored)'
- else
+ end
+ else
+ unless quiet then
$stderr.puts opts
- $stderr.puts invalid
- exit 1
end
+ $stderr.puts invalid
+ exit 1
end
end
@@ -1124,6 +1210,22 @@ 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 47ecd746d0..4da7f00d3c 100644
--- a/lib/rdoc/parser.rb
+++ b/lib/rdoc/parser.rb
@@ -83,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 = "r:#{encoding}" if encoding
+ mode = "rb:#{encoding}" if encoding
s = File.open(file, mode) {|f| f.gets(nil, 1024)}
not s.valid_encoding?
@@ -218,6 +218,8 @@ class RDoc::Parser
return unless parser
+ content = remove_modeline content
+
parser.new top_level, file_name, content, options, stats
rescue SystemCallError
nil
@@ -233,6 +235,13 @@ class RDoc::Parser
end
##
+ # Removes an emacs-style modeline from the first line of the document
+
+ def self.remove_modeline content
+ content.sub(/\A.*-\*-\s*(.*?\S)\s*-\*-.*\r?\n/, '')
+ end
+
+ ##
# If there is a <tt>markup: parser_name</tt> comment at the front of the
# file, use it to determine the parser. For example:
#
@@ -259,9 +268,11 @@ class RDoc::Parser
markup = Regexp.escape markup
- RDoc::Parser.parsers.find do |_, parser|
+ _, selected = RDoc::Parser.parsers.find do |_, parser|
/^#{markup}$/i =~ parser.name.sub(/.*:/, '')
- end.last
+ end
+
+ selected
end
##
diff --git a/lib/rdoc/parser/c.rb b/lib/rdoc/parser/c.rb
index 968ca3c789..dd3ba5efdb 100644
--- a/lib/rdoc/parser/c.rb
+++ b/lib/rdoc/parser/c.rb
@@ -123,7 +123,7 @@ class RDoc::Parser::C < RDoc::Parser
include RDoc::Text
##
- # Maps C variable names to names of ruby classes or modules
+ # Maps C variable names to names of Ruby classes or modules
attr_reader :classes
@@ -139,7 +139,7 @@ class RDoc::Parser::C < RDoc::Parser
attr_reader :enclosure_dependencies
##
- # Maps C variable names to names of ruby classes (and singleton classes)
+ # Maps C variable names to names of Ruby classes (and singleton classes)
attr_reader :known_classes
@@ -150,7 +150,7 @@ class RDoc::Parser::C < RDoc::Parser
attr_reader :missing_dependencies
##
- # Maps C variable names to names of ruby singleton classes
+ # Maps C variable names to names of Ruby singleton classes
attr_reader :singleton_classes
@@ -173,6 +173,9 @@ class RDoc::Parser::C < RDoc::Parser
@classes = load_variable_map :c_class_variables
@singleton_classes = load_variable_map :c_singleton_class_variables
+ # class_variable => { function => [method, ...] }
+ @methods = Hash.new { |h, f| h[f] = Hash.new { |i, m| i[m] = [] } }
+
# missing variable => [handle_class_module arguments]
@missing_dependencies = {}
@@ -207,6 +210,47 @@ class RDoc::Parser::C < RDoc::Parser
end
##
+ # Removes duplicate call-seq entries for methods using the same
+ # implementation.
+
+ def deduplicate_call_seq
+ @methods.each do |var_name, functions|
+ class_name = @known_classes[var_name]
+ class_obj = find_class var_name, class_name
+
+ functions.each_value do |method_names|
+ next if method_names.length == 1
+
+ method_names.each do |method_name|
+ deduplicate_method_name class_obj, method_name
+ end
+ end
+ end
+ end
+
+ ##
+ # If two ruby methods share a C implementation (and comment) this
+ # deduplicates the examples in the call_seq for the method to reduce
+ # confusion in the output.
+
+ def deduplicate_method_name class_obj, method_name # :nodoc:
+ return unless
+ method = class_obj.method_list.find { |m| m.name == method_name }
+ return unless call_seq = method.call_seq
+
+ method_name = method_name[0, 1] if method_name =~ /\A\[/
+
+ entries = call_seq.split "\n"
+
+ matching = entries.select do |entry|
+ entry =~ /^\w*\.?#{Regexp.escape method_name}/ or
+ entry =~ /\s#{Regexp.escape method_name}\s/
+ end
+
+ method.call_seq = matching.join "\n"
+ end
+
+ ##
# Scans #content for rb_define_alias
def do_aliases
@@ -422,7 +466,7 @@ class RDoc::Parser::C < RDoc::Parser
)
\s*\(\s*([\w\.]+),
\s*"([^"]+)",
- \s*(?:RUBY_METHOD_FUNC\(|VALUEFUNC\()?(\w+)\)?,
+ \s*(?:RUBY_METHOD_FUNC\(|VALUEFUNC\(|\(METHOD\))?(\w+)\)?,
\s*(-?\w+)\s*\)
(?:;\s*/[*/]\s+in\s+(\w+?\.(?:cpp|c|y)))?
%xm) do |type, var_name, meth_name, function, param_count, source_file|
@@ -550,9 +594,10 @@ class RDoc::Parser::C < RDoc::Parser
\s*#{attr_name}\s*,
#{rw},.*?\)\s*;%xm then
$1
- elsif @content =~ %r%Document-attr:\s#{attr_name}\s*?\n
- ((?>.*?\*/))%xm then
- $1
+ elsif @content =~ %r%(/\*.*?(?:\s*\*\s*)?)
+ Document-attr:\s#{attr_name}\s*?\n
+ ((?>(.|\n)*?\*/))%x then
+ "#{$1}\n#{$2}"
else
''
end
@@ -566,7 +611,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*)?)
- ((?:(?:static|SWIGINTERN)\s+)?
+ ((?:(?:\w+)\s+)?
(?:intern\s+)?VALUE\s+#{meth_name}
\s*(\([^)]*\))([^;]|$))%xm then
comment = RDoc::Comment.new $1, @top_level
@@ -938,6 +983,8 @@ class RDoc::Parser::C < RDoc::Parser
class_name = @known_classes[var_name]
singleton = @singleton_classes.key? var_name
+ @methods[var_name][function] << meth_name
+
return unless class_name
class_obj = find_class var_name, class_name
@@ -1139,7 +1186,6 @@ class RDoc::Parser::C < RDoc::Parser
if hash then
args << "p#{position} = {}"
- position += 1
end
args << '&block' if block
@@ -1172,6 +1218,8 @@ class RDoc::Parser::C < RDoc::Parser
do_aliases
do_attrs
+ deduplicate_call_seq
+
@store.add_c_variables self
@top_level
diff --git a/lib/rdoc/parser/changelog.rb b/lib/rdoc/parser/changelog.rb
index 782d8f09bf..a3567c1f81 100644
--- a/lib/rdoc/parser/changelog.rb
+++ b/lib/rdoc/parser/changelog.rb
@@ -145,10 +145,14 @@ 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
- time, = entry_name.split ' ', 2
- time = Time.parse time
+ # HACK Ruby 2.1.2 and earlier raises NoMethodError if time part is absent
+ entry_name.split ' ', 2
rescue ArgumentError
- entry_name = nil
+ if /out of range/ =~ $!.message
+ Time.parse(entry_name.split(' ', 2)[0]) rescue entry_name = nil
+ else
+ entry_name = nil
+ end
end
entry_body = []
diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb
index bfddd53270..ce1083edc7 100644
--- a/lib/rdoc/parser/ruby.rb
+++ b/lib/rdoc/parser/ruby.rb
@@ -107,6 +107,9 @@ $TOKEN_DEBUG ||= nil
# ##
# # :singleton-method: some_method!
#
+# You can define arguments for metaprogrammed methods via either the
+# :call-seq:, :arg: or :args: directives.
+#
# Additionally you can mark a method as an attribute by
# using :attr:, :attr_reader:, :attr_writer: or :attr_accessor:. Just like
# for :method:, the name is optional.
@@ -165,6 +168,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
@scanner.exception_on_syntax_error = false
@prev_seek = nil
@markup = @options.markup
+ @track_visibility = :nodoc != @options.visibility
@encoding = nil
@encoding = @options.encoding if Object.const_defined? :Encoding
@@ -173,6 +177,49 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
##
+ # Retrieves the read token stream and replaces +pattern+ with +replacement+
+ # using gsub. If the result is only a ";" returns an empty string.
+
+ def get_tkread_clean pattern, replacement # :nodoc:
+ read = get_tkread.gsub(pattern, replacement).strip
+ return '' if read == ';'
+ read
+ end
+
+ ##
+ # Extracts the visibility information for the visibility token +tk+
+ # and +single+ class type identifier.
+ #
+ # 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:
+ vis_type = tk.name
+ singleton = single == SINGLE
+
+ vis =
+ case vis_type
+ when 'private' then :private
+ when 'protected' then :protected
+ when 'public' then :public
+ when 'private_class_method' then
+ singleton = true
+ :private
+ when 'public_class_method' then
+ singleton = true
+ :public
+ when 'module_function' then
+ singleton = true
+ :public
+ else
+ raise RDoc::Error, "Invalid visibility: #{tk.name}"
+ end
+
+ return vis_type, vis, singleton
+ end
+
+ ##
# Look for the first comment in a file that isn't a shebang line.
def collect_first_comment
@@ -180,6 +227,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
comment = ''
comment.force_encoding @encoding if @encoding
first_line = true
+ first_comment_tk_class = nil
tk = get_tk
@@ -192,6 +240,9 @@ 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
@@ -209,6 +260,41 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
##
+ # Consumes trailing whitespace from the token stream
+
+ def consume_trailing_spaces # :nodoc:
+ get_tkread
+ skip_tkspace false
+ end
+
+ ##
+ # Creates a new attribute in +container+ with +name+.
+
+ def create_attr container, single, name, rw, comment # :nodoc:
+ att = RDoc::Attr.new get_tkread, name, rw, comment, single == SINGLE
+ record_location att
+
+ container.add_attribute att
+ @stats.add_attribute att
+
+ att
+ end
+
+ ##
+ # Creates a module alias in +container+ at +rhs_name+ (or at the top-level
+ # for "::") with the name from +constant+.
+
+ def create_module_alias container, constant, rhs_name # :nodoc:
+ mod = if rhs_name =~ /^::/ then
+ @store.find_class_or_module rhs_name
+ else
+ container.find_module_named rhs_name
+ end
+
+ container.add_module_alias mod, constant.name, @top_level if mod
+ end
+
+ ##
# Aborts with +msg+
def error(msg)
@@ -265,10 +351,11 @@ class RDoc::Parser::Ruby < RDoc::Parser
else
c = prev_container.add_module RDoc::NormalModule, name_t.name
c.ignore unless prev_container.document_children
+ @top_level.add_to_classes_or_modules c
c
end
- container.record_location @top_level
+ record_location container
get_tk
skip_tkspace false
@@ -285,17 +372,13 @@ class RDoc::Parser::Ruby < RDoc::Parser
# Return a superclass, which can be either a constant of an expression
def get_class_specification
- tk = get_tk
- return 'self' if TkSELF === tk
- return '' if TkGVAR === tk
-
- res = ''
- while TkCOLON2 === tk or TkCOLON3 === tk or TkCONSTANT === tk do
- res += tk.name
- tk = get_tk
+ case peek_tk
+ when TkSELF then return 'self'
+ when TkGVAR then return ''
end
- unget_tk(tk)
+ res = get_constant
+
skip_tkspace false
get_tkread # empty out read buffer
@@ -326,9 +409,6 @@ class RDoc::Parser::Ruby < RDoc::Parser
tk = get_tk
end
-# if res.empty?
-# warn("Unexpected token #{tk} in constant")
-# end
unget_tk(tk)
res
end
@@ -359,6 +439,68 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
##
+ # Little hack going on here. In the statement:
+ #
+ # f = 2*(1+yield)
+ #
+ # We see the RPAREN as the next token, so we need to exit early. This still
+ # won't catch all cases (such as "a = yield + 1"
+
+ def get_end_token tk # :nodoc:
+ case tk
+ when TkLPAREN, TkfLPAREN
+ TkRPAREN
+ when TkRPAREN
+ nil
+ else
+ TkNL
+ end
+ end
+
+ ##
+ # Retrieves the method container for a singleton method.
+
+ def get_method_container container, name_t # :nodoc:
+ prev_container = container
+ container = container.find_module_named(name_t.name)
+
+ unless container then
+ constant = prev_container.constants.find do |const|
+ const.name == name_t.name
+ end
+
+ if constant then
+ parse_method_dummy prev_container
+ return
+ end
+ end
+
+ unless container then
+ # TODO seems broken, should starting at Object in @store
+ obj = name_t.name.split("::").inject(Object) do |state, item|
+ state.const_get(item)
+ end rescue nil
+
+ type = obj.class == Class ? RDoc::NormalClass : RDoc::NormalModule
+
+ unless [Class, Module].include?(obj.class) then
+ warn("Couldn't find #{name_t.name}. Assuming it's a module")
+ end
+
+ if type == RDoc::NormalClass then
+ sclass = obj.superclass ? obj.superclass.name : nil
+ container = prev_container.add_class type, name_t.name, sclass
+ else
+ container = prev_container.add_module type, name_t.name
+ end
+
+ record_location container
+ end
+
+ container
+ end
+
+ ##
# Extracts a name or symbol from the token stream.
def get_symbol_or_name
@@ -385,6 +527,20 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
end
+ def stop_at_EXPR_END # :nodoc:
+ @scanner.lex_state == :EXPR_END || !@scanner.continue
+ end
+
+ ##
+ # Marks containers between +container+ and +ancestor+ as ignored
+
+ def suppress_parents container, ancestor # :nodoc:
+ while container and container != ancestor do
+ container.suppress unless container.documented?
+ container = container.parent
+ end
+ end
+
##
# Look for directives in a normal comment block:
#
@@ -450,16 +606,11 @@ class RDoc::Parser::Ruby < RDoc::Parser
unget_tk tk
end
- att = RDoc::Attr.new get_tkread, name, rw, comment, single == SINGLE
- att.record_location @top_level
+ att = create_attr context, single, name, rw, comment
att.offset = offset
att.line = line_no
read_documentation_modifiers att, RDoc::ATTR_MODIFIERS
-
- context.add_attribute att
-
- @stats.add_attribute att
else
warn "'attr' ignored - looks like a variable"
end
@@ -480,7 +631,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
read_documentation_modifiers tmp, RDoc::ATTR_MODIFIERS
# TODO In most other places we let the context keep track of document_self
# and add found items appropriately but here we do not. I'm not sure why.
- return unless tmp.document_self
+ return if @track_visibility and not tmp.document_self
case tk.name
when "attr_reader" then rw = "R"
@@ -491,13 +642,9 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
for name in args
- att = RDoc::Attr.new get_tkread, name, rw, comment, single == SINGLE
- att.record_location @top_level
+ att = create_attr context, single, name, rw, comment
att.offset = offset
att.line = line_no
-
- context.add_attribute att
- @stats.add_attribute att
end
end
@@ -517,7 +664,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
new_name = get_symbol_or_name
- @scanner.instance_eval { @lex_state = EXPR_FNAME }
+ @scanner.lex_state = :EXPR_FNAME
skip_tkspace
if TkCOMMA === peek_tk then
@@ -533,7 +680,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
al = RDoc::Alias.new(get_tkread, old_name, new_name, comment,
single == SINGLE)
- al.record_location @top_level
+ record_location al
al.offset = offset
al.line = line_no
@@ -567,7 +714,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
when end_token
if end_token == TkRPAREN
nest -= 1
- break if @scanner.lex_state == EXPR_END and nest <= 0
+ break if @scanner.lex_state == :EXPR_END and nest <= 0
else
break unless @scanner.continue
end
@@ -579,9 +726,8 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
tk = get_tk
end
- res = get_tkread.tr("\n", " ").strip
- res = "" if res == ";"
- res
+
+ get_tkread_clean "\n", " "
end
##
@@ -594,79 +740,105 @@ class RDoc::Parser::Ruby < RDoc::Parser
declaration_context = container
container, name_t, given_name = get_class_or_module container
- case name_t
- when TkCONSTANT
- name = name_t.name
- superclass = '::Object'
-
- if given_name =~ /^::/ then
- declaration_context = @top_level
- given_name = $'
+ cls =
+ case name_t
+ when TkCONSTANT
+ parse_class_regular container, declaration_context, single,
+ name_t, given_name, comment
+ when TkLSHFT
+ case name = get_class_specification
+ when 'self', container.name
+ parse_statements container, SINGLE
+ return # don't update offset or line
+ else
+ parse_class_singleton container, name, comment
+ end
+ else
+ warn "Expected class name or '<<'. Got #{name_t.class}: #{name_t.text.inspect}"
+ return
end
- if TkLT === peek_tk then
- get_tk
- skip_tkspace
- superclass = get_class_specification
- superclass = '(unknown)' if superclass.empty?
- end
+ cls.offset = offset
+ cls.line = line_no
- cls_type = single == SINGLE ? RDoc::SingleClass : RDoc::NormalClass
- cls = declaration_context.add_class cls_type, given_name, superclass
- cls.ignore unless container.document_children
+ cls
+ end
- read_documentation_modifiers cls, RDoc::CLASS_MODIFIERS
- cls.record_location @top_level
- cls.offset = offset
- cls.line = line_no
+ ##
+ # Parses and creates a regular class
- cls.add_comment comment, @top_level
+ def parse_class_regular container, declaration_context, single, # :nodoc:
+ name_t, given_name, comment
+ superclass = '::Object'
- @top_level.add_to_classes_or_modules cls
- @stats.add_class cls
+ if given_name =~ /^::/ then
+ declaration_context = @top_level
+ given_name = $'
+ end
- parse_statements cls
- when TkLSHFT
- case name = get_class_specification
- when 'self', container.name
- parse_statements container, SINGLE
- else
- other = @store.find_class_named name
+ if TkLT === peek_tk then
+ get_tk
+ skip_tkspace
+ superclass = get_class_specification
+ superclass = '(unknown)' if superclass.empty?
+ end
- unless other then
- if name =~ /^::/ then
- name = $'
- container = @top_level
- end
+ cls_type = single == SINGLE ? RDoc::SingleClass : RDoc::NormalClass
+ cls = declaration_context.add_class cls_type, given_name, superclass
+ cls.ignore unless container.document_children
- other = container.add_module RDoc::NormalModule, name
- other.record_location @top_level
- other.offset = offset
- other.line = line_no
+ read_documentation_modifiers cls, RDoc::CLASS_MODIFIERS
+ record_location cls
- # class << $gvar
- other.ignore if name.empty?
+ cls.add_comment comment, @top_level
- other.add_comment comment, @top_level
- end
+ @top_level.add_to_classes_or_modules cls
+ @stats.add_class cls
- # notify :nodoc: all if not a constant-named class/module
- # (and remove any comment)
- unless name =~ /\A(::)?[A-Z]/ then
- other.document_self = nil
- other.document_children = false
- other.clear_comment
- end
+ suppress_parents container, declaration_context unless cls.document_self
- @top_level.add_to_classes_or_modules other
- @stats.add_class other
+ parse_statements cls
- read_documentation_modifiers other, RDoc::CLASS_MODIFIERS
- parse_statements(other, SINGLE)
+ cls
+ end
+
+ ##
+ # Parses a singleton class in +container+ with the given +name+ and
+ # +comment+.
+
+ def parse_class_singleton container, name, comment # :nodoc:
+ other = @store.find_class_named name
+
+ unless other then
+ if name =~ /^::/ then
+ name = $'
+ container = @top_level
end
- else
- warn("Expected class name or '<<'. Got #{name_t.class}: #{name_t.text.inspect}")
+
+ other = container.add_module RDoc::NormalModule, name
+ record_location other
+
+ # class << $gvar
+ other.ignore if name.empty?
+
+ other.add_comment comment, @top_level
+ end
+
+ # notify :nodoc: all if not a constant-named class/module
+ # (and remove any comment)
+ unless name =~ /\A(::)?[A-Z]/ then
+ other.document_self = nil
+ other.document_children = false
+ other.clear_comment
end
+
+ @top_level.add_to_classes_or_modules other
+ @stats.add_class other
+
+ read_documentation_modifiers other, RDoc::CLASS_MODIFIERS
+ parse_statements(other, SINGLE)
+
+ other
end
##
@@ -700,21 +872,38 @@ class RDoc::Parser::Ruby < RDoc::Parser
return false
end
+ if TkGT === peek_tk then
+ unget_tk eq_tk
+ return
+ end
+
value = ''
con = RDoc::Constant.new name, value, comment
- nest = 0
- get_tkread
- tk = get_tk
+ body = parse_constant_body container, con
- if TkGT === tk then
- unget_tk tk
- unget_tk eq_tk
- return false
- end
+ return unless body
+
+ value.replace body
+ record_location con
+ con.offset = offset
+ con.line = line_no
+ read_documentation_modifiers con, RDoc::CONSTANT_MODIFIERS
+
+ @stats.add_constant con
+ container.add_constant con
+ true
+ end
+
+ def parse_constant_body container, constant # :nodoc:
+ nest = 0
rhs_name = ''
+ get_tkread
+
+ tk = get_tk
+
loop do
case tk
when TkSEMICOLON then
@@ -725,30 +914,22 @@ class RDoc::Parser::Ruby < RDoc::Parser
when TkRPAREN, TkRBRACE, TkRBRACK, TkEND then
nest -= 1
when TkCOMMENT then
- if nest <= 0 &&
- (@scanner.lex_state == EXPR_END || !@scanner.continue) then
+ if nest <= 0 and stop_at_EXPR_END then
unget_tk tk
break
else
unget_tk tk
- read_documentation_modifiers con, RDoc::CONSTANT_MODIFIERS
+ read_documentation_modifiers constant, RDoc::CONSTANT_MODIFIERS
end
when TkCONSTANT then
rhs_name << tk.name
if nest <= 0 and TkNL === peek_tk then
- mod = if rhs_name =~ /^::/ then
- @store.find_class_or_module rhs_name
- else
- container.find_module_named rhs_name
- end
-
- container.add_module_alias mod, name, @top_level if mod
+ create_module_alias container, constant, rhs_name
break
end
when TkNL then
- if nest <= 0 &&
- (@scanner.lex_state == EXPR_END || !@scanner.continue) then
+ if nest <= 0 and stop_at_EXPR_END then
unget_tk tk
break
end
@@ -760,19 +941,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
tk = get_tk
end
- res = get_tkread.gsub(/^[ \t]+/, '').strip
- res = "" if res == ";"
-
- value.replace res
- con.record_location @top_level
- con.offset = offset
- con.line = line_no
- read_documentation_modifiers con, RDoc::CONSTANT_MODIFIERS
-
- @stats.add_constant con
- con = container.add_constant con
-
- true
+ get_tkread_clean(/^[ \t]+/, '')
end
##
@@ -789,56 +958,72 @@ class RDoc::Parser::Ruby < RDoc::Parser
singleton = !!text.sub!(/(^# +:?)(singleton-)(method:)/, '\1\3')
- # REFACTOR
- if text.sub!(/^# +:?method: *(\S*).*?\n/i, '') then
- name = $1 unless $1.empty?
+ co =
+ if text.sub!(/^# +:?method: *(\S*).*?\n/i, '') then
+ parse_comment_ghost container, text, $1, column, line_no, comment
+ elsif text.sub!(/# +:?(attr(_reader|_writer|_accessor)?): *(\S*).*?\n/i, '') then
+ parse_comment_attr container, $1, $3, comment
+ end
- meth = RDoc::GhostMethod.new get_tkread, name
- meth.record_location @top_level
- meth.singleton = singleton
- meth.offset = offset
- meth.line = line_no
+ if co then
+ co.singleton = singleton
+ co.offset = offset
+ co.line = line_no
+ end
- meth.start_collecting_tokens
- indent = TkSPACE.new 0, 1, 1
- indent.set_text " " * column
+ true
+ end
- position_comment = TkCOMMENT.new 0, line_no, 1
- position_comment.set_text "# File #{@top_level.relative_name}, line #{line_no}"
- meth.add_tokens [position_comment, NEWLINE_TOKEN, indent]
+ ##
+ # Parse a comment that is describing an attribute in +container+ with the
+ # given +name+ and +comment+.
- meth.params = ''
+ def parse_comment_attr container, type, name, comment # :nodoc:
+ return if name.empty?
- comment.normalize
- comment.extract_call_seq meth
+ rw = case type
+ when 'attr_reader' then 'R'
+ when 'attr_writer' then 'W'
+ else 'RW'
+ end
- return unless meth.name
+ create_attr container, NORMAL, name, rw, comment
+ end
- container.add_method meth
+ def parse_comment_ghost container, text, name, column, line_no, # :nodoc:
+ comment
+ name = nil if name.empty?
- meth.comment = comment
+ meth = RDoc::GhostMethod.new get_tkread, name
+ record_location meth
- @stats.add_method meth
- elsif text.sub!(/# +:?(attr(_reader|_writer|_accessor)?): *(\S*).*?\n/i, '') then
- rw = case $1
- when 'attr_reader' then 'R'
- when 'attr_writer' then 'W'
- else 'RW'
- end
+ meth.start_collecting_tokens
+ indent = TkSPACE.new 0, 1, 1
+ indent.set_text " " * column
- name = $3 unless $3.empty?
+ position_comment = TkCOMMENT.new 0, line_no, 1
+ position_comment.set_text "# File #{@top_level.relative_name}, line #{line_no}"
+ meth.add_tokens [position_comment, NEWLINE_TOKEN, indent]
+
+ meth.params =
+ if text.sub!(/^#\s+:?args?:\s*(.*?)\s*$/i, '') then
+ $1
+ else
+ ''
+ end
- # TODO authorize 'singleton-attr...'?
- att = RDoc::Attr.new get_tkread, name, rw, comment
- att.record_location @top_level
- att.offset = offset
- att.line = line_no
+ comment.normalize
+ comment.extract_call_seq meth
- container.add_attribute att
- @stats.add_attribute att
- end
+ return unless meth.name
- true
+ container.add_method meth
+
+ meth.comment = comment
+
+ @stats.add_method meth
+
+ meth
end
##
@@ -853,7 +1038,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
name, = signature.split %r%[ \(]%, 2
meth = RDoc::GhostMethod.new get_tkread, name
- meth.record_location @top_level
+ record_location meth
meth.offset = offset
meth.line = line_no
@@ -879,17 +1064,18 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
##
- # Parses an +include+ in +context+ with +comment+
+ # Parses an +include+ or +extend+, indicated by the +klass+ and adds it to
+ # +container+ # with +comment+
- def parse_include context, comment
+ def parse_extend_or_include klass, container, comment # :nodoc:
loop do
skip_tkspace_comment
name = get_constant_with_optional_parens
unless name.empty? then
- incl = context.add_include RDoc::Include.new(name, comment)
- incl.record_location @top_level
+ obj = container.add klass, name, comment
+ record_location obj
end
return unless TkCOMMA === peek_tk
@@ -899,23 +1085,40 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
##
- # Parses an +extend+ in +context+ with +comment+
-
- def parse_extend context, comment
- loop do
- skip_tkspace_comment
-
- name = get_constant_with_optional_parens
+ # Parses identifiers that can create new methods or change visibility.
+ #
+ # Returns true if the comment was not consumed.
- unless name.empty? then
- incl = context.add_extend RDoc::Extend.new(name, comment)
- incl.record_location @top_level
+ def parse_identifier container, single, tk, comment # :nodoc:
+ case tk.name
+ when 'private', 'protected', 'public', 'private_class_method',
+ 'public_class_method', 'module_function' then
+ parse_visibility container, single, tk
+ return true
+ when 'attr' then
+ parse_attr container, single, tk, comment
+ when /^attr_(reader|writer|accessor)$/ then
+ parse_attr_accessor container, single, tk, comment
+ when 'alias_method' then
+ parse_alias container, single, tk, comment
+ when 'require', 'include' then
+ # ignore
+ else
+ if comment.text =~ /\A#\#$/ then
+ case comment.text
+ when /^# +:?attr(_reader|_writer|_accessor)?:/ then
+ parse_meta_attr container, single, tk, comment
+ else
+ method = parse_meta_method container, single, tk, comment
+ method.params = container.params if
+ container.params
+ method.block_params = container.block_params if
+ container.block_params
+ end
end
-
- return unless TkCOMMA === peek_tk
-
- get_tk
end
+
+ false
end
##
@@ -966,19 +1169,10 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
if name then
- att = RDoc::Attr.new get_tkread, name, rw, comment, single == SINGLE
- att.record_location @top_level
-
- context.add_attribute att
- @stats.add_attribute att
+ att = create_attr context, single, name, rw, comment
else
args.each do |attr_name|
- att = RDoc::Attr.new(get_tkread, attr_name, rw, comment,
- single == SINGLE)
- att.record_location @top_level
-
- context.add_attribute att
- @stats.add_attribute att
+ att = create_attr context, single, attr_name, rw, comment
end
end
@@ -1001,28 +1195,12 @@ class RDoc::Parser::Ruby < RDoc::Parser
singleton = !!comment.text.sub!(/(^# +:?)(singleton-)(method:)/, '\1\3')
- if comment.text.sub!(/^# +:?method: *(\S*).*?\n/i, '') then
- name = $1 unless $1.empty?
- end
+ name = parse_meta_method_name comment, tk
- if name.nil? then
- name_t = get_tk
- case name_t
- when TkSYMBOL then
- name = name_t.text[1..-1]
- when TkSTRING then
- name = name_t.value[1..-2]
- when TkASSIGN then # ignore
- remove_token_listener self
- return
- else
- warn "unknown name token #{name_t.inspect} for meta-method '#{tk.name}'"
- name = 'unknown'
- end
- end
+ return unless name
meth = RDoc::MetaMethod.new get_tkread, name
- meth.record_location @top_level
+ record_location meth
meth.offset = offset
meth.line = line_no
meth.singleton = singleton
@@ -1038,6 +1216,46 @@ class RDoc::Parser::Ruby < RDoc::Parser
meth.add_tokens [position_comment, NEWLINE_TOKEN, indent]
meth.add_tokens @token_stream
+ parse_meta_method_params container, single, meth, tk, comment
+
+ meth.comment = comment
+
+ @stats.add_method meth
+
+ meth
+ end
+
+ ##
+ # Parses the name of a metaprogrammed method. +comment+ is used to
+ # determine the name while +tk+ is used in an error message if the name
+ # cannot be determined.
+
+ def parse_meta_method_name comment, tk # :nodoc:
+ if comment.text.sub!(/^# +:?method: *(\S*).*?\n/i, '') then
+ return $1 unless $1.empty?
+ end
+
+ name_t = get_tk
+
+ case name_t
+ when TkSYMBOL then
+ name_t.text[1..-1]
+ when TkSTRING then
+ name_t.value[1..-2]
+ when TkASSIGN then # ignore
+ remove_token_listener self
+
+ nil
+ else
+ warn "unknown name token #{name_t.inspect} for meta-method '#{tk.name}'"
+ 'unknown'
+ end
+ end
+
+ ##
+ # Parses the parameters and block for a meta-programmed method.
+
+ def parse_meta_method_params container, single, meth, tk, comment # :nodoc:
token_listener meth do
meth.params = ''
@@ -1064,20 +1282,14 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
end
end
-
- meth.comment = comment
-
- @stats.add_method meth
-
- meth
end
##
# Parses a normal method defined by +def+
def parse_method(container, single, tk, comment)
- added_container = nil
- meth = nil
+ singleton = nil
+ added_container = false
name = nil
column = tk.char_no
offset = tk.seek
@@ -1087,110 +1299,17 @@ class RDoc::Parser::Ruby < RDoc::Parser
add_token tk
token_listener self do
- @scanner.instance_eval do @lex_state = EXPR_FNAME end
-
- skip_tkspace
- name_t = get_tk
- back_tk = skip_tkspace
- meth = nil
- added_container = false
-
- case dot = get_tk
- when TkDOT, TkCOLON2 then
- @scanner.instance_eval do @lex_state = EXPR_FNAME end
- skip_tkspace
- name_t2 = get_tk
-
- case name_t
- when TkSELF, TkMOD then
- name = case name_t2
- # NOTE: work around '[' being consumed early and not being
- # re-tokenized as a TkAREF
- when TkfLBRACK then
- get_tk
- '[]'
- else
- name_t2.name
- end
- when TkCONSTANT then
- name = name_t2.name
- prev_container = container
- container = container.find_module_named(name_t.name)
-
- unless container then
- constant = prev_container.constants.find do |const|
- const.name == name_t.name
- end
-
- if constant then
- parse_method_dummy prev_container
- return
- end
- end
-
- unless container then
- added_container = true
- obj = name_t.name.split("::").inject(Object) do |state, item|
- state.const_get(item)
- end rescue nil
-
- type = obj.class == Class ? RDoc::NormalClass : RDoc::NormalModule
-
- unless [Class, Module].include?(obj.class) then
- warn("Couldn't find #{name_t.name}. Assuming it's a module")
- end
-
- if type == RDoc::NormalClass then
- sclass = obj.superclass ? obj.superclass.name : nil
- container = prev_container.add_class type, name_t.name, sclass
- else
- container = prev_container.add_module type, name_t.name
- end
-
- container.record_location @top_level
- end
- when TkIDENTIFIER, TkIVAR, TkGVAR then
- parse_method_dummy container
- return
- when TkTRUE, TkFALSE, TkNIL then
- klass_name = "#{name_t.name.capitalize}Class"
- container = @store.find_class_named klass_name
- container ||= @top_level.add_class RDoc::NormalClass, klass_name
+ prev_container = container
+ name, container, singleton = parse_method_name container
+ added_container = container != prev_container
+ end
- name = name_t2.name
- else
- warn "unexpected method name token #{name_t.inspect}"
- # break
- skip_method container
- return
- end
+ return unless name
- meth = RDoc::AnyMethod.new(get_tkread, name)
- meth.singleton = true
- else
- unget_tk dot
- back_tk.reverse_each do |token|
- unget_tk token
- end
+ meth = RDoc::AnyMethod.new get_tkread, name
+ meth.singleton = single == SINGLE ? true : singleton
- name = case name_t
- when TkSTAR, TkAMPER then
- name_t.text
- else
- unless name_t.respond_to? :name then
- warn "expected method name token, . or ::, got #{name_t.inspect}"
- skip_method container
- return
- end
- name_t.name
- end
-
- meth = RDoc::AnyMethod.new get_tkread, name
- meth.singleton = (single == SINGLE)
- end
- end
-
- meth.record_location @top_level
+ record_location meth
meth.offset = offset
meth.line = line_no
@@ -1203,11 +1322,25 @@ class RDoc::Parser::Ruby < RDoc::Parser
meth.add_tokens [token, NEWLINE_TOKEN, indent]
meth.add_tokens @token_stream
+ parse_method_params_and_body container, single, meth, added_container
+
+ comment.normalize
+ comment.extract_call_seq meth
+
+ meth.comment = comment
+
+ @stats.add_method meth
+ end
+
+ ##
+ # Parses the parameters and body of +meth+
+
+ def parse_method_params_and_body container, single, meth, added_container
token_listener meth do
- @scanner.instance_eval do @continue = false end
+ @scanner.continue = false
parse_method_parameters meth
- if meth.document_self then
+ if meth.document_self or not @track_visibility then
container.add_method meth
elsif added_container then
container.document_self = false
@@ -1216,7 +1349,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
# Having now read the method parameters and documentation modifiers, we
# now know whether we have to rename #initialize to ::new
- if name == "initialize" && !meth.singleton then
+ if meth.name == "initialize" && !meth.singleton then
if meth.dont_rename_initialize then
meth.visibility = :protected
else
@@ -1228,13 +1361,6 @@ class RDoc::Parser::Ruby < RDoc::Parser
parse_statements container, single, meth
end
-
- comment.normalize
- comment.extract_call_seq meth
-
- meth.comment = comment
-
- @stats.add_method meth
end
##
@@ -1248,26 +1374,115 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
##
+ # Parses the name of a method in +container+.
+ #
+ # Returns the method name, the container it is in (for def Foo.name) and if
+ # it is a singleton or regular method.
+
+ def parse_method_name container # :nodoc:
+ @scanner.lex_state = :EXPR_FNAME
+
+ skip_tkspace
+ name_t = get_tk
+ back_tk = skip_tkspace
+ singleton = false
+
+ case dot = get_tk
+ when TkDOT, TkCOLON2 then
+ singleton = true
+
+ name, container = parse_method_name_singleton container, name_t
+ else
+ unget_tk dot
+ back_tk.reverse_each do |token|
+ unget_tk token
+ end
+
+ name = parse_method_name_regular container, name_t
+ end
+
+ return name, container, singleton
+ end
+
+ ##
+ # For the given +container+ and initial name token +name_t+ the method name
+ # is parsed from the token stream for a regular method.
+
+ def parse_method_name_regular container, name_t # :nodoc:
+ case name_t
+ when TkSTAR, TkAMPER then
+ name_t.text
+ else
+ unless name_t.respond_to? :name then
+ warn "expected method name token, . or ::, got #{name_t.inspect}"
+ skip_method container
+ return
+ end
+ name_t.name
+ end
+ end
+
+ ##
+ # For the given +container+ and initial name token +name_t+ the method name
+ # and the new +container+ (if necessary) are parsed from the token stream
+ # for a singleton method.
+
+ def parse_method_name_singleton container, name_t # :nodoc:
+ @scanner.lex_state = :EXPR_FNAME
+ skip_tkspace
+ name_t2 = get_tk
+
+ name =
+ case name_t
+ when TkSELF, TkMOD then
+ case name_t2
+ # NOTE: work around '[' being consumed early and not being re-tokenized
+ # as a TkAREF
+ when TkfLBRACK then
+ get_tk
+ '[]'
+ else
+ name_t2.name
+ end
+ when TkCONSTANT then
+ name = name_t2.name
+
+ container = get_method_container container, name_t
+
+ return unless container
+
+ name
+ when TkIDENTIFIER, TkIVAR, TkGVAR then
+ parse_method_dummy container
+
+ nil
+ when TkTRUE, TkFALSE, TkNIL then
+ klass_name = "#{name_t.name.capitalize}Class"
+ container = @store.find_class_named klass_name
+ container ||= @top_level.add_class RDoc::NormalClass, klass_name
+
+ name_t2.name
+ else
+ warn "unexpected method name token #{name_t.inspect}"
+ # break
+ skip_method container
+
+ nil
+ end
+
+ return name, container
+ end
+
+ ##
# Extracts +yield+ parameters from +method+
def parse_method_or_yield_parameters(method = nil,
modifiers = RDoc::METHOD_MODIFIERS)
skip_tkspace false
tk = get_tk
+ end_token = get_end_token tk
+ return '' unless end_token
- # Little hack going on here. In the statement
- # f = 2*(1+yield)
- # We see the RPAREN as the next token, so we need
- # to exit early. This still won't catch all cases
- # (such as "a = yield + 1"
- end_token = case tk
- when TkLPAREN, TkfLPAREN
- TkRPAREN
- when TkRPAREN
- return ""
- else
- TkNL
- end
nest = 0
loop do
@@ -1306,9 +1521,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
tk = get_tk
end
- res = get_tkread.gsub(/\s+/, ' ').strip
- res = '' if res == ';'
- res
+ get_tkread_clean(/\s+/, ' ')
end
##
@@ -1341,13 +1554,12 @@ class RDoc::Parser::Ruby < RDoc::Parser
mod = container.add_module RDoc::NormalModule, name
mod.ignore unless container.document_children
- mod.record_location @top_level
+ record_location mod
read_documentation_modifiers mod, RDoc::CLASS_MODIFIERS
mod.add_comment comment, @top_level
parse_statements mod
- @top_level.add_to_classes_or_modules mod
@stats.add_module mod
end
@@ -1393,7 +1605,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
##
- # The core of the ruby parser.
+ # The core of the Ruby parser.
def parse_statements(container, single = NORMAL, current_method = nil,
comment = new_comment(''))
@@ -1443,6 +1655,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
look_for_directives_in container, comment
if container.done_documenting then
+ throw :eof if RDoc::TopLevel === container
container.ongoing_visibility = save_visibility
end
end
@@ -1504,42 +1717,16 @@ class RDoc::Parser::Ruby < RDoc::Parser
when TkIDENTIFIER then
if nest == 1 and current_method.nil? then
- case tk.name
- when 'private', 'protected', 'public', 'private_class_method',
- 'public_class_method', 'module_function' then
- parse_visibility container, single, tk
- keep_comment = true
- when 'attr' then
- parse_attr container, single, tk, comment
- when /^attr_(reader|writer|accessor)$/ then
- parse_attr_accessor container, single, tk, comment
- when 'alias_method' then
- parse_alias container, single, tk, comment
- when 'require', 'include' then
- # ignore
- else
- if comment.text =~ /\A#\#$/ then
- case comment.text
- when /^# +:?attr(_reader|_writer|_accessor)?:/ then
- parse_meta_attr container, single, tk, comment
- else
- method = parse_meta_method container, single, tk, comment
- method.params = container.params if
- container.params
- method.block_params = container.block_params if
- container.block_params
- end
- end
- end
+ keep_comment = parse_identifier container, single, tk, comment
end
case tk.name
when "require" then
parse_require container, comment
when "include" then
- parse_include container, comment
+ parse_extend_or_include RDoc::Include, container, comment
when "extend" then
- parse_extend container, comment
+ parse_extend_or_include RDoc::Extend, container, comment
end
when TkEND then
@@ -1570,10 +1757,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
container.block_params = nil
end
- begin
- get_tkread
- skip_tkspace false
- end while peek_tk == TkNL
+ consume_trailing_spaces
end
container.params = nil
@@ -1584,50 +1768,70 @@ class RDoc::Parser::Ruby < RDoc::Parser
# Parse up to +no+ symbol arguments
def parse_symbol_arg(no = nil)
- args = []
-
skip_tkspace_comment
case tk = get_tk
when TkLPAREN
- loop do
- skip_tkspace_comment
- if tk1 = parse_symbol_in_arg
- args.push tk1
- break if no and args.size >= no
- end
+ parse_symbol_arg_paren no
+ else
+ parse_symbol_arg_space no, tk
+ end
+ end
- skip_tkspace_comment
- case tk2 = get_tk
- when TkRPAREN
- break
- when TkCOMMA
- else
- warn("unexpected token: '#{tk2.inspect}'") if $DEBUG_RDOC
- break
- end
+ ##
+ # Parses up to +no+ symbol arguments surrounded by () and places them in
+ # +args+.
+
+ def parse_symbol_arg_paren no # :nodoc:
+ args = []
+
+ loop do
+ skip_tkspace_comment
+ if tk1 = parse_symbol_in_arg
+ args.push tk1
+ break if no and args.size >= no
end
- else
- unget_tk tk
- if tk = parse_symbol_in_arg
- args.push tk
- return args if no and args.size >= no
+
+ skip_tkspace_comment
+ case tk2 = get_tk
+ when TkRPAREN
+ break
+ when TkCOMMA
+ else
+ warn("unexpected token: '#{tk2.inspect}'") if $DEBUG_RDOC
+ break
end
+ end
- loop do
- skip_tkspace false
+ args
+ end
- tk1 = get_tk
- unless TkCOMMA === tk1 then
- unget_tk tk1
- break
- end
+ ##
+ # Parses up to +no+ symbol arguments separated by spaces and places them in
+ # +args+.
- skip_tkspace_comment
- if tk = parse_symbol_in_arg
- args.push tk
- break if no and args.size >= no
- end
+ def parse_symbol_arg_space no, tk # :nodoc:
+ args = []
+
+ unget_tk tk
+ if tk = parse_symbol_in_arg
+ args.push tk
+ return args if no and args.size >= no
+ end
+
+ loop do
+ skip_tkspace false
+
+ tk1 = get_tk
+ unless TkCOMMA === tk1 then
+ unget_tk tk1
+ break
+ end
+
+ skip_tkspace_comment
+ if tk = parse_symbol_in_arg
+ args.push tk
+ break if no and args.size >= no
end
end
@@ -1659,6 +1863,8 @@ class RDoc::Parser::Ruby < RDoc::Parser
look_for_directives_in container, comment
+ throw :eof if container.done_documenting
+
@markup = comment.format
# HACK move if to RDoc::Context#comment=
@@ -1671,26 +1877,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
# Determines the visibility in +container+ from +tk+
def parse_visibility(container, single, tk)
- singleton = (single == SINGLE)
-
- vis_type = tk.name
-
- vis = case vis_type
- when 'private' then :private
- when 'protected' then :protected
- when 'public' then :public
- when 'private_class_method' then
- singleton = true
- :private
- when 'public_class_method' then
- singleton = true
- :public
- when 'module_function' then
- singleton = true
- :public
- else
- raise RDoc::Error, "Invalid visibility: #{tk.name}"
- end
+ vis_type, vis, singleton = get_visibility_information tk, single
skip_tkspace_comment false
@@ -1703,45 +1890,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
when TkNL, TkUNLESS_MOD, TkIF_MOD, TkSEMICOLON then
container.ongoing_visibility = vis
else
- new_methods = []
-
- case vis_type
- when 'module_function' then
- args = parse_symbol_arg
- container.set_visibility_for args, :private, false
-
- container.methods_matching args do |m|
- s_m = m.dup
- s_m.record_location @top_level
- s_m.singleton = true
- new_methods << s_m
- end
- when 'public_class_method', 'private_class_method' then
- args = parse_symbol_arg
-
- container.methods_matching args, true do |m|
- if m.parent != container then
- m = m.dup
- m.record_location @top_level
- new_methods << m
- end
-
- m.visibility = vis
- end
- else
- args = parse_symbol_arg
- container.set_visibility_for args, vis, singleton
- end
-
- new_methods.each do |method|
- case method
- when RDoc::AnyMethod then
- container.add_method method
- when RDoc::Attr then
- container.add_attribute method
- end
- method.visibility = vis
- end
+ update_visibility container, vis_type, vis, singleton
end
end
@@ -1752,7 +1901,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
return if method.block_params
get_tkread
- @scanner.instance_eval { @continue = false }
+ @scanner.continue = false
method.block_params = parse_method_or_yield_parameters
end
@@ -1777,7 +1926,8 @@ class RDoc::Parser::Ruby < RDoc::Parser
tokens << tk
case tk
- when TkNL then return
+ when TkNL, TkDEF then
+ return
when TkCOMMENT then
return unless tk.text =~ /\s*:?([\w-]+):\s*(.*)/
@@ -1817,6 +1967,19 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
##
+ # Records the location of this +container+ in the file for this parser and
+ # adds it to the list of classes and modules in the file.
+
+ def record_location container # :nodoc:
+ case container
+ when RDoc::ClassModule then
+ @top_level.add_to_classes_or_modules container
+ end
+
+ container.record_location @top_level
+ end
+
+ ##
# Removes private comments from +comment+
#--
# TODO remove
@@ -1826,7 +1989,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
##
- # Scans this ruby file for ruby constructs
+ # Scans this Ruby file for Ruby constructs
def scan
reset
@@ -1874,16 +2037,11 @@ class RDoc::Parser::Ruby < RDoc::Parser
def skip_optional_do_after_expression
skip_tkspace false
tk = get_tk
- case tk
- when TkLPAREN, TkfLPAREN then
- end_token = TkRPAREN
- else
- end_token = TkNL
- end
+ end_token = get_end_token tk
b_nest = 0
nest = 0
- @scanner.instance_eval { @continue = false }
+ @scanner.continue = false
loop do
case tk
@@ -1900,7 +2058,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
when end_token then
if end_token == TkRPAREN
nest -= 1
- break if @scanner.lex_state == EXPR_END and nest.zero?
+ break if @scanner.lex_state == :EXPR_END and nest.zero?
else
break unless @scanner.continue
end
@@ -1920,7 +2078,7 @@ class RDoc::Parser::Ruby < RDoc::Parser
def skip_for_variable
skip_tkspace false
- tk = get_tk
+ get_tk
skip_tkspace false
tk = get_tk
unget_tk(tk) unless TkIN === tk
@@ -1947,6 +2105,51 @@ class RDoc::Parser::Ruby < RDoc::Parser
end
##
+ # Updates visibility in +container+ from +vis_type+ and +vis+.
+
+ def update_visibility container, vis_type, vis, singleton # :nodoc:
+ new_methods = []
+
+ case vis_type
+ when 'module_function' then
+ args = parse_symbol_arg
+ container.set_visibility_for args, :private, false
+
+ container.methods_matching args do |m|
+ s_m = m.dup
+ record_location s_m
+ s_m.singleton = true
+ new_methods << s_m
+ end
+ when 'public_class_method', 'private_class_method' then
+ args = parse_symbol_arg
+
+ container.methods_matching args, true do |m|
+ if m.parent != container then
+ m = m.dup
+ record_location m
+ new_methods << m
+ end
+
+ m.visibility = vis
+ end
+ else
+ args = parse_symbol_arg
+ container.set_visibility_for args, vis, singleton
+ end
+
+ new_methods.each do |method|
+ case method
+ when RDoc::AnyMethod then
+ container.add_method method
+ when RDoc::Attr then
+ container.add_attribute method
+ end
+ method.visibility = vis
+ end
+ end
+
+ ##
# Prints +message+ to +$stderr+ unless we're being quiet
def warn message
diff --git a/lib/rdoc/rd/block_parser.rb b/lib/rdoc/rd/block_parser.rb
index dd15e1262e..a495ca4e1e 100644
--- a/lib/rdoc/rd/block_parser.rb
+++ b/lib/rdoc/rd/block_parser.rb
@@ -1,6 +1,6 @@
#
# DO NOT MODIFY!!!!
-# This file is automatically generated by Racc 1.4.9
+# This file is automatically generated by Racc 1.4.11
# from Racc grammer file "".
#
@@ -144,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 formated
+ if @tree.filter[@in_part].mode == :rd # if output is RD formatted
subtree = parse_subtree(part_out.to_a)
- else # if output is target formated
+ else # if output is target formatted
basename = TMPFILE.join('.')
TMPFILE[-1] += 1
tmpfile = open(@tree.tmp_dir + "/" + basename + ".#{@in_part}", "w")
diff --git a/lib/rdoc/rd/inline_parser.rb b/lib/rdoc/rd/inline_parser.rb
index c3c1f4b030..80d029cc21 100644
--- a/lib/rdoc/rd/inline_parser.rb
+++ b/lib/rdoc/rd/inline_parser.rb
@@ -1,6 +1,6 @@
#
# DO NOT MODIFY!!!!
-# This file is automatically generated by Racc 1.4.9
+# This file is automatically generated by Racc 1.4.11
# from Racc grammer file "".
#
diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb
index cff5e78a20..4d45d47978 100644
--- a/lib/rdoc/rdoc.rb
+++ b/lib/rdoc/rdoc.rb
@@ -217,7 +217,7 @@ option)
end unless @options.force_output
else
FileUtils.mkdir_p dir
- FileUtils.touch output_flag_file dir
+ FileUtils.touch flag_file
end
last
@@ -289,6 +289,7 @@ option)
file_list = []
relative_files.each do |rel_file_name|
+ next if rel_file_name.end_with? 'created.rid'
next if exclude_pattern && exclude_pattern =~ rel_file_name
stat = File.stat rel_file_name rescue next
@@ -304,6 +305,9 @@ 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
@@ -335,13 +339,15 @@ option)
# Parses +filename+ and returns an RDoc::TopLevel
def parse_file filename
- if defined?(Encoding) then
+ if Object.const_defined? :Encoding then
encoding = @options.encoding
filename = filename.encode encoding
end
@stats.add_file filename
+ return if RDoc::Parser.binary? filename
+
content = RDoc::Encoding.read_file filename, encoding
return unless content
@@ -408,8 +414,6 @@ The internal error was:
return [] if file_list.empty?
- file_info = []
-
@stats.begin_adding
file_info = file_list.map do |filename|
@@ -493,7 +497,7 @@ The internal error was:
if @options.coverage_report then
puts
- puts @stats.report
+ puts @stats.report.accept RDoc::Markup::ToRdoc.new
elsif file_info.empty? then
$stderr.puts "\nNo newer files." unless @options.quiet
else
@@ -506,7 +510,7 @@ The internal error was:
if @stats and (@options.coverage_report or not @options.quiet) then
puts
- puts @stats.summary
+ puts @stats.summary.accept RDoc::Markup::ToRdoc.new
end
exit @stats.fully_documented? if @options.coverage_report
@@ -562,4 +566,5 @@ 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/ri/driver.rb b/lib/rdoc/ri/driver.rb
index 88d87f8084..39064c1384 100644
--- a/lib/rdoc/ri/driver.rb
+++ b/lib/rdoc/ri/driver.rb
@@ -197,7 +197,7 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
opt.separator nil
- opt.on("--[no-]pager", "-T",
+ opt.on("--[no-]pager",
"Send output directly to stdout,",
"rather than to a pager.") do |use_pager|
options[:use_stdout] = !use_pager
@@ -205,6 +205,13 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
opt.separator nil
+ opt.on("-T",
+ "Synonym for --no-pager") do
+ options[:use_stdout] = true
+ end
+
+ opt.separator nil
+
opt.on("--width=WIDTH", "-w", OptionParser::DecimalInteger,
"Set the width of the output.") do |width|
options[:width] = width
@@ -459,38 +466,51 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
extensions.each do |modules, store|
if modules.length == 1 then
- include = modules.first
- name = include.name
- path = store.friendly_path
- out << RDoc::Markup::Paragraph.new("#{name} (from #{path})")
-
- if include.comment then
- out << RDoc::Markup::BlankLine.new
- out << include.comment
- end
+ add_extension_modules_single out, store, modules.first
else
- out << RDoc::Markup::Paragraph.new("(from #{store.friendly_path})")
+ add_extension_modules_multiple out, store, modules
+ end
+ end
+ end
- wout, with = modules.partition { |incl| incl.comment.empty? }
+ ##
+ # Renders multiple included +modules+ from +store+ to +out+.
- out << RDoc::Markup::BlankLine.new unless with.empty?
+ def add_extension_modules_multiple out, store, modules # :nodoc:
+ out << RDoc::Markup::Paragraph.new("(from #{store.friendly_path})")
- with.each do |incl|
- out << RDoc::Markup::Paragraph.new(incl.name)
- out << RDoc::Markup::BlankLine.new
- out << incl.comment
- end
+ wout, with = modules.partition { |incl| incl.comment.empty? }
- unless wout.empty? then
- verb = RDoc::Markup::Verbatim.new
+ out << RDoc::Markup::BlankLine.new unless with.empty?
- wout.each do |incl|
- verb.push incl.name, "\n"
- end
+ with.each do |incl|
+ out << RDoc::Markup::Paragraph.new(incl.name)
+ out << RDoc::Markup::BlankLine.new
+ out << incl.comment
+ end
- out << verb
- end
+ unless wout.empty? then
+ verb = RDoc::Markup::Verbatim.new
+
+ wout.each do |incl|
+ verb.push incl.name, "\n"
end
+
+ out << verb
+ end
+ end
+
+ ##
+ # Adds a single extension module +include+ from +store+ to +out+
+
+ def add_extension_modules_single out, store, include # :nodoc:
+ name = include.name
+ path = store.friendly_path
+ out << RDoc::Markup::Paragraph.new("#{name} (from #{path})")
+
+ if include.comment then
+ out << RDoc::Markup::BlankLine.new
+ out << include.comment
end
end
@@ -596,68 +616,56 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
add_extends out, extends
found.each do |store, klass|
- comment = klass.comment
- # TODO the store's cache should always return an empty Array
- class_methods = store.class_methods[klass.full_name] || []
- instance_methods = store.instance_methods[klass.full_name] || []
- attributes = store.attributes[klass.full_name] || []
-
- if comment.empty? and
- instance_methods.empty? and class_methods.empty? then
- also_in << store
- next
- end
-
- add_from out, store
+ render_class out, store, klass, also_in
+ end
- unless comment.empty? then
- out << RDoc::Markup::Rule.new(1)
+ add_also_in out, also_in
- if comment.merged? then
- parts = comment.parts
- parts = parts.zip [RDoc::Markup::BlankLine.new] * parts.length
- parts.flatten!
- parts.pop
+ out
+ end
- out.concat parts
- else
- out << comment
- end
- end
+ ##
+ # Adds the class +comment+ to +out+.
- if class_methods or instance_methods or not klass.constants.empty? then
- out << RDoc::Markup::Rule.new(1)
- end
+ def class_document_comment out, comment # :nodoc:
+ unless comment.empty? then
+ out << RDoc::Markup::Rule.new(1)
- unless klass.constants.empty? then
- out << RDoc::Markup::Heading.new(1, "Constants:")
- out << RDoc::Markup::BlankLine.new
- list = RDoc::Markup::List.new :NOTE
+ if comment.merged? then
+ parts = comment.parts
+ parts = parts.zip [RDoc::Markup::BlankLine.new] * parts.length
+ parts.flatten!
+ parts.pop
- constants = klass.constants.sort_by { |constant| constant.name }
+ out.concat parts
+ else
+ out << comment
+ end
+ end
+ end
- list.items.concat constants.map { |constant|
- parts = constant.comment.parts if constant.comment
- parts << RDoc::Markup::Paragraph.new('[not documented]') if
- parts.empty?
+ ##
+ # Adds the constants from +klass+ to the Document +out+.
- RDoc::Markup::ListItem.new(constant.name, *parts)
- }
+ def class_document_constants out, klass # :nodoc:
+ return if klass.constants.empty?
- out << list
- out << RDoc::Markup::BlankLine.new
- end
+ out << RDoc::Markup::Heading.new(1, "Constants:")
+ out << RDoc::Markup::BlankLine.new
+ list = RDoc::Markup::List.new :NOTE
- add_method_list out, class_methods, 'Class methods'
- add_method_list out, instance_methods, 'Instance methods'
- add_method_list out, attributes, 'Attributes'
+ constants = klass.constants.sort_by { |constant| constant.name }
- add_method_documentation out, klass if @show_all
- end
+ list.items.concat constants.map { |constant|
+ parts = constant.comment.parts if constant.comment
+ parts << RDoc::Markup::Paragraph.new('[not documented]') if
+ parts.empty?
- add_also_in out, also_in
+ RDoc::Markup::ListItem.new(constant.name, *parts)
+ }
- out
+ out << list
+ out << RDoc::Markup::BlankLine.new
end
##
@@ -709,16 +717,24 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
# Completes +name+ based on the caches. For Readline
def complete name
- klasses = classes.keys
completions = []
klass, selector, method = parse_name name
+ complete_klass name, klass, selector, method, completions
+ complete_method name, klass, selector, completions
+
+ completions.sort.uniq
+ end
+
+ def complete_klass name, klass, selector, method, completions # :nodoc:
+ klasses = classes.keys
+
# may need to include Foo when given Foo::
klass_name = method ? name : klass
if name !~ /#|\./ then
- completions = klasses.grep(/^#{Regexp.escape klass_name}[^:]*$/)
+ completions.replace klasses.grep(/^#{Regexp.escape klass_name}[^:]*$/)
completions.concat klasses.grep(/^#{Regexp.escape name}[^:]*$/) if
name =~ /::$/
@@ -728,7 +744,9 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
elsif classes.key? klass_name then
completions << klass_name
end
+ end
+ def complete_method name, klass, selector, completions # :nodoc:
if completions.include? klass and name =~ /#|\.|::/ then
methods = list_methods_matching name
@@ -743,8 +761,6 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
completions.concat methods
end
-
- completions.sort.uniq
end
##
@@ -804,7 +820,7 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
true
rescue NotFoundError
matches = list_methods_matching name if name =~ /::|#|\./
- matches = classes.keys.grep(/^#{name}/) if matches.empty?
+ matches = classes.keys.grep(/^#{Regexp.escape name}/) if matches.empty?
raise if matches.empty?
@@ -1183,6 +1199,12 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
return unless method
store.load_method klass, "#{type}#{method}"
+ rescue RDoc::Store::MissingFileError => e
+ comment = RDoc::Comment.new("missing documentation at #{e.file}").parse
+
+ method = RDoc::AnyMethod.new nil, name
+ method.comment = comment
+ method
end
##
@@ -1228,30 +1250,7 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
filtered.each do |store, methods|
methods.each do |method|
- out << RDoc::Markup::Paragraph.new("(from #{store.friendly_path})")
-
- unless name =~ /^#{Regexp.escape method.parent_name}/ then
- out << RDoc::Markup::Heading.new(3, "Implementation from #{method.parent_name}")
- end
-
- out << RDoc::Markup::Rule.new(1)
-
- if method.arglists then
- arglists = method.arglists.chomp.split "\n"
- arglists = arglists.map { |line| line + "\n" }
- out << RDoc::Markup::Verbatim.new(*arglists)
- out << RDoc::Markup::Rule.new(1)
- end
-
- if method.respond_to?(:superclass_method) and method.superclass_method
- out << RDoc::Markup::BlankLine.new
- out << RDoc::Markup::Heading.new(4, "(Uses superclass method #{method.superclass_method})")
- out << RDoc::Markup::Rule.new(1)
- end
-
- out << RDoc::Markup::BlankLine.new
- out << method.comment
- out << RDoc::Markup::BlankLine.new
+ render_method out, store, method, name
end
end
@@ -1346,6 +1345,78 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
end
##
+ # Renders the +klass+ from +store+ to +out+. If the klass has no
+ # documentable items the class is added to +also_in+ instead.
+
+ def render_class out, store, klass, also_in # :nodoc:
+ comment = klass.comment
+ # TODO the store's cache should always return an empty Array
+ class_methods = store.class_methods[klass.full_name] || []
+ instance_methods = store.instance_methods[klass.full_name] || []
+ attributes = store.attributes[klass.full_name] || []
+
+ if comment.empty? and
+ instance_methods.empty? and class_methods.empty? then
+ also_in << store
+ return
+ end
+
+ add_from out, store
+
+ class_document_comment out, comment
+
+ if class_methods or instance_methods or not klass.constants.empty? then
+ out << RDoc::Markup::Rule.new(1)
+ end
+
+ class_document_constants out, klass
+
+ add_method_list out, class_methods, 'Class methods'
+ add_method_list out, instance_methods, 'Instance methods'
+ add_method_list out, attributes, 'Attributes'
+
+ add_method_documentation out, klass if @show_all
+ end
+
+ def render_method out, store, method, name # :nodoc:
+ out << RDoc::Markup::Paragraph.new("(from #{store.friendly_path})")
+
+ unless name =~ /^#{Regexp.escape method.parent_name}/ then
+ out << RDoc::Markup::Heading.new(3, "Implementation from #{method.parent_name}")
+ end
+
+ out << RDoc::Markup::Rule.new(1)
+
+ render_method_arguments out, method.arglists
+ render_method_superclass out, method
+ render_method_comment out, method
+ end
+
+ def render_method_arguments out, arglists # :nodoc:
+ return unless arglists
+
+ arglists = arglists.chomp.split "\n"
+ arglists = arglists.map { |line| line + "\n" }
+ out << RDoc::Markup::Verbatim.new(*arglists)
+ out << RDoc::Markup::Rule.new(1)
+ end
+
+ def render_method_comment out, method # :nodoc:
+ out << RDoc::Markup::BlankLine.new
+ out << method.comment
+ out << RDoc::Markup::BlankLine.new
+ end
+
+ def render_method_superclass out, method # :nodoc:
+ return unless
+ method.respond_to?(:superclass_method) and method.superclass_method
+
+ out << RDoc::Markup::BlankLine.new
+ out << RDoc::Markup::Heading.new(4, "(Uses superclass method #{method.superclass_method})")
+ out << RDoc::Markup::Rule.new(1)
+ end
+
+ ##
# Looks up and displays ri data according to the options given.
def run
@@ -1412,7 +1483,9 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
server = WEBrick::HTTPServer.new :Port => @server
- server.mount '/', RDoc::Servlet
+ extra_doc_dirs = @stores.map {|s| s.type == :extra ? s.path : nil}.compact
+
+ server.mount '/', RDoc::Servlet, nil, extra_doc_dirs
trap 'INT' do server.shutdown end
trap 'TERM' do server.shutdown end
diff --git a/lib/rdoc/ri/paths.rb b/lib/rdoc/ri/paths.rb
index d7ea285eaa..970cb91461 100644
--- a/lib/rdoc/ri/paths.rb
+++ b/lib/rdoc/ri/paths.rb
@@ -162,9 +162,9 @@ module RDoc::RI::Paths
##
# The location of ri data installed into the site dir.
#
- # Historically this was available for documentation installed by ruby
+ # Historically this was available for documentation installed by Ruby
# libraries predating RubyGems. It is unlikely to contain any content for
- # modern ruby installations.
+ # modern Ruby installations.
def self.site_dir
File.join BASE, 'site'
@@ -173,11 +173,11 @@ module RDoc::RI::Paths
##
# The location of the built-in ri data.
#
- # This data is built automatically when `make` is run when ruby is
- # installed. If you did not install ruby by hand you may need to install
+ # This data is built automatically when `make` is run when Ruby is
+ # installed. If you did not install Ruby by hand you may need to install
# the documentation yourself. Please consult the documentation for your
- # package manager or ruby installer for details. You can also use the
- # rdoc-data gem to install system ri data for common versions of ruby.
+ # package manager or Ruby installer for details. You can also use the
+ # rdoc-data gem to install system ri data for common versions of Ruby.
def self.system_dir
File.join BASE, 'system'
diff --git a/lib/rdoc/ruby_lex.rb b/lib/rdoc/ruby_lex.rb
index e6e0b41aab..91b90ab2cf 100644
--- a/lib/rdoc/ruby_lex.rb
+++ b/lib/rdoc/ruby_lex.rb
@@ -42,8 +42,8 @@ class RDoc::RubyLex
include RDoc::RubyToken
include IRB
- attr_reader :continue
- attr_reader :lex_state
+ attr_accessor :continue
+ attr_accessor :lex_state
attr_reader :reader
class << self
@@ -107,7 +107,7 @@ class RDoc::RubyLex
@here_header = false
@indent = 0
@indent_stack = []
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
@space_seen = false
@continue = false
@@ -280,7 +280,7 @@ class RDoc::RubyLex
@quoted = nil
@indent = 0
@indent_stack = []
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
@space_seen = false
@here_header = false
@@ -434,7 +434,7 @@ class RDoc::RubyLex
|op, io|
@ltype = "="
res = ''
- nil until (ch = getc) == "\n"
+ nil until getc == "\n"
until ( peek_equal?("=end") && peek(4) =~ /\s/ ) do
(ch = getc)
@@ -450,11 +450,11 @@ class RDoc::RubyLex
@OP.def_rule("\n") do |op, io|
print "\\n\n" if RDoc::RubyLex.debug?
case @lex_state
- when EXPR_BEG, EXPR_FNAME, EXPR_DOT
+ when :EXPR_BEG, :EXPR_FNAME, :EXPR_DOT
@continue = true
else
@continue = false
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
until (@indent_stack.empty? ||
[TkLPAREN, TkLBRACK, TkLBRACE,
TkfLPAREN, TkfLBRACK, TkfLBRACE].include?(@indent_stack.last))
@@ -473,25 +473,25 @@ class RDoc::RubyLex
">", ">=", ">>") do
|op, io|
case @lex_state
- when EXPR_FNAME, EXPR_DOT
- @lex_state = EXPR_ARG
+ when :EXPR_FNAME, :EXPR_DOT
+ @lex_state = :EXPR_ARG
else
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
end
Token(op)
end
@OP.def_rules("!", "!=", "!~") do
|op, io|
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
Token(op)
end
@OP.def_rules("<<") do
|op, io|
tk = nil
- if @lex_state != EXPR_END && @lex_state != EXPR_CLASS &&
- (@lex_state != EXPR_ARG || @space_seen)
+ 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 == "-")
tk = identify_here_document
@@ -500,10 +500,10 @@ class RDoc::RubyLex
unless tk
tk = Token(op)
case @lex_state
- when EXPR_FNAME, EXPR_DOT
- @lex_state = EXPR_ARG
+ when :EXPR_FNAME, :EXPR_DOT
+ @lex_state = :EXPR_ARG
else
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
end
end
tk
@@ -516,8 +516,8 @@ class RDoc::RubyLex
@OP.def_rules("`") do
|op, io|
- if @lex_state == EXPR_FNAME
- @lex_state = EXPR_END
+ if @lex_state == :EXPR_FNAME
+ @lex_state = :EXPR_END
Token(op)
else
identify_string(op)
@@ -526,61 +526,61 @@ class RDoc::RubyLex
@OP.def_rules('?') do
|op, io|
- if @lex_state == EXPR_END
- @lex_state = EXPR_BEG
+ if @lex_state == :EXPR_END
+ @lex_state = :EXPR_BEG
Token(TkQUESTION)
else
ch = getc
- if @lex_state == EXPR_ARG && ch =~ /\s/
+ if @lex_state == :EXPR_ARG && ch =~ /\s/
ungetc
- @lex_state = EXPR_BEG;
+ @lex_state = :EXPR_BEG;
Token(TkQUESTION)
else
- @lex_state = EXPR_END
- Token(TkSTRING, ch)
+ @lex_state = :EXPR_END
+ Token(TkCHAR, "?#{ch}")
end
end
end
@OP.def_rules("&", "&&", "|", "||") do
|op, io|
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
Token(op)
end
@OP.def_rules("+=", "-=", "*=", "**=",
"&=", "|=", "^=", "<<=", ">>=", "||=", "&&=") do
|op, io|
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
op =~ /^(.*)=$/
Token(TkOPASGN, $1)
end
- @OP.def_rule("+@", proc{|op, io| @lex_state == EXPR_FNAME}) do
+ @OP.def_rule("+@", proc{|op, io| @lex_state == :EXPR_FNAME}) do
|op, io|
- @lex_state = EXPR_ARG
+ @lex_state = :EXPR_ARG
Token(op)
end
- @OP.def_rule("-@", proc{|op, io| @lex_state == EXPR_FNAME}) do
+ @OP.def_rule("-@", proc{|op, io| @lex_state == :EXPR_FNAME}) do
|op, io|
- @lex_state = EXPR_ARG
+ @lex_state = :EXPR_ARG
Token(op)
end
@OP.def_rules("+", "-") do
|op, io|
catch(:RET) do
- if @lex_state == EXPR_ARG
+ if @lex_state == :EXPR_ARG
if @space_seen and peek(0) =~ /[0-9]/
throw :RET, identify_number(op)
else
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
end
- elsif @lex_state != EXPR_END and peek(0) =~ /[0-9]/
+ elsif @lex_state != :EXPR_END and peek(0) =~ /[0-9]/
throw :RET, identify_number(op)
else
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
end
Token(op)
end
@@ -588,20 +588,20 @@ class RDoc::RubyLex
@OP.def_rule(".") do
|op, io|
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
if peek(0) =~ /[0-9]/
ungetc
identify_number
else
# for "obj.if" etc.
- @lex_state = EXPR_DOT
+ @lex_state = :EXPR_DOT
Token(TkDOT)
end
end
@OP.def_rules("..", "...") do
|op, io|
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
Token(op)
end
@@ -611,7 +611,7 @@ class RDoc::RubyLex
def lex_int2
@OP.def_rules("]", "}", ")") do
|op, io|
- @lex_state = EXPR_END
+ @lex_state = :EXPR_END
@indent -= 1
@indent_stack.pop
Token(op)
@@ -619,11 +619,11 @@ class RDoc::RubyLex
@OP.def_rule(":") do
|op, io|
- if @lex_state == EXPR_END || peek(0) =~ /\s/
- @lex_state = EXPR_BEG
+ if @lex_state == :EXPR_END || peek(0) =~ /\s/
+ @lex_state = :EXPR_BEG
Token(TkCOLON)
else
- @lex_state = EXPR_FNAME;
+ @lex_state = :EXPR_FNAME;
Token(TkSYMBEG)
end
end
@@ -631,51 +631,51 @@ class RDoc::RubyLex
@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
+ if @lex_state == :EXPR_BEG or @lex_state == :EXPR_ARG && @space_seen
+ @lex_state = :EXPR_BEG
Token(TkCOLON3)
else
- @lex_state = EXPR_DOT
+ @lex_state = :EXPR_DOT
Token(TkCOLON2)
end
end
@OP.def_rule("/") do
|op, io|
- if @lex_state == EXPR_BEG || @lex_state == EXPR_MID
+ if @lex_state == :EXPR_BEG || @lex_state == :EXPR_MID
identify_string(op)
elsif peek(0) == '='
getc
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
Token(TkOPASGN, "/") #/)
- elsif @lex_state == EXPR_ARG and @space_seen and peek(0) !~ /\s/
+ elsif @lex_state == :EXPR_ARG and @space_seen and peek(0) !~ /\s/
identify_string(op)
else
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
Token("/") #/)
end
end
@OP.def_rules("^") do
|op, io|
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
Token("^")
end
# @OP.def_rules("^=") do
- # @lex_state = EXPR_BEG
+ # @lex_state = :EXPR_BEG
# Token(OP_ASGN, :^)
# end
@OP.def_rules(",") do
|op, io|
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
Token(op)
end
@OP.def_rules(";") do
|op, io|
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
until (@indent_stack.empty? ||
[TkLPAREN, TkLBRACK, TkLBRACE,
TkfLPAREN, TkfLBRACK, TkfLBRACE].include?(@indent_stack.last))
@@ -686,56 +686,56 @@ class RDoc::RubyLex
@OP.def_rule("~") do
|op, io|
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
Token("~")
end
- @OP.def_rule("~@", proc{|op, io| @lex_state == EXPR_FNAME}) do
+ @OP.def_rule("~@", proc{|op, io| @lex_state == :EXPR_FNAME}) do
|op, io|
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
Token("~")
end
@OP.def_rule("(") do
|op, io|
@indent += 1
- if @lex_state == EXPR_BEG || @lex_state == EXPR_MID
- @lex_state = EXPR_BEG
+ if @lex_state == :EXPR_BEG || @lex_state == :EXPR_MID
+ @lex_state = :EXPR_BEG
tk_c = TkfLPAREN
else
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
tk_c = TkLPAREN
end
@indent_stack.push tk_c
Token tk_c
end
- @OP.def_rule("[]", proc{|op, io| @lex_state == EXPR_FNAME}) do
+ @OP.def_rule("[]", proc{|op, io| @lex_state == :EXPR_FNAME}) do
|op, io|
- @lex_state = EXPR_ARG
+ @lex_state = :EXPR_ARG
Token("[]")
end
- @OP.def_rule("[]=", proc{|op, io| @lex_state == EXPR_FNAME}) do
+ @OP.def_rule("[]=", proc{|op, io| @lex_state == :EXPR_FNAME}) do
|op, io|
- @lex_state = EXPR_ARG
+ @lex_state = :EXPR_ARG
Token("[]=")
end
@OP.def_rule("[") do
|op, io|
@indent += 1
- if @lex_state == EXPR_FNAME
+ if @lex_state == :EXPR_FNAME
tk_c = TkfLBRACK
else
- if @lex_state == EXPR_BEG || @lex_state == EXPR_MID
+ if @lex_state == :EXPR_BEG || @lex_state == :EXPR_MID
tk_c = TkLBRACK
- elsif @lex_state == EXPR_ARG && @space_seen
+ elsif @lex_state == :EXPR_ARG && @space_seen
tk_c = TkLBRACK
else
tk_c = TkfLBRACK
end
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
end
@indent_stack.push tk_c
Token(tk_c)
@@ -744,12 +744,12 @@ class RDoc::RubyLex
@OP.def_rule("{") do
|op, io|
@indent += 1
- if @lex_state != EXPR_END && @lex_state != EXPR_ARG
+ if @lex_state != :EXPR_END && @lex_state != :EXPR_ARG
tk_c = TkLBRACE
else
tk_c = TkfLBRACE
end
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
@indent_stack.push tk_c
Token(tk_c)
end
@@ -768,15 +768,15 @@ class RDoc::RubyLex
@OP.def_rule('%') do
|op, io|
- if @lex_state == EXPR_BEG || @lex_state == EXPR_MID
+ if @lex_state == :EXPR_BEG || @lex_state == :EXPR_MID
identify_quotation
elsif peek(0) == '='
getc
Token(TkOPASGN, :%)
- elsif @lex_state == EXPR_ARG and @space_seen and peek(0) !~ /\s/
+ elsif @lex_state == :EXPR_ARG and @space_seen and peek(0) !~ /\s/
identify_quotation
else
- @lex_state = EXPR_BEG
+ @lex_state = :EXPR_BEG
Token("%") #))
end
end
@@ -799,15 +799,15 @@ class RDoc::RubyLex
# @OP.def_rule("def", proc{|op, io| /\s/ =~ io.peek(0)}) do
# |op, io|
# @indent += 1
- # @lex_state = EXPR_FNAME
- # # @lex_state = EXPR_END
+ # @lex_state = :EXPR_FNAME
+ # # @lex_state = :EXPR_END
# # until @rests[0] == "\n" or @rests[0] == ";"
# # rests.shift
# # end
# end
@OP.def_rule("_") do
- if peek_match?(/_END__/) and @lex_state == EXPR_BEG then
+ if peek_match?(/_END__/) and @lex_state == :EXPR_BEG then
6.times { getc }
Token(TkEND_OF_SCRIPT, '__END__')
else
@@ -832,7 +832,7 @@ class RDoc::RubyLex
end
def identify_gvar
- @lex_state = EXPR_END
+ @lex_state = :EXPR_END
case ch = getc
when /[~_*$?!@\/\\;,=:<>".]/ #"
@@ -888,32 +888,33 @@ class RDoc::RubyLex
when /^\$/
return Token(TkGVAR, token)
when /^\@\@/
- @lex_state = EXPR_END
+ @lex_state = :EXPR_END
# p Token(TkCVAR, token)
return Token(TkCVAR, token)
when /^\@/
- @lex_state = EXPR_END
+ @lex_state = :EXPR_END
return Token(TkIVAR, token)
end
- if @lex_state != EXPR_DOT
+ if @lex_state != :EXPR_DOT
print token, "\n" if RDoc::RubyLex.debug?
token_c, *trans = TkReading2Token[token]
if token_c
# reserved word?
- if (@lex_state != EXPR_BEG &&
- @lex_state != EXPR_FNAME &&
+ 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 @lex_state != :EXPR_FNAME
if ENINDENT_CLAUSE.include?(token)
+ valid = peek(0) != ':'
+
# check for ``class = val'' etc.
- valid = true
case token
when "class"
valid = false unless peek_match?(/^\s*(<<|\w|::)/)
@@ -925,7 +926,8 @@ class RDoc::RubyLex
valid = false if peek_match?(/^\s*([+-\/*]?=|\*|<|>|\&|\|)/)
else
# no nothing
- end
+ end if valid
+
if valid
if token == "do"
if ![TkFOR, TkWHILE, TkUNTIL].include?(@indent_stack.last)
@@ -946,23 +948,23 @@ class RDoc::RubyLex
end
@lex_state = trans[0]
else
- @lex_state = EXPR_END
+ @lex_state = :EXPR_END
end
end
return Token(token_c, token)
end
end
- if @lex_state == EXPR_FNAME
- @lex_state = EXPR_END
+ if @lex_state == :EXPR_FNAME
+ @lex_state = :EXPR_END
if peek(0) == '='
token.concat getc
end
- elsif @lex_state == EXPR_BEG || @lex_state == EXPR_DOT ||
- @lex_state == EXPR_ARG
- @lex_state = EXPR_ARG
+ elsif @lex_state == :EXPR_BEG || @lex_state == :EXPR_DOT ||
+ @lex_state == :EXPR_ARG
+ @lex_state = :EXPR_ARG
else
- @lex_state = EXPR_END
+ @lex_state = :EXPR_END
end
if token[0, 1] =~ /[A-Z]/
@@ -1028,6 +1030,8 @@ class RDoc::RubyLex
end
if output_heredoc then
+ raise Error, "Missing terminating #{quoted} for string" unless l
+
doc << l.chomp
else
doc << '"'
@@ -1041,7 +1045,7 @@ class RDoc::RubyLex
token_class = output_heredoc ? RDoc::RubyLex::TkHEREDOC : Ltype2Token[lt]
@ltype = ltback
- @lex_state = EXPR_END
+ @lex_state = :EXPR_END
Token(token_class, doc)
end
@@ -1065,7 +1069,7 @@ class RDoc::RubyLex
end
def identify_number(op = "")
- @lex_state = EXPR_END
+ @lex_state = :EXPR_END
num = op
@@ -1180,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]}"
+ "%#{type or PERCENT_LTYPE.key ltype}#{PERCENT_PAREN_REV[quoted]||quoted}"
else
- "%#{type or PERCENT_LTYPE.index ltype}#{PERCENT_PAREN_REV[quoted]}"
+ "%#{type or PERCENT_LTYPE.index ltype}#{PERCENT_PAREN_REV[quoted]||quoted}"
end
subtype = nil
@@ -1227,8 +1231,8 @@ class RDoc::RubyLex
end
if @ltype == "/"
- if peek(0) =~ /i|m|x|o|e|s|u|n/
- getc
+ while peek(0) =~ /i|m|x|o|e|s|u|n/
+ str << getc
end
end
@@ -1240,7 +1244,7 @@ class RDoc::RubyLex
ensure
@ltype = nil
@quoted = nil
- @lex_state = EXPR_END
+ @lex_state = :EXPR_END
end
end
@@ -1283,18 +1287,19 @@ class RDoc::RubyLex
def read_escape
escape = ''
ch = getc
- escape << ch
case ch
when "\n", "\r", "\f"
+ escape << ch
when "\\", "n", "t", "r", "f", "v", "a", "e", "b", "s" #"
+ escape << ch
when /[0-7]/
ungetc ch
3.times do
ch = getc
- escape << ch
case ch
when /[0-7]/
+ escape << ch
when nil
break
else
@@ -1304,11 +1309,13 @@ class RDoc::RubyLex
end
when "x"
+ escape << ch
+
2.times do
ch = getc
- escape << ch
case ch
when /[0-9a-fA-F]/
+ escape << ch
when nil
break
else
@@ -1318,26 +1325,44 @@ class RDoc::RubyLex
end
when "M"
- ch = getc
escape << ch
+
+ ch = getc
if ch != '-'
ungetc
else
- ch = getc
escape << ch
+
+ ch = getc
if ch == "\\" #"
+ ungetc
escape << read_escape
+ else
+ escape << ch
end
end
when "C", "c" #, "^"
- if ch == "C" and (ch = getc) != "-"
- escape << ch
- ungetc
+ escape << ch
+
+ if ch == "C"
+ ch = getc
+
+ if ch == "-"
+ escape << ch
+ ch = getc
+ escape << ch
+
+ escape << read_escape if ch == "\\"
+ else
+ ungetc
+ end
elsif (ch = getc) == "\\" #"
escape << ch << read_escape
end
else
+ escape << ch
+
# other characters
end
diff --git a/lib/rdoc/ruby_token.rb b/lib/rdoc/ruby_token.rb
index 7878e4c22a..f091e1a676 100644
--- a/lib/rdoc/ruby_token.rb
+++ b/lib/rdoc/ruby_token.rb
@@ -38,9 +38,9 @@ module RDoc::RubyToken
@text = text
end
- attr :seek
- attr :line_no
- attr :char_no
+ attr_reader :seek
+ attr_reader :line_no
+ attr_reader :char_no
attr_accessor :text
@@ -73,7 +73,7 @@ module RDoc::RubyToken
@node = node
end
- attr :node
+ attr_reader:node
def ==(other)
self.class == other.class and
@@ -101,7 +101,7 @@ module RDoc::RubyToken
super(seek, line_no, char_no)
@name = name
end
- attr :name
+ attr_reader:name
def ==(other)
self.class == other.class and
@@ -192,7 +192,7 @@ module RDoc::RubyToken
@text = nil
end
- attr :op
+ attr_reader:op
def ==(other)
self.class == other.class and
@@ -217,7 +217,7 @@ module RDoc::RubyToken
super(seek, line_no, char_no)
@name = name
end
- attr :name
+ attr_reader:name
def ==(other)
self.class == other.class and
@@ -276,50 +276,50 @@ module RDoc::RubyToken
end
TokenDefinitions = [
- [:TkCLASS, TkKW, "class", EXPR_CLASS],
- [:TkMODULE, TkKW, "module", EXPR_BEG],
- [:TkDEF, TkKW, "def", EXPR_FNAME],
- [:TkUNDEF, TkKW, "undef", EXPR_FNAME],
- [:TkBEGIN, TkKW, "begin", EXPR_BEG],
- [:TkRESCUE, TkKW, "rescue", EXPR_MID],
- [:TkENSURE, TkKW, "ensure", EXPR_BEG],
- [:TkEND, TkKW, "end", EXPR_END],
- [:TkIF, TkKW, "if", EXPR_BEG, :TkIF_MOD],
- [:TkUNLESS, TkKW, "unless", EXPR_BEG, :TkUNLESS_MOD],
- [:TkTHEN, TkKW, "then", EXPR_BEG],
- [:TkELSIF, TkKW, "elsif", EXPR_BEG],
- [:TkELSE, TkKW, "else", EXPR_BEG],
- [:TkCASE, TkKW, "case", EXPR_BEG],
- [:TkWHEN, TkKW, "when", EXPR_BEG],
- [:TkWHILE, TkKW, "while", EXPR_BEG, :TkWHILE_MOD],
- [:TkUNTIL, TkKW, "until", EXPR_BEG, :TkUNTIL_MOD],
- [:TkFOR, TkKW, "for", EXPR_BEG],
- [:TkBREAK, TkKW, "break", EXPR_MID],
- [:TkNEXT, TkKW, "next", EXPR_END],
- [:TkREDO, TkKW, "redo", EXPR_END],
- [:TkRETRY, TkKW, "retry", EXPR_END],
- [:TkIN, TkKW, "in", EXPR_BEG],
- [:TkDO, TkKW, "do", EXPR_BEG],
- [:TkRETURN, TkKW, "return", EXPR_MID],
- [:TkYIELD, TkKW, "yield", EXPR_END],
- [:TkSUPER, TkKW, "super", EXPR_END],
- [:TkSELF, TkKW, "self", EXPR_END],
- [:TkNIL, TkKW, "nil", EXPR_END],
- [:TkTRUE, TkKW, "true", EXPR_END],
- [:TkFALSE, TkKW, "false", EXPR_END],
- [:TkAND, TkKW, "and", EXPR_BEG],
- [:TkOR, TkKW, "or", EXPR_BEG],
- [:TkNOT, TkKW, "not", EXPR_BEG],
+ [:TkCLASS, TkKW, "class", :EXPR_CLASS],
+ [:TkMODULE, TkKW, "module", :EXPR_BEG],
+ [:TkDEF, TkKW, "def", :EXPR_FNAME],
+ [:TkUNDEF, TkKW, "undef", :EXPR_FNAME],
+ [:TkBEGIN, TkKW, "begin", :EXPR_BEG],
+ [:TkRESCUE, TkKW, "rescue", :EXPR_MID],
+ [:TkENSURE, TkKW, "ensure", :EXPR_BEG],
+ [:TkEND, TkKW, "end", :EXPR_END],
+ [:TkIF, TkKW, "if", :EXPR_BEG, :TkIF_MOD],
+ [:TkUNLESS, TkKW, "unless", :EXPR_BEG, :TkUNLESS_MOD],
+ [:TkTHEN, TkKW, "then", :EXPR_BEG],
+ [:TkELSIF, TkKW, "elsif", :EXPR_BEG],
+ [:TkELSE, TkKW, "else", :EXPR_BEG],
+ [:TkCASE, TkKW, "case", :EXPR_BEG],
+ [:TkWHEN, TkKW, "when", :EXPR_BEG],
+ [:TkWHILE, TkKW, "while", :EXPR_BEG, :TkWHILE_MOD],
+ [:TkUNTIL, TkKW, "until", :EXPR_BEG, :TkUNTIL_MOD],
+ [:TkFOR, TkKW, "for", :EXPR_BEG],
+ [:TkBREAK, TkKW, "break", :EXPR_MID],
+ [:TkNEXT, TkKW, "next", :EXPR_END],
+ [:TkREDO, TkKW, "redo", :EXPR_END],
+ [:TkRETRY, TkKW, "retry", :EXPR_END],
+ [:TkIN, TkKW, "in", :EXPR_BEG],
+ [:TkDO, TkKW, "do", :EXPR_BEG],
+ [:TkRETURN, TkKW, "return", :EXPR_MID],
+ [:TkYIELD, TkKW, "yield", :EXPR_END],
+ [:TkSUPER, TkKW, "super", :EXPR_END],
+ [:TkSELF, TkKW, "self", :EXPR_END],
+ [:TkNIL, TkKW, "nil", :EXPR_END],
+ [:TkTRUE, TkKW, "true", :EXPR_END],
+ [:TkFALSE, TkKW, "false", :EXPR_END],
+ [:TkAND, TkKW, "and", :EXPR_BEG],
+ [:TkOR, TkKW, "or", :EXPR_BEG],
+ [:TkNOT, TkKW, "not", :EXPR_BEG],
[:TkIF_MOD, TkKW],
[:TkUNLESS_MOD, TkKW],
[:TkWHILE_MOD, TkKW],
[:TkUNTIL_MOD, TkKW],
- [:TkALIAS, TkKW, "alias", EXPR_FNAME],
- [:TkDEFINED, TkKW, "defined?", EXPR_END],
- [:TklBEGIN, TkKW, "BEGIN", EXPR_END],
- [:TklEND, TkKW, "END", EXPR_END],
- [:Tk__LINE__, TkKW, "__LINE__", EXPR_END],
- [:Tk__FILE__, TkKW, "__FILE__", EXPR_END],
+ [:TkALIAS, TkKW, "alias", :EXPR_FNAME],
+ [:TkDEFINED, TkKW, "defined?", :EXPR_END],
+ [:TklBEGIN, TkKW, "BEGIN", :EXPR_END],
+ [:TklEND, TkKW, "END", :EXPR_END],
+ [:Tk__LINE__, TkKW, "__LINE__", :EXPR_END],
+ [:Tk__FILE__, TkKW, "__FILE__", :EXPR_END],
[:TkIDENTIFIER, TkId],
[:TkFID, TkId],
@@ -335,6 +335,7 @@ module RDoc::RubyToken
[:TkXSTRING, TkVal],
[:TkREGEXP, TkVal],
[:TkSYMBOL, TkVal],
+ [:TkCHAR, TkVal],
[:TkDSTRING, TkNode],
[:TkDXSTRING, TkNode],
diff --git a/lib/rdoc/rubygems_hook.rb b/lib/rdoc/rubygems_hook.rb
index f001c6d66c..c4eaddbd97 100644
--- a/lib/rdoc/rubygems_hook.rb
+++ b/lib/rdoc/rubygems_hook.rb
@@ -12,6 +12,7 @@ require 'rdoc'
class RDoc::RubygemsHook
include Gem::UserInteraction
+ extend Gem::UserInteraction
@rdoc_version = nil
@specs = []
@@ -45,7 +46,8 @@ class RDoc::RubygemsHook
# +specs+
def self.generation_hook installer, specs
- types = installer.document
+ start = Time.now
+ types = installer.document
generate_rdoc = types.include? 'rdoc'
generate_ri = types.include? 'ri'
@@ -53,6 +55,13 @@ class RDoc::RubygemsHook
specs.each do |spec|
new(spec, generate_rdoc, generate_ri).generate
end
+
+ return unless generate_rdoc or generate_ri
+
+ duration = (Time.now - start).to_i
+ names = specs.map(&:name).join ', '
+
+ say "Done installing documentation for #{names} after #{duration} seconds"
end
##
@@ -144,7 +153,13 @@ class RDoc::RubygemsHook
options = nil
args = @spec.rdoc_options
- args.concat @spec.require_paths
+
+ if @spec.respond_to? :source_paths then
+ args.concat @spec.source_paths
+ else
+ args.concat @spec.require_paths
+ end
+
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 1dca7596db..ec8fd739f1 100644
--- a/lib/rdoc/servlet.rb
+++ b/lib/rdoc/servlet.rb
@@ -53,14 +53,17 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet
#
# Use +mount_path+ when mounting the servlet somewhere other than /.
#
+ # Use +extra_doc_dirs+ for additional documentation directories.
+ #
# +server+ is provided automatically by WEBrick when mounting. +stores+ and
# +cache+ are provided automatically by the servlet.
- def initialize server, stores, cache, mount_path = nil
+ def initialize server, stores, cache, mount_path = nil, extra_doc_dirs = []
super server
@cache = cache
@mount_path = mount_path
+ @extra_doc_dirs = extra_doc_dirs
@stores = stores
@options = RDoc::Options.new
@@ -121,6 +124,10 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet
else
show_documentation req, res
end
+ rescue WEBrick::HTTPStatus::NotFound => e
+ generator = generator_for RDoc::Store.new
+
+ not_found generator, req, res, e.message
rescue WEBrick::HTTPStatus::Status
raise
rescue => e
@@ -270,6 +277,7 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
# and the filesystem to the RDoc::Store for the documentation.
def installed_docs
+ extra_counter = 0
ri_paths.map do |path, type|
store = RDoc::Store.new path, type
exists = File.exist? store.cache_path
@@ -284,6 +292,11 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
['Site Documentation', 'site/', exists, type, path]
when :home then
['Home Documentation', 'home/', exists, type, path]
+ when :extra then
+ extra_counter += 1
+ store.load_cache if exists
+ title = store.title || "Extra Documentation"
+ [title, "extra-#{extra_counter}/", exists, type, path]
end
end
end
@@ -291,8 +304,9 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
##
# Returns a 404 page built by +generator+ for +req+ on +res+.
- def not_found generator, req, res
- res.body = generator.generate_servlet_not_found req.path
+ def not_found generator, req, res, message = nil
+ message ||= "The page <kbd>#{ERB::Util.h req.path}</kbd> was not found"
+ res.body = generator.generate_servlet_not_found message
res.status = 404
end
@@ -300,7 +314,7 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
# Enumerates the ri paths. See RDoc::RI::Paths#each
def ri_paths &block
- RDoc::RI::Paths.each true, true, true, :all, &block
+ RDoc::RI::Paths.each true, true, true, :all, *@extra_doc_dirs, &block #TODO: pass extra_dirs
end
##
@@ -344,6 +358,8 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
when :home then
path = 'home'
comment = 'Documentation from your home directory'
+ when :extra
+ comment = name
end
info << [name, '', path, '', comment]
@@ -397,6 +413,10 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
RDoc::Store.new RDoc::RI::Paths.system_dir, :system
when 'site' then
RDoc::Store.new RDoc::RI::Paths.site_dir, :site
+ when /^extra-(\d+)$/ then
+ index = $1.to_i - 1
+ ri_dir = installed_docs[index][4]
+ RDoc::Store.new ri_dir, :extra
else
ri_dir, type = ri_paths.find do |dir, dir_type|
next unless dir_type == :gem
@@ -404,11 +424,16 @@ version. If you're viewing Ruby's documentation, include the version of ruby.
source_name == dir[%r%/([^/]*)/ri$%, 1]
end
- raise RDoc::Error,
- "could not find ri documentation for #{source_name}" unless
- ri_dir
+ raise WEBrick::HTTPStatus::NotFound,
+ "Could not find gem \"#{source_name}\". Are you sure you installed it?" unless ri_dir
+
+ store = RDoc::Store.new ri_dir, type
+
+ return store if File.exist? store.cache_path
+
+ raise WEBrick::HTTPStatus::NotFound,
+ "Could not find documentation for \"#{source_name}\". Please run `gem rdoc --ri gem_name`"
- RDoc::Store.new ri_dir, type
end
end
diff --git a/lib/rdoc/stats.rb b/lib/rdoc/stats.rb
index 4fa519d243..b5a21915b4 100644
--- a/lib/rdoc/stats.rb
+++ b/lib/rdoc/stats.rb
@@ -187,12 +187,12 @@ class RDoc::Stats
# A report that says you did a great job!
def great_job
- report = []
- report << '100% documentation!'
- report << nil
- report << 'Great Job!'
+ report = RDoc::Markup::Document.new
+
+ report << RDoc::Markup::Paragraph.new('100% documentation!')
+ report << RDoc::Markup::Paragraph.new('Great Job!')
- report.join "\n"
+ report
end
##
@@ -217,8 +217,6 @@ class RDoc::Stats
extend RDoc::Text
end
- report = []
-
if @coverage_level.zero? then
calculate
@@ -227,14 +225,20 @@ class RDoc::Stats
ucm = @store.unique_classes_and_modules
+ report = RDoc::Markup::Document.new
+ report << RDoc::Markup::Paragraph.new('The following items are not documented:')
+ report << RDoc::Markup::BlankLine.new
+
ucm.sort.each do |cm|
- report << report_class_module(cm) {
+ body = report_class_module(cm) {
[
report_constants(cm),
report_attributes(cm),
report_methods(cm),
].compact
}
+
+ report << body if body
end
if @coverage_level > 0 then
@@ -243,10 +247,7 @@ class RDoc::Stats
return great_job if @num_items == @doc_items
end
- report.unshift nil
- report.unshift 'The following items are not documented:'
-
- report.join "\n"
+ report
end
##
@@ -260,7 +261,8 @@ class RDoc::Stats
cm.each_attribute do |attr|
next if attr.documented?
line = attr.line ? ":#{attr.line}" : nil
- report << " #{attr.definition} :#{attr.name} # in file #{attr.file.full_name}#{line}"
+ report << " #{attr.definition} :#{attr.name} # in file #{attr.file.full_name}#{line}\n"
+ report << "\n"
end
report
@@ -273,38 +275,47 @@ class RDoc::Stats
return if cm.fully_documented? and @coverage_level.zero?
return unless cm.display?
- report = []
+ report = RDoc::Markup::Document.new
if cm.in_files.empty? then
- report << "# #{cm.definition} is referenced but empty."
- report << "#"
- report << "# It probably came from another project. I'm sorry I'm holding it against you."
- report << nil
+ report << RDoc::Markup::Paragraph.new("#{cm.definition} is referenced but empty.")
+ report << RDoc::Markup::Paragraph.new("It probably came from another project. I'm sorry I'm holding it against you.")
return report
elsif cm.documented? then
documented = true
- report << "#{cm.definition} # is documented"
+ klass = RDoc::Markup::Verbatim.new("#{cm.definition} # is documented\n")
else
- report << '# in files:'
+ report << RDoc::Markup::Paragraph.new('In files:')
+
+ list = RDoc::Markup::List.new :BULLET
cm.in_files.each do |file|
- report << "# #{file.full_name}"
+ para = RDoc::Markup::Paragraph.new file.full_name
+ list << RDoc::Markup::ListItem.new(nil, para)
end
- report << nil
+ report << list
+ report << RDoc::Markup::BlankLine.new
- report << "#{cm.definition}"
+ klass = RDoc::Markup::Verbatim.new("#{cm.definition}\n")
end
+ klass << "\n"
+
body = yield.flatten # HACK remove #flatten
- return if body.empty? and documented
+ if body.empty? then
+ return if documented
+
+ klass.parts.pop
+ else
+ klass.parts.concat body
+ end
- report << nil << body unless body.empty?
+ klass << "end\n"
- report << 'end'
- report << nil
+ report << klass
report
end
@@ -323,8 +334,9 @@ class RDoc::Stats
next if constant.documented? || constant.is_alias_for
line = constant.line ? ":#{constant.line}" : line
- report << " # in file #{constant.file.full_name}#{line}"
- report << " #{constant.name} = nil"
+ report << " # in file #{constant.file.full_name}#{line}\n"
+ report << " #{constant.name} = nil\n"
+ report << "\n"
end
report
@@ -350,7 +362,7 @@ class RDoc::Stats
@undoc_params += undoc.length
undoc = undoc.map do |param| "+#{param}+" end
- param_report = " # #{undoc.join ', '} is not documented"
+ param_report = " # #{undoc.join ', '} is not documented\n"
end
end
@@ -359,10 +371,10 @@ class RDoc::Stats
line = method.line ? ":#{method.line}" : nil
scope = method.singleton ? 'self.' : nil
- report << " # in file #{method.file.full_name}#{line}"
+ report << " # in file #{method.file.full_name}#{line}\n"
report << param_report if param_report
- report << " def #{scope}#{method.name}#{method.params}; end"
- report << nil
+ report << " def #{scope}#{method.name}#{method.params}; end\n"
+ report << "\n"
end
report
@@ -385,35 +397,36 @@ class RDoc::Stats
@undoc_params,
].max.to_s.length
- report = []
- report << 'Files: %*d' % [num_width, @num_files]
+ report = RDoc::Markup::Verbatim.new
+
+ report << "Files: %*d\n" % [num_width, @num_files]
- report << nil
+ report << "\n"
- report << 'Classes: %*d (%*d undocumented)' % [
+ report << "Classes: %*d (%*d undocumented)\n" % [
num_width, @num_classes, undoc_width, @undoc_classes]
- report << 'Modules: %*d (%*d undocumented)' % [
+ report << "Modules: %*d (%*d undocumented)\n" % [
num_width, @num_modules, undoc_width, @undoc_modules]
- report << 'Constants: %*d (%*d undocumented)' % [
+ report << "Constants: %*d (%*d undocumented)\n" % [
num_width, @num_constants, undoc_width, @undoc_constants]
- report << 'Attributes: %*d (%*d undocumented)' % [
+ report << "Attributes: %*d (%*d undocumented)\n" % [
num_width, @num_attributes, undoc_width, @undoc_attributes]
- report << 'Methods: %*d (%*d undocumented)' % [
+ report << "Methods: %*d (%*d undocumented)\n" % [
num_width, @num_methods, undoc_width, @undoc_methods]
- report << 'Parameters: %*d (%*d undocumented)' % [
+ report << "Parameters: %*d (%*d undocumented)\n" % [
num_width, @num_params, undoc_width, @undoc_params] if
@coverage_level > 0
- report << nil
+ report << "\n"
- report << 'Total: %*d (%*d undocumented)' % [
+ report << "Total: %*d (%*d undocumented)\n" % [
num_width, @num_items, undoc_width, @undoc_items]
- report << '%6.2f%% documented' % percent_doc
- report << nil
- report << 'Elapsed: %0.1fs' % (Time.now - @start)
+ report << "%6.2f%% documented\n" % percent_doc
+ report << "\n"
+ report << "Elapsed: %0.1fs\n" % (Time.now - @start)
- report.join "\n"
+ RDoc::Markup::Document.new report
end
##
diff --git a/lib/rdoc/stats/normal.rb b/lib/rdoc/stats/normal.rb
index c971973bf1..ef366a500e 100644
--- a/lib/rdoc/stats/normal.rb
+++ b/lib/rdoc/stats/normal.rb
@@ -1,3 +1,8 @@
+begin
+ require 'io/console/size'
+rescue LoadError
+end
+
##
# Stats printer that prints just the files being documented with a progress
# bar
@@ -5,15 +10,14 @@
class RDoc::Stats::Normal < RDoc::Stats::Quiet
def begin_adding # :nodoc:
- puts "Parsing sources..." if $stdout.tty?
+ puts "Parsing sources..."
+ @last_width = 0
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,
@@ -21,7 +25,11 @@ 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 = (ENV['COLUMNS'] || 80).to_i
+ terminal_width = if defined?(IO) && IO.respond_to?(:console_size)
+ IO.console_size[1].to_i.nonzero? || 80
+ else
+ 80
+ end
max_filename_size = terminal_width - progress_bar.size
if filename.size > max_filename_size then
@@ -30,18 +38,21 @@ 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}"
- padding = terminal_width - line.size
- line << (" " * padding) if padding > 0
-
- $stdout.print("#{line}\r")
+ 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
$stdout.flush
end
def done_adding # :nodoc:
- puts if $stdout.tty?
+ puts
end
end
diff --git a/lib/rdoc/store.rb b/lib/rdoc/store.rb
index 6cbbfb5b69..fde6f0695b 100644
--- a/lib/rdoc/store.rb
+++ b/lib/rdoc/store.rb
@@ -305,8 +305,10 @@ class RDoc::Store
# cache included modules before they are removed from the documentation
all_classes_and_modules.each { |cm| cm.ancestors }
- remove_nodoc @classes_hash
- remove_nodoc @modules_hash
+ unless min_visibility == :nodoc then
+ remove_nodoc @classes_hash
+ remove_nodoc @modules_hash
+ end
@unique_classes = find_unique @classes_hash
@unique_modules = find_unique @modules_hash
@@ -661,7 +663,7 @@ class RDoc::Store
end
##
- # Converts the variable => ClassModule map +variables+ from a C parser into
+ # Converts the variable => ClassModule map +variables+ from a C parser into
# a variable => class name map.
def make_variable_map variables
diff --git a/lib/rdoc/task.rb b/lib/rdoc/task.rb
index d347e4d6ab..a83939090d 100644
--- a/lib/rdoc/task.rb
+++ b/lib/rdoc/task.rb
@@ -291,7 +291,7 @@ class RDoc::Task < Rake::TaskLib
private
def rdoc_target
- "#{rdoc_dir}/index.html"
+ "#{rdoc_dir}/created.rid"
end
def rdoc_task_name
diff --git a/lib/rdoc/test_case.rb b/lib/rdoc/test_case.rb
index c69e3c7cc6..245e4ef1c5 100644
--- a/lib/rdoc/test_case.rb
+++ b/lib/rdoc/test_case.rb
@@ -1,4 +1,11 @@
require 'rubygems'
+
+begin
+ gem 'minitest', '~> 4.0' unless defined?(Test::Unit)
+rescue NoMethodError
+ # for ruby tests
+end
+
require 'minitest/autorun'
require 'minitest/benchmark' if ENV['BENCHMARK']
@@ -45,6 +52,7 @@ class RDoc::TestCase < MiniTest::Unit::TestCase
@rdoc = RDoc::RDoc.new
@rdoc.store = @store
+ @rdoc.options = RDoc::Options.new
g = Object.new
def g.class_dir() end
@@ -53,6 +61,27 @@ class RDoc::TestCase < MiniTest::Unit::TestCase
end
##
+ # Asserts +path+ is a file
+
+ def assert_file path
+ assert File.file?(path), "#{path} is not a file"
+ end
+
+ ##
+ # Asserts +path+ is a directory
+
+ def assert_directory path
+ assert File.directory?(path), "#{path} is not a directory"
+ end
+
+ ##
+ # Refutes +path+ exists
+
+ def refute_file path
+ refute File.exist?(path), "#{path} exists"
+ end
+
+ ##
# Shortcut for RDoc::Markup::BlankLine.new
def blank_line
@@ -110,6 +139,16 @@ class RDoc::TestCase < MiniTest::Unit::TestCase
end
##
+ # Enables pretty-print output
+
+ def mu_pp obj # :nodoc:
+ s = ''
+ s = PP.pp obj, s
+ s = s.force_encoding Encoding.default_external if defined? Encoding
+ s.chomp
+ end
+
+ ##
# Shortcut for RDoc::Markup::Paragraph.new with +contents+
def para *a
diff --git a/lib/rdoc/text.rb b/lib/rdoc/text.rb
index c731dde097..3a58641ec1 100644
--- a/lib/rdoc/text.rb
+++ b/lib/rdoc/text.rb
@@ -103,6 +103,15 @@ 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
@@ -140,7 +149,7 @@ module RDoc::Text
def snippet text, limit = 100
document = parse text
- RDoc::Markup::ToHtmlSnippet.new(limit).convert document
+ RDoc::Markup::ToHtmlSnippet.new(options, limit).convert document
end
##
diff --git a/lib/rdoc/token_stream.rb b/lib/rdoc/token_stream.rb
index 851bc05bf5..b46b7da2f7 100644
--- a/lib/rdoc/token_stream.rb
+++ b/lib/rdoc/token_stream.rb
@@ -88,7 +88,7 @@ module RDoc::TokenStream
# Returns a string representation of the token stream
def tokens_to_s
- token_stream.map { |token| token.text }.join ''
+ token_stream.compact.map { |token| token.text }.join ''
end
end
diff --git a/lib/rdoc/tom_doc.rb b/lib/rdoc/tom_doc.rb
index 3a5a098ae8..2b62243525 100644
--- a/lib/rdoc/tom_doc.rb
+++ b/lib/rdoc/tom_doc.rb
@@ -129,7 +129,8 @@ class RDoc::TomDoc < RDoc::Markup::Parser
def initialize
super
- @section = nil
+ @section = nil
+ @seen_returns = false
end
# Internal: Builds a heading from the token stream
@@ -147,7 +148,7 @@ class RDoc::TomDoc < RDoc::Markup::Parser
end
# Internal: Builds a verbatim from the token stream. A verbatim in the
- # Examples section will be marked as in ruby format.
+ # Examples section will be marked as in Ruby format.
#
# margin - The indentation from the margin for lines that belong to this
# verbatim section.
@@ -176,9 +177,17 @@ class RDoc::TomDoc < RDoc::Markup::Parser
until @tokens.empty? do
type, data, = get
- if type == :TEXT then
+ case type
+ when :TEXT then
+ @section = 'Returns' if data =~ /\AReturns/
+
paragraph << data
- skip :NEWLINE
+ when :NEWLINE then
+ if :TEXT == peek_token[0] then
+ paragraph << ' '
+ else
+ break
+ end
else
unget
break
@@ -190,6 +199,21 @@ class RDoc::TomDoc < RDoc::Markup::Parser
paragraph
end
+ ##
+ # Detects a section change to "Returns" and adds a heading
+
+ def parse_text parent, indent # :nodoc:
+ paragraph = build_paragraph indent
+
+ if false == @seen_returns and 'Returns' == @section then
+ @seen_returns = true
+ parent << RDoc::Markup::Heading.new(3, 'Returns')
+ parent << RDoc::Markup::BlankLine.new
+ end
+
+ parent << paragraph
+ end
+
# Internal: Turns text into an Array of tokens
#
# text - A String containing TomDoc-format text.
diff --git a/lib/rdoc/top_level.rb b/lib/rdoc/top_level.rb
index 64e12d9ff9..64d81d20c1 100644
--- a/lib/rdoc/top_level.rb
+++ b/lib/rdoc/top_level.rb
@@ -30,7 +30,7 @@ class RDoc::TopLevel < RDoc::Context
attr_accessor :diagram # :nodoc:
##
- # The parser that processed this file
+ # The parser class that processed this file
attr_accessor :parser
@@ -98,7 +98,7 @@ class RDoc::TopLevel < RDoc::Context
##
# Adds class or module +mod+. Used in the building phase
- # by the ruby parser.
+ # by the Ruby parser.
def add_to_classes_or_modules mod
@classes_or_modules << mod
diff --git a/lib/resolv.rb b/lib/resolv.rb
index b38c42ab3f..9c7dd1b9b3 100644
--- a/lib/resolv.rb
+++ b/lib/resolv.rb
@@ -1,5 +1,4 @@
require 'socket'
-require 'fcntl'
require 'timeout'
require 'thread'
@@ -9,7 +8,7 @@ rescue LoadError
end
# Resolv is a thread-aware DNS resolver library written in Ruby. Resolv can
-# handle multiple DNS requests concurrently without blocking the entire ruby
+# handle multiple DNS requests concurrently without blocking the entire Ruby
# interpreter.
#
# See also resolv-replace.rb to replace the libc resolver with Resolv.
@@ -165,10 +164,11 @@ class Resolv
# Resolv::Hosts is a hostname resolver that uses the system hosts file.
class Hosts
- if /mswin|mingw|bccwin/ =~ RUBY_PLATFORM
+ begin
+ raise LoadError unless /mswin|mingw|cygwin/ =~ RUBY_PLATFORM
require 'win32/resolv'
DefaultFileName = Win32::Resolv.get_hosts_path
- else
+ rescue LoadError
DefaultFileName = '/etc/hosts'
end
@@ -186,7 +186,7 @@ class Resolv
unless @initialized
@name2addr = {}
@addr2name = {}
- open(@filename) {|f|
+ open(@filename, 'rb') {|f|
f.each {|line|
line.sub!(/#.*/, '')
addr, hostname, *aliases = line.split(/\s+/)
@@ -506,6 +506,12 @@ class Resolv
# #getresource for argument details.
def each_resource(name, typeclass, &proc)
+ fetch_resource(name, typeclass) {|reply, reply_name|
+ extract_resources(reply, reply_name, typeclass, &proc)
+ }
+ end
+
+ def fetch_resource(name, typeclass)
lazy_initialize
requester = make_udp_requester
senders = {}
@@ -515,8 +521,9 @@ class Resolv
msg.rd = 1
msg.add_question(candidate, typeclass)
unless sender = senders[[candidate, nameserver, port]]
- sender = senders[[candidate, nameserver, port]] =
- requester.sender(msg, candidate, nameserver, port)
+ sender = requester.sender(msg, candidate, nameserver, port)
+ next if !sender
+ senders[[candidate, nameserver, port]] = sender
end
reply, reply_name = requester.request(sender, tout)
case reply.rcode
@@ -532,7 +539,7 @@ class Resolv
# response will not fit in an untruncated UDP packet.
redo
else
- extract_resources(reply, reply_name, typeclass, &proc)
+ yield(reply, reply_name)
end
return
when RCode::NXDomain
@@ -645,7 +652,9 @@ class Resolv
begin
port = rangerand(1024..65535)
udpsock.bind(bind_host, port)
- rescue Errno::EADDRINUSE
+ 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).
retry
end
end
@@ -659,7 +668,12 @@ class Resolv
def request(sender, tout)
start = Time.now
timelimit = start + tout
- sender.send
+ begin
+ sender.send
+ rescue Errno::EHOSTUNREACH
+ # multi-homed IPv6 may generate this
+ raise ResolvTimeout
+ end
while true
before_select = Time.now
timeout = timelimit - before_select
@@ -685,7 +699,7 @@ class Resolv
rescue DecodeError
next # broken DNS message ignored
end
- if s = @senders[[from,msg.id]]
+ if s = sender_for(from, msg)
break
else
# unexpected DNS message ignored
@@ -694,6 +708,10 @@ class Resolv
return msg, s.data
end
+ def sender_for(addr, msg)
+ @senders[[addr,msg.id]]
+ end
+
def close
socks = @socks
@socks = nil
@@ -725,9 +743,12 @@ class Resolv
af = Socket::AF_INET
end
next if @socks_hash[bind_host]
- sock = UDPSocket.new(af)
+ begin
+ sock = UDPSocket.new(af)
+ rescue Errno::EAFNOSUPPORT
+ next # The kernel doesn't support the address family.
+ end
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
@@ -740,11 +761,12 @@ 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
@@ -765,6 +787,7 @@ class Resolv
attr_reader :data
def send
+ raise "@sock is nil." if @sock.nil?
@sock.send(@msg, 0, @host, @port)
end
end
@@ -779,7 +802,6 @@ 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
@@ -808,12 +830,28 @@ class Resolv
class Sender < Requester::Sender # :nodoc:
def send
+ raise "@sock is nil." if @sock.nil?
@sock.send(@msg, 0)
end
attr_reader :data
end
end
+ class MDNSOneShot < UnconnectedUDP # :nodoc:
+ def sender(msg, data, host, port=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[id] =
+ UnconnectedUDP::Sender.new(request, data, sock, host, port)
+ end
+
+ def sender_for(addr, msg)
+ @senders[msg.id]
+ end
+ end
+
class TCP < Requester # :nodoc:
def initialize(host, port=Port)
super()
@@ -821,7 +859,6 @@ 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
@@ -877,7 +914,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 postive"
+ t > 0.0 or raise ArgumentError, "timeout=#{t} must be positive"
end
@timeouts = values
else
@@ -889,7 +926,7 @@ class Resolv
nameserver = []
search = nil
ndots = 1
- open(filename) {|f|
+ open(filename, 'rb') {|f|
f.each {|line|
line.sub!(/[#;].*/, '')
keyword, *args = line.split(/\s+/)
@@ -1138,7 +1175,7 @@ class Resolv
end
def inspect
- return "#<#{self.class} #{self.to_s}>"
+ return "#<#{self.class} #{self}>"
end
def ==(other)
@@ -1183,7 +1220,7 @@ class Resolv
end
def inspect # :nodoc:
- "#<#{self.class}: #{self.to_s}#{@absolute ? '.' : ''}>"
+ "#<#{self.class}: #{self}#{@absolute ? '.' : ''}>"
end
##
@@ -1489,6 +1526,7 @@ 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
@@ -1516,6 +1554,7 @@ 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]
@@ -1535,29 +1574,33 @@ class Resolv
return Name.new(self.get_labels)
end
- def get_labels(limit=nil)
- limit = @index if !limit || @index < limit
+ def get_labels
+ prev_index = @index
+ save_index = nil
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 limit <= idx
+ if prev_index <= idx
raise DecodeError.new("non-backward name pointer")
end
- save_index = @index
+ prev_index = idx
+ if !save_index
+ save_index = @index
+ end
@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
@@ -1932,10 +1975,10 @@ class Resolv
attr_reader :strings
##
- # Returns the first string from +strings+.
+ # Returns the concatenated string from +strings+.
def data
- @strings[0]
+ @strings.join("")
end
def encode_rdata(msg) # :nodoc:
@@ -1949,6 +1992,97 @@ class Resolv
end
##
+ # Location resource
+
+ class LOC < Resource
+
+ TypeValue = 29 # :nodoc:
+
+ def initialize(version, ssize, hprecision, vprecision, latitude, longitude, altitude)
+ @version = version
+ @ssize = Resolv::LOC::Size.create(ssize)
+ @hprecision = Resolv::LOC::Size.create(hprecision)
+ @vprecision = Resolv::LOC::Size.create(vprecision)
+ @latitude = Resolv::LOC::Coord.create(latitude)
+ @longitude = Resolv::LOC::Coord.create(longitude)
+ @altitude = Resolv::LOC::Alt.create(altitude)
+ end
+
+ ##
+ # Returns the version value for this LOC record which should always be 00
+
+ attr_reader :version
+
+ ##
+ # The spherical size of this LOC
+ # in meters using scientific notation as 2 integers of XeY
+
+ attr_reader :ssize
+
+ ##
+ # The horizontal precision using ssize type values
+ # in meters using scientific notation as 2 integers of XeY
+ # for precision use value/2 e.g. 2m = +/-1m
+
+ attr_reader :hprecision
+
+ ##
+ # The vertical precision using ssize type values
+ # in meters using scientific notation as 2 integers of XeY
+ # for precision use value/2 e.g. 2m = +/-1m
+
+ attr_reader :vprecision
+
+ ##
+ # The latitude for this LOC where 2**31 is the equator
+ # in thousandths of an arc second as an unsigned 32bit integer
+
+ attr_reader :latitude
+
+ ##
+ # The longitude for this LOC where 2**31 is the prime meridian
+ # in thousandths of an arc second as an unsigned 32bit integer
+
+ attr_reader :longitude
+
+ ##
+ # The altitude of the LOC above a reference sphere whose surface sits 100km below the WGS84 spheroid
+ # in centimeters as an unsigned 32bit integer
+
+ attr_reader :altitude
+
+
+ def encode_rdata(msg) # :nodoc:
+ msg.put_bytes(@version)
+ msg.put_bytes(@ssize.scalar)
+ msg.put_bytes(@hprecision.scalar)
+ msg.put_bytes(@vprecision.scalar)
+ msg.put_bytes(@latitude.coordinates)
+ msg.put_bytes(@longitude.coordinates)
+ msg.put_bytes(@altitude.altitude)
+ end
+
+ def self.decode_rdata(msg) # :nodoc:
+ version = msg.get_bytes(1)
+ ssize = msg.get_bytes(1)
+ hprecision = msg.get_bytes(1)
+ vprecision = msg.get_bytes(1)
+ latitude = msg.get_bytes(4)
+ longitude = msg.get_bytes(4)
+ altitude = msg.get_bytes(4)
+ return self.new(
+ version,
+ Resolv::LOC::Size.new(ssize),
+ Resolv::LOC::Size.new(hprecision),
+ Resolv::LOC::Size.new(vprecision),
+ Resolv::LOC::Coord.new(latitude,"lat"),
+ Resolv::LOC::Coord.new(longitude,"lon"),
+ Resolv::LOC::Alt.new(altitude)
+ )
+ end
+ end
+
+ ##
# A Query type requesting any RR.
class ANY < Query
@@ -1956,7 +2090,7 @@ class Resolv
end
ClassInsensitiveTypes = [ # :nodoc:
- NS, CNAME, SOA, PTR, HINFO, MINFO, MX, TXT, ANY
+ NS, CNAME, SOA, PTR, HINFO, MINFO, MX, TXT, LOC, ANY
]
##
@@ -2212,7 +2346,7 @@ class Resolv
end
def inspect # :nodoc:
- return "#<#{self.class} #{self.to_s}>"
+ return "#<#{self.class} #{self}>"
end
##
@@ -2355,7 +2489,7 @@ class Resolv
end
def inspect # :nodoc:
- return "#<#{self.class} #{self.to_s}>"
+ return "#<#{self.class} #{self}>"
end
##
@@ -2382,11 +2516,313 @@ class Resolv
end
##
+ # Resolv::MDNS is a one-shot Multicast DNS (mDNS) resolver. It blindly
+ # makes queries to the mDNS addresses without understanding anything about
+ # multicast ports.
+ #
+ # Information taken form the following places:
+ #
+ # * RFC 6762
+
+ class MDNS < DNS
+
+ ##
+ # Default mDNS Port
+
+ Port = 5353
+
+ ##
+ # Default IPv4 mDNS address
+
+ AddressV4 = '224.0.0.251'
+
+ ##
+ # Default IPv6 mDNS address
+
+ AddressV6 = 'ff02::fb'
+
+ ##
+ # Default mDNS addresses
+
+ Addresses = [
+ [AddressV4, Port],
+ [AddressV6, Port],
+ ]
+
+ ##
+ # Creates a new one-shot Multicast DNS (mDNS) resolver.
+ #
+ # +config_info+ can be:
+ #
+ # nil::
+ # Uses the default mDNS addresses
+ #
+ # Hash::
+ # Must contain :nameserver or :nameserver_port like
+ # Resolv::DNS#initialize.
+
+ def initialize(config_info=nil)
+ if config_info then
+ super({ nameserver_port: Addresses }.merge(config_info))
+ else
+ super(nameserver_port: Addresses)
+ end
+ end
+
+ ##
+ # Iterates over all IP addresses for +name+ retrieved from the mDNS
+ # resolver, provided name ends with "local". If the name does not end in
+ # "local" no records will be returned.
+ #
+ # +name+ can be a Resolv::DNS::Name or a String. Retrieved addresses will
+ # be a Resolv::IPv4 or Resolv::IPv6
+
+ def each_address(name)
+ name = Resolv::DNS::Name.create(name)
+
+ return unless name.to_a.last == 'local'
+
+ super(name)
+ end
+
+ def make_udp_requester # :nodoc:
+ nameserver_port = @config.nameserver_port
+ Requester::MDNSOneShot.new(*nameserver_port)
+ end
+
+ end
+
+ module LOC
+
+ ##
+ # A Resolv::LOC::Size
+
+ class Size
+
+ Regex = /^(\d+\.*\d*)[m]$/
+
+ ##
+ # Creates a new LOC::Size from +arg+ which may be:
+ #
+ # LOC::Size:: returns +arg+.
+ # String:: +arg+ must match the LOC::Size::Regex constant
+
+ def self.create(arg)
+ case arg
+ when Size
+ return arg
+ when String
+ scalar = ''
+ if Regex =~ arg
+ scalar = [(($1.to_f*(1e2)).to_i.to_s[0].to_i*(2**4)+(($1.to_f*(1e2)).to_i.to_s.length-1))].pack("C")
+ else
+ raise ArgumentError.new("not a properly formed Size string: " + arg)
+ end
+ return Size.new(scalar)
+ else
+ raise ArgumentError.new("cannot interpret as Size: #{arg.inspect}")
+ end
+ end
+
+ def initialize(scalar)
+ @scalar = scalar
+ end
+
+ ##
+ # The raw size
+
+ attr_reader :scalar
+
+ def to_s # :nodoc:
+ s = @scalar.unpack("H2").join.to_s
+ return ((s[0].to_i)*(10**(s[1].to_i-2))).to_s << "m"
+ end
+
+ def inspect # :nodoc:
+ return "#<#{self.class} #{self}>"
+ end
+
+ def ==(other) # :nodoc:
+ return @scalar == other.scalar
+ end
+
+ def eql?(other) # :nodoc:
+ return self == other
+ end
+
+ def hash # :nodoc:
+ return @scalar.hash
+ end
+
+ end
+
+ ##
+ # A Resolv::LOC::Coord
+
+ class Coord
+
+ Regex = /^(\d+)\s(\d+)\s(\d+\.\d+)\s([NESW])$/
+
+ ##
+ # Creates a new LOC::Coord from +arg+ which may be:
+ #
+ # LOC::Coord:: returns +arg+.
+ # String:: +arg+ must match the LOC::Coord::Regex constant
+
+ def self.create(arg)
+ case arg
+ when Coord
+ return arg
+ when String
+ coordinates = ''
+ if Regex =~ arg && $1<180
+ hemi = ($4[/([NE])/,1]) || ($4[/([SW])/,1]) ? 1 : -1
+ coordinates = [(($1.to_i*(36e5))+($2.to_i*(6e4))+($3.to_f*(1e3)))*hemi+(2**31)].pack("N")
+ (orientation ||= '') << $4[[/NS/],1] ? 'lat' : 'lon'
+ else
+ raise ArgumentError.new("not a properly formed Coord string: " + arg)
+ end
+ return Coord.new(coordinates,orientation)
+ else
+ raise ArgumentError.new("cannot interpret as Coord: #{arg.inspect}")
+ end
+ end
+
+ def initialize(coordinates,orientation)
+ unless coordinates.kind_of?(String)
+ raise ArgumentError.new("Coord must be a 32bit unsigned integer in hex format: #{coordinates.inspect}")
+ end
+ unless orientation.kind_of?(String) && orientation[/^lon$|^lat$/]
+ raise ArgumentError.new('Coord expects orientation to be a String argument of "lat" or "lon"')
+ end
+ @coordinates = coordinates
+ @orientation = orientation
+ end
+
+ ##
+ # The raw coordinates
+
+ attr_reader :coordinates
+
+ ## The orientation of the hemisphere as 'lat' or 'lon'
+
+ attr_reader :orientation
+
+ def to_s # :nodoc:
+ c = @coordinates.unpack("N").join.to_i
+ val = (c - (2**31)).abs
+ fracsecs = (val % 1e3).to_i.to_s
+ val = val / 1e3
+ secs = (val % 60).to_i.to_s
+ val = val / 60
+ mins = (val % 60).to_i.to_s
+ degs = (val / 60).to_i.to_s
+ posi = (c >= 2**31)
+ case posi
+ when true
+ hemi = @orientation[/^lat$/] ? "N" : "E"
+ else
+ hemi = @orientation[/^lon$/] ? "W" : "S"
+ end
+ return degs << " " << mins << " " << secs << "." << fracsecs << " " << hemi
+ end
+
+ def inspect # :nodoc:
+ return "#<#{self.class} #{self}>"
+ end
+
+ def ==(other) # :nodoc:
+ return @coordinates == other.coordinates
+ end
+
+ def eql?(other) # :nodoc:
+ return self == other
+ end
+
+ def hash # :nodoc:
+ return @coordinates.hash
+ end
+
+ end
+
+ ##
+ # A Resolv::LOC::Alt
+
+ class Alt
+
+ Regex = /^([+-]*\d+\.*\d*)[m]$/
+
+ ##
+ # Creates a new LOC::Alt from +arg+ which may be:
+ #
+ # LOC::Alt:: returns +arg+.
+ # String:: +arg+ must match the LOC::Alt::Regex constant
+
+ def self.create(arg)
+ case arg
+ when Alt
+ return arg
+ when String
+ altitude = ''
+ if Regex =~ arg
+ altitude = [($1.to_f*(1e2))+(1e7)].pack("N")
+ else
+ raise ArgumentError.new("not a properly formed Alt string: " + arg)
+ end
+ return Alt.new(altitude)
+ else
+ raise ArgumentError.new("cannot interpret as Alt: #{arg.inspect}")
+ end
+ end
+
+ def initialize(altitude)
+ @altitude = altitude
+ end
+
+ ##
+ # The raw altitude
+
+ attr_reader :altitude
+
+ def to_s # :nodoc:
+ a = @altitude.unpack("N").join.to_i
+ return ((a.to_f/1e2)-1e5).to_s + "m"
+ end
+
+ def inspect # :nodoc:
+ return "#<#{self.class} #{self}>"
+ end
+
+ def ==(other) # :nodoc:
+ return @altitude == other.altitude
+ end
+
+ def eql?(other) # :nodoc:
+ return self == other
+ end
+
+ def hash # :nodoc:
+ return @altitude.hash
+ end
+
+ end
+
+ end
+
+ ##
# Default resolver to use for Resolv class methods.
DefaultResolver = self.new
##
+ # Replaces the resolvers in the default resolver with +new_resolvers+. This
+ # allows resolvers to be changed for resolv-replace.
+
+ def DefaultResolver.replace_resolvers new_resolvers
+ @resolvers = new_resolvers
+ end
+
+ ##
# Address Regexp to use for matching IP addresses.
AddressRegex = /(?:#{IPv4::Regex})|(?:#{IPv6::Regex})/
diff --git a/lib/rexml/attribute.rb b/lib/rexml/attribute.rb
index e99927943f..ef9e544294 100644
--- a/lib/rexml/attribute.rb
+++ b/lib/rexml/attribute.rb
@@ -80,8 +80,11 @@ module REXML
# Returns the namespace URL, if defined, or nil otherwise
#
# e = Element.new("el")
- # e.add_attributes({"xmlns:ns", "http://url"})
- # e.namespace( "ns" ) # -> "http://url"
+ # e.add_namespace("ns", "http://url")
+ # e.add_attribute("ns:a", "b")
+ # e.add_attribute("nsx:a", "c")
+ # e.attribute("ns:a").namespace # => "http://url"
+ # e.attribute("nsx:a").namespace # => nil
def namespace arg=nil
arg = prefix if arg.nil?
@element.namespace arg
@@ -156,7 +159,7 @@ module REXML
self
end
- # Removes this Attribute from the tree, and returns true if successfull
+ # Removes this Attribute from the tree, and returns true if successful
#
# This method is usually not called directly.
def remove
diff --git a/lib/rexml/document.rb b/lib/rexml/document.rb
index 76679d1c16..8342b96e6a 100644
--- a/lib/rexml/document.rb
+++ b/lib/rexml/document.rb
@@ -1,3 +1,4 @@
+require "rexml/security"
require "rexml/element"
require "rexml/xmldecl"
require "rexml/source"
@@ -122,7 +123,7 @@ module REXML
def xml_decl
rv = @children[0]
return rv if rv.kind_of? XMLDecl
- rv = @children.unshift(XMLDecl.default)[0]
+ @children.unshift(XMLDecl.default)[0]
end
# @return the XMLDecl version of this document as a String.
@@ -194,11 +195,8 @@ module REXML
# the absolute *value* of the document -- that is, it leaves the value
# and number of Text nodes in the document unchanged.
# ie_hack::
- # Internet Explorer is the worst piece of crap to have ever been
- # written, with the possible exception of Windows itself. Since IE is
- # unable to parse proper XML, we have to provide a hack to generate XML
- # that IE's limited abilities can handle. This hack inserts a space
- # before the /> on empty tags. Defaults to false
+ # This hack inserts a space before the /> on empty tags to address
+ # a limitation of Internet Explorer. Defaults to false
# encoding::
# Encoding name as String. Change output encoding to specified encoding
# instead of encoding in XML declaration.
@@ -243,37 +241,39 @@ module REXML
Parsers::StreamParser.new( source, listener ).parse
end
- @@entity_expansion_limit = 10_000
-
# Set the entity expansion limit. By default the limit is set to 10000.
+ #
+ # Deprecated. Use REXML::Security.entity_expansion_limit= instead.
def Document::entity_expansion_limit=( val )
- @@entity_expansion_limit = val
+ Security.entity_expansion_limit = val
end
# Get the entity expansion limit. By default the limit is set to 10000.
+ #
+ # Deprecated. Use REXML::Security.entity_expansion_limit= instead.
def Document::entity_expansion_limit
- return @@entity_expansion_limit
+ return Security.entity_expansion_limit
end
# Set the entity expansion limit. By default the limit is set to 10240.
#
- # Deprecated. Use REXML.entity_expansion_text_limit= instead.
+ # Deprecated. Use REXML::Security.entity_expansion_text_limit= instead.
def Document::entity_expansion_text_limit=( val )
- REXML.entity_expansion_text_limit = val
+ Security.entity_expansion_text_limit = val
end
# Get the entity expansion limit. By default the limit is set to 10240.
#
- # Deprecated. Use REXML.entity_expansion_text_limit instead.
+ # Deprecated. Use REXML::Security.entity_expansion_text_limit instead.
def Document::entity_expansion_text_limit
- return REXML.entity_expansion_text_limit
+ return Security.entity_expansion_text_limit
end
attr_reader :entity_expansion_count
def record_entity_expansion
@entity_expansion_count += 1
- if @entity_expansion_count > @@entity_expansion_limit
+ if @entity_expansion_count > Security.entity_expansion_limit
raise "number of entity expansions exceeded, processing aborted."
end
end
diff --git a/lib/rexml/dtd/dtd.rb b/lib/rexml/dtd/dtd.rb
index 966e39ea57..62317bac9e 100644
--- a/lib/rexml/dtd/dtd.rb
+++ b/lib/rexml/dtd/dtd.rb
@@ -24,23 +24,18 @@ 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/element.rb b/lib/rexml/element.rb
index 616771fc0f..e459704d3c 100644
--- a/lib/rexml/element.rb
+++ b/lib/rexml/element.rb
@@ -206,7 +206,7 @@ module REXML
return namespaces
end
- # Evalutas to the URI for a prefix, or the empty string if no such
+ # Evaluates 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::
@@ -678,11 +678,8 @@ module REXML
# pretty-printed in such a way that the added whitespace does not affect
# the parse tree of the document
# ie_hack::
- # Internet Explorer is the worst piece of crap to have ever been
- # written, with the possible exception of Windows itself. Since IE is
- # unable to parse proper XML, we have to provide a hack to generate XML
- # that IE's limited abilities can handle. This hack inserts a space
- # before the /> on empty tags. Defaults to false
+ # This hack inserts a space before the /> on empty tags to address
+ # a limitation of Internet Explorer. Defaults to false
#
# out = ''
# doc.write( out ) #-> doc is written to the string 'out'
@@ -990,7 +987,7 @@ module REXML
end
def to_a
- values.flatten
+ enum_for(:each_attribute).to_a
end
# Returns the number of attributes the owning Element contains.
@@ -1184,9 +1181,8 @@ module REXML
prefix = '' unless prefix
end
old = fetch(name, nil)
- attr = nil
if old.kind_of? Hash # the supplied attribute is one of many
- attr = old.delete(prefix)
+ old.delete(prefix)
if old.size == 1
repl = nil
old.each_value{|v| repl = v}
@@ -1195,7 +1191,6 @@ 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/entity.rb b/lib/rexml/entity.rb
index 3d81fbc738..39f3900075 100644
--- a/lib/rexml/entity.rb
+++ b/lib/rexml/entity.rb
@@ -63,7 +63,7 @@ module REXML
end
end
- # Evaluates whether the given string matchs an entity definition,
+ # Evaluates whether the given string matches an entity definition,
# returning true if so, and false otherwise.
def Entity::matches? string
(ENTITYDECL =~ string) == 0
diff --git a/lib/rexml/formatters/pretty.rb b/lib/rexml/formatters/pretty.rb
index 63f726e8c3..e5ba561a58 100644
--- a/lib/rexml/formatters/pretty.rb
+++ b/lib/rexml/formatters/pretty.rb
@@ -24,7 +24,7 @@ module REXML
# is undefined. Defaults to 2.
# ie_hack::
# If true, the printer will insert whitespace before closing empty
- # tags, thereby allowing Internet Explorer's feeble XML parser to
+ # tags, thereby allowing Internet Explorer's XML parser to
# function. Defaults to false.
def initialize( indentation=2, ie_hack=false )
@indentation = indentation
diff --git a/lib/rexml/functions.rb b/lib/rexml/functions.rb
index 20c8961aee..2010be14e0 100644
--- a/lib/rexml/functions.rb
+++ b/lib/rexml/functions.rb
@@ -363,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 )
diff --git a/lib/rexml/parsers/baseparser.rb b/lib/rexml/parsers/baseparser.rb
index a88896c5db..6a08b8661d 100644
--- a/lib/rexml/parsers/baseparser.rb
+++ b/lib/rexml/parsers/baseparser.rb
@@ -43,12 +43,13 @@ module REXML
REFERENCE_RE = /#{REFERENCE}/
DOCTYPE_START = /\A\s*<!DOCTYPE\s/um
+ DOCTYPE_END = /\A\s*\]\s*>/um
DOCTYPE_PATTERN = /\s*<!DOCTYPE\s+(.*?)(\[|>)/um
ATTRIBUTE_PATTERN = /\s*(#{NAME_STR})\s*=\s*(["'])(.*?)\4/um
COMMENT_START = /\A<!--/u
COMMENT_PATTERN = /<!--(.*?)-->/um
CDATA_START = /\A<!\[CDATA\[/u
- CDATA_END = /^\s*\]\s*>/um
+ CDATA_END = /\A\s*\]\s*>/um
CDATA_PATTERN = /<!\[CDATA\[(.*?)\]\]>/um
XMLDECL_START = /\A<\?xml\s/u;
XMLDECL_PATTERN = /<\?xml\s+(.*?)\?>/um
@@ -61,11 +62,11 @@ module REXML
ENCODING = /\bencoding\s*=\s*["'](.*?)['"]/um
STANDALONE = /\bstandalone\s*=\s*["'](.*?)['"]/um
- ENTITY_START = /^\s*<!ENTITY/
+ ENTITY_START = /\A\s*<!ENTITY/
IDENTITY = /^([!\*\w\-]+)(\s+#{NCNAME_STR})?(\s+["'](.*?)['"])?(\s+['"](.*?)["'])?/u
- ELEMENTDECL_START = /^\s*<!ELEMENT/um
- ELEMENTDECL_PATTERN = /^\s*(<!ELEMENT.*?)>/um
- SYSTEMENTITY = /^\s*(%.*?;)\s*$/um
+ ELEMENTDECL_START = /\A\s*<!ELEMENT/um
+ ELEMENTDECL_PATTERN = /\A\s*(<!ELEMENT.*?)>/um
+ SYSTEMENTITY = /\A\s*(%.*?;)\s*$/um
ENUMERATION = "\\(\\s*#{NMTOKEN}(?:\\s*\\|\\s*#{NMTOKEN})*\\s*\\)"
NOTATIONTYPE = "NOTATION\\s+\\(\\s*#{NAME}(?:\\s*\\|\\s*#{NAME})*\\s*\\)"
ENUMERATEDTYPE = "(?:(?:#{NOTATIONTYPE})|(?:#{ENUMERATION}))"
@@ -74,11 +75,11 @@ module REXML
DEFAULTDECL = "(#REQUIRED|#IMPLIED|(?:(#FIXED\\s+)?#{ATTVALUE}))"
ATTDEF = "\\s+#{NAME}\\s+#{ATTTYPE}\\s+#{DEFAULTDECL}"
ATTDEF_RE = /#{ATTDEF}/
- ATTLISTDECL_START = /^\s*<!ATTLIST/um
- ATTLISTDECL_PATTERN = /^\s*<!ATTLIST\s+#{NAME}(?:#{ATTDEF})*\s*>/um
- NOTATIONDECL_START = /^\s*<!NOTATION/um
- PUBLIC = /^\s*<!NOTATION\s+(\w[\-\w]*)\s+(PUBLIC)\s+(["'])(.*?)\3(?:\s+(["'])(.*?)\5)?\s*>/um
- SYSTEM = /^\s*<!NOTATION\s+(\w[\-\w]*)\s+(SYSTEM)\s+(["'])(.*?)\3\s*>/um
+ ATTLISTDECL_START = /\A\s*<!ATTLIST/um
+ ATTLISTDECL_PATTERN = /\A\s*<!ATTLIST\s+#{NAME}(?:#{ATTDEF})*\s*>/um
+ NOTATIONDECL_START = /\A\s*<!NOTATION/um
+ PUBLIC = /\A\s*<!NOTATION\s+(\w[\-\w]*)\s+(PUBLIC)\s+(["'])(.*?)\3(?:\s+(["'])(.*?)\5)?\s*>/um
+ SYSTEM = /\A\s*<!NOTATION\s+(\w[\-\w]*)\s+(SYSTEM)\s+(["'])(.*?)\3\s*>/um
TEXT_PATTERN = /\A([^<]*)/um
@@ -282,7 +283,8 @@ module REXML
# External reference
match[3] = match[3][1..-2] # PUBID
match[4] = match[4][1..-2] # HREF
- # match is [ :entity, name, PUBLIC, pubid, href ]
+ match.delete_at(5) if match.size > 5 # Chop out NDATA decl
+ # match is [ :entity, name, PUBLIC, pubid, href(, ndata)? ]
else
match[2] = match[2][1..-2]
match.pop if match.size == 4
@@ -322,9 +324,9 @@ module REXML
raise REXML::ParseException.new( "error parsing notation: no matching pattern", @source )
end
return [ :notationdecl, *vals ]
- when CDATA_END
+ when DOCTYPE_END
@document_status = :after_doctype
- @source.match( CDATA_END, true )
+ @source.match( DOCTYPE_END, true )
return [ :end_doctype ]
end
end
diff --git a/lib/rexml/parsers/sax2parser.rb b/lib/rexml/parsers/sax2parser.rb
index 0661af37aa..46ea8faa4d 100644
--- a/lib/rexml/parsers/sax2parser.rb
+++ b/lib/rexml/parsers/sax2parser.rb
@@ -176,8 +176,7 @@ module REXML
}
handle( :characters, copy )
when :entitydecl
- @entities[ event[1] ] = event[2] if event.size == 3
- handle( *event )
+ handle_entitydecl( event )
when :processing_instruction, :comment, :attlistdecl,
:elementdecl, :cdata, :notationdecl, :xmldecl
handle( *event )
@@ -198,6 +197,33 @@ module REXML
} if listeners
end
+ def handle_entitydecl( event )
+ @entities[ event[1] ] = event[2] if event.size == 3
+ parameter_reference_p = false
+ case event[2]
+ when "SYSTEM"
+ if event.size == 5
+ if event.last == "%"
+ parameter_reference_p = true
+ else
+ event[4, 0] = "NDATA"
+ end
+ end
+ when "PUBLIC"
+ if event.size == 6
+ if event.last == "%"
+ parameter_reference_p = true
+ else
+ event[5, 0] = "NDATA"
+ end
+ end
+ else
+ parameter_reference_p = (event.size == 4)
+ end
+ event[1, 0] = event.pop if parameter_reference_p
+ handle( event[0], event[1..-1] )
+ end
+
# The following methods are duplicates, but it is faster than using
# a helper
def get_procs( symbol, name )
diff --git a/lib/rexml/parsers/streamparser.rb b/lib/rexml/parsers/streamparser.rb
index 073fcc2c21..9ea65ed3d1 100644
--- a/lib/rexml/parsers/streamparser.rb
+++ b/lib/rexml/parsers/streamparser.rb
@@ -1,3 +1,5 @@
+require "rexml/parsers/baseparser"
+
module REXML
module Parsers
class StreamParser
@@ -38,6 +40,10 @@ module REXML
@listener.send( event[0].to_s, *event[1..-1] )
when :entitydecl, :notationdecl
@listener.send( event[0].to_s, event[1..-1] )
+ when :externalentity
+ entity_reference = event[1]
+ content = entity_reference.gsub(/\A%|;\z/, "")
+ @listener.entity(content)
end
end
end
diff --git a/lib/rexml/parsers/treeparser.rb b/lib/rexml/parsers/treeparser.rb
index 7f618cb319..68edb77759 100644
--- a/lib/rexml/parsers/treeparser.rb
+++ b/lib/rexml/parsers/treeparser.rb
@@ -24,8 +24,8 @@ module REXML
case event[0]
when :end_document
unless tag_stack.empty?
- #raise ParseException.new("No close tag for #{tag_stack.inspect}")
- raise ParseException.new("No close tag for #{@build_context.xpath}")
+ raise ParseException.new("No close tag for #{@build_context.xpath}",
+ @parser.source, @parser)
end
return
when :start_element
@@ -89,7 +89,7 @@ module REXML
end
rescue REXML::Validation::ValidationException
raise
- rescue REXML::UndefinedNamespaceException
+ rescue REXML::ParseException
raise
rescue
raise ParseException.new( $!.message, @parser.source, @parser, $! )
diff --git a/lib/rexml/parsers/ultralightparser.rb b/lib/rexml/parsers/ultralightparser.rb
index 7dd8172802..4e2d7a81cf 100644
--- a/lib/rexml/parsers/ultralightparser.rb
+++ b/lib/rexml/parsers/ultralightparser.rb
@@ -27,7 +27,7 @@ module REXML
break
when :end_doctype
context = context[1]
- when :start_element, :doctype
+ when :start_element, :start_doctype
context << event
event[1,0] = [context]
context = event
diff --git a/lib/rexml/parsers/xpathparser.rb b/lib/rexml/parsers/xpathparser.rb
index e643d11511..d30aa34f6e 100644
--- a/lib/rexml/parsers/xpathparser.rb
+++ b/lib/rexml/parsers/xpathparser.rb
@@ -21,7 +21,7 @@ module REXML
path.gsub!(/([\(\[])\s+/, '\1') # Strip ignorable spaces
path.gsub!( /\s+([\]\)])/, '\1')
parsed = []
- path = OrExpr(path, parsed)
+ OrExpr(path, parsed)
parsed
end
diff --git a/lib/rexml/rexml.rb b/lib/rexml/rexml.rb
index bc59a30c64..f89951171a 100644
--- a/lib/rexml/rexml.rb
+++ b/lib/rexml/rexml.rb
@@ -28,16 +28,4 @@ module REXML
Copyright = COPYRIGHT
Version = VERSION
-
- @@entity_expansion_text_limit = 10_240
-
- # Set the entity expansion limit. By default the limit is set to 10240.
- def self.entity_expansion_text_limit=( val )
- @@entity_expansion_text_limit = val
- end
-
- # Get the entity expansion limit. By default the limit is set to 10240.
- def self.entity_expansion_text_limit
- return @@entity_expansion_text_limit
- end
end
diff --git a/lib/rexml/sax2listener.rb b/lib/rexml/sax2listener.rb
index 6830e4483a..9f276eb4ed 100644
--- a/lib/rexml/sax2listener.rb
+++ b/lib/rexml/sax2listener.rb
@@ -59,21 +59,21 @@ module REXML
# declaration. It can be in a number of formats, but in general it
# returns (example, result):
# <!ENTITY % YN '"Yes"'>
- # ["%", "YN", "'\"Yes\"'", "\""]
+ # ["%", "YN", "\"Yes\""]
# <!ENTITY % YN 'Yes'>
- # ["%", "YN", "'Yes'", "s"]
+ # ["%", "YN", "Yes"]
# <!ENTITY WhatHeSaid "He said %YN;">
- # ["WhatHeSaid", "\"He said %YN;\"", "YN"]
+ # ["WhatHeSaid", "He said %YN;"]
# <!ENTITY open-hatch SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml">
- # ["open-hatch", "SYSTEM", "\"http://www.textuality.com/boilerplate/OpenHatch.xml\""]
+ # ["open-hatch", "SYSTEM", "http://www.textuality.com/boilerplate/OpenHatch.xml"]
# <!ENTITY open-hatch PUBLIC "-//Textuality//TEXT Standard open-hatch boilerplate//EN" "http://www.textuality.com/boilerplate/OpenHatch.xml">
- # ["open-hatch", "PUBLIC", "\"-//Textuality//TEXT Standard open-hatch boilerplate//EN\"", "\"http://www.textuality.com/boilerplate/OpenHatch.xml\""]
+ # ["open-hatch", "PUBLIC", "-//Textuality//TEXT Standard open-hatch boilerplate//EN", "http://www.textuality.com/boilerplate/OpenHatch.xml"]
# <!ENTITY hatch-pic SYSTEM "../grafix/OpenHatch.gif" NDATA gif>
- # ["hatch-pic", "SYSTEM", "\"../grafix/OpenHatch.gif\"", "\n\t\t\t\t\t\t\tNDATA gif", "gif"]
- def entitydecl name, decl
+ # ["hatch-pic", "SYSTEM", "../grafix/OpenHatch.gif", "NDATA", "gif"]
+ def entitydecl declaration
end
# <!NOTATION ...>
- def notationdecl content
+ def notationdecl name, public_or_system, public_id, system_id
end
# Called when <![CDATA[ ... ]]> is encountered in a document.
# @p content "..."
diff --git a/lib/rexml/security.rb b/lib/rexml/security.rb
new file mode 100644
index 0000000000..593b652dc6
--- /dev/null
+++ b/lib/rexml/security.rb
@@ -0,0 +1,27 @@
+module REXML
+ module Security
+ @@entity_expansion_limit = 10_000
+
+ # Set the entity expansion limit. By default the limit is set to 10000.
+ def self.entity_expansion_limit=( val )
+ @@entity_expansion_limit = val
+ end
+
+ # Get the entity expansion limit. By default the limit is set to 10000.
+ def self.entity_expansion_limit
+ return @@entity_expansion_limit
+ end
+
+ @@entity_expansion_text_limit = 10_240
+
+ # Set the entity expansion limit. By default the limit is set to 10240.
+ def self.entity_expansion_text_limit=( val )
+ @@entity_expansion_text_limit = val
+ end
+
+ # Get the entity expansion limit. By default the limit is set to 10240.
+ def self.entity_expansion_text_limit
+ return @@entity_expansion_text_limit
+ end
+ end
+end
diff --git a/lib/rexml/source.rb b/lib/rexml/source.rb
index b653714b2f..a0bbe25de7 100644
--- a/lib/rexml/source.rb
+++ b/lib/rexml/source.rb
@@ -62,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 regexes on the fly; however, this was
+ # generated search regexps 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
diff --git a/lib/rexml/streamlistener.rb b/lib/rexml/streamlistener.rb
index 619c529578..3a0528c102 100644
--- a/lib/rexml/streamlistener.rb
+++ b/lib/rexml/streamlistener.rb
@@ -13,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 immidiately after tag_start
+ # will be called immediately after tag_start
# @p the name of the tag
def tag_end name
end
@@ -57,17 +57,17 @@ module REXML
# declaration. It can be in a number of formats, but in general it
# returns (example, result):
# <!ENTITY % YN '"Yes"'>
- # ["%", "YN", "'\"Yes\"'", "\""]
+ # ["YN", "\"Yes\"", "%"]
# <!ENTITY % YN 'Yes'>
- # ["%", "YN", "'Yes'", "s"]
+ # ["YN", "Yes", "%"]
# <!ENTITY WhatHeSaid "He said %YN;">
- # ["WhatHeSaid", "\"He said %YN;\"", "YN"]
+ # ["WhatHeSaid", "He said %YN;"]
# <!ENTITY open-hatch SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml">
- # ["open-hatch", "SYSTEM", "\"http://www.textuality.com/boilerplate/OpenHatch.xml\""]
+ # ["open-hatch", "SYSTEM", "http://www.textuality.com/boilerplate/OpenHatch.xml"]
# <!ENTITY open-hatch PUBLIC "-//Textuality//TEXT Standard open-hatch boilerplate//EN" "http://www.textuality.com/boilerplate/OpenHatch.xml">
- # ["open-hatch", "PUBLIC", "\"-//Textuality//TEXT Standard open-hatch boilerplate//EN\"", "\"http://www.textuality.com/boilerplate/OpenHatch.xml\""]
+ # ["open-hatch", "PUBLIC", "-//Textuality//TEXT Standard open-hatch boilerplate//EN", "http://www.textuality.com/boilerplate/OpenHatch.xml"]
# <!ENTITY hatch-pic SYSTEM "../grafix/OpenHatch.gif" NDATA gif>
- # ["hatch-pic", "SYSTEM", "\"../grafix/OpenHatch.gif\"", "\n\t\t\t\t\t\t\tNDATA gif", "gif"]
+ # ["hatch-pic", "SYSTEM", "../grafix/OpenHatch.gif", "gif"]
def entitydecl content
end
# <!NOTATION ...>
diff --git a/lib/rexml/text.rb b/lib/rexml/text.rb
index 7b00b0f104..d3242ee46d 100644
--- a/lib/rexml/text.rb
+++ b/lib/rexml/text.rb
@@ -1,4 +1,4 @@
-require 'rexml/rexml'
+require 'rexml/security'
require 'rexml/entity'
require 'rexml/doctype'
require 'rexml/child'
@@ -103,7 +103,7 @@ module REXML
@raw = raw unless raw.nil?
@entity_filter = entity_filter
- @normalized = @unnormalized = nil
+ clear_cache
if arg.kind_of? String
@string = arg.dup
@@ -186,8 +186,13 @@ module REXML
# Appends text to this text node. The text is appended in the +raw+ mode
# of this text node.
+ #
+ # +returns+ the text itself to enable method chain like
+ # 'text << "XXX" << "YYY"'.
def <<( to_append )
@string << to_append.gsub( /\r\n?/, "\n" )
+ clear_cache
+ self
end
@@ -256,8 +261,7 @@ module REXML
# e[0].value = "<a>" # <a>&lt;a&gt;</a>
def value=( val )
@string = val.gsub( /\r\n?/, "\n" )
- @unnormalized = nil
- @normalized = nil
+ clear_cache
@raw = false
end
@@ -331,6 +335,12 @@ module REXML
out << copy
end
+ private
+ def clear_cache
+ @normalized = nil
+ @unnormalized = nil
+ end
+
# Reads text, substituting entities
def Text::read_with_substitution( input, illegal=nil )
copy = input.clone
@@ -368,7 +378,7 @@ module REXML
doctype.entities.each_value do |entity|
copy = copy.gsub( entity.value,
"&#{entity.name};" ) if entity.value and
- not( entity_filter and entity_filter.include?(entity) )
+ not( entity_filter and entity_filter.include?(entity.name) )
end
else
# Replace all ampersands that aren't part of an entity
@@ -384,7 +394,7 @@ module REXML
sum = 0
string.gsub( /\r\n?/, "\n" ).gsub( REFERENCE ) {
s = Text.expand($&, doctype, filter)
- if sum + s.bytesize > REXML.entity_expansion_text_limit
+ if sum + s.bytesize > Security.entity_expansion_text_limit
raise "entity expansion has grown too large"
else
sum += s.bytesize
diff --git a/lib/rexml/xmltokens.rb b/lib/rexml/xmltokens.rb
index 7dc4e8b2ba..4d4dd27f2d 100644
--- a/lib/rexml/xmltokens.rb
+++ b/lib/rexml/xmltokens.rb
@@ -2,12 +2,78 @@ module REXML
# Defines a number of tokens used for parsing XML. Not for general
# consumption.
module XMLTokens
- NCNAME_STR= '[\w:][\-\w.]*'
- NAME_STR= "(?:#{NCNAME_STR}:)?#{NCNAME_STR}"
+ # 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.
- NAMECHAR = '[\-\w\.:]'
- NAME = "([\\w:]#{NAMECHAR}*)"
- NMTOKEN = "(?:#{NAMECHAR})+"
+ # 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})+"
NMTOKENS = "#{NMTOKEN}(\\s+#{NMTOKEN})*"
REFERENCE = "(?:&#{NAME};|&#\\d+;|&#x[0-9a-fA-F]+;)"
diff --git a/lib/rexml/xpath_parser.rb b/lib/rexml/xpath_parser.rb
index 0fc9da2e08..367cbee1e8 100644
--- a/lib/rexml/xpath_parser.rb
+++ b/lib/rexml/xpath_parser.rb
@@ -63,19 +63,19 @@ module REXML
end
def parse path, nodeset
- #puts "#"*40
- path_stack = @parser.parse( path )
- #puts "PARSE: #{path} => #{path_stack.inspect}"
- #puts "PARSE: nodeset = #{nodeset.inspect}"
- 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
- #puts "#"*40
- path_stack = @parser.parse( path )
- #puts "PARSE: #{path} => #{path_stack.inspect}"
- #puts "PARSE: nodeset = #{nodeset.inspect}"
- 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
diff --git a/lib/rinda/rinda.rb b/lib/rinda/rinda.rb
index 18e284a544..d9cd3782a0 100644
--- a/lib/rinda/rinda.rb
+++ b/lib/rinda/rinda.rb
@@ -206,6 +206,50 @@ module Rinda
# TupleSpaceProxy allows a remote Tuplespace to appear as local.
class TupleSpaceProxy
+ ##
+ # A Port ensures that a moved tuple arrives properly at its destination
+ # and does not get lost.
+ #
+ # See https://bugs.ruby-lang.org/issues/8125
+
+ class Port # :nodoc:
+ attr_reader :value
+
+ def self.deliver
+ port = new
+
+ begin
+ yield(port)
+ ensure
+ port.close
+ end
+
+ port.value
+ end
+
+ def initialize
+ @open = true
+ @value = nil
+ end
+
+ ##
+ # Don't let the DRb thread push to it when remote sends tuple
+
+ def close
+ @open = false
+ end
+
+ ##
+ # Stores +value+ and ensure it does not get marshaled multiple times.
+
+ def push value
+ raise 'port closed' unless @open
+
+ @value = value
+
+ nil # avoid Marshal
+ end
+ end
##
# Creates a new TupleSpaceProxy to wrap +ts+.
@@ -225,9 +269,9 @@ module Rinda
# Takes +tuple+ from the proxied TupleSpace. See TupleSpace#take.
def take(tuple, sec=nil, &block)
- port = []
- @ts.move(DRbObject.new(port), tuple, sec, &block)
- port[0]
+ Port.deliver do |port|
+ @ts.move(DRbObject.new(port), tuple, sec, &block)
+ end
end
##
diff --git a/lib/rinda/ring.rb b/lib/rinda/ring.rb
index 8a2a201c8a..fe33420494 100644
--- a/lib/rinda/ring.rb
+++ b/lib/rinda/ring.rb
@@ -4,6 +4,7 @@
require 'drb/drb'
require 'rinda/rinda'
require 'thread'
+require 'ipaddr'
module Rinda
@@ -14,38 +15,169 @@ module Rinda
##
# A RingServer allows a Rinda::TupleSpace to be located via UDP broadcasts.
- # Service location uses the following steps:
+ # Default service location uses the following steps:
#
- # 1. A RingServer begins listening on the broadcast UDP address.
+ # 1. A RingServer begins listening on the network broadcast UDP address.
# 2. A RingFinger sends a UDP packet containing the DRb URI where it will
# listen for a reply.
# 3. The RingServer receives the UDP packet and connects back to the
# provided DRb URI with the DRb service.
+ #
+ # A RingServer requires a TupleSpace:
+ #
+ # ts = Rinda::TupleSpace.new
+ # rs = Rinda::RingServer.new
+ #
+ # RingServer can also listen on multicast addresses for announcements. This
+ # allows multiple RingServers to run on the same host. To use network
+ # broadcast and multicast:
+ #
+ # ts = Rinda::TupleSpace.new
+ # rs = Rinda::RingServer.new ts, %w[Socket::INADDR_ANY, 239.0.0.1 ff02::1]
class RingServer
include DRbUndumped
##
- # Advertises +ts+ on the UDP broadcast address at +port+.
+ # Special renewer for the RingServer to allow shutdown
+
+ class Renewer # :nodoc:
+ include DRbUndumped
+
+ ##
+ # Set to false to shutdown future requests using this Renewer
+
+ attr_writer :renew
+
+ def initialize # :nodoc:
+ @renew = true
+ end
+
+ def renew # :nodoc:
+ @renew ? 1 : true
+ end
+ end
+
+ ##
+ # Advertises +ts+ on the given +addresses+ at +port+.
+ #
+ # If +addresses+ is omitted only the UDP broadcast address is used.
+ #
+ # +addresses+ can contain multiple addresses. If a multicast address is
+ # given in +addresses+ then the RingServer will listen for multicast
+ # queries.
+ #
+ # If you use IPv4 multicast you may need to set an address of the inbound
+ # interface which joins a multicast group.
+ #
+ # ts = Rinda::TupleSpace.new
+ # rs = Rinda::RingServer.new(ts, [['239.0.0.1', '9.5.1.1']])
+ #
+ # You can set addresses as an Array Object. The first element of the
+ # Array is a multicast address and the second is an inbound interface
+ # address. If the second is omitted then '0.0.0.0' is used.
+ #
+ # If you use IPv6 multicast you may need to set both the local interface
+ # address and the inbound interface index:
+ #
+ # rs = Rinda::RingServer.new(ts, [['ff02::1', '::1', 1]])
+ #
+ # The first element is a multicast address and the second is an inbound
+ # interface address. The third is an inbound interface index.
+ #
+ # At this time there is no easy way to get an interface index by name.
+ #
+ # If the second is omitted then '::1' is used.
+ # If the third is omitted then 0 (default interface) is used.
+
+ def initialize(ts, addresses=[Socket::INADDR_ANY], port=Ring_PORT)
+ @port = port
+
+ if Integer === addresses then
+ addresses, @port = [Socket::INADDR_ANY], addresses
+ end
+
+ @renewer = Renewer.new
- def initialize(ts, port=Ring_PORT)
@ts = ts
- @soc = UDPSocket.open
- @soc.bind('', port)
- @w_service = write_service
- @r_service = reply_service
+ @sockets = []
+ addresses.each do |address|
+ if Array === address
+ make_socket(*address)
+ else
+ make_socket(address)
+ end
+ end
+
+ @w_services = write_services
+ @r_service = reply_service
end
##
- # Creates a thread that picks up UDP packets and passes them to do_write
- # for decoding.
+ # Creates a socket at +address+
+ #
+ # If +address+ is multicast address then +interface_address+ and
+ # +multicast_interface+ can be set as optional.
+ #
+ # A created socket is bound to +interface_address+. If you use IPv4
+ # multicast then the interface of +interface_address+ is used as the
+ # inbound interface. If +interface_address+ is omitted or nil then
+ # '0.0.0.0' or '::1' is used.
+ #
+ # If you use IPv6 multicast then +multicast_interface+ is used as the
+ # inbound interface. +multicast_interface+ is a network interface index.
+ # If +multicast_interface+ is omitted then 0 (default interface) is used.
+
+ def make_socket(address, interface_address=nil, multicast_interface=0)
+ addrinfo = Addrinfo.udp(address, @port)
+
+ socket = Socket.new(addrinfo.pfamily, addrinfo.socktype,
+ addrinfo.protocol)
+ @sockets << socket
+
+ if addrinfo.ipv4_multicast? or addrinfo.ipv6_multicast? then
+ if Socket.const_defined?(:SO_REUSEPORT) then
+ socket.setsockopt(:SOCKET, :SO_REUSEPORT, true)
+ else
+ socket.setsockopt(:SOCKET, :SO_REUSEADDR, true)
+ end
- def write_service
- Thread.new do
- loop do
- msg = @soc.recv(1024)
- do_write(msg)
+ if addrinfo.ipv4_multicast? then
+ interface_address = '0.0.0.0' if interface_address.nil?
+ socket.bind(Addrinfo.udp(interface_address, @port))
+
+ mreq = IPAddr.new(addrinfo.ip_address).hton +
+ IPAddr.new(interface_address).hton
+
+ socket.setsockopt(:IPPROTO_IP, :IP_ADD_MEMBERSHIP, mreq)
+ else
+ interface_address = '::1' if interface_address.nil?
+ socket.bind(Addrinfo.udp(interface_address, @port))
+
+ mreq = IPAddr.new(addrinfo.ip_address).hton +
+ [multicast_interface].pack('I')
+
+ socket.setsockopt(:IPPROTO_IPV6, :IPV6_JOIN_GROUP, mreq)
+ end
+ else
+ socket.bind(addrinfo)
+ end
+
+ socket
+ end
+
+ ##
+ # Creates threads that pick up UDP packets and passes them to do_write for
+ # decoding.
+
+ def write_services
+ @sockets.map do |s|
+ Thread.new(s) do |socket|
+ loop do
+ msg = socket.recv(1024)
+ do_write(msg)
+ end
end
end
end
@@ -80,11 +212,30 @@ module Rinda
# address of the local TupleSpace.
def do_reply
- tuple = @ts.take([:lookup_ring, DRbObject])
+ tuple = @ts.take([:lookup_ring, nil], @renewer)
Thread.new { tuple[1].call(@ts) rescue nil}
rescue
end
+ ##
+ # Shuts down the RingServer
+
+ def shutdown
+ @renewer.renew = false
+
+ @w_services.each do |thread|
+ thread.kill
+ thread.join
+ end
+
+ @sockets.each do |socket|
+ socket.close
+ end
+
+ @r_service.kill
+ @r_service.join
+ end
+
end
##
@@ -92,6 +243,33 @@ module Rinda
# TupleSpace. Typically, all a client needs to do is call
# RingFinger.primary to retrieve the remote TupleSpace, which it can then
# begin using.
+ #
+ # To find the first available remote TupleSpace:
+ #
+ # Rinda::RingFinger.primary
+ #
+ # To create a RingFinger that broadcasts to a custom list:
+ #
+ # rf = Rinda::RingFinger.new ['localhost', '192.0.2.1']
+ # rf.primary
+ #
+ # Rinda::RingFinger also understands multicast addresses and sets them up
+ # properly. This allows you to run multiple RingServers on the same host:
+ #
+ # rf = Rinda::RingFinger.new ['239.0.0.1']
+ # rf.primary
+ #
+ # You can set the hop count (or TTL) for multicast searches using
+ # #multicast_hops.
+ #
+ # If you use IPv6 multicast you may need to set both an address and the
+ # outbound interface index:
+ #
+ # rf = Rinda::RingFinger.new ['ff02::1']
+ # rf.multicast_interface = 1
+ # rf.primary
+ #
+ # At this time there is no easy way to get an interface index by name.
class RingFinger
@@ -131,6 +309,18 @@ module Rinda
attr_accessor :broadcast_list
##
+ # Maximum number of hops for sent multicast packets (if using a multicast
+ # address in the broadcast list). The default is 1 (same as UDP
+ # broadcast).
+
+ attr_accessor :multicast_hops
+
+ ##
+ # The interface index to send IPv6 multicast packets from.
+
+ attr_accessor :multicast_interface
+
+ ##
# The port that RingFinger will send query packets to.
attr_accessor :port
@@ -143,12 +333,18 @@ module Rinda
##
# Creates a new RingFinger that will look for RingServers at +port+ on
# the addresses in +broadcast_list+.
+ #
+ # If +broadcast_list+ contains a multicast address then multicast queries
+ # will be made using the given multicast_hops and multicast_interface.
def initialize(broadcast_list=@@broadcast_list, port=Ring_PORT)
@broadcast_list = broadcast_list || ['localhost']
@port = port
@primary = nil
@rings = []
+
+ @multicast_hops = 1
+ @multicast_interface = 0
end
##
@@ -178,15 +374,7 @@ module Rinda
msg = Marshal.dump([[:lookup_ring, DRbObject.new(block)], timeout])
@broadcast_list.each do |it|
- soc = UDPSocket.open
- begin
- soc.setsockopt(Socket::SOL_SOCKET, Socket::SO_BROADCAST, true)
- soc.send(msg, 0, it, @port)
- rescue
- nil
- ensure
- soc.close
- end
+ send_message(it, msg)
end
sleep(timeout)
end
@@ -217,6 +405,47 @@ module Rinda
@primary
end
+ ##
+ # Creates a socket for +address+ with the appropriate multicast options
+ # for multicast addresses.
+
+ def make_socket(address) # :nodoc:
+ 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
+ end
+
+ soc
+ end
+
+ def send_message(address, message) # :nodoc:
+ soc = make_socket(address)
+
+ soc.send(message, 0)
+ rescue
+ nil
+ ensure
+ soc.close if soc
+ end
+
end
##
@@ -249,27 +478,3 @@ 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 ba494aa4ec..11532fd161 100644
--- a/lib/rinda/tuplespace.rb
+++ b/lib/rinda/tuplespace.rb
@@ -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.
- # +false+:: it has expired.
+ # +true+:: it has expired.
# Numeric:: it will expire in that many seconds.
#
# Otherwise the argument refers to some kind of renewer object
@@ -491,7 +491,7 @@ module Rinda
port.push(entry.value) if port
@bag.delete(entry)
notify_event('take', entry.value)
- return entry.value
+ return port ? nil : entry.value
end
raise RequestExpiredError if template.expired?
@@ -506,7 +506,7 @@ module Rinda
port.push(entry.value) if port
@bag.delete(entry)
notify_event('take', entry.value)
- return entry.value
+ return port ? nil : entry.value
end
template.wait
end
diff --git a/lib/rss/0.9.rb b/lib/rss/0.9.rb
index 28ef768274..77b2de131c 100644
--- a/lib/rss/0.9.rb
+++ b/lib/rss/0.9.rb
@@ -2,6 +2,39 @@ require "rss/parser"
module RSS
+ ##
+ # = RSS 0.9 support
+ #
+ # RSS has three different versions. This module contains support for version
+ # 0.9.1[http://www.rssboard.org/rss-0-9-1-netscape].
+ #
+ # == Producing RSS 0.9
+ #
+ # Producing our own RSS feeds is easy as well. Let's make a very basic feed:
+ #
+ # require "rss"
+ #
+ # rss = RSS::Maker.make("0.91") do |maker|
+ # maker.channel.language = "en"
+ # maker.channel.author = "matz"
+ # maker.channel.updated = Time.now.to_s
+ # maker.channel.link = "http://www.ruby-lang.org/en/feeds/news.rss"
+ # maker.channel.title = "Example Feed"
+ # maker.channel.description = "A longer description of my feed."
+ # maker.image.url = "http://www.ruby-lang.org/images/logo.gif"
+ # maker.image.title = "An image"
+ # maker.items.new_item do |item|
+ # item.link = "http://www.ruby-lang.org/en/news/2010/12/25/ruby-1-9-2-p136-is-released/"
+ # item.title = "Ruby 1.9.2-p136 is released"
+ # item.updated = Time.now.to_s
+ # end
+ # end
+ #
+ # puts rss
+ #
+ # As you can see, this is a very Builder-like DSL. This code will spit out an
+ # RSS 0.9 feed with one item. If we needed a second item, we'd make another
+ # block with maker.items.new_item and build a second one.
module RSS09
NSPOOL = {}
ELEMENTS = []
diff --git a/lib/rss/1.0.rb b/lib/rss/1.0.rb
index 2ff53b4723..a2d88d459e 100644
--- a/lib/rss/1.0.rb
+++ b/lib/rss/1.0.rb
@@ -2,6 +2,38 @@ require "rss/parser"
module RSS
+ ##
+ # = RSS 1.0 support
+ #
+ # RSS has three different versions. This module contains support for version
+ # 1.0[http://web.resource.org/rss/1.0/]
+ #
+ # == Producing RSS 1.0
+ #
+ # Producing our own RSS feeds is easy as well. Let's make a very basic feed:
+ #
+ # require "rss"
+ #
+ # rss = RSS::Maker.make("1.0") do |maker|
+ # maker.channel.language = "en"
+ # maker.channel.author = "matz"
+ # maker.channel.about = "About my feed."
+ # maker.channel.updated = Time.now.to_s
+ # maker.channel.link = "http://www.ruby-lang.org/en/feeds/news.rss"
+ # maker.channel.title = "Example Feed"
+ # maker.channel.description = "A longer description of my feed."
+ # maker.items.new_item do |item|
+ # item.link = "http://www.ruby-lang.org/en/news/2010/12/25/ruby-1-9-2-p136-is-released/"
+ # item.title = "Ruby 1.9.2-p136 is released"
+ # item.updated = Time.now.to_s
+ # end
+ # end
+ #
+ # puts rss
+ #
+ # As you can see, this is a very Builder-like DSL. This code will spit out an
+ # RSS 1.0 feed with one item. If we needed a second item, we'd make another
+ # block with maker.items.new_item and build a second one.
module RSS10
NSPOOL = {}
ELEMENTS = []
diff --git a/lib/rss/2.0.rb b/lib/rss/2.0.rb
index 9622c598d9..5c0caecd73 100644
--- a/lib/rss/2.0.rb
+++ b/lib/rss/2.0.rb
@@ -2,6 +2,37 @@ require "rss/0.9"
module RSS
+ ##
+ # = RSS 2.0 support
+ #
+ # RSS has three different versions. This module contains support for version
+ # 2.0[http://www.rssboard.org/rss-specification]
+ #
+ # == Producing RSS 2.0
+ #
+ # Producing our own RSS feeds is easy as well. Let's make a very basic feed:
+ #
+ # require "rss"
+ #
+ # rss = RSS::Maker.make("2.0") do |maker|
+ # maker.channel.language = "en"
+ # maker.channel.author = "matz"
+ # maker.channel.updated = Time.now.to_s
+ # maker.channel.link = "http://www.ruby-lang.org/en/feeds/news.rss"
+ # maker.channel.title = "Example Feed"
+ # maker.channel.description = "A longer description of my feed."
+ # maker.items.new_item do |item|
+ # item.link = "http://www.ruby-lang.org/en/news/2010/12/25/ruby-1-9-2-p136-is-released/"
+ # item.title = "Ruby 1.9.2-p136 is released"
+ # item.updated = Time.now.to_s
+ # end
+ # end
+ #
+ # puts rss
+ #
+ # As you can see, this is a very Builder-like DSL. This code will spit out an
+ # RSS 2.0 feed with one item. If we needed a second item, we'd make another
+ # block with maker.items.new_item and build a second one.
class Rss
class Channel
diff --git a/lib/rss/atom.rb b/lib/rss/atom.rb
index fc16a381c1..d3524231ff 100644
--- a/lib/rss/atom.rb
+++ b/lib/rss/atom.rb
@@ -8,7 +8,7 @@ module RSS
#
# The Atom module provides support in reading and creating feeds.
#
- # See the RSS module for examples consuming and creating feeds
+ # See the RSS module for examples consuming and creating feeds.
module Atom
##
diff --git a/lib/rss/content.rb b/lib/rss/content.rb
index b12ee918aa..5a2120c067 100644
--- a/lib/rss/content.rb
+++ b/lib/rss/content.rb
@@ -1,7 +1,9 @@
require "rss/rss"
module RSS
+ # The prefix for the Content XML namespace.
CONTENT_PREFIX = 'content'
+ # The URI of the Content specification.
CONTENT_URI = "http://purl.org/rss/1.0/modules/content/"
module ContentModel
diff --git a/lib/rss/dublincore.rb b/lib/rss/dublincore.rb
index 53a4ca70d6..58424141cd 100644
--- a/lib/rss/dublincore.rb
+++ b/lib/rss/dublincore.rb
@@ -1,7 +1,9 @@
require "rss/rss"
module RSS
+ # The prefix for the Dublin Core XML namespace.
DC_PREFIX = 'dc'
+ # The URI of the Dublin Core specification.
DC_URI = "http://purl.org/dc/elements/1.1/"
module BaseDublinCoreModel
diff --git a/lib/rss/image.rb b/lib/rss/image.rb
index e79e9f5e65..b0619141bb 100644
--- a/lib/rss/image.rb
+++ b/lib/rss/image.rb
@@ -3,11 +3,15 @@ require 'rss/dublincore'
module RSS
+ # The prefix for the Image XML namespace.
IMAGE_PREFIX = 'image'
+ # The URI for the Image specification.
IMAGE_URI = 'http://purl.org/rss/1.0/modules/image/'
RDF.install_ns(IMAGE_PREFIX, IMAGE_URI)
+ # This constant holds strings which contain the names of
+ # image elements, with the appropriate prefix.
IMAGE_ELEMENTS = []
%w(item favicon).each do |name|
diff --git a/lib/rss/itunes.rb b/lib/rss/itunes.rb
index f95ca7aa2e..e6de5c1ca2 100644
--- a/lib/rss/itunes.rb
+++ b/lib/rss/itunes.rb
@@ -1,7 +1,9 @@
require 'rss/2.0'
module RSS
+ # The prefix for the iTunes XML namespace.
ITUNES_PREFIX = 'itunes'
+ # The URI of the iTunes specification.
ITUNES_URI = 'http://www.itunes.com/dtds/podcast-1.0.dtd'
Rss.install_ns(ITUNES_PREFIX, ITUNES_URI)
diff --git a/lib/rss/maker/base.rb b/lib/rss/maker/base.rb
index 36860032da..0f2fc11103 100644
--- a/lib/rss/maker/base.rb
+++ b/lib/rss/maker/base.rb
@@ -367,7 +367,7 @@ module RSS
self.date ||= self.dc_date
super
ensure
- date = keep[:date]
+ self.date = keep[:date]
dc_dates.replace(keep[:dc_dates])
end
diff --git a/lib/rss/parser.rb b/lib/rss/parser.rb
index c426a187b8..1b6e4e9596 100644
--- a/lib/rss/parser.rb
+++ b/lib/rss/parser.rb
@@ -545,6 +545,7 @@ module RSS
end
unless const_defined? :AVAILABLE_PARSER_LIBRARIES
+ # The list of all available libraries for parsing.
AVAILABLE_PARSER_LIBRARIES = [
["rss/xmlparser", :XMLParserParser],
["rss/xmlscanner", :XMLScanParser],
@@ -552,6 +553,7 @@ module RSS
]
end
+ # The list of all available parsers, in constant form.
AVAILABLE_PARSERS = []
AVAILABLE_PARSER_LIBRARIES.each do |lib, parser|
diff --git a/lib/rss/rexmlparser.rb b/lib/rss/rexmlparser.rb
index 7112ac3669..a5a2a2edbe 100644
--- a/lib/rss/rexmlparser.rb
+++ b/lib/rss/rexmlparser.rb
@@ -1,11 +1,6 @@
require "rexml/document"
require "rexml/streamlistener"
-/\A(\d+)\.(\d+)(?:\.\d+)+\z/ =~ REXML::Version
-if ([$1.to_i, $2.to_i] <=> [2, 5]) < 0
- raise LoadError, "needs REXML 2.5 or later (#{REXML::Version})"
-end
-
module RSS
class REXMLParser < BaseParser
diff --git a/lib/rss/rss.rb b/lib/rss/rss.rb
index 6a942bfa63..4f6732b4d2 100644
--- a/lib/rss/rss.rb
+++ b/lib/rss/rss.rb
@@ -3,6 +3,14 @@ require "time"
class Time
class << self
unless respond_to?(:w3cdtf)
+ # This method converts a W3CDTF string date/time format to Time object.
+ #
+ # The W3CDTF format is defined here: http://www.w3.org/TR/NOTE-datetime
+ #
+ # Time.w3cdtf('2003-02-15T13:50:05-05:00')
+ # # => 2003-02-15 10:50:05 -0800
+ # Time.w3cdtf('2003-02-15T13:50:05-05:00').class
+ # # => Time
def w3cdtf(date)
if /\A\s*
(-?\d+)-(\d\d)-(\d\d)
@@ -20,7 +28,7 @@ class Time
datetime = apply_offset(*(datetime + [off]))
datetime << usec
time = Time.utc(*datetime)
- time.localtime unless zone_utc?(zone)
+ force_zone!(time, zone, off)
time
else
datetime << usec
@@ -34,6 +42,13 @@ class Time
end
unless method_defined?(:w3cdtf)
+ # This method converts a Time object to a String. The String contains the
+ # time in W3CDTF date/time format.
+ #
+ # The W3CDTF format is defined here: http://www.w3.org/TR/NOTE-datetime
+ #
+ # Time.now.w3cdtf
+ # # => "2013-08-26T14:12:10.817124-07:00"
def w3cdtf
if usec.zero?
fraction_digits = 0
@@ -53,14 +68,20 @@ require "rss/xml-stylesheet"
module RSS
+ # The current version of RSS
VERSION = "0.2.7"
+ # The URI of the RSS 1.0 specification
URI = "http://purl.org/rss/1.0/"
- DEBUG = false
+ DEBUG = false # :nodoc:
+ # The basic error all other RSS errors stem from. Rescue this error if you
+ # want to handle any given RSS error and you don't care about the details.
class Error < StandardError; end
+ # RSS, being an XML-based format, has namespace support. If two namespaces are
+ # declared with the same name, an OverlappedPrefixError will be raised.
class OverlappedPrefixError < Error
attr_reader :prefix
def initialize(prefix)
@@ -68,11 +89,13 @@ module RSS
end
end
+ # The InvalidRSSError error is the base class for a variety of errors
+ # related to a poorly-formed RSS feed. Rescue this error if you only
+ # care that a file could be invalid, but don't care how it is invalid.
class InvalidRSSError < Error; end
- ##
- # Raised if no matching tag is found.
-
+ # Since RSS is based on XML, it must have opening and closing tags that
+ # match. If they don't, a MissingTagError will be raised.
class MissingTagError < InvalidRSSError
attr_reader :tag, :parent
def initialize(tag, parent)
@@ -81,9 +104,9 @@ module RSS
end
end
- ##
- # Raised if there are more occurrences of the tag than expected.
-
+ # 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
+ # will be raised.
class TooMuchTagError < InvalidRSSError
attr_reader :tag, :parent
def initialize(tag, parent)
@@ -92,9 +115,8 @@ module RSS
end
end
- ##
- # Raised if a required attribute is missing.
-
+ # Certain attributes are required on specific tags in an RSS feed. If a feed
+ # is missing one of these attributes, a MissingAttributeError is raised.
class MissingAttributeError < InvalidRSSError
attr_reader :tag, :attribute
def initialize(tag, attribute)
@@ -103,9 +125,8 @@ module RSS
end
end
- ##
- # Raised when an unknown tag is found.
-
+ # RSS does not allow for free-form tag names, so if an RSS feed contains a
+ # tag that we don't know about, an UnknownTagError is raised.
class UnknownTagError < InvalidRSSError
attr_reader :tag, :uri
def initialize(tag, uri)
@@ -114,9 +135,7 @@ module RSS
end
end
- ##
# Raised when an unexpected tag is encountered.
-
class NotExpectedTagError < InvalidRSSError
attr_reader :tag, :uri, :parent
def initialize(tag, uri, parent)
@@ -125,11 +144,10 @@ module RSS
end
end
# For backward compatibility :X
- NotExceptedTagError = NotExpectedTagError
-
- ##
- # Raised when an incorrect value is used.
+ NotExceptedTagError = NotExpectedTagError # :nodoc:
+ # Attributes are in key-value form, and if there's no value provided for an
+ # attribute, a NotAvailableValueError will be raised.
class NotAvailableValueError < InvalidRSSError
attr_reader :tag, :value, :attribute
def initialize(tag, value, attribute=nil)
@@ -141,9 +159,7 @@ module RSS
end
end
- ##
# Raised when an unknown conversion error occurs.
-
class UnknownConversionMethodError < Error
attr_reader :to, :from
def initialize(to, from)
@@ -153,11 +169,9 @@ module RSS
end
end
# for backward compatibility
- UnknownConvertMethod = UnknownConversionMethodError
+ UnknownConvertMethod = UnknownConversionMethodError # :nodoc:
- ##
# Raised when a conversion failure occurs.
-
class ConversionError < Error
attr_reader :string, :to, :from
def initialize(string, to, from)
@@ -168,9 +182,7 @@ module RSS
end
end
- ##
# Raised when a required variable is not set.
-
class NotSetError < Error
attr_reader :name, :variables
def initialize(name, variables)
@@ -180,9 +192,7 @@ module RSS
end
end
- ##
# Raised when a RSS::Maker attempts to use an unknown maker.
-
class UnsupportedMakerVersionError < Error
attr_reader :version
def initialize(version)
diff --git a/lib/rss/slash.rb b/lib/rss/slash.rb
index f102413b46..65c61142e1 100644
--- a/lib/rss/slash.rb
+++ b/lib/rss/slash.rb
@@ -1,7 +1,9 @@
require 'rss/1.0'
module RSS
+ # The prefix for the Slash XML namespace.
SLASH_PREFIX = 'slash'
+ # The URI of the Slash specification.
SLASH_URI = "http://purl.org/rss/1.0/modules/slash/"
RDF.install_ns(SLASH_PREFIX, SLASH_URI)
diff --git a/lib/rss/syndication.rb b/lib/rss/syndication.rb
index c375645dd6..77a84b9a2a 100644
--- a/lib/rss/syndication.rb
+++ b/lib/rss/syndication.rb
@@ -1,8 +1,9 @@
require "rss/1.0"
module RSS
-
+ # The prefix for the Syndication XML namespace.
SY_PREFIX = 'sy'
+ # The URI of the Syndication specification.
SY_URI = "http://purl.org/rss/1.0/modules/syndication/"
RDF.install_ns(SY_PREFIX, SY_URI)
diff --git a/lib/rss/taxonomy.rb b/lib/rss/taxonomy.rb
index b82e55dacc..b7fbe6b0de 100644
--- a/lib/rss/taxonomy.rb
+++ b/lib/rss/taxonomy.rb
@@ -2,12 +2,14 @@ require "rss/1.0"
require "rss/dublincore"
module RSS
-
+ # The prefix for the Taxonomy XML namespace.
TAXO_PREFIX = "taxo"
+ # The URI for the specification of the Taxonomy XML namespace.
TAXO_URI = "http://purl.org/rss/1.0/modules/taxonomy/"
RDF.install_ns(TAXO_PREFIX, TAXO_URI)
+ # The listing of all the taxonomy elements, with the appropriate namespace.
TAXO_ELEMENTS = []
%w(link).each do |name|
diff --git a/lib/rss/trackback.rb b/lib/rss/trackback.rb
index 59fedb5f3e..577bf0cef7 100644
--- a/lib/rss/trackback.rb
+++ b/lib/rss/trackback.rb
@@ -1,7 +1,9 @@
+# This file contains the implementation of trackbacks. It is entirely internal
+# and not useful to outside developers.
require 'rss/1.0'
require 'rss/2.0'
-module RSS
+module RSS # :nodoc: all
TRACKBACK_PREFIX = 'trackback'
TRACKBACK_URI = 'http://madskills.com/public/xml/rss/module/trackback/'
diff --git a/lib/rss/utils.rb b/lib/rss/utils.rb
index 75b05d45c7..b420e6b24c 100644
--- a/lib/rss/utils.rb
+++ b/lib/rss/utils.rb
@@ -1,14 +1,84 @@
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
+ # to those who aren't developing the library itself.
module Utils
module_function
- # Convert a name_with_underscores to CamelCase.
+ # Given a +name+ in a name_with_underscores or a name-with-dashes format,
+ # returns the CamelCase version of +name+.
+ #
+ # If the +name+ is already CamelCased, nothing happens.
+ #
+ # Examples:
+ #
+ # require 'rss/utils'
+ #
+ # RSS::Utils.to_class_name("sample_name")
+ # # => "SampleName"
+ # RSS::Utils.to_class_name("with-dashes")
+ # # => "WithDashes"
+ # RSS::Utils.to_class_name("CamelCase")
+ # # => "CamelCase"
def to_class_name(name)
name.split(/[_\-]/).collect do |part|
"#{part[0, 1].upcase}#{part[1..-1]}"
end.join("")
end
+ # Returns an array of two elements: the filename where the calling method
+ # is located, and the line number where it is defined.
+ #
+ # Takes an optional argument +i+, which specifies how many callers up the
+ # stack to look.
+ #
+ # Examples:
+ #
+ # require 'rss/utils'
+ #
+ # def foo
+ # p RSS::Utils.get_file_and_line_from_caller
+ # p RSS::Utils.get_file_and_line_from_caller(1)
+ # end
+ #
+ # def bar
+ # foo
+ # end
+ #
+ # def baz
+ # bar
+ # end
+ #
+ # baz
+ # # => ["test.rb", 5]
+ # # => ["test.rb", 9]
+ #
+ # If +i+ is not given, or is the default value of 0, it attempts to figure
+ # out the correct value. This is useful when in combination with
+ # instance_eval. For example:
+ #
+ # require 'rss/utils'
+ #
+ # def foo
+ # p RSS::Utils.get_file_and_line_from_caller(1)
+ # end
+ #
+ # def bar
+ # foo
+ # end
+ #
+ # instance_eval <<-RUBY, *RSS::Utils.get_file_and_line_from_caller
+ # def baz
+ # bar
+ # end
+ # RUBY
+ #
+ # baz
+ #
+ # # => ["test.rb", 8]
def get_file_and_line_from_caller(i=0)
file, line, = caller[i].split(':')
line = line.to_i
@@ -16,7 +86,19 @@ module RSS
[file, line]
end
- # escape '&', '"', '<' and '>' for use in HTML.
+ # Takes a string +s+ with some HTML in it, and escapes '&', '"', '<' and '>', by
+ # replacing them with the appropriate entities.
+ #
+ # This method is also aliased to h, for convenience.
+ #
+ # Examples:
+ #
+ # require 'rss/utils'
+ #
+ # RSS::Utils.html_escape("Dungeons & Dragons")
+ # # => "Dungeons &amp; Dragons"
+ # RSS::Utils.h(">_>")
+ # # => "&gt;_&gt;"
def html_escape(s)
s.to_s.gsub(/&/, "&amp;").gsub(/\"/, "&quot;").gsub(/>/, "&gt;").gsub(/</, "&lt;")
end
@@ -32,6 +114,12 @@ module RSS
end
end
+ # This method is used inside of several different objects to determine
+ # if special behavior is needed in the constructor.
+ #
+ # Special behavior is needed if the array passed in as +args+ has
+ # +true+ or +false+ as its value, and if the second element of +args+
+ # is a hash.
def element_initialize_arguments?(args)
[true, false].include?(args[0]) and args[1].is_a?(Hash)
end
diff --git a/lib/rss/xmlparser.rb b/lib/rss/xmlparser.rb
index aa902be396..46df94a320 100644
--- a/lib/rss/xmlparser.rb
+++ b/lib/rss/xmlparser.rb
@@ -20,7 +20,8 @@ end
module XML
class Parser
unless defined?(Error)
- Error = ::XMLParserError
+ # This error is legacy, so we just set it to the new one
+ Error = ::XMLParserError # :nodoc:
end
end
end
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index 7114a3b1e0..453520665a 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -6,9 +6,10 @@
#++
require 'rbconfig'
+require 'thread'
module Gem
- VERSION = '2.0.14'
+ VERSION = '2.4.1'
end
# Must be first since it unloads the prelude from 1.9.2
@@ -56,8 +57,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/operating_system.rb and
-# override any defaults from lib/rubygems/defaults.rb.
+# For RubyGems packagers, provide lib/rubygems/defaults/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.
@@ -83,7 +84,7 @@ require 'rubygems/errors'
# * Chad Fowler -- chad(at)chadfowler.com
# * David Black -- dblack(at)wobblini.net
# * Paul Brannan -- paul(at)atdesk.com
-# * Jim Weirch -- jim(at)weirichhouse.org
+# * Jim Weirich -- jim(at)weirichhouse.org
#
# Contributors:
#
@@ -115,7 +116,7 @@ module Gem
RUBYGEMS_DIR = File.dirname File.expand_path(__FILE__)
##
- # An Array of Regexps that match windows ruby platforms.
+ # An Array of Regexps that match windows Ruby platforms.
WIN_PATTERNS = [
/bccwin/i,
@@ -139,17 +140,28 @@ module Gem
build_info
cache
doc
+ extensions
gems
specifications
]
+ ##
+ # Subdirectories in a gem repository for default gems
+
+ REPOSITORY_DEFAULT_GEM_SUBDIRECTORIES = %w[
+ gems
+ specifications/default
+ ]
+
@@win_platform = nil
@configuration = nil
@loaded_specs = {}
+ LOADED_SPECS_MUTEX = Mutex.new
@path_to_default_spec_map = {}
@platforms = []
@ruby = nil
+ @ruby_api_version = nil
@sources = nil
@post_build_hooks ||= []
@@ -168,8 +180,8 @@ 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 alreaby be activated
- # or if it was ambigious (and thus unresolved) the code in our custom
+ # activate the latest version, then either it would already be activated
+ # or if it was ambiguous (and thus unresolved) the code in our custom
# require will try to activate the more specific version.
spec = Gem::Specification.find_inactive_by_path path
@@ -205,50 +217,6 @@ module Gem
end
end
- def self.detect_gemdeps
- if path = ENV['RUBYGEMS_GEMDEPS']
- path = path.dup.untaint
-
- if path == "-"
- here = Dir.pwd.untaint
- start = here
-
- begin
- while true
- path = GEM_DEP_FILES.find { |f| File.file?(f) }
-
- if path
- path = File.join here, path
- break
- end
-
- Dir.chdir ".."
-
- # If we're at a toplevel, stop.
- return if Dir.pwd == here
-
- here = Dir.pwd
- end
- ensure
- Dir.chdir start
- end
- end
-
- path.untaint
-
- return unless File.file? path
-
- rs = Gem::RequestSet.new
- rs.load_gemdeps path
-
- rs.resolve_current.map do |s|
- sp = s.full_spec
- sp.activate
- sp
- end
- end
- end
-
##
# Find the full path to the executable for gem +name+. If the +exec_name+
# is not given, the gem's default_executable is chosen, otherwise the
@@ -292,7 +260,6 @@ module Gem
# The path where gem executables are to be installed.
def self.bindir(install_dir=Gem.dir)
- # TODO: move to Gem::Dirs
return File.join install_dir, 'bin' unless
install_dir.to_s == Gem.default_dir.to_s
Gem.default_bindir
@@ -333,7 +300,7 @@ module Gem
end
##
- # The path the the data directory specified by the gem name. If the
+ # The path to the data directory specified by the gem name. If the
# package is not available as a gem, return nil.
def self.datadir(gem_name)
@@ -352,16 +319,21 @@ module Gem
Zlib::Deflate.deflate data
end
- # DOC: needs doc'd or :nodoc'd
+ # Retrieve the PathSupport object that RubyGems uses to
+ # lookup files.
+
def self.paths
@paths ||= Gem::PathSupport.new
end
- # DOC: needs doc'd or :nodoc'd
+ # Initialize the filesystem paths to use from +env+.
+ # +env+ is a hash-like object (typically ENV) that
+ # is queried for 'GEM_HOME', 'GEM_PATH', and 'GEM_SPEC_CACHE'
+
def self.paths=(env)
clear_paths
@paths = Gem::PathSupport.new env
- Gem::Specification.dirs = @paths.path # FIX: home is at end
+ Gem::Specification.dirs = @paths.path
end
##
@@ -370,15 +342,17 @@ module Gem
# FIXME deprecate these once everything else has been done -ebh
def self.dir
- # TODO: raise "no"
paths.home
end
def self.path
- # TODO: raise "no"
paths.path
end
+ def self.spec_cache_dir
+ paths.spec_cache_dir
+ end
+
##
# Quietly ensure the Gem directory +dir+ contains all the proper
# subdirectories. If we can't create a directory due to a permission
@@ -389,6 +363,23 @@ module Gem
# World-writable directories will never be created.
def self.ensure_gem_subdirectories dir = Gem.dir, mode = nil
+ ensure_subdirectories(dir, mode, REPOSITORY_SUBDIRECTORIES)
+ end
+
+ ##
+ # Quietly ensure the Gem directory +dir+ contains all the proper
+ # subdirectories for handling default gems. If we can't create a
+ # directory due to a permission problem, then we will silently continue.
+ #
+ # If +mode+ is given, missing directories are created with this mode.
+ #
+ # World-writable directories will never be created.
+
+ def self.ensure_default_gem_subdirectories dir = Gem.dir, mode = nil
+ ensure_subdirectories(dir, mode, REPOSITORY_DEFAULT_GEM_SUBDIRECTORIES)
+ end
+
+ def self.ensure_subdirectories dir, mode, subdirs # :nodoc:
old_umask = File.umask
File.umask old_umask | 002
@@ -398,7 +389,7 @@ module Gem
options[:mode] = mode if mode
- REPOSITORY_SUBDIRECTORIES.each do |name|
+ subdirs.each do |name|
subdir = File.join dir, name
next if File.exist? subdir
FileUtils.mkdir_p subdir, options rescue nil
@@ -408,6 +399,18 @@ module Gem
end
##
+ # The extension API version of ruby. This includes the static vs non-static
+ # distinction as extensions cannot be shared between the two.
+
+ def self.extension_api_version # :nodoc:
+ if 'no' == RbConfig::CONFIG['ENABLE_SHARED'] then
+ "#{ruby_api_version}-static"
+ else
+ ruby_api_version
+ end
+ end
+
+ ##
# Returns a list of paths matching +glob+ that can be used by a gem to pick
# up features from other gems. For example:
#
@@ -417,16 +420,12 @@ module Gem
# $LOAD_PATH for files as well as gems.
#
# Note that find_files will return all files even if they are from different
- # versions of the same gem.
+ # versions of the same gem. See also find_latest_files
def self.find_files(glob, check_load_path=true)
files = []
- if check_load_path
- files = $LOAD_PATH.map { |load_path|
- Dir["#{File.expand_path glob, load_path}#{Gem.suffix_pattern}"]
- }.flatten.select { |file| File.file? file.untaint }
- end
+ files = find_files_from_load_path glob if check_load_path
files.concat Gem::Specification.map { |spec|
spec.matches_for_glob("#{glob}#{Gem.suffix_pattern}")
@@ -439,6 +438,40 @@ module Gem
return files
end
+ def self.find_files_from_load_path glob # :nodoc:
+ $LOAD_PATH.map { |load_path|
+ Dir["#{File.expand_path glob, load_path}#{Gem.suffix_pattern}"]
+ }.flatten.select { |file| File.file? file.untaint }
+ end
+
+ ##
+ # Returns a list of paths matching +glob+ from the latest gems that can be
+ # used by a gem to pick up features from other gems. For example:
+ #
+ # Gem.find_latest_files('rdoc/discover').each do |path| load path end
+ #
+ # if +check_load_path+ is true (the default), then find_latest_files also
+ # searches $LOAD_PATH for files as well as gems.
+ #
+ # Unlike find_files, find_latest_files will return only files from the
+ # latest version of a gem.
+
+ def self.find_latest_files(glob, check_load_path=true)
+ files = []
+
+ files = find_files_from_load_path glob if check_load_path
+
+ files.concat Gem::Specification.latest_specs(true).map { |spec|
+ spec.matches_for_glob("#{glob}#{Gem.suffix_pattern}")
+ }.flatten
+
+ # $LOAD_PATH might contain duplicate entries or reference
+ # the spec dirs directly, so we prune.
+ files.uniq! if check_load_path
+
+ return files
+ end
+
##
# Finds the user's home directory.
#--
@@ -479,42 +512,30 @@ module Gem
private_class_method :find_home
+ # FIXME deprecate these in 3.0
+
##
# Zlib::GzipReader wrapper that unzips +data+.
def self.gunzip(data)
- # TODO: move to utils
- require 'stringio'
- require 'zlib'
- data = StringIO.new data
-
- unzipped = Zlib::GzipReader.new(data).read
- unzipped.force_encoding Encoding::BINARY if Object.const_defined? :Encoding
- unzipped
+ require 'rubygems/util'
+ Gem::Util.gunzip data
end
##
# Zlib::GzipWriter wrapper that zips +data+.
def self.gzip(data)
- # TODO: move to utils
- require 'stringio'
- require 'zlib'
- zipped = StringIO.new
- zipped.set_encoding Encoding::BINARY if Object.const_defined? :Encoding
-
- Zlib::GzipWriter.wrap zipped do |io| io.write data end
-
- zipped.string
+ require 'rubygems/util'
+ Gem::Util.gzip data
end
##
# A Zlib::Inflate#inflate wrapper
def self.inflate(data)
- # TODO: move to utils
- require 'zlib'
- Zlib::Inflate.inflate data
+ require 'rubygems/util'
+ Gem::Util.inflate data
end
##
@@ -525,9 +546,9 @@ module Gem
# Fetching: minitest-3.0.1.gem (100%)
# => [#<Gem::Specification:0x1013b4528 @name="minitest", ...>]
- def self.install name, version = Gem::Requirement.default
+ def self.install name, version = Gem::Requirement.default, *options
require "rubygems/dependency_installer"
- inst = Gem::DependencyInstaller.new
+ inst = Gem::DependencyInstaller.new(*options)
inst.install name, version
inst.installed_gems
end
@@ -549,14 +570,11 @@ module Gem
end
##
- # 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.
+ # The index to insert activated gem paths into the $LOAD_PATH. The activated
+ # gem's paths are inserted before site lib directory by default.
def self.load_path_insert_index
- index = $LOAD_PATH.index ConfigMap[:sitelibdir]
+ index = $LOAD_PATH.index RbConfig::CONFIG['sitelibdir']
index
end
@@ -620,7 +638,6 @@ module Gem
file = $1
lineno = $2.to_i
- # TODO: it is ALWAYS joined! STUPID!
[file, lineno]
end
@@ -728,8 +745,8 @@ module Gem
def self.prefix
prefix = File.dirname RUBYGEMS_DIR
- if prefix != File.expand_path(ConfigMap[:sitelibdir]) and
- prefix != File.expand_path(ConfigMap[:libdir]) and
+ if prefix != File.expand_path(RbConfig::CONFIG['sitelibdir']) and
+ prefix != File.expand_path(RbConfig::CONFIG['libdir']) and
'lib' == File.basename(RUBYGEMS_DIR) then
prefix
end
@@ -746,7 +763,14 @@ module Gem
# Safely read a file in binary mode on all platforms.
def self.read_binary(path)
- File.open path, binary_mode do |f| f.read end
+ open path, 'rb+' do |f|
+ f.flock(File::LOCK_EX)
+ f.read
+ end
+ rescue Errno::EACCES
+ open path, 'rb' do |f|
+ f.read
+ end
end
##
@@ -754,8 +778,8 @@ module Gem
def self.ruby
if @ruby.nil? then
- @ruby = File.join(ConfigMap[:bindir],
- "#{ConfigMap[:ruby_install_name]}#{ConfigMap[:EXEEXT]}")
+ @ruby = File.join(RbConfig::CONFIG['bindir'],
+ "#{RbConfig::CONFIG['ruby_install_name']}#{RbConfig::CONFIG['EXEEXT']}")
@ruby = "\"#{@ruby}\"" if @ruby =~ /\s/
end
@@ -764,6 +788,13 @@ module Gem
end
##
+ # Returns a String containing the API compatibility version of Ruby
+
+ def self.ruby_api_version
+ @ruby_api_version ||= RbConfig::CONFIG['ruby_version'].dup
+ end
+
+ ##
# Returns the latest release-version specification for the gem +name+.
def self.latest_spec_for name
@@ -793,7 +824,7 @@ module Gem
end
##
- # A Gem::Version for the currently running ruby.
+ # A Gem::Version for the currently running Ruby.
def self.ruby_version
return @ruby_version if defined? @ruby_version
@@ -893,7 +924,6 @@ module Gem
paths = nil if paths == [nil]
paths = paths.first if Array === Array(paths).first
self.paths = { "GEM_HOME" => home, "GEM_PATH" => paths }
- # TODO: self.paths = home, paths
end
##
@@ -916,9 +946,9 @@ module Gem
end
##
- # Load +plugins+ as ruby files
+ # Load +plugins+ as Ruby files
- def self.load_plugin_files(plugins)
+ def self.load_plugin_files plugins # :nodoc:
plugins.each do |plugin|
# Skip older versions of the GemCutter plugin: Its commands are in
@@ -936,10 +966,16 @@ module Gem
end
##
- # Find all 'rubygems_plugin' files in installed gems and load them
+ # Find the 'rubygems_plugin' files in the latest installed gems and load
+ # them
def self.load_plugins
- load_plugin_files find_files('rubygems_plugin', false)
+ # Remove this env var by at least 3.0
+ if ENV['RUBYGEMS_LOAD_ALL_PLUGINS']
+ load_plugin_files find_files('rubygems_plugin', false)
+ else
+ load_plugin_files find_latest_files('rubygems_plugin', false)
+ end
end
##
@@ -960,6 +996,76 @@ module Gem
load_plugin_files files
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.
+ #
+ # 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.
+ #
+ # 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
+
+ path ||= ENV['RUBYGEMS_GEMDEPS']
+ return unless path
+
+ path = path.dup
+
+ if path == "-" then
+ require 'rubygems/util'
+
+ Gem::Util.traverse_parents Dir.pwd do |directory|
+ dep_file = GEM_DEP_FILES.find { |f| File.file?(f) }
+
+ next unless dep_file
+
+ path = File.join directory, dep_file
+ break
+ end
+ end
+
+ path.untaint
+
+ unless File.file? path then
+ return unless raise_exception
+
+ raise ArgumentError, "Unable to find gem dependencies file at #{path}"
+ end
+
+ rs = Gem::RequestSet.new
+ 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
+
# FIX: Almost everywhere else we use the `def self.` way of defining class
# methods, and then we switch over to `class << self` here. Pick one or the
# other.
@@ -971,10 +1077,31 @@ module Gem
attr_reader :loaded_specs
##
- # Register a Gem::Specification for default gem
+ # Register a Gem::Specification for default gem.
+ #
+ # Two formats for the specification are supported:
+ #
+ # * MRI 2.0 style, where spec.files contains unprefixed require names.
+ # The spec's filenames will be registered as-is.
+ # * New style, where spec.files contains files prefixed with paths
+ # from spec.require_paths. The prefixes are stripped before
+ # registering the spec's filenames. Unprefixed files are omitted.
+ #
def register_default_spec(spec)
+ new_format = Gem.default_gems_use_full_paths? || spec.require_paths.any? {|path| spec.files.any? {|f| f.start_with? path } }
+
+ if new_format
+ prefix_group = spec.require_paths.map {|f| f + "/"}.join("|")
+ prefix_pattern = /^(#{prefix_group})/
+ end
+
spec.files.each do |file|
+ if new_format
+ file = file.sub(prefix_pattern, "")
+ next unless $~
+ end
+
@path_to_default_spec_map[file] = spec
end
end
@@ -1001,7 +1128,7 @@ module Gem
end
##
- # Clear default gem related varibles. It is for test
+ # Clear default gem related variables. It is for test
def clear_default_specs
@path_to_default_spec_map.clear
@@ -1061,16 +1188,18 @@ module Gem
autoload :ConfigFile, 'rubygems/config_file'
autoload :Dependency, 'rubygems/dependency'
autoload :DependencyList, 'rubygems/dependency_list'
- autoload :DependencyResolver, 'rubygems/dependency_resolver'
+ autoload :DependencyResolver, 'rubygems/resolver'
+ autoload :Installer, 'rubygems/installer'
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
@@ -1091,7 +1220,7 @@ unless gem_preluded then # TODO: remove guard after 1.9.2 dropped
if defined?(RUBY_ENGINE) then
begin
##
- # Defaults the ruby implementation wants to provide for RubyGems
+ # Defaults the Ruby implementation wants to provide for RubyGems
require "rubygems/defaults/#{RUBY_ENGINE}"
rescue LoadError
@@ -1106,4 +1235,5 @@ Gem::Specification.load_defaults
require 'rubygems/core_ext/kernel_gem'
require 'rubygems/core_ext/kernel_require'
-Gem.detect_gemdeps
+Gem.use_gemdeps
+
diff --git a/lib/rubygems/LICENSE.txt b/lib/rubygems/LICENSE.txt
index db88c5e118..8a0a51dec1 100644
--- a/lib/rubygems/LICENSE.txt
+++ b/lib/rubygems/LICENSE.txt
@@ -1,53 +1,54 @@
RubyGems is copyrighted free software by Chad Fowler, Rich Kilmer, Jim
Weirich and others. You can redistribute it and/or modify it under
-either the terms of the GPL (see the GPL.txt file), or the conditions
-below:
+either the terms of the MIT license (see the file MIT.txt), 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.
+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:
+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.
+ 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.
+ 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.
+ 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.
+ 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:
+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.
+ 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.
+ 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.
+ 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.
+ 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).
+4. You may modify and include the part of the software into any other
+ software (possibly commercial).
- 5. The scripts and library files supplied as input to or produced as
- output from the software do not automatically fall under the
- copyright of the software, but belong to whomever generated them,
- and may be sold commercially, and may be aggregated with this
- software.
+5. The scripts and library files supplied as input to or produced as
+ output from the software do not automatically fall under the
+ copyright of the software, but belong to whomever generated them,
+ and may be sold commercially, and may be aggregated with this
+ software.
+
+6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE.
- 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- PURPOSE.
diff --git a/lib/rubygems/available_set.rb b/lib/rubygems/available_set.rb
index 80539feee9..dae254b385 100644
--- a/lib/rubygems/available_set.rb
+++ b/lib/rubygems/available_set.rb
@@ -1,9 +1,15 @@
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
@@ -36,6 +42,28 @@ class Gem::AvailableSet
self
end
+ ##
+ # Yields each Tuple in this AvailableSet
+
+ def each
+ return enum_for __method__ unless block_given?
+
+ @set.each do |tuple|
+ yield tuple
+ end
+ end
+
+ ##
+ # Yields the Gem::Specification for each Tuple in this AvailableSet
+
+ def each_spec
+ return enum_for __method__ unless block_given?
+
+ each do |tuple|
+ yield tuple.spec
+ end
+ end
+
def empty?
@set.empty?
end
@@ -66,6 +94,49 @@ class Gem::AvailableSet
f.source
end
+ ##
+ # Converts this AvailableSet into a RequestSet that can be used to install
+ # gems.
+ #
+ # If +development+ is :none then no development dependencies are installed.
+ # Other options are :shallow for only direct development dependencies of the
+ # gems in this set or :all for all development dependencies.
+
+ def to_request_set development = :none
+ request_set = Gem::RequestSet.new
+ request_set.development = :all == development
+
+ each_spec do |spec|
+ request_set.always_install << spec
+
+ request_set.gem spec.name, spec.version
+ request_set.import spec.development_dependencies if
+ :shallow == development
+ end
+
+ request_set
+ end
+
+ ##
+ #
+ # Used by the Resolver, the protocol to use a AvailableSet as a
+ # search Set.
+
+ def find_all(req)
+ dep = req.dependency
+
+ match = @set.find_all do |t|
+ dep.match? t.spec
+ end
+
+ match.map do |t|
+ Gem::Resolver::LocalSpecification.new(self, t.spec, t.source)
+ end
+ end
+
+ def prefetch(reqs)
+ end
+
def pick_best!
return self if empty?
diff --git a/lib/rubygems/basic_specification.rb b/lib/rubygems/basic_specification.rb
new file mode 100644
index 0000000000..f9eb193fb4
--- /dev/null
+++ b/lib/rubygems/basic_specification.rb
@@ -0,0 +1,260 @@
+##
+# BasicSpecification is an abstract class which implements some common code
+# used by both Specification and StubSpecification.
+
+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_reader :loaded_from
+
+ ##
+ # Allows correct activation of git: and path: gems.
+
+ attr_writer :full_gem_path # :nodoc:
+
+ def self.default_specifications_dir
+ File.join(Gem.default_dir, "specifications", "default")
+ end
+
+ ##
+ # True when the gem has been activated
+
+ def activated?
+ raise NotImplementedError
+ end
+
+ ##
+ # Returns the full path to the base gem directory.
+ #
+ # eg: /usr/local/lib/ruby/gems/1.8
+
+ 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
+
+ ##
+ # Return true if this spec can require +file+.
+
+ def contains_requirable_file? file
+ if instance_variable_defined?(:@ignored) or
+ instance_variable_defined?('@ignored') then
+ return false
+ elsif missing_extensions? then
+ @ignored = true
+
+ warn "Ignoring #{full_name} because its extensions are not built. " +
+ "Try: gem pristine #{full_name}"
+ return false
+ end
+
+ suffixes = Gem.suffixes
+
+ full_require_paths.any? do |dir|
+ base = "#{dir}/#{file}"
+ suffixes.any? { |suf| File.file? "#{base}#{suf}" }
+ end
+ end
+
+ def default_gem?
+ loaded_from &&
+ File.dirname(loaded_from) == self.class.default_specifications_dir
+ 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)
+ end
+
+ ##
+ # Returns path to the extensions directory.
+
+ 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)
+ 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 if File.directory? path
+ end
+
+ private :find_full_gem_path
+
+ ##
+ # The full path to the gem (install path + full name).
+
+ def full_gem_path
+ # TODO: This is a heavily used method by gems, so we'll need
+ # to aleast just alias it to #gem_dir rather than remove it.
+ @full_gem_path ||= find_full_gem_path
+ end
+
+ ##
+ # Returns the full name (name-version) of this Gem. Platform information
+ # is included (name-version-platform) if it is specified and not the
+ # default Ruby platform.
+
+ def full_name
+ if platform == Gem::Platform::RUBY or platform.nil? then
+ "#{name}-#{version}".untaint
+ else
+ "#{name}-#{version}-#{platform}".untaint
+ end
+ end
+
+ ##
+ # Full paths in the gem to add to <code>$LOAD_PATH</code> when this gem is
+ # activated.
+
+ def full_require_paths
+ full_paths = raw_require_paths.map do |path|
+ File.join full_gem_path, path
+ end
+
+ full_paths.unshift extension_dir unless @extensions.nil? || @extensions.empty?
+
+ full_paths
+ end
+
+ ##
+ # Returns the full path to this spec's gem directory.
+ # eg: /usr/local/lib/ruby/1.8/gems/mygem-1.0
+
+ def gem_dir
+ @gem_dir ||= File.expand_path File.join(gems_dir, full_name)
+ end
+
+ ##
+ # Returns the full path to the gems directory containing this spec's
+ # gem directory. eg: /usr/local/lib/ruby/1.8/gems
+
+ 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
+
+ ##
+ # Set the path the Specification was loaded from. +path+ is converted to a
+ # String.
+
+ def loaded_from= path
+ @loaded_from = path && path.to_s
+
+ @extension_dir = nil
+ @extensions_dir = nil
+ @full_gem_path = nil
+ @gem_dir = nil
+ @gems_dir = nil
+ @base_dir = nil
+ end
+
+ ##
+ # Name of the gem
+
+ def name
+ raise NotImplementedError
+ end
+
+ ##
+ # Platform of the gem
+
+ def platform
+ raise NotImplementedError
+ end
+
+ def raw_require_paths # :nodoc:
+ Array(@require_paths)
+ end
+
+ ##
+ # Paths in the gem to add to <code>$LOAD_PATH</code> when this gem is
+ # activated.
+ #
+ # See also #require_paths=
+ #
+ # If you have an extension you do not need to add <code>"ext"</code> to the
+ # require path, the extension build process will copy the extension files
+ # into "lib" for you.
+ #
+ # The default value is <code>"lib"</code>
+ #
+ # Usage:
+ #
+ # # If all library files are in the root directory...
+ # spec.require_path = '.'
+
+ def require_paths
+ return raw_require_paths if @extensions.nil? || @extensions.empty?
+
+ [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 @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 a Gem::Specification from this gem
+
+ def to_spec
+ raise NotImplementedError
+ end
+
+ ##
+ # Version of the gem
+
+ def version
+ raise NotImplementedError
+ end
+
+ ##
+ # Whether this specification is stubbed - i.e. we have information
+ # about the gem from a stub line, without having to evaluate the
+ # entire gemspec file.
+ def stubbed?
+ raise NotImplementedError
+ end
+
+end
+
diff --git a/lib/rubygems/command.rb b/lib/rubygems/command.rb
index cba79b9196..0c6abec56c 100644
--- a/lib/rubygems/command.rb
+++ b/lib/rubygems/command.rb
@@ -148,6 +148,8 @@ 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?
@@ -557,7 +559,8 @@ 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 platforms show information about platforms
+ gem help gem_dependencies gem dependencies file guide
+ gem help platforms gem platforms guide
gem help <COMMAND> show help on COMMAND
(e.g. 'gem help install')
gem server present a web page at
diff --git a/lib/rubygems/command_manager.rb b/lib/rubygems/command_manager.rb
index 2af582177d..53d18c29cc 100644
--- a/lib/rubygems/command_manager.rb
+++ b/lib/rubygems/command_manager.rb
@@ -33,6 +33,40 @@ class Gem::CommandManager
include Gem::UserInteraction
+ BUILTIN_COMMANDS = [ # :nodoc:
+ :build,
+ :cert,
+ :check,
+ :cleanup,
+ :contents,
+ :dependency,
+ :environment,
+ :fetch,
+ :generate_index,
+ :help,
+ :install,
+ :list,
+ :lock,
+ :mirror,
+ :open,
+ :outdated,
+ :owner,
+ :pristine,
+ :push,
+ :query,
+ :rdoc,
+ :search,
+ :server,
+ :sources,
+ :specification,
+ :stale,
+ :uninstall,
+ :unpack,
+ :update,
+ :which,
+ :yank,
+ ]
+
##
# Return the authoritative instance of the command manager.
@@ -61,36 +95,10 @@ class Gem::CommandManager
def initialize
require 'timeout'
@commands = {}
- register_command :build
- register_command :cert
- register_command :check
- register_command :cleanup
- register_command :contents
- register_command :dependency
- register_command :environment
- register_command :fetch
- register_command :generate_index
- register_command :help
- register_command :install
- register_command :list
- register_command :lock
- register_command :mirror
- register_command :outdated
- register_command :owner
- register_command :pristine
- register_command :push
- register_command :query
- register_command :rdoc
- register_command :search
- register_command :server
- register_command :sources
- register_command :specification
- register_command :stale
- register_command :uninstall
- register_command :unpack
- register_command :update
- register_command :which
- register_command :yank
+
+ BUILTIN_COMMANDS.each do |name|
+ register_command name
+ end
end
##
@@ -129,17 +137,9 @@ 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.to_s}"
+ alert_error "While executing gem ... (#{ex.class})\n #{ex}"
ui.backtrace ex
- if Gem.configuration.really_verbose and \
- ex.kind_of?(Gem::Exception) and ex.source_exception
- e = ex.source_exception
-
- ui.errs.puts "Because of: (#{e.class})\n #{e.to_s}"
- ui.backtrace e
- end
-
terminate_interaction(1)
rescue Interrupt
alert_error "Interrupted"
@@ -147,8 +147,6 @@ class Gem::CommandManager
end
def process_args(args, build_args=nil)
- args = args.to_str.split(/\s+/) if args.respond_to?(:to_str)
-
if args.empty? then
say Gem::Command::HELP
terminate_interaction 1
diff --git a/lib/rubygems/commands/build_command.rb b/lib/rubygems/commands/build_command.rb
index 64563ed3db..d975429fe8 100644
--- a/lib/rubygems/commands/build_command.rb
+++ b/lib/rubygems/commands/build_command.rb
@@ -15,6 +15,25 @@ class Gem::Commands::BuildCommand < Gem::Command
"GEMSPEC_FILE gemspec file name to build a gem for"
end
+ def description # :nodoc:
+ <<-EOF
+The build command allows you to create a gem from a ruby gemspec.
+
+The best way to build a gem is to use a Rakefile and the Gem::PackageTask
+which ships with RubyGems.
+
+The gemspec can either be created by hand or extracted from an existing gem
+with gem spec:
+
+ $ gem unpack my_gem-1.0.gem
+ Unpacked gem: '.../my_gem-1.0'
+ $ gem spec my_gem-1.0.gem --ruby > my_gem-1.0/my_gem-1.0.gemspec
+ $ cd my_gem-1.0
+ [edit gem contents]
+ $ gem build my_gem-1.0.gemspec
+ EOF
+ end
+
def usage # :nodoc:
"#{program_name} GEMSPEC_FILE"
end
diff --git a/lib/rubygems/commands/cert_command.rb b/lib/rubygems/commands/cert_command.rb
index 5a9320f9c4..a920e7fcc3 100644
--- a/lib/rubygems/commands/cert_command.rb
+++ b/lib/rubygems/commands/cert_command.rb
@@ -1,6 +1,11 @@
require 'rubygems/command'
require 'rubygems/security'
-require 'openssl'
+begin
+ require 'openssl'
+rescue LoadError => e
+ raise unless (e.respond_to?(:path) && e.path == 'openssl') ||
+ e.message =~ / -- openssl$/
+end
class Gem::Commands::CertCommand < Gem::Command
@@ -21,7 +26,8 @@ class Gem::Commands::CertCommand < Gem::Command
OptionParser.accept OpenSSL::PKey::RSA do |key_file|
begin
- key = OpenSSL::PKey::RSA.new File.read key_file
+ passphrase = ENV['GEM_PRIVATE_KEY_PASSPHRASE']
+ key = OpenSSL::PKey::RSA.new File.read(key_file), passphrase
rescue Errno::ENOENT
raise OptionParser::InvalidArgument, "#{key_file}: does not exist"
rescue OpenSSL::PKey::RSAError
@@ -79,52 +85,65 @@ class Gem::Commands::CertCommand < Gem::Command
end
end
+ def add_certificate certificate # :nodoc:
+ Gem::Security.trust_dir.trust_cert certificate
+
+ say "Added '#{certificate.subject}'"
+ end
+
def execute
options[:add].each do |certificate|
- Gem::Security.trust_dir.trust_cert certificate
-
- say "Added '#{certificate.subject}'"
+ add_certificate certificate
end
options[:remove].each do |filter|
- certificates_matching filter do |certificate, path|
- FileUtils.rm path
- say "Removed '#{certificate.subject}'"
- end
+ remove_certificates_matching filter
end
options[:list].each do |filter|
- certificates_matching filter do |certificate, _|
- # this could probably be formatted more gracefully
- say certificate.subject.to_s
- end
+ list_certificates_matching filter
end
options[:build].each do |name|
build name
end
- unless options[:sign].empty? then
- load_default_cert unless options[:issuer_cert]
- load_default_key unless options[:key]
- end
-
- options[:sign].each do |cert_file|
- sign cert_file
- end
+ sign_certificates unless options[:sign].empty?
end
def build name
- key = options[:key] || Gem::Security.create_key
+ key, key_path = build_key
+ cert_path = build_cert name, key
+ say "Certificate: #{cert_path}"
+
+ if key_path
+ say "Private Key: #{key_path}"
+ say "Don't forget to move the key file to somewhere private!"
+ end
+ end
+
+ def build_cert name, key # :nodoc:
cert = Gem::Security.create_cert_email name, key
+ Gem::Security.write cert, "gem-public_cert.pem"
+ end
- key_path = Gem::Security.write key, "gem-private_key.pem"
- cert_path = Gem::Security.write cert, "gem-public_cert.pem"
+ def build_key # :nodoc:
+ return options[:key] if options[:key]
- say "Certificate: #{cert_path}"
- say "Private Key: #{key_path}"
- say "Don't forget to move the key file to somewhere private!"
+ 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"
+
+ 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
+
+ return key, key_path
end
def certificates_matching filter
@@ -179,6 +198,13 @@ For further reading on signing gems see `ri Gem::Security`.
EOF
end
+ def list_certificates_matching filter # :nodoc:
+ certificates_matching filter do |certificate, _|
+ # this could probably be formatted more gracefully
+ say certificate.subject.to_s
+ end
+ end
+
def load_default_cert
cert_file = File.join Gem.default_cert_path
cert = File.read cert_file
@@ -198,7 +224,8 @@ For further reading on signing gems see `ri Gem::Security`.
def load_default_key
key_file = File.join Gem.default_key_path
key = File.read key_file
- options[:key] = OpenSSL::PKey::RSA.new key
+ passphrase = ENV['GEM_PRIVATE_KEY_PASSPHRASE']
+ options[:key] = OpenSSL::PKey::RSA.new key, passphrase
rescue Errno::ENOENT
alert_error \
"--private-key not specified and ~/.gem/gem-private_key.pem does not exist"
@@ -211,6 +238,18 @@ For further reading on signing gems see `ri Gem::Security`.
terminate_interaction 1
end
+ def load_defaults # :nodoc:
+ load_default_cert unless options[:issuer_cert]
+ load_default_key unless options[:key]
+ end
+
+ def remove_certificates_matching filter # :nodoc:
+ certificates_matching filter do |certificate, path|
+ FileUtils.rm path
+ say "Removed '#{certificate.subject}'"
+ end
+ end
+
def sign cert_file
cert = File.read cert_file
cert = OpenSSL::X509::Certificate.new cert
@@ -225,5 +264,13 @@ For further reading on signing gems see `ri Gem::Security`.
Gem::Security.write cert, cert_file, permissions
end
-end
+ def sign_certificates # :nodoc:
+ load_defaults unless options[:sign].empty?
+
+ options[:sign].each do |cert_file|
+ sign cert_file
+ end
+ end
+
+end if defined?(OpenSSL::SSL)
diff --git a/lib/rubygems/commands/check_command.rb b/lib/rubygems/commands/check_command.rb
index d7677d47a1..8893b9c3b2 100644
--- a/lib/rubygems/commands/check_command.rb
+++ b/lib/rubygems/commands/check_command.rb
@@ -79,6 +79,13 @@ class Gem::Commands::CheckCommand < Gem::Command
'--gems --alien'
end
+ def description # :nodoc:
+ <<-EOF
+The check command can list and repair problems with installed gems and
+specifications and will clean up gems that have been partially uninstalled.
+ EOF
+ end
+
def usage # :nodoc:
"#{program_name} [OPTIONS] [GEMNAME ...]"
end
diff --git a/lib/rubygems/commands/cleanup_command.rb b/lib/rubygems/commands/cleanup_command.rb
index 61f189e449..69975640fe 100644
--- a/lib/rubygems/commands/cleanup_command.rb
+++ b/lib/rubygems/commands/cleanup_command.rb
@@ -6,10 +6,11 @@ class Gem::Commands::CleanupCommand < Gem::Command
def initialize
super 'cleanup',
- 'Clean up old versions of installed gems in the local repository',
+ 'Clean up old versions of installed gems',
:force => false, :install_dir => Gem.dir
- add_option('-d', '--dryrun', "") do |value, options|
+ add_option('-n', '-d', '--dryrun',
+ 'Do not uninstall gems') do |value, options|
options[:dryrun] = true
end
@@ -32,11 +33,11 @@ class Gem::Commands::CleanupCommand < Gem::Command
def description # :nodoc:
<<-EOF
-The cleanup command removes old gems from GEM_HOME. If an older version is
-installed elsewhere in GEM_PATH the cleanup command won't touch it.
+The cleanup command removes old versions of gems from GEM_HOME that are not
+required to meet a dependency. If a gem is installed elsewhere in GEM_PATH
+the cleanup command won't delete it.
-Older gems that are required to satisify the dependencies of gems
-are not removed.
+If no gems are named all gems in GEM_HOME are cleaned.
EOF
end
@@ -66,10 +67,10 @@ are not removed.
say "Clean Up Complete"
- if Gem.configuration.really_verbose then
+ verbose do
skipped = @default_gems.map { |spec| spec.full_name }
- say "Skipped default gems: #{skipped.join ', '}"
+ "Skipped default gems: #{skipped.join ', '}"
end
end
@@ -162,4 +163,3 @@ are not removed.
end
end
-
diff --git a/lib/rubygems/commands/contents_command.rb b/lib/rubygems/commands/contents_command.rb
index 42c7fabd86..15657f31a2 100644
--- a/lib/rubygems/commands/contents_command.rb
+++ b/lib/rubygems/commands/contents_command.rb
@@ -8,7 +8,8 @@ class Gem::Commands::ContentsCommand < Gem::Command
def initialize
super 'contents', 'Display the contents of the installed gems',
- :specdirs => [], :lib_only => false, :prefix => true
+ :specdirs => [], :lib_only => false, :prefix => true,
+ :show_install_dir => false
add_version_option
@@ -31,6 +32,15 @@ class Gem::Commands::ContentsCommand < Gem::Command
"Don't include installed path prefix") do |prefix, options|
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
end
def arguments # :nodoc:
@@ -41,79 +51,141 @@ class Gem::Commands::ContentsCommand < Gem::Command
"--no-lib-only --prefix"
end
+ def description # :nodoc:
+ <<-EOF
+The contents command lists the files in an installed gem. The listing can
+be given as full file names, file names without the installed directory
+prefix or only the files that are requireable.
+ EOF
+ end
+
def usage # :nodoc:
"#{program_name} GEMNAME [GEMNAME ...]"
end
def execute
- version = options[:version] || Gem::Requirement.default
+ @version = options[:version] || Gem::Requirement.default
+ @spec_dirs = specification_directories
+ @path_kind = path_description @spec_dirs
- spec_dirs = options[:specdirs].map do |i|
- [i, File.join(i, "specifications")]
- end.flatten
+ names = gem_names
- path_kind = if spec_dirs.empty? then
- spec_dirs = Gem::Specification.dirs
- "default gem paths"
- else
- "specified path"
- end
-
- gem_names = if options[:all] then
- Gem::Specification.map(&:name)
- else
- get_all_gem_names
- end
-
- gem_names.each do |name|
- # HACK: find_by_name fails for some reason... ARGH
- # How many places must we embed our resolve logic?
- spec = Gem::Specification.find_all_by_name(name, version).last
-
- unless spec then
- say "Unable to find gem '#{name}' in #{path_kind}"
-
- if Gem.configuration.verbose then
- say "\nDirectories searched:"
- spec_dirs.sort.each { |dir| say dir }
+ names.each do |name|
+ found =
+ if options[:show_install_dir] then
+ gem_install_dir name
+ else
+ gem_contents name
end
- terminate_interaction 1 if gem_names.length == 1
- end
+ terminate_interaction 1 unless found or names.length > 1
+ end
+ end
- if spec.default_gem?
- files = spec.files.sort.map do |file|
- case file
- when /\A#{spec.bindir}\//
- [Gem::ConfigMap[:bindir], $POSTMATCH]
- when /\.so\z/
- [Gem::ConfigMap[:archdir], file]
- else
- [Gem::ConfigMap[:rubylibdir], file]
- end
- end
+ def files_in spec
+ if spec.default_gem? then
+ files_in_default_gem spec
+ else
+ files_in_gem spec
+ end
+ end
+
+ def files_in_gem spec
+ gem_path = spec.full_gem_path
+ extra = "/{#{spec.require_paths.join ','}}" if options[:lib_only]
+ glob = "#{gem_path}#{extra}/**/*"
+ prefix_re = /#{Regexp.escape(gem_path)}\//
+
+ Dir[glob].map do |file|
+ [gem_path, file.sub(prefix_re, "")]
+ end
+ end
+
+ def files_in_default_gem spec
+ spec.files.sort.map do |file|
+ case file
+ when /\A#{spec.bindir}\//
+ [RbConfig::CONFIG['bindir'], $POSTMATCH]
+ when /\.so\z/
+ [RbConfig::CONFIG['archdir'], file]
else
- gem_path = spec.full_gem_path
- extra = "/{#{spec.require_paths.join ','}}" if options[:lib_only]
- glob = "#{gem_path}#{extra}/**/*"
- prefix_re = /#{Regexp.escape(gem_path)}\//
- files = Dir[glob].map do |file|
- [gem_path, file.sub(prefix_re, "")]
- end
+ [RbConfig::CONFIG['rubylibdir'], file]
end
+ end
+ end
- files.sort.each do |prefix, basename|
- absolute_path = File.join(prefix, basename)
- next if File.directory? absolute_path
+ def gem_contents name
+ spec = spec_for name
- if options[:prefix]
- say absolute_path
- else
- say basename
- end
+ return false unless spec
+
+ files = files_in spec
+
+ show_files files
+
+ 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)
+ else
+ get_all_gem_names
+ end
+ end
+
+ def path_description spec_dirs # :nodoc:
+ if spec_dirs.empty? then
+ spec_dirs = Gem::Specification.dirs
+ "default gem paths"
+ else
+ "specified path"
+ end
+ end
+
+ def show_files files
+ files.sort.each do |prefix, basename|
+ absolute_path = File.join(prefix, basename)
+ next if File.directory? absolute_path
+
+ if options[:prefix] then
+ say absolute_path
+ else
+ say basename
end
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}' in #{@path_kind}"
+
+ if Gem.configuration.verbose then
+ say "\nDirectories searched:"
+ @spec_dirs.sort.each { |dir| say dir }
+ end
+
+ return nil
+ end
+
+ def specification_directories # :nodoc:
+ options[:specdirs].map do |i|
+ [i, File.join(i, "specifications")]
+ end.flatten
+ end
+
end
diff --git a/lib/rubygems/commands/dependency_command.rb b/lib/rubygems/commands/dependency_command.rb
index 4690b13a94..4a54a3e385 100644
--- a/lib/rubygems/commands/dependency_command.rb
+++ b/lib/rubygems/commands/dependency_command.rb
@@ -31,96 +31,128 @@ class Gem::Commands::DependencyCommand < Gem::Command
end
def arguments # :nodoc:
- "GEMNAME name of gem to show dependencies for"
+ "REGEXP show dependencies for gems whose names start with REGEXP"
end
def defaults_str # :nodoc:
"--local --version '#{Gem::Requirement.default}' --no-reverse-dependencies"
end
+ def description # :nodoc:
+ <<-EOF
+The dependency commands lists which other gems a given gem depends on. For
+local gems only the reverse dependencies can be shown (which gems depend on
+the named gem).
+
+The dependency list can be displayed in a format suitable for piping for
+use with other commands.
+ EOF
+ end
+
def usage # :nodoc:
- "#{program_name} GEMNAME"
+ "#{program_name} REGEXP"
end
- def execute
- if options[:reverse_dependencies] and remote? and not local? then
- alert_error 'Only reverse dependencies for local gems are supported.'
- terminate_interaction 1
- end
+ def fetch_remote_specs dependency # :nodoc:
+ fetcher = Gem::SpecFetcher.fetcher
- options[:args] << '' if options[:args].empty?
+ ss, = fetcher.spec_for_dependency dependency
- pattern = if options[:args].length == 1 and
- options[:args].first =~ /\A\/(.*)\/(i)?\z/m then
+ ss.map { |spec, _| spec }
+ end
+
+ def fetch_specs dependency # :nodoc:
+ specs = []
+
+ specs.concat dependency.matching_specs if local?
+ specs.concat fetch_remote_specs dependency if remote?
+
+ ensure_specs specs
+
+ specs.uniq.sort
+ end
+
+ 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(*options[:args])}/
+ /\A#{Regexp.union(*args)}/
end
- # TODO: deprecate for real damnit
dependency = Gem::Deprecate.skip_during {
- Gem::Dependency.new pattern, options[:version]
+ Gem::Dependency.new pattern, version
}
- dependency.prerelease = options[:prerelease]
- specs = []
+ dependency.prerelease = prerelease
- specs.concat dependency.matching_specs if local?
+ dependency
+ end
- if remote? and not options[:reverse_dependencies] then
- fetcher = Gem::SpecFetcher.fetcher
+ def display_pipe specs # :nodoc:
+ specs.each do |spec|
+ unless spec.dependencies.empty? then
+ spec.dependencies.sort_by { |dep| dep.name }.each do |dep|
+ say "#{dep.name} --version '#{dep.requirement}'"
+ end
+ end
+ end
+ end
- ss, _ = fetcher.spec_for_dependency dependency
+ def display_readable specs, reverse # :nodoc:
+ response = ''
- ss.each { |s,o| specs << s }
+ specs.each do |spec|
+ response << print_dependencies(spec)
+ unless reverse[spec.full_name].empty? then
+ response << " Used by\n"
+ reverse[spec.full_name].each do |sp, dep|
+ response << " #{sp} (#{dep})\n"
+ end
+ end
+ response << "\n"
end
- if specs.empty? then
- patterns = options[:args].join ','
- say "No gems found matching #{patterns} (#{options[:version]})" if
- Gem.configuration.verbose
+ say response
+ end
- terminate_interaction 1
- end
+ def execute
+ ensure_local_only_reverse_dependencies
- specs = specs.uniq.sort
+ dependency =
+ gem_dependency options[:args], options[:version], options[:prerelease]
- reverse = Hash.new { |h, k| h[k] = [] }
+ specs = fetch_specs dependency
- if options[:reverse_dependencies] then
- specs.each do |spec|
- reverse[spec.full_name] = find_reverse_dependencies spec
- end
- end
+ reverse = reverse_dependencies specs
if options[:pipe_format] then
- specs.each do |spec|
- unless spec.dependencies.empty?
- spec.dependencies.sort_by { |dep| dep.name }.each do |dep|
- say "#{dep.name} --version '#{dep.requirement}'"
- end
- end
- end
+ display_pipe specs
else
- response = ''
-
- specs.each do |spec|
- response << print_dependencies(spec)
- unless reverse[spec.full_name].empty? then
- response << " Used by\n"
- reverse[spec.full_name].each do |sp, dep|
- response << " #{sp} (#{dep})\n"
- end
- end
- response << "\n"
- end
+ display_readable specs, reverse
+ end
+ end
- say response
+ def ensure_local_only_reverse_dependencies # :nodoc:
+ if options[:reverse_dependencies] and remote? and not local? then
+ alert_error 'Only reverse dependencies for local gems are supported.'
+ terminate_interaction 1
end
end
- def print_dependencies(spec, level = 0)
+ def ensure_specs specs # :nodoc:
+ return unless specs.empty?
+
+ patterns = options[:args].join ','
+ say "No gems found matching #{patterns} (#{options[:version]})" if
+ Gem.configuration.verbose
+
+ terminate_interaction 1
+ end
+
+ def print_dependencies(spec, level = 0) # :nodoc:
response = ''
response << ' ' * level + "Gem #{spec.full_name}\n"
unless spec.dependencies.empty? then
@@ -131,10 +163,30 @@ class Gem::Commands::DependencyCommand < Gem::Command
response
end
+ def remote_specs dependency # :nodoc:
+ fetcher = Gem::SpecFetcher.fetcher
+
+ ss, _ = fetcher.spec_for_dependency dependency
+
+ ss.map { |s,o| s }
+ end
+
+ def reverse_dependencies specs # :nodoc:
+ reverse = Hash.new { |h, k| h[k] = [] }
+
+ return reverse unless options[:reverse_dependencies]
+
+ specs.each do |spec|
+ reverse[spec.full_name] = find_reverse_dependencies spec
+ end
+
+ reverse
+ end
+
##
# Returns an Array of [specification, dep] that are satisfied by +spec+.
- def find_reverse_dependencies(spec)
+ def find_reverse_dependencies spec # :nodoc:
result = []
Gem::Specification.each do |sp|
diff --git a/lib/rubygems/commands/environment_command.rb b/lib/rubygems/commands/environment_command.rb
index 40e71cf094..067d0b1607 100644
--- a/lib/rubygems/commands/environment_command.rb
+++ b/lib/rubygems/commands/environment_command.rb
@@ -21,12 +21,16 @@ class Gem::Commands::EnvironmentCommand < Gem::Command
def description # :nodoc:
<<-EOF
+The environment command lets you query rubygems for its configuration for
+use in shell scripts or as a debugging aid.
+
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 /etc/gemrc for all users. These
-files are YAML files with the following YAML keys:
+~/.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:
:sources: A YAML array of remote gem repositories to install gems from
:verbose: Verbosity of the gem command. false, true, and :really are the
@@ -69,66 +73,85 @@ lib/rubygems/defaults/operating_system.rb
def execute
out = ''
arg = options[:args][0]
- case arg
- when /^packageversion/ then
- out << Gem::RubyGemsPackageVersion
- when /^version/ then
- out << Gem::VERSION
- when /^gemdir/, /^gemhome/, /^home/, /^GEM_HOME/ then
- out << Gem.dir
- when /^gempath/, /^path/, /^GEM_PATH/ then
- out << Gem.path.join(File::PATH_SEPARATOR)
- when /^remotesources/ then
- out << Gem.sources.to_a.join("\n")
- when /^platform/ then
- out << Gem.platforms.join(File::PATH_SEPARATOR)
- when nil then
- out = "RubyGems Environment:\n"
-
- out << " - RUBYGEMS VERSION: #{Gem::VERSION}\n"
-
- out << " - RUBY VERSION: #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}"
- out << " patchlevel #{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
- out << ") [#{RUBY_PLATFORM}]\n"
-
- out << " - INSTALLATION DIRECTORY: #{Gem.dir}\n"
-
- out << " - RUBYGEMS PREFIX: #{Gem.prefix}\n" unless Gem.prefix.nil?
-
- out << " - RUBY EXECUTABLE: #{Gem.ruby}\n"
-
- out << " - EXECUTABLE DIRECTORY: #{Gem.bindir}\n"
-
- out << " - RUBYGEMS PLATFORMS:\n"
- Gem.platforms.each do |platform|
- out << " - #{platform}\n"
+ out <<
+ case arg
+ when /^packageversion/ then
+ Gem::RubyGemsPackageVersion
+ when /^version/ then
+ Gem::VERSION
+ when /^gemdir/, /^gemhome/, /^home/, /^GEM_HOME/ then
+ Gem.dir
+ when /^gempath/, /^path/, /^GEM_PATH/ then
+ Gem.path.join(File::PATH_SEPARATOR)
+ when /^remotesources/ then
+ Gem.sources.to_a.join("\n")
+ when /^platform/ then
+ Gem.platforms.join(File::PATH_SEPARATOR)
+ when nil then
+ show_environment
+ else
+ raise Gem::CommandLineError, "Unknown environment option [#{arg}]"
end
+ say out
+ true
+ end
- out << " - GEM PATHS:\n"
- out << " - #{Gem.dir}\n"
+ def add_path out, path
+ path.each do |component|
+ out << " - #{component}\n"
+ end
+ end
- path = Gem.path.dup
- path.delete Gem.dir
- path.each do |p|
- out << " - #{p}\n"
- end
+ def show_environment # :nodoc:
+ out = "RubyGems Environment:\n"
- out << " - GEM CONFIGURATION:\n"
- Gem.configuration.each do |name, value|
- value = value.gsub(/./, '*') if name == 'gemcutter_key'
- out << " - #{name.inspect} => #{value.inspect}\n"
- end
+ out << " - RUBYGEMS VERSION: #{Gem::VERSION}\n"
- out << " - REMOTE SOURCES:\n"
- Gem.sources.each do |s|
- out << " - #{s}\n"
- end
+ out << " - RUBY VERSION: #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}"
+ out << " patchlevel #{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
+ out << ") [#{RUBY_PLATFORM}]\n"
+
+ out << " - INSTALLATION DIRECTORY: #{Gem.dir}\n"
+
+ out << " - RUBYGEMS PREFIX: #{Gem.prefix}\n" unless Gem.prefix.nil?
+
+ out << " - RUBY EXECUTABLE: #{Gem.ruby}\n"
+
+ out << " - EXECUTABLE DIRECTORY: #{Gem.bindir}\n"
- else
- raise Gem::CommandLineError, "Unknown environment option [#{arg}]"
+ 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"
end
- say out
- true
+
+ out << " - GEM PATHS:\n"
+ out << " - #{Gem.dir}\n"
+
+ gem_path = Gem.path.dup
+ gem_path.delete Gem.dir
+ add_path out, gem_path
+
+ out << " - GEM CONFIGURATION:\n"
+ Gem.configuration.each do |name, value|
+ value = value.gsub(/./, '*') if name == 'gemcutter_key'
+ out << " - #{name.inspect} => #{value.inspect}\n"
+ end
+
+ out << " - REMOTE SOURCES:\n"
+ Gem.sources.each do |s|
+ out << " - #{s}\n"
+ end
+
+ out << " - SHELL PATH:\n"
+
+ shell_path = ENV['PATH'].split(File::PATH_SEPARATOR)
+ add_path out, shell_path
+
+ out
end
end
diff --git a/lib/rubygems/commands/fetch_command.rb b/lib/rubygems/commands/fetch_command.rb
index f5a8abc349..c57ab0089a 100644
--- a/lib/rubygems/commands/fetch_command.rb
+++ b/lib/rubygems/commands/fetch_command.rb
@@ -28,6 +28,16 @@ class Gem::Commands::FetchCommand < Gem::Command
"--version '#{Gem::Requirement.default}'"
end
+ def description # :nodoc:
+ <<-EOF
+The fetch command fetches gem files that can be stored for later use or
+unpacked to examine their contents.
+
+See the build command help for an example of unpacking a gem, modifying it,
+then repackaging it.
+ EOF
+ end
+
def usage # :nodoc:
"#{program_name} GEMNAME [GEMNAME ...]"
end
@@ -42,7 +52,8 @@ class Gem::Commands::FetchCommand < Gem::Command
dep = Gem::Dependency.new gem_name, version
dep.prerelease = options[:prerelease]
- specs_and_sources, errors = Gem::SpecFetcher.fetcher.spec_for_dependency dep
+ specs_and_sources, errors =
+ Gem::SpecFetcher.fetcher.spec_for_dependency dep
if platform then
filtered = specs_and_sources.select { |s,| s.platform == platform }
diff --git a/lib/rubygems/commands/generate_index_command.rb b/lib/rubygems/commands/generate_index_command.rb
index a7db013caf..ca6f694bc5 100644
--- a/lib/rubygems/commands/generate_index_command.rb
+++ b/lib/rubygems/commands/generate_index_command.rb
@@ -62,7 +62,7 @@ Marshal::MINOR_VERSION constants. It is used to ensure compatibility.
end
def execute
- # This is always true becasue it's the only way now.
+ # This is always true because 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 7f1fb486e0..ed81ad6e25 100644
--- a/lib/rubygems/commands/help_command.rb
+++ b/lib/rubygems/commands/help_command.rb
@@ -46,6 +46,187 @@ Some examples of 'gem' usage.
* Update all gems on your system:
gem update
+
+* Update your local version of RubyGems
+
+ 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 specifiy 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 overriden with the :development_group option:
+
+ gemspec development_group: :other
+
EOF
PLATFORMS = <<-'EOF'
@@ -55,8 +236,9 @@ your current platform by running `gem environment`.
RubyGems matches platforms as follows:
- * The CPU must match exactly, unless one of the platforms has
- "universal" as the CPU.
+ * The CPU must match exactly unless one of the platforms has
+ "universal" as the CPU or the local CPU starts with "arm" and the gem's
+ CPU is exactly "arm" (for gems that support generic ARM architecture).
* The OS must match exactly.
* The versions must match exactly unless one of the versions is nil.
@@ -66,29 +248,41 @@ you pass must match "#{cpu}-#{os}" or "#{cpu}-#{os}-#{version}". On mswin
platforms, the version is the compiler version, not the OS version. (Ruby
compiled with VC6 uses "60" as the compiler version, VC8 uses "80".)
+For the ARM architecture, gems with a platform of "arm-linux" should run on a
+reasonable set of ARM CPUs and not depend on instructions present on a limited
+subset of the architecture. For example, the binary should run on platforms
+armv5, armv6hf, armv6l, armv7, etc. If you use the "arm-linux" platform
+please test your gem on a variety of ARM hardware before release to ensure it
+functions correctly.
+
Example platforms:
x86-freebsd # Any FreeBSD version on an x86 CPU
universal-darwin-8 # Darwin 8 only gems that run on any CPU
x86-mswin32-80 # Windows gems compiled with VC8
+ armv7-linux # Gem complied for an ARMv7 CPU running linux
+ arm-linux # Gem compiled for any ARM CPU running linux
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
super 'help', "Provide help on the 'gem' command"
- 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+/, '')
+ @command_manager = Gem::CommandManager.instance
end
def usage # :nodoc:
@@ -96,78 +290,93 @@ platform.
end
def execute
- command_manager = Gem::CommandManager.instance
arg = options[:args][0]
- if begins? "commands", arg then
- out = []
- out << "GEM commands are:"
- out << nil
-
- margin_width = 4
+ _, help = SUBCOMMANDS.find do |command,|
+ begins? command, arg
+ end
- desc_width = command_manager.command_names.map { |n| n.size }.max + 4
+ if help then
+ if Symbol === help then
+ send help
+ else
+ say help
+ end
+ return
+ end
- summary_width = 80 - margin_width - desc_width
- wrap_indent = ' ' * (margin_width + desc_width)
- format = "#{' ' * margin_width}%-#{desc_width}s%s"
+ if options[:help] then
+ show_help
- command_manager.command_names.each do |cmd_name|
- command = command_manager[cmd_name]
+ elsif arg then
+ show_command_help arg
- summary =
- if command then
- command.summary
- else
- "[No command found for #{cmd_name}, bug?]"
- end
+ else
+ say Gem::Command::HELP
+ end
+ end
- summary = wrap(summary, summary_width).split "\n"
- out << sprintf(format, cmd_name, summary.shift)
- until summary.empty? do
- out << "#{wrap_indent}#{summary.shift}"
- end
- end
+ def show_commands # :nodoc:
+ out = []
+ out << "GEM commands are:"
+ out << nil
- out << nil
- out << "For help on a particular command, use 'gem help COMMAND'."
- out << nil
- out << "Commands may be abbreviated, so long as they are unambiguous."
- out << "e.g. 'gem i rake' is short for 'gem install rake'."
+ margin_width = 4
- say out.join("\n")
+ desc_width = @command_manager.command_names.map { |n| n.size }.max + 4
- elsif begins? "options", arg then
- say Gem::Command::HELP
+ summary_width = 80 - margin_width - desc_width
+ wrap_indent = ' ' * (margin_width + desc_width)
+ format = "#{' ' * margin_width}%-#{desc_width}s%s"
- elsif begins? "examples", arg then
- say EXAMPLES
+ @command_manager.command_names.each do |cmd_name|
+ command = @command_manager[cmd_name]
- elsif begins? "platforms", arg then
- say PLATFORMS
+ summary =
+ if command then
+ command.summary
+ else
+ "[No command found for #{cmd_name}]"
+ end
- elsif options[:help] then
- command = command_manager[options[:help]]
- if command
- # help with provided command
- command.invoke("--help")
- else
- alert_error "Unknown command #{options[:help]}. Try 'gem help commands'"
+ summary = wrap(summary, summary_width).split "\n"
+ out << sprintf(format, cmd_name, summary.shift)
+ until summary.empty? do
+ out << "#{wrap_indent}#{summary.shift}"
end
+ end
- elsif arg then
- possibilities = command_manager.find_command_possibilities(arg.downcase)
- if possibilities.size == 1
- command = command_manager[possibilities.first]
- command.invoke("--help")
- elsif possibilities.size > 1
- alert_warning "Ambiguous command #{arg} (#{possibilities.join(', ')})"
- else
- alert_warning "Unknown command #{arg}. Try gem help commands"
- end
+ out << nil
+ out << "For help on a particular command, use 'gem help COMMAND'."
+ out << nil
+ out << "Commands may be abbreviated, so long as they are unambiguous."
+ out << "e.g. 'gem i rake' is short for 'gem install rake'."
+
+ say out.join("\n")
+ end
+
+ def show_command_help command_name # :nodoc:
+ command_name = command_name.downcase
+ possibilities = @command_manager.find_command_possibilities command_name
+
+ if possibilities.size == 1 then
+ command = @command_manager[possibilities.first]
+ command.invoke("--help")
+ elsif possibilities.size > 1 then
+ alert_warning "Ambiguous command #{command_name} (#{possibilities.join(', ')})"
else
- say Gem::Command::HELP
+ alert_warning "Unknown command #{command_name}. Try: gem help commands"
+ 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
diff --git a/lib/rubygems/commands/install_command.rb b/lib/rubygems/commands/install_command.rb
index 0b58fa665e..1bf5928ebb 100644
--- a/lib/rubygems/commands/install_command.rb
+++ b/lib/rubygems/commands/install_command.rb
@@ -4,8 +4,6 @@ require 'rubygems/dependency_installer'
require 'rubygems/local_remote_options'
require 'rubygems/validator'
require 'rubygems/version_option'
-require 'rubygems/install_message' # must come before rdoc for messaging
-require 'rubygems/rdoc'
##
# Gem installer command line tool
@@ -23,7 +21,10 @@ 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 => [],
})
super 'install', 'Install a gem into the local repository', defaults
@@ -34,13 +35,53 @@ class Gem::Commands::InstallCommand < Gem::Command
add_version_option
add_prerelease_option "to be installed. (Only for listed gems)"
- add_option(:"Install/Update", '-g', '--file FILE',
+ add_option(:"Install/Update", '-g', '--file [FILE]',
'Read from a gem dependencies API file and',
'install the listed gems') do |v,o|
+ v = Gem::GEM_DEP_FILES.find do |file|
+ 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
- @installed_specs = nil
+ add_option(:"Install/Update", '--without GROUPS', Array,
+ 'Omit the named groups (comma separated)',
+ 'when installing from a gem dependencies',
+ 'file') do |v,o|
+ o[:without_groups].concat v.map { |without| without.intern }
+ end
+
+ add_option(:"Install/Update", '--default',
+ 'Add the gem\'s full specification to',
+ 'specifications/default and extract only its bin') do |v,o|
+ o[:install_as_default] = v
+ end
+
+ add_option(:"Install/Update", '--explain',
+ 'Rather than install the gems, indicate which would',
+ 'be installed') do |v,o|
+ 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 = []
end
def arguments # :nodoc:
@@ -49,7 +90,7 @@ class Gem::Commands::InstallCommand < Gem::Command
def defaults_str # :nodoc:
"--both --version '#{Gem::Requirement.default}' --document --no-force\n" +
- "--install-dir #{Gem.dir}"
+ "--install-dir #{Gem.dir} --lock"
end
def description # :nodoc:
@@ -63,6 +104,25 @@ 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
@@ -109,14 +169,48 @@ to write the specification by hand. For example:
"#{program_name} GEMNAME [GEMNAME ...] [options] -- --build-flags"
end
- def install_from_gemdeps(gf)
+ def check_install_dir # :nodoc:
+ if options[:install_dir] and options[:user_install] then
+ alert_error "Use --install-dir or --user-install but not both"
+ terminate_interaction 1
+ end
+ end
+
+ def check_version # :nodoc:
+ if options[:version] != Gem::Requirement.default and
+ get_all_gem_names.size > 1 then
+ alert_error "Can't use --version w/ multiple gems. Use name:ver instead."
+ terminate_interaction 1
+ end
+ end
+
+ def execute
+ if options.include? :gemdeps then
+ install_from_gemdeps
+ return # not reached
+ end
+
+ @installed_specs = []
+
+ ENV.delete 'GEM_PATH' if options[:install_dir].nil? and RUBY_VERSION > '1.9'
+
+ check_install_dir
+ check_version
+
+ load_hooks
+
+ exit_code = install_gems
+
+ show_installed
+
+ terminate_interaction exit_code
+ end
+
+ def install_from_gemdeps # :nodoc:
require 'rubygems/request_set'
rs = Gem::RequestSet.new
- rs.load_gemdeps gf
-
- rs.resolve
- specs = rs.install options do |req, inst|
+ specs = rs.install_from_gemdeps options do |req, inst|
s = req.full_spec
if inst
@@ -128,70 +222,125 @@ to write the specification by hand. For example:
@installed_specs = specs
- raise Gem::SystemExitException, 0
+ terminate_interaction
end
- def execute
- if gf = options[:gemdeps] then
- install_from_gemdeps gf
- return
- end
+ def install_gem name, version # :nodoc:
+ return if options[:conservative] and
+ not Gem::Dependency.new(name, version).matching_specs.empty?
- @installed_specs = []
+ req = Gem::Requirement.create(version)
- ENV.delete 'GEM_PATH' if options[:install_dir].nil? and RUBY_VERSION > '1.9'
+ if options[:ignore_dependencies] then
+ install_gem_without_dependencies name, req
+ else
+ inst = Gem::DependencyInstaller.new options
+ request_set = inst.resolve_dependencies name, req
- if options[:install_dir] and options[:user_install]
- alert_error "Use --install-dir or --user-install but not both"
- terminate_interaction 1
+ 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
- exit_code = 0
+ def install_gem_without_dependencies name, req # :nodoc:
+ gem = nil
- if options[:version] != Gem::Requirement.default &&
- get_all_gem_names.size > 1 then
- alert_error "Can't use --version w/ multiple gems. Use name:ver instead."
- terminate_interaction 1
+ 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
+ end
+ gem = source.download spec if spec
end
+ if remote? and not gem then
+ dependency = Gem::Dependency.new name, req
+ dependency.prerelease = options[:prerelease]
- get_all_gem_names_and_versions.each do |gem_name, gem_version|
- gem_version ||= options[:version]
+ fetcher = Gem::RemoteFetcher.fetcher
+ gem = fetcher.download_to_cache dependency
+ end
- begin
- next if options[:conservative] and
- not Gem::Dependency.new(gem_name, gem_version).matching_specs.empty?
+ inst = Gem::Installer.new gem, options
+ inst.install
- inst = Gem::DependencyInstaller.new options
- inst.install gem_name, Gem::Requirement.create(gem_version)
+ require 'rubygems/dependency_installer'
+ dinst = Gem::DependencyInstaller.new options
+ dinst.installed_gems.replace [inst.spec]
- @installed_specs.push(*inst.installed_gems)
+ Gem.done_installing_hooks.each do |hook|
+ hook.call dinst, [inst.spec]
+ end unless Gem.done_installing_hooks.empty?
- next unless errs = inst.errors
+ @installed_specs.push(inst.spec)
+ end
- errs.each do |x|
- next unless Gem::SourceFetchProblem === x
+ def install_gems # :nodoc:
+ exit_code = 0
- msg = "Unable to pull data from '#{x.source.uri}': #{x.error.message}"
+ get_all_gem_names_and_versions.each do |gem_name, gem_version|
+ gem_version ||= options[:version]
- alert_warning msg
- end
+ begin
+ install_gem gem_name, gem_version
rescue Gem::InstallError => e
alert_error "Error installing #{gem_name}:\n\t#{e.message}"
exit_code |= 1
- rescue Gem::GemNotFoundException => e
- show_lookup_failure e.name, e.version, e.errors, options[:domain]
+ 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
exit_code |= 2
end
end
- unless @installed_specs.empty? then
- gems = @installed_specs.length == 1 ? 'gem' : 'gems'
- say "#{@installed_specs.length} #{gems} installed"
+ exit_code
+ end
+
+ ##
+ # Loads post-install hooks
+
+ def load_hooks # :nodoc:
+ if options[:install_as_default]
+ require 'rubygems/install_default_message'
+ else
+ require 'rubygems/install_message'
+ end
+ require 'rubygems/rdoc'
+ end
+
+ def show_install_errors errors # :nodoc:
+ return unless errors
+
+ errors.each do |x|
+ return unless Gem::SourceFetchProblem === x
+
+ msg = "Unable to pull data from '#{x.source.uri}': #{x.error.message}"
+
+ alert_warning msg
end
+ end
+
+ def show_installed # :nodoc:
+ return if @installed_specs.empty?
- raise Gem::SystemExitException, exit_code
+ gems = @installed_specs.length == 1 ? 'gem' : 'gems'
+ say "#{@installed_specs.length} #{gems} installed"
end
end
diff --git a/lib/rubygems/commands/list_command.rb b/lib/rubygems/commands/list_command.rb
index f3e5da9551..c6ff237311 100644
--- a/lib/rubygems/commands/list_command.rb
+++ b/lib/rubygems/commands/list_command.rb
@@ -8,27 +8,32 @@ require 'rubygems/commands/query_command'
class Gem::Commands::ListCommand < Gem::Commands::QueryCommand
def initialize
- super 'list', 'Display gems whose name starts with STRING'
+ super 'list', 'Display local gems whose name matches REGEXP'
remove_option('--name-matches')
end
def arguments # :nodoc:
- "STRING start of gem name to look for"
+ "REGEXP regexp to look for in gem name"
end
def defaults_str # :nodoc:
"--local --no-details"
end
- def usage # :nodoc:
- "#{program_name} [STRING]"
+ def description # :nodoc:
+ <<-EOF
+The list command is used to view the gems you have installed locally.
+
+The --details option displays additional details including the summary, the
+homepage, the author, the locations of different versions of the gem.
+
+To search for remote gems use the search command.
+ EOF
end
- def execute
- string = get_one_optional_argument || ''
- options[:name] = /^#{string}/i
- super
+ def usage # :nodoc:
+ "#{program_name} [STRING ...]"
end
end
diff --git a/lib/rubygems/commands/mirror_command.rb b/lib/rubygems/commands/mirror_command.rb
index 0f98077cbd..75419c857a 100644
--- a/lib/rubygems/commands/mirror_command.rb
+++ b/lib/rubygems/commands/mirror_command.rb
@@ -10,6 +10,12 @@ class Gem::Commands::MirrorCommand < Gem::Command
end
end
+ 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
diff --git a/lib/rubygems/commands/open_command.rb b/lib/rubygems/commands/open_command.rb
new file mode 100644
index 0000000000..91963bba73
--- /dev/null
+++ b/lib/rubygems/commands/open_command.rb
@@ -0,0 +1,74 @@
+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
+ system(*@editor.split(/\s+/) + [path])
+ 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 887faab0a2..7159dbb984 100644
--- a/lib/rubygems/commands/outdated_command.rb
+++ b/lib/rubygems/commands/outdated_command.rb
@@ -15,19 +15,18 @@ class Gem::Commands::OutdatedCommand < Gem::Command
add_platform_option
end
- def execute
- Gem::Specification.outdated.sort.each do |name|
- local = Gem::Specification.find_all_by_name(name).max
- dep = Gem::Dependency.new local.name, ">= #{local.version}"
- remotes, _ = Gem::SpecFetcher.fetcher.spec_for_dependency dep
-
- next if remotes.empty?
-
- remotes.sort! { |a,b| a[0].version <=> b[0].version }
+ def description # :nodoc:
+ <<-EOF
+The outdated command lists gems you may wish to upgrade to a newer version.
- highest = remotes.last.first
+You can check for dependency mismatches using the dependency command and
+update the gems with the update or install commands.
+ EOF
+ end
- say "#{local.name} (#{local.version} < #{highest.version})"
+ def execute
+ Gem::Specification.outdated_and_latest_version.each do |spec, remote_version|
+ say "#{spec.name} (#{spec.version} < #{remote_version})"
end
end
end
diff --git a/lib/rubygems/commands/owner_command.rb b/lib/rubygems/commands/owner_command.rb
index 11e6e026fd..322bf6590a 100644
--- a/lib/rubygems/commands/owner_command.rb
+++ b/lib/rubygems/commands/owner_command.rb
@@ -7,7 +7,14 @@ class Gem::Commands::OwnerCommand < Gem::Command
include Gem::GemcutterUtilities
def description # :nodoc:
- 'Manage gem owners on RubyGems.org.'
+ <<-EOF
+The owner command lets you add and remove owners of a gem on a push
+server (the default is https://rubygems.org).
+
+The owner of a gem has the permission to push new versions, yank existing
+versions or edit the HTML page of the gem. Be careful of who you give push
+permission to.
+ EOF
end
def arguments # :nodoc:
@@ -19,7 +26,7 @@ class Gem::Commands::OwnerCommand < Gem::Command
end
def initialize
- super 'owner', description
+ super 'owner', 'Manage gem owners of a gem on the push server'
add_proxy_option
add_key_option
defaults.merge! :add => [], :remove => []
@@ -31,9 +38,15 @@ class Gem::Commands::OwnerCommand < Gem::Command
add_option '-r', '--remove EMAIL', 'Remove an owner' do |value, options|
options[:remove] << value
end
+
+ add_option '-h', '--host HOST', 'Use another gemcutter-compatible host' do |value, options|
+ options[:host] = value
+ end
end
def execute
+ @host = options[:host]
+
sign_in
name = get_one_gem_name
@@ -73,7 +86,9 @@ class Gem::Commands::OwnerCommand < Gem::Command
request.add_field "Authorization", api_key
end
- with_response response, "Removing #{owner}"
+ action = method == :delete ? "Removing" : "Adding"
+
+ with_response response, "#{action} #{owner}"
rescue
# ignore
end
diff --git a/lib/rubygems/commands/pristine_command.rb b/lib/rubygems/commands/pristine_command.rb
index 8d479211ac..b54e7eac93 100644
--- a/lib/rubygems/commands/pristine_command.rb
+++ b/lib/rubygems/commands/pristine_command.rb
@@ -12,6 +12,7 @@ class Gem::Commands::PristineCommand < Gem::Command
'Restores installed gems to pristine condition from files located in the gem cache',
:version => Gem::Requirement.default,
:extensions => true,
+ :extensions_set => false,
:all => false
add_option('--all',
@@ -23,7 +24,8 @@ class Gem::Commands::PristineCommand < Gem::Command
add_option('--[no-]extensions',
'Restore gems with extensions',
'in addition to regular gems') do |value, options|
- options[:extensions] = value
+ options[:extensions_set] = true
+ options[:extensions] = value
end
add_option('--only-executables',
@@ -31,6 +33,12 @@ class Gem::Commands::PristineCommand < Gem::Command
options[:only_executables] = value
end
+ add_option('-E', '--[no-]env-shebang',
+ 'Rewrite executables with a shebang',
+ 'of /usr/bin/env') do |value, options|
+ options[:env_shebang] = value
+ end
+
add_version_option('restore to', 'pristine condition')
end
@@ -56,6 +64,9 @@ If the cached gem cannot be found it will be downloaded.
If --no-extensions is provided pristine will not attempt to restore a gem
with an extension.
+
+If --extensions is given (but not --all or gem names) only gems with
+extensions will be restored.
EOF
end
@@ -66,6 +77,14 @@ with an extension.
def execute
specs = if options[:all] then
Gem::Specification.map
+
+ # `--extensions` must be explicitly given to pristine only gems
+ # with extensions.
+ elsif options[:extensions_set] and
+ options[:extensions] and options[:args].empty? then
+ Gem::Specification.select do |spec|
+ spec.extensions and not spec.extensions.empty?
+ end
else
get_all_gem_names.map do |gem_name|
Gem::Specification.find_all_by_name gem_name, options[:version]
@@ -105,16 +124,21 @@ with an extension.
Gem::RemoteFetcher.fetcher.download_to_cache dep
end
- # TODO use installer options
- install_defaults = Gem::ConfigFile::PLATFORM_DEFAULTS['install']
- installer_env_shebang = install_defaults.to_s['--env-shebang']
+ env_shebang =
+ if options.include? :env_shebang then
+ options[:env_shebang]
+ else
+ install_defaults = Gem::ConfigFile::PLATFORM_DEFAULTS['install']
+ install_defaults.to_s['--env-shebang']
+ end
installer = Gem::Installer.new(gem,
:wrappers => true,
:force => true,
:install_dir => spec.base_dir,
- :env_shebang => installer_env_shebang,
+ :env_shebang => env_shebang,
:build_args => spec.build_args)
+
if options[:only_executables] then
installer.generate_bin
else
diff --git a/lib/rubygems/commands/push_command.rb b/lib/rubygems/commands/push_command.rb
index fccad206fa..6899b489ad 100644
--- a/lib/rubygems/commands/push_command.rb
+++ b/lib/rubygems/commands/push_command.rb
@@ -8,7 +8,13 @@ class Gem::Commands::PushCommand < Gem::Command
include Gem::GemcutterUtilities
def description # :nodoc:
- 'Push a gem up to RubyGems.org'
+ <<-EOF
+The push command uploads a gem to the push server (the default is
+https://rubygems.org) and adds it to the index.
+
+The gem can be removed from the index (but only the index) using the yank
+command. For further discussion see the help for the yank command.
+ EOF
end
def arguments # :nodoc:
@@ -20,7 +26,7 @@ class Gem::Commands::PushCommand < Gem::Command
end
def initialize
- super 'push', description, :host => self.host
+ super 'push', 'Push a gem up to the gem server', :host => self.host
add_proxy_option
add_key_option
@@ -63,13 +69,18 @@ You can upgrade or downgrade to the latest release version with:
terminate_interaction 1
end
+ gem_data = Gem::Package.new(name)
+
unless @host then
- if gem_data = Gem::Package.new(name) then
- @host = gem_data.spec.metadata['default_gem_server']
- end
+ @host = gem_data.spec.metadata['default_gem_server']
end
- args << @host if @host
+ # Always include this, even if it's nil
+ args << @host
+
+ if gem_data.spec.metadata.has_key?('allowed_push_host')
+ args << gem_data.spec.metadata['allowed_push_host']
+ end
say "Pushing gem to #{@host || Gem.host}..."
diff --git a/lib/rubygems/commands/query_command.rb b/lib/rubygems/commands/query_command.rb
index 05b214bb63..432250e033 100644
--- a/lib/rubygems/commands/query_command.rb
+++ b/lib/rubygems/commands/query_command.rb
@@ -61,18 +61,37 @@ class Gem::Commands::QueryCommand < Gem::Command
"--local --name-matches // --no-details --versions --no-installed"
end
+ def description # :nodoc:
+ <<-EOF
+The query command is the basis for the list and search commands.
+
+You should really use the list and search commands instead. This command
+is too hard to use.
+ EOF
+ end
+
def execute
exit_code = 0
+ if options[:args].to_a.empty? and options[:name].source.empty?
+ name = options[:name]
+ no_name = true
+ elsif !options[:name].source.empty?
+ name = Array(options[:name])
+ else
+ name = options[:args].to_a.map{|arg| /#{arg}/i }
+ end
- name = options[:name]
prerelease = options[:prerelease]
unless options[:installed].nil? then
- if name.source.empty? then
+ if no_name then
alert_error "You must specify a gem name"
exit_code |= 4
+ elsif name.count > 1
+ alert_error "You must specify only ONE gem!"
+ exit_code |= 4
else
- installed = installed? name, options[:version]
+ installed = installed? name.first, options[:version]
installed = !installed unless options[:installed]
if installed then
@@ -86,6 +105,22 @@ class Gem::Commands::QueryCommand < Gem::Command
terminate_interaction exit_code
end
+ names = Array(name)
+ names.each { |n| show_gems n, prerelease }
+ end
+
+ private
+
+ def display_header type
+ if (ui.outs.tty? and Gem.configuration.verbose) or both? then
+ say
+ say "*** #{type} GEMS ***"
+ say
+ end
+ end
+
+ #Guts of original execute
+ def show_gems name, prerelease
req = Gem::Requirement.default
# TODO: deprecate for real
dep = Gem::Deprecate.skip_during { Gem::Dependency.new name, req }
@@ -96,11 +131,7 @@ class Gem::Commands::QueryCommand < Gem::Command
alert_warning "prereleases are always shown locally"
end
- if ui.outs.tty? or both? then
- say
- say "*** LOCAL GEMS ***"
- say
- end
+ display_header 'LOCAL'
specs = Gem::Specification.find_all { |s|
s.name =~ name and req =~ s.version
@@ -114,11 +145,7 @@ class Gem::Commands::QueryCommand < Gem::Command
end
if remote? then
- if ui.outs.tty? or both? then
- say
- say "*** REMOTE GEMS ***"
- say
- end
+ display_header 'REMOTE'
fetcher = Gem::SpecFetcher.fetcher
@@ -134,11 +161,11 @@ class Gem::Commands::QueryCommand < Gem::Command
:latest
end
- if options[:name].source.empty?
+ if name.source.empty?
spec_tuples = fetcher.detect(type) { true }
else
spec_tuples = fetcher.detect(type) do |name_tuple|
- options[:name] === name_tuple.name
+ name === name_tuple.name
end
end
@@ -146,8 +173,6 @@ class Gem::Commands::QueryCommand < Gem::Command
end
end
- private
-
##
# Check if gem +name+ version +version+ is installed.
diff --git a/lib/rubygems/commands/rdoc_command.rb b/lib/rubygems/commands/rdoc_command.rb
index df00f3a5df..86597f99a6 100644
--- a/lib/rubygems/commands/rdoc_command.rb
+++ b/lib/rubygems/commands/rdoc_command.rb
@@ -45,8 +45,12 @@ class Gem::Commands::RdocCommand < Gem::Command
def description # :nodoc:
<<-DESC
-The rdoc command builds RDoc and RI documentation for installed gems. Use
---overwrite to force rebuilding of documentation.
+The rdoc command builds documentation for installed gems. By default
+only documentation is built using rdoc, but additional types of
+documentation may be built through rubygems plugins and the
+Gem.post_installs hook.
+
+Use --overwrite to force rebuilding of documentation.
DESC
end
diff --git a/lib/rubygems/commands/search_command.rb b/lib/rubygems/commands/search_command.rb
index c125715fe2..a1e2c1a00e 100644
--- a/lib/rubygems/commands/search_command.rb
+++ b/lib/rubygems/commands/search_command.rb
@@ -4,7 +4,7 @@ require 'rubygems/commands/query_command'
class Gem::Commands::SearchCommand < Gem::Commands::QueryCommand
def initialize
- super 'search', 'Display all gems whose name contains STRING'
+ super 'search', 'Display remote gems whose name matches REGEXP'
remove_option '--name-matches'
@@ -12,21 +12,28 @@ class Gem::Commands::SearchCommand < Gem::Commands::QueryCommand
end
def arguments # :nodoc:
- "STRING fragment of gem name to search for"
+ "REGEXP regexp to search for in gem name"
end
def defaults_str # :nodoc:
"--remote --no-details"
end
- def usage # :nodoc:
- "#{program_name} [STRING]"
+ def description # :nodoc:
+ <<-EOF
+The search command displays remote gems whose name matches the given
+regexp.
+
+The --details option displays additional details from the gem but will
+take a little longer to complete as it must download the information
+individually from the index.
+
+To list local gems use the list command.
+ EOF
end
- def execute
- string = get_one_optional_argument
- options[:name] = /#{string}/i
- super
+ def usage # :nodoc:
+ "#{program_name} [REGEXP]"
end
end
diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb
index face77fae9..6617396780 100644
--- a/lib/rubygems/commands/setup_command.rb
+++ b/lib/rubygems/commands/setup_command.rb
@@ -13,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',
@@ -36,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',
@@ -343,19 +343,19 @@ TEXT
site_or_vendor = options[:site_or_vendor]
if prefix.empty? then
- lib_dir = Gem::ConfigMap[site_or_vendor]
- bin_dir = Gem::ConfigMap[:bindir]
+ lib_dir = RbConfig::CONFIG[site_or_vendor]
+ bin_dir = RbConfig::CONFIG['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 == Gem::ConfigMap[:libdir] or
+ (prefix == RbConfig::CONFIG['libdir'] or
# this one is important
- prefix == File.join(Gem::ConfigMap[:libdir], 'ruby')) then
- lib_dir = Gem::ConfigMap[site_or_vendor]
- bin_dir = Gem::ConfigMap[:bindir]
+ prefix == File.join(RbConfig::CONFIG['libdir'], 'ruby')) then
+ lib_dir = RbConfig::CONFIG[site_or_vendor]
+ bin_dir = RbConfig::CONFIG['bindir']
else
lib_dir = File.join prefix, 'lib'
bin_dir = File.join prefix, 'bin'
@@ -446,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 f4cc3e57ae..81ff07babc 100644
--- a/lib/rubygems/commands/sources_command.rb
+++ b/lib/rubygems/commands/sources_command.rb
@@ -37,103 +37,164 @@ class Gem::Commands::SourcesCommand < Gem::Command
add_proxy_option
end
- def defaults_str
- '--list'
- end
-
- def execute
- options[:list] = !(options[:add] ||
- options[:clear_all] ||
- options[:remove] ||
- options[:update])
+ def add_source source_uri # :nodoc:
+ check_rubygems_https source_uri
- if options[:clear_all] then
- path = File.join Gem.user_home, '.gem', 'specs'
- FileUtils.rm_rf path
+ source = Gem::Source.new source_uri
- unless File.exist? path then
- say "*** Removed specs cache ***"
+ begin
+ if Gem.sources.include? source_uri then
+ say "source #{source_uri} already present in the cache"
else
- unless File.writable? path then
- say "*** Unable to remove source cache (write protected) ***"
- else
- say "*** Unable to remove source cache ***"
- end
+ source.load_specs :released
+ Gem.sources << source
+ Gem.configuration.write
- terminate_interaction 1
+ say "#{source_uri} added to sources"
end
+ rescue URI::Error, ArgumentError
+ say "#{source_uri} is not a URI"
+ terminate_interaction 1
+ rescue Gem::RemoteFetcher::FetchError => e
+ say "Error fetching #{source_uri}:\n\t#{e.message}"
+ terminate_interaction 1
end
+ end
- if source_uri = options[:add] then
- uri = URI source_uri
+ def check_rubygems_https source_uri # :nodoc:
+ uri = URI source_uri
- if uri.scheme and uri.scheme.downcase == 'http' and
- uri.host.downcase == 'rubygems.org' then
- question = <<-QUESTION.chomp
+ if uri.scheme and uri.scheme.downcase == 'http' and
+ uri.host.downcase == 'rubygems.org' then
+ question = <<-QUESTION.chomp
https://rubygems.org is recommended for security over #{uri}
Do you want to add this insecure source?
- QUESTION
+ QUESTION
- terminate_interaction 1 unless ask_yes_no question
- end
-
- source = Gem::Source.new source_uri
-
- begin
- if Gem.sources.include? source_uri then
- say "source #{source_uri} already present in the cache"
- else
- source.load_specs :released
- Gem.sources << source
- Gem.configuration.write
-
- say "#{source_uri} added to sources"
- end
- rescue URI::Error, ArgumentError
- say "#{source_uri} is not a URI"
- terminate_interaction 1
- rescue Gem::RemoteFetcher::FetchError => e
- say "Error fetching #{source_uri}:\n\t#{e.message}"
- terminate_interaction 1
- end
+ terminate_interaction 1 unless ask_yes_no question
end
+ end
- if options[:remove] then
- source_uri = options[:remove]
+ def clear_all # :nodoc:
+ path = Gem.spec_cache_dir
+ FileUtils.rm_rf path
- unless Gem.sources.include? source_uri then
- say "source #{source_uri} not present in cache"
+ unless File.exist? path then
+ say "*** Removed specs cache ***"
+ else
+ unless File.writable? path then
+ say "*** Unable to remove source cache (write protected) ***"
else
- Gem.sources.delete source_uri
- Gem.configuration.write
-
- say "#{source_uri} removed from sources"
+ say "*** Unable to remove source cache ***"
end
+
+ terminate_interaction 1
end
+ end
- if options[:update] then
- Gem.sources.each_source do |src|
- src.load_specs :released
- src.load_specs :latest
- end
+ def defaults_str # :nodoc:
+ '--list'
+ end
+
+ def description # :nodoc:
+ <<-EOF
+RubyGems fetches gems from the sources you have configured (stored in your
+~/.gemrc).
+
+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.
+
+Without any arguments the sources lists your currently configured sources:
+
+ $ gem sources
+ *** CURRENT SOURCES ***
+
+ https://rubygems.org
+
+This may list multiple sources or non-rubygems sources. You probably
+configured them before or have an old `~/.gemrc`. If you have sources you
+do not recognize you should remove them.
+
+RubyGems has been configured to serve gems via the following URLs through
+its history:
- say "source cache successfully updated"
+* http://gems.rubyforge.org (RubyGems 1.3.6 and earlier)
+* http://rubygems.org (RubyGems 1.3.7 through 1.8.25)
+* https://rubygems.org (RubyGems 2.0.1 and newer)
+
+Since all of these sources point to the same set of gems you only need one
+of them in your list. https://rubygems.org is recommended as it brings the
+protections of an SSL connection to gem downloads.
+
+To add a source use the --add argument:
+
+ $ gem sources --add https://rubygems.org
+ https://rubygems.org added to sources
+
+RubyGems will check to see if gems can be installed from the source given
+before it is added.
+
+To remove a source use the --remove argument:
+
+ $ gem sources --remove http://rubygems.org
+ http://rubygems.org removed from sources
+
+ EOF
+ end
+
+ def list # :nodoc:
+ say "*** CURRENT SOURCES ***"
+ say
+
+ Gem.sources.each do |src|
+ say src
end
+ end
- if options[:list] then
- say "*** CURRENT SOURCES ***"
- say
+ def list? # :nodoc:
+ !(options[:add] ||
+ options[:clear_all] ||
+ options[:remove] ||
+ options[:update])
+ end
- Gem.sources.each do |src|
- say src
- end
+ def execute
+ clear_all if options[:clear_all]
+
+ source_uri = options[:add]
+ add_source source_uri if source_uri
+
+ source_uri = options[:remove]
+ remove_source source_uri if source_uri
+
+ update if options[:update]
+
+ list if list?
+ end
+
+ def remove_source source_uri # :nodoc:
+ unless Gem.sources.include? source_uri then
+ say "source #{source_uri} not present in cache"
+ else
+ Gem.sources.delete source_uri
+ Gem.configuration.write
+
+ say "#{source_uri} removed from sources"
end
end
- private
+ def update # :nodoc:
+ Gem.sources.each_source do |src|
+ src.load_specs :released
+ src.load_specs :latest
+ end
+
+ say "source cache successfully updated"
+ end
- def remove_cache_file(desc, path)
+ def remove_cache_file desc, path # :nodoc:
FileUtils.rm_rf path
if not File.exist?(path) then
diff --git a/lib/rubygems/commands/specification_command.rb b/lib/rubygems/commands/specification_command.rb
index b40dfd5f3c..3bc02a9c14 100644
--- a/lib/rubygems/commands/specification_command.rb
+++ b/lib/rubygems/commands/specification_command.rb
@@ -50,6 +50,22 @@ FIELD name of gemspec field to show
"--local --version '#{Gem::Requirement.default}' --yaml"
end
+ def description # :nodoc:
+ <<-EOF
+The specification command allows you to extract the specification from
+a gem for examination.
+
+The specification can be output in YAML, ruby or Marshal formats.
+
+Specific fields in the specification can be extracted in YAML format:
+
+ $ gem spec rake summary
+ --- Ruby based make-like utility.
+ ...
+
+ EOF
+ end
+
def usage # :nodoc:
"#{program_name} [GEMFILE] [FIELD]"
end
@@ -111,7 +127,7 @@ FIELD name of gemspec field to show
end
unless options[:all] then
- specs = [specs.sort_by { |s| s.version }.last]
+ specs = [specs.max_by { |s| s.version }]
end
specs.each do |s|
diff --git a/lib/rubygems/commands/stale_command.rb b/lib/rubygems/commands/stale_command.rb
index 36c517e27c..0ef0755960 100644
--- a/lib/rubygems/commands/stale_command.rb
+++ b/lib/rubygems/commands/stale_command.rb
@@ -5,6 +5,16 @@ class Gem::Commands::StaleCommand < Gem::Command
super('stale', 'List gems along with access times')
end
+ def description # :nodoc:
+ <<-EOF
+The stale command lists the latest access time for all the files in your
+installed gems.
+
+You can use this command to discover gems and gem versions you are no
+longer using.
+ EOF
+ end
+
def usage # :nodoc:
"#{program_name}"
end
diff --git a/lib/rubygems/commands/uninstall_command.rb b/lib/rubygems/commands/uninstall_command.rb
index 56aa8ee57f..71ffdc89fc 100644
--- a/lib/rubygems/commands/uninstall_command.rb
+++ b/lib/rubygems/commands/uninstall_command.rb
@@ -1,6 +1,7 @@
require 'rubygems/command'
require 'rubygems/version_option'
require 'rubygems/uninstaller'
+require 'fileutils'
##
# Gem uninstaller command line tool
@@ -14,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
+ :check_dev => false, :vendor => false
add_option('-a', '--[no-]all',
'Uninstall all matching versions'
@@ -67,8 +68,26 @@ class Gem::Commands::UninstallCommand < Gem::Command
options[:force] = value
end
+ add_option('--[no-]abort-on-dependent',
+ 'Prevent uninstalling gems that are',
+ 'depended on by other gems.') do |value, options|
+ options[:abort_on_dependent] = value
+ end
+
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:
@@ -77,17 +96,51 @@ class Gem::Commands::UninstallCommand < Gem::Command
def defaults_str # :nodoc:
"--version '#{Gem::Requirement.default}' --no-force " +
- "--install-dir #{Gem.dir}\n" +
"--user-install"
end
+ def description # :nodoc:
+ <<-EOF
+The uninstall command removes a previously installed gem.
+
+RubyGems will ask for confirmation if you are attempting to uninstall a gem
+that is a dependency of an existing gem. You can use the
+--ignore-dependencies option to skip this check.
+ EOF
+ end
+
def usage # :nodoc:
"#{program_name} GEMNAME [GEMNAME ...]"
end
def execute
- # REFACTOR: stolen from cleanup_command
+ if options[:all] and not options[:args].empty? then
+ uninstall_specific
+ elsif options[:all] then
+ uninstall_all
+ else
+ uninstall_specific
+ end
+ end
+
+ def uninstall_all
+ _, specs = Gem::Specification.partition { |spec| spec.default_gem? }
+
+ specs.each do |spec|
+ options[:version] = spec.version
+
+ begin
+ Gem::Uninstaller.new(spec.name, options).uninstall
+ rescue Gem::InstallError
+ end
+ end
+
+ alert "Uninstalled all gems in #{options[:install_dir]}"
+ end
+
+ def uninstall_specific
deplist = Gem::DependencyList.new
+
get_all_gem_names.uniq.each do |name|
Gem::Specification.find_all_by_name(name).each do |spec|
deplist.add spec
diff --git a/lib/rubygems/commands/unpack_command.rb b/lib/rubygems/commands/unpack_command.rb
index 7eefd32a6e..5a05ad0a81 100644
--- a/lib/rubygems/commands/unpack_command.rb
+++ b/lib/rubygems/commands/unpack_command.rb
@@ -34,6 +34,24 @@ class Gem::Commands::UnpackCommand < Gem::Command
"--version '#{Gem::Requirement.default}'"
end
+ def description
+ <<-EOF
+The unpack command allows you to examine the contents of a gem or modify
+them to help diagnose a bug.
+
+You can add the contents of the unpacked gem to the load path using the
+RUBYLIB environment variable or -I:
+
+ $ gem unpack my_gem
+ Unpacked gem: '.../my_gem-1.0'
+ [edit my_gem-1.0/lib/my_gem.rb]
+ $ ruby -Imy_gem-1.0/lib -S other_program
+
+You can repackage an unpacked gem using the build command. See the build
+command help for an example.
+ EOF
+ end
+
def usage # :nodoc:
"#{program_name} GEMNAME"
end
@@ -116,7 +134,7 @@ class Gem::Commands::UnpackCommand < Gem::Command
specs = dependency.matching_specs
- selected = specs.sort_by { |s| s.version }.last # HACK: hunt last down
+ selected = specs.max_by { |s| s.version }
return Gem::RemoteFetcher.fetcher.download_to_cache(dependency) unless
selected
diff --git a/lib/rubygems/commands/update_command.rb b/lib/rubygems/commands/update_command.rb
index a31de0071a..9e9bd088f2 100644
--- a/lib/rubygems/commands/update_command.rb
+++ b/lib/rubygems/commands/update_command.rb
@@ -16,6 +16,8 @@ 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],
@@ -45,15 +47,40 @@ class Gem::Commands::UpdateCommand < Gem::Command
end
def arguments # :nodoc:
- "GEMNAME name of gem to update"
+ "REGEXP regexp to search for in gem name"
end
def defaults_str # :nodoc:
"--document --no-force --install-dir #{Gem.dir}"
end
+ def description # :nodoc:
+ <<-EOF
+The update command will update your gems to the latest version.
+
+The update command does not remove the previous version. Use the cleanup
+command to remove old versions.
+ EOF
+ end
+
def usage # :nodoc:
- "#{program_name} GEMNAME [GEMNAME ...]"
+ "#{program_name} REGEXP [REGEXP ...]"
+ end
+
+ def check_latest_rubygems version # :nodoc:
+ if Gem.rubygems_version == version then
+ say "Latest version currently installed. Aborting."
+ terminate_interaction
+ end
+
+ options[:user_install] = false
+ end
+
+ def check_update_arguments # :nodoc:
+ unless options[:args].empty? then
+ alert_error "Gem names are not allowed with the --system option"
+ terminate_interaction 1
+ end
end
def execute
@@ -62,74 +89,90 @@ class Gem::Commands::UpdateCommand < Gem::Command
if options[:system] then
update_rubygems
return
- else
- say "Updating installed gems"
+ end
- hig = {} # highest installed gems
+ say "Updating installed gems"
- Gem::Specification.each do |spec|
- if hig[spec.name].nil? or hig[spec.name].version < spec.version then
- hig[spec.name] = spec
- end
- end
- end
+ hig = highest_installed_gems
gems_to_update = which_to_update hig, options[:args].uniq
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.map { |spec| spec.name }.join ' '}"
+ say "Gems updated: #{updated_names.join(' ')}"
+ say "Gems already up-to-date: #{not_updated_names.join(' ')}" unless not_updated_names.empty?
end
end
- def update_gem name, version = Gem::Requirement.default
- return if @updated.any? { |spec| spec.name == name }
+ def fetch_remote_gems spec # :nodoc:
+ dependency = Gem::Dependency.new spec.name, "> #{spec.version}"
+ dependency.prerelease = options[:prerelease]
- @installer ||= Gem::DependencyInstaller.new options
+ fetcher = Gem::SpecFetcher.fetcher
- success = false
+ spec_tuples, errors = fetcher.search_for_dependency dependency
- say "Updating #{name}"
- begin
- @installer.install name, Gem::Requirement.new(version)
- success = true
- rescue Gem::InstallError => e
- alert_error "Error installing #{name}:\n\t#{e.message}"
- success = false
- end
+ error = errors.find { |e| e.respond_to? :exception }
- @installer.installed_gems.each do |spec|
- @updated << spec
- end
+ raise error if error
+
+ spec_tuples
end
- def update_gems gems_to_update
- gems_to_update.uniq.sort.each do |(name, version)|
- update_gem name, version
+ def highest_installed_gems # :nodoc:
+ hig = {} # highest installed gems
+
+ Gem::Specification.each do |spec|
+ if hig[spec.name].nil? or hig[spec.name].version < spec.version then
+ hig[spec.name] = spec
+ end
end
- @updated
+ hig
end
- ##
- # Update RubyGems software to the latest version.
+ def highest_remote_version spec # :nodoc:
+ spec_tuples = fetch_remote_gems spec
- def update_rubygems
- unless options[:args].empty? then
- alert_error "Gem names are not allowed with the --system option"
- terminate_interaction 1
+ matching_gems = spec_tuples.select do |g,_|
+ g.name == spec.name and g.match_platform?
end
- options[:user_install] = false
+ highest_remote_gem = matching_gems.max_by { |g,_| g.version }
+
+ highest_remote_gem ||= [Gem::NameTuple.null]
+
+ highest_remote_gem.first.version
+ end
+
+ def install_rubygems version # :nodoc:
+ args = update_rubygems_arguments
+
+ update_dir = File.join Gem.dir, 'gems', "rubygems-update-#{version}"
+
+ Dir.chdir update_dir do
+ say "Installing RubyGems #{version}"
- # TODO: rename version and other variable name conflicts
- # TODO: get rid of all this indirection on name and other BS
+ # Make sure old rubygems isn't loaded
+ old = ENV["RUBYOPT"]
+ ENV.delete("RUBYOPT") if old
+ installed = system Gem.ruby, 'setup.rb', *args
+ say "RubyGems system software updated" if installed
+ ENV["RUBYOPT"] = old if old
+ end
+ end
+ def rubygems_target_version
version = options[:system]
- if version == true then
+ update_latest = version == true
+
+ if update_latest then
version = Gem::Version.new Gem::VERSION
requirement = Gem::Requirement.new ">= #{Gem::VERSION}"
else
@@ -146,46 +189,71 @@ class Gem::Commands::UpdateCommand < Gem::Command
}
gems_to_update = which_to_update hig, options[:args], :system
- name, up_ver = gems_to_update.first
- current_ver = Gem.rubygems_version
+ _, up_ver = gems_to_update.first
- target = if options[:system] == true then
+ target = if update_latest then
up_ver
else
version
end
- if current_ver == target then
- # if options[:system] != true and version == current_ver then
- say "Latest version currently installed. Aborting."
- terminate_interaction
+ return target, requirement
+ end
+
+ def update_gem name, version = Gem::Requirement.default
+ return if @updated.any? { |spec| spec.name == name }
+
+ @installer ||= Gem::DependencyInstaller.new options
+
+ say "Updating #{name}"
+ begin
+ @installer.install name, Gem::Requirement.new(version)
+ rescue Gem::InstallError, Gem::DependencyError => e
+ alert_error "Error installing #{name}:\n\t#{e.message}"
+ end
+
+ @installer.installed_gems.each do |spec|
+ @updated << spec
end
+ end
- update_gem name, target
+ def update_gems gems_to_update
+ gems_to_update.uniq.sort.each do |(name, version)|
+ update_gem name, version
+ end
+
+ @updated
+ end
+
+ ##
+ # Update RubyGems software to the latest version.
+
+ def update_rubygems
+ check_update_arguments
+
+ version, requirement = rubygems_target_version
+
+ check_latest_rubygems version
+
+ update_gem 'rubygems-update', version
installed_gems = Gem::Specification.find_all_by_name 'rubygems-update', requirement
version = installed_gems.last.version
+ install_rubygems version
+ end
+
+ def update_rubygems_arguments # :nodoc:
args = []
args << '--prefix' << Gem.prefix if Gem.prefix
# TODO use --document for >= 1.9 , --no-rdoc --no-ri < 1.9
args << '--no-rdoc' unless options[:document].include? 'rdoc'
args << '--no-ri' unless options[:document].include? 'ri'
args << '--no-format-executable' if options[:no_format_executable]
-
- update_dir = File.join Gem.dir, 'gems', "rubygems-update-#{version}"
-
- Dir.chdir update_dir do
- say "Installing RubyGems #{version}"
- setup_cmd = "#{Gem.ruby} setup.rb #{args.join ' '}"
-
- # Make sure old rubygems isn't loaded
- old = ENV["RUBYOPT"]
- ENV.delete("RUBYOPT") if old
- installed = system setup_cmd
- say "RubyGems system software updated" if installed
- ENV["RUBYOPT"] = old if old
- end
+ args << '--previous-version' << Gem::VERSION if
+ options[:system] == true or
+ Gem::Version.new(options[:system]) >= Gem::Version.new(2)
+ args
end
def which_to_update highest_installed_gems, gem_names, system = false
@@ -193,23 +261,9 @@ class Gem::Commands::UpdateCommand < Gem::Command
highest_installed_gems.each do |l_name, l_spec|
next if not gem_names.empty? and
- gem_names.all? { |name| /#{name}/ !~ l_spec.name }
+ gem_names.none? { |name| name == l_spec.name }
- dependency = Gem::Dependency.new l_spec.name, "> #{l_spec.version}"
- dependency.prerelease = options[:prerelease]
-
- fetcher = Gem::SpecFetcher.fetcher
-
- spec_tuples, _ = fetcher.search_for_dependency dependency
-
- matching_gems = spec_tuples.select do |g,_|
- g.name == l_name and g.match_platform?
- end
-
- highest_remote_gem = matching_gems.sort_by { |g,_| g.version }.last
-
- highest_remote_gem ||= [Gem::NameTuple.null]
- highest_remote_ver = highest_remote_gem.first.version
+ highest_remote_ver = highest_remote_version l_spec
if system or (l_spec.version < highest_remote_ver) then
result << [l_spec.name, [l_spec.version, highest_remote_ver].max]
@@ -220,4 +274,3 @@ class Gem::Commands::UpdateCommand < Gem::Command
end
end
-
diff --git a/lib/rubygems/commands/which_command.rb b/lib/rubygems/commands/which_command.rb
index 6495278a87..96eeb86288 100644
--- a/lib/rubygems/commands/which_command.rb
+++ b/lib/rubygems/commands/which_command.rb
@@ -23,8 +23,19 @@ class Gem::Commands::WhichCommand < Gem::Command
"--no-gems-first --no-all"
end
+ def description # :nodoc:
+ <<-EOF
+The which command is like the shell which command and shows you where
+the file you wish to require lives.
+
+You can use the which command to help determine why you are requiring a
+version you did not expect or to look at the content of a file you are
+requiring to see why it does not behave as you expect.
+ EOF
+ end
+
def execute
- found = false
+ found = true
options[:args].each do |arg|
arg = arg.sub(/#{Regexp.union(*Gem.suffixes)}$/, '')
@@ -34,9 +45,9 @@ class Gem::Commands::WhichCommand < Gem::Command
if spec then
if options[:search_gems_first] then
- dirs = gem_paths(spec) + $LOAD_PATH
+ dirs = spec.full_require_paths + $LOAD_PATH
else
- dirs = $LOAD_PATH + gem_paths(spec)
+ dirs = $LOAD_PATH + spec.full_require_paths
end
end
@@ -45,9 +56,10 @@ class Gem::Commands::WhichCommand < Gem::Command
if paths.empty? then
alert_error "Can't find ruby library file or shared library #{arg}"
+
+ found &&= false
else
say paths
- found = true
end
end
@@ -70,10 +82,6 @@ class Gem::Commands::WhichCommand < Gem::Command
result
end
- def gem_paths(spec)
- spec.require_paths.collect { |d| File.join spec.full_gem_path, d }
- end
-
def usage # :nodoc:
"#{program_name} FILE [FILE ...]"
end
diff --git a/lib/rubygems/commands/yank_command.rb b/lib/rubygems/commands/yank_command.rb
index df4142d395..3c7859e763 100644
--- a/lib/rubygems/commands/yank_command.rb
+++ b/lib/rubygems/commands/yank_command.rb
@@ -9,7 +9,21 @@ class Gem::Commands::YankCommand < Gem::Command
include Gem::GemcutterUtilities
def description # :nodoc:
- 'Remove a specific gem version release from RubyGems.org'
+ <<-EOF
+The yank command removes a gem you pushed to a server from the server's
+index.
+
+Note that if you push a gem to rubygems.org the yank command does not
+prevent other people from downloading the gem via the download link.
+
+Once you have pushed a gem several downloads will happen automatically
+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 permanant removal. Be sure to mention this
+as the reason for the removal request.
+ EOF
end
def arguments # :nodoc:
@@ -21,7 +35,7 @@ class Gem::Commands::YankCommand < Gem::Command
end
def initialize
- super 'yank', description
+ super 'yank', 'Remove a pushed gem from the index'
add_version_option("remove")
add_platform_option("remove")
@@ -30,10 +44,7 @@ class Gem::Commands::YankCommand < Gem::Command
options[:undo] = true
end
- add_option('-k', '--key KEY_NAME',
- 'Use API key from your gem credentials file') do |value, options|
- options[:key] = value
- end
+ add_key_option
end
def execute
@@ -41,14 +52,12 @@ class Gem::Commands::YankCommand < Gem::Command
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
if options[:undo] then
- unyank_gem(version, platform, api_key)
+ unyank_gem(version, platform)
else
- yank_gem(version, platform, api_key)
+ yank_gem(version, platform)
end
else
say "A version argument is required: #{usage}"
@@ -56,19 +65,19 @@ class Gem::Commands::YankCommand < Gem::Command
end
end
- def yank_gem(version, platform, api_key)
+ def yank_gem(version, platform)
say "Yanking gem from #{self.host}..."
- yank_api_request(:delete, version, platform, "api/v1/gems/yank", api_key)
+ yank_api_request(:delete, version, platform, "api/v1/gems/yank")
end
- def unyank_gem(version, platform, api_key)
+ def unyank_gem(version, platform)
say "Unyanking gem from #{host}..."
- yank_api_request(:put, version, platform, "api/v1/gems/unyank", api_key)
+ yank_api_request(:put, version, platform, "api/v1/gems/unyank")
end
private
- def yank_api_request(method, version, platform, api, api_key)
+ def yank_api_request(method, version, platform, api)
name = get_one_gem_name
response = rubygems_api_request(method, api) do |request|
request.add_field("Authorization", api_key)
diff --git a/lib/rubygems/compatibility.rb b/lib/rubygems/compatibility.rb
index 87d5672dd4..d06ade1fa6 100644
--- a/lib/rubygems/compatibility.rb
+++ b/lib/rubygems/compatibility.rb
@@ -33,7 +33,12 @@ end
module Gem
RubyGemsVersion = VERSION
+ # TODO remove at RubyGems 3
+
RbConfigPriorities = %w[
+ MAJOR
+ MINOR
+ TEENY
EXEEXT RUBY_SO_NAME arch bindir datadir libdir ruby_install_name
ruby_version rubylibprefix sitedir sitelibdir vendordir vendorlibdir
rubylibdir
@@ -42,7 +47,7 @@ module Gem
unless defined?(ConfigMap)
##
# Configuration settings from ::RbConfig
- ConfigMap = Hash.new do |cm, key|
+ ConfigMap = Hash.new do |cm, key| # TODO remove at RubyGems 3
cm[key] = RbConfig::CONFIG[key.to_s]
end
else
diff --git a/lib/rubygems/config_file.rb b/lib/rubygems/config_file.rb
index da0b082624..1bdc79ae06 100644
--- a/lib/rubygems/config_file.rb
+++ b/lib/rubygems/config_file.rb
@@ -57,7 +57,7 @@ class Gem::ConfigFile
# :stopdoc:
- system_config_path =
+ SYSTEM_CONFIG_PATH =
begin
require "etc"
Etc.sysconfdir
@@ -86,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.
@@ -137,9 +137,15 @@ 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_reader :ssl_ca_cert
+ attr_accessor :ssl_ca_cert
+
+ ##
+ # Path name of directory or file of openssl client certificate, used for remote https connection with client authentication
+
+ attr_reader :ssl_client_cert
##
# Create the config file object. +args+ is the list of arguments
@@ -211,6 +217,7 @@ class Gem::ConfigFile
@ssl_verify_mode = @hash[:ssl_verify_mode] if @hash.key? :ssl_verify_mode
@ssl_ca_cert = @hash[:ssl_ca_cert] if @hash.key? :ssl_ca_cert
+ @ssl_client_cert = @hash[:ssl_client_cert] if @hash.key? :ssl_client_cert
@api_keys = nil
@rubygems_api_key = nil
@@ -247,6 +254,10 @@ Your gem push credentials file located at:
has file permissions of 0#{existing_permissions.to_s 8} but 0600 is required.
+To fix this error run:
+
+\tchmod 0600 #{credentials_path}
+
You should reset your credentials at:
\thttps://rubygems.org/profile/edit
@@ -310,6 +321,9 @@ 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
@@ -322,8 +336,8 @@ if you believe they were disclosed to a third party.
return {}
end
return content
- rescue ArgumentError
- warn "Failed to load #{filename}"
+ rescue *YAMLErrors => e
+ warn "Failed to load #{filename}, #{e}"
rescue Errno::EACCES
warn "Failed to load #{filename} due to permissions problem."
end
@@ -369,6 +383,8 @@ 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
@@ -414,6 +430,15 @@ 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 f946d0d5d7..edce4ee10b 100644
--- a/lib/rubygems/core_ext/kernel_gem.rb
+++ b/lib/rubygems/core_ext/kernel_gem.rb
@@ -1,3 +1,9 @@
+##
+# 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
+# live on the <code>$LOAD_PATH</code>. See the documentation of these methods
+# for further detail.
+
module Kernel
# REFACTOR: This should be pulled out into some kind of hacks file.
@@ -20,6 +26,11 @@ 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
@@ -45,7 +56,9 @@ module Kernel
end
spec = Gem::Dependency.new(gem_name, *requirements).to_spec
- spec.activate if spec
+ Gem::LOADED_SPECS_MUTEX.synchronize {
+ 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 4cd120b120..bf9618d3bf 100755
--- a/lib/rubygems/core_ext/kernel_require.rb
+++ b/lib/rubygems/core_ext/kernel_require.rb
@@ -50,6 +50,7 @@ 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)
end
@@ -59,11 +60,14 @@ module Kernel
#--
# TODO request access to the C implementation of this to speed up RubyGems
- spec = Gem::Specification.find { |s|
+ spec = Gem::Specification.stubs.find { |s|
s.activated? and s.contains_requirable_file? path
}
- return gem_original_require(path) if spec
+ begin
+ RUBYGEMS_ACTIVATION_MONITOR.exit
+ return gem_original_require(path)
+ end if spec
# Attempt to find +path+ in any unresolved gems...
@@ -95,6 +99,7 @@ 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
@@ -105,22 +110,27 @@ module Kernel
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
- gem_original_require path
+ RUBYGEMS_ACTIVATION_MONITOR.exit
+ return gem_original_require(path)
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
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 cc8dc722fc..55ca080c96 100644
--- a/lib/rubygems/defaults.rb
+++ b/lib/rubygems/defaults.rb
@@ -15,28 +15,36 @@ module Gem
end
##
+ # Default spec directory path to be used if an alternate value is not
+ # specified in the environment
+
+ def self.default_spec_cache_dir
+ File.join Gem.user_home, '.gem', 'specs'
+ end
+
+ ##
# Default home directory path to be used if an alternate value is not
# specified in the environment
def self.default_dir
path = if defined? RUBY_FRAMEWORK_VERSION then
[
- File.dirname(ConfigMap[:sitedir]),
+ File.dirname(RbConfig::CONFIG['sitedir']),
'Gems',
- ConfigMap[:ruby_version]
+ RbConfig::CONFIG['ruby_version']
]
- elsif ConfigMap[:rubylibprefix] then
+ elsif RbConfig::CONFIG['rubylibprefix'] then
[
- ConfigMap[:rubylibprefix],
+ RbConfig::CONFIG['rubylibprefix'],
'gems',
- ConfigMap[:ruby_version]
+ RbConfig::CONFIG['ruby_version']
]
else
[
- ConfigMap[:libdir],
+ RbConfig::CONFIG['libdir'],
ruby_engine,
'gems',
- ConfigMap[:ruby_version]
+ RbConfig::CONFIG['ruby_version']
]
end
@@ -44,6 +52,17 @@ 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
@@ -55,7 +74,7 @@ module Gem
def self.user_dir
parts = [Gem.user_home, '.gem', ruby_engine]
- parts << ConfigMap[:ruby_version] unless ConfigMap[:ruby_version].empty?
+ parts << RbConfig::CONFIG['ruby_version'] unless RbConfig::CONFIG['ruby_version'].empty?
File.join parts
end
@@ -70,18 +89,18 @@ module Gem
# Default gem load path
def self.default_path
- if Gem.user_home && File.exist?(Gem.user_home) then
- [user_dir, default_dir]
- else
- [default_dir]
- end
+ 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
end
##
# Deduce Ruby's --program-prefix and --program-suffix from its install name
def self.default_exec_format
- exec_format = ConfigMap[:ruby_install_name].sub('ruby', '%s') rescue '%s'
+ exec_format = RbConfig::CONFIG['ruby_install_name'].sub('ruby', '%s') rescue '%s'
unless exec_format =~ /%s/ then
raise Gem::Exception,
@@ -98,7 +117,7 @@ module Gem
if defined? RUBY_FRAMEWORK_VERSION then # mac framework support
'/usr/bin'
else # generic install
- ConfigMap[:bindir]
+ RbConfig::CONFIG['bindir']
end
end
@@ -126,4 +145,33 @@ module Gem
def self.default_cert_path
File.join Gem.user_home, ".gem", "gem-public_cert.pem"
end
+
+ ##
+ # Whether to expect full paths in default gems - true for non-MRI
+ # ruby implementations
+ 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 1e3cc168a8..b72a540dc8 100644
--- a/lib/rubygems/dependency.rb
+++ b/lib/rubygems/dependency.rb
@@ -74,7 +74,7 @@ class Gem::Dependency
end
def inspect # :nodoc:
- if @prerelease
+ if prerelease? then
"<%s type=%p name=%p requirements=%p prerelease=ok>" %
[self.class, self.type, self.name, requirement.to_s]
else
@@ -145,7 +145,6 @@ 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
@@ -203,9 +202,21 @@ class Gem::Dependency
requirement.satisfied_by? version
end
- # DOC: this method needs either documented or :nodoc'd
+ alias === =~
- def match? obj, version=nil
+ ##
+ # :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.
+
+ def match? obj, version=nil, allow_prerelease=false
if !version
name = obj.name
version = obj.version
@@ -214,12 +225,23 @@ class Gem::Dependency
end
return false unless self.name === name
- return true if requirement.none?
- requirement.satisfied_by? Gem::Version.new(version)
+ 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
end
- # DOC: this method needs either documented or :nodoc'd
+ ##
+ # 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.
def matches_spec? spec
return false unless name === spec.name
@@ -247,13 +269,11 @@ 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.find_all { |spec|
+ 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|
@@ -271,8 +291,6 @@ class Gem::Dependency
@requirement.specific?
end
- # DOC: this method needs either documented or :nodoc'd
-
def to_specs
matches = matching_specs true
@@ -285,12 +303,13 @@ class Gem::Dependency
if specs.empty?
total = Gem::Specification.to_a.size
- error = Gem::LoadError.new \
- "Could not find '#{name}' (#{requirement}) among #{total} total gem(s)"
+ msg = "Could not find '#{name}' (#{requirement}) among #{total} total gem(s)\n"
else
- error = Gem::LoadError.new \
- "Could not find '#{name}' (#{requirement}) - did find: [#{specs.join ','}]"
+ msg = "Could not find '#{name}' (#{requirement}) - did find: [#{specs.join ','}]\n"
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
@@ -301,11 +320,15 @@ class Gem::Dependency
matches
end
- # DOC: this method needs either documented or :nodoc'd
-
def to_spec
matches = self.to_specs
- matches.find { |spec| spec.activated? } or matches.last
+ active = matches.find { |spec| spec.activated? }
+
+ return active if active
+
+ matches.delete_if { |spec| spec.version.prerelease? } unless prerelease?
+
+ matches.last
end
end
diff --git a/lib/rubygems/dependency_installer.rb b/lib/rubygems/dependency_installer.rb
index ee361db94b..039d046da2 100644
--- a/lib/rubygems/dependency_installer.rb
+++ b/lib/rubygems/dependency_installer.rb
@@ -4,8 +4,7 @@ require 'rubygems/package'
require 'rubygems/installer'
require 'rubygems/spec_fetcher'
require 'rubygems/user_interaction'
-require 'rubygems/source_local'
-require 'rubygems/source_specific_file'
+require 'rubygems/source'
require 'rubygems/available_set'
##
@@ -15,15 +14,7 @@ class Gem::DependencyInstaller
include Gem::UserInteraction
- attr_reader :gems_to_install
- attr_reader :installed_gems
-
- ##
- # Documentation types. For use by the Gem.done_installing hook
-
- attr_reader :document
-
- DEFAULT_OPTIONS = {
+ DEFAULT_OPTIONS = { # :nodoc:
:env_shebang => false,
:document => %w[ri],
:domain => :both, # HACK dup
@@ -35,9 +26,31 @@ class Gem::DependencyInstaller
:wrappers => true,
:build_args => nil,
:build_docs_in_background => false,
+ :install_as_default => false
}.freeze
##
+ # Documentation types. For use by the Gem.done_installing hook
+
+ attr_reader :document
+
+ ##
+ # Errors from SpecFetcher while searching for remote specifications
+
+ attr_reader :errors
+
+ ##
+ #--
+ # TODO remove, no longer used
+
+ attr_reader :gems_to_install # :nodoc:
+
+ ##
+ # List of gems installed by #install in alphabetic order
+
+ attr_reader :installed_gems
+
+ ##
# Creates a new installer instance.
#
# Options are:
@@ -56,14 +69,10 @@ class Gem::DependencyInstaller
# :wrappers:: See Gem::Installer::new
# :build_args:: See Gem::Installer::new
- def initialize(options = {})
+ def initialize options = {}
+ @only_install_dir = !!options[:install_dir]
@install_dir = options[:install_dir] || Gem.dir
-
- if options[:install_dir] then
- # HACK shouldn't change the global settings, needed for -i behavior
- # maybe move to the install command? See also github #442
- Gem::Specification.dirs = @install_dir
- end
+ @build_root = options[:build_root]
options = DEFAULT_OPTIONS.merge options
@@ -82,6 +91,7 @@ class Gem::DependencyInstaller
@wrappers = options[:wrappers]
@build_args = options[:build_args]
@build_docs_in_background = options[:build_docs_in_background]
+ @install_as_default = options[:install_as_default]
# Indicates that we should not try to update any deps unless
# we absolutely must.
@@ -93,12 +103,61 @@ class Gem::DependencyInstaller
@cache_dir = options[:cache_dir] || @install_dir
- # Set with any errors that SpecFetcher finds while search through
- # gemspecs for a dep
- @errors = nil
+ @errors = []
end
- attr_reader :errors
+ ##
+ #--
+ # TODO remove, no longer used
+
+ def add_found_dependencies to_do, dependency_list # :nodoc:
+ seen = {}
+ dependencies = Hash.new { |h, name| h[name] = Gem::Dependency.new name }
+
+ until to_do.empty? do
+ spec = to_do.shift
+
+ # HACK why is spec nil?
+ next if spec.nil? or seen[spec.name]
+ seen[spec.name] = true
+
+ deps = spec.runtime_dependencies
+
+ if @development
+ if @dev_shallow
+ if @toplevel_specs.include? spec.full_name
+ deps |= spec.development_dependencies
+ end
+ else
+ deps |= spec.development_dependencies
+ end
+ end
+
+ deps.each do |dep|
+ dependencies[dep.name] = dependencies[dep.name].merge dep
+
+ if @minimal_deps
+ next if Gem::Specification.any? do |installed_spec|
+ dep.name == installed_spec.name and
+ dep.requirement.satisfied_by? installed_spec.version
+ end
+ end
+
+ results = find_gems_with_sources(dep)
+
+ results.sorted.each do |t|
+ to_do.push t.spec
+ end
+
+ results.remove_installed! dep
+
+ @available << results
+ results.inject_into_list dependency_list
+ end
+ end
+
+ dependency_list.remove_specs_unsatisfied_by dependencies
+ end
##
# Creates an AvailableSet to install from based on +dep_or_name+ and
@@ -138,7 +197,7 @@ class Gem::DependencyInstaller
# sources. Gems are sorted with newer gems preferred over older gems, and
# local gems preferred over remote gems.
- def find_gems_with_sources(dep)
+ def find_gems_with_sources dep, best_only=false # :nodoc:
set = Gem::AvailableSet.new
if consider_local?
@@ -153,7 +212,26 @@ class Gem::DependencyInstaller
if consider_remote?
begin
- found, errors = Gem::SpecFetcher.fetcher.spec_for_dependency dep
+ # TODO this is pulled from #spec_for_dependency to allow
+ # us to filter tuples before fetching specs.
+ #
+ tuples, errors = Gem::SpecFetcher.fetcher.search_for_dependency dep
+
+ if best_only && !tuples.empty?
+ tuples.sort! { |a,b| b[0].version <=> a[0].version }
+ tuples = [tuples.first]
+ end
+
+ specs = []
+ tuples.each do |tup, source|
+ begin
+ spec = source.fetch_spec(tup)
+ rescue Gem::RemoteFetcher::FetchError => e
+ errors << Gem::SourceFetchProblem.new(source, e)
+ else
+ specs << [spec, source]
+ end
+ end
if @errors
@errors += errors
@@ -161,15 +239,15 @@ class Gem::DependencyInstaller
@errors = errors
end
- set << found
+ set << specs
rescue Gem::RemoteFetcher::FetchError => e
# 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.
- if Gem.configuration.really_verbose then
- say "Error fetching remote data:\t\t#{e.message}"
- say "Falling back to local-only install"
+ verbose do
+ "Error fetching remote data:\t\t#{e.message}\n" \
+ "Falling back to local-only install"
end
@domain = :local
end
@@ -179,99 +257,13 @@ class Gem::DependencyInstaller
end
##
- # Gathers all dependencies necessary for the installation from local and
- # remote sources unless the ignore_dependencies was given.
-
- def gather_dependencies
- specs = @available.all_specs
-
- # these gems were listed by the user, always install them
- keep_names = specs.map { |spec| spec.full_name }
-
- if @dev_shallow
- @toplevel_specs = keep_names
- end
-
- dependency_list = Gem::DependencyList.new @development
- dependency_list.add(*specs)
- to_do = specs.dup
- add_found_dependencies to_do, dependency_list unless @ignore_dependencies
-
- # REFACTOR maybe abstract away using Gem::Specification.include? so
- # that this isn't dependent only on the currently installed gems
- dependency_list.specs.reject! { |spec|
- not keep_names.include?(spec.full_name) and
- Gem::Specification.include?(spec)
- }
-
- unless dependency_list.ok? or @ignore_dependencies or @force then
- reason = dependency_list.why_not_ok?.map { |k,v|
- "#{k} requires #{v.join(", ")}"
- }.join("; ")
- raise Gem::DependencyError, "Unable to resolve dependencies: #{reason}"
- end
-
- @gems_to_install = dependency_list.dependency_order.reverse
- end
-
- def add_found_dependencies to_do, dependency_list
- seen = {}
- dependencies = Hash.new { |h, name| h[name] = Gem::Dependency.new name }
-
- until to_do.empty? do
- spec = to_do.shift
-
- # HACK why is spec nil?
- next if spec.nil? or seen[spec.name]
- seen[spec.name] = true
-
- deps = spec.runtime_dependencies
-
- if @development
- if @dev_shallow
- if @toplevel_specs.include? spec.full_name
- deps |= spec.development_dependencies
- end
- else
- deps |= spec.development_dependencies
- end
- end
-
- deps.each do |dep|
- dependencies[dep.name] = dependencies[dep.name].merge dep
-
- if @minimal_deps
- next if Gem::Specification.any? do |installed_spec|
- dep.name == installed_spec.name and
- dep.requirement.satisfied_by? installed_spec.version
- end
- end
-
- results = find_gems_with_sources(dep)
-
- results.sorted.each do |t|
- to_do.push t.spec
- end
-
- results.remove_installed! dep
-
- @available << results
- results.inject_into_list dependency_list
- end
- end
-
- dependency_list.remove_specs_unsatisfied_by dependencies
- end
-
- ##
# Finds a spec and the source_uri it came from for gem +gem_name+ and
# +version+. Returns an Array of specs and sources required for
# installation of the gem.
- def find_spec_by_name_and_version(gem_name,
+ def find_spec_by_name_and_version gem_name,
version = Gem::Requirement.default,
- prerelease = false)
-
+ prerelease = false
set = Gem::AvailableSet.new
if consider_local?
@@ -297,10 +289,9 @@ class Gem::DependencyInstaller
if set.empty?
dep = Gem::Dependency.new gem_name, version
- # HACK Dependency objects should be immutable
dep.prerelease = true if prerelease
- set = find_gems_with_sources(dep)
+ set = find_gems_with_sources(dep, true)
set.match_platform!
end
@@ -312,6 +303,59 @@ class Gem::DependencyInstaller
end
##
+ # Gathers all dependencies necessary for the installation from local and
+ # remote sources unless the ignore_dependencies was given.
+ #--
+ # TODO remove at RubyGems 3
+
+ def gather_dependencies # :nodoc:
+ specs = @available.all_specs
+
+ # these gems were listed by the user, always install them
+ keep_names = specs.map { |spec| spec.full_name }
+
+ if @dev_shallow
+ @toplevel_specs = keep_names
+ end
+
+ dependency_list = Gem::DependencyList.new @development
+ dependency_list.add(*specs)
+ to_do = specs.dup
+ add_found_dependencies to_do, dependency_list unless @ignore_dependencies
+
+ # REFACTOR maybe abstract away using Gem::Specification.include? so
+ # that this isn't dependent only on the currently installed gems
+ dependency_list.specs.reject! { |spec|
+ not keep_names.include?(spec.full_name) and
+ Gem::Specification.include?(spec)
+ }
+
+ unless dependency_list.ok? or @ignore_dependencies or @force then
+ reason = dependency_list.why_not_ok?.map { |k,v|
+ "#{k} requires #{v.join(", ")}"
+ }.join("; ")
+ raise Gem::DependencyError, "Unable to resolve dependencies: #{reason}"
+ end
+
+ @gems_to_install = dependency_list.dependency_order.reverse
+ end
+
+ def in_background what # :nodoc:
+ fork_happened = false
+ if @build_docs_in_background and Process.respond_to?(:fork)
+ begin
+ Process.fork do
+ yield
+ end
+ fork_happened = true
+ say "#{what} in a background process."
+ rescue NotImplementedError
+ end
+ end
+ yield unless fork_happened
+ end
+
+ ##
# Installs the gem +dep_or_name+ and all its dependencies. Returns an Array
# of installed gem specifications.
#
@@ -326,61 +370,33 @@ class Gem::DependencyInstaller
# separately.
def install dep_or_name, version = Gem::Requirement.default
- available_set_for dep_or_name, version
+ request_set = resolve_dependencies dep_or_name, version
@installed_gems = []
- gather_dependencies
-
- # REFACTOR is the last gem always the one that the user requested?
- # This code assumes that but is that actually validated by the code?
-
- last = @gems_to_install.size - 1
- @gems_to_install.each_with_index do |spec, index|
- # REFACTOR more current spec set hardcoding, should be abstracted?
- next if Gem::Specification.include?(spec) and index != last
-
- # TODO: make this sorta_verbose so other users can benefit from it
- say "Installing gem #{spec.full_name}" if Gem.configuration.really_verbose
-
- source = @available.source_for spec
-
- begin
- # REFACTOR make the fetcher to use configurable
- local_gem_path = source.download spec, @cache_dir
- rescue Gem::RemoteFetcher::FetchError
- # TODO I doubt all fetch errors are recoverable, we should at least
- # report the errors probably.
- next if @force
- raise
- end
-
- if @development
- if @dev_shallow
- is_dev = @toplevel_specs.include? spec.full_name
- else
- is_dev = true
- end
- end
+ 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
- inst = Gem::Installer.new local_gem_path,
- :bin_dir => @bin_dir,
- :development => is_dev,
- :env_shebang => @env_shebang,
- :force => @force,
- :format_executable => @format_executable,
- :ignore_dependencies => @ignore_dependencies,
- :install_dir => @install_dir,
- :security_policy => @security_policy,
- :user_install => @user_install,
- :wrappers => @wrappers,
- :build_args => @build_args
-
- spec = inst.install
-
- @installed_gems << spec
+ request_set.install options do |_, installer|
+ @installed_gems << installer.spec if installer
end
+ @installed_gems.sort!
+
# Since this is currently only called for docs, we can be lazy and just say
# it's documentation. Ideally the hook adder could decide whether to be in
# the background or not, and what to call it.
@@ -393,18 +409,72 @@ class Gem::DependencyInstaller
@installed_gems
end
- def in_background what
- fork_happened = false
- if @build_docs_in_background and Process.respond_to?(:fork)
- begin
- Process.fork do
- yield
+ def install_development_deps # :nodoc:
+ if @development and @dev_shallow then
+ :shallow
+ elsif @development then
+ :all
+ else
+ :none
+ end
+ end
+
+ def resolve_dependencies dep_or_name, version # :nodoc:
+ request_set = Gem::RequestSet.new
+ request_set.development = @development
+ request_set.development_shallow = @dev_shallow
+ 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.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
- fork_happened = true
- say "#{what} in a background process."
- rescue NotImplementedError
+ # else This is a dependency. InstallerSet handles this case
end
end
- yield unless fork_happened
+
+ 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
+ end
+
+ request_set.resolve installer_set
+
+ @errors.concat request_set.errors
+
+ request_set
end
+
end
diff --git a/lib/rubygems/dependency_resolver.rb b/lib/rubygems/dependency_resolver.rb
deleted file mode 100644
index 66f55eb9ad..0000000000
--- a/lib/rubygems/dependency_resolver.rb
+++ /dev/null
@@ -1,575 +0,0 @@
-require 'rubygems'
-require 'rubygems/dependency'
-require 'rubygems/exceptions'
-
-require 'uri'
-require 'net/http'
-
-module Gem
-
- # Raised when a DependencyConflict reaches the toplevel.
- # Indicates which dependencies were incompatible.
- #
- class DependencyResolutionError < Gem::Exception
- def initialize(conflict)
- @conflict = conflict
- a, b = conflicting_dependencies
-
- super "unable to resolve conflicting dependencies '#{a}' and '#{b}'"
- end
-
- attr_reader :conflict
-
- def conflicting_dependencies
- @conflict.conflicting_dependencies
- end
- end
-
- # Raised when a dependency requests a gem for which there is
- # no spec.
- #
- class UnsatisfiableDepedencyError < Gem::Exception
- def initialize(dep)
- super "unable to find any gem matching dependency '#{dep}'"
-
- @dependency = dep
- end
-
- attr_reader :dependency
- end
-
- # Raised when dependencies conflict and create the inability to
- # find a valid possible spec for a request.
- #
- class ImpossibleDependenciesError < Gem::Exception
- def initialize(request, conflicts)
- s = conflicts.size == 1 ? "" : "s"
- super "detected #{conflicts.size} conflict#{s} with dependency '#{request.dependency}'"
- @request = request
- @conflicts = conflicts
- end
-
- def dependency
- @request.dependency
- end
-
- attr_reader :conflicts
- end
-
- # Given a set of Gem::Dependency objects as +needed+ and a way
- # to query the set of available specs via +set+, calculates
- # a set of ActivationRequest objects which indicate all the specs
- # that should be activated to meet the all the requirements.
- #
- class DependencyResolver
-
- # Represents a specification retrieved via the rubygems.org
- # API. This is used to avoid having to load the full
- # Specification object when all we need is the name, version,
- # and dependencies.
- #
- class APISpecification
- attr_reader :set # :nodoc:
-
- def initialize(set, api_data)
- @set = set
- @name = api_data[:name]
- @version = Gem::Version.new api_data[:number]
- @dependencies = api_data[:dependencies].map do |name, ver|
- Gem::Dependency.new name, ver.split(/\s*,\s*/)
- end
- end
-
- attr_reader :name, :version, :dependencies
-
- def == other # :nodoc:
- self.class === other and
- @set == other.set and
- @name == other.name and
- @version == other.version and
- @dependencies == other.dependencies
- end
-
- def full_name
- "#{@name}-#{@version}"
- end
- end
-
- # The global rubygems pool, available via the rubygems.org API.
- # Returns instances of APISpecification.
- #
- class APISet
- def initialize
- @data = Hash.new { |h,k| h[k] = [] }
- @dep_uri = URI 'https://rubygems.org/api/v1/dependencies'
- end
-
- # Return data for all versions of the gem +name+.
- #
- def versions(name)
- if @data.key?(name)
- return @data[name]
- end
-
- uri = @dep_uri + "?gems=#{name}"
- str = Gem::RemoteFetcher.fetcher.fetch_path uri
-
- Marshal.load(str).each do |ver|
- @data[ver[:name]] << ver
- end
-
- @data[name]
- end
-
- # Return an array of APISpecification objects matching
- # DependencyRequest +req+.
- #
- def find_all(req)
- res = []
-
- versions(req.name).each do |ver|
- if req.dependency.match? req.name, ver[:number]
- res << APISpecification.new(self, ver)
- end
- end
-
- res
- end
-
- # A hint run by the resolver to allow the Set to fetch
- # data for DependencyRequests +reqs+.
- #
- def prefetch(reqs)
- names = reqs.map { |r| r.dependency.name }
- needed = names.find_all { |d| !@data.key?(d) }
-
- return if needed.empty?
-
- uri = @dep_uri + "?gems=#{needed.sort.join ','}"
- str = Gem::RemoteFetcher.fetcher.fetch_path uri
-
- Marshal.load(str).each do |ver|
- @data[ver[:name]] << ver
- end
- end
- end
-
- # Represents a possible Specification object returned
- # from IndexSet. Used to delay needed to download full
- # Specification objects when only the +name+ and +version+
- # are needed.
- #
- class IndexSpecification
- def initialize(set, name, version, source, plat)
- @set = set
- @name = name
- @version = version
- @source = source
- @platform = plat
-
- @spec = nil
- end
-
- attr_reader :name, :version, :source
-
- def full_name
- "#{@name}-#{@version}"
- end
-
- def spec
- @spec ||= @set.load_spec(@name, @version, @source)
- end
-
- def dependencies
- spec.dependencies
- end
- end
-
- # The global rubygems pool represented via the traditional
- # source index.
- #
- class IndexSet
- def initialize
- @f = Gem::SpecFetcher.fetcher
-
- @all = Hash.new { |h,k| h[k] = [] }
-
- list, _ = @f.available_specs(:released)
- list.each do |uri, specs|
- specs.each do |n|
- @all[n.name] << [uri, n]
- end
- end
-
- @specs = {}
- end
-
- # Return an array of IndexSpecification objects matching
- # DependencyRequest +req+.
- #
- def find_all(req)
- res = []
-
- name = req.dependency.name
-
- @all[name].each do |uri, n|
- if req.dependency.match? n
- res << IndexSpecification.new(self, n.name, n.version,
- uri, n.platform)
- end
- end
-
- res
- end
-
- # No prefetching needed since we load the whole index in
- # initially.
- #
- def prefetch(gems)
- end
-
- # Called from IndexSpecification to get a true Specification
- # object.
- #
- def load_spec(name, ver, source)
- key = "#{name}-#{ver}"
- @specs[key] ||= source.fetch_spec(Gem::NameTuple.new(name, ver))
- end
- end
-
- # A set which represents the installed gems. Respects
- # all the normal settings that control where to look
- # for installed gems.
- #
- class CurrentSet
- def find_all(req)
- req.dependency.matching_specs
- end
-
- def prefetch(gems)
- end
- end
-
- # Create DependencyResolver object which will resolve
- # the tree starting with +needed+ Depedency objects.
- #
- # +set+ is an object that provides where to look for
- # specifications to satisify the Dependencies. This
- # defaults to IndexSet, which will query rubygems.org.
- #
- def initialize(needed, set=IndexSet.new)
- @set = set || IndexSet.new # Allow nil to mean IndexSet
- @needed = needed
-
- @conflicts = nil
- end
-
- # Provide a DependencyResolver that queries only against
- # the already installed gems.
- #
- def self.for_current_gems(needed)
- new needed, CurrentSet.new
- end
-
- # Contains all the conflicts encountered while doing resolution
- #
- attr_reader :conflicts
-
- # Proceed with resolution! Returns an array of ActivationRequest
- # objects.
- #
- def resolve
- @conflicts = []
-
- needed = @needed.map { |n| DependencyRequest.new(n, nil) }
-
- res = resolve_for needed, []
-
- if res.kind_of? DependencyConflict
- raise DependencyResolutionError.new(res)
- end
-
- res
- end
-
- # Used internally to indicate that a dependency conflicted
- # with a spec that would be activated.
- #
- class DependencyConflict
- def initialize(dependency, activated, failed_dep=dependency)
- @dependency = dependency
- @activated = activated
- @failed_dep = failed_dep
- end
-
- attr_reader :dependency, :activated
-
- # Return the Specification that listed the dependency
- #
- def requester
- @failed_dep.requester
- end
-
- def for_spec?(spec)
- @dependency.name == spec.name
- end
-
- # Return the 2 dependency objects that conflicted
- #
- def conflicting_dependencies
- [@failed_dep.dependency, @activated.request.dependency]
- end
- end
-
- # Used Internally. Wraps a Depedency object to also track
- # which spec contained the Dependency.
- #
- class DependencyRequest
- def initialize(dep, act)
- @dependency = dep
- @requester = act
- end
-
- attr_reader :dependency, :requester
-
- def name
- @dependency.name
- end
-
- def matches_spec?(spec)
- @dependency.matches_spec? spec
- end
-
- def to_s
- @dependency.to_s
- end
-
- def ==(other)
- case other
- when Dependency
- @dependency == other
- when DependencyRequest
- @dependency == other.dependency && @requester == other.requester
- else
- false
- end
- end
- end
-
- # Specifies a Specification object that should be activated.
- # Also contains a dependency that was used to introduce this
- # activation.
- #
- class ActivationRequest
- def initialize(spec, req, others_possible=true)
- @spec = spec
- @request = req
- @others_possible = others_possible
- end
-
- attr_reader :spec, :request
-
- # Indicate if this activation is one of a set of possible
- # requests for the same Dependency request.
- #
- def others_possible?
- @others_possible
- end
-
- # Return the ActivationRequest that contained the dependency
- # that we were activated for.
- #
- def parent
- @request.requester
- end
-
- def name
- @spec.name
- end
-
- def full_name
- @spec.full_name
- end
-
- def version
- @spec.version
- end
-
- def full_spec
- Gem::Specification === @spec ? @spec : @spec.spec
- end
-
- def download(path)
- if @spec.respond_to? :source
- source = @spec.source
- else
- source = Gem.sources.first
- end
-
- Gem.ensure_gem_subdirectories path
-
- source.download full_spec, path
- end
-
- def ==(other)
- case other
- when Gem::Specification
- @spec == other
- when ActivationRequest
- @spec == other.spec && @request == other.request
- else
- false
- end
- end
-
- ##
- # Indicates if the requested gem has already been installed.
-
- def installed?
- this_spec = full_spec
-
- Gem::Specification.any? do |s|
- s == this_spec
- end
- end
- end
-
- def requests(s, act)
- reqs = []
- s.dependencies.each do |d|
- next unless d.type == :runtime
- reqs << DependencyRequest.new(d, act)
- end
-
- @set.prefetch(reqs)
-
- reqs
- end
-
- # 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)
- until needed.empty?
- dep = needed.shift
-
- # If there is already a spec activated for the requested name...
- if 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
-
- # 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 dep for the activation itself. Otherwise, issue
- # it on the requester's request itself.
- #
- if existing.others_possible?
- conflict = DependencyConflict.new(dep, existing)
- else
- depreq = existing.request.requester.request
- conflict = DependencyConflict.new(depreq, existing, dep)
- end
- @conflicts << conflict
-
- return conflict
- end
-
- # Get a list of all specs that satisfy dep
- possible = @set.find_all(dep)
-
- case possible.size
- when 0
- # If there are none, then our work here is done.
- raise UnsatisfiableDepedencyError.new(dep)
- when 1
- # If there is one, then we just add it to specs
- # and process the specs dependencies by adding
- # them to needed.
-
- spec = possible.first
- act = ActivationRequest.new(spec, dep, false)
-
- 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
- else
- # There are multiple specs for this dep. This is
- # the case that this class is built to handle.
-
- # Sort them so that we try the highest versions
- # first.
- possible = possible.sort_by { |s| s.version }
-
- # We track the conflicts seen so that we can report them
- # to help the user figure out how to fix the situation.
- conflicts = []
-
- # To figure out which to pick, we keep resolving
- # given each one being activated and if there isn't
- # a conflict, we know we've found a full set.
- #
- # We use an until loop rather than #reverse_each
- # to keep the stack short since we're using a recursive
- # algorithm.
- #
- until possible.empty?
- s = possible.pop
-
- # Recursively call #resolve_for with this spec
- # and add it's dependencies into the picture...
-
- act = ActivationRequest.new(s, dep)
-
- try = requests(s, act) + needed
-
- res = resolve_for(try, specs + [act])
-
- # While trying to resolve these dependencies, there may
- # be a conflict!
-
- if res.kind_of? DependencyConflict
- # The conflict might be created not by this invocation
- # but rather one up the stack, so if we can't attempt
- # to resolve this conflict (conflict isn't with the spec +s+)
- # then just return it so the caller can try to sort it out.
- return res unless res.for_spec? s
-
- # Otherwise, this is a conflict that we can attempt to fix
- conflicts << [s, res]
-
- # Optimization:
- #
- # Because the conflict indicates the dependency that trigger
- # it, we can prune possible based on this new information.
- #
- # This cuts down on the number of iterations needed.
- possible.delete_if { |x| !res.dependency.matches_spec? x }
- else
- # No conflict, return the specs
- return res
- end
- end
-
- # We tried all possibles and nothing worked, so we let the user
- # know and include as much information about the problem since
- # the user is going to have to take action to fix this.
- raise ImpossibleDependenciesError.new(dep, conflicts)
- end
- end
-
- specs
- end
- end
-end
diff --git a/lib/rubygems/deprecate.rb b/lib/rubygems/deprecate.rb
index 274d6a5c12..e19360da13 100644
--- a/lib/rubygems/deprecate.rb
+++ b/lib/rubygems/deprecate.rb
@@ -50,7 +50,7 @@ module Gem::Deprecate
class_eval {
old = "_deprecated_#{name}"
alias_method old, name
- define_method name do |*args, &block| # TODO: really works on 1.8.7?
+ define_method name do |*args, &block|
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 4fb399e24c..3c71fd5aa4 100644
--- a/lib/rubygems/doctor.rb
+++ b/lib/rubygems/doctor.rb
@@ -1,6 +1,5 @@
require 'rubygems'
require 'rubygems/user_interaction'
-require 'pathname'
##
# Cleans up after a partially-failed uninstall or for an invalid
@@ -24,13 +23,17 @@ class Gem::Doctor
['build_info', '.info'],
['cache', '.gem'],
['doc', ''],
+ ['extensions', ''],
['gems', ''],
]
- raise 'Update REPOSITORY_EXTENSION_MAP' unless
- Gem::REPOSITORY_SUBDIRECTORIES.sort ==
+ missing =
+ Gem::REPOSITORY_SUBDIRECTORIES.sort -
REPOSITORY_EXTENSION_MAP.map { |(k,_)| k }.sort
+ raise "Update REPOSITORY_EXTENSION_MAP, missing: #{missing.join ', '}" unless
+ missing.empty?
+
##
# Creates a new Gem::Doctor that will clean up +gem_repository+. Only one
# gem repository may be cleaned at a time.
@@ -38,7 +41,7 @@ class Gem::Doctor
# If +dry_run+ is true no files or directories will be removed.
def initialize gem_repository, dry_run = false
- @gem_repository = Pathname(gem_repository)
+ @gem_repository = gem_repository
@dry_run = dry_run
@installed_specs = nil
@@ -96,26 +99,29 @@ class Gem::Doctor
# Removes files in +sub_directory+ with +extension+
def doctor_child sub_directory, extension # :nodoc:
- directory = @gem_repository + sub_directory
+ directory = File.join(@gem_repository, sub_directory)
+
+ Dir.entries(directory).sort.each do |ent|
+ next if ent == "." || ent == ".."
- directory.children.sort.each do |child|
- next unless child.exist?
+ child = File.join(directory, ent)
+ next unless File.exist?(child)
- basename = child.basename(extension).to_s
+ basename = File.basename(child, extension)
next if installed_specs.include? basename
next if /^rubygems-\d/ =~ basename
next if 'specifications' == sub_directory and 'default' == basename
- type = child.directory? ? 'directory' : 'file'
+ type = File.directory?(child) ? 'directory' : 'file'
action = if @dry_run then
'Extra'
else
- child.rmtree
+ FileUtils.rm_r(child)
'Removed'
end
- say "#{action} #{type} #{sub_directory}/#{child.basename}"
+ say "#{action} #{type} #{sub_directory}/#{File.basename(child)}"
end
rescue Errno::ENOENT
# ignore
diff --git a/lib/rubygems/errors.rb b/lib/rubygems/errors.rb
index e296ef3127..9defb9ee9b 100644
--- a/lib/rubygems/errors.rb
+++ b/lib/rubygems/errors.rb
@@ -19,8 +19,36 @@ module Gem
attr_accessor :requirement
end
- # FIX: does this need to exist? The subclass is the only other reference
- # I can find.
+ # 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
@@ -75,15 +103,35 @@ module Gem
# data from a source
class SourceFetchProblem < ErrorReason
+
+ ##
+ # Creates a new SourceFetchProblem for the given +source+ and +error+.
+
def initialize(source, error)
@source = source
@error = error
end
- attr_reader :source, :error
+ ##
+ # The source that had the fetch problem.
+
+ attr_reader :source
+
+ ##
+ # The fetch error which is an Exception subclass.
+
+ attr_reader :error
+
+ ##
+ # An English description of the error.
def wordy
"Unable to download data from #{@source.uri} - #{@error.message}"
end
+
+ ##
+ # The "exception" alias allows you to call raise on a SourceFetchProblem.
+
+ alias exception error
end
end
diff --git a/lib/rubygems/exceptions.rb b/lib/rubygems/exceptions.rb
index ff389b320b..2a9875cd24 100644
--- a/lib/rubygems/exceptions.rb
+++ b/lib/rubygems/exceptions.rb
@@ -7,7 +7,13 @@
# Base exception class for RubyGems. All exception raised by RubyGems are a
# subclass of this one.
class Gem::Exception < RuntimeError
- attr_accessor :source_exception
+
+ ##
+ #--
+ # TODO: remove in RubyGems 3, nobody sets this
+
+ attr_accessor :source_exception # :nodoc:
+
end
class Gem::CommandLineError < Gem::Exception; end
@@ -17,6 +23,28 @@ class Gem::DependencyError < Gem::Exception; end
class Gem::DependencyRemovalException < Gem::Exception; end
##
+# Raised by Gem::Resolver when a Gem::Dependency::Conflict reaches the
+# toplevel. Indicates which dependencies were incompatible through #conflict
+# and #conflicting_dependencies
+
+class Gem::DependencyResolutionError < Gem::DependencyError
+
+ attr_reader :conflict
+
+ def initialize conflict
+ @conflict = conflict
+ a, b = conflicting_dependencies
+
+ super "conflicting dependencies #{a} and #{b}\n#{@conflict.explanation}"
+ end
+
+ def conflicting_dependencies
+ @conflict.conflicting_dependencies
+ end
+
+end
+
+##
# Raised when attempting to uninstall a gem that isn't in GEM_HOME.
class Gem::GemNotInHomeException < Gem::Exception
@@ -53,7 +81,16 @@ end
class Gem::GemNotFoundException < Gem::Exception; end
+##
+# Raised by the DependencyInstaller when a specific gem cannot be found
+
class Gem::SpecificGemNotFoundException < Gem::GemNotFoundException
+
+ ##
+ # Creates a new SpecificGemNotFoundException for a gem with the given +name+
+ # and +version+. Any +errors+ encountered when attempting to find the gem
+ # are also stored.
+
def initialize(name, version, errors=nil)
super "Could not find a valid gem '#{name}' (#{version}) locally or in a repository"
@@ -62,7 +99,57 @@ class Gem::SpecificGemNotFoundException < Gem::GemNotFoundException
@errors = errors
end
- attr_reader :name, :version, :errors
+ ##
+ # The name of the gem that could not be found.
+
+ attr_reader :name
+
+ ##
+ # The version of the gem that could not be found.
+
+ attr_reader :version
+
+ ##
+ # Errors encountered attempting to find the gem.
+
+ attr_reader :errors
+
+end
+
+##
+# Raised by Gem::Resolver when dependencies conflict and create the
+# inability to find a valid possible spec for a request.
+
+class Gem::ImpossibleDependenciesError < Gem::Exception
+
+ attr_reader :conflicts
+ attr_reader :request
+
+ def initialize request, conflicts
+ @request = request
+ @conflicts = conflicts
+
+ super build_message
+ end
+
+ def build_message # :nodoc:
+ requester = @request.requester
+ requester = requester ? requester.spec.full_name : 'The user'
+ dependency = @request.dependency
+
+ message = "#{requester} requires #{dependency} but it conflicted:\n"
+
+ @conflicts.each do |_, conflict|
+ message << conflict.explanation
+ end
+
+ message
+ end
+
+ def dependency
+ @request.dependency
+ end
+
end
class Gem::InstallError < Gem::Exception; end
@@ -90,6 +177,15 @@ class Gem::RemoteInstallationSkipped < Gem::Exception; end
# Represents an error communicating via HTTP.
class Gem::RemoteSourceException < Gem::Exception; end
+##
+# Raised when a gem dependencies file specifies a ruby version that does not
+# match the current version.
+
+class Gem::RubyVersionMismatch < Gem::Exception; end
+
+##
+# Raised by Gem::Validator when something is not right in a gem.
+
class Gem::VerificationError < Gem::Exception; end
##
@@ -97,8 +193,15 @@ class Gem::VerificationError < Gem::Exception; end
# exit_code
class Gem::SystemExitException < SystemExit
+
+ ##
+ # The exit code for the process
+
attr_accessor :exit_code
+ ##
+ # Creates a new SystemExitException with the given +exit_code+
+
def initialize(exit_code)
@exit_code = exit_code
@@ -107,3 +210,61 @@ class Gem::SystemExitException < SystemExit
end
+##
+# Raised by Resolver when a dependency requests a gem for which
+# there is no spec.
+
+class Gem::UnsatisfiableDependencyError < Gem::DependencyError
+
+ ##
+ # The unsatisfiable dependency. This is a
+ # Gem::Resolver::DependencyRequest, not a Gem::Dependency
+
+ 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+
+
+ def initialize dep, platform_mismatch=nil
+ if platform_mismatch and !platform_mismatch.empty?
+ plats = platform_mismatch.map { |x| x.platform.to_s }.sort.uniq
+ super "Unable to resolve dependency: No match for '#{dep}' on this platform. Found: #{plats.join(', ')}"
+ else
+ if dep.explicit?
+ super "Unable to resolve dependency: user requested '#{dep}'"
+ else
+ super "Unable to resolve dependency: '#{dep.request_context}' requires '#{dep}'"
+ end
+ 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
+
+##
+# 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 b2bb09aad5..5af6bbf39e 100644
--- a/lib/rubygems/ext.rb
+++ b/lib/rubygems/ext.rb
@@ -4,13 +4,12 @@
# See LICENSE.txt for permissions.
#++
-require 'rubygems'
-
##
# Classes for building C extensions live here.
module Gem::Ext; end
+require 'rubygems/ext/build_error'
require 'rubygems/ext/builder'
require 'rubygems/ext/configure_builder'
require 'rubygems/ext/ext_conf_builder'
diff --git a/lib/rubygems/ext/build_error.rb b/lib/rubygems/ext/build_error.rb
new file mode 100644
index 0000000000..bfe85ffc11
--- /dev/null
+++ b/lib/rubygems/ext/build_error.rb
@@ -0,0 +1,6 @@
+##
+# Raised when there is an error while building extensions.
+
+class Gem::Ext::BuildError < Gem::InstallError
+end
+
diff --git a/lib/rubygems/ext/builder.rb b/lib/rubygems/ext/builder.rb
index 79cae906ee..548f1262a8 100644
--- a/lib/rubygems/ext/builder.rb
+++ b/lib/rubygems/ext/builder.rb
@@ -4,8 +4,23 @@
# See LICENSE.txt for permissions.
#++
+require 'rubygems/user_interaction'
+require 'thread'
+
class Gem::Ext::Builder
+ include Gem::UserInteraction
+
+ ##
+ # The builder shells-out to run various commands after changing the
+ # directory. This means multiple installations cannot be allowed to build
+ # extensions in parallel as they may change each other's directories leading
+ # to broken extensions or failed installations.
+
+ CHDIR_MUTEX = Mutex.new # :nodoc:
+
+ attr_accessor :build_args # :nodoc:
+
def self.class_name
name =~ /Ext::(.*)Builder/
$1.downcase
@@ -13,26 +28,30 @@ class Gem::Ext::Builder
def self.make(dest_path, results)
unless File.exist? 'Makefile' then
- raise Gem::InstallError, "Makefile not found:\n\n#{results.join "\n"}"
+ raise Gem::InstallError, 'Makefile not found'
end
# try to find make program from Ruby configure arguments first
RbConfig::CONFIG['configure_args'] =~ /with-make-prog\=(\w+)/
- make_program = $1 || ENV['MAKE'] || ENV['make']
+ make_program = ENV['MAKE'] || ENV['make'] || $1
unless make_program then
make_program = (/mswin/ =~ RUBY_PLATFORM) ? 'nmake' : 'make'
end
destdir = '"DESTDIR=%s"' % ENV['DESTDIR'] if RUBY_VERSION > '2.0'
- ['', 'install'].each do |target|
+ ['clean', '', 'install'].each do |target|
# Pass DESTDIR via command line to override what's in MAKEFLAGS
cmd = [
make_program,
destdir,
target
].join(' ').rstrip
- run(cmd, results, "make #{target}".rstrip)
+ begin
+ run(cmd, results, "make #{target}".rstrip)
+ rescue Gem::InstallError
+ raise unless target == 'clean' # ignore clean failure
+ end
end
end
@@ -59,9 +78,141 @@ class Gem::Ext::Builder
unless $?.success? then
results << "Building has failed. See above output for more information on the failure." if verbose
- raise Gem::InstallError, "#{command_name || class_name} failed:\n\n#{results.join "\n"}"
+
+ exit_reason =
+ if $?.exited? then
+ ", exit code #{$?.exitstatus}"
+ elsif $?.signaled? then
+ ", uncaught signal #{$?.termsig}"
+ end
+
+ raise Gem::InstallError, "#{command_name || class_name} failed#{exit_reason}"
end
end
+ ##
+ # Creates a new extension builder for +spec+. If the +spec+ does not yet
+ # have build arguments, saved, set +build_args+ which is an ARGV-style
+ # array.
+
+ def initialize spec, build_args = spec.build_args
+ @spec = spec
+ @build_args = build_args
+ @gem_dir = spec.full_gem_path
+
+ @ran_rake = nil
+ end
+
+ ##
+ # Chooses the extension builder class for +extension+
+
+ def builder_for extension # :nodoc:
+ case extension
+ when /extconf/ then
+ Gem::Ext::ExtConfBuilder
+ when /configure/ then
+ Gem::Ext::ConfigureBuilder
+ when /rakefile/i, /mkrf_conf/i then
+ @ran_rake = true
+ Gem::Ext::RakeBuilder
+ when /CMakeLists.txt/ then
+ Gem::Ext::CmakeBuilder
+ else
+ extension_dir = File.join @gem_dir, File.dirname(extension)
+
+ message = "No builder for extension '#{extension}'"
+ build_error extension_dir, message
+ end
+ end
+
+ ##
+ # Logs the build +output+ in +build_dir+, then raises Gem::Ext::BuildError.
+
+ def build_error build_dir, output, backtrace = nil # :nodoc:
+ gem_make_out = write_gem_make_out output
+
+ message = <<-EOF
+ERROR: Failed to build gem native extension.
+
+ #{output}
+
+Gem files will remain installed in #{@gem_dir} for inspection.
+Results logged to #{gem_make_out}
+EOF
+
+ raise Gem::Ext::BuildError, message, backtrace
+ end
+
+ def build_extension extension, dest_path # :nodoc:
+ results = []
+
+ extension ||= '' # I wish I knew why this line existed
+ extension_dir =
+ File.expand_path File.join @gem_dir, File.dirname(extension)
+ lib_dir = File.join @spec.full_gem_path, @spec.raw_require_paths.first
+
+ builder = builder_for extension
+
+ begin
+ FileUtils.mkdir_p dest_path
+
+ CHDIR_MUTEX.synchronize do
+ Dir.chdir extension_dir do
+ results = builder.build(extension, @gem_dir, dest_path,
+ results, @build_args, lib_dir)
+
+ verbose { results.join("\n") }
+ end
+ end
+
+ write_gem_make_out results.join "\n"
+ rescue => e
+ results << e.message
+ build_error extension_dir, results.join("\n"), $@
+ end
+ end
+
+ ##
+ # Builds extensions. Valid types of extensions are extconf.rb files,
+ # configure scripts and rakefiles or mkrf_conf files.
+
+ def build_extensions
+ return if @spec.extensions.empty?
+
+ if @build_args.empty?
+ say "Building native extensions. This could take a while..."
+ else
+ say "Building native extensions with: '#{@build_args.join ' '}'"
+ say "This could take a while..."
+ end
+
+ dest_path = @spec.extension_dir
+
+ FileUtils.rm_f @spec.gem_build_complete_path
+
+ @ran_rake = false # only run rake once
+
+ @spec.extensions.each do |extension|
+ break if @ran_rake
+
+ build_extension extension, dest_path
+ end
+
+ FileUtils.touch @spec.gem_build_complete_path
+ end
+
+ ##
+ # 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'
+
+ FileUtils.mkdir_p @spec.extension_dir
+
+ open destination, 'wb' do |io| io.puts output end
+
+ destination
+ end
+
end
diff --git a/lib/rubygems/ext/cmake_builder.rb b/lib/rubygems/ext/cmake_builder.rb
index d6d106f4ae..24531bc75c 100644
--- a/lib/rubygems/ext/cmake_builder.rb
+++ b/lib/rubygems/ext/cmake_builder.rb
@@ -1,5 +1,7 @@
+require 'rubygems/command'
+
class Gem::Ext::CmakeBuilder < Gem::Ext::Builder
- def self.build(extension, directory, dest_path, results)
+ def self.build(extension, directory, dest_path, results, args=[], lib_dir=nil)
unless File.exist?('Makefile') then
cmd = "cmake . -DCMAKE_INSTALL_PREFIX=#{dest_path}"
cmd << " #{Gem::Command.build_args.join ' '}" unless Gem::Command.build_args.empty?
diff --git a/lib/rubygems/ext/configure_builder.rb b/lib/rubygems/ext/configure_builder.rb
index ef8b29e427..f66e39387a 100644
--- a/lib/rubygems/ext/configure_builder.rb
+++ b/lib/rubygems/ext/configure_builder.rb
@@ -4,11 +4,9 @@
# See LICENSE.txt for permissions.
#++
-require 'rubygems/ext/builder'
-
class Gem::Ext::ConfigureBuilder < Gem::Ext::Builder
- def self.build(extension, directory, dest_path, results, args=[])
+ def self.build(extension, directory, dest_path, results, args=[], lib_dir=nil)
unless File.exist?('Makefile') then
cmd = "sh ./configure --prefix=#{dest_path}"
cmd << " #{args.join ' '}" unless args.empty?
diff --git a/lib/rubygems/ext/ext_conf_builder.rb b/lib/rubygems/ext/ext_conf_builder.rb
index 5112eb8e2f..213bdcb002 100644
--- a/lib/rubygems/ext/ext_conf_builder.rb
+++ b/lib/rubygems/ext/ext_conf_builder.rb
@@ -4,22 +4,22 @@
# See LICENSE.txt for permissions.
#++
-require 'rubygems/ext/builder'
-require 'rubygems/command'
require 'fileutils'
require 'tempfile'
class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
FileEntry = FileUtils::Entry_ # :nodoc:
- def self.build(extension, directory, dest_path, results, args=[])
- tmp_dest = Dir.mktmpdir(".gem.", ".")
+ def self.build(extension, directory, dest_path, results, args=[], lib_dir=nil)
+ # relative path required as some versions of mktmpdir return an absolute
+ # path which breaks make if it includes a space in the name
+ tmp_dest = get_relative_path(Dir.mktmpdir(".gem.", "."))
t = nil
Tempfile.open %w"siteconf .rb", "." do |siteconf|
t = siteconf
siteconf.puts "require 'rbconfig'"
- siteconf.puts "dest_path = #{(tmp_dest || dest_path).dump}"
+ siteconf.puts "dest_path = #{tmp_dest.dump}"
%w[sitearchdir sitelibdir].each do |dir|
siteconf.puts "RbConfig::MAKEFILE_CONFIG['#{dir}'] = dest_path"
siteconf.puts "RbConfig::CONFIG['#{dir}'] = dest_path"
@@ -27,31 +27,37 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
siteconf.flush
- siteconf_path = File.expand_path siteconf.path
-
- rubyopt = ENV["RUBYOPT"]
destdir = ENV["DESTDIR"]
begin
- ENV["RUBYOPT"] = ["-r#{siteconf_path}", rubyopt].compact.join(' ')
- cmd = [Gem.ruby, File.basename(extension), *args].join ' '
+ cmd = [Gem.ruby, "-r", get_relative_path(siteconf.path), File.basename(extension), *args].join ' '
- run cmd, results
+ begin
+ run cmd, results
+ ensure
+ FileUtils.mv 'mkmf.log', dest_path if File.exist? 'mkmf.log'
+ siteconf.unlink
+ end
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
+ end
+
FileEntry.new(tmp_dest).traverse do |ent|
destent = ent.class.new(dest_path, ent.rel)
- destent.exist? or File.rename(ent.path, destent.path)
+ destent.exist? or FileUtils.mv(ent.path, destent.path)
end
end
ensure
- ENV["RUBYOPT"] = rubyopt
ENV["DESTDIR"] = destdir
end
end
@@ -62,5 +68,11 @@ 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 2ac6edd5c8..d5ebf597ae 100644
--- a/lib/rubygems/ext/rake_builder.rb
+++ b/lib/rubygems/ext/rake_builder.rb
@@ -4,12 +4,9 @@
# See LICENSE.txt for permissions.
#++
-require 'rubygems/ext/builder'
-require 'rubygems/command'
-
class Gem::Ext::RakeBuilder < Gem::Ext::Builder
- def self.build(extension, directory, dest_path, results, args=[])
+ def self.build(extension, directory, dest_path, results, args=[], lib_dir=nil)
if File.basename(extension) =~ /mkrf_conf/i then
cmd = "#{Gem.ruby} #{File.basename extension}"
cmd << " #{args.join " "}" unless args.empty?
@@ -22,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 8060e15312..7a3fd6b116 100644
--- a/lib/rubygems/gem_runner.rb
+++ b/lib/rubygems/gem_runner.rb
@@ -33,17 +33,11 @@ class Gem::GemRunner
##
# Run the gem command with the following arguments.
- def run(args)
- if args.include?('--')
- # We need to preserve the original ARGV to use for passing gem options
- # to source gems. If there is a -- in the line, strip all options after
- # it...its for the source building process.
- # TODO use slice!
- build_args = args[args.index("--") + 1...args.length]
- args = args[0...args.index("--")]
- end
+ def run args
+ build_args = extract_build_args args
do_configuration args
+
cmd = @command_manager_class.instance
cmd.command_names.each do |command_name|
@@ -60,6 +54,20 @@ class Gem::GemRunner
cmd.run Gem.configuration.args, build_args
end
+ ##
+ # Separates the build arguments (those following <code>--</code>) from the
+ # other arguments in the list.
+
+ def extract_build_args args # :nodoc:
+ return [] unless offset = args.index('--')
+
+ build_args = args.slice!(offset...args.length)
+
+ build_args.shift
+
+ build_args
+ end
+
private
def do_configuration(args)
diff --git a/lib/rubygems/gemcutter_utilities.rb b/lib/rubygems/gemcutter_utilities.rb
index c0628ebfb5..4ecf7376e0 100644
--- a/lib/rubygems/gemcutter_utilities.rb
+++ b/lib/rubygems/gemcutter_utilities.rb
@@ -1,11 +1,17 @@
require 'rubygems/remote_fetcher'
+##
+# Utility methods for using the RubyGems API.
+
module Gem::GemcutterUtilities
+
# TODO: move to Gem::Command
OptionParser.accept Symbol do |value|
value.to_sym
end
+ attr_writer :host
+
##
# Add the --key option
@@ -17,6 +23,9 @@ module Gem::GemcutterUtilities
end
end
+ ##
+ # The API key from the command options or from the user's configuration.
+
def api_key
if options[:key] then
verify_api_key options[:key]
@@ -27,9 +36,57 @@ module Gem::GemcutterUtilities
end
end
+ ##
+ # The host to connect to either from the RUBYGEMS_HOST environment variable
+ # or from the user's configuration
+
+ def host
+ configured_host = Gem.host unless
+ Gem.configuration.disable_default_gem_server
+
+ @host ||=
+ begin
+ env_rubygems_host = ENV['RUBYGEMS_HOST']
+ env_rubygems_host = nil if
+ env_rubygems_host and env_rubygems_host.empty?
+
+ env_rubygems_host|| configured_host
+ end
+ end
+
+ ##
+ # Creates an RubyGems API to +host+ and +path+ with the given HTTP +method+.
+ #
+ # If +allowed_push_host+ metadata is present, then it will only allow that host.
+
+ def rubygems_api_request(method, path, host = nil, allowed_push_host = nil, &block)
+ require 'net/http'
+
+ self.host = host if host
+ unless self.host
+ alert_error "You must specify a gem server"
+ terminate_interaction 1 # TODO: question this
+ 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}"
+
+ request_method = Net::HTTP.const_get method.to_s.capitalize
+
+ Gem::RemoteFetcher.fetcher.request(uri, request_method, &block)
+ end
+
+ ##
+ # Signs in with the RubyGems API at +sign_in_host+ and sets the rubygems API
+ # key.
+
def sign_in sign_in_host = nil
sign_in_host ||= self.host
- return if Gem.configuration.rubygems_api_key
+ return if api_key
pretty_host = if Gem::DEFAULT_HOST == sign_in_host then
'RubyGems.org'
@@ -56,47 +113,36 @@ module Gem::GemcutterUtilities
end
end
- attr_writer :host
- def host
- configured_host = Gem.host unless
- Gem.configuration.disable_default_gem_server
-
- @host ||=
- begin
- env_rubygems_host = ENV['RUBYGEMS_HOST']
- env_rubygems_host = nil if
- env_rubygems_host and env_rubygems_host.empty?
-
- env_rubygems_host|| configured_host
- end
- end
-
- def rubygems_api_request(method, path, host = nil, &block)
- require 'net/http'
+ ##
+ # Retrieves the pre-configured API key +key+ or terminates interaction with
+ # an error.
- self.host = host if host
- unless self.host
- alert_error "You must specify a gem server"
+ def verify_api_key(key)
+ if Gem.configuration.api_keys.key? key then
+ Gem.configuration.api_keys[key]
+ else
+ alert_error "No such API key. Please add it to your configuration (done automatically on initial `gem push`)."
terminate_interaction 1 # TODO: question this
end
-
- uri = URI.parse "#{self.host}/#{path}"
-
- request_method = Net::HTTP.const_get method.to_s.capitalize
-
- Gem::RemoteFetcher.fetcher.request(uri, request_method, &block)
end
- def with_response resp, error_prefix = nil
- case resp
+ ##
+ # If +response+ is an HTTP Success (2XX) response, yields the response if a
+ # block was given or shows the response body to the user.
+ #
+ # If the response was not successful, shows an error to the user including
+ # the +error_prefix+ and the response body.
+
+ def with_response response, error_prefix = nil
+ case response
when Net::HTTPSuccess then
if block_given? then
- yield resp
+ yield response
else
- say resp.body
+ say response.body
end
else
- message = resp.body
+ message = response.body
message = "#{error_prefix}: #{message}" if error_prefix
say message
@@ -104,13 +150,5 @@ module Gem::GemcutterUtilities
end
end
- def verify_api_key(key)
- if Gem.configuration.api_keys.key? key then
- Gem.configuration.api_keys[key]
- else
- alert_error "No such API key. Please add it to your configuration (done automatically on initial `gem push`)."
- terminate_interaction 1 # TODO: question this
- end
- end
-
end
+
diff --git a/lib/rubygems/indexer.rb b/lib/rubygems/indexer.rb
index 85c90f7d78..1c7f8e709f 100644
--- a/lib/rubygems/indexer.rb
+++ b/lib/rubygems/indexer.rb
@@ -126,7 +126,7 @@ class Gem::Indexer
# Builds Marshal quick index gemspecs.
def build_marshal_gemspecs
- count = Gem::Specification.count
+ count = Gem::Specification.count { |s| not s.default_gem? }
progress = ui.progress_reporter count,
"Generating Marshal quick index gemspecs for #{count} gems",
"Complete"
@@ -135,6 +135,7 @@ class Gem::Indexer
Gem.time 'Generated Marshal quick index gemspecs' do
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
@@ -188,10 +189,13 @@ class Gem::Indexer
# Builds indicies for RubyGems 1.2 and newer. Handles full, latest, prerelease
def build_modern_indicies
- prerelease, released = Gem::Specification.partition { |s|
+ specs = Gem::Specification.reject { |s| s.default_gem? }
+
+ prerelease, released = specs.partition { |s|
s.version.prerelease?
}
- latest_specs = Gem::Specification.latest_specs
+ latest_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')
diff --git a/lib/rubygems/install_default_message.rb b/lib/rubygems/install_default_message.rb
new file mode 100644
index 0000000000..458ba3da96
--- /dev/null
+++ b/lib/rubygems/install_default_message.rb
@@ -0,0 +1,12 @@
+require 'rubygems'
+require 'rubygems/user_interaction'
+
+##
+# A post-install hook that displays "Successfully installed
+# some_gem-1.0 as a default gem"
+
+Gem.post_install do |installer|
+ ui = Gem::DefaultUserInteraction.ui
+ ui.say "Successfully installed #{installer.spec.full_name} as a default gem"
+end
+
diff --git a/lib/rubygems/install_update_options.rb b/lib/rubygems/install_update_options.rb
index ffa8f910df..a503b7fca4 100644
--- a/lib/rubygems/install_update_options.rb
+++ b/lib/rubygems/install_update_options.rb
@@ -26,6 +26,9 @@ module Gem::InstallUpdateOptions
OptionParser.accept Gem::Security::Policy do |value|
require 'rubygems/security'
+ raise OptionParser::InvalidArgument, 'OpenSSL not installed' unless
+ defined?(Gem::Security::HighSecurity)
+
value = Gem::Security::Policies[value]
valid = Gem::Security::Policies.keys.sort
message = "#{value} (#{valid.join ', '} are valid)"
@@ -56,6 +59,23 @@ 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] = []
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
index 0ccf7ad52f..e5cfc0f536 100644
--- a/lib/rubygems/installer.rb
+++ b/lib/rubygems/installer.rb
@@ -4,12 +4,12 @@
# See LICENSE.txt for permissions.
#++
+require 'rubygems/command'
require 'rubygems/exceptions'
require 'rubygems/package'
require 'rubygems/ext'
require 'rubygems/user_interaction'
require 'fileutils'
-require 'thread'
##
# The installer installs the files contained in the .gem into the Gem.home.
@@ -33,21 +33,15 @@ class Gem::Installer
ENV_PATHS = %w[/usr/bin/env /bin/env]
##
- # The builder shells-out to run various commands after changing the
- # directory. This means multiple installations cannot be allowed to build
- # extensions in parallel as they may change each other's directories leading
- # to broken extensions or failed installations.
+ # Deprecated in favor of Gem::Ext::BuildError
- CHDIR_MUTEX = Mutex.new # :nodoc:
-
- ##
- # Raised when there is an error while building extensions.
- #
- class ExtensionBuildError < Gem::InstallError; end
+ ExtensionBuildError = Gem::Ext::BuildError # :nodoc:
include Gem::UserInteraction
- # DOC: Missing docs or :nodoc:.
+ ##
+ # Filename of the gem being installed.
+
attr_reader :gem
##
@@ -55,6 +49,8 @@ class Gem::Installer
attr_reader :bin_dir
+ attr_reader :build_root # :nodoc:
+
##
# The gem repository the gem will be installed into
@@ -65,8 +61,15 @@ class Gem::Installer
attr_reader :options
+ ##
+ # Sets the specification for .gem-less installs.
+
+ attr_writer :spec
+
@path_warning = false
+ @install_lock = Mutex.new
+
class << self
##
@@ -74,7 +77,19 @@ class Gem::Installer
attr_accessor :path_warning
- # DOC: Missing docs or :nodoc:.
+ ##
+ # 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".
+
attr_writer :exec_format
# Defaults to use Ruby's program prefix and suffix.
@@ -93,8 +108,8 @@ class Gem::Installer
# :env_shebang:: Use /usr/bin/env in bin wrappers.
# :force:: Overrides all version checks and security policy checks, except
# for a signed-gems-only policy.
- # :format_executable:: Format the executable the same as the ruby executable.
- # If your ruby is ruby18, foo_exec will be installed as
+ # :format_executable:: Format the executable the same as the Ruby executable.
+ # If your Ruby is ruby18, foo_exec will be installed as
# foo_exec18.
# :ignore_dependencies:: Don't raise if a dependency is missing.
# :install_dir:: The directory to install the gem into.
@@ -153,7 +168,7 @@ class Gem::Installer
io.gets # blankline
# TODO detect a specially formatted comment instead of trying
- # to run a regexp against ruby code.
+ # to run a regexp against Ruby code.
next unless io.gets =~ /This file was generated by RubyGems/
ruby_executable = true
@@ -215,6 +230,8 @@ 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
@@ -222,21 +239,26 @@ class Gem::Installer
FileUtils.mkdir_p gem_dir
- extract_files
+ spec.loaded_from = spec_file
- build_extensions
- write_build_info_file
- run_post_build_hooks
+ if @options[:install_as_default]
+ extract_bin
+ write_default_spec
+ else
+ extract_files
- generate_bin
- write_spec
- write_cache_file
+ build_extensions
+ write_build_info_file
+ run_post_build_hooks
- say spec.post_install_message unless spec.post_install_message.nil?
+ generate_bin
+ write_spec
+ write_cache_file
+ end
- spec.loaded_from = spec_file
+ say spec.post_install_message unless spec.post_install_message.nil?
- Gem::Specification.add_spec spec unless Gem::Specification.include? spec
+ Gem::Installer.install_lock.synchronize { Gem::Specification.add_spec spec }
run_post_install_hooks
@@ -314,6 +336,7 @@ 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?
@@ -336,17 +359,38 @@ class Gem::Installer
end
##
+ # The location of of the default spec file for default gems.
+ #
+
+ def default_spec_file
+ File.join gem_home, "specifications/default", "#{spec.full_name}.gemspec"
+ end
+
+ ##
# Writes the .gemspec specification (in Ruby) to the gem home's
# specifications directory.
def write_spec
open spec_file, 'w' do |file|
+ spec.installed_by_version = Gem.rubygems_version
+
file.puts spec.to_ruby_for_cache
+
file.fsync rescue nil # for filesystems without fsync(2)
end
end
##
+ # Writes the full .gemspec specification (in Ruby) to the gem home's
+ # specifications/default directory.
+
+ def write_default_spec
+ File.open(default_spec_file, "w") do |file|
+ file.puts spec.to_ruby
+ end
+ end
+
+ ##
# Creates windows .bat files for easy running of commands
def generate_windows_script(filename, bindir)
@@ -357,12 +401,11 @@ class Gem::Installer
file.puts windows_stub_script(bindir, filename)
end
- say script_path if Gem.configuration.really_verbose
+ verbose script_path
end
end
- # DOC: Missing docs or :nodoc:.
- def generate_bin
+ def generate_bin # :nodoc:
return if spec.executables.nil? or spec.executables.empty?
Dir.mkdir @bin_dir unless File.exist? @bin_dir
@@ -408,7 +451,7 @@ class Gem::Installer
file.print app_script_text(filename)
end
- say bin_script_path if Gem.configuration.really_verbose
+ verbose bin_script_path
generate_windows_script filename, bindir
end
@@ -455,7 +498,7 @@ class Gem::Installer
#
def shebang(bin_file_name)
- ruby_name = Gem::ConfigMap[:ruby_install_name] if @env_shebang
+ ruby_name = RbConfig::CONFIG['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}
@@ -468,7 +511,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}$/," #{Gem::ConfigMap[:ruby_install_name]}")
+ which = which.gsub(/ #{bin_file_name}$/," #{RbConfig::CONFIG['ruby_install_name']}")
which = which.gsub(/\$(\w+)/) do
case $1
@@ -511,8 +554,7 @@ class Gem::Installer
end
end
- # DOC: Missing docs or :nodoc:.
- def ensure_required_ruby_version_met
+ def ensure_required_ruby_version_met # :nodoc:
if rrv = spec.required_ruby_version then
unless rrv.satisfied_by? Gem.ruby_version then
raise Gem::InstallError, "#{spec.name} requires Ruby version #{rrv}."
@@ -520,8 +562,7 @@ class Gem::Installer
end
end
- # DOC: Missing docs or :nodoc:.
- def ensure_required_rubygems_version_met
+ def ensure_required_rubygems_version_met # :nodoc:
if rrgv = spec.required_rubygems_version then
unless rrgv.satisfied_by? Gem.rubygems_version then
raise Gem::InstallError,
@@ -531,8 +572,7 @@ class Gem::Installer
end
end
- # DOC: Missing docs or :nodoc:.
- def ensure_dependencies_met
+ def ensure_dependencies_met # :nodoc:
deps = spec.runtime_dependencies
deps |= spec.development_dependencies if @development
@@ -541,19 +581,18 @@ class Gem::Installer
end
end
- # DOC: Missing docs or :nodoc:.
- def process_options
+ def process_options # :nodoc:
@options = {
:bin_dir => nil,
:env_shebang => false,
:force => false,
- :install_dir => Gem.dir,
:only_install_dir => false
}.merge options
@env_shebang = options[:env_shebang]
@force = options[:force]
- @gem_home = options[:install_dir]
+ @install_dir = options[:install_dir]
+ @gem_home = options[:install_dir] || Gem.dir
@ignore_dependencies = options[:ignore_dependencies]
@format_executable = options[:format_executable]
@security_policy = options[:security_policy]
@@ -565,12 +604,20 @@ 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
- # DOC: Missing docs or :nodoc:.
- def check_that_user_bin_dir_is_in_path
+ def check_that_user_bin_dir_is_in_path # :nodoc:
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
@@ -581,16 +628,19 @@ class Gem::Installer
user_bin_dir = user_bin_dir.downcase
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
+ 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
end
end
end
- # DOC: Missing docs or :nodoc:.
- def verify_gem_home(unpack = false)
+ def verify_gem_home(unpack = false) # :nodoc:
FileUtils.mkdir_p gem_home
raise Gem::FilePermissionError, gem_home unless
unpack or File.writable?(gem_home)
@@ -616,7 +666,7 @@ 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/
+ if str =~ /\\A_(.*)_\\z/ and Gem::Version.correct?($1) then
version = $1
ARGV.shift
end
@@ -628,17 +678,17 @@ TEXT
end
##
- # return the stub script text used to launch the true ruby script
+ # return the stub script text used to launch the true Ruby script
def windows_stub_script(bindir, bin_file_name)
ruby = File.basename(Gem.ruby).chomp('"')
return <<-TEXT
@ECHO OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT
-@"#{ruby}" "#{File.join(bindir, bin_file_name)}" %1 %2 %3 %4 %5 %6 %7 %8 %9
+@"#{bindir.tr(File::SEPARATOR, File::ALT_SEPARATOR)}\\#{ruby}" "#{File.join(bindir, bin_file_name)}" %1 %2 %3 %4 %5 %6 %7 %8 %9
GOTO :EOF
:WinNT
-@"#{ruby}" "%~dpn0" %*
+@"%~dp0#{ruby}" "%~dpn0" %*
TEXT
end
@@ -647,75 +697,20 @@ TEXT
# configure scripts and rakefiles or mkrf_conf files.
def build_extensions
- return if spec.extensions.empty?
-
- if @build_args.empty?
- say "Building native extensions. This could take a while..."
- else
- say "Building native extensions with: '#{@build_args.join(' ')}'"
- say "This could take a while..."
- end
+ builder = Gem::Ext::Builder.new spec, @build_args
- dest_path = File.join gem_dir, spec.require_paths.first
- ran_rake = false # only run rake once
-
- spec.extensions.each do |extension|
- break if ran_rake
- results = []
-
- extension ||= ""
- extension_dir = File.join gem_dir, File.dirname(extension)
-
- builder = case extension
- when /extconf/ then
- Gem::Ext::ExtConfBuilder
- when /configure/ then
- Gem::Ext::ConfigureBuilder
- when /rakefile/i, /mkrf_conf/i then
- ran_rake = true
- Gem::Ext::RakeBuilder
- when /CMakeLists.txt/ then
- Gem::Ext::CmakeBuilder
- else
- message = "No builder for extension '#{extension}'"
- extension_build_error extension_dir, message
- end
-
- begin
- FileUtils.mkdir_p dest_path
-
- CHDIR_MUTEX.synchronize do
- Dir.chdir extension_dir do
- results = builder.build(extension, gem_dir, dest_path,
- results, @build_args)
-
- say results.join("\n") if Gem.configuration.really_verbose
- end
- end
- rescue
- extension_build_error(extension_dir, results.join("\n"), $@)
- end
- end
+ builder.build_extensions
end
##
- # Logs the build +output+ in +build_dir+, then raises ExtensionBuildError.
-
- def extension_build_error(build_dir, output, backtrace = nil)
- gem_make_out = File.join build_dir, 'gem_make.out'
-
- open gem_make_out, 'wb' do |io| io.puts output end
-
- message = <<-EOF
-ERROR: Failed to build gem native extension.
-
- #{output}
+ # Logs the build +output+ in +build_dir+, then raises Gem::Ext::BuildError.
+ #
+ # TODO: Delete this for RubyGems 3. It remains for API compatibility
-Gem files will remain installed in #{gem_dir} for inspection.
-Results logged to #{gem_make_out}
-EOF
+ def extension_build_error(build_dir, output, backtrace = nil) # :nodoc:
+ builder = Gem::Ext::Builder.new spec, @build_args
- raise ExtensionBuildError, message, backtrace
+ builder.build_error build_dir, output, backtrace
end
##
@@ -728,6 +723,15 @@ EOF
end
##
+ # Extracts only the bin/ files from the gem into the gem directory.
+ # This is used by default gems to allow a gem-aware stub to function
+ # without the full gem installed.
+
+ def extract_bin
+ @package.extract_files gem_dir, "bin/*"
+ end
+
+ ##
# Prefix and suffix the program filename the same as ruby.
def formatted_program_filename(filename)
@@ -750,7 +754,7 @@ EOF
##
# Performs various checks before installing the gem such as the install
- # repository is writable and its directories exist, required ruby and
+ # repository is writable and its directories exist, required Ruby and
# rubygems versions are met and that dependencies are installed.
#
# Version and dependency checks are skipped if this install is forced.
@@ -767,7 +771,11 @@ EOF
ensure_loadable_spec
- Gem.ensure_gem_subdirectories gem_home
+ if options[:install_as_default]
+ Gem.ensure_default_gem_subdirectories gem_home
+ else
+ Gem.ensure_gem_subdirectories gem_home
+ end
return true if @force
diff --git a/lib/rubygems/installer_test_case.rb b/lib/rubygems/installer_test_case.rb
index 62a468a8a2..549de011e4 100644
--- a/lib/rubygems/installer_test_case.rb
+++ b/lib/rubygems/installer_test_case.rb
@@ -56,11 +56,6 @@ class Gem::Installer
##
# Available through requiring rubygems/installer_test_case
- attr_writer :spec
-
- ##
- # Available through requiring rubygems/installer_test_case
-
attr_writer :wrappers
end
@@ -106,6 +101,8 @@ 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:
diff --git a/lib/rubygems/local_remote_options.rb b/lib/rubygems/local_remote_options.rb
index a1e106d9be..db23d9f974 100644
--- a/lib/rubygems/local_remote_options.rb
+++ b/lib/rubygems/local_remote_options.rb
@@ -100,8 +100,8 @@ module Gem::LocalRemoteOptions
def add_source_option
accept_uri_http
- add_option(:"Local/Remote", '--source URL', URI::HTTP,
- 'Add URL as a remote source for gems') do |source, options|
+ add_option(:"Local/Remote", '-s', '--source URL', URI::HTTP,
+ 'Append URL to list of remote gem sources') do |source, options|
source << '/' if source !~ /\/\z/
diff --git a/lib/rubygems/name_tuple.rb b/lib/rubygems/name_tuple.rb
index d16fad26f1..60323db408 100644
--- a/lib/rubygems/name_tuple.rb
+++ b/lib/rubygems/name_tuple.rb
@@ -43,6 +43,20 @@ class Gem::NameTuple
end
##
+ # Returns the full name (name-version) of this Gem. Platform information is
+ # included if it is not the default Ruby platform. This mimics the behavior
+ # of Gem::Specification#full_name.
+
+ def full_name
+ case @platform
+ when nil, 'ruby', ''
+ "#{@name}-#{@version}"
+ else
+ "#{@name}-#{@version}-#{@platform}"
+ end.untaint
+ end
+
+ ##
# Indicate if this NameTuple matches the current platform.
def match_platform?
@@ -59,12 +73,7 @@ class Gem::NameTuple
# Return the name that the gemspec file would be
def spec_name
- case @platform
- when nil, 'ruby', ''
- "#{@name}-#{@version}.gemspec"
- else
- "#{@name}-#{@version}-#{@platform}.gemspec"
- end
+ "#{full_name}.gemspec"
end
##
@@ -74,12 +83,16 @@ class Gem::NameTuple
[@name, @version, @platform]
end
- def to_s
+ def inspect # :nodoc:
"#<Gem::NameTuple #{@name}, #{@version}, #{@platform}>"
end
+ alias to_s inspect # :nodoc:
+
def <=> other
- to_a <=> other.to_a
+ [@name, @version, @platform == Gem::Platform::RUBY ? -1 : 1] <=>
+ [other.name, other.version,
+ other.platform == Gem::Platform::RUBY ? -1 : 1]
end
include Comparable
diff --git a/lib/rubygems/package.rb b/lib/rubygems/package.rb
index 957446257d..417b34b79f 100644
--- a/lib/rubygems/package.rb
+++ b/lib/rubygems/package.rb
@@ -37,7 +37,7 @@
# the_gem.spec # get the spec out of the gem
# the_gem.verify # check the gem is OK (contains valid gem specification, contains a not corrupt contents archive)
#
-# #files are the files in the .gem tar file, not the ruby files in the gem
+# #files are the files in the .gem tar file, not the Ruby files in the gem
# #extract_files and #contents automatically call #verify
require 'rubygems/security'
@@ -54,10 +54,12 @@ class Gem::Package
class FormatError < Error
attr_reader :path
- def initialize message, path = nil
- @path = path
+ def initialize message, source = nil
+ if source
+ @path = source.path
- message << " in #{path}" if path
+ message << " in #{path}" if path
+ end
super message
end
@@ -80,6 +82,7 @@ class Gem::Package
class TarInvalidError < Error; end
+
attr_accessor :build_time # :nodoc:
##
@@ -114,19 +117,26 @@ class Gem::Package
end
##
- # Creates a new Gem::Package for the file at +gem+.
+ # Creates a new Gem::Package for the file at +gem+. +gem+ can also be
+ # provided as an IO object.
#
# If +gem+ is an existing file in the old format a Gem::Package::Old will be
# returned.
def self.new gem
- return super unless Gem::Package == self
- return super unless File.exist? gem
+ 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
- start = File.read gem, 20
+ return super(gem) unless Gem::Package == self
+ return super unless gem.present?
- return super unless start
- return super unless start.include? 'MD5SUM ='
+ return super unless gem.start
+ return super unless gem.start.include? 'MD5SUM ='
Gem::Package::Old.new gem
end
@@ -227,7 +237,7 @@ class Gem::Package
setup_signer
- open @gem, 'wb' do |gem_io|
+ @gem.with_write_io do |gem_io|
Gem::Package::TarWriter.new gem_io do |gem|
add_metadata gem
add_contents gem
@@ -255,7 +265,7 @@ EOM
@contents = []
- open @gem, 'rb' do |io|
+ @gem.with_read_io do |io|
gem_tar = Gem::Package::TarReader.new io
gem_tar.each do |entry|
@@ -280,11 +290,16 @@ EOM
algorithms = if @checksums then
@checksums.keys
else
- [Gem::Security::DIGEST_NAME]
+ [Gem::Security::DIGEST_NAME].compact
end
algorithms.each do |algorithm|
- digester = OpenSSL::Digest.new algorithm
+ digester =
+ if defined?(OpenSSL::Digest) then
+ OpenSSL::Digest.new algorithm
+ else
+ Digest.const_get(algorithm).new
+ end
digester << entry.read(16384) until entry.eof?
@@ -298,19 +313,22 @@ EOM
##
# Extracts the files in this package into +destination_dir+
+ #
+ # If +pattern+ is specified, only entries matching that glob will be
+ # extracted.
- def extract_files destination_dir
+ def extract_files destination_dir, pattern = "*"
verify unless @spec
FileUtils.mkdir_p destination_dir
- open @gem, 'rb' do |io|
+ @gem.with_read_io do |io|
reader = Gem::Package::TarReader.new io
reader.each do |entry|
next unless entry.full_name == 'data.tar.gz'
- extract_tar_gz entry, destination_dir
+ extract_tar_gz entry, destination_dir, pattern
return # ignore further entries
end
@@ -324,21 +342,35 @@ EOM
# If an entry in the archive contains a relative path above
# +destination_dir+ or an absolute path is encountered an exception is
# raised.
+ #
+ # If +pattern+ is specified, only entries matching that glob will be
+ # extracted.
- def extract_tar_gz io, destination_dir # :nodoc:
+ def extract_tar_gz io, destination_dir, pattern = "*" # :nodoc:
open_tar_gz io do |tar|
tar.each do |entry|
+ next unless File.fnmatch pattern, entry.full_name, File::FNM_DOTMATCH
+
destination = install_location entry.full_name, destination_dir
FileUtils.rm_rf destination
- FileUtils.mkdir_p File.dirname destination
+ mkdir_options = {}
+ mkdir_options[:mode] = entry.header.mode if entry.directory?
+ mkdir =
+ if entry.directory? then
+ destination
+ else
+ File.dirname destination
+ end
+
+ FileUtils.mkdir_p mkdir, mkdir_options
open destination, 'wb', entry.header.mode do |out|
out.write entry.read
- end
+ end if entry.file?
- say destination if Gem.configuration.really_verbose
+ verbose destination
end
end
end
@@ -369,6 +401,7 @@ EOM
destination_dir = File.realpath destination_dir if
File.respond_to? :realpath
+ destination_dir = File.expand_path destination_dir
destination = File.join destination_dir, filename
destination = File.expand_path destination
@@ -428,12 +461,13 @@ EOM
# certificate and key are not present only checksum generation is set up.
def setup_signer
+ passphrase = ENV['GEM_PRIVATE_KEY_PASSPHRASE']
if @spec.signing_key then
- @signer = Gem::Security::Signer.new @spec.signing_key, @spec.cert_chain
+ @signer = Gem::Security::Signer.new @spec.signing_key, @spec.cert_chain, passphrase
@spec.signing_key = nil
@spec.cert_chain = @signer.cert_chain.map { |cert| cert.to_s }
else
- @signer = Gem::Security::Signer.new nil, nil
+ @signer = Gem::Security::Signer.new nil, nil, passphrase
@spec.cert_chain = @signer.cert_chain.map { |cert| cert.to_pem } if
@signer.cert_chain
end
@@ -466,7 +500,7 @@ EOM
@files = []
@spec = nil
- open @gem, 'rb' do |io|
+ @gem.with_read_io do |io|
Gem::Package::TarReader.new io do |reader|
read_checksums reader
@@ -510,27 +544,38 @@ EOM
end
##
+ # Verifies +entry+ in a .gem file.
+
+ def verify_entry entry
+ file_name = entry.full_name
+ @files << file_name
+
+ case file_name
+ when /\.sig$/ then
+ @signatures[$`] = entry.read if @security_policy
+ return
+ else
+ digest entry
+ end
+
+ case file_name
+ when /^metadata(.gz)?$/ then
+ load_spec entry
+ when 'data.tar.gz' then
+ verify_gz entry
+ end
+ rescue => e
+ message = "package is corrupt, exception while verifying: " +
+ "#{e.message} (#{e.class})"
+ raise Gem::Package::FormatError.new message, @gem
+ end
+
+ ##
# Verifies the files of the +gem+
def verify_files gem
gem.each do |entry|
- file_name = entry.full_name
- @files << file_name
-
- case file_name
- when /\.sig$/ then
- @signatures[$`] = entry.read if @security_policy
- next
- else
- digest entry
- end
-
- case file_name
- when /^metadata(.gz)?$/ then
- load_spec entry
- when 'data.tar.gz' then
- verify_gz entry
- end
+ verify_entry entry
end
unless @spec then
@@ -557,6 +602,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'
diff --git a/lib/rubygems/package/file_source.rb b/lib/rubygems/package/file_source.rb
new file mode 100644
index 0000000000..85316f62e7
--- /dev/null
+++ b/lib/rubygems/package/file_source.rb
@@ -0,0 +1,33 @@
+##
+# 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
new file mode 100644
index 0000000000..f89593dd2d
--- /dev/null
+++ b/lib/rubygems/package/io_source.rb
@@ -0,0 +1,45 @@
+##
+# 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 d74753fa90..65bcbb2283 100644
--- a/lib/rubygems/package/old.rb
+++ b/lib/rubygems/package/old.rb
@@ -37,7 +37,7 @@ class Gem::Package::Old < Gem::Package
return @contents if @contents
- open @gem, 'rb' do |io|
+ @gem.with_read_io do |io|
read_until_dashes io # spec
header = file_list io
@@ -53,7 +53,7 @@ class Gem::Package::Old < Gem::Package
errstr = "Error reading files from gem"
- open @gem, 'rb' do |io|
+ @gem.with_read_io do |io|
read_until_dashes io # spec
header = file_list io
raise Gem::Exception, errstr unless header
@@ -83,7 +83,7 @@ class Gem::Package::Old < Gem::Package
out.write file_data
end
- say destination if Gem.configuration.really_verbose
+ verbose destination
end
end
rescue Zlib::DataError
@@ -136,7 +136,7 @@ class Gem::Package::Old < Gem::Package
yaml = ''
- open @gem, 'rb' do |io|
+ @gem.with_read_io do |io|
skip_ruby io
read_until_dashes io do |line|
yaml << line
@@ -145,7 +145,7 @@ class Gem::Package::Old < Gem::Package
yaml_error = if RUBY_VERSION < '1.9' then
YAML::ParseError
- elsif YAML::ENGINE.yamler == 'syck' then
+ elsif YAML.const_defined?(:ENGINE) && YAML::ENGINE.yamler == 'syck' then
YAML::ParseError
else
YAML::SyntaxError
diff --git a/lib/rubygems/package/source.rb b/lib/rubygems/package/source.rb
new file mode 100644
index 0000000000..1f18d479da
--- /dev/null
+++ b/lib/rubygems/package/source.rb
@@ -0,0 +1,3 @@
+class Gem::Package::Source # :nodoc:
+end
+
diff --git a/lib/rubygems/package/tar_header.rb b/lib/rubygems/package/tar_header.rb
index 28da1db0b5..f9ab13aca7 100644
--- a/lib/rubygems/package/tar_header.rb
+++ b/lib/rubygems/package/tar_header.rb
@@ -134,7 +134,7 @@ class Gem::Package::TarHeader
vals[:gid] ||= 0
vals[:mtime] ||= 0
vals[:checksum] ||= ""
- vals[:typeflag] ||= "0"
+ vals[:typeflag] = "0" if vals[:typeflag].nil? || vals[:typeflag].empty?
vals[:magic] ||= "ustar"
vals[:version] ||= "00"
vals[:uname] ||= "wheel"
diff --git a/lib/rubygems/package/tar_reader/entry.rb b/lib/rubygems/package/tar_reader/entry.rb
index 7034e59210..737c7639c6 100644
--- a/lib/rubygems/package/tar_reader/entry.rb
+++ b/lib/rubygems/package/tar_reader/entry.rb
@@ -129,6 +129,8 @@ class Gem::Package::TarReader::Entry
ret
end
+ alias readpartial read # :nodoc:
+
##
# Rewinds to the beginning of the tar file entry
diff --git a/lib/rubygems/package/tar_test_case.rb b/lib/rubygems/package/tar_test_case.rb
index 4601f1328f..5253e32f36 100644
--- a/lib/rubygems/package/tar_test_case.rb
+++ b/lib/rubygems/package/tar_test_case.rb
@@ -71,7 +71,7 @@ class Gem::Package::TarTestCase < Gem::TestCase
SP(Z(to_oct(sum, 6)))
end
- def header(type, fname, dname, length, mode, checksum = nil)
+ def header(type, fname, dname, length, mode, mtime, checksum = nil)
checksum ||= " " * 8
arr = [ # struct tarfile_entry_posix
@@ -80,7 +80,7 @@ class Gem::Package::TarTestCase < Gem::TestCase
Z(to_oct(0, 7)), # char uid[8]; ditto
Z(to_oct(0, 7)), # char gid[8]; ditto
Z(to_oct(length, 11)), # char size[12]; 0 padded, octal, null
- Z(to_oct(0, 11)), # char mtime[12]; 0 padded, octal, null
+ 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"
"\0" * 100, # char linkname[100]; ASCII + (Z unless filled)
@@ -105,16 +105,16 @@ class Gem::Package::TarTestCase < Gem::TestCase
ret
end
- def tar_dir_header(name, prefix, mode)
- h = header("5", name, prefix, 0, mode)
+ def tar_dir_header(name, prefix, mode, mtime)
+ h = header("5", name, prefix, 0, mode, mtime)
checksum = calc_checksum(h)
- header("5", name, prefix, 0, mode, checksum)
+ header("5", name, prefix, 0, mode, mtime, checksum)
end
- def tar_file_header(fname, dname, mode, length)
- h = header("0", fname, dname, length, mode)
+ def tar_file_header(fname, dname, mode, length, mtime)
+ h = header("0", fname, dname, length, mode, mtime)
checksum = calc_checksum(h)
- header("0", fname, dname, length, mode, checksum)
+ header("0", fname, dname, length, mode, mtime, checksum)
end
def to_oct(n, pad_size)
@@ -130,7 +130,7 @@ class Gem::Package::TarTestCase < Gem::TestCase
end
def util_dir_entry
- util_entry tar_dir_header("foo", "bar", 0)
+ util_entry tar_dir_header("foo", "bar", 0, Time.now)
end
end
diff --git a/lib/rubygems/package/tar_writer.rb b/lib/rubygems/package/tar_writer.rb
index f2c11e3544..e1b38ad6b5 100644
--- a/lib/rubygems/package/tar_writer.rb
+++ b/lib/rubygems/package/tar_writer.rb
@@ -4,6 +4,8 @@
# See LICENSE.txt for additional licensing information.
#++
+require 'digest'
+
##
# Allows writing of tar files
@@ -121,7 +123,8 @@ class Gem::Package::TarWriter
@io.pos = init_pos
header = Gem::Package::TarHeader.new :name => name, :mode => mode,
- :size => size, :prefix => prefix
+ :size => size, :prefix => prefix,
+ :mtime => Time.now
@io.write header
@io.pos = final_pos
@@ -140,7 +143,15 @@ class Gem::Package::TarWriter
def add_file_digest name, mode, digest_algorithms # :yields: io
digests = digest_algorithms.map do |digest_algorithm|
digest = digest_algorithm.new
- [digest.name, digest]
+ digest_name =
+ if digest.respond_to? :name then
+ digest.name
+ else
+ /::([^:]+)$/ =~ digest_algorithm.name
+ $1
+ end
+
+ [digest_name, digest]
end
digests = Hash[*digests.flatten]
@@ -165,22 +176,32 @@ class Gem::Package::TarWriter
def add_file_signed name, mode, signer
digest_algorithms = [
signer.digest_algorithm,
- OpenSSL::Digest::SHA512,
- ].uniq
+ Digest::SHA512,
+ ].compact.uniq
digests = add_file_digest name, mode, digest_algorithms do |io|
yield io
end
- signature_digest = digests.values.find do |digest|
- digest.name == signer.digest_name
+ signature_digest = digests.values.compact.find do |digest|
+ digest_name =
+ if digest.respond_to? :name then
+ digest.name
+ else
+ /::([^:]+)$/ =~ digest.class.name
+ $1
+ end
+
+ digest_name == signer.digest_name
end
- signature = signer.sign signature_digest.digest
+ if signer.key then
+ signature = signer.sign signature_digest.digest
- add_file_simple "#{name}.sig", 0444, signature.length do |io|
- io.write signature
- end if signature
+ add_file_simple "#{name}.sig", 0444, signature.length do |io|
+ io.write signature
+ end
+ end
digests
end
@@ -195,7 +216,8 @@ class Gem::Package::TarWriter
name, prefix = split_name name
header = Gem::Package::TarHeader.new(:name => name, :mode => mode,
- :size => size, :prefix => prefix).to_s
+ :size => size, :prefix => prefix,
+ :mtime => Time.now).to_s
@io.write header
os = BoundedStream.new @io, size
@@ -256,7 +278,8 @@ class Gem::Package::TarWriter
header = Gem::Package::TarHeader.new :name => name, :mode => mode,
:typeflag => "5", :size => 0,
- :prefix => prefix
+ :prefix => prefix,
+ :mtime => Time.now
@io.write header
diff --git a/lib/rubygems/path_support.rb b/lib/rubygems/path_support.rb
index 7195b322ef..2af303eecf 100644
--- a/lib/rubygems/path_support.rb
+++ b/lib/rubygems/path_support.rb
@@ -13,6 +13,10 @@ class Gem::PathSupport
attr_reader :path
##
+ # Directory with spec cache
+ attr_reader :spec_cache_dir # :nodoc:
+
+ ##
#
# Constructor. Takes a single argument which is to be treated like a
# hashtable, or defaults to ENV, the system environment.
@@ -28,6 +32,12 @@ class Gem::PathSupport
end
self.path = env["GEM_PATH"] || ENV["GEM_PATH"]
+
+ @spec_cache_dir =
+ env["GEM_SPEC_CACHE"] || ENV["GEM_SPEC_CACHE"] ||
+ Gem.default_spec_cache_dir
+
+ @spec_cache_dir = @spec_cache_dir.dup.untaint
end
private
diff --git a/lib/rubygems/platform.rb b/lib/rubygems/platform.rb
index 4a4674b72f..fa56141631 100644
--- a/lib/rubygems/platform.rb
+++ b/lib/rubygems/platform.rb
@@ -2,6 +2,8 @@ require "rubygems/deprecate"
##
# Available list of platforms for targeting Gem installations.
+#
+# See `gem help platform` for information on platform matching.
class Gem::Platform
@@ -14,8 +16,8 @@ class Gem::Platform
attr_accessor :version
def self.local
- arch = Gem::ConfigMap[:arch]
- arch = "#{arch}_60" if arch =~ /mswin32$/
+ arch = RbConfig::CONFIG['arch']
+ arch = "#{arch}_60" if arch =~ /mswin(?:32|64)$/
@local ||= new(arch)
end
@@ -27,6 +29,14 @@ class Gem::Platform
end
end
+ def self.installable?(spec)
+ if spec.respond_to? :installable_platform?
+ spec.installable_platform?
+ else
+ match spec.platform
+ end
+ end
+
def self.new(arch) # :nodoc:
case arch
when Gem::Platform::CURRENT then
@@ -129,12 +139,16 @@ class Gem::Platform
# Does +other+ match this platform? Two platforms match if they have the
# same CPU, or either has a CPU of 'universal', they have the same OS, and
# they have the same version, or either has no version.
+ #
+ # Additionally, the platform will match if the local CPU is 'arm' and the
+ # other CPU starts with "arm" (for generic ARM family support).
def ===(other)
return nil unless Gem::Platform === other
# cpu
- (@cpu == 'universal' or other.cpu == 'universal' or @cpu == other.cpu) and
+ (@cpu == 'universal' or other.cpu == 'universal' or @cpu == other.cpu or
+ (@cpu == 'arm' and other.cpu =~ /\Aarm/)) and
# os
@os == other.os and
@@ -159,6 +173,7 @@ 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' ]
@@ -175,13 +190,13 @@ class Gem::Platform
end
##
- # A pure-ruby gem that may use Gem::Specification#extensions to build
+ # A pure-Ruby gem that may use Gem::Specification#extensions to build
# binary files.
RUBY = 'ruby'
##
- # A platform-specific gem that is built for the packaging ruby's platform.
+ # A platform-specific gem that is built for the packaging Ruby's platform.
# This will be replaced with Gem::Platform::local.
CURRENT = 'current'
diff --git a/lib/rubygems/psych_additions.rb b/lib/rubygems/psych_additions.rb
index 08a5cb37ea..0e4ebbd50c 100644
--- a/lib/rubygems/psych_additions.rb
+++ b/lib/rubygems/psych_additions.rb
@@ -3,7 +3,7 @@
# in Specification._load, but if we don't have the constant, Marshal
# blows up.
-module Psych
- class PrivateType
+module Psych # :nodoc:
+ class PrivateType # :nodoc:
end
end
diff --git a/lib/rubygems/rdoc.rb b/lib/rubygems/rdoc.rb
index f16c8696f0..180b95fbf3 100644
--- a/lib/rubygems/rdoc.rb
+++ b/lib/rubygems/rdoc.rb
@@ -8,7 +8,7 @@ rescue Gem::LoadError
# swallow
else
# This will force any deps that 'rdoc' might have
- # (such as json) that are ambigious to be activated, which
+ # (such as json) that are ambiguous 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
@@ -193,7 +193,7 @@ class Gem::RDoc # :nodoc: all
::RDoc::Parser::C.reset
args = @spec.rdoc_options
- args.concat @spec.require_paths
+ args.concat @spec.source_paths
args.concat @spec.extra_rdoc_files
case config_args = Gem.configuration[:rdoc]
@@ -263,7 +263,7 @@ class Gem::RDoc # :nodoc: all
Gem::Requirement.new('>= 2.4.0') =~ self.class.rdoc_version
r = new_rdoc
- say "rdoc #{args.join ' '}" if Gem.configuration.really_verbose
+ verbose { "rdoc #{args.join ' '}" }
Dir.chdir @spec.full_gem_path do
begin
@@ -279,7 +279,6 @@ 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
diff --git a/lib/rubygems/remote_fetcher.rb b/lib/rubygems/remote_fetcher.rb
index 157a308769..607827c47e 100644
--- a/lib/rubygems/remote_fetcher.rb
+++ b/lib/rubygems/remote_fetcher.rb
@@ -1,8 +1,8 @@
require 'rubygems'
+require 'rubygems/request'
+require 'rubygems/uri_formatter'
require 'rubygems/user_interaction'
-require 'cgi'
-require 'thread'
-require 'uri'
+require 'rubygems/request/connection_pools'
require 'resolv'
##
@@ -73,24 +73,15 @@ class Gem::RemoteFetcher
Socket.do_not_reverse_lookup = true
- @connections = {}
- @connections_mutex = Mutex.new
- @requests = Hash.new 0
- @proxy_uri =
- case proxy
- when :no_proxy then nil
- when nil then get_proxy_from_env
- when URI::HTTP then proxy
- else URI.parse(proxy)
- end
- @user_agent = user_agent
- @env_no_proxy = get_no_proxy_from_env
+ @proxy = proxy
+ @pools = {}
+ @pool_lock = Mutex.new
+ @cert_files = Gem::Request.get_cert_files
@dns = dns
end
##
- #
# Given a source at +uri+, calculate what hostname to actually
# connect to query the data for it.
@@ -103,7 +94,7 @@ class Gem::RemoteFetcher
rescue Resolv::ResolvError
uri
else
- URI.parse "#{res.target}#{uri.path}"
+ URI.parse "#{uri.scheme}://#{res.target}#{uri.path}"
end
end
@@ -119,7 +110,7 @@ class Gem::RemoteFetcher
return if found.empty?
- spec, source = found.sort_by { |(s,_)| s.version }.last
+ spec, source = found.max_by { |(s,_)| s.version }
download spec, source.uri.to_s
end
@@ -144,11 +135,19 @@ 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
- 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))
+ # 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
end
scheme = source_uri.scheme
@@ -159,11 +158,10 @@ 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' then
+ when 'http', 'https', 's3' then
unless File.exist? local_gem_path then
begin
- say "Downloading gem #{gem_file_name}" if
- Gem.configuration.really_verbose
+ verbose "Downloading gem #{gem_file_name}"
remote_gem_path = source_uri + "gems/#{gem_file_name}"
@@ -173,8 +171,7 @@ class Gem::RemoteFetcher
alternate_name = "#{spec.original_name}.gem"
- say "Failed, downloading gem #{alternate_name}" if
- Gem.configuration.really_verbose
+ verbose "Failed, downloading gem #{alternate_name}"
remote_gem_path = source_uri + "gems/#{alternate_name}"
@@ -193,8 +190,7 @@ class Gem::RemoteFetcher
local_gem_path = source_uri.to_s
end
- say "Using local gem #{local_gem_path}" if
- Gem.configuration.really_verbose
+ verbose "Using local gem #{local_gem_path}"
when nil then # TODO test for local overriding cache
source_path = if Gem.win_platform? && source_uri.scheme &&
!source_uri.path.include?(':') then
@@ -203,7 +199,7 @@ class Gem::RemoteFetcher
source_uri.path
end
- source_path = unescape source_path
+ source_path = Gem::UriFormatter.new(source_path).unescape
begin
FileUtils.cp source_path, local_gem_path unless
@@ -212,8 +208,7 @@ class Gem::RemoteFetcher
local_gem_path = source_uri.to_s
end
- say "Using local gem #{local_gem_path}" if
- Gem.configuration.really_verbose
+ verbose "Using local gem #{local_gem_path}"
else
raise ArgumentError, "unsupported URI scheme #{source_uri.scheme}"
end
@@ -237,6 +232,7 @@ class Gem::RemoteFetcher
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
@@ -270,7 +266,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
@@ -291,6 +287,11 @@ 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.
@@ -298,19 +299,20 @@ class Gem::RemoteFetcher
def cache_update_path uri, path = nil, update = true
mtime = path && File.stat(path).mtime rescue nil
- if mtime && Net::HTTPNotModified === fetch_path(uri, mtime, true)
- Gem.read_binary(path)
- else
- data = fetch_path(uri)
+ data = fetch_path(uri, mtime)
- if update and path then
- open(path, 'wb') do |io|
- io.write data
- end
- end
+ if data == nil # indicates the server returned 304 Not Modified
+ return Gem.read_binary(path)
+ end
- data
+ if update and path
+ open(path, 'wb') do |io|
+ io.flock(File::LOCK_EX)
+ io.write data
+ end
end
+
+ data
end
##
@@ -322,136 +324,6 @@ class Gem::RemoteFetcher
response['content-length'].to_i
end
- def escape_auth_info(str)
- str && CGI.escape(str)
- end
-
- def unescape_auth_info(str)
- str && CGI.unescape(str)
- end
-
- def escape(str)
- return unless str
- @uri_parser ||= uri_escaper
- @uri_parser.escape str
- end
-
- def unescape(str)
- return unless str
- @uri_parser ||= uri_escaper
- @uri_parser.unescape str
- end
-
- def uri_escaper
- URI::Parser.new
- rescue NameError
- URI
- 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 an HTTP proxy URI if one is set in the environment variables.
-
- def get_proxy_from_env
- env_proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']
-
- return nil if env_proxy.nil? or env_proxy.empty?
-
- uri = URI.parse(normalize_uri(env_proxy))
-
- if uri and uri.user.nil? and uri.password.nil? then
- # Probably we have http_proxy_* variables?
- uri.user = escape_auth_info(ENV['http_proxy_user'] || ENV['HTTP_PROXY_USER'])
- uri.password = escape_auth_info(ENV['http_proxy_pass'] || ENV['HTTP_PROXY_PASS'])
- end
-
- uri
- end
-
- ##
- # Normalize the URI by adding "http://" if it is missing.
-
- def normalize_uri(uri)
- (uri =~ /^(https?|ftp|file):/i) ? uri : "http://#{uri}"
- end
-
- ##
- # Creates or an HTTP connection based on +uri+, or retrieves an existing
- # connection, using a proxy if needed.
-
- def connection_for(uri)
- 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,
- unescape_auth_info(@proxy_uri.user),
- unescape_auth_info(@proxy_uri.password)
- ]
- 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 FetchError.new(e.message, uri)
- end
-
- def configure_connection_for_https(connection)
- require 'net/https'
- connection.use_ssl = true
- connection.verify_mode =
- Gem.configuration.ssl_verify_mode || OpenSSL::SSL::VERIFY_PEER
- store = OpenSSL::X509::Store.new
- 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
- rescue LoadError => e
- raise unless (e.respond_to?(:path) && e.path == 'openssl') ||
- e.message =~ / -- openssl$/
-
- raise Gem::Exception.new(
- 'Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources')
- end
-
- def add_rubygems_trusted_certs(store)
- pattern = File.expand_path("./ssl_certs/*.pem", File.dirname(__FILE__))
- Dir.glob(pattern).each do |ssl_cert_file|
- store.add_file ssl_cert_file
- end
- end
-
def correct_for_windows_path(path)
if path[0].chr == '/' && path[1].chr =~ /[a-z]/i && path[2].chr == ':'
path = path[1..-1]
@@ -460,141 +332,63 @@ class Gem::RemoteFetcher
end
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
-
##
# Performs a Net::HTTP request of type +request_class+ on +uri+ returning
# a Net::HTTP response object. request maintains a table of persistent
# connections to reduce connect overhead.
def request(uri, request_class, last_modified = nil)
- request = request_class.new uri.request_uri
+ proxy = proxy_for @proxy, uri
+ pool = pools_for(proxy).pool_for uri
- unless uri.nil? || uri.user.nil? || uri.user.empty? then
- request.basic_auth uri.user, uri.password
- end
-
- request.add_field 'User-Agent', @user_agent
- request.add_field 'Connection', 'keep-alive'
- request.add_field 'Keep-Alive', '30'
+ request = Gem::Request.new uri, request_class, last_modified, pool
- if last_modified then
- last_modified = last_modified.utc
- request.add_field 'If-Modified-Since', last_modified.rfc2822
+ request.fetch do |req|
+ yield req if block_given?
end
+ end
- yield request if block_given?
-
- connection = connection_for uri
-
- retried = false
- bad_response = false
-
- begin
- @requests[connection.object_id] += 1
-
- say "#{request.method} #{uri}" if
- Gem.configuration.really_verbose
-
- file_name = File.basename(uri.path)
- # perform download progress reporter only for gems
- if request.response_body_permitted? && file_name =~ /\.gem$/
- reporter = ui.download_reporter
- response = connection.request(request) do |incomplete_response|
- if Net::HTTPOK === incomplete_response
- reporter.fetch(file_name, incomplete_response.content_length)
- downloaded = 0
- data = ''
-
- incomplete_response.read_body do |segment|
- data << segment
- downloaded += segment.length
- reporter.update(downloaded)
- end
- reporter.done
- if incomplete_response.respond_to? :body=
- incomplete_response.body = data
- else
- incomplete_response.instance_variable_set(:@body, data)
- end
- end
- end
- else
- response = connection.request request
- end
-
- say "#{response.code} #{response.message}" if
- Gem.configuration.really_verbose
-
- rescue Net::HTTPBadResponse
- say "bad response" if Gem.configuration.really_verbose
-
- reset connection
-
- raise FetchError.new('too many bad responses', uri) if bad_response
-
- bad_response = true
- retry
- # HACK work around EOFError bug in Net::HTTP
- # NOTE Errno::ECONNABORTED raised a lot on Windows, and make impossible
- # to install gems.
- rescue EOFError, Timeout::Error,
- Errno::ECONNABORTED, Errno::ECONNRESET, Errno::EPIPE
-
- requests = @requests[connection.object_id]
- say "connection reset after #{requests} requests, retrying" if
- Gem.configuration.really_verbose
+ def https?(uri)
+ uri.scheme.downcase == 'https'
+ end
- raise FetchError.new('too many connection resets', uri) if retried
+ protected
- reset connection
+ # 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'
- retried = true
- retry
+ unless uri.user && uri.password
+ raise FetchError.new("credentials needed in s3 source, like s3://key:secret@bucket-name/", uri.to_s)
end
- response
+ 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
- ##
- # Resets HTTP connection +connection+.
-
- def reset(connection)
- @requests.delete connection.object_id
-
- connection.finish
- connection.start
+ def s3_expiration
+ (Time.now + 3600).to_i # one hour from now
end
- def user_agent
- ua = "RubyGems/#{Gem::VERSION} #{Gem::Platform.local}"
-
- ruby_version = RUBY_VERSION
- ruby_version += 'dev' if RUBY_PATCHLEVEL == -1
+ BASE64_URI_TRANSLATE = { '+' => '%2B', '/' => '%2F', '=' => '%3D' }.freeze
- ua << " Ruby/#{ruby_version} (#{RUBY_RELEASE_DATE}"
- if RUBY_PATCHLEVEL >= 0 then
- ua << " patchlevel #{RUBY_PATCHLEVEL}"
- elsif defined?(RUBY_REVISION) then
- ua << " revision #{RUBY_REVISION}"
- end
- ua << ")"
+ private
- ua << " #{RUBY_ENGINE}" if defined?(RUBY_ENGINE) and RUBY_ENGINE != 'ruby'
-
- ua
+ def proxy_for proxy, uri
+ Gem::Request.proxy_uri(proxy || Gem::Request.get_proxy_from_env(uri.scheme))
end
- def https?(uri)
- uri.scheme.downcase == 'https'
+ 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
new file mode 100644
index 0000000000..702769c500
--- /dev/null
+++ b/lib/rubygems/request.rb
@@ -0,0 +1,244 @@
+require 'net/http'
+require 'thread'
+require 'time'
+require 'rubygems/user_interaction'
+
+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
+
+ 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)
+ @uri = uri
+ @request_class = request_class
+ @last_modified = last_modified
+ @requests = Hash.new 0
+ @user_agent = user_agent
+
+ @connection_pool = pool
+ end
+
+ def proxy_uri; @connection_pool.proxy_uri; end
+ def cert_files; @connection_pool.cert_files; end
+
+ def self.get_cert_files
+ pattern = File.expand_path("./ssl_certs/*.pem", File.dirname(__FILE__))
+ Dir.glob(pattern)
+ end
+
+ def self.configure_connection_for_https(connection, cert_files)
+ require 'net/https'
+ connection.use_ssl = true
+ connection.verify_mode =
+ Gem.configuration.ssl_verify_mode || OpenSSL::SSL::VERIFY_PEER
+ store = OpenSSL::X509::Store.new
+
+ if Gem.configuration.ssl_client_cert then
+ pem = File.read Gem.configuration.ssl_client_cert
+ connection.cert = OpenSSL::X509::Certificate.new pem
+ 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
+ end
+ connection.cert_store = store
+ connection
+ rescue LoadError => e
+ raise unless (e.respond_to?(:path) && e.path == 'openssl') ||
+ e.message =~ / -- openssl$/
+
+ raise Gem::Exception.new(
+ 'Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources')
+ end
+
+ ##
+ # Creates or an HTTP connection based on +uri+, or retrieves an existing
+ # connection, using a proxy if needed.
+
+ def connection_for(uri)
+ @connection_pool.checkout
+ rescue defined?(OpenSSL::SSL) ? OpenSSL::SSL::SSLError : Errno::EHOSTDOWN,
+ Errno::EHOSTDOWN => e
+ raise Gem::RemoteFetcher::FetchError.new(e.message, uri)
+ end
+
+ def fetch
+ 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
+ end
+
+ request.add_field 'User-Agent', @user_agent
+ request.add_field 'Connection', 'keep-alive'
+ request.add_field 'Keep-Alive', '30'
+
+ if @last_modified then
+ request.add_field 'If-Modified-Since', @last_modified.httpdate
+ end
+
+ 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
+ bad_response = false
+
+ begin
+ @requests[connection.object_id] += 1
+
+ verbose "#{request.method} #{@uri}"
+
+ file_name = File.basename(@uri.path)
+ # perform download progress reporter only for gems
+ if request.response_body_permitted? && file_name =~ /\.gem$/
+ reporter = ui.download_reporter
+ response = connection.request(request) do |incomplete_response|
+ if Net::HTTPOK === incomplete_response
+ reporter.fetch(file_name, incomplete_response.content_length)
+ downloaded = 0
+ data = ''
+
+ incomplete_response.read_body do |segment|
+ data << segment
+ downloaded += segment.length
+ reporter.update(downloaded)
+ end
+ reporter.done
+ if incomplete_response.respond_to? :body=
+ incomplete_response.body = data
+ else
+ incomplete_response.instance_variable_set(:@body, data)
+ end
+ end
+ end
+ else
+ response = connection.request request
+ end
+
+ verbose "#{response.code} #{response.message}"
+
+ rescue Net::HTTPBadResponse
+ verbose "bad response"
+
+ reset connection
+
+ raise Gem::RemoteFetcher::FetchError.new('too many bad responses', @uri) if bad_response
+
+ bad_response = true
+ retry
+ # HACK work around EOFError bug in Net::HTTP
+ # NOTE Errno::ECONNABORTED raised a lot on Windows, and make impossible
+ # to install gems.
+ rescue EOFError, Timeout::Error,
+ Errno::ECONNABORTED, Errno::ECONNRESET, Errno::EPIPE
+
+ requests = @requests[connection.object_id]
+ verbose "connection reset after #{requests} requests, retrying"
+
+ raise Gem::RemoteFetcher::FetchError.new('too many connection resets', @uri) if retried
+
+ reset connection
+
+ retried = true
+ retry
+ end
+
+ response
+ ensure
+ @connection_pool.checkin connection
+ end
+
+ ##
+ # Resets HTTP connection +connection+.
+
+ def reset(connection)
+ @requests.delete connection.object_id
+
+ connection.finish
+ connection.start
+ end
+
+ def user_agent
+ ua = "RubyGems/#{Gem::VERSION} #{Gem::Platform.local}"
+
+ ruby_version = RUBY_VERSION
+ ruby_version += 'dev' if RUBY_PATCHLEVEL == -1
+
+ ua << " Ruby/#{ruby_version} (#{RUBY_RELEASE_DATE}"
+ if RUBY_PATCHLEVEL >= 0 then
+ ua << " patchlevel #{RUBY_PATCHLEVEL}"
+ elsif defined?(RUBY_REVISION) then
+ ua << " revision #{RUBY_REVISION}"
+ end
+ ua << ")"
+
+ ua << " #{RUBY_ENGINE}" if defined?(RUBY_ENGINE) and RUBY_ENGINE != 'ruby'
+
+ ua
+ end
+
+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
new file mode 100644
index 0000000000..27ee99c20d
--- /dev/null
+++ b/lib/rubygems/request/connection_pools.rb
@@ -0,0 +1,79 @@
+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
+
+ 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
+ net_http_args = [uri.host, uri.port]
+
+ no_proxy = get_no_proxy_from_env
+
+ if proxy_uri and not no_proxy?(uri.host, no_proxy) then
+ net_http_args + [
+ proxy_uri.host,
+ proxy_uri.port,
+ Gem::UriFormatter.new(proxy_uri.user).unescape,
+ Gem::UriFormatter.new(proxy_uri.password).unescape,
+ ]
+ elsif no_proxy? uri.host, 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
new file mode 100644
index 0000000000..61c8884af7
--- /dev/null
+++ b/lib/rubygems/request/http_pool.rb
@@ -0,0 +1,38 @@
+##
+# 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
+
+ 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
new file mode 100644
index 0000000000..2e3da0a44e
--- /dev/null
+++ b/lib/rubygems/request/https_pool.rb
@@ -0,0 +1,10 @@
+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 6c52b90c40..d12e06358d 100644
--- a/lib/rubygems/request_set.rb
+++ b/lib/rubygems/request_set.rb
@@ -1,182 +1,374 @@
-require 'rubygems'
-require 'rubygems/dependency'
-require 'rubygems/dependency_resolver'
-require 'rubygems/dependency_list'
-require 'rubygems/installer'
require 'tsort'
-module Gem
- class RequestSet
+##
+# A RequestSet groups a request to activate a set of dependencies.
+#
+# nokogiri = Gem::Dependency.new 'nokogiri', '~> 1.6'
+# pg = Gem::Dependency.new 'pg', '~> 0.14'
+#
+# set = Gem::RequestSet.new nokogiri, pg
+#
+# requests = set.resolve
+#
+# p requests.map { |r| r.full_name }
+# #=> ["nokogiri-1.6.0", "mini_portile-0.5.1", "pg-0.17.0"]
- include TSort
+class Gem::RequestSet
- def initialize(*deps)
- @dependencies = deps
+ include TSort
- yield self if block_given?
- end
+ ##
+ # Array of gems to install even if already installed
- attr_reader :dependencies
+ attr_accessor :always_install
- # Declare that a gem of name +name+ with +reqs+ requirements
- # is needed.
- #
- def gem(name, *reqs)
- @dependencies << Gem::Dependency.new(name, reqs)
- end
+ attr_reader :dependencies
- # Add +deps+ Gem::Depedency objects to the set.
- #
- def import(deps)
- @dependencies += deps
- end
+ attr_accessor :development
- # Resolve the requested dependencies and return an Array of
- # Specification objects to be activated.
- #
- def resolve(set=nil)
- r = Gem::DependencyResolver.new(@dependencies, set)
- @requests = r.resolve
- end
+ ##
+ # Errors fetching gems during resolution.
- # Resolve the requested dependencies against the gems
- # available via Gem.path and return an Array of Specification
- # objects to be activated.
- #
- def resolve_current
- resolve DependencyResolver::CurrentSet.new
- end
+ attr_reader :errors
- # Load a dependency management file.
- #
- def load_gemdeps(path)
- gf = GemDepedencyAPI.new(self, path)
- gf.load
- end
+ ##
+ # 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:
+
+ ##
+ # Treat missing dependencies as silent errors
+
+ attr_accessor :soft_missing
- def specs
- @specs ||= @requests.map { |r| r.full_spec }
+ ##
+ # The set of vendor gems imported via load_gemdeps.
+
+ attr_reader :vendor_set # :nodoc:
+
+ ##
+ # Creates a RequestSet for a list of Gem::Dependency objects, +deps+. You
+ # can then #resolve and #install the resolved list of dependencies.
+ #
+ # nokogiri = Gem::Dependency.new 'nokogiri', '~> 1.6'
+ # pg = Gem::Dependency.new 'pg', '~> 0.14'
+ #
+ # set = Gem::RequestSet.new nokogiri, pg
+
+ 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
+
+ yield self if block_given?
+ end
+
+ ##
+ # Declare that a gem of name +name+ with +reqs+ requirements is needed.
+
+ def gem name, *reqs
+ if dep = @dependency_names[name] then
+ dep.requirement.concat reqs
+ else
+ dep = Gem::Dependency.new name, reqs
+ @dependency_names[name] = dep
+ @dependencies << dep
end
+ end
- def tsort_each_node(&block)
- @requests.each(&block)
+ ##
+ # Add +deps+ Gem::Dependency objects to the set.
+
+ def import deps
+ @dependencies.concat deps
+ end
+
+ ##
+ # Installs gems for this RequestSet using the Gem::Installer +options+.
+ #
+ # If a +block+ is given an activation +request+ and +installer+ are yielded.
+ # The +installer+ will be +nil+ if a gem matching the request was already
+ # installed.
+
+ def install options, &block # :yields: request, installer
+ if dir = options[:install_dir]
+ requests = install_into dir, false, options, &block
+ return requests
end
- def tsort_each_child(node)
- node.spec.dependencies.each do |dep|
- next if dep.type == :development
-
- match = @requests.find { |r| dep.match? r.spec.name, r.spec.version }
- if match
- begin
- yield match
- rescue TSort::Cyclic
- end
- else
- raise Gem::DependencyError, "Unresolved depedency found during sorting - #{dep}"
+ cache_dir = options[:cache_dir] || Gem.dir
+ @prerelease = options[:prerelease]
+
+ requests = []
+
+ sorted_requests.each do |req|
+ if req.installed? then
+ req.spec.spec.build_extensions
+
+ if @always_install.none? { |spec| spec == req.spec.spec } then
+ yield req, nil if block_given?
+ next
end
end
- end
- def sorted_requests
- @sorted ||= strongly_connected_components.flatten
+ path = req.download cache_dir
+
+ inst = Gem::Installer.new path, options
+
+ yield req, inst if block_given?
+
+ requests << inst.install
end
- def specs_in(dir)
- Dir["#{dir}/specifications/*.gemspec"].map do |g|
- Gem::Specification.load g
+ requests
+ ensure
+ raise if $!
+ return requests if options[:gemdeps]
+
+ specs = requests.map do |request|
+ case request
+ when Gem::Resolver::ActivationRequest then
+ request.spec.spec
+ else
+ request
end
end
- def install_into(dir, force=true, &b)
- existing = force ? [] : specs_in(dir)
+ require 'rubygems/dependency_installer'
+ inst = Gem::DependencyInstaller.new options
+ inst.installed_gems.replace specs
- dir = File.expand_path dir
+ Gem.done_installing_hooks.each do |hook|
+ hook.call inst, specs
+ end unless Gem.done_installing_hooks.empty?
+ end
- installed = []
+ ##
+ # Installs from the gem dependencies files in the +:gemdeps+ option in
+ # +options+, yielding to the +block+ as in #install.
+ #
+ # If +:without_groups+ is given in the +options+, those groups in the gem
+ # dependencies file are not used. See Gem::Installer for other +options+.
- sorted_requests.each do |req|
- if existing.find { |s| s.full_name == req.spec.full_name }
- b.call req, nil if b
- next
- end
+ 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]
- path = req.download(dir)
+ gem_deps_api = load_gemdeps gemdeps, options[:without_groups], true
- inst = Gem::Installer.new path, :install_dir => dir,
- :only_install_dir => true
+ resolve
- b.call req, inst if b
+ if options[:explain]
+ puts "Gems to install:"
- inst.install
+ sorted_requests.each do |spec|
+ puts " #{spec.full_name}"
+ end
+
+ if Gem.configuration.really_verbose
+ @resolver.stats.display
+ end
+ else
+ installed = install options, &block
- installed << req
+ if options.fetch :lock, true then
+ lockfile =
+ Gem::RequestSet::Lockfile.new self, gemdeps, gem_deps_api.dependencies
+ lockfile.write
end
installed
end
+ end
- def install(options, &b)
- if dir = options[:install_dir]
- return install_into(dir, false, &b)
- end
+ def install_into dir, force = true, options = {}
+ gem_home, ENV['GEM_HOME'] = ENV['GEM_HOME'], dir
- cache_dir = options[:cache_dir] || Gem.dir
+ existing = force ? [] : specs_in(dir)
+ existing.delete_if { |s| @always_install.include? s }
- specs = []
+ dir = File.expand_path dir
- sorted_requests.each do |req|
- if req.installed?
- b.call req, nil if b
- next
- end
+ installed = []
- path = req.download cache_dir
+ options[:development] = false
+ options[:install_dir] = dir
+ options[:only_install_dir] = true
+ @prerelease = options[:prerelease]
- inst = Gem::Installer.new path, options
+ sorted_requests.each do |request|
+ spec = request.spec
- b.call req, inst if b
+ if existing.find { |s| s.full_name == spec.full_name } then
+ yield request, nil if block_given?
+ next
+ end
- specs << inst.install
+ spec.install options do |installer|
+ yield request, installer if block_given?
end
- specs
+ installed << request
end
- # A semi-compatible DSL for Bundler's Gemfile format
- #
- class GemDepedencyAPI
- def initialize(set, path)
- @set = set
- @path = path
- end
+ installed
+ ensure
+ ENV['GEM_HOME'] = gem_home
+ end
- def load
- instance_eval File.read(@path).untaint, @path, 1
- end
+ ##
+ # Load a dependency management file.
- # DSL
+ def load_gemdeps path, without_groups = [], installing = false
+ @git_set = Gem::Resolver::GitSet.new
+ @vendor_set = Gem::Resolver::VendorSet.new
- def source(url)
- end
+ @git_set.root_dir = @install_dir
- def gem(name, *reqs)
- # Ignore the opts for now.
- reqs.pop if reqs.last.kind_of?(Hash)
+ lockfile = Gem::RequestSet::Lockfile.new self, path
+ lockfile.parse
- @set.gem name, *reqs
- end
+ gf = Gem::RequestSet::GemDependencyAPI.new self, path
+ gf.installing = installing
+ gf.without_groups = without_groups if without_groups
+ gf.load
+ end
- def platform(what)
- if what == :ruby
- yield
- end
+ ##
+ # Resolve the requested dependencies and return an Array of Specification
+ # objects to be activated.
+
+ def resolve set = Gem::Resolver::BestSet.new
+ @sets << set
+ @sets << @git_set
+ @sets << @vendor_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
+
+ @requests = resolver.resolve
- alias_method :platforms, :platform
+ @errors = set.errors
- def group(*what)
+ @requests
+ end
+
+ ##
+ # Resolve the requested dependencies against the gems available via Gem.path
+ # and return an Array of Specification objects to be activated.
+
+ def resolve_current
+ resolve Gem::Resolver::CurrentSet.new
+ end
+
+ def sorted_requests
+ @sorted ||= strongly_connected_components.flatten
+ end
+
+ def specs
+ @specs ||= @requests.map { |r| r.full_spec }
+ end
+
+ def specs_in dir
+ Dir["#{dir}/specifications/*.gemspec"].map do |g|
+ Gem::Specification.load g
+ end
+ end
+
+ def tsort_each_node &block # :nodoc:
+ @requests.each(&block)
+ end
+
+ def tsort_each_child node # :nodoc:
+ 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})"
+ end
+
+ begin
+ yield match
+ rescue TSort::Cyclic
end
end
end
+
end
+
+require 'rubygems/request_set/gem_dependency_api'
+require 'rubygems/request_set/lockfile'
diff --git a/lib/rubygems/request_set/gem_dependency_api.rb b/lib/rubygems/request_set/gem_dependency_api.rb
new file mode 100644
index 0000000000..24179dd1ed
--- /dev/null
+++ b/lib/rubygems/request_set/gem_dependency_api.rb
@@ -0,0 +1,792 @@
+##
+# 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.
+
+class Gem::RequestSet::GemDependencyAPI
+
+ ENGINE_MAP = { # :nodoc:
+ :jruby => %w[jruby],
+ :jruby_18 => %w[jruby],
+ :jruby_19 => %w[jruby],
+ :maglev => %w[maglev],
+ :mri => %w[ruby],
+ :mri_18 => %w[ruby],
+ :mri_19 => %w[ruby],
+ :mri_20 => %w[ruby],
+ :mri_21 => %w[ruby],
+ :rbx => %w[rbx],
+ :ruby => %w[ruby rbx maglev],
+ :ruby_18 => %w[ruby rbx maglev],
+ :ruby_19 => %w[ruby rbx maglev],
+ :ruby_20 => %w[ruby rbx maglev],
+ :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'
+
+ PLATFORM_MAP = { # :nodoc:
+ :jruby => Gem::Platform::RUBY,
+ :jruby_18 => Gem::Platform::RUBY,
+ :jruby_19 => Gem::Platform::RUBY,
+ :maglev => Gem::Platform::RUBY,
+ :mingw => x86_mingw,
+ :mingw_18 => x86_mingw,
+ :mingw_19 => x86_mingw,
+ :mingw_20 => x86_mingw,
+ :mingw_21 => x86_mingw,
+ :mri => Gem::Platform::RUBY,
+ :mri_18 => Gem::Platform::RUBY,
+ :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,
+ :rbx => Gem::Platform::RUBY,
+ :ruby => Gem::Platform::RUBY,
+ :ruby_18 => Gem::Platform::RUBY,
+ :ruby_19 => Gem::Platform::RUBY,
+ :ruby_20 => Gem::Platform::RUBY,
+ :ruby_21 => Gem::Platform::RUBY,
+ :x64_mingw => x64_mingw,
+ :x64_mingw_20 => x64_mingw,
+ :x64_mingw_21 => x64_mingw
+ }
+
+ gt_eq_0 = Gem::Requirement.new '>= 0'
+ tilde_gt_1_8_0 = Gem::Requirement.new '~> 1.8.0'
+ tilde_gt_1_9_0 = Gem::Requirement.new '~> 1.9.0'
+ tilde_gt_2_0_0 = Gem::Requirement.new '~> 2.0.0'
+ tilde_gt_2_1_0 = Gem::Requirement.new '~> 2.1.0'
+
+ VERSION_MAP = { # :nodoc:
+ :jruby => gt_eq_0,
+ :jruby_18 => tilde_gt_1_8_0,
+ :jruby_19 => tilde_gt_1_9_0,
+ :maglev => gt_eq_0,
+ :mingw => gt_eq_0,
+ :mingw_18 => tilde_gt_1_8_0,
+ :mingw_19 => tilde_gt_1_9_0,
+ :mingw_20 => tilde_gt_2_0_0,
+ :mingw_21 => tilde_gt_2_1_0,
+ :mri => gt_eq_0,
+ :mri_18 => tilde_gt_1_8_0,
+ :mri_19 => tilde_gt_1_9_0,
+ :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,
+ :ruby_19 => tilde_gt_1_9_0,
+ :ruby_20 => tilde_gt_2_0_0,
+ :ruby_21 => tilde_gt_2_1_0,
+ :x64_mingw => gt_eq_0,
+ :x64_mingw_20 => tilde_gt_2_0_0,
+ :x64_mingw_21 => tilde_gt_2_1_0,
+ }
+
+ WINDOWS = { # :nodoc:
+ :mingw => :only,
+ :mingw_18 => :only,
+ :mingw_19 => :only,
+ :mingw_20 => :only,
+ :mingw_21 => :only,
+ :mri => :never,
+ :mri_18 => :never,
+ :mri_19 => :never,
+ :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,
+ :ruby_19 => :never,
+ :ruby_20 => :never,
+ :ruby_21 => :never,
+ :x64_mingw => :only,
+ :x64_mingw_20 => :only,
+ :x64_mingw_21 => :only,
+ }
+
+ ##
+ # 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:
+
+ ##
+ # A Hash containing gem names and files to require from those gems.
+
+ attr_reader :requires # :nodoc:
+
+ ##
+ # A set of gems that are loaded via the +:path+ option to #gem
+
+ attr_reader :vendor_set # :nodoc:
+
+ ##
+ # The groups of gems to exclude from installation
+
+ attr_accessor :without_groups # :nodoc:
+
+ ##
+ # Creates a new GemDependencyAPI that will add dependencies to the
+ # Gem::RequestSet +set+ based on the dependency API description in +path+.
+
+ def initialize set, path
+ @set = set
+ @path = path
+
+ @current_groups = nil
+ @current_platforms = 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
+ @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
+
+ ##
+ # Adds +dependencies+ to the request set if any of the +groups+ are allowed.
+ # This is used for gemspec dependencies.
+
+ def add_dependencies groups, dependencies # :nodoc:
+ return unless (groups & @without_groups).empty?
+
+ dependencies.each do |dep|
+ @set.gem dep.name, *dep.requirement
+ end
+ end
+
+ private :add_dependencies
+
+ ##
+ # Finds a gemspec with the given +name+ that lives at +path+.
+
+ def find_gemspec name, path # :nodoc:
+ glob = File.join path, "#{name}.gemspec"
+
+ spec_files = Dir[glob]
+
+ case spec_files.length
+ when 1 then
+ spec_file = spec_files.first
+
+ spec = Gem::Specification.load spec_file
+
+ return spec if spec
+
+ raise ArgumentError, "invalid gemspec #{spec_file}"
+ when 0 then
+ raise ArgumentError, "no gemspecs found at #{Dir.pwd}"
+ else
+ raise ArgumentError,
+ "found multiple gemspecs at #{Dir.pwd}, " +
+ "use the name: option to specify the one you want"
+ end
+ 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.
+
+ def load
+ instance_eval File.read(@path).untaint, @path, 1
+
+ self
+ end
+
+ ##
+ # :category: Gem Dependencies DSL
+ #
+ # :call-seq:
+ # gem(name)
+ # gem(name, *requirements)
+ # gem(name, *requirements, options)
+ #
+ # 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)
+ options ||= {}
+
+ options[:git] = @current_repository if @current_repository
+
+ source_set = false
+
+ source_set ||= gem_path name, options
+ source_set ||= gem_git name, options
+ source_set ||= gem_git_source name, options
+
+ duplicate = @dependencies.include? name
+
+ @dependencies[name] =
+ if requirements.empty? and not source_set then
+ nil
+ elsif source_set then
+ '!'
+ else
+ requirements
+ end
+
+ return unless gem_platforms options
+
+ groups = gem_group name, options
+
+ return unless (groups & @without_groups).empty?
+
+ pin_gem_source name, :default unless source_set
+
+ gem_requires name, options
+
+ if duplicate then
+ warn <<-WARNING
+Gem dependencies file #{@path} requires #{name} more than once.
+ WARNING
+ end
+
+ @set.gem name, *requirements
+ end
+
+ ##
+ # Handles the git: option from +options+ for gem +name+.
+ #
+ # Returns +true+ if the path option was handled.
+
+ def gem_git name, options # :nodoc:
+ if gist = options.delete(:gist) then
+ options[:git] = "https://gist.github.com/#{gist}.git"
+ end
+
+ return unless repository = options.delete(:git)
+
+ pin_gem_source name, :git, repository
+
+ 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
+
+ private :gem_git
+
+ ##
+ # Handles a git gem option from +options+ for gem +name+ for a git source
+ # registered through git_source.
+ #
+ # 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
+
+ git_url = source_callback.call source_param
+
+ options[:git] = git_url
+
+ gem_git name, options
+
+ true
+ end
+
+ private :gem_git_source
+
+ ##
+ # Handles the :group and :groups +options+ for the gem with the given
+ # +name+.
+
+ def gem_group name, options # :nodoc:
+ g = options.delete :group
+ all_groups = g ? Array(g) : []
+
+ groups = options.delete :groups
+ all_groups |= groups if groups
+
+ all_groups |= @current_groups if @current_groups
+
+ all_groups
+ end
+
+ private :gem_group
+
+ ##
+ # Handles the path: option from +options+ for gem +name+.
+ #
+ # Returns +true+ if the path option was handled.
+
+ def gem_path name, options # :nodoc:
+ return unless directory = options.delete(:path)
+
+ pin_gem_source name, :path, directory
+
+ @vendor_set.add_vendor_gem name, directory
+
+ true
+ end
+
+ 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
+
+ return true if platform_names.empty?
+
+ platform_names.any? do |platform_name|
+ raise ArgumentError, "unknown platform #{platform_name.inspect}" unless
+ platform = PLATFORM_MAP[platform_name]
+
+ next false unless Gem::Platform.match platform
+
+ if engines = ENGINE_MAP[platform_name] then
+ next false unless engines.include? Gem.ruby_engine
+ end
+
+ case WINDOWS[platform_name]
+ when :only then
+ next false unless Gem.win_platform?
+ when :never then
+ next false if Gem.win_platform?
+ end
+
+ VERSION_MAP[platform_name].satisfied_by? Gem.ruby_version
+ end
+ end
+
+ private :gem_platforms
+
+ ##
+ # Records 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:
+ if options.include? :require then
+ if requires = options.delete(:require) then
+ @requires[name].concat Array requires
+ end
+ else
+ @requires[name] << name
+ end
+ end
+
+ private :gem_requires
+
+ ##
+ # :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
+
+ yield
+
+ ensure
+ @current_repository = nil
+ 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:
+ File.basename @path
+ end
+
+ ##
+ # :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) || '{,*}'
+ path = options.delete(:path) || '.'
+ development_group = options.delete(:development_group) || :development
+
+ spec = find_gemspec name, path
+
+ groups = gem_group spec.name, {}
+
+ add_dependencies groups, spec.runtime_dependencies
+
+ groups << development_group
+
+ add_dependencies groups, spec.development_dependencies
+
+ 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
+
+ yield
+
+ ensure
+ @current_groups = nil
+ 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}"
+ 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.
+
+ def platform *platforms
+ @current_platforms = platforms
+
+ yield
+
+ ensure
+ @current_platforms = nil
+ end
+
+ ##
+ # :category: Gem Dependencies DSL
+ #
+ # Block form for restricting gems to a particular set of platforms. See
+ # #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).
+
+ def ruby version, options = {}
+ engine = options[:engine]
+ engine_version = options[:engine_version]
+
+ raise ArgumentError,
+ '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}"
+
+ raise Gem::RubyVersionMismatch, message
+ end
+
+ if engine and engine != Gem.ruby_engine then
+ message = "Your ruby engine is #{Gem.ruby_engine}, " +
+ "but your #{gem_deps_file} requires #{engine}"
+
+ raise Gem::RubyVersionMismatch, message
+ end
+
+ if engine_version then
+ my_engine_version = Object.const_get "#{Gem.ruby_engine.upcase}_VERSION"
+
+ if engine_version != my_engine_version then
+ message =
+ "Your ruby engine version is #{Gem.ruby_engine} #{my_engine_version}, " +
+ "but your #{gem_deps_file} requires #{engine} #{engine_version}"
+
+ raise Gem::RubyVersionMismatch, message
+ end
+ end
+
+ return true
+ end
+
+ ##
+ # :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.
+
+ def source url
+ Gem.sources.clear if @default_sources
+
+ @default_sources = false
+
+ Gem.sources << url
+ end
+
+ # TODO: remove this typo name at RubyGems 3.0
+
+ Gem::RequestSet::GemDepedencyAPI = self # :nodoc:
+
+end
+
diff --git a/lib/rubygems/request_set/lockfile.rb b/lib/rubygems/request_set/lockfile.rb
new file mode 100644
index 0000000000..2901dba871
--- /dev/null
+++ b/lib/rubygems/request_set/lockfile.rb
@@ -0,0 +1,633 @@
+require 'strscan'
+
+##
+# 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
+
+ class ParseError < Gem::Exception
+
+ ##
+ # The column where the error was encountered
+
+ attr_reader :column
+
+ ##
+ # The line where the error was encountered
+
+ attr_reader :line
+
+ ##
+ # The location of the lock file
+
+ attr_reader :path
+
+ ##
+ # Raises a ParseError with the given +message+ which was encountered at a
+ # +line+ and +column+ while parsing.
+
+ def initialize message, column, line, path
+ @line = line
+ @column = column
+ @path = path
+ super "#{message} (at line #{line} column #{column})"
+ end
+
+ end
+
+ ##
+ # The platforms for this Lockfile
+
+ attr_reader :platforms
+
+ ##
+ # Creates a new Lockfile for the given +request_set+ and +gem_deps_file+
+ # location.
+
+ def initialize request_set, gem_deps_file, dependencies = nil
+ @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"
+
+ dependencies =
+ if @dependencies then
+ @dependencies.sort_by { |name,| name }.map do |name, requirement|
+ requirement_string =
+ if '!' == requirement then
+ requirement
+ else
+ Gem::Requirement.new(requirement).for_lockfile
+ end
+
+ [name, requirement_string]
+ end
+ else
+ @requests.sort_by { |r| r.name }.map do |request|
+ spec = request.spec
+ name = request.name
+ requirement = request.request.dependency.requirement
+
+ requirement_string =
+ if [Gem::Resolver::VendorSpecification,
+ Gem::Resolver::GitSpecification].include? spec.class then
+ "!"
+ else
+ requirement.for_lockfile
+ end
+
+ [name, requirement_string]
+ end
+ end
+
+ dependencies = dependencies.map do |name, requirement_string|
+ " #{name}#{requirement_string}"
+ end
+
+ out.concat dependencies
+
+ out << nil
+ end
+
+ def add_GEM out # :nodoc:
+ return if @spec_groups.empty?
+
+ 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"
+ 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
+ return unless git_requests =
+ @spec_groups.delete(Gem::Resolver::GitSpecification)
+
+ by_repository_revision = git_requests.group_by do |request|
+ source = request.spec.source
+ [source.repository, source.rev_parse]
+ end
+
+ out << "GIT"
+ by_repository_revision.each do |(repository, revision), requests|
+ 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
+ end
+
+ out << nil
+ end
+
+ def relative_path_from dest, base # :nodoc:
+ dest = File.expand_path(dest)
+ base = File.expand_path(base)
+
+ if dest.index(base) == 0
+ return dest[base.size+1..-1]
+ else
+ dest
+ end
+ end
+
+ def add_PATH out # :nodoc:
+ return unless path_requests =
+ @spec_groups.delete(Gem::Resolver::VendorSpecification)
+
+ out << "PATH"
+ path_requests.each do |request|
+ directory = File.expand_path(request.spec.source.uri)
+
+ out << " remote: #{relative_path_from directory, @gem_deps_dir}"
+ out << " specs:"
+ out << " #{request.name} (#{request.version})"
+ end
+
+ out << nil
+ end
+
+ def add_PLATFORMS out # :nodoc:
+ out << "PLATFORMS"
+
+ platforms = @requests.map { |request| request.spec.platform }.uniq
+
+ platforms.sort.each do |platform|
+ out << " #{platform}"
+ end
+
+ out << nil
+ end
+
+ ##
+ # Gets the next token for a Lockfile
+
+ def get expected_types = nil, expected_value = nil # :nodoc:
+ @current_token = @tokens.shift
+
+ type, value, column, line = @current_token
+
+ if expected_types and not Array(expected_types).include? type then
+ unget
+
+ message = "unexpected token [#{type.inspect}, #{value.inspect}], " +
+ "expected #{expected_types.inspect}"
+
+ raise ParseError.new message, column, line, "#{@gem_deps_file}.lock"
+ end
+
+ if expected_value and expected_value != value then
+ unget
+
+ message = "unexpected token [#{type.inspect}, #{value.inspect}], " +
+ "expected [#{expected_types.inspect}, " +
+ "#{expected_value.inspect}]"
+
+ raise ParseError.new message, column, line, "#{@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 'GIT' then
+ parse_GIT
+ when 'GEM' then
+ parse_GEM
+ when 'PATH' then
+ parse_PATH
+ 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 #{line} column #{column}"
+ end
+ end
+ end
+
+ def parse_DEPENDENCIES # :nodoc:
+ while not @tokens.empty? and :text == peek.first do
+ _, name, = get :text
+
+ requirements = []
+
+ case peek[0]
+ when :bang then
+ get :bang
+
+ spec = @set.sets.select { |set|
+ Gem::Resolver::GitSet === set or
+ Gem::Resolver::VendorSet === set
+ }.map { |set|
+ set.specs[name]
+ }.compact.first
+
+ requirements << spec.version
+ when :l_paren then
+ get :l_paren
+
+ loop do
+ _, op, = get :requirement
+ _, version, = get :text
+
+ requirements << "#{op} #{version}"
+
+ break unless peek[0] == :comma
+
+ get :comma
+ end
+
+ get :r_paren
+ end
+
+ @set.gem name, *requirements
+
+ skip :newline
+ end
+ end
+
+ def parse_GEM # :nodoc:
+ sources = []
+
+ while [:entry, 'remote'] == peek.first(2) do
+ get :entry, 'remote'
+ _, data, = get :text
+ 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.first do
+ _, name, column, = get :text
+
+ 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
+
+ type, data, = get [:text, :requirement]
+
+ 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
+
+ skip :newline
+
+ get :entry, 'revision'
+ _, revision, = get :text
+
+ skip :newline
+
+ type, value = peek.first 2
+ 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.first do
+ _, name, column, = get :text
+
+ case peek[0]
+ when :newline then
+ last_spec.add_dependency Gem::Dependency.new name if column == 6
+ when :l_paren then
+ get :l_paren
+
+ type, data, = get [:text, :requirement]
+
+ 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
+
+ skip :newline
+
+ get :entry, 'specs'
+
+ skip :newline
+
+ set = Gem::Resolver::VendorSet.new
+ last_spec = nil
+
+ while not @tokens.empty? and :text == peek.first do
+ _, name, column, = get :text
+
+ case peek[0]
+ when :newline then
+ last_spec.add_dependency Gem::Dependency.new name if column == 6
+ when :l_paren then
+ get :l_paren
+
+ type, data, = get [:text, :requirement]
+
+ 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
+
+ @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
+
+ requirements = ["#{op} #{version}"]
+
+ while peek[0] == :comma do
+ get :comma
+ _, op, = get :requirement
+ _, version, = get :text
+
+ requirements << "#{op} #{version}"
+ end
+
+ Gem::Dependency.new name, requirements
+ end
+
+ ##
+ # Peeks at the next token for Lockfile
+
+ def peek # :nodoc:
+ @tokens.first || [:EOF]
+ end
+
+ def skip type # :nodoc:
+ get while not @tokens.empty? and peek.first == type
+ end
+
+ ##
+ # The contents of the lock file.
+
+ def to_s
+ @set.resolve
+
+ out = []
+
+ @requests = @set.sorted_requests
+
+ @spec_groups = @requests.group_by do |request|
+ request.spec.class
+ end
+
+ add_PATH out
+
+ add_GIT out
+
+ add_GEM out
+
+ add_PLATFORMS out
+
+ add_DEPENDENCIES out
+
+ out.join "\n"
+ 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
+
+ ##
+ # Converts a lock file into an Array of tokens. If the lock file is missing
+ # an empty Array is returned.
+
+ def tokenize # :nodoc:
+ @line = 0
+ @line_pos = 0
+
+ @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
+
+ pos = s.pos if leading_whitespace = s.scan(/ +/)
+
+ if s.scan(/[<|=>]{7}/) then
+ message = "your #{lock_file} contains merge conflict markers"
+ column, line = token_pos pos
+
+ raise ParseError.new message, column, line, 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
+ if leading_whitespace then
+ text = s.matched
+ text += s.scan(/[^\s)]*/).to_s # in case of no match
+ [:text, text, *token_pos(pos)]
+ else
+ [:section, s.matched, *token_pos(pos)]
+ end
+ 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(/<=|>=|=|~>|<|>|!=/) then
+ [:requirement, s.matched, *token_pos(pos)]
+ when s.scan(/,/) then
+ [:comma, nil, *token_pos(pos)]
+ when s.scan(/!/) then
+ [:bang, 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
+ rescue Errno::ENOENT
+ @tokens
+ end
+
+ ##
+ # Ungets the last token retrieved by #get
+
+ def unget # :nodoc:
+ @tokens.unshift @current_token
+ end
+
+ ##
+ # Writes the lock file alongside the gem dependencies file
+
+ def write
+ content = to_s
+
+ open "#{@gem_deps_file}.lock", 'w' do |io|
+ io.write content
+ end
+ end
+
+end
+
diff --git a/lib/rubygems/requirement.rb b/lib/rubygems/requirement.rb
index ed768924a8..8b6a81612c 100644
--- a/lib/rubygems/requirement.rb
+++ b/lib/rubygems/requirement.rb
@@ -1,13 +1,3 @@
-##
-# A Requirement is a set of one or more version restrictions. It supports a
-# few (<tt>=, !=, >, <, >=, <=, ~></tt>) different restriction operators.
-
-# REFACTOR: The fact that a requirement is singular or plural is kind of
-# awkward. Is Requirement the right name for this? Or should it be one
-# [op, number] pair, and we call the list of requirements something else?
-# Since a Requirement is held by a Dependency, maybe this should be made
-# singular and the list aspect should be pulled up into Dependency?
-
require "rubygems/version"
require "rubygems/deprecate"
@@ -15,6 +5,13 @@ require "rubygems/deprecate"
# load our yaml + workarounds now.
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:
"=" => lambda { |v, r| v == r },
@@ -27,11 +24,21 @@ class Gem::Requirement
}
quoted = OPS.keys.map { |k| Regexp.quote k }.join "|"
- PATTERN_RAW = "\\s*(#{quoted})?\\s*(#{Gem::Version::VERSION_PATTERN})\\s*"
+ PATTERN_RAW = "\\s*(#{quoted})?\\s*(#{Gem::Version::VERSION_PATTERN})\\s*" # :nodoc:
+
+ ##
+ # A regular expression that matches a requirement
+
PATTERN = /\A#{PATTERN_RAW}\z/
+ ##
+ # The default requirement matches any version
+
DefaultRequirement = [">=", Gem::Version.new(0)]
+ ##
+ # Raised when a bad requirement is encountered
+
class BadRequirementError < ArgumentError; end
##
@@ -41,9 +48,6 @@ class Gem::Requirement
# If the input is "weird", the default version requirement is
# returned.
- # REFACTOR: There's no reason that this can't be unified with .new.
- # .new is the standard Ruby factory method.
-
def self.create input
case input
when Gem::Requirement then
@@ -78,11 +82,6 @@ class Gem::Requirement
# parse("1.0") # => ["=", "1.0"]
# parse(Gem::Version.new("1.0")) # => ["=, "1.0"]
- # REFACTOR: Little two element arrays like this have no real semantic
- # value. I'd love to see something like this:
- # Constraint = Struct.new(:operator, :version); (or similar)
- # and have a Requirement be a list of Constraints.
-
def self.parse obj
return ["=", obj] if Gem::Version === obj
@@ -122,9 +121,35 @@ class Gem::Requirement
end
##
+ # Concatenates the +new+ requirements onto this requirement.
+
+ def concat new
+ new = new.flatten
+ new.compact!
+ new.uniq!
+ new = new.map { |r| self.class.parse r }
+
+ @requirements.concat new
+ end
+
+ ##
+ # 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 ', '})"
+ end
+
+ ##
# true if this gem has no requirements.
- # FIX: maybe this should be using #default ?
def none?
if @requirements.size == 1
@requirements[0] == DefaultRequirement
@@ -133,6 +158,14 @@ 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
@@ -166,11 +199,11 @@ class Gem::Requirement
yaml_initialize coder.tag, coder.map
end
- def to_yaml_properties
+ def to_yaml_properties # :nodoc:
["@requirements"]
end
- def encode_with(coder)
+ def encode_with coder # :nodoc:
coder.add 'requirements', @requirements
end
@@ -214,15 +247,13 @@ class Gem::Requirement
as_list.join ", "
end
- # DOC: this should probably be :nodoc'd
- def == other
+ def == other # :nodoc:
Gem::Requirement === other and to_s == other.to_s
end
private
- # DOC: this should probably be :nodoc'd
- def fix_syck_default_key_in_requirements
+ def fix_syck_default_key_in_requirements # :nodoc:
Gem.load_yaml
# Fixup the Syck DefaultKey bug
@@ -234,9 +265,9 @@ class Gem::Requirement
end
end
-# This is needed for compatibility with older yaml
-# gemspecs.
-
class Gem::Version
- Requirement = Gem::Requirement
+ # This is needed for compatibility with older yaml
+ # gemspecs.
+
+ Requirement = Gem::Requirement # :nodoc:
end
diff --git a/lib/rubygems/resolver.rb b/lib/rubygems/resolver.rb
new file mode 100644
index 0000000000..ef17d682ac
--- /dev/null
+++ b/lib/rubygems/resolver.rb
@@ -0,0 +1,485 @@
+require 'rubygems/dependency'
+require 'rubygems/exceptions'
+require 'rubygems/util/list'
+
+require 'uri'
+require 'net/http'
+
+##
+# Given a set of Gem::Dependency objects as +needed+ and a way to query the
+# set of available specs via +set+, calculates a set of ActivationRequest
+# objects which indicate all the specs that should be activated to meet the
+# all the requirements.
+
+class Gem::Resolver
+
+ ##
+ # 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.
+
+ DEBUG_RESOLVER = !ENV['DEBUG_RESOLVER'].nil?
+
+ require 'pp' if DEBUG_RESOLVER
+
+ ##
+ # Contains all the conflicts encountered while doing resolution
+
+ attr_reader :conflicts
+
+ ##
+ # Set to true if all development dependencies should be considered.
+
+ 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.
+
+ attr_accessor :soft_missing
+
+ ##
+ # Combines +sets+ into a ComposedSet that allows specification lookup in a
+ # uniform manner. If one of the +sets+ is itself a ComposedSet its sets are
+ # flattened into the result ComposedSet.
+
+ def self.compose_sets *sets
+ sets.compact!
+
+ sets = sets.map do |set|
+ case set
+ when Gem::Resolver::BestSet then
+ set
+ when Gem::Resolver::ComposedSet then
+ set.sets
+ else
+ set
+ end
+ end.flatten
+
+ case sets.length
+ when 0 then
+ raise ArgumentError, 'one set in the composition must be non-nil'
+ when 1 then
+ sets.first
+ else
+ Gem::Resolver::ComposedSet.new(*sets)
+ end
+ end
+
+ ##
+ # Creates a Resolver that queries only against the already installed gems
+ # for the +needed+ dependencies.
+
+ def self.for_current_gems needed
+ new needed, Gem::Resolver::CurrentSet.new
+ end
+
+ ##
+ # Create Resolver object which will resolve the tree starting
+ # with +needed+ Dependency objects.
+ #
+ # +set+ is an object that provides where to look for specifications to
+ # satisfy the Dependencies. This defaults to IndexSet, which will query
+ # rubygems.org.
+
+ def initialize needed, set = nil
+ @set = set || Gem::Resolver::IndexSet.new
+ @needed = needed
+
+ @conflicts = []
+ @development = false
+ @development_shallow = false
+ @ignore_dependencies = false
+ @missing = []
+ @skip_gems = {}
+ @soft_missing = false
+ @stats = Gem::Resolver::Stats.new
+ end
+
+ def explain stage, *data # :nodoc:
+ return unless DEBUG_RESOLVER
+
+ d = data.map { |x| x.pretty_inspect }.join(", ")
+ $stderr.printf "%10s %s\n", stage.to_s.upcase, d
+ 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?
+ end
+
+ ##
+ # Creates an ActivationRequest for the given +dep+ and the last +possible+
+ # specification.
+ #
+ # Returns the Specification and the ActivationRequest
+
+ def activation_request dep, possible # :nodoc:
+ spec = possible.pop
+
+ explain :activate, [spec.full_name, possible.size]
+ explain :possible, possible
+
+ activation_request =
+ Gem::Resolver::ActivationRequest.new spec, dep, possible
+
+ return spec, activation_request
+ end
+
+ def requests s, act, reqs=nil # :nodoc:
+ return reqs if @ignore_dependencies
+
+ s.fetch_development_dependencies if @development
+
+ 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.add Gem::Resolver::DependencyRequest.new(d, act)
+ @stats.requirement!
+ end
+
+ @set.prefetch reqs
+
+ @stats.record_requirements reqs
+
+ reqs
+ end
+
+ ##
+ # Proceed with resolution! Returns an array of ActivationRequest objects.
+
+ def resolve
+ @conflicts = []
+
+ needed = Gem::Resolver::RequirementList.new
+
+ @needed.reverse_each do |n|
+ request = Gem::Resolver::DependencyRequest.new n, nil
+
+ needed.add request
+ @stats.requirement!
+ end
+
+ @stats.record_requirements needed
+
+ res = resolve_for needed, nil
+
+ raise Gem::DependencyResolutionError, res if
+ res.kind_of? Gem::Resolver::Conflict
+
+ res.to_a
+ end
+
+ ##
+ # Extracts the specifications that may be able to fulfill +dependency+ and
+ # returns those that match the local platform and all those that match.
+
+ def find_possible dependency # :nodoc:
+ all = @set.find_all dependency
+
+ 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
+
+ all = matching unless matching.empty?
+ end
+
+ matching_platform = select_local_platforms all
+
+ return matching_platform, all
+ end
+
+ def handle_conflict(dep, existing) # :nodoc:
+ # 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
+
+ @conflicts << conflict unless @conflicts.include? conflict
+
+ return conflict
+ end
+
+ # 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
+
+ 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
+
+ ##
+ # 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 # :nodoc:
+ # The State objects that are used to attempt the activation tree.
+ states = []
+
+ while !needed.empty?
+ @stats.iteration!
+
+ 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
+
+ return conflict unless dep.requester
+
+ explain :conflict, dep, :existing, existing.full_name
+
+ depreq = dep.requester.request
+
+ state = nil
+ until states.empty?
+ x = states.pop
+
+ i = existing.request.requester
+ explain :consider, x.spec.full_name, [depreq.name, dep.name, i ? i.name : :top]
+
+ if x.spec.name == depreq.name or
+ x.spec.name == dep.name or
+ (i && (i.name == x.spec.name))
+ explain :found, x.spec.full_name
+ state = x
+ break
+ end
+ end
+
+ return conflict unless state
+
+ @stats.backtracking!
+
+ 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
+
+ specs
+ end
+
+ ##
+ # 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
+
+ ##
+ # 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, [])
+
+ @stats.record_depth states
+
+ explain :states, states.map { |s| s.dep }
+
+ needed = requests spec, act, needed
+ specs = Gem::List.prepend specs, act
+
+ return needed, specs
+ end
+
+ ##
+ # 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
+
+ ##
+ # 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
+ exc = Gem::UnsatisfiableDependencyError.new dep, platform_mismatch
+ exc.errors = @set.errors
+
+ raise exc
+ 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
+
+##
+# TODO remove in RubyGems 3
+
+Gem::DependencyResolver = Gem::Resolver # :nodoc:
+
+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'
+require 'rubygems/resolver/composed_set'
+require 'rubygems/resolver/best_set'
+require 'rubygems/resolver/current_set'
+require 'rubygems/resolver/git_set'
+require 'rubygems/resolver/index_set'
+require 'rubygems/resolver/installer_set'
+require 'rubygems/resolver/lock_set'
+require 'rubygems/resolver/vendor_set'
+
+require 'rubygems/resolver/specification'
+require 'rubygems/resolver/spec_specification'
+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
new file mode 100644
index 0000000000..56c6363e4f
--- /dev/null
+++ b/lib/rubygems/resolver/activation_request.rb
@@ -0,0 +1,172 @@
+##
+# 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
+ @spec = spec
+ @request = request
+ @others_possible = others_possible
+ end
+
+ def == other # :nodoc:
+ case other
+ when Gem::Specification
+ @spec == other
+ when Gem::Resolver::ActivationRequest
+ @spec == other.spec && @request == other.request
+ else
+ false
+ 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
+ if @spec.respond_to? :source
+ source = @spec.source
+ else
+ source = Gem.sources.first
+ end
+
+ Gem.ensure_gem_subdirectories path
+
+ source.download full_spec, path
+ end
+
+ ##
+ # The full name of the specification to be activated.
+
+ def full_name
+ @spec.full_name
+ end
+
+ ##
+ # The Gem::Specification for this activation request.
+
+ def full_spec
+ Gem::Specification === @spec ? @spec : @spec.spec
+ end
+
+ def inspect # :nodoc:
+ others =
+ case @others_possible
+ when true then # TODO remove at RubyGems 3
+ ' (others possible)'
+ when false then # TODO remove at RubyGems 3
+ nil
+ else
+ unless @others_possible.empty? then
+ others = @others_possible.map { |s| s.full_name }
+ " (others possible: #{others.join ', '})"
+ end
+ end
+
+ '#<%s for %p from %s%s>' % [
+ self.class, @spec, @request, others
+ ]
+ end
+
+ ##
+ # True if the requested gem has already been installed.
+
+ def installed?
+ case @spec
+ when Gem::Resolver::VendorSpecification then
+ true
+ else
+ this_spec = full_spec
+
+ Gem::Specification.any? do |s|
+ s == this_spec
+ end
+ end
+ end
+
+ ##
+ # The name of this activation request's specification
+
+ def name
+ @spec.name
+ end
+
+ ##
+ # Indicate if this activation is one of a set of possible
+ # requests for the same Dependency request.
+
+ def others_possible?
+ case @others_possible
+ when true, false then
+ @others_possible
+ else
+ not @others_possible.empty?
+ end
+ end
+
+ ##
+ # Return the ActivationRequest that contained the dependency
+ # that we were activated for.
+
+ def parent
+ @request.requester
+ end
+
+ def pretty_print q # :nodoc:
+ q.group 2, '[Activation request', ']' do
+ q.breakable
+ q.pp @spec
+
+ q.breakable
+ q.text ' for '
+ q.pp @request
+
+ case @others_possible
+ when false then
+ when true then
+ q.breakable
+ q.text 'others possible'
+ else
+ unless @others_possible.empty? then
+ q.breakable
+ q.text 'others '
+ q.pp @others_possible.map { |s| s.full_name }
+ end
+ end
+ 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
new file mode 100644
index 0000000000..dda3579878
--- /dev/null
+++ b/lib/rubygems/resolver/api_set.rb
@@ -0,0 +1,125 @@
+##
+# The global rubygems pool, available via the rubygems.org API.
+# Returns instances of APISpecification.
+
+class Gem::Resolver::APISet < Gem::Resolver::Set
+
+ ##
+ # The URI for the dependency API this APISet uses.
+
+ attr_reader :dep_uri # :nodoc:
+
+ ##
+ # The Gem::Source that gems are fetched from
+
+ attr_reader :source
+
+ ##
+ # The corresponding place to fetch gems.
+
+ attr_reader :uri
+
+ ##
+ # Creates a new APISet that will retrieve gems from +uri+ using the RubyGems
+ # API URL +dep_uri+ which is described at
+ # 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 + '../..'
+
+ @data = Hash.new { |h,k| h[k] = [] }
+ @source = Gem::Source.new @uri
+
+ @to_fetch = []
+ end
+
+ ##
+ # Return an array of APISpecification objects matching
+ # DependencyRequest +req+.
+
+ 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)
+ end
+ end
+
+ res
+ end
+
+ ##
+ # A hint run by the resolver to allow the Set to fetch
+ # 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
+
+ def prefetch_now
+ needed, @to_fetch = @to_fetch, []
+
+ uri = @dep_uri + "?gems=#{needed.sort.join ','}"
+ str = Gem::RemoteFetcher.fetcher.fetch_path uri
+
+ loaded = []
+
+ Marshal.load(str).each do |ver|
+ name = ver[:name]
+
+ @data[name] << ver
+ loaded << name
+ end
+
+ (needed - loaded).each do |missing|
+ @data[missing] = []
+ end
+ end
+
+ def pretty_print q # :nodoc:
+ q.group 2, '[APISet', ']' do
+ q.breakable
+ q.text "URI: #{@dep_uri}"
+
+ q.breakable
+ q.text 'gem names:'
+ q.pp @data.keys
+ end
+ end
+
+ ##
+ # Return data for all versions of the gem +name+.
+
+ def versions name # :nodoc:
+ if @data.key?(name)
+ return @data[name]
+ end
+
+ uri = @dep_uri + "?gems=#{name}"
+ str = Gem::RemoteFetcher.fetcher.fetch_path uri
+
+ Marshal.load(str).each do |ver|
+ @data[ver[:name]] << ver
+ end
+
+ @data[name]
+ end
+
+end
+
diff --git a/lib/rubygems/resolver/api_specification.rb b/lib/rubygems/resolver/api_specification.rb
new file mode 100644
index 0000000000..bbd5a6427b
--- /dev/null
+++ b/lib/rubygems/resolver/api_specification.rb
@@ -0,0 +1,85 @@
+##
+# Represents a specification retrieved via the rubygems.org API.
+#
+# This is used to avoid loading the full Specification object when all we need
+# is the name, version, and dependencies.
+
+class Gem::Resolver::APISpecification < Gem::Resolver::Specification
+
+ ##
+ # Creates an APISpecification for the given +set+ from the rubygems.org
+ # +api_data+.
+ #
+ # See http://guides.rubygems.org/rubygems-org-api/#misc_methods for the
+ # format of the +api_data+.
+
+ def initialize(set, api_data)
+ super()
+
+ @set = set
+ @name = api_data[:name]
+ @version = Gem::Version.new api_data[:number]
+ @platform = api_data[:platform]
+ @dependencies = api_data[:dependencies].map do |name, ver|
+ Gem::Dependency.new name, ver.split(/\s*,\s*/)
+ end
+ end
+
+ def == other # :nodoc:
+ self.class === other and
+ @set == other.set and
+ @name == other.name and
+ @version == other.version and
+ @platform == other.platform and
+ @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
+ 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 "set uri: #{@set.dep_uri}"
+ end
+ end
+
+ ##
+ # Fetches a Gem::Specification for this APISpecification.
+
+ def spec # :nodoc:
+ @spec ||=
+ begin
+ tuple = Gem::NameTuple.new @name, @version, @platform
+
+ source.fetch_spec tuple
+ end
+ end
+
+ def source # :nodoc:
+ @set.source
+ end
+
+end
+
diff --git a/lib/rubygems/resolver/best_set.rb b/lib/rubygems/resolver/best_set.rb
new file mode 100644
index 0000000000..7e2d7e2647
--- /dev/null
+++ b/lib/rubygems/resolver/best_set.rb
@@ -0,0 +1,78 @@
+##
+# The BestSet chooses the best available method to query a remote index.
+#
+# It combines IndexSet and APISet
+
+class Gem::Resolver::BestSet < Gem::Resolver::ComposedSet
+
+ ##
+ # Creates a BestSet for the given +sources+ or Gem::sources if none are
+ # specified. +sources+ must be a Gem::SourceList.
+
+ 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|
+ @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
new file mode 100644
index 0000000000..5b08f128ed
--- /dev/null
+++ b/lib/rubygems/resolver/composed_set.rb
@@ -0,0 +1,66 @@
+##
+# A ComposedSet allows multiple sets to be queried like a single set.
+#
+# To create a composed set with any number of sets use:
+#
+# Gem::Resolver.compose_sets set1, set2
+#
+# This method will eliminate nesting of composed sets.
+
+class Gem::Resolver::ComposedSet < Gem::Resolver::Set
+
+ attr_reader :sets # :nodoc:
+
+ ##
+ # Creates a new ComposedSet containing +sets+. Use
+ # 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
+ @sets.map do |s|
+ s.find_all req
+ end.flatten
+ end
+
+ ##
+ # Prefetches +reqs+ in all sets.
+
+ def prefetch reqs
+ @sets.each { |s| s.prefetch(reqs) }
+ end
+
+end
+
diff --git a/lib/rubygems/resolver/conflict.rb b/lib/rubygems/resolver/conflict.rb
new file mode 100644
index 0000000000..902c286b6b
--- /dev/null
+++ b/lib/rubygems/resolver/conflict.rb
@@ -0,0 +1,160 @@
+##
+# Used internally to indicate that a dependency conflicted
+# with a spec that would be activated.
+
+class Gem::Resolver::Conflict
+
+ ##
+ # The specification that was activated prior to the conflict
+
+ attr_reader :activated
+
+ ##
+ # The dependency that is in conflict with the activated gem.
+
+ attr_reader :dependency
+
+ attr_reader :failed_dep # :nodoc:
+
+ ##
+ # Creates a new resolver conflict when +dependency+ is in conflict with an
+ # already +activated+ specification.
+
+ def initialize(dependency, activated, failed_dep=dependency)
+ @dependency = dependency
+ @activated = activated
+ @failed_dep = failed_dep
+ end
+
+ def == other # :nodoc:
+ self.class === other and
+ @dependency == other.dependency and
+ @activated == other.activated and
+ @failed_dep == other.failed_dep
+ end
+
+ ##
+ # A string explanation of the conflict.
+
+ def explain
+ "<Conflict wanted: #{@failed_dep}, had: #{activated.spec.full_name}>"
+ end
+
+ ##
+ # Return the 2 dependency objects that conflicted
+
+ def conflicting_dependencies
+ [@failed_dep.dependency, @activated.request.dependency]
+ end
+
+ ##
+ # Explanation of the conflict used by exceptions to print useful messages
+
+ def explanation
+ activated = @activated.spec.full_name
+ dependency = @failed_dep.dependency
+ requirement = dependency.requirement
+ alternates = dependency.matching_specs.map { |spec| spec.full_name }
+
+ 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,
+ ]
+ end
+
+ ##
+ # Returns true if the conflicting dependency's name matches +spec+.
+
+ def for_spec?(spec)
+ @dependency.name == spec.name
+ end
+
+ def pretty_print q # :nodoc:
+ q.group 2, '[Dependency conflict: ', ']' do
+ q.breakable
+
+ q.text 'activated '
+ q.pp @activated
+
+ q.breakable
+ q.text ' dependency '
+ q.pp @dependency
+
+ q.breakable
+ if @dependency == @failed_dep then
+ q.text ' failed'
+ else
+ q.text ' failed dependency '
+ q.pp @failed_dep
+ end
+ end
+ end
+
+ ##
+ # Path of activations from the +current+ list.
+
+ def request_path current
+ 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}"
+
+ current = current.requester
+ else
+ raise Gem::Exception, "[BUG] unknown request class #{current.class}"
+ end
+ end
+
+ path = ['user request (gem command or Gemfile)'] if path.empty?
+
+ path
+ end
+
+ ##
+ # Return the Specification that listed the dependency
+
+ def requester
+ @failed_dep.requester
+ end
+
+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
new file mode 100644
index 0000000000..4e8d34026b
--- /dev/null
+++ b/lib/rubygems/resolver/current_set.rb
@@ -0,0 +1,13 @@
+##
+# A set which represents the installed gems. Respects
+# all the normal settings that control where to look
+# for installed gems.
+
+class Gem::Resolver::CurrentSet < Gem::Resolver::Set
+
+ def find_all req
+ req.dependency.matching_specs
+ end
+
+end
+
diff --git a/lib/rubygems/resolver/dependency_request.rb b/lib/rubygems/resolver/dependency_request.rb
new file mode 100644
index 0000000000..79690bec4c
--- /dev/null
+++ b/lib/rubygems/resolver/dependency_request.rb
@@ -0,0 +1,116 @@
+##
+# 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
+ end
+
+ def == other # :nodoc:
+ case other
+ when Gem::Dependency
+ @dependency == other
+ when Gem::Resolver::DependencyRequest
+ @dependency == other.dependency && @requester == other.requester
+ else
+ false
+ 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
+
+ ##
+ # 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
+
+ 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
+
+ def pretty_print q # :nodoc:
+ q.group 2, '[Dependency request ', ']' do
+ q.breakable
+ q.text @dependency.to_s
+
+ q.breakable
+ q.text ' requested by '
+ q.pp @requester
+ end
+ end
+
+ ##
+ # The version requirement for this dependency request
+
+ def requirement
+ @dependency.requirement
+ end
+
+ def to_s # :nodoc:
+ @dependency.to_s
+ end
+
+end
+
diff --git a/lib/rubygems/resolver/git_set.rb b/lib/rubygems/resolver/git_set.rb
new file mode 100644
index 0000000000..5f1b368ac1
--- /dev/null
+++ b/lib/rubygems/resolver/git_set.rb
@@ -0,0 +1,122 @@
+##
+# A GitSet represents gems that are sourced from git repositories.
+#
+# This is used for gem dependency file support.
+#
+# Example:
+#
+# set = Gem::Resolver::GitSet.new
+# set.add_git_gem 'rake', 'git://example/rake.git', tag: 'rake-10.1.0'
+
+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:
+
+ ##
+ # A Hash containing git gem names for keys and a Hash of repository and
+ # git commit reference as values.
+
+ attr_reader :repositories # :nodoc:
+
+ ##
+ # A hash of gem names to Gem::Resolver::GitSpecifications
+
+ attr_reader :specs # :nodoc:
+
+ def initialize # :nodoc:
+ super()
+
+ @git = ENV['git'] || 'git'
+ @need_submodules = {}
+ @repositories = {}
+ @root_dir = Gem.dir
+ @specs = {}
+ end
+
+ def add_git_gem name, repository, reference, submodules # :nodoc:
+ @repositories[name] = [repository, reference]
+ @need_submodules[repository] = submodules
+ 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
+ end
+ end
+
+ ##
+ # Prefetches specifications from the git repositories in this set.
+
+ def prefetch reqs
+ return unless @specs.empty?
+
+ @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
+
+ @specs[spec.name] = git_spec
+ end
+ 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
new file mode 100644
index 0000000000..55e180e525
--- /dev/null
+++ b/lib/rubygems/resolver/git_specification.rb
@@ -0,0 +1,59 @@
+##
+# A GitSpecification represents a gem that is sourced from a git repository
+# and is being loaded through a gem dependencies file through the +git:+
+# option.
+
+class Gem::Resolver::GitSpecification < Gem::Resolver::SpecSpecification
+
+ def == other # :nodoc:
+ self.class === other and
+ @set == other.set and
+ @spec == other.spec and
+ @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.new '', options
+ installer.spec = spec
+
+ 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
new file mode 100644
index 0000000000..7c56c2bf99
--- /dev/null
+++ b/lib/rubygems/resolver/index_set.rb
@@ -0,0 +1,80 @@
+##
+# The global rubygems pool represented via the traditional
+# source index.
+
+class Gem::Resolver::IndexSet < Gem::Resolver::Set
+
+ def initialize source = nil # :nodoc:
+ super()
+
+ @f =
+ if source then
+ sources = Gem::SourceList.from [source]
+
+ Gem::SpecFetcher.new sources
+ else
+ Gem::SpecFetcher.fetcher
+ end
+
+ @all = Hash.new { |h,k| h[k] = [] }
+
+ list, errors = @f.available_specs :complete
+
+ @errors.concat errors
+
+ list.each do |uri, specs|
+ specs.each do |n|
+ @all[n.name] << [uri, n]
+ end
+ end
+
+ @specs = {}
+ end
+
+ ##
+ # Return an array of IndexSpecification objects matching
+ # DependencyRequest +req+.
+
+ 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
+ res << Gem::Resolver::IndexSpecification.new(
+ self, n.name, n.version, uri, n.platform)
+ end
+ end
+
+ 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
new file mode 100644
index 0000000000..56fecb5753
--- /dev/null
+++ b/lib/rubygems/resolver/index_specification.rb
@@ -0,0 +1,69 @@
+##
+# Represents a possible Specification object returned from IndexSet. Used to
+# delay needed to download full Specification objects when only the +name+
+# and +version+ are needed.
+
+class Gem::Resolver::IndexSpecification < Gem::Resolver::Specification
+
+ ##
+ # An IndexSpecification is created from the index format described in `gem
+ # help generate_index`.
+ #
+ # The +set+ contains other specifications for this (URL) +source+.
+ #
+ # The +name+, +version+ and +platform+ are the name, version and platform of
+ # the gem.
+
+ def initialize set, name, version, source, platform
+ super()
+
+ @set = set
+ @name = name
+ @version = version
+ @source = source
+ @platform = platform.to_s
+
+ @spec = nil
+ end
+
+ ##
+ # The dependencies of the gem for this specification
+
+ def dependencies
+ spec.dependencies
+ end
+
+ def inspect # :nodoc:
+ '#<%s %s source %s>' % [self.class, full_name, @source]
+ end
+
+ def pretty_print q # :nodoc:
+ q.group 2, '[Index specification', ']' do
+ q.breakable
+ q.text full_name
+
+ unless Gem::Platform::RUBY == @platform then
+ q.breakable
+ q.text @platform.to_s
+ end
+
+ q.breakable
+ q.text 'source '
+ q.pp @source
+ end
+ end
+
+ ##
+ # Fetches a Gem::Specification for this IndexSpecification from the #source.
+
+ def spec # :nodoc:
+ @spec ||=
+ begin
+ tuple = Gem::NameTuple.new @name, @version, @platform
+
+ @source.fetch_spec tuple
+ end
+ end
+
+end
+
diff --git a/lib/rubygems/resolver/installed_specification.rb b/lib/rubygems/resolver/installed_specification.rb
new file mode 100644
index 0000000000..2a2b89a6c2
--- /dev/null
+++ b/lib/rubygems/resolver/installed_specification.rb
@@ -0,0 +1,58 @@
+##
+# An InstalledSpecification represents a gem that is already installed
+# locally.
+
+class Gem::Resolver::InstalledSpecification < Gem::Resolver::SpecSpecification
+
+ def == other # :nodoc:
+ self.class === other and
+ @set == other.set and
+ @spec == other.spec
+ 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
+ end
+ end
+
+ ##
+ # The source for this specification
+
+ def source
+ @source ||= Gem::Source::Installed.new
+ end
+
+end
+
diff --git a/lib/rubygems/resolver/installer_set.rb b/lib/rubygems/resolver/installer_set.rb
new file mode 100644
index 0000000000..f53b496dc7
--- /dev/null
+++ b/lib/rubygems/resolver/installer_set.rb
@@ -0,0 +1,224 @@
+##
+# A set of gems for installation sourced from remote sources and local .gem
+# files
+
+class Gem::Resolver::InstallerSet < Gem::Resolver::Set
+
+ ##
+ # List of Gem::Specification objects that must always be installed.
+
+ attr_reader :always_install # :nodoc:
+
+ ##
+ # Only install gems in the always_install list
+
+ attr_accessor :ignore_dependencies # :nodoc:
+
+ ##
+ # Do not look in the installed set when finding specifications. This is
+ # used by the --install-dir option to `gem install`
+
+ 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
+
+ @always_install = []
+ @ignore_dependencies = false
+ @ignore_installed = false
+ @local = {}
+ @remote_set = Gem::Resolver::BestSet.new
+ @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:
+ @domain == :both or @domain == :local
+ end
+
+ ##
+ # Should remote gems should be considered?
+
+ def consider_remote? # :nodoc:
+ @domain == :both or @domain == :remote
+ end
+
+ ##
+ # Errors encountered while resolving gems
+
+ def errors
+ @errors + @remote_set.errors
+ end
+
+ ##
+ # Returns an array of IndexSpecification objects matching DependencyRequest
+ # +req+.
+
+ def find_all req
+ res = []
+
+ dep = req.dependency
+
+ return res if @ignore_dependencies and
+ @always_install.none? { |spec| dep.match? spec }
+
+ name = dep.name
+
+ dep.matching_specs.each do |gemspec|
+ next if @always_install.any? { |spec| spec.name == gemspec.name }
+
+ 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
+ res << Gem::Resolver::IndexSpecification.new(
+ self, local_spec.name, local_spec.version,
+ local_source, local_spec.platform)
+ end
+ end
+
+ res.delete_if do |spec|
+ spec.version.prerelease? and not dep.prerelease?
+ end
+
+ res.concat @remote_set.find_all req if consider_remote?
+
+ res
+ end
+
+ def prefetch(reqs)
+ @remote_set.prefetch(reqs)
+ end
+
+ def prerelease= allow_prerelease
+ super
+
+ @remote_set.prerelease = allow_prerelease
+ end
+
+ def inspect # :nodoc:
+ always_install = @always_install.map { |s| s.full_name }
+
+ '#<%s domain: %s specs: %p always install: %p>' % [
+ self.class, @domain, @specs.keys, always_install,
+ ]
+ end
+
+ ##
+ # Called from IndexSpecification to get a true Specification
+ # object.
+
+ def load_spec name, ver, platform, source # :nodoc:
+ key = "#{name}-#{ver}-#{platform}"
+
+ @specs.fetch key do
+ tuple = Gem::NameTuple.new name, ver, platform
+
+ @specs[key] = source.fetch_spec tuple
+ 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
+ q.text "domain: #{@domain}"
+
+ q.breakable
+ q.text 'specs: '
+ q.pp @specs.keys
+
+ q.breakable
+ q.text 'always install: '
+ q.pp @always_install
+ 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
new file mode 100644
index 0000000000..20a283f0ba
--- /dev/null
+++ b/lib/rubygems/resolver/local_specification.rb
@@ -0,0 +1,41 @@
+##
+# 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
new file mode 100644
index 0000000000..4ede5971fb
--- /dev/null
+++ b/lib/rubygems/resolver/lock_set.rb
@@ -0,0 +1,84 @@
+##
+# A set of gems from a gem dependencies lockfile.
+
+class Gem::Resolver::LockSet < Gem::Resolver::Set
+
+ attr_reader :specs # :nodoc:
+
+ ##
+ # Creates a new LockSet from the given +sources+
+
+ def initialize sources
+ super()
+
+ @sources = sources.map do |source|
+ Gem::Source::Lock.new source
+ end
+
+ @specs = []
+ end
+
+ ##
+ # Creates a new IndexSpecification in this set using the given +name+,
+ # +version+ and +platform+.
+ #
+ # The specification's set will be the current set, and the source will be
+ # the current set's source.
+
+ def add name, version, platform # :nodoc:
+ version = Gem::Version.new version
+
+ specs = @sources.map do |source|
+ Gem::Resolver::LockSpecification.new self, name, version, source,
+ platform
+ end
+
+ @specs.concat specs
+
+ specs
+ end
+
+ ##
+ # Returns an Array of IndexSpecification objects matching the
+ # DependencyRequest +req+.
+
+ def find_all req
+ @specs.select do |spec|
+ req.match? spec
+ end
+ end
+
+ ##
+ # Loads a Gem::Specification with the given +name+, +version+ and
+ # +platform+. +source+ is ignored.
+
+ def load_spec name, version, platform, source # :nodoc:
+ dep = Gem::Dependency.new name, version
+
+ found = @specs.find do |spec|
+ dep.matches_spec? spec and spec.platform == platform
+ end
+
+ tuple = Gem::NameTuple.new found.name, found.version, found.platform
+
+ 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
new file mode 100644
index 0000000000..0013171469
--- /dev/null
+++ b/lib/rubygems/resolver/lock_specification.rb
@@ -0,0 +1,84 @@
+##
+# 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
+
+ def initialize set, name, version, source, platform
+ super()
+
+ @name = name
+ @platform = platform
+ @set = set
+ @source = source
+ @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/requirement_list.rb b/lib/rubygems/resolver/requirement_list.rb
new file mode 100644
index 0000000000..a6bfaab307
--- /dev/null
+++ b/lib/rubygems/resolver/requirement_list.rb
@@ -0,0 +1,81 @@
+##
+# 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.
+
+class Gem::Resolver::RequirementList
+
+ include Enumerable
+
+ ##
+ # Creates a new RequirementList.
+
+ def initialize
+ @exact = []
+ @list = []
+ end
+
+ def initialize_copy other # :nodoc:
+ @exact = @exact.dup
+ @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
+ req
+ end
+
+ ##
+ # Enumerates requirements in the list
+
+ 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?
+ 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]
+ end
+end
diff --git a/lib/rubygems/resolver/set.rb b/lib/rubygems/resolver/set.rb
new file mode 100644
index 0000000000..b26dc45c7b
--- /dev/null
+++ b/lib/rubygems/resolver/set.rb
@@ -0,0 +1,56 @@
+##
+# Resolver sets are used to look up specifications (and their
+# dependencies) used in resolution. This set is abstract.
+
+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+.
+
+ def find_all req
+ raise NotImplementedError
+ end
+
+ ##
+ # The #prefetch method may be overridden, but this is not necessary. This
+ # default implementation does nothing, which is suitable for sets where
+ # looking up a specification is cheap (such as installed gems).
+ #
+ # When overridden, the #prefetch method should look up specifications
+ # matching +reqs+.
+
+ 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/spec_specification.rb b/lib/rubygems/resolver/spec_specification.rb
new file mode 100644
index 0000000000..1350e8a7ab
--- /dev/null
+++ b/lib/rubygems/resolver/spec_specification.rb
@@ -0,0 +1,56 @@
+##
+# The Resolver::SpecSpecification contains common functionality for
+# Resolver specifications that are backed by a Gem::Specification.
+
+class Gem::Resolver::SpecSpecification < Gem::Resolver::Specification
+
+ ##
+ # 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
+ # loaded from.
+
+ def initialize set, spec, source = nil
+ @set = set
+ @source = source
+ @spec = spec
+ end
+
+ ##
+ # The dependencies of the gem for this specification
+
+ def dependencies
+ spec.dependencies
+ end
+
+ ##
+ # The name and version of the specification.
+ #
+ # Unlike Gem::Specification#full_name, the platform is not included.
+
+ def full_name
+ "#{spec.name}-#{spec.version}"
+ end
+
+ ##
+ # The name of the gem for this specification
+
+ def name
+ spec.name
+ end
+
+ ##
+ # The platform this gem works on.
+
+ def platform
+ spec.platform
+ end
+
+ ##
+ # The version of the gem for this specification.
+
+ def version
+ spec.version
+ end
+
+end
+
diff --git a/lib/rubygems/resolver/specification.rb b/lib/rubygems/resolver/specification.rb
new file mode 100644
index 0000000000..4d77293262
--- /dev/null
+++ b/lib/rubygems/resolver/specification.rb
@@ -0,0 +1,110 @@
+##
+# A Resolver::Specification contains a subset of the information
+# contained in a Gem::Specification. Only the information necessary for
+# dependency resolution in the resolver is included.
+
+class Gem::Resolver::Specification
+
+ ##
+ # The dependencies of the gem for this specification
+
+ attr_reader :dependencies
+
+ ##
+ # The name of the gem for this specification
+
+ attr_reader :name
+
+ ##
+ # The platform this gem works on.
+
+ attr_reader :platform
+
+ ##
+ # The set this specification came from.
+
+ attr_reader :set
+
+ ##
+ # The source for this 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
+
+ ##
+ # Sets default instance variables for the specification.
+
+ def initialize
+ @dependencies = nil
+ @name = nil
+ @platform = nil
+ @set = nil
+ @source = nil
+ @version = nil
+ 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.
+
+ def full_name
+ "#{@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.new 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
new file mode 100644
index 0000000000..c31e5be962
--- /dev/null
+++ b/lib/rubygems/resolver/stats.rb
@@ -0,0 +1,44 @@
+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
new file mode 100644
index 0000000000..614bd05382
--- /dev/null
+++ b/lib/rubygems/resolver/vendor_set.rb
@@ -0,0 +1,87 @@
+##
+# A VendorSet represents gems that have been unpacked into a specific
+# directory that contains a gemspec.
+#
+# This is used for gem dependency file support.
+#
+# Example:
+#
+# set = Gem::Resolver::VendorSet.new
+#
+# set.add_vendor_gem 'rake', 'vendor/rake'
+#
+# The directory vendor/rake must contain an unpacked rake gem along with a
+# rake.gemspec (watching the given name).
+
+class Gem::Resolver::VendorSet < Gem::Resolver::Set
+
+ ##
+ # The specifications for this set.
+
+ attr_reader :specs # :nodoc:
+
+ def initialize # :nodoc:
+ super()
+
+ @directories = {}
+ @specs = {}
+ end
+
+ ##
+ # Adds a specification to the set with the given +name+ which has been
+ # unpacked into the given +directory+.
+
+ def add_vendor_gem name, directory # :nodoc:
+ gemspec = File.join directory, "#{name}.gemspec"
+
+ spec = Gem::Specification.load gemspec
+
+ raise Gem::GemNotFoundException,
+ "unable to find #{gemspec} for gem #{name}" unless spec
+
+ spec.full_gem_path = File.expand_path directory
+
+ @specs[spec.name] = spec
+ @directories[spec] = directory
+
+ spec
+ end
+
+ ##
+ # Returns an Array of VendorSpecification objects matching the
+ # DependencyRequest +req+.
+
+ def find_all req
+ @specs.values.select do |spec|
+ req.match? spec
+ end.map do |spec|
+ source = Gem::Source::Vendor.new @directories[spec]
+ Gem::Resolver::VendorSpecification.new self, spec, source
+ end
+ end
+
+ ##
+ # Loads a spec with the given +name+. +version+, +platform+ and +source+ are
+ # ignored.
+
+ 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
+
+ dirs = @directories.map do |spec, directory|
+ "#{spec.full_name}: #{directory}"
+ end
+
+ q.seplist dirs do |dir|
+ q.text dir
+ end
+ end
+ end
+
+end
+
diff --git a/lib/rubygems/resolver/vendor_specification.rb b/lib/rubygems/resolver/vendor_specification.rb
new file mode 100644
index 0000000000..a99b5f3cc1
--- /dev/null
+++ b/lib/rubygems/resolver/vendor_specification.rb
@@ -0,0 +1,24 @@
+##
+# A VendorSpecification represents a gem that has been unpacked into a project
+# and is being loaded through a gem dependencies file through the +path:+
+# option.
+
+class Gem::Resolver::VendorSpecification < Gem::Resolver::SpecSpecification
+
+ def == other # :nodoc:
+ self.class === other and
+ @set == other.set and
+ @spec == other.spec and
+ @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/security.rb b/lib/rubygems/security.rb
index bed47ab9f3..8c5fb7d9f2 100644
--- a/lib/rubygems/security.rb
+++ b/lib/rubygems/security.rb
@@ -12,20 +12,6 @@ begin
rescue LoadError => e
raise unless (e.respond_to?(:path) && e.path == 'openssl') ||
e.message =~ / -- openssl$/
-
- module OpenSSL # :nodoc:
- class Digest # :nodoc:
- class SHA1 # :nodoc:
- def name
- 'SHA1'
- end
- end
- end
- module PKey # :nodoc:
- class RSA # :nodoc:
- end
- end
- end
end
##
@@ -134,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; he can't modify the
-# package contents without invalidating the signature, and he can't
+# doesn't have a whole lot of options here; they can't modify the
+# package contents without invalidating the signature, and they can't
# modify or remove signature or the signing certificate chain, or
# RubyGems will simply refuse to install the package. Oh well, maybe
-# he'll have better luck causing problems for CPAN users instead :).
+# they'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),
@@ -352,17 +338,26 @@ module Gem::Security
##
# Digest algorithm used to sign gems
- DIGEST_ALGORITHM = OpenSSL::Digest::SHA1
+ DIGEST_ALGORITHM =
+ if defined?(OpenSSL::Digest) then
+ OpenSSL::Digest::SHA1
+ end
##
# Used internally to select the signing digest from all computed digests
- DIGEST_NAME = DIGEST_ALGORITHM.new.name # :nodoc:
+ DIGEST_NAME = # :nodoc:
+ if DIGEST_ALGORITHM then
+ DIGEST_ALGORITHM.new.name
+ end
##
# Algorithm for creating the key pair used to sign gems
- KEY_ALGORITHM = OpenSSL::PKey::RSA
+ KEY_ALGORITHM =
+ if defined?(OpenSSL::PKey) then
+ OpenSSL::PKey::RSA
+ end
##
# Length of keys created by KEY_ALGORITHM
@@ -370,6 +365,12 @@ module Gem::Security
KEY_LENGTH = 2048
##
+ # Cipher used to encrypt the key pair used to sign gems.
+ # Must be in the list returned by OpenSSL::Cipher.ciphers
+
+ KEY_CIPHER = OpenSSL::Cipher.new('AES-256-CBC') if defined?(OpenSSL::Cipher)
+
+ ##
# One year in seconds
ONE_YEAR = 86400 * 365
@@ -563,13 +564,18 @@ module Gem::Security
##
# Writes +pemmable+, which must respond to +to_pem+ to +path+ with the given
- # +permissions+.
+ # +permissions+. If passed +cipher+ and +passphrase+ those arguments will be
+ # passed to +to_pem+.
- def self.write pemmable, path, permissions = 0600
+ def self.write pemmable, path, permissions = 0600, passphrase = nil, cipher = KEY_CIPHER
path = File.expand_path path
open path, 'wb', permissions do |io|
- io.write pemmable.to_pem
+ if passphrase and cipher
+ io.write pemmable.to_pem cipher, passphrase
+ else
+ io.write pemmable.to_pem
+ end
end
path
@@ -579,8 +585,11 @@ module Gem::Security
end
-require 'rubygems/security/policy'
-require 'rubygems/security/policies'
+if defined?(OpenSSL::SSL) then
+ require 'rubygems/security/policy'
+ require 'rubygems/security/policies'
+ require 'rubygems/security/trust_dir'
+end
+
require 'rubygems/security/signer'
-require 'rubygems/security/trust_dir'
diff --git a/lib/rubygems/security/policy.rb b/lib/rubygems/security/policy.rb
index 467ee932b5..b9bcb17525 100644
--- a/lib/rubygems/security/policy.rb
+++ b/lib/rubygems/security/policy.rb
@@ -1,3 +1,5 @@
+require 'rubygems/user_interaction'
+
##
# A Gem::Security::Policy object encapsulates the settings for verifying
# signed gem files. This is the base class. You can either declare an
@@ -6,6 +8,8 @@
class Gem::Security::Policy
+ include Gem::UserInteraction
+
attr_reader :name
attr_accessor :only_signed
@@ -175,6 +179,19 @@ class Gem::Security::Policy
true
end
+ ##
+ # Extracts the email or subject from +certificate+
+
+ def subject certificate # :nodoc:
+ certificate.extensions.each do |extension|
+ next unless extension.oid == 'subjectAltName'
+
+ return extension.value
+ end
+
+ certificate.subject.to_s
+ end
+
def inspect # :nodoc:
("[Policy: %s - data: %p signer: %p chain: %p root: %p " +
"signed-only: %p trusted-only: %p]") % [
@@ -184,16 +201,25 @@ class Gem::Security::Policy
end
##
- # Verifies the certificate +chain+ is valid, the +digests+ match the
- # signatures +signatures+ created by the signer depending on the +policy+
- # settings.
+ # For +full_name+, verifies the certificate +chain+ is valid, the +digests+
+ # match the signatures +signatures+ created by the signer depending on the
+ # +policy+ settings.
#
# If +key+ is given it is used to validate the signing certificate.
- def verify chain, key = nil, digests = {}, signatures = {}
- if @only_signed and signatures.empty? then
- raise Gem::Security::Exception,
- "unsigned gems are not allowed by the #{name} policy"
+ def verify chain, key = nil, digests = {}, signatures = {},
+ full_name = '(unknown)'
+ if signatures.empty? then
+ if @only_signed then
+ raise Gem::Security::Exception,
+ "unsigned gems are not allowed by the #{name} policy"
+ elsif digests.empty? then
+ # lack of signatures is irrelevant if there is nothing to check
+ # against
+ else
+ alert_warning "#{full_name} is not signed"
+ return
+ end
end
opt = @opt
@@ -222,7 +248,13 @@ class Gem::Security::Policy
check_root chain, time if @verify_root
- check_trust chain, digester, trust_dir if @only_trusted
+ if @only_trusted then
+ check_trust chain, digester, trust_dir
+ elsif signatures.empty? and digests.empty? then
+ # trust is irrelevant if there's no signatures to verify
+ else
+ alert_warning "#{subject signer} is not trusted for #{full_name}"
+ end
signatures.each do |file, _|
digest = signer_digests[file]
@@ -252,7 +284,7 @@ class Gem::Security::Policy
OpenSSL::X509::Certificate.new cert_pem
end
- verify chain, nil, digests, signatures
+ verify chain, nil, digests, signatures, spec.full_name
true
end
diff --git a/lib/rubygems/security/signer.rb b/lib/rubygems/security/signer.rb
index 78455c0732..bb1eae7cf2 100644
--- a/lib/rubygems/security/signer.rb
+++ b/lib/rubygems/security/signer.rb
@@ -29,7 +29,7 @@ class Gem::Security::Signer
# +chain+ containing X509 certificates, encoding certificates or paths to
# certificates.
- def initialize key, cert_chain
+ def initialize key, cert_chain, passphrase = nil
@cert_chain = cert_chain
@key = key
@@ -46,7 +46,7 @@ class Gem::Security::Signer
@digest_algorithm = Gem::Security::DIGEST_ALGORITHM
@digest_name = Gem::Security::DIGEST_NAME
- @key = OpenSSL::PKey::RSA.new File.read @key if
+ @key = OpenSSL::PKey::RSA.new File.read(@key), passphrase if
@key and not OpenSSL::PKey::RSA === @key
if @cert_chain then
@@ -63,6 +63,22 @@ class Gem::Security::Signer
end
##
+ # Extracts the full name of +cert+. If the certificate has a subjectAltName
+ # this value is preferred, otherwise the subject is used.
+
+ def extract_name cert # :nodoc:
+ subject_alt_name = cert.extensions.find { |e| 'subjectAltName' == e.oid }
+
+ if subject_alt_name then
+ /\Aemail:/ =~ subject_alt_name.value
+
+ $' || subject_alt_name.value
+ else
+ cert.subject
+ end
+ end
+
+ ##
# Loads any missing issuers in the cert chain from the trusted certificates.
#
# If the issuer does not exist it is ignored as it will be checked later.
@@ -89,7 +105,9 @@ class Gem::Security::Signer
re_sign_key
end
- Gem::Security::SigningPolicy.verify @cert_chain, @key
+ full_name = extract_name @cert_chain.last
+
+ Gem::Security::SigningPolicy.verify @cert_chain, @key, {}, {}, full_name
@key.sign @digest_algorithm.new, data
end
diff --git a/lib/rubygems/security/trust_dir.rb b/lib/rubygems/security/trust_dir.rb
index dd51308ee5..76ef89af7f 100644
--- a/lib/rubygems/security/trust_dir.rb
+++ b/lib/rubygems/security/trust_dir.rb
@@ -1,10 +1,26 @@
+##
+# 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
@@ -12,8 +28,6 @@ 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 f2d1428489..7655be22ce 100644
--- a/lib/rubygems/server.rb
+++ b/lib/rubygems/server.rb
@@ -530,6 +530,36 @@ 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
@@ -537,7 +567,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
@@ -671,13 +701,13 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
# documentation for the particular gem, otherwise a list with results is
# shown.
#
- # === Additional trick - install documentation for ruby core
+ # === Additional trick - install documentation for Ruby core
#
# Note: please adjust paths accordingly use for example 'locate yaml.rb' and
# 'gem environment' to identify directories, that are specific for your
# local installation
#
- # 1. install ruby sources
+ # 1. install Ruby sources
# cd /usr/src
# sudo apt-get source ruby
#
@@ -710,7 +740,7 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
# name pattern was found.
#
# The search is based on the file system content, not on the gems metadata.
- # This allows additional documentation folders like 'core' for the ruby core
+ # This allows additional documentation folders like 'core' for the Ruby core
# documentation - just put it underneath the main doc folder.
def show_rdoc_for_pattern(pattern, res)
@@ -757,6 +787,11 @@ 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 c997d78ca6..4858ffb5ba 100644
--- a/lib/rubygems/source.rb
+++ b/lib/rubygems/source.rb
@@ -1,13 +1,30 @@
require 'uri'
require 'fileutils'
+##
+# A Source knows how to list and fetch gems from a RubyGems marshal index.
+#
+# There are other Source subclasses for installed gems, local gems, the
+# bundler dependency API and so-forth.
+
class Gem::Source
- FILES = {
+
+ include Comparable
+
+ FILES = { # :nodoc:
:released => 'specs',
:latest => 'latest_specs',
:prerelease => 'prerelease_specs',
}
+ ##
+ # The URI this source will fetch gems from.
+
+ attr_reader :uri
+
+ ##
+ # Creates a new Source which will use the index located at +uri+.
+
def initialize(uri)
unless uri.kind_of? URI
uri = URI.parse(uri.to_s)
@@ -17,38 +34,69 @@ class Gem::Source
@api_uri = nil
end
- attr_reader :uri
+ ##
+ # Use an SRV record on the host to look up the true endpoint for the index.
- def api_uri
+ def api_uri # :nodoc:
require 'rubygems/remote_fetcher'
@api_uri ||= Gem::RemoteFetcher.fetcher.api_endpoint uri
end
+ ##
+ # Sources are ordered by installation preference.
+
def <=>(other)
- if !@uri
- return 0 unless other.uri
- return -1
- end
+ case other
+ when Gem::Source::Installed,
+ Gem::Source::Local,
+ Gem::Source::Lock,
+ Gem::Source::SpecificFile,
+ Gem::Source::Git,
+ Gem::Source::Vendor then
+ -1
+ when Gem::Source then
+ if !@uri
+ return 0 unless other.uri
+ return 1
+ end
- return 1 if !other.uri
+ return -1 if !other.uri
- @uri.to_s <=> other.uri.to_s
+ @uri.to_s <=> other.uri.to_s
+ else
+ nil
+ end
end
- include Comparable
+ def == other # :nodoc:
+ self.class === other and @uri == other.uri
+ end
- def ==(other)
- case other
- when self.class
- @uri == other.uri
+ alias_method :eql?, :== # :nodoc:
+
+ ##
+ # 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
+ rescue Gem::RemoteFetcher::FetchError
+ Gem::Resolver::IndexSet.new self
else
- false
+ if response.respond_to? :uri then
+ Gem::Resolver::APISet.new response.uri
+ else
+ Gem::Resolver::APISet.new bundler_api_uri
+ end
end
end
- alias_method :eql?, :==
-
- def hash
+ def hash # :nodoc:
@uri.hash
end
@@ -58,10 +106,14 @@ class Gem::Source
def cache_dir(uri)
# Correct for windows paths
escaped_path = uri.path.sub(/^\/([a-z]):\//i, '/\\1-/')
- root = File.join Gem.user_home, '.gem', 'specs'
- File.join root, "#{uri.host}%#{uri.port}", File.dirname(escaped_path)
+ escaped_path.untaint
+
+ File.join Gem.spec_cache_dir, "#{uri.host}%#{uri.port}", File.dirname(escaped_path)
end
+ ##
+ # Returns true when it is possible and safe to update the cache directory.
+
def update_cache?
@update_cache ||=
begin
@@ -71,12 +123,15 @@ class Gem::Source
end
end
- def fetch_spec(name)
+ ##
+ # Fetches a specification for the given +name_tuple+.
+
+ def fetch_spec name_tuple
fetcher = Gem::RemoteFetcher.fetcher
- spec_file_name = name.spec_name
+ spec_file_name = name_tuple.spec_name
- uri = @uri + "#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}"
+ uri = api_uri + "#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}"
cache_dir = cache_dir uri
@@ -120,7 +175,7 @@ class Gem::Source
file = FILES[type]
fetcher = Gem::RemoteFetcher.fetcher
file_name = "#{file}.#{Gem.marshal_version}"
- spec_path = @uri + "#{file_name}.gz"
+ spec_path = api_uri + "#{file_name}.gz"
cache_dir = cache_dir spec_path
local_file = File.join(cache_dir, file_name)
retried = false
@@ -142,8 +197,34 @@ class Gem::Source
end
end
+ ##
+ # Downloads +spec+ and writes it to +dir+. See also
+ # Gem::RemoteFetcher#download.
+
def download(spec, dir=Dir.pwd)
fetcher = Gem::RemoteFetcher.fetcher
- fetcher.download spec, @uri.to_s, dir
+ fetcher.download spec, api_uri.to_s, dir
end
+
+ def pretty_print q # :nodoc:
+ 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
+ end
+
end
+
+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
new file mode 100644
index 0000000000..fb9cbce2fb
--- /dev/null
+++ b/lib/rubygems/source/git.rb
@@ -0,0 +1,232 @@
+require 'digest'
+require 'rubygems/util'
+
+##
+# A git gem for use in a gem dependencies file.
+#
+# Example:
+#
+# source =
+# Gem::Source::Git.new 'rake', 'git@example:rake.git', 'rake-10.1.0', false
+#
+# source.specs
+
+class Gem::Source::Git < Gem::Source
+
+ ##
+ # The name of the gem created by this git gem.
+
+ attr_reader :name
+
+ ##
+ # The commit reference used for checking out this git gem.
+
+ 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
+
+ ##
+ # Creates a new git gem source for a gems from loaded from +repository+ at
+ # the given +reference+. The +name+ is only used to track the repository
+ # back to a gem dependencies file, it has no real significance as a git
+ # repository may contain multiple gems. If +submodules+ is true, submodules
+ # will be checked out when the gem is installed.
+
+ def initialize name, repository, reference, submodules = false
+ super repository
+
+ @name = name
+ @repository = repository
+ @reference = reference
+ @need_submodules = submodules
+
+ @remote = true
+ @root_dir = Gem.dir
+ @git = ENV['git'] || 'git'
+ end
+
+ def <=> other
+ case other
+ when Gem::Source::Git then
+ 0
+ when Gem::Source::Vendor,
+ Gem::Source::Lock then
+ -1
+ when Gem::Source then
+ 1
+ else
+ nil
+ end
+ end
+
+ def == other # :nodoc:
+ super and
+ @name == other.name and
+ @repository == other.repository and
+ @reference == other.reference and
+ @need_submodules == other.need_submodules
+ end
+
+ ##
+ # Checks out the files for the repository into the install_dir.
+
+ 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
+ end
+
+ Dir.chdir install_dir do
+ system @git, 'fetch', '--quiet', '--force', '--tags', install_dir
+
+ success = system @git, 'reset', '--quiet', '--hard', rev_parse
+
+ success &&=
+ Gem::Util.silent_system @git, 'submodule', 'update',
+ '--quiet', '--init', '--recursive' if @need_submodules
+
+ success
+ end
+ end
+
+ ##
+ # 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',
+ @repository, 'refs/heads/*:refs/heads/*'
+ end
+ else
+ system @git, 'clone', '--quiet', '--bare', '--no-hardlinks',
+ @repository, repo_cache_dir
+ end
+ 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:
+ rev_parse[0..11]
+ end
+
+ ##
+ # Nothing to download for git gems
+
+ def download full_spec, path # :nodoc:
+ end
+
+ ##
+ # 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
+ 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}"
+ end
+
+ ##
+ # Converts the git reference for the repository into a commit hash.
+
+ def rev_parse # :nodoc:
+ Dir.chdir repo_cache_dir do
+ Gem::Util.popen(@git, 'rev-parse', @reference).strip
+ end
+ end
+
+ ##
+ # Loads all gemspecs in the repository
+
+ 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
+ end
+ end.compact
+ end
+ end
+
+ ##
+ # A hash for the git gem based on the git repository URI.
+
+ def uri_hash # :nodoc:
+ normalized =
+ if @repository =~ %r%^\w+://(\w+@)?% then
+ uri = URI(@repository).normalize.to_s.sub %r%/$%,''
+ uri.sub(/\A(\w+)/) { $1.downcase }
+ else
+ @repository
+ end
+
+ Digest::SHA1.hexdigest normalized
+ end
+
+end
+
diff --git a/lib/rubygems/source/installed.rb b/lib/rubygems/source/installed.rb
new file mode 100644
index 0000000000..bd05c75af1
--- /dev/null
+++ b/lib/rubygems/source/installed.rb
@@ -0,0 +1,40 @@
+##
+# Represents an installed gem. This is used for dependency resolution.
+
+class Gem::Source::Installed < Gem::Source
+
+ def initialize # :nodoc:
+ @uri = nil
+ end
+
+ ##
+ # Installed sources sort before all other sources
+
+ def <=> other
+ case other
+ when Gem::Source::Git,
+ Gem::Source::Lock,
+ Gem::Source::Vendor then
+ -1
+ when Gem::Source::Installed then
+ 0
+ when Gem::Source then
+ 1
+ else
+ nil
+ end
+ end
+
+ ##
+ # We don't need to download an installed gem
+
+ def download spec, path
+ 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
new file mode 100644
index 0000000000..8057921163
--- /dev/null
+++ b/lib/rubygems/source/local.rb
@@ -0,0 +1,129 @@
+##
+# The local source finds gems in the current directory for fulfilling
+# dependencies.
+
+class Gem::Source::Local < Gem::Source
+
+ def initialize # :nodoc:
+ @specs = nil
+ @api_uri = nil
+ @uri = nil
+ end
+
+ ##
+ # Local sorts before Gem::Source and after Gem::Source::Installed
+
+ def <=> other
+ case other
+ when Gem::Source::Installed,
+ Gem::Source::Lock then
+ -1
+ when Gem::Source::Local then
+ 0
+ when Gem::Source then
+ 1
+ else
+ nil
+ end
+ end
+
+ def inspect # :nodoc:
+ keys = @specs ? @specs.keys.sort : 'NOT LOADED'
+ "#<%s specs: %p>" % [self.class, keys]
+ end
+
+ def load_specs type # :nodoc:
+ names = []
+
+ @specs = {}
+
+ Dir["*.gem"].each do |file|
+ begin
+ pkg = Gem::Package.new(file)
+ rescue SystemCallError, Gem::Package::FormatError
+ # ignore
+ else
+ tup = pkg.spec.name_tuple
+ @specs[tup] = [File.expand_path(file), pkg]
+
+ case type
+ when :released
+ unless pkg.spec.version.prerelease?
+ names << pkg.spec.name_tuple
+ end
+ when :prerelease
+ if pkg.spec.version.prerelease?
+ names << pkg.spec.name_tuple
+ end
+ when :latest
+ tup = pkg.spec.name_tuple
+
+ cur = names.find { |x| x.name == tup.name }
+ if !cur
+ names << tup
+ elsif cur.version < tup.version
+ names.delete cur
+ names << tup
+ end
+ else
+ names << pkg.spec.name_tuple
+ end
+ end
+ end
+
+ names
+ end
+
+ def find_gem gem_name, version = Gem::Requirement.default, # :nodoc:
+ prerelease = false
+ load_specs :complete
+
+ found = []
+
+ @specs.each do |n, data|
+ if n.name == gem_name
+ s = data[1].spec
+
+ if version.satisfied_by?(s.version)
+ if prerelease
+ found << s
+ elsif !s.version.prerelease?
+ found << s
+ end
+ end
+ end
+ end
+
+ found.max_by { |s| s.version }
+ end
+
+ def fetch_spec name # :nodoc:
+ load_specs :complete
+
+ if data = @specs[name]
+ data.last.spec
+ else
+ raise Gem::Exception, "Unable to find spec for #{name.inspect}"
+ end
+ end
+
+ def download spec, cache_dir = nil # :nodoc:
+ load_specs :complete
+
+ @specs.each do |name, data|
+ return data[0] if data[1].spec == spec
+ end
+
+ raise Gem::Exception, "Unable to find file for '#{spec.full_name}'"
+ end
+
+ def pretty_print q # :nodoc:
+ q.group 2, '[Local gems:', ']' do
+ q.breakable
+ q.seplist @specs.keys do |v|
+ q.text v.full_name
+ end
+ end
+ end
+
+end
diff --git a/lib/rubygems/source/lock.rb b/lib/rubygems/source/lock.rb
new file mode 100644
index 0000000000..2ba7702bda
--- /dev/null
+++ b/lib/rubygems/source/lock.rb
@@ -0,0 +1,48 @@
+##
+# 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
new file mode 100644
index 0000000000..250a839203
--- /dev/null
+++ b/lib/rubygems/source/specific_file.rb
@@ -0,0 +1,72 @@
+##
+# A source representing a single .gem file. This is used for installation of
+# local gems.
+
+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)
+ @uri = nil
+ @path = ::File.expand_path(file)
+
+ @package = Gem::Package.new @path
+ @spec = @package.spec
+ @name = @spec.name_tuple
+ end
+
+ ##
+ # The Gem::Specification extracted from this .gem.
+
+ attr_reader :spec
+
+ def load_specs *a # :nodoc:
+ [@name]
+ end
+
+ def fetch_spec name # :nodoc:
+ return @spec if name == @name
+ raise Gem::Exception, "Unable to find '#{name}'"
+ @spec
+ end
+
+ def download spec, dir = nil # :nodoc:
+ return @path if spec == @spec
+ raise Gem::Exception, "Unable to download '#{spec.full_name}'"
+ end
+
+ def pretty_print q # :nodoc:
+ q.group 2, '[SpecificFile:', ']' do
+ q.breakable
+ q.text @path
+ end
+ end
+
+ ##
+ # Orders this source against +other+.
+ #
+ # If +other+ is a SpecificFile from a different gem name +nil+ is returned.
+ #
+ # If +other+ is a SpecificFile from the same gem name the versions are
+ # compared using Gem::Version#<=>
+ #
+ # Otherwise Gem::Source#<=> is used.
+
+ def <=> other
+ case other
+ when Gem::Source::SpecificFile then
+ return nil if @spec.name != other.spec.name
+
+ @spec.version <=> other.spec.version
+ else
+ super
+ end
+ end
+
+end
diff --git a/lib/rubygems/source/vendor.rb b/lib/rubygems/source/vendor.rb
new file mode 100644
index 0000000000..2d936231c1
--- /dev/null
+++ b/lib/rubygems/source/vendor.rb
@@ -0,0 +1,27 @@
+##
+# This represents a vendored source that is similar to an installed gem.
+
+class Gem::Source::Vendor < Gem::Source::Installed
+
+ ##
+ # Creates a new Vendor source for a gem that was unpacked at +path+.
+
+ def initialize path
+ @uri = path
+ end
+
+ def <=> other
+ case other
+ when Gem::Source::Lock then
+ -1
+ when Gem::Source::Vendor then
+ 0
+ when Gem::Source then
+ 1
+ else
+ nil
+ end
+ end
+
+end
+
diff --git a/lib/rubygems/source_list.rb b/lib/rubygems/source_list.rb
index 7bd8ef0b78..e01f11cc1e 100644
--- a/lib/rubygems/source_list.rb
+++ b/lib/rubygems/source_list.rb
@@ -1,28 +1,53 @@
require 'rubygems/source'
+##
+# The SourceList represents the sources rubygems has been configured to use.
+# A source may be created from an array of sources:
+#
+# Gem::SourceList.from %w[https://rubygems.example https://internal.example]
+#
+# Or by adding them:
+#
+# sources = Gem::SourceList.new
+# sources.add 'https://rubygems.example'
+#
+# The most common way to get a SourceList is Gem.sources.
+
class Gem::SourceList
+
+ include Enumerable
+
+ ##
+ # Creates a new SourceList
+
def initialize
@sources = []
end
+ ##
+ # The sources in this list
+
attr_reader :sources
+ ##
+ # Creates a new SourceList from an array of sources.
+
def self.from(ary)
list = new
- if ary
- ary.each do |x|
- list << x
- end
- end
+ list.replace ary
return list
end
- def initialize_copy(other)
+ def initialize_copy(other) # :nodoc:
@sources = @sources.dup
end
+ ##
+ # Appends +obj+ to the source list which may be a Gem::Source, URI or URI
+ # String.
+
def <<(obj)
src = case obj
when URI
@@ -37,8 +62,12 @@ class Gem::SourceList
src
end
+ ##
+ # Replaces this SourceList with the sources in +other+ See #<< for
+ # acceptable items in +other+.
+
def replace(other)
- @sources.clear
+ clear
other.each do |x|
self << x
@@ -47,28 +76,58 @@ class Gem::SourceList
self
end
+ ##
+ # Removes all sources from the SourceList.
+
+ def clear
+ @sources.clear
+ end
+
+ ##
+ # Yields each source URI in the list.
+
def each
@sources.each { |s| yield s.uri.to_s }
end
+ ##
+ # Yields each source in the list.
+
def each_source(&b)
@sources.each(&b)
end
- def ==(other)
+ ##
+ # Returns true if there are no sources in this SourceList.
+
+ def empty?
+ @sources.empty?
+ end
+
+ def == other # :nodoc:
to_a == other
end
+ ##
+ # Returns an Array of source URI Strings.
+
def to_a
@sources.map { |x| x.uri.to_s }
end
alias_method :to_ary, :to_a
+ ##
+ # Returns the first source in the list.
+
def first
@sources.first
end
+ ##
+ # Returns true if this source list includes +other+ which may be a
+ # Gem::Source or a source URI.
+
def include?(other)
if other.kind_of? Gem::Source
@sources.include? other
@@ -77,11 +136,14 @@ class Gem::SourceList
end
end
- def delete(uri)
- if uri.kind_of? Gem::Source
- @sources.delete uri
+ ##
+ # Deletes +source+ from the source list which may be a Gem::Source or a URI.
+
+ def delete source
+ if source.kind_of? Gem::Source
+ @sources.delete source
else
- @sources.delete_if { |x| x.uri.to_s == uri.to_s }
+ @sources.delete_if { |x| x.uri.to_s == source.to_s }
end
end
end
diff --git a/lib/rubygems/source_local.rb b/lib/rubygems/source_local.rb
index 44b170c4a4..0808f4694a 100644
--- a/lib/rubygems/source_local.rb
+++ b/lib/rubygems/source_local.rb
@@ -1,92 +1,5 @@
require 'rubygems/source'
+require 'rubygems/source_local'
-class Gem::Source::Local < Gem::Source
- def initialize
- @uri = nil
- end
+# TODO warn upon require, this file is deprecated.
- def load_specs(type)
- names = []
-
- @specs = {}
-
- Dir["*.gem"].each do |file|
- begin
- pkg = Gem::Package.new(file)
- rescue SystemCallError, Gem::Package::FormatError
- # ignore
- else
- tup = pkg.spec.name_tuple
- @specs[tup] = [File.expand_path(file), pkg]
-
- case type
- when :released
- unless pkg.spec.version.prerelease?
- names << pkg.spec.name_tuple
- end
- when :prerelease
- if pkg.spec.version.prerelease?
- names << pkg.spec.name_tuple
- end
- when :latest
- tup = pkg.spec.name_tuple
-
- cur = names.find { |x| x.name == tup.name }
- if !cur
- names << tup
- elsif cur.version < tup.version
- names.delete cur
- names << tup
- end
- else
- names << pkg.spec.name_tuple
- end
- end
- end
-
- names
- end
-
- def find_gem(gem_name, version=Gem::Requirement.default,
- prerelease=false)
- load_specs :complete
-
- found = []
-
- @specs.each do |n, data|
- if n.name == gem_name
- s = data[1].spec
-
- if version.satisfied_by?(s.version)
- if prerelease
- found << s
- elsif !s.version.prerelease?
- found << s
- end
- end
- end
- end
-
- found.sort_by { |s| s.version }.last
- end
-
- def fetch_spec(name)
- load_specs :complete
-
- if data = @specs[name]
- data.last.spec
- else
- raise Gem::Exception, "Unable to find spec for '#{name}'"
- end
- end
-
- def download(spec, cache_dir=nil)
- load_specs :complete
-
- @specs.each do |name, data|
- return data[0] if data[1].spec == spec
- end
-
- raise Gem::Exception, "Unable to find file for '#{spec.full_name}'"
- end
-end
diff --git a/lib/rubygems/source_specific_file.rb b/lib/rubygems/source_specific_file.rb
index d296e617cc..f785c2667c 100644
--- a/lib/rubygems/source_specific_file.rb
+++ b/lib/rubygems/source_specific_file.rb
@@ -1,28 +1,4 @@
-class Gem::Source::SpecificFile < Gem::Source
- def initialize(file)
- @uri = nil
- @path = ::File.expand_path(file)
+require 'rubygems/source/specific_file'
- @package = Gem::Package.new @path
- @spec = @package.spec
- @name = @spec.name_tuple
- end
+# TODO warn upon require, this file is deprecated.
- attr_reader :spec
-
- def load_specs(*a)
- [@name]
- end
-
- def fetch_spec(name)
- return @spec if name == @name
- raise Gem::Exception, "Unable to find '#{name}'"
- @spec
- end
-
- def download(spec, dir=nil)
- return @path if spec == @spec
- raise Gem::Exception, "Unable to download '#{spec.full_name}'"
- end
-
-end
diff --git a/lib/rubygems/spec_fetcher.rb b/lib/rubygems/spec_fetcher.rb
index e4db426633..4967c4a40b 100644
--- a/lib/rubygems/spec_fetcher.rb
+++ b/lib/rubygems/spec_fetcher.rb
@@ -18,6 +18,11 @@ class Gem::SpecFetcher
attr_reader :latest_specs # :nodoc:
##
+ # Sources for this SpecFetcher
+
+ attr_reader :sources # :nodoc:
+
+ ##
# Cache of all released specs
attr_reader :specs # :nodoc:
@@ -29,6 +34,10 @@ class Gem::SpecFetcher
@fetcher = nil
+ ##
+ # Default fetcher instance. Use this instead of ::new to reduce object
+ # allocation.
+
def self.fetcher
@fetcher ||= new
end
@@ -37,8 +46,16 @@ class Gem::SpecFetcher
@fetcher = fetcher
end
- def initialize
- @dir = File.join Gem.user_home, '.gem', 'specs'
+ ##
+ # Creates a new SpecFetcher. Ordinarily you want to use the default fetcher
+ # from Gem::SpecFetcher::fetcher which uses the Gem.sources.
+ #
+ # If you need to retrieve specifications from a different +source+, you can
+ # send it as an argument.
+
+ def initialize sources = nil
+ @sources = sources || Gem.sources
+
@update_cache =
begin
File.stat(Gem.user_home).uid == Process.uid
@@ -71,7 +88,11 @@ class Gem::SpecFetcher
rejected_specs = {}
if dependency.prerelease?
- type = :complete
+ if dependency.specific?
+ type = :complete
+ else
+ type = :abs_latest
+ end
elsif dependency.latest_version?
type = :latest
else
@@ -80,6 +101,12 @@ class Gem::SpecFetcher
list, errors = available_specs(type)
list.each do |source, specs|
+ if dependency.name.is_a?(String) && specs.respond_to?(:bsearch)
+ start_index = (0 ... specs.length).bsearch{ |i| specs[i].name >= dependency.name }
+ end_index = (0 ... specs.length).bsearch{ |i| specs[i].name > dependency.name }
+ specs = specs[start_index ... end_index] if start_index && end_index
+ end
+
found[source] = specs.select do |tup|
if dependency.match?(tup)
if matching_platform and !Gem::Platform.match(tup.platform)
@@ -159,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(:complete).first.values.flatten(1)
+ names = available_specs(:latest).first.values.flatten(1)
matches = names.map { |n|
next unless n.match_platform?
@@ -192,7 +219,7 @@ class Gem::SpecFetcher
errors = []
list = {}
- Gem.sources.each_source do |source|
+ @sources.each_source do |source|
begin
names = case type
when :latest
@@ -200,8 +227,17 @@ class Gem::SpecFetcher
when :released
tuples_for source, :released
when :complete
- tuples_for(source, :prerelease, true) +
+ names =
+ tuples_for(source, :prerelease, true) +
tuples_for(source, :released)
+
+ names.sort
+ when :abs_latest
+ names =
+ tuples_for(source, :prerelease, true) +
+ tuples_for(source, :latest)
+
+ names.sort
when :prerelease
tuples_for(source, :prerelease)
else
@@ -217,18 +253,16 @@ class Gem::SpecFetcher
[list, errors]
end
- def tuples_for(source, type, gracefully_ignore=false)
- cache = @caches[type]
-
- if gracefully_ignore
- begin
- cache[source.uri] ||= source.load_specs(type)
- rescue Gem::RemoteFetcher::FetchError
- []
- end
- else
- cache[source.uri] ||= source.load_specs(type)
- end
+ ##
+ # Retrieves NameTuples from +source+ of the given +type+ (:prerelease,
+ # 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
+ []
end
end
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index cc31c898f3..975a2e3f9a 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -5,16 +5,14 @@
# See LICENSE.txt for permissions.
#++
+
require 'rubygems/version'
require 'rubygems/requirement'
require 'rubygems/platform'
require 'rubygems/deprecate'
-
-# :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:
+require 'rubygems/basic_specification'
+require 'rubygems/stub_specification'
+require 'rubygems/util/stringio'
##
# The Specification class contains the information for a Gem. Typically
@@ -23,6 +21,7 @@ class Date; end
# Gem::Specification.new do |s|
# s.name = 'example'
# s.version = '0.1.0'
+# s.licenses = ['MIT']
# s.summary = "This is an example!"
# s.description = "Much longer explanation of the example!"
# s.authors = ["Ruby Coder"]
@@ -31,21 +30,11 @@ class Date; end
# s.homepage = 'https://rubygems.org/gems/example'
# end
#
-# Starting in RubyGems 1.9.0, a Specification can hold arbitrary
-# metadata. This metadata is accessed via Specification#metadata
-# and has the following restrictions:
-#
-# * Must be a Hash object
-# * All keys and values must be Strings
-# * Keys can be a maximum of 128 bytes and values can be a
-# maximum of 1024 bytes
-# * All strings must be UTF8, no binary data is allowed
-#
-# For example, to add metadata for the location of a bugtracker:
-#
-# s.metadata = { "bugtracker" => "http://somewhere.com/blah" }
+# Starting in RubyGems 2.0, a Specification can hold arbitrary
+# metadata. See #metadata for restrictions on the format and size of metadata
+# items you may add to a specification.
-class Gem::Specification
+class Gem::Specification < Gem::BasicSpecification
# REFACTOR: Consider breaking out this version stuff into a separate
# module. There's enough special stuff around it that it may justify
@@ -78,13 +67,13 @@ class Gem::Specification
#
# NOTE RubyGems < 1.2 cannot load specification versions > 2.
- CURRENT_SPECIFICATION_VERSION = 4
+ CURRENT_SPECIFICATION_VERSION = 4 # :nodoc:
##
# An informal list of changes to the specification. The highest-valued
# key should be equal to the CURRENT_SPECIFICATION_VERSION.
- SPECIFICATION_VERSION_HISTORY = {
+ SPECIFICATION_VERSION_HISTORY = { # :nodoc:
-1 => ['(RubyGems versions up to and including 0.7 did not have versioned specifications)'],
1 => [
'Deprecated "test_suite_file" in favor of the new, but equivalent, "test_files"',
@@ -102,10 +91,20 @@ class Gem::Specification
]
}
- MARSHAL_FIELDS = { -1 => 16, 1 => 16, 2 => 16, 3 => 17, 4 => 18 }
+ MARSHAL_FIELDS = { # :nodoc:
+ -1 => 16,
+ 1 => 16,
+ 2 => 16,
+ 3 => 17,
+ 4 => 18,
+ }
today = Time.now.utc
- TODAY = Time.utc(today.year, today.month, today.day)
+ TODAY = Time.utc(today.year, today.month, today.day) # :nodoc:
+
+ LOAD_CACHE = {} # :nodoc:
+
+ private_constant :LOAD_CACHE if defined? private_constant
# :startdoc:
@@ -156,6 +155,17 @@ class Gem::Specification
:version => nil,
}
+ Dupable = { } # :nodoc:
+
+ @@default_value.each do |k,v|
+ case v
+ when Time, Numeric, Symbol, true, false, nil
+ Dupable[k] = false
+ else
+ Dupable[k] = true
+ end
+ end
+
@@attributes = @@default_value.keys.sort_by { |s| s.to_s }
@@array_attributes = @@default_value.reject { |k,v| v != [] }.keys
@@nil_attributes, @@non_nil_attributes = @@default_value.keys.partition { |k|
@@ -191,6 +201,8 @@ class Gem::Specification
# Paths in the gem to add to <code>$LOAD_PATH</code> when this gem is
# activated.
#
+ # See also #require_paths
+ #
# If you have an extension you do not need to add <code>"ext"</code> to the
# require path, the extension build process will copy the extension files
# into "lib" for you.
@@ -200,9 +212,11 @@ class Gem::Specification
# Usage:
#
# # If all library files are in the root directory...
- # spec.require_path = '.'
+ # spec.require_paths = ['.']
- attr_accessor :require_paths
+ def require_paths=(val)
+ @require_paths = Array(val)
+ end
##
# The version of RubyGems used to create this gem.
@@ -223,6 +237,28 @@ class Gem::Specification
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.
@@ -309,7 +345,7 @@ class Gem::Specification
add_bindir(@executables),
@extra_rdoc_files,
@extensions,
- ].flatten.uniq.compact
+ ].flatten.uniq.compact.sort
end
######################################################################
@@ -333,7 +369,9 @@ class Gem::Specification
##
# A long description of this gem
#
- # The description should be more detailed than the summary.
+ # 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.
#
# Usage:
#
@@ -373,6 +411,16 @@ class Gem::Specification
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
@@ -380,10 +428,21 @@ class Gem::Specification
##
# :attr_accessor: metadata
#
- # Arbitrary metadata for this gem. An instance of Hash.
+ # The metadata holds extra data for this gem that may be useful to other
+ # consumers and is settable by gem authors without requiring an update to
+ # the rubygems software.
+ #
+ # Metadata items have the following restrictions:
#
- # metadata is simply a Symbol => String association that contains arbitary
- # data that could be useful to other consumers.
+ # * The metadata must be a Hash object
+ # * All keys and values must be Strings
+ # * Keys can be a maximum of 128 bytes and values can be a maximum of 1024
+ # bytes
+ # * All strings must be UTF-8, no binary data is allowed
+ #
+ # To add metadata for the location of a issue tracker:
+ #
+ # s.metadata = { "issue_tracker" => "https://example/issues" }
attr_accessor :metadata
@@ -414,35 +473,16 @@ class Gem::Specification
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
# full path (as in bin/rake); all application-style files are expected to be
- # found in bindir. These files must be executable ruby files. Files that
+ # 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'
@@ -485,12 +525,44 @@ class Gem::Specification
end
##
+ # The version of RubyGems that installed this gem. Returns
+ # <code>Gem::Version.new(0)</code> for gems installed by versions earlier
+ # than RubyGems 2.2.0.
+
+ def installed_by_version # :nodoc:
+ @installed_by_version ||= Gem::Version.new(0)
+ end
+
+ ##
+ # Sets the version of RubyGems that installed this gem. See also
+ # #installed_by_version.
+
+ def installed_by_version= version # :nodoc:
+ @installed_by_version = Gem::Version.new version
+ end
+
+ ##
+ # :category: Recommended gemspec attributes
+ #
# The license for this gem.
#
- # The license must be a short name, no more than 64 characters.
+ # 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 when you build it.
+ # 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 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.
+ #
+ # The most commonly used OSI approved licenses are BSD-3-Clause and MIT.
+ # 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.
#
# You can set multiple licenses with #licenses=
#
@@ -502,6 +574,7 @@ class Gem::Specification
end
##
+ # :category: Recommended gemspec attributes
# The license(s) for the library.
#
# Each license must be a short name, no more than 64 characters.
@@ -509,6 +582,8 @@ class Gem::Specification
# 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.
#
+ # See #license= for more discussion
+ #
# Usage:
# spec.licenses = ['MIT', 'GPL-2']
@@ -550,6 +625,13 @@ class Gem::Specification
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.
#
@@ -570,7 +652,7 @@ class Gem::Specification
# spec.test_files = Dir.glob('test/tc_*.rb')
# spec.test_files = ['tests/test-suite.rb']
- def test_files= files
+ def test_files= files # :nodoc:
@test_files = Array files
end
@@ -599,26 +681,11 @@ class Gem::Specification
attr_writer :default_executable
##
- # Path this gemspec was loaded from. This attribute is not persisted.
-
- attr_reader :loaded_from
-
- ##
# Allows deinstallation of gems with legacy platforms.
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".
#
@@ -633,58 +700,65 @@ class Gem::Specification
attr_accessor :specification_version
- class << self
- def default_specifications_dir
- File.join(Gem.default_dir, "specifications", "default")
+ def self._all # :nodoc:
+ unless defined?(@@all) && @@all then
+ @@all = stubs.map(&:to_spec)
+
+ # After a reset, make sure already loaded specs
+ # are still marked as activated.
+ specs = {}
+ Gem.loaded_specs.each_value{|s| specs[s] = true}
+ @@all.each{|s| s.activated = true if specs[s]}
+
+ _resort!(@@all)
end
+ @@all
+ end
+
+ def self._clear_load_cache # :nodoc:
+ LOAD_CACHE.clear
+ end
- def each_spec(search_dirs) # :nodoc:
- search_dirs.each { |dir|
- Dir[File.join(dir, "*.gemspec")].each { |path|
- spec = Gem::Specification.load path.untaint
- # #load returns nil if the spec is bad, so we just ignore
- # it at this stage
- yield(spec) if spec
- }
- }
+ def self.each_gemspec(dirs) # :nodoc:
+ dirs.each do |dir|
+ Dir[File.join(dir, "*.gemspec")].each do |path|
+ yield path.untaint
+ end
end
+ end
- def each_default(&block) # :nodoc:
- each_spec([default_specifications_dir],
- &block)
+ def self.each_stub(dirs) # :nodoc:
+ each_gemspec(dirs) do |path|
+ stub = Gem::StubSpecification.new(path)
+ yield stub if stub.valid?
end
+ end
- def each_normal(&block) # :nodoc:
- each_spec(dirs, &block)
+ def self.each_spec(dirs) # :nodoc:
+ each_gemspec(dirs) do |path|
+ spec = self.load path
+ yield spec if spec
end
end
- def self._all # :nodoc:
- unless defined?(@@all) && @@all then
+ ##
+ # Returns a Gem::StubSpecification for every installed gem
- specs = {}
- each_default do |spec|
- specs[spec.full_name] ||= spec
+ def self.stubs
+ @@stubs ||= begin
+ stubs = {}
+ each_stub([default_specifications_dir] + dirs) do |stub|
+ stubs[stub.full_name] ||= stub
end
- each_normal do |spec|
- specs[spec.full_name] ||= spec
- end
-
- @@all = specs.values
- # After a reset, make sure already loaded specs
- # are still marked as activated.
- specs = {}
- Gem.loaded_specs.each_value{|s| specs[s] = true}
- @@all.each{|s| s.activated = true if specs[s]}
-
- _resort!
+ stubs = stubs.values
+ _resort!(stubs)
+ stubs
end
- @@all
end
- def self._resort! # :nodoc:
- @@all.sort! { |a, b|
+ def self._resort!(specs) # :nodoc:
+ specs.sort! { |a, b|
names = a.name <=> b.name
next names if names.nonzero?
b.version <=> a.version
@@ -695,7 +769,9 @@ class Gem::Specification
# Loads the default specifications. It should be called only once.
def self.load_defaults
- each_default do |spec|
+ each_spec([default_specifications_dir]) do |spec|
+ # #load returns nil if the spec is bad, so we just ignore
+ # it at this stage
Gem.register_default_spec(spec)
end
end
@@ -718,7 +794,9 @@ class Gem::Specification
return if _all.include? spec
_all << spec
- _resort!
+ stubs << spec
+ _resort!(_all)
+ _resort!(stubs)
end
##
@@ -759,7 +837,7 @@ class Gem::Specification
# -- wilsonb
def self.all= specs
- @@all = specs
+ @@all = @@stubs = specs
end
##
@@ -801,12 +879,8 @@ class Gem::Specification
# this resets the list of known specs.
def self.dirs= dirs
- # TODO: find extra calls to dir=
- # warn "NOTE: dirs= called from #{caller.first} for #{dirs.inspect}"
-
self.reset
- # ugh
@@dirs = Array(dirs).map { |dir| File.join dir, "specifications" }
end
@@ -861,9 +935,10 @@ class Gem::Specification
# amongst the specs that are not activated.
def self.find_inactive_by_path path
- self.find { |spec|
- spec.contains_requirable_file? path unless spec.activated?
+ stub = stubs.find { |s|
+ s.contains_requirable_file? path unless s.activated?
}
+ stub && stub.to_spec
end
##
@@ -944,7 +1019,7 @@ class Gem::Specification
result.map(&:last).map(&:values).flatten.reject { |spec|
minimum = native[spec.name]
minimum && spec.version < minimum
- }
+ }.sort_by{ |tup| tup.name }
end
##
@@ -955,6 +1030,9 @@ class Gem::Specification
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
@@ -967,7 +1045,8 @@ class Gem::Specification
spec = eval code, binding, file
if Gem::Specification === spec
- spec.loaded_from = file.to_s
+ spec.loaded_from = File.expand_path file.to_s
+ LOAD_CACHE[file] = spec
return spec
end
@@ -1002,25 +1081,43 @@ class Gem::Specification
end
##
- # Return a list of all outdated specifications. This method is HEAVY
+ # Return a list of all outdated local gem names. This method is HEAVY
# as it must go fetch specifications from the server.
+ #
+ # Use outdated_and_latest_version if you wish to retrieve the latest remote
+ # version as well.
def self.outdated
- outdateds = []
+ outdated_and_latest_version.map { |local, _| local.name }
+ end
+
+ ##
+ # Enumerates the outdated local gems yielding the local specification and
+ # the latest remote version.
+ #
+ # This method may take some time to return as it must check each local gem
+ # against the server's index.
+
+ def self.outdated_and_latest_version
+ return enum_for __method__ unless block_given?
# TODO: maybe we should switch to rubygems' version service?
fetcher = Gem::SpecFetcher.fetcher
- latest_specs(true).each do |local|
- dependency = Gem::Dependency.new local.name, ">= #{local.version}"
- remotes, _ = fetcher.search_for_dependency dependency
- remotes = remotes.map { |n, _| n.version }
- latest = remotes.sort.last
+ latest_specs(true).each do |local_spec|
+ dependency =
+ Gem::Dependency.new local_spec.name, ">= #{local_spec.version}"
- outdateds << local.name if latest and local.version < latest
+ remotes, = fetcher.search_for_dependency dependency
+ remotes = remotes.map { |n, _| n.version }
+
+ latest_remote = remotes.sort.last
+
+ yield [local_spec, latest_remote] if
+ latest_remote and local_spec.version < latest_remote
end
- outdateds
+ nil
end
##
@@ -1028,6 +1125,7 @@ class Gem::Specification
def self.remove_spec spec
_all.delete spec
+ stubs.delete_if { |s| s.full_name == spec.full_name }
end
##
@@ -1052,6 +1150,8 @@ class Gem::Specification
@@dirs = nil
Gem.pre_reset_hooks.each { |hook| hook.call }
@@all = nil
+ @@stubs = nil
+ _clear_load_cache
unresolved = unresolved_deps
unless unresolved.empty? then
w = "W" + "ARN"
@@ -1173,9 +1273,13 @@ class Gem::Specification
# there are conflicts upon activation.
def activate
- raise_if_conflicts
+ other = Gem.loaded_specs[self.name]
+ if other then
+ check_version_conflict other
+ return false
+ end
- return false if Gem.loaded_specs[self.name]
+ raise_if_conflicts
activate_dependencies
add_self_to_load_path
@@ -1189,7 +1293,7 @@ class Gem::Specification
##
# Activate all unambiguously resolved runtime dependencies of this
- # spec. Add any ambigous dependencies to the unresolved list to be
+ # spec. Add any ambiguous dependencies to the unresolved list to be
# resolved later, as needed.
def activate_dependencies
@@ -1265,9 +1369,7 @@ class Gem::Specification
def add_self_to_load_path
return if default_gem?
- paths = require_paths.map do |path|
- File.join full_gem_path, path
- end
+ paths = full_require_paths
# gem directories must come after -I and ENV['RUBYLIB']
insert_index = Gem.load_path_insert_index
@@ -1298,20 +1400,6 @@ class Gem::Specification
end
##
- # Returns the full path to the base gem directory.
- #
- # eg: /usr/local/lib/ruby/gems/1.8
-
- 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
-
- ##
# Returns the full path to installed gem's bin directory.
#
# NOTE: do not confuse this with +bindir+, which is just 'bin', not
@@ -1332,14 +1420,50 @@ class Gem::Specification
# Returns the build_args used to install the gem
def build_args
- if File.exists? build_info_file
- File.readlines(build_info_file).map { |x| x.strip }
+ 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
else
[]
end
end
##
+ # Builds extensions for this platform if the gem has extensions listed and
+ # the gem.build_complete file is missing.
+
+ def build_extensions # :nodoc:
+ return if default_gem?
+ 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'))
+
+ begin
+ # We need to require things in $LOAD_PATH without looking for the
+ # extension we are about to build.
+ unresolved_deps = Gem::Specification.unresolved_deps.dup
+ Gem::Specification.unresolved_deps.clear
+
+ require 'rubygems/config_file'
+ require 'rubygems/ext'
+ require 'rubygems/user_interaction'
+
+ ui = Gem::SilentUI.new
+ Gem::DefaultUserInteraction.use_ui ui 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
+
+ ##
# Returns the full path to the build info directory
def build_info_dir
@@ -1374,30 +1498,16 @@ class Gem::Specification
def conflicts
conflicts = {}
- Gem.loaded_specs.values.each do |spec|
- bad = self.runtime_dependencies.find_all { |dep|
- spec.name == dep.name and not spec.satisfies_requirement? dep
- }
-
- conflicts[spec] = bad unless bad.empty?
- end
+ 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 this spec can require +file+.
-
- def contains_requirable_file? file
- root = full_gem_path
- suffixes = Gem.suffixes
-
- require_paths.any? do |lib|
- base = "#{root}/#{lib}/#{file}"
- suffixes.any? { |suf| File.file? "#{base}#{suf}" }
- end
- end
-
- ##
# The date this gem was created. Lazily defaults to the current UTC date.
#
# There is no need to set this in your gem specification.
@@ -1406,10 +1516,16 @@ class Gem::Specification
@date ||= TODAY
end
- DateTimeFormat = /\A
- (\d{4})-(\d{2})-(\d{2})
- (\s+ \d{2}:\d{2}:\d{2}\.\d+ \s* (Z | [-+]\d\d:\d\d) )?
- \Z/x
+ DateLike = Object.new # :nodoc:
+ def DateLike.===(obj) # :nodoc:
+ defined?(::Date) and Date === obj
+ end
+
+ DateTimeFormat = # :nodoc:
+ /\A
+ (\d{4})-(\d{2})-(\d{2})
+ (\s+ \d{2}:\d{2}:\d{2}\.\d+ \s* (Z | [-+]\d\d:\d\d) )?
+ \Z/x
##
# The date this gem was created
@@ -1434,7 +1550,7 @@ class Gem::Specification
raise(Gem::InvalidSpecificationException,
"invalid date format in specification: #{date.inspect}")
end
- when Time, Date then
+ when Time, DateLike then
Time.utc(date.year, date.month, date.day)
else
TODAY
@@ -1482,7 +1598,6 @@ class Gem::Specification
# [depending_gem, dependency, [list_of_gems_that_satisfy_dependency]]
def dependent_gems
- # REFACTOR: out = []; each; out; ? Really? No #collect love?
out = []
Gem::Specification.each do |spec|
spec.dependencies.each do |dep|
@@ -1521,7 +1636,7 @@ class Gem::Specification
##
# Returns the full path to this spec's documentation directory. If +type+
- # is given it will be appended to the end. For examlpe:
+ # is given it will be appended to the end. For example:
#
# spec.doc_dir # => "/path/to/gem_repo/doc/a-1"
#
@@ -1642,52 +1757,28 @@ class Gem::Specification
spec
end
- ##
- # The full path to the gem (install path + full name).
-
- def full_gem_path
- # TODO: This is a heavily used method by gems, so we'll need
- # to aleast just alias it to #gem_dir rather than remove it.
-
- # TODO: also, shouldn't it default to full_name if it hasn't been written?
- return @full_gem_path if defined?(@full_gem_path) && @full_gem_path
-
- @full_gem_path = File.expand_path File.join(gems_dir, full_name)
- @full_gem_path.untaint
-
- return @full_gem_path if File.directory? @full_gem_path
-
- @full_gem_path = File.expand_path File.join(gems_dir, original_name)
+ def find_full_gem_path # :nodoc:
+ super || File.expand_path(File.join(gems_dir, original_name))
end
-
- ##
- # Returns the full name (name-version) of this Gem. Platform information
- # is included (name-version-platform) if it is specified and not the
- # default Ruby platform.
+ private :find_full_gem_path
def full_name
- @full_name ||= if platform == Gem::Platform::RUBY or platform.nil? then
- "#{@name}-#{@version}".untaint
- else
- "#{@name}-#{@version}-#{platform}".untaint
- end
+ @full_name ||= super
end
##
- # Returns the full path to this spec's gem directory.
- # eg: /usr/local/lib/ruby/1.8/gems/mygem-1.0
+ # The path to the gem.build_complete file within the extension install
+ # directory.
- def gem_dir
- @gem_dir ||= File.expand_path File.join(gems_dir, full_name)
+ def gem_build_complete_path # :nodoc:
+ File.join extension_dir, 'gem.build_complete'
end
##
- # Returns the full path to the gems directory containing this spec's
- # gem directory. eg: /usr/local/lib/ruby/1.8/gems
+ # Work around bundler removing my methods
- 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")
+ def gem_dir # :nodoc:
+ super
end
##
@@ -1713,7 +1804,7 @@ class Gem::Specification
##
# True if this gem has files in test_files
- def has_unit_tests?
+ def has_unit_tests? # :nodoc:
not test_files.empty?
end
@@ -1722,12 +1813,11 @@ class Gem::Specification
# :startdoc:
def hash # :nodoc:
- @@attributes.inject(0) { |hash_code, (name, _)|
- hash_code ^ self.send(name).hash
- }
+ name.hash ^ version.hash
end
def init_with coder # :nodoc:
+ @installed_by_version ||= nil
yaml_initialize coder.tag, coder.map
end
@@ -1739,8 +1829,9 @@ class Gem::Specification
def initialize name = nil, version = nil
@loaded = false
@activated = false
- @loaded_from = nil
+ self.loaded_from = nil
@original_platform = nil
+ @installed_by_version = nil
@@nil_attributes.each do |key|
instance_variable_set "@#{key}", nil
@@ -1748,11 +1839,7 @@ class Gem::Specification
@@non_nil_attributes.each do |key|
default = default_value(key)
- value = case default
- when Time, Numeric, Symbol, true, false, nil then default
- else default.dup
- end
-
+ value = Dupable[key] ? default.dup : default
instance_variable_set "@#{key}", value
end
@@ -1800,7 +1887,7 @@ class Gem::Specification
private :invalidate_memoized_attributes
- def inspect
+ def inspect # :nodoc:
if $DEBUG
super
else
@@ -1842,27 +1929,20 @@ class Gem::Specification
##
# Plural accessor for setting licenses
+ #
+ # See #license= for details
def licenses
@licenses ||= []
end
- ##
- # Set the location a Specification was loaded from. +obj+ is converted
- # to a String.
-
- def loaded_from= path
- @loaded_from = path.to_s
+ def loaded_from= path # :nodoc:
+ super
- # reset everything @loaded_from depends upon
- @base_dir = nil
@bin_dir = nil
@cache_dir = nil
@cache_file = nil
@doc_dir = nil
- @full_gem_path = nil
- @gem_dir = nil
- @gems_dir = nil
@ri_dir = nil
@spec_dir = nil
@spec_file = nil
@@ -1898,6 +1978,19 @@ class Gem::Specification
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
@@ -1954,8 +2047,12 @@ class Gem::Specification
q.group 2, 'Gem::Specification.new do |s|', 'end' do
q.breakable
- # REFACTOR: each_attr - use in to_yaml as well
- @@attributes.each do |attr_name|
+ attributes = @@attributes - [:name, :version]
+ attributes.unshift :installed_by_version
+ attributes.unshift :version
+ attributes.unshift :name
+
+ attributes.each do |attr_name|
current_value = self.send attr_name
if current_value != default_value(attr_name) or
self.class.required_attribute? attr_name then
@@ -1977,34 +2074,34 @@ class Gem::Specification
end
##
- # Check the spec for possible conflicts and freak out if there are any.
+ # Raise an exception if the version of this spec conflicts with the one
+ # that is already loaded (+other+)
- 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:
+ conf = self.conflicts
- raise Gem::LoadError, "Unable to activate #{self.full_name}, because #{y}"
+ unless conf.empty? then
+ raise Gem::ConflictError.new self, conf
end
end
@@ -2028,14 +2125,7 @@ class Gem::Specification
# Singular accessor for #require_paths
def require_path= 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
+ self.require_paths = Array(path)
end
##
@@ -2047,6 +2137,10 @@ class Gem::Specification
@requirements = Array req
end
+ def respond_to_missing? m, include_private = false # :nodoc:
+ false
+ end
+
##
# Returns the full path to this spec's ri directory.
@@ -2066,7 +2160,7 @@ class Gem::Specification
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 Date then obj.strftime('%Y-%m-%d').dump
+ when DateLike 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
@@ -2108,11 +2202,17 @@ class Gem::Specification
# Returns an object you can use to sort specifications in #sort_by.
def sort_obj
- # TODO: this is horrible. Deprecate it.
[@name, @version, @new_platform == Gem::Platform::RUBY ? -1 : 1]
end
##
+ # Used by Gem::Resolver to order Gem::Specification objects
+
+ def source # :nodoc:
+ Gem::Source::Installed.new
+ end
+
+ ##
# Returns the full path to the directory containing this spec's
# gemspec file. eg: /usr/local/lib/ruby/gems/1.8/specifications
@@ -2148,14 +2248,14 @@ class Gem::Specification
##
# Singular accessor for #test_files
- def test_file
+ def test_file # :nodoc:
val = test_files and val.first
end
##
# Singular mutator for #test_files
- def test_file= file
+ def test_file= file # :nodoc:
self.test_files = [file]
end
@@ -2163,7 +2263,7 @@ class Gem::Specification
# Test files included in this gem. You cannot append to this accessor, you
# must assign to it.
- def test_files
+ def test_files # :nodoc:
# Handle the possibility that we have @test_suite_file but not
# @test_files. This will happen when an old gem is loaded via
# YAML.
@@ -2182,15 +2282,14 @@ class Gem::Specification
# Returns a Ruby code representation of this specification, such that it can
# be eval'ed and reconstruct the same specification later. Attributes that
# still have their default values are omitted.
- #
- # REFACTOR: This, plus stuff like #ruby_code and #pretty_print, should
- # probably be extracted out into some sort of separate class. SRP, do you
- # speak it!??!
def to_ruby
mark_version
result = []
result << "# -*- encoding: utf-8 -*-"
+ result << "#{Gem::StubSpecification::PREFIX}#{name} #{version} #{platform} #{raw_require_paths.join("\0")}"
+ result << "#{Gem::StubSpecification::PREFIX}#{extensions.join "\0"}" unless
+ extensions.empty?
result << nil
result << "Gem::Specification.new do |s|"
@@ -2205,11 +2304,13 @@ class Gem::Specification
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}"
handled = [
:dependencies,
:name,
:platform,
+ :require_paths,
:required_rubygems_version,
:specification_version,
:version,
@@ -2227,6 +2328,11 @@ class Gem::Specification
end
end
+ if @installed_by_version then
+ result << nil
+ result << " s.installed_by_version = \"#{Gem::VERSION}\" if s.respond_to? :installed_by_version"
+ end
+
unless dependencies.empty? then
result << nil
result << " if s.respond_to? :specification_version then"
@@ -2278,8 +2384,16 @@ class Gem::Specification
"#<Gem::Specification name=#{@name} version=#{@version}>"
end
+ ##
+ # Returns self
+
+ def to_spec
+ self
+ end
+
def to_yaml(opts = {}) # :nodoc:
- if YAML.const_defined?(:ENGINE) && !YAML::ENGINE.syck? then
+ if (YAML.const_defined?(:ENGINE) && !YAML::ENGINE.syck?) ||
+ (defined?(Psych) && YAML == Psych) 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.
@@ -2291,7 +2405,7 @@ class Gem::Specification
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)
@@ -2329,6 +2443,7 @@ class Gem::Specification
# checks..
def validate packaging = true
+ @warnings = 0
require 'rubygems/user_interaction'
extend Gem::UserInteraction
normalize
@@ -2359,7 +2474,7 @@ class Gem::Specification
"invalid value for attribute name: \"#{name.inspect}\""
end
- if require_paths.empty? then
+ if raw_require_paths.empty? then
raise Gem::InvalidSpecificationException,
'specification must have at least one require_path'
end
@@ -2377,6 +2492,11 @@ class Gem::Specification
"[\"#{non_files.join "\", \""}\"] are not files"
end
+ if files.include? file_name then
+ raise Gem::InvalidSpecificationException,
+ "#{full_name} contains itself (#{file_name}), check your files list"
+ end
+
unless specification_version.is_a?(Fixnum)
raise Gem::InvalidSpecificationException,
'specification_version must be a Fixnum (did you mean version?)'
@@ -2404,7 +2524,6 @@ class Gem::Specification
end
end
- # FIX: uhhhh single element array.each?
[:authors].each do |field|
val = self.send field
raise Gem::InvalidSpecificationException, "#{field} may not be empty" if
@@ -2447,13 +2566,15 @@ class Gem::Specification
end
}
- alert_warning 'licenses is empty' if licenses.empty?
+ warning <<-warning if licenses.empty?
+licenses is empty, but is recommended. Use a license abbreviation from:
+http://opensource.org/licenses/alphabetical
+ warning
validate_permissions
# reject lazy developers:
- # FIX: Doesn't this just evaluate to "FIXME" or "TODO"?
lazy = '"FIxxxXME" or "TOxxxDO"'.gsub(/xxx/, '')
unless authors.grep(/FI XME|TO DO/x).empty? then
@@ -2482,33 +2603,99 @@ class Gem::Specification
%w[author description email homepage summary].each do |attribute|
value = self.send attribute
- alert_warning "no #{attribute} specified" if value.nil? or value.empty?
+ warning "no #{attribute} specified" if value.nil? or value.empty?
end
if description == summary then
- alert_warning 'description and summary are identical'
+ warning 'description and summary are identical'
end
# TODO: raise at some given date
- alert_warning "deprecated autorequire specified" if autorequire
+ warning "deprecated autorequire specified" if autorequire
executables.each do |executable|
executable_path = File.join(bindir, executable)
shebang = File.read(executable_path, 2) == '#!'
- alert_warning "#{executable_path} is missing #! line" unless shebang
+ warning "#{executable_path} is missing #! line" unless shebang
end
+ validate_dependencies
+
+ true
+ ensure
+ if $! or @warnings > 0 then
+ alert_warning "See http://guides.rubygems.org/specification-reference/ for help"
+ end
+ end
+
+ ##
+ # Checks that dependencies use requirements as we recommend. Warnings are
+ # issued when dependencies are open-ended or overly strict for semantic
+ # versioning.
+
+ def validate_dependencies # :nodoc:
+ seen = {}
+
dependencies.each do |dep|
+ if prev = seen[dep.name] then
+ raise Gem::InvalidSpecificationException, <<-MESSAGE
+duplicate dependency on #{dep}, (#{prev.requirement}) use:
+ add_runtime_dependency '#{dep.name}', '#{dep.requirement}', '#{prev.requirement}'
+ MESSAGE
+ end
+
+ seen[dep.name] = dep
+
prerelease_dep = dep.requirements_list.any? do |req|
Gem::Requirement.new(req).prerelease?
end
- alert_warning "prerelease dependency on #{dep} is not recommended" if
+ warning "prerelease dependency on #{dep} is not recommended" if
prerelease_dep
- end
- true
+ 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
+ end
+
+ if overly_strict then
+ _, dep_version = dep.requirement.requirements.first
+
+ base = dep_version.segments.first 2
+
+ 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}'
+ WARNING
+ end
+
+ open_ended = dep.requirement.requirements.all? do |op, version|
+ not version.prerelease? and (op == '>' or op == '>=')
+ end
+
+ if open_ended then
+ op, dep_version = dep.requirement.requirements.first
+
+ base = dep_version.segments.first 2
+
+ bugfix = if op == '>' then
+ ", '> #{dep_version}'"
+ elsif op == '>=' and base != dep_version.segments then
+ ", '>= #{dep_version}'"
+ end
+
+ 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
end
##
@@ -2519,13 +2706,13 @@ class Gem::Specification
files.each do |file|
next if File.stat(file).mode & 0444 == 0444
- alert_warning "#{file} is not world-readable"
+ warning "#{file} is not world-readable"
end
executables.each do |name|
exec = File.join @bindir, name
next if File.stat(exec).executable?
- alert_warning "#{exec} is not executable"
+ warning "#{exec} is not executable"
end
end
@@ -2542,7 +2729,10 @@ class Gem::Specification
return @version
end
- # FIX: have this handle the platform/new_platform/original_platform bullshit
+ def stubbed?
+ false
+ end
+
def yaml_initialize(tag, vals) # :nodoc:
vals.each do |ivar, val|
case ivar
@@ -2576,11 +2766,14 @@ class Gem::Specification
instance_variable_set "@#{attribute}", value
end
+
+ @installed_by_version ||= nil
end
- def default_gem?
- loaded_from &&
- File.dirname(loaded_from) == self.class.default_specifications_dir
+ def warning statement # :nodoc:
+ @warnings += 1
+
+ alert_warning statement
end
extend Gem::Deprecate
diff --git a/lib/rubygems/stub_specification.rb b/lib/rubygems/stub_specification.rb
new file mode 100644
index 0000000000..49a6df43a3
--- /dev/null
+++ b/lib/rubygems/stub_specification.rb
@@ -0,0 +1,190 @@
+##
+# Gem::StubSpecification reads the stub: line from the gemspec. This prevents
+# us having to eval the entire gemspec in order to find out certain
+# information.
+
+class Gem::StubSpecification < Gem::BasicSpecification
+ # :nodoc:
+ PREFIX = "# stub: "
+
+ OPEN_MODE = # :nodoc:
+ if Object.const_defined? :Encoding then
+ 'r:UTF-8:-'
+ else
+ 'r'
+ end
+
+ class StubLine # :nodoc: all
+ attr_reader :parts
+
+ def initialize(data)
+ @parts = data[PREFIX.length..-1].split(" ")
+ end
+
+ def name
+ @parts[0]
+ end
+
+ def version
+ Gem::Version.new @parts[1]
+ end
+
+ def platform
+ Gem::Platform.new @parts[2]
+ end
+
+ def require_paths
+ @parts[3..-1].join(" ").split("\0")
+ end
+ end
+
+ def initialize(filename)
+ self.loaded_from = filename
+ @data = nil
+ @extensions = nil
+ @spec = nil
+ end
+
+ ##
+ # True when this gem has been activated
+
+ def activated?
+ loaded = Gem.loaded_specs[name]
+ loaded && loaded.version == version
+ end
+
+ def build_extensions # :nodoc:
+ return if default_gem?
+ return if extensions.empty?
+
+ to_spec.build_extensions
+ end
+
+ ##
+ # If the gemspec contains a stubline, returns a StubLine instance. Otherwise
+ # returns the full Gem::Specification.
+
+ def data
+ unless @data
+ @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
+ end
+ end
+
+ @data ||= to_spec
+ end
+
+ private :data
+
+ ##
+ # Extensions for this gem
+
+ def extensions
+ return @extensions if @extensions
+
+ data # load
+
+ @extensions
+ end
+
+ ##
+ # 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 find_full_gem_path # :nodoc:
+ path = File.expand_path File.join gems_dir, full_name
+ path.untaint
+ path
+ end
+
+ ##
+ # Full paths in the gem to add to <code>$LOAD_PATH</code> when this gem is
+ # activated.
+
+ def full_require_paths
+ @require_paths ||= data.require_paths
+
+ super
+ end
+
+ def missing_extensions?
+ return false if default_gem?
+ return false if extensions.empty?
+
+ to_spec.missing_extensions?
+ end
+
+ ##
+ # Name of the gem
+
+ def name
+ @name ||= data.name
+ end
+
+ ##
+ # Platform of the gem
+
+ def platform
+ @platform ||= data.platform
+ end
+
+ ##
+ # 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 ||= Gem.loaded_specs.values.find { |spec|
+ spec.name == @name and spec.version == @version
+ }
+
+ @spec ||= Gem::Specification.load(loaded_from)
+ @spec.ignored = @ignored if instance_variable_defined? :@ignored
+
+ @spec
+ end
+
+ ##
+ # Is this StubSpecification valid? i.e. have we found a stub line, OR does
+ # the filename contain a valid gemspec?
+
+ def valid?
+ data
+ end
+
+ ##
+ # Version of the gem
+
+ def version
+ @version ||= data.version
+ end
+
+ ##
+ # Is there a stub line present for this StubSpecification?
+
+ def stubbed?
+ data.is_a? StubLine
+ end
+
+end
+
diff --git a/lib/rubygems/syck_hack.rb b/lib/rubygems/syck_hack.rb
index 5356aa081e..92179abb53 100644
--- a/lib/rubygems/syck_hack.rb
+++ b/lib/rubygems/syck_hack.rb
@@ -10,9 +10,9 @@
# class no matter if the full yaml library has loaded or not.
#
-module YAML
+module YAML # :nodoc:
# In newer 1.9.2, there is a Syck toplevel constant instead of it
- # being underneith YAML. If so, reference it back under YAML as
+ # being underneath YAML. If so, reference it back under YAML as
# well.
if defined? ::Syck
# for tests that change YAML::ENGINE
@@ -29,7 +29,7 @@ module YAML
# loaded, so lets define a stub for DefaultKey.
elsif !defined? YAML::Syck
module Syck
- class DefaultKey
+ class DefaultKey # :nodoc:
end
end
end
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb
index 7d087afade..e9916dad61 100644
--- a/lib/rubygems/test_case.rb
+++ b/lib/rubygems/test_case.rb
@@ -2,7 +2,7 @@
begin
gem 'minitest', '~> 4.0'
-rescue NoMethodError
+rescue NoMethodError, Gem::LoadError
# for ruby tests
end
@@ -24,17 +24,19 @@ unless Gem::Dependency.new('rdoc', '>= 3.10').matching_specs.empty?
gem 'json'
end
-require 'rubygems/deprecate'
require 'minitest/autorun'
+
+require 'rubygems/deprecate'
+
require 'fileutils'
+require 'pathname'
+require 'pp'
+require 'rubygems/package'
+require 'shellwords'
require 'tmpdir'
require 'uri'
-require 'rubygems/package'
-require 'rubygems/test_utilities'
-require 'pp'
require 'zlib'
-require 'pathname'
-require 'shellwords'
+
Gem.load_yaml
require 'rubygems/mock_gem_ui'
@@ -58,7 +60,7 @@ module Gem
end
##
- # Allows setting path to ruby. This method is available when requiring
+ # Allows setting path to Ruby. This method is available when requiring
# 'rubygems/test_case'
def self.ruby= ruby
@@ -84,12 +86,52 @@ end
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
+ when String then
+ Gem::Specification.find_by_name(spec).activate
+ when Gem::Specification then
+ spec.activate
+ else
+ flunk spec.inspect
+ end
+ end
+
+ loaded = Gem.loaded_specs.values.map(&:full_name)
+
+ assert_equal expected.sort, loaded.sort if expected
+ end
+
# TODO: move to minitest
def assert_path_exists path, msg = nil
msg = message(msg) { "Expected path '#{path}' to exist" }
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" }
@@ -176,11 +218,15 @@ class Gem::TestCase < MiniTest::Unit::TestCase
def setup
super
- @orig_gem_home = ENV['GEM_HOME']
- @orig_gem_path = ENV['GEM_PATH']
+ @orig_gem_home = ENV['GEM_HOME']
+ @orig_gem_path = ENV['GEM_PATH']
+ @orig_gem_vendor = ENV['GEM_VENDOR']
+
+ ENV['GEM_VENDOR'] = nil
@current_dir = Dir.pwd
- @ui = Gem::MockGemUi.new
+ @fetcher = nil
+ @ui = Gem::MockGemUi.new
tmpdir = File.expand_path Dir.tmpdir
tmpdir.untaint
@@ -206,13 +252,16 @@ class Gem::TestCase < MiniTest::Unit::TestCase
@gemhome = File.join @tempdir, 'gemhome'
@userhome = File.join @tempdir, 'userhome'
+ ENV["GEM_SPEC_CACHE"] = File.join @tempdir, 'spec_cache'
@orig_ruby = if ENV['RUBY'] then
- ruby = Gem.instance_variable_get :@ruby
- Gem.instance_variable_set :@ruby, ENV['RUBY']
+ ruby = Gem.ruby
+ Gem.ruby = ENV['RUBY']
ruby
end
+ @git = ENV['GIT'] || 'git'
+
Gem.ensure_gem_subdirectories @gemhome
@orig_LOAD_PATH = $LOAD_PATH.dup
@@ -223,10 +272,15 @@ class Gem::TestCase < MiniTest::Unit::TestCase
@orig_ENV_HOME = ENV['HOME']
ENV['HOME'] = @userhome
Gem.instance_variable_set :@user_home, nil
+ Gem.send :remove_instance_variable, :@ruby_version if
+ Gem.instance_variables.include? :@ruby_version
FileUtils.mkdir_p @gemhome
FileUtils.mkdir_p @userhome
+ @orig_gem_private_key_passphrase = ENV['GEM_PRIVATE_KEY_PASSPHRASE']
+ ENV['GEM_PRIVATE_KEY_PASSPHRASE'] = PRIVATE_KEY_PASSPHRASE
+
@default_dir = File.join @tempdir, 'default'
@default_spec_dir = File.join @default_dir, "specifications", "default"
Gem.instance_variable_set :@default_dir, @default_dir
@@ -260,10 +314,10 @@ class Gem::TestCase < MiniTest::Unit::TestCase
Gem.searcher = nil
Gem::SpecFetcher.fetcher = nil
- @orig_BASERUBY = Gem::ConfigMap[:BASERUBY]
- Gem::ConfigMap[:BASERUBY] = Gem::ConfigMap[:ruby_install_name]
+ @orig_BASERUBY = RbConfig::CONFIG['BASERUBY']
+ RbConfig::CONFIG['BASERUBY'] = RbConfig::CONFIG['ruby_install_name']
- @orig_arch = Gem::ConfigMap[:arch]
+ @orig_arch = RbConfig::CONFIG['arch']
if win_platform?
util_set_arch 'i386-mswin32'
@@ -272,18 +326,52 @@ class Gem::TestCase < MiniTest::Unit::TestCase
end
@marshal_version = "#{Marshal::MAJOR_VERSION}.#{Marshal::MINOR_VERSION}"
+ end
- # TODO: move to installer test cases
- Gem.post_build_hooks.clear
- Gem.post_install_hooks.clear
- Gem.done_installing_hooks.clear
- Gem.post_reset_hooks.clear
- Gem.post_uninstall_hooks.clear
- Gem.pre_install_hooks.clear
- Gem.pre_reset_hooks.clear
- Gem.pre_uninstall_hooks.clear
+ ##
+ # #teardown restores the process to its original state and removes the
+ # tempdir unless the +KEEP_FILES+ environment variable was set.
+
+ def teardown
+ $LOAD_PATH.replace @orig_LOAD_PATH if @orig_LOAD_PATH
+
+ if @orig_BASERUBY
+ RbConfig::CONFIG['BASERUBY'] = @orig_BASERUBY
+ else
+ RbConfig::CONFIG.delete('BASERUBY')
+ end
+ RbConfig::CONFIG['arch'] = @orig_arch
+
+ if defined? Gem::RemoteFetcher then
+ Gem::RemoteFetcher.fetcher = nil
+ end
+
+ Dir.chdir @current_dir
+
+ 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
+
+ Gem.ruby = @orig_ruby if @orig_ruby
+
+ if @orig_ENV_HOME then
+ ENV['HOME'] = @orig_ENV_HOME
+ else
+ ENV.delete 'HOME'
+ end
+
+ Gem.instance_variable_set :@default_dir, nil
+
+ ENV['GEM_PRIVATE_KEY_PASSPHRASE'] = @orig_gem_private_key_passphrase
+
+ Gem::Specification._clear_load_cache
+ end
+
+ def common_installer_setup
+ common_installer_teardown
- # TODO: move to installer test cases
Gem.post_build do |installer|
@post_build_hook_arg = installer
true
@@ -307,37 +395,73 @@ class Gem::TestCase < MiniTest::Unit::TestCase
end
end
+ def common_installer_teardown
+ Gem.post_build_hooks.clear
+ Gem.post_install_hooks.clear
+ Gem.done_installing_hooks.clear
+ Gem.post_reset_hooks.clear
+ Gem.post_uninstall_hooks.clear
+ Gem.pre_install_hooks.clear
+ Gem.pre_reset_hooks.clear
+ Gem.pre_uninstall_hooks.clear
+ end
+
##
- # #teardown restores the process to its original state and removes the
- # tempdir unless the +KEEP_FILES+ environment variable was set.
+ # A git_gem is used with a gem dependencies file. The gem created here
+ # has no files, just a gem specification for the given +name+ and +version+.
+ #
+ # Yields the +specification+ to the block, if given
- def teardown
- $LOAD_PATH.replace @orig_LOAD_PATH if @orig_LOAD_PATH
+ def git_gem name = 'a', version = 1
+ have_git?
- Gem::ConfigMap[:BASERUBY] = @orig_BASERUBY
- Gem::ConfigMap[:arch] = @orig_arch
+ directory = File.join 'git', name
+ directory = File.expand_path directory
- if defined? Gem::RemoteFetcher then
- Gem::RemoteFetcher.fetcher = nil
+ git_spec = Gem::Specification.new name, version do |specification|
+ yield specification if block_given?
end
- Dir.chdir @current_dir
+ FileUtils.mkdir_p directory
- FileUtils.rm_rf @tempdir unless ENV['KEEP_FILES']
+ gemspec = "#{name}.gemspec"
- ENV['GEM_HOME'] = @orig_gem_home
- ENV['GEM_PATH'] = @orig_gem_path
+ open File.join(directory, gemspec), 'w' do |io|
+ io.write git_spec.to_ruby
+ end
- _ = @orig_ruby
- Gem.instance_variable_set :@ruby, @orig_ruby if @orig_ruby
+ head = nil
- if @orig_ENV_HOME then
- ENV['HOME'] = @orig_ENV_HOME
- else
- ENV.delete 'HOME'
+ Dir.chdir directory do
+ unless File.exist? '.git' then
+ system @git, 'init', '--quiet'
+ system @git, 'config', 'user.name', 'RubyGems Tests'
+ system @git, 'config', 'user.email', 'rubygems@example'
+ end
+
+ system @git, 'add', gemspec
+ system @git, 'commit', '-a', '-m', 'a non-empty commit message', '--quiet'
+ head = Gem::Util.popen('git', 'rev-parse', 'master').strip
end
- Gem.instance_variable_set :@default_dir, nil
+ return name, git_spec.version, directory, head
+ end
+
+ ##
+ # Skips this test unless you have a git executable
+
+ def have_git?
+ return if in_path? @git
+
+ skip 'cannot find git executable, use GIT environment variable to set'
+ end
+
+ def in_path? executable # :nodoc:
+ return true if %r%\A([A-Z]:|/)% =~ executable and File.exist? executable
+
+ ENV['PATH'].split(File::PATH_SEPARATOR).any? do |directory|
+ File.exist? File.join directory, executable
+ end
end
##
@@ -348,7 +472,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
gem = File.join @tempdir, "gems", "#{spec.full_name}.gem"
- unless File.exists? gem
+ unless File.exist? gem then
use_ui Gem::MockGemUi.new do
Dir.chdir @tempdir do
Gem::Package.build spec
@@ -473,28 +597,11 @@ class Gem::TestCase < MiniTest::Unit::TestCase
return spec
end
- def quick_spec name, version = '2'
- # TODO: deprecate
- require 'rubygems/specification'
-
- spec = Gem::Specification.new do |s|
- s.platform = Gem::Platform::RUBY
- s.name = name
- s.version = version
- s.author = 'A User'
- s.email = 'example@example.com'
- s.homepage = 'http://example.com'
- s.summary = "this is a summary"
- s.description = "This is a test description"
-
- yield(s) if block_given?
- end
-
- spec.loaded_from = spec.spec_file
-
- Gem::Specification.add_spec spec
+ ##
+ # TODO: remove in RubyGems 3.0
- return spec
+ def quick_spec name, version = '2' # :nodoc:
+ util_spec name, version
end
##
@@ -531,7 +638,9 @@ class Gem::TestCase < MiniTest::Unit::TestCase
def util_clear_gems
FileUtils.rm_rf File.join(@gemhome, "gems") # TODO: use Gem::Dirs
+ FileUtils.mkdir File.join(@gemhome, "gems")
FileUtils.rm_rf File.join(@gemhome, "specifications")
+ FileUtils.mkdir File.join(@gemhome, "specifications")
Gem::Specification.reset
end
@@ -566,11 +675,27 @@ class Gem::TestCase < MiniTest::Unit::TestCase
end
end
+ def loaded_spec_names
+ Gem.loaded_specs.values.map(&:full_name).sort
+ end
+
+ def unresolved_names
+ Gem::Specification.unresolved_deps.values.map(&:to_s).sort
+ end
+
+ def save_loaded_features
+ old_loaded_features = $LOADED_FEATURES.dup
+ yield
+ ensure
+ $LOADED_FEATURES.replace old_loaded_features
+ end
+
##
- # Create a new spec (or gem if passed an array of files) and set it
- # up properly. Use this instead of util_spec and util_gem.
+ # new_spec is deprecated as it is never used.
+ #
+ # TODO: remove in RubyGems 3.0
- def new_spec name, version, deps = nil, *files
+ def new_spec name, version, deps = nil, *files # :nodoc:
require 'rubygems/specification'
spec = Gem::Specification.new do |s|
@@ -611,7 +736,8 @@ class Gem::TestCase < MiniTest::Unit::TestCase
end
def new_default_spec(name, version, deps = nil, *files)
- spec = new_spec(name, version, deps)
+ spec = util_spec name, version, deps
+
spec.loaded_from = File.join(@default_spec_dir, spec.spec_name)
spec.files = files
@@ -629,24 +755,38 @@ class Gem::TestCase < MiniTest::Unit::TestCase
end
##
- # Creates a spec with +name+, +version+ and +deps+.
+ # Creates a spec with +name+, +version+. +deps+ can specify the dependency
+ # or a +block+ can be given for full customization of the specification.
- def util_spec(name, version, deps = nil, &block)
- # TODO: deprecate
- raise "deps or block, not both" if deps and block
+ def util_spec name, version = 2, deps = nil # :yields: specification
+ raise "deps or block, not both" if deps and block_given?
+
+ spec = Gem::Specification.new do |s|
+ s.platform = Gem::Platform::RUBY
+ s.name = name
+ s.version = version
+ s.author = 'A User'
+ s.email = 'example@example.com'
+ s.homepage = 'http://example.com'
+ s.summary = "this is a summary"
+ s.description = "This is a test description"
+
+ yield s if block_given?
+ end
if deps then
- block = proc do |s|
- # Since Hash#each is unordered in 1.8, sort
- # the keys and iterate that way so the tests are
- # deteriminstic on all implementations.
- deps.keys.sort.each do |n|
- s.add_dependency n, (deps[n] || '>= 0')
- end
+ # Since Hash#each is unordered in 1.8, sort the keys and iterate that
+ # way so the tests are deterministic on all implementations.
+ deps.keys.sort.each do |n|
+ spec.add_dependency n, (deps[n] || '>= 0')
end
end
- quick_spec(name, version, &block)
+ spec.loaded_from = spec.spec_file
+
+ Gem::Specification.add_spec spec
+
+ return spec
end
##
@@ -742,7 +882,7 @@ Also, a list:
@a_evil9 = quick_gem('a_evil', '9', &init)
@b2 = quick_gem('b', '2', &init)
@c1_2 = quick_gem('c', '1.2', &init)
- @x = quick_gem('x', '1', &init)
+ @x = quick_gem('x', '1', &init)
@dep_x = quick_gem('dep_x', '1') do |s|
s.files = %w[lib/code.rb]
s.require_paths = %w[lib]
@@ -762,14 +902,15 @@ Also, a list:
util_build_gem @a2_pre
end
- write_file File.join(*%W[gems #{@a1.original_name} lib code.rb])
- write_file File.join(*%W[gems #{@a2.original_name} lib code.rb])
- write_file File.join(*%W[gems #{@a3a.original_name} lib code.rb])
- write_file File.join(*%W[gems #{@b2.original_name} lib code.rb])
- write_file File.join(*%W[gems #{@c1_2.original_name} lib code.rb])
- write_file File.join(*%W[gems #{@pl1.original_name} lib code.rb])
- write_file File.join(*%W[gems #{@x.original_name} lib code.rb])
- write_file File.join(*%W[gems #{@dep_x.original_name} lib code.rb])
+ write_file File.join(*%W[gems #{@a1.original_name} lib code.rb])
+ write_file File.join(*%W[gems #{@a2.original_name} lib code.rb])
+ write_file File.join(*%W[gems #{@a3a.original_name} lib code.rb])
+ write_file File.join(*%W[gems #{@a_evil9.original_name} lib code.rb])
+ write_file File.join(*%W[gems #{@b2.original_name} lib code.rb])
+ write_file File.join(*%W[gems #{@c1_2.original_name} lib code.rb])
+ write_file File.join(*%W[gems #{@pl1.original_name} lib code.rb])
+ write_file File.join(*%W[gems #{@x.original_name} lib code.rb])
+ write_file File.join(*%W[gems #{@dep_x.original_name} lib code.rb])
[@a1, @a2, @a3a, @a_evil9, @b2, @c1_2, @pl1, @x, @dep_x].each do |spec|
util_build_gem spec
@@ -782,7 +923,7 @@ Also, a list:
# Set the platform to +arch+
def util_set_arch(arch)
- Gem::ConfigMap[:arch] = arch
+ RbConfig::CONFIG['arch'] = arch
platform = Gem::Platform.new arch
Gem.instance_variable_set :@platforms, nil
@@ -854,14 +995,35 @@ Also, a list:
spec_fetcher.prerelease_specs[@uri] << spec.name_tuple
end
- v = Gem.marshal_version
+ # HACK for test_download_to_cache
+ unless Gem::RemoteFetcher === @fetcher then
+ v = Gem.marshal_version
+
+ specs = all.map { |spec| spec.name_tuple }
+ s_zip = util_gzip Marshal.dump Gem::NameTuple.to_basic specs
+
+ latest_specs = Gem::Specification.latest_specs.map do |spec|
+ spec.name_tuple
+ end
+
+ l_zip = util_gzip Marshal.dump Gem::NameTuple.to_basic latest_specs
+
+ prerelease_specs = prerelease.map { |spec| spec.name_tuple }
+ p_zip = util_gzip Marshal.dump Gem::NameTuple.to_basic prerelease_specs
+
+ @fetcher.data["#{@gem_repo}specs.#{v}.gz"] = s_zip
+ @fetcher.data["#{@gem_repo}latest_specs.#{v}.gz"] = l_zip
+ @fetcher.data["#{@gem_repo}prerelease_specs.#{v}.gz"] = p_zip
+
+ v = Gem.marshal_version
- 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
- @fetcher.data[path] = data_deflate
- end unless Gem::RemoteFetcher === @fetcher # HACK for test_download_to_cache
+ 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
+ @fetcher.data[path] = data_deflate
+ end
+ end
nil # force errors
end
@@ -972,7 +1134,7 @@ Also, a list:
end
##
- # Finds the path to the ruby executable
+ # Finds the path to the Ruby executable
def self.rubybin
ruby = ENV["RUBY"]
@@ -1012,6 +1174,26 @@ Also, a list:
end
##
+ # Constructs a Gem::Resolver::DependencyRequest from a
+ # Gem::Dependency +dep+, a +from_name+ and +from_version+ requesting the
+ # dependency and a +parent+ DependencyRequest
+
+ def dependency_request dep, from_name, from_version, parent = nil
+ remote = Gem::Source.new @uri
+
+ unless parent then
+ parent_dep = dep from_name, from_version
+ parent = Gem::Resolver::DependencyRequest.new parent_dep, nil
+ end
+
+ spec = Gem::Resolver::IndexSpecification.new \
+ nil, from_name, from_version, remote, Gem::Platform::RUBY
+ activation = Gem::Resolver::ActivationRequest.new spec, parent
+
+ Gem::Resolver::DependencyRequest.new dep, activation
+ end
+
+ ##
# Constructs a new Gem::Requirement.
def req *requirements
@@ -1027,28 +1209,119 @@ Also, a list:
end
##
+ # Creates a SpecFetcher pre-filled with the gems or specs defined in the
+ # block.
+ #
+ # Yields a +fetcher+ object that responds to +spec+ and +gem+. +spec+ adds
+ # a specification to the SpecFetcher while +gem+ adds both a specification
+ # and the gem data to the RemoteFetcher so the built gem can be downloaded.
+ #
+ # If only the a-3 gem is supposed to be downloaded you can save setup
+ # time by creating only specs for the other versions:
+ #
+ # spec_fetcher do |fetcher|
+ # fetcher.spec 'a', 1
+ # fetcher.spec 'a', 2, 'b' => 3 # dependency on b = 3
+ # fetcher.gem 'a', 3 do |spec|
+ # # spec is a Gem::Specification
+ # # ...
+ # end
+ # end
+
+ def spec_fetcher repository = @gem_repo
+ Gem::TestCase::SpecFetcherSetup.declare self, repository do |spec_fetcher_setup|
+ yield spec_fetcher_setup if block_given?
+ end
+ end
+
+ ##
# Construct a new Gem::Version.
def v string
Gem::Version.create string
end
- class StaticSet
+ ##
+ # A vendor_gem is used with a gem dependencies file. The gem created here
+ # has no files, just a gem specification for the given +name+ and +version+.
+ #
+ # Yields the +specification+ to the block, if given
+
+ def vendor_gem name = 'a', version = 1
+ directory = File.join 'vendor', name
+
+ 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
+
+ return name, vendor_spec.version, directory
+ end
+
+ ##
+ # 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
+
+ ##
+ # Creates a new StaticSet for the given +specs+
+
def initialize(specs)
- @specs = specs.sort_by { |s| s.full_name }
+ super()
+
+ @specs = specs
+
+ @remote = true
+ end
+
+ ##
+ # Adds +spec+ to this set.
+
+ def add spec
+ @specs << spec
end
+ ##
+ # Finds +dep+ in this set.
+
def find_spec(dep)
@specs.reverse_each do |s|
return s if dep.matches_spec? s
end
end
+ ##
+ # Finds all gems matching +dep+ in this set.
+
def find_all(dep)
- @specs.find_all { |s| dep.matches_spec? s }
+ @specs.find_all { |s| dep.match? s, @prerelease }
+ end
+
+ ##
+ # Loads a Gem::Specification from this set which has the given +name+,
+ # version +ver+, +platform+. The +source+ is ignored.
+
+ def load_spec name, ver, platform, source
+ dep = Gem::Dependency.new name, ver
+ spec = find_spec dep
+
+ Gem::Specification.new spec.name, spec.version do |s|
+ s.platform = spec.platform
+ end
end
- def prefetch(reqs)
+ def prefetch reqs # :nodoc:
end
end
@@ -1080,18 +1353,18 @@ Also, a list:
end
##
- # Loads an RSA private key named +key_name+ in <tt>test/rubygems/</tt>
+ # Loads an RSA private key named +key_name+ with +passphrase+ in <tt>test/rubygems/</tt>
- def self.load_key key_name
+ def self.load_key key_name, passphrase = nil
key_file = key_path key_name
key = File.read key_file
- OpenSSL::PKey::RSA.new key
+ OpenSSL::PKey::RSA.new key, passphrase
end
##
- # Returns the path tot he key named +key_name+ from <tt>test/rubygems</tt>
+ # Returns the path to the key named +key_name+ from <tt>test/rubygems</tt>
def self.key_path key_name
File.expand_path "../../../test/rubygems/#{key_name}_key.pem", __FILE__
@@ -1100,17 +1373,27 @@ Also, a list:
# :stopdoc:
# only available in RubyGems tests
+ PRIVATE_KEY_PASSPHRASE = 'Foo bar'
+
begin
- PRIVATE_KEY = load_key 'private'
- PRIVATE_KEY_PATH = key_path 'private'
- PUBLIC_KEY = PRIVATE_KEY.public_key
+ PRIVATE_KEY = load_key 'private'
+ PRIVATE_KEY_PATH = key_path 'private'
+
+ # ENCRYPTED_PRIVATE_KEY is PRIVATE_KEY encrypted with PRIVATE_KEY_PASSPHRASE
+ ENCRYPTED_PRIVATE_KEY = load_key 'encrypted_private', PRIVATE_KEY_PASSPHRASE
+ ENCRYPTED_PRIVATE_KEY_PATH = key_path 'encrypted_private'
- PUBLIC_CERT = load_cert 'public'
- PUBLIC_CERT_PATH = cert_path 'public'
+ PUBLIC_KEY = PRIVATE_KEY.public_key
+
+ PUBLIC_CERT = load_cert 'public'
+ PUBLIC_CERT_PATH = cert_path 'public'
rescue Errno::ENOENT
PRIVATE_KEY = nil
PUBLIC_KEY = nil
PUBLIC_CERT = nil
- end
+ end if defined?(OpenSSL::SSL)
end
+
+require 'rubygems/test_utilities'
+
diff --git a/lib/rubygems/test_utilities.rb b/lib/rubygems/test_utilities.rb
index eed42f59a7..25786e6a21 100644
--- a/lib/rubygems/test_utilities.rb
+++ b/lib/rubygems/test_utilities.rb
@@ -38,6 +38,8 @@ 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}"
@@ -101,6 +103,24 @@ 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
@@ -160,6 +180,179 @@ end
# :startdoc:
##
+# The SpecFetcherSetup allows easy setup of a remote source in RubyGems tests:
+#
+# spec_fetcher do |f|
+# 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
+# b to a. The declaration creates an additional spec a-2, but no gem for it
+# (so it cannot be installed).
+#
+# After the gems are created they are removed from Gem.dir.
+
+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
+
+ yield setup
+
+ setup.execute
+ end
+
+ def initialize test, repository # :nodoc:
+ @test = test
+ @repository = repository
+
+ @gems = {}
+ @installed = []
+ @operations = []
+ end
+
+ ##
+ # Removes any created gems or specifications from Gem.dir (the default
+ # install location).
+
+ def clear
+ @operations << [:clear]
+ end
+
+ ##
+ # Returns a Hash of created Specification full names and the corresponding
+ # Specification.
+
+ def created_specs
+ created = {}
+
+ @gems.keys.each do |spec|
+ created[spec.full_name] = spec
+ end
+
+ created
+ end
+
+ ##
+ # Creates any defined gems or specifications
+
+ def execute # :nodoc:
+ execute_operations
+
+ setup_fetcher
+
+ created_specs
+ end
+
+ 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)
+
+ write_spec spec
+
+ @gems[spec] = gem
+ @installed << spec
+ when :spec then
+ spec = @test.util_spec(*arguments, &arguments.pop)
+
+ write_spec spec
+
+ @gems[spec] = nil
+ @installed << spec
+ end
+ end
+ end
+
+ ##
+ # Creates a gem with +name+, +version+ and +deps+. The created gem can be
+ # downloaded and installed.
+ #
+ # The specification will be yielded before gem creation for customization,
+ # but only the block or the dependencies may be set, not both.
+
+ def gem name, version, dependencies = nil, &block
+ @operations << [:gem, name, version, dependencies, block]
+ end
+
+ ##
+ # Creates a legacy platform spec with the name 'pl' and version 1
+
+ def legacy_platform
+ spec 'pl', 1 do |s|
+ s.platform = Gem::Platform.new 'i386-linux'
+ s.instance_variable_set :@original_platform, 'i386-linux'
+ end
+ end
+
+ 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
+
+ Gem::Specification.reset
+
+ begin
+ gem_repo, @test.gem_repo = @test.gem_repo, @repository
+ @test.uri = URI @repository
+
+ @test.util_setup_spec_fetcher(*@gems.keys)
+ 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}"] =
+ Gem.read_binary(gem)
+
+ FileUtils.cp gem, spec.cache_file
+ end
+ end
+
+ ##
+ # Creates a spec with +name+, +version+ and +deps+. The created gem can be
+ # downloaded and installed.
+ #
+ # The specification will be yielded before creation for customization,
+ # but only the block or the dependencies may be set, not both.
+
+ def spec name, version, dependencies = nil, &block
+ @operations << [:spec, name, version, dependencies, block]
+ end
+
+ def write_spec spec # :nodoc:
+ open spec.spec_file, 'w' do |io|
+ io.write spec.to_ruby_for_cache
+ end
+ end
+
+end
+
+##
# A StringIO duck-typed class that uses Tempfile instead of String as the
# backing store.
#
@@ -168,6 +361,10 @@ end
# This class was added to flush out problems in Rubinius' IO implementation.
class TempIO < Tempfile
+
+ ##
+ # Creates a new TempIO that will be initialized to contain +string+.
+
def initialize(string = '')
super "TempIO"
binmode
@@ -175,6 +372,9 @@ class TempIO < Tempfile
rewind
end
+ ##
+ # The content of the TempIO as a String.
+
def string
flush
Gem.read_binary path
diff --git a/lib/rubygems/text.rb b/lib/rubygems/text.rb
index 793cd953cb..8b26bebec8 100644
--- a/lib/rubygems/text.rb
+++ b/lib/rubygems/text.rb
@@ -26,6 +26,16 @@ module Gem::Text
result.join("\n").gsub(/^/, " " * indent)
end
+ def min3 a, b, c # :nodoc:
+ if a < b && a < c
+ a
+ elsif b < a && b < c
+ 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
@@ -42,16 +52,16 @@ module Gem::Text
d = (0..m).to_a
x = nil
- n.times do |i|
+ str1.each_char.each_with_index do |char1,i|
e = i+1
- m.times do |j|
- cost = (s[i] == t[j]) ? 0 : 1
- x = [
+ str2.each_char.each_with_index do |char2,j|
+ cost = (char1 == char2) ? 0 : 1
+ x = min3(
d[j+1] + 1, # insertion
e + 1, # deletion
d[j] + cost # substitution
- ].min
+ )
d[j] = e
e = x
end
diff --git a/lib/rubygems/uninstaller.rb b/lib/rubygems/uninstaller.rb
index d672b9dec1..2a6edc6131 100644
--- a/lib/rubygems/uninstaller.rb
+++ b/lib/rubygems/uninstaller.rb
@@ -43,14 +43,15 @@ class Gem::Uninstaller
def initialize(gem, options = {})
# TODO document the valid options
- @gem = gem
- @version = options[:version] || Gem::Requirement.default
- @gem_home = File.expand_path(options[:install_dir] || Gem.dir)
- @force_executables = options[:executables]
- @force_all = options[:all]
- @force_ignore = options[:ignore]
- @bin_dir = options[:bin_dir]
- @format_executable = options[:format_executable]
+ @gem = gem
+ @version = options[:version] || Gem::Requirement.default
+ @gem_home = File.expand_path(options[:install_dir] || Gem.dir)
+ @force_executables = options[:executables]
+ @force_all = options[:all]
+ @force_ignore = options[:ignore]
+ @bin_dir = options[:bin_dir]
+ @format_executable = options[:format_executable]
+ @abort_on_dependent = options[:abort_on_dependent]
# Indicate if development dependencies should be checked when
# uninstalling. (default: false)
@@ -95,6 +96,8 @@ 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?
@@ -119,7 +122,8 @@ class Gem::Uninstaller
remove_all list
elsif list.size > 1 then
- gem_names = list.collect {|gem| gem.full_name} + ["All versions"]
+ gem_names = list.map { |gem| gem.full_name }
+ gem_names << "All versions"
say
_, index = choose_from_list "Select gem to uninstall:", gem_names
@@ -143,7 +147,7 @@ class Gem::Uninstaller
@spec = spec
unless dependencies_ok? spec
- unless ask_if_ok(spec)
+ if abort_on_dependent? || !ask_if_ok(spec)
raise Gem::DependencyRemovalException,
"Uninstallation aborted due to dependent gem(s)"
end
@@ -236,7 +240,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 is not installed in directory #{@gem_home}"
+ "Gem '#{spec.full_name}' is not installed in directory #{@gem_home}"
e.spec = spec
raise e
@@ -246,13 +250,10 @@ class Gem::Uninstaller
File.writable?(spec.base_dir)
FileUtils.rm_rf spec.full_gem_path
+ FileUtils.rm_rf spec.extension_dir
- # TODO: should this be moved to spec?... I vote eww (also exists in docmgr)
- old_platform_name = [spec.name,
- spec.version,
- spec.original_platform].join '-'
-
- gemspec = spec.spec_file
+ old_platform_name = spec.original_name
+ gemspec = spec.spec_file
unless File.exist? gemspec then
gemspec = File.join(File.dirname(gemspec), "#{old_platform_name}.gemspec")
@@ -283,14 +284,30 @@ class Gem::Uninstaller
full_path == spec.full_gem_path || original_path == spec.full_gem_path
end
- def dependencies_ok?(spec)
+ ##
+ # Returns true if it is OK to remove +spec+ or this is a forced
+ # uninstallation.
+
+ def dependencies_ok? spec # :nodoc:
return true if @force_ignore
deplist = Gem::DependencyList.from_specs
deplist.ok_to_remove?(spec.full_name, @check_dev)
end
- def ask_if_ok(spec)
+ ##
+ # Should the uninstallation abort if a dependency will go unsatisfied?
+ #
+ # See ::new.
+
+ def abort_on_dependent? # :nodoc:
+ @abort_on_dependent
+ end
+
+ ##
+ # Asks if it is OK to remove +spec+. Returns true if it is OK.
+
+ def ask_if_ok spec # :nodoc:
msg = ['']
msg << 'You have requested to uninstall the gem:'
msg << "\t#{spec.full_name}"
@@ -311,7 +328,10 @@ class Gem::Uninstaller
return ask_yes_no(msg.join("\n"), false)
end
- def formatted_program_filename(filename)
+ ##
+ # Returns the formatted version of the executable +filename+
+
+ def formatted_program_filename filename # :nodoc:
# TODO perhaps the installer should leave a small manifest
# of what it did for us to find rather than trying to recreate
# it again.
diff --git a/lib/rubygems/uri_formatter.rb b/lib/rubygems/uri_formatter.rb
new file mode 100644
index 0000000000..68aacc6369
--- /dev/null
+++ b/lib/rubygems/uri_formatter.rb
@@ -0,0 +1,49 @@
+require 'cgi'
+require 'uri'
+
+##
+# The UriFormatter handles URIs from user-input and escaping.
+#
+# uf = Gem::UriFormatter.new 'example.com'
+#
+# p uf.normalize #=> 'http://example.com'
+
+class Gem::UriFormatter
+
+ ##
+ # The URI to be formatted.
+
+ attr_reader :uri
+
+ ##
+ # Creates a new URI formatter for +uri+.
+
+ def initialize uri
+ @uri = uri
+ end
+
+ ##
+ # Escapes the #uri for use as a CGI parameter
+
+ def escape
+ return unless @uri
+ CGI.escape @uri
+ end
+
+ ##
+ # Normalize the URI by adding "http://" if it is missing.
+
+ def normalize
+ (@uri =~ /^(https?|ftp|file):/i) ? @uri : "http://#{@uri}"
+ end
+
+ ##
+ # Unescapes the #uri which came from a CGI parameter
+
+ def unescape
+ return unless @uri
+ CGI.unescape @uri
+ end
+
+end
+
diff --git a/lib/rubygems/user_interaction.rb b/lib/rubygems/user_interaction.rb
index 0974476507..917b4ea5aa 100644
--- a/lib/rubygems/user_interaction.rb
+++ b/lib/rubygems/user_interaction.rb
@@ -4,6 +4,11 @@
# 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.
@@ -66,9 +71,13 @@ module Gem::DefaultUserInteraction
end
##
-# Make the default UI accessible without the "ui." prefix. Classes
-# including this module may use the interaction methods on the default UI
-# directly. Classes may also reference the ui and ui= methods.
+# UserInteraction allows RubyGems to interact with the user through standard
+# methods that can be replaced with more-specific UI methods for different
+# displays.
+#
+# Since UserInteraction dispatches to a concrete UI class you may need to
+# reference other classes for specific behavior such as Gem::ConsoleUI or
+# Gem::SilentUI.
#
# Example:
#
@@ -84,40 +93,77 @@ module Gem::UserInteraction
include Gem::DefaultUserInteraction
- def alert(*args)
- ui.alert(*args)
+ ##
+ # Displays an alert +statement+. Asks a +question+ if given.
+
+ def alert statement, question = nil
+ ui.alert statement, question
end
- def alert_error(*args)
- ui.alert_error(*args)
+ ##
+ # Displays an error +statement+ to the error output location. Asks a
+ # +question+ if given.
+
+ def alert_error statement, question = nil
+ ui.alert_error statement, question
end
- def alert_warning(*args)
- ui.alert_warning(*args)
+ ##
+ # Displays a warning +statement+ to the warning output location. Asks a
+ # +question+ if given.
+
+ def alert_warning statement, question = nil
+ ui.alert_warning statement, question
end
- def ask(*args)
- ui.ask(*args)
+ ##
+ # Asks a +question+ and returns the answer.
+
+ def ask question
+ ui.ask question
end
- def ask_for_password(*args)
- ui.ask_for_password(*args)
+ ##
+ # Asks for a password with a +prompt+
+
+ def ask_for_password prompt
+ ui.ask_for_password prompt
end
- def ask_yes_no(*args)
- ui.ask_yes_no(*args)
+ ##
+ # Asks a yes or no +question+. Returns true for yes, false for no.
+
+ def ask_yes_no question, default = nil
+ ui.ask_yes_no question, default
end
- def choose_from_list(*args)
- ui.choose_from_list(*args)
+ ##
+ # Asks the user to answer +question+ with an answer from the given +list+.
+
+ def choose_from_list question, list
+ ui.choose_from_list question, list
end
- def say(*args)
- ui.say(*args)
+ ##
+ # Displays the given +statement+ on the standard output (or equivalent).
+
+ def say statement = ''
+ ui.say statement
+ end
+
+ ##
+ # Terminates the RubyGems process with the given +exit_code+
+
+ def terminate_interaction exit_code = 0
+ ui.terminate_interaction exit_code
end
- def terminate_interaction(*args)
- ui.terminate_interaction(*args)
+ ##
+ # 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
@@ -126,7 +172,26 @@ end
class Gem::StreamUI
- attr_reader :ins, :outs, :errs
+ ##
+ # The input stream
+
+ attr_reader :ins
+
+ ##
+ # The output stream
+
+ attr_reader :outs
+
+ ##
+ # The error stream
+
+ attr_reader :errs
+
+ ##
+ # Creates a new StreamUI wrapping +in_stream+ for user input, +out_stream+
+ # for standard output, +err_stream+ for error output. If +usetty+ is true
+ # then special operations (like asking for passwords) will use the TTY
+ # commands to disable character echo.
def initialize(in_stream, out_stream, err_stream=STDERR, usetty=true)
@ins = in_stream
@@ -135,6 +200,9 @@ class Gem::StreamUI
@usetty = usetty
end
+ ##
+ # Returns true if TTY methods should be used on this StreamUI.
+
def tty?
if RUBY_VERSION < '1.9.3' and RUBY_PLATFORM =~ /mingw|mswin/ then
@usetty
@@ -228,41 +296,27 @@ class Gem::StreamUI
result
end
- 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?
-
- require 'io/console'
-
- @outs.print(question + " ")
- @outs.flush
+ ##
+ # Ask for a password. Does not echo response to terminal.
- password = @ins.noecho {@ins.gets}
- password.chomp! if password
- password
- end
- else
- ##
- # 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
- @outs.print(question + " ")
- @outs.flush
+ password = _gets_noecho
+ @outs.puts
+ password.chomp! if password
+ password
+ end
- Gem.win_platform? ? ask_for_password_on_windows : ask_for_password_on_unix
+ if IO.method_defined?(:noecho) then
+ def _gets_noecho
+ @ins.noecho {@ins.gets}
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?
-
+ elsif Gem.win_platform?
+ def _gets_noecho
require "Win32API"
char = nil
password = ''
@@ -275,22 +329,16 @@ class Gem::StreamUI
password << char.chr
end
end
-
- puts
password
end
-
- ##
- # Asks for a password that works on unix
-
- def ask_for_password_on_unix
- return nil if not tty?
-
+ else
+ def _gets_noecho
system "stty -echo"
- password = @ins.gets
- password.chomp! if password
- system "stty echo"
- password
+ begin
+ @ins.gets
+ ensure
+ system "stty echo"
+ end
end
end
@@ -310,8 +358,7 @@ class Gem::StreamUI
end
##
- # Display a warning in a location expected to get error messages. Will
- # ask +question+ if it is not nil.
+ # Display a warning on stderr. Will ask +question+ if it is not nil.
def alert_warning(statement, question=nil)
@errs.puts "WARNING: #{statement}"
@@ -339,9 +386,13 @@ 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.
@@ -364,14 +415,29 @@ class Gem::StreamUI
# An absolutely silent progress reporter.
class SilentProgressReporter
+
+ ##
+ # The count of items is never updated for the silent progress reporter.
+
attr_reader :count
+ ##
+ # Creates a silent progress reporter that ignores all input arguments.
+
def initialize(out_stream, size, initial_message, terminal_message = nil)
end
+ ##
+ # Does not print +message+ when updated as this object has taken a vow of
+ # silence.
+
def updated(message)
end
+ ##
+ # Does not print anything when complete as this object has taken a vow of
+ # silence.
+
def done
end
end
@@ -383,8 +449,16 @@ class Gem::StreamUI
include Gem::DefaultUserInteraction
+ ##
+ # The number of progress items counted so far.
+
attr_reader :count
+ ##
+ # Creates a new progress reporter that will write to +out_stream+ for
+ # +size+ items. Shows the given +initial_message+ when progress starts
+ # and the +terminal_message+ when it is complete.
+
def initialize(out_stream, size, initial_message,
terminal_message = "complete")
@out = out_stream
@@ -420,8 +494,16 @@ class Gem::StreamUI
include Gem::DefaultUserInteraction
+ ##
+ # The number of progress items counted so far.
+
attr_reader :count
+ ##
+ # Creates a new progress reporter that will write to +out_stream+ for
+ # +size+ items. Shows the given +initial_message+ when progress starts
+ # and the +terminal_message+ when it is complete.
+
def initialize(out_stream, size, initial_message,
terminal_message = 'complete')
@out = out_stream
@@ -468,15 +550,30 @@ class Gem::StreamUI
# An absolutely silent download reporter.
class SilentDownloadReporter
+
+ ##
+ # The silent download reporter ignores all arguments
+
def initialize(out_stream, *args)
end
+ ##
+ # The silent download reporter does not display +filename+ or care about
+ # +filesize+ because it is silent.
+
def fetch(filename, filesize)
end
+ ##
+ # Nothing can update the silent download reporter.
+
def update(current)
end
+ ##
+ # The silent download reporter won't tell you when the download is done.
+ # Because it is silent.
+
def done
end
end
@@ -485,13 +582,35 @@ class Gem::StreamUI
# A progress reporter that prints out messages about the current progress.
class VerboseDownloadReporter
- attr_reader :file_name, :total_bytes, :progress
+
+ ##
+ # The current file name being displayed
+
+ attr_reader :file_name
+
+ ##
+ # The total bytes in the file
+
+ attr_reader :total_bytes
+
+ ##
+ # The current progress (0 to 100)
+
+ attr_reader :progress
+
+ ##
+ # Creates a new verbose download reporter that will display on
+ # +out_stream+. The other arguments are ignored.
def initialize(out_stream, *args)
@out = out_stream
@progress = 0
end
+ ##
+ # Tells the download reporter that the +file_name+ is being fetched and
+ # contains +total_bytes+.
+
def fetch(file_name, total_bytes)
@file_name = file_name
@total_bytes = total_bytes.to_i
@@ -500,6 +619,9 @@ class Gem::StreamUI
update_display(false)
end
+ ##
+ # Updates the verbose download reporter for the given number of +bytes+.
+
def update(bytes)
new_progress = if @units == 'B' then
bytes
@@ -513,6 +635,9 @@ class Gem::StreamUI
update_display
end
+ ##
+ # Indicates the download is complete.
+
def done
@progress = 100 if @units == '%'
update_display(true, true)
@@ -520,7 +645,7 @@ class Gem::StreamUI
private
- def update_display(show_progress = true, new_line = false)
+ def update_display(show_progress = true, new_line = false) # :nodoc:
return unless @out.tty?
if show_progress then
@@ -538,6 +663,11 @@ 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
@@ -547,6 +677,10 @@ 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
@@ -561,11 +695,17 @@ class Gem::SilentUI < Gem::StreamUI
super reader, writer, writer, false
end
- def download_reporter(*args)
+ def close
+ super
+ @ins.close
+ @outs.close
+ end
+
+ def download_reporter(*args) # :nodoc:
SilentDownloadReporter.new(@outs, *args)
end
- def progress_reporter(*args)
+ def progress_reporter(*args) # :nodoc:
SilentProgressReporter.new(@outs, *args)
end
end
diff --git a/lib/rubygems/util.rb b/lib/rubygems/util.rb
new file mode 100644
index 0000000000..cd0af4d8fe
--- /dev/null
+++ b/lib/rubygems/util.rb
@@ -0,0 +1,134 @@
+##
+# 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 'rubygems/util/stringio'
+ data = Gem::StringSource.new data
+
+ unzipped = Zlib::GzipReader.new(data).read
+ unzipped.force_encoding Encoding::BINARY if Object.const_defined? :Encoding
+ unzipped
+ end
+
+ ##
+ # Zlib::GzipWriter wrapper that zips +data+.
+
+ def self.gzip(data)
+ require 'zlib'
+ 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
+
+ zipped.string
+ end
+
+ ##
+ # A Zlib::Inflate#inflate wrapper
+
+ def self.inflate(data)
+ require 'zlib'
+ Zlib::Inflate.inflate data
+ end
+
+ ##
+ # This calls IO.popen where it accepts an array for a +command+ (Ruby 1.9+)
+ # and implements an IO.popen-like behavior where it does not accept an array
+ # for a command.
+
+ def self.popen *command
+ IO.popen command, &:read
+ rescue TypeError # ruby 1.8 only supports string command
+ r, w = IO.pipe
+
+ pid = fork do
+ STDIN.close
+ STDOUT.reopen w
+
+ exec(*command)
+ end
+
+ w.close
+
+ begin
+ return r.read
+ ensure
+ Process.wait pid
+ 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/list.rb b/lib/rubygems/util/list.rb
new file mode 100644
index 0000000000..9bc11fe334
--- /dev/null
+++ b/lib/rubygems/util/list.rb
@@ -0,0 +1,48 @@
+module Gem
+ List = Struct.new(:value, :tail)
+
+ class List
+ def each
+ n = self
+ while n
+ yield n.value
+ n = n.tail
+ end
+ end
+
+ def to_a
+ 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)
+ List.new value, self
+ end
+
+ def pretty_print q # :nodoc:
+ q.pp to_a
+ end
+
+ def self.prepend(list, value)
+ return List.new(value) unless list
+ List.new value, list
+ end
+ end
+end
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 e5183d401f..6992af16ba 100644
--- a/lib/rubygems/validator.rb
+++ b/lib/rubygems/validator.rb
@@ -14,7 +14,7 @@ class Gem::Validator
include Gem::UserInteraction
- def initialize
+ def initialize # :nodoc:
require 'find'
end
@@ -57,8 +57,11 @@ class Gem::Validator
public
+ ##
+ # Describes a problem with a file in a gem.
+
ErrorData = Struct.new :path, :problem do
- def <=> other
+ def <=> other # :nodoc:
return nil unless self.class === other
[path, problem] <=> [other.path, other.problem]
@@ -83,6 +86,7 @@ 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 2b7bf9b422..8335ebe182 100644
--- a/lib/rubygems/version.rb
+++ b/lib/rubygems/version.rb
@@ -22,6 +22,11 @@
# 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
@@ -81,8 +86,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 for himself, but as soon as he/she makes a
-# public release, the version must be updated.
+# generate builds all day long, but as soon as they make a public release,
+# the version must be updated.
#
# === Examples
#
@@ -99,26 +104,25 @@
# 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. He writes to the
-# original interface (no <tt>top</tt>), so his version constraint looks
-# like:
+# 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:
#
# gem 'stack', '~> 0.0'
#
# Essentially, any version is OK with Client A. An incompatible change to
-# the library will cause him grief, but he is willing to take the chance (we
-# call Client A optimistic).
+# the library will cause them grief, but they are willing to take the chance
+# (we call Client A optimistic).
#
-# 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:
+# 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:
#
# 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 he is worried about incompatible future changes (it is OK to be
+# because they are worried about incompatible future changes (it is OK to be
# pessimistic!).
#
# == Preventing Version Catastrophe:
@@ -139,21 +143,26 @@
# "~> 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'
include Comparable
- # FIX: These are only used once, in .correct?. Do they deserve to be
- # constants?
- VERSION_PATTERN = '[0-9]+(?>\.[0-9a-zA-Z]+)*' # :nodoc:
+ VERSION_PATTERN = '[0-9]+(?>\.[0-9a-zA-Z]+)*(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?' # :nodoc:
ANCHORED_VERSION_PATTERN = /\A\s*(#{VERSION_PATTERN})?\s*\z/ # :nodoc:
##
# A string representation of this Version.
- attr_reader :version
+ def version
+ @version.dup
+ end
+
alias to_s version
##
@@ -171,8 +180,6 @@ class Gem::Version
# ver2 = Version.create(ver1) # -> (ver1)
# ver3 = Version.create(nil) # -> nil
- # REFACTOR: There's no real reason this should be separate from #initialize.
-
def self.create input
if self === input then # check yourself before you wreck yourself
input
@@ -183,6 +190,14 @@ class Gem::Version
end
end
+ @@all = {}
+
+ def self.new version # :nodoc:
+ return super unless Gem::Version == self
+
+ @@all[version] ||= super
+ end
+
##
# Constructs a Version from the +version+ string. A version string is a
# series of digits or ASCII letters separated by dots.
@@ -191,7 +206,8 @@ class Gem::Version
raise ArgumentError, "Malformed version number string #{version}" unless
self.class.correct?(version)
- @version = version.to_s.dup.strip
+ @version = version.to_s.strip.gsub("-",".pre.")
+ @segments = nil
end
##
@@ -245,17 +261,17 @@ class Gem::Version
initialize array[0]
end
- def yaml_initialize(tag, map)
+ def yaml_initialize(tag, map) # :nodoc:
@version = map['version']
@segments = nil
@hash = nil
end
- def to_yaml_properties
+ def to_yaml_properties # :nodoc:
["@version"]
end
- def encode_with coder
+ def encode_with coder # :nodoc:
coder.add 'version', @version
end
diff --git a/lib/rubygems/version_option.rb b/lib/rubygems/version_option.rb
index a3de4dc9e7..a0755d5020 100644
--- a/lib/rubygems/version_option.rb
+++ b/lib/rubygems/version_option.rb
@@ -42,6 +42,7 @@ module Gem::VersionOption
add_option("--[no-]prerelease",
"Allow prerelease versions of a gem", *wrap) do |value, options|
options[:prerelease] = value
+ options[:explicit_prerelease] = true
end
end
@@ -50,14 +51,19 @@ module Gem::VersionOption
def add_version_option(task = command, *wrap)
OptionParser.accept Gem::Requirement do |value|
- Gem::Requirement.new value
+ Gem::Requirement.new(*value.split(/\s*,\s*/))
end
add_option('-v', '--version VERSION', Gem::Requirement,
"Specify version of gem to #{task}", *wrap) do
|value, options|
options[:version] = value
- options[:prerelease] = true if value.prerelease?
+
+ explicit_prerelease_set = !options[:explicit_prerelease].nil?
+ options[:explicit_prerelease] = false unless explicit_prerelease_set
+
+ options[:prerelease] = value.prerelease? unless
+ options[:explicit_prerelease]
end
end
diff --git a/lib/scanf.rb b/lib/scanf.rb
index cd1596be8f..b6c5287664 100644
--- a/lib/scanf.rb
+++ b/lib/scanf.rb
@@ -10,7 +10,7 @@
# == Description
#
# scanf is an implementation of the C function scanf(3), modified as necessary
-# for ruby compatibility.
+# for Ruby compatibility.
#
# the methods provided are String#scanf, IO#scanf, and
# Kernel#scanf. Kernel#scanf is a wrapper around STDIN.scanf. IO#scanf
@@ -603,7 +603,7 @@ 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]
@@ -657,7 +657,12 @@ class IO
break if fstr.last_spec
fstr.prune
end
- seek(start_position + matched_so_far, IO::SEEK_SET) rescue Errno::ESPIPE
+
+ begin
+ seek(start_position + matched_so_far, IO::SEEK_SET)
+ rescue Errno::ESPIPE
+ end
+
soak_up_spaces if fstr.last_spec && fstr.space
return final_result
diff --git a/lib/securerandom.rb b/lib/securerandom.rb
index 15fe86f444..29368ee431 100644
--- a/lib/securerandom.rb
+++ b/lib/securerandom.rb
@@ -1,49 +1,49 @@
-# = Secure random number generator interface.
+begin
+ require 'openssl'
+rescue LoadError
+end
+
+# == Secure random number generator interface.
#
# 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 following secure random number generators.
#
# * openssl
# * /dev/urandom
# * Win32
#
-# == Example
+# === Examples
#
-# # random hexadecimal string.
-# p SecureRandom.hex(10) #=> "52750b30ffbc7de3b362"
-# p SecureRandom.hex(10) #=> "92b15d6c8dc4beb5f559"
-# p SecureRandom.hex(11) #=> "6aca1b5c58e4863e6b81b8"
-# p SecureRandom.hex(12) #=> "94b2fff3e7fd9b9c391a2306"
-# p SecureRandom.hex(13) #=> "39b290146bea6ce975c37cfc23"
-# ...
+# Hexadecimal string.
#
-# # random base64 string.
-# p SecureRandom.base64(10) #=> "EcmTPZwWRAozdA=="
-# p SecureRandom.base64(10) #=> "9b0nsevdwNuM/w=="
-# p SecureRandom.base64(10) #=> "KO1nIU+p9DKxGg=="
-# p SecureRandom.base64(11) #=> "l7XEiFja+8EKEtY="
-# p SecureRandom.base64(12) #=> "7kJSM/MzBJI+75j8"
-# p SecureRandom.base64(13) #=> "vKLJ0tXBHqQOuIcSIg=="
-# ...
+# require 'securerandom'
#
-# # random binary string.
-# p SecureRandom.random_bytes(10) #=> "\016\t{\370g\310pbr\301"
-# p SecureRandom.random_bytes(10) #=> "\323U\030TO\234\357\020\a\337"
-# ...
-
-begin
- require 'openssl'
-rescue LoadError
-end
-
+# p SecureRandom.hex(10) #=> "52750b30ffbc7de3b362"
+# p SecureRandom.hex(10) #=> "92b15d6c8dc4beb5f559"
+# p SecureRandom.hex(13) #=> "39b290146bea6ce975c37cfc23"
+#
+# Base64 string.
+#
+# p SecureRandom.base64(10) #=> "EcmTPZwWRAozdA=="
+# p SecureRandom.base64(10) #=> "KO1nIU+p9DKxGg=="
+# p SecureRandom.base64(12) #=> "7kJSM/MzBJI+75j8"
+#
+# Binary string.
+#
+# p SecureRandom.random_bytes(10) #=> "\016\t{\370g\310pbr\301"
+# p SecureRandom.random_bytes(10) #=> "\323U\030TO\234\357\020\a\337"
module SecureRandom
# SecureRandom.random_bytes generates a random binary string.
#
# The argument _n_ specifies the length of the result string.
#
- # If _n_ is not specified, 16 is assumed.
+ # 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".
@@ -57,12 +57,12 @@ module SecureRandom
n = n ? n.to_int : 16
if defined? OpenSSL::Random
- @pid = 0 if !defined?(@pid)
+ @pid = 0 unless defined?(@pid)
pid = $$
- if @pid != pid
- now = Time.now
- ary = [now.to_i, now.nsec, @pid, pid]
- OpenSSL::Random.seed(ary.to_s)
+ 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)
@pid = pid
end
return OpenSSL::Random.random_bytes(n)
@@ -79,7 +79,7 @@ module SecureRandom
end
@has_urandom = true
ret = f.read(n)
- if ret.length != n
+ unless ret.length == n
raise NotImplementedError, "Unexpected partial read from random device: only #{ret.length} for #{n} bytes"
end
return ret
@@ -89,7 +89,7 @@ module SecureRandom
end
end
- if !defined?(@has_win32)
+ unless defined?(@has_win32)
begin
require 'Win32API'
@@ -122,12 +122,12 @@ module SecureRandom
raise NotImplementedError, "No random device"
end
- # SecureRandom.hex generates a random hex string.
+ # SecureRandom.hex generates a random hexadecimal string.
#
- # The argument _n_ specifies the length of the random length.
- # The length of the result string is twice of _n_.
+ # The argument _n_ specifies the length, in bytes, of the random number to be generated.
+ # The length of the resulting hexadecimal string is twice _n_.
#
- # If _n_ is not specified, 16 is assumed.
+ # If _n_ is not specified or is nil, 16 is assumed.
# It may be larger in future.
#
# The result may contain 0-9 and a-f.
@@ -143,10 +143,10 @@ module SecureRandom
# SecureRandom.base64 generates a random base64 string.
#
- # The argument _n_ specifies the length of the random length.
- # The length of the result string is about 4/3 of _n_.
+ # The argument _n_ specifies the length, in bytes, of the random number
+ # to be generated. The length of the result string is about 4/3 of _n_.
#
- # If _n_ is not specified, 16 is assumed.
+ # If _n_ is not specified or is nil, 16 is assumed.
# It may be larger in future.
#
# The result may contain A-Z, a-z, 0-9, "+", "/" and "=".
@@ -164,10 +164,10 @@ module SecureRandom
# SecureRandom.urlsafe_base64 generates a random URL-safe base64 string.
#
- # The argument _n_ specifies the length of the random length.
- # The length of the result string is about 4/3 of _n_.
+ # The argument _n_ specifies the length, in bytes, of the random number
+ # to be generated. The length of the result string is about 4/3 of _n_.
#
- # If _n_ is not specified, 16 is assumed.
+ # If _n_ is not specified or is nil, 16 is assumed.
# It may be larger in future.
#
# The boolean argument _padding_ specifies the padding.
@@ -192,7 +192,7 @@ module SecureRandom
s = [random_bytes(n)].pack("m*")
s.delete!("\n")
s.tr!("+/", "-_")
- s.delete!("=") if !padding
+ s.delete!("=") unless padding
s
end
@@ -214,21 +214,29 @@ module SecureRandom
#
def self.random_number(n=0)
if 0 < n
- 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
+ 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 = SecureRandom.random_bytes(bin.length)
+ rnd[0] = (rnd[0].ord & mask).chr
+ end until rnd < bin
+ rnd.unpack("H*")[0].hex
+ end
else
# assumption: Float::MANT_DIG <= 64
- i64 = SecureRandom.random_bytes(8).unpack("Q")[0]
+ if defined? OpenSSL::BN
+ i64 = OpenSSL::BN.rand(64, -1).to_i
+ else
+ i64 = SecureRandom.random_bytes(8).unpack("Q")[0]
+ end
Math.ldexp(i64 >> (64-Float::MANT_DIG), -Float::MANT_DIG)
end
end
diff --git a/lib/set.rb b/lib/set.rb
index b378253606..f00cfac0c5 100644
--- a/lib/set.rb
+++ b/lib/set.rb
@@ -1,7 +1,7 @@
#--
# set.rb - defines the Set class
#++
-# Copyright (c) 2002-2008 Akinori MUSHA <knu@iDaemons.org>
+# Copyright (c) 2002-2013 Akinori MUSHA <knu@iDaemons.org>
#
# Documentation by Akinori MUSHA and Gavin Sinclair.
#
@@ -15,7 +15,7 @@
# This library provides the Set class, which deals with a collection
# of unordered values with no duplicates. It is a hybrid of Array's
# intuitive inter-operation facilities and Hash's fast lookup. If you
-# need to keep values ordered, use the SortedSet class.
+# need to keep values sorted in some order, use the SortedSet class.
#
# The method +to_set+ is added to Enumerable for convenience.
#
@@ -27,14 +27,21 @@
# This is a hybrid of Array's intuitive inter-operation facilities and
# Hash's fast lookup.
#
-# The equality of each couple of elements is determined according to
-# Object#eql? and Object#hash, since Set uses Hash as storage.
-#
# Set is easy to use with Enumerable objects (implementing +each+).
# Most of the initializer methods and binary operators accept generic
# Enumerable objects besides sets and arrays. An Enumerable object
# can be converted to Set using the +to_set+ method.
#
+# Set uses Hash as storage, so you must note the following points:
+#
+# * Equality of elements is determined according to Object#eql? and
+# Object#hash.
+# * Set assumes that the identity of each element does not change
+# while it is stored. Modifying an element of a set will render the
+# set to an unreliable state.
+# * When a string is to be stored, a frozen copy of the string is
+# stored instead unless the original string is already frozen.
+#
# == Comparison
#
# The comparison operators <, >, <= and >= are implemented as
@@ -49,7 +56,7 @@
# s2 = [1, 2].to_set # -> #<Set: {1, 2}>
# s1 == s2 # -> true
# s1.add("foo") # -> #<Set: {1, 2, "foo"}>
-# s1.merge([2, 6]) # -> #<Set: {6, 1, 2, "foo"}>
+# s1.merge([2, 6]) # -> #<Set: {1, 2, "foo", 6}>
# s1.subset? s2 # -> false
# s2.subset? s1 # -> true
#
@@ -84,36 +91,40 @@ class Set
def do_with_enum(enum, &block) # :nodoc:
if enum.respond_to?(:each_entry)
- enum.each_entry(&block)
+ enum.each_entry(&block) if block
elsif enum.respond_to?(:each)
- enum.each(&block)
+ enum.each(&block) if block
else
raise ArgumentError, "value must be enumerable"
end
end
private :do_with_enum
- # Copy internal hash.
- def initialize_copy(orig)
+ # Dup internal hash.
+ def initialize_dup(orig)
+ super
@hash = orig.instance_variable_get(:@hash).dup
end
- def freeze # :nodoc:
+ # Clone internal hash.
+ def initialize_clone(orig)
super
+ @hash = orig.instance_variable_get(:@hash).clone
+ end
+
+ def freeze # :nodoc:
@hash.freeze
- self
+ super
end
def taint # :nodoc:
- super
@hash.taint
- self
+ super
end
def untaint # :nodoc:
- super
@hash.untaint
- self
+ super
end
# Returns the number of elements.
@@ -138,12 +149,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)
clear
merge(enum)
end
-
- self
end
# Converts the set to an array. The order of elements is uncertain.
@@ -151,6 +162,16 @@ class Set
@hash.keys
end
+ # Returns self if no arguments are given. Otherwise, converts the
+ # set to another with klass.new(self, *args, &block).
+ #
+ # In subclasses, returns klass.new(self, *args, &block) unless
+ # overridden.
+ def to_set(klass = Set, *args, &block)
+ return self if instance_of?(Set) && klass == Set && block.nil? && args.empty?
+ klass.new(self, *args, &block)
+ end
+
def flatten_merge(set, seen = Set.new) # :nodoc:
set.each { |e|
if e.is_a?(Set)
@@ -224,6 +245,36 @@ class Set
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
+ any? { |o| set.include?(o) }
+ else
+ set.any? { |o| include?(o) }
+ end
+ end
+
+ # 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
+
# Calls the given block once for each element in the set, passing
# the element as parameter. Returns an enumerator if no block is
# given.
@@ -272,7 +323,9 @@ class Set
# true, and returns self.
def delete_if
block_given? or return enum_for(__method__)
- to_a.each { |o| @hash.delete(o) if yield(o) }
+ # @hash.delete_if should be faster, but using it breaks the order
+ # of enumeration in subclasses.
+ select { |o| yield o }.each { |o| @hash.delete(o) }
self
end
@@ -280,7 +333,9 @@ class Set
# false, and returns self.
def keep_if
block_given? or return enum_for(__method__)
- to_a.each { |o| @hash.delete(o) unless yield(o) }
+ # @hash.keep_if should be faster, but using it breaks the order of
+ # enumeration in subclasses.
+ reject { |o| yield o }.each { |o| @hash.delete(o) }
self
end
@@ -493,7 +548,7 @@ class Set
end
#
-# SortedSet implements a Set that guarantees that it's element are
+# SortedSet implements a Set that guarantees that its elements are
# yielded in sorted order (according to the return values of their
# #<=> methods) when iterating over them.
#
@@ -539,7 +594,7 @@ class SortedSet < Set
begin
require 'rbtree'
- module_eval %{
+ module_eval <<-END, __FILE__, __LINE__+1
def initialize(*args)
@hash = RBTree.new
super
@@ -550,9 +605,9 @@ class SortedSet < Set
super
end
alias << add
- }
+ END
rescue LoadError
- module_eval %{
+ module_eval <<-END, __FILE__, __LINE__+1
def initialize(*args)
@keys = nil
super
@@ -612,7 +667,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 8c91090414..db2d687908 100644
--- a/lib/shell.rb
+++ b/lib/shell.rb
@@ -37,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 doesnt' already exist
+# sh.mkdir dir # make dir if it doesn't already exist
# sh.cd(dir) do
# # change to the `dir` directory
# f = sh.open("tmpFile", "w") # open a new file in write mode
@@ -48,7 +48,7 @@ require "shell/process-controller"
# end
# end
#
-# === Temp file creationg with self
+# === Temp file creation with self
#
# This example is identical to the first, except we're using
# CommandProcessor#transact.
@@ -87,12 +87,10 @@ 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
@@ -108,7 +106,6 @@ class Shell
attr_accessor :cascade, :debug, :verbose
-# alias cascade? cascade
alias debug? debug
alias verbose? verbose
@verbose = true
@@ -355,7 +352,22 @@ class Shell
@process_controller.kill_job(sig, command)
end
- # Convenience method for Shell::CommandProcessor.def_system_command
+ # 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!"
+ #
def Shell.def_system_command(command, path = command)
CommandProcessor.def_system_command(command, path)
end
@@ -365,7 +377,17 @@ class Shell
CommandProcessor.undef_system_command(command)
end
- # Convenience method for Shell::CommandProcessor.alias_command
+ # 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
+ #
def Shell.alias_command(ali, command, *opts, &block)
CommandProcessor.alias_command(ali, command, *opts, &block)
end
@@ -375,7 +397,17 @@ class Shell
CommandProcessor.unalias_command(ali)
end
- # Convenience method for Shell::CommandProcessor.install_system_commands
+ # 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
+ #
def Shell.install_system_commands(pre = "sys_")
CommandProcessor.install_system_commands(pre)
end
@@ -413,7 +445,6 @@ 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 b1ca5c38f6..80a0ce5534 100644
--- a/lib/shell/builtin-command.rb
+++ b/lib/shell/builtin-command.rb
@@ -83,20 +83,6 @@ 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 f52d0ead6d..13bc50c3fe 100644
--- a/lib/shell/command-processor.rb
+++ b/lib/shell/command-processor.rb
@@ -24,7 +24,6 @@ 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,11 +120,10 @@ class Shell
end
f
else
- f = File.open(path, mode, perm, &b)
+ File.open(path, mode, perm, &b)
end
end
end
- # public :open
# call-seq:
# unlink(path)
@@ -369,7 +367,12 @@ class Shell
for p in @shell.system_path
path = join(p, command)
- if FileTest.exist?(path)
+ begin
+ st = File.stat(path)
+ rescue SystemCallError
+ next
+ else
+ next unless st.executable? and !st.directory?
@system_commands[command] = path
return path
end
@@ -645,7 +648,6 @@ 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/filter.rb b/lib/shell/filter.rb
index d53ed06315..9fae07d23e 100644
--- a/lib/shell/filter.rb
+++ b/lib/shell/filter.rb
@@ -10,7 +10,7 @@
#
class Shell #:nodoc:
- # Any result of command exection is a Filter.
+ # Any result of command execution 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 b973539b4b..d0cad0ec05 100644
--- a/lib/shell/process-controller.rb
+++ b/lib/shell/process-controller.rb
@@ -157,19 +157,16 @@ 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
@@ -254,7 +251,6 @@ 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
@@ -283,8 +279,6 @@ 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
@@ -296,11 +290,8 @@ 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 1a8bb1a90f..1fe37333d6 100644
--- a/lib/shell/system-command.rb
+++ b/lib/shell/system-command.rb
@@ -82,7 +82,6 @@ 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/shellwords.rb b/lib/shellwords.rb
index c3586d29fa..2b72750a6b 100644
--- a/lib/shellwords.rb
+++ b/lib/shellwords.rb
@@ -9,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'
#
@@ -27,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 it's alias
+# In this case, you might want to use Shellwords.escape, or its 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.
@@ -42,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'll use the literal shortcut for
+# separated by a space. In this example we used the literal shortcut for
# Array.new.
#
# === Authors
@@ -117,7 +117,7 @@ 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 bytes.
+ # Multibyte characters are treated as multibyte characters, not as bytes.
#
# Returns an empty quoted String if +str+ has a length of zero.
def shellescape(str)
@@ -128,13 +128,13 @@ module Shellwords
str = str.dup
- # Treat multibyte characters as is. It is caller's responsibility
+ # Treat multibyte characters as is. It is the 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 line continuation and simply ignored.
+ # combo is regarded as a line continuation and simply ignored.
str.gsub!(/\n/, "'\n'")
return str
@@ -149,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 Bourne shell and stringified using
- # +to_s+.
+ # space, where each element is escaped for the Bourne shell and stringified
+ # using +to_s+.
#
# ary = ["There's", "a", "time", "and", "place", "for", "everything"]
# argv = Shellwords.join(ary)
@@ -206,7 +206,7 @@ class Array
# array.shelljoin => string
#
# Builds a command line string from an argument list +array+ joining
- # all elements escaped for Bourne shell and separated by a space.
+ # all elements escaped for the Bourne shell and separated by a space.
#
# See Shellwords.shelljoin for details.
def shelljoin
diff --git a/lib/sync.rb b/lib/sync.rb
index dc513fc16b..09542d59f9 100644
--- a/lib/sync.rb
+++ b/lib/sync.rb
@@ -315,7 +315,7 @@ end
Synchronizer_m = Sync_m
##
-# A class that providesa two-phase lock with a counter. See Sync_m for
+# A class that provides two-phase lock with a counter. See Sync_m for
# details.
class Sync
diff --git a/lib/tempfile.rb b/lib/tempfile.rb
index 6dadf2f4b4..f0231bfc1b 100644
--- a/lib/tempfile.rb
+++ b/lib/tempfile.rb
@@ -6,7 +6,6 @@
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
@@ -133,7 +132,7 @@ class Tempfile < DelegateClass(File)
@clean_proc = Remover.new(@data)
ObjectSpace.define_finalizer(self, @clean_proc)
- create(basename, *rest) do |tmpname, n, opts|
+ ::Dir::Tmpname.create(basename, *rest) do |tmpname, n, opts|
mode = File::RDWR|File::CREAT|File::EXCL
perm = 0600
if opts
@@ -261,11 +260,15 @@ class Tempfile < DelegateClass(File)
end
alias length size
+ # :stopdoc:
def inspect
- "#<#{self.class}:#{path}>"
+ if closed?
+ "#<#{self.class}:#{path} (closed)>"
+ else
+ "#<#{self.class}:#{path}>"
+ end
end
- # :stopdoc:
class Remover
def initialize(data)
@pid = $$
@@ -291,9 +294,10 @@ class Tempfile < DelegateClass(File)
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.
@@ -332,12 +336,48 @@ class Tempfile < DelegateClass(File)
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!
+# 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.
+# The created file is not removed automatically.
+# You should use File.unlink to remove it.
+#
+# 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 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.
+#
+# Tempfile.create('foo', '/home/temp') do |f|
+# ... do something with f ...
+# end
+#
+def Tempfile.create(basename, *rest)
+ tmpfile = nil
+ 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?
+ begin
+ yield tmpfile
+ ensure
+ tmpfile.close if !tmpfile.closed?
+ File.unlink tmpfile
+ end
+ else
+ tmpfile
+ end
end
diff --git a/lib/test/unit/test-unit.gemspec b/lib/test/unit/test-unit.gemspec
deleted file mode 100644
index 6c7d22379d..0000000000
--- a/lib/test/unit/test-unit.gemspec
+++ /dev/null
@@ -1,14 +0,0 @@
-# -*- 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/lib/thread.rb b/lib/thread.rb
deleted file mode 100644
index 1c8107085b..0000000000
--- a/lib/thread.rb
+++ /dev/null
@@ -1,363 +0,0 @@
-#
-# thread.rb - thread support classes
-# by Yukihiro Matsumoto <matz@netlab.co.jp>
-#
-# Copyright (C) 2001 Yukihiro Matsumoto
-# Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
-# Copyright (C) 2000 Information-technology Promotion Agency, Japan
-#
-
-unless defined? Thread
- raise "Thread not available for this ruby interpreter"
-end
-
-unless defined? ThreadError
- class ThreadError < StandardError
- end
-end
-
-if $DEBUG
- Thread.abort_on_exception = true
-end
-
-#
-# 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
-# }
-# }
-#
-class ConditionVariable
- #
- # Creates a new ConditionVariable
- #
- def initialize
- @waiters = {}
- @waiters_mutex = Mutex.new
- end
-
- #
- # 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.
- #
- def wait(mutex, timeout=nil)
- Thread.handle_interrupt(StandardError => :never) do
- begin
- Thread.handle_interrupt(StandardError => :on_blocking) do
- @waiters_mutex.synchronize do
- @waiters[Thread.current] = true
- end
- mutex.sleep timeout
- end
- ensure
- @waiters_mutex.synchronize do
- @waiters.delete(Thread.current)
- end
- end
- end
- self
- end
-
- #
- # Wakes up the first thread in line waiting for this lock.
- #
- def signal
- Thread.handle_interrupt(StandardError => :on_blocking) do
- begin
- t, _ = @waiters_mutex.synchronize { @waiters.shift }
- t.run if t
- rescue ThreadError
- retry # t was already dead?
- end
- end
- self
- end
-
- #
- # Wakes up all threads waiting for this lock.
- #
- def broadcast
- Thread.handle_interrupt(StandardError => :on_blocking) do
- threads = nil
- @waiters_mutex.synchronize do
- threads = @waiters.keys
- @waiters.clear
- end
- for t in threads
- begin
- t.run
- rescue ThreadError
- end
- end
- end
- self
- end
-end
-
-#
-# 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
-#
-# consumer.join
-#
-class Queue
- #
- # Creates a new queue.
- #
- def initialize
- @que = []
- @que.taint # enable tainted communication
- @num_waiting = 0
- self.taint
- @mutex = Mutex.new
- @cond = ConditionVariable.new
- end
-
- #
- # Pushes +obj+ to the queue.
- #
- def push(obj)
- Thread.handle_interrupt(StandardError => :on_blocking) do
- @mutex.synchronize do
- @que.push obj
- @cond.signal
- end
- end
- end
-
- #
- # Alias of push
- #
- alias << push
-
- #
- # Alias of push
- #
- alias enq push
-
- #
- # 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.
- #
- def pop(non_block=false)
- Thread.handle_interrupt(StandardError => :on_blocking) do
- @mutex.synchronize do
- while true
- if @que.empty?
- if non_block
- raise ThreadError, "queue empty"
- else
- begin
- @num_waiting += 1
- @cond.wait @mutex
- ensure
- @num_waiting -= 1
- end
- end
- else
- return @que.shift
- end
- end
- end
- end
- end
-
- #
- # Alias of pop
- #
- alias shift pop
-
- #
- # Alias of pop
- #
- alias deq pop
-
- #
- # Returns +true+ if the queue is empty.
- #
- def empty?
- @que.empty?
- end
-
- #
- # Removes all objects from the queue.
- #
- def clear
- @que.clear
- end
-
- #
- # Returns the length of the queue.
- #
- def length
- @que.length
- end
-
- #
- # Alias of length.
- #
- alias size length
-
- #
- # Returns the number of threads waiting on the queue.
- #
- def num_waiting
- @num_waiting
- end
-end
-
-#
-# 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.
-#
-class SizedQueue < Queue
- #
- # Creates a fixed-length queue with a maximum size of +max+.
- #
- def initialize(max)
- raise ArgumentError, "queue size must be positive" unless max > 0
- @max = max
- @enque_cond = ConditionVariable.new
- @num_enqueue_waiting = 0
- super()
- end
-
- #
- # Returns the maximum size of the queue.
- #
- def max
- @max
- end
-
- #
- # Sets the maximum size of the queue.
- #
- def max=(max)
- raise ArgumentError, "queue size must be positive" unless max > 0
-
- @mutex.synchronize do
- if max <= @max
- @max = max
- else
- diff = max - @max
- @max = max
- diff.times do
- @enque_cond.signal
- end
- end
- end
- max
- end
-
- #
- # Pushes +obj+ to the queue. If there is no space left in the queue, waits
- # until space becomes available.
- #
- def push(obj)
- Thread.handle_interrupt(RuntimeError => :on_blocking) do
- @mutex.synchronize do
- while true
- break if @que.length < @max
- @num_enqueue_waiting += 1
- begin
- @enque_cond.wait @mutex
- ensure
- @num_enqueue_waiting -= 1
- end
- end
-
- @que.push obj
- @cond.signal
- end
- end
- end
-
- #
- # Alias of push
- #
- alias << push
-
- #
- # Alias of push
- #
- alias enq push
-
- #
- # Retrieves data from the queue and runs a waiting thread, if any.
- #
- def pop(*args)
- retval = super
- @mutex.synchronize do
- if @que.length < @max
- @enque_cond.signal
- end
- end
- retval
- end
-
- #
- # Alias of pop
- #
- alias shift pop
-
- #
- # Alias of pop
- #
- alias deq pop
-
- #
- # Returns the number of threads waiting on the queue.
- #
- def num_waiting
- @num_waiting + @num_enqueue_waiting
- end
-end
-
-# Documentation comments:
-# - How do you make RDoc inherit documentation from superclass?
diff --git a/lib/thwait.rb b/lib/thwait.rb
index f5876236e4..d9750a406b 100644
--- a/lib/thwait.rb
+++ b/lib/thwait.rb
@@ -15,7 +15,7 @@ require "e2mmap.rb"
#
# Example:
#
-# ThreadsWait.all_wait(thr1, thr2, ...) do |t|
+# ThreadsWait.all_waits(thr1, thr2, ...) do |t|
# STDERR.puts "Thread #{t} has terminated."
# end
#
@@ -25,8 +25,6 @@ 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.")
@@ -57,7 +55,7 @@ class ThreadsWait
end
# Returns the array of threads that have not terminated yet.
- attr :threads
+ attr_reader :threads
#
# Returns +true+ if there are no threads in the pool still running.
diff --git a/lib/time.rb b/lib/time.rb
index 12c2b30e25..d39c4f6515 100644
--- a/lib/time.rb
+++ b/lib/time.rb
@@ -80,7 +80,7 @@ require 'date'
#
# #strptime works similar to +parse+ except that instead of using a heuristic
# to detect the format of the input string, you provide a second argument that
-# is describes the format of the string. For example:
+# describes the format of the string. For example:
#
# Time.strptime("2000-10-31", "%Y-%m-%d") #=> 2000-10-31 00:00:00 -0500
@@ -174,8 +174,26 @@ class Time
end
private :zone_utc?
- LeapYearMonthDays = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
- CommonYearMonthDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
+ 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)
if ((y % 4 == 0) && (y % 100 != 0)) || (y % 400 == 0)
LeapYearMonthDays[m-1]
@@ -196,7 +214,8 @@ class Time
if o != 0 then hour += o; o, hour = hour.divmod(24); off += o end
if off != 0
day += off
- if month_days(year, mon) < day
+ days = month_days(year, mon)
+ if days and days < day
mon += 1
if 12 < mon
mon = 1
@@ -228,9 +247,24 @@ class Time
end
private :apply_offset
- def make_time(year, mon, day, hour, min, sec, sec_fraction, zone, now)
+ 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
+
usec = nil
usec = sec_fraction * 1000000 if sec_fraction
+
if now
begin
break if year; year = now.year
@@ -251,14 +285,16 @@ class Time
sec ||= 0
usec ||= 0
- off = nil
- off = zone_offset(zone, year) if zone
+ if year != off_year
+ off = nil
+ off = zone_offset(zone, year) if zone
+ end
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)
- t.localtime if !zone_utc?(zone)
+ force_zone!(t, zone, off)
t
else
self.local(year, mon, day, hour, min, sec, usec)
@@ -278,13 +314,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 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
+ # # 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
#
# Since there are numerous conflicts among locally defined time zone
# abbreviations all over the world, this method is not intended to
@@ -323,12 +359,9 @@ 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(year, d[:mon], d[:mday], d[:hour], d[:min], d[:sec], d[:sec_fraction], d[:zone], now)
+ make_time(date, year, d[:mon], d[:mday], d[:hour], d[:min], d[:sec], d[:sec_fraction], d[:zone], now)
end
#
@@ -339,7 +372,7 @@ class Time
#
# Time.strptime(...) {|y| y < 100 ? (y >= 69 ? y + 1900 : y + 2000) : y}
#
- # Below is a list of the formating options:
+ # Below is a list of the formatting options:
#
# %a :: The abbreviated weekday name ("Sun")
# %A :: The full weekday name ("Sunday")
@@ -384,7 +417,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 with century
+ # %Y :: Year which may include century, if provided
# %z :: Time zone as hour offset from UTC (e.g. +0900)
# %Z :: Time zone name
# %% :: Literal "%" character
@@ -393,19 +426,19 @@ class Time
d = Date._strptime(date, format)
raise ArgumentError, "invalid strptime format - `#{format}'" unless d
if seconds = d[:seconds]
- if offset = d[:offset]
- Time.at(seconds).localtime(offset)
- else
- Time.at(seconds)
+ t = Time.at(seconds)
+ if zone = d[:zone]
+ force_zone!(t, zone)
end
else
year = d[:year]
year = yield(year) if year && block_given?
- make_time(year, d[:mon], d[:mday], d[:hour], d[:min], d[:sec], d[:sec_fraction], d[:zone], now)
+ t = make_time(date, year, d[:mon], d[:mday], d[:hour], d[:min], d[:sec], d[:sec_fraction], d[:zone], now)
end
+ t
end
- MonthValue = {
+ MonthValue = { # :nodoc:
'JAN' => 1, 'FEB' => 2, 'MAR' => 3, 'APR' => 4, 'MAY' => 5, 'JUN' => 6,
'JUL' => 7, 'AUG' => 8, 'SEP' => 9, 'OCT' =>10, 'NOV' =>11, 'DEC' =>12
}
@@ -437,24 +470,26 @@ 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
- # following year completion is compliant with RFC 2822.
- year = if year < 50
- 2000 + year
- elsif year < 1000
- 1900 + year
- else
- year
- end
+ if short_year_p
+ # following year completion is compliant with RFC 2822.
+ year = if year < 50
+ 2000 + year
+ else
+ 1900 + year
+ end
+ end
+ off = zone_offset(zone)
year, mon, day, hour, min, sec =
- apply_offset(year, mon, day, hour, min, sec, zone_offset(zone))
+ apply_offset(year, mon, day, hour, min, sec, off)
t = self.utc(year, mon, day, hour, min, sec)
- t.localtime if !zone_utc?(zone)
+ force_zone!(t, zone, off)
t
else
raise ArgumentError.new("not RFC 2822 compliant date: #{date.inspect}")
@@ -482,7 +517,7 @@ class Time
(\d{2}):(\d{2}):(\d{2})\x20
GMT
\s*\z/ix =~ date
- self.rfc2822(date)
+ self.rfc2822(date).utc
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
@@ -542,9 +577,12 @@ 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, zone_offset(zone))
- self.utc(year, mon, day, hour, min, sec, usec)
+ 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
else
self.local(year, mon, day, hour, min, sec, usec)
end
@@ -581,10 +619,12 @@ class Time
end
alias rfc822 rfc2822
- RFC2822_DAY_NAME = [
+
+ RFC2822_DAY_NAME = [ # :nodoc:
'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'
]
- RFC2822_MONTH_NAME = [
+
+ RFC2822_MONTH_NAME = [ # :nodoc:
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
]
diff --git a/lib/timeout.rb b/lib/timeout.rb
index 284305bcca..d805dce2a3 100644
--- a/lib/timeout.rb
+++ b/lib/timeout.rb
@@ -26,6 +26,27 @@ module Timeout
class Error < RuntimeError
end
class ExitException < ::Exception # :nodoc:
+ attr_reader :thread
+
+ def self.catch(*args)
+ exc = new(*args)
+ exc.instance_variable_set(:@thread, Thread.current)
+ exc.freeze
+ ::Kernel.catch(exc) {yield exc}
+ end
+
+ def exception(*)
+ if self.thread == Thread.current
+ bt = caller
+ begin
+ throw(self, bt)
+ rescue ArgumentError => e
+ raise unless e.message.start_with?("uncaught throw")
+ raise Error, message, backtrace
+ end
+ end
+ self
+ end
end
# :stopdoc:
@@ -45,13 +66,17 @@ module Timeout
# Returns the result of the block *if* the block completed before
# +sec+ seconds, otherwise throws an exception, based on the value of +klass+.
#
+ # The exception thrown to terminate the given block cannot be rescued inside
+ # the block unless +klass+ is given explicitly.
+ #
# Note that this is both a method of module Timeout, so you can <tt>include
# Timeout</tt> into your classes so they have a #timeout method, as well as
# 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?
- exception = klass || Class.new(ExitException)
- begin
+ message = "execution expired"
+ e = Error
+ bl = proc do |exception|
begin
x = Thread.current
y = Thread.start {
@@ -60,7 +85,7 @@ module Timeout
rescue => e
x.raise e
else
- x.raise exception, "execution expired"
+ x.raise exception, message
end
}
return yield(sec)
@@ -70,18 +95,23 @@ module Timeout
y.join # make sure y is dead.
end
end
- rescue exception => e
- rej = /\A#{Regexp.quote(__FILE__)}:#{__LINE__-4}\z/o
- (bt = e.backtrace).reject! {|m| rej =~ m}
- level = -caller(CALLER_OFFSET).size
- while THIS_FILE =~ bt[level]
- bt.delete_at(level)
- level += 1
+ end
+ if klass
+ begin
+ bl.call(klass)
+ rescue klass => e
+ bt = e.backtrace
end
- raise if klass # if exception class is specified, it
- # would be expected outside.
- raise Error, e.message, e.backtrace
+ else
+ bt = ExitException.catch(message, &bl)
+ end
+ 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
+ raise(e, message, bt)
end
module_function :timeout
diff --git a/lib/tmpdir.rb b/lib/tmpdir.rb
index 18d4fb683d..409d779b8a 100644
--- a/lib/tmpdir.rb
+++ b/lib/tmpdir.rb
@@ -7,7 +7,7 @@
require 'fileutils'
begin
require 'etc.so'
-rescue LoadError
+rescue LoadError # rescue LoadError for miniruby
end
class Dir
@@ -19,7 +19,7 @@ class Dir
def Dir::tmpdir
if $SAFE > 0
- tmp = @@systmpdir
+ @@systmpdir
else
tmp = nil
for dir in [ENV['TMPDIR'], ENV['TMP'], ENV['TEMP'], @@systmpdir, '/tmp', '.']
@@ -39,7 +39,7 @@ class Dir
# Dir.mktmpdir creates a temporary directory.
#
# The directory is created with 0700 permission.
- # Application should not change the permission to make the temporary directory accesible from other users.
+ # Application should not change the permission to make the temporary directory accessible from other users.
#
# The prefix and suffix of the name of the directory is specified by
# the optional first argument, <i>prefix_suffix</i>.
diff --git a/lib/tracer.rb b/lib/tracer.rb
index 4266abf1b6..1d6b019bcf 100644
--- a/lib/tracer.rb
+++ b/lib/tracer.rb
@@ -12,7 +12,7 @@ require "thread"
#
# == Example
#
-# Consider the following ruby script
+# Consider the following Ruby script
#
# class A
# def square(a)
@@ -155,16 +155,8 @@ class Tracer
end
unless list = SCRIPT_LINES__[file]
- begin
- f = File::open(file)
- begin
- SCRIPT_LINES__[file] = list = f.readlines
- ensure
- f.close
- end
- rescue
- SCRIPT_LINES__[file] = list = []
- end
+ list = File.readlines(file) rescue []
+ SCRIPT_LINES__[file] = list
end
if l = list[line - 1]
diff --git a/lib/tsort.rb b/lib/tsort.rb
index d0f3cd4caa..cb8f67ef60 100644
--- a/lib/tsort.rb
+++ b/lib/tsort.rb
@@ -123,20 +123,59 @@ module TSort
class Cyclic < StandardError
end
- #
# Returns a topologically sorted array of nodes.
# The array is sorted from children to parents, i.e.
# the first element has no child and the last node has no parent.
#
# If there is a cycle, TSort::Cyclic is raised.
#
+ # class G
+ # include TSort
+ # def initialize(g)
+ # @g = g
+ # end
+ # def tsort_each_child(n, &b) @g[n].each(&b) end
+ # def tsort_each_node(&b) @g.each_key(&b) end
+ # end
+ #
+ # graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]})
+ # p graph.tsort #=> [4, 2, 3, 1]
+ #
+ # graph = G.new({1=>[2], 2=>[3, 4], 3=>[2], 4=>[]})
+ # p graph.tsort # raises TSort::Cyclic
+ #
def tsort
+ each_node = method(:tsort_each_node)
+ each_child = method(:tsort_each_child)
+ TSort.tsort(each_node, each_child)
+ end
+
+ # Returns a topologically sorted array of nodes.
+ # The array is sorted from children to parents, i.e.
+ # the first element has no child and the last node has no parent.
+ #
+ # The graph is represented by _each_node_ and _each_child_.
+ # _each_node_ should have +call+ method which yields for each node in the graph.
+ # _each_child_ should have +call+ method which takes a node argument and yields for each child node.
+ #
+ # If there is a cycle, TSort::Cyclic is raised.
+ #
+ # g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
+ # each_node = lambda {|&b| g.each_key(&b) }
+ # each_child = lambda {|n, &b| g[n].each(&b) }
+ # p TSort.tsort(each_node, each_child) #=> [4, 2, 3, 1]
+ #
+ # g = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
+ # each_node = lambda {|&b| g.each_key(&b) }
+ # each_child = lambda {|n, &b| g[n].each(&b) }
+ # p TSort.tsort(each_node, each_child) # raises TSort::Cyclic
+ #
+ def TSort.tsort(each_node, each_child)
result = []
- tsort_each {|element| result << element}
+ TSort.tsort_each(each_node, each_child) {|element| result << element}
result
end
- #
# The iterator version of the #tsort method.
# <tt><em>obj</em>.tsort_each</tt> is similar to <tt><em>obj</em>.tsort.each</tt>, but
# modification of _obj_ during the iteration may lead to unexpected results.
@@ -144,8 +183,45 @@ module TSort
# #tsort_each returns +nil+.
# If there is a cycle, TSort::Cyclic is raised.
#
- def tsort_each # :yields: node
- each_strongly_connected_component {|component|
+ # class G
+ # include TSort
+ # def initialize(g)
+ # @g = g
+ # end
+ # def tsort_each_child(n, &b) @g[n].each(&b) end
+ # def tsort_each_node(&b) @g.each_key(&b) end
+ # end
+ #
+ # graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]})
+ # graph.tsort_each {|n| p n }
+ # #=> 4
+ # # 2
+ # # 3
+ # # 1
+ #
+ def tsort_each(&block) # :yields: node
+ each_node = method(:tsort_each_node)
+ each_child = method(:tsort_each_child)
+ TSort.tsort_each(each_node, each_child, &block)
+ end
+
+ # The iterator version of the TSort.tsort method.
+ #
+ # The graph is represented by _each_node_ and _each_child_.
+ # _each_node_ should have +call+ method which yields for each node in the graph.
+ # _each_child_ should have +call+ method which takes a node argument and yields for each child node.
+ #
+ # g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
+ # each_node = lambda {|&b| g.each_key(&b) }
+ # each_child = lambda {|n, &b| g[n].each(&b) }
+ # TSort.tsort_each(each_node, each_child) {|n| p n }
+ # #=> 4
+ # # 2
+ # # 3
+ # # 1
+ #
+ def TSort.tsort_each(each_node, each_child) # :yields: node
+ TSort.each_strongly_connected_component(each_node, each_child) {|component|
if component.size == 1
yield component.first
else
@@ -154,32 +230,121 @@ module TSort
}
end
- #
# Returns strongly connected components as an array of arrays of nodes.
# The array is sorted from children to parents.
# Each elements of the array represents a strongly connected component.
#
+ # class G
+ # include TSort
+ # def initialize(g)
+ # @g = g
+ # end
+ # def tsort_each_child(n, &b) @g[n].each(&b) end
+ # def tsort_each_node(&b) @g.each_key(&b) end
+ # end
+ #
+ # graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]})
+ # p graph.strongly_connected_components #=> [[4], [2], [3], [1]]
+ #
+ # graph = G.new({1=>[2], 2=>[3, 4], 3=>[2], 4=>[]})
+ # p graph.strongly_connected_components #=> [[4], [2, 3], [1]]
+ #
def strongly_connected_components
+ each_node = method(:tsort_each_node)
+ each_child = method(:tsort_each_child)
+ TSort.strongly_connected_components(each_node, each_child)
+ end
+
+ # Returns strongly connected components as an array of arrays of nodes.
+ # The array is sorted from children to parents.
+ # Each elements of the array represents a strongly connected component.
+ #
+ # The graph is represented by _each_node_ and _each_child_.
+ # _each_node_ should have +call+ method which yields for each node in the graph.
+ # _each_child_ should have +call+ method which takes a node argument and yields for each child node.
+ #
+ # g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
+ # each_node = lambda {|&b| g.each_key(&b) }
+ # each_child = lambda {|n, &b| g[n].each(&b) }
+ # p TSort.strongly_connected_components(each_node, each_child)
+ # #=> [[4], [2], [3], [1]]
+ #
+ # g = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
+ # each_node = lambda {|&b| g.each_key(&b) }
+ # each_child = lambda {|n, &b| g[n].each(&b) }
+ # p TSort.strongly_connected_components(each_node, each_child)
+ # #=> [[4], [2, 3], [1]]
+ #
+ def TSort.strongly_connected_components(each_node, each_child)
result = []
- each_strongly_connected_component {|component| result << component}
+ TSort.each_strongly_connected_component(each_node, each_child) {|component| result << component}
result
end
- #
# The iterator version of the #strongly_connected_components method.
# <tt><em>obj</em>.each_strongly_connected_component</tt> is similar to
# <tt><em>obj</em>.strongly_connected_components.each</tt>, but
# modification of _obj_ during the iteration may lead to unexpected results.
#
- #
# #each_strongly_connected_component returns +nil+.
#
- def each_strongly_connected_component # :yields: nodes
+ # class G
+ # include TSort
+ # def initialize(g)
+ # @g = g
+ # end
+ # def tsort_each_child(n, &b) @g[n].each(&b) end
+ # def tsort_each_node(&b) @g.each_key(&b) end
+ # end
+ #
+ # graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]})
+ # graph.each_strongly_connected_component {|scc| p scc }
+ # #=> [4]
+ # # [2]
+ # # [3]
+ # # [1]
+ #
+ # graph = G.new({1=>[2], 2=>[3, 4], 3=>[2], 4=>[]})
+ # graph.each_strongly_connected_component {|scc| p scc }
+ # #=> [4]
+ # # [2, 3]
+ # # [1]
+ #
+ def each_strongly_connected_component(&block) # :yields: nodes
+ each_node = method(:tsort_each_node)
+ each_child = method(:tsort_each_child)
+ TSort.each_strongly_connected_component(each_node, each_child, &block)
+ end
+
+ # The iterator version of the TSort.strongly_connected_components method.
+ #
+ # The graph is represented by _each_node_ and _each_child_.
+ # _each_node_ should have +call+ method which yields for each node in the graph.
+ # _each_child_ should have +call+ method which takes a node argument and yields for each child node.
+ #
+ # g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
+ # each_node = lambda {|&b| g.each_key(&b) }
+ # each_child = lambda {|n, &b| g[n].each(&b) }
+ # TSort.each_strongly_connected_component(each_node, each_child) {|scc| p scc }
+ # #=> [4]
+ # # [2]
+ # # [3]
+ # # [1]
+ #
+ # g = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
+ # each_node = lambda {|&b| g.each_key(&b) }
+ # each_child = lambda {|n, &b| g[n].each(&b) }
+ # TSort.each_strongly_connected_component(each_node, each_child) {|scc| p scc }
+ # #=> [4]
+ # # [2, 3]
+ # # [1]
+ #
+ def TSort.each_strongly_connected_component(each_node, each_child) # :yields: nodes
id_map = {}
stack = []
- tsort_each_node {|node|
+ each_node.call {|node|
unless id_map.include? node
- each_strongly_connected_component_from(node, id_map, stack) {|c|
+ TSort.each_strongly_connected_component_from(node, each_child, id_map, stack) {|c|
yield c
}
end
@@ -187,7 +352,6 @@ module TSort
nil
end
- #
# Iterates over strongly connected component in the subgraph reachable from
# _node_.
#
@@ -195,18 +359,62 @@ module TSort
#
# #each_strongly_connected_component_from doesn't call #tsort_each_node.
#
- def each_strongly_connected_component_from(node, id_map={}, stack=[]) # :yields: nodes
+ # class G
+ # include TSort
+ # def initialize(g)
+ # @g = g
+ # end
+ # def tsort_each_child(n, &b) @g[n].each(&b) end
+ # def tsort_each_node(&b) @g.each_key(&b) end
+ # end
+ #
+ # graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]})
+ # graph.each_strongly_connected_component_from(2) {|scc| p scc }
+ # #=> [4]
+ # # [2]
+ #
+ # graph = G.new({1=>[2], 2=>[3, 4], 3=>[2], 4=>[]})
+ # graph.each_strongly_connected_component_from(2) {|scc| p scc }
+ # #=> [4]
+ # # [2, 3]
+ #
+ def each_strongly_connected_component_from(node, id_map={}, stack=[], &block) # :yields: nodes
+ TSort.each_strongly_connected_component_from(node, method(:tsort_each_child), id_map, stack, &block)
+ end
+
+ # Iterates over strongly connected components in a graph.
+ # The graph is represented by _node_ and _each_child_.
+ #
+ # _node_ is the first node.
+ # _each_child_ should have +call+ method which takes a node argument
+ # and yields for each child node.
+ #
+ # Return value is unspecified.
+ #
+ # #TSort.each_strongly_connected_component_from is a class method and
+ # it doesn't need a class to represent a graph which includes TSort.
+ #
+ # graph = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
+ # each_child = lambda {|n, &b| graph[n].each(&b) }
+ # TSort.each_strongly_connected_component_from(1, each_child) {|scc|
+ # p scc
+ # }
+ # #=> [4]
+ # # [2, 3]
+ # # [1]
+ #
+ def TSort.each_strongly_connected_component_from(node, each_child, id_map={}, stack=[]) # :yields: nodes
minimum_id = node_id = id_map[node] = id_map.size
stack_length = stack.length
stack << node
- tsort_each_child(node) {|child|
+ each_child.call(node) {|child|
if id_map.include? child
child_id = id_map[child]
minimum_id = child_id if child_id && child_id < minimum_id
else
sub_minimum_id =
- each_strongly_connected_component_from(child, id_map, stack) {|c|
+ TSort.each_strongly_connected_component_from(child, each_child, id_map, stack) {|c|
yield c
}
minimum_id = sub_minimum_id if sub_minimum_id < minimum_id
@@ -222,7 +430,6 @@ module TSort
minimum_id
end
- #
# Should be implemented by a extended class.
#
# #tsort_each_node is used to iterate for all nodes over a graph.
@@ -231,7 +438,6 @@ module TSort
raise NotImplementedError.new
end
- #
# Should be implemented by a extended class.
#
# #tsort_each_child is used to iterate for child nodes of _node_.
diff --git a/lib/un.rb b/lib/un.rb
index e06e0e759b..487ba9eb75 100644
--- a/lib/un.rb
+++ b/lib/un.rb
@@ -32,7 +32,9 @@ module FileUtils
@fileutils_output = $stdout
end
+# :nodoc:
def setup(options = "", *long_options)
+ caller = caller_locations(1, 1)[0].label
opt_hash = {}
argv = []
OptionParser.new do |o|
@@ -53,6 +55,10 @@ def setup(options = "", *long_options)
end
end
o.on("-v") do opt_hash[:verbose] = true end
+ o.on("--help") do
+ UN.help([caller])
+ exit
+ end
o.order!(ARGV) do |x|
if /[*?\[{]/ =~ x
argv.concat(Dir[x])
@@ -246,8 +252,10 @@ def wait_writable
break
rescue Errno::EACCES => e
raise if n and (n -= 1) <= 0
- puts e
- STDOUT.flush
+ if verbose
+ puts e
+ STDOUT.flush
+ end
sleep wait
retry
end
@@ -335,15 +343,33 @@ end
def help
setup do |argv,|
+ UN.help(argv)
+ end
+end
+
+module UN # :nodoc:
+ module_function
+ def help(argv, output: $stdout)
all = argv.empty?
+ cmd = nil
+ if all
+ store = proc {|msg| output << msg}
+ else
+ messages = {}
+ store = proc {|msg| messages[cmd] = msg}
+ end
open(__FILE__) do |me|
while me.gets("##\n")
if help = me.gets("\n\n")
- if all or argv.delete help[/-e \w+/].sub(/-e /, "")
- print help.gsub(/^# ?/, "")
+ if all or argv.include?(cmd = help[/^#\s*ruby\s.*-e\s+(\w+)/, 1])
+ store[help.gsub(/^# ?/, "")]
+ break unless all or argv.size > messages.size
end
end
end
end
+ if messages
+ argv.each {|cmd| output << messages[cmd]}
+ end
end
end
diff --git a/lib/uri/common.rb b/lib/uri/common.rb
index e71b36793b..facca4b08b 100644
--- a/lib/uri/common.rb
+++ b/lib/uri/common.rb
@@ -9,537 +9,13 @@
# See URI for general documentation
#
-module URI
- #
- # 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})?"
+require "uri/rfc2396_parser"
+require "uri/rfc3986_parser"
- # 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
+module URI
+ REGEXP = RFC2396_REGEXP
+ Parser = RFC2396_Parser
+ RFC3986_PARSER = RFC3986_Parser.new
# URI::Parser.new
DEFAULT_PARSER = Parser.new
@@ -575,7 +51,7 @@ module URI
end
else
raise ArgumentError,
- "expected Array of or Hash of components of #{klass.to_s} (#{klass.component[1..-1].join(', ')})"
+ "expected Array of or Hash of components of #{klass} (#{klass.component[1..-1].join(', ')})"
end
tmp[:scheme] = klass.to_s.sub(/\A.*::/, '').downcase
@@ -709,7 +185,7 @@ module URI
# # => ["http", nil, "www.ruby-lang.org", nil, nil, "/", nil, nil, nil]
#
def self.split(uri)
- DEFAULT_PARSER.split(uri)
+ RFC3986_PARSER.split(uri)
end
#
@@ -743,8 +219,11 @@ 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)
- DEFAULT_PARSER.parse(uri)
+ RFC3986_PARSER.parse(uri)
end
#
@@ -755,7 +234,7 @@ module URI
# == Args
#
# +str+::
- # String(s) to work with
+ # String(s) to work with, will be converted to RFC3986 URIs before merging.
#
# == Description
#
@@ -782,7 +261,7 @@ module URI
#
#
def self.join(*str)
- DEFAULT_PARSER.join(*str)
+ RFC3986_PARSER.join(*str)
end
#
@@ -810,6 +289,7 @@ 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
@@ -845,6 +325,7 @@ 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
@@ -873,18 +354,21 @@ module URI
# This method doesn't convert *, -, ., 0-9, A-Z, _, a-z, but does convert SP
# (ASCII space) to + and converts others to %XX.
#
+ # If +enc+ is given, convert +str+ to the encoding before percent encoding.
+ #
# This is an implementation of
- # http://www.w3.org/TR/html5/association-of-controls-and-forms.html#url-encoded-form-data
+ # http://www.w3.org/TR/2013/CR-html5-20130806/forms.html#url-encoded-form-data
#
# See URI.decode_www_form_component, URI.encode_www_form
- def self.encode_www_form_component(str)
- str = str.to_s
- if HTML5ASCIIINCOMPAT.include?(str.encoding)
- str = str.encode(Encoding::UTF_8)
- else
- str = str.dup
+ def self.encode_www_form_component(str, enc=nil)
+ str = str.to_s.dup
+ if str.encoding != Encoding::ASCII_8BIT
+ if enc && enc != Encoding::ASCII_8BIT
+ str.encode!(Encoding::UTF_8, invalid: :replace, undef: :replace)
+ str.encode!(enc, fallback: ->(x){"&#{x.ord};"})
+ end
+ str.force_encoding(Encoding::ASCII_8BIT)
end
- str.force_encoding(Encoding::ASCII_8BIT)
str.gsub!(/[^*\-.0-9A-Z_a-z]/, TBLENCWWWCOMP_)
str.force_encoding(Encoding::US_ASCII)
end
@@ -895,10 +379,8 @@ 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})" unless /\A[^%]*(?:%\h\h[^%]*)*\z/ =~ str
- str.dup.force_encoding("ASCII-8BIT") \
- .gsub(/\+|%\h\h/, TBLDECWWWCOMP_) \
- .force_encoding(enc)
+ raise ArgumentError, "invalid %-encoding (#{str})" if /%(?!\h\h)/ =~ str
+ str.b.gsub(/\+|%\h\h/, TBLDECWWWCOMP_).force_encoding(enc)
end
# Generate URL-encoded form data from given +enum+.
@@ -916,8 +398,7 @@ module URI
# This method doesn't handle files. When you send a file, use
# multipart/form-data.
#
- # This is an implementation of
- # http://www.w3.org/TR/html5/forms.html#url-encoded-form-data
+ # This refers http://url.spec.whatwg.org/#concept-urlencoded-serializer
#
# URI.encode_www_form([["q", "ruby"], ["lang", "en"]])
# #=> "q=ruby&lang=en"
@@ -929,39 +410,33 @@ module URI
# #=> "q=ruby&q=perl&lang=en"
#
# See URI.encode_www_form_component, URI.decode_www_form
- def self.encode_www_form(enum)
+ def self.encode_www_form(enum, enc=nil)
enum.map do |k,v|
if v.nil?
- encode_www_form_component(k)
+ encode_www_form_component(k, enc)
elsif v.respond_to?(:to_ary)
v.to_ary.map do |w|
- str = encode_www_form_component(k)
+ str = encode_www_form_component(k, enc)
unless w.nil?
str << '='
- str << encode_www_form_component(w)
+ str << encode_www_form_component(w, enc)
end
end.join('&')
else
- str = encode_www_form_component(k)
+ str = encode_www_form_component(k, enc)
str << '='
- str << encode_www_form_component(v)
+ str << encode_www_form_component(v, enc)
end
end.join('&')
end
- WFKV_ = '(?:[^%#=;&]*(?:%\h\h[^%#=;&]*)*)' # :nodoc:
-
# Decode URL-encoded form data from given +str+.
#
# This decodes application/x-www-form-urlencoded data
# and returns array of key-value array.
- # This internally uses URI.decode_www_form_component.
#
- # _charset_ hack is not supported now because the mapping from given charset
- # to Ruby's encoding is not clear yet.
- # see also http://www.w3.org/TR/html5/syntax.html#character-encodings-0
- #
- # This refers http://www.w3.org/TR/html5/forms.html#url-encoded-form-data
+ # 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']]
@@ -971,17 +446,259 @@ module URI
# 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)
- return [] if str.empty?
- unless /\A#{WFKV_}=#{WFKV_}(?:[;&]#{WFKV_}=#{WFKV_})*\z/o =~ str
- raise ArgumentError, "invalid data of application/x-www-form-urlencoded (#{str})"
- end
+ def self.decode_www_form(str, enc=Encoding::UTF_8, separator: '&', use__charset_: false, isindex: false)
+ raise ArgumentError, "the input of #{self.name}.#{__method__} must be ASCII only string" unless str.ascii_only?
ary = []
- $&.scan(/([^=;&]+)=([^;&]*)/) do
- ary << [decode_www_form_component($1, enc), decode_www_form_component($2, enc)]
+ return ary if str.empty?
+ enc = Encoding.find(enc)
+ str.b.each_line(separator) do |string|
+ string.chomp!(separator)
+ key, sep, val = string.partition('=')
+ if isindex
+ if sep.empty?
+ val = key
+ key = ''
+ end
+ isindex = false
+ end
+
+ if use__charset_ and key == '_charset_' and e = get_encoding(val)
+ enc = e
+ use__charset_ = false
+ end
+
+ key.gsub!(/\+|%\h\h/, TBLDECWWWCOMP_)
+ if val
+ val.gsub!(/\+|%\h\h/, TBLDECWWWCOMP_)
+ else
+ val = ''
+ end
+
+ ary << [key, val]
+ end
+ ary.each do |k, v|
+ k.force_encoding(enc)
+ k.scrub!
+ v.force_encoding(enc)
+ v.scrub!
end
ary
end
+
+ private
+ # curl http://encoding.spec.whatwg.org/encodings.json|rb -rpp -rjson -e'H={};h={"shift_jis"=>"Windows-31J","euc-jp"=>"cp51932","iso-2022-jp"=>"cp50221","x-mac-cyrillic"=>"macCyrillic"};JSON($<.read).map{|x|x["encodings"]}.flatten.each{|x|Encoding.find(n=h.fetch(n=x["name"],n))rescue next;x["labels"].each{|y|H[y]=n}};pp H'
+ WEB_ENCODINGS_ = {
+ "unicode-1-1-utf-8"=>"utf-8",
+ "utf-8"=>"utf-8",
+ "utf8"=>"utf-8",
+ "866"=>"ibm866",
+ "cp866"=>"ibm866",
+ "csibm866"=>"ibm866",
+ "ibm866"=>"ibm866",
+ "csisolatin2"=>"iso-8859-2",
+ "iso-8859-2"=>"iso-8859-2",
+ "iso-ir-101"=>"iso-8859-2",
+ "iso8859-2"=>"iso-8859-2",
+ "iso88592"=>"iso-8859-2",
+ "iso_8859-2"=>"iso-8859-2",
+ "iso_8859-2:1987"=>"iso-8859-2",
+ "l2"=>"iso-8859-2",
+ "latin2"=>"iso-8859-2",
+ "csisolatin3"=>"iso-8859-3",
+ "iso-8859-3"=>"iso-8859-3",
+ "iso-ir-109"=>"iso-8859-3",
+ "iso8859-3"=>"iso-8859-3",
+ "iso88593"=>"iso-8859-3",
+ "iso_8859-3"=>"iso-8859-3",
+ "iso_8859-3:1988"=>"iso-8859-3",
+ "l3"=>"iso-8859-3",
+ "latin3"=>"iso-8859-3",
+ "csisolatin4"=>"iso-8859-4",
+ "iso-8859-4"=>"iso-8859-4",
+ "iso-ir-110"=>"iso-8859-4",
+ "iso8859-4"=>"iso-8859-4",
+ "iso88594"=>"iso-8859-4",
+ "iso_8859-4"=>"iso-8859-4",
+ "iso_8859-4:1988"=>"iso-8859-4",
+ "l4"=>"iso-8859-4",
+ "latin4"=>"iso-8859-4",
+ "csisolatincyrillic"=>"iso-8859-5",
+ "cyrillic"=>"iso-8859-5",
+ "iso-8859-5"=>"iso-8859-5",
+ "iso-ir-144"=>"iso-8859-5",
+ "iso8859-5"=>"iso-8859-5",
+ "iso88595"=>"iso-8859-5",
+ "iso_8859-5"=>"iso-8859-5",
+ "iso_8859-5:1988"=>"iso-8859-5",
+ "arabic"=>"iso-8859-6",
+ "asmo-708"=>"iso-8859-6",
+ "csiso88596e"=>"iso-8859-6",
+ "csiso88596i"=>"iso-8859-6",
+ "csisolatinarabic"=>"iso-8859-6",
+ "ecma-114"=>"iso-8859-6",
+ "iso-8859-6"=>"iso-8859-6",
+ "iso-8859-6-e"=>"iso-8859-6",
+ "iso-8859-6-i"=>"iso-8859-6",
+ "iso-ir-127"=>"iso-8859-6",
+ "iso8859-6"=>"iso-8859-6",
+ "iso88596"=>"iso-8859-6",
+ "iso_8859-6"=>"iso-8859-6",
+ "iso_8859-6:1987"=>"iso-8859-6",
+ "csisolatingreek"=>"iso-8859-7",
+ "ecma-118"=>"iso-8859-7",
+ "elot_928"=>"iso-8859-7",
+ "greek"=>"iso-8859-7",
+ "greek8"=>"iso-8859-7",
+ "iso-8859-7"=>"iso-8859-7",
+ "iso-ir-126"=>"iso-8859-7",
+ "iso8859-7"=>"iso-8859-7",
+ "iso88597"=>"iso-8859-7",
+ "iso_8859-7"=>"iso-8859-7",
+ "iso_8859-7:1987"=>"iso-8859-7",
+ "sun_eu_greek"=>"iso-8859-7",
+ "csiso88598e"=>"iso-8859-8",
+ "csisolatinhebrew"=>"iso-8859-8",
+ "hebrew"=>"iso-8859-8",
+ "iso-8859-8"=>"iso-8859-8",
+ "iso-8859-8-e"=>"iso-8859-8",
+ "iso-ir-138"=>"iso-8859-8",
+ "iso8859-8"=>"iso-8859-8",
+ "iso88598"=>"iso-8859-8",
+ "iso_8859-8"=>"iso-8859-8",
+ "iso_8859-8:1988"=>"iso-8859-8",
+ "visual"=>"iso-8859-8",
+ "csisolatin6"=>"iso-8859-10",
+ "iso-8859-10"=>"iso-8859-10",
+ "iso-ir-157"=>"iso-8859-10",
+ "iso8859-10"=>"iso-8859-10",
+ "iso885910"=>"iso-8859-10",
+ "l6"=>"iso-8859-10",
+ "latin6"=>"iso-8859-10",
+ "iso-8859-13"=>"iso-8859-13",
+ "iso8859-13"=>"iso-8859-13",
+ "iso885913"=>"iso-8859-13",
+ "iso-8859-14"=>"iso-8859-14",
+ "iso8859-14"=>"iso-8859-14",
+ "iso885914"=>"iso-8859-14",
+ "csisolatin9"=>"iso-8859-15",
+ "iso-8859-15"=>"iso-8859-15",
+ "iso8859-15"=>"iso-8859-15",
+ "iso885915"=>"iso-8859-15",
+ "iso_8859-15"=>"iso-8859-15",
+ "l9"=>"iso-8859-15",
+ "iso-8859-16"=>"iso-8859-16",
+ "cskoi8r"=>"koi8-r",
+ "koi"=>"koi8-r",
+ "koi8"=>"koi8-r",
+ "koi8-r"=>"koi8-r",
+ "koi8_r"=>"koi8-r",
+ "koi8-u"=>"koi8-u",
+ "dos-874"=>"windows-874",
+ "iso-8859-11"=>"windows-874",
+ "iso8859-11"=>"windows-874",
+ "iso885911"=>"windows-874",
+ "tis-620"=>"windows-874",
+ "windows-874"=>"windows-874",
+ "cp1250"=>"windows-1250",
+ "windows-1250"=>"windows-1250",
+ "x-cp1250"=>"windows-1250",
+ "cp1251"=>"windows-1251",
+ "windows-1251"=>"windows-1251",
+ "x-cp1251"=>"windows-1251",
+ "ansi_x3.4-1968"=>"windows-1252",
+ "ascii"=>"windows-1252",
+ "cp1252"=>"windows-1252",
+ "cp819"=>"windows-1252",
+ "csisolatin1"=>"windows-1252",
+ "ibm819"=>"windows-1252",
+ "iso-8859-1"=>"windows-1252",
+ "iso-ir-100"=>"windows-1252",
+ "iso8859-1"=>"windows-1252",
+ "iso88591"=>"windows-1252",
+ "iso_8859-1"=>"windows-1252",
+ "iso_8859-1:1987"=>"windows-1252",
+ "l1"=>"windows-1252",
+ "latin1"=>"windows-1252",
+ "us-ascii"=>"windows-1252",
+ "windows-1252"=>"windows-1252",
+ "x-cp1252"=>"windows-1252",
+ "cp1253"=>"windows-1253",
+ "windows-1253"=>"windows-1253",
+ "x-cp1253"=>"windows-1253",
+ "cp1254"=>"windows-1254",
+ "csisolatin5"=>"windows-1254",
+ "iso-8859-9"=>"windows-1254",
+ "iso-ir-148"=>"windows-1254",
+ "iso8859-9"=>"windows-1254",
+ "iso88599"=>"windows-1254",
+ "iso_8859-9"=>"windows-1254",
+ "iso_8859-9:1989"=>"windows-1254",
+ "l5"=>"windows-1254",
+ "latin5"=>"windows-1254",
+ "windows-1254"=>"windows-1254",
+ "x-cp1254"=>"windows-1254",
+ "cp1255"=>"windows-1255",
+ "windows-1255"=>"windows-1255",
+ "x-cp1255"=>"windows-1255",
+ "cp1256"=>"windows-1256",
+ "windows-1256"=>"windows-1256",
+ "x-cp1256"=>"windows-1256",
+ "cp1257"=>"windows-1257",
+ "windows-1257"=>"windows-1257",
+ "x-cp1257"=>"windows-1257",
+ "cp1258"=>"windows-1258",
+ "windows-1258"=>"windows-1258",
+ "x-cp1258"=>"windows-1258",
+ "x-mac-cyrillic"=>"macCyrillic",
+ "x-mac-ukrainian"=>"macCyrillic",
+ "chinese"=>"gbk",
+ "csgb2312"=>"gbk",
+ "csiso58gb231280"=>"gbk",
+ "gb2312"=>"gbk",
+ "gb_2312"=>"gbk",
+ "gb_2312-80"=>"gbk",
+ "gbk"=>"gbk",
+ "iso-ir-58"=>"gbk",
+ "x-gbk"=>"gbk",
+ "gb18030"=>"gb18030",
+ "big5"=>"big5",
+ "big5-hkscs"=>"big5",
+ "cn-big5"=>"big5",
+ "csbig5"=>"big5",
+ "x-x-big5"=>"big5",
+ "cseucpkdfmtjapanese"=>"cp51932",
+ "euc-jp"=>"cp51932",
+ "x-euc-jp"=>"cp51932",
+ "csiso2022jp"=>"cp50221",
+ "iso-2022-jp"=>"cp50221",
+ "csshiftjis"=>"Windows-31J",
+ "ms_kanji"=>"Windows-31J",
+ "shift-jis"=>"Windows-31J",
+ "shift_jis"=>"Windows-31J",
+ "sjis"=>"Windows-31J",
+ "windows-31j"=>"Windows-31J",
+ "x-sjis"=>"Windows-31J",
+ "cseuckr"=>"euc-kr",
+ "csksc56011987"=>"euc-kr",
+ "euc-kr"=>"euc-kr",
+ "iso-ir-149"=>"euc-kr",
+ "korean"=>"euc-kr",
+ "ks_c_5601-1987"=>"euc-kr",
+ "ks_c_5601-1989"=>"euc-kr",
+ "ksc5601"=>"euc-kr",
+ "ksc_5601"=>"euc-kr",
+ "windows-949"=>"euc-kr",
+ "utf-16be"=>"utf-16be",
+ "utf-16"=>"utf-16le",
+ "utf-16le"=>"utf-16le"
+ } # :nodoc:
+
+ # :nodoc:
+ # return encoding or nil
+ # http://encoding.spec.whatwg.org/#concept-encoding-get
+ def self.get_encoding(label)
+ Encoding.find(WEB_ENCODINGS_[label.to_str.strip.downcase]) rescue nil
+ end
end # module URI
module Kernel
diff --git a/lib/uri/ftp.rb b/lib/uri/ftp.rb
index 9153c88636..557e1fda33 100644
--- a/lib/uri/ftp.rb
+++ b/lib/uri/ftp.rb
@@ -129,17 +129,24 @@ module URI
# Arguments are +scheme+, +userinfo+, +host+, +port+, +registry+, +path+,
# +opaque+, +query+ and +fragment+, in that order.
#
- def initialize(*arg)
- raise InvalidURIError unless arg[5]
- arg[5] = arg[5].sub(/^\//,'').sub(/^%2F/,'/')
- super(*arg)
+ 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)
@typecode = nil
- tmp = @path.index(TYPECODE_PREFIX)
- if tmp
+ if tmp = @path.index(TYPECODE_PREFIX)
typecode = @path[tmp + TYPECODE_PREFIX.size..-1]
@path = @path[0..tmp - 1]
- if arg[-1]
+ if arg_check
self.typecode = typecode
else
self.set_typecode(typecode)
@@ -165,7 +172,7 @@ module URI
end
private :check_typecode
- # private setter for the typecode +v+
+ # Private setter for the typecode +v+
#
# see also URI::FTP.typecode=
#
@@ -234,11 +241,13 @@ module URI
return @path.sub(/^\//,'').sub(/^%2F/,'/')
end
+ # Private setter for the path of the URI::FTP
def set_path(v)
super("/" + v.sub(/^\//, "%2F"))
end
protected :set_path
+ # Returns a String representation of the URI::FTP
def to_s
save_path = nil
if @typecode
diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb
index b1195fdf0b..0169934d04 100644
--- a/lib/uri/generic.rb
+++ b/lib/uri/generic.rb
@@ -55,16 +55,9 @@ module URI
self::COMPONENT
end
- #
- # Default to not use the registry for a URI::Generic
- #
- USE_REGISTRY = false
+ USE_REGISTRY = false # :nodoc:
- #
- # Returns whether a registry of naming
- # authorities are being used.
- #
- def self.use_registry
+ def self.use_registry # :nodoc:
self::USE_REGISTRY
end
@@ -185,7 +178,6 @@ module URI
@path = nil
@query = nil
@opaque = nil
- @registry = nil
@fragment = nil
@parser = parser == DEFAULT_PARSER ? nil : parser
@@ -197,7 +189,6 @@ module URI
self.path = path
self.query = query
self.opaque = opaque
- self.registry = registry
self.fragment = fragment
else
self.set_scheme(scheme)
@@ -205,14 +196,13 @@ module URI
self.set_host(host)
self.set_port(port)
self.set_path(path)
- self.set_query(query)
+ self.query = query
self.set_opaque(opaque)
- self.set_registry(registry)
- self.set_fragment(fragment)
+ self.fragment=(fragment)
end
- if @registry && !self.class.use_registry
+ if 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
@@ -257,11 +247,9 @@ module URI
#
attr_reader :port
- # returns the registry component of the URI.
- #
- # (see RFC2396 Section 3.2)
- #
- attr_reader :registry
+ def registry # :nodoc:
+ nil
+ end
# returns the path component of the URI.
#
@@ -401,9 +389,9 @@ module URI
# with a user component defined.
#
def check_user(v)
- if @registry || @opaque
+ if @opaque
raise InvalidURIError,
- "can not set user with registry or opaque"
+ "can not set user with opaque"
end
return v unless v
@@ -425,9 +413,9 @@ module URI
# with a user component defined.
#
def check_password(v, user = @user)
- if @registry || @opaque
+ if @opaque
raise InvalidURIError,
- "can not set password with registry or opaque"
+ "can not set password with opaque"
end
return v unless v
@@ -552,7 +540,7 @@ module URI
protected :set_password
# returns the userinfo +ui+ as user, password
- # if properly formated as 'user:password'
+ # if properly formatted as 'user:password'
def split_userinfo(ui)
return nil, nil unless ui
user, password = ui.split(/:/, 2)
@@ -563,7 +551,7 @@ module URI
# escapes 'user:password' +v+ based on RFC 1738 section 3.1
def escape_userpass(v)
- v = parser.escape(v, /[@:\/]/o) # RFC 1738 section 3.1 #/
+ parser.escape(v, /[@:\/]/o) # RFC 1738 section 3.1 #/
end
private :escape_userpass
@@ -598,7 +586,7 @@ module URI
def check_host(v)
return v unless v
- if @registry || @opaque
+ if @opaque
raise InvalidURIError,
"can not set host with registry or opaque"
elsif parser.regexp[:HOST] !~ v
@@ -651,7 +639,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 (andn future IP) addresses are removed.
+ # brackets for IPv6 (and future IP) addresses are removed.
#
# u = URI("http://[::1]/bar")
# p u.hostname #=> "::1"
@@ -672,7 +660,7 @@ module URI
# u.hostname = "::1"
# p u.to_s #=> "http://[::1]/bar"
#
- # If the arugument seems IPv6 address,
+ # If the argument seems IPv6 address,
# it is wrapped by brackets.
#
def hostname=(v)
@@ -690,12 +678,12 @@ module URI
def check_port(v)
return v unless v
- if @registry || @opaque
+ if @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}"
+ "bad component(expected port component): #{v.inspect}"
end
return true
@@ -747,57 +735,18 @@ module URI
port
end
- #
- # 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
+ def check_registry(v) # :nodoc:
+ raise InvalidURIError, "can not set registry"
end
private :check_registry
- # protected setter for the registry component +v+
- #
- # see also URI::Generic.registry=
- #
- def set_registry(v)
- @registry = v
+ def set_registry(v) #:nodoc:
+ raise InvalidURIError, "can not set registry"
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)
- check_registry(v)
- set_registry(v)
- v
+ raise InvalidURIError, "can not set registry"
end
#
@@ -874,42 +823,6 @@ 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+::
@@ -918,9 +831,6 @@ module URI
# == Description
#
# public setter for the query component +v+.
- # (with validation)
- #
- # see also URI::Generic.check_query
#
# == Usage
#
@@ -933,9 +843,17 @@ module URI
# #=> #<URI::HTTP:0x000000008e89e8 URL:http://my.example.com/?id=1>
#
def query=(v)
- check_query(v)
- set_query(v)
- 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){'%%%02X' % $&.ord}
+ v.force_encoding(Encoding::US_ASCII)
+ @query = v
end
#
@@ -994,27 +912,6 @@ 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
#
@@ -1026,8 +923,6 @@ module URI
# public setter for the fragment component +v+.
# (with validation)
#
- # see also URI::Generic.check_fragment
- #
# == Usage
#
# require 'uri'
@@ -1039,9 +934,16 @@ module URI
# #=> #<URI::HTTP:0x000000007a81f8 URL:http://my.example.com/?id=25#time=1305212086>
#
def fragment=(v)
- check_fragment(v)
- set_fragment(v)
- 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
end
#
@@ -1211,12 +1113,12 @@ module URI
# RFC2396, Section 5.2, 2)
if (rel.path.nil? || rel.path.empty?) && !authority && !rel.query
- base.set_fragment(rel.fragment) if rel.fragment
+ base.fragment=(rel.fragment) if rel.fragment
return base
end
- base.set_query(nil)
- base.set_fragment(nil)
+ base.query = nil
+ base.fragment=(nil)
# RFC2396, Section 5.2, 4)
if !authority
@@ -1230,8 +1132,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.set_query(rel.query) if rel.query
- base.set_fragment(rel.fragment) if rel.fragment
+ base.query = rel.query if rel.query
+ base.fragment=(rel.fragment) if rel.fragment
return base
end # merge
@@ -1318,7 +1220,7 @@ module URI
end
rel = URI::Generic.new(nil, # it is relative URI
self.userinfo, self.host, self.port,
- self.registry, self.path, self.opaque,
+ nil, self.path, self.opaque,
self.query, self.fragment, parser)
if rel.userinfo != oth.userinfo ||
@@ -1338,11 +1240,11 @@ module URI
if rel.path && rel.path == oth.path
rel.set_path('')
- rel.set_query(nil) if rel.query == oth.query
+ rel.query = nil if rel.query == oth.query
return rel, rel
elsif rel.opaque && rel.opaque == oth.opaque
rel.set_opaque('')
- rel.set_query(nil) if rel.query == oth.query
+ rel.query = nil if rel.query == oth.query
return rel, rel
end
@@ -1427,7 +1329,7 @@ module URI
# Destructive version of #normalize
#
def normalize!
- if path && path == ''
+ if path && path.empty?
set_path('/')
end
if scheme && scheme != scheme.downcase
@@ -1438,16 +1340,6 @@ 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
#
@@ -1455,40 +1347,36 @@ module URI
str = ''
if @scheme
str << @scheme
- str << ':'
+ str << ':'.freeze
end
if @opaque
str << @opaque
-
else
- 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
+ if @host
+ str << '//'.freeze
+ end
+ if self.userinfo
+ str << self.userinfo
+ str << '@'.freeze
+ end
+ if @host
+ str << @host
+ end
+ if @port && @port != self.default_port
+ str << ':'.freeze
+ str << @port.to_s
+ end
+ str << @path
+ if @query
+ str << '?'.freeze
+ str << @query
end
-
- str << path_query
end
-
if @fragment
- str << '#'
+ str << '#'.freeze
str << @fragment
end
-
str
end
diff --git a/lib/uri/http.rb b/lib/uri/http.rb
index 9877b1ee59..dc47613cdf 100644
--- a/lib/uri/http.rb
+++ b/lib/uri/http.rb
@@ -93,12 +93,12 @@ module URI
# Otherwise, the path is simply URI#path.
#
def request_uri
- r = path_query
- if r && r[0] != ?/
- r = '/' + r
+ return nil unless @path
+ if @path.start_with?(?/.freeze)
+ @query ? "#@path?#@query" : @path.dup
+ else
+ @query ? "/#@path?#@query" : "/#@path"
end
-
- r
end
end
diff --git a/lib/uri/mailto.rb b/lib/uri/mailto.rb
index 079340cf58..3499910787 100644
--- a/lib/uri/mailto.rb
+++ b/lib/uri/mailto.rb
@@ -12,7 +12,7 @@ require 'uri/generic'
module URI
#
- # RFC2368, The mailto URL scheme
+ # RFC6068, The mailto URL scheme
#
class MailTo < Generic
include REGEXP
@@ -37,28 +37,22 @@ module URI
#
# Within mailto URLs, the characters "?", "=", "&" are reserved.
- # 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
+ # ; 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/
# :startdoc:
#
@@ -91,31 +85,35 @@ module URI
def self.build(args)
tmp = Util::make_components_hash(self, args)
- if tmp[:to]
- tmp[:opaque] = tmp[:to]
+ case tmp[:to]
+ when Array
+ tmp[:opaque] = tmp[:to].join(',')
+ when String
+ tmp[:opaque] = tmp[:to].dup
else
tmp[:opaque] = ''
end
if tmp[:headers]
- 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
+ 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
end
end
@@ -137,19 +135,21 @@ module URI
@to = nil
@headers = []
- if MAILTO_REGEXP =~ @opaque
- if arg[-1]
- self.to = $1
- self.headers = $2
- else
- set_to($1)
- set_headers($2)
- end
-
- else
+ to, header = @opaque.split('?', 2)
+ # allow semicolon as a addr-spec separator
+ # http://support.microsoft.com/kb/820868
+ unless /\A(?:[^@,;]+@[^@,;]+(?:\z|[,;]))*\z/ =~ to
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
@@ -158,16 +158,25 @@ module URI
# E-mail headers set by the URL, as an Array of Arrays
attr_reader :headers
- # check the to +v+ component against either
- # * URI::Parser Regexp for :OPAQUE
- # * MAILBOX_PATTERN
+ # check the to +v+ component
def check_to(v)
return true unless v
return true if v.size == 0
- if parser.regexp[:OPAQUE] !~ v || /\A#{MAILBOX_PATTERN}*\z/o !~ v
- raise InvalidComponentError,
- "bad component(expected opaque component): #{v}"
+ 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
end
return true
@@ -188,14 +197,11 @@ module URI
end
# check the headers +v+ component against either
- # * URI::Parser Regexp for :OPAQUE
- # * HEADER_PATTERN
+ # * HEADER_REGEXP
def check_headers(v)
return true unless v
return true if v.size == 0
-
- if parser.regexp[:OPAQUE] !~ v ||
- /\A(#{HEADER_PATTERN}(?:\&#{HEADER_PATTERN})*)\z/o !~ v
+ if HEADER_REGEXP !~ v
raise InvalidComponentError,
"bad component(expected opaque component): #{v}"
end
@@ -208,8 +214,8 @@ module URI
def set_headers(v)
@headers = []
if v
- v.scan(HEADER_REGEXP) do |x|
- @headers << x.split(/=/o, 2)
+ v.split('&').each do |x|
+ @headers << x.split(/=/, 2)
end
end
end
diff --git a/lib/uri/rfc2396_parser.rb b/lib/uri/rfc2396_parser.rb
new file mode 100644
index 0000000000..50e3ae6973
--- /dev/null
+++ b/lib/uri/rfc2396_parser.rb
@@ -0,0 +1,543 @@
+#--
+# = 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 {|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
+end # module URI
diff --git a/lib/uri/rfc3986_parser.rb b/lib/uri/rfc3986_parser.rb
new file mode 100644
index 0000000000..965601c7b3
--- /dev/null
+++ b/lib/uri/rfc3986_parser.rb
@@ -0,0 +1,105 @@
+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>(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*))?(?:\#(?<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>(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*))?(?:\#(?<fragment>(?:%\h\h|[!$&-.0-;=@-Z_a-z~\/?])*))?)\z/
+
+ def split(uri) #:nodoc:
+ uri = uri.to_str
+ unless uri.ascii_only?
+ raise InvalidURIError, "URI must be ascii only #{uri.dump}"
+ end
+ if m = RFC3986_URI.match(uri)
+ ary = []
+ ary << m["scheme"]
+ if m["path-rootless"] # opaque
+ ary << nil # userinfo
+ ary << nil # host
+ ary << nil # port
+ ary << nil # registry
+ ary << nil # path
+ ary << m["path-rootless"]
+ ary[-1] << '?' << m["query"] if m["query"]
+ ary << nil # query
+ ary << m["fragment"]
+ else # normal
+ ary << m["userinfo"]
+ ary << m["host"]
+ ary << m["port"]
+ ary << nil # registry
+ ary << (m["path-abempty"] || m["path-absolute"] || m["path-empty"])
+ ary << nil # opaque
+ ary << m["query"]
+ ary << m["fragment"]
+ end
+ elsif m = RFC3986_relative_ref.match(uri)
+ ary = [nil]
+ ary << m["userinfo"]
+ ary << m["host"]
+ ary << m["port"]
+ ary << nil # registry
+ ary << (m["path-abempty"] || m["path-absolute"] || m["path-noscheme"] || m["path-empty"])
+ ary << nil # opaque
+ ary << m["query"]
+ ary << m["fragment"]
+ 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)
+
+ 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
+
+
+ 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
+
+ def regexp
+ {
+ 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
+
+ private
+
+ 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 dd2cee16aa..cdcbabf77c 100644
--- a/lib/weakref.rb
+++ b/lib/weakref.rb
@@ -16,7 +16,7 @@ require "delegate"
#
# == Example
#
-# With help from WeakRef, we can implement our own redimentary WeakHash class.
+# With help from WeakRef, we can implement our own rudimentary WeakHash class.
#
# We will call it WeakHash, since it's really just a Hash except all of it's
# keys and values can be garbage collected.
@@ -33,7 +33,7 @@ require "delegate"
# Hash#store to create a new WeakRef object with +key+ and +obj+ parameters
# before passing them as our key-value pair to the hash.
#
-# With this you will have to limit your self to String key's, otherwise you
+# With this you will have to limit your self to String keys, otherwise you
# will get an ArgumentError because WeakRef cannot create a finalizer for a
# Symbol. Symbols are immutable and cannot be garbage collected.
#
@@ -57,10 +57,10 @@ require "delegate"
# puts c.inspect
# #=> WeakRef::RefError: Invalid Reference - probably recycled
#
-# You can see the local variable +omg+ stayed, although it's reference in our
+# You can see the local variable +omg+ stayed, although its reference in our
# hash object was garbage collected, along with the rest of the keys and
-# values. Also, when we tried to inspect our hash, we got a WeakRef::RefError,
-# this is because these objects were also garbage collected.
+# values. Also, when we tried to inspect our hash, we got a WeakRef::RefError.
+# This is because these objects were also garbage collected.
class WeakRef < Delegator
@@ -101,17 +101,6 @@ class WeakRef < Delegator
# Returns true if the referenced object is still alive.
def weakref_alive?
- !!(@@__map[self] or defined?(@delegate_sd_obj))
+ @@__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 be6d314dd6..fd8522a6c5 100644
--- a/lib/webrick.rb
+++ b/lib/webrick.rb
@@ -8,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
@@ -42,7 +42,7 @@
# res.body = 'Hello, world!'
# end
#
-# Remember that <tt>server.mount_proc</tt> must <tt>server.start</tt>.
+# Remember that +server.mount_proc+ must precede +server.start+.
#
# == Servlets
#
diff --git a/lib/webrick/accesslog.rb b/lib/webrick/accesslog.rb
index 0a3c380406..4df27efc29 100644
--- a/lib/webrick/accesslog.rb
+++ b/lib/webrick/accesslog.rb
@@ -85,7 +85,7 @@ module WEBrick
# %q:: Request query string
# %r:: First line of the request
# %s:: Request status
- # %t:: Time the request was recieved
+ # %t:: Time the request was received
# %T:: Time taken to process the request
# %u:: Remote user from auth
# %U:: Unparsed URI
diff --git a/lib/webrick/compat.rb b/lib/webrick/compat.rb
index 33521f0a76..d2bc3ef6b4 100644
--- a/lib/webrick/compat.rb
+++ b/lib/webrick/compat.rb
@@ -9,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 compatability.
+# System call error module used by webrick for cross platform compatibility.
#
# EPROTO:: protocol error
# ECONNRESET:: remote host reset the connection request
diff --git a/lib/webrick/htmlutils.rb b/lib/webrick/htmlutils.rb
index ed901f1ce2..4cb3d0d7f6 100644
--- a/lib/webrick/htmlutils.rb
+++ b/lib/webrick/htmlutils.rb
@@ -15,12 +15,13 @@ module WEBrick
# Escapes &, ", > and < in +string+
def escape(string)
- str = string ? string.dup : ""
+ return "" unless string
+ str = string.b
str.gsub!(/&/n, '&amp;')
str.gsub!(/\"/n, '&quot;')
str.gsub!(/>/n, '&gt;')
str.gsub!(/</n, '&lt;')
- str
+ str.force_encoding(string.encoding)
end
module_function :escape
diff --git a/lib/webrick/httpauth/digestauth.rb b/lib/webrick/httpauth/digestauth.rb
index 78ad45b233..0eea94774f 100644
--- a/lib/webrick/httpauth/digestauth.rb
+++ b/lib/webrick/httpauth/digestauth.rb
@@ -204,7 +204,7 @@ module WEBrick
password = @userdb.get_passwd(@realm, auth_req['username'], @reload_db)
unless password
- error('%s: the user is not allowd.', auth_req['username'])
+ error('%s: the user is not allowed.', auth_req['username'])
return false
end
diff --git a/lib/webrick/httpauth/htdigest.rb b/lib/webrick/httpauth/htdigest.rb
index 4b74588c77..5fb0635e2a 100644
--- a/lib/webrick/httpauth/htdigest.rb
+++ b/lib/webrick/httpauth/htdigest.rb
@@ -70,13 +70,16 @@ module WEBrick
def flush(output=nil)
output ||= @path
- tmp = Tempfile.new("htpasswd", File::dirname(output))
+ tmp = Tempfile.create("htpasswd", File::dirname(output))
+ renamed = false
begin
each{|item| tmp.puts(item.join(":")) }
tmp.close
File::rename(tmp.path, output)
- rescue
- tmp.close(true)
+ renamed = true
+ ensure
+ tmp.close if !tmp.closed?
+ File.unlink(tmp.path) if !renamed
end
end
diff --git a/lib/webrick/httpauth/htpasswd.rb b/lib/webrick/httpauth/htpasswd.rb
index 205a6db2f0..69b739fbfe 100644
--- a/lib/webrick/httpauth/htpasswd.rb
+++ b/lib/webrick/httpauth/htpasswd.rb
@@ -75,13 +75,16 @@ module WEBrick
def flush(output=nil)
output ||= @path
- tmp = Tempfile.new("htpasswd", File::dirname(output))
+ tmp = Tempfile.create("htpasswd", File::dirname(output))
+ renamed = false
begin
each{|item| tmp.puts(item.join(":")) }
tmp.close
File::rename(tmp.path, output)
- rescue
- tmp.close(true)
+ renamed = true
+ ensure
+ tmp.close if !tmp.closed?
+ File.unlink(tmp.path) if !renamed
end
end
diff --git a/lib/webrick/httpproxy.rb b/lib/webrick/httpproxy.rb
index 7c34d33df0..cbba2d80f7 100644
--- a/lib/webrick/httpproxy.rb
+++ b/lib/webrick/httpproxy.rb
@@ -12,8 +12,6 @@
require "webrick/httpserver"
require "net/http"
-Net::HTTP::version_1_2 if RUBY_VERSION < "1.7"
-
module WEBrick
NullReader = Object.new # :nodoc:
@@ -203,7 +201,7 @@ module WEBrick
ua.syswrite(buf)
end
end
- rescue => ex
+ rescue
os.close
@logger.debug("CONNECT #{host}:#{port}: closed")
end
@@ -314,7 +312,7 @@ module WEBrick
http.start do
if @config[:ProxyTimeout]
################################## these issues are
- http.open_timeout = 30 # secs # necessary (maybe bacause
+ http.open_timeout = 30 # secs # necessary (maybe because
http.read_timeout = 60 # secs # Ruby's bug, but why?)
##################################
end
diff --git a/lib/webrick/httprequest.rb b/lib/webrick/httprequest.rb
index 10b9e6131e..4dfaee99af 100644
--- a/lib/webrick/httprequest.rb
+++ b/lib/webrick/httprequest.rb
@@ -359,7 +359,7 @@ module WEBrick
begin
body{|chunk| } # read remaining body
rescue HTTPStatus::Error => ex
- @logger.error("HTTPRequest#fixup: #{ex.class} occured.")
+ @logger.error("HTTPRequest#fixup: #{ex.class} occurred.")
@keep_alive = false
rescue => ex
@logger.error(ex)
@@ -369,7 +369,8 @@ module WEBrick
# This method provides the metavariables defined by the revision 3
# of "The WWW Common Gateway Interface Version 1.1"
- # http://Web.Golux.Com/coar/cgi/
+ # To browse the current document of CGI Version 1.1, see below:
+ # http://tools.ietf.org/html/rfc3875
def meta_vars
meta = Hash.new
diff --git a/lib/webrick/httpresponse.rb b/lib/webrick/httpresponse.rb
index 8e3eb39a31..e897e8c01b 100644
--- a/lib/webrick/httpresponse.rb
+++ b/lib/webrick/httpresponse.rb
@@ -47,7 +47,8 @@ module WEBrick
attr_accessor :reason_phrase
##
- # Body may be a String or IO subclass.
+ # Body may be a String or IO-like object that responds to #read and
+ # #readpartial.
attr_accessor :body
@@ -170,7 +171,7 @@ module WEBrick
end
##
- # Iterates over each header in the resopnse
+ # Iterates over each header in the response
def each
@header.each{|field, value| yield(field, value) }
@@ -299,9 +300,10 @@ module WEBrick
# Sends the body on +socket+
def send_body(socket) # :nodoc:
- case @body
- when IO then send_body_io(socket)
- else send_body_string(socket)
+ if @body.respond_to? :readpartial then
+ send_body_io(socket)
+ else
+ send_body_string(socket)
end
end
@@ -319,7 +321,7 @@ module WEBrick
# res.set_redirect WEBrick::HTTPStatus::TemporaryRedirect
def set_redirect(status, url)
- @body = "<HTML><A HREF=\"#{url.to_s}\">#{url.to_s}</A>.</HTML>\n"
+ @body = "<HTML><A HREF=\"#{url}\">#{url}</A>.</HTML>\n"
@header['location'] = url.to_s
raise status
end
diff --git a/lib/webrick/httpserver.rb b/lib/webrick/httpserver.rb
index 7a7b931dad..0618489c53 100644
--- a/lib/webrick/httpserver.rb
+++ b/lib/webrick/httpserver.rb
@@ -73,10 +73,10 @@ module WEBrick
timeout = @config[:RequestTimeout]
while timeout > 0
break if IO.select([sock], nil, nil, 0.5)
- timeout = 0 if @status != :Running
+ break if @status != :Running
timeout -= 0.5
end
- raise HTTPStatus::EOFError if timeout <= 0
+ raise HTTPStatus::EOFError if timeout <= 0 || @status != :Running
raise HTTPStatus::EOFError if sock.eof?
req.parse(sock)
res.request_method = req.request_method
diff --git a/lib/webrick/httpservlet/cgihandler.rb b/lib/webrick/httpservlet/cgihandler.rb
index 7c012ca64b..32100418e6 100644
--- a/lib/webrick/httpservlet/cgihandler.rb
+++ b/lib/webrick/httpservlet/cgihandler.rb
@@ -41,9 +41,6 @@ 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")
diff --git a/lib/webrick/httpservlet/erbhandler.rb b/lib/webrick/httpservlet/erbhandler.rb
index 34b4b9e68b..1b8a82d67b 100644
--- a/lib/webrick/httpservlet/erbhandler.rb
+++ b/lib/webrick/httpservlet/erbhandler.rb
@@ -56,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 => ex
+ rescue StandardError
raise
rescue Exception => ex
@logger.error(ex)
diff --git a/lib/webrick/httpservlet/filehandler.rb b/lib/webrick/httpservlet/filehandler.rb
index d8c66dfdc3..cc9db4a870 100644
--- a/lib/webrick/httpservlet/filehandler.rb
+++ b/lib/webrick/httpservlet/filehandler.rb
@@ -424,11 +424,18 @@ module WEBrick
}
list.compact!
- if d0 = req.query["N"]; idx = 0
- elsif d0 = req.query["M"]; idx = 1
- elsif d0 = req.query["S"]; idx = 2
- else d0 = "A" ; idx = 0
+ query = req.query
+
+ d0 = nil
+ idx = nil
+ %w[N M S].each_with_index do |q, i|
+ if d = query.delete(q)
+ idx ||= i
+ d0 ||= d
+ end
end
+ d0 ||= "A"
+ idx ||= 0
d1 = (d0 == "A") ? "D" : "A"
if d0 == "A"
@@ -437,38 +444,66 @@ module WEBrick
list.sort!{|a,b| b[idx] <=> a[idx] }
end
- res['content-type'] = "text/html"
+ namewidth = query["NameWidth"]
+ if namewidth == "*"
+ namewidth = nil
+ elsif !namewidth or (namewidth = namewidth.to_i) < 2
+ namewidth = 25
+ end
+ query = query.inject('') {|s, (k, v)| s << '&' << HTMLUtils::escape("#{k}=#{v}")}
+
+ type = "text/html"
+ case enc = Encoding.find('filesystem')
+ when Encoding::US_ASCII, Encoding::ASCII_8BIT
+ else
+ type << "; charset=\"#{enc.name}\""
+ end
+ res['content-type'] = type
+ title = "Index of #{HTMLUtils::escape(req.path)}"
res.body = <<-_end_of_html_
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
- <HEAD><TITLE>Index of #{HTMLUtils::escape(req.path)}</TITLE></HEAD>
+ <HEAD>
+ <TITLE>#{title}</TITLE>
+ <style type="text/css">
+ <!--
+ .name, .mtime { text-align: left; }
+ .size { text-align: right; }
+ td { text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
+ table { border-collapse: collapse; }
+ tr th { border-bottom: 2px groove; }
+ //-->
+ </style>
+ </HEAD>
<BODY>
- <H1>Index of #{HTMLUtils::escape(req.path)}</H1>
+ <H1>#{title}</H1>
_end_of_html_
- res.body << "<PRE>\n"
- res.body << " <A HREF=\"?N=#{d1}\">Name</A> "
- res.body << "<A HREF=\"?M=#{d1}\">Last modified</A> "
- res.body << "<A HREF=\"?S=#{d1}\">Size</A>\n"
- res.body << "<HR>\n"
+ res.body << "<TABLE width=\"100%\"><THEAD><TR>\n"
+ res.body << "<TH class=\"name\"><A HREF=\"?N=#{d1}#{query}\">Name</A></TH>"
+ res.body << "<TH class=\"mtime\"><A HREF=\"?M=#{d1}#{query}\">Last modified</A></TH>"
+ res.body << "<TH class=\"size\"><A HREF=\"?S=#{d1}#{query}\">Size</A></TH>\n"
+ 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 == ".."
dname = "Parent Directory"
- elsif name.bytesize > 25
- dname = name.sub(/^(.{23})(?:.*)/, '\1..')
+ elsif namewidth and name.size > namewidth
+ dname = name[0...(namewidth - 2)] << '..'
else
dname = name
end
- s = " <A HREF=\"#{HTTPUtils::escape(name)}\">#{HTMLUtils::escape(dname)}</A>"
- s << " " * (30 - dname.bytesize)
- s << (time ? time.strftime("%Y/%m/%d %H:%M ") : " " * 22)
- s << (size >= 0 ? size.to_s : "-") << "\n"
+ s = "<TR><TD class=\"name\"><A HREF=\"#{HTTPUtils::escape(name)}#{query if name.end_with?('/')}\">#{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
}
- res.body << "</PRE><HR>"
+ res.body << "</TBODY></TABLE>"
+ res.body << "<HR>"
res.body << <<-_end_of_html_
<ADDRESS>
diff --git a/lib/webrick/httpstatus.rb b/lib/webrick/httpstatus.rb
index afc8e75a47..78abb1bf12 100644
--- a/lib/webrick/httpstatus.rb
+++ b/lib/webrick/httpstatus.rb
@@ -39,7 +39,7 @@ module WEBrick
# Root of the HTTP info statuses
class Info < Status; end
- # Root of the HTTP sucess statuses
+ # Root of the HTTP success 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 a0ca3a48c7..a5f0632b86 100644
--- a/lib/webrick/httputils.rb
+++ b/lib/webrick/httputils.rb
@@ -437,8 +437,18 @@ module WEBrick
def _make_regex(str) /([#{Regexp.escape(str)}])/n end
def _make_regex!(str) /([^#{Regexp.escape(str)}])/n end
- def _escape(str, regex) str.gsub(regex){ "%%%02X" % $1.ord } end
- def _unescape(str, regex) str.gsub(regex){ $1.hex.chr } end
+ def _escape(str, regex)
+ str = str.b
+ str.gsub!(regex) {"%%%02X" % $1.ord}
+ # %-escaped string should contain US-ASCII only
+ str.force_encoding(Encoding::US_ASCII)
+ end
+ def _unescape(str, regex)
+ str = str.b
+ str.gsub!(regex) {$1.hex.chr}
+ # encoding of %-unescaped string is unknown
+ str
+ end
UNESCAPED = _make_regex(control+space+delims+unwise+nonascii)
UNESCAPED_FORM = _make_regex(reserved+control+delims+unwise+nonascii)
diff --git a/lib/webrick/server.rb b/lib/webrick/server.rb
index 3f5371ba47..7a3632b0b5 100644
--- a/lib/webrick/server.rb
+++ b/lib/webrick/server.rb
@@ -115,6 +115,7 @@ module WEBrick
@config[:Port] = @listeners[0].addr[1]
end
end
+ @shutdown_pipe_w = nil
end
##
@@ -157,6 +158,9 @@ module WEBrick
raise ServerError, "already started." if @status != :Stop
server_type = @config[:ServerType] || SimpleServer
+ shutdown_pipe_r, shutdown_pipe_w = IO.pipe
+ @shutdown_pipe_w = shutdown_pipe_w
+
server_type.start{
@logger.info \
"#{self.class}#start: pid=#{$$} port=#{@config[:Port]}"
@@ -167,7 +171,10 @@ module WEBrick
begin
while @status == :Running
begin
- if svrs = IO.select(@listeners, nil, nil, 2.0)
+ if svrs = IO.select([shutdown_pipe_r, *@listeners], nil, nil, 2.0)
+ if svrs[0].include? shutdown_pipe_r
+ return
+ end
svrs[0].each{|svr|
@tokens.pop # blocks while no token is there.
if sock = accept_client(svr)
@@ -180,7 +187,7 @@ module WEBrick
end
}
end
- rescue Errno::EBADF, IOError => ex
+ rescue Errno::EBADF, Errno::ENOTSOCK, IOError => ex
# if the listening socket was closed in GenericServer#shutdown,
# IO::select raise it.
rescue StandardError => ex
@@ -193,6 +200,14 @@ module WEBrick
end
ensure
+ shutdown_pipe_r.close
+ if !shutdown_pipe_w.closed?
+ begin
+ shutdown_pipe_w.close
+ rescue IOError # Another thread closed shutdown_pipe_w.
+ end
+ end
+ @shutdown_pipe_w = nil
@status = :Shutdown
@logger.info "going to shutdown ..."
thgroup.list.each{|th| th.join if th[:WEBrickThread] }
@@ -218,6 +233,16 @@ module WEBrick
def shutdown
stop
+
+ shutdown_pipe_w = @shutdown_pipe_w
+ @shutdown_pipe_w = nil
+ if shutdown_pipe_w && !shutdown_pipe_w.closed?
+ begin
+ shutdown_pipe_w.close
+ rescue IOError # Another thread closed shutdown_pipe_w.
+ end
+ end
+
@listeners.each{|s|
if @logger.debug?
addr = s.addr
@@ -263,7 +288,7 @@ module WEBrick
Utils::set_non_blocking(sock)
Utils::set_close_on_exec(sock)
rescue Errno::ECONNRESET, Errno::ECONNABORTED,
- Errno::EPROTO, Errno::EINVAL => ex
+ Errno::EPROTO, Errno::EINVAL
rescue StandardError => ex
msg = "#{ex.class}: #{ex.message}\n\t#{ex.backtrace[0]}"
@logger.error msg
diff --git a/lib/webrick/ssl.rb b/lib/webrick/ssl.rb
index cf0f3ddb23..5e296dbae2 100644
--- a/lib/webrick/ssl.rb
+++ b/lib/webrick/ssl.rb
@@ -31,7 +31,7 @@ module WEBrick
# :SSLClientCA :: nil,
# Array of certificates that will be sent to the client.
# :SSLExtraChainCert :: nil,
- # Array of certificates that willbe added to the certificate chain
+ # Array of certificates that will be added to the certificate chain
# :SSLCACertificateFile :: nil,
# Path to a CA certificate file
# :SSLCACertificatePath :: nil,
diff --git a/lib/webrick/utils.rb b/lib/webrick/utils.rb
index f2373572ce..606ede5ac3 100644
--- a/lib/webrick/utils.rb
+++ b/lib/webrick/utils.rb
@@ -10,11 +10,7 @@
require 'socket'
require 'fcntl'
-begin
- require 'etc'
-rescue LoadError
- nil
-end
+require 'etc'
module WEBrick
module Utils
@@ -41,8 +37,7 @@ module WEBrick
##
# Changes the process's uid and gid to the ones of +user+
def su(user)
- if defined?(Etc)
- pw = Etc.getpwnam(user)
+ if pw = Etc.getpwnam(user)
Process::initgroups(user, pw.gid)
Process::Sys::setgid(pw.gid)
Process::Sys::setuid(pw.uid)
@@ -72,26 +67,13 @@ module WEBrick
unless port
raise ArgumentError, "must specify port"
end
- res = Socket::getaddrinfo(address, port,
- Socket::AF_UNSPEC, # address family
- Socket::SOCK_STREAM, # socket type
- 0, # protocol
- Socket::AI_PASSIVE) # flag
- last_error = nil
- sockets = []
- res.each{|ai|
- begin
- logger.debug("TCPServer.new(#{ai[3]}, #{port})") if logger
- sock = TCPServer.new(ai[3], port)
- port = sock.addr[1] if port == 0
- Utils::set_close_on_exec(sock)
- sockets << sock
- rescue => ex
- logger.warn("TCPServer Error: #{ex}") if logger
- last_error = ex
- end
+ sockets = Socket.tcp_server_sockets(address, port)
+ sockets = sockets.map {|s|
+ s.autoclose = false
+ ts = TCPServer.for_fd(s.fileno)
+ s.close
+ ts
}
- raise last_error if sockets.empty?
return sockets
end
module_function :create_listeners
@@ -147,6 +129,8 @@ module WEBrick
class TimeoutHandler
include Singleton
+ class Thread < ::Thread; end
+
##
# Mutex used to synchronize access across threads
TimeoutMutex = Mutex.new # :nodoc:
diff --git a/lib/xmlrpc.rb b/lib/xmlrpc.rb
index d8208d02a8..511c57d269 100644
--- a/lib/xmlrpc.rb
+++ b/lib/xmlrpc.rb
@@ -30,7 +30,7 @@
#
# == Documentation
#
-# See http://www.ntecs.de/projects/xmlrpc4r. There is plenty of detail there to
+# See http://www.ntecs.de/ruby/xmlrpc4r/. There is plenty of detail there to
# use the client and implement a server.
#
# == Features of XMLRPC for Ruby
@@ -48,7 +48,7 @@
#
# * Client
# * synchronous/asynchronous calls
-# * Basic HTTP-401 Authentification
+# * Basic HTTP-401 Authentication
# * HTTPS protocol (SSL)
#
# * Parsers
diff --git a/lib/xmlrpc/client.rb b/lib/xmlrpc/client.rb
index c1c2da054c..aab07a7f95 100644
--- a/lib/xmlrpc/client.rb
+++ b/lib/xmlrpc/client.rb
@@ -77,8 +77,6 @@ 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)
@@ -188,6 +186,13 @@ module XMLRPC # :nodoc:
end
+ # Returns the Net::HTTP object for the client. If you want to
+ # change HTTP client options except header, cookie, timeout,
+ # user and password, use Net::HTTP directly.
+ #
+ # Since 2.1.0.
+ attr_reader :http
+
# Add additional HTTP headers to the request
attr_accessor :http_header_extra
@@ -240,7 +245,7 @@ module XMLRPC # :nodoc:
# * Date, Time, XMLRPC::DateTime
# * XMLRPC::Base64
# * A Ruby object which class includes XMLRPC::Marshallable
- # (only if Config::ENABLE_MARSHALLABLE is +true+).
+ # (only if Config::ENABLE_MARSHALLING 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.
@@ -469,7 +474,7 @@ module XMLRPC # :nodoc:
}
else
# reuse the HTTP object for each call => connection alive is possible
- # we must start connection explicitely first time so that http.request
+ # we must start connection explicitly first time so that http.request
# does not assume that we don't want keepalive
@http.start if not @http.started?
@@ -502,22 +507,29 @@ 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
- set_cookies = resp.get_fields("Set-Cookie")
- if set_cookies and !set_cookies.empty?
- require 'webrick/cookie'
- @cookie = set_cookies.collect do |set_cookie|
- cookie = WEBrick::Cookie.parse_set_cookie(set_cookie)
- WEBrick::Cookie.new(cookie.name, cookie.value).to_s
- end.join("; ")
- end
+ parse_set_cookies(resp.get_fields("Set-Cookie"))
return data
end
+ def parse_set_cookies(set_cookies)
+ return if set_cookies.nil?
+ return if set_cookies.empty?
+ require 'webrick/cookie'
+ pairs = {}
+ set_cookies.each do |set_cookie|
+ cookie = WEBrick::Cookie.parse_set_cookie(set_cookie)
+ pairs.delete(cookie.name)
+ pairs[cookie.name] = cookie.value
+ end
+ cookies = pairs.collect do |name, value|
+ WEBrick::Cookie.new(name, value).to_s
+ end
+ @cookie = cookies.join("; ")
+ end
+
def gen_multicall(methods=[], async=false)
meth = :call2
meth = :call2_async if async
diff --git a/lib/xmlrpc/config.rb b/lib/xmlrpc/config.rb
index 0213bef2a6..98081473b4 100644
--- a/lib/xmlrpc/config.rb
+++ b/lib/xmlrpc/config.rb
@@ -27,7 +27,7 @@ module XMLRPC # :nodoc:
# allows integers greater than 32-bit if +true+
ENABLE_BIGINT = false
- # enable marshalling ruby objects which include XMLRPC::Marshallable
+ # enable marshalling Ruby objects which include XMLRPC::Marshallable
ENABLE_MARSHALLING = true
# enable multiCall extension by default
diff --git a/lib/xmlrpc/datetime.rb b/lib/xmlrpc/datetime.rb
index dff2304f92..444a29f176 100644
--- a/lib/xmlrpc/datetime.rb
+++ b/lib/xmlrpc/datetime.rb
@@ -9,7 +9,7 @@ require "date"
module XMLRPC # :nodoc:
# This class is important to handle XMLRPC +dateTime.iso8601+ values,
-# correcly, because normal UNIX-dates, ie: Date, only handle dates
+# correctly, 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
deleted file mode 100644
index dd0d7417c1..0000000000
--- a/lib/xmlrpc/httpserver.rb
+++ /dev/null
@@ -1,173 +0,0 @@
-# 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/server.rb b/lib/xmlrpc/server.rb
index 839353da1a..64856ea1fa 100644
--- a/lib/xmlrpc/server.rb
+++ b/lib/xmlrpc/server.rb
@@ -50,7 +50,7 @@ class BasicServer
# method should be called from a subclass indirectly by a +super+ call
# in the initialize method.
#
- # The paramter +class_delim+ is used by add_handler, see
+ # The parameter +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=".")
@@ -430,7 +430,7 @@ class CGIServer < BasicServer
</head>
<body>
<h1>#{err}</h1>
- <p>Unexpected error occured while processing XML-RPC request!</p>
+ <p>Unexpected error occurred while processing XML-RPC request!</p>
</body>
</html>
MSGEND
@@ -505,7 +505,7 @@ class ModRubyServer < BasicServer
</head>
<body>
<h1>#{err}</h1>
- <p>Unexpected error occured while processing XML-RPC request!</p>
+ <p>Unexpected error occurred while processing XML-RPC request!</p>
</body>
</html>
MSGEND
diff --git a/lib/yaml.rb b/lib/yaml.rb
index 6f60f9d7c5..c0ffcf877b 100644
--- a/lib/yaml.rb
+++ b/lib/yaml.rb
@@ -1,5 +1,5 @@
##
-# The YAML module is an alias of Psych, the YAML engine for ruby.
+# The YAML module is an alias of Psych, the YAML engine for Ruby.
begin
require 'psych'
@@ -10,41 +10,7 @@ rescue LoadError
raise
end
-YAML = Psych
-
-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 = Psych # :nodoc:
# YAML Ain't Markup Language
#
@@ -56,7 +22,7 @@ end
#
# Working with YAML can be very simple, for example:
#
-# require 'yaml' # STEP ONE, REQUIRE YAML!
+# require 'yaml'
# # Parse a YAML string
# YAML.load("--- foo") #=> "foo"
#
@@ -85,5 +51,9 @@ end
#
# For more advanced details on the implementation see Psych, and also check out
# http://yaml.org for spec details and other helpful information.
+#
+# Pysch 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 976fdb3bb6..24a68bfa71 100644
--- a/lib/yaml/dbm.rb
+++ b/lib/yaml/dbm.rb
@@ -15,34 +15,43 @@ module YAML
#
# See the documentation for ::DBM and ::YAML for more information.
class DBM < ::DBM
- VERSION = "0.1"
+ VERSION = "0.1" # :nodoc:
+ # :call-seq:
+ # ydbm[key] -> value
+ #
# Return value associated with +key+ from database.
#
# Returns +nil+ if there is no such +key+.
+ #
+ # See #fetch for more information.
def []( key )
fetch( key )
end
# :call-seq:
- # []=( key, value )
+ # ydbm[key] = value
#
# Set +key+ to +value+ in database.
#
# +value+ will be converted to YAML before storage.
+ #
+ # See #store for more information.
def []=( key, val )
store( key, val )
end
# :call-seq:
- # fetch( key, ifnone = nil )
- # fetch( key, &block )
+ # ydbm.fetch( key, ifnone = nil )
+ # ydbm.fetch( key ) { |key| ... }
#
# Return value associated with +key+.
#
# If there is no value for +key+ and no block is given, returns +ifnone+.
#
# Otherwise, calls block passing in the given +key+.
+ #
+ # See ::DBM#fetch for more information.
def fetch( keystr, ifnone = nil )
begin
val = super( keystr )
@@ -67,15 +76,25 @@ class DBM < ::DBM
super( keystr.to_yaml )
end
+ # :call-seq:
+ # ydbm.key(value) -> string
+ #
+ # Returns the key for the specified value.
def key( keystr )
invert[keystr]
end
+ # :call-seq:
+ # ydbm.values_at(*keys)
+ #
# Returns an array containing the values associated with the given keys.
def values_at( *keys )
keys.collect { |k| fetch( k ) }
end
+ # :call-seq:
+ # ydbm.delete(key)
+ #
# Deletes value from database associated with +key+.
#
# Returns value or +nil+.
@@ -87,6 +106,9 @@ class DBM < ::DBM
v
end
+ # :call-seq:
+ # ydbm.delete_if { |key, value| ... }
+ #
# Calls the given block once for each +key+, +value+ pair in the database.
# Deletes all entries for which the block returns true.
#
@@ -98,6 +120,9 @@ class DBM < ::DBM
self
end
+ # :call-seq:
+ # ydbm.reject { |key, value| ... }
+ #
# Converts the contents of the database to an in-memory Hash, then calls
# Hash#reject with the specified code block, returning a new Hash.
def reject
@@ -105,6 +130,9 @@ class DBM < ::DBM
hsh.reject { |k,v| yield k, v }
end
+ # :call-seq:
+ # ydbm.each_pair { |key, value| ... }
+ #
# Calls the given block once for each +key+, +value+ pair in the database.
#
# Returns +self+.
@@ -113,6 +141,9 @@ class DBM < ::DBM
self
end
+ # :call-seq:
+ # ydbm.each_value { |value| ... }
+ #
# Calls the given block for each value in database.
#
# Returns +self+.
@@ -121,17 +152,26 @@ class DBM < ::DBM
self
end
+ # :call-seq:
+ # ydbm.values
+ #
# Returns an array of values from the database.
def values
super.collect { |v| YAML.load( v ) }
end
- # Returns true if specified value is found in the database.
+ # :call-seq:
+ # ydbm.has_value?(value)
+ #
+ # Returns true if specified +value+ is found in the database.
def has_value?( val )
each_value { |v| return true if v == val }
return false
end
+ # :call-seq:
+ # ydbm.invert -> hash
+ #
# Returns a Hash (not a DBM database) created by using each value in the
# database as a key, with the corresponding key as its value.
#
@@ -143,6 +183,9 @@ class DBM < ::DBM
h
end
+ # :call-seq:
+ # ydbm.replace(hash) -> ydbm
+ #
# Replaces the contents of the database with the contents of the specified
# object. Takes any object which implements the each_pair method, including
# Hash and DBM objects.
@@ -151,6 +194,9 @@ class DBM < ::DBM
update( hsh )
end
+ # :call-seq:
+ # ydbm.shift -> [key, value]
+ #
# Removes a [key, value] pair from the database, and returns it.
# If the database is empty, returns +nil+.
#
@@ -162,8 +208,8 @@ class DBM < ::DBM
end
# :call-seq:
- # select( &block )
- # select( *keys )
+ # ydbm.select { |key, value| ... }
+ # ydbm.select(*keys)
#
# If a block is provided, returns a new array containing [key, value] pairs
# for which the block returns true.
@@ -178,17 +224,20 @@ class DBM < ::DBM
end
# :call-seq:
- # store( key, value )
+ # ydbm.store(key, value) -> value
#
- #Stores +value+ in database with +key+ as the index. +value+ is converted
- #to YAML before being stored.
+ # Stores +value+ in database with +key+ as the index. +value+ is converted
+ # to YAML before being stored.
#
- #Returns +value+
+ # Returns +value+
def store( key, val )
super( key, val.to_yaml )
val
end
+ # :call-seq:
+ # ydbm.update(hash) -> ydbm
+ #
# Updates the database with multiple values from the specified object.
# Takes any object which implements the each_pair method, including
# Hash and DBM objects.
@@ -201,6 +250,9 @@ class DBM < ::DBM
self
end
+ # :call-seq:
+ # ydbm.to_a -> array
+ #
# Converts the contents of the database to an array of [key, value] arrays,
# and returns it.
def to_a
@@ -210,6 +262,9 @@ class DBM < ::DBM
end
+ # :call-seq:
+ # ydbm.to_hash -> hash
+ #
# Converts the contents of the database to an in-memory Hash object, and
# returns it.
def to_hash
diff --git a/load.c b/load.c
index 806c65374b..e88abfbb0c 100644
--- a/load.c
+++ b/load.c
@@ -12,8 +12,6 @@
VALUE ruby_dln_librefs;
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
-
#define IS_RBEXT(e) (strcmp((e), ".rb") == 0)
#define IS_SOEXT(e) (strcmp((e), ".so") == 0 || strcmp((e), ".o") == 0)
#ifdef DLEXT2
@@ -64,7 +62,7 @@ rb_construct_expanded_load_path(int type, int *has_relative, int *has_non_cache)
VALUE path, as_str, expanded_path;
int is_string, non_cache;
char *as_cstr;
- as_str = path = RARRAY_PTR(load_path)[i];
+ as_str = path = RARRAY_AREF(load_path, i);
is_string = RB_TYPE_P(path, T_STRING) ? 1 : 0;
non_cache = !is_string ? 1 : 0;
as_str = rb_get_path_check_to_string(path, level);
@@ -77,7 +75,7 @@ rb_construct_expanded_load_path(int type, int *has_relative, int *has_non_cache)
(!as_cstr[0] || as_cstr[0] != '~')) ||
(type == EXPAND_NON_CACHE)) {
/* Use cached expanded path. */
- rb_ary_push(ary, RARRAY_PTR(expanded_load_path)[i]);
+ rb_ary_push(ary, RARRAY_AREF(expanded_load_path, i));
continue;
}
}
@@ -205,7 +203,8 @@ 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 = rb_ary_tmp_new(numberof(feature_indexes));
+ this_feature_index = (VALUE)xcalloc(1, sizeof(struct RArray));
+ RBASIC(this_feature_index)->flags = T_ARRAY; /* fake VALUE, do not mark/sweep */
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);
}
@@ -265,6 +264,11 @@ 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;
}
@@ -339,7 +343,7 @@ loaded_feature_path(const char *name, long vlen, const char *feature, long len,
if (plen > 0) --plen; /* exclude '.' */
for (i = 0; i < RARRAY_LEN(load_path); ++i) {
- VALUE p = RARRAY_PTR(load_path)[i];
+ VALUE p = RARRAY_AREF(load_path, i);
const char *s = StringValuePtr(p);
long n = RSTRING_LEN(p);
@@ -421,40 +425,42 @@ rb_feature_p(const char *feature, const char *ext, int rb, int expanded, const c
or ends in '/'. This includes both match forms above, as well
as any distractors, so we may ignore all other entries in `features`.
*/
- for (i = 0; !NIL_P(this_feature_index); i++) {
- VALUE entry;
- long index;
- if (RB_TYPE_P(this_feature_index, T_ARRAY)) {
- if (i >= RARRAY_LEN(this_feature_index)) break;
- entry = RARRAY_PTR(this_feature_index)[i];
- }
- else {
- if (i > 0) break;
- entry = this_feature_index;
- }
- index = FIX2LONG(entry);
-
- v = RARRAY_PTR(features)[index];
- f = StringValuePtr(v);
- if ((n = RSTRING_LEN(v)) < len) continue;
- if (strncmp(f, feature, len) != 0) {
- if (expanded) continue;
- if (!load_path) load_path = rb_get_expanded_load_path();
- if (!(p = loaded_feature_path(f, n, feature, len, type, load_path)))
- continue;
- expanded = 1;
- f += RSTRING_LEN(p) + 1;
- }
- if (!*(e = f + len)) {
- if (ext) continue;
- return 'u';
- }
- if (*e != '.') continue;
- if ((!rb || !ext) && (IS_SOEXT(e) || IS_DLEXT(e))) {
- return 's';
- }
- if ((rb || !ext) && (IS_RBEXT(e))) {
- return 'r';
+ if (!NIL_P(this_feature_index)) {
+ for (i = 0; ; i++) {
+ VALUE entry;
+ long index;
+ if (RB_TYPE_P(this_feature_index, T_ARRAY)) {
+ if (i >= RARRAY_LEN(this_feature_index)) break;
+ entry = RARRAY_AREF(this_feature_index, i);
+ }
+ else {
+ if (i > 0) break;
+ entry = this_feature_index;
+ }
+ index = FIX2LONG(entry);
+
+ v = RARRAY_AREF(features, index);
+ f = StringValuePtr(v);
+ if ((n = RSTRING_LEN(v)) < len) continue;
+ if (strncmp(f, feature, len) != 0) {
+ if (expanded) continue;
+ if (!load_path) load_path = rb_get_expanded_load_path();
+ if (!(p = loaded_feature_path(f, n, feature, len, type, load_path)))
+ continue;
+ expanded = 1;
+ f += RSTRING_LEN(p) + 1;
+ }
+ if (!*(e = f + len)) {
+ if (ext) continue;
+ return 'u';
+ }
+ if (*e != '.') continue;
+ if ((!rb || !ext) && (IS_SOEXT(e) || IS_DLEXT(e))) {
+ return 's';
+ }
+ if ((rb || !ext) && (IS_RBEXT(e))) {
+ return 'r';
+ }
}
}
@@ -570,23 +576,21 @@ rb_provide(const char *feature)
NORETURN(static void load_failed(VALUE));
-static void
-rb_load_internal(VALUE fname, int wrap)
+static inline void
+rb_load_internal0(rb_thread_t *th, VALUE fname, int wrap)
{
int state;
- rb_thread_t *th = GET_THREAD();
volatile VALUE wrapper = th->top_wrapper;
volatile VALUE self = th->top_self;
volatile int loaded = FALSE;
volatile int mild_compile_error;
-#ifndef __GNUC__
+#if !defined __GNUC__
rb_thread_t *volatile th0 = th;
#endif
th->errinfo = Qnil; /* ensure */
if (!wrap) {
- rb_secure(4); /* should alter global state */
th->top_wrapper = 0;
}
else {
@@ -604,7 +608,7 @@ rb_load_internal(VALUE fname, int wrap)
VALUE iseq;
th->mild_compile_error++;
- node = (NODE *)rb_load_file(RSTRING_PTR(fname));
+ 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--;
@@ -612,7 +616,7 @@ rb_load_internal(VALUE fname, int wrap)
}
POP_TAG();
-#ifndef __GNUC__
+#if !defined __GNUC__
th = th0;
fname = RB_GC_GUARD(fname);
#endif
@@ -620,20 +624,26 @@ rb_load_internal(VALUE fname, int wrap)
th->top_self = self;
th->top_wrapper = wrapper;
- if (!loaded && !FIXNUM_P(GET_THREAD()->errinfo)) {
+ if (!loaded && !FIXNUM_P(th->errinfo)) {
/* an error on loading don't include INT2FIX(TAG_FATAL) see r35625 */
- rb_exc_raise(GET_THREAD()->errinfo);
+ rb_exc_raise(th->errinfo);
}
if (state) {
rb_vm_jump_tag_but_local_jump(state);
}
- if (!NIL_P(GET_THREAD()->errinfo)) {
+ if (!NIL_P(th->errinfo)) {
/* exception during load */
rb_exc_raise(th->errinfo);
}
}
+static void
+rb_load_internal(VALUE fname, int wrap)
+{
+ rb_load_internal0(GET_THREAD(), fname, wrap);
+}
+
void
rb_load(VALUE fname, int wrap)
{
@@ -727,8 +737,7 @@ load_lock(const char *ftptr)
}
if (RTEST(ruby_verbose)) {
rb_warning("loading in progress, circular require considered harmful - %s", ftptr);
- /* TODO: display to $stderr, not stderr in C */
- rb_backtrace();
+ rb_backtrace_print_to(rb_stderr);
}
switch (rb_thread_shield_wait((VALUE)data)) {
case Qfalse:
@@ -965,7 +974,8 @@ rb_require_safe(VALUE fname, int safe)
rb_sourceline());
}
- found = search_required(fname, &path, safe);
+ path = rb_str_encode_ospath(fname);
+ found = search_required(path, &path, safe);
if (RUBY_DTRACE_FIND_REQUIRE_RETURN_ENABLED()) {
RUBY_DTRACE_FIND_REQUIRE_RETURN(StringValuePtr(fname),
@@ -1039,6 +1049,7 @@ register_init_ext(st_data_t *key, st_data_t *value, st_data_t init, int existing
else {
*value = (st_data_t)NEW_MEMO(init, 0, 0);
*key = (st_data_t)ruby_strdup(name);
+ (*(void (*)(void))init)();
}
return ST_CONTINUE;
}
@@ -1048,10 +1059,13 @@ 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);
+ rb_provide(name);
}
/*
diff --git a/loadpath.c b/loadpath.c
new file mode 100644
index 0000000000..9160031971
--- /dev/null
+++ b/loadpath.c
@@ -0,0 +1,92 @@
+/**********************************************************************
+
+ loadpath.c -
+
+ $Author$
+ created at: Wed May 15 14:19:50 JST 2013
+
+ Copyright (C) 2013 Yukihiro Matsumoto
+
+**********************************************************************/
+
+#include "verconf.h"
+#include "ruby/ruby.h"
+
+/* Define RUBY_REVISION to avoid revision.h inclusion via version.h. */
+#define RUBY_REVISION 0
+#include "version.h"
+
+#ifndef RUBY_ARCH
+#define RUBY_ARCH RUBY_PLATFORM
+#endif
+#ifndef RUBY_SITEARCH
+#define RUBY_SITEARCH RUBY_ARCH
+#endif
+#ifdef RUBY_PLATFORM_CPU
+#define RUBY_THINARCH RUBY_PLATFORM_CPU"-"RUBY_PLATFORM_OS
+#endif
+#ifndef RUBY_LIB_PREFIX
+#ifndef RUBY_EXEC_PREFIX
+#error RUBY_EXEC_PREFIX must be defined
+#endif
+#define RUBY_LIB_PREFIX RUBY_EXEC_PREFIX"/lib/ruby"
+#endif
+#ifndef RUBY_SITE_LIB
+#define RUBY_SITE_LIB RUBY_LIB_PREFIX"/site_ruby"
+#endif
+#ifndef RUBY_VENDOR_LIB
+#define RUBY_VENDOR_LIB RUBY_LIB_PREFIX"/vendor_ruby"
+#endif
+
+typedef char ruby_lib_version_string[(int)sizeof(RUBY_LIB_VERSION) - 2];
+
+#ifndef RUBY_LIB
+#define RUBY_LIB RUBY_LIB_PREFIX "/"RUBY_LIB_VERSION
+#endif
+#define RUBY_SITE_LIB2 RUBY_SITE_LIB "/"RUBY_LIB_VERSION
+#define RUBY_VENDOR_LIB2 RUBY_VENDOR_LIB "/"RUBY_LIB_VERSION
+#ifndef RUBY_ARCH_LIB_FOR
+#define RUBY_ARCH_LIB_FOR(arch) RUBY_LIB "/"arch
+#endif
+#ifndef RUBY_SITE_ARCH_LIB_FOR
+#define RUBY_SITE_ARCH_LIB_FOR(arch) RUBY_SITE_LIB2 "/"arch
+#endif
+#ifndef RUBY_VENDOR_ARCH_LIB_FOR
+#define RUBY_VENDOR_ARCH_LIB_FOR(arch) RUBY_VENDOR_LIB2 "/"arch
+#endif
+
+#if !defined(LOAD_RELATIVE) || !LOAD_RELATIVE
+const char ruby_exec_prefix[] = RUBY_EXEC_PREFIX;
+#endif
+
+const char ruby_initial_load_paths[] =
+#ifndef NO_INITIAL_LOAD_PATH
+#ifdef RUBY_SEARCH_PATH
+ RUBY_SEARCH_PATH "\0"
+#endif
+#ifndef NO_RUBY_SITE_LIB
+ RUBY_SITE_LIB2 "\0"
+#ifdef RUBY_THINARCH
+ RUBY_SITE_ARCH_LIB_FOR(RUBY_THINARCH) "\0"
+#endif
+ RUBY_SITE_ARCH_LIB_FOR(RUBY_SITEARCH) "\0"
+ RUBY_SITE_LIB "\0"
+#endif
+
+#ifndef NO_RUBY_VENDOR_LIB
+ RUBY_VENDOR_LIB2 "\0"
+#ifdef RUBY_THINARCH
+ RUBY_VENDOR_ARCH_LIB_FOR(RUBY_THINARCH) "\0"
+#endif
+ RUBY_VENDOR_ARCH_LIB_FOR(RUBY_SITEARCH) "\0"
+ RUBY_VENDOR_LIB "\0"
+#endif
+
+ RUBY_LIB "\0"
+#ifdef RUBY_THINARCH
+ RUBY_ARCH_LIB_FOR(RUBY_THINARCH) "\0"
+#endif
+ RUBY_ARCH_LIB_FOR(RUBY_ARCH) "\0"
+#endif
+ "";
+
diff --git a/localeinit.c b/localeinit.c
new file mode 100644
index 0000000000..51a06c5b1c
--- /dev/null
+++ b/localeinit.c
@@ -0,0 +1,70 @@
+/**********************************************************************
+
+ localeinit.c -
+
+ $Author$
+ created at: Thu Jul 11 22:09:57 JST 2013
+
+ Copyright (C) 2013 Yukihiro Matsumoto
+
+**********************************************************************/
+
+#include "ruby/ruby.h"
+#include "ruby/encoding.h"
+#include "internal.h"
+#ifdef __CYGWIN__
+#include <windows.h>
+#endif
+#ifdef HAVE_LANGINFO_H
+#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
+
+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];
+# ifdef __CYGWIN__
+ const char *nl_langinfo_codeset(void);
+ codeset = nl_langinfo_codeset();
+# endif
+ if (!codeset) {
+ UINT codepage = GetConsoleCP();
+ if (!codepage) codepage = GetACP();
+ CP_FORMAT(cp, codepage);
+ codeset = cp;
+ }
+ return rb_usascii_str_new2(codeset);
+#elif defined HAVE_LANGINFO_H
+ char *codeset;
+ codeset = nl_langinfo(CODESET);
+ return rb_usascii_str_new2(codeset);
+#else
+ return Qnil;
+#endif
+}
+
+int
+Init_enc_set_filesystem_encoding(void)
+{
+ int idx;
+#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());
+ idx = rb_enc_find_index(cp);
+ if (idx < 0) idx = ENCINDEX_ASCII;
+#else
+ idx = rb_enc_to_index(rb_default_external_encoding());
+#endif
+ return idx;
+}
diff --git a/man/rake.1 b/man/rake.1
index c8ba5dd82c..d8991546b5 100644
--- a/man/rake.1
+++ b/man/rake.1
@@ -152,17 +152,46 @@ 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
-http://rake.rubyforge.org/
-.Sh REPORTING BUGS
-Bugs, features requests and other issues can be logged at
-<\fBhttp://onestepback.org/redmine/projects/show/rake\fR>.
-.Pp
-You will need an account to before you can post issues. Register at <\fBhttp://onestepback.org/redmine/account/register\fR>.
-Or you can send an email to the author.
+.Pa https://github.com/ruby/rake
.Sh AUTHOR
.Nm Rake
is written by
diff --git a/man/ruby.1 b/man/ruby.1
index 3a60215365..1c0a7dabc7 100644
--- a/man/ruby.1
+++ b/man/ruby.1
@@ -124,7 +124,7 @@ Libraries called "builtin libraries" and "standard libraries" are bundled with R
And you can obtain more libraries via the package management system called `RubyGems'.
.Pp
Moreover there are thousands of Ruby projects on GitHub
-.Pf <\fBhttps://github.com/languages/Ruby\fR> Ns .
+.Aq Pa https://github.com/languages/Ruby .
.El
.Pp
.Sh OPTIONS
@@ -432,7 +432,7 @@ after printing its version.
.El
.Pp
.Sh ENVIRONMENT
-.Bl -tag -width "RUBYLIB_PREFIX" -compact
+.Bl -tag -width "RUBYSHELL" -compact
.It Ev RUBYLIB
A colon-separated list of directories that are added to Ruby's
library load path
@@ -472,29 +472,22 @@ 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 bellow.
+as below.
.Bd -literal -offset indent
% gem help
.Ed
.Pp
.Sh SEE ALSO
.Bl -hang -compact -width "http://www.ruby-lang.org/123"
-.It http://www.ruby-lang.org
+.It https://www.ruby-lang.org/
The official web site.
-.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.
+.It https://www.ruby-toolbox.com/
+Comprehensive catalog of Ruby libraries.
.El
.Pp
.Sh REPORTING BUGS
@@ -505,7 +498,7 @@ Ruby projects on Github.
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 (http://bugs.ruby-lang.org).
+Ruby Issue Tracking System (https://bugs.ruby-lang.org/).
Do not report security vulnerabilities
via the system because it publishes the vulnerabilities immediately.
.El
@@ -513,4 +506,6 @@ via the system because it publishes the vulnerabilities immediately.
Ruby is designed and implemented by
.An Yukihiro Matsumoto Aq matz@netlab.jp .
.Pp
-See <\fBhttp://bugs.ruby-lang.org/wiki/ruby/Contributors\fR> for contributors to Ruby.
+See
+.Aq Pa https://bugs.ruby-lang.org/projects/ruby/wiki/Contributors
+for contributors to Ruby.
diff --git a/marshal.c b/marshal.c
index a6f9229c34..598f90f187 100644
--- a/marshal.c
+++ b/marshal.c
@@ -9,6 +9,10 @@
**********************************************************************/
+#if defined __GNUC__ && __GNUC__ < 3
+# error too old GCC
+#endif
+
#include "ruby/ruby.h"
#include "ruby/io.h"
#include "ruby/st.h"
@@ -28,11 +32,11 @@
#define SHORTMASK ((1<<BITSPERSHORT)-1)
#define SHORTDN(x) RSHIFT((x),BITSPERSHORT)
-#if SIZEOF_SHORT == SIZEOF_BDIGITS
+#if SIZEOF_SHORT == SIZEOF_BDIGIT
#define SHORTLEN(x) (x)
#else
-static long
-shortlen(long len, BDIGIT *ds)
+static size_t
+shortlen(size_t len, BDIGIT *ds)
{
BDIGIT num;
int offset = 0;
@@ -42,7 +46,7 @@ shortlen(long len, BDIGIT *ds)
num = SHORTDN(num);
offset++;
}
- return (len - 1)*sizeof(BDIGIT)/2 + offset;
+ return (len - 1)*SIZEOF_BDIGIT/2 + offset;
}
#define SHORTLEN(x) shortlen((x),d)
#endif
@@ -130,7 +134,7 @@ rb_marshal_define_compat(VALUE newclass, VALUE oldclass, VALUE (*dumper)(VALUE),
st_insert(compat_allocator_tbl, (st_data_t)allocator, (st_data_t)compat);
}
-#define MARSHAL_INFECTION (FL_TAINT|FL_UNTRUSTED)
+#define MARSHAL_INFECTION FL_TAINT
typedef char ruby_check_marshal_viral_flags[MARSHAL_INFECTION == (int)MARSHAL_INFECTION ? 1 : -1];
struct dump_arg {
@@ -165,6 +169,7 @@ 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);
@@ -186,39 +191,41 @@ memsize_dump_arg(const void *ptr)
static const rb_data_type_t dump_arg_data = {
"dump_arg",
{mark_dump_arg, free_dump_arg, memsize_dump_arg,},
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
-static const char *
+static VALUE
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", type);
+ rb_raise(rb_eTypeError, "can't dump non-ascii %s name % "PRIsVALUE,
+ type, path);
}
if (n[0] == '#') {
- rb_raise(rb_eTypeError, "can't dump anonymous %s %.*s", type,
- (int)RSTRING_LEN(path), n);
+ rb_raise(rb_eTypeError, "can't dump anonymous %s % "PRIsVALUE,
+ type, path);
}
- return n;
+ return path;
}
static VALUE
class2path(VALUE klass)
{
VALUE path = rb_class_path(klass);
- const char *n;
- n = must_not_be_anonymous((RB_TYPE_P(klass, T_CLASS) ? "class" : "module"), path);
+ 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, "%s can't be referred to", n);
+ rb_raise(rb_eTypeError, "% "PRIsVALUE" can't be referred to", path);
}
return path;
}
static void w_long(long, struct dump_arg*);
-static void w_encoding(VALUE obj, long num, struct dump_call_arg *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_nbyte(const char *s, long n, struct dump_arg *arg)
@@ -405,37 +412,38 @@ w_float(double d, struct dump_arg *arg)
}
static void
-w_symbol(ID id, struct dump_arg *arg)
+w_symbol(VALUE sym, struct dump_arg *arg)
{
- VALUE sym;
st_data_t num;
- int encidx = -1;
+ VALUE encname;
- if (st_lookup(arg->symbols, id, &num)) {
+ if (st_lookup(arg->symbols, sym, &num)) {
w_byte(TYPE_SYMLINK, arg);
w_long((long)num, arg);
}
else {
- sym = rb_id2str(id);
+ const VALUE orig_sym = sym;
+ sym = rb_sym2str(sym);
if (!sym) {
- rb_raise(rb_eTypeError, "can't dump anonymous ID %"PRIdVALUE, id);
+ rb_raise(rb_eTypeError, "can't dump anonymous ID %"PRIdVALUE, sym);
}
- encidx = rb_enc_get_index(sym);
- if (encidx == rb_usascii_encindex() ||
+ encname = encoding_name(sym, arg);
+ if (NIL_P(encname) ||
rb_enc_str_coderange(sym) == ENC_CODERANGE_7BIT) {
- encidx = -1;
+ encname = Qnil;
}
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, id, arg->symbols->num_entries);
- if (encidx != -1) {
+ st_add_direct(arg->symbols, orig_sym, arg->symbols->num_entries);
+ if (!NIL_P(encname)) {
struct dump_call_arg c_arg;
c_arg.limit = 1;
c_arg.arg = arg;
- w_encoding(sym, 0, &c_arg);
+ w_long(1L, arg);
+ w_encoding(encname, &c_arg);
}
}
}
@@ -444,7 +452,7 @@ static void
w_unique(VALUE s, struct dump_arg *arg)
{
must_not_be_anonymous("class", s);
- w_symbol(rb_intern_str(s), arg);
+ w_symbol(rb_str_dynamic_intern(s), arg);
}
static void w_object(VALUE,struct dump_arg*,int);
@@ -510,6 +518,8 @@ 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)
{
@@ -517,56 +527,80 @@ 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 (id == rb_id_encoding()) return ST_CONTINUE;
- if (id == rb_intern("E")) return ST_CONTINUE;
- w_symbol(id, arg->arg);
+ if (to_be_skipped_id(id)) return ST_CONTINUE;
+ w_symbol(ID2SYM(id), arg->arg);
w_object(value, arg->arg, arg->limit);
return ST_CONTINUE;
}
-static void
-w_encoding(VALUE obj, long num, struct dump_call_arg *arg)
+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)
{
int encidx = rb_enc_get_index(obj);
rb_encoding *enc = 0;
st_data_t name;
if (encidx <= 0 || !(enc = rb_enc_from_index(encidx))) {
- w_long(num, arg->arg);
- return;
+ return Qnil;
}
- w_long(num + 1, arg->arg);
/* special treatment for US-ASCII and UTF-8 */
if (encidx == rb_usascii_encindex()) {
- w_symbol(rb_intern("E"), arg->arg);
- w_object(Qfalse, arg->arg, arg->limit + 1);
- return;
+ return Qfalse;
}
else if (encidx == rb_utf8_encindex()) {
- w_symbol(rb_intern("E"), arg->arg);
- w_object(Qtrue, arg->arg, arg->limit + 1);
- return;
+ return Qtrue;
}
- 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);
+ 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_ivar(VALUE obj, st_table *tbl, struct dump_call_arg *arg)
+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:
+ 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, st_table **ivtbl)
{
- long num = tbl ? tbl->num_entries : 0;
+ st_index_t num = !NIL_P(encname);
- w_encoding(obj, num, arg);
+ *ivtbl = rb_generic_ivar_table(obj);
+ if (*ivtbl) {
+ st_foreach_safe(*ivtbl, obj_count_ivars, (st_data_t)&num);
+ }
+ return num;
+}
+
+static void
+w_ivar(st_index_t num, st_table *tbl, VALUE encname, struct dump_call_arg *arg)
+{
+ w_long(num, arg->arg);
+ w_encoding(encname, arg);
if (tbl) {
st_foreach_safe(tbl, w_obj_each, (st_data_t)arg);
}
@@ -585,7 +619,7 @@ w_objivar(VALUE obj, struct dump_call_arg *arg)
if (ptr[i] != Qundef)
num += 1;
- w_encoding(obj, num, arg);
+ w_long(num, arg->arg);
if (num != 0) {
rb_ivar_foreach(obj, w_obj_each, (st_data_t)arg);
}
@@ -597,9 +631,8 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
struct dump_call_arg c_arg;
st_table *ivtbl = 0;
st_data_t num;
- int hasiv = 0;
-#define has_ivars(obj, ivtbl) (((ivtbl) = rb_generic_ivar_table(obj)) != 0 || \
- (!SPECIAL_CONST_P(obj) && !ENCODING_IS_ASCII8BIT(obj)))
+ st_index_t hasiv = 0;
+ VALUE encname = Qnil;
if (limit == 0) {
rb_raise(rb_eArgError, "exceed depth limit");
@@ -639,7 +672,7 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
#endif
}
else if (SYMBOL_P(obj)) {
- w_symbol(SYM2ID(obj), arg);
+ w_symbol(obj, arg);
}
else if (FLONUM_P(obj)) {
st_add_direct(arg->data, obj, arg->data->num_entries);
@@ -649,6 +682,11 @@ 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)) {
@@ -656,16 +694,14 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
v = rb_funcall2(obj, s_mdump, 0, 0);
check_dump_arg(arg, s_mdump);
- hasiv = has_ivars(v, ivtbl);
- if (hasiv) w_byte(TYPE_IVAR, arg);
w_class(TYPE_USRMARSHAL, obj, arg, FALSE);
w_object(v, arg, limit);
- if (hasiv) w_ivar(v, ivtbl, &c_arg);
return;
}
if (rb_obj_respond_to(obj, s_dump, TRUE)) {
st_table *ivtbl2 = 0;
- int hasiv2;
+ st_index_t hasiv2;
+ VALUE encname2;
v = INT2NUM(limit);
v = rb_funcall2(obj, s_dump, 1, &v);
@@ -673,18 +709,18 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
if (!RB_TYPE_P(v, T_STRING)) {
rb_raise(rb_eTypeError, "_dump() must return string");
}
- 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);
+ hasiv = has_ivars(obj, (encname = encoding_name(obj, arg)), &ivtbl);
+ hasiv2 = has_ivars(v, (encname2 = encoding_name(v, arg)), &ivtbl2);
+ if (hasiv2) {
+ hasiv = hasiv2;
+ ivtbl = ivtbl2;
+ encname = encname2;
}
+ if (hasiv) w_byte(TYPE_IVAR, arg);
w_class(TYPE_USERDEF, obj, arg, FALSE);
w_bytes(RSTRING_PTR(v), RSTRING_LEN(v), arg);
- if (hasiv2) {
- w_ivar(v, ivtbl2, &c_arg);
- }
- else if (hasiv) {
- w_ivar(obj, ivtbl, &c_arg);
+ if (hasiv) {
+ w_ivar(hasiv, ivtbl, encname, &c_arg);
}
st_add_direct(arg->data, obj, arg->data->num_entries);
return;
@@ -692,7 +728,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, ivtbl);
+ hasiv = has_ivars(obj, (encname = encoding_name(obj, arg)), &ivtbl);
{
st_data_t compat_data;
rb_alloc_func_t allocator = rb_get_alloc_func(RBASIC(obj)->klass);
@@ -738,18 +774,24 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
case T_BIGNUM:
w_byte(TYPE_BIGNUM, arg);
{
- char sign = RBIGNUM_SIGN(obj) ? '+' : '-';
- long len = RBIGNUM_LEN(obj);
- BDIGIT *d = RBIGNUM_DIGITS(obj);
+ 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");
+ }
w_byte(sign, arg);
- w_long(SHORTLEN(len), arg); /* w_short? */
+ w_long((long)slen, arg);
while (len--) {
-#if SIZEOF_BDIGITS > SIZEOF_SHORT
+#if SIZEOF_BDIGIT > SIZEOF_SHORT
BDIGIT num = *d;
int i;
- for (i=0; i<SIZEOF_BDIGITS; i+=SIZEOF_SHORT) {
+ for (i=0; i<SIZEOF_BDIGIT; i+=SIZEOF_SHORT) {
w_short(num & SHORTMASK, arg);
num = SHORTDN(num);
if (len == 0 && num == 0) break;
@@ -786,7 +828,7 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
w_long(len, arg);
for (i=0; i<RARRAY_LEN(obj); i++) {
- w_object(RARRAY_PTR(obj)[i], arg, limit);
+ w_object(RARRAY_AREF(obj, i), arg, limit);
if (len != RARRAY_LEN(obj)) {
rb_raise(rb_eRuntimeError, "array modified during dump");
}
@@ -799,8 +841,7 @@ 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, FL_USER2)) {
- /* FL_USER2 means HASH_PROC_DEFAULT (see hash.c) */
+ else if (FL_TEST(obj, HASH_PROC_DEFAULT)) {
rb_raise(rb_eTypeError, "can't dump hash with default proc");
}
else {
@@ -823,8 +864,8 @@ 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(SYM2ID(RARRAY_PTR(mem)[i]), arg);
- w_object(RSTRUCT_PTR(obj)[i], arg, limit);
+ w_symbol(RARRAY_AREF(mem, i), arg);
+ w_object(RSTRUCT_GET(obj, i), arg, limit);
}
}
break;
@@ -858,7 +899,7 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
RB_GC_GUARD(obj);
}
if (hasiv) {
- w_ivar(obj, ivtbl, &c_arg);
+ w_ivar(hasiv, ivtbl, encname, &c_arg);
}
}
@@ -913,11 +954,11 @@ io_needed(void)
*
* Marshal can't dump following objects:
* * anonymous Class/Module.
- * * objects which related to its system (ex: Dir, File::Stat, IO, File, Socket
+ * * objects which are related to system (ex: Dir, File::Stat, IO, File, Socket
* and so on)
* * an instance of MatchData, Data, Method, UnboundMethod, Proc, Thread,
* ThreadGroup, Continuation
- * * objects which defines singleton methods
+ * * objects which define singleton methods
*/
static VALUE
marshal_dump(int argc, VALUE *argv)
@@ -925,7 +966,7 @@ marshal_dump(int argc, VALUE *argv)
VALUE obj, port, a1, a2;
int limit = -1;
struct dump_arg *arg;
- volatile VALUE wrapper;
+ VALUE wrapper; /* used to avoid memory leak in case of exception */
port = Qnil;
rb_scan_args(argc, argv, "12", &obj, &a1, &a2);
@@ -939,7 +980,7 @@ marshal_dump(int argc, VALUE *argv)
else if (NIL_P(a1)) io_needed();
else port = a1;
}
- RB_GC_GUARD(wrapper) = TypedData_Make_Struct(rb_cData, struct dump_arg, &dump_arg_data, arg);
+ wrapper = TypedData_Make_Struct(rb_cData, struct dump_arg, &dump_arg_data, arg);
arg->dest = 0;
arg->symbols = st_init_numtable();
arg->data = st_init_numtable();
@@ -1004,6 +1045,7 @@ 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);
}
@@ -1024,12 +1066,13 @@ memsize_load_arg(const void *ptr)
static const rb_data_type_t load_arg_data = {
"load_arg",
{mark_load_arg, free_load_arg, memsize_load_arg,},
+ 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 ID r_symbol(struct load_arg *arg);
+static VALUE r_symbol(struct load_arg *arg);
static VALUE path2class(VALUE path);
NORETURN(static void too_short(void));
@@ -1235,13 +1278,13 @@ r_bytes0(long len, struct load_arg *arg)
}
static int
-id2encidx(ID id, VALUE val)
+sym2encidx(VALUE sym, VALUE val)
{
- if (id == rb_id_encoding()) {
+ if (sym == ID2SYM(rb_id_encoding())) {
int idx = rb_enc_find_index(StringValueCStr(val));
return idx;
}
- else if (id == rb_intern("E")) {
+ else if (sym == ID2SYM(rb_intern("E"))) {
if (val == Qfalse) return rb_usascii_encindex();
else if (val == Qtrue) return rb_utf8_encindex();
/* bogus ignore */
@@ -1249,23 +1292,23 @@ id2encidx(ID id, VALUE val)
return -1;
}
-static ID
+static VALUE
r_symlink(struct load_arg *arg)
{
- st_data_t id;
+ st_data_t sym;
long num = r_long(arg);
- if (!st_lookup(arg->symbols, num, &id)) {
+ if (!st_lookup(arg->symbols, num, &sym)) {
rb_raise(rb_eArgError, "bad symbol");
}
- return (ID)id;
+ return (VALUE)sym;
}
-static ID
+static VALUE
r_symreal(struct load_arg *arg, int ivar)
{
VALUE s = r_bytes(arg);
- ID id;
+ VALUE sym;
int idx = -1;
st_index_t n = arg->symbols->num_entries;
@@ -1273,18 +1316,18 @@ r_symreal(struct load_arg *arg, int ivar)
if (ivar) {
long num = r_long(arg);
while (num-- > 0) {
- id = r_symbol(arg);
- idx = id2encidx(id, r_object(arg));
+ sym = r_symbol(arg);
+ idx = sym2encidx(sym, 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);
+ sym = rb_str_dynamic_intern(s);
+ st_insert(arg->symbols, (st_data_t)n, (st_data_t)sym);
- return id;
+ return sym;
}
-static ID
+static VALUE
r_symbol(struct load_arg *arg)
{
int type, ivar = 0;
@@ -1309,7 +1352,7 @@ r_symbol(struct load_arg *arg)
static VALUE
r_unique(struct load_arg *arg)
{
- return rb_id2str(r_symbol(arg));
+ return rb_sym2str(r_symbol(arg));
}
static VALUE
@@ -1330,15 +1373,15 @@ 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)) {
- FL_SET(v, arg->infection);
+ OBJ_TAINT(v);
if ((VALUE)real_obj != Qundef)
- FL_SET((VALUE)real_obj, arg->infection);
+ OBJ_TAINT((VALUE)real_obj);
}
return v;
}
static VALUE
-r_leave(VALUE v, struct load_arg *arg)
+r_fixup_compat(VALUE v, struct load_arg *arg)
{
st_data_t data;
if (st_lookup(arg->compat_tbl, v, &data)) {
@@ -1352,6 +1395,12 @@ r_leave(VALUE v, struct load_arg *arg)
st_delete(arg->compat_tbl, &key, 0);
v = real_obj;
}
+ return v;
+}
+
+static VALUE
+r_post_proc(VALUE v, struct load_arg *arg)
+{
if (arg->proc) {
v = rb_funcall(arg->proc, s_call, 1, v);
check_load_arg(arg, s_call);
@@ -1359,6 +1408,32 @@ r_leave(VALUE v, struct load_arg *arg)
return v;
}
+static VALUE
+r_leave(VALUE v, struct load_arg *arg)
+{
+ v = r_fixup_compat(v, arg);
+ v = r_post_proc(v, arg);
+ return v;
+}
+
+static int
+copy_ivar_i(st_data_t key, st_data_t val, st_data_t arg)
+{
+ VALUE obj = (VALUE)arg, value = (VALUE)val;
+ ID vid = (ID)key;
+
+ if (!rb_ivar_defined(obj, vid))
+ rb_ivar_set(obj, vid, value);
+ return ST_CONTINUE;
+}
+
+static VALUE
+r_copy_ivar(VALUE v, VALUE data)
+{
+ rb_ivar_foreach(data, copy_ivar_i, (st_data_t)v);
+ return v;
+}
+
static void
r_ivar(VALUE obj, int *has_encoding, struct load_arg *arg)
{
@@ -1367,15 +1442,15 @@ r_ivar(VALUE obj, int *has_encoding, struct load_arg *arg)
len = r_long(arg);
if (len > 0) {
do {
- ID id = r_symbol(arg);
+ VALUE sym = r_symbol(arg);
VALUE val = r_object(arg);
- int idx = id2encidx(id, val);
+ int idx = sym2encidx(sym, val);
if (idx >= 0) {
rb_enc_associate_index(obj, idx);
if (has_encoding) *has_encoding = TRUE;
}
else {
- rb_ivar_set(obj, id, val);
+ rb_ivar_set(obj, SYM2ID(sym), val);
}
} while (--len > 0);
}
@@ -1392,11 +1467,11 @@ path2class(VALUE path)
return v;
}
+#define path2module(path) must_be_module(rb_path_to_class(path), path)
+
static VALUE
-path2module(VALUE path)
+must_be_module(VALUE v, VALUE path)
{
- VALUE v = rb_path_to_class(path);
-
if (!RB_TYPE_P(v, T_MODULE)) {
rb_raise(rb_eArgError, "%"PRIsVALUE" does not refer to module", path);
}
@@ -1433,7 +1508,7 @@ append_extmod(VALUE obj, VALUE extmod)
{
long i = RARRAY_LEN(extmod);
while (i > 0) {
- VALUE m = RARRAY_PTR(extmod)[--i];
+ VALUE m = RARRAY_AREF(extmod, --i);
rb_extend_object(obj, m);
}
return obj;
@@ -1461,10 +1536,7 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
rb_raise(rb_eArgError, "dump format error (unlinked)");
}
v = (VALUE)link;
- if (arg->proc) {
- v = rb_funcall(arg->proc, s_call, 1, v);
- check_load_arg(arg, s_call);
- }
+ r_post_proc(v, arg);
break;
case TYPE_IVAR:
@@ -1478,16 +1550,36 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
case TYPE_EXTENDED:
{
- VALUE m = path2module(r_unique(arg));
-
- if (NIL_P(extmod)) extmod = rb_ary_tmp_new(0);
- rb_ary_push(extmod, m);
-
- v = r_object0(arg, 0, extmod);
- while (RARRAY_LEN(extmod) > 0) {
- m = rb_ary_pop(extmod);
- rb_extend_object(v, m);
- }
+ VALUE path = r_unique(arg);
+ VALUE m = rb_path_to_class(path);
+
+ if (RB_TYPE_P(m, T_CLASS)) { /* prepended */
+ VALUE c;
+
+ v = r_object0(arg, 0, Qnil);
+ c = CLASS_OF(v);
+ if (c != m || FL_TEST(c, FL_SINGLETON)) {
+ rb_raise(rb_eArgError,
+ "prepended class %"PRIsVALUE" differs from class %"PRIsVALUE,
+ path, rb_class_name(c));
+ }
+ c = rb_singleton_class(v);
+ while (RARRAY_LEN(extmod) > 0) {
+ m = rb_ary_pop(extmod);
+ rb_prepend_module(c, m);
+ }
+ }
+ 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);
+ while (RARRAY_LEN(extmod) > 0) {
+ m = rb_ary_pop(extmod);
+ rb_extend_object(v, m);
+ }
+ }
}
break;
@@ -1508,7 +1600,7 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
if (TYPE(v) != TYPE(tmp)) goto format_error;
}
- RBASIC(v)->klass = c;
+ RBASIC_SET_CLASS(v, c);
}
break;
@@ -1564,44 +1656,15 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
case TYPE_BIGNUM:
{
long len;
- BDIGIT *digits;
VALUE data;
+ int sign;
- NEWOBJ_OF(big, struct RBignum, rb_cBignum, T_BIGNUM);
- RBIGNUM_SET_SIGN(big, (r_byte(arg) == '+'));
+ sign = r_byte(arg);
len = r_long(arg);
data = r_bytes0(len * 2, arg);
-#if SIZEOF_BDIGITS == SIZEOF_SHORT
- rb_big_resize((VALUE)big, len);
-#else
- rb_big_resize((VALUE)big, (len + 1) * 2 / sizeof(BDIGIT));
-#endif
- digits = RBIGNUM_DIGITS(big);
- MEMCPY(digits, RSTRING_PTR(data), char, len * 2);
+ v = rb_integer_unpack(RSTRING_PTR(data), len, 2, 0,
+ INTEGER_PACK_LITTLE_ENDIAN | (sign == '-' ? INTEGER_PACK_NEGATIVE : 0));
rb_str_resize(data, 0L);
-#if SIZEOF_BDIGITS > SIZEOF_SHORT
- MEMZERO((char *)digits + len * 2, char,
- RBIGNUM_LEN(big) * sizeof(BDIGIT) - len * 2);
-#endif
- len = RBIGNUM_LEN(big);
- while (len > 0) {
- unsigned char *p = (unsigned char *)digits;
- BDIGIT num = 0;
-#if SIZEOF_BDIGITS > SIZEOF_SHORT
- int shift = 0;
- int i;
-
- for (i=0; i<SIZEOF_BDIGITS; i++) {
- num |= (int)p[i] << shift;
- shift += 8;
- }
-#else
- num = p[0] | (p[1] << 8);
-#endif
- *digits++ = num;
- len--;
- }
- v = rb_big_norm((VALUE)big);
v = r_entry(v, arg);
v = r_leave(v, arg);
}
@@ -1649,7 +1712,7 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
case TYPE_ARRAY:
{
- volatile long len = r_long(arg); /* gcc 2.7.2.3 -O2 bug?? */
+ long len = r_long(arg);
v = rb_ary_new2(len);
v = r_entry(v, arg);
@@ -1679,7 +1742,7 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
}
arg->readable += 2;
if (type == TYPE_HASH_DEF) {
- RHASH_IFNONE(v) = r_object(arg);
+ RHASH_SET_IFNONE(v, r_object(arg));
}
v = r_leave(v, arg);
}
@@ -1688,20 +1751,20 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
case TYPE_STRUCT:
{
VALUE mem, values;
- volatile long i; /* gcc 2.7.2.3 -O2 bug?? */
- ID slot;
+ long i;
+ VALUE 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 %s not a struct", rb_class2name(klass));
+ rb_raise(rb_eTypeError, "class %"PRIsVALUE" not a struct", rb_class_name(klass));
}
mem = rb_struct_s_members(klass);
if (RARRAY_LEN(mem) != len) {
- rb_raise(rb_eTypeError, "struct %s not compatible (struct size differs)",
- rb_class2name(klass));
+ rb_raise(rb_eTypeError, "struct %"PRIsVALUE" not compatible (struct size differs)",
+ rb_class_name(klass));
}
arg->readable += (len - 1) * 2;
@@ -1710,11 +1773,11 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
for (i=0; i<len; i++) {
slot = r_symbol(arg);
- if (RARRAY_PTR(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_PTR(mem)[i])));
+ if (RARRAY_AREF(mem, i) != slot) {
+ rb_raise(rb_eTypeError, "struct %"PRIsVALUE" not compatible (:%"PRIsVALUE" for :%"PRIsVALUE")",
+ rb_class_name(klass),
+ rb_sym2str(slot),
+ rb_sym2str(RARRAY_AREF(mem, i)));
}
rb_ary_push(values, r_object(arg));
arg->readable -= 2;
@@ -1765,7 +1828,9 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
data = r_object(arg);
rb_funcall2(v, s_mload, 1, &data);
check_load_arg(arg, s_mload);
- v = r_leave(v, arg);
+ v = r_fixup_compat(v, arg);
+ v = r_copy_ivar(v, data);
+ v = r_post_proc(v, arg);
if (!NIL_P(extmod)) {
if (oldclass) append_extmod(v, extmod);
rb_ary_clear(extmod);
@@ -1844,17 +1909,17 @@ r_object0(struct load_arg *arg, int *ivp, VALUE extmod)
case TYPE_SYMBOL:
if (ivp) {
- v = ID2SYM(r_symreal(arg, *ivp));
+ v = r_symreal(arg, *ivp);
*ivp = FALSE;
}
else {
- v = ID2SYM(r_symreal(arg, 0));
+ v = r_symreal(arg, 0);
}
v = r_leave(v, arg);
break;
case TYPE_SYMLINK:
- v = ID2SYM(r_symlink(arg));
+ v = r_symlink(arg);
break;
default:
@@ -1897,8 +1962,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, it will be passed each object as it
- * is deserialized.
+ * to_str. If proc is specified, each object will be passed to the proc, as the object
+ * is being deserialized.
*
* Never pass untrusted data (including user supplied input) to this method.
* Please see the overview for further details.
@@ -1909,7 +1974,7 @@ marshal_load(int argc, VALUE *argv)
VALUE port, proc;
int major, minor, infection = 0;
VALUE v;
- volatile VALUE wrapper;
+ VALUE wrapper; /* used to avoid memory leak in case of exception */
struct load_arg *arg;
rb_scan_args(argc, argv, "11", &port, &proc);
@@ -1920,12 +1985,12 @@ marshal_load(int argc, VALUE *argv)
}
else if (rb_respond_to(port, s_getbyte) && rb_respond_to(port, s_read)) {
rb_check_funcall(port, s_binmode, 0, 0);
- infection = (int)(FL_TAINT | FL_TEST(port, FL_UNTRUSTED));
+ infection = (int)FL_TAINT;
}
else {
io_needed();
}
- RB_GC_GUARD(wrapper) = TypedData_Make_Struct(rb_cData, struct load_arg, &load_arg_data, arg);
+ wrapper = TypedData_Make_Struct(rb_cData, struct load_arg, &load_arg_data, arg);
arg->infection = infection;
arg->src = port;
arg->offset = 0;
@@ -2070,7 +2135,7 @@ marshal_load(int argc, VALUE *argv)
* end
* end
*
- * Since Marhsal.dump outputs a string you can have _dump return a Marshal
+ * Since Marshal.dump outputs a string you can have _dump return a Marshal
* string which is Marshal.loaded in _load for complex objects.
*/
void
@@ -2098,7 +2163,9 @@ Init_marshal(void)
rb_define_module_function(rb_mMarshal, "load", marshal_load, -1);
rb_define_module_function(rb_mMarshal, "restore", marshal_load, -1);
+ /* major version */
rb_define_const(rb_mMarshal, "MAJOR_VERSION", INT2FIX(MARSHAL_MAJOR));
+ /* minor version */
rb_define_const(rb_mMarshal, "MINOR_VERSION", INT2FIX(MARSHAL_MINOR));
compat_allocator_tbl = st_init_numtable();
diff --git a/math.c b/math.c
index 96bd1e9f73..a09d605911 100644
--- a/math.c
+++ b/math.c
@@ -11,6 +11,7 @@
#include "ruby/ruby.h"
#include "internal.h"
+#include <float.h>
#include <math.h>
#include <errno.h>
@@ -19,7 +20,7 @@
extern int signbit(double);
#endif
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
+#define RB_BIGNUM_TYPE_P(x) RB_TYPE_P((x), T_BIGNUM)
VALUE rb_mMath;
VALUE rb_eMathDomainError;
@@ -35,10 +36,14 @@ VALUE rb_eMathDomainError;
/*
* call-seq:
- * Math.atan2(y, x) -> float
+ * Math.atan2(y, x) -> Float
*
- * Computes the arc tangent given <i>y</i> and <i>x</i>. Returns
- * -PI..PI.
+ * Computes the arc tangent given +y+ and +x+.
+ * Returns a Float in the range -PI..PI.
+ *
+ * Domain: (-INFINITY, INFINITY)
+ *
+ * Codomain: [-PI, PI]
*
* Math.atan2(-0.0, -1.0) #=> -3.141592653589793
* Math.atan2(-1.0, -1.0) #=> -2.356194490192345
@@ -50,6 +55,10 @@ 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
*
*/
@@ -70,17 +79,36 @@ math_atan2(VALUE obj, VALUE y, VALUE x)
return DBL2NUM(M_PI);
return DBL2NUM(-M_PI);
}
- if (isinf(dx) && isinf(dy)) domain_error("atan2");
+#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
return DBL2NUM(atan2(dy, dx));
}
/*
* call-seq:
- * Math.cos(x) -> float
+ * Math.cos(x) -> Float
+ *
+ * Computes the cosine of +x+ (expressed in radians).
+ * Returns a Float in the range -1.0..1.0.
+ *
+ * Domain: (-INFINITY, INFINITY)
+ *
+ * Codomain: [-1, 1]
+ *
+ * Math.cos(Math::PI) #=> -1.0
*
- * Computes the cosine of <i>x</i> (expressed in radians). Returns
- * -1..1.
*/
static VALUE
@@ -92,41 +120,60 @@ math_cos(VALUE obj, VALUE x)
/*
* call-seq:
- * Math.sin(x) -> float
+ * Math.sin(x) -> Float
+ *
+ * Computes the sine of +x+ (expressed in radians).
+ * Returns a Float in the range -1.0..1.0.
+ *
+ * Domain: (-INFINITY, INFINITY)
+ *
+ * Codomain: [-1, 1]
+ *
+ * Math.sin(Math::PI/2) #=> 1.0
*
- * Computes the sine of <i>x</i> (expressed in radians). Returns
- * -1..1.
*/
static VALUE
math_sin(VALUE obj, VALUE x)
{
Need_Float(x);
-
return DBL2NUM(sin(RFLOAT_VALUE(x)));
}
/*
* call-seq:
- * Math.tan(x) -> float
+ * Math.tan(x) -> Float
+ *
+ * Computes the tangent of +x+ (expressed in radians).
+ *
+ * Domain: (-INFINITY, INFINITY)
+ *
+ * Codomain: (-INFINITY, INFINITY)
+ *
+ * Math.tan(0) #=> 0.0
*
- * Returns the tangent of <i>x</i> (expressed in radians).
*/
static VALUE
math_tan(VALUE obj, VALUE x)
{
Need_Float(x);
-
return DBL2NUM(tan(RFLOAT_VALUE(x)));
}
/*
* call-seq:
- * Math.acos(x) -> float
+ * Math.acos(x) -> Float
+ *
+ * Computes the arc cosine of +x+. Returns 0..PI.
+ *
+ * Domain: [-1, 1]
+ *
+ * Codomain: [0, PI]
+ *
+ * Math.acos(0) == Math::PI/2 #=> true
*
- * Computes the arc cosine of <i>x</i>. Returns 0..PI.
*/
static VALUE
@@ -144,9 +191,15 @@ math_acos(VALUE obj, VALUE x)
/*
* call-seq:
- * Math.asin(x) -> float
+ * Math.asin(x) -> Float
+ *
+ * Computes the arc sine of +x+. Returns -PI/2..PI/2.
+ *
+ * Domain: [-1, -1]
*
- * Computes the arc sine of <i>x</i>. Returns -{PI/2} .. {PI/2}.
+ * Codomain: [-PI/2, PI/2]
+ *
+ * Math.asin(1) == Math::PI/2 #=> true
*/
static VALUE
@@ -164,9 +217,15 @@ math_asin(VALUE obj, VALUE x)
/*
* call-seq:
- * Math.atan(x) -> float
+ * Math.atan(x) -> Float
+ *
+ * Computes the arc tangent of +x+. Returns -PI/2..PI/2.
+ *
+ * Domain: (-INFINITY, INFINITY)
+ *
+ * Codomain: (-PI/2, PI/2)
*
- * Computes the arc tangent of <i>x</i>. Returns -{PI/2} .. {PI/2}.
+ * Math.atan(0) #=> 0.0
*/
static VALUE
@@ -186,16 +245,22 @@ cosh(double x)
/*
* call-seq:
- * Math.cosh(x) -> float
+ * Math.cosh(x) -> Float
+ *
+ * Computes the hyperbolic cosine of +x+ (expressed in radians).
+ *
+ * Domain: (-INFINITY, INFINITY)
+ *
+ * Codomain: [1, INFINITY)
+ *
+ * Math.cosh(0) #=> 1.0
*
- * Computes the hyperbolic cosine of <i>x</i> (expressed in radians).
*/
static VALUE
math_cosh(VALUE obj, VALUE x)
{
Need_Float(x);
-
return DBL2NUM(cosh(RFLOAT_VALUE(x)));
}
@@ -209,10 +274,16 @@ sinh(double x)
/*
* call-seq:
- * Math.sinh(x) -> float
+ * Math.sinh(x) -> Float
+ *
+ * Computes the hyperbolic sine of +x+ (expressed in radians).
+ *
+ * Domain: (-INFINITY, INFINITY)
+ *
+ * Codomain: (-INFINITY, INFINITY)
+ *
+ * Math.sinh(0) #=> 0.0
*
- * Computes the hyperbolic sine of <i>x</i> (expressed in
- * radians).
*/
static VALUE
@@ -232,10 +303,16 @@ tanh(double x)
/*
* call-seq:
- * Math.tanh() -> float
+ * Math.tanh(x) -> Float
+ *
+ * Computes the hyperbolic tangent of +x+ (expressed in radians).
+ *
+ * Domain: (-INFINITY, INFINITY)
+ *
+ * Codomain: (-1, 1)
+ *
+ * Math.tanh(0) #=> 0.0
*
- * Computes the hyperbolic tangent of <i>x</i> (expressed in
- * radians).
*/
static VALUE
@@ -247,9 +324,16 @@ math_tanh(VALUE obj, VALUE x)
/*
* call-seq:
- * Math.acosh(x) -> float
+ * Math.acosh(x) -> Float
+ *
+ * Computes the inverse hyperbolic cosine of +x+.
+ *
+ * Domain: [1, INFINITY)
+ *
+ * Codomain: [0, INFINITY)
+ *
+ * Math.acosh(1) #=> 0.0
*
- * Computes the inverse hyperbolic cosine of <i>x</i>.
*/
static VALUE
@@ -267,9 +351,16 @@ math_acosh(VALUE obj, VALUE x)
/*
* call-seq:
- * Math.asinh(x) -> float
+ * Math.asinh(x) -> Float
+ *
+ * Computes the inverse hyperbolic sine of +x+.
+ *
+ * Domain: (-INFINITY, INFINITY)
+ *
+ * Codomain: (-INFINITY, INFINITY)
+ *
+ * Math.asinh(1) #=> 0.881373587019543
*
- * Computes the inverse hyperbolic sine of <i>x</i>.
*/
static VALUE
@@ -281,9 +372,16 @@ math_asinh(VALUE obj, VALUE x)
/*
* call-seq:
- * Math.atanh(x) -> float
+ * Math.atanh(x) -> Float
+ *
+ * Computes the inverse hyperbolic tangent of +x+.
+ *
+ * Domain: (-1, 1)
+ *
+ * Codomain: (-INFINITY, INFINITY)
+ *
+ * Math.atanh(1) #=> Infinity
*
- * Computes the inverse hyperbolic tangent of <i>x</i>.
*/
static VALUE
@@ -304,10 +402,14 @@ math_atanh(VALUE obj, VALUE x)
/*
* call-seq:
- * Math.exp(x) -> float
+ * Math.exp(x) -> Float
*
* Returns e**x.
*
+ * Domain: (-INFINITY, INFINITY)
+ *
+ * Codomain: (0, INFINITY)
+ *
* Math.exp(0) #=> 1.0
* Math.exp(1) #=> 2.718281828459045
* Math.exp(1.5) #=> 4.4816890703380645
@@ -330,41 +432,68 @@ 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(numeric) -> float
- * Math.log(num,base) -> float
+ * Math.log(x) -> Float
+ * Math.log(x, base) -> Float
*
- * Returns the natural logarithm of <i>numeric</i>.
+ * Returns the logarithm of +x+.
* If additional second argument is given, it will be the base
- * of logarithm.
+ * of logarithm. Otherwise it is +e+ (for the natural logarithm).
+ *
+ * Domain: (0, INFINITY)
*
+ * Codomain: (-INFINITY, INFINITY)
+ *
+ * Math.log(0) #=> -Infinity
* Math.log(1) #=> 0.0
* Math.log(Math::E) #=> 1.0
* Math.log(Math::E**3) #=> 3.0
- * Math.log(12,3) #=> 2.2618595071429146
+ * Math.log(12, 3) #=> 2.2618595071429146
*
*/
static VALUE
-math_log(int argc, VALUE *argv)
+math_log(int argc, const VALUE *argv, VALUE obj)
{
VALUE x, base;
- double d0, d;
+ double d;
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 d0, d;
+ size_t numbits;
+
+ if (RB_BIGNUM_TYPE_P(x) && BIGNUM_POSITIVE_P(x) &&
+ DBL_MAX_EXP <= (numbits = rb_absint_numwords(x, 1, NULL))) {
+ numbits -= DBL_MANT_DIG;
+ x = rb_big_rshift(x, SIZET2NUM(numbits));
+ }
+ else {
+ numbits = 0;
+ }
+
Need_Float(x);
d0 = RFLOAT_VALUE(x);
/* check for domain error */
if (d0 < 0.0) domain_error("log");
/* check for pole error */
- if (d0 == 0.0) return DBL2NUM(-INFINITY);
+ if (d0 == 0.0) return -INFINITY;
d = log(d0);
- if (argc == 2) {
- Need_Float(base);
- d /= log(RFLOAT_VALUE(base));
- }
- return DBL2NUM(d);
+ if (numbits)
+ d += numbits * log(2); /* log(2**numbits) */
+ return d;
}
#ifndef log2
@@ -381,9 +510,13 @@ extern double log2(double);
/*
* call-seq:
- * Math.log2(numeric) -> float
+ * Math.log2(x) -> Float
+ *
+ * Returns the base 2 logarithm of +x+.
*
- * Returns the base 2 logarithm of <i>numeric</i>.
+ * Domain: (0, INFINITY)
+ *
+ * Codomain: (-INFINITY, INFINITY)
*
* Math.log2(1) #=> 0.0
* Math.log2(2) #=> 1.0
@@ -396,6 +529,16 @@ static VALUE
math_log2(VALUE obj, VALUE x)
{
double d0, d;
+ size_t numbits;
+
+ if (RB_BIGNUM_TYPE_P(x) && BIGNUM_POSITIVE_P(x) &&
+ DBL_MAX_EXP <= (numbits = rb_absint_numwords(x, 1, NULL))) {
+ numbits -= DBL_MANT_DIG;
+ x = rb_big_rshift(x, SIZET2NUM(numbits));
+ }
+ else {
+ numbits = 0;
+ }
Need_Float(x);
d0 = RFLOAT_VALUE(x);
@@ -404,14 +547,19 @@ math_log2(VALUE obj, VALUE x)
/* check for pole error */
if (d0 == 0.0) return DBL2NUM(-INFINITY);
d = log2(d0);
+ d += numbits;
return DBL2NUM(d);
}
/*
* call-seq:
- * Math.log10(numeric) -> float
+ * Math.log10(x) -> Float
*
- * Returns the base 10 logarithm of <i>numeric</i>.
+ * Returns the base 10 logarithm of +x+.
+ *
+ * Domain: (0, INFINITY)
+ *
+ * Codomain: (-INFINITY, INFINITY)
*
* Math.log10(1) #=> 0.0
* Math.log10(10) #=> 1.0
@@ -423,6 +571,16 @@ static VALUE
math_log10(VALUE obj, VALUE x)
{
double d0, d;
+ size_t numbits;
+
+ if (RB_BIGNUM_TYPE_P(x) && BIGNUM_POSITIVE_P(x) &&
+ DBL_MAX_EXP <= (numbits = rb_absint_numwords(x, 1, NULL))) {
+ numbits -= DBL_MANT_DIG;
+ x = rb_big_rshift(x, SIZET2NUM(numbits));
+ }
+ else {
+ numbits = 0;
+ }
Need_Float(x);
d0 = RFLOAT_VALUE(x);
@@ -431,31 +589,35 @@ math_log10(VALUE obj, VALUE x)
/* check for pole error */
if (d0 == 0.0) return DBL2NUM(-INFINITY);
d = log10(d0);
+ if (numbits)
+ d += numbits * log10(2); /* log10(2**numbits) */
return DBL2NUM(d);
}
/*
* call-seq:
- * Math.sqrt(numeric) -> float
+ * Math.sqrt(x) -> Float
+ *
+ * Returns the non-negative square root of +x+.
*
- * Returns the non-negative square root of <i>numeric</i>.
+ * Domain: [0, INFINITY)
+ *
+ * Codomain:[0, INFINITY)
*
* 0.upto(10) {|x|
* p [x, Math.sqrt(x), Math.sqrt(x)**2]
* }
- * #=>
- * [0, 0.0, 0.0]
- * [1, 1.0, 1.0]
- * [2, 1.4142135623731, 2.0]
- * [3, 1.73205080756888, 3.0]
- * [4, 2.0, 4.0]
- * [5, 2.23606797749979, 5.0]
- * [6, 2.44948974278318, 6.0]
- * [7, 2.64575131106459, 7.0]
- * [8, 2.82842712474619, 8.0]
- * [9, 3.0, 9.0]
- * [10, 3.16227766016838, 10.0]
- *
+ * #=> [0, 0.0, 0.0]
+ * # [1, 1.0, 1.0]
+ * # [2, 1.4142135623731, 2.0]
+ * # [3, 1.73205080756888, 3.0]
+ * # [4, 2.0, 4.0]
+ * # [5, 2.23606797749979, 5.0]
+ * # [6, 2.44948974278318, 6.0]
+ * # [7, 2.64575131106459, 7.0]
+ * # [8, 2.82842712474619, 8.0]
+ * # [9, 3.0, 9.0]
+ * # [10, 3.16227766016838, 10.0]
*/
static VALUE
@@ -474,33 +636,36 @@ math_sqrt(VALUE obj, VALUE x)
/*
* call-seq:
- * Math.cbrt(numeric) -> float
+ * Math.cbrt(x) -> Float
+ *
+ * Returns the cube root of +x+.
*
- * Returns the cube root of <i>numeric</i>.
+ * Domain: [0, INFINITY)
+ *
+ * Codomain:[0, INFINITY)
*
* -9.upto(9) {|x|
* p [x, Math.cbrt(x), Math.cbrt(x)**3]
* }
- * #=>
- * [-9, -2.0800838230519, -9.0]
- * [-8, -2.0, -8.0]
- * [-7, -1.91293118277239, -7.0]
- * [-6, -1.81712059283214, -6.0]
- * [-5, -1.7099759466767, -5.0]
- * [-4, -1.5874010519682, -4.0]
- * [-3, -1.44224957030741, -3.0]
- * [-2, -1.25992104989487, -2.0]
- * [-1, -1.0, -1.0]
- * [0, 0.0, 0.0]
- * [1, 1.0, 1.0]
- * [2, 1.25992104989487, 2.0]
- * [3, 1.44224957030741, 3.0]
- * [4, 1.5874010519682, 4.0]
- * [5, 1.7099759466767, 5.0]
- * [6, 1.81712059283214, 6.0]
- * [7, 1.91293118277239, 7.0]
- * [8, 2.0, 8.0]
- * [9, 2.0800838230519, 9.0]
+ * #=> [-9, -2.0800838230519, -9.0]
+ * # [-8, -2.0, -8.0]
+ * # [-7, -1.91293118277239, -7.0]
+ * # [-6, -1.81712059283214, -6.0]
+ * # [-5, -1.7099759466767, -5.0]
+ * # [-4, -1.5874010519682, -4.0]
+ * # [-3, -1.44224957030741, -3.0]
+ * # [-2, -1.25992104989487, -2.0]
+ * # [-1, -1.0, -1.0]
+ * # [0, 0.0, 0.0]
+ * # [1, 1.0, 1.0]
+ * # [2, 1.25992104989487, 2.0]
+ * # [3, 1.44224957030741, 3.0]
+ * # [4, 1.5874010519682, 4.0]
+ * # [5, 1.7099759466767, 5.0]
+ * # [6, 1.81712059283214, 6.0]
+ * # [7, 1.91293118277239, 7.0]
+ * # [8, 2.0, 8.0]
+ * # [9, 2.0800838230519, 9.0]
*
*/
@@ -513,11 +678,10 @@ math_cbrt(VALUE obj, VALUE x)
/*
* call-seq:
- * Math.frexp(numeric) -> [ fraction, exponent ]
+ * Math.frexp(x) -> [fraction, exponent]
*
- * Returns a two-element array containing the normalized fraction (a
- * <code>Float</code>) and exponent (a <code>Fixnum</code>) of
- * <i>numeric</i>.
+ * Returns a two-element array containing the normalized fraction (a Float)
+ * and exponent (a Fixnum) of +x+.
*
* fraction, exponent = Math.frexp(1234) #=> [0.6025390625, 11]
* fraction * 2**exponent #=> 1234.0
@@ -537,9 +701,9 @@ math_frexp(VALUE obj, VALUE x)
/*
* call-seq:
- * Math.ldexp(flt, int) -> float
+ * Math.ldexp(fraction, exponent) -> float
*
- * Returns the value of <i>flt</i>*(2**<i>int</i>).
+ * Returns the value of +fraction+*(2**+exponent+).
*
* fraction, exponent = Math.frexp(1234)
* Math.ldexp(fraction, exponent) #=> 1234.0
@@ -554,10 +718,10 @@ math_ldexp(VALUE obj, VALUE x, VALUE n)
/*
* call-seq:
- * Math.hypot(x, y) -> float
+ * Math.hypot(x, y) -> Float
*
- * Returns sqrt(x**2 + y**2), the hypotenuse of a right-angled triangle
- * with sides <i>x</i> and <i>y</i>.
+ * Returns sqrt(x**2 + y**2), the hypotenuse of a right-angled triangle with
+ * sides +x+ and +y+.
*
* Math.hypot(3, 4) #=> 5.0
*/
@@ -571,9 +735,16 @@ math_hypot(VALUE obj, VALUE x, VALUE y)
/*
* call-seq:
- * Math.erf(x) -> float
+ * Math.erf(x) -> Float
+ *
+ * Calculates the error function of +x+.
+ *
+ * Domain: (-INFINITY, INFINITY)
+ *
+ * Codomain: (-1, 1)
+ *
+ * Math.erf(0) #=> 0.0
*
- * Calculates the error function of x.
*/
static VALUE
@@ -585,9 +756,16 @@ math_erf(VALUE obj, VALUE x)
/*
* call-seq:
- * Math.erfc(x) -> float
+ * Math.erfc(x) -> Float
*
* Calculates the complementary error function of x.
+ *
+ * Domain: (-INFINITY, INFINITY)
+ *
+ * Codomain: (0, 2)
+ *
+ * Math.erfc(0) #=> 1.0
+ *
*/
static VALUE
@@ -599,7 +777,7 @@ math_erfc(VALUE obj, VALUE x)
/*
* call-seq:
- * Math.gamma(x) -> float
+ * Math.gamma(x) -> Float
*
* Calculates the gamma function of x.
*
@@ -690,12 +868,14 @@ math_gamma(VALUE obj, VALUE x)
* call-seq:
* Math.lgamma(x) -> [float, -1 or 1]
*
- * Calculates the logarithmic gamma of x and
- * the sign of gamma of x.
+ * Calculates the logarithmic gamma of +x+ and the sign of gamma of +x+.
*
* Math.lgamma(x) is same as
* [Math.log(Math.gamma(x).abs), Math.gamma(x) < 0 ? -1 : 1]
* but avoid overflow by Math.gamma(x) for large x.
+ *
+ * Math.lgamma(0) #=> [Infinity, 1]
+ *
*/
static VALUE
@@ -738,14 +918,16 @@ exp1(exp)
exp2(hypot)
VALUE
-rb_math_log(int argc, VALUE *argv)
+rb_math_log(int argc, const VALUE *argv)
{
- return math_log(argc, argv);
+ return math_log(argc, argv, rb_mMath);
}
exp1(sin)
exp1(sinh)
+#if 0
exp1(sqrt)
+#endif
/*
@@ -767,10 +949,12 @@ exp1(sqrt)
/*
* Document-class: Math
*
- * The <code>Math</code> module contains module functions for basic
+ * The Math module contains module functions for basic
* trigonometric and transcendental functions. See class
- * <code>Float</code> for a list of constants that
+ * Float for a list of constants that
* define Ruby's floating point accuracy.
+ *
+ * Domains and codomains are given only for real (not complex) numbers.
*/
@@ -781,12 +965,14 @@ Init_Math(void)
rb_eMathDomainError = rb_define_class_under(rb_mMath, "DomainError", rb_eStandardError);
#ifdef M_PI
+ /* Definition of the mathematical constant PI as a Float number. */
rb_define_const(rb_mMath, "PI", DBL2NUM(M_PI));
#else
rb_define_const(rb_mMath, "PI", DBL2NUM(atan(1.0)*4.0));
#endif
#ifdef M_E
+ /* Definition of the mathematical constant E (e) as a Float number. */
rb_define_const(rb_mMath, "E", DBL2NUM(M_E));
#else
rb_define_const(rb_mMath, "E", DBL2NUM(exp(1.0)));
diff --git a/method.h b/method.h
index f2f519679e..82678092c2 100644
--- a/method.h
+++ b/method.h
@@ -11,8 +11,10 @@
#ifndef METHOD_H
#define METHOD_H
+#include "internal.h"
+
#ifndef END_OF_ENUMERATION
-# ifdef __GNUC__
+# if defined(__GNUC__) &&! defined(__STRICT_ANSI__)
# define END_OF_ENUMERATION(key)
# else
# define END_OF_ENUMERATION(key) END_OF_##key##_PLACEHOLDER = 0
@@ -68,19 +70,20 @@ typedef struct rb_method_cfunc_struct {
typedef struct rb_method_attr_struct {
ID id;
- VALUE location;
+ const VALUE location;
} rb_method_attr_t;
typedef struct rb_iseq_struct rb_iseq_t;
typedef struct rb_method_definition_struct {
rb_method_type_t type; /* method type */
+ int alias_count;
ID original_id;
union {
- rb_iseq_t *iseq; /* should be mark */
+ rb_iseq_t * const iseq; /* should be mark */
rb_method_cfunc_t cfunc;
rb_method_attr_t attr;
- VALUE proc; /* should be mark */
+ const VALUE proc; /* should be mark */
enum method_optimized_type {
OPTIMIZED_METHOD_TYPE_SEND,
OPTIMIZED_METHOD_TYPE_CALL,
@@ -89,7 +92,6 @@ typedef struct rb_method_definition_struct {
} optimize_type;
struct rb_method_entry_struct *orig_me;
} body;
- int alias_count;
} rb_method_definition_t;
typedef struct rb_method_entry_struct {
@@ -110,6 +112,7 @@ struct unlinked_method_entry_list_entry {
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,
@@ -133,6 +136,6 @@ VALUE rb_obj_method_location(VALUE obj, ID id);
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);
+void rb_free_m_tbl_wrapper(struct method_table_wrapper *wrapper);
#endif /* METHOD_H */
diff --git a/miniinit.c b/miniinit.c
new file mode 100644
index 0000000000..bc6138a774
--- /dev/null
+++ b/miniinit.c
@@ -0,0 +1,30 @@
+/**********************************************************************
+
+ miniinit.c -
+
+ $Author$
+ created at: Thu Jul 11 22:09:57 JST 2013
+
+ Copyright (C) 2013 Yukihiro Matsumoto
+
+**********************************************************************/
+
+#include "ruby/ruby.h"
+#include "ruby/encoding.h"
+
+/* loadpath.c */
+const char ruby_exec_prefix[] = "";
+const char ruby_initial_load_paths[] = "";
+
+/* localeinit.c */
+VALUE
+rb_locale_charmap(VALUE klass)
+{
+ return rb_usascii_str_new2("ASCII-8BIT");
+}
+
+int
+Init_enc_set_filesystem_encoding(void)
+{
+ return rb_enc_to_index(rb_default_external_encoding());
+}
diff --git a/misc/README b/misc/README
index 93d1de90b2..08a9010f58 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 http://rubyforge.org/projects/ruby-debug/ also.
+Check out https://github.com/ruby-debug/ also.
diff --git a/misc/inf-ruby.el b/misc/inf-ruby.el
index ea03eee23d..b3f4f10267 100644
--- a/misc/inf-ruby.el
+++ b/misc/inf-ruby.el
@@ -156,6 +156,7 @@
(define-key inferior-ruby-mode-map "\C-c\C-l" 'ruby-load-file)
))
+;;;###autoload
(defun inf-ruby-keys ()
"Set local key defs for inf-ruby in ruby-mode"
(define-key ruby-mode-map "\M-\C-x" 'ruby-send-definition)
@@ -265,6 +266,7 @@ Defaults to a regexp ignoring all inputs of 0, 1, or 2 letters.")
(ruby-args-to-list (substring string pos
(length string)))))))))
+;;;###autoload
(defun run-ruby (cmd)
"Run an inferior Ruby process, input and output via buffer *ruby*.
If there is a process already running in `*ruby*', switch to that buffer.
diff --git a/misc/rdoc-mode.el b/misc/rdoc-mode.el
index ec715798ae..c26c2ee564 100644
--- a/misc/rdoc-mode.el
+++ b/misc/rdoc-mode.el
@@ -8,6 +8,8 @@
;; License: Ruby's
(require 'derived)
+
+;;;###autoload
(define-derived-mode rdoc-mode text-mode "RDoc"
"Major mode for RD editing.
\\{rdoc-mode-map}"
@@ -30,15 +32,49 @@
(run-hooks 'rdoc-mode-hook)
)
-(defun rdoc-fill-paragraph (&rest args)
+(defun rdoc-fill-paragraph (&optional justify region)
"Fills paragraph, except for cited region"
(interactive (progn
(barf-if-buffer-read-only)
(list (if current-prefix-arg 'full))))
(save-excursion
(beginning-of-line)
- (unless (looking-at "^ +")
- (apply 'fill-paragraph args))))
+ (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))))))))
(defun rdoc-setup-keys ()
(interactive)
diff --git a/misc/ruby-additional.el b/misc/ruby-additional.el
index 152067e48e..b77b5260d0 100644
--- a/misc/ruby-additional.el
+++ b/misc/ruby-additional.el
@@ -1,100 +1,126 @@
-;; missing functions in Emacs 24.
+;;; ruby-additional.el --- ruby-mode extensions yet to be merged into Emacs
-(eval-after-load "\\(\\`\\|/\\)ruby-mode\\.elc?\\(\\.gz\\)?\\'"
- (progn
- (define-key ruby-mode-map "\C-c\C-e" 'ruby-insert-end)
- (define-key ruby-mode-map "\C-c{" 'ruby-toggle-block)
+;; Authors: Yukihiro Matsumoto, Nobuyoshi Nakada, Akinori MUSHA
+;; URL: http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/misc/
+;; Created: 3 Sep 2012
+;; Package-Requires: ((emacs "24.3") (ruby-mode "1.2"))
+;; Keywords: ruby, languages
- (defun ruby-insert-end ()
- (interactive)
- (if (eq (char-syntax (char-before)) ?w)
- (insert " "))
- (insert "end")
- (save-excursion
- (if (eq (char-syntax (char-after)) ?w)
- (insert " "))
- (ruby-indent-line t)
- (end-of-line)))
+;;; Commentary:
+;;
+;; This package contains ruby-mode extensions yet to be merged into
+;; the latest released version of Emacs distribution. For older
+;; versions of Emacs, use ruby-mode.el bundled with CRuby.
- (defun ruby-brace-to-do-end ()
- (when (looking-at "{")
- (let ((orig (point)) (end (progn (ruby-forward-sexp) (point))))
- (when (eq (char-before) ?\})
- (delete-char -1)
- (if (eq (char-syntax (char-before)) ?w)
- (insert " "))
- (insert "end")
- (if (eq (char-syntax (char-after)) ?w)
- (insert " "))
- (goto-char orig)
- (delete-char 1)
- (if (eq (char-syntax (char-before)) ?w)
- (insert " "))
- (insert "do")
- (when (looking-at "\\sw\\||")
- (insert " ")
- (backward-char))
- t))))
+;;; Code:
- (defun ruby-do-end-to-brace ()
- (when (and (or (bolp)
- (not (memq (char-syntax (char-before)) '(?w ?_))))
- (looking-at "\\<do\\(\\s \\|$\\)"))
- (let ((orig (point)) (end (progn (ruby-forward-sexp) (point))))
- (backward-char 3)
- (when (looking-at ruby-block-end-re)
- (delete-char 3)
- (insert "}")
- (goto-char orig)
- (delete-char 2)
- (insert "{")
- (if (looking-at "\\s +|")
- (delete-char (- (match-end 0) (match-beginning 0) 1)))
- t))))
+(eval-when-compile
+ (require 'ruby-mode))
- (defun ruby-toggle-block ()
- (interactive)
- (or (ruby-brace-to-do-end)
- (ruby-do-end-to-brace)))
+(eval-after-load 'ruby-mode
+ '(progn
+ (define-key ruby-mode-map "\C-c\C-e" 'ruby-insert-end)
- (defun ruby-mode-set-encoding ()
- "Insert a magic comment header with the proper encoding always.
-Now encoding needs to be set always explicitly actually."
- (save-excursion
- (let ((coding-system))
- (widen)
- (goto-char (point-min))
- (if (re-search-forward "[^\0-\177]" nil t)
- (progn
- (goto-char (point-min))
- (setq coding-system
- (or coding-system-for-write
- buffer-file-coding-system))
- (if coding-system
- (setq coding-system
- (or (coding-system-get coding-system 'mime-charset)
- (coding-system-change-eol-conversion coding-system nil))))
- (setq coding-system
- (if coding-system
- (symbol-name
- (or (and ruby-use-encoding-map
- (cdr (assq coding-system ruby-encoding-map)))
- coding-system))
- "ascii-8bit")))
- (setq coding-system "us-ascii"))
- (if (looking-at "^#!") (beginning-of-line 2))
- (cond ((looking-at "\\s *#.*-\*-\\s *\\(en\\)?coding\\s *:\\s *\\([-a-z0-9_]*\\)\\s *\\(;\\|-\*-\\)")
- (unless (string= (match-string 2) coding-system)
- (goto-char (match-beginning 2))
- (delete-region (point) (match-end 2))
- (and (looking-at "-\*-")
- (let ((n (skip-chars-backward " ")))
- (cond ((= n 0) (insert " ") (backward-char))
- ((= n -1) (insert " "))
- ((forward-char)))))
- (insert coding-system)))
- ((looking-at "\\s *#.*coding\\s *[:=]"))
- (t (when ruby-insert-encoding-magic-comment
- (insert "# -*- coding: " coding-system " -*-\n")))))))
+ (defun ruby-insert-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)
+ (end-of-line)))
- ))
+ (defconst ruby-default-encoding-map
+ '((us-ascii . nil) ;; Do not put coding: us-ascii
+ (utf-8 . nil) ;; Do not put coding: utf-8
+ (shift-jis . cp932) ;; Emacs charset name of Shift_JIS
+ (shift_jis . cp932) ;; MIME charset name of Shift_JIS
+ (japanese-cp932 . cp932)) ;; Emacs charset name of CP932
+ )
+
+ (custom-set-default 'ruby-encoding-map ruby-default-encoding-map)
+
+ (defcustom ruby-encoding-map ruby-default-encoding-map
+ "Alist to map encoding name from Emacs to Ruby.
+Associating an encoding name with nil means it needs not be
+explicitly declared in magic comment."
+ :type '(repeat (cons (symbol :tag "From") (symbol :tag "To")))
+ :group 'ruby)
+
+ (defun ruby-mode-set-encoding ()
+ "Insert or update a magic comment header with the proper encoding.
+`ruby-encoding-map' is looked up to convert an encoding name from
+Emacs to Ruby."
+ (let* ((nonascii
+ (save-excursion
+ (widen)
+ (goto-char (point-min))
+ (re-search-forward "[^\0-\177]" nil t)))
+ (coding-system
+ (or coding-system-for-write
+ buffer-file-coding-system))
+ (coding-system
+ (and coding-system
+ (coding-system-change-eol-conversion coding-system nil)))
+ (coding-system
+ (and coding-system
+ (or
+ (coding-system-get coding-system :mime-charset)
+ (let ((coding-type (coding-system-get coding-system :coding-type)))
+ (cond ((eq coding-type 'undecided)
+ (if nonascii
+ (or (and (coding-system-get coding-system :prefer-utf-8)
+ 'utf-8)
+ (coding-system-get default-buffer-file-coding-system :coding-type)
+ 'ascii-8bit)))
+ ((memq coding-type '(utf-8 shift-jis))
+ coding-type)
+ (t coding-system))))))
+ (coding-system
+ (or coding-system
+ 'us-ascii))
+ (coding-system
+ (let ((cons (assq coding-system ruby-encoding-map)))
+ (if cons (cdr cons) coding-system)))
+ (coding-system
+ (and coding-system
+ (symbol-name coding-system))))
+ (if coding-system
+ (save-excursion
+ (widen)
+ (goto-char (point-min))
+ (if (looking-at "^#!") (beginning-of-line 2))
+ (cond ((looking-at "\\s *#.*-\*-\\s *\\(en\\)?coding\\s *:\\s *\\([-a-z0-9_]*\\)\\s *\\(;\\|-\*-\\)")
+ (unless (string= (match-string 2) coding-system)
+ (goto-char (match-beginning 2))
+ (delete-region (point) (match-end 2))
+ (and (looking-at "-\*-")
+ (let ((n (skip-chars-backward " ")))
+ (cond ((= n 0) (insert " ") (backward-char))
+ ((= n -1) (insert " "))
+ ((forward-char)))))
+ (insert coding-system)))
+ ((looking-at "\\s *#.*coding\\s *[:=]"))
+ (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 "}"))
+ ))
+ ))
+
+(provide 'ruby-additional)
+
+;;; ruby-additional.el ends here
diff --git a/misc/ruby-electric.el b/misc/ruby-electric.el
index 95644e24cd..b8897e7163 100644
--- a/misc/ruby-electric.el
+++ b/misc/ruby-electric.el
@@ -1,97 +1,215 @@
-;; -*-Emacs-Lisp-*-
+;;; ruby-electric.el --- Minor mode for electrically editing ruby code
;;
-;; ruby-electric.el --- electric editing commands for ruby files
-;;
-;; Copyright (C) 2005 by Dee Zsombor <dee dot zsombor at gmail dot com>.
-;; Released under same license terms as Ruby.
-;;
-;; Due credit: this work was inspired by a code snippet posted by
-;; Frederick Ros at http://rubygarden.org/ruby?EmacsExtensions.
-;;
-;; Following improvements where added:
-;;
-;; - handling of strings of type 'here document'
-;; - more keywords, with special handling for 'do'
-;; - packaged into a minor mode
-;;
-;; Usage:
-;;
-;; 0) copy ruby-electric.el into directory where emacs can find it.
-;;
-;; 1) modify your startup file (.emacs or whatever) by adding
-;; following line:
-;;
-;; (require 'ruby-electric)
-;;
-;; note that you need to have font lock enabled beforehand.
-;;
-;; 2) toggle Ruby Electric Mode on/off with ruby-electric-mode.
-;;
-;; Changelog:
-;;
-;; 2005/Jan/14: inserts matching pair delimiters like {, [, (, ', ",
-;; ' and | .
+;; Authors: Dee Zsombor <dee dot zsombor at gmail dot com>
+;; Yukihiro Matsumoto
+;; Nobuyoshi Nakada
+;; Akinori MUSHA <knu@iDaemons.org>
+;; Jakub Kuźma <qoobaa@gmail.com>
+;; Maintainer: Akinori MUSHA <knu@iDaemons.org>
+;; Created: 6 Mar 2005
+;; URL: https://github.com/knu/ruby-electric.el
+;; Keywords: languages ruby
+;; License: The same license terms as Ruby
+;; Version: 2.1.1
+
+;;; Commentary:
;;
-;; 2005/Jan/14: added basic Custom support for configuring keywords
-;; with electric closing.
+;; `ruby-electric-mode' accelerates code writing in ruby by making
+;; some keys "electric" and automatically supplying with closing
+;; parentheses and "end" as appropriate.
;;
-;; 2005/Jan/18: more Custom support for configuring characters for
-;; which matching expansion should occur.
+;; This work was originally inspired by a code snippet posted by
+;; [Frederick Ros](https://github.com/sleeper).
;;
-;; 2005/Jan/18: no longer uses 'looking-back' or regexp character
-;; classes like [:space:] since they are not implemented on XEmacs.
+;; Add the following line to enable ruby-electric-mode under
+;; ruby-mode.
;;
-;; 2005/Feb/01: explicitly provide default argument of 1 to
-;; 'backward-word' as it requires it on Emacs 21.3
+;; (eval-after-load "ruby-mode"
+;; '(add-hook 'ruby-mode-hook 'ruby-electric-mode))
;;
-;; 2005/Mar/06: now stored inside ruby CVS; customize pages now have
-;; ruby as parent; cosmetic fixes.
+;; Type M-x customize-group ruby-electric for configuration.
+;;; Code:
(require 'ruby-mode)
(defgroup ruby-electric nil
"Minor mode providing electric editing commands for ruby files"
- :group 'ruby)
+ :group 'ruby)
-(defconst ruby-electric-expandable-do-re
- "do\\s-$")
+(defconst ruby-electric-expandable-bar-re
+ "\\s-\\(do\\|{\\)\\s-*|")
-(defconst ruby-electric-expandable-bar
- "\\s-\\(do\\|{\\)\\s-+|")
+(defconst ruby-electric-delimiters-alist
+ '((?\{ :name "Curly brace" :handler ruby-electric-curlies :closing ?\})
+ (?\[ :name "Square brace" :handler ruby-electric-matching-char :closing ?\])
+ (?\( :name "Round brace" :handler ruby-electric-matching-char :closing ?\))
+ (?\' :name "Quote" :handler ruby-electric-matching-char)
+ (?\" :name "Double quote" :handler ruby-electric-matching-char)
+ (?\` :name "Back quote" :handler ruby-electric-matching-char)
+ (?\| :name "Vertical bar" :handler ruby-electric-bar)
+ (?\# :name "Hash" :handler ruby-electric-hash)))
(defvar ruby-electric-matching-delimeter-alist
- '((?\[ . ?\])
- (?\( . ?\))
- (?\' . ?\')
- (?\` . ?\`)
- (?\" . ?\")))
-
-(defcustom ruby-electric-simple-keywords-re
- (regexp-opt '("def" "if" "class" "module" "unless" "case" "while" "do" "until" "for" "begin") t)
- "*Regular expresion matching keywords for which closing 'end'
-is to be inserted."
+ (apply 'nconc
+ (mapcar #'(lambda (x)
+ (let ((delim (car x))
+ (plist (cdr x)))
+ (if (eq (plist-get plist :handler) 'ruby-electric-matching-char)
+ (list (cons delim (or (plist-get plist :closing)
+ delim))))))
+ ruby-electric-delimiters-alist)))
+
+(defvar ruby-electric-expandable-keyword-re)
+
+(defmacro ruby-electric--try-insert-and-do (string &rest body)
+ (declare (indent 1))
+ `(let ((before (point))
+ (after (progn
+ (insert ,string)
+ (point))))
+ (unwind-protect
+ (progn ,@body)
+ (delete-region before after)
+ (goto-char before))))
+
+(defconst ruby-modifier-beg-symbol-re
+ (regexp-opt ruby-modifier-beg-keywords 'symbols))
+
+(defun ruby-electric--modifier-keyword-at-point-p ()
+ "Test if there is a modifier keyword at point."
+ (and (looking-at ruby-modifier-beg-symbol-re)
+ (let ((end (match-end 1)))
+ (not (looking-back "\\."))
+ (save-excursion
+ (let ((indent1 (ruby-electric--try-insert-and-do "\n"
+ (ruby-calculate-indent)))
+ (indent2 (save-excursion
+ (goto-char end)
+ (ruby-electric--try-insert-and-do " x\n"
+ (ruby-calculate-indent)))))
+ (= indent1 indent2))))))
+
+(defconst ruby-block-mid-symbol-re
+ (regexp-opt ruby-block-mid-keywords 'symbols))
+
+(defun ruby-electric--block-mid-keyword-at-point-p ()
+ "Test if there is a block mid keyword at point."
+ (and (looking-at ruby-block-mid-symbol-re)
+ (looking-back "^\\s-*")))
+
+(defconst ruby-block-beg-symbol-re
+ (regexp-opt ruby-block-beg-keywords 'symbols))
+
+(defun ruby-electric--block-beg-keyword-at-point-p ()
+ "Test if there is a block beginning keyword at point."
+ (and (looking-at ruby-block-beg-symbol-re)
+ (if (string= (match-string 1) "do")
+ (looking-back "\\s-")
+ (not (looking-back "\\.")))
+ ;; (not (ruby-electric--modifier-keyword-at-point-p)) ;; implicit assumption
+ ))
+
+(defcustom ruby-electric-keywords-alist
+ '(("begin" . end)
+ ("case" . end)
+ ("class" . end)
+ ("def" . end)
+ ("do" . end)
+ ("else" . reindent)
+ ("elsif" . reindent)
+ ("end" . reindent)
+ ("ensure" . reindent)
+ ("for" . end)
+ ("if" . end)
+ ("module" . end)
+ ("rescue" . reindent)
+ ("unless" . end)
+ ("until" . end)
+ ("when" . reindent)
+ ("while" . end))
+ "Alist of keywords and actions to define how to react to space
+or return right after each keyword. In each (KEYWORD . ACTION)
+cons, ACTION can be set to one of the following values:
+
+ `reindent' Reindent the line.
+
+ `end' Reindent the line and auto-close the keyword with
+ end if applicable.
+
+ `nil' Do nothing.
+"
+ :type '(repeat (cons (string :tag "Keyword")
+ (choice :tag "Action"
+ :menu-tag "Action"
+ (const :tag "Auto-close with end"
+ :value end)
+ (const :tag "Auto-reindent"
+ :value reindent)
+ (const :tag "None"
+ :value nil))))
+ :set (lambda (sym val)
+ (set sym val)
+ (let (keywords)
+ (dolist (x val)
+ (let ((keyword (car x))
+ (action (cdr x)))
+ (if action
+ (setq keywords (cons keyword keywords)))))
+ (setq ruby-electric-expandable-keyword-re
+ (concat (regexp-opt keywords 'symbols)
+ "$"))))
+ :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)
+ (dolist (x ruby-electric-delimiters-alist)
+ (let* ((delim (car x))
+ (plist (cdr x))
+ (name (plist-get plist :name))
+ (func (plist-get plist :handler))
+ (closing (plist-get plist :closing)))
+ (define-key map (char-to-string delim) func)
+ (if closing
+ (define-key map (char-to-string closing) 'ruby-electric-closing-char))))
+ map)
+ "Keymap used in ruby-electric-mode")
+
(defcustom ruby-electric-expand-delimiters-list '(all)
- "*List of contexts where matching delimiter should be
-inserted. The word 'all' will do all insertions."
- :type '(set :extra-offset 8
- (const :tag "Everything" all )
- (const :tag "Curly brace" ?\{ )
- (const :tag "Square brace" ?\[ )
- (const :tag "Round brace" ?\( )
- (const :tag "Quote" ?\' )
- (const :tag "Double quote" ?\" )
- (const :tag "Back quote" ?\` )
- (const :tag "Vertical bar" ?\| ))
+ "*List of contexts where matching delimiter should be inserted.
+The word 'all' will do all insertions."
+ :type `(set :extra-offset 8
+ (const :tag "Everything" all)
+ ,@(apply 'list
+ (mapcar #'(lambda (x)
+ `(const :tag ,(plist-get (cdr x) :name)
+ ,(car x)))
+ ruby-electric-delimiters-alist)))
:group 'ruby-electric)
(defcustom ruby-electric-newline-before-closing-bracket nil
- "*Controls whether a newline should be inserted before the
-closing bracket or not."
+ "*Non-nil means a newline should be inserted before an
+automatically inserted closing bracket."
+ :type 'boolean :group 'ruby-electric)
+
+(defcustom ruby-electric-autoindent-on-closing-char nil
+ "*Non-nil means the current line should be automatically
+indented when a closing character is manually typed in."
:type 'boolean :group 'ruby-electric)
+(defvar ruby-electric-mode-hook nil
+ "Called after `ruby-electric-mode' is turned on.")
+
+;;;###autoload
(define-minor-mode ruby-electric-mode
"Toggle Ruby Electric minor mode.
With no argument, this command toggles the mode. Non-null prefix
@@ -101,34 +219,66 @@ mode.
When Ruby Electric mode is enabled, an indented 'end' is
heuristicaly inserted whenever typing a word like 'module',
'class', 'def', 'if', 'unless', 'case', 'until', 'for', 'begin',
-'do'. Simple, double and back quotes as well as braces are paired
-auto-magically. Expansion does not occur inside comments and
-strings. Note that you must have Font Lock enabled."
+'do' followed by a space. Single, double and back quotes as well
+as braces are paired auto-magically. Expansion does not occur
+inside comments and strings. Note that you must have Font Lock
+enabled."
;; initial value.
nil
;;indicator for the mode line.
" REl"
;;keymap
- ruby-mode-map
- (ruby-electric-setup-keymap))
-
-(defun ruby-electric-setup-keymap()
- (define-key ruby-mode-map " " 'ruby-electric-space)
- (define-key ruby-mode-map "{" 'ruby-electric-curlies)
- (define-key ruby-mode-map "(" 'ruby-electric-matching-char)
- (define-key ruby-mode-map "[" 'ruby-electric-matching-char)
- (define-key ruby-mode-map "\"" 'ruby-electric-matching-char)
- (define-key ruby-mode-map "\'" 'ruby-electric-matching-char)
- (define-key ruby-mode-map "|" 'ruby-electric-bar))
-
-(defun ruby-electric-space (arg)
- (interactive "P")
- (self-insert-command (prefix-numeric-value arg))
- (if (ruby-electric-space-can-be-expanded-p)
- (save-excursion
- (ruby-indent-line t)
- (newline)
- (ruby-insert-end))))
+ ruby-electric-mode-map
+ (if ruby-electric-mode
+ (run-hooks 'ruby-electric-mode-hook)))
+
+(defun ruby-electric-space/return-fallback ()
+ (if (or (eq this-original-command 'ruby-electric-space/return)
+ (null (ignore-errors
+ ;; ac-complete may fail if there is nothing left to complete
+ (call-interactively this-original-command)
+ (setq this-command this-original-command))))
+ ;; fall back to a globally bound command
+ (let ((command (global-key-binding (char-to-string last-command-event) t)))
+ (and command
+ (call-interactively (setq this-command command))))))
+
+(defun ruby-electric-space/return (arg)
+ (interactive "*P")
+ (and (boundp 'sp-last-operation)
+ (setq sp-delayed-pair nil))
+ (cond (arg
+ (insert (make-string (prefix-numeric-value arg) last-command-event)))
+ ((ruby-electric-space/return-can-be-expanded-p)
+ (let (action)
+ (save-excursion
+ (goto-char (match-beginning 0))
+ (let* ((keyword (match-string 1))
+ (allowed-actions
+ (cond ((ruby-electric--modifier-keyword-at-point-p)
+ '(reindent)) ;; no end necessary
+ ((ruby-electric--block-mid-keyword-at-point-p)
+ '(reindent)) ;; ditto
+ ((ruby-electric--block-beg-keyword-at-point-p)
+ '(end reindent)))))
+ (if allowed-actions
+ (setq action
+ (let ((action (cdr (assoc keyword ruby-electric-keywords-alist))))
+ (and (memq action allowed-actions)
+ action))))))
+ (cond ((eq action 'end)
+ (ruby-indent-line)
+ (save-excursion
+ (newline)
+ (ruby-insert-end)))
+ ((eq action 'reindent)
+ (ruby-indent-line)))
+ (ruby-electric-space/return-fallback)))
+ ((and (eq this-original-command 'newline-and-indent)
+ (ruby-electric-comment-at-point-p))
+ (call-interactively (setq this-command 'comment-indent-new-line)))
+ (t
+ (ruby-electric-space/return-fallback))))
(defun ruby-electric-code-at-point-p()
(and ruby-electric-mode
@@ -140,66 +290,186 @@ strings. Note that you must have Font Lock enabled."
(and ruby-electric-mode
(consp (memq 'font-lock-string-face (text-properties-at (point))))))
-(defun ruby-electric-is-last-command-char-expandable-punct-p()
+(defun ruby-electric-comment-at-point-p()
+ (and ruby-electric-mode
+ (consp (memq 'font-lock-comment-face (text-properties-at (point))))))
+
+(defun ruby-electric-escaped-p()
+ (let ((f nil))
+ (save-excursion
+ (while (char-equal ?\\ (preceding-char))
+ (backward-char 1)
+ (setq f (not f))))
+ f))
+
+(defun ruby-electric-command-char-expandable-punct-p(char)
(or (memq 'all ruby-electric-expand-delimiters-list)
- (memq last-command-event ruby-electric-expand-delimiters-list)))
-
-(defun ruby-electric-space-can-be-expanded-p()
- (if (ruby-electric-code-at-point-p)
- (let* ((ruby-electric-keywords-re
- (concat ruby-electric-simple-keywords-re "\\s-$"))
- (ruby-electric-single-keyword-in-line-re
- (concat "\\s-*" ruby-electric-keywords-re)))
- (save-excursion
- (backward-word 1)
- (or (looking-at ruby-electric-expandable-do-re)
- (and (looking-at ruby-electric-keywords-re)
- (not (string= "do" (match-string 1)))
- (progn
- (beginning-of-line)
- (looking-at ruby-electric-single-keyword-in-line-re))))))))
+ (memq char ruby-electric-expand-delimiters-list)))
+
+(defun ruby-electric-space/return-can-be-expanded-p()
+ (and (ruby-electric-code-at-point-p)
+ (looking-back ruby-electric-expandable-keyword-re)))
+
+(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 ((ruby-electric-cua-replace-region-maybe))
+ ((and
+ (null ,arg)
+ (ruby-electric-command-char-expandable-punct-p last-command-event))
+ (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")
- (self-insert-command (prefix-numeric-value arg))
- (if (ruby-electric-is-last-command-char-expandable-punct-p)
- (cond ((ruby-electric-code-at-point-p)
- (insert " ")
- (save-excursion
- (if ruby-electric-newline-before-closing-bracket
- (progn
- (newline)
- (insert "}")
- (ruby-indent-line t))
- (insert "}"))))
- ((ruby-electric-string-at-point-p)
- (if (eq last-command-event ?{)
- (save-excursion
+ (interactive "*P")
+ (ruby-electric-insert
+ arg
+ (cond
+ ((ruby-electric-code-at-point-p)
+ (insert "}")
+ (backward-char 1)
+ (redisplay)
+ (cond
+ ((ruby-electric-string-at-point-p) ;; %w{}, %r{}, etc.
+ t)
+ (ruby-electric-newline-before-closing-bracket
+ (insert " ")
+ (save-excursion
+ (newline)
+ (ruby-indent-line t)))
+ (t
+ (insert " ")
+ (backward-char 1))))
+ ((ruby-electric-string-at-point-p)
+ (save-excursion
+ (backward-char 1)
+ (cond
+ ((char-equal ?\# (preceding-char))
+ (unless (save-excursion
(backward-char 1)
- (or (char-equal ?\# (preceding-char))
- (insert "#"))
- (forward-char 1)
- (insert "}")))))))
+ (ruby-electric-escaped-p))
+ (forward-char 1)
+ (insert "}")))
+ ((or
+ (ruby-electric-command-char-expandable-punct-p ?\#)
+ (ruby-electric-escaped-p))
+ (setq this-command 'self-insert-command))
+ (t
+ (insert "#")
+ (forward-char 1)
+ (insert "}")))))
+ (t
+ (setq this-command 'self-insert-command)))))
-(defun ruby-electric-matching-char(arg)
- (interactive "P")
- (self-insert-command (prefix-numeric-value arg))
- (and (ruby-electric-is-last-command-char-expandable-punct-p)
- (ruby-electric-code-at-point-p)
+(defun ruby-electric-hash(arg)
+ (interactive "*P")
+ (ruby-electric-insert
+ 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 (cdr (assoc last-command-event
- ruby-electric-matching-delimeter-alist))))))
+ (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
+ ((char-equal closing last-command-event)
+ (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)
+ (save-excursion (insert closing)))))))
+
+(defun ruby-electric-closing-char(arg)
+ (interactive "*P")
+ (cond
+ ((ruby-electric-cua-replace-region-maybe))
+ (arg
+ (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 ?})) ;; {}
+ (if (char-equal (following-char) ?\n) (delete-char 1))
+ (delete-horizontal-space)
+ (forward-char))
+ ((and
+ (= last-command-event (following-char))
+ (memq last-command '(ruby-electric-matching-char
+ ruby-electric-closing-char))) ;; ()/[] and (())/[[]]
+ (forward-char))
+ (t
+ (setq this-command 'self-insert-command)
+ (self-insert-command 1)
+ (if ruby-electric-autoindent-on-closing-char
+ (ruby-indent-line)))))
(defun ruby-electric-bar(arg)
- (interactive "P")
- (self-insert-command (prefix-numeric-value arg))
- (and (ruby-electric-is-last-command-char-expandable-punct-p)
- (ruby-electric-code-at-point-p)
- (and (save-excursion (re-search-backward ruby-electric-expandable-bar nil t))
- (= (point) (match-end 0))) ;looking-back is missing on XEmacs
- (save-excursion
- (insert "|"))))
+ (interactive "*P")
+ (ruby-electric-insert
+ arg
+ (cond ((and (ruby-electric-code-at-point-p)
+ (looking-back ruby-electric-expandable-bar-re))
+ (save-excursion (insert "|")))
+ (t
+ (setq this-command 'self-insert-command)))))
+(defun ruby-electric-delete-backward-char(arg)
+ (interactive "*p")
+ (cond ((memq last-command '(ruby-electric-matching-char
+ ruby-electric-bar))
+ (delete-char 1))
+ ((eq last-command 'ruby-electric-curlies)
+ (cond ((eolp)
+ (cond ((char-equal (preceding-char) ?\s)
+ (setq this-command last-command))
+ ((char-equal (preceding-char) ?{)
+ (and (looking-at "[ \t\n]*}")
+ (delete-char (- (match-end 0) (match-beginning 0)))))))
+ ((char-equal (following-char) ?\s)
+ (setq this-command last-command)
+ (delete-char 1))
+ ((char-equal (following-char) ?})
+ (delete-char 1))))
+ ((eq last-command 'ruby-electric-hash)
+ (and (char-equal (preceding-char) ?{)
+ (delete-char 1))))
+ (delete-char (- arg)))
(provide 'ruby-electric)
+
+;;; ruby-electric.el ends here
diff --git a/misc/ruby-mode.el b/misc/ruby-mode.el
index dcaa396a2e..553591f3c9 100644
--- a/misc/ruby-mode.el
+++ b/misc/ruby-mode.el
@@ -240,8 +240,16 @@ Also ignores spaces after parenthesis when 'space."
"Default deep indent style."
:options '(t nil space) :group 'ruby)
-(defcustom ruby-encoding-map '((shift_jis . cp932) (shift-jis . cp932))
- "Alist to map encoding name from emacs to ruby."
+(defcustom ruby-encoding-map
+ '((us-ascii . nil) ;; Do not put coding: us-ascii
+ (utf-8 . nil) ;; Do not put coding: utf-8
+ (shift-jis . cp932) ;; Emacs charset name of Shift_JIS
+ (shift_jis . cp932) ;; MIME charset name of Shift_JIS
+ (japanese-cp932 . cp932)) ;; Emacs charset name of CP932
+ "Alist to map encoding name from Emacs to Ruby.
+Associating an encoding name with nil means it needs not be
+explicitly declared in magic comment."
+ :type '(repeat (cons (symbol :tag "From") (symbol :tag "To")))
:group 'ruby)
(defcustom ruby-use-encoding-map t
@@ -326,39 +334,61 @@ Also ignores spaces after parenthesis when 'space."
(setq paragraph-ignore-fill-prefix t))
(defun ruby-mode-set-encoding ()
- (save-excursion
- (widen)
- (goto-char (point-min))
- (when (re-search-forward "[^\0-\177]" nil t)
- (goto-char (point-min))
- (let ((coding-system
- (or coding-system-for-write
- buffer-file-coding-system)))
- (if coding-system
- (setq coding-system
- (or (coding-system-get coding-system 'mime-charset)
- (coding-system-change-eol-conversion coding-system nil))))
- (setq coding-system
- (if coding-system
- (symbol-name
- (or (and ruby-use-encoding-map
- (cdr (assq coding-system ruby-encoding-map)))
- coding-system))
- "ascii-8bit"))
- (if (looking-at "^#!") (beginning-of-line 2))
- (cond ((looking-at "\\s *#.*-\*-\\s *\\(en\\)?coding\\s *:\\s *\\([-a-z0-9_]*\\)\\s *\\(;\\|-\*-\\)")
- (unless (string= (match-string 2) coding-system)
- (goto-char (match-beginning 2))
- (delete-region (point) (match-end 2))
- (and (looking-at "-\*-")
- (let ((n (skip-chars-backward " ")))
- (cond ((= n 0) (insert " ") (backward-char))
- ((= n -1) (insert " "))
- ((forward-char)))))
- (insert coding-system)))
- ((looking-at "\\s *#.*coding\\s *[:=]"))
- (t (insert "# -*- coding: " coding-system " -*-\n"))
- )))))
+ "Insert or update a magic comment header with the proper encoding.
+`ruby-encoding-map' is looked up to convert an encoding name from
+Emacs to Ruby."
+ (let* ((nonascii
+ (save-excursion
+ (widen)
+ (goto-char (point-min))
+ (re-search-forward "[^\0-\177]" nil t)))
+ (coding-system
+ (or coding-system-for-write
+ buffer-file-coding-system))
+ (coding-system
+ (and coding-system
+ (coding-system-change-eol-conversion coding-system nil)))
+ (coding-system
+ (and coding-system
+ (or
+ (coding-system-get coding-system :mime-charset)
+ (let ((coding-type (coding-system-get coding-system :coding-type)))
+ (cond ((eq coding-type 'undecided)
+ (if nonascii
+ (or (and (coding-system-get coding-system :prefer-utf-8)
+ 'utf-8)
+ (coding-system-get default-buffer-file-coding-system :coding-type)
+ 'ascii-8bit)))
+ ((memq coding-type '(utf-8 shift-jis))
+ coding-type)
+ (t coding-system))))))
+ (coding-system
+ (or coding-system
+ 'us-ascii))
+ (coding-system
+ (let ((cons (assq coding-system ruby-encoding-map)))
+ (if cons (cdr cons) coding-system)))
+ (coding-system
+ (and coding-system
+ (symbol-name coding-system))))
+ (if coding-system
+ (save-excursion
+ (widen)
+ (goto-char (point-min))
+ (if (looking-at "^#!") (beginning-of-line 2))
+ (cond ((looking-at "\\s *#.*-\*-\\s *\\(en\\)?coding\\s *:\\s *\\([-a-z0-9_]*\\)\\s *\\(;\\|-\*-\\)")
+ (unless (string= (match-string 2) coding-system)
+ (goto-char (match-beginning 2))
+ (delete-region (point) (match-end 2))
+ (and (looking-at "-\*-")
+ (let ((n (skip-chars-backward " ")))
+ (cond ((= n 0) (insert " ") (backward-char))
+ ((= n -1) (insert " "))
+ ((forward-char)))))
+ (insert coding-system)))
+ ((looking-at "\\s *#.*coding\\s *[:=]"))
+ (t (when ruby-insert-encoding-magic-comment
+ (insert "# -*- coding: " coding-system " -*-\n"))))))))
(defun ruby-current-indentation ()
(save-excursion
@@ -418,7 +448,7 @@ Also ignores spaces after parenthesis when 'space."
((progn
(forward-char -1)
(and (looking-at "\\?")
- (or (eq (char-syntax (char-before (point))) ?w)
+ (or (eq (char-syntax (preceding-char)) ?w)
(ruby-special-char-p))))
nil)
((and (eq option 'heredoc) (< space 0))
@@ -874,7 +904,7 @@ Also ignores spaces after parenthesis when 'space."
(defun ruby-electric-brace (arg)
(interactive "P")
- (insert-char last-command-char 1)
+ (insert-char last-command-event 1)
(ruby-indent-line t)
(delete-char -1)
(self-insert-command (prefix-numeric-value arg)))
@@ -1168,36 +1198,76 @@ balanced expression is found."
(defun ruby-brace-to-do-end ()
(when (looking-at "{")
- (let ((orig (point)) (end (progn (ruby-forward-sexp) (point))))
+ (let ((orig (point)) (end (progn (ruby-forward-sexp) (point)))
+ oneline (end (make-marker)))
+ (setq oneline (and (eolp) (<= (point-at-bol) orig)))
(when (eq (char-before) ?\})
(delete-char -1)
- (if (eq (char-syntax (char-before)) ?w)
- (insert " "))
+ (cond
+ (oneline
+ (insert "\n")
+ (set-marker end (point)))
+ ((eq (char-syntax (preceding-char)) ?w)
+ (insert " ")))
(insert "end")
- (if (eq (char-syntax (char-after)) ?w)
+ (if (eq (char-syntax (following-char)) ?w)
(insert " "))
(goto-char orig)
(delete-char 1)
- (if (eq (char-syntax (char-before)) ?w)
+ (if (eq (char-syntax (preceding-char)) ?w)
(insert " "))
(insert "do")
(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 (char-before)) '(?w ?_))))
+ (not (memq (char-syntax (preceding-char)) '(?w ?_))))
(looking-at "\\<do\\(\\s \\|$\\)"))
- (let ((orig (point)) (end (progn (ruby-forward-sexp) (point))))
+ (let ((orig (point)) (end (progn (ruby-forward-sexp) (point)))
+ first last)
(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))))
diff --git a/misc/ruby-style.el b/misc/ruby-style.el
index 3ce55cd1ab..f81861afea 100644
--- a/misc/ruby-style.el
+++ b/misc/ruby-style.el
@@ -64,6 +64,7 @@
(access-label /)
)))
+;;;###autoload
(defun ruby-style-c-mode ()
(interactive)
(if (or (let ((name (buffer-file-name))) (and name (string-match "/ruby\\>" name)))
diff --git a/missing/crypt.c b/missing/crypt.c
index 68a4d2bf13..366fba0919 100644
--- a/missing/crypt.c
+++ b/missing/crypt.c
@@ -628,7 +628,7 @@ des_setkey(key)
/*
* Encrypt (or decrypt if num_iter < 0) the 8 chars at "in" with abs(num_iter)
- * iterations of DES, using the the given 24-bit salt and the pre-computed key
+ * iterations of DES, using the given 24-bit salt and the pre-computed key
* schedule, and store the resulting 8 chars at "out" (in == out is permitted).
*
* NOTE: the performance of this routine is critically dependent on your
diff --git a/missing/file.h b/missing/file.h
index 2d491d0fc1..241d716563 100644
--- a/missing/file.h
+++ b/missing/file.h
@@ -15,7 +15,7 @@
#ifndef R_OK
# define R_OK 4 /* test whether readable. */
# define W_OK 2 /* test whether writable. */
-# define X_OK 1 /* test whether execubale. */
+# define X_OK 1 /* test whether executable. */
# define F_OK 0 /* test whether exist. */
#endif
diff --git a/missing/flock.c b/missing/flock.c
index 435d66aefb..829f431ddc 100644
--- a/missing/flock.c
+++ b/missing/flock.c
@@ -4,7 +4,7 @@
#if defined _WIN32
#elif defined HAVE_FCNTL && defined HAVE_FCNTL_H && !defined(__native_client__)
-/* These are the flock() constants. Since this sytems doesn't have
+/* These are the flock() constants. Since this systems doesn't have
flock(), the values of the constants are probably not available.
*/
# ifndef LOCK_SH
@@ -73,7 +73,7 @@ flock(int fd, int operation)
# define F_TEST 3 /* Test a region for other processes locks */
# endif
-/* These are the flock() constants. Since this sytems doesn't have
+/* These are the flock() constants. Since this systems doesn't have
flock(), the values of the constants are probably not available.
*/
# ifndef LOCK_SH
diff --git a/missing/isnan.c b/missing/isnan.c
index 5846947f50..ed10bf5cd6 100644
--- a/missing/isnan.c
+++ b/missing/isnan.c
@@ -2,6 +2,20 @@
#include "ruby/missing.h"
+/*
+ * isnan() may be a macro, a function or both.
+ * (The C99 standard defines that isnan() is a macro, though.)
+ * http://www.gnu.org/software/automake/manual/autoconf/Function-Portability.html
+ *
+ * macro only: uClibc
+ * both: GNU libc
+ *
+ * This file is compile if no isnan() function is available.
+ * (autoconf AC_REPLACE_FUNCS detects only the function.)
+ * The macro is detected by following #ifndef.
+ */
+
+#ifndef isnan
static int double_ne(double n1, double n2);
int
@@ -15,3 +29,4 @@ double_ne(double n1, double n2)
{
return n1 != n2;
}
+#endif
diff --git a/missing/nextafter.c b/missing/nextafter.c
new file mode 100644
index 0000000000..dd1f1f2319
--- /dev/null
+++ b/missing/nextafter.c
@@ -0,0 +1,77 @@
+#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/nacl/README.nacl b/nacl/README.nacl
index e70f272715..471c3b5e5f 100644
--- a/nacl/README.nacl
+++ b/nacl/README.nacl
@@ -12,7 +12,7 @@ You need to install the following things before building NaCl port of Ruby.
== Steps
(1) Extract all files from the tarball:
$ tar xzf ruby-X.Y.Z.tar.gz
-(2) Set NACL_SDK_ROOT environment vairanble to the path to the Native Client SDK you installed:
+(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_16
(3) Configure
$ ./configure --prefix=/tmp/nacl-ruby --host=x86_64-nacl --with-baseruby=/path/to/ruby-1.9.3
diff --git a/nacl/nacl-config.rb b/nacl/nacl-config.rb
index b90c9ed100..2da05c0847 100644..100755
--- a/nacl/nacl-config.rb
+++ b/nacl/nacl-config.rb
@@ -34,7 +34,7 @@ module NaClConfig
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"
+ ].find{|path| File.exist?(path)} or raise "No irt_core found"
RUNNABLE_LD = File.join(HOST_LIB, 'runnable-ld.so')
module_function
diff --git a/node.c b/node.c
index 472a959ef9..cf334e3db4 100644
--- a/node.c
+++ b/node.c
@@ -169,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");
@@ -189,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;
@@ -252,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");
@@ -297,10 +297,15 @@ 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;
- F_NODE(nd_value, "rvalue");
+ if (node->nd_value == (NODE *)-1) {
+ F_MSG(nd_value, "rvalue", "(required keyword argument)");
+ }
+ else {
+ F_NODE(nd_value, "rvalue");
+ }
break;
case NODE_GASGN:
@@ -350,9 +355,9 @@ dump_node(VALUE buf, VALUE indent, int comment, NODE *node)
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);
+ case 0: A("0 (||)"); break;
+ case 1: A("1 (&&)"); break;
+ default: A_ID(node->nd_next->nd_mid);
}
});
LAST_NODE;
@@ -368,7 +373,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");
@@ -423,7 +428,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;
@@ -476,7 +481,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;
@@ -546,7 +551,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;
@@ -574,7 +579,7 @@ 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:
+ dlit:
F_LIT(nd_lit, "literal");
F_NODE(nd_next->nd_head, "preceding string");
LAST_NODE;
@@ -731,7 +736,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");
@@ -897,3 +902,184 @@ 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;
+
+ case NODE_CREF:
+ rb_gc_mark(obj->nd_refinements);
+ rb_gc_mark(RNODE(obj)->nd_clss);
+ return (VALUE)RNODE(obj)->nd_next;
+
+ 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 0fa72545c2..5055af438f 100644
--- a/node.h
+++ b/node.h
@@ -265,10 +265,16 @@ typedef struct RNode {
#define RNODE(obj) (R_CAST(RNode)(obj))
-/* 0..4:T_TYPES, 5:reserved, 6:NODE_FL_CREF_OMOD_SHARED, 7:NODE_FL_NEWLINE */
-#define NODE_FL_NEWLINE (((VALUE)1)<<7)
-#define NODE_FL_CREF_PUSHED_BY_EVAL NODE_FL_NEWLINE
-#define NODE_FL_CREF_OMOD_SHARED (((VALUE)1)<<6)
+/* 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 or
+ * 15: NODE_FL_CREF_PUSHED_BY_EVAL
+ * 16: NODE_FL_CREF_OMOD_SHARED
+ */
+#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)
@@ -462,13 +468,9 @@ typedef struct RNode {
#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))
+ ((value) = rb_ary_tmp_new_fill(roomof(type, VALUE)), MEMO_FOR(type, value))
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
+RUBY_SYMBOL_EXPORT_BEGIN
VALUE rb_parser_new(void);
VALUE rb_parser_end_seen_p(VALUE);
@@ -482,6 +484,8 @@ NODE *rb_parser_while_loop(VALUE, NODE *, int, int);
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);
@@ -489,6 +493,9 @@ 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;
@@ -525,9 +532,7 @@ 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 *);
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
-#endif
+RUBY_SYMBOL_EXPORT_END
#if defined(__cplusplus)
#if 0
diff --git a/numeric.c b/numeric.c
index c32b035e7b..2fdfaafda0 100644
--- a/numeric.c
+++ b/numeric.c
@@ -30,6 +30,14 @@
#include <ieeefp.h>
#endif
+#if !defined HAVE_ISFINITE && !defined isfinite
+#if defined HAVE_FINITE && !defined finite && !defined _WIN32
+extern int finite(double);
+# define HAVE_ISFINITE 1
+# define isfinite(x) finite(x)
+#endif
+#endif
+
/* use IEEE 64bit values if not defined */
#ifndef FLT_RADIX
#define FLT_RADIX 2
@@ -101,7 +109,10 @@ 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_to_i, id_eq, id_div;
+static ID id_coerce, id_div;
+#define id_to_i idTo_i
+#define id_eq idEq
+#define id_cmp idCmp
VALUE rb_cNumeric;
VALUE rb_cFloat;
@@ -111,6 +122,8 @@ VALUE rb_cFixnum;
VALUE rb_eZeroDivError;
VALUE rb_eFloatDomainError;
+static ID id_to, id_by;
+
void
rb_num_zerodiv(void)
{
@@ -134,16 +147,14 @@ rb_num_to_uint(VALUE val, unsigned int *ret)
return 0;
}
- switch (TYPE(val)) {
- case T_BIGNUM:
- if (RBIGNUM_NEGATIVE_P(val)) return NUMERR_NEGATIVE;
+ if (RB_TYPE_P(val, T_BIGNUM)) {
+ if (BIGNUM_NEGATIVE_P(val)) return NUMERR_NEGATIVE;
#if SIZEOF_INT < SIZEOF_LONG
/* long is 64bit */
return NUMERR_TOOLARGE;
#else
/* long is 32bit */
-#define DIGSPERLONG (SIZEOF_LONG/SIZEOF_BDIGITS)
- if (RBIGNUM_LEN(val) > DIGSPERLONG) return NUMERR_TOOLARGE;
+ if (rb_absint_size(val, NULL) > sizeof(int)) return NUMERR_TOOLARGE;
*ret = (unsigned int)rb_big2ulong((VALUE)val);
return 0;
#endif
@@ -164,7 +175,7 @@ positive_int_p(VALUE num)
}
else if (RB_TYPE_P(num, T_BIGNUM)) {
if (method_basic_p(rb_cBignum))
- return RBIGNUM_POSITIVE_P(num);
+ return BIGNUM_POSITIVE_P(num);
}
return RTEST(rb_funcall(num, mid, 1, INT2FIX(0)));
}
@@ -180,7 +191,7 @@ negative_int_p(VALUE num)
}
else if (RB_TYPE_P(num, T_BIGNUM)) {
if (method_basic_p(rb_cBignum))
- return RBIGNUM_NEGATIVE_P(num);
+ return BIGNUM_NEGATIVE_P(num);
}
return RTEST(rb_funcall(num, mid, 1, INT2FIX(0)));
}
@@ -195,12 +206,13 @@ rb_num_negative_p(VALUE num)
* call-seq:
* num.coerce(numeric) -> array
*
- * If <i>aNumeric</i> is the same type as <i>num</i>, returns an array
- * containing <i>aNumeric</i> and <i>num</i>. Otherwise, returns an
- * array with both <i>aNumeric</i> and <i>num</i> represented as
- * <code>Float</code> objects. This coercion mechanism is used by
- * Ruby to handle mixed-type numeric operations: it is intended to
- * find a compatible common type between the two operands of the operator.
+ * 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.
+ *
+ * This coercion mechanism is used by Ruby to handle mixed-type numeric
+ * operations: it is intended to find a compatible common type between the two
+ * operands of the operator.
*
* 1.coerce(2.5) #=> [2.5, 1.0]
* 1.2.coerce(3) #=> [3.0, 1.2]
@@ -223,20 +235,28 @@ 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)
+{
+ rb_raise(rb_eTypeError, "%"PRIsVALUE" can't be coerced into %"PRIsVALUE,
+ (rb_special_const_p(y)? rb_inspect(y) : rb_obj_class(y)),
+ rb_obj_class(x));
+}
+
static VALUE
coerce_rescue(VALUE *x)
{
- volatile VALUE v = rb_inspect(x[1]);
-
- 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]));
-
+ coerce_failed(x[0], x[1]);
return Qnil; /* dummy */
}
+static VALUE
+coerce_rescue_quiet(VALUE *x)
+{
+ return Qundef;
+}
+
static int
do_coerce(VALUE *x, VALUE *y, int err)
{
@@ -252,16 +272,24 @@ do_coerce(VALUE *x, VALUE *y, int err)
return FALSE;
}
- ary = rb_rescue(coerce_body, (VALUE)a, err ? coerce_rescue : 0, (VALUE)a);
+ 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;
+ }
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;
}
- *x = RARRAY_PTR(ary)[0];
- *y = RARRAY_PTR(ary)[1];
+ *x = RARRAY_AREF(ary, 0);
+ *y = RARRAY_AREF(ary, 1);
return TRUE;
}
@@ -294,8 +322,9 @@ rb_num_coerce_relop(VALUE x, VALUE y, ID func)
}
/*
- * Trap attempts to add methods to <code>Numeric</code> objects. Always
- * raises a <code>TypeError</code>
+ * Trap attempts to add methods to Numeric objects. Always raises a TypeError.
+ *
+ * Numerics should be values; singleton_methods should not be added to them.
*/
static VALUE
@@ -303,22 +332,24 @@ num_sadded(VALUE x, VALUE name)
{
ID mid = rb_to_id(name);
/* ruby_frame = ruby_frame->prev; */ /* pop frame for "singleton_method_added" */
- /* Numerics should be values; singleton_methods should not be added to them */
rb_remove_method_id(rb_singleton_class(x), mid);
rb_raise(rb_eTypeError,
- "can't define singleton method \"%s\" for %s",
- rb_id2name(mid),
- rb_obj_classname(x));
+ "can't define singleton method \"%"PRIsVALUE"\" for %"PRIsVALUE,
+ rb_id2str(mid),
+ rb_obj_class(x));
UNREACHABLE;
}
-/* :nodoc: */
+/*
+ * Numerics are immutable values, which should not be copied.
+ *
+ * Any attempt to use this method on a Numeric will raise a TypeError.
+ */
static VALUE
num_init_copy(VALUE x, VALUE y)
{
- /* Numerics are immutable values, which should not be copied */
- rb_raise(rb_eTypeError, "can't copy %s", rb_obj_classname(x));
+ rb_raise(rb_eTypeError, "can't copy %"PRIsVALUE, rb_obj_class(x));
UNREACHABLE;
}
@@ -371,20 +402,6 @@ num_uminus(VALUE num)
/*
* call-seq:
- * num.quo(numeric) -> real
- *
- * Returns most exact division (rational for integers, float for floats).
- */
-
-static VALUE
-num_quo(VALUE x, VALUE y)
-{
- return rb_funcall(rb_rational_raw1(x), '/', 1, y);
-}
-
-
-/*
- * call-seq:
* num.fdiv(numeric) -> float
*
* Returns float division.
@@ -401,14 +418,12 @@ num_fdiv(VALUE x, VALUE y)
* call-seq:
* num.div(numeric) -> integer
*
- * Uses <code>/</code> to perform division, then converts the result to
- * an integer. <code>numeric</code> does not define the <code>/</code>
- * operator; this is left to subclasses.
+ * Uses +/+ to perform division, then converts the result to an integer.
+ * +numeric+ does not define the +/+ operator; this is left to subclasses.
*
- * Equivalent to
- * <i>num</i>.<code>divmod(</code><i>aNumeric</i><code>)[0]</code>.
+ * Equivalent to <code>num.divmod(numeric)[0]</code>.
*
- * See <code>Numeric#divmod</code>.
+ * See Numeric#divmod.
*/
static VALUE
@@ -425,10 +440,9 @@ num_div(VALUE x, VALUE y)
*
* x.modulo(y) means x-y*(x/y).floor
*
- * Equivalent to
- * <i>num</i>.<code>divmod(</code><i>aNumeric</i><code>)[1]</code>.
+ * Equivalent to <code>num.divmod(numeric)[1]</code>.
*
- * See <code>Numeric#divmod</code>.
+ * See Numeric#divmod.
*/
static VALUE
@@ -445,7 +459,7 @@ num_modulo(VALUE x, VALUE y)
*
* x.remainder(y) means x-y*(x/y).truncate
*
- * See <code>Numeric#divmod</code>.
+ * See Numeric#divmod.
*/
static VALUE
@@ -467,9 +481,10 @@ num_remainder(VALUE x, VALUE y)
* call-seq:
* num.divmod(numeric) -> array
*
- * Returns an array containing the quotient and modulus obtained by
- * dividing <i>num</i> by <i>numeric</i>. If <code>q, r =
- * x.divmod(y)</code>, then
+ * Returns an array containing the quotient and modulus obtained by dividing
+ * +num+ by +numeric+.
+ *
+ * If <code>q, r = * x.divmod(y)</code>, then
*
* q = floor(x/y)
* x = q*y+r
@@ -514,8 +529,7 @@ num_divmod(VALUE x, VALUE y)
* call-seq:
* num.real? -> true or false
*
- * Returns <code>true</code> if <i>num</i> is a <code>Real</code>
- * (i.e. non <code>Complex</code>).
+ * Returns +true+ if +num+ is a Real number. (i.e. not Complex).
*/
static VALUE
@@ -545,11 +559,13 @@ num_int_p(VALUE num)
* num.abs -> numeric
* num.magnitude -> numeric
*
- * Returns the absolute value of <i>num</i>.
+ * Returns the absolute value of +num+.
*
* 12.abs #=> 12
* (-34.56).abs #=> 34.56
* -34.56.abs #=> 34.56
+ *
+ * Numeric#magnitude is an alias of Numeric#abs.
*/
static VALUE
@@ -566,7 +582,7 @@ num_abs(VALUE num)
* call-seq:
* num.zero? -> true or false
*
- * Returns <code>true</code> if <i>num</i> has a zero value.
+ * Returns +true+ if +num+ has a zero value.
*/
static VALUE
@@ -583,8 +599,9 @@ num_zero_p(VALUE num)
* call-seq:
* num.nonzero? -> self or nil
*
- * Returns +self+ if <i>num</i> is not zero, <code>nil</code>
- * otherwise. This behavior is useful when chaining comparisons:
+ * Returns +self+ if +num+ is not zero, +nil+ otherwise.
+ *
+ * This behavior is useful when chaining comparisons:
*
* a = %w( z Bb bB bb BB a aA Aa AA A )
* b = a.sort {|a,b| (a.downcase <=> b.downcase).nonzero? || a <=> b }
@@ -622,11 +639,10 @@ num_to_int(VALUE num)
*
* Document-class: Float
*
- * <code>Float</code> objects represent inexact real numbers using
- * the native architecture's double-precision floating point
- * representation.
+ * Float objects represent inexact real numbers using the native
+ * architecture's double-precision floating point representation.
*
- * Floating point has a different arithmetic and is a inexact number.
+ * Floating point has a different arithmetic and is an inexact number.
* So you should know its esoteric system. see following:
*
* - http://docs.sun.com/source/806-3568/ncg_goldberg.html
@@ -637,7 +653,7 @@ num_to_int(VALUE num)
VALUE
rb_float_new_in_heap(double d)
{
- NEWOBJ_OF(flt, struct RFloat, rb_cFloat, T_FLOAT);
+ NEWOBJ_OF(flt, struct RFloat, rb_cFloat, T_FLOAT | (RGENGC_WB_PROTECTED_FLOAT ? FL_WB_PROTECTED : 0));
flt->float_value = d;
OBJ_FREEZE(flt);
@@ -646,12 +662,11 @@ rb_float_new_in_heap(double d)
/*
* call-seq:
- * flt.to_s -> string
+ * float.to_s -> string
*
- * Returns a string containing a representation of self. As well as a
- * fixed or exponential form of the number, the call may return
- * ``<code>NaN</code>'', ``<code>Infinity</code>'', and
- * ``<code>-Infinity</code>''.
+ * Returns a string containing a representation of self. As well as a fixed or
+ * exponential form of the +float+, the call may return +NaN+, +Infinity+, and
+ * +-Infinity+.
*/
static VALUE
@@ -725,11 +740,12 @@ flo_to_s(VALUE flt)
/*
* call-seq:
- * flt.coerce(numeric) -> array
+ * float.coerce(numeric) -> array
*
- * Returns an array with both <i>aNumeric</i> and <i>flt</i> represented
- * as <code>Float</code> objects.
- * This is achieved by converting <i>aNumeric</i> to a <code>Float</code>.
+ * Returns an array with both a +numeric+ and a +float+ represented as Float
+ * objects.
+ *
+ * This is achieved by converting a +numeric+ to a Float.
*
* 1.2.coerce(3) #=> [3.0, 1.2]
* 2.5.coerce(1.1) #=> [1.1, 2.5]
@@ -758,21 +774,22 @@ flo_uminus(VALUE flt)
* call-seq:
* float + other -> float
*
- * Returns a new float which is the sum of <code>float</code>
- * and <code>other</code>.
+ * Returns a new float which is the sum of +float+ and +other+.
*/
static VALUE
flo_plus(VALUE x, VALUE y)
{
- switch (TYPE(y)) {
- case T_FIXNUM:
+ if (RB_TYPE_P(y, T_FIXNUM)) {
return DBL2NUM(RFLOAT_VALUE(x) + (double)FIX2LONG(y));
- case T_BIGNUM:
+ }
+ else if (RB_TYPE_P(y, T_BIGNUM)) {
return DBL2NUM(RFLOAT_VALUE(x) + rb_big2dbl(y));
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
return DBL2NUM(RFLOAT_VALUE(x) + RFLOAT_VALUE(y));
- default:
+ }
+ else {
return rb_num_coerce_bin(x, y, '+');
}
}
@@ -781,21 +798,22 @@ flo_plus(VALUE x, VALUE y)
* call-seq:
* float - other -> float
*
- * Returns a new float which is the difference of <code>float</code>
- * and <code>other</code>.
+ * Returns a new float which is the difference of +float+ and +other+.
*/
static VALUE
flo_minus(VALUE x, VALUE y)
{
- switch (TYPE(y)) {
- case T_FIXNUM:
+ if (RB_TYPE_P(y, T_FIXNUM)) {
return DBL2NUM(RFLOAT_VALUE(x) - (double)FIX2LONG(y));
- case T_BIGNUM:
+ }
+ else if (RB_TYPE_P(y, T_BIGNUM)) {
return DBL2NUM(RFLOAT_VALUE(x) - rb_big2dbl(y));
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
return DBL2NUM(RFLOAT_VALUE(x) - RFLOAT_VALUE(y));
- default:
+ }
+ else {
return rb_num_coerce_bin(x, y, '-');
}
}
@@ -804,21 +822,22 @@ flo_minus(VALUE x, VALUE y)
* call-seq:
* float * other -> float
*
- * Returns a new float which is the product of <code>float</code>
- * and <code>other</code>.
+ * Returns a new float which is the product of +float+ and +other+.
*/
static VALUE
flo_mul(VALUE x, VALUE y)
{
- switch (TYPE(y)) {
- case T_FIXNUM:
+ if (RB_TYPE_P(y, T_FIXNUM)) {
return DBL2NUM(RFLOAT_VALUE(x) * (double)FIX2LONG(y));
- case T_BIGNUM:
+ }
+ else if (RB_TYPE_P(y, T_BIGNUM)) {
return DBL2NUM(RFLOAT_VALUE(x) * rb_big2dbl(y));
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
return DBL2NUM(RFLOAT_VALUE(x) * RFLOAT_VALUE(y));
- default:
+ }
+ else {
return rb_num_coerce_bin(x, y, '*');
}
}
@@ -827,8 +846,7 @@ flo_mul(VALUE x, VALUE y)
* call-seq:
* float / other -> float
*
- * Returns a new float which is the result of dividing
- * <code>float</code> by <code>other</code>.
+ * Returns a new float which is the result of dividing +float+ by +other+.
*/
static VALUE
@@ -837,25 +855,28 @@ flo_div(VALUE x, VALUE y)
long f_y;
double d;
- switch (TYPE(y)) {
- case T_FIXNUM:
+ if (RB_TYPE_P(y, T_FIXNUM)) {
f_y = FIX2LONG(y);
return DBL2NUM(RFLOAT_VALUE(x) / (double)f_y);
- case T_BIGNUM:
+ }
+ else if (RB_TYPE_P(y, T_BIGNUM)) {
d = rb_big2dbl(y);
return DBL2NUM(RFLOAT_VALUE(x) / d);
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
return DBL2NUM(RFLOAT_VALUE(x) / RFLOAT_VALUE(y));
- default:
+ }
+ else {
return rb_num_coerce_bin(x, y, '/');
}
}
/*
* call-seq:
+ * float.fdiv(numeric) -> float
* float.quo(numeric) -> float
*
- * Returns float / numeric.
+ * Returns <code>float / numeric</code>, same as Float#/.
*/
static VALUE
@@ -869,6 +890,12 @@ 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;
@@ -882,7 +909,7 @@ flodivmod(double x, double y, double *divp, double *modp)
mod = x - z * y;
#endif
}
- if (isinf(x) && !isinf(y) && !isnan(y))
+ if (isinf(x) && !isinf(y))
div = x;
else
div = (x - mod) / y;
@@ -924,17 +951,16 @@ flo_mod(VALUE x, VALUE y)
{
double fy;
- switch (TYPE(y)) {
- case T_FIXNUM:
+ if (RB_TYPE_P(y, T_FIXNUM)) {
fy = (double)FIX2LONG(y);
- break;
- case T_BIGNUM:
+ }
+ else if (RB_TYPE_P(y, T_BIGNUM)) {
fy = rb_big2dbl(y);
- break;
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
fy = RFLOAT_VALUE(y);
- break;
- default:
+ }
+ else {
return rb_num_coerce_bin(x, y, '%');
}
return DBL2NUM(ruby_float_mod(RFLOAT_VALUE(x), fy));
@@ -966,17 +992,16 @@ flo_divmod(VALUE x, VALUE y)
double fy, div, mod;
volatile VALUE a, b;
- switch (TYPE(y)) {
- case T_FIXNUM:
+ if (RB_TYPE_P(y, T_FIXNUM)) {
fy = (double)FIX2LONG(y);
- break;
- case T_BIGNUM:
+ }
+ else if (RB_TYPE_P(y, T_BIGNUM)) {
fy = rb_big2dbl(y);
- break;
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
fy = RFLOAT_VALUE(y);
- break;
- default:
+ }
+ else {
return rb_num_coerce_bin(x, y, rb_intern("divmod"));
}
flodivmod(RFLOAT_VALUE(x), fy, &div, &mod);
@@ -988,9 +1013,9 @@ flo_divmod(VALUE x, VALUE y)
/*
* call-seq:
*
- * flt ** other -> float
+ * float ** other -> float
*
- * Raises <code>float</code> the <code>other</code> power.
+ * Raises +float+ to the power of +other+.
*
* 2.0**3 #=> 8.0
*/
@@ -998,12 +1023,13 @@ flo_divmod(VALUE x, VALUE y)
static VALUE
flo_pow(VALUE x, VALUE y)
{
- switch (TYPE(y)) {
- case T_FIXNUM:
+ if (RB_TYPE_P(y, T_FIXNUM)) {
return DBL2NUM(pow(RFLOAT_VALUE(x), (double)FIX2LONG(y)));
- case T_BIGNUM:
+ }
+ else if (RB_TYPE_P(y, T_BIGNUM)) {
return DBL2NUM(pow(RFLOAT_VALUE(x), rb_big2dbl(y)));
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
{
double dx = RFLOAT_VALUE(x);
double dy = RFLOAT_VALUE(y);
@@ -1011,7 +1037,8 @@ flo_pow(VALUE x, VALUE y)
return rb_funcall(rb_complex_raw1(x), rb_intern("**"), 1, y);
return DBL2NUM(pow(dx, dy));
}
- default:
+ }
+ else {
return rb_num_coerce_bin(x, y, rb_intern("**"));
}
}
@@ -1020,8 +1047,8 @@ flo_pow(VALUE x, VALUE y)
* call-seq:
* num.eql?(numeric) -> true or false
*
- * Returns <code>true</code> if <i>num</i> and <i>numeric</i> are the
- * same type and have equal values.
+ * Returns +true+ if +num+ and +numeric+ are the same type and have equal
+ * values.
*
* 1 == 1.0 #=> true
* 1.eql?(1.0) #=> false
@@ -1060,11 +1087,11 @@ num_equal(VALUE x, VALUE y)
/*
* call-seq:
- * flt == obj -> true or false
+ * float == obj -> true or false
+ *
+ * Returns +true+ only if +obj+ has the same value as +float+. Contrast this
+ * with Float#eql?, which requires obj to be a Float.
*
- * Returns <code>true</code> only if <i>obj</i> has the same value
- * as <i>flt</i>. Contrast this with <code>Float#eql?</code>, which
- * requires <i>obj</i> to be a <code>Float</code>.
* The result of <code>NaN == NaN</code> is undefined, so the
* implementation-dependent value is returned.
*
@@ -1077,17 +1104,16 @@ flo_eq(VALUE x, VALUE y)
{
volatile double a, b;
- switch (TYPE(y)) {
- case T_FIXNUM:
- case T_BIGNUM:
+ if (RB_TYPE_P(y, T_FIXNUM) || RB_TYPE_P(y, T_BIGNUM)) {
return rb_integer_float_eq(y, x);
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
b = RFLOAT_VALUE(y);
#if defined(_MSC_VER) && _MSC_VER < 1300
if (isnan(b)) return Qfalse;
#endif
- break;
- default:
+ }
+ else {
return num_equal(x, y);
}
a = RFLOAT_VALUE(x);
@@ -1099,9 +1125,11 @@ flo_eq(VALUE x, VALUE y)
/*
* call-seq:
- * flt.hash -> integer
+ * float.hash -> integer
*
* Returns a hash code for this float.
+ *
+ * See also Object#hash.
*/
static VALUE
@@ -1148,21 +1176,16 @@ flo_cmp(VALUE x, VALUE y)
a = RFLOAT_VALUE(x);
if (isnan(a)) return Qnil;
- switch (TYPE(y)) {
- case T_FIXNUM:
- case T_BIGNUM:
- {
+ if (RB_TYPE_P(y, T_FIXNUM) || RB_TYPE_P(y, T_BIGNUM)) {
VALUE rel = rb_integer_float_cmp(y, x);
if (FIXNUM_P(rel))
return INT2FIX(-FIX2INT(rel));
return rel;
- }
-
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
b = RFLOAT_VALUE(y);
- break;
-
- default:
+ }
+ else {
if (isinf(a) && (i = rb_check_funcall(y, rb_intern("infinite?"), 0, 0)) != Qundef) {
if (RTEST(i)) {
int j = rb_cmpint(i, x, y);
@@ -1172,16 +1195,17 @@ flo_cmp(VALUE x, VALUE y)
if (a > 0.0) return INT2FIX(1);
return INT2FIX(-1);
}
- return rb_num_coerce_cmp(x, y, rb_intern("<=>"));
+ return rb_num_coerce_cmp(x, y, id_cmp);
}
return rb_dbl_cmp(a, b);
}
/*
* call-seq:
- * flt > real -> true or false
+ * float > real -> true or false
+ *
+ * Returns +true+ if +float+ is greater than +real+.
*
- * <code>true</code> if <code>flt</code> is greater than <code>real</code>.
* The result of <code>NaN > NaN</code> is undefined, so the
* implementation-dependent value is returned.
*/
@@ -1192,24 +1216,19 @@ flo_gt(VALUE x, VALUE y)
double a, b;
a = RFLOAT_VALUE(x);
- switch (TYPE(y)) {
- case T_FIXNUM:
- case T_BIGNUM:
- {
+ if (RB_TYPE_P(y, T_FIXNUM) || RB_TYPE_P(y, T_BIGNUM)) {
VALUE rel = rb_integer_float_cmp(y, x);
if (FIXNUM_P(rel))
return -FIX2INT(rel) > 0 ? Qtrue : Qfalse;
return Qfalse;
- }
-
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
b = RFLOAT_VALUE(y);
#if defined(_MSC_VER) && _MSC_VER < 1300
if (isnan(b)) return Qfalse;
#endif
- break;
-
- default:
+ }
+ else {
return rb_num_coerce_relop(x, y, '>');
}
#if defined(_MSC_VER) && _MSC_VER < 1300
@@ -1220,10 +1239,10 @@ flo_gt(VALUE x, VALUE y)
/*
* call-seq:
- * flt >= real -> true or false
+ * float >= real -> true or false
+ *
+ * Returns +true+ if +float+ is greater than or equal to +real+.
*
- * <code>true</code> if <code>flt</code> is greater than
- * or equal to <code>real</code>.
* The result of <code>NaN >= NaN</code> is undefined, so the
* implementation-dependent value is returned.
*/
@@ -1234,24 +1253,19 @@ flo_ge(VALUE x, VALUE y)
double a, b;
a = RFLOAT_VALUE(x);
- switch (TYPE(y)) {
- case T_FIXNUM:
- case T_BIGNUM:
- {
+ if (RB_TYPE_P(y, T_FIXNUM) || RB_TYPE_P(y, T_BIGNUM)) {
VALUE rel = rb_integer_float_cmp(y, x);
if (FIXNUM_P(rel))
return -FIX2INT(rel) >= 0 ? Qtrue : Qfalse;
return Qfalse;
- }
-
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
b = RFLOAT_VALUE(y);
#if defined(_MSC_VER) && _MSC_VER < 1300
if (isnan(b)) return Qfalse;
#endif
- break;
-
- default:
+ }
+ else {
return rb_num_coerce_relop(x, y, rb_intern(">="));
}
#if defined(_MSC_VER) && _MSC_VER < 1300
@@ -1262,9 +1276,10 @@ flo_ge(VALUE x, VALUE y)
/*
* call-seq:
- * flt < real -> true or false
+ * float < real -> true or false
+ *
+ * Returns +true+ if +float+ is less than +real+.
*
- * <code>true</code> if <code>flt</code> is less than <code>real</code>.
* The result of <code>NaN < NaN</code> is undefined, so the
* implementation-dependent value is returned.
*/
@@ -1275,24 +1290,19 @@ flo_lt(VALUE x, VALUE y)
double a, b;
a = RFLOAT_VALUE(x);
- switch (TYPE(y)) {
- case T_FIXNUM:
- case T_BIGNUM:
- {
+ if (RB_TYPE_P(y, T_FIXNUM) || RB_TYPE_P(y, T_BIGNUM)) {
VALUE rel = rb_integer_float_cmp(y, x);
if (FIXNUM_P(rel))
return -FIX2INT(rel) < 0 ? Qtrue : Qfalse;
return Qfalse;
- }
-
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
b = RFLOAT_VALUE(y);
#if defined(_MSC_VER) && _MSC_VER < 1300
if (isnan(b)) return Qfalse;
#endif
- break;
-
- default:
+ }
+ else {
return rb_num_coerce_relop(x, y, '<');
}
#if defined(_MSC_VER) && _MSC_VER < 1300
@@ -1303,10 +1313,10 @@ flo_lt(VALUE x, VALUE y)
/*
* call-seq:
- * flt <= real -> true or false
+ * float <= real -> true or false
+ *
+ * Returns +true+ if +float+ is less than or equal to +real+.
*
- * <code>true</code> if <code>flt</code> is less than
- * or equal to <code>real</code>.
* The result of <code>NaN <= NaN</code> is undefined, so the
* implementation-dependent value is returned.
*/
@@ -1317,24 +1327,19 @@ flo_le(VALUE x, VALUE y)
double a, b;
a = RFLOAT_VALUE(x);
- switch (TYPE(y)) {
- case T_FIXNUM:
- case T_BIGNUM:
- {
+ if (RB_TYPE_P(y, T_FIXNUM) || RB_TYPE_P(y, T_BIGNUM)) {
VALUE rel = rb_integer_float_cmp(y, x);
if (FIXNUM_P(rel))
return -FIX2INT(rel) <= 0 ? Qtrue : Qfalse;
return Qfalse;
- }
-
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
b = RFLOAT_VALUE(y);
#if defined(_MSC_VER) && _MSC_VER < 1300
if (isnan(b)) return Qfalse;
#endif
- break;
-
- default:
+ }
+ else {
return rb_num_coerce_relop(x, y, rb_intern("<="));
}
#if defined(_MSC_VER) && _MSC_VER < 1300
@@ -1345,11 +1350,11 @@ flo_le(VALUE x, VALUE y)
/*
* call-seq:
- * flt.eql?(obj) -> true or false
+ * float.eql?(obj) -> true or false
+ *
+ * Returns +true+ only if +obj+ is a Float with the same value as +float+.
+ * Contrast this with Float#==, which performs type conversions.
*
- * Returns <code>true</code> only if <i>obj</i> is a
- * <code>Float</code> with the same value as <i>flt</i>. Contrast this
- * with <code>Float#==</code>, which performs type conversions.
* The result of <code>NaN.eql?(NaN)</code> is undefined, so the
* implementation-dependent value is returned.
*
@@ -1373,9 +1378,9 @@ flo_eql(VALUE x, VALUE y)
/*
* call-seq:
- * flt.to_f -> self
+ * float.to_f -> self
*
- * As <code>flt</code> is already a float, returns +self+.
+ * Since +float+ is already a float, returns +self+.
*/
static VALUE
@@ -1386,10 +1391,10 @@ flo_to_f(VALUE num)
/*
* call-seq:
- * flt.abs -> float
- * flt.magnitude -> float
+ * float.abs -> float
+ * float.magnitude -> float
*
- * Returns the absolute value of <i>flt</i>.
+ * Returns the absolute value of +float+.
*
* (-34.56).abs #=> 34.56
* -34.56.abs #=> 34.56
@@ -1405,9 +1410,9 @@ flo_abs(VALUE flt)
/*
* call-seq:
- * flt.zero? -> true or false
+ * float.zero? -> true or false
*
- * Returns <code>true</code> if <i>flt</i> is 0.0.
+ * Returns +true+ if +float+ is 0.0.
*
*/
@@ -1422,10 +1427,9 @@ flo_zero_p(VALUE num)
/*
* call-seq:
- * flt.nan? -> true or false
+ * float.nan? -> true or false
*
- * Returns <code>true</code> if <i>flt</i> is an invalid IEEE floating
- * point number.
+ * Returns +true+ if +float+ is an invalid IEEE floating point number.
*
* a = -1.0 #=> -1.0
* a.nan? #=> false
@@ -1443,10 +1447,15 @@ flo_is_nan_p(VALUE num)
/*
* call-seq:
- * flt.infinite? -> nil, -1, +1
+ * float.infinite? -> nil, -1, +1
*
- * Returns <code>nil</code>, -1, or +1 depending on whether <i>flt</i>
- * is finite, -infinity, or +infinity.
+ * Return values corresponding to the value of +float+:
+ *
+ * +finite+:: +nil+
+ * +-Infinity+:: +-1+
+ * ++Infinity+:: +1+
+ *
+ * For example:
*
* (0.0).infinite? #=> nil
* (-1.0/0.0).infinite? #=> -1
@@ -1467,11 +1476,10 @@ flo_is_infinite_p(VALUE num)
/*
* call-seq:
- * flt.finite? -> true or false
+ * float.finite? -> true or false
*
- * Returns <code>true</code> if <i>flt</i> is a valid IEEE floating
- * point number (it is not infinite, and <code>nan?</code> is
- * <code>false</code>).
+ * Returns +true+ if +float+ is a valid IEEE floating point number (it is not
+ * infinite, and Float#nan? is +false+).
*
*/
@@ -1480,8 +1488,8 @@ flo_is_finite_p(VALUE num)
{
double value = RFLOAT_VALUE(num);
-#if HAVE_FINITE
- if (!finite(value))
+#ifdef HAVE_ISFINITE
+ if (!isfinite(value))
return Qfalse;
#else
if (isinf(value) || isnan(value))
@@ -1493,9 +1501,122 @@ flo_is_finite_p(VALUE num)
/*
* call-seq:
- * flt.floor -> integer
+ * 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 floatint-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 <i>flt</i>.
+ * Returns the largest integer less than or equal to +float+.
*
* 1.2.floor #=> 1
* 2.0.floor #=> 2
@@ -1518,10 +1639,9 @@ flo_floor(VALUE num)
/*
* call-seq:
- * flt.ceil -> integer
+ * float.ceil -> integer
*
- * Returns the smallest <code>Integer</code> greater than or equal to
- * <i>flt</i>.
+ * Returns the smallest Integer greater than or equal to +float+.
*
* 1.2.ceil #=> 2
* 2.0.ceil #=> 2
@@ -1586,10 +1706,11 @@ flo_truncate(VALUE num);
/*
* call-seq:
- * flt.round([ndigits]) -> integer or float
+ * float.round([ndigits]) -> integer or float
*
- * Rounds <i>flt</i> to a given precision in decimal digits (default 0 digits).
- * Precision may be negative. Returns a floating point number when ndigits
+ * Rounds +float+ to a given precision in decimal digits (default 0 digits).
+ *
+ * Precision may be negative. Returns a floating point number when +ndigits+
* is more than zero.
*
* 1.4.round #=> 1
@@ -1665,11 +1786,13 @@ flo_round(int argc, VALUE *argv, VALUE num)
/*
* call-seq:
- * flt.to_i -> integer
- * flt.to_int -> integer
- * flt.truncate -> integer
+ * float.to_i -> integer
+ * float.to_int -> integer
+ * float.truncate -> integer
+ *
+ * Returns the +float+ truncated to an Integer.
*
- * Returns <i>flt</i> truncated to an <code>Integer</code>.
+ * Synonyms are #to_i, #to_int, and #truncate.
*/
static VALUE
@@ -1692,9 +1815,10 @@ flo_truncate(VALUE num)
* call-seq:
* num.floor -> integer
*
- * Returns the largest integer less than or equal to <i>num</i>.
- * <code>Numeric</code> implements this by converting <i>anInteger</i>
- * to a <code>Float</code> and invoking <code>Float#floor</code>.
+ * Returns the largest integer less than or equal to +num+.
+ *
+ * Numeric implements this by converting an Integer to a Float and invoking
+ * Float#floor.
*
* 1.floor #=> 1
* (-1).floor #=> -1
@@ -1711,10 +1835,11 @@ num_floor(VALUE num)
* call-seq:
* num.ceil -> integer
*
- * Returns the smallest <code>Integer</code> greater than or equal to
- * <i>num</i>. Class <code>Numeric</code> achieves this by converting
- * itself to a <code>Float</code> then invoking
- * <code>Float#ceil</code>.
+ * Returns the smallest possible Integer that is greater than or equal to
+ * +num+.
+ *
+ * Numeric achieves this by converting itself to a Float then invoking
+ * Float#ceil.
*
* 1.ceil #=> 1
* 1.2.ceil #=> 2
@@ -1732,10 +1857,13 @@ num_ceil(VALUE num)
* call-seq:
* num.round([ndigits]) -> integer or float
*
- * Rounds <i>num</i> to a given precision in decimal digits (default 0 digits).
- * Precision may be negative. Returns a floating point number when <i>ndigits</i>
- * is more than zero. <code>Numeric</code> implements this by converting itself
- * to a <code>Float</code> and invoking <code>Float#round</code>.
+ * Rounds +num+ to a given precision in decimal digits (default 0 digits).
+ *
+ * Precision may be negative. Returns a floating point number when +ndigits+
+ * is more than zero.
+ *
+ * Numeric implements this by converting itself to a Float and invoking
+ * Float#round.
*/
static VALUE
@@ -1748,9 +1876,10 @@ num_round(int argc, VALUE* argv, VALUE num)
* call-seq:
* num.truncate -> integer
*
- * Returns <i>num</i> truncated to an integer. <code>Numeric</code>
- * implements this by converting its value to a float and invoking
- * <code>Float#truncate</code>.
+ * Returns +num+ truncated to an Integer.
+ *
+ * Numeric implements this by converting its value to a Float and invoking
+ * Float#truncate.
*/
static VALUE
@@ -1769,6 +1898,9 @@ 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;
@@ -1798,6 +1930,11 @@ 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;
@@ -1811,28 +1948,42 @@ ruby_float_step(VALUE from, VALUE to, VALUE step, int excl)
}
VALUE
-num_interval_step_size(VALUE from, VALUE to, VALUE step, int excl)
+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, result;
+ long delta, diff;
diff = FIX2LONG(step);
+ if (diff == 0) {
+ return DBL2NUM(INFINITY);
+ }
delta = FIX2LONG(to) - FIX2LONG(from);
+ if (diff < 0) {
+ diff = -diff;
+ delta = -delta;
+ }
if (excl) {
- delta += (diff > 0 ? -1 : +1);
+ delta--;
}
- result = delta / diff;
- return LONG2FIX(result >= 0 ? result + 1 : 0);
+ if (delta < 0) {
+ return INT2FIX(0);
+ }
+ return ULONG2NUM(delta / diff + 1UL);
}
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);
- return LONG2FIX(n);
+ if (POSFIXABLE(n)) return LONG2FIX(n);
+ return rb_dbl2big(n);
}
else {
VALUE result;
- ID cmp = RTEST(rb_funcall(step, '>', 1, INT2FIX(0))) ? '>' : '<';
+ 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;
+ }
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))) {
@@ -1842,39 +1993,108 @@ 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;
+
+ 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;
+}
+
static VALUE
-num_step_size(VALUE from, VALUE args)
+num_step_size(VALUE from, VALUE args, VALUE eobj)
{
- VALUE to = RARRAY_PTR(args)[0];
- VALUE step = (RARRAY_LEN(args) > 1) ? RARRAY_PTR(args)[1] : INT2FIX(1);
- return num_interval_step_size(from, to, step, FALSE);
+ VALUE to, step;
+ int argc = args ? RARRAY_LENINT(args) : 0;
+ const VALUE *argv = args ? RARRAY_CONST_PTR(args) : 0;
+
+ num_step_scan_args(argc, argv, &to, &step);
+
+ return ruby_num_interval_step_size(from, to, step, FALSE);
}
/*
* call-seq:
- * num.step(limit[, step]) {|i| block } -> self
- * num.step(limit[, step]) -> 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
+ *
+ * Invokes the given block with the sequence of numbers starting at +num+,
+ * incremented by +step+ (defaulted to +1+) on each call.
+ *
+ * The loop finishes when the value to be passed to the block is greater than
+ * +limit+ (if +step+ is positive) or less than +limit+ (if +step+ is
+ * negative), where <i>limit</i> is defaulted to infinity.
+ *
+ * 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
+ * (i.e. num.step(limit, 0)) is not allowed for historical
+ * compatibility reasons.
*
- * Invokes <em>block</em> with the sequence of numbers starting at
- * <i>num</i>, incremented by <i>step</i> (default 1) on each
- * call. The loop finishes when the value to be passed to the block
- * is greater than <i>limit</i> (if <i>step</i> is positive) or less
- * than <i>limit</i> (if <i>step</i> is negative). If all the
- * arguments are integers, the loop operates using an integer
- * counter. If any of the arguments are floating point numbers, all
- * are converted to floats, and the loop is executed <i>floor(n +
- * n*epsilon)+ 1</i> times, where <i>n = (limit -
- * num)/step</i>. Otherwise, the loop starts at <i>num</i>, uses
- * either the <code><</code> or <code>></code> operator to compare
- * the counter against <i>limit</i>, and increments itself using the
- * <code>+</code> operator.
+ * If all the arguments are integers, the loop operates using an integer
+ * counter.
*
- * If no block is given, an enumerator is returned instead.
+ * If any of the arguments are floating point numbers, all are converted to floats, and the loop is executed the following expression:
*
+ * floor(n + n*epsilon)+ 1
+ *
+ * Where the +n+ is the following:
+ *
+ * n = (limit - num)/step
+ *
+ * Otherwise, the loop starts at +num+, uses either the less-than (<) or
+ * greater-than (>) operator to compare the counter against +limit+, and
+ * increments itself using the <code>+</code> operator.
+ *
+ * If no block is given, an Enumerator is returned instead.
+ *
+ * For example:
+ *
+ * p 1.step.take(4)
+ * p 10.step(by: -1).take(4)
+ * 3.step(to: 5) { |i| print i, " " }
* 1.step(10, 2) { |i| print i, " " }
- * Math::E.step(Math::PI, 0.2) { |f| print f, " " }
+ * Math::E.step(to: Math::PI, by: 0.2) { |f| print f, " " }
*
- * <em>produces:</em>
+ * Will produce:
*
+ * [1, 2, 3, 4]
+ * [10, 9, 8, 7]
+ * 3 4 5
* 1 3 5 7 9
* 2.71828182845905 2.91828182845905 3.11828182845905
*/
@@ -1883,65 +2103,84 @@ static VALUE
num_step(int argc, VALUE *argv, VALUE from)
{
VALUE to, step;
+ int desc, inf;
RETURN_SIZED_ENUMERATOR(from, argc, argv, num_step_size);
- if (argc == 1) {
- to = argv[0];
- step = INT2FIX(1);
+
+ desc = num_step_scan_args(argc, argv, &to, &step);
+ if (RTEST(rb_num_coerce_cmp(step, INT2FIX(0), id_eq))) {
+ inf = 1;
}
- else {
- rb_check_arity(argc, 1, 2);
- to = argv[0];
- step = argv[1];
- if (rb_equal(step, INT2FIX(0))) {
- rb_raise(rb_eArgError, "step can't be 0");
- }
+ else if (RB_TYPE_P(to, T_FLOAT)) {
+ double f = RFLOAT_VALUE(to);
+ inf = isinf(f) && (signbit(f) ? desc : !desc);
}
+ else inf = 0;
- if (FIXNUM_P(from) && FIXNUM_P(to) && FIXNUM_P(step)) {
- long i, end, diff;
-
- i = FIX2LONG(from);
- end = FIX2LONG(to);
- diff = FIX2LONG(step);
+ if (FIXNUM_P(from) && (inf || FIXNUM_P(to)) && FIXNUM_P(step)) {
+ long i = FIX2LONG(from);
+ long diff = FIX2LONG(step);
- if (diff > 0) {
- while (i <= end) {
+ if (inf) {
+ for (;; i += diff)
rb_yield(LONG2FIX(i));
- i += diff;
- }
}
else {
- while (i >= end) {
- rb_yield(LONG2FIX(i));
- i += diff;
+ long end = FIX2LONG(to);
+
+ if (desc) {
+ for (; i >= end; i += diff)
+ rb_yield(LONG2FIX(i));
+ }
+ else {
+ for (; i <= end; i += diff)
+ rb_yield(LONG2FIX(i));
}
}
}
else if (!ruby_float_step(from, to, step, FALSE)) {
VALUE i = from;
- ID cmp;
- if (positive_int_p(step)) {
- cmp = '>';
+ if (inf) {
+ for (;; i = rb_funcall(i, '+', 1, step))
+ rb_yield(i);
}
else {
- cmp = '<';
- }
- for (;;) {
- if (RTEST(rb_funcall(i, cmp, 1, to))) break;
- rb_yield(i);
- i = rb_funcall(i, '+', 1, step);
+ ID cmp = desc ? '<' : '>';
+
+ for (; !RTEST(rb_funcall(i, cmp, 1, to)); i = rb_funcall(i, '+', 1, step))
+ rb_yield(i);
}
}
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))
+#define LONG_MIN_MINUS_ONE_IS_LESS_THAN(n) \
+ (LONG_MIN_MINUS_ONE == (double)LONG_MIN ? \
+ LONG_MIN <= (n): \
+ LONG_MIN_MINUS_ONE < (n))
-SIGNED_VALUE
+long
rb_num2long(VALUE val)
{
again:
@@ -1951,65 +2190,73 @@ rb_num2long(VALUE val)
if (FIXNUM_P(val)) return FIX2LONG(val);
- switch (TYPE(val)) {
- case T_FLOAT:
+ else if (RB_TYPE_P(val, T_FLOAT)) {
if (RFLOAT_VALUE(val) < LONG_MAX_PLUS_ONE
- && RFLOAT_VALUE(val) > LONG_MIN_MINUS_ONE) {
- return (SIGNED_VALUE)(RFLOAT_VALUE(val));
+ && LONG_MIN_MINUS_ONE_IS_LESS_THAN(RFLOAT_VALUE(val))) {
+ return (long)RFLOAT_VALUE(val);
}
else {
- 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);
+ FLOAT_OUT_OF_RANGE(val, "integer");
}
-
- case T_BIGNUM:
+ }
+ else if (RB_TYPE_P(val, T_BIGNUM)) {
return rb_big2long(val);
-
- default:
+ }
+ else {
val = rb_to_int(val);
goto again;
}
}
-VALUE
-rb_num2ulong(VALUE val)
+static unsigned long
+rb_num2ulong_internal(VALUE val, int *wrap_p)
{
again:
if (NIL_P(val)) {
rb_raise(rb_eTypeError, "no implicit conversion from nil to integer");
}
- if (FIXNUM_P(val)) return FIX2LONG(val); /* this is FIX2LONG, inteneded */
-
- switch (TYPE(val)) {
- case T_FLOAT:
+ if (FIXNUM_P(val)) {
+ long l = FIX2LONG(val); /* this is FIX2LONG, inteneded */
+ if (wrap_p)
+ *wrap_p = l < 0;
+ return (unsigned long)l;
+ }
+ else if (RB_TYPE_P(val, T_FLOAT)) {
if (RFLOAT_VALUE(val) < ULONG_MAX_PLUS_ONE
- && RFLOAT_VALUE(val) > LONG_MIN_MINUS_ONE) {
- return (VALUE)RFLOAT_VALUE(val);
+ && LONG_MIN_MINUS_ONE_IS_LESS_THAN(RFLOAT_VALUE(val))) {
+ double d = RFLOAT_VALUE(val);
+ if (wrap_p)
+ *wrap_p = d <= -1.0; /* NUM2ULONG(v) uses v.to_int conceptually. */
+ if (0 <= d)
+ return (unsigned long)d;
+ return (unsigned long)(long)d;
}
else {
- 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);
+ FLOAT_OUT_OF_RANGE(val, "integer");
}
-
- case T_BIGNUM:
- return rb_big2ulong(val);
-
- default:
- val = rb_to_int(val);
- goto again;
}
+ else if (RB_TYPE_P(val, T_BIGNUM)) {
+ {
+ unsigned long ul = rb_big2ulong(val);
+ if (wrap_p)
+ *wrap_p = BIGNUM_NEGATIVE_P(val);
+ return ul;
+ }
+ }
+ else {
+ val = rb_to_int(val);
+ goto again;
+ }
+}
+
+unsigned long
+rb_num2ulong(VALUE val)
+{
+ return rb_num2ulong_internal(val, NULL);
}
-#if SIZEOF_INT < SIZEOF_VALUE
+#if SIZEOF_INT < SIZEOF_LONG
void
rb_out_of_int(SIGNED_VALUE num)
{
@@ -2018,28 +2265,25 @@ rb_out_of_int(SIGNED_VALUE num)
}
static void
-check_int(SIGNED_VALUE num)
+check_int(long num)
{
- if ((SIGNED_VALUE)(int)num != num) {
+ if ((long)(int)num != num) {
rb_out_of_int(num);
}
}
static void
-check_uint(VALUE num, int sign)
+check_uint(unsigned long num, int sign)
{
- static const VALUE mask = ~(VALUE)UINT_MAX;
-
if (sign) {
/* minus */
- if ((num & mask) != mask || (num & ~mask) <= INT_MAX)
-#define VALUE_MSBMASK ((VALUE)1 << ((sizeof(VALUE) * CHAR_BIT) - 1))
- rb_raise(rb_eRangeError, "integer %"PRIdVALUE " too small to convert to `unsigned int'", num|VALUE_MSBMASK);
+ if (num < (unsigned long)INT_MIN)
+ rb_raise(rb_eRangeError, "integer %ld too small to convert to `unsigned int'", (long)num);
}
else {
/* plus */
- if ((num & mask) != 0)
- rb_raise(rb_eRangeError, "integer %"PRIuVALUE " too big to convert to `unsigned int'", num);
+ if (UINT_MAX < num)
+ rb_raise(rb_eRangeError, "integer %lu too big to convert to `unsigned int'", num);
}
}
@@ -2064,10 +2308,11 @@ rb_fix2int(VALUE val)
unsigned long
rb_num2uint(VALUE val)
{
- VALUE num = rb_num2ulong(val);
+ int wrap;
+ unsigned long num = rb_num2ulong_internal(val, &wrap);
- check_uint(num, negative_int_p(val));
- return (unsigned long)num;
+ check_uint(num, wrap);
+ return num;
}
unsigned long
@@ -2105,28 +2350,25 @@ rb_out_of_short(SIGNED_VALUE num)
}
static void
-check_short(SIGNED_VALUE num)
+check_short(long num)
{
- if ((SIGNED_VALUE)(short)num != num) {
+ if ((long)(short)num != num) {
rb_out_of_short(num);
}
}
static void
-check_ushort(VALUE num, int sign)
+check_ushort(unsigned long num, int sign)
{
- static const VALUE mask = ~(VALUE)USHRT_MAX;
-
if (sign) {
/* minus */
- if ((num & mask) != mask || (num & ~mask) <= SHRT_MAX)
-#define VALUE_MSBMASK ((VALUE)1 << ((sizeof(VALUE) * CHAR_BIT) - 1))
- rb_raise(rb_eRangeError, "integer %"PRIdVALUE " too small to convert to `unsigned short'", num|VALUE_MSBMASK);
+ if (num < (unsigned long)SHRT_MIN)
+ rb_raise(rb_eRangeError, "integer %ld too small to convert to `unsigned short'", (long)num);
}
else {
/* plus */
- if ((num & mask) != 0)
- rb_raise(rb_eRangeError, "integer %"PRIuVALUE " too big to convert to `unsigned short'", num);
+ if (USHRT_MAX < num)
+ rb_raise(rb_eRangeError, "integer %lu too big to convert to `unsigned short'", num);
}
}
@@ -2151,10 +2393,11 @@ rb_fix2short(VALUE val)
unsigned short
rb_num2ushort(VALUE val)
{
- VALUE num = rb_num2ulong(val);
+ int wrap;
+ unsigned long num = rb_num2ulong_internal(val, &wrap);
- check_ushort(num, negative_int_p(val));
- return (unsigned long)num;
+ check_ushort(num, wrap);
+ return num;
}
unsigned short
@@ -2174,13 +2417,13 @@ rb_fix2ushort(VALUE val)
VALUE
rb_num2fix(VALUE val)
{
- SIGNED_VALUE v;
+ long v;
if (FIXNUM_P(val)) return val;
v = rb_num2long(val);
if (!FIXABLE(v))
- rb_raise(rb_eRangeError, "integer %"PRIdVALUE " out of range of fixnum", v);
+ rb_raise(rb_eRangeError, "integer %ld out of range of fixnum", v);
return LONG2FIX(v);
}
@@ -2192,6 +2435,10 @@ rb_num2fix(VALUE val)
#ifndef ULLONG_MAX
#define ULLONG_MAX ((unsigned LONG_LONG)LLONG_MAX*2+1)
#endif
+#define LLONG_MIN_MINUS_ONE_IS_LESS_THAN(n) \
+ (LLONG_MIN_MINUS_ONE == (double)LLONG_MIN ? \
+ LLONG_MIN <= (n): \
+ LLONG_MIN_MINUS_ONE < (n))
LONG_LONG
rb_num2ll(VALUE val)
@@ -2202,35 +2449,23 @@ rb_num2ll(VALUE val)
if (FIXNUM_P(val)) return (LONG_LONG)FIX2LONG(val);
- switch (TYPE(val)) {
- case T_FLOAT:
+ else if (RB_TYPE_P(val, T_FLOAT)) {
if (RFLOAT_VALUE(val) < LLONG_MAX_PLUS_ONE
- && RFLOAT_VALUE(val) > LLONG_MIN_MINUS_ONE) {
+ && (LLONG_MIN_MINUS_ONE_IS_LESS_THAN(RFLOAT_VALUE(val)))) {
return (LONG_LONG)(RFLOAT_VALUE(val));
}
else {
- 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);
+ FLOAT_OUT_OF_RANGE(val, "long long");
}
-
- case T_BIGNUM:
+ }
+ else if (RB_TYPE_P(val, T_BIGNUM)) {
return rb_big2ll(val);
-
- case T_STRING:
+ }
+ else if (RB_TYPE_P(val, T_STRING)) {
rb_raise(rb_eTypeError, "no implicit conversion from string");
- break;
-
- case T_TRUE:
- case T_FALSE:
+ }
+ else if (RB_TYPE_P(val, T_TRUE) || RB_TYPE_P(val, T_FALSE)) {
rb_raise(rb_eTypeError, "no implicit conversion from boolean");
- break;
-
- default:
- break;
}
val = rb_to_int(val);
@@ -2240,41 +2475,31 @@ rb_num2ll(VALUE val)
unsigned LONG_LONG
rb_num2ull(VALUE val)
{
- switch (TYPE(val)) {
- case T_NIL:
+ if (RB_TYPE_P(val, T_NIL)) {
rb_raise(rb_eTypeError, "no implicit conversion from nil");
-
- case T_FIXNUM:
+ }
+ else if (RB_TYPE_P(val, T_FIXNUM)) {
return (LONG_LONG)FIX2LONG(val); /* this is FIX2LONG, inteneded */
-
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(val, T_FLOAT)) {
if (RFLOAT_VALUE(val) < ULLONG_MAX_PLUS_ONE
- && RFLOAT_VALUE(val) > 0) {
- return (unsigned LONG_LONG)(RFLOAT_VALUE(val));
+ && LLONG_MIN_MINUS_ONE_IS_LESS_THAN(RFLOAT_VALUE(val))) {
+ if (0 <= RFLOAT_VALUE(val))
+ return (unsigned LONG_LONG)(RFLOAT_VALUE(val));
+ return (unsigned LONG_LONG)(LONG_LONG)(RFLOAT_VALUE(val));
}
else {
- 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);
+ FLOAT_OUT_OF_RANGE(val, "unsigned long long");
}
-
- case T_BIGNUM:
+ }
+ else if (RB_TYPE_P(val, T_BIGNUM)) {
return rb_big2ull(val);
-
- case T_STRING:
+ }
+ else if (RB_TYPE_P(val, T_STRING)) {
rb_raise(rb_eTypeError, "no implicit conversion from string");
- break;
-
- case T_TRUE:
- case T_FALSE:
+ }
+ else if (RB_TYPE_P(val, T_TRUE) || RB_TYPE_P(val, T_FALSE)) {
rb_raise(rb_eTypeError, "no implicit conversion from boolean");
- break;
-
- default:
- break;
}
val = rb_to_int(val);
@@ -2286,21 +2511,18 @@ rb_num2ull(VALUE val)
/*
* Document-class: Integer
*
- * <code>Integer</code> is the basis for the two concrete classes that
- * hold whole numbers, <code>Bignum</code> and <code>Fixnum</code>.
+ * This class is the basis for the two concrete classes that hold whole
+ * numbers, Bignum and Fixnum.
*
*/
/*
* call-seq:
* int.to_i -> integer
- * int.to_int -> integer
- * int.floor -> integer
- * int.ceil -> integer
- * int.truncate -> integer
*
- * As <i>int</i> is already an <code>Integer</code>, all these
- * methods simply return the receiver.
+ * As +int+ is already an Integer, all these methods simply return the receiver.
+ *
+ * Synonyms are #to_int, #floor, #ceil, #truncate.
*/
static VALUE
@@ -2313,7 +2535,7 @@ int_to_i(VALUE num)
* call-seq:
* int.integer? -> true
*
- * Always returns <code>true</code>.
+ * Since +int+ is already an Integer, this always returns +true+.
*/
static VALUE
@@ -2326,7 +2548,7 @@ int_int_p(VALUE num)
* call-seq:
* int.odd? -> true or false
*
- * Returns <code>true</code> if <i>int</i> is an odd number.
+ * Returns +true+ if +int+ is an odd number.
*/
static VALUE
@@ -2342,7 +2564,7 @@ int_odd_p(VALUE num)
* call-seq:
* int.even? -> true or false
*
- * Returns <code>true</code> if <i>int</i> is an even number.
+ * Returns +true+ if +int+ is an even number.
*/
static VALUE
@@ -2356,10 +2578,10 @@ int_even_p(VALUE num)
/*
* call-seq:
- * fixnum.next -> integer
- * fixnum.succ -> integer
+ * int.next -> integer
+ * int.succ -> integer
*
- * Returns the <code>Integer</code> equal to <i>int</i> + 1.
+ * Returns the Integer equal to +int+ + 1.
*
* 1.next #=> 2
* (-1).next #=> 0
@@ -2377,42 +2599,52 @@ fix_succ(VALUE num)
* int.next -> integer
* int.succ -> integer
*
- * Returns the <code>Integer</code> equal to <i>int</i> + 1.
+ * Returns the Integer equal to +int+ + 1, same as Fixnum#next.
*
* 1.next #=> 2
* (-1).next #=> 0
*/
-static VALUE
-int_succ(VALUE num)
+VALUE
+rb_int_succ(VALUE num)
{
if (FIXNUM_P(num)) {
long i = FIX2LONG(num) + 1;
return LONG2NUM(i);
}
+ if (RB_TYPE_P(num, T_BIGNUM)) {
+ return rb_big_plus(num, INT2FIX(1));
+ }
return rb_funcall(num, '+', 1, INT2FIX(1));
}
+#define int_succ rb_int_succ
+
/*
* call-seq:
* int.pred -> integer
*
- * Returns the <code>Integer</code> equal to <i>int</i> - 1.
+ * Returns the Integer equal to +int+ - 1.
*
* 1.pred #=> 0
* (-1).pred #=> -2
*/
-static VALUE
-int_pred(VALUE num)
+VALUE
+rb_int_pred(VALUE num)
{
if (FIXNUM_P(num)) {
long i = FIX2LONG(num) - 1;
return LONG2NUM(i);
}
+ if (RB_TYPE_P(num, T_BIGNUM)) {
+ return rb_big_minus(num, INT2FIX(1));
+ }
return rb_funcall(num, '-', 1, INT2FIX(1));
}
+#define int_pred rb_int_pred
+
VALUE
rb_enc_uint_chr(unsigned int code, rb_encoding *enc)
{
@@ -2439,8 +2671,8 @@ rb_enc_uint_chr(unsigned int code, rb_encoding *enc)
* call-seq:
* int.chr([encoding]) -> string
*
- * Returns a string containing the character represented by the
- * receiver's value according to +encoding+.
+ * Returns a string containing the character represented by the +int+'s value
+ * according to +encoding+.
*
* 65.chr #=> "A"
* 230.chr #=> "\346"
@@ -2495,12 +2727,13 @@ int_chr(int argc, VALUE *argv, VALUE num)
* call-seq:
* int.ord -> self
*
- * Returns the int itself.
+ * Returns the +int+ itself.
*
* ?a.ord #=> 97
*
- * This method is intended for compatibility to
- * character constant in Ruby 1.9.
+ * This method is intended for compatibility to character constant in Ruby
+ * 1.9.
+ *
* For example, ?a.ord returns 97 both in 1.8 and 1.9.
*/
@@ -2514,18 +2747,18 @@ int_ord(VALUE num)
*
* Document-class: Fixnum
*
- * A <code>Fixnum</code> holds <code>Integer</code> values that can be
- * represented in a native machine word (minus 1 bit). If any operation
- * on a <code>Fixnum</code> exceeds this range, the value is
- * automatically converted to a <code>Bignum</code>.
+ * Holds Integer values that can be represented in a native machine word
+ * (minus 1 bit). If any operation on a Fixnum exceeds this range, the value
+ * is automatically converted to a Bignum.
+ *
+ * Fixnum objects have immediate value. This means that when they are assigned
+ * or passed as parameters, the actual object is passed, rather than a
+ * reference to that object.
*
- * <code>Fixnum</code> objects have immediate value. This means that
- * when they are assigned or passed as parameters, the actual object is
- * passed, rather than a reference to that object. Assignment does not
- * alias <code>Fixnum</code> objects. There is effectively only one
- * <code>Fixnum</code> object instance for any given integer value, so,
- * for example, you cannot add a singleton method to a
- * <code>Fixnum</code>.
+ * Assignment does not alias Fixnum objects. There is effectively only one
+ * Fixnum object instance for any given integer value, so, for example, you
+ * cannot add a singleton method to a Fixnum. Any attempt to add a singleton
+ * method to a Fixnum object will raise a TypeError.
*/
@@ -2533,7 +2766,7 @@ int_ord(VALUE num)
* call-seq:
* -fix -> integer
*
- * Negates <code>fix</code> (which might return a Bignum).
+ * Negates +fix+, which may return a Bignum.
*/
static VALUE
@@ -2575,8 +2808,8 @@ rb_fix2str(VALUE x, int base)
* call-seq:
* fix.to_s(base=10) -> string
*
- * Returns a string containing the representation of <i>fix</i> radix
- * <i>base</i> (between 2 and 36).
+ * Returns a string containing the representation of +fix+ radix +base+
+ * (between 2 and 36).
*
* 12345.to_s #=> "12345"
* 12345.to_s(2) #=> "11000000111001"
@@ -2606,9 +2839,8 @@ fix_to_s(int argc, VALUE *argv, VALUE x)
* call-seq:
* fix + numeric -> numeric_result
*
- * Performs addition: the class of the resulting object depends on
- * the class of <code>numeric</code> and on the magnitude of the
- * result.
+ * Performs addition: the class of the resulting object depends on the class of
+ * +numeric+ and on the magnitude of the result. It may return a Bignum.
*/
static VALUE
@@ -2625,12 +2857,13 @@ fix_plus(VALUE x, VALUE y)
return r;
}
- switch (TYPE(y)) {
- case T_BIGNUM:
+ else if (RB_TYPE_P(y, T_BIGNUM)) {
return rb_big_plus(y, x);
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
return DBL2NUM((double)FIX2LONG(x) + RFLOAT_VALUE(y));
- default:
+ }
+ else {
return rb_num_coerce_bin(x, y, '+');
}
}
@@ -2639,9 +2872,8 @@ fix_plus(VALUE x, VALUE y)
* call-seq:
* fix - numeric -> numeric_result
*
- * Performs subtraction: the class of the resulting object depends on
- * the class of <code>numeric</code> and on the magnitude of the
- * result.
+ * Performs subtraction: the class of the resulting object depends on the class
+ * of +numeric+ and on the magnitude of the result. It may return a Bignum.
*/
static VALUE
@@ -2658,13 +2890,14 @@ fix_minus(VALUE x, VALUE y)
return r;
}
- switch (TYPE(y)) {
- case T_BIGNUM:
+ else if (RB_TYPE_P(y, T_BIGNUM)) {
x = rb_int2big(FIX2LONG(x));
return rb_big_minus(x, y);
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
return DBL2NUM((double)FIX2LONG(x) - RFLOAT_VALUE(y));
- default:
+ }
+ else {
return rb_num_coerce_bin(x, y, '-');
}
}
@@ -2677,9 +2910,9 @@ fix_minus(VALUE x, VALUE y)
* call-seq:
* fix * numeric -> numeric_result
*
- * Performs multiplication: the class of the resulting object depends on
- * the class of <code>numeric</code> and on the magnitude of the
- * result.
+ * Performs multiplication: the class of the resulting object depends on the
+ * class of +numeric+ and on the magnitude of the result. It may return a
+ * Bignum.
*/
static VALUE
@@ -2705,8 +2938,6 @@ fix_mul(VALUE x, VALUE y)
if (FIXABLE(d)) return LONG2FIX(d);
return rb_ll2inum(d);
#else
- if (FIT_SQRT_LONG(a) && FIT_SQRT_LONG(b))
- return LONG2FIX(a*b);
if (a == 0) return x;
if (MUL_OVERFLOW_FIXNUM_P(a, b))
r = rb_big_mul(rb_int2big(a), rb_int2big(b));
@@ -2715,12 +2946,13 @@ fix_mul(VALUE x, VALUE y)
return r;
#endif
}
- switch (TYPE(y)) {
- case T_BIGNUM:
+ else if (RB_TYPE_P(y, T_BIGNUM)) {
return rb_big_mul(y, x);
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
return DBL2NUM((double)FIX2LONG(x) * RFLOAT_VALUE(y));
- default:
+ }
+ else {
return rb_num_coerce_bin(x, y, '*');
}
}
@@ -2756,8 +2988,7 @@ fixdivmod(long x, long y, long *divp, long *modp)
* call-seq:
* fix.fdiv(numeric) -> float
*
- * Returns the floating point result of dividing <i>fix</i> by
- * <i>numeric</i>.
+ * Returns the floating point result of dividing +fix+ by +numeric+.
*
* 654321.fdiv(13731) #=> 47.6528293642124
* 654321.fdiv(13731.24) #=> 47.6519964693647
@@ -2770,12 +3001,13 @@ fix_fdiv(VALUE x, VALUE y)
if (FIXNUM_P(y)) {
return DBL2NUM((double)FIX2LONG(x) / (double)FIX2LONG(y));
}
- switch (TYPE(y)) {
- case T_BIGNUM:
+ else if (RB_TYPE_P(y, T_BIGNUM)) {
return rb_big_fdiv(rb_int2big(FIX2LONG(x)), y);
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
return DBL2NUM((double)FIX2LONG(x) / RFLOAT_VALUE(y));
- default:
+ }
+ else {
return rb_num_coerce_bin(x, y, rb_intern("fdiv"));
}
}
@@ -2789,11 +3021,11 @@ fix_divide(VALUE x, VALUE y, ID op)
fixdivmod(FIX2LONG(x), FIX2LONG(y), &div, 0);
return LONG2NUM(div);
}
- switch (TYPE(y)) {
- case T_BIGNUM:
+ else if (RB_TYPE_P(y, T_BIGNUM)) {
x = rb_int2big(FIX2LONG(x));
return rb_big_div(x, y);
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
{
double div;
@@ -2807,11 +3039,11 @@ fix_divide(VALUE x, VALUE y, ID op)
return rb_dbl2big(floor(div));
}
}
- case T_RATIONAL:
- if (op == '/' && FIX2LONG(x) == 1)
+ }
+ else {
+ if (RB_TYPE_P(y, T_RATIONAL) &&
+ op == '/' && FIX2LONG(x) == 1)
return rb_rational_reciprocal(y);
- /* fall through */
- default:
return rb_num_coerce_bin(x, y, op);
}
}
@@ -2820,9 +3052,8 @@ fix_divide(VALUE x, VALUE y, ID op)
* call-seq:
* fix / numeric -> numeric_result
*
- * Performs division: the class of the resulting object depends on
- * the class of <code>numeric</code> and on the magnitude of the
- * result.
+ * Performs division: the class of the resulting object depends on the class of
+ * +numeric+ and on the magnitude of the result. It may return a Bignum.
*/
static VALUE
@@ -2835,7 +3066,8 @@ fix_div(VALUE x, VALUE y)
* call-seq:
* fix.div(numeric) -> integer
*
- * Performs integer division: returns integer value.
+ * Performs integer division: returns integer result of dividing +fix+ by
+ * +numeric+.
*/
static VALUE
@@ -2849,8 +3081,9 @@ fix_idiv(VALUE x, VALUE y)
* fix % other -> real
* fix.modulo(other) -> real
*
- * Returns <code>fix</code> modulo <code>other</code>.
- * See <code>numeric.divmod</code> for more information.
+ * Returns +fix+ modulo +other+.
+ *
+ * See Numeric#divmod for more information.
*/
static VALUE
@@ -2862,13 +3095,14 @@ fix_mod(VALUE x, VALUE y)
fixdivmod(FIX2LONG(x), FIX2LONG(y), 0, &mod);
return LONG2NUM(mod);
}
- switch (TYPE(y)) {
- case T_BIGNUM:
+ else if (RB_TYPE_P(y, T_BIGNUM)) {
x = rb_int2big(FIX2LONG(x));
return rb_big_modulo(x, y);
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
return DBL2NUM(ruby_float_mod((double)FIX2LONG(x), RFLOAT_VALUE(y)));
- default:
+ }
+ else {
return rb_num_coerce_bin(x, y, '%');
}
}
@@ -2877,7 +3111,7 @@ fix_mod(VALUE x, VALUE y)
* call-seq:
* fix.divmod(numeric) -> array
*
- * See <code>Numeric#divmod</code>.
+ * See Numeric#divmod.
*/
static VALUE
fix_divmod(VALUE x, VALUE y)
@@ -2889,11 +3123,11 @@ fix_divmod(VALUE x, VALUE y)
return rb_assoc_new(LONG2NUM(div), LONG2NUM(mod));
}
- switch (TYPE(y)) {
- case T_BIGNUM:
+ else if (RB_TYPE_P(y, T_BIGNUM)) {
x = rb_int2big(FIX2LONG(x));
return rb_big_divmod(x, y);
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
{
double div, mod;
volatile VALUE a, b;
@@ -2903,7 +3137,8 @@ fix_divmod(VALUE x, VALUE y)
b = DBL2NUM(mod);
return rb_assoc_new(a, b);
}
- default:
+ }
+ else {
return rb_num_coerce_bin(x, y, rb_intern("divmod"));
}
}
@@ -2943,12 +3178,18 @@ int_pow(long x, unsigned long y)
return LONG2NUM(z);
}
+VALUE
+rb_int_positive_pow(long x, unsigned long y)
+{
+ return int_pow(x, y);
+}
+
/*
* call-seq:
* fix ** numeric -> numeric_result
*
- * Raises <code>fix</code> to the <code>numeric</code> power, which may
- * be negative or fractional.
+ * Raises +fix+ to the power of +numeric+, which may be negative or
+ * fractional.
*
* 2 ** 3 #=> 8
* 2 ** -1 #=> (1/2)
@@ -2981,8 +3222,7 @@ fix_pow(VALUE x, VALUE y)
}
return int_pow(a, b);
}
- switch (TYPE(y)) {
- case T_BIGNUM:
+ else if (RB_TYPE_P(y, T_BIGNUM)) {
if (a == 1) return INT2FIX(1);
if (a == -1) {
if (int_even_p(y)) return INT2FIX(1);
@@ -2993,7 +3233,8 @@ fix_pow(VALUE x, VALUE y)
if (a == 0) return INT2FIX(0);
x = rb_int2big(FIX2LONG(x));
return rb_big_pow(x, y);
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
if (RFLOAT_VALUE(y) == 0.0) return DBL2NUM(1.0);
if (a == 0) {
return DBL2NUM(RFLOAT_VALUE(y) < 0 ? INFINITY : 0.0);
@@ -3005,7 +3246,8 @@ fix_pow(VALUE x, VALUE y)
return rb_funcall(rb_complex_raw1(x), rb_intern("**"), 1, y);
return DBL2NUM(pow((double)a, dy));
}
- default:
+ }
+ else {
return rb_num_coerce_bin(x, y, rb_intern("**"));
}
}
@@ -3014,8 +3256,7 @@ fix_pow(VALUE x, VALUE y)
* call-seq:
* fix == other -> true or false
*
- * Return <code>true</code> if <code>fix</code> equals <code>other</code>
- * numerically.
+ * Return +true+ if +fix+ equals +other+ numerically.
*
* 1 == 2 #=> false
* 1 == 1.0 #=> true
@@ -3026,12 +3267,13 @@ fix_equal(VALUE x, VALUE y)
{
if (x == y) return Qtrue;
if (FIXNUM_P(y)) return Qfalse;
- switch (TYPE(y)) {
- case T_BIGNUM:
+ else if (RB_TYPE_P(y, T_BIGNUM)) {
return rb_big_eq(y, x);
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
return rb_integer_float_eq(x, y);
- default:
+ }
+ else {
return num_equal(x, y);
}
}
@@ -3040,9 +3282,10 @@ fix_equal(VALUE x, VALUE y)
* call-seq:
* fix <=> numeric -> -1, 0, +1 or nil
*
- * Comparison---Returns -1, 0, +1 or nil depending on whether +fix+ is less
- * than, equal to, or greater than +numeric+. This is the basis for the tests
- * in Comparable.
+ * Comparison---Returns +-1+, +0+, ++1+ or +nil+ depending on whether +fix+ is
+ * less than, equal to, or greater than +numeric+.
+ *
+ * This is the basis for the tests in the Comparable module.
*
* +nil+ is returned if the two values are incomparable.
*/
@@ -3055,13 +3298,14 @@ fix_cmp(VALUE x, VALUE y)
if (FIX2LONG(x) > FIX2LONG(y)) return INT2FIX(1);
return INT2FIX(-1);
}
- switch (TYPE(y)) {
- case T_BIGNUM:
+ else if (RB_TYPE_P(y, T_BIGNUM)) {
return rb_big_cmp(rb_int2big(FIX2LONG(x)), y);
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
return rb_integer_float_cmp(x, y);
- default:
- return rb_num_coerce_cmp(x, y, rb_intern("<=>"));
+ }
+ else {
+ return rb_num_coerce_cmp(x, y, id_cmp);
}
}
@@ -3069,8 +3313,7 @@ fix_cmp(VALUE x, VALUE y)
* call-seq:
* fix > real -> true or false
*
- * Returns <code>true</code> if the value of <code>fix</code> is
- * greater than that of <code>real</code>.
+ * Returns +true+ if the value of +fix+ is greater than that of +real+.
*/
static VALUE
@@ -3080,12 +3323,13 @@ fix_gt(VALUE x, VALUE y)
if (FIX2LONG(x) > FIX2LONG(y)) return Qtrue;
return Qfalse;
}
- switch (TYPE(y)) {
- case T_BIGNUM:
+ else if (RB_TYPE_P(y, T_BIGNUM)) {
return FIX2INT(rb_big_cmp(rb_int2big(FIX2LONG(x)), y)) > 0 ? Qtrue : Qfalse;
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
return rb_integer_float_cmp(x, y) == INT2FIX(1) ? Qtrue : Qfalse;
- default:
+ }
+ else {
return rb_num_coerce_relop(x, y, '>');
}
}
@@ -3094,8 +3338,8 @@ fix_gt(VALUE x, VALUE y)
* call-seq:
* fix >= real -> true or false
*
- * Returns <code>true</code> if the value of <code>fix</code> is
- * greater than or equal to that of <code>real</code>.
+ * Returns +true+ if the value of +fix+ is greater than or equal to that of
+ * +real+.
*/
static VALUE
@@ -3105,15 +3349,14 @@ fix_ge(VALUE x, VALUE y)
if (FIX2LONG(x) >= FIX2LONG(y)) return Qtrue;
return Qfalse;
}
- switch (TYPE(y)) {
- case T_BIGNUM:
+ else if (RB_TYPE_P(y, T_BIGNUM)) {
return FIX2INT(rb_big_cmp(rb_int2big(FIX2LONG(x)), y)) >= 0 ? Qtrue : Qfalse;
- case T_FLOAT:
- {
- VALUE rel = rb_integer_float_cmp(x, y);
- return rel == INT2FIX(1) || rel == INT2FIX(0) ? Qtrue : Qfalse;
- }
- default:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
+ VALUE rel = rb_integer_float_cmp(x, y);
+ return rel == INT2FIX(1) || rel == INT2FIX(0) ? Qtrue : Qfalse;
+ }
+ else {
return rb_num_coerce_relop(x, y, rb_intern(">="));
}
}
@@ -3122,8 +3365,7 @@ fix_ge(VALUE x, VALUE y)
* call-seq:
* fix < real -> true or false
*
- * Returns <code>true</code> if the value of <code>fix</code> is
- * less than that of <code>real</code>.
+ * Returns +true+ if the value of +fix+ is less than that of +real+.
*/
static VALUE
@@ -3133,12 +3375,13 @@ fix_lt(VALUE x, VALUE y)
if (FIX2LONG(x) < FIX2LONG(y)) return Qtrue;
return Qfalse;
}
- switch (TYPE(y)) {
- case T_BIGNUM:
+ else if (RB_TYPE_P(y, T_BIGNUM)) {
return FIX2INT(rb_big_cmp(rb_int2big(FIX2LONG(x)), y)) < 0 ? Qtrue : Qfalse;
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
return rb_integer_float_cmp(x, y) == INT2FIX(-1) ? Qtrue : Qfalse;
- default:
+ }
+ else {
return rb_num_coerce_relop(x, y, '<');
}
}
@@ -3147,8 +3390,8 @@ fix_lt(VALUE x, VALUE y)
* call-seq:
* fix <= real -> true or false
*
- * Returns <code>true</code> if the value of <code>fix</code> is
- * less than or equal to that of <code>real</code>.
+ * Returns +true+ if the value of +fix+ is less than or equal to that of
+ * +real+.
*/
static VALUE
@@ -3158,15 +3401,14 @@ fix_le(VALUE x, VALUE y)
if (FIX2LONG(x) <= FIX2LONG(y)) return Qtrue;
return Qfalse;
}
- switch (TYPE(y)) {
- case T_BIGNUM:
+ else if (RB_TYPE_P(y, T_BIGNUM)) {
return FIX2INT(rb_big_cmp(rb_int2big(FIX2LONG(x)), y)) <= 0 ? Qtrue : Qfalse;
- case T_FLOAT:
- {
- VALUE rel = rb_integer_float_cmp(x, y);
- return rel == INT2FIX(-1) || rel == INT2FIX(0) ? Qtrue : Qfalse;
- }
- default:
+ }
+ else if (RB_TYPE_P(y, T_FLOAT)) {
+ VALUE rel = rb_integer_float_cmp(x, y);
+ return rel == INT2FIX(-1) || rel == INT2FIX(0) ? Qtrue : Qfalse;
+ }
+ else {
return rb_num_coerce_relop(x, y, rb_intern("<="));
}
}
@@ -3185,18 +3427,13 @@ fix_rev(VALUE num)
}
static int
-bit_coerce(VALUE *x, VALUE *y, int err)
+bit_coerce(VALUE *x, VALUE *y)
{
if (!FIXNUM_P(*y) && !RB_TYPE_P(*y, T_BIGNUM)) {
- do_coerce(x, y, err);
+ do_coerce(x, y, TRUE);
if (!FIXNUM_P(*x) && !RB_TYPE_P(*x, T_BIGNUM)
&& !FIXNUM_P(*y) && !RB_TYPE_P(*y, T_BIGNUM)) {
- 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));
+ coerce_failed(*x, *y);
}
}
return TRUE;
@@ -3205,7 +3442,7 @@ bit_coerce(VALUE *x, VALUE *y, int err)
VALUE
rb_num_coerce_bit(VALUE x, VALUE y, ID func)
{
- bit_coerce(&x, &y, TRUE);
+ bit_coerce(&x, &y);
return rb_funcall(x, func, 1, y);
}
@@ -3228,7 +3465,7 @@ fix_and(VALUE x, VALUE y)
return rb_big_and(y, x);
}
- bit_coerce(&x, &y, TRUE);
+ bit_coerce(&x, &y);
return rb_funcall(x, rb_intern("&"), 1, y);
}
@@ -3251,7 +3488,7 @@ fix_or(VALUE x, VALUE y)
return rb_big_or(y, x);
}
- bit_coerce(&x, &y, TRUE);
+ bit_coerce(&x, &y);
return rb_funcall(x, rb_intern("|"), 1, y);
}
@@ -3274,7 +3511,7 @@ fix_xor(VALUE x, VALUE y)
return rb_big_xor(y, x);
}
- bit_coerce(&x, &y, TRUE);
+ bit_coerce(&x, &y);
return rb_funcall(x, rb_intern("^"), 1, y);
}
@@ -3285,7 +3522,7 @@ static VALUE fix_rshift(long, unsigned long);
* call-seq:
* fix << count -> integer
*
- * Shifts _fix_ left _count_ positions (right if _count_ is negative).
+ * Shifts +fix+ left +count+ positions, or right if +count+ is negative.
*/
static VALUE
@@ -3317,7 +3554,7 @@ fix_lshift(long val, unsigned long width)
* call-seq:
* fix >> count -> integer
*
- * Shifts _fix_ right _count_ positions (left if _count_ is negative).
+ * Shifts +fix+ right +count+ positions, or left if +count+ is negative.
*/
static VALUE
@@ -3350,16 +3587,14 @@ fix_rshift(long val, unsigned long i)
* call-seq:
* fix[n] -> 0, 1
*
- * Bit Reference---Returns the <em>n</em>th bit in the binary
- * representation of <i>fix</i>, where <i>fix</i>[0] is the least
- * significant bit.
+ * Bit Reference---Returns the +n+th bit in the binary representation of
+ * +fix+, where <code>fix[0]</code> is the least significant bit.
+ *
+ * For example:
*
* a = 0b11001100101010
* 30.downto(0) do |n| print a[n] end
- *
- * <em>produces:</em>
- *
- * 0000000000000000011001100101010
+ * #=> 0000000000000000011001100101010
*/
static VALUE
@@ -3372,7 +3607,7 @@ fix_aref(VALUE fix, VALUE idx)
if (!FIXNUM_P(idx)) {
idx = rb_big_norm(idx);
if (!FIXNUM_P(idx)) {
- if (!RBIGNUM_SIGN(idx) || val >= 0)
+ if (!BIGNUM_SIGN(idx) || val >= 0)
return INT2FIX(0);
return INT2FIX(1);
}
@@ -3380,7 +3615,7 @@ fix_aref(VALUE fix, VALUE idx)
i = FIX2LONG(idx);
if (i < 0) return INT2FIX(0);
- if (SIZEOF_LONG*CHAR_BIT-1 < i) {
+ if (SIZEOF_LONG*CHAR_BIT-1 <= i) {
if (val < 0) return INT2FIX(1);
return INT2FIX(0);
}
@@ -3393,7 +3628,7 @@ fix_aref(VALUE fix, VALUE idx)
* call-seq:
* fix.to_f -> float
*
- * Converts <i>fix</i> to a <code>Float</code>.
+ * Converts +fix+ to a Float.
*
*/
@@ -3412,7 +3647,7 @@ fix_to_f(VALUE num)
* fix.abs -> integer
* fix.magnitude -> integer
*
- * Returns the absolute value of <i>fix</i>.
+ * Returns the absolute value of +fix+.
*
* -12345.abs #=> 12345
* 12345.abs #=> 12345
@@ -3435,8 +3670,7 @@ fix_abs(VALUE fix)
* call-seq:
* fix.size -> fixnum
*
- * Returns the number of <em>bytes</em> in the machine representation
- * of a <code>Fixnum</code>.
+ * Returns the number of bytes in the machine representation of +fix+.
*
* 1.size #=> 4
* -1.size #=> 4
@@ -3449,10 +3683,57 @@ fix_size(VALUE fix)
return INT2FIX(sizeof(long));
}
+/*
+ * call-seq:
+ * int.bit_length -> integer
+ *
+ * Returns the number of bits of the value of <i>int</i>.
+ *
+ * "the number of bits" means that
+ * the bit position of the highest bit which is different to the sign bit.
+ * (The bit position of the bit 2**n is n+1.)
+ * If there is no such bit (zero or minus one), zero is returned.
+ *
+ * I.e. This method returns ceil(log2(int < 0 ? -int : int+1)).
+ *
+ * (-2**12-1).bit_length #=> 13
+ * (-2**12).bit_length #=> 12
+ * (-2**12+1).bit_length #=> 12
+ * -0x101.bit_length #=> 9
+ * -0x100.bit_length #=> 8
+ * -0xff.bit_length #=> 8
+ * -2.bit_length #=> 1
+ * -1.bit_length #=> 0
+ * 0.bit_length #=> 0
+ * 1.bit_length #=> 1
+ * 0xff.bit_length #=> 8
+ * 0x100.bit_length #=> 9
+ * (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
+rb_fix_bit_length(VALUE fix)
+{
+ long v = FIX2LONG(fix);
+ if (v < 0)
+ v = ~v;
+ return LONG2FIX(bit_length(v));
+}
+
static VALUE
-int_upto_size(VALUE from, VALUE args)
+int_upto_size(VALUE from, VALUE args, VALUE eobj)
{
- return num_interval_step_size(from, RARRAY_PTR(args)[0], INT2FIX(1), FALSE);
+ return ruby_num_interval_step_size(from, RARRAY_AREF(args, 0), INT2FIX(1), FALSE);
}
/*
@@ -3460,16 +3741,15 @@ int_upto_size(VALUE from, VALUE args)
* int.upto(limit) {|i| block } -> self
* int.upto(limit) -> an_enumerator
*
- * Iterates <em>block</em>, passing in integer values from <i>int</i>
- * up to and including <i>limit</i>.
- *
- * If no block is given, an enumerator is returned instead.
+ * Iterates the given block, passing in integer values from +int+ up to and
+ * including +limit+.
*
- * 5.upto(10) { |i| print i, " " }
+ * If no block is given, an Enumerator is returned instead.
*
- * <em>produces:</em>
+ * For example:
*
- * 5 6 7 8 9 10
+ * 5.upto(10) { |i| print i, " " }
+ * #=> 5 6 7 8 9 10
*/
static VALUE
@@ -3497,9 +3777,9 @@ int_upto(VALUE from, VALUE to)
}
static VALUE
-int_downto_size(VALUE from, VALUE args)
+int_downto_size(VALUE from, VALUE args, VALUE eobj)
{
- return num_interval_step_size(from, RARRAY_PTR(args)[0], INT2FIX(-1), FALSE);
+ return ruby_num_interval_step_size(from, RARRAY_AREF(args, 0), INT2FIX(-1), FALSE);
}
/*
@@ -3507,17 +3787,14 @@ int_downto_size(VALUE from, VALUE args)
* int.downto(limit) {|i| block } -> self
* int.downto(limit) -> an_enumerator
*
- * Iterates <em>block</em>, passing decreasing values from <i>int</i>
- * down to and including <i>limit</i>.
+ * Iterates the given block, passing decreasing values from +int+ down to and
+ * including +limit+.
*
- * If no block is given, an enumerator is returned instead.
+ * If no block is given, an Enumerator is returned instead.
*
* 5.downto(1) { |n| print n, ".. " }
* print " Liftoff!\n"
- *
- * <em>produces:</em>
- *
- * 5.. 4.. 3.. 2.. 1.. Liftoff!
+ * #=> "5.. 4.. 3.. 2.. 1.. Liftoff!"
*/
static VALUE
@@ -3545,7 +3822,7 @@ int_downto(VALUE from, VALUE to)
}
static VALUE
-int_dotimes_size(VALUE num)
+int_dotimes_size(VALUE num, VALUE args, VALUE eobj)
{
if (FIXNUM_P(num)) {
if (NUM2LONG(num) <= 0) return INT2FIX(0);
@@ -3561,18 +3838,15 @@ int_dotimes_size(VALUE num)
* int.times {|i| block } -> self
* int.times -> an_enumerator
*
- * Iterates block <i>int</i> times, passing in values from zero to
- * <i>int</i> - 1.
+ * Iterates the given block +int+ times, passing in values from zero to
+ * <code>int - 1</code>.
*
- * If no block is given, an enumerator is returned instead.
+ * If no block is given, an Enumerator is returned instead.
*
* 5.times do |i|
* print i, " "
* end
- *
- * <em>produces:</em>
- *
- * 0 1 2 3 4
+ * #=> 0 1 2 3 4
*/
static VALUE
@@ -3604,7 +3878,8 @@ int_dotimes(VALUE num)
* call-seq:
* int.round([ndigits]) -> integer or float
*
- * Rounds <i>flt</i> to a given precision in decimal digits (default 0 digits).
+ * Rounds +int+ to a given precision in decimal digits (default 0 digits).
+ *
* Precision may be negative. Returns a floating point number when +ndigits+
* is positive, +self+ for zero, and round down for negative.
*
@@ -3635,7 +3910,7 @@ int_round(int argc, VALUE* argv, VALUE num)
* call-seq:
* fix.zero? -> true or false
*
- * Returns <code>true</code> if <i>fix</i> is zero.
+ * Returns +true+ if +fix+ is zero.
*
*/
@@ -3652,7 +3927,7 @@ fix_zero_p(VALUE num)
* call-seq:
* fix.odd? -> true or false
*
- * Returns <code>true</code> if <i>fix</i> is an odd number.
+ * Returns +true+ if +fix+ is an odd number.
*/
static VALUE
@@ -3668,7 +3943,7 @@ fix_odd_p(VALUE num)
* call-seq:
* fix.even? -> true or false
*
- * Returns <code>true</code> if <i>fix</i> is an even number.
+ * Returns +true+ if +fix+ is an even number.
*/
static VALUE
@@ -3686,12 +3961,9 @@ fix_even_p(VALUE num)
* Raised when attempting to divide an integer by 0.
*
* 42 / 0
+ * #=> ZeroDivisionError: divided by 0
*
- * <em>raises the exception:</em>
- *
- * ZeroDivisionError: divided by 0
- *
- * Note that only division by an exact 0 will raise that exception:
+ * Note that only division by an exact 0 will raise the exception:
*
* 42 / 0.0 #=> Float::INFINITY
* 42 / -0.0 #=> -Float::INFINITY
@@ -3701,17 +3973,16 @@ fix_even_p(VALUE num)
/*
* Document-class: FloatDomainError
*
- * Raised when attempting to convert special float values
- * (in particular infinite or NaN)
- * to numerical classes which don't support them.
+ * Raised when attempting to convert special float values (in particular
+ * +infinite+ or +NaN+) to numerical classes which don't support them.
*
* Float::INFINITY.to_r
- *
- * <em>raises the exception:</em>
- *
- * FloatDomainError: Infinity
+ * #=> FloatDomainError: Infinity
*/
+/*
+ * The top-level number class.
+ */
void
Init_Numeric(void)
{
@@ -3730,8 +4001,6 @@ Init_Numeric(void)
_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");
rb_eZeroDivError = rb_define_class("ZeroDivisionError", rb_eStandardError);
@@ -3748,7 +4017,6 @@ Init_Numeric(void)
rb_define_method(rb_cNumeric, "-@", num_uminus, 0);
rb_define_method(rb_cNumeric, "<=>", num_cmp, 1);
rb_define_method(rb_cNumeric, "eql?", num_eql, 1);
- rb_define_method(rb_cNumeric, "quo", num_quo, 1);
rb_define_method(rb_cNumeric, "fdiv", num_fdiv, 1);
rb_define_method(rb_cNumeric, "div", num_div, 1);
rb_define_method(rb_cNumeric, "divmod", num_divmod, 1);
@@ -3831,6 +4099,7 @@ Init_Numeric(void)
rb_define_method(rb_cFixnum, "to_f", fix_to_f, 0);
rb_define_method(rb_cFixnum, "size", fix_size, 0);
+ rb_define_method(rb_cFixnum, "bit_length", rb_fix_bit_length, 0);
rb_define_method(rb_cFixnum, "zero?", fix_zero_p, 0);
rb_define_method(rb_cFixnum, "odd?", fix_odd_p, 0);
rb_define_method(rb_cFixnum, "even?", fix_even_p, 0);
@@ -3869,7 +4138,8 @@ Init_Numeric(void)
*/
rb_define_const(rb_cFloat, "MANT_DIG", INT2FIX(DBL_MANT_DIG));
/*
- * The number of decimal digits in a double-precision floating point.
+ * The minimum number of significant decimal digits in a double-precision
+ * floating point.
*
* Usually defaults to 15.
*/
@@ -3968,4 +4238,23 @@ 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);
+
+ id_to = rb_intern("to");
+ id_by = rb_intern("by");
+}
+
+#undef rb_float_value
+double
+rb_float_value(VALUE v)
+{
+ return rb_float_value_inline(v);
+}
+
+#undef rb_float_new
+VALUE
+rb_float_new(double d)
+{
+ return rb_float_new_inline(d);
}
diff --git a/object.c b/object.c
index 350418e68b..5b0f7dfdd7 100644
--- a/object.c
+++ b/object.c
@@ -22,6 +22,7 @@
#include <float.h>
#include "constant.h"
#include "internal.h"
+#include "id.h"
#include "probes.h"
VALUE rb_cBasicObject;
@@ -35,14 +36,46 @@ VALUE rb_cNilClass;
VALUE rb_cTrueClass;
VALUE rb_cFalseClass;
-static ID id_eq, id_eql, id_match, id_inspect;
-static ID id_init_copy, id_init_clone, id_init_dup;
-static ID id_const_missing;
+#define id_eq idEq
+#define id_eql idEqlP
+#define id_match idEqTilde
+#define id_inspect idInspect
+#define id_init_copy idInitialize_copy
+#define id_init_clone idInitialize_clone
+#define id_init_dup idInitialize_dup
+#define id_const_missing idConst_missing
#define CLASS_OR_MODULE_P(obj) \
(!SPECIAL_CONST_P(obj) && \
(BUILTIN_TYPE(obj) == T_CLASS || BUILTIN_TYPE(obj) == T_MODULE))
+VALUE
+rb_obj_hide(VALUE obj)
+{
+ if (!SPECIAL_CONST_P(obj)) {
+ RBASIC_CLEAR_CLASS(obj);
+ }
+ return obj;
+}
+
+VALUE
+rb_obj_reveal(VALUE obj, VALUE klass)
+{
+ if (!SPECIAL_CONST_P(obj)) {
+ RBASIC_SET_CLASS(obj, klass);
+ }
+ return obj;
+}
+
+VALUE
+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;
+}
+
/*
* call-seq:
* obj === other -> true or false
@@ -88,9 +121,9 @@ rb_eql(VALUE obj1, VALUE obj2)
* obj = "a"
* other = obj.dup
*
- * a == other #=> true
- * a.equal? other #=> false
- * a.equal? a #=> true
+ * obj == other #=> true
+ * obj.equal? other #=> false
+ * obj.equal? obj #=> true
*
* The <code>eql?</code> method returns <code>true</code> if +obj+ and
* +other+ refer to the same hash key. This is used by Hash to test members
@@ -113,6 +146,9 @@ rb_obj_equal(VALUE obj1, VALUE obj2)
}
/*
+ * 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>.
*
@@ -128,6 +164,7 @@ rb_obj_equal(VALUE obj1, VALUE obj2)
VALUE
rb_obj_hash(VALUE obj)
{
+ long rb_objid_hash(st_index_t index);
VALUE oid = rb_obj_id(obj);
#if SIZEOF_LONG == SIZEOF_VOIDP
st_index_t index = NUM2LONG(oid);
@@ -136,8 +173,7 @@ rb_obj_hash(VALUE obj)
#else
# error not supported
#endif
- st_index_t h = rb_hash_end(rb_hash_start(index));
- return LONG2FIX(h);
+ return LONG2FIX(rb_objid_hash(index));
}
/*
@@ -219,6 +255,35 @@ 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;
+ }
+}
+
+void rb_copy_wb_protected_attribute(VALUE dest, VALUE obj);
+
static void
init_copy(VALUE dest, VALUE obj)
{
@@ -226,45 +291,12 @@ init_copy(VALUE dest, VALUE obj)
rb_raise(rb_eTypeError, "[bug] frozen object (%s) allocated", rb_obj_classname(dest));
}
RBASIC(dest)->flags &= ~(T_MASK|FL_EXIVAR);
- RBASIC(dest)->flags |= RBASIC(obj)->flags & (T_MASK|FL_EXIVAR|FL_TAINT|FL_UNTRUSTED);
+ 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);
- 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) = st_copy(RCLASS_IV_TBL(obj));
- }
- break;
+ if (RB_TYPE_P(obj, T_OBJECT)) {
+ rb_obj_copy_ivar(dest, obj);
}
}
@@ -302,13 +334,15 @@ 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);
+ RBASIC(clone)->flags |= RBASIC(obj)->flags & ~(FL_PROMOTED0|FL_PROMOTED1|FL_FREEZE|FL_FINALIZE);
+
singleton = rb_singleton_class_clone_and_attach(obj, clone);
- RBASIC(clone)->klass = singleton;
+ RBASIC_SET_CLASS(clone, singleton);
if (FL_TEST(singleton, FL_SINGLETON)) {
rb_singleton_class_attached(singleton, clone);
}
- RBASIC(clone)->flags &= (FL_TAINT|FL_UNTRUSTED);
- RBASIC(clone)->flags |= RBASIC(obj)->flags & ~(FL_FREEZE|FL_FINALIZE);
+
init_copy(clone, obj);
rb_funcall(clone, id_init_clone, 1, obj);
RBASIC(clone)->flags |= RBASIC(obj)->flags & FL_FREEZE;
@@ -321,17 +355,42 @@ 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>. See also
- * the discussion under <code>Object#clone</code>. In general,
- * <code>clone</code> and <code>dup</code> may have different semantics
- * in descendant classes. While <code>clone</code> is used to duplicate
- * an object, including its internal state, <code>dup</code> typically
- * uses the class of the descendant object to create the new instance.
+ * <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
* the class.
+ *
+ * === on dup vs clone
+ *
+ * In general, <code>clone</code> and <code>dup</code> may have different
+ * semantics in descendant classes. While <code>clone</code> is used to
+ * duplicate an object, including its internal state, <code>dup</code>
+ * 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
+ * be copied.
+ *
+ * class Klass
+ * attr_accessor :str
+ * end
+ *
+ * module Foo
+ * def foo; 'foo'; end
+ * end
+ *
+ * s1 = Klass.new #=> #<Klass:0x401b3a38>
+ * s1.extend(Foo) #=> #<Klass:0x401b3a38>
+ * s1.foo #=> "foo"
+ *
+ * s2 = s1.clone #=> #<Klass:0x401b3a38>
+ * s2.foo #=> "foo"
+ *
+ * s3 = s1.dup #=> #<Klass:0x401b3a38>
+ * s3.foo #=> NoMethodError: undefined method `foo' for #<Klass:0x401b3a38>
+ *
*/
VALUE
@@ -349,6 +408,23 @@ 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)
@@ -395,7 +471,7 @@ rb_any_to_s(VALUE obj)
/*
* 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 incomapatible,
+ * If the default external encoding is ASCII incompatible,
* the result must be ASCII only.
*/
VALUE
@@ -409,7 +485,7 @@ rb_inspect(VALUE obj)
return 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 same encoding with default external");
+ rb_raise(rb_eEncCompatError, "inspected result must be ASCII only or use the default external encoding");
return str;
}
@@ -524,6 +600,8 @@ 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
@@ -584,15 +662,27 @@ rb_obj_is_kind_of(VALUE obj, VALUE c)
VALUE cl = CLASS_OF(obj);
c = class_or_module_required(c);
- c = RCLASS_ORIGIN(c);
+ return class_search_ancestor(cl, RCLASS_ORIGIN(c)) ? Qtrue : Qfalse;
+}
+
+static VALUE
+class_search_ancestor(VALUE cl, VALUE c)
+{
while (cl) {
- if (cl == c || RCLASS_M_TBL(cl) == RCLASS_M_TBL(c))
- return Qtrue;
+ if (cl == c || RCLASS_M_TBL_WRAPPER(cl) == RCLASS_M_TBL_WRAPPER(c))
+ return cl;
cl = RCLASS_SUPER(cl);
}
- return Qfalse;
+ return 0;
}
+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:
@@ -854,7 +944,9 @@ rb_obj_dummy(void)
* call-seq:
* obj.tainted? -> true or false
*
- * Returns <code>true</code> if the object is tainted.
+ * Returns true if the object is tainted.
+ *
+ * See #taint for more information.
*/
VALUE
@@ -869,16 +961,26 @@ rb_obj_tainted(VALUE obj)
* call-seq:
* obj.taint -> obj
*
- * Marks <i>obj</i> as tainted---if the <code>$SAFE</code> level is
- * set appropriately, many method calls which might alter the running
- * programs environment will refuse to accept tainted strings.
+ * Mark the object as tainted.
+ *
+ * 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 users
+ * system.
+ *
+ * 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
+ *
+ * In $SAFE level 3, all newly created objects are tainted and you can't untaint
+ * objects.
*/
VALUE
rb_obj_taint(VALUE obj)
{
- rb_secure(4);
- if (!OBJ_TAINTED(obj)) {
+ if (!OBJ_TAINTED(obj) && OBJ_TAINTABLE(obj)) {
rb_check_frozen(obj);
OBJ_TAINT(obj);
}
@@ -890,7 +992,9 @@ rb_obj_taint(VALUE obj)
* call-seq:
* obj.untaint -> obj
*
- * Removes the taint from <i>obj</i>.
+ * Removes the tainted mark from the object.
+ *
+ * See #taint for more information.
*/
VALUE
@@ -908,33 +1012,28 @@ rb_obj_untaint(VALUE obj)
* call-seq:
* obj.untrusted? -> true or false
*
- * Returns <code>true</code> if the object is untrusted.
+ * Deprecated method that is equivalent to #tainted?.
*/
VALUE
rb_obj_untrusted(VALUE obj)
{
- if (OBJ_UNTRUSTED(obj))
- return Qtrue;
- return Qfalse;
+ rb_warning("untrusted? is deprecated and its behavior is same as tainted?");
+ return rb_obj_tainted(obj);
}
/*
* call-seq:
* obj.untrust -> obj
*
- * Marks <i>obj</i> as untrusted.
+ * Deprecated method that is equivalent to #taint.
*/
VALUE
rb_obj_untrust(VALUE obj)
{
- rb_secure(4);
- if (!OBJ_UNTRUSTED(obj)) {
- rb_check_frozen(obj);
- OBJ_UNTRUST(obj);
- }
- return obj;
+ rb_warning("untrust is deprecated and its behavior is same as taint");
+ return rb_obj_taint(obj);
}
@@ -942,18 +1041,14 @@ rb_obj_untrust(VALUE obj)
* call-seq:
* obj.trust -> obj
*
- * Removes the untrusted mark from <i>obj</i>.
+ * Deprecated method that is equivalent to #untaint.
*/
VALUE
rb_obj_trust(VALUE obj)
{
- rb_secure(3);
- if (OBJ_UNTRUSTED(obj)) {
- rb_check_frozen(obj);
- FL_UNSET(obj, FL_UNTRUSTED);
- }
- return obj;
+ rb_warning("trust is deprecated and its behavior is same as untaint");
+ return rb_obj_untaint(obj);
}
void
@@ -962,8 +1057,6 @@ rb_obj_infect(VALUE obj1, VALUE obj2)
OBJ_INFECT(obj1, obj2);
}
-static st_table *immediate_frozen_tbl = 0;
-
/*
* call-seq:
* obj.freeze -> obj
@@ -983,21 +1076,18 @@ static st_table *immediate_frozen_tbl = 0;
*
* 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
rb_obj_freeze(VALUE obj)
{
if (!OBJ_FROZEN(obj)) {
- if (rb_safe_level() >= 4 && !OBJ_UNTRUSTED(obj)) {
- rb_raise(rb_eSecurityError, "Insecure: can't freeze object");
- }
OBJ_FREEZE(obj);
if (SPECIAL_CONST_P(obj)) {
- if (!immediate_frozen_tbl) {
- immediate_frozen_tbl = st_init_numtable();
- }
- st_insert(immediate_frozen_tbl, obj, (st_data_t)Qtrue);
+ rb_bug("special consts should be frozen.");
}
}
return obj;
@@ -1017,12 +1107,7 @@ rb_obj_freeze(VALUE obj)
VALUE
rb_obj_frozen_p(VALUE obj)
{
- 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;
+ return OBJ_FROZEN(obj) ? Qtrue : Qfalse;
}
@@ -1275,7 +1360,7 @@ false_xor(VALUE obj, VALUE obj2)
}
/*
- * call_seq:
+ * call-seq:
* nil.nil? -> true
*
* Only the object <i>nil</i> responds <code>true</code> to <code>nil?</code>.
@@ -1288,7 +1373,7 @@ rb_true(VALUE obj)
}
/*
- * call_seq:
+ * call-seq:
* nil.nil? -> true
* <anything_else>.nil? -> false
*
@@ -1341,16 +1426,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 <=> is used by various methods to compare objects, for example
+ * The <code><=></code> is used by various methods to compare objects, for example
* Enumerable#sort, Enumerable#max etc.
*
- * Your implementation of <=> should return one of the following values: -1, 0,
+ * Your implementation of <code><=></code> 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 <=>, you can include Comparable to gain the methods <=, <,
- * ==, >=, > and between?.
+ * 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>.
*/
static VALUE
rb_obj_cmp(VALUE obj1, VALUE obj2)
@@ -1405,7 +1490,7 @@ rb_mod_to_s(VALUE klass)
if (FL_TEST(klass, FL_SINGLETON)) {
VALUE s = rb_usascii_str_new2("#<Class:");
- VALUE v = rb_iv_get(klass, "__attached__");
+ VALUE v = rb_ivar_get(klass, id__attached__);
if (CLASS_OR_MODULE_P(v)) {
rb_str_append(s, rb_inspect(v));
@@ -1486,16 +1571,12 @@ rb_class_inherited_p(VALUE mod, VALUE arg)
rb_raise(rb_eTypeError, "compared with non class/module");
}
arg = RCLASS_ORIGIN(arg);
- while (mod) {
- if (RCLASS_M_TBL(mod) == RCLASS_M_TBL(arg))
- return Qtrue;
- mod = RCLASS_SUPER(mod);
+ if (class_search_ancestor(mod, arg)) {
+ return Qtrue;
}
/* not mod < arg; check if mod > arg */
- while (arg) {
- if (RCLASS_M_TBL(arg) == RCLASS_M_TBL(start))
- return Qfalse;
- arg = RCLASS_SUPER(arg);
+ if (class_search_ancestor(arg, start)) {
+ return Qfalse;
}
return Qnil;
}
@@ -1594,7 +1675,7 @@ rb_module_s_alloc(VALUE klass)
{
VALUE mod = rb_module_new();
- RBASIC(mod)->klass = klass;
+ RBASIC_SET_CLASS(mod, klass);
return mod;
}
@@ -1639,6 +1720,17 @@ 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
@@ -1687,7 +1779,7 @@ rb_class_initialize(int argc, VALUE *argv, VALUE klass)
rb_raise(rb_eTypeError, "can't inherit uninitialized class");
}
}
- RCLASS_SUPER(klass) = super;
+ RCLASS_SET_SUPER(klass, super);
rb_make_metaclass(klass, RBASIC(super)->klass);
rb_class_inherited(super, klass);
rb_mod_initialize(klass);
@@ -1755,7 +1847,7 @@ rb_obj_alloc(VALUE klass)
static VALUE
rb_class_allocate_instance(VALUE klass)
{
- NEWOBJ_OF(obj, struct RObject, klass, T_OBJECT);
+ NEWOBJ_OF(obj, struct RObject, klass, T_OBJECT | (RGENGC_WB_PROTECTED_OBJECT ? FL_WB_PROTECTED : 0));
return (VALUE)obj;
}
@@ -1772,7 +1864,7 @@ rb_class_allocate_instance(VALUE klass)
*/
VALUE
-rb_class_new_instance(int argc, VALUE *argv, VALUE klass)
+rb_class_new_instance(int argc, const VALUE *argv, VALUE klass)
{
VALUE obj;
@@ -1822,17 +1914,76 @@ rb_class_superclass(VALUE klass)
VALUE
rb_class_get_superclass(VALUE klass)
{
- return RCLASS_SUPER(klass);
+ return RCLASS(klass)->super;
+}
+
+#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 name, int (*valid_id_p)(ID), int (*valid_name_p)(VALUE),
+ const char *message)
+{
+ 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_id(ID id)
+{
+ return rb_is_local_id(id) || rb_is_const_id(id);
+}
+
+static int
+rb_is_attr_name(VALUE name)
+{
+ return rb_is_local_name(name) || rb_is_const_name(name);
+}
+
+static const char invalid_attribute_name[] = "invalid attribute name `%"PRIsVALUE"'";
+
+static ID
+id_for_attr(VALUE name)
+{
+ return id_for_setter(name, attr, invalid_attribute_name);
+}
+
+ID
+rb_check_attr_id(ID id)
+{
+ if (!rb_is_attr_id(id)) {
+ rb_name_error_str(id, invalid_attribute_name, QUOTE_ID(id));
+ }
+ return id;
}
/*
* call-seq:
- * attr_reader(symbol, ...) -> nil
- * attr(symbol, ...) -> nil
+ * attr_reader(symbol, ...) -> nil
+ * attr(symbol, ...) -> nil
+ * attr_reader(string, ...) -> nil
+ * attr(string, ...) -> nil
*
* Creates instance variables and corresponding methods that return the
* value of each instance variable. Equivalent to calling
* ``<code>attr</code><i>:name</i>'' on each name in turn.
+ * String arguments are converted to symbols.
*/
static VALUE
@@ -1841,7 +1992,7 @@ rb_mod_attr_reader(int argc, VALUE *argv, VALUE klass)
int i;
for (i=0; i<argc; i++) {
- rb_attr(klass, rb_to_id(argv[i]), TRUE, FALSE, TRUE);
+ rb_attr(klass, id_for_attr(argv[i]), TRUE, FALSE, TRUE);
}
return Qnil;
}
@@ -1851,7 +2002,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, rb_to_id(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);
@@ -1860,9 +2011,11 @@ rb_mod_attr(int argc, VALUE *argv, VALUE klass)
/*
* call-seq:
* attr_writer(symbol, ...) -> nil
+ * attr_writer(string, ...) -> nil
*
* Creates an accessor method to allow assignment to the attribute
* <i>symbol</i><code>.id2name</code>.
+ * String arguments are converted to symbols.
*/
static VALUE
@@ -1871,7 +2024,7 @@ rb_mod_attr_writer(int argc, VALUE *argv, VALUE klass)
int i;
for (i=0; i<argc; i++) {
- rb_attr(klass, rb_to_id(argv[i]), FALSE, TRUE, TRUE);
+ rb_attr(klass, id_for_attr(argv[i]), FALSE, TRUE, TRUE);
}
return Qnil;
}
@@ -1879,11 +2032,13 @@ rb_mod_attr_writer(int argc, VALUE *argv, VALUE klass)
/*
* call-seq:
* attr_accessor(symbol, ...) -> nil
+ * attr_accessor(string, ...) -> nil
*
* Defines a named attribute for this module, where the name is
* <i>symbol.</i><code>id2name</code>, creating an instance variable
* (<code>@name</code>) and a corresponding access method to read it.
* Also creates a method called <code>name=</code> to set the attribute.
+ * String arguments are converted to symbols.
*
* module Mod
* attr_accessor(:one, :two)
@@ -1897,7 +2052,7 @@ rb_mod_attr_accessor(int argc, VALUE *argv, VALUE klass)
int i;
for (i=0; i<argc; i++) {
- rb_attr(klass, rb_to_id(argv[i]), TRUE, TRUE, TRUE);
+ rb_attr(klass, id_for_attr(argv[i]), TRUE, TRUE, TRUE);
}
return Qnil;
}
@@ -1934,6 +2089,12 @@ 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 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
+ *
*/
static VALUE
@@ -1943,7 +2104,6 @@ rb_mod_const_get(int argc, VALUE *argv, VALUE mod)
rb_encoding *enc;
const char *pbeg, *p, *path, *pend;
ID id;
- int nestable = 1;
if (argc == 1) {
name = argv[0];
@@ -1954,15 +2114,13 @@ rb_mod_const_get(int argc, VALUE *argv, VALUE mod)
}
if (SYMBOL_P(name)) {
- name = rb_sym_to_s(name);
- nestable = 0;
+ id = SYM2ID(name);
+ if (!rb_is_const_id(id)) goto wrong_id;
+ return RTEST(recur) ? rb_const_get(mod, id) : rb_const_get_at(mod, id);
}
- name = rb_check_string_type(name);
- Check_Type(name, T_STRING);
-
+ path = StringValuePtr(name);
enc = rb_enc_get(name);
- path = RSTRING_PTR(name);
if (!rb_enc_asciicompat(enc)) {
rb_raise(rb_eArgError, "invalid class path encoding (non ASCII)");
@@ -1978,7 +2136,6 @@ rb_mod_const_get(int argc, VALUE *argv, VALUE mod)
}
if (p + 2 < pend && p[0] == ':' && p[1] == ':') {
- if (!nestable) goto wrong_name;
mod = rb_cObject;
p += 2;
pbeg = p;
@@ -1996,7 +2153,6 @@ 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;
@@ -2008,22 +2164,23 @@ rb_mod_const_get(int argc, VALUE *argv, VALUE mod)
}
if (!id) {
- if (!ISUPPER(*pbeg) || !rb_enc_symname2_p(pbeg, len, enc)) {
- part = rb_str_subseq(name, beglen, len);
+ part = rb_str_subseq(name, beglen, len);
+ OBJ_FREEZE(part);
+ if (!ISUPPER(*pbeg) || !rb_is_const_name(part)) {
rb_name_error_str(part, "wrong constant name %"PRIsVALUE,
QUOTE(part));
}
else if (!rb_method_basic_definition_p(CLASS_OF(mod), id_const_missing)) {
- id = rb_intern3(pbeg, len, enc);
+ id = rb_intern_str(part);
}
else {
- 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)) {
+ wrong_id:
rb_name_error(id, "wrong constant name %"PRIsVALUE,
QUOTE_ID(id));
}
@@ -2036,6 +2193,7 @@ rb_mod_const_get(int argc, VALUE *argv, VALUE mod)
/*
* call-seq:
* mod.const_set(sym, obj) -> obj
+ * mod.const_set(str, obj) -> obj
*
* Sets the named constant to the given object, returning that object.
* Creates a new constant if no constant with the given name previously
@@ -2043,17 +2201,18 @@ 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 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
+ *
*/
static VALUE
rb_mod_const_set(VALUE mod, VALUE name, VALUE value)
{
- ID id = rb_to_id(name);
-
- if (!rb_is_const_id(id)) {
- rb_name_error(id, "wrong constant name %"PRIsVALUE,
- QUOTE_ID(id));
- }
+ ID id = id_for_setter(name, const, "wrong constant name %"PRIsVALUE);
rb_const_set(mod, id, value);
return value;
}
@@ -2061,6 +2220,7 @@ rb_mod_const_set(VALUE mod, VALUE name, VALUE value)
/*
* call-seq:
* mod.const_defined?(sym, inherit=true) -> true or false
+ * mod.const_defined?(str, inherit=true) -> true or false
*
* Checks for a constant with the given name in <i>mod</i>
* If +inherit+ is set, the lookup will also search
@@ -2071,12 +2231,20 @@ rb_mod_const_set(VALUE mod, VALUE name, VALUE value)
* Math.const_defined? "PI" #=> true
* IO.const_defined? :SYNC #=> true
* IO.const_defined? :SYNC, false #=> false
+ *
+ * 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
+ *
*/
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;
if (argc == 1) {
@@ -2086,31 +2254,100 @@ rb_mod_const_defined(int argc, VALUE *argv, VALUE mod)
else {
rb_scan_args(argc, argv, "11", &name, &recur);
}
- if (!(id = rb_check_id(&name))) {
- if (rb_is_const_name(name)) {
- return Qfalse;
+
+ if (SYMBOL_P(name)) {
+ id = SYM2ID(name);
+ if (!rb_is_const_id(id)) goto wrong_id;
+ 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_raise(rb_eNameError, "wrong constant name %"PRIsVALUE,
+ QUOTE(name));
+ }
+
+ if (p + 2 < pend && p[0] == ':' && p[1] == ':') {
+ mod = rb_cObject;
+ p += 2;
+ pbeg = p;
+ }
+
+ 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)) {
+ rb_name_error_str(part, "wrong constant name %"PRIsVALUE,
+ QUOTE(part));
+ }
+ else {
+ return Qfalse;
+ }
+ }
+ if (!rb_is_const_id(id)) {
+ wrong_id:
+ rb_name_error(id, "wrong constant name %"PRIsVALUE,
+ QUOTE_ID(id));
+ }
+ if (RTEST(recur)) {
+ if (!rb_const_defined(mod, id))
+ return Qfalse;
+ mod = rb_const_get(mod, id);
}
else {
- rb_name_error_str(name, "wrong constant name %"PRIsVALUE,
- QUOTE(name));
+ 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));
}
}
- 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);
+
+ return Qtrue;
}
/*
* call-seq:
* obj.instance_variable_get(symbol) -> obj
+ * obj.instance_variable_get(string) -> obj
*
* Returns the value of the given instance variable, or nil if the
* instance variable is not set. The <code>@</code> part of the
* variable name should be included for regular instance
* variables. Throws a <code>NameError</code> exception if the
* supplied symbol is not valid as an instance variable name.
+ * String arguments are converted to symbols.
*
* class Fred
* def initialize(p1, p2)
@@ -2146,11 +2383,14 @@ rb_obj_ivar_get(VALUE obj, VALUE iv)
/*
* call-seq:
* obj.instance_variable_set(symbol, obj) -> obj
+ * obj.instance_variable_set(string, obj) -> obj
*
* 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
* 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.
*
* class Fred
* def initialize(p1, p2)
@@ -2166,21 +2406,18 @@ rb_obj_ivar_get(VALUE obj, VALUE iv)
static VALUE
rb_obj_ivar_set(VALUE obj, VALUE iv, VALUE val)
{
- ID id = rb_to_id(iv);
-
- if (!rb_is_instance_id(id)) {
- rb_name_error(id, "`%"PRIsVALUE"' is not allowed as an instance variable name",
- QUOTE_ID(id));
- }
+ ID id = id_for_setter(iv, instance, "`%"PRIsVALUE"' is not allowed as an instance variable name");
return rb_ivar_set(obj, id, val);
}
/*
* call-seq:
* obj.instance_variable_defined?(symbol) -> true or false
+ * obj.instance_variable_defined?(string) -> true or false
*
* Returns <code>true</code> if the given instance variable is
* defined in <i>obj</i>.
+ * String arguments are converted to symbols.
*
* class Fred
* def initialize(p1, p2)
@@ -2217,10 +2454,12 @@ rb_obj_ivar_defined(VALUE obj, VALUE iv)
/*
* call-seq:
* mod.class_variable_get(symbol) -> obj
+ * mod.class_variable_get(string) -> obj
*
* 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
+ * String arguments are converted to symbols.
*
* class Fred
* @@foo = 99
@@ -2253,9 +2492,12 @@ rb_mod_cvar_get(VALUE obj, VALUE iv)
/*
* call-seq:
* obj.class_variable_set(symbol, obj) -> obj
+ * obj.class_variable_set(string, obj) -> obj
*
* 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.
*
* class Fred
* @@foo = 99
@@ -2270,12 +2512,7 @@ rb_mod_cvar_get(VALUE obj, VALUE iv)
static VALUE
rb_mod_cvar_set(VALUE obj, VALUE iv, VALUE val)
{
- ID id = rb_to_id(iv);
-
- if (!rb_is_class_id(id)) {
- rb_name_error(id, "`%"PRIsVALUE"' is not allowed as a class variable name",
- QUOTE_ID(id));
- }
+ ID id = id_for_setter(iv, class, "`%"PRIsVALUE"' is not allowed as a class variable name");
rb_cvar_set(obj, id, val);
return val;
}
@@ -2283,9 +2520,11 @@ rb_mod_cvar_set(VALUE obj, VALUE iv, VALUE val)
/*
* call-seq:
* obj.class_variable_defined?(symbol) -> true or false
+ * obj.class_variable_defined?(string) -> true or false
*
* Returns <code>true</code> if the given class variable is defined
* in <i>obj</i>.
+ * String arguments are converted to symbols.
*
* class Fred
* @@foo = 99
@@ -2315,20 +2554,43 @@ rb_mod_cvar_defined(VALUE obj, VALUE iv)
return rb_cvar_defined(obj, id);
}
-static struct conv_method_tbl {
- const char *method;
+/*
+ * 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)
+{
+ if (RB_TYPE_P(klass, T_CLASS) && FL_TEST(klass, FL_SINGLETON))
+ return Qtrue;
+ return Qfalse;
+}
+
+static const struct conv_method_tbl {
+ const char method[8];
ID id;
} conv_method_names[] = {
- {"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 M(n) {"to_"#n, idTo_##n}
+ M(int),
+ M(ary),
+ M(str),
+ M(sym),
+ M(hash),
+ M(proc),
+ M(io),
+ M(a),
+ M(s),
+ M(i),
+#undef M
};
#define IMPLICIT_CONVERSIONS 7
@@ -2339,7 +2601,7 @@ convert_type(VALUE val, const char *tname, const char *method, int raise)
int i;
VALUE r;
- for (i=0; conv_method_names[i].method; i++) {
+ for (i=0; i < numberof(conv_method_names); i++) {
if (conv_method_names[i].method[0] == method[0] &&
strcmp(conv_method_names[i].method, method) == 0) {
m = conv_method_names[i].id;
@@ -2350,13 +2612,16 @@ convert_type(VALUE val, const char *tname, const char *method, int raise)
r = rb_check_funcall(val, m, 0, 0);
if (r == Qundef) {
if (raise) {
- 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),
+ 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),
tname);
}
return Qnil;
@@ -2364,6 +2629,16 @@ 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)
{
@@ -2372,9 +2647,7 @@ 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) {
- 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));
+ conversion_mismatch(val, tname, method, v);
}
return v;
}
@@ -2389,9 +2662,7 @@ 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) {
- 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));
+ conversion_mismatch(val, tname, method, v);
}
return v;
}
@@ -2406,9 +2677,7 @@ 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)) {
- 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));
+ conversion_mismatch(val, "Integer", method, v);
}
return v;
}
@@ -2503,13 +2772,15 @@ rb_Integer(VALUE val)
* 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 using
- * <code>to_int</code>, and <code>to_i</code>.
+ * <code>to_int</code>, and <code>to_i</code>. Passing <code>nil</code>
+ * raises a TypeError.
*
* Integer(123.999) #=> 123
* Integer("0x1a") #=> 26
* Integer(Time.new) #=> 1204973019
* Integer("0930", 10) #=> 930
* Integer("111", 2) #=> 7
+ * Integer(nil) #=> TypeError
*/
static VALUE
@@ -2817,7 +3088,7 @@ rb_Hash(VALUE val)
* <i>arg</i> is <tt>nil</tt> or <tt>[]</tt>.
*
* Hash([]) #=> {}
- * Hash(nil) #=> nil
+ * Hash(nil) #=> {}
* Hash(key: :value) #=> {:key => :value}
* Hash([1, 2, 3]) #=> TypeError
*/
@@ -2986,8 +3257,6 @@ rb_f_hash(VALUE obj, VALUE arg)
void
Init_Object(void)
{
- int i;
-
Init_class_hierarchy();
#if 0
@@ -3046,6 +3315,7 @@ Init_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);
@@ -3130,6 +3400,7 @@ Init_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 */
@@ -3155,6 +3426,7 @@ Init_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, "singleton_class?", rb_mod_singleton_p, 0);
rb_define_method(rb_cClass, "allocate", rb_obj_alloc, 0);
rb_define_method(rb_cClass, "new", rb_class_new_instance, -1);
@@ -3199,17 +3471,4 @@ Init_Object(void)
* An alias of +false+
*/
rb_define_global_const("FALSE", Qfalse);
-
- id_eq = rb_intern("==");
- id_eql = rb_intern("eql?");
- id_match = rb_intern("=~");
- id_inspect = rb_intern("inspect");
- id_init_copy = rb_intern("initialize_copy");
- id_init_clone = rb_intern("initialize_clone");
- id_init_dup = rb_intern("initialize_dup");
- id_const_missing = rb_intern("const_missing");
-
- 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 fabbb7ddb0..fcf3a3a2a0 100644
--- a/pack.c
+++ b/pack.c
@@ -11,16 +11,34 @@
#include "ruby/ruby.h"
#include "ruby/encoding.h"
+#include "internal.h"
#include <sys/types.h>
#include <ctype.h>
#include <errno.h>
-#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))))
-#if SIZEOF_SHORT != 2 || SIZEOF_LONG != 4
+/*
+ * It is intentional that the condition for natstr is HAVE_TRUE_LONG_LONG
+ * instead of HAVE_LONG_LONG or LONG_LONG.
+ * This means q! and Q! means always the standard long long type and
+ * causes ArgumentError for platforms which has no long long type,
+ * even if the platform has an implementation specific 64bit type.
+ * This behavior is consistent with the document of pack/unpack.
+ */
+#ifdef HAVE_TRUE_LONG_LONG
+static const char natstr[] = "sSiIlLqQ";
+#else
+static const char natstr[] = "sSiIlL";
+#endif
+static const char endstr[] = "sSiIlLqQ";
+
+#ifdef HAVE_TRUE_LONG_LONG
+/* It is intentional to use long long instead of LONG_LONG. */
+# define NATINT_LEN_Q NATINT_LEN(long long, 8)
+#else
+# define NATINT_LEN_Q 8
+#endif
+
+#if SIZEOF_SHORT != 2 || SIZEOF_LONG != 4 || (defined(HAVE_TRUE_LONG_LONG) && SIZEOF_LONG_LONG != 8)
# define NATINT_PACK
#endif
@@ -52,14 +70,6 @@
# define NATINT_LEN(type,len) ((int)sizeof(type))
#endif
-#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) \
@@ -82,68 +92,6 @@ TOKEN_PASTE(swap,x)(xtype z) \
return r; \
}
-#if GCC_VERSION_SINCE(4,3,0)
-# define swap32(x) __builtin_bswap32(x)
-# define swap64(x) __builtin_bswap64(x)
-#endif
-
-#ifndef swap16
-# define swap16(x) ((uint16_t)((((x)&0xFF)<<8) | (((x)>>8)&0xFF)))
-#endif
-
-#ifndef swap32
-# define swap32(x) ((uint32_t)((((x)&0xFF)<<24) \
- |(((x)>>24)&0xFF) \
- |(((x)&0x0000FF00)<<8) \
- |(((x)&0x00FF0000)>>8) ))
-#endif
-
-#ifndef swap64
-# ifdef HAVE_INT64_T
-# define byte_in_64bit(n) ((uint64_t)0xff << (n))
-# define swap64(x) ((uint64_t)((((x)&byte_in_64bit(0))<<56) \
- |(((x)>>56)&0xFF) \
- |(((x)&byte_in_64bit(8))<<40) \
- |(((x)&byte_in_64bit(48))>>40) \
- |(((x)&byte_in_64bit(16))<<24) \
- |(((x)&byte_in_64bit(40))>>24) \
- |(((x)&byte_in_64bit(24))<<8) \
- |(((x)&byte_in_64bit(32))>>8)))
-# endif
-#endif
-
-#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
@@ -237,22 +185,7 @@ TOKEN_PASTE(swap,x)(xtype z) \
# define VTOHD(x,y) rb_vtohd(x)
#endif
-static unsigned long
-num2i32(VALUE x)
-{
- x = rb_to_int(x); /* is nil OK? (should not) */
-
- if (FIXNUM_P(x)) return FIX2LONG(x);
- if (RB_TYPE_P(x, T_BIGNUM)) {
- return rb_big2ulong_pack(x);
- }
- rb_raise(rb_eTypeError, "can't convert %s to `integer'", rb_obj_classname(x));
-
- UNREACHABLE;
-}
-
#define MAX_INTEGER_PACK_SIZE 8
-/* #define FORCE_BIG_PACK */
static const char toofew[] = "too few arguments";
@@ -261,6 +194,45 @@ 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
@@ -303,24 +275,30 @@ static unsigned long utf8_to_uv(const char*,long*);
* S_, S! | Integer | unsigned short, native endian
* I, I_, I! | Integer | unsigned int, native endian
* L_, L! | Integer | unsigned long, native endian
+ * 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.)
* | |
* s_, s! | Integer | signed short, native endian
* i, i_, i! | Integer | signed int, native endian
* l_, l! | Integer | signed long, native endian
+ * 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.)
* | |
* S> L> Q> | Integer | same as the directives without ">" except
* s> l> q> | | big endian
* S!> I!> | | (available since Ruby 1.9.3)
- * L!> | | "S>" is same as "n"
+ * L!> Q!> | | "S>" is same as "n"
* s!> i!> | | "L>" is same as "N"
- * l!> | |
+ * l!> q!> | |
* | |
* S< L< Q< | Integer | same as the directives without "<" except
* s< l< q< | | little endian
* S!< I!< | | (available since Ruby 1.9.3)
- * L!< | | "S<" is same as "v"
+ * L!< Q!< | | "S<" is same as "v"
* s!< i!< | | "L<" is same as "V"
- * l!< | |
+ * l!< q!< | |
* | |
* n | Integer | 16-bit unsigned, network (big-endian) byte order
* N | Integer | 32-bit unsigned, network (big-endian) byte order
@@ -390,8 +368,8 @@ pack_pack(VALUE ary, VALUE fmt)
idx = 0;
#define TOO_FEW (rb_raise(rb_eArgError, toofew), 0)
-#define THISFROM (items > 0 ? RARRAY_PTR(ary)[idx] : TOO_FEW)
-#define NEXTFROM (items-- > 0 ? RARRAY_PTR(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;
@@ -412,9 +390,6 @@ pack_pack(VALUE ary, VALUE fmt)
}
{
- static const char natstr[] = "sSiIlL";
- static const char endstr[] = "sSiIlLqQ";
-
modifiers:
switch (*p) {
case '_':
@@ -641,71 +616,66 @@ pack_pack(VALUE ary, VALUE fmt)
case 'c': /* signed char */
case 'C': /* unsigned char */
- while (len-- > 0) {
- char c;
-
- from = NEXTFROM;
- c = (char)num2i32(from);
- rb_str_buf_cat(res, &c, sizeof(char));
- }
- break;
+ integer_size = 1;
+ bigendian_p = BIGENDIAN_P(); /* not effective */
+ goto pack_integer;
- case 's': /* signed short */
+ case 's': /* s for int16_t, s! for signed short */
integer_size = NATINT_LEN(short, 2);
bigendian_p = BIGENDIAN_P();
goto pack_integer;
- case 'S': /* unsigned short */
+ case 'S': /* S for uint16_t, S! for unsigned short */
integer_size = NATINT_LEN(short, 2);
bigendian_p = BIGENDIAN_P();
goto pack_integer;
- case 'i': /* signed int */
+ case 'i': /* i and i! for signed int */
integer_size = (int)sizeof(int);
bigendian_p = BIGENDIAN_P();
goto pack_integer;
- case 'I': /* unsigned int */
+ case 'I': /* I and I! for unsigned int */
integer_size = (int)sizeof(int);
bigendian_p = BIGENDIAN_P();
goto pack_integer;
- case 'l': /* signed long */
+ case 'l': /* l for int32_t, l! for signed long */
integer_size = NATINT_LEN(long, 4);
bigendian_p = BIGENDIAN_P();
goto pack_integer;
- case 'L': /* unsigned long */
+ case 'L': /* L for uint32_t, L! for unsigned long */
integer_size = NATINT_LEN(long, 4);
bigendian_p = BIGENDIAN_P();
goto pack_integer;
- case 'q': /* signed quad (64bit) int */
- integer_size = 8;
+ case 'q': /* q for int64_t, q! for signed long long */
+ integer_size = NATINT_LEN_Q;
bigendian_p = BIGENDIAN_P();
goto pack_integer;
- case 'Q': /* unsigned quad (64bit) int */
- integer_size = 8;
+ case 'Q': /* Q for uint64_t, Q! for unsigned long long */
+ integer_size = NATINT_LEN_Q;
bigendian_p = BIGENDIAN_P();
goto pack_integer;
- case 'n': /* unsigned short (network byte-order) */
+ case 'n': /* 16 bit (2 bytes) integer (network byte-order) */
integer_size = 2;
bigendian_p = 1;
goto pack_integer;
- case 'N': /* unsigned long (network byte-order) */
+ case 'N': /* 32 bit (4 bytes) integer (network byte-order) */
integer_size = 4;
bigendian_p = 1;
goto pack_integer;
- case 'v': /* unsigned short (VAX byte-order) */
+ case 'v': /* 16 bit (2 bytes) integer (VAX byte-order) */
integer_size = 2;
bigendian_p = 0;
goto pack_integer;
- case 'V': /* unsigned long (VAX byte-order) */
+ case 'V': /* 32 bit (4 bytes) integer (VAX byte-order) */
integer_size = 4;
bigendian_p = 0;
goto pack_integer;
@@ -714,88 +684,17 @@ pack_pack(VALUE ary, VALUE fmt)
if (explicit_endian) {
bigendian_p = explicit_endian == '>';
}
-
- switch (integer_size) {
-#if defined(HAVE_INT16_T) && !defined(FORCE_BIG_PACK)
- case SIZEOF_INT16_T:
- while (len-- > 0) {
- union {
- int16_t i;
- char a[sizeof(int16_t)];
- } v;
-
- from = NEXTFROM;
- v.i = (int16_t)num2i32(from);
- if (bigendian_p != BIGENDIAN_P()) v.i = swap16(v.i);
- rb_str_buf_cat(res, v.a, sizeof(int16_t));
- }
- break;
-#endif
-
-#if defined(HAVE_INT32_T) && !defined(FORCE_BIG_PACK)
- case SIZEOF_INT32_T:
- while (len-- > 0) {
- union {
- int32_t i;
- char a[sizeof(int32_t)];
- } v;
-
- from = NEXTFROM;
- v.i = (int32_t)num2i32(from);
- if (bigendian_p != BIGENDIAN_P()) v.i = swap32(v.i);
- rb_str_buf_cat(res, v.a, sizeof(int32_t));
- }
- break;
-#endif
-
-#if defined(HAVE_INT64_T) && SIZEOF_LONG == SIZEOF_INT64_T && !defined(FORCE_BIG_PACK)
- case SIZEOF_INT64_T:
- while (len-- > 0) {
- union {
- int64_t i;
- char a[sizeof(int64_t)];
- } v;
-
- from = NEXTFROM;
- v.i = num2i32(from); /* can return 64bit value if SIZEOF_LONG == SIZEOF_INT64_T */
- if (bigendian_p != BIGENDIAN_P()) v.i = swap64(v.i);
- rb_str_buf_cat(res, v.a, sizeof(int64_t));
- }
- break;
-#endif
-
- default:
- if (integer_size > MAX_INTEGER_PACK_SIZE)
- rb_bug("unexpected intger size for pack: %d", integer_size);
- while (len-- > 0) {
- union {
- unsigned long i[(MAX_INTEGER_PACK_SIZE+SIZEOF_LONG-1)/SIZEOF_LONG];
- char a[(MAX_INTEGER_PACK_SIZE+SIZEOF_LONG-1)/SIZEOF_LONG*SIZEOF_LONG];
- } v;
- int num_longs = (integer_size+SIZEOF_LONG-1)/SIZEOF_LONG;
- int i;
-
- from = NEXTFROM;
- rb_big_pack(from, v.i, num_longs);
- if (bigendian_p) {
- for (i = 0; i < num_longs/2; i++) {
- unsigned long t = v.i[i];
- v.i[i] = v.i[num_longs-1-i];
- v.i[num_longs-1-i] = t;
- }
- }
- if (bigendian_p != BIGENDIAN_P()) {
- for (i = 0; i < num_longs; i++)
- v.i[i] = swapl(v.i[i]);
- }
- rb_str_buf_cat(res,
- bigendian_p ?
- v.a + sizeof(long)*num_longs - integer_size :
- v.a,
- integer_size);
- }
- break;
- }
+ if (integer_size > MAX_INTEGER_PACK_SIZE)
+ rb_bug("unexpected intger size for pack: %d", integer_size);
+ while (len-- > 0) {
+ char intbuf[MAX_INTEGER_PACK_SIZE];
+
+ from = NEXTFROM;
+ rb_integer_pack(from, intbuf, integer_size, 1, 0,
+ INTEGER_PACK_2COMP |
+ (bigendian_p ? INTEGER_PACK_BIG_ENDIAN : INTEGER_PACK_LITTLE_ENDIAN));
+ rb_str_buf_cat(res, intbuf, integer_size);
+ }
break;
case 'f': /* single precision float in native format */
@@ -971,62 +870,45 @@ 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;
case 'w': /* BER compressed integer */
while (len-- > 0) {
- unsigned long ul;
VALUE buf = rb_str_new(0, 0);
- char c, *bufs, *bufe;
+ size_t numbytes;
+ int sign;
+ char *cp;
from = NEXTFROM;
- if (RB_TYPE_P(from, T_BIGNUM)) {
- VALUE big128 = rb_uint2big(128);
- while (RB_TYPE_P(from, T_BIGNUM)) {
- from = rb_big_divmod(from, big128);
- c = castchar(NUM2INT(RARRAY_PTR(from)[1]) | 0x80); /* mod */
- rb_str_buf_cat(buf, &c, sizeof(char));
- from = RARRAY_PTR(from)[0]; /* div */
- }
- }
-
- {
- long l = NUM2LONG(from);
- if (l < 0) {
- rb_raise(rb_eArgError, "can't compress negative numbers");
- }
- ul = l;
- }
-
- while (ul) {
- c = castchar((ul & 0x7f) | 0x80);
- rb_str_buf_cat(buf, &c, sizeof(char));
- ul >>= 7;
- }
+ from = rb_to_int(from);
+ numbytes = rb_absint_numwords(from, 7, NULL);
+ if (numbytes == 0)
+ numbytes = 1;
+ buf = rb_str_new(NULL, numbytes);
+
+ sign = rb_integer_pack(from, RSTRING_PTR(buf), RSTRING_LEN(buf), 1, 1, INTEGER_PACK_BIG_ENDIAN);
+
+ if (sign < 0)
+ rb_raise(rb_eArgError, "can't compress negative numbers");
+ if (sign == 2)
+ rb_bug("buffer size problem?");
+
+ cp = RSTRING_PTR(buf);
+ while (1 < numbytes) {
+ *cp |= 0x80;
+ cp++;
+ numbytes--;
+ }
- if (RSTRING_LEN(buf)) {
- bufs = RSTRING_PTR(buf);
- bufe = bufs + RSTRING_LEN(buf) - 1;
- *bufs &= 0x7f; /* clear continue bit */
- while (bufs < bufe) { /* reverse */
- c = *bufs;
- *bufs++ = *bufe;
- *bufe-- = c;
- }
- rb_str_buf_cat(res, RSTRING_PTR(buf), RSTRING_LEN(buf));
- }
- else {
- c = 0;
- rb_str_buf_cat(res, &c, sizeof(char));
- }
+ rb_str_buf_cat(res, RSTRING_PTR(buf), RSTRING_LEN(buf));
}
break;
@@ -1038,7 +920,7 @@ pack_pack(VALUE ary, VALUE fmt)
}
if (associates) {
- rb_str_associate(res, associates);
+ str_associate(res, associates);
}
OBJ_INFECT(res, fmt);
switch (enc_info) {
@@ -1063,9 +945,10 @@ static const char b64_table[] =
static void
encodes(VALUE str, const char *s, long len, int type, int tail_lf)
{
- char buff[4096];
+ enum {buff_size = 4096, encoded_unit = 4, input_unit = 3};
+ char buff[buff_size + 1]; /* +1 for tail_lf */
long i = 0;
- const char *trans = type == 'u' ? uu_table : b64_table;
+ const char *const trans = type == 'u' ? uu_table : b64_table;
char padding;
if (type == 'u') {
@@ -1075,16 +958,16 @@ encodes(VALUE str, const char *s, long len, int type, int tail_lf)
else {
padding = '=';
}
- while (len >= 3) {
- while (len >= 3 && sizeof(buff)-i >= 4) {
+ while (len >= input_unit) {
+ while (len >= input_unit && buff_size-i >= encoded_unit) {
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 += 3;
- len -= 3;
+ s += input_unit;
+ len -= input_unit;
}
- if (sizeof(buff)-i < 4) {
+ if (buff_size-i < encoded_unit) {
rb_str_buf_cat(str, buff, i);
i = 0;
}
@@ -1104,6 +987,7 @@ encodes(VALUE str, const char *s, 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";
@@ -1164,19 +1048,11 @@ qpencode(VALUE str, VALUE from, long len)
static inline int
hex2num(char c)
{
- switch (c) {
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- return c - '0';
- case 'a': case 'b': case 'c':
- case 'd': case 'e': case 'f':
- return c - 'a' + 10;
- case 'A': case 'B': case 'C':
- case 'D': case 'E': case 'F':
- return c - 'A' + 10;
- default:
- return -1;
- }
+ int n;
+ n = ruby_digit36_to_number_table[(unsigned char)c];
+ if (16 <= n)
+ n = -1;
+ return n;
}
#define PACK_LENGTH_ADJUST_SIZE(sz) do { \
@@ -1249,10 +1125,16 @@ infected_str_new(const char *ptr, long len, VALUE str)
* S_, S! | Integer | unsigned short, native endian
* I, I_, I! | Integer | unsigned int, native endian
* L_, L! | Integer | unsigned long, native endian
+ * 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.)
* | |
* s_, s! | Integer | signed short, native endian
* i, i_, i! | Integer | signed int, native endian
* l_, l! | Integer | signed long, native endian
+ * 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.)
* | |
* S> L> Q> | Integer | same as the directives without ">" except
* s> l> q> | | big endian
@@ -1361,9 +1243,6 @@ pack_unpack(VALUE str, VALUE fmt)
star = 0;
{
- static const char natstr[] = "sSiIlL";
- static const char endstr[] = "sSiIlLqQ";
-
modifiers:
switch (*p) {
case '_':
@@ -1534,23 +1413,16 @@ pack_unpack(VALUE str, VALUE fmt)
break;
case 'c':
- PACK_LENGTH_ADJUST_SIZE(sizeof(char));
- while (len-- > 0) {
- int c = *s++;
- if (c > (char)127) c-=256;
- UNPACK_PUSH(INT2FIX(c));
- }
- PACK_ITEM_ADJUST();
- break;
+ signed_p = 1;
+ integer_size = 1;
+ bigendian_p = BIGENDIAN_P(); /* not effective */
+ goto unpack_integer;
case 'C':
- PACK_LENGTH_ADJUST_SIZE(sizeof(unsigned char));
- while (len-- > 0) {
- unsigned char c = *s++;
- UNPACK_PUSH(INT2FIX(c));
- }
- PACK_ITEM_ADJUST();
- break;
+ signed_p = 0;
+ integer_size = 1;
+ bigendian_p = BIGENDIAN_P(); /* not effective */
+ goto unpack_integer;
case 's':
signed_p = 1;
@@ -1590,13 +1462,13 @@ pack_unpack(VALUE str, VALUE fmt)
case 'q':
signed_p = 1;
- integer_size = 8;
+ integer_size = NATINT_LEN_Q;
bigendian_p = BIGENDIAN_P();
goto unpack_integer;
case 'Q':
signed_p = 0;
- integer_size = 8;
+ integer_size = NATINT_LEN_Q;
bigendian_p = BIGENDIAN_P();
goto unpack_integer;
@@ -1628,144 +1500,17 @@ pack_unpack(VALUE str, VALUE fmt)
if (explicit_endian) {
bigendian_p = explicit_endian == '>';
}
-
- switch (integer_size) {
-#if defined(HAVE_INT16_T) && !defined(FORCE_BIG_PACK)
- case SIZEOF_INT16_T:
- if (signed_p) {
- PACK_LENGTH_ADJUST_SIZE(sizeof(int16_t));
- while (len-- > 0) {
- union {
- int16_t i;
- char a[sizeof(int16_t)];
- } v;
- memcpy(v.a, s, sizeof(int16_t));
- if (bigendian_p != BIGENDIAN_P()) v.i = swap16(v.i);
- s += sizeof(int16_t);
- UNPACK_PUSH(INT2FIX(v.i));
- }
- PACK_ITEM_ADJUST();
- }
- else {
- PACK_LENGTH_ADJUST_SIZE(sizeof(uint16_t));
- while (len-- > 0) {
- union {
- uint16_t i;
- char a[sizeof(uint16_t)];
- } v;
- memcpy(v.a, s, sizeof(uint16_t));
- if (bigendian_p != BIGENDIAN_P()) v.i = swap16(v.i);
- s += sizeof(uint16_t);
- UNPACK_PUSH(INT2FIX(v.i));
- }
- PACK_ITEM_ADJUST();
- }
- break;
-#endif
-
-#if defined(HAVE_INT32_T) && !defined(FORCE_BIG_PACK)
- case SIZEOF_INT32_T:
- if (signed_p) {
- PACK_LENGTH_ADJUST_SIZE(sizeof(int32_t));
- while (len-- > 0) {
- union {
- int32_t i;
- char a[sizeof(int32_t)];
- } v;
- memcpy(v.a, s, sizeof(int32_t));
- if (bigendian_p != BIGENDIAN_P()) v.i = swap32(v.i);
- s += sizeof(int32_t);
- UNPACK_PUSH(INT2NUM(v.i));
- }
- PACK_ITEM_ADJUST();
- }
- else {
- PACK_LENGTH_ADJUST_SIZE(sizeof(uint32_t));
- while (len-- > 0) {
- union {
- uint32_t i;
- char a[sizeof(uint32_t)];
- } v;
- memcpy(v.a, s, sizeof(uint32_t));
- if (bigendian_p != BIGENDIAN_P()) v.i = swap32(v.i);
- s += sizeof(uint32_t);
- UNPACK_PUSH(UINT2NUM(v.i));
- }
- PACK_ITEM_ADJUST();
- }
- break;
-#endif
-
-#if defined(HAVE_INT64_T) && !defined(FORCE_BIG_PACK)
- case SIZEOF_INT64_T:
- if (signed_p) {
- PACK_LENGTH_ADJUST_SIZE(sizeof(int64_t));
- while (len-- > 0) {
- union {
- int64_t i;
- char a[sizeof(int64_t)];
- } v;
- memcpy(v.a, s, sizeof(int64_t));
- if (bigendian_p != BIGENDIAN_P()) v.i = swap64(v.i);
- s += sizeof(int64_t);
- UNPACK_PUSH(INT64toNUM(v.i));
- }
- PACK_ITEM_ADJUST();
- }
- else {
- PACK_LENGTH_ADJUST_SIZE(sizeof(uint64_t));
- while (len-- > 0) {
- union {
- uint64_t i;
- char a[sizeof(uint64_t)];
- } v;
- memcpy(v.a, s, sizeof(uint64_t));
- if (bigendian_p != BIGENDIAN_P()) v.i = swap64(v.i);
- s += sizeof(uint64_t);
- UNPACK_PUSH(UINT64toNUM(v.i));
- }
- PACK_ITEM_ADJUST();
- }
- break;
-#endif
-
- default:
- if (integer_size > MAX_INTEGER_PACK_SIZE)
- rb_bug("unexpected integer size for pack: %d", integer_size);
- PACK_LENGTH_ADJUST_SIZE(integer_size);
- while (len-- > 0) {
- union {
- unsigned long i[(MAX_INTEGER_PACK_SIZE+SIZEOF_LONG)/SIZEOF_LONG];
- char a[(MAX_INTEGER_PACK_SIZE+SIZEOF_LONG)/SIZEOF_LONG*SIZEOF_LONG];
- } v;
- int num_longs = (integer_size+SIZEOF_LONG)/SIZEOF_LONG;
- int i;
-
- if (signed_p && (signed char)s[bigendian_p ? 0 : (integer_size-1)] < 0)
- memset(v.a, 0xff, sizeof(long)*num_longs);
- else
- memset(v.a, 0, sizeof(long)*num_longs);
- if (bigendian_p)
- memcpy(v.a + sizeof(long)*num_longs - integer_size, s, integer_size);
- else
- memcpy(v.a, s, integer_size);
- if (bigendian_p) {
- for (i = 0; i < num_longs/2; i++) {
- unsigned long t = v.i[i];
- v.i[i] = v.i[num_longs-1-i];
- v.i[num_longs-1-i] = t;
- }
- }
- if (bigendian_p != BIGENDIAN_P()) {
- for (i = 0; i < num_longs; i++)
- v.i[i] = swapl(v.i[i]);
- }
- s += integer_size;
- UNPACK_PUSH(rb_big_unpack(v.i, num_longs));
- }
- PACK_ITEM_ADJUST();
- break;
- }
+ PACK_LENGTH_ADJUST_SIZE(integer_size);
+ while (len-- > 0) {
+ int flags = bigendian_p ? INTEGER_PACK_BIG_ENDIAN : INTEGER_PACK_LITTLE_ENDIAN;
+ VALUE val;
+ if (signed_p)
+ flags |= INTEGER_PACK_2COMP;
+ val = rb_integer_unpack(s, integer_size, 1, 0, flags);
+ UNPACK_PUSH(val);
+ s += integer_size;
+ }
+ PACK_ITEM_ADJUST();
break;
case 'f':
@@ -1917,7 +1662,7 @@ pack_unpack(VALUE str, VALUE fmt)
case 'm':
{
- VALUE buf = infected_str_new(0, (send - s)*3/4, str);
+ VALUE buf = infected_str_new(0, (send - s + 3)*3/4, str); /* +3 is for skipping paddings */
char *ptr = RSTRING_PTR(buf);
int a = -1,b = -1,c = 0,d = 0;
static signed char b64_xtable[256];
@@ -1980,11 +1725,12 @@ pack_unpack(VALUE str, VALUE fmt)
*ptr++ = castchar(a << 2 | b >> 4);
*ptr++ = castchar(b << 4 | c >> 2);
*ptr++ = castchar(c << 6 | d);
+ a = -1;
}
if (a != -1 && b != -1) {
- if (c == -1 && *s == '=')
+ if (c == -1)
*ptr++ = castchar(a << 2 | b >> 4);
- else if (c != -1 && *s == '=') {
+ else {
*ptr++ = castchar(a << 2 | b >> 4);
*ptr++ = castchar(b << 4 | c >> 2);
}
@@ -2053,18 +1799,19 @@ pack_unpack(VALUE str, VALUE fmt)
s += sizeof(char *);
if (t) {
- VALUE a, *p, *pend;
+ VALUE a;
+ const VALUE *p, *pend;
- if (!(a = rb_str_associated(str))) {
+ if (!(a = str_associated(str))) {
rb_raise(rb_eArgError, "no associated pointer");
}
- p = RARRAY_PTR(a);
+ p = RARRAY_CONST_PTR(a);
pend = p + RARRAY_LEN(a);
while (p < pend) {
if (RB_TYPE_P(*p, T_STRING) && RSTRING_PTR(*p) == t) {
if (len < RSTRING_LEN(*p)) {
tmp = rb_tainted_str_new(t, len);
- rb_str_associate(tmp, a);
+ str_associate(tmp, a);
}
else {
tmp = *p;
@@ -2095,12 +1842,13 @@ pack_unpack(VALUE str, VALUE fmt)
s += sizeof(char *);
if (t) {
- VALUE a, *p, *pend;
+ VALUE a;
+ const VALUE *p, *pend;
- if (!(a = rb_str_associated(str))) {
+ if (!(a = str_associated(str))) {
rb_raise(rb_eArgError, "no associated pointer");
}
- p = RARRAY_PTR(a);
+ p = RARRAY_CONST_PTR(a);
pend = p + RARRAY_LEN(a);
while (p < pend) {
if (RB_TYPE_P(*p, T_STRING) && RSTRING_PTR(*p) == t) {
@@ -2120,32 +1868,18 @@ pack_unpack(VALUE str, VALUE fmt)
case 'w':
{
- unsigned long ul = 0;
- unsigned long ulmask = 0xfeUL << ((sizeof(unsigned long) - 1) * 8);
-
- while (len > 0 && s < send) {
- ul <<= 7;
- ul |= (*s & 0x7f);
- if (!(*s++ & 0x80)) {
- UNPACK_PUSH(ULONG2NUM(ul));
- len--;
- ul = 0;
- }
- else if (ul & ulmask) {
- VALUE big = rb_uint2big(ul);
- VALUE big128 = rb_uint2big(128);
- while (s < send) {
- big = rb_big_mul(big, big128);
- big = rb_big_plus(big, rb_uint2big(*s & 0x7f));
- if (!(*s++ & 0x80)) {
- UNPACK_PUSH(big);
- len--;
- ul = 0;
- break;
- }
- }
- }
- }
+ char *s0 = s;
+ while (len > 0 && s < send) {
+ if (*s & 0x80) {
+ s++;
+ }
+ else {
+ s++;
+ UNPACK_PUSH(rb_integer_unpack(s0, s-s0, 1, 1, INTEGER_PACK_BIG_ENDIAN));
+ len--;
+ s0 = s;
+ }
+ }
}
break;
@@ -2159,8 +1893,6 @@ pack_unpack(VALUE str, VALUE fmt)
return ary;
}
-#define BYTEWIDTH 8
-
int
rb_uv_to_utf8(char buf[6], unsigned long uv)
{
@@ -2273,4 +2005,6 @@ 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 9f8b284924..68d6397c69 100644
--- a/parse.y
+++ b/parse.y
@@ -24,46 +24,26 @@
#include "internal.h"
#include "node.h"
#include "parse.h"
-#include "id.h"
+#include "symbol.h"
#include "regenc.h"
#include <stdio.h>
#include <errno.h>
#include <ctype.h>
#include "probes.h"
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
-
#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))
+#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. */
@@ -76,6 +56,7 @@ enum lex_state_bits {
EXPR_DOT_bit, /* right after `.' or `::', no reserved words. */
EXPR_CLASS_bit, /* immediate after `class', no here document. */
EXPR_VALUE_bit, /* alike EXPR_BEG but label is disallowed. */
+ EXPR_LABELARG_bit, /* ignore significant, +/- is a sign. */
EXPR_MAX_STATE
};
/* examine combinations */
@@ -92,7 +73,8 @@ enum lex_state_e {
DEF_EXPR(DOT),
DEF_EXPR(CLASS),
DEF_EXPR(VALUE),
- EXPR_BEG_ANY = (EXPR_BEG | EXPR_VALUE | EXPR_MID | EXPR_CLASS),
+ DEF_EXPR(LABELARG),
+ EXPR_BEG_ANY = (EXPR_BEG | EXPR_VALUE | EXPR_MID | EXPR_CLASS | EXPR_LABELARG),
EXPR_ARG_ANY = (EXPR_ARG | EXPR_CMDARG),
EXPR_END_ANY = (EXPR_END | EXPR_ENDARG | EXPR_ENDFN)
};
@@ -132,6 +114,7 @@ struct local_vars {
struct vtable *vars;
struct vtable *used;
struct local_vars *prev;
+ stack_type cmdargs;
};
#define DVARS_INHERIT ((void*)1)
@@ -182,7 +165,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, %s\n", (void *)tbl, rb_id2name(id));
+ if (VTBL_DEBUG) printf("vtable_add: %p, %"PRIsVALUE"\n", (void *)tbl, rb_id2str(id));
if (tbl->pos == tbl->capa) {
tbl->capa = tbl->capa * 2;
@@ -227,16 +210,15 @@ typedef struct token_info {
token
*/
struct parser_params {
- int is_ripper;
NODE *heap;
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;
+ enum lex_state_e parser_lex_state;
int parser_class_nest;
int parser_paren_nest;
int parser_lpar_beg;
@@ -245,11 +227,13 @@ struct parser_params {
int parser_brace_nest;
int parser_compile_for_eval;
VALUE parser_cur_mid;
+ int parser_in_kwarg;
int parser_in_defined;
char *parser_tokenbuf;
int parser_tokidx;
int parser_toksiz;
int parser_tokline;
+ int is_ripper; /* bool, seems unused */
VALUE parser_lex_input;
VALUE parser_lex_lastline;
VALUE parser_lex_nextline;
@@ -265,12 +249,15 @@ struct parser_params {
int parser_ruby__end__seen;
int line_count;
int has_shebang;
- char *parser_ruby_sourcefile; /* current source file */
int parser_ruby_sourceline; /* current line no. */
+ char *parser_ruby_sourcefile; /* current source file */
+ VALUE parser_ruby_sourcefile_string;
rb_encoding *enc;
int parser_yydebug;
+ int last_cr_line;
+
#ifndef RIPPER
/* Ruby core only */
NODE *parser_eval_tree_begin;
@@ -283,7 +270,6 @@ struct parser_params {
token_info *parser_token_info;
#else
/* Ripper only */
- VALUE parser_ruby_sourcefile_string;
const char *tokp;
VALUE delayed;
int delayed_line;
@@ -296,12 +282,17 @@ struct parser_params {
#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 ENC_SINGLE(cr) ((cr)==ENC_CODERANGE_7BIT)
-#define TOK_INTERN(mb) rb_intern3(tok(), toklen(), current_enc)
+#define TOK_INTERN() intern_cstr(tok(), toklen(), current_enc)
static int parser_yyerror(struct parser_params*, const char*);
#define yyerror(msg) parser_yyerror(parser, (msg))
@@ -338,6 +329,7 @@ static int parser_yyerror(struct parser_params*, const char*);
#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 yydebug (parser->parser_yydebug)
#ifdef RIPPER
@@ -371,6 +363,7 @@ static void fixpos(NODE*,NODE*);
static int value_expr_gen(struct parser_params*,NODE*);
static void void_expr_gen(struct parser_params*,NODE*);
static NODE *remove_begin(NODE*);
+static NODE *remove_begin_all(NODE*);
#define value_expr(node) value_expr_gen(parser, (node) = remove_begin(node))
#define void_expr0(node) void_expr_gen(parser, (node))
#define void_expr(node) void_expr0((node) = remove_begin(node))
@@ -410,7 +403,7 @@ static NODE *new_args_gen(struct parser_params*,NODE*,NODE*,ID,NODE*,NODE*);
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))
-static NODE *negate_lit(NODE*);
+static VALUE negate_lit(VALUE);
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*);
@@ -440,6 +433,8 @@ static NODE *new_attr_op_assign_gen(struct parser_params *parser, NODE *lhs, ID
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))
+#define new_defined(expr) NEW_DEFINED(remove_begin_all(expr))
+
static NODE *match_op_gen(struct parser_params*,NODE*,NODE*);
#define match_op(node1,node2) match_op_gen(parser, (node1), (node2))
@@ -494,9 +489,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 int local_var_gen(struct parser_params*, ID);
+static void local_var_gen(struct parser_params*, ID);
#define local_var(id) local_var_gen(parser, (id))
-static int arg_var_gen(struct parser_params*, ID);
+static void 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))
@@ -618,6 +613,8 @@ new_args_tail_gen(struct parser_params *parser, VALUE k, VALUE kr, VALUE b)
}
#define new_args_tail(k,kr,b) new_args_tail_gen(parser, (k),(kr),(b))
+#define new_defined(expr) dispatch1(defined, (expr))
+
#define FIXME 0
#endif /* RIPPER */
@@ -635,20 +632,29 @@ new_args_tail_gen(struct parser_params *parser, VALUE k, VALUE kr, VALUE b)
# 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_warn4V(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))
+# define rb_warningV(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_warnV(fmt,a) ripper_warnV(parser, (fmt), (a))
# define rb_warn4S(file,line,fmt,a) ripper_warnS(parser, (fmt), (a))
+# define rb_warn4V(file,line,fmt,a) ripper_warnV(parser, (fmt), (a))
# define rb_warning0(fmt) ripper_warning0(parser, (fmt))
# define rb_warningS(fmt,a) ripper_warningS(parser, (fmt), (a))
+# define rb_warningV(fmt,a) ripper_warningV(parser, (fmt), (a))
static void ripper_warn0(struct parser_params*, const char*);
static void ripper_warnI(struct parser_params*, const char*, int);
+#if 0 /* not in use right now */
static void ripper_warnS(struct parser_params*, const char*, const char*);
+#endif
+static void ripper_warnV(struct parser_params*, const char*, VALUE);
static void ripper_warning0(struct parser_params*, const char*);
static void ripper_warningS(struct parser_params*, const char*, const char*);
+static void ripper_warningV(struct parser_params*, const char*, VALUE);
#endif
#ifdef RIPPER
@@ -659,7 +665,7 @@ static void ripper_compile_error(struct parser_params*, const char *fmt, ...);
#else
# 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,
+# define PARSER_ARG ruby_sourcefile, ruby_sourceline, (void *)current_enc,
#endif
/* Older versions of Yacc set YYMAXDEPTH to a very low value by default (150,
@@ -750,14 +756,14 @@ static void token_info_pop(struct parser_params*, const char *token);
keyword__ENCODING__
%token <id> tIDENTIFIER tFID tGVAR tIVAR tCONSTANT tCVAR tLABEL
-%token <node> tINTEGER tFLOAT tSTRING_CONTENT tCHAR
+%token <node> tINTEGER tFLOAT tRATIONAL tIMAGINARY tSTRING_CONTENT tCHAR
%token <node> tNTH_REF tBACK_REF
%token <num> tREGEXP_END
%type <node> singleton strings string string1 xstring regexp
%type <node> string_contents xstring_contents regexp_contents string_content
%type <node> words symbols symbol_list qwords qsymbols word_list qword_list qsym_list word
-%type <node> literal numeric dsym cpath
+%type <node> literal numeric simple_numeric dsym cpath
%type <node> top_compstmt top_stmts top_stmt
%type <node> bodystmt compstmt stmts stmt_or_begin stmt expr arg primary command command_call method_call
%type <node> expr_value arg_value primary_value fcall
@@ -765,7 +771,7 @@ static void token_info_pop(struct parser_params*, const char *token);
%type <node> args call_args opt_call_args
%type <node> paren_args opt_paren_args args_tail opt_args_tail block_args_tail opt_block_args_tail
%type <node> command_args aref_args opt_block_arg block_arg var_ref var_lhs
-%type <node> command_asgn mrhs superclass block_call block_command
+%type <node> command_asgn mrhs mrhs_arg superclass block_call block_command
%type <node> f_block_optarg f_block_opt
%type <node> f_arglist f_args f_arg f_arg_item f_optarg f_marg f_marg_list f_margs
%type <node> assoc_list assocs assoc undef_list backref string_dvar for_var
@@ -777,7 +783,7 @@ static void token_info_pop(struct parser_params*, const char *token);
%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
+%type <id> f_kwrest f_label f_arg_asgn
/*%%%*/
/*%
%type <val> program reswords then do dot_or_colon
@@ -1236,16 +1242,7 @@ stmt : keyword_alias fitem {lex_state = EXPR_FNAME;} fitem
$$ = dispatch2(assign, $1, $3);
%*/
}
- | mlhs '=' arg_value
- {
- /*%%%*/
- $1->nd_value = $3;
- $$ = $1;
- /*%
- $$ = dispatch2(massign, $1, $3);
- %*/
- }
- | mlhs '=' mrhs
+ | mlhs '=' mrhs_arg
{
/*%%%*/
$1->nd_value = $3;
@@ -1684,9 +1681,10 @@ 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, $$);
+ }
%*/
}
| tCOLON3 tCONSTANT
@@ -1697,6 +1695,9 @@ mlhs_node : user_variable
$$ = NEW_CDECL(0, 0, NEW_COLON3($2));
/*%
$$ = dispatch1(top_const_field, $2);
+ if (in_def || in_single) {
+ $$ = dispatch1(assign_error, $$);
+ }
%*/
}
| backref
@@ -2115,16 +2116,7 @@ arg : lhs '=' arg
$$ = dispatch3(binary, $1, ripper_intern("**"), $3);
%*/
}
- | tUMINUS_NUM tINTEGER tPOW arg
- {
- /*%%%*/
- $$ = NEW_CALL(call_bin_op($2, tPOW, $4), tUMINUS, 0);
- /*%
- $$ = dispatch3(binary, $2, ripper_intern("**"), $4);
- $$ = dispatch2(unary, ripper_intern("-@"), $$);
- %*/
- }
- | tUMINUS_NUM tFLOAT tPOW arg
+ | tUMINUS_NUM simple_numeric tPOW arg
{
/*%%%*/
$$ = NEW_CALL(call_bin_op($2, tPOW, $4), tUMINUS, 0);
@@ -2306,11 +2298,10 @@ arg : lhs '=' arg
}
| keyword_defined opt_nl {in_defined = 1;} arg
{
- /*%%%*/
in_defined = 0;
- $$ = NEW_DEFINED($4);
+ /*%%%*/
+ $$ = new_defined($4);
/*%
- in_defined = 0;
$$ = dispatch1(defined, $4);
%*/
}
@@ -2526,6 +2517,10 @@ args : arg_value
}
;
+mrhs_arg : mrhs
+ | arg_value
+ ;
+
mrhs : args ',' arg_value
{
/*%%%*/
@@ -2619,12 +2614,18 @@ primary : literal
$$ = dispatch1(paren, 0);
%*/
}
- | tLPAREN_ARG expr {lex_state = EXPR_ENDARG;} rparen
+ | tLPAREN_ARG
+ {
+ $<val>1 = cmdarg_stack;
+ cmdarg_stack = 0;
+ }
+ expr {lex_state = EXPR_ENDARG;} rparen
{
+ cmdarg_stack = $<val>1;
/*%%%*/
- $$ = $2;
+ $$ = $3;
/*%
- $$ = dispatch1(paren, $2);
+ $$ = dispatch1(paren, $3);
%*/
}
| tLPAREN compstmt ')'
@@ -2706,11 +2707,10 @@ primary : literal
}
| keyword_defined opt_nl '(' {in_defined = 1;} expr rparen
{
- /*%%%*/
in_defined = 0;
- $$ = NEW_DEFINED($5);
+ /*%%%*/
+ $$ = new_defined($5);
/*%
- in_defined = 0;
$$ = dispatch1(defined, $5);
%*/
}
@@ -3488,11 +3488,7 @@ f_larglist : '(' f_args opt_bv_decl ')'
}
| f_args
{
- /*%%%*/
- $$ = $1;
- /*%
$$ = $1;
- %*/
}
;
@@ -4297,26 +4293,24 @@ dsym : tSYMBEG xstring_contents tSTRING_END
}
;
-numeric : tINTEGER
- | tFLOAT
- | tUMINUS_NUM tINTEGER %prec tLOWEST
- {
- /*%%%*/
- $$ = negate_lit($2);
- /*%
- $$ = dispatch2(unary, ripper_intern("-@"), $2);
- %*/
- }
- | tUMINUS_NUM tFLOAT %prec tLOWEST
+numeric : simple_numeric
+ | tUMINUS_NUM simple_numeric %prec tLOWEST
{
/*%%%*/
- $$ = negate_lit($2);
+ $$ = $2;
+ $$->nd_lit = negate_lit($$->nd_lit);
/*%
$$ = dispatch2(unary, ripper_intern("-@"), $2);
%*/
}
;
+simple_numeric : tINTEGER
+ | tFLOAT
+ | tRATIONAL
+ | tIMAGINARY
+ ;
+
user_variable : tIDENTIFIER
| tIVAR
| tGVAR
@@ -4417,9 +4411,14 @@ f_arglist : '(' f_args rparen
lex_state = EXPR_BEG;
command_start = TRUE;
}
- | f_args term
+ | {
+ $<num>$ = parser->parser_in_kwarg;
+ parser->parser_in_kwarg = 1;
+ }
+ f_args term
{
- $$ = $1;
+ parser->parser_in_kwarg = $<num>1;
+ $$ = $2;
lex_state = EXPR_BEG;
command_start = TRUE;
}
@@ -4562,9 +4561,15 @@ f_norm_arg : f_bad_arg
}
;
-f_arg_item : f_norm_arg
+f_arg_asgn : f_norm_arg
{
arg_var(get_id($1));
+ $$ = $1;
+ }
+ ;
+
+f_arg_item : f_arg_asgn
+ {
/*%%%*/
$$ = NEW_ARGS_AUX($1, 1);
/*%
@@ -4610,9 +4615,16 @@ f_arg : f_arg_item
}
;
-f_kw : tLABEL arg_value
+
+f_label : tLABEL
{
arg_var(formal_argument(get_id($1)));
+ $$ = $1;
+ }
+ ;
+
+f_kw : f_label arg_value
+ {
$$ = assignable($1, $2);
/*%%%*/
$$ = NEW_KW_ARG(0, $$);
@@ -4620,11 +4632,19 @@ f_kw : tLABEL arg_value
$$ = rb_assoc_new($$, $2);
%*/
}
+ | f_label
+ {
+ $$ = assignable($1, (NODE *)-1);
+ /*%%%*/
+ $$ = NEW_KW_ARG(0, $$);
+ /*%
+ $$ = rb_assoc_new($$, 0);
+ %*/
+ }
;
-f_block_kw : tLABEL primary_value
+f_block_kw : f_label primary_value
{
- arg_var(formal_argument(get_id($1)));
$$ = assignable($1, $2);
/*%%%*/
$$ = NEW_KW_ARG(0, $$);
@@ -4632,6 +4652,15 @@ f_block_kw : tLABEL primary_value
$$ = rb_assoc_new($$, $2);
%*/
}
+ | f_label
+ {
+ $$ = assignable($1, (NODE *)-1);
+ /*%%%*/
+ $$ = NEW_KW_ARG(0, $$);
+ /*%
+ $$ = rb_assoc_new($$, 0);
+ %*/
+ }
;
f_block_kwarg : f_block_kw
@@ -4698,9 +4727,8 @@ f_kwrest : kwrest_mark tIDENTIFIER
}
;
-f_opt : tIDENTIFIER '=' arg_value
+f_opt : f_arg_asgn '=' arg_value
{
- arg_var(formal_argument(get_id($1)));
$$ = assignable($1, $3);
/*%%%*/
$$ = NEW_OPT_ARG(0, $$);
@@ -4710,9 +4738,8 @@ f_opt : tIDENTIFIER '=' arg_value
}
;
-f_block_opt : tIDENTIFIER '=' primary_value
+f_block_opt : f_arg_asgn '=' primary_value
{
- arg_var(formal_argument(get_id($1)));
$$ = assignable($1, $3);
/*%%%*/
$$ = NEW_OPT_ARG(0, $$);
@@ -4903,6 +4930,10 @@ 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);
@@ -4926,8 +4957,6 @@ assoc : arg_value tASSOC arg_value
}
;
- ;
-
operation : tIDENTIFIER
| tCONSTANT
| tFID
@@ -5005,22 +5034,25 @@ static int parser_parse_string(struct parser_params*,NODE*);
static int parser_here_document(struct parser_params*,NODE*);
-# define nextc() parser_nextc(parser)
-# define pushback(c) parser_pushback(parser, (c))
-# define newtok() parser_newtok(parser)
-# define tokspace(n) parser_tokspace(parser, (n))
-# define tokadd(c) parser_tokadd(parser, (c))
-# define tok_hex(numlen) parser_tok_hex(parser, (numlen))
-# define read_escape(flags,e) parser_read_escape(parser, (flags), (e))
-# define tokadd_escape(e) parser_tokadd_escape(parser, (e))
-# define regx_options() parser_regx_options(parser)
-# define tokadd_string(f,t,p,n,e) parser_tokadd_string(parser,(f),(t),(p),(n),(e))
-# define parse_string(n) parser_parse_string(parser,(n))
-# define tokaddmbc(c, enc) parser_tokaddmbc(parser, (c), (enc))
-# define here_document(n) parser_here_document(parser,(n))
-# define heredoc_identifier() parser_heredoc_identifier(parser)
-# define heredoc_restore(n) parser_heredoc_restore(parser,(n))
-# define whole_match_p(e,l,i) parser_whole_match_p(parser,(e),(l),(i))
+# define nextc() parser_nextc(parser)
+# define pushback(c) parser_pushback(parser, (c))
+# define newtok() parser_newtok(parser)
+# define tokspace(n) parser_tokspace(parser, (n))
+# define tokadd(c) parser_tokadd(parser, (c))
+# define tok_hex(numlen) parser_tok_hex(parser, (numlen))
+# define read_escape(flags,e) parser_read_escape(parser, (flags), (e))
+# define tokadd_escape(e) parser_tokadd_escape(parser, (e))
+# define regx_options() parser_regx_options(parser)
+# define tokadd_string(f,t,p,n,e) parser_tokadd_string(parser,(f),(t),(p),(n),(e))
+# define parse_string(n) parser_parse_string(parser,(n))
+# define tokaddmbc(c, enc) parser_tokaddmbc(parser, (c), (enc))
+# define here_document(n) parser_here_document(parser,(n))
+# define heredoc_identifier() parser_heredoc_identifier(parser)
+# define heredoc_restore(n) parser_heredoc_restore(parser,(n))
+# define whole_match_p(e,l,i) parser_whole_match_p(parser,(e),(l),(i))
+# define number_literal_suffix(f) parser_number_literal_suffix(parser, (f))
+# define set_number_literal(v, t, f) parser_set_number_literal(parser, (v), (t), (f))
+# define set_integer_literal(v, f) parser_set_integer_literal(parser, (v), (f))
#ifndef RIPPER
# define set_yylval_str(x) (yylval.node = NEW_STR(x))
@@ -5116,7 +5148,7 @@ 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(*(p),(enc)) || (*(p)) == '_' || !ISASCII(*(p)))
+#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))
@@ -5238,7 +5270,7 @@ parser_yyerror(struct parser_params *parser, const char *msg)
buf = ALLOCA_N(char, len+2);
MEMCPY(buf, p, char, len);
buf[len] = '\0';
- rb_compile_error_append("%s%s%s", pre, buf, post);
+ rb_compile_error_with_enc(NULL, 0, (void *)current_enc, "%s%s%s", pre, buf, post);
i = (int)(lex_p - p);
p2 = buf; pe = buf + len;
@@ -5261,14 +5293,13 @@ static void parser_prepare(struct parser_params *parser);
#ifndef RIPPER
static VALUE
-debug_lines(const char *f)
+debug_lines(VALUE fname)
{
ID script_lines;
CONST_ID(script_lines, "SCRIPT_LINES__");
if (rb_const_defined_at(rb_cObject, script_lines)) {
VALUE hash = rb_const_get_at(rb_cObject, script_lines);
if (RB_TYPE_P(hash, T_HASH)) {
- VALUE fname = rb_external_str_new_with_enc(f, strlen(f), rb_filesystem_encoding());
VALUE lines = rb_ary_new();
rb_hash_aset(hash, fname, lines);
return lines;
@@ -5278,16 +5309,11 @@ debug_lines(const char *f)
}
static VALUE
-coverage(const char *f, int n)
+coverage(VALUE fname, int n)
{
VALUE coverages = rb_get_coverages();
if (RTEST(coverages) && RBASIC(coverages)->klass == 0) {
- VALUE fname = rb_external_str_new_with_enc(f, strlen(f), rb_filesystem_encoding());
- VALUE lines = rb_ary_new2(n);
- int i;
- RBASIC(lines)->klass = 0;
- for (i = 0; i < n; i++) RARRAY_PTR(lines)[i] = Qnil;
- RARRAY(lines)->as.heap.len = n;
+ VALUE lines = rb_ary_tmp_new_fill(n);
rb_hash_aset(coverages, fname, lines);
return lines;
}
@@ -5308,7 +5334,7 @@ yycompile0(VALUE arg)
struct parser_params *parser = (struct parser_params *)arg;
if (!compile_for_eval && rb_safe_level() == 0) {
- ruby_debug_lines = debug_lines(ruby_sourcefile);
+ ruby_debug_lines = debug_lines(ruby_sourcefile_string);
if (ruby_debug_lines && ruby_sourceline > 0) {
VALUE str = STR_NEW0();
n = ruby_sourceline;
@@ -5318,9 +5344,10 @@ yycompile0(VALUE arg)
}
if (!e_option_supplied(parser)) {
- ruby_coverage = coverage(ruby_sourcefile, ruby_sourceline);
+ ruby_coverage = coverage(ruby_sourcefile_string, ruby_sourceline);
}
}
+ parser->last_cr_line = ruby_sourceline - 1;
parser_prepare(parser);
deferred_nodes = 0;
@@ -5361,9 +5388,10 @@ yycompile0(VALUE arg)
}
static NODE*
-yycompile(struct parser_params *parser, const char *f, int line)
+yycompile(struct parser_params *parser, VALUE fname, int line)
{
- ruby_sourcefile = ruby_strdup(f);
+ ruby_sourcefile_string = rb_str_new_frozen(fname);
+ ruby_sourcefile = RSTRING_PTR(fname);
ruby_sourceline = line - 1;
return (NODE *)rb_suppress_tracing(yycompile0, (VALUE)parser);
}
@@ -5382,21 +5410,21 @@ must_be_ascii_compatible(VALUE s)
static VALUE
lex_get_str(struct parser_params *parser, VALUE s)
{
- char *beg, *end, *pend;
- rb_encoding *enc = must_be_ascii_compatible(s);
+ char *beg, *end, *start;
+ long len;
beg = RSTRING_PTR(s);
+ len = RSTRING_LEN(s);
+ start = beg;
if (lex_gets_ptr) {
- if (RSTRING_LEN(s) == lex_gets_ptr) return Qnil;
+ if (len == lex_gets_ptr) return Qnil;
beg += lex_gets_ptr;
+ len -= lex_gets_ptr;
}
- 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);
+ end = memchr(beg, '\n', len);
+ if (end) len = ++end - beg;
+ lex_gets_ptr += len;
+ return rb_str_subseq(s, beg - start, len);
}
static VALUE
@@ -5423,7 +5451,7 @@ static rb_data_type_t parser_data_type;
static const rb_data_type_t parser_data_type;
static NODE*
-parser_compile_string(volatile VALUE vparser, const char *f, VALUE s, int line)
+parser_compile_string(volatile VALUE vparser, VALUE fname, VALUE s, int line)
{
struct parser_params *parser;
NODE *node;
@@ -5431,11 +5459,11 @@ parser_compile_string(volatile VALUE vparser, const char *f, 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 = s;
+ lex_input = rb_str_new_frozen(s);
lex_pbeg = lex_p = lex_pend = 0;
compile_for_eval = rb_parse_in_eval();
- node = yycompile(parser, f, line);
+ node = yycompile(parser, fname, line);
RB_GC_GUARD(vparser); /* prohibit tail call optimization */
return node;
@@ -5445,12 +5473,18 @@ NODE*
rb_compile_string(const char *f, VALUE s, int line)
{
must_be_ascii_compatible(s);
- return parser_compile_string(rb_parser_new(), f, s, line);
+ return parser_compile_string(rb_parser_new(), rb_filesystem_str_new_cstr(f), s, line);
}
NODE*
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(volatile VALUE vparser, VALUE f, VALUE s, int line)
+{
must_be_ascii_compatible(s);
return parser_compile_string(vparser, f, s, line);
}
@@ -5459,14 +5493,14 @@ NODE*
rb_compile_cstr(const char *f, const char *s, int len, int line)
{
VALUE str = rb_str_new(s, len);
- return parser_compile_string(rb_parser_new(), f, str, line);
+ return parser_compile_string(rb_parser_new(), rb_filesystem_str_new_cstr(f), str, line);
}
NODE*
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, f, str, line);
+ return parser_compile_string(vparser, rb_filesystem_str_new_cstr(f), str, line);
}
static VALUE
@@ -5486,6 +5520,12 @@ rb_compile_file(const char *f, VALUE file, int start)
NODE*
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(volatile VALUE vparser, VALUE fname, VALUE file, int start)
+{
struct parser_params *parser;
NODE *node;
@@ -5495,7 +5535,7 @@ rb_parser_compile_file(volatile VALUE vparser, const char *f, VALUE file, int st
lex_pbeg = lex_p = lex_pend = 0;
compile_for_eval = rb_parse_in_eval();
- node = yycompile(parser, f, start);
+ node = yycompile(parser, fname, start);
RB_GC_GUARD(vparser); /* prohibit tail call optimization */
return node;
@@ -5541,6 +5581,8 @@ parser_str_new(const char *p, long n, rb_encoding *enc, int func, rb_encoding *e
#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)
@@ -5590,9 +5632,15 @@ parser_nextc(struct parser_params *parser)
}
}
c = (unsigned char)*lex_p++;
- if (c == '\r' && peek('\n')) {
- lex_p++;
- c = '\n';
+ if (c == '\r') {
+ if (peek('\n')) {
+ lex_p++;
+ c = '\n';
+ }
+ else if (ruby_sourceline > parser->last_cr_line) {
+ parser->last_cr_line = ruby_sourceline;
+ rb_compile_warn(ruby_sourcefile, ruby_sourceline, "encountered \\r in middle of line, treated as a mere space");
+ }
}
return c;
@@ -6165,13 +6213,6 @@ const unsigned int ruby_global_name_punct_bits[] = {
#undef SPECIAL_PUNCT
#endif
-static inline int
-is_global_name_punct(const char 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)
{
@@ -6334,6 +6375,7 @@ parser_heredoc_restore(struct parser_params *parser, NODE *here)
{
VALUE line;
+ lex_strterm = 0;
line = here->nd_orig;
lex_lastline = line;
lex_pbeg = RSTRING_PTR(line);
@@ -6357,10 +6399,77 @@ parser_whole_match_p(struct parser_params *parser,
while (*p && ISSPACE(*p)) p++;
}
n = lex_pend - (p + len);
- if (n < 0 || (n > 0 && p[len] != '\n' && p[len] != '\r')) return FALSE;
+ if (n < 0) return FALSE;
+ if (n > 0 && p[len] != '\n') {
+ if (p[len] != '\r') return FALSE;
+ if (n <= 1 || p[len+1] != '\n') return FALSE;
+ }
return strncmp(eos, p, len) == 0;
}
+#define NUM_SUFFIX_R (1<<0)
+#define NUM_SUFFIX_I (1<<1)
+#define NUM_SUFFIX_ALL 3
+
+static int
+parser_number_literal_suffix(struct parser_params *parser, int mask)
+{
+ int c, result = 0;
+ const char *lastp = lex_p;
+
+ while ((c = nextc()) != -1) {
+ if ((mask & NUM_SUFFIX_I) && c == 'i') {
+ result |= (mask & NUM_SUFFIX_I);
+ mask &= ~NUM_SUFFIX_I;
+ /* r after i, rational of complex is disallowed */
+ mask &= ~NUM_SUFFIX_R;
+ continue;
+ }
+ if ((mask & NUM_SUFFIX_R) && c == 'r') {
+ result |= (mask & NUM_SUFFIX_R);
+ mask &= ~NUM_SUFFIX_R;
+ continue;
+ }
+ if (!ISASCII(c) || ISALPHA(c) || c == '_') {
+ lex_p = lastp;
+ 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;
+}
+
+static int
+parser_set_number_literal(struct parser_params *parser, VALUE v, int type, int suffix)
+{
+ if (suffix & NUM_SUFFIX_I) {
+ v = rb_complex_raw(INT2FIX(0), v);
+ type = tIMAGINARY;
+ }
+ set_yylval_literal(v);
+ return type;
+}
+
+static int
+parser_set_integer_literal(struct parser_params *parser, VALUE v, int suffix)
+{
+ int type = tINTEGER;
+ if (suffix & NUM_SUFFIX_R) {
+ v = rb_rational_raw1(v);
+ type = tRATIONAL;
+ }
+ return set_number_literal(v, type, suffix);
+}
+
#ifdef RIPPER
static void
ripper_dispatch_heredoc_end(struct parser_params *parser)
@@ -6408,7 +6517,6 @@ parser_here_document(struct parser_params *parser, NODE *here)
#endif
restore:
heredoc_restore(lex_strterm);
- lex_strterm = 0;
return 0;
}
if (was_bol() && whole_match_p(eos, len, indent)) {
@@ -6480,15 +6588,15 @@ parser_here_document(struct parser_params *parser, NODE *here)
#include "lex.c"
static void
-arg_ambiguous_gen(struct parser_params *parser)
+arg_ambiguous_gen(struct parser_params *parser, char c)
{
#ifndef RIPPER
- rb_warning0("ambiguous first argument; put parentheses or even spaces");
+ rb_warningS("ambiguous first argument; put parentheses or a space even after `%c' operator", c);
#else
- dispatch0(arg_ambiguous);
+ dispatch1(arg_ambiguous, rb_usascii_str_new(&c, 1));
#endif
}
-#define arg_ambiguous() (arg_ambiguous_gen(parser), 1)
+#define arg_ambiguous(c) (arg_ambiguous_gen(parser, (c)), 1)
static ID
formal_argument_gen(struct parser_params *parser, ID lhs)
@@ -6551,10 +6659,10 @@ parser_set_encode(struct parser_params *parser, const char *name)
parser->enc = enc;
#ifndef RIPPER
if (ruby_debug_lines) {
- long i, n = RARRAY_LEN(ruby_debug_lines);
- const VALUE *p = RARRAY_PTR(ruby_debug_lines);
+ VALUE lines = ruby_debug_lines;
+ long i, n = RARRAY_LEN(lines);
for (i = 0; i < n; ++i) {
- rb_enc_associate_index(*p, idx);
+ rb_enc_associate_index(RARRAY_AREF(lines, i), idx);
}
}
#endif
@@ -6825,7 +6933,7 @@ parser_prepare(struct parser_params *parser)
#ifndef RIPPER
#define ambiguous_operator(op, syn) ( \
- rb_warning0("`"op"' after local variable is interpreted as binary operator"), \
+ rb_warning0("`"op"' after local variable or literal is interpreted as binary operator"), \
rb_warning0("even though it seems like "syn""))
#else
#define ambiguous_operator(op, syn) dispatch2(operator_ambiguous, ripper_intern(op), rb_str_new_cstr(syn))
@@ -6835,6 +6943,694 @@ 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;
+ 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_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);
+}
+
+static int
+parse_qmark(struct parser_params *parser)
+{
+ rb_encoding *enc;
+ register int c;
+
+ 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;
+}
+
+static int
+parse_percent(struct parser_params *parser, const int space_seen, const enum lex_state_e last_state)
+{
+ register int c;
+
+ 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 '%';
+}
+
+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 void
+tokenize_ident(struct parser_params *parser, const enum lex_state_e last_state)
+{
+ ID ident = TOK_INTERN();
+
+ 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;
+ }
+}
+
+static int
+parse_gvar(struct parser_params *parser, const enum lex_state_e last_state)
+{
+ register int c;
+
+ 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(intern_cstr(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('$');
+ }
+
+ if (tokadd_ident(parser, c)) return 0;
+ 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 && (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;
+ }
+
+ if (tokadd_ident(parser, c)) return 0;
+ 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;
+
+ 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)) {
+ lex_state = EXPR_LABELARG;
+ 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;
+ 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;
+ }
+
+ tokenize_ident(parser, last_state);
+ return result;
+}
+
static int
parser_yylex(struct parser_params *parser)
{
@@ -6842,8 +7638,6 @@ parser_yylex(struct parser_params *parser)
int space_seen = 0;
int cmd_state;
enum lex_state_e last_state;
- rb_encoding *enc;
- int mb;
#ifdef RIPPER
int fallthru = FALSE;
#endif
@@ -6912,13 +7706,16 @@ parser_yylex(struct parser_params *parser)
#endif
/* fall through */
case '\n':
- if (IS_lex_state(EXPR_BEG | EXPR_VALUE | EXPR_CLASS | EXPR_FNAME | EXPR_DOT)) {
+ if (IS_lex_state(EXPR_BEG | EXPR_VALUE | EXPR_CLASS | EXPR_FNAME | EXPR_DOT | EXPR_LABELARG)) {
#ifdef RIPPER
if (!fallthru) {
ripper_dispatch_scan_event(parser, tIGNORED_NL);
}
fallthru = FALSE;
#endif
+ if (IS_lex_state(EXPR_LABELARG) && parser->parser_in_kwarg) {
+ goto normal_newline;
+ }
goto retry;
}
while ((c = nextc())) {
@@ -7147,83 +7944,7 @@ parser_yylex(struct parser_params *parser)
return tSTRING_BEG;
case '?':
- 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;
+ return parse_qmark(parser);
case '&':
if ((c = nextc()) == '&') {
@@ -7291,12 +8012,11 @@ parser_yylex(struct parser_params *parser)
lex_state = EXPR_BEG;
return tOP_ASGN;
}
- if (IS_BEG() || (IS_SPCARG(c) && arg_ambiguous())) {
+ if (IS_BEG() || (IS_SPCARG(c) && arg_ambiguous('+'))) {
lex_state = EXPR_BEG;
pushback(c);
if (c != -1 && ISDIGIT(c)) {
- c = '+';
- goto start_num;
+ return parse_numeric(parser, '+');
}
return tUPLUS;
}
@@ -7324,7 +8044,7 @@ parser_yylex(struct parser_params *parser)
lex_state = EXPR_ENDFN;
return tLAMBDA;
}
- if (IS_BEG() || (IS_SPCARG(c) && arg_ambiguous())) {
+ if (IS_BEG() || (IS_SPCARG(c) && arg_ambiguous('-'))) {
lex_state = EXPR_BEG;
pushback(c);
if (c != -1 && ISDIGIT(c)) {
@@ -7353,226 +8073,9 @@ parser_yylex(struct parser_params *parser)
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':
- {
- int is_float, seen_point, seen_e, nondigit;
-
- 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;
- set_yylval_literal(rb_cstr_to_inum(tok(), 16, FALSE));
- return tINTEGER;
- }
- 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;
- set_yylval_literal(rb_cstr_to_inum(tok(), 2, FALSE));
- return tINTEGER;
- }
- 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;
- set_yylval_literal(rb_cstr_to_inum(tok(), 10, FALSE));
- return tINTEGER;
- }
- 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;
- set_yylval_literal(rb_cstr_to_inum(tok(), 8, FALSE));
- return tINTEGER;
- }
- 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);
- set_yylval_literal(INT2FIX(0));
- return tINTEGER;
- }
- }
-
- 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;
- }
- tokadd('.');
- tokadd(c);
- is_float++;
- seen_point++;
- nondigit = 0;
- break;
-
- case 'e':
- case 'E':
- if (nondigit) {
- pushback(c);
- c = nondigit;
- goto decode_num;
- }
- if (seen_e) {
- goto decode_num;
- }
- tokadd(c);
- seen_e++;
- is_float++;
- nondigit = c;
- c = nextc();
- if (c != '-' && c != '+') continue;
- tokadd(c);
- nondigit = c;
- 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) {
- double d = strtod(tok(), 0);
- if (errno == ERANGE) {
- rb_warningS("Float %s out of range", tok());
- errno = 0;
- }
- set_yylval_literal(DBL2NUM(d));
- return tFLOAT;
- }
- set_yylval_literal(rb_cstr_to_inum(tok(), 10, FALSE));
- return tINTEGER;
- }
+ return parse_numeric(parser, c);
case ')':
case ']':
@@ -7631,7 +8134,7 @@ parser_yylex(struct parser_params *parser)
}
pushback(c);
if (IS_SPCARG(c)) {
- (void)arg_ambiguous();
+ (void)arg_ambiguous('/');
lex_strterm = NEW_STRTERM(str_regexp, '/', 0);
return tREGEXP_BEG;
}
@@ -7743,206 +8246,13 @@ parser_yylex(struct parser_params *parser)
return '\\';
case '%':
- 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 '%';
+ return parse_percent(parser, space_seen, last_state);
case '$':
- 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);
- tokfix();
- set_yylval_name(rb_intern(tok()));
- return tGVAR;
-
- case '-':
- tokadd('$');
- tokadd(c);
- c = nextc();
- if (parser_is_identchar()) {
- if (tokadd_mbchar(c) == -1) return 0;
- }
- else {
- pushback(c);
- }
- gvar:
- tokfix();
- set_yylval_name(rb_intern(tok()));
- 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;
+ return parse_gvar(parser, last_state);
case '@':
- 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;
+ return parse_atmark(parser, last_state);
case '_':
if (was_bol() && whole_match_p("__END__", 7, 0)) {
@@ -7961,7 +8271,7 @@ parser_yylex(struct parser_params *parser)
default:
if (!parser_is_identchar()) {
- rb_compile_error(PARSER_ARG "Invalid char `\\x%02X' in expression", c);
+ compile_error(PARSER_ARG "Invalid char `\\x%02X' in expression", c);
goto retry;
}
@@ -7969,139 +8279,7 @@ parser_yylex(struct parser_params *parser)
break;
}
- 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 (state == EXPR_FNAME) {
- set_yylval_name(rb_intern(kw->name));
- return kw->id[0];
- }
- if (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() && state != EXPR_CMDARG)
- return keyword_do_block;
- if (state & (EXPR_BEG | EXPR_ENDARG))
- return keyword_do_block;
- return keyword_do;
- }
- if (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;
- }
+ return parse_ident(parser, c, cmd_state);
}
#if YYPURE
@@ -8466,8 +8644,7 @@ gettable_gen(struct parser_params *parser, ID id)
case keyword_false:
return NEW_FALSE();
case keyword__FILE__:
- return NEW_STR(rb_external_str_new_with_enc(ruby_sourcefile, strlen(ruby_sourcefile),
- rb_filesystem_encoding()));
+ return NEW_STR(rb_str_dup(ruby_sourcefile_string));
case keyword__LINE__:
return NEW_LIT(INT2FIX(tokline));
case keyword__ENCODING__:
@@ -8488,7 +8665,7 @@ gettable_gen(struct parser_params *parser, ID id)
case ID_CLASS:
return NEW_CVAR(id);
}
- compile_error(PARSER_ARG "identifier %s is not valid to get", rb_id2name(id));
+ compile_error(PARSER_ARG "identifier %"PRIsVALUE" is not valid to get", rb_id2str(id));
return 0;
}
#else /* !RIPPER */
@@ -8506,7 +8683,7 @@ id_is_var_gen(struct parser_params *parser, ID id)
return 0;
}
}
- compile_error(PARSER_ARG "identifier %s is not valid to get", rb_id2name(id));
+ compile_error(PARSER_ARG "identifier %s is not valid to get", rb_id2str(id));
return 0;
}
#endif /* !RIPPER */
@@ -8602,7 +8779,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 %s is not valid to set", rb_id2name(id));
+ compile_error(PARSER_ARG "identifier %"PRIsVALUE" is not valid to set", rb_id2str(id));
}
error:
return assignable_result(0);
@@ -8623,20 +8800,21 @@ is_private_local_id(ID name)
#define LVAR_USED ((ID)1 << (sizeof(ID) * CHAR_BIT - 1))
-static ID
-shadowing_lvar_gen(struct parser_params *parser, ID name)
+static int
+shadowing_lvar_0(struct parser_params *parser, ID name)
{
- if (is_private_local_id(name)) return name;
+ if (is_private_local_id(name)) return 1;
if (dyna_in_block()) {
if (dvar_curr(name)) {
yyerror("duplicated argument name");
}
else if (dvar_defined_get(name) || local_id(name)) {
- rb_warningS("shadowing outer local variable - %s", rb_id2name(name));
+ rb_warningV("shadowing outer local variable - %"PRIsVALUE, rb_id2str(name));
vtable_add(lvtbl->vars, name);
if (lvtbl->used) {
vtable_add(lvtbl->used, (ID)ruby_sourceline | LVAR_USED);
}
+ return 0;
}
}
else {
@@ -8644,6 +8822,13 @@ shadowing_lvar_gen(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;
}
@@ -8652,11 +8837,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 - %s",
- rb_id2name(name));
+ compile_error(PARSER_ARG "invalid local variable - %"PRIsVALUE,
+ rb_id2str(name));
return;
}
- shadowing_lvar(name);
+ if (!shadowing_lvar_0(parser, name)) return;
dyna_var(name);
}
@@ -8664,8 +8849,6 @@ 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);
}
@@ -8677,19 +8860,9 @@ block_dup_check_gen(struct parser_params *parser, NODE *node1, NODE *node2)
}
}
-ID
-rb_id_attrset(ID id)
-{
- id &= ~ID_SCOPE_MASK;
- id |= ID_ATTRSET;
- return id;
-}
-
static NODE *
attrset_gen(struct parser_params *parser, NODE *recv, ID id)
{
- if (recv && nd_type(recv) == NODE_SELF)
- recv = (NODE *)1;
return NEW_ATTRASGN(recv, rb_id_attrset(id), 0);
}
@@ -8798,11 +8971,6 @@ value_expr_gen(struct parser_params *parser, NODE *node)
}
while (node) {
switch (nd_type(node)) {
- case NODE_DEFN:
- case NODE_DEFS:
- parser_warning(node, "void value expression");
- return FALSE;
-
case NODE_RETURN:
case NODE_BREAK:
case NODE_NEXT:
@@ -8963,6 +9131,16 @@ remove_begin(NODE *node)
return node;
}
+static NODE *
+remove_begin_all(NODE *node)
+{
+ NODE **n = &node, *n1 = node;
+ while (n1 && nd_type(n1) == NODE_BEGIN) {
+ *n = n1 = n1->nd_body;
+ }
+ return node;
+}
+
static void
reduce_nodes_gen(struct parser_params *parser, NODE **body)
{
@@ -9267,32 +9445,33 @@ new_yield_gen(struct parser_params *parser, NODE *node)
return NEW_YIELD(node);
}
-static NODE*
-negate_lit(NODE *node)
+static VALUE
+negate_lit(VALUE lit)
{
- switch (TYPE(node->nd_lit)) {
+ int type = TYPE(lit);
+ switch (type) {
case T_FIXNUM:
- node->nd_lit = LONG2FIX(-FIX2LONG(node->nd_lit));
+ lit = LONG2FIX(-FIX2LONG(lit));
break;
case T_BIGNUM:
- node->nd_lit = rb_funcall(node->nd_lit,tUMINUS,0,0);
+ case T_RATIONAL:
+ case T_COMPLEX:
+ lit = rb_funcall(lit,tUMINUS,0,0);
break;
case T_FLOAT:
#if USE_FLONUM
- 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);
+ if (FLONUM_P(lit)) {
+ lit = DBL2NUM(-RFLOAT_VALUE(lit));
+ break;
}
-#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);
break;
}
- return node;
+ return lit;
}
static NODE *
@@ -9335,17 +9514,21 @@ new_args_tail_gen(struct parser_params *parser, NODE *k, ID kr, ID b)
struct rb_args_info *args;
NODE *kw_rest_arg = 0;
NODE *node;
+ int check = 0;
- args = ALLOC(struct rb_args_info);
- MEMZERO(args, struct rb_args_info, 1);
+ args = ZALLOC(struct rb_args_info);
node = NEW_NODE(NODE_ARGS, 0, 0, args);
args->block_arg = b;
args->kw_args = k;
- if (k && !kr) kr = internal_id();
+ if (k && !kr) {
+ check = 1;
+ kr = internal_id();
+ }
if (kr) {
arg_var(kr);
kw_rest_arg = NEW_DVAR(kr);
+ kw_rest_arg->nd_cflag = check;
}
args->kw_rest_arg = kw_rest_arg;
@@ -9390,8 +9573,13 @@ 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_asgn_or_id(vid)) {
- asgn->nd_aid = vid;
+ if (is_notop_id(vid)) {
+ switch (id_type(vid)) {
+ case ID_GLOBAL:
+ case ID_INSTANCE:
+ case ID_CLASS:
+ asgn->nd_aid = vid;
+ }
}
}
else if (op == tANDOP) {
@@ -9476,7 +9664,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_warn4S(ruby_sourcefile, (int)u[i], "assigned but unused variable - %s", rb_id2name(v[i]));
+ rb_warn4V(ruby_sourcefile, (int)u[i], "assigned but unused variable - %"PRIsVALUE, rb_id2str(v[i]));
}
}
@@ -9492,6 +9680,8 @@ 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;
+ local->cmdargs = cmdarg_stack;
+ cmdarg_stack = 0;
lvtbl = local;
}
@@ -9505,56 +9695,50 @@ local_pop_gen(struct parser_params *parser)
}
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 = vtable_size(lvtbl->args) + vtable_size(lvtbl->vars);
+ int cnt_args = vtable_size(lvtbl->args);
+ int cnt_vars = vtable_size(lvtbl->vars);
+ int cnt = cnt_args + cnt_vars;
+ int i, j;
ID *buf;
if (cnt <= 0) return 0;
buf = ALLOC_N(ID, cnt + 1);
- vtable_tblcpy(buf+1, lvtbl->args);
- vtable_tblcpy(buf+vtable_size(lvtbl->args)+1, lvtbl->vars);
+ 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);
buf[0] = cnt;
return buf;
}
#endif
-static int
+static void
arg_var_gen(struct parser_params *parser, ID id)
{
vtable_add(lvtbl->args, id);
- return vtable_size(lvtbl->args) - 1;
}
-static int
+static void
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
@@ -9720,8 +9904,7 @@ reg_fragment_check_gen(struct parser_params* parser, VALUE str, int options)
err = rb_reg_check_preprocess(str);
if (err != Qnil) {
err = rb_obj_as_string(err);
- compile_error(PARSER_ARG "%s", RSTRING_PTR(err));
- RB_GC_GUARD(err);
+ compile_error(PARSER_ARG "%"PRIsVALUE, err);
return 0;
}
return 1;
@@ -9758,10 +9941,10 @@ reg_named_capture_assign_iter(const OnigUChar *name, const OnigUChar *name_end,
!rb_enc_symname2_p(s, len, enc)) {
return ST_CONTINUE;
}
- var = rb_intern3(s, len, enc);
+ var = intern_cstr(s, len, enc);
if (dvar_defined(var) || local_id(var)) {
- rb_warningS("named capture conflicts a local variable - %s",
- rb_id2name(var));
+ rb_warningV("named capture conflicts a local variable - %"PRIsVALUE,
+ rb_id2str(var));
}
arg->succ_block = block_append(arg->succ_block,
newline_node(node_assign(assignable(var,0),
@@ -9785,7 +9968,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, (void*)&arg);
+ onig_foreach_name(RREGEXP(regexp)->ptr, reg_named_capture_assign_iter, &arg);
if (arg.num == 0)
return match;
@@ -9824,18 +10007,13 @@ reg_compile_gen(struct parser_params* parser, VALUE str, int options)
rb_str_append(rb_str_cat(rb_attr_get(err, mesg), "\n", 1), m);
}
else {
- compile_error(PARSER_ARG "%s", RSTRING_PTR(m));
+ compile_error(PARSER_ARG "%"PRIsVALUE, m);
}
return Qnil;
}
return re;
}
-void
-rb_gc_mark_parser(void)
-{
-}
-
NODE*
rb_parser_append_print(VALUE vparser, NODE *node)
{
@@ -9909,105 +10087,15 @@ 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];
-} 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
-Init_sym(void)
+rb_init_parse(void)
{
- 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
-
+ /* just to suppress unused-function warnings */
(void)nodetype;
(void)nodeline;
#if PARSER_DEBUG
(void)lex_state_name(-1);
#endif
-
- Init_id();
-}
-
-void
-rb_gc_mark_symbols(void)
-{
- rb_mark_tbl(global_symbols.id_str);
- rb_gc_mark_locations(global_symbols.op_sym,
- global_symbols.op_sym + numberof(global_symbols.op_sym));
}
#endif /* !RIPPER */
@@ -10016,630 +10104,9 @@ 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_INTERNAL | (id << ID_SCOPE_SHIFT);
+ return ID_STATIC_SYM | 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 == '-') {
- ++m;
- if (m < e && 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);
-}
-
-static int
-rb_enc_symname_type(const char *name, long len, rb_encoding *enc)
-{
- 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);
- switch (*m) {
- case '!': case '?':
- if (type == ID_GLOBAL || type == ID_CLASS || type == ID_INSTANCE) return -1;
- type = ID_JUNK;
- ++m;
- break;
- case '=':
- if (type != ID_CONST && type != ID_LOCAL) 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) != -1;
-}
-
-static int
-rb_str_symname_type(VALUE name)
-{
- const char *ptr = StringValuePtr(name);
- long len = RSTRING_LEN(name);
- int type = rb_enc_symname_type(ptr, len, rb_enc_get(name));
- 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);
- st_add_direct(global_symbols.sym_id, (st_data_t)str, id);
- st_add_direct(global_symbols.id_str, id, (st_data_t)str);
- 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);
-
-ID
-rb_intern3(const char *name, long len, rb_encoding *enc)
-{
- VALUE str;
- st_data_t data;
- struct RString fake_str;
- fake_str.basic.flags = T_STRING|RSTRING_NOEMBED;
- fake_str.basic.klass = rb_cString;
- fake_str.as.heap.len = len;
- fake_str.as.heap.ptr = (char *)name;
- fake_str.as.heap.aux.capa = len;
- str = (VALUE)&fake_str;
- 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 (rb_cString && !rb_enc_asciicompat(enc)) {
- id = ID_JUNK;
- goto new_id;
- }
- last = len-1;
- id = 0;
- switch (*m) {
- case '$':
- 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] == '@') {
- m++;
- id |= ID_CLASS;
- }
- else {
- 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;
- }
- }
- }
-
- if (m[last] == '=') {
- /* attribute assignment */
- 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 (rb_enc_isupper(m[0], enc)) {
- id = ID_CONST;
- }
- else {
- id = ID_LOCAL;
- }
- break;
- }
- 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 (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;
- }
- 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;
- }
- return str;
- }
- }
- }
-
- if (st_lookup(global_symbols.id_str, id, &data)) {
- VALUE str = (VALUE)data;
- if (RBASIC(str)->klass == 0)
- RBASIC(str)->klass = rb_cString;
- return str;
- }
-
- if (is_attrset_id(id)) {
- ID id2 = (id & ~ID_SCOPE_MASK) | ID_LOCAL;
- VALUE str;
-
- while (!(str = rb_id2str(id2))) {
- if (!is_local_id(id2)) return 0;
- id2 = (id & ~ID_SCOPE_MASK) | ID_CONST;
- }
- str = rb_str_dup(str);
- rb_str_cat(str, "=", 1);
- rb_intern_str(str);
- if (st_lookup(global_symbols.id_str, id, &data)) {
- VALUE str = (VALUE)data;
- if (RBASIC(str)->klass == 0)
- RBASIC(str)->klass = 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;
- const VALUE localname = (VALUE)&fake_str;
- /* make local name by chopping '=' */
- fake_str.basic.flags = T_STRING|RSTRING_NOEMBED;
- fake_str.basic.klass = rb_cString;
- fake_str.as.heap.len = RSTRING_LEN(name) - 1;
- fake_str.as.heap.ptr = RSTRING_PTR(name);
- fake_str.as.heap.aux.capa = fake_str.as.heap.len;
- 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 = (VALUE)&fake_str;
- fake_str.basic.flags = T_STRING|RSTRING_NOEMBED;
- fake_str.basic.klass = rb_cString;
- fake_str.as.heap.len = len;
- fake_str.as.heap.ptr = (char *)ptr;
- fake_str.as.heap.aux.capa = 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) == ID_CONST;
-}
-
-int
-rb_is_class_name(VALUE name)
-{
- return rb_str_symname_type(name) == ID_CLASS;
-}
-
-int
-rb_is_global_name(VALUE name)
-{
- return rb_str_symname_type(name) == ID_GLOBAL;
-}
-
-int
-rb_is_instance_name(VALUE name)
-{
- return rb_str_symname_type(name) == ID_INSTANCE;
-}
-
-int
-rb_is_attrset_name(VALUE name)
-{
- return rb_str_symname_type(name) == ID_ATTRSET;
-}
-
-int
-rb_is_local_name(VALUE name)
-{
- return rb_str_symname_type(name) == ID_LOCAL;
-}
-
-int
-rb_is_method_name(VALUE name)
-{
- switch (rb_str_symname_type(name)) {
- 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) == -1;
-}
-
-#endif /* !RIPPER */
-
static void
parser_initialize(struct parser_params *parser)
{
@@ -10655,6 +10122,7 @@ parser_initialize(struct parser_params *parser)
parser->parser_in_single = 0;
parser->parser_in_def = 0;
parser->parser_in_defined = 0;
+ parser->parser_in_kwarg = 0;
parser->parser_compile_for_eval = 0;
parser->parser_cur_mid = 0;
parser->parser_tokenbuf = NULL;
@@ -10669,13 +10137,13 @@ parser_initialize(struct parser_params *parser)
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->parser_ruby_sourcefile_string = Qnil;
parser->delayed = Qnil;
parser->result = Qnil;
@@ -10703,12 +10171,12 @@ parser_mark(void *ptr)
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)p->parser_eval_tree_begin) ;
rb_gc_mark((VALUE)p->parser_eval_tree) ;
rb_gc_mark(p->debug_lines);
#else
- rb_gc_mark(p->parser_ruby_sourcefile_string);
rb_gc_mark(p->delayed);
rb_gc_mark(p->value);
rb_gc_mark(p->result);
@@ -10733,9 +10201,6 @@ parser_free(void *ptr)
prev = local->prev;
xfree(local);
}
-#ifndef RIPPER
- xfree(p->parser_ruby_sourcefile);
-#endif
xfree(p);
}
@@ -10752,11 +10217,6 @@ parser_memsize(const void *ptr)
size += sizeof(*local);
if (local->vars) size += local->vars->capa * sizeof(ID);
}
-#ifndef RIPPER
- if (p->parser_ruby_sourcefile) {
- size += strlen(p->parser_ruby_sourcefile) + 1;
- }
-#endif
return size;
}
@@ -10771,6 +10231,7 @@ rb_data_type_t parser_data_type = {
parser_free,
parser_memsize,
},
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
#ifndef RIPPER
@@ -10787,8 +10248,7 @@ parser_new(void)
{
struct parser_params *p;
- p = ALLOC_N(struct parser_params, 1);
- MEMZERO(p, struct parser_params, 1);
+ p = ZALLOC(struct parser_params);
parser_initialize(p);
return p;
}
@@ -10943,12 +10403,14 @@ ripper_validate_object(VALUE self, VALUE x)
if (SYMBOL_P(x)) return x;
if (!rb_is_pointer_to_heap(x))
rb_raise(rb_eArgError, "invalid pointer: %p", x);
- switch (TYPE(x)) {
+ switch (BUILTIN_TYPE(x)) {
case T_STRING:
case T_OBJECT:
case T_ARRAY:
case T_BIGNUM:
case T_FLOAT:
+ case T_COMPLEX:
+ case T_RATIONAL:
return x;
case T_NODE:
if (nd_type(x) != NODE_LASGN) {
@@ -11119,8 +10581,7 @@ ripper_id2sym(ID id)
name = "&&";
break;
default:
- name = rb_id2name(id);
- if (!name) {
+ if (!rb_id2str(id)) {
rb_bug("cannot convert ID to string: %ld", (unsigned long)id);
}
return ID2SYM(id);
@@ -11174,12 +10635,21 @@ ripper_warnI(struct parser_params *parser, const char *fmt, int a)
STR_NEW2(fmt), INT2NUM(a));
}
+#if 0 /* not in use right now */
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));
}
+#endif
+
+static void
+ripper_warnV(struct parser_params *parser, const char *fmt, VALUE v)
+{
+ rb_funcall(parser->value, rb_intern("warn"), 2,
+ STR_NEW2(fmt), v);
+}
static void
ripper_warning0(struct parser_params *parser, const char *fmt)
@@ -11194,6 +10664,13 @@ ripper_warningS(struct parser_params *parser, const char *fmt, const char *str)
STR_NEW2(fmt), STR_NEW2(str));
}
+static void
+ripper_warningV(struct parser_params *parser, const char *fmt, VALUE v)
+{
+ rb_funcall(parser->value, rb_intern("warning"), 2,
+ STR_NEW2(fmt), v);
+}
+
static VALUE
ripper_lex_get_generic(struct parser_params *parser, VALUE src)
{
@@ -11206,8 +10683,7 @@ ripper_s_allocate(VALUE klass)
struct parser_params *p;
VALUE self;
- p = ALLOC_N(struct parser_params, 1);
- MEMZERO(p, struct parser_params, 1);
+ p = ZALLOC(struct parser_params);
self = TypedData_Wrap_Struct(klass, &parser_data_type, p);
p->value = self;
return self;
@@ -11244,9 +10720,11 @@ ripper_initialize(int argc, VALUE *argv, VALUE self)
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);
@@ -11378,7 +10856,7 @@ ripper_assert_Qundef(VALUE self, VALUE obj, VALUE msg)
{
StringValue(msg);
if (obj == Qundef) {
- rb_raise(rb_eArgError, "%s", RSTRING_PTR(msg));
+ rb_raise(rb_eArgError, "%"PRIsVALUE, msg);
}
return Qnil;
}
@@ -11412,6 +10890,7 @@ InitVM_ripper(void)
VALUE Ripper;
Ripper = rb_define_class("Ripper", rb_cObject);
+ /* version of Ripper */
rb_define_const(Ripper, "Version", rb_usascii_str_new2(RIPPER_VERSION));
rb_define_alloc_func(Ripper, ripper_s_allocate);
rb_define_method(Ripper, "initialize", ripper_initialize, -1);
diff --git a/prelude.rb b/prelude.rb
index 2b371e7134..cc24a81474 100644
--- a/prelude.rb
+++ b/prelude.rb
@@ -4,9 +4,9 @@ class Thread
# call-seq:
# Thread.exclusive { block } => obj
#
- # Wraps a block in Thread.critical, restoring the original value
- # upon exit from the critical section, and returns the value of the
- # block.
+ # 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.
def self.exclusive
MUTEX_FOR_THREAD_EXCLUSIVE.synchronize{
yield
diff --git a/probes.d b/probes.d
index 31aef37854..dc20d30172 100644
--- a/probes.d
+++ b/probes.d
@@ -1,3 +1,4 @@
+/* -*- c -*- */
#include "vm_opts.h"
provider ruby {
@@ -11,14 +12,14 @@ provider ruby {
* `filename` the file name where the method is _being called_ (a string)
* `lineno` the line number where the method is _being called_ (an int)
*/
- probe method__entry(const char *, const char *, const char *, int);
+ probe method__entry(const char *classname, const char *methodname, const char *filename, int lineno);
/*
ruby:::method-return(classname, methodname, filename, lineno);
This probe is fired just after a method has returned. The arguments are
the same as "ruby:::function-entry".
*/
- probe method__return(const char *, const char *, const char *, int);
+ probe method__return(const char *classname, const char *methodname, const char *filename, int lineno);
/*
ruby:::cmethod-entry(classname, methodname, filename, lineno);
@@ -26,14 +27,14 @@ provider ruby {
This probe is fired just before a C method is entered. The arguments are
the same as "ruby:::function-entry".
*/
- probe cmethod__entry(const char *, const char *, const char *, int);
+ 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:::function-entry".
*/
- probe cmethod__return(const char *, const char *, const char *, int);
+ probe cmethod__return(const char *classname, const char *methodname, const char *filename, int lineno);
/*
ruby:::require-entry(requiredfile, filename, lineno);
@@ -45,7 +46,7 @@ provider ruby {
* `filename` is the file that called "require" (string).
* `lineno` is the line number where the call to require was made (int).
*/
- probe require__entry(const char *, const char *, int);
+ probe require__entry(const char *rquiredfile, const char *filename, int lineno);
/*
ruby:::require-return(requiredfile, filename, lineno);
@@ -54,7 +55,7 @@ provider ruby {
returns. The arguments are the same as "ruby:::require-entry". This
probe will not fire if there was an exception during file require.
*/
- probe require__return(const char *, const char *, int);
+ probe require__return(const char *requiredfile, const char *filename, int lineno);
/*
ruby:::find-require-entry(requiredfile, filename, lineno);
@@ -68,7 +69,7 @@ provider ruby {
* `filename` is the file that called "require" (string).
* `lineno` is the line number where the call to require was made (int).
*/
- probe find__require__entry(const char *, const char *, int);
+ probe find__require__entry(const char *requiredfile, const char *filename, int lineno);
/*
ruby:::find-require-return(requiredfile, filename, lineno);
@@ -77,7 +78,7 @@ provider ruby {
documentation for "ruby:::find-require-entry" for more details. Arguments
for this probe are the same as "ruby:::find-require-entry".
*/
- probe find__require__return(const char *, const char *, int);
+ probe find__require__return(const char *requiredfile, const char *filename, int lineno);
/*
ruby:::load-entry(loadedfile, filename, lineno);
@@ -85,7 +86,7 @@ provider ruby {
This probe is fired when calls to "load" are made. The arguments are the
same as "ruby:::require-entry".
*/
- probe load__entry(const char *, const char *, int);
+ probe load__entry(const char *loadedfile, const char *filename, int lineno);
/*
ruby:::load-return(loadedfile, filename, lineno);
@@ -93,7 +94,7 @@ provider ruby {
This probe is fired when "load" returns. The arguments are the same as
"ruby:::load-entry".
*/
- probe load__return(const char *, const char *, int);
+ probe load__return(const char *loadedfile, const char *filename, int lineno);
/*
ruby:::raise(classname, filename, lineno);
@@ -104,7 +105,7 @@ provider ruby {
* `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)
*/
- probe raise(const char *, const char *, int);
+ probe raise(const char *classname, const char *filename, int lineno);
/*
ruby:::object-create(classname, filename, lineno);
@@ -115,7 +116,7 @@ provider ruby {
* `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)
*/
- probe object__create(const char *, const char *, int);
+ probe object__create(const char *classname, const char *filename, int lineno);
/*
ruby:::array-create(length, filename, lineno);
@@ -126,7 +127,7 @@ provider ruby {
* `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)
*/
- probe array__create(long, const char *, int);
+ probe array__create(long length, const char *filename, int lineno);
/*
ruby:::hash-create(length, filename, lineno);
@@ -137,7 +138,7 @@ provider ruby {
* `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)
*/
- probe hash__create(long, const char *, int);
+ probe hash__create(long length, const char *filename, int lineno);
/*
ruby:::string-create(length, filename, lineno);
@@ -148,7 +149,18 @@ provider ruby {
* `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)
*/
- probe string__create(long, const char *, int);
+ probe string__create(long length, const char *filename, int lineno);
+
+ /*
+ 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)
+ */
+ probe symbol__create(const char *str, const char *filename, int lineno);
/*
ruby:::parse-begin(sourcefile, lineno);
@@ -158,7 +170,7 @@ provider ruby {
* `sourcefile` the file being parsed (string)
* `lineno` the line number where the source starts (int)
*/
- probe parse__begin(const char *, int);
+ probe parse__begin(const char *sourcefile, int lineno);
/*
ruby:::parse-end(sourcefile, lineno);
@@ -168,11 +180,11 @@ provider ruby {
* `sourcefile` the file being parsed (string)
* `lineno` the line number where the source ended (int)
*/
- probe parse__end(const char *, int);
+ probe parse__end(const char *sourcefile, int lineno);
#if VM_COLLECT_USAGE_DETAILS
- probe insn(const char *);
- probe insn__operand(const char *, const char *);
+ probe insn(const char *insns_name);
+ probe insn__operand(const char *val, const char *insns_name);
#endif
/*
@@ -202,6 +214,17 @@ 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 12a18dcb34..f01cbc374a 100644
--- a/probes_helper.h
+++ b/probes_helper.h
@@ -10,7 +10,7 @@ VALUE rb_class_path_no_cache(VALUE _klass);
do { \
if (RUBY_DTRACE_##name##_ENABLED()) { \
VALUE _klass = (klazz); \
- VALUE _id = (id); \
+ ID _id = (id); \
const char * classname; \
const char * methodname; \
const char * filename; \
diff --git a/proc.c b/proc.c
index 41908d5b94..a3882a9acd 100644
--- a/proc.c
+++ b/proc.c
@@ -14,6 +14,8 @@
#include "gc.h"
#include "iseq.h"
+const NODE *rb_vm_cref_in_context(VALUE self, VALUE cbase);
+
struct METHOD {
VALUE recv;
VALUE rclass;
@@ -31,36 +33,23 @@ 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);
-static ID attached;
+#define attached id__attached__
/* Proc */
#define IS_METHOD_PROC_NODE(node) (nd_type(node) == NODE_IFUNC && (node)->nd_cfnc == bmcall)
static void
-proc_free(void *ptr)
-{
- RUBY_FREE_ENTER("proc");
- if (ptr) {
- ruby_xfree(ptr);
- }
- RUBY_FREE_LEAVE("proc");
-}
-
-static void
proc_mark(void *ptr)
{
- rb_proc_t *proc;
+ rb_proc_t *proc = ptr;
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_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");
}
@@ -68,23 +57,25 @@ proc_mark(void *ptr)
static size_t
proc_memsize(const void *ptr)
{
- return ptr ? sizeof(rb_proc_t) : 0;
+ return sizeof(rb_proc_t);
}
static const rb_data_type_t proc_data_type = {
"proc",
{
proc_mark,
- proc_free,
+ RUBY_TYPED_DEFAULT_FREE,
proc_memsize,
},
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
VALUE
-rb_proc_alloc(VALUE klass)
+rb_proc_wrap(VALUE klass, rb_proc_t *proc)
{
- rb_proc_t *proc;
- return TypedData_Make_Struct(klass, rb_proc_t, &proc_data_type, proc);
+ proc->block.proc = TypedData_Wrap_Struct(klass, &proc_data_type, proc);
+
+ return proc->block.proc;
}
VALUE
@@ -102,17 +93,14 @@ rb_obj_is_proc(VALUE proc)
static VALUE
proc_dup(VALUE self)
{
- VALUE procval = rb_proc_alloc(rb_cProc);
- rb_proc_t *src, *dst;
- GetProcPtr(self, src);
- GetProcPtr(procval, dst);
+ VALUE procval;
+ rb_proc_t *src;
+ rb_proc_t *dst = ALLOC(rb_proc_t);
- dst->block = src->block;
- dst->block.proc = procval;
- dst->blockprocval = src->blockprocval;
- dst->envval = src->envval;
- dst->safe_level = src->safe_level;
- dst->is_lambda = src->is_lambda;
+ GetProcPtr(self, src);
+ *dst = *src;
+ procval = rb_proc_wrap(rb_cProc, dst);
+ RB_GC_GUARD(self); /* for: body = proc_dup(body) */
return procval;
}
@@ -269,13 +257,14 @@ binding_memsize(const void *ptr)
return ptr ? sizeof(rb_binding_t) : 0;
}
-static const rb_data_type_t binding_data_type = {
+const rb_data_type_t ruby_binding_data_type = {
"binding",
{
binding_mark,
binding_free,
binding_memsize,
},
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
static VALUE
@@ -283,7 +272,7 @@ binding_alloc(VALUE klass)
{
VALUE obj;
rb_binding_t *bind;
- obj = TypedData_Make_Struct(klass, rb_binding_t, &binding_data_type, bind);
+ obj = TypedData_Make_Struct(klass, rb_binding_t, &ruby_binding_data_type, bind);
return obj;
}
@@ -394,6 +383,208 @@ bind_eval(int argc, VALUE *argv, VALUE bindval)
return rb_f_eval(argc+1, args, Qnil /* self will be searched in eval */);
}
+static VALUE *
+get_local_variable_ptr(VALUE envval, ID lid)
+{
+ rb_env_t *env;
+
+ do {
+ const rb_iseq_t *iseq;
+ int i;
+
+ GetEnvPtr(envval, env);
+ iseq = env->block.iseq;
+
+ for (i=0; i<iseq->local_table_size; i++) {
+ if (iseq->local_table[i] == lid) {
+ return &env->env[i];
+ }
+ }
+ } while ((envval = env->prev_envval) != 0);
+
+ return 0;
+}
+
+/*
+ * check local variable name.
+ * returns ID if it's an already interned symbol, or 0 with setting
+ * local name in String to *namep.
+ */
+static ID
+check_local_id(VALUE bindval, volatile VALUE *pname)
+{
+ ID lid = rb_check_id(pname);
+ VALUE name = *pname, sym = name;
+
+ if (lid) {
+ if (!rb_is_local_id(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(sym)) goto wrong;
+ return 0;
+ }
+ return lid;
+}
+
+/*
+ * call-seq:
+ * binding.local_variables -> Array
+ *
+ * Returns the +symbol+ names of the binding's local variables
+ *
+ * def foo
+ * a = 1
+ * 2.times do |n|
+ * binding.local_variables #=> [:a, :n]
+ * end
+ * end
+ *
+ * This method is short version of the following code.
+ *
+ * binding.eval("local_variables")
+ *
+ */
+static VALUE
+bind_local_variables(VALUE bindval)
+{
+ const rb_binding_t *bind;
+
+ GetBindingPtr(bindval, bind);
+ return rb_vm_env_local_variables(bind->env);
+}
+
+/*
+ * call-seq:
+ * binding.local_variable_get(symbol) -> obj
+ *
+ * Returns a +value+ of local variable +symbol+.
+ *
+ * def foo
+ * a = 1
+ * binding.local_variable_get(:a) #=> 1
+ * binding.local_variable_get(:b) #=> NameError
+ * end
+ *
+ * This method is short version of the following code.
+ *
+ * binding.eval("#{symbol}")
+ *
+ */
+static VALUE
+bind_local_variable_get(VALUE bindval, VALUE sym)
+{
+ ID lid = check_local_id(bindval, &sym);
+ const rb_binding_t *bind;
+ const VALUE *ptr;
+
+ if (!lid) goto undefined;
+
+ GetBindingPtr(bindval, bind);
+
+ if ((ptr = get_local_variable_ptr(bind->env, lid)) == NULL) {
+ undefined:
+ rb_name_error_str(sym, "local variable `%"PRIsVALUE"' not defined for %"PRIsVALUE,
+ sym, bindval);
+ }
+
+ return *ptr;
+}
+
+/*
+ * call-seq:
+ * binding.local_variable_set(symbol, obj) -> obj
+ *
+ * Set local variable named +symbol+ as +obj+.
+ *
+ * def foo
+ * a = 1
+ * 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 is a similar behavior of the following code
+ *
+ * binding.eval("#{symbol} = #{obj}")
+ *
+ * if obj can be dumped in Ruby code.
+ */
+static VALUE
+bind_local_variable_set(VALUE bindval, VALUE sym, VALUE val)
+{
+ ID lid = check_local_id(bindval, &sym);
+ rb_binding_t *bind;
+ VALUE *ptr;
+
+ if (!lid) lid = rb_intern_str(sym);
+
+ GetBindingPtr(bindval, bind);
+ if ((ptr = get_local_variable_ptr(bind->env, lid)) == NULL) {
+ /* not found. create new env */
+ ptr = rb_binding_add_dynavars(bind, 1, &lid);
+ }
+
+ *ptr = val;
+
+ return val;
+}
+
+/*
+ * call-seq:
+ * binding.local_variable_defined?(symbol) -> obj
+ *
+ * Returns a +true+ if a local variable +symbol+ exists.
+ *
+ * def foo
+ * a = 1
+ * binding.local_variable_defined?(:a) #=> true
+ * binding.local_variable_defined?(:b) #=> false
+ * end
+ *
+ * This method is short version of the following code.
+ *
+ * binding.eval("defined?(#{symbol}) == 'local-variable'")
+ *
+ */
+static VALUE
+bind_local_variable_defined_p(VALUE bindval, VALUE sym)
+{
+ ID lid = check_local_id(bindval, &sym);
+ const rb_binding_t *bind;
+
+ if (!lid) return Qfalse;
+
+ GetBindingPtr(bindval, bind);
+ 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
proc_new(VALUE klass, int is_lambda)
{
@@ -427,7 +618,7 @@ proc_new(VALUE klass, int is_lambda)
}
else {
VALUE newprocval = proc_dup(procval);
- RBASIC(newprocval)->klass = klass;
+ RBASIC_SET_CLASS(newprocval, klass);
return newprocval;
}
}
@@ -496,6 +687,17 @@ rb_block_lambda(void)
}
VALUE
+rb_block_clear_env_self(VALUE proc)
+{
+ rb_proc_t *po;
+ rb_env_t *env;
+ GetProcPtr(proc, po);
+ GetEnvPtr(po->envval, env);
+ env->env[0] = Qnil;
+ return proc;
+}
+
+VALUE
rb_f_lambda(void)
{
rb_warn("rb_f_lambda() is deprecated; use rb_block_proc() instead");
@@ -594,15 +796,14 @@ rb_proc_call(VALUE self, VALUE args)
VALUE vret;
rb_proc_t *proc;
GetProcPtr(self, proc);
- vret = rb_vm_invoke_proc(GET_THREAD(), proc,
- check_argc(RARRAY_LEN(args)), RARRAY_PTR(args), 0);
+ vret = rb_vm_invoke_proc(GET_THREAD(), proc, check_argc(RARRAY_LEN(args)), RARRAY_CONST_PTR(args), 0);
RB_GC_GUARD(self);
RB_GC_GUARD(args);
return vret;
}
VALUE
-rb_proc_call_with_block(VALUE self, int argc, VALUE *argv, VALUE pass_procval)
+rb_proc_call_with_block(VALUE self, int argc, const VALUE *argv, VALUE pass_procval)
{
VALUE vret;
rb_proc_t *proc;
@@ -621,36 +822,46 @@ rb_proc_call_with_block(VALUE self, int argc, VALUE *argv, VALUE pass_procval)
return vret;
}
+
/*
* call-seq:
* prc.arity -> fixnum
*
- * Returns the number of arguments that would not be ignored. If the block
+ * Returns the number of mandatory arguments. 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, return -n-1, where n is the number of mandatory
- * arguments. A <code>proc</code> with no argument declarations
+ * 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 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 #=> 0
+ * 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
* 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
@@ -664,24 +875,16 @@ static inline int
rb_iseq_min_max_arity(const rb_iseq_t *iseq, int *max)
{
*max = iseq->arg_rest == -1 ?
- iseq->argc + iseq->arg_post_len + iseq->arg_opts - (iseq->arg_opts > 0)
+ iseq->argc + iseq->arg_post_len + iseq->arg_opts -
+ (iseq->arg_opts > 0) + (iseq->arg_keyword != -1)
: UNLIMITED_ARGUMENTS;
- return iseq->argc + iseq->arg_post_len;
+ return iseq->argc + iseq->arg_post_len + (iseq->arg_keyword_required > 0);
}
-/*
- * Returns the number of required parameters and stores the maximum
- * number of parameters in max, or UNLIMITED_ARGUMENTS if no max.
- * For non-lambda procs, the maximum is the number of non-ignored
- * parameters even though there is no actual limit to the number of parameters
- */
static int
-rb_proc_min_max_arity(VALUE self, int *max)
+rb_block_min_max_arity(rb_block_t *block, int *max)
{
- rb_proc_t *proc;
- rb_iseq_t *iseq;
- GetProcPtr(self, proc);
- iseq = proc->block.iseq;
+ rb_iseq_t *iseq = block->iseq;
if (iseq) {
if (BUILTIN_TYPE(iseq) != T_NODE) {
return rb_iseq_min_max_arity(iseq, max);
@@ -698,6 +901,22 @@ rb_proc_min_max_arity(VALUE self, int *max)
return 0;
}
+/*
+ * Returns the number of required parameters and stores the maximum
+ * number of parameters in max, or UNLIMITED_ARGUMENTS if no max.
+ * For non-lambda procs, the maximum is the number of non-ignored
+ * parameters even though there is no actual limit to the number of parameters
+ */
+static int
+rb_proc_min_max_arity(VALUE self, int *max)
+{
+ rb_proc_t *proc;
+ rb_block_t *block;
+ GetProcPtr(self, proc);
+ block = &proc->block;
+ return rb_block_min_max_arity(block, max);
+}
+
int
rb_proc_arity(VALUE self)
{
@@ -707,6 +926,27 @@ rb_proc_arity(VALUE self)
return (proc->is_lambda ? min == max : max != UNLIMITED_ARGUMENTS) ? min : -min-1;
}
+int
+rb_block_arity(void)
+{
+ int min, max;
+ rb_thread_t *th = GET_THREAD();
+ rb_control_frame_t *cfp = th->cfp;
+ rb_block_t *block = rb_vm_control_frame_block_ptr(cfp);
+ VALUE proc_value;
+
+ if (!block) rb_raise(rb_eArgError, "no block given");
+ min = rb_block_min_max_arity(block, &max);
+ proc_value = block->proc;
+ if (proc_value) {
+ 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;
+}
+
#define get_proc_iseq rb_proc_get_iseq
rb_iseq_t *
@@ -738,7 +978,7 @@ iseq_location(rb_iseq_t *iseq)
if (!iseq) return Qnil;
loc[0] = iseq->location.path;
if (iseq->line_info_table) {
- loc[1] = INT2FIX(rb_iseq_first_lineno(iseq));
+ loc[1] = rb_iseq_first_lineno(iseq->self);
}
else {
loc[1] = Qnil;
@@ -815,6 +1055,8 @@ rb_hash_proc(st_index_t hash, VALUE prc)
* prc.hash -> integer
*
* Returns a hash value corresponding to proc body.
+ *
+ * See also Object#hash.
*/
static VALUE
@@ -852,11 +1094,10 @@ proc_to_s(VALUE self)
int first_lineno = 0;
if (iseq->line_info_table) {
- first_lineno = rb_iseq_first_lineno(iseq);
+ first_lineno = FIX2INT(rb_iseq_first_lineno(iseq->self));
}
- str = rb_sprintf("#<%s:%p@%s:%d%s>", cname, (void *)self,
- RSTRING_PTR(iseq->location.path),
- first_lineno, is_lambda);
+ str = rb_sprintf("#<%s:%p@%"PRIsVALUE":%d%s>", cname, (void *)self,
+ iseq->location.path, first_lineno, is_lambda);
}
else {
str = rb_sprintf("#<%s:%p%s>", cname, (void *)proc->block.iseq,
@@ -871,7 +1112,7 @@ proc_to_s(VALUE self)
/*
* call-seq:
- * prc.to_proc -> prc
+ * prc.to_proc -> proc
*
* Part of the protocol for converting objects to <code>Proc</code>
* objects. Instances of class <code>Proc</code> simply return
@@ -919,6 +1160,7 @@ static const rb_data_type_t method_data_type = {
bm_free,
bm_memsize,
},
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
VALUE
@@ -933,61 +1175,44 @@ rb_obj_is_method(VALUE m)
}
static VALUE
-mnew(VALUE klass, VALUE obj, ID id, VALUE mclass, int scope)
+mnew_internal(rb_method_entry_t *me, VALUE defined_class, VALUE klass,
+ VALUE obj, ID id, VALUE mclass, int scope, int error)
{
VALUE method;
- VALUE rclass = klass, defined_class;
+ VALUE rclass = klass;
ID rid = id;
struct METHOD *data;
- rb_method_entry_t *me, meb;
rb_method_definition_t *def = 0;
rb_method_flag_t flag = NOEX_UNDEF;
again:
- me = rb_method_entry_without_refinements(klass, id, &defined_class);
if (UNDEFINED_METHOD_ENTRY_P(me)) {
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))) {
- def = ALLOC(rb_method_definition_t);
- def->type = VM_METHOD_TYPE_MISSING;
- def->original_id = id;
- def->alias_count = 0;
-
- meb.flag = 0;
- meb.mark = 0;
- meb.called_id = id;
- meb.klass = klass;
- meb.def = def;
- me = &meb;
- def = 0;
+ me = 0;
+ defined_class = klass;
goto gen_method;
}
}
+ if (!error) return Qnil;
rb_print_undef(klass, id, 0);
}
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 `%s' is %s",
- rb_id2name(id),
- (RB_TYPE_P(klass, T_MODULE)) ? "module" : "class",
- rb_class2name(klass),
- v);
+ if (!error) return Qnil;
+ rb_print_inaccessible(klass, id, flag & NOEX_MASK);
}
}
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;
}
@@ -998,10 +1223,6 @@ mnew(VALUE klass, VALUE obj, ID id, VALUE mclass, int scope)
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);
@@ -1010,15 +1231,49 @@ mnew(VALUE klass, VALUE obj, ID id, VALUE mclass, int scope)
data->defined_class = defined_class;
data->id = rid;
data->me = ALLOC(rb_method_entry_t);
- *data->me = *me;
- data->me->def->alias_count++;
+ 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(rb_method_entry_t *me, VALUE defined_class, VALUE klass,
+ VALUE obj, ID id, VALUE mclass, int scope)
+{
+ return mnew_internal(me, defined_class, klass, obj, id, mclass, scope, TRUE);
+}
+
+static VALUE
+mnew(VALUE klass, VALUE obj, ID id, VALUE mclass, int 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);
+}
+
/**********************************************************************
*
@@ -1046,6 +1301,7 @@ mnew(VALUE klass, VALUE obj, ID id, VALUE mclass, int scope)
/*
* call-seq:
+ * meth.eql?(other_meth) -> true or false
* meth == other_meth -> true or false
*
* Two method objects are equal if they are bound to the same
@@ -1081,6 +1337,8 @@ method_eq(VALUE method, VALUE other)
* meth.hash -> integer
*
* Returns a hash value corresponding to the method object.
+ *
+ * See also Object#hash.
*/
static VALUE
@@ -1163,6 +1421,22 @@ method_name(VALUE obj)
/*
* call-seq:
+ * meth.original_name -> symbol
+ *
+ * Returns the original name of the method.
+ */
+
+static VALUE
+method_original_name(VALUE obj)
+{
+ struct METHOD *data;
+
+ TypedData_Get_Struct(obj, struct METHOD, &method_data_type, data);
+ return ID2SYM(data->me->def->original_id);
+}
+
+/*
+ * call-seq:
* meth.owner -> class_or_module
*
* Returns the class or module that defines the method.
@@ -1172,9 +1446,16 @@ static VALUE
method_owner(VALUE obj)
{
struct METHOD *data;
+ VALUE defined_class;
TypedData_Get_Struct(obj, struct METHOD, &method_data_type, data);
- return data->me->klass;
+ defined_class = data->defined_class;
+
+ if (RB_TYPE_P(defined_class, T_ICLASS)) {
+ defined_class = RBASIC_CLASS(defined_class);
+ }
+
+ return defined_class;
}
void
@@ -1257,6 +1538,48 @@ rb_obj_public_method(VALUE obj, VALUE vid)
/*
* call-seq:
+ * obj.singleton_method(sym) -> method
+ *
+ * Similar to _method_, searches singleton method only.
+ *
+ * class Demo
+ * def initialize(n)
+ * @iv = n
+ * end
+ * def hello()
+ * "Hello, @iv = #{@iv}"
+ * end
+ * end
+ *
+ * k = Demo.new(99)
+ * def k.hi
+ * "Hi, @iv = #{@iv}"
+ * end
+ * m = k.singleton_method(:hi)
+ * m.call #=> "Hi, @iv = 99"
+ * m = k.singleton_method(:hello) #=> NameError
+ */
+
+VALUE
+rb_obj_singleton_method(VALUE obj, VALUE vid)
+{
+ rb_method_entry_t *me;
+ VALUE klass;
+ ID id = rb_check_id(&vid);
+ if (!id) {
+ rb_name_error_str(vid, "undefined singleton method `%"PRIsVALUE"' for `%"PRIsVALUE"'",
+ QUOTE(vid), obj);
+ }
+ if (NIL_P(klass = rb_singleton_class_get(obj)) ||
+ !(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, klass, obj, id, rb_cMethod, FALSE);
+}
+
+/*
+ * call-seq:
* mod.instance_method(symbol) -> unbound_method
*
* Returns an +UnboundMethod+ representing the given
@@ -1315,8 +1638,8 @@ rb_mod_public_instance_method(VALUE mod, VALUE vid)
/*
* call-seq:
- * define_method(symbol, method) -> new_method
- * define_method(symbol) { block } -> proc
+ * define_method(symbol, method) -> symbol
+ * define_method(symbol) { block } -> symbol
*
* Defines an instance method in the receiver. The _method_
* parameter can be a +Proc+, a +Method+ or an +UnboundMethod+ object.
@@ -1356,6 +1679,11 @@ rb_mod_define_method(int argc, VALUE *argv, VALUE mod)
ID id;
VALUE body;
int noex = NOEX_PUBLIC;
+ const NODE *cref = rb_vm_cref_in_context(mod, mod);
+
+ if (cref) {
+ noex = (int)cref->nd_visi;
+ }
if (argc == 1) {
id = rb_to_id(argv[0]);
@@ -1383,11 +1711,14 @@ rb_mod_define_method(int argc, VALUE *argv, VALUE mod)
}
else {
rb_raise(rb_eTypeError,
- "bind argument must be a subclass of %s",
- rb_class2name(rclass));
+ "bind argument must be a subclass of % "PRIsVALUE,
+ rb_class_name(rclass));
}
}
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);
+ }
}
else if (rb_obj_is_proc(body)) {
rb_proc_t *proc;
@@ -1395,19 +1726,22 @@ rb_mod_define_method(int argc, VALUE *argv, VALUE mod)
GetProcPtr(body, proc);
if (BUILTIN_TYPE(proc->block.iseq) != T_NODE) {
proc->block.iseq->defined_method_id = id;
- proc->block.iseq->klass = mod;
+ RB_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, 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 body;
+ return ID2SYM(id);
}
/*
@@ -1457,7 +1791,6 @@ top_define_method(int argc, VALUE *argv, VALUE obj)
rb_thread_t *th = GET_THREAD();
VALUE klass;
- rb_secure(4);
klass = th->top_wrapper;
if (klass) {
rb_warning("main.define_method in the wrapped load is effective only in wrapper module");
@@ -1517,14 +1850,14 @@ method_clone(VALUE self)
*/
VALUE
-rb_method_call(int argc, VALUE *argv, VALUE method)
+rb_method_call(int argc, const VALUE *argv, VALUE method)
{
VALUE proc = rb_block_given_p() ? rb_block_proc() : Qnil;
return rb_method_call_with_block(argc, argv, method, proc);
}
VALUE
-rb_method_call_with_block(int argc, VALUE *argv, VALUE method, VALUE pass_procval)
+rb_method_call_with_block(int argc, const VALUE *argv, VALUE method, VALUE pass_procval)
{
VALUE result = Qnil; /* OK */
struct METHOD *data;
@@ -1546,6 +1879,7 @@ rb_method_call_with_block(int argc, VALUE *argv, VALUE method, VALUE pass_procva
if ((state = EXEC_TAG()) == 0) {
rb_thread_t *th = GET_THREAD();
rb_block_t *block = 0;
+ VALUE defined_class;
if (!NIL_P(pass_procval)) {
rb_proc_t *pass_proc;
@@ -1554,7 +1888,10 @@ rb_method_call_with_block(int argc, VALUE *argv, VALUE method, VALUE pass_procva
}
th->passed_block = block;
- result = rb_vm_call(th, data->recv, data->id, argc, argv, data->me, data->defined_class);
+ VAR_INITIALIZED(data);
+ defined_class = data->defined_class;
+ if (BUILTIN_TYPE(defined_class) == T_MODULE) defined_class = data->rclass;
+ result = rb_vm_call(th, data->recv, data->id, argc, argv, data->me, defined_class);
}
POP_TAG();
if (safe >= 0)
@@ -1659,18 +1996,21 @@ static VALUE
umethod_bind(VALUE method, VALUE recv)
{
struct METHOD *data, *bound;
+ VALUE methclass;
+ VALUE rclass;
TypedData_Get_Struct(method, struct METHOD, &method_data_type, data);
- if (!RB_TYPE_P(data->rclass, T_MODULE) &&
- data->rclass != CLASS_OF(recv) && !rb_obj_is_kind_of(recv, data->rclass)) {
- if (FL_TEST(data->rclass, FL_SINGLETON)) {
+ 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)) {
rb_raise(rb_eTypeError,
"singleton method called for a different object");
}
else {
- rb_raise(rb_eTypeError, "bind argument must be an instance of %s",
- rb_class2name(data->rclass));
+ rb_raise(rb_eTypeError, "bind argument must be an instance of % "PRIsVALUE,
+ rb_class_name(methclass));
}
}
@@ -1679,8 +2019,18 @@ umethod_bind(VALUE method, VALUE recv)
bound->me = ALLOC(rb_method_entry_t);
*bound->me = *data->me;
if (bound->me->def) bound->me->def->alias_count++;
+ rclass = CLASS_OF(recv);
+ if (BUILTIN_TYPE(bound->defined_class) == T_MODULE) {
+ VALUE ic = rb_class_search_ancestor(rclass, bound->defined_class);
+ if (ic) {
+ rclass = ic;
+ }
+ else {
+ rclass = rb_include_class_new(methclass, rclass);
+ }
+ }
bound->recv = recv;
- bound->rclass = CLASS_OF(recv);
+ bound->rclass = rclass;
data->ume = ALLOC(struct unlinked_method_entry_list_entry);
return method;
@@ -1730,6 +2080,7 @@ rb_method_entry_min_max_arity(const rb_method_entry_t *me, int *max)
default:
break;
}
+ break;
}
case VM_METHOD_TYPE_REFINED:
*max = UNLIMITED_ARGUMENTS;
@@ -1941,6 +2292,7 @@ method_inspect(VALUE method)
VALUE str;
const char *s;
const char *sharp = "#";
+ VALUE mklass;
TypedData_Get_Struct(method, struct METHOD, &method_data_type, data);
str = rb_str_buf_new2("#<");
@@ -1948,11 +2300,12 @@ method_inspect(VALUE method)
rb_str_buf_cat2(str, s);
rb_str_buf_cat2(str, ": ");
- if (FL_TEST(data->me->klass, FL_SINGLETON)) {
- VALUE v = rb_ivar_get(data->me->klass, attached);
+ mklass = data->me->klass;
+ if (FL_TEST(mklass, FL_SINGLETON)) {
+ VALUE v = rb_ivar_get(mklass, attached);
if (data->recv == Qundef) {
- rb_str_buf_append(str, rb_inspect(data->me->klass));
+ rb_str_buf_append(str, rb_inspect(mklass));
}
else if (data->recv == v) {
rb_str_buf_append(str, rb_inspect(v));
@@ -1967,15 +2320,19 @@ method_inspect(VALUE method)
}
}
else {
- rb_str_buf_cat2(str, rb_class2name(data->rclass));
- if (data->rclass != data->me->klass) {
+ rb_str_buf_append(str, rb_class_name(data->rclass));
+ if (data->rclass != mklass) {
rb_str_buf_cat2(str, "(");
- rb_str_buf_cat2(str, rb_class2name(data->me->klass));
+ rb_str_buf_append(str, rb_class_name(mklass));
rb_str_buf_cat2(str, ")");
}
}
rb_str_buf_cat2(str, sharp);
- rb_str_append(str, rb_id2str(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));
+ }
if (data->me->def->type == VM_METHOD_TYPE_NOTIMPLEMENTED) {
rb_str_buf_cat2(str, " (not-implemented)");
}
@@ -2025,7 +2382,7 @@ rb_proc_new(
/*
* call-seq:
- * meth.to_proc -> prc
+ * meth.to_proc -> proc
*
* Returns a <code>Proc</code> object corresponding to this method.
*/
@@ -2051,7 +2408,29 @@ method_proc(VALUE method)
}
/*
- * call_seq:
+ * Returns a Method of superclass, which would be called when super is used.
+ */
+static VALUE
+method_super_method(VALUE method)
+{
+ struct METHOD *data;
+ VALUE defined_class, super_class;
+ rb_method_entry_t *me;
+
+ TypedData_Get_Struct(method, struct METHOD, &method_data_type, data);
+ defined_class = data->defined_class;
+ if (BUILTIN_TYPE(defined_class) == T_MODULE) defined_class = data->rclass;
+ super_class = RCLASS_SUPER(defined_class);
+ if (!super_class) return Qnil;
+ me = rb_method_entry_without_refinements(super_class, data->id, &defined_class);
+ if (!me) return Qnil;
+ return mnew_internal(me, defined_class,
+ super_class, data->recv, data->id,
+ rb_obj_class(method), FALSE, FALSE);
+}
+
+/*
+ * call-seq:
* local_jump_error.exit_value -> obj
*
* Returns the exit value associated with this +LocalJumpError+.
@@ -2110,7 +2489,7 @@ proc_binding(VALUE self)
bind->env = proc->envval;
if (RUBY_VM_NORMAL_ISEQ_P(proc->block.iseq)) {
bind->path = proc->block.iseq->location.path;
- bind->first_lineno = rb_iseq_first_lineno(proc->block.iseq);
+ bind->first_lineno = FIX2INT(rb_iseq_first_lineno(proc->block.iseq->self));
}
else {
bind->path = Qnil;
@@ -2142,9 +2521,9 @@ static VALUE
curry(VALUE dummy, VALUE args, int argc, VALUE *argv, VALUE passed_proc)
{
VALUE proc, passed, arity;
- proc = RARRAY_PTR(args)[0];
- passed = RARRAY_PTR(args)[1];
- arity = RARRAY_PTR(args)[2];
+ proc = RARRAY_AREF(args, 0);
+ passed = RARRAY_AREF(args, 1);
+ arity = RARRAY_AREF(args, 2);
passed = rb_ary_plus(passed, rb_ary_new4(argc, argv));
rb_ary_freeze(passed);
@@ -2157,8 +2536,7 @@ curry(VALUE dummy, VALUE args, int argc, VALUE *argv, VALUE passed_proc)
return arity;
}
else {
- return rb_proc_call_with_block(proc, check_argc(RARRAY_LEN(passed)),
- RARRAY_PTR(passed), passed_proc);
+ return rb_proc_call_with_block(proc, check_argc(RARRAY_LEN(passed)), RARRAY_CONST_PTR(passed), passed_proc);
}
}
@@ -2205,7 +2583,7 @@ curry(VALUE dummy, VALUE args, int argc, VALUE *argv, VALUE passed_proc)
* p b.curry[] #=> :foo
*/
static VALUE
-proc_curry(int argc, VALUE *argv, VALUE self)
+proc_curry(int argc, const VALUE *argv, VALUE self)
{
int sarity, max_arity, min_arity = rb_proc_min_max_arity(self, &max_arity);
VALUE arity;
@@ -2225,6 +2603,45 @@ proc_curry(int argc, 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_proc(self);
+ return proc_curry(argc, argv, proc);
+}
+
+/*
* Document-class: LocalJumpError
*
* Raised when Ruby can't yield as requested.
@@ -2327,9 +2744,7 @@ Init_Proc(void)
rb_define_method(rb_eLocalJumpError, "reason", localjump_reason, 0);
rb_eSysStackError = rb_define_class("SystemStackError", rb_eException);
- sysstack_error = rb_exc_new3(rb_eSysStackError,
- rb_obj_freeze(rb_str_new2("stack level too deep")));
- OBJ_TAINT(sysstack_error);
+ rb_vm_register_special_exception(ruby_error_sysstack, rb_eSysStackError, "stack level too deep");
/* utility functions */
rb_define_global_function("proc", rb_block_proc, 0);
@@ -2344,6 +2759,7 @@ 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);
@@ -2351,12 +2767,15 @@ Init_Proc(void)
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);
rb_define_method(rb_cMethod, "owner", method_owner, 0);
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);
/* UnboundMethod */
rb_cUnboundMethod = rb_define_class("UnboundMethod", rb_cObject);
@@ -2370,10 +2789,12 @@ Init_Proc(void)
rb_define_method(rb_cUnboundMethod, "inspect", method_inspect, 0);
rb_define_method(rb_cUnboundMethod, "to_s", method_inspect, 0);
rb_define_method(rb_cUnboundMethod, "name", method_name, 0);
+ rb_define_method(rb_cUnboundMethod, "original_name", method_original_name, 0);
rb_define_method(rb_cUnboundMethod, "owner", method_owner, 0);
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);
@@ -2431,7 +2852,11 @@ 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);
- attached = rb_intern("__attached__");
}
diff --git a/process.c b/process.c
index 0f758e831c..1ea637a412 100644
--- a/process.c
+++ b/process.c
@@ -50,6 +50,9 @@
#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
@@ -68,7 +71,9 @@
# include "nacl/unistd.h"
#endif
-
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
#ifdef HAVE_SYS_TIMES_H
#include <sys/times.h>
#endif
@@ -79,8 +84,19 @@
#ifdef HAVE_GRP_H
#include <grp.h>
#endif
+#ifdef HAVE_SYS_ID_H
+#include <sys/id.h>
+#endif
+
+#ifdef __APPLE__
+# include <mach/mach_time.h>
+#endif
-#define numberof(array) (int)(sizeof(array)/sizeof((array)[0]))
+/* define system APIs */
+#ifdef _WIN32
+#undef open
+#define open rb_w32_uopen
+#endif
#if defined(HAVE_TIMES) || defined(_WIN32)
static VALUE rb_cProcessTms;
@@ -147,20 +163,38 @@ 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 \
- 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);
+ VALUE getpw_buf = 0
+# define FINISH_GETPWNAM \
+ ALLOCV_END(getpw_buf)
+# 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;
+}
# 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
@@ -171,20 +205,39 @@ 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 \
- 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);
+ VALUE getgr_buf = 0
+# define FINISH_GETGRNAM \
+ ALLOCV_END(getgr_buf)
+# 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);
# 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
@@ -192,6 +245,14 @@ static rb_gid_t obj2gid(VALUE id);
# endif
#endif
+#if SIZEOF_CLOCK_T == SIZEOF_INT
+typedef unsigned int unsigned_clock_t;
+#elif SIZEOF_CLOCK_T == SIZEOF_LONG
+typedef unsigned long unsigned_clock_t;
+#elif defined(HAVE_LONG_LONG) && SIZEOF_CLOCK_T == SIZEOF_LONG_LONG
+typedef unsigned LONG_LONG unsigned_clock_t;
+#endif
+
/*
* call-seq:
* Process.pid -> fixnum
@@ -679,8 +740,8 @@ waitall_each(rb_pid_t pid, int status, VALUE ary)
#else
struct waitpid_arg {
rb_pid_t pid;
- int *st;
int flags;
+ int *st;
};
#endif
@@ -946,6 +1007,8 @@ proc_waitall(void)
return result;
}
+static VALUE rb_cWaiter;
+
static inline ID
id_pid(void)
{
@@ -977,7 +1040,7 @@ 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));
- rb_define_singleton_method(watcher, "pid", detach_process_pid, 0);
+ RBASIC_SET_CLASS(watcher, rb_cWaiter);
return watcher;
}
@@ -1036,8 +1099,6 @@ proc_detach(VALUE obj, VALUE pid)
return rb_detach_process(NUM2PIDT(pid));
}
-static int forked_child = 0;
-
#ifdef SIGPIPE
static RETSIGTYPE (*saved_sigpipe_handler)(int) = 0;
#endif
@@ -1065,22 +1126,20 @@ before_exec_async_signal_safe(void)
}
static void
-before_exec_non_async_signal_safe(void)
+before_exec_non_async_signal_safe()
{
- if (!forked_child) {
- /*
- * On Mac OS X 10.5.x (Leopard) or earlier, exec() may return ENOTSUPP
- * 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);
- }
+ /*
+ * 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
-before_exec(void)
+before_exec()
{
before_exec_non_async_signal_safe();
before_exec_async_signal_safe();
@@ -1100,8 +1159,6 @@ after_exec_non_async_signal_safe(void)
{
rb_thread_reset_timer_thread();
rb_thread_start_timer_thread();
-
- forked_child = 0;
}
static void
@@ -1111,8 +1168,8 @@ after_exec(void)
after_exec_non_async_signal_safe();
}
-#define before_fork() before_exec()
-#define after_fork() (rb_threadptr_pending_interrupt_clear(GET_THREAD()), after_exec())
+#define before_fork_ruby() before_exec()
+#define after_fork_ruby() (rb_threadptr_pending_interrupt_clear(GET_THREAD()), after_exec())
#include "dln.h"
@@ -1126,7 +1183,7 @@ security(const char *str)
}
}
-#if defined(HAVE_FORK) && !defined(__native_client__)
+#if defined(HAVE_WORKING_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)
@@ -1210,54 +1267,6 @@ proc_exec_cmd(const char *prog, VALUE argv_str, VALUE envp_str)
#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)
@@ -1278,7 +1287,7 @@ proc_exec_sh(const char *str, VALUE envp_str)
}
#ifdef _WIN32
- rb_w32_spawn(P_OVERLAY, (char *)str, 0);
+ rb_w32_uspawn(P_OVERLAY, (char *)str, 0);
return -1;
#else
#if defined(__CYGWIN32__) || defined(__EMX__)
@@ -1339,28 +1348,37 @@ 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 ptr ? sizeof(struct rb_execarg) : 0;
+ return sizeof(struct rb_execarg);
}
static const rb_data_type_t exec_arg_data_type = {
- "exec_arg",
- {mark_exec_arg, free_exec_arg, memsize_exec_arg},
+ "exec_arg",
+ {mark_exec_arg, RUBY_TYPED_DEFAULT_FREE, memsize_exec_arg},
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
-#if defined(_WIN32)
-#define HAVE_SPAWNV 1
+#ifdef _WIN32
+# define DEFAULT_PROCESS_ENCODING rb_utf8_encoding()
+#endif
+#ifdef DEFAULT_PROCESS_ENCODING
+# define EXPORT_STR(str) rb_str_export_to_enc((str), DEFAULT_PROCESS_ENCODING)
+# define EXPORT_DUP(str) export_dup(str)
+static VALUE
+export_dup(VALUE str)
+{
+ VALUE newstr = EXPORT_STR(str);
+ if (newstr == str) newstr = rb_str_dup(str);
+ return newstr;
+}
+#else
+# define EXPORT_STR(str) (str)
+# define EXPORT_DUP(str) rb_str_dup(str)
#endif
-#if !defined(HAVE_FORK) && defined(HAVE_SPAWNV)
+#if !defined(HAVE_WORKING_FORK) && defined(HAVE_SPAWNV)
# define USE_SPAWNV 1
#else
# define USE_SPAWNV 0
@@ -1371,7 +1389,7 @@ static const rb_data_type_t exec_arg_data_type = {
#if USE_SPAWNV
#if defined(_WIN32)
-#define proc_spawn_cmd_internal(argv, prog) rb_w32_aspawn(P_NOWAIT, (prog), (argv))
+#define proc_spawn_cmd_internal(argv, prog) rb_w32_uaspawn(P_NOWAIT, (prog), (argv))
#else
static rb_pid_t
proc_spawn_cmd_internal(char **argv, char *prog)
@@ -1395,7 +1413,6 @@ proc_spawn_cmd_internal(char **argv, char *prog)
after_exec();
if (status == -1) errno = ENOEXEC;
}
- rb_last_status_set(status == -1 ? 127 : status, 0);
return status;
}
#endif
@@ -1411,7 +1428,7 @@ proc_spawn_cmd(char **argv, VALUE prog, struct rb_execarg *eargp)
if (eargp->new_pgroup_given && eargp->new_pgroup_flag) {
flags = CREATE_NEW_PROCESS_GROUP;
}
- pid = rb_w32_aspawn_flags(P_NOWAIT, prog ? RSTRING_PTR(prog) : 0, argv, flags);
+ pid = rb_w32_uaspawn_flags(P_NOWAIT, prog ? RSTRING_PTR(prog) : 0, argv, flags);
#else
pid = proc_spawn_cmd_internal(argv, prog ? RSTRING_PTR(prog) : 0);
#endif
@@ -1420,7 +1437,7 @@ proc_spawn_cmd(char **argv, VALUE prog, struct rb_execarg *eargp)
}
#if defined(_WIN32)
-#define proc_spawn_sh(str) rb_w32_spawn(P_NOWAIT, (str), 0)
+#define proc_spawn_sh(str) rb_w32_uspawn(P_NOWAIT, (str), 0)
#else
static rb_pid_t
proc_spawn_sh(char *str)
@@ -1431,7 +1448,6 @@ proc_spawn_sh(char *str)
char *shell = dln_find_exe_r("sh", 0, fbuf, sizeof(fbuf));
before_exec();
status = spawnl(P_NOWAIT, (shell ? shell : "/bin/sh"), "sh", "-c", str, (char*)NULL);
- rb_last_status_set(status == -1 ? 127 : status, 0);
after_exec();
return status;
}
@@ -1441,7 +1457,7 @@ proc_spawn_sh(char *str)
static VALUE
hide_obj(VALUE obj)
{
- RBASIC(obj)->klass = 0;
+ RBASIC_CLEAR_CLASS(obj);
return obj;
}
@@ -1472,10 +1488,10 @@ check_exec_redirect_fd(VALUE v, int iskey)
fd = fptr->fd;
}
else {
+ wrong:
rb_raise(rb_eArgError, "wrong exec redirect");
}
if (fd < 0) {
- wrong:
rb_raise(rb_eArgError, "negative file descriptor");
}
#ifdef _WIN32
@@ -1499,7 +1515,7 @@ check_exec_redirect1(VALUE ary, VALUE key, VALUE param)
else {
int i, n=0;
for (i = 0 ; i < RARRAY_LEN(key); i++) {
- VALUE v = RARRAY_PTR(key)[i];
+ VALUE v = RARRAY_AREF(key, i);
VALUE fd = check_exec_redirect_fd(v, !NIL_P(param));
rb_ary_push(ary, hide_obj(rb_assoc_new(fd, param)));
n++;
@@ -1568,7 +1584,7 @@ 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(3, hide_obj(rb_str_dup(path)),
+ 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);
}
@@ -1581,10 +1597,22 @@ 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
+ 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
flags = INT2NUM(O_RDONLY);
perm = INT2FIX(0644);
- param = hide_obj(rb_ary_new3(3, hide_obj(rb_str_dup(path)),
+ 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;
@@ -1619,7 +1647,7 @@ rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val)
id = SYM2ID(key);
#ifdef HAVE_SETPGID
if (id == rb_intern("pgroup")) {
- pid_t pgroup;
+ rb_pid_t pgroup;
if (eargp->pgroup_given) {
rb_raise(rb_eArgError, "pgroup option specified twice");
}
@@ -1690,7 +1718,7 @@ rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val)
}
FilePathValue(val);
eargp->chdir_given = 1;
- eargp->chdir_dir = hide_obj(rb_str_dup(val));
+ eargp->chdir_dir = hide_obj(EXPORT_DUP(val));
}
else if (id == rb_intern("umask")) {
mode_t cmask = NUM2MODET(val);
@@ -1726,7 +1754,6 @@ rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val)
}
check_uid_switch();
{
- PREPARE_GETPWNAM;
eargp->uid = OBJ2UID(val);
eargp->uid_given = 1;
}
@@ -1742,7 +1769,6 @@ rb_execarg_addopt(VALUE execarg_obj, VALUE key, VALUE val)
}
check_gid_switch();
{
- PREPARE_GETGRNAM;
eargp->gid = OBJ2GID(val);
eargp->gid_given = 1;
}
@@ -1771,12 +1797,6 @@ 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)
{
@@ -1814,21 +1834,21 @@ check_exec_fds_1(struct rb_execarg *eargp, VALUE h, int maxhint, VALUE ary)
if (ary != Qfalse) {
for (i = 0; i < RARRAY_LEN(ary); i++) {
- VALUE elt = RARRAY_PTR(ary)[i];
- int fd = FIX2INT(RARRAY_PTR(elt)[0]);
+ VALUE elt = RARRAY_AREF(ary, i);
+ int fd = FIX2INT(RARRAY_AREF(elt, 0));
if (RTEST(rb_hash_lookup(h, INT2FIX(fd)))) {
rb_raise(rb_eArgError, "fd %d specified twice", fd);
}
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_PTR(elt)[1]);
+ rb_hash_aset(h, INT2FIX(fd), RARRAY_AREF(elt, 1));
else /* ary == eargp->fd_close */
rb_hash_aset(h, INT2FIX(fd), INT2FIX(-1));
if (maxhint < fd)
maxhint = fd;
if (ary == eargp->fd_dup2 || ary == eargp->fd_dup2_child) {
- fd = FIX2INT(RARRAY_PTR(elt)[1]);
+ fd = FIX2INT(RARRAY_AREF(elt, 1));
if (maxhint < fd)
maxhint = fd;
}
@@ -1853,9 +1873,9 @@ check_exec_fds(struct rb_execarg *eargp)
if (eargp->fd_dup2_child) {
ary = eargp->fd_dup2_child;
for (i = 0; i < RARRAY_LEN(ary); i++) {
- VALUE elt = RARRAY_PTR(ary)[i];
- int newfd = FIX2INT(RARRAY_PTR(elt)[0]);
- int oldfd = FIX2INT(RARRAY_PTR(elt)[1]);
+ VALUE elt = RARRAY_AREF(ary, i);
+ int newfd = FIX2INT(RARRAY_AREF(elt, 0));
+ int oldfd = FIX2INT(RARRAY_AREF(elt, 1));
int lastfd = oldfd;
VALUE val = rb_hash_lookup(h, INT2FIX(lastfd));
long depth = 0;
@@ -1890,7 +1910,7 @@ rb_check_exec_options(VALUE opthash, VALUE execarg_obj)
{
if (RHASH_EMPTY_P(opthash))
return;
- st_foreach(RHASH_TBL(opthash), check_exec_options_i, (st_data_t)execarg_obj);
+ st_foreach(rb_hash_tbl_raw(opthash), check_exec_options_i, (st_data_t)execarg_obj);
}
VALUE
@@ -1901,7 +1921,7 @@ rb_execarg_extract_options(VALUE execarg_obj, VALUE opthash)
return Qnil;
args[0] = execarg_obj;
args[1] = Qnil;
- st_foreach(RHASH_TBL(opthash), check_exec_options_i_extract, (st_data_t)args);
+ st_foreach(rb_hash_tbl_raw(opthash), check_exec_options_i_extract, (st_data_t)args);
return args[1];
}
@@ -1920,6 +1940,9 @@ check_exec_env_i(st_data_t st_key, st_data_t st_val, st_data_t arg)
if (!NIL_P(val))
StringValueCStr(val);
+ key = EXPORT_STR(key);
+ if (!NIL_P(val)) val = EXPORT_STR(val);
+
rb_ary_push(env, hide_obj(rb_assoc_new(key, val)));
return ST_CONTINUE;
@@ -1931,7 +1954,7 @@ rb_check_exec_env(VALUE hash)
VALUE env;
env = hide_obj(rb_ary_new());
- st_foreach(RHASH_TBL(hash), check_exec_env_i, (st_data_t)env);
+ st_foreach(rb_hash_tbl_raw(hash), check_exec_env_i, (st_data_t)env);
return env;
}
@@ -1951,8 +1974,8 @@ rb_check_argv(int argc, VALUE *argv)
if (RARRAY_LEN(tmp) != 2) {
rb_raise(rb_eArgError, "wrong first argument");
}
- prog = RARRAY_PTR(tmp)[0];
- argv[0] = RARRAY_PTR(tmp)[1];
+ prog = RARRAY_AREF(tmp, 0);
+ argv[0] = RARRAY_AREF(tmp, 1);
SafeStringValue(prog);
StringValueCStr(prog);
prog = rb_str_new_frozen(prog);
@@ -2031,6 +2054,7 @@ rb_exec_fillarg(VALUE prog, int argc, VALUE *argv, VALUE env, VALUE opthash, VAL
eargp->env_modification = env;
}
+ prog = EXPORT_STR(prog);
eargp->use_shell = argc == 0;
if (eargp->use_shell)
eargp->invoke.sh.shell_script = prog;
@@ -2124,7 +2148,7 @@ rb_exec_fillarg(VALUE prog, int argc, VALUE *argv, VALUE env, VALUE opthash, VAL
has_meta = 1;
}
if (!has_meta) {
- /* avoid shell since no shell meta charactor found. */
+ /* avoid shell since no shell meta character found. */
eargp->use_shell = 0;
}
if (!eargp->use_shell) {
@@ -2163,8 +2187,13 @@ rb_exec_fillarg(VALUE prog, int argc, VALUE *argv, VALUE env, VALUE opthash, VAL
argv_buf = rb_str_buf_new(0);
hide_obj(argv_buf);
for (i = 0; i < argc; i++) {
- rb_str_buf_cat2(argv_buf, StringValueCStr(argv[i]));
- rb_str_buf_cat(argv_buf, "", 1); /* append '\0' */
+ VALUE arg = argv[i];
+ const char *s = StringValueCStr(arg);
+#ifdef DEFAULT_PROCESS_ENCODING
+ arg = EXPORT_STR(arg);
+ s = RSTRING_PTR(arg);
+#endif
+ rb_str_buf_cat(argv_buf, s, RSTRING_LEN(arg) + 1); /* include '\0' */
}
eargp->invoke.cmd.argv_buf = argv_buf;
}
@@ -2187,7 +2216,7 @@ rb_exec_fillarg(VALUE prog, int argc, VALUE *argv, VALUE env, VALUE opthash, VAL
}
VALUE
-rb_execarg_new(int argc, VALUE *argv, int accept_shell)
+rb_execarg_new(int argc, const VALUE *argv, int accept_shell)
{
VALUE execarg_obj;
struct rb_execarg *eargp;
@@ -2197,8 +2226,8 @@ rb_execarg_new(int argc, VALUE *argv, int accept_shell)
return execarg_obj;
}
-struct rb_execarg
-*rb_execarg_get(VALUE execarg_obj)
+struct rb_execarg *
+rb_execarg_get(VALUE execarg_obj)
{
struct rb_execarg *eargp;
TypedData_Get_Struct(execarg_obj, struct rb_execarg, &exec_arg_data_type, eargp);
@@ -2206,24 +2235,22 @@ struct rb_execarg
}
VALUE
-rb_execarg_init(int argc, VALUE *argv, int accept_shell, VALUE execarg_obj)
+rb_execarg_init(int argc, const VALUE *orig_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)
{
@@ -2282,24 +2309,26 @@ rb_execarg_fixup(VALUE execarg_obj)
}
hide_obj(envtbl);
if (envopts != Qfalse) {
- st_table *stenv = RHASH_TBL(envtbl);
+ st_table *stenv = RHASH_TBL_RAW(envtbl);
long i;
for (i = 0; i < RARRAY_LEN(envopts); i++) {
- VALUE pair = RARRAY_PTR(envopts)[i];
- VALUE key = RARRAY_PTR(pair)[0];
- VALUE val = RARRAY_PTR(pair)[1];
+ 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);
+ st_insert(stenv, (st_data_t)key, (st_data_t)val);
+ RB_OBJ_WRITTEN(envtbl, Qundef, key);
+ RB_OBJ_WRITTEN(envtbl, Qundef, val);
}
}
}
envp_buf = rb_str_buf_new(0);
hide_obj(envp_buf);
- st_foreach(RHASH_TBL(envtbl), fill_envp_buf_i, (st_data_t)envp_buf);
+ st_foreach(RHASH_TBL_RAW(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);
@@ -2324,67 +2353,85 @@ rb_execarg_fixup(VALUE execarg_obj)
RB_GC_GUARD(execarg_obj);
}
-void
-rb_exec_arg_fixup(struct rb_exec_arg *e)
-{
- rb_execarg_fixup(e->execarg_obj);
-}
-
+#if defined(__APPLE__) || defined(__HAIKU__)
static int rb_exec_without_timer_thread(const struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen);
+#endif
/*
* call-seq:
* exec([env,] command... [,options])
*
- * Replaces the current process by running the given external _command_.
- * _command..._ is one of following forms.
+ * Replaces the current process by running the given external _command_, which
+ * can take one of the following forms:
*
- * commandline : command line string which is passed to the standard shell
- * cmdname, arg1, ... : command name and one or more arguments (no shell)
- * [cmdname, argv0], arg1, ... : command name, argv[0] and zero or more arguments (no shell)
+ * [<code>exec(commandline)</code>]
+ * command line string which is passed to the standard shell
+ * [<code>exec(cmdname, arg1, ...)</code>]
+ * command name and one or more arguments (no shell)
+ * [<code>exec([cmdname, argv0], arg1, ...)</code>]
+ * command name, argv[0] and zero or more arguments (no shell)
+ *
+ * In the first form, the string is taken as a command line that is subject to
+ * shell expansion before being executed.
+ *
+ * The standard shell always means <code>"/bin/sh"</code> on Unix-like systems,
+ * same as <code>ENV["RUBYSHELL"]</code>
+ * (or <code>ENV["COMSPEC"]</code> on Windows NT series), and similar.
+ *
+ * If the string from the first form (<code>exec("command")</code>) follows
+ * these simple rules:
*
- * If single string is given as the command,
- * it is taken as a command line that is subject to shell expansion before being executed.
+ * * no meta characters
+ * * no shell reserved word and no special built-in
+ * * Ruby invokes the command directly without shell
*
- * The standard shell means always <code>"/bin/sh"</code> on Unix-like systems,
- * <code>ENV["RUBYSHELL"]</code> or <code>ENV["COMSPEC"]</code> on Windows NT series, and
- * similar.
+ * You can force shell invocation by adding ";" to the string (because ";" is
+ * a meta character).
*
- * If two or more +string+ given,
- * the first is taken as a command name and
- * the rest are passed as parameters to command with no shell expansion.
+ * Note that this behavior is observable by pid obtained
+ * (return value of spawn() and IO#pid for IO.popen) is the pid of the invoked
+ * command, not shell.
*
- * If a two-element array at the beginning of the command,
- * the first element is the command to be executed,
- * and the second argument is used as the <code>argv[0]</code> value,
- * which may show up in process listings.
+ * In the second form (<code>exec("command1", "arg1", ...)</code>), the first
+ * is taken as a command name and the rest are passed as parameters to command
+ * with no shell expansion.
*
- * In order to execute the command, one of the <code>exec(2)</code>
- * system calls is used, so the running command may inherit some of the environment
+ * In the third form (<code>exec(["command", "argv0"], "arg1", ...)</code>),
+ * starting a two-element array at the beginning of the command, the first
+ * element is the command to be executed, and the second argument is used as
+ * the <code>argv[0]</code> value, which may show up in process listings.
+ *
+ * In order to execute the command, one of the <code>exec(2)</code> system
+ * calls are used, so the running command may inherit some of the environment
* of the original program (including open file descriptors).
- * This behavior is modified by env and options.
- * See <code>spawn</code> for details.
*
- * Raises SystemCallError if the command couldn't execute (typically
- * <code>Errno::ENOENT</code> when it was not found).
+ * This behavior is modified by the given +env+ and +options+ parameters. See
+ * ::spawn for details.
+ *
+ * If the command fails to execute (typically <code>Errno::ENOENT</code> when
+ * it was not found) a SystemCallError exception is raised.
+ *
+ * This method modifies process attributes according to given +options+ before
+ * <code>exec(2)</code> system call. See ::spawn for more details about the
+ * given +options+.
+ *
+ * The modified attributes may be retained when <code>exec(2)</code> system
+ * call fails.
+ *
+ * For example, hard resource limits are not restorable.
*
- * This method modifies process attributes according to _options_
- * (details described in <code>spawn</code>)
- * before <code>exec(2)</code> system call.
- * The modified attributes may be retained when <code>exec(2)</code> system call fails.
- * For example, hard resource limits is not restorable.
- * If it is not acceptable, consider to create a child process using <code>spawn</code> or <code>system</code>.
+ * Consider to create a child process using ::spawn or Kernel#system if this
+ * is not acceptable.
*
* exec "echo *" # echoes list of files in current directory
* # never get here
*
- *
* exec "echo", "*" # echoes an asterisk
* # never get here
*/
VALUE
-rb_f_exec(int argc, VALUE *argv)
+rb_f_exec(int argc, const VALUE *argv)
{
VALUE execarg_obj, fail_str;
struct rb_execarg *eargp;
@@ -2399,7 +2446,9 @@ rb_f_exec(int argc, VALUE *argv)
#if defined(__APPLE__) || defined(__HAIKU__)
rb_exec_without_timer_thread(eargp, errmsg, sizeof(errmsg));
#else
+ before_exec_async_signal_safe(); /* async-signal-safe */
rb_exec_async_signal_safe(eargp, errmsg, sizeof(errmsg));
+ preserving_errno(after_exec_async_signal_safe()); /* async-signal-safe */
#endif
RB_GC_GUARD(execarg_obj);
if (errmsg[0])
@@ -2444,28 +2493,16 @@ redirect_dup(int 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)
{
@@ -2485,6 +2522,8 @@ redirect_open(const char *pathname, int flags, mode_t perm)
}
#else
+#define redirect_dup(oldfd) dup(oldfd)
+#define redirect_dup2(oldfd, newfd) dup2((oldfd), (newfd))
#define redirect_close(fd) close(fd)
#define redirect_open(pathname, flags, perm) open((pathname), (flags), (perm))
#endif
@@ -2560,9 +2599,9 @@ run_exec_dup2(VALUE ary, VALUE tmpbuf, struct rb_execarg *sargp, char *errmsg, s
/* initialize oldfd and newfd: O(n) */
for (i = 0; i < n; i++) {
- VALUE elt = RARRAY_PTR(ary)[i];
- pairs[i].oldfd = FIX2INT(RARRAY_PTR(elt)[1]);
- pairs[i].newfd = FIX2INT(RARRAY_PTR(elt)[0]); /* unique */
+ 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].older_index = -1;
}
@@ -2686,8 +2725,8 @@ run_exec_close(VALUE ary, char *errmsg, size_t errmsg_buflen)
int ret;
for (i = 0; i < RARRAY_LEN(ary); i++) {
- VALUE elt = RARRAY_PTR(ary)[i];
- int fd = FIX2INT(RARRAY_PTR(elt)[0]);
+ VALUE elt = RARRAY_AREF(ary, i);
+ int fd = FIX2INT(RARRAY_AREF(elt, 0));
ret = redirect_close(fd); /* async-signal-safe */
if (ret == -1) {
ERRMSG("close");
@@ -2705,12 +2744,13 @@ run_exec_open(VALUE ary, struct rb_execarg *sargp, char *errmsg, size_t errmsg_b
int ret;
for (i = 0; i < RARRAY_LEN(ary);) {
- VALUE elt = RARRAY_PTR(ary)[i];
- int fd = FIX2INT(RARRAY_PTR(elt)[0]);
- VALUE param = RARRAY_PTR(elt)[1];
- char *path = RSTRING_PTR(RARRAY_PTR(param)[0]);
- int flags = NUM2INT(RARRAY_PTR(param)[1]);
- int perm = NUM2INT(RARRAY_PTR(param)[2]);
+ VALUE elt = RARRAY_AREF(ary, i);
+ int fd = FIX2INT(RARRAY_AREF(elt, 0));
+ VALUE param = RARRAY_AREF(elt, 1);
+ const VALUE vpath = RARRAY_AREF(param, 0);
+ const char *path = RSTRING_PTR(vpath);
+ 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) {
@@ -2719,8 +2759,8 @@ run_exec_open(VALUE ary, struct rb_execarg *sargp, char *errmsg, size_t errmsg_b
}
rb_update_max_fd(fd2);
while (i < RARRAY_LEN(ary) &&
- (elt = RARRAY_PTR(ary)[i], RARRAY_PTR(elt)[1] == param)) {
- fd = FIX2INT(RARRAY_PTR(elt)[0]);
+ (elt = RARRAY_AREF(ary, i), RARRAY_AREF(elt, 1) == param)) {
+ fd = FIX2INT(RARRAY_AREF(elt, 0));
if (fd == fd2) {
need_close = 0;
}
@@ -2755,9 +2795,9 @@ run_exec_dup2_child(VALUE ary, struct rb_execarg *sargp, char *errmsg, size_t er
int ret;
for (i = 0; i < RARRAY_LEN(ary); i++) {
- VALUE elt = RARRAY_PTR(ary)[i];
- int newfd = FIX2INT(RARRAY_PTR(elt)[0]);
- int oldfd = FIX2INT(RARRAY_PTR(elt)[1]);
+ VALUE elt = RARRAY_AREF(ary, i);
+ int newfd = FIX2INT(RARRAY_AREF(elt, 0));
+ int oldfd = FIX2INT(RARRAY_AREF(elt, 1));
if (save_redirect_fd(newfd, sargp, errmsg, errmsg_buflen) < 0) /* async-signal-safe */
return -1;
@@ -2777,13 +2817,14 @@ 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 waits the child's execve.
- * So setpgid is done in the child when rb_fork is returned in the parent.
+ * 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.
* No race condition, even without setpgid from the parent.
* (Is there an environment which has setpgid but no FD_CLOEXEC?)
*/
int ret;
- pid_t pgroup;
+ rb_pid_t pgroup;
pgroup = eargp->pgroup_pgid;
if (pgroup == -1)
@@ -2811,8 +2852,8 @@ run_exec_rlimit(VALUE ary, struct rb_execarg *sargp, char *errmsg, size_t errmsg
{
long i;
for (i = 0; i < RARRAY_LEN(ary); i++) {
- VALUE elt = RARRAY_PTR(ary)[i];
- int rtype = NUM2INT(RARRAY_PTR(elt)[0]);
+ VALUE elt = RARRAY_AREF(ary, i);
+ int rtype = NUM2INT(RARRAY_AREF(elt, 0));
struct rlimit rlim;
if (sargp) {
VALUE tmp, newary;
@@ -2820,7 +2861,7 @@ run_exec_rlimit(VALUE ary, struct rb_execarg *sargp, char *errmsg, size_t errmsg
ERRMSG("getrlimit");
return -1;
}
- tmp = hide_obj(rb_ary_new3(3, RARRAY_PTR(elt)[0],
+ tmp = hide_obj(rb_ary_new3(3, RARRAY_AREF(elt, 0),
RLIM2NUM(rlim.rlim_cur),
RLIM2NUM(rlim.rlim_max)));
if (sargp->rlimit_limits == Qfalse)
@@ -2829,8 +2870,8 @@ run_exec_rlimit(VALUE ary, struct rb_execarg *sargp, char *errmsg, size_t errmsg
newary = sargp->rlimit_limits;
rb_ary_push(newary, tmp);
}
- rlim.rlim_cur = NUM2RLIM(RARRAY_PTR(elt)[1]);
- rlim.rlim_max = NUM2RLIM(RARRAY_PTR(elt)[2]);
+ rlim.rlim_cur = NUM2RLIM(RARRAY_AREF(elt, 1));
+ rlim.rlim_max = NUM2RLIM(RARRAY_AREF(elt, 2));
if (setrlimit(rtype, &rlim) == -1) { /* hopefully async-signal-safe */
ERRMSG("setrlimit");
return -1;
@@ -2840,9 +2881,9 @@ run_exec_rlimit(VALUE ary, struct rb_execarg *sargp, char *errmsg, size_t errmsg
}
#endif
-#if !defined(HAVE_FORK)
+#if !defined(HAVE_WORKING_FORK)
static VALUE
-save_env_i(VALUE i, VALUE ary, int argc, VALUE *argv)
+save_env_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, ary))
{
rb_ary_push(ary, hide_obj(rb_ary_dup(argv[0])));
return Qnil;
@@ -2894,7 +2935,7 @@ rb_execarg_run_options(const struct rb_execarg *eargp, struct rb_execarg *sargp,
}
#endif
-#if !defined(HAVE_FORK)
+#if !defined(HAVE_WORKING_FORK)
if (eargp->unsetenv_others_given && eargp->unsetenv_others_do) {
save_env(sargp);
rb_env_clear();
@@ -2905,9 +2946,9 @@ rb_execarg_run_options(const struct rb_execarg *eargp, struct rb_execarg *sargp,
long i;
save_env(sargp);
for (i = 0; i < RARRAY_LEN(obj); i++) {
- VALUE pair = RARRAY_PTR(obj)[i];
- VALUE key = RARRAY_PTR(pair)[0];
- VALUE val = RARRAY_PTR(pair)[1];
+ VALUE pair = RARRAY_AREF(obj, i);
+ VALUE key = RARRAY_AREF(pair, 0);
+ VALUE val = RARRAY_AREF(pair, 1);
if (NIL_P(val))
ruby_setenv(StringValueCStr(key), 0);
else
@@ -2941,7 +2982,7 @@ rb_execarg_run_options(const struct rb_execarg *eargp, struct rb_execarg *sargp,
}
}
-#ifdef HAVE_FORK
+#ifdef HAVE_WORKING_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 */
}
@@ -3002,30 +3043,16 @@ 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_FORK)
+#if !defined(HAVE_WORKING_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;
}
@@ -3039,54 +3066,27 @@ 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_FORK)
+#if !defined(HAVE_WORKING_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;
}
+#if defined(__APPLE__) || defined(__HAIKU__)
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 */
+ before_exec();
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. */
+ preserving_errno(after_exec()); /* 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
+#ifdef HAVE_WORKING_FORK
/* This function should be async-signal-safe. Hopefully it is. */
static int
rb_exec_atfork(void* arg, char *errmsg, size_t errmsg_buflen)
@@ -3095,7 +3095,7 @@ rb_exec_atfork(void* arg, char *errmsg, size_t errmsg_buflen)
}
#endif
-#ifdef HAVE_FORK
+#ifdef HAVE_WORKING_FORK
#if SIZEOF_INT == SIZEOF_LONG
#define proc_syswait (VALUE (*)(VALUE))rb_syswait
#else
@@ -3149,24 +3149,48 @@ pipe_nocrash(int filedes[2], VALUE fds)
return ret;
}
-struct chfunc_protect_t {
- int (*chfunc)(void*, char *, size_t);
- void *arg;
- char *errmsg;
- size_t buflen;
-};
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
-static VALUE
-chfunc_protect(VALUE arg)
+static int
+handle_fork_error(int *status, int *ep, volatile int *try_gc_p)
{
- struct chfunc_protect_t *p = (struct chfunc_protect_t *)arg;
+ int state = 0;
- return (VALUE)(*p->chfunc)(p->arg, p->errmsg, p->buflen);
+ 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;
}
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
+#define prefork() ( \
+ rb_io_flush(rb_stdout), \
+ rb_io_flush(rb_stderr) \
+ )
/*
* Forks child process, and returns the process ID in the parent
@@ -3194,233 +3218,384 @@ chfunc_protect(VALUE arg)
* +chfunc+ must not raise any exceptions.
*/
-static rb_pid_t
-retry_fork(int *status, int *ep, int chfunc_is_async_signal_safe)
+static ssize_t
+write_retry(int fd, const void *buf, size_t len)
{
- rb_pid_t pid;
- int state = 0;
+ ssize_t w;
-#define prefork() ( \
- rb_io_flush(rb_stdout), \
- rb_io_flush(rb_stderr) \
- )
+ do {
+ w = write(fd, buf, len);
+ } while (w < 0 && errno == EINTR);
- 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 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;
- }
- /* fall through */
- default:
- if (ep) {
- preserving_errno((close(ep[0]), close(ep[1])));
- }
- if (state && !status) rb_jump_tag(state);
- return -1;
- }
- }
+ return w;
+}
+
+static ssize_t
+read_retry(int fd, void *buf, size_t len)
+{
+ ssize_t r;
+
+ do {
+ r = read(fd, buf, len);
+ } while (r < 0 && errno == EINTR);
+
+ return r;
}
static void
-send_child_error(int fd, int state, char *errmsg, size_t errmsg_buflen, int chfunc_is_async_signal_safe)
+send_child_error(int fd, char *errmsg, size_t errmsg_buflen)
{
- 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(fd, &err, sizeof(err)) < 0) err = errno;
+ if (write_retry(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(fd, errmsg, errmsg_buflen) < 0)
+ if (errmsg_buflen > 0 && write_retry(fd, errmsg, errmsg_buflen) < 0)
err = errno;
}
- if (!NIL_P(io)) rb_io_close(io);
}
static int
-recv_child_error(int fd, int *statep, VALUE *excp, int *errp, char *errmsg, size_t errmsg_buflen, int chfunc_is_async_signal_safe)
+recv_child_error(int fd, int *errp, char *errmsg, size_t errmsg_buflen)
{
- int err, state = 0;
- VALUE io = Qnil;
+ int err;
ssize_t size;
- 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) {
+ if ((size = read_retry(fd, &err, sizeof(err))) < 0) {
err = errno;
}
*errp = err;
if (size == sizeof(err) &&
errmsg && 0 < errmsg_buflen) {
- ssize_t ret = READ_FROM_CHILD(errmsg, errmsg_buflen-1);
+ ssize_t ret = read_retry(fd, errmsg, errmsg_buflen-1);
if (0 <= ret) {
errmsg[ret] = '\0';
}
}
- if (NIL_P(io))
- close(fd);
- else
- rb_io_close(io);
+ close(fd);
return size != 0;
}
-static rb_pid_t
-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)
+#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_pid_t pid;
- int err, state = 0;
- int ep[2];
- VALUE exc = Qnil;
- int error_occured;
+ rb_uid_t ret;
- if (status) *status = 0;
+ *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 (!chfunc) {
- pid = retry_fork(status, NULL, FALSE);
- if (pid < 0)
- return pid;
- if (!pid) {
- forked_child = 1;
- after_fork();
+#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;
+
+ 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) {
+ errno = ret;
+ rb_sys_fail("pthread_sigmask");
+ }
+
+#ifdef PTHREAD_CANCEL_DISABLE
+ ret = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &old->cancelstate);
+ if (ret != 0) {
+ errno = ret;
+ rb_sys_fail("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) {
+ errno = ret;
+ rb_sys_fail("pthread_setcancelstate");
+ }
+#endif
+
+ ret = pthread_sigmask(SIG_SETMASK, &old->sigmask, NULL); /* not async-signal-safe */
+ if (ret != 0) {
+ errno = ret;
+ rb_sys_fail("pthread_sigmask");
+ }
+}
+
+/* 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;
+ 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;
+ }
+
+ for (sig = 1; sig < NSIG; sig++) {
+ int reset = 0;
+#ifdef SIGPIPE
+ if (sig == SIGPIPE)
+ reset = 1;
+#endif
+ if (!reset) {
+ 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);
+ }
+ if (reset) {
+ ret = sigaction(sig, &act, NULL); /* async-signal-safe */
+ if (ret == -1) {
+ ERRMSG("sigaction to set default action");
+ return -1;
+ }
}
- 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) {
+
+ 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,
+ char *errmsg, size_t errmsg_buflen)
+{
+ rb_pid_t pid;
+ volatile int try_gc = 1;
+ struct child_handler_disabler_state old;
+
+ 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 */
int ret;
- forked_child = 1;
close(ep[0]);
- if (chfunc_is_async_signal_safe)
+ ret = disable_child_handler_fork_child(&old, errmsg, errmsg_buflen); /* async-signal-safe */
+ if (ret == 0) {
ret = chfunc(charg, errmsg, errmsg_buflen);
- 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);
+ if (!ret) _exit(EXIT_SUCCESS);
}
- if (!ret) _exit(EXIT_SUCCESS);
- send_child_error(ep[1], state, errmsg, errmsg_buflen, chfunc_is_async_signal_safe);
+ send_child_error(ep[1], errmsg, errmsg_buflen);
#if EXIT_SUCCESS == 127
_exit(EXIT_FAILURE);
#else
_exit(127);
#endif
}
- close(ep[1]);
- error_occured = recv_child_error(ep[0], &state, &exc, &err, errmsg, errmsg_buflen, chfunc_is_async_signal_safe);
- if (state || error_occured) {
- 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;
+ 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))
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)
{
- return rb_fork_internal(status, chfunc, charg, TRUE, fds, errmsg, errmsg_buflen);
-}
+ rb_pid_t pid;
+ int err, state = 0;
+ int ep[2];
+ VALUE exc = Qnil;
+ int error_occurred;
-struct chfunc_wrapper_t {
- int (*chfunc)(void*);
- void *arg;
-};
+ if (status) *status = 0;
-static int
-chfunc_wrapper(void *arg_, char *errmsg, size_t errmsg_buflen)
-{
- struct chfunc_wrapper_t *arg = arg_;
- return arg->chfunc(arg->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 (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(int *status, int (*chfunc)(void*), void *charg, VALUE fds)
+static rb_pid_t
+retry_fork_ruby(int *status)
{
- 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 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;
+ }
}
rb_pid_t
rb_fork_ruby(int *status)
{
- return rb_fork_internal(status, NULL, NULL, FALSE, Qnil, NULL, 0);
+ 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;
}
#endif
-#if defined(HAVE_FORK) && !defined(CANNOT_FORK_WITH_PTHREAD)
+#if defined(HAVE_WORKING_FORK) && !defined(CANNOT_FORK_WITH_PTHREAD)
/*
* call-seq:
* Kernel.fork [{ block }] -> fixnum or nil
@@ -3442,6 +3617,9 @@ rb_fork_ruby(int *status)
* fork doesn't copy other threads.
*
* 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.
+ * Therefore you should use spawn() instead of fork().
*/
static VALUE
@@ -3514,7 +3692,6 @@ rb_f_exit_bang(int argc, VALUE *argv, VALUE obj)
VALUE status;
int istatus;
- rb_secure(4);
if (argc > 0 && rb_scan_args(argc, argv, "01", &status) == 1) {
istatus = exit_status_code(status);
}
@@ -3536,8 +3713,7 @@ rb_exit(int status)
args[1] = rb_str_new2("exit");
rb_exc_raise(rb_class_new_instance(2, args, rb_eSystemExit));
}
- ruby_finalize();
- exit(status);
+ ruby_stop(status);
}
@@ -3583,12 +3759,11 @@ rb_exit(int status)
*/
VALUE
-rb_f_exit(int argc, VALUE *argv)
+rb_f_exit(int argc, const VALUE *argv)
{
VALUE status;
int istatus;
- rb_secure(4);
if (argc > 0 && rb_scan_args(argc, argv, "01", &status) == 1) {
istatus = exit_status_code(status);
}
@@ -3613,9 +3788,9 @@ rb_f_exit(int argc, VALUE *argv)
*/
VALUE
-rb_f_abort(int argc, VALUE *argv)
+rb_f_abort(int argc, const VALUE *argv)
{
- rb_secure(4);
+ rb_check_arity(argc, 0, 1);
if (argc == 0) {
if (!NIL_P(GET_THREAD()->errinfo)) {
ruby_error_print();
@@ -3625,9 +3800,9 @@ rb_f_abort(int argc, VALUE *argv)
else {
VALUE args[2];
- rb_scan_args(argc, argv, "1", &args[1]);
- StringValue(argv[0]);
- rb_io_puts(argc, argv, rb_stderr);
+ args[1] = args[0] = argv[0];
+ StringValue(args[0]);
+ rb_io_puts(1, args, rb_stderr);
args[0] = INT2NUM(EXIT_FAILURE);
rb_exc_raise(rb_class_new_instance(2, args, rb_eSystemExit));
}
@@ -3650,12 +3825,12 @@ rb_spawn_process(struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen)
#if !USE_SPAWNV
int status;
#endif
-#if !defined HAVE_FORK || USE_SPAWNV
+#if !defined HAVE_WORKING_FORK || USE_SPAWNV
VALUE prog;
struct rb_execarg sarg;
#endif
-#if defined HAVE_FORK && !USE_SPAWNV
+#if defined HAVE_WORKING_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;
@@ -3676,10 +3851,8 @@ rb_spawn_process(struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen)
char **argv = ARGVSTR2ARGV(eargp->invoke.cmd.argv_str);
pid = proc_spawn_cmd(argv, prog, eargp);
}
-# if defined(_WIN32)
if (pid == -1)
rb_last_status_set(0x7f << 8, 0);
-# endif
# else
if (!eargp->use_shell) {
char **argv = ARGVSTR2ARGV(eargp->invoke.cmd.argv_str);
@@ -3696,7 +3869,7 @@ rb_spawn_process(struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen)
}
static rb_pid_t
-rb_spawn_internal(int argc, VALUE *argv, char *errmsg, size_t errmsg_buflen)
+rb_spawn_internal(int argc, const VALUE *argv, char *errmsg, size_t errmsg_buflen)
{
VALUE execarg_obj;
struct rb_execarg *eargp;
@@ -3711,13 +3884,13 @@ rb_spawn_internal(int argc, VALUE *argv, char *errmsg, size_t errmsg_buflen)
}
rb_pid_t
-rb_spawn_err(int argc, VALUE *argv, char *errmsg, size_t errmsg_buflen)
+rb_spawn_err(int argc, const VALUE *argv, char *errmsg, size_t errmsg_buflen)
{
return rb_spawn_internal(argc, argv, errmsg, errmsg_buflen);
}
rb_pid_t
-rb_spawn(int argc, VALUE *argv)
+rb_spawn(int argc, const VALUE *argv)
{
return rb_spawn_internal(argc, argv, NULL, 0);
}
@@ -3772,7 +3945,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_FORK) || defined(HAVE_SPAWNV)
+#if defined(HAVE_WORKING_FORK) || defined(HAVE_SPAWNV)
if (pid > 0) {
int ret, status;
ret = rb_waitpid(pid, &status, 0);
@@ -3798,7 +3971,15 @@ rb_f_system(int argc, VALUE *argv)
*
* spawn executes specified command and return its pid.
*
- * This method doesn't wait for end of the command.
+ * pid = spawn("tar xf ruby-2.0.0-p195.tar.bz2")
+ * Process.wait pid
+ *
+ * pid = spawn(RbConfig.ruby, "-eputs'Hello, world!'")
+ * Process.wait pid
+ *
+ * This method is similar to Kernel#system but it doesn't wait for the command
+ * to finish.
+ *
* The parent process should
* use <code>Process.wait</code> to collect
* the termination status of its child or
@@ -3813,7 +3994,7 @@ rb_f_system(int argc, VALUE *argv)
* name => nil : unset the environment variable
* command...:
* commandline : command line string which is passed to the standard shell
- * cmdname, arg1, ... : command name and one or more arguments (no shell)
+ * cmdname, arg1, ... : command name and one or more arguments (This form does not use the shell. See below for caveats.)
* [cmdname, argv0], arg1, ... : command name, argv[0] and zero or more arguments (no shell)
* options: hash
* clearing environment variables:
@@ -3854,6 +4035,14 @@ rb_f_system(int argc, VALUE *argv)
* current directory:
* :chdir => str
*
+ * The 'cmdname, arg1, ...' form does not use the shell. However,
+ * on different OSes, different things are provided as built-in
+ * commands. An example of this is 'echo', which is a built-in
+ * on Windows, but is a normal program on Linux and Mac OS X.
+ * This means that `Process.spawn 'echo', '%Path%'` will display
+ * the contents of the `%Path%` environment variable on Windows,
+ * but `Process.spawn 'echo', '$PATH'` prints the literal '$PATH'.
+ *
* If a hash is given as +env+, the environment is
* updated by +env+ before <code>exec(2)</code> in the child process.
* If a pair in +env+ has nil as the value, the variable is deleted.
@@ -3941,9 +4130,10 @@ 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,
+ * For stdout and stderr (and combination of them),
* it is opened in write mode.
* Otherwise read mode is used.
*
@@ -4063,7 +4253,7 @@ rb_f_spawn(int argc, VALUE *argv)
}
rb_sys_fail(prog);
}
-#if defined(HAVE_FORK) || defined(HAVE_SPAWNV)
+#if defined(HAVE_WORKING_FORK) || defined(HAVE_SPAWNV)
return PIDT2NUM(pid);
#else
return Qnil;
@@ -4244,7 +4434,7 @@ proc_getsid(int argc, VALUE *argv)
rb_scan_args(argc, argv, "01", &pid);
if (NIL_P(pid))
- pid = INT2NUM(0);
+ pid = INT2FIX(0);
sid = getsid(NUM2PIDT(pid));
if (sid < 0) rb_sys_fail(0);
@@ -4513,7 +4703,8 @@ rlimit_resource_type(VALUE rtype)
switch (TYPE(rtype)) {
case T_SYMBOL:
- name = rb_id2name(SYM2ID(rtype));
+ v = rb_sym2str(rtype);
+ name = RSTRING_PTR(v);
break;
default:
@@ -4535,7 +4726,7 @@ rlimit_resource_type(VALUE rtype)
if (r != -1)
return r;
- rb_raise(rb_eArgError, "invalid resource name: %s", name);
+ rb_raise(rb_eArgError, "invalid resource name: %"PRIsVALUE, rtype);
UNREACHABLE;
}
@@ -4548,7 +4739,8 @@ rlimit_resource_value(VALUE rval)
switch (TYPE(rval)) {
case T_SYMBOL:
- name = rb_id2name(SYM2ID(rval));
+ v = rb_sym2str(rval);
+ name = RSTRING_PTR(v);
break;
default:
@@ -4575,7 +4767,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: %s", name);
+ rb_raise(rb_eArgError, "invalid resource value: %"PRIsVALUE, rval);
UNREACHABLE;
}
@@ -4729,7 +4921,7 @@ check_gid_switch(void)
static rb_uid_t
obj2uid(VALUE id
# ifdef USE_GETPWNAM_R
- , char *getpw_buf, size_t getpw_buf_len
+ , VALUE *getpw_tmp
# endif
)
{
@@ -4744,8 +4936,28 @@ obj2uid(VALUE id
struct passwd *pwptr;
#ifdef USE_GETPWNAM_R
struct passwd pwbuf;
- if (getpwnam_r(usrname, &pwbuf, getpw_buf, getpw_buf_len, &pwptr))
- rb_sys_fail("getpwnam_r");
+ 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_buf = rb_alloc_tmp_buffer(getpw_tmp, getpw_buf_len);
+ }
+ else {
+ getpw_buf = RSTRING_PTR(*getpw_tmp);
+ getpw_buf_len = rb_str_capacity(*getpw_tmp);
+ }
+ 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)) {
+ if (errno != ERANGE || getpw_buf_len >= GETPW_R_SIZE_LIMIT) {
+ rb_free_tmp_buffer(getpw_tmp);
+ rb_sys_fail("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);
+ }
#else
pwptr = getpwnam(usrname);
#endif
@@ -4764,10 +4976,20 @@ obj2uid(VALUE id
}
# ifdef p_uid_from_name
+/*
+ * call-seq:
+ * Process::UID.from_name(name) -> uid
+ *
+ * Get the user ID by the _name_.
+ * If the user is not found, +ArgumentError+ will be raised.
+ *
+ * Process::UID.from_name("root") #=> 0
+ * Process::UID.from_name("nosuchuser") #=> can't find user for nosuchuser (ArgumentError)
+ */
+
static VALUE
p_uid_from_name(VALUE self, VALUE id)
{
- PREPARE_GETPWNAM
return UIDT2NUM(OBJ2UID(id));
}
# endif
@@ -4777,7 +4999,7 @@ p_uid_from_name(VALUE self, VALUE id)
static rb_gid_t
obj2gid(VALUE id
# ifdef USE_GETGRNAM_R
- , char *getgr_buf, size_t getgr_buf_len
+ , VALUE *getgr_tmp
# endif
)
{
@@ -4792,19 +5014,39 @@ obj2gid(VALUE id
struct group *grptr;
#ifdef USE_GETGRNAM_R
struct group grbuf;
- if (getgrnam_r(grpname, &grbuf, getgr_buf, getgr_buf_len, &grptr))
- rb_sys_fail("getgrnam_r");
+ 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_buf = rb_alloc_tmp_buffer(getgr_tmp, getgr_buf_len);
+ }
+ else {
+ getgr_buf = RSTRING_PTR(*getgr_tmp);
+ getgr_buf_len = rb_str_capacity(*getgr_tmp);
+ }
+ 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)) {
+ if (errno != ERANGE || getgr_buf_len >= GETGR_R_SIZE_LIMIT) {
+ rb_free_tmp_buffer(getgr_tmp);
+ rb_sys_fail("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);
+ }
#else
grptr = getgrnam(grpname);
#endif
if (!grptr) {
-#ifndef USE_GETGRNAM_R
+#if !defined(USE_GETGRNAM_R) && defined(HAVE_ENDGRENT)
endgrent();
#endif
rb_raise(rb_eArgError, "can't find group for %s", grpname);
}
gid = grptr->gr_gid;
-#ifndef USE_GETGRNAM_R
+#if !defined(USE_GETGRNAM_R) && defined(HAVE_ENDGRENT)
endgrent();
#endif
}
@@ -4812,10 +5054,20 @@ obj2gid(VALUE id
}
# ifdef p_gid_from_name
+/*
+ * call-seq:
+ * Process::GID.from_name(name) -> gid
+ *
+ * Get the group ID by the _name_.
+ * If the group is not found, +ArgumentError+ will be raised.
+ *
+ * Process::GID.from_name("wheel") #=> 0
+ * Process::GID.from_name("nosuchgroup") #=> can't find group for nosuchgroup (ArgumentError)
+ */
+
static VALUE
p_gid_from_name(VALUE self, VALUE id)
{
- PREPARE_GETGRNAM;
return GIDT2NUM(OBJ2GID(id));
}
# endif
@@ -4834,7 +5086,6 @@ 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;
@@ -4857,7 +5108,6 @@ 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;
@@ -4880,7 +5130,6 @@ 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;
@@ -4905,9 +5154,13 @@ 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();
- if (setreuid(OBJ2UID(rid), OBJ2UID(eid)) != 0) rb_sys_fail(0);
+ ruid = OBJ2UID1(rid);
+ euid = OBJ2UID1(eid);
+ FINISH_GETPWNAM;
+ if (setreuid(ruid, euid) != 0) rb_sys_fail(0);
return Qnil;
}
#else
@@ -4930,9 +5183,14 @@ 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();
- if (setresuid(OBJ2UID(rid), OBJ2UID(eid), OBJ2UID(sid)) != 0) rb_sys_fail(0);
+ ruid = OBJ2UID1(rid);
+ euid = OBJ2UID1(eid);
+ suid = OBJ2UID1(sid);
+ FINISH_GETPWNAM;
+ if (setresuid(ruid, euid, suid) != 0) rb_sys_fail(0);
return Qnil;
}
#else
@@ -4972,7 +5230,6 @@ static VALUE
proc_setuid(VALUE obj, VALUE id)
{
rb_uid_t uid;
- PREPARE_GETPWNAM;
check_uid_switch();
@@ -5044,7 +5301,6 @@ static VALUE
p_uid_change_privilege(VALUE obj, VALUE id)
{
rb_uid_t uid;
- PREPARE_GETPWNAM;
check_uid_switch();
@@ -5214,7 +5470,6 @@ 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;
@@ -5237,7 +5492,6 @@ 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;
@@ -5260,7 +5514,6 @@ 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;
@@ -5285,9 +5538,13 @@ 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();
- if (setregid(OBJ2GID(rid), OBJ2GID(eid)) != 0) rb_sys_fail(0);
+ rgid = OBJ2GID(rid);
+ egid = OBJ2GID(eid);
+ FINISH_GETGRNAM;
+ if (setregid(rgid, egid) != 0) rb_sys_fail(0);
return Qnil;
}
#else
@@ -5309,9 +5566,14 @@ 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();
- if (setresgid(OBJ2GID(rid), OBJ2GID(eid), OBJ2GID(sid)) != 0) rb_sys_fail(0);
+ rgid = OBJ2GID(rid);
+ egid = OBJ2GID(eid);
+ sgid = OBJ2GID(sid);
+ FINISH_GETGRNAM;
+ if (setresgid(rgid, egid, sgid) != 0) rb_sys_fail(0);
return Qnil;
}
#else
@@ -5379,7 +5641,6 @@ static VALUE
proc_setgid(VALUE obj, VALUE id)
{
rb_gid_t gid;
- PREPARE_GETGRNAM;
check_gid_switch();
@@ -5470,7 +5731,7 @@ maxgroups(void)
static VALUE
proc_getgroups(VALUE obj)
{
- VALUE ary;
+ VALUE ary, tmp;
int i, ngroups;
rb_gid_t *groups;
@@ -5478,7 +5739,7 @@ proc_getgroups(VALUE obj)
if (ngroups == -1)
rb_sys_fail(0);
- groups = ALLOCA_N(rb_gid_t, ngroups);
+ groups = ALLOCV_N(rb_gid_t, tmp, ngroups);
ngroups = getgroups(ngroups, groups);
if (ngroups == -1)
@@ -5488,6 +5749,8 @@ proc_getgroups(VALUE obj)
for (i = 0; i < ngroups; i++)
rb_ary_push(ary, GIDT2NUM(groups[i]));
+ ALLOCV_END(tmp);
+
return ary;
}
#else
@@ -5514,6 +5777,7 @@ proc_setgroups(VALUE obj, VALUE ary)
{
int ngroups, i;
rb_gid_t *groups;
+ VALUE tmp;
PREPARE_GETGRNAM;
Check_Type(ary, T_ARRAY);
@@ -5522,17 +5786,20 @@ proc_setgroups(VALUE obj, VALUE ary)
if (ngroups > maxgroups())
rb_raise(rb_eArgError, "too many groups, %d max", maxgroups());
- groups = ALLOCA_N(rb_gid_t, ngroups);
+ groups = ALLOCV_N(rb_gid_t, tmp, ngroups);
for (i = 0; i < ngroups; i++) {
- VALUE g = RARRAY_PTR(ary)[i];
+ VALUE g = RARRAY_AREF(ary, i);
- groups[i] = OBJ2GID(g);
+ groups[i] = OBJ2GID1(g);
}
+ FINISH_GETGRNAM;
if (setgroups(ngroups, groups) == -1) /* ngroups <= maxgroups */
rb_sys_fail(0);
+ ALLOCV_END(tmp);
+
return proc_getgroups(obj);
}
#else
@@ -5561,7 +5828,6 @@ 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);
}
@@ -5623,7 +5889,7 @@ proc_setmaxgroups(VALUE obj, VALUE val)
#define proc_setmaxgroups rb_f_notimplement
#endif
-#if defined(HAVE_DAEMON) || (defined(HAVE_FORK) && defined(HAVE_SETSID))
+#if defined(HAVE_DAEMON) || (defined(HAVE_WORKING_FORK) && defined(HAVE_SETSID))
static int rb_daemon(int nochdir, int noclose);
/*
@@ -5660,9 +5926,9 @@ rb_daemon(int nochdir, int noclose)
{
int err = 0;
#ifdef HAVE_DAEMON
- before_fork();
+ before_fork_ruby();
err = daemon(nochdir, noclose);
- after_fork();
+ after_fork_ruby();
rb_thread_atfork();
#else
int n;
@@ -5743,7 +6009,6 @@ static VALUE
p_gid_change_privilege(VALUE obj, VALUE id)
{
rb_gid_t gid;
- PREPARE_GETGRNAM;
check_gid_switch();
@@ -5953,7 +6218,6 @@ 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;
@@ -6019,7 +6283,6 @@ 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;
}
@@ -6059,7 +6322,6 @@ 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();
@@ -6151,7 +6413,6 @@ 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;
}
@@ -6512,22 +6773,10 @@ p_gid_switch(VALUE obj)
#if defined(HAVE_TIMES)
-/*
- * call-seq:
- * Process.times -> aStructTms
- *
- * Returns a <code>Tms</code> structure (see <code>Struct::Tms</code>)
- * that contains user and system CPU times for this process,
- * and also for children processes.
- *
- * t = Process.times
- * [ t.utime, t.stime, t.cutime, t.cstime ] #=> [0.0, 0.02, 0.00, 0.00]
- */
-
-VALUE
-rb_proc_times(VALUE obj)
+static long
+get_clk_tck(void)
{
- const double hertz =
+ long hertz =
#ifdef HAVE__SC_CLK_TCK
(double)sysconf(_SC_CLK_TCK);
#else
@@ -6540,20 +6789,670 @@ rb_proc_times(VALUE obj)
#endif /* HZ */
HZ;
#endif
+ return hertz;
+}
+
+/*
+ * call-seq:
+ * Process.times -> aProcessTms
+ *
+ * Returns a <code>Tms</code> structure (see <code>Process::Tms</code>)
+ * that contains user and system CPU times for this process,
+ * and also for children processes.
+ *
+ * t = Process.times
+ * [ t.utime, t.stime, t.cutime, t.cstime ] #=> [0.0, 0.02, 0.00, 0.00]
+ */
+
+VALUE
+rb_proc_times(VALUE obj)
+{
+ const double hertz = get_clk_tck();
struct tms buf;
- volatile VALUE utime, stime, cutime, sctime;
+ VALUE utime, stime, cutime, cstime, ret;
times(&buf);
- return rb_struct_new(rb_cProcessTms,
- utime = DBL2NUM(buf.tms_utime / hertz),
- stime = DBL2NUM(buf.tms_stime / hertz),
- cutime = DBL2NUM(buf.tms_cutime / hertz),
- sctime = DBL2NUM(buf.tms_cstime / hertz));
+ utime = DBL2NUM(buf.tms_utime / hertz);
+ stime = DBL2NUM(buf.tms_stime / hertz);
+ cutime = DBL2NUM(buf.tms_cutime / hertz);
+ cstime = DBL2NUM(buf.tms_cstime / hertz);
+ ret = rb_struct_new(rb_cProcessTms, utime, stime, cutime, cstime);
+ RB_GC_GUARD(utime);
+ RB_GC_GUARD(stime);
+ RB_GC_GUARD(cutime);
+ RB_GC_GUARD(cstime);
+ return ret;
}
#else
#define rb_proc_times rb_f_notimplement
#endif
+#ifdef HAVE_LONG_LONG
+typedef LONG_LONG timetick_int_t;
+#define TIMETICK_INT_MIN LLONG_MIN
+#define TIMETICK_INT_MAX LLONG_MAX
+#define TIMETICK_INT2NUM(v) LL2NUM(v)
+#else
+typedef long timetick_int_t;
+#define TIMETICK_INT_MIN LONG_MIN
+#define TIMETICK_INT_MAX LONG_MAX
+#define TIMETICK_INT2NUM(v) LONG2NUM(v)
+#endif
+
+static timetick_int_t
+gcd_timetick_int(timetick_int_t a, timetick_int_t b)
+{
+ timetick_int_t t;
+
+ if (a < b) {
+ t = a;
+ a = b;
+ b = t;
+ }
+
+ while (1) {
+ t = a % b;
+ if (t == 0)
+ return b;
+ a = b;
+ b = t;
+ }
+}
+
+static void
+reduce_fraction(timetick_int_t *np, timetick_int_t *dp)
+{
+ timetick_int_t gcd = gcd_timetick_int(*np, *dp);
+ if (gcd != 1) {
+ *np /= gcd;
+ *dp /= gcd;
+ }
+}
+
+static void
+reduce_factors(timetick_int_t *numerators, int num_numerators,
+ timetick_int_t *denominators, int num_denominators)
+{
+ int i, j;
+ for (i = 0; i < num_numerators; i++) {
+ if (numerators[i] == 1)
+ continue;
+ for (j = 0; j < num_denominators; j++) {
+ if (denominators[j] == 1)
+ continue;
+ reduce_fraction(&numerators[i], &denominators[j]);
+ }
+ }
+}
+
+struct timetick {
+ timetick_int_t giga_count;
+ int32_t count; /* 0 .. 999999999 */
+};
+
+static VALUE
+timetick2dblnum(struct timetick *ttp,
+ timetick_int_t *numerators, int num_numerators,
+ timetick_int_t *denominators, int num_denominators)
+{
+ double d;
+ int i;
+
+ reduce_factors(numerators, num_numerators,
+ denominators, num_denominators);
+
+ d = ttp->giga_count * 1e9 + ttp->count;
+
+ for (i = 0; i < num_numerators; i++)
+ d *= numerators[i];
+ for (i = 0; i < num_denominators; i++)
+ d /= denominators[i];
+
+ return DBL2NUM(d);
+}
+
+static VALUE
+timetick2dblnum_reciprocal(struct timetick *ttp,
+ timetick_int_t *numerators, int num_numerators,
+ timetick_int_t *denominators, int num_denominators)
+{
+ double d;
+ int i;
+
+ reduce_factors(numerators, num_numerators,
+ denominators, num_denominators);
+
+ d = 1.0;
+ for (i = 0; i < num_denominators; i++)
+ d *= denominators[i];
+ for (i = 0; i < num_numerators; i++)
+ d /= numerators[i];
+ d /= ttp->giga_count * 1e9 + ttp->count;
+
+ return DBL2NUM(d);
+}
+
+#define NDIV(x,y) (-(-((x)+1)/(y))-1)
+#define DIV(n,d) ((n)<0 ? NDIV((n),(d)) : (n)/(d))
+
+static VALUE
+timetick2integer(struct timetick *ttp,
+ timetick_int_t *numerators, int num_numerators,
+ timetick_int_t *denominators, int num_denominators)
+{
+ VALUE v;
+ int i;
+
+ reduce_factors(numerators, num_numerators,
+ denominators, num_denominators);
+
+ if (!MUL_OVERFLOW_SIGNED_INTEGER_P(1000000000, ttp->giga_count,
+ TIMETICK_INT_MIN, TIMETICK_INT_MAX-ttp->count)) {
+ timetick_int_t t = ttp->giga_count * 1000000000 + ttp->count;
+ for (i = 0; i < num_numerators; i++) {
+ timetick_int_t factor = numerators[i];
+ if (MUL_OVERFLOW_SIGNED_INTEGER_P(factor, t,
+ TIMETICK_INT_MIN, TIMETICK_INT_MAX))
+ goto generic;
+ t *= factor;
+ }
+ for (i = 0; i < num_denominators; i++) {
+ t = DIV(t, denominators[i]);
+ }
+ return TIMETICK_INT2NUM(t);
+ }
+
+ generic:
+ v = TIMETICK_INT2NUM(ttp->giga_count);
+ v = rb_funcall(v, '*', 1, LONG2FIX(1000000000));
+ v = rb_funcall(v, '+', 1, LONG2FIX(ttp->count));
+ for (i = 0; i < num_numerators; i++) {
+ timetick_int_t factor = numerators[i];
+ if (factor == 1)
+ continue;
+ v = rb_funcall(v, '*', 1, TIMETICK_INT2NUM(factor));
+ }
+ for (i = 0; i < num_denominators; i++) {
+ v = rb_funcall(v, '/', 1, TIMETICK_INT2NUM(denominators[i])); /* Ruby's '/' is div. */
+ }
+ return v;
+}
+
+static VALUE
+make_clock_result(struct timetick *ttp,
+ timetick_int_t *numerators, int num_numerators,
+ timetick_int_t *denominators, int num_denominators,
+ VALUE unit)
+{
+ if (unit == ID2SYM(rb_intern("nanosecond"))) {
+ numerators[num_numerators++] = 1000000000;
+ return timetick2integer(ttp, numerators, num_numerators, denominators, num_denominators);
+ }
+ else if (unit == ID2SYM(rb_intern("microsecond"))) {
+ numerators[num_numerators++] = 1000000;
+ return timetick2integer(ttp, numerators, num_numerators, denominators, num_denominators);
+ }
+ else if (unit == ID2SYM(rb_intern("millisecond"))) {
+ numerators[num_numerators++] = 1000;
+ return timetick2integer(ttp, numerators, num_numerators, denominators, num_denominators);
+ }
+ else if (unit == ID2SYM(rb_intern("second"))) {
+ return timetick2integer(ttp, numerators, num_numerators, denominators, num_denominators);
+ }
+ 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(rb_intern("float_millisecond"))) {
+ numerators[num_numerators++] = 1000;
+ return timetick2dblnum(ttp, numerators, num_numerators, denominators, num_denominators);
+ }
+ else if (NIL_P(unit) || unit == ID2SYM(rb_intern("float_second"))) {
+ return timetick2dblnum(ttp, numerators, num_numerators, denominators, num_denominators);
+ }
+ else
+ rb_raise(rb_eArgError, "unexpected unit: %"PRIsVALUE, unit);
+}
+
+#ifdef __APPLE__
+static mach_timebase_info_data_t *
+get_mach_timebase_info(void)
+{
+ static mach_timebase_info_data_t sTimebaseInfo;
+
+ if ( sTimebaseInfo.denom == 0 ) {
+ (void) mach_timebase_info(&sTimebaseInfo);
+ }
+
+ return &sTimebaseInfo;
+}
+#endif
+
+/*
+ * call-seq:
+ * Process.clock_gettime(clock_id [, unit]) -> number
+ *
+ * Returns a time returned by POSIX clock_gettime() function.
+ *
+ * p Process.clock_gettime(Process::CLOCK_MONOTONIC)
+ * #=> 896053.968060096
+ *
+ * +clock_id+ specifies a kind of clock.
+ * 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.
+ * Ruby provides following types of +clock_id+ if available.
+ *
+ * [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_VIRTUAL] FreeBSD 3.0, OpenBSD 2.1
+ * [CLOCK_PROF] FreeBSD 3.0, OpenBSD 2.1
+ * [CLOCK_REALTIME_FAST] FreeBSD 8.1
+ * [CLOCK_REALTIME_PRECISE] FreeBSD 8.1
+ * [CLOCK_REALTIME_COARSE] Linux 2.6.32
+ * [CLOCK_REALTIME_ALARM] Linux 3.0
+ * [CLOCK_MONOTONIC_FAST] FreeBSD 8.1
+ * [CLOCK_MONOTONIC_PRECISE] FreeBSD 8.1
+ * [CLOCK_MONOTONIC_COARSE] Linux 2.6.32
+ * [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_FAST] FreeBSD 8.1
+ * [CLOCK_UPTIME_PRECISE] FreeBSD 8.1
+ * [CLOCK_SECOND] FreeBSD 8.1
+ *
+ * Note that SUS stands for Single Unix Specification.
+ * SUS contains POSIX and clock_gettime is defined in the POSIX part.
+ * SUS defines CLOCK_REALTIME mandatory but
+ * CLOCK_MONOTONIC, CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID are optional.
+ *
+ * Also, several symbols are accepted as +clock_id+.
+ * There are emulations for clock_gettime().
+ *
+ * For example, Process::CLOCK_REALTIME is defined as
+ * +:GETTIMEOFDAY_BASED_CLOCK_REALTIME+ when clock_gettime() is not available.
+ *
+ * Emulations for +CLOCK_REALTIME+:
+ * [:GETTIMEOFDAY_BASED_CLOCK_REALTIME]
+ * Use gettimeofday() defined by SUS.
+ * (SUSv4 obsoleted it, though.)
+ * The resolution is 1 microsecond.
+ * [:TIME_BASED_CLOCK_REALTIME]
+ * Use time() defined by ISO C.
+ * The resolution is 1 second.
+ *
+ * Emulations for +CLOCK_MONOTONIC+:
+ * [:MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC]
+ * Use mach_absolute_time(), available on Darwin.
+ * The resolution is CPU dependent.
+ * [:TIMES_BASED_CLOCK_MONOTONIC]
+ * Use the result value of times() defined by POSIX.
+ * POSIX defines it as "times() shall return the elapsed real time, in clock ticks, since an arbitrary point in the past (for example, system start-up time)".
+ * For example, GNU/Linux returns a value based on jiffies and it is monotonic.
+ * However, 4.4BSD uses gettimeofday() and it is not monotonic.
+ * (FreeBSD uses clock_gettime(CLOCK_MONOTONIC) instead, though.)
+ * The resolution is the clock tick.
+ * "getconf CLK_TCK" command shows the clock ticks per second.
+ * (The clock ticks per second is defined by HZ macro in older systems.)
+ * If it is 100 and clock_t is 32 bits integer type, the resolution is 10 millisecond and
+ * cannot represent over 497 days.
+ *
+ * Emulations for +CLOCK_PROCESS_CPUTIME_ID+:
+ * [:GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID]
+ * Use getrusage() defined by SUS.
+ * getrusage() is used with RUSAGE_SELF to obtain the time only for
+ * the calling process (excluding the time for child processes).
+ * The result is addition of user time (ru_utime) and system time (ru_stime).
+ * The resolution is 1 microsecond.
+ * [:TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID]
+ * Use times() defined by POSIX.
+ * The result is addition of user time (tms_utime) and system time (tms_stime).
+ * tms_cutime and tms_cstime are ignored to exclude the time for child processes.
+ * The resolution is the clock tick.
+ * "getconf CLK_TCK" command shows the clock ticks per second.
+ * (The clock ticks per second is defined by HZ macro in older systems.)
+ * If it is 100, the resolution is 10 millisecond.
+ * [:CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID]
+ * Use clock() defined by ISO C.
+ * The resolution is 1/CLOCKS_PER_SEC.
+ * CLOCKS_PER_SEC is the C-level macro defined by time.h.
+ * SUS defines CLOCKS_PER_SEC is 1000000.
+ * Non-Unix systems may define it a different value, though.
+ * If CLOCKS_PER_SEC is 1000000 as SUS, the resolution is 1 microsecond.
+ * If CLOCKS_PER_SEC is 1000000 and clock_t is 32 bits integer type, it cannot represent over 72 minutes.
+ *
+ * If the given +clock_id+ is not supported, Errno::EINVAL is raised.
+ *
+ * +unit+ specifies a type of the return value.
+ *
+ * [: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
+ *
+ * The underlying function, clock_gettime(), returns a number of nanoseconds.
+ * Float object (IEEE 754 double) is not enough to represent
+ * the return value for CLOCK_REALTIME.
+ * If the exact nanoseconds value is required, use +:nanoseconds+ as the +unit+.
+ *
+ * The origin (zero) of the returned value varies.
+ * For example, system start up time, process start up time, the Epoch, etc.
+ *
+ * The origin in CLOCK_REALTIME is defined as the Epoch
+ * (1970-01-01 00:00:00 UTC).
+ * But some systems count leap seconds and others doesn't.
+ * So the result can be interpreted differently across systems.
+ * Time.now is recommended over CLOCK_REALTIME.
+ */
+VALUE
+rb_clock_gettime(int argc, VALUE *argv)
+{
+ VALUE clk_id, unit;
+ int ret;
+
+ struct timetick tt;
+ timetick_int_t numerators[2];
+ timetick_int_t denominators[2];
+ int num_numerators = 0;
+ int num_denominators = 0;
+
+ rb_scan_args(argc, argv, "11", &clk_id, &unit);
+
+ if (SYMBOL_P(clk_id)) {
+ /*
+ * Non-clock_gettime clocks are provided by symbol clk_id.
+ *
+ * gettimeofday is always available on platforms supported by Ruby.
+ * GETTIMEOFDAY_BASED_CLOCK_REALTIME is used for
+ * CLOCK_REALTIME if clock_gettime is not available.
+ */
+#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);
+ if (ret != 0)
+ rb_sys_fail("gettimeofday");
+ tt.giga_count = tv.tv_sec;
+ tt.count = (int32_t)tv.tv_usec * 1000;
+ denominators[num_denominators++] = 1000000000;
+ goto success;
+ }
+
+#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);
+ if (t == (time_t)-1)
+ rb_sys_fail("time");
+ tt.giga_count = t;
+ tt.count = 0;
+ denominators[num_denominators++] = 1000000000;
+ goto success;
+ }
+
+#ifdef HAVE_TIMES
+#define RUBY_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;
+ unsigned_clock_t uc;
+ c = times(&buf);
+ if (c == (clock_t)-1)
+ rb_sys_fail("times");
+ uc = (unsigned_clock_t)c;
+ tt.count = (int32_t)(uc % 1000000000);
+ tt.giga_count = (uc / 1000000000);
+ denominators[num_denominators++] = get_clk_tck();
+ goto success;
+ }
+#endif
+
+#ifdef RUSAGE_SELF
+#define RUBY_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;
+ ret = getrusage(RUSAGE_SELF, &usage);
+ if (ret != 0)
+ rb_sys_fail("getrusage");
+ tt.giga_count = usage.ru_utime.tv_sec + usage.ru_stime.tv_sec;
+ usec = (int32_t)(usage.ru_utime.tv_usec + usage.ru_stime.tv_usec);
+ if (1000000 <= usec) {
+ tt.giga_count++;
+ usec -= 1000000;
+ }
+ tt.count = usec * 1000;
+ denominators[num_denominators++] = 1000000000;
+ goto success;
+ }
+#endif
+
+#ifdef HAVE_TIMES
+#define RUBY_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;
+ if (times(&buf) == (clock_t)-1)
+ rb_sys_fail("times");
+ utime = (unsigned_clock_t)buf.tms_utime;
+ stime = (unsigned_clock_t)buf.tms_stime;
+ tt.count = (int32_t)((utime % 1000000000) + (stime % 1000000000));
+ tt.giga_count = (utime / 1000000000) + (stime / 1000000000);
+ if (1000000000 <= tt.count) {
+ tt.count -= 1000000000;
+ tt.giga_count++;
+ }
+ denominators[num_denominators++] = get_clk_tck();
+ goto success;
+ }
+#endif
+
+#define RUBY_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;
+ errno = 0;
+ c = clock();
+ if (c == (clock_t)-1)
+ rb_sys_fail("clock");
+ uc = (unsigned_clock_t)c;
+ tt.count = (int32_t)(uc % 1000000000);
+ tt.giga_count = uc / 1000000000;
+ denominators[num_denominators++] = CLOCKS_PER_SEC;
+ goto success;
+ }
+
+#ifdef __APPLE__
+#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();
+ tt.count = (int32_t)(t % 1000000000);
+ tt.giga_count = t / 1000000000;
+ numerators[num_numerators++] = info->numer;
+ denominators[num_denominators++] = info->denom;
+ denominators[num_denominators++] = 1000000000;
+ goto success;
+ }
+#endif
+ }
+ else {
+#if defined(HAVE_CLOCK_GETTIME)
+ struct timespec ts;
+ clockid_t c;
+ c = NUM2CLOCKID(clk_id);
+ ret = clock_gettime(c, &ts);
+ if (ret == -1)
+ rb_sys_fail("clock_gettime");
+ tt.count = (int32_t)ts.tv_nsec;
+ tt.giga_count = ts.tv_sec;
+ denominators[num_denominators++] = 1000000000;
+ goto success;
+#endif
+ }
+ /* EINVAL emulates clock_gettime behavior when clock_id is invalid. */
+ errno = EINVAL;
+ rb_sys_fail(0);
+
+ success:
+ return make_clock_result(&tt, numerators, num_numerators, denominators, num_denominators, unit);
+}
+
+/*
+ * call-seq:
+ * Process.clock_getres(clock_id [, unit]) -> number
+ *
+ * Returns the time resolution returned by POSIX clock_getres() function.
+ *
+ * +clock_id+ specifies a kind of clock.
+ * See the document of +Process.clock_gettime+ for details.
+ *
+ * +clock_id+ can be a symbol as +Process.clock_gettime+.
+ * However the result may not be accurate.
+ * For example, +Process.clock_getres(:GETTIMEOFDAY_BASED_CLOCK_REALTIME)+
+ * returns 1.0e-06 which means 1 microsecond, but actual resolution can be more coarse.
+ *
+ * If the given +clock_id+ is not supported, Errno::EINVAL is raised.
+ *
+ * +unit+ specifies a type of the return value.
+ * +Process.clock_getres+ accepts +unit+ as +Process.clock_gettime+.
+ * The default value, +:float_second+, is also same as
+ * +Process.clock_gettime+.
+ *
+ * +Process.clock_getres+ also accepts +:hertz+ as +unit+.
+ * +:hertz+ means a the reciprocal of +:float_second+.
+ *
+ * +:hertz+ can be used to obtain the exact value of
+ * the clock ticks per second for times() function and
+ * CLOCKS_PER_SEC for clock() function.
+ *
+ * +Process.clock_getres(:TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID, :hertz)+
+ * returns the clock ticks per second.
+ *
+ * +Process.clock_getres(:CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID, :hertz)+
+ * returns CLOCKS_PER_SEC.
+ *
+ * p Process.clock_getres(Process::CLOCK_MONOTONIC)
+ * #=> 1.0e-09
+ *
+ */
+VALUE
+rb_clock_getres(int argc, VALUE *argv)
+{
+ VALUE clk_id, unit;
+
+ struct timetick tt;
+ timetick_int_t numerators[2];
+ timetick_int_t denominators[2];
+ int num_numerators = 0;
+ int num_denominators = 0;
+
+ rb_scan_args(argc, argv, "11", &clk_id, &unit);
+
+ if (SYMBOL_P(clk_id)) {
+#ifdef RUBY_GETTIMEOFDAY_BASED_CLOCK_REALTIME
+ if (clk_id == RUBY_GETTIMEOFDAY_BASED_CLOCK_REALTIME) {
+ tt.giga_count = 0;
+ tt.count = 1000;
+ denominators[num_denominators++] = 1000000000;
+ goto success;
+ }
+#endif
+
+#ifdef RUBY_TIME_BASED_CLOCK_REALTIME
+ if (clk_id == RUBY_TIME_BASED_CLOCK_REALTIME) {
+ tt.giga_count = 1;
+ tt.count = 0;
+ denominators[num_denominators++] = 1000000000;
+ goto success;
+ }
+#endif
+
+#ifdef RUBY_TIMES_BASED_CLOCK_MONOTONIC
+ if (clk_id == RUBY_TIMES_BASED_CLOCK_MONOTONIC) {
+ tt.count = 1;
+ tt.giga_count = 0;
+ denominators[num_denominators++] = get_clk_tck();
+ goto success;
+ }
+#endif
+
+#ifdef RUBY_GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID
+ if (clk_id == RUBY_GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID) {
+ tt.giga_count = 0;
+ tt.count = 1000;
+ denominators[num_denominators++] = 1000000000;
+ goto success;
+ }
+#endif
+
+#ifdef RUBY_TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID
+ if (clk_id == RUBY_TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID) {
+ tt.count = 1;
+ tt.giga_count = 0;
+ denominators[num_denominators++] = get_clk_tck();
+ goto success;
+ }
+#endif
+
+#ifdef RUBY_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID
+ if (clk_id == RUBY_CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID) {
+ tt.count = 1;
+ tt.giga_count = 0;
+ denominators[num_denominators++] = CLOCKS_PER_SEC;
+ goto success;
+ }
+#endif
+
+#ifdef RUBY_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();
+ tt.count = 1;
+ tt.giga_count = 0;
+ numerators[num_numerators++] = info->numer;
+ denominators[num_denominators++] = info->denom;
+ denominators[num_denominators++] = 1000000000;
+ goto success;
+ }
+#endif
+ }
+ else {
+#if defined(HAVE_CLOCK_GETRES)
+ struct timespec ts;
+ clockid_t c = NUM2CLOCKID(clk_id);
+ int ret = clock_getres(c, &ts);
+ if (ret == -1)
+ rb_sys_fail("clock_getres");
+ tt.count = (int32_t)ts.tv_nsec;
+ tt.giga_count = ts.tv_sec;
+ denominators[num_denominators++] = 1000000000;
+ goto success;
+#endif
+ }
+ /* EINVAL emulates clock_getres behavior when clock_id is invalid. */
+ errno = EINVAL;
+ rb_sys_fail(0);
+
+ success:
+ if (unit == ID2SYM(rb_intern("hertz"))) {
+ return timetick2dblnum_reciprocal(&tt, numerators, num_numerators, denominators, num_denominators);
+ }
+ else {
+ return make_clock_result(&tt, numerators, num_numerators, denominators, num_denominators, unit);
+ }
+}
+
VALUE rb_mProcess;
VALUE rb_mProcUID;
VALUE rb_mProcGID;
@@ -6568,6 +7467,8 @@ VALUE rb_mProcID_Syscall;
void
Init_process(void)
{
+#undef rb_intern
+#define rb_intern(str) rb_intern_const(str)
rb_define_virtual_variable("$?", rb_last_status_get, 0);
rb_define_virtual_variable("$$", get_pid, 0);
rb_define_global_function("exec", rb_f_exec, -1);
@@ -6611,6 +7512,11 @@ Init_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");
@@ -6812,8 +7718,78 @@ Init_process(void)
rb_define_module_function(rb_mProcess, "times", rb_proc_times, 0);
+#ifdef CLOCK_REALTIME
+ rb_define_const(rb_mProcess, "CLOCK_REALTIME", CLOCKID2NUM(CLOCK_REALTIME));
+#elif defined(RUBY_GETTIMEOFDAY_BASED_CLOCK_REALTIME)
+ rb_define_const(rb_mProcess, "CLOCK_REALTIME", RUBY_GETTIMEOFDAY_BASED_CLOCK_REALTIME);
+#endif
+#ifdef CLOCK_MONOTONIC
+ rb_define_const(rb_mProcess, "CLOCK_MONOTONIC", CLOCKID2NUM(CLOCK_MONOTONIC));
+#elif defined(RUBY_MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC)
+ rb_define_const(rb_mProcess, "CLOCK_MONOTONIC", RUBY_MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC);
+#endif
+#ifdef CLOCK_PROCESS_CPUTIME_ID
+ rb_define_const(rb_mProcess, "CLOCK_PROCESS_CPUTIME_ID", CLOCKID2NUM(CLOCK_PROCESS_CPUTIME_ID));
+#elif defined(RUBY_GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID)
+ rb_define_const(rb_mProcess, "CLOCK_PROCESS_CPUTIME_ID", RUBY_GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID);
+#endif
+#ifdef CLOCK_THREAD_CPUTIME_ID
+ rb_define_const(rb_mProcess, "CLOCK_THREAD_CPUTIME_ID", CLOCKID2NUM(CLOCK_THREAD_CPUTIME_ID));
+#endif
+#ifdef CLOCK_VIRTUAL
+ rb_define_const(rb_mProcess, "CLOCK_VIRTUAL", CLOCKID2NUM(CLOCK_VIRTUAL));
+#endif
+#ifdef CLOCK_PROF
+ rb_define_const(rb_mProcess, "CLOCK_PROF", CLOCKID2NUM(CLOCK_PROF));
+#endif
+#ifdef CLOCK_REALTIME_FAST
+ rb_define_const(rb_mProcess, "CLOCK_REALTIME_FAST", CLOCKID2NUM(CLOCK_REALTIME_FAST));
+#endif
+#ifdef CLOCK_REALTIME_PRECISE
+ rb_define_const(rb_mProcess, "CLOCK_REALTIME_PRECISE", CLOCKID2NUM(CLOCK_REALTIME_PRECISE));
+#endif
+#ifdef CLOCK_REALTIME_COARSE
+ rb_define_const(rb_mProcess, "CLOCK_REALTIME_COARSE", CLOCKID2NUM(CLOCK_REALTIME_COARSE));
+#endif
+#ifdef CLOCK_REALTIME_ALARM
+ rb_define_const(rb_mProcess, "CLOCK_REALTIME_ALARM", CLOCKID2NUM(CLOCK_REALTIME_ALARM));
+#endif
+#ifdef CLOCK_MONOTONIC_FAST
+ rb_define_const(rb_mProcess, "CLOCK_MONOTONIC_FAST", CLOCKID2NUM(CLOCK_MONOTONIC_FAST));
+#endif
+#ifdef CLOCK_MONOTONIC_PRECISE
+ rb_define_const(rb_mProcess, "CLOCK_MONOTONIC_PRECISE", CLOCKID2NUM(CLOCK_MONOTONIC_PRECISE));
+#endif
+#ifdef CLOCK_MONOTONIC_RAW
+ rb_define_const(rb_mProcess, "CLOCK_MONOTONIC_RAW", CLOCKID2NUM(CLOCK_MONOTONIC_RAW));
+#endif
+#ifdef CLOCK_MONOTONIC_COARSE
+ rb_define_const(rb_mProcess, "CLOCK_MONOTONIC_COARSE", CLOCKID2NUM(CLOCK_MONOTONIC_COARSE));
+#endif
+#ifdef CLOCK_BOOTTIME
+ rb_define_const(rb_mProcess, "CLOCK_BOOTTIME", CLOCKID2NUM(CLOCK_BOOTTIME));
+#endif
+#ifdef CLOCK_BOOTTIME_ALARM
+ rb_define_const(rb_mProcess, "CLOCK_BOOTTIME_ALARM", CLOCKID2NUM(CLOCK_BOOTTIME_ALARM));
+#endif
+#ifdef CLOCK_UPTIME
+ rb_define_const(rb_mProcess, "CLOCK_UPTIME", CLOCKID2NUM(CLOCK_UPTIME));
+#endif
+#ifdef CLOCK_UPTIME_FAST
+ rb_define_const(rb_mProcess, "CLOCK_UPTIME_FAST", CLOCKID2NUM(CLOCK_UPTIME_FAST));
+#endif
+#ifdef CLOCK_UPTIME_PRECISE
+ rb_define_const(rb_mProcess, "CLOCK_UPTIME_PRECISE", CLOCKID2NUM(CLOCK_UPTIME_PRECISE));
+#endif
+#ifdef CLOCK_SECOND
+ rb_define_const(rb_mProcess, "CLOCK_SECOND", CLOCKID2NUM(CLOCK_SECOND));
+#endif
+ rb_define_module_function(rb_mProcess, "clock_gettime", rb_clock_gettime, -1);
+ rb_define_module_function(rb_mProcess, "clock_getres", rb_clock_getres, -1);
+
#if defined(HAVE_TIMES) || defined(_WIN32)
- rb_cProcessTms = rb_struct_define("Tms", "utime", "stime", "cutime", "cstime", NULL);
+ rb_cProcessTms = rb_struct_define_under(rb_mProcess, "Tms", "utime", "stime", "cutime", "cstime", NULL);
+ rb_define_const(rb_cStruct, "Tms", rb_cProcessTms); /* for the backward compatibility */
#endif
SAVED_USER_ID = geteuid();
diff --git a/random.c b/random.c
index 4cb6aee773..a1deecf5d7 100644
--- a/random.c
+++ b/random.c
@@ -60,6 +60,7 @@ The original copyright notice follows.
*/
#include "ruby/ruby.h"
+#include "internal.h"
#include <limits.h>
#ifdef HAVE_UNISTD_H
@@ -204,12 +205,12 @@ genrand_real(struct MT *mt)
}
/* generates a random number on [0,1] with 53-bit resolution*/
-static double int_pair_to_real_inclusive(unsigned int a, unsigned int b);
+static double int_pair_to_real_inclusive(uint32_t a, uint32_t b);
static double
genrand_real2(struct MT *mt)
{
/* mt must be initialized */
- unsigned int a = genrand_int32(mt), b = genrand_int32(mt);
+ uint32_t a = genrand_int32(mt), b = genrand_int32(mt);
return int_pair_to_real_inclusive(a, b);
}
@@ -260,42 +261,30 @@ rb_genrand_real(void)
return genrand_real(mt);
}
-#define BDIGITS(x) (RBIGNUM_DIGITS(x))
-#define BITSPERDIG (SIZEOF_BDIGITS*CHAR_BIT)
-#define BIGRAD ((BDIGIT_DBL)1 << BITSPERDIG)
-#define DIGSPERINT (SIZEOF_INT/SIZEOF_BDIGITS)
-#define BIGUP(x) ((BDIGIT_DBL)(x) << BITSPERDIG)
-#define BIGDN(x) RSHIFT((x),BITSPERDIG)
-#define BIGLO(x) ((BDIGIT)((x) & (BIGRAD-1)))
-#define BDIGMAX ((BDIGIT)-1)
-
-#define roomof(n, m) (int)(((n)+(m)-1) / (m))
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
#define SIZEOF_INT32 (31/CHAR_BIT + 1)
static double
-int_pair_to_real_inclusive(unsigned int a, unsigned int b)
+int_pair_to_real_inclusive(uint32_t a, uint32_t b)
{
- VALUE x = rb_big_new(roomof(64, BITSPERDIG), 1);
- VALUE m = rb_big_new(roomof(53, BITSPERDIG), 1);
- BDIGIT *xd = BDIGITS(x);
- int i = 0;
+ VALUE x;
+ VALUE m;
+ uint32_t xary[2], mary[2];
double r;
- xd[i++] = (BDIGIT)b;
-#if BITSPERDIG < 32
- xd[i++] = (BDIGIT)(b >> BITSPERDIG);
-#endif
- xd[i++] = (BDIGIT)a;
-#if BITSPERDIG < 32
- xd[i++] = (BDIGIT)(a >> BITSPERDIG);
-#endif
- xd = BDIGITS(m);
-#if BITSPERDIG < 53
- MEMZERO(xd, BDIGIT, roomof(53, BITSPERDIG) - 1);
-#endif
- xd[53 / BITSPERDIG] = 1 << 53 % BITSPERDIG;
- xd[0] |= 1;
+ /* (a << 32) | b */
+ xary[0] = a;
+ xary[1] = b;
+ x = rb_integer_unpack(xary, 2, sizeof(uint32_t), 0,
+ INTEGER_PACK_MSWORD_FIRST|INTEGER_PACK_NATIVE_BYTE_ORDER|
+ INTEGER_PACK_FORCE_BIGNUM);
+
+ /* (1 << 53) | 1 */
+ mary[0] = 0x00200000;
+ mary[1] = 0x00000001;
+ m = rb_integer_unpack(mary, 2, sizeof(uint32_t), 0,
+ INTEGER_PACK_MSWORD_FIRST|INTEGER_PACK_NATIVE_BYTE_ORDER|
+ INTEGER_PACK_FORCE_BIGNUM);
+
x = rb_big_mul(x, m);
if (FIXNUM_P(x)) {
#if CHAR_BIT * SIZEOF_LONG > 64
@@ -305,21 +294,11 @@ int_pair_to_real_inclusive(unsigned int a, unsigned int b)
#endif
}
else {
-#if 64 % BITSPERDIG == 0
- long len = RBIGNUM_LEN(x);
- xd = BDIGITS(x);
- MEMMOVE(xd, xd + 64 / BITSPERDIG, BDIGIT, len - 64 / BITSPERDIG);
- MEMZERO(xd + len - 64 / BITSPERDIG, BDIGIT, 64 / BITSPERDIG);
- r = rb_big2dbl(x);
-#else
- x = rb_big_rshift(x, INT2FIX(64));
- if (FIXNUM_P(x)) {
- r = (double)FIX2ULONG(x);
- }
- else {
- r = rb_big2dbl(x);
- }
-#endif
+ uint32_t uary[4];
+ rb_integer_pack(x, uary, numberof(uary), sizeof(uint32_t), 0,
+ INTEGER_PACK_MSWORD_FIRST|INTEGER_PACK_NATIVE_BYTE_ORDER);
+ /* r = x >> 64 */
+ r = (double)uary[0] * (0x10000 * (double)0x10000) + (double)uary[1];
}
return ldexp(r, -53);
}
@@ -356,6 +335,7 @@ static const rb_data_type_t random_data_type = {
random_free,
random_memsize,
},
+ NULL, NULL, RUBY_TYPED_FREE_IMMEDIATELY
};
static rb_random_t *
@@ -390,60 +370,30 @@ static VALUE
rand_init(struct MT *mt, VALUE vseed)
{
volatile VALUE seed;
- long blen = 0;
- long fixnum_seed;
- int i, j, len;
- unsigned int buf0[SIZEOF_LONG / SIZEOF_INT32 * 4], *buf = buf0;
+ uint32_t buf0[SIZEOF_LONG / SIZEOF_INT32 * 4], *buf = buf0;
+ size_t len;
+ int sign;
seed = rb_to_int(vseed);
- switch (TYPE(seed)) {
- case T_FIXNUM:
- len = 1;
- fixnum_seed = FIX2LONG(seed);
- if (fixnum_seed < 0)
- fixnum_seed = -fixnum_seed;
- buf[0] = (unsigned int)(fixnum_seed & 0xffffffff);
-#if SIZEOF_LONG > SIZEOF_INT32
- if ((long)(int32_t)fixnum_seed != fixnum_seed) {
- if ((buf[1] = (unsigned int)(fixnum_seed >> 32)) != 0) ++len;
- }
-#endif
- break;
- case T_BIGNUM:
- blen = RBIGNUM_LEN(seed);
- if (blen == 0) {
- len = 1;
- }
- else {
- if (blen > MT_MAX_STATE * SIZEOF_INT32 / SIZEOF_BDIGITS)
- blen = MT_MAX_STATE * SIZEOF_INT32 / SIZEOF_BDIGITS;
- len = roomof((int)blen * SIZEOF_BDIGITS, SIZEOF_INT32);
- }
- /* allocate ints for init_by_array */
- if (len > numberof(buf0)) buf = ALLOC_N(unsigned int, len);
- memset(buf, 0, len * sizeof(*buf));
- len = 0;
- for (i = (int)(blen-1); 0 <= i; i--) {
- j = i * SIZEOF_BDIGITS / SIZEOF_INT32;
-#if SIZEOF_BDIGITS < SIZEOF_INT32
- buf[j] <<= BITSPERDIG;
-#endif
- buf[j] |= RBIGNUM_DIGITS(seed)[i];
- if (!len && buf[j]) len = j;
- }
- ++len;
- break;
- default:
- rb_raise(rb_eTypeError, "failed to convert %s into Integer",
- rb_obj_classname(vseed));
+
+ len = rb_absint_numwords(seed, 32, NULL);
+ if (len > numberof(buf0))
+ buf = ALLOC_N(unsigned int, len);
+ sign = rb_integer_pack(seed, buf, len, sizeof(uint32_t), 0,
+ INTEGER_PACK_LSWORD_FIRST|INTEGER_PACK_NATIVE_BYTE_ORDER);
+ if (sign < 0)
+ sign = -sign;
+ if (len == 0) {
+ buf[0] = 0;
+ len = 1;
}
if (len <= 1) {
init_genrand(mt, buf[0]);
}
else {
- if (buf[len-1] == 1) /* remove leading-zero-guard */
+ if (sign != 2 && buf[len-1] == 1) /* remove leading-zero-guard */
len--;
- init_by_array(mt, buf, len);
+ init_by_array(mt, buf, (int)len);
}
if (buf != buf0) xfree(buf);
return seed;
@@ -476,7 +426,7 @@ random_init(int argc, VALUE *argv, VALUE obj)
return obj;
}
-#define DEFAULT_SEED_LEN (DEFAULT_SEED_CNT * (int)sizeof(int))
+#define DEFAULT_SEED_LEN (DEFAULT_SEED_CNT * (int)sizeof(int32_t))
#if defined(S_ISCHR) && !defined(DOSISH)
# define USE_DEV_URANDOM 1
@@ -485,7 +435,7 @@ random_init(int argc, VALUE *argv, VALUE obj)
#endif
static void
-fill_random_seed(unsigned int seed[DEFAULT_SEED_CNT])
+fill_random_seed(uint32_t seed[DEFAULT_SEED_CNT])
{
static int n = 0;
struct timeval tv;
@@ -524,40 +474,39 @@ fill_random_seed(unsigned int seed[DEFAULT_SEED_CNT])
gettimeofday(&tv, 0);
seed[0] ^= tv.tv_usec;
- seed[1] ^= (unsigned int)tv.tv_sec;
+ seed[1] ^= (uint32_t)tv.tv_sec;
#if SIZEOF_TIME_T > SIZEOF_INT
- seed[0] ^= (unsigned int)((time_t)tv.tv_sec >> SIZEOF_INT * CHAR_BIT);
+ seed[0] ^= (uint32_t)((time_t)tv.tv_sec >> SIZEOF_INT * CHAR_BIT);
#endif
seed[2] ^= getpid() ^ (n++ << 16);
- seed[3] ^= (unsigned int)(VALUE)&seed;
+ seed[3] ^= (uint32_t)(VALUE)&seed;
#if SIZEOF_VOIDP > SIZEOF_INT
- seed[2] ^= (unsigned int)((VALUE)&seed >> SIZEOF_INT * CHAR_BIT);
+ seed[2] ^= (uint32_t)((VALUE)&seed >> SIZEOF_INT * CHAR_BIT);
#endif
}
static VALUE
-make_seed_value(const void *ptr)
+make_seed_value(const uint32_t *ptr)
{
- const long len = DEFAULT_SEED_LEN/SIZEOF_BDIGITS;
- BDIGIT *digits;
- NEWOBJ_OF(big, struct RBignum, rb_cBignum, T_BIGNUM);
-
- RBIGNUM_SET_SIGN(big, 1);
- rb_big_resize((VALUE)big, len + 1);
- digits = RBIGNUM_DIGITS(big);
-
- MEMCPY(digits, ptr, char, DEFAULT_SEED_LEN);
+ VALUE seed;
+ size_t len;
+ uint32_t buf[DEFAULT_SEED_CNT+1];
+
+ if (ptr[DEFAULT_SEED_CNT-1] <= 1) {
+ /* set leading-zero-guard */
+ MEMCPY(buf, ptr, uint32_t, DEFAULT_SEED_CNT);
+ buf[DEFAULT_SEED_CNT] = 1;
+ ptr = buf;
+ len = DEFAULT_SEED_CNT+1;
+ }
+ else {
+ len = DEFAULT_SEED_CNT;
+ }
- /* set leading-zero-guard if need. */
- digits[len] =
-#if SIZEOF_INT32 / SIZEOF_BDIGITS > 1
- digits[len-2] <= 1 && digits[len-1] == 0
-#else
- digits[len-1] <= 1
-#endif
- ? 1 : 0;
+ seed = rb_integer_unpack(ptr, len, sizeof(uint32_t), 0,
+ INTEGER_PACK_LSWORD_FIRST|INTEGER_PACK_NATIVE_BYTE_ORDER);
- return rb_big_norm((VALUE)big);
+ return seed;
}
/*
@@ -571,7 +520,7 @@ make_seed_value(const void *ptr)
static VALUE
random_seed(void)
{
- unsigned int buf[DEFAULT_SEED_CNT];
+ uint32_t buf[DEFAULT_SEED_CNT];
fill_random_seed(buf);
return make_seed_value(buf);
}
@@ -617,23 +566,9 @@ random_copy(VALUE obj, VALUE orig)
static VALUE
mt_state(const struct MT *mt)
{
- VALUE bigo = rb_big_new(sizeof(mt->state) / sizeof(BDIGIT), 1);
- BDIGIT *d = RBIGNUM_DIGITS(bigo);
- int i;
-
- for (i = 0; i < numberof(mt->state); ++i) {
- unsigned int x = mt->state[i];
-#if SIZEOF_BDIGITS < SIZEOF_INT32
- int j;
- for (j = 0; j < SIZEOF_INT32 / SIZEOF_BDIGITS; ++j) {
- *d++ = BIGLO(x);
- x = BIGDN(x);
- }
-#else
- *d++ = (BDIGIT)x;
-#endif
- }
- return rb_big_norm(bigo);
+ return rb_integer_unpack(mt->state, numberof(mt->state),
+ sizeof(*mt->state), 0,
+ INTEGER_PACK_LSWORD_FIRST|INTEGER_PACK_NATIVE_BYTE_ORDER);
}
/* :nodoc: */
@@ -687,12 +622,12 @@ random_load(VALUE obj, VALUE dump)
rb_random_t *rnd = get_rnd(obj);
struct MT *mt = &rnd->mt;
VALUE state, left = INT2FIX(1), seed = INT2FIX(0);
- VALUE *ary;
+ const VALUE *ary;
unsigned long x;
rb_check_copyable(obj, dump);
Check_Type(dump, T_ARRAY);
- ary = RARRAY_PTR(dump);
+ ary = RARRAY_CONST_PTR(dump);
switch (RARRAY_LEN(dump)) {
case 3:
seed = ary[2];
@@ -704,60 +639,9 @@ random_load(VALUE obj, VALUE dump)
default:
rb_raise(rb_eArgError, "wrong dump data");
}
- memset(mt->state, 0, sizeof(mt->state));
- if (FIXNUM_P(state)) {
- x = FIX2ULONG(state);
- mt->state[0] = (unsigned int)x;
-#if SIZEOF_LONG / SIZEOF_INT >= 2
- mt->state[1] = (unsigned int)(x >> BITSPERDIG);
-#endif
-#if SIZEOF_LONG / SIZEOF_INT >= 3
- mt->state[2] = (unsigned int)(x >> 2 * BITSPERDIG);
-#endif
-#if SIZEOF_LONG / SIZEOF_INT >= 4
- mt->state[3] = (unsigned int)(x >> 3 * BITSPERDIG);
-#endif
- }
- else {
- BDIGIT *d;
- long len;
- Check_Type(state, T_BIGNUM);
- len = RBIGNUM_LEN(state);
- if (len > roomof(sizeof(mt->state), SIZEOF_BDIGITS)) {
- len = roomof(sizeof(mt->state), SIZEOF_BDIGITS);
- }
-#if SIZEOF_BDIGITS < SIZEOF_INT
- else if (len % DIGSPERINT) {
- d = RBIGNUM_DIGITS(state) + len;
-# if DIGSPERINT == 2
- --len;
- x = *--d;
-# else
- x = 0;
- do {
- x = (x << BITSPERDIG) | *--d;
- } while (--len % DIGSPERINT);
-# endif
- mt->state[len / DIGSPERINT] = (unsigned int)x;
- }
-#endif
- if (len > 0) {
- d = BDIGITS(state) + len;
- do {
- --len;
- x = *--d;
-# if DIGSPERINT == 2
- --len;
- x = (x << BITSPERDIG) | *--d;
-# elif SIZEOF_BDIGITS < SIZEOF_INT
- do {
- x = (x << BITSPERDIG) | *--d;
- } while (--len % DIGSPERINT);
-# endif
- mt->state[len / DIGSPERINT] = (unsigned int)x;
- } while (len > 0);
- }
- }
+ rb_integer_pack(state, mt->state, numberof(mt->state),
+ sizeof(*mt->state), 0,
+ INTEGER_PACK_LSWORD_FIRST|INTEGER_PACK_NATIVE_BYTE_ORDER);
x = NUM2ULONG(left);
if (x > numberof(mt->state)) {
rb_raise(rb_eArgError, "wrong value");
@@ -798,7 +682,6 @@ rb_f_srand(int argc, VALUE *argv, VALUE obj)
VALUE seed, old;
rb_random_t *r = &default_rand;
- rb_secure(4);
if (argc == 0) {
seed = random_seed();
}
@@ -848,39 +731,33 @@ limited_rand(struct MT *mt, unsigned long limit)
}
static VALUE
-limited_big_rand(struct MT *mt, struct RBignum *limit)
+limited_big_rand(struct MT *mt, VALUE limit)
{
/* mt must be initialized */
- unsigned long mask, lim, rnd;
- struct RBignum *val;
- long i, len;
+
+ uint32_t mask;
+ long i;
int boundary;
- len = (RBIGNUM_LEN(limit) * SIZEOF_BDIGITS + 3) / 4;
- val = (struct RBignum *)rb_big_clone((VALUE)limit);
- RBIGNUM_SET_SIGN(val, 1);
-#if SIZEOF_BDIGITS == 2
-# define BIG_GET32(big,i) \
- (RBIGNUM_DIGITS(big)[(i)*2] | \
- ((i)*2+1 < RBIGNUM_LEN(big) ? \
- (RBIGNUM_DIGITS(big)[(i)*2+1] << 16) : \
- 0))
-# define BIG_SET32(big,i,d) \
- ((RBIGNUM_DIGITS(big)[(i)*2] = (d) & 0xffff), \
- ((i)*2+1 < RBIGNUM_LEN(big) ? \
- (RBIGNUM_DIGITS(big)[(i)*2+1] = (d) >> 16) : \
- 0))
-#else
- /* SIZEOF_BDIGITS == 4 */
-# define BIG_GET32(big,i) (RBIGNUM_DIGITS(big)[(i)])
-# define BIG_SET32(big,i,d) (RBIGNUM_DIGITS(big)[(i)] = (d))
-#endif
+ size_t len;
+ uint32_t *tmp, *lim_array, *rnd_array;
+ VALUE vtmp;
+ VALUE val;
+
+ len = rb_absint_numwords(limit, 32, NULL);
+ tmp = ALLOCV_N(uint32_t, vtmp, len*2);
+ lim_array = tmp;
+ rnd_array = tmp + len;
+ rb_integer_pack(limit, lim_array, len, sizeof(uint32_t), 0,
+ INTEGER_PACK_LSWORD_FIRST|INTEGER_PACK_NATIVE_BYTE_ORDER);
+
retry:
mask = 0;
boundary = 1;
for (i = len-1; 0 <= i; i--) {
- lim = BIG_GET32(limit, i);
- mask = mask ? 0xffffffff : make_mask(lim);
+ uint32_t rnd;
+ uint32_t lim = lim_array[i];
+ mask = mask ? 0xffffffff : (uint32_t)make_mask(lim);
if (mask) {
rnd = genrand_int32(mt) & mask;
if (boundary) {
@@ -893,9 +770,13 @@ limited_big_rand(struct MT *mt, struct RBignum *limit)
else {
rnd = 0;
}
- BIG_SET32(val, i, (BDIGIT)rnd);
+ rnd_array[i] = rnd;
}
- return rb_big_norm((VALUE)val);
+ val = rb_integer_unpack(rnd_array, len, sizeof(uint32_t), 0,
+ INTEGER_PACK_LSWORD_FIRST|INTEGER_PACK_NATIVE_BYTE_ORDER);
+ ALLOCV_END(vtmp);
+
+ return val;
}
/*
@@ -1057,10 +938,9 @@ rand_int(struct MT *mt, VALUE vmax, int restrictive)
else {
VALUE ret;
if (rb_bigzero_p(vmax)) return Qnil;
- if (!RBIGNUM_SIGN(vmax)) {
+ if (!BIGNUM_SIGN(vmax)) {
if (restrictive) return Qnil;
- vmax = rb_big_clone(vmax);
- RBIGNUM_SET_SIGN(vmax, 1);
+ vmax = rb_big_uminus(vmax);
}
vmax = rb_big_minus(vmax, INT2FIX(1));
if (FIXNUM_P(vmax)) {
@@ -1069,7 +949,7 @@ rand_int(struct MT *mt, VALUE vmax, int restrictive)
r = limited_rand(mt, max);
return LONG2NUM(r);
}
- ret = limited_big_rand(mt, RBIGNUM(vmax));
+ ret = limited_big_rand(mt, vmax);
RB_GC_GUARD(vmax);
return ret;
}
@@ -1105,13 +985,13 @@ rand_range(struct MT* mt, VALUE range)
v = ULONG2NUM(r);
}
}
- else if (BUILTIN_TYPE(vmax) == T_BIGNUM && RBIGNUM_SIGN(vmax) && !rb_bigzero_p(vmax)) {
+ else if (BUILTIN_TYPE(vmax) == T_BIGNUM && BIGNUM_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 = limited_big_rand(mt, RBIGNUM(vmax));
+ v = limited_big_rand(mt, vmax);
}
}
else if (v = rb_check_to_float(vmax), !NIL_P(v)) {
@@ -1372,7 +1252,7 @@ static union {
} sipseed;
static VALUE
-init_randomseed(struct MT *mt, unsigned int initial[DEFAULT_SEED_CNT])
+init_randomseed(struct MT *mt, uint32_t initial[DEFAULT_SEED_CNT])
{
VALUE seed;
fill_random_seed(initial);
@@ -1386,7 +1266,7 @@ void
Init_RandomSeed(void)
{
rb_random_t *r = &default_rand;
- unsigned int initial[DEFAULT_SEED_CNT];
+ uint32_t initial[DEFAULT_SEED_CNT];
struct MT *mt = &r->mt;
VALUE seed = init_randomseed(mt, initial);
int i;
@@ -1435,7 +1315,7 @@ Init_RandomSeed2(void)
VALUE seed = default_rand.seed;
if (RB_TYPE_P(seed, T_BIGNUM)) {
- RBASIC(seed)->klass = rb_cBignum;
+ rb_obj_reveal(seed, rb_cBignum);
}
}
@@ -1472,7 +1352,7 @@ rb_reset_random_seed(void)
*/
void
-Init_Random(void)
+InitVM_Random(void)
{
Init_RandomSeed2();
rb_define_global_function("srand", rb_f_srand, -1);
@@ -1494,6 +1374,7 @@ Init_Random(void)
{
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). */
rb_define_const(rb_cRandom, "DEFAULT", rand_default);
}
@@ -1502,7 +1383,14 @@ Init_Random(void)
rb_define_singleton_method(rb_cRandom, "new_seed", random_seed, 0);
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);
+}
+#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 e2e8388c43..0a67b6f7c3 100644
--- a/range.c
+++ b/range.c
@@ -25,9 +25,12 @@ 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])
#define RANGE_EXCL(r) (RSTRUCT(r)->as.ary[2])
+#define RANGE_SET_BEG(r, v) (RSTRUCT_SET(r, 0, v))
+#define RANGE_SET_END(r, v) (RSTRUCT_SET(r, 1, v))
+#define RANGE_SET_EXCL(r, v) (RSTRUCT_SET(r, 2, v))
+#define RBOOL(v) ((v) ? Qtrue : Qfalse)
#define EXCL(r) RTEST(RANGE_EXCL(r))
-#define SET_EXCL(r,v) (RSTRUCT(r)->as.ary[2] = (v) ? Qtrue : Qfalse)
static VALUE
range_failed(void)
@@ -43,7 +46,7 @@ range_check(VALUE *args)
}
static void
-range_init(VALUE range, VALUE beg, VALUE end, int exclude_end)
+range_init(VALUE range, VALUE beg, VALUE end, VALUE exclude_end)
{
VALUE args[2];
@@ -58,9 +61,9 @@ range_init(VALUE range, VALUE beg, VALUE end, int exclude_end)
range_failed();
}
- SET_EXCL(range, exclude_end);
- RSTRUCT(range)->as.ary[0] = beg;
- RSTRUCT(range)->as.ary[1] = end;
+ RANGE_SET_EXCL(range, exclude_end);
+ RANGE_SET_BEG(range, beg);
+ RANGE_SET_END(range, end);
}
VALUE
@@ -68,10 +71,19 @@ rb_range_new(VALUE beg, VALUE end, int exclude_end)
{
VALUE range = rb_obj_alloc(rb_cRange);
- range_init(range, beg, end, exclude_end);
+ range_init(range, beg, end, RBOOL(exclude_end));
return range;
}
+static void
+range_modify(VALUE range)
+{
+ /* Ranges are immutable, so that they should be initialized only once. */
+ if (RANGE_EXCL(range) != Qnil) {
+ rb_name_error(idInitialize, "`initialize' called twice");
+ }
+}
+
/*
* call-seq:
* Range.new(begin, end, exclude_end=false) -> rng
@@ -87,15 +99,19 @@ range_initialize(int argc, VALUE *argv, VALUE range)
VALUE beg, end, flags;
rb_scan_args(argc, argv, "21", &beg, &end, &flags);
- /* Ranges are immutable, so that they should be initialized only once. */
- if (RANGE_EXCL(range) != Qnil) {
- rb_name_error(idInitialize, "`initialize' called twice");
- }
- range_init(range, beg, end, RTEST(flags));
+ range_modify(range);
+ range_init(range, beg, end, RBOOL(RTEST(flags)));
return Qnil;
}
-#define range_initialize_copy rb_struct_init_copy /* :nodoc: */
+/* :nodoc: */
+static VALUE
+range_initialize_copy(VALUE range, VALUE orig)
+{
+ range_modify(range);
+ rb_struct_init_copy(range, orig);
+ return range;
+}
/*
* call-seq:
@@ -220,25 +236,6 @@ 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
@@ -246,16 +243,29 @@ recursive_hash(VALUE range, VALUE dummy, int recur)
* 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)
{
- return rb_exec_recursive_outer(recursive_hash, range, 0);
+ 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);
}
static void
-range_each_func(VALUE range, VALUE (*func) (VALUE, void *), void *arg)
+range_each_func(VALUE range, rb_block_call_func *func, VALUE arg)
{
int c;
VALUE b = RANGE_BEG(range);
@@ -264,13 +274,13 @@ range_each_func(VALUE range, VALUE (*func) (VALUE, void *), void *arg)
if (EXCL(range)) {
while (r_lt(v, e)) {
- (*func) (v, arg);
+ (*func) (v, arg, 0, 0, 0);
v = rb_funcall(v, id_succ, 0, 0);
}
}
else {
while ((c = r_le(v, e)) != Qfalse) {
- (*func) (v, arg);
+ (*func) (v, arg, 0, 0, 0);
if (c == (int)INT2FIX(0))
break;
v = rb_funcall(v, id_succ, 0, 0);
@@ -279,9 +289,9 @@ range_each_func(VALUE range, VALUE (*func) (VALUE, void *), void *arg)
}
static VALUE
-sym_step_i(VALUE i, void *arg)
+sym_step_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, arg))
{
- VALUE *iter = arg;
+ VALUE *iter = (VALUE *)arg;
if (FIXNUM_P(iter[0])) {
iter[0] -= INT2FIX(1) & ~FIXNUM_FLAG;
@@ -297,9 +307,9 @@ sym_step_i(VALUE i, void *arg)
}
static VALUE
-step_i(VALUE i, void *arg)
+step_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, arg))
{
- VALUE *iter = arg;
+ VALUE *iter = (VALUE *)arg;
if (FIXNUM_P(iter[0])) {
iter[0] -= INT2FIX(1) & ~FIXNUM_FLAG;
@@ -322,12 +332,12 @@ discrete_object_p(VALUE obj)
}
static VALUE
-range_step_size(VALUE range, VALUE args)
+range_step_size(VALUE range, VALUE args, VALUE eobj)
{
VALUE b = RANGE_BEG(range), e = RANGE_END(range);
VALUE step = INT2FIX(1);
if (args) {
- step = RARRAY_PTR(args)[0];
+ step = RARRAY_AREF(args, 0);
if (!rb_obj_is_kind_of(step, rb_cNumeric)) {
step = rb_to_int(step);
}
@@ -340,7 +350,7 @@ range_step_size(VALUE range, VALUE args)
}
if (rb_obj_is_kind_of(b, rb_cNumeric) && rb_obj_is_kind_of(e, rb_cNumeric)) {
- return num_interval_step_size(b, e, step, EXCL(range));
+ return ruby_num_interval_step_size(b, e, step, EXCL(range));
}
return Qnil;
}
@@ -465,7 +475,7 @@ range_step(int argc, VALUE *argv, VALUE range)
}
args[0] = INT2FIX(1);
args[1] = step;
- range_each_func(range, step_i, args);
+ range_each_func(range, step_i, (VALUE)args);
}
}
return range;
@@ -524,7 +534,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 i.
+ * equal to x.
*
* If x is within the range, this method returns the value x.
* Otherwise, it returns nil.
@@ -679,14 +689,14 @@ range_bsearch(VALUE range)
}
static VALUE
-each_i(VALUE v, void *arg)
+each_i(RB_BLOCK_CALL_FUNC_ARGLIST(v, arg))
{
rb_yield(v);
return Qnil;
}
static VALUE
-sym_each_i(VALUE v, void *arg)
+sym_each_i(RB_BLOCK_CALL_FUNC_ARGLIST(v, arg))
{
rb_yield(rb_str_intern(v));
return Qnil;
@@ -696,9 +706,12 @@ sym_each_i(VALUE v, void *arg)
* call-seq:
* rng.size -> num
*
- * Returns the number of elements in the range.
+ * Returns the number of elements in the range. Both the begin and the end of
+ * the Range must be Numeric, otherwise nil is returned.
*
* (10..20).size #=> 11
+ * ('a'..'z').size #=> nil
+ * (-Float::INFINITY..Float::INFINITY).size #=> Infinity
*/
static VALUE
@@ -706,11 +719,17 @@ range_size(VALUE range)
{
VALUE b = RANGE_BEG(range), e = RANGE_END(range);
if (rb_obj_is_kind_of(b, rb_cNumeric) && rb_obj_is_kind_of(e, rb_cNumeric)) {
- return num_interval_step_size(b, e, INT2FIX(1), EXCL(range));
+ return ruby_num_interval_step_size(b, e, INT2FIX(1), EXCL(range));
}
return Qnil;
}
+static VALUE
+range_enum_size(VALUE range, VALUE args, VALUE eobj)
+{
+ return range_size(range);
+}
+
/*
* call-seq:
* rng.each {| i | block } -> rng
@@ -737,7 +756,7 @@ range_each(VALUE range)
{
VALUE beg, end;
- RETURN_SIZED_ENUMERATOR(range, 0, 0, range_size);
+ RETURN_SIZED_ENUMERATOR(range, 0, 0, range_enum_size);
beg = RANGE_BEG(range);
end = RANGE_END(range);
@@ -767,14 +786,14 @@ range_each(VALUE range)
args[0] = end;
args[1] = EXCL(range) ? Qtrue : Qfalse;
- rb_block_call(tmp, rb_intern("upto"), 2, args, rb_yield, 0);
+ rb_block_call(tmp, rb_intern("upto"), 2, args, each_i, 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, NULL);
+ range_each_func(range, each_i, 0);
}
}
return range;
@@ -815,8 +834,9 @@ range_end(VALUE range)
static VALUE
-first_i(VALUE i, VALUE *ary)
+first_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, cbarg))
{
+ VALUE *ary = (VALUE *)cbarg;
long n = NUM2LONG(ary[0]);
if (n <= 0) {
@@ -883,8 +903,10 @@ range_last(int argc, VALUE *argv, VALUE range)
/*
* call-seq:
- * rng.min -> obj
- * rng.min {| a,b | block } -> obj
+ * rng.min -> obj
+ * rng.min {| a,b | block } -> obj
+ * rng.min(n) -> array
+ * rng.min(n) {| a,b | block } -> array
*
* Returns the minimum value in the range. Returns +nil+ if the begin
* value of the range is larger than the end value.
@@ -897,10 +919,13 @@ range_last(int argc, VALUE *argv, VALUE range)
static VALUE
-range_min(VALUE range)
+range_min(int argc, VALUE *argv, VALUE range)
{
if (rb_block_given_p()) {
- return rb_call_super(0, 0);
+ return rb_call_super(argc, argv);
+ }
+ else if (argc != 0) {
+ return range_first(argc, argv, range);
}
else {
VALUE b = RANGE_BEG(range);
@@ -915,8 +940,10 @@ range_min(VALUE range)
/*
* call-seq:
- * rng.max -> obj
- * rng.max {| a,b | block } -> obj
+ * rng.max -> obj
+ * rng.max {| a,b | block } -> obj
+ * rng.max(n) -> obj
+ * rng.max(n) {| 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.
@@ -928,13 +955,13 @@ range_min(VALUE range)
*/
static VALUE
-range_max(VALUE range)
+range_max(int argc, VALUE *argv, 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)) {
- return rb_call_super(0, 0);
+ if (rb_block_given_p() || (EXCL(range) && !nm) || argc) {
+ return rb_call_super(argc, argv);
}
else {
VALUE b = RANGE_BEG(range);
@@ -1211,7 +1238,7 @@ static VALUE
range_dumper(VALUE range)
{
VALUE v;
- NEWOBJ_OF(m, struct RObject, rb_cObject, T_OBJECT);
+ NEWOBJ_OF(m, struct RObject, rb_cObject, T_OBJECT | (RGENGC_WB_PROTECTED_OBJECT ? FL_WB_PROTECTED : 1));
v = (VALUE)m;
@@ -1228,9 +1255,10 @@ range_loader(VALUE range, VALUE obj)
rb_raise(rb_eTypeError, "not a dumped range object");
}
- RSTRUCT(range)->as.ary[0] = rb_ivar_get(obj, id_beg);
- RSTRUCT(range)->as.ary[1] = rb_ivar_get(obj, id_end);
- RSTRUCT(range)->as.ary[2] = rb_ivar_get(obj, id_excl);
+ range_modify(range);
+ RANGE_SET_BEG(range, rb_ivar_get(obj, id_beg));
+ RANGE_SET_END(range, rb_ivar_get(obj, id_end));
+ RANGE_SET_EXCL(range, rb_ivar_get(obj, id_excl));
return range;
}
@@ -1238,7 +1266,7 @@ static VALUE
range_alloc(VALUE klass)
{
/* rb_struct_alloc_noinit itself should not be used because
- * rb_marshal_define_compat uses equality of allocaiton function */
+ * rb_marshal_define_compat uses equality of allocation function */
return rb_struct_alloc_noinit(klass);
}
@@ -1332,8 +1360,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, 0);
- rb_define_method(rb_cRange, "max", range_max, 0);
+ rb_define_method(rb_cRange, "min", range_min, -1);
+ rb_define_method(rb_cRange, "max", range_max, -1);
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 dd5d24dc69..23b4bb0864 100644
--- a/rational.c
+++ b/rational.c
@@ -17,17 +17,26 @@
#define NDEBUG
#include <assert.h>
+#if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H)
+#define USE_GMP
+#include <gmp.h>
+#endif
+
#define ZERO INT2FIX(0)
#define ONE INT2FIX(1)
#define TWO INT2FIX(2)
+#define GMP_GCD_DIGITS 1
+
VALUE rb_cRational;
static ID id_abs, id_cmp, id_convert, id_eqeq_p, id_expt, id_fdiv,
- id_floor, id_idiv, id_inspect, id_integer_p, id_negate, id_to_f,
- id_to_i, id_to_s, id_truncate, id_i_num, id_i_den;
+ 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)
+#define f_inspect rb_inspect
+#define f_to_s rb_obj_as_string
#define binop(n,op) \
inline static VALUE \
@@ -83,14 +92,6 @@ 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,8 +134,6 @@ f_sub(VALUE x, VALUE y)
}
fun1(abs)
-fun1(floor)
-fun1(inspect)
fun1(integer_p)
fun1(negate)
@@ -153,9 +152,6 @@ f_to_f(VALUE x)
return rb_funcall(x, id_to_f, 0);
}
-fun1(to_s)
-fun1(truncate)
-
inline static VALUE
f_eqeq_p(VALUE x, VALUE y)
{
@@ -183,17 +179,16 @@ f_negative_p(VALUE x)
inline static VALUE
f_zero_p(VALUE x)
{
- switch (TYPE(x)) {
- case T_FIXNUM:
+ if (RB_TYPE_P(x, T_FIXNUM)) {
return f_boolcast(FIX2LONG(x) == 0);
- case T_BIGNUM:
+ }
+ else if (RB_TYPE_P(x, T_BIGNUM)) {
return Qfalse;
- case T_RATIONAL:
- {
- VALUE num = RRATIONAL(x)->num;
+ }
+ else if (RB_TYPE_P(x, T_RATIONAL)) {
+ VALUE num = RRATIONAL(x)->num;
- return f_boolcast(FIXNUM_P(num) && FIX2LONG(num) == 0);
- }
+ return f_boolcast(FIXNUM_P(num) && FIX2LONG(num) == 0);
}
return rb_funcall(x, id_eqeq_p, 1, ZERO);
}
@@ -203,19 +198,18 @@ f_zero_p(VALUE x)
inline static VALUE
f_one_p(VALUE x)
{
- switch (TYPE(x)) {
- case T_FIXNUM:
+ if (RB_TYPE_P(x, T_FIXNUM)) {
return f_boolcast(FIX2LONG(x) == 1);
- case T_BIGNUM:
+ }
+ else if (RB_TYPE_P(x, T_BIGNUM)) {
return Qfalse;
- case T_RATIONAL:
- {
- VALUE num = RRATIONAL(x)->num;
- VALUE den = RRATIONAL(x)->den;
+ }
+ else if (RB_TYPE_P(x, T_RATIONAL)) {
+ VALUE num = RRATIONAL(x)->num;
+ VALUE den = RRATIONAL(x)->den;
- return f_boolcast(FIXNUM_P(num) && FIX2LONG(num) == 1 &&
- FIXNUM_P(den) && FIX2LONG(den) == 1);
- }
+ return f_boolcast(FIXNUM_P(num) && FIX2LONG(num) == 1 &&
+ FIXNUM_P(den) && FIX2LONG(den) == 1);
}
return rb_funcall(x, id_eqeq_p, 1, ONE);
}
@@ -223,19 +217,18 @@ f_one_p(VALUE x)
inline static VALUE
f_minus_one_p(VALUE x)
{
- switch (TYPE(x)) {
- case T_FIXNUM:
+ if (RB_TYPE_P(x, T_FIXNUM)) {
return f_boolcast(FIX2LONG(x) == -1);
- case T_BIGNUM:
+ }
+ else if (RB_TYPE_P(x, T_BIGNUM)) {
return Qfalse;
- case T_RATIONAL:
- {
- VALUE num = RRATIONAL(x)->num;
- VALUE den = RRATIONAL(x)->den;
+ }
+ else if (RB_TYPE_P(x, T_RATIONAL)) {
+ VALUE num = RRATIONAL(x)->num;
+ VALUE den = RRATIONAL(x)->den;
- return f_boolcast(FIXNUM_P(num) && FIX2LONG(num) == -1 &&
- FIXNUM_P(den) && FIX2LONG(den) == 1);
- }
+ return f_boolcast(FIXNUM_P(num) && FIX2LONG(num) == -1 &&
+ FIXNUM_P(den) && FIX2LONG(den) == 1);
}
return rb_funcall(x, id_eqeq_p, 1, INT2FIX(-1));
}
@@ -276,6 +269,32 @@ k_rational_p(VALUE 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))
+#ifdef USE_GMP
+VALUE
+rb_gcd_gmp(VALUE x, VALUE y)
+{
+ const size_t nails = (sizeof(BDIGIT)-SIZEOF_BDIGIT)*CHAR_BIT;
+ mpz_t mx, my, mz;
+ size_t count;
+ VALUE z;
+ long zn;
+
+ 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_gcd(mz, mx, my);
+
+ zn = (mpz_sizeinbase(mz, 16) + SIZEOF_BDIGIT*2 - 1) / (SIZEOF_BDIGIT*2);
+ z = rb_big_new(zn, 1);
+ mpz_export(BIGNUM_DIGITS(z), &count, -1, sizeof(BDIGIT), 0, nails, mz);
+
+ return rb_big_norm(z);
+}
+#endif
+
#ifndef NDEBUG
#define f_gcd f_gcd_orig
#endif
@@ -302,7 +321,7 @@ i_gcd(long x, long y)
}
inline static VALUE
-f_gcd(VALUE x, VALUE y)
+f_gcd_normal(VALUE x, VALUE y)
{
VALUE z;
@@ -333,6 +352,26 @@ f_gcd(VALUE x, VALUE y)
/* NOTREACHED */
}
+VALUE
+rb_gcd_normal(VALUE x, VALUE y)
+{
+ return f_gcd_normal(x, y);
+}
+
+inline static VALUE
+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);
+ if (GMP_GCD_DIGITS <= xn || GMP_GCD_DIGITS <= yn)
+ return rb_gcd_gmp(x, y);
+ }
+#endif
+ return f_gcd_normal(x, y);
+}
+
#ifndef NDEBUG
#undef f_gcd
@@ -365,13 +404,16 @@ 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)
{
- NEWOBJ_OF(obj, struct RRational, klass, T_RATIONAL);
+ NEWOBJ_OF(obj, struct RRational, klass, T_RATIONAL | (RGENGC_WB_PROTECTED_RATIONAL ? FL_WB_PROTECTED : 0));
- obj->num = num;
- obj->den = den;
+ RRATIONAL_SET_NUM(obj, num);
+ RRATIONAL_SET_DEN(obj, den);
return (VALUE)obj;
}
@@ -424,14 +466,6 @@ 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
@@ -449,11 +483,7 @@ nurat_canonicalization(int f)
inline static void
nurat_int_check(VALUE num)
{
- switch (TYPE(num)) {
- case T_FIXNUM:
- case T_BIGNUM:
- break;
- default:
+ if (!(RB_TYPE_P(num, T_FIXNUM) || RB_TYPE_P(num, T_BIGNUM))) {
if (!k_numeric_p(num) || !f_integer_p(num))
rb_raise(rb_eTypeError, "not an integer");
}
@@ -534,13 +564,6 @@ 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));
@@ -549,13 +572,6 @@ 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));
@@ -571,6 +587,8 @@ 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:
*
@@ -730,9 +748,7 @@ f_addsub(VALUE self, VALUE anum, VALUE aden, VALUE bnum, VALUE bden, int k)
static VALUE
nurat_add(VALUE self, VALUE other)
{
- switch (TYPE(other)) {
- case T_FIXNUM:
- case T_BIGNUM:
+ if (RB_TYPE_P(other, T_FIXNUM) || RB_TYPE_P(other, T_BIGNUM)) {
{
get_dat1(self);
@@ -740,9 +756,11 @@ nurat_add(VALUE self, VALUE other)
dat->num, dat->den,
other, ONE, '+');
}
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(other, T_FLOAT)) {
return f_add(f_to_f(self), other);
- case T_RATIONAL:
+ }
+ else if (RB_TYPE_P(other, T_RATIONAL)) {
{
get_dat2(self, other);
@@ -750,7 +768,8 @@ nurat_add(VALUE self, VALUE other)
adat->num, adat->den,
bdat->num, bdat->den, '+');
}
- default:
+ }
+ else {
return rb_num_coerce_bin(self, other, '+');
}
}
@@ -770,9 +789,7 @@ nurat_add(VALUE self, VALUE other)
static VALUE
nurat_sub(VALUE self, VALUE other)
{
- switch (TYPE(other)) {
- case T_FIXNUM:
- case T_BIGNUM:
+ if (RB_TYPE_P(other, T_FIXNUM) || RB_TYPE_P(other, T_BIGNUM)) {
{
get_dat1(self);
@@ -780,9 +797,11 @@ nurat_sub(VALUE self, VALUE other)
dat->num, dat->den,
other, ONE, '-');
}
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(other, T_FLOAT)) {
return f_sub(f_to_f(self), other);
- case T_RATIONAL:
+ }
+ else if (RB_TYPE_P(other, T_RATIONAL)) {
{
get_dat2(self, other);
@@ -790,7 +809,8 @@ nurat_sub(VALUE self, VALUE other)
adat->num, adat->den,
bdat->num, bdat->den, '-');
}
- default:
+ }
+ else {
return rb_num_coerce_bin(self, other, '-');
}
}
@@ -849,9 +869,7 @@ f_muldiv(VALUE self, VALUE anum, VALUE aden, VALUE bnum, VALUE bden, int k)
static VALUE
nurat_mul(VALUE self, VALUE other)
{
- switch (TYPE(other)) {
- case T_FIXNUM:
- case T_BIGNUM:
+ if (RB_TYPE_P(other, T_FIXNUM) || RB_TYPE_P(other, T_BIGNUM)) {
{
get_dat1(self);
@@ -859,9 +877,11 @@ nurat_mul(VALUE self, VALUE other)
dat->num, dat->den,
other, ONE, '*');
}
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(other, T_FLOAT)) {
return f_mul(f_to_f(self), other);
- case T_RATIONAL:
+ }
+ else if (RB_TYPE_P(other, T_RATIONAL)) {
{
get_dat2(self, other);
@@ -869,7 +889,8 @@ nurat_mul(VALUE self, VALUE other)
adat->num, adat->den,
bdat->num, bdat->den, '*');
}
- default:
+ }
+ else {
return rb_num_coerce_bin(self, other, '*');
}
}
@@ -890,9 +911,7 @@ nurat_mul(VALUE self, VALUE other)
static VALUE
nurat_div(VALUE self, VALUE other)
{
- switch (TYPE(other)) {
- case T_FIXNUM:
- case T_BIGNUM:
+ if (RB_TYPE_P(other, T_FIXNUM) || RB_TYPE_P(other, T_BIGNUM)) {
if (f_zero_p(other))
rb_raise_zerodiv();
{
@@ -902,19 +921,10 @@ nurat_div(VALUE self, VALUE other)
dat->num, dat->den,
other, ONE, '/');
}
- case T_FLOAT:
- {
- double x = RFLOAT_VALUE(other), den;
- get_dat1(self);
-
- if (isnan(x)) return DBL2NUM(NAN);
- if (isinf(x)) return INT2FIX(0);
- if (x != 0.0 && modf(x, &den) == 0.0) {
- return rb_rational_raw2(dat->num, f_mul(rb_dbl2big(den), dat->den));
- }
- }
+ }
+ else if (RB_TYPE_P(other, T_FLOAT))
return rb_funcall(f_to_f(self), '/', 1, other);
- case T_RATIONAL:
+ else if (RB_TYPE_P(other, T_RATIONAL)) {
if (f_zero_p(other))
rb_raise_zerodiv();
{
@@ -928,7 +938,8 @@ nurat_div(VALUE self, VALUE other)
adat->num, adat->den,
bdat->num, bdat->den, '/');
}
- default:
+ }
+ else {
return rb_num_coerce_bin(self, other, '/');
}
}
@@ -958,7 +969,6 @@ f_odd_p(VALUE integer)
return Qtrue;
}
return Qfalse;
-
}
/*
@@ -990,21 +1000,26 @@ nurat_expt(VALUE self, VALUE other)
/* Deal with special cases of 0**n and 1**n */
if (k_numeric_p(other) && k_exact_p(other)) {
get_dat1(self);
- if (f_one_p(dat->den))
- if (f_one_p(dat->num))
+ if (f_one_p(dat->den)) {
+ if (f_one_p(dat->num)) {
return f_rational_new_bang1(CLASS_OF(self), ONE);
- else if (f_minus_one_p(dat->num) && k_integer_p(other))
+ }
+ else if (f_minus_one_p(dat->num) && k_integer_p(other)) {
return f_rational_new_bang1(CLASS_OF(self), INT2FIX(f_odd_p(other) ? -1 : 1));
- else if (f_zero_p(dat->num))
- if (FIX2INT(f_cmp(other, ZERO)) == -1)
+ }
+ else if (f_zero_p(dat->num)) {
+ if (FIX2INT(f_cmp(other, ZERO)) == -1) {
rb_raise_zerodiv();
- else
+ }
+ else {
return f_rational_new_bang1(CLASS_OF(self), ZERO);
+ }
+ }
+ }
}
/* General case */
- switch (TYPE(other)) {
- case T_FIXNUM:
+ if (RB_TYPE_P(other, T_FIXNUM)) {
{
VALUE num, den;
@@ -1026,13 +1041,15 @@ nurat_expt(VALUE self, VALUE other)
}
return f_rational_new2(CLASS_OF(self), num, den);
}
- case T_BIGNUM:
+ }
+ else if (RB_TYPE_P(other, T_BIGNUM)) {
rb_warn("in a**b, b may be too big");
- /* fall through */
- case T_FLOAT:
- case T_RATIONAL:
return f_expt(f_to_f(self), other);
- default:
+ }
+ else if (RB_TYPE_P(other, T_FLOAT) || RB_TYPE_P(other, T_RATIONAL)) {
+ return f_expt(f_to_f(self), other);
+ }
+ else {
return rb_num_coerce_bin(self, other, id_expt);
}
}
@@ -1054,9 +1071,7 @@ nurat_expt(VALUE self, VALUE other)
static VALUE
nurat_cmp(VALUE self, VALUE other)
{
- switch (TYPE(other)) {
- case T_FIXNUM:
- case T_BIGNUM:
+ if (RB_TYPE_P(other, T_FIXNUM) || RB_TYPE_P(other, T_BIGNUM)) {
{
get_dat1(self);
@@ -1064,9 +1079,11 @@ nurat_cmp(VALUE self, VALUE other)
return f_cmp(dat->num, other); /* c14n */
return f_cmp(self, f_rational_new_bang1(CLASS_OF(self), other));
}
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(other, T_FLOAT)) {
return f_cmp(f_to_f(self), other);
- case T_RATIONAL:
+ }
+ else if (RB_TYPE_P(other, T_RATIONAL)) {
{
VALUE num1, num2;
@@ -1083,7 +1100,8 @@ nurat_cmp(VALUE self, VALUE other)
}
return f_cmp(f_sub(num1, num2), ZERO);
}
- default:
+ }
+ else {
return rb_num_coerce_cmp(self, other, id_cmp);
}
}
@@ -1103,9 +1121,7 @@ nurat_cmp(VALUE self, VALUE other)
static VALUE
nurat_eqeq_p(VALUE self, VALUE other)
{
- switch (TYPE(other)) {
- case T_FIXNUM:
- case T_BIGNUM:
+ if (RB_TYPE_P(other, T_FIXNUM) || RB_TYPE_P(other, T_BIGNUM)) {
{
get_dat1(self);
@@ -1120,9 +1136,11 @@ nurat_eqeq_p(VALUE self, VALUE other)
return Qtrue;
return Qfalse;
}
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(other, T_FLOAT)) {
return f_eqeq_p(f_to_f(self), other);
- case T_RATIONAL:
+ }
+ else if (RB_TYPE_P(other, T_RATIONAL)) {
{
get_dat2(self, other);
@@ -1132,7 +1150,8 @@ nurat_eqeq_p(VALUE self, VALUE other)
return f_boolcast(f_eqeq_p(adat->num, bdat->num) &&
f_eqeq_p(adat->den, bdat->den));
}
- default:
+ }
+ else {
return f_eqeq_p(other, self);
}
}
@@ -1141,15 +1160,16 @@ nurat_eqeq_p(VALUE self, VALUE other)
static VALUE
nurat_coerce(VALUE self, VALUE other)
{
- switch (TYPE(other)) {
- case T_FIXNUM:
- case T_BIGNUM:
+ if (RB_TYPE_P(other, T_FIXNUM) || RB_TYPE_P(other, T_BIGNUM)) {
return rb_assoc_new(f_rational_new_bang1(CLASS_OF(self), other), self);
- case T_FLOAT:
+ }
+ else if (RB_TYPE_P(other, T_FLOAT)) {
return rb_assoc_new(other, f_to_f(self));
- case T_RATIONAL:
+ }
+ else if (RB_TYPE_P(other, T_RATIONAL)) {
return rb_assoc_new(other, self);
- case T_COMPLEX:
+ }
+ else if (RB_TYPE_P(other, T_COMPLEX)) {
if (k_exact_zero_p(RCOMPLEX(other)->imag))
return rb_assoc_new(f_rational_new_bang1
(CLASS_OF(self), RCOMPLEX(other)->real), self);
@@ -1636,8 +1656,8 @@ nurat_loader(VALUE self, VALUE a)
{
get_dat1(self);
- dat->num = rb_ivar_get(a, id_i_num);
- dat->den = rb_ivar_get(a, id_i_den);
+ RRATIONAL_SET_NUM(dat, rb_ivar_get(a, id_i_num));
+ RRATIONAL_SET_DEN(dat, rb_ivar_get(a, id_i_den));
return self;
}
@@ -1664,11 +1684,11 @@ nurat_marshal_load(VALUE self, VALUE a)
Check_Type(a, T_ARRAY);
if (RARRAY_LEN(a) != 2)
rb_raise(rb_eArgError, "marshaled rational must have an array whose length is 2 but %ld", RARRAY_LEN(a));
- if (f_zero_p(RARRAY_PTR(a)[1]))
+ if (f_zero_p(RARRAY_AREF(a, 1)))
rb_raise_zerodiv();
- rb_ivar_set(self, id_i_num, RARRAY_PTR(a)[0]);
- rb_ivar_set(self, id_i_den, RARRAY_PTR(a)[1]);
+ rb_ivar_set(self, id_i_num, RARRAY_AREF(a, 0));
+ rb_ivar_set(self, id_i_den, RARRAY_AREF(a, 1));
return self;
}
@@ -1758,6 +1778,18 @@ 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)
@@ -1791,6 +1823,35 @@ numeric_denominator(VALUE self)
return f_denominator(f_to_r(self));
}
+
+/*
+ * call-seq:
+ * num.quo(int_or_rat) -> rat
+ * num.quo(flo) -> flo
+ *
+ * Returns most exact division (rational for integers, float for floats).
+ */
+
+static VALUE
+numeric_quo(VALUE x, VALUE y)
+{
+ if (RB_TYPE_P(y, T_FLOAT)) {
+ return f_fdiv(x, y);
+ }
+
+#ifdef CANON
+ if (canonicalization) {
+ x = rb_rational_raw1(x);
+ }
+ else
+#endif
+ {
+ x = rb_convert_type(x, T_RATIONAL, "Rational", "to_r");
+ }
+ return rb_funcall(x, '/', 1, y);
+}
+
+
/*
* call-seq:
* int.numerator -> self
@@ -1972,6 +2033,60 @@ float_to_r(VALUE self)
#endif
}
+VALUE
+rb_flt_rationalize_with_prec(VALUE flt, VALUE prec)
+{
+ VALUE e, a, b, p, q;
+
+ e = f_abs(prec);
+ a = f_sub(flt, e);
+ b = f_add(flt, e);
+
+ if (f_eqeq_p(a, b))
+ return f_to_r(flt);
+
+ nurat_rationalize_internal(a, b, &p, &q);
+ return rb_rational_new2(p, q);
+}
+
+VALUE
+rb_flt_rationalize(VALUE flt)
+{
+ VALUE a, b, f, n, p, q;
+
+ float_decode_internal(flt, &f, &n);
+ if (f_zero_p(f) || f_positive_p(n))
+ return rb_rational_new1(f_lshift(f, n));
+
+#if FLT_RADIX == 2
+ {
+ VALUE two_times_f, den;
+
+ two_times_f = f_mul(TWO, f);
+ den = f_lshift(ONE, f_sub(ONE, n));
+
+ a = rb_rational_new2(f_sub(two_times_f, ONE), den);
+ b = rb_rational_new2(f_add(two_times_f, ONE), den);
+ }
+#else
+ {
+ VALUE radix_times_f, den;
+
+ radix_times_f = f_mul(INT2FIX(FLT_RADIX), f);
+ den = f_expt(INT2FIX(FLT_RADIX), f_sub(ONE, n));
+
+ a = rb_rational_new2(f_sub(radix_times_f, INT2FIX(FLT_RADIX - 1)), den);
+ b = rb_rational_new2(f_add(radix_times_f, INT2FIX(FLT_RADIX - 1)), den);
+ }
+#endif
+
+ if (f_eqeq_p(a, b))
+ return f_to_r(flt);
+
+ nurat_rationalize_internal(a, b, &p, &q);
+ return rb_rational_new2(p, q);
+}
+
/*
* call-seq:
* flt.rationalize([eps]) -> rational
@@ -1989,53 +2104,19 @@ float_to_r(VALUE self)
static VALUE
float_rationalize(int argc, VALUE *argv, VALUE self)
{
- VALUE e, a, b, p, q;
+ VALUE e;
if (f_negative_p(self))
- return f_negate(float_rationalize(argc, argv, f_abs(self)));
+ return f_negate(float_rationalize(argc, argv, f_abs(self)));
rb_scan_args(argc, argv, "01", &e);
if (argc != 0) {
- e = f_abs(e);
- a = f_sub(self, e);
- b = f_add(self, e);
+ return rb_flt_rationalize_with_prec(self, e);
}
else {
- VALUE f, n;
-
- float_decode_internal(self, &f, &n);
- if (f_zero_p(f) || f_positive_p(n))
- return rb_rational_new1(f_lshift(f, n));
-
-#if FLT_RADIX == 2
- {
- VALUE two_times_f, den;
-
- two_times_f = f_mul(TWO, f);
- den = f_lshift(ONE, f_sub(ONE, n));
-
- a = rb_rational_new2(f_sub(two_times_f, ONE), den);
- b = rb_rational_new2(f_add(two_times_f, ONE), den);
- }
-#else
- {
- VALUE radix_times_f, den;
-
- radix_times_f = f_mul(INT2FIX(FLT_RADIX), f);
- den = f_expt(INT2FIX(FLT_RADIX), f_sub(ONE, n));
-
- a = rb_rational_new2(f_sub(radix_times_f, INT2FIX(FLT_RADIX - 1)), den);
- b = rb_rational_new2(f_add(radix_times_f, INT2FIX(FLT_RADIX - 1)), den);
- }
-#endif
+ return rb_flt_rationalize(self);
}
-
- if (f_eqeq_p(a, b))
- return f_to_r(self);
-
- nurat_rationalize_internal(a, b, &p, &q);
- return rb_rational_new2(p, q);
}
#include <ctype.h>
@@ -2070,13 +2151,14 @@ 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 = ALLOCA_N(char, strlen(*s) + 1);
+ bb = b = ALLOCV_N(char, tmp, strlen(*s) + 1);
while (isdecimal(**s) || **s == '_') {
if (**s == '_') {
@@ -2103,6 +2185,7 @@ read_digits(const char **s, int strict,
conv:
*b = '\0';
*num = rb_cstr_to_inum(bb, 10, 0);
+ ALLOCV_END(tmp);
return ret;
}
@@ -2326,14 +2409,12 @@ nurat_s_convert(int argc, VALUE *argv, VALUE klass)
if (NIL_P(a1) || (argc == 2 && NIL_P(a2)))
rb_raise(rb_eTypeError, "can't convert nil into Rational");
- switch (TYPE(a1)) {
- case T_COMPLEX:
+ if (RB_TYPE_P(a1, T_COMPLEX)) {
if (k_exact_zero_p(RCOMPLEX(a1)->imag))
a1 = RCOMPLEX(a1)->real;
}
- switch (TYPE(a2)) {
- case T_COMPLEX:
+ if (RB_TYPE_P(a2, T_COMPLEX)) {
if (k_exact_zero_p(RCOMPLEX(a2)->imag))
a2 = RCOMPLEX(a2)->real;
}
@@ -2341,34 +2422,23 @@ nurat_s_convert(int argc, VALUE *argv, VALUE klass)
backref = rb_backref_get();
rb_match_busy(backref);
- switch (TYPE(a1)) {
- case T_FIXNUM:
- case T_BIGNUM:
- break;
- case T_FLOAT:
+ if (RB_TYPE_P(a1, T_FLOAT)) {
a1 = f_to_r(a1);
- break;
- case T_STRING:
+ }
+ else if (RB_TYPE_P(a1, T_STRING)) {
a1 = string_to_r_strict(a1);
- break;
}
- switch (TYPE(a2)) {
- case T_FIXNUM:
- case T_BIGNUM:
- break;
- case T_FLOAT:
+ if (RB_TYPE_P(a2, T_FLOAT)) {
a2 = f_to_r(a2);
- break;
- case T_STRING:
+ }
+ else if (RB_TYPE_P(a2, T_STRING)) {
a2 = string_to_r_strict(a2);
- break;
}
rb_backref_set(backref);
- switch (TYPE(a1)) {
- case T_RATIONAL:
+ if (RB_TYPE_P(a1, T_RATIONAL)) {
if (argc == 1 || (k_exact_one_p(a2)))
return a1;
}
@@ -2446,14 +2516,11 @@ 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_inspect = rb_intern("inspect");
id_integer_p = rb_intern("integer?");
id_negate = rb_intern("-@");
id_to_f = rb_intern("to_f");
id_to_i = rb_intern("to_i");
- id_to_s = rb_intern("to_s");
id_truncate = rb_intern("truncate");
id_i_num = rb_intern("@numerator");
id_i_den = rb_intern("@denominator");
@@ -2529,6 +2596,7 @@ Init_Rational(void)
rb_define_method(rb_cNumeric, "numerator", numeric_numerator, 0);
rb_define_method(rb_cNumeric, "denominator", numeric_denominator, 0);
+ rb_define_method(rb_cNumeric, "quo", numeric_quo, 1);
rb_define_method(rb_cInteger, "numerator", integer_numerator, 0);
rb_define_method(rb_cInteger, "denominator", integer_denominator, 0);
@@ -2546,6 +2614,8 @@ 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 4e57971364..d110fe63ef 100644
--- a/re.c
+++ b/re.c
@@ -236,9 +236,9 @@ rb_memsearch(const void *x0, long m, const void *y0, long n, rb_encoding *enc)
return 0;
}
else if (m == 1) {
- const unsigned char *ys;
+ const unsigned char *ys = memchr(y, *x, n);
- if (ys = memchr(y, *x, n))
+ if (ys)
return ys - y;
else
return -1;
@@ -307,10 +307,10 @@ rb_char_to_option_kcode(int c, int *option, int *kcode)
*kcode = rb_ascii8bit_encindex();
return (*option = ARG_ENCODING_NONE);
case 'e':
- *kcode = rb_enc_find_index("EUC-JP");
+ *kcode = ENCINDEX_EUC_JP;
break;
case 's':
- *kcode = rb_enc_find_index("Windows-31J");
+ *kcode = ENCINDEX_Windows_31J;
break;
case 'u':
*kcode = rb_utf8_encindex();
@@ -571,12 +571,15 @@ rb_reg_to_s(VALUE re)
}
if (*ptr == ':' && ptr[len-1] == ')') {
Regexp *rp;
+ VALUE verbose = ruby_verbose;
+ ruby_verbose = Qfalse;
++ptr;
len -= 2;
err = onig_new(&rp, ptr, ptr + len, ONIG_OPTION_DEFAULT,
enc, OnigDefaultSyntax, NULL);
onig_free(rp);
+ ruby_verbose = verbose;
}
if (err) {
options = RREGEXP(re)->ptr->options;
@@ -594,8 +597,30 @@ rb_reg_to_s(VALUE re)
}
rb_str_buf_cat2(str, ":");
- rb_reg_expr_str(str, (char*)ptr, len, enc, NULL);
- rb_str_buf_cat2(str, ")");
+ if (rb_enc_asciicompat(enc)) {
+ rb_reg_expr_str(str, (char*)ptr, len, enc, NULL);
+ rb_str_buf_cat2(str, ")");
+ }
+ else {
+ const char *s, *e;
+ char *paren;
+ ptrdiff_t n;
+ rb_str_buf_cat2(str, ")");
+ rb_enc_associate(str, rb_usascii_encoding());
+ str = rb_str_encode(str, rb_enc_from_encoding(enc), 0, Qnil);
+
+ /* backup encoded ")" to paren */
+ s = RSTRING_PTR(str);
+ e = RSTRING_END(str);
+ s = rb_enc_left_char_head(s, e-1, e, enc);
+ n = e - s;
+ paren = ALLOCA_N(char, n);
+ memcpy(paren, s, n);
+ rb_str_resize(str, RSTRING_LEN(str) - n);
+
+ rb_reg_expr_str(str, (char*)ptr, len, enc, NULL);
+ rb_str_buf_cat(str, paren, n);
+ }
rb_enc_copy(str, re);
OBJ_INFECT(str, re);
@@ -605,9 +630,9 @@ rb_reg_to_s(VALUE re)
static void
rb_reg_raise(const char *s, long len, const char *err, VALUE re)
{
- volatile VALUE desc = rb_reg_desc(s, len, re);
+ VALUE desc = rb_reg_desc(s, len, re);
- rb_raise(rb_eRegexpError, "%s: %s", err, RSTRING_PTR(desc));
+ rb_raise(rb_eRegexpError, "%s: %"PRIsVALUE, err, desc);
}
static VALUE
@@ -847,8 +872,7 @@ match_alloc(VALUE klass)
match->str = 0;
match->rmatch = 0;
match->regexp = 0;
- match->rmatch = ALLOC(struct rmatch);
- MEMZERO(match->rmatch, struct rmatch, 1);
+ match->rmatch = ZALLOC(struct rmatch);
return (VALUE)match;
}
@@ -992,8 +1016,15 @@ match_init_copy(VALUE obj, VALUE orig)
static VALUE
match_regexp(VALUE match)
{
+ VALUE regexp;
match_check(match);
- return RMATCH(match)->regexp;
+ 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;
}
/*
@@ -1051,8 +1082,8 @@ match_backref_number(VALUE match, VALUE backref)
return NUM2INT(backref);
case T_SYMBOL:
- name = rb_id2name(SYM2ID(backref));
- break;
+ backref = rb_sym2str(backref);
+ /* fall through */
case T_STRING:
name = StringValueCStr(backref);
@@ -1191,6 +1222,32 @@ 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
@@ -1348,8 +1405,9 @@ rb_reg_adjust_startpos(VALUE re, VALUE str, long pos, int reverse)
return pos;
}
+/* returns byte offset */
long
-rb_reg_search(VALUE re, VALUE str, long pos, int reverse)
+rb_reg_search0(VALUE re, VALUE str, long pos, int reverse, int set_backref_str)
{
long result;
VALUE match;
@@ -1424,17 +1482,26 @@ rb_reg_search(VALUE re, VALUE str, long pos, int reverse)
FL_UNSET(match, FL_TAINT);
}
- RMATCH(match)->str = rb_str_new4(str);
+ if (set_backref_str) {
+ RMATCH(match)->str = rb_str_new4(str);
+ OBJ_INFECT(match, 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)
{
@@ -1665,20 +1732,16 @@ match_captures(VALUE match)
static int
name_to_backref_number(struct re_registers *regs, VALUE regexp, const char* name, const char* name_end)
{
- int num;
-
- num = onig_name_to_backref_number(RREGEXP(regexp)->ptr,
+ return 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));
- }
+}
- UNREACHABLE;
+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);
}
/*
@@ -1728,17 +1791,16 @@ match_aref(int argc, VALUE *argv, VALUE match)
switch (TYPE(idx)) {
case T_SYMBOL:
- p = rb_id2name(SYM2ID(idx));
- goto name_to_backref;
- break;
+ idx = rb_sym2str(idx);
+ /* fall through */
case T_STRING:
p = StringValuePtr(idx);
-
- name_to_backref:
- num = name_to_backref_number(RMATCH_REGS(match),
- RMATCH(match)->regexp, p, p + strlen(p));
+ if (!rb_enc_compatible(RREGEXP(RMATCH(match)->regexp)->src, idx) ||
+ (num = name_to_backref_number(RMATCH_REGS(match), RMATCH(match)->regexp,
+ p, p + RSTRING_LEN(idx))) < 1) {
+ name_to_backref_error(idx);
+ }
return rb_reg_nth_match(num, match);
- break;
default:
break;
@@ -1863,7 +1925,7 @@ match_inspect_name_iter(const OnigUChar *name, const OnigUChar *name_end,
static VALUE
match_inspect(VALUE match)
{
- const char *cname = rb_obj_classname(match);
+ VALUE cname = rb_class_path(rb_obj_class(match));
VALUE str;
int i;
struct re_registers *regs = RMATCH_REGS(match);
@@ -1872,7 +1934,11 @@ match_inspect(VALUE match)
VALUE regexp = RMATCH(match)->regexp;
if (regexp == 0) {
- return rb_sprintf("#<%s:%p>", cname, (void*)match);
+ 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));
}
names = ALLOCA_N(struct backref_name_tag, num_regs);
@@ -1882,7 +1948,7 @@ match_inspect(VALUE match)
match_inspect_name_iter, names);
str = rb_str_buf_new2("#<");
- rb_str_buf_cat2(str, cname);
+ rb_str_append(str, cname);
for (i = 0; i < num_regs; i++) {
VALUE v;
@@ -2338,7 +2404,7 @@ rb_reg_preprocess_dregexp(VALUE ary, int options)
}
for (i = 0; i < RARRAY_LEN(ary); i++) {
- VALUE str = RARRAY_PTR(ary)[i];
+ VALUE str = RARRAY_AREF(ary, i);
VALUE buf;
char *p, *end;
rb_encoding *src_enc;
@@ -2391,8 +2457,6 @@ rb_reg_initialize(VALUE obj, const char *s, long len, rb_encoding *enc,
rb_encoding *fixed_enc = 0;
rb_encoding *a_enc = rb_ascii8bit_encoding();
- if (!OBJ_UNTRUSTED(obj) && rb_safe_level() >= 4)
- rb_raise(rb_eSecurityError, "Insecure: can't modify regexp");
rb_check_frozen(obj);
if (FL_TEST(obj, REG_LITERAL))
rb_raise(rb_eSecurityError, "can't modify literal regexp");
@@ -2436,8 +2500,7 @@ 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;
- re->src = rb_enc_str_new(s, len, enc);
- OBJ_FREEZE(re->src);
+ RB_OBJ_WRITE(obj, &re->src, rb_fstring(rb_enc_str_new(s, len, enc)));
RB_GC_GUARD(unescaped);
return 0;
}
@@ -2468,10 +2531,10 @@ rb_reg_initialize_str(VALUE obj, VALUE str, int options, onig_errmsg_buffer err,
static VALUE
rb_reg_s_alloc(VALUE klass)
{
- NEWOBJ_OF(re, struct RRegexp, klass, T_REGEXP);
+ NEWOBJ_OF(re, struct RRegexp, klass, T_REGEXP | (RGENGC_WB_PROTECTED_REGEXP ? FL_WB_PROTECTED : 0));
re->ptr = 0;
- re->src = 0;
+ RB_OBJ_WRITE(re, &re->src, 0);
re->usecnt = 0;
return (VALUE)re;
@@ -2546,13 +2609,12 @@ 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(save_str, 0);
+ return reg_cache = rb_reg_new_str(str, 0);
}
static st_index_t reg_hash(VALUE re);
@@ -2561,6 +2623,8 @@ 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
@@ -2619,6 +2683,8 @@ 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
@@ -2639,6 +2705,7 @@ match_hash(VALUE match)
/*
* call-seq:
* mtch == mtch2 -> true or false
+ * mtch.eql?(mtch2) -> true or false
*
* Equality---Two matchdata are equal if their target strings,
* patterns, and matched positions are identical.
@@ -3251,6 +3318,9 @@ rb_reg_s_union(VALUE self, VALUE args0)
* Regexp.union("skiing", "sledding") #=> /skiing|sledding/
* Regexp.union(["skiing", "sledding"]) #=> /skiing|sledding/
* Regexp.union(/dogs/, /cats/i) #=> /(?-mix:dogs)|(?i-mx:cats)/
+ *
+ * Note: the arguments for ::union will try to be converted into a regular
+ * expression literal via #to_regexp.
*/
static VALUE
rb_reg_s_union_m(VALUE self, VALUE args)
@@ -3327,7 +3397,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 (onig_noname_group_capture_is_active(RREGEXP(regexp)->ptr)) {
+ if (!NIL_P(regexp) && onig_noname_group_capture_is_active(RREGEXP(regexp)->ptr)) {
no = c - '0';
}
else {
@@ -3346,7 +3416,12 @@ 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) {
- no = name_to_backref_number(regs, regexp, name, name_end);
+ VALUE n = rb_str_subseq(str, (long)(name - RSTRING_PTR(str)),
+ (long)(name_end - name));
+ if (!rb_enc_compatible(RREGEXP(regexp)->src, n) ||
+ (no = name_to_backref_number(regs, regexp, name, name_end)) < 1) {
+ name_to_backref_error(n);
+ }
p = s = name_end + clen;
break;
}
@@ -3515,7 +3590,7 @@ re_warn(const char *s)
* <code>%r{...}</code> literals, and by the <code>Regexp::new</code>
* constructor.
*
- * :include: doc/re.rdoc
+ * :include: doc/regexp.rdoc
*/
void
diff --git a/regcomp.c b/regcomp.c
index 705e0faad7..c1698ea1dc 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -3,7 +3,7 @@
**********************************************************************/
/*-
* Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
- * Copyright (c) 2011-2013 K.Takata <kentkt AT csc DOT jp>
+ * Copyright (c) 2011-2014 K.Takata <kentkt AT csc DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,6 +30,15 @@
#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
@@ -321,9 +330,10 @@ 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 str_len, int ignore_case)
+select_str_opcode(int mb_len, OnigDistance byte_len, int ignore_case)
{
int op;
+ OnigDistance str_len = (byte_len + mb_len - 1) / mb_len;
if (ignore_case) {
switch (str_len) {
@@ -425,11 +435,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 str_len,
+add_compile_string_length(UChar* s ARG_UNUSED, int mb_len, OnigDistance byte_len,
regex_t* reg ARG_UNUSED, int ignore_case)
{
int len;
- int op = select_str_opcode(mb_len, str_len, ignore_case);
+ int op = select_str_opcode(mb_len, byte_len, ignore_case);
len = SIZE_OPCODE;
@@ -437,15 +447,15 @@ add_compile_string_length(UChar* s ARG_UNUSED, int mb_len, OnigDistance str_len,
if (IS_NEED_STR_LEN_OP_EXACT(op))
len += SIZE_LENGTH;
- len += mb_len * (int )str_len;
+ len += (int )byte_len;
return len;
}
static int
-add_compile_string(UChar* s, int mb_len, OnigDistance str_len,
+add_compile_string(UChar* s, int mb_len, OnigDistance byte_len,
regex_t* reg, int ignore_case)
{
- int op = select_str_opcode(mb_len, str_len, ignore_case);
+ int op = select_str_opcode(mb_len, byte_len, ignore_case);
add_opcode(reg, op);
if (op == OP_EXACTMBN)
@@ -453,12 +463,12 @@ add_compile_string(UChar* s, int mb_len, OnigDistance str_len,
if (IS_NEED_STR_LEN_OP_EXACT(op)) {
if (op == OP_EXACTN_IC)
- add_length(reg, mb_len * str_len);
+ add_length(reg, byte_len);
else
- add_length(reg, str_len);
+ add_length(reg, byte_len / mb_len);
}
- add_bytes(reg, s, mb_len * str_len);
+ add_bytes(reg, s, byte_len);
return 0;
}
@@ -466,7 +476,7 @@ add_compile_string(UChar* s, int mb_len, OnigDistance str_len,
static int
compile_length_string_node(Node* node, regex_t* reg)
{
- int rlen, r, len, prev_len, slen, ambig;
+ int rlen, r, len, prev_len, blen, ambig;
OnigEncoding enc = reg->enc;
UChar *p, *prev;
StrNode* sn;
@@ -480,24 +490,24 @@ compile_length_string_node(Node* node, regex_t* reg)
p = prev = sn->s;
prev_len = enclen(enc, p, sn->end);
p += prev_len;
- slen = 1;
+ blen = prev_len;
rlen = 0;
for (; p < sn->end; ) {
len = enclen(enc, p, sn->end);
- if (len == prev_len) {
- slen++;
+ if (len == prev_len || ambig) {
+ blen += len;
}
else {
- r = add_compile_string_length(prev, prev_len, slen, reg, ambig);
+ r = add_compile_string_length(prev, prev_len, blen, reg, ambig);
rlen += r;
prev = p;
- slen = 1;
+ blen = len;
prev_len = len;
}
p += len;
}
- r = add_compile_string_length(prev, prev_len, slen, reg, ambig);
+ r = add_compile_string_length(prev, prev_len, blen, reg, ambig);
rlen += r;
return rlen;
}
@@ -514,7 +524,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, slen, ambig;
+ int r, len, prev_len, blen, ambig;
OnigEncoding enc = reg->enc;
UChar *p, *prev, *end;
StrNode* sn;
@@ -529,25 +539,25 @@ compile_string_node(Node* node, regex_t* reg)
p = prev = sn->s;
prev_len = enclen(enc, p, end);
p += prev_len;
- slen = 1;
+ blen = prev_len;
for (; p < end; ) {
len = enclen(enc, p, end);
- if (len == prev_len) {
- slen++;
+ if (len == prev_len || ambig) {
+ blen += len;
}
else {
- r = add_compile_string(prev, prev_len, slen, reg, ambig);
+ r = add_compile_string(prev, prev_len, blen, reg, ambig);
if (r) return r;
prev = p;
- slen = 1;
+ blen = len;
prev_len = len;
}
p += len;
}
- return add_compile_string(prev, prev_len, slen, reg, ambig);
+ return add_compile_string(prev, prev_len, blen, reg, ambig);
}
static int
@@ -2582,6 +2592,7 @@ 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)
@@ -2669,22 +2680,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;
}
@@ -2697,7 +2708,7 @@ is_not_included(Node* x, Node* y, regex_t* reg)
break;
default:
- break;
+ break;
}
}
break;
@@ -3302,7 +3313,7 @@ next_setup(Node* node, Node* next_node, int in_root, regex_t* reg)
qn->next_head_exact = n;
}
#endif
- /* automatic possessivation a*b ==> (?>a*)b */
+ /* automatic possessification a*b ==> (?>a*)b */
if (qn->lower <= 1) {
int ttype = NTYPE(qn->target);
if (IS_NODE_TYPE_SIMPLE(ttype)) {
@@ -3424,26 +3435,39 @@ 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, varclen;
+ int r, i, j, len, varlen;
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) {
@@ -3493,29 +3517,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;
@@ -3528,8 +3552,6 @@ expand_case_fold_string_alt(int item_num, OnigCaseFoldCodeItem items[],
}
}
- if (varclen && !varlen)
- return 2;
return varlen;
mem_err2:
@@ -3573,7 +3595,8 @@ expand_case_fold_string(Node* node, regex_t* reg)
len = enclen(reg->enc, p, end);
- if (n == 0) {
+ varlen = is_case_fold_variable_len(n, items, len);
+ if (n == 0 || varlen == 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);
@@ -3600,6 +3623,12 @@ 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)) {
@@ -3610,7 +3639,6 @@ 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;
@@ -3624,7 +3652,7 @@ expand_case_fold_string(Node* node, regex_t* reg)
root = NCAR(prev_node);
}
- else { /* r == 0 || r == 2 */
+ else { /* r == 0 */
if (IS_NOT_NULL(root)) {
if (IS_NULL(onig_node_list_add(root, prev_node))) {
onig_node_free(prev_node);
@@ -3638,6 +3666,12 @@ 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;
@@ -3667,20 +3701,9 @@ expand_case_fold_string(Node* node, regex_t* reg)
/* ending */
top_root = (IS_NOT_NULL(top_root) ? top_root : prev_node);
- 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;
- }
+ swap_node(node, top_root);
onig_node_free(top_root);
- return r;
+ return 0;
mem_err:
r = ONIGERR_MEMORY;
@@ -4355,7 +4378,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 < (int )(sizeof(ByteValTable)/sizeof(ByteValTable[0]))) {
+ if (i < numberof(ByteValTable)) {
if (i == 0 && ONIGENC_MBC_MINLEN(enc) > 1)
return 20;
else
@@ -4387,7 +4410,7 @@ distance_value(MinMaxLen* mm)
if (mm->max == ONIG_INFINITE_DISTANCE) return 0;
d = mm->max - mm->min;
- if (d < sizeof(dist_vals)/sizeof(dist_vals[0]))
+ if (d < numberof(dist_vals))
/* return dist_vals[d] * 16 / (mm->min + 12); */
return (int )dist_vals[d];
else
@@ -4495,6 +4518,9 @@ 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
@@ -5068,7 +5094,8 @@ 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_LOOK_BEHIND: /* just for (?<=x).* */
+ case ANCHOR_PREC_READ_NOT: /* just for (?!x).* */
add_opt_anc_info(&opt->anc, NANCHOR(node)->type);
break;
@@ -5091,7 +5118,6 @@ optimize_node_left(Node* node, NodeOptInfo* opt, OptEnv* env)
}
break;
- case ANCHOR_PREC_READ_NOT:
case ANCHOR_LOOK_BEHIND_NOT:
break;
}
@@ -5357,7 +5383,8 @@ 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);
+ reg->anchor |= opt.anc.right_anchor & (ANCHOR_END_BUF | ANCHOR_SEMI_END_BUF |
+ ANCHOR_PREC_READ_NOT);
if (reg->anchor & (ANCHOR_END_BUF | ANCHOR_SEMI_END_BUF)) {
reg->anchor_dmin = opt.len.min;
@@ -5448,14 +5475,14 @@ print_distance_range(FILE* f, OnigDistance a, OnigDistance b)
if (a == ONIG_INFINITE_DISTANCE)
fputs("inf", f);
else
- fprintf(f, "(%"PRIuSIZE")", a);
+ fprintf(f, "(%"PRIuPTR")", a);
fputs("-", f);
if (b == ONIG_INFINITE_DISTANCE)
fputs("inf", f);
else
- fprintf(f, "(%"PRIuSIZE")", b);
+ fprintf(f, "(%"PRIuPTR")", b);
}
static void
@@ -5532,7 +5559,7 @@ print_optimize_info(FILE* f, regex_t* reg)
for (p = reg->exact; p < reg->exact_end; p++) {
fputc(*p, f);
}
- fprintf(f, "]: length: %ld\n", (reg->exact_end - reg->exact));
+ fprintf(f, "]: length: %"PRIdPTR"\n", (reg->exact_end - reg->exact));
}
else if (reg->optimize & ONIG_OPTIMIZE_MAP) {
int c, i, n = 0;
@@ -6394,7 +6421,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;
@@ -6530,9 +6557,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))) {
@@ -6546,7 +6573,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);
@@ -6557,7 +6584,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;
@@ -6569,7 +6596,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)
@@ -6585,11 +6612,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;
@@ -6622,7 +6649,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]);
@@ -6634,21 +6661,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 288eac433d..2683b826f2 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, struct OnigEncodingTypeST* enc)
+onigenc_mbclen_approximate(const OnigUChar* p,const OnigUChar* e, OnigEncoding enc)
{
int ret = ONIGENC_PRECISE_MBC_ENC_LEN(enc,p,e);
if (ONIGENC_MBCLEN_CHARFOUND_P(ret))
@@ -414,9 +414,7 @@ onigenc_ascii_apply_all_case_fold(OnigCaseFoldType flag ARG_UNUSED,
OnigCodePoint code;
int i, r;
- for (i = 0;
- i < (int )(sizeof(OnigAsciiLowerMap)/sizeof(OnigPairCaseFoldCodes));
- i++) {
+ for (i = 0; i < numberof(OnigAsciiLowerMap); i++) {
code = OnigAsciiLowerMap[i].to;
r = (*f)(OnigAsciiLowerMap[i].from, &code, 1, arg);
if (r != 0) return r;
@@ -431,8 +429,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;
@@ -570,9 +568,10 @@ onigenc_get_case_fold_codes_by_str_with_map(int map_size,
extern int
-onigenc_not_support_get_ctype_code_range(OnigCtype ctype,
- OnigCodePoint* sb_out, const OnigCodePoint* ranges[],
- OnigEncoding enc)
+onigenc_not_support_get_ctype_code_range(OnigCtype ctype ARG_UNUSED,
+ OnigCodePoint* sb_out ARG_UNUSED,
+ const OnigCodePoint* ranges[] ARG_UNUSED,
+ OnigEncoding enc)
{
return ONIG_NO_SUPPORT_CONFIG;
}
@@ -589,7 +588,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);
@@ -633,28 +632,31 @@ 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,
+onigenc_single_byte_left_adjust_char_head(const UChar* start ARG_UNUSED,
+ const UChar* s,
+ const UChar* end ARG_UNUSED,
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;
@@ -716,7 +718,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 ARG_UNUSED, const UChar* end ARG_UNUSED)
+ const UChar** pp, const UChar* end ARG_UNUSED)
{
const UChar* p = *pp;
@@ -791,27 +793,27 @@ extern int
onigenc_minimum_property_name_to_ctype(OnigEncoding enc, UChar* p, UChar* end)
{
static const PosixBracketEntryType PBS[] = {
- 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),
+ 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),
};
- const PosixBracketEntryType *pb, *pbe;
+ const PosixBracketEntryType *pb;
int len;
len = onigenc_strlen(enc, p, end);
- for (pbe = (pb = PBS) + sizeof(PBS)/sizeof(PBS[0]); pb < pbe; ++pb) {
+ for (pb = PBS; pb < PBS + numberof(PBS); pb++) {
if (len == pb->len &&
onigenc_with_ascii_strnicmp(enc, p, end, pb->name, pb->len) == 0)
return pb->ctype;
diff --git a/regenc.h b/regenc.h
index 3ad3faea3e..5e467961a1 100644
--- a/regenc.h
+++ b/regenc.h
@@ -29,20 +29,21 @@
* 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"
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
+RUBY_SYMBOL_EXPORT_BEGIN
typedef struct {
OnigCodePoint from;
@@ -101,15 +102,22 @@ typedef struct {
typedef struct {
- const UChar *name;
- int ctype;
short int len;
+ const UChar name[6];
+ int ctype;
} PosixBracketEntryType;
-#define PosixBracketEntryInit(name, ctype) {(const UChar *)name, ctype, (short int)(sizeof(name) - 1)}
+#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 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 */
@@ -160,6 +168,7 @@ 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 ONIGENC_ISO_8859_1_TO_LOWER_CASE(c) \
OnigEncISO_8859_1_ToLowerCaseTable[c]
@@ -199,9 +208,9 @@ ONIG_EXTERN const unsigned short OnigEncAsciiCtypeTable[];
#ifdef ONIG_ENC_REGISTER
-extern int ONIG_ENC_REGISTER(const char *, OnigEncodingType*);
+extern int ONIG_ENC_REGISTER(const char *, OnigEncoding);
#define OnigEncodingName(n) encoding_##n
-#define OnigEncodingDeclare(n) static OnigEncodingType OnigEncodingName(n)
+#define OnigEncodingDeclare(n) static const OnigEncodingType OnigEncodingName(n)
#define OnigEncodingDefine(f,n) \
OnigEncodingDeclare(n); \
void Init_##f(void) { \
@@ -211,7 +220,7 @@ extern int ONIG_ENC_REGISTER(const char *, OnigEncodingType*);
OnigEncodingDeclare(n)
#else
#define OnigEncodingName(n) OnigEncoding##n
-#define OnigEncodingDeclare(n) OnigEncodingType OnigEncodingName(n)
+#define OnigEncodingDeclare(n) const OnigEncodingType OnigEncodingName(n)
#define OnigEncodingDefine(f,n) OnigEncodingDeclare(n)
#endif
@@ -220,8 +229,6 @@ extern int ONIG_ENC_REGISTER(const char *, OnigEncodingType*);
#define ENC_ALIAS(name, orig)
#define ENC_DUMMY(name)
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
-#endif
+RUBY_SYMBOL_EXPORT_END
#endif /* ONIGURUMA_REGENC_H */
diff --git a/regerror.c b/regerror.c
index 9c94d23018..9ec3f65f4c 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 K.Takata <kentkt AT csc DOT jp>
+ * Copyright (c) 2011-2014 K.Takata <kentkt AT csc DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -53,8 +53,6 @@ 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:
@@ -65,6 +63,8 @@ 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,14 +141,10 @@ 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:
@@ -173,6 +169,12 @@ 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:
@@ -307,8 +309,12 @@ onig_error_code_to_str(s, code, va_alist)
default:
q = onig_error_code_to_format(code);
- len = onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, q);
- xmemcpy(s, q, len);
+ if (q) {
+ len = onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, q);
+ xmemcpy(s, q, len);
+ } else {
+ len = 0;
+ }
s[len] = '\0';
break;
}
diff --git a/regexec.c b/regexec.c
index 997849695e..1336468a74 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-2013 K.Takata <kentkt AT csc DOT jp>
+ * Copyright (c) 2011-2014 K.Takata <kentkt AT csc DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -444,9 +444,26 @@ onig_region_copy(OnigRegion* to, OnigRegion* from)
-#define STACK_INIT(alloc_addr, ptr_num, stack_num) do {\
- if (msa->stack_p) {\
+#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) {\
alloc_addr = (char* )xalloca(sizeof(OnigStackIndex) * (ptr_num));\
+ heap_addr = NULL;\
stk_alloc = (OnigStackType* )(msa->stack_p);\
stk_base = stk_alloc;\
stk = stk_base;\
@@ -455,6 +472,7 @@ 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;\
@@ -529,7 +547,11 @@ 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; return r; } \
+ if (r != 0) {\
+ STACK_SAVE;\
+ if (xmalloc_base) xfree(xmalloc_base);\
+ return r;\
+ }\
}\
} while(0)
@@ -1299,9 +1321,6 @@ 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
@@ -1325,6 +1344,7 @@ 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;
@@ -1340,7 +1360,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
/* 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, n, INIT_MATCH_STACK_SIZE);
+ STACK_INIT(alloca_base, xmalloc_base, n, INIT_MATCH_STACK_SIZE);
pop_level = reg->stack_pop_level;
num_mem = reg->num_mem;
repeat_stk = (OnigStackIndex* )alloca_base;
@@ -1354,7 +1374,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, n, INIT_MATCH_STACK_SIZE);
+ STACK_INIT(alloca_base, xmalloc_base, n, INIT_MATCH_STACK_SIZE);
pop_level = reg->stack_pop_level;
num_mem = reg->num_mem;
repeat_stk = (OnigStackIndex* )alloca_base;
@@ -1372,12 +1392,12 @@ 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;
@@ -1386,7 +1406,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
if (s) {
UChar *q, *bp, buf[50];
int len;
- fprintf(stderr, "%4d> \"", (int )(s - str));
+ fprintf(stderr, "%4"PRIdPTR"> \"", (*p == OP_FINISH) ? (ptrdiff_t )-1 : 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++) {
@@ -1399,6 +1419,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
*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");
}
@@ -2150,6 +2171,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
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;
continue;
@@ -2157,6 +2179,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
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;
continue;
@@ -2916,20 +2939,24 @@ match_at(regex_t* reg, const UChar* str, const UChar* end,
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;
}
@@ -3159,8 +3186,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: %d %s\n",
- (int)(s - text), s);
+ fprintf(stderr, "bm_search_loop: pos: %"PRIdPTR" %s\n",
+ (intptr_t )(s - text), s);
#endif
while (*p == *t) {
if (t == target) return (UChar* )p;
@@ -3294,8 +3321,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: %d (%p), text_end: %d (%p), text_range: %d (%p)\n",
- (int )text, text, (int )text_end, text_end, (int )text_range, text_range);
+ 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);
#endif
tail = target_end - 1;
@@ -3398,8 +3425,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: %d (%p), text_end: %d (%p), text_range: %d (%p)\n",
- (int )text, text, (int )text_end, text_end, (int )text_range, text_range);
+ 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);
#endif
tail = target_end - 1;
@@ -3454,8 +3481,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: %d (%p), text_end: %d (%p), text_range: %d (%p)\n",
- (int )text, text, (int )text_end, text_end, (int )text_range, text_range);
+ 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);
#endif
tail = target_end - 1;
@@ -3641,7 +3668,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",
- str, str, end, end, s, s, range, range);
+ (intptr_t )str, str, (intptr_t )end, end, (intptr_t )s, s, (intptr_t )range, range);
#endif
p = s;
@@ -3754,8 +3781,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: %d, high: %d, dmin: %d, dmax: %d\n",
- (int )(*low - str), (int )(*high - str), reg->dmin, reg->dmax);
+ "forward_search_range success: low: %"PRIdPTR", high: %"PRIdPTR", dmin: %"PRIdPTR", dmax: %"PRIdPTR"\n",
+ *low - str, *high - str, reg->dmin, reg->dmax);
#endif
return 1; /* success */
}
@@ -3919,7 +3946,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",
- str, str, end - str, start - str, range - str);
+ (intptr_t )str, str, end - str, start - str, range - str);
#endif
if (region
@@ -4157,7 +4184,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) == 0) {
+ if ((reg->anchor & (ANCHOR_LOOK_BEHIND | ANCHOR_PREC_READ_NOT)) == 0) {
while (!ONIGENC_IS_MBC_NEWLINE_EX(reg->enc, prev, str, end, reg->options, 0)
&& s < range) {
prev = s;
@@ -4181,11 +4208,6 @@ 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;
@@ -4268,7 +4290,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 %d\n", r);
+ fprintf(stderr, "onig_search: error %"PRIdPTR"\n", r);
#endif
return r;
@@ -4278,7 +4300,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 %d\n", r);
+ fprintf(stderr, "onig_search: error %"PRIdPTR"\n", r);
#endif
return r;
@@ -4336,7 +4358,7 @@ onig_number_of_capture_histories(regex_t* reg)
}
extern void
-onig_copy_encoding(OnigEncoding to, OnigEncoding from)
+onig_copy_encoding(OnigEncodingType *to, OnigEncoding from)
{
*to = *from;
}
diff --git a/regint.h b/regint.h
index c26b2decff..3abc8809c9 100644
--- a/regint.h
+++ b/regint.h
@@ -5,7 +5,7 @@
**********************************************************************/
/*-
* Copyright (c) 2002-2008 K.Kosako <sndgk393 AT ybb DOT ne DOT jp>
- * Copyright (c) 2011-2012 K.Takata <kentkt AT csc DOT jp>
+ * Copyright (c) 2011-2014 K.Takata <kentkt AT csc DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -49,7 +49,8 @@
#endif
#if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD86) || \
+ defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || \
+ defined(__powerpc64__) || \
defined(__mc68020__)
#define PLATFORM_UNALIGNED_WORD_ACCESS
#endif
@@ -92,8 +93,6 @@
# define ARG_UNUSED
#endif
-/* */
-/* escape other system UChar definition */
#ifndef RUBY_DEFINES_H
#include "ruby/ruby.h"
#undef xmalloc
@@ -101,23 +100,67 @@
#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
@@ -150,6 +193,8 @@
#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
@@ -170,8 +215,6 @@
/* */
#define onig_st_is_member st_is_member
-#define CHECK_INTERRUPT_IN_MATCH_AT
-
#endif
#define STATE_CHECK_STRING_THRESHOLD_LEN 7
@@ -235,12 +278,16 @@
# include <stdint.h>
#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+
#ifdef STDC_HEADERS
# include <stddef.h>
#endif
-#ifdef __BORLANDC__
-#include <malloc.h>
+#ifdef _WIN32
+#include <malloc.h> /* for alloca() */
#endif
#ifdef ONIG_DEBUG
@@ -260,11 +307,21 @@ 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"
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
+RUBY_SYMBOL_EXPORT_BEGIN
#ifdef MIN
#undef MIN
@@ -368,6 +425,8 @@ 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)
@@ -854,7 +913,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));
@@ -908,8 +967,6 @@ extern int onigenc_property_list_init P_((ONIGENC_INIT_PROPERTY_LIST_FUNC_TYPE))
extern size_t onig_memsize P_((const regex_t *reg));
extern size_t onig_region_memsize P_((const struct re_registers *regs));
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
-#endif
+RUBY_SYMBOL_EXPORT_END
#endif /* ONIGURUMA_REGINT_H */
diff --git a/regparse.c b/regparse.c
index 774ee0a960..094332f90e 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-2013 K.Takata <kentkt AT csc DOT jp>
+ * Copyright (c) 2011-2014 K.Takata <kentkt AT csc DOT jp>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -281,6 +281,14 @@ 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)
@@ -978,6 +986,8 @@ 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)) {
@@ -1143,6 +1153,25 @@ 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)
@@ -1164,6 +1193,24 @@ 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[])
@@ -1172,7 +1219,7 @@ node_new_cclass_by_codepoint_range(int not, OnigCodePoint sb_out,
CClassNode* cc;
OnigCodePoint j;
- Node* node = node_new_cclass();
+ Node* node = node_new_cclass_locked();
CHECK_NULL_RETURN(node);
cc = NCCLASS(node);
@@ -1213,6 +1260,7 @@ 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)
@@ -2486,22 +2534,21 @@ 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(c);
+ PFETCH_S(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(c);
+ PFETCH_S(c);
if (c != '-') return ONIGERR_META_CODE_SYNTAX;
if (PEND) return ONIGERR_END_PATTERN_AT_META;
- PFETCH(c);
+ PFETCH_S(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);
@@ -2513,7 +2560,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(c);
+ PFETCH_S(c);
if (c != '-') return ONIGERR_CONTROL_CODE_SYNTAX;
goto control;
}
@@ -2524,9 +2571,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(c);
+ PFETCH_S(c);
if (c == '?') {
- c = 0177;
+ c = 0177;
}
else {
if (c == MC_ESC(env->syntax)) {
@@ -2534,7 +2581,7 @@ fetch_escaped_value(UChar** src, UChar* end, ScanEnv* env)
if (v < 0) return v;
c = (OnigCodePoint )v;
}
- c &= 0x9f;
+ c &= 0x9f;
}
break;
}
@@ -2630,11 +2677,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)) {
@@ -2701,7 +2748,6 @@ fetch_name(OnigCodePoint start_code, UChar** src, UChar* end,
UChar *name_end;
UChar *pnum_head;
UChar *p = *src;
- PFETCH_READY;
*rback_num = 0;
@@ -2716,23 +2762,23 @@ fetch_name(OnigCodePoint start_code, UChar** src, UChar* end,
return ONIGERR_EMPTY_GROUP_NAME;
}
else {
- PFETCH(c);
+ PFETCH_S(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;
@@ -2747,29 +2793,28 @@ fetch_name(OnigCodePoint start_code, UChar** src, UChar* end,
if (r == 0) {
while (!PEND) {
name_end = p;
- PFETCH(c);
+ PFETCH_S(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;
+ }
}
}
@@ -2782,8 +2827,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;
@@ -2796,9 +2841,9 @@ fetch_name(OnigCodePoint start_code, UChar** src, UChar* end,
else {
while (!PEND) {
name_end = p;
- PFETCH(c);
+ PFETCH_S(c);
if (c == end_code || c == ')')
- break;
+ break;
}
if (PEND)
name_end = end;
@@ -4108,16 +4153,13 @@ 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 char_prop, ScanEnv* env)
+add_ctype_to_cc(CClassNode* cc, int ctype, int not, int ascii_range, ScanEnv* env)
{
- int maxcode, ascii_range;
+ int maxcode;
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) {
@@ -4235,38 +4277,38 @@ add_ctype_to_cc(CClassNode* cc, int ctype, int not, int char_prop, ScanEnv* env)
}
static int
-parse_posix_bracket(CClassNode* cc, UChar** src, UChar* end, ScanEnv* env)
+parse_posix_bracket(CClassNode* cc, CClassNode* asc_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[] = {
- { (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 }
+ 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),
};
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;
+ PINC_S;
not = 1;
}
else
@@ -4275,18 +4317,26 @@ parse_posix_bracket(CClassNode* cc, UChar** src, UChar* end, ScanEnv* env)
if (onigenc_strlen(enc, p, end) < POSIX_BRACKET_NAME_MIN_LEN + 3)
goto not_posix_bracket;
- for (pb = PBS; IS_NOT_NULL(pb->name); pb++) {
+ ascii_range = IS_ASCII_RANGE(env->option) &&
+ ! IS_POSIX_BRACKET_ALL_RANGE(env->option);
+ for (pb = PBS; pb < PBS + numberof(PBS); 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,
- IS_POSIX_BRACKET_ALL_RANGE(env->option),
- env);
+ r = add_ctype_to_cc(cc, pb->ctype, not, ascii_range, env);
if (r != 0) return r;
- PINC; PINC;
+ 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;
*src = p;
return 0;
}
@@ -4296,15 +4346,15 @@ parse_posix_bracket(CClassNode* cc, UChar** src, UChar* end, ScanEnv* env)
c = 0;
i = 0;
while (!PEND && ((c = PPEEK) != ':') && c != ']') {
- PINC;
+ PINC_S;
if (++i > POSIX_BRACKET_CHECK_LIMIT_LENGTH) break;
}
if (c == ':' && ! PEND) {
- PINC;
+ PINC_S;
if (! PEND) {
- PFETCH(c);
+ PFETCH_S(c);
if (c == ']')
- return ONIGERR_INVALID_POSIX_BRACKET_TYPE;
+ return ONIGERR_INVALID_POSIX_BRACKET_TYPE;
}
}
@@ -4318,14 +4368,13 @@ 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(c);
+ PFETCH_S(c);
if (c == '}') {
r = ONIGENC_PROPERTY_NAME_TO_CTYPE(enc, start, prev);
if (r < 0) break;
@@ -4343,6 +4392,8 @@ 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)
@@ -4356,11 +4407,15 @@ 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, 1, env);
+ r = add_ctype_to_cc(cc, ctype, 0, 0, env);
if (r != 0) return r;
if (tok->u.prop.not != 0) NCCLASS_SET_NOT(cc);
- return 0;
+ if (IS_IGNORECASE(env->option)) {
+ if (ctype != ONIGENC_CTYPE_ASCII)
+ r = cclass_case_fold(np, cc, cc, env);
+ }
+ return r;
}
@@ -4378,7 +4433,8 @@ enum CCVALTYPE {
};
static int
-next_state_class(CClassNode* cc, OnigCodePoint* vs, enum CCVALTYPE* type,
+next_state_class(CClassNode* cc, CClassNode* asc_cc,
+ OnigCodePoint* vs, enum CCVALTYPE* type,
enum CCSTATE* state, ScanEnv* env)
{
int r;
@@ -4387,11 +4443,18 @@ next_state_class(CClassNode* cc, OnigCodePoint* vs, enum CCVALTYPE* type,
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;
+ }
}
}
@@ -4401,7 +4464,8 @@ next_state_class(CClassNode* cc, OnigCodePoint* vs, enum CCVALTYPE* type,
}
static int
-next_state_val(CClassNode* cc, OnigCodePoint *vs, OnigCodePoint v,
+next_state_val(CClassNode* cc, CClassNode* asc_cc,
+ OnigCodePoint *vs, OnigCodePoint v,
int* vs_israw, int v_israw,
enum CCVALTYPE intype, enum CCVALTYPE* type,
enum CCSTATE* state, ScanEnv* env)
@@ -4410,11 +4474,18 @@ next_state_val(CClassNode* cc, OnigCodePoint *vs, OnigCodePoint v,
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;
@@ -4431,10 +4502,16 @@ next_state_val(CClassNode* cc, OnigCodePoint *vs, OnigCodePoint v,
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 {
@@ -4450,6 +4527,11 @@ next_state_val(CClassNode* cc, OnigCodePoint *vs, OnigCodePoint v,
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
@@ -4483,7 +4565,6 @@ 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) {
@@ -4491,7 +4572,7 @@ code_exist_check(OnigCodePoint c, UChar* from, UChar* end, int ignore_escaped,
in_esc = 0;
}
else {
- PFETCH(code);
+ PFETCH_S(code);
if (code == c) return 1;
if (code == MC_ESC(env->syntax)) in_esc = 1;
}
@@ -4500,22 +4581,24 @@ code_exist_check(OnigCodePoint c, UChar* from, UChar* end, int ignore_escaped,
}
static int
-parse_char_class(Node** np, OnigToken* tok, UChar** src, UChar* end,
+parse_char_class(Node** np, Node** asc_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 work_cc;
+ CClassNode *asc_cc, *asc_prev_cc;
+ CClassNode work_cc, asc_work_cc;
enum CCSTATE state;
enum CCVALTYPE val_type, in_type;
int val_israw, in_israw;
- prev_cc = (CClassNode* )NULL;
- *np = NULL_NODE;
+ prev_cc = asc_prev_cc = (CClassNode* )NULL;
+ *np = *asc_np = NULL_NODE;
r = fetch_token_in_cc(tok, src, end, env);
if (r == TK_CHAR && tok->u.c == '^' && tok->escaped == 0) {
neg = 1;
@@ -4539,6 +4622,16 @@ parse_char_class(Node** np, OnigToken* tok, UChar** src, UChar* end,
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;
@@ -4629,13 +4722,13 @@ parse_char_class(Node** np, OnigToken* tok, UChar** src, UChar* end,
}
in_type = (len == 1 ? CCV_SB : CCV_CODE_POINT);
val_entry2:
- r = next_state_val(cc, &vs, v, &val_israw, in_israw, in_type, &val_type,
+ r = next_state_val(cc, asc_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, &p, end, env);
+ r = parse_posix_bracket(cc, asc_cc, &p, end, env);
if (r < 0) goto err;
if (r == 1) { /* is not POSIX bracket */
CC_ESC_WARN(env, (UChar* )"[");
@@ -4648,11 +4741,18 @@ parse_char_class(Node** np, OnigToken* tok, UChar** src, UChar* end,
break;
case TK_CHAR_TYPE:
- r = add_ctype_to_cc(cc, tok->u.prop.ctype, tok->u.prop.not, 0, env);
+ r = add_ctype_to_cc(cc, tok->u.prop.ctype, tok->u.prop.not,
+ IS_ASCII_RANGE(env->option), 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, &vs, &val_type, &state, env);
+ r = next_state_class(cc, asc_cc, &vs, &val_type, &state, env);
if (r != 0) goto err;
break;
@@ -4662,8 +4762,13 @@ parse_char_class(Node** np, OnigToken* tok, UChar** src, UChar* end,
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, 1, env);
+ r = add_ctype_to_cc(cc, ctype, tok->u.prop.not, 0, 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;
@@ -4724,15 +4829,20 @@ parse_char_class(Node** np, OnigToken* tok, UChar** src, UChar* end,
case TK_CC_CC_OPEN: /* [ */
{
- Node *anode;
+ Node *anode, *aasc_node;
CClassNode* acc;
- r = parse_char_class(&anode, tok, &p, end, env);
+ r = parse_char_class(&anode, &aasc_node, 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;
@@ -4740,7 +4850,7 @@ parse_char_class(Node** np, OnigToken* tok, UChar** src, UChar* end,
case TK_CC_AND: /* && */
{
if (state == CCS_VALUE) {
- r = next_state_val(cc, &vs, 0, &val_israw, 0, val_type,
+ r = next_state_val(cc, asc_cc, &vs, 0, &val_israw, 0, val_type,
&val_type, &state, env);
if (r != 0) goto err;
}
@@ -4752,12 +4862,23 @@ parse_char_class(Node** np, OnigToken* tok, UChar** src, UChar* end,
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;
@@ -4780,7 +4901,7 @@ parse_char_class(Node** np, OnigToken* tok, UChar** src, UChar* end,
}
if (state == CCS_VALUE) {
- r = next_state_val(cc, &vs, 0, &val_israw, 0, val_type,
+ r = next_state_val(cc, asc_cc, &vs, 0, &val_israw, 0, val_type,
&val_type, &state, env);
if (r != 0) goto err;
}
@@ -4790,12 +4911,24 @@ parse_char_class(Node** np, OnigToken* tok, UChar** src, UChar* end,
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);
- else
+ if (IS_NOT_NULL(asc_cc))
+ NCCLASS_SET_NOT(asc_cc);
+ }
+ 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;
@@ -4823,6 +4956,8 @@ parse_char_class(Node** np, OnigToken* tok, UChar** src, UChar* end,
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;
}
@@ -4960,14 +5095,10 @@ 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) {
- onig_node_free(*np);
- return num;
- }
- else if (num >= (int )BIT_STATUS_BITS_NUM) {
- onig_node_free(*np);
+ if (num < 0) return num;
+ if (num >= (int )BIT_STATUS_BITS_NUM)
return ONIGERR_GROUP_NUMBER_OVER_FOR_CAPTURE_HISTORY;
- }
+
NENCLOSE(*np)->regnum = num;
BIT_STATUS_ON_AT_SIMPLE(env->capture_history, num);
}
@@ -4985,11 +5116,14 @@ 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]))
@@ -5291,30 +5425,23 @@ 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_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);
+ if (onig_warn != onig_null_warn) {
+ onig_syntax_warn(env, "regular expression has redundant nested repeat operator '%s'",
+ PopularQStr[targetq_num]);
}
goto warn_exit;
break;
default:
- 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);
+ 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]]);
}
goto warn_exit;
break;
@@ -5413,13 +5540,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;
}
@@ -5455,6 +5582,7 @@ clear_not_flag_cclass(CClassNode* cc, OnigEncoding enc)
typedef struct {
ScanEnv* env;
CClassNode* cc;
+ CClassNode* asc_cc;
Node* alt_root;
Node** ptail;
} IApplyCaseFoldArg;
@@ -5466,37 +5594,57 @@ 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 (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 (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);
+ }
}
}
#else
if (is_in != 0) {
- 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);
+ 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);
+ }
}
- else
- BITSET_SET_BIT(bs, *to);
}
}
#endif /* CASE_FOLD_IS_APPLIED_INSIDE_NEGATIVE_CCLASS */
@@ -5540,6 +5688,35 @@ 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}]) */
@@ -5624,7 +5801,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, 1, env);
+ r = add_ctype_to_cc(cc1, ctype, 0, 0, env);
if (r != 0) goto err;
NCCLASS_SET_NOT(cc1);
@@ -5632,7 +5809,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, 1, env);
+ r = add_ctype_to_cc(cc2, ctype, 0, 0, env);
if (r != 0) goto err;
qn = node_new_quantifier(0, REPEAT_INFINITE, 0);
@@ -5979,7 +6156,8 @@ 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, 0, env);
+ r = add_ctype_to_cc(cc, tok->u.prop.ctype, 0,
+ IS_ASCII_RANGE(env->option), env);
if (r != 0) return r;
if (tok->u.prop.not != 0) NCCLASS_SET_NOT(cc);
#ifdef USE_SHARED_CCLASS_TABLE
@@ -6002,15 +6180,20 @@ parse_exp(Node** np, OnigToken* tok, int term,
case TK_CC_OPEN:
{
+ Node *asc_node;
CClassNode* cc;
OnigCodePoint code;
- r = parse_char_class(np, tok, src, end, env);
- if (r != 0) return r;
+ r = parse_char_class(np, &asc_node, tok, src, end, env);
+ if (r != 0) {
+ onig_node_free(asc_node);
+ 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);
@@ -6018,28 +6201,13 @@ parse_exp(Node** np, OnigToken* tok, int term,
goto string_loop;
}
if (IS_IGNORECASE(env->option)) {
- 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);
+ r = cclass_case_fold(np, cc, NCCLASS(asc_node), env);
if (r != 0) {
- onig_node_free(iarg.alt_root);
+ onig_node_free(asc_node);
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 4f45e2b72c..35de54671e 100644
--- a/regparse.h
+++ b/regparse.h
@@ -32,9 +32,7 @@
#include "regint.h"
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
+RUBY_SYMBOL_EXPORT_BEGIN
/* node type */
#define NT_STR 0
@@ -195,8 +193,8 @@ typedef struct {
int type;
int regnum;
OnigOptionType option;
- struct _Node* target;
AbsAddrType call_addr;
+ struct _Node* target;
/* for multiple call reference */
OnigDistance min_len; /* min length (byte) */
OnigDistance max_len; /* max length (byte) */
@@ -298,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;
@@ -360,8 +358,6 @@ extern int onig_print_names(FILE*, regex_t*);
#endif
#endif
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
-#endif
+RUBY_SYMBOL_EXPORT_END
#endif /* ONIGURUMA_REGPARSE_H */
diff --git a/ruby.c b/ruby.c
index 9e112623a9..d0130ec7d3 100644
--- a/ruby.c
+++ b/ruby.c
@@ -52,9 +52,10 @@
char *getenv();
#endif
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
-
-#if defined DISABLE_RUBYGEMS && DISABLE_RUBYGEMS
+#ifndef DISABLE_RUBYGEMS
+# define DISABLE_RUBYGEMS 0
+#endif
+#if DISABLE_RUBYGEMS
#define DEFAULT_RUBYGEMS_ENABLED "disabled"
#else
#define DEFAULT_RUBYGEMS_ENABLED "enabled"
@@ -116,7 +117,7 @@ cmdline_options_init(struct cmdline_options *opt)
opt->src.enc.index = src_encoding_index;
opt->ext.enc.index = -1;
opt->intern.enc.index = -1;
-#if defined DISABLE_RUBYGEMS && DISABLE_RUBYGEMS
+#if DISABLE_RUBYGEMS
opt->disable |= DISABLE_BIT(gems);
#endif
return opt;
@@ -206,49 +207,7 @@ usage(const char *name, int help)
SHOW(features[i]);
}
-#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
+#define rubylib_path_new rb_str_new
static void
push_include(const char *path, VALUE (*filter)(VALUE))
@@ -263,7 +222,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_mangled_path(p, s - p)));
+ rb_ary_push(load_path, (*filter)(rubylib_path_new(p, s - p)));
p = s;
}
}
@@ -298,8 +257,7 @@ 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
-#define CONV_TO_POSIX_PATH(p, lib) \
- cygwin_conv_to_posix_path((p), (lib))
+# error no cygwin_conv_path
#endif
if (CONV_TO_POSIX_PATH(p, rubylib) == 0)
p = rubylib;
@@ -389,7 +347,7 @@ ruby_init_loadpath_safe(int safe_level)
extern const char ruby_initial_load_paths[];
const char *paths = ruby_initial_load_paths;
#if defined LOAD_RELATIVE
-# if defined HAVE_DLADDR || defined HAVE_CYGWIN_CONV_PATH
+# if defined HAVE_DLADDR || defined __CYGWIN__ || defined _WIN32
# define VARIABLE_LIBPATH 1
# else
# define VARIABLE_LIBPATH 0
@@ -404,13 +362,9 @@ 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)
@@ -435,7 +389,6 @@ 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) {
@@ -447,11 +400,6 @@ 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, '/');
@@ -464,15 +412,30 @@ ruby_init_loadpath_safe(int safe_level)
#endif
const ptrdiff_t bindir_len = (ptrdiff_t)sizeof(bindir) - 1;
const ptrdiff_t libdir_len = (ptrdiff_t)sizeof(libdir) - 1;
- *p = 0;
- if (p - libpath >= bindir_len && !STRCASECMP(p - bindir_len, bindir)) {
+
+#ifdef ENABLE_MULTIARCH
+ char *p2 = NULL;
+
+ multiarch:
+#endif
+ if (p - libpath >= bindir_len && !STRNCASECMP(p - bindir_len, bindir, bindir_len)) {
p -= bindir_len;
- *p = 0;
}
- else if (p - libpath >= libdir_len && !strcmp(p - libdir_len, libdir)) {
+ else if (p - libpath >= libdir_len && !strncmp(p - libdir_len, libdir, libdir_len)) {
p -= libdir_len;
- *p = 0;
}
+#ifdef ENABLE_MULTIARCH
+ else if (p2) {
+ p = p2;
+ }
+ else {
+ p2 = p;
+ p = rb_enc_path_last_separator(libpath, p, rb_ascii8bit_encoding());
+ if (p) goto multiarch;
+ p = p2;
+ }
+#endif
+ *p = 0;
}
#if !VARIABLE_LIBPATH
else {
@@ -492,16 +455,14 @@ ruby_init_loadpath_safe(int safe_level)
#define RUBY_RELATIVE(path, len) rb_str_buf_cat(BASEPATH(), (path), (len))
#else
- static const char exec_prefix[] = RUBY_EXEC_PREFIX;
-#define RUBY_RELATIVE(path, len) rubylib_mangled_path((path), (len))
-#define PREFIX_PATH() RUBY_RELATIVE(exec_prefix, sizeof(exec_prefix)-1)
+ 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 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);
}
@@ -526,10 +487,10 @@ add_modules(VALUE *req_list, const char *mod)
if (!list) {
*req_list = list = rb_ary_new();
- RBASIC(list)->klass = 0;
+ RBASIC_CLEAR_CLASS(list);
}
feature = rb_str_new2(mod);
- RBASIC(feature)->klass = 0;
+ RBASIC_CLEAR_CLASS(feature);
rb_ary_push(list, feature);
}
@@ -544,12 +505,11 @@ require_libraries(VALUE *req_list)
int prev_parse_in_eval = th->parse_in_eval;
th->parse_in_eval = 0;
- Init_ext(); /* should be called here for some reason :-( */
CONST_ID(require, "require");
while (list && RARRAY_LEN(list) > 0) {
VALUE feature = rb_ary_shift(list);
rb_enc_associate(feature, extenc);
- RBASIC(feature)->klass = rb_cString;
+ RBASIC_SET_CLASS_RAW(feature, rb_cString);
OBJ_FREEZE(feature);
rb_funcall2(self, require, 1, &feature);
}
@@ -574,11 +534,11 @@ process_sflag(int *sflag)
{
if (*sflag > 0) {
long n;
- VALUE *args;
+ const VALUE *args;
VALUE argv = rb_argv;
n = RARRAY_LEN(argv);
- args = RARRAY_PTR(argv);
+ args = RARRAY_CONST_PTR(argv);
while (n > 0) {
VALUE v = *args++;
char *s = StringValuePtr(v);
@@ -751,7 +711,7 @@ set_option_encoding_once(const char *type, VALUE *name, const char *e, long elen
if (*name &&
rb_funcall(ename, rb_intern("casecmp"), 1, *name) != INT2FIX(0)) {
rb_raise(rb_eRuntimeError,
- "%s already set to %s", type, RSTRING_PTR(*name));
+ "%s already set to %"PRIsVALUE, type, *name);
}
*name = ename;
}
@@ -881,11 +841,9 @@ proc_options(long argc, char **argv, struct cmdline_options *opt, int envopt)
if (envopt) goto noenvopt;
forbid_setid("-e");
if (!*++s) {
- s = argv[1];
- argc--, argv++;
- }
- if (!s) {
- rb_raise(rb_eRuntimeError, "no code specified for -e");
+ if (!--argc)
+ rb_raise(rb_eRuntimeError, "no code specified for -e");
+ s = *++argv;
}
if (!opt->e_script) {
opt->e_script = rb_str_new(0, 0);
@@ -901,7 +859,7 @@ proc_options(long argc, char **argv, struct cmdline_options *opt, int envopt)
if (*++s) {
add_modules(&opt->req_list, s);
}
- else if (argv[1]) {
+ else if (argc > 1) {
add_modules(&opt->req_list, argv[1]);
argc--, argv++;
}
@@ -925,12 +883,7 @@ proc_options(long argc, char **argv, struct cmdline_options *opt, int envopt)
case 'C':
case 'X':
if (envopt) goto noenvopt;
- s++;
- if (!*s) {
- s = argv[1];
- argc--, argv++;
- }
- if (!s || !*s) {
+ if (!*++s && (!--argc || !(s = *++argv) || !*s)) {
rb_fatal("Can't chdir");
}
if (chdir(s) < 0) {
@@ -1001,7 +954,7 @@ proc_options(long argc, char **argv, struct cmdline_options *opt, int envopt)
forbid_setid("-I");
if (*++s)
ruby_incpush_expand(s);
- else if (argv[1]) {
+ else if (argc > 1) {
ruby_incpush_expand(argv[1]);
argc--, argv++;
}
@@ -1040,13 +993,16 @@ 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) \
- ((*(s)++ ? !*(s) : (!--argc || !((s) = *++argv))) ? \
+# 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) \
+# define is_option_with_arg(name, allow_hyphen, allow_envopt) \
+ 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), 1) : 0)
+ (check_envopt(name, (allow_envopt)), s += n, \
+ need_argument(name, s, needs_arg), 1) : 0)
if (strcmp("copyright", s) == 0) {
if (envopt) goto noenvopt_long;
@@ -1158,6 +1114,7 @@ proc_options(long argc, char **argv, struct cmdline_options *opt, int envopt)
# undef check_envopt
# undef need_argument
# undef is_option_with_arg
+# undef is_option_with_optarg
}
}
@@ -1187,7 +1144,8 @@ opt_enc_index(VALUE enc_name)
return i;
}
-#define rb_progname (GET_VM()->progname)
+#define rb_progname (GET_VM()->progname)
+#define rb_orig_progname (GET_VM()->orig_progname)
VALUE rb_argv0;
static VALUE
@@ -1221,7 +1179,7 @@ uscore_get(void)
/*
* call-seq:
* sub(pattern, replacement) -> $_
- * sub(pattern) { block } -> $_
+ * sub(pattern) {|...| block } -> $_
*
* Equivalent to <code>$_.sub(<i>args</i>)</code>, except that
* <code>$_</code> will be updated if substitution occurs.
@@ -1238,11 +1196,11 @@ rb_f_sub(int argc, VALUE *argv)
/*
* call-seq:
- * gsub(pattern, replacement) -> string
- * gsub(pattern) {|...| block } -> string
+ * gsub(pattern, replacement) -> $_
+ * gsub(pattern) {|...| block } -> $_
*
* Equivalent to <code>$_.gsub...</code>, except that <code>$_</code>
- * receives the modified result.
+ * will be updated if substitution occurs.
* Available only when -p/-n command line option specified.
*
*/
@@ -1257,7 +1215,7 @@ rb_f_gsub(int argc, VALUE *argv)
/*
* call-seq:
- * chop -> string
+ * chop -> $_
*
* Equivalent to <code>($_.dup).chop!</code>, except <code>nil</code>
* is never returned. See <code>String#chop!</code>.
@@ -1384,6 +1342,7 @@ process_options(int argc, char **argv, struct cmdline_options *opt)
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");
@@ -1422,16 +1381,14 @@ process_options(int argc, char **argv, struct cmdline_options *opt)
long i;
VALUE load_path = GET_VM()->load_path;
for (i = 0; i < RARRAY_LEN(load_path); ++i) {
- RARRAY_PTR(load_path)[i] =
- rb_enc_associate(rb_str_dup(RARRAY_PTR(load_path)[i]), lenc);
+ VALUE path = RARRAY_AREF(load_path, i);
+ path = rb_enc_associate(rb_str_dup(path), lenc);
+ RARRAY_ASET(load_path, i, path);
}
}
+ Init_ext(); /* load statically linked extensions before rubygems */
if (!(opt->disable & DISABLE_BIT(gems))) {
-#if defined DISABLE_RUBYGEMS && DISABLE_RUBYGEMS
- rb_require("rubygems");
-#else
rb_define_module("Gem");
-#endif
}
ruby_init_prelude();
ruby_set_argv(argc, argv);
@@ -1550,7 +1507,6 @@ 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);
- rb_gc_set_params();
return iseq;
}
@@ -1560,57 +1516,24 @@ struct load_file_arg {
VALUE fname;
int script;
struct cmdline_options *opt;
+ VALUE f;
+ int xflag;
};
static VALUE
-load_file_internal(VALUE arg)
+load_file_internal2(VALUE argp_v)
{
- extern VALUE rb_stdin;
- struct load_file_arg *argp = (struct load_file_arg *)arg;
+ struct load_file_arg *argp = (struct load_file_arg *)argp_v;
VALUE parser = argp->parser;
- VALUE fname_v = rb_str_encode_ospath(argp->fname);
- const char *fname = StringValueCStr(fname_v);
- const char *orig_fname = StringValueCStr(argp->fname);
+ VALUE orig_fname = argp->fname;
int script = argp->script;
struct cmdline_options *opt = argp->opt;
- VALUE f;
+ VALUE f = argp->f;
int line_start = 1;
NODE *tree = 0;
rb_encoding *enc;
ID set_encoding;
- 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);
- }
+ int xflag = argp->xflag;
CONST_ID(set_encoding, "set_encoding");
if (script) {
@@ -1704,11 +1627,70 @@ load_file_internal(VALUE arg)
if (NIL_P(f)) {
f = rb_str_new(0, 0);
rb_enc_associate(f, enc);
- return (VALUE)rb_parser_compile_string(parser, orig_fname, f, line_start);
+ return (VALUE)rb_parser_compile_string_path(parser, orig_fname, f, line_start);
}
rb_funcall(f, set_encoding, 2, rb_enc_from_encoding(enc), rb_str_new_cstr("-"));
- tree = rb_parser_compile_file(parser, orig_fname, f, line_start);
+ tree = rb_parser_compile_file_path(parser, orig_fname, f, line_start);
rb_funcall(f, set_encoding, 1, rb_parser_encoding(parser));
+ return (VALUE)tree;
+}
+
+static VALUE
+load_file_internal(VALUE arg)
+{
+ 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;
+ VALUE f;
+ NODE *tree;
+ int xflag = 0;
+ int state;
+
+ 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->f = f;
+ argp->xflag = xflag;
+ tree = (NODE *)rb_protect(load_file_internal2, (VALUE)argp, &state);
+ if (state) {
+ if (f != rb_stdin)
+ rb_io_close(f);
+ rb_jump_tag(state);
+ }
+
if (script && tree && rb_parser_end_seen_p(parser)) {
/*
* DATA is a File that contains the data section of the executed file.
@@ -1750,39 +1732,81 @@ load_file(VALUE parser, VALUE fname, int script, struct cmdline_options *opt)
void *
rb_load_file(const char *fname)
{
- struct cmdline_options opt;
VALUE fname_v = rb_str_new_cstr(fname);
+ return rb_load_file_str(fname_v);
+}
+
+void *
+rb_load_file_str(VALUE fname_v)
+{
+ struct cmdline_options opt;
return load_file(rb_parser_new(), fname_v, 0, cmdline_options_init(&opt));
}
+/*
+ * call-seq:
+ * Process.argv0 -> frozen_string
+ *
+ * Returns the name of the script being executed. The value is not
+ * affected by assigning a new value to $0.
+ *
+ * This method first appeared in Ruby 2.1 to serve as a global
+ * variable free means to get the script name.
+ */
+
+static VALUE
+proc_argv0(VALUE process)
+{
+ return rb_orig_progname;
+}
+
+/*
+ * call-seq:
+ * Process.setproctitle(string) -> string
+ *
+ * Sets the process title that appears on the ps(1) command. Not
+ * necessarily effective on all platforms. No exception will be
+ * raised regardless of the result, nor will NotImplementedError be
+ * raised even if the platform does not support the feature.
+ *
+ * Calling this method does not affect the value of $0.
+ *
+ * Process.setproctitle('myapp: worker #%d' % worker_id)
+ *
+ * This method first appeared in Ruby 2.1 to serve as a global
+ * variable free means to change the process title.
+ */
+
+static VALUE
+proc_setproctitle(VALUE process, VALUE title)
+{
+ StringValue(title);
+
+ setproctitle("%.*s", RSTRING_LENINT(title), RSTRING_PTR(title));
+
+ return title;
+}
+
static void
set_arg0(VALUE val, ID id)
{
- char *s;
- long i;
-
if (origarg.argv == 0)
rb_raise(rb_eRuntimeError, "$0 not initialized");
- StringValue(val);
- s = RSTRING_PTR(val);
- i = RSTRING_LEN(val);
- setproctitle("%.*s", (int)i, s);
-
- rb_progname = rb_obj_freeze(rb_external_str_new(s, i));
+ rb_progname = rb_str_new_frozen(proc_setproctitle(rb_mProcess, val));
}
/*! Sets the current script name to this value.
*
- * This is similiar to <code>$0 = name</code> in Ruby level but also affects
+ * This is similar to <code>$0 = name</code> in Ruby level but also affects
* <code>Method#location</code> and others.
*/
void
ruby_script(const char *name)
{
if (name) {
- rb_progname = rb_external_str_new(name, strlen(name));
+ rb_orig_progname = rb_progname = rb_external_str_new(name, strlen(name));
rb_vm_set_progname(rb_progname);
}
}
@@ -1794,7 +1818,7 @@ ruby_script(const char *name)
void
ruby_set_script_name(VALUE name)
{
- rb_progname = rb_str_dup(name);
+ rb_orig_progname = rb_progname = rb_str_dup(name);
rb_vm_set_progname(rb_progname);
}
@@ -1862,6 +1886,9 @@ ruby_prog_init(void)
rb_define_hooked_variable("$0", &rb_progname, 0, set_arg0);
rb_define_hooked_variable("$PROGRAM_NAME", &rb_progname, 0, set_arg0);
+ rb_define_module_function(rb_mProcess, "argv0", proc_argv0, 0);
+ rb_define_module_function(rb_mProcess, "setproctitle", proc_setproctitle, 1);
+
/*
* ARGV contains the command line arguments used to run ruby with the
* first value containing the name of the executable.
diff --git a/ruby_atomic.h b/ruby_atomic.h
index 4a53e60824..789efdc4ea 100644
--- a/ruby_atomic.h
+++ b/ruby_atomic.h
@@ -3,6 +3,23 @@
#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_or_fetch(&(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__(oldval) 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 ATOMIC_PTR_EXCHANGE(var, val) __atomic_exchange_n(&(var), (val), __ATOMIC_SEQ_CST)
+
+#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 */
@@ -17,9 +34,8 @@ typedef unsigned int rb_atomic_t; /* Anything OK */
# 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 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))
+
+# define ATOMIC_PTR_EXCHANGE(var, val) __sync_lock_test_and_set(&(var), (val))
#elif defined _WIN32
#if defined _MSC_VER && _MSC_VER > 1200
@@ -50,15 +66,25 @@ rb_w32_atomic_or(volatile rb_atomic_t *var, rb_atomic_t val)
#endif
# define ATOMIC_EXCHANGE(var, val) InterlockedExchange(&(var), (val))
# define ATOMIC_CAS(var, oldval, newval) InterlockedCompareExchange(&(var), (newval), (oldval))
+# if defined _MSC_VER && _MSC_VER <= 1200
+static inline rb_atomic_t
+rb_w32_atomic_cas(volatile rb_atomic_t *var, rb_atomic_t oldval, rb_atomic_t newval)
+{
+ return (rb_atomic_t)InterlockedCompareExchange((PVOID *)var, (PVOID)newval, (PVOID)oldval);
+}
+# undef ATOMIC_CAS
+# define ATOMIC_CAS(var, oldval, newval) rb_w32_atomic_cas(&(var), (oldval), (newval))
+# endif
# ifdef _M_AMD64
-# define ATOMIC_SIZE_ADD(var, val) InterlockedExchangeAdd64(&(var), (val))
-# define ATOMIC_SIZE_SUB(var, val) InterlockedExchangeAdd64(&(var), -(val))
+# define ATOMIC_SIZE_ADD(var, val) InterlockedExchangeAdd64((LONG_LONG *)&(var), (val))
+# define ATOMIC_SIZE_SUB(var, val) InterlockedExchangeAdd64((LONG_LONG *)&(var), -(LONG)(val))
# 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, 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), -(val))
+# define ATOMIC_SIZE_SUB(var, val) InterlockedExchangeAdd((LONG *)&(var), -(LONG)(val))
# define ATOMIC_SIZE_INC(var) InterlockedIncrement((LONG *)&(var))
# define ATOMIC_SIZE_DEC(var) InterlockedDecrement((LONG *)&(var))
# define ATOMIC_SIZE_EXCHANGE(var, val) InterlockedExchange((LONG *)&(var), (val))
@@ -81,6 +107,7 @@ typedef unsigned int rb_atomic_t;
# define ATOMIC_SIZE_INC(var) atomic_inc_ulong(&(var))
# define ATOMIC_SIZE_DEC(var) atomic_dec_ulong(&(var))
# define ATOMIC_SIZE_EXCHANGE(var, val) atomic_swap_ulong(&(var), (val))
+# define ATOMIC_SIZE_CAS(var, oldval, val) atomic_cas_ulong(&(var), (oldval), (val))
# else
# define ATOMIC_SIZE_ADD(var, val) atomic_add_int(&(var), (val))
# define ATOMIC_SIZE_SUB(var, val) atomic_add_int(&(var), -(val))
@@ -106,8 +133,6 @@ 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_INC(var) ((var)++)
-# define ATOMIC_SIZE_DEC(var) ((var)--)
# define ATOMIC_SIZE_EXCHANGE(var, val) atomic_size_exchange(&(var), (val))
static inline size_t
atomic_size_exchange(size_t *ptr, size_t val)
@@ -118,4 +143,28 @@ 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
+
+#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))
+# 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))
+# endif
+#endif
+
#endif /* RUBY_ATOMIC_H */
diff --git a/safe.c b/safe.c
index 05c1aa395b..7f3a412686 100644
--- a/safe.c
+++ b/safe.c
@@ -14,16 +14,25 @@
1 - no dangerous operation by tainted value
2 - process/file operations prohibited
3 - all generated objects are tainted
- 4 - no global (non-tainted) variable modification/no direct output
*/
-#define SAFE_LEVEL_MAX 4
+#define SAFE_LEVEL_MAX RUBY_SAFE_LEVEL_MAX
#include "ruby/ruby.h"
#include "vm_core.h"
/* $SAFE accessor */
+#undef rb_secure
+#undef rb_set_safe_level
+#undef ruby_safe_level_4_warning
+
+int
+ruby_safe_level_4_warning(void)
+{
+ return 4;
+}
+
int
rb_safe_level(void)
{
@@ -43,7 +52,7 @@ rb_set_safe_level(int level)
if (level > th->safe_level) {
if (level > SAFE_LEVEL_MAX) {
- level = SAFE_LEVEL_MAX;
+ rb_raise(rb_eArgError, "$SAFE=4 is obsolete");
}
th->safe_level = level;
}
@@ -67,10 +76,10 @@ safe_setter(VALUE val)
th->safe_level, level);
}
if (level == 3) {
- rb_warning("$SAFE=3 does no sandboxing; you might want to use $SAFE=4");
+ rb_warning("$SAFE=3 does no sandboxing");
}
if (level > SAFE_LEVEL_MAX) {
- level = SAFE_LEVEL_MAX;
+ rb_raise(rb_eArgError, "$SAFE=4 is obsolete");
}
th->safe_level = level;
}
@@ -79,9 +88,10 @@ void
rb_secure(int level)
{
if (level <= rb_safe_level()) {
- if (rb_frame_callee()) {
+ ID caller_name = rb_frame_callee();
+ if (caller_name) {
rb_raise(rb_eSecurityError, "Insecure operation `%s' at level %d",
- rb_id2name(rb_frame_callee()), rb_safe_level());
+ rb_id2name(caller_name), rb_safe_level());
}
else {
rb_raise(rb_eSecurityError, "Insecure operation at level %d",
@@ -93,16 +103,15 @@ rb_secure(int level)
void
rb_secure_update(VALUE obj)
{
- if (!OBJ_TAINTED(obj))
- rb_secure(4);
}
void
rb_insecure_operation(void)
{
- if (rb_frame_callee()) {
+ ID caller_name = rb_frame_callee();
+ if (caller_name) {
rb_raise(rb_eSecurityError, "Insecure operation - %s",
- rb_id2name(rb_frame_callee()));
+ rb_id2name(caller_name));
}
else {
rb_raise(rb_eSecurityError, "Insecure operation: -r");
@@ -115,17 +124,6 @@ rb_check_safe_obj(VALUE x)
if (rb_safe_level() > 0 && OBJ_TAINTED(x)) {
rb_insecure_operation();
}
- rb_secure(4);
-}
-
-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
diff --git a/sample/benchmark.rb b/sample/benchmark.rb
new file mode 100644
index 0000000000..de5d66f505
--- /dev/null
+++ b/sample/benchmark.rb
@@ -0,0 +1,19 @@
+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/cal.rb b/sample/cal.rb
index 387657490f..97f75bcf1c 100644
--- a/sample/cal.rb
+++ b/sample/cal.rb
@@ -71,7 +71,7 @@ class Cal
ta = gr.collect{|xs| xs.join(' ')}
ca = %w(January February March April May June July
- August September October November December)[m - 1]
+ August September October November December)[m - 1]
ca = ca + ' ' + y.to_s if !@opt_y
ca = ca.center(@mw)
@@ -132,10 +132,10 @@ if __FILE__ == $0
begin
GetoptLong.new(['-c', GetoptLong::REQUIRED_ARGUMENT],
- ['-j', GetoptLong::NO_ARGUMENT],
- ['-m', GetoptLong::NO_ARGUMENT],
- ['-t', GetoptLong::NO_ARGUMENT],
- ['-y', GetoptLong::NO_ARGUMENT]).
+ ['-j', GetoptLong::NO_ARGUMENT],
+ ['-m', GetoptLong::NO_ARGUMENT],
+ ['-t', GetoptLong::NO_ARGUMENT],
+ ['-y', GetoptLong::NO_ARGUMENT]).
each do |opt, arg|
case opt
when '-c'; cal.opt_c(arg) || raise
diff --git a/sample/cgi-session-pstore.rb b/sample/cgi-session-pstore.rb
new file mode 100644
index 0000000000..ec8b4989d6
--- /dev/null
+++ b/sample/cgi-session-pstore.rb
@@ -0,0 +1,11 @@
+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/coverage.rb b/sample/coverage.rb
index 1e036f95f9..8e8d6167e2 100644
--- a/sample/coverage.rb
+++ b/sample/coverage.rb
@@ -38,7 +38,7 @@ at_exit do
end
cov
else
- p line
+ p line
warn("coverage file corrupted, ignoring: #{ cfile }")
break []
end
diff --git a/sample/delegate.rb b/sample/delegate.rb
new file mode 100644
index 0000000000..918dc08877
--- /dev/null
+++ b/sample/delegate.rb
@@ -0,0 +1,31 @@
+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/README.rd.ja b/sample/drb/README.ja.rdoc
index ec78dc70dd..3ab70f3369 100644
--- a/sample/drb/README.rd.ja
+++ b/sample/drb/README.ja.rdoc
@@ -42,7 +42,7 @@
* rindas.rb --- TupleSpaceのclientでアプリケーションのserver
* observerの使用例
- cdbiff - ((<URI:http://namazu.org/~satoru/cdbiff/>))
+ cdbiff - http://namazu.org/~satoru/cdbiff/
* dbiff.rb --- dcdbiff server
* dcdbiff.rb --- dcdbiff client
diff --git a/sample/drb/README.rd b/sample/drb/README.rdoc
index 5cf1f51913..80ae910a8a 100644
--- a/sample/drb/README.rd
+++ b/sample/drb/README.rdoc
@@ -22,7 +22,7 @@
* dqout.rb --- client. pop DQEntry objects.
* dqlib.rb --- define DQEntry
-* IdConv customize demo: reference by name
+* IdConv customize demo: reference by name
* name.rb --- server
* namec.rb --- client
@@ -39,14 +39,14 @@
* rindac.rb --- service user
* observer
- cdbiff - ((<URI:http://namazu.org/~satoru/cdbiff/>))
+ cdbiff - http://namazu.org/~satoru/cdbiff/
* dbiff.rb --- dcdbiff server
* dcdbiff.rb --- dcdbiff client
* drbssl
* drbssl_s.rb
* drbssl_c.rb
-
+
* add DRbProtocl
* http0.rb
* http0serv.rb
diff --git a/sample/drb/acl.rb b/sample/drb/acl.rb
new file mode 100644
index 0000000000..d93eb9c1fc
--- /dev/null
+++ b/sample/drb/acl.rb
@@ -0,0 +1,15 @@
+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/dbiff.rb b/sample/drb/dbiff.rb
index b50edc0898..290eb1d28b 100644
--- a/sample/drb/dbiff.rb
+++ b/sample/drb/dbiff.rb
@@ -19,18 +19,18 @@ class Biff
last = Time.now
while true
begin
- sleep(@interval)
- current = File::mtime(@filename)
- if current > last
- changed
- begin
- notify_observers(@filename, current)
- rescue Error
- end
- last = current
- end
+ sleep(@interval)
+ current = File::mtime(@filename)
+ if current > last
+ changed
+ begin
+ notify_observers(@filename, current)
+ rescue Error
+ end
+ last = current
+ end
rescue
- next
+ next
end
end
end
diff --git a/sample/drb/dchats.rb b/sample/drb/dchats.rb
index ccb2c7c9c5..c07f748e99 100644
--- a/sample/drb/dchats.rb
+++ b/sample/drb/dchats.rb
@@ -47,16 +47,16 @@ class ChatServer
msg2 = ">#{name}< #{str}"
@mutex.synchronize do
for m in @members.keys
- begin
- if m == there
- @members[m].listen(msg2)
- else
- @members[m].listen(msg)
- end
- rescue
- p $!
- @members.delete(m)
- end
+ begin
+ if m == there
+ @members[m].listen(msg2)
+ else
+ @members[m].listen(msg)
+ end
+ rescue
+ p $!
+ @members.delete(m)
+ end
end
end
end
diff --git a/sample/drb/dlogd.rb b/sample/drb/dlogd.rb
index fef7ca0f1d..42f302e64e 100644
--- a/sample/drb/dlogd.rb
+++ b/sample/drb/dlogd.rb
@@ -21,8 +21,8 @@ class Logger
def flush
begin
while(1)
- @fp.puts(@queue.pop)
- @fp.flush
+ @fp.puts(@queue.pop)
+ @fp.flush
end
ensure
@fp.close
diff --git a/sample/drb/http0.rb b/sample/drb/http0.rb
index d4c9f6b7fb..e40d810311 100644
--- a/sample/drb/http0.rb
+++ b/sample/drb/http0.rb
@@ -6,20 +6,20 @@ module DRb
module HTTP0
class StrStream
def initialize(str='')
- @buf = str
+ @buf = str
end
attr_reader :buf
def read(n)
- begin
- return @buf[0,n]
- ensure
- @buf[0,n] = ''
- end
+ begin
+ return @buf[0,n]
+ ensure
+ @buf[0,n] = ''
+ end
end
def write(s)
- @buf.concat s
+ @buf.concat s
end
end
@@ -29,47 +29,47 @@ module DRb
def self.open(uri, config)
unless /^http:/ =~ uri
- raise(DRbBadScheme, uri) unless uri =~ /^http:/
- raise(DRbBadURI, 'can\'t parse uri:' + uri)
+ raise(DRbBadScheme, uri) unless uri =~ /^http:/
+ raise(DRbBadURI, 'can\'t parse uri:' + uri)
end
ClientSide.new(uri, config)
end
class ClientSide
def initialize(uri, config)
- @uri = uri
- @res = nil
- @config = config
- @msg = DRbMessage.new(config)
- @proxy = ENV['HTTP_PROXY']
+ @uri = uri
+ @res = nil
+ @config = config
+ @msg = DRbMessage.new(config)
+ @proxy = ENV['HTTP_PROXY']
end
def close; end
def alive?; false; end
def send_request(ref, msg_id, *arg, &b)
- stream = StrStream.new
- @msg.send_request(stream, ref, msg_id, *arg, &b)
- @reply_stream = StrStream.new
- post(@uri, stream.buf)
+ stream = StrStream.new
+ @msg.send_request(stream, ref, msg_id, *arg, &b)
+ @reply_stream = StrStream.new
+ post(@uri, stream.buf)
end
def recv_reply
- @msg.recv_reply(@reply_stream)
+ @msg.recv_reply(@reply_stream)
end
def post(url, data)
- it = URI.parse(url)
- path = [(it.path=='' ? '/' : it.path), it.query].compact.join('?')
- http = Net::HTTP.new(it.host, it.port)
- sio = StrStream.new
- http.post(path, data, {'Content-Type'=>'application/octetstream;'}) do |str|
- sio.write(str)
- if @config[:load_limit] < sio.buf.size
- raise TypeError, 'too large packet'
- end
- end
- @reply_stream = sio
+ it = URI.parse(url)
+ path = [(it.path=='' ? '/' : it.path), it.query].compact.join('?')
+ http = Net::HTTP.new(it.host, it.port)
+ sio = StrStream.new
+ http.post(path, data, {'Content-Type'=>'application/octetstream;'}) do |str|
+ sio.write(str)
+ if @config[:load_limit] < sio.buf.size
+ raise TypeError, 'too large packet'
+ end
+ end
+ @reply_stream = sio
end
end
end
diff --git a/sample/drb/http0serv.rb b/sample/drb/http0serv.rb
index 8318123fa9..9503a1790c 100644
--- a/sample/drb/http0serv.rb
+++ b/sample/drb/http0serv.rb
@@ -8,111 +8,111 @@ module DRb
def self.open_server(uri, config)
unless /^http:/ =~ uri
- raise(DRbBadScheme, uri) unless uri =~ /^http:/
- raise(DRbBadURI, 'can\'t parse uri:' + uri)
+ raise(DRbBadScheme, uri) unless uri =~ /^http:/
+ raise(DRbBadURI, 'can\'t parse uri:' + uri)
end
Server.new(uri, config)
end
class Callback < WEBrick::HTTPServlet::AbstractServlet
def initialize(config, drb)
- @config = config
- @drb = drb
- @queue = Queue.new
+ @config = config
+ @drb = drb
+ @queue = Queue.new
end
def do_POST(req, res)
- @req = req
- @res = res
- @drb.push(self)
- @res.body = @queue.pop
- @res['content-type'] = 'application/octet-stream;'
+ @req = req
+ @res = res
+ @drb.push(self)
+ @res.body = @queue.pop
+ @res['content-type'] = 'application/octet-stream;'
end
def req_body
- @req.body
+ @req.body
end
def reply(body)
- @queue.push(body)
+ @queue.push(body)
end
def close
- @queue.push('')
+ @queue.push('')
end
end
class Server
def initialize(uri, config)
- @uri = uri
- @config = config
- @queue = Queue.new
- setup_webrick(uri)
+ @uri = uri
+ @config = config
+ @queue = Queue.new
+ setup_webrick(uri)
end
attr_reader :uri
def close
- @server.shutdown if @server
- @server = nil
+ @server.shutdown if @server
+ @server = nil
end
def push(callback)
- @queue.push(callback)
+ @queue.push(callback)
end
def accept
- client = @queue.pop
- ServerSide.new(client, @config)
+ client = @queue.pop
+ ServerSide.new(client, @config)
end
def setup_webrick(uri)
- logger = WEBrick::Log::new($stderr, WEBrick::Log::FATAL)
- u = URI.parse(uri)
- s = WEBrick::HTTPServer.new(:Port => u.port,
- :AddressFamily => Socket::AF_INET,
- :BindAddress => u.host,
- :Logger => logger,
- :ServerType => Thread)
- s.mount(u.path, Callback, self)
- @server = s
- s.start
+ logger = WEBrick::Log::new($stderr, WEBrick::Log::FATAL)
+ u = URI.parse(uri)
+ s = WEBrick::HTTPServer.new(:Port => u.port,
+ :AddressFamily => Socket::AF_INET,
+ :BindAddress => u.host,
+ :Logger => logger,
+ :ServerType => Thread)
+ s.mount(u.path, Callback, self)
+ @server = s
+ s.start
end
end
class ServerSide
def initialize(callback, config)
- @callback = callback
- @config = config
- @msg = DRbMessage.new(@config)
- @req_stream = StrStream.new(@callback.req_body)
+ @callback = callback
+ @config = config
+ @msg = DRbMessage.new(@config)
+ @req_stream = StrStream.new(@callback.req_body)
end
def close
- @callback.close if @callback
- @callback = nil
+ @callback.close if @callback
+ @callback = nil
end
def alive?; false; end
def recv_request
- begin
- @msg.recv_request(@req_stream)
- rescue
- close
- raise $!
- end
+ begin
+ @msg.recv_request(@req_stream)
+ rescue
+ close
+ raise $!
+ end
end
def send_reply(succ, result)
- begin
- return unless @callback
- stream = StrStream.new
- @msg.send_reply(stream, succ, result)
- @callback.reply(stream.buf)
- rescue
- close
- raise $!
- end
+ begin
+ return unless @callback
+ stream = StrStream.new
+ @msg.send_reply(stream, succ, result)
+ @callback.reply(stream.buf)
+ rescue
+ close
+ raise $!
+ end
end
end
end
diff --git a/sample/drb/old_tuplespace.rb b/sample/drb/old_tuplespace.rb
index 0da9fa84c3..9c10a34527 100644
--- a/sample/drb/old_tuplespace.rb
+++ b/sample/drb/old_tuplespace.rb
@@ -11,7 +11,7 @@ class TupleSpace
@list = list
@check_idx = []
@list.each_with_index do |x, i|
- @check_idx.push i if x
+ @check_idx.push i if x
end
@size = @list.size
end
@@ -22,9 +22,9 @@ class TupleSpace
def match(tuple)
return nil if tuple.size != self.size
@check_idx.each do |i|
- unless @list[i] === tuple[i]
- return false
- end
+ unless @list[i] === tuple[i]
+ return false
+ end
end
return true
end
@@ -47,13 +47,13 @@ class TupleSpace
found = false
@waiting[sz] = @waiting[sz].find_all { |x|
if x[0].match(tuple)
- begin
- x[1].wakeup
- rescue ThreadError
- end
- false
+ begin
+ x[1].wakeup
+ rescue ThreadError
+ end
+ false
else
- true
+ true
end
}
end
@@ -77,8 +77,8 @@ class TupleSpace
found = false
@que[sz].each_with_index do |x, i|
if template.match(x)
- found = true
- break
+ found = true
+ break
end
end
return nil unless found
@@ -110,17 +110,17 @@ class TupleSpace
def in(template, non_block=false)
begin
loop do
- Thread.critical = true
- tuple = get_que(template)
- unless tuple
- if non_block
- raise ThreadError, "queue empty"
- end
- put_waiting(template, Thread.current)
- Thread.stop
- else
- return tuple
- end
+ Thread.critical = true
+ tuple = get_que(template)
+ unless tuple
+ if non_block
+ raise ThreadError, "queue empty"
+ end
+ put_waiting(template, Thread.current)
+ Thread.stop
+ else
+ return tuple
+ end
end
ensure
Thread.critical = false
@@ -155,11 +155,11 @@ if __FILE__ == $0
def server(ts, id)
Thread.start {
loop do
- req = ts.in(['req', nil, nil])
- ac = req[1]
- num = req[2]
- sleep id
- ts.out([ac, id, num, num * num])
+ req = ts.in(['req', nil, nil])
+ ac = req[1]
+ num = req[2]
+ sleep id
+ ts.out([ac, id, num, num * num])
end
}
end
@@ -168,14 +168,14 @@ if __FILE__ == $0
Thread.start {
ac = Object.new
tuples = (1..10).collect { |i|
- ['req', ac, i * 10 + n]
+ ['req', ac, i * 10 + n]
}
ts.out(*tuples)
ts.out(tuples[0])
puts "out: #{n}"
11.times do |i|
- ans = ts.in([ac, nil, nil, nil])
- puts "client(#{n}) server(#{ans[1]}) #{ans[2]} #{ans[3]}"
+ ans = ts.in([ac, nil, nil, nil])
+ puts "client(#{n}) server(#{ans[1]}) #{ans[2]} #{ans[3]}"
end
}
end
@@ -183,12 +183,12 @@ if __FILE__ == $0
def watcher(ts)
Thread.start {
loop do
- begin
- sleep 1
- p ts.rd(['req', nil, nil], true)
- rescue ThreadError
- puts "'req' not found."
- end
+ begin
+ sleep 1
+ p ts.rd(['req', nil, nil], true)
+ rescue ThreadError
+ puts "'req' not found."
+ end
end
}
end
diff --git a/sample/drb/ring_place.rb b/sample/drb/ring_place.rb
index 0ceef7c65a..11c6c2fe80 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('/dev/null')
- STDOUT.reopen('/dev/null', 'w')
- STDERR.reopen('/dev/null', 'w')
+ STDIN.reopen(IO::NULL)
+ STDOUT.reopen(IO::NULL, 'w')
+ STDERR.reopen(IO::NULL, 'w')
DRb.thread.join
end
diff --git a/sample/drb/simpletuple.rb b/sample/drb/simpletuple.rb
index 1b9b7a35a7..bfbd86e665 100644
--- a/sample/drb/simpletuple.rb
+++ b/sample/drb/simpletuple.rb
@@ -58,10 +58,10 @@ if __FILE__ == $0
def server(ts)
Thread.start {
loop do
- req = ts.in('req')
- ac = req[0]
- num = req[1]
- ts.out(ac, num * num)
+ req = ts.in('req')
+ ac = req[0]
+ num = req[1]
+ ts.out(ac, num * num)
end
}
end
diff --git a/sample/dualstack-fetch.rb b/sample/dualstack-fetch.rb
index 1897a3d8e9..18d33cc45a 100644
--- a/sample/dualstack-fetch.rb
+++ b/sample/dualstack-fetch.rb
@@ -38,7 +38,7 @@ end
STDERR.print "conntecting to #{host} port #{port}\n"
c = TCPSocket.new(host, port)
dest = Socket.getnameinfo(c.getpeername,
- Socket::NI_NUMERICHOST|Socket::NI_NUMERICSERV)
+ Socket::NI_NUMERICHOST|Socket::NI_NUMERICSERV)
STDERR.print "conntected to #{dest[0]} port #{dest[1]}\n"
c.print "GET #{path} HTTP/1.0\n"
c.print "Host: #{host}\n"
diff --git a/sample/dualstack-httpd.rb b/sample/dualstack-httpd.rb
index 11c5201d74..a6d4d3a2c2 100644
--- a/sample/dualstack-httpd.rb
+++ b/sample/dualstack-httpd.rb
@@ -29,22 +29,22 @@ end
while true
as = ls.accept
Thread.start do
- STDERR.print "socket #{myname} accepted, thread ", Thread.current, "\n"
- s = as # copy to dynamic variable
- str = ''
- while line = s.gets
- break if line == "\r\n" or line == "\n"
- str << line
- end
- STDERR.print "socket #{myname} got string\n"
- s.write("HTTP/1.0 200 OK\n")
- s.write("Content-type: text/plain\n\n")
- s.write("this is test: my name is #{myname}, you sent:\n")
- s.write("---start\n")
- s.write(str)
- s.write("---end\n")
- s.close
- STDERR.print "socket #{myname} processed, thread ", Thread.current, " terminating\n"
+ STDERR.print "socket #{myname} accepted, thread ", Thread.current, "\n"
+ s = as # copy to dynamic variable
+ str = ''
+ while line = s.gets
+ break if line == "\r\n" or line == "\n"
+ str << line
+ end
+ STDERR.print "socket #{myname} got string\n"
+ s.write("HTTP/1.0 200 OK\n")
+ s.write("Content-type: text/plain\n\n")
+ s.write("this is test: my name is #{myname}, you sent:\n")
+ s.write("---start\n")
+ s.write(str)
+ s.write("---end\n")
+ s.close
+ STDERR.print "socket #{myname} processed, thread ", Thread.current, " terminating\n"
end
end
end
diff --git a/sample/exyacc.rb b/sample/exyacc.rb
index c96ebfd676..7b37a8b236 100644
--- a/sample/exyacc.rb
+++ b/sample/exyacc.rb
@@ -5,16 +5,16 @@
ARGF.each(nil) do |source|
sbeg = source.index("\n%%") + 1
send = source.rindex("\n%%") + 1
- 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
+ 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
end
diff --git a/sample/fib.awk b/sample/fib.awk
index 7ebe8930f5..9589f97965 100644
--- a/sample/fib.awk
+++ b/sample/fib.awk
@@ -1,5 +1,5 @@
- function fib(n) {
- if ( n<2 ) return n; else return fib(n-2) + fib(n-1)
- }
+function fib(n) {
+ if ( n<2 ) return n; else return fib(n-2) + fib(n-1)
+}
- BEGIN { print fib(20); }
+BEGIN { print fib(20); }
diff --git a/sample/fib.pl b/sample/fib.pl
index 945a4929a7..4c35eaae31 100644
--- a/sample/fib.pl
+++ b/sample/fib.pl
@@ -1,10 +1,10 @@
sub fib {
my($n)=@_;
if ($n<2) {
- return $n;
+ return $n;
}
else {
- return fib($n-2)+fib($n-1);
+ return fib($n-2)+fib($n-1);
}
}
diff --git a/sample/fib.scm b/sample/fib.scm
index b246ca50ac..d2dc770282 100644
--- a/sample/fib.scm
+++ b/sample/fib.scm
@@ -1,7 +1,7 @@
(define (fib n)
(if (< n 2)
- n
- (+ (fib (- n 2)) (fib (- n 1)))))
+ n
+ (+ (fib (- n 2)) (fib (- n 1)))))
(display (fib 20))
(newline)
diff --git a/sample/freq.rb b/sample/freq.rb
index 362753f71f..1b2194c69a 100644
--- a/sample/freq.rb
+++ b/sample/freq.rb
@@ -1,5 +1,5 @@
# word occurrence listing
-# usege: ruby freq.rb file..
+# usage: ruby freq.rb file..
freq = Hash.new(0)
while line = gets()
line.scan(/\w+/) do |word|
diff --git a/sample/from.rb b/sample/from.rb
index 918745e55f..db1299c869 100644
--- a/sample/from.rb
+++ b/sample/from.rb
@@ -43,8 +43,8 @@ def get_mailfile(user)
[ENV['SPOOLDIR'], '/usr/spool', '/var/spool', '/usr', '/var'].each do |m|
path = "#{m}/mail/#{user}"
if File.exist?(path)
- file = path
- break
+ file = path
+ break
end
end
end
@@ -64,23 +64,23 @@ def from_main
mtime = File.mtime(file)
open(file, "r") do |f|
until f.eof?
- header = {}
- f.each_line do |line|
- next if /^From / =~ line # skip From-line
- break if /^$/ =~ line # end of header
-
- if /^(?<attr>\S+?):\s*(?<value>.*)/ =~ line
- attr.capitalize!
- header[attr] = value
- elsif attr
- header[attr] += "\n" + line.lstrip
- end
- end
-
- f.each_line do |line|
- break if /^From / =~ line
- end
- outcount += fromout(header['Date'], header['From'], header['Subject'])
+ header = {}
+ f.each_line do |line|
+ next if /^From / =~ line # skip From-line
+ break if /^$/ =~ line # end of header
+
+ if /^(?<attr>\S+?):\s*(?<value>.*)/ =~ line
+ attr.capitalize!
+ header[attr] = value
+ elsif attr
+ header[attr] += "\n" + line.lstrip
+ end
+ end
+
+ f.each_line do |line|
+ break if /^From / =~ line
+ end
+ outcount += fromout(header['Date'], header['From'], header['Subject'])
end
end
File.utime(atime, mtime, file)
diff --git a/sample/logger/app.rb b/sample/logger/app.rb
index 924bcba4b0..97b62bca30 100644
--- a/sample/logger/app.rb
+++ b/sample/logger/app.rb
@@ -41,6 +41,6 @@ end
status = MyApp.new(1, 2, 3).start
if status != 0
- puts 'Some error(s) occured.'
+ puts 'Some error(s) occurred.'
puts 'See "app.log".'
end
diff --git a/sample/mkproto.rb b/sample/mkproto.rb
index 6e7fc0f788..e650fe8d47 100644
--- a/sample/mkproto.rb
+++ b/sample/mkproto.rb
@@ -7,18 +7,18 @@ while line = gets()
for arg in $4.split(/;\n\s*/)
arg.gsub!(/ +/, ' ')
if arg =~ /,/
- if arg =~ /(([^*]+) *\** *\w+),/
- type = $2.strip
- args.push $1.strip
- arg = $'
- else
- type = ""
- end
- while arg.sub!(/(\** *\w+)(,|$)/, "") && $~
- args.push type + " " + $1.strip
- end
+ if arg =~ /(([^*]+) *\** *\w+),/
+ type = $2.strip
+ args.push $1.strip
+ arg = $'
+ else
+ type = ""
+ end
+ while arg.sub!(/(\** *\w+)(,|$)/, "") && $~
+ args.push type + " " + $1.strip
+ end
else
- args.push arg.strip
+ args.push arg.strip
end
end
printf "%s);\n", args.join(', ')
diff --git a/sample/net-imap.rb b/sample/net-imap.rb
new file mode 100644
index 0000000000..b93ecb746e
--- /dev/null
+++ b/sample/net-imap.rb
@@ -0,0 +1,167 @@
+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/observ.rb b/sample/observ.rb
index 72e5178b38..061e3c6a10 100644
--- a/sample/observ.rb
+++ b/sample/observ.rb
@@ -8,10 +8,10 @@ class Tick
def initialize
Thread.start do
loop do
- sleep 0.999
- now = Time.now
- changed
- notify_observers(now.hour, now.min, now.sec)
+ sleep 0.999
+ now = Time.now
+ changed
+ notify_observers(now.hour, now.min, now.sec)
end
end
end
diff --git a/sample/occur.pl b/sample/occur.pl
index 1f5fcf27a4..331ce50211 100644
--- a/sample/occur.pl
+++ b/sample/occur.pl
@@ -1,9 +1,9 @@
while (<>) {
- for (split(/\W+/)) {
- $freq{$_}++;
- }
+ for (split(/\W+/)) {
+ $freq{$_}++;
+ }
}
for (sort keys %freq) {
- print "$_ -- $freq{$_}\n";
+ print "$_ -- $freq{$_}\n";
}
diff --git a/sample/occur.rb b/sample/occur.rb
index 4ec6ae479b..42151d85e8 100644
--- a/sample/occur.rb
+++ b/sample/occur.rb
@@ -1,5 +1,5 @@
# word occurrence listing
-# usege: ruby occur.rb file..
+# usage: ruby occur.rb file..
freq = Hash.new(0)
while line = gets()
for word in line.split(/\W+/)
diff --git a/sample/occur2.rb b/sample/occur2.rb
index ca87d0ddef..ef8ad2c541 100644
--- a/sample/occur2.rb
+++ b/sample/occur2.rb
@@ -1,5 +1,5 @@
# word occurrence listing
-# usege: ruby occur2.rb file..
+# usage: ruby occur2.rb file..
freq = {}
ARGF.each_line do |line|
for word in line.split(/\W+/)
diff --git a/sample/open3.rb b/sample/open3.rb
new file mode 100644
index 0000000000..bc6cdfe3bf
--- /dev/null
+++ b/sample/open3.rb
@@ -0,0 +1,12 @@
+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/openssl/c_rehash.rb b/sample/openssl/c_rehash.rb
index afbb654517..cd6c9d5fd4 100644
--- a/sample/openssl/c_rehash.rb
+++ b/sample/openssl/c_rehash.rb
@@ -54,13 +54,13 @@ class CHashDir
OpenSSL::X509::Certificate.new(str)
rescue
begin
- OpenSSL::X509::CRL.new(str)
+ OpenSSL::X509::CRL.new(str)
rescue
- begin
- OpenSSL::X509::Request.new(str)
- rescue
- nil
- end
+ begin
+ OpenSSL::X509::Request.new(str)
+ rescue
+ nil
+ end
end
end
end
@@ -75,15 +75,15 @@ private
Dir.chdir(@dirpath) do
delete_symlink
Dir.glob('*.pem') do |pemfile|
- cert = load_pem_file(pemfile)
- case cert
- when OpenSSL::X509::Certificate
- link_hash_cert(pemfile, cert)
- when OpenSSL::X509::CRL
- link_hash_crl(pemfile, cert)
- else
- STDERR.puts("WARNING: #{pemfile} does not contain a certificate or CRL: skipping") unless @silent
- end
+ cert = load_pem_file(pemfile)
+ case cert
+ when OpenSSL::X509::Certificate
+ link_hash_cert(pemfile, cert)
+ when OpenSSL::X509::CRL
+ link_hash_crl(pemfile, cert)
+ else
+ STDERR.puts("WARNING: #{pemfile} does not contain a certificate or CRL: skipping") unless @silent
+ end
end
end
end
@@ -103,7 +103,7 @@ private
}
unless filepath
unless @silent
- STDERR.puts("WARNING: Skipping duplicate certificate #{org_filename}")
+ STDERR.puts("WARNING: Skipping duplicate certificate #{org_filename}")
end
else
(@cert_cache[name_hash] ||= []) << path(filepath)
@@ -118,7 +118,7 @@ private
}
unless filepath
unless @silent
- STDERR.puts("WARNING: Skipping duplicate CRL #{org_filename}")
+ STDERR.puts("WARNING: Skipping duplicate CRL #{org_filename}")
end
else
(@crl_cache[name_hash] ||= []) << path(filepath)
@@ -132,7 +132,7 @@ private
filepath = yield(idx)
break unless FileTest.symlink?(filepath) or FileTest.exist?(filepath)
if @fingerprint_cache[filepath] == fingerprint
- return false
+ return false
end
idx += 1
end
@@ -147,7 +147,7 @@ private
File.symlink(from, to)
rescue
File.open(to, "w") do |f|
- f << File.read(from)
+ f << File.read(from)
end
end
end
diff --git a/sample/openssl/certstore.rb b/sample/openssl/certstore.rb
index c0bc21bcbb..c6e8f816bc 100644
--- a/sample/openssl/certstore.rb
+++ b/sample/openssl/certstore.rb
@@ -76,27 +76,27 @@ private
result = @x509store.verify(cert) do |ok, ctx|
cert = ctx.current_cert
if ctx.current_crl
- crl_map[cert.subject] = true
+ crl_map[cert.subject] = true
end
if ok
- if !ctx.current_crl
- if crl = @crl_store.find_crl(cert)
- crl_map[cert.subject] = true
- if crl.revoked.find { |revoked| revoked.serial == cert.serial }
- ok = false
- error_string = 'certification revoked'
- end
- end
- end
+ if !ctx.current_crl
+ if crl = @crl_store.find_crl(cert)
+ crl_map[cert.subject] = true
+ if crl.revoked.find { |revoked| revoked.serial == cert.serial }
+ ok = false
+ error_string = 'certification revoked'
+ end
+ end
+ end
end
error_map[cert.subject] = error_string if error_string
ok
end
error = if result
- nil
- else
- error_map[cert.subject] || @x509store.error_string
- end
+ nil
+ else
+ error_map[cert.subject] || @x509store.error_string
+ end
return error, crl_map
end
@@ -105,13 +105,13 @@ private
cert = generate_cert(certfile)
case guess_cert_type(cert)
when CERT_TYPE_SELF_SIGNED
- @self_signed_ca << cert
+ @self_signed_ca << cert
when CERT_TYPE_OTHER
- @other_ca << cert
+ @other_ca << cert
when CERT_TYPE_EE
- @ee << cert
+ @ee << cert
else
- raise "Unknown cert type."
+ raise "Unknown cert type."
end
end
@c_store.get_crls.each do |crlfile|
@@ -128,21 +128,21 @@ private
# Ignores criticality of extensions. It's 'guess'ing.
case ext.oid
when 'basicConstraints'
- /CA:(TRUE|FALSE), pathlen:(\d+)/ =~ ext.value
- ca = ($1 == 'TRUE') unless ca
+ /CA:(TRUE|FALSE), pathlen:(\d+)/ =~ ext.value
+ ca = ($1 == 'TRUE') unless ca
when 'keyUsage'
- usage = ext.value.split(/\s*,\s*/)
- ca = usage.include?('Certificate Sign') unless ca
+ usage = ext.value.split(/\s*,\s*/)
+ ca = usage.include?('Certificate Sign') unless ca
when 'nsCertType'
- usage = ext.value.split(/\s*,\s*/)
- ca = usage.include?('SSL CA') unless ca
+ usage = ext.value.split(/\s*,\s*/)
+ ca = usage.include?('SSL CA') unless ca
end
end
if ca
if self_signed
- CERT_TYPE_SELF_SIGNED
+ CERT_TYPE_SELF_SIGNED
else
- CERT_TYPE_OTHER
+ CERT_TYPE_OTHER
end
else
CERT_TYPE_EE
diff --git a/sample/openssl/crlstore.rb b/sample/openssl/crlstore.rb
index b305913eb0..e3a592567c 100644
--- a/sample/openssl/crlstore.rb
+++ b/sample/openssl/crlstore.rb
@@ -24,22 +24,22 @@ private
end
unless crlfiles = @c_store.get_crls(ca.subject)
if crl = renew_crl(cert, ca)
- @c_store.add_crl(crl)
- return crl
+ @c_store.add_crl(crl)
+ return crl
end
return nil
end
crlfiles.each do |crlfile|
next unless crl = load_crl(crlfile)
if crl.next_update < Time.now
- if new_crl = renew_crl(cert, ca)
- @c_store.delete_crl(crl)
- @c_store.add_crl(new_crl)
- crl = new_crl
- end
+ if new_crl = renew_crl(cert, ca)
+ @c_store.delete_crl(crl)
+ @c_store.add_crl(new_crl)
+ crl = new_crl
+ end
end
if check_valid(crl, ca)
- return crl
+ return crl
end
end
nil
@@ -49,7 +49,7 @@ private
@c_store.get_certs(cert.issuer).each do |cafile|
ca = load_cert(cafile)
if cert.verify(ca.public_key)
- return ca
+ return ca
end
end
nil
@@ -58,10 +58,10 @@ private
def fetch(location)
if /\AURI:(.*)\z/ =~ location
begin
- c = HTTPAccess2::Client.new(ENV['http_proxy'] || ENV['HTTP_PROXY'])
- c.get_content($1)
+ c = HTTPAccess2::Client.new(ENV['http_proxy'] || ENV['HTTP_PROXY'])
+ c.get_content($1)
rescue NameError, StandardError
- nil
+ nil
end
else
nil
@@ -103,10 +103,10 @@ private
def renew_crl(cert, ca)
if cdp = get_cdp(cert)
if new_crl_str = fetch(cdp)
- new_crl = load_crl_str(new_crl_str)
- if check_valid(new_crl, ca)
- return new_crl
- end
+ new_crl = load_crl_str(new_crl_str)
+ if check_valid(new_crl, ca)
+ return new_crl
+ end
end
end
false
diff --git a/sample/optparse/opttest.rb b/sample/optparse/opttest.rb
index 9247af494f..b2013c5253 100755
--- a/sample/optparse/opttest.rb
+++ b/sample/optparse/opttest.rb
@@ -18,49 +18,89 @@ ARGV.options do
opts.on_tail("common options:")
# no argument, shows at tail
- opts.on_tail("--help", "show this message") {puts opts; exit}
+ opts.on_tail("--help", "show this message") do
+ puts opts
+ exit
+ end
# mandatory argument
opts.on("-r", "--require=LIBRARY", String,
- "require the LIBRARY, before",
- "executing your script") {|lib|@library=lib}
+ "require the LIBRARY, before",
+ "executing your script") do
+ |lib|
+ @library = lib
+ end
# optional argument
opts.on("-i", "--inplace=[EXTENSION]",
- "edit ARGV files in place", # multiline description
- "(make backup if EXTENSION supplied)") {|inplace| @inplace = inplace || ''}
+ "edit ARGV files in place", # multiline description
+ "(make backup if EXTENSION supplied)") do
+ |inplace|
+ @inplace = inplace || ''
+ end
- opts.on("-N=[NUM]", Integer) {|num|@number=num}
+ opts.on("-N=[NUM]", Integer) do
+ |num|
+ @number = num
+ end
# additional class
- opts.on("-t", "--[no-]time[=TIME]", Time, "it's the time") {|time|@time=time}
+ opts.on("-t", "--[no-]time[=TIME]", Time, "it's the time") do
+ |time|
+ @time = time
+ end
# limit argument syntax
opts.on("-[0-7]", "-F", "--irs=[OCTAL]", OptionParser::OctalInteger,
- "specify record separator", "(\\0, if no argument)") {|irs|@irs=irs}
+ "specify record separator", "(\\0, if no argument)") do
+ |irs|
+ @irs = irs
+ end
# boolean switch(default true)
@exec = true
- opts.on("-n", "--no-exec[=FLAG]", TrueClass, "not really execute") {|exec|@exec=exec}
+ opts.on("-n", "--no-exec[=FLAG]", TrueClass, "not really execute") do
+ |exec|
+ @exec = exec
+ end
# array
- opts.on("-a", "--list[=LIST,LIST]", Array, "list") {|list|@list=list}
+ opts.on("-a", "--list[=LIST,LIST]", Array, "list") do
+ |list|
+ @list = list
+ end
# fixed size array
- opts.on("--pair[=car,cdr]", Array, "pair") {|x,y|@x=x; @y=y}
+ opts.on("--pair[=car,cdr]", Array, "pair") do
+ |x, y|
+ @x = x
+ @y = y
+ end
# keyword completion
opts.on("--code=CODE", CODES, CODE_ALIASES, "select coding system",
- "("+CODES.join(",")+",", " "+CODE_ALIASES.keys.join(",")+")") {|c|@code=c}
+ "("+CODES.join(",")+",", " "+CODE_ALIASES.keys.join(",")+")") do
+ |c|
+ @code = c
+ end
# optional argument with keyword completion
- opts.on("--type[=TYPE]", [:text, :binary], "select type(text, binary)") {|t|@type=t}
+ opts.on("--type[=TYPE]", [:text, :binary], "select type(text, binary)") do
+ |t|
+ @type = t
+ end
# boolean switch with optional argument(default false)
- opts.on("-v", "--[no-]verbose=[FLAG]", "run verbosely") {|v|@verbose=v}
+ opts.on("-v", "--[no-]verbose=[FLAG]", "run verbosely") do
+ |v|
+ @verbose = v
+ end
# easy way, set local variable
- opts.on("-q", "--quit", "quit when ARGV is empty") {|q|@quit=q}
+ opts.on("-q", "--quit", "quit when ARGV is empty") do
+ |q|
+ @quit = q
+ end
# adding on the fly
opts.on("--add=SWITCH=[ARG]", "add option on the fly", /\A(\w+)(?:=.+)?\Z/) do
diff --git a/sample/pstore.rb b/sample/pstore.rb
new file mode 100644
index 0000000000..38c2305516
--- /dev/null
+++ b/sample/pstore.rb
@@ -0,0 +1,19 @@
+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/expect_sample.rb b/sample/pty/expect_sample.rb
index d3b072b83c..2f87f21895 100644
--- a/sample/pty/expect_sample.rb
+++ b/sample/pty/expect_sample.rb
@@ -3,7 +3,7 @@
#
# by A. Ito
#
-# This program reports the latest version of ruby interpreter
+# This program reports the latest version of Ruby interpreter
# by connecting to ftp server at ruby-lang.org.
#
require 'pty'
diff --git a/sample/rcs.awk b/sample/rcs.awk
index 08979285c9..e64af5b628 100644
--- a/sample/rcs.awk
+++ b/sample/rcs.awk
@@ -1,33 +1,33 @@
BEGIN {
- sw = 40.0;
- dw = 78.0;
- hdw = dw / 2.0;
- w = 20.0;
- h =1.0;
- d = 0.2;
- ss="abcdefghijklmnopqrstuvwxyz0123456789!#$%^&*()-=\\[];'`,./";
- rnd = srand();
+ sw = 40.0;
+ dw = 78.0;
+ hdw = dw / 2.0;
+ w = 20.0;
+ h =1.0;
+ d = 0.2;
+ ss="abcdefghijklmnopqrstuvwxyz0123456789!#$%^&*()-=\\[];'`,./";
+ rnd = srand();
}
{
- xr = -hdw; y = h * 1.0; maxxl = -999;
- s = "";
- while (xr < hdw) {
- x = xr * (1 + y) - y * w / 2;
- i = (x / (1 + h) + sw /2);
- c = (0 < i && i < length($0)) ? substr($0, i, 1) : "0";
- y = h - d * c;
- xl = xr - w * y / (1 + y);
- if (xl < -hdw || xl >= hdw || xl <= maxxl) {
- t = rand() * length(ss);
- c = substr(ss, t, 1);
- }
- else {
- c = substr(s, xl + hdw, 1);
- maxxl = xl;
- }
- s = s c;
- xr = xr + 1;
+ xr = -hdw; y = h * 1.0; maxxl = -999;
+ s = "";
+ while (xr < hdw) {
+ x = xr * (1 + y) - y * w / 2;
+ i = (x / (1 + h) + sw /2);
+ c = (0 < i && i < length($0)) ? substr($0, i, 1) : "0";
+ y = h - d * c;
+ xl = xr - w * y / (1 + y);
+ if (xl < -hdw || xl >= hdw || xl <= maxxl) {
+ t = rand() * length(ss);
+ c = substr(ss, t, 1);
}
- print s;
+ else {
+ c = substr(s, xl + hdw, 1);
+ maxxl = xl;
+ }
+ s = s c;
+ xr = xr + 1;
+ }
+ print s;
}
diff --git a/sample/rinda-ring.rb b/sample/rinda-ring.rb
new file mode 100644
index 0000000000..f9bd934029
--- /dev/null
+++ b/sample/rinda-ring.rb
@@ -0,0 +1,22 @@
+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/tempfile.rb b/sample/tempfile.rb
new file mode 100644
index 0000000000..5a363614a3
--- /dev/null
+++ b/sample/tempfile.rb
@@ -0,0 +1,8 @@
+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 21547c442c..4bef6bc392 100755
--- a/sample/test.rb
+++ b/sample/test.rb
@@ -645,7 +645,8 @@ end
test_check "while/until";
-tmp = open("while_tmp", "w")
+while_tmp = "while_tmp.#{$$}"
+tmp = open(while_tmp, "w")
tmp.print "tvi925\n";
tmp.print "tvi920\n";
tmp.print "vt100\n";
@@ -655,7 +656,7 @@ tmp.close
# test break
-tmp = open("while_tmp", "r")
+tmp = open(while_tmp, "r")
test_ok(tmp.kind_of?(File))
while line = tmp.gets()
@@ -667,7 +668,7 @@ tmp.close
# test next
$bad = false
-tmp = open("while_tmp", "r")
+tmp = open(while_tmp, "r")
while line = tmp.gets()
next if /vt100/ =~ line
$bad = 1 if /vt100/ =~ line
@@ -677,7 +678,7 @@ tmp.close
# test redo
$bad = false
-tmp = open("while_tmp", "r")
+tmp = open(while_tmp, "r")
while line = tmp.gets()
lastline = line
line = line.gsub(/vt100/, 'VT100')
@@ -703,7 +704,7 @@ test_ok(sum == 220)
# test interval
$bad = false
-tmp = open("while_tmp", "r")
+tmp = open(while_tmp, "r")
while line = tmp.gets()
break if 3
case line
@@ -714,8 +715,8 @@ end
test_ok(!$bad)
tmp.close
-File.unlink "while_tmp" or `/bin/rm -f "while_tmp"`
-test_ok(!File.exist?("while_tmp"))
+File.unlink while_tmp or `/bin/rm -f "#{while_tmp}"`
+test_ok(!File.exist?(while_tmp))
i = 0
until i>4
@@ -1969,21 +1970,22 @@ test_check "system"
test_ok(`echo foobar` == "foobar\n")
test_ok(`./miniruby -e 'print "foobar"'` == 'foobar')
-tmp = open("script_tmp", "w")
+script_tmp = "script_tmp.#{$$}"
+tmp = open(script_tmp, "w")
tmp.print "print $zzz\n";
tmp.close
-test_ok(`./miniruby -s script_tmp -zzz` == 'true')
-test_ok(`./miniruby -s script_tmp -zzz=555` == '555')
+test_ok(`./miniruby -s #{script_tmp} -zzz` == 'true')
+test_ok(`./miniruby -s #{script_tmp} -zzz=555` == '555')
-tmp = open("script_tmp", "w")
+tmp = open(script_tmp, "w")
tmp.print "#! /usr/local/bin/ruby -s\n";
tmp.print "print $zzz\n";
tmp.close
-test_ok(`./miniruby script_tmp -zzz=678` == '678')
+test_ok(`./miniruby #{script_tmp} -zzz=678` == '678')
-tmp = open("script_tmp", "w")
+tmp = open(script_tmp, "w")
tmp.print "this is a leading junk\n";
tmp.print "#! /usr/local/bin/ruby -s\n";
tmp.print "print $zzz\n";
@@ -1991,18 +1993,18 @@ tmp.print "__END__\n";
tmp.print "this is a trailing junk\n";
tmp.close
-test_ok(`./miniruby -x script_tmp` == '')
-test_ok(`./miniruby -x script_tmp -zzz=555` == '555')
+test_ok(`./miniruby -x #{script_tmp}` == '')
+test_ok(`./miniruby -x #{script_tmp} -zzz=555` == '555')
-tmp = open("script_tmp", "w")
+tmp = open(script_tmp, "w")
for i in 1..5
tmp.print i, "\n"
end
tmp.close
-`./miniruby -i.bak -pe '$_.sub!(/^[0-9]+$/){$&.to_i * 5}' script_tmp`
+`./miniruby -i.bak -pe '$_.sub!(/^[0-9]+$/){$&.to_i * 5}' #{script_tmp}`
done = true
-tmp = open("script_tmp", "r")
+tmp = open(script_tmp, "r")
while tmp.gets
if $_.to_i % 5 != 0
done = false
@@ -2012,8 +2014,8 @@ end
tmp.close
test_ok(done)
-File.unlink "script_tmp" or `/bin/rm -f "script_tmp"`
-File.unlink "script_tmp.bak" or `/bin/rm -f "script_tmp.bak"`
+File.unlink script_tmp or `/bin/rm -f "#{script_tmp}"`
+File.unlink "#{script_tmp}.bak" or `/bin/rm -f "#{script_tmp}.bak"`
test_check "const"
TEST1 = 1
diff --git a/sample/trick2013/README.md b/sample/trick2013/README.md
new file mode 100644
index 0000000000..65f1d3b8ad
--- /dev/null
+++ b/sample/trick2013/README.md
@@ -0,0 +1,13 @@
+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
+
+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
new file mode 100644
index 0000000000..84c011ee05
--- /dev/null
+++ b/sample/trick2013/kinaba/authors.markdown
@@ -0,0 +1,3 @@
+* kinaba
+ * kiki@kmonos.net
+ * cctld: jp
diff --git a/sample/trick2013/kinaba/entry.rb b/sample/trick2013/kinaba/entry.rb
new file mode 100644
index 0000000000..8a3f855e46
--- /dev/null
+++ b/sample/trick2013/kinaba/entry.rb
@@ -0,0 +1 @@
+!@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
new file mode 100644
index 0000000000..e35550e9af
--- /dev/null
+++ b/sample/trick2013/kinaba/remarks.markdown
@@ -0,0 +1,37 @@
+### 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*. Only the 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., #unsed...) 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 with 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
new file mode 100644
index 0000000000..e99cd71554
--- /dev/null
+++ b/sample/trick2013/mame/authors.markdown
@@ -0,0 +1,3 @@
+* Yusuke Endoh
+ * mame@tsg.ne.jp
+ * cctld: jp
diff --git a/sample/trick2013/mame/entry.rb b/sample/trick2013/mame/entry.rb
new file mode 100644
index 0000000000..8abfc2be40
--- /dev/null
+++ b/sample/trick2013/mame/entry.rb
@@ -0,0 +1,97 @@
+ 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
new file mode 100644
index 0000000000..6d1e87c01c
--- /dev/null
+++ b/sample/trick2013/mame/music-box.mp4
Binary files differ
diff --git a/sample/trick2013/mame/remarks.markdown b/sample/trick2013/mame/remarks.markdown
new file mode 100644
index 0000000000..8c1988c809
--- /dev/null
+++ b/sample/trick2013/mame/remarks.markdown
@@ -0,0 +1,47 @@
+### 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
new file mode 100644
index 0000000000..7ea2298a1a
--- /dev/null
+++ b/sample/trick2013/shinh/authors.markdown
@@ -0,0 +1,2 @@
+Shinichiro Hamaji
+Japan, .jp
diff --git a/sample/trick2013/shinh/entry.rb b/sample/trick2013/shinh/entry.rb
new file mode 100644
index 0000000000..cd4517358a
--- /dev/null
+++ b/sample/trick2013/shinh/entry.rb
@@ -0,0 +1,10 @@
+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
new file mode 100644
index 0000000000..1cd190db9f
--- /dev/null
+++ b/sample/trick2013/shinh/remarks.markdown
@@ -0,0 +1,4 @@
+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
new file mode 100644
index 0000000000..c0adc2bfdb
--- /dev/null
+++ b/sample/trick2013/yhara/authors.markdown
@@ -0,0 +1,3 @@
+* Yutaka Hara
+ * yutaka.hara.gmail.com
+ * cctld: jp
diff --git a/sample/trick2013/yhara/entry.rb b/sample/trick2013/yhara/entry.rb
new file mode 100644
index 0000000000..a2deb54399
--- /dev/null
+++ b/sample/trick2013/yhara/entry.rb
@@ -0,0 +1,28 @@
+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
new file mode 100644
index 0000000000..bd821e882c
--- /dev/null
+++ b/sample/trick2013/yhara/remarks.en.markdown
@@ -0,0 +1,23 @@
+### 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
new file mode 100644
index 0000000000..99cb4b557c
--- /dev/null
+++ b/sample/trick2013/yhara/remarks.markdown
@@ -0,0 +1,24 @@
+### 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/trojan.rb b/sample/trojan.rb
index 2be9567b98..cea0dae098 100644
--- a/sample/trojan.rb
+++ b/sample/trojan.rb
@@ -7,7 +7,7 @@ for dir in path
for f in d = Dir.open(dir)
fpath = File.join(dir, f)
if File.file?(fpath) && (File.stat(fpath).mode & 022) != 0
- printf("file %s is writable from other users\n", fpath)
+ printf("file %s is writable from other users\n", fpath)
end
end
d.close
diff --git a/sample/weakref.rb b/sample/weakref.rb
new file mode 100644
index 0000000000..b9f38f954f
--- /dev/null
+++ b/sample/weakref.rb
@@ -0,0 +1,9 @@
+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 39cc5e0f56..075738576b 100644
--- a/signal.c
+++ b/signal.c
@@ -18,6 +18,23 @@
#include <errno.h>
#include "ruby_atomic.h"
#include "eval_intern.h"
+#include "internal.h"
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#ifdef HAVE_VALGRIND_MEMCHECK_H
+# include <valgrind/memcheck.h>
+# ifndef VALGRIND_MAKE_MEM_DEFINED
+# define VALGRIND_MAKE_MEM_DEFINED(p, n) VALGRIND_MAKE_READABLE((p), (n))
+# endif
+# ifndef VALGRIND_MAKE_MEM_UNDEFINED
+# define VALGRIND_MAKE_MEM_UNDEFINED(p, n) VALGRIND_MAKE_WRITABLE((p), (n))
+# endif
+#else
+# define VALGRIND_MAKE_MEM_DEFINED(p, n) 0
+# define VALGRIND_MAKE_MEM_UNDEFINED(p, n) 0
+#endif
#if defined(__native_client__) && defined(NACL_NEWLIB)
# include "nacl/signal.h"
@@ -38,7 +55,7 @@ ruby_atomic_compare_and_swap(rb_atomic_t *ptr, rb_atomic_t cmp,
{
rb_atomic_t old = *ptr;
if (old == cmp) {
- *ptr = newval;
+ *ptr = newval;
}
return old;
}
@@ -70,12 +87,12 @@ static const struct signals {
#ifdef SIGTRAP
{"TRAP", SIGTRAP},
#endif
-#ifdef SIGIOT
- {"IOT", SIGIOT},
-#endif
#ifdef SIGABRT
{"ABRT", SIGABRT},
#endif
+#ifdef SIGIOT
+ {"IOT", SIGIOT},
+#endif
#ifdef SIGEMT
{"EMT", SIGEMT},
#endif
@@ -191,6 +208,8 @@ static const struct signals {
{NULL, 0}
};
+static const char signame_prefix[3] = "SIG";
+
static int
signm2signo(const char *nm)
{
@@ -281,11 +300,17 @@ esignal_init(int argc, VALUE *argv, VALUE self)
}
}
else {
- signm = SYMBOL_P(sig) ? rb_id2name(SYM2ID(sig)) : StringValuePtr(sig);
- if (strncmp(signm, "SIG", 3) == 0) signm += 3;
+ 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;
+ }
signo = signm2signo(signm);
if (!signo) {
- rb_raise(rb_eArgError, "unsupported name `SIG%s'", signm);
+ rb_raise(rb_eArgError, "unsupported name `%.*s%"PRIsVALUE"'",
+ len, signame_prefix, sig);
}
sig = rb_sprintf("SIG%s", signm);
}
@@ -326,6 +351,9 @@ ruby_default_signal(int sig)
raise(sig);
}
+static int signal_ignored(int sig);
+static void signal_enque(int sig);
+
/*
* call-seq:
* Process.kill(signal, pid, ...) -> fixnum
@@ -361,7 +389,7 @@ ruby_default_signal(int sig)
*/
VALUE
-rb_f_kill(int argc, VALUE *argv)
+rb_f_kill(int argc, const VALUE *argv)
{
#ifndef HAVE_KILLPG
#define killpg(pg, sig) kill(-(pg), (sig))
@@ -369,7 +397,7 @@ rb_f_kill(int argc, VALUE *argv)
int negative = 0;
int sig;
int i;
- volatile VALUE str;
+ VALUE str;
const char *s;
rb_secure(2);
@@ -381,21 +409,24 @@ rb_f_kill(int argc, VALUE *argv)
break;
case T_SYMBOL:
- s = rb_id2name(SYM2ID(argv[0]));
- if (!s) rb_raise(rb_eArgError, "bad signal");
+ str = rb_sym2str(argv[0]);
goto str_signal;
case T_STRING:
- s = RSTRING_PTR(argv[0]);
+ str = argv[0];
str_signal:
+ s = RSTRING_PTR(str);
if (s[0] == '-') {
negative++;
s++;
}
- if (strncmp("SIG", s, 3) == 0)
+ if (strncmp(signame_prefix, s, sizeof(signame_prefix)) == 0)
s += 3;
- if ((sig = signm2signo(s)) == 0)
- rb_raise(rb_eArgError, "unsupported name `SIG%s'", s);
+ 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 (negative)
sig = -sig;
@@ -404,7 +435,6 @@ rb_f_kill(int argc, 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",
@@ -412,6 +442,8 @@ rb_f_kill(int argc, VALUE *argv)
break;
}
+ if (argc <= 1) return INT2FIX(0);
+
if (sig < 0) {
sig = -sig;
for (i=1; i<argc; i++) {
@@ -420,11 +452,46 @@ rb_f_kill(int argc, 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++) {
- if (kill(NUM2PIDT(argv[i]), sig) < 0)
+ rb_pid_t pid = NUM2PIDT(argv[i]);
+
+ if ((sig != 0) && (self != -1) && (pid == self)) {
+ /*
+ * 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:
+ if (signal_ignored(sig)) 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);
}
}
+ rb_thread_execute_interrupts(rb_thread_current());
+
return INT2FIX(i-1);
}
@@ -435,19 +502,24 @@ static struct {
#ifdef __dietlibc__
#define sighandler_t sh_t
+#else
+#define sighandler_t ruby_sighandler_t
#endif
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
-int rb_sigaltstack_size(void)
+int
+rb_sigaltstack_size(void)
{
/* XXX: BSD_vfprintf() uses >1500KiB stack and x86-64 need >5KiB stack. */
int size = 8192;
@@ -497,31 +569,45 @@ ruby_signal(int signum, sighandler_t handler)
sigemptyset(&sigact.sa_mask);
#ifdef USE_SIGALTSTACK
- sigact.sa_sigaction = (ruby_sigaction_t*)handler;
- sigact.sa_flags = SA_SIGINFO;
+ 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;
+ }
#else
sigact.sa_handler = handler;
sigact.sa_flags = 0;
#endif
+ switch (signum) {
#ifdef SA_NOCLDWAIT
- if (signum == SIGCHLD && handler == SIG_IGN)
- sigact.sa_flags |= SA_NOCLDWAIT;
+ case SIGCHLD:
+ if (handler == SIG_IGN)
+ sigact.sa_flags |= SA_NOCLDWAIT;
+ break;
#endif
#if defined(SA_ONSTACK) && defined(USE_SIGALTSTACK)
- if (signum == SIGSEGV
+ case SIGSEGV:
#ifdef SIGBUS
- || signum == SIGBUS
+ case SIGBUS:
#endif
- )
sigact.sa_flags |= SA_ONSTACK;
+ break;
#endif
+ }
+ (void)VALGRIND_MAKE_MEM_DEFINED(&old, sizeof(old));
if (sigaction(signum, &sigact, &old) < 0) {
if (errno != 0 && errno != EINVAL) {
rb_bug_errno("sigaction", errno);
}
}
- return old.sa_handler;
+ if (old.sa_flags & SA_SIGINFO)
+ return (sighandler_t)old.sa_sigaction;
+ else
+ return old.sa_handler;
}
sighandler_t
@@ -545,11 +631,32 @@ ruby_nativethread_signal(int signum, sighandler_t handler)
#endif
#endif
-static RETSIGTYPE
-sighandler(int sig)
+static int
+signal_ignored(int sig)
+{
+#ifdef POSIX_SIGNAL
+ struct sigaction old;
+ (void)VALGRIND_MAKE_MEM_DEFINED(&old, sizeof(old));
+ if (sigaction(sig, NULL, &old) < 0) return FALSE;
+ return old.sa_handler == SIG_IGN;
+#else
+ sighandler_t old = signal(sig, SIG_DFL);
+ signal(sig, old);
+ return old == SIG_IGN;
+#endif
+}
+
+static void
+signal_enque(int sig)
{
ATOMIC_INC(signal_buff.cnt[sig]);
ATOMIC_INC(signal_buff.size);
+}
+
+static RETSIGTYPE
+sighandler(int sig)
+{
+ signal_enque(sig);
rb_thread_wakeup_timer_thread();
#if !defined(BSD_SIGNAL) && !defined(POSIX_SIGNAL)
ruby_signal(sig, sighandler);
@@ -605,21 +712,78 @@ rb_get_next_signal(void)
}
-#ifdef USE_SIGALTSTACK
+#if defined(USE_SIGALTSTACK) || defined(_WIN32)
+NORETURN(void ruby_thread_stack_overflow(rb_thread_t *th));
+#if !(defined(HAVE_UCONTEXT_H) && (defined __i386__ || defined __x86_64__))
+#elif defined __linux__
+# define USE_UCONTEXT_REG 1
+#elif defined __APPLE__
+# define USE_UCONTEXT_REG 1
+#endif
+#ifdef USE_UCONTEXT_REG
+static void
+check_stack_overflow(const uintptr_t addr, const ucontext_t *ctx)
+{
+# if defined __linux__
+ const mcontext_t *mctx = &ctx->uc_mcontext;
+# 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__
+ const mcontext_t mctx = ctx->uc_mcontext;
+# if defined(__LP64__)
+ const uintptr_t sp = mctx->__ss.__rsp;
+# else
+ const uintptr_t sp = mctx->__ss.__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;
+ }
+ 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 *);
- NORETURN(void ruby_thread_stack_overflow(rb_thread_t *th));
- rb_thread_t *th = GET_THREAD();
+ rb_thread_t *th = ruby_current_thread;
if (ruby_stack_overflowed_p(th, addr)) {
ruby_thread_stack_overflow(th);
}
}
-#define CHECK_STACK_OVERFLOW() check_stack_overflow(info->si_addr)
+#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
#else
#define CHECK_STACK_OVERFLOW() (void)0
#endif
+#ifndef MESSAGE_FAULT_ADDRESS
+#define MESSAGE_FAULT_ADDRESS
+#endif
#ifdef SIGBUS
static RETSIGTYPE
@@ -627,18 +791,19 @@ sigbus(int sig SIGINFO_ARG)
{
/*
* Mac OS X makes KERN_PROTECTION_FAILURE when thread touch guard page.
- * and it's delivered as SIGBUS instaed of SIGSEGV to userland. It's crazy
+ * and it's delivered as SIGBUS instead of SIGSEGV to userland. It's crazy
* wrong IMHO. but anyway we have to care it. Sigh.
*/
#if defined __APPLE__
CHECK_STACK_OVERFLOW();
#endif
- rb_bug("Bus Error");
+ rb_bug_context(SIGINFO_CTX, "Bus Error" MESSAGE_FAULT_ADDRESS);
}
#endif
#ifdef SIGSEGV
-static void ruby_abort(void)
+static void
+ruby_abort(void)
{
#ifdef __sun
/* Solaris's abort() is async signal unsafe. Of course, it is not
@@ -652,14 +817,14 @@ static void ruby_abort(void)
}
static int segv_received = 0;
-extern int ruby_disable_gc_stress;
+extern int ruby_disable_gc;
static RETSIGTYPE
sigsegv(int sig SIGINFO_ARG)
{
if (segv_received) {
ssize_t RB_UNUSED_VAR(err);
- char msg[] = "SEGV received in SEGV handler\n";
+ static const char msg[] = "SEGV received in SEGV handler\n";
err = write(2, msg, sizeof(msg));
ruby_abort();
@@ -668,8 +833,8 @@ sigsegv(int sig SIGINFO_ARG)
CHECK_STACK_OVERFLOW();
segv_received = 1;
- ruby_disable_gc_stress = 1;
- rb_bug("Segmentation fault");
+ ruby_disable_gc = 1;
+ rb_bug_context(SIGINFO_CTX, "Segmentation fault" MESSAGE_FAULT_ADDRESS);
}
#endif
@@ -680,6 +845,15 @@ 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) {
@@ -811,7 +985,7 @@ trap_handler(VALUE *cmd, int sig)
else {
command = rb_check_string_type(*cmd);
if (NIL_P(command) && SYMBOL_P(*cmd)) {
- command = rb_id2str(SYM2ID(*cmd));
+ command = rb_sym2str(*cmd);
if (!command) rb_raise(rb_eArgError, "bad handler");
}
if (!NIL_P(command)) {
@@ -831,7 +1005,7 @@ trap_handler(VALUE *cmd, int sig)
if (strncmp(RSTRING_PTR(command), "SIG_IGN", 7) == 0) {
sig_ign:
func = SIG_IGN;
- *cmd = 0;
+ *cmd = Qtrue;
}
else if (strncmp(RSTRING_PTR(command), "SIG_DFL", 7) == 0) {
sig_dfl:
@@ -879,19 +1053,22 @@ trap_signm(VALUE vsig)
break;
case T_SYMBOL:
- s = rb_id2name(SYM2ID(vsig));
- if (!s) rb_raise(rb_eArgError, "bad signal");
+ vsig = rb_sym2str(vsig);
+ s = RSTRING_PTR(vsig);
goto str_signal;
default:
s = StringValuePtr(vsig);
str_signal:
- if (strncmp("SIG", s, 3) == 0)
+ if (strncmp(signame_prefix, s, sizeof(signame_prefix)) == 0)
s += 3;
sig = signm2signo(s);
- if (sig == 0 && strcmp(s, "EXIT") != 0)
- rb_raise(rb_eArgError, "unsupported signal SIG%s", 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);
+ }
}
return sig;
}
@@ -912,10 +1089,14 @@ trap(int sig, sighandler_t func, VALUE command)
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;
@@ -1069,7 +1250,8 @@ init_sigchld(int sig)
oldfunc = ruby_signal(sig, SIG_DFL);
if (oldfunc != SIG_DFL && oldfunc != SIG_IGN) {
ruby_signal(sig, oldfunc);
- } else {
+ }
+ else {
GET_VM()->trap_list[sig].cmd = 0;
}
rb_enable_interrupt();
@@ -1142,7 +1324,7 @@ 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("signm"), rb_intern("message"));
+ rb_alias(rb_eSignal, rb_intern_const("signm"), rb_intern_const("message"));
rb_define_method(rb_eInterrupt, "initialize", interrupt_init, -1);
install_sighandler(SIGINT, sighandler);
diff --git a/siphash.c b/siphash.c
index c100b14ee7..0df96f8320 100644
--- a/siphash.c
+++ b/siphash.c
@@ -29,7 +29,8 @@
#ifndef UNALIGNED_WORD_ACCESS
# if defined(__i386) || defined(__i386__) || defined(_M_IX86) || \
- defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD86) || \
+ defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || \
+ defined(__powerpc64__) || \
defined(__mc68020__)
# define UNALIGNED_WORD_ACCESS 1
# endif
@@ -417,7 +418,7 @@ sip_hash24(const uint8_t key[16], const uint8_t *data, size_t len)
SIP_2_ROUND(m, v0, v1, v2, v3);
}
}
-#elif BYTE_ORDER == BIG_ENDIAN
+#else
for (; data != end; data += sizeof(uint64_t)) {
m = U8TO64_LE(data);
SIP_2_ROUND(m, v0, v1, v2, v3);
@@ -453,7 +454,7 @@ sip_hash24(const uint8_t key[16], const uint8_t *data, size_t len)
last.lo |= ((uint32_t *) end)[0];
#endif
break;
-#elif BYTE_ORDER == BIG_ENDIAN
+#else
OR_BYTE(3);
#endif
case 3:
diff --git a/sparc.c b/sparc.c
index 5c5dc8ef8e..dc3779035f 100644
--- a/sparc.c
+++ b/sparc.c
@@ -12,7 +12,16 @@
void
rb_sparc_flush_register_windows(void)
{
- asm
+/*
+ * gcc doesn't provide "asm" keyword if -ansi and the various -std options
+ * are given.
+ * http://gcc.gnu.org/onlinedocs/gcc/Alternate-Keywords.html
+ */
+#ifndef __GNUC__
+#define __asm__ asm
+#endif
+
+ __asm__
#ifdef __GNUC__
__volatile__
#endif
diff --git a/spec/default.mspec b/spec/default.mspec
index c4b75f614a..0506f1d86a 100644
--- a/spec/default.mspec
+++ b/spec/default.mspec
@@ -1,8 +1,8 @@
-load File.dirname(__FILE__) + '/rubyspec/ruby.1.9.mspec'
+load File.dirname(__FILE__) + '/rubyspec/ruby.2.2.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
}
diff --git a/sprintf.c b/sprintf.c
index 9443c69925..85adc216f3 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -14,6 +14,8 @@
#include "ruby/ruby.h"
#include "ruby/re.h"
#include "ruby/encoding.h"
+#include "internal.h"
+#include "id.h"
#include <math.h>
#include <stdarg.h>
@@ -22,35 +24,10 @@
#endif
#define BIT_DIGITS(N) (((N)*146)/485 + 1) /* log2(10) =~ 146/485 */
-#define BITSPERDIG (SIZEOF_BDIGITS*CHAR_BIT)
-#define EXTENDSIGN(n, l) (((~0 << (n)) >> (((n)*(l)) % BITSPERDIG)) & ~(~0 << (n)))
-static void fmt_setup(char*,size_t,int,int,int,int);
-
-static char*
-remove_sign_bits(char *str, int base)
-{
- char *t = str;
-
- if (base == 16) {
- while (*t == 'f') {
- t++;
- }
- }
- else if (base == 8) {
- *t |= EXTENDSIGN(3, strlen(t));
- while (*t == '7') {
- t++;
- }
- }
- else if (base == 2) {
- while (*t == '1') {
- t++;
- }
- }
+extern const char ruby_digitmap[];
- return t;
-}
+static void fmt_setup(char*,size_t,int,int,int,int);
static char
sign_bits(int base, const char *p)
@@ -103,55 +80,96 @@ sign_bits(int base, const char *p)
} while (0)
#define GETARG() (nextvalue != Qundef ? nextvalue : \
- 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) : \
+ GETNEXTARG())
+
+#define GETNEXTARG() ( \
+ check_next_arg(posarg, nextarg), \
(posarg = nextarg++, GETNTHARG(posarg)))
-#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 GETPOSARG(n) ( \
+ check_pos_arg(posarg, (n)), \
+ (posarg = -1, GETNTHARG(n)))
#define GETNTHARG(nth) \
(((nth) >= argc) ? (rb_raise(rb_eArgError, "too few arguments"), 0) : argv[(nth)])
-#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 CHECKNAMEARG(name, len, enc) ( \
+ check_name_arg(posarg, name, len, enc), \
+ posarg = -2)
#define GETNUM(n, val) \
- for (; p < end && rb_enc_isdigit(*p, enc); p++) { \
- int next_n = 10 * (n) + (*p - '0'); \
- if (next_n / 10 != (n)) {\
- rb_raise(rb_eArgError, #val " too big"); \
- } \
- (n) = next_n; \
- } \
- if (p >= end) { \
- rb_raise(rb_eArgError, "malformed format string - %%*[0-9]"); \
- }
+ (!(p = get_num(p, end, enc, &(n))) ? \
+ rb_raise(rb_eArgError, #val " too big") : (void)0)
#define GETASTER(val) do { \
t = p++; \
n = 0; \
- GETNUM(n, (val)); \
+ GETNUM(n, val); \
if (*p == '$') { \
tmp = GETPOSARG(n); \
} \
else { \
- tmp = GETARG(); \
+ tmp = GETNEXTARG(); \
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)
{
@@ -438,6 +456,7 @@ 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;
@@ -489,7 +508,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
for (; p < end; p++) {
const char *t;
int n;
- ID id = 0;
+ VALUE sym = Qnil;
for (t = p; t < end && *t != '%'; t++) ;
PUSH(p, t - p);
@@ -584,15 +603,16 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
}
#endif
len = (int)(p - start + 1); /* including parenthesis */
- if (id) {
- rb_enc_raise(enc, rb_eArgError, "named%.*s after <%s>",
- len, start, rb_id2name(id));
+ if (sym != Qnil) {
+ rb_enc_raise(enc, rb_eArgError, "named%.*s after <%"PRIsVALUE">",
+ len, start, rb_sym2str(sym));
}
- nextvalue = GETNAMEARG((id = rb_check_id_cstr(start + 1,
- len - 2 /* without parenthesis */,
- enc),
- ID2SYM(id)),
- start, len, enc);
+ CHECKNAMEARG(start, len, enc);
+ get_hash(&hash, argc, argv);
+ sym = rb_check_symbol_cstr(start + 1,
+ len - 2 /* without parenthesis */,
+ enc);
+ if (sym != Qnil) nextvalue = rb_hash_lookup2(hash, sym, Qundef);
if (nextvalue == Qundef) {
rb_enc_raise(enc, rb_eKeyError, "key%.*s not found", len, start);
}
@@ -754,7 +774,8 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
case 'u':
{
volatile VALUE val = GETARG();
- char fbuf[32], nbuf[64], *s;
+ int valsign;
+ char nbuf[64], *s;
const char *prefix = 0;
int sign = 0, dots = 0;
char sc = 0;
@@ -831,96 +852,98 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
base = 10; break;
}
- if (!bignum) {
- if (base == 2) {
- val = rb_int2big(v);
- goto bin_retry;
- }
- if (sign) {
- char c = *p;
- if (c == 'i') c = 'd'; /* %d and %i are identical */
- if (v < 0) {
- v = -v;
- sc = '-';
- width--;
- }
- else if (flags & FPLUS) {
- sc = '+';
- width--;
- }
- else if (flags & FSPACE) {
- sc = ' ';
- width--;
- }
- snprintf(fbuf, sizeof(fbuf), "%%l%c", c);
- snprintf(nbuf, sizeof(nbuf), fbuf, v);
- s = nbuf;
- }
- else {
- s = nbuf;
- if (v < 0) {
- dots = 1;
- }
- snprintf(fbuf, sizeof(fbuf), "%%l%c", *p == 'X' ? 'x' : *p);
- snprintf(++s, sizeof(nbuf) - 1, fbuf, v);
- if (v < 0) {
- char d = 0;
-
- s = remove_sign_bits(s, base);
- switch (base) {
- case 16:
- d = 'f'; break;
- case 8:
- d = '7'; break;
- }
- if (d && *s != d) {
- *--s = d;
- }
- }
- }
+ if (base != 10) {
+ int numbits = ffs(base)-1;
+ size_t abs_nlz_bits;
+ size_t numdigits = rb_absint_numwords(val, numbits, &abs_nlz_bits);
+ long i;
+ if (INT_MAX-1 < numdigits) /* INT_MAX is used because rb_long2int is used later. */
+ rb_raise(rb_eArgError, "size too big");
+ if (sign) {
+ if (numdigits == 0)
+ numdigits = 1;
+ tmp = rb_str_new(NULL, numdigits);
+ valsign = rb_integer_pack(val, RSTRING_PTR(tmp), RSTRING_LEN(tmp),
+ 1, CHAR_BIT-numbits, INTEGER_PACK_BIG_ENDIAN);
+ for (i = 0; i < RSTRING_LEN(tmp); i++)
+ RSTRING_PTR(tmp)[i] = ruby_digitmap[((unsigned char *)RSTRING_PTR(tmp))[i]];
+ s = RSTRING_PTR(tmp);
+ if (valsign < 0) {
+ sc = '-';
+ width--;
+ }
+ else if (flags & FPLUS) {
+ sc = '+';
+ width--;
+ }
+ else if (flags & FSPACE) {
+ sc = ' ';
+ width--;
+ }
+ }
+ else {
+ /* Following conditional "numdigits++" guarantees the
+ * most significant digit as
+ * - '1'(bin), '7'(oct) or 'f'(hex) for negative numbers
+ * - '0' for zero
+ * - not '0' for positive numbers.
+ *
+ * It also guarantees the most significant two
+ * digits will not be '11'(bin), '77'(oct), 'ff'(hex)
+ * or '00'. */
+ if (numdigits == 0 ||
+ ((abs_nlz_bits != (size_t)(numbits-1) ||
+ !rb_absint_singlebit_p(val)) &&
+ (!bignum ? v < 0 : BIGNUM_NEGATIVE_P(val))))
+ numdigits++;
+ tmp = rb_str_new(NULL, numdigits);
+ valsign = rb_integer_pack(val, RSTRING_PTR(tmp), RSTRING_LEN(tmp),
+ 1, CHAR_BIT-numbits, INTEGER_PACK_2COMP | INTEGER_PACK_BIG_ENDIAN);
+ for (i = 0; i < RSTRING_LEN(tmp); i++)
+ RSTRING_PTR(tmp)[i] = ruby_digitmap[((unsigned char *)RSTRING_PTR(tmp))[i]];
+ s = RSTRING_PTR(tmp);
+ dots = valsign < 0;
+ }
+ len = rb_long2int(RSTRING_END(tmp) - s);
+ }
+ else if (!bignum) {
+ valsign = 1;
+ if (v < 0) {
+ v = -v;
+ sc = '-';
+ width--;
+ valsign = -1;
+ }
+ else if (flags & FPLUS) {
+ sc = '+';
+ width--;
+ }
+ else if (flags & FSPACE) {
+ sc = ' ';
+ width--;
+ }
+ snprintf(nbuf, sizeof(nbuf), "%ld", v);
+ s = nbuf;
len = (int)strlen(s);
}
else {
- if (sign) {
- tmp = rb_big2str(val, base);
- s = RSTRING_PTR(tmp);
- if (s[0] == '-') {
- s++;
- sc = '-';
- width--;
- }
- else if (flags & FPLUS) {
- sc = '+';
- width--;
- }
- else if (flags & FSPACE) {
- sc = ' ';
- width--;
- }
- }
- else {
- if (!RBIGNUM_SIGN(val)) {
- val = rb_big_clone(val);
- rb_big_2comp(val);
- }
- tmp = rb_big2str0(val, base, RBIGNUM_SIGN(val));
- s = RSTRING_PTR(tmp);
- if (*s == '-') {
- dots = 1;
- if (base == 10) {
- rb_warning("negative number for %%u specifier");
- }
- s = remove_sign_bits(++s, base);
- switch (base) {
- case 16:
- if (s[0] != 'f') *--s = 'f'; break;
- case 8:
- if (s[0] != '7') *--s = '7'; break;
- case 2:
- if (s[0] != '1') *--s = '1'; break;
- }
- }
- }
+ tmp = rb_big2str(val, 10);
+ s = RSTRING_PTR(tmp);
+ valsign = 1;
+ if (s[0] == '-') {
+ s++;
+ sc = '-';
+ width--;
+ valsign = -1;
+ }
+ else if (flags & FPLUS) {
+ sc = '+';
+ width--;
+ }
+ else if (flags & FSPACE) {
+ sc = ' ';
+ width--;
+ }
len = rb_long2int(RSTRING_END(tmp) - s);
}
@@ -979,21 +1002,15 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
}
CHECK(prec - len);
if (dots) PUSH("..", 2);
- if (!bignum && v < 0) {
+ if (!sign && valsign < 0) {
char c = sign_bits(base, p);
while (len < prec--) {
buf[blen++] = c;
}
}
else if ((flags & (FMINUS|FPREC)) != FMINUS) {
- char c;
-
- if (!sign && bignum && !RBIGNUM_SIGN(val))
- c = sign_bits(base, p);
- else
- c = '0';
while (len < prec--) {
- buf[blen++] = c;
+ buf[blen++] = '0';
}
}
PUSH(s, len);
@@ -1006,16 +1023,108 @@ 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 (!RB_TYPE_P(val, T_RATIONAL)) {
+ nextvalue = val;
+ goto float_value;
+ }
+ if (!(flags&FPREC)) prec = default_float_precision;
+ den = rb_rational_den(val);
+ num = rb_rational_num(val);
+ 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; /* 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) {
+ if (!(flags&FMINUS)) {
+ long i, shifting = (flags&FZERO) ? done - prefix : done;
+ for (i = 1; i <= shifting; i++)
+ buf[width - i] = buf[done - i];
+ blen -= shifting;
+ FILL((flags&FZERO) ? '0' : ' ', width - done);
+ blen += shifting;
+ } else {
+ FILL(' ', width - done);
+ }
+ }
+ 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 = 6;
+ int i, need;
char fbuf[32];
fval = RFLOAT_VALUE(rb_Float(val));
@@ -1067,7 +1176,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
if (i > 0)
need = BIT_DIGITS(i);
}
- need += (flags&FPREC) ? prec : 6;
+ need += (flags&FPREC) ? prec : default_float_precision;
if ((flags&FWIDTH) && need < width)
need = width;
need += 20;
@@ -1195,6 +1304,7 @@ ruby__sfvextra(rb_printf_buffer *fp, size_t valsize, void *valp, long *sz, int s
}
else {
value = rb_obj_as_string(value);
+ if (sign == ' ') value = QUOTE(value);
}
enc = rb_enc_compatible(result, value);
if (enc) {
@@ -1235,12 +1345,12 @@ rb_enc_vsprintf(rb_encoding *enc, const char *fmt, va_list ap)
}
f._bf._base = (unsigned char *)result;
f._p = (unsigned char *)RSTRING_PTR(result);
- RBASIC(result)->klass = 0;
+ RBASIC_CLEAR_CLASS(result);
f.vwrite = ruby__sfvwrite;
f.vextra = ruby__sfvextra;
buffer.value = 0;
BSD_vfprintf(&f, fmt, ap);
- RBASIC(result)->klass = rb_cString;
+ RBASIC_SET_CLASS_RAW(result, rb_cString);
rb_str_resize(result, (char *)f._p - RSTRING_PTR(result));
#undef f
@@ -1294,12 +1404,12 @@ rb_str_vcatf(VALUE str, const char *fmt, va_list ap)
f._bf._base = (unsigned char *)str;
f._p = (unsigned char *)RSTRING_END(str);
klass = RBASIC(str)->klass;
- RBASIC(str)->klass = 0;
+ RBASIC_CLEAR_CLASS(str);
f.vwrite = ruby__sfvwrite;
f.vextra = ruby__sfvextra;
buffer.value = 0;
BSD_vfprintf(&f, fmt, ap);
- RBASIC(str)->klass = klass;
+ RBASIC_SET_CLASS_RAW(str, klass);
rb_str_resize(str, (char *)f._p - RSTRING_PTR(str));
#undef f
diff --git a/st.c b/st.c
index c5550bc673..9f21a96196 100644
--- a/st.c
+++ b/st.c
@@ -33,8 +33,7 @@ typedef struct st_packed_entry {
#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 11
-#define ST_DEFAULT_SECOND_TABLE_SIZE 19
+#define ST_DEFAULT_INIT_TABLE_SIZE 16
#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))
@@ -67,13 +66,17 @@ static const struct st_hash_type type_strhash = {
static st_index_t strcasehash(st_data_t);
static const struct st_hash_type type_strcasehash = {
- st_strcasecmp,
+ st_locale_insensitive_strcasecmp,
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
@@ -85,7 +88,8 @@ static void rehash(st_table *);
#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 do_hash_bin(key,table) (do_hash((key), (table))%(table)->num_bins)
+#define hash_pos(h,n) ((h) & (n - 1))
+#define do_hash_bin(key,table) hash_pos(do_hash((key), (table)), (table)->num_bins)
/* preparation for possible allocation improvements */
#define st_alloc_entry() (st_table_entry *)malloc(sizeof(st_table_entry))
@@ -102,7 +106,7 @@ st_realloc_bins(st_table_entry **bins, st_index_t newsize, st_index_t oldsize)
return bins;
}
-/* Shortage */
+/* Shortcut */
#define bins as.big.bins
#define head as.big.head
#define tail as.big.tail
@@ -139,69 +143,18 @@ remove_safe_packed_entry(st_table *table, st_index_t i, st_data_t never)
PHASH_SET(table, i, 0);
}
-/*
- * 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)
{
- int i;
+ st_index_t i;
-#if 0
for (i=3; i<31; i++) {
- if ((1<<i) > size) return 1<<i;
- }
- return -1;
-#else
- st_index_t newsize;
-
- for (i = 0, newsize = MINSIZE; i < numberof(primes); i++, newsize <<= 1) {
- if (newsize > size) return primes[i];
+ if ((st_index_t)(1<<i) > size) return 1<<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
@@ -252,7 +205,7 @@ st_init_table_with_size(const struct st_hash_type *type, st_index_t size)
size = ST_DEFAULT_PACKED_TABLE_SIZE;
}
else {
- size = new_size(size); /* round up to prime number */
+ size = new_size(size); /* round up to power-of-two */
}
tbl->num_bins = size;
tbl->bins = st_alloc_bins(size);
@@ -375,7 +328,7 @@ 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_val)%(table)->num_bins)))
+ ((ptr) = find_entry((table), key, (hash_val), ((bin_pos) = hash_pos(hash_val, (table)->num_bins))))
static st_table_entry *
find_entry(st_table *table, st_data_t key, st_index_t hash_val, st_index_t bin_pos)
@@ -393,9 +346,8 @@ find_entry(st_table *table, st_data_t key, st_index_t hash_val, st_index_t bin_p
}
static inline st_index_t
-find_packed_index(st_table *table, st_index_t hash_val, st_data_t key)
+find_packed_index_from(st_table *table, st_index_t hash_val, st_data_t key, st_index_t i)
{
- st_index_t i = 0;
while (i < table->real_entries &&
(PHASH(table, i) != hash_val || !EQUAL(table, key, PKEY(table, i)))) {
i++;
@@ -403,6 +355,12 @@ find_packed_index(st_table *table, st_index_t hash_val, st_data_t key)
return i;
}
+static inline st_index_t
+find_packed_index(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
@@ -422,7 +380,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_val % table->num_bins);
+ ptr = find_entry(table, key, hash_val, hash_pos(hash_val, table->num_bins));
if (ptr == 0) {
return 0;
@@ -450,7 +408,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_val % table->num_bins);
+ ptr = find_entry(table, key, hash_val, hash_pos(hash_val, table->num_bins));
if (ptr == 0) {
return 0;
@@ -486,7 +444,7 @@ 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_val % table->num_bins;
+ bin_pos = hash_pos(hash_val, table->num_bins);
}
entry = new_entry(table, key, value, hash_val, bin_pos);
@@ -527,7 +485,7 @@ unpack_entries(register st_table *table)
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 % ST_DEFAULT_INIT_TABLE_SIZE);
+ hash_pos(hash, ST_DEFAULT_INIT_TABLE_SIZE));
*chain = entry;
entry->back = preventry;
preventry = entry;
@@ -550,7 +508,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_val % table->num_bins);
+ add_direct(table, key, value, hash_val, hash_pos(hash_val, table->num_bins));
}
}
@@ -631,7 +589,7 @@ st_add_direct(st_table *table, st_data_t key, st_data_t value)
return;
}
- add_direct(table, key, value, hash_val, hash_val % table->num_bins);
+ add_direct(table, key, value, hash_val, hash_pos(hash_val, table->num_bins));
}
static void
@@ -647,7 +605,7 @@ rehash(register st_table *table)
if ((ptr = table->head) != 0) {
do {
- hash_val = ptr->hash % new_num_bins;
+ hash_val = hash_pos(ptr->hash, new_num_bins);
ptr->next = new_bins[hash_val];
new_bins[hash_val] = ptr;
} while ((ptr = ptr->fore) != 0);
@@ -690,7 +648,7 @@ st_copy(st_table *old_table)
return 0;
}
*entry = *ptr;
- hash_val = entry->hash % num_bins;
+ hash_val = hash_pos(entry->hash, num_bins);
entry->next = new_table->bins[hash_val];
new_table->bins[hash_val] = entry;
entry->back = prev;
@@ -741,7 +699,7 @@ st_delete(register st_table *table, register st_data_t *key, st_data_t *value)
return 0;
}
- prev = &table->bins[hash_val % table->num_bins];
+ prev = &table->bins[hash_pos(hash_val, table->num_bins)];
for (;(ptr = *prev) != 0; prev = &ptr->next) {
if (EQUAL(table, *key, ptr->key)) {
*prev = ptr->next;
@@ -777,7 +735,7 @@ st_delete_safe(register st_table *table, register st_data_t *key, st_data_t *val
return 0;
}
- ptr = table->bins[hash_val % table->num_bins];
+ ptr = table->bins[hash_pos(hash_val, table->num_bins)];
for (; ptr != 0; ptr = ptr->next) {
if ((ptr->key != never) && EQUAL(table, ptr->key, *key)) {
@@ -793,6 +751,34 @@ st_delete_safe(register st_table *table, register st_data_t *key, st_data_t *val
return 0;
}
+int
+st_shift(register st_table *table, register st_data_t *key, st_data_t *value)
+{
+ st_table_entry **prev;
+ register st_table_entry *ptr;
+
+ if (table->num_entries == 0) {
+ if (value != 0) *value = 0;
+ return 0;
+ }
+
+ if (table->entries_packed) {
+ if (value != 0) *value = PVAL(table, 0);
+ *key = PKEY(table, 0);
+ remove_packed_entry(table, 0);
+ return 1;
+ }
+
+ prev = &table->bins[hash_pos(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;
+}
+
void
st_cleanup_safe(st_table *table, st_data_t never)
{
@@ -835,7 +821,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;
+ st_data_t value = 0, old_key;
int retval, existing = 0;
hash_val = do_hash(key, table);
@@ -848,6 +834,7 @@ 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);
@@ -859,6 +846,9 @@ 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:
@@ -877,14 +867,18 @@ 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_val % table->num_bins);
+ add_direct(table, key, value, hash_val, hash_pos(hash_val, table->num_bins));
break;
}
+ if (old_key != key) {
+ ptr->key = key;
+ }
ptr->record = value;
break;
case ST_DELETE:
@@ -892,7 +886,6 @@ 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);
@@ -920,7 +913,7 @@ st_foreach_check(st_table *table, int (*func)(ANYARGS), st_data_t arg, st_data_t
val = PVAL(table, i);
hash = PHASH(table, i);
if (key == never) continue;
- retval = (*func)(key, val, arg);
+ retval = (*func)(key, val, arg, 0);
if (!table->entries_packed) {
FIND_ENTRY(table, ptr, hash, i);
if (retval == ST_CHECK) {
@@ -934,9 +927,10 @@ 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(table, hash, key);
- if (i == table->real_entries) {
- goto deleted;
+ 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;
}
/* fall through */
case ST_CONTINUE:
@@ -958,8 +952,8 @@ st_foreach_check(st_table *table, int (*func)(ANYARGS), st_data_t arg, st_data_t
do {
if (ptr->key == never)
goto unpacked_continue;
- i = ptr->hash % table->num_bins;
- retval = (*func)(ptr->key, ptr->record, arg);
+ i = hash_pos(ptr->hash, table->num_bins);
+ retval = (*func)(ptr->key, ptr->record, arg, 0);
unpacked:
switch (retval) {
case ST_CHECK: /* check if hash is modified during iteration */
@@ -979,7 +973,7 @@ st_foreach_check(st_table *table, int (*func)(ANYARGS), st_data_t arg, st_data_t
case ST_STOP:
return 0;
case ST_DELETE:
- last = &table->bins[ptr->hash % table->num_bins];
+ last = &table->bins[hash_pos(ptr->hash, table->num_bins)];
for (; (tmp = *last) != 0; last = &tmp->next) {
if (ptr == tmp) {
tmp = ptr->fore;
@@ -1005,11 +999,12 @@ st_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
if (table->entries_packed) {
for (i = 0; i < table->real_entries; i++) {
- st_data_t key, val, hash;
+ st_data_t key, val;
+ st_index_t hash;
key = PKEY(table, i);
val = PVAL(table, i);
hash = PHASH(table, i);
- retval = (*func)(key, val, arg);
+ retval = (*func)(key, val, arg, 0);
if (!table->entries_packed) {
FIND_ENTRY(table, ptr, hash, i);
if (!ptr) return 0;
@@ -1035,8 +1030,8 @@ st_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
if (ptr != 0) {
do {
- i = ptr->hash % table->num_bins;
- retval = (*func)(ptr->key, ptr->record, arg);
+ i = hash_pos(ptr->hash, table->num_bins);
+ retval = (*func)(ptr->key, ptr->record, arg, 0);
unpacked:
switch (retval) {
case ST_CONTINUE:
@@ -1046,7 +1041,7 @@ st_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
case ST_STOP:
return 0;
case ST_DELETE:
- last = &table->bins[ptr->hash % table->num_bins];
+ last = &table->bins[hash_pos(ptr->hash, table->num_bins)];
for (; (tmp = *last) != 0; last = &tmp->next) {
if (ptr == tmp) {
tmp = ptr->fore;
@@ -1063,6 +1058,88 @@ st_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
return 0;
}
+static st_index_t
+get_keys(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 = table->head;
+ st_data_t *keys_end = keys + size;
+ for (; ptr && keys < keys_end; ptr = ptr->fore) {
+ 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(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 = table->head;
+ st_data_t *values_end = values + size;
+ for (; ptr && values < values_end; ptr = ptr->fore) {
+ 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(st_table *table, int (*func)(ANYARGS), st_data_t arg)
@@ -1077,7 +1154,7 @@ st_reverse_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
st_data_t key, val;
key = PKEY(table, i);
val = PVAL(table, i);
- retval = (*func)(key, val, arg);
+ retval = (*func)(key, val, arg, 0);
switch (retval) {
case ST_CHECK: /* check if hash is modified during iteration */
for (j = 0; j < table->num_entries; j++) {
@@ -1108,7 +1185,7 @@ st_reverse_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
retval = (*func)(ptr->key, ptr->record, arg, 0);
switch (retval) {
case ST_CHECK: /* check if hash is modified during iteration */
- i = ptr->hash % table->num_bins;
+ i = hash_pos(ptr->hash, table->num_bins);
for (tmp = table->bins[i]; tmp != ptr; tmp = tmp->next) {
if (!tmp) {
/* call func with error notice */
@@ -1123,7 +1200,7 @@ st_reverse_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg)
case ST_STOP:
return 0;
case ST_DELETE:
- last = &table->bins[ptr->hash % table->num_bins];
+ last = &table->bins[hash_pos(ptr->hash, table->num_bins)];
for (; (tmp = *last) != 0; last = &tmp->next) {
if (ptr == tmp) {
tmp = ptr->back;
@@ -1242,7 +1319,8 @@ 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_AMD86) || \
+ defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || \
+ defined(__powerpc64__) || \
defined(__mc68020__)
# define UNALIGNED_WORD_ACCESS 1
# endif
@@ -1497,7 +1575,7 @@ strhash(st_data_t arg)
#endif
int
-st_strcasecmp(const char *s1, const char *s2)
+st_locale_insensitive_strcasecmp(const char *s1, const char *s2)
{
unsigned int c1, c2;
@@ -1521,7 +1599,7 @@ st_strcasecmp(const char *s1, const char *s2)
}
int
-st_strncasecmp(const char *s1, const char *s2, size_t n)
+st_locale_insensitive_strncasecmp(const char *s1, const char *s2, size_t n)
{
unsigned int c1, c2;
@@ -1574,5 +1652,17 @@ st_numcmp(st_data_t x, st_data_t y)
st_index_t
st_numhash(st_data_t n)
{
- return (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 ID scope, +1 worked well initially, too
+ * - (n << 3) was finally added to avoid losing bits for fixnums
+ * - avoid expensive modulo instructions, it is currently only
+ * shifts and bitmask operations.
+ */
+ return (st_index_t)((n>>(RUBY_SPECIAL_SHIFT+3)|(n<<3)) ^ (n>>3));
}
diff --git a/strftime.c b/strftime.c
index b05653ffd5..83550e9a7f 100644
--- a/strftime.c
+++ b/strftime.c
@@ -363,7 +363,8 @@ rb_strftime_with_timespec(char *s, size_t maxsize, const char *format, rb_encodi
continue;
case 'j': /* day of the year, 001 - 366 */
- FMT('0', 3, "d", vtm->yday);
+ i = range(1, vtm->yday, 366);
+ FMT('0', 3, "d", (int)i);
continue;
case 'm': /* month, 01 - 12 */
diff --git a/string.c b/string.c
index 6ba920a718..05e4e802cd 100644
--- a/string.c
+++ b/string.c
@@ -14,9 +14,9 @@
#include "ruby/ruby.h"
#include "ruby/re.h"
#include "ruby/encoding.h"
-#include "vm_core.h"
#include "internal.h"
#include "probes.h"
+#include "gc.h"
#include <assert.h>
#define BEG(no) (regs->beg[(no)])
@@ -29,24 +29,20 @@
#include <unistd.h>
#endif
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
+#define STRING_ENUMERATORS_WANTARRAY 0 /* next major */
#undef rb_str_new_cstr
#undef rb_tainted_str_new_cstr
#undef rb_usascii_str_new_cstr
+#undef rb_enc_str_new_cstr
#undef rb_external_str_new_cstr
#undef rb_locale_str_new_cstr
-#undef rb_str_new2
-#undef rb_str_new3
-#undef rb_str_new4
-#undef rb_str_new5
-#undef rb_tainted_str_new2
-#undef rb_usascii_str_new2
#undef rb_str_dup_frozen
#undef rb_str_buf_new_cstr
-#undef rb_str_buf_new2
+#undef rb_str_buf_cat
#undef rb_str_buf_cat2
#undef rb_str_cat2
+#undef rb_str_cat_cstr
static VALUE rb_str_clear(VALUE str);
@@ -55,24 +51,12 @@ VALUE rb_cSymbol;
#define RUBY_MAX_CHAR_LEN 16
#define STR_TMPLOCK FL_USER7
-#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_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)
-#define STR_EMBED_P(str) (!FL_TEST((str), STR_NOEMBED))
#define STR_SET_EMBED_LEN(str, n) do { \
long tmp_n = (n);\
RBASIC(str)->flags &= ~RSTRING_EMBED_LEN_MASK;\
@@ -99,28 +83,209 @@ VALUE rb_cSymbol;
}\
} while (0)
+#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)
+
#define RESIZE_CAPA(str,capacity) do {\
+ const int termlen = TERM_LEN(str);\
if (STR_EMBED_P(str)) {\
if ((capacity) > RSTRING_EMBED_LEN_MAX) {\
- char *tmp = ALLOC_N(char, (capacity)+1);\
- memcpy(tmp, RSTRING_PTR(str), RSTRING_LEN(str));\
+ char *const tmp = ALLOC_N(char, (capacity)+termlen);\
+ const long tlen = RSTRING_LEN(str);\
+ memcpy(tmp, RSTRING_PTR(str), tlen);\
RSTRING(str)->as.heap.ptr = tmp;\
- RSTRING(str)->as.heap.len = RSTRING_LEN(str);\
+ RSTRING(str)->as.heap.len = tlen;\
STR_SET_NOEMBED(str);\
RSTRING(str)->as.heap.aux.capa = (capacity);\
}\
}\
else {\
- REALLOC_N(RSTRING(str)->as.heap.ptr, char, (capacity)+1);\
- if (!STR_NOCAPA_P(str))\
- RSTRING(str)->as.heap.aux.capa = (capacity);\
+ assert(!FL_TEST((str), STR_SHARED)); \
+ REALLOC_N(RSTRING(str)->as.heap.ptr, char, (capacity)+termlen);\
+ RSTRING(str)->as.heap.aux.capa = (capacity);\
}\
} while (0)
-#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)
+#define STR_SET_SHARED(str, shared_str) do { \
+ RB_OBJ_WRITE((str), &RSTRING(str)->as.heap.aux.shared, (shared_str)); \
+ FL_SET((str), STR_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) rb_enc_from_index(ENCODING_GET(str))
+#define STR_ENC_GET(str) get_encoding(str)
+
+#if 1
+#define SHARABLE_SUBSTRING_P(beg, len, end) ((beg) + (len) == (end))
+#else
+#define SHARABLE_SUBSTRING_P(beg, len, end) 1
+#endif
+
+rb_encoding *rb_enc_get_from_index(int index);
+
+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 int fstring_cmp(VALUE a, VALUE b);
+
+/* in case we restart MVM development, this needs to be per-VM */
+static st_table* frozen_strings;
+
+static inline st_table*
+rb_vm_fstring_table(void)
+{
+ return frozen_strings;
+}
+
+static const struct st_hash_type fstring_hash_type = {
+ fstring_cmp,
+ rb_str_hash,
+};
+
+static int
+fstr_update_callback(st_data_t *key, st_data_t *value, st_data_t arg, int existing)
+{
+ VALUE *fstr = (VALUE *)arg;
+ VALUE str = (VALUE)*key;
+
+ if (existing) {
+ /* because of lazy sweep, str may be unmarked already and swept
+ * at next time */
+
+ if (rb_objspace_garbage_object_p(str)) {
+ *fstr = Qundef;
+ return ST_DELETE;
+ }
+
+ *fstr = str;
+ return ST_STOP;
+ }
+ else {
+ if (STR_SHARED_P(str)) { /* str should not be shared */
+ str = rb_enc_str_new(RSTRING_PTR(str), RSTRING_LEN(str), STR_ENC_GET(str));
+ OBJ_FREEZE(str);
+ }
+ else {
+ str = rb_str_new_frozen(str);
+ }
+ RBASIC(str)->flags |= RSTRING_FSTR;
+
+ *key = *value = *fstr = str;
+ return ST_CONTINUE;
+ }
+}
+
+VALUE
+rb_fstring(VALUE str)
+{
+ VALUE ret;
+
+ Check_Type(str, T_STRING);
+
+ if (FL_TEST(str, RSTRING_FSTR))
+ return str;
+
+ do {
+ ret = str;
+ st_update(rb_vm_fstring_table(), (st_data_t)str,
+ fstr_update_callback, (st_data_t)&ret);
+ } while (ret == Qundef);
+
+ 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|ELTS_SHARED;
+ /* 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 rb_fstring(setup_fake_str(&fake_str, ptr, len, ENCINDEX_US_ASCII));
+}
+
+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;
+}
+
+static int
+fstring_cmp(VALUE a, VALUE b)
+{
+ int cmp = rb_str_hash_cmp(a, b);
+ if (cmp != 0) {
+ return cmp;
+ }
+ return ENCODING_GET(b) - ENCODING_GET(a);
+}
static inline int
single_byte_optimizable(VALUE str)
@@ -145,22 +310,22 @@ VALUE rb_fs;
static inline const char *
search_nonascii(const char *p, const char *e)
{
-#if SIZEOF_VALUE == 8
+#if SIZEOF_VOIDP == 8
# define NONASCII_MASK 0x8080808080808080ULL
-#elif SIZEOF_VALUE == 4
+#elif SIZEOF_VOIDP == 4
# define NONASCII_MASK 0x80808080UL
#endif
#ifdef NONASCII_MASK
- if ((int)sizeof(VALUE) * 2 < e - p) {
- const VALUE *s, *t;
- const VALUE lowbits = sizeof(VALUE) - 1;
- s = (const VALUE*)(~lowbits & ((VALUE)p + lowbits));
+ 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));
while (p < (const char *)s) {
if (!ISASCII(*p))
return p;
p++;
}
- t = (const VALUE*)(~lowbits & (VALUE)e);
+ t = (const uintptr_t*)(~lowbits & (uintptr_t)e);
while (s < t) {
if (*s & NONASCII_MASK) {
t = s;
@@ -184,7 +349,7 @@ coderange_scan(const char *p, long len, rb_encoding *enc)
{
const char *e = p + len;
- if (rb_enc_to_index(enc) == 0) {
+ if (rb_enc_to_index(enc) == rb_ascii8bit_encindex()) {
/* enc is ASCII-8BIT. ASCII-8BIT string never be broken. */
p = search_nonascii(p, e);
return p ? ENC_CODERANGE_VALID : ENC_CODERANGE_7BIT;
@@ -192,38 +357,22 @@ 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;
- }
- while (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;
- }
+ 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 (p == e) break;
+ p = search_nonascii(p, e);
+ if (!p) break;
}
- 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;
+ else {
+ 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);
}
- p += MBCLEN_CHARFOUND_LEN(ret);
- }
- if (e < p) {
- return ENC_CODERANGE_BROKEN;
}
return ENC_CODERANGE_VALID;
}
@@ -236,10 +385,11 @@ 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) == 0) {
+ if (rb_enc_to_index(enc) == rb_ascii8bit_encindex()) {
/* 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 && *cr != ENC_CODERANGE_VALID) ? ENC_CODERANGE_7BIT : ENC_CODERANGE_VALID;
+ *cr = p ? ENC_CODERANGE_VALID : ENC_CODERANGE_7BIT;
return e - s;
}
else if (rb_enc_asciicompat(enc)) {
@@ -248,23 +398,17 @@ 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;
}
- while (p < e) {
+ for (;;) {
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) {
- p = search_nonascii(p, e);
- if (!p) {
- *cr = ENC_CODERANGE_VALID;
- return e - s;
- }
- }
+ if (p == e) break;
+ p = search_nonascii(p, e);
+ if (!p) break;
}
- *cr = e < p ? ENC_CODERANGE_BROKEN: ENC_CODERANGE_VALID;
- return p - s;
}
else {
while (p < e) {
@@ -275,9 +419,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
@@ -362,7 +506,7 @@ rb_str_capacity(VALUE str)
if (STR_EMBED_P(str)) {
return RSTRING_EMBED_LEN_MAX;
}
- else if (STR_NOCAPA_P(str)) {
+ else if (FL_TEST(str, STR_SHARED)) {
return RSTRING(str)->as.heap.len;
}
else {
@@ -370,15 +514,18 @@ rb_str_capacity(VALUE 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)
{
- NEWOBJ_OF(str, struct RString, klass, T_STRING);
-
- str->as.heap.ptr = 0;
- str->as.heap.len = 0;
- str->as.heap.aux.capa = 0;
-
+ NEWOBJ_OF(str, struct RString, klass, T_STRING | (RGENGC_WB_PROTECTED_STRING ? FL_WB_PROTECTED : 0));
return (VALUE)str;
}
@@ -392,7 +539,7 @@ empty_str_alloc(VALUE klass)
}
static VALUE
-str_new(VALUE klass, const char *ptr, long len)
+str_new0(VALUE klass, const char *ptr, long len, int termlen)
{
VALUE str;
@@ -407,7 +554,7 @@ str_new(VALUE klass, const char *ptr, long len)
str = str_alloc(klass);
if (len > RSTRING_EMBED_LEN_MAX) {
RSTRING(str)->as.heap.aux.capa = len;
- RSTRING(str)->as.heap.ptr = ALLOC_N(char,len+1);
+ RSTRING(str)->as.heap.ptr = ALLOC_N(char, len + termlen);
STR_SET_NOEMBED(str);
}
else if (len == 0) {
@@ -417,10 +564,16 @@ str_new(VALUE klass, const char *ptr, long len)
memcpy(RSTRING_PTR(str), ptr, len);
}
STR_SET_LEN(str, len);
- RSTRING_PTR(str)[len] = '\0';
+ TERM_FILL(RSTRING_PTR(str) + len, termlen);
return str;
}
+static VALUE
+str_new(VALUE klass, const char *ptr, long len)
+{
+ return str_new0(klass, ptr, len, 1);
+}
+
VALUE
rb_str_new(const char *ptr, long len)
{
@@ -438,7 +591,11 @@ rb_usascii_str_new(const char *ptr, long len)
VALUE
rb_enc_str_new(const char *ptr, long len, rb_encoding *enc)
{
- VALUE str = rb_str_new(ptr, len);
+ VALUE str;
+
+ if (!enc) return rb_str_new(ptr, len);
+
+ str = str_new0(rb_cString, ptr, len, rb_enc_mbminlen(enc));
rb_enc_associate(str, enc);
return str;
}
@@ -446,25 +603,27 @@ rb_enc_str_new(const char *ptr, long len, rb_encoding *enc)
VALUE
rb_str_new_cstr(const char *ptr)
{
- if (!ptr) {
- rb_raise(rb_eArgError, "NULL pointer given");
- }
+ must_not_null(ptr);
return rb_str_new(ptr, strlen(ptr));
}
-RUBY_ALIAS_FUNCTION(rb_str_new2(const char *ptr), rb_str_new_cstr, (ptr))
-#define rb_str_new2 rb_str_new_cstr
-
VALUE
rb_usascii_str_new_cstr(const char *ptr)
{
- VALUE str = rb_str_new2(ptr);
+ VALUE str = rb_str_new_cstr(ptr);
ENCODING_CODERANGE_SET(str, rb_usascii_encindex(), ENC_CODERANGE_7BIT);
return str;
}
-RUBY_ALIAS_FUNCTION(rb_usascii_str_new2(const char *ptr), rb_usascii_str_new_cstr, (ptr))
-#define rb_usascii_str_new2 rb_usascii_str_new_cstr
+VALUE
+rb_enc_str_new_cstr(const char *ptr, rb_encoding *enc)
+{
+ must_not_null(ptr);
+ if (rb_enc_mbminlen(enc) != 1) {
+ rb_raise(rb_eArgError, "wchar encoding given");
+ }
+ return rb_enc_str_new(ptr, strlen(ptr), enc);
+}
VALUE
rb_tainted_str_new(const char *ptr, long len)
@@ -478,15 +637,12 @@ rb_tainted_str_new(const char *ptr, long len)
VALUE
rb_tainted_str_new_cstr(const char *ptr)
{
- VALUE str = rb_str_new2(ptr);
+ VALUE str = rb_str_new_cstr(ptr);
OBJ_TAINT(str);
return str;
}
-RUBY_ALIAS_FUNCTION(rb_tainted_str_new2(const char *ptr), rb_tainted_str_new_cstr, (ptr))
-#define rb_tainted_str_new2 rb_tainted_str_new_cstr
-
VALUE
rb_str_conv_enc_opts(VALUE str, rb_encoding *from, rb_encoding *to, int ecflags, VALUE ecopts)
{
@@ -503,7 +659,7 @@ rb_str_conv_enc_opts(VALUE str, rb_encoding *from, rb_encoding *to, int ecflags,
if (!to) return str;
if (!from) from = rb_enc_get(str);
if (from == to) return str;
- if ((rb_enc_asciicompat(to) && ENC_CODERANGE(str) == ENC_CODERANGE_7BIT) ||
+ if ((rb_enc_asciicompat(to) && is_ascii_string(str)) ||
to == rb_ascii8bit_encoding()) {
if (STR_ENC_GET(str) != to) {
str = rb_str_dup(str);
@@ -514,10 +670,11 @@ rb_str_conv_enc_opts(VALUE str, rb_encoding *from, rb_encoding *to, int ecflags,
len = RSTRING_LEN(str);
newstr = rb_str_new(0, len);
+ OBJ_INFECT(newstr, str);
olen = len;
econv_wrapper = rb_obj_alloc(rb_cEncodingConverter);
- RBASIC(econv_wrapper)->klass = 0;
+ RBASIC_CLEAR_CLASS(econv_wrapper);
ec = rb_econv_open_opts(from->name, to->name, ecflags, ecopts);
if (!ec) return str;
DATA_PTR(econv_wrapper) = ec;
@@ -571,6 +728,12 @@ rb_external_str_new_with_enc(const char *ptr, long len, rb_encoding *eenc)
VALUE str;
str = rb_tainted_str_new(ptr, len);
+ return rb_external_str_with_enc(str, eenc);
+}
+
+VALUE
+rb_external_str_with_enc(VALUE str, rb_encoding *eenc)
+{
if (eenc == rb_usascii_encoding() &&
rb_enc_str_coderange(str) != ENC_CODERANGE_7BIT) {
rb_enc_associate(str, rb_ascii8bit_encoding());
@@ -647,8 +810,7 @@ str_replace_shared_without_enc(VALUE str2, VALUE str)
FL_SET(str2, STR_NOEMBED);
RSTRING(str2)->as.heap.len = RSTRING_LEN(str);
RSTRING(str2)->as.heap.ptr = RSTRING_PTR(str);
- RSTRING(str2)->as.heap.aux.shared = str;
- FL_SET(str2, ELTS_SHARED);
+ STR_SET_SHARED(str2, str);
}
return str2;
}
@@ -667,44 +829,11 @@ 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_new3(rb_obj_class(str), str);
-
- OBJ_INFECT(str2, str);
- return str2;
-}
-
-RUBY_ALIAS_FUNCTION(rb_str_new3(VALUE str), rb_str_new_shared, (str))
-#define rb_str_new3 rb_str_new_shared
-
-static VALUE
-str_new4(VALUE klass, VALUE str)
-{
- VALUE str2;
+ VALUE str2 = str_new_shared(rb_obj_class(str), 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));
- FL_SET(str2, ELTS_SHARED);
- RSTRING(str2)->as.heap.aux.shared = shared;
- }
- else {
- FL_SET(str, ELTS_SHARED);
- RSTRING(str)->as.heap.aux.shared = str2;
- }
- rb_enc_cr_str_exact_copy(str2, str);
OBJ_INFECT(str2, str);
return str2;
}
@@ -715,57 +844,57 @@ rb_str_new_frozen(VALUE orig)
VALUE klass, str;
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|FL_UNTRUSTED)) ||
- 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)) {
+
+ 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);
- RSTRING(str)->as.heap.aux.shared = assoc;
}
else {
- str = str_new4(klass, orig);
+ if (FL_TEST(orig, STR_SHARED)) {
+ VALUE shared = RSTRING(orig)->as.heap.aux.shared;
+ long ofs = RSTRING_PTR(orig) - RSTRING_PTR(shared);
+ long rest = RSTRING_LEN(shared) - ofs - RSTRING_LEN(orig);
+ 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 {
+ 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;
+ STR_SET_SHARED(orig, str);
+ }
}
+
+ rb_enc_cr_str_exact_copy(str, orig);
+ OBJ_INFECT(str, orig);
OBJ_FREEZE(str);
return str;
}
-RUBY_ALIAS_FUNCTION(rb_str_new4(VALUE orig), rb_str_new_frozen, (orig))
-#define rb_str_new4 rb_str_new_frozen
-
VALUE
rb_str_new_with_class(VALUE obj, const char *ptr, long len)
{
return str_new(rb_obj_class(obj), ptr, len);
}
-RUBY_ALIAS_FUNCTION(rb_str_new5(VALUE obj, const char *ptr, long len),
- rb_str_new_with_class, (obj, ptr, len))
-#define rb_str_new5 rb_str_new_with_class
-
static VALUE
str_new_empty(VALUE str)
{
- VALUE v = rb_str_new5(str, 0, 0);
+ VALUE v = rb_str_new_with_class(str, 0, 0);
rb_enc_copy(v, str);
OBJ_INFECT(v, str);
return v;
@@ -801,9 +930,6 @@ rb_str_buf_new_cstr(const char *ptr)
return str;
}
-RUBY_ALIAS_FUNCTION(rb_str_buf_new2(const char *ptr), rb_str_buf_new_cstr, (ptr))
-#define rb_str_buf_new2 rb_str_buf_new_cstr
-
VALUE
rb_str_tmp_new(long len)
{
@@ -829,16 +955,21 @@ rb_free_tmp_buffer(volatile VALUE *store)
void
rb_str_free(VALUE str)
{
- if (!STR_EMBED_P(str) && !STR_SHARED_P(str)) {
- xfree(RSTRING(str)->as.heap.ptr);
+ if (FL_TEST(str, RSTRING_FSTR)) {
+ st_data_t fstr = (st_data_t)str;
+ st_delete(rb_vm_fstring_table(), &fstr, NULL);
+ }
+
+ if (!STR_EMBED_P(str) && !FL_TEST(str, STR_SHARED)) {
+ ruby_sized_xfree(STR_HEAP_PTR(str), STR_HEAP_SIZE(str));
}
}
RUBY_FUNC_EXPORTED size_t
rb_str_memsize(VALUE str)
{
- if (!STR_EMBED_P(str) && !STR_SHARED_P(str)) {
- return RSTRING(str)->as.heap.aux.capa;
+ if (FL_TEST(str, STR_NOEMBED|STR_SHARED) == STR_NOEMBED) {
+ return STR_HEAP_SIZE(str);
}
else {
return 0;
@@ -863,30 +994,35 @@ rb_str_shared_replace(VALUE str, VALUE str2)
cr = ENC_CODERANGE(str2);
str_discard(str);
OBJ_INFECT(str, str2);
+
if (RSTRING_LEN(str2) <= RSTRING_EMBED_LEN_MAX) {
STR_SET_EMBED(str);
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)) {
- FL_SET(str, RBASIC(str2)->flags & STR_NOCAPA);
- RSTRING(str)->as.heap.aux.shared = RSTRING(str2)->as.heap.aux.shared;
}
else {
- RSTRING(str)->as.heap.aux.capa = RSTRING(str2)->as.heap.aux.capa;
+ 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);
}
- 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;
@@ -912,18 +1048,13 @@ 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);
- RSTRING(str)->as.heap.aux.shared = shared;
+ STR_SET_SHARED(str, shared);
}
else {
str_replace_shared(str, str2);
@@ -955,7 +1086,7 @@ rb_str_resurrect(VALUE str)
RUBY_DTRACE_STRING_CREATE(RSTRING_LEN(str),
rb_sourcefile(), rb_sourceline());
}
- return str_replace(str_alloc(rb_cString), str);
+ return str_duplicate(rb_cString, str);
}
/*
@@ -975,6 +1106,41 @@ rb_str_init(int argc, VALUE *argv, VALUE 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, 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 uintptr_t
+count_utf8_lead_bytes_with_word(const uintptr_t *s)
+{
+ uintptr_t 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_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)
{
@@ -984,6 +1150,31 @@ 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 (cr == ENC_CODERANGE_7BIT || cr == ENC_CODERANGE_VALID) {
@@ -1027,6 +1218,9 @@ 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)
{
@@ -1083,46 +1277,11 @@ rb_enc_strlen_cr(const char *p, const char *e, rb_encoding *enc, int *cr)
return c;
}
-#ifdef NONASCII_MASK
-#define is_utf8_lead_byte(c) (((c)&0xC0) != 0x80)
-
-/*
- * UTF-8 leading bytes have either 0xxxxxxx or 11xxxxxx
- * bit represention. (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
-
+/* enc must be str's enc or rb_enc_check(str, str2) */
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);
@@ -1130,44 +1289,21 @@ 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()) {
- 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;
+ if (cr == ENC_CODERANGE_UNKNOWN) {
+ long n = rb_enc_strlen_cr(p, e, enc, &cr);
+ if (cr) ENC_CODERANGE_SET(str, cr);
+ return n;
}
-#endif
- n = rb_enc_strlen_cr(p, e, enc, &cr);
- if (cr) {
- ENC_CODERANGE_SET(str, cr);
+ else {
+ return enc_strlen(p, e, enc, cr);
}
- return n;
}
long
rb_str_strlen(VALUE str)
{
- return str_strlen(str, STR_ENC_GET(str));
+ return str_strlen(str, NULL);
}
/*
@@ -1181,10 +1317,7 @@ rb_str_strlen(VALUE str)
VALUE
rb_str_length(VALUE str)
{
- long len;
-
- len = str_strlen(str, STR_ENC_GET(str));
- return LONG2NUM(len);
+ return LONG2NUM(str_strlen(str, NULL));
}
/*
@@ -1279,7 +1412,7 @@ rb_str_times(VALUE str, VALUE times)
rb_raise(rb_eArgError, "argument too big");
}
- str2 = rb_str_new5(str, 0, len *= RSTRING_LEN(str));
+ str2 = rb_str_new_with_class(str, 0, len *= RSTRING_LEN(str));
ptr2 = RSTRING_PTR(str2);
if (len) {
n = RSTRING_LEN(str);
@@ -1315,10 +1448,12 @@ rb_str_times(VALUE str, VALUE times)
static VALUE
rb_str_format_m(VALUE str, VALUE arg)
{
- volatile VALUE tmp = rb_check_array_type(arg);
+ VALUE tmp = rb_check_array_type(arg);
if (!NIL_P(tmp)) {
- return rb_str_format(RARRAY_LENINT(tmp), RARRAY_PTR(tmp), str);
+ VALUE rv = rb_str_format(RARRAY_LENINT(tmp), RARRAY_CONST_PTR(tmp), str);
+ RB_GC_GUARD(tmp);
+ return rv;
}
return rb_str_format(1, &arg, str);
}
@@ -1330,17 +1465,18 @@ str_modifiable(VALUE str)
rb_raise(rb_eRuntimeError, "can't modify string; temporarily locked");
}
rb_check_frozen(str);
- if (!OBJ_UNTRUSTED(str) && rb_safe_level() >= 4)
- rb_raise(rb_eSecurityError, "Insecure: can't modify string");
}
static inline int
str_independent(VALUE str)
{
str_modifiable(str);
- if (!STR_SHARED_P(str)) return 1;
- if (STR_EMBED_P(str)) return 1;
- return 0;
+ if (STR_EMBED_P(str) || !FL_TEST(str, STR_SHARED)) {
+ return 1;
+ }
+ else {
+ return 0;
+ }
}
static void
@@ -1348,16 +1484,17 @@ str_make_independent_expand(VALUE str, long expand)
{
char *ptr;
long len = RSTRING_LEN(str);
+ const int termlen = TERM_LEN(str);
long capa = len + expand;
if (len > capa) len = capa;
- ptr = ALLOC_N(char, capa + 1);
+ ptr = ALLOC_N(char, capa + termlen);
if (RSTRING_PTR(str)) {
memcpy(ptr, RSTRING_PTR(str), len);
}
STR_SET_NOEMBED(str);
- STR_UNSET_NOCAPA(str);
- ptr[len] = 0;
+ FL_UNSET(str, STR_SHARED);
+ TERM_FILL(ptr + len, termlen);
RSTRING(str)->as.heap.ptr = ptr;
RSTRING(str)->as.heap.len = len;
RSTRING(str)->as.heap.aux.capa = capa;
@@ -1385,11 +1522,12 @@ rb_str_modify_expand(VALUE str, long expand)
else if (expand > 0) {
long len = RSTRING_LEN(str);
long capa = len + expand;
+ int termlen = TERM_LEN(str);
if (!STR_EMBED_P(str)) {
- REALLOC_N(RSTRING(str)->as.heap.ptr, char, capa+1);
+ REALLOC_N(RSTRING(str)->as.heap.ptr, char, capa + termlen);
RSTRING(str)->as.heap.aux.capa = capa;
}
- else if (capa > RSTRING_EMBED_LEN_MAX) {
+ else if (capa + termlen > RSTRING_EMBED_LEN_MAX + 1) {
str_make_independent_expand(str, expand);
}
}
@@ -1412,54 +1550,13 @@ str_discard(VALUE str)
{
str_modifiable(str);
if (!STR_SHARED_P(str) && !STR_EMBED_P(str)) {
- xfree(RSTRING_PTR(str));
+ ruby_sized_xfree(STR_HEAP_PTR(str), STR_HEAP_SIZE(str));
RSTRING(str)->as.heap.ptr = 0;
RSTRING(str)->as.heap.len = 0;
}
}
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(add)->klass = 0;
- 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);
@@ -1486,13 +1583,58 @@ rb_string_value_ptr(volatile VALUE *ptr)
return RSTRING_PTR(str);
}
+static int
+zero_filled(const char *s, int n)
+{
+ for (; n > 0; --n) {
+ if (*s++) return 0;
+ }
+ return 1;
+}
+
+static const char *
+str_null_char(const char *s, long len, const int minlen, rb_encoding *enc)
+{
+ const char *e = s + len;
+
+ for (; s + minlen <= e; s += rb_enc_mbclen(s, e, enc)) {
+ if (zero_filled(s, minlen)) return s;
+ }
+ return 0;
+}
+
+static char *
+str_fill_term(VALUE str, char *s, long len, int oldtermlen, int termlen)
+{
+ long capa = rb_str_capacity(str) + 1;
+
+ if (capa < len + termlen) {
+ rb_str_modify_expand(str, 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;
+}
+
char *
rb_string_value_cstr(volatile VALUE *ptr)
{
VALUE str = rb_string_value(ptr);
char *s = RSTRING_PTR(str);
long len = RSTRING_LEN(str);
+ rb_encoding *enc = rb_enc_get(str);
+ const int minlen = rb_enc_mbminlen(enc);
+ if (minlen > 1) {
+ if (str_null_char(s, len, minlen, enc)) {
+ rb_raise(rb_eArgError, "string contains null char");
+ }
+ return str_fill_term(str, s, len, minlen, minlen);
+ }
if (!s || memchr(s, 0, len)) {
rb_raise(rb_eArgError, "string contains null byte");
}
@@ -1504,6 +1646,15 @@ rb_string_value_cstr(volatile VALUE *ptr)
return s;
}
+void
+rb_str_fill_terminator(VALUE str, const int newminlen)
+{
+ char *s = RSTRING_PTR(str);
+ long len = RSTRING_LEN(str);
+ rb_encoding *enc = rb_enc_get(str);
+ str_fill_term(str, s, len, rb_enc_mbminlen(enc), newminlen);
+}
+
VALUE
rb_check_string_type(VALUE str)
{
@@ -1618,11 +1769,11 @@ static char *
str_utf8_nth(const char *p, const char *e, long *nthp)
{
long nth = *nthp;
- 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);
+ 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);
while (p < (const char *)s) {
if (is_utf8_lead_byte(*p)) nth--;
p++;
@@ -1630,7 +1781,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(VALUE) <= nth);
+ } while (s < t && (int)SIZEOF_VOIDP <= nth);
p = (char *)s;
}
while (p < e) {
@@ -1669,13 +1820,15 @@ rb_str_subseq(VALUE str, long beg, long len)
{
VALUE str2;
- 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);
+ if (RSTRING_EMBED_LEN_MAX < 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;
}
else {
- str2 = rb_str_new5(str, RSTRING_PTR(str)+beg, len);
+ str2 = rb_str_new_with_class(str, RSTRING_PTR(str)+beg, len);
RB_GC_GUARD(str);
}
@@ -1685,7 +1838,7 @@ rb_str_subseq(VALUE str, long beg, long len)
return str2;
}
-static char *
+char *
rb_str_subpos(VALUE str, long beg, long *lenp)
{
long len = *lenp;
@@ -1734,7 +1887,7 @@ rb_str_subpos(VALUE str, long beg, long *lenp)
return 0;
}
if (len == 0) {
- if (beg > str_strlen(str, enc)) return 0;
+ if (beg > str_strlen(str, enc)) return 0; /* str's enc */
p = s + beg;
}
#ifdef NONASCII_MASK
@@ -1777,18 +1930,19 @@ 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 && 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;
+ if (len > RSTRING_EMBED_LEN_MAX && 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;
RSTRING(str2)->as.heap.len = len;
}
else {
- str2 = rb_str_new5(str, p, len);
- rb_enc_cr_str_copy_for_substr(str2, str);
+ str2 = rb_str_new_with_class(str, p, len);
OBJ_INFECT(str2, str);
RB_GC_GUARD(str);
}
+ rb_enc_cr_str_copy_for_substr(str2, str);
return str2;
}
@@ -1796,10 +1950,8 @@ rb_str_substr(VALUE str, long beg, long len)
VALUE
rb_str_freeze(VALUE str)
{
- if (STR_ASSOC_P(str)) {
- VALUE ary = RSTRING(str)->as.heap.aux.shared;
- OBJ_FREEZE(ary);
- }
+ if (OBJ_FROZEN(str)) return str;
+ rb_str_resize(str, RSTRING_LEN(str));
return rb_obj_freeze(str);
}
@@ -1837,16 +1989,17 @@ void
rb_str_set_len(VALUE str, long len)
{
long capa;
+ const int termlen = TERM_LEN(str);
str_modifiable(str);
if (STR_SHARED_P(str)) {
rb_raise(rb_eRuntimeError, "can't set length of shared string");
}
- if (len > (capa = (long)rb_str_capacity(str))) {
+ if (len + termlen - 1 > (capa = (long)rb_str_capacity(str))) {
rb_bug("probable buffer overflow: %ld for %ld", len, capa);
}
STR_SET_LEN(str, len);
- RSTRING_PTR(str)[len] = '\0';
+ TERM_FILL(&RSTRING_PTR(str)[len], termlen);
}
VALUE
@@ -1862,37 +2015,41 @@ rb_str_resize(VALUE str, long len)
independent = str_independent(str);
ENC_CODERANGE_CLEAR(str);
slen = RSTRING_LEN(str);
- if (len != slen) {
+
+ {
+ long capa;
+ const int termlen = TERM_LEN(str);
if (STR_EMBED_P(str)) {
- if (len <= RSTRING_EMBED_LEN_MAX) {
+ if (len == slen) return str;
+ if (len + termlen <= RSTRING_EMBED_LEN_MAX + 1) {
STR_SET_EMBED_LEN(str, len);
- RSTRING(str)->as.ary[len] = '\0';
+ TERM_FILL(RSTRING(str)->as.ary + len, termlen);
return str;
}
str_make_independent_expand(str, len - slen);
- STR_SET_NOEMBED(str);
}
- else if (len <= RSTRING_EMBED_LEN_MAX) {
- char *ptr = RSTRING(str)->as.heap.ptr;
+ else if (len + termlen <= RSTRING_EMBED_LEN_MAX + 1) {
+ char *ptr = STR_HEAP_PTR(str);
STR_SET_EMBED(str);
if (slen > len) slen = len;
if (slen > 0) MEMCPY(RSTRING(str)->as.ary, ptr, char, slen);
- RSTRING(str)->as.ary[len] = '\0';
+ TERM_FILL(RSTRING(str)->as.ary + len, termlen);
STR_SET_EMBED_LEN(str, len);
- if (independent) xfree(ptr);
+ if (independent) ruby_xfree(ptr);
return str;
}
else if (!independent) {
+ if (len == slen) return str;
str_make_independent_expand(str, len - slen);
}
- else if (slen < len || slen - len > 1024) {
- REALLOC_N(RSTRING(str)->as.heap.ptr, char, len+1);
- }
- if (!STR_NOCAPA_P(str)) {
+ else if ((capa = RSTRING(str)->as.heap.aux.capa) < len ||
+ (capa - len) > (len < 1024 ? len : 1024)) {
+ REALLOC_N(RSTRING(str)->as.heap.ptr, char, len + termlen);
RSTRING(str)->as.heap.aux.capa = len;
}
+ else if (len == slen) return str;
RSTRING(str)->as.heap.len = len;
- RSTRING(str)->as.heap.ptr[len] = '\0'; /* sentinel */
+ TERM_FILL(RSTRING(str)->as.heap.ptr + len, termlen); /* sentinel */
}
return str;
}
@@ -1907,11 +2064,7 @@ str_buf_cat(VALUE str, const char *ptr, long len)
}
rb_str_modify(str);
if (len == 0) return 0;
- 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)) {
+ if (STR_EMBED_P(str)) {
capa = RSTRING_EMBED_LEN_MAX;
}
else {
@@ -1923,11 +2076,11 @@ str_buf_cat(VALUE str, const char *ptr, long len)
total = RSTRING_LEN(str)+len;
if (capa <= total) {
while (total > capa) {
- if (capa + 1 >= LONG_MAX / 2) {
- capa = (total + 4095) / 4096;
+ if (capa > LONG_MAX / 2) {
+ capa = (total + 4095) / 4096 * 4096;
break;
}
- capa = (capa + 1) * 2;
+ capa = 2 * capa;
}
RESIZE_CAPA(str, capa);
}
@@ -1944,7 +2097,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_buf_cat(VALUE str, const char *ptr, long len)
+rb_str_cat(VALUE str, const char *ptr, long len)
{
if (len == 0) return str;
if (len < 0) {
@@ -1954,35 +2107,15 @@ rb_str_buf_cat(VALUE str, const char *ptr, long len)
}
VALUE
-rb_str_buf_cat2(VALUE str, const char *ptr)
+rb_str_cat_cstr(VALUE str, const char *ptr)
{
+ must_not_null(ptr);
return rb_str_buf_cat(str, ptr, strlen(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;
- p[len] = '\0'; /* 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));
-}
+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))
static VALUE
rb_enc_cr_str_buf_cat(VALUE str, const char *ptr, long len,
@@ -1991,19 +2124,18 @@ 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 = ENC_CODERANGE(str);
+ 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;
- else if (ptr_cr == ENC_CODERANGE_UNKNOWN) {
+ if (str_cr != ENC_CODERANGE_UNKNOWN && ptr_cr == ENC_CODERANGE_UNKNOWN) {
ptr_cr = coderange_scan(ptr, len, rb_enc_from_index(ptr_encindex));
}
}
else {
- rb_encoding *str_enc = rb_enc_from_index(str_encindex);
- rb_encoding *ptr_enc = rb_enc_from_index(ptr_encindex);
+ str_enc = rb_enc_from_index(str_encindex);
+ ptr_enc = rb_enc_from_index(ptr_encindex);
if (!rb_enc_asciicompat(str_enc) || !rb_enc_asciicompat(ptr_enc)) {
if (len == 0)
return str;
@@ -2029,10 +2161,11 @@ 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(rb_enc_from_index(str_encindex)),
- rb_enc_name(rb_enc_from_index(ptr_encindex)));
+ rb_enc_name(str_enc), rb_enc_name(ptr_enc));
}
if (str_cr == ENC_CODERANGE_UNKNOWN) {
@@ -2120,25 +2253,7 @@ rb_str_buf_append(VALUE str, VALUE str2)
VALUE
rb_str_append(VALUE str, VALUE str2)
{
- rb_encoding *enc;
- int cr, cr2;
- long len2;
-
StringValue(str2);
- if ((len2 = RSTRING_LEN(str2)) > 0 && STR_ASSOC_P(str)) {
- long len = RSTRING_LEN(str) + len2;
- enc = rb_enc_check(str, str2);
- cr = ENC_CODERANGE(str);
- if ((cr2 = ENC_CODERANGE(str2)) > cr) cr = cr2;
- rb_str_modify_expand(str, len2);
- memcpy(RSTRING(str)->as.heap.ptr + RSTRING(str)->as.heap.len,
- RSTRING_PTR(str2), len2+1);
- RSTRING(str)->as.heap.len = len;
- rb_enc_associate(str, enc);
- ENC_CODERANGE_SET(str, cr);
- OBJ_INFECT(str, str2);
- return str;
- }
return rb_str_buf_append(str, str2);
}
@@ -2267,7 +2382,9 @@ rb_str_hash_cmp(VALUE str1, VALUE str2)
* call-seq:
* str.hash -> fixnum
*
- * Return a hash based on the string's length and content.
+ * Return a hash based on the string's length, content and encoding.
+ *
+ * See also Object#hash.
*/
static VALUE
@@ -2348,11 +2465,17 @@ str_eql(const VALUE str1, const VALUE str2)
/*
* call-seq:
- * str == obj -> true or false
+ * str == obj -> true or false
+ * str === obj -> true or false
+ *
+ * === Equality
*
- * Equality---If <i>obj</i> is not a <code>String</code>, returns
- * <code>false</code>. Otherwise, returns <code>true</code> if <i>str</i>
- * <code><=></code> <i>obj</i> returns zero.
+ * Returns whether +str+ == +obj+, similar to Object#==.
+ *
+ * If +obj+ is not an instance of String but responds to +to_str+, then the
+ * two strings are compared using case equality Object#===.
+ *
+ * Otherwise, returns similarly to String#eql?, comparing length and content.
*/
VALUE
@@ -2498,29 +2621,31 @@ 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_str_index(VALUE str, VALUE sub, long offset)
+rb_strseq_index(VALUE str, VALUE sub, long offset, int in_byte)
{
- long pos;
- char *s, *sptr, *e;
- long len, slen;
+ const char *s, *sptr, *e;
+ long pos, len, slen;
+ int single_byte = single_byte_optimizable(str);
rb_encoding *enc;
enc = rb_enc_check(str, sub);
- if (is_broken_string(sub)) {
- return -1;
- }
- len = str_strlen(str, enc);
- slen = str_strlen(sub, enc);
+ 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 */
if (offset < 0) {
offset += len;
if (offset < 0) return -1;
}
if (len - offset < slen) return -1;
+
s = RSTRING_PTR(str);
- e = s + RSTRING_LEN(str);
+ e = RSTRING_END(str);
if (offset) {
- offset = str_offset(s, RSTRING_END(str), offset, enc, single_byte_optimizable(str));
+ if (!in_byte) offset = str_offset(s, e, offset, enc, single_byte);
s += offset;
}
if (slen == 0) return offset;
@@ -2529,12 +2654,13 @@ rb_str_index(VALUE str, VALUE sub, long offset)
slen = RSTRING_LEN(sub);
len = RSTRING_LEN(str) - offset;
for (;;) {
- char *t;
+ const 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);
if (t == s + pos) break;
- if ((len -= t - s) <= 0) return -1;
+ len -= t - s;
+ if (len <= 0) return -1;
offset += t - s;
s = t;
}
@@ -2573,7 +2699,7 @@ rb_str_index_m(int argc, VALUE *argv, VALUE str)
pos = 0;
}
if (pos < 0) {
- pos += str_strlen(str, STR_ENC_GET(str));
+ pos += str_strlen(str, NULL);
if (pos < 0) {
if (RB_TYPE_P(sub, T_REGEXP)) {
rb_backref_set(Qnil);
@@ -2585,7 +2711,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, STR_ENC_GET(str)))
+ if (pos > str_strlen(str, NULL))
return Qnil;
pos = str_offset(RSTRING_PTR(str), RSTRING_END(str), pos,
rb_enc_check(str, sub), single_byte_optimizable(str));
@@ -2616,33 +2742,50 @@ rb_str_index_m(int argc, VALUE *argv, VALUE str)
return LONG2NUM(pos);
}
+#ifdef HAVE_MEMRCHR
static long
-rb_str_rindex(VALUE str, VALUE sub, long pos)
+str_rindex(VALUE str, VALUE sub, const char *s, long pos, rb_encoding *enc)
{
- long len, slen;
- char *s, *sbeg, *e, *t;
- rb_encoding *enc;
- int singlebyte = single_byte_optimizable(str);
+ char *hit, *adjusted;
+ int c;
+ long slen, searchlen;
+ char *sbeg, *e, *t;
+
+ slen = RSTRING_LEN(sub);
+ if (slen == 0) return pos;
+ sbeg = RSTRING_PTR(str);
+ e = RSTRING_END(str);
+ t = RSTRING_PTR(sub);
+ c = *t & 0xff;
+ searchlen = s - sbeg + 1;
+
+ do {
+ hit = memrchr(sbeg, c, searchlen);
+ if (!hit) break;
+ adjusted = rb_enc_left_char_head(sbeg, hit, e, enc);
+ if (hit != adjusted) {
+ searchlen = adjusted - sbeg;
+ continue;
+ }
+ if (memcmp(hit, t, slen) == 0)
+ return rb_str_sublen(str, hit - sbeg);
+ searchlen = adjusted - sbeg;
+ } while (searchlen > 0);
+
+ return -1;
+}
+#else
+static long
+str_rindex(VALUE str, VALUE sub, const char *s, long pos, rb_encoding *enc)
+{
+ long slen;
+ char *sbeg, *e, *t;
- enc = rb_enc_check(str, sub);
- if (is_broken_string(sub)) {
- return -1;
- }
- len = str_strlen(str, enc);
- slen = str_strlen(sub, enc);
- /* substring longer than string */
- if (len < slen) return -1;
- if (len - pos < slen) {
- pos = len - slen;
- }
- if (len == 0) {
- return pos;
- }
sbeg = RSTRING_PTR(str);
e = RSTRING_END(str);
t = RSTRING_PTR(sub);
slen = RSTRING_LEN(sub);
- s = str_nth(sbeg, e, pos, enc, singlebyte);
+
while (s) {
if (memcmp(s, t, slen) == 0) {
return pos;
@@ -2651,8 +2794,42 @@ rb_str_rindex(VALUE str, VALUE sub, long pos)
pos--;
s = rb_enc_prev_char(sbeg, s, e, enc);
}
+
return -1;
}
+#endif
+
+static long
+rb_str_rindex(VALUE str, VALUE sub, long pos)
+{
+ long len, slen;
+ char *sbeg, *s;
+ rb_encoding *enc;
+ int singlebyte;
+
+ 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 */
+
+ /* substring longer than string */
+ if (len < slen) return -1;
+ if (len - pos < slen) pos = len - slen;
+ if (len == 0) return pos;
+
+ sbeg = RSTRING_PTR(str);
+
+ if (pos == 0) {
+ if (memcmp(sbeg, RSTRING_PTR(sub), RSTRING_LEN(sub)) == 0)
+ return 0;
+ else
+ return -1;
+ }
+
+ s = str_nth(sbeg, RSTRING_END(str), pos, enc, singlebyte);
+ return str_rindex(str, sub, s, pos, enc);
+}
/*
@@ -2679,7 +2856,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);
+ long pos, len = str_strlen(str, enc); /* str's enc */
if (rb_scan_args(argc, argv, "11", &sub, &vpos) == 2) {
pos = NUM2LONG(vpos);
@@ -2703,7 +2880,7 @@ 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,
- STR_ENC_GET(str), single_byte_optimizable(str));
+ enc, single_byte_optimizable(str));
if (!RREGEXP(sub)->ptr || RREGEXP_SRC_LEN(sub)) {
pos = rb_reg_search(sub, str, pos, 1);
@@ -2768,7 +2945,7 @@ rb_str_match(VALUE x, VALUE y)
}
-static VALUE get_pat(VALUE, int);
+static VALUE get_pat(VALUE);
/*
@@ -2808,7 +2985,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, 0), rb_intern("match"), argc, argv);
+ result = rb_funcall2(get_pat(re), rb_intern("match"), argc, argv);
if (!NIL_P(result) && rb_block_given_p()) {
return rb_yield(result);
}
@@ -2826,6 +3003,24 @@ enc_succ_char(char *p, long len, rb_encoding *enc)
{
long i;
int l;
+
+ if (rb_enc_mbminlen(enc) > 1) {
+ /* wchar, trivial case */
+ int r = rb_enc_precise_mbclen(p, p + len, enc), c;
+ if (!MBCLEN_CHARFOUND_P(r)) {
+ return NEIGHBOR_NOT_CHAR;
+ }
+ c = rb_enc_mbc_to_codepoint(p, p + len, enc) + 1;
+ l = rb_enc_code_to_mbclen(c, enc);
+ if (!l) return NEIGHBOR_NOT_CHAR;
+ if (l != len) return NEIGHBOR_WRAPPED;
+ rb_enc_mbcput(c, p, enc);
+ r = rb_enc_precise_mbclen(p, p + len, enc);
+ if (!MBCLEN_CHARFOUND_P(r)) {
+ return NEIGHBOR_NOT_CHAR;
+ }
+ return NEIGHBOR_FOUND;
+ }
while (1) {
for (i = len-1; 0 <= i && (unsigned char)p[i] == 0xff; i--)
p[i] = '\0';
@@ -2860,6 +3055,25 @@ enc_pred_char(char *p, long len, rb_encoding *enc)
{
long i;
int l;
+ if (rb_enc_mbminlen(enc) > 1) {
+ /* wchar, trivial case */
+ int r = rb_enc_precise_mbclen(p, p + len, enc), c;
+ if (!MBCLEN_CHARFOUND_P(r)) {
+ return NEIGHBOR_NOT_CHAR;
+ }
+ c = rb_enc_mbc_to_codepoint(p, p + len, enc);
+ if (!c) return NEIGHBOR_NOT_CHAR;
+ --c;
+ l = rb_enc_code_to_mbclen(c, enc);
+ if (!l) return NEIGHBOR_NOT_CHAR;
+ if (l != len) return NEIGHBOR_WRAPPED;
+ rb_enc_mbcput(c, p, enc);
+ r = rb_enc_precise_mbclen(p, p + len, enc);
+ if (!MBCLEN_CHARFOUND_P(r)) {
+ return NEIGHBOR_NOT_CHAR;
+ }
+ return NEIGHBOR_FOUND;
+ }
while (1) {
for (i = len-1; 0 <= i && (unsigned char)p[i] == 0; i--)
p[i] = '\xff';
@@ -2992,7 +3206,7 @@ rb_str_succ(VALUE orig)
long carry_pos = 0, carry_len = 1;
enum neighbor_char neighbor = NEIGHBOR_FOUND;
- str = rb_str_new5(orig, RSTRING_PTR(orig), RSTRING_LEN(orig));
+ 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);
if (RSTRING_LEN(str) == 0) return str;
@@ -3009,7 +3223,9 @@ rb_str_succ(VALUE orig)
break;
}
}
- if ((l = rb_enc_precise_mbclen(s, e, enc)) <= 0) continue;
+ l = rb_enc_precise_mbclen(s, e, enc);
+ if (!ONIGENC_MBCLEN_CHARFOUND_P(l)) continue;
+ l = ONIGENC_MBCLEN_CHARFOUND_LEN(l);
neighbor = enc_succ_alnum_char(s, l, enc, carry);
switch (neighbor) {
case NEIGHBOR_NOT_CHAR:
@@ -3028,10 +3244,23 @@ rb_str_succ(VALUE orig)
s = e;
while ((s = rb_enc_prev_char(sbeg, s, e, enc)) != 0) {
enum neighbor_char neighbor;
- if ((l = rb_enc_precise_mbclen(s, e, enc)) <= 0) continue;
- neighbor = enc_succ_char(s, l, enc);
- if (neighbor == NEIGHBOR_FOUND)
+ char tmp[ONIGENC_CODE_TO_MBC_MAXLEN];
+ l = rb_enc_precise_mbclen(s, e, enc);
+ if (!ONIGENC_MBCLEN_CHARFOUND_P(l)) continue;
+ l = ONIGENC_MBCLEN_CHARFOUND_LEN(l);
+ MEMCPY(tmp, s, char, l);
+ neighbor = enc_succ_char(tmp, l, enc);
+ switch (neighbor) {
+ case NEIGHBOR_FOUND:
+ MEMCPY(s, tmp, char, l);
return str;
+ break;
+ case NEIGHBOR_WRAPPED:
+ MEMCPY(s, tmp, char, l);
+ break;
+ case NEIGHBOR_NOT_CHAR:
+ break;
+ }
if (rb_enc_precise_mbclen(s, s+l, enc) != l) {
/* wrapped to \0...\0. search next valid char. */
enc_succ_char(s, l, enc);
@@ -3242,7 +3471,7 @@ rb_str_aref(VALUE str, VALUE indx)
long beg, len;
VALUE tmp;
- len = str_strlen(str, STR_ENC_GET(str));
+ len = str_strlen(str, NULL);
switch (rb_range_beg_len(indx, &beg, &len, len, 0)) {
case Qfalse:
break;
@@ -3354,7 +3583,7 @@ rb_str_drop_bytes(VALUE str, long len)
nlen = olen - len;
if (nlen <= RSTRING_EMBED_LEN_MAX) {
char *oldptr = ptr;
- int fl = (int)(RBASIC(str)->flags & (STR_NOEMBED|ELTS_SHARED));
+ int fl = (int)(RBASIC(str)->flags & (STR_NOEMBED|STR_SHARED));
STR_SET_EMBED(str);
STR_SET_EMBED_LEN(str, nlen);
ptr = RSTRING(str)->as.ary;
@@ -3362,7 +3591,7 @@ rb_str_drop_bytes(VALUE str, long len)
if (fl == STR_NOEMBED) xfree(oldptr);
}
else {
- if (!STR_SHARED_P(str)) rb_str_new4(str);
+ if (!STR_SHARED_P(str)) rb_str_new_frozen(str);
ptr = RSTRING(str)->as.heap.ptr += len;
RSTRING(str)->as.heap.len = nlen;
}
@@ -3383,7 +3612,7 @@ rb_str_splice_0(VALUE str, long beg, long len, VALUE val)
rb_str_modify(str);
if (len < RSTRING_LEN(val)) {
/* expand string */
- RESIZE_CAPA(str, RSTRING_LEN(str) + RSTRING_LEN(val) - len + 1);
+ RESIZE_CAPA(str, RSTRING_LEN(str) + RSTRING_LEN(val) - len + TERM_LEN(str));
}
if (RSTRING_LEN(val) != len) {
@@ -3404,8 +3633,8 @@ rb_str_splice_0(VALUE str, long beg, long len, VALUE val)
OBJ_INFECT(str, val);
}
-static void
-rb_str_splice(VALUE str, long beg, long len, VALUE val)
+void
+rb_str_update(VALUE str, long beg, long len, VALUE val)
{
long slen;
char *p, *e;
@@ -3417,7 +3646,7 @@ rb_str_splice(VALUE str, long beg, long len, VALUE val)
StringValue(val);
enc = rb_enc_check(str, val);
- slen = str_strlen(str, enc);
+ slen = str_strlen(str, enc); /* rb_enc_check */
if (slen < beg) {
out_of_range:
@@ -3447,11 +3676,7 @@ rb_str_splice(VALUE str, long beg, long len, VALUE val)
ENC_CODERANGE_SET(str, cr);
}
-void
-rb_str_update(VALUE str, long beg, long len, VALUE val)
-{
- rb_str_splice(str, beg, len, val);
-}
+#define rb_str_splice(str, beg, len, val) rb_str_update(str, beg, len, val)
static void
rb_str_subpat_set(VALUE str, VALUE re, VALUE backref, VALUE val)
@@ -3515,7 +3740,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, 0), val);
+ rb_str_splice(str, beg, str_strlen(indx, NULL), val);
return val;
generic:
@@ -3523,7 +3748,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, 0), 2)) {
+ if (rb_range_beg_len(indx, &beg, &len, str_strlen(str, NULL), 2)) {
rb_str_splice(str, beg, len, val);
return val;
}
@@ -3609,7 +3834,7 @@ rb_str_insert(VALUE str, VALUE idx, VALUE str2)
/*
* call-seq:
- * str.slice!(fixnum) -> fixnum or nil
+ * str.slice!(fixnum) -> new_str or nil
* str.slice!(fixnum, fixnum) -> new_str or nil
* str.slice!(range) -> new_str or nil
* str.slice!(regexp) -> new_str or nil
@@ -3647,11 +3872,12 @@ rb_str_slice_bang(int argc, VALUE *argv, VALUE str)
}
static VALUE
-get_pat(VALUE pat, int quote)
+get_pat(VALUE pat)
{
VALUE val;
- switch (TYPE(pat)) {
+ if (SPECIAL_CONST_P(pat)) goto to_string;
+ switch (BUILTIN_TYPE(pat)) {
case T_REGEXP:
return pat;
@@ -3659,6 +3885,7 @@ get_pat(VALUE pat, int quote)
break;
default:
+ to_string:
val = rb_check_string_type(pat);
if (NIL_P(val)) {
Check_Type(pat, T_REGEXP);
@@ -3666,11 +3893,58 @@ get_pat(VALUE pat, int quote)
pat = val;
}
- if (quote) {
- pat = rb_reg_quote(pat);
+ 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 (check && is_broken_string(pat)) {
+ rb_raise(rb_eTypeError, "%"PRIsVALUE, rb_reg_new_str(pat, 0));
}
+ return pat;
+}
- return rb_reg_regcomp(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);
+ }
}
@@ -3691,9 +3965,9 @@ rb_str_sub_bang(int argc, VALUE *argv, VALUE str)
VALUE pat, repl, hash = Qnil;
int iter = 0;
int tainted = 0;
- int untrusted = 0;
long plen;
int min_arity = rb_block_given_p() ? 1 : 2;
+ long beg;
rb_check_arity(argc, min_arity, 2);
if (argc == 1) {
@@ -3706,26 +3980,39 @@ rb_str_sub_bang(int argc, VALUE *argv, VALUE str)
StringValue(repl);
}
if (OBJ_TAINTED(repl)) tainted = 1;
- if (OBJ_UNTRUSTED(repl)) untrusted = 1;
}
- pat = get_pat(argv[0], 1);
+ pat = get_pat_quoted(argv[0], 1);
+
str_modifiable(str);
- if (rb_reg_search(pat, str, 0, 0) >= 0) {
+ beg = rb_pat_search(pat, str, 0, 1);
+ if (beg >= 0) {
rb_encoding *enc;
int cr = ENC_CODERANGE(str);
- VALUE match = rb_backref_get();
- struct re_registers *regs = RMATCH_REGS(match);
- long beg0 = BEG(0);
- long end0 = END(0);
+ long beg0, end0;
+ VALUE match, match0 = Qnil;
+ struct re_registers *regs;
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(rb_reg_nth_match(0, match)));
+ repl = rb_obj_as_string(rb_yield(match0));
}
else {
repl = rb_hash_aref(hash, rb_str_subseq(str, beg0, end0 - beg0));
@@ -3735,8 +4022,9 @@ rb_str_sub_bang(int argc, VALUE *argv, VALUE str)
rb_check_frozen(str);
}
else {
- repl = rb_reg_regsub(repl, str, regs, pat);
+ repl = rb_reg_regsub(repl, str, regs, RB_TYPE_P(pat, T_STRING) ? Qnil : pat);
}
+
enc = rb_enc_compatible(str, repl);
if (!enc) {
rb_encoding *str_enc = STR_ENC_GET(str);
@@ -3752,7 +4040,6 @@ rb_str_sub_bang(int argc, VALUE *argv, VALUE str)
rb_str_modify(str);
rb_enc_associate(str, enc);
if (OBJ_TAINTED(repl)) tainted = 1;
- if (OBJ_UNTRUSTED(repl)) untrusted = 1;
if (ENC_CODERANGE_UNKNOWN < cr && cr < ENC_CODERANGE_BROKEN) {
int cr2 = ENC_CODERANGE(repl);
if (cr2 == ENC_CODERANGE_BROKEN ||
@@ -3777,7 +4064,6 @@ rb_str_sub_bang(int argc, VALUE *argv, VALUE str)
RSTRING_PTR(str)[len] = '\0';
ENC_CODERANGE_SET(str, cr);
if (tainted) OBJ_TAINT(str);
- if (untrusted) OBJ_UNTRUST(str);
return str;
}
@@ -3835,20 +4121,21 @@ rb_str_sub(int argc, VALUE *argv, VALUE str)
static VALUE
str_gsub(int argc, VALUE *argv, VALUE str, int bang)
{
- VALUE pat, val, repl, match, dest, hash = Qnil;
+ VALUE pat, val = Qnil, repl, match, match0 = Qnil, dest, hash = Qnil;
struct re_registers *regs;
long beg, n;
long beg0, end0;
long offset, blen, slen, len, last;
- int iter = 0;
+ enum {STR, ITER, MAP} mode = STR;
char *sp, *cp;
int tainted = 0;
+ int need_backref = -1;
rb_encoding *str_enc;
switch (argc) {
case 1:
RETURN_ENUMERATOR(str, argc, argv);
- iter = 1;
+ mode = ITER;
break;
case 2:
repl = argv[1];
@@ -3856,14 +4143,17 @@ str_gsub(int argc, VALUE *argv, VALUE str, int bang)
if (NIL_P(hash)) {
StringValue(repl);
}
+ else {
+ mode = MAP;
+ }
if (OBJ_TAINTED(repl)) tainted = 1;
break;
default:
rb_check_arity(argc, 1, 2);
}
- pat = get_pat(argv[0], 1);
- beg = rb_reg_search(pat, str, 0, 0);
+ pat = get_pat_quoted(argv[0], 1);
+ beg = rb_pat_search(pat, str, 0, need_backref);
if (beg < 0) {
if (bang) return Qnil; /* no match, no substitution */
return rb_str_dup(str);
@@ -3882,16 +4172,26 @@ str_gsub(int argc, VALUE *argv, VALUE str, int bang)
do {
n++;
+
match = rb_backref_get();
regs = RMATCH_REGS(match);
- 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)));
+ 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));
}
else {
- val = rb_hash_aref(hash, rb_str_subseq(str, BEG(0), END(0) - BEG(0)));
+ val = rb_hash_aref(hash, rb_str_subseq(str, beg0, end0 - beg0));
val = rb_obj_as_string(val);
}
str_mod_check(str, sp, slen);
@@ -3899,10 +4199,17 @@ 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 = rb_reg_regsub(repl, str, regs, pat);
+ val = repl;
}
+
if (OBJ_TAINTED(val)) tainted = 1;
len = beg0 - offset; /* copy pre-match substr */
@@ -3926,17 +4233,17 @@ str_gsub(int argc, VALUE *argv, VALUE str, int bang)
}
cp = RSTRING_PTR(str) + offset;
if (offset > RSTRING_LEN(str)) break;
- beg = rb_reg_search(pat, str, offset, 0);
+ beg = rb_pat_search(pat, str, offset, need_backref);
} while (beg >= 0);
if (RSTRING_LEN(str) > offset) {
rb_enc_str_buf_cat(dest, cp, RSTRING_LEN(str) - offset, str_enc);
}
- rb_reg_search(pat, str, last, 0);
+ rb_pat_search(pat, str, last, 1);
if (bang) {
rb_str_shared_replace(str, dest);
}
else {
- RBASIC(dest)->klass = rb_obj_class(str);
+ RBASIC_SET_CLASS(dest, rb_obj_class(str));
OBJ_INFECT(dest, str);
str = dest;
}
@@ -4141,14 +4448,14 @@ str_byte_substr(VALUE str, long beg, long len)
else
p = s + 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;
+ if (len > RSTRING_EMBED_LEN_MAX && 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;
RSTRING(str2)->as.heap.len = len;
}
else {
- str2 = rb_str_new5(str, p, len);
+ str2 = rb_str_new_with_class(str, p, len);
}
str_enc_copy(str2, str);
@@ -4261,7 +4568,7 @@ rb_str_reverse(VALUE str)
if (RSTRING_LEN(str) <= 1) return rb_str_dup(str);
enc = STR_ENC_GET(str);
- rev = rb_str_new5(str, 0, RSTRING_LEN(str));
+ rev = rb_str_new_with_class(str, 0, RSTRING_LEN(str));
s = RSTRING_PTR(str); e = RSTRING_END(str);
p = RSTRING_END(rev);
@@ -4507,17 +4814,15 @@ rb_str_buf_cat_escaped_char(VALUE result, unsigned int c, int unicode_p)
VALUE
rb_str_inspect(VALUE str)
{
- rb_encoding *enc = STR_ENC_GET(str);
+ int encidx = ENCODING_GET(str);
+ rb_encoding *enc = rb_enc_from_index(encidx), *actenc;
const char *p, *pend, *prev;
char buf[CHAR_ESC_LEN + 1];
VALUE result = rb_str_buf_new(0);
rb_encoding *resenc = rb_default_internal_encoding();
int unicode_p = rb_enc_unicode_p(enc);
int asciicompat = rb_enc_asciicompat(enc);
- static rb_encoding *utf16, *utf32;
- if (!utf16) utf16 = rb_enc_find("UTF-16");
- if (!utf32) utf32 = rb_enc_find("UTF-32");
if (resenc == NULL) resenc = rb_default_external_encoding();
if (!rb_enc_asciicompat(resenc)) resenc = rb_usascii_encoding();
rb_enc_associate(result, resenc);
@@ -4525,23 +4830,10 @@ rb_str_inspect(VALUE str)
p = RSTRING_PTR(str); pend = RSTRING_END(str);
prev = p;
- if (enc == utf16) {
- const unsigned char *q = (const unsigned char *)p;
- if (q[0] == 0xFE && q[1] == 0xFF)
- enc = rb_enc_find("UTF-16BE");
- else if (q[0] == 0xFF && q[1] == 0xFE)
- enc = rb_enc_find("UTF-16LE");
- else
- unicode_p = 0;
- }
- else if (enc == utf32) {
- const unsigned char *q = (const unsigned char *)p;
- if (q[0] == 0 && q[1] == 0 && q[2] == 0xFE && q[3] == 0xFF)
- enc = rb_enc_find("UTF-32BE");
- else if (q[3] == 0 && q[2] == 0 && q[1] == 0xFE && q[0] == 0xFF)
- enc = rb_enc_find("UTF-32LE");
- else
- unicode_p = 0;
+ actenc = get_actual_encoding(encidx, str);
+ if (actenc != enc) {
+ enc = actenc;
+ if (unicode_p) unicode_p = rb_enc_unicode_p(enc);
}
while (p < pend) {
unsigned int c, cc;
@@ -4657,9 +4949,9 @@ rb_str_dump(VALUE str)
len++;
}
else {
- if (u8) { /* \u{NN} */
+ if (u8 && c > 0x7F) { /* \u{NN} */
int n = rb_enc_precise_mbclen(p-1, pend, enc);
- if (MBCLEN_CHARFOUND_P(n-1)) {
+ if (MBCLEN_CHARFOUND_P(n)) {
unsigned int cc = rb_enc_mbc_to_codepoint(p-1, pend, enc);
while (cc >>= 4) len++;
len += 5;
@@ -4677,7 +4969,7 @@ rb_str_dump(VALUE str)
len += strlen(enc->name);
}
- result = rb_str_new5(str, 0, len);
+ result = rb_str_new_with_class(str, 0, len);
p = RSTRING_PTR(str); pend = p + RSTRING_LEN(str);
q = RSTRING_PTR(result); qend = q + len + 1;
@@ -5280,7 +5572,7 @@ tr_trans(VALUE str, VALUE src, VALUE repl, int sflag)
t += tlen;
}
if (!STR_EMBED_P(str)) {
- xfree(RSTRING(str)->as.heap.ptr);
+ ruby_sized_xfree(STR_HEAP_PTR(str), STR_HEAP_SIZE(str));
}
*t = '\0';
RSTRING(str)->as.heap.ptr = buf;
@@ -5356,7 +5648,7 @@ tr_trans(VALUE str, VALUE src, VALUE repl, int sflag)
t += tlen;
}
if (!STR_EMBED_P(str)) {
- xfree(RSTRING(str)->as.heap.ptr);
+ ruby_sized_xfree(STR_HEAP_PTR(str), STR_HEAP_SIZE(str));
}
*t = '\0';
RSTRING(str)->as.heap.ptr = buf;
@@ -5500,7 +5792,7 @@ tr_setup_table(VALUE str, char stable[TR_TABLE_SIZE], int first,
static int
-tr_find(unsigned int c, char table[TR_TABLE_SIZE], VALUE del, VALUE nodel)
+tr_find(unsigned int c, const char table[TR_TABLE_SIZE], VALUE del, VALUE nodel)
{
if (c < 256) {
return table[c] != 0;
@@ -5662,7 +5954,8 @@ rb_str_squeeze_bang(int argc, VALUE *argv, VALUE str)
*t++ = save = c;
}
}
- } else {
+ }
+ else {
while (s < send) {
unsigned int c;
int clen;
@@ -5790,21 +6083,25 @@ rb_str_count(int argc, VALUE *argv, VALUE str)
{
char table[TR_TABLE_SIZE];
rb_encoding *enc = 0;
- VALUE del = 0, nodel = 0;
+ VALUE del = 0, nodel = 0, tstr;
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;
- 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)) {
+ 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)) {
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);
@@ -5814,7 +6111,14 @@ rb_str_count(int argc, VALUE *argv, VALUE str)
}
return INT2NUM(n);
}
- tr_setup_table(tstr, table, i==0, &del, &nodel, enc);
+ }
+
+ 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);
}
s = RSTRING_PTR(str);
@@ -5944,7 +6248,8 @@ rb_str_split_m(int argc, VALUE *argv, VALUE str)
}
else {
fs_set:
- if (RB_TYPE_P(spat, T_STRING)) {
+ spat = get_pat_quoted(spat, 1);
+ if (BUILTIN_TYPE(spat) == T_STRING) {
rb_encoding *enc2 = STR_ENC_GET(spat);
split_type = string;
@@ -5967,7 +6272,6 @@ rb_str_split_m(int argc, VALUE *argv, VALUE str)
}
}
else {
- spat = get_pat(spat, 1);
split_type = regexp;
}
}
@@ -6041,12 +6345,8 @@ rb_str_split_m(int argc, VALUE *argv, VALUE str)
char *sptr = RSTRING_PTR(spat);
long slen = RSTRING_LEN(spat);
- 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)));
- }
+ mustnot_broken(str);
+ mustnot_broken(spat);
enc = rb_enc_check(str, spat);
while (ptr < eptr &&
(end = rb_memsearch(sptr, slen, ptr, eptr - ptr, enc)) >= 0) {
@@ -6120,7 +6420,7 @@ rb_str_split_m(int argc, VALUE *argv, VALUE str)
if (NIL_P(limit) && lim == 0) {
long len;
while ((len = RARRAY_LEN(result)) > 0 &&
- (tmp = RARRAY_PTR(result)[len-1], RSTRING_LEN(tmp) == 0))
+ (tmp = RARRAY_AREF(result, len-1), RSTRING_LEN(tmp) == 0))
rb_ary_pop(result);
}
@@ -6133,7 +6433,7 @@ rb_str_split(VALUE str, const char *sep0)
VALUE sep;
StringValue(str);
- sep = rb_str_new2(sep0);
+ sep = rb_str_new_cstr(sep0);
return rb_str_split_m(1, &sep, str);
}
@@ -6142,25 +6442,21 @@ static VALUE
rb_str_enumerate_lines(int argc, VALUE *argv, VALUE str, int wantarray)
{
rb_encoding *enc;
- VALUE rs;
- unsigned int newline;
- const char *p, *pend, *s, *ptr;
- long len, rslen;
- VALUE line;
- int n;
- VALUE orig = str;
+ VALUE line, rs, orig = str;
+ const char *ptr, *pend, *subptr, *subend, *rsptr, *hit, *adjusted;
+ long pos, len, rslen;
+ int paragraph_mode = 0;
+
VALUE UNINITIALIZED_VAR(ary);
- if (argc == 0) {
+ if (argc == 0)
rs = rb_rs;
- }
- else {
+ else
rb_scan_args(argc, argv, "01", &rs);
- }
if (rb_block_given_p()) {
if (wantarray) {
-#if 0 /* next major */
+#if STRING_ENUMERATORS_WANTARRAY
rb_warn("given block not used");
ary = rb_ary_new();
#else
@@ -6186,76 +6482,63 @@ rb_str_enumerate_lines(int argc, VALUE *argv, VALUE str, int wantarray)
return orig;
}
}
- str = rb_str_new4(str);
- ptr = p = s = RSTRING_PTR(str);
- pend = p + RSTRING_LEN(str);
+
+ str = rb_str_new_frozen(str);
+ ptr = subptr = RSTRING_PTR(str);
+ pend = RSTRING_END(str);
len = RSTRING_LEN(str);
StringValue(rs);
- if (rs == rb_default_rs) {
- enc = rb_enc_get(str);
- while (p < pend) {
- char *p0;
+ rslen = RSTRING_LEN(rs);
- p = memchr(p, '\n', pend - p);
- if (!p) break;
- p0 = rb_enc_left_char_head(s, p, pend, enc);
- if (!rb_enc_is_newline(p0, pend, enc)) {
- p++;
- continue;
- }
- p = p0 + rb_enc_mbclen(p0, pend, enc);
- line = rb_str_subseq(str, s - ptr, p - s);
- if (wantarray)
- rb_ary_push(ary, line);
- else
- rb_yield(line);
- str_mod_check(str, ptr, len);
- s = p;
- }
- goto finish;
- }
+ if (rs == rb_default_rs)
+ enc = rb_enc_get(str);
+ else
+ enc = rb_enc_check(str, rs);
- enc = rb_enc_check(str, rs);
- rslen = RSTRING_LEN(rs);
if (rslen == 0) {
- newline = '\n';
+ rsptr = "\n\n";
+ rslen = 2;
+ paragraph_mode = 1;
}
else {
- newline = rb_enc_codepoint(RSTRING_PTR(rs), RSTRING_END(rs), enc);
+ rsptr = RSTRING_PTR(rs);
}
- while (p < pend) {
- unsigned int c = rb_enc_codepoint_len(p, pend, &n, enc);
+ if ((rs == rb_default_rs || paragraph_mode) && !rb_enc_asciicompat(enc)) {
+ rs = rb_str_new(rsptr, rslen);
+ rs = rb_str_encode(rs, rb_enc_from_encoding(enc), 0, Qnil);
+ rsptr = RSTRING_PTR(rs);
+ rslen = RSTRING_LEN(rs);
+ }
- again:
- if (rslen == 0 && c == newline) {
- p += n;
- if (p < pend && (c = rb_enc_codepoint_len(p, pend, &n, enc)) != newline) {
- goto again;
- }
- while (p < pend && rb_enc_codepoint(p, pend, enc) == newline) {
- p += n;
+ while (subptr < pend) {
+ pos = rb_memsearch(rsptr, rslen, subptr, pend - subptr, enc);
+ if (pos < 0) break;
+ hit = subptr + pos;
+ adjusted = rb_enc_right_char_head(subptr, hit, pend, enc);
+ if (hit != adjusted) {
+ subptr = adjusted;
+ continue;
+ }
+ subend = hit + rslen;
+ if (paragraph_mode) {
+ while (subend < pend && rb_enc_is_newline(subend, pend, enc)) {
+ subend += rb_enc_mbclen(subend, pend, enc);
}
- p -= n;
}
- if (c == newline &&
- (rslen <= 1 ||
- (pend - p >= rslen && memcmp(RSTRING_PTR(rs), p, rslen) == 0))) {
- const char *pp = p + (rslen ? rslen : n);
- line = rb_str_subseq(str, s - ptr, pp - s);
- if (wantarray)
- rb_ary_push(ary, line);
- else
- rb_yield(line);
+ line = rb_str_subseq(str, subptr - ptr, subend - subptr);
+ if (wantarray) {
+ rb_ary_push(ary, line);
+ }
+ else {
+ rb_yield(line);
str_mod_check(str, ptr, len);
- s = pp;
}
- p += n;
+ subptr = subend;
}
- finish:
- if (s != pend) {
- line = rb_str_subseq(str, s - ptr, pend - s);
+ if (subptr != pend) {
+ line = rb_str_subseq(str, subptr - ptr, pend - subptr);
if (wantarray)
rb_ary_push(ary, line);
else
@@ -6329,7 +6612,7 @@ rb_str_lines(int argc, VALUE *argv, VALUE str)
}
static VALUE
-rb_str_each_byte_size(VALUE str, VALUE args)
+rb_str_each_byte_size(VALUE str, VALUE args, VALUE eobj)
{
return LONG2FIX(RSTRING_LEN(str));
}
@@ -6342,7 +6625,7 @@ rb_str_enumerate_bytes(VALUE str, int wantarray)
if (rb_block_given_p()) {
if (wantarray) {
-#if 0 /* next major */
+#if STRING_ENUMERATORS_WANTARRAY
rb_warn("given block not used");
ary = rb_ary_new();
#else
@@ -6409,18 +6692,9 @@ rb_str_bytes(VALUE str)
}
static VALUE
-rb_str_each_char_size(VALUE str)
+rb_str_each_char_size(VALUE str, VALUE args, VALUE eobj)
{
- long len = RSTRING_LEN(str);
- if (!single_byte_optimizable(str)) {
- const char *ptr = RSTRING_PTR(str);
- rb_encoding *enc = rb_enc_get(str);
- const char *end_ptr = ptr + len;
- for (len = 0; ptr < end_ptr; ++len) {
- ptr += rb_enc_mbclen(ptr, end_ptr, enc);
- }
- }
- return LONG2FIX(len);
+ return rb_str_length(str);
}
static VALUE
@@ -6433,11 +6707,16 @@ rb_str_enumerate_chars(VALUE str, int wantarray)
rb_encoding *enc;
VALUE UNINITIALIZED_VAR(ary);
+ str = rb_str_new_frozen(str);
+ ptr = RSTRING_PTR(str);
+ len = RSTRING_LEN(str);
+ enc = rb_enc_get(str);
+
if (rb_block_given_p()) {
if (wantarray) {
-#if 0 /* next major */
+#if STRING_ENUMERATORS_WANTARRAY
rb_warn("given block not used");
- ary = rb_ary_new();
+ ary = rb_ary_new_capa(str_strlen(str, enc)); /* str's enc*/
#else
rb_warning("passing a block to String#chars is deprecated");
wantarray = 0;
@@ -6446,15 +6725,11 @@ rb_str_enumerate_chars(VALUE str, int wantarray)
}
else {
if (wantarray)
- ary = rb_ary_new();
+ ary = rb_ary_new_capa(str_strlen(str, enc)); /* str's enc*/
else
RETURN_SIZED_ENUMERATOR(str, 0, 0, rb_str_each_char_size);
}
- str = rb_str_new4(str);
- ptr = RSTRING_PTR(str);
- len = RSTRING_LEN(str);
- enc = rb_enc_get(str);
switch (ENC_CODERANGE(str)) {
case ENC_CODERANGE_VALID:
case ENC_CODERANGE_7BIT:
@@ -6536,11 +6811,16 @@ 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);
+ ptr = RSTRING_PTR(str);
+ end = RSTRING_END(str);
+ enc = STR_ENC_GET(str);
+
if (rb_block_given_p()) {
if (wantarray) {
-#if 0 /* next major */
+#if STRING_ENUMERATORS_WANTARRAY
rb_warn("given block not used");
- ary = rb_ary_new();
+ ary = rb_ary_new_capa(str_strlen(str, enc)); /* str's enc*/
#else
rb_warning("passing a block to String#codepoints is deprecated");
wantarray = 0;
@@ -6549,15 +6829,11 @@ rb_str_enumerate_codepoints(VALUE str, int wantarray)
}
else {
if (wantarray)
- ary = rb_ary_new();
+ ary = rb_ary_new_capa(str_strlen(str, enc)); /* str's enc*/
else
RETURN_SIZED_ENUMERATOR(str, 0, 0, rb_str_each_char_size);
}
- str = rb_str_new4(str);
- ptr = RSTRING_PTR(str);
- end = RSTRING_END(str);
- enc = STR_ENC_GET(str);
while (ptr < end) {
c = rb_enc_codepoint_len(ptr, end, &n, enc);
if (wantarray)
@@ -6997,7 +7273,7 @@ scan_once(VALUE str, VALUE pat, long *start)
struct re_registers *regs;
int i;
- if (rb_reg_search(pat, str, *start, 0) >= 0) {
+ if (rb_pat_search(pat, str, *start, 1) >= 0) {
match = rb_backref_get();
regs = RMATCH_REGS(match);
if (BEG(0) == END(0)) {
@@ -7067,7 +7343,8 @@ 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(pat, 1);
+ pat = get_pat_quoted(pat, 1);
+ mustnot_broken(str);
if (!rb_block_given_p()) {
VALUE ary = rb_ary_new();
@@ -7076,7 +7353,7 @@ rb_str_scan(VALUE str, VALUE pat)
prev = start;
rb_ary_push(ary, result);
}
- if (last >= 0) rb_reg_search(pat, str, last, 0);
+ if (last >= 0) rb_pat_search(pat, str, last, 1);
return ary;
}
@@ -7086,7 +7363,7 @@ rb_str_scan(VALUE str, VALUE pat)
rb_yield(result);
str_mod_check(str, p, len);
}
- if (last >= 0) rb_reg_search(pat, str, last, 0);
+ if (last >= 0) rb_pat_search(pat, str, last, 1);
return str;
}
@@ -7180,33 +7457,13 @@ rb_str_crypt(VALUE str, VALUE salt)
if (!res) {
rb_sys_fail("crypt");
}
- result = rb_str_new2(res);
+ result = rb_str_new_cstr(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)
{
@@ -7325,13 +7582,13 @@ rb_str_justify(int argc, VALUE *argv, VALUE str, char jflag)
enc = rb_enc_check(str, pad);
f = RSTRING_PTR(pad);
flen = RSTRING_LEN(pad);
- fclen = str_strlen(pad, enc);
+ fclen = str_strlen(pad, enc); /* rb_enc_check */
singlebyte = single_byte_optimizable(pad);
if (flen == 0 || fclen == 0) {
rb_raise(rb_eArgError, "zero width padding");
}
}
- len = str_strlen(str, enc);
+ len = str_strlen(str, enc); /* rb_enc_check */
if (width < 0 || len >= width) return rb_str_dup(str);
n = width - len;
llen = (jflag == 'l') ? 0 : ((jflag == 'r') ? n : n/2);
@@ -7348,7 +7605,7 @@ rb_str_justify(int argc, VALUE *argv, VALUE str, char jflag)
rb_raise(rb_eArgError, "argument too big");
}
len += size;
- res = rb_str_new5(str, 0, len);
+ res = rb_str_new_with_class(str, 0, len);
p = RSTRING_PTR(res);
if (flen <= 1) {
memset(p, *f, llen);
@@ -7473,31 +7730,21 @@ 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);
- 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));
+ if (pos < 0) {
+ failed:
+ return rb_ary_new3(3, str, str_new_empty(str), str_new_empty(str));
}
- sep = tmp;
- pos = rb_str_index(str, sep, 0);
- }
- 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;
}
+ else {
+ pos = rb_str_index(str, sep, 0);
+ if (pos < 0) goto failed;
+ }
return rb_ary_new3(3, rb_str_subseq(str, 0, pos),
sep,
rb_str_subseq(str, pos+RSTRING_LEN(sep),
@@ -7547,9 +7794,13 @@ rb_str_rpartition(VALUE str, VALUE sep)
if (regex) {
sep = rb_reg_nth_match(0, rb_backref_get());
}
- return rb_ary_new3(3, rb_str_substr(str, 0, pos),
+ else {
+ pos = rb_str_offset(str, pos);
+ }
+ return rb_ary_new3(3, rb_str_subseq(str, 0, pos),
sep,
- rb_str_substr(str,pos+str_strlen(sep,STR_ENC_GET(sep)),RSTRING_LEN(str)));
+ rb_str_subseq(str, pos+RSTRING_LEN(sep),
+ RSTRING_LEN(str)-pos-RSTRING_LEN(sep)));
}
/*
@@ -7650,7 +7901,7 @@ rb_str_b(VALUE str)
VALUE str2 = str_alloc(rb_cString);
str_replace_shared_without_enc(str2, str);
OBJ_INFECT(str2, str);
- ENC_CODERANGE_SET(str2, ENC_CODERANGE_VALID);
+ ENC_CODERANGE_CLEAR(str2);
return str2;
}
@@ -7701,7 +7952,7 @@ rb_str_is_ascii_only_p(VALUE str)
* \pre _len_ must not be negative.
* \post the length of the returned string in characters is less than or equal to _len_.
* \post If the length of _str_ is less than or equal _len_, returns _str_ itself.
- * \post the encoded of returned string is equal to the encoded of _str_.
+ * \post the encoding of returned string is equal to the encoding of _str_.
* \post the class of returned string is equal to the class of _str_.
* \note the length is counted in characters.
*/
@@ -7742,6 +7993,318 @@ rb_str_ellipsize(VALUE str, long len)
return ret;
}
+static VALUE
+str_compat_and_valid(VALUE str, rb_encoding *enc)
+{
+ int cr;
+ str = StringValue(str);
+ cr = rb_enc_str_coderange(str);
+ if (cr == ENC_CODERANGE_BROKEN) {
+ rb_raise(rb_eArgError, "replacement must be valid byte sequence '%+"PRIsVALUE"'", str);
+ }
+ else if (cr == ENC_CODERANGE_7BIT) {
+ rb_encoding *e = STR_ENC_GET(str);
+ if (!rb_enc_asciicompat(enc)) {
+ rb_raise(rb_eEncCompatError, "incompatible character encodings: %s and %s",
+ 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;
+}
+
+/**
+ * @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)
+{
+ int cr = ENC_CODERANGE(str);
+ rb_encoding *enc;
+ int encidx;
+
+ 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);
+ }
+
+ if (rb_enc_dummy_p(enc)) {
+ return Qnil;
+ }
+ encidx = rb_enc_to_index(enc);
+
+#define DEFAULT_REPLACE_CHAR(str) do { \
+ static const char replace[sizeof(str)-1] = str; \
+ rep = replace; replen = (int)sizeof(replace); \
+ } while (0)
+
+ if (rb_enc_asciicompat(enc)) {
+ const char *p = RSTRING_PTR(str);
+ const char *e = RSTRING_END(str);
+ const char *p1 = p;
+ const char *rep;
+ long replen;
+ int rep7bit_p;
+ VALUE buf = Qnil;
+ if (rb_block_given_p()) {
+ rep = NULL;
+ replen = 0;
+ rep7bit_p = FALSE;
+ }
+ else if (!NIL_P(repl)) {
+ rep = RSTRING_PTR(repl);
+ replen = RSTRING_LEN(repl);
+ rep7bit_p = (ENC_CODERANGE(repl) == ENC_CODERANGE_7BIT);
+ }
+ else if (encidx == rb_utf8_encindex()) {
+ DEFAULT_REPLACE_CHAR("\xEF\xBF\xBD");
+ rep7bit_p = FALSE;
+ }
+ else {
+ DEFAULT_REPLACE_CHAR("?");
+ rep7bit_p = TRUE;
+ }
+ cr = ENC_CODERANGE_7BIT;
+
+ p = search_nonascii(p, e);
+ if (!p) {
+ p = e;
+ }
+ while (p < e) {
+ int ret = rb_enc_precise_mbclen(p, e, enc);
+ if (MBCLEN_NEEDMORE_P(ret)) {
+ break;
+ }
+ else if (MBCLEN_CHARFOUND_P(ret)) {
+ cr = ENC_CODERANGE_VALID;
+ p += MBCLEN_CHARFOUND_LEN(ret);
+ }
+ else if (MBCLEN_INVALID_P(ret)) {
+ /*
+ * p1~p: valid ascii/multibyte chars
+ * p ~e: invalid bytes + unknown bytes
+ */
+ long clen = rb_enc_mbmaxlen(enc);
+ if (NIL_P(buf)) buf = rb_str_buf_new(RSTRING_LEN(str));
+ if (p > p1) {
+ rb_str_buf_cat(buf, p1, p - p1);
+ }
+
+ if (e - p < clen) clen = e - p;
+ if (clen <= 2) {
+ clen = 1;
+ }
+ else {
+ const char *q = p;
+ clen--;
+ for (; clen > 1; clen--) {
+ ret = rb_enc_precise_mbclen(q, q + clen, enc);
+ if (MBCLEN_NEEDMORE_P(ret)) break;
+ if (MBCLEN_INVALID_P(ret)) continue;
+ UNREACHABLE;
+ }
+ }
+ if (rep) {
+ rb_str_buf_cat(buf, rep, replen);
+ if (!rep7bit_p) cr = ENC_CODERANGE_VALID;
+ }
+ else {
+ repl = rb_yield(rb_enc_str_new(p, clen, enc));
+ repl = str_compat_and_valid(repl, enc);
+ rb_str_buf_cat(buf, RSTRING_PTR(repl), RSTRING_LEN(repl));
+ if (ENC_CODERANGE(repl) == ENC_CODERANGE_VALID)
+ cr = ENC_CODERANGE_VALID;
+ }
+ p += clen;
+ p1 = p;
+ p = search_nonascii(p, e);
+ if (!p) {
+ p = e;
+ break;
+ }
+ }
+ else {
+ UNREACHABLE;
+ }
+ }
+ if (NIL_P(buf)) {
+ if (p == e) {
+ ENC_CODERANGE_SET(str, cr);
+ return Qnil;
+ }
+ buf = rb_str_buf_new(RSTRING_LEN(str));
+ }
+ if (p1 < p) {
+ rb_str_buf_cat(buf, p1, p - p1);
+ }
+ if (p < e) {
+ if (rep) {
+ rb_str_buf_cat(buf, rep, replen);
+ if (!rep7bit_p) cr = ENC_CODERANGE_VALID;
+ }
+ else {
+ repl = rb_yield(rb_enc_str_new(p, e-p, enc));
+ repl = str_compat_and_valid(repl, enc);
+ 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 (!NIL_P(repl)) {
+ rep = RSTRING_PTR(repl);
+ replen = RSTRING_LEN(repl);
+ }
+ else if (encidx == ENCINDEX_UTF_16BE) {
+ DEFAULT_REPLACE_CHAR("\xFF\xFD");
+ }
+ else if (encidx == ENCINDEX_UTF_16LE) {
+ DEFAULT_REPLACE_CHAR("\xFD\xFF");
+ }
+ else if (encidx == ENCINDEX_UTF_32BE) {
+ DEFAULT_REPLACE_CHAR("\x00\x00\xFF\xFD");
+ }
+ else if (encidx == ENCINDEX_UTF_32LE) {
+ DEFAULT_REPLACE_CHAR("\xFD\xFF\x00\x00");
+ }
+ else {
+ DEFAULT_REPLACE_CHAR("?");
+ }
+
+ while (p < e) {
+ int ret = rb_enc_precise_mbclen(p, e, enc);
+ if (MBCLEN_NEEDMORE_P(ret)) {
+ break;
+ }
+ else if (MBCLEN_CHARFOUND_P(ret)) {
+ p += MBCLEN_CHARFOUND_LEN(ret);
+ }
+ else if (MBCLEN_INVALID_P(ret)) {
+ const char *q = p;
+ long clen = rb_enc_mbmaxlen(enc);
+ if (NIL_P(buf)) buf = rb_str_buf_new(RSTRING_LEN(str));
+ if (p > p1) rb_str_buf_cat(buf, p1, p - p1);
+
+ if (e - p < clen) clen = e - p;
+ if (clen <= mbminlen * 2) {
+ clen = mbminlen;
+ }
+ else {
+ clen -= mbminlen;
+ for (; clen > mbminlen; clen-=mbminlen) {
+ ret = rb_enc_precise_mbclen(q, q + clen, enc);
+ if (MBCLEN_NEEDMORE_P(ret)) break;
+ if (MBCLEN_INVALID_P(ret)) continue;
+ UNREACHABLE;
+ }
+ }
+ if (rep) {
+ rb_str_buf_cat(buf, rep, replen);
+ }
+ else {
+ repl = rb_yield(rb_enc_str_new(p, e-p, enc));
+ repl = str_compat_and_valid(repl, enc);
+ rb_str_buf_cat(buf, RSTRING_PTR(repl), RSTRING_LEN(repl));
+ }
+ p += clen;
+ p1 = p;
+ }
+ else {
+ UNREACHABLE;
+ }
+ }
+ if (NIL_P(buf)) {
+ if (p == e) {
+ ENC_CODERANGE_SET(str, ENC_CODERANGE_VALID);
+ return Qnil;
+ }
+ buf = rb_str_buf_new(RSTRING_LEN(str));
+ }
+ if (p1 < p) {
+ rb_str_buf_cat(buf, p1, p - p1);
+ }
+ if (p < e) {
+ if (rep) {
+ rb_str_buf_cat(buf, rep, replen);
+ }
+ else {
+ repl = rb_yield(rb_enc_str_new(p, e-p, enc));
+ repl = str_compat_and_valid(repl, enc);
+ rb_str_buf_cat(buf, RSTRING_PTR(repl), RSTRING_LEN(repl));
+ }
+ }
+ ENCODING_CODERANGE_SET(buf, rb_enc_to_index(enc), ENC_CODERANGE_VALID);
+ return buf;
+ }
+}
+
+/*
+ * call-seq:
+ * str.scrub -> new_str
+ * str.scrub(repl) -> new_str
+ * str.scrub{|bytes|} -> new_str
+ *
+ * If the string is invalid byte sequence then replace invalid bytes with given replacement
+ * character, else returns self.
+ * If block is given, replace invalid bytes with returned value of the block.
+ *
+ * "abc\u3042\x81".scrub #=> "abc\u3042\uFFFD"
+ * "abc\u3042\x81".scrub("*") #=> "abc\u3042*"
+ * "abc\u3042\xE3\x80".scrub{|bytes| '<'+bytes.unpack('H*')[0]+'>' } #=> "abc\u3042<e380>"
+ */
+static VALUE
+str_scrub(int argc, VALUE *argv, VALUE str)
+{
+ VALUE repl = argc ? (rb_check_arity(argc, 0, 1), argv[0]) : Qnil;
+ VALUE new = rb_str_scrub(str, repl);
+ return NIL_P(new) ? rb_str_dup(str): new;
+}
+
+/*
+ * call-seq:
+ * str.scrub! -> str
+ * str.scrub!(repl) -> str
+ * str.scrub!{|bytes|} -> str
+ *
+ * If the string is invalid byte sequence then replace invalid bytes with given replacement
+ * character, else returns self.
+ * If block is given, replace invalid bytes with returned value of the block.
+ *
+ * "abc\u3042\x81".scrub! #=> "abc\u3042\uFFFD"
+ * "abc\u3042\x81".scrub!("*") #=> "abc\u3042*"
+ * "abc\u3042\xE3\x80".scrub!{|bytes| '<'+bytes.unpack('H*')[0]+'>' } #=> "abc\u3042<e380>"
+ */
+static VALUE
+str_scrub_bang(int argc, VALUE *argv, VALUE str)
+{
+ VALUE repl = argc ? (rb_check_arity(argc, 0, 1), argv[0]) : Qnil;
+ VALUE new = rb_str_scrub(str, repl);
+ if (!NIL_P(new)) rb_str_replace(str, new);
+ return str;
+}
+
/**********************************************************************
* Document-class: Symbol
*
@@ -7866,10 +8429,9 @@ sym_inspect(VALUE sym)
VALUE str;
const char *ptr;
long len;
- ID id = SYM2ID(sym);
char *dest;
- sym = rb_id2str(id);
+ sym = rb_sym2str(sym);
if (!rb_str_symname_p(sym)) {
str = rb_str_inspect(sym);
len = RSTRING_LEN(str);
@@ -7905,9 +8467,7 @@ sym_inspect(VALUE sym)
VALUE
rb_sym_to_s(VALUE sym)
{
- ID id = SYM2ID(sym);
-
- return str_new3(rb_cString, rb_id2str(id));
+ return str_new_shared(rb_cString, rb_sym2str(sym));
}
@@ -7972,6 +8532,7 @@ sym_to_proc(VALUE sym)
}
else {
proc = rb_proc_new(sym_call, (VALUE)id);
+ rb_block_clear_env_self(proc);
aryp[index] = sym;
aryp[index + 1] = proc;
return proc;
@@ -7989,7 +8550,7 @@ sym_to_proc(VALUE sym)
static VALUE
sym_succ(VALUE sym)
{
- return rb_str_intern(rb_str_succ(rb_sym_to_s(sym)));
+ return rb_str_dynamic_intern(rb_str_succ(rb_sym2str(sym)));
}
/*
@@ -8012,7 +8573,7 @@ sym_cmp(VALUE sym, VALUE other)
if (!SYMBOL_P(other)) {
return Qnil;
}
- return rb_str_cmp_m(rb_sym_to_s(sym), rb_sym_to_s(other));
+ return rb_str_cmp_m(rb_sym2str(sym), rb_sym2str(other));
}
/*
@@ -8029,12 +8590,13 @@ sym_casecmp(VALUE sym, VALUE other)
if (!SYMBOL_P(other)) {
return Qnil;
}
- return rb_str_casecmp(rb_sym_to_s(sym), rb_sym_to_s(other));
+ return rb_str_casecmp(rb_sym2str(sym), rb_sym2str(other));
}
/*
* call-seq:
* sym =~ obj -> fixnum or nil
+ * sym.match(obj) -> fixnum or nil
*
* Returns <code>sym.to_s =~ obj</code>.
*/
@@ -8042,13 +8604,15 @@ sym_casecmp(VALUE sym, VALUE other)
static VALUE
sym_match(VALUE sym, VALUE other)
{
- return rb_str_match(rb_sym_to_s(sym), other);
+ return rb_str_match(rb_sym2str(sym), other);
}
/*
* call-seq:
* sym[idx] -> char
- * sym[b, n] -> char
+ * sym[b, n] -> string
+ * sym.slice(idx) -> char
+ * sym.slice(b, n) -> string
*
* Returns <code>sym.to_s[]</code>.
*/
@@ -8056,12 +8620,13 @@ sym_match(VALUE sym, VALUE other)
static VALUE
sym_aref(int argc, VALUE *argv, VALUE sym)
{
- return rb_str_aref_m(argc, argv, rb_sym_to_s(sym));
+ return rb_str_aref_m(argc, argv, rb_sym2str(sym));
}
/*
* call-seq:
* sym.length -> integer
+ * sym.size -> integer
*
* Same as <code>sym.to_s.length</code>.
*/
@@ -8069,7 +8634,7 @@ sym_aref(int argc, VALUE *argv, VALUE sym)
static VALUE
sym_length(VALUE sym)
{
- return rb_str_length(rb_id2str(SYM2ID(sym)));
+ return rb_str_length(rb_sym2str(sym));
}
/*
@@ -8082,7 +8647,7 @@ sym_length(VALUE sym)
static VALUE
sym_empty(VALUE sym)
{
- return rb_str_empty(rb_id2str(SYM2ID(sym)));
+ return rb_str_empty(rb_sym2str(sym));
}
/*
@@ -8095,7 +8660,7 @@ sym_empty(VALUE sym)
static VALUE
sym_upcase(VALUE sym)
{
- return rb_str_intern(rb_str_upcase(rb_id2str(SYM2ID(sym))));
+ return rb_str_dynamic_intern(rb_str_upcase(rb_sym2str(sym)));
}
/*
@@ -8108,7 +8673,7 @@ sym_upcase(VALUE sym)
static VALUE
sym_downcase(VALUE sym)
{
- return rb_str_intern(rb_str_downcase(rb_id2str(SYM2ID(sym))));
+ return rb_str_dynamic_intern(rb_str_downcase(rb_sym2str(sym)));
}
/*
@@ -8121,7 +8686,7 @@ sym_downcase(VALUE sym)
static VALUE
sym_capitalize(VALUE sym)
{
- return rb_str_intern(rb_str_capitalize(rb_id2str(SYM2ID(sym))));
+ return rb_str_dynamic_intern(rb_str_capitalize(rb_sym2str(sym)));
}
/*
@@ -8134,7 +8699,7 @@ sym_capitalize(VALUE sym)
static VALUE
sym_swapcase(VALUE sym)
{
- return rb_str_intern(rb_str_swapcase(rb_id2str(SYM2ID(sym))));
+ return rb_str_dynamic_intern(rb_str_swapcase(rb_sym2str(sym)));
}
/*
@@ -8147,32 +8712,41 @@ sym_swapcase(VALUE sym)
static VALUE
sym_encoding(VALUE sym)
{
- return rb_obj_encoding(rb_id2str(SYM2ID(sym)));
+ return rb_obj_encoding(rb_sym2str(sym));
}
-ID
-rb_to_id(VALUE name)
+static VALUE
+string_for_symbol(VALUE name)
{
- VALUE tmp;
-
- switch (TYPE(name)) {
- default:
- tmp = rb_check_string_type(name);
+ if (!RB_TYPE_P(name, T_STRING)) {
+ VALUE 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));
+ rb_raise(rb_eTypeError, "%+"PRIsVALUE" is not a symbol",
+ name);
}
name = tmp;
- /* fall through */
- case T_STRING:
- name = rb_str_intern(name);
- /* fall through */
- case T_SYMBOL:
+ }
+ 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);
+}
- UNREACHABLE;
+VALUE
+rb_to_symbol(VALUE name)
+{
+ if (SYMBOL_P(name)) {
+ return name;
+ }
+ name = string_for_symbol(name);
+ return rb_str_dynamic_intern(name);
}
/*
@@ -8231,6 +8805,9 @@ Init_String(void)
rb_define_method(rb_cString, "getbyte", rb_str_getbyte, 1);
rb_define_method(rb_cString, "setbyte", rb_str_setbyte, 2);
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_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);
@@ -8262,8 +8839,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);
- rb_define_method(rb_cString, "to_sym", rb_str_intern, 0);
+ rb_define_method(rb_cString, "intern", rb_str_dynamic_intern, 0); /* in symbol.c */
+ rb_define_method(rb_cString, "to_sym", rb_str_dynamic_intern, 0); /* in symbol.c */
rb_define_method(rb_cString, "ord", rb_str_ord, 0);
rb_define_method(rb_cString, "include?", rb_str_include, 1);
@@ -8332,7 +8909,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 parse.y */
+ rb_define_singleton_method(rb_cSymbol, "all_symbols", rb_sym_all_symbols, 0); /* in symbol.c */
rb_define_method(rb_cSymbol, "==", sym_equal, 1);
rb_define_method(rb_cSymbol, "===", sym_equal, 1);
@@ -8362,4 +8939,14 @@ 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);
+}
+
+void
+Init_frozen_strings(void)
+{
+ assert(!frozen_strings);
+ frozen_strings = st_init_table_with_size(&fstring_hash_type, 1000);
}
diff --git a/struct.c b/struct.c
index 5e9f9a15a1..b550be93b1 100644
--- a/struct.c
+++ b/struct.c
@@ -30,12 +30,6 @@ struct_ivar_get(VALUE c, ID id)
}
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,8 +67,7 @@ rb_struct_s_members_m(VALUE klass)
* call-seq:
* struct.members -> array
*
- * Returns an array of symbols representing the names of the instance
- * variables.
+ * Returns the struct members as an array of symbols:
*
* Customer = Struct.new(:name, :address, :zip)
* joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
@@ -87,23 +80,28 @@ rb_struct_members_m(VALUE obj)
return rb_struct_s_members_m(rb_obj_class(obj));
}
+NORETURN(static void not_a_member(ID id));
+static void
+not_a_member(ID id)
+{
+ rb_name_error(id, "`%"PRIsVALUE"' is not a struct member", QUOTE_ID(id));
+}
+
VALUE
rb_struct_getmember(VALUE obj, ID id)
{
- VALUE members, slot, *ptr, *ptr_members;
+ VALUE members, slot;
long i, len;
- ptr = RSTRUCT_PTR(obj);
members = rb_struct_members(obj);
- ptr_members = RARRAY_PTR(members);
slot = ID2SYM(id);
len = RARRAY_LEN(members);
for (i=0; i<len; i++) {
- if (ptr_members[i] == slot) {
- return ptr[i];
+ if (RARRAY_AREF(members, i) == slot) {
+ return RSTRUCT_GET(obj, i);
}
}
- rb_name_error(id, "%s is not struct member", rb_id2name(id));
+ not_a_member(id);
UNREACHABLE;
}
@@ -114,18 +112,17 @@ rb_struct_ref(VALUE obj)
return rb_struct_getmember(obj, rb_frame_this_func());
}
-static VALUE rb_struct_ref0(VALUE obj) {return RSTRUCT_PTR(obj)[0];}
-static VALUE rb_struct_ref1(VALUE obj) {return RSTRUCT_PTR(obj)[1];}
-static VALUE rb_struct_ref2(VALUE obj) {return RSTRUCT_PTR(obj)[2];}
-static VALUE rb_struct_ref3(VALUE obj) {return RSTRUCT_PTR(obj)[3];}
-static VALUE rb_struct_ref4(VALUE obj) {return RSTRUCT_PTR(obj)[4];}
-static VALUE rb_struct_ref5(VALUE obj) {return RSTRUCT_PTR(obj)[5];}
-static VALUE rb_struct_ref6(VALUE obj) {return RSTRUCT_PTR(obj)[6];}
-static VALUE rb_struct_ref7(VALUE obj) {return RSTRUCT_PTR(obj)[7];}
-static VALUE rb_struct_ref8(VALUE obj) {return RSTRUCT_PTR(obj)[8];}
-static VALUE rb_struct_ref9(VALUE obj) {return RSTRUCT_PTR(obj)[9];}
+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);}
+static VALUE rb_struct_ref3(VALUE obj) {return RSTRUCT_GET(obj, 3);}
+static VALUE rb_struct_ref4(VALUE obj) {return RSTRUCT_GET(obj, 4);}
+static VALUE rb_struct_ref5(VALUE obj) {return RSTRUCT_GET(obj, 5);}
+static VALUE rb_struct_ref6(VALUE obj) {return RSTRUCT_GET(obj, 6);}
+static VALUE rb_struct_ref7(VALUE obj) {return RSTRUCT_GET(obj, 7);}
+static VALUE rb_struct_ref8(VALUE obj) {return RSTRUCT_GET(obj, 8);}
+static VALUE rb_struct_ref9(VALUE obj) {return RSTRUCT_GET(obj, 9);}
-#define numberof(array) (int)(sizeof(array) / sizeof((array)[0]))
#define N_REF_FUNC numberof(ref_func)
static VALUE (*const ref_func[])(VALUE) = {
@@ -151,59 +148,71 @@ rb_struct_modify(VALUE s)
static VALUE
rb_struct_set(VALUE obj, VALUE val)
{
- VALUE members, slot, *ptr, *ptr_members;
+ VALUE members, slot, fsym;
long i, len;
+ ID fid = rb_frame_this_func();
members = rb_struct_members(obj);
- ptr_members = RARRAY_PTR(members);
len = RARRAY_LEN(members);
rb_struct_modify(obj);
- ptr = RSTRUCT_PTR(obj);
+ fid = rb_id_attrget(fid);
+ if (!fid) not_a_member(rb_frame_this_func());
+ fsym = ID2SYM(fid);
for (i=0; i<len; i++) {
- slot = ptr_members[i];
- if (rb_id_attrset(SYM2ID(slot)) == rb_frame_this_func()) {
- return ptr[i] = val;
+ slot = RARRAY_AREF(members, i);
+ if (slot == fsym) {
+ RSTRUCT_SET(obj, i, val);
+ return val;
}
}
- rb_name_error(rb_frame_this_func(), "`%s' is not a struct member",
- rb_id2name(rb_frame_this_func()));
+ not_a_member(fid);
UNREACHABLE;
}
static VALUE
-make_struct(VALUE name, VALUE members, VALUE klass)
+anonymous_struct(VALUE klass)
+{
+ VALUE nstr;
+
+ nstr = rb_class_new(klass);
+ rb_make_metaclass(nstr, RBASIC(klass)->klass);
+ rb_class_inherited(klass, nstr);
+ return nstr;
+}
+
+static VALUE
+new_struct(VALUE name, VALUE super)
{
- VALUE nstr, *ptr_members;
+ /* old style: should we warn? */
ID id;
+ name = rb_str_to_str(name);
+ if (!rb_is_const_name(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)) {
+ rb_warn("redefining constant %"PRIsVALUE"::%"PRIsVALUE, super, name);
+ rb_mod_remove_const(super, ID2SYM(id));
+ }
+ return rb_define_class_id_under(super, id, super);
+}
+
+static VALUE
+setup_struct(VALUE nstr, VALUE members)
+{
+ const VALUE *ptr_members;
long i, len;
OBJ_FREEZE(members);
- if (NIL_P(name)) {
- nstr = rb_class_new(klass);
- rb_make_metaclass(nstr, RBASIC(klass)->klass);
- rb_class_inherited(klass, nstr);
- }
- else {
- /* old style: should we warn? */
- name = rb_str_to_str(name);
- id = rb_to_id(name);
- if (!rb_is_const_id(id)) {
- rb_name_error(id, "identifier %s needs to be constant", StringValuePtr(name));
- }
- if (rb_const_defined_at(klass, id)) {
- rb_warn("redefining constant Struct::%s", StringValuePtr(name));
- rb_mod_remove_const(klass, ID2SYM(id));
- }
- nstr = rb_define_class_id_under(klass, id, klass);
- }
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);
rb_define_singleton_method(nstr, "[]", rb_class_new_instance, -1);
rb_define_singleton_method(nstr, "members", rb_struct_s_members_m, 0);
- ptr_members = RARRAY_PTR(members);
+ ptr_members = RARRAY_CONST_PTR(members);
len = RARRAY_LEN(members);
for (i=0; i< len; i++) {
ID id = SYM2ID(ptr_members[i]);
@@ -225,15 +234,43 @@ rb_struct_alloc_noinit(VALUE klass)
return struct_alloc(klass);
}
-VALUE
-rb_struct_define_without_accessor(const char *class_name, VALUE super, rb_alloc_func_t alloc, ...)
+static VALUE
+struct_define_without_accessor(VALUE outer, const char *class_name, VALUE super, rb_alloc_func_t alloc, VALUE members)
{
VALUE klass;
+
+ if (class_name) {
+ if (outer) {
+ klass = rb_define_class_under(outer, class_name, super);
+ }
+ else {
+ klass = rb_define_class(class_name, super);
+ }
+ }
+ else {
+ klass = anonymous_struct(super);
+ }
+
+ rb_ivar_set(klass, id_members, members);
+
+ if (alloc) {
+ rb_define_alloc_func(klass, alloc);
+ }
+ else {
+ rb_define_alloc_func(klass, struct_alloc);
+ }
+
+ return klass;
+}
+
+VALUE
+rb_struct_define_without_accessor_under(VALUE outer, const char *class_name, VALUE super, rb_alloc_func_t alloc, ...)
+{
va_list ar;
VALUE members;
char *name;
- members = rb_ary_new2(0);
+ members = rb_ary_tmp_new(0);
va_start(ar, alloc);
while ((name = va_arg(ar, char*)) != NULL) {
rb_ary_push(members, ID2SYM(rb_intern(name)));
@@ -241,35 +278,35 @@ rb_struct_define_without_accessor(const char *class_name, VALUE super, rb_alloc_
va_end(ar);
OBJ_FREEZE(members);
- if (class_name) {
- klass = rb_define_class(class_name, super);
- }
- else {
- klass = rb_class_new(super);
- rb_make_metaclass(klass, RBASIC(super)->klass);
- rb_class_inherited(super, klass);
- }
+ return struct_define_without_accessor(outer, class_name, super, alloc, members);
+}
- rb_ivar_set(klass, id_members, members);
+VALUE
+rb_struct_define_without_accessor(const char *class_name, VALUE super, rb_alloc_func_t alloc, ...)
+{
+ va_list ar;
+ VALUE members;
+ char *name;
- if (alloc)
- rb_define_alloc_func(klass, alloc);
- else
- rb_define_alloc_func(klass, struct_alloc);
+ members = rb_ary_tmp_new(0);
+ va_start(ar, alloc);
+ while ((name = va_arg(ar, char*)) != NULL) {
+ rb_ary_push(members, ID2SYM(rb_intern(name)));
+ }
+ va_end(ar);
+ OBJ_FREEZE(members);
- return klass;
+ return struct_define_without_accessor(0, class_name, super, alloc, members);
}
VALUE
rb_struct_define(const char *name, ...)
{
va_list ar;
- VALUE nm, ary;
+ VALUE st, ary;
char *mem;
- if (!name) nm = Qnil;
- else nm = rb_str_new2(name);
- ary = rb_ary_new();
+ ary = rb_ary_tmp_new(0);
va_start(ar, name);
while ((mem = va_arg(ar, char*)) != 0) {
@@ -278,27 +315,55 @@ rb_struct_define(const char *name, ...)
}
va_end(ar);
- return make_struct(nm, ary, rb_cStruct);
+ if (!name) st = anonymous_struct(rb_cStruct);
+ else st = new_struct(rb_str_new2(name), rb_cStruct);
+ return setup_struct(st, ary);
+}
+
+VALUE
+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);
+ 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);
}
/*
* call-seq:
- * Struct.new( [aString] [, aSym]+> ) -> StructClass
- * Struct.new( [aString] [, aSym]+> ) {|StructClass| block } -> StructClass
- * StructClass.new(arg, ...) -> obj
- * StructClass[arg, ...] -> obj
- *
- * Creates a new class, named by <i>aString</i>, containing accessor
- * methods for the given symbols. If the name <i>aString</i> is
- * omitted, an anonymous structure class will be created. Otherwise,
- * the name of this struct will appear as a constant in class
- * <code>Struct</code>, so it must be unique for all
- * <code>Struct</code>s in the system and should start with a capital
- * letter. Assigning a structure class to a constant effectively gives
- * the class the name of the constant.
- *
- * If a block is given, it will be evaluated in the context of
- * <i>StructClass</i>, passing <i>StructClass</i> as a parameter.
+ * Struct.new([class_name] [, member_name]+>) -> StructClass
+ * Struct.new([class_name] [, member_name]+>) {|StructClass| block } -> StructClass
+ * StructClass.new(value, ...) -> obj
+ * StructClass[value, ...] -> obj
+ *
+ * The first two forms are used to create a new Struct subclass +class_name+
+ * that can contain a value for each +member_name+. This subclass can be
+ * used to create instances of the structure like any other Class.
+ *
+ * If the +class_name+ is omitted an anonymous structure class will be
+ * created. Otherwise, the name of this struct will appear as a constant in
+ * class Struct, so it must be unique for all Structs in the system and
+ * must start with a capital letter. Assigning a structure class to a
+ * constant also gives the class the name of the constant.
+ *
+ * # Create a structure with a name under Struct
+ * Struct.new("Customer", :name, :address)
+ * #=> Struct::Customer
+ * Struct::Customer.new("Dave", "123 Main")
+ * #=> #<struct Struct::Customer name="Dave", address="123 Main">
+ *
+ * If a block is given it will be evaluated in the context of
+ * +StructClass+, passing the created class as a parameter:
*
* Customer = Struct.new(:name, :address) do
* def greeting
@@ -307,23 +372,20 @@ rb_struct_define(const char *name, ...)
* end
* Customer.new("Dave", "123 Main").greeting # => "Hello Dave!"
*
- * <code>Struct::new</code> returns a new <code>Class</code> object,
- * which can then be used to create specific instances of the new
- * structure. The number of actual parameters must be
- * less than or equal to the number of attributes defined for this
- * class; unset parameters default to <code>nil</code>. Passing too many
- * parameters will raise an <code>ArgumentError</code>.
- *
- * The remaining methods listed in this section (class and instance)
- * are defined for this generated class.
+ * This is the recommended way to customize a struct. Subclassing an
+ * anonymous struct creates an extra anonymous class that will never be used.
*
- * # Create a structure with a name in Struct
- * Struct.new("Customer", :name, :address) #=> Struct::Customer
- * Struct::Customer.new("Dave", "123 Main") #=> #<struct Struct::Customer name="Dave", address="123 Main">
+ * The last two forms create a new instance of a struct subclass. The number
+ * of +value+ parameters must be less than or equal to the number of
+ * attributes defined for the structure. Unset parameters default to +nil+.
+ * Passing more parameters than number of attributes will raise
+ * an ArgumentError.
*
* # Create a structure named by its constant
- * Customer = Struct.new(:name, :address) #=> Customer
- * Customer.new("Dave", "123 Main") #=> #<struct Customer name="Dave", address="123 Main">
+ * Customer = Struct.new(:name, :address)
+ * #=> Customer
+ * Customer.new("Dave", "123 Main")
+ * #=> #<struct Customer name="Dave", address="123 Main">
*/
static VALUE
@@ -334,16 +396,28 @@ rb_struct_s_def(int argc, VALUE *argv, VALUE klass)
VALUE st;
ID id;
- rb_scan_args(argc, argv, "1*", &name, &rest);
- if (!NIL_P(name) && SYMBOL_P(name)) {
- rb_ary_unshift(rest, name);
+ rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS);
+ name = argv[0];
+ if (SYMBOL_P(name)) {
name = Qnil;
}
- for (i=0; i<RARRAY_LEN(rest); i++) {
- id = rb_to_id(RARRAY_PTR(rest)[i]);
- RARRAY_PTR(rest)[i] = ID2SYM(id);
+ else {
+ --argc;
+ ++argv;
+ }
+ rest = rb_ary_tmp_new(argc);
+ for (i=0; i<argc; i++) {
+ id = rb_to_id(argv[i]);
+ RARRAY_ASET(rest, i, ID2SYM(id));
+ rb_ary_set_len(rest, i+1);
}
- st = make_struct(name, rest, klass);
+ if (NIL_P(name)) {
+ st = anonymous_struct(klass);
+ }
+ else {
+ st = new_struct(name, klass);
+ }
+ setup_struct(st, rest);
if (rb_block_given_p()) {
rb_mod_module_eval(0, 0, st);
}
@@ -366,19 +440,21 @@ num_members(VALUE klass)
*/
static VALUE
-rb_struct_initialize_m(int argc, VALUE *argv, VALUE self)
+rb_struct_initialize_m(int argc, const VALUE *argv, VALUE self)
{
VALUE klass = rb_obj_class(self);
- long n;
+ long i, n;
rb_struct_modify(self);
n = num_members(klass);
if (n < argc) {
rb_raise(rb_eArgError, "struct size differs");
}
- MEMCPY(RSTRUCT_PTR(self), argv, VALUE, argc);
+ for (i=0; i<argc; i++) {
+ RSTRUCT_SET(self, i, argv[i]);
+ }
if (n > argc) {
- rb_mem_clear(RSTRUCT_PTR(self)+argc, n-argc);
+ rb_mem_clear((VALUE *)RSTRUCT_CONST_PTR(self)+argc, n-argc);
}
return Qnil;
}
@@ -386,25 +462,25 @@ rb_struct_initialize_m(int argc, VALUE *argv, VALUE self)
VALUE
rb_struct_initialize(VALUE self, VALUE values)
{
- return rb_struct_initialize_m(RARRAY_LENINT(values), RARRAY_PTR(values), self);
+ return rb_struct_initialize_m(RARRAY_LENINT(values), RARRAY_CONST_PTR(values), self);
}
static VALUE
struct_alloc(VALUE klass)
{
long n;
- NEWOBJ_OF(st, struct RStruct, klass, T_STRUCT);
+ NEWOBJ_OF(st, struct RStruct, klass, T_STRUCT | (RGENGC_WB_PROTECTED_STRUCT ? FL_WB_PROTECTED : 0));
n = num_members(klass);
if (0 < n && n <= RSTRUCT_EMBED_LEN_MAX) {
RBASIC(st)->flags &= ~RSTRUCT_EMBED_LEN_MASK;
RBASIC(st)->flags |= n << RSTRUCT_EMBED_LEN_SHIFT;
- rb_mem_clear(st->as.ary, n);
+ rb_mem_clear((VALUE *)st->as.ary, n);
}
else {
st->as.heap.ptr = ALLOC_N(VALUE, n);
- rb_mem_clear(st->as.heap.ptr, n);
+ rb_mem_clear((VALUE *)st->as.heap.ptr, n);
st->as.heap.len = n;
}
@@ -414,7 +490,7 @@ struct_alloc(VALUE klass)
VALUE
rb_struct_alloc(VALUE klass, VALUE values)
{
- return rb_class_new_instance(RARRAY_LENINT(values), RARRAY_PTR(values), klass);
+ return rb_class_new_instance(RARRAY_LENINT(values), RARRAY_CONST_PTR(values), klass);
}
VALUE
@@ -441,21 +517,25 @@ rb_struct_new(VALUE klass, ...)
static VALUE
rb_struct_size(VALUE s);
+static VALUE
+struct_enum_size(VALUE s, VALUE args, VALUE eobj)
+{
+ return rb_struct_size(s);
+}
+
/*
* call-seq:
* struct.each {|obj| block } -> struct
* struct.each -> an_enumerator
*
- * Calls <i>block</i> once for each instance variable, passing the
- * value as a parameter.
- *
- * If no block is given, an enumerator is returned instead.
+ * Yields the value of each struct member in order. If no block is given an
+ * enumerator is returned.
*
* Customer = Struct.new(:name, :address, :zip)
* joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
* joe.each {|x| puts(x) }
*
- * <em>produces:</em>
+ * Produces:
*
* Joe Smith
* 123 Maple, Anytown NC
@@ -467,9 +547,9 @@ rb_struct_each(VALUE s)
{
long i;
- RETURN_SIZED_ENUMERATOR(s, 0, 0, rb_struct_size);
+ RETURN_SIZED_ENUMERATOR(s, 0, 0, struct_enum_size);
for (i=0; i<RSTRUCT_LEN(s); i++) {
- rb_yield(RSTRUCT_PTR(s)[i]);
+ rb_yield(RSTRUCT_GET(s, i));
}
return s;
}
@@ -479,16 +559,14 @@ rb_struct_each(VALUE s)
* struct.each_pair {|sym, obj| block } -> struct
* struct.each_pair -> an_enumerator
*
- * Calls <i>block</i> once for each instance variable, passing the name
- * (as a symbol) and the value as parameters.
- *
- * If no block is given, an enumerator is returned instead.
+ * Yields the name and value of each struct member in order. If no block is
+ * given an enumerator is returned.
*
* Customer = Struct.new(:name, :address, :zip)
* joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
* joe.each_pair {|name, value| puts("#{name} => #{value}") }
*
- * <em>produces:</em>
+ * Produces:
*
* name => Joe Smith
* address => 123 Maple, Anytown NC
@@ -501,12 +579,21 @@ rb_struct_each_pair(VALUE s)
VALUE members;
long i;
- RETURN_SIZED_ENUMERATOR(s, 0, 0, rb_struct_size);
+ RETURN_SIZED_ENUMERATOR(s, 0, 0, struct_enum_size);
members = rb_struct_members(s);
- for (i=0; i<RSTRUCT_LEN(s); i++) {
- VALUE key = rb_ary_entry(members, i);
- VALUE value = RSTRUCT_PTR(s)[i];
- rb_yield(rb_assoc_new(key, value));
+ if (rb_block_arity() > 1) {
+ for (i=0; i<RSTRUCT_LEN(s); i++) {
+ VALUE key = rb_ary_entry(members, i);
+ VALUE value = RSTRUCT_GET(s, i);
+ rb_yield_values(2, key, value);
+ }
+ }
+ else {
+ for (i=0; i<RSTRUCT_LEN(s); i++) {
+ VALUE key = rb_ary_entry(members, i);
+ VALUE value = RSTRUCT_GET(s, i);
+ rb_yield(rb_assoc_new(key, value));
+ }
}
return s;
}
@@ -514,9 +601,8 @@ rb_struct_each_pair(VALUE s)
static VALUE
inspect_struct(VALUE s, VALUE dummy, int recur)
{
- VALUE cname = rb_class_name(rb_obj_class(s));
+ VALUE cname = rb_class_path(rb_obj_class(s));
VALUE members, str = rb_str_new2("#<struct ");
- VALUE *ptr, *ptr_members;
long i, len;
char first = RSTRING_PTR(cname)[0];
@@ -528,9 +614,8 @@ inspect_struct(VALUE s, VALUE dummy, int recur)
}
members = rb_struct_members(s);
- ptr_members = RARRAY_PTR(members);
- ptr = RSTRUCT_PTR(s);
len = RSTRUCT_LEN(s);
+
for (i=0; i<len; i++) {
VALUE slot;
ID id;
@@ -541,7 +626,7 @@ inspect_struct(VALUE s, VALUE dummy, int recur)
else if (first != '#') {
rb_str_cat2(str, " ");
}
- slot = ptr_members[i];
+ slot = RARRAY_AREF(members, i);
id = SYM2ID(slot);
if (rb_is_local_id(id) || rb_is_const_id(id)) {
rb_str_append(str, rb_id2str(id));
@@ -550,7 +635,7 @@ inspect_struct(VALUE s, VALUE dummy, int recur)
rb_str_append(str, rb_inspect(slot));
}
rb_str_cat2(str, "=");
- rb_str_append(str, rb_inspect(ptr[i]));
+ rb_str_append(str, rb_inspect(RSTRUCT_GET(s, i)));
}
rb_str_cat2(str, ">");
OBJ_INFECT(str, s);
@@ -577,7 +662,7 @@ rb_struct_inspect(VALUE s)
* struct.to_a -> array
* struct.values -> array
*
- * Returns the values for this instance as an array.
+ * Returns the values for this struct as an Array.
*
* Customer = Struct.new(:name, :address, :zip)
* joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
@@ -587,15 +672,14 @@ rb_struct_inspect(VALUE s)
static VALUE
rb_struct_to_a(VALUE s)
{
- return rb_ary_new4(RSTRUCT_LEN(s), RSTRUCT_PTR(s));
+ return rb_ary_new4(RSTRUCT_LEN(s), RSTRUCT_CONST_PTR(s));
}
/*
* call-seq:
* struct.to_h -> hash
*
- * Returns the values for this instance as a hash with keys
- * corresponding to the instance variable name.
+ * Returns a Hash containing the names and values for the struct's members.
*
* Customer = Struct.new(:name, :address, :zip)
* joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
@@ -610,7 +694,7 @@ rb_struct_to_h(VALUE s)
long i;
for (i=0; i<RSTRUCT_LEN(s); i++) {
- rb_hash_aset(h, rb_ary_entry(members, i), RSTRUCT_PTR(s)[i]);
+ rb_hash_aset(h, rb_ary_entry(members, i), RSTRUCT_GET(s, i));
}
return h;
}
@@ -619,45 +703,44 @@ rb_struct_to_h(VALUE s)
VALUE
rb_struct_init_copy(VALUE copy, VALUE s)
{
+ long i, len;
+
if (!OBJ_INIT_COPY(copy, s)) return copy;
if (RSTRUCT_LEN(copy) != RSTRUCT_LEN(s)) {
rb_raise(rb_eTypeError, "struct size mismatch");
}
- MEMCPY(RSTRUCT_PTR(copy), RSTRUCT_PTR(s), VALUE, RSTRUCT_LEN(copy));
+
+ for (i=0, len=RSTRUCT_LEN(copy); i<len; i++) {
+ RSTRUCT_SET(copy, i, RSTRUCT_GET(s, i));
+ }
return copy;
}
static VALUE
-rb_struct_aref_id(VALUE s, ID id)
+rb_struct_aref_sym(VALUE s, VALUE name)
{
- VALUE *ptr, members, *ptr_members;
- long i, len;
+ VALUE members = rb_struct_members(s);
+ long i, len = RARRAY_LEN(members);
- ptr = RSTRUCT_PTR(s);
- members = rb_struct_members(s);
- ptr_members = RARRAY_PTR(members);
- len = RARRAY_LEN(members);
for (i=0; i<len; i++) {
- if (SYM2ID(ptr_members[i]) == id) {
- return ptr[i];
+ if (RARRAY_AREF(members, i) == name) {
+ return RSTRUCT_GET(s, i);
}
}
- rb_name_error(id, "no member '%s' in struct", rb_id2name(id));
+ rb_name_error_str(name, "no member '% "PRIsVALUE"' in struct", name);
UNREACHABLE;
}
/*
* call-seq:
- * struct[symbol] -> anObject
- * struct[fixnum] -> anObject
+ * struct[member] -> anObject
+ * struct[index] -> anObject
*
- * Attribute Reference---Returns the value of the instance variable
- * named by <i>symbol</i>, or indexed (0..length-1) by
- * <i>fixnum</i>. Will raise <code>NameError</code> if the named
- * variable does not exist, or <code>IndexError</code> if the index is
- * out of range.
+ * Attribute Reference---Returns the value of the given struct +member+ or
+ * the member at the given +index+. Raises NameError if the +member+ does
+ * not exist and IndexError if the +index+ is out of range.
*
* Customer = Struct.new(:name, :address, :zip)
* joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
@@ -672,8 +755,16 @@ rb_struct_aref(VALUE s, VALUE idx)
{
long i;
- if (RB_TYPE_P(idx, T_STRING) || RB_TYPE_P(idx, T_SYMBOL)) {
- return rb_struct_aref_id(s, rb_to_id(idx));
+ if (RB_TYPE_P(idx, T_SYMBOL)) {
+ return rb_struct_aref_sym(s, 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_sym(s, ID2SYM(id));
}
i = NUM2LONG(idx);
@@ -684,45 +775,40 @@ rb_struct_aref(VALUE s, VALUE idx)
if (RSTRUCT_LEN(s) <= i)
rb_raise(rb_eIndexError, "offset %ld too large for struct(size:%ld)",
i, RSTRUCT_LEN(s));
- return RSTRUCT_PTR(s)[i];
+ return RSTRUCT_GET(s, i);
}
static VALUE
-rb_struct_aset_id(VALUE s, ID id, VALUE val)
+rb_struct_aset_sym(VALUE s, VALUE name, VALUE val)
{
- VALUE members, *ptr, *ptr_members;
- long i, len;
+ VALUE members = rb_struct_members(s);
+ long i, len = RARRAY_LEN(members);
- members = rb_struct_members(s);
- len = RARRAY_LEN(members);
- rb_struct_modify(s);
if (RSTRUCT_LEN(s) != len) {
rb_raise(rb_eTypeError, "struct size differs (%ld required %ld given)",
len, RSTRUCT_LEN(s));
}
- ptr = RSTRUCT_PTR(s);
- ptr_members = RARRAY_PTR(members);
+
for (i=0; i<len; i++) {
- if (SYM2ID(ptr_members[i]) == id) {
- ptr[i] = val;
+ if (RARRAY_AREF(members, i) == name) {
+ rb_struct_modify(s);
+ RSTRUCT_SET(s, i, val);
return val;
}
}
- rb_name_error(id, "no member '%s' in struct", rb_id2name(id));
+ rb_name_error_str(name, "no member '% "PRIsVALUE"' in struct", name);
UNREACHABLE;
}
/*
* call-seq:
- * struct[symbol] = obj -> obj
- * struct[fixnum] = obj -> obj
+ * struct[name] = obj -> obj
+ * struct[index] = obj -> obj
*
- * Attribute Assignment---Assigns to the instance variable named by
- * <i>symbol</i> or <i>fixnum</i> the value <i>obj</i> and
- * returns it. Will raise a <code>NameError</code> if the named
- * variable does not exist, or an <code>IndexError</code> if the index
- * is out of range.
+ * Attribute Assignment---Sets the value of the given struct +member+ or
+ * 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)
* joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
@@ -739,8 +825,16 @@ rb_struct_aset(VALUE s, VALUE idx, VALUE val)
{
long i;
- if (RB_TYPE_P(idx, T_STRING) || RB_TYPE_P(idx, T_SYMBOL)) {
- return rb_struct_aset_id(s, rb_to_id(idx), val);
+ if (RB_TYPE_P(idx, T_SYMBOL)) {
+ return rb_struct_aset_sym(s, 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_sym(s, ID2SYM(id), val);
}
i = NUM2LONG(idx);
@@ -754,7 +848,8 @@ rb_struct_aset(VALUE s, VALUE idx, VALUE val)
i, RSTRUCT_LEN(s));
}
rb_struct_modify(s);
- return RSTRUCT_PTR(s)[i] = val;
+ RSTRUCT_SET(s, i, val);
+ return val;
}
static VALUE
@@ -764,19 +859,17 @@ struct_entry(VALUE s, long n)
}
/*
- * call-seq:
- * struct.values_at(selector,... ) -> an_array
- *
- * Returns an array containing the elements in
- * +self+ corresponding to the given selector(s). The selectors
- * may be either integer indices or ranges.
- * See also </code>.select<code>.
- *
- * a = %w{ a b c d e f }
- * a.values_at(1, 3, 5)
- * a.values_at(1, 3, 5, 7)
- * a.values_at(-1, -3, -5, -7)
- * a.values_at(1..3, 2...5)
+ * call-seq:
+ * struct.values_at(selector, ...) -> an_array
+ *
+ * Returns the struct member values for each +selector+ as an Array. A
+ * +selector+ may be either an Integer offset or a Range of offsets (as in
+ * Array#values_at).
+ *
+ * Customer = Struct.new(:name, :address, :zip)
+ * joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
+ * joe.values_at 0, 2 #=> ["Joe Smith", 12345]
+ *
*/
static VALUE
@@ -790,10 +883,9 @@ rb_struct_values_at(int argc, VALUE *argv, VALUE s)
* struct.select {|i| block } -> array
* struct.select -> an_enumerator
*
- * Invokes the block passing in successive elements from
- * <i>struct</i>, returning an array containing those elements
- * for which the block returns a true value (equivalent to
- * <code>Enumerable#select</code>).
+ * Yields each member value from the struct to the block and returns an Array
+ * containing the member values from the +struct+ for which the given block
+ * returns a true value (equivalent to Enumerable#select).
*
* Lots = Struct.new(:a, :b, :c, :d, :e, :f)
* l = Lots.new(11, 22, 33, 44, 55, 66)
@@ -807,11 +899,11 @@ rb_struct_select(int argc, VALUE *argv, VALUE s)
long i;
rb_check_arity(argc, 0, 0);
- RETURN_SIZED_ENUMERATOR(s, 0, 0, rb_struct_size);
+ RETURN_SIZED_ENUMERATOR(s, 0, 0, struct_enum_size);
result = rb_ary_new();
for (i = 0; i < RSTRUCT_LEN(s); i++) {
- if (RTEST(rb_yield(RSTRUCT_PTR(s)[i]))) {
- rb_ary_push(result, RSTRUCT_PTR(s)[i]);
+ if (RTEST(rb_yield(RSTRUCT_GET(s, i)))) {
+ rb_ary_push(result, RSTRUCT_GET(s, i));
}
}
@@ -821,12 +913,12 @@ rb_struct_select(int argc, VALUE *argv, VALUE s)
static VALUE
recursive_equal(VALUE s, VALUE s2, int recur)
{
- VALUE *ptr, *ptr2;
+ const VALUE *ptr, *ptr2;
long i, len;
if (recur) return Qtrue; /* Subtle! */
- ptr = RSTRUCT_PTR(s);
- ptr2 = RSTRUCT_PTR(s2);
+ ptr = RSTRUCT_CONST_PTR(s);
+ ptr2 = RSTRUCT_CONST_PTR(s2);
len = RSTRUCT_LEN(s);
for (i=0; i<len; i++) {
if (!rb_equal(ptr[i], ptr2[i])) return Qfalse;
@@ -836,12 +928,10 @@ recursive_equal(VALUE s, VALUE s2, int recur)
/*
* call-seq:
- * struct == other_struct -> true or false
+ * struct == other -> true or false
*
- * Equality---Returns <code>true</code> if <i>other_struct</i> is
- * equal to this one: they must be of the same class as generated by
- * <code>Struct::new</code>, and the values of all instance variables
- * must be equal (according to <code>Object#==</code>).
+ * Equality---Returns +true+ if +other+ has the same struct subclass and has
+ * equal member values (according to Object#==).
*
* Customer = Struct.new(:name, :address, :zip)
* joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
@@ -864,48 +954,43 @@ rb_struct_equal(VALUE s, VALUE s2)
return rb_exec_recursive_paired(recursive_equal, s, s2, s2);
}
-static VALUE
-recursive_hash(VALUE s, VALUE dummy, int recur)
-{
- long i, len;
- st_index_t h;
- VALUE n, *ptr;
-
- h = rb_hash_start(rb_hash(rb_obj_class(s)));
- if (!recur) {
- ptr = RSTRUCT_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
*
- * Return a hash value based on this struct's contents.
+ * Returns a hash value based on this struct's contents (see Object#hash).
+ *
+ * See also Object#hash.
*/
static VALUE
rb_struct_hash(VALUE s)
{
- return rb_exec_recursive_outer(recursive_hash, s, 0);
+ long i, len;
+ st_index_t h;
+ VALUE n;
+ 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));
+ }
+ h = rb_hash_end(h);
+ return INT2FIX(h);
}
static VALUE
recursive_eql(VALUE s, VALUE s2, int recur)
{
- VALUE *ptr, *ptr2;
+ const VALUE *ptr, *ptr2;
long i, len;
if (recur) return Qtrue; /* Subtle! */
- ptr = RSTRUCT_PTR(s);
- ptr2 = RSTRUCT_PTR(s2);
+ ptr = RSTRUCT_CONST_PTR(s);
+ ptr2 = RSTRUCT_CONST_PTR(s2);
len = RSTRUCT_LEN(s);
for (i=0; i<len; i++) {
if (!rb_eql(ptr[i], ptr2[i])) return Qfalse;
@@ -917,8 +1002,9 @@ recursive_eql(VALUE s, VALUE s2, int recur)
* call-seq:
* struct.eql?(other) -> true or false
*
- * Two structures are equal if they are the same object, or if all their
- * fields are equal (using <code>eql?</code>).
+ * Hash equality---+other+ and +struct+ refer to the same hash key if they
+ * have the same struct subclass and have equal member values (according to
+ * Object#eql?).
*/
static VALUE
@@ -939,7 +1025,7 @@ rb_struct_eql(VALUE s, VALUE s2)
* struct.length -> fixnum
* struct.size -> fixnum
*
- * Returns the number of instance variables.
+ * Returns the number of struct members.
*
* Customer = Struct.new(:name, :address, :zip)
* joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
@@ -953,22 +1039,32 @@ rb_struct_size(VALUE s)
}
/*
- * A <code>Struct</code> is a convenient way to bundle a number of
- * attributes together, using accessor methods, without having to write
- * an explicit class.
- *
- * The <code>Struct</code> class is a generator of specific classes,
- * each one of which is defined to hold a set of variables and their
- * accessors. In these examples, we'll call the generated class
- * ``<i>Customer</i>Class,'' and we'll show an example instance of that
- * class as ``<i>Customer</i>Inst.''
- *
- * In the descriptions that follow, the parameter <i>symbol</i> refers
- * to a symbol, which is either a quoted string or a
- * <code>Symbol</code> (such as <code>:name</code>).
+ * A Struct is a convenient way to bundle a number of attributes together,
+ * using accessor methods, without having to write an explicit class.
+ *
+ * The Struct class generates new subclasses that hold a set of members and
+ * their values. For each member a reader and writer method is created
+ * similar to Module#attr_accessor.
+ *
+ * Customer = Struct.new(:name, :address) do
+ * def greeting
+ * "Hello #{name}!"
+ * end
+ * end
+ *
+ * dave = Customer.new("Dave", "123 Main")
+ * dave.name #=> "Dave"
+ * dave.greeting #=> "Hello Dave!"
+ *
+ * See Struct::new for further examples of creating struct subclasses and
+ * instances.
+ *
+ * In the method descriptions that follow a "member" parameter refers to a
+ * struct member which is either a quoted string (<code>"name"</code>) or a
+ * Symbol (<code>:name</code>).
*/
void
-Init_Struct(void)
+InitVM_Struct(void)
{
rb_cStruct = rb_define_class("Struct", rb_cObject);
rb_include_module(rb_cStruct, rb_mEnumerable);
@@ -999,5 +1095,13 @@ Init_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);
+}
+
+#undef rb_intern
+void
+Init_Struct(void)
+{
id_members = rb_intern("__members__");
+
+ InitVM(Struct);
}
diff --git a/symbian/README.SYMBIAN b/symbian/README.SYMBIAN
deleted file mode 100644
index 5b500e3234..0000000000
--- a/symbian/README.SYMBIAN
+++ /dev/null
@@ -1,93 +0,0 @@
-=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
deleted file mode 100644
index 58a83a35fc..0000000000
--- a/symbian/configure.bat
+++ /dev/null
@@ -1,123 +0,0 @@
-@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
deleted file mode 100644
index f8d7a85039..0000000000
--- a/symbian/missing-aeabi.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#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
deleted file mode 100644
index c5649fb45a..0000000000
--- a/symbian/missing-pips.c
+++ /dev/null
@@ -1,65 +0,0 @@
-#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
deleted file mode 100644
index e118f793e0..0000000000
--- a/symbian/pre-build
+++ /dev/null
@@ -1,83 +0,0 @@
-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
deleted file mode 100644
index 74ff21c16a..0000000000
--- a/symbian/setup
+++ /dev/null
@@ -1,440 +0,0 @@
-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
new file mode 100644
index 0000000000..9cb2fe478e
--- /dev/null
+++ b/symbol.c
@@ -0,0 +1,1156 @@
+/**********************************************************************
+
+ symbol.h -
+
+ $Author$
+ created at: Tue Jul 8 15:49:54 JST 2014
+
+ Copyright (C) 2014 Yukihiro Matsumoto
+
+**********************************************************************/
+
+#include "ruby/ruby.h"
+#include "ruby/st.h"
+#include "ruby/encoding.h"
+#include "internal.h"
+#include "node.h"
+#include "symbol.h"
+#include "gc.h"
+#include "probes.h"
+
+#define SYMBOL_PINNED FL_USER1
+#define SYMBOL_PINNED_P(sym) FL_TEST((sym), SYMBOL_PINNED)
+
+#define ID_DYNAMIC_SYM_P(id) (!(id&ID_STATIC_SYM)&&id>tLAST_OP_ID)
+#define STATIC_SYM2ID(sym) RSHIFT((unsigned long)(sym), RUBY_SPECIAL_SHIFT)
+#define STATIC_ID2SYM(id) (((VALUE)(id)<<RUBY_SPECIAL_SHIFT)|SYMBOL_FLAG)
+
+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 tUPLUS RUBY_TOKEN(UPLUS)
+#define tUMINUS RUBY_TOKEN(UMINUS)
+#define tPOW RUBY_TOKEN(POW)
+#define tCMP RUBY_TOKEN(CMP)
+#define tEQ RUBY_TOKEN(EQ)
+#define tEQQ RUBY_TOKEN(EQQ)
+#define tNEQ RUBY_TOKEN(NEQ)
+#define tGEQ RUBY_TOKEN(GEQ)
+#define tLEQ RUBY_TOKEN(LEQ)
+#define tMATCH RUBY_TOKEN(MATCH)
+#define tNMATCH RUBY_TOKEN(NMATCH)
+#define tDOT2 RUBY_TOKEN(DOT2)
+#define tDOT3 RUBY_TOKEN(DOT3)
+#define tAREF RUBY_TOKEN(AREF)
+#define tASET RUBY_TOKEN(ASET)
+#define tLSHFT RUBY_TOKEN(LSHFT)
+#define tRSHFT RUBY_TOKEN(RSHFT)
+
+static const struct {
+ unsigned short token;
+ const char name[3], term;
+} op_tbl[] = {
+ {tDOT2, ".."},
+ {tDOT3, "..."},
+ {tPOW, "**"},
+ {tUPLUS, "+@"},
+ {tUMINUS, "-@"},
+ {tCMP, "<=>"},
+ {tGEQ, ">="},
+ {tLEQ, "<="},
+ {tEQ, "=="},
+ {tEQQ, "==="},
+ {tNEQ, "!="},
+ {tMATCH, "=~"},
+ {tNMATCH, "!~"},
+ {tAREF, "[]"},
+ {tASET, "[]="},
+ {tLSHFT, "<<"},
+ {tRSHFT, ">>"},
+};
+
+#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 struct symbols {
+ ID last_id;
+ st_table *str_id;
+ st_table *id_str;
+ 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_hash_new();
+ global_symbols.dsymbol_fstr_hash = dsym_fstrs;
+ rb_gc_register_mark_object(dsym_fstrs);
+ rb_obj_hide(dsym_fstrs);
+
+ global_symbols.str_id = st_init_table_with_size(&symhash, 1000);
+ global_symbols.id_str = st_init_numtable_with_size(1000);
+
+ Init_id();
+}
+
+WARN_UNUSED_RESULT(static VALUE dsymbol_alloc(const VALUE klass, const VALUE str, rb_encoding *const enc));
+WARN_UNUSED_RESULT(static VALUE dsymbol_check(const VALUE sym));
+WARN_UNUSED_RESULT(static ID dsymbol_pindown(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));
+
+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 :%"PRIsVALUE" attrset",
+ rb_id2str(id));
+ }
+ else {
+ int 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:
+ {
+ VALUE str;
+ 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);
+ }
+ }
+ }
+ }
+ if (id&ID_STATIC_SYM) {
+ id &= ~ID_SCOPE_MASK;
+ id |= ID_ATTRSET;
+ }
+ else {
+ VALUE str;
+
+ /* make new dynamic symbol */
+ str = rb_str_dup(RSYMBOL((VALUE)id)->fstr);
+ rb_str_cat(str, "=", 1);
+ id = SYM2ID(rb_str_dynamic_intern(str));
+ }
+ 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 != ']') 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;
+ 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
+register_symid_direct(VALUE str, ID id)
+{
+ st_add_direct(global_symbols.str_id, (st_data_t)str, (st_data_t)id);
+ st_add_direct(global_symbols.id_str, (st_data_t)id, (st_data_t)str);
+}
+
+static int
+unregister_sym_str(VALUE str)
+{
+ st_data_t str_data = (st_data_t)str;
+ return st_delete(global_symbols.str_id, &str_data, NULL);
+}
+
+static int
+unregister_sym_id(VALUE sym)
+{
+ st_data_t sym_data = (st_data_t)sym;
+ return st_delete(global_symbols.id_str, &sym_data, NULL);
+}
+
+static void
+unregister_sym(VALUE str, VALUE sym)
+{
+ if (!unregister_sym_str(str)) {
+ rb_bug("%p can't remove str from str_id (%s)", (void *)sym, RSTRING_PTR(str));
+ }
+ if (!unregister_sym_id(sym)) {
+ rb_bug("%p can't remove sym from id_str (%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)
+{
+ OBJ_FREEZE(str);
+ str = rb_fstring(str);
+
+ if (RUBY_DTRACE_SYMBOL_CREATE_ENABLED()) {
+ RUBY_DTRACE_SYMBOL_CREATE(RSTRING_PTR(str), rb_sourcefile(), rb_sourceline());
+ }
+
+ register_symid_direct(str, id);
+ rb_gc_register_mark_object(str);
+
+ 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 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));
+ }
+ }
+}
+
+static VALUE
+dsymbol_alloc(const VALUE klass, const VALUE str, rb_encoding * const enc)
+{
+ const VALUE dsym = rb_newobj_of(klass, T_SYMBOL | FL_WB_PROTECTED);
+ const ID type = rb_str_symname_type(str, IDSET_ATTRSET_FOR_INTERN);
+
+ rb_enc_associate(dsym, enc);
+ OBJ_FREEZE(dsym);
+ RB_OBJ_WRITE(dsym, &RSYMBOL(dsym)->fstr, str);
+ RSYMBOL(dsym)->type = type;
+
+ register_symid_direct(str, (ID)dsym);
+ rb_hash_aset(global_symbols.dsymbol_fstr_hash, str, Qtrue);
+
+ if (RUBY_DTRACE_SYMBOL_CREATE_ENABLED()) {
+ RUBY_DTRACE_SYMBOL_CREATE(RSTRING_PTR(RSYMBOL(dsym)->fstr), rb_sourcefile(), rb_sourceline());
+ }
+
+ return dsym;
+}
+
+static inline VALUE
+dsymbol_check(const VALUE sym)
+{
+ if (UNLIKELY(rb_objspace_garbage_object_p(sym))) {
+ const VALUE fstr = RSYMBOL(sym)->fstr;
+ RSYMBOL(sym)->fstr = 0;
+
+ unregister_sym(fstr, sym);
+ return dsymbol_alloc(rb_cSymbol, fstr, rb_enc_get(fstr));
+ }
+ else {
+ return sym;
+ }
+}
+
+static ID
+dsymbol_pindown(VALUE sym)
+{
+ must_be_dynamic_symbol(sym);
+
+ if (UNLIKELY(SYMBOL_PINNED_P(sym) == 0)) {
+ VALUE fstr = RSYMBOL(sym)->fstr;
+ sym = dsymbol_check(sym);
+ FL_SET(sym, SYMBOL_PINNED);
+
+ /* make it permanent object */
+ rb_gc_register_mark_object(sym);
+ rb_gc_register_mark_object(fstr);
+ rb_hash_delete(global_symbols.dsymbol_fstr_hash, fstr);
+ }
+
+ return (ID)sym;
+}
+
+static ID
+lookup_str_id(VALUE str)
+{
+ st_data_t id_data;
+ if (st_lookup(global_symbols.str_id, (st_data_t)str, &id_data)) {
+ const ID id = (ID)id_data;
+
+ if (!ID_DYNAMIC_SYM_P(id) || SYMBOL_PINNED_P(id)) {
+ return id;
+ }
+ }
+ return (ID)0;
+}
+
+static VALUE
+lookup_str_sym(const VALUE str)
+{
+ st_data_t sym_data;
+ if (st_lookup(global_symbols.str_id, (st_data_t)str, &sym_data)) {
+ const ID id = (ID)sym_data;
+
+ if (ID_DYNAMIC_SYM_P(id)) {
+ return dsymbol_check(id);
+ }
+ else {
+ return STATIC_ID2SYM(id);
+ }
+ }
+ else {
+ return (VALUE)0;
+ }
+}
+
+static VALUE
+lookup_id_str(ID id)
+{
+ st_data_t data;
+ if (ID_DYNAMIC_SYM_P(id)) {
+ return RSYMBOL(id)->fstr;
+ }
+ if (st_lookup(global_symbols.id_str, id, &data)) {
+ return (VALUE)data;
+ }
+ return 0;
+}
+
+ID
+rb_intern_cstr_without_pindown(const char *name, long len, rb_encoding *enc)
+{
+ st_data_t id;
+ struct RString fake_str;
+ VALUE str = rb_setup_fake_str(&fake_str, name, len, enc);
+ OBJ_FREEZE(str);
+
+ if (st_lookup(global_symbols.str_id, str, &id)) {
+ if (ID_DYNAMIC_SYM_P((ID)id)) {
+ return (ID)dsymbol_check((VALUE)id);
+ }
+ return (ID)id;
+ }
+
+ str = rb_enc_str_new(name, len, enc); /* make true string */
+ return intern_str(str);
+}
+
+ID
+rb_intern3(const char *name, long len, rb_encoding *enc)
+{
+ ID id;
+
+ id = rb_intern_cstr_without_pindown(name, len, enc);
+ if (ID_DYNAMIC_SYM_P(id)) {
+ id = dsymbol_pindown((VALUE)id);
+ }
+
+ return id;
+}
+
+static ID
+next_id_base(void)
+{
+ if (global_symbols.last_id >= ~(ID)0 >> (ID_SCOPE_SHIFT+RUBY_SPECIAL_SHIFT)) {
+ return (ID)-1;
+ }
+ ++global_symbols.last_id;
+ return global_symbols.last_id << ID_SCOPE_SHIFT;
+}
+
+static ID
+next_id(VALUE str)
+{
+ const char *name, *m, *e;
+ long len, last;
+ rb_encoding *enc, *symenc;
+ unsigned char c;
+ ID id;
+ ID nid;
+ 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;
+ return id;
+ }
+ 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;
+ return id;
+ }
+ }
+ }
+ 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);
+ return id;
+ }
+ 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 ((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 id;
+}
+
+static ID
+intern_str(VALUE str)
+{
+ ID id = next_id(str);
+ if (ID_DYNAMIC_SYM_P(id) && is_attrset_id(id)) return id;
+ 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(rb_str_dup(str));
+}
+
+void
+rb_gc_free_dsymbol(VALUE sym)
+{
+ VALUE str = RSYMBOL(sym)->fstr;
+
+ if (str) {
+ RSYMBOL(sym)->fstr = 0;
+ unregister_sym(str, sym);
+ }
+}
+
+/*
+ * 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_dynamic_intern(VALUE str)
+{
+#if USE_SYMBOL_GC
+ rb_encoding *enc, *ascii;
+ VALUE sym = lookup_str_sym(str);
+
+ if (sym) {
+ return sym;
+ }
+
+ enc = rb_enc_get(str);
+ ascii = rb_usascii_encoding();
+ if (enc != ascii) {
+ if (sym_check_asciionly(str)) {
+ str = rb_str_dup(str);
+ rb_enc_associate(str, ascii);
+ OBJ_FREEZE(str);
+ enc = ascii;
+ }
+ }
+
+ return dsymbol_alloc(rb_cSymbol, rb_fstring(str), enc);
+#else
+ return rb_str_intern(str);
+#endif
+}
+
+ID
+rb_sym2id(VALUE sym)
+{
+ if (STATIC_SYM_P(sym)) {
+ return STATIC_SYM2ID(sym);
+ }
+ else {
+ if (!SYMBOL_PINNED_P(sym)) {
+ return dsymbol_pindown(sym);
+ }
+ return (ID)sym;
+ }
+}
+
+VALUE
+rb_id2sym(ID x)
+{
+ if (!ID_DYNAMIC_SYM_P(x)) {
+ return STATIC_ID2SYM(x);
+ }
+ else {
+ return (VALUE)x;
+ }
+}
+
+
+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 (id < tLAST_OP_ID) {
+ int i = 0;
+
+ if (id < INT_MAX && rb_ispunct((int)id)) {
+ char name[1];
+ name[0] = (char)id;
+ return rb_fstring_new(name, 1);
+ }
+ for (i = 0; i < op_tbl_count; i++) {
+ if (op_tbl[i].token == id) {
+ const char *name = op_tbl[i].name;
+ return rb_fstring_new(name, op_tbl_len(i));
+ }
+ }
+ }
+
+ if ((str = lookup_id_str(id)) != 0) {
+ 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) | ID_STATIC_SYM;
+
+ 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_static_symid_str(id, 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 = ID2SYM((ID)value);
+
+ if (DYNAMIC_SYM_P(sym) && !SYMBOL_PINNED_P(sym) && rb_objspace_garbage_object_p(sym)) {
+ RSYMBOL(sym)->fstr = 0;
+ unregister_sym_id(sym);
+ 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_id->num_entries);
+ st_foreach(global_symbols.str_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)
+{
+ ID id;
+ 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 (ID)name;
+ }
+ 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)) {
+ tmp = rb_inspect(name);
+ rb_raise(rb_eTypeError, "%s is not a symbol nor a string",
+ RSTRING_PTR(tmp));
+ }
+ name = tmp;
+ *namep = name;
+ }
+
+ sym_check_asciionly(name);
+
+ if ((id = lookup_str_id(name)) != 0) {
+ return id;
+ }
+
+ {
+ ID gid = attrsetname_to_attr(name);
+ if (gid) return rb_id_attrset(gid);
+ }
+
+ return (ID)0;
+}
+
+VALUE
+rb_check_symbol(volatile VALUE *namep)
+{
+ VALUE sym;
+ VALUE tmp;
+ VALUE name = *namep;
+
+ if (SYMBOL_P(name)) {
+ return 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 nor a string",
+ RSTRING_PTR(tmp));
+ }
+ name = tmp;
+ *namep = name;
+ }
+
+ sym_check_asciionly(name);
+
+ if ((sym = lookup_str_sym(name)) != 0) {
+ return sym;
+ }
+
+ {
+ ID gid = attrsetname_to_attr(name);
+ if (gid) return ID2SYM(rb_id_attrset(gid));
+ }
+
+ return Qnil;
+}
+
+ID
+rb_check_id_cstr(const char *ptr, long len, rb_encoding *enc)
+{
+ ID id;
+ struct RString fake_str;
+ const VALUE name = rb_setup_fake_str(&fake_str, ptr, len, enc);
+
+ sym_check_asciionly(name);
+
+ if ((id = lookup_str_id(name)) != 0) {
+ return id;
+ }
+
+ if (rb_is_attrset_name(name)) {
+ fake_str.as.heap.len = len - 1;
+ if ((id = lookup_str_id(name)) != 0) {
+ return rb_id_attrset(id);
+ }
+ }
+
+ return (ID)0;
+}
+
+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;
+ }
+
+ if (rb_is_attrset_name(name)) {
+ fake_str.as.heap.len = len - 1;
+ if ((sym = lookup_str_sym(name)) != 0) {
+ return ID2SYM(rb_id_attrset(SYM2ID(sym)));
+ }
+ }
+
+ return Qnil;
+}
+
+static ID
+attrsetname_to_attr(VALUE name)
+{
+ if (rb_is_attrset_name(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;
+}
+
+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;
+}
diff --git a/symbol.h b/symbol.h
new file mode 100644
index 0000000000..36db8ef667
--- /dev/null
+++ b/symbol.h
@@ -0,0 +1,54 @@
+/**********************************************************************
+
+ 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 RSYMBOL(obj) (R_CAST(RSymbol)(obj))
+
+static inline int
+id_type(ID id)
+{
+ if (id<=tLAST_OP_ID) {
+ return -1;
+ }
+ if (id&ID_STATIC_SYM) {
+ return (int)((id)&ID_SCOPE_MASK);
+ }
+ else {
+ VALUE dsym = (VALUE)id;
+ return (int)(RSYMBOL(dsym)->type);
+ }
+}
+
+#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_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)
+
+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 *);
+
+#endif
diff --git a/template/Doxyfile.tmpl b/template/Doxyfile.tmpl
index 6b91e20c1d..2fb7588b02 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
+EXCLUDE = ext/dl/callback ccan
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/GNUmakefile.in b/template/GNUmakefile.in
new file mode 100644
index 0000000000..d9932c0a72
--- /dev/null
+++ b/template/GNUmakefile.in
@@ -0,0 +1,6 @@
+override MFLAGS := $(filter-out -j%,$(MFLAGS))
+include Makefile
+-include uncommon.mk
+include $(srcdir)/defs/gmake.mk
+
+GNUmakefile: $(srcdir)/template/GNUmakefile.in
diff --git a/template/encdb.h.tmpl b/template/encdb.h.tmpl
index 308227e9e9..9cbb1f0083 100644
--- a/template/encdb.h.tmpl
+++ b/template/encdb.h.tmpl
@@ -19,9 +19,14 @@ def check_duplication(defs, name, fn, line)
end
end
-count = 0
lines = []
-encodings = []
+BUILTIN_ENCODINGS = {
+ 'ASCII-8BIT' => 0,
+ 'UTF-8' => 1,
+ 'US-ASCII' => 2,
+}
+encodings = %w[ASCII-8BIT UTF-8 US-ASCII] # BUILTIN_ENCODINGS.keys is not available on cross compiling and used ruby 1.8
+count = encodings.size
defs = {}
encdirs = ARGV.dup
encdirs << 'enc' if encdirs.empty?
@@ -44,6 +49,7 @@ encdirs.each do |encdir|
name = $1
end
check_duplication(defs, $1, fn, $.)
+ next if BUILTIN_ENCODINGS[name]
encodings << $1
count += 1
end
@@ -52,6 +58,7 @@ encdirs.each do |encdir|
when /^\s*rb_enc_register\(\s*"([^"]+)"/
count += 1
line = nil
+ encodings << $1
when /^ENC_REPLICATE\(\s*"([^"]+)"\s*,\s*"([^"]+)"/
raise ArgumentError,
'%s:%d: ENC_REPLICATE: %s is not defined yet. (replica %s)' %
@@ -73,9 +80,10 @@ encdirs.each do |encdir|
end
end
end
-encodings.each do |e|
+encodings.each_with_index do |e, i|
%>ENC_DEFINE("<%=e%>");
% end
+% encidx = encodings.size - 1
% lines.each do |line|
<%=line%>
% end
diff --git a/template/fake.rb.in b/template/fake.rb.in
index c94eec3516..8b4e6e5aa3 100644
--- a/template/fake.rb.in
+++ b/template/fake.rb.in
@@ -10,38 +10,15 @@ class Object
CROSS_COMPILING = RUBY_PLATFORM
remove_const :RUBY_PLATFORM
remove_const :RUBY_VERSION
+ remove_const :RUBY_RELEASE_DATE
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}]"
+ RUBY_RELEASE_DATE = "@RUBY_RELEASE_DATE@"
+ 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
-trace_var(:$extmk, prehook)
+builddir = File.dirname(__FILE__)
+top_srcdir = "@abs_top_srcdir@"
+$:.unshift(File.expand_path(builddir))
+fake = File.join(top_srcdir, "tool/fake.rb")
+eval(File.read(fake), nil, fake)
diff --git a/template/id.h.tmpl b/template/id.h.tmpl
index c993243424..d7e10e9330 100644
--- a/template/id.h.tmpl
+++ b/template/id.h.tmpl
@@ -28,16 +28,31 @@ types = ids.keys.grep(/^[A-Z]/)
#ifndef RUBY_ID_H
#define RUBY_ID_H
-#define ID_SCOPE_SHIFT 3
-#define ID_SCOPE_MASK 0x07
-#define ID_LOCAL 0x00
-#define ID_INSTANCE 0x01
-#define ID_GLOBAL 0x03
-#define ID_ATTRSET 0x04
-#define ID_CONST 0x05
-#define ID_CLASS 0x06
-#define ID_JUNK 0x07
-#define ID_INTERNAL ID_JUNK
+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_INTERNAL = RUBY_ID_JUNK,
+ RUBY_ID_SCOPE_SHIFT = 4,
+ RUBY_ID_SCOPE_MASK = (~(~0U<<(RUBY_ID_SCOPE_SHIFT-1))<<1)
+};
+
+#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
+#define ID_INSTANCE RUBY_ID_INSTANCE
+#define ID_GLOBAL RUBY_ID_GLOBAL
+#define ID_ATTRSET RUBY_ID_ATTRSET
+#define ID_CONST RUBY_ID_CONST
+#define ID_CLASS RUBY_ID_CLASS
+#define ID_JUNK RUBY_ID_JUNK
+#define ID_INTERNAL RUBY_ID_INTERNAL
#define ID2ATTRSET(id) (((id)&~ID_SCOPE_MASK)|ID_ATTRSET)
@@ -83,10 +98,11 @@ 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%>)
+#define TOKEN2<%=type%>ID(n) id##n = ((t##n<<ID_SCOPE_SHIFT)|ID_<%=type%>|ID_STATIC_SYM)
% types.each do |token|
TOKEN2<%=type%>ID(<%=token%>),
% end
diff --git a/template/opt_sc.inc.tmpl b/template/opt_sc.inc.tmpl
index 7d7ce717dc..41492b2bb6 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 rb/insns2vm.rb
+ or tool/insns2vm.rb
*/
#define SC_STATE_SIZE 6
diff --git a/template/optinsn.inc.tmpl b/template/optinsn.inc.tmpl
index b4b4b6b05a..3c4f732290 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 rb/insns2vm.rb
+ or tool/insns2vm.rb
*/
static INSN *
diff --git a/template/optunifs.inc.tmpl b/template/optunifs.inc.tmpl
index 61364a3bd4..af313a9b45 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 rb/insns2vm.rb
+ or tool/insns2vm.rb
*/
/*
diff --git a/template/ruby.pc.in b/template/ruby.pc.in
index 65a3f79857..8a2c066e9c 100644
--- a/template/ruby.pc.in
+++ b/template/ruby.pc.in
@@ -15,15 +15,6 @@ RUBY_VERSION_NAME=@RUBY_VERSION_NAME@
RUBY_SO_NAME=@RUBY_SO_NAME@
RUBY_INSTALL_NAME=@RUBY_INSTALL_NAME@
DEFFILE=@DEFFILE@
-LIBPATH=@LIBPATH@
-LIBRUBY_A=@LIBRUBY_A@
-LIBRUBY_SO=@LIBRUBY_SO@
-LIBRUBY=@LIBRUBY@
-LIBRUBYARG_SHARED=@LIBRUBYARG_SHARED@
-LIBRUBYARG_STATIC=@LIBRUBYARG_STATIC@
-LIBRUBYARG=@LIBRUBYARG@
-LIBS=@LIBS@
-DLDFLAGS=@DLDFLAGS@
archlibdir=@archlibdir@
sitearchlibdir=@sitearchlibdir@
archincludedir=@archincludedir@
@@ -43,11 +34,23 @@ sitearchdir=@sitearchdir@
rubyhdrdir=@rubyhdrdir@
vendorhdrdir=@vendorhdrdir@
sitehdrdir=@sitehdrdir@
+rubyarchhdrdir=@rubyarchhdrdir@
+vendorarchhdrdir=@vendorarchhdrdir@
+sitearchhdrdir=@sitearchhdrdir@
+LIBPATH=@LIBPATH@
+LIBRUBY_A=@LIBRUBY_A@
+LIBRUBY_SO=@LIBRUBY_SO@
+LIBRUBY=@LIBRUBY@
+LIBRUBYARG_SHARED=@LIBRUBYARG_SHARED@
+LIBRUBYARG_STATIC=@LIBRUBYARG_STATIC@
+LIBRUBYARG=@LIBRUBYARG@
+LIBS=@LIBS@
+DLDFLAGS=@DLDFLAGS@
Name: Ruby
Description: Object Oriented Script Language
Version: ${ruby_version}
URL: http://www.ruby-lang.org
-Cflags: -I${rubyhdrdir}/${arch} -I${rubyhdrdir}
+Cflags: -I${rubyarchhdrdir} -I${rubyhdrdir}
Libs: ${DLDFLAGS} ${LIBRUBYARG_SHARED} ${LIBS}
Requires:
diff --git a/template/sizes.c.tmpl b/template/sizes.c.tmpl
new file mode 100644
index 0000000000..ac9964dd5b
--- /dev/null
+++ b/template/sizes.c.tmpl
@@ -0,0 +1,30 @@
+%# -*- c -*-
+#include "ruby/ruby.h"
+<%
+class String
+ def tr_cpp
+ strip.upcase.tr_s("^A-Z0-9_*", "_").tr_s("*", "P")
+ end
+end
+types = ARGF.grep(/^\s*RUBY_CHECK_SIZEOF\((\w[^\[\],#]*)[^#]*\)/) {$1}
+conditions = {
+ "long long" => 'defined(HAVE_TRUE_LONG_LONG)',
+}
+%>
+void
+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));
+
+% types.each do |type|
+% cond = conditions[type]
+#if SIZEOF_<%= type.tr_cpp %> != 0<%= " && #{cond}" if cond %>
+ DEFINE(<%= type %>, <%= type.tr_cpp %>);
+#endif
+% end
+
+#undef DEFINE
+}
diff --git a/template/verconf.h.tmpl b/template/verconf.h.tmpl
new file mode 100644
index 0000000000..79c003e09f
--- /dev/null
+++ b/template/verconf.h.tmpl
@@ -0,0 +1,61 @@
+% 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
+% if C["RUBY_LIB_VERSION_STYLE"]
+#define RUBY_LIB_VERSION_STYLE ${RUBY_LIB_VERSION_STYLE}
+% elsif !C["RUBY_LIB_VERSION"]
+#define RUBY_LIB_VERSION_STYLE 3 /* full */
+% else
+#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}"
+% unless (sitearch = C["sitearch"]) == '$(arch)'
+#define RUBY_SITEARCH "<%=sitearch%>"
+% end
+#define RUBY_ARCH_PREFIX_FOR(arch) "${rubyarchprefix}"
+#define RUBY_SITEARCH_PREFIX_FOR(arch) "${rubysitearchprefix}"
+#define RUBY_LIB "${rubylibdir}"
+#define RUBY_ARCH_LIB_FOR(arch) "${rubyarchdir}"
+% if C["sitedir"] == "no"
+#define NO_RUBY_SITE_LIB 1
+% else
+#define RUBY_SITE_LIB "${sitedir}"
+#define RUBY_SITE_ARCH_LIB_FOR(arch) "${sitearchdir}"
+% end
+% if C["vendordir"] == "no"
+#define NO_RUBY_VENDOR_LIB 1
+% else
+#define RUBY_VENDOR_LIB "${vendordir}"
+#define RUBY_VENDOR_ARCH_LIB_FOR(arch) "${vendorarchdir}"
+% end
+% if C["RUBY_SEARCH_PATH"]
+#define RUBY_SEARCH_PATH "${RUBY_SEARCH_PATH}"
+% end
+%
+% R = {}
+% R["ruby_version"] = '"RUBY_LIB_VERSION"'
+% R["arch"] = '"arch"'
+% R["sitearch"] = '"arch"'
+% R["vendorlibdir"] = '"RUBY_VENDOR_LIB2"'
+% R["sitelibdir"] = '"RUBY_SITE_LIB2"'
+% R["vendordir"] = '"RUBY_VENDOR_LIB"'
+% R["sitedir"] = '"RUBY_SITE_LIB"'
+% R["rubylibdir"] = '"RUBY_LIB"'
+% R["rubylibprefix"] = '"RUBY_LIB_PREFIX"'
+% R["rubyarchprefix"] = '"RUBY_ARCH_PREFIX_FOR(arch)"'
+% 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)/
+% _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)
+% 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 c21b3a83eb..11c6d1bcf5 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.c'
+ If you want to fix something, you must edit 'insns.def'
*/
<%=
diff --git a/template/yarvarch.ja b/template/yarvarch.ja
index bb90f0c0d2..2739ec6b14 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 からみると reciever)です。こ
+あること、具体的にはブロックとself(callee からみると receiver)です。こ
の情報をそれぞれのフレームにもたせるのは無駄です。
また、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-/bignum/test_big2str.rb b/test/-ext-/bignum/test_big2str.rb
new file mode 100644
index 0000000000..0af552ea70
--- /dev/null
+++ b/test/-ext-/bignum/test_big2str.rb
@@ -0,0 +1,29 @@
+require 'test/unit'
+require "-test-/bignum"
+
+class TestBignum < Test::Unit::TestCase
+ class TestBig2str < Test::Unit::TestCase
+
+ SIZEOF_BDIGIT = Bignum::SIZEOF_BDIGIT
+ BITSPERDIG = Bignum::BITSPERDIG
+ BDIGMAX = (1 << BITSPERDIG) - 1
+
+ def test_big2str_generic
+ x = 10**1000
+ assert_equal("1" + "0" * 1000, x.big2str_generic(10))
+ end
+
+ def test_big2str_poweroftwo
+ e = BITSPERDIG*2
+ x = 0b10**e
+ assert_equal("1" + "0" * e, x.big2str_poweroftwo(2))
+ end
+
+ def test_big2str_gmp
+ x = 10**1000
+ assert_equal("1" + "0" * 1000, x.big2str_gmp(10))
+ rescue NotImplementedError
+ end
+
+ end
+end
diff --git a/test/-ext-/bignum/test_bigzero.rb b/test/-ext-/bignum/test_bigzero.rb
new file mode 100644
index 0000000000..f75c4590b8
--- /dev/null
+++ b/test/-ext-/bignum/test_bigzero.rb
@@ -0,0 +1,13 @@
+require 'test/unit'
+require "-test-/bignum"
+
+class TestBignum < Test::Unit::TestCase
+ class TestBigZero < Test::Unit::TestCase
+ def test_equal_0
+ bug8204 = '[ruby-core:53893] [Bug #8204]'
+ (0..10).each do |i|
+ assert_equal(0, Bug::Bignum.zero(i), "#{bug8204} Bignum.zero(#{i})")
+ end
+ end
+ end
+end
diff --git a/test/-ext-/bignum/test_div.rb b/test/-ext-/bignum/test_div.rb
new file mode 100644
index 0000000000..9c1a3c3d2a
--- /dev/null
+++ b/test/-ext-/bignum/test_div.rb
@@ -0,0 +1,28 @@
+require 'test/unit'
+require "-test-/bignum"
+
+class TestBignum < Test::Unit::TestCase
+ class TestDiv < Test::Unit::TestCase
+
+ SIZEOF_BDIGIT = Bignum::SIZEOF_BDIGIT
+ BITSPERDIG = Bignum::BITSPERDIG
+ BDIGMAX = (1 << BITSPERDIG) - 1
+
+ def test_divrem_normal
+ x = (1 << (BITSPERDIG*2)) | (2 << BITSPERDIG) | 3
+ y = (1 << BITSPERDIG) | 1
+ q = (1 << BITSPERDIG) | 1
+ r = 2
+ assert_equal([q, r], x.big_divrem_normal(y))
+ end
+
+ def test_divrem_gmp
+ x = (1 << (BITSPERDIG*2)) | (2 << BITSPERDIG) | 3
+ y = (1 << BITSPERDIG) | 1
+ q = (1 << BITSPERDIG) | 1
+ r = 2
+ assert_equal([q, r], x.big_divrem_gmp(y))
+ rescue NotImplementedError
+ end
+ end
+end
diff --git a/test/-ext-/bignum/test_mul.rb b/test/-ext-/bignum/test_mul.rb
new file mode 100644
index 0000000000..3e78247aa4
--- /dev/null
+++ b/test/-ext-/bignum/test_mul.rb
@@ -0,0 +1,137 @@
+require 'test/unit'
+require "-test-/bignum"
+
+class TestBignum < Test::Unit::TestCase
+ class TestMul < Test::Unit::TestCase
+
+ SIZEOF_BDIGIT = Bignum::SIZEOF_BDIGIT
+ BITSPERDIG = Bignum::BITSPERDIG
+ BDIGMAX = (1 << BITSPERDIG) - 1
+
+ def test_mul_normal
+ x = (1 << BITSPERDIG) | 1
+ y = (1 << BITSPERDIG) | 1
+ z = (1 << (BITSPERDIG*2)) | (2 << BITSPERDIG) | 1
+ assert_equal(z, x.big_mul_normal(y))
+ end
+
+ def test_mul_normal_zero_in_x
+ x = (1 << (2*BITSPERDIG)) | 1
+ y = (1 << BITSPERDIG) | 1
+ z = (1 << (BITSPERDIG*3)) | (1 << (BITSPERDIG*2)) | (1 << BITSPERDIG) | 1
+ assert_equal(z, x.big_mul_normal(y))
+ end
+
+ def test_mul_normal_zero_in_y
+ x = (1 << BITSPERDIG) | 1
+ y = (1 << (2*BITSPERDIG)) | 1
+ z = (1 << (BITSPERDIG*3)) | (1 << (BITSPERDIG*2)) | (1 << BITSPERDIG) | 1
+ assert_equal(z, x.big_mul_normal(y))
+ end
+
+ def test_mul_normal_max_max
+ x = (1 << (2*BITSPERDIG)) - 1
+ y = (1 << (2*BITSPERDIG)) - 1
+ z = (1 << (4*BITSPERDIG)) - (1 << (2*BITSPERDIG+1)) + 1
+ assert_equal(z, x.big_mul_normal(y))
+ end
+
+ def test_sq_fast
+ x = (1 << BITSPERDIG) | 1
+ z = (1 << 2*BITSPERDIG) | (2 << BITSPERDIG) | 1
+ assert_equal(z, x.big_sq_fast)
+ end
+
+ def test_sq_fast_max2
+ x = (BDIGMAX << BITSPERDIG) | BDIGMAX
+ assert_equal(x.big_mul_normal(x), x.big_sq_fast)
+ end
+
+ def test_sq_fast_zero_in_middle
+ x = (BDIGMAX << 2*BITSPERDIG) | BDIGMAX
+ assert_equal(x.big_mul_normal(x), x.big_sq_fast)
+ end
+
+ def test_mul_balance
+ x = (1 << BITSPERDIG) | 1
+ y = (1 << BITSPERDIG) | 1
+ z = (1 << (BITSPERDIG*2)) | (2 << BITSPERDIG) | 1
+ assert_equal(z, x.big_mul_balance(y))
+ end
+
+ def test_mul_balance_2x16
+ x = (1 << Bignum::BITSPERDIG) | 1
+ y = (1 << Bignum::BITSPERDIG*16) | 1
+ assert_equal(x.big_mul_normal(y), x.big_mul_balance(y))
+ end
+
+ def test_mul_balance_2x17
+ x = (1 << Bignum::BITSPERDIG) | 1
+ y = (1 << Bignum::BITSPERDIG*17) | 1
+ assert_equal(x.big_mul_normal(y), x.big_mul_balance(y))
+ end
+
+ def test_mul_karatsuba
+ x = (1 << BITSPERDIG) | 1
+ y = (1 << BITSPERDIG) | 1
+ z = (1 << (BITSPERDIG*2)) | (2 << BITSPERDIG) | 1
+ assert_equal(z, x.big_mul_karatsuba(y))
+ end
+
+ def test_mul_karatsuba_odd_y
+ x = (1 << BITSPERDIG) | 1
+ y = (1 << (2*BITSPERDIG)) | 1
+ assert_equal(x.big_mul_normal(y), x.big_mul_karatsuba(y))
+ end
+
+ def test_mul_karatsuba_odd_xy
+ x = (1 << (2*BITSPERDIG)) | 1
+ y = (1 << (2*BITSPERDIG)) | 1
+ assert_equal(x.big_mul_normal(y), x.big_mul_karatsuba(y))
+ end
+
+ def test_mul_karatsuba_x1_gt_x0
+ x = (2 << BITSPERDIG) | 1
+ y = (1 << BITSPERDIG) | 2
+ assert_equal(x.big_mul_normal(y), x.big_mul_karatsuba(y))
+ end
+
+ def test_mul_karatsuba_y1_gt_y0
+ x = (1 << BITSPERDIG) | 2
+ y = (2 << BITSPERDIG) | 1
+ assert_equal(x.big_mul_normal(y), x.big_mul_karatsuba(y))
+ end
+
+ def test_mul_karatsuba_x1_gt_x0_and_y1_gt_y0
+ x = (2 << BITSPERDIG) | 1
+ y = (2 << BITSPERDIG) | 1
+ assert_equal(x.big_mul_normal(y), x.big_mul_karatsuba(y))
+ end
+
+ def test_mul_karatsuba_carry2
+ x = (1 << BITSPERDIG) | BDIGMAX
+ y = (1 << BITSPERDIG) | BDIGMAX
+ assert_equal(x.big_mul_normal(y), x.big_mul_karatsuba(y))
+ end
+
+ def test_mul_karatsuba_borrow
+ x = (BDIGMAX << BITSPERDIG) | 1
+ y = (BDIGMAX << BITSPERDIG) | 1
+ assert_equal(x.big_mul_normal(y), x.big_mul_karatsuba(y))
+ end
+
+ def test_mul_toom3
+ x = (1 << 2*BITSPERDIG) | (1 << BITSPERDIG) | 1
+ y = (1 << 2*BITSPERDIG) | (1 << BITSPERDIG) | 1
+ assert_equal(x.big_mul_normal(y), x.big_mul_toom3(y))
+ end
+
+ def test_mul_gmp
+ x = (1 << 2*BITSPERDIG) | (1 << BITSPERDIG) | 1
+ y = (1 << 2*BITSPERDIG) | (1 << BITSPERDIG) | 1
+ assert_equal(x.big_mul_normal(y), x.big_mul_gmp(y))
+ rescue NotImplementedError
+ end
+
+ end
+end
diff --git a/test/-ext-/bignum/test_pack.rb b/test/-ext-/bignum/test_pack.rb
new file mode 100644
index 0000000000..f2a3df814e
--- /dev/null
+++ b/test/-ext-/bignum/test_pack.rb
@@ -0,0 +1,398 @@
+# coding: ASCII-8BIT
+
+require 'test/unit'
+require "-test-/bignum"
+
+class TestBignum < Test::Unit::TestCase
+ class TestPack < Test::Unit::TestCase
+
+ MSWORD_FIRST = Integer::INTEGER_PACK_MSWORD_FIRST
+ LSWORD_FIRST = Integer::INTEGER_PACK_LSWORD_FIRST
+ MSBYTE_FIRST = Integer::INTEGER_PACK_MSBYTE_FIRST
+ LSBYTE_FIRST = Integer::INTEGER_PACK_LSBYTE_FIRST
+ NATIVE_BYTE_ORDER = Integer::INTEGER_PACK_NATIVE_BYTE_ORDER
+ TWOCOMP = Integer::INTEGER_PACK_2COMP
+ LITTLE_ENDIAN = Integer::INTEGER_PACK_LITTLE_ENDIAN
+ BIG_ENDIAN = Integer::INTEGER_PACK_BIG_ENDIAN
+ NEGATIVE = Integer::INTEGER_PACK_NEGATIVE
+ GENERIC = Integer::INTEGER_PACK_FORCE_GENERIC_IMPLEMENTATION
+
+ def test_pack_zero
+ assert_equal([0, ""], 0.test_pack(0, 1, 0, BIG_ENDIAN))
+ end
+
+ def test_pack_argument_check
+ assert_raise(ArgumentError) { 0.test_pack_raw("", 2, 1, 0, MSBYTE_FIRST) }
+ assert_raise(ArgumentError) { 0.test_pack_raw("", 0, 1, 0, MSWORD_FIRST) }
+ assert_raise(ArgumentError) { 0.test_pack_raw("", 0, 0, 0, BIG_ENDIAN) }
+ assert_raise(ArgumentError) { 0.test_pack_raw("", 0, 1, 8, BIG_ENDIAN) }
+
+ # assume sizeof(ssize_t) == sizeof(intptr_t)
+ assert_raise(ArgumentError) { 0.test_pack_raw("", 1 << ([""].pack("p").length * 8 - 1), 0, BIG_ENDIAN) }
+ end
+
+ def test_pack_wordsize
+ assert_equal([1, "\x01"], 1.test_pack(1, 1, 0, BIG_ENDIAN))
+ assert_equal([1, "\x00\x01"], 1.test_pack(1, 2, 0, BIG_ENDIAN))
+ assert_equal([1, "\x00\x00\x01"], 1.test_pack(1, 3, 0, BIG_ENDIAN))
+ assert_equal([1, "\x01"], 1.test_pack(1, 1, 0, LITTLE_ENDIAN))
+ assert_equal([1, "\x01\x00"], 1.test_pack(1, 2, 0, LITTLE_ENDIAN))
+ assert_equal([1, "\x01\x00\x00"], 1.test_pack(1, 3, 0, LITTLE_ENDIAN))
+ end
+
+ def test_pack_fixed_buffer
+ assert_equal([0, "\x00\x00"], 0.test_pack(2, 1, 0, BIG_ENDIAN))
+ assert_equal([1, "\x00\x01"], 0x01.test_pack(2, 1, 0, BIG_ENDIAN))
+ assert_equal([1, "\x02\x01"], 0x0201.test_pack(2, 1, 0, BIG_ENDIAN))
+ assert_equal([2, "\x02\x01"], 0x030201.test_pack(2, 1, 0, BIG_ENDIAN))
+ assert_equal([2, "\x02\x01"], 0x04030201.test_pack(2, 1, 0, BIG_ENDIAN))
+ assert_equal([0, "\x00\x00"], 0.test_pack(2, 1, 0, LITTLE_ENDIAN))
+ assert_equal([1, "\x01\x00"], 0x01.test_pack(2, 1, 0, LITTLE_ENDIAN))
+ assert_equal([1, "\x01\x02"], 0x0201.test_pack(2, 1, 0, LITTLE_ENDIAN))
+ assert_equal([2, "\x01\x02"], 0x030201.test_pack(2, 1, 0, LITTLE_ENDIAN))
+ assert_equal([2, "\x01\x02"], 0x04030201.test_pack(2, 1, 0, LITTLE_ENDIAN))
+ end
+
+ def test_pack_wordorder_and_endian
+ assert_equal([1, "\x12\x34\x56\x78"], 0x12345678.test_pack(2, 2, 0, MSWORD_FIRST|MSBYTE_FIRST))
+ assert_equal([1, "\x34\x12\x78\x56"], 0x12345678.test_pack(2, 2, 0, MSWORD_FIRST|LSBYTE_FIRST))
+ assert_equal([1, "\x56\x78\x12\x34"], 0x12345678.test_pack(2, 2, 0, LSWORD_FIRST|MSBYTE_FIRST))
+ assert_equal([1, "\x78\x56\x34\x12"], 0x12345678.test_pack(2, 2, 0, LSWORD_FIRST|LSBYTE_FIRST))
+ end
+
+ def test_pack_native_endian
+ assert_equal([1, [0x1234].pack("S!")], 0x1234.test_pack(1, 2, 0, MSWORD_FIRST|NATIVE_BYTE_ORDER))
+ end
+
+ def test_pack_nail
+ assert_equal([1, "\x01\x00\x00\x00\x01\x01"], 0b100011.test_pack(6, 1, 7, BIG_ENDIAN))
+ assert_equal([1, "\x01\x02\x03\x04\x05\x06\x07\x08"], 0x12345678.test_pack(8, 1, 4, BIG_ENDIAN))
+ assert_equal([1, "\x00\x12\x00\x34\x00\x56\x00\x78"], 0x12345678.test_pack(4, 2, 8, BIG_ENDIAN))
+ end
+
+ def test_pack_overflow
+ assert_equal([-2, "\x1"], (-0x11).test_pack(1, 1, 4, BIG_ENDIAN))
+ assert_equal([-2, "\x0"], (-0x10).test_pack(1, 1, 4, BIG_ENDIAN))
+ assert_equal([-1, "\xF"], (-0x0F).test_pack(1, 1, 4, BIG_ENDIAN))
+ assert_equal([+1, "\xF"], (+0x0F).test_pack(1, 1, 4, BIG_ENDIAN))
+ assert_equal([+2, "\x0"], (+0x10).test_pack(1, 1, 4, BIG_ENDIAN))
+ assert_equal([+2, "\x1"], (+0x11).test_pack(1, 1, 4, BIG_ENDIAN))
+
+ assert_equal([-2, "\x01"], (-0x101).test_pack(1, 1, 0, BIG_ENDIAN))
+ assert_equal([-2, "\x00"], (-0x100).test_pack(1, 1, 0, BIG_ENDIAN))
+ assert_equal([-1, "\xFF"], (-0x0FF).test_pack(1, 1, 0, BIG_ENDIAN))
+ assert_equal([+1, "\xFF"], (+0x0FF).test_pack(1, 1, 0, BIG_ENDIAN))
+ assert_equal([+2, "\x00"], (+0x100).test_pack(1, 1, 0, BIG_ENDIAN))
+ assert_equal([+2, "\x01"], (+0x101).test_pack(1, 1, 0, BIG_ENDIAN))
+
+ assert_equal([-2, "\x00\x00\x00\x00\x00\x00\x00\x01"], (-0x10000000000000001).test_pack(2, 4, 0, BIG_ENDIAN))
+ assert_equal([-2, "\x00\x00\x00\x00\x00\x00\x00\x00"], (-0x10000000000000000).test_pack(2, 4, 0, BIG_ENDIAN))
+ assert_equal([-1, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"], (-0x0FFFFFFFFFFFFFFFF).test_pack(2, 4, 0, BIG_ENDIAN))
+ assert_equal([+1, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"], (+0x0FFFFFFFFFFFFFFFF).test_pack(2, 4, 0, BIG_ENDIAN))
+ assert_equal([+2, "\x00\x00\x00\x00\x00\x00\x00\x00"], (+0x10000000000000000).test_pack(2, 4, 0, BIG_ENDIAN))
+ assert_equal([+2, "\x00\x00\x00\x00\x00\x00\x00\x01"], (+0x10000000000000001).test_pack(2, 4, 0, BIG_ENDIAN))
+
+ 1.upto(16) {|wordsize|
+ 1.upto(20) {|numwords|
+ w = numwords*wordsize
+ n = 256**w
+ assert_equal([-2, "\x00"*(w-1)+"\x01"], (-n-1).test_pack(numwords, wordsize, 0, BIG_ENDIAN))
+ assert_equal([-2, "\x00"*w], (-n ).test_pack(numwords, wordsize, 0, BIG_ENDIAN))
+ assert_equal([-1, "\xFF"*w], (-n+1).test_pack(numwords, wordsize, 0, BIG_ENDIAN))
+ assert_equal([+1, "\xFF"*w], (+n-1).test_pack(numwords, wordsize, 0, BIG_ENDIAN))
+ assert_equal([+2, "\x00"*w], (+n ).test_pack(numwords, wordsize, 0, BIG_ENDIAN))
+ assert_equal([+2, "\x00"*(w-1)+"\x01"], (+n+1).test_pack(numwords, wordsize, 0, BIG_ENDIAN))
+ }
+ }
+
+ 1.upto(16) {|wordsize|
+ 1.upto(20) {|numwords|
+ w = numwords*wordsize
+ n = 256**w
+ assert_equal([-2, "\x01"+"\x00"*(w-1)], (-n-1).test_pack(numwords, wordsize, 0, LITTLE_ENDIAN))
+ assert_equal([-2, "\x00"*w], (-n ).test_pack(numwords, wordsize, 0, LITTLE_ENDIAN))
+ assert_equal([-1, "\xFF"*w], (-n+1).test_pack(numwords, wordsize, 0, LITTLE_ENDIAN))
+ assert_equal([+1, "\xFF"*w], (+n-1).test_pack(numwords, wordsize, 0, LITTLE_ENDIAN))
+ assert_equal([+2, "\x00"*w], (+n ).test_pack(numwords, wordsize, 0, LITTLE_ENDIAN))
+ assert_equal([+2, "\x01"+"\x00"*(w-1)], (+n+1).test_pack(numwords, wordsize, 0, LITTLE_ENDIAN))
+ }
+ }
+ end
+
+ def test_pack_sign
+ assert_equal([-1, "\x01"], (-1).test_pack(1, 1, 0, BIG_ENDIAN))
+ assert_equal([-1, "\x80\x70\x60\x50\x40\x30\x20\x10"], (-0x8070605040302010).test_pack(8, 1, 0, BIG_ENDIAN))
+ end
+
+ def test_pack_orders
+ [MSWORD_FIRST, LSWORD_FIRST].each {|word_order|
+ [MSBYTE_FIRST, LSBYTE_FIRST, NATIVE_BYTE_ORDER].each {|byte_order|
+ 1.upto(16) {|wordsize|
+ 1.upto(20) {|numwords|
+ w = numwords*wordsize
+ n = 0;
+ 0.upto(w) {|i|
+ n |= ((i+1) % 256) << (i*8)
+ }
+ assert_equal(n.test_pack(numwords, wordsize, 0, word_order|byte_order|GENERIC),
+ n.test_pack(numwords, wordsize, 0, word_order|byte_order),
+ "#{'%#x' % n}.test_pack(#{numwords}, #{wordsize}, 0, #{'%#x' % (word_order|byte_order)})")
+ }
+ }
+ }
+ }
+ end
+
+ def test_pack2comp_zero
+ assert_equal([0, ""], 0.test_pack(0, 1, 0, TWOCOMP|BIG_ENDIAN))
+ end
+
+ def test_pack2comp_emptybuf
+ assert_equal([-2, ""], (-3).test_pack(0, 1, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal([-2, ""], (-2).test_pack(0, 1, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal([-1, ""], (-1).test_pack(0, 1, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal([ 0, ""], 0.test_pack(0, 1, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal([+2, ""], 1.test_pack(0, 1, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal([+2, ""], 2.test_pack(0, 1, 0, TWOCOMP|BIG_ENDIAN))
+ end
+
+ def test_pack2comp_nearly_zero
+ assert_equal([-1, "\xFE"], (-2).test_pack(1, 1, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal([-1, "\xFF"], (-1).test_pack(1, 1, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal([ 0, "\x00"], 0.test_pack(1, 1, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal([+1, "\x01"], 1.test_pack(1, 1, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal([+1, "\x02"], 2.test_pack(1, 1, 0, TWOCOMP|BIG_ENDIAN))
+ end
+
+ def test_pack2comp_overflow
+ assert_equal([-2, "\xF"], (-0x11).test_pack(1, 1, 4, TWOCOMP|BIG_ENDIAN))
+ assert_equal([-1, "\x0"], (-0x10).test_pack(1, 1, 4, TWOCOMP|BIG_ENDIAN))
+ assert_equal([-1, "\x1"], (-0x0F).test_pack(1, 1, 4, TWOCOMP|BIG_ENDIAN))
+ assert_equal([+1, "\xF"], (+0x0F).test_pack(1, 1, 4, TWOCOMP|BIG_ENDIAN))
+ assert_equal([+2, "\x0"], (+0x10).test_pack(1, 1, 4, TWOCOMP|BIG_ENDIAN))
+ assert_equal([+2, "\x1"], (+0x11).test_pack(1, 1, 4, TWOCOMP|BIG_ENDIAN))
+
+ assert_equal([-2, "\xFF"], (-0x101).test_pack(1, 1, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal([-1, "\x00"], (-0x100).test_pack(1, 1, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal([-1, "\x01"], (-0x0FF).test_pack(1, 1, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal([+1, "\xFF"], (+0x0FF).test_pack(1, 1, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal([+2, "\x00"], (+0x100).test_pack(1, 1, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal([+2, "\x01"], (+0x101).test_pack(1, 1, 0, TWOCOMP|BIG_ENDIAN))
+
+ assert_equal([-2, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"], (-0x10000000000000001).test_pack(2, 4, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal([-1, "\x00\x00\x00\x00\x00\x00\x00\x00"], (-0x10000000000000000).test_pack(2, 4, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal([-1, "\x00\x00\x00\x00\x00\x00\x00\x01"], (-0x0FFFFFFFFFFFFFFFF).test_pack(2, 4, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal([+1, "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF"], (+0x0FFFFFFFFFFFFFFFF).test_pack(2, 4, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal([+2, "\x00\x00\x00\x00\x00\x00\x00\x00"], (+0x10000000000000000).test_pack(2, 4, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal([+2, "\x00\x00\x00\x00\x00\x00\x00\x01"], (+0x10000000000000001).test_pack(2, 4, 0, TWOCOMP|BIG_ENDIAN))
+
+ 1.upto(16) {|wordsize|
+ 1.upto(20) {|numwords|
+ w = numwords*wordsize
+ n = 256**w
+ assert_equal([-2, "\xFF"*w ], (-n-1).test_pack(numwords, wordsize, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal([-1, "\x00"*w], (-n ).test_pack(numwords, wordsize, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal([-1, "\x00"*(w-1)+"\x01"], (-n+1).test_pack(numwords, wordsize, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal([+1, "\xFF"*w], (+n-1).test_pack(numwords, wordsize, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal([+2, "\x00"*w], (+n ).test_pack(numwords, wordsize, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal([+2, "\x00"*(w-1)+"\x01"], (+n+1).test_pack(numwords, wordsize, 0, TWOCOMP|BIG_ENDIAN))
+ }
+ }
+
+ 1.upto(16) {|wordsize|
+ 1.upto(20) {|numwords|
+ w = numwords*wordsize
+ n = 256**w
+ assert_equal([-2, "\xFF"*w ], (-n-1).test_pack(numwords, wordsize, 0, TWOCOMP|LITTLE_ENDIAN))
+ assert_equal([-1, "\x00"*w], (-n ).test_pack(numwords, wordsize, 0, TWOCOMP|LITTLE_ENDIAN))
+ assert_equal([-1, "\x01"+"\x00"*(w-1)], (-n+1).test_pack(numwords, wordsize, 0, TWOCOMP|LITTLE_ENDIAN))
+ assert_equal([+1, "\xFF"*w], (+n-1).test_pack(numwords, wordsize, 0, TWOCOMP|LITTLE_ENDIAN))
+ assert_equal([+2, "\x00"*w], (+n ).test_pack(numwords, wordsize, 0, TWOCOMP|LITTLE_ENDIAN))
+ assert_equal([+2, "\x01"+"\x00"*(w-1)], (+n+1).test_pack(numwords, wordsize, 0, TWOCOMP|LITTLE_ENDIAN))
+ }
+ }
+
+ 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
+ assert_equal(0, Integer.test_unpack("", 0, 1, 0, BIG_ENDIAN))
+ end
+
+ def test_unpack_argument_check
+ assert_raise(ArgumentError) { Integer.test_unpack("x", 2, 1, 0, MSBYTE_FIRST) }
+ assert_raise(ArgumentError) { Integer.test_unpack("x", 1, 1, 0, MSWORD_FIRST) }
+ assert_raise(ArgumentError) { Integer.test_unpack("x", 1, 0, 0, BIG_ENDIAN) }
+ assert_raise(ArgumentError) { Integer.test_unpack("x", 1, 1, 8, BIG_ENDIAN) }
+
+ # assume sizeof(ssize_t) == sizeof(intptr_t)
+ assert_raise(ArgumentError) { Integer.test_unpack("x", 1, 1 << ([""].pack("p").length * 8 - 1), 0, BIG_ENDIAN) }
+ end
+
+ def test_unpack_wordsize
+ assert_equal(1, Integer.test_unpack("\x01", 1, 1, 0, BIG_ENDIAN))
+ assert_equal(1, Integer.test_unpack("\x00\x01", 1, 2, 0, BIG_ENDIAN))
+ assert_equal(1, Integer.test_unpack("\x00\x00\x01", 1, 3, 0, BIG_ENDIAN))
+ assert_equal(1, Integer.test_unpack("\x01", 1, 1, 0, LITTLE_ENDIAN))
+ assert_equal(1, Integer.test_unpack("\x01\x00", 1, 2, 0, LITTLE_ENDIAN))
+ assert_equal(1, Integer.test_unpack("\x01\x00\x00", 1, 3, 0, LITTLE_ENDIAN))
+ end
+
+ def test_unpack_wordorder_and_endian
+ assert_equal(0x01020304, Integer.test_unpack("\x01\x02\x03\x04", 2, 2, 0, MSWORD_FIRST|MSBYTE_FIRST))
+ assert_equal(0x02010403, Integer.test_unpack("\x01\x02\x03\x04", 2, 2, 0, MSWORD_FIRST|LSBYTE_FIRST))
+ assert_equal(0x03040102, Integer.test_unpack("\x01\x02\x03\x04", 2, 2, 0, LSWORD_FIRST|MSBYTE_FIRST))
+ assert_equal(0x04030201, Integer.test_unpack("\x01\x02\x03\x04", 2, 2, 0, LSWORD_FIRST|LSBYTE_FIRST))
+ end
+
+ def test_unpack_native_endian
+ assert_equal("\x12\x34".unpack("S!")[0], Integer.test_unpack("\x12\x34", 1, 2, 0, MSWORD_FIRST|NATIVE_BYTE_ORDER))
+ end
+
+ def test_unpack_nail
+ assert_equal(0b100011, Integer.test_unpack("\x01\x00\x00\x00\x01\x01", 6, 1, 7, BIG_ENDIAN))
+ assert_equal(0x12345678, Integer.test_unpack("\x01\x02\x03\x04\x05\x06\x07\x08", 8, 1, 4, BIG_ENDIAN))
+ assert_equal(0x12345678, Integer.test_unpack("\x00\x12\x00\x34\x00\x56\x00\x78", 4, 2, 8, BIG_ENDIAN))
+ end
+
+ def test_unpack_sign
+ assert_equal(-1, Integer.test_unpack("\x01", 1, 1, 0, BIG_ENDIAN|NEGATIVE))
+ assert_equal(-0x8070605040302010, Integer.test_unpack("\x80\x70\x60\x50\x40\x30\x20\x10", 8, 1, 0, BIG_ENDIAN|NEGATIVE))
+ end
+
+ def test_unpack_orders
+ [MSWORD_FIRST, LSWORD_FIRST].each {|word_order|
+ [MSBYTE_FIRST, LSBYTE_FIRST, NATIVE_BYTE_ORDER].each {|byte_order|
+ 1.upto(16) {|wordsize|
+ 1.upto(20) {|numwords|
+ w = numwords*wordsize
+ ary = []
+ 0.upto(w) {|i|
+ ary << ((i+1) % 256);
+ }
+ str = ary.pack("C*")
+ flags = word_order|byte_order
+ assert_equal(Integer.test_unpack(str, numwords, wordsize, 0, flags|GENERIC),
+ Integer.test_unpack(str, numwords, wordsize, 0, flags),
+ "Integer.test_unpack(#{str.dump}, #{numwords}, #{wordsize}, 0, #{'%#x' % flags})")
+ }
+ }
+ }
+ }
+ end
+
+ def test_unpack2comp_single_byte
+ assert_equal(-128, Integer.test_unpack("\x80", 1, 1, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal( -2, Integer.test_unpack("\xFE", 1, 1, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal( -1, Integer.test_unpack("\xFF", 1, 1, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal( 0, Integer.test_unpack("\x00", 1, 1, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal( 1, Integer.test_unpack("\x01", 1, 1, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal( 2, Integer.test_unpack("\x02", 1, 1, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal( 127, Integer.test_unpack("\x7F", 1, 1, 0, TWOCOMP|BIG_ENDIAN))
+ end
+
+ def test_unpack2comp_sequence_of_ff
+ assert_equal(-1, Integer.test_unpack("\xFF"*2, 2, 1, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal(-1, Integer.test_unpack("\xFF"*3, 3, 1, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal(-1, Integer.test_unpack("\xFF"*4, 4, 1, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal(-1, Integer.test_unpack("\xFF"*5, 5, 1, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal(-1, Integer.test_unpack("\xFF"*6, 6, 1, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal(-1, Integer.test_unpack("\xFF"*7, 7, 1, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal(-1, Integer.test_unpack("\xFF"*8, 8, 1, 0, TWOCOMP|BIG_ENDIAN))
+ assert_equal(-1, Integer.test_unpack("\xFF"*9, 9, 1, 0, TWOCOMP|BIG_ENDIAN))
+ end
+
+ def test_unpack2comp_negative_single_byte
+ assert_equal(-256, Integer.test_unpack("\x00", 1, 1, 0, TWOCOMP|BIG_ENDIAN|NEGATIVE))
+ assert_equal(-255, Integer.test_unpack("\x01", 1, 1, 0, TWOCOMP|BIG_ENDIAN|NEGATIVE))
+ assert_equal(-254, Integer.test_unpack("\x02", 1, 1, 0, TWOCOMP|BIG_ENDIAN|NEGATIVE))
+ assert_equal(-129, Integer.test_unpack("\x7F", 1, 1, 0, TWOCOMP|BIG_ENDIAN|NEGATIVE))
+ assert_equal(-128, Integer.test_unpack("\x80", 1, 1, 0, TWOCOMP|BIG_ENDIAN|NEGATIVE))
+ assert_equal( -2, Integer.test_unpack("\xFE", 1, 1, 0, TWOCOMP|BIG_ENDIAN|NEGATIVE))
+ assert_equal( -1, Integer.test_unpack("\xFF", 1, 1, 0, TWOCOMP|BIG_ENDIAN|NEGATIVE))
+ end
+
+ def test_unpack2comp_negative_zero
+ 0.upto(100) {|n|
+ str = "\x00"*n
+ flags = TWOCOMP|BIG_ENDIAN|NEGATIVE
+ assert_equal(-(256**n), Integer.test_unpack(str, n, 1, 0, flags))
+ flags = TWOCOMP|LITTLE_ENDIAN|NEGATIVE
+ assert_equal(-(256**n), Integer.test_unpack(str, n, 1, 0, flags),
+ "Integer.test_unpack(#{str.dump}, #{n}, 1, 0, #{'%#x' % flags})")
+ }
+ end
+ end
+
+ def test_numbits_2comp
+ assert_equal(4, -9.test_numbits_2comp_without_sign)
+ assert_equal(3, -8.test_numbits_2comp_without_sign)
+ assert_equal(3, -7.test_numbits_2comp_without_sign)
+ assert_equal(3, -6.test_numbits_2comp_without_sign)
+ assert_equal(3, -5.test_numbits_2comp_without_sign)
+ assert_equal(2, -4.test_numbits_2comp_without_sign)
+ assert_equal(2, -3.test_numbits_2comp_without_sign)
+ assert_equal(1, -2.test_numbits_2comp_without_sign)
+ assert_equal(0, -1.test_numbits_2comp_without_sign)
+ assert_equal(0, 0.test_numbits_2comp_without_sign)
+ assert_equal(1, 1.test_numbits_2comp_without_sign)
+ assert_equal(2, 2.test_numbits_2comp_without_sign)
+ assert_equal(2, 3.test_numbits_2comp_without_sign)
+ assert_equal(3, 4.test_numbits_2comp_without_sign)
+ assert_equal(3, 5.test_numbits_2comp_without_sign)
+ assert_equal(3, 6.test_numbits_2comp_without_sign)
+ assert_equal(3, 7.test_numbits_2comp_without_sign)
+ assert_equal(4, 8.test_numbits_2comp_without_sign)
+ assert_equal(4, 9.test_numbits_2comp_without_sign)
+ end
+
+ def test_numbytes_2comp
+ assert_equal(6, -0x8000000001.test_numbytes_2comp_with_sign)
+ assert_equal(5, -0x8000000000.test_numbytes_2comp_with_sign)
+ assert_equal(5, -0x80000001.test_numbytes_2comp_with_sign)
+ assert_equal(4, -0x80000000.test_numbytes_2comp_with_sign)
+ assert_equal(4, -0x800001.test_numbytes_2comp_with_sign)
+ assert_equal(3, -0x800000.test_numbytes_2comp_with_sign)
+ assert_equal(3, -0x8001.test_numbytes_2comp_with_sign)
+ assert_equal(2, -0x8000.test_numbytes_2comp_with_sign)
+ assert_equal(2, -0x81.test_numbytes_2comp_with_sign)
+ assert_equal(1, -0x80.test_numbytes_2comp_with_sign)
+ assert_equal(1, -1.test_numbytes_2comp_with_sign)
+ assert_equal(1, 0.test_numbytes_2comp_with_sign)
+ assert_equal(1, 1.test_numbytes_2comp_with_sign)
+ assert_equal(1, 0x7f.test_numbytes_2comp_with_sign)
+ assert_equal(2, 0x80.test_numbytes_2comp_with_sign)
+ assert_equal(2, 0x7fff.test_numbytes_2comp_with_sign)
+ assert_equal(3, 0x8000.test_numbytes_2comp_with_sign)
+ assert_equal(3, 0x7fffff.test_numbytes_2comp_with_sign)
+ assert_equal(4, 0x800000.test_numbytes_2comp_with_sign)
+ assert_equal(4, 0x7fffffff.test_numbytes_2comp_with_sign)
+ assert_equal(5, 0x80000000.test_numbytes_2comp_with_sign)
+ assert_equal(5, 0x7fffffffff.test_numbytes_2comp_with_sign)
+ assert_equal(6, 0x8000000000.test_numbytes_2comp_with_sign)
+ end
+
+end
diff --git a/test/-ext-/bignum/test_str2big.rb b/test/-ext-/bignum/test_str2big.rb
new file mode 100644
index 0000000000..4304be88e9
--- /dev/null
+++ b/test/-ext-/bignum/test_str2big.rb
@@ -0,0 +1,37 @@
+require 'test/unit'
+require "-test-/bignum"
+
+class TestBignum < Test::Unit::TestCase
+ class TestStr2big < Test::Unit::TestCase
+
+ SIZEOF_BDIGIT = Bignum::SIZEOF_BDIGIT
+ BITSPERDIG = Bignum::BITSPERDIG
+ BDIGMAX = (1 << BITSPERDIG) - 1
+
+ def test_str2big_poweroftwo
+ s = "1" + "0" * 1000
+ n = 16 ** 1000
+ assert_equal(n, s.str2big_poweroftwo(16, true))
+ end
+
+ def test_str2big_normal
+ s = "1" + "0" * 1000
+ n = 10 ** 1000
+ assert_equal(n, s.str2big_normal(10, true))
+ end
+
+ def test_str2big_karatsuba
+ s = "1" + "0" * 1000
+ n = 10 ** 1000
+ assert_equal(n, s.str2big_karatsuba(10, true))
+ end
+
+ def test_str2big_gmp
+ s = "1" + "0" * 1000
+ n = 10 ** 1000
+ assert_equal(n, s.str2big_gmp(10, true))
+ rescue NotImplementedError
+ end
+
+ end
+end
diff --git a/test/-ext-/bug_reporter/test_bug_reporter.rb b/test/-ext-/bug_reporter/test_bug_reporter.rb
new file mode 100644
index 0000000000..2e5e332074
--- /dev/null
+++ b/test/-ext-/bug_reporter/test_bug_reporter.rb
@@ -0,0 +1,17 @@
+require 'test/unit'
+require 'tmpdir'
+require_relative "../../ruby/envutil"
+
+class TestBugReporter < Test::Unit::TestCase
+ def test_bug_reporter_add
+ expected_stderr = /Sample bug reporter: 12345/
+ tmpdir = Dir.mktmpdir
+ assert_in_out_err(["--disable-gems", "-r-test-/bug_reporter/bug_reporter",
+ "-C", tmpdir],
+ "register_sample_bug_reporter(12345); Process.kill :SEGV, $$",
+ [],
+ expected_stderr, nil)
+ ensure
+ FileUtils.rm_rf(tmpdir) if tmpdir
+ end
+end
diff --git a/test/-ext-/class/test_class2name.rb b/test/-ext-/class/test_class2name.rb
new file mode 100644
index 0000000000..070be5a130
--- /dev/null
+++ b/test/-ext-/class/test_class2name.rb
@@ -0,0 +1,18 @@
+require 'test/unit'
+require "-test-/class"
+
+class Test_Class < Test::Unit::TestCase
+ class Test_Class2Name < superclass
+ def test_toplevel_class
+ assert_equal("Object", Bug::Class.class2name(::Object))
+ end
+
+ def test_toplevel_module
+ assert_equal("Kernel", Bug::Class.class2name(::Kernel))
+ end
+
+ def test_singleton_class
+ assert_equal("Object", Bug::Class.class2name(::Object.new.singleton_class))
+ end
+ end
+end
diff --git a/test/-ext-/debug/test_debug.rb b/test/-ext-/debug/test_debug.rb
index 4c45057b5d..ec506e0ca5 100644
--- a/test/-ext-/debug/test_debug.rb
+++ b/test/-ext-/debug/test_debug.rb
@@ -3,42 +3,42 @@ require '-test-/debug'
class TestDebug < Test::Unit::TestCase
- def binds_check binds
+ def binds_check(binds, msg = nil)
count = Hash.new(0)
- assert_instance_of(Array, binds)
+ assert_instance_of(Array, binds, msg)
binds.each{|(_self, bind, klass, iseq, loc)|
if _self == self
count[:self] += 1
end
if bind
- assert_instance_of(Binding, bind)
+ assert_instance_of(Binding, bind, msg)
count[:bind] += 1
end
if klass
- assert(klass.instance_of?(Module) || klass.instance_of?(Class))
+ assert(klass.instance_of?(Module) || klass.instance_of?(Class), msg)
count[:class] += 1
end
if iseq
count[:iseq] += 1
- assert_instance_of(RubyVM::InstructionSequence, iseq)
+ assert_instance_of(RubyVM::InstructionSequence, iseq, msg)
# check same location
- assert_equal(loc.path, iseq.path)
- assert_equal(loc.absolute_path, iseq.absolute_path)
- assert_equal(loc.label, iseq.label)
- assert_operator(loc.lineno, :>=, iseq.first_lineno)
+ assert_equal(loc.path, iseq.path, msg)
+ assert_equal(loc.absolute_path, iseq.absolute_path, msg)
+ assert_equal(loc.label, iseq.label, msg)
+ assert_operator(loc.lineno, :>=, iseq.first_lineno, msg)
end
- assert_instance_of(Thread::Backtrace::Location, loc)
+ assert_instance_of(Thread::Backtrace::Location, loc, msg)
}
- assert_operator(0, :<, count[:self])
- assert_operator(0, :<, count[:bind])
- assert_operator(0, :<, count[:iseq])
- assert_operator(0, :<, count[:class])
+ assert_operator(0, :<, count[:self], msg)
+ assert_operator(0, :<, count[:bind], msg)
+ assert_operator(0, :<, count[:iseq], msg)
+ assert_operator(0, :<, count[:class], msg)
end
def test_inspector_open
@@ -53,6 +53,6 @@ class TestDebug < Test::Unit::TestCase
def test_inspector_open_in_eval
bug7635 = '[ruby-core:51640]'
binds = inspector_in_eval
- binds_check binds
+ binds_check binds, bug7635
end
end
diff --git a/test/-ext-/debug/test_profile_frames.rb b/test/-ext-/debug/test_profile_frames.rb
new file mode 100644
index 0000000000..1879c222c2
--- /dev/null
+++ b/test/-ext-/debug/test_profile_frames.rb
@@ -0,0 +1,104 @@
+require 'test/unit'
+require '-test-/debug'
+
+class SampleClassForTestProfileFrames
+ class Sample2
+ def baz(block)
+ instance_eval "def zab(block) block.call end"
+ [self, zab(block)]
+ end
+ end
+
+ def self.bar(block)
+ Sample2.new.baz(block)
+ end
+
+ def foo(block)
+ self.class.bar(block)
+ end
+end
+
+class TestProfileFrames < Test::Unit::TestCase
+ def test_profile_frames
+ obj, frames = Fiber.new{
+ Fiber.yield SampleClassForTestProfileFrames.new.foo(lambda{ Bug::Debug.profile_frames(0, 10) })
+ }.resume
+
+ labels = [
+ "block (2 levels) in test_profile_frames",
+ "zab",
+ "baz",
+ "bar",
+ "foo",
+ "block in test_profile_frames",
+ ]
+ base_labels = [
+ "test_profile_frames",
+ "zab",
+ "baz",
+ "bar",
+ "foo",
+ "test_profile_frames",
+ ]
+ full_labels = [
+ "block (2 levels) in TestProfileFrames#test_profile_frames",
+ "#{obj.inspect}.zab",
+ "SampleClassForTestProfileFrames::Sample2#baz",
+ "SampleClassForTestProfileFrames.bar",
+ "SampleClassForTestProfileFrames#foo",
+ "block in TestProfileFrames#test_profile_frames",
+ ]
+ classes = [
+ TestProfileFrames,
+ obj,
+ SampleClassForTestProfileFrames::Sample2,
+ SampleClassForTestProfileFrames, # singleton method
+ SampleClassForTestProfileFrames,
+ TestProfileFrames,
+ ]
+ singleton_method_p = [
+ false, true, false, true, false, false, false,
+ ]
+ method_names = [
+ "test_profile_frames",
+ "zab",
+ "baz",
+ "bar",
+ "foo",
+ "test_profile_frames",
+ ]
+ qualified_method_names = [
+ "TestProfileFrames#test_profile_frames",
+ "#{obj.inspect}.zab",
+ "SampleClassForTestProfileFrames::Sample2#baz",
+ "SampleClassForTestProfileFrames.bar",
+ "SampleClassForTestProfileFrames#foo",
+ "TestProfileFrames#test_profile_frames",
+ ]
+ paths = [ file=__FILE__, "(eval)", file, file, file, file ]
+ absolute_paths = [ file, nil, file, file, file, file ]
+
+ # pp frames
+
+ assert_equal(labels.size, frames.size)
+
+ frames.each.with_index{|(path, absolute_path, label, base_label, full_label, first_lineno,
+ classpath, singleton_p, method_name, qualified_method_name), i|
+ err_msg = "#{i}th frame"
+ assert_equal(paths[i], path, err_msg)
+ assert_equal(absolute_paths[i], absolute_path, err_msg)
+ assert_equal(labels[i], label, err_msg)
+ assert_equal(base_labels[i], base_label, err_msg)
+ assert_equal(singleton_method_p[i], singleton_p, err_msg)
+ assert_equal(method_names[i], method_name, err_msg)
+ assert_match(qualified_method_names[i], qualified_method_name, err_msg)
+ assert_match(full_labels[i], full_label, err_msg)
+ assert_match(classes[i].inspect, classpath, err_msg)
+ if label == method_name
+ c = classes[i]
+ m = singleton_p ? c.method(method_name) : c.instance_method(method_name)
+ assert_equal(m.source_location[1], first_lineno, err_msg)
+ end
+ }
+ end
+end
diff --git a/test/-ext-/exception/test_data_error.rb b/test/-ext-/exception/test_data_error.rb
new file mode 100644
index 0000000000..140de5bd5a
--- /dev/null
+++ b/test/-ext-/exception/test_data_error.rb
@@ -0,0 +1,14 @@
+require 'test/unit'
+require_relative '../../ruby/envutil'
+
+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-/file/test_stat.rb b/test/-ext-/file/test_stat.rb
new file mode 100644
index 0000000000..b9aa132932
--- /dev/null
+++ b/test/-ext-/file/test_stat.rb
@@ -0,0 +1,14 @@
+require 'test/unit'
+require "-test-/file"
+
+class Test_FileStat < Test::Unit::TestCase
+ def test_stat_for_fd
+ st = open(__FILE__) {|f| Bug::File::Stat.for_fd(f.fileno)}
+ assert_equal(File.stat(__FILE__), st)
+ end
+
+ def test_stat_for_path
+ st = Bug::File::Stat.for_path(__FILE__)
+ assert_equal(File.stat(__FILE__), st)
+ end
+end
diff --git a/test/-ext-/float/test_nextafter.rb b/test/-ext-/float/test_nextafter.rb
new file mode 100644
index 0000000000..e3a3e726c7
--- /dev/null
+++ b/test/-ext-/float/test_nextafter.rb
@@ -0,0 +1,57 @@
+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"
+ assert_equal(s1, s2,
+ "Bug::Float.missing_nextafter(#{'%a' % n1}, #{'%a' % n2}) = #{'%a' % v1} != " +
+ "#{'%a' % v2} = Bug::Float.system_nextafter(#{'%a' % n1}, #{'%a' % n2})")
+ end
+ end
+ }
+ }
+ }
+
+end
diff --git a/test/-ext-/iter/test_iter_break.rb b/test/-ext-/iter/test_iter_break.rb
index 1ef2aad3c2..5bac6331fd 100644
--- a/test/-ext-/iter/test_iter_break.rb
+++ b/test/-ext-/iter/test_iter_break.rb
@@ -1,12 +1,15 @@
require 'test/unit'
-require '-test-/iter/break'
+require '-test-/iter'
-class TestIterBreak < Test::Unit::TestCase
+module TestIter
+end
+
+class TestIter::IterBreak < Test::Unit::TestCase
def test_iter_break
backport7896 = '[ruby-core:52607]'
- assert_equal(nil, 1.times{Bug::Breakable.iter_break}, backport7896)
+ assert_equal(nil, 1.times{Bug::Iter::Breakable.iter_break}, backport7896)
feature5895 = '[ruby-dev:45132]'
- assert_equal(42, 1.times{Bug::Breakable.iter_break_value(42)}, feature5895)
+ assert_equal(42, 1.times{Bug::Iter::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
new file mode 100644
index 0000000000..bec993c950
--- /dev/null
+++ b/test/-ext-/iter/test_yield_block.rb
@@ -0,0 +1,21 @@
+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-/marshal/test_usrmarshal.rb b/test/-ext-/marshal/test_usrmarshal.rb
index 54adace7d6..ae23223e15 100644
--- a/test/-ext-/marshal/test_usrmarshal.rb
+++ b/test/-ext-/marshal/test_usrmarshal.rb
@@ -21,8 +21,7 @@ module Bug::Marshal
end
def test_incompat
- e = assert_raise(ArgumentError) {::Marshal.load(old_dump)}
- assert_equal("dump format error", e.message)
+ assert_raise_with_message(ArgumentError, "dump format error") {::Marshal.load(old_dump)}
end
def test_compat
diff --git a/test/-ext-/num2int/test_num2int.rb b/test/-ext-/num2int/test_num2int.rb
index b69f29a516..f579659929 100644
--- a/test/-ext-/num2int/test_num2int.rb
+++ b/test/-ext-/num2int/test_num2int.rb
@@ -1,10 +1,7 @@
require 'test/unit'
+require '-test-/num2int/num2int'
class TestNum2int < Test::Unit::TestCase
- module Num2int
- end
- require '-test-/num2int/num2int'
-
SHRT_MIN = -32768
SHRT_MAX = 32767
USHRT_MAX = 65535
@@ -31,197 +28,240 @@ class TestNum2int < Test::Unit::TestCase
FIXNUM_MAX = LONG_MAX/2
FIXNUM_MIN = LONG_MIN/2
- def test_num2short
- assert_output(SHRT_MIN.to_s) do
- Num2int.print_num2short(SHRT_MIN)
+ def fix2big(n)
+ 10000000000000000000000000000.coerce(n)[0]
+ end
+
+ def assert_num2i_success_internal(exp, func, arg)
+ mesg = "#{func}(#{arg.inspect})"
+ out = nil
+ assert_nothing_raised(mesg) {
+ out = Num2int.send(func, arg)
+ }
+ assert_equal(exp, out, mesg)
+ end
+
+ def assert_num2i_success(type, num, result=num)
+ func = "NUM2#{type}".upcase
+ assert_num2i_success_internal(result.to_s, func, num)
+ assert_num2i_success_internal(result.to_s, func, fix2big(num))
+ assert_num2i_success_internal(result.to_s, func, Rational(num, 1))
+ if num.to_f.to_i == num
+ assert_num2i_success_internal(result.to_s, func, num.to_f)
+ end
+ # The conversion functions such as NUM2INT uses (conceptually) to_int.
+ if (arg = num.to_f + 0.5) != num.to_f && arg.to_int == num
+ assert_num2i_success_internal(result.to_s, func, arg)
end
- assert_output(SHRT_MAX.to_s) do
- Num2int.print_num2short(SHRT_MAX)
+ if (arg = num.to_f - 0.5) != num.to_f && arg.to_int == num
+ assert_num2i_success_internal(result.to_s, func, arg)
end
- assert_raise(RangeError) do
- Num2int.print_num2short(SHRT_MIN-1)
+ if (arg = num + Rational(1,2)) && arg.to_int == num
+ assert_num2i_success_internal(result.to_s, func, arg)
end
- assert_raise(RangeError) do
- Num2int.print_num2short(SHRT_MAX+1)
+ if (arg = num - Rational(1,2)) && arg.to_int == num
+ assert_num2i_success_internal(result.to_s, func, arg)
end
end
- def test_num2ushort
- assert_output("0") do
- Num2int.print_num2ushort(0)
- end
- assert_output(USHRT_MAX.to_s) do
- Num2int.print_num2ushort(USHRT_MAX)
+ def assert_num2i_error_internal(func, arg)
+ assert_raise(RangeError, "#{func}(#{arg.inspect})") {
+ Num2int.send(func, arg)
+ }
+ end
+
+ def assert_num2i_error(type, num)
+ func = "NUM2#{type}".upcase
+ assert_num2i_error_internal(func, num)
+ assert_num2i_error_internal(func, fix2big(num))
+ assert_num2i_error_internal(func, Rational(num, 1))
+ if num.to_f.to_i == num
+ assert_num2i_error_internal(func, num.to_f)
end
- assert_output(USHRT_MAX.to_s) do
- Num2int.print_num2ushort(-1)
+ # The conversion functions such as NUM2INT uses (conceptually) to_int.
+ if (arg = num.to_f + 0.5) != num.to_f && arg.to_int == num
+ assert_num2i_error_internal(func, arg)
end
- assert_output((SHRT_MAX+1).to_s) do
- Num2int.print_num2ushort(SHRT_MIN)
+ if (arg = num.to_f - 0.5) != num.to_f && arg.to_int == num
+ assert_num2i_error_internal(func, arg)
end
- assert_raise(RangeError) do
- Num2int.print_num2ushort(SHRT_MIN-1)
+ if (arg = num + Rational(1,2)) && arg.to_int == num
+ assert_num2i_error_internal(func, arg)
end
- assert_raise(RangeError) do
- Num2int.print_num2ushort(USHRT_MAX+1)
+ if (arg = num - Rational(1,2)) && arg.to_int == num
+ assert_num2i_error_internal(func, arg)
end
end
+ def assert_fix2i_success_internal(exp, func, arg)
+ mesg = "#{func}(#{arg.inspect})"
+ out = nil
+ assert_nothing_raised(mesg) {
+ out = Num2int.send(func, arg)
+ }
+ assert_equal(exp, out, mesg)
+ end
+
+ def assert_fix2i_success(type, num, result=num)
+ return if !num.kind_of?(Fixnum)
+ func = "FIX2#{type}".upcase
+ assert_fix2i_success_internal(result.to_s, func, num)
+ end
+
+ def assert_fix2i_error_internal(func, arg)
+ assert_raise(RangeError, "#{func}(#{arg.inspect})") {
+ Num2int.send(func, arg)
+ }
+ end
+
+ def assert_fix2i_error(type, num)
+ return if !num.kind_of?(Fixnum)
+ func = "FIX2#{type}".upcase
+ assert_num2i_error_internal(func, num)
+ end
+
+ def test_num2short
+ assert_num2i_success(:short, SHRT_MIN)
+ assert_num2i_success(:short, SHRT_MIN+1)
+ assert_num2i_success(:short, SHRT_MAX)
+ assert_num2i_error(:short, SHRT_MIN-1)
+ assert_num2i_error(:short, SHRT_MAX+1)
+ end
+
+ def test_num2ushort
+ assert_num2i_success(:ushort, 0)
+ assert_num2i_success(:ushort, USHRT_MAX)
+ assert_num2i_success(:ushort, -1, USHRT_MAX)
+ assert_num2i_success(:ushort, SHRT_MIN, SHRT_MAX+1)
+ assert_num2i_success(:ushort, SHRT_MIN+1, SHRT_MAX+2)
+ assert_num2i_error(:ushort, SHRT_MIN-1)
+ assert_num2i_error(:ushort, USHRT_MAX+1)
+ end
+
def test_num2int
- assert_output(INT_MIN.to_s) do
- Num2int.print_num2int(INT_MIN)
- end
- assert_output(INT_MAX.to_s) do
- Num2int.print_num2int(INT_MAX)
- end
- assert_raise(RangeError) do
- Num2int.print_num2int(INT_MIN-1)
- end
- assert_raise(RangeError) do
- Num2int.print_num2int(INT_MAX+1)
- end
+ assert_num2i_success(:int, INT_MIN)
+ assert_num2i_success(:int, INT_MIN+1)
+ assert_num2i_success(:int, INT_MAX)
+ assert_num2i_error(:int, INT_MIN-1)
+ assert_num2i_error(:int, INT_MAX+1)
end
def test_num2uint
- assert_output("0") do
- Num2int.print_num2uint(0)
- end
- assert_output(UINT_MAX.to_s) do
- Num2int.print_num2uint(UINT_MAX)
- end
- assert_output(UINT_MAX.to_s) do
- Num2int.print_num2uint(-1)
- end
- assert_output((INT_MAX+1).to_s) do
- Num2int.print_num2uint(INT_MIN)
- end
- assert_raise(RangeError) do
- Num2int.print_num2uint(INT_MIN-1)
- end
- assert_raise(RangeError) do
- Num2int.print_num2uint(UINT_MAX+1)
- end
+ assert_num2i_success(:uint, 0)
+ assert_num2i_success(:uint, UINT_MAX)
+ assert_num2i_success(:uint, -1, UINT_MAX)
+ assert_num2i_success(:uint, INT_MIN, INT_MAX+1)
+ assert_num2i_success(:uint, INT_MIN+1, INT_MAX+2)
+ assert_num2i_error(:uint, INT_MIN-1)
+ assert_num2i_error(:uint, UINT_MAX+1)
end
def test_num2long
- assert_output(LONG_MIN.to_s) do
- Num2int.print_num2long(LONG_MIN)
- end
- assert_output(LONG_MAX.to_s) do
- Num2int.print_num2long(LONG_MAX)
- end
- assert_raise(RangeError) do
- Num2int.print_num2long(LONG_MIN-1)
- end
- assert_raise(RangeError) do
- Num2int.print_num2long(LONG_MAX+1)
- end
- assert_output(FIXNUM_MIN.to_s) do
- Num2int.print_num2long(FIXNUM_MIN)
- end
- assert_output((FIXNUM_MIN-1).to_s) do
- Num2int.print_num2long(FIXNUM_MIN-1)
- end
- assert_output(FIXNUM_MAX.to_s) do
- Num2int.print_num2long(FIXNUM_MAX)
- end
- assert_output((FIXNUM_MAX+1).to_s) do
- Num2int.print_num2long(FIXNUM_MAX+1)
- end
+ assert_num2i_success(:long, LONG_MIN)
+ assert_num2i_success(:long, LONG_MIN+1)
+ assert_num2i_success(:long, LONG_MAX)
+ assert_num2i_error(:long, LONG_MIN-1)
+ assert_num2i_error(:long, LONG_MAX+1)
+ assert_num2i_success(:long, FIXNUM_MIN)
+ assert_num2i_success(:long, FIXNUM_MIN+1)
+ assert_num2i_success(:long, FIXNUM_MIN-1)
+ assert_num2i_success(:long, FIXNUM_MAX)
+ assert_num2i_success(:long, FIXNUM_MAX+1)
end
def test_num2ulong
- assert_output("0") do
- Num2int.print_num2ulong(0)
- end
- assert_output(ULONG_MAX.to_s) do
- Num2int.print_num2ulong(ULONG_MAX)
- end
- assert_output(ULONG_MAX.to_s) do
- Num2int.print_num2ulong(-1)
- end
- assert_output((LONG_MAX+1).to_s) do
- Num2int.print_num2ulong(LONG_MIN)
- end
- assert_raise(RangeError) do
- Num2int.print_num2ulong(LONG_MIN-1)
- end
- assert_raise(RangeError) do
- Num2int.print_num2ulong(ULONG_MAX+1)
- end
- assert_output((ULONG_MAX-FIXNUM_MAX).to_s) do
- Num2int.print_num2ulong(FIXNUM_MIN)
- end
- assert_output((ULONG_MAX-FIXNUM_MAX-1).to_s) do
- Num2int.print_num2ulong(FIXNUM_MIN-1)
- end
- assert_output(FIXNUM_MAX.to_s) do
- Num2int.print_num2ulong(FIXNUM_MAX)
- end
- assert_output((FIXNUM_MAX+1).to_s) do
- Num2int.print_num2ulong(FIXNUM_MAX+1)
- end
+ assert_num2i_success(:ulong, 0)
+ assert_num2i_success(:ulong, ULONG_MAX)
+ assert_num2i_success(:ulong, -1, ULONG_MAX)
+ assert_num2i_success(:ulong, LONG_MIN, LONG_MAX+1)
+ assert_num2i_success(:ulong, LONG_MIN+1, LONG_MAX+2)
+ assert_num2i_error(:ulong, LONG_MIN-1)
+ assert_num2i_error(:ulong, ULONG_MAX+1)
+ assert_num2i_success(:ulong, FIXNUM_MIN, ULONG_MAX-FIXNUM_MAX)
+ assert_num2i_success(:ulong, FIXNUM_MIN+1, ULONG_MAX-FIXNUM_MAX+1)
+ assert_num2i_success(:ulong, FIXNUM_MIN-1, ULONG_MAX-FIXNUM_MAX-1)
+ assert_num2i_success(:ulong, FIXNUM_MAX, FIXNUM_MAX)
+ assert_num2i_success(:ulong, FIXNUM_MAX+1, FIXNUM_MAX+1)
end
def test_num2ll
- assert_output(LONG_MIN.to_s) do
- Num2int.print_num2ll(LONG_MIN)
- end
- assert_output(LLONG_MAX.to_s) do
- Num2int.print_num2ll(LLONG_MAX)
- end
- assert_raise(RangeError) do
- Num2int.print_num2ll(LLONG_MIN-1)
- end
- assert_raise(RangeError) do
- Num2int.print_num2ll(LLONG_MAX+1)
- end
- assert_output(FIXNUM_MIN.to_s) do
- Num2int.print_num2ll(FIXNUM_MIN)
- end
- assert_output((FIXNUM_MIN-1).to_s) do
- Num2int.print_num2ll(FIXNUM_MIN-1)
- end
- assert_output(FIXNUM_MAX.to_s) do
- Num2int.print_num2ll(FIXNUM_MAX)
- end
- assert_output((FIXNUM_MAX+1).to_s) do
- Num2int.print_num2ll(FIXNUM_MAX+1)
- end
- end if defined?(Num2int.print_num2ll)
+ assert_num2i_success(:ll, LLONG_MIN)
+ assert_num2i_success(:ll, LLONG_MIN+1)
+ assert_num2i_success(:ll, LLONG_MAX)
+ assert_num2i_error(:ll, LLONG_MIN-1)
+ assert_num2i_error(:ll, LLONG_MAX+1)
+ assert_num2i_success(:ll, FIXNUM_MIN)
+ assert_num2i_success(:ll, FIXNUM_MIN+1)
+ assert_num2i_success(:ll, FIXNUM_MIN-1)
+ assert_num2i_success(:ll, FIXNUM_MAX)
+ assert_num2i_success(:ll, FIXNUM_MAX+1)
+ end if defined?(Num2int.NUM2LL)
def test_num2ull
- assert_output("0") do
- Num2int.print_num2ull(0)
- end
- assert_output(ULLONG_MAX.to_s) do
- Num2int.print_num2ull(ULLONG_MAX)
- end
- assert_output(ULLONG_MAX.to_s) do
- Num2int.print_num2ull(-1)
- end
- assert_output((LLONG_MAX+1).to_s) do
- Num2int.print_num2ull(LLONG_MIN)
- end
- assert_raise(RangeError) do
- Num2int.print_num2ull(LLONG_MIN-1)
- end
- assert_raise(RangeError) do
- Num2int.print_num2ull(ULLONG_MAX+1)
- end
- assert_output((ULLONG_MAX-FIXNUM_MAX).to_s) do
- Num2int.print_num2ull(FIXNUM_MIN)
- end
- assert_output((ULLONG_MAX-FIXNUM_MAX-1).to_s) do
- Num2int.print_num2ull(FIXNUM_MIN-1)
- end
- assert_output(FIXNUM_MAX.to_s) do
- Num2int.print_num2ull(FIXNUM_MAX)
- end
- assert_output((FIXNUM_MAX+1).to_s) do
- Num2int.print_num2ull(FIXNUM_MAX+1)
- end
- end if defined?(Num2int.print_num2ull)
+ assert_num2i_success(:ull, 0)
+ assert_num2i_success(:ull, ULLONG_MAX)
+ assert_num2i_success(:ull, -1, ULLONG_MAX)
+ assert_num2i_success(:ull, LLONG_MIN, LLONG_MAX+1)
+ assert_num2i_success(:ull, LLONG_MIN+1, LLONG_MAX+2)
+ assert_num2i_error(:ull, LLONG_MIN-1)
+ assert_num2i_error(:ull, ULLONG_MAX+1)
+ assert_num2i_success(:ull, FIXNUM_MIN, ULLONG_MAX-FIXNUM_MAX)
+ assert_num2i_success(:ull, FIXNUM_MIN+1, ULLONG_MAX-FIXNUM_MAX+1)
+ assert_num2i_success(:ull, FIXNUM_MIN-1, ULLONG_MAX-FIXNUM_MAX-1)
+ assert_num2i_success(:ull, FIXNUM_MAX)
+ assert_num2i_success(:ull, FIXNUM_MAX+1)
+ end if defined?(Num2int.NUM2ULL)
+
+ def test_fix2short
+ assert_fix2i_success(:short, 0)
+ assert_fix2i_success(:short, SHRT_MAX)
+ assert_fix2i_success(:short, SHRT_MIN)
+ assert_fix2i_success(:short, SHRT_MIN+1)
+ assert_fix2i_error(:short, SHRT_MAX+1)
+ assert_fix2i_error(:short, SHRT_MIN-1)
+ assert_fix2i_error(:short, FIXNUM_MAX)
+ assert_fix2i_error(:short, FIXNUM_MIN)
+ assert_fix2i_error(:short, FIXNUM_MIN+1)
+ end
+
+ def test_fix2int
+ assert_fix2i_success(:int, 0)
+ assert_fix2i_success(:int, INT_MAX)
+ assert_fix2i_success(:int, INT_MIN)
+ assert_fix2i_success(:int, INT_MIN+1)
+ assert_fix2i_error(:int, INT_MAX+1)
+ assert_fix2i_error(:int, INT_MIN-1)
+ assert_fix2i_error(:int, FIXNUM_MAX) if INT_MAX < FIXNUM_MAX
+ assert_fix2i_error(:int, FIXNUM_MIN) if FIXNUM_MIN < INT_MIN
+ assert_fix2i_error(:int, FIXNUM_MIN+1) if FIXNUM_MIN+1 < INT_MIN
+ end
+
+ def test_fix2uint
+ assert_fix2i_success(:uint, 0)
+ assert_fix2i_success(:uint, UINT_MAX)
+ assert_fix2i_success(:uint, INT_MAX)
+ assert_fix2i_success(:uint, INT_MIN, INT_MAX+1)
+ assert_fix2i_success(:uint, INT_MIN+1, INT_MAX+2)
+ assert_fix2i_error(:uint, UINT_MAX+1)
+ assert_fix2i_error(:uint, INT_MIN-1)
+ assert_fix2i_error(:uint, FIXNUM_MAX) if UINT_MAX < FIXNUM_MAX
+ assert_fix2i_error(:uint, FIXNUM_MIN) if FIXNUM_MIN < INT_MIN
+ assert_fix2i_error(:uint, FIXNUM_MIN+1) if FIXNUM_MIN+1 < INT_MIN
+ end
+
+ def test_fix2long
+ assert_fix2i_success(:long, 0)
+ assert_fix2i_success(:long, FIXNUM_MAX)
+ assert_fix2i_success(:long, FIXNUM_MIN)
+ assert_fix2i_success(:long, FIXNUM_MIN+1)
+ end
+
+ def test_fix2ulong
+ assert_fix2i_success(:ulong, 0)
+ assert_fix2i_success(:ulong, FIXNUM_MAX)
+ assert_fix2i_success(:ulong, -1, ULONG_MAX)
+ end
+
end
diff --git a/test/-ext-/old_thread_select/test_old_thread_select.rb b/test/-ext-/old_thread_select/test_old_thread_select.rb
deleted file mode 100644
index 340351a08e..0000000000
--- a/test/-ext-/old_thread_select/test_old_thread_select.rb
+++ /dev/null
@@ -1,100 +0,0 @@
-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/
-
- 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)
- assert_equal [ r.fileno ], rfds, bug5306
- assert_equal 1, rc, bug5306
- 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
- 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-/postponed_job/test_postponed_job.rb b/test/-ext-/postponed_job/test_postponed_job.rb
new file mode 100644
index 0000000000..032e35c055
--- /dev/null
+++ b/test/-ext-/postponed_job/test_postponed_job.rb
@@ -0,0 +1,28 @@
+require 'test/unit'
+require 'thread'
+require '-test-/postponed_job'
+
+module Bug
+ def self.postponed_job_call_direct_wrapper(*args)
+ postponed_job_call_direct(*args)
+ end
+
+ def self.postponed_job_register_wrapper(*args)
+ postponed_job_register(*args)
+ end
+end
+
+class TestPostponed_job < Test::Unit::TestCase
+ def test_register
+ direct, registered = [], []
+
+ Bug.postponed_job_call_direct_wrapper(direct)
+ Bug.postponed_job_register_wrapper(registered)
+
+ assert_match( /postponed_job_call_direct_wrapper/, direct.join)
+ assert_not_match( /postponed_job_register_wrapper/, registered.join)
+
+ Bug.postponed_job_register_one(ary = [])
+ assert_equal [1], ary
+ end
+end
diff --git a/test/-ext-/rational/test_rat.rb b/test/-ext-/rational/test_rat.rb
new file mode 100644
index 0000000000..ef7e7fe535
--- /dev/null
+++ b/test/-ext-/rational/test_rat.rb
@@ -0,0 +1,31 @@
+require 'test/unit'
+require "-test-/rational"
+
+class TestRational < Test::Unit::TestCase
+ class TestGCD < Test::Unit::TestCase
+
+ def test_gcd_normal
+ x = 2*2*3*3*3
+ y = 2*2*2*3*3
+ gcd = 2*2*3*3
+ assert_equal(gcd, x.gcd_normal(y))
+ end
+
+ def test_gcd_gmp
+ x = 2*2*3*3*3
+ y = 2*2*2*3*3
+ gcd = 2*2*3*3
+ assert_equal(gcd, x.gcd_gmp(y))
+ rescue NotImplementedError
+ end
+
+ def test_gcd_gmp_brute_force
+ -13.upto(13) {|x|
+ -13.upto(13) {|y|
+ assert_equal(x.gcd_normal(y), x.gcd_gmp(y))
+ }
+ }
+ rescue NotImplementedError
+ end
+ end
+end
diff --git a/test/-ext-/string/test_coderange.rb b/test/-ext-/string/test_coderange.rb
new file mode 100644
index 0000000000..83cebf19c0
--- /dev/null
+++ b/test/-ext-/string/test_coderange.rb
@@ -0,0 +1,59 @@
+# coding: ascii-8bit
+require 'test/unit'
+require "-test-/string/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 8c0bb136ad..f691da6f79 100644
--- a/test/-ext-/string/test_cstr.rb
+++ b/test/-ext-/string/test_cstr.rb
@@ -14,4 +14,29 @@ class Test_StringCStr < Test::Unit::TestCase
s = Bug::String.new("abcdef")*100000
assert_equal(0, s.cstr_term, Bug4319)
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))
+ assert_nothing_raised(ArgumentError) {s.cstr_term}
+ s.set_len(s.bytesize / 2)
+ assert_equal(1, s.size)
+ assert_equal(0, s.cstr_term)
+ end
+ end
+
+ def test_wchar_long
+ str = "\u{4022}abcdef"
+ n = 100
+ len = str.size * n
+ WCHARS.each do |enc|
+ s = Bug::String.new(str.encode(enc))*n
+ assert_nothing_raised(ArgumentError) {s.cstr_term}
+ s.set_len(s.bytesize / 2)
+ assert_equal(len / 2, s.size)
+ assert_equal(0, s.cstr_term)
+ end
+ end
end
diff --git a/test/-ext-/string/test_ellipsize.rb b/test/-ext-/string/test_ellipsize.rb
index 6ef7d0a1a3..2c14c0cf84 100644
--- a/test/-ext-/string/test_ellipsize.rb
+++ b/test/-ext-/string/test_ellipsize.rb
@@ -32,7 +32,7 @@ class Test_StringEllipsize < Test::Unit::TestCase
def test_nonascii
a = "\u3042"
- encs = Encoding.list.each do |enc|
+ Encoding.list.each do |enc|
next if enc.dummy?
begin
s = a.encode(enc)
diff --git a/test/-ext-/string/test_normalize.rb b/test/-ext-/string/test_normalize.rb
new file mode 100644
index 0000000000..283ca93db7
--- /dev/null
+++ b/test/-ext-/string/test_normalize.rb
@@ -0,0 +1,106 @@
+require 'test/unit'
+require "-test-/string/string"
+require "tempfile"
+
+class Test_StringNormalize < Test::Unit::TestCase
+=begin
+ def test_normalize_all
+ exclude = [
+ #0x340, 0x341, 0x343, 0x344
+ ]
+ (0x0080..0xFFFD).each do |n|
+ next if 0xD800 <= n && n <= 0xDFFF
+ next if exclude.include? n
+ code = n.to_s(16)
+ Tempfile.create("#{code}-#{n.chr(Encoding::UTF_8)}-") do |tempfile|
+ ary = Dir.glob(File.expand_path("../#{code}-*", tempfile.path))
+ assert_equal 1, ary.size
+ result = ary[0]
+ rn = result[/\/\h+-(.+?)-/, 1]
+ #assert_equal tempfile.path, result, "#{rn.dump} is not U+#{n.to_s(16)}"
+ r2 = Bug::String.new(result ).normalize_ospath
+ rn2 = r2[/\/\h+-(.+?)-/, 1]
+ if tempfile.path == result
+ if tempfile.path == r2
+ else
+ puts "U+#{n.to_s(16)} shouldn't be r2#{rn2.dump}"
+ end
+ else
+ if tempfile.path == r2
+ # puts "U+#{n.to_s(16)} shouldn't be r#{rn.dump}"
+ elsif result == r2
+ puts "U+#{n.to_s(16)} shouldn't be #{rn.dump}"
+ else
+ puts "U+#{n.to_s(16)} shouldn't be r#{rn.dump} r2#{rn2.dump}"
+ end
+ end
+ end
+ end
+ end
+=end
+
+ def test_normalize
+ %[
+ \u304C \u304B\u3099
+ \u3077 \u3075\u309A
+ \u308F\u3099 \u308F\u3099
+ \u30F4 \u30A6\u3099
+ \u30DD \u30DB\u309A
+ \u30AB\u303A \u30AB\u303A
+ \u00C1 A\u0301
+ B\u030A B\u030A
+ \u0386 \u0391\u0301
+ \u03D3 \u03D2\u0301
+ \u0401 \u0415\u0308
+ \u2260 =\u0338
+ \u{c548} \u{110b}\u{1161}\u{11ab}
+ ].scan(/(\S+)\s+(\S+)/) do |expected, src|
+ result = Bug::String.new(src).normalize_ospath
+ assert_equal expected, result,
+ "#{expected.dump} is expected but #{src.dump}"
+ end
+ rescue NotImplementedError
+ end
+
+ def test_not_normalize_kc
+ %[
+ \u2460
+ \u2162
+ \u3349
+ \u33A1
+ \u337B
+ \u2116
+ \u33CD
+ \u2121
+ \u32A4
+ \u3231
+ ].split.each do |src|
+ result = Bug::String.new(src).normalize_ospath
+ assert_equal src, result,
+ "#{src.dump} is expected not to be normalized, but #{result.dump}"
+ end
+ rescue NotImplementedError
+ end
+
+ def test_dont_normalize_hfsplus
+ %[
+ \u2190\u0338
+ \u219A
+ \u212B
+ \uF90A
+ \uF9F4
+ \uF961 \uF9DB
+ \uF96F \uF3AA
+ \uF915 \uF95C \uF9BF
+ \uFA0C
+ \uFA10
+ \uFA19
+ \uFA26
+ ].split.each do |src|
+ result = Bug::String.new(src).normalize_ospath
+ assert_equal src, result,
+ "#{src.dump} is expected not to be normalized, but #{result.dump}"
+ end
+ rescue NotImplementedError
+ end
+end
diff --git a/test/-ext-/struct/test_member.rb b/test/-ext-/struct/test_member.rb
new file mode 100644
index 0000000000..4e6295c218
--- /dev/null
+++ b/test/-ext-/struct/test_member.rb
@@ -0,0 +1,16 @@
+require 'test/unit'
+require "-test-/struct"
+require_relative '../../ruby/envutil'
+
+class Bug::Struct::Test_Member < Test::Unit::TestCase
+ S = Bug::Struct.new(:a)
+
+ def test_member_get
+ s = S.new(1)
+ assert_equal(1, s.get(:a))
+ assert_raise_with_message(NameError, /is not a struct member/) {s.get(:b)}
+ EnvUtil.with_default_external(Encoding::UTF_8) do
+ assert_raise_with_message(NameError, /\u{3042}/) {s.get(:"\u{3042}")}
+ end
+ end
+end
diff --git a/test/-ext-/symbol/test_inadvertent_creation.rb b/test/-ext-/symbol/test_inadvertent_creation.rb
index 7c0aaa89f0..465f032bbb 100644
--- a/test/-ext-/symbol/test_inadvertent_creation.rb
+++ b/test/-ext-/symbol/test_inadvertent_creation.rb
@@ -1,5 +1,5 @@
require 'test/unit'
-require "-test-/symbol/symbol"
+require "-test-/symbol"
module Test_Symbol
class TestInadvertent < Test::Unit::TestCase
@@ -7,7 +7,7 @@ module Test_Symbol
prefix += "_#{Thread.current.object_id.to_s(36).tr('-', '_')}"
begin
name = "#{prefix}_#{rand(0x1000).to_s(16)}_#{Time.now.usec}"
- end while Bug::Symbol.interned?(name)
+ end while Bug::Symbol.find(name)
name
end
@@ -16,7 +16,7 @@ module Test_Symbol
end
def assert_not_interned(name, msg = nil)
- assert_not_send([Bug::Symbol, :interned?, name], msg)
+ assert_not_send([Bug::Symbol, :find, name], msg)
end
def assert_not_interned_error(obj, meth, name, msg = nil)
@@ -139,7 +139,7 @@ module Test_Symbol
def test_public_send
name = noninterned_name
e = assert_raise(NoMethodError) {@obj.public_send(name, Feature5112)}
- assert_not_send([Bug::Symbol, :interned?, name])
+ assert_not_interned(name)
assert_equal(name, e.name)
assert_equal([Feature5112], e.args)
end
@@ -147,7 +147,7 @@ module Test_Symbol
def test_send
name = noninterned_name
e = assert_raise(NoMethodError) {@obj.send(name, Feature5112)}
- assert_not_send([Bug::Symbol, :interned?, name])
+ assert_not_interned(name)
assert_equal(name, e.name)
assert_equal([Feature5112], e.args)
end
@@ -155,9 +155,132 @@ module Test_Symbol
def test___send__
name = noninterned_name
e = assert_raise(NoMethodError) {@obj.__send__(name, Feature5112)}
- assert_not_send([Bug::Symbol, :interned?, name])
+ assert_not_interned(name)
assert_equal(name, e.name)
assert_equal([Feature5112], e.args)
end
+
+ def test_thread_aref
+ Thread.current[:test] = nil
+ name = noninterned_name
+ assert_nil(Thread.current[name])
+ assert_not_interned(name)
+ end
+
+ def test_thread_key?
+ Thread.current[:test] = nil
+ name = noninterned_name
+ assert_not_send([Thread.current, :key?, name])
+ assert_not_interned(name)
+ end
+
+ def test_thread_variable_get
+ Thread.current.thread_variable_set(:test, nil)
+ name = noninterned_name
+ assert_nil(Thread.current.thread_variable_get(name))
+ assert_not_interned(name)
+ end
+
+ def test_thread_variable?
+ Thread.current.thread_variable_set(:test, nil)
+ name = noninterned_name
+ assert_not_send([Thread.current, :thread_variable?, name])
+ assert_not_interned(name)
+ end
+
+ def test_enumerable_inject_op
+ name = noninterned_name
+ assert_raise(NoMethodError) {[1, 2].inject(name)}
+ assert_not_interned(name)
+ end
+
+ def test_module_const_set
+ name = noninterned_name
+ mod = Module.new
+ assert_raise(NameError) {mod.const_set(name, true)}
+ assert_not_interned(name)
+ end
+
+ def test_module_cvar_set
+ name = noninterned_name
+ mod = Module.new
+ assert_raise(NameError) {mod.class_variable_set(name, true)}
+ assert_not_interned(name)
+ end
+
+ def test_object_ivar_set
+ name = noninterned_name
+ obj = Object.new
+ assert_raise(NameError) {obj.instance_variable_set(name, true)}
+ assert_not_interned(name)
+ end
+
+ def test_struct_new
+ name = noninterned_name
+ assert_raise(NameError) {Struct.new(name)}
+ assert_not_interned(name)
+ end
+
+ def test_struct_aref
+ s = Struct.new(:foo).new
+ name = noninterned_name
+ assert_raise(NameError) {s[name]}
+ assert_not_interned(name)
+ end
+
+ def test_struct_aset
+ s = Struct.new(:foo).new
+ name = noninterned_name
+ assert_raise(NameError) {s[name] = true}
+ assert_not_interned(name)
+ end
+
+ def test_invalid_attr
+ name = noninterned_name("*")
+ mod = Module.new
+ assert_raise(NameError) {mod.module_eval {attr(name)}}
+ assert_not_interned(name)
+ end
+
+ def test_invalid_attr_reader
+ name = noninterned_name("*")
+ mod = Module.new
+ assert_raise(NameError) {mod.module_eval {attr_reader(name)}}
+ assert_not_interned(name)
+ end
+
+ def test_invalid_attr_writer
+ name = noninterned_name("*")
+ mod = Module.new
+ assert_raise(NameError) {mod.module_eval {attr_writer(name)}}
+ assert_not_interned(name)
+ end
+
+ def test_invalid_attr_accessor
+ name = noninterned_name("*")
+ mod = Module.new
+ assert_raise(NameError) {mod.module_eval {attr_accessor(name)}}
+ assert_not_interned(name)
+ end
+
+ def test_gc_attrset
+ assert_separately(['-r-test-/symbol', '-', '[ruby-core:62226] [Bug #9787]'], <<-'end;') # begin
+ bug = ARGV.shift
+ def noninterned_name(prefix = "")
+ prefix += "_#{Thread.current.object_id.to_s(36).tr('-', '_')}"
+ begin
+ name = "#{prefix}_#{rand(0x1000).to_s(16)}_#{Time.now.usec}"
+ end while Bug::Symbol.find(name) or Bug::Symbol.find(name + "=")
+ name
+ end
+ names = Array.new(1000) {noninterned_name("gc")}
+ names.each {|n| n.to_sym}
+ GC.start(immediate_sweep: false)
+ names.each do |n|
+ eval(":#{n}=")
+ assert_nothing_raised(TypeError, bug) {eval("proc{self.#{n} = nil}")}
+ end
+ end;
+ end
end
end
diff --git a/test/-ext-/symbol/test_type.rb b/test/-ext-/symbol/test_type.rb
new file mode 100644
index 0000000000..f1749f55da
--- /dev/null
+++ b/test/-ext-/symbol/test_type.rb
@@ -0,0 +1,124 @@
+require 'test/unit'
+require "-test-/symbol"
+
+module Test_Symbol
+ class TestType < Test::Unit::TestCase
+ def test_id2str_fstring_bug9171
+ fstr = eval("# encoding: us-ascii
+ 'foobar'.freeze")
+ assert_same fstr, Bug::Symbol.id2str(:foobar)
+
+ fstr = eval("# encoding: us-ascii
+ '>'.freeze")
+ assert_same fstr, Bug::Symbol.id2str(:>)
+ end
+
+ def assert_symtype(sym, pred, msg = nil)
+ assert_send([Bug::Symbol, pred, sym], msg)
+ end
+
+ def assert_not_symtype(sym, pred, msg = nil)
+ assert_not_send([Bug::Symbol, pred, sym], msg)
+ end
+
+ def test_const
+ assert_symtype("Foo", :const?)
+ assert_not_symtype("F!", :const?)
+ assert_not_symtype("foo", :const?)
+ assert_not_symtype("@foo", :const?)
+ assert_not_symtype("@@foo", :const?)
+ assert_not_symtype("$foo", :const?)
+ assert_not_symtype("foo=", :const?)
+ assert_not_symtype("[foo]", :const?)
+ assert_not_symtype("xFoo", :const?)
+ end
+
+ def test_local
+ assert_symtype("foo", :local?)
+ assert_symtype("fooBar", :local?)
+ assert_symtype("foo_bar", :local?)
+ assert_not_symtype("foo!", :local?)
+ assert_not_symtype("foo?", :local?)
+ assert_not_symtype("Foo", :local?)
+ assert_not_symtype("@foo", :local?)
+ assert_not_symtype("@@foo", :local?)
+ assert_not_symtype("$foo", :local?)
+ assert_not_symtype("foo=", :local?)
+ assert_not_symtype("[foo]", :local?)
+ end
+
+ def test_global
+ assert_symtype("$foo", :global?)
+ assert_symtype("$$", :global?)
+ assert_not_symtype("$()", :global?)
+ assert_not_symtype("$", :global?)
+ assert_not_symtype("foo", :global?)
+ assert_not_symtype("Foo", :global?)
+ assert_not_symtype("@foo", :global?)
+ assert_not_symtype("@@foo", :global?)
+ assert_not_symtype("foo=", :global?)
+ assert_not_symtype("[foo]", :global?)
+ end
+
+ def test_instance
+ assert_symtype("@foo", :instance?)
+ assert_not_symtype("@", :instance?)
+ assert_not_symtype("@1", :instance?)
+ assert_not_symtype("@@", :instance?)
+ assert_not_symtype("foo", :instance?)
+ assert_not_symtype("Foo", :instance?)
+ assert_not_symtype("@@foo", :instance?)
+ assert_not_symtype("$foo", :instance?)
+ assert_not_symtype("foo=", :instance?)
+ assert_not_symtype("[foo]", :instance?)
+ end
+
+ def test_class
+ assert_symtype("@@foo", :class?)
+ assert_not_symtype("@@", :class?)
+ assert_not_symtype("@", :class?)
+ assert_not_symtype("@@1", :class?)
+ assert_not_symtype("foo", :class?)
+ assert_not_symtype("Foo", :class?)
+ assert_not_symtype("@foo", :class?)
+ assert_not_symtype("$foo", :class?)
+ assert_not_symtype("foo=", :class?)
+ assert_not_symtype("[foo]", :class?)
+ end
+
+ def test_attrset
+ assert_symtype("foo=", :attrset?)
+ assert_symtype("Foo=", :attrset?)
+ assert_symtype("@foo=", :attrset?)
+ assert_symtype("@@foo=", :attrset?)
+ assert_symtype("$foo=", :attrset?)
+ assert_symtype("0=", :attrset?)
+ assert_symtype("@=", :attrset?)
+ assert_symtype("@@=", :attrset?)
+ assert_not_symtype("foo", :attrset?)
+ assert_not_symtype("Foo", :attrset?)
+ assert_not_symtype("@foo", :attrset?)
+ assert_not_symtype("@@foo", :attrset?)
+ assert_not_symtype("$foo", :attrset?)
+ assert_not_symtype("[foo]", :attrset?)
+ assert_symtype("[foo]=", :attrset?)
+ assert_equal(:"foo=", Bug::Symbol.attrset("foo"))
+ assert_symtype(Bug::Symbol.attrset("foo"), :attrset?)
+ assert_equal(:"Foo=", Bug::Symbol.attrset("Foo"))
+ assert_symtype(Bug::Symbol.attrset("Foo"), :attrset?)
+ assert_equal(:"@foo=", Bug::Symbol.attrset("@foo"))
+ assert_symtype(Bug::Symbol.attrset("@foo"), :attrset?)
+ assert_equal(:"@@foo=", Bug::Symbol.attrset("@@foo"))
+ assert_symtype(Bug::Symbol.attrset("@@foo"), :attrset?)
+ assert_equal(:"$foo=", Bug::Symbol.attrset("$foo"))
+ assert_symtype(Bug::Symbol.attrset("$foo"), :attrset?)
+ assert_equal(:"[foo]=", Bug::Symbol.attrset("[foo]"))
+ assert_symtype(Bug::Symbol.attrset("[foo]"), :attrset?)
+ assert_equal(:[]=, Bug::Symbol.attrset(:[]))
+ assert_symtype(Bug::Symbol.attrset("foo?="), :attrset?)
+ assert_equal(:"foo?=", Bug::Symbol.attrset(:foo?))
+ assert_symtype(Bug::Symbol.attrset("foo!="), :attrset?)
+ assert_equal(:"foo!=", Bug::Symbol.attrset(:foo!))
+ end
+ end
+end
diff --git a/test/-ext-/test_printf.rb b/test/-ext-/test_printf.rb
index 4b471ab5d9..235865dbdc 100644
--- a/test/-ext-/test_printf.rb
+++ b/test/-ext-/test_printf.rb
@@ -1,5 +1,6 @@
require 'test/unit'
require "-test-/printf"
+require_relative '../ruby/allpairs'
class Test_SPrintf < Test::Unit::TestCase
def to_s
@@ -22,6 +23,12 @@ class Test_SPrintf < Test::Unit::TestCase
assert_equal("{<#{self.class}:#{object_id}>}", Bug::Printf.v(self))
end
+ def test_quote
+ assert_equal('["\n"]', Bug::Printf.q("\n"))
+ assert_equal('[aaa]', Bug::Printf.q('aaa'))
+ assert_equal('[a a]', Bug::Printf.q('a a'))
+ end
+
def test_encoding
def self.to_s
"\u{3042 3044 3046 3048 304a}"
@@ -38,12 +45,146 @@ class Test_SPrintf < Test::Unit::TestCase
})
end
- def test_untrust
- obj = Object.new.untrust
- assert_equal({to_s: true, inspect: true},
- {
- to_s: Bug::Printf.s(obj).untrusted?,
- inspect: Bug::Printf.v(obj).untrusted?,
- })
+ VS = [
+ #-0x1000000000000000000000000000000000000000000000002,
+ #-0x1000000000000000000000000000000000000000000000001,
+ #-0x1000000000000000000000000000000000000000000000000,
+ #-0xffffffffffffffffffffffffffffffffffffffffffffffff,
+ #-0x1000000000000000000000002,
+ #-0x1000000000000000000000001,
+ #-0x1000000000000000000000000,
+ #-0xffffffffffffffffffffffff,
+ -0x10000000000000002,
+ -0x10000000000000001,
+ -0x10000000000000000,
+ -0xffffffffffffffff,
+ -0x4000000000000002,
+ -0x4000000000000001,
+ -0x4000000000000000,
+ -0x3fffffffffffffff,
+ -0x100000002,
+ -0x100000001,
+ -0x100000000,
+ -0xffffffff,
+ #-0xc717a08d, # 0xc717a08d * 0x524b2245 = 0x4000000000000001
+ -0x80000002,
+ -0x80000001,
+ -0x80000000,
+ -0x7fffffff,
+ #-0x524b2245,
+ -0x40000002,
+ -0x40000001,
+ -0x40000000,
+ -0x3fffffff,
+ #-0x10002,
+ #-0x10001,
+ #-0x10000,
+ #-0xffff,
+ #-0x8101, # 0x8101 * 0x7f01 = 0x40000001
+ #-0x8002,
+ #-0x8001,
+ #-0x8000,
+ #-0x7fff,
+ #-0x7f01,
+ #-65,
+ #-64,
+ #-63,
+ #-62,
+ #-33,
+ #-32,
+ #-31,
+ #-30,
+ -3,
+ -2,
+ -1,
+ 0,
+ 1,
+ 2,
+ 3,
+ #30,
+ #31,
+ #32,
+ #33,
+ #62,
+ #63,
+ #64,
+ #65,
+ #0x7f01,
+ #0x7ffe,
+ #0x7fff,
+ #0x8000,
+ #0x8001,
+ #0x8101,
+ #0xfffe,
+ #0xffff,
+ #0x10000,
+ #0x10001,
+ 0x3ffffffe,
+ 0x3fffffff,
+ 0x40000000,
+ 0x40000001,
+ #0x524b2245,
+ 0x7ffffffe,
+ 0x7fffffff,
+ 0x80000000,
+ 0x80000001,
+ #0xc717a08d,
+ 0xfffffffe,
+ 0xffffffff,
+ 0x100000000,
+ 0x100000001,
+ 0x3ffffffffffffffe,
+ 0x3fffffffffffffff,
+ 0x4000000000000000,
+ 0x4000000000000001,
+ 0xfffffffffffffffe,
+ 0xffffffffffffffff,
+ 0x10000000000000000,
+ 0x10000000000000001,
+ #0xffffffffffffffffffffffff,
+ #0x1000000000000000000000000,
+ #0x1000000000000000000000001,
+ #0xffffffffffffffffffffffffffffffffffffffffffffffff,
+ #0x1000000000000000000000000000000000000000000000000,
+ #0x1000000000000000000000000000000000000000000000001
+ ]
+ VS.reverse!
+
+ FLAGS = [[nil, ' '], [nil, '#'], [nil, '+'], [nil, '-'], [nil, '0']]
+
+ def self.assertions_format_integer(format, type, **opts)
+ proc {
+ VS.each {|v|
+ begin
+ r = Bug::Printf.(type, v, **opts)
+ rescue RangeError
+ else
+ e = sprintf format, v
+ assert_equal([e, format], r, "rb_sprintf(#{format.dump}, #{v})")
+ end
+ }
+ }
+ end
+
+ AllPairs.each(%w[d],
+ # octal and hexadecimal deal with negative values differently
+ [nil, 0, 5, 20],
+ [nil, true, 0], # 8, 20
+ *FLAGS) {
+ |type, width, prec, sp, hs, pl, mi, zr|
+ precision = ".#{prec unless prec == true}" if prec
+ format = "%#{sp}#{hs}#{pl}#{mi}#{zr}#{width}#{precision}#{type}"
+ define_method("test_format_integer(#{format})",
+ assertions_format_integer(format, type,
+ space: sp, hash: hs,
+ plus: pl, minus: mi,
+ zero: zr, width: width,
+ prec: prec))
+ }
+
+ def test_string_prec
+ assert_equal("a", Bug::Printf.("s", "a", prec: 3)[0])
+ assert_equal(" a", Bug::Printf.("s", "a", width: 3, prec: 3)[0])
+ assert_equal("a ", Bug::Printf.("s", "a", minus: true, width: 3, prec: 3)[0])
end
end
diff --git a/test/-ext-/test_recursion.rb b/test/-ext-/test_recursion.rb
new file mode 100644
index 0000000000..43a256f942
--- /dev/null
+++ b/test/-ext-/test_recursion.rb
@@ -0,0 +1,36 @@
+# -*- coding: us-ascii -*-
+require 'test/unit'
+require_relative '../ruby/envutil'
+
+class TestRecursion < Test::Unit::TestCase
+ require '-test-/recursion'
+
+ def setup
+ @obj = Struct.new(:visited).new(false)
+ @obj.extend(Bug::Recursive)
+ end
+
+ def test_recursive
+ def @obj.doit
+ self.visited = true
+ exec_recursive(:doit)
+ raise "recursive"
+ end
+ assert_raise_with_message(RuntimeError, "recursive") {
+ @obj.exec_recursive(:doit)
+ }
+ assert(@obj.visited, "obj.hash was not called")
+ end
+
+ def test_recursive_outer
+ def @obj.doit
+ self.visited = true
+ exec_recursive_outer(:doit)
+ raise "recursive_outer should short circuit intermediate calls"
+ end
+ assert_nothing_raised {
+ @obj.exec_recursive_outer(:doit)
+ }
+ assert(@obj.visited, "obj.hash was not called")
+ end
+end
diff --git a/test/-ext-/tracepoint/test_tracepoint.rb b/test/-ext-/tracepoint/test_tracepoint.rb
new file mode 100644
index 0000000000..cc630e895b
--- /dev/null
+++ b/test/-ext-/tracepoint/test_tracepoint.rb
@@ -0,0 +1,80 @@
+require 'test/unit'
+require '-test-/tracepoint'
+require_relative '../../ruby/envutil'
+
+class TestTracepointObj < Test::Unit::TestCase
+ def test_not_available_from_ruby
+ assert_raise ArgumentError do
+ TracePoint.trace(:obj_new){}
+ end
+ end
+
+ def test_tracks_objspace_events
+ result = Bug.tracepoint_track_objspace_events{
+ 99
+ 'abc'
+ _="foobar"
+ Object.new
+ nil
+ }
+
+ newobj_count, free_count, gc_start_count, gc_end_mark_count, gc_end_sweep_count, *newobjs = *result
+ assert_equal 2, newobj_count
+ assert_equal 2, newobjs.size
+ assert_equal 'foobar', newobjs[0]
+ assert_equal Object, newobjs[1].class
+ assert_operator free_count, :>=, 0
+ assert_operator gc_start_count, :==, gc_end_mark_count
+ assert_operator gc_start_count, :>=, gc_end_sweep_count
+ end
+
+ def test_tracks_objspace_count
+ stat1 = {}
+ stat2 = {}
+ GC.disable
+ GC.stat(stat1)
+ result = Bug.tracepoint_track_objspace_events{
+ GC.enable
+ 1_000_000.times{''}
+ GC.disable
+ }
+ GC.stat(stat2)
+ GC.enable
+
+ newobj_count, free_count, gc_start_count, gc_end_mark_count, gc_end_sweep_count, *newobjs = *result
+
+ assert_operator stat2[:total_allocated_objects] - stat1[:total_allocated_objects], :>=, newobj_count
+ assert_operator 1_000_000, :<=, newobj_count
+
+ assert_operator stat2[:total_freed_objects] + stat2[:heap_final_slots] - stat1[:total_freed_objects], :>=, free_count
+ assert_operator stat2[:count] - stat1[:count], :==, gc_start_count
+
+ assert_operator gc_start_count, :==, gc_end_mark_count
+ assert_operator gc_start_count, :>=, gc_end_sweep_count
+ assert_operator stat2[:count] - stat1[:count] - 1, :<=, gc_end_sweep_count
+ end
+
+ def test_tracepoint_specify_normal_and_internal_events
+ assert_raise(TypeError){ Bug.tracepoint_specify_normal_and_internal_events }
+ end
+
+ def test_after_gc_start_hook_with_GC_stress
+ bug8492 = '[ruby-dev:47400] [Bug #8492]: infinite after_gc_start_hook reentrance'
+ assert_nothing_raised(Timeout::Error, bug8492) do
+ assert_in_out_err(%w[-r-test-/tracepoint], <<-'end;', /\A[1-9]/, timeout: 2)
+ stress, GC.stress = GC.stress, false
+ count = 0
+ Bug.after_gc_start_hook = proc {count += 1}
+ begin
+ GC.stress = true
+ 3.times {Object.new}
+ ensure
+ GC.stress = stress
+ Bug.after_gc_start_hook = nil
+ end
+ puts count
+ end;
+ end
+ end
+
+end
diff --git a/test/-ext-/typeddata/test_typeddata.rb b/test/-ext-/typeddata/test_typeddata.rb
index 50505850d8..c24ad08004 100644
--- a/test/-ext-/typeddata/test_typeddata.rb
+++ b/test/-ext-/typeddata/test_typeddata.rb
@@ -3,19 +3,14 @@ require "-test-/typeddata/typeddata"
class Test_TypedData < Test::Unit::TestCase
def test_wrong_argtype
- e = assert_raise(TypeError) {Bug::TypedData.check(false)}
- assert_equal("wrong argument type false (expected typed_data)", e.message)
+ assert_raise_with_message(TypeError, "wrong argument type false (expected typed_data)") {Bug::TypedData.check(false)}
- e = assert_raise(TypeError) {Bug::TypedData.check(true)}
- assert_equal("wrong argument type true (expected typed_data)", e.message)
+ assert_raise_with_message(TypeError, "wrong argument type true (expected typed_data)") {Bug::TypedData.check(true)}
- e = assert_raise(TypeError) {Bug::TypedData.check(:e)}
- assert_equal("wrong argument type Symbol (expected typed_data)", e.message)
+ assert_raise_with_message(TypeError, "wrong argument type Symbol (expected typed_data)") {Bug::TypedData.check(:e)}
- e = assert_raise(TypeError) {Bug::TypedData.check(0)}
- assert_equal("wrong argument type Fixnum (expected typed_data)", e.message)
+ assert_raise_with_message(TypeError, "wrong argument type Fixnum (expected typed_data)") {Bug::TypedData.check(0)}
- e = assert_raise(TypeError) {Bug::TypedData.check("a")}
- assert_equal("wrong argument type String (expected typed_data)", e.message)
+ assert_raise_with_message(TypeError, "wrong argument type String (expected typed_data)") {Bug::TypedData.check("a")}
end
end
diff --git a/test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb b/test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb
index e181068611..e88dbefac6 100644
--- a/test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb
+++ b/test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb
@@ -27,7 +27,7 @@ class TestWaitForSingleFD < Test::Unit::TestCase
with_pipe do |r,w|
wfd = w.fileno
w.close
- assert_raises(Errno::EBADF) do
+ assert_raise(Errno::EBADF) do
IO.wait_for_single_fd(wfd, RB_WAITFD_OUT, nil)
end
end
diff --git a/test/-ext-/win32/test_console_attr.rb b/test/-ext-/win32/test_console_attr.rb
new file mode 100644
index 0000000000..3afb2d9378
--- /dev/null
+++ b/test/-ext-/win32/test_console_attr.rb
@@ -0,0 +1,43 @@
+if /mswin|mingw/ =~ RUBY_PLATFORM and STDOUT.tty?
+ require '-test-/win32/console'
+ require 'io/console'
+ require 'test/unit'
+
+ class Test_Win32Console < Test::Unit::TestCase
+ def reset
+ STDOUT.console_attribute(7)
+ end
+
+ alias setup reset
+ alias teardown reset
+
+ def test_default
+ info = STDOUT.console_info
+ assert_equal(7, info.attr);
+ end
+
+ def test_reverse
+ print "\e[7m"
+ info = STDOUT.console_info
+ assert_equal(0x70, info.attr);
+ end
+
+ def test_bold
+ print "\e[1m"
+ info = STDOUT.console_info
+ assert_equal(0x8, info.attr&0x8);
+ end
+
+ def test_bold_reverse
+ print "\e[1;7m"
+ info = STDOUT.console_info
+ assert_equal(0xf0, info.attr);
+ end
+
+ def test_reverse_bold
+ print "\e[7;1m"
+ info = STDOUT.console_info
+ assert_equal(0xf0, info.attr);
+ end
+ end
+end
diff --git a/test/-ext-/win32/test_dln.rb b/test/-ext-/win32/test_dln.rb
index 7c5fe61f59..c9065e66fb 100644
--- a/test/-ext-/win32/test_dln.rb
+++ b/test/-ext-/win32/test_dln.rb
@@ -1,4 +1,6 @@
require 'test/unit'
+require 'tmpdir'
+require 'rbconfig'
require_relative '../../ruby/envutil'
module Bug
@@ -8,6 +10,26 @@ module Bug
bug = '[Bug #6303]'
assert_in_out_err(['-r-test-/win32/dln', '-eexit'], '', [], [], bug, timeout: 10)
end
+
+ def test_nonascii_load
+ bug9699 = '[ruby-core:61845] [Bug #9699]'
+ so = "-test-/win32/dln/empty." + RbConfig::CONFIG["DLEXT"]
+ so = $:.find {|d| d = ::File.join(d, so); break d if ::File.exist?(d)}
+ assert_not_nil(so)
+ Dir.mkdir(dir = ::File.join(testdir = Dir.mktmpdir("test"), "\u{30c6 30b9 30c8}"))
+ ::File.copy_stream(so, ::File.join(dir, ::File.basename(so)))
+ assert_separately(['-', bug9699, testdir, ::File.basename(so)], <<-'end;')
+ bug, dir, so = *ARGV
+ assert_nothing_raised(LoadError, bug) do
+ require ::File.join(dir, "\u{30c6 30b9 30c8}", so)
+ end
+ end;
+ ensure
+ ::File.unlink(::File.join(dir, ::File.basename(so))) rescue nil
+ Dir.rmdir(dir) rescue nil
+ Dir.rmdir(testdir) rescue nil
+ end
+
end
end
end if /mswin|mingw/ =~ RUBY_PLATFORM
diff --git a/test/benchmark/test_benchmark.rb b/test/benchmark/test_benchmark.rb
index 7477fa8e05..1b9964eafa 100644
--- a/test/benchmark/test_benchmark.rb
+++ b/test/benchmark/test_benchmark.rb
@@ -1,10 +1,8 @@
-require 'minitest/spec'
+require 'test/unit'
require 'benchmark'
-MiniTest::Unit.autorun
-
-describe Benchmark do
- bench_for_times_upto = lambda do |x|
+class TestBenchmark < Test::Unit::TestCase
+ BENCH_FOR_TIMES_UPTO = lambda do |x|
n = 1000
tf = x.report("for:") { for _ in 1..n; '1'; end }
tt = x.report("times:") { n.times do ; '1'; end }
@@ -12,7 +10,7 @@ describe Benchmark do
[tf+tt+tu, (tf+tt+tu)/3]
end
- bench_for_times_upto_no_label = lambda do |x|
+ BENCH_FOR_TIMES_UPTO_NO_LABEL = lambda do |x|
n = 1000
x.report { for _ in 1..n; '1'; end }
x.report { n.times do ; '1'; end }
@@ -43,25 +41,23 @@ describe Benchmark do
capture_output { bench(type, *args, &block) }
end
- describe 'Tms' do
- it 'outputs nicely' do
- Benchmark::Tms.new.to_s.must_equal " 0.000000 0.000000 0.000000 ( 0.000000)\n"
- Benchmark::Tms.new(1,2,3,4,5).to_s.must_equal " 1.000000 2.000000 10.000000 ( 5.000000)\n"
- Benchmark::Tms.new(1,2,3,4,5,'label').format('%u %y %U %Y %t %r %n').must_equal \
- "1.000000 2.000000 3.000000 4.000000 10.000000 (5.000000) label"
- Benchmark::Tms.new(1).format('%u %.3f', 2).must_equal "1.000000 2.000"
- Benchmark::Tms.new(100, 150, 0, 0, 200).to_s.must_equal \
- "100.000000 150.000000 250.000000 (200.000000)\n"
- end
+ def test_tms_outputs_nicely
+ assert_equal(" 0.000000 0.000000 0.000000 ( 0.000000)\n", Benchmark::Tms.new.to_s)
+ assert_equal(" 1.000000 2.000000 10.000000 ( 5.000000)\n", Benchmark::Tms.new(1,2,3,4,5).to_s)
+ assert_equal("1.000000 2.000000 3.000000 4.000000 10.000000 (5.000000) label",
+ Benchmark::Tms.new(1,2,3,4,5,'label').format('%u %y %U %Y %t %r %n'))
+ assert_equal("1.000000 2.000", Benchmark::Tms.new(1).format('%u %.3f', 2))
+ assert_equal("100.000000 150.000000 250.000000 (200.000000)\n",
+ Benchmark::Tms.new(100, 150, 0, 0, 200).to_s)
+ end
- it 'wont modify the format String given' do
- format = "format %u"
- Benchmark::Tms.new.format(format)
- format.must_equal "format %u"
- end
+ def test_tms_wont_modify_the_format_String_given
+ format = "format %u"
+ Benchmark::Tms.new.format(format)
+ assert_equal("format %u", format)
end
- benchmark_output_with_total_avg = <<BENCH
+ BENCHMARK_OUTPUT_WITH_TOTAL_AVG = <<BENCH
user system total real
for: --time-- --time-- --time-- ( --time--)
times: --time-- --time-- --time-- ( --time--)
@@ -70,64 +66,61 @@ upto: --time-- --time-- --time-- ( --time--)
>avg: --time-- --time-- --time-- ( --time--)
BENCH
- describe 'benchmark' do
- it 'does not print any space if the given caption is empty' do
- capture_bench_output(:benchmark).must_equal <<-BENCH
+ def test_benchmark_does_not_print_any_space_if_the_given_caption_is_empty
+ assert_equal(<<-BENCH, capture_bench_output(:benchmark))
first --time-- --time-- --time-- ( --time--)
second --time-- --time-- --time-- ( --time--)
third --time-- --time-- --time-- ( --time--)
BENCH
- end
+ end
- it 'makes extra calcultations with an Array at the end of the benchmark and show the result' do
+ def test_benchmark_makes_extra_calcultations_with_an_Array_at_the_end_of_the_benchmark_and_show_the_result
+ assert_equal(BENCHMARK_OUTPUT_WITH_TOTAL_AVG,
capture_bench_output(:benchmark,
Benchmark::CAPTION, 7,
Benchmark::FORMAT, ">total:", ">avg:",
- &bench_for_times_upto).must_equal benchmark_output_with_total_avg
- end
+ &BENCH_FOR_TIMES_UPTO))
end
- describe 'bm' do
- it "returns an Array of the times with the labels" do
- [:bm, :bmbm].each do |meth|
- capture_io do
- results = bench(meth)
- results.must_be_instance_of Array
- results.size.must_equal labels.size
- results.zip(labels).each { |tms, label|
- tms.must_be_instance_of Benchmark::Tms
- tms.label.must_equal label
- }
- end
+ def test_bm_returns_an_Array_of_the_times_with_the_labels
+ [:bm, :bmbm].each do |meth|
+ capture_io do
+ results = bench(meth)
+ assert_instance_of(Array, results)
+ assert_equal(labels.size, results.size)
+ results.zip(labels).each { |tms, label|
+ assert_instance_of(Benchmark::Tms, tms)
+ assert_equal(label, tms.label)
+ }
end
end
+ end
- it 'correctly output when the label width is given' do
- capture_bench_output(:bm, 6).must_equal <<-BENCH
+ def test_bm_correctly_output_when_the_label_width_is_given
+ assert_equal(<<-BENCH, capture_bench_output(:bm, 6))
user system total real
first --time-- --time-- --time-- ( --time--)
second --time-- --time-- --time-- ( --time--)
third --time-- --time-- --time-- ( --time--)
BENCH
- end
+ end
- it 'correctly output when no label is given' do
- capture_bench_output(:bm, &bench_for_times_upto_no_label).must_equal <<-BENCH
+ def test_bm_correctly_output_when_no_label_is_given
+ assert_equal(<<-BENCH, capture_bench_output(:bm, &BENCH_FOR_TIMES_UPTO_NO_LABEL))
user system total real
--time-- --time-- --time-- ( --time--)
--time-- --time-- --time-- ( --time--)
--time-- --time-- --time-- ( --time--)
BENCH
- end
+ end
- it 'can make extra calcultations with an array at the end of the benchmark' do
+ def test_bm_can_make_extra_calcultations_with_an_array_at_the_end_of_the_benchmark
+ assert_equal(BENCHMARK_OUTPUT_WITH_TOTAL_AVG,
capture_bench_output(:bm, 7, ">total:", ">avg:",
- &bench_for_times_upto).must_equal benchmark_output_with_total_avg
- end
+ &BENCH_FOR_TIMES_UPTO))
end
- describe 'bmbm' do
- bmbm_output = <<BENCH
+ BMBM_OUTPUT = <<BENCH
Rehearsal ------------------------------------------
first --time-- --time-- --time-- ( --time--)
second --time-- --time-- --time-- ( --time--)
@@ -140,30 +133,29 @@ second --time-- --time-- --time-- ( --time--)
third --time-- --time-- --time-- ( --time--)
BENCH
- it 'correctly guess the label width even when not given' do
- capture_bench_output(:bmbm).must_equal bmbm_output
- end
+ def test_bmbm_correctly_guess_the_label_width_even_when_not_given
+ assert_equal(BMBM_OUTPUT, capture_bench_output(:bmbm))
+ end
- it 'correctly output when the label width is given (bmbm ignore it, but it is a frequent mistake)' do
- capture_bench_output(:bmbm, 6).must_equal bmbm_output
- end
+ def test_bmbm_correctly_output_when_the_label_width_is_given__bmbm_ignore_it__but_it_is_a_frequent_mistake
+ assert_equal(BMBM_OUTPUT, capture_bench_output(:bmbm, 6))
end
- describe 'Report' do
- describe '#item' do
- it 'shows the title, even if not a string' do
- capture_bench_output(:bm) { |x| x.report(:title) {} }.must_include 'title'
- capture_bench_output(:bmbm) { |x| x.report(:title) {} }.must_include 'title'
- end
- end
+ def test_report_item_shows_the_title__even_if_not_a_string
+ assert_operator(capture_bench_output(:bm) { |x| x.report(:title) {} }, :include?, 'title')
+ assert_operator(capture_bench_output(:bmbm) { |x| x.report(:title) {} }, :include?, 'title')
end
- describe 'Bugs' do
- it '[ruby-dev:40906] can add in-place the time of execution of the block given' do
- t = Benchmark::Tms.new
- t.real.must_equal 0
- t.add! { sleep 0.1 }
- t.real.wont_equal 0
- end
+ def test_bugs_ruby_dev_40906_can_add_in_place_the_time_of_execution_of_the_block_given
+ t = Benchmark::Tms.new
+ assert_equal(0, t.real)
+ t.add! { sleep 0.1 }
+ assert_not_equal(0, t.real)
+ end
+
+ def test_realtime_output
+ sleeptime = 1.0
+ realtime = Benchmark.realtime { sleep sleeptime }
+ assert_operator sleeptime, :<, realtime
end
end
diff --git a/test/bigdecimal/test_bigdecimal.rb b/test/bigdecimal/test_bigdecimal.rb
index 5cbafdafd4..02bb5a5175 100644
--- a/test/bigdecimal/test_bigdecimal.rb
+++ b/test/bigdecimal/test_bigdecimal.rb
@@ -1,5 +1,6 @@
require_relative "testbase"
require_relative "../ruby/envutil"
+require 'bigdecimal/math'
require 'thread'
@@ -85,6 +86,9 @@ class TestBigDecimal < Test::Unit::TestCase
assert_raise(ArgumentError) { BigDecimal(0.1) }
assert_raise(ArgumentError) { BigDecimal(0.1, Float::DIG + 2) }
assert_nothing_raised { BigDecimal(0.1, Float::DIG + 1) }
+
+ bug9214 = '[ruby-core:58858]'
+ assert_equal(BigDecimal(-0.0, Float::DIG).sign, -1, bug9214)
end
def test_global_new_with_big_decimal
@@ -434,6 +438,20 @@ class TestBigDecimal < Test::Unit::TestCase
assert_equal(0, BigDecimal("1E-1") <=> 10**(-1), '#4825')
end
+ def test_cmp_issue9192
+ bug9192 = '[ruby-core:58756] [#9192]'
+ operators = { :== => :==, :< => :>, :> => :<, :<= => :>=, :>= => :<= }
+ 5.upto(8) do |i|
+ s = "706.0#{i}"
+ d = BigDecimal(s)
+ f = s.to_f
+ operators.each do |op, inv|
+ assert_equal(d.send(op, f), f.send(inv, d),
+ "(BigDecimal(#{s.inspect}) #{op} #{s}) and (#{s} #{inv} BigDecimal(#{s.inspect})) is different #{bug9192}")
+ end
+ end
+ end
+
def test_cmp_nan
n1 = BigDecimal.new("1")
BigDecimal.mode(BigDecimal::EXCEPTION_NaN, false)
@@ -604,8 +622,8 @@ class TestBigDecimal < Test::Unit::TestCase
def test_coerce
a, b = BigDecimal.new("1").coerce(1.0)
- assert_instance_of(Float, a)
- assert_instance_of(Float, b)
+ assert_instance_of(BigDecimal, a)
+ assert_instance_of(BigDecimal, b)
assert_equal(2, 1 + BigDecimal.new("1"), '[ruby-core:25697]')
a, b = BigDecimal("1").coerce(1.quo(10))
@@ -683,6 +701,10 @@ class TestBigDecimal < Test::Unit::TestCase
assert_equal(BigDecimal::SIGN_NEGATIVE_ZERO, (BigDecimal.new("-0") / 1).sign)
assert_equal(2, BigDecimal.new("2") / 1)
assert_equal(-2, BigDecimal.new("2") / -1)
+
+ assert_equal(BigDecimal('1486.868686869'), BigDecimal('1472.0') / BigDecimal('0.99'), '[ruby-core:59365] [#9316]')
+
+ assert_equal(4.124045235, BigDecimal('0.9932') / (700 * BigDecimal('0.344045') / BigDecimal('1000.0')), '[#9305]')
end
def test_div_with_float
@@ -803,6 +825,20 @@ class TestBigDecimal < Test::Unit::TestCase
assert_equal(1, BigDecimal.new("1").sqrt(1))
end
+ def test_sqrt_5266
+ x = BigDecimal('2' + '0'*100)
+ assert_equal('0.14142135623730950488016887242096980785696718753769480731',
+ x.sqrt(56).to_s(56).split(' ')[0])
+ assert_equal('0.1414213562373095048801688724209698078569671875376948073',
+ x.sqrt(55).to_s(55).split(' ')[0])
+
+ x = BigDecimal('2' + '0'*200)
+ assert_equal('0.14142135623730950488016887242096980785696718753769480731766797379907324784621070388503875343276415727350138462',
+ x.sqrt(110).to_s(110).split(' ')[0])
+ assert_equal('0.1414213562373095048801688724209698078569671875376948073176679737990732478462107038850387534327641572735013846',
+ x.sqrt(109).to_s(109).split(' ')[0])
+ end
+
def test_fix
x = BigDecimal.new("1.1")
assert_equal(1, x.fix)
@@ -1108,6 +1144,9 @@ class TestBigDecimal < Test::Unit::TestCase
e = BigDecimal("2.71828182845904523536028747135266249775724709369996")
pow = BigDecimal("22.459157718361045473")
assert_equal(pow, pi.power(e, 20))
+
+ b = BigDecimal('1.034482758620689655172413793103448275862068965517241379310344827586206896551724')
+ assert_equal(BigDecimal('0.114523E1'), b.power(4, 5), '[Bug #8818] [ruby-core:56802]')
end
def test_limit
@@ -1116,6 +1155,25 @@ class TestBigDecimal < Test::Unit::TestCase
assert_equal(90, x ** 4) # OK? must it be 80?
# 3 * 3 * 3 * 3 = 10 * 3 * 3 = 30 * 3 = 90 ???
assert_raise(ArgumentError) { BigDecimal.limit(-1) }
+
+ bug7458 = '[ruby-core:50269] [#7458]'
+ one = BigDecimal('1')
+ epsilon = BigDecimal('0.7E-18')
+ BigDecimal.save_limit do
+ BigDecimal.limit(0)
+ assert_equal(BigDecimal("1.0000000000000000007"), one + epsilon, "limit(0) #{bug7458}")
+
+ 1.upto(18) do |lim|
+ BigDecimal.limit(lim)
+ assert_equal(BigDecimal("1.0"), one + epsilon, "limit(#{lim}) #{bug7458}")
+ end
+
+ BigDecimal.limit(19)
+ assert_equal(BigDecimal("1.000000000000000001"), one + epsilon, "limit(19) #{bug7458}")
+
+ BigDecimal.limit(20)
+ assert_equal(BigDecimal("1.0000000000000000007"), one + epsilon, "limit(20) #{bug7458}")
+ end
end
def test_sign
@@ -1321,12 +1379,24 @@ class TestBigDecimal < Test::Unit::TestCase
EOS
end
+ def test_BigMath_log_with_string
+ assert_raise(ArgumentError) do
+ BigMath.log("foo", 20)
+ end
+ end
+
def test_BigMath_log_with_nil
assert_raise(ArgumentError) do
BigMath.log(nil, 20)
end
end
+ def test_BigMath_log_with_non_integer_precision
+ assert_raise(ArgumentError) do
+ BigMath.log(1, 0.5)
+ end
+ end
+
def test_BigMath_log_with_nil_precision
assert_raise(ArgumentError) do
BigMath.log(1, nil)
@@ -1339,7 +1409,19 @@ class TestBigDecimal < Test::Unit::TestCase
end
end
- def test_BigMath_log_with_zerp_precision
+ def test_BigMath_log_with_zero_arg
+ assert_raise(Math::DomainError) do
+ BigMath.log(0, 20)
+ end
+ end
+
+ def test_BigMath_log_with_negative_arg
+ assert_raise(Math::DomainError) do
+ BigMath.log(-1, 20)
+ end
+ end
+
+ def test_BigMath_log_with_zero_precision
assert_raise(ArgumentError) do
BigMath.log(1, 0)
end
@@ -1375,6 +1457,13 @@ class TestBigDecimal < Test::Unit::TestCase
end
end
+ def test_BigMath_log_with_float_nan
+ BigDecimal.save_exception_mode do
+ BigDecimal.mode(BigDecimal::EXCEPTION_NaN, false)
+ assert(BigMath.log(Float::NAN, 20).nan?)
+ end
+ end
+
def test_BigMath_log_with_1
assert_in_delta(0.0, BigMath.log(1, 20))
assert_in_delta(0.0, BigMath.log(1.0, 20))
@@ -1382,7 +1471,7 @@ class TestBigDecimal < Test::Unit::TestCase
end
def test_BigMath_log_with_exp_1
- assert_in_delta(1.0, BigMath.log(BigMath.exp(1, 20), 20))
+ assert_in_delta(1.0, BigMath.log(BigMath.E(10), 10))
end
def test_BigMath_log_with_2
@@ -1391,8 +1480,15 @@ class TestBigDecimal < Test::Unit::TestCase
assert_in_delta(Math.log(2), BigMath.log(BigDecimal(2), 20))
end
- def test_BigMath_log_with_square_of_exp_2
- assert_in_delta(2, BigMath.log(BigMath.exp(1, 20)**2, 20))
+ def test_BigMath_log_with_square_of_E
+ assert_in_delta(2, BigMath.log(BigMath.E(20)**2, 20))
+ end
+
+ def test_BigMath_log_with_high_precision_case
+ e = BigDecimal('2.71828182845904523536028747135266249775724709369996')
+ e_3 = e.mult(e, 50).mult(e, 50)
+ log_3 = BigMath.log(e_3, 50)
+ assert_in_delta(3, log_3, 0.0000000000_0000000000_0000000000_0000000000_0000000001)
end
def test_BigMath_log_with_42
@@ -1401,6 +1497,11 @@ class TestBigDecimal < Test::Unit::TestCase
assert_in_delta(Math.log(42), BigMath.log(BigDecimal(42), 20))
end
+ def test_BigMath_log_with_101
+ # this is mainly a performance test (should be very fast, not the 0.3 s)
+ assert_in_delta(Math.log(101), BigMath.log(101, 20), 1E-15)
+ end
+
def test_BigMath_log_with_reciprocal_of_42
assert_in_delta(Math.log(1e-42), BigMath.log(1e-42, 20))
assert_in_delta(Math.log(1e-42), BigMath.log(BigDecimal("1e-42"), 20))
diff --git a/test/bigdecimal/test_bigdecimal_util.rb b/test/bigdecimal/test_bigdecimal_util.rb
index 72342b922f..e4d64006ab 100644
--- a/test/bigdecimal/test_bigdecimal_util.rb
+++ b/test/bigdecimal/test_bigdecimal_util.rb
@@ -14,9 +14,13 @@ class TestBigDecimalUtil < Test::Unit::TestCase
end
def test_Float_to_d_without_precision
- delta = 1.0/10**(Float::DIG + 1)
- assert_in_delta(BigDecimal(0.5, Float::DIG+1), 0.5.to_d, delta)
- assert_in_delta(BigDecimal(355.0/113.0, Float::DIG+1), (355.0/113.0).to_d, delta)
+ delta = 1.0/10**(Float::DIG)
+ assert_in_delta(BigDecimal(0.5, Float::DIG), 0.5.to_d, delta)
+ assert_in_delta(BigDecimal(355.0/113.0, Float::DIG), (355.0/113.0).to_d, delta)
+ assert_equal(9.05.to_d.to_s('F'), "9.05")
+
+ bug9214 = '[ruby-core:58858]'
+ assert_equal((-0.0).to_d.sign, -1, bug9214)
end
def test_Float_to_d_with_precision
@@ -24,6 +28,9 @@ class TestBigDecimalUtil < Test::Unit::TestCase
delta = 1.0/10**(digits)
assert_in_delta(BigDecimal(0.5, 5), 0.5.to_d(digits), delta)
assert_in_delta(BigDecimal(355.0/113.0, 5), (355.0/113.0).to_d(digits), delta)
+
+ bug9214 = '[ruby-core:58858]'
+ assert_equal((-0.0).to_d(digits).sign, -1, bug9214)
end
def test_Rational_to_d
diff --git a/test/bigdecimal/test_bigmath.rb b/test/bigdecimal/test_bigmath.rb
index 2ccdb510f9..88c2e2e120 100644
--- a/test/bigdecimal/test_bigmath.rb
+++ b/test/bigdecimal/test_bigmath.rb
@@ -1,4 +1,5 @@
require_relative "testbase"
+require_relative "../ruby/envutil"
require "bigdecimal/math"
class TestBigMath < Test::Unit::TestCase
@@ -60,4 +61,21 @@ class TestBigMath < Test::Unit::TestCase
assert_equal(BigDecimal("0.823840753418636291769355073102514088959345624027952954058347023122539489"),
atan(BigDecimal("1.08"), 72).round(72), '[ruby-dev:41257]')
end
+
+ def test_log
+ assert_equal(0, BigMath.log(BigDecimal("1.0"), 10))
+ assert_in_epsilon(Math.log(10)*1000, BigMath.log(BigDecimal("1e1000"), 10))
+ assert_raise(Math::DomainError) {BigMath.log(BigDecimal("0"), 10)}
+ assert_raise(Math::DomainError) {BigMath.log(BigDecimal("-1"), 10)}
+ assert_separately(%w[-rbigdecimal], <<-SRC)
+ begin
+ x = BigMath.log(BigDecimal("1E19999999999999"), 10)
+ rescue FloatDomainError
+ else
+ unless x.infinite?
+ assert_in_epsilon(Math.log(10)*19999999999999, x)
+ end
+ end
+ SRC
+ end
end
diff --git a/test/cgi/test_cgi_core.rb b/test/cgi/test_cgi_core.rb
index 123caf7acd..274d088f0f 100644
--- a/test/cgi/test_cgi_core.rb
+++ b/test/cgi/test_cgi_core.rb
@@ -31,7 +31,7 @@ class CGICoreTest < Test::Unit::TestCase
}
ENV.update(@environ)
cgi = CGI.new
- assert_equal(["a","b","c","d"],cgi.keys.sort) if RUBY_VERSION>="1.9"
+ assert_equal(["a","b","c","d"],cgi.keys.sort)
assert_equal("",cgi["d"])
end
@@ -48,27 +48,6 @@ class CGICoreTest < Test::Unit::TestCase
## cgi[]
assert_equal('123', cgi['id'])
assert_equal('@h =~ /^$/', cgi['str'])
- ## cgi[][], cgi[].first, cgi[].to_ary (obsolete 1.9)
- if RUBY_VERSION<"1.9"
- $stderr = StringIO.new
- begin
- assert_equal('123', cgi['id'][0])
- assert_equal('456', cgi['id'][1])
- assert_equal('', cgi['id'][2])
- assert_nil(cgi['id'][3])
- assert_equal('@h =~ /^$/', cgi['str'][0])
- assert_nil(cgi['str'][1])
- assert_equal('123', cgi['id'].first)
- assert_equal('123', cgi['id'].last) # should be '' ?
- id1, id2, id3 = cgi['id']
- assert_equal(['123', '456', ''], [id1, id2, id3])
- str1, = cgi['str']
- assert_equal('@h =~ /^$/', str1)
- assert_not_same(str1, cgi['str']) # necessary?
- ensure
- $stderr = STDERR
- end
- end
## cgi.params
assert_equal(['123', '456', ''], cgi.params['id'])
assert_equal(['@h =~ /^$/'], cgi.params['str'])
@@ -199,48 +178,8 @@ class CGICoreTest < Test::Unit::TestCase
}
ENV.update(@environ)
cgi = CGI.new
- ## jis, euc, sjis string
- jis_str = "\e$B8+$m!\"?M$,%4%_$N$h$&$@\e(B"
+ ## euc string
euc_str = "\270\253\244\355\241\242\277\315\244\254\245\264\245\337\244\316\244\350\244\246\244\300"
- sjis_str = "\214\251\202\353\201A\220l\202\252\203S\203~\202\314\202\346\202\244\202\276"
- if RUBY_VERSION<"1.9"
- ## iso-2022-jp
- options = { 'charset'=>'iso-2022-jp' }
- $stdout = StringIO.new
- cgi.out(options) { euc_str }
- assert_equal('ja', options['language'])
- actual = $stdout.string
- expected = "Content-Type: text/html; charset=iso-2022-jp\r\n" +
- "Content-Length: 28\r\n" +
- "Content-Language: ja\r\n" +
- "\r\n" +
- jis_str
- assert_equal(expected,actual)
- ## euc-jp
- options = { 'charset'=>'EUC-JP' }
- $stdout = StringIO.new
- cgi.out(options) { euc_str }
- assert_equal('ja', options['language'])
- actual = $stdout.string
- expected = "Content-Type: text/html; charset=EUC-JP\r\n" +
- "Content-Length: 22\r\n" +
- "Content-Language: ja\r\n" +
- "\r\n" +
- euc_str
- assert_equal(expected, actual)
- ## shift_jis
- options = { 'charset'=>'Shift_JIS' }
- $stdout = StringIO.new
- cgi.out(options) { euc_str }
- assert_equal('ja', options['language'])
- actual = $stdout.string
- expected = "Content-Type: text/html; charset=Shift_JIS\r\n" +
- "Content-Length: 22\r\n" +
- "Content-Language: ja\r\n" +
- "\r\n" +
- sjis_str
- assert_equal(expected, actual)
- end
## utf8 (not converted)
options = { 'charset'=>'utf8' }
$stdout = StringIO.new
diff --git a/test/cgi/test_cgi_header.rb b/test/cgi/test_cgi_header.rb
index c6306eb0ff..9022301153 100644
--- a/test/cgi/test_cgi_header.rb
+++ b/test/cgi/test_cgi_header.rb
@@ -71,12 +71,8 @@ class CGIHeaderTest < Test::Unit::TestCase
def test_cgi_http_header_argerr
cgi = CGI.new
- #expected = NoMethodError # must be ArgumentError
- if RUBY_VERSION>="1.9.0"
- expected = ArgumentError # for CGIAlt
- else
- expected = NoMethodError # for Ruby1.8
- end
+ expected = ArgumentError
+
assert_raise(expected) do
cgi.http_header(nil)
end
diff --git a/test/cgi/test_cgi_multipart.rb b/test/cgi/test_cgi_multipart.rb
index ea40535dfd..806adbd013 100644
--- a/test/cgi/test_cgi_multipart.rb
+++ b/test/cgi/test_cgi_multipart.rb
@@ -118,7 +118,7 @@ class CGIMultipartTest < Test::Unit::TestCase
$stdin.close() if $stdin.is_a?(Tempfile)
$stdin = STDIN
@tempfiles.each {|t|
- t.unlink
+ t.close!
}
end
@@ -145,29 +145,27 @@ class CGIMultipartTest < Test::Unit::TestCase
$stdin = tmpfile
end
- def _test_multipart
+ def _test_multipart(cgi_options={})
caller(0).find {|s| s =~ /in `test_(.*?)'/ }
#testname = $1
#$stderr.puts "*** debug: testname=#{testname.inspect}"
_prepare(@data)
- cgi = RUBY_VERSION>="1.9" ? CGI.new(:accept_charset=>"UTF-8") : CGI.new
+ options = {:accept_charset=>"UTF-8"}
+ options.merge! cgi_options
+ cgi = CGI.new(options)
expected_names = @data.collect{|hash| hash[:name] }.sort
assert_equal(expected_names, cgi.params.keys.sort)
threshold = 1024*10
@data.each do |hash|
name = hash[:name]
expected = hash[:value]
- if RUBY_VERSION>="1.9"
- if hash[:filename] #if file
- expected_class = @expected_class || (hash[:value].length < threshold ? StringIO : Tempfile)
- assert(cgi.files.keys.member?(hash[:name]))
- else
- expected_class = String
- assert_equal(expected, cgi[name])
- assert_equal(false,cgi.files.keys.member?(hash[:name]))
- end
- else
+ if hash[:filename] #if file
expected_class = @expected_class || (hash[:value].length < threshold ? StringIO : Tempfile)
+ assert(cgi.files.keys.member?(hash[:name]))
+ else
+ expected_class = String
+ assert_equal(expected, cgi[name])
+ assert_equal(false,cgi.files.keys.member?(hash[:name]))
end
assert_kind_of(expected_class, cgi[name])
assert_equal(expected, cgi[name].read())
@@ -179,7 +177,7 @@ class CGIMultipartTest < Test::Unit::TestCase
cgi.params.each {|name, vals|
vals.each {|val|
if val.kind_of?(Tempfile) && val.path
- val.unlink
+ val.close!
end
}
}
@@ -243,16 +241,29 @@ class CGIMultipartTest < Test::Unit::TestCase
{:name=>'image1', :value=>_read('large.png'),
:filename=>'large.png', :content_type=>'image/png'}, # large image
]
- original = _set_const(CGI, :MAX_MULTIPART_LENGTH, 2 * 1024)
begin
ex = assert_raise(StandardError) do
- _test_multipart()
+ _test_multipart(:max_multipart_length=>2 * 1024) # set via simple scalar
end
assert_equal("too large multipart data.", ex.message)
ensure
- _set_const(CGI, :MAX_MULTIPART_LENGTH, original)
end
- end if CGI.const_defined?(:MAX_MULTIPART_LENGTH)
+ end
+
+
+ def test_cgi_multipart_maxmultipartlength_lambda
+ @data = [
+ {:name=>'image1', :value=>_read('large.png'),
+ :filename=>'large.png', :content_type=>'image/png'}, # large image
+ ]
+ begin
+ ex = assert_raise(StandardError) do
+ _test_multipart(:max_multipart_length=>lambda{2*1024}) # set via lambda
+ end
+ assert_equal("too large multipart data.", ex.message)
+ ensure
+ end
+ end
def test_cgi_multipart_maxmultipartcount
@@ -286,7 +297,7 @@ class CGIMultipartTest < Test::Unit::TestCase
input2
end
ex = assert_raise(EOFError) do
- RUBY_VERSION>="1.9" ? CGI.new(:accept_charset=>"UTF-8") : CGI.new
+ CGI.new(:accept_charset=>"UTF-8")
end
assert_equal("bad content body", ex.message)
#
@@ -297,7 +308,7 @@ class CGIMultipartTest < Test::Unit::TestCase
input2
end
ex = assert_raise(EOFError) do
- RUBY_VERSION>="1.9" ? CGI.new(:accept_charset=>"UTF-8") : CGI.new
+ CGI.new(:accept_charset=>"UTF-8")
end
assert_equal("bad content body", ex.message)
end
@@ -313,9 +324,9 @@ class CGIMultipartTest < Test::Unit::TestCase
{:name=>'image1', :value=>_read('small.png'),
:filename=>'small.png', :content_type=>'image/png'}, # small image
]
- @data[1][:value].force_encoding("UTF-8") if RUBY_VERSION>="1.9"
+ @data[1][:value].force_encoding("UTF-8")
_prepare(@data)
- cgi = RUBY_VERSION>="1.9" ? CGI.new(:accept_charset=>"UTF-8") : CGI.new
+ cgi = CGI.new(:accept_charset=>"UTF-8")
assert_equal('file1.html', cgi['file1'].original_filename)
end
@@ -327,10 +338,10 @@ class CGIMultipartTest < Test::Unit::TestCase
{:name=>'foo', :value=>"bar"},
]
_prepare(@data)
- cgi = RUBY_VERSION>="1.9" ? CGI.new(:accept_charset=>"UTF-8") : CGI.new
+ cgi = CGI.new(:accept_charset=>"UTF-8")
assert_equal(cgi['foo'], 'bar')
assert_equal(cgi['file'].read, 'b'*10134)
- cgi['file'].unlink if cgi['file'].kind_of? Tempfile
+ cgi['file'].close! if cgi['file'].kind_of? Tempfile
end
def test_cgi_multipart_without_tempfile
diff --git a/test/cgi/test_cgi_tag_helper.rb b/test/cgi/test_cgi_tag_helper.rb
index 51d1d58bd3..eb3c20a02e 100644
--- a/test/cgi/test_cgi_tag_helper.rb
+++ b/test/cgi/test_cgi_tag_helper.rb
@@ -318,13 +318,11 @@ class CGITagHelperTest < Test::Unit::TestCase
assert_match(/^<INPUT .*TYPE="checkbox".*>bb<INPUT .*TYPE="checkbox".*>dd$/,str)
assert_match(/^<INPUT .*NAME="foo".*>bb<INPUT .*NAME="foo".*>dd$/,str)
assert_match(/^<INPUT .*>bb<INPUT .*CHECKED.*>dd$/,str)
- assert_match(/<INPUT .*TYPE="text".*>/,cgi.text_field(:name=>"name",:value=>"value")) if RUBY_VERSION>="1.9"
- if RUBY_VERSION>="1.9"
- str=cgi.radio_group("foo",["aa","bb"],["cc","dd",false])
- assert_match(/^<INPUT .*VALUE="aa".*>bb<INPUT .*VALUE="cc".*>dd$/,str)
- assert_match(/^<INPUT .*TYPE="radio".*>bb<INPUT .*TYPE="radio".*>dd$/,str)
- assert_match(/^<INPUT .*NAME="foo".*>bb<INPUT .*NAME="foo".*>dd$/,str)
- end
+ assert_match(/<INPUT .*TYPE="text".*>/,cgi.text_field(:name=>"name",:value=>"value"))
+ str=cgi.radio_group("foo",["aa","bb"],["cc","dd",false])
+ assert_match(/^<INPUT .*VALUE="aa".*>bb<INPUT .*VALUE="cc".*>dd$/,str)
+ assert_match(/^<INPUT .*TYPE="radio".*>bb<INPUT .*TYPE="radio".*>dd$/,str)
+ assert_match(/^<INPUT .*NAME="foo".*>bb<INPUT .*NAME="foo".*>dd$/,str)
end
=begin
@@ -349,6 +347,7 @@ class CGITagHelperTest < Test::Unit::TestCase
assert_equal('<FOOTER></FOOTER>',cgi.footer)
assert_equal('<ARTICLE></ARTICLE>',cgi.article)
assert_equal('<SECTION></SECTION>',cgi.section)
+ assert_equal('<!DOCTYPE HTML><HTML BLA="TEST"></HTML>',cgi.html("BLA"=>"TEST"){})
end
end
diff --git a/test/cgi/test_cgi_util.rb b/test/cgi/test_cgi_util.rb
index 7129cb6c9e..802379d233 100644
--- a/test/cgi/test_cgi_util.rb
+++ b/test/cgi/test_cgi_util.rb
@@ -4,7 +4,7 @@ require 'stringio'
class CGIUtilTest < Test::Unit::TestCase
-
+ include CGI::Util
def setup
ENV['REQUEST_METHOD'] = 'GET'
@@ -26,14 +26,14 @@ class CGIUtilTest < Test::Unit::TestCase
def test_cgi_escape_with_invalid_byte_sequence
assert_nothing_raised(ArgumentError) do
- assert_equal('%C0%3C%3C', CGI::escape("\xC0<<".force_encoding("UTF-8")))
+ assert_equal('%C0%3C%3C', CGI::escape("\xC0\<\<".force_encoding("UTF-8")))
end
end
def test_cgi_escape_preserve_encoding
- assert_equal(Encoding::US_ASCII, CGI::escape("\xC0<<".force_encoding("US-ASCII")).encoding)
- assert_equal(Encoding::ASCII_8BIT, CGI::escape("\xC0<<".force_encoding("ASCII-8BIT")).encoding)
- assert_equal(Encoding::UTF_8, CGI::escape("\xC0<<".force_encoding("UTF-8")).encoding)
+ assert_equal(Encoding::US_ASCII, CGI::escape("\xC0\<\<".force_encoding("US-ASCII")).encoding)
+ assert_equal(Encoding::ASCII_8BIT, CGI::escape("\xC0\<\<".force_encoding("ASCII-8BIT")).encoding)
+ assert_equal(Encoding::UTF_8, CGI::escape("\xC0\<\<".force_encoding("UTF-8")).encoding)
end
def test_cgi_unescape
@@ -65,4 +65,40 @@ class CGIUtilTest < Test::Unit::TestCase
assert_equal(CGI::unescapeHTML("&#x3042;&#x3044;&#X3046;"),"\xE3\x81\x82\xE3\x81\x84\xE3\x81\x86")
end
+ def test_cgi_include_escape
+ assert_equal('%26%3C%3E%22+%E3%82%86%E3%82%93%E3%82%86%E3%82%93', escape(@str1))
+ end
+
+ def test_cgi_include_escapeHTML
+ assert_equal(escapeHTML("'&\"><"),"&#39;&amp;&quot;&gt;&lt;")
+ end
+
+ def test_cgi_include_h
+ assert_equal(h("'&\"><"),"&#39;&amp;&quot;&gt;&lt;")
+ end
+
+ def test_cgi_include_unescape
+ assert_equal(@str1, unescape('%26%3C%3E%22+%E3%82%86%E3%82%93%E3%82%86%E3%82%93'))
+ assert_equal(@str1.encoding, unescape('%26%3C%3E%22+%E3%82%86%E3%82%93%E3%82%86%E3%82%93').encoding) if defined?(::Encoding)
+ assert_equal("\u{30E1 30E2 30EA 691C 7D22}", unescape("\u{30E1 30E2 30EA}%E6%A4%9C%E7%B4%A2"))
+ end
+
+ def test_cgi_include_unescapeHTML
+ assert_equal(unescapeHTML("&#39;&amp;&quot;&gt;&lt;"),"'&\"><")
+ end
+
+ def test_cgi_escapeElement
+ assert_equal("<BR>&lt;A HREF=&quot;url&quot;&gt;&lt;/A&gt;", escapeElement('<BR><A HREF="url"></A>', "A", "IMG"))
+ assert_equal("<BR>&lt;A HREF=&quot;url&quot;&gt;&lt;/A&gt;", escapeElement('<BR><A HREF="url"></A>', ["A", "IMG"]))
+ assert_equal("<BR>&lt;A HREF=&quot;url&quot;&gt;&lt;/A&gt;", escape_element('<BR><A HREF="url"></A>', "A", "IMG"))
+ assert_equal("<BR>&lt;A HREF=&quot;url&quot;&gt;&lt;/A&gt;", escape_element('<BR><A HREF="url"></A>', ["A", "IMG"]))
+ end
+
+
+ def test_cgi_unescapeElement
+ assert_equal('&lt;BR&gt;<A HREF="url"></A>', unescapeElement(escapeHTML('<BR><A HREF="url"></A>'), "A", "IMG"))
+ assert_equal('&lt;BR&gt;<A HREF="url"></A>', unescapeElement(escapeHTML('<BR><A HREF="url"></A>'), ["A", "IMG"]))
+ assert_equal('&lt;BR&gt;<A HREF="url"></A>', unescape_element(escapeHTML('<BR><A HREF="url"></A>'), "A", "IMG"))
+ assert_equal('&lt;BR&gt;<A HREF="url"></A>', unescape_element(escapeHTML('<BR><A HREF="url"></A>'), ["A", "IMG"]))
+ end
end
diff --git a/test/csv/base.rb b/test/csv/base.rb
index 42f4fa26ea..621569e013 100644
--- a/test/csv/base.rb
+++ b/test/csv/base.rb
@@ -2,7 +2,7 @@ require "test/unit"
require "csv"
-require_relative "../with_different_ofs.rb"
+require_relative "../lib/with_different_ofs.rb"
class TestCSV < Test::Unit::TestCase
end
diff --git a/test/csv/test_data_converters.rb b/test/csv/test_data_converters.rb
index 3351620e10..89b6dd1dfd 100755
--- a/test/csv/test_data_converters.rb
+++ b/test/csv/test_data_converters.rb
@@ -68,7 +68,7 @@ class TestCSV::DataConverters < TestCSV
def test_convert_with_builtin_integer
# setup parser...
- assert(@parser.respond_to?(:convert))
+ assert_respond_to(@parser, :convert)
assert_nothing_raised(Exception) { @parser.convert(:integer) }
# and use
@@ -77,7 +77,7 @@ class TestCSV::DataConverters < TestCSV
def test_convert_with_builtin_float
# setup parser...
- assert(@parser.respond_to?(:convert))
+ assert_respond_to(@parser, :convert)
assert_nothing_raised(Exception) { @parser.convert(:float) }
# and use
diff --git a/test/csv/test_encodings.rb b/test/csv/test_encodings.rb
index 85ed21a9d6..dc45692ce4 100755
--- a/test/csv/test_encodings.rb
+++ b/test/csv/test_encodings.rb
@@ -121,11 +121,9 @@ class TestCSV::Encodings < TestCSV
def test_parser_works_with_encoded_headers
encode_for_tests([%w[one two three], %w[1 2 3]]) do |data|
parsed = CSV.parse(data, headers: true)
- assert( parsed.headers.all? { |h| h.encoding == data.encoding },
- "Wrong data encoding." )
+ assert_all?(parsed.headers, "Wrong data encoding.") {|h| h.encoding == data.encoding}
parsed.each do |row|
- assert( row.fields.all? { |f| f.encoding == data.encoding },
- "Wrong data encoding." )
+ assert_all?(row.fields, "Wrong data encoding.") {|f| f.encoding == data.encoding}
end
end
end
@@ -133,8 +131,7 @@ class TestCSV::Encodings < TestCSV
def test_built_in_converters_transcode_to_utf_8_then_convert
encode_for_tests([%w[one two three], %w[1 2 3]]) do |data|
parsed = CSV.parse(data, converters: :integer)
- assert( parsed[0].all? { |f| f.encoding == data.encoding },
- "Wrong data encoding." )
+ assert_all?(parsed[0], "Wrong data encoding.") {|f| f.encoding == data.encoding}
assert_equal([1, 2, 3], parsed[1])
end
end
@@ -143,10 +140,8 @@ class TestCSV::Encodings < TestCSV
encode_for_tests([%w[one two three], %w[1 2 3]]) do |data|
parsed = CSV.parse( data, headers: true,
header_converters: :downcase )
- assert( parsed.headers.all? { |h| h.encoding.name == "UTF-8" },
- "Wrong data encoding." )
- assert( parsed[0].fields.all? { |f| f.encoding == data.encoding },
- "Wrong data encoding." )
+ assert_all?(parsed.headers, "Wrong data encoding.") {|h| h.encoding.name == "UTF-8"}
+ assert_all?(parsed[0].fields, "Wrong data encoding.") {|f| f.encoding == data.encoding}
end
end
@@ -156,8 +151,7 @@ class TestCSV::Encodings < TestCSV
File.open(@temp_csv_path, "wb:#{data.encoding.name}") { |f| f << data }
CSV.open(@temp_csv_path, "rb:#{data.encoding.name}") do |csv|
csv.each do |row|
- assert( row.all? { |f| f.encoding == data.encoding },
- "Wrong data encoding." )
+ assert_all?(row, "Wrong data encoding.") {|f| f.encoding == data.encoding}
end
end
@@ -167,8 +161,7 @@ class TestCSV::Encodings < TestCSV
end
CSV.open(@temp_csv_path, "rb:UTF-32BE:#{data.encoding.name}") do |csv|
csv.each do |row|
- assert( row.all? { |f| f.encoding == data.encoding },
- "Wrong data encoding." )
+ assert_all?(row, "Wrong data encoding.") {|f| f.encoding == data.encoding}
end
end
end
@@ -188,8 +181,7 @@ class TestCSV::Encodings < TestCSV
end
CSV.foreach( @temp_csv_path,
encoding: "UTF-32BE:#{data.encoding.name}" ) do |row|
- assert( row.all? { |f| f.encoding == data.encoding },
- "Wrong data encoding." )
+ assert_all?(row, "Wrong data encoding.") {|f| f.encoding == data.encoding}
end
end
end
@@ -199,8 +191,7 @@ class TestCSV::Encodings < TestCSV
# read and write in encoding
File.open(@temp_csv_path, "wb:#{data.encoding.name}") { |f| f << data }
rows = CSV.read(@temp_csv_path, encoding: data.encoding.name)
- assert( rows.flatten.all? { |f| f.encoding == data.encoding },
- "Wrong data encoding." )
+ assert_all?(rows.flatten, "Wrong data encoding.") {|f| f.encoding == data.encoding}
# read and write with transcoding
File.open(@temp_csv_path, "wb:UTF-32BE:#{data.encoding.name}") do |f|
@@ -208,8 +199,7 @@ class TestCSV::Encodings < TestCSV
end
rows = CSV.read( @temp_csv_path,
encoding: "UTF-32BE:#{data.encoding.name}" )
- assert( rows.flatten.all? { |f| f.encoding == data.encoding },
- "Wrong data encoding." )
+ assert_all?(rows.flatten, "Wrong data encoding.") {|f| f.encoding == data.encoding}
end
end
@@ -257,6 +247,14 @@ class TestCSV::Encodings < TestCSV
assert_equal("UTF-8", data.to_csv.encoding.name)
end
+ def test_explicit_encoding
+ bug9766 = '[ruby-core:62113] [Bug #9766]'
+ s = CSV.generate(encoding: "Windows-31J") do |csv|
+ csv << ["foo".force_encoding("ISO-8859-1"), "\u3042"]
+ end
+ assert_equal(["foo,\u3042\n".encode(Encoding::Windows_31J), Encoding::Windows_31J], [s, s.encoding], bug9766)
+ end
+
private
def assert_parses(fields, encoding, options = { })
diff --git a/test/csv/test_features.rb b/test/csv/test_features.rb
index 698d92144d..e31465710b 100755
--- a/test/csv/test_features.rb
+++ b/test/csv/test_features.rb
@@ -74,6 +74,14 @@ class TestCSV::Features < TestCSV
end
end
+ def test_bug_8405
+ TEST_CASES.each do |test_case|
+ assert_equal( test_case.last.map { |t| t.tr('"', "|") unless t.nil? },
+ CSV.parse_line( test_case.first.tr('"', "|"),
+ quote_char: "|" ) )
+ end
+ end
+
def test_csv_char_readers
%w[col_sep row_sep quote_char].each do |reader|
csv = CSV.new("abc,def", reader.to_sym => "|")
@@ -115,7 +123,9 @@ class TestCSV::Features < TestCSV
end
def test_unknown_options
- assert_raise(ArgumentError) { CSV.new(String.new, unknown: :error) }
+ assert_raise_with_message(ArgumentError, /unknown/) {
+ CSV.new(@sample_data, unknown: :error)
+ }
end
def test_skip_blanks
@@ -134,10 +144,9 @@ class TestCSV::Features < TestCSV
def test_csv_behavior_readers
%w[ unconverted_fields return_headers write_headers
skip_blanks force_quotes ].each do |behavior|
- assert( !CSV.new("abc,def").send("#{behavior}?"),
- "Behavior defaulted to on." )
+ assert_not_predicate(CSV.new("abc,def"), "#{behavior}?", "Behavior defaulted to on.")
csv = CSV.new("abc,def", behavior.to_sym => true)
- assert(csv.send("#{behavior}?"), "Behavior change now registered.")
+ assert_predicate(csv, "#{behavior}?", "Behavior change now registered.")
end
end
@@ -184,9 +193,9 @@ class TestCSV::Features < TestCSV
# reported by Chris Roos
def test_failing_to_reset_headers_in_rewind_bug_fix
csv = CSV.new("forename,surname", headers: true, return_headers: true)
- csv.each { |row| assert row.header_row? }
+ csv.each {|row| assert_predicate row, :header_row?}
csv.rewind
- csv.each { |row| assert row.header_row? }
+ csv.each {|row| assert_predicate row, :header_row?}
end
# reported by Dave Burt
@@ -209,40 +218,41 @@ class TestCSV::Features < TestCSV
)
end
assert_equal("\r\n", zipped.row_sep)
+ ensure
+ zipped.close
end if defined?(Zlib::GzipReader)
def test_gzip_writer_bug_fix
- tempfile = Tempfile.new(%w"temp .gz")
- tempfile.close
- file = tempfile.path
- zipped = nil
- assert_nothing_raised(NoMethodError) do
- zipped = CSV.new(Zlib::GzipWriter.open(file))
- end
- zipped << %w[one two three]
- zipped << [1, 2, 3]
- zipped.close
+ Tempfile.create(%w"temp .gz") {|tempfile|
+ tempfile.close
+ file = tempfile.path
+ zipped = nil
+ assert_nothing_raised(NoMethodError) do
+ zipped = CSV.new(Zlib::GzipWriter.open(file))
+ end
+ zipped << %w[one two three]
+ zipped << [1, 2, 3]
+ zipped.close
- assert( Zlib::GzipReader.open(file) { |f| f.read }.
- include?($INPUT_RECORD_SEPARATOR),
- "@row_sep did not default" )
- tempfile.close(true)
+ assert_include(Zlib::GzipReader.open(file) {|f| f.read},
+ $INPUT_RECORD_SEPARATOR, "@row_sep did not default")
+ }
end if defined?(Zlib::GzipWriter)
def test_inspect_is_smart_about_io_types
str = CSV.new("string,data").inspect
- assert(str.include?("io_type:StringIO"), "IO type not detected.")
+ assert_include(str, "io_type:StringIO", "IO type not detected.")
str = CSV.new($stderr).inspect
- assert(str.include?("io_type:$stderr"), "IO type not detected.")
-
- tempfile = Tempfile.new(%w"temp .csv")
- tempfile.close
- path = tempfile.path
- File.open(path, "w") { |csv| csv << "one,two,three\n1,2,3\n" }
- str = CSV.open(path) { |csv| csv.inspect }
- assert(str.include?("io_type:File"), "IO type not detected.")
- tempfile.close(true)
+ assert_include(str, "io_type:$stderr", "IO type not detected.")
+
+ Tempfile.create(%w"temp .csv") {|tempfile|
+ tempfile.close
+ path = tempfile.path
+ File.open(path, "w") { |csv| csv << "one,two,three\n1,2,3\n" }
+ str = CSV.open(path) { |csv| csv.inspect }
+ assert_include(str, "io_type:File", "IO type not detected.")
+ }
end
def test_inspect_shows_key_attributes
@@ -254,7 +264,7 @@ class TestCSV::Features < TestCSV
def test_inspect_shows_headers_when_available
CSV.new("one,two,three\n1,2,3\n", headers: true) do |csv|
- assert(csv.inspect.include?("headers:true"), "Header hint not shown.")
+ assert_include(csv.inspect, "headers:true", "Header hint not shown.")
csv.shift # load headers
assert_match(/headers:\[[^\]]+\]/, csv.inspect)
end
@@ -262,28 +272,28 @@ class TestCSV::Features < TestCSV
def test_inspect_encoding_is_ascii_compatible
CSV.new("one,two,three\n1,2,3\n".encode("UTF-16BE")) do |csv|
- assert( Encoding.compatible?( Encoding.find("US-ASCII"),
- csv.inspect.encoding ),
- "inspect() was not ASCII compatible." )
+ assert_send([Encoding, :compatible?,
+ Encoding.find("US-ASCII"), csv.inspect.encoding],
+ "inspect() was not ASCII compatible.")
end
end
def test_version
assert_not_nil(CSV::VERSION)
assert_instance_of(String, CSV::VERSION)
- assert(CSV::VERSION.frozen?)
+ assert_predicate(CSV::VERSION, :frozen?)
assert_match(/\A\d\.\d\.\d\Z/, CSV::VERSION)
end
def test_accepts_comment_skip_lines_option
assert_nothing_raised(ArgumentError) do
- CSV.new nil, :skip_lines => /\A\s*#/
+ CSV.new(@sample_data, :skip_lines => /\A\s*#/)
end
end
def test_accepts_comment_defaults_to_nil
- c = CSV.new nil
- assert_equal c.skip_lines, nil
+ c = CSV.new(@sample_data)
+ assert_nil(c.skip_lines)
end
class RegexStub
@@ -291,20 +301,27 @@ class TestCSV::Features < TestCSV
def test_requires_skip_lines_to_call_match
regex_stub = RegexStub.new
- assert_raise(ArgumentError) do
- CSV.new nil, :skip_lines => regex_stub
+ assert_raise_with_message(ArgumentError, /skip_lines/) do
+ CSV.new(@sample_data, :skip_lines => regex_stub)
end
end
def test_comment_rows_are_ignored
sample_data = "line,1,a\n#not,a,line\nline,2,b\n #also,no,line"
c = CSV.new sample_data, :skip_lines => /\A\s*#/
- assert_equal c.each.to_a, [["line", "1", "a"], ["line", "2", "b"]]
+ assert_equal [["line", "1", "a"], ["line", "2", "b"]], c.each.to_a
end
def test_quoted_skip_line_markers_are_ignored
sample_data = "line,1,a\n\"#not\",a,line\nline,2,b"
c = CSV.new sample_data, :skip_lines => /\A\s*#/
- assert_equal c.each.to_a, [["line", "1", "a"], ["#not", "a", "line"], ["line", "2", "b"]]
+ assert_equal [["line", "1", "a"], ["#not", "a", "line"], ["line", "2", "b"]], c.each.to_a
end
+
+ def test_string_works_like_a_regexp
+ sample_data = "line,1,a\n#(not,a,line\nline,2,b\n also,#no,line"
+ c = CSV.new sample_data, :skip_lines => "#"
+ assert_equal [["line", "1", "a"], ["line", "2", "b"]], c.each.to_a
+ end
+
end
diff --git a/test/csv/test_headers.rb b/test/csv/test_headers.rb
index 00ae82af06..79ccd20c74 100755
--- a/test/csv/test_headers.rb
+++ b/test/csv/test_headers.rb
@@ -85,8 +85,8 @@ class TestCSV::Headers < TestCSV
assert_not_nil(row)
assert_instance_of(CSV::Row, row)
assert_equal([["my", :my], ["new", :new], ["headers", :headers]], row.to_a)
- assert(row.header_row?)
- assert(!row.field_row?)
+ assert_predicate(row, :header_row?)
+ assert_not_predicate(row, :field_row?)
end
def test_csv_header_string
@@ -127,8 +127,8 @@ class TestCSV::Headers < TestCSV
assert_not_nil(row)
assert_instance_of(CSV::Row, row)
assert_equal([[:my, "my"], [:new, "new"], [:headers, "headers"]], row.to_a)
- assert(row.header_row?)
- assert(!row.field_row?)
+ assert_predicate(row, :header_row?)
+ assert_not_predicate(row, :field_row?)
end
def test_csv_header_string_inherits_separators
@@ -159,24 +159,24 @@ class TestCSV::Headers < TestCSV
assert_instance_of(CSV::Row, row)
assert_equal( [%w{first first}, %w{second second}, %w{third third}],
row.to_a )
- assert(row.header_row?)
- assert(!row.field_row?)
+ assert_predicate(row, :header_row?)
+ assert_not_predicate(row, :field_row?)
# first data row - skipping headers
row = csv[1]
assert_not_nil(row)
assert_instance_of(CSV::Row, row)
assert_equal([%w{first A}, %w{second B}, %w{third C}], row.to_a)
- assert(!row.header_row?)
- assert(row.field_row?)
+ assert_not_predicate(row, :header_row?)
+ assert_predicate(row, :field_row?)
# second data row
row = csv[2]
assert_not_nil(row)
assert_instance_of(CSV::Row, row)
assert_equal([%w{first 1}, %w{second 2}, %w{third 3}], row.to_a)
- assert(!row.header_row?)
- assert(row.field_row?)
+ assert_not_predicate(row, :header_row?)
+ assert_predicate(row, :field_row?)
# empty
assert_nil(csv[3])
@@ -217,12 +217,20 @@ class TestCSV::Headers < TestCSV
end
def test_builtin_symbol_converter
- csv = CSV.parse( "One,TWO Three", headers: true,
- return_headers: true,
- header_converters: :symbol )
+ # Note that the trailing space is intentional
+ csv = CSV.parse( "One,TWO Three ", headers: true,
+ return_headers: true,
+ header_converters: :symbol )
assert_equal([:one, :two_three], csv.headers)
end
+ def test_builtin_converters_with_blank_header
+ csv = CSV.parse( "one,,three", headers: true,
+ return_headers: true,
+ header_converters: [:downcase, :symbol] )
+ assert_equal([:one, nil, :three], csv.headers)
+ end
+
def test_custom_converter
converter = lambda { |header| header.tr(" ", "_") }
csv = CSV.parse( "One,TWO Three",
diff --git a/test/csv/test_interface.rb b/test/csv/test_interface.rb
index 73e6ca9a4a..d6bf470f6b 100755
--- a/test/csv/test_interface.rb
+++ b/test/csv/test_interface.rb
@@ -40,20 +40,26 @@ class TestCSV::Interface < TestCSV
end
end
+ def test_foreach_enum
+ CSV.foreach(@path, col_sep: "\t", row_sep: "\r\n").zip(@expected) do |row, exp|
+ assert_equal(exp, row)
+ end
+ end
+
def test_open_and_close
csv = CSV.open(@path, "r+", col_sep: "\t", row_sep: "\r\n")
assert_not_nil(csv)
assert_instance_of(CSV, csv)
- assert_equal(false, csv.closed?)
+ assert_not_predicate(csv, :closed?)
csv.close
- assert(csv.closed?)
+ assert_predicate(csv, :closed?)
ret = CSV.open(@path) do |new_csv|
csv = new_csv
assert_instance_of(CSV, new_csv)
"Return value."
end
- assert(csv.closed?)
+ assert_predicate(csv, :closed?)
assert_equal("Return value.", ret)
end
@@ -124,6 +130,12 @@ class TestCSV::Interface < TestCSV
end
end
+ def test_nil_is_not_acceptable
+ assert_raise_with_message ArgumentError, "Cannot parse nil as CSV" do
+ CSV.new(nil)
+ end
+ end
+
### Test Write Interface ###
def test_generate
@@ -192,6 +204,25 @@ class TestCSV::Interface < TestCSV
end
end
+ def test_write_hash_with_string_keys
+ File.unlink(@path)
+
+ lines = [{a: 1, b: 2, c: 3}, {a: 4, b: 5, c: 6}]
+ CSV.open( @path, "wb", headers: true ) do |csv|
+ csv << lines.first.keys
+ lines.each { |line| csv << line }
+ end
+ CSV.open( @path, "rb", headers: true ) do |csv|
+ csv.each do |line|
+ csv.headers.each_with_index do |header, h|
+ keys = line.to_hash.keys
+ assert_instance_of(String, keys[h])
+ assert_same(header, keys[h])
+ end
+ end
+ end
+ end
+
def test_write_hash_with_headers_array
File.unlink(@path)
diff --git a/test/csv/test_row.rb b/test/csv/test_row.rb
index 697c7d56c8..3acceea234 100755
--- a/test/csv/test_row.rb
+++ b/test/csv/test_row.rb
@@ -40,16 +40,16 @@ class TestCSV::Row < TestCSV
def test_row_type
# field rows
row = CSV::Row.new(%w{A B C}, [1, 2, 3]) # implicit
- assert(!row.header_row?)
- assert(row.field_row?)
+ assert_not_predicate(row, :header_row?)
+ assert_predicate(row, :field_row?)
row = CSV::Row.new(%w{A B C}, [1, 2, 3], false) # explicit
- assert(!row.header_row?)
- assert(row.field_row?)
+ assert_not_predicate(row, :header_row?)
+ assert_predicate(row, :field_row?)
# header row
row = CSV::Row.new(%w{A B C}, [1, 2, 3], true)
- assert(row.header_row?)
- assert(!row.field_row?)
+ assert_predicate(row, :header_row?)
+ assert_not_predicate(row, :field_row?)
end
def test_headers
@@ -249,10 +249,10 @@ class TestCSV::Row < TestCSV
def test_queries
# headers
- assert(@row.header?("A"))
- assert(@row.header?("C"))
- assert(!@row.header?("Z"))
- assert(@row.include?("A")) # alias
+ assert_send([@row, :header?, "A"])
+ assert_send([@row, :header?, "C"])
+ assert_not_send([@row, :header?, "Z"])
+ assert_send([@row, :include?, "A"]) # alias
# fields
assert(@row.field?(4))
@@ -297,7 +297,12 @@ class TestCSV::Row < TestCSV
end
def test_to_hash
- assert_equal({"A" => nil, "B" => 2, "C" => 3}, @row.to_hash)
+ hash = @row.to_hash
+ assert_equal({"A" => nil, "B" => 2, "C" => 3}, hash)
+ hash.keys.each_with_index do |string_key, h|
+ assert_predicate(string_key, :frozen?)
+ assert_same(string_key, @row.headers[h])
+ end
end
def test_to_csv
@@ -311,7 +316,7 @@ class TestCSV::Row < TestCSV
end
def test_array_delegation
- assert(!@row.empty?, "Row was empty.")
+ assert_not_empty(@row, "Row was empty.")
assert_equal([@row.headers.size, @row.fields.size].max, @row.size)
end
@@ -319,26 +324,32 @@ class TestCSV::Row < TestCSV
def test_inspect_shows_header_field_pairs
str = @row.inspect
@row.each do |header, field|
- assert( str.include?("#{header.inspect}:#{field.inspect}"),
- "Header field pair not found." )
+ assert_include(str, "#{header.inspect}:#{field.inspect}",
+ "Header field pair not found.")
end
end
def test_inspect_encoding_is_ascii_compatible
- assert( Encoding.compatible?( Encoding.find("US-ASCII"),
- @row.inspect.encoding ),
- "inspect() was not ASCII compatible." )
+ assert_send([Encoding, :compatible?,
+ Encoding.find("US-ASCII"),
+ @row.inspect.encoding],
+ "inspect() was not ASCII compatible.")
end
def test_inspect_shows_symbol_headers_as_bare_attributes
str = CSV::Row.new(@row.headers.map { |h| h.to_sym }, @row.fields).inspect
@row.each do |header, field|
- assert( str.include?("#{header}:#{field.inspect}"),
- "Header field pair not found." )
+ assert_include(str, "#{header}:#{field.inspect}",
+ "Header field pair not found.")
end
end
def test_can_be_compared_with_other_classes
- assert(CSV::Row.new([ ], [ ]) != nil, "The row was nil")
+ assert_not_nil(CSV::Row.new([ ], [ ]), "The row was nil")
+ end
+
+ def test_can_be_compared_when_not_a_row
+ r = @row == []
+ assert_equal false, r
end
end
diff --git a/test/csv/test_table.rb b/test/csv/test_table.rb
index 318825f2b1..44e9d4a8be 100755
--- a/test/csv/test_table.rb
+++ b/test/csv/test_table.rb
@@ -54,6 +54,11 @@ class TestCSV::Table < TestCSV
assert_equal(@rows.first.headers, @table.headers)
end
+ def test_headers_empty
+ t = CSV::Table.new([])
+ assert_equal Array.new, t.headers
+ end
+
def test_index
##################
### Mixed Mode ###
@@ -190,6 +195,14 @@ class TestCSV::Table < TestCSV
assert_raise(TypeError) { @table["Extra"] = nil }
end
+ def test_set_by_col_with_header_row
+ r = [ CSV::Row.new(%w{X Y Z}, [97, 98, 99], true) ]
+ t = CSV::Table.new(r)
+ t.by_col!
+ t['A'] = [42]
+ assert_equal(['A'], t['A'])
+ end
+
def test_each
######################
### Mixed/Row Mode ###
@@ -398,23 +411,24 @@ class TestCSV::Table < TestCSV
end
def test_array_delegation
- assert(!@table.empty?, "Table was empty.")
+ assert_not_empty(@table, "Table was empty.")
assert_equal(@rows.size, @table.size)
end
def test_inspect_shows_current_mode
str = @table.inspect
- assert(str.include?("mode:#{@table.mode}"), "Mode not shown.")
+ assert_include(str, "mode:#{@table.mode}", "Mode not shown.")
@table.by_col!
str = @table.inspect
- assert(str.include?("mode:#{@table.mode}"), "Mode not shown.")
+ assert_include(str, "mode:#{@table.mode}", "Mode not shown.")
end
def test_inspect_encoding_is_ascii_compatible
- assert( Encoding.compatible?( Encoding.find("US-ASCII"),
- @table.inspect.encoding ),
+ assert_send([Encoding, :compatible?,
+ Encoding.find("US-ASCII"),
+ @table.inspect.encoding],
"inspect() was not ASCII compatible." )
end
end
diff --git a/test/date/test_date.rb b/test/date/test_date.rb
index 86790e4cde..3d8bf868c4 100644
--- a/test/date/test_date.rb
+++ b/test/date/test_date.rb
@@ -20,7 +20,6 @@ class TestDate < Test::Unit::TestCase
assert_equal(7, Date::ABBR_DAYNAMES.size)
assert(Date::MONTHNAMES.frozen?)
- assert(!Date::MONTHNAMES[0].frozen?)
assert(Date::MONTHNAMES[1].frozen?)
assert(Date::DAYNAMES.frozen?)
assert(Date::DAYNAMES[0].frozen?)
@@ -41,9 +40,7 @@ class TestDate < Test::Unit::TestCase
assert_instance_of(DateSub, DateSub.today)
assert_instance_of(DateTimeSub, DateTimeSub.now)
-# assert_equal('#<DateSub: -4712-01-01 (-1/2,0,2299161)>', d.inspect)
assert_equal('-4712-01-01', d.to_s)
-# assert_equal('#<DateTimeSub: -4712-01-01T00:00:00+00:00 (-1/2,0,2299161)>', dt.inspect)
assert_equal('-4712-01-01T00:00:00+00:00', dt.to_s)
d2 = d + 1
@@ -141,4 +138,13 @@ class TestDate < Test::Unit::TestCase
assert_instance_of(String, d.to_s)
end
+ def test_submillisecond_comparison
+ d1 = DateTime.new(2013, 12, 6, 0, 0, Rational(1, 10000))
+ d2 = DateTime.new(2013, 12, 6, 0, 0, Rational(2, 10000))
+ # d1 is 0.0001s earlier than d2
+ assert_equal(-1, d1 <=> d2)
+ assert_equal(0, d1 <=> d1)
+ assert_equal(1, d2 <=> d1)
+ end
+
end
diff --git a/test/date/test_date_arith.rb b/test/date/test_date_arith.rb
index 745ddbd16c..7b79c18097 100644
--- a/test/date/test_date_arith.rb
+++ b/test/date/test_date_arith.rb
@@ -205,7 +205,7 @@ class TestDateArith < Test::Unit::TestCase
p = Date.new(2001,1,14)
q = Date.new(2001,1,7)
i = 0
- p.downto(q) do |d|
+ p.downto(q) do
i += 1
end
assert_equal(8, i)
@@ -222,7 +222,7 @@ class TestDateArith < Test::Unit::TestCase
p = Date.new(2001,1,14)
q = Date.new(2001,1,21)
i = 0
- p.upto(q) do |d|
+ p.upto(q) do
i += 1
end
assert_equal(8, i)
@@ -239,13 +239,13 @@ class TestDateArith < Test::Unit::TestCase
p = Date.new(2001,1,14)
q = Date.new(2001,1,21)
i = 0
- p.step(q, 2) do |d|
+ p.step(q, 2) do
i += 1
end
assert_equal(4, i)
i = 0
- p.step(q) do |d|
+ p.step(q) do
i += 1
end
assert_equal(8, i)
@@ -261,26 +261,4 @@ class TestDateArith < Test::Unit::TestCase
assert_equal(8, e.to_a.size)
end
-=begin
- def test_step__inf
- p = Date.new(2001,1,14)
- q = Date.new(2001,1,21)
- inf = 1.0/0
-
- if inf.infinite?
- [p, q].each do |a|
- [p, q].each do |b|
- [inf, -inf].each do |c|
- i = 0
- a.step(b, c) do |d|
- i += 1
- end
- assert_equal(0, i)
- end
- end
- end
- end
- end
-=end
-
end
diff --git a/test/date/test_date_attr.rb b/test/date/test_date_attr.rb
index 88a54d7461..bc6bec2a80 100644
--- a/test/date/test_date_attr.rb
+++ b/test/date/test_date_attr.rb
@@ -8,15 +8,6 @@ class TestDateAttr < Test::Unit::TestCase
datetime = DateTime.new(1965, 5, 23, 22, 31, 59)
[date, datetime].each_with_index do |d, i|
-=begin
- if i == 0
- assert_match(/\#<Date\d?: 1965-05-23 \(4877807\/2,0,2299161\)>/,
- d.inspect)
- else
- assert_match(/\#<DateTime\d?: 1965-05-23T22:31:59\+00:00 \(210721343519\/86400,0,2299161\)>/,
- d.inspect)
- end
-=end
if i == 0
assert_equal('1965-05-23', d.to_s)
diff --git a/test/date/test_date_parse.rb b/test/date/test_date_parse.rb
index 30976067a4..e0cd6025a8 100644
--- a/test/date/test_date_parse.rb
+++ b/test/date/test_date_parse.rb
@@ -37,7 +37,6 @@ class TestDateParse < Test::Unit::TestCase
[['Sat Aug 28 02:29:34 Mountain Standard Time 2000',false],[2000,8,28,2,29,34,'Mountain Standard Time',-7*3600,6], __LINE__],
[['Sat Aug 28 02:29:34 Mountain Daylight Time 2000',false],[2000,8,28,2,29,34,'Mountain Daylight Time',-6*3600,6], __LINE__],
[['Sat Aug 28 02:29:34 Mexico Standard Time 2000',false],[2000,8,28,2,29,34,'Mexico Standard Time',-6*3600,6], __LINE__],
-# [['Sat Aug 28 02:29:34 Mexico Standard Time 2 2000',false],[2000,8,28,2,29,34,'Mexico Standard Time 2',-7*3600,6], __LINE__], # cp
[['Sat Aug 28 02:29:34 E. Australia Standard Time 2000',false],[2000,8,28,2,29,34,'E. Australia Standard Time',10*3600,6], __LINE__],
# part of iso 8601
@@ -109,7 +108,6 @@ class TestDateParse < Test::Unit::TestCase
[["23-05-'99",true],[1999,5,23,nil,nil,nil,nil,nil,nil], __LINE__],
# broken iso 8601 (?)
-# [['1999-05-23T235521Z',false],[1999,5,23,23,55,21,'Z',0,nil], __LINE__], # cp
[['19990523T23:55:21Z',false],[1999,5,23,23,55,21,'Z',0,nil], __LINE__],
[['19990523235521.1234-100',true],[1999,5,23,23,55,21,'-100',-1*3600,nil], __LINE__],
[['19990523235521.1234-10',true],[1999,5,23,23,55,21,'-10',-10*3600,nil], __LINE__],
@@ -134,7 +132,6 @@ class TestDateParse < Test::Unit::TestCase
[['19990523235521.123[-5:EST]',false],[1999,5,23,23,55,21,'EST',-5*3600,nil], __LINE__],
[['19990523235521.123[+9:JST]',false],[1999,5,23,23,55,21,'JST',9*3600,nil], __LINE__],
[['19990523235521.123[+12:XXX YYY ZZZ]',false],[1999,5,23,23,55,21,'XXX YYY ZZZ',12*3600,nil], __LINE__],
-# [['235521',false],[nil,nil,nil,23,55,21,nil,nil,nil], __LINE__], # cp
[['235521.123',false],[nil,nil,nil,23,55,21,nil,nil,nil], __LINE__],
[['235521.123[-9]',false],[nil,nil,nil,23,55,21,'-9',-9*3600,nil], __LINE__],
[['235521.123[+9]',false],[nil,nil,nil,23,55,21,'+9',+9*3600,nil], __LINE__],
@@ -147,8 +144,6 @@ class TestDateParse < Test::Unit::TestCase
[['Sun, 22 Aug 1999 00:45:29 +9959',false],[1999,8,22,0,45,29,'+9959',+(99*3600+59*60),0], __LINE__],
[['Sun, 22 Aug 05 00:45:29 -0400',true],[2005,8,22,0,45,29,'-0400',-4*3600,0], __LINE__],
[['Sun, 22 Aug 49 00:45:29 -0400',true],[2049,8,22,0,45,29,'-0400',-4*3600,0], __LINE__],
-# [['Sun, 22 Aug 50 00:45:29 -0400',true],[1950,8,22,0,45,29,'-0400',-4*3600,0], __LINE__],
-# [['Sun, 22 Aug 111 00:45:29 -0400',true],[2011,8,22,0,45,29,'-0400',-4*3600,0], __LINE__],
[['Sun, 22 Aug 1999 00:45:29 GMT',false],[1999,8,22,0,45,29,'GMT',0,0], __LINE__],
[["Sun,\00022\r\nAug\r\n1999\r\n00:45:29\r\nGMT",false],[1999,8,22,0,45,29,'GMT',0,0], __LINE__],
[['Sun, 22 Aug 1999 00:45 GMT',false],[1999,8,22,0,45,nil,'GMT',0,0], __LINE__],
@@ -181,8 +176,6 @@ class TestDateParse < Test::Unit::TestCase
[['1999.5.2',false],[1999,5,2,nil,nil,nil,nil,nil,nil], __LINE__],
[['1999.05.02',false],[1999,5,2,nil,nil,nil,nil,nil,nil], __LINE__],
[['-1999.05.02',false],[-1999,5,2,nil,nil,nil,nil,nil,nil], __LINE__],
-# [['05.02',false],[nil,5,2,nil,nil,nil,nil,nil,nil], __LINE__], # not support
-# [[' 5. 2',false],[nil,5,2,nil,nil,nil,nil,nil,nil], __LINE__], # not support
[['0099.5.2',false],[99,5,2,nil,nil,nil,nil,nil,nil], __LINE__],
[['0099.5.2',true],[99,5,2,nil,nil,nil,nil,nil,nil], __LINE__],
@@ -310,8 +303,6 @@ class TestDateParse < Test::Unit::TestCase
[['Sat Aug 28 02:29:34 GMT 2000 B.C.E.',false],[-1999,8,28,2,29,34,'GMT',0,6], __LINE__],
# collection
-# [['le ler juillet 1982',false],[1982,7,1,nil,nil,nil,nil,nil,nil], __LINE__], # bih 1982
-# [['30 June 1982 , 23h 59m 59s',false],[1982,6,30,23,59,59,nil,nil,nil], __LINE__], # bih 1982
[['Tuesday, May 18, 1999 Published at 13:36 GMT 14:36 UK',false],[1999,5,18,13,36,nil,'GMT',0,2], __LINE__], # bbc.co.uk
[['July 20, 2000 Web posted at: 3:37 p.m. EDT (1937 GMT)',false],[2000,7,20,15,37,nil,'EDT',-4*3600,nil], __LINE__], # cnn.com
[['12:54 p.m. EDT, September 11, 2006',false],[2006,9,11,12,54,nil,'EDT',-4*3600,nil], __LINE__], # cnn.com
@@ -323,11 +314,9 @@ class TestDateParse < Test::Unit::TestCase
[['8:00 pm lt',false],[nil,nil,nil,20,0,nil,'lt',nil,nil], __LINE__],
[['4:00 AM, Jan. 12, 1990',false],[1990,1,12,4,0,nil,nil,nil,nil], __LINE__],
[['Jan. 12 4:00 AM 1990',false],[1990,1,12,4,0,nil,nil,nil,nil], __LINE__],
-# [['Jan. 12 4:00 -1990',false],[-1990,1,12,4,0,nil,nil,nil,nil], __LINE__], # cp
[['1990-01-12 04:00:00+00',false],[1990,1,12,4,0,0,'+00',0,nil], __LINE__],
[['1990-01-11 20:00:00-08',false],[1990,1,11,20,0,0,'-08',-8*3600,nil], __LINE__],
[['1990/01/12 04:00:00',false],[1990,1,12,4,0,0,nil,nil,nil], __LINE__],
-# [['Thu Jan 11 20:00:00 1990 LT',false], [1990,1,11,20,0,0,'LT',nil,4], __LINE__], # cp
[['Thu Jan 11 20:00:00 PST 1990',false],[1990,1,11,20,0,0,'PST',-8*3600,4], __LINE__],
[['Fri Jan 12 04:00:00 GMT 1990',false],[1990,1,12,4,0,0,'GMT',0,5], __LINE__],
[['Thu, 11 Jan 1990 20:00:00 -0800',false],[1990,1,11,20,0,0,'-0800',-8*3600,4], __LINE__],
@@ -353,8 +342,6 @@ class TestDateParse < Test::Unit::TestCase
[['sat.',false],[nil,nil,nil,nil,nil,nil,nil,nil,6], __LINE__],
[['SAT.',false],[nil,nil,nil,nil,nil,nil,nil,nil,6], __LINE__],
[['sAt.',false],[nil,nil,nil,nil,nil,nil,nil,nil,6], __LINE__],
-# [['su',false],[nil,nil,nil,nil,nil,nil,nil,nil,0], __LINE__],
-# [['mo',false],[nil,nil,nil,nil,nil,nil,nil,nil,1], __LINE__],
# time
[['09:55',false],[nil,nil,nil,9,55,nil,nil,nil,nil], __LINE__],
diff --git a/test/date/test_date_strptime.rb b/test/date/test_date_strptime.rb
index f8483f9e4c..ae149bb8d8 100644
--- a/test/date/test_date_strptime.rb
+++ b/test/date/test_date_strptime.rb
@@ -195,8 +195,12 @@ class TestDateStrptime < Test::Unit::TestCase
[['01', '%y'], [2001,nil,nil,nil,nil,nil,nil,nil,nil], __LINE__],
[['19 99', '%C %y'], [1999,nil,nil,nil,nil,nil,nil,nil,nil], __LINE__],
[['20 01', '%C %y'], [2001,nil,nil,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['30 99', '%C %y'], [3099,nil,nil,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['30 01', '%C %y'], [3001,nil,nil,nil,nil,nil,nil,nil,nil], __LINE__],
[['1999', '%C%y'], [1999,nil,nil,nil,nil,nil,nil,nil,nil], __LINE__],
[['2001', '%C%y'], [2001,nil,nil,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['3099', '%C%y'], [3099,nil,nil,nil,nil,nil,nil,nil,nil], __LINE__],
+ [['3001', '%C%y'], [3001,nil,nil,nil,nil,nil,nil,nil,nil], __LINE__],
[['20060806', '%Y'], [20060806,nil,nil,nil,nil,nil,nil,nil,nil], __LINE__],
[['20060806', "%Y\s"], [20060806,nil,nil,nil,nil,nil,nil,nil,nil], __LINE__],
@@ -309,7 +313,6 @@ class TestDateStrptime < Test::Unit::TestCase
end
def test_strptime__2
- n = 10**9
(Date.new(2006,6,1)..Date.new(2007,6,1)).each do |d|
[
'%Y %m %d',
@@ -489,4 +492,21 @@ class TestDateStrptime < Test::Unit::TestCase
assert_equal(s0, s)
end
+ def test_sz
+ d = DateTime.strptime('0 -0200', '%s %z')
+ assert_equal([1969, 12, 31, 22, 0, 0], [d.year, d.mon, d.mday, d.hour, d.min, d.sec])
+ assert_equal(Rational(-2, 24), d.offset)
+ d = DateTime.strptime('9 +0200', '%s %z')
+ assert_equal([1970, 1, 1, 2, 0, 9], [d.year, d.mon, d.mday, d.hour, d.min, d.sec])
+ assert_equal(Rational(2, 24), d.offset)
+
+ d = DateTime.strptime('0 -0200', '%Q %z')
+ assert_equal([1969, 12, 31, 22, 0, 0], [d.year, d.mon, d.mday, d.hour, d.min, d.sec])
+ assert_equal(Rational(-2, 24), d.offset)
+ d = DateTime.strptime('9000 +0200', '%Q %z')
+ assert_equal([1970, 1, 1, 2, 0, 9], [d.year, d.mon, d.mday, d.hour, d.min, d.sec])
+ assert_equal(Rational(2, 24), d.offset)
+
+ end
+
end
diff --git a/test/date/test_switch_hitter.rb b/test/date/test_switch_hitter.rb
index f18d76b393..08e23015dc 100644
--- a/test/date/test_switch_hitter.rb
+++ b/test/date/test_switch_hitter.rb
@@ -312,6 +312,8 @@ class TestSH < Test::Unit::TestCase
assert_equal(-1, Date.new(2001,2,3) <=> Rational('4903888/2'))
assert_equal(0, Date.new(2001,2,3) <=> Rational('4903887/2'))
assert_equal(1, Date.new(2001,2,3) <=> Rational('4903886/2'))
+
+ assert_equal(-1, Date.new(-4713,11,1,Date::GREGORIAN) <=> Date.new(-4713,12,1,Date::GREGORIAN))
end
def test_eqeqeq
diff --git a/test/dbm/test_dbm.rb b/test/dbm/test_dbm.rb
index 1b851207da..5d59c92fcd 100644
--- a/test/dbm/test_dbm.rb
+++ b/test/dbm/test_dbm.rb
@@ -15,12 +15,8 @@ if defined? DBM
require 'rbconfig'
case RbConfig::CONFIG['target_os']
when 'cygwin'
- require 'Win32API'
- uname = Win32API.new('cygwin1', 'uname', 'P', 'I')
- utsname = ' ' * 100
- raise 'cannot get system name' if uname.call(utsname) == -1
-
- utsname.unpack('A20' * 5)[0]
+ require 'etc'
+ Etc.uname[:sysname]
else
RbConfig::CONFIG['target_os']
end
@@ -58,6 +54,14 @@ if defined? DBM
assert_nil(@dbm_rdonly.delete("bar"))
end
end
+
+ def test_fetch_not_found
+ notfound = nil
+ result = Object.new
+ assert_same(result, @dbm_rdonly.fetch("bar") {|k| notfound = k; result})
+ assert_equal("bar", notfound)
+ assert_predicate(notfound, :tainted?)
+ end
end
class TestDBM < Test::Unit::TestCase
@@ -87,15 +91,6 @@ if defined? DBM
end
end
- def have_fork?
- begin
- fork{}
- true
- rescue NotImplementedError
- false
- end
- end
-
def test_dbmfile_suffix
@dbm.close
prefix = File.basename(@path)
diff --git a/test/digest/test_digest.rb b/test/digest/test_digest.rb
index 4b1d55e256..cf541a4626 100755
--- a/test/digest/test_digest.rb
+++ b/test/digest/test_digest.rb
@@ -4,9 +4,10 @@
# $Id$
require 'test/unit'
+require 'tempfile'
require 'digest'
-%w[digest/md5 digest/rmd160 digest/sha1 digest/sha2].each do |lib|
+%w[digest/md5 digest/rmd160 digest/sha1 digest/sha2 digest/bubblebabble].each do |lib|
begin
require lib
rescue LoadError
@@ -68,6 +69,9 @@ module TestDigest
assert_equal(md1, md1.clone, self.class::ALGO)
+ bug9913 = '[ruby-core:62967] [Bug #9913]'
+ assert_not_equal(md1, nil, bug9913)
+
md2 = self.class::ALGO.new
md2 << "A"
@@ -78,6 +82,16 @@ module TestDigest
assert_equal(md1, md2, self.class::ALGO)
end
+ def test_s_file
+ Tempfile.create("test_digest_file", mode: File::BINARY) { |tmpfile|
+ str = "hello, world.\r\n"
+ tmpfile.print str
+ tmpfile.close
+
+ assert_equal self.class::ALGO.new.update(str), self.class::ALGO.file(tmpfile.path)
+ }
+ end
+
def test_instance_eval
assert_nothing_raised {
self.class::ALGO.new.instance_eval { update "a" }
@@ -93,6 +107,23 @@ module TestDigest
}
end
+ def test_bubblebabble
+ expected = "xirek-hasol-fumik-lanax"
+ assert_equal expected, Digest.bubblebabble('message')
+ end
+
+ def test_bubblebabble_class
+ expected = "xopoh-fedac-fenyh-nehon-mopel-nivor-lumiz-rypon-gyfot-cosyz-rimez-lolyv-pekyz-rosud-ricob-surac-toxox"
+ assert_equal expected, Digest::SHA256.bubblebabble('message')
+ end
+
+ def test_bubblebabble_instance
+ expected = "xumor-boceg-dakuz-sulic-gukoz-rutas-mekek-zovud-gunap-vabov-genin-rygyg-sanun-hykac-ruvah-dovah-huxex"
+
+ hash = Digest::SHA256.new
+ assert_equal expected, hash.bubblebabble
+ end
+
class TestMD5 < Test::Unit::TestCase
include TestDigest
ALGO = Digest::MD5
@@ -138,6 +169,20 @@ module TestDigest
}
end if defined?(Digest::SHA512)
+ class TestSHA2 < Test::Unit::TestCase
+
+ def test_s_file
+ Tempfile.create("test_digest_file") { |tmpfile|
+ str = Data1
+ tmpfile.print str
+ tmpfile.close
+
+ assert_equal "cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7", Digest::SHA2.file(tmpfile.path, 384).hexdigest
+ }
+ end
+
+ end if defined?(Digest::SHA2)
+
class TestRMD160 < Test::Unit::TestCase
include TestDigest
ALGO = Digest::RMD160
diff --git a/test/digest/test_digest_extend.rb b/test/digest/test_digest_extend.rb
index 2992e28877..adc5613339 100644
--- a/test/digest/test_digest_extend.rb
+++ b/test/digest/test_digest_extend.rb
@@ -1,6 +1,6 @@
require 'test/unit'
require 'digest'
-require_relative '../with_different_ofs.rb'
+require_relative '../lib/with_different_ofs.rb'
class TestDigestExtend < Test::Unit::TestCase
extend DifferentOFS
diff --git a/test/digest/test_digest_hmac.rb b/test/digest/test_digest_hmac.rb
deleted file mode 100644
index 3eb1567397..0000000000
--- a/test/digest/test_digest_hmac.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-require_relative '../inlinetest.rb'
-InlineTest.loadtest__END__part('digest/hmac.rb')
diff --git a/test/dl/test_base.rb b/test/dl/test_base.rb
index c0d91f9edb..dafba6e44d 100644
--- a/test/dl/test_base.rb
+++ b/test/dl/test_base.rb
@@ -36,6 +36,12 @@ when /kfreebsd/
when /gnu/ #GNU/Hurd
libc_so = "/lib/libc.so.0.3"
libm_so = "/lib/libm.so.6"
+when /mirbsd/
+ libc_so = "/usr/lib/libc.so.41.10"
+ libm_so = "/usr/lib/libm.so.7.0"
+when /freebsd/
+ libc_so = "/lib/libc.so.7"
+ libm_so = "/lib/libm.so.5"
when /bsd|dragonfly/
libc_so = "/usr/lib/libc.so"
libm_so = "/usr/lib/libm.so"
@@ -130,5 +136,11 @@ module DL
def test_empty()
end
+
+ def teardown
+ if /linux/ =~ RUBY_PLATFORM
+ GC.start
+ end
+ end
end
end
diff --git a/test/dl/test_cptr.rb b/test/dl/test_cptr.rb
index c3793859d7..aa74a73fe5 100644
--- a/test/dl/test_cptr.rb
+++ b/test/dl/test_cptr.rb
@@ -219,4 +219,8 @@ module DL
assert_raise(DLError) {nullpo[0] = 1}
end
end
+
+ def test_no_memory_leak
+ assert_no_memory_leak(%w[-W0 -rdl.so], '', '100_000.times {DL::CPtr.allocate}', rss: true)
+ end
end
diff --git a/test/dl/test_dl2.rb b/test/dl/test_dl2.rb
index 88ef0869b1..955ac1d855 100644
--- a/test/dl/test_dl2.rb
+++ b/test/dl/test_dl2.rb
@@ -11,15 +11,6 @@ class TestDL < TestBase
# TODO: refactor test repetition
- def test_free_secure
- assert_raises(SecurityError) do
- Thread.new do
- $SAFE = 4
- DL.free(0)
- end.join
- end
- end
-
def test_realloc
str = "abc"
ptr_id = DL.realloc(0, 4)
@@ -33,15 +24,6 @@ class TestDL < TestBase
DL.free ptr_id
end
- def test_realloc_secure
- assert_raises(SecurityError) do
- Thread.new do
- $SAFE = 4
- DL.realloc(0, 4)
- end.join
- end
- end
-
def test_malloc
str = "abc"
@@ -56,15 +38,6 @@ class TestDL < TestBase
DL.free ptr_id
end
- def test_malloc_security
- assert_raises(SecurityError) do
- Thread.new do
- $SAFE = 4
- DL.malloc(4)
- end.join
- end
- end
-
def test_call_int()
cfunc = CFunc.new(@libc['atoi'], TYPE_INT, 'atoi')
x = cfunc.call(["100"].pack("p").unpack("l!*"))
diff --git a/test/dl/test_func.rb b/test/dl/test_func.rb
index 3b5ad3394f..8cc1eac4a0 100644
--- a/test/dl/test_func.rb
+++ b/test/dl/test_func.rb
@@ -153,12 +153,17 @@ module DL
end
def test_qsort1()
+ assert_separately(%W[--disable=gems -r#{__dir__}/test_base.rb -rdl/func], __FILE__, __LINE__, <<-"end;")
+ include DL
+ @libc = dlopen(LIBC_SO)
+ @libm = dlopen(LIBM_SO)
begin
cb = Function.new(CFunc.new(0, TYPE_INT, '<callback>qsort'),
[TYPE_VOIDP, TYPE_VOIDP]){|x,y| CPtr.new(x)[0] <=> CPtr.new(y)[0]}
qsort = Function.new(CFunc.new(@libc['qsort'], TYPE_VOID, 'qsort'),
[TYPE_VOIDP, TYPE_SIZE_T, TYPE_SIZE_T, TYPE_VOIDP])
buff = "9341"
+
qsort.call(buff, buff.size, 1, cb)
assert_equal("1349", buff)
@@ -169,6 +174,7 @@ module DL
ensure
cb.unbind if cb # max number of callbacks is limited to MAX_CALLBACK
end
+ end;
end
def test_qsort2()
diff --git a/test/dl/test_handle.rb b/test/dl/test_handle.rb
index 4ef93adf41..6a8964e9a0 100644
--- a/test/dl/test_handle.rb
+++ b/test/dl/test_handle.rb
@@ -181,7 +181,11 @@ module DL
# In general uses of dlerror(3) should call it before use it.
require 'socket'
Socket.gethostbyname("localhost")
- DL.dlopen("/usr/lib/libc.so").sym('strcpy')
+ DL.dlopen("/lib/libc.so.7").sym('strcpy')
end if /freebsd/=~ RUBY_PLATFORM
end
+
+ def test_no_memory_leak
+ assert_no_memory_leak(%w[-W0 -rdl.so], '', '100_000.times {DL::Handle.allocate}; GC.start', rss: true)
+ end
end
diff --git a/test/drb/drbtest.rb b/test/drb/drbtest.rb
index 6de85cee82..4f12db5003 100644
--- a/test/drb/drbtest.rb
+++ b/test/drb/drbtest.rb
@@ -5,6 +5,8 @@ require 'timeout'
require 'shellwords'
require_relative '../ruby/envutil'
+module DRbTests
+
class DRbService
@@manager = DRb::ExtServManager.new
@@ruby = Shellwords.escape(EnvUtil.rubybin)
@@ -30,6 +32,9 @@ class DRbService
manager.service(name)
end
end
+ def self.finish
+ @server.instance_variable_get(:@grp).list.each {|th| th.join }
+ end
end
class Onecky
@@ -63,9 +68,9 @@ class XArray < Array
end
end
-module DRbCore
- def setup
- @service_name = 'ut_drb.rb'
+module DRbBase
+ def setup_service(service_name)
+ @service_name = service_name
@ext = DRbService.ext_service(@service_name)
@there = @ext.front
end
@@ -94,6 +99,10 @@ module DRbCore
end
}
end
+end
+
+module DRbCore
+ include DRbBase
def test_00_DRbObject
ro = DRbObject.new(nil, 'druby://localhost:12345')
@@ -134,15 +143,11 @@ module DRbCore
def test_02_unknown
obj = @there.unknown_class
assert_kind_of(DRb::DRbUnknown, obj)
- assert_equal('Unknown2', obj.name)
+ assert_equal('DRbTests::Unknown2', obj.name)
obj = @there.unknown_module
assert_kind_of(DRb::DRbUnknown, obj)
- if RUBY_VERSION >= '1.8'
- assert_equal('DRbEx::', obj.name)
- else
- assert_equal('DRbEx', obj.name)
- end
+ assert_equal('DRbTests::DRbEx::', obj.name)
assert_raise(DRb::DRbUnknownError) do
@there.unknown_error
@@ -292,36 +297,7 @@ module DRbCore
end
module DRbAry
- def setup
- @service_name = 'ut_array.rb'
- @ext = DRbService.ext_service(@service_name)
- @there = @ext.front
- end
-
- def teardown
- @ext.stop_service if defined?(@ext) && @ext
- DRbService.manager.unregist(@service_name)
- while (@there&&@there.to_s rescue nil)
- # nop
- end
- signal = /mswin|mingw/ =~ RUBY_PLATFORM ? :KILL : :TERM
- Thread.list.each {|th|
- if th.respond_to?(:pid) && th[:drb_service] == @service_name
- 10.times do
- begin
- Process.kill signal, th.pid
- break
- rescue Errno::ESRCH
- break
- rescue Errno::EPERM # on Windows
- sleep 0.1
- retry
- end
- end
- th.join
- end
- }
- end
+ include DRbBase
def test_01
assert_kind_of(DRb::DRbObject, @there)
@@ -389,3 +365,5 @@ module DRbAry
EOS
end
+
+end
diff --git a/test/drb/ignore_test_drb.rb b/test/drb/ignore_test_drb.rb
index d0bb1f49b0..8b94650534 100644
--- a/test/drb/ignore_test_drb.rb
+++ b/test/drb/ignore_test_drb.rb
@@ -1,24 +1,13 @@
require 'drbtest'
+module DRbTests
+
class TestDRbReusePort < Test::Unit::TestCase
include DRbAry
def setup
- @ext = DRbService.ext_service('ut_port.rb')
- @there = @ext.front
- end
-
- def teardown
- return unless @ext
- @ext.stop_service
- while true
- sleep 0.1
- begin
- @ext.alive?
- rescue DRb::DRbConnError
- break
- end
- end
+ setup_service 'ut_port.rb'
end
end
+end
diff --git a/test/drb/test_acl.rb b/test/drb/test_acl.rb
index 7fe30f4c4a..a1ee1d48c5 100644
--- a/test/drb/test_acl.rb
+++ b/test/drb/test_acl.rb
@@ -7,6 +7,8 @@
require 'test/unit'
require 'drb/acl'
+module DRbTests
+
class SampleHosts
def initialize
list = %w(127.0.0.1 localhost
@@ -192,4 +194,4 @@ class ACLTest < Test::Unit::TestCase
end
end
-
+end
diff --git a/test/drb/test_drb.rb b/test/drb/test_drb.rb
index 5841687b38..ffc2935edc 100644
--- a/test/drb/test_drb.rb
+++ b/test/drb/test_drb.rb
@@ -1,17 +1,32 @@
require_relative 'drbtest'
+module DRbTests
+
class TestDRbCore < Test::Unit::TestCase
include DRbCore
+
+ def setup
+ setup_service 'ut_drb.rb'
+ super
+ end
+
+ def teardown
+ super
+ DRbService.finish
+ end
end
class TestDRbYield < Test::Unit::TestCase
+ include DRbBase
+
def setup
- @ext = DRbService.ext_service('ut_drb.rb')
- @there = @ext.front
+ setup_service 'ut_drb.rb'
+ super
end
def teardown
- @ext.stop_service if @ext
+ super
+ DRbService.finish
end
def test_01_one
@@ -177,12 +192,24 @@ end
class TestDRbAry < Test::Unit::TestCase
include DRbAry
+
+ def setup
+ setup_service 'ut_array.rb'
+ super
+ end
+
+ def teardown
+ super
+ DRbService.finish
+ end
end
class TestDRbMServer < Test::Unit::TestCase
+ include DRbBase
+
def setup
- @ext = DRbService.ext_service('ut_drb.rb')
- @there = @ext.front
+ setup_service 'ut_drb.rb'
+ super
@server = (1..3).collect do |n|
DRb::DRbServer.new(nil, Onecky.new(n.to_s))
end
@@ -192,7 +219,8 @@ class TestDRbMServer < Test::Unit::TestCase
@server.each do |s|
s.stop_service
end
- @ext.stop_service if @ext
+ super
+ DRbService.finish
end
def test_01
@@ -202,9 +230,12 @@ end
class TestDRbSafe1 < TestDRbAry
def setup
- @service_name = 'ut_safe1.rb'
- @ext = DRbService.ext_service(@service_name)
- @there = @ext.front
+ setup_service 'ut_safe1.rb'
+ end
+
+ def teardown
+ super
+ DRbService.finish
end
end
@@ -258,13 +289,16 @@ class TestDRbEval # < Test::Unit::TestCase
end
class TestDRbLarge < Test::Unit::TestCase
+ include DRbBase
+
def setup
- @ext = DRbService.ext_service('ut_large.rb')
- @there = @ext.front
+ setup_service 'ut_large.rb'
+ super
end
def teardown
- @ext.stop_service if @ext
+ super
+ DRbService.finish
end
def test_01_large_ary
@@ -302,13 +336,16 @@ class TestDRbLarge < Test::Unit::TestCase
end
class TestBug4409 < Test::Unit::TestCase
+ include DRbBase
+
def setup
- @ext = DRbService.ext_service('ut_eq.rb')
- @there = @ext.front
+ setup_service 'ut_eq.rb'
+ super
end
def teardown
- @ext.stop_service if @ext
+ super
+ DRbService.finish
end
def test_bug4409
@@ -316,3 +353,5 @@ class TestBug4409 < Test::Unit::TestCase
assert(@there.foo?(foo))
end
end
+
+end
diff --git a/test/drb/test_drbssl.rb b/test/drb/test_drbssl.rb
index 6322434eaa..bcf5f9034a 100644
--- a/test/drb/test_drbssl.rb
+++ b/test/drb/test_drbssl.rb
@@ -5,6 +5,8 @@ begin
rescue LoadError
end
+module DRbTests
+
if Object.const_defined?("OpenSSL")
@@ -36,9 +38,13 @@ end
class TestDRbSSLCore < Test::Unit::TestCase
include DRbCore
def setup
- @service_name = 'ut_drb_drbssl.rb'
- @ext = DRbSSLService.ext_service(@service_name)
- @there = @ext.front
+ setup_service 'ut_drb_drbssl.rb'
+ super
+ end
+
+ def teardown
+ super
+ DRbService.finish
end
def test_02_unknown
@@ -54,11 +60,17 @@ end
class TestDRbSSLAry < Test::Unit::TestCase
include DRbAry
def setup
- @service_name = 'ut_array_drbssl.rb'
- @ext = DRbSSLService.ext_service(@service_name)
- @there = @ext.front
+ setup_service 'ut_array_drbssl.rb'
+ super
+ end
+
+ def teardown
+ super
+ DRbService.finish
end
end
end
+
+end
diff --git a/test/drb/test_drbunix.rb b/test/drb/test_drbunix.rb
index 1fba033aca..c422b7a689 100644
--- a/test/drb/test_drbunix.rb
+++ b/test/drb/test_drbunix.rb
@@ -5,6 +5,8 @@ begin
rescue LoadError
end
+module DRbTests
+
if Object.const_defined?("UNIXServer")
@@ -20,9 +22,13 @@ end
class TestDRbUNIXCore < Test::Unit::TestCase
include DRbCore
def setup
- @service_name = 'ut_drb_drbunix.rb'
- @ext = DRbUNIXService.ext_service(@service_name)
- @there = @ext.front
+ setup_service 'ut_drb_drbunix.rb'
+ super
+ end
+
+ def teardown
+ super
+ DRbService.finish
end
def test_02_unknown
@@ -38,11 +44,16 @@ end
class TestDRbUNIXAry < Test::Unit::TestCase
include DRbAry
def setup
- @service_name = 'ut_array_drbunix.rb'
- @ext = DRbUNIXService.ext_service(@service_name)
- @there = @ext.front
+ setup_service 'ut_array_drbunix.rb'
+ super
+ end
+ def teardown
+ super
+ DRbService.finish
end
end
end
+
+end
diff --git a/test/drb/ut_array.rb b/test/drb/ut_array.rb
index 6d9778ffbc..01599f1d89 100644
--- a/test/drb/ut_array.rb
+++ b/test/drb/ut_array.rb
@@ -8,8 +8,9 @@ if __FILE__ == $0
it
end
- DRb.start_service(nil, [1, 2, 'III', 4, "five", 6])
+ DRb.start_service('druby://localhost:0', [1, 2, 'III', 4, "five", 6])
es = DRb::ExtServ.new(ARGV.shift, ARGV.shift)
DRb.thread.join
+ es.stop_service if es.alive?
end
diff --git a/test/drb/ut_array_drbssl.rb b/test/drb/ut_array_drbssl.rb
index 77ff7ca354..fa9afa6abd 100644
--- a/test/drb/ut_array_drbssl.rb
+++ b/test/drb/ut_array_drbssl.rb
@@ -9,7 +9,9 @@ if __FILE__ == $0
it
end
- TEST_KEY_DH1024 = OpenSSL::PKey::DH.new <<-_end_of_pem_
+ module DRbTests
+
+ TEST_KEY_DH1024 = OpenSSL::PKey::DH.new <<-_end_of_pem_
-----BEGIN DH PARAMETERS-----
MIGHAoGBAKnKQ8MNK6nYZzLrrcuTsLxuiJGXoOO5gT+tljOTbHBuiktdMTITzIY0
pFxIvjG05D7HoBZQfrR0c92NGWPkAiCkhQKB8JCbPVzwNLDy6DZ0pmofDKrEsYHG
@@ -17,10 +19,12 @@ AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOPeVkJ8ePao0eLAgEC
-----END DH PARAMETERS-----
_end_of_pem_
- TEST_KEY_DH1024.priv_key = OpenSSL::BN.new("48561834C67E65FFD2A9B47F41E5E78FDC95C387428FDB1E4B0188B64D1643C3A8D3455B945B7E8C4D166010C7C2CE23BFB9BEF43D0348FE7FA5284B0225E7FE1537546D114E3D8A4411B9B9351AB451E1A358F50ED61B1F00DA29336EEBBD649980AC86D76AF8BBB065298C2052672EEF3EF13AB47A15275FC2836F3AC74CEA", 16)
+ TEST_KEY_DH1024.priv_key = OpenSSL::BN.new("48561834C67E65FFD2A9B47F41E5E78FDC95C387428FDB1E4B0188B64D1643C3A8D3455B945B7E8C4D166010C7C2CE23BFB9BEF43D0348FE7FA5284B0225E7FE1537546D114E3D8A4411B9B9351AB451E1A358F50ED61B1F00DA29336EEBBD649980AC86D76AF8BBB065298C2052672EEF3EF13AB47A15275FC2836F3AC74CEA", 16)
+
+ end
config = Hash.new
- config[:SSLTmpDhCallback] = proc { TEST_KEY_DH1024 }
+ config[:SSLTmpDhCallback] = proc { DRbTests::TEST_KEY_DH1024 }
config[:SSLVerifyMode] = OpenSSL::SSL::VERIFY_PEER
config[:SSLVerifyCallback] = lambda{|ok,x509_store|
true
@@ -28,8 +32,9 @@ AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOPeVkJ8ePao0eLAgEC
config[:SSLCertName] =
[ ["C","JP"], ["O","Foo.DRuby.Org"], ["CN", "Sample"] ]
- DRb.start_service('drbssl://:0', [1, 2, 'III', 4, "five", 6], config)
+ DRb.start_service('drbssl://localhost:0', [1, 2, 'III', 4, "five", 6], config)
es = DRb::ExtServ.new(ARGV.shift, ARGV.shift)
DRb.thread.join
+ es.stop_service if es.alive?
end
diff --git a/test/drb/ut_array_drbunix.rb b/test/drb/ut_array_drbunix.rb
index 76d2a610af..dd397907c7 100644
--- a/test/drb/ut_array_drbunix.rb
+++ b/test/drb/ut_array_drbunix.rb
@@ -11,5 +11,6 @@ if __FILE__ == $0
DRb.start_service('drbunix:', [1, 2, 'III', 4, "five", 6])
es = DRb::ExtServ.new(ARGV.shift, ARGV.shift)
DRb.thread.join
+ es.stop_service if es.alive?
end
diff --git a/test/drb/ut_drb.rb b/test/drb/ut_drb.rb
index c6cc0590f1..c2a5f62331 100644
--- a/test/drb/ut_drb.rb
+++ b/test/drb/ut_drb.rb
@@ -2,6 +2,8 @@ require 'drb/drb'
require 'drb/extserv'
require 'timeout'
+module DRbTests
+
class XArray < Array
def initialize(ary)
ary.each do |x|
@@ -147,6 +149,8 @@ class DRbEx
end
end
+end
+
if __FILE__ == $0
def ARGV.shift
it = super()
@@ -156,7 +160,7 @@ if __FILE__ == $0
DRb::DRbServer.default_argc_limit(8)
DRb::DRbServer.default_load_limit(4096)
- DRb.start_service('druby://localhost:0', DRbEx.new)
+ DRb.start_service('druby://localhost:0', DRbTests::DRbEx.new)
es = DRb::ExtServ.new(ARGV.shift, ARGV.shift)
DRb.thread.join
es.stop_service if es.alive?
diff --git a/test/drb/ut_drb_drbssl.rb b/test/drb/ut_drb_drbssl.rb
index c3a3eb075d..b6d1c12262 100644
--- a/test/drb/ut_drb_drbssl.rb
+++ b/test/drb/ut_drb_drbssl.rb
@@ -8,7 +8,9 @@ if __FILE__ == $0
it
end
- TEST_KEY_DH1024 = OpenSSL::PKey::DH.new <<-_end_of_pem_
+ module DRbTests
+
+ TEST_KEY_DH1024 = OpenSSL::PKey::DH.new <<-_end_of_pem_
-----BEGIN DH PARAMETERS-----
MIGHAoGBAKnKQ8MNK6nYZzLrrcuTsLxuiJGXoOO5gT+tljOTbHBuiktdMTITzIY0
pFxIvjG05D7HoBZQfrR0c92NGWPkAiCkhQKB8JCbPVzwNLDy6DZ0pmofDKrEsYHG
@@ -16,10 +18,12 @@ AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOPeVkJ8ePao0eLAgEC
-----END DH PARAMETERS-----
_end_of_pem_
- TEST_KEY_DH1024.priv_key = OpenSSL::BN.new("48561834C67E65FFD2A9B47F41E5E78FDC95C387428FDB1E4B0188B64D1643C3A8D3455B945B7E8C4D166010C7C2CE23BFB9BEF43D0348FE7FA5284B0225E7FE1537546D114E3D8A4411B9B9351AB451E1A358F50ED61B1F00DA29336EEBBD649980AC86D76AF8BBB065298C2052672EEF3EF13AB47A15275FC2836F3AC74CEA", 16)
+ TEST_KEY_DH1024.priv_key = OpenSSL::BN.new("48561834C67E65FFD2A9B47F41E5E78FDC95C387428FDB1E4B0188B64D1643C3A8D3455B945B7E8C4D166010C7C2CE23BFB9BEF43D0348FE7FA5284B0225E7FE1537546D114E3D8A4411B9B9351AB451E1A358F50ED61B1F00DA29336EEBBD649980AC86D76AF8BBB065298C2052672EEF3EF13AB47A15275FC2836F3AC74CEA", 16)
+
+ end
config = Hash.new
- config[:SSLTmpDhCallback] = proc { TEST_KEY_DH1024 }
+ config[:SSLTmpDhCallback] = proc { DRbTests::TEST_KEY_DH1024 }
config[:SSLVerifyMode] = OpenSSL::SSL::VERIFY_PEER
config[:SSLVerifyCallback] = lambda{|ok,x509_store|
true
@@ -29,8 +33,9 @@ AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOPeVkJ8ePao0eLAgEC
DRb::DRbServer.default_argc_limit(8)
DRb::DRbServer.default_load_limit(4096)
- DRb.start_service('drbssl://localhost:0', DRbEx.new, config)
+ DRb.start_service('drbssl://localhost:0', DRbTests::DRbEx.new, config)
es = DRb::ExtServ.new(ARGV.shift, ARGV.shift)
DRb.thread.join
+ es.stop_service if es.alive?
end
diff --git a/test/drb/ut_drb_drbunix.rb b/test/drb/ut_drb_drbunix.rb
index 8b9484cf9c..c997d2469d 100644
--- a/test/drb/ut_drb_drbunix.rb
+++ b/test/drb/ut_drb_drbunix.rb
@@ -9,8 +9,9 @@ if __FILE__ == $0
DRb::DRbServer.default_argc_limit(8)
DRb::DRbServer.default_load_limit(4096)
- DRb.start_service('drbunix:', DRbEx.new)
+ DRb.start_service('drbunix:', DRbTests::DRbEx.new)
es = DRb::ExtServ.new(ARGV.shift, ARGV.shift)
DRb.thread.join
+ es.stop_service if es.alive?
end
diff --git a/test/drb/ut_eq.rb b/test/drb/ut_eq.rb
index 330af95289..cc86158363 100644
--- a/test/drb/ut_eq.rb
+++ b/test/drb/ut_eq.rb
@@ -1,6 +1,8 @@
require 'drb/drb'
require 'drb/extserv'
+module DRbTests
+
class Foo
include DRbUndumped
end
@@ -17,6 +19,8 @@ class Bar
end
end
+end
+
if __FILE__ == $0
def ARGV.shift
it = super()
@@ -24,7 +28,9 @@ if __FILE__ == $0
it
end
- DRb.start_service('druby://:0', Bar.new)
+ DRb.start_service('druby://localhost:0', DRbTests::Bar.new)
es = DRb::ExtServ.new(ARGV.shift, ARGV.shift)
DRb.thread.join
+ es.stop_service if es.alive?
end
+
diff --git a/test/drb/ut_eval.rb b/test/drb/ut_eval.rb
index 4df963e7cd..c456790fd9 100644
--- a/test/drb/ut_eval.rb
+++ b/test/drb/ut_eval.rb
@@ -1,6 +1,8 @@
require 'drb/drb'
require 'drb/extserv'
+module DRbTests
+
class EvalAttack
def initialize
@four = DRb::DRbServer.new('druby://localhost:0', self, {:safe_level => 4})
@@ -15,6 +17,8 @@ class EvalAttack
end
end
+end
+
if __FILE__ == $0
def ARGV.shift
@@ -25,7 +29,8 @@ if __FILE__ == $0
$SAFE = 1
- DRb.start_service('druby://localhost:0', EvalAttack.new, {:safe_level => 2})
+ DRb.start_service('druby://localhost:0', DRbTests::EvalAttack.new, {:safe_level => 2})
es = DRb::ExtServ.new(ARGV.shift, ARGV.shift)
DRb.thread.join
+ es.stop_service if es.alive?
end
diff --git a/test/drb/ut_large.rb b/test/drb/ut_large.rb
index 9545f78f4b..c2fbd3e184 100644
--- a/test/drb/ut_large.rb
+++ b/test/drb/ut_large.rb
@@ -2,6 +2,8 @@ require 'drb/drb'
require 'drb/extserv'
require 'timeout'
+module DRbTests
+
class DRbLarge
include DRbUndumped
@@ -22,6 +24,8 @@ class DRbLarge
end
end
+end
+
if __FILE__ == $0
def ARGV.shift
it = super()
@@ -31,8 +35,9 @@ if __FILE__ == $0
DRb::DRbServer.default_argc_limit(3)
DRb::DRbServer.default_load_limit(100000)
- DRb.start_service('druby://localhost:0', DRbLarge.new)
+ DRb.start_service('druby://localhost:0', DRbTests::DRbLarge.new)
es = DRb::ExtServ.new(ARGV.shift, ARGV.shift)
DRb.thread.join
+ es.stop_service if es.alive?
end
diff --git a/test/drb/ut_port.rb b/test/drb/ut_port.rb
index 337e0eda86..3009db5acd 100644
--- a/test/drb/ut_port.rb
+++ b/test/drb/ut_port.rb
@@ -11,4 +11,5 @@ if __FILE__ == $0
DRb.start_service('druby://:8473', [1, 2, 'III', 4, "five", 6])
es = DRb::ExtServ.new(ARGV.shift, ARGV.shift)
DRb.thread.join
+ es.stop_service if es.alive?
end
diff --git a/test/drb/ut_safe1.rb b/test/drb/ut_safe1.rb
index 97b4df24ab..43eb367689 100644
--- a/test/drb/ut_safe1.rb
+++ b/test/drb/ut_safe1.rb
@@ -12,4 +12,5 @@ if __FILE__ == $0
{:safe_level => 1})
es = DRb::ExtServ.new(ARGV.shift, ARGV.shift)
DRb.thread.join
+ es.stop_service if es.alive?
end
diff --git a/test/drb/ut_timerholder.rb b/test/drb/ut_timerholder.rb
index 6f66dd3393..6c62ea7726 100644
--- a/test/drb/ut_timerholder.rb
+++ b/test/drb/ut_timerholder.rb
@@ -2,6 +2,8 @@ require 'runit/testcase'
require 'runit/cui/testrunner'
require 'timerholder'
+module DRbTests
+
class TimerHolderTest < RUNIT::TestCase
def do_test(timeout, keeper_sleep = nil)
holder = TimerHolder.new(timeout)
@@ -44,6 +46,8 @@ class TimerHolderTest < RUNIT::TestCase
end
end
+end
+
if __FILE__ == $0
- RUNIT::CUI::TestRunner.run(TimerHolderTest.suite)
+ RUNIT::CUI::TestRunner.run(DRbTests::TimerHolderTest.suite)
end
diff --git a/test/dtrace/helper.rb b/test/dtrace/helper.rb
index 7a327a8695..318857c8dd 100644
--- a/test/dtrace/helper.rb
+++ b/test/dtrace/helper.rb
@@ -1,26 +1,26 @@
# -*- coding: us-ascii -*-
-require 'minitest/autorun'
+require 'test/unit'
require 'tempfile'
require_relative '../ruby/envutil'
if Process.euid == 0
ok = true
-elsif (sudo = ENV["SUDO"]) and (`#{sudo} echo ok` rescue false)
+elsif (sudo = ENV["SUDO"]) and !sudo.empty? and (`#{sudo} echo ok` rescue false)
ok = true
else
ok = false
end
ok &= (`dtrace -V` rescue false)
module DTrace
- class TestCase < MiniTest::Unit::TestCase
- INCLUDE = File.expand_path(File.join(File.dirname(__FILE__), '..'))
+ class TestCase < Test::Unit::TestCase
+ INCLUDE = File.expand_path('..', File.dirname(__FILE__))
def trap_probe d_program, ruby_program
- d = Tempfile.new('probe.d')
+ d = Tempfile.new(%w'probe .d')
d.write d_program
d.flush
- rb = Tempfile.new('probed.rb')
+ rb = Tempfile.new(%w'probed .rb')
rb.write ruby_program
rb.flush
@@ -28,8 +28,15 @@ module DTrace
rb_path = rb.path
cmd = ["dtrace", "-q", "-s", d_path, "-c", "#{EnvUtil.rubybin} -I#{INCLUDE} #{rb_path}"]
- sudo = ENV["SUDO"] and cmd.unshift(sudo)
- probes = IO.popen(cmd) do |io|
+ if sudo = @@sudo
+ [RbConfig::CONFIG["LIBPATHENV"], "RUBY", "RUBYOPT"].each do |name|
+ if name and val = ENV[name]
+ cmd.unshift("#{name}=#{val}")
+ end
+ end
+ cmd.unshift(sudo)
+ end
+ probes = IO.popen(cmd, err: [:child, :out]) do |io|
io.readlines
end
d.close(true)
@@ -38,3 +45,7 @@ module DTrace
end
end
end if ok
+
+if ok
+ DTrace::TestCase.class_variable_set(:@@sudo, sudo)
+end
diff --git a/test/dtrace/test_array_create.rb b/test/dtrace/test_array_create.rb
index affcd475c0..d849bcc0c7 100644
--- a/test/dtrace/test_array_create.rb
+++ b/test/dtrace/test_array_create.rb
@@ -1,4 +1,4 @@
-require 'dtrace/helper'
+require_relative 'helper'
module DTrace
class TestArrayCreate < TestCase
diff --git a/test/dtrace/test_cmethod.rb b/test/dtrace/test_cmethod.rb
index 138ec55ab3..0a9107fa38 100644
--- a/test/dtrace/test_cmethod.rb
+++ b/test/dtrace/test_cmethod.rb
@@ -1,4 +1,4 @@
-require 'dtrace/helper'
+require_relative 'helper'
module DTrace
class TestCMethod < TestCase
diff --git a/test/dtrace/test_function_entry.rb b/test/dtrace/test_function_entry.rb
index c7bf478643..74aee64b02 100644
--- a/test/dtrace/test_function_entry.rb
+++ b/test/dtrace/test_function_entry.rb
@@ -1,4 +1,4 @@
-require 'dtrace/helper'
+require_relative 'helper'
module DTrace
class TestFunctionEntry < TestCase
diff --git a/test/dtrace/test_gc.rb b/test/dtrace/test_gc.rb
index f2a01fb6a0..2f58a11096 100644
--- a/test/dtrace/test_gc.rb
+++ b/test/dtrace/test_gc.rb
@@ -1,4 +1,4 @@
-require 'dtrace/helper'
+require_relative 'helper'
module DTrace
class TestGC < TestCase
diff --git a/test/dtrace/test_hash_create.rb b/test/dtrace/test_hash_create.rb
index 91dd6ce552..2cceded38f 100644
--- a/test/dtrace/test_hash_create.rb
+++ b/test/dtrace/test_hash_create.rb
@@ -1,4 +1,4 @@
-require 'dtrace/helper'
+require_relative 'helper'
module DTrace
class TestHashCreate < TestCase
diff --git a/test/dtrace/test_load.rb b/test/dtrace/test_load.rb
index 095a61d78d..cceb0c2925 100644
--- a/test/dtrace/test_load.rb
+++ b/test/dtrace/test_load.rb
@@ -1,4 +1,4 @@
-require 'dtrace/helper'
+require_relative 'helper'
require 'tempfile'
module DTrace
diff --git a/test/dtrace/test_method_cache.rb b/test/dtrace/test_method_cache.rb
new file mode 100644
index 0000000000..d8ddf454f4
--- /dev/null
+++ b/test/dtrace/test_method_cache.rb
@@ -0,0 +1,28 @@
+require_relative 'helper'
+
+module DTrace
+ class TestMethodCacheClear < TestCase
+ def test_method_cache_clear
+ trap_probe(probe, <<-code) do |_,rbfile,lines|
+ class String; end
+ class String; def abc() end end
+ class Object; def abc() end end
+ code
+ assert_not_includes lines, "String #{rbfile} 1\n"
+ assert_includes lines, "String #{rbfile} 2\n"
+ assert_includes lines, "global #{rbfile} 3\n"
+ end
+ end
+
+ private
+ def probe
+ <<-eoprobe
+ruby$target:::method-cache-clear
+/arg1/
+{
+ printf("%s %s %d\\n", copyinstr(arg0), copyinstr(arg1), arg2);
+}
+ eoprobe
+ end
+ end
+end if defined?(DTrace::TestCase)
diff --git a/test/dtrace/test_object_create_start.rb b/test/dtrace/test_object_create_start.rb
index ae4fb742e2..2be9611613 100644
--- a/test/dtrace/test_object_create_start.rb
+++ b/test/dtrace/test_object_create_start.rb
@@ -1,4 +1,4 @@
-require 'dtrace/helper'
+require_relative 'helper'
module DTrace
class TestObjectCreateStart < TestCase
diff --git a/test/dtrace/test_raise.rb b/test/dtrace/test_raise.rb
index b56ce750d9..48fdbf14d1 100644
--- a/test/dtrace/test_raise.rb
+++ b/test/dtrace/test_raise.rb
@@ -1,4 +1,4 @@
-require 'dtrace/helper'
+require_relative 'helper'
module DTrace
class TestRaise < TestCase
diff --git a/test/dtrace/test_require.rb b/test/dtrace/test_require.rb
index 4dc1bdf360..46a1d7652a 100644
--- a/test/dtrace/test_require.rb
+++ b/test/dtrace/test_require.rb
@@ -1,4 +1,4 @@
-require 'dtrace/helper'
+require_relative 'helper'
module DTrace
class TestRequire < TestCase
diff --git a/test/dtrace/test_singleton_function.rb b/test/dtrace/test_singleton_function.rb
index 4b5d3d7f18..9e118f65b7 100644
--- a/test/dtrace/test_singleton_function.rb
+++ b/test/dtrace/test_singleton_function.rb
@@ -1,4 +1,4 @@
-require 'dtrace/helper'
+require_relative 'helper'
module DTrace
class TestSingletonFunctionEntry < TestCase
diff --git a/test/dtrace/test_string.rb b/test/dtrace/test_string.rb
index 05e8033e39..873d5ac364 100644
--- a/test/dtrace/test_string.rb
+++ b/test/dtrace/test_string.rb
@@ -1,4 +1,4 @@
-require 'dtrace/helper'
+require_relative 'helper'
module DTrace
class TestStringProbes < TestCase
diff --git a/test/erb/test_erb.rb b/test/erb/test_erb.rb
index 89fdbff6eb..65efd39191 100644
--- a/test/erb/test_erb.rb
+++ b/test/erb/test_erb.rb
@@ -185,11 +185,6 @@ EOS
assert_equal(ans, erb.result)
end
- def test_safe_04
- erb = @erb.new('<%=$SAFE%>', 4)
- assert_equal('4', erb.result(TOPLEVEL_BINDING.taint))
- end
-
class Foo; end
def test_def_class
diff --git a/test/erb/test_erb_m17n.rb b/test/erb/test_erb_m17n.rb
index ff49228c26..f60dd103f6 100644
--- a/test/erb/test_erb_m17n.rb
+++ b/test/erb/test_erb_m17n.rb
@@ -1,4 +1,4 @@
-# -*- coding: UTF-8 -*-
+# -*- coding: utf-8 -*-
require 'test/unit'
require 'erb'
diff --git a/test/etc/test_etc.rb b/test/etc/test_etc.rb
index c105122af1..4a099e7df5 100644
--- a/test/etc/test_etc.rb
+++ b/test/etc/test_etc.rb
@@ -112,4 +112,51 @@ class TestEtc < Test::Unit::TestCase
Etc.endgrent
assert_equal(a, b)
end
+
+ def test_uname
+ begin
+ uname = Etc.uname
+ rescue NotImplementedError
+ return
+ end
+ assert_kind_of(Hash, uname)
+ [:sysname, :nodename, :release, :version, :machine].each {|sym|
+ assert_operator(uname, :has_key?, sym)
+ assert_kind_of(String, uname[sym])
+ }
+ end
+
+ def test_sysconf
+ begin
+ Etc.sysconf
+ rescue NotImplementedError
+ return
+ rescue ArgumentError
+ end
+ assert_kind_of(Integer, Etc.sysconf(Etc::SC_CLK_TCK))
+ end if defined?(Etc::SC_CLK_TCK)
+
+ def test_confstr
+ begin
+ Etc.confstr
+ rescue NotImplementedError
+ return
+ rescue ArgumentError
+ end
+ assert_kind_of(String, Etc.confstr(Etc::CS_PATH))
+ end if defined?(Etc::CS_PATH)
+
+ def test_pathconf
+ begin
+ Etc.confstr
+ rescue NotImplementedError
+ return
+ rescue ArgumentError
+ end
+ IO.pipe {|r, w|
+ val = w.pathconf(Etc::PC_PIPE_BUF)
+ assert(val.nil? || val.kind_of?(Integer))
+ }
+ end if defined?(Etc::PC_PIPE_BUF)
+
end
diff --git a/test/fiddle/helper.rb b/test/fiddle/helper.rb
index e5cbecd1db..f58077e7bc 100644
--- a/test/fiddle/helper.rb
+++ b/test/fiddle/helper.rb
@@ -37,6 +37,12 @@ when /kfreebsd/
when /gnu/ #GNU/Hurd
libc_so = "/lib/libc.so.0.3"
libm_so = "/lib/libm.so.6"
+when /mirbsd/
+ libc_so = "/usr/lib/libc.so.41.10"
+ libm_so = "/usr/lib/libm.so.7.0"
+when /freebsd/
+ libc_so = "/lib/libc.so.7"
+ libm_so = "/lib/libm.so.5"
when /bsd|dragonfly/
libc_so = "/usr/lib/libc.so"
libm_so = "/usr/lib/libm.so"
@@ -109,5 +115,11 @@ module Fiddle
@libc = Fiddle.dlopen(LIBC_SO)
@libm = Fiddle.dlopen(LIBM_SO)
end
+
+ def teardown
+ if /linux/ =~ RUBY_PLATFORM
+ GC.start
+ end
+ end
end
end
diff --git a/test/fiddle/test_c_struct_entry.rb b/test/fiddle/test_c_struct_entry.rb
index a6cee75eb9..de5449b43d 100644
--- a/test/fiddle/test_c_struct_entry.rb
+++ b/test/fiddle/test_c_struct_entry.rb
@@ -1,6 +1,8 @@
-require_relative 'helper'
-
-require 'fiddle/struct'
+begin
+ require_relative 'helper'
+ require 'fiddle/struct'
+rescue LoadError
+end
module Fiddle
class TestCStructEntity < TestCase
@@ -71,4 +73,4 @@ module Fiddle
assert_equal("Alice", user["name"].to_s)
end
end
-end
+end if defined?(Fiddle)
diff --git a/test/fiddle/test_c_union_entity.rb b/test/fiddle/test_c_union_entity.rb
index d27c9edb52..165c4ecacb 100644
--- a/test/fiddle/test_c_union_entity.rb
+++ b/test/fiddle/test_c_union_entity.rb
@@ -1,6 +1,9 @@
-require_relative 'helper'
+begin
+ require_relative 'helper'
+ require 'fiddle/struct'
+rescue LoadError
+end
-require 'fiddle/struct'
module Fiddle
class TestCUnionEntity < TestCase
@@ -28,4 +31,4 @@ module Fiddle
assert_equal 1, union['int']
end
end
-end
+end if defined?(Fiddle)
diff --git a/test/fiddle/test_cparser.rb b/test/fiddle/test_cparser.rb
index 32ef82fc6e..666d8c89d6 100644
--- a/test/fiddle/test_cparser.rb
+++ b/test/fiddle/test_cparser.rb
@@ -1,6 +1,8 @@
-require_relative 'helper'
-
-require 'fiddle/cparser'
+begin
+ require_relative 'helper'
+ require 'fiddle/cparser'
+rescue LoadError
+end
module Fiddle
class TestCParser < TestCase
@@ -30,4 +32,4 @@ module Fiddle
assert_equal(TYPE_UINTPTR_T, parse_ctype("uintptr_t"))
end
end
-end
+end if defined?(Fiddle)
diff --git a/test/fiddle/test_func.rb b/test/fiddle/test_func.rb
index 92bcd8ed25..529aaa8baf 100644
--- a/test/fiddle/test_func.rb
+++ b/test/fiddle/test_func.rb
@@ -1,4 +1,7 @@
-require_relative 'helper'
+begin
+ require_relative 'helper'
+rescue LoadError
+end
module Fiddle
class TestFunc < TestCase
@@ -86,4 +89,4 @@ module Fiddle
assert_equal("1349", buff, bug4929)
end
end
-end
+end if defined?(Fiddle)
diff --git a/test/fiddle/test_function.rb b/test/fiddle/test_function.rb
index f7a49dc6fa..63dfbd6e5d 100644
--- a/test/fiddle/test_function.rb
+++ b/test/fiddle/test_function.rb
@@ -1,10 +1,13 @@
begin
require_relative 'helper'
+ require_relative '../ruby/envutil'
rescue LoadError
end
module Fiddle
class TestFunction < Fiddle::TestCase
+ include Test::Unit::Assertions
+
def setup
super
Fiddle.last_error = nil
@@ -59,7 +62,7 @@ module Fiddle
func = Function.new(@libc['strcpy'], [TYPE_VOIDP, TYPE_VOIDP], TYPE_VOIDP)
assert_nil Fiddle.last_error
- str = func.call("000", "123")
+ func.call("000", "123")
refute_nil Fiddle.last_error
end
@@ -70,5 +73,11 @@ module Fiddle
assert_equal("123", buff)
assert_equal("123", str.to_s)
end
+
+ def test_no_memory_leak
+ prep = 'r = Fiddle::Function.new(Fiddle.dlopen(nil)["rb_obj_tainted"], [Fiddle::TYPE_UINTPTR_T], Fiddle::TYPE_UINTPTR_T); a = "a"'
+ code = 'begin r.call(a); rescue TypeError; end'
+ assert_no_memory_leak(%w[-W0 -rfiddle], "#{prep}\n1000.times{#{code}}", "10_000.times {#{code}}", limit: 1.2)
+ end
end
end if defined?(Fiddle)
diff --git a/test/fiddle/test_handle.rb b/test/fiddle/test_handle.rb
index f11272abbf..cde3fa816d 100644
--- a/test/fiddle/test_handle.rb
+++ b/test/fiddle/test_handle.rb
@@ -1,9 +1,15 @@
-require_relative 'helper'
+begin
+ require_relative 'helper'
+ require_relative '../ruby/envutil'
+rescue LoadError
+end
module Fiddle
class TestHandle < TestCase
include Fiddle
+ include Test::Unit::Assertions
+
def test_to_i
handle = Fiddle::Handle.new(LIBC_SO)
assert_kind_of Integer, handle.to_i
@@ -27,13 +33,13 @@ module Fiddle
skip "Fiddle::Handle.sym is not supported" if /mswin|mingw/ =~ RUBY_PLATFORM
begin
# Linux / Darwin / FreeBSD
- refute_nil Fiddle::Handle.sym('dlopen')
- assert_equal Fiddle::Handle.sym('dlopen'), Fiddle::Handle['dlopen']
+ refute_nil Fiddle::Handle.sym('dlopen')
+ assert_equal Fiddle::Handle.sym('dlopen'), Fiddle::Handle['dlopen']
rescue
# NetBSD
require 'objspace'
- refute_nil Fiddle::Handle.sym('Init_objspace')
- assert_equal Fiddle::Handle.sym('Init_objspace'), Fiddle::Handle['Init_objspace']
+ refute_nil Fiddle::Handle.sym('Init_objspace')
+ assert_equal Fiddle::Handle.sym('Init_objspace'), Fiddle::Handle['Init_objspace']
end
end
@@ -180,7 +186,11 @@ module Fiddle
# In general uses of dlerror(3) should call it before use it.
require 'socket'
Socket.gethostbyname("localhost")
- Fiddle.dlopen("/usr/lib/libc.so").sym('strcpy')
+ Fiddle.dlopen("/lib/libc.so.7").sym('strcpy')
end if /freebsd/=~ RUBY_PLATFORM
+
+ def test_no_memory_leak
+ assert_no_memory_leak(%w[-W0 -rfiddle.so], '', '100_000.times {Fiddle::Handle.allocate}; GC.start', rss: true)
+ end
end
-end
+end if defined?(Fiddle)
diff --git a/test/fiddle/test_import.rb b/test/fiddle/test_import.rb
index d792eaf657..c83f50fe44 100644
--- a/test/fiddle/test_import.rb
+++ b/test/fiddle/test_import.rb
@@ -1,6 +1,9 @@
# coding: US-ASCII
-require_relative 'helper'
-require 'fiddle/import'
+begin
+ require_relative 'helper'
+ require 'fiddle/import'
+rescue LoadError
+end
module Fiddle
module LIBC
@@ -60,6 +63,16 @@ module Fiddle
assert_equal(SIZEOF_VOIDP, LIBC.sizeof("FILE*"))
assert_equal(LIBC::MyStruct.size(), LIBC.sizeof(LIBC::MyStruct))
assert_equal(LIBC::MyStruct.size(), LIBC.sizeof(LIBC::MyStruct.malloc()))
+ assert_equal(SIZEOF_LONG_LONG, LIBC.sizeof("long long"))
+ end
+
+ Fiddle.constants.grep(/\ATYPE_(?!VOID\z)(.*)/) do
+ type = $&
+ size = Fiddle.const_get("SIZEOF_#{$1}")
+ name = $1.sub(/P\z/,"*").gsub(/_(?!T\z)/, " ").downcase
+ define_method("test_sizeof_#{name}") do
+ assert_equal(size, Fiddle::Importer.sizeof(name), type)
+ end
end
def test_unsigned_result()
@@ -134,4 +147,4 @@ module Fiddle
assert_includes(12.00..13.00, r)
end
end
-end
+end if defined?(Fiddle)
diff --git a/test/fiddle/test_pointer.rb b/test/fiddle/test_pointer.rb
index ef33b91062..2ba11b4ed7 100644
--- a/test/fiddle/test_pointer.rb
+++ b/test/fiddle/test_pointer.rb
@@ -1,5 +1,8 @@
-require_relative 'helper'
-require_relative '../ruby/envutil'
+begin
+ require_relative 'helper'
+ require_relative '../ruby/envutil'
+rescue LoadError
+end
module Fiddle
class TestPointer < TestCase
@@ -227,5 +230,9 @@ module Fiddle
assert_raise(DLError) {nullpo[0]}
assert_raise(DLError) {nullpo[0] = 1}
end
+
+ def test_no_memory_leak
+ assert_no_memory_leak(%w[-W0 -rfiddle.so], '', '100_000.times {Fiddle::Pointer.allocate}', rss: true)
+ end
end
-end
+end if defined?(Fiddle)
diff --git a/test/fileutils/fileasserts.rb b/test/fileutils/fileasserts.rb
index 0aa139fe16..b6067f6d84 100644
--- a/test/fileutils/fileasserts.rb
+++ b/test/fileutils/fileasserts.rb
@@ -34,7 +34,7 @@ module Test
assert(File.symlink?(path), "is not a symlink: #{path}#{message&&': '}#{message||''}")
end
- def assert_not_symlink(path)
+ def assert_not_symlink(path, message=nil)
assert(!File.symlink?(path), "is a symlink: #{path}#{message&&': '}#{message||''}")
end
@@ -67,6 +67,45 @@ EOT
assert_equal(expected.tv_sec, actual.tv_sec, full_message)
end
+ def assert_filemode(expected, file, message=nil, mask: 07777)
+ width = ('%o' % mask).size
+ actual = File.stat(file).mode & mask
+ assert expected == actual, <<EOT
+File mode of "#{file}" unexpected:
+ Expected: <#{'%0*o' % [width, expected]}>
+ Actual: <#{'%0*o' % [width, actual]}>
+EOT
+ end
+
+ def assert_equal_filemode(file1, file2, message=nil, mask: 07777)
+ mode1, mode2 = [file1, file2].map { |file|
+ File.stat(file).mode & mask
+ }
+ width = ('%o' % mask).size
+ assert mode1 == mode2, <<EOT
+File modes expected to be equal:
+ <#{'%0*o' % [width, mode1]}>: "#{file1}"
+ <#{'%0*o' % [width, mode2]}>: "#{file2}"
+EOT
+ end
+
+ def assert_ownership_group(expected, file)
+ actual = File.stat(file).gid
+ assert expected == actual, <<EOT
+File group ownership of "#{file}" unexpected:
+ Expected: <#{expected}>
+ Actual: <#{actual}>
+EOT
+ end
+
+ def assert_ownership_user(expected, file)
+ actual = File.stat(file).uid
+ assert expected == actual, <<EOT
+File user ownership of "#{file}" unexpected:
+ Expected: <#{expected}>
+ Actual: <#{actual}>
+EOT
+ end
end
end
end
diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb
index 640c3655f4..9263fe0180 100644
--- a/test/fileutils/test_fileutils.rb
+++ b/test/fileutils/test_fileutils.rb
@@ -1,6 +1,7 @@
# $Id$
require 'fileutils'
+require 'etc'
require_relative 'fileasserts'
require 'pathname'
require 'tmpdir'
@@ -9,71 +10,109 @@ require 'test/unit'
class TestFileUtils < Test::Unit::TestCase
TMPROOT = "#{Dir.tmpdir}/fileutils.rb.#{$$}"
include Test::Unit::FileAssertions
-end
-prevdir = Dir.pwd
-tmproot = TestFileUtils::TMPROOT
-Dir.mkdir tmproot unless File.directory?(tmproot)
-Dir.chdir tmproot
+ def assert_output_lines(expected, fu = self, message=nil)
+ old = fu.instance_variable_get(:@fileutils_output)
+ IO.pipe {|read, write|
+ fu.instance_variable_set(:@fileutils_output, write)
+ th = Thread.new { read.read }
-def have_drive_letter?
- /mswin(?!ce)|mingw|bcc|emx/ =~ RUBY_PLATFORM
-end
+ yield
-def have_file_perm?
- /mswin|mingw|bcc|emx/ !~ RUBY_PLATFORM
-end
+ write.close
+ lines = th.value.lines.map {|l| l.chomp }
+ assert_equal(expected, lines)
+ }
+ ensure
+ fu.instance_variable_set(:@fileutils_output, old) if old
+ end
-$fileutils_rb_have_symlink = nil
+ m = Module.new do
+ def have_drive_letter?
+ /mswin(?!ce)|mingw|bcc|emx/ =~ RUBY_PLATFORM
+ end
-def have_symlink?
- if $fileutils_rb_have_symlink == nil
- $fileutils_rb_have_symlink = check_have_symlink?
- end
- $fileutils_rb_have_symlink
-end
+ def have_file_perm?
+ /mswin|mingw|bcc|emx/ !~ RUBY_PLATFORM
+ end
-def check_have_symlink?
- File.symlink nil, nil
-rescue NotImplementedError
- return false
-rescue
- return true
-end
+ @@have_symlink = nil
-$fileutils_rb_have_hardlink = nil
+ def have_symlink?
+ if @@have_symlink == nil
+ @@have_symlink = check_have_symlink?
+ end
+ @@have_symlink
+ end
-def have_hardlink?
- if $fileutils_rb_have_hardlink == nil
- $fileutils_rb_have_hardlink = check_have_hardlink?
- end
- $fileutils_rb_have_hardlink
-end
+ def check_have_symlink?
+ File.symlink nil, nil
+ rescue NotImplementedError
+ return false
+ rescue
+ return true
+ end
-def check_have_hardlink?
- File.link nil, nil
-rescue NotImplementedError
- return false
-rescue
- return true
-end
+ @@have_hardlink = nil
-begin
- Dir.mkdir("\n")
- Dir.rmdir("\n")
- def lf_in_path_allowed?
- true
- end
-rescue
- def lf_in_path_allowed?
- false
- end
-end
+ def have_hardlink?
+ if @@have_hardlink == nil
+ @@have_hardlink = check_have_hardlink?
+ end
+ @@have_hardlink
+ end
+
+ def check_have_hardlink?
+ File.link nil, nil
+ rescue NotImplementedError
+ return false
+ rescue
+ return true
+ end
+
+ def root_in_posix?
+ if Process.respond_to?('uid')
+ return Process.uid == 0
+ else
+ return false
+ end
+ end
-Dir.chdir prevdir
-Dir.rmdir tmproot
+ def distinct_uids(n = 2)
+ return unless user = Etc.getpwent
+ uids = [user.uid]
+ while user = Etc.getpwent
+ uid = user.uid
+ unless uids.include?(uid)
+ uids << uid
+ break if uids.size >= n
+ end
+ end
+ uids
+ ensure
+ Etc.endpwent
+ end
-class TestFileUtils
+ begin
+ tmproot = TMPROOT
+ Dir.mkdir tmproot unless File.directory?(tmproot)
+ Dir.chdir tmproot do
+ Dir.mkdir("\n")
+ Dir.rmdir("\n")
+ end
+ def lf_in_path_allowed?
+ true
+ end
+ rescue
+ def lf_in_path_allowed?
+ false
+ end
+ ensure
+ Dir.rmdir tmproot
+ end
+ end
+ include m
+ extend m
include FileUtils
@@ -96,6 +135,7 @@ class TestFileUtils
def setup
@prevdir = Dir.pwd
+ @groups = Process.groups if have_file_perm?
tmproot = TMPROOT
mymkdir tmproot unless File.directory?(tmproot)
Dir.chdir tmproot
@@ -234,9 +274,7 @@ class TestFileUtils
touch 'tmp/cptmp'
chmod 0755, 'tmp/cptmp'
cp 'tmp/cptmp', 'tmp/cptmp2'
- assert_equal(File.stat('tmp/cptmp').mode,
- File.stat('tmp/cptmp2').mode,
- bug4507)
+ assert_equal_filemode('tmp/cptmp', 'tmp/cptmp2', bug4507)
end
def test_cp_preserve_permissions_dir
@@ -247,12 +285,8 @@ class TestFileUtils
mkdir 'tmp/cptmp/d2'
chmod 0700, 'tmp/cptmp/d2'
cp_r 'tmp/cptmp', 'tmp/cptmp2', :preserve => true
- assert_equal(File.stat('tmp/cptmp/d1').mode,
- File.stat('tmp/cptmp2/d1').mode,
- bug7246)
- assert_equal(File.stat('tmp/cptmp/d2').mode,
- File.stat('tmp/cptmp2/d2').mode,
- bug7246)
+ assert_equal_filemode('tmp/cptmp/d1', 'tmp/cptmp2/d1', bug7246)
+ assert_equal_filemode('tmp/cptmp/d2', 'tmp/cptmp2/d2', bug7246)
end
def test_cp_symlink
@@ -411,6 +445,12 @@ class TestFileUtils
assert_raise(Errno::ELOOP) {
mv 'tmp/symlink', 'tmp/symlink'
}
+ # unexist symlink
+ File.symlink 'xxx', 'tmp/src'
+ assert_nothing_raised {
+ mv 'tmp/src', 'tmp/dest'
+ }
+ assert_equal true, File.symlink?('tmp/dest')
end if have_symlink?
def test_mv_pathname
@@ -756,14 +796,19 @@ class TestFileUtils
mkdir 'tmp/tmp', :mode => 0700
assert_directory 'tmp/tmp'
- assert_equal 0700, (File.stat('tmp/tmp').mode & 0777) if have_file_perm?
+ assert_filemode 0700, 'tmp/tmp', mask: 0777 if have_file_perm?
Dir.rmdir 'tmp/tmp'
+
+ # EISDIR on OS X, FreeBSD; EEXIST on Linux; Errno::EACCES on Windows
+ assert_raise(Errno::EISDIR, Errno::EEXIST, Errno::EACCES) {
+ mkdir '/'
+ }
end
def test_mkdir_file_perm
mkdir 'tmp/tmp', :mode => 07777
assert_directory 'tmp/tmp'
- assert_equal 07777, (File.stat('tmp/tmp').mode & 07777)
+ assert_filemode 07777, 'tmp/tmp'
Dir.rmdir 'tmp/tmp'
end if have_file_perm?
@@ -820,23 +865,25 @@ class TestFileUtils
mkdir_p 'tmp/tmp/tmp', :mode => 0700
assert_directory 'tmp/tmp'
assert_directory 'tmp/tmp/tmp'
- assert_equal 0700, (File.stat('tmp/tmp').mode & 0777) if have_file_perm?
- assert_equal 0700, (File.stat('tmp/tmp/tmp').mode & 0777) if have_file_perm?
+ assert_filemode 0700, 'tmp/tmp', mask: 0777 if have_file_perm?
+ assert_filemode 0700, 'tmp/tmp/tmp', mask: 0777 if have_file_perm?
rm_rf 'tmp/tmp'
mkdir_p 'tmp/tmp', :mode => 0
assert_directory 'tmp/tmp'
- assert_equal 0, (File.stat('tmp/tmp').mode & 0777) if have_file_perm?
+ assert_filemode 0, 'tmp/tmp', mask: 0777 if have_file_perm?
# DO NOT USE rm_rf here.
# (rm(1) try to chdir to parent directory, it fails to remove directory.)
Dir.rmdir 'tmp/tmp'
Dir.rmdir 'tmp'
+
+ mkdir_p '/'
end
def test_mkdir_p_file_perm
mkdir_p 'tmp/tmp/tmp', :mode => 07777
assert_directory 'tmp/tmp/tmp'
- assert_equal 07777, (File.stat('tmp/tmp/tmp').mode & 07777)
+ assert_filemode 07777, 'tmp/tmp/tmp'
Dir.rmdir 'tmp/tmp/tmp'
Dir.rmdir 'tmp/tmp'
end if have_file_perm?
@@ -855,12 +902,12 @@ class TestFileUtils
File.open('tmp/bbb', 'w') {|f| f.puts 'bbb' }
install 'tmp/aaa', 'tmp/bbb', :mode => 0600
assert_equal "aaa\n", File.read('tmp/bbb')
- assert_equal 0600, (File.stat('tmp/bbb').mode & 0777) if have_file_perm?
+ assert_filemode 0600, 'tmp/bbb', mask: 0777 if have_file_perm?
t = File.mtime('tmp/bbb')
install 'tmp/aaa', 'tmp/bbb'
assert_equal "aaa\n", File.read('tmp/bbb')
- assert_equal 0600, (File.stat('tmp/bbb').mode & 0777) if have_file_perm?
+ assert_filemode 0600, 'tmp/bbb', mask: 0777 if have_file_perm?
assert_equal_time t, File.mtime('tmp/bbb')
File.unlink 'tmp/aaa'
@@ -916,27 +963,35 @@ class TestFileUtils
touch 'tmp/a'
chmod 0700, 'tmp/a'
- assert_equal 0700, File.stat('tmp/a').mode & 0777
+ assert_filemode 0700, 'tmp/a'
chmod 0500, 'tmp/a'
- assert_equal 0500, File.stat('tmp/a').mode & 0777
+ assert_filemode 0500, 'tmp/a'
end if have_file_perm?
def test_chmod_symbol_mode
check_singleton :chmod
touch 'tmp/a'
+ chmod "u=wrx,g=rx,o=x", 'tmp/a'
+ assert_filemode 0751, 'tmp/a'
+ chmod "g+w-x", 'tmp/a'
+ assert_filemode 0761, 'tmp/a'
+ chmod "o+r,g=o+w,o-r,u-o", 'tmp/a' # 761 => 763 => 773 => 771 => 671
+ assert_filemode 0671, 'tmp/a'
+ chmod "go=u", 'tmp/a'
+ assert_filemode 0666, 'tmp/a'
chmod "u=wrx,g=,o=", 'tmp/a'
- assert_equal 0700, File.stat('tmp/a').mode & 0777
+ assert_filemode 0700, 'tmp/a'
chmod "u=rx,go=", 'tmp/a'
- assert_equal 0500, File.stat('tmp/a').mode & 0777
+ assert_filemode 0500, 'tmp/a'
chmod "+wrx", 'tmp/a'
- assert_equal 0777, File.stat('tmp/a').mode & 0777
+ assert_filemode 0777, 'tmp/a'
chmod "u+s,o=s", 'tmp/a'
- assert_equal 04770, File.stat('tmp/a').mode & 07777
+ assert_filemode 04770, 'tmp/a'
chmod "u-w,go-wrx", 'tmp/a'
- assert_equal 04500, File.stat('tmp/a').mode & 07777
+ assert_filemode 04500, 'tmp/a'
chmod "+s", 'tmp/a'
- assert_equal 06500, File.stat('tmp/a').mode & 07777
+ assert_filemode 06500, 'tmp/a'
# FreeBSD ufs and tmpfs don't allow to change sticky bit against
# regular file. It's slightly strange. Anyway it's no effect bit.
@@ -944,11 +999,31 @@ class TestFileUtils
# NetBSD, OpenBSD and Solaris also denies it.
if /freebsd|netbsd|openbsd|solaris/ !~ RUBY_PLATFORM
chmod "u+t,o+t", 'tmp/a'
- assert_equal 07500, File.stat('tmp/a').mode & 07777
+ assert_filemode 07500, 'tmp/a'
chmod "a-t,a-s", 'tmp/a'
- assert_equal 0500, File.stat('tmp/a').mode & 07777
+ assert_filemode 0500, 'tmp/a'
end
+ assert_raise_with_message(ArgumentError, /invalid\b.*\bfile mode/) {
+ chmod "a", 'tmp/a'
+ }
+
+ assert_raise_with_message(ArgumentError, /invalid\b.*\bfile mode/) {
+ chmod "x+a", 'tmp/a'
+ }
+
+ assert_raise_with_message(ArgumentError, /invalid\b.*\bfile mode/) {
+ chmod "u+z", 'tmp/a'
+ }
+
+ assert_raise_with_message(ArgumentError, /invalid\b.*\bfile mode/) {
+ chmod ",+x", 'tmp/a'
+ }
+
+ assert_raise_with_message(ArgumentError, /invalid\b.*\bfile mode/) {
+ chmod "755", 'tmp/a'
+ }
+
end if have_file_perm?
@@ -958,15 +1033,15 @@ class TestFileUtils
mkdir_p 'tmp/dir/dir'
touch %w( tmp/dir/file tmp/dir/dir/file )
chmod_R 0700, 'tmp/dir'
- assert_equal 0700, File.stat('tmp/dir').mode & 0777
- assert_equal 0700, File.stat('tmp/dir/file').mode & 0777
- assert_equal 0700, File.stat('tmp/dir/dir').mode & 0777
- assert_equal 0700, File.stat('tmp/dir/dir/file').mode & 0777
+ assert_filemode 0700, 'tmp/dir', mask: 0777
+ assert_filemode 0700, 'tmp/dir/file', mask: 0777
+ assert_filemode 0700, 'tmp/dir/dir', mask: 0777
+ assert_filemode 0700, 'tmp/dir/dir/file', mask: 0777
chmod_R 0500, 'tmp/dir'
- assert_equal 0500, File.stat('tmp/dir').mode & 0777
- assert_equal 0500, File.stat('tmp/dir/file').mode & 0777
- assert_equal 0500, File.stat('tmp/dir/dir').mode & 0777
- assert_equal 0500, File.stat('tmp/dir/dir/file').mode & 0777
+ assert_filemode 0500, 'tmp/dir', mask: 0777
+ assert_filemode 0500, 'tmp/dir/file', mask: 0777
+ assert_filemode 0500, 'tmp/dir/dir', mask: 0777
+ assert_filemode 0500, 'tmp/dir/dir/file', mask: 0777
chmod_R 0700, 'tmp/dir' # to remove
end if have_file_perm?
@@ -976,65 +1051,280 @@ class TestFileUtils
mkdir_p 'tmp/dir/dir'
touch %w( tmp/dir/file tmp/dir/dir/file )
chmod_R "u=wrx,g=,o=", 'tmp/dir'
- assert_equal 0700, File.stat('tmp/dir').mode & 0777
- assert_equal 0700, File.stat('tmp/dir/file').mode & 0777
- assert_equal 0700, File.stat('tmp/dir/dir').mode & 0777
- assert_equal 0700, File.stat('tmp/dir/dir/file').mode & 0777
+ assert_filemode 0700, 'tmp/dir', mask: 0777
+ assert_filemode 0700, 'tmp/dir/file', mask: 0777
+ assert_filemode 0700, 'tmp/dir/dir', mask: 0777
+ assert_filemode 0700, 'tmp/dir/dir/file', mask: 0777
chmod_R "u=xr,g+X,o=", 'tmp/dir'
- assert_equal 0510, File.stat('tmp/dir').mode & 0777
- assert_equal 0500, File.stat('tmp/dir/file').mode & 0777
- assert_equal 0510, File.stat('tmp/dir/dir').mode & 0777
- assert_equal 0500, File.stat('tmp/dir/dir/file').mode & 0777
+ assert_filemode 0510, 'tmp/dir', mask: 0777
+ assert_filemode 0500, 'tmp/dir/file', mask: 0777
+ assert_filemode 0510, 'tmp/dir/dir', mask: 0777
+ assert_filemode 0500, 'tmp/dir/dir/file', mask: 0777
chmod_R 0700, 'tmp/dir' # to remove
end if have_file_perm?
def test_chmod_verbose
check_singleton :chmod
- stderr_back = $stderr
- read, $stderr = IO.pipe
- th = Thread.new { read.read }
-
- touch 'tmp/a'
- chmod 0700, 'tmp/a', verbose: true
- assert_equal 0700, File.stat('tmp/a').mode & 0777
- chmod 0500, 'tmp/a', verbose: true
- assert_equal 0500, File.stat('tmp/a').mode & 0777
-
- $stderr.close
- lines = th.value.lines.map {|l| l.chomp }
- assert_equal(["chmod 700 tmp/a", "chmod 500 tmp/a"], lines)
- ensure
- $stderr = stderr_back if stderr_back
+ assert_output_lines(["chmod 700 tmp/a", "chmod 500 tmp/a"]) {
+ touch 'tmp/a'
+ chmod 0700, 'tmp/a', verbose: true
+ assert_filemode 0700, 'tmp/a', mask: 0777
+ chmod 0500, 'tmp/a', verbose: true
+ assert_filemode 0500, 'tmp/a', mask: 0777
+ }
end if have_file_perm?
def test_s_chmod_verbose
- output_back = FileUtils.instance_variable_get(:@fileutils_output)
- read, write = IO.pipe
- FileUtils.instance_variable_set(:@fileutils_output, write)
- th = Thread.new { read.read }
-
- touch 'tmp/a'
- FileUtils.chmod 0700, 'tmp/a', verbose: true
- assert_equal 0700, File.stat('tmp/a').mode & 0777
-
- write.close
- lines = th.value.lines.map {|l| l.chomp }
- assert_equal(["chmod 700 tmp/a"], lines)
- ensure
- FileUtils.instance_variable_set(:@fileutils_output, output_back) if output_back
+ assert_output_lines(["chmod 700 tmp/a"], FileUtils) {
+ touch 'tmp/a'
+ FileUtils.chmod 0700, 'tmp/a', verbose: true
+ assert_filemode 0700, 'tmp/a', mask: 0777
+ }
end if have_file_perm?
- # FIXME: How can I test this method?
def test_chown
check_singleton :chown
+
+ return unless @groups[1]
+
+ input_group_1 = @groups[0]
+ assert_output_lines([]) {
+ touch 'tmp/a'
+ # integer input for group, nil for user
+ chown nil, input_group_1, 'tmp/a'
+ assert_ownership_group @groups[0], 'tmp/a'
+ }
+
+ input_group_2 = Etc.getgrgid(@groups[1]).name
+ assert_output_lines([]) {
+ touch 'tmp/b'
+ # string input for group, -1 for user
+ chown(-1, input_group_2, 'tmp/b')
+ assert_ownership_group @groups[1], 'tmp/b'
+ }
end if have_file_perm?
- # FIXME: How can I test this method?
- def test_chown_R
- check_singleton :chown_R
+ def test_chown_verbose
+ assert_output_lines(["chown :#{@groups[0]} tmp/a1 tmp/a2"]) {
+ touch 'tmp/a1'
+ touch 'tmp/a2'
+ chown nil, @groups[0], ['tmp/a1', 'tmp/a2'], verbose: true
+ assert_ownership_group @groups[0], 'tmp/a1'
+ assert_ownership_group @groups[0], 'tmp/a2'
+ }
end if have_file_perm?
+ def test_chown_noop
+ return unless @groups[1]
+ assert_output_lines([]) {
+ touch 'tmp/a'
+ chown nil, @groups[0], 'tmp/a', :noop => false
+ assert_ownership_group @groups[0], 'tmp/a'
+ chown nil, @groups[1], 'tmp/a', :noop => true
+ assert_ownership_group @groups[0], 'tmp/a'
+ chown nil, @groups[1], 'tmp/a'
+ assert_ownership_group @groups[1], 'tmp/a'
+ }
+ end if have_file_perm?
+
+ if have_file_perm?
+ def test_chown_error
+ uid, = distinct_uids(1)
+ return unless uid
+
+ touch 'tmp/a'
+
+ # getpwnam("") on Mac OS X doesn't err.
+ # passwd & group databases format is colon-separated, so user &
+ # group name can't contain a colon.
+
+ assert_raise_with_message(ArgumentError, "can't find user for :::") {
+ chown ":::", @groups[0], 'tmp/a'
+ }
+
+ assert_raise_with_message(ArgumentError, "can't find group for :::") {
+ chown uid, ":::", 'tmp/a'
+ }
+
+ assert_raise_with_message(Errno::ENOENT, /No such file or directory/) {
+ chown nil, @groups[0], ''
+ }
+ end
+
+ def test_chown_dir_group_ownership_not_recursive
+ return unless @groups[1]
+
+ input_group_1 = @groups[0]
+ input_group_2 = @groups[1]
+ assert_output_lines([]) {
+ mkdir 'tmp/dir'
+ touch 'tmp/dir/a'
+ chown nil, input_group_1, ['tmp/dir', 'tmp/dir/a']
+ assert_ownership_group @groups[0], 'tmp/dir'
+ assert_ownership_group @groups[0], 'tmp/dir/a'
+ chown nil, input_group_2, 'tmp/dir'
+ assert_ownership_group @groups[1], 'tmp/dir'
+ # Make sure FileUtils.chown does not chown recursively
+ assert_ownership_group @groups[0], 'tmp/dir/a'
+ }
+ end
+
+ def test_chown_R
+ check_singleton :chown_R
+
+ return unless @groups[1]
+
+ input_group_1 = @groups[0]
+ input_group_2 = @groups[1]
+ assert_output_lines([]) {
+ list = ['tmp/dir', 'tmp/dir/a', 'tmp/dir/a/b', 'tmp/dir/a/b/c']
+ mkdir_p 'tmp/dir/a/b/c'
+ touch 'tmp/d'
+ # string input
+ chown_R nil, input_group_1, 'tmp/dir'
+ list.each {|dir|
+ assert_ownership_group @groups[0], dir
+ }
+ chown_R nil, input_group_1, 'tmp/d'
+ assert_ownership_group @groups[0], 'tmp/d'
+ # list input
+ chown_R nil, input_group_2, ['tmp/dir', 'tmp/d']
+ list += ['tmp/d']
+ list.each {|dir|
+ assert_ownership_group @groups[1], dir
+ }
+ }
+ end
+
+ def test_chown_R_verbose
+ assert_output_lines(["chown -R :#{@groups[0]} tmp/dir tmp/d"]) {
+ list = ['tmp/dir', 'tmp/dir/a', 'tmp/dir/a/b', 'tmp/dir/a/b/c']
+ mkdir_p 'tmp/dir/a/b/c'
+ touch 'tmp/d'
+ chown_R nil, @groups[0], ['tmp/dir', 'tmp/d'], :verbose => true
+ list.each {|dir|
+ assert_ownership_group @groups[0], dir
+ }
+ }
+ end
+
+ def test_chown_R_noop
+ return unless @groups[1]
+
+ assert_output_lines([]) {
+ list = ['tmp/dir', 'tmp/dir/a', 'tmp/dir/a/b', 'tmp/dir/a/b/c']
+ mkdir_p 'tmp/dir/a/b/c'
+ chown_R nil, @groups[0], 'tmp/dir', :noop => false
+ list.each {|dir|
+ assert_ownership_group @groups[0], dir
+ }
+ chown_R nil, @groups[1], 'tmp/dir', :noop => true
+ list.each {|dir|
+ assert_ownership_group @groups[0], dir
+ }
+ }
+ end
+
+ def test_chown_R_force
+ assert_output_lines([]) {
+ list = ['tmp/dir', 'tmp/dir/a', 'tmp/dir/a/b', 'tmp/dir/a/b/c']
+ mkdir_p 'tmp/dir/a/b/c'
+ assert_raise_with_message(Errno::ENOENT, /No such file or directory/) {
+ chown_R nil, @groups[0], ['tmp/dir', 'invalid'], :force => false
+ }
+ chown_R nil, @groups[0], ['tmp/dir', 'invalid'], :force => true
+ list.each {|dir|
+ assert_ownership_group @groups[0], dir
+ }
+ }
+ end
+
+ if root_in_posix?
+ def test_chown_with_root
+ uid_1, uid_2 = distinct_uids(2)
+ return unless uid_1 and uid_2
+
+ gid = @groups[0] # Most of the time, root only has one group
+
+ files = ['tmp/a1', 'tmp/a2']
+ files.each {|file| touch file}
+ [uid_1, uid_2].each {|uid|
+ assert_output_lines(["chown #{uid}:#{gid} tmp/a1 tmp/a2"]) {
+ chown uid, gid, files, verbose: true
+ files.each {|file|
+ assert_ownership_group gid, file
+ assert_ownership_user uid, file
+ }
+ }
+ }
+ end
+
+ def test_chown_dir_user_ownership_not_recursive_with_root
+ uid_1, uid_2 = distinct_uids(2)
+ return unless uid_1 and uid_2
+
+ assert_output_lines([]) {
+ mkdir 'tmp/dir'
+ touch 'tmp/dir/a'
+ chown uid_1, nil, ['tmp/dir', 'tmp/dir/a']
+ assert_ownership_user uid_1, 'tmp/dir'
+ assert_ownership_user uid_1, 'tmp/dir/a'
+ chown uid_2, nil, 'tmp/dir'
+ assert_ownership_user uid_2, 'tmp/dir'
+ # Make sure FileUtils.chown does not chown recursively
+ assert_ownership_user uid_1, 'tmp/dir/a'
+ }
+ end
+
+ def test_chown_R_with_root
+ uid_1, uid_2 = distinct_uids(2)
+ return unless uid_1 and uid_2
+
+ assert_output_lines([]) {
+ list = ['tmp/dir', 'tmp/dir/a', 'tmp/dir/a/b', 'tmp/dir/a/b/c']
+ mkdir_p 'tmp/dir/a/b/c'
+ touch 'tmp/d'
+ # string input
+ chown_R uid_1, nil, 'tmp/dir'
+ list.each {|dir|
+ assert_ownership_user uid_1, dir
+ }
+ chown_R uid_1, nil, 'tmp/d'
+ assert_ownership_user uid_1, 'tmp/d'
+ # list input
+ chown_R uid_2, nil, ['tmp/dir', 'tmp/d']
+ list += ['tmp/d']
+ list.each {|dir|
+ assert_ownership_user uid_2, dir
+ }
+ }
+ end
+ else
+ def test_chown_without_permission
+ uid_1, uid_2 = distinct_uids(2)
+ return unless uid_1 and uid_2
+
+ touch 'tmp/a'
+ assert_raise(Errno::EPERM) {
+ chown uid_1, nil, 'tmp/a'
+ chown uid_2, nil, 'tmp/a'
+ }
+ end
+
+ def test_chown_R_without_permission
+ uid_1, uid_2 = distinct_uids(2)
+ return unless uid_1 and uid_2
+
+ touch 'tmp/a'
+ exception = assert_raise(Errno::EPERM) {
+ chown_R uid_1, nil, 'tmp/a'
+ chown_R uid_2, nil, 'tmp/a'
+ }
+ end
+ end
+ end
+
def test_copy_entry
check_singleton :copy_entry
@@ -1170,29 +1460,11 @@ class TestFileUtils
uptodate? Pathname.new('tmp/a'), [Pathname.new('tmp/b'), Pathname.new('tmp/c')]
}
# [Bug #6708] [ruby-core:46256]
- assert_raises_with_message(ArgumentError, "wrong number of arguments (3 for 2)") {
+ assert_raise_with_message(ArgumentError, "wrong number of arguments (3 for 2)") {
uptodate?('new',['old', 'oldest'], {})
}
end
- def assert_raises_with_message(klass, message)
- begin
- yield
- flunk("Expected Exception #{klass} didn't raise")
- rescue klass => ex
- if message.kind_of? String
- flag = !!(ex.message == message)
- assert(flag, "Expected Exception(#{klass}) was raised, but the message doesn't match")
- elsif message.kind_of? Regexp
- flag = !!(ex.message =~ message)
- assert(flag, "Expected Exception(#{klass}) was raised, but the message doesn't match")
- else
- raise
- end
- end
- end
- private :assert_raises_with_message
-
def test_cd
check_singleton :cd
end
@@ -1227,10 +1499,39 @@ class TestFileUtils
def test_rm_rf
check_singleton :rm_rf
+
+ return if /mswin|mingw/ =~ RUBY_PLATFORM
+
+ mkdir 'tmpdatadir'
+ chmod 700, 'tmpdatadir'
+ rm_rf 'tmpdatadir'
+
+ assert_file_not_exist 'tmpdatadir'
end
def test_rmdir
check_singleton :rmdir
+
+ begin
+ Dir.rmdir '/'
+ rescue Errno::ENOTEMPTY
+ rescue => e
+ assert_raise(e.class) {
+ # Dir.rmdir('') raises Errno::ENOENT.
+ # FileUtils#rmdir ignores it.
+ # And this test failed as expected.
+ rmdir '/'
+ }
+ end
+
+ subdir = 'data/sub/dir'
+ mkdir_p(subdir)
+ assert_nothing_raised(Errno::ENOENT) {
+ rmdir(subdir, parents: true)
+ }
+ assert_file_not_exist(subdir)
+ assert_file_not_exist('data/sub')
+ assert_directory('data')
end
def test_rmtree
diff --git a/test/gdbm/test_gdbm.rb b/test/gdbm/test_gdbm.rb
index 38d97c1605..ae6985a5b4 100644
--- a/test/gdbm/test_gdbm.rb
+++ b/test/gdbm/test_gdbm.rb
@@ -1,26 +1,21 @@
-require 'test/unit'
-require 'tmpdir'
-
begin
require 'gdbm'
rescue LoadError
end
if defined? GDBM
+ require 'test/unit'
require 'tmpdir'
require 'fileutils'
+ require_relative '../ruby/envutil'
class TestGDBM_RDONLY < Test::Unit::TestCase
def TestGDBM_RDONLY.uname_s
require 'rbconfig'
case RbConfig::CONFIG['target_os']
when 'cygwin'
- require 'Win32API'
- uname = Win32API.new('cygwin1', 'uname', 'P', 'I')
- utsname = ' ' * 100
- raise 'cannot get system name' if uname.call(utsname) == -1
-
- utsname.unpack('A20' * 5)[0]
+ require 'etc'
+ Etc.uname[:sysname]
else
RbConfig::CONFIG['target_os']
end
@@ -86,15 +81,6 @@ if defined? GDBM
end
end
- def have_fork?
- begin
- fork{}
- true
- rescue NotImplementedError
- false
- end
- end
-
def test_s_new_has_no_block
# GDBM.new ignore the block
foo = true
@@ -144,23 +130,33 @@ if defined? GDBM
def test_s_open_with_block
assert_equal(GDBM.open("#{@tmpdir}/#{@prefix}") { :foo }, :foo)
end
+
+ def open_db_child(dbname, *opts)
+ opts = [0644, *opts].map(&:inspect).join(', ')
+ args = [EnvUtil.rubybin, "-rgdbm", "-e", <<-SRC, dbname]
+ STDOUT.sync = true
+ gdbm = GDBM.open(ARGV.shift, #{opts})
+ puts gdbm.class
+ gets
+ SRC
+ IO.popen(args, "r+") do |f|
+ dbclass = f.gets
+ assert_equal("GDBM", dbclass.chomp)
+ yield
+ end
+ end
+
def test_s_open_lock
- return unless have_fork? # snip this test
- pid = fork() {
- assert_instance_of(GDBM, GDBM.open("#{@tmpdir}/#{@prefix}", 0644))
- sleep 2
- }
- begin
- sleep 1
- assert_raise(Errno::EWOULDBLOCK) {
- begin
- assert_instance_of(GDBM, GDBM.open("#{@tmpdir}/#{@prefix}", 0644))
- rescue Errno::EAGAIN, Errno::EACCES
- raise Errno::EWOULDBLOCK
- end
+ skip "GDBM.open would block when opening already locked gdbm file on platforms without flock and with lockf" if /solaris/ =~ RUBY_PLATFORM
+
+ dbname = "#{@tmpdir}/#{@prefix}"
+
+ open_db_child(dbname) do
+ assert_raise(Errno::EWOULDBLOCK, Errno::EAGAIN, Errno::EACCES) {
+ GDBM.open(dbname, 0644) {|gdbm|
+ assert_instance_of(GDBM, gdbm)
+ }
}
- ensure
- Process.wait pid
end
end
@@ -180,47 +176,31 @@ if defined? GDBM
=end
def test_s_open_nolock
- # gdbm 1.8.0 specific
- if not defined? GDBM::NOLOCK
- return
- end
- return unless have_fork? # snip this test
+ dbname = "#{@tmpdir}/#{@prefix}"
- pid = fork() {
- assert_instance_of(GDBM, GDBM.open("#{@tmpdir}/#{@prefix}", 0644,
- GDBM::NOLOCK))
- sleep 2
- }
- sleep 1
- begin
- gdbm2 = nil
+ open_db_child(dbname, GDBM::NOLOCK) do
assert_nothing_raised(Errno::EWOULDBLOCK, Errno::EAGAIN, Errno::EACCES) {
- assert_instance_of(GDBM, gdbm2 = GDBM.open("#{@tmpdir}/#{@prefix}", 0644))
+ GDBM.open(dbname, 0644) {|gdbm2|
+ assert_instance_of(GDBM, gdbm2)
+ }
}
- ensure
- Process.wait pid
- gdbm2.close if gdbm2
end
- STDERR.puts Dir.glob("#{@tmpdir}/#{@prefix}*") if $DEBUG
+ STDERR.puts Dir.glob("#{dbname}*") if $DEBUG
- pid = fork() {
- assert_instance_of(GDBM, GDBM.open("#{@tmpdir}/#{@prefix}", 0644))
- sleep 2
- }
- begin
- sleep 1
- gdbm2 = nil
+ # The following test fails on Windows because flock() implementation
+ # is different from Unix.
+ return if /mswin|mingw/ =~ RUBY_PLATFORM
+
+ open_db_child(dbname) do
assert_nothing_raised(Errno::EWOULDBLOCK, Errno::EAGAIN, Errno::EACCES) {
# this test is failed on Cygwin98 (???)
- assert_instance_of(GDBM, gdbm2 = GDBM.open("#{@tmpdir}/#{@prefix}", 0644,
- GDBM::NOLOCK))
+ GDBM.open(dbname, 0644, GDBM::NOLOCK) {|gdbm2|
+ assert_instance_of(GDBM, gdbm2)
+ }
}
- ensure
- Process.wait pid
- gdbm2.close if gdbm2
end
- end
+ end if defined? GDBM::NOLOCK # gdbm 1.8.0 specific
def test_s_open_error
assert_instance_of(GDBM, gdbm = GDBM.open("#{@tmpdir}/#{@prefix}", 0))
diff --git a/test/io/console/test_io_console.rb b/test/io/console/test_io_console.rb
index 65514f2b81..9cddd991a6 100644
--- a/test/io/console/test_io_console.rb
+++ b/test/io/console/test_io_console.rb
@@ -26,9 +26,8 @@ class TestIO_Console < Test::Unit::TestCase
end
def test_raw_minchar
- len = 0
- th = nil
helper {|m, s|
+ len = 0
assert_equal([nil, 0], [s.getch(min: 0), len])
main = Thread.current
go = false
@@ -41,18 +40,19 @@ class TestIO_Console < Test::Unit::TestCase
m.print("1234567890")
m.flush
}
- assert_equal(["a", 1], [s.getch(min: 1), len])
- go = true
- assert_equal(["1", 11], [s.getch, len])
+ begin
+ assert_equal(["a", 1], [s.getch(min: 1), len])
+ go = true
+ assert_equal(["1", 11], [s.getch, len])
+ ensure
+ th.join
+ end
}
- ensure
- th.kill if th and th.alive?
end
def test_raw_timeout
- len = 0
- th = nil
helper {|m, s|
+ len = 0
assert_equal([nil, 0], [s.getch(min: 0, time: 0.1), len])
main = Thread.current
th = Thread.start {
@@ -60,11 +60,13 @@ class TestIO_Console < Test::Unit::TestCase
len += 2
m.print("ab")
}
- assert_equal(["a", 2], [s.getch(min: 1, time: 1), len])
- assert_equal(["b", 2], [s.getch(time: 1), len])
+ begin
+ assert_equal(["a", 2], [s.getch(min: 1, time: 1), len])
+ assert_equal(["b", 2], [s.getch(time: 1), len])
+ ensure
+ th.join
+ end
}
- ensure
- th.kill if th and th.alive?
end
def test_cooked
@@ -229,6 +231,9 @@ class TestIO_Console < Test::Unit::TestCase
con = r.gets.chomp
Process.wait(pid)
assert_match("File", con)
+ ensure
+ r.close if r
+ w.close if w
end
end
@@ -262,16 +267,23 @@ class TestIO_Console < Test::Unit::TestCase
t.close
t2 = Tempfile.new("console")
t2.close
- cmd = NOCTTY + [
- '--disable=gems',
- '-rio/console',
- '-e', 'open(ARGV[0], "w") {|f| f.puts IO.console.inspect}',
- '-e', 'File.unlink(ARGV[1])',
+ cmd = [*NOCTTY[1..-1],
+ '-e', 'open(ARGV[0], "w") {|f|',
+ '-e', 'STDOUT.reopen(f)',
+ '-e', 'STDERR.reopen(f)',
+ '-e', 'require "io/console"',
+ '-e', 'f.puts IO.console.inspect',
+ '-e', 'f.flush',
+ '-e', 'File.unlink(ARGV[1])',
+ '-e', '}',
'--', t.path, t2.path]
- system(*cmd)
- sleep 0.1 while File.exist?(t2.path)
+ assert_ruby_status(cmd, rubybin: NOCTTY[0])
+ 30.times do
+ break unless File.exist?(t2.path)
+ sleep 0.1
+ end
t.open
- assert_equal("nil", t.gets.chomp)
+ assert_equal("nil", t.gets(nil).chomp)
ensure
t.close! if t and !t.closed?
t2.close!
diff --git a/test/io/nonblock/test_flush.rb b/test/io/nonblock/test_flush.rb
index b031c71bf8..ab54205174 100644
--- a/test/io/nonblock/test_flush.rb
+++ b/test/io/nonblock/test_flush.rb
@@ -7,9 +7,14 @@ end
class TestIONonblock < Test::Unit::TestCase
def test_flush
- flush_test(*IO.pipe) or
- (require 'socket'; flush_test(*Socket.pair(:INET, :STREAM))) or
- skip "nonblocking IO did not work"
+ IO.pipe {|r, w|
+ return if flush_test(r, w)
+ }
+ require 'socket';
+ Socket.pair(:INET, :STREAM) {|s1, s2|
+ return if flush_test(s1, s2)
+ }
+ skip "nonblocking IO did not work"
end
def flush_test(r, w)
@@ -24,7 +29,7 @@ class TestIONonblock < Test::Unit::TestCase
w << "a" * 4096
result = ""
timeout(10) {
- Thread.new {
+ t0 = Thread.new {
Thread.pass
w.close
}
@@ -39,6 +44,7 @@ class TestIONonblock < Test::Unit::TestCase
# ignore [ruby-dev:35638]
end
assert_nothing_raised {t.join}
+ t0.join
}
assert_equal(4097, result.size)
true
diff --git a/test/io/wait/test_io_wait.rb b/test/io/wait/test_io_wait.rb
index 46097e00c6..9d883aa821 100644
--- a/test/io/wait/test_io_wait.rb
+++ b/test/io/wait/test_io_wait.rb
@@ -62,13 +62,17 @@ class TestIOWait < Test::Unit::TestCase
end
def test_wait_forever
- Thread.new { sleep 0.01; @w.syswrite "." }
+ th = Thread.new { sleep 0.01; @w.syswrite "." }
assert_equal @r, @r.wait
+ ensure
+ th.join
end
def test_wait_eof
- Thread.new { sleep 0.01; @w.close }
+ th = Thread.new { sleep 0.01; @w.close }
assert_nil @r.wait
+ ensure
+ th.join
end
def test_wait_writable
diff --git a/test/irb/test_raise_no_backtrace_exception.rb b/test/irb/test_raise_no_backtrace_exception.rb
new file mode 100644
index 0000000000..e8204d7a1b
--- /dev/null
+++ b/test/irb/test_raise_no_backtrace_exception.rb
@@ -0,0 +1,14 @@
+require 'test/unit'
+require_relative '../ruby/envutil'
+
+module TestIRB
+ class TestRaiseNoBacktraceException < Test::Unit::TestCase
+ def test_raise_exception
+ status = assert_in_out_err(%w[-rirb -e IRB.start(__FILE__) -- -f --], <<-IRB, /Exception: foo/, [])
+ e = Exception.new("foo")
+ def e.backtrace; nil; end
+ raise e
+IRB
+ end
+ end
+end
diff --git a/test/json/test_json.rb b/test/json/test_json.rb
index 6af6b32208..462650e861 100755
--- a/test/json/test_json.rb
+++ b/test/json/test_json.rb
@@ -491,6 +491,8 @@ EOT
assert_equal @hash, JSON.load(stringio)
assert_equal nil, JSON.load(nil)
assert_equal nil, JSON.load('')
+ ensure
+ tempfile.close!
end
def test_load_with_options
diff --git a/test/json/test_json_generate.rb b/test/json/test_json_generate.rb
index 1c8f0bc968..618b933bac 100755
--- a/test/json/test_json_generate.rb
+++ b/test/json/test_json_generate.rb
@@ -252,6 +252,22 @@ EOT
assert_equal '5', state2.array_nl
end
+ def test_configure_hash_conversion
+ state = JSON.state.new
+ state.configure(:indent => '1')
+ assert_equal '1', state.indent
+ state = JSON.state.new
+ foo = 'foo'
+ assert_raise(TypeError) do
+ state.configure(foo)
+ end
+ def foo.to_h
+ { :indent => '2' }
+ end
+ state.configure(foo)
+ assert_equal '2', state.indent
+ end
+
if defined?(JSON::Ext::Generator)
def test_broken_bignum # [ruby-core:38867]
pid = fork do
@@ -298,4 +314,10 @@ EOT
assert_kind_of Hash, state_hash
assert_equal :bar, state_hash[:foo]
end
+
+ def test_json_generate
+ assert_raise JSON::GeneratorError do
+ assert_equal true, JSON.generate(["\xea"])
+ end
+ end
end
diff --git a/test/json/test_json_generic_object.rb b/test/json/test_json_generic_object.rb
index 77ef22e6ae..c43c7762be 100644
--- a/test/json/test_json_generic_object.rb
+++ b/test/json/test_json_generic_object.rb
@@ -49,6 +49,21 @@ class TestJSONGenericObject < Test::Unit::TestCase
assert_equal true, GenericObject.from_hash(true)
end
+ def test_json_generic_object_load
+ empty = JSON::GenericObject.load(nil)
+ assert_kind_of JSON::GenericObject, empty
+ simple_json = '{"json_class":"JSON::GenericObject","hello":"world"}'
+ simple = JSON::GenericObject.load(simple_json)
+ assert_kind_of JSON::GenericObject, simple
+ assert_equal "world", simple.hello
+ converting = JSON::GenericObject.load('{ "hello": "world" }')
+ assert_kind_of JSON::GenericObject, converting
+ assert_equal "world", converting.hello
+
+ json = JSON::GenericObject.dump(JSON::GenericObject[:hello => 'world'])
+ assert_equal JSON(json), JSON('{"json_class":"JSON::GenericObject","hello":"world"}')
+ end
+
private
def switch_json_creatable
diff --git a/test/lib/leakchecker.rb b/test/lib/leakchecker.rb
new file mode 100644
index 0000000000..b6ed19e9c4
--- /dev/null
+++ b/test/lib/leakchecker.rb
@@ -0,0 +1,163 @@
+class LeakChecker
+ def initialize
+ @fd_info = find_fds
+ @tempfile_info = find_tempfiles
+ @thread_info = find_threads
+ end
+
+ def check(test_name)
+ leaked1 = check_fd_leak(test_name)
+ leaked2 = check_thread_leak(test_name)
+ leaked3 = check_tempfile_leak(test_name)
+ GC.start if leaked1 || leaked2 || leaked3
+ end
+
+ def find_fds
+ fd_dir = "/proc/self/fd"
+ if File.directory?(fd_dir)
+ fds = Dir.open(fd_dir) {|d|
+ a = d.grep(/\A\d+\z/, &:to_i)
+ if d.respond_to? :fileno
+ a -= [d.fileno]
+ end
+ a
+ }
+ fds.sort
+ else
+ []
+ end
+ end
+
+ def check_fd_leak(test_name)
+ leaked = false
+ live1 = @fd_info
+ live2 = find_fds
+ fd_closed = live1 - live2
+ if !fd_closed.empty?
+ fd_closed.each {|fd|
+ puts "Closed file descriptor: #{test_name}: #{fd}"
+ }
+ end
+ fd_leaked = live2 - live1
+ if !fd_leaked.empty?
+ leaked = true
+ h = {}
+ ObjectSpace.each_object(IO) {|io|
+ inspect = io.inspect
+ begin
+ autoclose = io.autoclose?
+ fd = io.fileno
+ rescue IOError # closed IO object
+ next
+ end
+ (h[fd] ||= []) << [io, autoclose, inspect]
+ }
+ fd_leaked.each {|fd|
+ str = ''
+ if h[fd]
+ str << ' :'
+ h[fd].map {|io, autoclose, inspect|
+ s = ' ' + inspect
+ s << "(not-autoclose)" if !autoclose
+ s
+ }.sort.each {|s|
+ str << s
+ }
+ end
+ puts "Leaked file descriptor: #{test_name}: #{fd}#{str}"
+ }
+ h.each {|fd, list|
+ next if list.length <= 1
+ if 1 < list.count {|io, autoclose, inspect| autoclose }
+ str = list.map {|io, autoclose, inspect| " #{inspect}" + (autoclose ? "(autoclose)" : "") }.sort.join
+ puts "Multiple autoclose IO object for a file descriptor:#{str}"
+ end
+ }
+ end
+ @fd_info = live2
+ return leaked
+ end
+
+ def extend_tempfile_counter
+ return if defined? LeakChecker::TempfileCounter
+ m = Module.new {
+ @count = 0
+ class << self
+ attr_accessor :count
+ end
+
+ def new(data)
+ LeakChecker::TempfileCounter.count += 1
+ super(data)
+ end
+ }
+ LeakChecker.const_set(:TempfileCounter, m)
+
+ class << Tempfile::Remover
+ prepend LeakChecker::TempfileCounter
+ end
+ end
+
+ def find_tempfiles(prev_count=-1)
+ return [prev_count, []] unless defined? Tempfile
+ extend_tempfile_counter
+ count = TempfileCounter.count
+ if prev_count == count
+ [prev_count, []]
+ else
+ tempfiles = ObjectSpace.each_object(Tempfile).find_all {|t| t.path }
+ [count, tempfiles]
+ end
+ end
+
+ def check_tempfile_leak(test_name)
+ return false, @tempfile_info unless defined? Tempfile
+ count1, initial_tempfiles = @tempfile_info
+ count2, current_tempfiles = find_tempfiles(count1)
+ leaked = false
+ tempfiles_leaked = current_tempfiles - initial_tempfiles
+ if !tempfiles_leaked.empty?
+ leaked = true
+ list = tempfiles_leaked.map {|t| t.inspect }.sort
+ list.each {|str|
+ puts "Leaked tempfile: #{test_name}: #{str}"
+ }
+ tempfiles_leaked.each {|t| t.close! }
+ end
+ @tempfile_info = [count2, initial_tempfiles]
+ return leaked
+ end
+
+ def find_threads
+ Thread.list.find_all {|t|
+ t != Thread.current && /\AWEBrick::/ !~ t.class.name && t.alive?
+ }
+ end
+
+ def check_thread_leak(test_name)
+ live1 = @thread_info
+ live2 = find_threads
+ thread_finished = live1 - live2
+ leaked = false
+ if !thread_finished.empty?
+ list = thread_finished.map {|t| t.inspect }.sort
+ list.each {|str|
+ puts "Finished thread: #{test_name}: #{str}"
+ }
+ end
+ thread_leaked = live2 - live1
+ if !thread_leaked.empty?
+ leaked = true
+ list = thread_leaked.map {|t| t.inspect }.sort
+ list.each {|str|
+ puts "Leaked thread: #{test_name}: #{str}"
+ }
+ end
+ @thread_info = live2
+ return leaked
+ end
+
+ def puts(*a)
+ MiniTest::Unit.output.puts(*a)
+ end
+end
diff --git a/lib/minitest/README.txt b/test/lib/minitest/README.txt
index 6430c1b442..368cc3aa4e 100644
--- a/lib/minitest/README.txt
+++ b/test/lib/minitest/README.txt
@@ -104,7 +104,7 @@ Given that you'd like to test the following class:
def test_that_it_will_not_blend
refute_match /^no/i, @meme.will_it_blend?
end
-
+
def test_that_will_be_skipped
skip "test this later"
end
@@ -221,6 +221,14 @@ Output is tab-delimited to make it easy to paste into a spreadsheet.
end
end
+A note on stubbing: In order to stub a method, the method must
+actually exist prior to stubbing. Use a singleton method to create a
+new non-existing method:
+
+ def obj_under_test.fake_method
+ ...
+ end
+
=== Customizable Test Runner Types:
MiniTest::Unit.runner=(runner) provides an easy way of creating custom
@@ -273,54 +281,113 @@ fixture loading:
MiniTest::Unit.runner = MiniTestWithTransactions::Unit.new
+== FAQ
+
+=== How to test SimpleDelegates?
+
+The following implementation and test:
+
+ class Worker < SimpleDelegator
+ def work
+ end
+ end
+
+ describe Worker do
+ before do
+ @worker = Worker.new(Object.new)
+ end
+
+ it "must respond to work" do
+ @worker.must_respond_to :work
+ end
+ end
+
+outputs a failure:
+
+ 1) Failure:
+ Worker#test_0001_must respond to work [bug11.rb:16]:
+ Expected #<Object:0x007f9e7184f0a0> (Object) to respond to #work.
+
+Worker is a SimpleDelegate which in 1.9+ is a subclass of BasicObject.
+Expectations are put on Object (one level down) so the Worker
+(SimpleDelegate) hits `method_missing` and delegates down to the
+`Object.new` instance. That object doesn't respond to work so the test
+fails.
+
+You can bypass `SimpleDelegate#method_missing` by extending the worker
+with `MiniTest::Expectations`. You can either do that in your setup at
+the instance level, like:
+
+ before do
+ @worker = Worker.new(Object.new)
+ @worker.extend MiniTest::Expectations
+ end
+
+or you can extend the Worker class (within the test file!), like:
+
+ class Worker
+ include ::MiniTest::Expectations
+ end
+
== Known Extensions:
-minitest-capistrano :: Assertions and expectations for testing Capistrano recipes
-minitest-capybara :: Capybara matchers support for minitest unit and spec
-minitest-chef-handler :: Run Minitest suites as Chef report handlers
-minitest-ci :: CI reporter plugin for MiniTest.
-minitest-colorize :: Colorize MiniTest output and show failing tests instantly.
-minitest-context :: Defines contexts for code reuse in MiniTest
- specs that share common expectations.
-minitest-debugger :: Wraps assert so failed assertions drop into
- the ruby debugger.
-minitest-display :: Patches MiniTest to allow for an easily configurable output.
-minitest-emoji :: Print out emoji for your test passes, fails, and skips.
-minitest-excludes :: Clean API for excluding certain tests you
- don't want to run under certain conditions.
-minitest-firemock :: Makes your MiniTest mocks more resilient.
-minitest-growl :: Test notifier for minitest via growl.
-minitest-instrument :: Instrument ActiveSupport::Notifications when
- test method is executed
-minitest-instrument-db :: Store information about speed of test
- execution provided by minitest-instrument in database
-minitest-libnotify :: Test notifier for minitest via libnotify.
-minitest-macruby :: Provides extensions to minitest for macruby UI testing.
-minitest-matchers :: Adds support for RSpec-style matchers to minitest.
-minitest-metadata :: Annotate tests with metadata (key-value).
-minitest-mongoid :: Mongoid assertion matchers for MiniTest
-minitest-must_not :: Provides must_not as an alias for wont in MiniTest
-minitest-predicates :: Adds support for .predicate? methods
-minitest-rails :: MiniTest integration for Rails 3.x
-minitest-rails-capybara :: Capybara integration for MiniTest::Rails
-minitest-reporters :: Create customizable MiniTest output formats
-minitest-rg :: redgreen minitest
-minitest-shouldify :: Adding all manner of shoulds to MiniTest (bad idea)
-minitest-spec-magic :: Minitest::Spec extensions for Rails and beyond
-minitest-tags :: add tags for minitest
-minitest-wscolor :: Yet another test colorizer.
-minitest_owrapper :: Get tests results as a TestResult object.
-minitest_should :: Shoulda style syntax for minitest test::unit.
-minitest_tu_shim :: minitest_tu_shim bridges between test/unit and minitest.
-mongoid-minitest :: MiniTest matchers for Mongoid.
-pry-rescue :: A pry plugin w/ minitest support. See pry-rescue/minitest.rb.
+capybara_minitest_spec :: Bridge between Capybara RSpec matchers and MiniTest::Spec expectations (e.g. page.must_have_content('Title')).
+minispec-metadata :: Metadata for describe/it blocks
+ (e.g. `it 'requires JS driver', js: true do`)
+minitest-ansi :: Colorize minitest output with ANSI colors.
+minitest-around :: Around block for minitest. An alternative to setup/teardown dance.
+minitest-capistrano :: Assertions and expectations for testing Capistrano recipes
+minitest-capybara :: Capybara matchers support for minitest unit and spec
+minitest-chef-handler :: Run Minitest suites as Chef report handlers
+minitest-ci :: CI reporter plugin for MiniTest.
+minitest-colorize :: Colorize MiniTest output and show failing tests instantly.
+minitest-context :: Defines contexts for code reuse in MiniTest
+ specs that share common expectations.
+minitest-debugger :: Wraps assert so failed assertions drop into
+ the ruby debugger.
+minitest-display :: Patches MiniTest to allow for an easily configurable output.
+minitest-emoji :: Print out emoji for your test passes, fails, and skips.
+minitest-english :: Semantically symmetric aliases for assertions and expectations.
+minitest-excludes :: Clean API for excluding certain tests you
+ don't want to run under certain conditions.
+minitest-firemock :: Makes your MiniTest mocks more resilient.
+minitest-great_expectations :: Generally useful additions to minitest's assertions and expectations
+minitest-growl :: Test notifier for minitest via growl.
+minitest-implicit-subject :: Implicit declaration of the test subject.
+minitest-instrument :: Instrument ActiveSupport::Notifications when
+ test method is executed
+minitest-instrument-db :: Store information about speed of test
+ execution provided by minitest-instrument in database
+minitest-libnotify :: Test notifier for minitest via libnotify.
+minitest-macruby :: Provides extensions to minitest for macruby UI testing.
+minitest-matchers :: Adds support for RSpec-style matchers to minitest.
+minitest-metadata :: Annotate tests with metadata (key-value).
+minitest-mongoid :: Mongoid assertion matchers for MiniTest
+minitest-must_not :: Provides must_not as an alias for wont in MiniTest
+minitest-nc :: Test notifier for minitest via Mountain Lion's Notification Center
+minitest-predicates :: Adds support for .predicate? methods
+minitest-rails :: MiniTest integration for Rails 3.x
+minitest-rails-capybara :: Capybara integration for MiniTest::Rails
+minitest-reporters :: Create customizable MiniTest output formats
+minitest-should_syntax :: RSpec-style +x.should == y+ assertions for MiniTest
+minitest-shouldify :: Adding all manner of shoulds to MiniTest (bad idea)
+minitest-spec-context :: Provides rspec-ish context method to MiniTest::Spec
+minitest-spec-magic :: Minitest::Spec extensions for Rails and beyond
+minitest-spec-rails :: Drop in MiniTest::Spec superclass for ActiveSupport::TestCase.
+minitest-stub-const :: Stub constants for the duration of a block
+minitest-tags :: add tags for minitest
+minitest-wscolor :: Yet another test colorizer.
+minitest_owrapper :: Get tests results as a TestResult object.
+minitest_should :: Shoulda style syntax for minitest test::unit.
+minitest_tu_shim :: minitest_tu_shim bridges between test/unit and minitest.
+mongoid-minitest :: MiniTest matchers for Mongoid.
+pry-rescue :: A pry plugin w/ minitest support. See pry-rescue/minitest.rb.
== Unknown Extensions:
Authors... Please send me a pull request with a description of your minitest extension.
* assay-minitest
-* capybara_minitest_spec
* detroit-minitest
* em-minitest-spec
* flexmock-minitest
@@ -328,16 +395,12 @@ Authors... Please send me a pull request with a description of your minitest ext
* guard-minitest-decisiv
* minitest-activemodel
* minitest-ar-assertions
-* minitest-around
* minitest-capybara-unit
* minitest-colorer
* minitest-deluxe
* minitest-extra-assertions
-* minitest-nc
* minitest-rails-shoulda
* minitest-spec
-* minitest-spec-context
-* minitest-spec-rails
* minitest-spec-should
* minitest-sugar
* minitest_should
@@ -358,7 +421,7 @@ the gem, but you'll need to activate the gem explicitly to use it:
require 'rubygems'
gem 'minitest' # ensures you're using the gem, and not the built in MT
require 'minitest/autorun'
-
+
# ... usual testing stuffs ...
DO NOTE: There is a serious problem with the way that ruby 1.9/2.0
diff --git a/test/lib/minitest/autorun.rb b/test/lib/minitest/autorun.rb
new file mode 100644
index 0000000000..88b1e0550d
--- /dev/null
+++ b/test/lib/minitest/autorun.rb
@@ -0,0 +1,13 @@
+# encoding: utf-8
+
+begin
+ require 'rubygems'
+ gem 'minitest'
+rescue Gem::LoadError
+ # do nothing
+end
+
+require 'minitest/unit'
+require 'minitest/mock'
+
+MiniTest::Unit.autorun
diff --git a/lib/minitest/benchmark.rb b/test/lib/minitest/benchmark.rb
index 02121db340..5195fc01bc 100644
--- a/lib/minitest/benchmark.rb
+++ b/test/lib/minitest/benchmark.rb
@@ -1,12 +1,6 @@
# 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'
-require 'minitest/spec'
class MiniTest::Unit # :nodoc:
def run_benchmarks # :nodoc:
@@ -163,6 +157,26 @@ class MiniTest::Unit # :nodoc:
##
# Runs the given +work+ and asserts that the times gathered fit to
+ # match a logarithmic curve within a given error +threshold+.
+ #
+ # Fit is calculated by #fit_logarithmic.
+ #
+ # Ranges are specified by ::bench_range.
+ #
+ # Eg:
+ #
+ # def bench_algorithm
+ # assert_performance_logarithmic 0.9999 do |n|
+ # @obj.algorithm(n)
+ # end
+ # end
+
+ def assert_performance_logarithmic threshold = 0.99, &work
+ assert_performance validation_for_fit(:logarithmic, threshold), &work
+ end
+
+ ##
+ # Runs the given +work+ and asserts that the times gathered fit to
# match a straight line within a given error +threshold+.
#
# Fit is calculated by #fit_linear.
@@ -237,6 +251,29 @@ class MiniTest::Unit # :nodoc:
end
##
+ # To fit a functional form: y = a + b*ln(x).
+ #
+ # Takes x and y values and returns [a, b, r^2].
+ #
+ # See: http://mathworld.wolfram.com/LeastSquaresFittingLogarithmic.html
+
+ def fit_logarithmic xs, ys
+ n = xs.size
+ xys = xs.zip(ys)
+ slnx2 = sigma(xys) { |x,y| Math.log(x) ** 2 }
+ slnx = sigma(xys) { |x,y| Math.log(x) }
+ sylnx = sigma(xys) { |x,y| y * Math.log(x) }
+ sy = sigma(xys) { |x,y| y }
+
+ c = n * slnx2 - slnx ** 2
+ b = ( n * sylnx - sy * slnx ) / c
+ a = (sy - b * slnx) / n
+
+ return a, b, fit_error(xys) { |x| a + b * Math.log(x) }
+ end
+
+
+ ##
# Fits the functional form: a + bx.
#
# Takes x and y values and returns [a, b, r^2].
diff --git a/lib/minitest/mock.rb b/test/lib/minitest/mock.rb
index c636b9e901..19acaff68e 100644
--- a/lib/minitest/mock.rb
+++ b/test/lib/minitest/mock.rb
@@ -1,12 +1,6 @@
# 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.
-######################################################################
-class MockExpectationError < StandardError # :nodoc:
-end # omg... worst bug ever. rdoc doesn't allow 1-liners
+class MockExpectationError < StandardError; end # :nodoc:
##
# A simple and clean mock object framework.
@@ -159,7 +153,8 @@ class Object # :nodoc:
# Add a temporary stubbed method replacing +name+ for the duration
# of the +block+. If +val_or_callable+ responds to #call, then it
# returns the result of calling it, otherwise returns the value
- # as-is. Cleans up the stub at the end of the +block+.
+ # as-is. Cleans up the stub at the end of the +block+. The method
+ # +name+ must exist before stubbing.
#
# def test_stale_eh
# obj_under_test = Something.new
diff --git a/lib/minitest/unit.rb b/test/lib/minitest/unit.rb
index a221dda4b4..665e61446e 100644
--- a/lib/minitest/unit.rb
+++ b/test/lib/minitest/unit.rb
@@ -1,14 +1,8 @@
# 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 'optparse'
-require 'rbconfig'
-require 'thread' # required for 1.8
-require 'minitest/parallel_each'
+require "optparse"
+require "rbconfig"
+require "leakchecker"
##
# Minimal (mostly drop-in) replacement for test-unit.
@@ -40,6 +34,9 @@ module MiniTest
class Skip < Assertion; end
class << self
+ ##
+ # Filter object for backtraces.
+
attr_accessor :backtrace_filter
end
@@ -87,16 +84,17 @@ module MiniTest
# figure out what diff to use.
def self.diff
- @diff = if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ then
+ @diff = if (RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ &&
+ system("diff.exe", __FILE__, __FILE__)) then
"diff.exe -u"
+ elsif Minitest::Unit::Guard.maglev? then # HACK
+ "diff -u"
+ elsif system("gdiff", __FILE__, __FILE__)
+ "gdiff -u" # solaris and kin suck
+ elsif system("diff", __FILE__, __FILE__)
+ "diff -u"
else
- if system("gdiff", __FILE__, __FILE__)
- "gdiff -u" # solaris and kin suck
- elsif system("diff", __FILE__, __FILE__)
- "diff -u"
- else
- nil
- end
+ nil
end unless defined? @diff
@diff
@@ -133,11 +131,16 @@ 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
@@ -158,6 +161,9 @@ module MiniTest
end
result
+ ensure
+ tempfile_a.close! if tempfile_a
+ tempfile_b.close! if tempfile_b
end
##
@@ -177,8 +183,8 @@ module MiniTest
# newlines and makes hex-values generic (like object_ids). This
# uses mu_pp to do the first pass and then cleans it up.
- def mu_pp_for_diff obj # TODO: possibly rename
- mu_pp(obj).gsub(/\\n/, "\n").gsub(/0x[a-f0-9]+/m, '0xXXXXXX')
+ def mu_pp_for_diff obj
+ mu_pp(obj).gsub(/\\n/, "\n").gsub(/:0x[a-fA-F0-9]{4,}/m, ':0xXXXXXX')
end
def _assertions= n # :nodoc:
@@ -203,18 +209,6 @@ module MiniTest
end
##
- # Fails unless the block returns a true value.
- #
- # NOTE: This method is deprecated, use assert. It will be removed
- # on 2013-01-01."
-
- def assert_block msg = nil
- warn "NOTE: MiniTest::Unit::TestCase#assert_block is deprecated, use assert. It will be removed on 2013-01-01. Called from #{caller.first}"
- msg = message(msg) { "Expected block to return true value" }
- assert yield, msg
- end
-
- ##
# Fails unless +obj+ is empty.
def assert_empty obj, msg = nil
@@ -237,7 +231,7 @@ module MiniTest
def assert_equal exp, act, msg = nil
msg = message(msg, "") { diff exp, act }
- assert(exp == act, msg)
+ assert exp == act, msg
end
##
@@ -248,7 +242,9 @@ module MiniTest
def assert_in_delta exp, act, delta = 0.001, msg = nil
n = (exp - act).abs
- msg = message(msg) { "Expected |#{exp} - #{act}| (#{n}) to be < #{delta}"}
+ msg = message(msg) {
+ "Expected |#{exp} - #{act}| (#{n}) to be <= #{delta}"
+ }
assert delta >= n, msg
end
@@ -527,10 +523,12 @@ 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
@@ -562,6 +560,7 @@ module MiniTest
def message msg = nil, ending = ".", &default
proc {
+ msg = msg.call.chomp(".") if Proc === msg
custom_message = "#{msg}.\n" unless msg.nil? or msg.to_s.empty?
"#{custom_message}#{default.call}#{ending}"
}
@@ -611,9 +610,9 @@ module MiniTest
def refute_in_delta exp, act, delta = 0.001, msg = nil
n = (exp - act).abs
msg = message(msg) {
- "Expected |#{exp} - #{act}| (#{n}) to not be < #{delta}"
+ "Expected |#{exp} - #{act}| (#{n}) to not be <= #{delta}"
}
- refute delta > n, msg
+ refute delta >= n, msg
end
##
@@ -723,10 +722,18 @@ module MiniTest
def skip msg = nil, bt = caller
msg ||= "Skipped, no message given"
+ @skip = true
raise MiniTest::Skip, msg, bt
end
##
+ # Was this testcase skipped? Meant for #teardown.
+
+ def skipped?
+ defined?(@skip) and @skip
+ end
+
+ ##
# Takes a block and wraps it with the runner's shared mutex.
def synchronize
@@ -737,16 +744,28 @@ module MiniTest
end
class Unit # :nodoc:
- VERSION = "4.3.2" # :nodoc:
+ VERSION = "4.7.5" # :nodoc:
attr_accessor :report, :failures, :errors, :skips # :nodoc:
- attr_accessor :test_count, :assertion_count # :nodoc:
+ attr_accessor :assertion_count # :nodoc:
+ attr_writer :test_count # :nodoc:
attr_accessor :start_time # :nodoc:
attr_accessor :help # :nodoc:
attr_accessor :verbose # :nodoc:
attr_writer :options # :nodoc:
##
+ # :attr:
+ #
+ # if true, installs an "INFO" signal handler (only available to BSD and
+ # OS X users) which prints diagnostic information about the test run.
+ #
+ # This is auto-detected by default but may be overridden by custom
+ # runners.
+
+ attr_accessor :info_signal
+
+ ##
# Lazy accessor for options.
def options
@@ -847,6 +866,10 @@ module MiniTest
output.print(*a)
end
+ def test_count # :nodoc:
+ @test_count ||= 0
+ end
+
##
# Runner for a given +type+ (eg, test vs bench).
@@ -888,15 +911,11 @@ module MiniTest
end
##
- # Runs all the +suites+ for a given +type+. Runs suites declaring
- # a test_order of +:parallel+ in parallel, and everything else
- # serial.
+ # Runs all the +suites+ for a given +type+.
+ #
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 }
+ suites.map { |suite| _run_suite suite, type }
end
##
@@ -909,7 +928,15 @@ module MiniTest
filter = options[:filter] || '/./'
filter = Regexp.new $1 if filter =~ /\/(.*)\//
- assertions = suite.send("#{type}_methods").grep(filter).map { |method|
+ all_test_methods = suite.send "#{type}_methods"
+
+ filtered_test_methods = all_test_methods.find_all { |m|
+ filter === m || filter === "#{suite}##{m}"
+ }
+
+ leakchecker = LeakChecker.new
+
+ assertions = filtered_test_methods.map { |method|
inst = suite.new method
inst._assertions = 0
@@ -921,6 +948,9 @@ 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
}
@@ -929,7 +959,7 @@ module MiniTest
end
##
- # Record the result of a single run. Makes it very easy to gather
+ # Record the result of a single test. Makes it very easy to gather
# information. Eg:
#
# class StatisticsRecorder < MiniTest::Unit
@@ -939,6 +969,11 @@ module MiniTest
# end
#
# MiniTest::Unit.runner = StatisticsRecorder.new
+ #
+ # NOTE: record might be sent more than once per test. It will be
+ # sent once with the results from the test itself. If there is a
+ # failure or error in teardown, it will be sent again with the
+ # error or failure.
def record suite, method, assertions, time, error
end
@@ -961,14 +996,14 @@ module MiniTest
when MiniTest::Skip then
@skips += 1
return "S" unless @verbose
- "Skipped:\n#{meth}(#{klass}) [#{location e}]:\n#{e.message}\n"
+ "Skipped:\n#{klass}##{meth} [#{location e}]:\n#{e.message}\n"
when MiniTest::Assertion then
@failures += 1
- "Failure:\n#{meth}(#{klass}) [#{location e}]:\n#{e.message}\n"
+ "Failure:\n#{klass}##{meth} [#{location e}]:\n#{e.message}\n"
else
@errors += 1
bt = MiniTest::filter_backtrace(e.backtrace).join "\n "
- "Error:\n#{meth}(#{klass}):\n#{e.class}: #{e.message}\n #{bt}\n"
+ "Error:\n#{klass}##{meth}:\n#{e.class}: #{e.message}\n #{bt}\n"
end
@report << e
e[0, 1]
@@ -978,11 +1013,16 @@ module MiniTest
@report = []
@errors = @failures = @skips = 0
@verbose = false
- @mutex = Mutex.new
+ @mutex = defined?(Mutex) ? Mutex.new : nil
+ @info_signal = Signal.list['INFO']
end
def synchronize # :nodoc:
- @mutex.synchronize { yield }
+ if @mutex then
+ @mutex.synchronize { yield }
+ else
+ yield
+ end
end
def process_args args = [] # :nodoc:
@@ -1039,7 +1079,8 @@ module MiniTest
# Top level driver, controls all output and filtering.
def _run args = []
- self.options = process_args args
+ args = process_args args # ARGH!! blame test/unit process_args
+ self.options.merge! args
puts "Run options: #{help}"
@@ -1048,7 +1089,7 @@ module MiniTest
break unless report.empty?
end
- return failures + errors if @test_count > 0 # or return nil...
+ return failures + errors if self.test_count > 0 # or return nil...
rescue Interrupt
abort 'Interrupted'
end
@@ -1095,6 +1136,15 @@ module MiniTest
##
# Is this running on mri?
+ def maglev? platform = defined?(RUBY_ENGINE) && RUBY_ENGINE
+ "maglev" == platform
+ end
+
+ module_function :maglev?
+
+ ##
+ # Is this running on mri?
+
def mri? platform = RUBY_DESCRIPTION
/^ruby/ =~ platform
end
@@ -1183,79 +1233,6 @@ module MiniTest
def after_teardown; end
end
- module Deprecated # :nodoc:
-
- ##
- # This entire module is deprecated and slated for removal on 2013-01-01.
-
- module Hooks
- def run_setup_hooks # :nodoc:
- _run_hooks self.class.setup_hooks
- end
-
- def _run_hooks hooks # :nodoc:
- hooks.each do |hook|
- if hook.respond_to?(:arity) && hook.arity == 1
- hook.call(self)
- else
- hook.call
- end
- end
- end
-
- def run_teardown_hooks # :nodoc:
- _run_hooks self.class.teardown_hooks.reverse
- end
- end
-
- ##
- # This entire module is deprecated and slated for removal on 2013-01-01.
-
- module HooksCM
- ##
- # Adds a block of code that will be executed before every
- # TestCase is run.
- #
- # NOTE: This method is deprecated, use before/after_setup. It
- # will be removed on 2013-01-01.
-
- def add_setup_hook arg=nil, &block
- warn "NOTE: MiniTest::Unit::TestCase.add_setup_hook is deprecated, use before/after_setup via a module (and call super!). It will be removed on 2013-01-01. Called from #{caller.first}"
- hook = arg || block
- @setup_hooks << hook
- end
-
- def setup_hooks # :nodoc:
- if superclass.respond_to? :setup_hooks then
- superclass.setup_hooks
- else
- []
- end + @setup_hooks
- end
-
- ##
- # Adds a block of code that will be executed after every
- # TestCase is run.
- #
- # NOTE: This method is deprecated, use before/after_teardown. It
- # will be removed on 2013-01-01.
-
- def add_teardown_hook arg=nil, &block
- warn "NOTE: MiniTest::Unit::TestCase#add_teardown_hook is deprecated, use before/after_teardown. It will be removed on 2013-01-01. Called from #{caller.first}"
- hook = arg || block
- @teardown_hooks << hook
- end
-
- def teardown_hooks # :nodoc:
- if superclass.respond_to? :teardown_hooks then
- superclass.teardown_hooks
- else
- []
- end + @teardown_hooks
- end
- end
- end
-
##
# Subclass TestCase to create your own tests. Typically you'll want a
# TestCase subclass per implementation class.
@@ -1264,8 +1241,6 @@ module MiniTest
class TestCase
include LifecycleHooks
- include Deprecated::Hooks
- extend Deprecated::HooksCM # UGH... I can't wait 'til 2013!
include Guard
extend Guard
@@ -1274,8 +1249,6 @@ module MiniTest
PASSTHROUGH_EXCEPTIONS = [NoMemoryError, SignalException,
Interrupt, SystemExit] # :nodoc:
- SUPPORTS_INFO_SIGNAL = Signal.list['INFO'] # :nodoc:
-
##
# Runs the tests reporting the status to +runner+
@@ -1288,7 +1261,7 @@ module MiniTest
time = runner.start_time ? Time.now - runner.start_time : 0
warn "Current Test: %s#%s %.2fs" % [self.class, self.__name__, time]
runner.status $stderr
- end if SUPPORTS_INFO_SIGNAL
+ end if runner.info_signal
start_time = Time.now
@@ -1306,7 +1279,7 @@ module MiniTest
rescue *PASSTHROUGH_EXCEPTIONS
raise
rescue Exception => e
- @passed = false
+ @passed = Skip === e
time = Time.now - start_time
runner.record self.class, self.__name__, self._assertions, time, e
result = runner.puke self.class, self.__name__, e
@@ -1318,10 +1291,11 @@ module MiniTest
raise
rescue Exception => e
@passed = false
+ runner.record self.class, self.__name__, self._assertions, time, e
result = runner.puke self.class, self.__name__, e
end
end
- trap 'INFO', 'DEFAULT' if SUPPORTS_INFO_SIGNAL
+ trap 'INFO', 'DEFAULT' if runner.info_signal
end
result
end
@@ -1332,11 +1306,11 @@ module MiniTest
@__name__ = name
@__io__ = nil
@passed = nil
- @@current = self
+ @@current = self # FIX: make thread local
end
def self.current # :nodoc:
- @@current
+ @@current # FIX: make thread local
end
##
@@ -1386,21 +1360,8 @@ 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!
- 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
- klass.reset_setup_teardown_hooks
super
end
@@ -1448,30 +1409,9 @@ module MiniTest
def teardown; end
- def self.reset_setup_teardown_hooks # :nodoc:
- # also deprecated... believe it.
- @setup_hooks = []
- @teardown_hooks = []
- end
-
- reset_setup_teardown_hooks
-
include MiniTest::Assertions
end # class TestCase
end # class Unit
end # module MiniTest
Minitest = MiniTest # :nodoc: because ugh... I typo this all the time
-
-if $DEBUG then
- module Test # :nodoc:
- module Unit # :nodoc:
- class TestCase # :nodoc:
- def self.inherited x # :nodoc:
- # this helps me ferret out porting issues
- raise "Using minitest and test/unit in the same process: #{x}"
- end
- end
- end
- end
-end
diff --git a/test/lib/profile_test_all.rb b/test/lib/profile_test_all.rb
new file mode 100644
index 0000000000..08de7bb129
--- /dev/null
+++ b/test/lib/profile_test_all.rb
@@ -0,0 +1,90 @@
+#
+# purpose:
+# Profile memory usage of each tests.
+#
+# usage:
+# RUBY_TEST_ALL_PROFILE=[file] make test-all
+#
+# output:
+# [file] specified by RUBY_TEST_ALL_PROFILE
+# If [file] is 'true', then it is ./test_all_profile
+#
+# collected information:
+# - ObjectSpace.memsize_of_all
+# - GC.stat
+# - /proc/meminfo (some fields, if exists)
+# - /proc/self/status (some fields, if exists)
+# - /proc/self/statm (if exists)
+#
+
+require 'objspace'
+
+class MiniTest::Unit::TestCase
+ alias orig_run run
+
+ file = ENV['RUBY_TEST_ALL_PROFILE']
+ file = 'test-all-profile-result' if file == 'true'
+ TEST_ALL_PROFILE_OUT = open(file, 'w')
+ TEST_ALL_PROFILE_GC_STAT_HASH = {}
+ TEST_ALL_PROFILE_BANNER = ['name']
+ TEST_ALL_PROFILE_PROCS = []
+
+ def self.add *name, &b
+ TEST_ALL_PROFILE_BANNER.concat name
+ TEST_ALL_PROFILE_PROCS << b
+ end
+
+ add 'failed?' do |result, tc|
+ result << (tc.passed? ? 0 : 1)
+ end
+
+ add 'memsize_of_all' do |result, *|
+ result << ObjectSpace.memsize_of_all
+ end
+
+ add *GC.stat.keys do |result, *|
+ GC.stat(TEST_ALL_PROFILE_GC_STAT_HASH)
+ result.concat TEST_ALL_PROFILE_GC_STAT_HASH.values
+ end
+
+ def self.add_proc_meminfo file, fields
+ return unless FileTest.exist?(file)
+ regexp = /(#{fields.join("|")}):\s*(\d+) kB/
+ # check = {}; fields.each{|e| check[e] = true}
+ add *fields do |result, *|
+ text = File.read(file)
+ text.scan(regexp){
+ # check.delete $1
+ result << $2
+ ''
+ }
+ # raise check.inspect unless check.empty?
+ end
+ end
+
+ add_proc_meminfo '/proc/meminfo', %w(MemTotal MemFree)
+ add_proc_meminfo '/proc/self/status', %w(VmPeak VmSize VmHWM VmRSS)
+
+ if FileTest.exist?('/proc/self/statm')
+ add *%w(size resident share text lib data dt) do |result, *|
+ result.concat File.read('/proc/self/statm').split(/\s+/)
+ end
+ end
+
+ def memprofile_test_all_result_result
+ result = ["#{self.class}\##{self.__name__.to_s.gsub(/\s+/, '')}"]
+ TEST_ALL_PROFILE_PROCS.each{|proc|
+ proc.call(result, self)
+ }
+ result.join("\t")
+ end
+
+ def run runner
+ result = orig_run(runner)
+ TEST_ALL_PROFILE_OUT.puts memprofile_test_all_result_result
+ TEST_ALL_PROFILE_OUT.flush
+ result
+ end
+
+ TEST_ALL_PROFILE_OUT.puts TEST_ALL_PROFILE_BANNER.join("\t")
+end
diff --git a/lib/test/unit.rb b/test/lib/test/unit.rb
index b96dece837..2b52eefa49 100644
--- a/lib/test/unit.rb
+++ b/test/lib/test/unit.rb
@@ -1,15 +1,25 @@
-# test/unit compatibility layer using minitest.
-
+begin
+ gem 'minitest', '< 5.0.0' if defined? Gem
+rescue Gem::LoadError
+end
require 'minitest/unit'
require 'test/unit/assertions'
require 'test/unit/testcase'
require 'optparse'
+# See Test::Unit
module Test
+ ##
+ # Test::Unit is an implementation of the xUnit testing framework for Ruby.
+ #
+ # If you are writing new test code, please use MiniTest instead of Test::Unit.
+ #
+ # Test::Unit has been left in the standard library to support legacy test
+ # suites.
module Unit
- TEST_UNIT_IMPLEMENTATION = 'test/unit compatibility layer using minitest'
+ TEST_UNIT_IMPLEMENTATION = 'test/unit compatibility layer using minitest' # :nodoc:
- module RunCount
+ module RunCount # :nodoc: all
@@run_count = 0
def self.have_run?
@@ -29,7 +39,7 @@ module Test
module_function :run_once
end
- module Options
+ module Options # :nodoc: all
def initialize(*, &block)
@init_hook = block
@options = nil
@@ -151,7 +161,7 @@ module Test
end
end
- module GlobOption
+ module GlobOption # :nodoc: all
@@testfile_prefix = "test"
def setup_options(parser, options)
@@ -197,7 +207,7 @@ module Test
end
end
- module LoadPathOption
+ module LoadPathOption # :nodoc: all
def setup_options(parser, options)
super
parser.on '-Idirectory', 'Add library load path' do |dirs|
@@ -206,7 +216,7 @@ module Test
end
end
- module GCStressOption
+ module GCStressOption # :nodoc: all
def setup_options(parser, options)
super
parser.on '--[no-]gc-stress', 'Set GC.stress as true' do |flag|
@@ -232,9 +242,10 @@ module Test
end
end
- module RequireFiles
+ 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))
@@ -245,6 +256,8 @@ module Test
require path unless options[:parallel]
result = true
rescue LoadError
+ next if errors[$!.message]
+ errors[$!.message] = true
puts "#{f}: #{$!}"
end
}
@@ -252,7 +265,7 @@ module Test
end
end
- class Runner < MiniTest::Unit
+ class Runner < MiniTest::Unit # :nodoc: all
include Test::Unit::Options
include Test::Unit::GlobOption
include Test::Unit::LoadPathOption
@@ -520,7 +533,11 @@ module Test
def deal(io, type, result, rep, shutting_down = false)
worker = @workers_hash[io]
- case worker.read
+ cmd = worker.read
+ cmd.sub!(/\A\.+/, '')
+ case cmd
+ when ''
+ # just only dots, ignore
when /^okay$/
worker.status = :running
jobs_status
@@ -538,7 +555,12 @@ module Test
jobs_status
when /^done (.+?)$/
- r = Marshal.load($1.unpack("m")[0])
+ begin
+ r = Marshal.load($1.unpack("m")[0])
+ rescue
+ print "unknown object: #{$1.unpack("m")[0].dump}"
+ return true
+ end
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!
@@ -557,6 +579,8 @@ module Test
else
after_worker_down worker
end
+ else
+ print "unknown command: #{cmd.dump}\n"
end
return false
end
@@ -759,7 +783,7 @@ module Test
rep
end
- def initialize # :nodoc:
+ def initialize
super
@tty = $stdout.tty?
end
@@ -777,7 +801,7 @@ module Test
end
end
- class StatusLineOutput < Struct.new(:runner)
+ 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
@@ -798,7 +822,7 @@ module Test
end
end
- class AutoRunner
+ class AutoRunner # :nodoc: all
class Runner < Test::Unit::Runner
include Test::Unit::RequireFiles
end
@@ -839,7 +863,7 @@ module Test
end
end
- class ProxyError < StandardError
+ class ProxyError < StandardError # :nodoc: all
def initialize(ex)
@message = ex.message
@backtrace = ex.backtrace
@@ -850,7 +874,12 @@ module Test
end
end
-class MiniTest::Unit::TestCase
+module MiniTest # :nodoc: all
+ class Unit
+ end
+end
+
+class MiniTest::Unit::TestCase # :nodoc: all
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/test/lib/test/unit/assertions.rb
index 67a289757b..6d255f5869 100644
--- a/lib/test/unit/assertions.rb
+++ b/test/lib/test/unit/assertions.rb
@@ -12,10 +12,8 @@ module Test
MINI_DIR = File.join(File.dirname(File.dirname(File.expand_path(__FILE__))), "minitest") #:nodoc:
- UNASSIGNED = Object.new # :nodoc:
-
# :call-seq:
- # assert( test, failure_message = UNASSIGNED )
+ # assert(test, [failure_message])
#
#Tests if +test+ is true.
#
@@ -26,15 +24,15 @@ module Test
#If no +msg+ is given, a default message will be used.
#
# assert(false, "This was expected to be true")
- def assert(test, msg = UNASSIGNED)
- case msg
- when UNASSIGNED
- msg = nil
+ def assert(test, *msgs)
+ case msg = msgs.first
when String, Proc
+ when nil
+ msgs.shift
else
- bt = caller.reject { |s| s.rindex(MINI_DIR, 0) }
+ 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
+ end unless msgs.empty?
super
end
@@ -56,7 +54,7 @@ module Test
# 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
+ #types may 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
@@ -65,8 +63,80 @@ module Test
# assert_raise NameError do
# puts x #Raises NameError, so assertion succeeds
# end
- def assert_raise(*args, &b)
- assert_raises(*args, &b)
+ def assert_raise(*exp, &b)
+ case exp.last
+ when String, Proc
+ msg = exp.pop
+ end
+
+ begin
+ yield
+ rescue MiniTest::Skip => e
+ return e if exp.include? MiniTest::Skip
+ raise e
+ rescue Exception => e
+ expected = exp.any? { |ex|
+ if ex.instance_of? Module then
+ e.kind_of? ex
+ else
+ e.instance_of? ex
+ end
+ }
+
+ assert expected, proc {
+ exception_details(e, message(msg) {"#{mu_pp(exp)} exception expected, not"}.call)
+ }
+
+ return e
+ end
+
+ exp = exp.first if exp.size == 1
+
+ flunk(message(msg) {"#{mu_pp(exp)} expected but nothing was raised"})
+ 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, &block)
+ 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 || proc {"Exception(#{exception}) with message matches to #{expected.inspect}"}) {yield}
+ msg = message(msg, "") {"Expected Exception(#{exception}) was raised, but the message doesn't match"}
+
+ if assert == :assert_equal
+ assert_equal(expected, ex.message, msg)
+ else
+ msg = message(msg) { "Expected #{mu_pp expected} to match #{mu_pp ex.message}" }
+ assert expected =~ ex.message, msg
+ block.binding.eval("proc{|_|$~=_}").call($~)
+ end
+ ex
end
# :call-seq:
@@ -117,7 +187,8 @@ module Test
# :call-seq:
# assert_nothing_thrown( failure_message = nil, &block )
#
- #Fails if the given block uses a call to Kernel#throw.
+ #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.
#
@@ -126,13 +197,43 @@ module Test
# end
def assert_nothing_thrown(msg=nil)
begin
- yield
+ 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)
+ ret = catch(tag) do
+ begin
+ yield(tag)
+ rescue ArgumentError => e
+ raise unless thrown = e.message[/\Auncaught throw (.+)\z/m, 1]
+ end
+ msg = message(msg) {
+ "Expected #{mu_pp(tag)} to have been thrown"\
+ "#{", not #{thrown}" if thrown}"
+ }
+ assert(false, msg)
+ end
+ assert(true)
+ ret
end
# :call-seq:
@@ -272,8 +373,8 @@ EOT
# * Arguments to the method
#
# Example:
- # assert_send([[1, 2], :member?, 1]) # -> pass
- # assert_send([[1, 2], :member?, 4]) # -> fail
+ # 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) {
@@ -321,10 +422,44 @@ EOT
alias assert_include assert_includes
alias assert_not_include assert_not_includes
+ def assert_all?(obj, m = nil, &blk)
+ failed = []
+ obj.each do |*a, &b|
+ unless blk.call(*a, &b)
+ failed << (a.size > 1 ? a : a[0])
+ end
+ end
+ assert(failed.empty?, message(m) {failed.pretty_inspect})
+ end
+
+ def assert_not_all?(obj, m = nil, &blk)
+ failed = []
+ obj.each do |*a, &b|
+ if blk.call(*a, &b)
+ failed << a.size > 1 ? a : a[0]
+ end
+ end
+ assert(failed.empty?, message(m) {failed.pretty_inspect})
+ end
+
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
+ ary = [msg.call, (default.call if default)].compact.reject(&:empty?)
+ if 1 < ary.length
+ ary[0...-1] = ary[0...-1].map {|str| str.sub(/(?<!\.)\z/, '.') }
+ end
+ ary.join("\n")
+ end
+ else
+ super
+ end
+ end
end
end
end
diff --git a/lib/test/unit/parallel.rb b/test/lib/test/unit/parallel.rb
index d1891838f7..ea809f28ae 100644
--- a/lib/test/unit/parallel.rb
+++ b/test/lib/test/unit/parallel.rb
@@ -1,8 +1,9 @@
+$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../.."
require 'test/unit'
module Test
module Unit
- class Worker < Runner
+ class Worker < Runner # :nodoc:
class << self
undef autorun
end
@@ -12,19 +13,19 @@ module Test
undef _run_suites
undef run
- def increment_io(orig)
+ def increment_io(orig) # :nodoc:
*rest, io = 32.times.inject([orig.dup]){|ios, | ios << ios.last.dup }
rest.each(&:close)
io
end
- def _run_suites(suites, type)
+ def _run_suites(suites, type) # :nodoc:
suites.map do |suite|
_run_suite(suite, type)
end
end
- def _run_suite(suite, type)
+ def _run_suite(suite, type) # :nodoc:
@partial_report = []
orig_testout = MiniTest::Unit.output
i,o = IO.pipe
@@ -34,7 +35,7 @@ module Test
th = Thread.new do
begin
- while buf = (self.verbose ? i.gets : i.read(5))
+ while buf = (self.verbose ? i.gets : i.readpartial(1024))
_report "p", buf
end
rescue IOError
@@ -75,13 +76,13 @@ module Test
return result
ensure
MiniTest::Unit.output = orig_stdout
- $stdin = orig_stdin
- $stdout = orig_stdout
+ $stdin = orig_stdin if orig_stdin
+ $stdout = orig_stdout if orig_stdout
o.close if o && !o.closed?
i.close if i && !i.closed?
end
- def run(args = [])
+ def run(args = []) # :nodoc:
process_args args
@@stop_auto_run = true
@opts = @options.dup
@@ -149,12 +150,17 @@ module Test
end
end
- def _report(res, *args)
+ def _report(res, *args) # :nodoc:
res = "#{res} #{args.pack("m0")}" unless args.empty?
@stdout.puts(res)
end
- def puke(klass, meth, e)
+ 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
@@ -165,7 +171,7 @@ end
if $0 == __FILE__
module Test
module Unit
- class TestCase < MiniTest::Unit::TestCase
+ class TestCase < MiniTest::Unit::TestCase # :nodoc: all
undef on_parallel_worker?
def on_parallel_worker?
true
@@ -174,7 +180,9 @@ if $0 == __FILE__
end
end
require 'rubygems'
- class Gem::TestCase < MiniTest::Unit::TestCase
+ module Gem # :nodoc:
+ end
+ class Gem::TestCase < MiniTest::Unit::TestCase # :nodoc:
@@project_dir = File.expand_path('../../../..', __FILE__)
end
diff --git a/lib/test/unit/testcase.rb b/test/lib/test/unit/testcase.rb
index 59637e1234..984f08dd32 100644
--- a/lib/test/unit/testcase.rb
+++ b/test/lib/test/unit/testcase.rb
@@ -5,7 +5,7 @@ module Test
# remove silly TestCase class
remove_const(:TestCase) if defined?(self::TestCase)
- class TestCase < MiniTest::Unit::TestCase
+ class TestCase < MiniTest::Unit::TestCase # :nodoc: all
include Assertions
def on_parallel_worker?
diff --git a/test/lib/tracepointchecker.rb b/test/lib/tracepointchecker.rb
new file mode 100644
index 0000000000..4612e62e82
--- /dev/null
+++ b/test/lib/tracepointchecker.rb
@@ -0,0 +1,118 @@
+module TracePointChecker
+ STATE = {
+ count: 0,
+ running: false,
+ }
+
+ module ZombieTraceHunter
+ def before_setup
+ @tracepoint_captured_stat = TracePoint.stat.map{|k, (activated, _deleted)| [k, activated]}
+
+ super
+ end
+
+ def after_teardown
+ super
+
+ # detect zombie traces.
+ assert_equal(
+ @tracepoint_captured_stat,
+ TracePoint.stat.map{|k, (activated, _deleted)| [k, activated]},
+ "The number of active trace events was changed"
+ )
+ # puts "TracePoint - deleted: #{deleted}" if deleted > 0
+
+ TracePointChecker.check if STATE[:running]
+ end
+ end
+
+ MAIN_THREAD = Thread.current
+ TRACES = []
+
+ def self.prefix event
+ case event
+ when :call, :return
+ :n
+ when :c_call, :c_return
+ :c
+ when :b_call, :b_return
+ :b
+ end
+ end
+
+ def self.clear_call_stack
+ Thread.current[:call_stack] = []
+ end
+
+ def self.call_stack
+ stack = Thread.current[:call_stack]
+ stack = clear_call_stack unless stack
+ stack
+ end
+
+ def self.verbose_out label, method
+ puts label => call_stack, :count => STATE[:count], :method => method
+ end
+
+ def self.method_label tp
+ "#{prefix(tp.event)}##{tp.method_id}"
+ end
+
+ def self.start verbose: false, stop_at_failure: false
+ call_events = %i(a_call)
+ return_events = %i(a_return)
+ clear_call_stack
+
+ STATE[:running] = true
+
+ TRACES << TracePoint.new(*call_events){|tp|
+ next if Thread.current != MAIN_THREAD
+
+ method = method_label(tp)
+ call_stack.push method
+ STATE[:count] += 1
+
+ verbose_out :psuh, method if verbose
+ }
+
+ TRACES << TracePoint.new(*return_events){|tp|
+ next if Thread.current != MAIN_THREAD
+ STATE[:count] += 1
+
+ method = "#{prefix(tp.event)}##{tp.method_id}"
+ verbose_out :pop1, method if verbose
+
+ stored_method = call_stack.pop
+ next if stored_method.nil?
+
+ verbose_out :pop2, method if verbose
+
+ if stored_method != method
+ stop if stop_at_failure
+ RubyVM::SDR() if defined? RubyVM::SDR()
+ call_stack.clear
+ raise "#{stored_method} is expected, but #{method} (count: #{STATE[:count]})"
+ end
+ }
+
+ TRACES.each{|trace| trace.enable}
+ end
+
+ def self.stop
+ STATE[:running] = true
+ TRACES.each{|trace| trace.disable}
+ TRACES.clear
+ end
+
+ def self.check
+ TRACES.each{|trace|
+ raise "trace #{trace} should not be deactivated" unless trace.enabled?
+ }
+ end
+end
+
+class ::Test::Unit::TestCase
+ include TracePointChecker::ZombieTraceHunter
+end
+
+# TracePointChecker.start verbose: false
diff --git a/test/with_different_ofs.rb b/test/lib/with_different_ofs.rb
index 76dfa6896c..76dfa6896c 100644
--- a/test/with_different_ofs.rb
+++ b/test/lib/with_different_ofs.rb
diff --git a/test/logger/test_logdevice.rb b/test/logger/test_logdevice.rb
new file mode 100644
index 0000000000..78eb12e3c9
--- /dev/null
+++ b/test/logger/test_logdevice.rb
@@ -0,0 +1,420 @@
+# coding: US-ASCII
+require 'test/unit'
+require 'logger'
+require 'tempfile'
+require 'tmpdir'
+require_relative '../ruby/envutil'
+
+class TestLogDevice < Test::Unit::TestCase
+ class LogExcnRaiser
+ def write(*arg)
+ raise 'disk is full'
+ end
+
+ def close
+ end
+
+ def stat
+ Object.new
+ end
+ end
+
+ def setup
+ @tempfile = Tempfile.new("logger")
+ @tempfile.close
+ @filename = @tempfile.path
+ File.unlink(@filename)
+ end
+
+ def teardown
+ @tempfile.close(true)
+ end
+
+ def d(log, opt = {})
+ Logger::LogDevice.new(log, opt)
+ end
+
+ def test_initialize
+ logdev = d(STDERR)
+ assert_equal(STDERR, logdev.dev)
+ assert_nil(logdev.filename)
+ assert_raises(TypeError) do
+ d(nil)
+ end
+ #
+ logdev = d(@filename)
+ begin
+ assert(File.exist?(@filename))
+ assert(logdev.dev.sync)
+ assert_equal(@filename, logdev.filename)
+ logdev.write('hello')
+ ensure
+ logdev.close
+ end
+ # create logfile whitch is already exist.
+ logdev = d(@filename)
+ begin
+ logdev.write('world')
+ logfile = File.read(@filename)
+ assert_equal(2, logfile.split(/\n/).size)
+ assert_match(/^helloworld$/, logfile)
+ ensure
+ logdev.close
+ end
+ end
+
+ def test_write
+ r, w = IO.pipe
+ logdev = d(w)
+ logdev.write("msg2\n\n")
+ IO.select([r], nil, nil, 0.1)
+ w.close
+ msg = r.read
+ r.close
+ assert_equal("msg2\n\n", msg)
+ #
+ logdev = d(LogExcnRaiser.new)
+ class << (stderr = '')
+ alias write <<
+ end
+ $stderr, stderr = stderr, $stderr
+ begin
+ assert_nothing_raised do
+ logdev.write('hello')
+ end
+ ensure
+ logdev.close
+ $stderr, stderr = stderr, $stderr
+ end
+ assert_equal "log writing failed. disk is full\n", stderr
+ end
+
+ def test_close
+ r, w = IO.pipe
+ logdev = d(w)
+ logdev.write("msg2\n\n")
+ IO.select([r], nil, nil, 0.1)
+ assert(!w.closed?)
+ logdev.close
+ assert(w.closed?)
+ r.close
+ end
+
+ def test_shifting_size
+ tmpfile = Tempfile.new([File.basename(__FILE__, '.*'), '_1.log'])
+ logfile = tmpfile.path
+ logfile0 = logfile + '.0'
+ logfile1 = logfile + '.1'
+ logfile2 = logfile + '.2'
+ logfile3 = logfile + '.3'
+ tmpfile.close(true)
+ File.unlink(logfile) if File.exist?(logfile)
+ File.unlink(logfile0) if File.exist?(logfile0)
+ File.unlink(logfile1) if File.exist?(logfile1)
+ File.unlink(logfile2) if File.exist?(logfile2)
+ logger = Logger.new(logfile, 4, 100)
+ logger.error("0" * 15)
+ assert(File.exist?(logfile))
+ assert(!File.exist?(logfile0))
+ logger.error("0" * 15)
+ assert(File.exist?(logfile0))
+ assert(!File.exist?(logfile1))
+ logger.error("0" * 15)
+ assert(File.exist?(logfile1))
+ assert(!File.exist?(logfile2))
+ logger.error("0" * 15)
+ assert(File.exist?(logfile2))
+ assert(!File.exist?(logfile3))
+ logger.error("0" * 15)
+ assert(!File.exist?(logfile3))
+ logger.error("0" * 15)
+ assert(!File.exist?(logfile3))
+ logger.close
+ File.unlink(logfile)
+ File.unlink(logfile0)
+ File.unlink(logfile1)
+ File.unlink(logfile2)
+
+ tmpfile = Tempfile.new([File.basename(__FILE__, '.*'), '_2.log'])
+ logfile = tmpfile.path
+ logfile0 = logfile + '.0'
+ logfile1 = logfile + '.1'
+ logfile2 = logfile + '.2'
+ logfile3 = logfile + '.3'
+ tmpfile.close(true)
+ logger = Logger.new(logfile, 4, 150)
+ logger.error("0" * 15)
+ assert(File.exist?(logfile))
+ assert(!File.exist?(logfile0))
+ logger.error("0" * 15)
+ assert(!File.exist?(logfile0))
+ logger.error("0" * 15)
+ assert(File.exist?(logfile0))
+ assert(!File.exist?(logfile1))
+ logger.error("0" * 15)
+ assert(!File.exist?(logfile1))
+ logger.error("0" * 15)
+ assert(File.exist?(logfile1))
+ assert(!File.exist?(logfile2))
+ logger.error("0" * 15)
+ assert(!File.exist?(logfile2))
+ logger.error("0" * 15)
+ assert(File.exist?(logfile2))
+ assert(!File.exist?(logfile3))
+ logger.error("0" * 15)
+ assert(!File.exist?(logfile3))
+ logger.error("0" * 15)
+ assert(!File.exist?(logfile3))
+ logger.error("0" * 15)
+ assert(!File.exist?(logfile3))
+ logger.close
+ File.unlink(logfile)
+ File.unlink(logfile0)
+ File.unlink(logfile1)
+ File.unlink(logfile2)
+ end
+
+ def test_shifting_age_variants
+ logger = Logger.new(@filename, 'daily')
+ logger.info('daily')
+ logger.close
+ logger = Logger.new(@filename, 'weekly')
+ logger.info('weekly')
+ logger.close
+ logger = Logger.new(@filename, 'monthly')
+ logger.info('monthly')
+ logger.close
+ end
+
+ def test_shifting_age
+ # shift_age other than 'daily', 'weekly', and 'monthly' means 'everytime'
+ yyyymmdd = Time.now.strftime("%Y%m%d")
+ filename1 = @filename + ".#{yyyymmdd}"
+ filename2 = @filename + ".#{yyyymmdd}.1"
+ filename3 = @filename + ".#{yyyymmdd}.2"
+ begin
+ logger = Logger.new(@filename, 'now')
+ assert(File.exist?(@filename))
+ assert(!File.exist?(filename1))
+ assert(!File.exist?(filename2))
+ assert(!File.exist?(filename3))
+ logger.info("0" * 15)
+ assert(File.exist?(@filename))
+ assert(File.exist?(filename1))
+ assert(!File.exist?(filename2))
+ assert(!File.exist?(filename3))
+ logger.warn("0" * 15)
+ assert(File.exist?(@filename))
+ assert(File.exist?(filename1))
+ assert(File.exist?(filename2))
+ assert(!File.exist?(filename3))
+ logger.error("0" * 15)
+ assert(File.exist?(@filename))
+ assert(File.exist?(filename1))
+ assert(File.exist?(filename2))
+ assert(File.exist?(filename3))
+ ensure
+ logger.close if logger
+ [filename1, filename2, filename3].each do |filename|
+ File.unlink(filename) if File.exist?(filename)
+ end
+ end
+ end
+
+ def test_shifting_size_in_multiprocess
+ tmpfile = Tempfile.new([File.basename(__FILE__, '.*'), '_1.log'])
+ logfile = tmpfile.path
+ logfile0 = logfile + '.0'
+ logfile1 = logfile + '.1'
+ logfile2 = logfile + '.2'
+ tmpfile.close(true)
+ File.unlink(logfile) if File.exist?(logfile)
+ File.unlink(logfile0) if File.exist?(logfile0)
+ File.unlink(logfile1) if File.exist?(logfile1)
+ File.unlink(logfile2) if File.exist?(logfile2)
+ begin
+ stderr = run_children(2, [logfile], <<-'END')
+ logger = Logger.new(ARGV[0], 4, 10)
+ 10.times do
+ logger.info '0' * 15
+ end
+ END
+ assert_no_match(/log shifting failed/, stderr)
+ assert_no_match(/log writing failed/, stderr)
+ assert_no_match(/log rotation inter-process lock failed/, stderr)
+ ensure
+ File.unlink(logfile) if File.exist?(logfile)
+ File.unlink(logfile0) if File.exist?(logfile0)
+ File.unlink(logfile1) if File.exist?(logfile1)
+ File.unlink(logfile2) if File.exist?(logfile2)
+ end
+ end
+
+ def test_shifting_age_in_multiprocess
+ yyyymmdd = Time.now.strftime("%Y%m%d")
+ begin
+ stderr = run_children(2, [@filename], <<-'END')
+ logger = Logger.new(ARGV[0], 'now')
+ 10.times do
+ logger.info '0' * 15
+ end
+ END
+ assert_no_match(/log shifting failed/, stderr)
+ assert_no_match(/log writing failed/, stderr)
+ assert_no_match(/log rotation inter-process lock failed/, stderr)
+ ensure
+ Dir.glob("#{@filename}.#{yyyymmdd}{,.[1-9]*}") do |filename|
+ File.unlink(filename) if File.exist?(filename)
+ end
+ end
+ end
+
+ def test_open_logfile_in_multiprocess
+ tmpfile = Tempfile.new([File.basename(__FILE__, '.*'), '_1.log'])
+ logfile = tmpfile.path
+ tmpfile.close(true)
+ begin
+ 20.times do
+ run_children(2, [logfile], <<-'END')
+ logfile = ARGV[0]
+ logdev = Logger::LogDevice.new(logfile)
+ logdev.send(:open_logfile, logfile)
+ END
+ assert_equal(1, File.readlines(logfile).grep(/# Logfile created on/).size)
+ File.unlink(logfile)
+ end
+ ensure
+ File.unlink(logfile) if File.exist?(logfile)
+ end
+ end
+
+ def test_shifting_size_not_rotate_too_much
+ logdev0 = d(@filename)
+ logdev0.__send__(:add_log_header, @tempfile)
+ header_size = @tempfile.size
+ message = "*" * 99 + "\n"
+ shift_size = header_size + message.size * 3 - 1
+ opt = {shift_age: 1, shift_size: shift_size}
+
+ Dir.mktmpdir do |tmpdir|
+ begin
+ log = File.join(tmpdir, "log")
+ logdev1 = d(log, opt)
+ logdev2 = d(log, opt)
+
+ assert_file.identical?(log, logdev1.dev)
+ assert_file.identical?(log, logdev2.dev)
+
+ 3.times{logdev1.write(message)}
+ assert_file.identical?(log, logdev1.dev)
+ assert_file.identical?(log, logdev2.dev)
+
+ logdev1.write(message)
+ assert_file.identical?(log, logdev1.dev)
+ assert_file.identical?(log + ".0", logdev2.dev)
+
+ logdev2.write(message)
+ assert_file.identical?(log, logdev1.dev)
+ assert_file.identical?(log, logdev2.dev)
+
+ logdev1.write(message)
+ assert_file.identical?(log, logdev1.dev)
+ assert_file.identical?(log, logdev2.dev)
+ ensure
+ logdev1.close if logdev1
+ logdev2.close if logdev2
+ end
+ end
+ ensure
+ logdev0.close
+ end unless /mswin|mingw/ =~ RUBY_PLATFORM
+
+ def test_shifting_midnight
+ Dir.mktmpdir do |tmpdir|
+ assert_in_out_err([*%W"--disable=gems -rlogger -C#{tmpdir} -"], <<-'end;')
+ begin
+ module FakeTime
+ attr_accessor :now
+ end
+
+ class << Time
+ prepend FakeTime
+ end
+
+ log = "log"
+ File.open(log, "w") {}
+ File.utime(*[Time.mktime(2014, 1, 1, 23, 59, 59)]*2, log)
+
+ Time.now = Time.mktime(2014, 1, 2, 23, 59, 59, 999000)
+ dev = Logger::LogDevice.new(log, shift_age: 'daily')
+ dev.write("#{Time.now} hello-1\n")
+
+ Time.now = Time.mktime(2014, 1, 3, 1, 1, 1)
+ dev.write("#{Time.now} hello-2\n")
+ ensure
+ dev.close
+ end
+ end;
+
+ bug = '[GH-539]'
+ log = File.join(tmpdir, "log")
+ cont = File.read(log)
+ assert_match(/hello-2/, cont)
+ assert_not_match(/hello-1/, cont)
+ assert_file.for(bug).exist?(log+".20140102")
+ assert_match(/hello-1/, File.read(log+".20140102"), bug)
+ end
+ end
+
+ def test_shifting_dst_change
+ Dir.mktmpdir do |tmpdir|
+ assert_in_out_err([{"TZ"=>"Europe/London"}, *%W"--disable=gems -rlogger -C#{tmpdir} -"], <<-'end;')
+ begin
+ module FakeTime
+ attr_accessor :now
+ end
+
+ class << Time
+ prepend FakeTime
+ end
+
+ log = "log"
+ File.open(log, "w") {}
+
+ Time.now = Time.mktime(2014, 3, 30, 0, 1, 1)
+ File.utime(Time.now, Time.now, log)
+
+ dev = Logger::LogDevice.new(log, shift_age: 'daily')
+ dev.write("#{Time.now} hello-1\n")
+ File.utime(*[Time.mktime(2014, 3, 30, 0, 2, 3)]*2, log)
+
+ Time.now = Time.mktime(2014, 3, 31, 0, 1, 1)
+ File.utime(Time.now, Time.now, log)
+ dev.write("#{Time.now} hello-2\n")
+ ensure
+ dev.close
+ end
+ end;
+
+ log = File.join(tmpdir, "log")
+ cont = File.read(log)
+ assert_match(/hello-2/, cont)
+ assert_not_match(/hello-1/, cont)
+ assert_file.exist?(log+".20140330")
+ end
+ end if /linux|darwin|freebsd/ =~ RUBY_PLATFORM # borrow from test/ruby/test_time_tz.rb
+
+ private
+
+ def run_children(n, args, src)
+ r, w = IO.pipe
+ [w, *(1..n).map do
+ f = IO.popen([EnvUtil.rubybin, *%w[--disable=gems -rlogger -], *args], "w", err: w)
+ f.puts(src)
+ f
+ end].each(&:close)
+ stderr = r.read
+ r.close
+ stderr
+ end
+end
diff --git a/test/logger/test_logger.rb b/test/logger/test_logger.rb
index b153658659..dc1a155b49 100644
--- a/test/logger/test_logger.rb
+++ b/test/logger/test_logger.rb
@@ -3,20 +3,6 @@ require 'test/unit'
require 'logger'
require 'tempfile'
-
-class TestLoggerSeverity < Test::Unit::TestCase
- def test_enum
- logger_levels = Logger.constants
- levels = ["WARN", "UNKNOWN", "INFO", "FATAL", "DEBUG", "ERROR"]
- Logger::Severity.constants.each do |level|
- assert(levels.include?(level.to_s))
- assert(logger_levels.include?(level))
- end
- assert_equal(levels.size, Logger::Severity.constants.size)
- end
-end
-
-
class TestLogger < Test::Unit::TestCase
include Logger::Severity
@@ -41,13 +27,12 @@ class TestLogger < Test::Unit::TestCase
end
def log_raw(logger, msg_id, *arg, &block)
- logdev = Tempfile.new(File.basename(__FILE__) + '.log')
- logger.instance_eval { @logdev = Logger::LogDevice.new(logdev) }
- logger.__send__(msg_id, *arg, &block)
- logdev.open
- msg = logdev.read
- logdev.close(true)
- msg
+ Tempfile.create(File.basename(__FILE__) + '.log') {|logdev|
+ logger.instance_eval { @logdev = Logger::LogDevice.new(logdev) }
+ logger.__send__(msg_id, *arg, &block)
+ logdev.rewind
+ logdev.read
+ }
end
def test_level
@@ -257,271 +242,3 @@ class TestLogger < Test::Unit::TestCase
assert_equal("msg2\n\n", msg)
end
end
-
-class TestLogDevice < Test::Unit::TestCase
- class LogExcnRaiser
- def write(*arg)
- raise 'disk is full'
- end
-
- def close
- end
-
- def stat
- Object.new
- end
- end
-
- def setup
- @tempfile = Tempfile.new("logger")
- @tempfile.close
- @filename = @tempfile.path
- File.unlink(@filename)
- end
-
- def teardown
- @tempfile.close(true)
- end
-
- def d(log, opt = {})
- Logger::LogDevice.new(log, opt)
- end
-
- def test_initialize
- logdev = d(STDERR)
- assert_equal(STDERR, logdev.dev)
- assert_nil(logdev.filename)
- assert_raises(TypeError) do
- d(nil)
- end
- #
- logdev = d(@filename)
- begin
- assert(File.exist?(@filename))
- assert(logdev.dev.sync)
- assert_equal(@filename, logdev.filename)
- logdev.write('hello')
- ensure
- logdev.close
- end
- # create logfile whitch is already exist.
- logdev = d(@filename)
- begin
- logdev.write('world')
- logfile = File.read(@filename)
- assert_equal(2, logfile.split(/\n/).size)
- assert_match(/^helloworld$/, logfile)
- ensure
- logdev.close
- end
- end
-
- def test_write
- r, w = IO.pipe
- logdev = d(w)
- logdev.write("msg2\n\n")
- read_ready, = IO.select([r], nil, nil, 0.1)
- w.close
- msg = r.read
- r.close
- assert_equal("msg2\n\n", msg)
- #
- logdev = d(LogExcnRaiser.new)
- class << (stderr = '')
- alias write <<
- end
- $stderr, stderr = stderr, $stderr
- begin
- assert_nothing_raised do
- logdev.write('hello')
- end
- ensure
- logdev.close
- $stderr, stderr = stderr, $stderr
- end
- assert_equal "log writing failed. disk is full\n", stderr
- end
-
- def test_close
- r, w = IO.pipe
- logdev = d(w)
- logdev.write("msg2\n\n")
- read_ready, = IO.select([r], nil, nil, 0.1)
- assert(!w.closed?)
- logdev.close
- assert(w.closed?)
- r.close
- end
-
- def test_shifting_size
- tmpfile = Tempfile.new([File.basename(__FILE__, '.*'), '_1.log'])
- logfile = tmpfile.path
- logfile0 = logfile + '.0'
- logfile1 = logfile + '.1'
- logfile2 = logfile + '.2'
- logfile3 = logfile + '.3'
- tmpfile.close(true)
- File.unlink(logfile) if File.exist?(logfile)
- File.unlink(logfile0) if File.exist?(logfile0)
- File.unlink(logfile1) if File.exist?(logfile1)
- File.unlink(logfile2) if File.exist?(logfile2)
- logger = Logger.new(logfile, 4, 100)
- logger.error("0" * 15)
- assert(File.exist?(logfile))
- assert(!File.exist?(logfile0))
- logger.error("0" * 15)
- assert(File.exist?(logfile0))
- assert(!File.exist?(logfile1))
- logger.error("0" * 15)
- assert(File.exist?(logfile1))
- assert(!File.exist?(logfile2))
- logger.error("0" * 15)
- assert(File.exist?(logfile2))
- assert(!File.exist?(logfile3))
- logger.error("0" * 15)
- assert(!File.exist?(logfile3))
- logger.error("0" * 15)
- assert(!File.exist?(logfile3))
- logger.close
- File.unlink(logfile)
- File.unlink(logfile0)
- File.unlink(logfile1)
- File.unlink(logfile2)
-
- tmpfile = Tempfile.new([File.basename(__FILE__, '.*'), '_2.log'])
- logfile = tmpfile.path
- logfile0 = logfile + '.0'
- logfile1 = logfile + '.1'
- logfile2 = logfile + '.2'
- logfile3 = logfile + '.3'
- tmpfile.close(true)
- logger = Logger.new(logfile, 4, 150)
- logger.error("0" * 15)
- assert(File.exist?(logfile))
- assert(!File.exist?(logfile0))
- logger.error("0" * 15)
- assert(!File.exist?(logfile0))
- logger.error("0" * 15)
- assert(File.exist?(logfile0))
- assert(!File.exist?(logfile1))
- logger.error("0" * 15)
- assert(!File.exist?(logfile1))
- logger.error("0" * 15)
- assert(File.exist?(logfile1))
- assert(!File.exist?(logfile2))
- logger.error("0" * 15)
- assert(!File.exist?(logfile2))
- logger.error("0" * 15)
- assert(File.exist?(logfile2))
- assert(!File.exist?(logfile3))
- logger.error("0" * 15)
- assert(!File.exist?(logfile3))
- logger.error("0" * 15)
- assert(!File.exist?(logfile3))
- logger.error("0" * 15)
- assert(!File.exist?(logfile3))
- logger.close
- File.unlink(logfile)
- File.unlink(logfile0)
- File.unlink(logfile1)
- File.unlink(logfile2)
- end
-
- def test_shifting_age_variants
- logger = Logger.new(@filename, 'daily')
- logger.info('daily')
- logger.close
- logger = Logger.new(@filename, 'weekly')
- logger.info('weekly')
- logger.close
- logger = Logger.new(@filename, 'monthly')
- logger.info('monthly')
- logger.close
- end
-
- def test_shifting_age
- # shift_age other than 'daily', 'weekly', and 'monthly' means 'everytime'
- yyyymmdd = Time.now.strftime("%Y%m%d")
- filename1 = @filename + ".#{yyyymmdd}"
- filename2 = @filename + ".#{yyyymmdd}.1"
- filename3 = @filename + ".#{yyyymmdd}.2"
- begin
- logger = Logger.new(@filename, 'now')
- assert(File.exist?(@filename))
- assert(!File.exist?(filename1))
- assert(!File.exist?(filename2))
- assert(!File.exist?(filename3))
- logger.info("0" * 15)
- assert(File.exist?(@filename))
- assert(File.exist?(filename1))
- assert(!File.exist?(filename2))
- assert(!File.exist?(filename3))
- logger.warn("0" * 15)
- assert(File.exist?(@filename))
- assert(File.exist?(filename1))
- assert(File.exist?(filename2))
- assert(!File.exist?(filename3))
- logger.error("0" * 15)
- assert(File.exist?(@filename))
- assert(File.exist?(filename1))
- assert(File.exist?(filename2))
- assert(File.exist?(filename3))
- ensure
- logger.close if logger
- [filename1, filename2, filename3].each do |filename|
- File.unlink(filename) if File.exist?(filename)
- end
- end
- end
-end
-
-
-class TestLoggerApplication < Test::Unit::TestCase
- def setup
- @app = Logger::Application.new('appname')
- @tempfile = Tempfile.new("logger")
- @tempfile.close
- @filename = @tempfile.path
- File.unlink(@filename)
- end
-
- def teardown
- @tempfile.close(true)
- end
-
- def test_initialize
- app = Logger::Application.new('appname')
- assert_equal('appname', app.appname)
- end
-
- def test_start
- @app.set_log(@filename)
- begin
- @app.level = Logger::UNKNOWN
- @app.start # logs FATAL log
- assert_equal(1, File.read(@filename).split(/\n/).size)
- ensure
- @app.logger.close
- end
- end
-
- def test_logger
- @app.level = Logger::WARN
- @app.set_log(@filename)
- begin
- assert_equal(Logger::WARN, @app.logger.level)
- ensure
- @app.logger.close
- end
- @app.logger = logger = Logger.new(STDOUT)
- assert_equal(logger, @app.logger)
- assert_equal(Logger::WARN, @app.logger.level)
- @app.log = @filename
- begin
- assert(logger != @app.logger)
- assert_equal(Logger::WARN, @app.logger.level)
- ensure
- @app.logger.close
- end
- end
-end
diff --git a/test/logger/test_severity.rb b/test/logger/test_severity.rb
new file mode 100644
index 0000000000..045461caa2
--- /dev/null
+++ b/test/logger/test_severity.rb
@@ -0,0 +1,15 @@
+# coding: US-ASCII
+require 'test/unit'
+require 'logger'
+
+class TestLoggerSeverity < Test::Unit::TestCase
+ def test_enum
+ logger_levels = Logger.constants
+ levels = ["WARN", "UNKNOWN", "INFO", "FATAL", "DEBUG", "ERROR"]
+ Logger::Severity.constants.each do |level|
+ assert(levels.include?(level.to_s))
+ assert(logger_levels.include?(level))
+ end
+ assert_equal(levels.size, Logger::Severity.constants.size)
+ end
+end
diff --git a/test/matrix/test_matrix.rb b/test/matrix/test_matrix.rb
index 26248e5746..7c466e67fd 100644
--- a/test/matrix/test_matrix.rb
+++ b/test/matrix/test_matrix.rb
@@ -8,6 +8,7 @@ class TestMatrix < Test::Unit::TestCase
@m3 = @m1.clone
@m4 = Matrix[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]
@n1 = Matrix[[2,3,4], [5,6,7]]
+ @c1 = Matrix[[Complex(1,2), Complex(0,1), 0], [1, 2, 3]]
end
def test_matrix
@@ -155,7 +156,9 @@ class TestMatrix < Test::Unit::TestCase
end
def test_inverse
+ assert_equal(Matrix.empty(0, 0), Matrix.empty.inverse)
assert_equal(Matrix[[-1, 1], [0, -1]], Matrix[[-1, -1], [0, -1]].inverse)
+ assert_raise(ExceptionForMatrix::ErrDimensionMismatch) { @m1.inverse }
end
def test_determinant
@@ -179,11 +182,13 @@ class TestMatrix < Test::Unit::TestCase
end
def test_diagonal
+ assert_equal(Matrix.empty(0, 0), Matrix.diagonal( ))
assert_equal(Matrix[[3,0,0],[0,2,0],[0,0,1]], Matrix.diagonal(3, 2, 1))
assert_equal(Matrix[[4,0,0,0],[0,3,0,0],[0,0,2,0],[0,0,0,1]], Matrix.diagonal(4, 3, 2, 1))
end
def test_scalar
+ assert_equal(Matrix.empty(0, 0), Matrix.scalar(0, 1))
assert_equal(Matrix[[2,0,0],[0,2,0],[0,0,2]], Matrix.scalar(3, 2))
assert_equal(Matrix[[2,0,0,0],[0,2,0,0],[0,0,2,0],[0,0,0,2]], Matrix.scalar(4, 2))
end
@@ -246,6 +251,29 @@ class TestMatrix < Test::Unit::TestCase
assert_raise(ArgumentError) { @m1.minor(0) }
end
+ def test_first_minor
+ assert_equal(Matrix.empty(0, 0), Matrix[[1]].first_minor(0, 0))
+ assert_equal(Matrix.empty(0, 2), Matrix[[1, 4, 2]].first_minor(0, 1))
+ assert_equal(Matrix[[1, 3]], @m1.first_minor(1, 1))
+ assert_equal(Matrix[[4, 6]], @m1.first_minor(0, 1))
+ assert_equal(Matrix[[1, 2]], @m1.first_minor(1, 2))
+ assert_raise(RuntimeError) { Matrix.empty(0, 0).first_minor(0, 0) }
+ assert_raise(ArgumentError) { @m1.first_minor(4, 0) }
+ assert_raise(ArgumentError) { @m1.first_minor(0, -1) }
+ assert_raise(ArgumentError) { @m1.first_minor(-1, 4) }
+ end
+
+ def test_cofactor
+ assert_equal(1, Matrix[[1]].cofactor(0, 0))
+ assert_equal(9, Matrix[[7,6],[3,9]].cofactor(0, 0))
+ assert_equal(0, Matrix[[0,0],[0,0]].cofactor(0, 0))
+ assert_equal(3, Matrix[[0,0,1],[0,7,6],[1,3,9]].cofactor(1, 0))
+ assert_equal(-21, Matrix[[7,0,1,0,12],[8,1,1,9,1],[4,0,0,-7,17],[-1,0,0,-4,8],[10,1,1,8,6]].cofactor(2, 3))
+ assert_raise(RuntimeError) { Matrix.empty(0, 0).cofactor(0, 0) }
+ assert_raise(ArgumentError) { Matrix[[0,0],[0,0]].cofactor(-1, 4) }
+ assert_raise(ExceptionForMatrix::ErrDimensionMismatch) { Matrix[[2,0,1],[0,-2,2]].cofactor(0, 0) }
+ end
+
def test_regular?
assert(Matrix[[1, 0], [0, 1]].regular?)
assert(Matrix[[1, 0, 0], [0, 1, 0], [0, 0, 1]].regular?)
@@ -344,6 +372,40 @@ class TestMatrix < Test::Unit::TestCase
assert_equal(Matrix[[1,4],[2,5],[3,6]], @m1.transpose)
end
+ def test_conjugate
+ assert_equal(Matrix[[Complex(1,-2), Complex(0,-1), 0], [1, 2, 3]], @c1.conjugate)
+ end
+
+ def test_eigensystem
+ m = Matrix[[1, 2], [3, 4]]
+ v, d, v_inv = m.eigensystem
+ assert(d.diagonal?)
+ assert_equal(v.inv, v_inv)
+ assert_equal((v * d * v_inv).round(5), m)
+ end
+
+ def test_imaginary
+ assert_equal(Matrix[[2, 1, 0], [0, 0, 0]], @c1.imaginary)
+ end
+
+ def test_lup
+ m = Matrix[[1, 2], [3, 4]]
+ l, u, p = m.lup
+ assert(l.lower_triangular?)
+ assert(u.upper_triangular?)
+ assert(p.permutation?)
+ assert(l * u == p * m)
+ assert_equal(m.lup.solve([2, 5]), Vector[1, Rational(1,2)])
+ end
+
+ def test_real
+ assert_equal(Matrix[[1, 0, 0], [1, 2, 3]], @c1.real)
+ end
+
+ def test_rect
+ assert_equal([Matrix[[1, 0, 0], [1, 2, 3]], Matrix[[2, 1, 0], [0, 0, 0]]], @c1.rect)
+ end
+
def test_row_vectors
assert_equal([Vector[1,2,3], Vector[4,5,6]], @m1.row_vectors)
end
diff --git a/test/matrix/test_vector.rb b/test/matrix/test_vector.rb
index 18660df574..ced774c490 100644
--- a/test/matrix/test_vector.rb
+++ b/test/matrix/test_vector.rb
@@ -146,4 +146,9 @@ class TestVector < Test::Unit::TestCase
v = Vector[Rational(1,2), 0]
assert_equal(0.5, v.norm)
end
+
+ def test_cross_product
+ v = Vector[1, 0, 0].cross_product Vector[0, 1, 0]
+ assert_equal(Vector[0, 0, 1], v)
+ end
end
diff --git a/test/minitest/metametameta.rb b/test/minitest/metametameta.rb
index 65eece07ca..87bc56c93b 100644
--- a/test/minitest/metametameta.rb
+++ b/test/minitest/metametameta.rb
@@ -1,9 +1,4 @@
# 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 'tempfile'
require 'stringio'
diff --git a/test/minitest/test_minitest_benchmark.rb b/test/minitest/test_minitest_benchmark.rb
index 708589b3fa..d04bb9a125 100644
--- a/test/minitest/test_minitest_benchmark.rb
+++ b/test/minitest/test_minitest_benchmark.rb
@@ -1,9 +1,4 @@
# 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/autorun'
require 'minitest/benchmark'
@@ -51,6 +46,22 @@ class TestMiniTestBenchmark < MiniTest::Unit::TestCase
assert_fit :exponential, x, y, 0.95, 13.81148, -0.1820
end
+ def test_fit_logarithmic_clean
+ x = [1.0, 2.0, 3.0, 4.0, 5.0]
+ y = x.map { |n| 1.1 + 2.1 * Math.log(n) }
+
+ assert_fit :logarithmic, x, y, 1.0, 1.1, 2.1
+ end
+
+ def test_fit_logarithmic_noisy
+ x = [1.0, 2.0, 3.0, 4.0, 5.0]
+ # Generated with
+ # y = x.map { |n| jitter = 0.999 + 0.002 * rand; (Math.log(n) ) * jitter }
+ y = [0.0, 0.6935, 1.0995, 1.3873, 1.6097]
+
+ assert_fit :logarithmic, x, y, 0.95, 0, 1
+ end
+
def test_fit_constant_clean
x = (1..5).to_a
y = [5.0, 5.0, 5.0, 5.0, 5.0]
diff --git a/test/minitest/test_minitest_mock.rb b/test/minitest/test_minitest_mock.rb
index cfd97e4002..062cda56ff 100644
--- a/test/minitest/test_minitest_mock.rb
+++ b/test/minitest/test_minitest_mock.rb
@@ -1,18 +1,8 @@
# 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/mock'
-require 'minitest/unit'
-
-MiniTest::Unit.autorun
+require 'minitest/autorun'
class TestMiniTestMock < MiniTest::Unit::TestCase
- parallelize_me! if ENV["PARALLEL"]
-
def setup
@mock = MiniTest::Mock.new.expect(:foo, nil)
@mock.expect(:meaning_of_life, 42)
@@ -74,6 +64,8 @@ class TestMiniTestMock < MiniTest::Unit::TestCase
end
def test_mock_args_does_not_raise
+ skip "non-opaque use of ==" if maglev?
+
arg = MiniTest::Mock.new
mock = MiniTest::Mock.new
mock.expect(:foo, nil, [arg])
@@ -279,8 +271,6 @@ end
require "minitest/metametameta"
class TestMiniTestStub < MiniTest::Unit::TestCase
- parallelize_me! if ENV["PARALLEL"]
-
def setup
super
MiniTest::Unit::TestCase.reset
@@ -294,17 +284,55 @@ class TestMiniTestStub < MiniTest::Unit::TestCase
assert_equal @assertion_count, @tc._assertions
end
+ class Time
+ def self.now
+ 24
+ end
+ end
+
def assert_stub val_or_callable
@assertion_count += 1
- synchronize do
- t = Time.now.to_i
+ t = Time.now.to_i
+
+ Time.stub :now, val_or_callable do
+ @tc.assert_equal 42, Time.now
+ end
+
+ @tc.assert_operator Time.now.to_i, :>=, t
+ end
+
+ def test_stub_private_module_method
+ @assertion_count += 1
+
+ t0 = Time.now
+
+ self.stub :sleep, nil do
+ @tc.assert_nil sleep(10)
+ end
+
+ @tc.assert_operator Time.now - t0, :<=, 1
+ end
+
+ def test_stub_private_module_method_indirect
+ @assertion_count += 1
- Time.stub :now, val_or_callable do
- @tc.assert_equal 42, Time.now
+ slow_clapper = Class.new do
+ def slow_clap
+ sleep 3
+ :clap
end
+ end.new
- @tc.assert_operator Time.now.to_i, :>=, t
+ slow_clapper.stub :sleep, nil do |fast_clapper|
+ @tc.assert_equal :clap, fast_clapper.slow_clap # either form works
+ @tc.assert_equal :clap, slow_clapper.slow_clap # yay closures
+ end
+ end
+
+ def test_stub_public_module_method
+ Math.stub(:log10, 42.0) do
+ @tc.assert_in_delta 42.0, Math.log10(1000)
end
end
@@ -319,15 +347,13 @@ class TestMiniTestStub < MiniTest::Unit::TestCase
def test_stub_block_args
@assertion_count += 1
- synchronize do
- t = Time.now.to_i
+ t = Time.now.to_i
- Time.stub :now, lambda { |n| n * 2 } do
- @tc.assert_equal 42, Time.now(21)
- end
-
- @tc.assert_operator Time.now.to_i, :>=, t
+ Time.stub :now, lambda { |n| n * 2 } do
+ @tc.assert_equal 42, Time.now(21)
end
+
+ @tc.assert_operator Time.now.to_i, :>=, t
end
def test_stub_callable
diff --git a/test/minitest/test_minitest_spec.rb b/test/minitest/test_minitest_spec.rb
deleted file mode 100644
index 85cb95f42b..0000000000
--- a/test/minitest/test_minitest_spec.rb
+++ /dev/null
@@ -1,738 +0,0 @@
-# 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.
-######################################################################
-
-# encoding: utf-8
-require 'minitest/autorun'
-require 'stringio'
-
-class MiniSpecA < MiniTest::Spec; end
-class MiniSpecB < MiniTest::Spec; end
-class ExampleA; end
-class ExampleB < ExampleA; end
-
-describe MiniTest::Spec do
- # do not parallelize this suite... it just can't handle it.
-
- def assert_triggered expected = "blah", klass = MiniTest::Assertion
- @assertion_count += 2
-
- e = assert_raises(klass) do
- yield
- end
-
- msg = e.message.sub(/(---Backtrace---).*/m, '\1')
- msg.gsub!(/\(oid=[-0-9]+\)/, '(oid=N)')
-
- assert_equal expected, msg
- end
-
- before do
- @assertion_count = 4
- end
-
- after do
- self._assertions.must_equal @assertion_count
- end
-
- it "needs to be able to catch a MiniTest::Assertion exception" do
- @assertion_count = 1
-
- assert_triggered "Expected 1 to not be equal to 1." do
- 1.wont_equal 1
- end
- end
-
- it "needs to be sensible about must_include order" do
- @assertion_count += 3 # must_include is 2 assertions
-
- [1, 2, 3].must_include(2).must_equal true
-
- assert_triggered "Expected [1, 2, 3] to include 5." do
- [1, 2, 3].must_include 5
- end
-
- assert_triggered "msg.\nExpected [1, 2, 3] to include 5." do
- [1, 2, 3].must_include 5, "msg"
- end
- end
-
- it "needs to be sensible about wont_include order" do
- @assertion_count += 3 # wont_include is 2 assertions
-
- [1, 2, 3].wont_include(5).must_equal false
-
- assert_triggered "Expected [1, 2, 3] to not include 2." do
- [1, 2, 3].wont_include 2
- end
-
- assert_triggered "msg.\nExpected [1, 2, 3] to not include 2." do
- [1, 2, 3].wont_include 2, "msg"
- end
- end
-
- it "needs to catch an expected exception" do
- @assertion_count = 2
-
- proc { raise "blah" }.must_raise RuntimeError
- proc { raise MiniTest::Assertion }.must_raise MiniTest::Assertion
- end
-
- it "needs to catch an unexpected exception" do
- @assertion_count -= 2 # no positive
-
- msg = <<-EOM.gsub(/^ {6}/, '').chomp
- [RuntimeError] exception expected, not
- Class: <MiniTest::Assertion>
- Message: <\"MiniTest::Assertion\">
- ---Backtrace---
- EOM
-
- assert_triggered msg do
- proc { raise MiniTest::Assertion }.must_raise RuntimeError
- end
-
- assert_triggered "msg.\n#{msg}" do
- proc { raise MiniTest::Assertion }.must_raise RuntimeError, "msg"
- end
- end
-
- it "needs to ensure silence" do
- @assertion_count -= 1 # no msg
- @assertion_count += 2 # assert_output is 2 assertions
-
- proc { }.must_be_silent.must_equal true
-
- assert_triggered "In stdout.\nExpected: \"\"\n Actual: \"xxx\"" do
- proc { print "xxx" }.must_be_silent
- end
- end
-
- it "needs to have all methods named well" do
- @assertion_count = 2
-
- methods = Object.public_instance_methods.find_all { |n| n =~ /^must|^wont/ }
- methods.map! { |m| m.to_s } if Symbol === methods.first
-
- musts, wonts = methods.sort.partition { |m| m =~ /^must/ }
-
- expected_musts = %w(must_be
- must_be_close_to
- must_be_empty
- must_be_instance_of
- must_be_kind_of
- must_be_nil
- must_be_same_as
- must_be_silent
- must_be_within_delta
- must_be_within_epsilon
- must_equal
- must_include
- must_match
- must_output
- must_raise
- must_respond_to
- must_send
- must_throw)
-
- bad = %w[not raise throw send output be_silent]
-
- expected_wonts = expected_musts.map { |m| m.sub(/^must/, 'wont') }
- expected_wonts.reject! { |m| m =~ /wont_#{Regexp.union(*bad)}/ }
-
- musts.must_equal expected_musts
- wonts.must_equal expected_wonts
- end
-
- it "needs to raise if an expected exception is not raised" do
- @assertion_count -= 2 # no positive test
-
- assert_triggered "RuntimeError expected but nothing was raised." do
- proc { 42 }.must_raise RuntimeError
- end
-
- assert_triggered "msg.\nRuntimeError expected but nothing was raised." do
- proc { 42 }.must_raise RuntimeError, "msg"
- end
- end
-
- it "needs to verify binary messages" do
- 42.wont_be(:<, 24).must_equal false
-
- assert_triggered 'Expected 24 to not be < 42.' do
- 24.wont_be :<, 42
- end
-
- assert_triggered "msg.\nExpected 24 to not be < 42." do
- 24.wont_be :<, 42, "msg"
- end
- end
-
- it "needs to verify emptyness" do
- @assertion_count += 3 # empty is 2 assertions
-
- [].must_be_empty.must_equal true
-
- assert_triggered "Expected [42] to be empty." do
- [42].must_be_empty
- end
-
- assert_triggered "msg.\nExpected [42] to be empty." do
- [42].must_be_empty "msg"
- end
- end
-
- it "needs to verify equality" do
- (6 * 7).must_equal(42).must_equal true
-
- assert_triggered "Expected: 42\n Actual: 54" do
- (6 * 9).must_equal 42
- end
-
- assert_triggered "msg.\nExpected: 42\n Actual: 54" do
- (6 * 9).must_equal 42, "msg"
- end
- end
-
- it "needs to verify floats outside a delta" do
- @assertion_count += 1 # extra test
-
- 24.wont_be_close_to(42).must_equal false
-
- assert_triggered 'Expected |42 - 42.0| (0.0) to not be < 0.001.' do
- (6 * 7.0).wont_be_close_to 42
- end
-
- assert_triggered 'Expected |42 - 42.0| (0.0) to not be < 1.0e-05.' do
- (6 * 7.0).wont_be_close_to 42, 0.00001
- end
-
- assert_triggered "msg.\nExpected |42 - 42.0| (0.0) to not be < 1.0e-05." do
- (6 * 7.0).wont_be_close_to 42, 0.00001, "msg"
- end
- end
-
- it "needs to verify floats outside an epsilon" do
- @assertion_count += 1 # extra test
-
- 24.wont_be_within_epsilon(42).must_equal false
-
- assert_triggered 'Expected |42 - 42.0| (0.0) to not be < 0.042.' do
- (6 * 7.0).wont_be_within_epsilon 42
- end
-
- assert_triggered 'Expected |42 - 42.0| (0.0) to not be < 0.00042.' do
- (6 * 7.0).wont_be_within_epsilon 42, 0.00001
- end
-
- assert_triggered "msg.\nExpected |42 - 42.0| (0.0) to not be < 0.00042." do
- (6 * 7.0).wont_be_within_epsilon 42, 0.00001, "msg"
- end
- end
-
- it "needs to verify floats within a delta" do
- @assertion_count += 1 # extra test
-
- (6.0 * 7).must_be_close_to(42.0).must_equal true
-
- assert_triggered 'Expected |0.0 - 0.01| (0.01) to be < 0.001.' do
- (1.0 / 100).must_be_close_to 0.0
- end
-
- assert_triggered 'Expected |0.0 - 0.001| (0.001) to be < 1.0e-06.' do
- (1.0 / 1000).must_be_close_to 0.0, 0.000001
- end
-
- assert_triggered "msg.\nExpected |0.0 - 0.001| (0.001) to be < 1.0e-06." do
- (1.0 / 1000).must_be_close_to 0.0, 0.000001, "msg"
- end
- end
-
- it "needs to verify floats within an epsilon" do
- @assertion_count += 1 # extra test
-
- (6.0 * 7).must_be_within_epsilon(42.0).must_equal true
-
- assert_triggered 'Expected |0.0 - 0.01| (0.01) to be < 0.0.' do
- (1.0 / 100).must_be_within_epsilon 0.0
- end
-
- assert_triggered 'Expected |0.0 - 0.001| (0.001) to be < 0.0.' do
- (1.0 / 1000).must_be_within_epsilon 0.0, 0.000001
- end
-
- assert_triggered "msg.\nExpected |0.0 - 0.001| (0.001) to be < 0.0." do
- (1.0 / 1000).must_be_within_epsilon 0.0, 0.000001, "msg"
- end
- end
-
- it "needs to verify identity" do
- 1.must_be_same_as(1).must_equal true
-
- assert_triggered "Expected 1 (oid=N) to be the same as 2 (oid=N)." do
- 1.must_be_same_as 2
- end
-
- assert_triggered "msg.\nExpected 1 (oid=N) to be the same as 2 (oid=N)." do
- 1.must_be_same_as 2, "msg"
- end
- end
-
- it "needs to verify inequality" do
- 42.wont_equal(6 * 9).must_equal false
-
- assert_triggered "Expected 1 to not be equal to 1." do
- 1.wont_equal 1
- end
-
- assert_triggered "msg.\nExpected 1 to not be equal to 1." do
- 1.wont_equal 1, "msg"
- end
- end
-
- it "needs to verify instances of a class" do
- 42.wont_be_instance_of(String).must_equal false
-
- assert_triggered 'Expected 42 to not be an instance of Fixnum.' do
- 42.wont_be_instance_of Fixnum
- end
-
- assert_triggered "msg.\nExpected 42 to not be an instance of Fixnum." do
- 42.wont_be_instance_of Fixnum, "msg"
- end
- end
-
- it "needs to verify kinds of a class" do
- 42.wont_be_kind_of(String).must_equal false
-
- assert_triggered 'Expected 42 to not be a kind of Integer.' do
- 42.wont_be_kind_of Integer
- end
-
- assert_triggered "msg.\nExpected 42 to not be a kind of Integer." do
- 42.wont_be_kind_of Integer, "msg"
- end
- end
-
- it "needs to verify kinds of objects" do
- @assertion_count += 2 # extra test
-
- (6 * 7).must_be_kind_of(Fixnum).must_equal true
- (6 * 7).must_be_kind_of(Numeric).must_equal true
-
- assert_triggered "Expected 42 to be a kind of String, not Fixnum." do
- (6 * 7).must_be_kind_of String
- end
-
- assert_triggered "msg.\nExpected 42 to be a kind of String, not Fixnum." do
- (6 * 7).must_be_kind_of String, "msg"
- end
- end
-
- it "needs to verify mismatch" do
- @assertion_count += 3 # match is 2
-
- "blah".wont_match(/\d+/).must_equal false
-
- assert_triggered "Expected /\\w+/ to not match \"blah\"." do
- "blah".wont_match(/\w+/)
- end
-
- assert_triggered "msg.\nExpected /\\w+/ to not match \"blah\"." do
- "blah".wont_match(/\w+/, "msg")
- end
- end
-
- it "needs to verify nil" do
- nil.must_be_nil.must_equal true
-
- assert_triggered "Expected 42 to be nil." do
- 42.must_be_nil
- end
-
- assert_triggered "msg.\nExpected 42 to be nil." do
- 42.must_be_nil "msg"
- end
- end
-
- it "needs to verify non-emptyness" do
- @assertion_count += 3 # empty is 2 assertions
-
- ['some item'].wont_be_empty.must_equal false
-
- assert_triggered "Expected [] to not be empty." do
- [].wont_be_empty
- end
-
- assert_triggered "msg.\nExpected [] to not be empty." do
- [].wont_be_empty "msg"
- end
- end
-
- it "needs to verify non-identity" do
- 1.wont_be_same_as(2).must_equal false
-
- assert_triggered "Expected 1 (oid=N) to not be the same as 1 (oid=N)." do
- 1.wont_be_same_as 1
- end
-
- assert_triggered "msg.\nExpected 1 (oid=N) to not be the same as 1 (oid=N)." do
- 1.wont_be_same_as 1, "msg"
- end
- end
-
- it "needs to verify non-nil" do
- 42.wont_be_nil.must_equal false
-
- assert_triggered "Expected nil to not be nil." do
- nil.wont_be_nil
- end
-
- assert_triggered "msg.\nExpected nil to not be nil." do
- nil.wont_be_nil "msg"
- end
- end
-
- it "needs to verify objects not responding to a message" do
- "".wont_respond_to(:woot!).must_equal false
-
- assert_triggered 'Expected "" to not respond to to_s.' do
- "".wont_respond_to :to_s
- end
-
- assert_triggered "msg.\nExpected \"\" to not respond to to_s." do
- "".wont_respond_to :to_s, "msg"
- end
- end
-
- it "needs to verify output in stderr" do
- @assertion_count -= 1 # no msg
-
- proc { $stderr.print "blah" }.must_output(nil, "blah").must_equal true
-
- assert_triggered "In stderr.\nExpected: \"blah\"\n Actual: \"xxx\"" do
- proc { $stderr.print "xxx" }.must_output(nil, "blah")
- end
- end
-
- it "needs to verify output in stdout" do
- @assertion_count -= 1 # no msg
-
- proc { print "blah" }.must_output("blah").must_equal true
-
- assert_triggered "In stdout.\nExpected: \"blah\"\n Actual: \"xxx\"" do
- proc { print "xxx" }.must_output("blah")
- end
- end
-
- it "needs to verify regexp matches" do
- @assertion_count += 3 # must_match is 2 assertions
-
- "blah".must_match(/\w+/).must_equal true
-
- assert_triggered "Expected /\\d+/ to match \"blah\"." do
- "blah".must_match(/\d+/)
- end
-
- assert_triggered "msg.\nExpected /\\d+/ to match \"blah\"." do
- "blah".must_match(/\d+/, "msg")
- end
- end
-
- it "needs to verify throw" do
- @assertion_count += 2 # 2 extra tests
-
- proc { throw :blah }.must_throw(:blah).must_equal true
-
- assert_triggered "Expected :blah to have been thrown." do
- proc { }.must_throw :blah
- end
-
- assert_triggered "Expected :blah to have been thrown, not :xxx." do
- proc { throw :xxx }.must_throw :blah
- end
-
- assert_triggered "msg.\nExpected :blah to have been thrown." do
- proc { }.must_throw :blah, "msg"
- end
-
- assert_triggered "msg.\nExpected :blah to have been thrown, not :xxx." do
- proc { throw :xxx }.must_throw :blah, "msg"
- end
- end
-
- it "needs to verify types of objects" do
- (6 * 7).must_be_instance_of(Fixnum).must_equal true
-
- exp = "Expected 42 to be an instance of String, not Fixnum."
-
- assert_triggered exp do
- (6 * 7).must_be_instance_of String
- end
-
- assert_triggered "msg.\n#{exp}" do
- (6 * 7).must_be_instance_of String, "msg"
- end
- end
-
- it "needs to verify using any (negative) predicate" do
- @assertion_count -= 1 # doesn't take a message
-
- "blah".wont_be(:empty?).must_equal false
-
- assert_triggered "Expected \"\" to not be empty?." do
- "".wont_be :empty?
- end
- end
-
- it "needs to verify using any binary operator" do
- @assertion_count -= 1 # no msg
-
- 41.must_be(:<, 42).must_equal true
-
- assert_triggered "Expected 42 to be < 41." do
- 42.must_be(:<, 41)
- end
- end
-
- it "needs to verify using any predicate" do
- @assertion_count -= 1 # no msg
-
- "".must_be(:empty?).must_equal true
-
- assert_triggered "Expected \"blah\" to be empty?." do
- "blah".must_be :empty?
- end
- end
-
- it "needs to verify using respond_to" do
- 42.must_respond_to(:+).must_equal true
-
- assert_triggered "Expected 42 (Fixnum) to respond to #clear." do
- 42.must_respond_to :clear
- end
-
- assert_triggered "msg.\nExpected 42 (Fixnum) to respond to #clear." do
- 42.must_respond_to :clear, "msg"
- end
- end
-
-end
-
-describe MiniTest::Spec, :let do
- i_suck_and_my_tests_are_order_dependent!
-
- def _count
- $let_count ||= 0
- end
-
- let :count do
- $let_count += 1
- $let_count
- end
-
- it "is evaluated once per example" do
- _count.must_equal 0
-
- count.must_equal 1
- count.must_equal 1
-
- _count.must_equal 1
- end
-
- it "is REALLY evaluated once per example" do
- _count.must_equal 1
-
- count.must_equal 2
- count.must_equal 2
-
- _count.must_equal 2
- end
-end
-
-describe MiniTest::Spec, :subject do
- attr_reader :subject_evaluation_count
-
- subject do
- @subject_evaluation_count ||= 0
- @subject_evaluation_count += 1
- @subject_evaluation_count
- end
-
- it "is evaluated once per example" do
- subject.must_equal 1
- subject.must_equal 1
- subject_evaluation_count.must_equal 1
- end
-end
-
-class TestMetaStatic < MiniTest::Unit::TestCase
- def test_children
- MiniTest::Spec.children.clear # prevents parallel run
-
- x = y = z = nil
- x = describe "top-level thingy" do
- y = describe "first thingy" do end
-
- it "top-level-it" do end
-
- z = describe "second thingy" do end
- end
-
- assert_equal [x], MiniTest::Spec.children
- assert_equal [y, z], x.children
- assert_equal [], y.children
- assert_equal [], z.children
- end
-end
-
-class TestMeta < MiniTest::Unit::TestCase
- parallelize_me! if ENV["PARALLEL"]
-
- def util_structure
- x = y = z = nil
- before_list = []
- after_list = []
- x = describe "top-level thingy" do
- before { before_list << 1 }
- after { after_list << 1 }
-
- it "top-level-it" do end
-
- y = describe "inner thingy" do
- before { before_list << 2 }
- after { after_list << 2 }
- it "inner-it" do end
-
- z = describe "very inner thingy" do
- before { before_list << 3 }
- after { after_list << 3 }
- it "inner-it" do end
-
- it {} # ignore me
- specify {} # anonymous it
- end
- end
- end
-
- return x, y, z, before_list, after_list
- end
-
- def test_register_spec_type
- original_types = MiniTest::Spec::TYPES.dup
-
- assert_equal [[//, MiniTest::Spec]], MiniTest::Spec::TYPES
-
- MiniTest::Spec.register_spec_type(/woot/, TestMeta)
-
- p = lambda do |x| true end
- MiniTest::Spec.register_spec_type TestMeta, &p
-
- keys = MiniTest::Spec::TYPES.map(&:first)
-
- assert_includes keys, /woot/
- assert_includes keys, p
- ensure
- MiniTest::Spec::TYPES.replace original_types
- end
-
- def test_spec_type
- original_types = MiniTest::Spec::TYPES.dup
-
- MiniTest::Spec.register_spec_type(/A$/, MiniSpecA)
- MiniTest::Spec.register_spec_type MiniSpecB do |desc|
- desc.superclass == ExampleA
- end
-
- assert_equal MiniSpecA, MiniTest::Spec.spec_type(ExampleA)
- assert_equal MiniSpecB, MiniTest::Spec.spec_type(ExampleB)
- ensure
- MiniTest::Spec::TYPES.replace original_types
- end
-
- def test_structure
- x, y, z, * = util_structure
-
- assert_equal "top-level thingy", x.to_s
- assert_equal "top-level thingy::inner thingy", y.to_s
- assert_equal "top-level thingy::inner thingy::very inner thingy", z.to_s
-
- assert_equal "top-level thingy", x.desc
- assert_equal "inner thingy", y.desc
- assert_equal "very inner thingy", z.desc
-
- top_methods = %w(setup teardown test_0001_top-level-it)
- inner_methods1 = %w(setup teardown test_0001_inner-it)
- inner_methods2 = inner_methods1 +
- %w(test_0002_anonymous test_0003_anonymous)
-
- assert_equal top_methods, x.instance_methods(false).sort.map(&:to_s)
- assert_equal inner_methods1, y.instance_methods(false).sort.map(&:to_s)
- assert_equal inner_methods2, z.instance_methods(false).sort.map(&:to_s)
- end
-
- def test_setup_teardown_behavior
- _, _, z, before_list, after_list = util_structure
-
- @tu = MiniTest::Unit.new
- MiniTest::Unit.runner = nil # protect the outer runner from the inner tests
-
- with_output do
- tc = z.new :test_0002_anonymous
- tc.run @tu
- end
-
- assert_equal [1, 2, 3], before_list
- assert_equal [3, 2, 1], after_list
- end
-
- def test_describe_first_structure
- x = x1 = x2 = y = z = nil
- x = describe "top-level thingy" do
- y = describe "first thingy" do end
-
- x1 = it "top level it" do end
- x2 = it "не латинские буквы-и-спецсимволы&いった α, β, γ, δ, ε hello!!! world" do end
-
- z = describe "second thingy" do end
- end
-
- test_methods = ['test_0001_top level it', 'test_0002_не латинские буквы-и-спецсимволы&いった α, β, γ, δ, ε hello!!! world'].sort
-
- assert_equal test_methods, [x1, x2]
- assert_equal test_methods,
- x.instance_methods.grep(/^test/).map {|o| o.to_s}.sort
- assert_equal [], y.instance_methods.grep(/^test/)
- assert_equal [], z.instance_methods.grep(/^test/)
- end
-
- def test_structure_subclasses
- z = nil
- x = Class.new MiniTest::Spec do
- def xyz; end
- end
- y = Class.new x do
- z = describe("inner") {}
- end
-
- assert_respond_to x.new(nil), "xyz"
- assert_respond_to y.new(nil), "xyz"
- assert_respond_to z.new(nil), "xyz"
- end
-
- def with_output # REFACTOR: dupe from metametameta
- synchronize do
- begin
- @output = StringIO.new("")
- MiniTest::Unit.output = @output
-
- yield
- ensure
- MiniTest::Unit.output = STDOUT
- end
- end
- end
-end
diff --git a/test/minitest/test_minitest_unit.rb b/test/minitest/test_minitest_unit.rb
index d3f7d4c1c3..6a01b6cfe3 100644
--- a/test/minitest/test_minitest_unit.rb
+++ b/test/minitest/test_minitest_unit.rb
@@ -1,9 +1,4 @@
# 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 'pathname'
require 'minitest/metametameta'
@@ -13,8 +8,6 @@ class AnError < StandardError; include MyModule; end
class ImmutableString < String; def inspect; super.freeze; end; end
class TestMiniTestUnit < MetaMetaMetaTestCase
- parallelize_me! if ENV["PARALLEL"]
-
pwd = Pathname.new File.expand_path Dir.pwd
basedir = Pathname.new(File.expand_path "lib/minitest") + 'mini'
basedir = basedir.relative_path_from(pwd).to_s
@@ -24,30 +17,13 @@ class TestMiniTestUnit < MetaMetaMetaTestCase
"#{MINITEST_BASE_DIR}/test.rb:139:in `run'",
"#{MINITEST_BASE_DIR}/test.rb:106:in `run'"]
- def test_wtf
- $hook_value = nil
-
- capture_io do # don't care about deprecation
- MiniTest::Unit::TestCase.add_setup_hook do
- $hook_value = 42
- end
- end
-
- run_setup_hooks
-
- assert_equal 42, $hook_value
- assert_equal [Proc], MiniTest::Unit::TestCase.setup_hooks.map(&:class)
- MiniTest::Unit::TestCase.reset_setup_teardown_hooks
- assert_equal [], MiniTest::Unit::TestCase.setup_hooks.map(&:class)
- end
-
def test_class_puke_with_assertion_failed
exception = MiniTest::Assertion.new "Oh no!"
exception.set_backtrace ["unhappy"]
assert_equal 'F', @tu.puke('SomeClass', 'method_name', exception)
assert_equal 1, @tu.failures
assert_match(/^Failure.*Oh no!/m, @tu.report.first)
- assert_match("method_name(SomeClass) [unhappy]", @tu.report.first)
+ assert_match("SomeClass#method_name [unhappy]", @tu.report.first)
end
def test_class_puke_with_assertion_failed_and_long_backtrace
@@ -67,7 +43,7 @@ class TestMiniTestUnit < MetaMetaMetaTestCase
assert_equal 'F', @tu.puke('TestSomeClass', 'test_method_name', exception)
assert_equal 1, @tu.failures
assert_match(/^Failure.*Oh no!/m, @tu.report.first)
- assert_match("test_method_name(TestSomeClass) [#{ex_location}]", @tu.report.first)
+ assert_match("TestSomeClass#test_method_name [#{ex_location}]", @tu.report.first)
end
def test_class_puke_with_assertion_failed_and_user_defined_assertions
@@ -90,7 +66,7 @@ class TestMiniTestUnit < MetaMetaMetaTestCase
assert_equal 'F', @tu.puke('TestSomeClass', 'test_method_name', exception)
assert_equal 1, @tu.failures
assert_match(/^Failure.*Oh no!/m, @tu.report.first)
- assert_match("test_method_name(TestSomeClass) [#{ex_location}]", @tu.report.first)
+ assert_match("TestSomeClass#test_method_name [#{ex_location}]", @tu.report.first)
end
def test_class_puke_with_failure_and_flunk_in_backtrace
@@ -123,7 +99,7 @@ class TestMiniTestUnit < MetaMetaMetaTestCase
assert_equal 'F', @tu.puke('TestSomeClass', 'test_method_name', exception)
assert_equal 1, @tu.failures
assert_match(/^Failure.*Oh no!/m, @tu.report.first)
- assert_match("test_method_name(TestSomeClass) [#{ex_location}]", @tu.report.first)
+ assert_match("TestSomeClass#test_method_name [#{ex_location}]", @tu.report.first)
end
def test_class_puke_with_non_failure_exception
@@ -179,6 +155,46 @@ class TestMiniTestUnit < MetaMetaMetaTestCase
assert_instance_of MiniTest::Unit, MiniTest::Unit.runner
end
+
+ def test_passed_eh_teardown_good
+ test_class = Class.new MiniTest::Unit::TestCase do
+ def teardown; assert true; end
+ def test_omg; assert true; end
+ end
+
+ test = test_class.new :test_omg
+ test.run @tu
+ assert test.passed?
+ end
+
+ def test_passed_eh_teardown_skipped
+ test_class = Class.new MiniTest::Unit::TestCase do
+ def teardown; assert true; end
+ def test_omg; skip "bork"; end
+ end
+
+ test = test_class.new :test_omg
+ test.run @tu
+ assert test.passed?
+ end
+
+ def test_passed_eh_teardown_flunked
+ test_class = Class.new MiniTest::Unit::TestCase do
+ def teardown; flunk; end
+ def test_omg; assert true; end
+ end
+
+ test = test_class.new :test_omg
+ test.run @tu
+ refute test.passed?
+ end
+
+ def util_expand_bt bt
+ bt.map { |f| (f =~ /^\./) ? File.expand_path(f) : f }
+ end
+end
+
+class TestMiniTestUnitInherited < MetaMetaMetaTestCase
def with_overridden_include
Class.class_eval do
def inherited_with_hacks klass
@@ -210,36 +226,6 @@ class TestMiniTestUnit < MetaMetaMetaTestCase
end
end
end
-
- def test_passed_eh_teardown_good
- test_class = Class.new MiniTest::Unit::TestCase do
- def teardown; assert true; end
- def test_omg; assert true; end
- end
-
- test = test_class.new :test_omg
- test.run @tu
- assert test.passed?
- end
-
- def test_passed_eh_teardown_flunked
- test_class = Class.new MiniTest::Unit::TestCase do
- def teardown; flunk; end
- def test_omg; assert true; end
- end
-
- test = test_class.new :test_omg
- test.run @tu
- refute test.passed?
- end
-
- def util_expand_bt bt
- if RUBY_VERSION >= '1.9.0' then
- bt.map { |f| (f =~ /^\./) ? File.expand_path(f) : f }
- else
- bt
- end
- end
end
class TestMiniTestRunner < MetaMetaMetaTestCase
@@ -297,9 +283,9 @@ class TestMiniTestRunner < MetaMetaMetaTestCase
Finished tests in 0.00
1) Error:
- test_error(#<Class:0xXXX>):
+ #<Class:0xXXX>#test_error:
RuntimeError: unhandled exception
- FILE:LINE:in `test_error'
+ FILE:LINE:in \`test_error\'
2 tests, 1 assertions, 0 failures, 1 errors, 0 skips
EOM
@@ -324,9 +310,9 @@ class TestMiniTestRunner < MetaMetaMetaTestCase
Finished tests in 0.00
1) Error:
- test_something(#<Class:0xXXX>):
+ #<Class:0xXXX>#test_something:
RuntimeError: unhandled exception
- FILE:LINE:in `teardown'
+ FILE:LINE:in \`teardown\'
1 tests, 1 assertions, 0 failures, 1 errors, 0 skips
EOM
@@ -351,7 +337,7 @@ class TestMiniTestRunner < MetaMetaMetaTestCase
Finished tests in 0.00
1) Failure:
- test_failure(#<Class:0xXXX>) [FILE:LINE]:
+ #<Class:0xXXX>#test_failure [FILE:LINE]:
Failed assertion, no message given.
2 tests, 2 assertions, 1 failures, 0 errors, 0 skips
@@ -382,6 +368,65 @@ class TestMiniTestRunner < MetaMetaMetaTestCase
assert_report expected, %w[--name /some|thing/ --seed 42]
end
+ def assert_filtering name, expected, a = false
+ args = %W[--name #{name} --seed 42]
+
+ alpha = Class.new MiniTest::Unit::TestCase do
+ define_method :test_something do
+ assert a
+ end
+ end
+ Object.const_set(:Alpha, alpha)
+
+ beta = Class.new MiniTest::Unit::TestCase do
+ define_method :test_something do
+ assert true
+ end
+ end
+ Object.const_set(:Beta, beta)
+
+ assert_report expected, args
+ ensure
+ Object.send :remove_const, :Alpha
+ Object.send :remove_const, :Beta
+ end
+
+ def test_run_filtered_including_suite_name
+ expected = clean <<-EOM
+ .
+
+ Finished tests in 0.00
+
+ 1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
+ EOM
+
+ assert_filtering "/Beta#test_something/", expected
+ end
+
+ def test_run_filtered_including_suite_name_string
+ expected = clean <<-EOM
+ .
+
+ Finished tests in 0.00
+
+ 1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
+ EOM
+
+ assert_filtering "Beta#test_something", expected
+ end
+
+ def test_run_filtered_string_method_only
+ expected = clean <<-EOM
+ ..
+
+ Finished tests in 0.00
+
+ 2 tests, 2 assertions, 0 failures, 0 errors, 0 skips
+ EOM
+
+ assert_filtering "test_something", expected, :pass
+ end
+
def test_run_passing
Class.new MiniTest::Unit::TestCase do
def test_something
@@ -441,7 +486,7 @@ class TestMiniTestRunner < MetaMetaMetaTestCase
Finished tests in 0.00
1) Skipped:
- test_skip(#<Class:0xXXX>) [FILE:LINE]:
+ #<Class:0xXXX>#test_skip [FILE:LINE]:
not yet
2 tests, 1 assertions, 0 failures, 0 errors, 1 skips
@@ -507,50 +552,6 @@ class TestMiniTestRunner < MetaMetaMetaTestCase
@lock.synchronize { @cv.wait_while { @count > 0 } }
end
end
-
- def test_run_parallel
- test_count = 2
- test_latch = Latch.new test_count
- main_latch = Latch.new
-
- thread = Thread.new {
- Thread.current.abort_on_exception = true
-
- # This latch waits until both test latches have been released. Both
- # latches can't be released unless done in separate threads because
- # `main_latch` keeps the test method from finishing.
- test_latch.await
- main_latch.release
- }
-
- Class.new MiniTest::Unit::TestCase do
- parallelize_me!
-
- test_count.times do |i|
- define_method :"test_wait_on_main_thread_#{i}" do
- test_latch.release
-
- # This latch blocks until the "main thread" releases it. The main
- # thread can't release this latch until both test latches have
- # been released. This forces the latches to be released in separate
- # threads.
- main_latch.await
- assert true
- end
- end
- end
-
- expected = clean <<-EOM
- ..
-
- Finished tests in 0.00
-
- 2 tests, 2 assertions, 0 failures, 0 errors, 0 skips
- EOM
-
- assert_report expected
- assert thread.join
- end
end
class TestMiniTestUnitOrder < MetaMetaMetaTestCase
@@ -637,12 +638,12 @@ class TestMiniTestUnitOrder < MetaMetaMetaTestCase
def test_setup_and_teardown_survive_inheritance
call_order = []
- parent = Class.new MiniTest::Spec do
- before do
+ parent = Class.new MiniTest::Unit::TestCase do
+ define_method :setup do
call_order << :setup_method
end
- after do
+ define_method :teardown do
call_order << :teardown_method
end
@@ -665,7 +666,9 @@ class TestMiniTestUnitOrder < MetaMetaMetaTestCase
end
class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
- parallelize_me! if ENV["PARALLEL"]
+ # do not call parallelize_me! - teardown accesses @tc._assertions
+ # which is not threadsafe. Nearly every method in here is an
+ # assertion test so it isn't worth splitting it out further.
RUBY18 = ! defined? Encoding
@@ -681,7 +684,7 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
def teardown
assert_equal(@assertion_count, @tc._assertions,
- "expected #{@assertion_count} assertions to be fired during the test, not #{@tc._assertions}") if @tc._assertions
+ "expected #{@assertion_count} assertions to be fired during the test, not #{@tc._assertions}") if @tc.passed?
end
def non_verbose
@@ -711,30 +714,6 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
end
end
- def test_assert_block
- exp = ["NOTE: MiniTest::Unit::TestCase#assert_block is deprecated,",
- "use assert. It will be removed on 2013-01-01."].join " "
-
- out, err = capture_io do
- @tc.assert_block do
- true
- end
- end
-
- assert_equal "", out
- assert_match exp, err
- end
-
- def test_assert_block_triggered
- assert_output do
- util_assert_triggered "blah.\nExpected block to return true value." do
- @tc.assert_block "blah" do
- false
- end
- end
- end
- end
-
def test_assert_empty
@assertion_count = 2
@@ -778,6 +757,8 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
end
def test_assert_equal_different_diff_deactivated
+ skip "https://github.com/MagLev/maglev/issues/209" if maglev?
+
without_diff do
util_assert_triggered util_msg("haha" * 10, "blah" * 10) do
o1 = "haha" * 10
@@ -890,8 +871,17 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
@tc.assert_in_delta 0.0, 1.0 / 1000, 0.1
end
+ def test_delta_consistency
+ @tc.assert_in_delta 0, 1, 1
+
+ util_assert_triggered "Expected |0 - 1| (1) to not be <= 1." do
+ @tc.refute_in_delta 0, 1, 1
+ end
+ end
+
def test_assert_in_delta_triggered
- util_assert_triggered 'Expected |0.0 - 0.001| (0.001) to be < 1.0e-06.' do
+ x = maglev? ? "9.999999xxxe-07" : "1.0e-06"
+ util_assert_triggered "Expected |0.0 - 0.001| (0.001) to be <= #{x}." do
@tc.assert_in_delta 0.0, 1.0 / 1000, 0.000001
end
end
@@ -913,15 +903,25 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
@tc.assert_in_epsilon(-10000, -9991)
end
+ def test_epsilon_consistency
+ @tc.assert_in_epsilon 1.0, 1.001
+
+ msg = "Expected |1.0 - 1.001| (0.000999xxx) to not be <= 0.001."
+ util_assert_triggered msg do
+ @tc.refute_in_epsilon 1.0, 1.001
+ end
+ end
+
def test_assert_in_epsilon_triggered
- util_assert_triggered 'Expected |10000 - 9990| (10) to be < 9.99.' do
+ util_assert_triggered 'Expected |10000 - 9990| (10) to be <= 9.99.' do
@tc.assert_in_epsilon 10000, 9990
end
end
def test_assert_in_epsilon_triggered_negative_case
- x = RUBY18 ? "0.1" : "0.10000000000000009"
- util_assert_triggered "Expected |-1.1 - -1| (#{x}) to be < 0.1." do
+ x = (RUBY18 and not maglev?) ? "0.1" : "0.100000xxx"
+ y = maglev? ? "0.100000xxx" : "0.1"
+ util_assert_triggered "Expected |-1.1 - -1| (#{x}) to be <= #{y}." do
@tc.assert_in_epsilon(-1.1, -1, 0.1)
end
end
@@ -1149,7 +1149,7 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
Class: <SyntaxError>
Message: <\"icky\">
---Backtrace---
- FILE:LINE:in `test_assert_raises_triggered_different'
+ FILE:LINE:in \`test_assert_raises_triggered_different\'
---------------
EOM
@@ -1172,7 +1172,7 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
Class: <SyntaxError>
Message: <\"icky\">
---Backtrace---
- FILE:LINE:in `test_assert_raises_triggered_different_msg'
+ FILE:LINE:in \`test_assert_raises_triggered_different_msg\'
---------------
EOM
@@ -1218,7 +1218,7 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
Class: <AnError>
Message: <\"AnError\">
---Backtrace---
- FILE:LINE:in `test_assert_raises_triggered_subclass'
+ FILE:LINE:in \`test_assert_raises_triggered_subclass\'
---------------
EOM
@@ -1326,7 +1326,7 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
non_verbose do
out, err = capture_io do
puts 'hi'
- warn 'bye!'
+ $stderr.puts 'bye!'
end
assert_equal "hi\n", out
@@ -1336,12 +1336,11 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
def test_capture_subprocess_io
@assertion_count = 0
- skip "Dunno why but the parallel run of this fails"
non_verbose do
out, err = capture_subprocess_io do
- system("echo 'hi'")
- system("echo 'bye!' 1>&2")
+ system("echo", "hi")
+ system("echo", "bye!", out: :err)
end
assert_equal "hi\n", out
@@ -1357,7 +1356,7 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
# These don't have corresponding refutes _on purpose_. They're
# useless and will never be added, so don't bother.
- ignores = %w[assert_block assert_output assert_raises assert_send
+ ignores = %w[assert_output assert_raises assert_send
assert_silent assert_throws]
# These are test/unit methods. I'm not actually sure why they're still here
@@ -1372,24 +1371,6 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
assert_empty asserts.map { |n| n.sub(/^assert/, 'refute') } - refutes
end
- def test_expectation
- @assertion_count = 2
-
- @tc.assert_equal true, 1.must_equal(1)
- end
-
- def test_expectation_triggered
- util_assert_triggered "Expected: 2\n Actual: 1" do
- 1.must_equal 2
- end
- end
-
- def test_expectation_with_a_message
- util_assert_triggered "Expected: 2\n Actual: 1" do
- 1.must_equal 2, ''
- end
- end
-
def test_flunk
util_assert_triggered 'Epic Fail!' do
@tc.flunk
@@ -1409,6 +1390,36 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
assert_equal "blah2.", @tc.message("") { "blah2" }.call
assert_equal "blah1.\nblah2.", @tc.message(:blah1) { "blah2" }.call
assert_equal "blah1.\nblah2.", @tc.message("blah1") { "blah2" }.call
+
+ message = proc { "blah1" }
+ assert_equal "blah1.\nblah2.", @tc.message(message) { "blah2" }.call
+
+ message = @tc.message { "blah1" }
+ assert_equal "blah1.\nblah2.", @tc.message(message) { "blah2" }.call
+ end
+
+ def test_message_message
+ util_assert_triggered "whoops.\nExpected: 1\n Actual: 2" do
+ @tc.assert_equal 1, 2, message { "whoops" }
+ end
+ end
+
+ def test_message_lambda
+ util_assert_triggered "whoops.\nExpected: 1\n Actual: 2" do
+ @tc.assert_equal 1, 2, lambda { "whoops" }
+ end
+ end
+
+ def test_message_deferred
+ @assertion_count, var = 0, nil
+
+ msg = message { var = "blah" }
+
+ assert_nil var
+
+ msg.call
+
+ assert_equal "blah", var
end
def test_pass
@@ -1455,18 +1466,19 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
end
def test_refute_in_delta_triggered
- util_assert_triggered 'Expected |0.0 - 0.001| (0.001) to not be < 0.1.' do
+ x = maglev? ? "0.100000xxx" : "0.1"
+ util_assert_triggered "Expected |0.0 - 0.001| (0.001) to not be <= #{x}." do
@tc.refute_in_delta 0.0, 1.0 / 1000, 0.1
end
end
def test_refute_in_epsilon
- @tc.refute_in_epsilon 10000, 9990
+ @tc.refute_in_epsilon 10000, 9990-1
end
def test_refute_in_epsilon_triggered
- util_assert_triggered 'Expected |10000 - 9991| (9) to not be < 10.0.' do
- @tc.refute_in_epsilon 10000, 9991
+ util_assert_triggered 'Expected |10000 - 9990| (10) to not be <= 10.0.' do
+ @tc.refute_in_epsilon 10000, 9990
fail
end
end
@@ -1613,7 +1625,12 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
end
srand 42
- expected = %w(test_test2 test_test1 test_test3)
+ expected = case
+ when maglev? then
+ %w(test_test2 test_test3 test_test1)
+ else
+ %w(test_test2 test_test1 test_test3)
+ end
assert_equal expected, sample_test_case.test_methods
end
@@ -1660,6 +1677,7 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
msg = e.message.sub(/(---Backtrace---).*/m, '\1')
msg.gsub!(/\(oid=[-0-9]+\)/, '(oid=N)')
+ msg.gsub!(/(\d\.\d{6})\d+/, '\1xxx') # normalize: ruby version, impl, platform
assert_equal expected, msg
end
@@ -1681,8 +1699,6 @@ class TestMiniTestUnitTestCase < MiniTest::Unit::TestCase
end
class TestMiniTestGuard < MiniTest::Unit::TestCase
- parallelize_me! if ENV["PARALLEL"]
-
def test_mri_eh
assert self.class.mri? "ruby blah"
assert self.mri? "ruby blah"
@@ -1703,3 +1719,85 @@ class TestMiniTestGuard < MiniTest::Unit::TestCase
assert self.windows? "mswin"
end
end
+
+class TestMiniTestUnitRecording < MetaMetaMetaTestCase
+ # do not parallelize this suite... it just can't handle it.
+
+ def assert_run_record(*expected, &block)
+ def @tu.record suite, method, assertions, time, error
+ recording[method] << error
+ end
+
+ def @tu.recording
+ @recording ||= Hash.new { |h,k| h[k] = [] }
+ end
+
+ MiniTest::Unit.runner = @tu
+
+ Class.new MiniTest::Unit::TestCase, &block
+
+ with_output do
+ @tu.run
+ end
+
+ recorded = @tu.recording.fetch("test_method").map(&:class)
+
+ assert_equal expected, recorded
+ end
+
+ def test_record_passing
+ assert_run_record NilClass do
+ def test_method
+ assert true
+ end
+ end
+ end
+
+ def test_record_failing
+ assert_run_record MiniTest::Assertion do
+ def test_method
+ assert false
+ end
+ end
+ end
+
+ def test_record_error
+ assert_run_record RuntimeError do
+ def test_method
+ raise "unhandled exception"
+ end
+ end
+ end
+
+ def test_record_error_teardown
+ assert_run_record NilClass, RuntimeError do
+ def test_method
+ assert true
+ end
+
+ def teardown
+ raise "unhandled exception"
+ end
+ end
+ end
+
+ def test_record_error_in_test_and_teardown
+ assert_run_record AnError, RuntimeError do
+ def test_method
+ raise AnError
+ end
+
+ def teardown
+ raise "unhandled exception"
+ end
+ end
+ end
+
+ def test_record_skip
+ assert_run_record MiniTest::Skip do
+ def test_method
+ skip "not yet"
+ end
+ end
+ end
+end
diff --git a/test/misc/test_ruby_mode.rb b/test/misc/test_ruby_mode.rb
index e011ece1cf..5be01747f1 100644
--- a/test/misc/test_ruby_mode.rb
+++ b/test/misc/test_ruby_mode.rb
@@ -34,8 +34,9 @@ class TestRubyMode
output = IO.popen([*EMACS, tmp.path, *exprs, err:[:child, :out]], "r") {|e| e.read}
tmp.open
result = tmp.read
- tmp.close!
return result, output
+ ensure
+ tmp.close!
end
class TestIndent < self
@@ -49,7 +50,7 @@ class TestRubyMode
end
result, output = run_emacs(source, EXPR_INDENT, EXPR_SAVE)
assert_match(/^Wrote /, output)
- assert_equal(expected, result, *message)
+ assert_equal(expected, result, message(*message) {diff expected, result})
end
def test_simple
diff --git a/test/mkmf/base.rb b/test/mkmf/base.rb
index 7df1e8961f..ab1a0f04b7 100644
--- a/test/mkmf/base.rb
+++ b/test/mkmf/base.rb
@@ -1,3 +1,5 @@
+$extmk = true
+
require 'test/unit'
require 'mkmf'
require 'tmpdir'
@@ -10,9 +12,6 @@ $extout_prefix = "$(extout)$(target_prefix)/"
class TestMkmf < Test::Unit::TestCase
MKMFLOG = proc {File.read("mkmf.log") rescue ""}
- class << MKMFLOG
- alias to_s call
- end
class Capture
attr_accessor :origin
@@ -54,11 +53,7 @@ class TestMkmf < Test::Unit::TestCase
attr_reader :stdout
def mkmflog(msg)
- log = proc {MKMFLOG[] << msg}
- class << log
- alias to_s call
- end
- log
+ proc {MKMFLOG[] << msg}
end
def setup
diff --git a/test/mkmf/test_config.rb b/test/mkmf/test_config.rb
new file mode 100644
index 0000000000..4a9be57e0a
--- /dev/null
+++ b/test/mkmf/test_config.rb
@@ -0,0 +1,17 @@
+$extmk = true
+
+require 'test/unit'
+require 'mkmf'
+require_relative '../ruby/envutil'
+
+class TestMkmf < Test::Unit::TestCase
+ class TestConfig < Test::Unit::TestCase
+ def test_dir_config
+ bug8074 = '[Bug #8074]'
+ lib = RbConfig.expand(RbConfig::MAKEFILE_CONFIG["libdir"], "exec_prefix"=>"")
+ assert_separately %w[-rmkmf - -- --with-foo-dir=/test/foo], %{
+ assert_equal(%w[/test/foo/include /test/foo#{lib}], dir_config("foo"), #{bug8074.dump})
+ }
+ end
+ end
+end
diff --git a/test/mkmf/test_framework.rb b/test/mkmf/test_framework.rb
index 48e8bf7213..cad6b052d0 100644
--- a/test/mkmf/test_framework.rb
+++ b/test/mkmf/test_framework.rb
@@ -26,7 +26,9 @@ class TestMkmf
def test_multi_frameworks
assert(have_framework("CoreFoundation"), mkmflog("try as Objective-C"))
- assert(have_framework("Cocoa"), mkmflog("try as Objective-C"))
+ create_framework("MkmfTest") do |fw|
+ assert(have_framework(fw), MKMFLOG)
+ end
end
def test_empty_framework
@@ -36,7 +38,7 @@ class TestMkmf
end
def test_different_name_header
- bug8593 = '[ruby-core:55745] [Bug #8593]'
+ _bug8593 = '[ruby-core:55745] [Bug #8593]'
create_framework("MkmfTest", "test_mkmf.h") do |fw, hdrname|
assert(!have_framework(fw), MKMFLOG)
assert(have_framework([fw, hdrname]), MKMFLOG)
diff --git a/test/mkmf/test_have_library.rb b/test/mkmf/test_have_library.rb
index 3cdc6e2c9f..bf17b85f61 100644
--- a/test/mkmf/test_have_library.rb
+++ b/test/mkmf/test_have_library.rb
@@ -15,11 +15,13 @@ class TestMkmf
hdr.puts "void #{FUNC_NAME}_fake(void);"
end
create_tmpsrc("#include \"#{HEADER_NAME}\"\n""void #{FUNC_NAME}(void) {}")
- xsystem(cc_command)
- xsystem("#{CONFIG['AR']} #{config_string('ARFLAGS') || 'cru '}#{lib} conftest.#{$OBJEXT}")
- File.unlink("conftest.#{$OBJEXT}")
+ assert(xsystem(cc_command), "compile failed: #{cc_command}")
+ command = "#{CONFIG['AR']} #{config_string('ARFLAGS') || 'cru '}#{lib} #{CONFTEST}.#{$OBJEXT}"
+ assert(xsystem(command), "making library failed: #{command}")
+ File.unlink("#{CONFTEST}.#{$OBJEXT}")
config_string('RANLIB') do |ranlib|
- xsystem("#{ranlib} #{lib}")
+ command = "#{ranlib} #{lib}"
+ assert(xsystem(command), "ranlib failed: #{command}")
end
end
diff --git a/test/mkmf/test_have_macro.rb b/test/mkmf/test_have_macro.rb
index 735a57c093..43c4029f70 100644
--- a/test/mkmf/test_have_macro.rb
+++ b/test/mkmf/test_have_macro.rb
@@ -10,7 +10,7 @@ class TestMkmf
end
def test_have_macro_header
- Tempfile.open(%w"test_mkmf .h", ".") do |tmp|
+ Tempfile.create(%w"test_mkmf .h", ".") do |tmp|
tmp.puts("#undef #{MACRO_NAME}")
tmp.puts("#define #{MACRO_NAME} 1")
tmp.close
@@ -24,7 +24,7 @@ class TestMkmf
end
def test_not_have_macro_header
- Tempfile.open(%w"test_mkmf .h", ".") do |tmp|
+ Tempfile.create(%w"test_mkmf .h", ".") do |tmp|
tmp.puts("#undef #{MACRO_NAME}")
tmp.close
base = File.basename(tmp.path)
diff --git a/test/monitor/test_monitor.rb b/test/monitor/test_monitor.rb
index 8591570b70..313ef23a95 100644
--- a/test/monitor/test_monitor.rb
+++ b/test/monitor/test_monitor.rb
@@ -78,6 +78,9 @@ class TestMonitor < Test::Unit::TestCase
ary << :main
end
assert_equal([:main], ary)
+ ensure
+ t1.join
+ t2.join
end
def test_try_enter
@@ -99,6 +102,7 @@ class TestMonitor < Test::Unit::TestCase
queue1.enq(nil)
queue2.deq
assert_equal(true, @monitor.try_enter)
+ th.join
end
def test_cond
@@ -106,7 +110,7 @@ class TestMonitor < Test::Unit::TestCase
a = "foo"
queue1 = Queue.new
- Thread.start do
+ th = Thread.start do
queue1.deq
@monitor.synchronize do
a = "bar"
@@ -120,13 +124,14 @@ class TestMonitor < Test::Unit::TestCase
assert_equal(true, result1)
assert_equal("bar", a)
end
+ th.join
end
def test_timedwait
cond = @monitor.new_cond
b = "foo"
queue2 = Queue.new
- Thread.start do
+ th = Thread.start do
queue2.deq
@monitor.synchronize do
b = "bar"
@@ -140,10 +145,11 @@ class TestMonitor < Test::Unit::TestCase
assert_equal(true, result2)
assert_equal("bar", b)
end
+ th.join
c = "foo"
queue3 = Queue.new
- Thread.start do
+ th = Thread.start do
queue3.deq
@monitor.synchronize do
c = "bar"
@@ -160,6 +166,7 @@ class TestMonitor < Test::Unit::TestCase
assert_equal(true, result4)
assert_equal("bar", c)
end
+ th.join
# d = "foo"
# cumber_thread = Thread.start {
diff --git a/test/net/ftp/test_buffered_socket.rb b/test/net/ftp/test_buffered_socket.rb
new file mode 100644
index 0000000000..f9eefcd988
--- /dev/null
+++ b/test/net/ftp/test_buffered_socket.rb
@@ -0,0 +1,40 @@
+require "net/ftp"
+require "test/unit"
+require "ostruct"
+require "stringio"
+
+class FTPTest < Test::Unit::TestCase
+ def test_gets_empty
+ sock = create_buffered_socket("")
+ assert_equal(nil, sock.gets)
+ end
+
+ def test_gets_one_line
+ sock = create_buffered_socket("foo\n")
+ assert_equal("foo\n", sock.gets)
+ end
+
+ def test_gets_one_line_without_term
+ sock = create_buffered_socket("foo")
+ assert_equal("foo", sock.gets)
+ end
+
+ def test_gets_two_lines
+ sock = create_buffered_socket("foo\nbar\n")
+ assert_equal("foo\n", sock.gets)
+ assert_equal("bar\n", sock.gets)
+ end
+
+ def test_gets_two_lines_without_term
+ sock = create_buffered_socket("foo\nbar")
+ assert_equal("foo\n", sock.gets)
+ assert_equal("bar", sock.gets)
+ end
+
+ private
+
+ def create_buffered_socket(s)
+ io = StringIO.new(s)
+ return Net::FTP::BufferedSocket.new(io)
+ end
+end
diff --git a/test/net/ftp/test_ftp.rb b/test/net/ftp/test_ftp.rb
index f25e10747b..e3c01d32c0 100644
--- a/test/net/ftp/test_ftp.rb
+++ b/test/net/ftp/test_ftp.rb
@@ -428,11 +428,6 @@ class FTPTest < Test::Unit::TestCase
def test_list_fail
commands = []
- list_lines = [
- "-rw-r--r-- 1 0 0 0 Mar 30 11:22 foo.txt",
- "-rw-r--r-- 1 0 0 0 Mar 30 11:22 bar.txt",
- "-rw-r--r-- 1 0 0 0 Mar 30 11:22 baz.txt"
- ]
server = create_ftp_server { |sock|
sock.print("220 (test_ftp).\r\n")
commands.push(sock.gets)
@@ -445,9 +440,6 @@ class FTPTest < Test::Unit::TestCase
sock.print("200 Switching to ASCII mode.\r\n")
line = sock.gets
commands.push(line)
- port_args = line.slice(/\APORT (.*)/, 1).split(/,/)
- host = port_args[0, 4].join(".")
- port = port_args[4, 2].map(&:to_i).inject {|x, y| (x << 8) + y}
sock.print("200 PORT command successful.\r\n")
commands.push(sock.gets)
sock.print("553 Requested action not taken.\r\n")
@@ -589,7 +581,6 @@ class FTPTest < Test::Unit::TestCase
def test_retrbinary_fail
commands = []
- binary_data = (0..0xff).map {|i| i.chr}.join * 4 * 3
server = create_ftp_server { |sock|
sock.print("220 (test_ftp).\r\n")
commands.push(sock.gets)
@@ -600,9 +591,6 @@ class FTPTest < Test::Unit::TestCase
sock.print("200 Switching to Binary mode.\r\n")
line = sock.gets
commands.push(line)
- port_args = line.slice(/\APORT (.*)/, 1).split(/,/)
- host = port_args[0, 4].join(".")
- port = port_args[4, 2].map(&:to_i).inject {|x, y| (x << 8) + y}
sock.print("200 PORT command successful.\r\n")
commands.push(sock.gets)
sock.print("550 Requested action not taken.\r\n")
@@ -678,7 +666,6 @@ class FTPTest < Test::Unit::TestCase
def test_storbinary_fail
commands = []
binary_data = (0..0xff).map {|i| i.chr}.join * 4 * 3
- stored_data = nil
server = create_ftp_server { |sock|
sock.print("220 (test_ftp).\r\n")
commands.push(sock.gets)
@@ -689,9 +676,6 @@ class FTPTest < Test::Unit::TestCase
sock.print("200 Switching to Binary mode.\r\n")
line = sock.gets
commands.push(line)
- port_args = line.slice(/\APORT (.*)/, 1).split(/,/)
- host = port_args[0, 4].join(".")
- port = port_args[4, 2].map(&:to_i).inject {|x, y| (x << 8) + y}
sock.print("200 PORT command successful.\r\n")
commands.push(sock.gets)
sock.print("452 Requested file action aborted.\r\n")
diff --git a/test/net/http/test_http.rb b/test/net/http/test_http.rb
index 0a0b6ca809..704456f3a3 100644
--- a/test/net/http/test_http.rb
+++ b/test/net/http/test_http.rb
@@ -397,13 +397,14 @@ module TestNetHTTP_version_1_1_methods
def test_timeout_during_HTTP_session
bug4246 = "expected the HTTP session to have timed out but have not. c.f. [ruby-core:34203]"
+ th = nil
# listen for connections... but deliberately do not read
TCPServer.open('localhost', 0) {|server|
port = server.addr[1]
conn = Net::HTTP.new('localhost', port)
conn.read_timeout = 0.01
- conn.open_timeout = 0.01
+ conn.open_timeout = 0.1
th = Thread.new do
assert_raise(Net::ReadTimeout) {
@@ -412,6 +413,9 @@ module TestNetHTTP_version_1_1_methods
end
assert th.join(10), bug4246
}
+ ensure
+ th.kill
+ th.join
end
end
@@ -559,10 +563,10 @@ module TestNetHTTP_version_1_2_methods
end
def _test_request__uri_host(http)
- uri = URI 'http://example/'
+ uri = URI 'http://other.example/'
req = Net::HTTP::Get.new(uri)
- req['host'] = 'other.example'
+ req['host'] = 'example'
res = http.request(req)
@@ -599,15 +603,15 @@ module TestNetHTTP_version_1_2_methods
def test_set_form
require 'tempfile'
- file = Tempfile.new('ruby-test')
- file << "\u{30c7}\u{30fc}\u{30bf}"
- data = [
- ['name', 'Gonbei Nanashi'],
- ['name', "\u{540d}\u{7121}\u{3057}\u{306e}\u{6a29}\u{5175}\u{885b}"],
- ['s"i\o', StringIO.new("\u{3042 3044 4e9c 925b}")],
- ["file", file, filename: "ruby-test"]
- ]
- expected = <<"__EOM__".gsub(/\n/, "\r\n")
+ Tempfile.create('ruby-test') {|file|
+ file << "\u{30c7}\u{30fc}\u{30bf}"
+ data = [
+ ['name', 'Gonbei Nanashi'],
+ ['name', "\u{540d}\u{7121}\u{3057}\u{306e}\u{6a29}\u{5175}\u{885b}"],
+ ['s"i\o', StringIO.new("\u{3042 3044 4e9c 925b}")],
+ ["file", file, filename: "ruby-test"]
+ ]
+ expected = <<"__EOM__".gsub(/\n/, "\r\n")
--<boundary>
Content-Disposition: form-data; name="name"
@@ -627,13 +631,12 @@ Content-Type: application/octet-stream
\xE3\x83\x87\xE3\x83\xBC\xE3\x82\xBF
--<boundary>--
__EOM__
- start {|http|
- _test_set_form_urlencoded(http, data.reject{|k,v|!v.is_a?(String)})
- _test_set_form_multipart(http, false, data, expected)
- _test_set_form_multipart(http, true, data, expected)
+ start {|http|
+ _test_set_form_urlencoded(http, data.reject{|k,v|!v.is_a?(String)})
+ _test_set_form_multipart(http, false, data, expected)
+ _test_set_form_multipart(http, true, data, expected)
+ }
}
- ensure
- file.close! if file
end
def _test_set_form_urlencoded(http, data)
@@ -658,12 +661,12 @@ __EOM__
def test_set_form_with_file
require 'tempfile'
- file = Tempfile.new('ruby-test')
- file.binmode
- file << $test_net_http_data
- filename = File.basename(file.to_path)
- data = [['file', file]]
- expected = <<"__EOM__".gsub(/\n/, "\r\n")
+ Tempfile.create('ruby-test') {|file|
+ file.binmode
+ file << $test_net_http_data
+ filename = File.basename(file.to_path)
+ data = [['file', file]]
+ expected = <<"__EOM__".gsub(/\n/, "\r\n")
--<boundary>
Content-Disposition: form-data; name="file"; filename="<filename>"
Content-Type: application/octet-stream
@@ -671,38 +674,36 @@ Content-Type: application/octet-stream
<data>
--<boundary>--
__EOM__
- expected.sub!(/<filename>/, filename)
- expected.sub!(/<data>/, $test_net_http_data)
- start {|http|
- data.each{|k,v|v.rewind rescue nil}
- req = Net::HTTP::Post.new('/')
- req.set_form(data, 'multipart/form-data')
- res = http.request req
- body = res.body
- header, _ = body.split(/\r\n\r\n/, 2)
- assert_match(/\A--(?<boundary>\S+)/, body)
- /\A--(?<boundary>\S+)/ =~ body
- expected = expected.gsub(/<boundary>/, boundary)
- assert_match(/^--(?<boundary>\S+)\r\n/, header)
- assert_match(
- /^Content-Disposition: form-data; name="file"; filename="#{filename}"\r\n/,
- header)
- assert_equal(expected, body)
-
- data.each{|k,v|v.rewind rescue nil}
- req['Transfer-Encoding'] = 'chunked'
- res = http.request req
- #assert_equal(expected, res.body)
+ expected.sub!(/<filename>/, filename)
+ expected.sub!(/<data>/, $test_net_http_data)
+ start {|http|
+ data.each{|k,v|v.rewind rescue nil}
+ req = Net::HTTP::Post.new('/')
+ req.set_form(data, 'multipart/form-data')
+ res = http.request req
+ body = res.body
+ header, _ = body.split(/\r\n\r\n/, 2)
+ assert_match(/\A--(?<boundary>\S+)/, body)
+ /\A--(?<boundary>\S+)/ =~ body
+ expected = expected.gsub(/<boundary>/, boundary)
+ assert_match(/^--(?<boundary>\S+)\r\n/, header)
+ assert_match(
+ /^Content-Disposition: form-data; name="file"; filename="#{filename}"\r\n/,
+ header)
+ assert_equal(expected, body)
+
+ data.each{|k,v|v.rewind rescue nil}
+ req['Transfer-Encoding'] = 'chunked'
+ res = http.request req
+ #assert_equal(expected, res.body)
+ }
}
- ensure
- file.close! if file
end
end
class TestNetHTTP_v1_2 < Test::Unit::TestCase
CONFIG = {
'host' => '127.0.0.1',
- 'port' => 0,
'proxy_host' => nil,
'proxy_port' => nil,
}
@@ -720,7 +721,6 @@ end
class TestNetHTTP_v1_2_chunked < Test::Unit::TestCase
CONFIG = {
'host' => '127.0.0.1',
- 'port' => 0,
'proxy_host' => nil,
'proxy_port' => nil,
'chunked' => true,
@@ -751,7 +751,6 @@ end
class TestNetHTTPContinue < Test::Unit::TestCase
CONFIG = {
'host' => '127.0.0.1',
- 'port' => 0,
'proxy_host' => nil,
'proxy_port' => nil,
'chunked' => true,
@@ -836,7 +835,6 @@ end
class TestNetHTTPKeepAlive < Test::Unit::TestCase
CONFIG = {
'host' => '127.0.0.1',
- 'port' => 0,
'proxy_host' => nil,
'proxy_port' => nil,
'RequestTimeout' => 1,
@@ -888,7 +886,6 @@ end
class TestNetHTTPLocalBind < Test::Unit::TestCase
CONFIG = {
'host' => 'localhost',
- 'port' => 0,
'proxy_host' => nil,
'proxy_port' => nil,
}
@@ -912,7 +909,9 @@ class TestNetHTTPLocalBind < Test::Unit::TestCase
http = Net::HTTP.new(config('host'), config('port'))
http.local_host = Addrinfo.tcp(config('host'), config('port')).ip_address
- http.local_port = [*10000..20000].shuffle.first.to_s
+ http.local_port = Addrinfo.tcp(config('host'), 0).bind {|s|
+ s.local_address.ip_port.to_s
+ }
assert_not_nil(http.local_host)
assert_not_nil(http.local_port)
diff --git a/test/net/http/test_https.rb b/test/net/http/test_https.rb
index b711582b99..0df003bdda 100644
--- a/test/net/http/test_https.rb
+++ b/test/net/http/test_https.rb
@@ -24,7 +24,6 @@ class TestNetHTTPS < Test::Unit::TestCase
CONFIG = {
'host' => '127.0.0.1',
- 'port' => 0,
'proxy_host' => nil,
'proxy_port' => nil,
'ssl_enable' => true,
@@ -52,7 +51,7 @@ class TestNetHTTPS < Test::Unit::TestCase
store_ctx.current_cert.to_der == config('ssl_certificate').to_der
end
data = config('ssl_private_key').to_der
- http.request_post("/", data) {|res|
+ http.request_post("/", data, {'content-type' => 'application/x-www-form-urlencoded'}) {|res|
assert_equal(data, res.body)
}
rescue SystemCallError
@@ -80,6 +79,7 @@ class TestNetHTTPS < Test::Unit::TestCase
socket = http.instance_variable_get(:@socket).io
assert socket.session_reused?
+ http.finish
rescue SystemCallError
skip $!
end
diff --git a/test/net/http/utils.rb b/test/net/http/utils.rb
index 02e99d45fb..c629da8808 100644
--- a/test/net/http/utils.rb
+++ b/test/net/http/utils.rb
@@ -34,9 +34,7 @@ module TestNetHTTPUtils
def teardown
if @server
@server.shutdown
- until @server.status == :Stop
- sleep 0.1
- end
+ @server_thread.join
end
# resume global state
Net::HTTP.version_1_2
@@ -46,10 +44,9 @@ module TestNetHTTPUtils
@config = self.class::CONFIG
server_config = {
:BindAddress => config('host'),
- :Port => config('port'),
+ :Port => 0,
:Logger => WEBrick::Log.new(NullWriter.new),
:AccessLog => [],
- :ShutdownSocketWithoutClose => true,
:ServerType => Thread,
}
server_config[:OutputBufferSize] = 4 if config('chunked')
@@ -64,8 +61,8 @@ module TestNetHTTPUtils
end
@server = WEBrick::HTTPServer.new(server_config)
@server.mount('/', Servlet, config('chunked'))
- @server.start
- @config['port'] = @server[:Port] if @config['port'] == 0
+ @server_thread = @server.start
+ @config['port'] = @server[:Port]
n_try_max = 5
begin
TCPSocket.open(config('host'), config('port')).close
diff --git a/test/net/imap/Makefile b/test/net/imap/Makefile
new file mode 100644
index 0000000000..b2bc9c7368
--- /dev/null
+++ b/test/net/imap/Makefile
@@ -0,0 +1,15 @@
+all:
+
+regen_certs:
+ touch server.key
+ make server.crt
+
+cacert.pem: server.key
+ openssl req -new -x509 -days 1825 -key server.key -out cacert.pem -text -subj "/C=JP/ST=Shimane/L=Matz-e city/O=Ruby Core Team/CN=Ruby Test CA/emailAddress=security@ruby-lang.org"
+
+server.csr:
+ openssl req -new -key server.key -out server.csr -text -subj "/C=JP/ST=Shimane/O=Ruby Core Team/OU=Ruby Test/CN=localhost"
+
+server.crt: server.csr cacert.pem
+ openssl x509 -days 1825 -CA cacert.pem -CAkey server.key -set_serial 00 -in server.csr -req -text -out server.crt
+ rm server.csr
diff --git a/test/net/imap/cacert.pem b/test/net/imap/cacert.pem
index bd7e68ac95..7073387877 100644
--- a/test/net/imap/cacert.pem
+++ b/test/net/imap/cacert.pem
@@ -2,59 +2,65 @@ Certificate:
Data:
Version: 3 (0x2)
Serial Number:
- 9f:dc:f7:94:98:05:43:4c
+ b9:90:a2:bf:62:69:17:9c
Signature Algorithm: sha1WithRSAEncryption
Issuer: C=JP, ST=Shimane, L=Matz-e city, O=Ruby Core Team, CN=Ruby Test CA/emailAddress=security@ruby-lang.org
Validity
- Not Before: Dec 23 10:21:33 2010 GMT
- Not After : Jan 1 10:21:33 2014 GMT
+ Not Before: Jan 3 01:34:17 2014 GMT
+ Not After : Jan 2 01:34:17 2019 GMT
Subject: C=JP, ST=Shimane, L=Matz-e city, O=Ruby Core Team, CN=Ruby Test CA/emailAddress=security@ruby-lang.org
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
- Public-Key: (1024 bit)
- Modulus:
- 00:ce:be:2c:9f:47:ba:db:9c:9c:5b:f0:38:3b:f3:
- 74:20:37:76:23:9f:84:1c:81:90:b4:3e:00:20:34:
- 98:7e:81:69:50:a1:c3:65:96:ea:fa:00:da:8c:cc:
- 53:3f:ba:3c:d0:50:7a:5a:b4:6b:ac:d3:2e:18:ca:
- 2a:69:b3:6a:6f:38:c2:32:a8:06:b6:0a:30:a9:ee:
- 03:38:e9:05:a5:19:23:54:a8:3c:b9:08:ad:2b:72:
- 23:df:93:22:c4:46:a8:ea:f1:a6:e9:30:4a:3f:83:
- 39:e9:62:8e:8b:a3:5e:67:89:1d:7c:75:de:05:aa:
- 58:b1:b7:79:7c:10:80:6d:87
+ RSA Public Key: (1024 bit)
+ Modulus (1024 bit):
+ 00:db:75:d0:45:de:b1:df:bf:71:a0:0e:b0:a5:e6:
+ bc:f4:1c:9d:e5:25:67:64:c5:7b:cb:f1:af:c6:be:
+ 9a:aa:ea:7e:0f:cc:05:af:ef:40:69:06:b2:c9:13:
+ 9d:7e:eb:a2:06:e2:ea:7d:07:c7:c7:99:c7:fb:d5:
+ b8:eb:63:77:62:2b:18:12:c3:53:58:d0:f5:c7:40:
+ 0c:01:d1:26:82:34:16:09:e3:dc:65:f4:dc:bb:5d:
+ a5:41:60:e7:a9:74:ba:d7:4c:b6:a3:9c:c5:8c:89:
+ af:cb:e8:9f:05:fe:ea:fe:64:24:bf:e7:ed:e3:f6:
+ d0:fc:d6:eb:fc:06:82:10:fb
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Subject Key Identifier:
- 41:C9:49:37:B1:FA:61:E3:BA:D7:19:3D:D9:DA:8C:B9:82:C9:B4:6A
+ E8:7E:58:AC:13:7B:03:22:8D:9E:AF:32:0B:84:89:80:80:0C:1E:C2
X509v3 Authority Key Identifier:
- keyid:41:C9:49:37:B1:FA:61:E3:BA:D7:19:3D:D9:DA:8C:B9:82:C9:B4:6A
+ keyid:E8:7E:58:AC:13:7B:03:22:8D:9E:AF:32:0B:84:89:80:80:0C:1E:C2
+ DirName:/C=JP/ST=Shimane/L=Matz-e city/O=Ruby Core Team/CN=Ruby Test CA/emailAddress=security@ruby-lang.org
+ serial:B9:90:A2:BF:62:69:17:9C
X509v3 Basic Constraints:
CA:TRUE
Signature Algorithm: sha1WithRSAEncryption
- 86:00:33:b9:dd:ff:5f:83:59:5f:c3:29:3c:d7:11:db:10:b3:
- d7:d1:70:fb:0a:c6:74:85:c6:ea:e1:15:c4:92:f8:0e:11:cc:
- ff:a6:3c:31:c2:2c:66:d8:fe:63:93:9f:b0:97:e6:f5:bc:5c:
- 80:68:96:5d:eb:77:b9:23:dd:68:a7:49:03:ff:22:48:55:f1:
- 39:7c:20:21:ff:64:52:e1:f6:cf:3c:b3:4d:2c:5c:03:62:ea:
- c5:49:99:07:fa:8d:ff:7b:c2:75:0c:ca:24:b5:0b:f5:b7:57:
- 3a:10:f0:8a:bb:9a:e8:92:4d:d5:6f:c2:a2:29:36:61:78:a4:
- dc:7b
+ 8f:77:06:4e:31:72:12:ee:68:09:70:27:d4:31:85:ef:10:95:
+ f9:0f:2b:66:63:08:37:88:6e:b7:9b:40:3e:18:77:33:86:e8:
+ 61:6a:b7:3c:cb:c7:a6:d6:d5:92:6a:1f:56:d0:9f:5c:32:56:
+ d3:37:52:fe:0e:20:c2:7a:0d:fe:2d:3c:81:da:b8:7f:4d:6a:
+ 08:01:d9:be:7a:a2:15:be:a6:ce:49:64:90:8c:9a:ca:6e:2e:
+ 84:48:1d:94:19:56:94:46:aa:25:9b:68:c2:80:60:bf:cb:2e:
+ 35:03:ea:0a:65:5a:33:38:c6:cc:81:46:c0:bc:36:86:96:39:
+ 10:7d
-----BEGIN CERTIFICATE-----
-MIIC6DCCAlGgAwIBAgIJAJ/c95SYBUNMMA0GCSqGSIb3DQEBBQUAMIGMMQswCQYD
-VQQGEwJKUDEQMA4GA1UECAwHU2hpbWFuZTEUMBIGA1UEBwwLTWF0ei1lIGNpdHkx
-FzAVBgNVBAoMDlJ1YnkgQ29yZSBUZWFtMRUwEwYDVQQDDAxSdWJ5IFRlc3QgQ0Ex
-JTAjBgkqhkiG9w0BCQEWFnNlY3VyaXR5QHJ1YnktbGFuZy5vcmcwHhcNMTAxMjIz
-MTAyMTMzWhcNMTQwMTAxMTAyMTMzWjCBjDELMAkGA1UEBhMCSlAxEDAOBgNVBAgM
-B1NoaW1hbmUxFDASBgNVBAcMC01hdHotZSBjaXR5MRcwFQYDVQQKDA5SdWJ5IENv
-cmUgVGVhbTEVMBMGA1UEAwwMUnVieSBUZXN0IENBMSUwIwYJKoZIhvcNAQkBFhZz
+MIIDjTCCAvagAwIBAgIJALmQor9iaRecMA0GCSqGSIb3DQEBBQUAMIGMMQswCQYD
+VQQGEwJKUDEQMA4GA1UECBMHU2hpbWFuZTEUMBIGA1UEBxMLTWF0ei1lIGNpdHkx
+FzAVBgNVBAoTDlJ1YnkgQ29yZSBUZWFtMRUwEwYDVQQDEwxSdWJ5IFRlc3QgQ0Ex
+JTAjBgkqhkiG9w0BCQEWFnNlY3VyaXR5QHJ1YnktbGFuZy5vcmcwHhcNMTQwMTAz
+MDEzNDE3WhcNMTkwMTAyMDEzNDE3WjCBjDELMAkGA1UEBhMCSlAxEDAOBgNVBAgT
+B1NoaW1hbmUxFDASBgNVBAcTC01hdHotZSBjaXR5MRcwFQYDVQQKEw5SdWJ5IENv
+cmUgVGVhbTEVMBMGA1UEAxMMUnVieSBUZXN0IENBMSUwIwYJKoZIhvcNAQkBFhZz
ZWN1cml0eUBydWJ5LWxhbmcub3JnMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKB
-gQDOviyfR7rbnJxb8Dg783QgN3Yjn4QcgZC0PgAgNJh+gWlQocNllur6ANqMzFM/
-ujzQUHpatGus0y4Yyipps2pvOMIyqAa2CjCp7gM46QWlGSNUqDy5CK0rciPfkyLE
-Rqjq8abpMEo/gznpYo6Lo15niR18dd4Fqlixt3l8EIBthwIDAQABo1AwTjAdBgNV
-HQ4EFgQUQclJN7H6YeO61xk92dqMuYLJtGowHwYDVR0jBBgwFoAUQclJN7H6YeO6
-1xk92dqMuYLJtGowDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCGADO5
-3f9fg1lfwyk81xHbELPX0XD7CsZ0hcbq4RXEkvgOEcz/pjwxwixm2P5jk5+wl+b1
-vFyAaJZd63e5I91op0kD/yJIVfE5fCAh/2RS4fbPPLNNLFwDYurFSZkH+o3/e8J1
-DMoktQv1t1c6EPCKu5rokk3Vb8KiKTZheKTcew==
+gQDbddBF3rHfv3GgDrCl5rz0HJ3lJWdkxXvL8a/Gvpqq6n4PzAWv70BpBrLJE51+
+66IG4up9B8fHmcf71bjrY3diKxgSw1NY0PXHQAwB0SaCNBYJ49xl9Ny7XaVBYOep
+dLrXTLajnMWMia/L6J8F/ur+ZCS/5+3j9tD81uv8BoIQ+wIDAQABo4H0MIHxMB0G
+A1UdDgQWBBToflisE3sDIo2erzILhImAgAwewjCBwQYDVR0jBIG5MIG2gBToflis
+E3sDIo2erzILhImAgAwewqGBkqSBjzCBjDELMAkGA1UEBhMCSlAxEDAOBgNVBAgT
+B1NoaW1hbmUxFDASBgNVBAcTC01hdHotZSBjaXR5MRcwFQYDVQQKEw5SdWJ5IENv
+cmUgVGVhbTEVMBMGA1UEAxMMUnVieSBUZXN0IENBMSUwIwYJKoZIhvcNAQkBFhZz
+ZWN1cml0eUBydWJ5LWxhbmcub3JnggkAuZCiv2JpF5wwDAYDVR0TBAUwAwEB/zAN
+BgkqhkiG9w0BAQUFAAOBgQCPdwZOMXIS7mgJcCfUMYXvEJX5DytmYwg3iG63m0A+
+GHczhuhharc8y8em1tWSah9W0J9cMlbTN1L+DiDCeg3+LTyB2rh/TWoIAdm+eqIV
+vqbOSWSQjJrKbi6ESB2UGVaURqolm2jCgGC/yy41A+oKZVozOMbMgUbAvDaGljkQ
+fQ==
-----END CERTIFICATE-----
diff --git a/test/net/imap/server.crt b/test/net/imap/server.crt
index d848b26ab0..fa4f99493a 100644
--- a/test/net/imap/server.crt
+++ b/test/net/imap/server.crt
@@ -1,17 +1,17 @@
Certificate:
Data:
- Version: 3 (0x2)
+ Version: 1 (0x0)
Serial Number: 0 (0x0)
Signature Algorithm: sha1WithRSAEncryption
Issuer: C=JP, ST=Shimane, L=Matz-e city, O=Ruby Core Team, CN=Ruby Test CA/emailAddress=security@ruby-lang.org
Validity
- Not Before: Dec 23 10:23:52 2010 GMT
- Not After : Jan 1 10:23:52 2014 GMT
+ Not Before: Jan 3 01:34:17 2014 GMT
+ Not After : Jan 2 01:34:17 2019 GMT
Subject: C=JP, ST=Shimane, O=Ruby Core Team, OU=Ruby Test, CN=localhost
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
- Public-Key: (1024 bit)
- Modulus:
+ RSA Public Key: (1024 bit)
+ Modulus (1024 bit):
00:db:75:d0:45:de:b1:df:bf:71:a0:0e:b0:a5:e6:
bc:f4:1c:9d:e5:25:67:64:c5:7b:cb:f1:af:c6:be:
9a:aa:ea:7e:0f:cc:05:af:ef:40:69:06:b2:c9:13:
@@ -22,40 +22,27 @@ Certificate:
af:cb:e8:9f:05:fe:ea:fe:64:24:bf:e7:ed:e3:f6:
d0:fc:d6:eb:fc:06:82:10:fb
Exponent: 65537 (0x10001)
- X509v3 extensions:
- X509v3 Basic Constraints:
- CA:FALSE
- Netscape Comment:
- OpenSSL Generated Certificate
- X509v3 Subject Key Identifier:
- E8:7E:58:AC:13:7B:03:22:8D:9E:AF:32:0B:84:89:80:80:0C:1E:C2
- X509v3 Authority Key Identifier:
- keyid:41:C9:49:37:B1:FA:61:E3:BA:D7:19:3D:D9:DA:8C:B9:82:C9:B4:6A
-
Signature Algorithm: sha1WithRSAEncryption
- ae:ee:cd:fe:c9:af:48:0b:50:37:ac:6a:f6:68:90:9b:67:df:
- 6f:2d:17:c9:3c:a5:da:ad:39:dc:2a:5b:07:88:26:38:19:30:
- d6:95:cf:10:69:c7:92:14:83:be:f1:b5:8e:6f:d9:91:51:c5:
- 63:ae:1c:89:ac:27:bf:4f:2a:8f:4e:0c:57:42:0a:c9:8e:0c:
- f4:f3:02:f7:ea:44:b6:e4:47:05:af:4e:74:e4:87:87:d9:c8:
- 76:ed:ab:32:7c:f0:31:34:10:14:bc:a6:37:cd:d7:dc:33:da:
- 82:d3:d4:9b:e9:d5:cd:38:cc:fa:81:5f:4e:fd:5f:53:05:5d:
- 76:f9
+ 85:f5:d3:05:8b:8c:f4:43:1c:88:f2:8f:b2:f2:93:77:b7:3d:
+ 95:c6:a0:34:bc:33:6a:d8:85:5f:3e:86:08:10:c5:5c:c1:76:
+ a3:53:3c:dc:38:98:23:97:e7:da:21:ac:e8:4d:3c:96:70:29:
+ ff:ff:1e:4a:9a:17:2b:db:04:62:b9:ef:ab:ea:a7:a5:e8:7c:
+ b1:d5:ed:30:a8:6c:78:de:51:7e:e3:8a:c2:a4:64:a8:63:a2:
+ bc:fd:43:9c:f3:55:7d:54:c9:6a:d8:53:1c:4b:6b:03:aa:b6:
+ 19:e6:a4:4f:47:00:96:c5:42:59:85:4e:c3:4e:cd:41:82:53:
+ 10:f8
-----BEGIN CERTIFICATE-----
-MIIC3jCCAkegAwIBAgIBADANBgkqhkiG9w0BAQUFADCBjDELMAkGA1UEBhMCSlAx
-EDAOBgNVBAgMB1NoaW1hbmUxFDASBgNVBAcMC01hdHotZSBjaXR5MRcwFQYDVQQK
-DA5SdWJ5IENvcmUgVGVhbTEVMBMGA1UEAwwMUnVieSBUZXN0IENBMSUwIwYJKoZI
-hvcNAQkBFhZzZWN1cml0eUBydWJ5LWxhbmcub3JnMB4XDTEwMTIyMzEwMjM1MloX
-DTE0MDEwMTEwMjM1MlowYDELMAkGA1UEBhMCSlAxEDAOBgNVBAgMB1NoaW1hbmUx
-FzAVBgNVBAoMDlJ1YnkgQ29yZSBUZWFtMRIwEAYDVQQLDAlSdWJ5IFRlc3QxEjAQ
-BgNVBAMMCWxvY2FsaG9zdDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA23XQ
-Rd6x379xoA6wpea89Byd5SVnZMV7y/Gvxr6aqup+D8wFr+9AaQayyROdfuuiBuLq
-fQfHx5nH+9W462N3YisYEsNTWND1x0AMAdEmgjQWCePcZfTcu12lQWDnqXS610y2
-o5zFjImvy+ifBf7q/mQkv+ft4/bQ/Nbr/AaCEPsCAwEAAaN7MHkwCQYDVR0TBAIw
-ADAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUw
-HQYDVR0OBBYEFOh+WKwTewMijZ6vMguEiYCADB7CMB8GA1UdIwQYMBaAFEHJSTex
-+mHjutcZPdnajLmCybRqMA0GCSqGSIb3DQEBBQUAA4GBAK7uzf7Jr0gLUDesavZo
-kJtn328tF8k8pdqtOdwqWweIJjgZMNaVzxBpx5IUg77xtY5v2ZFRxWOuHImsJ79P
-Ko9ODFdCCsmODPTzAvfqRLbkRwWvTnTkh4fZyHbtqzJ88DE0EBS8pjfN19wz2oLT
-1Jvp1c04zPqBX079X1MFXXb5
+MIICXDCCAcUCAQAwDQYJKoZIhvcNAQEFBQAwgYwxCzAJBgNVBAYTAkpQMRAwDgYD
+VQQIEwdTaGltYW5lMRQwEgYDVQQHEwtNYXR6LWUgY2l0eTEXMBUGA1UEChMOUnVi
+eSBDb3JlIFRlYW0xFTATBgNVBAMTDFJ1YnkgVGVzdCBDQTElMCMGCSqGSIb3DQEJ
+ARYWc2VjdXJpdHlAcnVieS1sYW5nLm9yZzAeFw0xNDAxMDMwMTM0MTdaFw0xOTAx
+MDIwMTM0MTdaMGAxCzAJBgNVBAYTAkpQMRAwDgYDVQQIEwdTaGltYW5lMRcwFQYD
+VQQKEw5SdWJ5IENvcmUgVGVhbTESMBAGA1UECxMJUnVieSBUZXN0MRIwEAYDVQQD
+Ewlsb2NhbGhvc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANt10EXesd+/
+caAOsKXmvPQcneUlZ2TFe8vxr8a+mqrqfg/MBa/vQGkGsskTnX7rogbi6n0Hx8eZ
+x/vVuOtjd2IrGBLDU1jQ9cdADAHRJoI0Fgnj3GX03LtdpUFg56l0utdMtqOcxYyJ
+r8vonwX+6v5kJL/n7eP20PzW6/wGghD7AgMBAAEwDQYJKoZIhvcNAQEFBQADgYEA
+hfXTBYuM9EMciPKPsvKTd7c9lcagNLwzatiFXz6GCBDFXMF2o1M83DiYI5fn2iGs
+6E08lnAp//8eSpoXK9sEYrnvq+qnpeh8sdXtMKhseN5RfuOKwqRkqGOivP1DnPNV
+fVTJathTHEtrA6q2GeakT0cAlsVCWYVOw07NQYJTEPg=
-----END CERTIFICATE-----
diff --git a/test/net/imap/test_imap.rb b/test/net/imap/test_imap.rb
index 9484ab8f6c..0f171e6a1d 100644
--- a/test/net/imap/test_imap.rb
+++ b/test/net/imap/test_imap.rb
@@ -127,7 +127,7 @@ class IMAPTest < Test::Unit::TestCase
def test_unexpected_eof
server = create_tcp_server
port = server.addr[1]
- Thread.start do
+ ths = Thread.start do
begin
sock = server.accept
begin
@@ -152,6 +152,7 @@ class IMAPTest < Test::Unit::TestCase
end
ensure
server.close
+ ths.join
end
end
@@ -159,7 +160,7 @@ class IMAPTest < Test::Unit::TestCase
server = create_tcp_server
port = server.addr[1]
requests = []
- Thread.start do
+ ths = Thread.start do
begin
sock = server.accept
begin
@@ -204,6 +205,7 @@ class IMAPTest < Test::Unit::TestCase
end
ensure
server.close
+ ths.join
end
end
@@ -211,7 +213,7 @@ class IMAPTest < Test::Unit::TestCase
server = create_tcp_server
port = server.addr[1]
requests = []
- Thread.start do
+ ths = Thread.start do
begin
sock = server.accept
begin
@@ -240,7 +242,7 @@ class IMAPTest < Test::Unit::TestCase
in_idle = false
exception_raised = false
c = m.new_cond
- Thread.start do
+ thw = Thread.start do
m.synchronize do
until in_idle
c.wait(0.1)
@@ -266,17 +268,18 @@ class IMAPTest < Test::Unit::TestCase
imap.logout
ensure
imap.disconnect if imap
+ thw.join
end
ensure
server.close
+ ths.join
end
end
def test_idle_done_not_during_idle
server = create_tcp_server
port = server.addr[1]
- requests = []
- Thread.start do
+ ths = Thread.start do
begin
sock = server.accept
begin
@@ -298,13 +301,14 @@ class IMAPTest < Test::Unit::TestCase
end
ensure
server.close
+ ths.join
end
end
def test_unexpected_bye
server = create_tcp_server
port = server.addr[1]
- Thread.start do
+ ths = Thread.start do
begin
sock = server.accept
begin
@@ -326,13 +330,14 @@ class IMAPTest < Test::Unit::TestCase
end
ensure
server.close
+ ths.join
end
end
def test_exception_during_shutdown
server = create_tcp_server
port = server.addr[1]
- Thread.start do
+ ths = Thread.start do
begin
sock = server.accept
begin
@@ -364,6 +369,7 @@ class IMAPTest < Test::Unit::TestCase
end
ensure
server.close
+ ths.join
end
end
@@ -372,7 +378,7 @@ class IMAPTest < Test::Unit::TestCase
port = server.addr[1]
requests = []
sock = nil
- Thread.start do
+ ths = Thread.start do
begin
sock = server.accept
sock.print("* OK test server\r\n")
@@ -384,12 +390,11 @@ class IMAPTest < Test::Unit::TestCase
begin
imap = Net::IMAP.new(SERVER_ADDR, :port => port)
begin
- th = Thread.current
m = Monitor.new
in_idle = false
exception_raised = false
c = m.new_cond
- Thread.start do
+ thw = Thread.start do
m.synchronize do
until in_idle
c.wait(0.1)
@@ -413,19 +418,21 @@ class IMAPTest < Test::Unit::TestCase
assert_equal("RUBY0001 IDLE\r\n", requests[0])
ensure
imap.disconnect if imap
+ thw.join
end
ensure
server.close
if sock && !sock.closed?
sock.close
end
+ ths.join
end
end
def test_connection_closed_without_greeting
server = create_tcp_server
port = server.addr[1]
- Thread.start do
+ ths = Thread.start do
begin
sock = server.accept
sock.close
@@ -438,6 +445,7 @@ class IMAPTest < Test::Unit::TestCase
end
ensure
server.close
+ ths.join
end
end
@@ -463,7 +471,7 @@ class IMAPTest < Test::Unit::TestCase
OpenSSL::X509::Certificate.new(f)
}
ssl_server = OpenSSL::SSL::SSLServer.new(server, ctx)
- Thread.start do
+ ths = Thread.start do
begin
sock = ssl_server.accept
begin
@@ -486,28 +494,30 @@ class IMAPTest < Test::Unit::TestCase
end
ensure
ssl_server.close
+ ths.join
end
end
def starttls_test
server = create_tcp_server
port = server.addr[1]
- Thread.start do
+ ths = Thread.start do
begin
sock = server.accept
- sock.print("* OK test server\r\n")
- sock.gets
- sock.print("RUBY0001 OK completed\r\n")
- ctx = OpenSSL::SSL::SSLContext.new
- ctx.ca_file = CA_FILE
- ctx.key = File.open(SERVER_KEY) { |f|
- OpenSSL::PKey::RSA.new(f)
- }
- ctx.cert = File.open(SERVER_CERT) { |f|
- OpenSSL::X509::Certificate.new(f)
- }
- sock = OpenSSL::SSL::SSLSocket.new(sock, ctx)
begin
+ sock.print("* OK test server\r\n")
+ sock.gets
+ sock.print("RUBY0001 OK completed\r\n")
+ ctx = OpenSSL::SSL::SSLContext.new
+ ctx.ca_file = CA_FILE
+ ctx.key = File.open(SERVER_KEY) { |f|
+ OpenSSL::PKey::RSA.new(f)
+ }
+ ctx.cert = File.open(SERVER_CERT) { |f|
+ OpenSSL::X509::Certificate.new(f)
+ }
+ sock = OpenSSL::SSL::SSLSocket.new(sock, ctx)
+ sock.sync_close = true
sock.accept
sock.gets
sock.print("* BYE terminating connection\r\n")
@@ -527,6 +537,7 @@ class IMAPTest < Test::Unit::TestCase
end
ensure
server.close
+ ths.join
end
end
diff --git a/test/net/imap/test_imap_response_parser.rb b/test/net/imap/test_imap_response_parser.rb
index 28a80fdd49..d23e3934cb 100644
--- a/test/net/imap/test_imap_response_parser.rb
+++ b/test/net/imap/test_imap_response_parser.rb
@@ -111,16 +111,12 @@ EOF
* 1 FETCH (UID 92285 )
EOF
assert_equal 92285, response.data.attr["UID"]
-
- response = parser.parse(<<EOF.gsub(/\n/, "\r\n").taint)
-* 1 FETCH (UID 92285 )
-EOF
end
def test_msg_att_parse_error
parser = Net::IMAP::ResponseParser.new
e = assert_raise(Net::IMAP::ResponseParseError) {
- response = parser.parse(<<EOF.gsub(/\n/, "\r\n").taint)
+ parser.parse(<<EOF.gsub(/\n/, "\r\n").taint)
* 123 FETCH (UNKNOWN 92285)
EOF
}
@@ -181,6 +177,49 @@ EOF
EOF
end
+ # [Bug #8167]
+ def test_msg_delivery_status_with_extra_data
+ parser = Net::IMAP::ResponseParser.new
+ response = parser.parse(<<EOF.gsub(/\n/, "\r\n").taint)
+* 29021 FETCH (RFC822.SIZE 3162 UID 113622 RFC822.HEADER {1155}
+Return-path: <>
+Envelope-to: info@xxxxxxxx.si
+Delivery-date: Tue, 26 Mar 2013 12:42:58 +0100
+Received: from mail by xxxx.xxxxxxxxxxx.net with spam-scanned (Exim 4.76)
+ id 1UKSHI-000Cwl-AR
+ for info@xxxxxxxx.si; Tue, 26 Mar 2013 12:42:58 +0100
+X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on xxxx.xxxxxxxxxxx.net
+X-Spam-Level: **
+X-Spam-Status: No, score=2.1 required=7.0 tests=DKIM_ADSP_NXDOMAIN,RDNS_NONE
+ autolearn=no version=3.3.1
+Received: from [xx.xxx.xxx.xx] (port=56890 helo=xxxxxx.localdomain)
+ by xxxx.xxxxxxxxxxx.net with esmtp (Exim 4.76)
+ id 1UKSHI-000Cwi-9j
+ for info@xxxxxxxx.si; Tue, 26 Mar 2013 12:42:56 +0100
+Received: by xxxxxx.localdomain (Postfix)
+ id 72725BEA64A; Tue, 26 Mar 2013 12:42:55 +0100 (CET)
+Date: Tue, 26 Mar 2013 12:42:55 +0100 (CET)
+From: MAILER-DAEMON@xxxxxx.localdomain (Mail Delivery System)
+Subject: Undelivered Mail Returned to Sender
+To: info@xxxxxxxx.si
+Auto-Submitted: auto-replied
+MIME-Version: 1.0
+Content-Type: multipart/report; report-type=delivery-status;
+ boundary="27797BEA649.1364298175/xxxxxx.localdomain"
+Message-Id: <20130326114255.72725BEA64A@xxxxxx.localdomain>
+
+ BODYSTRUCTURE (("text" "plain" ("charset" "us-ascii") NIL "Notification" "7bit" 510 14 NIL NIL NIL NIL)("message" "delivery-status" NIL NIL "Delivery report" "7bit" 410 NIL NIL NIL NIL)("text" "rfc822-headers" ("charset" "us-ascii") NIL "Undelivered Message Headers" "7bit" 612 15 NIL NIL NIL NIL) "report" ("report-type" "delivery-status" "boundary" "27797BEA649.1364298175/xxxxxx.localdomain") NIL NIL NIL))
+EOF
+ delivery_status = response.data.attr["BODYSTRUCTURE"].parts[1]
+ assert_equal("MESSAGE", delivery_status.media_type)
+ assert_equal("DELIVERY-STATUS", delivery_status.subtype)
+ assert_equal(nil, delivery_status.param)
+ assert_equal(nil, delivery_status.content_id)
+ assert_equal("Delivery report", delivery_status.description)
+ assert_equal("7BIT", delivery_status.encoding)
+ assert_equal(410, delivery_status.size)
+ end
+
# [Bug #8281]
def test_acl
parser = Net::IMAP::ResponseParser.new
@@ -205,4 +244,28 @@ EOF
assert_equal("CAPABILITY", response.name)
assert_equal("AUTH=PLAIN", response.data.last)
end
+
+ def test_mixed_boundry
+ parser = Net::IMAP::ResponseParser.new
+ response = parser.parse("* 2688 FETCH (UID 179161 BODYSTRUCTURE (" \
+ "(\"TEXT\" \"PLAIN\" (\"CHARSET\" \"iso-8859-1\") NIL NIL \"QUOTED-PRINTABLE\" 200 4 NIL NIL NIL)" \
+ "(\"MESSAGE\" \"DELIVERY-STATUS\" NIL NIL NIL \"7BIT\" 318 NIL NIL NIL)" \
+ "(\"MESSAGE\" \"RFC822\" NIL NIL NIL \"7BIT\" 2177" \
+ " (\"Tue, 11 May 2010 18:28:16 -0400\" \"Re: Welcome letter\" (" \
+ "(\"David\" NIL \"info\" \"xxxxxxxx.si\")) " \
+ "((\"David\" NIL \"info\" \"xxxxxxxx.si\")) " \
+ "((\"David\" NIL \"info\" \"xxxxxxxx.si\")) " \
+ "((\"Doretha\" NIL \"doretha.info\" \"xxxxxxxx.si\")) " \
+ "NIL NIL " \
+ "\"<AC1D15E06EA82F47BDE18E851CC32F330717704E@localdomain>\" " \
+ "\"<AANLkTikKMev1I73L2E7XLjRs67IHrEkb23f7ZPmD4S_9@localdomain>\")" \
+ " (\"MIXED\" (\"BOUNDARY\" \"000e0cd29212e3e06a0486590ae2\") NIL NIL)" \
+ " 37 NIL NIL NIL)" \
+ " \"REPORT\" (\"BOUNDARY\" \"16DuG.4XbaNOvCi.9ggvq.8Ipnyp3\" \"REPORT-TYPE\" \"delivery-status\") NIL NIL))\r\n")
+ empty_part = response.data.attr['BODYSTRUCTURE'].parts[2]
+ assert_equal(empty_part.lines, 37)
+ assert_equal(empty_part.body.media_type, 'MULTIPART')
+ assert_equal(empty_part.body.subtype, 'MIXED')
+ assert_equal(empty_part.body.param['BOUNDARY'], '000e0cd29212e3e06a0486590ae2')
+ end
end
diff --git a/test/net/pop/test_pop.rb b/test/net/pop/test_pop.rb
index c8aa9a83a8..94c76ede53 100644
--- a/test/net/pop/test_pop.rb
+++ b/test/net/pop/test_pop.rb
@@ -57,7 +57,7 @@ class TestPOP < Test::Unit::TestCase
def test_apop_invalid_at
pop_test(@stamp_base.sub('@', '.')) do |pop|
assert_instance_of Net::APOP, pop
- e = assert_raise Net::POPAuthenticationError do
+ assert_raise Net::POPAuthenticationError do
pop.start(@ok_user, @users[@ok_user])
end
end
diff --git a/test/net/protocol/test_protocol.rb b/test/net/protocol/test_protocol.rb
index f6ee4941cf..4453422552 100644
--- a/test/net/protocol/test_protocol.rb
+++ b/test/net/protocol/test_protocol.rb
@@ -3,6 +3,15 @@ require "net/protocol"
require "stringio"
class TestProtocol < Test::Unit::TestCase
+ def test_should_properly_dot_stuff_period_with_no_endline
+ bug9627 = '[ruby-core:61441] [Bug #9627]'
+ sio = StringIO.new("")
+ imio = Net::InternetMessageIO.new(sio)
+ email = "To: bob@aol.com\nlook, a period with no endline\n."
+ imio.write_message(email)
+ assert_equal("To: bob@aol.com\r\nlook, a period with no endline\r\n..\r\n.\r\n", sio.string, bug9627)
+ end
+
def test_each_crlf_line
assert_output('', '') do
sio = StringIO.new("")
diff --git a/test/net/smtp/test_smtp.rb b/test/net/smtp/test_smtp.rb
index 8af6a37d53..748b20d65b 100644
--- a/test/net/smtp/test_smtp.rb
+++ b/test/net/smtp/test_smtp.rb
@@ -1,8 +1,39 @@
require 'net/smtp'
+require 'stringio'
require 'minitest/autorun'
module Net
class TestSMTP < MiniTest::Unit::TestCase
+ class FakeSocket
+ def initialize out = "250 OK\n"
+ @write_io = StringIO.new
+ @read_io = StringIO.new out
+ end
+
+ def writeline line
+ @write_io.write "#{line}\r\n"
+ end
+
+ def readline
+ line = @read_io.gets
+ raise 'ran out of input' unless line
+ line.chop
+ end
+ end
+
+ def test_critical
+ smtp = Net::SMTP.new 'localhost', 25
+
+ assert_raises RuntimeError do
+ smtp.send :critical do
+ raise 'fail on purpose'
+ end
+ end
+
+ assert_kind_of Net::SMTP::Response, smtp.send(:critical),
+ '[Bug #9125]'
+ end
+
def test_esmtp
smtp = Net::SMTP.new 'localhost', 25
assert smtp.esmtp
@@ -12,5 +43,12 @@ module Net
assert_equal 'omg', smtp.esmtp
assert_equal 'omg', smtp.esmtp?
end
+
+ def test_rset
+ smtp = Net::SMTP.new 'localhost', 25
+ smtp.instance_variable_set :@socket, FakeSocket.new
+
+ assert smtp.rset
+ end
end
end
diff --git a/test/objspace/test_objspace.rb b/test/objspace/test_objspace.rb
index 8a8d7ce8ea..8a5ed3400f 100644
--- a/test/objspace/test_objspace.rb
+++ b/test/objspace/test_objspace.rb
@@ -24,6 +24,14 @@ class TestObjSpace < Test::Unit::TestCase
ObjectSpace.memsize_of(//.match("")))
end
+ def test_memsize_of_root_shared_string
+ a = "hello" * 5
+ b = a.dup
+ c = nil
+ ObjectSpace.each_object(String) {|x| break c = x if x == a and x.frozen?}
+ assert_equal([0, 0, 26], [a, b, c].map {|x| ObjectSpace.memsize_of(x)})
+ end
+
def test_argf_memsize
size = ObjectSpace.memsize_of(ARGF)
assert_kind_of(Integer, size)
@@ -97,6 +105,18 @@ class TestObjSpace < Test::Unit::TestCase
eom
end
+ def test_reachable_objects_from_root
+ root_objects = ObjectSpace.reachable_objects_from_root
+
+ assert_operator(root_objects.size, :>, 0)
+
+ root_objects.each{|category, objects|
+ assert_kind_of(String, category)
+ assert_kind_of(Array, objects)
+ assert_operator(objects.size, :>, 0)
+ }
+ end
+
def test_reachable_objects_size
assert_separately %w[--disable-gem -robjspace], __FILE__, __LINE__, <<-'eom'
ObjectSpace.each_object{|o|
@@ -108,4 +128,152 @@ class TestObjSpace < Test::Unit::TestCase
}
eom
end
+
+ def test_trace_object_allocations
+ Class.name
+ o0 = Object.new
+ ObjectSpace.trace_object_allocations{
+ o1 = Object.new; line1 = __LINE__; c1 = GC.count
+ o2 = "xyzzy" ; line2 = __LINE__; c2 = GC.count
+ o3 = [1, 2] ; line3 = __LINE__; c3 = GC.count
+
+ assert_equal(nil, ObjectSpace.allocation_sourcefile(o0))
+ assert_equal(nil, ObjectSpace.allocation_sourceline(o0))
+ assert_equal(nil, ObjectSpace.allocation_generation(o0))
+
+ assert_equal(line1, ObjectSpace.allocation_sourceline(o1))
+ assert_equal(__FILE__, ObjectSpace.allocation_sourcefile(o1))
+ assert_equal(c1, ObjectSpace.allocation_generation(o1))
+ assert_equal(Class.name, ObjectSpace.allocation_class_path(o1))
+ assert_equal(:new, ObjectSpace.allocation_method_id(o1))
+
+ assert_equal(__FILE__, ObjectSpace.allocation_sourcefile(o2))
+ assert_equal(line2, ObjectSpace.allocation_sourceline(o2))
+ assert_equal(c2, ObjectSpace.allocation_generation(o2))
+ assert_equal(self.class.name, ObjectSpace.allocation_class_path(o2))
+ assert_equal(__method__, ObjectSpace.allocation_method_id(o2))
+
+ assert_equal(__FILE__, ObjectSpace.allocation_sourcefile(o3))
+ assert_equal(line3, ObjectSpace.allocation_sourceline(o3))
+ assert_equal(c3, ObjectSpace.allocation_generation(o3))
+ assert_equal(self.class.name, ObjectSpace.allocation_class_path(o3))
+ assert_equal(__method__, ObjectSpace.allocation_method_id(o3))
+ }
+ end
+
+ def test_trace_object_allocations_start_stop_clear
+ begin
+ ObjectSpace.trace_object_allocations_start
+ begin
+ ObjectSpace.trace_object_allocations_start
+ begin
+ ObjectSpace.trace_object_allocations_start
+ obj0 = Object.new
+ ensure
+ ObjectSpace.trace_object_allocations_stop
+ obj1 = Object.new
+ end
+ ensure
+ ObjectSpace.trace_object_allocations_stop
+ obj2 = Object.new
+ end
+ ensure
+ ObjectSpace.trace_object_allocations_stop
+ obj3 = Object.new
+ end
+
+ assert_equal(__FILE__, ObjectSpace.allocation_sourcefile(obj0))
+ assert_equal(__FILE__, ObjectSpace.allocation_sourcefile(obj1))
+ assert_equal(__FILE__, ObjectSpace.allocation_sourcefile(obj2))
+ assert_equal(nil , ObjectSpace.allocation_sourcefile(obj3)) # after tracing
+
+ ObjectSpace.trace_object_allocations_clear
+ assert_equal(nil, ObjectSpace.allocation_sourcefile(obj0))
+ assert_equal(nil, ObjectSpace.allocation_sourcefile(obj1))
+ assert_equal(nil, ObjectSpace.allocation_sourcefile(obj2))
+ assert_equal(nil, ObjectSpace.allocation_sourcefile(obj3))
+ end
+
+ def test_dump_flags
+ info = ObjectSpace.dump("foo".freeze)
+ assert_match /"wb_protected":true, "old":true, "long_lived":true, "marked":true/, info
+ assert_match /"fstring":true/, info
+ end
+
+ def test_dump_to_default
+ line = nil
+ info = nil
+ ObjectSpace.trace_object_allocations do
+ line = __LINE__ + 1
+ str = "hello world"
+ info = ObjectSpace.dump(str)
+ end
+ assert_dump_object(info, line)
+ end
+
+ def test_dump_to_io
+ line = nil
+ info = IO.pipe do |r, w|
+ th = Thread.start {r.read}
+ ObjectSpace.trace_object_allocations do
+ line = __LINE__ + 1
+ str = "hello world"
+ ObjectSpace.dump(str, output: w)
+ end
+ w.close
+ th.value
+ end
+ assert_dump_object(info, line)
+ end
+
+ def assert_dump_object(info, line)
+ loc = caller_locations(1, 1)[0]
+ assert_match /"type":"STRING"/, info
+ assert_match /"embedded":true, "bytesize":11, "value":"hello world", "encoding":"UTF-8"/, info
+ assert_match /"file":"#{Regexp.escape __FILE__}", "line":#{line}/, info
+ assert_match /"method":"#{loc.base_label}"/, info
+ end
+
+ def test_dump_all
+ entry = /"bytesize":11, "value":"TEST STRING", "encoding":"UTF-8", "file":"-", "line":4, "method":"dump_my_heap_please", "generation":/
+
+ assert_in_out_err(%w[-robjspace], <<-'end;') do |output, error|
+ def dump_my_heap_please
+ ObjectSpace.trace_object_allocations_start
+ GC.start
+ str = "TEST STRING".force_encoding("UTF-8")
+ ObjectSpace.dump_all(output: :stdout)
+ end
+
+ dump_my_heap_please
+ end;
+ assert_match(entry, output.grep(/TEST STRING/).join("\n"))
+ end
+
+ assert_in_out_err(%w[-robjspace], <<-'end;') do |(output), (error)|
+ def dump_my_heap_please
+ ObjectSpace.trace_object_allocations_start
+ GC.start
+ str = "TEST STRING".force_encoding("UTF-8")
+ ObjectSpace.dump_all().path
+ end
+
+ puts dump_my_heap_please
+ end;
+ skip if /is not supported/ =~ error
+ skip error unless output
+ assert_match(entry, File.readlines(output).grep(/TEST STRING/).join("\n"))
+ File.unlink(output)
+ end
+ end
+
+ def test_dump_uninitialized_file
+ assert_in_out_err(%[-robjspace], <<-RUBY) do |(output), (error)|
+ puts ObjectSpace.dump(File.allocate)
+ RUBY
+ assert_nil error
+ assert_match /"type":"FILE"/, output
+ assert_not_match /"fd":/, output
+ end
+ end
end
diff --git a/test/open-uri/test_open-uri.rb b/test/open-uri/test_open-uri.rb
index 740728e9e7..4073754bd7 100644
--- a/test/open-uri/test_open-uri.rb
+++ b/test/open-uri/test_open-uri.rb
@@ -24,13 +24,11 @@ class TestOpenURI < Test::Unit::TestCase
:Port => 0})
_, port, _, host = srv.listeners[0].addr
begin
- srv.start
+ th = srv.start
yield srv, dr, "http://#{host}:#{port}"
ensure
srv.shutdown
- until srv.status == :Stop
- sleep 0.1
- end
+ th.join
end
}
end
@@ -163,6 +161,29 @@ class TestOpenURI < Test::Unit::TestCase
}
end
+ def test_close_in_block_small
+ with_http {|srv, dr, url|
+ srv.mount_proc("/close200", lambda { |req, res| res.body = "close200" } )
+ assert_nothing_raised {
+ open("#{url}/close200") {|f|
+ f.close
+ }
+ }
+ }
+ end
+
+ def test_close_in_block_big
+ with_http {|srv, dr, url|
+ content = "close200big"*10240
+ srv.mount_proc("/close200big", lambda { |req, res| res.body = content } )
+ assert_nothing_raised {
+ open("#{url}/close200big") {|f|
+ f.close
+ }
+ }
+ }
+ end
+
def test_header
myheader1 = 'barrrr'
myheader2 = nil
@@ -202,7 +223,7 @@ class TestOpenURI < Test::Unit::TestCase
_, proxy_port, _, proxy_host = proxy.listeners[0].addr
proxy_url = "http://#{proxy_host}:#{proxy_port}/"
begin
- proxy.start
+ proxy_thread = proxy.start
srv.mount_proc("/proxy", lambda { |req, res| res.body = "proxy" } )
open("#{url}/proxy", :proxy=>proxy_url) {|f|
assert_equal("200", f.status[0])
@@ -233,6 +254,7 @@ class TestOpenURI < Test::Unit::TestCase
assert_equal("", log); log.clear
ensure
proxy.shutdown
+ proxy_thread.join
end
}
end
@@ -255,7 +277,7 @@ class TestOpenURI < Test::Unit::TestCase
_, proxy_port, _, proxy_host = proxy.listeners[0].addr
proxy_url = "http://#{proxy_host}:#{proxy_port}/"
begin
- proxy.start
+ th = proxy.start
srv.mount_proc("/proxy", lambda { |req, res| res.body = "proxy" } )
exc = assert_raise(OpenURI::HTTPError) { open("#{url}/proxy", :proxy=>proxy_url) {} }
assert_equal("407", exc.io.status[0])
@@ -273,6 +295,7 @@ class TestOpenURI < Test::Unit::TestCase
assert_equal("", log); log.clear
ensure
proxy.shutdown
+ th.join
end
}
end
@@ -378,9 +401,7 @@ class TestOpenURI < Test::Unit::TestCase
end
def test_userinfo
- if "1.9.0" <= RUBY_VERSION
- assert_raise(ArgumentError) { open("http://user:pass@127.0.0.1/") {} }
- end
+ assert_raise(ArgumentError) { open("http://user:pass@127.0.0.1/") {} }
end
def test_progress
@@ -502,6 +523,21 @@ class TestOpenURI < Test::Unit::TestCase
}
end if defined?(Zlib::GzipWriter)
+ def test_multiple_cookies
+ with_http {|srv, dr, url|
+ srv.mount_proc("/mcookie/") {|req, res|
+ res.cookies << "name1=value1; blabla"
+ res.cookies << "name2=value2; blabla"
+ res.body = "foo"
+ }
+ open("#{url}/mcookie/") {|f|
+ assert_equal("foo", f.read)
+ assert_equal(["name1=value1; blabla", "name2=value2; blabla"],
+ f.metas['set-cookie'].sort)
+ }
+ }
+ end
+
# 192.0.2.0/24 is TEST-NET. [RFC3330]
def test_ftp_invalid_request
@@ -510,7 +546,7 @@ class TestOpenURI < Test::Unit::TestCase
assert_raise(ArgumentError) { URI("ftp://127.0.0.1/a%0Ab").read }
assert_raise(ArgumentError) { URI("ftp://127.0.0.1/a%0Db/f").read }
assert_raise(ArgumentError) { URI("ftp://127.0.0.1/a%0Ab/f").read }
- assert_raise(URI::InvalidComponentError) { URI("ftp://127.0.0.1/d/f;type=x") }
+ assert_nothing_raised(URI::InvalidComponentError) { URI("ftp://127.0.0.1/d/f;type=x") }
end
def test_ftp
diff --git a/test/open-uri/test_ssl.rb b/test/open-uri/test_ssl.rb
index f3e1f48de7..f653cd77ec 100644
--- a/test/open-uri/test_ssl.rb
+++ b/test/open-uri/test_ssl.rb
@@ -5,6 +5,7 @@ require 'webrick'
begin
require 'openssl'
require 'webrick/https'
+ require_relative '../openssl/utils'
rescue LoadError
end
require 'webrick/httpproxy'
@@ -27,17 +28,16 @@ class TestOpenURISSL
:SSLEnable => true,
:SSLCertificate => OpenSSL::X509::Certificate.new(SERVER_CERT),
:SSLPrivateKey => OpenSSL::PKey::RSA.new(SERVER_KEY),
+ :SSLTmpDhCallback => proc { OpenSSL::TestUtils::TEST_KEY_DH1024 },
:BindAddress => '127.0.0.1',
:Port => 0})
_, port, _, host = srv.listeners[0].addr
begin
- srv.start
+ th = srv.start
yield srv, dr, "https://#{host}:#{port}"
ensure
srv.shutdown
- until srv.status == :Stop
- sleep 0.1
- end
+ th.join
end
}
end
@@ -85,7 +85,7 @@ class TestOpenURISSL
:Port => 0})
_, p_port, _, p_host = prxy.listeners[0].addr
begin
- prxy.start
+ th = prxy.start
srv.mount_proc("/proxy", lambda { |req, res| res.body = "proxy" } )
open("#{url}/proxy", :proxy=>"http://#{p_host}:#{p_port}/", :ssl_ca_cert => cacert_filename) {|f|
assert_equal("200", f.status[0])
@@ -101,9 +101,7 @@ class TestOpenURISSL
sio.truncate(0); sio.rewind
ensure
prxy.shutdown
- until prxy.status == :Stop
- sleep 0.1
- end
+ th.join
end
}
end
diff --git a/test/openssl/test_bn.rb b/test/openssl/test_bn.rb
index af1c72c8e9..27bbcdfeaf 100644
--- a/test/openssl/test_bn.rb
+++ b/test/openssl/test_bn.rb
@@ -3,13 +3,38 @@ require_relative 'utils'
if defined?(OpenSSL)
class OpenSSL::TestBN < Test::Unit::TestCase
- def test_bn_to_bn
- assert_equal(999.to_bn, OpenSSL::BN.new(999.to_bn))
+ def test_new_str
+ e1 = OpenSSL::BN.new(999.to_s(16), 16) # OpenSSL::BN.new(str, 16) must be most stable
+ e2 = OpenSSL::BN.new((2**107-1).to_s(16), 16)
+ assert_equal(e1, OpenSSL::BN.new("999"))
+ assert_equal(e2, OpenSSL::BN.new((2**107-1).to_s))
+ assert_equal(e1, OpenSSL::BN.new("999", 10))
+ assert_equal(e2, OpenSSL::BN.new((2**107-1).to_s, 10))
+ assert_equal(e1, OpenSSL::BN.new("\x03\xE7", 2))
+ assert_equal(e2, OpenSSL::BN.new("\a\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF", 2))
+ assert_equal(e1, OpenSSL::BN.new("\x00\x00\x00\x02\x03\xE7", 0))
+ assert_equal(e2, OpenSSL::BN.new("\x00\x00\x00\x0E\a\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF", 0))
end
- def test_integer_to_bn
- assert_equal(999.to_bn, OpenSSL::BN.new(999.to_s(16), 16))
- assert_equal((2 ** 107 - 1).to_bn, OpenSSL::BN.new((2 ** 107 - 1).to_s(16), 16))
+ def test_new_bn
+ e1 = OpenSSL::BN.new(999.to_s(16), 16)
+ e2 = OpenSSL::BN.new((2**107-1).to_s(16), 16)
+ assert_equal(e1, OpenSSL::BN.new(e1))
+ assert_equal(e2, OpenSSL::BN.new(e2))
+ end
+
+ def test_new_integer
+ assert_equal(999.to_bn, OpenSSL::BN.new(999))
+ assert_equal((2 ** 107 - 1).to_bn, OpenSSL::BN.new(2 ** 107 - 1))
+ assert_equal(-999.to_bn, OpenSSL::BN.new(-999))
+ assert_equal((-(2 ** 107 - 1)).to_bn, OpenSSL::BN.new(-(2 ** 107 - 1)))
+ end
+
+ def test_to_bn
+ e1 = OpenSSL::BN.new(999.to_s(16), 16)
+ e2 = OpenSSL::BN.new((2**107-1).to_s(16), 16)
+ assert_equal(e1, 999.to_bn)
+ assert_equal(e2, (2**107-1).to_bn)
end
def test_prime_p
diff --git a/test/openssl/test_cipher.rb b/test/openssl/test_cipher.rb
index 15cfb7b302..156fa2a9c9 100644
--- a/test/openssl/test_cipher.rb
+++ b/test/openssl/test_cipher.rb
@@ -133,7 +133,7 @@ class OpenSSL::TestCipher < Test::Unit::TestCase
end
end
- if has_ciphers?(['aes-128-gcm', 'aes-192-gcm', 'aes-128-gcm'])
+ if has_ciphers?(['aes-128-gcm', 'aes-192-gcm', 'aes-256-gcm'])
def test_authenticated
cipher = OpenSSL::Cipher.new('aes-128-gcm')
@@ -143,7 +143,7 @@ class OpenSSL::TestCipher < Test::Unit::TestCase
end
def test_aes_gcm
- ['aes-128-gcm', 'aes-192-gcm', 'aes-128-gcm'].each do |algo|
+ ['aes-128-gcm', 'aes-192-gcm', 'aes-256-gcm'].each do |algo|
pt = "You should all use Authenticated Encryption!"
cipher, key, iv = new_encryptor(algo)
@@ -161,7 +161,7 @@ class OpenSSL::TestCipher < Test::Unit::TestCase
end
def test_aes_gcm_short_tag
- ['aes-128-gcm', 'aes-192-gcm', 'aes-128-gcm'].each do |algo|
+ ['aes-128-gcm', 'aes-192-gcm', 'aes-256-gcm'].each do |algo|
pt = "You should all use Authenticated Encryption!"
cipher, key, iv = new_encryptor(algo)
@@ -187,7 +187,8 @@ class OpenSSL::TestCipher < Test::Unit::TestCase
tag = cipher.auth_tag
decipher = new_decryptor('aes-128-gcm', key, iv)
- decipher.auth_tag = tag[0..-2] << tag[-1].succ
+ tag.setbyte(-1, (tag.getbyte(-1) + 1) & 0xff)
+ decipher.auth_tag = tag
decipher.auth_data = "aad"
assert_raise OpenSSL::Cipher::CipherError do
diff --git a/test/openssl/test_config.rb b/test/openssl/test_config.rb
index 88bb5af7be..4ad90c43f5 100644
--- a/test/openssl/test_config.rb
+++ b/test/openssl/test_config.rb
@@ -17,7 +17,7 @@ __EOD__
end
def teardown
- @tmpfile.unlink
+ @tmpfile.close!
end
def test_constants
@@ -121,13 +121,12 @@ __EOC__
assert_equal("", c.to_s)
assert_equal([], c.sections)
#
- file = Tempfile.open("openssl.cnf")
- file.close
- c = OpenSSL::Config.load(file.path)
- assert_equal("[ default ]\n\n", c.to_s)
- assert_equal(['default'], c.sections)
- ensure
- file.unlink if file
+ Tempfile.create("openssl.cnf") {|file|
+ file.close
+ c = OpenSSL::Config.load(file.path)
+ assert_equal("[ default ]\n\n", c.to_s)
+ assert_equal(['default'], c.sections)
+ }
end
def test_initialize
@@ -137,13 +136,12 @@ __EOC__
end
def test_initialize_with_empty_file
- file = Tempfile.open("openssl.cnf")
- file.close
- c = OpenSSL::Config.new(file.path)
- assert_equal("[ default ]\n\n", c.to_s)
- assert_equal(['default'], c.sections)
- ensure
- file.unlink if file
+ Tempfile.create("openssl.cnf") {|file|
+ file.close
+ c = OpenSSL::Config.new(file.path)
+ assert_equal("[ default ]\n\n", c.to_s)
+ assert_equal(['default'], c.sections)
+ }
end
def test_initialize_with_example_file
diff --git a/test/openssl/test_digest.rb b/test/openssl/test_digest.rb
index 86c30d973c..c2a3f70566 100644
--- a/test/openssl/test_digest.rb
+++ b/test/openssl/test_digest.rb
@@ -4,7 +4,7 @@ if defined?(OpenSSL)
class OpenSSL::TestDigest < Test::Unit::TestCase
def setup
- @d1 = OpenSSL::Digest::Digest::new("MD5")
+ @d1 = OpenSSL::Digest.new("MD5")
@d2 = OpenSSL::Digest::MD5.new
@md = Digest::MD5.new
@data = "DATA"
diff --git a/test/openssl/test_hmac.rb b/test/openssl/test_hmac.rb
index ba158d2b51..f1e45365d9 100644
--- a/test/openssl/test_hmac.rb
+++ b/test/openssl/test_hmac.rb
@@ -1,3 +1,5 @@
+# coding: UTF-8
+
require_relative 'utils'
class OpenSSL::TestHMAC < Test::Unit::TestCase
@@ -29,4 +31,11 @@ class OpenSSL::TestHMAC < Test::Unit::TestCase
h = @h1.dup
assert_equal(@h1.digest, h.digest, "dup digest")
end
+
+ def test_binary_update
+ data = "Lücíllé: Bût... yøü sáîd hé wås âlrîght.\nDr. Físhmån: Yés. Hé's løst hîs léft hånd, sø hé's gøîng tø bé åll rîght"
+ hmac = OpenSSL::HMAC.new("qShkcwN92rsM9nHfdnP4ugcVU2iI7iM/trovs01ZWok", "SHA256")
+ result = hmac.update(data).hexdigest
+ assert_equal "a13984b929a07912e4e21c5720876a8e150d6f67f854437206e7f86547248396", result
+ end
end if defined?(OpenSSL)
diff --git a/test/openssl/test_pair.rb b/test/openssl/test_pair.rb
index 12af6aeff5..b9206daea9 100644
--- a/test/openssl/test_pair.rb
+++ b/test/openssl/test_pair.rb
@@ -5,14 +5,14 @@ if defined?(OpenSSL)
require 'socket'
require_relative '../ruby/ut_eof'
-module SSLPair
+module OpenSSL::SSLPairM
def server
host = "127.0.0.1"
port = 0
ctx = OpenSSL::SSL::SSLContext.new()
ctx.ciphers = "ADH"
ctx.tmp_dh_callback = proc { OpenSSL::TestUtils::TEST_KEY_DH1024 }
- tcps = TCPServer.new(host, port)
+ tcps = create_tcp_server(host, port)
ssls = OpenSSL::SSL::SSLServer.new(tcps, ctx)
return ssls
end
@@ -21,7 +21,7 @@ module SSLPair
host = "127.0.0.1"
ctx = OpenSSL::SSL::SSLContext.new()
ctx.ciphers = "ADH"
- s = TCPSocket.new(host, port)
+ s = create_tcp_client(host, port)
ssl = OpenSSL::SSL::SSLSocket.new(s, ctx)
ssl.connect
ssl.sync_close = true
@@ -35,7 +35,7 @@ module SSLPair
ssls.close
ns
}
- port = ssls.to_io.addr[1]
+ port = ssls.to_io.local_address.ip_port
c = client(port)
s = th.value
if block_given?
@@ -56,31 +56,53 @@ module SSLPair
end
end
-class OpenSSL::TestEOF1 < Test::Unit::TestCase
- include TestEOF
- include SSLPair
+module OpenSSL::SSLPair
+ include OpenSSL::SSLPairM
+
+ def create_tcp_server(host, port)
+ TCPServer.new(host, port)
+ end
+
+ def create_tcp_client(host, port)
+ TCPSocket.new(host, port)
+ end
+end
+
+module OpenSSL::SSLPairLowlevelSocket
+ include OpenSSL::SSLPairM
+
+ def create_tcp_server(host, port)
+ Addrinfo.tcp(host, port).listen
+ end
+
+ def create_tcp_client(host, port)
+ Addrinfo.tcp(host, port).connect
+ end
+end
+module OpenSSL::TestEOF1M
def open_file(content)
s1, s2 = ssl_pair
- Thread.new { s2 << content; s2.close }
+ th = Thread.new { s2 << content; s2.close }
yield s1
+ ensure
+ th.join
+ s1.close
end
end
-class OpenSSL::TestEOF2 < Test::Unit::TestCase
- include TestEOF
- include SSLPair
-
+module OpenSSL::TestEOF2M
def open_file(content)
s1, s2 = ssl_pair
- Thread.new { s1 << content; s1.close }
+ th = Thread.new { s1 << content; s1.close }
yield s2
+ ensure
+ th.join
+ s2.close
end
end
-class OpenSSL::TestPair < Test::Unit::TestCase
- include SSLPair
-
+module OpenSSL::TestPairM
def test_getc
ssl_pair {|s1, s2|
s1 << "a"
@@ -92,9 +114,13 @@ class OpenSSL::TestPair < Test::Unit::TestCase
ssl_pair {|s1, s2|
s2.write "a\nbcd"
assert_equal("a\n", s1.gets)
- assert_equal("bcd", s1.readpartial(10))
+ result = ""
+ result << s1.readpartial(10) until result.length == 3
+ assert_equal("bcd", result)
s2.write "efg"
- assert_equal("efg", s1.readpartial(10))
+ result = ""
+ result << s1.readpartial(10) until result.length == 3
+ assert_equal("efg", result)
s2.close
assert_raise(EOFError) { s1.readpartial(10) }
assert_raise(EOFError) { s1.readpartial(10) }
@@ -141,7 +167,7 @@ class OpenSSL::TestPair < Test::Unit::TestCase
def test_read_nonblock
ssl_pair {|s1, s2|
err = nil
- assert_raise(OpenSSL::SSL::SSLError) {
+ assert_raise(OpenSSL::SSL::SSLErrorWaitReadable) {
begin
s2.read_nonblock(10)
ensure
@@ -156,19 +182,48 @@ class OpenSSL::TestPair < Test::Unit::TestCase
ret = nil
assert_nothing_raised("[ruby-core:20298]") { ret = s2.read_nonblock(10) }
assert_equal("def\n", ret)
+ s1.close
+ sleep 0.1
+ assert_raise(EOFError) { s2.read_nonblock(10) }
+ }
+ end
+
+ def test_read_nonblock_no_exception
+ ssl_pair {|s1, s2|
+ assert_equal :wait_readable, s2.read_nonblock(10, exception: false)
+ s1.write "abc\ndef\n"
+ IO.select([s2])
+ assert_equal("ab", s2.read_nonblock(2, exception: false))
+ assert_equal("c\n", s2.gets)
+ ret = nil
+ assert_nothing_raised("[ruby-core:20298]") { ret = s2.read_nonblock(10, exception: false) }
+ assert_equal("def\n", ret)
+ s1.close
+ sleep 0.1
+ assert_equal(nil, s2.read_nonblock(10, exception: false))
}
end
+ def write_nonblock(socket, meth, str)
+ ret = socket.send(meth, str)
+ ret.is_a?(Symbol) ? 0 : ret
+ end
+
+ def write_nonblock_no_ex(socket, str)
+ ret = socket.write_nonblock str, exception: false
+ ret.is_a?(Symbol) ? 0 : ret
+ end
+
def test_write_nonblock
ssl_pair {|s1, s2|
n = 0
begin
- n += s1.write_nonblock("a" * 100000)
- n += s1.write_nonblock("b" * 100000)
- n += s1.write_nonblock("c" * 100000)
- n += s1.write_nonblock("d" * 100000)
- n += s1.write_nonblock("e" * 100000)
- n += s1.write_nonblock("f" * 100000)
+ n += write_nonblock s1, :write_nonblock, "a" * 100000
+ n += write_nonblock s1, :write_nonblock, "b" * 100000
+ n += write_nonblock s1, :write_nonblock, "c" * 100000
+ n += write_nonblock s1, :write_nonblock, "d" * 100000
+ n += write_nonblock s1, :write_nonblock, "e" * 100000
+ n += write_nonblock s1, :write_nonblock, "f" * 100000
rescue IO::WaitWritable
end
s1.close
@@ -176,6 +231,26 @@ class OpenSSL::TestPair < Test::Unit::TestCase
}
end
+ def test_write_nonblock_no_exceptions
+ ssl_pair {|s1, s2|
+ n = 0
+ begin
+ n += write_nonblock_no_ex s1, "a" * 100000
+ n += write_nonblock_no_ex s1, "b" * 100000
+ n += write_nonblock_no_ex s1, "c" * 100000
+ n += write_nonblock_no_ex s1, "d" * 100000
+ n += write_nonblock_no_ex s1, "e" * 100000
+ n += write_nonblock_no_ex s1, "f" * 100000
+ rescue OpenSSL::SSL::SSLError => e
+ # on some platforms (maybe depend on OpenSSL version), writing to
+ # SSLSocket after SSL_ERROR_WANT_WRITE causes this error.
+ raise e if n == 0
+ end
+ s1.close
+ assert_equal(n, s2.read.length)
+ }
+ end
+
def test_write_nonblock_with_buffered_data
ssl_pair {|s1, s2|
s1.write "foo"
@@ -186,19 +261,34 @@ class OpenSSL::TestPair < Test::Unit::TestCase
}
end
- def test_connect_accept_nonblock
- host = "127.0.0.1"
- port = 0
- ctx = OpenSSL::SSL::SSLContext.new()
- ctx.ciphers = "ADH"
- ctx.tmp_dh_callback = proc { OpenSSL::TestUtils::TEST_KEY_DH1024 }
- serv = TCPServer.new(host, port)
+ def test_write_nonblock_with_buffered_data_no_exceptions
+ ssl_pair {|s1, s2|
+ s1.write "foo"
+ s1.write_nonblock("bar", exception: false)
+ s1.write "baz"
+ s1.close
+ assert_equal("foobarbaz", s2.read)
+ }
+ end
+ def tcp_pair
+ host = "127.0.0.1"
+ serv = TCPServer.new(host, 0)
port = serv.connect_address.ip_port
-
sock1 = TCPSocket.new(host, port)
sock2 = serv.accept
serv.close
+ [sock1, sock2]
+ ensure
+ serv.close if serv && !serv.closed?
+ end
+
+ def test_connect_accept_nonblock
+ ctx = OpenSSL::SSL::SSLContext.new()
+ ctx.ciphers = "ADH"
+ ctx.tmp_dh_callback = proc { OpenSSL::TestUtils::TEST_KEY_DH1024 }
+
+ sock1, sock2 = tcp_pair
th = Thread.new {
s2 = OpenSSL::SSL::SSLSocket.new(sock2, ctx)
@@ -237,13 +327,46 @@ class OpenSSL::TestPair < Test::Unit::TestCase
s1.print "a\ndef"
assert_equal("a\n", s2.gets)
ensure
+ th.join
s1.close if s1 && !s1.closed?
s2.close if s2 && !s2.closed?
- serv.close if serv && !serv.closed?
sock1.close if sock1 && !sock1.closed?
sock2.close if sock2 && !sock2.closed?
end
+end
+
+class OpenSSL::TestEOF1 < Test::Unit::TestCase
+ include TestEOF
+ include OpenSSL::SSLPair
+ include OpenSSL::TestEOF1M
+end
+
+class OpenSSL::TestEOF1LowlevelSocket < Test::Unit::TestCase
+ include TestEOF
+ include OpenSSL::SSLPairLowlevelSocket
+ include OpenSSL::TestEOF1M
+end
+
+class OpenSSL::TestEOF2 < Test::Unit::TestCase
+ include TestEOF
+ include OpenSSL::SSLPair
+ include OpenSSL::TestEOF2M
+end
+
+class OpenSSL::TestEOF2LowlevelSocket < Test::Unit::TestCase
+ include TestEOF
+ include OpenSSL::SSLPairLowlevelSocket
+ include OpenSSL::TestEOF2M
+end
+
+class OpenSSL::TestPair < Test::Unit::TestCase
+ include OpenSSL::SSLPair
+ include OpenSSL::TestPairM
+end
+class OpenSSL::TestPairLowlevelSocket < Test::Unit::TestCase
+ include OpenSSL::SSLPairLowlevelSocket
+ include OpenSSL::TestPairM
end
end
diff --git a/test/openssl/test_partial_record_read.rb b/test/openssl/test_partial_record_read.rb
new file mode 100644
index 0000000000..f3d83c6973
--- /dev/null
+++ b/test/openssl/test_partial_record_read.rb
@@ -0,0 +1,36 @@
+require_relative "utils"
+
+if defined?(OpenSSL)
+
+ class OpenSSL::TestPartialRecordRead < OpenSSL::SSLTestCase
+ def test_partial_tls_record_read_nonblock
+ port = 12345
+
+ start_server(port, OpenSSL::SSL::VERIFY_NONE, true, :server_proc =>
+ Proc.new do |server_ctx, server_ssl|
+ begin
+ server_ssl.io.write("\x01") # the beginning of a TLS record
+ sleep 6 # do not finish prematurely before the read by the client is attempted
+ ensure
+ server_ssl.close
+ end
+ end
+ ) do |server, port|
+ sock = TCPSocket.new("127.0.0.1", port)
+ ssl = OpenSSL::SSL::SSLSocket.new(sock)
+ ssl.sync_close = true
+ begin
+ ssl.connect
+ sleep 3 # wait is required for the (incomplete) TLS record to arrive at the client socket
+
+ # Should raise a IO::WaitReadable since a full TLS record is not available for reading.
+ assert_raise(IO::WaitReadable) { ssl.read_nonblock(1) }
+ ensure
+ ssl.close
+ end
+ end
+ end
+
+ end
+
+end
diff --git a/test/openssl/test_pkcs7.rb b/test/openssl/test_pkcs7.rb
index 4a6692a74c..a1ff04851a 100644
--- a/test/openssl/test_pkcs7.rb
+++ b/test/openssl/test_pkcs7.rb
@@ -151,6 +151,147 @@ class OpenSSL::TestPKCS7 < Test::Unit::TestCase
contents = File.read(__FILE__)
assert_raise(ArgumentError) { OpenSSL::PKCS7.new(contents) }
end
+
+ def test_set_type_signed
+ p7 = OpenSSL::PKCS7.new
+ p7.type = "signed"
+ assert_equal(:signed, p7.type)
+ end
+
+ def test_set_type_data
+ p7 = OpenSSL::PKCS7.new
+ p7.type = "data"
+ assert_equal(:data, p7.type)
+ end
+
+ def test_set_type_signed_and_enveloped
+ p7 = OpenSSL::PKCS7.new
+ p7.type = "signedAndEnveloped"
+ assert_equal(:signedAndEnveloped, p7.type)
+ end
+
+ def test_set_type_enveloped
+ p7 = OpenSSL::PKCS7.new
+ p7.type = "enveloped"
+ assert_equal(:enveloped, p7.type)
+ end
+
+ def test_set_type_encrypted
+ p7 = OpenSSL::PKCS7.new
+ p7.type = "encrypted"
+ assert_equal(:encrypted, p7.type)
+ end
+
+ def test_degenerate_pkcs7
+ ca_cert_pem = <<END
+-----BEGIN CERTIFICATE-----
+MIID4DCCAsigAwIBAgIJAL1oVI72wmQwMA0GCSqGSIb3DQEBBQUAMFMxCzAJBgNV
+BAYTAkFVMQ4wDAYDVQQIEwVTdGF0ZTENMAsGA1UEBxMEQ2l0eTEQMA4GA1UEChMH
+RXhhbXBsZTETMBEGA1UEAxMKRXhhbXBsZSBDQTAeFw0xMjEwMTgwOTE2NTBaFw0y
+MjEwMTYwOTE2NTBaMFMxCzAJBgNVBAYTAkFVMQ4wDAYDVQQIEwVTdGF0ZTENMAsG
+A1UEBxMEQ2l0eTEQMA4GA1UEChMHRXhhbXBsZTETMBEGA1UEAxMKRXhhbXBsZSBD
+QTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMTSPNxOkd5NN19XO0fJ
+tGVlWN4DWuvVL9WbWnXJXX9rU6X8sSOL9RrRA64eEZf2UBFjz9fMHZj/OGcxZpus
+4YtzfSrMU6xfvsIHeqX+mT60ms2RfX4UXab50MQArBin3JVKHGnOi25uyAOylVFU
+TuzzQJvKyB67vjuRPMlVAgVAZAP07ru9gW0ajt/ODxvUfvXxp5SFF68mVP2ipMBr
+4fujUwQC6cVHmnuL6p87VFoo9uk87TSQVDOQGL8MK4moMFtEW9oUTU22CgnxnCsS
+sCCELYhy9BdaTWQH26LzMfhnwSuIRHZyprW4WZtU0akrYXNiCj8o92rZmQWXJDbl
+qNECAwEAAaOBtjCBszAdBgNVHQ4EFgQUNtVw4jvkZZbkdQbkYi2/F4QN79owgYMG
+A1UdIwR8MHqAFDbVcOI75GWW5HUG5GItvxeEDe/aoVekVTBTMQswCQYDVQQGEwJB
+VTEOMAwGA1UECBMFU3RhdGUxDTALBgNVBAcTBENpdHkxEDAOBgNVBAoTB0V4YW1w
+bGUxEzARBgNVBAMTCkV4YW1wbGUgQ0GCCQC9aFSO9sJkMDAMBgNVHRMEBTADAQH/
+MA0GCSqGSIb3DQEBBQUAA4IBAQBvJIsY9bIqliZ3WD1KoN4cvAQeRAPsoLXQkkHg
+P6Nrcw9rJ5JvoHfYbo5aNlwbnkbt/B2xlVEXUYpJoBZFXafgxG2gJleioIgnaDS4
+FPPwZf1C5ZrOgUBfxTGjHex4ghSAoNGOd35jQzin5NGKOvZclPjZ2vQ++LP3aA2l
+9Fn2qASS46IzMGJlC75mlTOTQwDM16UunMAK26lNG9J6q02o4d/oU2a7x0fD80yF
+64kNA1wDAwaVCYiUH541qKp+b4iDqer8nf8HqzYDFlpje18xYZMEd1hj8dVOharM
+pISJ+D52hV/BGEYF8r5k3hpC5d76gSP2oCcaY0XvLBf97qik
+-----END CERTIFICATE-----
+END
+ p7 = OpenSSL::PKCS7.new
+ p7.type = "signed"
+ ca_cert = OpenSSL::X509::Certificate.new(ca_cert_pem)
+ p7.add_certificate ca_cert
+ p7.add_data ""
+
+ assert_nothing_raised do
+ p7.to_pem
+ end
+ end
+
+ def test_split_content
+ pki_message_pem = <<END
+-----BEGIN PKCS7-----
+MIIHSwYJKoZIhvcNAQcCoIIHPDCCBzgCAQExCzAJBgUrDgMCGgUAMIIDiAYJKoZI
+hvcNAQcBoIIDeQSCA3UwgAYJKoZIhvcNAQcDoIAwgAIBADGCARAwggEMAgEAMHUw
+cDEQMA4GA1UECgwHZXhhbXBsZTEXMBUGA1UEAwwOVEFSTUFDIFJPT1QgQ0ExIjAg
+BgkqhkiG9w0BCQEWE3NvbWVvbmVAZXhhbXBsZS5vcmcxCzAJBgNVBAYTAlVTMRIw
+EAYDVQQHDAlUb3duIEhhbGwCAWYwDQYJKoZIhvcNAQEBBQAEgYBspXXse8ZhG1FE
+E3PVAulbvrdR52FWPkpeLvSjgEkYzTiUi0CC3poUL1Ku5mOlavWAJgoJpFICDbvc
+N4ZNDCwOhnzoI9fMGmm1gvPQy15BdhhZRo9lP7Ga/Hg2APKT0/0yhPsmJ+w+u1e7
+OoJEVeEZ27x3+u745bGEcu8of5th6TCABgkqhkiG9w0BBwEwFAYIKoZIhvcNAwcE
+CBNs2U5mMsd/oIAEggIQU6cur8QBz02/4eMpHdlU9IkyrRMiaMZ/ky9zecOAjnvY
+d2jZqS7RhczpaNJaSli3GmDsKrF+XqE9J58s9ScGqUigzapusTsxIoRUPr7Ztb0a
+pg8VWDipAsuw7GfEkgx868sV93uC4v6Isfjbhd+JRTFp/wR1kTi7YgSXhES+RLUW
+gQbDIDgEQYxJ5U951AJtnSpjs9za2ZkTdd8RSEizJK0bQ1vqLoApwAVgZqluATqQ
+AHSDCxhweVYw6+y90B9xOrqPC0eU7Wzryq2+Raq5ND2Wlf5/N11RQ3EQdKq/l5Te
+ijp9PdWPlkUhWVoDlOFkysjk+BE+7AkzgYvz9UvBjmZsMsWqf+KsZ4S8/30ndLzu
+iucsu6eOnFLLX8DKZxV6nYffZOPzZZL8hFBcE7PPgSdBEkazMrEBXq1j5mN7exbJ
+NOA5uGWyJNBMOCe+1JbxG9UeoqvCCTHESxEeDu7xR3NnSOD47n7cXwHr81YzK2zQ
+5oWpP3C8jzI7tUjLd1S0Z3Psd17oaCn+JOfUtuB0nc3wfPF/WPo0xZQodWxp2/Cl
+EltR6qr1zf5C7GwmLzBZ6bHFAIT60/JzV0/56Pn8ztsRFtI4cwaBfTfvnwi8/sD9
+/LYOMY+/b6UDCUSR7RTN7XfrtAqDEzSdzdJkOWm1jvM8gkLmxpZdvxG3ZvDYnEQE
+5Nq+un5nAny1wf3rWierBAjE5ntiAmgs5AAAAAAAAAAAAACgggHqMIIB5jCCAU+g
+AwIBAgIBATANBgkqhkiG9w0BAQUFADAvMS0wKwYDVQQDEyQwQUM5RjAyNi1EQ0VB
+LTRDMTItOTEyNy1DMEZEN0QyQThCNUEwHhcNMTIxMDE5MDk0NTQ3WhcNMTMxMDE5
+MDk0NTQ3WjAvMS0wKwYDVQQDEyQwQUM5RjAyNi1EQ0VBLTRDMTItOTEyNy1DMEZE
+N0QyQThCNUEwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBALTsTNyGIsKvyw56
+WI3Gll/RmjsupkrdEtPbx7OjS9MEgyhOAf9+u6CV0LJGHpy7HUeROykF6xpbSdCm
+Mr6kNObl5N0ljOb8OmV4atKjmGg1rWawDLyDQ9Dtuby+dzfHtzAzP+J/3ZoOtSqq
+AHVTnCclU1pm/uHN0HZ5nL5iLJTvAgMBAAGjEjAQMA4GA1UdDwEB/wQEAwIFoDAN
+BgkqhkiG9w0BAQUFAAOBgQA8K+BouEV04HRTdMZd3akjTQOm6aEGW4nIRnYIf8ZV
+mvUpLirVlX/unKtJinhGisFGpuYLMpemx17cnGkBeLCQRvHQjC+ho7l8/LOGheMS
+nvu0XHhvmJtRbm8MKHhogwZqHFDnXonvjyqhnhEtK5F2Fimcce3MoF2QtEe0UWv/
+8DGCAaowggGmAgEBMDQwLzEtMCsGA1UEAxMkMEFDOUYwMjYtRENFQS00QzEyLTkx
+MjctQzBGRDdEMkE4QjVBAgEBMAkGBSsOAwIaBQCggc0wEgYKYIZIAYb4RQEJAjEE
+EwIxOTAYBgkqhkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0x
+MjEwMTkwOTQ1NDdaMCAGCmCGSAGG+EUBCQUxEgQQ2EFUJdQNwQDxclIQ8qNyYzAj
+BgkqhkiG9w0BCQQxFgQUy8GFXPpAwRJUT3rdvNC9Pn+4eoswOAYKYIZIAYb4RQEJ
+BzEqEygwRkU3QzJEQTVEMDc2NzFFOTcxNDlCNUE3MDRCMERDNkM4MDYwRDJBMA0G
+CSqGSIb3DQEBAQUABIGAWUNdzvU2iiQOtihBwF0h48Nnw/2qX8uRjg6CVTOMcGji
+BxjUMifEbT//KJwljshl4y3yBLqeVYLOd04k6aKSdjgdZnrnUPI6p5tL5PfJkTAE
+L6qflZ9YCU5erE4T5U98hCQBMh4nOYxgaTjnZzhpkKQuEiKq/755cjzTzlI/eok=
+-----END PKCS7-----
+END
+ pki_message_content_pem = <<END
+-----BEGIN PKCS7-----
+MIIDawYJKoZIhvcNAQcDoIIDXDCCA1gCAQAxggEQMIIBDAIBADB1MHAxEDAOBgNV
+BAoMB2V4YW1wbGUxFzAVBgNVBAMMDlRBUk1BQyBST09UIENBMSIwIAYJKoZIhvcN
+AQkBFhNzb21lb25lQGV4YW1wbGUub3JnMQswCQYDVQQGEwJVUzESMBAGA1UEBwwJ
+VG93biBIYWxsAgFmMA0GCSqGSIb3DQEBAQUABIGAbKV17HvGYRtRRBNz1QLpW763
+UedhVj5KXi70o4BJGM04lItAgt6aFC9SruZjpWr1gCYKCaRSAg273DeGTQwsDoZ8
+6CPXzBpptYLz0MteQXYYWUaPZT+xmvx4NgDyk9P9MoT7JifsPrtXuzqCRFXhGdu8
+d/ru+OWxhHLvKH+bYekwggI9BgkqhkiG9w0BBwEwFAYIKoZIhvcNAwcECBNs2U5m
+Msd/gIICGFOnLq/EAc9Nv+HjKR3ZVPSJMq0TImjGf5Mvc3nDgI572Hdo2aku0YXM
+6WjSWkpYtxpg7Cqxfl6hPSefLPUnBqlIoM2qbrE7MSKEVD6+2bW9GqYPFVg4qQLL
+sOxnxJIMfOvLFfd7guL+iLH424XfiUUxaf8EdZE4u2IEl4REvkS1FoEGwyA4BEGM
+SeVPedQCbZ0qY7Pc2tmZE3XfEUhIsyStG0Nb6i6AKcAFYGapbgE6kAB0gwsYcHlW
+MOvsvdAfcTq6jwtHlO1s68qtvkWquTQ9lpX+fzddUUNxEHSqv5eU3oo6fT3Vj5ZF
+IVlaA5ThZMrI5PgRPuwJM4GL8/VLwY5mbDLFqn/irGeEvP99J3S87ornLLunjpxS
+y1/AymcVep2H32Tj82WS/IRQXBOzz4EnQRJGszKxAV6tY+Zje3sWyTTgObhlsiTQ
+TDgnvtSW8RvVHqKrwgkxxEsRHg7u8UdzZ0jg+O5+3F8B6/NWMyts0OaFqT9wvI8y
+O7VIy3dUtGdz7Hde6Ggp/iTn1LbgdJ3N8Hzxf1j6NMWUKHVsadvwpRJbUeqq9c3+
+QuxsJi8wWemxxQCE+tPyc1dP+ej5/M7bERbSOHMGgX03758IvP7A/fy2DjGPv2+l
+AwlEke0Uze1367QKgxM0nc3SZDlptY7zPIJC5saWXb8Rt2bw2JxEBOTavrp+ZwJ8
+tcH961onq8Tme2ICaCzk
+-----END PKCS7-----
+END
+ pki_msg = OpenSSL::PKCS7.new(pki_message_pem)
+ store = OpenSSL::X509::Store.new
+ pki_msg.verify(nil, store, nil, OpenSSL::PKCS7::NOVERIFY)
+ p7enc = OpenSSL::PKCS7.new(pki_msg.data)
+ assert_equal(pki_message_content_pem, p7enc.to_pem)
+ end
end
end
diff --git a/test/openssl/test_pkey_rsa.rb b/test/openssl/test_pkey_rsa.rb
index 1881525c02..df0c6090cb 100644
--- a/test/openssl/test_pkey_rsa.rb
+++ b/test/openssl/test_pkey_rsa.rb
@@ -75,6 +75,36 @@ class OpenSSL::TestPKeyRSA < Test::Unit::TestCase
assert(key.verify(digest, sig, data))
end
+ def test_sign_verify_memory_leak
+ bug9743 = '[ruby-core:62038] [Bug #9743]'
+ assert_no_memory_leak(%w[-ropenssl], <<-PREP, <<-CODE, bug9743, rss: true, timeout: 30)
+ data = 'Sign me!'
+ digest = OpenSSL::Digest::SHA512.new
+ pkey = OpenSSL::PKey::RSA.new(2048)
+ signature = pkey.sign(digest, data)
+ pub_key = pkey.public_key
+ PREP
+ 20_000.times {
+ pub_key.verify(digest, signature, data)
+ }
+ CODE
+
+ assert_no_memory_leak(%w[-ropenssl], <<-PREP, <<-CODE, bug9743, rss: true, timeout: 30)
+ data = 'Sign me!'
+ digest = OpenSSL::Digest::SHA512.new
+ pkey = OpenSSL::PKey::RSA.new(2048)
+ signature = pkey.sign(digest, data)
+ pub_key = pkey.public_key
+ PREP
+ 20_000.times {
+ begin
+ pub_key.verify(digest, signature, 1)
+ rescue TypeError
+ end
+ }
+ CODE
+ end
+
def test_digest_state_irrelevant_sign
key = OpenSSL::TestUtils::TEST_KEY_RSA1024
digest1 = OpenSSL::Digest::SHA1.new
diff --git a/test/openssl/test_ssl.rb b/test/openssl/test_ssl.rb
index 64efa8dd33..ddc3be5b05 100644
--- a/test/openssl/test_ssl.rb
+++ b/test/openssl/test_ssl.rb
@@ -4,10 +4,6 @@ if defined?(OpenSSL)
class OpenSSL::TestSSL < OpenSSL::SSLTestCase
- TLS_DEFAULT_OPS = defined?(OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS) ?
- OpenSSL::SSL::OP_ALL & ~OpenSSL::SSL::OP_DONT_INSERT_EMPTY_FRAGMENTS :
- OpenSSL::SSL::OP_ALL
-
def test_ctx_setup
ctx = OpenSSL::SSL::SSLContext.new
assert_equal(ctx.setup, true)
@@ -30,6 +26,20 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
end
end
+ def test_ssl_gets
+ start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true) { |server, port|
+ server_connect(port) { |ssl|
+ ssl.write "abc\n"
+ IO.select [ssl]
+
+ line = ssl.gets
+
+ assert_equal "abc\n", line
+ assert_equal Encoding::BINARY, line.encoding
+ }
+ }
+ end
+
def test_ssl_read_nonblock
start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true) { |server, port|
server_connect(port) { |ssl|
@@ -68,13 +78,17 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
ITERATIONS.times{|i|
str = "x" * 100 + "\n"
ssl.syswrite(str)
- assert_equal(str, ssl.sysread(str.size))
+ newstr = ''
+ newstr << ssl.sysread(str.size - newstr.size) until newstr.size == str.size
+ assert_equal(str, newstr)
str = "x" * i * 100 + "\n"
buf = ""
ssl.syswrite(str)
assert_equal(buf.object_id, ssl.sysread(str.size, buf).object_id)
- assert_equal(str, buf)
+ newstr = buf
+ newstr << ssl.sysread(str.size - newstr.size) until newstr.size == str.size
+ assert_equal(str, newstr)
}
# puts and gets
@@ -111,7 +125,12 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
assert_raise(OpenSSL::SSL::SSLError, Errno::ECONNRESET){
sock = TCPSocket.new("127.0.0.1", port)
ssl = OpenSSL::SSL::SSLSocket.new(sock)
- ssl.connect
+ ssl.sync_close = true
+ begin
+ ssl.connect
+ ensure
+ ssl.close
+ end
}
ctx = OpenSSL::SSL::SSLContext.new
@@ -155,28 +174,46 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
}
end
+ def test_read_nonblock_without_session
+ OpenSSL::TestUtils.silent do
+ start_server(PORT, OpenSSL::SSL::VERIFY_NONE, false){|server, port|
+ sock = TCPSocket.new("127.0.0.1", port)
+ ssl = OpenSSL::SSL::SSLSocket.new(sock)
+ ssl.sync_close = true
+
+ assert_equal :wait_readable, ssl.read_nonblock(100, exception: false)
+ ssl.write("abc\n")
+ IO.select [ssl]
+ assert_equal('a', ssl.read_nonblock(1))
+ assert_equal("bc\n", ssl.read_nonblock(100))
+ assert_equal :wait_readable, ssl.read_nonblock(100, exception: false)
+ ssl.close
+ }
+ end
+ end
+
def test_starttls
- start_server(PORT, OpenSSL::SSL::VERIFY_NONE, false){|server, port|
- sock = TCPSocket.new("127.0.0.1", port)
- ssl = OpenSSL::SSL::SSLSocket.new(sock)
- ssl.sync_close = true
- str = "x" * 1000 + "\n"
+ OpenSSL::TestUtils.silent do
+ start_server(PORT, OpenSSL::SSL::VERIFY_NONE, false){|server, port|
+ sock = TCPSocket.new("127.0.0.1", port)
+ ssl = OpenSSL::SSL::SSLSocket.new(sock)
+ ssl.sync_close = true
+ str = "x" * 1000 + "\n"
- OpenSSL::TestUtils.silent do
ITERATIONS.times{
ssl.puts(str)
assert_equal(str, ssl.gets)
}
starttls(ssl)
- end
- ITERATIONS.times{
- ssl.puts(str)
- assert_equal(str, ssl.gets)
- }
+ ITERATIONS.times{
+ ssl.puts(str)
+ assert_equal(str, ssl.gets)
+ }
- ssl.close
- }
+ ssl.close
+ }
+ end
end
def test_parallel
@@ -207,9 +244,16 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
ctx = OpenSSL::SSL::SSLContext.new
ctx.set_params
ssl = OpenSSL::SSL::SSLSocket.new(sock, ctx)
- assert_raise(OpenSSL::SSL::SSLError){ ssl.connect }
- assert_equal(OpenSSL::X509::V_ERR_SELF_SIGNED_CERT_IN_CHAIN, ssl.verify_result)
+ ssl.sync_close = true
+ begin
+ assert_raise(OpenSSL::SSL::SSLError){ ssl.connect }
+ assert_equal(OpenSSL::X509::V_ERR_SELF_SIGNED_CERT_IN_CHAIN, ssl.verify_result)
+ ensure
+ ssl.close
+ end
+ }
+ start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true){|server, port|
sock = TCPSocket.new("127.0.0.1", port)
ctx = OpenSSL::SSL::SSLContext.new
ctx.set_params(
@@ -219,9 +263,16 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
end
)
ssl = OpenSSL::SSL::SSLSocket.new(sock, ctx)
- ssl.connect
- assert_equal(OpenSSL::X509::V_OK, ssl.verify_result)
+ ssl.sync_close = true
+ begin
+ ssl.connect
+ assert_equal(OpenSSL::X509::V_OK, ssl.verify_result)
+ ensure
+ ssl.close
+ end
+ }
+ start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true){|server, port|
sock = TCPSocket.new("127.0.0.1", port)
ctx = OpenSSL::SSL::SSLContext.new
ctx.set_params(
@@ -231,8 +282,13 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
end
)
ssl = OpenSSL::SSL::SSLSocket.new(sock, ctx)
- assert_raise(OpenSSL::SSL::SSLError){ ssl.connect }
- assert_equal(OpenSSL::X509::V_ERR_APPLICATION_VERIFICATION, ssl.verify_result)
+ ssl.sync_close = true
+ begin
+ assert_raise(OpenSSL::SSL::SSLError){ ssl.connect }
+ assert_equal(OpenSSL::X509::V_ERR_APPLICATION_VERIFICATION, ssl.verify_result)
+ ensure
+ ssl.close
+ end
}
end
@@ -247,12 +303,16 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
end
)
ssl = OpenSSL::SSL::SSLSocket.new(sock, ctx)
- OpenSSL::TestUtils.silent do
- # SSLError, not RuntimeError
- assert_raise(OpenSSL::SSL::SSLError) { ssl.connect }
+ ssl.sync_close = true
+ begin
+ OpenSSL::TestUtils.silent do
+ # SSLError, not RuntimeError
+ assert_raise(OpenSSL::SSL::SSLError) { ssl.connect }
+ end
+ assert_equal(OpenSSL::X509::V_ERR_CERT_REJECTED, ssl.verify_result)
+ ensure
+ ssl.close
end
- assert_equal(OpenSSL::X509::V_ERR_CERT_REJECTED, ssl.verify_result)
- ssl.close
}
end
@@ -262,15 +322,20 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase
ctx = OpenSSL::SSL::SSLContext.new
ctx.set_params
assert_equal(OpenSSL::SSL::VERIFY_PEER, ctx.verify_mode)
- assert_equal(TLS_DEFAULT_OPS, ctx.options)
+ assert_equal(OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:options], ctx.options)
ciphers = ctx.ciphers
ciphers_versions = ciphers.collect{|_, v, _, _| v }
ciphers_names = ciphers.collect{|v, _, _, _| v }
assert(ciphers_names.all?{|v| /ADH/ !~ v })
assert(ciphers_versions.all?{|v| /SSLv2/ !~ v })
ssl = OpenSSL::SSL::SSLSocket.new(sock, ctx)
- assert_raise(OpenSSL::SSL::SSLError){ ssl.connect }
- assert_equal(OpenSSL::X509::V_ERR_SELF_SIGNED_CERT_IN_CHAIN, ssl.verify_result)
+ ssl.sync_close = true
+ begin
+ assert_raise(OpenSSL::SSL::SSLError){ ssl.connect }
+ assert_equal(OpenSSL::X509::V_ERR_SELF_SIGNED_CERT_IN_CHAIN, ssl.verify_result)
+ ensure
+ ssl.close
+ end
}
end
@@ -648,6 +713,15 @@ end
}
end
+ def test_sync_close_without_connect
+ Socket.open(:INET, :STREAM) {|s|
+ ssl = OpenSSL::SSL::SSLSocket.new(s)
+ ssl.sync_close = true
+ ssl.close
+ assert(s.closed?)
+ }
+ end
+
private
def start_server_version(version, ctx_proc=nil, server_proc=nil, &blk)
diff --git a/test/openssl/test_ssl_session.rb b/test/openssl/test_ssl_session.rb
index 69a3a0d876..3e89633f65 100644
--- a/test/openssl/test_ssl_session.rb
+++ b/test/openssl/test_ssl_session.rb
@@ -41,32 +41,34 @@ tddwpBAEDjcwMzA5NTYzMTU1MzAwpQMCARM=
end
def test_session
- start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true) do |server, port|
- sock = TCPSocket.new("127.0.0.1", port)
- ctx = OpenSSL::SSL::SSLContext.new("TLSv1")
- ssl = OpenSSL::SSL::SSLSocket.new(sock, ctx)
- ssl.sync_close = true
- ssl.connect
- session = ssl.session
- assert(session == OpenSSL::SSL::Session.new(session.to_pem))
- assert(session == OpenSSL::SSL::Session.new(ssl))
- assert_equal(300, session.timeout)
- session.timeout = 5
- assert_equal(5, session.timeout)
- assert_not_nil(session.time)
- # SSL_SESSION_time keeps long value so we can't keep nsec fragment.
- session.time = t1 = Time.now.to_i
- assert_equal(Time.at(t1), session.time)
- if session.respond_to?(:id)
- assert_not_nil(session.id)
+ timeout(5) do
+ start_server(PORT, OpenSSL::SSL::VERIFY_NONE, true) do |server, port|
+ sock = TCPSocket.new("127.0.0.1", port)
+ ctx = OpenSSL::SSL::SSLContext.new("TLSv1")
+ ssl = OpenSSL::SSL::SSLSocket.new(sock, ctx)
+ ssl.sync_close = true
+ ssl.connect
+ session = ssl.session
+ assert(session == OpenSSL::SSL::Session.new(session.to_pem))
+ assert(session == OpenSSL::SSL::Session.new(ssl))
+ assert_equal(300, session.timeout)
+ session.timeout = 5
+ assert_equal(5, session.timeout)
+ assert_not_nil(session.time)
+ # SSL_SESSION_time keeps long value so we can't keep nsec fragment.
+ session.time = t1 = Time.now.to_i
+ assert_equal(Time.at(t1), session.time)
+ if session.respond_to?(:id)
+ assert_not_nil(session.id)
+ end
+ pem = session.to_pem
+ assert_match(/\A-----BEGIN SSL SESSION PARAMETERS-----/, pem)
+ assert_match(/-----END SSL SESSION PARAMETERS-----\Z/, pem)
+ pem.gsub!(/-----(BEGIN|END) SSL SESSION PARAMETERS-----/, '').gsub!(/[\r\n]+/m, '')
+ assert_equal(session.to_der, pem.unpack('m*')[0])
+ assert_not_nil(session.to_text)
+ ssl.close
end
- pem = session.to_pem
- assert_match(/\A-----BEGIN SSL SESSION PARAMETERS-----/, pem)
- assert_match(/-----END SSL SESSION PARAMETERS-----\Z/, pem)
- pem.gsub!(/-----(BEGIN|END) SSL SESSION PARAMETERS-----/, '').gsub!(/[\r\n]+/m, '')
- assert_equal(session.to_der, pem.unpack('m*')[0])
- assert_not_nil(session.to_text)
- ssl.close
end
end
diff --git a/test/openssl/test_x509cert.rb b/test/openssl/test_x509cert.rb
index dd5751eb48..f13d6456f4 100644
--- a/test/openssl/test_x509cert.rb
+++ b/test/openssl/test_x509cert.rb
@@ -45,10 +45,10 @@ class OpenSSL::TestX509Certificate < Test::Unit::TestCase
].each{|pk, digest|
cert = issue_cert(@ca, pk, 1, Time.now, Time.now+3600, exts,
nil, nil, digest)
- assert_equal(cert.extensions[1].value,
+ assert_equal(cert.extensions.sort_by(&:to_s)[2].value,
OpenSSL::TestUtils.get_subject_key_id(cert))
cert = OpenSSL::X509::Certificate.new(cert.to_der)
- assert_equal(cert.extensions[1].value,
+ assert_equal(cert.extensions.sort_by(&:to_s)[2].value,
OpenSSL::TestUtils.get_subject_key_id(cert))
}
end
@@ -125,7 +125,7 @@ class OpenSSL::TestX509Certificate < Test::Unit::TestCase
end
- def test_sign_and_verify
+ def test_sign_and_verify_rsa_sha1
cert = issue_cert(@ca, @rsa2048, 1, Time.now, Time.now+3600, [],
nil, nil, OpenSSL::Digest::SHA1.new)
assert_equal(false, cert.verify(@rsa1024))
@@ -134,7 +134,9 @@ class OpenSSL::TestX509Certificate < Test::Unit::TestCase
assert_equal(false, certificate_error_returns_false { cert.verify(@dsa512) })
cert.serial = 2
assert_equal(false, cert.verify(@rsa2048))
+ end
+ def test_sign_and_verify_rsa_md5
cert = issue_cert(@ca, @rsa2048, 1, Time.now, Time.now+3600, [],
nil, nil, OpenSSL::Digest::MD5.new)
assert_equal(false, cert.verify(@rsa1024))
@@ -144,7 +146,10 @@ class OpenSSL::TestX509Certificate < Test::Unit::TestCase
assert_equal(false, certificate_error_returns_false { cert.verify(@dsa512) })
cert.subject = @ee1
assert_equal(false, cert.verify(@rsa2048))
+ rescue OpenSSL::X509::CertificateError # RHEL7 disables MD5
+ end
+ def test_sign_and_verify_dsa
cert = issue_cert(@ca, @dsa512, 1, Time.now, Time.now+3600, [],
nil, nil, OpenSSL::TestUtils::DSA_SIGNATURE_DIGEST.new)
assert_equal(false, certificate_error_returns_false { cert.verify(@rsa1024) })
@@ -153,19 +158,21 @@ class OpenSSL::TestX509Certificate < Test::Unit::TestCase
assert_equal(true, cert.verify(@dsa512))
cert.not_after = Time.now
assert_equal(false, cert.verify(@dsa512))
+ end
- begin
- cert = issue_cert(@ca, @rsa2048, 1, Time.now, Time.now+3600, [],
- nil, nil, OpenSSL::Digest::DSS1.new)
- assert_equal(false, cert.verify(@rsa1024))
- assert_equal(true, cert.verify(@rsa2048))
- assert_equal(false, certificate_error_returns_false { cert.verify(@dsa256) })
- assert_equal(false, certificate_error_returns_false { cert.verify(@dsa512) })
- cert.subject = @ee1
- assert_equal(false, cert.verify(@rsa2048))
- rescue OpenSSL::X509::CertificateError
- end
+ def test_sign_and_verify_rsa_dss1
+ cert = issue_cert(@ca, @rsa2048, 1, Time.now, Time.now+3600, [],
+ nil, nil, OpenSSL::Digest::DSS1.new)
+ assert_equal(false, cert.verify(@rsa1024))
+ assert_equal(true, cert.verify(@rsa2048))
+ assert_equal(false, certificate_error_returns_false { cert.verify(@dsa256) })
+ assert_equal(false, certificate_error_returns_false { cert.verify(@dsa512) })
+ cert.subject = @ee1
+ assert_equal(false, cert.verify(@rsa2048))
+ rescue OpenSSL::X509::CertificateError
+ end
+ def test_sign_and_verify_dsa_md5
assert_raise(OpenSSL::X509::CertificateError){
issue_cert(@ca, @dsa512, 1, Time.now, Time.now+3600, [],
nil, nil, OpenSSL::Digest::MD5.new)
diff --git a/test/openssl/test_x509req.rb b/test/openssl/test_x509req.rb
index e6c89c5e81..d0b6a5725d 100644
--- a/test/openssl/test_x509req.rb
+++ b/test/openssl/test_x509req.rb
@@ -98,7 +98,7 @@ class OpenSSL::TestX509Request < Test::Unit::TestCase
assert_equal(exts, get_ext_req(attrs[1].value))
end
- def test_sign_and_verify
+ def test_sign_and_verify_rsa_sha1
req = issue_csr(0, @dn, @rsa1024, OpenSSL::Digest::SHA1.new)
assert_equal(true, req.verify(@rsa1024))
assert_equal(false, req.verify(@rsa2048))
@@ -106,7 +106,9 @@ class OpenSSL::TestX509Request < Test::Unit::TestCase
assert_equal(false, request_error_returns_false { req.verify(@dsa512) })
req.version = 1
assert_equal(false, req.verify(@rsa1024))
+ end
+ def test_sign_and_verify_rsa_md5
req = issue_csr(0, @dn, @rsa2048, OpenSSL::Digest::MD5.new)
assert_equal(false, req.verify(@rsa1024))
assert_equal(true, req.verify(@rsa2048))
@@ -114,7 +116,10 @@ class OpenSSL::TestX509Request < Test::Unit::TestCase
assert_equal(false, request_error_returns_false { req.verify(@dsa512) })
req.subject = OpenSSL::X509::Name.parse("/C=JP/CN=FooBar")
assert_equal(false, req.verify(@rsa2048))
+ rescue OpenSSL::X509::RequestError # RHEL7 disables MD5
+ end
+ def test_sign_and_verify_dsa
req = issue_csr(0, @dn, @dsa512, OpenSSL::TestUtils::DSA_SIGNATURE_DIGEST.new)
assert_equal(false, request_error_returns_false { req.verify(@rsa1024) })
assert_equal(false, request_error_returns_false { req.verify(@rsa2048) })
@@ -122,18 +127,21 @@ class OpenSSL::TestX509Request < Test::Unit::TestCase
assert_equal(true, req.verify(@dsa512))
req.public_key = @rsa1024.public_key
assert_equal(false, req.verify(@dsa512))
+ end
- begin
- req = issue_csr(0, @dn, @rsa1024, OpenSSL::Digest::DSS1.new)
- assert_equal(true, req.verify(@rsa1024))
- assert_equal(false, req.verify(@rsa2048))
- assert_equal(false, request_error_returns_false { req.verify(@dsa256) })
- assert_equal(false, request_error_returns_false { req.verify(@dsa512) })
- req.version = 1
- assert_equal(false, req.verify(@rsa1024))
- rescue OpenSSL::X509::RequestError
- end
+ def test_sign_and_verify_rsa_dss1
+ req = issue_csr(0, @dn, @rsa1024, OpenSSL::Digest::DSS1.new)
+ assert_equal(true, req.verify(@rsa1024))
+ assert_equal(false, req.verify(@rsa2048))
+ assert_equal(false, request_error_returns_false { req.verify(@dsa256) })
+ assert_equal(false, request_error_returns_false { req.verify(@dsa512) })
+ req.version = 1
+ assert_equal(false, req.verify(@rsa1024))
+ rescue OpenSSL::X509::RequestError
+ skip
+ end
+ def test_sign_and_verify_dsa_md5
assert_raise(OpenSSL::X509::RequestError){
issue_csr(0, @dn, @dsa512, OpenSSL::Digest::MD5.new) }
end
diff --git a/test/openssl/test_x509store.rb b/test/openssl/test_x509store.rb
index ff820c1c58..082e405371 100644
--- a/test/openssl/test_x509store.rb
+++ b/test/openssl/test_x509store.rb
@@ -1,3 +1,4 @@
+require_relative "../ruby/envutil"
require_relative "utils"
if defined?(OpenSSL)
@@ -21,7 +22,9 @@ class OpenSSL::TestX509Store < Test::Unit::TestCase
cert = OpenSSL::X509::Certificate.new
store = OpenSSL::X509::Store.new
ctx = OpenSSL::X509::StoreContext.new(store, cert, [])
- ctx.cleanup
+ EnvUtil.suppress_warning do
+ ctx.cleanup
+ end
ctx.verify
end
diff --git a/test/openssl/utils.rb b/test/openssl/utils.rb
index ba9714b3fc..4df14056e4 100644
--- a/test/openssl/utils.rb
+++ b/test/openssl/utils.rb
@@ -240,7 +240,7 @@ AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOPeVkJ8ePao0eLAgEC
ssl.close rescue nil
end
- def server_loop(ctx, ssls, server_proc)
+ def server_loop(ctx, ssls, server_proc, threads)
loop do
ssl = nil
begin
@@ -249,10 +249,11 @@ AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOPeVkJ8ePao0eLAgEC
retry
end
- Thread.start do
+ th = Thread.start do
Thread.current.abort_on_exception = true
server_proc.call(ctx, ssl)
end
+ threads << th
end
rescue Errno::EBADF, IOError, Errno::EINVAL, Errno::ECONNABORTED, Errno::ENOTSOCK, Errno::ECONNRESET
end
@@ -261,6 +262,7 @@ AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOPeVkJ8ePao0eLAgEC
ctx_proc = args[:ctx_proc]
server_proc = args[:server_proc]
server_proc ||= method(:readwrite_loop)
+ threads = []
store = OpenSSL::X509::Store.new
store.add_cert(@ca_cert)
@@ -290,7 +292,7 @@ AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOPeVkJ8ePao0eLAgEC
begin
server = Thread.new do
Thread.current.abort_on_exception = true
- server_loop(ctx, ssls, server_proc)
+ server_loop(ctx, ssls, server_proc, threads)
end
$stderr.printf("%s started: pid=%d port=%d\n", SSL_SERVER, $$, port) if $DEBUG
@@ -309,7 +311,6 @@ AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOPeVkJ8ePao0eLAgEC
if (server)
server.join(5)
if server.alive?
- server.kill
server.join
flunk("TCPServer was closed and SSLServer is still alive") unless $!
end
@@ -318,6 +319,10 @@ AQjjxMXhwULlmuR/K+WwlaZPiLIBYalLAZQ7ZbOPeVkJ8ePao0eLAgEC
tcps.close if (tcps)
end
end
+ ensure
+ threads.each {|th|
+ th.join
+ }
end
def starttls(ssl)
diff --git a/test/optparse/test_acceptable.rb b/test/optparse/test_acceptable.rb
new file mode 100644
index 0000000000..6ec619ef8c
--- /dev/null
+++ b/test/optparse/test_acceptable.rb
@@ -0,0 +1,195 @@
+require_relative 'test_optparse'
+
+class TestOptionParser::Acceptable < TestOptionParser
+
+ def setup
+ super
+ @opt.def_option("--integer VAL", Integer) { |v| @integer = v }
+ @opt.def_option("--float VAL", Float) { |v| @float = v }
+ @opt.def_option("--numeric VAL", Numeric) { |v| @numeric = v }
+
+ @opt.def_option("--decimal-integer VAL",
+ OptionParser::DecimalInteger) { |i| @decimal_integer = i }
+ @opt.def_option("--octal-integer VAL",
+ OptionParser::OctalInteger) { |i| @octal_integer = i }
+ @opt.def_option("--decimal-numeric VAL",
+ OptionParser::DecimalNumeric) { |i| @decimal_numeric = i }
+ end
+
+ def test_integer
+ assert_equal(%w"", no_error {@opt.parse!(%w"--integer 0")})
+ assert_equal(0, @integer)
+
+ assert_equal(%w"", no_error {@opt.parse!(%w"--integer 0b10")})
+ assert_equal(2, @integer)
+
+ assert_equal(%w"", no_error {@opt.parse!(%w"--integer 077")})
+ assert_equal(63, @integer)
+
+ assert_equal(%w"", no_error {@opt.parse!(%w"--integer 10")})
+ assert_equal(10, @integer)
+
+ assert_equal(%w"", no_error {@opt.parse!(%w"--integer 0x3")})
+ assert_equal(3, @integer)
+
+ assert_raises(OptionParser::InvalidArgument) do
+ @opt.parse!(%w"--integer 0b")
+ end
+
+ assert_raises(OptionParser::InvalidArgument) do
+ @opt.parse!(%w"--integer 09")
+ end
+
+ assert_raises(OptionParser::InvalidArgument) do
+ @opt.parse!(%w"--integer 0x")
+ end
+
+ assert_raises(OptionParser::InvalidArgument) do
+ @opt.parse!(%w"--integer 1234xyz")
+ end
+ end
+
+ def test_float
+ assert_equal(%w"", no_error {@opt.parse!(%w"--float 0")})
+ assert_in_epsilon(0.0, @float)
+
+ assert_equal(%w"", no_error {@opt.parse!(%w"--float 0.0")})
+ assert_in_epsilon(0.0, @float)
+
+ assert_equal(%w"", no_error {@opt.parse!(%w"--float 1.2")})
+ assert_in_epsilon(1.2, @float)
+
+ assert_equal(%w"", no_error {@opt.parse!(%w"--float 1E2")})
+ assert_in_epsilon(100, @float)
+
+ assert_equal(%w"", no_error {@opt.parse!(%w"--float 1E-2")})
+ assert_in_epsilon(0.01, @float)
+
+ assert_raises(OptionParser::InvalidArgument) do
+ @opt.parse!(%w"--float 0e")
+ end
+
+ assert_raises(OptionParser::InvalidArgument) do
+ @opt.parse!(%w"--float 1.234xyz")
+ end
+ end
+
+ def test_numeric
+ assert_equal(%w"", no_error {@opt.parse!(%w"--numeric 0")})
+ assert_equal(0, @numeric)
+
+ assert_equal(%w"", no_error {@opt.parse!(%w"--numeric 0/1")})
+ assert_equal(0, @numeric)
+
+ assert_equal(%w"", no_error {@opt.parse!(%w"--numeric 1/2")})
+ assert_equal(Rational(1, 2), @numeric)
+
+ assert_equal(%w"", no_error {@opt.parse!(%w"--numeric 1.2/2.3")})
+ assert_equal(Rational(12, 23), @numeric)
+
+ assert_raises(OptionParser::InvalidArgument) do
+ @opt.parse!(%w"--numeric 1/")
+ end
+
+ assert_raises(OptionParser::InvalidArgument) do
+ @opt.parse!(%w"--numeric 12/34xyz")
+ end
+
+ assert_raises(OptionParser::InvalidArgument) do
+ @opt.parse!(%w"--numeric 12x/34yz")
+ end
+ end
+
+ def test_decimal_integer
+ assert_equal(%w"", no_error {@opt.parse!(%w"--decimal-integer 0")})
+ assert_equal(0, @decimal_integer)
+
+ assert_equal(%w"", no_error {@opt.parse!(%w"--decimal-integer 10")})
+ assert_equal(10, @decimal_integer)
+
+ assert_raises(OptionParser::InvalidArgument) do
+ @opt.parse!(%w"--decimal-integer 0b1")
+ end
+
+ e = assert_raises(OptionParser::InvalidArgument) do
+ @opt.parse!(%w"--decimal-integer 09")
+ end
+
+ assert_equal("invalid argument: --decimal-integer 09", e.message)
+
+ assert_raises(OptionParser::InvalidArgument) do
+ @opt.parse!(%w"--decimal-integer x")
+ end
+
+ assert_raises(OptionParser::InvalidArgument) do
+ @opt.parse!(%w"--decimal-integer 1234xyz")
+ end
+ end
+
+ def test_octal_integer
+ assert_equal(%w"", no_error {@opt.parse!(%w"--octal-integer 0")})
+ assert_equal(0, @octal_integer)
+
+ assert_equal(%w"", no_error {@opt.parse!(%w"--octal-integer 6")})
+ assert_equal(6, @octal_integer)
+
+ assert_equal(%w"", no_error {@opt.parse!(%w"--octal-integer 07")})
+ assert_equal(7, @octal_integer)
+
+ assert_equal(%w"", no_error {@opt.parse!(%w"--octal-integer 10")})
+ assert_equal(8, @octal_integer)
+
+ assert_equal(%w"", no_error {@opt.parse!(%w"--octal-integer 011")})
+ assert_equal(9, @octal_integer)
+
+ assert_raises(OptionParser::InvalidArgument) do
+ @opt.parse!(%w"--octal-integer 09")
+ end
+
+ assert_raises(OptionParser::InvalidArgument) do
+ @opt.parse!(%w"--octal-integer 0b1")
+ end
+
+ assert_raises(OptionParser::InvalidArgument) do
+ @opt.parse!(%w"--octal-integer x")
+ end
+
+ assert_raises(OptionParser::InvalidArgument) do
+ @opt.parse!(%w"--octal-integer 01234xyz")
+ end
+ end
+
+ def test_decimal_numeric
+ assert_equal(%w"", no_error {@opt.parse!(%w"--decimal-numeric 0")})
+ assert_equal(0, @decimal_numeric)
+
+ assert_equal(%w"", no_error {@opt.parse!(%w"--decimal-numeric 01")})
+ assert_equal(1, @decimal_numeric)
+
+ assert_equal(%w"", no_error {@opt.parse!(%w"--decimal-numeric 1.2")})
+ assert_in_delta(1.2, @decimal_numeric)
+
+ assert_equal(%w"", no_error {@opt.parse!(%w"--decimal-numeric 1E2")})
+ assert_in_delta(100.0, @decimal_numeric)
+
+ assert_raises(OptionParser::InvalidArgument) do
+ @opt.parse!(%w"--decimal-numeric 0b1")
+ end
+
+ e = assert_raises(OptionParser::InvalidArgument) do
+ @opt.parse!(%w"--decimal-numeric 09")
+ end
+
+ assert_equal("invalid argument: --decimal-numeric 09", e.message)
+
+ assert_raises(OptionParser::InvalidArgument) do
+ @opt.parse!(%w"--decimal-integer 1234xyz")
+ end
+
+ assert_raises(OptionParser::InvalidArgument) do
+ @opt.parse!(%w"--decimal-integer 12.34xyz")
+ end
+ end
+
+end
+
diff --git a/test/optparse/test_optparse.rb b/test/optparse/test_optparse.rb
index 76b8f7b183..e85a2ef586 100644
--- a/test/optparse/test_optparse.rb
+++ b/test/optparse/test_optparse.rb
@@ -10,7 +10,7 @@ class TestOptionParser < Test::Unit::TestCase
class DummyOutput < String
alias write <<
end
- def no_error(*args)
+ def assert_no_error(*args)
$stderr, stderr = DummyOutput.new, $stderr
assert_nothing_raised(*args) {return yield}
ensure
@@ -18,6 +18,7 @@ class TestOptionParser < Test::Unit::TestCase
$!.backtrace.delete_if {|e| /\A#{Regexp.quote(__FILE__)}:#{__LINE__-2}/o =~ e} if $!
assert_empty(stderr)
end
+ alias no_error assert_no_error
def test_permute
assert_equal(%w"", no_error {@opt.permute!(%w"")})
diff --git a/test/ostruct/test_ostruct.rb b/test/ostruct/test_ostruct.rb
index d82bab9784..14bc2b2da8 100644
--- a/test/ostruct/test_ostruct.rb
+++ b/test/ostruct/test_ostruct.rb
@@ -46,14 +46,14 @@ class TC_OpenStruct < Test::Unit::TestCase
o = OpenStruct.new
o.a = 'a'
o.freeze
- assert_raise(TypeError) {o.b = 'b'}
+ assert_raise(RuntimeError) {o.b = 'b'}
assert_not_respond_to(o, :b)
- assert_raise(TypeError) {o.a = 'z'}
+ assert_raise(RuntimeError) {o.a = 'z'}
assert_equal('a', o.a)
o = OpenStruct.new :a => 42
def o.frozen?; nil end
o.freeze
- assert_raise(TypeError, '[ruby-core:22559]') {o.a = 1764}
+ assert_raise(RuntimeError, '[ruby-core:22559]') {o.a = 1764}
end
def test_delete_field
@@ -68,6 +68,16 @@ class TC_OpenStruct < Test::Unit::TestCase
assert_not_respond_to(o, :a, bug)
assert_not_respond_to(o, :a=, bug)
assert_equal(a, 'a')
+ s = Object.new
+ def s.to_sym
+ :foo
+ end
+ o[s] = true
+ assert_respond_to(o, :foo)
+ assert_respond_to(o, :foo=)
+ o.delete_field s
+ assert_not_respond_to(o, :foo)
+ assert_not_respond_to(o, :foo=)
end
def test_setter
@@ -103,6 +113,7 @@ class TC_OpenStruct < Test::Unit::TestCase
os = OpenStruct.new(h)
assert_equal '#<Enumerator: #<OpenStruct name="John Smith", age=70, pension=300>:each_pair>', os.each_pair.inspect
assert_equal [[:name, "John Smith"], [:age, 70], [:pension, 300]], os.each_pair.to_a
+ assert_equal 3, os.each_pair.size
end
def test_eql_and_hash
@@ -114,4 +125,14 @@ class TC_OpenStruct < Test::Unit::TestCase
assert_equal true, os1.eql?(os1.dup)
assert_equal os1.hash, os1.dup.hash
end
+
+ def test_method_missing
+ os = OpenStruct.new
+ e = assert_raise(NoMethodError) { os.foo true }
+ assert_equal :foo, e.name
+ assert_equal [true], e.args
+ assert_match(/#{__callee__}/, e.backtrace[0])
+ e = assert_raise(ArgumentError) { os.send :foo=, true, true }
+ assert_match(/#{__callee__}/, e.backtrace[0])
+ end
end
diff --git a/test/pathname/test_pathname.rb b/test/pathname/test_pathname.rb
index ccdc5bd8eb..f77552cc9a 100644
--- a/test/pathname/test_pathname.rb
+++ b/test/pathname/test_pathname.rb
@@ -88,6 +88,10 @@ class TestPathname < Test::Unit::TestCase
defassert(:cleanpath_aggressive, '/', '///a/../..')
end
+ if DOSISH
+ defassert(:cleanpath_aggressive, 'c:/foo/bar', 'c:\\foo\\bar')
+ end
+
def cleanpath_conservative(path)
Pathname.new(path).cleanpath(true).to_s
end
@@ -124,6 +128,10 @@ class TestPathname < Test::Unit::TestCase
defassert(:cleanpath_conservative, '/a', '/../.././../a')
defassert(:cleanpath_conservative, 'a/b/../../../../c/../d', 'a/b/../../../../c/../d')
+ if DOSISH
+ defassert(:cleanpath_conservative, 'c:/foo/bar', 'c:\\foo\\bar')
+ end
+
if DOSISH_UNC
defassert(:cleanpath_conservative, '//', '//')
else
@@ -213,6 +221,10 @@ class TestPathname < Test::Unit::TestCase
defassert(:plus, 'a//b/d//e', 'a//b/c', '../d//e')
+ def test_slash
+ assert_kind_of(Pathname, Pathname("a") / Pathname("b"))
+ end
+
def test_parent
assert_equal(Pathname("."), Pathname("a").parent)
end
@@ -234,6 +246,16 @@ class TestPathname < Test::Unit::TestCase
def test_join
r = Pathname("a").join(Pathname("b"), Pathname("c"))
assert_equal(Pathname("a/b/c"), r)
+ r = Pathname("/a").join(Pathname("b"), Pathname("c"))
+ assert_equal(Pathname("/a/b/c"), r)
+ r = Pathname("/a").join(Pathname("/b"), Pathname("c"))
+ assert_equal(Pathname("/b/c"), r)
+ r = Pathname("/a").join(Pathname("/b"), Pathname("/c"))
+ assert_equal(Pathname("/c"), r)
+ r = Pathname("/a").join("/b", "/c")
+ assert_equal(Pathname("/c"), r)
+ r = Pathname("/foo/var").join()
+ assert_equal(Pathname("/foo/var"), r)
end
def test_absolute
@@ -537,6 +559,11 @@ class TestPathname < Test::Unit::TestCase
assert_include([true, false], r)
end
+ def test_mountpoint_enoent
+ r = Pathname("/nonexistent").mountpoint?
+ assert_equal false, r
+ end
+
def test_destructive_update
path = Pathname.new("a")
path.to_s.replace "b"
@@ -716,6 +743,22 @@ class TestPathname < Test::Unit::TestCase
}
end
+ def test_write
+ with_tmpchdir('rubytest-pathname') {|dir|
+ path = Pathname("a")
+ path.write "abc"
+ assert_equal("abc", path.read)
+ }
+ end
+
+ def test_binwrite
+ with_tmpchdir('rubytest-pathname') {|dir|
+ path = Pathname("a")
+ path.binwrite "abc\x80"
+ assert_equal("abc\x80".b, path.binread)
+ }
+ end
+
def test_sysopen
with_tmpchdir('rubytest-pathname') {|dir|
open("a", "w") {|f| f.write "abc" }
@@ -733,6 +776,14 @@ class TestPathname < Test::Unit::TestCase
assert_kind_of(Time, Pathname(__FILE__).atime)
end
+ def test_birthtime
+ assert_kind_of(Time, Pathname(__FILE__).birthtime)
+ rescue NotImplementedError
+ assert_raise(NotImplementedError) do
+ File.birthtime(__FILE__)
+ end
+ end
+
def test_ctime
assert_kind_of(Time, Pathname(__FILE__).ctime)
end
@@ -1206,7 +1257,7 @@ class TestPathname < Test::Unit::TestCase
Pathname("d").mkdir
assert(File.directory?("d"))
Pathname("d").rmdir
- assert(!File.exists?("d"))
+ assert(!File.exist?("d"))
}
end
@@ -1237,6 +1288,31 @@ class TestPathname < Test::Unit::TestCase
assert_equal([Pathname("."), Pathname("a"), Pathname("b"), Pathname("d"), Pathname("d/x"), Pathname("d/y")], a)
a = Pathname("d").find.sort
assert_equal([Pathname("d"), Pathname("d/x"), Pathname("d/y")], a)
+
+ begin
+ File.unlink("d/y")
+ File.chmod(0600, "d")
+ a = []; Pathname(".").find(ignore_error: true) {|v| a << v }; a.sort!
+ assert_equal([Pathname("."), Pathname("a"), Pathname("b"), Pathname("d"), Pathname("d/x")], a)
+ a = []; Pathname("d").find(ignore_error: true) {|v| a << v }; a.sort!
+ assert_equal([Pathname("d"), Pathname("d/x")], a)
+
+ skip "no meaning test on Windows" if /mswin|mingw/ =~ RUBY_PLATFORM
+ a = [];
+ assert_raise_with_message(Errno::EACCES, %r{d/x}) do
+ Pathname(".").find(ignore_error: false) {|v| a << v }
+ end
+ a.sort!
+ assert_equal([Pathname("."), Pathname("a"), Pathname("b"), Pathname("d"), Pathname("d/x")], a)
+ a = [];
+ assert_raise_with_message(Errno::EACCES, %r{d/x}) do
+ Pathname("d").find(ignore_error: false) {|v| a << v }
+ end
+ a.sort!
+ assert_equal([Pathname("d"), Pathname("d/x")], a)
+ ensure
+ File.chmod(0700, "d")
+ end
}
end
@@ -1298,4 +1374,17 @@ class TestPathname < Test::Unit::TestCase
assert_equal("foo/bar", File.join(Pathname.new("foo"), Pathname.new("bar").taint))
}.call
end
+
+ def test_relative_path_from_casefold
+ assert_separately([], <<-'end;') # do
+ module File::Constants
+ remove_const :FNM_SYSCASE
+ FNM_SYSCASE = FNM_CASEFOLD
+ end
+ require 'pathname'
+ foo = Pathname.new("fo\u{f6}")
+ bar = Pathname.new("b\u{e4}r".encode("ISO-8859-1"))
+ assert_instance_of(Pathname, foo.relative_path_from(bar))
+ end;
+ end
end
diff --git a/test/profile_test_all.rb b/test/profile_test_all.rb
deleted file mode 100644
index 54e916b73b..0000000000
--- a/test/profile_test_all.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-require 'objspace'
-
-#
-# purpose:
-# Profile memory usage of each tests.
-#
-# usage:
-# RUBY_TEST_ALL_PROFILE=true make test-all
-#
-# output:
-# ./test_all_profile
-#
-# collected information:
-# - ObjectSpace.memsize_of_all
-# - GC.stat
-# - /proc/self/statm (if it exists)
-#
-
-class MiniTest::Unit::TestCase
- alias orig_run run
-
- $test_all_profile_out = open('test_all_profile', 'w')
- $test_all_profile_gc_stat_hash = {}
-
- if FileTest.exist?('/proc/self/statm')
- # for Linux (only?)
- $test_all_profile_out.puts "name\tmemsize_of_all\t" +
- (GC.stat.keys +
- %w(size resident share text lib data dt)).join("\t")
-
- def memprofile_test_all_result_result
- "#{self.class}\##{self.__name__}\t" \
- "#{ObjectSpace.memsize_of_all}\t" \
- "#{GC.stat($test_all_profile_gc_stat_hash).values.join("\t")}\t" \
- "#{File.read('/proc/self/statm').split(/\s+/).join("\t")}"
- end
- else
- $test_all_profile_out.puts "name\tmemsize_of_alls\t" + GC.stat.keys.join("\t")
- def memprofile_test_all_result_result
- "#{self.class}\##{self.__name__}\t" \
- "#{ObjectSpace.memsize_of_all}\t" \
- "#{GC.stat($test_all_profile_gc_stat_hash).values.join("\t")}"
- end
- end
-
- def run runner
- result = orig_run(runner)
- $test_all_profile_out.puts memprofile_test_all_result_result
- $test_all_profile_out.flush
- result
- end
-end
diff --git a/test/psych/helper.rb b/test/psych/helper.rb
index f5800303fd..11b2216b20 100644
--- a/test/psych/helper.rb
+++ b/test/psych/helper.rb
@@ -6,6 +6,35 @@ require 'psych'
module Psych
class TestCase < MiniTest::Unit::TestCase
+ def self.suppress_warning
+ verbose, $VERBOSE = $VERBOSE, nil
+ yield
+ ensure
+ $VERBOSE = verbose
+ end
+
+ def with_default_external(enc)
+ verbose, $VERBOSE = $VERBOSE, nil
+ origenc, Encoding.default_external = Encoding.default_external, enc
+ $VERBOSE = verbose
+ yield
+ ensure
+ verbose, $VERBOSE = $VERBOSE, nil
+ Encoding.default_external = origenc
+ $VERBOSE = verbose
+ end
+
+ def with_default_internal(enc)
+ verbose, $VERBOSE = $VERBOSE, nil
+ origenc, Encoding.default_internal = Encoding.default_internal, enc
+ $VERBOSE = verbose
+ yield
+ ensure
+ verbose, $VERBOSE = $VERBOSE, nil
+ Encoding.default_internal = origenc
+ $VERBOSE = verbose
+ end
+
#
# Convert between Psych and the object to verify correct parsing and
# emitting
@@ -31,7 +60,7 @@ module Psych
end
def assert_cycle( obj )
- v = Visitors::YAMLTree.new
+ v = Visitors::YAMLTree.create
v << obj
assert_equal(obj, Psych.load(v.tree.yaml))
assert_equal( obj, Psych::load(Psych.dump(obj)))
@@ -54,3 +83,32 @@ module Psych
end
end
end
+
+# backport so that tests will run on 1.9 and 2.0.0
+unless Tempfile.respond_to? :create
+ def Tempfile.create(basename, *rest)
+ tmpfile = nil
+ 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?
+ begin
+ yield tmpfile
+ ensure
+ tmpfile.close if !tmpfile.closed?
+ File.unlink tmpfile
+ end
+ else
+ tmpfile
+ end
+ end
+end
diff --git a/test/psych/test_alias_and_anchor.rb b/test/psych/test_alias_and_anchor.rb
index 7cb5a6e52b..9e2c24013d 100644
--- a/test/psych/test_alias_and_anchor.rb
+++ b/test/psych/test_alias_and_anchor.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
class ObjectWithInstanceVariables
attr_accessor :var1, :var2
diff --git a/test/psych/test_array.rb b/test/psych/test_array.rb
index 747fe95062..960ffd71d8 100644
--- a/test/psych/test_array.rb
+++ b/test/psych/test_array.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestArray < TestCase
diff --git a/test/psych/test_boolean.rb b/test/psych/test_boolean.rb
index ebfa25e56a..b656f4f90e 100644
--- a/test/psych/test_boolean.rb
+++ b/test/psych/test_boolean.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
###
diff --git a/test/psych/test_class.rb b/test/psych/test_class.rb
index 156f2fb0ad..c7f964cc6d 100644
--- a/test/psych/test_class.rb
+++ b/test/psych/test_class.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestClass < TestCase
diff --git a/test/psych/test_coder.rb b/test/psych/test_coder.rb
index 7539c7d408..7571e89c9d 100644
--- a/test/psych/test_coder.rb
+++ b/test/psych/test_coder.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestCoder < TestCase
@@ -85,7 +85,7 @@ module Psych
end
def encode_with coder
- coder.represent_map self.class.name, { 'a' => 'b' }
+ coder.represent_map self.class.name, { "string" => 'a', :symbol => 'b' }
end
end
@@ -131,7 +131,7 @@ module Psych
def test_represent_map
thing = Psych.load(Psych.dump(RepresentWithMap.new))
- assert_equal({ 'a' => 'b' }, thing.map)
+ assert_equal({ "string" => 'a', :symbol => 'b' }, thing.map)
end
def test_represent_sequence
diff --git a/test/psych/test_date_time.rb b/test/psych/test_date_time.rb
index fb76cb3a00..72150ad7db 100644
--- a/test/psych/test_date_time.rb
+++ b/test/psych/test_date_time.rb
@@ -1,8 +1,21 @@
-require 'psych/helper'
+require_relative 'helper'
require 'date'
module Psych
class TestDateTime < TestCase
+ def test_negative_year
+ time = Time.utc -1, 12, 16
+ assert_cycle time
+ end
+
+ def test_new_datetime
+ assert_cycle DateTime.new
+ end
+
+ def test_invalid_date
+ assert_cycle "2013-10-31T10:40:07-000000000000033"
+ end
+
def test_string_tag
dt = DateTime.now
yaml = Psych.dump dt
@@ -13,5 +26,13 @@ module Psych
dt = DateTime.now
assert_cycle dt
end
+
+ def test_alias_with_time
+ t = Time.now
+ h = {:a => t, :b => t}
+ yaml = Psych.dump h
+ assert_match('&', yaml)
+ assert_match('*', yaml)
+ end
end
end
diff --git a/test/psych/test_deprecated.rb b/test/psych/test_deprecated.rb
index 3740b6f31c..fd2d3299e3 100644
--- a/test/psych/test_deprecated.rb
+++ b/test/psych/test_deprecated.rb
@@ -1,8 +1,9 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestDeprecated < TestCase
def teardown
+ $VERBOSE = @orig_verbose
Psych.domain_types.clear
end
@@ -27,6 +28,7 @@ module Psych
def setup
@qe = QuickEmitter.new
+ @orig_verbose, $VERBOSE = $VERBOSE, false
end
def test_quick_emit
@@ -145,7 +147,9 @@ module Psych
end
class YamlAs
- psych_yaml_as 'helloworld' # this should be yaml_as but to avoid syck
+ TestCase.suppress_warning do
+ psych_yaml_as 'helloworld' # this should be yaml_as but to avoid syck
+ end
end
def test_yaml_as
diff --git a/test/psych/test_document.rb b/test/psych/test_document.rb
index 05d9bbfb87..bd77d60084 100644
--- a/test/psych/test_document.rb
+++ b/test/psych/test_document.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestDocument < TestCase
diff --git a/test/psych/test_emitter.rb b/test/psych/test_emitter.rb
index dfd20e1507..0554ae5f85 100644
--- a/test/psych/test_emitter.rb
+++ b/test/psych/test_emitter.rb
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestEmitter < TestCase
diff --git a/test/psych/test_encoding.rb b/test/psych/test_encoding.rb
index 1abee0df16..517cae2069 100644
--- a/test/psych/test_encoding.rb
+++ b/test/psych/test_encoding.rb
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestEncoding < TestCase
@@ -31,6 +31,11 @@ module Psych
@emitter = Psych::Emitter.new @buffer
end
+ def test_dump_load_encoding_object
+ assert_cycle Encoding::US_ASCII
+ assert_cycle Encoding::UTF_8
+ end
+
def test_transcode_shiftjis
str = "こんにちは!"
loaded = Psych.load("--- こんにちは!".encode('SHIFT_JIS'))
@@ -50,58 +55,54 @@ module Psych
end
def test_io_shiftjis
- t = Tempfile.new(['shiftjis', 'yml'], :encoding => 'SHIFT_JIS')
- t.write '--- こんにちは!'
- t.close
-
- # If the external encoding isn't utf8, utf16le, or utf16be, we cannot
- # process the file.
- File.open(t.path, 'r', :encoding => 'SHIFT_JIS') do |f|
- assert_raises Psych::SyntaxError do
- Psych.load(f)
+ Tempfile.create(['shiftjis', 'yml'], :encoding => 'SHIFT_JIS') {|t|
+ t.write '--- こんにちは!'
+ t.close
+
+ # If the external encoding isn't utf8, utf16le, or utf16be, we cannot
+ # process the file.
+ File.open(t.path, 'r', :encoding => 'SHIFT_JIS') do |f|
+ assert_raises Psych::SyntaxError do
+ Psych.load(f)
+ end
end
- end
-
- t.close(true)
+ }
end
def test_io_utf16le
- t = Tempfile.new(['utf16le', 'yml'])
- t.binmode
- t.write '--- こんにちは!'.encode('UTF-16LE')
- t.close
+ Tempfile.create(['utf16le', 'yml']) {|t|
+ t.binmode
+ t.write '--- こんにちは!'.encode('UTF-16LE')
+ t.close
- File.open(t.path, 'rb', :encoding => 'UTF-16LE') do |f|
- assert_equal "こんにちは!", Psych.load(f)
- end
-
- t.close(true)
+ File.open(t.path, 'rb', :encoding => 'UTF-16LE') do |f|
+ assert_equal "こんにちは!", Psych.load(f)
+ end
+ }
end
def test_io_utf16be
- t = Tempfile.new(['utf16be', 'yml'])
- t.binmode
- t.write '--- こんにちは!'.encode('UTF-16BE')
- t.close
-
- File.open(t.path, 'rb', :encoding => 'UTF-16BE') do |f|
- assert_equal "こんにちは!", Psych.load(f)
- end
+ Tempfile.create(['utf16be', 'yml']) {|t|
+ t.binmode
+ t.write '--- こんにちは!'.encode('UTF-16BE')
+ t.close
- t.close(true)
+ File.open(t.path, 'rb', :encoding => 'UTF-16BE') do |f|
+ assert_equal "こんにちは!", Psych.load(f)
+ end
+ }
end
def test_io_utf8
- t = Tempfile.new(['utf8', 'yml'])
- t.binmode
- t.write '--- こんにちは!'.encode('UTF-8')
- t.close
-
- File.open(t.path, 'rb', :encoding => 'UTF-8') do |f|
- assert_equal "こんにちは!", Psych.load(f)
- end
+ Tempfile.create(['utf8', 'yml']) {|t|
+ t.binmode
+ t.write '--- こんにちは!'.encode('UTF-8')
+ t.close
- t.close(true)
+ File.open(t.path, 'rb', :encoding => 'UTF-8') do |f|
+ assert_equal "こんにちは!", Psych.load(f)
+ end
+ }
end
def test_emit_alias
@@ -114,19 +115,14 @@ module Psych
end
def test_to_yaml_is_valid
- ext_before = Encoding.default_external
- int_before = Encoding.default_internal
-
- Encoding.default_external = Encoding::US_ASCII
- Encoding.default_internal = nil
-
- s = "こんにちは!"
- # If no encoding is specified, use UTF-8
- assert_equal Encoding::UTF_8, Psych.dump(s).encoding
- assert_equal s, Psych.load(Psych.dump(s))
- ensure
- Encoding.default_external = ext_before
- Encoding.default_internal = int_before
+ with_default_external(Encoding::US_ASCII) do
+ with_default_internal(nil) do
+ s = "こんにちは!"
+ # If no encoding is specified, use UTF-8
+ assert_equal Encoding::UTF_8, Psych.dump(s).encoding
+ assert_equal s, Psych.load(Psych.dump(s))
+ end
+ end
end
def test_start_mapping
@@ -191,19 +187,14 @@ module Psych
end
def test_default_internal
- before = Encoding.default_internal
-
- Encoding.default_internal = 'EUC-JP'
+ with_default_internal(Encoding::EUC_JP) do
+ str = "壁に耳あり、障子に目あり"
+ assert_equal @utf8, str.encoding
- str = "壁に耳あり、障子に目あり"
- yaml = "--- #{str}"
- assert_equal @utf8, str.encoding
-
- @parser.parse str
- assert_encodings Encoding.find('EUC-JP'), @handler.strings
- assert_equal str, @handler.strings.first.encode('UTF-8')
- ensure
- Encoding.default_internal = before
+ @parser.parse str
+ assert_encodings Encoding::EUC_JP, @handler.strings
+ assert_equal str, @handler.strings.first.encode('UTF-8')
+ end
end
def test_scalar
diff --git a/test/psych/test_engine_manager.rb b/test/psych/test_engine_manager.rb
deleted file mode 100644
index e7bfb2ea72..0000000000
--- a/test/psych/test_engine_manager.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-require 'psych/helper'
-require 'yaml'
-
-module Psych
- class TestEngineManager < TestCase
- def test_bad_engine
- assert_raises(ArgumentError) do
- YAML::ENGINE.yamler = 'foooo'
- end
- end
-
- def test_set_psych
- YAML::ENGINE.yamler = 'psych'
- assert_equal Psych, YAML
- assert_equal 'psych', YAML::ENGINE.yamler
- end
-
- A = Struct.new(:name)
-
- def test_dump_types
- YAML::ENGINE.yamler = 'psych'
-
- assert_to_yaml ::Object.new
- assert_to_yaml Time.now
- assert_to_yaml Date.today
- assert_to_yaml('a' => 'b')
- assert_to_yaml A.new('foo')
- assert_to_yaml %w{a b}
- assert_to_yaml Exception.new('foo')
- assert_to_yaml "hello!"
- assert_to_yaml :fooo
- assert_to_yaml(1..10)
- assert_to_yaml(/hello!~/)
- assert_to_yaml 1
- assert_to_yaml 1.2
- assert_to_yaml Rational(1, 2)
- assert_to_yaml Complex(1, 2)
- assert_to_yaml true
- assert_to_yaml false
- assert_to_yaml nil
- end
-
- def assert_to_yaml obj
- assert obj.to_yaml, "#{obj.class} to_yaml works"
- end
- end
-end
diff --git a/test/psych/test_exception.rb b/test/psych/test_exception.rb
index 46dece4127..30dfb24f3b 100644
--- a/test/psych/test_exception.rb
+++ b/test/psych/test_exception.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestException < TestCase
@@ -16,6 +16,12 @@ module Psych
@wups = Wups.new
end
+ def test_naming_exception
+ err = String.xxx rescue $!
+ new_err = Psych.load(Psych.dump(err))
+ assert_equal err.message, new_err.message
+ end
+
def test_load_takes_file
ex = assert_raises(Psych::SyntaxError) do
Psych.load '--- `'
@@ -56,27 +62,27 @@ module Psych
end
def test_parse_file_exception
- t = Tempfile.new(['parsefile', 'yml'])
- t.binmode
- t.write '--- `'
- t.close
- ex = assert_raises(Psych::SyntaxError) do
- Psych.parse_file t.path
- end
- assert_equal t.path, ex.file
- t.close(true)
+ Tempfile.create(['parsefile', 'yml']) {|t|
+ t.binmode
+ t.write '--- `'
+ t.close
+ ex = assert_raises(Psych::SyntaxError) do
+ Psych.parse_file t.path
+ end
+ assert_equal t.path, ex.file
+ }
end
def test_load_file_exception
- t = Tempfile.new(['loadfile', 'yml'])
- t.binmode
- t.write '--- `'
- t.close
- ex = assert_raises(Psych::SyntaxError) do
- Psych.load_file t.path
- end
- assert_equal t.path, ex.file
- t.close(true)
+ Tempfile.create(['loadfile', 'yml']) {|t|
+ t.binmode
+ t.write '--- `'
+ t.close
+ ex = assert_raises(Psych::SyntaxError) do
+ Psych.load_file t.path
+ end
+ assert_equal t.path, ex.file
+ }
end
def test_psych_parse_takes_file
@@ -128,7 +134,7 @@ module Psych
end
def test_psych_syntax_error
- Tempfile.open(['parsefile', 'yml']) do |t|
+ Tempfile.create(['parsefile', 'yml']) do |t|
t.binmode
t.write '--- `'
t.close
@@ -138,7 +144,6 @@ module Psych
rescue StandardError
assert true # count assertion
ensure
- t.close(true)
return unless $!
ancestors = $!.class.ancestors.inspect
diff --git a/test/psych/test_hash.rb b/test/psych/test_hash.rb
index 4bd4edfc8c..264a4719e2 100644
--- a/test/psych/test_hash.rb
+++ b/test/psych/test_hash.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestHash < TestCase
@@ -10,6 +10,11 @@ module Psych
@hash = { :a => 'b' }
end
+ def test_load_with_class_syck_compatibility
+ hash = Psych.load "--- !ruby/object:Hash\n:user_id: 7\n:username: Lucas\n"
+ assert_equal({ user_id: 7, username: 'Lucas'}, hash)
+ end
+
def test_empty_subclass
assert_match "!ruby/hash:#{X}", Psych.dump(X.new)
x = Psych.load Psych.dump X.new
diff --git a/test/psych/test_json_tree.rb b/test/psych/test_json_tree.rb
index eed8cf36c4..60f8321e68 100644
--- a/test/psych/test_json_tree.rb
+++ b/test/psych/test_json_tree.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestJSONTree < TestCase
diff --git a/test/psych/test_merge_keys.rb b/test/psych/test_merge_keys.rb
index c31f9b80c0..1620a6a4e3 100644
--- a/test/psych/test_merge_keys.rb
+++ b/test/psych/test_merge_keys.rb
@@ -1,7 +1,55 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestMergeKeys < TestCase
+ class Product
+ attr_reader :bar
+ end
+
+ def test_merge_key_with_bare_hash
+ doc = Psych.load <<-eodoc
+map:
+ <<:
+ hello: world
+ eodoc
+ hash = { "map" => { "hello" => "world" } }
+ assert_equal hash, doc
+ end
+
+ def test_roundtrip_with_chevron_key
+ h = {}
+ v = { 'a' => h, '<<' => h }
+ assert_cycle v
+ end
+
+ def test_explicit_string
+ doc = Psych.load <<-eoyml
+a: &me { hello: world }
+b: { !!str '<<': *me }
+eoyml
+ expected = {
+ "a" => { "hello" => "world" },
+ "b" => {
+ "<<" => { "hello" => "world" }
+ }
+ }
+ assert_equal expected, doc
+ end
+
+ def test_mergekey_with_object
+ s = <<-eoyml
+foo: &foo
+ bar: 10
+product:
+ !ruby/object:#{Product.name}
+ <<: *foo
+ eoyml
+ hash = Psych.load s
+ assert_equal({"bar" => 10}, hash["foo"])
+ product = hash["product"]
+ assert_equal 10, product.bar
+ end
+
def test_merge_nil
yaml = <<-eoyml
defaults: &defaults
diff --git a/test/psych/test_nil.rb b/test/psych/test_nil.rb
index 4f32b7703b..3dbf56279a 100644
--- a/test/psych/test_nil.rb
+++ b/test/psych/test_nil.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestNil < TestCase
diff --git a/test/psych/test_null.rb b/test/psych/test_null.rb
index 0fee1d2464..1725550443 100644
--- a/test/psych/test_null.rb
+++ b/test/psych/test_null.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
###
diff --git a/test/psych/test_numeric.rb b/test/psych/test_numeric.rb
index 0858e799aa..5378b4aaad 100644
--- a/test/psych/test_numeric.rb
+++ b/test/psych/test_numeric.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
require 'bigdecimal'
module Psych
diff --git a/test/psych/test_object.rb b/test/psych/test_object.rb
index 6145bb6ada..5e3ce8294f 100644
--- a/test/psych/test_object.rb
+++ b/test/psych/test_object.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class Tagged
diff --git a/test/psych/test_object_references.rb b/test/psych/test_object_references.rb
index 51d8085fa0..273b466b0c 100644
--- a/test/psych/test_object_references.rb
+++ b/test/psych/test_object_references.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestObjectReferences < TestCase
@@ -26,6 +26,10 @@ module Psych
assert_reference_trip DateTime.now
end
+ def test_struct_has_references
+ assert_reference_trip Struct.new(:foo).new(1)
+ end
+
def assert_reference_trip obj
yml = Psych.dump([obj, obj])
assert_match(/\*-?\d+/, yml)
diff --git a/test/psych/test_omap.rb b/test/psych/test_omap.rb
index 34df724998..36edc26c49 100644
--- a/test/psych/test_omap.rb
+++ b/test/psych/test_omap.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestOmap < TestCase
diff --git a/test/psych/test_parser.rb b/test/psych/test_parser.rb
index acbdd96f5c..0abe0dd398 100644
--- a/test/psych/test_parser.rb
+++ b/test/psych/test_parser.rb
@@ -1,6 +1,6 @@
# coding: utf-8
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestParser < TestCase
diff --git a/test/psych/test_psych.rb b/test/psych/test_psych.rb
index 543367538a..8054bd6234 100644
--- a/test/psych/test_psych.rb
+++ b/test/psych/test_psych.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
require 'stringio'
require 'tempfile'
@@ -64,11 +64,10 @@ class TestPsych < Psych::TestCase
def test_dump_file
hash = {'hello' => 'TGIF!'}
- Tempfile.open('fun.yml') do |io|
+ Tempfile.create('fun.yml') do |io|
assert_equal io, Psych.dump(hash, io)
io.rewind
assert_equal Psych.dump(hash), io.read
- io.close(true)
end
end
@@ -126,21 +125,21 @@ class TestPsych < Psych::TestCase
end
def test_load_file
- t = Tempfile.new(['yikes', 'yml'])
- t.binmode
- t.write('--- hello world')
- t.close
- assert_equal 'hello world', Psych.load_file(t.path)
- t.close(true)
+ Tempfile.create(['yikes', 'yml']) {|t|
+ t.binmode
+ t.write('--- hello world')
+ t.close
+ assert_equal 'hello world', Psych.load_file(t.path)
+ }
end
def test_parse_file
- t = Tempfile.new(['yikes', 'yml'])
- t.binmode
- t.write('--- hello world')
- t.close
- assert_equal 'hello world', Psych.parse_file(t.path).transform
- t.close(true)
+ Tempfile.create(['yikes', 'yml']) {|t|
+ t.binmode
+ t.write('--- hello world')
+ t.close
+ assert_equal 'hello world', Psych.parse_file(t.path).transform
+ }
end
def test_degenerate_strings
diff --git a/test/psych/test_safe_load.rb b/test/psych/test_safe_load.rb
new file mode 100644
index 0000000000..dd299c0ebf
--- /dev/null
+++ b/test/psych/test_safe_load.rb
@@ -0,0 +1,97 @@
+require 'psych/helper'
+
+module Psych
+ class TestSafeLoad < TestCase
+ class Foo; end
+
+ [1, 2.2, {}, [], "foo"].each do |obj|
+ define_method(:"test_basic_#{obj.class}") do
+ assert_safe_cycle obj
+ end
+ end
+
+ def test_no_recursion
+ x = []
+ x << x
+ assert_raises(Psych::BadAlias) do
+ Psych.safe_load Psych.dump(x)
+ end
+ end
+
+ def test_explicit_recursion
+ x = []
+ x << x
+ assert_equal(x, Psych.safe_load(Psych.dump(x), [], [], true))
+ end
+
+ def test_symbol_whitelist
+ yml = Psych.dump :foo
+ assert_raises(Psych::DisallowedClass) do
+ Psych.safe_load yml
+ end
+ assert_equal(:foo, Psych.safe_load(yml, [Symbol], [:foo]))
+ end
+
+ def test_symbol
+ assert_raises(Psych::DisallowedClass) do
+ assert_safe_cycle :foo
+ end
+ assert_raises(Psych::DisallowedClass) do
+ Psych.safe_load '--- !ruby/symbol foo', []
+ end
+ assert_safe_cycle :foo, [Symbol]
+ assert_safe_cycle :foo, %w{ Symbol }
+ assert_equal :foo, Psych.safe_load('--- !ruby/symbol foo', [Symbol])
+ end
+
+ def test_foo
+ assert_raises(Psych::DisallowedClass) do
+ Psych.safe_load '--- !ruby/object:Foo {}', [Foo]
+ end
+ assert_raises(Psych::DisallowedClass) do
+ assert_safe_cycle Foo.new
+ end
+ assert_kind_of(Foo, Psych.safe_load(Psych.dump(Foo.new), [Foo]))
+ end
+
+ X = Struct.new(:x)
+ def test_struct_depends_on_sym
+ assert_safe_cycle(X.new, [X, Symbol])
+ assert_raises(Psych::DisallowedClass) do
+ cycle X.new, [X]
+ end
+ end
+
+ def test_anon_struct
+ assert Psych.safe_load(<<-eoyml, [Struct, Symbol])
+--- !ruby/struct
+ foo: bar
+ eoyml
+
+ assert_raises(Psych::DisallowedClass) do
+ Psych.safe_load(<<-eoyml, [Struct])
+--- !ruby/struct
+ foo: bar
+ eoyml
+ end
+
+ assert_raises(Psych::DisallowedClass) do
+ Psych.safe_load(<<-eoyml, [Symbol])
+--- !ruby/struct
+ foo: bar
+ eoyml
+ end
+ end
+
+ private
+
+ def cycle object, whitelist = []
+ Psych.safe_load(Psych.dump(object), whitelist)
+ end
+
+ def assert_safe_cycle object, whitelist = []
+ other = cycle object, whitelist
+ assert_equal object, other
+ end
+ end
+end
diff --git a/test/psych/test_scalar.rb b/test/psych/test_scalar.rb
index 3cf6b0938c..e6b76975a6 100644
--- a/test/psych/test_scalar.rb
+++ b/test/psych/test_scalar.rb
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestScalar < TestCase
diff --git a/test/psych/test_scalar_scanner.rb b/test/psych/test_scalar_scanner.rb
index 8483eabc7d..e8e423cb05 100644
--- a/test/psych/test_scalar_scanner.rb
+++ b/test/psych/test_scalar_scanner.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
require 'date'
module Psych
@@ -7,7 +7,7 @@ module Psych
def setup
super
- @ss = Psych::ScalarScanner.new
+ @ss = Psych::ScalarScanner.new ClassLoader.new
end
def test_scan_time
diff --git a/test/psych/test_serialize_subclasses.rb b/test/psych/test_serialize_subclasses.rb
index c8221928a1..f597b7a051 100644
--- a/test/psych/test_serialize_subclasses.rb
+++ b/test/psych/test_serialize_subclasses.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestSerializeSubclasses < TestCase
diff --git a/test/psych/test_set.rb b/test/psych/test_set.rb
index bea67d95b6..921fe2284f 100644
--- a/test/psych/test_set.rb
+++ b/test/psych/test_set.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestSet < TestCase
diff --git a/test/psych/test_stream.rb b/test/psych/test_stream.rb
index beca365608..7e41178e34 100644
--- a/test/psych/test_stream.rb
+++ b/test/psych/test_stream.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestStream < TestCase
diff --git a/test/psych/test_string.rb b/test/psych/test_string.rb
index aa6866b618..1ce16fdf3e 100644
--- a/test/psych/test_string.rb
+++ b/test/psych/test_string.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestString < TestCase
@@ -15,6 +15,54 @@ module Psych
end
end
+ def test_string_with_newline
+ assert_equal "1\n2", Psych.load("--- ! '1\n\n 2'\n")
+ end
+
+ def test_no_doublequotes_with_special_characters
+ assert_equal 2, Psych.dump(%Q{<%= ENV["PATH"] %>}).count('"')
+ end
+
+ def test_doublequotes_when_there_is_a_single
+ yaml = Psych.dump "@123'abc"
+ assert_match(/---\s*"/, yaml)
+ end
+
+ def test_cycle_x
+ str = X.new 'abc'
+ assert_cycle str
+ end
+
+ def test_dash_dot
+ assert_cycle '-.'
+ assert_cycle '+.'
+ end
+
+ def test_string_subclass_with_anchor
+ y = Psych.load <<-eoyml
+---
+body:
+ string: &70121654388580 !ruby/string
+ str: ! 'foo'
+ x:
+ body: *70121654388580
+ eoyml
+ assert_equal({"body"=>{"string"=>"foo", "x"=>{"body"=>"foo"}}}, y)
+ end
+
+ def test_self_referential_string
+ y = Psych.load <<-eoyml
+---
+string: &70121654388580 !ruby/string
+ str: ! 'foo'
+ body: *70121654388580
+ eoyml
+
+ assert_equal({"string"=>"foo"}, y)
+ value = y['string']
+ assert_equal value, value.instance_variable_get(:@body)
+ end
+
def test_another_subclass_with_attributes
y = Psych.load Psych.dump Y.new("foo").tap {|y| y.val = 1}
assert_equal "foo", y
@@ -93,7 +141,7 @@ module Psych
ivar = "on rock and roll"
food.instance_variable_set(:@we_built_this_city, ivar)
- str = Psych.load Psych.dump food
+ Psych.load Psych.dump food
assert_equal ivar, food.instance_variable_get(:@we_built_this_city)
end
diff --git a/test/psych/test_struct.rb b/test/psych/test_struct.rb
index 977aae08ba..8c7f2513ce 100644
--- a/test/psych/test_struct.rb
+++ b/test/psych/test_struct.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
class PsychStructWithIvar < Struct.new(:foo)
attr_reader :bar
diff --git a/test/psych/test_symbol.rb b/test/psych/test_symbol.rb
index 3226141d02..558a672886 100644
--- a/test/psych/test_symbol.rb
+++ b/test/psych/test_symbol.rb
@@ -1,7 +1,15 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestSymbol < TestCase
+ def test_cycle_empty
+ assert_cycle :''
+ end
+
+ def test_cycle_colon
+ assert_cycle :':'
+ end
+
def test_cycle
assert_cycle :a
end
diff --git a/test/psych/test_tainted.rb b/test/psych/test_tainted.rb
index fdcced4cf3..37fc5b2b80 100644
--- a/test/psych/test_tainted.rb
+++ b/test/psych/test_tainted.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestStringTainted < TestCase
@@ -117,14 +117,14 @@ module Psych
class TestIOTainted < TestStringTainted
def assert_taintedness string
- t = Tempfile.new(['something', 'yml'])
- t.binmode
- t.write string
- t.close
- File.open(t.path, 'r:bom|utf-8') { |f|
- @parser.parse f
+ Tempfile.create(['something', 'yml']) {|t|
+ t.binmode
+ t.write string
+ t.close
+ File.open(t.path, 'r:bom|utf-8') { |f|
+ @parser.parse f
+ }
}
- t.close(true)
end
end
end
diff --git a/test/psych/test_to_yaml_properties.rb b/test/psych/test_to_yaml_properties.rb
index 2636becf00..5b4860c435 100644
--- a/test/psych/test_to_yaml_properties.rb
+++ b/test/psych/test_to_yaml_properties.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestToYamlProperties < MiniTest::Unit::TestCase
diff --git a/test/psych/test_tree_builder.rb b/test/psych/test_tree_builder.rb
index 9a134d5a2d..7ad3ddd8a0 100644
--- a/test/psych/test_tree_builder.rb
+++ b/test/psych/test_tree_builder.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
module Psych
class TestTreeBuilder < TestCase
diff --git a/test/psych/test_yaml.rb b/test/psych/test_yaml.rb
index 9891349118..cd3e8ee72c 100644
--- a/test/psych/test_yaml.rb
+++ b/test/psych/test_yaml.rb
@@ -2,7 +2,7 @@
# vim:sw=4:ts=4
# $Id$
#
-require 'psych/helper'
+require_relative 'helper'
require 'ostruct'
# [ruby-core:01946]
@@ -250,7 +250,6 @@ EOY
def test_spec_mapping_between_sequences
# Complex key #1
- dj = Date.new( 2001, 7, 23 )
assert_parse_only(
{ [ 'Detroit Tigers', 'Chicago Cubs' ] => [ Date.new( 2001, 7, 23 ) ],
[ 'New York Yankees', 'Atlanta Braves' ] => [ Date.new( 2001, 7, 2 ), Date.new( 2001, 8, 12 ), Date.new( 2001, 8, 14 ) ] }, <<EOY
@@ -606,7 +605,7 @@ EOY
def test_spec_domain_prefix
customer_proc = proc { |type, val|
if Hash === val
- scheme, domain, type = type.split( ':', 3 )
+ _, _, type = type.split( ':', 3 )
val['type'] = "domain #{type}"
val
else
diff --git a/test/psych/test_yamldbm.rb b/test/psych/test_yamldbm.rb
index d9780035f2..785365841e 100644
--- a/test/psych/test_yamldbm.rb
+++ b/test/psych/test_yamldbm.rb
@@ -1,6 +1,4 @@
-# -*- coding: UTF-8 -*-
-
-require 'psych/helper'
+require_relative 'helper'
require 'tmpdir'
begin
@@ -13,7 +11,6 @@ module Psych
class YAMLDBMTest < TestCase
def setup
- @engine, YAML::ENGINE.yamler = YAML::ENGINE.yamler, 'psych'
@dir = Dir.mktmpdir("rubytest-file")
File.chown(-1, Process.gid, @dir)
@yamldbm_file = make_tmp_filename("yamldbm")
@@ -21,7 +18,6 @@ module Psych
end
def teardown
- YAML::ENGINE.yamler = @engine
@yamldbm.clear
@yamldbm.close
FileUtils.remove_entry_secure @dir
diff --git a/test/psych/test_yamlstore.rb b/test/psych/test_yamlstore.rb
index 5d6fcb79b2..94f1330d37 100644
--- a/test/psych/test_yamlstore.rb
+++ b/test/psych/test_yamlstore.rb
@@ -1,4 +1,4 @@
-require 'psych/helper'
+require_relative 'helper'
require 'yaml/store'
require 'tmpdir'
@@ -7,7 +7,6 @@ module Psych
class YAMLStoreTest < TestCase
def setup
- @engine, YAML::ENGINE.yamler = YAML::ENGINE.yamler, 'psych'
@dir = Dir.mktmpdir("rubytest-file")
File.chown(-1, Process.gid, @dir)
@yamlstore_file = make_tmp_filename("yamlstore")
@@ -15,7 +14,6 @@ module Psych
end
def teardown
- YAML::ENGINE.yamler = @engine
FileUtils.remove_entry_secure @dir
end
diff --git a/test/psych/visitors/test_to_ruby.rb b/test/psych/visitors/test_to_ruby.rb
index ee473c9ba2..c13d980468 100644
--- a/test/psych/visitors/test_to_ruby.rb
+++ b/test/psych/visitors/test_to_ruby.rb
@@ -6,7 +6,7 @@ module Psych
class TestToRuby < TestCase
def setup
super
- @visitor = ToRuby.new
+ @visitor = ToRuby.create
end
def test_object
@@ -18,8 +18,8 @@ module Psych
assert_equal 'bar', o.instance_variable_get(:@foo)
end
- def test_awesome
- Psych.load('1900-01-01T00:00:00+00:00')
+ def test_tz_00_00_loads_without_error
+ assert Psych.load('1900-01-01T00:00:00+00:00')
end
def test_legacy_struct
@@ -88,7 +88,7 @@ description:
end
def test_exception
- exc = Exception.new 'hello'
+ exc = ::Exception.new 'hello'
mapping = Nodes::Mapping.new nil, '!ruby/exception'
mapping.children << Nodes::Scalar.new('message')
diff --git a/test/psych/visitors/test_yaml_tree.rb b/test/psych/visitors/test_yaml_tree.rb
index 496cdd05cc..40702bce79 100644
--- a/test/psych/visitors/test_yaml_tree.rb
+++ b/test/psych/visitors/test_yaml_tree.rb
@@ -5,7 +5,7 @@ module Psych
class TestYAMLTree < TestCase
def setup
super
- @v = Visitors::YAMLTree.new
+ @v = Visitors::YAMLTree.create
end
def test_tree_can_be_called_twice
@@ -18,7 +18,7 @@ module Psych
def test_yaml_tree_can_take_an_emitter
io = StringIO.new
e = Psych::Emitter.new io
- v = Visitors::YAMLTree.new({}, e)
+ v = Visitors::YAMLTree.create({}, e)
v.start
v << "hello world"
v.finish
diff --git a/test/rake/helper.rb b/test/rake/helper.rb
index 9817e8f0cd..992c6bffae 100644
--- a/test/rake/helper.rb
+++ b/test/rake/helper.rb
@@ -2,7 +2,7 @@ require 'rubygems'
$:.unshift File.expand_path('../../lib', __FILE__)
begin
- gem 'minitest'
+ gem 'minitest', '~> 4'
rescue Gem::LoadError
end
@@ -11,10 +11,15 @@ require 'rake'
require 'tmpdir'
require File.expand_path('../file_creation', __FILE__)
+
begin
require_relative '../ruby/envutil'
+ require_relative 'support/ruby_runner'
+ require_relative 'support/rakefile_definitions'
rescue NoMethodError, LoadError
- # for ruby trunk
+ # ruby 1.8
+ require 'test/support/ruby_runner'
+ require 'test/support/rakefile_definitions'
end
class Rake::TestCase < MiniTest::Unit::TestCase
@@ -33,26 +38,30 @@ class Rake::TestCase < MiniTest::Unit::TestCase
test_dir = File.basename File.dirname File.expand_path __FILE__
- @rake_root = if test_dir == 'test' then
- # rake repository
- File.expand_path '../../', __FILE__
- else
- # ruby repository
- File.expand_path '../../../', __FILE__
- end
+ @rake_root =
+ if test_dir == 'test'
+ # rake repository
+ File.expand_path '../../', __FILE__
+ else
+ # ruby repository
+ File.expand_path '../../../', __FILE__
+ end
+
+ @verbose = ENV['VERBOSE']
@rake_exec = File.join @rake_root, 'bin', 'rake'
@rake_lib = File.join @rake_root, 'lib'
-
- @orig_PWD = Dir.pwd
- @orig_APPDATA = ENV['APPDATA']
- @orig_HOME = ENV['HOME']
- @orig_HOMEDRIVE = ENV['HOMEDRIVE']
- @orig_HOMEPATH = ENV['HOMEPATH']
- @orig_RAKE_COLUMNS = ENV['RAKE_COLUMNS']
- @orig_RAKE_SYSTEM = ENV['RAKE_SYSTEM']
- @orig_RAKEOPT = ENV['RAKEOPT']
- @orig_USERPROFILE = ENV['USERPROFILE']
+ @ruby_options = ["-I#{@rake_lib}", "-I."]
+
+ @orig_pwd = Dir.pwd
+ @orig_appdata = ENV['APPDATA']
+ @orig_home = ENV['HOME']
+ @orig_homedrive = ENV['HOMEDRIVE']
+ @orig_homepath = ENV['HOMEPATH']
+ @orig_rake_columns = ENV['RAKE_COLUMNS']
+ @orig_rake_system = ENV['RAKE_SYSTEM']
+ @orig_rakeopt = ENV['RAKEOPT']
+ @orig_userprofile = ENV['USERPROFILE']
ENV.delete 'RAKE_COLUMNS'
ENV.delete 'RAKE_SYSTEM'
ENV.delete 'RAKEOPT'
@@ -70,22 +79,22 @@ class Rake::TestCase < MiniTest::Unit::TestCase
end
def teardown
- Dir.chdir @orig_PWD
+ Dir.chdir @orig_pwd
FileUtils.rm_rf @tempdir
- if @orig_APPDATA then
- ENV['APPDATA'] = @orig_APPDATA
+ if @orig_appdata
+ ENV['APPDATA'] = @orig_appdata
else
ENV.delete 'APPDATA'
end
- ENV['HOME'] = @orig_HOME
- ENV['HOMEDRIVE'] = @orig_HOMEDRIVE
- ENV['HOMEPATH'] = @orig_HOMEPATH
- ENV['RAKE_COLUMNS'] = @orig_RAKE_COLUMNS
- ENV['RAKE_SYSTEM'] = @orig_RAKE_SYSTEM
- ENV['RAKEOPT'] = @orig_RAKEOPT
- ENV['USERPROFILE'] = @orig_USERPROFILE
+ ENV['HOME'] = @orig_home
+ ENV['HOMEDRIVE'] = @orig_homedrive
+ ENV['HOMEPATH'] = @orig_homepath
+ ENV['RAKE_COLUMNS'] = @orig_rake_columns
+ ENV['RAKE_SYSTEM'] = @orig_rake_system
+ ENV['RAKEOPT'] = @orig_rakeopt
+ ENV['USERPROFILE'] = @orig_userprofile
end
def ignore_deprecations
@@ -111,452 +120,11 @@ end
ENV['RAKE_SYSTEM'] = @system_dir
end
- def rakefile contents
+ def rakefile(contents)
open 'Rakefile', 'w' do |io|
io << contents
end
end
- def rakefile_access
- rakefile <<-ACCESS
-TOP_LEVEL_CONSTANT = 0
-
-def a_top_level_function
-end
-
-task :default => [:work, :obj, :const]
-
-task :work do
- begin
- a_top_level_function
- puts "GOOD:M Top level methods can be called in tasks"
- rescue NameError => ex
- puts "BAD:M Top level methods can not be called in tasks"
- end
-end
-
-# TODO: remove `disabled_' when DeprecatedObjectDSL removed
-task :obj
-task :disabled_obj do
- begin
- Object.new.instance_eval { task :xyzzy }
- puts "BAD:D Rake DSL are polluting objects"
- rescue StandardError => ex
- puts "GOOD:D Rake DSL are not polluting objects"
- end
-end
-
-task :const do
- begin
- TOP_LEVEL_CONSTANT
- puts "GOOD:C Top level constants are available in tasks"
- rescue StandardError => ex
- puts "BAD:C Top level constants are NOT available in tasks"
- end
-end
- ACCESS
- end
-
- def rakefile_chains
- rakefile <<-DEFAULT
-task :default => "play.app"
-
-file "play.scpt" => "base" do |t|
- cp t.prerequisites.first, t.name
-end
-
-rule ".app" => ".scpt" do |t|
- cp t.source, t.name
-end
-
-file 'base' do
- touch 'base'
-end
- DEFAULT
- end
-
- def rakefile_comments
- rakefile <<-COMMENTS
-# comment for t1
-task :t1 do
-end
-
-# no comment or task because there's a blank line
-
-task :t2 do
-end
-
-desc "override comment for t3"
-# this is not the description
-multitask :t3 do
-end
-
-# this is not the description
-desc "override comment for t4"
-file :t4 do
-end
- COMMENTS
- end
-
- def rakefile_default
- rakefile <<-DEFAULT
-if ENV['TESTTOPSCOPE']
- puts "TOPSCOPE"
-end
-
-task :default do
- puts "DEFAULT"
-end
-
-task :other => [:default] do
- puts "OTHER"
-end
-
-task :task_scope do
- if ENV['TESTTASKSCOPE']
- puts "TASKSCOPE"
- end
-end
- DEFAULT
- end
-
- def rakefile_dryrun
- rakefile <<-DRYRUN
-task :default => ["temp_main"]
-
-file "temp_main" => [:all_apps] do touch "temp_main" end
-
-task :all_apps => [:one, :two]
-task :one => ["temp_one"]
-task :two => ["temp_two"]
-
-file "temp_one" do |t|
- touch "temp_one"
-end
-file "temp_two" do |t|
- touch "temp_two"
-end
-
-task :clean do
- ["temp_one", "temp_two", "temp_main"].each do |file|
- rm_f file
- end
-end
- DRYRUN
-
- FileUtils.touch 'temp_main'
- FileUtils.touch 'temp_two'
- end
-
- def rakefile_extra
- rakefile 'task :default'
-
- FileUtils.mkdir_p 'rakelib'
-
- open File.join('rakelib', 'extra.rake'), 'w' do |io|
- io << <<-EXTRA_RAKE
-# Added for testing
-
-namespace :extra do
- desc "An Extra Task"
- task :extra do
- puts "Read all about it"
- end
-end
- EXTRA_RAKE
- end
- end
-
- def rakefile_file_creation
- rakefile <<-'FILE_CREATION'
-N = 2
-
-task :default => :run
-
-BUILD_DIR = 'build'
-task :clean do
- rm_rf 'build'
- rm_rf 'src'
-end
-
-task :run
-
-TARGET_DIR = 'build/copies'
-
-FileList['src/*'].each do |src|
- directory TARGET_DIR
- target = File.join TARGET_DIR, File.basename(src)
- file target => [src, TARGET_DIR] do
- cp src, target
- # sleep 3 if src !~ /foo#{N-1}$/ # I'm commenting out this sleep, it doesn't seem to do anything.
- end
- task :run => target
-end
-
-task :prep => :clean do
- mkdir_p 'src'
- N.times do |n|
- touch "src/foo#{n}"
- end
-end
- FILE_CREATION
- end
-
- def rakefile_imports
- rakefile <<-IMPORTS
-require 'rake/loaders/makefile'
-
-task :default
-
-task :other do
- puts "OTHER"
-end
-
-file "dynamic_deps" do |t|
- open(t.name, "w") do |f| f.puts "puts 'DYNAMIC'" end
-end
-
-import "dynamic_deps"
-import "static_deps"
-import "static_deps"
-import "deps.mf"
-puts "FIRST"
- IMPORTS
-
- open 'deps.mf', 'w' do |io|
- io << <<-DEPS
-default: other
- DEPS
- end
-
- open "static_deps", "w" do |f|
- f.puts 'puts "STATIC"'
- end
- end
-
- def rakefile_multidesc
- rakefile <<-MULTIDESC
-task :b
-
-desc "A"
-task :a
-
-desc "B"
-task :b
-
-desc "A2"
-task :a
-
-task :c
-
-desc "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
-task :d
- MULTIDESC
- end
-
- def rakefile_namespace
- rakefile <<-NAMESPACE
-desc "copy"
-task :copy do
- puts "COPY"
-end
-
-namespace "nest" do
- desc "nest copy"
- task :copy do
- puts "NEST COPY"
- end
- task :xx => :copy
-end
-
-anon_ns = namespace do
- desc "anonymous copy task"
- task :copy do
- puts "ANON COPY"
- end
-end
-
-desc "Top level task to run the anonymous version of copy"
-task :anon => anon_ns[:copy]
-
-namespace "very" do
- namespace "nested" do
- task "run" => "rake:copy"
- end
-end
-
-namespace "a" do
- desc "Run task in the 'a' namespace"
- task "run" do
- puts "IN A"
- end
-end
-
-namespace "b" do
- desc "Run task in the 'b' namespace"
- task "run" => "a:run" do
- puts "IN B"
- end
-end
-
-namespace "file1" do
- file "xyz.rb" do
- puts "XYZ1"
- end
-end
-
-namespace "file2" do
- file "xyz.rb" do
- puts "XYZ2"
- end
-end
-
-namespace "scopedep" do
- task :prepare do
- touch "scopedep.rb"
- puts "PREPARE"
- end
- file "scopedep.rb" => [:prepare] do
- puts "SCOPEDEP"
- end
-end
- NAMESPACE
- end
-
- def rakefile_nosearch
- FileUtils.touch 'dummy'
- end
-
- def rakefile_rakelib
- FileUtils.mkdir_p 'rakelib'
-
- Dir.chdir 'rakelib' do
- open 'test1.rb', 'w' do |io|
- io << <<-TEST1
-task :default do
- puts "TEST1"
-end
- TEST1
- end
-
- open 'test2.rake', 'w' do |io|
- io << <<-TEST1
-task :default do
- puts "TEST2"
-end
- TEST1
- end
- end
- end
-
- def rakefile_rbext
- open 'rakefile.rb', 'w' do |io|
- io << 'task :default do puts "OK" end'
- end
- end
-
- def rakefile_unittest
- rakefile '# Empty Rakefile for Unit Test'
-
- readme = File.join 'subdir', 'README'
- FileUtils.mkdir_p File.dirname readme
-
- FileUtils.touch readme
- end
-
- def rakefile_verbose
- rakefile <<-VERBOSE
-task :standalone_verbose_true do
- verbose true
- sh "#{RUBY} -e '0'"
-end
-
-task :standalone_verbose_false do
- verbose false
- sh "#{RUBY} -e '0'"
-end
-
-task :inline_verbose_default do
- sh "#{RUBY} -e '0'"
-end
-
-task :inline_verbose_false do
- sh "#{RUBY} -e '0'", :verbose => false
-end
-
-task :inline_verbose_true do
- sh "#{RUBY} -e '0'", :verbose => true
-end
-
-task :block_verbose_true do
- verbose(true) do
- sh "#{RUBY} -e '0'"
- end
-end
-
-task :block_verbose_false do
- verbose(false) do
- sh "#{RUBY} -e '0'"
- end
-end
- VERBOSE
- end
-
- def rakefile_test_signal
- rakefile <<-TEST_SIGNAL
-require 'rake/testtask'
-
-Rake::TestTask.new(:a) do |t|
- t.test_files = ['a_test.rb']
-end
-
-Rake::TestTask.new(:b) do |t|
- t.test_files = ['b_test.rb']
-end
-
-task :test do
- Rake::Task[:a].invoke
- Rake::Task[:b].invoke
-end
-
-task :default => :test
- TEST_SIGNAL
- open 'a_test.rb', 'w' do |io|
- io << 'puts "ATEST"' << "\n"
- io << '$stdout.flush' << "\n"
- io << 'Process.kill("TERM", $$)' << "\n"
- end
- open 'b_test.rb', 'w' do |io|
- io << 'puts "BTEST"' << "\n"
- io << '$stdout.flush' << "\n"
- end
- end
-
- def rakefile_failing_test_task
- rakefile <<-TEST_TASK
-require 'rake/testtask'
-
-task :default => :test
-Rake::TestTask.new(:test) do |t|
- t.test_files = ['a_test.rb']
-end
- TEST_TASK
- open 'a_test.rb', 'w' do |io|
- io << "require 'minitest/autorun'\n"
- io << "class ExitTaskTest < MiniTest::Unit::TestCase\n"
- io << " def test_exit\n"
- io << " assert false, 'this should fail'\n"
- io << " end\n"
- io << "end\n"
- end
- end
-
- def rakefile_stand_alone_filelist
- open 'stand_alone_filelist.rb', 'w' do |io|
- io << "require 'rake/file_list'\n"
- io << "FL = Rake::FileList['*.rb']\n"
- io << "puts FL\n"
- end
- end
-
+ include RakefileDefinitions
end
diff --git a/test/rake/support/rakefile_definitions.rb b/test/rake/support/rakefile_definitions.rb
new file mode 100644
index 0000000000..d4311425f1
--- /dev/null
+++ b/test/rake/support/rakefile_definitions.rb
@@ -0,0 +1,478 @@
+module RakefileDefinitions
+ include FileUtils
+
+ def rakefile_access
+ rakefile <<-ACCESS
+TOP_LEVEL_CONSTANT = 0
+
+def a_top_level_function
+end
+
+task :default => [:work, :obj, :const]
+
+task :work do
+ begin
+ a_top_level_function
+ puts "GOOD:M Top level methods can be called in tasks"
+ rescue NameError => ex
+ puts "BAD:M Top level methods can not be called in tasks"
+ end
+end
+
+# TODO: remove `disabled_' when DeprecatedObjectDSL removed
+task :obj
+task :disabled_obj do
+ begin
+ Object.new.instance_eval { task :xyzzy }
+ puts "BAD:D Rake DSL are polluting objects"
+ rescue StandardError => ex
+ puts "GOOD:D Rake DSL are not polluting objects"
+ end
+end
+
+task :const do
+ begin
+ TOP_LEVEL_CONSTANT
+ puts "GOOD:C Top level constants are available in tasks"
+ rescue StandardError => ex
+ puts "BAD:C Top level constants are NOT available in tasks"
+ end
+end
+ ACCESS
+ end
+
+ def rakefile_test_task
+ rakefile <<-RAKEFILE
+ require "rake/testtask"
+
+ Rake::TestTask.new(:unit) do |t|
+ t.description = "custom test task description"
+ end
+ RAKEFILE
+ end
+
+ def rakefile_chains
+ rakefile <<-DEFAULT
+task :default => "play.app"
+
+file "play.scpt" => "base" do |t|
+ cp t.prerequisites.first, t.name
+end
+
+rule ".app" => ".scpt" do |t|
+ cp t.source, t.name
+end
+
+file 'base' do
+ touch 'base'
+end
+ DEFAULT
+ end
+
+ def rakefile_comments
+ rakefile <<-COMMENTS
+# comment for t1
+task :t1 do
+end
+
+# no comment or task because there's a blank line
+
+task :t2 do
+end
+
+desc "override comment for t3"
+# this is not the description
+multitask :t3 do
+end
+
+# this is not the description
+desc "override comment for t4"
+file :t4 do
+end
+ COMMENTS
+ end
+
+ def rakefile_default
+ rakefile <<-DEFAULT
+if ENV['TESTTOPSCOPE']
+ puts "TOPSCOPE"
+end
+
+task :default do
+ puts "DEFAULT"
+end
+
+task :other => [:default] do
+ puts "OTHER"
+end
+
+task :task_scope do
+ if ENV['TESTTASKSCOPE']
+ puts "TASKSCOPE"
+ end
+end
+ DEFAULT
+ end
+
+ def rakefile_dryrun
+ rakefile <<-DRYRUN
+task :default => ["temp_main"]
+
+file "temp_main" => [:all_apps] do touch "temp_main" end
+
+task :all_apps => [:one, :two]
+task :one => ["temp_one"]
+task :two => ["temp_two"]
+
+file "temp_one" do |t|
+ touch "temp_one"
+end
+file "temp_two" do |t|
+ touch "temp_two"
+end
+
+task :clean do
+ ["temp_one", "temp_two", "temp_main"].each do |file|
+ rm_f file
+ end
+end
+ DRYRUN
+
+ FileUtils.touch 'temp_main'
+ FileUtils.touch 'temp_two'
+ end
+
+ def rakefile_extra
+ rakefile 'task :default'
+
+ FileUtils.mkdir_p 'rakelib'
+
+ open File.join('rakelib', 'extra.rake'), 'w' do |io|
+ io << <<-EXTRA_RAKE
+# Added for testing
+
+namespace :extra do
+ desc "An Extra Task"
+ task :extra do
+ puts "Read all about it"
+ end
+end
+ EXTRA_RAKE
+ end
+ end
+
+ def rakefile_file_creation
+ rakefile <<-'FILE_CREATION'
+N = 2
+
+task :default => :run
+
+BUILD_DIR = 'build'
+task :clean do
+ rm_rf 'build'
+ rm_rf 'src'
+end
+
+task :run
+
+TARGET_DIR = 'build/copies'
+
+FileList['src/*'].each do |src|
+ directory TARGET_DIR
+ target = File.join TARGET_DIR, File.basename(src)
+ file target => [src, TARGET_DIR] do
+ cp src, target
+ end
+ task :run => target
+end
+
+task :prep => :clean do
+ mkdir_p 'src'
+ N.times do |n|
+ touch "src/foo#{n}"
+ end
+end
+ FILE_CREATION
+ end
+
+ def rakefile_imports
+ rakefile <<-IMPORTS
+require 'rake/loaders/makefile'
+
+task :default
+
+task :other do
+ puts "OTHER"
+end
+
+file "dynamic_deps" do |t|
+ open(t.name, "w") do |f| f.puts "puts 'DYNAMIC'" end
+end
+
+import "dynamic_deps"
+import "static_deps"
+import "static_deps"
+import "deps.mf"
+puts "FIRST"
+ IMPORTS
+
+ open 'deps.mf', 'w' do |io|
+ io << <<-DEPS
+default: other
+ DEPS
+ end
+
+ open "static_deps", "w" do |f|
+ f.puts 'puts "STATIC"'
+ end
+ end
+
+ def rakefile_regenerate_imports
+ rakefile <<-REGENERATE_IMPORTS
+task :default
+
+task :regenerate do
+ open("deps", "w") do |f|
+ f << <<-CONTENT
+file "deps" => :regenerate
+puts "REGENERATED"
+ CONTENT
+ end
+end
+
+import "deps"
+ REGENERATE_IMPORTS
+
+ open "deps", "w" do |f|
+ f << <<-CONTENT
+file "deps" => :regenerate
+puts "INITIAL"
+ CONTENT
+ end
+ end
+
+ def rakefile_multidesc
+ rakefile <<-MULTIDESC
+task :b
+
+desc "A"
+task :a
+
+desc "B"
+task :b
+
+desc "A2"
+task :a
+
+task :c
+
+desc "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
+task :d
+ MULTIDESC
+ end
+
+ def rakefile_namespace
+ rakefile <<-NAMESPACE
+desc "copy"
+task :copy do
+ puts "COPY"
+end
+
+namespace "nest" do
+ desc "nest copy"
+ task :copy do
+ puts "NEST COPY"
+ end
+ task :xx => :copy
+end
+
+anon_ns = namespace do
+ desc "anonymous copy task"
+ task :copy do
+ puts "ANON COPY"
+ end
+end
+
+desc "Top level task to run the anonymous version of copy"
+task :anon => anon_ns[:copy]
+
+namespace "very" do
+ namespace "nested" do
+ task "run" => "rake:copy"
+ end
+end
+
+namespace "a" do
+ desc "Run task in the 'a' namespace"
+ task "run" do
+ puts "IN A"
+ end
+end
+
+namespace "b" do
+ desc "Run task in the 'b' namespace"
+ task "run" => "a:run" do
+ puts "IN B"
+ end
+end
+
+namespace "file1" do
+ file "xyz.rb" do
+ puts "XYZ1"
+ end
+end
+
+namespace "file2" do
+ file "xyz.rb" do
+ puts "XYZ2"
+ end
+end
+
+namespace "scopedep" do
+ task :prepare do
+ touch "scopedep.rb"
+ puts "PREPARE"
+ end
+ file "scopedep.rb" => [:prepare] do
+ puts "SCOPEDEP"
+ end
+end
+ NAMESPACE
+ end
+
+ def rakefile_nosearch
+ FileUtils.touch 'dummy'
+ end
+
+ def rakefile_rakelib
+ FileUtils.mkdir_p 'rakelib'
+
+ Dir.chdir 'rakelib' do
+ open 'test1.rb', 'w' do |io|
+ io << <<-TEST1
+task :default do
+ puts "TEST1"
+end
+ TEST1
+ end
+
+ open 'test2.rake', 'w' do |io|
+ io << <<-TEST1
+task :default do
+ puts "TEST2"
+end
+ TEST1
+ end
+ end
+ end
+
+ def rakefile_rbext
+ open 'rakefile.rb', 'w' do |io|
+ io << 'task :default do puts "OK" end'
+ end
+ end
+
+ def rakefile_unittest
+ rakefile '# Empty Rakefile for Unit Test'
+
+ readme = File.join 'subdir', 'README'
+ FileUtils.mkdir_p File.dirname readme
+
+ FileUtils.touch readme
+ end
+
+ def rakefile_verbose
+ rakefile <<-VERBOSE
+task :standalone_verbose_true do
+ verbose true
+ sh "#{RUBY} -e '0'"
+end
+
+task :standalone_verbose_false do
+ verbose false
+ sh "#{RUBY} -e '0'"
+end
+
+task :inline_verbose_default do
+ sh "#{RUBY} -e '0'"
+end
+
+task :inline_verbose_false do
+ sh "#{RUBY} -e '0'", :verbose => false
+end
+
+task :inline_verbose_true do
+ sh "#{RUBY} -e '0'", :verbose => true
+end
+
+task :block_verbose_true do
+ verbose(true) do
+ sh "#{RUBY} -e '0'"
+ end
+end
+
+task :block_verbose_false do
+ verbose(false) do
+ sh "#{RUBY} -e '0'"
+ end
+end
+ VERBOSE
+ end
+
+ def rakefile_test_signal
+ rakefile <<-TEST_SIGNAL
+require 'rake/testtask'
+
+Rake::TestTask.new(:a) do |t|
+ t.test_files = ['a_test.rb']
+end
+
+Rake::TestTask.new(:b) do |t|
+ t.test_files = ['b_test.rb']
+end
+
+task :test do
+ Rake::Task[:a].invoke
+ Rake::Task[:b].invoke
+end
+
+task :default => :test
+ TEST_SIGNAL
+ open 'a_test.rb', 'w' do |io|
+ io << 'puts "ATEST"' << "\n"
+ io << '$stdout.flush' << "\n"
+ io << 'Process.kill("TERM", $$)' << "\n"
+ end
+ open 'b_test.rb', 'w' do |io|
+ io << 'puts "BTEST"' << "\n"
+ io << '$stdout.flush' << "\n"
+ end
+ end
+
+ def rakefile_failing_test_task
+ rakefile <<-TEST_TASK
+require 'rake/testtask'
+
+task :default => :test
+Rake::TestTask.new(:test) do |t|
+ t.test_files = ['a_test.rb']
+end
+ TEST_TASK
+ open 'a_test.rb', 'w' do |io|
+ io << "require 'minitest/autorun'\n"
+ io << "class ExitTaskTest < MiniTest::Unit::TestCase\n"
+ io << " def test_exit\n"
+ io << " assert false, 'this should fail'\n"
+ io << " end\n"
+ io << "end\n"
+ end
+ end
+
+ def rakefile_stand_alone_filelist
+ open 'stand_alone_filelist.rb', 'w' do |io|
+ io << "require 'rake/file_list'\n"
+ io << "FL = Rake::FileList['*.rb']\n"
+ io << "puts FL\n"
+ end
+ end
+end
diff --git a/test/rake/support/ruby_runner.rb b/test/rake/support/ruby_runner.rb
new file mode 100644
index 0000000000..d51dd24b89
--- /dev/null
+++ b/test/rake/support/ruby_runner.rb
@@ -0,0 +1,34 @@
+module RubyRunner
+ include FileUtils
+
+ # Run a shell Ruby command with command line options (using the
+ # default test options). Output is captured in @out and @err
+ def ruby(*option_list)
+ run_ruby(@ruby_options + option_list)
+ end
+
+ # Run a command line rake with the give rake options. Default
+ # command line ruby options are included. Output is captured in
+ # @out and @err
+ def rake(*rake_options)
+ run_ruby @ruby_options + [@rake_exec] + rake_options
+ end
+
+ # Low level ruby command runner ...
+ def run_ruby(option_list)
+ puts "COMMAND: [#{RUBY} #{option_list.join ' '}]" if @verbose
+
+ Open3.popen3(RUBY, *option_list) {|inn, out, err, wait|
+ inn.close
+
+ @exit = wait ? wait.value : $?
+ @out = out.read
+ @err = err.read
+ }
+
+ puts "OUTPUT: [#{@out}]" if @verbose
+ puts "ERROR: [#{@err}]" if @verbose
+ puts "EXIT: [#{@exit.inspect}]" if @verbose
+ puts "PWD: [#{Dir.pwd}]" if @verbose
+ end
+end
diff --git a/test/rake/test_rake_application.rb b/test/rake/test_rake_application.rb
index f2358552c8..f52040471b 100644
--- a/test/rake/test_rake_application.rb
+++ b/test/rake/test_rake_application.rb
@@ -9,11 +9,79 @@ class TestRakeApplication < Rake::TestCase
@app.options.rakelib = []
end
- def test_constant_warning
- _, err = capture_io do @app.instance_eval { const_warning("Task") } end
- assert_match(/warning/i, err)
- assert_match(/deprecated/i, err)
- assert_match(/Task/i, err)
+ def setup_command_line(*options)
+ ARGV.clear
+ options.each do |option|
+ ARGV << option
+ end
+ end
+
+ def test_display_exception_details
+ obj = Object.new
+ obj.instance_eval("def #{__method__}; raise 'test'; end", "ruby")
+ begin
+ obj.__send__(__method__)
+ rescue => ex
+ end
+
+ out, err = capture_io do
+ @app.display_error_message ex
+ end
+
+ assert_empty out
+
+ assert_match 'rake aborted!', err
+ assert_match __method__.to_s, err
+ end
+
+ def test_display_exception_details_cause
+ skip 'Exception#cause not implemented' unless
+ Exception.method_defined? :cause
+
+ begin
+ raise 'cause a'
+ rescue
+ begin
+ raise 'cause b'
+ rescue => ex
+ end
+ end
+
+ out, err = capture_io do
+ @app.display_error_message ex
+ end
+
+ assert_empty out
+
+ assert_match 'cause a', err
+ assert_match 'cause b', err
+ end
+
+ def test_display_exception_details_cause_loop
+ skip 'Exception#cause not implemented' unless
+ Exception.method_defined? :cause
+
+ begin
+ begin
+ raise 'cause a'
+ rescue => a
+ begin
+ raise 'cause b'
+ rescue
+ raise a
+ end
+ end
+ rescue => ex
+ end
+
+ out, err = capture_io do
+ @app.display_error_message ex
+ end
+
+ assert_empty out
+
+ assert_match 'cause a', err
+ assert_match 'cause b', err
end
def test_display_tasks
@@ -30,13 +98,14 @@ class TestRakeApplication < Rake::TestCase
@app.terminal_columns = 80
@app.options.show_tasks = :tasks
@app.options.show_task_pattern = //
- @app.last_description = "1234567890" * 8
+ numbers = "1234567890" * 8
+ @app.last_description = numbers
@app.define_task(Rake::Task, "t")
out, = capture_io do @app.instance_eval { display_tasks_and_comments } end
assert_match(/^rake t/, out)
- assert_match(/# 12345678901234567890123456789012345678901234567890123456789012345\.\.\./, out)
+ assert_match(/# #{numbers[0, 65]}\.\.\./, out)
end
def test_display_tasks_with_task_name_wider_than_tty_display
@@ -45,7 +114,7 @@ class TestRakeApplication < Rake::TestCase
@app.options.show_task_pattern = //
task_name = "task name" * 80
@app.last_description = "something short"
- @app.define_task(Rake::Task, task_name )
+ @app.define_task(Rake::Task, task_name)
out, = capture_io do @app.instance_eval { display_tasks_and_comments } end
@@ -60,7 +129,7 @@ class TestRakeApplication < Rake::TestCase
description = "something short"
task_name = "task name" * 80
@app.last_description = "something short"
- @app.define_task(Rake::Task, task_name )
+ @app.define_task(Rake::Task, task_name)
out, = capture_io do @app.instance_eval { display_tasks_and_comments } end
@@ -79,18 +148,19 @@ class TestRakeApplication < Rake::TestCase
assert_match(/# #{@app.last_description}/, out)
end
- def test_display_tasks_with_long_comments_to_a_non_tty_with_columns_set_truncates_comments
+ def test_truncating_comments_to_a_non_tty
@app.terminal_columns = 80
@app.options.show_tasks = :tasks
@app.options.show_task_pattern = //
@app.tty_output = false
- @app.last_description = "1234567890" * 8
+ numbers = "1234567890" * 8
+ @app.last_description = numbers
@app.define_task(Rake::Task, "t")
out, = capture_io do @app.instance_eval { display_tasks_and_comments } end
assert_match(/^rake t/, out)
- assert_match(/# 12345678901234567890123456789012345678901234567890123456789012345\.\.\./, out)
+ assert_match(/# #{numbers[0, 65]}\.\.\./, out)
end
def test_describe_tasks
@@ -121,7 +191,7 @@ class TestRakeApplication < Rake::TestCase
def test_not_finding_rakefile
@app.instance_eval { @rakefiles = ['NEVER_FOUND'] }
- assert( ! @app.instance_eval do have_rakefile end )
+ assert(! @app.instance_eval do have_rakefile end)
assert_nil @app.rakefile
end
@@ -198,6 +268,7 @@ class TestRakeApplication < Rake::TestCase
end
def test_load_rakefile_not_found
+ ARGV.clear
Dir.chdir @tempdir
ENV['RAKE_SYSTEM'] = 'not_exist'
@@ -206,8 +277,11 @@ class TestRakeApplication < Rake::TestCase
options.silent = true
end
+
ex = assert_raises(RuntimeError) do
- @app.instance_eval do raw_load_rakefile end
+ @app.instance_eval do
+ raw_load_rakefile
+ end
end
assert_match(/no rakefile found/i, ex.message)
@@ -252,7 +326,7 @@ class TestRakeApplication < Rake::TestCase
end
def test_terminal_columns
- old_RAKE_COLUMNS = ENV['RAKE_COLUMNS']
+ old_rake_columns = ENV['RAKE_COLUMNS']
ENV['RAKE_COLUMNS'] = '42'
@@ -260,10 +334,10 @@ class TestRakeApplication < Rake::TestCase
assert_equal 42, app.terminal_columns
ensure
- if old_RAKE_COLUMNS then
+ if old_rake_columns
ENV['RAKE_COLUMNS'].delete
else
- ENV['RAKE_COLUMNS'] = old_RAKE_COLUMNS
+ ENV['RAKE_COLUMNS'] = old_rake_columns
end
end
@@ -296,12 +370,11 @@ class TestRakeApplication < Rake::TestCase
# HACK no assertions
end
- def test_handle_options_should_strip_options_from_ARGV
+ def test_handle_options_should_strip_options_from_argv
assert !@app.options.trace
valid_option = '--trace'
- ARGV.clear
- ARGV << valid_option
+ setup_command_line(valid_option)
@app.handle_options
@@ -310,8 +383,7 @@ class TestRakeApplication < Rake::TestCase
end
def test_handle_options_trace_default_is_stderr
- ARGV.clear
- ARGV << "--trace"
+ setup_command_line("--trace")
@app.handle_options
@@ -320,8 +392,7 @@ class TestRakeApplication < Rake::TestCase
end
def test_handle_options_trace_overrides_to_stdout
- ARGV.clear
- ARGV << "--trace=stdout"
+ setup_command_line("--trace=stdout")
@app.handle_options
@@ -332,8 +403,7 @@ class TestRakeApplication < Rake::TestCase
def test_handle_options_trace_does_not_eat_following_task_names
assert !@app.options.trace
- ARGV.clear
- ARGV << "--trace" << "sometask"
+ setup_command_line("--trace", "sometask")
@app.handle_options
assert ARGV.include?("sometask")
@@ -364,8 +434,7 @@ class TestRakeApplication < Rake::TestCase
def test_display_task_run
ran = false
- ARGV.clear
- ARGV << '-f' << '-s' << '--tasks' << '--rakelib=""'
+ setup_command_line('-f', '-s', '--tasks', '--rakelib=""')
@app.last_description = "COMMENT"
@app.define_task(Rake::Task, "default")
out, = capture_io { @app.run }
@@ -377,8 +446,7 @@ class TestRakeApplication < Rake::TestCase
def test_display_prereqs
ran = false
- ARGV.clear
- ARGV << '-f' << '-s' << '--prereqs' << '--rakelib=""'
+ setup_command_line('-f', '-s', '--prereqs', '--rakelib=""')
@app.last_description = "COMMENT"
t = @app.define_task(Rake::Task, "default")
t.enhance([:a, :b])
@@ -394,44 +462,99 @@ class TestRakeApplication < Rake::TestCase
def test_bad_run
@app.intern(Rake::Task, "default").enhance { fail }
- ARGV.clear
- ARGV << '-f' << '-s' << '--rakelib=""'
- assert_raises(SystemExit) {
- _, err = capture_io { @app.run }
- assert_match(/see full trace/, err)
+ setup_command_line('-f', '-s', '--rakelib=""')
+ _, err = capture_io {
+ assert_raises(SystemExit){ @app.run }
}
+ assert_match(/see full trace/i, err)
ensure
ARGV.clear
end
def test_bad_run_with_trace
@app.intern(Rake::Task, "default").enhance { fail }
- ARGV.clear
- ARGV << '-f' << '-s' << '-t'
- assert_raises(SystemExit) {
- _, err = capture_io { @app.run }
- refute_match(/see full trace/, err)
+ setup_command_line('-f', '-s', '-t')
+ _, err = capture_io {
+ assert_raises(SystemExit) { @app.run }
}
+ refute_match(/see full trace/i, err)
ensure
ARGV.clear
end
def test_bad_run_with_backtrace
@app.intern(Rake::Task, "default").enhance { fail }
+ setup_command_line('-f', '-s', '--backtrace')
+ _, err = capture_io {
+ assert_raises(SystemExit) {
+ @app.run
+ }
+ }
+ refute_match(/see full trace/, err)
+ ensure
ARGV.clear
- ARGV << '-f' << '-s' << '--backtrace'
- assert_raises(SystemExit) {
- _, err = capture_io { @app.run }
- refute_match(/see full trace/, err)
+ end
+
+ CustomError = Class.new(RuntimeError)
+
+ def test_bad_run_includes_exception_name
+ @app.intern(Rake::Task, "default").enhance {
+ raise CustomError, "intentional"
+ }
+ setup_command_line('-f', '-s')
+ _, err = capture_io {
+ assert_raises(SystemExit) {
+ @app.run
+ }
}
+ assert_match(/CustomError: intentional/, err)
+ end
+
+ def test_rake_error_excludes_exception_name
+ @app.intern(Rake::Task, "default").enhance {
+ fail "intentional"
+ }
+ setup_command_line('-f', '-s')
+ _, err = capture_io {
+ assert_raises(SystemExit) {
+ @app.run
+ }
+ }
+ refute_match(/RuntimeError/, err)
+ assert_match(/intentional/, err)
+ end
+
+ def cause_supported?
+ ex = StandardError.new
+ ex.respond_to?(:cause)
+ end
+
+ def test_printing_original_exception_cause
+ custom_error = Class.new(StandardError)
+ @app.intern(Rake::Task, "default").enhance {
+ begin
+ raise custom_error, "Original Error"
+ rescue custom_error
+ raise custom_error, "Secondary Error"
+ end
+ }
+ setup_command_line('-f', '-s')
+ _ ,err = capture_io {
+ assert_raises(SystemExit) {
+ @app.run
+ }
+ }
+ if cause_supported?
+ assert_match(/Original Error/, err)
+ end
+ assert_match(/Secondary Error/, err)
ensure
ARGV.clear
end
def test_run_with_bad_options
@app.intern(Rake::Task, "default").enhance { fail }
- ARGV.clear
- ARGV << '-f' << '-s' << '--xyzzy'
+ setup_command_line('-f', '-s', '--xyzzy')
assert_raises(SystemExit) {
capture_io { @app.run }
}
@@ -439,15 +562,6 @@ class TestRakeApplication < Rake::TestCase
ARGV.clear
end
- def test_deprecation_message
- _, err = capture_io do
- @app.deprecate("a", "b", "c")
- end
- assert_match(/'a' is deprecated/i, err)
- assert_match(/use 'b' instead/i, err)
- assert_match(/at c$/i, err)
- end
-
def test_standard_exception_handling_invalid_option
out, err = capture_io do
e = assert_raises SystemExit do
@@ -514,14 +628,12 @@ class TestRakeApplication < Rake::TestCase
loader.instance_variable_set :@load_called, false
def loader.load arg
- raise 'called more than once' if @load_called
raise ArgumentError, arg unless arg == 'x.dummy'
@load_called = true
end
loader.instance_variable_set :@make_dummy_called, false
def loader.make_dummy
- raise 'called more than once' if @make_dummy_called
@make_dummy_called = true
end
diff --git a/test/rake/test_rake_application_options.rb b/test/rake/test_rake_application_options.rb
index 6a8aba652b..a9ae4d9c00 100644
--- a/test/rake/test_rake_application_options.rb
+++ b/test/rake/test_rake_application_options.rb
@@ -1,6 +1,6 @@
require File.expand_path('../helper', __FILE__)
-TESTING_REQUIRE = [ ]
+TESTING_REQUIRE = []
class TestRakeApplicationOptions < Rake::TestCase
@@ -22,15 +22,12 @@ class TestRakeApplicationOptions < Rake::TestCase
end
def clear_argv
- while ! ARGV.empty?
- ARGV.pop
- end
+ ARGV.pop until ARGV.empty?
end
def test_default_options
opts = command_line
assert_nil opts.backtrace
- assert_nil opts.classic_namespace
assert_nil opts.dryrun
assert_nil opts.ignore_system
assert_nil opts.load_system
@@ -114,14 +111,23 @@ class TestRakeApplicationOptions < Rake::TestCase
end
def test_jobs
+ flags([]) do |opts|
+ assert_nil opts.thread_pool_size
+ end
+ flags(['--jobs', '0'], ['-j', '0']) do |opts|
+ assert_equal 0, opts.thread_pool_size
+ end
+ flags(['--jobs', '1'], ['-j', '1']) do |opts|
+ assert_equal 0, opts.thread_pool_size
+ end
flags(['--jobs', '4'], ['-j', '4']) do |opts|
- assert_equal 4, opts.thread_pool_size
+ assert_equal 3, opts.thread_pool_size
end
flags(['--jobs', 'asdas'], ['-j', 'asdas']) do |opts|
- assert_equal 2, opts.thread_pool_size
+ assert_equal Rake.suggested_thread_count-1, opts.thread_pool_size
end
flags('--jobs', '-j') do |opts|
- assert_equal 2, opts.thread_pool_size
+ assert opts.thread_pool_size > 1_000_000, "thread pool size should be huge (was #{opts.thread_pool_size})"
end
end
@@ -147,7 +153,11 @@ class TestRakeApplicationOptions < Rake::TestCase
def test_rakelib
dirs = %w(A B C).join(File::PATH_SEPARATOR)
- flags(['--rakelibdir', dirs], ["--rakelibdir=#{dirs}"], ['-R', dirs], ["-R#{dirs}"]) do |opts|
+ flags(
+ ['--rakelibdir', dirs],
+ ["--rakelibdir=#{dirs}"],
+ ['-R', dirs],
+ ["-R#{dirs}"]) do |opts|
assert_equal ['A', 'B', 'C'], opts.rakelib
end
end
@@ -186,9 +196,10 @@ class TestRakeApplicationOptions < Rake::TestCase
end
def test_quiet
+ Rake::FileUtilsExt.verbose_flag = true
flags('--quiet', '-q') do |opts|
- assert ! Rake::FileUtilsExt.verbose_flag
- assert ! opts.silent
+ assert ! Rake::FileUtilsExt.verbose_flag, "verbose flag shoud be false"
+ assert ! opts.silent, "should not be silent"
end
end
@@ -199,9 +210,10 @@ class TestRakeApplicationOptions < Rake::TestCase
end
def test_silent
+ Rake::FileUtilsExt.verbose_flag = true
flags('--silent', '-s') do |opts|
- assert ! Rake::FileUtilsExt.verbose_flag
- assert opts.silent
+ assert ! Rake::FileUtilsExt.verbose_flag, "verbose flag should be false"
+ assert opts.silent, "should be silent"
end
end
@@ -353,18 +365,16 @@ class TestRakeApplicationOptions < Rake::TestCase
end
def test_verbose
- out, = capture_io do
- flags('--verbose', '-V') do |opts|
- assert Rake::FileUtilsExt.verbose_flag
- assert ! opts.silent
+ capture_io do
+ flags('--verbose', '-v') do |opts|
+ assert Rake::FileUtilsExt.verbose_flag, "verbose should be true"
+ assert ! opts.silent, "opts should not be silent"
end
end
-
- assert_equal "rake, version #{Rake::VERSION}\n", out
end
def test_version
- out, = capture_io do
+ out, _ = capture_io do
flags '--version', '-V'
end
@@ -373,22 +383,6 @@ class TestRakeApplicationOptions < Rake::TestCase
assert_equal :exit, @exit
end
- def test_classic_namespace
- _, err = capture_io do
- flags(['--classic-namespace'],
- ['-C', '-T', '-P', '-n', '-s', '-t']) do |opts|
- assert opts.classic_namespace
- assert_equal opts.show_tasks, $show_tasks
- assert_equal opts.show_prereqs, $show_prereqs
- assert_equal opts.trace, $trace
- assert_equal opts.dryrun, $dryrun
- assert_equal opts.silent, $silent
- end
- end
-
- assert_match(/deprecated/, err)
- end
-
def test_bad_option
_, err = capture_io do
ex = assert_raises(OptionParser::InvalidOption) do
@@ -418,9 +412,21 @@ class TestRakeApplicationOptions < Rake::TestCase
def test_environment_definition
ENV.delete('TESTKEY')
- command_line("a", "TESTKEY=12")
- assert_equal ["a"], @tasks.sort
- assert '12', ENV['TESTKEY']
+ command_line("TESTKEY=12")
+ assert_equal '12', ENV['TESTKEY']
+ end
+
+ def test_multiline_environment_definition
+ ENV.delete('TESTKEY')
+ command_line("TESTKEY=a\nb\n")
+ assert_equal "a\nb\n", ENV['TESTKEY']
+ end
+
+ def test_environment_and_tasks_together
+ ENV.delete('TESTKEY')
+ command_line("a", "b", "TESTKEY=12")
+ assert_equal ["a", "b"], @tasks.sort
+ assert_equal '12', ENV['TESTKEY']
end
def test_rake_explicit_task_library
@@ -452,7 +458,7 @@ class TestRakeApplicationOptions < Rake::TestCase
end
@app.instance_eval do
handle_options
- collect_tasks
+ collect_command_line_tasks
end
@tasks = @app.top_level_tasks
@app.options
diff --git a/test/rake/test_rake_backtrace.rb b/test/rake/test_rake_backtrace.rb
index cfd58f2aac..78eaa8d52d 100644
--- a/test/rake/test_rake_backtrace.rb
+++ b/test/rake/test_rake_backtrace.rb
@@ -1,24 +1,53 @@
require File.expand_path('../helper', __FILE__)
require 'open3'
+class TestBacktraceSuppression < Rake::TestCase
+ def test_bin_rake_suppressed
+ paths = ["something/bin/rake:12"]
+
+ actual = Rake::Backtrace.collapse(paths)
+
+ assert_equal [], actual
+ end
+
+ def test_system_dir_suppressed
+ path = RbConfig::CONFIG['rubylibprefix']
+ skip if path.nil?
+ path = File.expand_path path
+
+ paths = [path + ":12"]
+
+ actual = Rake::Backtrace.collapse(paths)
+
+ assert_equal [], actual
+ end
+
+ def test_near_system_dir_isnt_suppressed
+ path = RbConfig::CONFIG['rubylibprefix']
+ skip if path.nil?
+ path = File.expand_path path
+
+ paths = [" " + path + ":12"]
+
+ actual = Rake::Backtrace.collapse(paths)
+
+ assert_equal paths, actual
+ end
+end
+
class TestRakeBacktrace < Rake::TestCase
+ include RubyRunner
def setup
super
skip 'tmpdir is suppressed in backtrace' if
- Dir.pwd =~ Rake::Backtrace::SUPPRESS_PATTERN
- end
-
- # TODO: factor out similar code in test_rake_functional.rb
- def rake(*args)
- Open3.popen3(RUBY, "-I", @rake_lib, @rake_exec, *args) { |_, _, err, _|
- err.read
- }
+ Rake::Backtrace::SUPPRESS_PATTERN =~ Dir.pwd
end
- def invoke(task_name)
- rake task_name.to_s
+ def invoke(*args)
+ rake(*args)
+ @err
end
def test_single_collapse
@@ -28,7 +57,7 @@ class TestRakeBacktrace < Rake::TestCase
end
}
- lines = invoke(:foo).split("\n")
+ lines = invoke("foo").split("\n")
assert_equal "rake aborted!", lines[0]
assert_equal "foooo!", lines[1]
@@ -46,7 +75,7 @@ class TestRakeBacktrace < Rake::TestCase
end
}
- lines = invoke(:foo).split("\n")
+ lines = invoke("foo").split("\n")
assert_equal "rake aborted!", lines[0]
assert_equal "barrr!", lines[1]
@@ -62,12 +91,12 @@ class TestRakeBacktrace < Rake::TestCase
end
}
- lines = rake("baz").split("\n")
+ lines = invoke("baz").split("\n")
assert_equal "rake aborted!", lines[0]
assert_equal "bazzz!", lines[1]
assert_something_matches %r!Rakefile!i, lines
- lines = rake("--suppress-backtrace", ".ak.file", "baz").split("\n")
+ lines = invoke("--suppress-backtrace", ".ak.file", "baz").split("\n")
assert_equal "rake aborted!", lines[0]
assert_equal "bazzz!", lines[1]
refute_match %r!Rakefile!i, lines[2]
@@ -83,7 +112,8 @@ class TestRakeBacktrace < Rake::TestCase
return
end
end
- flunk "expected #{pattern.inspect} to match something in:\n #{lines.join("\n ")}"
+ flunk "expected #{pattern.inspect} to match something in:\n" +
+ "#{lines.join("\n ")}"
end
end
diff --git a/test/rake/test_rake_clean.rb b/test/rake/test_rake_clean.rb
index 1541c69359..0bce7bc0b1 100644
--- a/test/rake/test_rake_clean.rb
+++ b/test/rake/test_rake_clean.rb
@@ -2,13 +2,60 @@ require File.expand_path('../helper', __FILE__)
require 'rake/clean'
class TestRakeClean < Rake::TestCase
- include Rake
def test_clean
load 'rake/clean.rb', true
- assert Task['clean'], "Should define clean"
- assert Task['clobber'], "Should define clobber"
- assert Task['clobber'].prerequisites.include?("clean"),
+ assert Rake::Task['clean'], "Should define clean"
+ assert Rake::Task['clobber'], "Should define clobber"
+ assert Rake::Task['clobber'].prerequisites.include?("clean"),
"Clobber should require clean"
end
+
+ def test_cleanup
+ file_name = create_undeletable_file
+
+ out, _ = capture_io do
+ Rake::Cleaner.cleanup(file_name, :verbose => false)
+ end
+ assert_match(/failed to remove/i, out)
+
+ ensure
+ remove_undeletable_file
+ end
+
+ def test_cleanup_ignores_missing_files
+ file_name = File.join(@tempdir, "missing_directory", "no_such_file")
+
+ out, _ = capture_io do
+ Rake::Cleaner.cleanup(file_name, :verbose => false)
+ end
+ refute_match(/failed to remove/i, out)
+ end
+
+ private
+
+ def create_undeletable_file
+ dir_name = File.join(@tempdir, "deletedir")
+ file_name = File.join(dir_name, "deleteme")
+ FileUtils.mkdir(dir_name)
+ FileUtils.touch(file_name)
+ FileUtils.chmod(0, file_name)
+ FileUtils.chmod(0, dir_name)
+ begin
+ FileUtils.chmod(0644, file_name)
+ rescue
+ file_name
+ else
+ skip "Permission to delete files is different on thie system"
+ end
+ end
+
+ def remove_undeletable_file
+ dir_name = File.join(@tempdir, "deletedir")
+ file_name = File.join(dir_name, "deleteme")
+ FileUtils.chmod(0777, dir_name)
+ FileUtils.chmod(0777, file_name)
+ Rake::Cleaner.cleanup(file_name, :verbose => false)
+ Rake::Cleaner.cleanup(dir_name, :verbose => false)
+ end
end
diff --git a/test/rake/test_rake_cpu_counter.rb b/test/rake/test_rake_cpu_counter.rb
new file mode 100644
index 0000000000..ccf21d8ba6
--- /dev/null
+++ b/test/rake/test_rake_cpu_counter.rb
@@ -0,0 +1,50 @@
+require File.expand_path('../helper', __FILE__)
+
+class TestRakeCpuCounter < Rake::TestCase
+
+ def setup
+ super
+
+ @cpu_counter = Rake::CpuCounter.new
+ end
+
+ def test_count_via_win32
+ if Rake::Win32.windows? then
+ assert_kind_of Numeric, @cpu_counter.count_via_win32
+ else
+ assert_nil @cpu_counter.count_via_win32
+ end
+ end
+
+ def test_in_path_command
+ with_ruby_in_path do |ruby|
+ assert_equal ruby, @cpu_counter.in_path_command(ruby)
+ end
+ rescue Errno::ENOENT => e
+ raise unless e.message =~ /\bwhich\b/
+
+ skip 'cannot find which for this test'
+ end
+
+ def test_run
+ with_ruby_in_path do |ruby|
+ assert_equal 7, @cpu_counter.run(ruby, '-e', 'puts 3 + 4')
+ end
+ end
+
+ def with_ruby_in_path
+ ruby = File.basename Gem.ruby
+ ruby_dir = File.dirname Gem.ruby
+
+ begin
+ orig_path, ENV['PATH'] =
+ ENV['PATH'], [ruby_dir, *ENV['PATH']].join(File::PATH_SEPARATOR)
+
+ yield ruby
+ ensure
+ ENV['PATH'] = orig_path
+ end
+ end
+
+end
+
diff --git a/test/rake/test_rake_definitions.rb b/test/rake/test_rake_definitions.rb
index 839c40419e..4b2de9d1d2 100644
--- a/test/rake/test_rake_definitions.rb
+++ b/test/rake/test_rake_definitions.rb
@@ -34,12 +34,12 @@ class TestRakeDefinitions < Rake::TestCase
t = Task[n1]
assert Task === t, "Should be a Task"
assert_equal n1.to_s, t.name
- assert_equal [n2.to_s], t.prerequisites.collect{|n| n.to_s}
+ assert_equal [n2.to_s], t.prerequisites.map { |n| n.to_s }
t.invoke
t2 = Task[n2]
assert_equal FileList[], t2.prerequisites
t3 = Task[n3]
- assert_equal [n1.to_s, n2.to_s], t3.prerequisites.collect{|n|n.to_s}
+ assert_equal [n1.to_s, n2.to_s], t3.prerequisites.map { |n| n.to_s }
end
def test_incremental_definitions
@@ -77,4 +77,3 @@ class TestRakeDefinitions < Rake::TestCase
end
end
-
diff --git a/test/rake/test_rake_directory_task.rb b/test/rake/test_rake_directory_task.rb
index 8ae7537b50..0014d1c158 100644
--- a/test/rake/test_rake_directory_task.rb
+++ b/test/rake/test_rake_directory_task.rb
@@ -1,5 +1,6 @@
require File.expand_path('../helper', __FILE__)
require 'fileutils'
+require 'pathname'
class TestRakeDirectoryTask < Rake::TestCase
include Rake
@@ -25,6 +26,12 @@ class TestRakeDirectoryTask < Rake::TestCase
refute File.exist?("a/b/c")
end
+ def test_directory_colon
+ directory "a:b"
+
+ assert_equal FileCreationTask, Task['a:b'].class
+ end unless Rake::Win32.windows?
+
if Rake::Win32.windows?
def test_directory_win32
desc "WIN32 DESC"
@@ -54,4 +61,16 @@ class TestRakeDirectoryTask < Rake::TestCase
assert_equal ["t2", "a/b/c"], runlist
assert File.directory?("a/b/c")
end
+
+ def test_can_use_pathname
+ directory Pathname.new "a/b/c"
+
+ assert_equal FileCreationTask, Task["a/b/c"].class
+
+ verbose(false) {
+ Task['a/b/c'].invoke
+ }
+
+ assert File.directory?("a/b/c")
+ end
end
diff --git a/test/rake/test_rake_dsl.rb b/test/rake/test_rake_dsl.rb
index de83b89ab4..ad52f760b6 100644
--- a/test/rake/test_rake_dsl.rb
+++ b/test/rake/test_rake_dsl.rb
@@ -33,45 +33,8 @@ class TestRakeDsl < Rake::TestCase
refute_nil Rake::Task["bob:t"]
end
- class Foo
- def initialize
- task :foo_deprecated_a => "foo_deprecated_b" do
- print "a"
- end
- file "foo_deprecated_b" do
- print "b"
- end
- end
- end
-
- def test_deprecated_object_dsl
- out, err = capture_io do
- Foo.new
- Rake.application.invoke_task :foo_deprecated_a
- end
- assert_equal("ba", out)
- assert_match(/deprecated/, err)
- assert_match(/Foo\#task/, err)
- assert_match(/Foo\#file/, err)
- assert_match(/test_rake_dsl\.rb:\d+/, err)
- end
-
def test_no_commands_constant
assert ! defined?(Commands), "should not define Commands"
end
- def test_deprecated_object_dsl_with_suppressed_warnings
- Rake.application.options.ignore_deprecate = true
- out, err = capture_io do
- Foo.new
- Rake.application.invoke_task :foo_deprecated_a
- end
- assert_equal("ba", out)
- refute_match(/deprecated/, err)
- refute_match(/Foo\#task/, err)
- refute_match(/Foo\#file/, err)
- refute_match(/test_rake_dsl\.rb:\d+/, err)
- ensure
- Rake.application.options.ignore_deprecate = false
- end
end
diff --git a/test/rake/test_rake_file_creation_task.rb b/test/rake/test_rake_file_creation_task.rb
index d486d2f0d4..d8dcd965a3 100644
--- a/test/rake/test_rake_file_creation_task.rb
+++ b/test/rake/test_rake_file_creation_task.rb
@@ -21,7 +21,7 @@ class TestRakeFileCreationTask < Rake::TestCase
FileUtils.rm_rf fc_task.name
assert fc_task.needed?, "file should be needed"
FileUtils.mkdir fc_task.name
- assert_equal nil, fc_task.prerequisites.collect{|n| Task[n].timestamp}.max
+ assert_equal nil, fc_task.prerequisites.map { |n| Task[n].timestamp }.max
assert ! fc_task.needed?, "file should not be needed"
end
@@ -51,6 +51,6 @@ class TestRakeFileCreationTask < Rake::TestCase
def test_very_early_timestamp
t1 = Rake.application.intern(FileCreationTask, OLDFILE)
assert t1.timestamp < Time.now
- assert t1.timestamp < Time.now - 1000000
+ assert t1.timestamp < Time.now - 1_000_000
end
end
diff --git a/test/rake/test_rake_file_list.rb b/test/rake/test_rake_file_list.rb
index 08939fb6ed..c1b4c92086 100644
--- a/test/rake/test_rake_file_list.rb
+++ b/test/rake/test_rake_file_list.rb
@@ -1,4 +1,5 @@
require File.expand_path('../helper', __FILE__)
+require 'pathname'
class TestRakeFileList < Rake::TestCase
FileList = Rake::FileList
@@ -46,6 +47,12 @@ class TestRakeFileList < Rake::TestCase
fl.sort
end
+ def test_create_with_pathname
+ fl = FileList.new(Pathname.new("*.c"))
+ assert_equal ["abc.c", "x.c", "xyz.c"].sort,
+ fl.sort
+ end
+
def test_create_with_block
fl = FileList.new { |f| f.include("x") }
assert_equal ["x"], fl.resolve
@@ -74,12 +81,24 @@ class TestRakeFileList < Rake::TestCase
fl.sort
end
+ def test_include_with_pathname
+ fl = FileList.new.include(Pathname.new("*.c"))
+ assert_equal ["abc.c", "x.c", "xyz.c"].sort,
+ fl.sort
+ end
+
def test_append
fl = FileList.new
fl << "a.rb" << "b.rb"
assert_equal ['a.rb', 'b.rb'], fl
end
+ def test_append_pathname
+ fl = FileList.new
+ fl << Pathname.new("a.rb")
+ assert_equal ['a.rb'], fl
+ end
+
def test_add_many
fl = FileList.new
fl.include %w(a d c)
@@ -163,10 +182,19 @@ class TestRakeFileList < Rake::TestCase
assert_equal [], fl
end
+ def test_exclude_pathname
+ fl = FileList['x.c', 'abc.c', 'other']
+ fl.each { |fn| touch fn, :verbose => false }
+
+ fl.exclude(Pathname.new('*.c'))
+
+ assert_equal ['other'], fl
+ end
+
def test_excluding_via_block
fl = FileList['a.c', 'b.c', 'xyz.c']
fl.exclude { |fn| fn.pathmap('%n') == 'xyz' }
- assert fl.exclude?("xyz.c"), "Should exclude xyz.c"
+ assert fl.excluded_from_list?("xyz.c"), "Should exclude xyz.c"
assert_equal ['a.c', 'b.c'], fl
end
@@ -404,24 +432,24 @@ class TestRakeFileList < Rake::TestCase
def test_exclude_with_alternate_file_seps
fl = FileList.new
- assert fl.exclude?("x/CVS/y")
- assert fl.exclude?("x\\CVS\\y")
- assert fl.exclude?("x/.svn/y")
- assert fl.exclude?("x\\.svn\\y")
- assert fl.exclude?("x/core")
- assert fl.exclude?("x\\core")
+ assert fl.excluded_from_list?("x/CVS/y")
+ assert fl.excluded_from_list?("x\\CVS\\y")
+ assert fl.excluded_from_list?("x/.svn/y")
+ assert fl.excluded_from_list?("x\\.svn\\y")
+ assert fl.excluded_from_list?("x/core")
+ assert fl.excluded_from_list?("x\\core")
end
def test_add_default_exclude_list
fl = FileList.new
fl.exclude(/~\d+$/)
- assert fl.exclude?("x/CVS/y")
- assert fl.exclude?("x\\CVS\\y")
- assert fl.exclude?("x/.svn/y")
- assert fl.exclude?("x\\.svn\\y")
- assert fl.exclude?("x/core")
- assert fl.exclude?("x\\core")
- assert fl.exclude?("x/abc~1")
+ assert fl.excluded_from_list?("x/CVS/y")
+ assert fl.excluded_from_list?("x\\CVS\\y")
+ assert fl.excluded_from_list?("x/.svn/y")
+ assert fl.excluded_from_list?("x\\.svn\\y")
+ assert fl.excluded_from_list?("x/core")
+ assert fl.excluded_from_list?("x\\core")
+ assert fl.excluded_from_list?("x/abc~1")
end
def test_basic_array_functions
@@ -482,12 +510,12 @@ class TestRakeFileList < Rake::TestCase
a = ['b', 'a']
b = ['b', 'b']
c = ['b', 'c']
- assert_equal( 1, fl <=> a )
- assert_equal( 0, fl <=> b )
- assert_equal( -1, fl <=> c )
- assert_equal( -1, a <=> fl )
- assert_equal( 0, b <=> fl )
- assert_equal( 1, c <=> fl )
+ assert_equal(1, fl <=> a)
+ assert_equal(0, fl <=> b)
+ assert_equal(-1, fl <=> c)
+ assert_equal(-1, a <=> fl)
+ assert_equal(0, b <=> fl)
+ assert_equal(1, c <=> fl)
end
def test_array_equality
@@ -503,7 +531,7 @@ class TestRakeFileList < Rake::TestCase
def test_enumeration_methods
a = FileList['a', 'b']
- b = a.collect { |it| it.upcase }
+ b = a.map { |it| it.upcase }
assert_equal ['A', 'B'], b
assert_equal FileList, b.class
@@ -519,7 +547,7 @@ class TestRakeFileList < Rake::TestCase
assert_equal ['a', 'b'], b
assert_equal FileList, b.class
- b = a.find_all { |it| it == 'b'}
+ b = a.select { |it| it == 'b' }
assert_equal ['b'], b
assert_equal FileList, b.class
@@ -609,7 +637,7 @@ class TestRakeFileList < Rake::TestCase
assert_equal FileList, r.class
f = FileList['a', 'b', 'c', 'd']
- r = f.values_at(1,3)
+ r = f.values_at(1, 3)
assert_equal ['b', 'd'], r
assert_equal FileList, r.class
end
@@ -625,4 +653,3 @@ class TestRakeFileList < Rake::TestCase
end
end
-
diff --git a/test/rake/test_rake_file_task.rb b/test/rake/test_rake_file_task.rb
index 0ed32e5655..a6a9fa2c51 100644
--- a/test/rake/test_rake_file_task.rb
+++ b/test/rake/test_rake_file_task.rb
@@ -1,5 +1,6 @@
require File.expand_path('../helper', __FILE__)
require 'fileutils'
+require 'pathname'
class TestRakeFileTask < Rake::TestCase
include Rake
@@ -26,7 +27,7 @@ class TestRakeFileTask < Rake::TestCase
open(ftask.name, "w") { |f| f.puts "HI" }
- assert_equal nil, ftask.prerequisites.collect{|n| Task[n].timestamp}.max
+ assert_equal nil, ftask.prerequisites.map { |n| Task[n].timestamp }.max
assert ! ftask.needed?, "file should not be needed"
ensure
File.delete(ftask.name) rescue nil
@@ -55,16 +56,16 @@ class TestRakeFileTask < Rake::TestCase
task(name => :phony)
- assert ! t1.needed?, "unless the non-file task has a timestamp"
+ assert t1.needed?, "unless the non-file task has a timestamp"
end
def test_file_times_old_depends_on_new
create_timed_files(OLDFILE, NEWFILE)
- t1 = Rake.application.intern(FileTask,OLDFILE).enhance([NEWFILE])
+ t1 = Rake.application.intern(FileTask, OLDFILE).enhance([NEWFILE])
t2 = Rake.application.intern(FileTask, NEWFILE)
assert ! t2.needed?, "Should not need to build new file"
- preq_stamp = t1.prerequisites.collect{|t| Task[t].timestamp}.max
+ preq_stamp = t1.prerequisites.map { |t| Task[t].timestamp }.max
assert_equal t2.timestamp, preq_stamp
assert t1.timestamp < preq_stamp, "T1 should be older"
assert t1.needed?, "Should need to rebuild old file because of new"
@@ -79,7 +80,7 @@ class TestRakeFileTask < Rake::TestCase
Task[:obj].invoke
Task[NEWFILE].invoke
- assert ! @runs.include?(NEWFILE)
+ assert @runs.include?(NEWFILE)
end
def test_existing_file_depends_on_non_existing_file
@@ -98,6 +99,84 @@ class TestRakeFileTask < Rake::TestCase
assert @ran
end
+ def test_needed_eh_build_all
+ create_file 'a'
+
+ file 'a'
+
+ a_task = Task['a']
+
+ refute a_task.needed?
+
+ Rake.application.options.build_all = true
+
+ assert a_task.needed?
+ ensure
+ delete_file 'a'
+ end
+
+ def test_needed_eh_dependency
+ create_file 'a', Time.now
+ create_file 'b', Time.now - 60
+
+ create_file 'c', Time.now
+ create_file 'd', Time.now - 60
+
+ file 'b' => 'a'
+
+ b_task = Task['b']
+
+ assert b_task.needed?
+
+ file 'c' => 'd'
+
+ c_task = Task['c']
+
+ refute c_task.needed?
+ ensure
+ delete_file 'old'
+ delete_file 'new'
+ end
+
+ def test_needed_eh_exists
+ name = "dummy"
+ file name
+
+ ftask = Task[name]
+
+ assert ftask.needed?
+
+ create_file name
+
+ refute ftask.needed?
+ ensure
+ delete_file name
+ end
+
+ def test_source_is_first_prerequisite
+ t = file :f => ["preqA", "preqB"]
+ assert_equal "preqA", t.source
+ end
+
+ def test_sources_is_all_prerequisites
+ t = file :f => ["preqA", "preqB"]
+ assert_equal ["preqA", "preqB"], t.sources
+ end
+
+ def test_task_can_be_pathname
+ name = "dummy"
+ file Pathname.new name
+
+ ftask = Task[name]
+
+ assert_equal name.to_s, ftask.name
+ end
+
+ def test_prerequisite_can_be_pathname
+ t = file :f => Pathname.new("preq")
+ assert_equal "preq", t.source
+ end
+
# I have currently disabled this test. I'm not convinced that
# deleting the file target on failure is always the proper thing to
# do. I'm willing to hear input on this topic.
@@ -112,7 +191,7 @@ class TestRakeFileTask < Rake::TestCase
Task[NEWFILE].invoke
rescue Exception
end
- assert( ! File.exist?(NEWFILE), "NEWFILE should be deleted")
+ assert(! File.exist?(NEWFILE), "NEWFILE should be deleted")
end
def load_phony
diff --git a/test/rake/test_rake_file_utils.rb b/test/rake/test_rake_file_utils.rb
index 90565e3ebd..37d33dc39a 100644
--- a/test/rake/test_rake_file_utils.rb
+++ b/test/rake/test_rake_file_utils.rb
@@ -44,15 +44,19 @@ class TestRakeFileUtils < Rake::TestCase
class BadLink
include Rake::FileUtilsExt
attr_reader :cp_args
+
def initialize(klass)
@failure_class = klass
end
+
def cp(*args)
@cp_args = args
end
+
def ln(*args)
fail @failure_class, "ln not supported"
end
+
public :safe_ln
end
@@ -94,7 +98,7 @@ class TestRakeFileUtils < Rake::TestCase
assert_equal true, nowrite
nowrite false
assert_equal false, nowrite
- nowrite(true){
+ nowrite(true) {
assert_equal true, nowrite
}
assert_equal false, nowrite
@@ -250,7 +254,7 @@ class TestRakeFileUtils < Rake::TestCase
assert_equal ['..', 'a', 'b'], Rake::FileUtilsExt.split_all('../a/b')
end
- def command name, text
+ def command(name, text)
open name, 'w', 0750 do |io|
io << text
end
diff --git a/test/rake/test_rake_ftp_file.rb b/test/rake/test_rake_ftp_file.rb
index 7f41faf0dd..5749b8a5ef 100644
--- a/test/rake/test_rake_ftp_file.rb
+++ b/test/rake/test_rake_ftp_file.rb
@@ -5,10 +5,11 @@ require 'rake/contrib/ftptools'
class FakeDate
def self.today
- Date.new(2003,10,3)
+ Date.new(2003, 10, 3)
end
+
def self.now
- Time.local(2003,10,3,12,00,00)
+ Time.local(2003, 10, 3, 12, 00, 00)
end
end
@@ -17,43 +18,57 @@ class TestRakeFtpFile < Rake::TestCase
def setup
super
- Rake::FtpFile.class_eval { @date_class = FakeDate; @time_class = FakeDate }
+ Rake::FtpFile.class_eval {
+ @date_class = FakeDate
+ @time_class = FakeDate
+ }
end
def test_general
- file = Rake::FtpFile.new("here", "-rw-r--r-- 1 a279376 develop 121770 Mar 6 14:50 wiki.pl")
+ file = Rake::FtpFile.new(
+ "here",
+ "-rw-r--r-- 1 a279376 develop 121770 Mar 6 14:50 wiki.pl")
assert_equal "wiki.pl", file.name
assert_equal "here/wiki.pl", file.path
assert_equal "a279376", file.owner
assert_equal "develop", file.group
assert_equal 0644, file.mode
- assert_equal 121770, file.size
- assert_equal Time.mktime(2003,3,6,14,50,0,0), file.time
+ assert_equal 121_770, file.size
+ assert_equal Time.mktime(2003, 3, 6, 14, 50, 0, 0), file.time
assert ! file.directory?
assert ! file.symlink?
end
def test_far_date
- file = Rake::FtpFile.new(".", "drwxr-xr-x 3 a279376 develop 4096 Nov 26 2001 vss")
- assert_equal Time.mktime(2001,11,26,0,0,0,0), file.time
+ file = Rake::FtpFile.new(
+ ".",
+ "drwxr-xr-x 3 a279376 develop 4096 Nov 26 2001 vss")
+ assert_equal Time.mktime(2001, 11, 26, 0, 0, 0, 0), file.time
end
def test_close_date
- file = Rake::FtpFile.new(".", "drwxr-xr-x 3 a279376 develop 4096 Nov 26 15:35 vss")
- assert_equal Time.mktime(2002,11,26,15,35,0,0), file.time
+ file = Rake::FtpFile.new(
+ ".",
+ "drwxr-xr-x 3 a279376 develop 4096 Nov 26 15:35 vss")
+ assert_equal Time.mktime(2002, 11, 26, 15, 35, 0, 0), file.time
end
def test_directory
- file = Rake::FtpFile.new(".", "drwxrwxr-x 9 a279376 develop 4096 Mar 13 14:32 working")
+ file = Rake::FtpFile.new(
+ ".",
+ "drwxrwxr-x 9 a279376 develop 4096 Mar 13 14:32 working")
assert file.directory?
assert !file.symlink?
end
def test_symlink
- file = Rake::FtpFile.new(".", "lrwxrwxrwx 1 a279376 develop 64 Mar 26 2002 xtrac -> /home/a279376/working/ics/development/java/com/fmr/fwp/ics/xtrac")
+ file = Rake::FtpFile.new(
+ ".",
+ "lrwxrwxrwx 1 a279376 develop 64 Mar 26 2002 " +
+ "xtrac -> /home/a279376/working/ics/development/java/" +
+ "com/fmr/fwp/ics/xtrac")
assert_equal 'xtrac', file.name
assert file.symlink?
assert !file.directory?
end
end
-
diff --git a/test/rake/test_rake_functional.rb b/test/rake/test_rake_functional.rb
index 23249b97fb..bf7ba92f75 100644
--- a/test/rake/test_rake_functional.rb
+++ b/test/rake/test_rake_functional.rb
@@ -3,13 +3,11 @@ require 'fileutils'
require 'open3'
class TestRakeFunctional < Rake::TestCase
+ include RubyRunner
def setup
super
- @ruby_options = ["-I#{@rake_lib}", "-I."]
- @verbose = ENV['VERBOSE']
-
if @verbose
puts
puts
@@ -68,7 +66,7 @@ class TestRakeFunctional < Rake::TestCase
rake "--describe"
- assert_match %r{^rake a\n *A / A2 *$}m, @out
+ assert_match %r{^rake a\n *A\n *A2 *$}m, @out
assert_match %r{^rake b\n *B *$}m, @out
assert_match %r{^rake d\n *x{80}}m, @out
refute_match %r{^rake c\n}m, @out
@@ -270,6 +268,14 @@ class TestRakeFunctional < Rake::TestCase
assert_match(/^FIRST$\s+^DYNAMIC$\s+^STATIC$\s+^OTHER$/, @out)
end
+ def test_regenerate_imports
+ rakefile_regenerate_imports
+
+ rake
+
+ assert_match(/^INITIAL\s+^REGENERATED$/, @out)
+ end
+
def test_rules_chaining_to_file_task
rakefile_chains
@@ -370,6 +376,14 @@ class TestRakeFunctional < Rake::TestCase
assert_match(/^PREPARE\nSCOPEDEP$/m, @out)
end
+ def test_test_task_descriptions
+ rakefile_test_task
+
+ rake "-T"
+
+ assert_match(/custom test task description/, @out)
+ end
+
def test_comment_before_task_acts_like_desc
rakefile_comments
@@ -416,12 +430,14 @@ class TestRakeFunctional < Rake::TestCase
end
def can_detect_signals?
- system "ruby -e 'Process.kill \"TERM\", $$'"
+ system RUBY, '-e', 'Process.kill "TERM", $$'
status = $?
if @verbose
puts " SIG status = #{$?.inspect}"
- puts " SIG status.respond_to?(:signaled?) = #{$?.respond_to?(:signaled?).inspect}"
- puts " SIG status.signaled? = #{status.signaled?}" if status.respond_to?(:signaled?)
+ puts " SIG status.respond_to?(:signaled?) = " +
+ "#{$?.respond_to?(:signaled?).inspect}"
+ puts " SIG status.signaled? = #{status.signaled?}" if
+ status.respond_to?(:signaled?)
end
status.respond_to?(:signaled?) && status.signaled?
end
@@ -463,34 +479,4 @@ class TestRakeFunctional < Rake::TestCase
RUBY_VERSION < "1.9" || defined?(JRUBY_VERSION)
end
- # Run a shell Ruby command with command line options (using the
- # default test options). Output is captured in @out and @err
- def ruby(*option_list)
- run_ruby(@ruby_options + option_list)
- end
-
- # Run a command line rake with the give rake options. Default
- # command line ruby options are included. Output is captured in
- # @out and @err
- def rake(*rake_options)
- run_ruby @ruby_options + [@rake_exec] + rake_options
- end
-
- # Low level ruby command runner ...
- def run_ruby(option_list)
- puts "COMMAND: [#{RUBY} #{option_list.join ' '}]" if @verbose
-
- inn, out, err, wait = Open3.popen3(RUBY, *option_list)
- inn.close
-
- @exit = wait ? wait.value : $?
- @out = out.read
- @err = err.read
-
- puts "OUTPUT: [#{@out}]" if @verbose
- puts "ERROR: [#{@err}]" if @verbose
- puts "EXIT: [#{@exit.inspect}]" if @verbose
- puts "PWD: [#{Dir.pwd}]" if @verbose
- end
-
end
diff --git a/test/rake/test_rake_invocation_chain.rb b/test/rake/test_rake_invocation_chain.rb
index 1aab1eac81..0176339bd4 100644
--- a/test/rake/test_rake_invocation_chain.rb
+++ b/test/rake/test_rake_invocation_chain.rb
@@ -1,11 +1,12 @@
require File.expand_path('../helper', __FILE__)
class TestRakeInvocationChain < Rake::TestCase
+ include Rake
def setup
super
- @empty = Rake::InvocationChain::EMPTY
+ @empty = InvocationChain.empty
@first_member = "A"
@second_member = "B"
@@ -13,7 +14,19 @@ class TestRakeInvocationChain < Rake::TestCase
@two = @one.append(@second_member)
end
- def test_append
+ def test_conj_on_invocation_chains
+ list = InvocationChain.empty.conj("B").conj("A")
+ assert_equal InvocationChain.make("A", "B"), list
+ assert_equal InvocationChain, list.class
+ end
+
+ def test_make_on_invocation_chains
+ assert_equal @empty, InvocationChain.make()
+ assert_equal @one, InvocationChain.make(@first_member)
+ assert_equal @two, InvocationChain.make(@second_member, @first_member)
+ end
+
+ def test_append_with_one_argument
chain = @empty.append("A")
assert_equal 'TOP => A', chain.to_s # HACK
@@ -49,4 +62,3 @@ class TestRakeInvocationChain < Rake::TestCase
end
end
-
diff --git a/test/rake/test_rake_linked_list.rb b/test/rake/test_rake_linked_list.rb
new file mode 100644
index 0000000000..10957fba6d
--- /dev/null
+++ b/test/rake/test_rake_linked_list.rb
@@ -0,0 +1,84 @@
+require File.expand_path('../helper', __FILE__)
+
+class TestLinkedList < Rake::TestCase
+ include Rake
+
+ def test_empty_list
+ empty = LinkedList::EMPTY
+ assert empty.empty?, "should be empty"
+ end
+
+ def test_list_with_one_item
+ list = LinkedList.make(:one)
+ assert ! list.empty?, "should not be empty"
+ assert_equal :one, list.head
+ assert_equal LinkedList::EMPTY, list.tail
+ end
+
+ def test_make_with_no_arguments
+ empty = LinkedList.make()
+ assert_equal LinkedList::EMPTY, empty
+ end
+
+ def test_make_with_one_argument
+ list = LinkedList.make(:one)
+ assert ! list.empty?
+ assert_equal :one, list.head
+ assert_equal LinkedList::EMPTY, list.tail
+ end
+
+ def test_make_with_two_arguments
+ list = LinkedList.make(:one, :two)
+ assert ! list.empty?
+ assert_equal :one, list.head
+ assert_equal :two, list.tail.head
+ assert_equal LinkedList::EMPTY, list.tail.tail
+ end
+
+ def test_list_with_several_items
+ list = LinkedList.make(:one, :two, :three)
+
+ assert ! list.empty?, "should not be empty"
+ assert_equal :one, list.head
+ assert_equal :two, list.tail.head
+ assert_equal :three, list.tail.tail.head
+ assert_equal LinkedList::EMPTY, list.tail.tail.tail
+ end
+
+ def test_lists_are_structurally_equivalent
+ list = LinkedList.make(1, 2, 3)
+ same = LinkedList.make(1, 2, 3)
+ diff = LinkedList.make(1, 2, 4)
+ short = LinkedList.make(1, 2)
+
+ assert_equal list, same
+ refute_equal list, diff
+ refute_equal list, short
+ refute_equal short, list
+ end
+
+ def test_converstion_to_string
+ list = LinkedList.make(:one, :two, :three)
+ assert_equal "LL(one, two, three)", list.to_s
+ assert_equal "LL()", LinkedList.make().to_s
+ end
+
+ def test_converstion_with_inspect
+ list = LinkedList.make(:one, :two, :three)
+ assert_equal "LL(:one, :two, :three)", list.inspect
+ assert_equal "LL()", LinkedList.make().inspect
+ end
+
+ def test_lists_are_enumerable
+ list = LinkedList.make(1, 2, 3)
+ new_list = list.map { |item| item + 10 }
+ expected = [11, 12, 13]
+ assert_equal expected, new_list
+ end
+
+ def test_conjunction
+ list = LinkedList.make.conj("C").conj("B").conj("A")
+ assert_equal LinkedList.make("A", "B", "C"), list
+ end
+
+end
diff --git a/test/rake/test_rake_makefile_loader.rb b/test/rake/test_rake_makefile_loader.rb
index bd3c99ba71..9e9265ad18 100644
--- a/test/rake/test_rake_makefile_loader.rb
+++ b/test/rake/test_rake_makefile_loader.rb
@@ -38,7 +38,9 @@ g\ 0: g1 g\ 2 g\ 3 g4
assert_equal %w(d1 d2).sort, Task['d'].prerequisites.sort
assert_equal %w(e1 f1).sort, Task['e'].prerequisites.sort
assert_equal %w(e1 f1).sort, Task['f'].prerequisites.sort
- assert_equal ["g1", "g 2", "g 3", "g4"].sort, Task['g 0'].prerequisites.sort
+ assert_equal(
+ ["g1", "g 2", "g 3", "g4"].sort,
+ Task['g 0'].prerequisites.sort)
assert_equal 7, Task.tasks.size
end
end
diff --git a/test/rake/test_rake_multi_task.rb b/test/rake/test_rake_multi_task.rb
index 22d13d27a0..9f8fed6d50 100644
--- a/test/rake/test_rake_multi_task.rb
+++ b/test/rake/test_rake_multi_task.rb
@@ -13,6 +13,12 @@ class TestRakeMultiTask < Rake::TestCase
@mutex = Mutex.new
end
+ def teardown
+ Rake.application.thread_pool.join
+
+ super
+ end
+
def add_run(obj)
@mutex.synchronize do
@runs << obj
@@ -49,11 +55,10 @@ class TestRakeMultiTask < Rake::TestCase
end
def test_multitasks_with_parameters
- task :a, [:arg] do |t,args| add_run(args[:arg]) end
- multitask :b, [:arg] => [:a] do |t,args| add_run(args[:arg]+'mt') end
+ task :a, [:arg] do |t, args| add_run(args[:arg]) end
+ multitask :b, [:arg] => [:a] do |t, args| add_run(args[:arg] + 'mt') end
Task[:b].invoke "b"
assert @runs[0] == "b"
assert @runs[1] == "bmt"
end
end
-
diff --git a/test/rake/test_rake_name_space.rb b/test/rake/test_rake_name_space.rb
index b1f2ed00b2..d35e70e175 100644
--- a/test/rake/test_rake_name_space.rb
+++ b/test/rake/test_rake_name_space.rb
@@ -38,6 +38,20 @@ class TestRakeNameSpace < Rake::TestCase
assert_equal ["n:nn:z", "n:x", "n:y"],
ns.tasks.map { |tsk| tsk.name }
- assert_equal ["n:nn:z"], nns.tasks.map {|t| t.name}
+ assert_equal ["n:nn:z"], nns.tasks.map { |t| t.name }
end
+
+ def test_scope
+ mgr = TM.new
+
+ scope = Rake::LinkedList.new 'b'
+ scope = scope.conj 'a'
+
+ ns = Rake::NameSpace.new mgr, scope
+
+ assert_equal scope, ns.scope
+
+ refute_same scope, ns.scope
+ end
+
end
diff --git a/test/rake/test_rake_path_map.rb b/test/rake/test_rake_path_map.rb
index 32ffb854b1..038ba1f9a7 100644
--- a/test/rake/test_rake_path_map.rb
+++ b/test/rake/test_rake_path_map.rb
@@ -52,7 +52,7 @@ class TestRakePathMap < Rake::TestCase
assert_equal "", "dir/.depends".pathmap("%x")
end
- def test_X_returns_everything_but_extension
+ def test_x_returns_everything_but_extension
assert_equal "abc", "abc".pathmap("%X")
assert_equal "abc", "abc.rb".pathmap("%X")
assert_equal "abc.xyz", "abc.xyz.rb".pathmap("%X")
@@ -142,16 +142,27 @@ class TestRakePathMap < Rake::TestCase
def test_complex_patterns
sep = "".pathmap("%s")
- assert_equal "dir/abc.rb", "dir/abc.rb".pathmap("%d/%n%x")
- assert_equal "./abc.rb", "abc.rb".pathmap("%d/%n%x")
- assert_equal "Your file extension is '.rb'",
- "dir/abc.rb".pathmap("Your file extension is '%x'")
- assert_equal "bin/org/onstepback/proj/A.class",
- "src/org/onstepback/proj/A.java".pathmap("%{src,bin}d/%n.class")
- assert_equal "src_work/bin/org/onstepback/proj/A.class",
- "src_work/src/org/onstepback/proj/A.java".pathmap('%{\bsrc\b,bin}X.class')
- assert_equal ".depends.bak", ".depends".pathmap("%X.bak")
- assert_equal "d#{sep}a/b/c#{sep}file.txt", "a/b/c/d/file.txt".pathmap("%-1d%s%3d%s%f")
+ assert_equal(
+ "dir/abc.rb",
+ "dir/abc.rb".pathmap("%d/%n%x"))
+ assert_equal(
+ "./abc.rb",
+ "abc.rb".pathmap("%d/%n%x"))
+ assert_equal(
+ "Your file extension is '.rb'",
+ "dir/abc.rb".pathmap("Your file extension is '%x'"))
+ assert_equal(
+ "bin/org/onstepback/proj/A.class",
+ "src/org/onstepback/proj/A.java".pathmap("%{src,bin}d/%n.class"))
+ assert_equal(
+ "src_work/bin/org/onstepback/proj/A.class",
+ "src_work/src/org/onstepback/proj/A.java".
+ pathmap('%{\bsrc\b,bin}X.class'))
+ assert_equal(
+ ".depends.bak",
+ ".depends".pathmap("%X.bak"))
+ assert_equal(
+ "d#{sep}a/b/c#{sep}file.txt",
+ "a/b/c/d/file.txt".pathmap("%-1d%s%3d%s%f"))
end
end
-
diff --git a/test/rake/test_rake_pathname_extensions.rb b/test/rake/test_rake_pathname_extensions.rb
new file mode 100644
index 0000000000..7da702d0c7
--- /dev/null
+++ b/test/rake/test_rake_pathname_extensions.rb
@@ -0,0 +1,15 @@
+require File.expand_path('../helper', __FILE__)
+require 'rake/ext/pathname'
+
+class TestRakePathnameExtensions < Rake::TestCase
+ def test_ext_works_on_pathnames
+ pathname = Pathname.new("abc.foo")
+ assert_equal Pathname.new("abc.bar"), pathname.ext("bar")
+ end
+
+ def test_path_map_works_on_pathnames
+ pathname = Pathname.new("this/is/a/dir/abc.rb")
+ assert_equal Pathname.new("abc.rb"), pathname.pathmap("%f")
+ assert_equal Pathname.new("this/is/a/dir"), pathname.pathmap("%d")
+ end
+end
diff --git a/test/rake/test_rake_rake_test_loader.rb b/test/rake/test_rake_rake_test_loader.rb
index 7b5337c234..0485c4c8ac 100644
--- a/test/rake/test_rake_rake_test_loader.rb
+++ b/test/rake/test_rake_rake_test_loader.rb
@@ -3,7 +3,7 @@ require File.expand_path('../helper', __FILE__)
class TestRakeRakeTestLoader < Rake::TestCase
def test_pattern
- orig_LOADED_FEATURES = $:.dup
+ orig_loaded_features = $:.dup
FileUtils.touch 'foo.rb'
FileUtils.touch 'test_a.rb'
FileUtils.touch 'test_b.rb'
@@ -14,8 +14,7 @@ class TestRakeRakeTestLoader < Rake::TestCase
assert_equal %w[-v], ARGV
ensure
- $:.replace orig_LOADED_FEATURES
+ $:.replace orig_loaded_features
end
end
-
diff --git a/test/rake/test_rake_rdoc_task.rb b/test/rake/test_rake_rdoc_task.rb
deleted file mode 100644
index 0d24ef04a3..0000000000
--- a/test/rake/test_rake_rdoc_task.rb
+++ /dev/null
@@ -1,83 +0,0 @@
-require File.expand_path('../helper', __FILE__)
-begin
- old_stderr = $stderr
- dev_null = File.exist?('/dev/null') ? '/dev/null' : 'NUL'
- $stderr = open dev_null, 'w'
- require 'rake/rdoctask'
-ensure
- $stderr.close
- $stderr = old_stderr
-end
-
-class TestRakeRDocTask < Rake::TestCase
- include Rake
-
- def setup
- super
-
- Task.clear
- end
-
- def test_tasks_creation
- Rake::RDocTask.new
- assert Task[:rdoc]
- assert Task[:clobber_rdoc]
- assert Task[:rerdoc]
- end
-
- def test_tasks_creation_with_custom_name_symbol
- rd = Rake::RDocTask.new(:rdoc_dev)
- assert Task[:rdoc_dev]
- assert Task[:clobber_rdoc_dev]
- assert Task[:rerdoc_dev]
- assert_equal :rdoc_dev, rd.name
- end
-
- def test_tasks_creation_with_custom_name_string
- rd = Rake::RDocTask.new("rdoc_dev")
- assert Task[:rdoc_dev]
- assert Task[:clobber_rdoc_dev]
- assert Task[:rerdoc_dev]
- assert_equal "rdoc_dev", rd.name
- end
-
- def test_tasks_creation_with_custom_name_hash
- options = { :rdoc => "rdoc", :clobber_rdoc => "rdoc:clean", :rerdoc => "rdoc:force" }
- rd = Rake::RDocTask.new(options)
- assert Task[:"rdoc"]
- assert Task[:"rdoc:clean"]
- assert Task[:"rdoc:force"]
- assert_raises(RuntimeError) { Task[:clobber_rdoc] }
- assert_equal options, rd.name
- end
-
- def test_tasks_creation_with_custom_name_hash_will_use_default_if_an_option_isnt_given
- Rake::RDocTask.new(:clobber_rdoc => "rdoc:clean")
- assert Task[:rdoc]
- assert Task[:"rdoc:clean"]
- assert Task[:rerdoc]
- end
-
- def test_tasks_creation_with_custom_name_hash_raises_exception_if_invalid_option_given
- assert_raises(ArgumentError) do
- Rake::RDocTask.new(:foo => "bar")
- end
-
- begin
- Rake::RDocTask.new(:foo => "bar")
- rescue ArgumentError => e
- assert_match(/foo/, e.message)
- end
- end
-
- def test_inline_source_option_is_only_appended_if_option_not_already_given
- rd = Rake::RDocTask.new
- rd.options << '--inline-source'
- assert_equal 1, rd.option_list.grep('--inline-source').size
-
- rd = Rake::RDocTask.new
- rd.options << '-S'
- assert_equal 1, rd.option_list.grep('-S').size
- assert_equal 0, rd.option_list.grep('--inline-source').size
- end
-end
diff --git a/test/rake/test_rake_reduce_compat.rb b/test/rake/test_rake_reduce_compat.rb
index 6da8e4259c..d295266540 100644
--- a/test/rake/test_rake_reduce_compat.rb
+++ b/test/rake/test_rake_reduce_compat.rb
@@ -2,19 +2,11 @@ require File.expand_path('../helper', __FILE__)
require 'open3'
class TestRakeReduceCompat < Rake::TestCase
- # TODO: factor out similar code in test_rake_functional.rb
- def rake(*args)
- Open3.popen3(RUBY, "-I", @rake_lib, @rake_exec, *args) { |_, out, _, _|
- out.read
- }
- end
+ include RubyRunner
def invoke_normal(task_name)
rake task_name.to_s
- end
-
- def invoke_reduce_compat(task_name)
- rake "--reduce-compat", task_name.to_s
+ @out
end
def test_no_deprecated_dsl
@@ -28,38 +20,7 @@ class TestRakeReduceCompat < Rake::TestCase
end
}
- assert_equal %{"method"}, invoke_normal(:check_task).chomp
- assert_equal %{"method"}, invoke_normal(:check_file).chomp
-
- assert_equal "nil", invoke_reduce_compat(:check_task).chomp
- assert_equal "nil", invoke_reduce_compat(:check_file).chomp
- end
-
- def test_no_classic_namespace
- rakefile %q{
- task :check_task do
- begin
- Task
- print "present"
- rescue NameError
- print "absent"
- end
- end
-
- task :check_file_task do
- begin
- FileTask
- print "present"
- rescue NameError
- print "absent"
- end
- end
- }
-
- assert_equal "present", invoke_normal(:check_task)
- assert_equal "present", invoke_normal(:check_file_task)
-
- assert_equal "absent", invoke_reduce_compat(:check_task)
- assert_equal "absent", invoke_reduce_compat(:check_file_task)
+ assert_equal "nil", invoke_normal(:check_task).chomp
+ assert_equal "nil", invoke_normal(:check_file).chomp
end
end
diff --git a/test/rake/test_rake_rules.rb b/test/rake/test_rake_rules.rb
index 3f6e352322..ece75e5d9e 100644
--- a/test/rake/test_rake_rules.rb
+++ b/test/rake/test_rake_rules.rb
@@ -102,7 +102,7 @@ class TestRakeRules < Rake::TestCase
verbose(false) do
create_file(".foo")
- rule '.o' => lambda{".foo"} do |t|
+ rule '.o' => lambda { ".foo" } do |t|
@runs << "#{t.name} - #{t.source}"
end
Task[OBJFILE].invoke
@@ -113,7 +113,7 @@ class TestRakeRules < Rake::TestCase
def test_file_names_containing_percent_can_be_wrapped_in_lambda
verbose(false) do
create_file("foo%x")
- rule '.o' => lambda{"foo%x"} do |t|
+ rule '.o' => lambda { "foo%x" } do |t|
@runs << "#{t.name} - #{t.source}"
end
Task[OBJFILE].invoke
@@ -186,7 +186,7 @@ class TestRakeRules < Rake::TestCase
def test_rule_with_two_sources_runs_if_both_sources_are_present
create_timed_files(OBJFILE, SRCFILE, SRCFILE2)
- rule OBJFILE => [lambda{SRCFILE}, lambda{SRCFILE2}] do
+ rule OBJFILE => [lambda { SRCFILE }, lambda { SRCFILE2 }] do
@runs << :RULE
end
Task[OBJFILE].invoke
@@ -196,7 +196,7 @@ class TestRakeRules < Rake::TestCase
def test_rule_with_two_sources_but_one_missing_does_not_run
create_timed_files(OBJFILE, SRCFILE)
delete_file(SRCFILE2)
- rule OBJFILE => [lambda{SRCFILE}, lambda{SRCFILE2}] do
+ rule OBJFILE => [lambda { SRCFILE }, lambda { SRCFILE2 }] do
@runs << :RULE
end
Task[OBJFILE].invoke
@@ -222,10 +222,10 @@ class TestRakeRules < Rake::TestCase
def test_second_rule_runs_when_first_rule_doesnt
create_timed_files(OBJFILE, SRCFILE)
delete_file(SRCFILE2)
- rule OBJFILE => [lambda{SRCFILE}, lambda{SRCFILE2}] do
+ rule OBJFILE => [lambda { SRCFILE }, lambda { SRCFILE2 }] do
@runs << :RULE1
end
- rule OBJFILE => [lambda{SRCFILE}] do
+ rule OBJFILE => [lambda { SRCFILE }] do
@runs << :RULE2
end
Task[OBJFILE].invoke
@@ -234,10 +234,10 @@ class TestRakeRules < Rake::TestCase
def test_second_rule_doest_run_if_first_triggers
create_timed_files(OBJFILE, SRCFILE, SRCFILE2)
- rule OBJFILE => [lambda{SRCFILE}, lambda{SRCFILE2}] do
+ rule OBJFILE => [lambda { SRCFILE }, lambda { SRCFILE2 }] do
@runs << :RULE1
end
- rule OBJFILE => [lambda{SRCFILE}] do
+ rule OBJFILE => [lambda { SRCFILE }] do
@runs << :RULE2
end
Task[OBJFILE].invoke
@@ -246,10 +246,10 @@ class TestRakeRules < Rake::TestCase
def test_second_rule_doest_run_if_first_triggers_with_reversed_rules
create_timed_files(OBJFILE, SRCFILE, SRCFILE2)
- rule OBJFILE => [lambda{SRCFILE}] do
+ rule OBJFILE => [lambda { SRCFILE }] do
@runs << :RULE1
end
- rule OBJFILE => [lambda{SRCFILE}, lambda{SRCFILE2}] do
+ rule OBJFILE => [lambda { SRCFILE }, lambda { SRCFILE2 }] do
@runs << :RULE2
end
Task[OBJFILE].invoke
@@ -319,9 +319,70 @@ class TestRakeRules < Rake::TestCase
end
def test_rules_with_bad_dependents_will_fail
- rule "a" => [ 1 ] do |t| puts t.name end
+ rule "a" => [1] do |t| puts t.name end
assert_raises(RuntimeError) do Task['a'].invoke end
end
-end
+ def test_string_rule_with_args
+ delete_file(OBJFILE)
+ create_file(SRCFILE)
+ rule '.o', [:a] => SRCFILE do |t, args|
+ assert_equal 'arg', args.a
+ end
+ Task[OBJFILE].invoke('arg')
+ end
+
+ def test_regex_rule_with_args
+ delete_file(OBJFILE)
+ create_file(SRCFILE)
+ rule(/.o$/, [:a] => SRCFILE) do |t, args|
+ assert_equal 'arg', args.a
+ end
+ Task[OBJFILE].invoke('arg')
+ end
+
+ def test_string_rule_with_args_and_lambda_prereq
+ delete_file(OBJFILE)
+ create_file(SRCFILE)
+ rule '.o', [:a] => [lambda{SRCFILE}]do |t, args|
+ assert_equal 'arg', args.a
+ end
+ Task[OBJFILE].invoke('arg')
+ end
+
+ def test_regex_rule_with_args_and_lambda_prereq
+ delete_file(OBJFILE)
+ create_file(SRCFILE)
+ rule(/.o$/, [:a] => [lambda{SRCFILE}]) do |t, args|
+ assert_equal 'arg', args.a
+ end
+ Task[OBJFILE].invoke('arg')
+ end
+
+ def test_rule_with_method_prereq
+ create_file(".foo")
+ obj = Object.new
+ def obj.find_prereq
+ ".foo"
+ end
+ rule '.o' => obj.method(:find_prereq) do |t|
+ @runs << "#{t.name} - #{t.source}"
+ end
+ Task[OBJFILE].invoke
+ assert_equal ["#{OBJFILE} - .foo"], @runs
+ end
+
+ def test_rule_with_one_arg_method_prereq
+ create_file(SRCFILE)
+ obj = Object.new
+ def obj.find_prereq(task_name)
+ task_name.ext(".c")
+ end
+ rule '.o' => obj.method(:find_prereq) do |t|
+ @runs << "#{t.name} - #{t.source}"
+ end
+ Task[OBJFILE].invoke
+ assert_equal ["#{OBJFILE} - abc.c"], @runs
+ end
+end
diff --git a/test/rake/test_rake_scope.rb b/test/rake/test_rake_scope.rb
new file mode 100644
index 0000000000..ef06618ba9
--- /dev/null
+++ b/test/rake/test_rake_scope.rb
@@ -0,0 +1,44 @@
+require File.expand_path('../helper', __FILE__)
+
+class TestRakeScope < Rake::TestCase
+ include Rake
+
+ def test_path_against_empty_scope
+ scope = Scope.make
+ assert_equal scope, Scope::EMPTY
+ assert_equal scope.path, ""
+ end
+
+ def test_path_against_one_element
+ scope = Scope.make(:one)
+ assert_equal "one", scope.path
+ end
+
+ def test_path_against_two_elements
+ scope = Scope.make(:inner, :outer)
+ assert_equal "outer:inner", scope.path
+ end
+
+ def test_path_with_task_name
+ scope = Scope.make(:inner, :outer)
+ assert_equal "outer:inner:task", scope.path_with_task_name("task")
+ end
+
+ def test_path_with_task_name_against_empty_scope
+ scope = Scope.make
+ assert_equal "task", scope.path_with_task_name("task")
+ end
+
+ def test_conj_against_two_elements
+ scope = Scope.make.conj("B").conj("A")
+ assert_equal Scope.make("A", "B"), scope
+ end
+
+ def test_trim
+ scope = Scope.make("A", "B")
+ assert_equal scope, scope.trim(0)
+ assert_equal scope.tail, scope.trim(1)
+ assert_equal scope.tail.tail, scope.trim(2)
+ assert_equal scope.tail.tail, scope.trim(3)
+ end
+end
diff --git a/test/rake/test_rake_task.rb b/test/rake/test_rake_task.rb
index 7d844ac22b..d7f14efcdb 100644
--- a/test/rake/test_rake_task.rb
+++ b/test/rake/test_rake_task.rb
@@ -13,6 +13,7 @@ class TestRakeTask < Rake::TestCase
def teardown
Rake::TaskManager.record_task_metadata = false
+ Rake.application.thread_pool.join
super
end
@@ -32,7 +33,6 @@ class TestRakeTask < Rake::TestCase
end
def test_inspect
-# t = task(:foo, :needs => [:bar, :baz])
t = task(:foo => [:bar, :baz])
assert_equal "<Rake::Task foo => [bar, baz]>", t.inspect
end
@@ -157,8 +157,8 @@ class TestRakeTask < Rake::TestCase
def test_multi_invocations
runs = []
p = proc do |t| runs << t.name end
- task({:t1=>[:t2,:t3]}, &p)
- task({:t2=>[:t3]}, &p)
+ task({ :t1 => [:t2, :t3] }, &p)
+ task({ :t2 => [:t3] }, &p)
task(:t3, &p)
Task[:t1].invoke
assert_equal ["t1", "t2", "t3"], runs.sort
@@ -167,7 +167,7 @@ class TestRakeTask < Rake::TestCase
def test_task_list
task :t2
task :t1 => [:t2]
- assert_equal ["t1", "t2"], Task.tasks.collect {|t| t.name}
+ assert_equal ["t1", "t2"], Task.tasks.map { |t| t.name }
end
def test_task_gives_name_on_to_s
@@ -221,6 +221,31 @@ class TestRakeTask < Rake::TestCase
assert_equal [b, c], a.prerequisite_tasks
end
+ def test_all_prerequisite_tasks_includes_all_prerequisites
+ a = task :a => "b"
+ b = task :b => ["c", "d"]
+ c = task :c => "e"
+ d = task :d
+ e = task :e
+
+ assert_equal [b, c, d, e], a.all_prerequisite_tasks.sort_by { |t| t.name }
+ end
+
+ def test_all_prerequisite_tasks_does_not_include_duplicates
+ a = task :a => ["b", "c"]
+ b = task :b => "c"
+ c = task :c
+
+ assert_equal [b, c], a.all_prerequisite_tasks.sort_by { |t| t.name }
+ end
+
+ def test_all_prerequisite_tasks_includes_self_on_cyclic_dependencies
+ a = task :a => "b"
+ b = task :b => "a"
+
+ assert_equal [a, b], a.all_prerequisite_tasks.sort_by { |t| t.name }
+ end
+
def test_timestamp_returns_now_if_all_prereqs_have_no_times
a = task :a => ["b", "c"]
task :b
@@ -238,7 +263,7 @@ class TestRakeTask < Rake::TestCase
def b.timestamp() Time.now + 10 end
def c.timestamp() Time.now + 5 end
- assert_in_delta now + 10, a.timestamp, 0.1, 'computer too slow?'
+ assert_in_delta now, a.timestamp, 0.1, 'computer too slow?'
end
def test_always_multitask
@@ -246,16 +271,16 @@ class TestRakeTask < Rake::TestCase
result = []
t_a = task(:a) do |t|
- sleep 0.02
- mx.synchronize{ result << t.name }
+ sleep 0.2
+ mx.synchronize { result << t.name }
end
t_b = task(:b) do |t|
- mx.synchronize{ result << t.name }
+ mx.synchronize { result << t.name }
end
- t_c = task(:c => [:a,:b]) do |t|
- mx.synchronize{ result << t.name }
+ t_c = task(:c => [:a, :b]) do |t|
+ mx.synchronize { result << t.name }
end
t_c.invoke
@@ -283,6 +308,41 @@ class TestRakeTask < Rake::TestCase
assert_match(/pre-requisites:\s*--t[23]/, out)
end
+ # NOTE: Rail-ties uses comment=.
+ def test_comment_setting
+ t = task(:t, :name, :rev)
+ t.comment = "A Comment"
+ assert_equal "A Comment", t.comment
+ end
+
+ def test_comments_with_sentences
+ desc "Comment 1. Comment 2."
+ t = task(:t, :name, :rev)
+ assert_equal "Comment 1", t.comment
+ end
+
+ def test_comments_with_tabbed_sentences
+ desc "Comment 1.\tComment 2."
+ t = task(:t, :name, :rev)
+ assert_equal "Comment 1", t.comment
+ end
+
+ def test_comments_with_decimal_points
+ desc "Revision 1.2.3."
+ t = task(:t, :name, :rev)
+ assert_equal "Revision 1.2.3", t.comment
+ end
+
+ def test_comments_do_not_set
+ t = task(:t, :name, :rev)
+ assert_equal nil, t.comment
+ end
+
+ def test_comments_is_nil
+ t = task(:t, :name, :rev)
+ t.comment = nil
+ assert_equal nil, t.comment
+ end
def test_extended_comments
desc %{
@@ -294,7 +354,7 @@ class TestRakeTask < Rake::TestCase
}
t = task(:t, :name, :rev)
assert_equal "[name,rev]", t.arg_description
- assert_equal "This is a comment.", t.comment
+ assert_equal "This is a comment", t.comment
assert_match(/^\s*name -- Name/, t.full_comment)
assert_match(/^\s*rev -- Software/, t.full_comment)
assert_match(/\A\s*This is a comment\.$/, t.full_comment)
@@ -308,9 +368,26 @@ class TestRakeTask < Rake::TestCase
assert_equal "line one / line two", t.comment
end
- def test_settable_comments
+ def test_duplicate_comments
+ desc "line one"
t = task(:t)
- t.comment = "HI"
- assert_equal "HI", t.comment
+ desc "line one"
+ task(:t)
+ assert_equal "line one", t.comment
+ end
+
+ def test_interspersed_duplicate_comments
+ desc "line one"
+ t = task(:t)
+ desc "line two"
+ task(:t)
+ desc "line one"
+ task(:t)
+ assert_equal "line one / line two", t.comment
+ end
+
+ def test_source_is_first_prerequisite
+ t = task :t => ["preqA", "preqB"]
+ assert_equal "preqA", t.source
end
end
diff --git a/test/rake/test_rake_task_argument_parsing.rb b/test/rake/test_rake_task_argument_parsing.rb
index 9b99991de9..3cb5d9cfe3 100644
--- a/test/rake/test_rake_task_argument_parsing.rb
+++ b/test/rake/test_rake_task_argument_parsing.rb
@@ -43,6 +43,22 @@ class TestRakeTaskArgumentParsing < Rake::TestCase
assert_equal ["a one ana", "two"], args
end
+ def test_can_handle_commas_in_args
+ name, args = @app.parse_task_string("name[one, two, three_a\\, three_b, four]")
+ assert_equal "name", name
+ assert_equal ["one", "two", "three_a, three_b", "four"], args
+ end
+
+ def test_treat_blank_arg_as_empty_string
+ name, args = @app.parse_task_string("name[one,]")
+ assert_equal "name", name
+ assert_equal ["one", ""], args
+
+ name, args = @app.parse_task_string("name[one,,two]")
+ assert_equal "name", name
+ assert_equal ["one", "", "two"], args
+ end
+
def test_terminal_width_using_env
app = Rake::Application.new
app.terminal_columns = 1234
diff --git a/test/rake/test_rake_task_arguments.rb b/test/rake/test_rake_task_arguments.rb
index 7001a4aeb2..369ecf6e5c 100644
--- a/test/rake/test_rake_task_arguments.rb
+++ b/test/rake/test_rake_task_arguments.rb
@@ -19,6 +19,12 @@ class TestRakeTaskArguments < Rake::TestCase
assert_equal({:a => :one, :b => :two, :c => :three}, ta.to_hash)
end
+ def test_has_key
+ ta = Rake::TaskArguments.new([:a], [:one])
+ assert(ta.has_key?(:a))
+ refute(ta.has_key?(:b))
+ end
+
def test_to_s
ta = Rake::TaskArguments.new([:a, :b, :c], [1, 2, 3])
assert_equal ta.to_hash.inspect, ta.to_s
@@ -26,8 +32,8 @@ class TestRakeTaskArguments < Rake::TestCase
end
def test_enumerable_behavior
- ta = Rake::TaskArguments.new([:a, :b, :c], [1, 2 ,3])
- assert_equal [10, 20, 30], ta.collect { |k,v| v * 10 }.sort
+ ta = Rake::TaskArguments.new([:a, :b, :c], [1, 2, 3])
+ assert_equal [10, 20, 30], ta.map { |k, v| v * 10 }.sort
end
def test_named_args
@@ -85,4 +91,37 @@ class TestRakeTaskArguments < Rake::TestCase
ta.with_defaults({ "cc" => "default_val" })
assert_nil ta[:cc]
end
+
+ def test_all_and_extra_arguments_without_named_arguments
+ app = Rake::Application.new
+ _, args = app.parse_task_string("task[1,two,more]")
+ ta = Rake::TaskArguments.new([], args)
+ assert_equal [], ta.names
+ assert_equal ['1', 'two', 'more'], ta.to_a
+ assert_equal ['1', 'two', 'more'], ta.extras
+ end
+
+ def test_all_and_extra_arguments_with_named_arguments
+ app = Rake::Application.new
+ _, args = app.parse_task_string("task[1,two,more,still more]")
+ ta = Rake::TaskArguments.new([:first, :second], args)
+ assert_equal [:first, :second], ta.names
+ assert_equal "1", ta[:first]
+ assert_equal "two", ta[:second]
+ assert_equal ['1', 'two', 'more', 'still more'], ta.to_a
+ assert_equal ['more', 'still more'], ta.extras
+ end
+
+ def test_extra_args_with_less_than_named_arguments
+ app = Rake::Application.new
+ _, args = app.parse_task_string("task[1,two]")
+ ta = Rake::TaskArguments.new([:first, :second, :third], args)
+ assert_equal [:first, :second, :third], ta.names
+ assert_equal "1", ta[:first]
+ assert_equal "two", ta[:second]
+ assert_equal nil, ta[:third]
+ assert_equal ['1', 'two'], ta.to_a
+ assert_equal [], ta.extras
+ end
+
end
diff --git a/test/rake/test_rake_task_manager.rb b/test/rake/test_rake_task_manager.rb
index 110ce65d4c..c2730b67e2 100644
--- a/test/rake/test_rake_task_manager.rb
+++ b/test/rake/test_rake_task_manager.rb
@@ -37,7 +37,24 @@ class TestRakeTaskManager < Rake::TestCase
t = @tm.define_task(Rake::Task, :t)
assert_equal "x:t", t.name
end
- assert_equal ["x:t"], @tm.tasks.collect { |t| t.name }
+ assert_equal ["x:t"], @tm.tasks.map { |t| t.name }
+ end
+
+ def test_define_namespaced_task
+ t = @tm.define_task(Rake::Task, 'n:a:m:e:t')
+ assert_equal Rake::Scope.make("e", "m", "a", "n"), t.scope
+ assert_equal "n:a:m:e:t", t.name
+ assert_equal @tm, t.application
+ end
+
+ def test_define_namespace_in_namespace
+ t = nil
+ @tm.in_namespace("n") do
+ t = @tm.define_task(Rake::Task, 'a:m:e:t')
+ end
+ assert_equal Rake::Scope.make("e", "m", "a", "n"), t.scope
+ assert_equal "n:a:m:e:t", t.name
+ assert_equal @tm, t.application
end
def test_anonymous_namespace
@@ -55,7 +72,7 @@ class TestRakeTaskManager < Rake::TestCase
assert_equal "fn", t.name
end
- assert_equal ["fn"], @tm.tasks.collect { |t| t.name }
+ assert_equal ["fn"], @tm.tasks.map { |t| t.name }
end
def test_namespace_yields_same_namespace_as_returned
@@ -89,11 +106,12 @@ class TestRakeTaskManager < Rake::TestCase
@tm.in_namespace("a") do
aa = @tm.define_task(Rake::Task, :aa)
mid_z = @tm.define_task(Rake::Task, :z)
+ ns_d = @tm.define_task(Rake::Task, "n:t")
@tm.in_namespace("b") do
bb = @tm.define_task(Rake::Task, :bb)
bot_z = @tm.define_task(Rake::Task, :z)
- assert_equal ["a", "b"], @tm.current_scope
+ assert_equal Rake::Scope.make("b", "a"), @tm.current_scope
assert_equal bb, @tm["a:b:bb"]
assert_equal aa, @tm["a:aa"]
@@ -101,10 +119,11 @@ class TestRakeTaskManager < Rake::TestCase
assert_equal bot_z, @tm["z"]
assert_equal mid_z, @tm["^z"]
assert_equal top_z, @tm["^^z"]
+ assert_equal top_z, @tm["^^^z"] # Over the top
assert_equal top_z, @tm["rake:z"]
end
- assert_equal ["a"], @tm.current_scope
+ assert_equal Rake::Scope.make("a"), @tm.current_scope
assert_equal bb, @tm["a:b:bb"]
assert_equal aa, @tm["a:aa"]
@@ -113,18 +132,21 @@ class TestRakeTaskManager < Rake::TestCase
assert_equal aa, @tm["aa"]
assert_equal mid_z, @tm["z"]
assert_equal top_z, @tm["^z"]
+ assert_equal top_z, @tm["^^z"] # Over the top
assert_equal top_z, @tm["rake:z"]
+ assert_equal ns_d, @tm["n:t"]
+ assert_equal ns_d, @tm["a:n:t"]
end
- assert_equal [], @tm.current_scope
+ assert_equal Rake::Scope.make, @tm.current_scope
- assert_equal [], xx.scope
- assert_equal ['a'], aa.scope
- assert_equal ['a', 'b'], bb.scope
+ assert_equal Rake::Scope.make, xx.scope
+ assert_equal Rake::Scope.make('a'), aa.scope
+ assert_equal Rake::Scope.make('b', 'a'), bb.scope
end
def test_lookup_with_explicit_scopes
- t1, t2, t3, s = (0...4).collect { nil }
+ t1, t2, t3, s = (0...4).map { nil }
t1 = @tm.define_task(Rake::Task, :t)
@tm.in_namespace("a") do
t2 = @tm.define_task(Rake::Task, :t)
@@ -133,11 +155,11 @@ class TestRakeTaskManager < Rake::TestCase
t3 = @tm.define_task(Rake::Task, :t)
end
end
- assert_equal t1, @tm[:t, []]
- assert_equal t2, @tm[:t, ["a"]]
- assert_equal t3, @tm[:t, ["a", "b"]]
- assert_equal s, @tm[:s, ["a", "b"]]
- assert_equal s, @tm[:s, ["a"]]
+ assert_equal t1, @tm[:t, Rake::Scope.make]
+ assert_equal t2, @tm[:t, Rake::Scope.make("a")]
+ assert_equal t3, @tm[:t, Rake::Scope.make("b", "a")]
+ assert_equal s, @tm[:s, Rake::Scope.make("b", "a")]
+ assert_equal s, @tm[:s, Rake::Scope.make("a")]
end
def test_correctly_scoped_prerequisites_are_invoked
@@ -154,4 +176,3 @@ class TestRakeTaskManager < Rake::TestCase
end
end
-
diff --git a/test/rake/test_rake_task_manager_argument_resolution.rb b/test/rake/test_rake_task_manager_argument_resolution.rb
index 35e0862ef7..43fa2ac447 100644
--- a/test/rake/test_rake_task_manager_argument_resolution.rb
+++ b/test/rake/test_rake_task_manager_argument_resolution.rb
@@ -2,28 +2,11 @@ require File.expand_path('../helper', __FILE__)
class TestRakeTaskManagerArgumentResolution < Rake::TestCase
- def setup
- super
-
- Rake.application.options.ignore_deprecate = true
- end
-
- def teardown
- Rake.application.options.ignore_deprecate = false
-
- super
- end
-
def test_good_arg_patterns
assert_equal [:t, [], []], task(:t)
assert_equal [:t, [], [:x]], task(:t => :x)
assert_equal [:t, [], [:x, :y]], task(:t => [:x, :y])
- assert_equal [:t, [:a, :b], []], task(:t, :a, :b)
- assert_equal [:t, [], [:x]], task(:t, :needs => :x)
- assert_equal [:t, [:a, :b], [:x]], task(:t, :a, :b, :needs => :x)
- assert_equal [:t, [:a, :b], [:x, :y]], task(:t, :a, :b, :needs => [:x, :y])
-
assert_equal [:t, [:a, :b], []], task(:t, [:a, :b])
assert_equal [:t, [:a, :b], [:x]], task(:t, [:a, :b] => :x)
assert_equal [:t, [:a, :b], [:x, :y]], task(:t, [:a, :b] => [:x, :y])
diff --git a/test/rake/test_rake_task_with_arguments.rb b/test/rake/test_rake_task_with_arguments.rb
index cf4c157256..8646fc041b 100644
--- a/test/rake/test_rake_task_with_arguments.rb
+++ b/test/rake/test_rake_task_with_arguments.rb
@@ -12,6 +12,7 @@ class TestRakeTaskWithArguments < Rake::TestCase
def teardown
Rake::TaskManager.record_task_metadata = false
+ Rake.application.thread_pool.join
super
end
@@ -33,21 +34,11 @@ class TestRakeTaskWithArguments < Rake::TestCase
assert_equal ["pre"], t.prerequisites
end
- def test_name_args_and_explicit_needs
- ignore_deprecations do
- t = task(:t, :x, :y, :needs => [:pre])
- assert_equal "t", t.name
- assert_equal [:x, :y], t.arg_names
- assert_equal ["pre"], t.prerequisites
- end
- end
-
- def test_illegal_keys_in_task_name_hash
- ignore_deprecations do
- assert_raises RuntimeError do
- task(:t, :x, :y => 1, :needs => [:pre])
- end
- end
+ def test_name_args_and_prereqs
+ t = task(:t, [:x, :y] => [:pre])
+ assert_equal "t", t.name
+ assert_equal [:x, :y], t.arg_names
+ assert_equal ["pre"], t.prerequisites
end
def test_arg_list_is_empty_if_no_args_given
@@ -91,7 +82,7 @@ class TestRakeTaskWithArguments < Rake::TestCase
def test_arguments_are_passed_to_block
t = task(:t, :a, :b) { |tt, args|
- assert_equal( { :a => 1, :b => 2 }, args.to_hash )
+ assert_equal({ :a => 1, :b => 2 }, args.to_hash)
}
t.invoke(1, 2)
end
@@ -131,7 +122,7 @@ class TestRakeTaskWithArguments < Rake::TestCase
assert_equal "T", t.comment
assert_equal "[a,b]", t.arg_description
assert_equal "tt[a,b]", t.name_with_args
- assert_equal [:a, :b],t.arg_names
+ assert_equal [:a, :b], t.arg_names
end
def test_named_args_are_passed_to_prereqs
diff --git a/test/rake/test_rake_test_task.rb b/test/rake/test_rake_test_task.rb
index 1a6d23e425..80fe9a28b4 100644
--- a/test/rake/test_rake_test_task.rb
+++ b/test/rake/test_rake_test_task.rb
@@ -16,11 +16,13 @@ class TestRakeTestTask < Rake::TestCase
def test_initialize_override
tt = Rake::TestTask.new(:example) do |t|
+ t.description = "Run example tests"
t.libs = ['src', 'ext']
t.pattern = 'test/tc_*.rb'
t.verbose = true
end
refute_nil tt
+ assert_equal "Run example tests", tt.description
assert_equal :example, tt.name
assert_equal ['src', 'ext'], tt.libs
assert_equal 'test/tc_*.rb', tt.pattern
@@ -28,7 +30,7 @@ class TestRakeTestTask < Rake::TestCase
assert Task.task_defined?(:example)
end
- def test_file_list_ENV_TEST
+ def test_file_list_env_test
ENV['TEST'] = 'testfile.rb'
tt = Rake::TestTask.new do |t|
t.pattern = '*'
@@ -81,11 +83,31 @@ class TestRakeTestTask < Rake::TestCase
end
def test_run_code_rake
+ spec = Gem::Specification.new 'rake', 0
+ spec.loaded_from = File.join Gem::Specification.dirs.last, 'rake-0.gemspec'
+ rake, Gem.loaded_specs['rake'] = Gem.loaded_specs['rake'], spec
+
test_task = Rake::TestTask.new do |t|
t.loader = :rake
end
- assert_match(/-I".*?" ".*?"/, test_task.run_code)
+ assert_match(/\A-I".*?" ".*?"\Z/, test_task.run_code)
+ ensure
+ Gem.loaded_specs['rake'] = rake
+ end
+
+ def test_run_code_rake_default_gem
+ default_spec = Gem::Specification.new 'rake', 0
+ default_spec.loaded_from = File.join Gem::Specification.default_specifications_dir, 'rake-0.gemspec'
+ rake, Gem.loaded_specs['rake'] = Gem.loaded_specs['rake'], default_spec
+
+ test_task = Rake::TestTask.new do |t|
+ t.loader = :rake
+ end
+
+ assert_match(/\A(-I".*?" *)* ".*?"\Z/, test_task.run_code)
+ ensure
+ Gem.loaded_specs['rake'] = rake
end
def test_run_code_testrb_ruby_1_8_2
@@ -117,4 +139,3 @@ class TestRakeTestTask < Rake::TestCase
end
end
-
diff --git a/test/rake/test_rake_thread_pool.rb b/test/rake/test_rake_thread_pool.rb
index cc8163a9e0..421c38d90d 100644
--- a/test/rake/test_rake_thread_pool.rb
+++ b/test/rake/test_rake_thread_pool.rb
@@ -7,25 +7,34 @@ class TestRakeTestThreadPool < Rake::TestCase
def test_pool_executes_in_current_thread_for_zero_threads
pool = ThreadPool.new(0)
- f = pool.future{Thread.current}
+ f = pool.future { Thread.current }
pool.join
assert_equal Thread.current, f.value
end
def test_pool_executes_in_other_thread_for_pool_of_size_one
pool = ThreadPool.new(1)
- f = pool.future{Thread.current}
+ f = pool.future { Thread.current }
pool.join
refute_equal Thread.current, f.value
end
def test_pool_executes_in_two_other_threads_for_pool_of_size_two
pool = ThreadPool.new(2)
- threads = 2.times.collect{ pool.future{ sleep 0.1; Thread.current } }.each{|f|f.value}
+ threads = 2.times.map {
+ pool.future {
+ sleep 0.1
+ Thread.current
+ }
+ }.each { |f|
+ f.value
+ }
refute_equal threads[0], threads[1]
refute_equal Thread.current, threads[0]
refute_equal Thread.current, threads[1]
+ ensure
+ pool.join
end
def test_pool_creates_the_correct_number_of_threads
@@ -35,22 +44,20 @@ class TestRakeTestThreadPool < Rake::TestCase
10.times.each do
pool.future do
sleep 0.02
- t_mutex.synchronize{ threads << Thread.current }
+ t_mutex.synchronize { threads << Thread.current }
end
end
pool.join
assert_equal 2, threads.count
end
- def test_pool_future_captures_arguments
+ def test_pool_future_does_not_duplicate_arguments
pool = ThreadPool.new(2)
- a = 'a'
- b = 'b'
- c = 5 # 5 throws an exception with 5.dup. It should be ignored
- pool.future(a,c){ |a_var,ignore| a_var.capitalize!; b.capitalize! }
+ obj = Object.new
+ captured = nil
+ pool.future(obj) { |var| captured = var }
pool.join
- assert_equal 'a', a
- assert_equal 'b'.capitalize, b
+ assert_equal obj, captured
end
def test_pool_join_empties_queue
@@ -69,35 +76,51 @@ class TestRakeTestThreadPool < Rake::TestCase
}
pool.join
- assert_equal true, pool.__send__(:__queue__).empty?, "queue should be empty"
+ assert_equal(
+ true,
+ pool.__send__(:__queue__).empty?,
+ "queue should be empty")
end
+ CustomError = Class.new(StandardError)
+
# test that throwing an exception way down in the blocks propagates
# to the top
def test_exceptions
pool = ThreadPool.new(10)
deep_exception_block = lambda do |count|
- next raise Exception.new if ( count < 1 )
- pool.future(count-1, &deep_exception_block).value
+ raise CustomError if count < 1
+ pool.future(count - 1, &deep_exception_block).value
end
- assert_raises(Exception) do
+ assert_raises(CustomError) do
pool.future(2, &deep_exception_block).value
end
-
+ ensure
+ pool.join
end
def test_pool_prevents_deadlock
pool = ThreadPool.new(5)
common_dependency_a = pool.future { sleep 0.2 }
- futures_a = 10.times.collect { pool.future{ common_dependency_a.value; sleep(rand() * 0.01) } }
+ futures_a = 10.times.map {
+ pool.future {
+ common_dependency_a.value
+ sleep(rand() * 0.01)
+ }
+ }
common_dependency_b = pool.future { futures_a.each { |f| f.value } }
- futures_b = 10.times.collect { pool.future{ common_dependency_b.value; sleep(rand() * 0.01) } }
+ futures_b = 10.times.map {
+ pool.future {
+ common_dependency_b.value
+ sleep(rand() * 0.01)
+ }
+ }
- futures_b.each{|f|f.value}
+ futures_b.each { |f| f.value }
pool.join
end
@@ -108,15 +131,15 @@ class TestRakeTestThreadPool < Rake::TestCase
b = 5
c = 3
- result = a.times.collect do
+ result = a.times.map do
pool.future do
- b.times.collect do
+ b.times.map do
pool.future { sleep rand * 0.001; c }
- end.inject(0) { |m,f| m+f.value }
+ end.reduce(0) { |m, f| m + f.value }
end
- end.inject(0) { |m,f| m+f.value }
+ end.reduce(0) { |m, f| m + f.value }
- assert_equal( (a*b*c), result )
+ assert_equal a * b * c, result
pool.join
end
diff --git a/test/rake/test_rake_top_level_functions.rb b/test/rake/test_rake_top_level_functions.rb
index 4cc4b4cfdd..fee702dc13 100644
--- a/test/rake/test_rake_top_level_functions.rb
+++ b/test/rake/test_rake_top_level_functions.rb
@@ -65,46 +65,6 @@ class TestRakeTopLevelFunctions < Rake::TestCase
Rake::FileUtilsExt.nowrite_flag = false
end
- def test_missing_constants_task
- Object.const_missing(:Task)
-
- expected = [
- [[:const_warning, :Task], nil]
- ]
-
- assert_equal expected, @app.called
- end
-
- def test_missing_constants_file_task
- Object.const_missing(:FileTask)
-
- expected = [
- [[:const_warning, :FileTask], nil]
- ]
-
- assert_equal expected, @app.called
- end
-
- def test_missing_constants_file_creation_task
- Object.const_missing(:FileCreationTask)
-
- expected = [
- [[:const_warning, :FileCreationTask], nil]
- ]
-
- assert_equal expected, @app.called
- end
-
- def test_missing_constants_rake_app
- Object.const_missing(:RakeApp)
-
- expected = [
- [[:const_warning, :RakeApp], nil]
- ]
-
- assert_equal expected, @app.called
- end
-
def test_missing_other_constant
assert_raises(NameError) do Object.const_missing(:Xyz) end
end
diff --git a/test/rake/test_sys.rb b/test/rake/test_sys.rb
deleted file mode 100644
index 21f7e2c708..0000000000
--- a/test/rake/test_sys.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-require File.expand_path('../helper', __FILE__)
-begin
- old_verbose = $VERBOSE
- $VERBOSE = nil
- require 'rake/contrib/sys'
-ensure
- $VERBOSE = old_verbose
-end
-
-class TestSys < Rake::TestCase
-
- def test_split_all
- assert_equal ['a'], Sys.split_all('a')
- assert_equal ['..'], Sys.split_all('..')
- assert_equal ['/'], Sys.split_all('/')
- assert_equal ['a', 'b'], Sys.split_all('a/b')
- assert_equal ['/', 'a', 'b'], Sys.split_all('/a/b')
- assert_equal ['..', 'a', 'b'], Sys.split_all('../a/b')
- end
-end
diff --git a/test/rake/test_thread_history_display.rb b/test/rake/test_thread_history_display.rb
index 2ac83b0dc0..bb5879cff5 100644
--- a/test/rake/test_thread_history_display.rb
+++ b/test/rake/test_thread_history_display.rb
@@ -5,7 +5,7 @@ require 'rake/thread_history_display'
class TestThreadHistoryDisplay < Rake::TestCase
def setup
super
- @time = 1000000
+ @time = 1_000_000
@stats = []
@display = Rake::ThreadHistoryDisplay.new(@stats)
end
@@ -60,24 +60,34 @@ class TestThreadHistoryDisplay < Rake::TestCase
end
def test_thread_deleted
- @stats << event(:thread_deleted, :deleted_thread => 123456, :thread_count => 12)
+ @stats << event(
+ :thread_deleted,
+ :deleted_thread => 123_456,
+ :thread_count => 12)
out, _ = capture_io do
@display.show
end
- assert_match(/^ *1000000 +A +thread_deleted( +deleted_thread:B| +thread_count:12){2}$/, out)
+ assert_match(
+ /^ *1000000 +A +thread_deleted( +deleted_thread:B| +thread_count:12){2}$/,
+ out)
end
def test_thread_created
- @stats << event(:thread_created, :new_thread => 123456, :thread_count => 13)
+ @stats << event(
+ :thread_created,
+ :new_thread => 123_456,
+ :thread_count => 13)
out, _ = capture_io do
@display.show
end
- assert_match(/^ *1000000 +A +thread_created( +new_thread:B| +thread_count:13){2}$/, out)
+ assert_match(
+ /^ *1000000 +A +thread_created( +new_thread:B| +thread_count:13){2}$/,
+ out)
end
private
- def event(type, data={})
+ def event(type, data = {})
result = {
:event => type,
:time => @time / 1_000_000.0,
diff --git a/test/rake/test_trace_output.rb b/test/rake/test_trace_output.rb
index 750ea1447e..f9aead989d 100644
--- a/test/rake/test_trace_output.rb
+++ b/test/rake/test_trace_output.rb
@@ -6,10 +6,12 @@ class TestTraceOutput < Rake::TestCase
class PrintSpy
attr_reader :result, :calls
+
def initialize
@result = ""
@calls = 0
end
+
def print(string)
@result << string
@calls += 1
@@ -30,6 +32,13 @@ class TestTraceOutput < Rake::TestCase
assert_equal 1, spy.calls
end
+ def test_trace_handles_nil_objects
+ spy = PrintSpy.new
+ trace_on(spy, "HI\n", nil, "LO")
+ assert_equal "HI\nLO\n", spy.result
+ assert_equal 1, spy.calls
+ end
+
def test_trace_issues_single_io_for_args_multiple_strings_and_alternate_sep
old_sep = $\
$\ = "\r"
diff --git a/test/rdoc/test.ja.large.rdoc b/test/rdoc/test.ja.large.rdoc
deleted file mode 100644
index a9c6c4691c..0000000000
--- a/test/rdoc/test.ja.large.rdoc
+++ /dev/null
@@ -1,3 +0,0 @@
-# -*- coding: utf-8 -*-
- 吾輩(わがはい)は猫である。名前はまだ無い。
- どこで生れたかとんと見当(けんとう)がつかぬ。何でも薄暗いじめじめした所でニャーニャー泣いていた事だけは記憶している。吾輩はここで始めて人間というものを見た。しかもあとで聞くとそれは書生という人間中で一番獰悪(どうあく)な種族であったそうだ。この書生というのは時々我々を捕(つかま)えて煮(に)て食うという話である。しかしその当時は何という考もなかったから別段恐しいとも思わなかった。ただ彼の掌(てのひら)に載せられてスーと持ち上げられた時何だかフワフワした感じがあったばかりである。掌の上で少し落ちついて書生の顔を見たのがいわゆる人間というものの見始(みはじめ)であろう。この時妙なものだと思った感じが今でも残っている。第一毛をもって装飾されべきはずの顔がつるつるしてまるで薬缶(やかん)だ。その後(ご)猫にもだいぶ逢(あ)ったがこんな片輪(かたわ)には一度も出会(でく)わした事がない。のみならず顔の真中があまりに突起している。そうしてその穴の中から時々ぷうぷうと煙(けむり)を吹く。どうも咽(む)せぽくて実に弱った。これが人間の飲む煙草(たばこ)というものである事はようやくこの頃知った。
diff --git a/test/rdoc/test_attribute_manager.rb b/test/rdoc/test_attribute_manager.rb
deleted file mode 100644
index 8832a5d515..0000000000
--- a/test/rdoc/test_attribute_manager.rb
+++ /dev/null
@@ -1,120 +0,0 @@
-require 'rdoc/test_case'
-
-class TestAttributeManager < RDoc::TestCase # HACK fix test name
-
- def setup
- super
-
- @options = RDoc::Options.new
-
- @am = RDoc::Markup::AttributeManager.new
- @klass = RDoc::Markup::AttributeManager
- @formatter = RDoc::Markup::Formatter.new @options
- @formatter.add_tag :BOLD, '<B>', '</B>'
- @formatter.add_tag :EM, '<EM>', '</EM>'
- @formatter.add_tag :TT, '<CODE>', '</CODE>'
- end
-
- def test_convert_attrs_ignores_code
- assert_equal 'foo <CODE>__send__</CODE> bar', output('foo <code>__send__</code> bar')
- end
-
- def test_convert_attrs_ignores_tt
- assert_equal 'foo <CODE>__send__</CODE> bar', output('foo <tt>__send__</tt> bar')
- end
-
- def test_convert_attrs_preserves_double
- assert_equal 'foo.__send__ :bar', output('foo.__send__ :bar')
- assert_equal 'use __FILE__ to', output('use __FILE__ to')
- end
-
- def test_convert_attrs_does_not_ignore_after_tt
- assert_equal 'the <CODE>IF:</CODE><EM>key</EM> directive', output('the <tt>IF:</tt>_key_ directive')
- end
-
- def test_initial_word_pairs
- word_pairs = @am.matching_word_pairs
- assert word_pairs.is_a?(Hash)
- assert_equal(3, word_pairs.size)
- end
-
- def test_initial_html
- html_tags = @am.html_tags
- assert html_tags.is_a?(Hash)
- assert_equal(5, html_tags.size)
- end
-
- def test_add_matching_word_pair
- @am.add_word_pair("x","x", :TEST)
- word_pairs = @am.matching_word_pairs
- assert_equal(4,word_pairs.size)
- assert(word_pairs.has_key?("x"))
- end
-
- def test_add_invalid_word_pair
- assert_raises ArgumentError do
- @am.add_word_pair("<", "<", :TEST)
- end
- end
-
- def test_add_word_pair_map
- @am.add_word_pair("x", "y", :TEST)
- word_pair_map = @am.word_pair_map
- assert_equal(1,word_pair_map.size)
- assert_equal(word_pair_map. keys.first.source, "(x)(\\S+)(y)")
- end
-
- def test_add_html_tag
- @am.add_html("Test", :TEST)
- tags = @am.html_tags
- assert_equal(6, tags.size)
- assert(tags.has_key?("test"))
- end
-
- def test_add_special
- @am.add_special "WikiWord", :WIKIWORD
- specials = @am.special
-
- assert_equal 1, specials.size
- assert specials.assoc "WikiWord"
- end
-
- def test_escapes
- assert_equal '<CODE>text</CODE>', output('<tt>text</tt>')
- assert_equal '<tt>text</tt>', output('\\<tt>text</tt>')
- assert_equal '<tt>', output('\\<tt>')
- assert_equal '<CODE><tt></CODE>', output('<tt>\\<tt></tt>')
- assert_equal '<CODE>\\<tt></CODE>', output('<tt>\\\\<tt></tt>')
- assert_equal '<B>text</B>', output('*text*')
- assert_equal '*text*', output('\\*text*')
- assert_equal '\\', output('\\')
- assert_equal '\\text', output('\\text')
- assert_equal '\\\\text', output('\\\\text')
- assert_equal 'text \\ text', output('text \\ text')
-
- assert_equal 'and <CODE>\\s</CODE> matches space',
- output('and <tt>\\s</tt> matches space')
- assert_equal 'use <CODE><tt>text</CODE></tt> for code',
- output('use <tt>\\<tt>text</tt></tt> for code')
- assert_equal 'use <CODE><tt>text</tt></CODE> for code',
- output('use <tt>\\<tt>text\\</tt></tt> for code')
- assert_equal 'use <tt><tt>text</tt></tt> for code',
- output('use \\<tt>\\<tt>text</tt></tt> for code')
- assert_equal 'use <tt><CODE>text</CODE></tt> for code',
- output('use \\<tt><tt>text</tt></tt> for code')
- assert_equal 'use <CODE>+text+</CODE> for code',
- output('use <tt>\\+text+</tt> for code')
- assert_equal 'use <tt><CODE>text</CODE></tt> for code',
- output('use \\<tt>+text+</tt> for code')
- assert_equal 'illegal <tag>not</tag> changed',
- output('illegal <tag>not</tag> changed')
- assert_equal 'unhandled <p>tag</p> unchanged',
- output('unhandled <p>tag</p> unchanged')
- end
-
- def output str
- @formatter.convert_flow @am.flow str
- end
-
-end
-
diff --git a/test/rdoc/test_rdoc_any_method.rb b/test/rdoc/test_rdoc_any_method.rb
index cb4a979392..90305807f8 100644
--- a/test/rdoc/test_rdoc_any_method.rb
+++ b/test/rdoc/test_rdoc_any_method.rb
@@ -38,10 +38,39 @@ method(a, b) { |c, d| ... }
assert_equal 'my_c1_m', @c1_m.c_function
end
+ def test_call_seq_equals
+ m = RDoc::AnyMethod.new nil, nil
+
+ m.call_seq = ''
+
+ assert_nil m.call_seq
+
+ m.call_seq = 'foo'
+
+ assert_equal 'foo', m.call_seq
+ end
+
def test_full_name
assert_equal 'C1::m', @c1.method_list.first.full_name
end
+ def test_is_alias_for
+ assert_equal @c2_b, @c2_a.is_alias_for
+
+ # set string on instance variable
+ loaded = Marshal.load Marshal.dump @c2_a
+
+ loaded.store = @store
+
+ assert_equal @c2_b, loaded.is_alias_for, 'Marshal.load'
+
+ m1 = RDoc::AnyMethod.new nil, 'm1'
+ m1.store = @store
+ m1.instance_variable_set :@is_alias_for, ['Missing', false, 'method']
+
+ assert_nil m1.is_alias_for, 'missing alias'
+ end
+
def test_markup_code
tokens = [
RDoc::RubyToken::TkCONSTANT. new(0, 0, 0, 'CONSTANT'),
@@ -101,11 +130,14 @@ method(a, b) { |c, d| ... }
end
def test_marshal_load_aliased_method
- aliased_method = Marshal.load Marshal.dump(@c2.method_list.last)
+ aliased_method = Marshal.load Marshal.dump(@c2_a)
+
+ aliased_method.store = @store
assert_equal 'C2#a', aliased_method.full_name
assert_equal 'C2', aliased_method.parent_name
assert_equal '()', aliased_method.params
+ assert_equal @c2_b, aliased_method.is_alias_for, 'is_alias_for'
assert aliased_method.display?
end
@@ -170,16 +202,87 @@ method(a, b) { |c, d| ... }
assert_equal nil, loaded.file
assert_equal cm, loaded.parent
assert_equal section, loaded.section
+ assert_nil loaded.is_alias_for
assert loaded.display?
end
+ def test_marshal_dump_version_2
+ @store.path = Dir.tmpdir
+ top_level = @store.add_file 'file.rb'
+
+ m = RDoc::AnyMethod.new nil, 'method'
+ m.block_params = 'some_block'
+ m.call_seq = 'call_seq'
+ m.comment = 'this is a comment'
+ m.params = 'param'
+ m.record_location top_level
+
+ cm = top_level.add_class RDoc::ClassModule, 'Klass'
+ cm.add_method m
+
+ section = cm.sections.first
+
+ al = RDoc::Alias.new nil, 'method', 'aliased', 'alias comment'
+ al_m = m.add_alias al, cm
+
+ loaded = Marshal.load "\x04\bU:\x14RDoc::AnyMethod[\x14i\bI" +
+ "\"\vmethod\x06:\x06ETI" +
+ "\"\x11Klass#method\x06;\x06T0:\vpublic" +
+ "o:\eRDoc::Markup::Document\b:\v@parts[\x06" +
+ "o:\x1CRDoc::Markup::Paragraph\x06;\t[\x06I" +
+ "\"\x16this is a comment\x06;\x06T:\n@file0" +
+ ":0@omit_headings_from_table_of_contents_below0" +
+ "I\"\rcall_seq\x06;\x06TI\"\x0Fsome_block\x06" +
+ ";\x06T[\x06[\aI\"\faliased\x06;\x06To;\b\b;\t" +
+ "[\x06o;\n\x06;\t[\x06I\"\x12alias comment\x06" +
+ ";\x06T;\v0;\f0I\"\nparam\x06;\x06TI" +
+ "\"\ffile.rb\x06;\x06TFI\"\nKlass\x06;\x06T" +
+ "c\x16RDoc::ClassModule0"
+
+ loaded.store = @store
+
+ comment = doc(para('this is a comment'))
+
+ assert_equal m, loaded
+
+ assert_equal [al_m.name], loaded.aliases.map { |alas| alas.name }
+ assert_equal 'some_block', loaded.block_params
+ assert_equal 'call_seq', loaded.call_seq
+ assert_equal comment, loaded.comment
+ assert_equal top_level, loaded.file
+ assert_equal 'Klass#method', loaded.full_name
+ assert_equal 'method', loaded.name
+ assert_equal 'param', loaded.params
+ assert_equal nil, loaded.singleton # defaults to nil
+ assert_equal :public, loaded.visibility
+ assert_equal cm, loaded.parent
+ assert_equal section, loaded.section
+ assert_nil loaded.is_alias_for
+ end
+
def test_name
m = RDoc::AnyMethod.new nil, nil
assert_nil m.name
end
+ def test_name_call_seq
+ m = RDoc::AnyMethod.new nil, nil
+
+ m.call_seq = "yields(name)\nyields(name, description)"
+
+ assert_equal 'yields', m.name
+ end
+
+ def test_name_call_seq_dot
+ m = RDoc::AnyMethod.new nil, nil
+
+ m.call_seq = "obj.yields(name)\nobj.yields(name, description)"
+
+ assert_equal 'yields', m.name
+ end
+
def test_param_list_block_params
m = RDoc::AnyMethod.new nil, 'method'
m.parent = @c1
@@ -231,6 +334,35 @@ method(a, b) { |c, d| ... }
assert_equal %w[a b c d], m.param_list
end
+ def test_param_list_empty_params_with_block
+ m = RDoc::AnyMethod.new nil, 'method'
+ m.parent = @c1
+
+ m.params = '()'
+ m.block_params = 'a, b'
+
+ assert_equal %w[a b], m.param_list
+ end
+
+ def test_param_list_ampersand_param_block_params
+ m = RDoc::AnyMethod.new nil, 'method'
+ m.parent = @c1
+
+ m.params = '(a, b, &block)'
+ m.block_params = 'c, d'
+
+ assert_equal %w[a b c d], m.param_list
+ end
+
+ def test_param_list_ampersand_param
+ m = RDoc::AnyMethod.new nil, 'method'
+ m.parent = @c1
+
+ m.params = '(a, b, &block)'
+
+ assert_equal %w[a b block], m.param_list
+ end
+
def test_param_seq
m = RDoc::AnyMethod.new nil, 'method'
m.parent = @c1
diff --git a/test/rdoc/test_rdoc_class_module.rb b/test/rdoc/test_rdoc_class_module.rb
index ec81282c35..0e06587dc6 100644
--- a/test/rdoc/test_rdoc_class_module.rb
+++ b/test/rdoc/test_rdoc_class_module.rb
@@ -2,13 +2,6 @@ require File.expand_path '../xref_test_case', __FILE__
class TestRDocClassModule < XrefTestCase
- def mu_pp obj
- s = ''
- s = PP.pp obj, s
- s.force_encoding Encoding.default_external if defined? Encoding
- s.chomp
- end
-
def test_add_comment
tl1 = @store.add_file 'one.rb'
tl2 = @store.add_file 'two.rb'
@@ -108,23 +101,23 @@ class TestRDocClassModule < XrefTestCase
def test_documented_eh
cm = RDoc::ClassModule.new 'C'
- refute cm.documented?
+ refute cm.documented?, 'no comments, no markers'
- cm.add_comment 'hi', @top_level
+ cm.add_comment '', @top_level
- assert cm.documented?
+ refute cm.documented?, 'empty comment'
- cm.comment.replace ''
+ cm.add_comment 'hi', @top_level
- assert cm.documented?
+ assert cm.documented?, 'commented'
cm.comment_location.clear
- refute cm.documented?
+ refute cm.documented?, 'no comment'
cm.document_self = nil # notify :nodoc:
- assert cm.documented?
+ assert cm.documented?, ':nodoc:'
end
def test_each_ancestor
@@ -165,6 +158,7 @@ class TestRDocClassModule < XrefTestCase
ns = tl.add_module RDoc::NormalModule, 'Namespace'
cm = ns.add_class RDoc::NormalClass, 'Klass', 'Super'
+ cm.document_self = true
cm.record_location tl
a1 = RDoc::Attr.new nil, 'a1', 'RW', ''
@@ -236,6 +230,59 @@ class TestRDocClassModule < XrefTestCase
assert_equal tl, loaded.method_list.first.file
end
+ def test_marshal_dump_visibilty
+ @store.path = Dir.tmpdir
+ tl = @store.add_file 'file.rb'
+
+ ns = tl.add_module RDoc::NormalModule, 'Namespace'
+
+ cm = ns.add_class RDoc::NormalClass, 'Klass', 'Super'
+ cm.record_location tl
+
+ a1 = RDoc::Attr.new nil, 'a1', 'RW', ''
+ a1.record_location tl
+ a1.document_self = false
+
+ m1 = RDoc::AnyMethod.new nil, 'm1'
+ m1.record_location tl
+ m1.document_self = false
+
+ c1 = RDoc::Constant.new 'C1', nil, ''
+ c1.record_location tl
+ c1.document_self = false
+
+ i1 = RDoc::Include.new 'I1', ''
+ i1.record_location tl
+ i1.document_self = false
+
+ e1 = RDoc::Extend.new 'E1', ''
+ e1.record_location tl
+ e1.document_self = false
+
+ section_comment = RDoc::Comment.new('section comment')
+ section_comment.location = tl
+
+ assert_equal 1, cm.sections.length, 'sanity, default section only'
+
+ cm.add_attribute a1
+ cm.add_method m1
+ cm.add_constant c1
+ cm.add_include i1
+ cm.add_extend e1
+ cm.add_comment 'this is a comment', tl
+
+ loaded = Marshal.load Marshal.dump cm
+ loaded.store = @store
+
+ assert_equal cm, loaded
+
+ assert_empty loaded.attributes
+ assert_empty loaded.constants
+ assert_empty loaded.includes
+ assert_empty loaded.extends
+ assert_empty loaded.method_list
+ end
+
def test_marshal_load_version_0
tl = @store.add_file 'file.rb'
ns = tl.add_module RDoc::NormalModule, 'Namespace'
@@ -1401,7 +1448,7 @@ class TestRDocClassModule < XrefTestCase
@c1.update_extends
- assert_equal [a, c], @c1.extends
+ assert_equal [a, b, c], @c1.extends
end
def test_update_extends_trim
diff --git a/test/rdoc/test_rdoc_code_object.rb b/test/rdoc/test_rdoc_code_object.rb
index ef8a5df713..2fb6ac23a5 100644
--- a/test/rdoc/test_rdoc_code_object.rb
+++ b/test/rdoc/test_rdoc_code_object.rb
@@ -100,24 +100,56 @@ class TestRDocCodeObject < XrefTestCase
refute @co.display?
end
+ def test_display_eh_suppress
+ assert @co.display?
+
+ @co.suppress
+
+ refute @co.display?
+
+ @co.comment = comment('hi')
+
+ refute @co.display?
+
+ @co.done_documenting = false
+
+ assert @co.display?
+
+ @co.ignore
+ @co.done_documenting = false
+
+ refute @co.display?
+ end
+
def test_document_children_equals
@co.document_children = false
+
refute @co.document_children
- # TODO this is not true anymore:
- # test all the nodoc stuff etc...
- #@c2.document_children = false
- #assert_empty @c2.classes
+ @store.rdoc.options.visibility = :nodoc
+
+ @co.store = @store
+
+ assert @co.document_children
+
+ @co.document_children = false
+
+ assert @co.document_children
end
def test_document_self_equals
@co.document_self = false
refute @co.document_self
- # TODO this is not true anymore:
- # test all the nodoc stuff etc...
- #@c1.document_self = false
- #assert_empty @c1.method_list
+ @store.rdoc.options.visibility = :nodoc
+
+ @co.store = @store
+
+ assert @co.document_self
+
+ @co.document_self = false
+
+ assert @co.document_self
end
def test_documented_eh
@@ -159,6 +191,18 @@ class TestRDocCodeObject < XrefTestCase
@co.done_documenting = false
assert @co.document_self
assert @co.document_children
+
+ @co.done_documenting = true
+
+ @store.rdoc.options.visibility = :nodoc
+
+ @co.store = @store
+
+ refute @co.done_documenting
+
+ @co.done_documenting = true
+
+ refute @co.done_documenting
end
def test_each_parent
@@ -195,6 +239,18 @@ class TestRDocCodeObject < XrefTestCase
refute @co.document_self
refute @co.document_children
assert @co.ignored?
+
+ @store.rdoc.options.visibility = :nodoc
+
+ @co.store = @store
+
+ assert @co.document_self
+ assert @co.document_children
+ refute @co.ignored?
+
+ @co.ignore
+
+ refute @co.ignored?
end
def test_ignore_eh
@@ -229,6 +285,14 @@ class TestRDocCodeObject < XrefTestCase
assert_equal 5, @c1_m.offset
end
+ def test_options
+ assert_kind_of RDoc::Options, @co.options
+
+ @co.store = @store
+
+ assert_same @options, @co.options
+ end
+
def test_parent_file_name
assert_equal '(unknown)', @co.parent_file_name
assert_equal 'xref_data.rb', @c1.parent_file_name
@@ -263,6 +327,13 @@ class TestRDocCodeObject < XrefTestCase
refute @co.ignored?
end
+ def test_record_location_suppressed
+ @co.suppress
+ @co.record_location @xref_data
+
+ refute @co.suppressed?
+ end
+
def test_section
parent = RDoc::Context.new
section = parent.sections.first
@@ -303,6 +374,30 @@ class TestRDocCodeObject < XrefTestCase
refute @co.ignored?
end
+ def test_start_doc_suppressed
+ @co.suppress
+
+ @co.start_doc
+
+ assert @co.document_self
+ assert @co.document_children
+ refute @co.suppressed?
+ end
+
+ def test_store_equals
+ @co.document_self = false
+
+ @co.store = @store
+
+ refute @co.document_self
+
+ @store.rdoc.options.visibility = :nodoc
+
+ @co.store = @store
+
+ assert @co.document_self
+ end
+
def test_stop_doc
@co.document_self = true
@co.document_children = true
@@ -311,6 +406,44 @@ class TestRDocCodeObject < XrefTestCase
refute @co.document_self
refute @co.document_children
+
+ @store.rdoc.options.visibility = :nodoc
+
+ @co.store = @store
+
+ assert @co.document_self
+ assert @co.document_children
+
+ @co.stop_doc
+
+ assert @co.document_self
+ assert @co.document_children
+ end
+
+ def test_suppress
+ @co.suppress
+
+ refute @co.document_self
+ refute @co.document_children
+ assert @co.suppressed?
+
+ @store.rdoc.options.visibility = :nodoc
+
+ @co.store = @store
+
+ refute @co.suppressed?
+
+ @co.suppress
+
+ refute @co.suppressed?
+ end
+
+ def test_suppress_eh
+ refute @co.suppressed?
+
+ @co.suppress
+
+ assert @co.suppressed?
end
end
diff --git a/test/rdoc/test_rdoc_constant.rb b/test/rdoc/test_rdoc_constant.rb
index 5c347f62ae..171963d8e4 100644
--- a/test/rdoc/test_rdoc_constant.rb
+++ b/test/rdoc/test_rdoc_constant.rb
@@ -8,6 +8,36 @@ class TestRDocConstant < XrefTestCase
@const = @c1.constants.first
end
+ def test_documented_eh
+ top_level = @store.add_file 'file.rb'
+
+ const = RDoc::Constant.new 'CONST', nil, nil
+ top_level.add_constant const
+
+ refute const.documented?
+
+ const.comment = comment 'comment'
+
+ assert const.documented?
+ end
+
+ def test_documented_eh_alias
+ top_level = @store.add_file 'file.rb'
+
+ const = RDoc::Constant.new 'CONST', nil, nil
+ top_level.add_constant const
+
+ refute const.documented?
+
+ const.is_alias_for = 'C1'
+
+ refute const.documented?
+
+ @c1.add_comment comment('comment'), @top_level
+
+ assert const.documented?
+ end
+
def test_full_name
assert_equal 'C1::CONST', @const.full_name
end
diff --git a/test/rdoc/test_rdoc_context.rb b/test/rdoc/test_rdoc_context.rb
index 28b98dfe55..c981cf3b11 100644
--- a/test/rdoc/test_rdoc_context.rb
+++ b/test/rdoc/test_rdoc_context.rb
@@ -41,6 +41,14 @@ class TestRDocContext < XrefTestCase
assert_equal [as], @context.unmatched_alias_lists['#old_name']
end
+ def test_add
+ @context.add RDoc::Extend, 'Ext', 'comment'
+ @context.add RDoc::Include, 'Incl', 'comment'
+
+ refute_empty @context.extends
+ refute_empty @context.includes
+ end
+
def test_add_alias_method_attr
top_level = @store.add_file 'file.rb'
@@ -613,6 +621,8 @@ class TestRDocContext < XrefTestCase
assert_equal 1, @c2_c3.<=>(@c2)
assert_equal(-1, @c2_c3.<=>(@c3))
+
+ assert_nil @c2.<=>(Gem.loaded_specs.values.first)
end
def test_methods_by_type
@@ -691,6 +701,15 @@ class TestRDocContext < XrefTestCase
assert_equal [@apub, @aprot, @apriv], @vis.attributes
end
+ def test_remove_invisible_nodoc
+ util_visibilities
+
+ @vis.remove_invisible :nodoc
+
+ assert_equal [@pub, @prot, @priv], @vis.method_list
+ assert_equal [@apub, @aprot, @apriv], @vis.attributes
+ end
+
def test_remove_invisible_protected
util_visibilities
diff --git a/test/rdoc/test_rdoc_context_section.rb b/test/rdoc/test_rdoc_context_section.rb
index d492c17048..b8f8c7f756 100644
--- a/test/rdoc/test_rdoc_context_section.rb
+++ b/test/rdoc/test_rdoc_context_section.rb
@@ -13,13 +13,6 @@ class TestRDocContextSection < RDoc::TestCase
@s = @S.new @klass, 'section', comment('# comment', @top_level)
end
- def mu_pp obj
- s = ''
- s = PP.pp obj, s
- s.force_encoding Encoding.default_external if defined? Encoding
- s.chomp
- end
-
def test_add_comment
file1 = @store.add_file 'file1.rb'
diff --git a/test/rdoc/test_rdoc_cross_reference.rb b/test/rdoc/test_rdoc_cross_reference.rb
index ecb5f9aa41..99fc224d88 100644
--- a/test/rdoc/test_rdoc_cross_reference.rb
+++ b/test/rdoc/test_rdoc_cross_reference.rb
@@ -19,9 +19,10 @@ class TestRDocCrossReference < XrefTestCase
def test_METHOD_REGEXP_STR
re = /#{RDoc::CrossReference::METHOD_REGEXP_STR}/
- re =~ '==='
-
- assert_equal '===', $&
+ %w'=== [] []= << >>'.each do |x|
+ re =~ x
+ assert_equal x, $&
+ end
end
def test_resolve_C2
diff --git a/test/rdoc/test_rdoc_encoding.rb b/test/rdoc/test_rdoc_encoding.rb
index 89277585ec..7ec39f8a9c 100644
--- a/test/rdoc/test_rdoc_encoding.rb
+++ b/test/rdoc/test_rdoc_encoding.rb
@@ -10,6 +10,12 @@ class TestRDocEncoding < RDoc::TestCase
@tempfile = Tempfile.new 'test_rdoc_encoding'
end
+ def teardown
+ @tempfile.close!
+
+ super
+ end
+
def test_class_read_file
@tempfile.write "hi everybody"
@tempfile.flush
@@ -125,6 +131,23 @@ class TestRDocEncoding < RDoc::TestCase
assert_equal "hi everybody", content, bug3360
end
+ def test_class_read_file_encoding_iso_2022_jp
+ skip "Encoding not implemented" unless Object.const_defined? :Encoding
+
+ input = "# coding: ISO-2022-JP\n:\e$B%3%^%s%I\e(B:"
+
+ @tempfile.write input
+ @tempfile.flush
+
+ contents = RDoc::Encoding.read_file @tempfile.path, Encoding::UTF_8
+
+ expected = ":\xe3\x82\xb3\xe3\x83\x9e\xe3\x83\xb3\xe3\x83\x89:"
+ expected.force_encoding Encoding::UTF_8
+
+ assert_equal expected, contents
+ assert_equal Encoding::UTF_8, contents.encoding
+ end
+
def test_class_set_encoding
s = "# coding: UTF-8\n"
RDoc::Encoding.set_encoding s
diff --git a/test/rdoc/test_rdoc_generator_darkfish.rb b/test/rdoc/test_rdoc_generator_darkfish.rb
index 613a1151e7..79c52f0805 100644
--- a/test/rdoc/test_rdoc_generator_darkfish.rb
+++ b/test/rdoc/test_rdoc_generator_darkfish.rb
@@ -65,21 +65,6 @@ class TestRDocGeneratorDarkfish < RDoc::TestCase
FileUtils.rm_rf @tmpdir
end
- def assert_file path
- assert File.file?(path), "#{path} is not a file"
- end
-
- def refute_file path
- refute File.exist?(path), "#{path} exists"
- end
-
- def mu_pp obj
- s = ''
- s = PP.pp obj, s
- s = s.force_encoding Encoding.default_external if defined? Encoding
- s.chomp
- end
-
def test_generate
top_level = @store.add_file 'file.rb'
top_level.add_class @klass.class, @klass.name
@@ -91,16 +76,20 @@ class TestRDocGeneratorDarkfish < RDoc::TestCase
assert_file 'table_of_contents.html'
assert_file 'js/search_index.js'
+ assert_hard_link 'rdoc.css'
+ assert_hard_link 'fonts.css'
+
+ assert_hard_link 'fonts/SourceCodePro-Bold.ttf'
+ assert_hard_link 'fonts/SourceCodePro-Regular.ttf'
+
encoding = if Object.const_defined? :Encoding then
Regexp.escape Encoding::UTF_8.name
else
Regexp.escape 'UTF-8'
end
- assert_match(/<meta content="text\/html; charset=#{encoding}"/,
- File.read('index.html'))
- assert_match(/<meta content="text\/html; charset=#{encoding}"/,
- File.read('Object.html'))
+ assert_match %r%<meta charset="#{encoding}">%, File.read('index.html')
+ assert_match %r%<meta charset="#{encoding}">%, File.read('Object.html')
refute_match(/Ignored/, File.read('index.html'))
end
@@ -145,6 +134,36 @@ class TestRDocGeneratorDarkfish < RDoc::TestCase
refute_file 'image.png'
end
+ def test_install_rdoc_static_file
+ src = Pathname(__FILE__)
+ dst = File.join @tmpdir, File.basename(src)
+ options = {}
+
+ @g.install_rdoc_static_file src, dst, options
+
+ assert_file dst
+
+ begin
+ assert_hard_link dst
+ rescue MiniTest::Assertion
+ return # hard links are not supported, no further tests needed
+ end
+
+ @g.install_rdoc_static_file src, dst, options
+
+ assert_hard_link dst
+ end
+
+ def test_install_rdoc_static_file_missing
+ src = Pathname(__FILE__) + 'nonexistent'
+ dst = File.join @tmpdir, File.basename(src)
+ options = {}
+
+ @g.install_rdoc_static_file src, dst, options
+
+ refute_file dst
+ end
+
def test_setup
@g.setup
@@ -183,5 +202,28 @@ class TestRDocGeneratorDarkfish < RDoc::TestCase
assert_same template, @g.send(:template_for, partial)
end
+ ##
+ # Asserts that +filename+ has a link count greater than 1 if hard links to
+ # @tmpdir are supported.
+
+ def assert_hard_link filename
+ assert_file filename
+
+ src = @g.template_dir + '_head.rhtml'
+ dst = File.join @tmpdir, 'hardlinktest'
+
+ begin
+ FileUtils.ln src, dst
+ nlink = File.stat(dst).nlink if File.identical? src, dst
+ FileUtils.rm dst
+ return if nlink == 1
+ rescue SystemCallError
+ return
+ end
+
+ assert_operator File.stat(filename).nlink, :>, 1,
+ "#{filename} is not hard-linked"
+ end
+
end
diff --git a/test/rdoc/test_rdoc_generator_json_index.rb b/test/rdoc/test_rdoc_generator_json_index.rb
index 717159eeda..214e4a0d91 100644
--- a/test/rdoc/test_rdoc_generator_json_index.rb
+++ b/test/rdoc/test_rdoc_generator_json_index.rb
@@ -57,17 +57,6 @@ class TestRDocGeneratorJsonIndex < RDoc::TestCase
FileUtils.rm_rf @tmpdir
end
- def assert_file path
- assert File.file?(path), "#{path} is not a file"
- end
-
- def mu_pp obj
- s = ''
- s = PP.pp obj, s
- s = s.force_encoding Encoding.default_external if defined? Encoding
- s.chomp
- end
-
def test_build_index
index = @g.build_index
diff --git a/test/rdoc/test_rdoc_generator_pot.rb b/test/rdoc/test_rdoc_generator_pot.rb
new file mode 100644
index 0000000000..d028ce71de
--- /dev/null
+++ b/test/rdoc/test_rdoc_generator_pot.rb
@@ -0,0 +1,91 @@
+require 'rdoc/test_case'
+
+class TestRDocGeneratorPOT < RDoc::TestCase
+
+ def setup
+ super
+
+ @options = RDoc::Options.new
+ @tmpdir = File.join Dir.tmpdir, "test_rdoc_generator_pot_#{$$}"
+ FileUtils.mkdir_p @tmpdir
+
+ @generator = RDoc::Generator::POT.new @store, @options
+
+ @top_level = @store.add_file 'file.rb'
+ @klass = @top_level.add_class RDoc::NormalClass, 'Object'
+ @klass.add_comment 'This is a class', @top_level
+ @klass.add_section 'This is a section', comment('This is a section comment')
+
+ @const = RDoc::Constant.new "CONSTANT", "29", "This is a constant"
+
+ @meth = RDoc::AnyMethod.new nil, 'method'
+ @meth.record_location @top_level
+ @meth.comment = 'This is a method'
+
+ @attr = RDoc::Attr.new nil, 'attr', 'RW', ''
+ @attr.record_location @top_level
+ @attr.comment = 'This is an attribute'
+
+ @klass.add_constant @const
+ @klass.add_method @meth
+ @klass.add_attribute @attr
+
+ Dir.chdir @tmpdir
+ end
+
+ def teardown
+ super
+
+ Dir.chdir @pwd
+ FileUtils.rm_rf @tmpdir
+ end
+
+ def test_generate
+ @generator.generate
+
+ assert_equal <<-POT, File.read(File.join(@tmpdir, 'rdoc.pot'))
+# 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.
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSEION\\n"
+"Report-Msgid-Bugs-To:\\n"
+"PO-Revision-Date: YEAR-MO_DA HO:MI+ZONE\\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n"
+"Language-Team: LANGUAGE <LL@li.org>\\n"
+"Language:\\n"
+"MIME-Version: 1.0\\n"
+"Content-Type: text/plain; charset=CHARSET\\n"
+"Content-Transfer-Encoding: 8bit\\n"
+"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\\n"
+
+#. Object
+msgid "This is a class"
+msgstr ""
+
+#. Object::CONSTANT
+msgid "This is a constant"
+msgstr ""
+
+#. Object#method
+msgid "This is a method"
+msgstr ""
+
+#. Object: section title
+msgid "This is a section"
+msgstr ""
+
+#. Object: This is a section
+msgid "This is a section comment"
+msgstr ""
+
+#. Object#attr
+msgid "This is an attribute"
+msgstr ""
+ POT
+ end
+
+end
diff --git a/test/rdoc/test_rdoc_generator_pot_po.rb b/test/rdoc/test_rdoc_generator_pot_po.rb
new file mode 100644
index 0000000000..fae7f7ed6e
--- /dev/null
+++ b/test/rdoc/test_rdoc_generator_pot_po.rb
@@ -0,0 +1,51 @@
+require 'rdoc/test_case'
+
+class TestRDocGeneratorPOTPO < RDoc::TestCase
+
+ def setup
+ super
+ @po = RDoc::Generator::POT::PO.new
+ end
+
+ def test_empty
+ assert_equal header, @po.to_s
+ end
+
+ def test_have_entry
+ @po.add(entry("Hello", {}))
+ assert_equal <<-PO, @po.to_s
+#{header}
+msgid "Hello"
+msgstr ""
+ PO
+ end
+
+ private
+
+ def entry(msgid, options)
+ RDoc::Generator::POT::POEntry.new(msgid, options)
+ end
+
+ def header
+ <<-'HEADER'
+# 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.
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSEION\n"
+"Report-Msgid-Bugs-To:\n"
+"PO-Revision-Date: YEAR-MO_DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language:\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
+ HEADER
+ end
+
+end
diff --git a/test/rdoc/test_rdoc_generator_pot_po_entry.rb b/test/rdoc/test_rdoc_generator_pot_po_entry.rb
new file mode 100644
index 0000000000..8620d98bf8
--- /dev/null
+++ b/test/rdoc/test_rdoc_generator_pot_po_entry.rb
@@ -0,0 +1,139 @@
+require 'rdoc/test_case'
+
+class TestRDocGeneratorPOTPOEntry < RDoc::TestCase
+
+ def test_msgid_normal
+ assert_equal <<-'ENTRY', entry("Hello", {}).to_s
+msgid "Hello"
+msgstr ""
+ ENTRY
+ end
+
+ def test_msgid_multiple_lines
+ assert_equal <<-'ENTRY', entry("Hello\nWorld", {}).to_s
+msgid ""
+"Hello\n"
+"World"
+msgstr ""
+ ENTRY
+ end
+
+ def test_msgid_tab
+ assert_equal <<-'ENTRY', entry("Hello\tWorld", {}).to_s
+msgid "Hello\tWorld"
+msgstr ""
+ ENTRY
+ end
+
+ def test_msgid_back_slash
+ assert_equal <<-'ENTRY', entry("Hello \\ World", {}).to_s
+msgid "Hello \\ World"
+msgstr ""
+ ENTRY
+ end
+
+ def test_msgid_double_quote
+ assert_equal <<-'ENTRY', entry("Hello \"World\"!", {}).to_s
+msgid "Hello \"World\"!"
+msgstr ""
+ ENTRY
+ end
+
+ def test_translator_comment_normal
+ options = {:translator_comment => "Greeting"}
+ assert_equal <<-'ENTRY', entry("Hello", options).to_s
+# Greeting
+msgid "Hello"
+msgstr ""
+ ENTRY
+ end
+
+ def test_translator_comment_multiple_lines
+ options = {:translator_comment => "Greeting\nfor morning"}
+ assert_equal <<-'ENTRY', entry("Hello", options).to_s
+# Greeting
+# for morning
+msgid "Hello"
+msgstr ""
+ ENTRY
+ end
+
+ def test_extracted_comment_normal
+ options = {:extracted_comment => "Object"}
+ assert_equal <<-'ENTRY', entry("Hello", options).to_s
+#. Object
+msgid "Hello"
+msgstr ""
+ ENTRY
+ end
+
+ def test_extracted_comment_multiple_lines
+ options = {:extracted_comment => "Object\nMorning#greeting"}
+ assert_equal <<-'ENTRY', entry("Hello", options).to_s
+#. Object
+#. Morning#greeting
+msgid "Hello"
+msgstr ""
+ ENTRY
+ end
+
+ def test_references_normal
+ options = {:references => [["lib/rdoc.rb", 29]]}
+ assert_equal <<-'ENTRY', entry("Hello", options).to_s
+#: lib/rdoc.rb:29
+msgid "Hello"
+msgstr ""
+ ENTRY
+ end
+
+ def test_references_multiple
+ options = {:references => [["lib/rdoc.rb", 29], ["lib/rdoc/i18n.rb", 9]]}
+ assert_equal <<-'ENTRY', entry("Hello", options).to_s
+#: lib/rdoc.rb:29
+#: lib/rdoc/i18n.rb:9
+msgid "Hello"
+msgstr ""
+ ENTRY
+ end
+
+ def test_flags_normal
+ options = {:flags => ["fuzzy"]}
+ assert_equal <<-'ENTRY', entry("Hello", options).to_s
+#, fuzzy
+msgid "Hello"
+msgstr ""
+ ENTRY
+ end
+
+ def test_flags_multiple
+ options = {:flags => ["fuzzy", "ruby-format"]}
+ assert_equal <<-'ENTRY', entry("Hello", options).to_s
+#, fuzzy,ruby-format
+msgid "Hello"
+msgstr ""
+ ENTRY
+ end
+
+ def test_full
+ options = {
+ :translator_comment => "Greeting",
+ :extracted_comment => "Morning#greeting",
+ :references => [["lib/rdoc.rb", 29]],
+ :flags => ["fuzzy"],
+ }
+ assert_equal <<-'ENTRY', entry("Hello", options).to_s
+# Greeting
+#. Morning#greeting
+#: lib/rdoc.rb:29
+#, fuzzy
+msgid "Hello"
+msgstr ""
+ ENTRY
+ end
+
+ private
+ def entry(msgid, options)
+ RDoc::Generator::POT::POEntry.new(msgid, options)
+ end
+
+end
diff --git a/test/rdoc/test_rdoc_generator_ri.rb b/test/rdoc/test_rdoc_generator_ri.rb
index a2bcec534d..f8ac97337d 100644
--- a/test/rdoc/test_rdoc_generator_ri.rb
+++ b/test/rdoc/test_rdoc_generator_ri.rb
@@ -42,14 +42,6 @@ class TestRDocGeneratorRI < RDoc::TestCase
FileUtils.rm_rf @tmpdir
end
- def assert_file path
- assert File.file?(path), "#{path} is not a file"
- end
-
- def refute_file path
- refute File.exist?(path), "#{path} exists"
- end
-
def test_generate
@g.generate
diff --git a/test/rdoc/test_rdoc_i18n_locale.rb b/test/rdoc/test_rdoc_i18n_locale.rb
new file mode 100644
index 0000000000..69de88a9f2
--- /dev/null
+++ b/test/rdoc/test_rdoc_i18n_locale.rb
@@ -0,0 +1,73 @@
+require 'rdoc/test_case'
+
+class TestRDocI18nLocale < RDoc::TestCase
+
+ def setup
+ super
+ @locale = locale('fr')
+
+ @tmpdir = File.join Dir.tmpdir, "test_rdoc_i18n_locale_#{$$}"
+ FileUtils.mkdir_p @tmpdir
+
+ @locale_dir = @tmpdir
+ end
+
+ def teardown
+ FileUtils.rm_rf @tmpdir
+ super
+ end
+
+ def test_name
+ assert_equal 'fr', locale('fr').name
+ end
+
+ def test_load_nonexistent_po
+ File.stub(:exist?, false) do
+ refute @locale.load('nonexsitent-locale')
+ end
+ end
+
+ def test_load_existent_po
+ begin
+ require 'gettext/po_parser'
+ rescue LoadError
+ skip 'gettext gem is not found'
+ end
+
+ fr_locale_dir = File.join @locale_dir, 'fr'
+ FileUtils.mkdir_p fr_locale_dir
+ File.open File.join(fr_locale_dir, 'rdoc.po'), 'w' do |po|
+ po.puts <<-PO
+msgid ""
+msgstr ""
+"Language: fr\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+msgid "Hello"
+msgstr "Bonjour"
+ PO
+ end
+
+ assert @locale.load(@locale_dir)
+ assert_equal 'Bonjour', @locale.translate('Hello')
+ end
+
+ def test_translate_existent_message
+ messages = @locale.instance_variable_get(:@messages)
+ messages['Hello'] = 'Bonjour'
+ assert_equal 'Bonjour', @locale.translate('Hello')
+ end
+
+ def test_translate_nonexistent_message
+ assert_equal 'Hello', @locale.translate('Hello')
+ end
+
+ private
+
+ def locale(name)
+ RDoc::I18n::Locale.new(name)
+ end
+
+end
diff --git a/test/rdoc/test_rdoc_i18n_text.rb b/test/rdoc/test_rdoc_i18n_text.rb
new file mode 100644
index 0000000000..c47f03c1af
--- /dev/null
+++ b/test/rdoc/test_rdoc_i18n_text.rb
@@ -0,0 +1,123 @@
+require 'rdoc/test_case'
+
+class TestRDocI18nText < RDoc::TestCase
+
+ def test_multiple_paragraphs
+ paragraph1 = <<-PARAGRAPH.strip
+RDoc produces HTML and command-line documentation for Ruby projects. RDoc
+includes the +rdoc+ and +ri+ tools for generating and displaying documentation
+from the command-line.
+ PARAGRAPH
+
+ paragraph2 = <<-PARAGRAPH.strip
+This command generates documentation for all the Ruby and C source
+files in and below the current directory. These will be stored in a
+documentation tree starting in the subdirectory +doc+.
+ PARAGRAPH
+
+ raw = <<-RAW
+#{paragraph1}
+
+#{paragraph2}
+ RAW
+
+ expected = [
+ {
+ :type => :paragraph,
+ :paragraph => paragraph1,
+ :line_no => 1,
+ },
+ {
+ :type => :paragraph,
+ :paragraph => paragraph2,
+ :line_no => 5,
+ },
+ ]
+ assert_equal expected, extract_messages(raw)
+ end
+
+ def test_translate_multiple_paragraphs
+ paragraph1 = <<-PARAGRAPH.strip
+Paragraph 1.
+ PARAGRAPH
+ paragraph2 = <<-PARAGRAPH.strip
+Paragraph 2.
+ PARAGRAPH
+
+ raw = <<-RAW
+#{paragraph1}
+
+#{paragraph2}
+ RAW
+
+ expected = <<-TRANSLATED
+Paragraphe 1.
+
+Paragraphe 2.
+ TRANSLATED
+ assert_equal expected, translate(raw)
+ end
+
+ def test_translate_not_transalted_message
+ nonexistent_paragraph = <<-PARAGRAPH.strip
+Nonexistent paragraph.
+ PARAGRAPH
+
+ raw = <<-RAW
+#{nonexistent_paragraph}
+ RAW
+
+ expected = <<-TRANSLATED
+#{nonexistent_paragraph}
+ TRANSLATED
+ assert_equal expected, translate(raw)
+ end
+
+ def test_translate_keep_empty_lines
+ raw = <<-RAW
+Paragraph 1.
+
+
+
+
+Paragraph 2.
+ RAW
+
+ expected = <<-TRANSLATED
+Paragraphe 1.
+
+
+
+
+Paragraphe 2.
+ TRANSLATED
+ assert_equal expected, translate(raw)
+ end
+
+ private
+
+ def extract_messages(raw)
+ text = RDoc::I18n::Text.new(raw)
+ messages = []
+ text.extract_messages do |message|
+ messages << message
+ end
+ messages
+ end
+
+ def locale
+ locale = RDoc::I18n::Locale.new('fr')
+ messages = locale.instance_variable_get(:@messages)
+ messages['markdown'] = 'markdown (markdown in fr)'
+ messages['Hello'] = 'Bonjour (Hello in fr)'
+ messages['Paragraph 1.'] = 'Paragraphe 1.'
+ messages['Paragraph 2.'] = 'Paragraphe 2.'
+ locale
+ end
+
+ def translate(raw)
+ text = RDoc::I18n::Text.new(raw)
+ text.translate(locale)
+ end
+
+end
diff --git a/test/rdoc/test_rdoc_markdown.rb b/test/rdoc/test_rdoc_markdown.rb
index f3eb22227c..ea5dc73387 100644
--- a/test/rdoc/test_rdoc_markdown.rb
+++ b/test/rdoc/test_rdoc_markdown.rb
@@ -1,10 +1,6 @@
# coding: UTF-8
-require 'rubygems'
-require 'minitest/autorun'
-require 'pp'
-
-require 'rdoc'
+require 'rdoc/test_case'
require 'rdoc/markup/block_quote'
require 'rdoc/markdown'
@@ -14,13 +10,8 @@ class TestRDocMarkdown < RDoc::TestCase
@RM = RDoc::Markup
@parser = RDoc::Markdown.new
- end
- def mu_pp obj
- s = ''
- s = PP.pp obj, s
- s.force_encoding Encoding.default_external if defined? Encoding
- s.chomp
+ @to_html = RDoc::Markup::ToHtml.new(RDoc::Options.new, nil)
end
def test_class_parse
@@ -439,7 +430,19 @@ heading
def test_parse_image
doc = parse "image ![alt text](path/to/image.jpg)"
- expected = doc(para("image {alt text}[path/to/image.jpg]"))
+ expected = doc(para("image rdoc-image:path/to/image.jpg"))
+
+ assert_equal expected, doc
+ end
+
+ def test_parse_image_link
+ @parser.html = true
+
+ doc = parse "[![alt text](path/to/image.jpg)](http://example.com)"
+
+ expected =
+ doc(
+ para('{rdoc-image:path/to/image.jpg}[http://example.com]'))
assert_equal expected, doc
end
diff --git a/test/rdoc/test_rdoc_markdown_test.rb b/test/rdoc/test_rdoc_markdown_test.rb
index 7dfe727ef5..d464cba263 100644
--- a/test/rdoc/test_rdoc_markdown_test.rb
+++ b/test/rdoc/test_rdoc_markdown_test.rb
@@ -15,13 +15,6 @@ class TestRDocMarkdownTest < RDoc::TestCase
@parser = RDoc::Markdown.new
end
- def mu_pp obj
- s = ''
- s = PP.pp obj, s
- s.force_encoding Encoding.default_external if defined? Encoding
- s.chomp
- end
-
def test_amps_and_angle_encoding
input = File.read "#{MARKDOWN_TEST_PATH}/Amps and angle encoding.text"
diff --git a/test/rdoc/test_rdoc_markup_attribute_manager.rb b/test/rdoc/test_rdoc_markup_attribute_manager.rb
index 36edea3f73..34615aa625 100644
--- a/test/rdoc/test_rdoc_markup_attribute_manager.rb
+++ b/test/rdoc/test_rdoc_markup_attribute_manager.rb
@@ -26,6 +26,12 @@ class TestRDocMarkupAttributeManager < RDoc::TestCase
@am.add_word_pair("{", "}", :WOMBAT)
@wombat_on = @am.changed_attribute_by_name([], [:WOMBAT])
@wombat_off = @am.changed_attribute_by_name([:WOMBAT], [])
+
+ @klass = RDoc::Markup::AttributeManager
+ @formatter = RDoc::Markup::Formatter.new @rdoc.options
+ @formatter.add_tag :BOLD, '<B>', '</B>'
+ @formatter.add_tag :EM, '<EM>', '</EM>'
+ @formatter.add_tag :TT, '<CODE>', '</CODE>'
end
def crossref(text)
@@ -44,6 +50,21 @@ class TestRDocMarkupAttributeManager < RDoc::TestCase
#assert_equal(["cat {and} dog" ], @am.flow("cat \\{and} dog"))
end
+ def test_add_html_tag
+ @am.add_html("Test", :TEST)
+ tags = @am.html_tags
+ assert_equal(6, tags.size)
+ assert(tags.has_key?("test"))
+ end
+
+ def test_add_special
+ @am.add_special "WikiWord", :WIKIWORD
+ specials = @am.special
+
+ assert_equal 1, specials.size
+ assert specials.assoc "WikiWord"
+ end
+
def test_add_word_pair
@am.add_word_pair '%', '&', 'percent and'
@@ -60,6 +81,20 @@ class TestRDocMarkupAttributeManager < RDoc::TestCase
assert_equal "Word flags may not start with '<'", e.message
end
+ def test_add_word_pair_invalid
+ assert_raises ArgumentError do
+ @am.add_word_pair("<", "<", :TEST)
+ end
+ end
+
+ def test_add_word_pair_map
+ @am.add_word_pair("x", "y", :TEST)
+
+ word_pair_map = @am.word_pair_map
+
+ assert_includes word_pair_map.keys.map { |r| r.source }, "(x)(\\S+)(y)"
+ end
+
def test_add_word_pair_matching
@am.add_word_pair '^', '^', 'caret'
@@ -95,6 +130,9 @@ class TestRDocMarkupAttributeManager < RDoc::TestCase
assert_equal(["cat ", @tt_on, "and", @tt_off, " dog"],
@am.flow("cat +and+ dog"))
+ assert_equal(["cat ", @tt_on, "X::Y", @tt_off, " dog"],
+ @am.flow("cat +X::Y+ dog"))
+
assert_equal(["cat ", @bold_on, "a_b_c", @bold_off, " dog"],
@am.flow("cat *a_b_c* dog"))
@@ -151,6 +189,56 @@ class TestRDocMarkupAttributeManager < RDoc::TestCase
assert_equal "\000x-y\000", str
end
+ def test_convert_attrs_ignores_code
+ assert_equal 'foo <CODE>__send__</CODE> bar', output('foo <code>__send__</code> bar')
+ end
+
+ def test_convert_attrs_ignores_tt
+ assert_equal 'foo <CODE>__send__</CODE> bar', output('foo <tt>__send__</tt> bar')
+ end
+
+ def test_convert_attrs_preserves_double
+ assert_equal 'foo.__send__ :bar', output('foo.__send__ :bar')
+ assert_equal 'use __FILE__ to', output('use __FILE__ to')
+ end
+
+ def test_convert_attrs_does_not_ignore_after_tt
+ assert_equal 'the <CODE>IF:</CODE><EM>key</EM> directive', output('the <tt>IF:</tt>_key_ directive')
+ end
+
+ def test_escapes
+ assert_equal '<CODE>text</CODE>', output('<tt>text</tt>')
+ assert_equal '<tt>text</tt>', output('\\<tt>text</tt>')
+ assert_equal '<tt>', output('\\<tt>')
+ assert_equal '<CODE><tt></CODE>', output('<tt>\\<tt></tt>')
+ assert_equal '<CODE>\\<tt></CODE>', output('<tt>\\\\<tt></tt>')
+ assert_equal '<B>text</B>', output('*text*')
+ assert_equal '*text*', output('\\*text*')
+ assert_equal '\\', output('\\')
+ assert_equal '\\text', output('\\text')
+ assert_equal '\\\\text', output('\\\\text')
+ assert_equal 'text \\ text', output('text \\ text')
+
+ assert_equal 'and <CODE>\\s</CODE> matches space',
+ output('and <tt>\\s</tt> matches space')
+ assert_equal 'use <CODE><tt>text</CODE></tt> for code',
+ output('use <tt>\\<tt>text</tt></tt> for code')
+ assert_equal 'use <CODE><tt>text</tt></CODE> for code',
+ output('use <tt>\\<tt>text\\</tt></tt> for code')
+ assert_equal 'use <tt><tt>text</tt></tt> for code',
+ output('use \\<tt>\\<tt>text</tt></tt> for code')
+ assert_equal 'use <tt><CODE>text</CODE></tt> for code',
+ output('use \\<tt><tt>text</tt></tt> for code')
+ assert_equal 'use <CODE>+text+</CODE> for code',
+ output('use <tt>\\+text+</tt> for code')
+ assert_equal 'use <tt><CODE>text</CODE></tt> for code',
+ output('use \\<tt>+text+</tt> for code')
+ assert_equal 'illegal <tag>not</tag> changed',
+ output('illegal <tag>not</tag> changed')
+ assert_equal 'unhandled <p>tag</p> unchanged',
+ output('unhandled <p>tag</p> unchanged')
+ end
+
def test_html_like_em_bold
assert_equal ["cat ", @em_on, "and ", @em_to_bold, "dog", @bold_off],
@am.flow("cat <i>and </i><b>dog</b>")
@@ -191,6 +279,38 @@ class TestRDocMarkupAttributeManager < RDoc::TestCase
@am.flow("<tt>cat</tt> <i>and <b></i>dog</b>")
end
+ def test_initial_html
+ html_tags = @am.html_tags
+ assert html_tags.is_a?(Hash)
+ assert_equal(5, html_tags.size)
+ end
+
+ def test_initial_word_pairs
+ word_pairs = @am.matching_word_pairs
+ assert word_pairs.is_a?(Hash)
+ assert_equal(3, word_pairs.size)
+ end
+
+ def test_mask_protected_sequence
+ def @am.str() @str end
+ def @am.str=(str) @str = str end
+
+ @am.str = '<code>foo</code>'
+ @am.mask_protected_sequences
+
+ assert_equal "<code>foo</code>", @am.str
+
+ @am.str = '<code>foo\\</code>'
+ @am.mask_protected_sequences
+
+ assert_equal "<code>foo<\x04/code>", @am.str, 'escaped close'
+
+ @am.str = '<code>foo\\\\</code>'
+ @am.mask_protected_sequences
+
+ assert_equal "<code>foo\\</code>", @am.str, 'escaped backslash'
+ end
+
def test_protect
assert_equal(['cat \\ dog'],
@am.flow('cat \\ dog'))
@@ -233,5 +353,9 @@ class TestRDocMarkupAttributeManager < RDoc::TestCase
@am.flow('<tt>"\n"</tt>')
end
+ def output str
+ @formatter.convert_flow @am.flow str
+ end
+
end
diff --git a/test/rdoc/test_rdoc_markup_document.rb b/test/rdoc/test_rdoc_markup_document.rb
index 0ab87280eb..718ae6d4c4 100644
--- a/test/rdoc/test_rdoc_markup_document.rb
+++ b/test/rdoc/test_rdoc_markup_document.rb
@@ -8,13 +8,6 @@ class TestRDocMarkupDocument < RDoc::TestCase
@d = @RM::Document.new
end
- def mu_pp obj
- s = ''
- s = PP.pp obj, s
- s.force_encoding Encoding.default_external if defined? Encoding
- s.chomp
- end
-
def test_append
@d << @RM::Paragraph.new('hi')
diff --git a/test/rdoc/test_rdoc_markup_formatter.rb b/test/rdoc/test_rdoc_markup_formatter.rb
index c0dde757cb..d01a42fca6 100644
--- a/test/rdoc/test_rdoc_markup_formatter.rb
+++ b/test/rdoc/test_rdoc_markup_formatter.rb
@@ -71,20 +71,46 @@ class TestRDocMarkupFormatter < RDoc::TestCase
@to.add_special_RDOCLINK
assert_includes special_names, 'RDOCLINK'
+
+ def @to.handle_special_RDOCLINK special
+ "<#{special.text}>"
+ end
+
+ document = doc(para('{foo}[rdoc-label:bar].'))
+
+ formatted = document.accept @to
+
+ assert_equal '{foo}[<rdoc-label:bar>].', formatted
end
def test_add_special_TIDYLINK
@to.add_special_TIDYLINK
assert_includes special_names, 'TIDYLINK'
+
+ def @to.handle_special_TIDYLINK special
+ "<#{special.text}>"
+ end
+
+ document = doc(para('foo[rdoc-label:bar].'))
+
+ formatted = document.accept @to
+
+ assert_equal '<foo[rdoc-label:bar]>.', formatted
+
+ document = doc(para('{foo}[rdoc-label:bar].'))
+
+ formatted = document.accept @to
+
+ assert_equal '<{foo}[rdoc-label:bar]>.', formatted
end
def test_parse_url
scheme, url, id = @to.parse_url 'example/foo'
- assert_equal 'http', scheme
- assert_equal 'http://example/foo', url
- assert_equal nil, id
+ assert_equal 'http', scheme
+ assert_equal 'example/foo', url
+ assert_equal nil, id
end
def test_parse_url_anchor
diff --git a/test/rdoc/test_rdoc_markup_heading.rb b/test/rdoc/test_rdoc_markup_heading.rb
index eef051a64e..ff53ff5ac3 100644
--- a/test/rdoc/test_rdoc_markup_heading.rb
+++ b/test/rdoc/test_rdoc_markup_heading.rb
@@ -12,6 +12,15 @@ class TestRDocMarkupHeading < RDoc::TestCase
assert_equal 'label-Hello+Friend%21', @h.aref
end
+ def test_label
+ assert_equal 'label-Hello+Friend%21', @h.label
+ assert_equal 'label-Hello+Friend%21', @h.label(nil)
+
+ context = RDoc::NormalClass.new 'Foo'
+
+ assert_equal 'class-Foo-label-Hello+Friend%21', @h.label(context)
+ end
+
def test_plain_html
assert_equal 'Hello <strong>Friend</strong>!', @h.plain_html
end
diff --git a/test/rdoc/test_rdoc_markup_parser.rb b/test/rdoc/test_rdoc_markup_parser.rb
index b367b23bcc..d27fb42f9a 100644
--- a/test/rdoc/test_rdoc_markup_parser.rb
+++ b/test/rdoc/test_rdoc_markup_parser.rb
@@ -12,13 +12,6 @@ class TestRDocMarkupParser < RDoc::TestCase
@RMP = @RM::Parser
end
- def mu_pp(obj)
- s = ''
- s = PP.pp obj, s
- s = s.force_encoding(Encoding.default_external) if @have_encoding
- s.chomp
- end
-
def test_build_heading
parser = @RMP.new
diff --git a/test/rdoc/test_rdoc_markup_pre_process.rb b/test/rdoc/test_rdoc_markup_pre_process.rb
index 3a991a6397..7cbe29c5a9 100644
--- a/test/rdoc/test_rdoc_markup_pre_process.rb
+++ b/test/rdoc/test_rdoc_markup_pre_process.rb
@@ -11,13 +11,13 @@ class TestRDocMarkupPreProcess < RDoc::TestCase
@file_name = File.basename @tempfile.path
@dir = File.dirname @tempfile.path
- @pp = RDoc::Markup::PreProcess.new __FILE__, [@dir]
+ @pp = RDoc::Markup::PreProcess.new @tempfile.path, [@dir, File.dirname(__FILE__)]
end
def teardown
super
- @tempfile.close
+ @tempfile.close!
end
def test_class_register
@@ -72,6 +72,18 @@ contents of a string.
assert_equal expected, content
end
+ def test_include_file_in_other_directory
+ content = nil
+ out, err = capture_io do
+ content = @pp.include_file "test.txt", '', nil
+ end
+
+ assert_empty out
+ assert_empty err
+
+ assert_equal "test file\n", content
+ end
+
def test_handle
text = "# :main: M\n"
out = @pp.handle text
@@ -135,7 +147,7 @@ contents of a string.
def test_handle_directive_blankline
result = @pp.handle_directive '#', 'arg', 'a, b'
- assert_equal "#\n", result
+ assert_equal "#:arg: a, b\n", result
end
def test_handle_directive_downcase
@@ -157,7 +169,7 @@ contents of a string.
def test_handle_directive_arg_no_context
result = @pp.handle_directive '', 'arg', 'a, b', nil
- assert_equal "\n", result
+ assert_equal ":arg: a, b\n", result
end
def test_handle_directive_args
diff --git a/test/rdoc/test_rdoc_markup_raw.rb b/test/rdoc/test_rdoc_markup_raw.rb
index 16cc60e3a8..43bfe0c3b1 100644
--- a/test/rdoc/test_rdoc_markup_raw.rb
+++ b/test/rdoc/test_rdoc_markup_raw.rb
@@ -8,13 +8,6 @@ class TestRDocMarkupRaw < RDoc::TestCase
@p = @RM::Raw.new
end
- def mu_pp obj
- s = ''
- s = PP.pp obj, s
- s.force_encoding Encoding.default_external if defined? Encoding
- s.chomp
- end
-
def test_push
@p.push 'hi', 'there'
diff --git a/test/rdoc/test_rdoc_markup_to_html.rb b/test/rdoc/test_rdoc_markup_to_html.rb
index ebd2fe7dd2..b1addc5dcb 100644
--- a/test/rdoc/test_rdoc_markup_to_html.rb
+++ b/test/rdoc/test_rdoc_markup_to_html.rb
@@ -256,7 +256,7 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
end
def accept_paragraph_break
- assert_equal "\n<p>hello<br>\nworld</p>\n", @to.res.join
+ assert_equal "\n<p>hello<br> world</p>\n", @to.res.join
end
def accept_paragraph_i
@@ -288,7 +288,7 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
end
def accept_rule
- assert_equal "<hr style=\"height: 4px\">\n", @to.res.join
+ assert_equal "<hr>\n", @to.res.join
end
def accept_verbatim
@@ -357,12 +357,12 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
@to.code_object = RDoc::NormalClass.new 'Foo'
@to.start_accepting
- @to.accept_heading @RM::Heading.new(1, 'Hello')
+ @to.accept_heading head(1, 'Hello')
- links = '<span><a href="#label-Hello">&para;</a> ' +
+ links = '<span><a href="#class-Foo-label-Hello">&para;</a> ' +
'<a href="#documentation">&uarr;</a></span>'
- assert_equal "\n<h1 id=\"label-Hello\">Hello#{links}</h1>\n",
+ assert_equal "\n<h1 id=\"class-Foo-label-Hello\">Hello#{links}</h1>\n",
@to.res.join
end
@@ -389,6 +389,35 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
assert_equal "\n<h1 id=\"label-Hello\">Hello</h1>\n", @to.res.join
end
+ def test_accept_paragraph_newline
+ @to.start_accepting
+
+ @to.accept_paragraph para("hello\n", "world\n")
+
+ assert_equal "\n<p>hello world</p>\n", @to.res.join
+ end
+
+ def test_accept_heading_output_decoration
+ @options.output_decoration = false
+
+ @to.start_accepting
+
+ @to.accept_heading @RM::Heading.new(1, 'Hello')
+
+ assert_equal "\n<h1>Hello<span><a href=\"#label-Hello\">&para;</a> <a href=\"#documentation\">&uarr;</a></span></h1>\n", @to.res.join
+ end
+
+ def test_accept_heading_output_decoration_with_pipe
+ @options.pipe = true
+ @options.output_decoration = false
+
+ @to.start_accepting
+
+ @to.accept_heading @RM::Heading.new(1, 'Hello')
+
+ assert_equal "\n<h1>Hello</h1>\n", @to.res.join
+ end
+
def test_accept_verbatim_parseable
verb = @RM::Verbatim.new("class C\n", "end\n")
@@ -422,6 +451,24 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
assert_equal expected, @to.res.join
end
+ def test_accept_verbatim_pipe
+ @options.pipe = true
+
+ verb = @RM::Verbatim.new("1 + 1\n")
+ verb.format = :ruby
+
+ @to.start_accepting
+ @to.accept_verbatim verb
+
+ expected = <<-EXPECTED
+
+<pre><code>1 + 1
+</code></pre>
+ EXPECTED
+
+ assert_equal expected, @to.res.join
+ end
+
def test_accept_verbatim_ruby
verb = @RM::Verbatim.new("1 + 1\n")
verb.format = :ruby
@@ -457,13 +504,13 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
def test_convert_RDOCLINK_label_foottext
result = @to.convert 'rdoc-label:foottext-1'
- assert_equal "\n<p><a href=\"#foottext-1\">*1</a></p>\n", result
+ assert_equal "\n<p><a href=\"#foottext-1\">1</a></p>\n", result
end
def test_convert_RDOCLINK_label_footmark
result = @to.convert 'rdoc-label:footmark-1'
- assert_equal "\n<p><a href=\"#footmark-1\">^1</a></p>\n", result
+ assert_equal "\n<p><a href=\"#footmark-1\">1</a></p>\n", result
end
def test_convert_RDOCLINK_ref
@@ -475,7 +522,28 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
def test_convert_TIDYLINK_footnote
result = @to.convert 'text{*1}[rdoc-label:foottext-1:footmark-1]'
- assert_equal "\n<p>text<a id=\"footmark-1\" href=\"#foottext-1\">*1</a></p>\n", result
+ assert_equal "\n<p>text<sup><a id=\"footmark-1\" href=\"#foottext-1\">1</a></sup></p>\n", result
+ end
+
+ def test_convert_TIDYLINK_multiple
+ result = @to.convert '{a}[http://example] {b}[http://example]'
+
+ expected = <<-EXPECTED
+
+<p><a href=\"http://example\">a</a> <a href=\"http://example\">b</a></p>
+ EXPECTED
+
+ assert_equal expected, result
+ end
+
+ def test_convert_TIDYLINK_image
+ result =
+ @to.convert '{rdoc-image:path/to/image.jpg}[http://example.com]'
+
+ expected =
+ "\n<p><a href=\"http://example.com\"><img src=\"path/to/image.jpg\"></a></p>\n"
+
+ assert_equal expected, result
end
def test_convert_TIDYLINK_rdoc_label
@@ -501,7 +569,7 @@ class TestRDocMarkupToHtml < RDoc::Markup::FormatterTestCase
end
def test_gen_url_rdoc_label_id
- assert_equal '<a id="footmark-1" href="#foottext-1">example</a>',
+ assert_equal '<sup><a id="footmark-1" href="#foottext-1">example</a></sup>',
@to.gen_url('rdoc-label:foottext-1:footmark-1', 'example')
end
diff --git a/test/rdoc/test_rdoc_markup_to_html_crossref.rb b/test/rdoc/test_rdoc_markup_to_html_crossref.rb
index 27a60120f4..872daea1dc 100644
--- a/test/rdoc/test_rdoc_markup_to_html_crossref.rb
+++ b/test/rdoc/test_rdoc_markup_to_html_crossref.rb
@@ -36,6 +36,13 @@ class TestRDocMarkupToHtmlCrossref < XrefTestCase
result
end
+ def test_convert_CROSSREF_section
+ @c1.add_section 'Section'
+
+ result = @to.convert 'C1@Section'
+ assert_equal para("<a href=\"C1.html#Section\">Section at C1</a>"), result
+ end
+
def test_convert_RDOCLINK_rdoc_ref
result = @to.convert 'rdoc-ref:C1'
diff --git a/test/rdoc/test_rdoc_markup_to_html_snippet.rb b/test/rdoc/test_rdoc_markup_to_html_snippet.rb
index 065b2edbc8..4bb8ed1b47 100644
--- a/test/rdoc/test_rdoc_markup_to_html_snippet.rb
+++ b/test/rdoc/test_rdoc_markup_to_html_snippet.rb
@@ -626,15 +626,15 @@ This routine modifies its +comment+ parameter.
def test_convert_RDOCLINK_label_foottext
result = @to.convert 'rdoc-label:foottext-1'
- assert_equal "<p>*1\n", result
- assert_equal 2, @to.characters
+ assert_equal "<p>1\n", result
+ assert_equal 1, @to.characters
end
def test_convert_RDOCLINK_label_footmark
result = @to.convert 'rdoc-label:footmark-1'
- assert_equal "<p>^1\n", result
- assert_equal 2, @to.characters
+ assert_equal "<p>1\n", result
+ assert_equal 1, @to.characters
end
def test_convert_RDOCLINK_ref
diff --git a/test/rdoc/test_rdoc_markup_to_markdown.rb b/test/rdoc/test_rdoc_markup_to_markdown.rb
index 6d09ca62ea..442bb19e9c 100644
--- a/test/rdoc/test_rdoc_markup_to_markdown.rb
+++ b/test/rdoc/test_rdoc_markup_to_markdown.rb
@@ -354,6 +354,12 @@ words words words words
assert_equal "C\n", result
end
+ def test_convert_RDOCLINK_image
+ result = @to.convert 'rdoc-image:/path/to/image.jpg'
+
+ assert_equal "![](/path/to/image.jpg)\n", result
+ end
+
def test_convert_TIDYLINK
result = @to.convert \
'{DSL}[http://en.wikipedia.org/wiki/Domain-specific_language]'
diff --git a/test/rdoc/test_rdoc_method_attr.rb b/test/rdoc/test_rdoc_method_attr.rb
index 8fff038289..e93e81cee4 100644
--- a/test/rdoc/test_rdoc_method_attr.rb
+++ b/test/rdoc/test_rdoc_method_attr.rb
@@ -2,8 +2,11 @@ require File.expand_path '../xref_test_case', __FILE__
class TestRDocMethodAttr < XrefTestCase
- def test_block_params_equal
+ def test_initialize_copy
+ refute_same @c1_m.full_name, @c1_m.dup.full_name
+ end
+ def test_block_params_equal
m = RDoc::MethodAttr.new(nil, 'foo')
m.block_params = ''
@@ -116,6 +119,10 @@ class TestRDocMethodAttr < XrefTestCase
assert_equal 'C1::m', @c1__m.full_name
end
+ def test_is_alias_for
+ assert_equal @c2_b, @c2_a.is_alias_for
+ end
+
def test_output_name
assert_equal '#m', @c1_m.output_name(@c1)
assert_equal '::m', @c1__m.output_name(@c1)
@@ -140,11 +147,42 @@ class TestRDocMethodAttr < XrefTestCase
assert_equal expected, @c1_m.search_record
end
+ def test_spaceship
+ assert_nil @c1_m.<=>(RDoc::CodeObject.new)
+ end
+
def test_equals2
assert_equal @c1_m, @c1_m
refute_equal @c1_m, @parent_m
end
+ def test_pretty_print
+ temp_dir do |tmpdir|
+ s = RDoc::RI::Store.new tmpdir
+ s.rdoc = @rdoc
+
+ top_level = s.add_file 'file.rb'
+ meth_bang = RDoc::AnyMethod.new nil, 'method!'
+ meth_bang.record_location top_level
+
+ meth_bang_alias = RDoc::Alias.new nil, 'method!', 'method_bang', ''
+ meth_bang_alias.record_location top_level
+
+ klass = top_level.add_class RDoc::NormalClass, 'Object'
+ klass.add_method meth_bang
+
+ meth_bang.add_alias meth_bang_alias, klass
+
+ s.save
+
+ meth_alias_from_store = s.load_method 'Object', '#method_bang'
+
+ expected = "[RDoc::AnyMethod Object#method_bang public alias for method!]"
+ actual = mu_pp meth_alias_from_store
+ assert_equal expected, actual
+ end
+ end
+
def test_to_s
assert_equal 'RDoc::AnyMethod: C1#m', @c1_m.to_s
assert_equal 'RDoc::AnyMethod: C2#b', @c2_b.to_s
diff --git a/test/rdoc/test_rdoc_normal_class.rb b/test/rdoc/test_rdoc_normal_class.rb
index f3c7890d59..ab31a8dd12 100644
--- a/test/rdoc/test_rdoc_normal_class.rb
+++ b/test/rdoc/test_rdoc_normal_class.rb
@@ -15,18 +15,23 @@ class TestRDocNormalClass < XrefTestCase
def test_ancestors_multilevel
c1 = @top_level.add_class RDoc::NormalClass, 'Outer'
- c2 = @top_level.add_class RDoc::NormalClass, 'Middle', c1
- c3 = @top_level.add_class RDoc::NormalClass, 'Inner', c2
+ c2 = @top_level.add_class RDoc::NormalClass, 'Middle', c1.full_name
+ c3 = @top_level.add_class RDoc::NormalClass, 'Inner', c2.full_name
assert_equal [c2, c1, 'Object'], c3.ancestors
end
+ def test_aref
+ assert_equal 'class-C1', @c1.aref
+ assert_equal 'class-C2::C3', @c2_c3.aref
+ end
+
def test_direct_ancestors
incl = RDoc::Include.new 'Incl', ''
c1 = @top_level.add_class RDoc::NormalClass, 'Outer'
- c2 = @top_level.add_class RDoc::NormalClass, 'Middle', c1
- c3 = @top_level.add_class RDoc::NormalClass, 'Inner', c2
+ c2 = @top_level.add_class RDoc::NormalClass, 'Middle', c1.full_name
+ c3 = @top_level.add_class RDoc::NormalClass, 'Inner', c2.full_name
c3.add_include incl
assert_equal [incl.name, c2], c3.direct_ancestors
diff --git a/test/rdoc/test_rdoc_normal_module.rb b/test/rdoc/test_rdoc_normal_module.rb
index 120f56a284..1944564596 100644
--- a/test/rdoc/test_rdoc_normal_module.rb
+++ b/test/rdoc/test_rdoc_normal_module.rb
@@ -23,6 +23,11 @@ class TestRDocNormalModule < XrefTestCase
assert_equal [mod2, incl.name], mod.ancestors
end
+ def test_aref
+ assert_equal 'module-M1', @m1.aref
+ assert_equal 'module-M1::M2', @m1_m2.aref
+ end
+
def test_definition
m = RDoc::NormalModule.new 'M'
diff --git a/test/rdoc/test_rdoc_options.rb b/test/rdoc/test_rdoc_options.rb
index 5d7135c795..67053e3e33 100644
--- a/test/rdoc/test_rdoc_options.rb
+++ b/test/rdoc/test_rdoc_options.rb
@@ -15,13 +15,6 @@ class TestRDocOptions < RDoc::TestCase
RDoc::RDoc::GENERATORS.replace @generators
end
- def mu_pp obj
- s = ''
- s = PP.pp obj, s
- s = s.force_encoding Encoding.default_external if defined? Encoding
- s.chomp
- end
-
def test_check_files
skip "assumes UNIX permission model" if /mswin|mingw/ =~ RUBY_PLATFORM
@@ -69,21 +62,26 @@ class TestRDocOptions < RDoc::TestCase
encoding = Object.const_defined?(:Encoding) ? 'UTF-8' : nil
expected = {
- 'charset' => 'UTF-8',
- 'encoding' => encoding,
- 'exclude' => [],
- 'hyperlink_all' => false,
- 'line_numbers' => false,
- 'main_page' => nil,
- 'markup' => 'rdoc',
- 'page_dir' => nil,
- 'rdoc_include' => [],
- 'show_hash' => false,
- 'static_path' => [],
- 'tab_width' => 8,
- 'title' => nil,
- 'visibility' => :protected,
- 'webcvs' => nil,
+ 'charset' => 'UTF-8',
+ 'encoding' => encoding,
+ 'exclude' => [],
+ 'hyperlink_all' => false,
+ 'line_numbers' => false,
+ 'locale' => nil,
+ 'locale_dir' => 'locale',
+ 'locale_name' => nil,
+ 'main_page' => nil,
+ 'markup' => 'rdoc',
+ 'output_decoration' => true,
+ 'page_dir' => nil,
+ 'rdoc_include' => [],
+ 'show_hash' => false,
+ 'static_path' => [],
+ 'tab_width' => 8,
+ 'template_stylesheets' => [],
+ 'title' => nil,
+ 'visibility' => :protected,
+ 'webcvs' => nil,
}
assert_equal expected, coder
@@ -339,6 +337,18 @@ rdoc_include:
e.message
end
+ def test_parse_h
+ out, = capture_io do
+ begin
+ @options.parse %w[-h]
+ rescue SystemExit
+ end
+ end
+
+ assert_equal 1, out.scan(/HTML generator options:/).length
+ assert_equal 1, out.scan(/ri generator options:/). length
+ end
+
def test_parse_help
out, = capture_io do
begin
@@ -372,6 +382,20 @@ rdoc_include:
assert_equal 1, out.scan(/test generator options:/).length
end
+ def test_parse_format_for_extra_generator
+ RDoc::RDoc::GENERATORS['test'] = Class.new do
+ def self.setup_options options
+ op = options.option_parser
+
+ op.separator 'test generator options:'
+ end
+ end
+
+ @options.setup_generator 'test'
+
+ assert_equal @options.generator_name, 'test'
+ end
+
def test_parse_ignore_invalid
out, err = capture_io do
@options.parse %w[--ignore-invalid --bogus]
@@ -409,6 +433,39 @@ rdoc_include:
assert_empty out
end
+ def test_parse_ignore_invalid_no_quiet
+ out, err = capture_io do
+ assert_raises SystemExit do
+ @options.parse %w[--quiet --no-ignore-invalid --bogus=arg --bobogus --visibility=extended]
+ end
+ end
+
+ refute_match %r%^Usage: %, err
+ assert_match %r%^invalid options: --bogus=arg, --bobogus, --visibility=extended%, err
+
+ assert_empty out
+ end
+
+ def test_ignore_needless_arg
+ out, err = capture_io do
+ @options.parse %w[--ri=foo]
+ end
+
+ assert_match %r%^invalid options: --ri=foo%, err
+
+ assert_empty out
+ end
+
+ def test_ignore_missing_arg
+ out, err = capture_io do
+ @options.parse %w[--copy-files]
+ end
+
+ assert_match %r%^invalid options: --copy-files%, err
+
+ assert_empty out
+ end
+
def test_parse_main
out, err = capture_io do
@options.parse %w[--main MAIN]
@@ -468,6 +525,13 @@ rdoc_include:
end
end
+ def test_parse_ri_site
+ @options.parse %w[--ri-site]
+
+ assert_equal RDoc::Generator::RI, @options.generator
+ assert_equal RDoc::RI::Paths.site_dir, @options.op_dir
+ end
+
def test_parse_root
assert_equal Pathname(Dir.pwd), @options.root
@@ -479,6 +543,27 @@ rdoc_include:
assert_empty err
assert_equal Pathname(Dir.tmpdir), @options.root
+ assert_includes @options.rdoc_include, @options.root.to_s
+ end
+
+ def test_parse_tab_width
+ @options.parse %w[--tab-width=1]
+ assert_equal 1, @options.tab_width
+
+ @options.parse %w[-w2]
+ assert_equal 2, @options.tab_width
+
+ _, err = capture_io do
+ @options.parse %w[-w=2]
+ end
+
+ assert_match 'invalid options', err
+
+ _, err = capture_io do
+ @options.parse %w[-w0]
+ end
+
+ assert_match 'invalid options', err
end
def test_parse_template
@@ -532,6 +617,20 @@ rdoc_include:
$LOAD_PATH.replace orig_LOAD_PATH
end
+ def test_parse_visibility
+ @options.parse %w[--visibility=public]
+ assert_equal :public, @options.visibility
+
+ @options.parse %w[--visibility=protected]
+ assert_equal :protected, @options.visibility
+
+ @options.parse %w[--visibility=private]
+ assert_equal :private, @options.visibility
+
+ @options.parse %w[--visibility=nodoc]
+ assert_equal :nodoc, @options.visibility
+ end
+
def test_parse_write_options
tmpdir = File.join Dir.tmpdir, "test_rdoc_options_#{$$}"
FileUtils.mkdir_p tmpdir
@@ -639,5 +738,29 @@ rdoc_include:
end
end
+ def test_version
+ out, _ = capture_io do
+ begin
+ @options.parse %w[--version]
+ rescue SystemExit
+ end
+ end
+
+ assert out.include?(RDoc::VERSION)
+
+ out, _ = capture_io do
+ begin
+ @options.parse %w[-v]
+ rescue SystemExit
+ end
+ end
+
+ assert out.include?(RDoc::VERSION)
+ end
+
+ def test_visibility
+ @options.visibility = :all
+ assert_equal :private, @options.visibility
+ end
end
diff --git a/test/rdoc/test_rdoc_parser.rb b/test/rdoc/test_rdoc_parser.rb
index 338693f97a..34d4486cb1 100644
--- a/test/rdoc/test_rdoc_parser.rb
+++ b/test/rdoc/test_rdoc_parser.rb
@@ -15,6 +15,19 @@ class TestRDocParser < RDoc::TestCase
@options = RDoc::Options.new
end
+ def test_class_binary_eh_ISO_2022_JP
+ iso_2022_jp = File.join Dir.tmpdir, "test_rdoc_parser_#{$$}.rd"
+
+ open iso_2022_jp, 'wb' do |io|
+ io.write "# coding: ISO-2022-JP\n"
+ io.write ":\e$B%3%^%s%I\e(B:\n"
+ end
+
+ refute @RP.binary? iso_2022_jp
+ ensure
+ File.unlink iso_2022_jp
+ end
+
def test_class_binary_eh_marshal
marshal = File.join Dir.tmpdir, "test_rdoc_parser_#{$$}.marshal"
open marshal, 'wb' do |io|
@@ -96,7 +109,7 @@ class TestRDocParser < RDoc::TestCase
def test_class_for_forbidden
skip 'chmod not supported' if Gem.win_platform?
- Tempfile.open 'forbidden' do |io|
+ tf = Tempfile.open 'forbidden' do |io|
begin
File.chmod 0000, io.path
forbidden = @store.add_file io.path
@@ -107,6 +120,23 @@ class TestRDocParser < RDoc::TestCase
ensure
File.chmod 0400, io.path
end
+ io
+ end
+ tf.close! if tf.respond_to? :close!
+ end
+
+ def test_class_for_modeline
+ temp_dir do
+ content = "# -*- rdoc -*-\n= NEWS\n"
+
+ open 'NEWS', 'w' do |io| io.write content end
+ app = @store.add_file 'NEWS'
+
+ parser = @RP.for app, 'NEWS', content, @options, :stats
+
+ assert_kind_of RDoc::Parser::Simple, parser
+
+ assert_equal "= NEWS\n", parser.content
end
end
@@ -277,6 +307,16 @@ class TestRDocParser < RDoc::TestCase
assert_nil parser
end
+ def test_class_use_markup_unknown
+ content = <<-CONTENT
+# :markup: RDoc
+ CONTENT
+
+ parser = @RP.use_markup content
+
+ assert_nil parser
+ end
+
def test_initialize
@RP.new @top_level, @fn, '', @options, nil
diff --git a/test/rdoc/test_rdoc_parser_c.rb b/test/rdoc/test_rdoc_parser_c.rb
index 8fe1bf46ec..71ffce5f9a 100644
--- a/test/rdoc/test_rdoc_parser_c.rb
+++ b/test/rdoc/test_rdoc_parser_c.rb
@@ -58,7 +58,7 @@ class TestRDocParserC < RDoc::TestCase
def teardown
super
- @tempfile.close
+ @tempfile.close!
end
def test_class_can_parse
@@ -534,10 +534,6 @@ void Init_curses(){
def test_do_constants_file
content = <<-EOF
void Init_File(void) {
- rb_cFile = rb_define_class("File", rb_cIO);
- rb_mFConst = rb_define_module_under(rb_cFile, "Constants");
- rb_include_module(rb_cIO, rb_mFConst);
-
/* Document-const: LOCK_SH
*
* Shared lock
@@ -740,6 +736,47 @@ rb_define_alias(C, "[]", "index");
assert_equal "/*\n * comment\n */\n\n", comment.text
end
+ def test_find_attr_comment_document_attr
+ parser= util_parser <<-C
+/*
+ * Document-attr: y
+ * comment
+ */
+ C
+
+ comment = parser.find_attr_comment nil, 'y'
+
+ assert_equal "/*\n * \n * comment\n */", comment.text
+ end
+
+ def test_find_attr_comment_document_attr_oneline
+ parser= util_parser <<-C
+/* Document-attr: y
+ * comment
+ */
+ C
+
+ comment = parser.find_attr_comment nil, 'y'
+
+ assert_equal "/* \n * comment\n */", comment.text
+ end
+
+ def test_find_attr_comment_document_attr_overlap
+ parser= util_parser <<-C
+/* Document-attr: x
+ * comment
+ */
+
+/* Document-attr: y
+ * comment
+ */
+ C
+
+ comment = parser.find_attr_comment nil, 'y'
+
+ assert_equal "/* \n * comment\n */", comment.text
+ end
+
def test_find_class_comment
@options.rdoc_include << File.dirname(__FILE__)
@@ -1000,6 +1037,36 @@ init_gi_repository (void)
assert_equal 2, klass.method_list.length
end
+ def test_find_body_cast
+ content = <<-EOF
+/*
+ * a comment for other_function
+ */
+VALUE
+other_function() {
+}
+
+void
+Init_Foo(void) {
+ VALUE foo = rb_define_class("Foo", rb_cObject);
+
+ rb_define_method(foo, "my_method", (METHOD)other_function, 0);
+}
+ EOF
+
+ klass = util_get_class content, 'foo'
+ other_function = klass.method_list.first
+
+ assert_equal 'my_method', other_function.name
+ assert_equal "a comment for other_function",
+ other_function.comment.text
+ assert_equal '()', other_function.params
+
+ code = other_function.token_stream.first.text
+
+ assert_equal "VALUE\nother_function() {\n}", code
+ end
+
def test_find_body_define
content = <<-EOF
#define something something_else
@@ -1179,6 +1246,36 @@ Init_Foo(void) {
assert_equal "a comment for Foo#bar", bar.comment.text
end
+ def test_find_body_macro
+ content = <<-EOF
+/*
+ * a comment for other_function
+ */
+DLL_LOCAL VALUE
+other_function() {
+}
+
+void
+Init_Foo(void) {
+ VALUE foo = rb_define_class("Foo", rb_cObject);
+
+ rb_define_method(foo, "my_method", other_function, 0);
+}
+ EOF
+
+ klass = util_get_class content, 'foo'
+ other_function = klass.method_list.first
+
+ assert_equal 'my_method', other_function.name
+ assert_equal "a comment for other_function",
+ other_function.comment.text
+ assert_equal '()', other_function.params
+
+ code = other_function.token_stream.first.text
+
+ assert_equal "DLL_LOCAL VALUE\nother_function() {\n}", code
+ end
+
def test_find_modifiers_call_seq
comment = RDoc::Comment.new <<-COMMENT
call-seq:
@@ -1669,6 +1766,96 @@ void Init(void) {
assert_equal expected, @store.c_singleton_class_variables
end
+ def test_scan_method_copy
+ parser = util_parser <<-C
+/*
+ * call-seq:
+ * pathname.to_s -> string
+ * pathname.to_path -> string
+ *
+ * Return the path as a String.
+ *
+ * to_path is implemented so Pathname objects are usable with File.open, etc.
+ */
+static VALUE
+path_to_s(VALUE self) { }
+
+/*
+ * call-seq:
+ * str[index] -> new_str or nil
+ * str[start, length] -> new_str or nil
+ * str.slice(index) -> new_str or nil
+ * str.slice(start, length) -> new_str or nil
+ */
+static VALUE
+path_aref_m(int argc, VALUE *argv, VALUE str) { }
+
+/*
+ * call-seq:
+ * string <=> other_string -> -1, 0, +1 or nil
+ */
+static VALUE
+path_cmp_m(VALUE str1, VALUE str2) { }
+
+/*
+ * call-seq:
+ * str == obj -> true or false
+ * str === obj -> true or false
+ */
+VALUE
+rb_str_equal(VALUE str1, VALUE str2) { }
+
+Init_pathname()
+{
+ rb_cPathname = rb_define_class("Pathname", rb_cObject);
+
+ rb_define_method(rb_cPathname, "to_s", path_to_s, 0);
+ rb_define_method(rb_cPathname, "to_path", path_to_s, 0);
+ rb_define_method(rb_cPathname, "[]", path_aref_m, -1);
+ rb_define_method(rb_cPathname, "slice", path_aref_m, -1);
+ rb_define_method(rb_cPathname, "<=>", path_cmp_m, 1);
+ rb_define_method(rb_cPathname, "==", rb_str_equal), 2);
+ rb_define_method(rb_cPathname, "===", rb_str_equal), 2);
+}
+ C
+
+ parser.scan
+
+ pathname = @store.classes_hash['Pathname']
+
+ to_path = pathname.method_list.find { |m| m.name == 'to_path' }
+ assert_equal "pathname.to_path -> string", to_path.call_seq
+
+ to_s = pathname.method_list.find { |m| m.name == 'to_s' }
+ assert_equal "pathname.to_s -> string", to_s.call_seq
+
+ index_expected = <<-EXPECTED.chomp
+str[index] -> new_str or nil
+str[start, length] -> new_str or nil
+ EXPECTED
+
+ index = pathname.method_list.find { |m| m.name == '[]' }
+ assert_equal index_expected, index.call_seq, '[]'
+
+ slice_expected = <<-EXPECTED.chomp
+str.slice(index) -> new_str or nil
+str.slice(start, length) -> new_str or nil
+ EXPECTED
+
+ slice = pathname.method_list.find { |m| m.name == 'slice' }
+ assert_equal slice_expected, slice.call_seq
+
+ spaceship = pathname.method_list.find { |m| m.name == '<=>' }
+ assert_equal "string <=> other_string -> -1, 0, +1 or nil",
+ spaceship.call_seq
+
+ equals2 = pathname.method_list.find { |m| m.name == '==' }
+ assert_match 'str == obj', equals2.call_seq
+
+ equals3 = pathname.method_list.find { |m| m.name == '===' }
+ assert_match 'str === obj', equals3.call_seq
+ end
+
def test_scan_order_dependent
parser = util_parser <<-C
void a(void) {
diff --git a/test/rdoc/test_rdoc_parser_changelog.rb b/test/rdoc/test_rdoc_parser_changelog.rb
index ccd66f2b84..4d83983092 100644
--- a/test/rdoc/test_rdoc_parser_changelog.rb
+++ b/test/rdoc/test_rdoc_parser_changelog.rb
@@ -12,14 +12,7 @@ class TestRDocParserChangeLog < RDoc::TestCase
end
def teardown
- @tempfile.close
- end
-
- def mu_pp obj
- s = ''
- s = PP.pp obj, s
- s = s.force_encoding Encoding.default_external if defined? Encoding
- s.chomp
+ @tempfile.close!
end
def test_class_can_parse
diff --git a/test/rdoc/test_rdoc_parser_markdown.rb b/test/rdoc/test_rdoc_parser_markdown.rb
index 597407ff68..b17e14432b 100644
--- a/test/rdoc/test_rdoc_parser_markdown.rb
+++ b/test/rdoc/test_rdoc_parser_markdown.rb
@@ -19,7 +19,7 @@ class TestRDocParserMarkdown < RDoc::TestCase
def teardown
super
- @tempfile.close
+ @tempfile.close!
end
def test_file
diff --git a/test/rdoc/test_rdoc_parser_rd.rb b/test/rdoc/test_rdoc_parser_rd.rb
index 79959d2aae..9be0d7d31c 100644
--- a/test/rdoc/test_rdoc_parser_rd.rb
+++ b/test/rdoc/test_rdoc_parser_rd.rb
@@ -19,14 +19,7 @@ class TestRDocParserRd < RDoc::TestCase
def teardown
super
- @tempfile.close
- end
-
- def mu_pp obj
- s = ''
- s = PP.pp obj, s
- s = s.force_encoding Encoding.default_external if defined? Encoding
- s.chomp
+ @tempfile.close!
end
def test_file
diff --git a/test/rdoc/test_rdoc_parser_ruby.rb b/test/rdoc/test_rdoc_parser_ruby.rb
index 2c61728571..8750433ff1 100644
--- a/test/rdoc/test_rdoc_parser_ruby.rb
+++ b/test/rdoc/test_rdoc_parser_ruby.rb
@@ -29,15 +29,8 @@ class TestRDocParserRuby < RDoc::TestCase
def teardown
super
- @tempfile.close
- @tempfile2.close
- end
-
- def mu_pp obj
- s = ''
- s = PP.pp obj, s
- s = s.force_encoding(Encoding.default_external) if defined? Encoding
- s.chomp
+ @tempfile.close!
+ @tempfile2.close!
end
def test_collect_first_comment
@@ -70,6 +63,21 @@ class C; end
assert_equal Encoding::CP852, comment.text.encoding
end
+ def test_collect_first_comment_rd_hash
+ parser = util_parser <<-CONTENT
+=begin
+first
+=end
+
+# second
+class C; end
+ CONTENT
+
+ comment = parser.collect_first_comment
+
+ assert_equal RDoc::Comment.new("first\n\n", @top_level), comment
+ end
+
def test_get_class_or_module
ctxt = RDoc::Context.new
ctxt.store = @store
@@ -163,6 +171,35 @@ class C; end
assert_equal '/', @parser.get_symbol_or_name
end
+ def test_suppress_parents
+ a = @top_level.add_class RDoc::NormalClass, 'A'
+ b = a.add_class RDoc::NormalClass, 'B'
+ c = b.add_class RDoc::NormalClass, 'C'
+
+ util_parser ''
+
+ @parser.suppress_parents c, a
+
+ assert c.suppressed?
+ assert b.suppressed?
+ refute a.suppressed?
+ end
+
+ def test_suppress_parents_documented
+ a = @top_level.add_class RDoc::NormalClass, 'A'
+ b = a.add_class RDoc::NormalClass, 'B'
+ b.add_comment RDoc::Comment.new("hello"), @top_level
+ c = b.add_class RDoc::NormalClass, 'C'
+
+ util_parser ''
+
+ @parser.suppress_parents c, a
+
+ assert c.suppressed?
+ refute b.suppressed?
+ refute a.suppressed?
+ end
+
def test_look_for_directives_in_attr
util_parser ""
@@ -392,6 +429,23 @@ class C; end
assert_equal 0, klass.attributes.length
end
+ def test_parse_attr_accessor_nodoc_track
+ klass = RDoc::NormalClass.new 'Foo'
+ klass.parent = @top_level
+
+ comment = RDoc::Comment.new "##\n# my attr\n", @top_level
+
+ @options.visibility = :nodoc
+
+ util_parser "attr_accessor :foo, :bar # :nodoc:"
+
+ tk = @parser.get_tk
+
+ @parser.parse_attr_accessor klass, RDoc::Parser::Ruby::NORMAL, tk, comment
+
+ refute_empty klass.attributes
+ end
+
def test_parse_attr_accessor_stopdoc
klass = RDoc::NormalClass.new 'Foo'
klass.parent = @top_level
@@ -568,6 +622,26 @@ class C; end
assert_equal 1, foo.line
end
+ def test_parse_class_singleton
+ comment = RDoc::Comment.new "##\n# my class\n", @top_level
+
+ util_parser <<-RUBY
+class C
+ class << self
+ end
+end
+ RUBY
+
+ tk = @parser.get_tk
+
+ @parser.parse_class @top_level, RDoc::Parser::Ruby::NORMAL, tk, comment
+
+ c = @top_level.classes.first
+ assert_equal 'C', c.full_name
+ assert_equal 0, c.offset
+ assert_equal 1, c.line
+ end
+
def test_parse_class_ghost_method
util_parser <<-CLASS
class Foo
@@ -589,6 +663,29 @@ end
assert_equal @top_level, blah.file
end
+ def test_parse_class_ghost_method_yields
+ util_parser <<-CLASS
+class Foo
+ ##
+ # :method:
+ # :call-seq:
+ # yields(name)
+end
+ CLASS
+
+ tk = @parser.get_tk
+
+ @parser.parse_class @top_level, RDoc::Parser::Ruby::NORMAL, tk, @comment
+
+ foo = @top_level.classes.first
+ assert_equal 'Foo', foo.full_name
+
+ blah = foo.method_list.first
+ assert_equal 'Foo#yields', blah.full_name
+ assert_equal 'yields(name)', blah.call_seq
+ assert_equal @top_level, blah.file
+ end
+
def test_parse_class_multi_ghost_methods
util_parser <<-'CLASS'
class Foo
@@ -1002,6 +1099,23 @@ EOF
assert_equal klass.current_section, foo.section
end
+ def test_parse_comment_attr_attr_reader
+ klass = RDoc::NormalClass.new 'Foo'
+ klass.parent = @top_level
+
+ comment = RDoc::Comment.new "##\n# :attr_reader: foo\n", @top_level
+
+ util_parser "\n"
+
+ tk = @parser.get_tk
+
+ @parser.parse_comment klass, tk, comment
+
+ foo = klass.attributes.first
+ assert_equal 'foo', foo.name
+ assert_equal 'R', foo.rw
+ end
+
def test_parse_comment_attr_stopdoc
klass = RDoc::NormalClass.new 'Foo'
klass.parent = @top_level
@@ -1064,6 +1178,23 @@ EOF
assert_equal stream, foo.token_stream
end
+ def test_parse_comment_method_args
+ klass = RDoc::NormalClass.new 'Foo'
+ klass.parent = @top_level
+
+
+ util_parser "\n"
+
+ tk = @parser.get_tk
+
+ @parser.parse_comment klass, tk,
+ comment("##\n# :method: foo\n# :args: a, b\n")
+
+ foo = klass.method_list.first
+ assert_equal 'foo', foo.name
+ assert_equal 'a, b', foo.params
+ end
+
def test_parse_comment_method_stopdoc
klass = RDoc::NormalClass.new 'Foo'
klass.parent = @top_level
@@ -1203,44 +1334,44 @@ A::B::C = 1
assert_equal 'comment', c.comment
end
- def test_parse_include
+ def test_parse_extend_or_include_extend
klass = RDoc::NormalClass.new 'C'
klass.parent = @top_level
- comment = RDoc::Comment.new "# my include\n", @top_level
+ comment = RDoc::Comment.new "# my extend\n", @top_level
- util_parser "include I"
+ util_parser "extend I"
- @parser.get_tk # include
+ @parser.get_tk # extend
- @parser.parse_include klass, comment
+ @parser.parse_extend_or_include RDoc::Extend, klass, comment
- assert_equal 1, klass.includes.length
+ assert_equal 1, klass.extends.length
- incl = klass.includes.first
- assert_equal 'I', incl.name
- assert_equal 'my include', incl.comment.text
- assert_equal @top_level, incl.file
+ ext = klass.extends.first
+ assert_equal 'I', ext.name
+ assert_equal 'my extend', ext.comment.text
+ assert_equal @top_level, ext.file
end
- def test_parse_extend
+ def test_parse_extend_or_include_include
klass = RDoc::NormalClass.new 'C'
klass.parent = @top_level
- comment = RDoc::Comment.new "# my extend\n", @top_level
+ comment = RDoc::Comment.new "# my include\n", @top_level
- util_parser "extend I"
+ util_parser "include I"
- @parser.get_tk # extend
+ @parser.get_tk # include
- @parser.parse_extend klass, comment
+ @parser.parse_extend_or_include RDoc::Include, klass, comment
- assert_equal 1, klass.extends.length
+ assert_equal 1, klass.includes.length
- ext = klass.extends.first
- assert_equal 'I', ext.name
- assert_equal 'my extend', ext.comment.text
- assert_equal @top_level, ext.file
+ incl = klass.includes.first
+ assert_equal 'I', incl.name
+ assert_equal 'my include', incl.comment.text
+ assert_equal @top_level, incl.file
end
def test_parse_meta_method
@@ -1644,6 +1775,34 @@ end
assert_equal 'foo', foo.name
end
+ def test_parse_method_nodoc
+ klass = RDoc::NormalClass.new 'Foo'
+ klass.parent = @top_level
+
+ util_parser "def foo # :nodoc:\nend"
+
+ tk = @parser.get_tk
+
+ @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, comment('')
+
+ assert_empty klass.method_list
+ end
+
+ def test_parse_method_nodoc_track
+ klass = RDoc::NormalClass.new 'Foo'
+ klass.parent = @top_level
+
+ @options.visibility = :nodoc
+
+ util_parser "def foo # :nodoc:\nend"
+
+ tk = @parser.get_tk
+
+ @parser.parse_method klass, RDoc::Parser::Ruby::NORMAL, tk, comment('')
+
+ refute_empty klass.method_list
+ end
+
def test_parse_method_no_parens
klass = RDoc::NormalClass.new 'Foo'
klass.parent = @top_level
@@ -1884,6 +2043,24 @@ end
assert_equal Encoding::CP852, foo.comment.text.encoding
end
+ def test_parse_statements_enddoc
+ klass = @top_level.add_class RDoc::NormalClass, 'Foo'
+
+ util_parser "\n# :enddoc:"
+
+ @parser.parse_statements klass, RDoc::Parser::Ruby::NORMAL, nil
+
+ assert klass.done_documenting
+ end
+
+ def test_parse_statements_enddoc_top_level
+ util_parser "\n# :enddoc:"
+
+ assert_throws :eof do
+ @parser.parse_statements @top_level, RDoc::Parser::Ruby::NORMAL, nil
+ end
+ end
+
def test_parse_statements_identifier_meta_method
content = <<-EOF
class Foo
@@ -2367,6 +2544,16 @@ end
# HACK where are the assertions?
end
+ def test_parse_top_level_statements_enddoc
+ util_parser <<-CONTENT
+# :enddoc:
+ CONTENT
+
+ assert_throws :eof do
+ @parser.parse_top_level_statements @top_level
+ end
+ end
+
def test_parse_top_level_statements_stopdoc
@top_level.stop_doc
content = "# this is the top-level comment"
@@ -2690,6 +2877,21 @@ end
assert_equal 'A nice girl', m.comment.text
end
+ def test_scan_class_nested_nodoc
+ content = <<-CONTENT
+class A::B # :nodoc:
+end
+ CONTENT
+
+ util_parser content
+
+ @parser.scan
+
+ visible = @store.all_classes_and_modules.select { |mod| mod.display? }
+
+ assert_empty visible.map { |mod| mod.full_name }
+ end
+
def test_scan_constant_in_method
content = <<-CONTENT # newline is after M is important
module M
@@ -2780,6 +2982,30 @@ end
assert c.documented?
end
+ def test_scan_duplicate_module
+ content = <<-CONTENT
+# comment a
+module Foo
+end
+
+# comment b
+module Foo
+end
+ CONTENT
+
+ util_parser content
+
+ @parser.scan
+
+ foo = @top_level.modules.first
+
+ expected = [
+ RDoc::Comment.new('comment b', @top_level)
+ ]
+
+ assert_equal expected, foo.comment_location.map { |c, l| c }
+ end
+
def test_scan_meta_method_block
content = <<-CONTENT
class C
@@ -2802,6 +3028,32 @@ class C
assert_equal 2, @top_level.classes.first.method_list.length
end
+ def test_scan_method_semi_method
+ content = <<-CONTENT
+class A
+ def self.m() end; def self.m=() end
+end
+
+class B
+ def self.m() end
+end
+ CONTENT
+
+ util_parser content
+
+ @parser.scan
+
+ a = @store.find_class_named 'A'
+ assert a, 'missing A'
+
+ assert_equal 2, a.method_list.length
+
+ b = @store.find_class_named 'B'
+ assert b, 'missing B'
+
+ assert_equal 1, b.method_list.length
+ end
+
def test_scan_markup_override
content = <<-CONTENT
# *awesome*
@@ -2847,6 +3099,20 @@ end
assert_equal 'rd', c.method_list.first.comment.format
end
+ def test_scan_rails_routes
+ util_parser <<-ROUTES_RB
+namespace :api do
+ scope module: :v1 do
+ end
+end
+ ROUTES_RB
+
+ @parser.scan
+
+ assert_empty @top_level.classes
+ assert_empty @top_level.modules
+ end
+
def test_scan_tomdoc_meta
util_parser <<-RUBY
# :markup: tomdoc
@@ -2953,6 +3219,53 @@ end
assert_equal %w[C::[]], c.method_list.map { |m| m.full_name }
end
+ def test_scan_visibility
+ util_parser <<-RUBY
+class C
+ def a() end
+
+ private :a
+
+ class << self
+ def b() end
+ private :b
+ end
+end
+ RUBY
+
+ @parser.scan
+
+ c = @store.find_class_named 'C'
+
+ c_a = c.find_method_named 'a'
+
+ assert_equal :private, c_a.visibility
+ refute c_a.singleton
+
+ c_b = c.find_method_named 'b'
+
+ assert_equal :private, c_b.visibility
+ assert c_b.singleton
+ end
+
+ def test_singleton_method_via_eigenclass
+ util_parser <<-RUBY
+class C
+ class << self
+ def a() end
+ end
+end
+ RUBY
+
+ @parser.scan
+
+ c = @store.find_class_named 'C'
+ c_a = c.find_method_named 'a'
+
+ assert_equal :public, c_a.visibility
+ assert c_a.singleton
+ end
+
def test_stopdoc_after_comment
util_parser <<-EOS
module Bar
diff --git a/test/rdoc/test_rdoc_parser_simple.rb b/test/rdoc/test_rdoc_parser_simple.rb
index 356ea07504..d45a99358a 100644
--- a/test/rdoc/test_rdoc_parser_simple.rb
+++ b/test/rdoc/test_rdoc_parser_simple.rb
@@ -17,7 +17,7 @@ class TestRDocParserSimple < RDoc::TestCase
def teardown
super
- @tempfile.close
+ @tempfile.close!
end
def test_initialize_metadata
diff --git a/test/rdoc/test_rdoc_rd_block_parser.rb b/test/rdoc/test_rdoc_rd_block_parser.rb
index 8bb1c27c2d..956f3d2822 100644
--- a/test/rdoc/test_rdoc_rd_block_parser.rb
+++ b/test/rdoc/test_rdoc_rd_block_parser.rb
@@ -8,13 +8,6 @@ class TestRDocRdBlockParser < RDoc::TestCase
@block_parser = RDoc::RD::BlockParser.new
end
- def mu_pp(obj)
- s = ""
- s = PP.pp obj, s
- s = s.force_encoding(Encoding.default_external) if defined? Encoding
- s.chomp
- end
-
def test_add_footnote
index = @block_parser.add_footnote 'context'
@@ -160,7 +153,7 @@ class TestRDocRdBlockParser < RDoc::TestCase
blank_line,
blank_line)
- Tempfile.open %w[parse_include .rd] do |io|
+ tf = Tempfile.open %w[parse_include .rd] do |io|
io.puts "=begin\ninclude ((*worked*))\n=end"
io.flush
@@ -169,7 +162,9 @@ class TestRDocRdBlockParser < RDoc::TestCase
STR
assert_equal expected, parse(str)
+ io
end
+ tf.close! if tf.respond_to? :close!
end
def test_parse_heading
@@ -538,4 +533,3 @@ two
end
end
-
diff --git a/test/rdoc/test_rdoc_rd_inline_parser.rb b/test/rdoc/test_rdoc_rd_inline_parser.rb
index 6f8c9557c4..e4a765b4fb 100644
--- a/test/rdoc/test_rdoc_rd_inline_parser.rb
+++ b/test/rdoc/test_rdoc_rd_inline_parser.rb
@@ -175,4 +175,3 @@ class TestRDocRdInlineParser < RDoc::TestCase
end
end
-
diff --git a/test/rdoc/test_rdoc_rdoc.rb b/test/rdoc/test_rdoc_rdoc.rb
index 28b6a2bb4d..230c18fde2 100644
--- a/test/rdoc/test_rdoc_rdoc.rb
+++ b/test/rdoc/test_rdoc_rdoc.rb
@@ -108,7 +108,13 @@ class TestRDocRDoc < RDoc::TestCase
end
def test_normalized_file_list
- files = @rdoc.normalized_file_list [__FILE__]
+ files = temp_dir do |dir|
+ flag_file = @rdoc.output_flag_file dir
+
+ FileUtils.touch flag_file
+
+ @rdoc.normalized_file_list [__FILE__, flag_file]
+ end
files = files.map { |file| File.expand_path file }
@@ -162,6 +168,43 @@ class TestRDocRDoc < RDoc::TestCase
end
end
+ def test_parse_file_binary
+ @rdoc.store = RDoc::Store.new
+
+ root = File.dirname __FILE__
+
+ @rdoc.options.root = Pathname root
+
+ out, err = capture_io do
+ Dir.chdir root do
+ assert_nil @rdoc.parse_file 'binary.dat'
+ end
+ end
+
+ assert_empty out
+ assert_empty err
+ end
+
+ def test_parse_file_include_root
+ @rdoc.store = RDoc::Store.new
+
+ top_level = nil
+ temp_dir do |dir|
+ @rdoc.options.parse %W[--root #{File.dirname(__FILE__)}]
+
+ open 'include.txt', 'w' do |io|
+ io.puts ':include: test.txt'
+ end
+
+ out, err = capture_io do
+ top_level = @rdoc.parse_file 'include.txt'
+ end
+ assert_empty out
+ assert_empty err
+ end
+ assert_equal "test file", top_level.comment.text
+ end
+
def test_parse_file_page_dir
@rdoc.store = RDoc::Store.new
@@ -209,14 +252,16 @@ class TestRDocRDoc < RDoc::TestCase
@rdoc.options.encoding = Encoding::ISO_8859_1
@rdoc.store = RDoc::Store.new
- Tempfile.open 'test.txt' do |io|
+ tf = Tempfile.open 'test.txt' do |io|
io.write 'hi'
io.rewind
top_level = @rdoc.parse_file io.path
assert_equal Encoding::ISO_8859_1, top_level.absolute_name.encoding
+ io
end
+ tf.close! if tf.respond_to? :close!
end
def test_parse_file_forbidden
@@ -224,7 +269,7 @@ class TestRDocRDoc < RDoc::TestCase
@rdoc.store = RDoc::Store.new
- Tempfile.open 'test.txt' do |io|
+ tf = Tempfile.open 'test.txt' do |io|
io.write 'hi'
io.rewind
@@ -243,7 +288,9 @@ class TestRDocRDoc < RDoc::TestCase
ensure
File.chmod 0400, io.path
end
+ io
end
+ tf.close! if tf.respond_to? :close!
end
def test_remove_unparseable
@@ -339,7 +386,7 @@ class TestRDocRDoc < RDoc::TestCase
end
def test_setup_output_dir_exists_file
- Tempfile.open 'test_rdoc_rdoc' do |tempfile|
+ tf = Tempfile.open 'test_rdoc_rdoc' do |tempfile|
path = tempfile.path
e = assert_raises RDoc::Error do
@@ -348,7 +395,9 @@ class TestRDocRDoc < RDoc::TestCase
assert_match(%r%#{Regexp.escape path} exists and is not a directory%,
e.message)
+ tempfile
end
+ tf.close! if tf.respond_to? :close!
end
def test_setup_output_dir_exists_not_rdoc
@@ -387,5 +436,20 @@ class TestRDocRDoc < RDoc::TestCase
end
end
+ def test_normalized_file_list_removes_created_rid_dir
+ temp_dir do |d|
+ FileUtils.mkdir "doc"
+ flag_file = @rdoc.output_flag_file "doc"
+ file = File.join "doc", "test"
+ FileUtils.touch flag_file
+ FileUtils.touch file
+
+ file_list = ["doc"]
+
+ output = @rdoc.normalized_file_list file_list
+
+ assert_empty output
+ end
+ end
end
diff --git a/test/rdoc/test_rdoc_ri_driver.rb b/test/rdoc/test_rdoc_ri_driver.rb
index 92403e12f4..d0987a01c3 100644
--- a/test/rdoc/test_rdoc_ri_driver.rb
+++ b/test/rdoc/test_rdoc_ri_driver.rb
@@ -46,13 +46,6 @@ class TestRDocRIDriver < RDoc::TestCase
ENV['RI_PAGER'] = pager_env
end
- def mu_pp(obj)
- s = ''
- s = PP.pp obj, s
- s = s.force_encoding(Encoding.default_external) if defined? Encoding
- s.chomp
- end
-
def test_self_dump
util_store
@@ -696,6 +689,14 @@ Foo::Bar#bother
assert_equal expected, out
end
+ def test_display_name_not_found_special
+ util_store
+
+ assert_raises RDoc::RI::Driver::NotFoundError do
+ assert_equal false, @driver.display_name('Set#[]')
+ end
+ end
+
def test_display_method_params
util_store
@@ -939,7 +940,10 @@ Foo::Bar#bother
tty = Object.new
def tty.tty?() true; end
- driver = RDoc::RI::Driver.new
+ @options.delete :use_stdout
+ @options.delete :formatter
+
+ driver = RDoc::RI::Driver.new @options
assert_instance_of @RM::ToAnsi, driver.formatter(tty)
@@ -1094,6 +1098,17 @@ Foo::Bar#bother
assert_equal expected, @driver.load_methods_matching('Bar#inherit')
end
+ def test_load_method_missing
+ util_store
+
+ FileUtils.rm @store1.method_file 'Foo', '#inherit'
+
+ method = @driver.load_method(@store1, :instance_methods, 'Foo', '#',
+ 'inherit')
+
+ assert_equal '(unknown)#inherit', method.full_name
+ end
+
def _test_page # this test doesn't do anything anymore :(
@driver.use_stdout = false
diff --git a/test/rdoc/test_rdoc_ruby_lex.rb b/test/rdoc/test_rdoc_ruby_lex.rb
index 0dcb42565d..8871b4f412 100644
--- a/test/rdoc/test_rdoc_ruby_lex.rb
+++ b/test/rdoc/test_rdoc_ruby_lex.rb
@@ -8,13 +8,6 @@ class TestRDocRubyLex < RDoc::TestCase
@TK = RDoc::RubyToken
end
- def mu_pp obj
- s = ''
- s = PP.pp obj, s
- s = s.force_encoding(Encoding.default_external) if defined? Encoding
- s.chomp
- end
-
def test_class_tokenize
tokens = RDoc::RubyLex.tokenize "def x() end", nil
@@ -47,8 +40,8 @@ class TestRDocRubyLex < RDoc::TestCase
tokens = RDoc::RubyLex.tokenize "?\\", nil
expected = [
- @TK::TkSTRING.new( 0, 1, 0, "\\"),
- @TK::TkNL .new( 2, 1, 2, "\n"),
+ @TK::TkCHAR.new( 0, 1, 0, "?\\"),
+ @TK::TkNL .new( 2, 1, 2, "\n"),
]
assert_equal expected, tokens
@@ -162,6 +155,18 @@ Line 2
assert_equal expected, tokens
end
+ def test_class_tokenize_heredoc_missing_end
+ e = assert_raises RDoc::RubyLex::Error do
+ RDoc::RubyLex.tokenize <<-'RUBY', nil
+>> string1 = <<-TXT
+>" That's swell
+>" TXT
+ RUBY
+ end
+
+ assert_equal 'Missing terminating TXT for string', e.message
+ end
+
def test_class_tokenize_heredoc_percent_N
tokens = RDoc::RubyLex.tokenize <<-'RUBY', nil
a b <<-U
@@ -226,6 +231,17 @@ U
assert_equal expected, tokens
end
+ def test_class_tokenize_percent_w_quote
+ tokens = RDoc::RubyLex.tokenize '%w"hi"', nil
+
+ expected = [
+ @TK::TkDSTRING.new( 0, 1, 0, '%w"hi"'),
+ @TK::TkNL .new( 6, 1, 6, "\n"),
+ ]
+
+ assert_equal expected, tokens
+ end
+
def test_class_tokenize_regexp
tokens = RDoc::RubyLex.tokenize "/hay/", nil
@@ -237,6 +253,26 @@ U
assert_equal expected, tokens
end
+ def test_class_tokenize_regexp_options
+ tokens = RDoc::RubyLex.tokenize "/hAY/i", nil
+
+ expected = [
+ @TK::TkREGEXP.new( 0, 1, 0, "/hAY/i"),
+ @TK::TkNL .new( 6, 1, 6, "\n"),
+ ]
+
+ assert_equal expected, tokens
+
+ tokens = RDoc::RubyLex.tokenize "/hAY/ix", nil
+
+ expected = [
+ @TK::TkREGEXP.new( 0, 1, 0, "/hAY/ix"),
+ @TK::TkNL .new( 7, 1, 7, "\n"),
+ ]
+
+ assert_equal expected, tokens
+ end
+
def test_class_tokenize_regexp_backref
tokens = RDoc::RubyLex.tokenize "/[csh](..) [csh]\\1 in/", nil
@@ -270,6 +306,100 @@ U
assert_equal expected, tokens
end
+ def test_class_tokenize_string_escape
+ tokens = RDoc::RubyLex.tokenize '"\\n"', nil
+ assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\n\""), tokens.first
+
+ tokens = RDoc::RubyLex.tokenize '"\\r"', nil
+ assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\r\""), tokens.first
+
+ tokens = RDoc::RubyLex.tokenize '"\\f"', nil
+ assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\f\""), tokens.first
+
+ tokens = RDoc::RubyLex.tokenize '"\\\\"', nil
+ assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\\\\""), tokens.first
+
+ tokens = RDoc::RubyLex.tokenize '"\\t"', nil
+ assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\t\""), tokens.first
+
+ tokens = RDoc::RubyLex.tokenize '"\\v"', nil
+ assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\v\""), tokens.first
+
+ tokens = RDoc::RubyLex.tokenize '"\\a"', nil
+ assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\a\""), tokens.first
+
+ tokens = RDoc::RubyLex.tokenize '"\\e"', nil
+ assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\e\""), tokens.first
+
+ tokens = RDoc::RubyLex.tokenize '"\\b"', nil
+ assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\b\""), tokens.first
+
+ tokens = RDoc::RubyLex.tokenize '"\\s"', nil
+ assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\s\""), tokens.first
+
+ tokens = RDoc::RubyLex.tokenize '"\\d"', nil
+ assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\d\""), tokens.first
+
+ end
+
+ def test_class_tokenize_string_escape_control
+ tokens = RDoc::RubyLex.tokenize '"\\C-a"', nil
+ assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\C-a\""), tokens.first
+
+ tokens = RDoc::RubyLex.tokenize '"\\c\\a"', nil
+ assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\c\\a\""), tokens.first
+
+ tokens = RDoc::RubyLex.tokenize '"\\C-\\M-a"', nil
+ assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\C-\\M-a\""), tokens.first
+ end
+
+ def test_class_tokenize_string_escape_meta
+ tokens = RDoc::RubyLex.tokenize '"\\M-a"', nil
+ assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\M-a\""), tokens.first
+
+ tokens = RDoc::RubyLex.tokenize '"\\M-\\C-a"', nil
+ assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\M-\\C-a\""), tokens.first
+ end
+
+ def test_class_tokenize_string_escape_hexadecimal
+ tokens = RDoc::RubyLex.tokenize '"\\x0"', nil
+ assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\x0\""), tokens.first
+
+ tokens = RDoc::RubyLex.tokenize '"\\x00"', nil
+ assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\x00\""), tokens.first
+
+ tokens = RDoc::RubyLex.tokenize '"\\x000"', nil
+ assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\x000\""), tokens.first
+ end
+
+ def test_class_tokenize_string_escape_octal
+ tokens = RDoc::RubyLex.tokenize '"\\0"', nil
+ assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\0\""), tokens.first
+
+ tokens = RDoc::RubyLex.tokenize '"\\00"', nil
+ assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\00\""), tokens.first
+
+ tokens = RDoc::RubyLex.tokenize '"\\000"', nil
+ assert_equal @TK::TkSTRING.new( 0, 1, 0, "\"\\000\""), tokens.first
+ end
+
+ def test_class_tokenize_symbol
+ tokens = RDoc::RubyLex.tokenize 'scope module: :v1', nil
+
+ expected = [
+ @TK::TkIDENTIFIER.new( 0, 1, 0, 'scope'),
+ @TK::TkSPACE .new( 5, 1, 5, ' '),
+ @TK::TkIDENTIFIER.new( 6, 1, 6, 'module'),
+ @TK::TkCOLON .new(12, 1, 12, ':'),
+ @TK::TkSPACE .new(13, 1, 13, ' '),
+ @TK::TkSYMBEG .new(14, 1, 14, ':'),
+ @TK::TkIDENTIFIER.new(15, 1, 15, 'v1'),
+ @TK::TkNL .new(17, 1, 17, "\n"),
+ ]
+
+ assert_equal expected, tokens
+ end
+
def test_unary_minus
ruby_lex = RDoc::RubyLex.new("-1", nil)
assert_equal("-1", ruby_lex.token.value)
diff --git a/test/rdoc/test_rdoc_rubygems_hook.rb b/test/rdoc/test_rdoc_rubygems_hook.rb
index da9c3edd9f..960afc9ed4 100644
--- a/test/rdoc/test_rdoc_rubygems_hook.rb
+++ b/test/rdoc/test_rdoc_rubygems_hook.rb
@@ -10,7 +10,7 @@ class TestRDocRubygemsHook < Gem::TestCase
skip 'requires RubyGems 1.9+' unless
Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.9')
- @a = quick_spec 'a' do |s|
+ @a = util_spec 'a', 2 do |s|
s.rdoc_options = %w[--main MyTitle]
s.extra_rdoc_files = %w[README]
end
@@ -138,9 +138,6 @@ class TestRDocRubygemsHook < Gem::TestCase
@a.loaded_from =
File.join Gem::Specification.default_specifications_dir, 'a.gemspec'
- FileUtils.mkdir_p @a.doc_dir
- FileUtils.mkdir_p File.join(@a.gem_dir, 'lib')
-
@hook.generate
refute @hook.rdoc_installed?
diff --git a/test/rdoc/test_rdoc_servlet.rb b/test/rdoc/test_rdoc_servlet.rb
index 40de171b6b..143e2f225b 100644
--- a/test/rdoc/test_rdoc_servlet.rb
+++ b/test/rdoc/test_rdoc_servlet.rb
@@ -23,7 +23,9 @@ class TestRDocServlet < RDoc::TestCase
@stores = {}
@cache = Hash.new { |hash, store| hash[store] = {} }
- @s = RDoc::Servlet.new @server, @stores, @cache
+ @extra_dirs = [File.join(@tempdir, 'extra1'), File.join(@tempdir, 'extra2')]
+
+ @s = RDoc::Servlet.new @server, @stores, @cache, nil, @extra_dirs
@req = WEBrick::HTTPRequest.new :Logger => nil
@res = WEBrick::HTTPResponse.new :HTTPVersion => '1.0'
@@ -145,6 +147,16 @@ class TestRDocServlet < RDoc::TestCase
end
end
+ def do_GET_not_found
+ touch_system_cache_path
+
+ @req.path = "/#{@spec.full_name}"
+
+ @s.do_GET @req, @res
+
+ assert_equal 404, @res.status
+ end
+
def test_do_GET_not_modified
touch_system_cache_path
@req.header['if-modified-since'] = [(Time.now + 10).httpdate]
@@ -187,8 +199,8 @@ class TestRDocServlet < RDoc::TestCase
@s.documentation_page store, generator, 'Klass::Sub.html', @req, @res
- assert_match %r%<title>class Klass::Sub - </title>%, @res.body
- assert_match %r%<body id="top" class="class">%, @res.body
+ assert_match %r%<title>class Klass::Sub - </title>%, @res.body
+ assert_match %r%<body id="top" role="document" class="class">%, @res.body
end
def test_documentation_page_not_found
@@ -214,7 +226,7 @@ class TestRDocServlet < RDoc::TestCase
@s.documentation_page store, generator, 'README_rdoc.html', @req, @res
assert_match %r%<title>README - </title>%, @res.body
- assert_match %r%<body class="file">%, @res.body
+ assert_match %r%<body [^>]+ class="file">%, @res.body
end
def test_documentation_source
@@ -298,8 +310,13 @@ class TestRDocServlet < RDoc::TestCase
def test_installed_docs
touch_system_cache_path
+ touch_extra_cache_path
expected = [
+ ['My Extra Documentation', 'extra-1/', true, :extra,
+ @extra_dirs[0]],
+ ['Extra Documentation', 'extra-2/', false, :extra,
+ @extra_dirs[1]],
['Ruby Documentation', 'ruby/', true, :system,
@system_dir],
['Site Documentation', 'site/', false, :site,
@@ -325,10 +342,24 @@ class TestRDocServlet < RDoc::TestCase
assert_match %r%<kbd>/ruby/Missing\.html</kbd>%, @res.body
end
+ def test_not_found_message
+ generator = @s.generator_for RDoc::Store.new
+
+ @req.path = '/ruby/Missing.html'
+
+ @s.not_found generator, @req, @res, 'woo, this is a message'
+
+ assert_equal 404, @res.status
+ assert_match %r%<title>Not Found</title>%, @res.body
+ assert_match %r%woo, this is a message%, @res.body
+ end
+
def test_ri_paths
paths = @s.ri_paths
expected = [
+ [@extra_dirs[0], :extra],
+ [@extra_dirs[1], :extra],
[@system_dir, :system],
[File.join(@base, 'site'), :site],
[RDoc::RI::Paths::HOMEDIR, :home],
@@ -347,6 +378,7 @@ class TestRDocServlet < RDoc::TestCase
def test_root_search
touch_system_cache_path
+ touch_extra_cache_path
@s.root_search @req, @res
@@ -359,12 +391,16 @@ class TestRDocServlet < RDoc::TestCase
expected = {
'index' => {
'searchIndex' => %w[
+ My\ Extra\ Documentation
Ruby\ Documentation
],
'longSearchIndex' => %w[
+ My\ Extra\ Documentation
Ruby\ Documentation
],
'info' => [
+ ['My Extra Documentation', '', @extra_dirs[0], '',
+ 'My Extra Documentation'],
['Ruby Documentation', '', 'ruby', '',
'Documentation for the Ruby standard library'],
],
@@ -419,6 +455,10 @@ class TestRDocServlet < RDoc::TestCase
end
def test_store_for_gem
+ ri_dir = File.join @gem_doc_dir, 'spec-1.0', 'ri'
+ FileUtils.mkdir_p ri_dir
+ FileUtils.touch File.join ri_dir, 'cache.ri'
+
store = @s.store_for 'spec-1.0'
assert_equal File.join(@gem_doc_dir, 'spec-1.0', 'ri'), store.path
@@ -432,12 +472,24 @@ class TestRDocServlet < RDoc::TestCase
assert_equal :home, store.type
end
- def test_store_for_missing
- e = assert_raises RDoc::Error do
+ def test_store_for_missing_documentation
+ FileUtils.mkdir_p(File.join @gem_doc_dir, 'spec-1.0', 'ri')
+
+ e = assert_raises WEBrick::HTTPStatus::NotFound do
+ @s.store_for 'spec-1.0'
+ end
+
+ assert_equal 'Could not find documentation for "spec-1.0". Please run `gem rdoc --ri gem_name`',
+ e.message
+ end
+
+ def test_store_for_missing_gem
+ e = assert_raises WEBrick::HTTPStatus::NotFound do
@s.store_for 'missing'
end
- assert_equal 'could not find ri documentation for missing', e.message
+ assert_equal 'Could not find gem "missing". Are you sure you installed it?',
+ e.message
end
def test_store_for_ruby
@@ -454,6 +506,13 @@ class TestRDocServlet < RDoc::TestCase
assert_equal :site, store.type
end
+ def test_store_for_extra
+ store = @s.store_for 'extra-1'
+
+ assert_equal @extra_dirs.first, store.path
+ assert_equal :extra, store.type
+ end
+
def touch_system_cache_path
store = RDoc::Store.new @system_dir
store.title = 'Standard Library Documentation'
@@ -463,5 +522,14 @@ class TestRDocServlet < RDoc::TestCase
store.save
end
+ def touch_extra_cache_path
+ store = RDoc::Store.new @extra_dirs.first
+ store.title = 'My Extra Documentation'
+
+ FileUtils.mkdir_p File.dirname store.cache_path
+
+ store.save
+ end
+
end
diff --git a/test/rdoc/test_rdoc_stats.rb b/test/rdoc/test_rdoc_stats.rb
index 5073e53b7e..7d336bedc8 100644
--- a/test/rdoc/test_rdoc_stats.rb
+++ b/test/rdoc/test_rdoc_stats.rb
@@ -44,14 +44,17 @@ class TestRDocStats < RDoc::TestCase
report = @s.report
- expected = <<-EXPECTED
-The following items are not documented:
-
-class C # is documented
-
- attr_accessor :a # in file file.rb
-end
- EXPECTED
+ expected =
+ doc(
+ para('The following items are not documented:'),
+ blank_line,
+ verb(
+ "class C # is documented\n",
+ "\n",
+ " attr_accessor :a # in file file.rb\n",
+ "\n",
+ "end\n"),
+ blank_line)
assert_equal expected, report
end
@@ -84,7 +87,7 @@ end
@store.complete :public
- assert_match '# in file file.rb:3', @s.report
+ assert_match '# in file file.rb:3', @s.report.accept(to_rdoc)
end
def test_report_constant
@@ -100,15 +103,18 @@ end
report = @s.report
- expected = <<-EXPECTED
-The following items are not documented:
-
-module M # is documented
-
- # in file file.rb
- C = nil
-end
- EXPECTED
+ expected =
+ doc(
+ para('The following items are not documented:'),
+ blank_line,
+ verb(
+ "module M # is documented\n",
+ "\n",
+ " # in file file.rb\n",
+ " C = nil\n",
+ "\n",
+ "end\n"),
+ blank_line)
assert_equal expected, report
end
@@ -130,13 +136,13 @@ end
# TODO change this to refute match, aliases should be ignored as they are
# programmer convenience constructs
- assert_match(/class Object/, report)
+ assert_match 'class Object', report.accept(to_rdoc)
end
def test_report_constant_documented
m = @tl.add_module RDoc::NormalModule, 'M'
m.record_location @tl
- m.comment = 'M'
+ m.add_comment 'M', @tl
c = RDoc::Constant.new 'C', nil, 'C'
c.record_location @tl
@@ -161,7 +167,7 @@ end
@store.complete :public
- assert_match '# in file file.rb:5', @s.report
+ assert_match '# in file file.rb:5', @s.report.accept(to_rdoc)
end
def test_report_class
@@ -177,15 +183,16 @@ end
report = @s.report
- expected = <<-EXPECTED
-The following items are not documented:
-
-# in files:
-# file.rb
-
-class C
-end
- EXPECTED
+ expected =
+ doc(
+ para('The following items are not documented:'),
+ blank_line,
+ para('In files:'),
+ list(:BULLET, *[
+ item(nil, para('file.rb'))]),
+ blank_line,
+ verb("class C\n", "end\n"),
+ blank_line)
assert_equal expected, report
end
@@ -201,7 +208,7 @@ end
@store.complete :public
- refute_match %r%^class Object$%, @s.report
+ refute_match %r%^class Object$%, @s.report.accept(to_rdoc)
end
def test_report_class_documented
@@ -245,16 +252,16 @@ end
report = @s.report
- expected = <<-EXPECTED
-The following items are not documented:
-
-
-# in files:
-# file.rb
-
-class C2
-end
- EXPECTED
+ expected =
+ doc(
+ para('The following items are not documented:'),
+ blank_line,
+ para('In files:'),
+ list(:BULLET, *[
+ item(nil, para('file.rb'))]),
+ blank_line,
+ verb("class C2\n", "end\n"),
+ blank_line)
assert_equal expected, report
end
@@ -266,13 +273,13 @@ end
report = @s.report
- expected = <<-EXPECTED
-The following items are not documented:
-
-# class C is referenced but empty.
-#
-# It probably came from another project. I'm sorry I'm holding it against you.
- EXPECTED
+ expected =
+ doc(
+ para('The following items are not documented:'),
+ blank_line,
+ para('class C is referenced but empty.'),
+ para("It probably came from another project. I'm sorry I'm holding it against you."),
+ blank_line)
assert_equal expected, report
end
@@ -290,16 +297,16 @@ The following items are not documented:
@s.coverage_level = 1
report = @s.report
- expected = <<-EXPECTED
-The following items are not documented:
-
-# in files:
-# file.rb
-
-class C1
-end
-
- EXPECTED
+ expected =
+ doc(
+ para('The following items are not documented:'),
+ blank_line,
+ para('In files:'),
+ list(:BULLET, *[
+ item(nil, para('file.rb'))]),
+ blank_line,
+ verb("class C1\n", "end\n"),
+ blank_line)
assert_equal expected, report
end
@@ -317,15 +324,16 @@ end
report = @s.report
- expected = <<-EXPECTED
-The following items are not documented:
-
-# in files:
-# file.rb
-
-class C
-end
- EXPECTED
+ expected =
+ doc(
+ para('The following items are not documented:'),
+ blank_line,
+ para('In files:'),
+ list(:BULLET, *[
+ item(nil, para('file.rb'))]),
+ blank_line,
+ verb("class C\n", "end\n"),
+ blank_line)
assert_equal expected, report
end
@@ -367,16 +375,18 @@ end
report = @s.report
- expected = <<-EXPECTED
-The following items are not documented:
-
-class C # is documented
-
- # in file file.rb
- def m1; end
-
-end
- EXPECTED
+ expected =
+ doc(
+ para('The following items are not documented:'),
+ blank_line,
+ verb(*[
+ "class C # is documented\n",
+ "\n",
+ " # in file file.rb\n",
+ " def m1; end\n",
+ "\n",
+ "end\n"]),
+ blank_line)
assert_equal expected, report
end
@@ -401,16 +411,18 @@ end
report = @s.report
- expected = <<-EXPECTED
-The following items are not documented:
-
-class C # is documented
-
- # in file file.rb
- def self.m1; end
-
-end
- EXPECTED
+ expected =
+ doc(
+ para('The following items are not documented:'),
+ blank_line,
+ verb(*[
+ "class C # is documented\n",
+ "\n",
+ " # in file file.rb\n",
+ " def self.m1; end\n",
+ "\n",
+ "end\n"]),
+ blank_line)
assert_equal expected, report
end
@@ -444,7 +456,7 @@ end
@store.complete :public
- assert_match '# in file file.rb:4', @s.report
+ assert_match '# in file file.rb:4', @s.report.accept(to_rdoc)
end
def test_report_method_parameters
@@ -468,17 +480,19 @@ end
@s.coverage_level = 1
report = @s.report
- expected = <<-EXPECTED
-The following items are not documented:
-
-class C # is documented
-
- # in file file.rb
- # +p2+ is not documented
- def m1(p1, p2); end
-
-end
- EXPECTED
+ expected =
+ doc(
+ para('The following items are not documented:'),
+ blank_line,
+ verb(*[
+ "class C # is documented\n",
+ "\n",
+ " # in file file.rb\n",
+ " # +p2+ is not documented\n",
+ " def m1(p1, p2); end\n",
+ "\n",
+ "end\n"]),
+ blank_line)
assert_equal expected, report
end
@@ -522,17 +536,19 @@ m(a, b) { |c, d| ... }
@s.coverage_level = 1
report = @s.report
- expected = <<-EXPECTED
-The following items are not documented:
-
-class C # is documented
-
- # in file file.rb
- # +b+, +d+ is not documented
- def m; end
-
-end
- EXPECTED
+ expected =
+ doc(
+ para('The following items are not documented:'),
+ blank_line,
+ verb(
+ "class C # is documented\n",
+ "\n",
+ " # in file file.rb\n",
+ " # +b+, +d+ is not documented\n",
+ " def m; end\n",
+ "\n",
+ "end\n"),
+ blank_line)
assert_equal expected, report
end
@@ -558,20 +574,20 @@ end
@store.complete :public
- summary = @s.summary
- summary.sub!(/Elapsed:.*/, '')
+ summary = @s.summary.accept to_rdoc
+ summary.sub!(/ Elapsed:.*/m, '')
expected = <<-EXPECTED
-Files: 0
+ Files: 0
-Classes: 1 (1 undocumented)
-Modules: 1 (1 undocumented)
-Constants: 1 (1 undocumented)
-Attributes: 1 (1 undocumented)
-Methods: 1 (1 undocumented)
+ Classes: 1 (1 undocumented)
+ Modules: 1 (1 undocumented)
+ Constants: 1 (1 undocumented)
+ Attributes: 1 (1 undocumented)
+ Methods: 1 (1 undocumented)
-Total: 5 (5 undocumented)
- 0.00% documented
+ Total: 5 (5 undocumented)
+ 0.00% documented
EXPECTED
@@ -586,20 +602,20 @@ Total: 5 (5 undocumented)
@s.coverage_level = false
- summary = @s.summary
- summary.sub!(/Elapsed:.*/, '')
+ summary = @s.summary.accept to_rdoc
+ summary.sub!(/ Elapsed:.*/m, '')
expected = <<-EXPECTED
-Files: 0
+ Files: 0
-Classes: 1 (1 undocumented)
-Modules: 0 (0 undocumented)
-Constants: 0 (0 undocumented)
-Attributes: 0 (0 undocumented)
-Methods: 0 (0 undocumented)
+ Classes: 1 (1 undocumented)
+ Modules: 0 (0 undocumented)
+ Constants: 0 (0 undocumented)
+ Attributes: 0 (0 undocumented)
+ Methods: 0 (0 undocumented)
-Total: 1 (1 undocumented)
- 0.00% documented
+ Total: 1 (1 undocumented)
+ 0.00% documented
EXPECTED
@@ -622,26 +638,30 @@ Total: 1 (1 undocumented)
@s.coverage_level = 1
@s.report
- summary = @s.summary
- summary.sub!(/Elapsed:.*/, '')
+ summary = @s.summary.accept to_rdoc
+ summary.sub!(/ Elapsed:.*/m, '')
expected = <<-EXPECTED
-Files: 0
+ Files: 0
-Classes: 1 (0 undocumented)
-Modules: 0 (0 undocumented)
-Constants: 0 (0 undocumented)
-Attributes: 0 (0 undocumented)
-Methods: 1 (0 undocumented)
-Parameters: 2 (1 undocumented)
+ Classes: 1 (0 undocumented)
+ Modules: 0 (0 undocumented)
+ Constants: 0 (0 undocumented)
+ Attributes: 0 (0 undocumented)
+ Methods: 1 (0 undocumented)
+ Parameters: 2 (1 undocumented)
-Total: 4 (1 undocumented)
- 75.00% documented
+ Total: 4 (1 undocumented)
+ 75.00% documented
EXPECTED
assert_equal summary, expected
end
+ def to_rdoc
+ RDoc::Markup::ToRdoc.new
+ end
+
end
diff --git a/test/rdoc/test_rdoc_store.rb b/test/rdoc/test_rdoc_store.rb
index 3b92707987..bd565e7149 100644
--- a/test/rdoc/test_rdoc_store.rb
+++ b/test/rdoc/test_rdoc_store.rb
@@ -9,6 +9,7 @@ class TestRDocStore < XrefTestCase
@tmpdir = File.join Dir.tmpdir, "test_rdoc_ri_store_#{$$}"
@s = RDoc::RI::Store.new @tmpdir
+ @s.rdoc = @rdoc
@top_level = @s.add_file 'file.rb'
@@ -71,13 +72,6 @@ class TestRDocStore < XrefTestCase
FileUtils.rm_rf @tmpdir
end
- def mu_pp obj
- s = ''
- s = PP.pp obj, s
- s.force_encoding Encoding.default_external if defined? Encoding
- s.chomp
- end
-
def assert_cache imethods, cmethods, attrs, modules,
ancestors = {}, pages = [], main = nil, title = nil
imethods ||= { 'Object' => %w[method method! method_bang] }
@@ -106,18 +100,6 @@ class TestRDocStore < XrefTestCase
assert_equal expected, @s.cache
end
- def assert_directory path
- assert File.directory?(path), "#{path} is not a directory"
- end
-
- def assert_file path
- assert File.file?(path), "#{path} is not a file"
- end
-
- def refute_file path
- refute File.exist?(path), "#{path} exists"
- end
-
def test_add_c_enclosure
@s.add_c_enclosure 'cC1', @c1
@@ -249,6 +231,16 @@ class TestRDocStore < XrefTestCase
refute_empty a1.aliases
end
+ def test_complete_nodoc
+ c_nodoc = @top_level.add_class RDoc::NormalClass, 'Nodoc'
+ c_nodoc.record_location @top_level
+ c_nodoc.document_self = nil
+
+ @s.complete :nodoc
+
+ assert_includes @s.classes_hash.keys, 'Nodoc'
+ end
+
def test_find_c_enclosure
assert_nil @s.find_c_enclosure 'cC1'
diff --git a/test/rdoc/test_rdoc_task.rb b/test/rdoc/test_rdoc_task.rb
index 8faf3f7d92..43d458981d 100644
--- a/test/rdoc/test_rdoc_task.rb
+++ b/test/rdoc/test_rdoc_task.rb
@@ -46,6 +46,7 @@ class TestRDocTask < RDoc::TestCase
assert Rake::Task[:rdoc]
assert Rake::Task[:clobber_rdoc]
assert Rake::Task[:rerdoc]
+ assert_equal ["html/created.rid"], Rake::Task[:rdoc].prerequisites
end
def test_tasks_creation_with_custom_name_symbol
@@ -56,6 +57,23 @@ class TestRDocTask < RDoc::TestCase
assert_equal :rdoc_dev, rd.name
end
+ def test_tasks_option_parser
+ rdoc_task = RDoc::Task.new do |rd|
+ rd.title = "Test Tasks Option Parser"
+ rd.main = "README.md"
+ rd.rdoc_files.include("README.md")
+ rd.options << "--all"
+ end
+
+ assert rdoc_task.title, "Test Tasks Option Parser"
+ assert rdoc_task.main, "README.md"
+ assert rdoc_task.rdoc_files.include?("README.md")
+ assert rdoc_task.options.include?("--all")
+
+ args = %w[--all -o html --main README.md] << "--title" << "Test Tasks Option Parser" << "README.md"
+ assert_equal args, rdoc_task.option_list + rdoc_task.rdoc_files
+ end
+
def test_generator_option
rdoc_task = RDoc::Task.new do |rd|
rd.generator = "ri"
@@ -64,6 +82,22 @@ class TestRDocTask < RDoc::TestCase
assert_equal %w[-o html -f ri], rdoc_task.option_list
end
+ def test_main_option
+ rdoc_task = RDoc::Task.new do |rd|
+ rd.main = "README.md"
+ end
+
+ assert_equal %w[-o html --main README.md], rdoc_task.option_list
+ end
+
+ def test_output_dir_option
+ rdoc_task = RDoc::Task.new do |rd|
+ rd.rdoc_dir = "zomg"
+ end
+
+ assert_equal %w[-o zomg], rdoc_task.option_list
+ end
+
def test_rdoc_task_description
assert_equal 'Build RDoc HTML files', @t.rdoc_task_description
end
@@ -116,5 +150,21 @@ class TestRDocTask < RDoc::TestCase
end
end
+ def test_template_option
+ rdoc_task = RDoc::Task.new do |rd|
+ rd.template = "foo"
+ end
+
+ assert_equal %w[-o html -T foo], rdoc_task.option_list
+ end
+
+ def test_title_option
+ rdoc_task = RDoc::Task.new do |rd|
+ rd.title = "Test Title Option"
+ end
+
+ assert_equal %w[-o html] << "--title" << "Test Title Option", rdoc_task.option_list
+ end
+
end
diff --git a/test/rdoc/test_rdoc_text.rb b/test/rdoc/test_rdoc_text.rb
index 473bd3cadd..b0c464a659 100644
--- a/test/rdoc/test_rdoc_text.rb
+++ b/test/rdoc/test_rdoc_text.rb
@@ -14,13 +14,6 @@ class TestRDocText < RDoc::TestCase
@top_level = @store.add_file 'file.rb'
end
- def mu_pp obj
- s = ''
- s = PP.pp obj, s
- s = s.force_encoding Encoding.default_external if defined? Encoding
- s.chomp
- end
-
def test_self_encode_fallback
skip "Encoding not implemented" unless Object.const_defined? :Encoding
@@ -261,42 +254,31 @@ Examples
assert_equal RDoc::Markup::Document.new, parse("\n")
end
-# def test_snippet
-# text = <<-TEXT
-#This is one-hundred characters or more of text in a single paragraph. This
-#paragraph will be cut off some point after the one-hundredth character.
-# TEXT
-#
-# expected = text.gsub(/\r?\n/, ' ').sub(/ some point.*/, '')
-#
-# assert_equal expected, snippet(text)
-# end
-#
-# def test_snippet_comment
-# c = comment 'This is a comment'
-#
-# assert_equal 'This is a comment', snippet(c)
-# end
-#
-# def test_snippet_no_space
-# text = <<-TEXT.strip
-#This is one-hundred characters or more of text in a single paragraph. This
-#paragraph will not be cut
-# TEXT
-#
-# expected = <<-EXPECTED.strip.gsub(/\r?\n/, ' ')
-#This is one-hundred characters or more of text in a single paragraph. This
-#paragraph will not be cut
-# EXPECTED
-#
-# assert_equal expected, snippet(text)
-# end
-#
-# def test_snippet_short
-# text = 'This is a comment'
-#
-# assert_equal text.dup, snippet(text)
-# end
+ def test_snippet
+ text = <<-TEXT
+This is one-hundred characters or more of text in a single paragraph. This
+paragraph will be cut off some point after the one-hundredth character.
+ TEXT
+
+ expected = <<-EXPECTED
+<p>This is one-hundred characters or more of text in a single paragraph. This
+paragraph will be cut off …
+ EXPECTED
+
+ assert_equal expected, snippet(text)
+ end
+
+ def test_snippet_comment
+ c = comment 'This is a comment'
+
+ assert_equal "<p>This is a comment\n", snippet(c)
+ end
+
+ def test_snippet_short
+ text = 'This is a comment'
+
+ assert_equal "<p>#{text}\n", snippet(text)
+ end
def test_strip_hashes
text = <<-TEXT
@@ -560,9 +542,13 @@ The comments associated with
assert_equal "mismatched <tt> tag\n", err
end
- def formatter()
+ def formatter
RDoc::Markup::ToHtml.new @options
end
+ def options
+ @options
+ end
+
end
diff --git a/test/rdoc/test_rdoc_tom_doc.rb b/test/rdoc/test_rdoc_tom_doc.rb
index b22411f89f..63d3a5e79e 100644
--- a/test/rdoc/test_rdoc_tom_doc.rb
+++ b/test/rdoc/test_rdoc_tom_doc.rb
@@ -11,13 +11,6 @@ class TestRDocTomDoc < RDoc::TestCase
@td = @TD.new
end
- def mu_pp obj
- s = ''
- s = PP.pp obj, s
- s = s.force_encoding Encoding.default_external if defined? Encoding
- s.chomp
- end
-
def test_class_add_post_processor
RDoc::TomDoc.add_post_processor
@@ -135,6 +128,17 @@ here - something
assert_equal expected, @TD.parse(text)
end
+ def test_parse_multiline_paragraph
+ text = "Public: Do some stuff\n"
+ text << "On a new line\n"
+
+ expected =
+ doc(
+ para('Do some stuff', ' ', 'On a new line'))
+
+ assert_equal expected, @TD.parse(text)
+ end
+
def test_parse_arguments
text = <<-TEXT
Create new Arg object.
@@ -188,7 +192,7 @@ foo - A comment goes here
blank_line,
list(:NOTE,
item(%w[foo],
- para('A comment goes here', 'and is more than one line'))))
+ para('A comment goes here', ' ', 'and is more than one line'))))
assert_equal expected, @TD.parse(text)
end
@@ -279,13 +283,19 @@ Signature
Do some stuff
Returns a thing
+
+Returns another thing
TEXT
expected =
- @RM::Document.new(
- @RM::Paragraph.new('Do some stuff'),
- @RM::BlankLine.new,
- @RM::Paragraph.new('Returns a thing'))
+ doc(
+ para('Do some stuff'),
+ blank_line,
+ head(3, 'Returns'),
+ blank_line,
+ para('Returns a thing'),
+ blank_line,
+ para('Returns another thing'))
assert_equal expected, @TD.parse(text)
end
@@ -299,10 +309,12 @@ Returns a thing
TEXT
expected =
- @RM::Document.new(
- @RM::Paragraph.new('Do some stuff'),
- @RM::BlankLine.new,
- @RM::Paragraph.new('Returns a thing', 'that is multiline'))
+ doc(
+ para('Do some stuff'),
+ blank_line,
+ head(3, 'Returns'),
+ blank_line,
+ para('Returns a thing', ' ', 'that is multiline'))
assert_equal expected, @TD.parse(text)
end
@@ -338,6 +350,22 @@ Signature
assert_equal expected, @td.tokens
end
+ def test_tokenize_multiline_paragraph
+ text = "Public: Do some stuff\n"
+ text << "On a new line\n"
+
+ @td.tokenize text
+
+ expected = [
+ [:TEXT, "Do some stuff", 0, 0],
+ [:NEWLINE, "\n", 13, 0],
+ [:TEXT, "On a new line", 0, 1],
+ [:NEWLINE, "\n", 13, 1]
+ ]
+
+ assert_equal expected, @td.tokens
+ end
+
def test_tokenize_arguments
@td.tokenize <<-TEXT
Create new Arg object.
diff --git a/test/rdoc/xref_test_case.rb b/test/rdoc/xref_test_case.rb
index 29021a301c..a56fa71268 100644
--- a/test/rdoc/xref_test_case.rb
+++ b/test/rdoc/xref_test_case.rb
@@ -11,6 +11,8 @@ class XrefTestCase < RDoc::TestCase
@options = RDoc::Options.new
@options.quiet = true
+ @rdoc.options = @options
+
@file_name = 'xref_data.rb'
@xref_data = @store.add_file @file_name
@top_level = @xref_data
diff --git a/test/readline/test_readline.rb b/test/readline/test_readline.rb
index 84cfcf2ae3..ed71e00285 100644
--- a/test/readline/test_readline.rb
+++ b/test/readline/test_readline.rb
@@ -4,6 +4,7 @@ rescue LoadError
else
require "test/unit"
require "tempfile"
+ require "timeout"
end
class TestReadline < Test::Unit::TestCase
@@ -16,55 +17,13 @@ class TestReadline < Test::Unit::TestCase
def teardown
ENV[INPUTRC] = @inputrc
Readline.instance_variable_set("@completion_proc", nil)
- end
-
- def test_safe_level_4
- method_args =
- [
- ["readline"],
- ["input=", $stdin],
- ["output=", $stdout],
- ["completion_proc=", proc {}],
- ["completion_proc"],
- ["completion_case_fold=", true],
- ["completion_case_fold"],
- ["vi_editing_mode"],
- ["vi_editing_mode?"],
- ["emacs_editing_mode"],
- ["emacs_editing_mode?"],
- ["completion_append_character=", "s"],
- ["completion_append_character"],
- ["basic_word_break_characters=", "s"],
- ["basic_word_break_characters"],
- ["completer_word_break_characters=", "s"],
- ["completer_word_break_characters"],
- ["basic_quote_characters=", "\\"],
- ["basic_quote_characters"],
- ["completer_quote_characters=", "\\"],
- ["completer_quote_characters"],
- ["filename_quote_characters=", "\\"],
- ["filename_quote_characters"],
- ["line_buffer"],
- ["point"],
- ["set_screen_size", 1, 1],
- ["get_screen_size"],
- ["pre_input_hook=", proc {}],
- ["pre_input_hook"],
- ["insert_text", ""],
- ["redisplay"],
- ["special_prefixes=", "$"],
- ["special_prefixes"],
- ]
- method_args.each do |method_name, *args|
- assert_raise(SecurityError, NotImplementedError,
- "method=<#{method_name}>") do
- Thread.start {
- $SAFE = 4
- Readline.send(method_name.to_sym, *args)
- assert(true)
- }.join
- end
+ begin
+ Readline.delete_text
+ Readline.point = 0
+ rescue NotImplementedError
end
+ Readline.input = nil
+ Readline.output = nil
end
if !/EditLine/n.match(Readline::VERSION)
@@ -72,13 +31,13 @@ class TestReadline < Test::Unit::TestCase
with_temp_stdio do |stdin, stdout|
stdin.write("hello\n")
stdin.close
- stdout.close
+ stdout.flush
line = replace_stdio(stdin.path, stdout.path) {
Readline.readline("> ", true)
}
assert_equal("hello", line)
assert_equal(true, line.tainted?)
- stdout.open
+ stdout.rewind
assert_equal("> ", stdout.read(2))
assert_equal(1, Readline::HISTORY.length)
assert_equal("hello", Readline::HISTORY[0])
@@ -90,12 +49,6 @@ class TestReadline < Test::Unit::TestCase
end
}.join
end
- assert_raise(SecurityError) do
- Thread.start {
- $SAFE = 4
- replace_stdio(stdin.path, stdout.path) { Readline.readline("> ") }
- }.join
- end
end
end
@@ -118,8 +71,8 @@ class TestReadline < Test::Unit::TestCase
actual_point = Readline.point
actual_line_buffer = Readline.line_buffer
stdin.write(" finish\n")
- stdin.close
- stdout.close
+ stdin.flush
+ stdout.flush
return ["complete"]
}
@@ -137,8 +90,8 @@ class TestReadline < Test::Unit::TestCase
assert_equal(true, Readline.line_buffer.tainted?)
assert_equal(22, Readline.point)
- stdin.open
- stdout.open
+ stdin.rewind
+ stdout.rewind
stdin.write("first second\t")
stdin.flush
@@ -291,7 +244,10 @@ class TestReadline < Test::Unit::TestCase
else
results = %W"\xa1\xa1 \xa1\xa2".map {|s| s.force_encoding(locale)}
end or
+ begin
+ return if assert_under_utf8
skip("missing test for locale #{locale.name}")
+ end
expected = results[0][0...1]
Readline.completion_case_fold = false
assert_equal(expected, with_pipe {|r, w| w << "\t"}, bug5941)
@@ -362,43 +318,91 @@ class TestReadline < Test::Unit::TestCase
end
end
+ def test_point
+ assert_equal(0, Readline.point)
+ Readline.insert_text('12345')
+ assert_equal(5, Readline.point)
+
+ assert_equal(4, Readline.point=(4))
+
+ Readline.insert_text('abc')
+ assert_equal(7, Readline.point)
+
+ assert_equal('1234abc5', Readline.line_buffer)
+ rescue NotImplementedError
+ end if !/EditLine/n.match(Readline::VERSION)
+
def test_insert_text
- begin
- str = "test_insert_text"
- assert_equal(Readline, Readline.insert_text(str))
- assert_equal(str, Readline.line_buffer)
- assert_equal(get_default_internal_encoding,
- Readline.line_buffer.encoding)
- rescue NotImplementedError
- end
+ str = "test_insert_text"
+ assert_equal(0, Readline.point)
+ assert_equal(Readline, Readline.insert_text(str))
+ assert_equal(str, Readline.line_buffer)
+ assert_equal(16, Readline.point)
+ assert_equal(get_default_internal_encoding,
+ Readline.line_buffer.encoding)
+
+ Readline.delete_text(1, 3)
+ assert_equal("t_insert_text", Readline.line_buffer)
+ Readline.delete_text(11)
+ assert_equal("t_insert_te", Readline.line_buffer)
+ Readline.delete_text(-3...-1)
+ assert_equal("t_inserte", Readline.line_buffer)
+ Readline.delete_text(-3..-1)
+ assert_equal("t_inse", Readline.line_buffer)
+ Readline.delete_text(3..-3)
+ assert_equal("t_ise", Readline.line_buffer)
+ Readline.delete_text(3, 1)
+ assert_equal("t_ie", Readline.line_buffer)
+ Readline.delete_text(1..1)
+ assert_equal("tie", Readline.line_buffer)
+ Readline.delete_text(1...2)
+ assert_equal("te", Readline.line_buffer)
+ Readline.delete_text
+ assert_equal("", Readline.line_buffer)
+ rescue NotImplementedError
+ end if !/EditLine/n.match(Readline::VERSION)
+
+ def test_delete_text
+ str = "test_insert_text"
+ assert_equal(0, Readline.point)
+ assert_equal(Readline, Readline.insert_text(str))
+ assert_equal(16, Readline.point)
+ assert_equal(str, Readline.line_buffer)
+ Readline.delete_text
+
+ # NOTE: unexpected but GNU Readline's spec
+ assert_equal(16, Readline.point)
+ assert_equal("", Readline.line_buffer)
+ assert_equal(Readline, Readline.insert_text(str))
+ assert_equal(32, Readline.point)
+ assert_equal("", Readline.line_buffer)
+ rescue NotImplementedError
end if !/EditLine/n.match(Readline::VERSION)
def test_modify_text_in_pre_input_hook
- begin
- stdin = Tempfile.new("readline_redisplay_stdin")
- stdout = Tempfile.new("readline_redisplay_stdout")
- stdin.write("world\n")
- stdin.close
- Readline.pre_input_hook = proc do
- assert_equal("", Readline.line_buffer)
- Readline.insert_text("hello ")
- Readline.redisplay
- end
- replace_stdio(stdin.path, stdout.path) do
- line = Readline.readline("> ")
- assert_equal("hello world", line)
- end
- assert_equal("> hello world\n", stdout.read)
- stdout.close
- rescue NotImplementedError
- ensure
+ with_temp_stdio {|stdin, stdout|
begin
- Readline.pre_input_hook = nil
+ stdin.write("world\n")
+ stdin.close
+ Readline.pre_input_hook = proc do
+ assert_equal("", Readline.line_buffer)
+ Readline.insert_text("hello ")
+ Readline.redisplay
+ end
+ replace_stdio(stdin.path, stdout.path) do
+ line = Readline.readline("> ")
+ assert_equal("hello world", line)
+ end
+ assert_equal("> hello world\n", stdout.read)
+ stdout.close
rescue NotImplementedError
+ ensure
+ begin
+ Readline.pre_input_hook = nil
+ rescue NotImplementedError
+ end
end
- stdin.close(true)
- stdout.close(true)
- end
+ }
end if !/EditLine|\A4\.3\z/n.match(Readline::VERSION)
def test_input_metachar
@@ -412,12 +416,15 @@ class TestReadline < Test::Unit::TestCase
assert_equal("hello", line, bug6601)
ensure
wo.close
- with_pipe {|r, w| w.write("\C-a\C-k\n")} # clear line_buffer
+ Readline.delete_text
Readline::HISTORY.clear
end if !/EditLine/n.match(Readline::VERSION)
def test_input_metachar_multibyte
- skip 'this test needs UTF-8 locale' unless Encoding.find("locale") == Encoding::UTF_8
+ unless Encoding.find("locale") == Encoding::UTF_8
+ return if assert_under_utf8
+ skip 'this test needs UTF-8 locale'
+ end
bug6602 = '[ruby-core:45683]'
Readline::HISTORY << "\u3042\u3093"
Readline::HISTORY << "\u3044\u3093"
@@ -430,12 +437,14 @@ class TestReadline < Test::Unit::TestCase
w << "\cr\u3042\u3093"
w.reopen(IO::NULL)
assert_equal("\u3046\u3093", Readline.readline("", true), bug6602)
- assert_equal("\u3042\u3093", Readline.readline("", true), bug6602)
+ Timeout.timeout(2) do
+ assert_equal("\u3042\u3093", Readline.readline("", true), bug6602)
+ end
assert_equal(nil, Readline.readline("", true), bug6602)
end
end
ensure
- with_pipe {|r, w| w.write("\C-a\C-k\n")} # clear line_buffer
+ Readline.delete_text
Readline::HISTORY.clear
end if !/EditLine/n.match(Readline::VERSION)
@@ -460,18 +469,18 @@ class TestReadline < Test::Unit::TestCase
STDOUT.reopen(orig_stdout)
orig_stdin.close
orig_stdout.close
+ orig_stderr.close
end
}
}
end
def with_temp_stdio
- stdin = Tempfile.new("test_readline_stdin")
- stdout = Tempfile.new("test_readline_stdout")
- yield stdin, stdout
- ensure
- stdin.close(true) if stdin
- stdout.close(true) if stdout
+ Tempfile.create("test_readline_stdin") {|stdin|
+ Tempfile.create("test_readline_stdout") {|stdout|
+ yield stdin, stdout
+ }
+ }
end
def with_pipe
@@ -496,4 +505,15 @@ class TestReadline < Test::Unit::TestCase
def get_default_internal_encoding
return Encoding.default_internal || Encoding.find("locale")
end
+
+ def assert_under_utf8
+ return false if ENV['LC_ALL'] == 'UTF-8'
+ loc = caller_locations(1, 1)[0].base_label.to_s
+ require_relative "../ruby/envutil"
+ assert_separately([{"LC_ALL"=>"UTF-8"}, "-r", __FILE__], <<SRC)
+#skip "test \#{ENV['LC_ALL']}"
+#{self.class.name}.new(#{loc.dump}).run(Test::Unit::Runner.new)
+SRC
+ return true
+ end
end if defined?(::Readline)
diff --git a/test/readline/test_readline_history.rb b/test/readline/test_readline_history.rb
index e21d170cc3..4bcd7b3b25 100644
--- a/test/readline/test_readline_history.rb
+++ b/test/readline/test_readline_history.rb
@@ -39,41 +39,6 @@ class Readline::TestHistory < Test::Unit::TestCase
HISTORY.clear
end
- def test_safe_level_4
- method_args =
- [
- ["[]", [0]],
- ["[]=", [0, "s"]],
- ["\<\<", ["s"]],
- ["push", ["s"]],
- ["pop", []],
- ["shift", []],
- ["length", []],
- ["delete_at", [0]],
- ["clear", []],
- ]
- method_args.each do |method_name, args|
- assert_raise(SecurityError, NotImplementedError,
- "method=<#{method_name}>") do
- Thread.start {
- $SAFE = 4
- HISTORY.send(method_name.to_sym, *args)
- assert(true)
- }.join
- end
- end
-
- assert_raise(SecurityError, NotImplementedError,
- "method=<each>") do
- Thread.start {
- $SAFE = 4
- HISTORY.each { |s|
- assert(true)
- }
- }.join
- end
- end
-
def test_to_s
expected = "HISTORY"
assert_equal(expected, HISTORY.to_s)
diff --git a/test/resolv/test_addr.rb b/test/resolv/test_addr.rb
index 84bc8c2d3b..e06c3c2a4c 100644
--- a/test/resolv/test_addr.rb
+++ b/test/resolv/test_addr.rb
@@ -1,6 +1,7 @@
require 'test/unit'
require 'resolv'
require 'socket'
+require 'tempfile'
class TestResolvAddr < Test::Unit::TestCase
def test_invalid_ipv4_address
@@ -13,4 +14,16 @@ class TestResolvAddr < Test::Unit::TestCase
end
}
end
+
+ def test_invalid_byte_comment
+ bug9273 = '[ruby-core:59239] [Bug #9273]'
+ Tempfile.create('resolv_test_addr_') do |tmpfile|
+ tmpfile.print("\xff\x00\x40")
+ tmpfile.close
+ hosts = Resolv::Hosts.new(tmpfile.path)
+ assert_nothing_raised(ArgumentError, bug9273) do
+ hosts.each_address("") {break}
+ end
+ end
+ end
end
diff --git a/test/resolv/test_dns.rb b/test/resolv/test_dns.rb
index 0d9565ef68..94a248e5fe 100644
--- a/test/resolv/test_dns.rb
+++ b/test/resolv/test_dns.rb
@@ -1,6 +1,7 @@
require 'test/unit'
require 'resolv'
require 'socket'
+require 'tempfile'
class TestResolvDNS < Test::Unit::TestCase
def setup
@@ -37,7 +38,7 @@ class TestResolvDNS < Test::Unit::TestCase
dns.getresources("foo.example.org", Resolv::DNS::Resource::IN::A)
}
}
- msg, (af, client_port, _, client_address) = u.recvfrom(4096)
+ msg, (_, client_port, _, client_address) = u.recvfrom(4096)
id, word2, qdcount, ancount, nscount, arcount = msg.unpack("nnnnnn")
qr = (word2 & 0x8000) >> 15
opcode = (word2 & 0x7800) >> 11
@@ -64,7 +65,7 @@ class TestResolvDNS < Test::Unit::TestCase
assert_operator(rest, :start_with?, name)
rest = rest[name.length..-1]
assert_equal(4, rest.length)
- qtype, qclass = rest.unpack("nn")
+ qtype, _ = rest.unpack("nn")
assert_equal(1, qtype) # A
assert_equal(1, qtype) # IN
id = id
@@ -150,4 +151,14 @@ class TestResolvDNS < Test::Unit::TestCase
}
end
+ def test_invalid_byte_comment
+ bug9273 = '[ruby-core:59239] [Bug #9273]'
+ Tempfile.create('resolv_test_dns_') do |tmpfile|
+ tmpfile.print("\xff\x00\x40")
+ tmpfile.close
+ assert_nothing_raised(ArgumentError, bug9273) do
+ Resolv::DNS::Config.parse_resolv_conf(tmpfile.path)
+ end
+ end
+ end
end
diff --git a/test/rexml/data/tutorial.xml b/test/rexml/data/tutorial.xml
index 43784d2f02..bf5783d09a 100644
--- a/test/rexml/data/tutorial.xml
+++ b/test/rexml/data/tutorial.xml
@@ -628,7 +628,7 @@ parser.parse</example>
attributes, text) root_node.find_first_recursive {|node| node.name ==
tag and attributes.all? {|attr, val| node.attributes[attr] == val} and
text === node.text } end # # Extract specific columns (specified by
- the position of it's corrensponding # header column) from a table. # #
+ the position of it's corresponding # header column) from a table. # #
Given the following table: # # &lt;table&gt; # &lt;tr&gt; #
&lt;td&gt;A&lt;/td&gt; # &lt;td&gt;B&lt;/td&gt; #
&lt;td&gt;C&lt;/td&gt; # &lt;/tr&gt; # &lt;tr&gt; #
diff --git a/test/rexml/listener.rb b/test/rexml/listener.rb
index a89205fe5d..81c9e8822c 100644
--- a/test/rexml/listener.rb
+++ b/test/rexml/listener.rb
@@ -1,50 +1,50 @@
class Listener
- attr_reader :ts, :te
- attr_reader :normalize
- def initialize
- @ts = false
- @te = false
- end
- def tag_start name, attrs
- @ts = true if name=="subsection" and attrs["title"]=="Namespaces"
- end
- def tag_end name
- @te = true if name=="documentation"
- end
- def text text
- @normalize = text
- #text.tr! "\n", ' '
- #puts "text #{text[0..10]}..."
- end
- def instruction name, instruction
- #puts "instruction"
- end
- def comment comment
- #puts "comment #{comment[0..10]}..."
- end
- def doctype name, pub_sys, long_name, uri
- #puts "doctype #{name}"
- end
- def attlistdecl content
- #puts "attlistdecl"
- end
- def elementdecl content
- #puts "elementdecl"
- end
- def entitydecl content
- #puts "entitydecl"
- end
- def notationdecl content
- #puts "notationdecl"
- end
- def entity content
- #puts "entity"
- end
- def cdata content
- #puts "cdata"
- end
- def xmldecl version, encoding, standalone
- #puts "xmldecl #{version}"
- end
+ attr_reader :ts, :te
+ attr_reader :normalize
+ def initialize
+ @ts = false
+ @te = false
+ end
+ def tag_start name, attrs
+ @ts = true if name=="subsection" and attrs["title"]=="Namespaces"
+ end
+ def tag_end name
+ @te = true if name=="documentation"
+ end
+ def text text
+ @normalize = text
+ #text.tr! "\n", ' '
+ #puts "text #{text[0..10]}..."
+ end
+ def instruction name, instruction
+ #puts "instruction"
+ end
+ def comment comment
+ #puts "comment #{comment[0..10]}..."
+ end
+ def doctype name, pub_sys, long_name, uri
+ #puts "doctype #{name}"
+ end
+ def attlistdecl content
+ #puts "attlistdecl"
+ end
+ def elementdecl content
+ #puts "elementdecl"
+ end
+ def entitydecl content
+ #puts "entitydecl"
+ end
+ def notationdecl content
+ #puts "notationdecl"
+ end
+ def entity content
+ #puts "entity"
+ end
+ def cdata content
+ #puts "cdata"
+ end
+ def xmldecl version, encoding, standalone
+ #puts "xmldecl #{version}"
+ end
end
diff --git a/test/rexml/parse/test_document_type_declaration.rb b/test/rexml/parse/test_document_type_declaration.rb
new file mode 100644
index 0000000000..59fe561155
--- /dev/null
+++ b/test/rexml/parse/test_document_type_declaration.rb
@@ -0,0 +1,49 @@
+require "test/unit"
+require "rexml/document"
+
+module REXMLTests
+ class TestParseDocumentTypeDeclaration < Test::Unit::TestCase
+ private
+ def xml(internal_subset)
+ <<-XML
+<!DOCTYPE r SYSTEM "urn:x-rexml:test" [
+#{internal_subset}
+]>
+<r/>
+ XML
+ end
+
+ def parse(internal_subset)
+ REXML::Document.new(xml(internal_subset)).doctype
+ end
+
+ class TestMixed < self
+ def test_entity_element
+ doctype = parse(<<-INTERNAL_SUBSET)
+<!ENTITY entity-name "entity content">
+<!ELEMENT element-name EMPTY>
+ INTERNAL_SUBSET
+ assert_equal([REXML::Entity, REXML::ElementDecl],
+ doctype.children.collect(&:class))
+ end
+
+ def test_attlist_entity
+ doctype = parse(<<-INTERNAL_SUBSET)
+<!ATTLIST attribute-list-name attribute-name CDATA #REQUIRED>
+<!ENTITY entity-name "entity content">
+ INTERNAL_SUBSET
+ assert_equal([REXML::AttlistDecl, REXML::Entity],
+ doctype.children.collect(&:class))
+ end
+
+ def test_notation_attlist
+ doctype = parse(<<-INTERNAL_SUBSET)
+<!NOTATION notation-name SYSTEM "system-literal">
+<!ATTLIST attribute-list-name attribute-name CDATA #REQUIRED>
+ INTERNAL_SUBSET
+ assert_equal([REXML::NotationDecl, REXML::AttlistDecl],
+ doctype.children.collect(&:class))
+ end
+ end
+ end
+end
diff --git a/test/rexml/parse/test_notation_declaration.rb b/test/rexml/parse/test_notation_declaration.rb
new file mode 100644
index 0000000000..0a4e737abf
--- /dev/null
+++ b/test/rexml/parse/test_notation_declaration.rb
@@ -0,0 +1,99 @@
+require 'test/unit'
+require 'rexml/document'
+
+module REXMLTests
+ class TestParseNotationDeclaration < Test::Unit::TestCase
+ private
+ def xml(internal_subset)
+ <<-XML
+<!DOCTYPE r SYSTEM "urn:x-henrikmartensson:test" [
+#{internal_subset}
+]>
+<r/>
+ XML
+ end
+
+ def parse(internal_subset)
+ REXML::Document.new(xml(internal_subset)).doctype
+ end
+
+ class TestCommon < self
+ def test_name
+ doctype = parse("<!NOTATION name PUBLIC 'urn:public-id'>")
+ assert_equal("name", doctype.notation("name").name)
+ end
+ end
+
+ class TestExternalID < self
+ class TestSystem < self
+ def test_single_quote
+ doctype = parse(<<-INTERNAL_SUBSET)
+<!NOTATION name SYSTEM 'system-literal'>
+ INTERNAL_SUBSET
+ assert_equal("system-literal", doctype.notation("name").system)
+ end
+
+ def test_double_quote
+ doctype = parse(<<-INTERNAL_SUBSET)
+<!NOTATION name SYSTEM "system-literal">
+ INTERNAL_SUBSET
+ assert_equal("system-literal", doctype.notation("name").system)
+ end
+ end
+
+ class TestPublic < self
+ class TestPublicIDLiteral < self
+ def test_single_quote
+ doctype = parse(<<-INTERNAL_SUBSET)
+<!NOTATION name PUBLIC 'public-id-literal' "system-literal">
+ INTERNAL_SUBSET
+ assert_equal("public-id-literal", doctype.notation("name").public)
+ end
+
+ def test_double_quote
+ doctype = parse(<<-INTERNAL_SUBSET)
+<!NOTATION name PUBLIC "public-id-literal" "system-literal">
+ INTERNAL_SUBSET
+ assert_equal("public-id-literal", doctype.notation("name").public)
+ end
+ end
+
+ class TestSystemLiteral < self
+ def test_single_quote
+ doctype = parse(<<-INTERNAL_SUBSET)
+<!NOTATION name PUBLIC "public-id-literal" 'system-literal'>
+ INTERNAL_SUBSET
+ assert_equal("system-literal", doctype.notation("name").system)
+ end
+
+ def test_double_quote
+ doctype = parse(<<-INTERNAL_SUBSET)
+<!NOTATION name PUBLIC "public-id-literal" "system-literal">
+ INTERNAL_SUBSET
+ assert_equal("system-literal", doctype.notation("name").system)
+ end
+ end
+ end
+
+ class TestMixed < self
+ def test_system_public
+ doctype = parse(<<-INTERNAL_SUBSET)
+<!NOTATION system-name SYSTEM "system-literal">
+<!NOTATION public-name PUBLIC "public-id-literal" 'system-literal'>
+ INTERNAL_SUBSET
+ assert_equal(["system-name", "public-name"],
+ doctype.notations.collect(&:name))
+ end
+
+ def test_public_system
+ doctype = parse(<<-INTERNAL_SUBSET)
+<!NOTATION public-name PUBLIC "public-id-literal" 'system-literal'>
+<!NOTATION system-name SYSTEM "system-literal">
+ INTERNAL_SUBSET
+ assert_equal(["public-name", "system-name"],
+ doctype.notations.collect(&:name))
+ end
+ end
+ end
+ end
+end
diff --git a/test/rexml/parser/test_sax2.rb b/test/rexml/parser/test_sax2.rb
new file mode 100644
index 0000000000..dba5eab033
--- /dev/null
+++ b/test/rexml/parser/test_sax2.rb
@@ -0,0 +1,202 @@
+require "test/unit"
+require "rexml/parsers/sax2parser"
+require "rexml/sax2listener"
+
+module REXMLTests
+class TestSAX2Parser < Test::Unit::TestCase
+ class TestDocumentTypeDeclaration < self
+ private
+ def xml(internal_subset)
+ <<-XML
+<!DOCTYPE r SYSTEM "urn:x-henrikmartensson:test" [
+#{internal_subset}
+]>
+<r/>
+ XML
+ end
+
+ class TestEntityDeclaration < self
+ class Listener
+ include REXML::SAX2Listener
+ attr_reader :entity_declarations
+ def initialize
+ @entity_declarations = []
+ end
+
+ def entitydecl(declaration)
+ super
+ @entity_declarations << declaration
+ end
+ end
+
+ private
+ def parse(internal_subset)
+ listener = Listener.new
+ parser = REXML::Parsers::SAX2Parser.new(xml(internal_subset))
+ parser.listen(listener)
+ parser.parse
+ listener.entity_declarations
+ end
+
+ class TestGeneralEntity < self
+ class TestValue < self
+ def test_double_quote
+ assert_equal([["name", "value"]], parse(<<-INTERNAL_SUBSET))
+<!ENTITY name "value">
+ INTERNAL_SUBSET
+ end
+
+ def test_single_quote
+ assert_equal([["name", "value"]], parse(<<-INTERNAL_SUBSET))
+<!ENTITY name 'value'>
+ INTERNAL_SUBSET
+ end
+ end
+
+ class TestExternlID < self
+ class TestSystem < self
+ def test_with_ndata
+ declaration = [
+ "name",
+ "SYSTEM", "system-literal",
+ "NDATA", "ndata-name",
+ ]
+ assert_equal([declaration],
+ parse(<<-INTERNAL_SUBSET))
+<!ENTITY name SYSTEM "system-literal" NDATA ndata-name>
+ INTERNAL_SUBSET
+ end
+
+ def test_without_ndata
+ declaration = [
+ "name",
+ "SYSTEM", "system-literal",
+ ]
+ assert_equal([declaration],
+ parse(<<-INTERNAL_SUBSET))
+<!ENTITY name SYSTEM "system-literal">
+ INTERNAL_SUBSET
+ end
+ end
+
+ class TestPublic < self
+ def test_with_ndata
+ declaration = [
+ "name",
+ "PUBLIC", "public-literal", "system-literal",
+ "NDATA", "ndata-name",
+ ]
+ assert_equal([declaration],
+ parse(<<-INTERNAL_SUBSET))
+<!ENTITY name PUBLIC "public-literal" "system-literal" NDATA ndata-name>
+ INTERNAL_SUBSET
+ end
+
+ def test_without_ndata
+ declaration = [
+ "name",
+ "PUBLIC", "public-literal", "system-literal",
+ ]
+ assert_equal([declaration], parse(<<-INTERNAL_SUBSET))
+<!ENTITY name PUBLIC "public-literal" "system-literal">
+ INTERNAL_SUBSET
+ end
+ end
+ end
+ end
+
+ class TestParameterEntity < self
+ class TestValue < self
+ def test_double_quote
+ assert_equal([["%", "name", "value"]], parse(<<-INTERNAL_SUBSET))
+<!ENTITY % name "value">
+ INTERNAL_SUBSET
+ end
+
+ def test_single_quote
+ assert_equal([["%", "name", "value"]], parse(<<-INTERNAL_SUBSET))
+<!ENTITY % name 'value'>
+ INTERNAL_SUBSET
+ end
+ end
+
+ class TestExternlID < self
+ def test_system
+ declaration = [
+ "%",
+ "name",
+ "SYSTEM", "system-literal",
+ ]
+ assert_equal([declaration],
+ parse(<<-INTERNAL_SUBSET))
+<!ENTITY % name SYSTEM "system-literal">
+ INTERNAL_SUBSET
+ end
+
+ def test_public
+ declaration = [
+ "%",
+ "name",
+ "PUBLIC", "public-literal", "system-literal",
+ ]
+ assert_equal([declaration], parse(<<-INTERNAL_SUBSET))
+<!ENTITY % name PUBLIC "public-literal" "system-literal">
+ INTERNAL_SUBSET
+ end
+ end
+ end
+ end
+
+ class TestNotationDeclaration < self
+ class Listener
+ include REXML::SAX2Listener
+ attr_reader :notation_declarations
+ def initialize
+ @notation_declarations = []
+ end
+
+ def notationdecl(*declaration)
+ super
+ @notation_declarations << declaration
+ end
+ end
+
+ private
+ def parse(internal_subset)
+ listener = Listener.new
+ parser = REXML::Parsers::SAX2Parser.new(xml(internal_subset))
+ parser.listen(listener)
+ parser.parse
+ listener.notation_declarations
+ end
+
+ class TestExternlID < self
+ def test_system
+ declaration = ["name", "SYSTEM", nil, "system-literal"]
+ assert_equal([declaration],
+ parse(<<-INTERNAL_SUBSET))
+<!NOTATION name SYSTEM "system-literal">
+ INTERNAL_SUBSET
+ end
+
+ def test_public
+ declaration = ["name", "PUBLIC", "public-literal", "system-literal"]
+ assert_equal([declaration], parse(<<-INTERNAL_SUBSET))
+<!NOTATION name PUBLIC "public-literal" "system-literal">
+ INTERNAL_SUBSET
+ end
+ end
+
+ class TestPublicID < self
+ def test_literal
+ declaration = ["name", "PUBLIC", "public-literal", nil]
+ assert_equal([declaration],
+ parse(<<-INTERNAL_SUBSET))
+<!NOTATION name PUBLIC "public-literal">
+ INTERNAL_SUBSET
+ end
+ end
+ end
+ end
+end
+end
diff --git a/test/rexml/parser/test_tree.rb b/test/rexml/parser/test_tree.rb
new file mode 100644
index 0000000000..fa010f6975
--- /dev/null
+++ b/test/rexml/parser/test_tree.rb
@@ -0,0 +1,42 @@
+require "test/unit"
+require "rexml/document"
+require "rexml/parsers/treeparser"
+
+module REXMLTests
+class TestTreeParser < Test::Unit::TestCase
+ class TestInvalid < self
+ def test_unmatched_close_tag
+ xml = "<root></not-root>"
+ exception = assert_raise(REXML::ParseException) do
+ parse(xml)
+ end
+ assert_equal(<<-MESSAGE, exception.to_s)
+Missing end tag for 'root' (got "not-root")
+Line: 1
+Position: #{xml.bytesize}
+Last 80 unconsumed characters:
+ MESSAGE
+ end
+
+ def test_no_close_tag
+ xml = "<root>"
+ exception = assert_raise(REXML::ParseException) do
+ parse(xml)
+ end
+ assert_equal(<<-MESSAGE, exception.to_s)
+No close tag for /root
+Line: 1
+Position: #{xml.bytesize}
+Last 80 unconsumed characters:
+ MESSAGE
+ end
+
+ private
+ def parse(xml)
+ document = REXML::Document.new
+ parser = REXML::Parsers::TreeParser.new(xml, document)
+ parser.parse
+ end
+ end
+end
+end
diff --git a/test/rexml/parser/test_ultra_light.rb b/test/rexml/parser/test_ultra_light.rb
new file mode 100644
index 0000000000..4960fc16dc
--- /dev/null
+++ b/test/rexml/parser/test_ultra_light.rb
@@ -0,0 +1,69 @@
+require "test/unit"
+require "rexml/parsers/ultralightparser"
+
+module REXMLTests
+class TestUltraLightParser < Test::Unit::TestCase
+ class TestDocumentTypeDeclaration < self
+ def test_entity_declaration
+ assert_equal([
+ [
+ :start_doctype,
+ :parent,
+ "root",
+ "SYSTEM",
+ "urn:x-test",
+ nil,
+ [:entitydecl, "name", "value"]
+ ],
+ [:text, "\n"],
+ [:start_element, :parent, "root", {}],
+ [:text, "\n"],
+ ],
+ parse(<<-INTERNAL_SUBSET))
+<!ENTITY name "value">
+ INTERNAL_SUBSET
+ end
+
+ private
+ def xml(internal_subset)
+ <<-XML
+<!DOCTYPE root SYSTEM "urn:x-test" [
+#{internal_subset}
+]>
+<root/>
+ XML
+ end
+
+ def parse(internal_subset)
+ parser = REXML::Parsers::UltraLightParser.new(xml(internal_subset))
+ normalize(parser.parse)
+ end
+
+ def normalize(root)
+ root.collect do |child|
+ normalize_child(child)
+ end
+ end
+
+ def normalize_child(child)
+ tag = child.first
+ case tag
+ when :start_doctype
+ normalized_parent = :parent
+ normalized_doctype = child.dup
+ normalized_doctype[1] = normalized_parent
+ normalized_doctype
+ when :start_element
+ tag, parent, name, attributes, *children = child
+ normalized_parent = :parent
+ normalized_children = children.collect do |sub_child|
+ normalize_child(sub_child)
+ end
+ [tag, normalized_parent, name, attributes, *normalized_children]
+ else
+ child
+ end
+ end
+ end
+end
+end
diff --git a/test/rexml/rexml_test_utils.rb b/test/rexml/rexml_test_utils.rb
index 916e73674d..57fe65ca73 100644
--- a/test/rexml/rexml_test_utils.rb
+++ b/test/rexml/rexml_test_utils.rb
@@ -1,3 +1,4 @@
+require 'test/unit'
module REXMLTestUtils
def fixture_path(*components)
File.join(File.dirname(__FILE__), "data", *components)
diff --git a/test/rexml/test_attributes.rb b/test/rexml/test_attributes.rb
index e46850de3a..aea1d8857c 100644
--- a/test/rexml/test_attributes.rb
+++ b/test/rexml/test_attributes.rb
@@ -1,198 +1,222 @@
require 'test/unit/testcase'
require 'rexml/document'
-class AttributesTester < Test::Unit::TestCase
- include REXML
- def test_accessor
- doc = Document.new("<a xmlns:foo='a' xmlns:bar='b' foo:att='1' bar:att='2' att='3'/>")
- assert_equal '3', doc.root.attributes['att']
- assert_equal '2', doc.root.attributes['bar:att']
- doc.root.attributes['att'] = 5
- assert_equal '5', doc.root.attributes['att']
- end
+module REXMLTests
+ class AttributesTester < Test::Unit::TestCase
+ include REXML
+ def test_accessor
+ doc = Document.new("<a xmlns:foo='a' xmlns:bar='b' foo:att='1' bar:att='2' att='3'/>")
+ assert_equal '3', doc.root.attributes['att']
+ assert_equal '2', doc.root.attributes['bar:att']
+ doc.root.attributes['att'] = 5
+ assert_equal '5', doc.root.attributes['att']
+ end
- def test_each_attribute
- doc = Document.new('<a x="1" y="2"/>')
- doc.root.attributes.each_attribute {|attr|
- if attr.expanded_name == 'x'
- assert_equal '1', attr.value
- elsif attr.expanded_name == 'y'
- assert_equal '2', attr.value
- else
- assert_fail "No such attribute!!"
- end
- }
- end
+ def test_each_attribute
+ doc = Document.new('<a x="1" y="2"/>')
+ doc.root.attributes.each_attribute {|attr|
+ if attr.expanded_name == 'x'
+ assert_equal '1', attr.value
+ elsif attr.expanded_name == 'y'
+ assert_equal '2', attr.value
+ else
+ assert_fail "No such attribute!!"
+ end
+ }
+ end
- def test_each
- doc = Document.new('<a x="1" y="2"/>')
- doc.root.attributes.each {|name, value|
- if name == 'x'
- assert_equal '1', value
- elsif name == 'y'
- assert_equal '2', value
- else
- assert_fail "No such attribute!!"
- end
- }
- end
+ def test_each
+ doc = Document.new('<a x="1" y="2"/>')
+ doc.root.attributes.each {|name, value|
+ if name == 'x'
+ assert_equal '1', value
+ elsif name == 'y'
+ assert_equal '2', value
+ else
+ assert_fail "No such attribute!!"
+ end
+ }
+ end
- def test_get_attribute
- doc = Document.new('<a xmlns:x="a" x:foo="1" foo="2" bar="3"/>')
- assert_equal '2', doc.root.attributes.get_attribute("foo").value
- assert_equal '1', doc.root.attributes.get_attribute("x:foo").value
- end
+ def test_get_attribute
+ doc = Document.new('<a xmlns:x="a" x:foo="1" foo="2" bar="3"/>')
+ assert_equal '2', doc.root.attributes.get_attribute("foo").value
+ assert_equal '1', doc.root.attributes.get_attribute("x:foo").value
+ end
- def test_size
- doc = Document.new("<a xmlns:foo='a' x='1' y='2' foo:x='3'/>")
- assert_equal 4, doc.root.attributes.length
- end
+ def test_size
+ doc = Document.new("<a xmlns:foo='a' x='1' y='2' foo:x='3'/>")
+ assert_equal 4, doc.root.attributes.length
+ end
- def test_setter
- doc = Document.new("<a xmlns:x='a' x:foo='1' foo='3'/>")
- doc.root.attributes['y:foo'] = '2'
- assert_equal '2', doc.root.attributes['y:foo']
- doc.root.attributes['foo'] = '4'
- assert_equal '4', doc.root.attributes['foo']
- doc.root.attributes['x:foo'] = nil
- assert_equal 3, doc.root.attributes.size
- end
+ def test_setter
+ doc = Document.new("<a xmlns:x='a' x:foo='1' foo='3'/>")
+ doc.root.attributes['y:foo'] = '2'
+ assert_equal '2', doc.root.attributes['y:foo']
+ doc.root.attributes['foo'] = '4'
+ assert_equal '4', doc.root.attributes['foo']
+ doc.root.attributes['x:foo'] = nil
+ assert_equal 3, doc.root.attributes.size
+ end
- def test_delete
- doc = Document.new("<a xmlns:y='a' xmlns:x='b' xmlns:z='c' y:foo='0' x:foo='1' foo='3' z:foo='4'/>")
- doc.root.attributes.delete 'foo'
- assert_equal 6, doc.root.attributes.size
- assert_equal '1', doc.root.attributes['x:foo']
+ def test_delete
+ doc = Document.new("<a xmlns:y='a' xmlns:x='b' xmlns:z='c' y:foo='0' x:foo='1' foo='3' z:foo='4'/>")
+ doc.root.attributes.delete 'foo'
+ assert_equal 6, doc.root.attributes.size
+ assert_equal '1', doc.root.attributes['x:foo']
- doc.root.attributes.delete 'x:foo'
- assert_equal 5, doc.root.attributes.size
+ doc.root.attributes.delete 'x:foo'
+ assert_equal 5, doc.root.attributes.size
- attr = doc.root.attributes.get_attribute('y:foo')
- doc.root.attributes.delete attr
- assert_equal 4, doc.root.attributes.size
+ attr = doc.root.attributes.get_attribute('y:foo')
+ doc.root.attributes.delete attr
+ assert_equal 4, doc.root.attributes.size
- assert_equal '4', doc.root.attributes['z:foo']
- end
+ assert_equal '4', doc.root.attributes['z:foo']
+ end
- def test_prefixes
- doc = Document.new("<a xmlns='foo' xmlns:x='bar' xmlns:y='twee' z='glorp' x:k='gru'/>")
- prefixes = doc.root.attributes.prefixes
- assert_equal 2, prefixes.size
- assert_equal 0, (prefixes - ['x', 'y']).size
- end
+ def test_prefixes
+ doc = Document.new("<a xmlns='foo' xmlns:x='bar' xmlns:y='twee' z='glorp' x:k='gru'/>")
+ prefixes = doc.root.attributes.prefixes
+ assert_equal 2, prefixes.size
+ assert_equal 0, (prefixes - ['x', 'y']).size
+ end
- # Contributed by Mike Stok
- def test_values_with_apostrophes
- doc = Document.new(%q#<tag h1="1'2'" h2='1"2'/>#)
- s = doc.to_s
- assert(s =~ /h1='1&apos;2&apos;'/)
- assert(s =~ /h2='1"2'/)
- end
+ # Contributed by Mike Stok
+ def test_values_with_apostrophes
+ doc = Document.new(%q#<tag h1="1'2'" h2='1"2'/>#)
+ s = doc.to_s
+ assert(s =~ /h1='1&apos;2&apos;'/)
+ assert(s =~ /h2='1"2'/)
+ end
+
+ # Submitted by Kou
+ def test_namespace_conflict
+ assert_raise( ParseException,
+ "Declaring two attributes with the same namespace should be an error" ) do
+ REXML::Document.new <<-XML
+ <x xmlns:n1="http://www.w3.org"
+ xmlns:n2="http://www.w3.org" >
+ <bad n1:a="1" n2:a="2" />
+ </x>
+ XML
+ end
- # Submitted by Kou
- def test_namespace_conflict
- assert_raise( ParseException,
- "Declaring two attributes with the same namespace should be an error" ) do
- REXML::Document.new <<-XML
- <x xmlns:n1="http://www.w3.org"
- xmlns:n2="http://www.w3.org" >
- <bad n1:a="1" n2:a="2" />
- </x>
- XML
+ REXML::Document.new("<a xmlns:a='a' xmlns:b='a'></a>")
end
- REXML::Document.new("<a xmlns:a='a' xmlns:b='a'></a>")
- end
+ # Submitted by Kou
+ def test_attribute_deletion
+ e = REXML::Element.new
+ e.add_namespace("a", "http://a/")
+ e.add_namespace("b", "http://b/")
+ e.add_attributes({"c" => "cc", "a:c" => "cC", "b:c" => "CC"})
- # Submitted by Kou
- def test_attribute_deletion
- e = REXML::Element.new
- e.add_namespace("a", "http://a/")
- e.add_namespace("b", "http://b/")
- e.add_attributes({"c" => "cc", "a:c" => "cC", "b:c" => "CC"})
+ e.attributes.delete("c")
+ assert_nil(e.attributes.get_attribute("c"))
- e.attributes.delete("c")
- assert_nil(e.attributes.get_attribute("c"))
+ before_size = e.attributes.size
+ e.attributes.delete("c")
+ assert_nil(e.attributes.get_attribute("c"))
+ assert_equal(before_size, e.attributes.size)
- before_size = e.attributes.size
- e.attributes.delete("c")
- assert_nil(e.attributes.get_attribute("c"))
- assert_equal(before_size, e.attributes.size)
+ e.attributes.delete(e.attributes.get_attribute("a:c"))
+ assert_nil(e.attributes.get_attribute("a:c"))
- e.attributes.delete(e.attributes.get_attribute("a:c"))
- assert_nil(e.attributes.get_attribute("a:c"))
+ e.attributes.delete("b:c")
+ assert_nil(e.attributes.get_attribute("b:c"))
- e.attributes.delete("b:c")
- assert_nil(e.attributes.get_attribute("b:c"))
+ before_size = e.attributes.size
+ e.attributes.delete(e.attributes.get_attribute("b:c"))
+ assert_nil(e.attributes.get_attribute("b:c"))
+ assert_equal(before_size, e.attributes.size)
- before_size = e.attributes.size
- e.attributes.delete(e.attributes.get_attribute("b:c"))
- assert_nil(e.attributes.get_attribute("b:c"))
- assert_equal(before_size, e.attributes.size)
+ before_size = e.attributes.size
+ e.attributes.delete("c")
+ assert_nil(e.attributes.get_attribute("c"))
+ assert_equal(before_size, e.attributes.size)
- before_size = e.attributes.size
- e.attributes.delete("c")
- assert_nil(e.attributes.get_attribute("c"))
- assert_equal(before_size, e.attributes.size)
+ e.add_attribute("c", "cc")
- e.add_attribute("c", "cc")
+ e.attributes.delete(e.attributes.get_attribute("c"))
+ assert_nil(e.attributes.get_attribute("c"))
+ end
- e.attributes.delete(e.attributes.get_attribute("c"))
- assert_nil(e.attributes.get_attribute("c"))
- end
+ # Submitted by Kou
+ def test_element_usage
+ attr = Attribute.new("name", "value")
+ elem = Element.new("elem")
+ a = Attribute.new(attr, elem)
+ assert_equal(elem, a.element)
+ end
- # Submitted by Kou
- def test_element_usage
- attr = Attribute.new("name", "value")
- elem = Element.new("elem")
- a = Attribute.new(attr, elem)
- assert_equal(elem, a.element)
- end
+ def attr_test(attr_name,attr_value)
+ a1 = REXML::Attribute.new(attr_name,attr_value)
- def attr_test(attr_name,attr_value)
- a1 = REXML::Attribute.new(attr_name,attr_value)
+ s1 = a1.value
+ s2 = a1.value
- s1 = a1.value
- s2 = a1.value
+ #p s1
+ #p s2
+ assert_equal(s1,s2)
- #p s1
- #p s2
- assert_equal(s1,s2)
+ a2 = REXML::Attribute.new(attr_name,attr_value)
- a2 = REXML::Attribute.new(attr_name,attr_value)
+ a2.to_s # NB invocation of to_s
+ s1 = a2.value
+ s2 = a2.value
- a2.to_s # NB invocation of to_s
- s1 = a2.value
- s2 = a2.value
+ #p s1
+ #p s2
+ assert_equal(s1,s2)
+ end
- #p s1
- #p s2
- assert_equal(s1,s2)
- end
+ def test_amp_attributes
+ attr_test('name','value with &amp; ampersand only')
+ end
- def test_amp_attributes
- attr_test('name','value with &amp; ampersand only')
- end
+ def test_amp_and_lf_attributes
+ attr_test('name','value with LF &#x000a; &amp; ampersand')
+ end
- def test_amp_and_lf_attributes
- attr_test('name','value with LF &#x000a; &amp; ampersand')
- end
+ def test_quoting
+ d = Document.new(%q{<a x='1' y="2"/>})
+ assert_equal( %q{<a x='1' y='2'/>}, d.to_s )
+ d.root.context[:attribute_quote] = :quote
+ assert_equal( %q{<a x="1" y="2"/>}, d.to_s )
- def test_quoting
- d = Document.new(%q{<a x='1' y="2"/>})
- assert_equal( %q{<a x='1' y='2'/>}, d.to_s )
- d.root.context[:attribute_quote] = :quote
- assert_equal( %q{<a x="1" y="2"/>}, d.to_s )
+ d = Document.new(%q{<a x='1' y="2"><b z='3'/></a>})
+ assert_equal( %q{<a x='1' y='2'><b z='3'/></a>}, d.to_s )
+ d.root.context[:attribute_quote] = :quote
+ assert_equal( %q{<a x="1" y="2"><b z="3"/></a>}, d.to_s )
+ end
- d = Document.new(%q{<a x='1' y="2"><b z='3'/></a>})
- assert_equal( %q{<a x='1' y='2'><b z='3'/></a>}, d.to_s )
- d.root.context[:attribute_quote] = :quote
- assert_equal( %q{<a x="1" y="2"><b z="3"/></a>}, d.to_s )
- end
+ def test_ticket_127
+ doc = Document.new
+ doc.add_element 'a', { 'v' => 'x & y' }
+ assert doc.to_s.index(';')
+ end
- def test_ticket_127
- doc = Document.new
- doc.add_element 'a', { 'v' => 'x & y' }
- assert doc.to_s.index(';')
+ def test_to_a_with_namespaces
+ document = Document.new(<<-XML)
+<root
+ xmlns:ns1="http://example.org/ns1"
+ xmlns:ns2="http://example.org/ns2">
+ <child
+ ns1:attribute="ns1"
+ ns2:attribute="ns2"
+ attribute="no-ns"
+ other-attribute="other-value"/>
+</root>
+XML
+ child = document.root.elements["child"]
+ assert_equal([
+ "attribute='no-ns'",
+ "ns1:attribute='ns1'",
+ "ns2:attribute='ns2'",
+ "other-attribute='other-value'",
+ ],
+ child.attributes.to_a.collect(&:to_string).sort)
+ end
end
end
diff --git a/test/rexml/test_attributes_mixin.rb b/test/rexml/test_attributes_mixin.rb
index 50899d0607..17cca4efc3 100644
--- a/test/rexml/test_attributes_mixin.rb
+++ b/test/rexml/test_attributes_mixin.rb
@@ -1,32 +1,31 @@
-#! /usr/local/bin/ruby
-
-
require 'test/unit'
require 'rexml/document'
-class TestAttributes < Test::Unit::TestCase
- def setup
- @ns_a = "urn:x-test:a"
- @ns_b = "urn:x-test:b"
- element_string = <<-"XMLEND"
- <test xmlns:a="#{@ns_a}"
- xmlns:b="#{@ns_b}"
- a = "1"
- b = '2'
- a:c = "3"
- a:d = '4'
- a:e = "5"
- b:f = "6"/>
- XMLEND
- @attributes = REXML::Document.new(element_string).root.attributes
- end
+module REXMLTests
+ class TestAttributes < Test::Unit::TestCase
+ def setup
+ @ns_a = "urn:x-test:a"
+ @ns_b = "urn:x-test:b"
+ element_string = <<-"XMLEND"
+ <test xmlns:a="#{@ns_a}"
+ xmlns:b="#{@ns_b}"
+ a = "1"
+ b = '2'
+ a:c = "3"
+ a:d = '4'
+ a:e = "5"
+ b:f = "6"/>
+ XMLEND
+ @attributes = REXML::Document.new(element_string).root.attributes
+ end
- def test_get_attribute_ns
- assert_equal("1", @attributes.get_attribute_ns("", "a").value)
- assert_equal("2", @attributes.get_attribute_ns("", "b").value)
- assert_equal("3", @attributes.get_attribute_ns(@ns_a, "c").value)
- assert_equal("4", @attributes.get_attribute_ns(@ns_a, "d").value)
- assert_equal("5", @attributes.get_attribute_ns(@ns_a, "e").value)
- assert_equal("6", @attributes.get_attribute_ns(@ns_b, "f").value)
+ def test_get_attribute_ns
+ assert_equal("1", @attributes.get_attribute_ns("", "a").value)
+ assert_equal("2", @attributes.get_attribute_ns("", "b").value)
+ assert_equal("3", @attributes.get_attribute_ns(@ns_a, "c").value)
+ assert_equal("4", @attributes.get_attribute_ns(@ns_a, "d").value)
+ assert_equal("5", @attributes.get_attribute_ns(@ns_a, "e").value)
+ assert_equal("6", @attributes.get_attribute_ns(@ns_b, "f").value)
+ end
end
end
diff --git a/test/rexml/test_changing_encoding.rb b/test/rexml/test_changing_encoding.rb
index c6c1f59a1a..5a085e2519 100644
--- a/test/rexml/test_changing_encoding.rb
+++ b/test/rexml/test_changing_encoding.rb
@@ -1,44 +1,44 @@
-#!/usr/bin/ruby -Ku
# -*- coding: utf-8 -*-
require 'rexml/encoding'
+module REXMLTests
+ class ChangingEncodings < Test::Unit::TestCase
+ def initialize a
+ @u = 'テスト ほげ ふが 美しい'
+ @e = @u.encode("EUC-JP")
+ @f = Foo.new
+ super
+ end
-class ChangingEncodings < Test::Unit::TestCase
- def initialize a
- @u = 'テスト ほげ ふが 美しい'
- @e = @u.encode("EUC-JP")
- @f = Foo.new
- super
- end
+ class Foo
+ include REXML::Encoding
+ end
- class Foo
- include REXML::Encoding
- end
+ # Note that these tests must be executed in order for the third one to
+ # actually test anything.
+ def test_0_euc
+ @f.encoding = 'EUC-JP'
+ assert_equal( @u, @f.decode(@e) )
+ # This doesn't happen anymore, for some reason
+ #assert_raises( Iconv::IllegalSequence, "Decoding unicode should fail" ) {
+ # @f.decode(@u) == @u
+ #}
+ end
- # Note that these tests must be executed in order for the third one to
- # actually test anything.
- def test_0_euc
- @f.encoding = 'EUC-JP'
- assert_equal( @u, @f.decode(@e) )
- # This doesn't happen anymore, for some reason
- #assert_raises( Iconv::IllegalSequence, "Decoding unicode should fail" ) {
- # @f.decode(@u) == @u
- #}
- end
-
- def test_1_utf
- @f.encoding = 'UTF-8'
- assert_not_equal( @u, @f.decode( @e ) )
- assert_equal( @u, @f.decode( @u ) )
- end
+ def test_1_utf
+ @f.encoding = 'UTF-8'
+ assert_not_equal( @u, @f.decode( @e ) )
+ assert_equal( @u, @f.decode( @u ) )
+ end
- def test_2_euc
- @f.encoding = 'EUC-JP'
- assert_equal( @u, @f.decode(@e) )
- # This doesn't happen anymore, for some reason
- #assert_raises( Iconv::IllegalSequence, "Decoding unicode should fail" ) {
- # @f.decode(@u) == @u
- #}
+ def test_2_euc
+ @f.encoding = 'EUC-JP'
+ assert_equal( @u, @f.decode(@e) )
+ # This doesn't happen anymore, for some reason
+ #assert_raises( Iconv::IllegalSequence, "Decoding unicode should fail" ) {
+ # @f.decode(@u) == @u
+ #}
+ end
end
end
diff --git a/test/rexml/test_comment.rb b/test/rexml/test_comment.rb
index ebe3eead8d..d5e78a5cde 100644
--- a/test/rexml/test_comment.rb
+++ b/test/rexml/test_comment.rb
@@ -2,7 +2,7 @@ require "test/unit/testcase"
require 'rexml/document'
-module REXMLTest
+module REXMLTests
class CommentTester < Test::Unit::TestCase
# Bug #5278
def test_hyphen_end_line_in_doctype
diff --git a/test/rexml/test_contrib.rb b/test/rexml/test_contrib.rb
index db7c18d027..fa84ebef3a 100644
--- a/test/rexml/test_contrib.rb
+++ b/test/rexml/test_contrib.rb
@@ -1,16 +1,17 @@
# coding: binary
-require "rexml_test_utils"
+require_relative "rexml_test_utils"
require "rexml/document"
require "rexml/parseexception"
require "rexml/formatters/default"
-class ContribTester < Test::Unit::TestCase
- include REXMLTestUtils
- include REXML
+module REXMLTests
+ class ContribTester < Test::Unit::TestCase
+ include REXMLTestUtils
+ include REXML
- XML_STRING_01 = <<DELIMITER
+ XML_STRING_01 = <<DELIMITER
<?xml version="1.0" encoding="UTF-8"?>
<biblio>
<entry type="Book">
@@ -31,7 +32,7 @@ class ContribTester < Test::Unit::TestCase
</biblio>
DELIMITER
- XML_STRING_02 = <<DELIMITER
+ XML_STRING_02 = <<DELIMITER
<biblio>
<entry type="Book">
<language>english</language>
@@ -51,205 +52,205 @@ DELIMITER
</biblio>
DELIMITER
- # Tobias Reif <tobiasreif@pinkjuice.com>
- def test_bad_doctype_Tobias
- source = <<-EOF
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
- "http://www.w3.org/TR/SVG/DTD/svg10.dtd"
- [
- <!-- <!ENTITY % fast-slow "0 0 .5 1">-->
- <!--<!ENTITY % slow-fast ".5 0 1 1">-->
- <!ENTITY hover_ani
- '<animateTransform attributeName="transform"
- type="scale" restart="whenNotActive" values="1;0.96"
- dur="0.5s" calcMode="spline" keySplines="0 0 .5 1"
- fill="freeze" begin="mouseover"/>
- <animateTransform attributeName="transform"
- type="scale" restart="whenNotActive" values="0.96;1"
- dur="0.5s" calcMode="spline" keySplines=".5 0 1 1"
- fill="freeze" begin="mouseover+0.5s"/>'
+ # Tobias Reif <tobiasreif@pinkjuice.com>
+ def test_bad_doctype_Tobias
+ source = <<-EOF
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
+ "http://www.w3.org/TR/SVG/DTD/svg10.dtd"
+ [
+ <!-- <!ENTITY % fast-slow "0 0 .5 1">-->
+ <!--<!ENTITY % slow-fast ".5 0 1 1">-->
+ <!ENTITY hover_ani
+ '<animateTransform attributeName="transform"
+ type="scale" restart="whenNotActive" values="1;0.96"
+ dur="0.5s" calcMode="spline" keySplines="0 0 .5 1"
+ fill="freeze" begin="mouseover"/>
+ <animateTransform attributeName="transform"
+ type="scale" restart="whenNotActive" values="0.96;1"
+ dur="0.5s" calcMode="spline" keySplines=".5 0 1 1"
+ fill="freeze" begin="mouseover+0.5s"/>'
+ >
+ ]
>
- ]
- >
- EOF
- doc = REXML::Document.new source
- doc.write(out="")
- assert(out[/>\'>/] != nil, "Couldn't find >'>")
- assert(out[/\]>/] != nil, "Couldn't find ]>")
- end
+ EOF
+ doc = REXML::Document.new source
+ doc.write(out="")
+ assert(out[/>\'>/] != nil, "Couldn't find >'>")
+ assert(out[/\]>/] != nil, "Couldn't find ]>")
+ end
- # Peter Verhage
- def test_namespace_Peter
- source = <<-EOF
- <?xml version="1.0"?>
- <config:myprog-config xmlns:config="http://someurl/program/version">
- <!-- main options -->
- <config:main>
- <config:parameter name="name" value="value"/>
- </config:main>
- </config:myprog-config>
- EOF
- doc = REXML::Document.new source
- assert_equal "myprog-config", doc.root.name
- count = 0
- REXML::XPath.each(doc, "x:myprog-config/x:main/x:parameter",
- {"x"=>"http://someurl/program/version"}) { |element|
- assert_equal "name", element.attributes["name"]
- count += 1;
- }
- assert_equal 1, count
- assert_equal "myprog-config", doc.elements["config:myprog-config"].name
- end
+ # Peter Verhage
+ def test_namespace_Peter
+ source = <<-EOF
+ <?xml version="1.0"?>
+ <config:myprog-config xmlns:config="http://someurl/program/version">
+ <!-- main options -->
+ <config:main>
+ <config:parameter name="name" value="value"/>
+ </config:main>
+ </config:myprog-config>
+ EOF
+ doc = REXML::Document.new source
+ assert_equal "myprog-config", doc.root.name
+ count = 0
+ REXML::XPath.each(doc, "x:myprog-config/x:main/x:parameter",
+ {"x"=>"http://someurl/program/version"}) { |element|
+ assert_equal "name", element.attributes["name"]
+ count += 1;
+ }
+ assert_equal 1, count
+ assert_equal "myprog-config", doc.elements["config:myprog-config"].name
+ end
- # Tobias Reif <tobiasreif@pinkjuice.com>
- def test_complex_xpath_Tobias
- source = <<-EOF
- <root>
- <foo>
- <bar style="baz"/>
- <blah style="baz"/>
- <blam style="baz"/>
- </foo>
- <wax>
- <fudge>
- <noodle/>
- </fudge>
- </wax>
- </root>
- EOF
- # elements that have child elements
- # but not grandchildren
- # and not children that don't have a style attribute
- # and not children that have a unique style attribute
- complex_path = "*[* "+
- "and not(*/node()) "+
- "and not(*[not(@style)]) "+
- "and not(*/@style != */@style)]"
- doc = REXML::Document.new source
- results = REXML::XPath.match( doc.root, complex_path )
- assert(results)
- assert_equal 1, results.size
- assert_equal "foo", results[0].name
- end
+ # Tobias Reif <tobiasreif@pinkjuice.com>
+ def test_complex_xpath_Tobias
+ source = <<-EOF
+ <root>
+ <foo>
+ <bar style="baz"/>
+ <blah style="baz"/>
+ <blam style="baz"/>
+ </foo>
+ <wax>
+ <fudge>
+ <noodle/>
+ </fudge>
+ </wax>
+ </root>
+ EOF
+ # elements that have child elements
+ # but not grandchildren
+ # and not children that don't have a style attribute
+ # and not children that have a unique style attribute
+ complex_path = "*[* "+
+ "and not(*/node()) "+
+ "and not(*[not(@style)]) "+
+ "and not(*/@style != */@style)]"
+ doc = REXML::Document.new source
+ results = REXML::XPath.match( doc.root, complex_path )
+ assert(results)
+ assert_equal 1, results.size
+ assert_equal "foo", results[0].name
+ end
- # "Chris Morris" <chrismo@charter.net>
- def test_extra_newline_on_read_Chris
- text = 'test text'
- e = REXML::Element.new('Test')
- e.add_text(text)
- REXML::Formatters::Default.new.write(e,out="")
+ # "Chris Morris" <chrismo@charter.net>
+ def test_extra_newline_on_read_Chris
+ text = 'test text'
+ e = REXML::Element.new('Test')
+ e.add_text(text)
+ REXML::Formatters::Default.new.write(e,out="")
- doc = REXML::Document.new(out)
- outtext = doc.root.text
+ doc = REXML::Document.new(out)
+ outtext = doc.root.text
- assert_equal(text, outtext)
- end
+ assert_equal(text, outtext)
+ end
- # Tobias Reif <tobiasreif@pinkjuice.com>
- def test_other_xpath_Tobias
- schema = <<-DELIM
- <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
- elementFormDefault="qualified">
- <xs:element name="rect">
- <xs:complexType>
- <xs:attribute name="width" type="xs:byte" use="required"/>
- <xs:attribute name="height" type="xs:byte" use="required"/>
- </xs:complexType>
- </xs:element>
- <xs:element name="svg">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="rect"/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:schema>
- DELIM
-
- doc = REXML::Document.new schema
-
- result = REXML::XPath.first(doc.root, 'xs:element[descendant::xs:element[@ref]]')
- assert result
- assert_equal "svg", result.attributes['name']
- result = REXML::XPath.first(doc, 'element[descendant::element[@ref]]')
- assert_nil result
- end
+ # Tobias Reif <tobiasreif@pinkjuice.com>
+ def test_other_xpath_Tobias
+ schema = <<-DELIM
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified">
+ <xs:element name="rect">
+ <xs:complexType>
+ <xs:attribute name="width" type="xs:byte" use="required"/>
+ <xs:attribute name="height" type="xs:byte" use="required"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="svg">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="rect"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ DELIM
+
+ doc = REXML::Document.new schema
+
+ result = REXML::XPath.first(doc.root, 'xs:element[descendant::xs:element[@ref]]')
+ assert result
+ assert_equal "svg", result.attributes['name']
+ result = REXML::XPath.first(doc, 'element[descendant::element[@ref]]')
+ assert_nil result
+ end
- #this first test succeeds, to check if stuff is set up correctly
- def test_xpath_01_TobiasReif
- doc = Document.new XML_STRING_01.dup
- desired_result = Document.new '<author>Thomas, David; Hunt, Andrew</author>'
- xpath = '//author'
- result = XPath.first(doc, xpath)
- assert_equal desired_result.to_s, result.to_s
- end
+ #this first test succeeds, to check if stuff is set up correctly
+ def test_xpath_01_TobiasReif
+ doc = Document.new XML_STRING_01.dup
+ desired_result = Document.new '<author>Thomas, David; Hunt, Andrew</author>'
+ xpath = '//author'
+ result = XPath.first(doc, xpath)
+ assert_equal desired_result.to_s, result.to_s
+ end
- def test_xpath_whitespace_TobiasReif
- # same as above, with whitespace in XPath
- doc = Document.new(XML_STRING_01.dup)
- desired_result = Document.new('<author>Thomas, David; Hunt, Andrew</author>')
- xpath = "\/\/author\n \n"
- result = XPath.first(doc, xpath)
- failure_message = "\n[[[TR: AFAIK, whitespace should be allowed]]]\n"
- assert_equal(desired_result.to_s, result.to_s, failure_message)
- end
+ def test_xpath_whitespace_TobiasReif
+ # same as above, with whitespace in XPath
+ doc = Document.new(XML_STRING_01.dup)
+ desired_result = Document.new('<author>Thomas, David; Hunt, Andrew</author>')
+ xpath = "\/\/author\n \n"
+ result = XPath.first(doc, xpath)
+ failure_message = "\n[[[TR: AFAIK, whitespace should be allowed]]]\n"
+ assert_equal(desired_result.to_s, result.to_s, failure_message)
+ end
- def test_xpath_02_TobiasReif
- doc = Document.new XML_STRING_01.dup
- desired_result = Document.new '<author>Thomas, David; Hunt, Andrew</author>'
- # Could that quirky
- # Programmer',&quot;'&quot;,'s
- # be handled automatically, somehow?
- # Or is there a simpler way? (the below XPath should match the author element above,
- # AFAIK; I tested it inside an XSLT)
- xpath = %q{/biblio/entry[
- title/text()=concat('Programming Ruby. The Pragmatic Programmer',"'",'s Guide')
- and
- year='2000'
- ]/author}
- result = XPath.first(doc, xpath)
- failure_message = "\nHow to handle the apos inside the string inside the XPath?\nXPath = #{xpath}\n"
- assert_equal desired_result.to_s, result.to_s, failure_message
- end
+ def test_xpath_02_TobiasReif
+ doc = Document.new XML_STRING_01.dup
+ desired_result = Document.new '<author>Thomas, David; Hunt, Andrew</author>'
+ # Could that quirky
+ # Programmer',&quot;'&quot;,'s
+ # be handled automatically, somehow?
+ # Or is there a simpler way? (the below XPath should match the author element above,
+ # AFAIK; I tested it inside an XSLT)
+ xpath = %q{/biblio/entry[
+ title/text()=concat('Programming Ruby. The Pragmatic Programmer',"'",'s Guide')
+ and
+ year='2000'
+ ]/author}
+ result = XPath.first(doc, xpath)
+ failure_message = "\nHow to handle the apos inside the string inside the XPath?\nXPath = #{xpath}\n"
+ assert_equal desired_result.to_s, result.to_s, failure_message
+ end
- def test_xpath_03_TobiasReif
- doc = Document.new XML_STRING_02.dup
- desired_result_string = "<entry type='Book'>
+ def test_xpath_03_TobiasReif
+ doc = Document.new XML_STRING_02.dup
+ desired_result_string = "<entry type='Book'>
<language>english</language>
<publisher>Addison-Wesley</publisher>
<title>Programming Ruby. The Pragmatic Programmer's Guide</title>
<type>Book</type>
<year>2000</year>
</entry>"
- Document.new desired_result_string
- xpath = "/biblio/entry[not(author)]"
- result = XPath.first(doc, xpath)
- assert_equal desired_result_string, result.to_s
- end
-
- def test_umlaut
- koln_iso = "K\xf6ln"
- koln_utf = "K\xc3\xb6ln"
- source_iso = "<?xml version='1.0' encoding='ISO-8859-1'?><test>#{koln_iso}</test>"
- source_utf = "<?xml version='1.0' encoding='UTF-8'?><test>#{koln_utf}</test>"
-
- if String.method_defined? :encode
- koln_iso.force_encoding('iso-8859-1')
- koln_utf.force_encoding('utf-8')
- source_iso.force_encoding('iso-8859-1')
- source_utf.force_encoding('utf-8')
+ Document.new desired_result_string
+ xpath = "/biblio/entry[not(author)]"
+ result = XPath.first(doc, xpath)
+ assert_equal desired_result_string, result.to_s
end
- doc = REXML::Document.new(source_iso)
- assert_equal('ISO-8859-1', doc.xml_decl.encoding)
- assert_equal(koln_utf, doc.root.text)
- doc.write(out="")
- assert_equal(source_iso, out )
- doc.xml_decl.encoding = 'UTF-8'
- doc.write(out="")
- assert_equal(source_utf, out)
+ def test_umlaut
+ koln_iso = "K\xf6ln"
+ koln_utf = "K\xc3\xb6ln"
+ source_iso = "<?xml version='1.0' encoding='ISO-8859-1'?><test>#{koln_iso}</test>"
+ source_utf = "<?xml version='1.0' encoding='UTF-8'?><test>#{koln_utf}</test>"
+
+ if String.method_defined? :encode
+ koln_iso.force_encoding('iso-8859-1')
+ koln_utf.force_encoding('utf-8')
+ source_iso.force_encoding('iso-8859-1')
+ source_utf.force_encoding('utf-8')
+ end
+
+ doc = REXML::Document.new(source_iso)
+ assert_equal('ISO-8859-1', doc.xml_decl.encoding)
+ assert_equal(koln_utf, doc.root.text)
+ doc.write(out="")
+ assert_equal(source_iso, out )
+ doc.xml_decl.encoding = 'UTF-8'
+ doc.write(out="")
+ assert_equal(source_utf, out)
- doc = Document.new <<-EOF
+ doc = Document.new <<-EOF
<?xml version="1.0" encoding="ISO-8859-1"?>
<intranet>
<position><aktuell datum="01-10-11">Technik</aktuell></position>
@@ -265,254 +266,255 @@ Die Technik ist das R\xFCckgrat der meisten Gesch\xFCftsprozesse bei Home of the
</nebenspalte>
</intranet>
EOF
- tn = XPath.first(doc, "//nebenspalte/text()[2]")
- expected_iso = "N\xFCtzliches von Flashern f\xFCr Flasher."
- expected_utf = expected_iso.unpack('C*').pack('U*')
- expected_iso.force_encoding(::Encoding::ISO_8859_1)
- expected_utf.force_encoding(::Encoding::UTF_8)
- assert_equal(expected_utf, tn.to_s.strip)
- f = REXML::Formatters::Default.new
- f.write( tn, Output.new(o = "", "ISO-8859-1") )
- assert_equal(expected_iso, o.strip)
-
- doc = Document.new File.new(fixture_path('xmlfile-bug.xml'))
- tn = XPath.first(doc, "//nebenspalte/text()[2]")
- assert_equal(expected_utf, tn.to_s.strip)
- f.write( tn, Output.new(o = "", "ISO-8859-1") )
- assert_equal(expected_iso, o.strip)
- end
+ tn = XPath.first(doc, "//nebenspalte/text()[2]")
+ expected_iso = "N\xFCtzliches von Flashern f\xFCr Flasher."
+ expected_utf = expected_iso.unpack('C*').pack('U*')
+ expected_iso.force_encoding(::Encoding::ISO_8859_1)
+ expected_utf.force_encoding(::Encoding::UTF_8)
+ assert_equal(expected_utf, tn.to_s.strip)
+ f = REXML::Formatters::Default.new
+ f.write( tn, Output.new(o = "", "ISO-8859-1") )
+ assert_equal(expected_iso, o.strip)
+
+ doc = File.open(fixture_path('xmlfile-bug.xml')) {|file| Document.new file }
+ tn = XPath.first(doc, "//nebenspalte/text()[2]")
+ assert_equal(expected_utf, tn.to_s.strip)
+ f.write( tn, Output.new(o = "", "ISO-8859-1") )
+ assert_equal(expected_iso, o.strip)
+ end
- def test_element_cloning_namespace_Chris
- aDoc = REXML::Document.new '<h1 tpl:content="title" xmlns:tpl="1">Dummy title</h1>'
+ def test_element_cloning_namespace_Chris
+ aDoc = REXML::Document.new '<h1 tpl:content="title" xmlns:tpl="1">Dummy title</h1>'
- anElement = anElement = aDoc.elements[1]
- elementAttrPrefix = anElement.attributes.get_attribute('content').prefix
+ anElement = anElement = aDoc.elements[1]
+ elementAttrPrefix = anElement.attributes.get_attribute('content').prefix
- aClone = anElement.clone
- cloneAttrPrefix = aClone.attributes.get_attribute('content').prefix
+ aClone = anElement.clone
+ cloneAttrPrefix = aClone.attributes.get_attribute('content').prefix
- assert_equal( elementAttrPrefix , cloneAttrPrefix )
- end
-
- def test_namespaces_in_attlist_tobias
- in_string = File.open(fixture_path('foo.xml'), 'r') do |file|
- file.read
+ assert_equal( elementAttrPrefix , cloneAttrPrefix )
end
- doc = Document.new in_string
+ def test_namespaces_in_attlist_tobias
+ in_string = File.open(fixture_path('foo.xml'), 'r') do |file|
+ file.read
+ end
- assert_nil XPath.first(doc,'//leg')
- assert_equal 'http://www.foo.com/human', doc.root.elements[1].namespace
- assert_equal 'human leg',
- XPath.first(doc, '//x:leg/text()', {'x'=>'http://www.foo.com/human'}).to_s
- end
+ doc = Document.new in_string
- # Alun ap Rhisiart
- def test_less_than_in_element_content
- source = File.new(fixture_path('ProductionSupport.xml'))
- h = Hash.new
- doc = REXML::Document.new source
- doc.elements.each("//CommonError") { |el|
- h[el.elements['Key'].text] = 'okay'
- }
- assert(h.include?('MotorInsuranceContract(Object)>>#error:'))
- end
+ assert_nil XPath.first(doc,'//leg')
+ assert_equal 'http://www.foo.com/human', doc.root.elements[1].namespace
+ assert_equal 'human leg',
+ XPath.first(doc, '//x:leg/text()', {'x'=>'http://www.foo.com/human'}).to_s
+ end
- # XPaths provided by Thomas Sawyer
- def test_various_xpath
- #@doc = REXML::Document.new('<r a="1"><p><c b="2"/></p></r>')
- doc = REXML::Document.new('<r a="1"><p><c b="2">3</c></p></r>')
-
- [['/r', REXML::Element],
- ['/r/p/c', REXML::Element],
- ['/r/attribute::a', Attribute],
- ['/r/@a', Attribute],
- ['/r/attribute::*', Attribute],
- ['/r/@*', Attribute],
- ['/r/p/c/attribute::b', Attribute],
- ['/r/p/c/@b', Attribute],
- ['/r/p/c/attribute::*', Attribute],
- ['/r/p/c/@*', Attribute],
- ['//c/attribute::b', Attribute],
- ['//c/@b', Attribute],
- ['//c/attribute::*', Attribute],
- ['//c/@*', Attribute],
- ['.//node()', REXML::Node ],
- ['.//node()[@a]', REXML::Element ],
- ['.//node()[@a="1"]', REXML::Element ],
- ['.//node()[@b]', REXML::Element ], # no show, why?
- ['.//node()[@b="2"]', REXML::Element ]
- ].each do |xpath,kind|
- begin
- REXML::XPath.each( doc, xpath ) do |what|
- assert_kind_of( kind, what, "\n\nWrong type (#{what.class}) returned for #{xpath} (expected #{kind.name})\n\n" )
- end
- rescue Exception
- puts "PATH WAS: #{xpath}"
- raise
+ # Alun ap Rhisiart
+ def test_less_than_in_element_content
+ doc = File.open(fixture_path('ProductionSupport.xml')) do |source|
+ REXML::Document.new source
end
+ h = Hash.new
+ doc.elements.each("//CommonError") { |el|
+ h[el.elements['Key'].text] = 'okay'
+ }
+ assert(h.include?('MotorInsuranceContract(Object)>>#error:'))
end
- [
- ['/r', 'attribute::a', Attribute ],
- ['/r', '@a', Attribute ],
- ['/r', 'attribute::*', Attribute ],
- ['/r', '@*', Attribute ],
- ['/r/p/c', 'attribute::b', Attribute ],
- ['/r/p/c', '@b', Attribute ],
- ['/r/p/c', 'attribute::*', Attribute ],
- ['/r/p/c', '@*', Attribute ]
- ].each do |nodepath, xpath, kind|
- begin
- context = REXML::XPath.first(doc, nodepath)
- REXML::XPath.each( context, xpath ) do |what|
- assert_kind_of kind, what, "Wrong type (#{what.class}) returned for #{xpath} (expected #{kind.name})\n"
+ # XPaths provided by Thomas Sawyer
+ def test_various_xpath
+ #@doc = REXML::Document.new('<r a="1"><p><c b="2"/></p></r>')
+ doc = REXML::Document.new('<r a="1"><p><c b="2">3</c></p></r>')
+
+ [['/r', REXML::Element],
+ ['/r/p/c', REXML::Element],
+ ['/r/attribute::a', Attribute],
+ ['/r/@a', Attribute],
+ ['/r/attribute::*', Attribute],
+ ['/r/@*', Attribute],
+ ['/r/p/c/attribute::b', Attribute],
+ ['/r/p/c/@b', Attribute],
+ ['/r/p/c/attribute::*', Attribute],
+ ['/r/p/c/@*', Attribute],
+ ['//c/attribute::b', Attribute],
+ ['//c/@b', Attribute],
+ ['//c/attribute::*', Attribute],
+ ['//c/@*', Attribute],
+ ['.//node()', REXML::Node ],
+ ['.//node()[@a]', REXML::Element ],
+ ['.//node()[@a="1"]', REXML::Element ],
+ ['.//node()[@b]', REXML::Element ], # no show, why?
+ ['.//node()[@b="2"]', REXML::Element ]
+ ].each do |xpath,kind|
+ begin
+ REXML::XPath.each( doc, xpath ) do |what|
+ assert_kind_of( kind, what, "\n\nWrong type (#{what.class}) returned for #{xpath} (expected #{kind.name})\n\n" )
+ end
+ rescue Exception
+ puts "PATH WAS: #{xpath}"
+ raise
end
- rescue Exception
- puts "PATH WAS: #{xpath}"
- raise
end
- end
- end
- def test_entities_Holden_Glova
- document = <<-EOL
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE rubynet [
- <!ENTITY rbconfig.MAJOR "1">
- <!ENTITY rbconfig.MINOR "7">
- <!ENTITY rbconfig.TEENY "2">
- <!ENTITY rbconfig.ruby_version "&rbconfig.MAJOR;.&rbconfig.MINOR;">
- <!ENTITY rbconfig.arch "i386-freebsd5">
- <!ENTITY rbconfig.prefix "/usr/local">
- <!ENTITY rbconfig.libdir "&rbconfig.prefix;/lib">
- <!ENTITY rbconfig.includedir "&rbconfig.prefix;/include">
- <!ENTITY rbconfig.sitedir "&rbconfig.prefix;/lib/ruby/site_ruby">
- <!ENTITY rbconfig.sitelibdir "&rbconfig.sitedir;/&rbconfig.ruby_version;">
- <!ENTITY rbconfig.sitearchdir "&rbconfig.sitelibdir;/&rbconfig.arch;">
- ]>
- <rubynet>
- <pkg version="version1.0">
- <files>
- <file>
- <filename>uga.rb</filename>
- <mode>0444</mode>
- <path>&rbconfig.libdir;/rexml</path>
- <content encoding="xml">... the file here</content>
- </file>
- <file>
- <filename>booga.h</filename>
- <mode>0444</mode>
- <path>&rbconfig.includedir;</path>
- <content encoding="xml">... the file here</content>
- </file>
- <file>
- <filename>foo.so</filename>
- <mode>0555</mode>
- <path>&rbconfig.sitearchdir;/rexml</path>
- <content encoding="mime64">Li4uIHRoZSBmaWxlIGhlcmU=\n</content>
- </file>
- </files>
- </pkg>
- </rubynet>
- EOL
-
- file_xpath = '/rubynet/pkg/files/file'
-
- root = REXML::Document.new(document)
-
- root.elements.each(file_xpath) do |metadata|
- text = metadata.elements['path'].get_text.value
- assert text !~ /&rbconfig/, "'#{text}' failed"
+ [
+ ['/r', 'attribute::a', Attribute ],
+ ['/r', '@a', Attribute ],
+ ['/r', 'attribute::*', Attribute ],
+ ['/r', '@*', Attribute ],
+ ['/r/p/c', 'attribute::b', Attribute ],
+ ['/r/p/c', '@b', Attribute ],
+ ['/r/p/c', 'attribute::*', Attribute ],
+ ['/r/p/c', '@*', Attribute ]
+ ].each do |nodepath, xpath, kind|
+ begin
+ context = REXML::XPath.first(doc, nodepath)
+ REXML::XPath.each( context, xpath ) do |what|
+ assert_kind_of kind, what, "Wrong type (#{what.class}) returned for #{xpath} (expected #{kind.name})\n"
+ end
+ rescue Exception
+ puts "PATH WAS: #{xpath}"
+ raise
+ end
+ end
end
- #Error occurred in test_package_file_opens(TC_PackageInstall):
- # ArgumentError:
- #illegal access mode &rbconfig.prefix;/lib/rexml
- #
- #[synack@Evergreen] src $ ruby --version
- #ruby 1.6.7 (2002-03-01) [i686-linux-gnu]
- #
- #It looks like it expanded the first entity, but didn't reparse it for more
- #entities. possible bug - or have I mucked this up?
- end
+ def test_entities_Holden_Glova
+ document = <<-EOL
+ <?xml version="1.0" encoding="UTF-8"?>
+ <!DOCTYPE rubynet [
+ <!ENTITY rbconfig.MAJOR "1">
+ <!ENTITY rbconfig.MINOR "7">
+ <!ENTITY rbconfig.TEENY "2">
+ <!ENTITY rbconfig.ruby_version "&rbconfig.MAJOR;.&rbconfig.MINOR;">
+ <!ENTITY rbconfig.arch "i386-freebsd5">
+ <!ENTITY rbconfig.prefix "/usr/local">
+ <!ENTITY rbconfig.libdir "&rbconfig.prefix;/lib">
+ <!ENTITY rbconfig.includedir "&rbconfig.prefix;/include">
+ <!ENTITY rbconfig.sitedir "&rbconfig.prefix;/lib/ruby/site_ruby">
+ <!ENTITY rbconfig.sitelibdir "&rbconfig.sitedir;/&rbconfig.ruby_version;">
+ <!ENTITY rbconfig.sitearchdir "&rbconfig.sitelibdir;/&rbconfig.arch;">
+ ]>
+ <rubynet>
+ <pkg version="version1.0">
+ <files>
+ <file>
+ <filename>uga.rb</filename>
+ <mode>0444</mode>
+ <path>&rbconfig.libdir;/rexml</path>
+ <content encoding="xml">... the file here</content>
+ </file>
+ <file>
+ <filename>booga.h</filename>
+ <mode>0444</mode>
+ <path>&rbconfig.includedir;</path>
+ <content encoding="xml">... the file here</content>
+ </file>
+ <file>
+ <filename>foo.so</filename>
+ <mode>0555</mode>
+ <path>&rbconfig.sitearchdir;/rexml</path>
+ <content encoding="mime64">Li4uIHRoZSBmaWxlIGhlcmU=\n</content>
+ </file>
+ </files>
+ </pkg>
+ </rubynet>
+ EOL
+
+ file_xpath = '/rubynet/pkg/files/file'
+
+ root = REXML::Document.new(document)
+
+ root.elements.each(file_xpath) do |metadata|
+ text = metadata.elements['path'].get_text.value
+ assert text !~ /&rbconfig/, "'#{text}' failed"
+ end
+
+ #Error occurred in test_package_file_opens(TC_PackageInstall):
+ # ArgumentError:
+ #illegal access mode &rbconfig.prefix;/lib/rexml
+ #
+ #[synack@Evergreen] src $ ruby --version
+ #ruby 1.6.7 (2002-03-01) [i686-linux-gnu]
+ #
+ #It looks like it expanded the first entity, but didn't reparse it for more
+ #entities. possible bug - or have I mucked this up?
+ end
- def test_whitespace_after_xml_decl
- Document.new <<EOL
+ def test_whitespace_after_xml_decl
+ Document.new <<EOL
<?xml version='1.0'?>
<blo>
<wak>
</wak>
</blo>
EOL
- end
+ end
- def test_external_entity
- xp = '//channel/title'
+ def test_external_entity
+ xp = '//channel/title'
- %w{working.rss broken.rss}.each do |path|
- File.open(File.join(fixture_path(path))) do |file|
- doc = REXML::Document.new file.readlines.join('')
+ %w{working.rss broken.rss}.each do |path|
+ File.open(File.join(fixture_path(path))) do |file|
+ doc = REXML::Document.new file.readlines.join('')
- # check to make sure everything is kosher
- assert_equal( doc.root.class, REXML::Element )
- assert_equal( doc.root.elements.class, REXML::Elements )
+ # check to make sure everything is kosher
+ assert_equal( doc.root.class, REXML::Element )
+ assert_equal( doc.root.elements.class, REXML::Elements )
- # get the title of the feed
- assert( doc.root.elements[xp].kind_of?( REXML::Element ) )
+ # get the title of the feed
+ assert( doc.root.elements[xp].kind_of?( REXML::Element ) )
+ end
end
end
- end
- def test_maintain_dtd
- src = %q{<?xml version="1.0" encoding="UTF-8"?>
+ def test_maintain_dtd
+ src = %q{<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ivattacks SYSTEM "../../ivacm.dtd" [
<!ENTITY % extern-packages SYSTEM "../../ivpackages.dtd">
<!ENTITY % extern-packages SYSTEM "../../common-declarations.dtd">
%extern-packages;
%extern-common;
]>}
- doc = Document.new( src )
- doc.write( out="" )
- src = src.tr('"', "'")
- out = out.tr('"', "'")
- assert_equal( src, out )
- end
+ doc = Document.new( src )
+ doc.write( out="" )
+ src = src.tr('"', "'")
+ out = out.tr('"', "'")
+ assert_equal( src, out )
+ end
- def test_text_nodes_nomatch
- source = "<root><child>test</child></root>"
- d = REXML::Document.new( source )
- r = REXML::XPath.match( d, %q{/root/child[text()="no-test"]} )
- assert_equal( 0, r.size )
- end
+ def test_text_nodes_nomatch
+ source = "<root><child>test</child></root>"
+ d = REXML::Document.new( source )
+ r = REXML::XPath.match( d, %q{/root/child[text()="no-test"]} )
+ assert_equal( 0, r.size )
+ end
- def test_raw_Terje_Elde
- f = REXML::Formatters::Default.new
- txt = 'abc&#248;def'
- a = Text.new( txt,false,nil,true )
- f.write(a,out="")
- assert_equal( txt, out )
-
- txt = '<sean><russell>abc&#248;def</russell></sean>'
- a = Document.new( txt, { :raw => ["russell"] } )
- f.write(a,out="")
- assert_equal( txt, out )
- end
+ def test_raw_Terje_Elde
+ f = REXML::Formatters::Default.new
+ txt = 'abc&#248;def'
+ a = Text.new( txt,false,nil,true )
+ f.write(a,out="")
+ assert_equal( txt, out )
+
+ txt = '<sean><russell>abc&#248;def</russell></sean>'
+ a = Document.new( txt, { :raw => ["russell"] } )
+ f.write(a,out="")
+ assert_equal( txt, out )
+ end
- def test_indenting_error
- a=Element.new("test1")
- b=Element.new("test2")
- c=Element.new("test3")
- b << c
- a << b
+ def test_indenting_error
+ a=Element.new("test1")
+ b=Element.new("test2")
+ c=Element.new("test3")
+ b << c
+ a << b
- REXML::Formatters::Pretty.new.write(a,"")
- end
+ REXML::Formatters::Pretty.new.write(a,"")
+ end
- def test_pos
- require 'tempfile'
- testfile = Tempfile.new("tidal")
- testdata = %Q{<calibration>
+ def test_pos
+ require 'tempfile'
+ Tempfile.create("tidal") {|testfile|
+ testdata = %Q{<calibration>
<section name="parameters">
<param name="barpress">760</param>
<param name="hertz">50</param>
@@ -520,62 +522,63 @@ EOL
</calibration>
}
- testfile.puts testdata
- testfile.rewind
- assert_nothing_raised do
- REXML::Document.new(testfile)
+ testfile.puts testdata
+ testfile.rewind
+ assert_nothing_raised do
+ REXML::Document.new(testfile)
+ end
+ }
end
- testfile.close(true)
- end
- def test_deep_clone
- a = Document.new( '<?xml version="1.0"?><!DOCTYPE html PUBLIC
- "-//W3C//DTD
- XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html
- xmlns="http:///www.w3.org/1999/xhtml"></html>' )
- b = a.deep_clone
- assert_equal a.to_s, b.to_s
- end
+ def test_deep_clone
+ a = Document.new( '<?xml version="1.0"?><!DOCTYPE html PUBLIC
+ "-//W3C//DTD
+ XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html
+ xmlns="http:///www.w3.org/1999/xhtml"></html>' )
+ b = a.deep_clone
+ assert_equal a.to_s, b.to_s
+ end
- def test_double_escaping
- data = '<title>AT&amp;T</title>'
- xml = "<description><![CDATA[#{data}]]></description>"
+ def test_double_escaping
+ data = '<title>AT&amp;T</title>'
+ xml = "<description><![CDATA[#{data}]]></description>"
- doc = REXML::Document.new(xml)
- description = doc.find {|e| e.name=="description"}
- assert_equal data, description.text
- end
+ doc = REXML::Document.new(xml)
+ description = doc.find {|e| e.name=="description"}
+ assert_equal data, description.text
+ end
- def test_ticket_12
- cfg = "<element><anotherelement><child1>a</child1><child2>b</child2></anotherelement></element>"
+ def test_ticket_12
+ cfg = "<element><anotherelement><child1>a</child1><child2>b</child2></anotherelement></element>"
- config = REXML::Document.new( cfg )
+ config = REXML::Document.new( cfg )
- assert_equal( "a", config.elements[ "//child1" ].text )
- end
+ assert_equal( "a", config.elements[ "//child1" ].text )
+ end
=begin
- # This is a silly test, and is low priority
- def test_namespace_serialization_tobi_reif
- doc = Document.new '<doc xmlns:b="http://www.foo.foo">
- <b:p/>
-</doc>'
- ns = 'http://www.foo.foo'
- ns_declaration={'f'=>ns}
- returned = XPath.match(doc,'//f:p',ns_declaration)
- # passes:
- assert( (returned[0].namespace==ns), 'namespace should be '+ns)
- serialized = returned.to_s
- serialized_and_parsed = Document.new(serialized)
- puts 'serialized: '+serialized
- # ... currently brings <b:p/>
- # prefix b is undeclared (!)
- assert( (serialized_and_parsed.namespace==ns),
- 'namespace should still be '+ns.inspect+
- ' and not '+serialized_and_parsed.namespace.inspect)
- # ... currently results in a failure:
- # 'namespace should still be "http://www.foo.foo" and not ""'
- end
+ # This is a silly test, and is low priority
+ def test_namespace_serialization_tobi_reif
+ doc = Document.new '<doc xmlns:b="http://www.foo.foo">
+ <b:p/>
+ </doc>'
+ ns = 'http://www.foo.foo'
+ ns_declaration={'f'=>ns}
+ returned = XPath.match(doc,'//f:p',ns_declaration)
+ # passes:
+ assert( (returned[0].namespace==ns), 'namespace should be '+ns)
+ serialized = returned.to_s
+ serialized_and_parsed = Document.new(serialized)
+ puts 'serialized: '+serialized
+ # ... currently brings <b:p/>
+ # prefix b is undeclared (!)
+ assert( (serialized_and_parsed.namespace==ns),
+ 'namespace should still be '+ns.inspect+
+ ' and not '+serialized_and_parsed.namespace.inspect)
+ # ... currently results in a failure:
+ # 'namespace should still be "http://www.foo.foo" and not ""'
+ end
=end
+ end
end
diff --git a/test/rexml/test_core.rb b/test/rexml/test_core.rb
index 0865aa9747..97aada9104 100644
--- a/test/rexml/test_core.rb
+++ b/test/rexml/test_core.rb
@@ -1,6 +1,6 @@
# coding: binary
-require "rexml_test_utils"
+require_relative "rexml_test_utils"
require "rexml/document"
require "rexml/parseexception"
@@ -9,1167 +9,1171 @@ require "rexml/source"
require "rexml/formatters/pretty"
require "rexml/undefinednamespaceexception"
-require "listener"
-
-class Tester < Test::Unit::TestCase
- include REXMLTestUtils
- include REXML
- def setup
- @xsa_source = <<-EOL
- <?xml version="1.0"?>
- <?xsl stylesheet="blah.xsl"?>
- <!-- The first line tests the XMLDecl, the second tests PI.
- The next line tests DocType. This line tests comments. -->
- <!DOCTYPE xsa PUBLIC
- "-//LM Garshol//DTD XML Software Autoupdate 1.0//EN//XML"
- "http://www.garshol.priv.no/download/xsa/xsa.dtd">
-
- <xsa>
- <vendor id="blah">
- <name>Lars Marius Garshol</name>
- <email>larsga@garshol.priv.no</email>
- <url>http://www.stud.ifi.uio.no/~lmariusg/</url>
- </vendor>
- </xsa>
- EOL
- end
+require_relative "listener"
+
+module REXMLTests
+ class Tester < Test::Unit::TestCase
+ include REXMLTestUtils
+ include REXML
+ def setup
+ @xsa_source = <<-EOL
+ <?xml version="1.0"?>
+ <?xsl stylesheet="blah.xsl"?>
+ <!-- The first line tests the XMLDecl, the second tests PI.
+ The next line tests DocType. This line tests comments. -->
+ <!DOCTYPE xsa PUBLIC
+ "-//LM Garshol//DTD XML Software Autoupdate 1.0//EN//XML"
+ "http://www.garshol.priv.no/download/xsa/xsa.dtd">
+
+ <xsa>
+ <vendor id="blah">
+ <name>Lars Marius Garshol</name>
+ <email>larsga@garshol.priv.no</email>
+ <url>http://www.stud.ifi.uio.no/~lmariusg/</url>
+ </vendor>
+ </xsa>
+ EOL
+ end
- def test_bad_markup
- [
- "<pkg='version'> foo </pkg>",
- '<0/>',
- '<a>&</a>',
- '<a>&a</a>',
-# '<a>&a;</a>', # FIXME
- '<a a="<"/>',
- '<a 3="<"/>',
- '<a a="1" a="2"/>',
- '<a><!-- -- --></a>',
- '<a><!-- ---></a>',
- '<a>&#x00;</a>',
- '<a>&#0;</a>',
- "<a a='&#0;' />",
- "<a>\f</a>",
- "<a a='\f' />",
- "<a>\000</a>",
+ def test_bad_markup
+ [
+ "<pkg='version'> foo </pkg>",
+ '<0/>',
+ '<a>&</a>',
+ '<a>&a</a>',
+# '<a>&a;</a>', # FIXME
+ '<a a="<"/>',
+ '<a 3="<"/>',
+ '<a a="1" a="2"/>',
+ '<a><!-- -- --></a>',
+ '<a><!-- ---></a>',
+ '<a>&#x00;</a>',
+ '<a>&#0;</a>',
+ "<a a='&#0;' />",
+ "<a>\f</a>",
+ "<a a='\f' />",
+ "<a>\000</a>",
# FIXME '<a' + [65535].pack('U') + ' />',
- '<a>&#xfffe;</a>',
- '<a>&#65535;</a>',
+ '<a>&#xfffe;</a>',
+ '<a>&#65535;</a>',
# FIXME '<a' + [0x0371].pack('U') + ' />',
# FIXME '<a a' + [0x0371].pack('U') + '="" />',
- ].each do |src|
- assert_raise( ParseException, %Q{Parse #{src.inspect} should have failed!} ) do
- Document.new(src)
+ ].each do |src|
+ assert_raise( ParseException, %Q{Parse #{src.inspect} should have failed!} ) do
+ Document.new(src)
+ end
end
end
- end
- def test_attribute
- # Testing constructors
- #a = Attribute.new "hello", "dolly"
- #b = Attribute.new a
- #d = Document.new( "<a hello='dolly' href='blah'/>" )
- #c = d[0].attributes.get_attribute( "hello" )
-
- #assert_equal a, b
- #for attr in [ a, b, c]
- # assert_equal "hello", attr.name
- # assert_equal "dolly", attr.value
- #end
-
- # This because of a reported bug in attribute handling in 1.0a8
- source = '<a att="A">blah</a>'
- doc = Document.new source
- doc.elements.each do |a|
- a.attributes['att'] << 'B'
- assert_equal "AB", a.attributes['att']
- a.attributes['att'] = 'C'
- assert_equal "C", a.attributes['att']
- end
-
- # Bryan Murphy <murphybryanp@yahoo.com>
- text = "this is a {target[@name='test']/@value} test"
- source = <<-EOL
- <?xml version="1.0"?>
- <doc search="#{text}"/>
- EOL
-
- xml = Document.new source
- value = xml.root.attributes["search"]
- assert_equal text, value.to_s
-
- e = Element.new "test"
- e.add_attributes({ "name1" => "test1", "name4" => "test4" })
- e.add_attributes([["name3","test3"], ["name2","test2"]])
- assert_equal "test1", e.attributes["name1"]
- assert_equal "test2", e.attributes["name2"]
- assert_equal "test3", e.attributes["name3"]
- assert_equal "test4", e.attributes["name4"]
-
- # ensure that the attributes come out in sorted order
- assert_equal %w(<test
- name1='test1'
- name2='test2'
- name3='test3'
- name4='test4'/>).join(' '), e.to_s
- end
+ def test_attribute
+ # Testing constructors
+ #a = Attribute.new "hello", "dolly"
+ #b = Attribute.new a
+ #d = Document.new( "<a hello='dolly' href='blah'/>" )
+ #c = d[0].attributes.get_attribute( "hello" )
+
+ #assert_equal a, b
+ #for attr in [ a, b, c]
+ # assert_equal "hello", attr.name
+ # assert_equal "dolly", attr.value
+ #end
+
+ # This because of a reported bug in attribute handling in 1.0a8
+ source = '<a att="A">blah</a>'
+ doc = Document.new source
+ doc.elements.each do |a|
+ a.attributes['att'] << 'B'
+ assert_equal "AB", a.attributes['att']
+ a.attributes['att'] = 'C'
+ assert_equal "C", a.attributes['att']
+ end
- def test_cdata
- test = "The quick brown fox jumped
- & < & < \" '
- over the lazy dog."
+ # Bryan Murphy <murphybryanp@yahoo.com>
+ text = "this is a {target[@name='test']/@value} test"
+ source = <<-EOL
+ <?xml version="1.0"?>
+ <doc search="#{text}"/>
+ EOL
+
+ xml = Document.new source
+ value = xml.root.attributes["search"]
+ assert_equal text, value.to_s
+
+ e = Element.new "test"
+ e.add_attributes({ "name1" => "test1", "name4" => "test4" })
+ e.add_attributes([["name3","test3"], ["name2","test2"]])
+ assert_equal "test1", e.attributes["name1"]
+ assert_equal "test2", e.attributes["name2"]
+ assert_equal "test3", e.attributes["name3"]
+ assert_equal "test4", e.attributes["name4"]
+
+ # ensure that the attributes come out in sorted order
+ assert_equal %w(<test
+ name1='test1'
+ name2='test2'
+ name3='test3'
+ name4='test4'/>).join(' '), e.to_s
+ end
- source = "<a><![CDATA[#{test}]]></a>"
- d = REXML::Document.new( source )
+ def test_cdata
+ test = "The quick brown fox jumped
+ & < & < \" '
+ over the lazy dog."
- # Test constructors
- cdata = d[0][0]
- assert_equal test, cdata.value
- end
+ source = "<a><![CDATA[#{test}]]></a>"
+ d = REXML::Document.new( source )
- def test_comment
- string = "This is a new comment!"
- source = "<!--#{string}-->"
- comment = Comment.new string
- REXML::Formatters::Default.new.write( comment, out = "" )
- assert_equal(source, out)
-
- comment2 = Comment.new comment
- assert_equal(comment, comment2)
-
- assert_raise(ParseException) {
- REXML::Document.new("<d><!- foo --></d>")
- }
- assert_raise(ParseException) {
- REXML::Document.new("<d><!-- foo -></d>")
- }
- end
+ # Test constructors
+ cdata = d[0][0]
+ assert_equal test, cdata.value
+ end
- def test_whitespace
- doc = Document.new "<root-element><first-element/></root-element>"
- assert_equal 1, doc.root.size
- assert_equal 1, doc.root.elements.size
- doc = Document.new "<root-element>
- <first-element/>
- </root-element>"
- assert_equal 3, doc.root.size
- assert_equal 1, doc.root.elements.size
-
- text = " This is text
- with a lot of whitespace "
- source = "<a>#{text}<b>#{text}</b><c>#{text}</c>#{text}</a>"
-
- doc = Document.new( source, {
- :respect_whitespace => %w{ a c }
- } )
- assert_equal text, doc.elements["//c"].text
- string = ""
- doc.root.each { |n| string << n.to_s if n.kind_of? Text }
- assert_equal text+text, string
-
- string =" lots of blank
- space"
- doc.root.add_element("d").add_element("c").text = string
- doc.root.add_element("e").text = string
- assert_equal string, doc.elements["/a/d/c"].text
- assert string != doc.elements["/a/e"].text, "Text wasn't properly compressed"
-
- doc = Document.new source, { :respect_whitespace => :all }
- doc.root.add_element("d").text = string
- assert_equal text, doc.root.text
- nxt = ""
- doc.root.each { |n| nxt << n.to_s if n.kind_of? Text }
- assert_equal text+text, nxt
- assert_equal text, doc.root.elements["b"].text
- assert_equal text, doc.root.elements["c"].text
- assert_equal string, doc.root.elements["d"].text
- end
+ def test_comment
+ string = "This is a new comment!"
+ source = "<!--#{string}-->"
+ comment = Comment.new string
+ REXML::Formatters::Default.new.write( comment, out = "" )
+ assert_equal(source, out)
+
+ comment2 = Comment.new comment
+ assert_equal(comment, comment2)
+
+ assert_raise(ParseException) {
+ REXML::Document.new("<d><!- foo --></d>")
+ }
+ assert_raise(ParseException) {
+ REXML::Document.new("<d><!-- foo -></d>")
+ }
+ end
- # This isn't complete. We need to check declarations and comments
- def test_doctype
- string = "something"
- correct = "<!DOCTYPE something>"
- doc = DocType.new(string)
- assert_equal(string, doc.name)
- doc.write(out="")
- assert_equal(correct, out)
-
- doc2 = DocType.new(doc)
- assert_equal(doc.name, doc2.name)
- assert_equal(doc.external_id, doc2.external_id)
-
- correct = '<!DOCTYPE xsa PUBLIC "-//LM Garshol//DTD XML Software Autoupdate 1.0//EN//XML" "http://www.garshol.priv.no/download/xsa/xsa.dtd">'
-
- one_line_source = '<!DOCTYPE xsa PUBLIC "-//LM Garshol//DTD XML Software Autoupdate 1.0//EN//XML" "http://www.garshol.priv.no/download/xsa/xsa.dtd"><a/>'
- doc = Document.new( one_line_source )
- doc = doc[0]
- assert(doc)
- doc.write(test="")
- assert_equal(correct, test)
-
- multi_line_source = '<!DOCTYPE xsa PUBLIC
- "-//LM Garshol//DTD XML Software Autoupdate 1.0//EN//XML"
- "http://www.garshol.priv.no/download/xsa/xsa.dtd">
- <a/>'
- d = Document.new( multi_line_source )
- doc = d[0]
- assert(doc)
- doc.write(test="")
- assert_equal(correct, test)
-
- odd_space_source = ' <!DOCTYPE
- xsa PUBLIC "-//LM Garshol//DTD XML Software Autoupdate 1.0//EN//XML"
- "http://www.garshol.priv.no/download/xsa/xsa.dtd"> <a/>'
- d = Document.new( odd_space_source )
- dt = d.doctype
- dt.write(test="")
- assert_equal(correct, test)
-
- # OK, the BIG doctype test, numba wun
- docin = File.new(fixture_path("doctype_test.xml"))
- doc = Document.new(docin)
- doc.write(test="")
- assert_equal(31, doc.doctype.size)
- end
+ def test_whitespace
+ doc = Document.new "<root-element><first-element/></root-element>"
+ assert_equal 1, doc.root.size
+ assert_equal 1, doc.root.elements.size
+ doc = Document.new "<root-element>
+ <first-element/>
+ </root-element>"
+ assert_equal 3, doc.root.size
+ assert_equal 1, doc.root.elements.size
+
+ text = " This is text
+ with a lot of whitespace "
+ source = "<a>#{text}<b>#{text}</b><c>#{text}</c>#{text}</a>"
+
+ doc = Document.new( source, {
+ :respect_whitespace => %w{ a c }
+ } )
+ assert_equal text, doc.elements["//c"].text
+ string = ""
+ doc.root.each { |n| string << n.to_s if n.kind_of? Text }
+ assert_equal text+text, string
+
+ string =" lots of blank
+ space"
+ doc.root.add_element("d").add_element("c").text = string
+ doc.root.add_element("e").text = string
+ assert_equal string, doc.elements["/a/d/c"].text
+ assert string != doc.elements["/a/e"].text, "Text wasn't properly compressed"
+
+ doc = Document.new source, { :respect_whitespace => :all }
+ doc.root.add_element("d").text = string
+ assert_equal text, doc.root.text
+ nxt = ""
+ doc.root.each { |n| nxt << n.to_s if n.kind_of? Text }
+ assert_equal text+text, nxt
+ assert_equal text, doc.root.elements["b"].text
+ assert_equal text, doc.root.elements["c"].text
+ assert_equal string, doc.root.elements["d"].text
+ end
- def test_document
- # Testing cloning
- source = "<element/>"
- doc = Document.new source
+ # This isn't complete. We need to check declarations and comments
+ def test_doctype
+ string = "something"
+ correct = "<!DOCTYPE something>"
+ doc = DocType.new(string)
+ assert_equal(string, doc.name)
+ doc.write(out="")
+ assert_equal(correct, out)
+
+ doc2 = DocType.new(doc)
+ assert_equal(doc.name, doc2.name)
+ assert_equal(doc.external_id, doc2.external_id)
+
+ correct = '<!DOCTYPE xsa PUBLIC "-//LM Garshol//DTD XML Software Autoupdate 1.0//EN//XML" "http://www.garshol.priv.no/download/xsa/xsa.dtd">'
+
+ one_line_source = '<!DOCTYPE xsa PUBLIC "-//LM Garshol//DTD XML Software Autoupdate 1.0//EN//XML" "http://www.garshol.priv.no/download/xsa/xsa.dtd"><a/>'
+ doc = Document.new( one_line_source )
+ doc = doc[0]
+ assert(doc)
+ doc.write(test="")
+ assert_equal(correct, test)
+
+ multi_line_source = '<!DOCTYPE xsa PUBLIC
+ "-//LM Garshol//DTD XML Software Autoupdate 1.0//EN//XML"
+ "http://www.garshol.priv.no/download/xsa/xsa.dtd">
+ <a/>'
+ d = Document.new( multi_line_source )
+ doc = d[0]
+ assert(doc)
+ doc.write(test="")
+ assert_equal(correct, test)
+
+ odd_space_source = ' <!DOCTYPE
+ xsa PUBLIC "-//LM Garshol//DTD XML Software Autoupdate 1.0//EN//XML"
+ "http://www.garshol.priv.no/download/xsa/xsa.dtd"> <a/>'
+ d = Document.new( odd_space_source )
+ dt = d.doctype
+ dt.write(test="")
+ assert_equal(correct, test)
+
+ # OK, the BIG doctype test, numba wun
+ doc = File.open(fixture_path("doctype_test.xml")) do |docin|
+ Document.new(docin)
+ end
+ doc.write(test="")
+ assert_equal(31, doc.doctype.size)
+ end
- # Testing Root
- assert_equal doc.root.name.to_s, "element"
+ def test_document
+ # Testing cloning
+ source = "<element/>"
+ doc = Document.new source
- # Testing String source
- source = @xsa_source
- doc = Document.new source
- assert_instance_of XMLDecl, doc.xml_decl
- assert_instance_of DocType, doc.doctype
- assert_equal doc.version, "1.0"
+ # Testing Root
+ assert_equal doc.root.name.to_s, "element"
- source = File.new(fixture_path("dash.xml"))
- doc = Document.new source
- assert_equal "content-2", doc.elements["//content-2"].name
- end
+ # Testing String source
+ source = @xsa_source
+ doc = Document.new source
+ assert_instance_of XMLDecl, doc.xml_decl
+ assert_instance_of DocType, doc.doctype
+ assert_equal doc.version, "1.0"
- def test_instruction
- target = "use"
- content = "ruby"
- source = "<?#{target} #{content}?>"
+ doc = File.open(fixture_path("dash.xml")) {|s| Document.new s }
+ assert_equal "content-2", doc.elements["//content-2"].name
+ end
- instruction = Instruction.new target, content
- instruction2 = Instruction.new instruction
- assert_equal(instruction, instruction2)
- REXML::Formatters::Default.new.write( instruction, out = "" )
- assert_equal(source, out)
+ def test_instruction
+ target = "use"
+ content = "ruby"
+ source = "<?#{target} #{content}?>"
- d = Document.new( source )
- instruction2 = d[0]
- assert_equal(instruction.to_s, instruction2.to_s)
+ instruction = Instruction.new target, content
+ instruction2 = Instruction.new instruction
+ assert_equal(instruction, instruction2)
+ REXML::Formatters::Default.new.write( instruction, out = "" )
+ assert_equal(source, out)
- assert_raise(ParseException) {
- REXML::Document.new("<d><?foo bar></d>")
- }
- end
+ d = Document.new( source )
+ instruction2 = d[0]
+ assert_equal(instruction.to_s, instruction2.to_s)
- def test_parent
- parent = Parent.new
- begin
- parent << "Something"
- rescue Exception
- parent << Comment.new("Some comment")
- assert parent.size == 1, "size of parent should be 1"
- else
- assert_fail "should have gotten an exception trying to add a "+ "String to a Parent"
- end
-
- source = "<a><one/><three/><five/></a>"
- doc = Document.new source
- three = doc.root.elements["three"]
- doc.root.insert_before( three, Element.new("two") )
- nxt = doc.root.elements["one"]
- string = ""
- while nxt
- string << nxt.name
- nxt = nxt.next_sibling
- end
- assert_equal "onetwothreefive", string
-
-
- doc.root.insert_after( three, Element.new("four") )
- string = ""
- doc.root.each { |element| string << element.name }
- assert_equal "onetwothreefourfive", string
-
- string = ""
- nxt = doc.root.elements["five"]
- while nxt
- string << nxt.name
- nxt = nxt.previous_sibling
- end
- assert_equal "fivefourthreetwoone", string
-
- doc.insert_after "//two", Element.new("two-and-half")
- string = doc.root.elements.collect {|x| x.name}.join
- assert_equal "onetwotwo-and-halfthreefourfive", string
- doc.elements["/a/five"].insert_before "../four", Element.new("three-and-half")
- string = doc.root.elements.collect {|x| x.name}.join
- assert_equal "onetwotwo-and-halfthreethree-and-halffourfive", string
-
- doc.elements["/a/five"].previous_sibling = Element.new("four-and-half")
- string = doc.root.elements.collect {|x| x.name}.join
- assert_equal "onetwotwo-and-halfthreethree-and-halffourfour-and-halffive", string
- doc.elements["/a/one"].next_sibling = Element.new("one-and-half")
- string = doc.root.elements.collect {|x| x.name}.join
- assert_equal "oneone-and-halftwotwo-and-halfthreethree-and-halffourfour-and-halffive", string
-
- doc = Document.new "<a><one/><three/></a>"
- doc.root[1,0] = Element.new "two"
- string = ""
- doc.root.each { |el| string << el.name }
- assert_equal "onetwothree", string
- end
+ assert_raise(ParseException) {
+ REXML::Document.new("<d><?foo bar></d>")
+ }
+ end
- # The Source classes are tested extensively throughout the test suite
- def test_source
- # Testing string source
- source = @xsa_source
- doc = Document.new source
- assert_equal doc.root.name.to_s, "xsa"
+ def test_parent
+ parent = Parent.new
+ begin
+ parent << "Something"
+ rescue Exception
+ parent << Comment.new("Some comment")
+ assert parent.size == 1, "size of parent should be 1"
+ else
+ assert_fail "should have gotten an exception trying to add a "+ "String to a Parent"
+ end
- # Testing IO source
- doc = Document.new File.new(fixture_path("project.xml"))
- assert_equal doc.root.name.to_s, "Project"
- end
+ source = "<a><one/><three/><five/></a>"
+ doc = Document.new source
+ three = doc.root.elements["three"]
+ doc.root.insert_before( three, Element.new("two") )
+ nxt = doc.root.elements["one"]
+ string = ""
+ while nxt
+ string << nxt.name
+ nxt = nxt.next_sibling
+ end
+ assert_equal "onetwothreefive", string
- def test_text
- f = REXML::Formatters::Default.new
- string = "Some text"
- text = Text.new(string)
- assert_equal(string, text.to_s)
- text2 = Text.new(text)
- assert_equal(text, text2)
- #testing substitution
- string = "0 < ( 1 & 1 )"
- correct = "0 &lt; ( 1 &amp; 1 )"
- text = Text.new(string, true)
- f.write(text,out="")
- assert_equal(correct, out)
-
- string = "Cats &amp; dogs"
- text = Text.new(string, false, nil, true)
- assert_equal(string, text.to_s)
-
- string2 = "<a>#{string}</a>"
- doc = Document.new( string2, {
- :raw => %w{ a b }
- } )
- f.write(doc,out="")
- assert_equal(string2, out)
- b = doc.root.add_element( "b" )
- b.text = string
- assert_equal(string, b.get_text.to_s)
-
- c = doc.root.add_element("c")
- c.text = string
- assert_equal("Cats &amp;amp; dogs", c.get_text.to_s)
-
- # test all
- string = "<a>&amp;<b>&lt;</b><c>&gt;<d>&quot;</d></c></a>"
- doc = Document.new(string, { :raw => :all })
- assert_equal( "&amp;", doc.elements["/a"][0].to_s )
- assert_equal( "&", doc.elements["/a"].text )
- assert_equal( "&lt;", doc.elements["/a/b"][0].to_s )
- assert_equal( "<", doc.elements["/a/b"].text )
- assert_equal( "&gt;", doc.elements["/a/c"][0].to_s )
- assert_equal( ">", doc.elements["/a/c"].text )
- assert_equal( '&quot;', doc.elements["//d"][0].to_s )
- assert_equal( '"', doc.elements["//d"].text )
-
- # test some other stuff
- doc = Document.new('<a><b/></a>')
- doc.root.text = 'Sean'
- assert_equal( '<a><b/>Sean</a>', doc.to_s )
- doc.root.text = 'Elliott'
- assert_equal( '<a><b/>Elliott</a>', doc.to_s )
- doc.root.add_element( 'c' )
- assert_equal( '<a><b/>Elliott<c/></a>', doc.to_s )
- doc.root.text = 'Russell'
- assert_equal( '<a><b/>Russell<c/></a>', doc.to_s )
- doc.root.text = nil
- assert_equal( '<a><b/><c/></a>', doc.to_s )
- end
- def test_text_frozen
- string = "Frozen".freeze
- text = Text.new(string)
- assert_equal(string, text.to_s)
- end
+ doc.root.insert_after( three, Element.new("four") )
+ string = ""
+ doc.root.each { |element| string << element.name }
+ assert_equal "onetwothreefourfive", string
- def test_xmldecl
- source = "<?xml version='1.0'?>"
- # test args
- # test no args
- decl2 = XMLDecl.new
- assert_equal source, decl2.to_s
- # test XMLDecl
- decl2 = XMLDecl.new "1.0"
- assert_equal source, decl2.to_s
- end
+ string = ""
+ nxt = doc.root.elements["five"]
+ while nxt
+ string << nxt.name
+ nxt = nxt.previous_sibling
+ end
+ assert_equal "fivefourthreetwoone", string
+
+ doc.insert_after "//two", Element.new("two-and-half")
+ string = doc.root.elements.collect {|x| x.name}.join
+ assert_equal "onetwotwo-and-halfthreefourfive", string
+ doc.elements["/a/five"].insert_before "../four", Element.new("three-and-half")
+ string = doc.root.elements.collect {|x| x.name}.join
+ assert_equal "onetwotwo-and-halfthreethree-and-halffourfive", string
+
+ doc.elements["/a/five"].previous_sibling = Element.new("four-and-half")
+ string = doc.root.elements.collect {|x| x.name}.join
+ assert_equal "onetwotwo-and-halfthreethree-and-halffourfour-and-halffive", string
+ doc.elements["/a/one"].next_sibling = Element.new("one-and-half")
+ string = doc.root.elements.collect {|x| x.name}.join
+ assert_equal "oneone-and-halftwotwo-and-halfthreethree-and-halffourfour-and-halffive", string
+
+ doc = Document.new "<a><one/><three/></a>"
+ doc.root[1,0] = Element.new "two"
+ string = ""
+ doc.root.each { |el| string << el.name }
+ assert_equal "onetwothree", string
+ end
- def test_xmldecl_utf_16be_encoding_name
- assert_equal("<?xml version='1.0' encoding='UTF-16'?>",
- XMLDecl.new("1.0", "UTF-16").to_s)
- end
+ # The Source classes are tested extensively throughout the test suite
+ def test_source
+ # Testing string source
+ source = @xsa_source
+ doc = Document.new source
+ assert_equal doc.root.name.to_s, "xsa"
- def each_test( element, xpath, num_children )
- count = 0
- element.each_element( xpath ) { |child|
- count += 1
- yield child if block_given?
- }
- assert_equal num_children, count
- end
+ # Testing IO source
+ doc = File.open(fixture_path("project.xml")) {|f| Document.new f }
+ assert_equal doc.root.name.to_s, "Project"
+ end
- # This is the biggest test, as the number of permutations of xpath are
- # enormous.
- def test_element_access
- # Testing each_element
- doc = Document.new File.new(fixture_path("project.xml"))
-
- each_test( doc, "/", 1 ) { |child|
- assert_equal doc.name, child.name
- }
- each_test(doc, ".", 1) { |child| assert_equal doc, child }
- each_test(doc.root, "..", 1) { |child| assert_equal doc, child }
- each_test(doc.root, "*", 5)
- each_test(doc, "Project/Datasets", 1) { |child|
- assert_equal "Datasets", child.name
- }
- each_test(doc, "Project/Datasets/link", 2 )
- each_test(doc.root, "/Project/Description", 1) {|child|
- assert_equal "Description", child.name
- }
- each_test(doc.root, "./Description",1 ) { |child|
- assert_equal "Description",child.name
- }
- each_test(doc.root, "../Project",1 ) { |child|
- assert_equal doc.root, child
- }
- #each_test(doc,".../link",2) {|child| assert_equal "link",child.name.to_s}
-
- # test get_element
- first = doc.elements[ "Project" ]
- assert_equal doc.root, first
- second = doc.elements[ "Project" ].elements[1]
- third = doc.elements[ "Project/Creator" ]
- assert_equal second, third
- fourth = doc.elements[ "Project/Datasets/link[@idref='18']" ]
- assert_equal "Test data 1", fourth.attributes["name"]
-
- # Testing each_predicate
- each_test( doc, "Project/Datasets/link[@idref='18']", 1 ) { |child|
- assert_equal "Test data 1", child.attributes["name"]
- }
-
- # testing next/previous_element
- creator = doc.elements["//Creator"]
- lm = creator.next_element
- assert_equal "LastModifier", lm.name
- assert_equal "Creator", lm.previous_element.name
- end
+ def test_text
+ f = REXML::Formatters::Default.new
+ string = "Some text"
+ text = Text.new(string)
+ assert_equal(string, text.to_s)
+ text2 = Text.new(text)
+ assert_equal(text, text2)
+ #testing substitution
+ string = "0 < ( 1 & 1 )"
+ correct = "0 &lt; ( 1 &amp; 1 )"
+ text = Text.new(string, true)
+ f.write(text,out="")
+ assert_equal(correct, out)
+
+ string = "Cats &amp; dogs"
+ text = Text.new(string, false, nil, true)
+ assert_equal(string, text.to_s)
+
+ string2 = "<a>#{string}</a>"
+ doc = Document.new( string2, {
+ :raw => %w{ a b }
+ } )
+ f.write(doc,out="")
+ assert_equal(string2, out)
+ b = doc.root.add_element( "b" )
+ b.text = string
+ assert_equal(string, b.get_text.to_s)
+
+ c = doc.root.add_element("c")
+ c.text = string
+ assert_equal("Cats &amp;amp; dogs", c.get_text.to_s)
+
+ # test all
+ string = "<a>&amp;<b>&lt;</b><c>&gt;<d>&quot;</d></c></a>"
+ doc = Document.new(string, { :raw => :all })
+ assert_equal( "&amp;", doc.elements["/a"][0].to_s )
+ assert_equal( "&", doc.elements["/a"].text )
+ assert_equal( "&lt;", doc.elements["/a/b"][0].to_s )
+ assert_equal( "<", doc.elements["/a/b"].text )
+ assert_equal( "&gt;", doc.elements["/a/c"][0].to_s )
+ assert_equal( ">", doc.elements["/a/c"].text )
+ assert_equal( '&quot;', doc.elements["//d"][0].to_s )
+ assert_equal( '"', doc.elements["//d"].text )
+
+ # test some other stuff
+ doc = Document.new('<a><b/></a>')
+ doc.root.text = 'Sean'
+ assert_equal( '<a><b/>Sean</a>', doc.to_s )
+ doc.root.text = 'Elliott'
+ assert_equal( '<a><b/>Elliott</a>', doc.to_s )
+ doc.root.add_element( 'c' )
+ assert_equal( '<a><b/>Elliott<c/></a>', doc.to_s )
+ doc.root.text = 'Russell'
+ assert_equal( '<a><b/>Russell<c/></a>', doc.to_s )
+ doc.root.text = nil
+ assert_equal( '<a><b/><c/></a>', doc.to_s )
+ end
- def test_child
- sean = Element.new "Sean"
- rubbell = Element.new "Rubbell"
- elliott = sean.add_element "Elliott"
- sean << rubbell
- assert_equal elliott, rubbell.previous_sibling
- assert_equal rubbell, elliott.next_sibling
-
- russell = Element.new "Russell"
- rubbell.replace_with russell
- assert_equal elliott, russell.previous_sibling
- assert_equal russell, elliott.next_sibling
-
- assert_nil russell.document
- assert_equal sean, russell.root
- end
+ def test_text_frozen
+ string = "Frozen".freeze
+ text = Text.new(string)
+ assert_equal(string, text.to_s)
+ end
- # Most of this class is tested elsewhere. Here are the methods which
- # aren't used in any other class
- def test_element
- sean = Element.new "Sean"
- string = "1) He's a great guy!"
- sean.text = string
- russell = Element.new "Russell"
- sean << russell
-
- russell.attributes["email"] = "ser@germane-software.com"
- assert_equal russell.attributes["email"], "ser@germane-software.com"
- russell.attributes["webpage"] = "http://www.germane-software.com/~ser"
-
- assert sean.has_text?, "element should have text"
- assert_equal sean.text, string
- assert sean.has_elements?, "element should have one element"
- string = "2) What a stud!"
- sean.add_text string
- sean.text = "3) Super programmer!"
- sean.text = nil
- assert sean.has_text?, "element should still have text"
- assert_equal sean.text, string
-
- russell.delete_attribute "email"
- assert_nil russell.attributes["email"]
- russell.attributes.delete "webpage"
- assert !russell.has_attributes?, "element should have no attributes"
- end
+ def test_xmldecl
+ source = "<?xml version='1.0'?>"
+ # test args
+ # test no args
+ decl2 = XMLDecl.new
+ assert_equal source, decl2.to_s
+ # test XMLDecl
+ decl2 = XMLDecl.new "1.0"
+ assert_equal source, decl2.to_s
+ end
- def test_no_format
- source = "<a><b><c>blah</c><d/></b></a>"
- out = ""
- doc = Document.new( source )
- doc.write(out)
- assert_equal(source, out)
- end
+ def test_xmldecl_utf_16be_encoding_name
+ assert_equal("<?xml version='1.0' encoding='UTF-16'?>",
+ XMLDecl.new("1.0", "UTF-16").to_s)
+ end
- def test_namespace
- source = <<-EOF
- <x xmlns:foo="http://www.bar.com/schema">
- </x>
- EOF
- doc = Document.new(source)
- assert_equal("http://www.bar.com/schema", doc.root.namespace( "foo" ))
- source = <<-EOF
- <!-- bar namespace is "someuri" -->
- <foo:bar xmlns="default" xmlns:foo="someuri">
- <!-- a namespace is "default" -->
- <a/>
- <!-- foo:b namespace is "someuri" -->
- <foo:b>
- <!-- c namespace is "default" -->
- <c/>
- </foo:b>
- <!-- d namespace is "notdefault" -->
- <d xmlns="notdefault">
- <!-- e namespace is "notdefault" -->
- <e/>
- <f xmlns="">
- <g/>
- </f>
- </d>
- </foo:bar>
- EOF
- doc = Document.new source
- assert_equal "someuri", doc.root.namespace
- assert_equal "default", doc.root.elements[1].namespace
- assert_equal "someuri", doc.root.elements[2].namespace
- assert_equal "notdefault", doc.root.elements[ 3 ].namespace
-
- # Testing namespaces in attributes
- source = <<-EOF
- <a xmlns:b="uri">
- <b b:a="x" a="y"/>
- <c xmlns="foo">
- </c>
- </a>
- EOF
- doc = Document.new source
- b = doc.root.elements["b"]
- assert_equal "x", b.attributes["b:a"]
- assert_equal "y", b.attributes["a"]
-
- doc = Document.new
- doc.add_element "sean:blah"
- doc.root.text = "Some text"
- out = ""
- doc.write(out)
- assert_equal "<sean:blah>Some text</sean:blah>", out
- end
+ def each_test( element, xpath, num_children )
+ count = 0
+ element.each_element( xpath ) { |child|
+ count += 1
+ yield child if block_given?
+ }
+ assert_equal num_children, count
+ end
+ # This is the biggest test, as the number of permutations of xpath are
+ # enormous.
+ def test_element_access
+ # Testing each_element
+ doc = File.open(fixture_path("project.xml")) {|f| Document.new f }
+
+ each_test( doc, "/", 1 ) { |child|
+ assert_equal doc.name, child.name
+ }
+ each_test(doc, ".", 1) { |child| assert_equal doc, child }
+ each_test(doc.root, "..", 1) { |child| assert_equal doc, child }
+ each_test(doc.root, "*", 5)
+ each_test(doc, "Project/Datasets", 1) { |child|
+ assert_equal "Datasets", child.name
+ }
+ each_test(doc, "Project/Datasets/link", 2 )
+ each_test(doc.root, "/Project/Description", 1) {|child|
+ assert_equal "Description", child.name
+ }
+ each_test(doc.root, "./Description",1 ) { |child|
+ assert_equal "Description",child.name
+ }
+ each_test(doc.root, "../Project",1 ) { |child|
+ assert_equal doc.root, child
+ }
+ #each_test(doc,".../link",2) {|child| assert_equal "link",child.name.to_s}
+
+ # test get_element
+ first = doc.elements[ "Project" ]
+ assert_equal doc.root, first
+ second = doc.elements[ "Project" ].elements[1]
+ third = doc.elements[ "Project/Creator" ]
+ assert_equal second, third
+ fourth = doc.elements[ "Project/Datasets/link[@idref='18']" ]
+ assert_equal "Test data 1", fourth.attributes["name"]
+
+ # Testing each_predicate
+ each_test( doc, "Project/Datasets/link[@idref='18']", 1 ) { |child|
+ assert_equal "Test data 1", child.attributes["name"]
+ }
+
+ # testing next/previous_element
+ creator = doc.elements["//Creator"]
+ lm = creator.next_element
+ assert_equal "LastModifier", lm.name
+ assert_equal "Creator", lm.previous_element.name
+ end
- def test_add_namespace
- e = Element.new 'a'
- e.add_namespace 'someuri'
- e.add_namespace 'foo', 'otheruri'
- e.add_namespace 'xmlns:bar', 'thirduri'
- assert_equal 'someuri', e.attributes['xmlns']
- assert_equal 'otheruri', e.attributes['xmlns:foo']
- assert_equal 'thirduri', e.attributes['xmlns:bar']
- end
+ def test_child
+ sean = Element.new "Sean"
+ rubbell = Element.new "Rubbell"
+ elliott = sean.add_element "Elliott"
+ sean << rubbell
+ assert_equal elliott, rubbell.previous_sibling
+ assert_equal rubbell, elliott.next_sibling
+
+ russell = Element.new "Russell"
+ rubbell.replace_with russell
+ assert_equal elliott, russell.previous_sibling
+ assert_equal russell, elliott.next_sibling
+
+ assert_nil russell.document
+ assert_equal sean, russell.root
+ end
+ # Most of this class is tested elsewhere. Here are the methods which
+ # aren't used in any other class
+ def test_element
+ sean = Element.new "Sean"
+ string = "1) He's a great guy!"
+ sean.text = string
+ russell = Element.new "Russell"
+ sean << russell
+
+ russell.attributes["email"] = "ser@germane-software.com"
+ assert_equal russell.attributes["email"], "ser@germane-software.com"
+ russell.attributes["webpage"] = "http://www.germane-software.com/~ser"
+
+ assert sean.has_text?, "element should have text"
+ assert_equal sean.text, string
+ assert sean.has_elements?, "element should have one element"
+ string = "2) What a stud!"
+ sean.add_text string
+ sean.text = "3) Super programmer!"
+ sean.text = nil
+ assert sean.has_text?, "element should still have text"
+ assert_equal sean.text, string
+
+ russell.delete_attribute "email"
+ assert_nil russell.attributes["email"]
+ russell.attributes.delete "webpage"
+ assert !russell.has_attributes?, "element should have no attributes"
+ end
- def test_big_documentation
- f = File.new(fixture_path("documentation.xml"))
- d = Document.new f
- assert_equal "Sean Russell", d.elements["documentation/head/author"].text.tr("\n\t", " ").squeeze(" ")
- out = ""
- d.write out
- end
+ def test_no_format
+ source = "<a><b><c>blah</c><d/></b></a>"
+ out = ""
+ doc = Document.new( source )
+ doc.write(out)
+ assert_equal(source, out)
+ end
- def test_tutorial
- doc = Document.new File.new(fixture_path("tutorial.xml"))
- out = ""
- doc.write out
- end
+ def test_namespace
+ source = <<-EOF
+ <x xmlns:foo="http://www.bar.com/schema">
+ </x>
+ EOF
+ doc = Document.new(source)
+ assert_equal("http://www.bar.com/schema", doc.root.namespace( "foo" ))
+ source = <<-EOF
+ <!-- bar namespace is "someuri" -->
+ <foo:bar xmlns="default" xmlns:foo="someuri">
+ <!-- a namespace is "default" -->
+ <a/>
+ <!-- foo:b namespace is "someuri" -->
+ <foo:b>
+ <!-- c namespace is "default" -->
+ <c/>
+ </foo:b>
+ <!-- d namespace is "notdefault" -->
+ <d xmlns="notdefault">
+ <!-- e namespace is "notdefault" -->
+ <e/>
+ <f xmlns="">
+ <g/>
+ </f>
+ </d>
+ </foo:bar>
+ EOF
+ doc = Document.new source
+ assert_equal "someuri", doc.root.namespace
+ assert_equal "default", doc.root.elements[1].namespace
+ assert_equal "someuri", doc.root.elements[2].namespace
+ assert_equal "notdefault", doc.root.elements[ 3 ].namespace
+
+ # Testing namespaces in attributes
+ source = <<-EOF
+ <a xmlns:b="uri">
+ <b b:a="x" a="y"/>
+ <c xmlns="foo">
+ </c>
+ </a>
+ EOF
+ doc = Document.new source
+ b = doc.root.elements["b"]
+ assert_equal "x", b.attributes["b:a"]
+ assert_equal "y", b.attributes["a"]
+
+ doc = Document.new
+ doc.add_element "sean:blah"
+ doc.root.text = "Some text"
+ out = ""
+ doc.write(out)
+ assert_equal "<sean:blah>Some text</sean:blah>", out
+ end
- def test_stream
- c = Listener.new
- Document.parse_stream( File.new(fixture_path("documentation.xml")), c )
- assert(c.ts, "Stream parsing apparantly didn't parse the whole file")
- assert(c.te, "Stream parsing dropped end tag for documentation")
- Document.parse_stream("<a.b> <c/> </a.b>", c)
+ def test_add_namespace
+ e = Element.new 'a'
+ e.add_namespace 'someuri'
+ e.add_namespace 'foo', 'otheruri'
+ e.add_namespace 'xmlns:bar', 'thirduri'
+ assert_equal 'someuri', e.attributes['xmlns']
+ assert_equal 'otheruri', e.attributes['xmlns:foo']
+ assert_equal 'thirduri', e.attributes['xmlns:bar']
+ end
- Document.parse_stream("<a>&lt;&gt;&amp;</a>", c)
- assert_equal('<>&', c.normalize)
- end
- def test_line
- Document.new File.new(fixture_path("bad.xml"))
- assert_fail "There should have been an error"
- rescue Exception
- # We should get here
- assert($!.line == 5, "Should have been an error on line 5, "+
- "but was reported as being on line #{$!.line}" )
- end
+ def test_big_documentation
+ d = File.open(fixture_path("documentation.xml")) {|f| Document.new f }
+ assert_equal "Sean Russell", d.elements["documentation/head/author"].text.tr("\n\t", " ").squeeze(" ")
+ out = ""
+ d.write out
+ end
+
+ def test_tutorial
+ doc = File.open(fixture_path("tutorial.xml")) {|f| Document.new f }
+ out = ""
+ doc.write out
+ end
- def test_substitution
- val = "a'b\"c"
- el = Element.new("a")
- el.attributes["x"] = val
- REXML::Formatters::Default.new.write(el, out="")
+ def test_stream
+ c = Listener.new
+ File.open(fixture_path("documentation.xml")) do |f|
+ Document.parse_stream( f, c )
+ end
+ assert(c.ts, "Stream parsing apparantly didn't parse the whole file")
+ assert(c.te, "Stream parsing dropped end tag for documentation")
- nel = Document.new( out)
- assert_equal( val, nel.root.attributes["x"] )
- end
+ Document.parse_stream("<a.b> <c/> </a.b>", c)
- def test_exception
- source = SourceFactory.create_from "<a/>"
- p = ParseException.new( "dummy message", source )
- begin
- raise "dummy"
+ Document.parse_stream("<a>&lt;&gt;&amp;</a>", c)
+ assert_equal('<>&', c.normalize)
+ end
+
+ def test_line
+ f = File.new(fixture_path("bad.xml"))
+ Document.new f
+ assert_fail "There should have been an error"
rescue Exception
- p.continued_exception = $!
+ # We should get here
+ assert($!.line == 5, "Should have been an error on line 5, "+
+ "but was reported as being on line #{$!.line}" )
+ ensure
+ f.close if f
end
- end
- def test_bad_content
- in_gt = '<root-el>content>content</root-el>'
- in_lt = '<root-el>content<content</root-el>'
+ def test_substitution
+ val = "a'b\"c"
+ el = Element.new("a")
+ el.attributes["x"] = val
+ REXML::Formatters::Default.new.write(el, out="")
- # This is OK
- tree_gt = Document.new in_gt
- assert_equal "content>content", tree_gt.elements[1].text
- # This isn't
- begin
- Document.new in_lt
- assert_fail "Should have gotten a parse error"
- rescue ParseException
+ nel = Document.new( out)
+ assert_equal( val, nel.root.attributes["x"] )
end
- end
-
- def test_iso_8859_1_output_function
- out = ""
- output = Output.new( out )
- koln_iso_8859_1 = "K\xF6ln"
- koln_utf8 = "K\xc3\xb6ln"
- source = Source.new( koln_iso_8859_1, 'iso-8859-1' )
- results = source.scan(/.*/)[0]
- koln_utf8.force_encoding('UTF-8') if koln_utf8.respond_to?(:force_encoding)
- assert_equal koln_utf8, results
- output << results
- if koln_iso_8859_1.respond_to?(:force_encoding)
- koln_iso_8859_1.force_encoding('ISO-8859-1')
- end
- assert_equal koln_iso_8859_1, out
- end
- def test_attributes_each
- doc = Document.new("<a xmlns:a='foo'><b x='1' y='2' z='3' a:x='4'/></a>")
- count = 0
- doc.root.elements[1].attributes.each {|k,v| count += 1 }
- assert_equal 4, count
- end
+ def test_exception
+ source = SourceFactory.create_from "<a/>"
+ p = ParseException.new( "dummy message", source )
+ begin
+ raise "dummy"
+ rescue Exception
+ p.continued_exception = $!
+ end
+ end
- def test_delete_namespace
- doc = Document.new "<a xmlns='1' xmlns:x='2'/>"
- doc.root.delete_namespace
- doc.root.delete_namespace 'x'
- assert_equal "<a/>", doc.to_s
- end
+ def test_bad_content
+ in_gt = '<root-el>content>content</root-el>'
+ in_lt = '<root-el>content<content</root-el>'
- def test_each_element_with_attribute
- doc = Document.new "<a><b id='1'/><c id='2'/><d id='1'/><e/></a>"
- arry = []
- block = proc { |e|
- assert arry.include?(e.name)
- arry.delete e.name
- }
- # Yields b, c, d
- arry = %w{b c d}
- doc.root.each_element_with_attribute( 'id', &block )
- assert_equal 0, arry.size
- # Yields b, d
- arry = %w{b d}
- doc.root.each_element_with_attribute( 'id', '1', &block )
- assert_equal 0, arry.size
- # Yields b
- arry = ['b']
- doc.root.each_element_with_attribute( 'id', '1', 1, &block )
- assert_equal 0, arry.size
- # Yields d
- arry = ['d']
- doc.root.each_element_with_attribute( 'id', '1', 0, 'd', &block )
- assert_equal 0, arry.size
- end
- def test_each_element_with_text
- doc = Document.new '<a><b>b</b><c>b</c><d>d</d><e/></a>'
- arry = []
- block = proc { |e|
- assert arry.include?(e.name)
- arry.delete e.name
- }
- # Yields b, c, d
- arry = %w{b c d}
- doc.root.each_element_with_text(&block)
- assert_equal 0, arry.size
- # Yields b, d
- arry = %w{b c}
- doc.root.each_element_with_text( 'b', &block )
- assert_equal 0, arry.size
- # Yields b
- arry = ['b']
- doc.root.each_element_with_text( 'b', 1, &block )
- assert_equal 0, arry.size
- # Yields d
- arry = ['d']
- doc.root.each_element_with_text( nil, 0, 'd', &block )
- assert_equal 0, arry.size
- end
+ # This is OK
+ tree_gt = Document.new in_gt
+ assert_equal "content>content", tree_gt.elements[1].text
+ # This isn't
+ begin
+ Document.new in_lt
+ assert_fail "Should have gotten a parse error"
+ rescue ParseException
+ end
+ end
- def test_element_parse_stream
- s = Source.new( "<a>some text</a>" )
- l = Listener.new
- class << l
- def tag_start name, attributes
- raise "Didn't find proper tag name" unless 'a'==name
+ def test_iso_8859_1_output_function
+ out = ""
+ output = Output.new( out )
+ koln_iso_8859_1 = "K\xF6ln"
+ koln_utf8 = "K\xc3\xb6ln"
+ source = Source.new( koln_iso_8859_1, 'iso-8859-1' )
+ results = source.scan(/.*/)[0]
+ koln_utf8.force_encoding('UTF-8') if koln_utf8.respond_to?(:force_encoding)
+ assert_equal koln_utf8, results
+ output << results
+ if koln_iso_8859_1.respond_to?(:force_encoding)
+ koln_iso_8859_1.force_encoding('ISO-8859-1')
end
+ assert_equal koln_iso_8859_1, out
end
- Document::parse_stream(s, l)
- end
+ def test_attributes_each
+ doc = Document.new("<a xmlns:a='foo'><b x='1' y='2' z='3' a:x='4'/></a>")
+ count = 0
+ doc.root.elements[1].attributes.each {|k,v| count += 1 }
+ assert_equal 4, count
+ end
- def test_deep_clone
- a = Document.new( '<?xml version="1"?><a x="y"><b>text</b>text<c><d><e>text</e></d></c></a>' )
- b = a.deep_clone
- assert_equal a.to_s, b.to_s
+ def test_delete_namespace
+ doc = Document.new "<a xmlns='1' xmlns:x='2'/>"
+ doc.root.delete_namespace
+ doc.root.delete_namespace 'x'
+ assert_equal "<a/>", doc.to_s
+ end
- a = Document.new( '<a>some &lt; text <b> more &gt; text </b> &gt; </a>' )
- b = a.deep_clone
- assert_equal a.to_s, b.to_s
- c = Document.new( b.to_s )
- assert_equal a.to_s, c.to_s
- end
+ def test_each_element_with_attribute
+ doc = Document.new "<a><b id='1'/><c id='2'/><d id='1'/><e/></a>"
+ arry = []
+ block = proc { |e|
+ assert arry.include?(e.name)
+ arry.delete e.name
+ }
+ # Yields b, c, d
+ arry = %w{b c d}
+ doc.root.each_element_with_attribute( 'id', &block )
+ assert_equal 0, arry.size
+ # Yields b, d
+ arry = %w{b d}
+ doc.root.each_element_with_attribute( 'id', '1', &block )
+ assert_equal 0, arry.size
+ # Yields b
+ arry = ['b']
+ doc.root.each_element_with_attribute( 'id', '1', 1, &block )
+ assert_equal 0, arry.size
+ # Yields d
+ arry = ['d']
+ doc.root.each_element_with_attribute( 'id', '1', 0, 'd', &block )
+ assert_equal 0, arry.size
+ end
+ def test_each_element_with_text
+ doc = Document.new '<a><b>b</b><c>b</c><d>d</d><e/></a>'
+ arry = []
+ block = proc { |e|
+ assert arry.include?(e.name)
+ arry.delete e.name
+ }
+ # Yields b, c, d
+ arry = %w{b c d}
+ doc.root.each_element_with_text(&block)
+ assert_equal 0, arry.size
+ # Yields b, d
+ arry = %w{b c}
+ doc.root.each_element_with_text( 'b', &block )
+ assert_equal 0, arry.size
+ # Yields b
+ arry = ['b']
+ doc.root.each_element_with_text( 'b', 1, &block )
+ assert_equal 0, arry.size
+ # Yields d
+ arry = ['d']
+ doc.root.each_element_with_text( nil, 0, 'd', &block )
+ assert_equal 0, arry.size
+ end
+
+ def test_element_parse_stream
+ s = Source.new( "<a>some text</a>" )
+ l = Listener.new
+ class << l
+ def tag_start name, attributes
+ raise "Didn't find proper tag name" unless 'a'==name
+ end
+ end
- def test_whitespace_before_root
- a = <<EOL
+ Document::parse_stream(s, l)
+ end
+
+ def test_deep_clone
+ a = Document.new( '<?xml version="1"?><a x="y"><b>text</b>text<c><d><e>text</e></d></c></a>' )
+ b = a.deep_clone
+ assert_equal a.to_s, b.to_s
+
+ a = Document.new( '<a>some &lt; text <b> more &gt; text </b> &gt; </a>' )
+ b = a.deep_clone
+ assert_equal a.to_s, b.to_s
+ c = Document.new( b.to_s )
+ assert_equal a.to_s, c.to_s
+ end
+
+ def test_whitespace_before_root
+ a = <<EOL
<?xml version='1.0'?>
<blo>
<wak>
</wak>
</blo>
EOL
- d = Document.new(a)
- b = ""
- d.write( b )
- assert_equal a,b
- end
+ d = Document.new(a)
+ b = ""
+ d.write( b )
+ assert_equal a,b
+ end
- def test_entities
- a = Document.new( '<a>&#101;&#x65;&#252;</a>' )
- assert_equal('eeü'.force_encoding("UTF-8"), a.root.text)
- end
+ def test_entities
+ a = Document.new( '<a>&#101;&#x65;&#252;</a>' )
+ assert_equal('eeü'.force_encoding("UTF-8"), a.root.text)
+ end
- def test_element_decl
- element_decl = Source.new("<!DOCTYPE foo [
+ def test_element_decl
+ element_decl = Source.new("<!DOCTYPE foo [
<!ELEMENT bar (#PCDATA)>
]>")
- doc = Document.new( element_decl )
- d = doc[0]
- assert_equal("<!ELEMENT bar (#PCDATA)>", d.to_s.split(/\n/)[1].strip)
- end
+ doc = Document.new( element_decl )
+ d = doc[0]
+ assert_equal("<!ELEMENT bar (#PCDATA)>", d.to_s.split(/\n/)[1].strip)
+ end
- def test_attlist_decl
- doc = Document.new <<-EOL
- <!DOCTYPE blah [
- <!ATTLIST blah
- xmlns CDATA "foo">
- <!ATTLIST a
- bar CDATA "gobble"
- xmlns:one CDATA "two"
- >
- ]>
- <a xmlns:three='xxx' three='yyy'><one:b/><three:c/></a>
- EOL
- assert_equal 'gobble', doc.root.attributes['bar']
- assert_equal 'xxx', doc.root.elements[2].namespace
- assert_equal 'two', doc.root.elements[1].namespace
- assert_equal 'foo', doc.root.namespace
-
- doc = Document.new <<-EOL
- <?xml version="1.0"?>
- <!DOCTYPE schema SYSTEM "XMLSchema.dtd" [
- <!ENTITY % p ''>
- <!ENTITY % s ''>
- <!ATTLIST schema
- xmlns:svg CDATA #FIXED "http://www.w3.org/2000/svg"
- xmlns:xlink CDATA #FIXED "http://www.w3.org/1999/xlink"
- xmlns:xml CDATA #FIXED "http://www.w3.org/XML/1998/namespace"
- >]>
- <schema/>
- EOL
- prefixes = doc.root.prefixes.sort
- correct = ['svg', 'xlink', 'xml']
- assert_equal correct, prefixes
- end
+ def test_attlist_decl
+ doc = Document.new <<-EOL
+ <!DOCTYPE blah [
+ <!ATTLIST blah
+ xmlns CDATA "foo">
+ <!ATTLIST a
+ bar CDATA "gobble"
+ xmlns:one CDATA "two"
+ >
+ ]>
+ <a xmlns:three='xxx' three='yyy'><one:b/><three:c/></a>
+ EOL
+ assert_equal 'gobble', doc.root.attributes['bar']
+ assert_equal 'xxx', doc.root.elements[2].namespace
+ assert_equal 'two', doc.root.elements[1].namespace
+ assert_equal 'foo', doc.root.namespace
+
+ doc = Document.new <<-EOL
+ <?xml version="1.0"?>
+ <!DOCTYPE schema SYSTEM "XMLSchema.dtd" [
+ <!ENTITY % p ''>
+ <!ENTITY % s ''>
+ <!ATTLIST schema
+ xmlns:svg CDATA #FIXED "http://www.w3.org/2000/svg"
+ xmlns:xlink CDATA #FIXED "http://www.w3.org/1999/xlink"
+ xmlns:xml CDATA #FIXED "http://www.w3.org/XML/1998/namespace"
+ >]>
+ <schema/>
+ EOL
+ prefixes = doc.root.prefixes.sort
+ correct = ['svg', 'xlink', 'xml']
+ assert_equal correct, prefixes
+ end
- def test_attlist_write
- file=File.new(fixture_path("foo.xml"))
- doc=Document.new file
- out = ''
- doc.write(out)
- end
+ def test_attlist_write
+ doc = File.open(fixture_path("foo.xml")) {|file| Document.new file }
+ out = ''
+ doc.write(out)
+ end
- def test_more_namespaces
- assert_raise( REXML::UndefinedNamespaceException,
- %Q{Should have gotten an Undefined Namespace error} ) {
- Document.new("<r><p><n:c/></p></r>")
- }
- doc2 = Document.new("<r xmlns:n='1'><p><n:c/></p></r>")
- es = XPath.match(doc2, '//c')
- assert_equal 0, es.size
- es = XPath.match(doc2, '//n:c')
- assert_equal 1, es.size
- doc2.root.add_namespace('m', '2')
- doc2.root.add_element("m:o")
- es = XPath.match(doc2, './/o')
- assert_equal 0, es.size
- es = XPath.match(doc2, '//n:c')
- assert_equal 1, es.size
- end
+ def test_more_namespaces
+ assert_raise( REXML::UndefinedNamespaceException,
+ %Q{Should have gotten an Undefined Namespace error} ) {
+ Document.new("<r><p><n:c/></p></r>")
+ }
+ doc2 = Document.new("<r xmlns:n='1'><p><n:c/></p></r>")
+ es = XPath.match(doc2, '//c')
+ assert_equal 0, es.size
+ es = XPath.match(doc2, '//n:c')
+ assert_equal 1, es.size
+ doc2.root.add_namespace('m', '2')
+ doc2.root.add_element("m:o")
+ es = XPath.match(doc2, './/o')
+ assert_equal 0, es.size
+ es = XPath.match(doc2, '//n:c')
+ assert_equal 1, es.size
+ end
- def test_ticket_51
- doc = REXML::Document.new <<-EOL
- <test xmlns='1' xmlns:x='1'>
- <a>X</a>
- <x:a>Y</x:a>
-
- <b xmlns='2'>
- <a>Z</a>
- </b>
- </test>
- EOL
-
- # The most common case. People not caring about the namespaces much.
- assert_equal( "XY", XPath.match( doc, "/test/a/text()" ).join )
- assert_equal( "XY", XPath.match( doc, "/test/x:a/text()" ).join )
- # Surprising? I don't think so, if you believe my definition of the "common case"
- assert_equal( "XYZ", XPath.match( doc, "//a/text()" ).join )
-
- # These are the uncommon cases. Namespaces are actually important, so we define our own
- # mappings, and pass them in.
- assert_equal( "XY", XPath.match( doc, "/f:test/f:a/text()", { "f" => "1" } ).join )
- # The namespaces are defined, and override the original mappings
- assert_equal( "", XPath.match( doc, "/test/a/text()", { "f" => "1" } ).join )
- assert_equal( "", XPath.match( doc, "/x:test/x:a/text()", { "f" => "1" } ).join )
- assert_equal( "", XPath.match( doc, "//a/text()", { "f" => "1" } ).join )
- end
+ def test_ticket_51
+ doc = REXML::Document.new <<-EOL
+ <test xmlns='1' xmlns:x='1'>
+ <a>X</a>
+ <x:a>Y</x:a>
+
+ <b xmlns='2'>
+ <a>Z</a>
+ </b>
+ </test>
+ EOL
+
+ # The most common case. People not caring about the namespaces much.
+ assert_equal( "XY", XPath.match( doc, "/test/a/text()" ).join )
+ assert_equal( "XY", XPath.match( doc, "/test/x:a/text()" ).join )
+ # Surprising? I don't think so, if you believe my definition of the "common case"
+ assert_equal( "XYZ", XPath.match( doc, "//a/text()" ).join )
+
+ # These are the uncommon cases. Namespaces are actually important, so we define our own
+ # mappings, and pass them in.
+ assert_equal( "XY", XPath.match( doc, "/f:test/f:a/text()", { "f" => "1" } ).join )
+ # The namespaces are defined, and override the original mappings
+ assert_equal( "", XPath.match( doc, "/test/a/text()", { "f" => "1" } ).join )
+ assert_equal( "", XPath.match( doc, "/x:test/x:a/text()", { "f" => "1" } ).join )
+ assert_equal( "", XPath.match( doc, "//a/text()", { "f" => "1" } ).join )
+ end
- def test_processing_instruction
- d = Document.new("<a><?foo bar?><?foo2 bar2?><b><?foo3 bar3?></b><?foo4 bar4?></a>")
- assert_equal 4, XPath.match(d, '//processing-instruction()' ).size
- match = XPath.match(d, "//processing-instruction('foo3')" )
- assert_equal 1, match.size
- assert_equal 'bar3', match[0].content
- end
+ def test_processing_instruction
+ d = Document.new("<a><?foo bar?><?foo2 bar2?><b><?foo3 bar3?></b><?foo4 bar4?></a>")
+ assert_equal 4, XPath.match(d, '//processing-instruction()' ).size
+ match = XPath.match(d, "//processing-instruction('foo3')" )
+ assert_equal 1, match.size
+ assert_equal 'bar3', match[0].content
+ end
- def test_oses_with_bad_EOLs
- Document.new("\n\n\n<?xml version='1.0'?>\n\n\n<a/>\n\n")
- end
+ def test_oses_with_bad_EOLs
+ Document.new("\n\n\n<?xml version='1.0'?>\n\n\n<a/>\n\n")
+ end
- # Contributed (with patch to fix bug) by Kouhei
- def test_ignore_whitespace
- source = "<a> <b/> abc <![CDATA[def]]> </a>"
+ # Contributed (with patch to fix bug) by Kouhei
+ def test_ignore_whitespace
+ source = "<a> <b/> abc <![CDATA[def]]> </a>"
- context_all = {:ignore_whitespace_nodes => :all}
- context_a = {:ignore_whitespace_nodes => %(a)}
- context_b = {:ignore_whitespace_nodes => %(b)}
+ context_all = {:ignore_whitespace_nodes => :all}
+ context_a = {:ignore_whitespace_nodes => %(a)}
+ context_b = {:ignore_whitespace_nodes => %(b)}
- tests = [[[" abc ", "def"], context_all],
- [[" abc ", "def"], context_a],
- [[" ", " abc ", "def", " "], context_b]]
+ tests = [[[" abc ", "def"], context_all],
+ [[" abc ", "def"], context_a],
+ [[" ", " abc ", "def", " "], context_b]]
- tests.each do |test|
- assert_equal(test[0], Document.new(source, test[1]).root.texts.collect{|x|
- x.to_s})
+ tests.each do |test|
+ assert_equal(test[0], Document.new(source, test[1]).root.texts.collect{|x|
+ x.to_s})
+ end
end
- end
- def test_0xD_in_preface
- doc = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\x0D<opml version=\"1.0\">\x0D</opml>"
- doc = Document.new doc
- end
+ def test_0xD_in_preface
+ doc = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\x0D<opml version=\"1.0\">\x0D</opml>"
+ doc = Document.new doc
+ end
- def test_hyphens_in_doctype
- doc = REXML::Document.new <<-EOQ
- <?xml version="1.0"?>
- <!DOCTYPE a-b-c>
- <a-b-c>
- <a/>
- </a-b-c>
- EOQ
+ def test_hyphens_in_doctype
+ doc = REXML::Document.new <<-EOQ
+ <?xml version="1.0"?>
+ <!DOCTYPE a-b-c>
+ <a-b-c>
+ <a/>
+ </a-b-c>
+ EOQ
- assert_equal('a-b-c', doc.doctype.name)
- end
+ assert_equal('a-b-c', doc.doctype.name)
+ end
- def test_accents
- docs = [
- %Q{<?xml version="1.0" encoding="ISO-8859-1"?>
+ def test_accents
+ docs = [
+ %Q{<?xml version="1.0" encoding="ISO-8859-1"?>
<gnuPod>
<files>
<file id="57" artist="Coralie Cl\357\277\275ent" />
</files>
</gnuPod>},
- '<?xml version="1.0" encoding="ISO-8859-1"?>
+ '<?xml version="1.0" encoding="ISO-8859-1"?>
<gnuPod>
<files>
<file id="71" album="Astrakan Caf" />
</files>
</gnuPod>',
- %Q{<?xml version="1.0" encoding="ISO-8859-1"?>
+ %Q{<?xml version="1.0" encoding="ISO-8859-1"?>
<gnuPod>
<files>
<file id="71" album="Astrakan Caf\357\277\275eria" />
</files>
</gnuPod>},
- %Q{<?xml version="1.0" encoding="ISO-8859-1"?>
+ %Q{<?xml version="1.0" encoding="ISO-8859-1"?>
<gnuPod>
<files>
<file id="71" album="Astrakan Caf\357\277\275" />
</files>
</gnuPod>} ]
- docs.each_with_index { |d,i|
- begin
- REXML::Document.new(d)
- rescue
- puts "#{i} => #{docs[i]}"
- raise
- end
- }
- end
+ docs.each_with_index { |d,i|
+ begin
+ REXML::Document.new(d)
+ rescue
+ puts "#{i} => #{docs[i]}"
+ raise
+ end
+ }
+ end
- def test_replace_text
- e = REXML::Element.new( "a" )
- e.add_text( "foo" )
- assert_equal( "<a>foo</a>", e.to_s )
- e[0].value = "bar"
- assert_equal( "<a>bar</a>", e.to_s )
- e[0].value = "<"
- assert_equal( "<a>&lt;</a>", e.to_s )
- assert_equal( "<", e[0].value )
- end
+ def test_replace_text
+ e = REXML::Element.new( "a" )
+ e.add_text( "foo" )
+ assert_equal( "<a>foo</a>", e.to_s )
+ e[0].value = "bar"
+ assert_equal( "<a>bar</a>", e.to_s )
+ e[0].value = "<"
+ assert_equal( "<a>&lt;</a>", e.to_s )
+ assert_equal( "<", e[0].value )
+ end
- def test_write_doctype
- ## XML Document and Declaration
- document = REXML::Document.new
- xmldecl = REXML::XMLDecl.new("1.0", "UTF-8")
- document.add(xmldecl)
- s = ""
- document.write(s)
+ def test_write_doctype
+ ## XML Document and Declaration
+ document = REXML::Document.new
+ xmldecl = REXML::XMLDecl.new("1.0", "UTF-8")
+ document.add(xmldecl)
+ s = ""
+ document.write(s)
- ## XML Doctype
- str = '<!DOCTYPE foo "bar">'
- source = REXML::Source.new(str)
- doctype = REXML::DocType.new(source)
- document.add(doctype)
- document.write(s)
+ ## XML Doctype
+ str = '<!DOCTYPE foo "bar">'
+ source = REXML::Source.new(str)
+ doctype = REXML::DocType.new(source)
+ document.add(doctype)
+ document.write(s)
- ## Element
- element = REXML::Element.new("hoge")
- document.add(element)
+ ## Element
+ element = REXML::Element.new("hoge")
+ document.add(element)
- document.write(s)
- end
+ document.write(s)
+ end
- def test_write_cdata
- src = "<a>A</a>"
- doc = REXML::Document.new( src )
- out = ""
- doc.write( out )
- assert_equal( src, out )
-
- src = "<a><![CDATA[A]]></a>"
- doc = REXML::Document.new( src )
- out = ""
- doc.write( out )
- assert_equal( src, out )
- end
+ def test_write_cdata
+ src = "<a>A</a>"
+ doc = REXML::Document.new( src )
+ out = ""
+ doc.write( out )
+ assert_equal( src, out )
+
+ src = "<a><![CDATA[A]]></a>"
+ doc = REXML::Document.new( src )
+ out = ""
+ doc.write( out )
+ assert_equal( src, out )
+ end
- def test_namespace_attributes
- source = <<-EOL
- <a xmlns:x="1">
- <x:b x:n="foo"/>
- </a>
- EOL
- d = Document.new( source )
- assert_equal( 'foo', REXML::XPath.first(d.root, "//x:b/@x:n").value )
- assert_equal( nil, REXML::XPath.first(d.root, "//x:b/@x:n", {}))
- end
+ def test_namespace_attributes
+ source = <<-EOL
+ <a xmlns:x="1">
+ <x:b x:n="foo"/>
+ </a>
+ EOL
+ d = Document.new( source )
+ assert_equal( 'foo', REXML::XPath.first(d.root, "//x:b/@x:n").value )
+ assert_equal( nil, REXML::XPath.first(d.root, "//x:b/@x:n", {}))
+ end
- def test_null_element_name
- a = REXML::Document.new
- assert_raise( RuntimeError ) {
- a.add_element( nil )
- }
- end
+ def test_null_element_name
+ a = REXML::Document.new
+ assert_raise( RuntimeError ) {
+ a.add_element( nil )
+ }
+ end
- def test_text_raw
- # From the REXML tutorial
- # (http://www.germane-software.com/software/rexml/test/data/tutorial.html)
- doc = Document.new <<-EOL
- <?xml version="1.0"?>
- <!DOCTYPE schema SYSTEM "XMLSchema.dtd" [
- <!ENTITY % s 'Sean'>
- ]>
- <a/>
- EOL
- a = doc.root
-
- # This makes sure that RAW text nodes don't have their entity strings
- # replaced
- t = Text.new "Sean", false, nil, true
- a.text = t
- assert_equal( "Sean", t.to_s )
- assert_equal( "Sean", t.value )
-
- # This makes sure that they do
- t = Text.new "Sean", false, nil, false
- a.text = t
- assert_equal( "&s;", t.to_s )
- assert_equal( "Sean", t.value )
-
- t = Text.new "&s;", false, nil, true
- a.text = t
- assert_equal( "&s;", t.to_s )
- assert_equal( "Sean", t.value )
-
- t = Text.new "&s;", false, nil, true
- a.text = t
- assert_equal( "&s;", t.to_s )
- assert_equal( "Sean", t.value )
-
- # Ticket #44
- t = REXML::Text.new( "&amp;", false, nil, true )
- assert_equal( "&amp;", t.to_s )
-
- t = REXML::Text.new("&amp;", false, false)
- assert_equal( "&amp;amp;", t.to_s )
- end
+ def test_text_raw
+ # From the REXML tutorial
+ # (http://www.germane-software.com/software/rexml/test/data/tutorial.html)
+ doc = Document.new <<-EOL
+ <?xml version="1.0"?>
+ <!DOCTYPE schema SYSTEM "XMLSchema.dtd" [
+ <!ENTITY % s 'Sean'>
+ ]>
+ <a/>
+ EOL
+ a = doc.root
+
+ # This makes sure that RAW text nodes don't have their entity strings
+ # replaced
+ t = Text.new "Sean", false, nil, true
+ a.text = t
+ assert_equal( "Sean", t.to_s )
+ assert_equal( "Sean", t.value )
+
+ # This makes sure that they do
+ t = Text.new "Sean", false, nil, false
+ a.text = t
+ assert_equal( "&s;", t.to_s )
+ assert_equal( "Sean", t.value )
+
+ t = Text.new "&s;", false, nil, true
+ a.text = t
+ assert_equal( "&s;", t.to_s )
+ assert_equal( "Sean", t.value )
+
+ t = Text.new "&s;", false, nil, true
+ a.text = t
+ assert_equal( "&s;", t.to_s )
+ assert_equal( "Sean", t.value )
+
+ # Ticket #44
+ t = REXML::Text.new( "&amp;", false, nil, true )
+ assert_equal( "&amp;", t.to_s )
+
+ t = REXML::Text.new("&amp;", false, false)
+ assert_equal( "&amp;amp;", t.to_s )
+ end
- def test_to_xpath
- doc = REXML::Document.new( %q{<tag1>
- <tag2 name="tag2"/>
- <tag2 name="tag2"/>
- </tag1>})
- names = %w{ /tag1/tag2[1] /tag1/tag2[2] }
- doc.root.elements.each_with_index {|el, i|
- assert_equal( names[i], el.xpath )
- }
- end
+ def test_to_xpath
+ doc = REXML::Document.new( %q{<tag1>
+ <tag2 name="tag2"/>
+ <tag2 name="tag2"/>
+ </tag1>})
+ names = %w{ /tag1/tag2[1] /tag1/tag2[2] }
+ doc.root.elements.each_with_index {|el, i|
+ assert_equal( names[i], el.xpath )
+ }
+ end
- def test_transitive
- doc = REXML::Document.new( "<a/>")
- s = ""
- doc.write( s, 0, true )
- end
+ def test_transitive
+ doc = REXML::Document.new( "<a/>")
+ s = ""
+ doc.write( s, 0, true )
+ end
- # This is issue #40
- def test_replace_with
- old = '<doc>old<foo/>old</doc>'
- d = REXML::Document.new(old).root
- new = REXML::Text.new('new',true,nil,true)
- child = d.children[2]
- child.replace_with(new)
- assert_equal( new, d.children[2] )
- end
+ # This is issue #40
+ def test_replace_with
+ old = '<doc>old<foo/>old</doc>'
+ d = REXML::Document.new(old).root
+ new = REXML::Text.new('new',true,nil,true)
+ child = d.children[2]
+ child.replace_with(new)
+ assert_equal( new, d.children[2] )
+ end
- def test_repeated_writes
- a = IO.read(fixture_path("iso8859-1.xml"))
- f = REXML::Formatters::Pretty.new
+ def test_repeated_writes
+ a = IO.read(fixture_path("iso8859-1.xml"))
+ f = REXML::Formatters::Pretty.new
- xmldoc = REXML::Document.new( a )
- a_andre = xmldoc.elements['//image'].attributes['caption']
+ xmldoc = REXML::Document.new( a )
+ a_andre = xmldoc.elements['//image'].attributes['caption']
- f.write(xmldoc,b="")
+ f.write(xmldoc,b="")
- xmldoc = REXML::Document.new(b)
- b_andre = xmldoc.elements['//image'].attributes['caption']
- assert_equal( a_andre, b_andre )
+ xmldoc = REXML::Document.new(b)
+ b_andre = xmldoc.elements['//image'].attributes['caption']
+ assert_equal( a_andre, b_andre )
- f.write(xmldoc,c="")
+ f.write(xmldoc,c="")
- xmldoc = REXML::Document.new(c)
- c_andre = xmldoc.elements['//image'].attributes['caption']
- assert_equal( b_andre, c_andre )
+ xmldoc = REXML::Document.new(c)
+ c_andre = xmldoc.elements['//image'].attributes['caption']
+ assert_equal( b_andre, c_andre )
- o = Output.new(d="","UTF-8")
- f.write(xmldoc,o)
- assert_not_equal( c, d )
- end
+ o = Output.new(d="","UTF-8")
+ f.write(xmldoc,o)
+ assert_not_equal( c, d )
+ end
- def test_pretty_format_long_text_finite
- n = 1_000_000
- long_text = 'aaaa ' * n
- xml = "<doc>#{long_text}</doc>"
- formatter = REXML::Formatters::Pretty.new
- document = nil
- begin
- document = REXML::Document.new(xml)
- rescue REXML::ParseException
- skip_message = "skip this test because we can't check Pretty#wrap " +
- "works without #<SystemStackError: stack level too deep> on " +
- "small memory system. #<RegexpError: failed to allocate memory> " +
- "will be raised on the system. See also [ruby-dev:42599]."
- return skip_message
- end
- output = ""
- formatter.write(document, output)
- assert_equal("<doc>\n" +
- ((" " + (" aaaa" * 15) + "\n") * (n / 15)) +
- " " + ("aaaa " * (n % 15)) + "\n" +
- "</doc>",
- output)
- end
+ def test_pretty_format_long_text_finite
+ n = 1_000_000
+ long_text = 'aaaa ' * n
+ xml = "<doc>#{long_text}</doc>"
+ formatter = REXML::Formatters::Pretty.new
+ document = nil
+ begin
+ document = REXML::Document.new(xml)
+ rescue REXML::ParseException
+ skip_message = "skip this test because we can't check Pretty#wrap " +
+ "works without #<SystemStackError: stack level too deep> on " +
+ "small memory system. #<RegexpError: failed to allocate memory> " +
+ "will be raised on the system. See also [ruby-dev:42599]."
+ return skip_message
+ end
+ output = ""
+ formatter.write(document, output)
+ assert_equal("<doc>\n" +
+ ((" " + (" aaaa" * 15) + "\n") * (n / 15)) +
+ " " + ("aaaa " * (n % 15)) + "\n" +
+ "</doc>",
+ output)
+ end
- def test_pretty_format_deep_indent
- n = 6
- elements = ""
- n.times do |i|
- elements << "<element#{i}>"
- elements << "element#{i} " * 5
- end
- (n - 1).downto(0) do |i|
- elements << "</element#{i}>"
- end
- xml = "<doc>#{elements}</doc>"
- document = REXML::Document.new(xml)
- formatter = REXML::Formatters::Pretty.new
- formatter.width = 20
- output = ""
- formatter.write(document, output)
- assert_equal(<<-XML.strip, output)
+ def test_pretty_format_deep_indent
+ n = 6
+ elements = ""
+ n.times do |i|
+ elements << "<element#{i}>"
+ elements << "element#{i} " * 5
+ end
+ (n - 1).downto(0) do |i|
+ elements << "</element#{i}>"
+ end
+ xml = "<doc>#{elements}</doc>"
+ document = REXML::Document.new(xml)
+ formatter = REXML::Formatters::Pretty.new
+ formatter.width = 20
+ output = ""
+ formatter.write(document, output)
+ assert_equal(<<-XML.strip, output)
<doc>
<element0>
element0
@@ -1211,114 +1215,114 @@ EOL
</element1>
</element0>
</doc>
- XML
- end
+ XML
+ end
- def test_ticket_58
- doc = REXML::Document.new
- doc << REXML::XMLDecl.default
- doc << REXML::Element.new("a")
+ def test_ticket_58
+ doc = REXML::Document.new
+ doc << REXML::XMLDecl.default
+ doc << REXML::Element.new("a")
- str = ""
- doc.write(str)
+ str = ""
+ doc.write(str)
- assert_equal("<a/>", str)
+ assert_equal("<a/>", str)
- doc = REXML::Document.new
- doc << REXML::XMLDecl.new("1.0", "UTF-8")
- doc << REXML::Element.new("a")
+ doc = REXML::Document.new
+ doc << REXML::XMLDecl.new("1.0", "UTF-8")
+ doc << REXML::Element.new("a")
- str = ""
- doc.write(str)
+ str = ""
+ doc.write(str)
- assert_equal("<?xml version='1.0' encoding='UTF-8'?><a/>", str)
- end
+ assert_equal("<?xml version='1.0' encoding='UTF-8'?><a/>", str)
+ end
- # Incomplete tags should generate an error
- def test_ticket_53
- assert_raise( REXML::ParseException ) {
- REXML::Document.new( "<a><b></a>" )
- }
- assert_raise( REXML::ParseException ) {
- REXML::Document.new( "<a><b>" )
- }
- assert_raise( REXML::ParseException ) {
- REXML::Document.new( "<a><b/>" )
- }
- end
+ # Incomplete tags should generate an error
+ def test_ticket_53
+ assert_raise( REXML::ParseException ) {
+ REXML::Document.new( "<a><b></a>" )
+ }
+ assert_raise( REXML::ParseException ) {
+ REXML::Document.new( "<a><b>" )
+ }
+ assert_raise( REXML::ParseException ) {
+ REXML::Document.new( "<a><b/>" )
+ }
+ end
- def test_ticket_52
- source = "<!-- this is a single line comment -->"
- d = REXML::Document.new(source)
- d.write(k="")
- assert_equal( source, k )
-
- source = "<a><!-- Comment --></a>"
- target = "<a>\n <!-- Comment -->\n</a>"
- d = REXML::Document.new(source)
- REXML::Formatters::Pretty.new(4).write(d,k="")
- assert_equal( target, k )
- end
+ def test_ticket_52
+ source = "<!-- this is a single line comment -->"
+ d = REXML::Document.new(source)
+ d.write(k="")
+ assert_equal( source, k )
+
+ source = "<a><!-- Comment --></a>"
+ target = "<a>\n <!-- Comment -->\n</a>"
+ d = REXML::Document.new(source)
+ REXML::Formatters::Pretty.new(4).write(d,k="")
+ assert_equal( target, k )
+ end
- def test_ticket_76
- src = "<div>at&t"
- assert_raise( ParseException, %Q{"#{src}" is invalid XML} ) {
- REXML::Document.new(src)
- }
- end
+ def test_ticket_76
+ src = "<div>at&t"
+ assert_raise( ParseException, %Q{"#{src}" is invalid XML} ) {
+ REXML::Document.new(src)
+ }
+ end
- def test_ticket_21
- src = "<foo bar=value/>"
- assert_raise( ParseException, "invalid XML should be caught" ) {
- Document.new(src)
- }
- begin
- Document.new(src)
- rescue
- assert_match( /missing attribute quote/, $!.message )
+ def test_ticket_21
+ src = "<foo bar=value/>"
+ assert_raise( ParseException, "invalid XML should be caught" ) {
+ Document.new(src)
+ }
+ begin
+ Document.new(src)
+ rescue
+ assert_match( /missing attribute quote/, $!.message )
+ end
end
- end
- def test_ticket_63
- Document.new(File.new(fixture_path("t63-1.xml")))
- end
+ def test_ticket_63
+ File.open(fixture_path("t63-1.xml")) {|f| Document.new(f) }
+ end
- def test_ticket_75
- d = REXML::Document.new(File.new(fixture_path("t75.xml")))
- assert_equal("tree", d.root.name)
- end
+ def test_ticket_75
+ d = File.open(fixture_path("t75.xml")) {|f| REXML::Document.new(f) }
+ assert_equal("tree", d.root.name)
+ end
- def test_ticket_48_part_II
- f = REXML::Formatters::Pretty.new
- #- rexml sanity check (bugs in ruby 1.8.4, ruby 1.8.6)
- xmldoc = Document.new("<test/>")
- xmldoc << XMLDecl.new(XMLDecl::DEFAULT_VERSION, "UTF-8")
- content = ['61c3a927223c3e26'].pack("H*")
- content.force_encoding('UTF-8') if content.respond_to?(:force_encoding)
- #- is some UTF-8 text but just to make sure my editor won't magically convert..
- xmldoc.root.add_attribute('attr', content)
- f.write(xmldoc,out=[])
-
- xmldoc = REXML::Document.new(out.join)
- sanity1 = xmldoc.root.attributes['attr']
- f.write(xmldoc,out=[])
-
- xmldoc = REXML::Document.new(out.join)
- sanity2 = xmldoc.root.attributes['attr']
- f.write(xmldoc,out=[])
-
- assert_equal( sanity1, sanity2 )
- end
+ def test_ticket_48_part_II
+ f = REXML::Formatters::Pretty.new
+ #- rexml sanity check (bugs in ruby 1.8.4, ruby 1.8.6)
+ xmldoc = Document.new("<test/>")
+ xmldoc << XMLDecl.new(XMLDecl::DEFAULT_VERSION, "UTF-8")
+ content = ['61c3a927223c3e26'].pack("H*")
+ content.force_encoding('UTF-8') if content.respond_to?(:force_encoding)
+ #- is some UTF-8 text but just to make sure my editor won't magically convert..
+ xmldoc.root.add_attribute('attr', content)
+ f.write(xmldoc,out=[])
+
+ xmldoc = REXML::Document.new(out.join)
+ sanity1 = xmldoc.root.attributes['attr']
+ f.write(xmldoc,out=[])
+
+ xmldoc = REXML::Document.new(out.join)
+ sanity2 = xmldoc.root.attributes['attr']
+ f.write(xmldoc,out=[])
+
+ assert_equal( sanity1, sanity2 )
+ end
- def test_ticket_88
- doc = REXML::Document.new("<?xml version=\"1.0\" encoding=\"shift_jis\"?>")
- assert_equal("<?xml version='1.0' encoding='SHIFT_JIS'?>", doc.to_s)
- doc = REXML::Document.new("<?xml version = \"1.0\" encoding = \"shift_jis\"?>")
- assert_equal("<?xml version='1.0' encoding='SHIFT_JIS'?>", doc.to_s)
- end
+ def test_ticket_88
+ doc = REXML::Document.new("<?xml version=\"1.0\" encoding=\"shift_jis\"?>")
+ assert_equal("<?xml version='1.0' encoding='SHIFT_JIS'?>", doc.to_s)
+ doc = REXML::Document.new("<?xml version = \"1.0\" encoding = \"shift_jis\"?>")
+ assert_equal("<?xml version='1.0' encoding='SHIFT_JIS'?>", doc.to_s)
+ end
- def test_ticket_85
- xml = <<ENDXML
+ def test_ticket_85
+ xml = <<ENDXML
<foo>
<bar>
<bob name='jimmy'/>
@@ -1326,137 +1330,138 @@ EOL
</foo>
ENDXML
- yml = "<foo>
+ yml = "<foo>
<bar>
<bob name='jimmy'/>
</bar>
</foo>"
- # The pretty printer ignores all whitespace, anyway so output1 == output2
- f = REXML::Formatters::Pretty.new( 2 )
- d = Document.new( xml, :ignore_whitespace_nodes=>:all )
- f.write( d, output1="" )
+ # The pretty printer ignores all whitespace, anyway so output1 == output2
+ f = REXML::Formatters::Pretty.new( 2 )
+ d = Document.new( xml, :ignore_whitespace_nodes=>:all )
+ f.write( d, output1="" )
- d = Document.new( xml )
- f.write( d, output2="" )
+ d = Document.new( xml )
+ f.write( d, output2="" )
- # Output directives should override whitespace directives.
- assert_equal( output1, output2 )
+ # Output directives should override whitespace directives.
+ assert_equal( output1, output2 )
- # The base case.
- d = Document.new(yml)
- f.write( d, output3="" )
+ # The base case.
+ d = Document.new(yml)
+ f.write( d, output3="" )
- assert_equal( output3.strip, output2.strip )
+ assert_equal( output3.strip, output2.strip )
- d = Document.new(yml)
- f.write( d, output4="" )
+ d = Document.new(yml)
+ f.write( d, output4="" )
- assert_equal( output3.strip, output4.strip )
- end
+ assert_equal( output3.strip, output4.strip )
+ end
- def test_ticket_91
- source="<root>
- <bah something='1' somethingelse='bah'>
- <something>great</something>
- </bah>
- </root>"
+ def test_ticket_91
+ source="<root>
+ <bah something='1' somethingelse='bah'>
+ <something>great</something>
+ </bah>
+ </root>"
expected="<root>
<bah something='1' somethingelse='bah'>
<something>great</something>
</bah>
<bah/>
</root>"
- d = Document.new( source )
- d.root.add_element( "bah" )
- p=REXML::Formatters::Pretty.new(2)
- p.compact = true # Don't add whitespace to text nodes unless necessary
- p.write(d,out="")
- assert_equal( expected, out )
- end
+ d = Document.new( source )
+ d.root.add_element( "bah" )
+ p=REXML::Formatters::Pretty.new(2)
+ p.compact = true # Don't add whitespace to text nodes unless necessary
+ p.write(d,out="")
+ assert_equal( expected, out )
+ end
- def test_ticket_95
- testd = REXML::Document.new "<a><b><c/><c/><c/></b></a>"
- testd.write(out1="")
- testd.elements["//c[2]"].xpath
- testd.write(out2="")
- assert_equal(out1,out2)
- end
+ def test_ticket_95
+ testd = REXML::Document.new "<a><b><c/><c/><c/></b></a>"
+ testd.write(out1="")
+ testd.elements["//c[2]"].xpath
+ testd.write(out2="")
+ assert_equal(out1,out2)
+ end
- def test_ticket_102
- doc = REXML::Document.new '<doc xmlns="ns"><item name="foo"/></doc>'
- assert_equal( "foo", doc.root.elements["item"].attribute("name","ns").to_s )
- assert_equal( "item", doc.root.elements["item[@name='foo']"].name )
- end
+ def test_ticket_102
+ doc = REXML::Document.new '<doc xmlns="ns"><item name="foo"/></doc>'
+ assert_equal( "foo", doc.root.elements["item"].attribute("name","ns").to_s )
+ assert_equal( "item", doc.root.elements["item[@name='foo']"].name )
+ end
- def test_ticket_14
- # Per .2.5 Node Tests of XPath spec
- assert_raise( REXML::UndefinedNamespaceException,
- %Q{Should have gotten an Undefined Namespace error} ) {
- Document.new("<a><n:b/></a>")
- }
- end
+ def test_ticket_14
+ # Per .2.5 Node Tests of XPath spec
+ assert_raise( REXML::UndefinedNamespaceException,
+ %Q{Should have gotten an Undefined Namespace error} ) {
+ Document.new("<a><n:b/></a>")
+ }
+ end
- # 5.7 Text Nodes
- # Character data is grouped into text nodes. As much character data as
- # possible is grouped into each text node: a text node never has an
- # immediately following or preceding sibling that is a text node. The
- # string-value of a text node is the character data. A text node always has
- # at least one character of data.
- def test_ticket_105
- d = Document.new("<a/>")
- d.root.add_text( "a" )
- d.root.add_text( "b" )
- assert_equal( 1, d.root.children.size )
- end
+ # 5.7 Text Nodes
+ # Character data is grouped into text nodes. As much character data as
+ # possible is grouped into each text node: a text node never has an
+ # immediately following or preceding sibling that is a text node. The
+ # string-value of a text node is the character data. A text node always has
+ # at least one character of data.
+ def test_ticket_105
+ d = Document.new("<a/>")
+ d.root.add_text( "a" )
+ d.root.add_text( "b" )
+ assert_equal( 1, d.root.children.size )
+ end
- # phantom namespace same as default namespace
- def test_ticket_121
- doc = REXML::Document.new(
- '<doc xmlns="ns" xmlns:phantom="ns"><item name="foo">text</item></doc>'
- )
- assert_equal 'text', doc.text( "/doc/item[@name='foo']" )
- assert_equal "name='foo'",
- doc.root.elements["item"].attribute("name", "ns").inspect
- assert_equal "<item name='foo'>text</item>",
- doc.root.elements["item[@name='foo']"].to_s
- end
+ # phantom namespace same as default namespace
+ def test_ticket_121
+ doc = REXML::Document.new(
+ '<doc xmlns="ns" xmlns:phantom="ns"><item name="foo">text</item></doc>'
+ )
+ assert_equal 'text', doc.text( "/doc/item[@name='foo']" )
+ assert_equal "name='foo'",
+ doc.root.elements["item"].attribute("name", "ns").inspect
+ assert_equal "<item name='foo'>text</item>",
+ doc.root.elements["item[@name='foo']"].to_s
+ end
- def test_ticket_135
- bean_element = REXML::Element.new("bean")
- textToAdd = "(&#38;(|(memberof=CN=somegroupabcdefgh,OU=OUsucks,DC=hookemhorns,DC=com)(mail=*someco.com))(acct=%u)(!(extraparameter:2.2.222.222222.2.2.222:=2)))"
- bean_element.add_element("prop", {"key"=> "filter"}).add_text(textToAdd)
- doc = REXML::Document.new
- doc.add_element(bean_element)
+ def test_ticket_135
+ bean_element = REXML::Element.new("bean")
+ textToAdd = "(&#38;(|(memberof=CN=somegroupabcdefgh,OU=OUsucks,DC=hookemhorns,DC=com)(mail=*someco.com))(acct=%u)(!(extraparameter:2.2.222.222222.2.2.222:=2)))"
+ bean_element.add_element("prop", {"key"=> "filter"}).add_text(textToAdd)
+ doc = REXML::Document.new
+ doc.add_element(bean_element)
- REXML::Formatters::Pretty.new(3).write( doc, out = "" )
+ REXML::Formatters::Pretty.new(3).write( doc, out = "" )
- assert_equal "<bean>\n <prop key='filter'>\n (&amp;#38;(|(memberof=CN=somegroupabcdefgh,OU=OUsucks,DC=hookemhorns,DC=com)(mail=*someco.com))(acct=%u)(!(extraparameter:2.2.222.222222.2.2.222:=2)))\n </prop>\n</bean>", out
- end
+ assert_equal "<bean>\n <prop key='filter'>\n (&amp;#38;(|(memberof=CN=somegroupabcdefgh,OU=OUsucks,DC=hookemhorns,DC=com)(mail=*someco.com))(acct=%u)(!(extraparameter:2.2.222.222222.2.2.222:=2)))\n </prop>\n</bean>", out
+ end
- def test_ticket_138
- doc = REXML::Document.new(
- '<svg xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" ' +
- 'inkscape:version="0.44" version="1.0"/>'
- )
- expected = {
- "inkscape" => attribute("xmlns:inkscape",
- "http://www.inkscape.org/namespaces/inkscape"),
- "version" => {
- "inkscape" => attribute("inkscape:version", "0.44"),
- "" => attribute("version", "1.0"),
- },
- }
- assert_equal(expected, doc.root.attributes)
- assert_equal(expected, REXML::Document.new(doc.root.to_s).root.attributes)
- end
+ def test_ticket_138
+ doc = REXML::Document.new(
+ '<svg xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" ' +
+ 'inkscape:version="0.44" version="1.0"/>'
+ )
+ expected = {
+ "inkscape" => attribute("xmlns:inkscape",
+ "http://www.inkscape.org/namespaces/inkscape"),
+ "version" => {
+ "inkscape" => attribute("inkscape:version", "0.44"),
+ "" => attribute("version", "1.0"),
+ },
+ }
+ assert_equal(expected, doc.root.attributes)
+ assert_equal(expected, REXML::Document.new(doc.root.to_s).root.attributes)
+ end
- def test_empty_doc
- assert(REXML::Document.new('').children.empty?)
- end
+ def test_empty_doc
+ assert(REXML::Document.new('').children.empty?)
+ end
- private
- def attribute(name, value)
- REXML::Attribute.new(name, value)
+ private
+ def attribute(name, value)
+ REXML::Attribute.new(name, value)
+ end
end
end
diff --git a/test/rexml/test_doctype.rb b/test/rexml/test_doctype.rb
index 0a87c0a304..0b3ea11929 100644
--- a/test/rexml/test_doctype.rb
+++ b/test/rexml/test_doctype.rb
@@ -1,107 +1,106 @@
-#! /usr/local/bin/ruby
-
-
require 'test/unit'
require 'rexml/document'
-class TestDocTypeAccessor < Test::Unit::TestCase
-
- def setup
- @sysid = "urn:x-test:sysid1"
- @notid1 = "urn:x-test:notation1"
- @notid2 = "urn:x-test:notation2"
- document_string1 = <<-"XMLEND"
- <!DOCTYPE r SYSTEM "#{@sysid}" [
- <!NOTATION n1 SYSTEM "#{@notid1}">
- <!NOTATION n2 SYSTEM "#{@notid2}">
- ]>
- <r/>
- XMLEND
- @doctype1 = REXML::Document.new(document_string1).doctype
-
- @pubid = "TEST_ID"
- document_string2 = <<-"XMLEND"
- <!DOCTYPE r PUBLIC "#{@pubid}">
- <r/>
- XMLEND
- @doctype2 = REXML::Document.new(document_string2).doctype
-
- document_string3 = <<-"XMLEND"
- <!DOCTYPE r PUBLIC "#{@pubid}" "#{@sysid}">
- <r/>
- XMLEND
- @doctype3 = REXML::Document.new(document_string3).doctype
-
- end
-
- def test_public
- assert_equal(nil, @doctype1.public)
- assert_equal(@pubid, @doctype2.public)
- assert_equal(@pubid, @doctype3.public)
- end
-
- def test_system
- assert_equal(@sysid, @doctype1.system)
- assert_equal(nil, @doctype2.system)
- assert_equal(@sysid, @doctype3.system)
- end
-
- def test_notation
- assert_equal(@notid1, @doctype1.notation("n1").system)
- assert_equal(@notid2, @doctype1.notation("n2").system)
- end
-
- def test_notations
- notations = @doctype1.notations
- assert_equal(2, notations.length)
- assert_equal(@notid1, find_notation(notations, "n1").system)
- assert_equal(@notid2, find_notation(notations, "n2").system)
- end
-
- def find_notation(notations, name)
- notations.find { |notation|
- name == notation.name
- }
- end
-
-end
-
-class TestNotationDeclPublic < Test::Unit::TestCase
- def setup
- @name = "vrml"
- @id = "VRML 1.0"
- @uri = "http://www.web3d.org/"
- end
-
- def test_to_s
- assert_equal("<!NOTATION #{@name} PUBLIC \"#{@id}\">",
- decl(@id, nil).to_s)
- end
-
- def test_to_s_with_uri
- assert_equal("<!NOTATION #{@name} PUBLIC \"#{@id}\" \"#{@uri}\">",
- decl(@id, @uri).to_s)
- end
-
- private
- def decl(id, uri)
- REXML::NotationDecl.new(@name, "PUBLIC", id, uri)
- end
-end
+module REXMLTests
+ class TestDocTypeAccessor < Test::Unit::TestCase
+
+ def setup
+ @sysid = "urn:x-test:sysid1"
+ @notid1 = "urn:x-test:notation1"
+ @notid2 = "urn:x-test:notation2"
+ document_string1 = <<-"XMLEND"
+ <!DOCTYPE r SYSTEM "#{@sysid}" [
+ <!NOTATION n1 SYSTEM "#{@notid1}">
+ <!NOTATION n2 SYSTEM "#{@notid2}">
+ ]>
+ <r/>
+ XMLEND
+ @doctype1 = REXML::Document.new(document_string1).doctype
+
+ @pubid = "TEST_ID"
+ document_string2 = <<-"XMLEND"
+ <!DOCTYPE r PUBLIC "#{@pubid}">
+ <r/>
+ XMLEND
+ @doctype2 = REXML::Document.new(document_string2).doctype
+
+ document_string3 = <<-"XMLEND"
+ <!DOCTYPE r PUBLIC "#{@pubid}" "#{@sysid}">
+ <r/>
+ XMLEND
+ @doctype3 = REXML::Document.new(document_string3).doctype
+
+ end
+
+ def test_public
+ assert_equal(nil, @doctype1.public)
+ assert_equal(@pubid, @doctype2.public)
+ assert_equal(@pubid, @doctype3.public)
+ end
+
+ def test_system
+ assert_equal(@sysid, @doctype1.system)
+ assert_equal(nil, @doctype2.system)
+ assert_equal(@sysid, @doctype3.system)
+ end
+
+ def test_notation
+ assert_equal(@notid1, @doctype1.notation("n1").system)
+ assert_equal(@notid2, @doctype1.notation("n2").system)
+ end
+
+ def test_notations
+ notations = @doctype1.notations
+ assert_equal(2, notations.length)
+ assert_equal(@notid1, find_notation(notations, "n1").system)
+ assert_equal(@notid2, find_notation(notations, "n2").system)
+ end
+
+ def find_notation(notations, name)
+ notations.find { |notation|
+ name == notation.name
+ }
+ end
-class TestNotationDeclSystem < Test::Unit::TestCase
- def setup
- @name = "gif"
- @id = "gif viewer"
end
- def test_to_s
- assert_equal("<!NOTATION #{@name} SYSTEM \"#{@id}\">",
- decl(@id).to_s)
+ class TestNotationDeclPublic < Test::Unit::TestCase
+ def setup
+ @name = "vrml"
+ @id = "VRML 1.0"
+ @uri = "http://www.web3d.org/"
+ end
+
+ def test_to_s
+ assert_equal("<!NOTATION #{@name} PUBLIC \"#{@id}\">",
+ decl(@id, nil).to_s)
+ end
+
+ def test_to_s_with_uri
+ assert_equal("<!NOTATION #{@name} PUBLIC \"#{@id}\" \"#{@uri}\">",
+ decl(@id, @uri).to_s)
+ end
+
+ private
+ def decl(id, uri)
+ REXML::NotationDecl.new(@name, "PUBLIC", id, uri)
+ end
end
- private
- def decl(id)
- REXML::NotationDecl.new(@name, "SYSTEM", id, nil)
+ class TestNotationDeclSystem < Test::Unit::TestCase
+ def setup
+ @name = "gif"
+ @id = "gif viewer"
+ end
+
+ def test_to_s
+ assert_equal("<!NOTATION #{@name} SYSTEM \"#{@id}\">",
+ decl(@id).to_s)
+ end
+
+ private
+ def decl(id)
+ REXML::NotationDecl.new(@name, "SYSTEM", id, nil)
+ end
end
end
diff --git a/test/rexml/test_document.rb b/test/rexml/test_document.rb
index 3ef584c290..db3c0e97c3 100644
--- a/test/rexml/test_document.rb
+++ b/test/rexml/test_document.rb
@@ -3,35 +3,36 @@
require "rexml/document"
require "test/unit"
-class REXML::TestDocument < Test::Unit::TestCase
- def test_version_attributes_to_s
- doc = REXML::Document.new(<<-eoxml)
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
- <svg id="svg2"
- xmlns:sodipodi="foo"
- xmlns:inkscape="bar"
- sodipodi:version="0.32"
- inkscape:version="0.44.1"
- >
- </svg>
- eoxml
+module REXMLTests
+ class TestDocument < Test::Unit::TestCase
+ def test_version_attributes_to_s
+ doc = REXML::Document.new(<<-eoxml)
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
+ <svg id="svg2"
+ xmlns:sodipodi="foo"
+ xmlns:inkscape="bar"
+ sodipodi:version="0.32"
+ inkscape:version="0.44.1"
+ >
+ </svg>
+ eoxml
- string = doc.to_s
- assert_match('xmlns:sodipodi', string)
- assert_match('xmlns:inkscape', string)
- assert_match('sodipodi:version', string)
- assert_match('inkscape:version', string)
- end
+ string = doc.to_s
+ assert_match('xmlns:sodipodi', string)
+ assert_match('xmlns:inkscape', string)
+ assert_match('sodipodi:version', string)
+ assert_match('inkscape:version', string)
+ end
- def test_new
- doc = REXML::Document.new(<<EOF)
+ def test_new
+ doc = REXML::Document.new(<<EOF)
<?xml version="1.0" encoding="UTF-8"?>
<message>Hello world!</message>
EOF
- assert_equal("Hello world!", doc.root.children.first.value)
- end
+ assert_equal("Hello world!", doc.root.children.first.value)
+ end
- XML_WITH_NESTED_ENTITY = <<EOF
+ XML_WITH_NESTED_ENTITY = <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE member [
<!ENTITY a "&b;&b;&b;&b;&b;&b;&b;&b;&b;&b;">
@@ -47,7 +48,7 @@ EOF
</member>
EOF
- XML_WITH_4_ENTITY_EXPANSION = <<EOF
+ XML_WITH_4_ENTITY_EXPANSION = <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE member [
<!ENTITY a "a">
@@ -60,259 +61,260 @@ EOF
</member>
EOF
- def test_entity_expansion_limit
- doc = REXML::Document.new(XML_WITH_NESTED_ENTITY)
- assert_raise(RuntimeError) do
- doc.root.children.first.value
- end
- REXML::Document.entity_expansion_limit = 100
- assert_equal(100, REXML::Document.entity_expansion_limit)
- doc = REXML::Document.new(XML_WITH_NESTED_ENTITY)
- assert_raise(RuntimeError) do
- doc.root.children.first.value
- end
- assert_equal(101, doc.entity_expansion_count)
+ def test_entity_expansion_limit
+ doc = REXML::Document.new(XML_WITH_NESTED_ENTITY)
+ assert_raise(RuntimeError) do
+ doc.root.children.first.value
+ end
+ REXML::Security.entity_expansion_limit = 100
+ assert_equal(100, REXML::Security.entity_expansion_limit)
+ doc = REXML::Document.new(XML_WITH_NESTED_ENTITY)
+ assert_raise(RuntimeError) do
+ doc.root.children.first.value
+ end
+ assert_equal(101, doc.entity_expansion_count)
- REXML::Document.entity_expansion_limit = 4
- doc = REXML::Document.new(XML_WITH_4_ENTITY_EXPANSION)
- assert_equal("\na\na a\n<\n", doc.root.children.first.value)
- REXML::Document.entity_expansion_limit = 3
- doc = REXML::Document.new(XML_WITH_4_ENTITY_EXPANSION)
- assert_raise(RuntimeError) do
- doc.root.children.first.value
+ REXML::Security.entity_expansion_limit = 4
+ doc = REXML::Document.new(XML_WITH_4_ENTITY_EXPANSION)
+ assert_equal("\na\na a\n<\n", doc.root.children.first.value)
+ REXML::Security.entity_expansion_limit = 3
+ doc = REXML::Document.new(XML_WITH_4_ENTITY_EXPANSION)
+ assert_raise(RuntimeError) do
+ doc.root.children.first.value
+ end
+ ensure
+ REXML::Security.entity_expansion_limit = 10000
end
- ensure
- REXML::Document.entity_expansion_limit = 10000
- end
- def test_tag_in_cdata_with_not_ascii_only_but_ascii8bit_encoding_source
- tag = "<b>...</b>"
- message = "こんにちは、世界!" # Hello world! in Japanese
- xml = <<EOX
+ def test_tag_in_cdata_with_not_ascii_only_but_ascii8bit_encoding_source
+ tag = "<b>...</b>"
+ message = "こんにちは、世界!" # Hello world! in Japanese
+ xml = <<EOX
<?xml version="1.0" encoding="UTF-8"?>
<message><![CDATA[#{tag}#{message}]]></message>
EOX
- xml.force_encoding(Encoding::ASCII_8BIT)
- doc = REXML::Document.new(xml)
- assert_equal("#{tag}#{message}", doc.root.children.first.value)
- end
+ xml.force_encoding(Encoding::ASCII_8BIT)
+ doc = REXML::Document.new(xml)
+ assert_equal("#{tag}#{message}", doc.root.children.first.value)
+ end
- def test_xml_declaration_standalone
- bug2539 = '[ruby-core:27345]'
- doc = REXML::Document.new('<?xml version="1.0" standalone="no" ?>')
- assert_equal('no', doc.stand_alone?, bug2539)
- doc = REXML::Document.new('<?xml version="1.0" standalone= "no" ?>')
- assert_equal('no', doc.stand_alone?, bug2539)
- doc = REXML::Document.new('<?xml version="1.0" standalone= "no" ?>')
- assert_equal('no', doc.stand_alone?, bug2539)
- end
+ def test_xml_declaration_standalone
+ bug2539 = '[ruby-core:27345]'
+ doc = REXML::Document.new('<?xml version="1.0" standalone="no" ?>')
+ assert_equal('no', doc.stand_alone?, bug2539)
+ doc = REXML::Document.new('<?xml version="1.0" standalone= "no" ?>')
+ assert_equal('no', doc.stand_alone?, bug2539)
+ doc = REXML::Document.new('<?xml version="1.0" standalone= "no" ?>')
+ assert_equal('no', doc.stand_alone?, bug2539)
+ end
- class WriteTest < Test::Unit::TestCase
- def setup
- @document = REXML::Document.new(<<-EOX)
+ class WriteTest < Test::Unit::TestCase
+ def setup
+ @document = REXML::Document.new(<<-EOX)
<?xml version="1.0" encoding="UTF-8"?>
<message>Hello world!</message>
EOX
- end
+ end
- class ArgumentsTest < self
- def test_output
- output = ""
- @document.write(output)
- assert_equal(<<-EOX, output)
+ class ArgumentsTest < self
+ def test_output
+ output = ""
+ @document.write(output)
+ assert_equal(<<-EOX, output)
<?xml version='1.0' encoding='UTF-8'?>
<message>Hello world!</message>
EOX
- end
+ end
- def test_indent
- output = ""
- indent = 2
- @document.write(output, indent)
- assert_equal(<<-EOX.chomp, output)
+ def test_indent
+ output = ""
+ indent = 2
+ @document.write(output, indent)
+ assert_equal(<<-EOX.chomp, output)
<?xml version='1.0' encoding='UTF-8'?>
<message>
Hello world!
</message>
EOX
- end
+ end
- def test_transitive
- output = ""
- indent = 2
- transitive = true
- @document.write(output, indent, transitive)
- assert_equal(<<-EOX, output)
+ def test_transitive
+ output = ""
+ indent = 2
+ transitive = true
+ @document.write(output, indent, transitive)
+ assert_equal(<<-EOX, output)
<?xml version='1.0' encoding='UTF-8'?>
<message
>Hello world!</message
>
EOX
- end
+ end
- def test_ie_hack
- output = ""
- indent = -1
- transitive = false
- ie_hack = true
- document = REXML::Document.new("<empty/>")
- document.write(output, indent, transitive, ie_hack)
- assert_equal("<empty />", output)
- end
+ def test_ie_hack
+ output = ""
+ indent = -1
+ transitive = false
+ ie_hack = true
+ document = REXML::Document.new("<empty/>")
+ document.write(output, indent, transitive, ie_hack)
+ assert_equal("<empty />", output)
+ end
- def test_encoding
- output = ""
- indent = -1
- transitive = false
- ie_hack = false
- encoding = "Windows-31J"
+ def test_encoding
+ output = ""
+ indent = -1
+ transitive = false
+ ie_hack = false
+ encoding = "Windows-31J"
- @document.xml_decl.encoding = "Shift_JIS"
- japanese_text = "こんにちは"
- @document.root.text = japanese_text
- @document.write(output, indent, transitive, ie_hack, encoding)
- assert_equal(<<-EOX.encode(encoding), output)
+ @document.xml_decl.encoding = "Shift_JIS"
+ japanese_text = "こんにちは"
+ @document.root.text = japanese_text
+ @document.write(output, indent, transitive, ie_hack, encoding)
+ assert_equal(<<-EOX.encode(encoding), output)
<?xml version='1.0' encoding='SHIFT_JIS'?>
<message>#{japanese_text}</message>
EOX
+ end
end
- end
- class OptionsTest < self
- def test_output
- output = ""
- @document.write(:output => output)
- assert_equal(<<-EOX, output)
+ class OptionsTest < self
+ def test_output
+ output = ""
+ @document.write(:output => output)
+ assert_equal(<<-EOX, output)
<?xml version='1.0' encoding='UTF-8'?>
<message>Hello world!</message>
EOX
- end
+ end
- def test_indent
- output = ""
- @document.write(:output => output, :indent => 2)
- assert_equal(<<-EOX.chomp, output)
+ def test_indent
+ output = ""
+ @document.write(:output => output, :indent => 2)
+ assert_equal(<<-EOX.chomp, output)
<?xml version='1.0' encoding='UTF-8'?>
<message>
Hello world!
</message>
EOX
- end
+ end
- def test_transitive
- output = ""
- @document.write(:output => output, :indent => 2, :transitive => true)
- assert_equal(<<-EOX, output)
+ def test_transitive
+ output = ""
+ @document.write(:output => output, :indent => 2, :transitive => true)
+ assert_equal(<<-EOX, output)
<?xml version='1.0' encoding='UTF-8'?>
<message
>Hello world!</message
>
EOX
- end
+ end
- def test_ie_hack
- output = ""
- document = REXML::Document.new("<empty/>")
- document.write(:output => output, :ie_hack => true)
- assert_equal("<empty />", output)
- end
+ def test_ie_hack
+ output = ""
+ document = REXML::Document.new("<empty/>")
+ document.write(:output => output, :ie_hack => true)
+ assert_equal("<empty />", output)
+ end
- def test_encoding
- output = ""
- encoding = "Windows-31J"
- @document.xml_decl.encoding = "Shift_JIS"
- japanese_text = "こんにちは"
- @document.root.text = japanese_text
- @document.write(:output => output, :encoding => encoding)
- assert_equal(<<-EOX.encode(encoding), output)
+ def test_encoding
+ output = ""
+ encoding = "Windows-31J"
+ @document.xml_decl.encoding = "Shift_JIS"
+ japanese_text = "こんにちは"
+ @document.root.text = japanese_text
+ @document.write(:output => output, :encoding => encoding)
+ assert_equal(<<-EOX.encode(encoding), output)
<?xml version='1.0' encoding='SHIFT_JIS'?>
<message>#{japanese_text}</message>
EOX
+ end
end
end
- end
- class BomTest < self
- class HaveEncodingTest < self
- def test_utf_8
- xml = <<-EOX.force_encoding("ASCII-8BIT")
+ class BomTest < self
+ class HaveEncodingTest < self
+ def test_utf_8
+ xml = <<-EOX.force_encoding("ASCII-8BIT")
<?xml version="1.0" encoding="UTF-8"?>
<message>Hello world!</message>
EOX
- bom = "\ufeff".force_encoding("ASCII-8BIT")
- document = REXML::Document.new(bom + xml)
- assert_equal("UTF-8", document.encoding)
- end
+ bom = "\ufeff".force_encoding("ASCII-8BIT")
+ document = REXML::Document.new(bom + xml)
+ assert_equal("UTF-8", document.encoding)
+ end
- def test_utf_16le
- xml = <<-EOX.encode("UTF-16LE").force_encoding("ASCII-8BIT")
+ def test_utf_16le
+ xml = <<-EOX.encode("UTF-16LE").force_encoding("ASCII-8BIT")
<?xml version="1.0" encoding="UTF-16"?>
<message>Hello world!</message>
EOX
- bom = "\ufeff".encode("UTF-16LE").force_encoding("ASCII-8BIT")
- document = REXML::Document.new(bom + xml)
- assert_equal("UTF-16", document.encoding)
- end
+ bom = "\ufeff".encode("UTF-16LE").force_encoding("ASCII-8BIT")
+ document = REXML::Document.new(bom + xml)
+ assert_equal("UTF-16", document.encoding)
+ end
- def test_utf_16be
- xml = <<-EOX.encode("UTF-16BE").force_encoding("ASCII-8BIT")
+ def test_utf_16be
+ xml = <<-EOX.encode("UTF-16BE").force_encoding("ASCII-8BIT")
<?xml version="1.0" encoding="UTF-16"?>
<message>Hello world!</message>
EOX
- bom = "\ufeff".encode("UTF-16BE").force_encoding("ASCII-8BIT")
- document = REXML::Document.new(bom + xml)
- assert_equal("UTF-16", document.encoding)
+ bom = "\ufeff".encode("UTF-16BE").force_encoding("ASCII-8BIT")
+ document = REXML::Document.new(bom + xml)
+ assert_equal("UTF-16", document.encoding)
+ end
end
- end
- class NoEncodingTest < self
- def test_utf_8
- xml = <<-EOX.force_encoding("ASCII-8BIT")
+ class NoEncodingTest < self
+ def test_utf_8
+ xml = <<-EOX.force_encoding("ASCII-8BIT")
<?xml version="1.0"?>
<message>Hello world!</message>
EOX
- bom = "\ufeff".force_encoding("ASCII-8BIT")
- document = REXML::Document.new(bom + xml)
- assert_equal("UTF-8", document.encoding)
- end
+ bom = "\ufeff".force_encoding("ASCII-8BIT")
+ document = REXML::Document.new(bom + xml)
+ assert_equal("UTF-8", document.encoding)
+ end
- def test_utf_16le
- xml = <<-EOX.encode("UTF-16LE").force_encoding("ASCII-8BIT")
+ def test_utf_16le
+ xml = <<-EOX.encode("UTF-16LE").force_encoding("ASCII-8BIT")
<?xml version="1.0"?>
<message>Hello world!</message>
EOX
- bom = "\ufeff".encode("UTF-16LE").force_encoding("ASCII-8BIT")
- document = REXML::Document.new(bom + xml)
- assert_equal("UTF-16", document.encoding)
- end
+ bom = "\ufeff".encode("UTF-16LE").force_encoding("ASCII-8BIT")
+ document = REXML::Document.new(bom + xml)
+ assert_equal("UTF-16", document.encoding)
+ end
- def test_utf_16be
- xml = <<-EOX.encode("UTF-16BE").force_encoding("ASCII-8BIT")
+ def test_utf_16be
+ xml = <<-EOX.encode("UTF-16BE").force_encoding("ASCII-8BIT")
<?xml version="1.0"?>
<message>Hello world!</message>
EOX
- bom = "\ufeff".encode("UTF-16BE").force_encoding("ASCII-8BIT")
- document = REXML::Document.new(bom + xml)
- assert_equal("UTF-16", document.encoding)
+ bom = "\ufeff".encode("UTF-16BE").force_encoding("ASCII-8BIT")
+ document = REXML::Document.new(bom + xml)
+ assert_equal("UTF-16", document.encoding)
+ end
end
- end
- class WriteTest < self
- def test_utf_16
- xml = <<-EOX.encode("UTF-16LE").force_encoding("ASCII-8BIT")
+ class WriteTest < self
+ def test_utf_16
+ xml = <<-EOX.encode("UTF-16LE").force_encoding("ASCII-8BIT")
<?xml version="1.0"?>
<message>Hello world!</message>
EOX
- bom = "\ufeff".encode("UTF-16LE").force_encoding("ASCII-8BIT")
- document = REXML::Document.new(bom + xml)
+ bom = "\ufeff".encode("UTF-16LE").force_encoding("ASCII-8BIT")
+ document = REXML::Document.new(bom + xml)
- actual_xml = ""
- document.write(actual_xml)
- expected_xml = <<-EOX.encode("UTF-16BE")
+ actual_xml = ""
+ document.write(actual_xml)
+ expected_xml = <<-EOX.encode("UTF-16BE")
\ufeff<?xml version='1.0' encoding='UTF-16'?>
<message>Hello world!</message>
EOX
- assert_equal(expected_xml, actual_xml)
+ assert_equal(expected_xml, actual_xml)
+ end
end
end
end
diff --git a/test/rexml/test_elements.rb b/test/rexml/test_elements.rb
index e5e209ecdc..f253a75daf 100644
--- a/test/rexml/test_elements.rb
+++ b/test/rexml/test_elements.rb
@@ -1,116 +1,118 @@
require 'test/unit/testcase'
require 'rexml/document'
-class ElementsTester < Test::Unit::TestCase
- include REXML
- def test_accessor
- doc = Document.new '<a><b/><c id="1"/><c id="2"/><d/></a>'
- assert_equal 'b', doc.root.elements[1].name
- assert_equal '1', doc.root.elements['c'].attributes['id']
- assert_equal '2', doc.root.elements[2,'c'].attributes['id']
- end
+module REXMLTests
+ class ElementsTester < Test::Unit::TestCase
+ include REXML
+ def test_accessor
+ doc = Document.new '<a><b/><c id="1"/><c id="2"/><d/></a>'
+ assert_equal 'b', doc.root.elements[1].name
+ assert_equal '1', doc.root.elements['c'].attributes['id']
+ assert_equal '2', doc.root.elements[2,'c'].attributes['id']
+ end
- def test_indexing
- doc = Document.new '<a/>'
- doc.root.elements[10] = Element.new('b')
- assert_equal 'b', doc.root.elements[1].name
- doc.root.elements[1] = Element.new('c')
- assert_equal 'c', doc.root.elements[1].name
- doc.root.elements['c'] = Element.new('d')
- assert_equal 'd', doc.root.elements[1].name
- end
+ def test_indexing
+ doc = Document.new '<a/>'
+ doc.root.elements[10] = Element.new('b')
+ assert_equal 'b', doc.root.elements[1].name
+ doc.root.elements[1] = Element.new('c')
+ assert_equal 'c', doc.root.elements[1].name
+ doc.root.elements['c'] = Element.new('d')
+ assert_equal 'd', doc.root.elements[1].name
+ end
- def test_delete
- doc = Document.new '<a><b/><c/><c id="1"/></a>'
- block = proc { |str|
- out = ''
- doc.write out
- assert_equal str, out
- }
- b = doc.root.elements[1]
- doc.root.elements.delete b
- block.call( "<a><c/><c id='1'/></a>" )
- doc.elements.delete("a/c[@id='1']")
- block.call( '<a><c/></a>' )
- doc.root.elements.delete 1
- block.call( '<a/>' )
- end
+ def test_delete
+ doc = Document.new '<a><b/><c/><c id="1"/></a>'
+ block = proc { |str|
+ out = ''
+ doc.write out
+ assert_equal str, out
+ }
+ b = doc.root.elements[1]
+ doc.root.elements.delete b
+ block.call( "<a><c/><c id='1'/></a>" )
+ doc.elements.delete("a/c[@id='1']")
+ block.call( '<a><c/></a>' )
+ doc.root.elements.delete 1
+ block.call( '<a/>' )
+ end
- def test_delete_all
- doc = Document.new '<a><c/><c/><c/><c/></a>'
- deleted = doc.elements.delete_all 'a/c'
- assert_equal 4, deleted.size
- end
+ def test_delete_all
+ doc = Document.new '<a><c/><c/><c/><c/></a>'
+ deleted = doc.elements.delete_all 'a/c'
+ assert_equal 4, deleted.size
+ end
- def test_ticket_36
- doc = Document.new( "<a xmlns:xi='foo'><b><xi:c id='1'/></b><xi:c id='2'/></a>" )
+ def test_ticket_36
+ doc = Document.new( "<a xmlns:xi='foo'><b><xi:c id='1'/></b><xi:c id='2'/></a>" )
- deleted = doc.root.elements.delete_all( "xi:c" )
- assert_equal( 1, deleted.size )
+ deleted = doc.root.elements.delete_all( "xi:c" )
+ assert_equal( 1, deleted.size )
- doc = Document.new( "<a xmlns:xi='foo'><b><xi:c id='1'/></b><xi:c id='2'/></a>" )
- deleted = doc.root.elements.delete_all( "//xi:c" )
- assert_equal( 2, deleted.size )
- end
+ doc = Document.new( "<a xmlns:xi='foo'><b><xi:c id='1'/></b><xi:c id='2'/></a>" )
+ deleted = doc.root.elements.delete_all( "//xi:c" )
+ assert_equal( 2, deleted.size )
+ end
- def test_add
- a = Element.new 'a'
- a.elements.add Element.new('b')
- assert_equal 'b', a.elements[1].name
- a.elements.add 'c'
- assert_equal 'c', a.elements[2].name
- end
+ def test_add
+ a = Element.new 'a'
+ a.elements.add Element.new('b')
+ assert_equal 'b', a.elements[1].name
+ a.elements.add 'c'
+ assert_equal 'c', a.elements[2].name
+ end
- def test_size
- doc = Document.new '<a>sean<b/>elliott<b/>russell<b/></a>'
- assert_equal 6, doc.root.size
- assert_equal 3, doc.root.elements.size
- end
+ def test_size
+ doc = Document.new '<a>sean<b/>elliott<b/>russell<b/></a>'
+ assert_equal 6, doc.root.size
+ assert_equal 3, doc.root.elements.size
+ end
- def test_each
- doc = Document.new '<a><b/><c/><d/>sean<b/><c/><d/></a>'
- count = 0
- block = proc {|e| count += 1}
- doc.root.elements.each(&block)
- assert_equal 6, count
- count = 0
- doc.root.elements.each('b', &block)
- assert_equal 2, count
- count = 0
- doc.root.elements.each('child::node()', &block)
- assert_equal 6, count
- count = 0
- XPath.each(doc.root, 'child::node()', &block)
- assert_equal 7, count
- end
+ def test_each
+ doc = Document.new '<a><b/><c/><d/>sean<b/><c/><d/></a>'
+ count = 0
+ block = proc {|e| count += 1}
+ doc.root.elements.each(&block)
+ assert_equal 6, count
+ count = 0
+ doc.root.elements.each('b', &block)
+ assert_equal 2, count
+ count = 0
+ doc.root.elements.each('child::node()', &block)
+ assert_equal 6, count
+ count = 0
+ XPath.each(doc.root, 'child::node()', &block)
+ assert_equal 7, count
+ end
- def test_each_with_frozen_condition
- doc = Document.new('<books><book name="Ruby"/><book name="XML"/></books>')
- names = []
- doc.root.elements.each('book'.freeze) do |element|
- names << element.attributes["name"]
+ def test_each_with_frozen_condition
+ doc = Document.new('<books><book name="Ruby"/><book name="XML"/></books>')
+ names = []
+ doc.root.elements.each('book'.freeze) do |element|
+ names << element.attributes["name"]
+ end
+ assert_equal(["Ruby", "XML"], names)
end
- assert_equal(["Ruby", "XML"], names)
- end
- def test_to_a
- doc = Document.new '<a>sean<b/>elliott<c/></a>'
- assert_equal 2, doc.root.elements.to_a.size
- assert_equal 2, doc.root.elements.to_a("child::node()").size
- assert_equal 4, XPath.match(doc.root, "child::node()").size
- end
+ def test_to_a
+ doc = Document.new '<a>sean<b/>elliott<c/></a>'
+ assert_equal 2, doc.root.elements.to_a.size
+ assert_equal 2, doc.root.elements.to_a("child::node()").size
+ assert_equal 4, XPath.match(doc.root, "child::node()").size
+ end
- def test_collect
- doc = Document.new( "<a><b id='1'/><b id='2'/></a>" )
- r = doc.elements.collect( "/a/b" ) { |e| e.attributes["id"].to_i }
- assert_equal( [1,2], r )
- end
+ def test_collect
+ doc = Document.new( "<a><b id='1'/><b id='2'/></a>" )
+ r = doc.elements.collect( "/a/b" ) { |e| e.attributes["id"].to_i }
+ assert_equal( [1,2], r )
+ end
- def test_inject
- doc = Document.new( "<a><b id='1'/><b id='2'/></a>" )
- r = doc.elements.inject( "/a/b", 3 ) { |s, e|
- s + e.attributes["id"].to_i
- }
- assert_equal 6, r
+ def test_inject
+ doc = Document.new( "<a><b id='1'/><b id='2'/></a>" )
+ r = doc.elements.inject( "/a/b", 3 ) { |s, e|
+ s + e.attributes["id"].to_i
+ }
+ assert_equal 6, r
+ end
end
end
diff --git a/test/rexml/test_encoding.rb b/test/rexml/test_encoding.rb
index 9bcdfb3118..3b2a56ac5e 100644
--- a/test/rexml/test_encoding.rb
+++ b/test/rexml/test_encoding.rb
@@ -1,94 +1,98 @@
# coding: binary
-require "rexml_test_utils"
+require_relative "rexml_test_utils"
require 'rexml/source'
require 'rexml/document'
-class EncodingTester < Test::Unit::TestCase
- include REXMLTestUtils
- include REXML
+module REXMLTests
+ class EncodingTester < Test::Unit::TestCase
+ include REXMLTestUtils
+ include REXML
- def setup
- @encoded_root = "<a><b>\346</b></a>"
- @encoded = "<?xml version='1.0' encoding='ISO-8859-3'?>"+
- @encoded_root
- @not_encoded = "<a><b>ĉ</b></a>"
- end
+ def setup
+ @encoded_root = "<a><b>\346</b></a>"
+ @encoded = "<?xml version='1.0' encoding='ISO-8859-3'?>"+
+ @encoded_root
+ @not_encoded = "<a><b>ĉ</b></a>"
+ end
- # Given an encoded document, try to write out to that encoding
- def test_encoded_in_encoded_out
- doc = Document.new( @encoded )
- doc.write( out="" )
- out.force_encoding(::Encoding::ASCII_8BIT)
- assert_equal( @encoded, out )
- end
+ # Given an encoded document, try to write out to that encoding
+ def test_encoded_in_encoded_out
+ doc = Document.new( @encoded )
+ doc.write( out="" )
+ out.force_encoding(::Encoding::ASCII_8BIT)
+ assert_equal( @encoded, out )
+ end
- # Given an encoded document, try to change the encoding and write it out
- def test_encoded_in_change_out
- doc = Document.new( @encoded )
- doc.xml_decl.encoding = "UTF-8"
- assert_equal("UTF-8", doc.encoding)
- REXML::Formatters::Default.new.write( doc.root, out="" )
- out.force_encoding(::Encoding::ASCII_8BIT)
- assert_equal( @not_encoded, out )
- char = XPath.first( doc, "/a/b/text()" ).to_s
- char.force_encoding(::Encoding::ASCII_8BIT)
- assert_equal( "ĉ", char )
- end
+ # Given an encoded document, try to change the encoding and write it out
+ def test_encoded_in_change_out
+ doc = Document.new( @encoded )
+ doc.xml_decl.encoding = "UTF-8"
+ assert_equal("UTF-8", doc.encoding)
+ REXML::Formatters::Default.new.write( doc.root, out="" )
+ out.force_encoding(::Encoding::ASCII_8BIT)
+ assert_equal( @not_encoded, out )
+ char = XPath.first( doc, "/a/b/text()" ).to_s
+ char.force_encoding(::Encoding::ASCII_8BIT)
+ assert_equal( "ĉ", char )
+ end
- # * Given an encoded document, try to write it to a different encoding
- def test_encoded_in_different_out
- doc = Document.new( @encoded )
- REXML::Formatters::Default.new.write( doc.root, Output.new( out="", "UTF-8" ) )
- out.force_encoding(::Encoding::ASCII_8BIT)
- assert_equal( @not_encoded, out )
- end
+ # * Given an encoded document, try to write it to a different encoding
+ def test_encoded_in_different_out
+ doc = Document.new( @encoded )
+ REXML::Formatters::Default.new.write( doc.root, Output.new( out="", "UTF-8" ) )
+ out.force_encoding(::Encoding::ASCII_8BIT)
+ assert_equal( @not_encoded, out )
+ end
- # * Given a non-encoded document, change the encoding
- def test_in_change_out
- doc = Document.new( @not_encoded )
- doc.xml_decl.encoding = "ISO-8859-3"
- assert_equal("ISO-8859-3", doc.encoding)
- doc.write( out="" )
- out.force_encoding(::Encoding::ASCII_8BIT)
- assert_equal( @encoded, out )
- end
+ # * Given a non-encoded document, change the encoding
+ def test_in_change_out
+ doc = Document.new( @not_encoded )
+ doc.xml_decl.encoding = "ISO-8859-3"
+ assert_equal("ISO-8859-3", doc.encoding)
+ doc.write( out="" )
+ out.force_encoding(::Encoding::ASCII_8BIT)
+ assert_equal( @encoded, out )
+ end
- # * Given a non-encoded document, write to a different encoding
- def test_in_different_out
- doc = Document.new( @not_encoded )
- doc.write( Output.new( out="", "ISO-8859-3" ) )
- out.force_encoding(::Encoding::ASCII_8BIT)
- assert_equal( "<?xml version='1.0'?>#{@encoded_root}", out )
- end
+ # * Given a non-encoded document, write to a different encoding
+ def test_in_different_out
+ doc = Document.new( @not_encoded )
+ doc.write( Output.new( out="", "ISO-8859-3" ) )
+ out.force_encoding(::Encoding::ASCII_8BIT)
+ assert_equal( "<?xml version='1.0'?>#{@encoded_root}", out )
+ end
- # * Given an encoded document, accessing text and attribute nodes
- # should provide UTF-8 text.
- def test_in_different_access
- doc = Document.new <<-EOL
- <?xml version='1.0' encoding='ISO-8859-1'?>
- <a a="\xFF">\xFF</a>
- EOL
- expect = "\303\277"
- expect.force_encoding(::Encoding::UTF_8)
- assert_equal( expect, doc.elements['a'].attributes['a'] )
- assert_equal( expect, doc.elements['a'].text )
- end
+ # * Given an encoded document, accessing text and attribute nodes
+ # should provide UTF-8 text.
+ def test_in_different_access
+ doc = Document.new <<-EOL
+ <?xml version='1.0' encoding='ISO-8859-1'?>
+ <a a="\xFF">\xFF</a>
+ EOL
+ expect = "\303\277"
+ expect.force_encoding(::Encoding::UTF_8)
+ assert_equal( expect, doc.elements['a'].attributes['a'] )
+ assert_equal( expect, doc.elements['a'].text )
+ end
- def test_ticket_89
- doc = Document.new <<-EOL
- <?xml version="1.0" encoding="CP-1252" ?>
- <xml><foo></foo></xml>
- EOL
+ def test_ticket_89
+ doc = Document.new <<-EOL
+ <?xml version="1.0" encoding="CP-1252" ?>
+ <xml><foo></foo></xml>
+ EOL
- REXML::Document.new doc
- end
+ REXML::Document.new doc
+ end
- def test_ticket_110
- utf16 = REXML::Document.new(File.new(fixture_path("ticket_110_utf16.xml")))
- assert_equal(utf16.encoding, "UTF-16")
- assert( utf16[0].kind_of?(REXML::XMLDecl))
+ def test_ticket_110
+ utf16 = File.open(fixture_path("ticket_110_utf16.xml")) do |f|
+ REXML::Document.new(f)
+ end
+ assert_equal(utf16.encoding, "UTF-16")
+ assert( utf16[0].kind_of?(REXML::XMLDecl))
+ end
end
end
diff --git a/test/rexml/test_encoding_2.rb b/test/rexml/test_encoding_2.rb
deleted file mode 100644
index 6a985f3897..0000000000
--- a/test/rexml/test_encoding_2.rb
+++ /dev/null
@@ -1,59 +0,0 @@
-require "test/unit/testcase"
-
-require "rexml/document"
-require "rexml/parseexception"
-
-=begin
-# THIS DOESN'T WORK
-begin
- require 'iconv'
-
- UnixCharsets = open("| iconv -l") do |f|
- f.readlines[5..-1].collect { |x| x.sub(/\/\/\n/,"").delete(' ') }
- end
-
- DATA = <<END
-<?xml version="1.0" encoding='ENC'?>
-<Ruby xmlns="http://www.ruby-lang.org/ruby/1.8">
-</Ruby>
-END
-
-
- class IConvTester < Test::Unit::TestCase
-
- def test_iconv
- broken_encodings = 0
- UnixCharsets.each do |enc|
- begin
- puts "Testing encoding #{enc}"
- data = DATA.dup
- data[/ENC/] = enc
- REXML::Document.new(data).root
- rescue REXML::ParseException => e
- broken_encodings += 1
- fail "Encoding #{enc} does not work with REXML: #{e.message}"
- rescue Errno::EINVAL => e
- broken_encodings += 1
- fail "Encoding #{enc} does not work with REXML: #{e.message}"
- rescue ArgumentError => e
- broken_encodings += 1
- fail "Encoding #{enc} does not work with REXML: #{e.message}"
- rescue
- broken_encodings += 1
- fail "Encoding #{enc} does not work with REXML: #{$!.message}"
- end
- end
-
- if broken_encodings > 0
- fail "There were #{broken_encodings} encoding failures out of #{UnixCharsets.size} plus some REXML internal encodings"
- else
- fail "There were no encoding failures"
- end
-
- puts "Full list of registered encodings in REXML:"
- puts REXML::Encoding::ENCODING_CLAIMS.values.join(', ')
- end
- end
-rescue LoadError
-end
-=end
diff --git a/test/rexml/test_entity.rb b/test/rexml/test_entity.rb
index 5900fac7a8..820e4f2b85 100644
--- a/test/rexml/test_entity.rb
+++ b/test/rexml/test_entity.rb
@@ -4,164 +4,186 @@ require 'rexml/document'
require 'rexml/entity'
require 'rexml/source'
-class EntityTester < Test::Unit::TestCase
- def test_parse_general_decl
- simple = "<!ENTITY foo 'bar'>"
- simple =~ /#{REXML::Entity::GEDECL}/
- assert $&
- assert_equal simple, $&
-
- REXML::Entity::ENTITYDECL =~ simple
- assert REXML::Entity::matches?(simple)
- match = REXML::Entity::ENTITYDECL.match(simple)
- assert_equal 'foo', match[1]
- assert_equal "'bar'", match[2]
-
- simple = '<!ENTITY Pub-Status
- "This is a pre-release of the specification.">'
- assert REXML::Entity::matches?(simple)
- match = REXML::Entity::ENTITYDECL.match(simple)
- assert_equal 'Pub-Status', match[1]
- assert_equal '"This is a pre-release of the specification."', match[2]
-
- txt = '"This is a
- pre-release of <the> specification."'
- simple = "<!ENTITY Pub-Status
- #{txt}>"
- assert REXML::Entity::matches?(simple)
- match = REXML::Entity::ENTITYDECL.match(simple)
- assert_equal 'Pub-Status', match[1]
- assert_equal txt, match[2]
- end
+module REXMLTests
+ class EntityTester < Test::Unit::TestCase
+ def test_parse_general_decl
+ simple = "<!ENTITY foo 'bar'>"
+ simple =~ /#{REXML::Entity::GEDECL}/
+ assert $&
+ assert_equal simple, $&
+
+ REXML::Entity::ENTITYDECL =~ simple
+ assert REXML::Entity::matches?(simple)
+ match = REXML::Entity::ENTITYDECL.match(simple)
+ assert_equal 'foo', match[1]
+ assert_equal "'bar'", match[2]
+
+ simple = '<!ENTITY Pub-Status
+ "This is a pre-release of the specification.">'
+ assert REXML::Entity::matches?(simple)
+ match = REXML::Entity::ENTITYDECL.match(simple)
+ assert_equal 'Pub-Status', match[1]
+ assert_equal '"This is a pre-release of the specification."', match[2]
+
+ txt = '"This is a
+ pre-release of <the> specification."'
+ simple = "<!ENTITY Pub-Status
+ #{txt}>"
+ assert REXML::Entity::matches?(simple)
+ match = REXML::Entity::ENTITYDECL.match(simple)
+ assert_equal 'Pub-Status', match[1]
+ assert_equal txt, match[2]
+ end
- def test_parse_external_decl
- zero = '<!ENTITY open-hatch SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml" >'
- one = '<!ENTITY open-hatch
- SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml">'
- two = '<!ENTITY open-hatch
- PUBLIC "-//Textuality//TEXT Standard open-hatch boilerplate//EN"
- "http://www.textuality.com/boilerplate/OpenHatch.xml">'
- three = '<!ENTITY hatch-pic
- SYSTEM "../grafix/OpenHatch.gif"
- NDATA gif >'
- assert REXML::Entity::matches?(zero)
- assert REXML::Entity::matches?(one)
- assert REXML::Entity::matches?(two)
- assert REXML::Entity::matches?(three)
- end
+ def test_parse_external_decl
+ zero = '<!ENTITY open-hatch SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml" >'
+ one = '<!ENTITY open-hatch
+ SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml">'
+ two = '<!ENTITY open-hatch
+ PUBLIC "-//Textuality//TEXT Standard open-hatch boilerplate//EN"
+ "http://www.textuality.com/boilerplate/OpenHatch.xml">'
+ three = '<!ENTITY hatch-pic
+ SYSTEM "../grafix/OpenHatch.gif"
+ NDATA gif >'
+ assert REXML::Entity::matches?(zero)
+ assert REXML::Entity::matches?(one)
+ assert REXML::Entity::matches?(two)
+ assert REXML::Entity::matches?(three)
+ end
- def test_parse_entity
- one = %q{<!ENTITY % YN '"Yes"'>}
- two = %q{<!ENTITY WhatHeSaid "He said %YN;">}
- assert REXML::Entity::matches?(one)
- assert REXML::Entity::matches?(two)
- end
+ def test_parse_entity
+ one = %q{<!ENTITY % YN '"Yes"'>}
+ two = %q{<!ENTITY WhatHeSaid "He said %YN;">}
+ assert REXML::Entity::matches?(one)
+ assert REXML::Entity::matches?(two)
+ end
- def test_constructor
- one = [ %q{<!ENTITY % YN '"Yes"'>},
- %q{<!ENTITY % YN2 "Yes">},
- %q{<!ENTITY WhatHeSaid "He said %YN;">},
- '<!ENTITY open-hatch
- SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml">',
- '<!ENTITY open-hatch2
- PUBLIC "-//Textuality//TEXT Standard open-hatch boilerplate//EN"
- "http://www.textuality.com/boilerplate/OpenHatch.xml">',
- '<!ENTITY hatch-pic
- SYSTEM "../grafix/OpenHatch.gif"
- NDATA gif>' ]
- source = %q{<!DOCTYPE foo [
- <!ENTITY % YN '"Yes"'>
- <!ENTITY % YN2 "Yes">
- <!ENTITY WhatHeSaid "He said %YN;">
- <!ENTITY open-hatch
- SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml">
- <!ENTITY open-hatch2
- PUBLIC "-//Textuality//TEXT Standard open-hatch boilerplate//EN"
- "http://www.textuality.com/boilerplate/OpenHatch.xml">
- <!ENTITY hatch-pic
- SYSTEM "../grafix/OpenHatch.gif"
- NDATA gif>
- ]>}
-
- d = REXML::Document.new( source )
- dt = d.doctype
- c = 0
- dt.each do |child|
- if child.kind_of? REXML::Entity
- str = one[c].tr("\r\n\t", ' ').squeeze(" ")
- assert_equal str, child.to_s
- c+=1
+ def test_constructor
+ one = [ %q{<!ENTITY % YN '"Yes"'>},
+ %q{<!ENTITY % YN2 "Yes">},
+ %q{<!ENTITY WhatHeSaid "He said %YN;">},
+ '<!ENTITY open-hatch
+ SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml">',
+ '<!ENTITY open-hatch2
+ PUBLIC "-//Textuality//TEXT Standard open-hatch boilerplate//EN"
+ "http://www.textuality.com/boilerplate/OpenHatch.xml">',
+ '<!ENTITY hatch-pic
+ SYSTEM "../grafix/OpenHatch.gif"
+ NDATA gif>' ]
+ source = %q{<!DOCTYPE foo [
+ <!ENTITY % YN '"Yes"'>
+ <!ENTITY % YN2 "Yes">
+ <!ENTITY WhatHeSaid "He said %YN;">
+ <!ENTITY open-hatch
+ SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml">
+ <!ENTITY open-hatch2
+ PUBLIC "-//Textuality//TEXT Standard open-hatch boilerplate//EN"
+ "http://www.textuality.com/boilerplate/OpenHatch.xml">
+ <!ENTITY hatch-pic
+ SYSTEM "../grafix/OpenHatch.gif"
+ NDATA gif>
+ ]>}
+
+ d = REXML::Document.new( source )
+ dt = d.doctype
+ c = 0
+ dt.each do |child|
+ if child.kind_of? REXML::Entity
+ str = one[c].tr("\r\n\t", ' ').squeeze(" ")
+ assert_equal str, child.to_s
+ c+=1
+ end
end
end
- end
- def test_replace_entities
- source = "<!DOCTYPE blah [\n<!ENTITY foo \"bar\">\n]><a>&foo;</a>"
- doc = REXML::Document.new(source)
- assert_equal 'bar', doc.root.text
- out = ''
- doc.write out
- assert_equal source, out
- end
+ def test_replace_entities
+ source = "<!DOCTYPE blah [\n<!ENTITY foo \"bar\">\n]><a>&foo;</a>"
+ doc = REXML::Document.new(source)
+ assert_equal 'bar', doc.root.text
+ out = ''
+ doc.write out
+ assert_equal source, out
+ end
- def test_entity_string_limit
- template = '<!DOCTYPE bomb [ <!ENTITY a "^" > ]> <bomb>$</bomb>'
- len = 5120 # 5k per entity
- template.sub!(/\^/, "B" * len)
-
- # 10k is OK
- entities = '&a;' * 2 # 5k entity * 2 = 10k
- xmldoc = REXML::Document.new(template.sub(/\$/, entities))
- assert_equal(len * 2, xmldoc.root.text.bytesize)
-
- # above 10k explodes
- entities = '&a;' * 3 # 5k entity * 2 = 15k
- xmldoc = REXML::Document.new(template.sub(/\$/, entities))
- assert_raises(RuntimeError) do
- xmldoc.root.text
+ def test_entity_string_limit
+ template = '<!DOCTYPE bomb [ <!ENTITY a "^" > ]> <bomb>$</bomb>'
+ len = 5120 # 5k per entity
+ template.sub!(/\^/, "B" * len)
+
+ # 10k is OK
+ entities = '&a;' * 2 # 5k entity * 2 = 10k
+ xmldoc = REXML::Document.new(template.sub(/\$/, entities))
+ assert_equal(len * 2, xmldoc.root.text.bytesize)
+
+ # above 10k explodes
+ entities = '&a;' * 3 # 5k entity * 2 = 15k
+ xmldoc = REXML::Document.new(template.sub(/\$/, entities))
+ assert_raises(RuntimeError) do
+ xmldoc.root.text
+ end
end
- end
- def test_raw
- source = '<!DOCTYPE foo [
+ def test_raw
+ source = '<!DOCTYPE foo [
<!ENTITY ent "replace">
]><a>replace &ent;</a>'
- doc = REXML::Document.new( source, {:raw=>:all})
- assert_equal('replace &ent;', doc.root.get_text.to_s)
- assert_equal(source, doc.to_s)
- end
+ doc = REXML::Document.new( source, {:raw=>:all})
+ assert_equal('replace &ent;', doc.root.get_text.to_s)
+ assert_equal(source, doc.to_s)
+ end
- def test_lazy_evaluation
- source = '<!DOCTYPE foo [
+ def test_lazy_evaluation
+ source = '<!DOCTYPE foo [
<!ENTITY ent "replace">
]><a>replace &ent;</a>'
- doc = REXML::Document.new( source )
- assert_equal(source, doc.to_s)
- assert_equal("replace replace", doc.root.text)
- assert_equal(source, doc.to_s)
- end
+ doc = REXML::Document.new( source )
+ assert_equal(source, doc.to_s)
+ assert_equal("replace replace", doc.root.text)
+ assert_equal(source, doc.to_s)
+ end
- # Contributed (not only test, but bug fix!!) by Kouhei Sutou
- def test_entity_replacement
- source = %q{<!DOCTYPE foo [
- <!ENTITY % YN '"Yes"'>
- <!ENTITY WhatHeSaid "He said %YN;">]>
- <a>&WhatHeSaid;</a>}
-
- d = REXML::Document.new( source )
- dt = d.doctype
- assert_equal( '"Yes"', dt.entities[ "YN" ].value )
- assert_equal( 'He said "Yes"', dt.entities[ "WhatHeSaid" ].value )
- assert_equal( 'He said "Yes"', d.elements[1].text )
- end
+ # Contributed (not only test, but bug fix!!) by Kouhei Sutou
+ def test_entity_replacement
+ source = %q{<!DOCTYPE foo [
+ <!ENTITY % YN '"Yes"'>
+ <!ENTITY WhatHeSaid "He said %YN;">]>
+ <a>&WhatHeSaid;</a>}
+
+ d = REXML::Document.new( source )
+ dt = d.doctype
+ assert_equal( '"Yes"', dt.entities[ "YN" ].value )
+ assert_equal( 'He said "Yes"', dt.entities[ "WhatHeSaid" ].value )
+ assert_equal( 'He said "Yes"', d.elements[1].text )
+ end
- # More unit tests from Kouhei. I looove users who give me unit tests.
- def test_entity_insertions
- assert_equal("&amp;", REXML::Text.new("&amp;", false, nil, true).to_s)
- #assert_equal("&", REXML::Text.new("&amp;", false, false).to_s)
- end
+ # More unit tests from Kouhei. I looove users who give me unit tests.
+ def test_entity_insertions
+ assert_equal("&amp;", REXML::Text.new("&amp;", false, nil, true).to_s)
+ #assert_equal("&", REXML::Text.new("&amp;", false, false).to_s)
+ end
- def test_single_pass_unnormalization # ticket 123
- assert_equal '&amp;&', REXML::Text::unnormalize('&#38;amp;&amp;')
+ def test_single_pass_unnormalization # ticket 123
+ assert_equal '&amp;&', REXML::Text::unnormalize('&#38;amp;&amp;')
+ end
+
+ def test_entity_filter
+ document = REXML::Document.new(<<-XML)
+<!DOCTYPE root [
+<!ENTITY copy "(c)">
+<!ENTITY release-year "2013">
+]>
+<root/>
+XML
+ respect_whitespace = false
+ parent = document.root
+ raw = false
+ entity_filter = ["copy"]
+ assert_equal("(c) &release-year;",
+ REXML::Text.new("(c) 2013",
+ respect_whitespace,
+ parent,
+ raw,
+ entity_filter).to_s)
+ end
end
end
diff --git a/test/rexml/test_functions.rb b/test/rexml/test_functions.rb
index 082d772e23..bf501ff0c2 100644
--- a/test/rexml/test_functions.rb
+++ b/test/rexml/test_functions.rb
@@ -2,222 +2,223 @@ require "test/unit/testcase"
require "rexml/document"
-class FunctionsTester < Test::Unit::TestCase
- include REXML
- def test_functions
- # trivial text() test
- # confuse-a-function
- source = "<a>more <b id='1'/><b id='2'>dumb</b><b id='3'/><c/> text</a>"
- doc = Document.new source
- res = ""
- XPath::each(doc.root, "text()") {|val| res << val.to_s}
- assert_equal "more text", res
-
- res = XPath::first(doc.root, "b[last()]")
- assert_equal '3', res.attributes['id']
- res = XPath::first(doc.root, "b[position()=2]")
- assert_equal '2', res.attributes['id']
- res = XPath::first(doc.root, "*[name()='c']")
- assert_equal "c", res.name
- end
+module REXMLTests
+ class FunctionsTester < Test::Unit::TestCase
+ include REXML
+ def test_functions
+ # trivial text() test
+ # confuse-a-function
+ source = "<a>more <b id='1'/><b id='2'>dumb</b><b id='3'/><c/> text</a>"
+ doc = Document.new source
+ res = ""
+ XPath::each(doc.root, "text()") {|val| res << val.to_s}
+ assert_equal "more text", res
+
+ res = XPath::first(doc.root, "b[last()]")
+ assert_equal '3', res.attributes['id']
+ res = XPath::first(doc.root, "b[position()=2]")
+ assert_equal '2', res.attributes['id']
+ res = XPath::first(doc.root, "*[name()='c']")
+ assert_equal "c", res.name
+ end
- # Contributed by Mike Stok
- def test_starts_with
- source = <<-EOF
- <foo>
- <a href="mailto:a@b.c">a@b.c</a>
- <a href="http://www.foo.com">http://www.foo.com</a>
- </foo>
- EOF
- doc = Document.new source
- mailtos = doc.elements.to_a("//a[starts-with(@href, 'mailto:')]")
- assert_equal 1, mailtos.size
- assert_equal "mailto:a@b.c", mailtos[0].attributes['href']
-
- ailtos = doc.elements.to_a("//a[starts-with(@href, 'ailto:')]")
- assert_equal 0, ailtos.size
- end
+ # Contributed by Mike Stok
+ def test_starts_with
+ source = <<-EOF
+ <foo>
+ <a href="mailto:a@b.c">a@b.c</a>
+ <a href="http://www.foo.com">http://www.foo.com</a>
+ </foo>
+ EOF
+ doc = Document.new source
+ mailtos = doc.elements.to_a("//a[starts-with(@href, 'mailto:')]")
+ assert_equal 1, mailtos.size
+ assert_equal "mailto:a@b.c", mailtos[0].attributes['href']
+
+ ailtos = doc.elements.to_a("//a[starts-with(@href, 'ailto:')]")
+ assert_equal 0, ailtos.size
+ end
- def test_string_length
- doc = Document.new <<-EOF
- <AAA>
- <Q/>
- <SSSS/>
- <BB/>
- <CCC/>
- <DDDDDDDD/>
- <EEEE/>
- </AAA>
- EOF
- assert doc, "create doc"
-
- set = doc.elements.to_a("//*[string-length(name()) = 3]")
- assert_equal 2, set.size, "nodes with names length = 3"
-
- set = doc.elements.to_a("//*[string-length(name()) < 3]")
- assert_equal 2, set.size, "nodes with names length < 3"
-
- set = doc.elements.to_a("//*[string-length(name()) > 3]")
- assert_equal 3, set.size, "nodes with names length > 3"
- end
+ def test_string_length
+ doc = Document.new <<-EOF
+ <AAA>
+ <Q/>
+ <SSSS/>
+ <BB/>
+ <CCC/>
+ <DDDDDDDD/>
+ <EEEE/>
+ </AAA>
+ EOF
+ assert doc, "create doc"
+
+ set = doc.elements.to_a("//*[string-length(name()) = 3]")
+ assert_equal 2, set.size, "nodes with names length = 3"
+
+ set = doc.elements.to_a("//*[string-length(name()) < 3]")
+ assert_equal 2, set.size, "nodes with names length < 3"
+
+ set = doc.elements.to_a("//*[string-length(name()) > 3]")
+ assert_equal 3, set.size, "nodes with names length > 3"
+ end
- # Test provided by Mike Stok
- def test_contains
- source = <<-EOF
- <foo>
- <a href="mailto:a@b.c">a@b.c</a>
- <a href="http://www.foo.com">http://www.foo.com</a>
- </foo>
- EOF
- doc = Document.new source
-
- [['o', 2], ['foo', 1], ['bar', 0]].each { |test|
- search, expected = test
- set = doc.elements.to_a("//a[contains(@href, '#{search}')]")
- assert_equal expected, set.size
- }
- end
+ # Test provided by Mike Stok
+ def test_contains
+ source = <<-EOF
+ <foo>
+ <a href="mailto:a@b.c">a@b.c</a>
+ <a href="http://www.foo.com">http://www.foo.com</a>
+ </foo>
+ EOF
+ doc = Document.new source
+
+ [['o', 2], ['foo', 1], ['bar', 0]].each { |test|
+ search, expected = test
+ set = doc.elements.to_a("//a[contains(@href, '#{search}')]")
+ assert_equal expected, set.size
+ }
+ end
- # Mike Stok and Sean Russell
- def test_substring
- # examples from http://www.w3.org/TR/xpath#function-substring
- doc = Document.new('<test string="12345" />')
-
- d = Document.new("<a b='1'/>")
- #puts XPath.first(d, 'node()[0 + 1]')
- #d = Document.new("<a b='1'/>")
- #puts XPath.first(d, 'a[0 mod 0]')
- [ [1.5, 2.6, '234'],
- [0, 3, '12'],
- [0, '0 div 0', ''],
- [1, '0 div 0', ''],
- ['-42', '1 div 0', '12345'],
- ['-1 div 0', '1 div 0', '']
- ].each { |start, length, expected|
- set = doc.elements.to_a("//test[substring(@string, #{start}, #{length}) = '#{expected}']")
- assert_equal 1, set.size, "#{start}, #{length}, '#{expected}'"
- }
- end
+ # Mike Stok and Sean Russell
+ def test_substring
+ # examples from http://www.w3.org/TR/xpath#function-substring
+ doc = Document.new('<test string="12345" />')
+
+ #puts XPath.first(d, 'node()[0 + 1]')
+ #d = Document.new("<a b='1'/>")
+ #puts XPath.first(d, 'a[0 mod 0]')
+ [ [1.5, 2.6, '234'],
+ [0, 3, '12'],
+ [0, '0 div 0', ''],
+ [1, '0 div 0', ''],
+ ['-42', '1 div 0', '12345'],
+ ['-1 div 0', '1 div 0', '']
+ ].each { |start, length, expected|
+ set = doc.elements.to_a("//test[substring(@string, #{start}, #{length}) = '#{expected}']")
+ assert_equal 1, set.size, "#{start}, #{length}, '#{expected}'"
+ }
+ end
- def test_substring_angrez
- testString = REXML::Functions::substring_after("helloworld","hello")
- assert_equal( 'world', testString )
- end
+ def test_substring_angrez
+ testString = REXML::Functions::substring_after("helloworld","hello")
+ assert_equal( 'world', testString )
+ end
- def test_translate
- source = <<-EOF
- <doc>
- <case name='w3c one' result='BAr' /> <!-- w3c -->
- <case name='w3c two' result='AAA' /> <!-- w3c -->
- <case name='alchemy' result="gold" /> <!-- mike -->
- <case name='vbxml one' result='A Space Odyssey' />
- <case name='vbxml two' result='AbCdEf' />
- </doc>
- EOF
-
- doc = Document.new(source)
-
- [ ['bar', 'abc', 'ABC', 'w3c one'],
- ['--aaa--','abc-','ABC', 'w3c two'],
- ['lead', 'dear language', 'doll groover', 'alchemy'],
- ['A Space Odissei', 'i', 'y', 'vbxml one'],
- ['abcdefg', 'aceg', 'ACE', 'vbxml two'],
- ].each { |arg1, arg2, arg3, name|
- translate = "translate('#{arg1}', '#{arg2}', '#{arg3}')"
- set = doc.elements.to_a("//case[@result = #{translate}]")
- assert_equal 1, set.size, translate
- assert_equal name, set[0].attributes['name']
- }
- end
+ def test_translate
+ source = <<-EOF
+ <doc>
+ <case name='w3c one' result='BAr' /> <!-- w3c -->
+ <case name='w3c two' result='AAA' /> <!-- w3c -->
+ <case name='alchemy' result="gold" /> <!-- mike -->
+ <case name='vbxml one' result='A Space Odyssey' />
+ <case name='vbxml two' result='AbCdEf' />
+ </doc>
+ EOF
+
+ doc = Document.new(source)
+
+ [ ['bar', 'abc', 'ABC', 'w3c one'],
+ ['--aaa--','abc-','ABC', 'w3c two'],
+ ['lead', 'dear language', 'doll groover', 'alchemy'],
+ ['A Space Odissei', 'i', 'y', 'vbxml one'],
+ ['abcdefg', 'aceg', 'ACE', 'vbxml two'],
+ ].each { |arg1, arg2, arg3, name|
+ translate = "translate('#{arg1}', '#{arg2}', '#{arg3}')"
+ set = doc.elements.to_a("//case[@result = #{translate}]")
+ assert_equal 1, set.size, translate
+ assert_equal name, set[0].attributes['name']
+ }
+ end
- def test_name
- d = REXML::Document.new("<a xmlns:x='foo'><b/><x:b/></a>")
- assert_equal 1, d.root.elements.to_a('*[name() = "b"]').size
- assert_equal 1, d.elements.to_a('//*[name() = "x:b"]').size
- end
+ def test_name
+ d = REXML::Document.new("<a xmlns:x='foo'><b/><x:b/></a>")
+ assert_equal 1, d.root.elements.to_a('*[name() = "b"]').size
+ assert_equal 1, d.elements.to_a('//*[name() = "x:b"]').size
+ end
- def test_local_name
- d = REXML::Document.new("<a xmlns:x='foo'><b/><x:b/></a>")
- assert_equal 2, d.root.elements.to_a('*[local_name() = "b"]').size
- assert_equal 2, d.elements.to_a('//*[local_name() = "b"]').size
- end
+ def test_local_name
+ d = REXML::Document.new("<a xmlns:x='foo'><b/><x:b/></a>")
+ assert_equal 2, d.root.elements.to_a('*[local_name() = "b"]').size
+ assert_equal 2, d.elements.to_a('//*[local_name() = "b"]').size
+ end
- def test_substring2
- doc = Document.new('<test string="12345" />')
- assert_equal(1,doc.elements.to_a("//test[substring(@string,2)='2345']").size)
- end
+ def test_substring2
+ doc = Document.new('<test string="12345" />')
+ assert_equal(1,doc.elements.to_a("//test[substring(@string,2)='2345']").size)
+ end
- # Submitted by Kouhei
- def test_floor_ceiling_round
- source = "<a><b id='1'/><b id='2'/><b id='3'/></a>"
- doc = REXML::Document.new(source)
-
- id_1 = doc.elements["/a/b[@id='1']"]
- id_2 = doc.elements["/a/b[@id='2']"]
- id_3 = doc.elements["/a/b[@id='3']"]
-
- good = {
- "floor" => [[], [id_1], [id_2], [id_3]],
- "ceiling" => [[id_1], [id_2], [id_3], []],
- "round" => [[id_1], [id_2], [id_3], []]
- }
- good.each do |key, value|
- (0..3).each do |i|
- xpath = "//b[number(@id) = #{key}(#{i+0.5})]"
- assert_equal(value[i], REXML::XPath.match(doc, xpath))
+ # Submitted by Kouhei
+ def test_floor_ceiling_round
+ source = "<a><b id='1'/><b id='2'/><b id='3'/></a>"
+ doc = REXML::Document.new(source)
+
+ id_1 = doc.elements["/a/b[@id='1']"]
+ id_2 = doc.elements["/a/b[@id='2']"]
+ id_3 = doc.elements["/a/b[@id='3']"]
+
+ good = {
+ "floor" => [[], [id_1], [id_2], [id_3]],
+ "ceiling" => [[id_1], [id_2], [id_3], []],
+ "round" => [[id_1], [id_2], [id_3], []]
+ }
+ good.each do |key, value|
+ (0..3).each do |i|
+ xpath = "//b[number(@id) = #{key}(#{i+0.5})]"
+ assert_equal(value[i], REXML::XPath.match(doc, xpath))
+ end
end
- end
- good["round"] = [[], [id_1], [id_2], [id_3]]
- good.each do |key, value|
- (0..3).each do |i|
- xpath = "//b[number(@id) = #{key}(#{i+0.4})]"
- assert_equal(value[i], REXML::XPath.match(doc, xpath))
+ good["round"] = [[], [id_1], [id_2], [id_3]]
+ good.each do |key, value|
+ (0..3).each do |i|
+ xpath = "//b[number(@id) = #{key}(#{i+0.4})]"
+ assert_equal(value[i], REXML::XPath.match(doc, xpath))
+ end
end
end
- end
- # Submitted by Kou
- def test_lang
- d = Document.new(<<-XML)
- <a xml:lang="en">
- <b xml:lang="ja">
- <c xml:lang="fr"/>
- <d/>
- <e xml:lang="ja-JP"/>
- <f xml:lang="en-US"/>
- </b>
- </a>
- XML
-
- assert_equal(1, d.elements.to_a("//*[lang('fr')]").size)
- assert_equal(3, d.elements.to_a("//*[lang('ja')]").size)
- assert_equal(2, d.elements.to_a("//*[lang('en')]").size)
- assert_equal(1, d.elements.to_a("//*[lang('en-us')]").size)
-
- d = Document.new(<<-XML)
- <root>
- <para xml:lang="en"/>
- <div xml:lang="en"><para/></div>
- <para xml:lang="EN"/>
- <para xml:lang="en-us"/>
- </root>
- XML
-
- assert_equal(5, d.elements.to_a("//*[lang('en')]").size)
- end
+ # Submitted by Kou
+ def test_lang
+ d = Document.new(<<-XML)
+ <a xml:lang="en">
+ <b xml:lang="ja">
+ <c xml:lang="fr"/>
+ <d/>
+ <e xml:lang="ja-JP"/>
+ <f xml:lang="en-US"/>
+ </b>
+ </a>
+ XML
+
+ assert_equal(1, d.elements.to_a("//*[lang('fr')]").size)
+ assert_equal(3, d.elements.to_a("//*[lang('ja')]").size)
+ assert_equal(2, d.elements.to_a("//*[lang('en')]").size)
+ assert_equal(1, d.elements.to_a("//*[lang('en-us')]").size)
+
+ d = Document.new(<<-XML)
+ <root>
+ <para xml:lang="en"/>
+ <div xml:lang="en"><para/></div>
+ <para xml:lang="EN"/>
+ <para xml:lang="en-us"/>
+ </root>
+ XML
+
+ assert_equal(5, d.elements.to_a("//*[lang('en')]").size)
+ end
- def test_ticket_60
- document = REXML::Document.new("<a><b>A</b><b>1</b></a>")
- assert_equal( "A", REXML::XPath.first(document, '//b[.="A"]').text )
- assert_equal( "1", REXML::XPath.first(document, '//b[.="1"]').text )
- end
+ def test_ticket_60
+ document = REXML::Document.new("<a><b>A</b><b>1</b></a>")
+ assert_equal( "A", REXML::XPath.first(document, '//b[.="A"]').text )
+ assert_equal( "1", REXML::XPath.first(document, '//b[.="1"]').text )
+ end
- def test_normalize_space
- source = "<a><!--COMMENT A--><b><!-- COMMENT A --></b></a>"
- doc = REXML::Document.new(source)
- predicate = "string(.)=normalize_space('\nCOMMENT \n A \n\n ')"
- m = REXML::XPath.match(doc, "//comment()[#{predicate}]")
- assert_equal( [REXML::Comment.new("COMMENT A")], m )
+ def test_normalize_space
+ source = "<a><!--COMMENT A--><b><!-- COMMENT A --></b></a>"
+ doc = REXML::Document.new(source)
+ predicate = "string(.)=normalize_space('\nCOMMENT \n A \n\n ')"
+ m = REXML::XPath.match(doc, "//comment()[#{predicate}]")
+ assert_equal( [REXML::Comment.new("COMMENT A")], m )
+ end
end
end
diff --git a/test/rexml/test_functions_number.rb b/test/rexml/test_functions_number.rb
index 3048c8dd00..0b5ec92f6c 100644
--- a/test/rexml/test_functions_number.rb
+++ b/test/rexml/test_functions_number.rb
@@ -2,31 +2,33 @@ require 'rexml/document'
require 'test/unit'
require 'rexml/functions'
-class TC_Rexml_Functions_Number < Test::Unit::TestCase
+module REXMLTests
+ class TC_Rexml_Functions_Number < Test::Unit::TestCase
- def test_functions_number_int
- telem = REXML::Element.new("elem")
- telem.text="9"
- assert_equal(9, REXML::Functions::number(telem))
+ def test_functions_number_int
+ telem = REXML::Element.new("elem")
+ telem.text="9"
+ assert_equal(9, REXML::Functions::number(telem))
+ end
+ def test_functions_number_float
+ telem = REXML::Element.new("elem")
+ telem.text="10.4"
+ assert_equal(10.4, REXML::Functions::number(telem))
+ end
+ def test_functions_number_negative_int
+ telem = REXML::Element.new("elem")
+ telem.text="-9"
+ assert_equal(-9, REXML::Functions::number(telem))
+ end
+ def test_functions_number_negative_float
+ telem = REXML::Element.new("elem")
+ telem.text="-9.13"
+ assert_equal(-9.13, REXML::Functions::number(telem))
+ end
+ #def test_functions_number_scientific_notation
+ # telem = REXML::Element.new("elem")
+ # telem.text="9.13E12"
+ # assert_equal(9.13E12, REXML::Functions::number(telem))
+ #end
end
- def test_functions_number_float
- telem = REXML::Element.new("elem")
- telem.text="10.4"
- assert_equal(10.4, REXML::Functions::number(telem))
- end
- def test_functions_number_negative_int
- telem = REXML::Element.new("elem")
- telem.text="-9"
- assert_equal(-9, REXML::Functions::number(telem))
- end
- def test_functions_number_negative_float
- telem = REXML::Element.new("elem")
- telem.text="-9.13"
- assert_equal(-9.13, REXML::Functions::number(telem))
- end
- #def test_functions_number_scientific_notation
- # telem = REXML::Element.new("elem")
- # telem.text="9.13E12"
- # assert_equal(9.13E12, REXML::Functions::number(telem))
- #end
end
diff --git a/test/rexml/test_jaxen.rb b/test/rexml/test_jaxen.rb
index 222cf79c60..1eec73f3e0 100644
--- a/test/rexml/test_jaxen.rb
+++ b/test/rexml/test_jaxen.rb
@@ -1,4 +1,4 @@
-require 'rexml_test_utils'
+require_relative 'rexml_test_utils'
require "rexml/document"
require "rexml/xpath"
@@ -6,121 +6,124 @@ require "rexml/xpath"
# Harness to test REXML's capabilities against the test suite from Jaxen
# ryan.a.cox@gmail.com
-class JaxenTester < Test::Unit::TestCase
- include REXMLTestUtils
- include REXML
+module REXMLTests
+ class JaxenTester < Test::Unit::TestCase
+ include REXMLTestUtils
+ include REXML
- def test_axis ; test("axis") ; end
- def test_basic ; test("basic") ; end
- def test_basicupdate ; test("basicupdate") ; end
- def test_contents ; test("contents") ; end
- def test_defaultNamespace ; test("defaultNamespace") ; end
- def test_fibo ; test("fibo") ; end
- def test_id ; test("id") ; end
- def test_jaxen24 ; test("jaxen24") ; end
- def test_lang ; test("lang") ; end
- def test_message ; test("message") ; end
- def test_moreover ; test("moreover") ; end
- def test_much_ado ; test("much_ado") ; end
- def test_namespaces ; test("namespaces") ; end
- def test_nitf ; test("nitf") ; end
- def test_numbers ; test("numbers") ; end
- def test_pi ; test("pi") ; end
- def test_pi2 ; test("pi2") ; end
- def test_simple ; test("simple") ; end
- def test_testNamespaces ; test("testNamespaces") ; end
- def test_text ; test("text") ; end
- def test_underscore ; test("underscore") ; end
- def test_web ; test("web") ; end
- def test_web2 ; test("web2") ; end
+ def test_axis ; test("axis") ; end
+ def test_basic ; test("basic") ; end
+ def test_basicupdate ; test("basicupdate") ; end
+ def test_contents ; test("contents") ; end
+ def test_defaultNamespace ; test("defaultNamespace") ; end
+ def test_fibo ; test("fibo") ; end
+ def test_id ; test("id") ; end
+ def test_jaxen24 ; test("jaxen24") ; end
+ def test_lang ; test("lang") ; end
+ def test_message ; test("message") ; end
+ def test_moreover ; test("moreover") ; end
+ def test_much_ado ; test("much_ado") ; end
+ def test_namespaces ; test("namespaces") ; end
+ def test_nitf ; test("nitf") ; end
+ def test_numbers ; test("numbers") ; end
+ def test_pi ; test("pi") ; end
+ def test_pi2 ; test("pi2") ; end
+ def test_simple ; test("simple") ; end
+ def test_testNamespaces ; test("testNamespaces") ; end
+ def test_text ; test("text") ; end
+ def test_underscore ; test("underscore") ; end
+ def test_web ; test("web") ; end
+ def test_web2 ; test("web2") ; end
- private
- def test( fname )
-# Dir.entries( xml_dir ).each { |fname|
-# if fname =~ /\.xml$/
- file = File.new(fixture_path(fname+".xml"))
- doc = Document.new( file )
- XPath.each( doc, "/tests/document" ) {|e| handleDocument(e)}
-# end
-# }
- end
+ private
+ def test( fname )
+# Dir.entries( xml_dir ).each { |fname|
+# if fname =~ /\.xml$/
+ doc = File.open(fixture_path(fname+".xml")) do |file|
+ Document.new(file)
+ end
+ XPath.each( doc, "/tests/document" ) {|e| handleDocument(e)}
+# end
+# }
+ end
- # processes a tests/document/context node
- def handleContext( testDoc, ctxElement)
- testCtx = XPath.match( testDoc, ctxElement.attributes["select"] )[0]
- namespaces = {}
- if testCtx.class == Element
- testCtx.prefixes.each { |pre| handleNamespace( testCtx, pre, namespaces ) }
+ # processes a tests/document/context node
+ def handleContext( testDoc, ctxElement)
+ testCtx = XPath.match( testDoc, ctxElement.attributes["select"] )[0]
+ namespaces = {}
+ if testCtx.class == Element
+ testCtx.prefixes.each { |pre| handleNamespace( testCtx, pre, namespaces ) }
+ end
+ variables = {}
+ XPath.each( ctxElement, "@*[namespace-uri() = 'http://jaxen.org/test-harness/var']") { |attrib| handleVariable(testCtx, variables, attrib) }
+ XPath.each( ctxElement, "valueOf") { |e| handleValueOf(testCtx, variables, namespaces, e) }
+ XPath.each( ctxElement, "test[not(@exception) or (@exception != 'true') ]") { |e| handleNominalTest(testCtx,variables, namespaces, e) }
+ XPath.each( ctxElement, "test[@exception = 'true']") { |e| handleExceptionalTest(testCtx,variables, namespaces, e) }
end
- variables = {}
- XPath.each( ctxElement, "@*[namespace-uri() = 'http://jaxen.org/test-harness/var']") { |attrib| handleVariable(testCtx, variables, attrib) }
- XPath.each( ctxElement, "valueOf") { |e| handleValueOf(testCtx, variables, namespaces, e) }
- XPath.each( ctxElement, "test[not(@exception) or (@exception != 'true') ]") { |e| handleNominalTest(testCtx,variables, namespaces, e) }
- XPath.each( ctxElement, "test[@exception = 'true']") { |e| handleExceptionalTest(testCtx,variables, namespaces, e) }
- end
- # processes a tests/document/context/valueOf or tests/document/context/test/valueOf node
- def handleValueOf(ctx,variables, namespaces, valueOfElement)
- expected = valueOfElement.text
- got = XPath.match( ctx, valueOfElement.attributes["select"], namespaces, variables )[0]
- assert_true( (got.nil? && expected.nil?) || !got.nil? )
- case got.class
- when Element
- assert_equal( got.class, Element )
- when Attribute, Text, Comment, TrueClass, FalseClass
- assert_equal( expected, got.to_s )
- when Instruction
- assert_equal( expected, got.content )
- when Fixnum
- assert_equal( exected.to_f, got )
- when String
- # normalize values for comparison
- got = "" if got == nil or got == ""
- expected = "" if expected == nil or expected == ""
- assert_equal( expected, got )
- else
- assert_fail( "Wassup?" )
+ # processes a tests/document/context/valueOf or tests/document/context/test/valueOf node
+ def handleValueOf(ctx,variables, namespaces, valueOfElement)
+ expected = valueOfElement.text
+ got = XPath.match( ctx, valueOfElement.attributes["select"], namespaces, variables )[0]
+ assert_true( (got.nil? && expected.nil?) || !got.nil? )
+ case got.class
+ when Element
+ assert_equal( got.class, Element )
+ when Attribute, Text, Comment, TrueClass, FalseClass
+ assert_equal( expected, got.to_s )
+ when Instruction
+ assert_equal( expected, got.content )
+ when Fixnum
+ assert_equal( exected.to_f, got )
+ when String
+ # normalize values for comparison
+ got = "" if got == nil or got == ""
+ expected = "" if expected == nil or expected == ""
+ assert_equal( expected, got )
+ else
+ assert_fail( "Wassup?" )
+ end
end
- end
- # processes a tests/document/context/test node ( where @exception is false or doesn't exist )
- def handleNominalTest(ctx, variables, namespaces, testElement)
- expected = testElement.attributes["count"]
- got = XPath.match( ctx, testElement.attributes["select"], namespaces, variables )
- # might be a test with no count attribute, but nested valueOf elements
- assert( expected == got.size.to_s ) if !expected.nil?
+ # processes a tests/document/context/test node ( where @exception is false or doesn't exist )
+ def handleNominalTest(ctx, variables, namespaces, testElement)
+ expected = testElement.attributes["count"]
+ got = XPath.match( ctx, testElement.attributes["select"], namespaces, variables )
+ # might be a test with no count attribute, but nested valueOf elements
+ assert( expected == got.size.to_s ) if !expected.nil?
- XPath.each( testElement, "valueOf") { |e|
- handleValueOf(got, variables, namespaces, e)
- }
- end
+ XPath.each( testElement, "valueOf") { |e|
+ handleValueOf(got, variables, namespaces, e)
+ }
+ end
- # processes a tests/document/context/test node ( where @exception is true )
- def handleExceptionalTest(ctx, variables, namespaces, testElement)
- assert_raise( Exception ) {
- XPath.match( ctx, testElement.attributes["select"], namespaces, variables )
- }
- end
+ # processes a tests/document/context/test node ( where @exception is true )
+ def handleExceptionalTest(ctx, variables, namespaces, testElement)
+ assert_raise( Exception ) {
+ XPath.match( ctx, testElement.attributes["select"], namespaces, variables )
+ }
+ end
- # processes a tests/document node
- def handleDocument(docElement)
- puts "- Processing document: #{docElement.attributes['url']}"
- testFile = File.new( docElement.attributes["url"] )
- testDoc = Document.new testFile
- XPath.each( docElement, "context") { |e| handleContext(testDoc, e) }
- end
+ # processes a tests/document node
+ def handleDocument(docElement)
+ puts "- Processing document: #{docElement.attributes['url']}"
+ testFile = File.new( docElement.attributes["url"] )
+ testDoc = Document.new testFile
+ XPath.each( docElement, "context") { |e| handleContext(testDoc, e) }
+ end
- # processes a variable definition in a namespace like <test var:foo="bar">
- def handleVariable( ctx, variables, attrib )
- puts "--- Found attribute: #{attrib.name}"
- variables[attrib.name] = attrib.value
- end
+ # processes a variable definition in a namespace like <test var:foo="bar">
+ def handleVariable( ctx, variables, attrib )
+ puts "--- Found attribute: #{attrib.name}"
+ variables[attrib.name] = attrib.value
+ end
- # processes a namespace definition like <test xmlns:foo="fiz:bang:bam">
- def handleNamespace( ctx, prefix, namespaces )
- puts "--- Found namespace: #{prefix}"
- namespaces[prefix] = ctx.namespaces[prefix]
- end
+ # processes a namespace definition like <test xmlns:foo="fiz:bang:bam">
+ def handleNamespace( ctx, prefix, namespaces )
+ puts "--- Found namespace: #{prefix}"
+ namespaces[prefix] = ctx.namespaces[prefix]
+ end
+ end
end
diff --git a/test/rexml/test_light.rb b/test/rexml/test_light.rb
index 1b56159254..b775eb79e9 100644
--- a/test/rexml/test_light.rb
+++ b/test/rexml/test_light.rb
@@ -1,104 +1,106 @@
-require "rexml_test_utils"
+require_relative "rexml_test_utils"
require "rexml/light/node"
require "rexml/parsers/lightparser"
-class LightTester < Test::Unit::TestCase
- include REXMLTestUtils
- include REXML::Light
+module REXMLTests
+ class LightTester < Test::Unit::TestCase
+ include REXMLTestUtils
+ include REXML::Light
- def test_parse_large
- xml_string = fixture_path("documentation.xml")
- parser = REXML::Parsers::LightParser.new(xml_string)
- tag, content = parser.parse
- assert_equal([:document, :text], [tag, content.first])
- end
+ def test_parse_large
+ xml_string = fixture_path("documentation.xml")
+ parser = REXML::Parsers::LightParser.new(xml_string)
+ tag, content = parser.parse
+ assert_equal([:document, :text], [tag, content.first])
+ end
- # FIXME INCOMPLETE
- # This is because the light API is not yet ready to be used to produce
- # trees.
+ # FIXME INCOMPLETE
+ # This is because the light API is not yet ready to be used to produce
+ # trees.
=begin
- def test_add_element
- doc = Node.new
- foo = doc.add_element( 'foo' )
- assert_equal( "foo", foo.name )
- end
+ def test_add_element
+ doc = Node.new
+ foo = doc.add_element( 'foo' )
+ assert_equal( "foo", foo.name )
+ end
- def test_add_attribute
- foo = Node.new( "a" )
- foo["attr"] = "bar"
- assert_equal( "bar", foo["attr"] )
- end
+ def test_add_attribute
+ foo = Node.new( "a" )
+ foo["attr"] = "bar"
+ assert_equal( "bar", foo["attr"] )
+ end
- def test_write_document